mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
section 16: Phase 16: Documentation, container ports and full repository checks
This commit is contained in:
1 parent
81a9f0c8ef
commit
a383e57bc5
55 files changed
+4095
-59
No files matched your search
@@ -18,6 +18,10 @@ export const DEFAULTS = {
|
||||
HEALTH_FAILURE_THRESHOLD: 2,
|
||||
},
|
||||
|
||||
PREVIEW: {
|
||||
PORT: 5004,
|
||||
},
|
||||
|
||||
DATABASE: {
|
||||
PATH: './data/opencode.db',
|
||||
},
|
||||
|
||||
@@ -74,6 +74,11 @@ export const ENV = {
|
||||
LEGACY_PUBLIC_URL: getEnvString('OPENCODE_PUBLIC_URL', ''),
|
||||
},
|
||||
|
||||
PREVIEW: {
|
||||
PORT: getEnvNumber('PREVIEW_PORT', DEFAULTS.PREVIEW.PORT),
|
||||
PUBLIC_URL: getEnvString('PREVIEW_PUBLIC_URL', ''),
|
||||
},
|
||||
|
||||
DATABASE: {
|
||||
PATH: getEnvString('DATABASE_PATH', DEFAULTS.DATABASE.PATH),
|
||||
},
|
||||
|
||||
@@ -14,3 +14,4 @@ export * from './session-pins'
|
||||
export * from './logs'
|
||||
export * from './terminal'
|
||||
export * from './project-config'
|
||||
export * from './preview'
|
||||
@@ -0,0 +1,29 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
export const PreviewPortSchema = z.object({
|
||||
port: z.number().int(),
|
||||
host: z.enum(['127.0.0.1', '::1']),
|
||||
pid: z.number().int().nullable(),
|
||||
command: z.string().nullable(),
|
||||
cwd: z.string().nullable(),
|
||||
})
|
||||
|
||||
export const PreviewPortsResponseSchema = z.object({
|
||||
enabled: z.boolean(),
|
||||
ports: z.array(PreviewPortSchema),
|
||||
})
|
||||
|
||||
export const CreatePreviewSessionRequestSchema = z.object({
|
||||
port: z.number().int().min(1024).max(65535),
|
||||
})
|
||||
|
||||
export const CreatePreviewSessionResponseSchema = z.object({
|
||||
token: z.string(),
|
||||
previewPort: z.number().int(),
|
||||
publicUrl: z.string().nullable(),
|
||||
})
|
||||
|
||||
export type PreviewPort = z.infer<typeof PreviewPortSchema>
|
||||
export type PreviewPortsResponse = z.infer<typeof PreviewPortsResponseSchema>
|
||||
export type CreatePreviewSessionRequest = z.infer<typeof CreatePreviewSessionRequestSchema>
|
||||
export type CreatePreviewSessionResponse = z.infer<typeof CreatePreviewSessionResponseSchema>
|
||||
@@ -93,6 +93,17 @@ export const RunProjectActionResponseSchema = z.object({
|
||||
autoOpenUrl: z.boolean(),
|
||||
})
|
||||
|
||||
export const WorktreeSetupResultSchema = z.discriminatedUnion('status', [
|
||||
z.object({ status: z.literal('none') }),
|
||||
z.object({
|
||||
status: z.literal('started'),
|
||||
terminal: TerminalInfoSchema,
|
||||
repoCommandsSkipped: z.boolean(),
|
||||
}),
|
||||
z.object({ status: z.literal('skipped'), reason: z.literal('untrusted') }),
|
||||
z.object({ status: z.literal('failed'), error: z.string() }),
|
||||
])
|
||||
|
||||
export type ProjectActionIcon = z.infer<typeof ProjectActionIconSchema>
|
||||
export type ProjectAction = z.infer<typeof ProjectActionSchema>
|
||||
export type WorktreeSetupCommands = z.infer<typeof WorktreeSetupCommandsSchema>
|
||||
@@ -105,3 +116,4 @@ export type TrustRepoConfigRequest = z.infer<typeof TrustRepoConfigRequestSchema
|
||||
export type MoveProjectItemRequest = z.infer<typeof MoveProjectItemRequestSchema>
|
||||
export type RunProjectActionRequest = z.infer<typeof RunProjectActionRequestSchema>
|
||||
export type RunProjectActionResponse = z.infer<typeof RunProjectActionResponseSchema>
|
||||
export type WorktreeSetupResult = z.infer<typeof WorktreeSetupResultSchema>
|
||||
@@ -166,6 +166,13 @@ export type {
|
||||
ResizeTerminalRequest,
|
||||
} from '../schemas/terminal'
|
||||
|
||||
export type {
|
||||
PreviewPort,
|
||||
PreviewPortsResponse,
|
||||
CreatePreviewSessionRequest,
|
||||
CreatePreviewSessionResponse,
|
||||
} from '../schemas/preview'
|
||||
|
||||
export type {
|
||||
ProjectActionIcon,
|
||||
ProjectAction,
|
||||
@@ -179,4 +186,5 @@ export type {
|
||||
MoveProjectItemRequest,
|
||||
RunProjectActionRequest,
|
||||
RunProjectActionResponse,
|
||||
WorktreeSetupResult,
|
||||
} from '../schemas/project-config'
|
||||
Reference in new issue
Block a user