diff --git a/assets/help/bootstrap-plan.schema.json b/assets/help/bootstrap-plan.schema.json new file mode 100644 index 000000000..d499bd177 --- /dev/null +++ b/assets/help/bootstrap-plan.schema.json @@ -0,0 +1,127 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/dev/assets/help/bootstrap-plan.schema.json", + "title": "Bootstrap Plan", + "description": "JSON schema for oh-my-openagent bootstrap plan output", + "type": "object", + "properties": { + "plan": { + "type": "object", + "properties": { + "version": { + "type": "string", + "description": "Plan version" + }, + "createdAt": { + "type": "number", + "description": "Plan creation timestamp (epoch ms)" + }, + "completedAt": { + "description": "Completion timestamp (epoch ms)", + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ] + }, + "totalSteps": { + "type": "number", + "description": "Total number of steps" + }, + "completedSteps": { + "type": "number", + "description": "Number of completed steps" + }, + "steps": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Step identifier" + }, + "title": { + "type": "string", + "description": "Step display title" + }, + "description": { + "type": "string", + "description": "Step description" + }, + "status": { + "type": "string", + "enum": [ + "pending", + "in_progress", + "completed", + "skipped", + "failed" + ], + "description": "Step execution status" + }, + "duration": { + "description": "Step execution duration in ms", + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ] + }, + "error": { + "description": "Error message if failed", + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "id", + "title", + "description", + "status" + ], + "additionalProperties": false, + "ref": "BootstrapStep" + }, + "description": "Bootstrap steps" + }, + "summary": { + "description": "Overall summary of the bootstrap plan", + "type": "string" + } + }, + "required": [ + "version", + "createdAt", + "totalSteps", + "completedSteps", + "steps" + ], + "additionalProperties": false, + "ref": "BootstrapPlan", + "description": "The bootstrap plan" + }, + "timestamp": { + "type": "number", + "description": "Snapshot timestamp (epoch ms)" + } + }, + "required": [ + "plan", + "timestamp" + ], + "additionalProperties": false, + "ref": "BootstrapPlanResult" +} \ No newline at end of file diff --git a/script/build-help-schemas.ts b/script/build-help-schemas.ts index b68b96169..71cc2de4f 100644 --- a/script/build-help-schemas.ts +++ b/script/build-help-schemas.ts @@ -4,6 +4,7 @@ import { DoctorResultSchema as DoctorSchema } from "../src/help/schema/doctor" import { StatusResultSchema as StatusSchema } from "../src/help/schema/status" import { SandboxResultSchema as SandboxSchema } from "../src/help/schema/sandbox" import { AcpResultSchema as AcpSchema } from "../src/help/schema/acp" +import { BootstrapPlanResultSchema as BootstrapPlanSchema } from "../src/help/schema/bootstrap-plan" const SCHEMA_OUTPUT_DIR = "assets/help" @@ -62,6 +63,14 @@ const SCHEMAS: SchemaEntry[] = [ title: "ACP Server Status", description: "JSON schema for oh-my-openagent Agent Control Protocol server output", id: "https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/dev/assets/help/acp.schema.json", + id: "https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/dev/assets/help/acp.schema.json", + }, + { + name: "bootstrap-plan", + schema: BootstrapPlanSchema, + title: "Bootstrap Plan", + description: "JSON schema for oh-my-openagent bootstrap plan output", + id: "https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/dev/assets/help/bootstrap-plan.schema.json", }, ] diff --git a/src/help/schema/bootstrap-plan.ts b/src/help/schema/bootstrap-plan.ts new file mode 100644 index 000000000..928bee78f --- /dev/null +++ b/src/help/schema/bootstrap-plan.ts @@ -0,0 +1,29 @@ +import { z } from "zod" + +export const BootstrapStepSchema = z.object({ + id: z.string().describe("Step identifier"), + title: z.string().describe("Step display title"), + description: z.string().describe("Step description"), + status: z.enum(["pending", "in_progress", "completed", "skipped", "failed"]).describe("Step execution status"), + duration: z.number().nullable().optional().describe("Step execution duration in ms"), + error: z.string().nullable().optional().describe("Error message if failed"), +}).meta({ ref: "BootstrapStep" }) + +export const BootstrapPlanSchema = z.object({ + version: z.string().describe("Plan version"), + createdAt: z.number().describe("Plan creation timestamp (epoch ms)"), + completedAt: z.number().nullable().optional().describe("Completion timestamp (epoch ms)"), + totalSteps: z.number().describe("Total number of steps"), + completedSteps: z.number().describe("Number of completed steps"), + steps: z.array(BootstrapStepSchema).describe("Bootstrap steps"), + summary: z.string().optional().describe("Overall summary of the bootstrap plan"), +}).meta({ ref: "BootstrapPlan" }) + +export const BootstrapPlanResultSchema = z.object({ + plan: BootstrapPlanSchema.describe("The bootstrap plan"), + timestamp: z.number().describe("Snapshot timestamp (epoch ms)"), +}).meta({ ref: "BootstrapPlanResult" }) + +export type BootstrapStep = z.infer +export type BootstrapPlan = z.infer +export type BootstrapPlanResult = z.infer