mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
feat: add bundle-based OCM mirror sync (#289)
* feat: add bundle-based OCM mirror sync * feat: add OpenCode model editor and HEAD-safe bundle import * fix: consolidate discovery-cache, batch bundle refs, remove dead code (#290) * fix: consolidate discovery-cache, batch bundle refs, remove dead code * refactor: consolidate discovery cache into generic discoverCached, extract spawnGit helper * feat: extract project-id-resolver, add CLI full-fallback prompt, wire lint into root scripts - Extract shared project-id-resolver for origin URL matching (replaces local-repo duplicates) - Add promptYesNo / confirmFullFallback to ocm CLI before slow full mirror - Backend: consolidate opencode-workspaces routes with project-id-resolver - Frontend: fix schedules prompt/global page navigation - CLI: add eslint config, lint/lint:fix scripts, fix no-fallthrough in ocm.ts - Root: wire CLI into build, test, typecheck, lint, lint:fix chains - Fix test lint issues (_code, const, require→import) * fix: replace polynomial regex with linear-time string ops in gitRemoteParts * feat: add divergence guards for push/pull, streaming bundle upload, server-side ancestry check - Backend: GET /:repoId/mirror/head (head+branch+dirty) and GET /:repoId/mirror/contains/:sha (ancestry check) - CLI: checkPushDivergence warns before overwriting server commits; checkPullDivergence warns before discarding local commits; both require confirm or --force - Bundle upload now streams from disk instead of buffering entire file in memory - Version visible in --help and default (no-arg) output - Version bump 0.1.5 → 0.2.0 * fix: show connecting message before fetching repos in default command * fix: update default command messages to reflect actual matching behavior
This commit is contained in:
1 parent
bb1df259b6
commit
01e50a7019
34 files changed
+2060
-316
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import { Hono } from 'hono'
|
||||
import type { Database } from 'bun:sqlite'
|
||||
import { listRepos } from '../../db/queries'
|
||||
import { resolveProjectId } from '../../services/project-id-resolver'
|
||||
import { logger } from '../../utils/logger'
|
||||
import { getErrorMessage } from '../../utils/error-utils'
|
||||
import path from 'path'
|
||||
@@ -8,12 +9,11 @@ import path from 'path'
|
||||
export function createInternalOpenCodeWorkspacesRoutes(db: Database) {
|
||||
const app = new Hono()
|
||||
|
||||
app.get('/', (c) => {
|
||||
app.get('/', async (c) => {
|
||||
try {
|
||||
const repos = listRepos(db)
|
||||
const workspaces = repos
|
||||
.filter((repo) => repo.cloneStatus === 'ready')
|
||||
.map((repo) => ({
|
||||
const repos = listRepos(db).filter((repo) => repo.cloneStatus === 'ready')
|
||||
const workspaces = await Promise.all(
|
||||
repos.map(async (repo) => ({
|
||||
repoId: repo.id,
|
||||
name: repo.repoUrl
|
||||
? repo.repoUrl.split('/').slice(-1)[0]?.replace('.git', '') || repo.localPath
|
||||
@@ -24,12 +24,14 @@ export function createInternalOpenCodeWorkspacesRoutes(db: Database) {
|
||||
cloneStatus: repo.cloneStatus,
|
||||
directory: repo.fullPath,
|
||||
originUrl: repo.repoUrl ?? null,
|
||||
projectId: await resolveProjectId(repo.fullPath).catch(() => null),
|
||||
extra: {
|
||||
repoId: repo.id,
|
||||
localPath: repo.localPath,
|
||||
fullPath: repo.fullPath,
|
||||
},
|
||||
}))
|
||||
})),
|
||||
)
|
||||
return c.json({ workspaces })
|
||||
} catch (error) {
|
||||
logger.error('Failed to list opencode workspaces:', error)
|
||||
|
||||
Reference in new issue
Block a user