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,81 @@
|
|
|
1
|
+
# Feature Specification: sofIA PoC Generation & Ralph Loop
|
|
2
|
+
|
|
3
|
+
**Feature ID**: 002-poc-generation
|
|
4
|
+
**Created**: 2026-02-26
|
|
5
|
+
**Upstream Dependency**: specs/001-cli-workshop-rebuild/spec.md (session model, Plan outputs)
|
|
6
|
+
**Status**: Draft
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
This feature defines the **Develop** phase implementation for sofIA: generating a proof-of-concept (PoC) repository from an existing workshop session and iteratively refining it via a Ralph-like loop.
|
|
11
|
+
|
|
12
|
+
Feature 001 (CLI workshop rebuild) is responsible for Discover Ideate Design Select Plan and for capturing PoC intent/requirements into the session JSON. Feature 002 consumes that session state, creates or updates a PoC repository, and feeds back status/results.
|
|
13
|
+
|
|
14
|
+
## User Scenarios & Testing (mandatory)
|
|
15
|
+
|
|
16
|
+
### User Story 1 Generate a PoC repository from a completed plan (Priority: P1)
|
|
17
|
+
|
|
18
|
+
As a facilitator, I want to run the **Develop** phase for a completed workshop session so that sofIA generates a PoC repository aligned with the selected idea and implementation plan.
|
|
19
|
+
|
|
20
|
+
**Independent Test**: From a fixture session JSON produced by feature 001, run the Develop command and verify that a PoC repo is created (locally or via GitHub MCP), with README, basic docs, and smoke tests wired to the captured plan.
|
|
21
|
+
|
|
22
|
+
### User Story 2 Iterate via Ralph loop (Priority: P1)
|
|
23
|
+
|
|
24
|
+
As a facilitator, I want to iteratively refine the PoC by running tests and applying improvements suggested by sofIA, so that the PoC converges toward the intended behavior without manual code authoring.
|
|
25
|
+
|
|
26
|
+
**Independent Test**: Starting from an initial generated repo, simulate failing tests and verify that successive Develop iterations apply targeted changes until tests pass or a clear "cannot fix" outcome is produced.
|
|
27
|
+
|
|
28
|
+
### User Story 3 Handle MCP and permissions constraints (Priority: P2)
|
|
29
|
+
|
|
30
|
+
As an operator, I want Develop to gracefully handle environments where GitHub MCP cannot create or modify repositories, so that I still get a usable local PoC scaffold.
|
|
31
|
+
|
|
32
|
+
**Independent Test**: Disable/misconfigure GitHub MCP for the test environment, run Develop, and verify that the system falls back to a local repo structure without crashing or corrupting the parent session.
|
|
33
|
+
|
|
34
|
+
## Functional Requirements (Develop phase)
|
|
35
|
+
|
|
36
|
+
> Numbering in this feature is local (D-XXX) to avoid colliding with FR-0XX in feature 001. Feature 001 FR-036..038 now delegate detailed PoC behavior to this feature.
|
|
37
|
+
|
|
38
|
+
### D-001 Session consumption
|
|
39
|
+
|
|
40
|
+
- MUST accept a `WorkshopSession` produced by feature 001 (from .sofia/sessions/<sessionId>.json) with populated `selection`, `plan`, and PoC intent fields.
|
|
41
|
+
- MUST validate that required fields for PoC generation are present; otherwise fail fast with a clear error and guidance to re-run Plan.
|
|
42
|
+
|
|
43
|
+
### D-002 PoC repository creation (GitHub MCP)
|
|
44
|
+
|
|
45
|
+
- When GitHub MCP is available and authorized, MUST be able to create or update a PoC repository associated with the session.
|
|
46
|
+
- MUST at minimum generate:
|
|
47
|
+
- `README` describing the selected idea and scope
|
|
48
|
+
- basic run instructions
|
|
49
|
+
- a minimal test or smoke-test harness
|
|
50
|
+
- MUST record the repository location (URL or local path) back into the session's `poc` state or a closely related artifact.
|
|
51
|
+
|
|
52
|
+
### D-003 Local scaffolding fallback
|
|
53
|
+
|
|
54
|
+
- When GitHub MCP is unavailable or lacks permissions, MUST fall back to generating a **local** PoC scaffold outside the workspace (e.g., `./poc/<sessionId>/`).
|
|
55
|
+
- MUST clearly mark in logs and artifacts that the PoC was generated locally rather than via GitHub MCP.
|
|
56
|
+
|
|
57
|
+
### D-004 Ralph loop iterations
|
|
58
|
+
|
|
59
|
+
- MUST support multiple iterations of Develop for a given session/repo.
|
|
60
|
+
- MUST run tests (or other checks) between iterations and incorporate failures into the next iteration's prompts.
|
|
61
|
+
- MUST stop the loop when:
|
|
62
|
+
- tests are passing to the configured threshold, or
|
|
63
|
+
- a maximum number of iterations is reached, or
|
|
64
|
+
- the user explicitly stops the loop.
|
|
65
|
+
|
|
66
|
+
### D-005 Safety & auditability
|
|
67
|
+
|
|
68
|
+
- MUST log high-level actions (files created/modified, tests run, iteration outcomes) without logging secrets or full code diffs.
|
|
69
|
+
- MUST preserve an audit trail sufficient to explain why particular changes were made in each iteration, referencing session intent where possible.
|
|
70
|
+
|
|
71
|
+
## Success Criteria (initial)
|
|
72
|
+
|
|
73
|
+
- **SC-002-001**: From a valid session created by feature 001, at least one happy-path run of Develop generates a working PoC repo with README and a passing smoke test in a properly configured environment.
|
|
74
|
+
- **SC-002-002**: When GitHub MCP is misconfigured or unavailable, Develop still completes successfully by producing a local PoC scaffold and a clear explanation of the fallback in the logs and export artifacts.
|
|
75
|
+
- **SC-002-003**: The Ralph loop demonstrates at least one successful iteration where a failing test guides a subsequent change that results in a passing test.
|
|
76
|
+
|
|
77
|
+
## Open Items
|
|
78
|
+
|
|
79
|
+
- Finalize the PoC repo technology templates (e.g., Node/TypeScript web API, minimal Azure integration samples) and how they map from the plan's architecture notes.
|
|
80
|
+
- Define the exact shape of `PocDevelopmentState` fields that this feature will read and write, in coordination with the 001 data model.
|
|
81
|
+
- Confirm which parts of the Ralph loop run locally vs via GitHub MCP tools, and how to surface errors back to the main CLI UX.
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
# Tasks: Fix Review Findings for Feature 002 (PoC Generation & Ralph Loop)
|
|
2
|
+
|
|
3
|
+
**Input**: Review of current implementation against `specs/002-poc-generation/spec.md`, `contracts/ralph-loop.md`, `contracts/poc-output.md`
|
|
4
|
+
**Prerequisites**: All original tasks (T001–T050) in `tasks.md` are marked complete. These fix tasks address deviations, stubs, and bugs found during cross-referencing.
|
|
5
|
+
|
|
6
|
+
**Tests**: Tests are REQUIRED (Red → Green → Review). Write a failing test first for each behavioral fix.
|
|
7
|
+
|
|
8
|
+
**Organization**: Tasks are grouped by functional area. Each fix is independently implementable and testable.
|
|
9
|
+
|
|
10
|
+
## Format: `[ID] [P?] [Fix] Description`
|
|
11
|
+
|
|
12
|
+
- **[P]**: Can run in parallel (different files, no dependencies)
|
|
13
|
+
- **[Fix]**: Which review finding this task addresses (F1–F10)
|
|
14
|
+
- Include exact file paths in descriptions
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Phase 1: Critical — Ralph Loop Effectiveness (Finding 3)
|
|
19
|
+
|
|
20
|
+
**Purpose**: The LLM currently receives only a file tree listing, not actual file contents. Without code visibility, the Ralph loop cannot effectively fix failing tests. This is the single most impactful fix.
|
|
21
|
+
|
|
22
|
+
### Tests
|
|
23
|
+
|
|
24
|
+
- [x] F001 [P] [F3] Add unit test in `tests/unit/develop/codeGenerator.spec.ts` verifying `buildIterationPrompt` includes file contents (not just names) when `fileContents` option is provided
|
|
25
|
+
- [x] F002 [P] [F3] Add unit test in `tests/unit/develop/ralphLoop.spec.ts` verifying the Ralph loop reads file contents from disk and passes them to `buildIterationPrompt`
|
|
26
|
+
|
|
27
|
+
### Implementation
|
|
28
|
+
|
|
29
|
+
- [x] F003 [F3] Extend `IterationPromptOptions` in `src/develop/codeGenerator.ts` with `fileContents?: Array<{ path: string; content: string }>` and render a `## Current Code` section with fenced code blocks for each file
|
|
30
|
+
- [x] F004 [F3] Update `RalphLoop` in `src/develop/ralphLoop.ts` to read file contents from the PoC directory before building the iteration prompt, passing them as `fileContents` to `buildIterationPrompt`
|
|
31
|
+
- [x] F005 [F3] Add a size guard: if total file content exceeds 50KB, include only files referenced in test failures plus `src/index.ts` and `package.json`; log a warning when content is truncated
|
|
32
|
+
|
|
33
|
+
**Checkpoint**: Ralph loop now sends actual source code to the LLM. Verify by running an existing integration test and inspecting the `llmPromptContext` summary.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Phase 2: Critical — Final Test Run After Last Iteration (Finding 4)
|
|
38
|
+
|
|
39
|
+
**Purpose**: When max iterations are reached, the loop applies the last code fix but never runs tests again, potentially misreporting `failed` when tests actually pass.
|
|
40
|
+
|
|
41
|
+
### Tests
|
|
42
|
+
|
|
43
|
+
- [x] F006 [P] [F4] Add unit test in `tests/unit/develop/ralphLoop.spec.ts` verifying that after the last LLM iteration at `maxIterations`, a final test run occurs and `finalStatus` reflects the actual result
|
|
44
|
+
- [x] F007 [P] [F4] Add integration test in `tests/integration/ralphLoopFlow.spec.ts` verifying that when the last iteration's code fix resolves all failures, `finalStatus` is `'success'` (not `'partial'` or `'failed'`)
|
|
45
|
+
|
|
46
|
+
### Implementation
|
|
47
|
+
|
|
48
|
+
- [x] F008 [F4] Add a final test run after the last LLM code application in `src/develop/ralphLoop.ts`: after the loop exits at `maxIterations`, run tests one more time, update the last iteration's outcome and `testResults`, and use those results for `finalStatus` determination
|
|
49
|
+
|
|
50
|
+
**Checkpoint**: `finalStatus` now accurately reflects the state of tests after the final code changes. Verify with `npx vitest run tests/unit/develop/ralphLoop.spec.ts`.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Phase 3: SIGINT Handler Stale Session (Finding 5)
|
|
55
|
+
|
|
56
|
+
**Purpose**: The Ctrl+C handler captures the initial session object, so pressing Ctrl+C mid-loop persists stale data with no iteration history.
|
|
57
|
+
|
|
58
|
+
### Tests
|
|
59
|
+
|
|
60
|
+
- [x] F009 [P] [F5] Add unit test in `tests/unit/develop/ralphLoop.spec.ts` verifying that after at least one iteration completes, triggering SIGINT persists a session containing the completed iteration(s)
|
|
61
|
+
|
|
62
|
+
### Implementation
|
|
63
|
+
|
|
64
|
+
- [x] F010 [F5] Refactor `setupSigintHandler` in `src/develop/ralphLoop.ts` to close over a mutable reference (e.g., `{ current: session }` wrapper object or a class field `this.currentSession`) so the handler always persists the latest session state
|
|
65
|
+
|
|
66
|
+
**Checkpoint**: Verify by simulating SIGINT after one iteration in the unit test and asserting the persisted session has `poc.iterations.length >= 1`.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Phase 4: User-Stopped Status (Finding 6)
|
|
71
|
+
|
|
72
|
+
**Purpose**: `user-stopped` hardcodes `finalStatus: 'failed'`. Spec says session should be preserved as-is — status should reflect actual test state.
|
|
73
|
+
|
|
74
|
+
### Tests
|
|
75
|
+
|
|
76
|
+
- [x] F011 [P] [F6] Add unit test in `tests/unit/develop/ralphLoop.spec.ts` verifying `finalStatus` is `'partial'` when user stops mid-loop and some tests were passing
|
|
77
|
+
|
|
78
|
+
### Implementation
|
|
79
|
+
|
|
80
|
+
- [x] F012 [F6] Update the user-stopped branch in `src/develop/ralphLoop.ts` to compute `finalStatus` based on the latest test results: `'partial'` if any tests were passing, `'failed'` if none were
|
|
81
|
+
|
|
82
|
+
**Checkpoint**: Verify with `npx vitest run tests/unit/develop/ralphLoop.spec.ts`.
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Phase 5: GitHub MCP Adapter — Real Tool Calls (Findings 1 & 2)
|
|
87
|
+
|
|
88
|
+
**Purpose**: `createRepository` and `pushFiles` are no-op stubs returning fake data. D-002 requires real MCP tool calls when GitHub MCP is available.
|
|
89
|
+
|
|
90
|
+
### Tests
|
|
91
|
+
|
|
92
|
+
- [x] F013 [P] [F1] Add unit test in `tests/unit/develop/githubMcpAdapter.spec.ts` verifying `createRepository` calls `mcpManager.callTool('github', 'create_repository', ...)` and returns the URL from the tool response
|
|
93
|
+
- [x] F014 [P] [F1] Add unit test in `tests/unit/develop/githubMcpAdapter.spec.ts` verifying `pushFiles` calls `mcpManager.callTool('github', 'push_files', ...)` with file paths and contents, and returns the commit SHA from the response
|
|
94
|
+
- [x] F015 [P] [F2] Add unit test verifying that when the MCP tool call fails, `createRepository` returns `{ available: false }` with the error message (not a fake URL)
|
|
95
|
+
|
|
96
|
+
### Implementation
|
|
97
|
+
|
|
98
|
+
- [x] F016 [F1] Implement real MCP tool calls in `GitHubMcpAdapter.createRepository()` in `src/develop/githubMcpAdapter.ts`: call `mcpManager.callTool('github', 'create_repository', { name, description, private: true })`, parse the response for `html_url`, return it
|
|
99
|
+
- [x] F017 [F1] Implement real MCP tool calls in `GitHubMcpAdapter.pushFiles()` in `src/develop/githubMcpAdapter.ts`: call `mcpManager.callTool('github', 'push_files', { repoUrl, files, message })`, return the commit SHA from the response
|
|
100
|
+
- [x] F018 [F2] Remove hardcoded `poc-owner` URL; derive repo owner from the MCP response or user configuration
|
|
101
|
+
|
|
102
|
+
**Checkpoint**: With a mocked McpManager, verify `createRepository` and `pushFiles` invoke the correct MCP tool names with expected arguments.
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Phase 6: MCP Context Enricher — Real Tool Calls (Finding 2/6)
|
|
107
|
+
|
|
108
|
+
**Purpose**: All three MCP query methods return simulated data instead of calling actual MCP tools.
|
|
109
|
+
|
|
110
|
+
### Tests
|
|
111
|
+
|
|
112
|
+
- [x] F019 [P] [F6] Update unit tests in `tests/unit/develop/mcpContextEnricher.spec.ts` to verify `queryContext7` calls `mcpManager.callTool('context7', ...)` with the dependency name
|
|
113
|
+
- [x] F020 [P] [F6] Update unit tests in `tests/unit/develop/mcpContextEnricher.spec.ts` to verify `queryAzureMcp` calls `mcpManager.callTool('azure', ...)` with the architecture keywords
|
|
114
|
+
- [x] F021 [P] [F6] Update unit tests in `tests/unit/develop/mcpContextEnricher.spec.ts` to verify `queryWebSearch` calls the web search tool with failing test context
|
|
115
|
+
|
|
116
|
+
### Implementation
|
|
117
|
+
|
|
118
|
+
- [x] F022 [F6] Implement real MCP calls in `McpContextEnricher.queryContext7()` in `src/develop/mcpContextEnricher.ts`: call `mcpManager.callTool('context7', 'resolve-library-id', { libraryName })` then `query-docs` with the resolved ID; return the documentation text
|
|
119
|
+
- [x] F023 [F6] Implement real MCP calls in `McpContextEnricher.queryAzureMcp()` in `src/develop/mcpContextEnricher.ts`: call `mcpManager.callTool('azure', 'documentation', { query })` with architecture keywords; return relevant guidance
|
|
120
|
+
- [x] F024 [F6] Implement real calls in `McpContextEnricher.queryWebSearch()` in `src/develop/mcpContextEnricher.ts`: use the Copilot SDK web search capability or `mcpManager.callTool` to search for the stuck error messages; return search result summaries
|
|
121
|
+
|
|
122
|
+
**Checkpoint**: With mocked McpManager, verify each method produces structured context from tool responses. Graceful degradation tests should still pass.
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Phase 7: --force Option & Output Validation (Findings 7 & 8)
|
|
127
|
+
|
|
128
|
+
**Purpose**: `--force` is declared but not implemented. `validatePocOutput` exists but is never called.
|
|
129
|
+
|
|
130
|
+
### Tests
|
|
131
|
+
|
|
132
|
+
- [x] F025 [P] [F7] Add unit test in `tests/unit/cli/developCommand.spec.ts` verifying that when `outputDir` already exists and `--force` is not set, the command resumes from the last iteration (skip scaffold)
|
|
133
|
+
- [x] F026 [P] [F7] Add unit test in `tests/unit/cli/developCommand.spec.ts` verifying that when `outputDir` already exists and `--force` is set, the directory is cleared and scaffold runs fresh
|
|
134
|
+
- [x] F027 [P] [F8] Add unit test in `tests/unit/develop/ralphLoop.spec.ts` verifying `validatePocOutput` is called before the loop returns `finalStatus: 'success'`, and a missing required file downgrades status to `'partial'`
|
|
135
|
+
|
|
136
|
+
### Implementation
|
|
137
|
+
|
|
138
|
+
- [x] F028 [F7] Implement `--force` handling in `src/cli/developCommand.ts`: check if `outputDir` exists; if so and `--force` is set, remove and recreate it; if not set, detect existing `.sofia-metadata.json` and resume from last iteration count
|
|
139
|
+
- [x] F029 [F8] Call `validatePocOutput(outputDir)` in `src/develop/ralphLoop.ts` after loop completion and before returning; if validation fails and `finalStatus` was `'success'`, downgrade to `'partial'` with a warning
|
|
140
|
+
|
|
141
|
+
**Checkpoint**: `--force` clears output, validation catches missing files. Verify with `npx vitest run tests/unit/cli/developCommand.spec.ts tests/unit/develop/ralphLoop.spec.ts`.
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Phase 8: Polish (Findings 9 & 10)
|
|
146
|
+
|
|
147
|
+
**Purpose**: Minor improvements — PoC highlights in export summary, schema cleanup.
|
|
148
|
+
|
|
149
|
+
- [x] F030 [P] [F9] Add PoC status highlights in `src/sessions/exportWriter.ts`: include `finalStatus`, iteration count, and termination reason in `summary.json` highlights when session has `poc` data
|
|
150
|
+
- [x] F031 [P] [F10] Simplify `filesChanged` schema in `src/shared/schemas/session.ts`: replace `.optional().default([])` with `.default([])` (`.optional()` is redundant when `.default()` is present)
|
|
151
|
+
- [x] F032 Run full test suite (`npx vitest run`) and lint/typecheck (`npm run lint && npm run typecheck`) to confirm no regressions
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Dependencies & Execution Order
|
|
156
|
+
|
|
157
|
+
### Phase Dependencies
|
|
158
|
+
|
|
159
|
+
- **Phase 1** (Finding 3 — file contents in prompt): No dependencies — can start immediately. Highest impact.
|
|
160
|
+
- **Phase 2** (Finding 4 — final test run): No dependencies — can start immediately.
|
|
161
|
+
- **Phase 3** (Finding 5 — SIGINT stale session): No dependencies — can start immediately.
|
|
162
|
+
- **Phase 4** (Finding 6 — user-stopped status): Depends on Phase 3 (same SIGINT code area).
|
|
163
|
+
- **Phase 5** (Findings 1&2 — GitHub MCP): No dependencies — can start immediately. Requires understanding of McpManager tool call API.
|
|
164
|
+
- **Phase 6** (Finding 6 — MCP enricher): No dependencies — can start immediately. Requires understanding of McpManager tool call API.
|
|
165
|
+
- **Phase 7** (Findings 7&8 — --force & validation): No dependencies — can start immediately.
|
|
166
|
+
- **Phase 8** (Findings 9&10 — polish): Depends on all other phases (runs final validation).
|
|
167
|
+
|
|
168
|
+
### Parallel Opportunities
|
|
169
|
+
|
|
170
|
+
- Phases 1, 2, 3, 5, 6, 7 are fully independent and can be worked in parallel.
|
|
171
|
+
- Phase 4 should follow Phase 3 (same code area).
|
|
172
|
+
- Phase 8 should be last (final regression check).
|
|
173
|
+
|
|
174
|
+
Within each phase, all tasks marked `[P]` (tests) can run in parallel.
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Implementation Strategy
|
|
179
|
+
|
|
180
|
+
### MVP First
|
|
181
|
+
|
|
182
|
+
1. **Phase 1** (Finding 3): File contents in prompt — makes the Ralph loop actually work
|
|
183
|
+
2. **Phase 2** (Finding 4): Final test run — correct status reporting
|
|
184
|
+
3. **Phase 3 + 4** (Findings 5 & 6): SIGINT + user-stopped — data safety
|
|
185
|
+
4. **Phase 8**: Run full test suite
|
|
186
|
+
|
|
187
|
+
### Full Fix
|
|
188
|
+
|
|
189
|
+
After MVP, add Phases 5–7 (MCP wiring, --force, validation) and re-run Phase 8.
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## Notes
|
|
194
|
+
|
|
195
|
+
- All findings reference the original spec: `specs/002-poc-generation/spec.md`
|
|
196
|
+
- Contract references: `specs/002-poc-generation/contracts/ralph-loop.md`, `specs/002-poc-generation/contracts/poc-output.md`
|
|
197
|
+
- Finding numbers (F1–F10) map to the review report above
|
|
198
|
+
- MCP wiring tasks (Phases 5 & 6) depend on `McpManager.callTool()` API shape — verify available methods before implementation
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
# Tasks: sofIA PoC Generation & Ralph Loop (Feature 002)
|
|
2
|
+
|
|
3
|
+
**Input**: Design documents from `/specs/002-poc-generation/`
|
|
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 implements the Develop phase: scaffold → Ralph loop → PoC output. It consumes session state produced by Feature 001.
|
|
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**: Create the `src/develop/` module directory, develop prompt, test fixture session, and any new dependencies.
|
|
21
|
+
|
|
22
|
+
- [x] T001 Create `src/develop/` directory structure with placeholder barrel file `src/develop/index.ts`
|
|
23
|
+
- [x] T002 [P] Create Develop phase system prompt in `src/prompts/develop.md` (code-generation instructions, fenced-code-block output format, iteration context template, conditional MCP tool-use instructions: use Context7 for up-to-date library docs when generating code with external dependencies, use web.search when stuck on implementation patterns, use Microsoft Docs/Azure MCP when plan references Azure services)
|
|
24
|
+
- [x] T003 [P] Create a fixture session JSON file in `tests/fixtures/completedSession.json` with populated `selection`, `plan`, and `businessContext` fields for use by all Develop tests
|
|
25
|
+
- [x] T004 [P] Add any new devDependencies needed for test runner child_process spawning (none expected — verify `child_process` and `fs/promises` available without extra packages)
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Phase 2: Foundational (Blocking Prerequisites)
|
|
30
|
+
|
|
31
|
+
**Purpose**: Extend schemas and shared infrastructure required by ALL user stories in this feature.
|
|
32
|
+
|
|
33
|
+
**⚠️ CRITICAL**: No user story work can begin until this phase is complete.
|
|
34
|
+
|
|
35
|
+
- [x] T005 Extend `pocIterationSchema` in `src/shared/schemas/session.ts` with new fields: `outcome` (enum: tests-passing | tests-failing | error | scaffold), `filesChanged` (string[]), `testResults` (optional TestResults), `errorMessage` (optional string), `llmPromptContext` (optional string); mark old `testsRun` field as deprecated (keep as `.optional()` for backward compatibility with existing session files)
|
|
36
|
+
- [x] T006 Extend `pocDevelopmentStateSchema` in `src/shared/schemas/session.ts` with new fields: `repoUrl` (optional string), `repoSource` (enum: local | github-mcp), `techStack` (optional TechStack), `terminationReason` (optional enum: tests-passing | max-iterations | user-stopped | error), `totalDurationMs` (optional number), `finalTestResults` (optional TestResults); extend `finalStatus` enum with `"partial"`
|
|
37
|
+
- [x] T007 [P] Add new Zod schemas for `TechStack`, `TestResults`, `TestFailure` in `src/shared/schemas/session.ts` per data-model.md entities
|
|
38
|
+
- [x] T008 [P] Add unit tests for the new/extended schemas (validation rules, enum constraints, total===passed+failed+skipped) in `tests/unit/schemas/pocSchemas.spec.ts`
|
|
39
|
+
- [x] T009 Update `generateDevelopMarkdown()` in `src/sessions/exportWriter.ts` to render: repo location (path or URL), repoSource, techStack summary, iteration timeline with outcomes, final test results, termination reason
|
|
40
|
+
- [x] T010 [P] Add unit tests for enriched `generateDevelopMarkdown()` in `tests/unit/sessions/exportWriter.spec.ts`
|
|
41
|
+
|
|
42
|
+
**Checkpoint**: Schemas extended, export writer enriched — user story implementation can now begin.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Phase 3: User Story 1 — Generate a PoC repository from a completed plan (Priority: P1) 🎯 MVP
|
|
47
|
+
|
|
48
|
+
**Goal**: Allow a facilitator to run the Develop phase for a completed workshop session so that sofIA generates a local PoC repository with README, package.json, tsconfig.json, .gitignore, initial tests, and .sofia-metadata.json.
|
|
49
|
+
|
|
50
|
+
**Independent Test**: From a fixture session JSON produced by Feature 001, run the `sofia dev` command and verify that a PoC repo is created at `./poc/<sessionId>/` with all required files per the poc-output contract.
|
|
51
|
+
|
|
52
|
+
### Tests for User Story 1 (REQUIRED) ⚠️
|
|
53
|
+
|
|
54
|
+
- [x] T011 [P] [US1] Add unit tests for `PocScaffolder` in `tests/unit/develop/pocScaffolder.spec.ts`: verify scaffold creates all required files (.gitignore, README.md, package.json, tsconfig.json, src/index.ts, tests/\*.test.ts, .sofia-metadata.json); verify skip-if-exists behavior; verify ScaffoldContext population from session
|
|
55
|
+
- [x] T012 [P] [US1] Add unit tests for `TestRunner` in `tests/unit/develop/testRunner.spec.ts`: verify spawns `npm test` with `--reporter=json`, parses JSON output into `TestResults` schema, handles timeout (60s), handles non-zero exit code, truncates `rawOutput` to 2000 chars
|
|
56
|
+
- [x] T013 [P] [US1] Add unit tests for `CodeGenerator` in `tests/unit/develop/codeGenerator.spec.ts`: verify parses fenced code blocks with `file=path` from LLM response, writes files to outputDir, handles empty response gracefully, builds iteration prompt with test failures context
|
|
57
|
+
- [x] T014 [P] [US1] Add unit tests for `developCommand` in `tests/unit/cli/developCommand.spec.ts`: verify session validation (rejects sessions without selection/plan), verify `--session`, `--max-iterations`, `--output` option parsing, verify error messages for invalid sessions
|
|
58
|
+
- [x] T015 [P] [US1] Add integration test for scaffold-only flow in `tests/integration/pocScaffold.spec.ts`: run scaffolder with fixture session → verify output directory structure matches poc-output contract → verify package.json has test script → verify .sofia-metadata.json links to session
|
|
59
|
+
- [x] T047 [P] [US1] Add unit tests for `McpContextEnricher` in `tests/unit/develop/mcpContextEnricher.spec.ts`: verify queries Context7 for library docs when dependencies listed in plan; verify queries Microsoft Docs/Azure MCP when plan mentions Azure services; verify calls web.search when `stuckIterations > 0`; verify falls back gracefully (returns empty context) when MCP services unavailable; verify returns structured context string suitable for prompt injection
|
|
60
|
+
|
|
61
|
+
### Implementation for User Story 1
|
|
62
|
+
|
|
63
|
+
- [x] T016 [US1] Implement `PocScaffolder` class in `src/develop/pocScaffolder.ts`: accepts `ScaffoldContext`, generates files from `node-ts-vitest` template, respects `skipIfExists`, creates directory structure, returns list of created files
|
|
64
|
+
- [x] T017 [US1] Implement `TestRunner` class in `src/develop/testRunner.ts`: spawns `npm test -- --reporter=json` via `child_process.spawn` in outputDir, parses Vitest JSON reporter output into `TestResults`, enforces 60s timeout, truncates rawOutput
|
|
65
|
+
- [x] T018 [US1] Implement `CodeGenerator` class in `src/develop/codeGenerator.ts`: builds iteration prompt per ralph-loop contract template, parses LLM response for fenced code blocks with `file=` paths, writes parsed files to outputDir, detects new dependencies in package.json
|
|
66
|
+
- [x] T048 [US1] Implement `McpContextEnricher` in `src/develop/mcpContextEnricher.ts`: accepts plan/techStack/iteration context; conditionally queries Context7 (library docs for PoC dependencies, gated by `McpManager.isAvailable('context7')`), Microsoft Docs/Azure MCP (when plan references Azure services, gated by `McpManager.isAvailable('azure')`), web.search (when stuck iterations detected, gated by `isWebSearchConfigured()`); returns enriched context strings for prompt injection; graceful degradation when services unavailable
|
|
67
|
+
- [x] T019 [US1] Implement `developCommand` handler in `src/cli/developCommand.ts`: parses `--session <id>`, `--max-iterations <n>`, `--output <dir>`, `--force` options; validates session has `selection` and `plan`; fails fast with guidance if missing; detects existing outputDir and warns (default: resume from last iteration; `--force`: overwrite and start fresh); wires to RalphLoop (Phase 4)
|
|
68
|
+
- [x] T020 [US1] Register `dev` command in `src/cli/index.ts` as a subcommand pointing to `developCommand` handler
|
|
69
|
+
- [x] T021 [US1] Prepare `createDevelopHandler()` in `src/phases/phaseHandlers.ts` as a stub that accepts RalphLoop integration (actual wiring completed in T029, Phase 4); keep `develop-boundary.md` prompt for backward compat
|
|
70
|
+
|
|
71
|
+
**Checkpoint**: User Story 1 scaffolding works — `sofia dev --session <id>` creates a valid PoC project structure locally.
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Phase 4: User Story 2 — Iterate via Ralph loop (Priority: P1)
|
|
76
|
+
|
|
77
|
+
**Goal**: Iteratively refine the PoC by running tests and applying LLM-suggested improvements until tests pass, max iterations reached, or user stops.
|
|
78
|
+
|
|
79
|
+
**Independent Test**: Starting from a scaffolded PoC, simulate test failures and verify that successive iterations apply targeted changes. At least one iteration should fix a failing test.
|
|
80
|
+
|
|
81
|
+
### Tests for User Story 2 (REQUIRED) ⚠️
|
|
82
|
+
|
|
83
|
+
- [x] T022 [P] [US2] Add unit tests for `RalphLoop` orchestrator in `tests/unit/develop/ralphLoop.spec.ts`: verify lifecycle (validate → scaffold → install → iterate); verify termination on tests-passing; verify termination on max-iterations; verify iteration count tracking; verify session persistence callback called after each iteration; verify Ctrl+C handling sets user-stopped
|
|
84
|
+
- [x] T023 [P] [US2] Add integration test for Ralph loop with fakes in `tests/integration/ralphLoopFlow.spec.ts`: use a fake CopilotClient and fake test runner; scaffold → fail tests → LLM generates fix → tests pass → loop terminates with `success`; verify at least one iteration where failing test guides a fix (SC-002-003)
|
|
85
|
+
- [x] T024 [P] [US2] Add integration test for partial/failed outcomes in `tests/integration/ralphLoopPartial.spec.ts`: test max-iterations with some tests passing (partial status); test max-iterations with no tests passing (failed status); test LLM error mid-loop (error outcome on iteration, loop continues)
|
|
86
|
+
|
|
87
|
+
### Implementation for User Story 2
|
|
88
|
+
|
|
89
|
+
- [x] T025 [US2] Implement `RalphLoop` orchestrator in `src/develop/ralphLoop.ts`: accepts `RalphLoopOptions` per contract; lifecycle: validate session → scaffold (iteration 1) → npm install → iterate (2..max: run tests → check pass → build prompt → LLM turn → apply code → persist); returns `RalphLoopResult` with finalStatus and terminationReason
|
|
90
|
+
- [x] T026 [US2] Implement auto-completing `LoopIO` adapter for Ralph loop LLM turns in `src/develop/ralphLoop.ts`: creates `ConversationLoop` per iteration with `readInput: async () => null` (single-turn, no user input); passes iteration prompt as `initialMessage`
|
|
91
|
+
- [x] T027 [US2] Implement npm install step in `RalphLoop`: run `npm install` after scaffold; detect package.json dependency changes between iterations and re-run `npm install` if needed; on install failure after scaffold, terminate with `terminationReason: "error"` and clear error message; on install failure during iteration, set iteration `outcome: "error"` with `errorMessage`, log the npm error, and continue to next iteration (LLM may fix the dependency issue)
|
|
92
|
+
- [x] T028 [US2] Implement Ctrl+C / SIGINT handling in `RalphLoop`: on signal, set `terminationReason: "user-stopped"`, persist current session state, exit loop gracefully
|
|
93
|
+
- [x] T029 [US2] Wire `RalphLoop` into `developCommand` in `src/cli/developCommand.ts`: create `RalphLoopOptions` from CLI args and session; create `ActivitySpinner` for visual feedback; call `ralphLoop.run()` and display results
|
|
94
|
+
- [x] T030 [US2] Implement iteration event logging via `onEvent` callback: emit `SofiaEvent` for each iteration start, test results, code generation, and loop termination (D-005 auditability)
|
|
95
|
+
- [x] T031 [US2] Add `llmPromptContext` summary generation (truncated context of what was sent to LLM) in `CodeGenerator` for auditability — not full prompt, just key context (iteration number, failure count, files listed)
|
|
96
|
+
- [x] T049 [US2] Integrate `McpContextEnricher` into `RalphLoop` iteration cycle in `src/develop/ralphLoop.ts`: call enricher before CodeGenerator on each iteration to fetch relevant library docs (Context7) and architecture guidance (Azure MCP); pass enriched context into the iteration prompt; invoke web.search enrichment when 2+ consecutive stuck iterations detected (same failures repeating)
|
|
97
|
+
|
|
98
|
+
**Checkpoint**: Full Ralph loop works end-to-end with fakes — scaffold, iterate, terminate. SC-002-003 validated.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Phase 5: User Story 3 — Handle MCP and permissions constraints (Priority: P2)
|
|
103
|
+
|
|
104
|
+
**Goal**: When GitHub MCP is available, create a GitHub repository for the PoC. When unavailable, fall back gracefully to local output with clear logging.
|
|
105
|
+
|
|
106
|
+
**Independent Test**: Disable GitHub MCP, run Develop, verify local scaffold produced with `repoSource: "local"`. Enable GitHub MCP, run Develop, verify repo created with `repoSource: "github-mcp"`.
|
|
107
|
+
|
|
108
|
+
### Tests for User Story 3 (REQUIRED) ⚠️
|
|
109
|
+
|
|
110
|
+
- [x] T032 [P] [US3] Add unit tests for `GitHubMcpAdapter` in `tests/unit/develop/githubMcpAdapter.spec.ts`: verify `isAvailable()` checks `McpManager.isAvailable('github')`; verify `createRepository()` calls MCP tool; verify `pushFiles()` commits and pushes; verify graceful fallback returns `{ available: false }` when MCP unavailable
|
|
111
|
+
- [x] T033 [P] [US3] Add integration test for local fallback flow in `tests/integration/pocLocalFallback.spec.ts`: mock McpManager to report GitHub unavailable; run Ralph loop; verify `repoSource: "local"`, `repoPath` set, no `repoUrl`; verify log message explains fallback
|
|
112
|
+
- [x] T034 [P] [US3] Add integration test for GitHub MCP flow in `tests/integration/pocGithubMcp.spec.ts`: mock McpManager to report GitHub available; mock MCP tool calls; run Ralph loop; verify `repoSource: "github-mcp"`, `repoUrl` set; verify push after each iteration
|
|
113
|
+
|
|
114
|
+
### Implementation for User Story 3
|
|
115
|
+
|
|
116
|
+
- [x] T035 [US3] Implement `GitHubMcpAdapter` in `src/develop/githubMcpAdapter.ts`: `isAvailable()` checks McpManager; `createRepository(name, description)` creates repo via MCP tool call; `pushFiles(repoUrl, files, message)` commits and pushes; `getRepoUrl()` returns URL; all methods return typed results with error handling
|
|
117
|
+
- [x] T036 [US3] Integrate `GitHubMcpAdapter` into `RalphLoop` in `src/develop/ralphLoop.ts`: after scaffold, check adapter availability; if available, create repo and push scaffold; after each successful iteration, push updated files; on completion, final push; set `repoSource` and `repoUrl` in session
|
|
118
|
+
- [x] T037 [US3] Implement local fallback path in `RalphLoop`: when `GitHubMcpAdapter.isAvailable()` returns false, set `repoSource: "local"`, log clear fallback message via `io.writeActivity()`, continue with local-only output
|
|
119
|
+
- [x] T038 [US3] Update `developCommand` in `src/cli/developCommand.ts`: display repo URL or local path on completion; in `--json` mode, include `repoSource` and `repoUrl`/`repoPath` in output
|
|
120
|
+
|
|
121
|
+
**Checkpoint**: `sofia dev` works in both MCP-available and MCP-unavailable environments. SC-002-002 validated.
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Phase 6: Polish & Cross-Cutting Concerns
|
|
126
|
+
|
|
127
|
+
**Purpose**: End-to-end validation, documentation updates, output validation, and hardening.
|
|
128
|
+
|
|
129
|
+
- [x] T039 [P] Implement PoC output validator in `src/develop/pocScaffolder.ts` (or separate `src/develop/outputValidator.ts`): check all required files exist per poc-output contract validation table; report missing files; return structured validation result
|
|
130
|
+
- [x] T040 [P] Add unit tests for output validator in `tests/unit/develop/outputValidator.spec.ts`: test all 8 validation checks from poc-output contract
|
|
131
|
+
- [x] T041 Add E2E happy-path test in `tests/e2e/developE2e.spec.ts`: run `sofia dev --session <fixtureId>` as subprocess; verify exit code 0; verify output directory has required files; verify session JSON updated with poc state
|
|
132
|
+
- [x] T050 Add E2E failure/recovery test in `tests/e2e/developFailureE2e.spec.ts`: run `sofia dev --session <fixtureId> --max-iterations 1` with a session whose plan produces deliberately failing tests; verify graceful termination; verify `finalStatus` is `"failed"` or `"partial"` in session JSON; verify `terminationReason: "max-iterations"`; verify user-facing output includes recovery guidance (Constitution VI compliance)
|
|
133
|
+
- [x] T042 [P] Update documentation in `docs/` to cover `sofia dev` command: usage, options, output structure, GitHub MCP integration, troubleshooting
|
|
134
|
+
- [x] T043 [P] Update `docs/export-format.md` to document enriched Develop section in exports
|
|
135
|
+
- [x] T044 Run `quickstart.md` validation: execute all commands from `specs/002-poc-generation/quickstart.md` and verify they work or update the quickstart
|
|
136
|
+
- [x] T045 Review logs for Develop phase: ensure no secrets/PII in iteration logs, verify `llmPromptContext` contains only summary data, verify `rawOutput` truncation works
|
|
137
|
+
- [x] T046 Run full test suite (`npx vitest run`) and lint/typecheck (`npm run lint && npm run typecheck`) to confirm no regressions
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Dependencies & Execution Order
|
|
142
|
+
|
|
143
|
+
### Phase Dependencies
|
|
144
|
+
|
|
145
|
+
- **Setup (Phase 1)**: No dependencies — can start immediately.
|
|
146
|
+
- **Foundational (Phase 2)**: Depends on Setup completion — BLOCKS all user stories.
|
|
147
|
+
- **User Stories (Phases 3–5)**: All depend on Foundational phase completion.
|
|
148
|
+
- US1 (P1) and US2 (P1) are both Priority 1 but US2 depends on US1 components (scaffolder, test runner, code generator).
|
|
149
|
+
- US3 (P2) depends on US2 (RalphLoop must exist to integrate MCP adapter into it).
|
|
150
|
+
- **Polish (Phase 6)**: Depends on all user stories being complete.
|
|
151
|
+
|
|
152
|
+
### User Story Dependencies
|
|
153
|
+
|
|
154
|
+
- **User Story 1 (P1)**: Can start after Foundational (Phase 2). No dependencies on other stories. Delivers scaffolding, test runner, code generator, MCP context enricher, and CLI command.
|
|
155
|
+
- **User Story 2 (P1)**: Depends on US1 (needs PocScaffolder, TestRunner, CodeGenerator, McpContextEnricher). Delivers the Ralph loop orchestrator that wires those components together.
|
|
156
|
+
- **User Story 3 (P2)**: Depends on US2 (needs RalphLoop to integrate GitHub MCP adapter). Delivers MCP integration and local fallback.
|
|
157
|
+
|
|
158
|
+
### Within Each User Story
|
|
159
|
+
|
|
160
|
+
- Tests MUST be written and FAIL before implementation.
|
|
161
|
+
- Components: schemas → individual modules → orchestration → CLI wiring.
|
|
162
|
+
- Each story complete before moving to next priority.
|
|
163
|
+
|
|
164
|
+
### Parallel Opportunities
|
|
165
|
+
|
|
166
|
+
- All Setup tasks marked [P] can run in parallel.
|
|
167
|
+
- All Foundational tasks marked [P] can run in parallel (T007, T008, T010 alongside T005/T006).
|
|
168
|
+
- Within US1: all test tasks (T011–T015, T047) can run in parallel; T016/T017/T018/T048 can run in parallel (different files).
|
|
169
|
+
- Within US2: all test tasks (T022–T024) can run in parallel.
|
|
170
|
+
- Within US3: all test tasks (T032–T034) can run in parallel.
|
|
171
|
+
- Polish tasks marked [P] can run in parallel.
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Parallel Example: User Story 1
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
# Launch all tests for User Story 1 together (all [P]):
|
|
179
|
+
T011: tests/unit/develop/pocScaffolder.spec.ts
|
|
180
|
+
T012: tests/unit/develop/testRunner.spec.ts
|
|
181
|
+
T013: tests/unit/develop/codeGenerator.spec.ts
|
|
182
|
+
T014: tests/unit/cli/developCommand.spec.ts
|
|
183
|
+
T015: tests/integration/pocScaffold.spec.ts
|
|
184
|
+
T047: tests/unit/develop/mcpContextEnricher.spec.ts
|
|
185
|
+
|
|
186
|
+
# Launch parallel implementation (different files):
|
|
187
|
+
T016: src/develop/pocScaffolder.ts [P]
|
|
188
|
+
T017: src/develop/testRunner.ts [P]
|
|
189
|
+
T018: src/develop/codeGenerator.ts [P]
|
|
190
|
+
T048: src/develop/mcpContextEnricher.ts [P]
|
|
191
|
+
|
|
192
|
+
# Then sequential (wiring):
|
|
193
|
+
T019: src/cli/developCommand.ts
|
|
194
|
+
T020: src/cli/index.ts
|
|
195
|
+
T021: src/phases/phaseHandlers.ts
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Parallel Example: User Story 2
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
# Launch all tests together (all [P]):
|
|
202
|
+
T022: tests/unit/develop/ralphLoop.spec.ts
|
|
203
|
+
T023: tests/integration/ralphLoopFlow.spec.ts
|
|
204
|
+
T024: tests/integration/ralphLoopPartial.spec.ts
|
|
205
|
+
|
|
206
|
+
# Sequential implementation (ralphLoop.ts is central):
|
|
207
|
+
T025: src/develop/ralphLoop.ts (core orchestrator)
|
|
208
|
+
T026: src/develop/ralphLoop.ts (auto-completing IO)
|
|
209
|
+
T027: src/develop/ralphLoop.ts (npm install)
|
|
210
|
+
T028: src/develop/ralphLoop.ts (Ctrl+C)
|
|
211
|
+
T029: src/cli/developCommand.ts (wiring)
|
|
212
|
+
T030: src/develop/ralphLoop.ts (events)
|
|
213
|
+
T031: src/develop/codeGenerator.ts (auditability)
|
|
214
|
+
T049: src/develop/ralphLoop.ts (MCP context enrichment)
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## Implementation Strategy
|
|
220
|
+
|
|
221
|
+
### MVP First (User Story 1 Only)
|
|
222
|
+
|
|
223
|
+
1. Complete Phase 1: Setup.
|
|
224
|
+
2. Complete Phase 2: Foundational (CRITICAL — blocks all stories).
|
|
225
|
+
3. Complete Phase 3: User Story 1 (scaffolding, test runner, code generator, CLI command).
|
|
226
|
+
4. **STOP and VALIDATE**: `sofia dev --session <id>` creates a valid PoC directory with all required files.
|
|
227
|
+
5. Demo the scaffold output.
|
|
228
|
+
|
|
229
|
+
### Incremental Delivery
|
|
230
|
+
|
|
231
|
+
1. Deliver MVP (User Story 1) — scaffolding works, files created.
|
|
232
|
+
2. Add User Story 2 (Ralph loop) — iterative refinement works with fakes. SC-002-001 and SC-002-003 validated.
|
|
233
|
+
3. Add User Story 3 (GitHub MCP) — MCP integration and local fallback. SC-002-002 validated.
|
|
234
|
+
4. Apply Phase 6 polish — E2E tests, docs, output validation, full regression.
|
|
235
|
+
|
|
236
|
+
### Relation to Feature 001
|
|
237
|
+
|
|
238
|
+
- This feature consumes `WorkshopSession` with populated `selection`, `plan`, and `businessContext` from Feature 001.
|
|
239
|
+
- The `createDevelopHandler()` in `src/phases/phaseHandlers.ts` (currently boundary-only) is replaced with a real handler that invokes the Ralph loop.
|
|
240
|
+
- The `generateDevelopMarkdown()` in `src/sessions/exportWriter.ts` is enriched with iteration details.
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## Notes
|
|
245
|
+
|
|
246
|
+
- [P] tasks = different files, no dependencies
|
|
247
|
+
- [Story] label maps task to specific user story for traceability
|
|
248
|
+
- Each user story should be independently completable and testable
|
|
249
|
+
- Verify tests fail before implementing
|
|
250
|
+
- Commit after each task or logical group
|
|
251
|
+
- Stop at any checkpoint to validate story independently
|
|
252
|
+
- v1 targets TypeScript + Vitest PoCs only (template: `node-ts-vitest`); other templates deferred
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Specification Quality Checklist: MCP Transport Integration
|
|
2
|
+
|
|
3
|
+
**Purpose**: Validate specification completeness and quality before proceeding to planning
|
|
4
|
+
**Created**: 2026-03-01
|
|
5
|
+
**Feature**: [spec.md](../spec.md)
|
|
6
|
+
|
|
7
|
+
## Content Quality
|
|
8
|
+
|
|
9
|
+
- [x] No implementation details (languages, frameworks, APIs)
|
|
10
|
+
- [x] Focused on user value and business needs
|
|
11
|
+
- [x] Written for non-technical stakeholders
|
|
12
|
+
- [x] All mandatory sections completed
|
|
13
|
+
|
|
14
|
+
## Requirement Completeness
|
|
15
|
+
|
|
16
|
+
- [x] No [NEEDS CLARIFICATION] markers remain
|
|
17
|
+
- [x] Requirements are testable and unambiguous
|
|
18
|
+
- [x] Success criteria are measurable
|
|
19
|
+
- [x] Success criteria are technology-agnostic (no implementation details)
|
|
20
|
+
- [x] All acceptance scenarios are defined
|
|
21
|
+
- [x] Edge cases are identified
|
|
22
|
+
- [x] Scope is clearly bounded
|
|
23
|
+
- [x] Dependencies and assumptions identified
|
|
24
|
+
|
|
25
|
+
## Feature Readiness
|
|
26
|
+
|
|
27
|
+
- [x] All functional requirements have clear acceptance criteria
|
|
28
|
+
- [x] User scenarios cover primary flows
|
|
29
|
+
- [x] Feature meets measurable outcomes defined in Success Criteria
|
|
30
|
+
- [x] No implementation details leak into specification
|
|
31
|
+
|
|
32
|
+
## Notes
|
|
33
|
+
|
|
34
|
+
- FR-019 and FR-020 use SHOULD (not MUST) because they depend on research into Copilot SDK capabilities — the implementation approach may vary based on what the SDK actually supports.
|
|
35
|
+
- Success criteria SC-003-004 and SC-003-005 reference comparative measurements that will need baseline data collection during implementation.
|
|
36
|
+
- Live MCP integration tests are assumed to be gated behind environment variables to keep CI stable.
|
|
37
|
+
- The spec deliberately avoids prescribing JSON-RPC implementation details, stdio spawning mechanics, or HTTP client choices — those are implementation decisions for the planning phase.
|