sofia-cli 0.1.1
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/.github/agents/copilot-instructions.md +39 -0
- package/.github/agents/speckit.analyze.agent.md +184 -0
- package/.github/agents/speckit.checklist.agent.md +294 -0
- package/.github/agents/speckit.clarify.agent.md +181 -0
- package/.github/agents/speckit.constitution.agent.md +84 -0
- package/.github/agents/speckit.implement.agent.md +135 -0
- package/.github/agents/speckit.plan.agent.md +90 -0
- package/.github/agents/speckit.specify.agent.md +258 -0
- package/.github/agents/speckit.tasks.agent.md +137 -0
- package/.github/agents/speckit.taskstoissues.agent.md +30 -0
- package/.github/copilot-instructions.md +257 -0
- package/.github/prompts/speckit.analyze.prompt.md +3 -0
- package/.github/prompts/speckit.checklist.prompt.md +3 -0
- package/.github/prompts/speckit.clarify.prompt.md +3 -0
- package/.github/prompts/speckit.constitution.prompt.md +3 -0
- package/.github/prompts/speckit.implement.prompt.md +3 -0
- package/.github/prompts/speckit.plan.prompt.md +3 -0
- package/.github/prompts/speckit.specify.prompt.md +3 -0
- package/.github/prompts/speckit.tasks.prompt.md +3 -0
- package/.github/prompts/speckit.taskstoissues.prompt.md +3 -0
- package/.github/workflows/ci.yml +38 -0
- package/.prettierrc +6 -0
- package/.specify/memory/constitution.md +181 -0
- package/.specify/scripts/bash/check-prerequisites.sh +166 -0
- package/.specify/scripts/bash/common.sh +156 -0
- package/.specify/scripts/bash/create-new-feature.sh +297 -0
- package/.specify/scripts/bash/setup-plan.sh +61 -0
- package/.specify/scripts/bash/update-agent-context.sh +810 -0
- package/.specify/templates/agent-file-template.md +28 -0
- package/.specify/templates/checklist-template.md +40 -0
- package/.specify/templates/constitution-template.md +50 -0
- package/.specify/templates/plan-template.md +113 -0
- package/.specify/templates/spec-template.md +115 -0
- package/.specify/templates/tasks-template.md +251 -0
- package/.vscode/mcp.json +42 -0
- package/.vscode/settings.json +19 -0
- package/CODE_OF_CONDUCT.md +128 -0
- package/LICENSE +21 -0
- package/README.md +213 -0
- package/dist/src/cli/developCommand.js +240 -0
- package/dist/src/cli/directCommands.js +143 -0
- package/dist/src/cli/envLoader.js +16 -0
- package/dist/src/cli/exportCommand.js +53 -0
- package/dist/src/cli/index.js +203 -0
- package/dist/src/cli/ioContext.js +109 -0
- package/dist/src/cli/preflight.js +57 -0
- package/dist/src/cli/statusCommand.js +110 -0
- package/dist/src/cli/workshopCommand.js +400 -0
- package/dist/src/develop/checkpointState.js +86 -0
- package/dist/src/develop/codeGenerator.js +319 -0
- package/dist/src/develop/dynamicScaffolder.js +226 -0
- package/dist/src/develop/githubMcpAdapter.js +122 -0
- package/dist/src/develop/index.js +15 -0
- package/dist/src/develop/mcpContextEnricher.js +195 -0
- package/dist/src/develop/pocScaffolder.js +542 -0
- package/dist/src/develop/ralphLoop.js +659 -0
- package/dist/src/develop/templateRegistry.js +364 -0
- package/dist/src/develop/testRunner.js +202 -0
- package/dist/src/logging/logger.js +58 -0
- package/dist/src/loop/conversationLoop.js +227 -0
- package/dist/src/loop/phaseSummarizer.js +87 -0
- package/dist/src/mcp/mcpManager.js +267 -0
- package/dist/src/mcp/mcpTransport.js +391 -0
- package/dist/src/mcp/retryPolicy.js +47 -0
- package/dist/src/mcp/webSearch.js +254 -0
- package/dist/src/phases/contextSummarizer.js +101 -0
- package/dist/src/phases/discoveryEnricher.js +156 -0
- package/dist/src/phases/phaseExtractors.js +222 -0
- package/dist/src/phases/phaseHandlers.js +328 -0
- package/dist/src/prompts/design.md +51 -0
- package/dist/src/prompts/develop-boundary.md +51 -0
- package/dist/src/prompts/develop.md +111 -0
- package/dist/src/prompts/discover.md +58 -0
- package/dist/src/prompts/ideate.md +56 -0
- package/dist/src/prompts/plan.md +51 -0
- package/dist/src/prompts/promptLoader.js +167 -0
- package/dist/src/prompts/promptLoader.ts +198 -0
- package/dist/src/prompts/select.md +47 -0
- package/dist/src/prompts/summarize/README.md +8 -0
- package/dist/src/prompts/summarize/design-summary.md +37 -0
- package/dist/src/prompts/summarize/develop-summary.md +25 -0
- package/dist/src/prompts/summarize/ideate-summary.md +27 -0
- package/dist/src/prompts/summarize/plan-summary.md +27 -0
- package/dist/src/prompts/summarize/select-summary.md +21 -0
- package/dist/src/prompts/system.md +28 -0
- package/dist/src/sessions/exportPaths.js +22 -0
- package/dist/src/sessions/exportWriter.js +406 -0
- package/dist/src/sessions/sessionManager.js +81 -0
- package/dist/src/sessions/sessionStore.js +65 -0
- package/dist/src/shared/activitySpinner.js +91 -0
- package/dist/src/shared/copilotClient.js +129 -0
- package/dist/src/shared/data/cards.json +1249 -0
- package/dist/src/shared/data/cardsLoader.js +51 -0
- package/dist/src/shared/errorClassifier.js +120 -0
- package/dist/src/shared/events.js +28 -0
- package/dist/src/shared/markdownRenderer.js +34 -0
- package/dist/src/shared/schemas/session.js +265 -0
- package/dist/src/shared/tableRenderer.js +20 -0
- package/dist/src/vendor/chalk.js +2 -0
- package/dist/src/vendor/cli-table3.js +3 -0
- package/dist/src/vendor/commander.js +2 -0
- package/dist/src/vendor/marked-terminal.js +3 -0
- package/dist/src/vendor/marked.js +2 -0
- package/dist/src/vendor/ora.js +2 -0
- package/dist/src/vendor/pino.js +2 -0
- package/dist/src/vendor/zod.js +2 -0
- package/dist/tests/e2e/developE2e.spec.js +126 -0
- package/dist/tests/e2e/developFailureE2e.spec.js +247 -0
- package/dist/tests/e2e/developPty.spec.js +75 -0
- package/dist/tests/e2e/discoveryWebSearchRelevance.spec.js +84 -0
- package/dist/tests/e2e/harness.spec.js +83 -0
- package/dist/tests/e2e/mcpLive.spec.js +120 -0
- package/dist/tests/e2e/newSession.e2e.spec.js +177 -0
- package/dist/tests/e2e/ralphLoopEnrichmentComparison.spec.js +62 -0
- package/dist/tests/e2e/workiqEnrichment.spec.js +56 -0
- package/dist/tests/e2e/zavaSimulation.spec.js +452 -0
- package/dist/tests/fixtures/test-fixture-project/src/add.js +3 -0
- package/dist/tests/fixtures/test-fixture-project/tests/failing.test.js +6 -0
- package/dist/tests/fixtures/test-fixture-project/tests/hanging.test.js +8 -0
- package/dist/tests/fixtures/test-fixture-project/tests/passing.test.js +10 -0
- package/dist/tests/fixtures/test-fixture-project/vitest.config.js +6 -0
- package/dist/tests/integration/autoStartConversation.spec.js +138 -0
- package/dist/tests/integration/defaultCommand.spec.js +147 -0
- package/dist/tests/integration/directCommandNonTty.spec.js +224 -0
- package/dist/tests/integration/directCommandTty.spec.js +151 -0
- package/dist/tests/integration/discoveryEnrichmentFlow.spec.js +175 -0
- package/dist/tests/integration/exportArtifacts.spec.js +202 -0
- package/dist/tests/integration/exportFallbackFlow.spec.js +99 -0
- package/dist/tests/integration/mcpDegradationFlow.spec.js +190 -0
- package/dist/tests/integration/mcpTransportFlow.spec.js +139 -0
- package/dist/tests/integration/newSessionFlow.spec.js +343 -0
- package/dist/tests/integration/pocGithubMcp.spec.js +186 -0
- package/dist/tests/integration/pocLocalFallback.spec.js +171 -0
- package/dist/tests/integration/pocScaffold.spec.js +163 -0
- package/dist/tests/integration/ralphLoopFlow.spec.js +359 -0
- package/dist/tests/integration/ralphLoopPartial.spec.js +368 -0
- package/dist/tests/integration/resumeAndBacktrack.spec.js +247 -0
- package/dist/tests/integration/spinnerLifecycle.spec.js +220 -0
- package/dist/tests/integration/summarizationFlow.spec.js +115 -0
- package/dist/tests/integration/testRunnerReal.spec.js +52 -0
- package/dist/tests/integration/webSearchAgent.spec.js +128 -0
- package/dist/tests/live/copilotSdkLive.spec.js +107 -0
- package/dist/tests/live/zavaFullWorkshop.spec.js +392 -0
- package/dist/tests/setup/loadEnv.js +3 -0
- package/dist/tests/unit/cli/developCommand.spec.js +567 -0
- package/dist/tests/unit/cli/directCommands.spec.js +279 -0
- package/dist/tests/unit/cli/envLoader.spec.js +58 -0
- package/dist/tests/unit/cli/ioContext.spec.js +119 -0
- package/dist/tests/unit/cli/preflight.spec.js +108 -0
- package/dist/tests/unit/cli/statusCommand.spec.js +111 -0
- package/dist/tests/unit/cli/workshopClientFallback.spec.js +80 -0
- package/dist/tests/unit/cli/workshopCommand.spec.js +329 -0
- package/dist/tests/unit/config/vitestEnvSetup.spec.js +13 -0
- package/dist/tests/unit/develop/checkpointState.spec.js +315 -0
- package/dist/tests/unit/develop/codeGenerator.spec.js +355 -0
- package/dist/tests/unit/develop/githubMcpAdapter.spec.js +231 -0
- package/dist/tests/unit/develop/mcpContextEnricher.spec.js +433 -0
- package/dist/tests/unit/develop/outputValidator.spec.js +119 -0
- package/dist/tests/unit/develop/pocScaffolder.spec.js +353 -0
- package/dist/tests/unit/develop/ralphLoop.spec.js +1248 -0
- package/dist/tests/unit/develop/templateRegistry.spec.js +85 -0
- package/dist/tests/unit/develop/testRunner.spec.js +249 -0
- package/dist/tests/unit/infraBicep.spec.js +92 -0
- package/dist/tests/unit/infraDeploy.spec.js +82 -0
- package/dist/tests/unit/infraTeardown.spec.js +63 -0
- package/dist/tests/unit/logging/logger.spec.js +43 -0
- package/dist/tests/unit/loop/conversationLoop.spec.js +592 -0
- package/dist/tests/unit/loop/phaseSummarizer.spec.js +141 -0
- package/dist/tests/unit/loop/streamingMarkdown.spec.js +147 -0
- package/dist/tests/unit/mcp/mcpManager.spec.js +279 -0
- package/dist/tests/unit/mcp/mcpTransport.spec.js +529 -0
- package/dist/tests/unit/mcp/retryPolicy.spec.js +218 -0
- package/dist/tests/unit/mcp/timeoutValidation.spec.js +46 -0
- package/dist/tests/unit/mcp/webSearch.spec.js +567 -0
- package/dist/tests/unit/phases/contextSummarizer.spec.js +140 -0
- package/dist/tests/unit/phases/discoveryEnricher.repeatCalls.spec.js +93 -0
- package/dist/tests/unit/phases/discoveryEnricher.spec.js +411 -0
- package/dist/tests/unit/phases/phaseExtractors.spec.js +352 -0
- package/dist/tests/unit/phases/phaseHandlers.spec.js +425 -0
- package/dist/tests/unit/prompts/promptLoader.spec.js +118 -0
- package/dist/tests/unit/schemas/pocSchemas.spec.js +412 -0
- package/dist/tests/unit/schemas/session.spec.js +257 -0
- package/dist/tests/unit/sessions/exportPaths.spec.js +31 -0
- package/dist/tests/unit/sessions/exportWriter.spec.js +655 -0
- package/dist/tests/unit/sessions/sessionManager.spec.js +151 -0
- package/dist/tests/unit/sessions/sessionStore.spec.js +116 -0
- package/dist/tests/unit/shared/activitySpinner.spec.js +175 -0
- package/dist/tests/unit/shared/cardsLoader.spec.js +76 -0
- package/dist/tests/unit/shared/copilotClient.spec.js +155 -0
- package/dist/tests/unit/shared/errorClassifier.spec.js +131 -0
- package/dist/tests/unit/shared/events.spec.js +55 -0
- package/dist/tests/unit/shared/markdownRenderer.spec.js +35 -0
- package/dist/tests/unit/shared/markdownRendererChunks.spec.js +70 -0
- package/dist/tests/unit/shared/tableRenderer.spec.js +34 -0
- package/dist/vitest.config.js +14 -0
- package/dist/vitest.live.config.js +18 -0
- package/docs/README.md +35 -0
- package/docs/architecture.md +169 -0
- package/docs/cli-usage.md +207 -0
- package/docs/environment.md +66 -0
- package/docs/export-format.md +146 -0
- package/docs/session-model.md +113 -0
- package/eslint.config.js +35 -0
- package/infra/deploy.sh +193 -0
- package/infra/gather-env.sh +211 -0
- package/infra/main.bicep +90 -0
- package/infra/main.bicepparam +18 -0
- package/infra/resources.bicep +134 -0
- package/infra/teardown.sh +114 -0
- package/package.json +63 -0
- package/specs/001-cli-workshop-rebuild/checklists/requirements.md +35 -0
- package/specs/001-cli-workshop-rebuild/contracts/cli.md +59 -0
- package/specs/001-cli-workshop-rebuild/contracts/export-summary-json.md +23 -0
- package/specs/001-cli-workshop-rebuild/contracts/session-json.md +30 -0
- package/specs/001-cli-workshop-rebuild/data-model.md +210 -0
- package/specs/001-cli-workshop-rebuild/plan.md +361 -0
- package/specs/001-cli-workshop-rebuild/quickstart.md +83 -0
- package/specs/001-cli-workshop-rebuild/research.md +116 -0
- package/specs/001-cli-workshop-rebuild/spec.md +240 -0
- package/specs/001-cli-workshop-rebuild/tasks.md +476 -0
- package/specs/002-poc-generation/contracts/poc-output.md +172 -0
- package/specs/002-poc-generation/contracts/ralph-loop.md +113 -0
- package/specs/002-poc-generation/data-model.md +172 -0
- package/specs/002-poc-generation/plan.md +109 -0
- package/specs/002-poc-generation/quickstart.md +97 -0
- package/specs/002-poc-generation/research.md +786 -0
- package/specs/002-poc-generation/spec.md +81 -0
- package/specs/002-poc-generation/tasks-fix.md +198 -0
- package/specs/002-poc-generation/tasks.md +252 -0
- package/specs/003-mcp-transport-integration/checklists/requirements.md +37 -0
- package/specs/003-mcp-transport-integration/contracts/context-enricher.md +220 -0
- package/specs/003-mcp-transport-integration/contracts/discovery-enricher.md +267 -0
- package/specs/003-mcp-transport-integration/contracts/github-adapter.md +149 -0
- package/specs/003-mcp-transport-integration/contracts/mcp-transport.md +288 -0
- package/specs/003-mcp-transport-integration/data-model.md +326 -0
- package/specs/003-mcp-transport-integration/plan.md +114 -0
- package/specs/003-mcp-transport-integration/quickstart.md +311 -0
- package/specs/003-mcp-transport-integration/research.md +395 -0
- package/specs/003-mcp-transport-integration/spec.md +234 -0
- package/specs/003-mcp-transport-integration/tasks.md +324 -0
- package/specs/003-next-spec-gaps.md +150 -0
- package/specs/004-dev-resume-hardening/checklists/requirements.md +37 -0
- package/specs/004-dev-resume-hardening/contracts/cli.md +160 -0
- package/specs/004-dev-resume-hardening/data-model.md +321 -0
- package/specs/004-dev-resume-hardening/plan.md +107 -0
- package/specs/004-dev-resume-hardening/quickstart.md +115 -0
- package/specs/004-dev-resume-hardening/research.md +142 -0
- package/specs/004-dev-resume-hardening/spec.md +221 -0
- package/specs/004-dev-resume-hardening/tasks.md +333 -0
- package/specs/005-ai-search-deploy/checklists/requirements.md +39 -0
- package/specs/005-ai-search-deploy/contracts/web-search-tool.md +241 -0
- package/specs/005-ai-search-deploy/data-model.md +130 -0
- package/specs/005-ai-search-deploy/plan.md +93 -0
- package/specs/005-ai-search-deploy/quickstart.md +96 -0
- package/specs/005-ai-search-deploy/research.md +187 -0
- package/specs/005-ai-search-deploy/spec.md +143 -0
- package/specs/005-ai-search-deploy/tasks.md +284 -0
- package/specs/006-workshop-extraction-fixes/checklists/requirements.md +61 -0
- package/specs/006-workshop-extraction-fixes/contracts/summarization-and-export.md +131 -0
- package/specs/006-workshop-extraction-fixes/data-model.md +149 -0
- package/specs/006-workshop-extraction-fixes/plan.md +123 -0
- package/specs/006-workshop-extraction-fixes/quickstart.md +101 -0
- package/specs/006-workshop-extraction-fixes/research.md +143 -0
- package/specs/006-workshop-extraction-fixes/spec.md +210 -0
- package/specs/006-workshop-extraction-fixes/tasks.md +316 -0
- package/src/cli/developCommand.ts +308 -0
- package/src/cli/directCommands.ts +195 -0
- package/src/cli/envLoader.ts +17 -0
- package/src/cli/exportCommand.ts +65 -0
- package/src/cli/index.ts +249 -0
- package/src/cli/ioContext.ts +139 -0
- package/src/cli/preflight.ts +86 -0
- package/src/cli/statusCommand.ts +118 -0
- package/src/cli/workshopCommand.ts +496 -0
- package/src/develop/checkpointState.ts +121 -0
- package/src/develop/codeGenerator.ts +402 -0
- package/src/develop/dynamicScaffolder.ts +284 -0
- package/src/develop/githubMcpAdapter.ts +199 -0
- package/src/develop/index.ts +34 -0
- package/src/develop/mcpContextEnricher.ts +279 -0
- package/src/develop/pocScaffolder.ts +646 -0
- package/src/develop/ralphLoop.ts +1044 -0
- package/src/develop/templateRegistry.ts +427 -0
- package/src/develop/testRunner.ts +276 -0
- package/src/logging/logger.ts +73 -0
- package/src/loop/conversationLoop.ts +355 -0
- package/src/loop/phaseSummarizer.ts +114 -0
- package/src/mcp/mcpManager.ts +365 -0
- package/src/mcp/mcpTransport.ts +562 -0
- package/src/mcp/retryPolicy.ts +87 -0
- package/src/mcp/webSearch.ts +388 -0
- package/src/originalPrompts/design_thinking.md +178 -0
- package/src/originalPrompts/design_thinking_persona.md +76 -0
- package/src/originalPrompts/document_generator_example.md +77 -0
- package/src/originalPrompts/document_generator_persona.md +47 -0
- package/src/originalPrompts/facilitator_persona.md +125 -0
- package/src/originalPrompts/guardrails.md +47 -0
- package/src/phases/contextSummarizer.ts +154 -0
- package/src/phases/discoveryEnricher.ts +223 -0
- package/src/phases/phaseExtractors.ts +247 -0
- package/src/phases/phaseHandlers.ts +450 -0
- package/src/prompts/design.md +51 -0
- package/src/prompts/develop-boundary.md +51 -0
- package/src/prompts/develop.md +111 -0
- package/src/prompts/discover.md +58 -0
- package/src/prompts/ideate.md +56 -0
- package/src/prompts/plan.md +51 -0
- package/src/prompts/promptLoader.ts +198 -0
- package/src/prompts/select.md +47 -0
- package/src/prompts/summarize/README.md +8 -0
- package/src/prompts/summarize/design-summary.md +37 -0
- package/src/prompts/summarize/develop-summary.md +25 -0
- package/src/prompts/summarize/ideate-summary.md +27 -0
- package/src/prompts/summarize/plan-summary.md +27 -0
- package/src/prompts/summarize/select-summary.md +21 -0
- package/src/prompts/system.md +28 -0
- package/src/sessions/exportPaths.ts +28 -0
- package/src/sessions/exportWriter.ts +490 -0
- package/src/sessions/sessionManager.ts +119 -0
- package/src/sessions/sessionStore.ts +69 -0
- package/src/shared/activitySpinner.ts +108 -0
- package/src/shared/copilotClient.ts +291 -0
- package/src/shared/data/cards.json +1249 -0
- package/src/shared/data/cardsLoader.ts +70 -0
- package/src/shared/errorClassifier.ts +160 -0
- package/src/shared/events.ts +103 -0
- package/src/shared/markdownRenderer.ts +44 -0
- package/src/shared/schemas/session.ts +346 -0
- package/src/shared/tableRenderer.ts +28 -0
- package/src/types/marked-terminal.d.ts +5 -0
- package/src/vendor/chalk.ts +2 -0
- package/src/vendor/cli-table3.ts +3 -0
- package/src/vendor/commander.ts +2 -0
- package/src/vendor/marked-terminal.ts +3 -0
- package/src/vendor/marked.ts +2 -0
- package/src/vendor/ora.ts +2 -0
- package/src/vendor/pino.ts +3 -0
- package/src/vendor/zod.ts +3 -0
- package/tests/e2e/developE2e.spec.ts +152 -0
- package/tests/e2e/developFailureE2e.spec.ts +289 -0
- package/tests/e2e/developPty.spec.ts +86 -0
- package/tests/e2e/discoveryWebSearchRelevance.spec.ts +103 -0
- package/tests/e2e/harness.spec.ts +104 -0
- package/tests/e2e/mcpLive.spec.ts +149 -0
- package/tests/e2e/newSession.e2e.spec.ts +245 -0
- package/tests/e2e/ralphLoopEnrichmentComparison.spec.ts +70 -0
- package/tests/e2e/workiqEnrichment.spec.ts +72 -0
- package/tests/e2e/zava-assessment/agent-interaction-script.md +258 -0
- package/tests/e2e/zava-assessment/company-profile.md +98 -0
- package/tests/e2e/zava-assessment/expected-results-checklist.md +454 -0
- package/tests/e2e/zavaSimulation.spec.ts +511 -0
- package/tests/fixtures/completedSession.json +141 -0
- package/tests/fixtures/test-fixture-project/package-lock.json +1585 -0
- package/tests/fixtures/test-fixture-project/package.json +12 -0
- package/tests/fixtures/test-fixture-project/src/add.ts +3 -0
- package/tests/fixtures/test-fixture-project/tests/failing.test.ts +7 -0
- package/tests/fixtures/test-fixture-project/tests/hanging.test.ts +9 -0
- package/tests/fixtures/test-fixture-project/tests/passing.test.ts +13 -0
- package/tests/fixtures/test-fixture-project/vitest.config.ts +7 -0
- package/tests/integration/autoStartConversation.spec.ts +168 -0
- package/tests/integration/defaultCommand.spec.ts +179 -0
- package/tests/integration/directCommandNonTty.spec.ts +260 -0
- package/tests/integration/directCommandTty.spec.ts +185 -0
- package/tests/integration/discoveryEnrichmentFlow.spec.ts +209 -0
- package/tests/integration/exportArtifacts.spec.ts +232 -0
- package/tests/integration/exportFallbackFlow.spec.ts +115 -0
- package/tests/integration/mcpDegradationFlow.spec.ts +231 -0
- package/tests/integration/mcpTransportFlow.spec.ts +178 -0
- package/tests/integration/newSessionFlow.spec.ts +406 -0
- package/tests/integration/pocGithubMcp.spec.ts +224 -0
- package/tests/integration/pocLocalFallback.spec.ts +205 -0
- package/tests/integration/pocScaffold.spec.ts +220 -0
- package/tests/integration/ralphLoopFlow.spec.ts +430 -0
- package/tests/integration/ralphLoopPartial.spec.ts +416 -0
- package/tests/integration/resumeAndBacktrack.spec.ts +278 -0
- package/tests/integration/spinnerLifecycle.spec.ts +270 -0
- package/tests/integration/summarizationFlow.spec.ts +135 -0
- package/tests/integration/testRunnerReal.spec.ts +63 -0
- package/tests/integration/webSearchAgent.spec.ts +155 -0
- package/tests/live/copilotSdkLive.spec.ts +149 -0
- package/tests/live/zavaFullWorkshop.spec.ts +515 -0
- package/tests/setup/loadEnv.ts +5 -0
- package/tests/unit/cli/developCommand.spec.ts +679 -0
- package/tests/unit/cli/directCommands.spec.ts +325 -0
- package/tests/unit/cli/envLoader.spec.ts +73 -0
- package/tests/unit/cli/ioContext.spec.ts +148 -0
- package/tests/unit/cli/preflight.spec.ts +125 -0
- package/tests/unit/cli/statusCommand.spec.ts +134 -0
- package/tests/unit/cli/workshopClientFallback.spec.ts +100 -0
- package/tests/unit/cli/workshopCommand.spec.ts +378 -0
- package/tests/unit/config/vitestEnvSetup.spec.ts +24 -0
- package/tests/unit/develop/checkpointState.spec.ts +378 -0
- package/tests/unit/develop/codeGenerator.spec.ts +447 -0
- package/tests/unit/develop/githubMcpAdapter.spec.ts +283 -0
- package/tests/unit/develop/mcpContextEnricher.spec.ts +564 -0
- package/tests/unit/develop/outputValidator.spec.ts +134 -0
- package/tests/unit/develop/pocScaffolder.spec.ts +451 -0
- package/tests/unit/develop/ralphLoop.spec.ts +1439 -0
- package/tests/unit/develop/templateRegistry.spec.ts +106 -0
- package/tests/unit/develop/testRunner.spec.ts +294 -0
- package/tests/unit/infraBicep.spec.ts +116 -0
- package/tests/unit/infraDeploy.spec.ts +102 -0
- package/tests/unit/infraTeardown.spec.ts +77 -0
- package/tests/unit/logging/logger.spec.ts +50 -0
- package/tests/unit/loop/conversationLoop.spec.ts +719 -0
- package/tests/unit/loop/phaseSummarizer.spec.ts +169 -0
- package/tests/unit/loop/streamingMarkdown.spec.ts +180 -0
- package/tests/unit/mcp/mcpManager.spec.ts +336 -0
- package/tests/unit/mcp/mcpTransport.spec.ts +689 -0
- package/tests/unit/mcp/retryPolicy.spec.ts +278 -0
- package/tests/unit/mcp/timeoutValidation.spec.ts +55 -0
- package/tests/unit/mcp/webSearch.spec.ts +718 -0
- package/tests/unit/phases/contextSummarizer.spec.ts +158 -0
- package/tests/unit/phases/discoveryEnricher.repeatCalls.spec.ts +125 -0
- package/tests/unit/phases/discoveryEnricher.spec.ts +512 -0
- package/tests/unit/phases/phaseExtractors.spec.ts +406 -0
- package/tests/unit/phases/phaseHandlers.spec.ts +483 -0
- package/tests/unit/prompts/promptLoader.spec.ts +144 -0
- package/tests/unit/schemas/pocSchemas.spec.ts +457 -0
- package/tests/unit/schemas/session.spec.ts +328 -0
- package/tests/unit/sessions/exportPaths.spec.ts +38 -0
- package/tests/unit/sessions/exportWriter.spec.ts +737 -0
- package/tests/unit/sessions/sessionManager.spec.ts +174 -0
- package/tests/unit/sessions/sessionStore.spec.ts +136 -0
- package/tests/unit/shared/activitySpinner.spec.ts +211 -0
- package/tests/unit/shared/cardsLoader.spec.ts +89 -0
- package/tests/unit/shared/copilotClient.spec.ts +185 -0
- package/tests/unit/shared/errorClassifier.spec.ts +152 -0
- package/tests/unit/shared/events.spec.ts +71 -0
- package/tests/unit/shared/markdownRenderer.spec.ts +42 -0
- package/tests/unit/shared/markdownRendererChunks.spec.ts +83 -0
- package/tests/unit/shared/tableRenderer.spec.ts +38 -0
- package/tsconfig.json +20 -0
- package/vitest.config.ts +15 -0
- package/vitest.live.config.ts +19 -0
|
@@ -0,0 +1,476 @@
|
|
|
1
|
+
# Tasks: sofIA Unified Build-From-Scratch CLI (Feature 001)
|
|
2
|
+
|
|
3
|
+
**Input**: Design documents from `/specs/001-cli-workshop-rebuild/`
|
|
4
|
+
**Prerequisites**: plan.md (required), spec.md (required), research.md, data-model.md, contracts/
|
|
5
|
+
|
|
6
|
+
**Tests**: Tests are REQUIRED for new behavior in this repository (Red → Green → Review). Write tests first for each user story and core infrastructure.
|
|
7
|
+
|
|
8
|
+
**Organization**: Tasks are grouped by user story to enable independent implementation and testing of each story. This feature covers Discover → Ideate → Design → Select → Plan and PoC intent capture only; concrete PoC repo generation and the Ralph loop are implemented in feature `002-poc-generation`.
|
|
9
|
+
|
|
10
|
+
## Format: `[ID] [P?] [Story] Description`
|
|
11
|
+
|
|
12
|
+
- **[P]**: Can run in parallel (different files, no dependencies)
|
|
13
|
+
- **[Story]**: Which user story this task belongs to (e.g., US1, US2, US3)
|
|
14
|
+
- Include exact file paths in descriptions
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Phase 1: Setup (Shared Infrastructure)
|
|
19
|
+
|
|
20
|
+
**Purpose**: Project initialization, TypeScript/Node toolchain, and base repository wiring.
|
|
21
|
+
|
|
22
|
+
- [x] T001 Initialize Node.js + TypeScript project structure at repo root (package.json, tsconfig.json, src/, tests/)
|
|
23
|
+
- [x] T002 Add core dependencies (`@github/copilot-sdk`, `commander`, `@inquirer/prompts`, `zod`, `pino`, `ora`, `marked`, `marked-terminal`, `chalk`, `cli-table3`) in package.json
|
|
24
|
+
- [x] T003 Configure TypeScript build scripts and Node 20 target in package.json
|
|
25
|
+
- [x] T004 [P] Configure linting/formatting (ESLint + Prettier) for src/ and tests/
|
|
26
|
+
- [x] T005 [P] Setup basic Vitest configuration file for unit/integration tests in tests/
|
|
27
|
+
- [x] T006 [P] Add npm scripts for `test`, `test:unit`, `test:integration`, and `test:e2e` in package.json
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Phase 2: Foundational (Blocking Prerequisites)
|
|
32
|
+
|
|
33
|
+
**Purpose**: Core infrastructure that MUST be complete before ANY user story can be implemented.
|
|
34
|
+
|
|
35
|
+
**⚠️ CRITICAL**: No user story work can begin until this phase is complete.
|
|
36
|
+
|
|
37
|
+
- [x] T007 Define shared type schemas for WorkshopSession and related entities in src/shared/schemas/session.ts
|
|
38
|
+
- [x] T008 Implement session persistence adapter (read/write) in src/sessions/sessionStore.ts using `./.sofia/sessions/<sessionId>.json`
|
|
39
|
+
- [x] T009 Implement export directory helper in src/sessions/exportPaths.ts for `./exports/<sessionId>/`
|
|
40
|
+
- [x] T010 Implement logging setup with `pino` in src/logging/logger.ts (includes redaction of secrets/PII)
|
|
41
|
+
- [x] T011 Implement activity/telemetry event model in src/shared/events.ts (TextDelta, Activity, ToolCall, ToolResult, PhaseChanged, Error)
|
|
42
|
+
- [x] T012 Implement ConversationLoop abstraction in src/loop/conversationLoop.ts (streaming renderer, event handling, Ctrl+C handling)
|
|
43
|
+
- [x] T013 [P] Implement Markdown rendering helper with `marked` + `marked-terminal` in src/shared/markdownRenderer.ts (TTY vs non-TTY, --json safe)
|
|
44
|
+
- [x] T014 [P] Implement CLI table helper using `cli-table3` in src/shared/tableRenderer.ts
|
|
45
|
+
- [x] T015 Implement MCP manager in src/mcp/mcpManager.ts (load .vscode/mcp.json, connect clients, list tools, error classification)
|
|
46
|
+
- [x] T016 Implement Copilot client wrapper in src/shared/copilotClient.ts to abstract Copilot SDK interactions for tests
|
|
47
|
+
- [x] T017 [P] Create initial CLI entrypoint in src/cli/index.ts wired to commander (no workshop commands implemented yet)
|
|
48
|
+
- [x] T018 [P] Add node-pty based E2E harness skeleton in tests/e2e/harness.spec.ts for driving the CLI interactively
|
|
49
|
+
- [x] T019 Add foundational unit tests for sessionStore, logger, markdownRenderer, and ConversationLoop in tests/unit/
|
|
50
|
+
- [x] T059 [P] Implement `web.search` tool backed by the Azure AI Foundry Bing Search agent in src/mcp/webSearch.ts, wired through McpManager and exposed to the Copilot SDK
|
|
51
|
+
- [x] T060 [P] Add unit/integration tests for `web.search` behavior and degradation paths (Foundry misconfigured/unavailable) in tests/unit/mcp/webSearch.spec.ts and/or tests/integration/webSearch.spec.ts
|
|
52
|
+
|
|
53
|
+
**Checkpoint**: Foundation ready – user story implementation can now begin in parallel.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Phase 3: User Story 1 - Run a new governed workshop session (Priority: P1) 🎯 MVP
|
|
58
|
+
|
|
59
|
+
**Goal**: Allow a facilitator to start a new workshop session, drive phases Discover → Ideate → Design → Select → Plan with explicit decision gates, and capture artifacts and PoC intent without losing progress.
|
|
60
|
+
|
|
61
|
+
**Independent Test**: Using the PTY harness, simulate a full `New Session` run that completes all phases, verifies phase summaries and decision gates, and confirms session persistence and artifacts are written.
|
|
62
|
+
|
|
63
|
+
### Tests for User Story 1 (REQUIRED) ⚠️
|
|
64
|
+
|
|
65
|
+
- [x] T020 [P] [US1] Add integration test in tests/integration/newSessionFlow.spec.ts to cover happy-path New Session through Plan with decision gates
|
|
66
|
+
- [x] T021 [P] [US1] Add PTY-based E2E test in tests/e2e/newSession.e2e.spec.ts to validate streaming output and interactive prompts
|
|
67
|
+
|
|
68
|
+
### Implementation for User Story 1
|
|
69
|
+
|
|
70
|
+
- [x] T022 [US1] Implement `sofia workshop` command and main menu (New Session, Resume Session, Status, Export) in src/cli/workshopCommand.ts
|
|
71
|
+
- [x] T023 [US1] Implement New Session flow wiring in src/cli/workshopCommand.ts to create a new WorkshopSession and persist it via sessionStore
|
|
72
|
+
- [x] T024 [US1] Implement Discover phase module in src/phases/discoverPhase.ts using WorkIQ (when available), web.search, and prompts from src/prompts/
|
|
73
|
+
- [x] T025 [US1] Implement Ideate phase module in src/phases/ideatePhase.ts using Discovery Cards dataset via src/shared/data/cardsLoader.ts
|
|
74
|
+
- [x] T026 [US1] Implement Design phase module in src/phases/designPhase.ts, including Idea Cards and Mermaid architecture sketch generation
|
|
75
|
+
- [x] T027 [US1] Implement Select phase module in src/phases/selectPhase.ts with BXT evaluation and scoring
|
|
76
|
+
- [x] T028 [US1] Implement Plan phase module in src/phases/planPhase.ts producing implementation roadmap and PoC intent fields
|
|
77
|
+
- [x] T029 [US1] Implement Develop boundary module in src/phases/developBoundary.ts to capture PoC requirements into PocDevelopmentState without generating a repo
|
|
78
|
+
- [x] T030 [US1] Implement governed phase progression and decision gates in src/loop/conversationLoop.ts (no auto-advance; explicit decisions only)
|
|
79
|
+
- [x] T031 [US1] Wire ConversationLoop into workshop command so that each phase uses streaming renderer and activity events
|
|
80
|
+
- [x] T032 [US1] Integrate rationale summaries and activity stream rendering into interactive output in src/cli/workshopCommand.ts
|
|
81
|
+
- [x] T033 [US1] Ensure session is persisted after every user input/turn in all phase modules via sessionStore
|
|
82
|
+
- [x] T034 [US1] Implement status command handler in src/cli/statusCommand.ts that reads session JSON and emits minimal status (TTY and --json)
|
|
83
|
+
- [x] T035 [US1] Add unit tests for individual phase modules (Discover/Ideate/Design/Select/Plan/Develop boundary) in tests/unit/phases/
|
|
84
|
+
|
|
85
|
+
**Checkpoint**: User Story 1 fully functional and testable independently via integration and E2E tests.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Phase 4: User Story 2 - Resume, backtrack, and export a session (Priority: P2)
|
|
90
|
+
|
|
91
|
+
**Goal**: Allow a facilitator to resume an existing session, step back to earlier phases with deterministic invalidation of downstream artifacts, and export customer-ready artifacts and summary JSON.
|
|
92
|
+
|
|
93
|
+
**Independent Test**: Using integration and PTY harness tests, create a session, stop mid-way, resume it, backtrack to an earlier phase, and export artifacts, verifying that downstream artifacts are regenerated correctly.
|
|
94
|
+
|
|
95
|
+
### Tests for User Story 2 (REQUIRED) ⚠️
|
|
96
|
+
|
|
97
|
+
- [x] T036 [P] [US2] Add integration test in tests/integration/resumeAndBacktrack.spec.ts covering resume, backtrack, and artifact invalidation
|
|
98
|
+
- [x] T037 [P] [US2] Add integration test in tests/integration/exportArtifacts.spec.ts to validate export bundle contents and summary.json
|
|
99
|
+
|
|
100
|
+
### Implementation for User Story 2
|
|
101
|
+
|
|
102
|
+
- [x] T038 [US2] Implement Resume Session menu option in src/cli/workshopCommand.ts that loads an existing session via sessionStore
|
|
103
|
+
- [x] T039 [US2] Implement backtrack capability in src/sessions/sessionManager.ts to move to an earlier phase and mark downstream artifacts invalid
|
|
104
|
+
- [x] T040 [US2] Ensure phase modules honor invalidated state and recompute artifacts deterministically when rerun
|
|
105
|
+
- [x] T041 [US2] Implement export command handler in src/cli/exportCommand.ts to generate Markdown artifacts per phase and summary.json under ./exports/<sessionId>/
|
|
106
|
+
- [x] T042 [US2] Implement ArtifactIndex writing in src/sessions/exportWriter.ts to track generated files and timestamps
|
|
107
|
+
- [x] T043 [US2] Add unit tests for sessionManager backtracking and artifact invalidation behavior in tests/unit/sessions/sessionManager.spec.ts
|
|
108
|
+
- [x] T044 [US2] Add unit tests for exportWriter and exportCommand in tests/unit/cli/exportCommand.spec.ts
|
|
109
|
+
|
|
110
|
+
**Checkpoint**: User Stories 1 and 2 both work independently; sessions can be resumed, backtracked, and exported safely.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Phase 5: User Story 3 - Continue a session via direct command mode (Priority: P3)
|
|
115
|
+
|
|
116
|
+
**Goal**: Support non-interactive and automation-friendly continuation of sessions with clear JSON-only output and correct behavior in TTY vs non-TTY environments.
|
|
117
|
+
|
|
118
|
+
**Independent Test**: Using CLI invocations under non-TTY and --json flags, verify that required inputs are enforced, failures are non-zero exits with actionable errors, and stdout remains machine-readable.
|
|
119
|
+
|
|
120
|
+
### Tests for User Story 3 (REQUIRED) ⚠️
|
|
121
|
+
|
|
122
|
+
- [x] T045 [P] [US3] Add integration test in tests/integration/directCommandTty.spec.ts for direct command mode with TTY (prompts for missing inputs)
|
|
123
|
+
- [x] T046 [P] [US3] Add integration test in tests/integration/directCommandNonTty.spec.ts for non-TTY mode (fails fast when inputs missing, JSON-only output)
|
|
124
|
+
|
|
125
|
+
### Implementation for User Story 3
|
|
126
|
+
|
|
127
|
+
- [x] T047 [US3] Implement direct command entrypoints (e.g., `sofia workshop --session <id> --phase <phase>` and `sofia status --session <id> --json`) in src/cli/directCommands.ts
|
|
128
|
+
- [x] T048 [US3] Implement detection of TTY vs non-TTY and JSON mode in src/cli/ioContext.ts
|
|
129
|
+
- [x] T049 [US3] Enforce required input validation in non-TTY mode with non-zero exit codes and actionable error messages
|
|
130
|
+
- [x] T050 [US3] Ensure stdout remains JSON-only when --json is specified, sending telemetry/activity to stderr instead
|
|
131
|
+
- [x] T051 [US3] Implement retry flag handling (e.g., `--retry <N>`) for transient failures in direct command flows in src/cli/directCommands.ts
|
|
132
|
+
- [x] T052 [US3] Add unit tests for ioContext, JSON output separation, and retry behavior in tests/unit/cli/directCommands.spec.ts
|
|
133
|
+
|
|
134
|
+
**Checkpoint**: All three user stories are independently functional and testable; automation scenarios are supported safely.
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Phase 6: Polish & Cross-Cutting Concerns
|
|
139
|
+
|
|
140
|
+
**Purpose**: Improvements that affect multiple user stories and overall robustness.
|
|
141
|
+
|
|
142
|
+
- [x] T053 [P] Add documentation for CLI usage, session model, and exports in a new docs/ directory (linking back to specs/001-cli-workshop-rebuild)
|
|
143
|
+
- [x] T054 Implement centralized error classification and mapping to user-facing messages in src/shared/errorClassifier.ts
|
|
144
|
+
- [x] T055 [P] Add additional unit tests for errorClassifier and edge cases (MCP down, WorkIQ unavailable, web.search failures) in tests/unit/shared/errorClassifier.spec.ts
|
|
145
|
+
- [x] T056 Implement pre-flight checks for Copilot connectivity and MCP readiness in src/cli/preflight.ts and integrate into workshop command startup
|
|
146
|
+
- [x] T057 [P] Validate quickstart.md by running commands and updating any mismatched flags or script names
|
|
147
|
+
- [x] T058 Review logs to ensure no secrets/PII are written; adjust logger redaction rules as needed
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Phase 7: New Capabilities — Session Naming, Default Command, Auto-Start (FR-004, FR-015a, FR-023a)
|
|
152
|
+
|
|
153
|
+
**Purpose**: Implement three new requirements from Session 2026-02-27 clarifications: auto-generated session names, workshop as default command, and auto-start conversations.
|
|
154
|
+
|
|
155
|
+
**Prerequisites**: All Phase 1–6 tasks complete (T001–T058 except T021 optional).
|
|
156
|
+
|
|
157
|
+
### 7a. Session Naming (FR-023a)
|
|
158
|
+
|
|
159
|
+
**Goal**: Auto-generate a short session name after the first Discover exchange that yields `businessContext`. The LLM includes `sessionName` in its structured JSON block. The name is extracted, persisted, and displayed in status output.
|
|
160
|
+
|
|
161
|
+
**Independent Test**: Unit tests verify schema accepts `name`, extractor parses `sessionName` from JSON, Discover handler sets `session.name`, and status command displays it.
|
|
162
|
+
|
|
163
|
+
#### Tests for 7a (REQUIRED — write first, verify they fail) ⚠️
|
|
164
|
+
|
|
165
|
+
- [x] T061 [P] [US1] Add unit test for `name` field in `workshopSessionSchema` (accepts string, omits gracefully) in tests/unit/schemas/session.spec.ts
|
|
166
|
+
- [x] T062 [P] [US1] Add unit test for `extractSessionName()` (parses `sessionName` from JSON block, returns null when missing) in tests/unit/phases/phaseExtractors.spec.ts
|
|
167
|
+
- [x] T063 [P] [US1] Add unit test for Discover handler `extractResult()` setting `session.name` when `sessionName` is present in LLM response, **and** a negative case verifying `extractResult()` does not set `session.name` when the LLM response lacks `sessionName`, in tests/unit/phases/phaseHandlers.spec.ts
|
|
168
|
+
- [x] T064 [P] [US1] Add unit test for `statusCommand` displaying session name in table and JSON output in tests/unit/cli/statusCommand.spec.ts
|
|
169
|
+
- [x] T064b [P] [US1] Add unit test for `workshopCommand` displaying session name in creation, resume, and pause messages in tests/unit/cli/workshopCommand.spec.ts
|
|
170
|
+
|
|
171
|
+
#### Implementation for 7a
|
|
172
|
+
|
|
173
|
+
- [x] T065 [US1] Add `name?: string` field to `workshopSessionSchema` in src/shared/schemas/session.ts
|
|
174
|
+
- [x] T066 [P] [US1] Add `extractSessionName()` extractor function in src/phases/phaseExtractors.ts (parse `sessionName` from JSON block via `extractJsonBlock`)
|
|
175
|
+
- [x] T067 [US1] Update Discover handler in src/phases/phaseHandlers.ts: update `extractResult()` to call `extractSessionName()` and set `session.name` **only if `session.name` is currently undefined** (first-write-wins semantics — FR-023a says "after the first Discover exchange"); update Discover system prompt to instruct LLM to include `sessionName` in JSON output
|
|
176
|
+
- [x] T068 [P] [US1] Update src/cli/statusCommand.ts to display session name in TTY table row and JSON output
|
|
177
|
+
- [x] T069 [P] [US1] Update src/cli/workshopCommand.ts to display session name when showing session info (creation, resume, pause messages)
|
|
178
|
+
|
|
179
|
+
**Checkpoint**: Sessions receive auto-generated names after the first business context exchange; names appear in status and workshop output.
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
### 7b. Default Workshop Command (FR-004 updated)
|
|
184
|
+
|
|
185
|
+
**Goal**: Running `sofia` with no subcommand starts the workshop flow (main menu). Workshop options (`--new-session`, `--phase`, `--retry`) promoted to top level. `sofia workshop` kept as alias. `status`/`export` remain explicit subcommands. `--help` shows all options at the top level.
|
|
186
|
+
|
|
187
|
+
**Independent Test**: Integration tests verify that `sofia` (no subcommand) enters the workshop flow, `sofia workshop` still works as alias, `sofia status` and `sofia export` still work, and `--help` shows workshop options at top level.
|
|
188
|
+
|
|
189
|
+
#### Tests for 7b (REQUIRED — write first, verify they fail) ⚠️
|
|
190
|
+
|
|
191
|
+
- [x] T070 [P] [US1/US2/US3] Add integration tests for default command behavior: `sofia` with no subcommand enters workshop, `sofia workshop` works as alias, `--help` shows workshop options at top level, **and** `sofia status` and `sofia export` subcommands continue to work after restructure, in tests/integration/defaultCommand.spec.ts
|
|
192
|
+
|
|
193
|
+
#### Implementation for 7b
|
|
194
|
+
|
|
195
|
+
- [x] T071 [US1/US2/US3] Restructure src/cli/index.ts: promote `--new-session`, `--phase`, `--retry` options to top-level `program`; add default action on `program` that invokes `workshopCommand()`; keep `program.command('workshop')` as alias pointing to same handler; keep `status` and `export` as explicit subcommands
|
|
196
|
+
- [x] T072 [US1/US2/US3] Update src/cli/workshopCommand.ts `WorkshopCommandOptions` interface to accept `retry` at top level (if not already) and ensure direct command mode (`--session` + `--phase`) works from top level
|
|
197
|
+
|
|
198
|
+
**Checkpoint**: `sofia` and `sofia workshop` both enter the same workshop flow; `--help` shows all options; status/export subcommands unchanged.
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
### 7c. Auto-Start Conversation (FR-015a)
|
|
203
|
+
|
|
204
|
+
**Goal**: When a conversation phase starts (new or resumed), the ConversationLoop sends an initial message to the LLM before waiting for user input. The LLM introduces the phase and asks the first question. On resume, it summarizes progress and asks the next question. 10-second timeout for first token.
|
|
205
|
+
|
|
206
|
+
**Independent Test**: Unit tests verify ConversationLoop sends initial message before `readInput()`, streams the greeting, records it in turns, and handles 10s timeout. Integration tests verify end-to-end auto-start in workshop flow.
|
|
207
|
+
|
|
208
|
+
#### Tests for 7c (REQUIRED — write first, verify they fail) ⚠️
|
|
209
|
+
|
|
210
|
+
- [x] T073 [P] [US1] Add unit tests for `ConversationLoop` auto-start behavior in tests/unit/loop/conversationLoop.spec.ts: sends `initialMessage` to LLM before `readInput()`, streams greeting response, records initial exchange in turn history, handles timeout
|
|
211
|
+
- [x] T074 [P] [US1] Add unit tests for `getInitialMessage()` method on `PhaseHandler` interface in tests/unit/phases/phaseHandlers.spec.ts: generates phase introduction for new sessions, generates progress summary for resumed sessions, works for all 6 phase handlers
|
|
212
|
+
- [x] T075 [P] [US1] Add integration test for auto-start wiring in tests/integration/autoStartConversation.spec.ts: verifying workshop flow sends initial message at phase start and LLM speaks first
|
|
213
|
+
|
|
214
|
+
> **Note (E3)**: Constitution VI requires PTY-based E2E tests for interactive UX changes. Auto-start changes who speaks first, which is an interactive UX change. A PTY E2E test is deferred here (same gap as T021) — the integration test in T075 covers the logic. If PTY tests become reliable, add `tests/e2e/autoStart.e2e.spec.ts`.
|
|
215
|
+
|
|
216
|
+
#### Implementation for 7c
|
|
217
|
+
|
|
218
|
+
- [x] T076 [US1] Add `initialMessage?: string` to `ConversationLoopOptions` interface and implement auto-start in `ConversationLoop.run()` in src/loop/conversationLoop.ts: if `initialMessage` is provided, send it to LLM via `streamResponse()` before entering `readInput()` loop; record initial exchange in turn history; apply 10-second timeout for first token
|
|
219
|
+
- [x] T077 [US1] Add `getInitialMessage(session: WorkshopSession): string` method to `PhaseHandler` interface and implement for all 6 phase handler factories in src/phases/phaseHandlers.ts: for new sessions (no turns), generate "Introduce [phase] and ask first question" prompt; for resumed sessions (existing turns), generate "Summarize progress and ask next question" prompt
|
|
220
|
+
- [x] T078 [US1] Wire auto-start into src/cli/workshopCommand.ts `runWorkshop()`: call `handler.getInitialMessage(session)` and pass result as `initialMessage` to `ConversationLoop` constructor at each phase start
|
|
221
|
+
|
|
222
|
+
**Checkpoint**: Workshop phases start with LLM greeting; user never has to speak first; resumed sessions get progress summary before next question.
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
### Phase 7 Validation
|
|
227
|
+
|
|
228
|
+
- [x] T079 Run full test suite (`npx vitest run`) and CLI smoke tests (`npm run start -- --help`, `npm run start -- status`, `npm run start -- --new-session --non-interactive`) to confirm no regressions
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## Phase 8: Visual Feedback & Streaming Markdown (FR-009a, FR-043a/b/c)
|
|
233
|
+
|
|
234
|
+
**Purpose**: Implement incremental markdown rendering during streaming, activity spinners (Thinking... + tool-specific), tool call summaries, and `--debug` verbose tool output.
|
|
235
|
+
|
|
236
|
+
**Prerequisites**: Phase 7 complete (T079 passed). Depends on existing `ConversationLoop`, `markdownRenderer`, `LoopIO`, and `events.ts`.
|
|
237
|
+
|
|
238
|
+
### 8a. Incremental Streaming Markdown Rendering (FR-009a)
|
|
239
|
+
|
|
240
|
+
**Goal**: Render LLM streaming text through `marked` + `marked-terminal` incrementally so users see formatted markdown (headings, bold, code, lists) in real time instead of raw syntax.
|
|
241
|
+
|
|
242
|
+
**Independent Test**: Unit tests verify that `TextDelta` chunks are rendered through `renderMarkdown()` before being written in TTY mode, and that raw markdown is preserved for session persistence.
|
|
243
|
+
|
|
244
|
+
#### Tests for 8a (REQUIRED — write first, verify they fail) ⚠️
|
|
245
|
+
|
|
246
|
+
- [X] T080 [P] [US1] Add unit tests for incremental markdown rendering in streaming in tests/unit/loop/conversationLoop.spec.ts: verify `TextDelta` chunks are passed through `renderMarkdown()` in TTY mode, raw markdown in non-TTY/JSON mode, and turn history stores raw markdown (not ANSI)
|
|
247
|
+
- [X] T081 [P] [US1] Add unit tests for `renderMarkdown()` handling of partial/incremental chunks in tests/unit/shared/markdownRenderer.spec.ts: verify partial markdown (split heading, incomplete bold) renders without crashing
|
|
248
|
+
|
|
249
|
+
#### Implementation for 8a
|
|
250
|
+
|
|
251
|
+
- [X] T082 [US1] Update `ConversationLoop.streamResponse()` in src/loop/conversationLoop.ts to pass `TextDelta` chunks through `renderMarkdown()` before `io.write()` in TTY mode; ensure raw markdown is accumulated separately for turn history persistence
|
|
252
|
+
- [X] T083 [US1] Update `renderMarkdown()` in src/shared/markdownRenderer.ts if needed to handle incremental chunk rendering gracefully (ensure `marked.parse()` doesn't throw on partial markdown)
|
|
253
|
+
|
|
254
|
+
**Checkpoint**: LLM streaming output appears as formatted markdown (colored headings, bold, code blocks) in the terminal during streaming.
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
### 8b. Activity Spinner Module (FR-043a, FR-043c)
|
|
259
|
+
|
|
260
|
+
**Goal**: Create a unified spinner module wrapping `ora` that manages "Thinking..." and tool-specific spinners with proper lifecycle.
|
|
261
|
+
|
|
262
|
+
**Independent Test**: Unit tests verify spinner methods (`startThinking`, `startToolCall`, `completeToolCall`, `stop`) produce expected outputs and respect TTY/JSON mode suppression.
|
|
263
|
+
|
|
264
|
+
#### Tests for 8b (REQUIRED — write first, verify they fail) ⚠️
|
|
265
|
+
|
|
266
|
+
- [X] T084 [P] [US1] Add unit tests for `ActivitySpinner` in tests/unit/shared/activitySpinner.spec.ts: verify `startThinking()` starts a spinner with "Thinking..." text, `startToolCall(name)` updates spinner text, `completeToolCall(name, summary)` stops spinner and prints summary, `stop()` clears spinner, and all methods are no-ops when non-TTY or JSON mode
|
|
267
|
+
|
|
268
|
+
#### Implementation for 8b
|
|
269
|
+
|
|
270
|
+
- [X] T085 [US1] Create `src/shared/activitySpinner.ts` with `ActivitySpinner` class wrapping `ora`: constructor accepts `{ isTTY, isJsonMode, debugMode }`; methods: `startThinking()`, `startToolCall(toolName)`, `completeToolCall(toolName, summary)`, `stop()`, `isActive()`; writes to stderr; all operations no-op when non-TTY or JSON mode
|
|
271
|
+
|
|
272
|
+
**Checkpoint**: `ActivitySpinner` module exists with full test coverage; can be instantiated and used independently.
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
### 8c. Tool Call Summaries & Debug Verbose Output (FR-043b)
|
|
277
|
+
|
|
278
|
+
**Goal**: After each tool call completes, display a one-line summary. In `--debug` mode, show full arguments and result details.
|
|
279
|
+
|
|
280
|
+
**Independent Test**: Unit tests verify `writeToolSummary()` outputs correct format in default and `--debug` modes, and is suppressed in JSON/non-TTY mode.
|
|
281
|
+
|
|
282
|
+
#### Tests for 8c (REQUIRED — write first, verify they fail) ⚠️
|
|
283
|
+
|
|
284
|
+
- [X] T086 [P] [US1] Add unit tests for `writeToolSummary()` in tests/unit/cli/ioContext.spec.ts: verify default mode prints "✓ <toolName>: <summary>" to stderr, `--debug` mode additionally prints args and result, and JSON/non-TTY mode omits tool summaries from stdout
|
|
285
|
+
|
|
286
|
+
#### Implementation for 8c
|
|
287
|
+
|
|
288
|
+
- [X] T087 [US1] Add `writeToolSummary(toolName, summary, debug?)` method to `LoopIO` interface in src/loop/conversationLoop.ts and implement in `createLoopIO()` in src/cli/ioContext.ts: default prints one-line summary to stderr; `--debug` expands with formatted JSON of args and result; non-TTY/JSON omits from stdout
|
|
289
|
+
- [X] T088 [US1] Update `IoContextOptions` in src/cli/ioContext.ts to accept `debug?: boolean` option so `createLoopIO()` can control verbose tool output behavior
|
|
290
|
+
|
|
291
|
+
**Checkpoint**: Tool call completions produce visible one-line summaries; `--debug` shows full details.
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
### 8d. ConversationLoop Spinner Integration (FR-043a/b/c combined)
|
|
296
|
+
|
|
297
|
+
**Goal**: Wire `ActivitySpinner` into `ConversationLoop.streamResponse()` to manage the full spinner lifecycle across thinking → tool calls → text streaming.
|
|
298
|
+
|
|
299
|
+
**Independent Test**: Integration tests verify the full spinner lifecycle: "Thinking..." appears after user input, transitions to tool-specific spinner on ToolCall, prints summary on ToolResult, clears on TextDelta.
|
|
300
|
+
|
|
301
|
+
#### Tests for 8d (REQUIRED — write first, verify they fail) ⚠️
|
|
302
|
+
|
|
303
|
+
- [X] T089 [P] [US1] Add integration tests for spinner lifecycle in ConversationLoop in tests/integration/spinnerLifecycle.spec.ts: verify spinner starts with "Thinking..." after user input, transitions on ToolCall events, prints tool summary on ToolResult, stops on first TextDelta, and handles multi-tool sequences correctly
|
|
304
|
+
- [X] T090 [P] [US1] Add unit tests for ConversationLoop spinner injection in tests/unit/loop/conversationLoop.spec.ts: verify spinner option is accepted, no-op spinner works for non-TTY, spinner.stop() is called on response complete
|
|
305
|
+
|
|
306
|
+
#### Implementation for 8d
|
|
307
|
+
|
|
308
|
+
- [X] T091 [US1] Add `spinner?: ActivitySpinner` to `ConversationLoopOptions` in src/loop/conversationLoop.ts; update `streamResponse()` to manage spinner lifecycle: `startThinking()` before send, `startToolCall()` on ToolCall event, `completeToolCall()` + `io.writeToolSummary()` on ToolResult event, `stop()` on first TextDelta event, `stop()` on response complete
|
|
309
|
+
- [X] T092 [US1] Wire spinner creation into src/cli/workshopCommand.ts `runWorkshop()`: create `ActivitySpinner` from IO context options and pass to `ConversationLoop` constructor; pass `debug` option through to `createLoopIO()`
|
|
310
|
+
|
|
311
|
+
**Checkpoint**: Full visual feedback lifecycle works end-to-end: users see "Thinking...", tool-specific spinners, tool summaries, and formatted markdown streaming.
|
|
312
|
+
|
|
313
|
+
---
|
|
314
|
+
|
|
315
|
+
### Phase 8 Validation
|
|
316
|
+
|
|
317
|
+
- [X] T093 Run full test suite (`npx vitest run`) and manual smoke test with a live Copilot session to verify: (1) "Thinking..." spinner appears during LLM processing, (2) tool-specific spinners appear during tool calls, (3) tool summaries display after completion, (4) LLM text streams as formatted markdown, (5) `--debug` shows verbose tool output, (6) `--json` mode suppresses all spinners and ANSI
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
## Dependencies & Execution Order
|
|
322
|
+
|
|
323
|
+
### Phase Dependencies
|
|
324
|
+
|
|
325
|
+
- **Setup (Phase 1)**: No dependencies – can start immediately.
|
|
326
|
+
- **Foundational (Phase 2)**: Depends on Setup completion – BLOCKS all user stories.
|
|
327
|
+
- **User Stories (Phase 3–5)**: All depend on Foundational phase completion.
|
|
328
|
+
- User stories can then proceed in parallel (if staffed) but are ordered by priority: US1 (P1) → US2 (P2) → US3 (P3).
|
|
329
|
+
- **Polish (Phase 6)**: Depends on all desired user stories being complete.
|
|
330
|
+
- **New Capabilities (Phase 7)**: Depends on Phase 6 completion (all existing behavior stable).
|
|
331
|
+
- **7a (Session Naming)**, **7b (Default Command)**, and **7c (Auto-Start)** can proceed in parallel — they touch different files.
|
|
332
|
+
- Within each sub-phase: test tasks run first (must fail), then implementation tasks.
|
|
333
|
+
- **T079** (validation) runs last after all Phase 7 tasks complete.
|
|
334
|
+
- **Visual Feedback & Streaming Markdown (Phase 8)**: Depends on Phase 7 completion.
|
|
335
|
+
- **8a (Streaming Markdown)** and **8b (Activity Spinner)** can proceed in parallel — they touch different files.
|
|
336
|
+
- **8c (Tool Summaries)** depends on 8b (uses ActivitySpinner types).
|
|
337
|
+
- **8d (Spinner Integration)** depends on 8a, 8b, and 8c (wires everything together).
|
|
338
|
+
- **T093** (validation) runs last after all Phase 8 tasks complete.
|
|
339
|
+
|
|
340
|
+
### User Story Dependencies
|
|
341
|
+
|
|
342
|
+
- **User Story 1 (P1)**: Can start after Foundational (Phase 2); no dependencies on other stories; defines the main workshop flow and is the MVP.
|
|
343
|
+
- **User Story 2 (P2)**: Can start after Foundational (Phase 2); depends on core session model from US1 but remains independently testable.
|
|
344
|
+
- **User Story 3 (P3)**: Can start after Foundational (Phase 2); depends on session model and commands from US1 but is independently testable in direct-command contexts.
|
|
345
|
+
|
|
346
|
+
### Within Each User Story
|
|
347
|
+
|
|
348
|
+
- Tests MUST be written and FAIL before implementation.
|
|
349
|
+
- Shared entities and helpers (src/shared/, src/sessions/) should be reused, not duplicated.
|
|
350
|
+
- For each story: models/schemas → services/managers → CLI commands/endpoints → integration wiring → E2E validation.
|
|
351
|
+
|
|
352
|
+
### Parallel Opportunities
|
|
353
|
+
|
|
354
|
+
- All Setup tasks marked [P] can run in parallel.
|
|
355
|
+
- All Foundational tasks marked [P] can run in parallel once their dependencies are met.
|
|
356
|
+
- After Foundational completion, different user stories (US1, US2, US3) can be worked on by different developers in parallel.
|
|
357
|
+
- Within each story, test tasks marked [P] and helper implementations in different files can proceed in parallel.
|
|
358
|
+
|
|
359
|
+
### Phase 7 Parallel Opportunities
|
|
360
|
+
|
|
361
|
+
Within Phase 7, the three sub-phases touch different files and can be parallelized:
|
|
362
|
+
|
|
363
|
+
```bash
|
|
364
|
+
# 7a tests (all [P] — different test files):
|
|
365
|
+
T061: tests/unit/schemas/session.spec.ts
|
|
366
|
+
T062: tests/unit/phases/phaseExtractors.spec.ts
|
|
367
|
+
T063: tests/unit/phases/phaseHandlers.spec.ts
|
|
368
|
+
T064: tests/unit/cli/statusCommand.spec.ts
|
|
369
|
+
|
|
370
|
+
# 7b tests:
|
|
371
|
+
T070: tests/integration/defaultCommand.spec.ts
|
|
372
|
+
|
|
373
|
+
# 7c tests (all [P] — different test files):
|
|
374
|
+
T073: tests/unit/loop/conversationLoop.spec.ts
|
|
375
|
+
T074: tests/unit/phases/phaseHandlers.spec.ts (same file as T063 — cannot parallel with T063)
|
|
376
|
+
T075: tests/integration/autoStartConversation.spec.ts
|
|
377
|
+
|
|
378
|
+
# 7a implementation — after 7a tests fail:
|
|
379
|
+
T065: src/shared/schemas/session.ts (schema change — do first)
|
|
380
|
+
T066: src/phases/phaseExtractors.ts [P] (different file)
|
|
381
|
+
T068: src/cli/statusCommand.ts [P] (different file)
|
|
382
|
+
T069: src/cli/workshopCommand.ts (display only — SHARED with T072, T078)
|
|
383
|
+
T064b: tests/unit/cli/workshopCommand.spec.ts [P] (test for T069)
|
|
384
|
+
T067: src/phases/phaseHandlers.ts (depends on T065, T066 — SHARED with T077)
|
|
385
|
+
|
|
386
|
+
# 7b implementation — after 7b tests fail:
|
|
387
|
+
T071: src/cli/index.ts (main restructure)
|
|
388
|
+
T072: src/cli/workshopCommand.ts (depends on T071 — SHARED with T069, T078)
|
|
389
|
+
|
|
390
|
+
# 7c implementation — after 7c tests fail:
|
|
391
|
+
T076: src/loop/conversationLoop.ts (core auto-start)
|
|
392
|
+
T077: src/phases/phaseHandlers.ts (depends on T076 interface — SHARED with T067)
|
|
393
|
+
T078: src/cli/workshopCommand.ts (depends on T076, T077 — SHARED with T069, T072)
|
|
394
|
+
|
|
395
|
+
# ⚠ Cross-sub-phase file conflicts (serialize edits to these files):
|
|
396
|
+
# src/phases/phaseHandlers.ts → T067 (7a) and T077 (7c)
|
|
397
|
+
# src/cli/workshopCommand.ts → T069 (7a), T072 (7b), and T078 (7c)
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
**Recommended serial order** (single developer):
|
|
401
|
+
1. 7a tests → 7a implementation → verify tests pass
|
|
402
|
+
2. 7b tests → 7b implementation → verify tests pass
|
|
403
|
+
3. 7c tests → 7c implementation → verify tests pass
|
|
404
|
+
4. T079 full validation
|
|
405
|
+
|
|
406
|
+
### Phase 8 Parallel Opportunities
|
|
407
|
+
|
|
408
|
+
Within Phase 8, sub-phases have the following parallelization profile:
|
|
409
|
+
|
|
410
|
+
```bash
|
|
411
|
+
# 8a tests (parallel — different files):
|
|
412
|
+
T080: tests/unit/loop/conversationLoop.spec.ts
|
|
413
|
+
T081: tests/unit/shared/markdownRenderer.spec.ts
|
|
414
|
+
|
|
415
|
+
# 8b tests (parallel with 8a — different file):
|
|
416
|
+
T084: tests/unit/shared/activitySpinner.spec.ts
|
|
417
|
+
|
|
418
|
+
# 8c tests (parallel with 8a, 8b — different file):
|
|
419
|
+
T086: tests/unit/cli/ioContext.spec.ts
|
|
420
|
+
|
|
421
|
+
# 8a implementation — after 8a tests fail:
|
|
422
|
+
T082: src/loop/conversationLoop.ts (streaming markdown rendering)
|
|
423
|
+
T083: src/shared/markdownRenderer.ts [P] (incremental chunk handling)
|
|
424
|
+
|
|
425
|
+
# 8b implementation — after 8b tests fail (parallel with 8a impl):
|
|
426
|
+
T085: src/shared/activitySpinner.ts (new file — no conflicts)
|
|
427
|
+
|
|
428
|
+
# 8c implementation — after 8c tests fail:
|
|
429
|
+
T087: src/loop/conversationLoop.ts (LoopIO interface — SHARED with T082)
|
|
430
|
+
T088: src/cli/ioContext.ts [P] (IoContextOptions update)
|
|
431
|
+
|
|
432
|
+
# 8d tests — after 8a+8b+8c implementation:
|
|
433
|
+
T089: tests/integration/spinnerLifecycle.spec.ts [P]
|
|
434
|
+
T090: tests/unit/loop/conversationLoop.spec.ts
|
|
435
|
+
|
|
436
|
+
# 8d implementation — after 8d tests fail:
|
|
437
|
+
T091: src/loop/conversationLoop.ts (spinner integration — SHARED with T082, T087)
|
|
438
|
+
T092: src/cli/workshopCommand.ts (spinner wiring)
|
|
439
|
+
|
|
440
|
+
# ⚠ Cross-sub-phase file conflicts (serialize edits):
|
|
441
|
+
# src/loop/conversationLoop.ts → T082 (8a), T087 (8c), T091 (8d)
|
|
442
|
+
# src/cli/ioContext.ts → T088 (8c)
|
|
443
|
+
# src/cli/workshopCommand.ts → T092 (8d)
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
**Recommended serial order** (single developer):
|
|
447
|
+
1. 8a tests + 8b tests (parallel) → 8a implementation + 8b implementation (parallel) → verify
|
|
448
|
+
2. 8c tests → 8c implementation → verify
|
|
449
|
+
3. 8d tests → 8d implementation → verify
|
|
450
|
+
4. T093 full validation
|
|
451
|
+
|
|
452
|
+
---
|
|
453
|
+
|
|
454
|
+
## Implementation Strategy
|
|
455
|
+
|
|
456
|
+
### MVP First (User Story 1 Only)
|
|
457
|
+
|
|
458
|
+
1. Complete Phase 1: Setup.
|
|
459
|
+
2. Complete Phase 2: Foundational (CRITICAL – blocks all stories).
|
|
460
|
+
3. Complete Phase 3: User Story 1 (New Session, phases Discover→Plan, PoC intent capture, status output).
|
|
461
|
+
4. STOP and VALIDATE via integration and PTY E2E tests.
|
|
462
|
+
5. Demo the end-to-end workshop flow using the quickstart commands.
|
|
463
|
+
|
|
464
|
+
### Incremental Delivery
|
|
465
|
+
|
|
466
|
+
1. Deliver MVP (User Story 1).
|
|
467
|
+
2. Add User Story 2 (resume, backtrack, export) and validate independently.
|
|
468
|
+
3. Add User Story 3 (direct command/automation) and validate independently.
|
|
469
|
+
4. Apply Phase 6 polish and cross-cutting improvements.
|
|
470
|
+
5. Add Phase 7 new capabilities (session naming → default command → auto-start) and validate with full regression suite.
|
|
471
|
+
6. Add Phase 8 visual feedback and streaming markdown (activity spinners → tool summaries → streaming markdown → spinner integration) and validate with live session smoke test.
|
|
472
|
+
|
|
473
|
+
### Relation to Feature 002 (PoC Generation & Ralph Loop)
|
|
474
|
+
|
|
475
|
+
- This feature ensures that session JSON and exports contain all necessary PoC intent and plan information.
|
|
476
|
+
- Feature 002 will consume these artifacts to generate and iteratively refine a PoC repository using GitHub MCP and/or local scaffolding.
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# Contract: PoC Output
|
|
2
|
+
|
|
3
|
+
Defines the structure and content of the generated proof-of-concept repository.
|
|
4
|
+
|
|
5
|
+
## Directory layout
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
<outputDir>/ # Default: ./poc/<sessionId>/
|
|
9
|
+
├── .gitignore # Generated: node_modules/, dist/, coverage/
|
|
10
|
+
├── README.md # Generated: what the PoC does, how to run it
|
|
11
|
+
├── package.json # Generated: name, scripts (test, start, build)
|
|
12
|
+
├── tsconfig.json # Generated: strict TS configuration
|
|
13
|
+
├── src/
|
|
14
|
+
│ ├── index.ts # Main entry point
|
|
15
|
+
│ └── ... # Feature modules (varies per idea)
|
|
16
|
+
├── tests/
|
|
17
|
+
│ └── *.test.ts # Vitest test files
|
|
18
|
+
└── .sofia-metadata.json # Session linkage & generation metadata
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Required files
|
|
22
|
+
|
|
23
|
+
### .gitignore
|
|
24
|
+
|
|
25
|
+
```gitignore
|
|
26
|
+
node_modules/
|
|
27
|
+
dist/
|
|
28
|
+
coverage/
|
|
29
|
+
*.tsbuildinfo
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Always generated to prevent accidental commits of build artifacts, especially when pushing to GitHub via MCP.
|
|
33
|
+
|
|
34
|
+
### README.md
|
|
35
|
+
|
|
36
|
+
Must contain:
|
|
37
|
+
- **Title**: PoC name (from the selected idea title)
|
|
38
|
+
- **Description**: What AI capability it demonstrates
|
|
39
|
+
- **Prerequisites**: Runtime, environment variables, dependencies
|
|
40
|
+
- **Quick start**: Steps to install and run
|
|
41
|
+
- **How it works**: Brief architecture / flow description
|
|
42
|
+
- **Generated by**: sofIA attribution with session ID and timestamp
|
|
43
|
+
|
|
44
|
+
### package.json
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"name": "<kebab-case-title>",
|
|
49
|
+
"version": "0.1.0",
|
|
50
|
+
"private": true,
|
|
51
|
+
"type": "module",
|
|
52
|
+
"scripts": {
|
|
53
|
+
"build": "tsc",
|
|
54
|
+
"start": "node dist/index.js",
|
|
55
|
+
"test": "vitest run"
|
|
56
|
+
},
|
|
57
|
+
"dependencies": { },
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"typescript": "^5.0.0",
|
|
60
|
+
"vitest": "^3.0.0"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Dependencies vary per PoC; `typescript` and `vitest` are always present.
|
|
66
|
+
|
|
67
|
+
### tsconfig.json
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"compilerOptions": {
|
|
72
|
+
"target": "ES2022",
|
|
73
|
+
"module": "Node16",
|
|
74
|
+
"moduleResolution": "Node16",
|
|
75
|
+
"strict": true,
|
|
76
|
+
"outDir": "dist",
|
|
77
|
+
"rootDir": "src",
|
|
78
|
+
"declaration": true,
|
|
79
|
+
"esModuleInterop": true,
|
|
80
|
+
"skipLibCheck": true
|
|
81
|
+
},
|
|
82
|
+
"include": ["src"]
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### .sofia-metadata.json
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"sessionId": "<uuid>",
|
|
91
|
+
"featureSpec": "002-poc-generation",
|
|
92
|
+
"generatedAt": "<ISO-8601>",
|
|
93
|
+
"ideaTitle": "<selected idea title>",
|
|
94
|
+
"totalIterations": 3,
|
|
95
|
+
"finalStatus": "success",
|
|
96
|
+
"terminationReason": "tests-passing",
|
|
97
|
+
"techStack": {
|
|
98
|
+
"language": "typescript",
|
|
99
|
+
"runtime": "node",
|
|
100
|
+
"testRunner": "vitest"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Tests
|
|
106
|
+
|
|
107
|
+
- At least one test file in `tests/`
|
|
108
|
+
- Tests must exercise the core functionality described in the idea
|
|
109
|
+
- Tests must be runnable with `npm test` (mapped to `vitest run`)
|
|
110
|
+
- Test file naming: `<module>.test.ts`
|
|
111
|
+
|
|
112
|
+
## Scaffold templates
|
|
113
|
+
|
|
114
|
+
The scaffolder produces the initial file set before the first Ralph loop iteration. Templates are programmatic (TypeScript functions returning file content), not file-based.
|
|
115
|
+
|
|
116
|
+
> **v1 Scope**: The initial implementation targets **TypeScript + Vitest** PoCs only
|
|
117
|
+
> (template id: `node-ts-vitest`). Support for additional languages/frameworks
|
|
118
|
+
> (e.g., Python/FastAPI) is deferred to a future feature. The `ScaffoldTemplate`
|
|
119
|
+
> abstraction is designed to accommodate additional templates without refactoring.
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
interface ScaffoldTemplate {
|
|
123
|
+
id: string; // e.g., "node-ts-vitest"
|
|
124
|
+
description: string;
|
|
125
|
+
files: TemplateFile[];
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
interface TemplateFile {
|
|
129
|
+
path: string; // Relative to outputDir
|
|
130
|
+
content: string | ((ctx: ScaffoldContext) => string);
|
|
131
|
+
skipIfExists?: boolean; // Default: true
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
interface ScaffoldContext {
|
|
135
|
+
projectName: string; // kebab-case from idea title
|
|
136
|
+
ideaTitle: string;
|
|
137
|
+
ideaDescription: string;
|
|
138
|
+
techStack: TechStack;
|
|
139
|
+
planSummary: string; // From Plan phase output
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Output validation
|
|
144
|
+
|
|
145
|
+
After the Ralph loop completes, the following checks are applied before declaring success:
|
|
146
|
+
|
|
147
|
+
| Check | Required | Description |
|
|
148
|
+
|-------|----------|-------------|
|
|
149
|
+
| `package.json` exists | Yes | Valid JSON with `test` script |
|
|
150
|
+
| `README.md` exists | Yes | Non-empty |
|
|
151
|
+
| `tsconfig.json` exists | Yes | Valid JSON |
|
|
152
|
+
| At least 1 `.ts` file in `src/` | Yes | Main implementation |
|
|
153
|
+
| At least 1 `.test.ts` file in `tests/` | Yes | Tests for the PoC |
|
|
154
|
+
| `.sofia-metadata.json` exists | Yes | Links back to session |
|
|
155
|
+
| `.gitignore` exists | Yes | Excludes `node_modules/`, `dist/`, `coverage/` |
|
|
156
|
+
| `npm test` exits 0 | Only for `success` status | Tests pass |
|
|
157
|
+
|
|
158
|
+
## GitHub MCP integration (optional)
|
|
159
|
+
|
|
160
|
+
When GitHub MCP is available and the user opts in:
|
|
161
|
+
|
|
162
|
+
1. Create repository via `create_repository` tool
|
|
163
|
+
2. Initial commit with scaffold contents
|
|
164
|
+
3. Push code after each successful iteration
|
|
165
|
+
4. Final push with all files on completion
|
|
166
|
+
5. Store `repoUrl` in session state
|
|
167
|
+
|
|
168
|
+
When GitHub MCP is unavailable:
|
|
169
|
+
|
|
170
|
+
- All output stays in `<outputDir>/`
|
|
171
|
+
- `repoSource` is set to `"local"`
|
|
172
|
+
- User gets a message with the output path
|