@wizdear/atlas-code 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-factory.d.ts +8 -1
- package/dist/agent-factory.d.ts.map +1 -1
- package/dist/agent-factory.js +42 -2
- package/dist/agent-factory.js.map +1 -1
- package/dist/cli.d.ts +7 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +8 -0
- package/dist/cli.js.map +1 -1
- package/dist/discovery.d.ts +9 -0
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +4 -4
- package/dist/discovery.js.map +1 -1
- package/dist/extension.d.ts +9 -2
- package/dist/extension.d.ts.map +1 -1
- package/dist/extension.js +1096 -333
- package/dist/extension.js.map +1 -1
- package/dist/gate.d.ts +1 -1
- package/dist/gate.d.ts.map +1 -1
- package/dist/gate.js.map +1 -1
- package/dist/orchestrator.d.ts +0 -2
- package/dist/orchestrator.d.ts.map +1 -1
- package/dist/orchestrator.js +0 -1
- package/dist/orchestrator.js.map +1 -1
- package/dist/pipeline-editor.d.ts +2 -0
- package/dist/pipeline-editor.d.ts.map +1 -1
- package/dist/pipeline-editor.js +36 -5
- package/dist/pipeline-editor.js.map +1 -1
- package/dist/pipeline.d.ts +2 -5
- package/dist/pipeline.d.ts.map +1 -1
- package/dist/pipeline.js +4 -3
- package/dist/pipeline.js.map +1 -1
- package/dist/planner.d.ts +9 -0
- package/dist/planner.d.ts.map +1 -1
- package/dist/planner.js +20 -10
- package/dist/planner.js.map +1 -1
- package/dist/roles/architect.d.ts +1 -1
- package/dist/roles/architect.d.ts.map +1 -1
- package/dist/roles/architect.js +1 -1
- package/dist/roles/architect.js.map +1 -1
- package/dist/roles/documenter.d.ts +1 -1
- package/dist/roles/documenter.d.ts.map +1 -1
- package/dist/roles/documenter.js +11 -0
- package/dist/roles/documenter.js.map +1 -1
- package/dist/roles/index.d.ts +1 -0
- package/dist/roles/index.d.ts.map +1 -1
- package/dist/roles/index.js +3 -0
- package/dist/roles/index.js.map +1 -1
- package/dist/roles/recover.d.ts +5 -0
- package/dist/roles/recover.d.ts.map +1 -0
- package/dist/roles/recover.js +82 -0
- package/dist/roles/recover.js.map +1 -0
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +6 -6
- package/dist/router.js.map +1 -1
- package/dist/standards.d.ts.map +1 -1
- package/dist/standards.js +1 -0
- package/dist/standards.js.map +1 -1
- package/dist/step-executor.d.ts +2 -0
- package/dist/step-executor.d.ts.map +1 -1
- package/dist/step-executor.js +16 -4
- package/dist/step-executor.js.map +1 -1
- package/dist/store.d.ts +3 -0
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +48 -19
- package/dist/store.js.map +1 -1
- package/dist/system-architect.d.ts +9 -0
- package/dist/system-architect.d.ts.map +1 -1
- package/dist/system-architect.js +11 -9
- package/dist/system-architect.js.map +1 -1
- package/dist/telegram/bridge.d.ts +39 -0
- package/dist/telegram/bridge.d.ts.map +1 -0
- package/dist/telegram/bridge.js +380 -0
- package/dist/telegram/bridge.js.map +1 -0
- package/dist/telegram/formatter.d.ts +15 -0
- package/dist/telegram/formatter.d.ts.map +1 -0
- package/dist/telegram/formatter.js +86 -0
- package/dist/telegram/formatter.js.map +1 -0
- package/dist/telegram/renderer.d.ts +45 -0
- package/dist/telegram/renderer.d.ts.map +1 -0
- package/dist/telegram/renderer.js +150 -0
- package/dist/telegram/renderer.js.map +1 -0
- package/dist/telegram/telegram-api.d.ts +84 -0
- package/dist/telegram/telegram-api.d.ts.map +1 -0
- package/dist/telegram/telegram-api.js +134 -0
- package/dist/telegram/telegram-api.js.map +1 -0
- package/dist/types.d.ts +10 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/ui.d.ts +1 -1
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +2 -0
- package/dist/ui.js.map +1 -1
- package/package.json +1 -1
package/dist/planner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
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AC,IAAI,CAAC,YAAY,CAAC,CAAC;QACzB,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAC9B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,mEAAmE,CAAC,CAAC;IAChF,KAAK,CAAC,IAAI,CAAC,sEAAsE,CAAC,CAAC;IACnF,KAAK,CAAC,IAAI,CAAC,2DAA2D,CAAC,CAAC;IACxE,KAAK,CAAC,IAAI,CAAC,6DAA6D,CAAC,CAAC;IAC1E,KAAK,CAAC,IAAI,CAAC,kDAAkD,CAAC,CAAC;IAC/D,KAAK,CAAC,IAAI,CAAC,yEAAyE,CAAC,CAAC;IAEtF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAAA,CACxB","sourcesContent":["import type { Agent, AgentEvent } from \"@mariozechner/pi-agent-core\";\nimport type { Model } from \"@mariozechner/pi-ai\";\nimport type { GetApiKeyFn } from \"./agent-factory.js\";\nimport { createRoleAgent, runAgent } from \"./agent-factory.js\";\nimport { getSystemPromptForRole } from \"./roles/index.js\";\nimport { extractArtifactContent } from \"./step-executor.js\";\nimport type { VibeStore } from \"./store.js\";\nimport type { PlanData, VibeConfig } from \"./types.js\";\n\n// ─── Types ───────────────────────────────────────────────────────────────────\n\n/** Planner execution options */\nexport interface PlannerOptions {\n\tstore: VibeStore;\n\tconfig: VibeConfig;\n\tprojectRoot: string;\n\tgetApiKey?: GetApiKeyFn;\n\t/** Model to use. Uses the Agent's default model if not specified. */\n\tmodel?: Model<any>;\n\t/** Agent event callback. Used for progress display, etc. */\n\tonAgentEvent?: (event: AgentEvent) => void;\n\t/** Callback to relay agent messages externally */\n\tonMessage?: (message: string) => void;\n\t/** User feedback on rejection. Regenerates the existing plan with feedback applied. */\n\tfeedback?: string;\n\t/** Lightweight skill index. Included in the agent system prompt. */\n\tavailableSkills?: string;\n\t/** Callback invoked when the agent is created. Used for abort wiring, etc. */\n\tonAgentCreated?: (agent: Agent) => void;\n\t/** Callback invoked when the agent finishes execution. */\n\tonAgentFinished?: () => void;\n}\n\n/** Planner execution result */\nexport interface PlannerResult {\n\t/** Whether plan.json was generated */\n\tcompleted: boolean;\n\t/** Number of decomposed features */\n\tfeatureCount: number;\n}\n\n// ─── Planner Runner ──────────────────────────────────────────────────────────\n\n/**\n * Runs the Planner Agent to generate plan.json and spec.md for each feature\n * based on requirements.md and project-context.md.\n *\n * 1. Load requirements.md and project-context.md from the store\n * 2. Create Planner Agent (readonly — extracts artifacts from response)\n * 3. Run the agent\n * 4. Extract plan.json from the response → save to store\n * 5. Extract each feature's spec.md → save to store\n */\nexport async function runPlanner(options: PlannerOptions): Promise<PlannerResult> {\n\tconst { store, config, projectRoot, getApiKey, model, onAgentEvent, onMessage, feedback } = options;\n\n\t// 1. Load inputs\n\tlet requirements: string | undefined;\n\tif (await store.hasRequirements()) {\n\t\trequirements = await store.readRequirements();\n\t}\n\n\tlet projectContext: string | undefined;\n\tif (await store.hasProjectContext()) {\n\t\tprojectContext = await store.readProjectContext();\n\t}\n\n\tlet impactReport: string | undefined;\n\tif (await store.hasGlobalArtifact(\"impact-report.md\")) {\n\t\timpactReport = await store.readGlobalArtifact(\"impact-report.md\");\n\t}\n\n\t// 2. Combine context\n\tconst featureContext = buildPlannerContext(requirements, projectContext, impactReport);\n\n\t// 3. Create Agent\n\tconst systemPrompt = getSystemPromptForRole(\"planner\");\n\tconst agent = await createRoleAgent({\n\t\trole: \"planner\",\n\t\tsystemPrompt,\n\t\tconfig,\n\t\tprojectRoot,\n\t\tmodel,\n\t\tfeatureContext: featureContext || undefined,\n\t\tgetApiKey,\n\t\tavailableSkills: options.availableSkills,\n\t});\n\n\t// Notify external code that the agent has been created (for abort wiring)\n\toptions.onAgentCreated?.(agent);\n\n\t// 4. Build prompt and execute\n\ttry {\n\t\tlet prompt: string;\n\t\tif (feedback) {\n\t\t\tprompt =\n\t\t\t\t`The previous plan was rejected with the following feedback:\\n\\n${feedback}\\n\\n` +\n\t\t\t\t\"Please revise the plan based on this feedback.\\n\\n\" +\n\t\t\t\tbuildPlannerPrompt(requirements, projectContext, impactReport);\n\t\t} else {\n\t\t\tprompt = buildPlannerPrompt(requirements, projectContext, impactReport);\n\t\t}\n\t\tconst response = await runAgent(agent, prompt, onAgentEvent ? { onEvent: onAgentEvent } : undefined);\n\t\tonMessage?.(response);\n\n\t\t// 5. Extract and save plan.json\n\t\tconst planContent = extractArtifactContent(response, \"plan.json\", false);\n\t\tif (!planContent) {\n\t\t\treturn { completed: false, featureCount: 0 };\n\t\t}\n\n\t\tlet plan: PlanData;\n\t\ttry {\n\t\t\tplan = JSON.parse(planContent) as PlanData;\n\t\t} catch {\n\t\t\treturn { completed: false, featureCount: 0 };\n\t\t}\n\n\t\tawait store.savePlan(plan);\n\n\t\t// 6. Extract and save each feature's spec.md\n\t\tfor (const feature of plan.features) {\n\t\t\tconst specContent = extractArtifactContent(response, `${feature.featureId}/spec.md`, false);\n\t\t\tif (specContent) {\n\t\t\t\tawait store.writeArtifact(feature.featureId, \"spec.md\", specContent);\n\t\t\t}\n\t\t}\n\n\t\treturn { completed: true, featureCount: plan.features.length };\n\t} catch (error) {\n\t\t// Interruption by agent.abort(): \"Request was aborted\" error\n\t\tconst msg = error instanceof Error ? error.message : String(error);\n\t\tif (msg.includes(\"aborted\")) {\n\t\t\treturn { completed: false, featureCount: 0 };\n\t\t}\n\t\tthrow error;\n\t} finally {\n\t\toptions.onAgentFinished?.();\n\t}\n}\n\n// ─── Context & Prompt Builders ───────────────────────────────────────────────\n\nfunction buildPlannerContext(requirements?: string, projectContext?: string, impactReport?: string): string {\n\tconst parts: string[] = [];\n\n\tif (requirements) {\n\t\tparts.push(\"## Requirements\\n\");\n\t\tparts.push(requirements);\n\t}\n\n\tif (projectContext) {\n\t\tparts.push(\"## Project Context\\n\");\n\t\tparts.push(projectContext);\n\t}\n\n\tif (impactReport) {\n\t\tparts.push(\"## Impact Report\\n\");\n\t\tparts.push(impactReport);\n\t}\n\n\treturn parts.join(\"\\n\\n\");\n}\n\nfunction buildPlannerPrompt(requirements?: string, projectContext?: string, impactReport?: string): string {\n\tconst parts: string[] = [];\n\n\tparts.push(\"Analyze the following inputs and decompose the requirements into features.\");\n\tparts.push(\"\");\n\n\tif (requirements) {\n\t\tparts.push(\"## Requirements Document\");\n\t\tparts.push(\"\");\n\t\tparts.push(requirements);\n\t\tparts.push(\"\");\n\t} else {\n\t\tparts.push(\"Note: No requirements.md found. Use the project context to create a reasonable plan.\");\n\t\tparts.push(\"\");\n\t}\n\n\tif (projectContext) {\n\t\tparts.push(\"## Project Context\");\n\t\tparts.push(\"\");\n\t\tparts.push(projectContext);\n\t\tparts.push(\"\");\n\t}\n\n\tif (impactReport) {\n\t\tparts.push(\"## Impact Report\");\n\t\tparts.push(\"\");\n\t\tparts.push(\n\t\t\t\"The following impact analysis was performed on the existing codebase. Use it to inform feature decomposition, dependency ordering, and risk assessment.\",\n\t\t);\n\t\tparts.push(\"\");\n\t\tparts.push(impactReport);\n\t\tparts.push(\"\");\n\t}\n\n\tparts.push(\"## Instructions\");\n\tparts.push(\"\");\n\tparts.push(\"1. Decompose the requirements into independent, testable features\");\n\tparts.push(\"2. Map each feature to requirement IDs (FR-xxx) from requirements.md\");\n\tparts.push(\"3. Estimate complexity (low/medium/high) for each feature\");\n\tparts.push(\"4. Define dependency relationships and organize into phases\");\n\tparts.push(\"5. Output plan.json in a ```plan.json code block\");\n\tparts.push(\"6. Output each feature's spec.md in a ```{featureId}/spec.md code block\");\n\n\treturn parts.join(\"\\n\");\n}\n"]}
|
|
1
|
+
{"version":3,"file":"planner.js","sourceRoot":"","sources":["../src/planner.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AA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AAC,kBAAkB,CAAC,CAAC;QAC/B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,IAAI,CACT,yJAAyJ,CACzJ,CAAC;QACF,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACzB,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAC9B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,mEAAmE,CAAC,CAAC;IAChF,KAAK,CAAC,IAAI,CAAC,sEAAsE,CAAC,CAAC;IACnF,KAAK,CAAC,IAAI,CAAC,2DAA2D,CAAC,CAAC;IACxE,KAAK,CAAC,IAAI,CAAC,6DAA6D,CAAC,CAAC;IAC1E,KAAK,CAAC,IAAI,CAAC,kDAAkD,CAAC,CAAC;IAC/D,KAAK,CAAC,IAAI,CAAC,yEAAyE,CAAC,CAAC;IAEtF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAAA,CACxB","sourcesContent":["import type { Agent, AgentEvent } from \"@mariozechner/pi-agent-core\";\nimport type { Model } from \"@mariozechner/pi-ai\";\nimport type { GetApiKeyFn } from \"./agent-factory.js\";\nimport { createRoleAgent, runAgent } from \"./agent-factory.js\";\nimport { getSystemPromptForRole } from \"./roles/index.js\";\nimport { aggregateUsage, extractArtifactContent } from \"./step-executor.js\";\nimport type { VibeStore } from \"./store.js\";\nimport type { PlanData, VibeConfig } from \"./types.js\";\n\n// ─── Types ───────────────────────────────────────────────────────────────────\n\n/** Planner execution options */\nexport interface PlannerOptions {\n\tstore: VibeStore;\n\tconfig: VibeConfig;\n\tprojectRoot: string;\n\tgetApiKey?: GetApiKeyFn;\n\t/** Model to use. Uses the Agent's default model if not specified. */\n\tmodel?: Model<any>;\n\t/** Agent event callback. Used for progress display, etc. */\n\tonAgentEvent?: (event: AgentEvent) => void;\n\t/** Callback to relay agent messages externally */\n\tonMessage?: (message: string) => void;\n\t/** User feedback on rejection. Regenerates the existing plan with feedback applied. */\n\tfeedback?: string;\n\t/** Lightweight skill index. Included in the agent system prompt. */\n\tavailableSkills?: string;\n\t/** Callback invoked when the agent is created. Used for abort wiring, etc. */\n\tonAgentCreated?: (agent: Agent) => void;\n\t/** Callback invoked when the agent finishes execution. */\n\tonAgentFinished?: () => void;\n}\n\n/** Planner execution result */\nexport interface PlannerResult {\n\t/** Whether plan.json was generated */\n\tcompleted: boolean;\n\t/** Number of decomposed features */\n\tfeatureCount: number;\n\t/** Aggregated token usage. */\n\tusage?: { input: number; output: number; cacheRead: number; cacheWrite: number; totalTokens: number; cost: number };\n}\n\n// ─── Planner Runner ──────────────────────────────────────────────────────────\n\n/**\n * Runs the Planner Agent to generate plan.json and spec.md for each feature\n * based on requirements.md and project-context.md.\n *\n * 1. Load requirements.md and project-context.md from the store\n * 2. Create Planner Agent (readonly — extracts artifacts from response)\n * 3. Run the agent\n * 4. Extract plan.json from the response → save to store\n * 5. Extract each feature's spec.md → save to store\n */\nexport async function runPlanner(options: PlannerOptions): Promise<PlannerResult> {\n\tconst { store, config, projectRoot, getApiKey, model, onAgentEvent, onMessage, feedback } = options;\n\n\t// 1. Load inputs\n\tlet requirements: string | undefined;\n\tif (await store.hasRequirements()) {\n\t\trequirements = await store.readRequirements();\n\t}\n\n\tlet projectContext: string | undefined;\n\tif (await store.hasProjectContext()) {\n\t\tprojectContext = await store.readProjectContext();\n\t}\n\n\tlet impactReport: string | undefined;\n\tif (await store.hasGlobalArtifact(\"impact-report.md\")) {\n\t\timpactReport = await store.readGlobalArtifact(\"impact-report.md\");\n\t}\n\n\tlet systemDesign: string | undefined;\n\tif (await store.hasSystemDesign()) {\n\t\tsystemDesign = await store.readSystemDesign();\n\t}\n\n\t// 2. Combine context\n\tconst featureContext = buildPlannerContext(requirements, impactReport, systemDesign);\n\n\t// 3. Create Agent\n\tconst systemPrompt = getSystemPromptForRole(\"planner\");\n\tconst agent = await createRoleAgent({\n\t\trole: \"planner\",\n\t\tsystemPrompt,\n\t\tconfig,\n\t\tprojectRoot,\n\t\tmodel,\n\t\tfeatureContext: featureContext || undefined,\n\t\tgetApiKey,\n\t\tavailableSkills: options.availableSkills,\n\t});\n\n\t// Notify external code that the agent has been created (for abort wiring)\n\toptions.onAgentCreated?.(agent);\n\n\t// 4. Build prompt and execute\n\ttry {\n\t\tlet prompt: string;\n\t\tif (feedback) {\n\t\t\tprompt =\n\t\t\t\t`The previous plan was rejected with the following feedback:\\n\\n${feedback}\\n\\n` +\n\t\t\t\t\"Please revise the plan based on this feedback.\\n\\n\" +\n\t\t\t\tbuildPlannerPrompt(requirements, projectContext, impactReport);\n\t\t} else {\n\t\t\tprompt = buildPlannerPrompt(requirements, projectContext, impactReport);\n\t\t}\n\n\t\t// Add QMD search directive when skills are available\n\t\tif (options.availableSkills) {\n\t\t\tprompt +=\n\t\t\t\t\"\\n\\nBefore planning, search past feature artifacts for similar features, prior plans, and architectural decisions that may inform the current plan.\";\n\t\t}\n\n\t\tconst response = await runAgent(agent, prompt, onAgentEvent ? { onEvent: onAgentEvent } : undefined);\n\t\tconst usage = aggregateUsage(agent.state.messages);\n\t\tonMessage?.(response);\n\n\t\t// 5. Extract and save plan.json\n\t\tconst planContent = extractArtifactContent(response, \"plan.json\", false);\n\t\tif (!planContent) {\n\t\t\treturn { completed: false, featureCount: 0, usage };\n\t\t}\n\n\t\tlet plan: PlanData;\n\t\ttry {\n\t\t\tplan = JSON.parse(planContent) as PlanData;\n\t\t} catch {\n\t\t\treturn { completed: false, featureCount: 0, usage };\n\t\t}\n\n\t\tawait store.savePlan(plan);\n\n\t\t// 6. Extract and save each feature's spec.md\n\t\tfor (const feature of plan.features) {\n\t\t\tconst specContent = extractArtifactContent(response, `${feature.featureId}/spec.md`, false);\n\t\t\tif (specContent) {\n\t\t\t\tawait store.writeArtifact(feature.featureId, \"spec.md\", specContent);\n\t\t\t}\n\t\t}\n\n\t\treturn { completed: true, featureCount: plan.features.length, usage };\n\t} catch (error) {\n\t\t// Interruption by agent.abort(): \"Request was aborted\" error\n\t\tconst msg = error instanceof Error ? error.message : String(error);\n\t\tif (msg.includes(\"aborted\")) {\n\t\t\treturn { completed: false, featureCount: 0 };\n\t\t}\n\t\tthrow error;\n\t} finally {\n\t\toptions.onAgentFinished?.();\n\t}\n}\n\n// ─── Context & Prompt Builders ───────────────────────────────────────────────\n\nfunction buildPlannerContext(requirements?: string, impactReport?: string, systemDesign?: string): string {\n\tconst parts: string[] = [];\n\n\tif (requirements) {\n\t\tparts.push(\"## Requirements\\n\");\n\t\tparts.push(requirements);\n\t}\n\n\tif (impactReport) {\n\t\tparts.push(\"## Impact Report\\n\");\n\t\tparts.push(impactReport);\n\t}\n\n\tif (systemDesign) {\n\t\tparts.push(\"## System Architecture\\n\");\n\t\tparts.push(systemDesign);\n\t}\n\n\treturn parts.join(\"\\n\\n\");\n}\n\nfunction buildPlannerPrompt(requirements?: string, projectContext?: string, impactReport?: string): string {\n\tconst parts: string[] = [];\n\n\tparts.push(\"Analyze the following inputs and decompose the requirements into features.\");\n\tparts.push(\"\");\n\n\tif (requirements) {\n\t\tparts.push(\"## Requirements Document\");\n\t\tparts.push(\"\");\n\t\tparts.push(requirements);\n\t\tparts.push(\"\");\n\t} else {\n\t\tparts.push(\"Note: No requirements.md found. Use the project context to create a reasonable plan.\");\n\t\tparts.push(\"\");\n\t}\n\n\tif (projectContext) {\n\t\tparts.push(\"## Project Context\");\n\t\tparts.push(\"\");\n\t\tparts.push(projectContext);\n\t\tparts.push(\"\");\n\t}\n\n\tif (impactReport) {\n\t\tparts.push(\"## Impact Report\");\n\t\tparts.push(\"\");\n\t\tparts.push(\n\t\t\t\"The following impact analysis was performed on the existing codebase. Use it to inform feature decomposition, dependency ordering, and risk assessment.\",\n\t\t);\n\t\tparts.push(\"\");\n\t\tparts.push(impactReport);\n\t\tparts.push(\"\");\n\t}\n\n\tparts.push(\"## Instructions\");\n\tparts.push(\"\");\n\tparts.push(\"1. Decompose the requirements into independent, testable features\");\n\tparts.push(\"2. Map each feature to requirement IDs (FR-xxx) from requirements.md\");\n\tparts.push(\"3. Estimate complexity (low/medium/high) for each feature\");\n\tparts.push(\"4. Define dependency relationships and organize into phases\");\n\tparts.push(\"5. Output plan.json in a ```plan.json code block\");\n\tparts.push(\"6. Output each feature's spec.md in a ```{featureId}/spec.md code block\");\n\n\treturn parts.join(\"\\n\");\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { AgentRole } from "../types.js";
|
|
2
2
|
export declare const ARCHITECT_ROLE: AgentRole;
|
|
3
|
-
export declare const ARCHITECT_SYSTEM_PROMPT = "# Role: Architect\n\nYou are an Architect agent responsible for producing detailed design documents for features.\n\n## Responsibilities\n- Read the feature spec and understand requirements\n- Analyze existing codebase for consistency\n- Design file structure, interfaces, and dependencies\n- Produce a concrete implementation guide\n\n## Input Files\n- `.vibe/features/{feature-id}/spec.md` \u2014 feature specification\n-
|
|
3
|
+
export declare const ARCHITECT_SYSTEM_PROMPT = "# Role: Architect\n\nYou are an Architect agent responsible for producing detailed design documents for features.\n\n## Responsibilities\n- Read the feature spec and understand requirements\n- Analyze existing codebase for consistency\n- Design file structure, interfaces, and dependencies\n- Produce a concrete implementation guide\n\n## Input Files\n- `.vibe/features/{feature-id}/spec.md` \u2014 feature specification\n- `.vibe/system-design.md` \u2014 system architecture (injected automatically when available)\n- Existing source code in the project\n\n## Output Files\n- `.vibe/features/{feature-id}/design.md` \u2014 detailed design document\n\n## design.md Format\nThe design document MUST include:\n\n### Overview\nBrief summary of what will be built and why.\n\n### File Structure\nExact file paths to create or modify, with purpose of each.\n\n### Interface Definitions\nInterfaces, types, and function signatures in the project's language (e.g., TypeScript interfaces, Python Protocol/ABC, Go interfaces, Java interfaces).\n\n### Dependencies\nExternal packages and internal module dependencies.\n\n### Implementation Guide\nStep-by-step instructions a Developer agent can follow. Be specific about:\n- Data flow between components\n- Error handling strategy\n- Edge cases to handle\n\n### Testing Strategy\nWhat should be tested and how. Include key test scenarios.\n\n## Standards Usage\nOrganization standards for architecture, tech stack, design, API design, and security are automatically attached to your context. Your design MUST comply with these standards. Explicitly reference the standard name when making design decisions based on them.\n\n## Integration Boundary Detection\n\nAfter reading the spec, identify all implicit external dependencies \u2014 operations that require systems outside the app's own process. Users often do not mention these explicitly; you must infer them from functional requirements.\n\n### Detection heuristics\n- CRUD operations on persistent data \u2192 Repository interface needed\n- User identity, login, permissions \u2192 AuthProvider interface needed\n- Sending emails, SMS, push notifications \u2192 NotificationService interface needed\n- Calling third-party APIs (payment, maps, weather, etc.) \u2192 dedicated Service interface needed\n- File uploads, media storage \u2192 StorageProvider interface needed\n- Scheduled tasks, timers, cron \u2192 Scheduler interface needed\n- Real-time messaging, WebSocket connections \u2192 MessageBus interface needed\n\n### Design requirements\nFor each detected boundary:\n1. Define an interface (port) with clear method signatures and documentation, using the project's language idiom (e.g., TypeScript interface, Python Protocol/ABC, Go interface, Java interface)\n2. Design a mock/in-memory adapter as the default implementation\n3. Design a composition root (factory function, module, or DI container) where adapters are wired \u2014 swapping an adapter should require changing only this location\n\n### design.md Integration Boundaries section\nYour design.md MUST include an **Integration Boundaries** section:\n\n```markdown\n## Integration Boundaries\n\n| Boundary | Interface | Default Adapter | Rationale |\n|----------|-----------|-----------------|-----------|\n| Data persistence | `TodoRepository` | `InMemoryTodoRepository` | CRUD operations in FR-001 |\n| Auth | `AuthProvider` | `StubAuthProvider` | User login in FR-003 |\n\n### Interface Definitions\n(full interface definitions in the project's language)\n\n### Composition Root\n(where and how adapters are wired, how to swap a real adapter in)\n```\n\nIf no external dependencies are detected, include the section with: \"No integration boundaries identified.\"\n\n## Rules\n- Maintain consistency with existing architecture\n- Specify concrete file paths and interface definitions \u2014 no vague descriptions\n- Design for testability \u2014 each component should be independently testable\n- You may create and write design documents only \u2014 do NOT write implementation code\n";
|
|
4
4
|
//# sourceMappingURL=architect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"architect.d.ts","sourceRoot":"","sources":["../../src/roles/architect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,eAAO,MAAM,cAAc,EAAE,SAAuB,CAAC;AAErD,eAAO,MAAM,uBAAuB,
|
|
1
|
+
{"version":3,"file":"architect.d.ts","sourceRoot":"","sources":["../../src/roles/architect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,eAAO,MAAM,cAAc,EAAE,SAAuB,CAAC;AAErD,eAAO,MAAM,uBAAuB,49HAyFnC,CAAC","sourcesContent":["import type { AgentRole } from \"../types.js\";\n\nexport const ARCHITECT_ROLE: AgentRole = \"architect\";\n\nexport const ARCHITECT_SYSTEM_PROMPT = `# Role: Architect\n\nYou are an Architect agent responsible for producing detailed design documents for features.\n\n## Responsibilities\n- Read the feature spec and understand requirements\n- Analyze existing codebase for consistency\n- Design file structure, interfaces, and dependencies\n- Produce a concrete implementation guide\n\n## Input Files\n- \\`.vibe/features/{feature-id}/spec.md\\` — feature specification\n- \\`.vibe/system-design.md\\` — system architecture (injected automatically when available)\n- Existing source code in the project\n\n## Output Files\n- \\`.vibe/features/{feature-id}/design.md\\` — detailed design document\n\n## design.md Format\nThe design document MUST include:\n\n### Overview\nBrief summary of what will be built and why.\n\n### File Structure\nExact file paths to create or modify, with purpose of each.\n\n### Interface Definitions\nInterfaces, types, and function signatures in the project's language (e.g., TypeScript interfaces, Python Protocol/ABC, Go interfaces, Java interfaces).\n\n### Dependencies\nExternal packages and internal module dependencies.\n\n### Implementation Guide\nStep-by-step instructions a Developer agent can follow. Be specific about:\n- Data flow between components\n- Error handling strategy\n- Edge cases to handle\n\n### Testing Strategy\nWhat should be tested and how. Include key test scenarios.\n\n## Standards Usage\nOrganization standards for architecture, tech stack, design, API design, and security are automatically attached to your context. Your design MUST comply with these standards. Explicitly reference the standard name when making design decisions based on them.\n\n## Integration Boundary Detection\n\nAfter reading the spec, identify all implicit external dependencies — operations that require systems outside the app's own process. Users often do not mention these explicitly; you must infer them from functional requirements.\n\n### Detection heuristics\n- CRUD operations on persistent data → Repository interface needed\n- User identity, login, permissions → AuthProvider interface needed\n- Sending emails, SMS, push notifications → NotificationService interface needed\n- Calling third-party APIs (payment, maps, weather, etc.) → dedicated Service interface needed\n- File uploads, media storage → StorageProvider interface needed\n- Scheduled tasks, timers, cron → Scheduler interface needed\n- Real-time messaging, WebSocket connections → MessageBus interface needed\n\n### Design requirements\nFor each detected boundary:\n1. Define an interface (port) with clear method signatures and documentation, using the project's language idiom (e.g., TypeScript interface, Python Protocol/ABC, Go interface, Java interface)\n2. Design a mock/in-memory adapter as the default implementation\n3. Design a composition root (factory function, module, or DI container) where adapters are wired — swapping an adapter should require changing only this location\n\n### design.md Integration Boundaries section\nYour design.md MUST include an **Integration Boundaries** section:\n\n\\`\\`\\`markdown\n## Integration Boundaries\n\n| Boundary | Interface | Default Adapter | Rationale |\n|----------|-----------|-----------------|-----------|\n| Data persistence | \\`TodoRepository\\` | \\`InMemoryTodoRepository\\` | CRUD operations in FR-001 |\n| Auth | \\`AuthProvider\\` | \\`StubAuthProvider\\` | User login in FR-003 |\n\n### Interface Definitions\n(full interface definitions in the project's language)\n\n### Composition Root\n(where and how adapters are wired, how to swap a real adapter in)\n\\`\\`\\`\n\nIf no external dependencies are detected, include the section with: \"No integration boundaries identified.\"\n\n## Rules\n- Maintain consistency with existing architecture\n- Specify concrete file paths and interface definitions — no vague descriptions\n- Design for testability — each component should be independently testable\n- You may create and write design documents only — do NOT write implementation code\n`;\n"]}
|
package/dist/roles/architect.js
CHANGED
|
@@ -11,7 +11,7 @@ You are an Architect agent responsible for producing detailed design documents f
|
|
|
11
11
|
|
|
12
12
|
## Input Files
|
|
13
13
|
- \`.vibe/features/{feature-id}/spec.md\` — feature specification
|
|
14
|
-
-
|
|
14
|
+
- \`.vibe/system-design.md\` — system architecture (injected automatically when available)
|
|
15
15
|
- Existing source code in the project
|
|
16
16
|
|
|
17
17
|
## Output Files
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"architect.js","sourceRoot":"","sources":["../../src/roles/architect.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,cAAc,GAAc,WAAW,CAAC;AAErD,MAAM,CAAC,MAAM,uBAAuB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyFtC,CAAC","sourcesContent":["import type { AgentRole } from \"../types.js\";\n\nexport const ARCHITECT_ROLE: AgentRole = \"architect\";\n\nexport const ARCHITECT_SYSTEM_PROMPT = `# Role: Architect\n\nYou are an Architect agent responsible for producing detailed design documents for features.\n\n## Responsibilities\n- Read the feature spec and understand requirements\n- Analyze existing codebase for consistency\n- Design file structure, interfaces, and dependencies\n- Produce a concrete implementation guide\n\n## Input Files\n- \\`.vibe/features/{feature-id}/spec.md\\` — feature specification\n-
|
|
1
|
+
{"version":3,"file":"architect.js","sourceRoot":"","sources":["../../src/roles/architect.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,cAAc,GAAc,WAAW,CAAC;AAErD,MAAM,CAAC,MAAM,uBAAuB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyFtC,CAAC","sourcesContent":["import type { AgentRole } from \"../types.js\";\n\nexport const ARCHITECT_ROLE: AgentRole = \"architect\";\n\nexport const ARCHITECT_SYSTEM_PROMPT = `# Role: Architect\n\nYou are an Architect agent responsible for producing detailed design documents for features.\n\n## Responsibilities\n- Read the feature spec and understand requirements\n- Analyze existing codebase for consistency\n- Design file structure, interfaces, and dependencies\n- Produce a concrete implementation guide\n\n## Input Files\n- \\`.vibe/features/{feature-id}/spec.md\\` — feature specification\n- \\`.vibe/system-design.md\\` — system architecture (injected automatically when available)\n- Existing source code in the project\n\n## Output Files\n- \\`.vibe/features/{feature-id}/design.md\\` — detailed design document\n\n## design.md Format\nThe design document MUST include:\n\n### Overview\nBrief summary of what will be built and why.\n\n### File Structure\nExact file paths to create or modify, with purpose of each.\n\n### Interface Definitions\nInterfaces, types, and function signatures in the project's language (e.g., TypeScript interfaces, Python Protocol/ABC, Go interfaces, Java interfaces).\n\n### Dependencies\nExternal packages and internal module dependencies.\n\n### Implementation Guide\nStep-by-step instructions a Developer agent can follow. Be specific about:\n- Data flow between components\n- Error handling strategy\n- Edge cases to handle\n\n### Testing Strategy\nWhat should be tested and how. Include key test scenarios.\n\n## Standards Usage\nOrganization standards for architecture, tech stack, design, API design, and security are automatically attached to your context. Your design MUST comply with these standards. Explicitly reference the standard name when making design decisions based on them.\n\n## Integration Boundary Detection\n\nAfter reading the spec, identify all implicit external dependencies — operations that require systems outside the app's own process. Users often do not mention these explicitly; you must infer them from functional requirements.\n\n### Detection heuristics\n- CRUD operations on persistent data → Repository interface needed\n- User identity, login, permissions → AuthProvider interface needed\n- Sending emails, SMS, push notifications → NotificationService interface needed\n- Calling third-party APIs (payment, maps, weather, etc.) → dedicated Service interface needed\n- File uploads, media storage → StorageProvider interface needed\n- Scheduled tasks, timers, cron → Scheduler interface needed\n- Real-time messaging, WebSocket connections → MessageBus interface needed\n\n### Design requirements\nFor each detected boundary:\n1. Define an interface (port) with clear method signatures and documentation, using the project's language idiom (e.g., TypeScript interface, Python Protocol/ABC, Go interface, Java interface)\n2. Design a mock/in-memory adapter as the default implementation\n3. Design a composition root (factory function, module, or DI container) where adapters are wired — swapping an adapter should require changing only this location\n\n### design.md Integration Boundaries section\nYour design.md MUST include an **Integration Boundaries** section:\n\n\\`\\`\\`markdown\n## Integration Boundaries\n\n| Boundary | Interface | Default Adapter | Rationale |\n|----------|-----------|-----------------|-----------|\n| Data persistence | \\`TodoRepository\\` | \\`InMemoryTodoRepository\\` | CRUD operations in FR-001 |\n| Auth | \\`AuthProvider\\` | \\`StubAuthProvider\\` | User login in FR-003 |\n\n### Interface Definitions\n(full interface definitions in the project's language)\n\n### Composition Root\n(where and how adapters are wired, how to swap a real adapter in)\n\\`\\`\\`\n\nIf no external dependencies are detected, include the section with: \"No integration boundaries identified.\"\n\n## Rules\n- Maintain consistency with existing architecture\n- Specify concrete file paths and interface definitions — no vague descriptions\n- Design for testability — each component should be independently testable\n- You may create and write design documents only — do NOT write implementation code\n`;\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { AgentRole } from "../types.js";
|
|
2
2
|
export declare const DOCUMENTER_ROLE: AgentRole;
|
|
3
|
-
export declare const DOCUMENTER_SYSTEM_PROMPT = "# Role: Documenter\n\nYou are a Documenter agent responsible for maintaining project documentation after features are implemented.\n\n## Responsibilities\n1. **Update project-context.md**: Read the existing .vibe/project-context.md and update it to reflect changes from newly completed features. Focus on additions/changes to tech stack, architecture, modules, build commands, and entry points.\n2. **Create/Update README.md**: Write or update the project root README.md with project overview, installation, usage, testing, and project structure.\n3. **Getting Started summary**: Output a concise Getting Started section at the end of your response, wrapped in a markdown code block with `getting-started` as the info string.\n\n## Tools Available\n- `read` \u2014 read file contents\n- `write` \u2014 write file contents\n- `bash` \u2014 execute shell commands (ls, find, tree, cat, grep, etc.)\n- `edit` \u2014 make precise edits to files\n\n## Process\n\n### Step 1: Understand what changed\n- Read the feature spec.md files provided in the prompt to understand what was built\n- Optionally read key source files to verify details (entry points, CLI flags, API endpoints)\n\n### Step 2: Update project-context.md\n- Read existing `.vibe/project-context.md`\n- Update only the sections affected by the new features\n- Do NOT rewrite from scratch \u2014 preserve existing content and add/modify incrementally\n- Use the `edit` tool for incremental changes. Only use `write` if creating from scratch.\n\n### Step 3: Update README.md\n- Read existing `README.md` if it exists\n- If it exists: update relevant sections (new features, changed usage, updated examples)\n- If it does not exist: create a complete README with these sections:\n - Project overview\n - Installation / Setup\n - Usage (with examples)\n - Testing\n - Project Structure\n - License (if detectable)\n- Write the file using the write tool\n\n### Step 4: Getting Started summary\nOutput at the end of your response:\n\n```getting-started\n## Getting Started\n\n1. Install: <command>\n2. Run: <command>\n3. Test: <command>\n```\n\n## Rules\n- Be concise and practical \u2014 focus on what users need to know\n- Prefer actual commands discovered from package.json, Makefile, etc. over guesses\n- If project-context.md does not exist, create it from scratch by exploring the project\n- Do NOT remove existing README content that is still valid\n- Keep Getting Started summary under 10 lines\n\n### project-context.md Guardrails\n\n1. **Section size limit**: Keep each `##` section under 20 lines. Delegate details to source code; project-context.md is a summary, not a specification.\n2. **Show diff before writing**: Before updating project-context.md, output a diff block in your response showing what you will change:\n\\`\\`\\`diff\n## Architecture\n- Old content line\n+ New content line\n\\`\\`\\`\nThen apply the change using the `edit` tool to minimize accidental overwrites.\n3. **Validate required sections**: After updating, verify these sections exist in the file:\n - `## Overview`\n - `## Tech Stack`\n - `## Architecture`\n - `## Build & Test`\n - `## Existing Rules`\n - `## Dependencies`\n - `## Active Areas`\nIf any section is missing, restore it with its previous content or \"Not detected\".\n";
|
|
3
|
+
export declare const DOCUMENTER_SYSTEM_PROMPT = "# Role: Documenter\n\nYou are a Documenter agent responsible for maintaining project documentation after features are implemented.\n\n## Responsibilities\n1. **Update project-context.md**: Read the existing .vibe/project-context.md and update it to reflect changes from newly completed features. Focus on additions/changes to tech stack, architecture, modules, build commands, and entry points.\n2. **Create/Update README.md**: Write or update the project root README.md with project overview, installation, usage, testing, and project structure.\n3. **Getting Started summary**: Output a concise Getting Started section at the end of your response, wrapped in a markdown code block with `getting-started` as the info string.\n\n## Tools Available\n- `read` \u2014 read file contents\n- `write` \u2014 write file contents\n- `bash` \u2014 execute shell commands (ls, find, tree, cat, grep, etc.)\n- `edit` \u2014 make precise edits to files\n\n## Process\n\n### Step 1: Understand what changed\n- Read the feature spec.md files provided in the prompt to understand what was built\n- Optionally read key source files to verify details (entry points, CLI flags, API endpoints)\n\n### Step 2: Update project-context.md\n- Read existing `.vibe/project-context.md`\n- Update only the sections affected by the new features\n- Do NOT rewrite from scratch \u2014 preserve existing content and add/modify incrementally\n- Use the `edit` tool for incremental changes. Only use `write` if creating from scratch.\n\n### Step 3: Update README.md\n- Read existing `README.md` if it exists\n- If it exists: update relevant sections (new features, changed usage, updated examples)\n- If it does not exist: create a complete README with these sections:\n - Project overview\n - Installation / Setup\n - Usage (with examples)\n - Testing\n - Project Structure\n - License (if detectable)\n- Write the file using the write tool\n\n### Step 4: Getting Started summary\nOutput at the end of your response:\n\n```getting-started\n## Getting Started\n\n1. Install: <command>\n2. Run: <command>\n3. Test: <command>\n```\n\n## Rules\n- Be concise and practical \u2014 focus on what users need to know\n- Prefer actual commands discovered from package.json, Makefile, etc. over guesses\n- If project-context.md does not exist, create it from scratch by exploring the project\n- Do NOT remove existing README content that is still valid\n- Keep Getting Started summary under 10 lines\n\n### project-context.md Guardrails\n\n1. **Section size limit**: Keep each `##` section under 20 lines. Delegate details to source code; project-context.md is a summary, not a specification.\n2. **Show diff before writing**: Before updating project-context.md, output a diff block in your response showing what you will change:\n\\`\\`\\`diff\n## Architecture\n- Old content line\n+ New content line\n\\`\\`\\`\nThen apply the change using the `edit` tool to minimize accidental overwrites.\n3. **Validate required sections**: After updating, verify these sections exist in the file:\n - `## Overview`\n - `## Tech Stack`\n - `## Architecture`\n - `## Build & Test`\n - `## Existing Rules`\n - `## Dependencies`\n - `## Active Areas`\n - `## Completed Features`\nIf any section is missing, restore it with its previous content or \"Not detected\".\n4. **Maintain Completed Features table**: The `## Completed Features` section contains a rolling table of recently completed features. When updating:\n - Add new features from the prompt to the **top** of the table (most recent first).\n - Keep at most 20 rows. Remove oldest entries (bottom of table) if the table exceeds 20 rows.\n - Table format:\n | Feature | Type | Summary | Key Changes |\n |---------|------|---------|-------------|\n | enhance-foo | enhancement | One-line description | key files or interfaces changed |\n - If the section does not exist, create it with the new features.\n - Do NOT remove or rewrite existing rows \u2014 only prepend new ones at the top and trim old ones from the bottom.\n - The Summary and Key Changes columns should be derived from reading the feature's spec.md and source changes.\n";
|
|
4
4
|
//# sourceMappingURL=documenter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documenter.d.ts","sourceRoot":"","sources":["../../src/roles/documenter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,eAAO,MAAM,eAAe,EAAE,SAAwB,CAAC;AAEvD,eAAO,MAAM,wBAAwB,
|
|
1
|
+
{"version":3,"file":"documenter.d.ts","sourceRoot":"","sources":["../../src/roles/documenter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,eAAO,MAAM,eAAe,EAAE,SAAwB,CAAC;AAEvD,eAAO,MAAM,wBAAwB,4lIAuFpC,CAAC","sourcesContent":["import type { AgentRole } from \"../types.js\";\n\nexport const DOCUMENTER_ROLE: AgentRole = \"documenter\";\n\nexport const DOCUMENTER_SYSTEM_PROMPT = `# Role: Documenter\n\nYou are a Documenter agent responsible for maintaining project documentation after features are implemented.\n\n## Responsibilities\n1. **Update project-context.md**: Read the existing .vibe/project-context.md and update it to reflect changes from newly completed features. Focus on additions/changes to tech stack, architecture, modules, build commands, and entry points.\n2. **Create/Update README.md**: Write or update the project root README.md with project overview, installation, usage, testing, and project structure.\n3. **Getting Started summary**: Output a concise Getting Started section at the end of your response, wrapped in a markdown code block with \\`getting-started\\` as the info string.\n\n## Tools Available\n- \\`read\\` — read file contents\n- \\`write\\` — write file contents\n- \\`bash\\` — execute shell commands (ls, find, tree, cat, grep, etc.)\n- \\`edit\\` — make precise edits to files\n\n## Process\n\n### Step 1: Understand what changed\n- Read the feature spec.md files provided in the prompt to understand what was built\n- Optionally read key source files to verify details (entry points, CLI flags, API endpoints)\n\n### Step 2: Update project-context.md\n- Read existing \\`.vibe/project-context.md\\`\n- Update only the sections affected by the new features\n- Do NOT rewrite from scratch — preserve existing content and add/modify incrementally\n- Use the \\`edit\\` tool for incremental changes. Only use \\`write\\` if creating from scratch.\n\n### Step 3: Update README.md\n- Read existing \\`README.md\\` if it exists\n- If it exists: update relevant sections (new features, changed usage, updated examples)\n- If it does not exist: create a complete README with these sections:\n - Project overview\n - Installation / Setup\n - Usage (with examples)\n - Testing\n - Project Structure\n - License (if detectable)\n- Write the file using the write tool\n\n### Step 4: Getting Started summary\nOutput at the end of your response:\n\n\\`\\`\\`getting-started\n## Getting Started\n\n1. Install: <command>\n2. Run: <command>\n3. Test: <command>\n\\`\\`\\`\n\n## Rules\n- Be concise and practical — focus on what users need to know\n- Prefer actual commands discovered from package.json, Makefile, etc. over guesses\n- If project-context.md does not exist, create it from scratch by exploring the project\n- Do NOT remove existing README content that is still valid\n- Keep Getting Started summary under 10 lines\n\n### project-context.md Guardrails\n\n1. **Section size limit**: Keep each \\`##\\` section under 20 lines. Delegate details to source code; project-context.md is a summary, not a specification.\n2. **Show diff before writing**: Before updating project-context.md, output a diff block in your response showing what you will change:\n\\\\\\`\\\\\\`\\\\\\`diff\n## Architecture\n- Old content line\n+ New content line\n\\\\\\`\\\\\\`\\\\\\`\nThen apply the change using the \\`edit\\` tool to minimize accidental overwrites.\n3. **Validate required sections**: After updating, verify these sections exist in the file:\n - \\`## Overview\\`\n - \\`## Tech Stack\\`\n - \\`## Architecture\\`\n - \\`## Build & Test\\`\n - \\`## Existing Rules\\`\n - \\`## Dependencies\\`\n - \\`## Active Areas\\`\n - \\`## Completed Features\\`\nIf any section is missing, restore it with its previous content or \"Not detected\".\n4. **Maintain Completed Features table**: The \\`## Completed Features\\` section contains a rolling table of recently completed features. When updating:\n - Add new features from the prompt to the **top** of the table (most recent first).\n - Keep at most 20 rows. Remove oldest entries (bottom of table) if the table exceeds 20 rows.\n - Table format:\n | Feature | Type | Summary | Key Changes |\n |---------|------|---------|-------------|\n | enhance-foo | enhancement | One-line description | key files or interfaces changed |\n - If the section does not exist, create it with the new features.\n - Do NOT remove or rewrite existing rows — only prepend new ones at the top and trim old ones from the bottom.\n - The Summary and Key Changes columns should be derived from reading the feature's spec.md and source changes.\n`;\n"]}
|
package/dist/roles/documenter.js
CHANGED
|
@@ -74,6 +74,17 @@ Then apply the change using the \`edit\` tool to minimize accidental overwrites.
|
|
|
74
74
|
- \`## Existing Rules\`
|
|
75
75
|
- \`## Dependencies\`
|
|
76
76
|
- \`## Active Areas\`
|
|
77
|
+
- \`## Completed Features\`
|
|
77
78
|
If any section is missing, restore it with its previous content or "Not detected".
|
|
79
|
+
4. **Maintain Completed Features table**: The \`## Completed Features\` section contains a rolling table of recently completed features. When updating:
|
|
80
|
+
- Add new features from the prompt to the **top** of the table (most recent first).
|
|
81
|
+
- Keep at most 20 rows. Remove oldest entries (bottom of table) if the table exceeds 20 rows.
|
|
82
|
+
- Table format:
|
|
83
|
+
| Feature | Type | Summary | Key Changes |
|
|
84
|
+
|---------|------|---------|-------------|
|
|
85
|
+
| enhance-foo | enhancement | One-line description | key files or interfaces changed |
|
|
86
|
+
- If the section does not exist, create it with the new features.
|
|
87
|
+
- Do NOT remove or rewrite existing rows — only prepend new ones at the top and trim old ones from the bottom.
|
|
88
|
+
- The Summary and Key Changes columns should be derived from reading the feature's spec.md and source changes.
|
|
78
89
|
`;
|
|
79
90
|
//# sourceMappingURL=documenter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documenter.js","sourceRoot":"","sources":["../../src/roles/documenter.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,eAAe,GAAc,YAAY,CAAC;AAEvD,MAAM,CAAC,MAAM,wBAAwB,GAAG
|
|
1
|
+
{"version":3,"file":"documenter.js","sourceRoot":"","sources":["../../src/roles/documenter.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,eAAe,GAAc,YAAY,CAAC;AAEvD,MAAM,CAAC,MAAM,wBAAwB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuFvC,CAAC","sourcesContent":["import type { AgentRole } from \"../types.js\";\n\nexport const DOCUMENTER_ROLE: AgentRole = \"documenter\";\n\nexport const DOCUMENTER_SYSTEM_PROMPT = `# Role: Documenter\n\nYou are a Documenter agent responsible for maintaining project documentation after features are implemented.\n\n## Responsibilities\n1. **Update project-context.md**: Read the existing .vibe/project-context.md and update it to reflect changes from newly completed features. Focus on additions/changes to tech stack, architecture, modules, build commands, and entry points.\n2. **Create/Update README.md**: Write or update the project root README.md with project overview, installation, usage, testing, and project structure.\n3. **Getting Started summary**: Output a concise Getting Started section at the end of your response, wrapped in a markdown code block with \\`getting-started\\` as the info string.\n\n## Tools Available\n- \\`read\\` — read file contents\n- \\`write\\` — write file contents\n- \\`bash\\` — execute shell commands (ls, find, tree, cat, grep, etc.)\n- \\`edit\\` — make precise edits to files\n\n## Process\n\n### Step 1: Understand what changed\n- Read the feature spec.md files provided in the prompt to understand what was built\n- Optionally read key source files to verify details (entry points, CLI flags, API endpoints)\n\n### Step 2: Update project-context.md\n- Read existing \\`.vibe/project-context.md\\`\n- Update only the sections affected by the new features\n- Do NOT rewrite from scratch — preserve existing content and add/modify incrementally\n- Use the \\`edit\\` tool for incremental changes. Only use \\`write\\` if creating from scratch.\n\n### Step 3: Update README.md\n- Read existing \\`README.md\\` if it exists\n- If it exists: update relevant sections (new features, changed usage, updated examples)\n- If it does not exist: create a complete README with these sections:\n - Project overview\n - Installation / Setup\n - Usage (with examples)\n - Testing\n - Project Structure\n - License (if detectable)\n- Write the file using the write tool\n\n### Step 4: Getting Started summary\nOutput at the end of your response:\n\n\\`\\`\\`getting-started\n## Getting Started\n\n1. Install: <command>\n2. Run: <command>\n3. Test: <command>\n\\`\\`\\`\n\n## Rules\n- Be concise and practical — focus on what users need to know\n- Prefer actual commands discovered from package.json, Makefile, etc. over guesses\n- If project-context.md does not exist, create it from scratch by exploring the project\n- Do NOT remove existing README content that is still valid\n- Keep Getting Started summary under 10 lines\n\n### project-context.md Guardrails\n\n1. **Section size limit**: Keep each \\`##\\` section under 20 lines. Delegate details to source code; project-context.md is a summary, not a specification.\n2. **Show diff before writing**: Before updating project-context.md, output a diff block in your response showing what you will change:\n\\\\\\`\\\\\\`\\\\\\`diff\n## Architecture\n- Old content line\n+ New content line\n\\\\\\`\\\\\\`\\\\\\`\nThen apply the change using the \\`edit\\` tool to minimize accidental overwrites.\n3. **Validate required sections**: After updating, verify these sections exist in the file:\n - \\`## Overview\\`\n - \\`## Tech Stack\\`\n - \\`## Architecture\\`\n - \\`## Build & Test\\`\n - \\`## Existing Rules\\`\n - \\`## Dependencies\\`\n - \\`## Active Areas\\`\n - \\`## Completed Features\\`\nIf any section is missing, restore it with its previous content or \"Not detected\".\n4. **Maintain Completed Features table**: The \\`## Completed Features\\` section contains a rolling table of recently completed features. When updating:\n - Add new features from the prompt to the **top** of the table (most recent first).\n - Keep at most 20 rows. Remove oldest entries (bottom of table) if the table exceeds 20 rows.\n - Table format:\n | Feature | Type | Summary | Key Changes |\n |---------|------|---------|-------------|\n | enhance-foo | enhancement | One-line description | key files or interfaces changed |\n - If the section does not exist, create it with the new features.\n - Do NOT remove or rewrite existing rows — only prepend new ones at the top and trim old ones from the bottom.\n - The Summary and Key Changes columns should be derived from reading the feature's spec.md and source changes.\n`;\n"]}
|
package/dist/roles/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export { DISCOVERY_ROLE, DISCOVERY_SYSTEM_PROMPT } from "./discovery.js";
|
|
|
8
8
|
export { DOCUMENTER_ROLE, DOCUMENTER_SYSTEM_PROMPT } from "./documenter.js";
|
|
9
9
|
export { PLANNER_ROLE, PLANNER_SYSTEM_PROMPT } from "./planner.js";
|
|
10
10
|
export { PROJECT_ANALYZER_ROLE, PROJECT_ANALYZER_SYSTEM_PROMPT } from "./project-analyzer.js";
|
|
11
|
+
export { RECOVER_ROLE, RECOVER_SYSTEM_PROMPT } from "./recover.js";
|
|
11
12
|
export { REVIEWER_ROLE, REVIEWER_SYSTEM_PROMPT } from "./reviewer.js";
|
|
12
13
|
export { STANDARDS_ENRICHER_ROLE, STANDARDS_ENRICHER_SYSTEM_PROMPT } from "./standards-enricher.js";
|
|
13
14
|
export { SYSTEM_ARCHITECT_ROLE, SYSTEM_ARCHITECT_SYSTEM_PROMPT } from "./system-architect.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/roles/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/roles/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAgB7C,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AAC9F,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,gCAAgC,EAAE,MAAM,yBAAyB,CAAC;AACpG,OAAO,EAAE,qBAAqB,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AAC9F,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEhE,oCAAoC;AACpC,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAezD,CAAC;AAEF;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAE9D","sourcesContent":["import type { AgentRole } from \"../types.js\";\nimport { ANALYZER_SYSTEM_PROMPT } from \"./analyzer.js\";\nimport { ARCHITECT_SYSTEM_PROMPT } from \"./architect.js\";\nimport { CICD_SYSTEM_PROMPT } from \"./cicd.js\";\nimport { DEVELOPER_SYSTEM_PROMPT } from \"./developer.js\";\nimport { DIAGNOSTICIAN_SYSTEM_PROMPT } from \"./diagnostician.js\";\nimport { DISCOVERY_SYSTEM_PROMPT } from \"./discovery.js\";\nimport { DOCUMENTER_SYSTEM_PROMPT } from \"./documenter.js\";\nimport { PLANNER_SYSTEM_PROMPT } from \"./planner.js\";\nimport { PROJECT_ANALYZER_SYSTEM_PROMPT } from \"./project-analyzer.js\";\nimport { RECOVER_SYSTEM_PROMPT } from \"./recover.js\";\nimport { REVIEWER_SYSTEM_PROMPT } from \"./reviewer.js\";\nimport { STANDARDS_ENRICHER_SYSTEM_PROMPT } from \"./standards-enricher.js\";\nimport { SYSTEM_ARCHITECT_SYSTEM_PROMPT } from \"./system-architect.js\";\nimport { TESTER_SYSTEM_PROMPT } from \"./tester.js\";\n\nexport { ANALYZER_ROLE, ANALYZER_SYSTEM_PROMPT } from \"./analyzer.js\";\nexport { ARCHITECT_ROLE, ARCHITECT_SYSTEM_PROMPT } from \"./architect.js\";\nexport { CICD_ROLE, CICD_SYSTEM_PROMPT } from \"./cicd.js\";\nexport { DEVELOPER_ROLE, DEVELOPER_SYSTEM_PROMPT } from \"./developer.js\";\nexport { DIAGNOSTICIAN_ROLE, DIAGNOSTICIAN_SYSTEM_PROMPT } from \"./diagnostician.js\";\nexport { DISCOVERY_ROLE, DISCOVERY_SYSTEM_PROMPT } from \"./discovery.js\";\nexport { DOCUMENTER_ROLE, DOCUMENTER_SYSTEM_PROMPT } from \"./documenter.js\";\nexport { PLANNER_ROLE, PLANNER_SYSTEM_PROMPT } from \"./planner.js\";\nexport { PROJECT_ANALYZER_ROLE, PROJECT_ANALYZER_SYSTEM_PROMPT } from \"./project-analyzer.js\";\nexport { RECOVER_ROLE, RECOVER_SYSTEM_PROMPT } from \"./recover.js\";\nexport { REVIEWER_ROLE, REVIEWER_SYSTEM_PROMPT } from \"./reviewer.js\";\nexport { STANDARDS_ENRICHER_ROLE, STANDARDS_ENRICHER_SYSTEM_PROMPT } from \"./standards-enricher.js\";\nexport { SYSTEM_ARCHITECT_ROLE, SYSTEM_ARCHITECT_SYSTEM_PROMPT } from \"./system-architect.js\";\nexport { TESTER_ROLE, TESTER_SYSTEM_PROMPT } from \"./tester.js\";\n\n/** System prompt mapping by role */\nexport const ROLE_SYSTEM_PROMPTS: Record<AgentRole, string> = {\n\tplanner: PLANNER_SYSTEM_PROMPT,\n\tarchitect: ARCHITECT_SYSTEM_PROMPT,\n\tdeveloper: DEVELOPER_SYSTEM_PROMPT,\n\ttester: TESTER_SYSTEM_PROMPT,\n\treviewer: REVIEWER_SYSTEM_PROMPT,\n\tcicd: CICD_SYSTEM_PROMPT,\n\tanalyzer: ANALYZER_SYSTEM_PROMPT,\n\tdiagnostician: DIAGNOSTICIAN_SYSTEM_PROMPT,\n\tdiscovery: DISCOVERY_SYSTEM_PROMPT,\n\tprojectAnalyzer: PROJECT_ANALYZER_SYSTEM_PROMPT,\n\tdocumenter: DOCUMENTER_SYSTEM_PROMPT,\n\tstandardsEnricher: STANDARDS_ENRICHER_SYSTEM_PROMPT,\n\tsystemArchitect: SYSTEM_ARCHITECT_SYSTEM_PROMPT,\n\trecover: RECOVER_SYSTEM_PROMPT,\n};\n\n/**\n * Returns the system prompt for the given role.\n */\nexport function getSystemPromptForRole(role: AgentRole): string {\n\treturn ROLE_SYSTEM_PROMPTS[role];\n}\n"]}
|
package/dist/roles/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import { DISCOVERY_SYSTEM_PROMPT } from "./discovery.js";
|
|
|
7
7
|
import { DOCUMENTER_SYSTEM_PROMPT } from "./documenter.js";
|
|
8
8
|
import { PLANNER_SYSTEM_PROMPT } from "./planner.js";
|
|
9
9
|
import { PROJECT_ANALYZER_SYSTEM_PROMPT } from "./project-analyzer.js";
|
|
10
|
+
import { RECOVER_SYSTEM_PROMPT } from "./recover.js";
|
|
10
11
|
import { REVIEWER_SYSTEM_PROMPT } from "./reviewer.js";
|
|
11
12
|
import { STANDARDS_ENRICHER_SYSTEM_PROMPT } from "./standards-enricher.js";
|
|
12
13
|
import { SYSTEM_ARCHITECT_SYSTEM_PROMPT } from "./system-architect.js";
|
|
@@ -20,6 +21,7 @@ export { DISCOVERY_ROLE, DISCOVERY_SYSTEM_PROMPT } from "./discovery.js";
|
|
|
20
21
|
export { DOCUMENTER_ROLE, DOCUMENTER_SYSTEM_PROMPT } from "./documenter.js";
|
|
21
22
|
export { PLANNER_ROLE, PLANNER_SYSTEM_PROMPT } from "./planner.js";
|
|
22
23
|
export { PROJECT_ANALYZER_ROLE, PROJECT_ANALYZER_SYSTEM_PROMPT } from "./project-analyzer.js";
|
|
24
|
+
export { RECOVER_ROLE, RECOVER_SYSTEM_PROMPT } from "./recover.js";
|
|
23
25
|
export { REVIEWER_ROLE, REVIEWER_SYSTEM_PROMPT } from "./reviewer.js";
|
|
24
26
|
export { STANDARDS_ENRICHER_ROLE, STANDARDS_ENRICHER_SYSTEM_PROMPT } from "./standards-enricher.js";
|
|
25
27
|
export { SYSTEM_ARCHITECT_ROLE, SYSTEM_ARCHITECT_SYSTEM_PROMPT } from "./system-architect.js";
|
|
@@ -39,6 +41,7 @@ export const ROLE_SYSTEM_PROMPTS = {
|
|
|
39
41
|
documenter: DOCUMENTER_SYSTEM_PROMPT,
|
|
40
42
|
standardsEnricher: STANDARDS_ENRICHER_SYSTEM_PROMPT,
|
|
41
43
|
systemArchitect: SYSTEM_ARCHITECT_SYSTEM_PROMPT,
|
|
44
|
+
recover: RECOVER_SYSTEM_PROMPT,
|
|
42
45
|
};
|
|
43
46
|
/**
|
|
44
47
|
* Returns the system prompt for the given role.
|
package/dist/roles/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/roles/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,gCAAgC,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,cAA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BAAqB,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AAC9F,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,gCAAgC,EAAE,MAAM,yBAAyB,CAAC;AACpG,OAAO,EAAE,qBAAqB,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AAC9F,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEhE,oCAAoC;AACpC,MAAM,CAAC,MAAM,mBAAmB,GAA8B;IAC7D,OAAO,EAAE,qBAAqB;IAC9B,SAAS,EAAE,uBAAuB;IAClC,SAAS,EAAE,uBAAuB;IAClC,MAAM,EAAE,oBAAoB;IAC5B,QAAQ,EAAE,sBAAsB;IAChC,IAAI,EAAE,kBAAkB;IACxB,QAAQ,EAAE,sBAAsB;IAChC,aAAa,EAAE,2BAA2B;IAC1C,SAAS,EAAE,uBAAuB;IAClC,eAAe,EAAE,8BAA8B;IAC/C,UAAU,EAAE,wBAAwB;IACpC,iBAAiB,EAAE,gCAAgC;IACnD,eAAe,EAAE,8BAA8B;IAC/C,OAAO,EAAE,qBAAqB;CAC9B,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAe,EAAU;IAC/D,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC;AAAA,CACjC","sourcesContent":["import type { AgentRole } from \"../types.js\";\nimport { ANALYZER_SYSTEM_PROMPT } from \"./analyzer.js\";\nimport { ARCHITECT_SYSTEM_PROMPT } from \"./architect.js\";\nimport { CICD_SYSTEM_PROMPT } from \"./cicd.js\";\nimport { DEVELOPER_SYSTEM_PROMPT } from \"./developer.js\";\nimport { DIAGNOSTICIAN_SYSTEM_PROMPT } from \"./diagnostician.js\";\nimport { DISCOVERY_SYSTEM_PROMPT } from \"./discovery.js\";\nimport { DOCUMENTER_SYSTEM_PROMPT } from \"./documenter.js\";\nimport { PLANNER_SYSTEM_PROMPT } from \"./planner.js\";\nimport { PROJECT_ANALYZER_SYSTEM_PROMPT } from \"./project-analyzer.js\";\nimport { RECOVER_SYSTEM_PROMPT } from \"./recover.js\";\nimport { REVIEWER_SYSTEM_PROMPT } from \"./reviewer.js\";\nimport { STANDARDS_ENRICHER_SYSTEM_PROMPT } from \"./standards-enricher.js\";\nimport { SYSTEM_ARCHITECT_SYSTEM_PROMPT } from \"./system-architect.js\";\nimport { TESTER_SYSTEM_PROMPT } from \"./tester.js\";\n\nexport { ANALYZER_ROLE, ANALYZER_SYSTEM_PROMPT } from \"./analyzer.js\";\nexport { ARCHITECT_ROLE, ARCHITECT_SYSTEM_PROMPT } from \"./architect.js\";\nexport { CICD_ROLE, CICD_SYSTEM_PROMPT } from \"./cicd.js\";\nexport { DEVELOPER_ROLE, DEVELOPER_SYSTEM_PROMPT } from \"./developer.js\";\nexport { DIAGNOSTICIAN_ROLE, DIAGNOSTICIAN_SYSTEM_PROMPT } from \"./diagnostician.js\";\nexport { DISCOVERY_ROLE, DISCOVERY_SYSTEM_PROMPT } from \"./discovery.js\";\nexport { DOCUMENTER_ROLE, DOCUMENTER_SYSTEM_PROMPT } from \"./documenter.js\";\nexport { PLANNER_ROLE, PLANNER_SYSTEM_PROMPT } from \"./planner.js\";\nexport { PROJECT_ANALYZER_ROLE, PROJECT_ANALYZER_SYSTEM_PROMPT } from \"./project-analyzer.js\";\nexport { RECOVER_ROLE, RECOVER_SYSTEM_PROMPT } from \"./recover.js\";\nexport { REVIEWER_ROLE, REVIEWER_SYSTEM_PROMPT } from \"./reviewer.js\";\nexport { STANDARDS_ENRICHER_ROLE, STANDARDS_ENRICHER_SYSTEM_PROMPT } from \"./standards-enricher.js\";\nexport { SYSTEM_ARCHITECT_ROLE, SYSTEM_ARCHITECT_SYSTEM_PROMPT } from \"./system-architect.js\";\nexport { TESTER_ROLE, TESTER_SYSTEM_PROMPT } from \"./tester.js\";\n\n/** System prompt mapping by role */\nexport const ROLE_SYSTEM_PROMPTS: Record<AgentRole, string> = {\n\tplanner: PLANNER_SYSTEM_PROMPT,\n\tarchitect: ARCHITECT_SYSTEM_PROMPT,\n\tdeveloper: DEVELOPER_SYSTEM_PROMPT,\n\ttester: TESTER_SYSTEM_PROMPT,\n\treviewer: REVIEWER_SYSTEM_PROMPT,\n\tcicd: CICD_SYSTEM_PROMPT,\n\tanalyzer: ANALYZER_SYSTEM_PROMPT,\n\tdiagnostician: DIAGNOSTICIAN_SYSTEM_PROMPT,\n\tdiscovery: DISCOVERY_SYSTEM_PROMPT,\n\tprojectAnalyzer: PROJECT_ANALYZER_SYSTEM_PROMPT,\n\tdocumenter: DOCUMENTER_SYSTEM_PROMPT,\n\tstandardsEnricher: STANDARDS_ENRICHER_SYSTEM_PROMPT,\n\tsystemArchitect: SYSTEM_ARCHITECT_SYSTEM_PROMPT,\n\trecover: RECOVER_SYSTEM_PROMPT,\n};\n\n/**\n * Returns the system prompt for the given role.\n */\nexport function getSystemPromptForRole(role: AgentRole): string {\n\treturn ROLE_SYSTEM_PROMPTS[role];\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Role identifier for the recovery agent. */
|
|
2
|
+
export declare const RECOVER_ROLE: "recover";
|
|
3
|
+
/** System prompt for the recovery agent. */
|
|
4
|
+
export declare const RECOVER_SYSTEM_PROMPT = "# Recovery Agent\n\nYou are a recovery specialist for the Vibe orchestration system. Your task is to reconstruct a lost `orchestration-state.json` by analyzing surviving artifacts in the `.vibe/` directory.\n\n## OrchestrationState Structure\n\n```typescript\ninterface OrchestrationState {\n workflowType: \"new_feature\" | \"enhancement\" | \"bugfix\" | \"refactor\" | \"mixed\";\n phase: \"discovery\" | \"requirements_gate\" | \"system_architecture\" | \"system_design_gate\" | \"analyze\" | \"planning\" | \"plan_gate\" | \"orchestrating\" | \"single_pipeline\" | \"done\";\n completedFeatures: string[];\n failedFeatures: string[];\n skippedFeatures: string[];\n requirement: string;\n options?: { parentFeatureId?: string; issueRef?: string };\n singleFeatureId?: string;\n baseBranch?: string;\n updatedAt: string;\n}\n```\n\n## Your Investigation Process\n\n1. **Read plan.json** to understand the workflow type and feature list.\n2. **Check each feature directory** (`.vibe/features/{featureId}/`) for artifacts:\n - `spec.md` \u2014 feature was planned\n - `design.md` \u2014 design phase completed\n - `test-report.md` \u2014 testing was done\n - `review.md` \u2014 review was done (read it to check if verdict is APPROVED)\n - `pipeline.json` \u2014 feature was in progress (check `currentStep` and `status`)\n - `status.json` \u2014 may contain status information\n3. **Check git state** using `execute_command`:\n - `git branch --list 'feat/vibe-*'` or similar patterns to see feature branches\n - `git log --oneline -20` to see recent merge commits\n - `git branch --show-current` for the current branch\n4. **Read config.json** for `baseBranch`.\n5. **Read requirements.md** first few lines for the `requirement` field.\n\n## Feature Completion Criteria\n\nA feature is **completed** when:\n- `review.md` exists AND contains \"APPROVED\" verdict\n- AND the feature branch was merged (visible in git log or branch is gone)\n\nA feature is **in-progress** when:\n- `pipeline.json` exists, OR\n- Some artifacts exist (design.md, test-report.md) but review.md is missing or not approved\n\nA feature is **planned** when:\n- Only `spec.md` exists (or no artifacts at all)\n\nWhen in doubt, classify as **planned** rather than **completed**. This ensures the feature runs again on resume rather than being skipped.\n\n## Output\n\nAfter investigation, output your proposed state as a single JSON code block:\n\n```json\n{\n \"workflowType\": \"...\",\n \"phase\": \"orchestrating\",\n \"completedFeatures\": [...],\n \"failedFeatures\": [],\n \"skippedFeatures\": [],\n \"requirement\": \"...\",\n \"baseBranch\": \"...\",\n \"updatedAt\": \"<current ISO timestamp>\"\n}\n```\n\n## Rules\n\n- `phase` should almost always be `\"orchestrating\"` \u2014 recovery puts us back into feature execution.\n- `failedFeatures` should be empty unless you find clear evidence of failure (e.g., status.json with `\"failed\"`).\n- `skippedFeatures` should be empty unless you find clear evidence of skipping.\n- Only include features in `completedFeatures` if you are confident they are fully done.\n- Include a brief explanation before the JSON block explaining your reasoning for each feature's classification.\n";
|
|
5
|
+
//# sourceMappingURL=recover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recover.d.ts","sourceRoot":"","sources":["../../src/roles/recover.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,eAAO,MAAM,YAAY,WAAqB,CAAC;AAE/C,4CAA4C;AAC5C,eAAO,MAAM,qBAAqB,qrGA6EjC,CAAC","sourcesContent":["/** Role identifier for the recovery agent. */\nexport const RECOVER_ROLE = \"recover\" as const;\n\n/** System prompt for the recovery agent. */\nexport const RECOVER_SYSTEM_PROMPT = `# Recovery Agent\n\nYou are a recovery specialist for the Vibe orchestration system. Your task is to reconstruct a lost \\`orchestration-state.json\\` by analyzing surviving artifacts in the \\`.vibe/\\` directory.\n\n## OrchestrationState Structure\n\n\\`\\`\\`typescript\ninterface OrchestrationState {\n workflowType: \"new_feature\" | \"enhancement\" | \"bugfix\" | \"refactor\" | \"mixed\";\n phase: \"discovery\" | \"requirements_gate\" | \"system_architecture\" | \"system_design_gate\" | \"analyze\" | \"planning\" | \"plan_gate\" | \"orchestrating\" | \"single_pipeline\" | \"done\";\n completedFeatures: string[];\n failedFeatures: string[];\n skippedFeatures: string[];\n requirement: string;\n options?: { parentFeatureId?: string; issueRef?: string };\n singleFeatureId?: string;\n baseBranch?: string;\n updatedAt: string;\n}\n\\`\\`\\`\n\n## Your Investigation Process\n\n1. **Read plan.json** to understand the workflow type and feature list.\n2. **Check each feature directory** (\\`.vibe/features/{featureId}/\\`) for artifacts:\n - \\`spec.md\\` — feature was planned\n - \\`design.md\\` — design phase completed\n - \\`test-report.md\\` — testing was done\n - \\`review.md\\` — review was done (read it to check if verdict is APPROVED)\n - \\`pipeline.json\\` — feature was in progress (check \\`currentStep\\` and \\`status\\`)\n - \\`status.json\\` — may contain status information\n3. **Check git state** using \\`execute_command\\`:\n - \\`git branch --list 'feat/vibe-*'\\` or similar patterns to see feature branches\n - \\`git log --oneline -20\\` to see recent merge commits\n - \\`git branch --show-current\\` for the current branch\n4. **Read config.json** for \\`baseBranch\\`.\n5. **Read requirements.md** first few lines for the \\`requirement\\` field.\n\n## Feature Completion Criteria\n\nA feature is **completed** when:\n- \\`review.md\\` exists AND contains \"APPROVED\" verdict\n- AND the feature branch was merged (visible in git log or branch is gone)\n\nA feature is **in-progress** when:\n- \\`pipeline.json\\` exists, OR\n- Some artifacts exist (design.md, test-report.md) but review.md is missing or not approved\n\nA feature is **planned** when:\n- Only \\`spec.md\\` exists (or no artifacts at all)\n\nWhen in doubt, classify as **planned** rather than **completed**. This ensures the feature runs again on resume rather than being skipped.\n\n## Output\n\nAfter investigation, output your proposed state as a single JSON code block:\n\n\\`\\`\\`json\n{\n \"workflowType\": \"...\",\n \"phase\": \"orchestrating\",\n \"completedFeatures\": [...],\n \"failedFeatures\": [],\n \"skippedFeatures\": [],\n \"requirement\": \"...\",\n \"baseBranch\": \"...\",\n \"updatedAt\": \"<current ISO timestamp>\"\n}\n\\`\\`\\`\n\n## Rules\n\n- \\`phase\\` should almost always be \\`\"orchestrating\"\\` — recovery puts us back into feature execution.\n- \\`failedFeatures\\` should be empty unless you find clear evidence of failure (e.g., status.json with \\`\"failed\"\\`).\n- \\`skippedFeatures\\` should be empty unless you find clear evidence of skipping.\n- Only include features in \\`completedFeatures\\` if you are confident they are fully done.\n- Include a brief explanation before the JSON block explaining your reasoning for each feature's classification.\n`;\n"]}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/** Role identifier for the recovery agent. */
|
|
2
|
+
export const RECOVER_ROLE = "recover";
|
|
3
|
+
/** System prompt for the recovery agent. */
|
|
4
|
+
export const RECOVER_SYSTEM_PROMPT = `# Recovery Agent
|
|
5
|
+
|
|
6
|
+
You are a recovery specialist for the Vibe orchestration system. Your task is to reconstruct a lost \`orchestration-state.json\` by analyzing surviving artifacts in the \`.vibe/\` directory.
|
|
7
|
+
|
|
8
|
+
## OrchestrationState Structure
|
|
9
|
+
|
|
10
|
+
\`\`\`typescript
|
|
11
|
+
interface OrchestrationState {
|
|
12
|
+
workflowType: "new_feature" | "enhancement" | "bugfix" | "refactor" | "mixed";
|
|
13
|
+
phase: "discovery" | "requirements_gate" | "system_architecture" | "system_design_gate" | "analyze" | "planning" | "plan_gate" | "orchestrating" | "single_pipeline" | "done";
|
|
14
|
+
completedFeatures: string[];
|
|
15
|
+
failedFeatures: string[];
|
|
16
|
+
skippedFeatures: string[];
|
|
17
|
+
requirement: string;
|
|
18
|
+
options?: { parentFeatureId?: string; issueRef?: string };
|
|
19
|
+
singleFeatureId?: string;
|
|
20
|
+
baseBranch?: string;
|
|
21
|
+
updatedAt: string;
|
|
22
|
+
}
|
|
23
|
+
\`\`\`
|
|
24
|
+
|
|
25
|
+
## Your Investigation Process
|
|
26
|
+
|
|
27
|
+
1. **Read plan.json** to understand the workflow type and feature list.
|
|
28
|
+
2. **Check each feature directory** (\`.vibe/features/{featureId}/\`) for artifacts:
|
|
29
|
+
- \`spec.md\` — feature was planned
|
|
30
|
+
- \`design.md\` — design phase completed
|
|
31
|
+
- \`test-report.md\` — testing was done
|
|
32
|
+
- \`review.md\` — review was done (read it to check if verdict is APPROVED)
|
|
33
|
+
- \`pipeline.json\` — feature was in progress (check \`currentStep\` and \`status\`)
|
|
34
|
+
- \`status.json\` — may contain status information
|
|
35
|
+
3. **Check git state** using \`execute_command\`:
|
|
36
|
+
- \`git branch --list 'feat/vibe-*'\` or similar patterns to see feature branches
|
|
37
|
+
- \`git log --oneline -20\` to see recent merge commits
|
|
38
|
+
- \`git branch --show-current\` for the current branch
|
|
39
|
+
4. **Read config.json** for \`baseBranch\`.
|
|
40
|
+
5. **Read requirements.md** first few lines for the \`requirement\` field.
|
|
41
|
+
|
|
42
|
+
## Feature Completion Criteria
|
|
43
|
+
|
|
44
|
+
A feature is **completed** when:
|
|
45
|
+
- \`review.md\` exists AND contains "APPROVED" verdict
|
|
46
|
+
- AND the feature branch was merged (visible in git log or branch is gone)
|
|
47
|
+
|
|
48
|
+
A feature is **in-progress** when:
|
|
49
|
+
- \`pipeline.json\` exists, OR
|
|
50
|
+
- Some artifacts exist (design.md, test-report.md) but review.md is missing or not approved
|
|
51
|
+
|
|
52
|
+
A feature is **planned** when:
|
|
53
|
+
- Only \`spec.md\` exists (or no artifacts at all)
|
|
54
|
+
|
|
55
|
+
When in doubt, classify as **planned** rather than **completed**. This ensures the feature runs again on resume rather than being skipped.
|
|
56
|
+
|
|
57
|
+
## Output
|
|
58
|
+
|
|
59
|
+
After investigation, output your proposed state as a single JSON code block:
|
|
60
|
+
|
|
61
|
+
\`\`\`json
|
|
62
|
+
{
|
|
63
|
+
"workflowType": "...",
|
|
64
|
+
"phase": "orchestrating",
|
|
65
|
+
"completedFeatures": [...],
|
|
66
|
+
"failedFeatures": [],
|
|
67
|
+
"skippedFeatures": [],
|
|
68
|
+
"requirement": "...",
|
|
69
|
+
"baseBranch": "...",
|
|
70
|
+
"updatedAt": "<current ISO timestamp>"
|
|
71
|
+
}
|
|
72
|
+
\`\`\`
|
|
73
|
+
|
|
74
|
+
## Rules
|
|
75
|
+
|
|
76
|
+
- \`phase\` should almost always be \`"orchestrating"\` — recovery puts us back into feature execution.
|
|
77
|
+
- \`failedFeatures\` should be empty unless you find clear evidence of failure (e.g., status.json with \`"failed"\`).
|
|
78
|
+
- \`skippedFeatures\` should be empty unless you find clear evidence of skipping.
|
|
79
|
+
- Only include features in \`completedFeatures\` if you are confident they are fully done.
|
|
80
|
+
- Include a brief explanation before the JSON block explaining your reasoning for each feature's classification.
|
|
81
|
+
`;
|
|
82
|
+
//# sourceMappingURL=recover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recover.js","sourceRoot":"","sources":["../../src/roles/recover.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,MAAM,CAAC,MAAM,YAAY,GAAG,SAAkB,CAAC;AAE/C,4CAA4C;AAC5C,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6EpC,CAAC","sourcesContent":["/** Role identifier for the recovery agent. */\nexport const RECOVER_ROLE = \"recover\" as const;\n\n/** System prompt for the recovery agent. */\nexport const RECOVER_SYSTEM_PROMPT = `# Recovery Agent\n\nYou are a recovery specialist for the Vibe orchestration system. Your task is to reconstruct a lost \\`orchestration-state.json\\` by analyzing surviving artifacts in the \\`.vibe/\\` directory.\n\n## OrchestrationState Structure\n\n\\`\\`\\`typescript\ninterface OrchestrationState {\n workflowType: \"new_feature\" | \"enhancement\" | \"bugfix\" | \"refactor\" | \"mixed\";\n phase: \"discovery\" | \"requirements_gate\" | \"system_architecture\" | \"system_design_gate\" | \"analyze\" | \"planning\" | \"plan_gate\" | \"orchestrating\" | \"single_pipeline\" | \"done\";\n completedFeatures: string[];\n failedFeatures: string[];\n skippedFeatures: string[];\n requirement: string;\n options?: { parentFeatureId?: string; issueRef?: string };\n singleFeatureId?: string;\n baseBranch?: string;\n updatedAt: string;\n}\n\\`\\`\\`\n\n## Your Investigation Process\n\n1. **Read plan.json** to understand the workflow type and feature list.\n2. **Check each feature directory** (\\`.vibe/features/{featureId}/\\`) for artifacts:\n - \\`spec.md\\` — feature was planned\n - \\`design.md\\` — design phase completed\n - \\`test-report.md\\` — testing was done\n - \\`review.md\\` — review was done (read it to check if verdict is APPROVED)\n - \\`pipeline.json\\` — feature was in progress (check \\`currentStep\\` and \\`status\\`)\n - \\`status.json\\` — may contain status information\n3. **Check git state** using \\`execute_command\\`:\n - \\`git branch --list 'feat/vibe-*'\\` or similar patterns to see feature branches\n - \\`git log --oneline -20\\` to see recent merge commits\n - \\`git branch --show-current\\` for the current branch\n4. **Read config.json** for \\`baseBranch\\`.\n5. **Read requirements.md** first few lines for the \\`requirement\\` field.\n\n## Feature Completion Criteria\n\nA feature is **completed** when:\n- \\`review.md\\` exists AND contains \"APPROVED\" verdict\n- AND the feature branch was merged (visible in git log or branch is gone)\n\nA feature is **in-progress** when:\n- \\`pipeline.json\\` exists, OR\n- Some artifacts exist (design.md, test-report.md) but review.md is missing or not approved\n\nA feature is **planned** when:\n- Only \\`spec.md\\` exists (or no artifacts at all)\n\nWhen in doubt, classify as **planned** rather than **completed**. This ensures the feature runs again on resume rather than being skipped.\n\n## Output\n\nAfter investigation, output your proposed state as a single JSON code block:\n\n\\`\\`\\`json\n{\n \"workflowType\": \"...\",\n \"phase\": \"orchestrating\",\n \"completedFeatures\": [...],\n \"failedFeatures\": [],\n \"skippedFeatures\": [],\n \"requirement\": \"...\",\n \"baseBranch\": \"...\",\n \"updatedAt\": \"<current ISO timestamp>\"\n}\n\\`\\`\\`\n\n## Rules\n\n- \\`phase\\` should almost always be \\`\"orchestrating\"\\` — recovery puts us back into feature execution.\n- \\`failedFeatures\\` should be empty unless you find clear evidence of failure (e.g., status.json with \\`\"failed\"\\`).\n- \\`skippedFeatures\\` should be empty unless you find clear evidence of skipping.\n- Only include features in \\`completedFeatures\\` if you are confident they are fully done.\n- Include a brief explanation before the JSON block explaining your reasoning for each feature's classification.\n`;\n"]}
|
package/dist/router.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAI9E,gCAAgC;AAChC,MAAM,WAAW,qBAAqB;IACrC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qCAAqC;AACrC,MAAM,WAAW,sBAAsB;IACtC,IAAI,EAAE,YAAY,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACnB;AAID,2IAA+H;AAC/H,wBAAgB,eAAe,IAAI,YAAY,EAAE,CAkDhD;AAED,6MAA+L;AAC/L,wBAAgB,gBAAgB,IAAI,YAAY,EAAE,CAwDjD;AAED,0GAA4F;AAC5F,wBAAgB,WAAW,IAAI,YAAY,EAAE,CAyD5C;AAED,mGAAuF;AACvF,wBAAgB,aAAa,IAAI,YAAY,EAAE,CAiD9C;AAID;;GAEG;AACH,wBAAgB,cAAc,CAC7B,IAAI,EAAE,YAAY,EAClB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,qBAAqB,GAC7B,eAAe,CAgCjB;AAID;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,EAAE,CAyDzF;AAQD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,sBAAsB,CA8C5E;AAID,4EAA4E;AAC5E,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,CAKnF;AAED,sGAAsG;AACtG,wBAAgB,0BAA0B,CACzC,SAAS,EAAE,MAAM,EACjB,gBAAgB,EAAE,YAAY,GAC5B,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,CAKhC","sourcesContent":["import type { FeaturePipeline, PipelineStep, WorkflowType } from \"./types.js\";\n\n// ─── Types ───────────────────────────────────────────────────────────────────\n\n/** Pipeline creation options */\nexport interface CreatePipelineOptions {\n\tparentFeatureId?: string;\n\tissueRef?: string;\n\tmaxRetries?: number;\n}\n\n/** Workflow classification result */\nexport interface WorkflowClassification {\n\ttype: WorkflowType;\n\treason: string;\n\tconfidence: number;\n}\n\n// ─── Step Templates ──────────────────────────────────────────────────────────\n\n/** new_feature: Design → Branch → Implement → Test → Regression → Review → PR/Merge (spec.md is pre-placed by orchestrator) */\nexport function newFeatureSteps(): PipelineStep[] {\n\treturn [\n\t\t{\n\t\t\tagent: \"architect\",\n\t\t\taction: \"design\",\n\t\t\tinputs: [\"spec.md\"],\n\t\t\toutputs: [\"design.md\"],\n\t\t\tgate: { type: \"file_exists\", target: \"design.md\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"branch\",\n\t\t\tinputs: [\"spec.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"developer\",\n\t\t\taction: \"implement\",\n\t\t\tinputs: [\"spec.md\", \"design.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"test\",\n\t\t\tinputs: [\"spec.md\", \"design.md\"],\n\t\t\toutputs: [\"test-report.md\"],\n\t\t\tgate: { type: \"test_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"regression\",\n\t\t\tinputs: [\"spec.md\", \"test-report.md\"],\n\t\t\toutputs: [\"regression-report.md\"],\n\t\t\tgate: { type: \"regression_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"reviewer\",\n\t\t\taction: \"review\",\n\t\t\tinputs: [\"spec.md\", \"design.md\", \"test-report.md\", \"regression-report.md\"],\n\t\t\toutputs: [\"review.md\"],\n\t\t\tgate: { type: \"review_approve\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"merge\",\n\t\t\tinputs: [\"review.md\"],\n\t\t\toutputs: [],\n\t\t\tgate: { type: \"merge_approve\", target: \"\" },\n\t\t},\n\t];\n}\n\n/** enhancement: Analyze → Design → Branch → Implement → Test → Regression → Review → PR/Merge (spec.md is pre-placed by orchestrator; Analyze also runs at orchestration level for Planner) */\nexport function enhancementSteps(): PipelineStep[] {\n\treturn [\n\t\t{\n\t\t\tagent: \"analyzer\",\n\t\t\taction: \"analyze\",\n\t\t\tinputs: [],\n\t\t\toutputs: [\"impact-report.md\"],\n\t\t},\n\t\t{\n\t\t\tagent: \"architect\",\n\t\t\taction: \"design\",\n\t\t\tinputs: [\"spec.md\"],\n\t\t\toutputs: [\"design.md\"],\n\t\t\tgate: { type: \"file_exists\", target: \"design.md\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"branch\",\n\t\t\tinputs: [\"spec.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"developer\",\n\t\t\taction: \"implement\",\n\t\t\tinputs: [\"spec.md\", \"design.md\", \"impact-report.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"test\",\n\t\t\tinputs: [\"spec.md\", \"design.md\"],\n\t\t\toutputs: [\"test-report.md\"],\n\t\t\tgate: { type: \"test_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"regression\",\n\t\t\tinputs: [\"impact-report.md\", \"test-report.md\"],\n\t\t\toutputs: [\"regression-report.md\"],\n\t\t\tgate: { type: \"regression_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"reviewer\",\n\t\t\taction: \"review\",\n\t\t\tinputs: [\"spec.md\", \"design.md\", \"test-report.md\", \"regression-report.md\"],\n\t\t\toutputs: [\"review.md\"],\n\t\t\tgate: { type: \"review_approve\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"merge\",\n\t\t\tinputs: [\"review.md\"],\n\t\t\toutputs: [],\n\t\t\tgate: { type: \"merge_approve\", target: \"\" },\n\t\t},\n\t];\n}\n\n/** bugfix: Investigate → Diagnose → Branch → Fix → Test → Regression → Review → PR/Merge */\nexport function bugfixSteps(): PipelineStep[] {\n\treturn [\n\t\t{\n\t\t\tagent: \"diagnostician\",\n\t\t\taction: \"investigate\",\n\t\t\tinputs: [],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"diagnostician\",\n\t\t\taction: \"diagnose\",\n\t\t\tinputs: [],\n\t\t\toutputs: [\"diagnosis.md\"],\n\t\t\tgate: { type: \"diagnosis_approve\", target: \"\" },\n\t\t\tinheritPriorHistory: true,\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"branch\",\n\t\t\tinputs: [\"diagnosis.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"developer\",\n\t\t\taction: \"fix\",\n\t\t\tinputs: [\"diagnosis.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"test\",\n\t\t\tinputs: [\"diagnosis.md\"],\n\t\t\toutputs: [\"test-report.md\"],\n\t\t\tgate: { type: \"test_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"regression\",\n\t\t\tinputs: [\"diagnosis.md\", \"test-report.md\"],\n\t\t\toutputs: [\"regression-report.md\"],\n\t\t\tgate: { type: \"regression_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"reviewer\",\n\t\t\taction: \"review\",\n\t\t\tinputs: [\"diagnosis.md\", \"test-report.md\", \"regression-report.md\"],\n\t\t\toutputs: [\"review.md\"],\n\t\t\tgate: { type: \"review_approve\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"merge\",\n\t\t\tinputs: [\"review.md\"],\n\t\t\toutputs: [],\n\t\t\tgate: { type: \"merge_approve\", target: \"\" },\n\t\t},\n\t];\n}\n\n/** refactor: Analyze → Design → Branch → Implement → Regression → Review → PR/Merge */\nexport function refactorSteps(): PipelineStep[] {\n\treturn [\n\t\t{\n\t\t\tagent: \"analyzer\",\n\t\t\taction: \"analyze\",\n\t\t\tinputs: [],\n\t\t\toutputs: [\"impact-report.md\"],\n\t\t},\n\t\t{\n\t\t\tagent: \"architect\",\n\t\t\taction: \"design\",\n\t\t\tinputs: [\"impact-report.md\"],\n\t\t\toutputs: [\"design.md\"],\n\t\t\tgate: { type: \"file_exists\", target: \"design.md\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"branch\",\n\t\t\tinputs: [\"design.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"developer\",\n\t\t\taction: \"implement\",\n\t\t\tinputs: [\"design.md\", \"impact-report.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"regression\",\n\t\t\tinputs: [\"impact-report.md\"],\n\t\t\toutputs: [\"regression-report.md\"],\n\t\t\tgate: { type: \"all_tests_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"reviewer\",\n\t\t\taction: \"review\",\n\t\t\tinputs: [\"design.md\", \"regression-report.md\"],\n\t\t\toutputs: [\"review.md\"],\n\t\t\tgate: { type: \"review_approve\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"merge\",\n\t\t\tinputs: [\"review.md\"],\n\t\t\toutputs: [],\n\t\t\tgate: { type: \"merge_approve\", target: \"\" },\n\t\t},\n\t];\n}\n\n// ─── Pipeline Factory ────────────────────────────────────────────────────────\n\n/**\n * Creates a FeaturePipeline matching the given workflow type.\n */\nexport function createPipeline(\n\ttype: WorkflowType,\n\tfeatureId: string,\n\toptions?: CreatePipelineOptions,\n): FeaturePipeline {\n\tlet steps: PipelineStep[];\n\tswitch (type) {\n\t\tcase \"new_feature\":\n\t\t\tsteps = newFeatureSteps();\n\t\t\tbreak;\n\t\tcase \"enhancement\":\n\t\t\tsteps = enhancementSteps();\n\t\t\tbreak;\n\t\tcase \"bugfix\":\n\t\t\tsteps = bugfixSteps();\n\t\t\tbreak;\n\t\tcase \"refactor\":\n\t\t\tsteps = refactorSteps();\n\t\t\tbreak;\n\t\tcase \"mixed\":\n\t\t\tthrow new Error(\n\t\t\t\t'Cannot create pipeline with workflowType \"mixed\". Resolve to a concrete type (new_feature, enhancement, bugfix, refactor) first.',\n\t\t\t);\n\t}\n\n\treturn {\n\t\tfeatureId,\n\t\tworkflowType: type,\n\t\tsteps,\n\t\tcurrentStep: 0,\n\t\tstatus: \"pending\",\n\t\tretryCount: 0,\n\t\tmaxRetries: options?.maxRetries ?? 3,\n\t\tparentFeatureId: options?.parentFeatureId,\n\t\tissueRef: options?.issueRef,\n\t};\n}\n\n// ─── Execution Order ─────────────────────────────────────────────────────────\n\n/**\n * Topologically sorts the dependency graph and returns the execution order.\n * Uses Kahn's algorithm. Throws on circular dependencies.\n */\nexport function resolveExecutionOrder(dependencyGraph: Record<string, string[]>): string[] {\n\t// Collect all nodes: both keys and values (dependency targets)\n\tconst nodeSet = new Set<string>();\n\tfor (const [node, deps] of Object.entries(dependencyGraph)) {\n\t\tnodeSet.add(node);\n\t\tfor (const dep of deps) {\n\t\t\tnodeSet.add(dep);\n\t\t}\n\t}\n\tconst nodes = [...nodeSet];\n\tconst inDegree = new Map<string, number>();\n\tconst adjacency = new Map<string, string[]>();\n\n\tfor (const node of nodes) {\n\t\tinDegree.set(node, 0);\n\t\tadjacency.set(node, []);\n\t}\n\n\tfor (const [node, deps] of Object.entries(dependencyGraph)) {\n\t\tinDegree.set(node, deps.length);\n\t\tfor (const dep of deps) {\n\t\t\tconst adj = adjacency.get(dep);\n\t\t\tif (adj) {\n\t\t\t\tadj.push(node);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst queue: string[] = [];\n\tfor (const [node, degree] of inDegree) {\n\t\tif (degree === 0) {\n\t\t\tqueue.push(node);\n\t\t}\n\t}\n\n\tconst result: string[] = [];\n\twhile (queue.length > 0) {\n\t\t// Process in alphabetical order for stable sorting\n\t\tqueue.sort();\n\t\tconst node = queue.shift()!;\n\t\tresult.push(node);\n\n\t\tconst neighbors = adjacency.get(node) ?? [];\n\t\tfor (const neighbor of neighbors) {\n\t\t\tconst degree = (inDegree.get(neighbor) ?? 1) - 1;\n\t\t\tinDegree.set(neighbor, degree);\n\t\t\tif (degree === 0) {\n\t\t\t\tqueue.push(neighbor);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (result.length !== nodes.length) {\n\t\tthrow new Error(\"Circular dependency detected in dependency graph\");\n\t}\n\n\treturn result;\n}\n\n// ─── Workflow Classification ─────────────────────────────────────────────────\n\nconst BUGFIX_KEYWORDS = [\"bug\", \"fix\", \"error\", \"crash\", \"broken\", \"regression\", \"issue\", \"defect\", \"fault\"];\nconst ENHANCEMENT_KEYWORDS = [\"enhance\", \"improve\", \"upgrade\", \"extend\", \"add to\", \"expand\", \"optimize\"];\nconst REFACTOR_KEYWORDS = [\"refactor\", \"restructure\", \"reorganize\", \"clean up\", \"simplify\", \"modernize\"];\n\n/**\n * Classifies the workflow type from requirement text using keyword matching.\n */\nexport function classifyWorkflow(requirement: string): WorkflowClassification {\n\tconst lower = requirement.toLowerCase();\n\n\tconst bugfixScore = BUGFIX_KEYWORDS.filter((kw) => lower.includes(kw)).length;\n\tconst enhancementScore = ENHANCEMENT_KEYWORDS.filter((kw) => lower.includes(kw)).length;\n\tconst refactorScore = REFACTOR_KEYWORDS.filter((kw) => lower.includes(kw)).length;\n\n\tconst maxScore = Math.max(bugfixScore, enhancementScore, refactorScore);\n\n\tif (maxScore === 0) {\n\t\treturn {\n\t\t\ttype: \"new_feature\",\n\t\t\treason: \"No specific workflow keywords detected; defaulting to new_feature\",\n\t\t\tconfidence: 0.5,\n\t\t};\n\t}\n\n\tif (bugfixScore === maxScore && bugfixScore > enhancementScore && bugfixScore > refactorScore) {\n\t\treturn {\n\t\t\ttype: \"bugfix\",\n\t\t\treason: `Matched bugfix keywords: ${BUGFIX_KEYWORDS.filter((kw) => lower.includes(kw)).join(\", \")}`,\n\t\t\tconfidence: Math.min(0.9, 0.5 + bugfixScore * 0.1),\n\t\t};\n\t}\n\n\tif (refactorScore === maxScore && refactorScore > enhancementScore) {\n\t\treturn {\n\t\t\ttype: \"refactor\",\n\t\t\treason: `Matched refactor keywords: ${REFACTOR_KEYWORDS.filter((kw) => lower.includes(kw)).join(\", \")}`,\n\t\t\tconfidence: Math.min(0.9, 0.5 + refactorScore * 0.1),\n\t\t};\n\t}\n\n\tif (enhancementScore === maxScore) {\n\t\treturn {\n\t\t\ttype: \"enhancement\",\n\t\t\treason: `Matched enhancement keywords: ${ENHANCEMENT_KEYWORDS.filter((kw) => lower.includes(kw)).join(\", \")}`,\n\t\t\tconfidence: Math.min(0.9, 0.5 + enhancementScore * 0.1),\n\t\t};\n\t}\n\n\treturn {\n\t\ttype: \"new_feature\",\n\t\treason: \"Ambiguous classification; defaulting to new_feature\",\n\t\tconfidence: 0.4,\n\t};\n}\n\n// ─── Feature ID Type Inference ───────────────────────────────────────────────\n\n/** Infers WorkflowType from the featureId prefix. Never returns \"mixed\". */\nexport function inferWorkflowType(featureId: string): Exclude<WorkflowType, \"mixed\"> {\n\tif (featureId.startsWith(\"fix-\")) return \"bugfix\";\n\tif (featureId.startsWith(\"enhance-\")) return \"enhancement\";\n\tif (featureId.startsWith(\"refactor-\")) return \"refactor\";\n\treturn \"new_feature\";\n}\n\n/** If the plan's workflowType is \"mixed\", infer from featureId; otherwise use the plan type as-is. */\nexport function resolveFeatureWorkflowType(\n\tfeatureId: string,\n\tplanWorkflowType: WorkflowType,\n): Exclude<WorkflowType, \"mixed\"> {\n\tif (planWorkflowType === \"mixed\") {\n\t\treturn inferWorkflowType(featureId);\n\t}\n\treturn planWorkflowType as Exclude<WorkflowType, \"mixed\">;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAI9E,gCAAgC;AAChC,MAAM,WAAW,qBAAqB;IACrC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qCAAqC;AACrC,MAAM,WAAW,sBAAsB;IACtC,IAAI,EAAE,YAAY,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACnB;AAID,2IAA+H;AAC/H,wBAAgB,eAAe,IAAI,YAAY,EAAE,CAkDhD;AAED,6MAA+L;AAC/L,wBAAgB,gBAAgB,IAAI,YAAY,EAAE,CAwDjD;AAED,0GAA4F;AAC5F,wBAAgB,WAAW,IAAI,YAAY,EAAE,CAyD5C;AAED,mGAAuF;AACvF,wBAAgB,aAAa,IAAI,YAAY,EAAE,CAiD9C;AAID;;GAEG;AACH,wBAAgB,cAAc,CAC7B,IAAI,EAAE,YAAY,EAClB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,qBAAqB,GAC7B,eAAe,CAgCjB;AAID;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,EAAE,CAyDzF;AAQD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,sBAAsB,CA8C5E;AAID,4EAA4E;AAC5E,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,CAKnF;AAED,sGAAsG;AACtG,wBAAgB,0BAA0B,CACzC,SAAS,EAAE,MAAM,EACjB,gBAAgB,EAAE,YAAY,GAC5B,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,CAKhC","sourcesContent":["import type { FeaturePipeline, PipelineStep, WorkflowType } from \"./types.js\";\n\n// ─── Types ───────────────────────────────────────────────────────────────────\n\n/** Pipeline creation options */\nexport interface CreatePipelineOptions {\n\tparentFeatureId?: string;\n\tissueRef?: string;\n\tmaxRetries?: number;\n}\n\n/** Workflow classification result */\nexport interface WorkflowClassification {\n\ttype: WorkflowType;\n\treason: string;\n\tconfidence: number;\n}\n\n// ─── Step Templates ──────────────────────────────────────────────────────────\n\n/** new_feature: Design → Branch → Implement → Test → Regression → Review → PR/Merge (spec.md is pre-placed by orchestrator) */\nexport function newFeatureSteps(): PipelineStep[] {\n\treturn [\n\t\t{\n\t\t\tagent: \"architect\",\n\t\t\taction: \"design\",\n\t\t\tinputs: [\"spec.md\"],\n\t\t\toutputs: [\"design.md\"],\n\t\t\tgate: { type: \"file_exists\", target: \"design.md\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"branch\",\n\t\t\tinputs: [\"spec.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"developer\",\n\t\t\taction: \"implement\",\n\t\t\tinputs: [\"spec.md\", \"design.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"test\",\n\t\t\tinputs: [\"spec.md\", \"design.md\"],\n\t\t\toutputs: [\"test-report.md\"],\n\t\t\tgate: { type: \"test_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"regression\",\n\t\t\tinputs: [\"spec.md\", \"test-report.md\"],\n\t\t\toutputs: [\"regression-report.md\"],\n\t\t\tgate: { type: \"regression_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"reviewer\",\n\t\t\taction: \"review\",\n\t\t\tinputs: [\"spec.md\", \"design.md\", \"test-report.md\", \"regression-report.md\"],\n\t\t\toutputs: [\"review.md\"],\n\t\t\tgate: { type: \"review_approve\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"merge\",\n\t\t\tinputs: [\"review.md\"],\n\t\t\toutputs: [],\n\t\t\tgate: { type: \"merge_approve\", target: \"\" },\n\t\t},\n\t];\n}\n\n/** enhancement: Analyze → Design → Branch → Implement → Test → Regression → Review → PR/Merge (spec.md is pre-placed by orchestrator; Analyze also runs at orchestration level for Planner) */\nexport function enhancementSteps(): PipelineStep[] {\n\treturn [\n\t\t{\n\t\t\tagent: \"analyzer\",\n\t\t\taction: \"analyze\",\n\t\t\tinputs: [\"spec.md\"],\n\t\t\toutputs: [\"impact-report.md\"],\n\t\t},\n\t\t{\n\t\t\tagent: \"architect\",\n\t\t\taction: \"design\",\n\t\t\tinputs: [\"spec.md\"],\n\t\t\toutputs: [\"design.md\"],\n\t\t\tgate: { type: \"file_exists\", target: \"design.md\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"branch\",\n\t\t\tinputs: [\"spec.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"developer\",\n\t\t\taction: \"implement\",\n\t\t\tinputs: [\"spec.md\", \"design.md\", \"impact-report.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"test\",\n\t\t\tinputs: [\"spec.md\", \"design.md\"],\n\t\t\toutputs: [\"test-report.md\"],\n\t\t\tgate: { type: \"test_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"regression\",\n\t\t\tinputs: [\"spec.md\", \"impact-report.md\", \"test-report.md\"],\n\t\t\toutputs: [\"regression-report.md\"],\n\t\t\tgate: { type: \"regression_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"reviewer\",\n\t\t\taction: \"review\",\n\t\t\tinputs: [\"spec.md\", \"design.md\", \"impact-report.md\", \"test-report.md\", \"regression-report.md\"],\n\t\t\toutputs: [\"review.md\"],\n\t\t\tgate: { type: \"review_approve\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"merge\",\n\t\t\tinputs: [\"review.md\"],\n\t\t\toutputs: [],\n\t\t\tgate: { type: \"merge_approve\", target: \"\" },\n\t\t},\n\t];\n}\n\n/** bugfix: Investigate → Diagnose → Branch → Fix → Test → Regression → Review → PR/Merge */\nexport function bugfixSteps(): PipelineStep[] {\n\treturn [\n\t\t{\n\t\t\tagent: \"diagnostician\",\n\t\t\taction: \"investigate\",\n\t\t\tinputs: [],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"diagnostician\",\n\t\t\taction: \"diagnose\",\n\t\t\tinputs: [],\n\t\t\toutputs: [\"diagnosis.md\"],\n\t\t\tgate: { type: \"diagnosis_approve\", target: \"\" },\n\t\t\tinheritPriorHistory: true,\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"branch\",\n\t\t\tinputs: [\"diagnosis.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"developer\",\n\t\t\taction: \"fix\",\n\t\t\tinputs: [\"diagnosis.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"test\",\n\t\t\tinputs: [\"diagnosis.md\"],\n\t\t\toutputs: [\"test-report.md\"],\n\t\t\tgate: { type: \"test_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"regression\",\n\t\t\tinputs: [\"diagnosis.md\", \"test-report.md\"],\n\t\t\toutputs: [\"regression-report.md\"],\n\t\t\tgate: { type: \"regression_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"reviewer\",\n\t\t\taction: \"review\",\n\t\t\tinputs: [\"diagnosis.md\", \"test-report.md\", \"regression-report.md\"],\n\t\t\toutputs: [\"review.md\"],\n\t\t\tgate: { type: \"review_approve\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"merge\",\n\t\t\tinputs: [\"review.md\"],\n\t\t\toutputs: [],\n\t\t\tgate: { type: \"merge_approve\", target: \"\" },\n\t\t},\n\t];\n}\n\n/** refactor: Analyze → Design → Branch → Implement → Regression → Review → PR/Merge */\nexport function refactorSteps(): PipelineStep[] {\n\treturn [\n\t\t{\n\t\t\tagent: \"analyzer\",\n\t\t\taction: \"analyze\",\n\t\t\tinputs: [\"spec.md\"],\n\t\t\toutputs: [\"impact-report.md\"],\n\t\t},\n\t\t{\n\t\t\tagent: \"architect\",\n\t\t\taction: \"design\",\n\t\t\tinputs: [\"impact-report.md\"],\n\t\t\toutputs: [\"design.md\"],\n\t\t\tgate: { type: \"file_exists\", target: \"design.md\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"branch\",\n\t\t\tinputs: [\"design.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"developer\",\n\t\t\taction: \"implement\",\n\t\t\tinputs: [\"design.md\", \"impact-report.md\"],\n\t\t\toutputs: [],\n\t\t},\n\t\t{\n\t\t\tagent: \"tester\",\n\t\t\taction: \"regression\",\n\t\t\tinputs: [\"design.md\", \"impact-report.md\"],\n\t\t\toutputs: [\"regression-report.md\"],\n\t\t\tgate: { type: \"all_tests_pass\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"reviewer\",\n\t\t\taction: \"review\",\n\t\t\tinputs: [\"design.md\", \"impact-report.md\", \"regression-report.md\"],\n\t\t\toutputs: [\"review.md\"],\n\t\t\tgate: { type: \"review_approve\", target: \"\" },\n\t\t},\n\t\t{\n\t\t\tagent: \"cicd\",\n\t\t\taction: \"merge\",\n\t\t\tinputs: [\"review.md\"],\n\t\t\toutputs: [],\n\t\t\tgate: { type: \"merge_approve\", target: \"\" },\n\t\t},\n\t];\n}\n\n// ─── Pipeline Factory ────────────────────────────────────────────────────────\n\n/**\n * Creates a FeaturePipeline matching the given workflow type.\n */\nexport function createPipeline(\n\ttype: WorkflowType,\n\tfeatureId: string,\n\toptions?: CreatePipelineOptions,\n): FeaturePipeline {\n\tlet steps: PipelineStep[];\n\tswitch (type) {\n\t\tcase \"new_feature\":\n\t\t\tsteps = newFeatureSteps();\n\t\t\tbreak;\n\t\tcase \"enhancement\":\n\t\t\tsteps = enhancementSteps();\n\t\t\tbreak;\n\t\tcase \"bugfix\":\n\t\t\tsteps = bugfixSteps();\n\t\t\tbreak;\n\t\tcase \"refactor\":\n\t\t\tsteps = refactorSteps();\n\t\t\tbreak;\n\t\tcase \"mixed\":\n\t\t\tthrow new Error(\n\t\t\t\t'Cannot create pipeline with workflowType \"mixed\". Resolve to a concrete type (new_feature, enhancement, bugfix, refactor) first.',\n\t\t\t);\n\t}\n\n\treturn {\n\t\tfeatureId,\n\t\tworkflowType: type,\n\t\tsteps,\n\t\tcurrentStep: 0,\n\t\tstatus: \"pending\",\n\t\tretryCount: 0,\n\t\tmaxRetries: options?.maxRetries ?? 3,\n\t\tparentFeatureId: options?.parentFeatureId,\n\t\tissueRef: options?.issueRef,\n\t};\n}\n\n// ─── Execution Order ─────────────────────────────────────────────────────────\n\n/**\n * Topologically sorts the dependency graph and returns the execution order.\n * Uses Kahn's algorithm. Throws on circular dependencies.\n */\nexport function resolveExecutionOrder(dependencyGraph: Record<string, string[]>): string[] {\n\t// Collect all nodes: both keys and values (dependency targets)\n\tconst nodeSet = new Set<string>();\n\tfor (const [node, deps] of Object.entries(dependencyGraph)) {\n\t\tnodeSet.add(node);\n\t\tfor (const dep of deps) {\n\t\t\tnodeSet.add(dep);\n\t\t}\n\t}\n\tconst nodes = [...nodeSet];\n\tconst inDegree = new Map<string, number>();\n\tconst adjacency = new Map<string, string[]>();\n\n\tfor (const node of nodes) {\n\t\tinDegree.set(node, 0);\n\t\tadjacency.set(node, []);\n\t}\n\n\tfor (const [node, deps] of Object.entries(dependencyGraph)) {\n\t\tinDegree.set(node, deps.length);\n\t\tfor (const dep of deps) {\n\t\t\tconst adj = adjacency.get(dep);\n\t\t\tif (adj) {\n\t\t\t\tadj.push(node);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst queue: string[] = [];\n\tfor (const [node, degree] of inDegree) {\n\t\tif (degree === 0) {\n\t\t\tqueue.push(node);\n\t\t}\n\t}\n\n\tconst result: string[] = [];\n\twhile (queue.length > 0) {\n\t\t// Process in alphabetical order for stable sorting\n\t\tqueue.sort();\n\t\tconst node = queue.shift()!;\n\t\tresult.push(node);\n\n\t\tconst neighbors = adjacency.get(node) ?? [];\n\t\tfor (const neighbor of neighbors) {\n\t\t\tconst degree = (inDegree.get(neighbor) ?? 1) - 1;\n\t\t\tinDegree.set(neighbor, degree);\n\t\t\tif (degree === 0) {\n\t\t\t\tqueue.push(neighbor);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (result.length !== nodes.length) {\n\t\tthrow new Error(\"Circular dependency detected in dependency graph\");\n\t}\n\n\treturn result;\n}\n\n// ─── Workflow Classification ─────────────────────────────────────────────────\n\nconst BUGFIX_KEYWORDS = [\"bug\", \"fix\", \"error\", \"crash\", \"broken\", \"regression\", \"issue\", \"defect\", \"fault\"];\nconst ENHANCEMENT_KEYWORDS = [\"enhance\", \"improve\", \"upgrade\", \"extend\", \"add to\", \"expand\", \"optimize\"];\nconst REFACTOR_KEYWORDS = [\"refactor\", \"restructure\", \"reorganize\", \"clean up\", \"simplify\", \"modernize\"];\n\n/**\n * Classifies the workflow type from requirement text using keyword matching.\n */\nexport function classifyWorkflow(requirement: string): WorkflowClassification {\n\tconst lower = requirement.toLowerCase();\n\n\tconst bugfixScore = BUGFIX_KEYWORDS.filter((kw) => lower.includes(kw)).length;\n\tconst enhancementScore = ENHANCEMENT_KEYWORDS.filter((kw) => lower.includes(kw)).length;\n\tconst refactorScore = REFACTOR_KEYWORDS.filter((kw) => lower.includes(kw)).length;\n\n\tconst maxScore = Math.max(bugfixScore, enhancementScore, refactorScore);\n\n\tif (maxScore === 0) {\n\t\treturn {\n\t\t\ttype: \"new_feature\",\n\t\t\treason: \"No specific workflow keywords detected; defaulting to new_feature\",\n\t\t\tconfidence: 0.5,\n\t\t};\n\t}\n\n\tif (bugfixScore === maxScore && bugfixScore > enhancementScore && bugfixScore > refactorScore) {\n\t\treturn {\n\t\t\ttype: \"bugfix\",\n\t\t\treason: `Matched bugfix keywords: ${BUGFIX_KEYWORDS.filter((kw) => lower.includes(kw)).join(\", \")}`,\n\t\t\tconfidence: Math.min(0.9, 0.5 + bugfixScore * 0.1),\n\t\t};\n\t}\n\n\tif (refactorScore === maxScore && refactorScore > enhancementScore) {\n\t\treturn {\n\t\t\ttype: \"refactor\",\n\t\t\treason: `Matched refactor keywords: ${REFACTOR_KEYWORDS.filter((kw) => lower.includes(kw)).join(\", \")}`,\n\t\t\tconfidence: Math.min(0.9, 0.5 + refactorScore * 0.1),\n\t\t};\n\t}\n\n\tif (enhancementScore === maxScore) {\n\t\treturn {\n\t\t\ttype: \"enhancement\",\n\t\t\treason: `Matched enhancement keywords: ${ENHANCEMENT_KEYWORDS.filter((kw) => lower.includes(kw)).join(\", \")}`,\n\t\t\tconfidence: Math.min(0.9, 0.5 + enhancementScore * 0.1),\n\t\t};\n\t}\n\n\treturn {\n\t\ttype: \"new_feature\",\n\t\treason: \"Ambiguous classification; defaulting to new_feature\",\n\t\tconfidence: 0.4,\n\t};\n}\n\n// ─── Feature ID Type Inference ───────────────────────────────────────────────\n\n/** Infers WorkflowType from the featureId prefix. Never returns \"mixed\". */\nexport function inferWorkflowType(featureId: string): Exclude<WorkflowType, \"mixed\"> {\n\tif (featureId.startsWith(\"fix-\")) return \"bugfix\";\n\tif (featureId.startsWith(\"enhance-\")) return \"enhancement\";\n\tif (featureId.startsWith(\"refactor-\")) return \"refactor\";\n\treturn \"new_feature\";\n}\n\n/** If the plan's workflowType is \"mixed\", infer from featureId; otherwise use the plan type as-is. */\nexport function resolveFeatureWorkflowType(\n\tfeatureId: string,\n\tplanWorkflowType: WorkflowType,\n): Exclude<WorkflowType, \"mixed\"> {\n\tif (planWorkflowType === \"mixed\") {\n\t\treturn inferWorkflowType(featureId);\n\t}\n\treturn planWorkflowType as Exclude<WorkflowType, \"mixed\">;\n}\n"]}
|
package/dist/router.js
CHANGED
|
@@ -57,7 +57,7 @@ export function enhancementSteps() {
|
|
|
57
57
|
{
|
|
58
58
|
agent: "analyzer",
|
|
59
59
|
action: "analyze",
|
|
60
|
-
inputs: [],
|
|
60
|
+
inputs: ["spec.md"],
|
|
61
61
|
outputs: ["impact-report.md"],
|
|
62
62
|
},
|
|
63
63
|
{
|
|
@@ -89,14 +89,14 @@ export function enhancementSteps() {
|
|
|
89
89
|
{
|
|
90
90
|
agent: "tester",
|
|
91
91
|
action: "regression",
|
|
92
|
-
inputs: ["impact-report.md", "test-report.md"],
|
|
92
|
+
inputs: ["spec.md", "impact-report.md", "test-report.md"],
|
|
93
93
|
outputs: ["regression-report.md"],
|
|
94
94
|
gate: { type: "regression_pass", target: "" },
|
|
95
95
|
},
|
|
96
96
|
{
|
|
97
97
|
agent: "reviewer",
|
|
98
98
|
action: "review",
|
|
99
|
-
inputs: ["spec.md", "design.md", "test-report.md", "regression-report.md"],
|
|
99
|
+
inputs: ["spec.md", "design.md", "impact-report.md", "test-report.md", "regression-report.md"],
|
|
100
100
|
outputs: ["review.md"],
|
|
101
101
|
gate: { type: "review_approve", target: "" },
|
|
102
102
|
},
|
|
@@ -174,7 +174,7 @@ export function refactorSteps() {
|
|
|
174
174
|
{
|
|
175
175
|
agent: "analyzer",
|
|
176
176
|
action: "analyze",
|
|
177
|
-
inputs: [],
|
|
177
|
+
inputs: ["spec.md"],
|
|
178
178
|
outputs: ["impact-report.md"],
|
|
179
179
|
},
|
|
180
180
|
{
|
|
@@ -199,14 +199,14 @@ export function refactorSteps() {
|
|
|
199
199
|
{
|
|
200
200
|
agent: "tester",
|
|
201
201
|
action: "regression",
|
|
202
|
-
inputs: ["impact-report.md"],
|
|
202
|
+
inputs: ["design.md", "impact-report.md"],
|
|
203
203
|
outputs: ["regression-report.md"],
|
|
204
204
|
gate: { type: "all_tests_pass", target: "" },
|
|
205
205
|
},
|
|
206
206
|
{
|
|
207
207
|
agent: "reviewer",
|
|
208
208
|
action: "review",
|
|
209
|
-
inputs: ["design.md", "regression-report.md"],
|
|
209
|
+
inputs: ["design.md", "impact-report.md", "regression-report.md"],
|
|
210
210
|
outputs: ["review.md"],
|
|
211
211
|
gate: { type: "review_approve", target: "" },
|
|
212
212
|
},
|