mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
feat: add repo rename capability with custom name field (#294)
* feat: add repo rename capability with custom name field Add a custom name field to repos, allowing users to set a display name independent of the repo URL or path. Includes a migration, PATCH endpoint, rename dialog, and display name consolidation. - DB migration 014 adds name column to repos table - PATCH /api/repos/:id endpoint with Zod validation - RenameRepoDialog component with clear/reset support - RepoRowActions gains Rename action in both dropdown and inline modes - getRepoDisplayName() consolidated to accept a repo object and prefer name - All repo name display call sites updated to use the new API * fix: add DialogTitle to RenameRepoDialog for a11y compliance * refactor: extract getRepoDisplayName to shared utils, fix schedule cache invalidation on rename
This commit is contained in:
1 parent
01e50a7019
commit
6a4e8734f9
33 files changed
+535
-84
No files matched your search
@@ -14,7 +14,7 @@ import {
|
||||
} from "@opencode-manager/shared/notifications";
|
||||
import { SettingsService } from "./settings";
|
||||
import { sseAggregator, type SSEEvent } from "./sse-aggregator";
|
||||
import { getRepoByLocalPath, getRepoBySourcePath } from "../db/queries";
|
||||
import { getRepoByLocalPath, getRepoBySourcePath, getRepoName } from "../db/queries";
|
||||
import { getReposPath } from "@opencode-manager/shared/config/env";
|
||||
import path from "path";
|
||||
|
||||
@@ -271,7 +271,7 @@ export class NotificationService {
|
||||
|
||||
if (repo) {
|
||||
repoId = repo.id;
|
||||
repoName = path.basename(repo.localPath);
|
||||
repoName = getRepoName(repo);
|
||||
notificationUrl = sessionId
|
||||
? `/repos/${repo.id}/sessions/${sessionId}`
|
||||
: `/repos/${repo.id}`;
|
||||
|
||||
@@ -5,7 +5,7 @@ import type { Database } from 'bun:sqlite'
|
||||
import type { SkillFileInfo, SkillScope, CreateSkillRequest, UpdateSkillRequest, InstallSkillUploadRequest, InstallSkillFromGithubRequest, InstallSkillResponse } from '@opencode-manager/shared'
|
||||
import { SKILL_NAME_REGEX, SkillFrontmatterSchema } from '@opencode-manager/shared'
|
||||
import { getWorkspacePath, FILE_LIMITS } from '@opencode-manager/shared/config/env'
|
||||
import { getRepoById, listRepos } from '../db/queries'
|
||||
import { getRepoById, getRepoName, listRepos } from '../db/queries'
|
||||
import type { Repo } from '@opencode-manager/shared/types'
|
||||
import { ensureDirectoryExists, fileExists, readFileContent, writeFileContent, deletePath, listDirectory, normalizeUploadRelativePath, resolveWithinDirectory } from './file-operations'
|
||||
import type { OpenCodeClient } from './opencode/client'
|
||||
@@ -161,7 +161,7 @@ async function installSkillFiles(
|
||||
scope: input.scope,
|
||||
location: skillPath,
|
||||
repoId: input.scope === 'project' ? input.repoId : undefined,
|
||||
repoName: repo?.localPath,
|
||||
repoName: repo ? getRepoName(repo) : undefined,
|
||||
},
|
||||
overwritten: Boolean(existingTarget),
|
||||
sourceType: input.sourceType,
|
||||
@@ -434,7 +434,7 @@ function toSkillFileInfo(
|
||||
scope: classification.scope,
|
||||
location: skill.location,
|
||||
repoId: classification.repo?.id,
|
||||
repoName: classification.repo?.localPath,
|
||||
repoName: classification.repo ? getRepoName(classification.repo) : undefined,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -468,7 +468,7 @@ async function scanSkillRoot(root: string, scope: SkillScope, repo?: Repo): Prom
|
||||
scope,
|
||||
location: skillPath,
|
||||
repoId: scope === 'project' ? repo?.id : undefined,
|
||||
repoName: scope === 'project' ? repo?.localPath : undefined,
|
||||
repoName: scope === 'project' && repo ? getRepoName(repo) : undefined,
|
||||
}
|
||||
} catch (error) {
|
||||
logger.warn(`Failed to read skill at ${skillPath}:`, error)
|
||||
@@ -597,7 +597,7 @@ export async function createSkill(
|
||||
scope,
|
||||
location: skillPath,
|
||||
repoId: scope === 'project' ? repoId : undefined,
|
||||
repoName: repo?.localPath,
|
||||
repoName: repo ? getRepoName(repo) : undefined,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user