mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +01:00
refactor: persist assistant repo in database with ID migration (#271)
This commit is contained in:
1 parent
0d384d6cf0
commit
8133b655b0
12 files changed
+188
-112
No files matched your search
@@ -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,
|
||||
})
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user