mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +01:00
* feat: discover local repos and reconnect OpenCode sessions Replace one-by-one local repo setup with parent-folder discovery and path-aware repo linking so first-time installs can recover existing OpenCode chats. Add first-run import support and onboarding docs for standalone OpenCode users, including Docker path-matching guidance. * fix: address session discovery review feedback * fix: improve delete/unlink messaging for local vs cloned repos * feat: discover local repos and reconnect OpenCode sessions (#158) --------- Co-authored-by: itz4blitz <justinscroggins@outlook.com> Co-authored-by: itz4blitz <60281870+itz4blitz@users.noreply.github.com>
52 lines
1.4 KiB
TypeScript
52 lines
1.4 KiB
TypeScript
import { z } from 'zod'
|
|
|
|
export const RepoStatusSchema = z.enum(['cloning', 'ready', 'error'])
|
|
|
|
export const RepoSchema = z.object({
|
|
id: z.number(),
|
|
repoUrl: z.string().url().optional(),
|
|
localPath: z.string(),
|
|
fullPath: z.string(),
|
|
sourcePath: z.string().optional(),
|
|
branch: z.string().optional(),
|
|
defaultBranch: z.string(),
|
|
cloneStatus: RepoStatusSchema,
|
|
clonedAt: z.number(),
|
|
lastPulled: z.number().optional(),
|
|
openCodeConfigName: z.string().optional(),
|
|
isWorktree: z.boolean().optional(),
|
|
isLocal: z.boolean().optional(),
|
|
})
|
|
|
|
export const CreateRepoRequestSchema = z.object({
|
|
repoUrl: z.string().url().optional(),
|
|
localPath: z.string().optional(),
|
|
branch: z.string().optional(),
|
|
openCodeConfigName: z.string().optional(),
|
|
useWorktree: z.boolean().optional(),
|
|
skipSSHVerification: z.boolean().optional(),
|
|
}).refine(
|
|
(data) => data.repoUrl || data.localPath,
|
|
{
|
|
message: "Either repoUrl or localPath must be provided",
|
|
path: ["repoUrl"],
|
|
}
|
|
)
|
|
|
|
export const DiscoverReposRequestSchema = z.object({
|
|
rootPath: z.string().trim().min(1),
|
|
maxDepth: z.number().int().min(0).max(8).optional(),
|
|
})
|
|
|
|
export const DiscoverReposResponseSchema = z.object({
|
|
repos: z.array(RepoSchema),
|
|
discoveredCount: z.number().int().nonnegative(),
|
|
existingCount: z.number().int().nonnegative(),
|
|
errors: z.array(
|
|
z.object({
|
|
path: z.string(),
|
|
error: z.string(),
|
|
})
|
|
),
|
|
})
|