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:
Chris Scott authored and GitHub committed 2026-06-28 14:49:00 -04:00
1 parent 01e50a7019
commit 6a4e8734f9
33 files changed
+535 -84

No files matched your search

@@ -24,9 +24,13 @@ vi.mock('bun:sqlite', () => ({
}))
const mockListRepos = vi.fn()
vi.mock('../../src/db/queries', () => ({
listRepos: (...args: unknown[]) => mockListRepos(...args),
}))
vi.mock('../../src/db/queries', async () => {
const { getRepoDisplayName } = await vi.importActual<typeof import('@opencode-manager/shared/utils')>('@opencode-manager/shared/utils')
return {
listRepos: (...args: unknown[]) => mockListRepos(...args),
getRepoName: (repo: Parameters<typeof getRepoDisplayName>[0]) => getRepoDisplayName(repo),
}
})
vi.mock('../../src/db/migration-runner', () => ({
migrate: vi.fn(),
+18 -14
View File
@@ -16,19 +16,23 @@ vi.mock('@opencode-manager/shared/config/env', async (importOriginal) => {
}
})
vi.mock('../../src/db/queries', () => ({
getRepoById: vi.fn(),
listRepos: vi.fn(() => []),
getRepoByUrlAndBranch: vi.fn(),
getRepoByLocalPath: vi.fn(),
getRepoBySourcePath: vi.fn(),
createRepo: vi.fn(),
updateRepoStatus: vi.fn(),
updateRepoConfigName: vi.fn(),
updateLastPulled: vi.fn(),
updateRepoBranch: vi.fn(),
deleteRepo: vi.fn(),
}))
vi.mock('../../src/db/queries', async () => {
const { getRepoDisplayName } = await vi.importActual<typeof import('@opencode-manager/shared/utils')>('@opencode-manager/shared/utils')
return {
getRepoById: vi.fn(),
listRepos: vi.fn(() => []),
getRepoByUrlAndBranch: vi.fn(),
getRepoByLocalPath: vi.fn(),
getRepoBySourcePath: vi.fn(),
createRepo: vi.fn(),
updateRepoStatus: vi.fn(),
updateRepoConfigName: vi.fn(),
updateLastPulled: vi.fn(),
updateRepoBranch: vi.fn(),
deleteRepo: vi.fn(),
getRepoName: (repo: Parameters<typeof getRepoDisplayName>[0]) => getRepoDisplayName(repo),
}
})
function createMockClient(skills: Array<{ name: string; description: string; location: string; content: string }>): OpenCodeClient {
return {
@@ -332,7 +336,7 @@ describe('SkillService', () => {
description: 'Helps project work',
scope: 'project',
repoId: repo.id,
repoName: 'Project Zero',
repoName: 'project-zero',
}))
}
})