refactor: persist assistant repo in database with ID migration (#271)

This commit is contained in:
Chris Scott authored and GitHub committed 2026-06-09 14:46:39 -04:00
1 parent 0d384d6cf0
commit 8133b655b0
12 files changed
+188 -112

No files matched your search

+4 -1
View File
@@ -17,6 +17,7 @@ import { ASSISTANT_REPO_ID, ASSISTANT_REPO_PATH } from '@opencode-manager/shared
import { getReposPath, ENV } from '@opencode-manager/shared/config/env'
import type { Database } from 'bun:sqlite'
import { getOrCreateInternalToken } from './internal-token'
import { ensureAssistantRepo } from '../db/queries'
const ASSISTANT_MODE_DIR = ASSISTANT_REPO_PATH
@@ -1081,7 +1082,9 @@ export async function installAssistantWorkspace(deps: {
db: Database
apiBaseUrl: string
}): Promise<AssistantModeStatus> {
return ensureAssistantMode(buildAssistantRepo(), {
const assistantRepo = ensureAssistantRepo(deps.db)
return ensureAssistantMode(assistantRepo, {
db: deps.db,
apiBaseUrl: deps.apiBaseUrl,
})
+2
View File
@@ -1080,6 +1080,8 @@ export class ScheduleService {
private assertRepo(repoId: number) {
if (repoId === ASSISTANT_REPO_ID) {
const repo = getRepoById(this.db, ASSISTANT_REPO_ID)
if (repo) return repo
return { ...buildAssistantRepo(), lastAccessedAt: Date.now(), isLocal: true, currentBranch: undefined }
}
const repo = getRepoById(this.db, repoId)