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,128 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity
|
|
10
|
+
and orientation.
|
|
11
|
+
|
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
14
|
+
|
|
15
|
+
## Our Standards
|
|
16
|
+
|
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
|
18
|
+
community include:
|
|
19
|
+
|
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
|
+
and learning from the experience
|
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the
|
|
26
|
+
overall community
|
|
27
|
+
|
|
28
|
+
Examples of unacceptable behavior include:
|
|
29
|
+
|
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or
|
|
31
|
+
advances of any kind
|
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
+
* Public or private harassment
|
|
34
|
+
* Publishing others' private information, such as a physical or email
|
|
35
|
+
address, without their explicit permission
|
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
+
professional setting
|
|
38
|
+
|
|
39
|
+
## Enforcement Responsibilities
|
|
40
|
+
|
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
+
or harmful.
|
|
45
|
+
|
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
49
|
+
decisions when appropriate.
|
|
50
|
+
|
|
51
|
+
## Scope
|
|
52
|
+
|
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
54
|
+
an individual is officially representing the community in public spaces.
|
|
55
|
+
Examples of representing our community include using an official e-mail address,
|
|
56
|
+
posting via an official social media account, or acting as an appointed
|
|
57
|
+
representative at an online or offline event.
|
|
58
|
+
|
|
59
|
+
## Enforcement
|
|
60
|
+
|
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
62
|
+
reported to the community leaders responsible for enforcement at
|
|
63
|
+
Issues Page.
|
|
64
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
|
65
|
+
|
|
66
|
+
All community leaders are obligated to respect the privacy and security of the
|
|
67
|
+
reporter of any incident.
|
|
68
|
+
|
|
69
|
+
## Enforcement Guidelines
|
|
70
|
+
|
|
71
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
|
72
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
|
73
|
+
|
|
74
|
+
### 1. Correction
|
|
75
|
+
|
|
76
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
77
|
+
unprofessional or unwelcome in the community.
|
|
78
|
+
|
|
79
|
+
**Consequence**: A private, written warning from community leaders, providing
|
|
80
|
+
clarity around the nature of the violation and an explanation of why the
|
|
81
|
+
behavior was inappropriate. A public apology may be requested.
|
|
82
|
+
|
|
83
|
+
### 2. Warning
|
|
84
|
+
|
|
85
|
+
**Community Impact**: A violation through a single incident or series
|
|
86
|
+
of actions.
|
|
87
|
+
|
|
88
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
|
89
|
+
interaction with the people involved, including unsolicited interaction with
|
|
90
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
|
91
|
+
includes avoiding interactions in community spaces as well as external channels
|
|
92
|
+
like social media. Violating these terms may lead to a temporary or
|
|
93
|
+
permanent ban.
|
|
94
|
+
|
|
95
|
+
### 3. Temporary Ban
|
|
96
|
+
|
|
97
|
+
**Community Impact**: A serious violation of community standards, including
|
|
98
|
+
sustained inappropriate behavior.
|
|
99
|
+
|
|
100
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
|
101
|
+
communication with the community for a specified period of time. No public or
|
|
102
|
+
private interaction with the people involved, including unsolicited interaction
|
|
103
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
|
104
|
+
Violating these terms may lead to a permanent ban.
|
|
105
|
+
|
|
106
|
+
### 4. Permanent Ban
|
|
107
|
+
|
|
108
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
|
109
|
+
standards, including sustained inappropriate behavior, harassment of an
|
|
110
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
|
111
|
+
|
|
112
|
+
**Consequence**: A permanent ban from any sort of public interaction within
|
|
113
|
+
the community.
|
|
114
|
+
|
|
115
|
+
## Attribution
|
|
116
|
+
|
|
117
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
118
|
+
version 2.0, available at
|
|
119
|
+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
|
120
|
+
|
|
121
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
|
122
|
+
enforcement ladder](https://github.com/mozilla/diversity).
|
|
123
|
+
|
|
124
|
+
[homepage]: https://www.contributor-covenant.org
|
|
125
|
+
|
|
126
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
|
127
|
+
https://www.contributor-covenant.org/faq. Translations are available at
|
|
128
|
+
https://www.contributor-covenant.org/translations.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Juan Manuel Servera
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
# sofIA — AI Discovery Workshop CLI
|
|
2
|
+
|
|
3
|
+
**sofIA** is an agentic CLI that guides facilitators through a structured AI Discovery Workshop — from understanding a business and brainstorming AI use cases, all the way to generating a working proof-of-concept. It reimagines two Microsoft open-source projects using the GitHub Copilot SDK for Node.js and extends them with idea selection, planning, and autonomous code generation.
|
|
4
|
+
|
|
5
|
+
## Origins
|
|
6
|
+
|
|
7
|
+
sofIA builds on and extends two upstream projects:
|
|
8
|
+
|
|
9
|
+
### 1. [AI Discovery Agent (AIDA)](https://github.com/microsoft/ai-discovery-agent/)
|
|
10
|
+
|
|
11
|
+
Microsoft's AI Discovery Agent is a Python/LangGraph agent that facilitates AI Discovery Workshops — structured sessions where organizations identify high-value AI use cases. AIDA walks participants through business analysis, workflow mapping, and idea generation using multi-agent orchestration.
|
|
12
|
+
|
|
13
|
+
**What sofIA takes from AIDA**: The workshop facilitation methodology, multi-phase agent flow (Discover → Ideate → Design), prompt engineering patterns for business analysis, and the overall goal of making AI discovery accessible and structured.
|
|
14
|
+
|
|
15
|
+
**What sofIA changes**: Rebuilt from Python/LangGraph to **Node.js/TypeScript** using the **GitHub Copilot SDK**. Runs as a CLI rather than a notebook/web interface. Adds three phases beyond AIDA's scope: idea **Selection**, implementation **Planning**, and PoC **Development**.
|
|
16
|
+
|
|
17
|
+
### 2. [AI Discovery Cards Agent](https://github.com/microsoft-partner-solutions-ai/agent-guides/tree/main/ai-discovery-cards-agent)
|
|
18
|
+
|
|
19
|
+
The AI Discovery Cards Agent is a guided workshop framework that uses a deck of "AI Envisioning Cards" to help teams systematically map AI capabilities to their workflow steps. Each card represents an AI pattern (e.g., anomaly detection, content generation, predictive analytics) that participants score and align to business activities.
|
|
20
|
+
|
|
21
|
+
**What sofIA takes from AI Discovery Cards**: The 12-step methodology, the card deck and scoring system, the workflow-to-card mapping approach, and the idea evaluation framework using feasibility/value matrices.
|
|
22
|
+
|
|
23
|
+
**What sofIA changes**: Implements the full 12-step process as an interactive CLI agent rather than a facilitation guide. Automates card presentation, scoring aggregation, and idea generation. Extends the process with autonomous idea selection based on structured criteria.
|
|
24
|
+
|
|
25
|
+
## What sofIA Does
|
|
26
|
+
|
|
27
|
+
sofIA implements a **6-phase agentic pipeline** as an interactive CLI:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
Discover → Ideate → Design → Select → Plan → Develop
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
| Phase | What happens |
|
|
34
|
+
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
35
|
+
| **Discover** | Understand the business, challenges, and constraints. Choose a focus topic. |
|
|
36
|
+
| **Ideate** | Brainstorm activities, map workflows, explore AI Envisioning Cards, score and map them to workflow steps. |
|
|
37
|
+
| **Design** | Generate idea cards with descriptions, workflow coverage, and aspirational scope. |
|
|
38
|
+
| **Select** | Evaluate ideas on feasibility/value, select the most promising one with transparent rationale. |
|
|
39
|
+
| **Plan** | Create an implementation plan with milestones, architecture notes, dependencies, and PoC scope. |
|
|
40
|
+
| **Develop** | Generate a proof-of-concept repository using a **Ralph loop** — an autonomous cycle of code generation, testing, and LLM-driven refinement. |
|
|
41
|
+
|
|
42
|
+
### The Ralph Loop
|
|
43
|
+
|
|
44
|
+
The Develop phase uses an iterative code generation pattern inspired by [Geoffrey Huntley's Ralph concept](https://ghuntley.com/ralph/): the LLM generates code, tests run, failures are fed back as context, and the LLM refines until tests pass or the iteration limit is reached. This produces a working PoC without manual code authoring.
|
|
45
|
+
|
|
46
|
+
### MCP Integrations
|
|
47
|
+
|
|
48
|
+
sofIA uses [Model Context Protocol](https://modelcontextprotocol.io/) servers to enrich its context:
|
|
49
|
+
|
|
50
|
+
| Server | Purpose |
|
|
51
|
+
| ------------------ | ------------------------------------------------------------ |
|
|
52
|
+
| **GitHub MCP** | Repository creation for PoCs, code search, issue tracking |
|
|
53
|
+
| **Context7** | Up-to-date library and framework documentation |
|
|
54
|
+
| **Microsoft Docs** | Azure resource management, cloud architecture guidance |
|
|
55
|
+
| **WorkIQ** | Microsoft 365 process analysis (emails, meetings, documents) |
|
|
56
|
+
| **Playwright** | Browser automation for web research and PoC testing |
|
|
57
|
+
|
|
58
|
+
## Tech Stack
|
|
59
|
+
|
|
60
|
+
- **Runtime**: Node.js (>=20 LTS) with TypeScript (ES2022 target, ESM)
|
|
61
|
+
- **SDK**: [@github/copilot-sdk](https://www.npmjs.com/package/@github/copilot-sdk) for LLM orchestration
|
|
62
|
+
- **CLI**: [Commander.js](https://github.com/tj/commander.js) with interactive menus via [@inquirer/prompts](https://github.com/SBoudrias/Inquirer.js)
|
|
63
|
+
- **Testing**: [Vitest](https://vitest.dev/) with v8 coverage
|
|
64
|
+
- **Logging**: [Pino](https://getpino.io/) with PII redaction
|
|
65
|
+
- **Schemas**: [Zod v4](https://zod.dev/) for session validation
|
|
66
|
+
|
|
67
|
+
## Quick Start
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Prerequisites: Node.js >= 20, a GitHub Copilot subscription
|
|
71
|
+
|
|
72
|
+
# Clone & install
|
|
73
|
+
git clone https://github.com/jmservera/sofia-cli.git
|
|
74
|
+
cd sofia-cli
|
|
75
|
+
npm install
|
|
76
|
+
|
|
77
|
+
# Start an interactive workshop
|
|
78
|
+
npm run start -- workshop
|
|
79
|
+
|
|
80
|
+
# Check session status
|
|
81
|
+
npm run start -- status
|
|
82
|
+
|
|
83
|
+
# Generate a PoC from a completed session
|
|
84
|
+
npm run start -- dev --session <id>
|
|
85
|
+
|
|
86
|
+
# Export workshop artifacts
|
|
87
|
+
npm run start -- export --session <id>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## CLI Commands
|
|
91
|
+
|
|
92
|
+
| Command | Description |
|
|
93
|
+
| ---------------- | -------------------------------------------------- |
|
|
94
|
+
| `sofia workshop` | Start or resume an AI Discovery Workshop session |
|
|
95
|
+
| `sofia dev` | Generate and refine a PoC from a completed session |
|
|
96
|
+
| `sofia status` | Display session status and next actions |
|
|
97
|
+
| `sofia export` | Export workshop artifacts as Markdown + JSON |
|
|
98
|
+
|
|
99
|
+
See [docs/cli-usage.md](docs/cli-usage.md) for full command reference.
|
|
100
|
+
|
|
101
|
+
## Project Structure
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
infra/ # Azure AI Foundry IaC (Bicep + deployment scripts)
|
|
105
|
+
├── main.bicep # Foundry account, project, model deployment
|
|
106
|
+
├── resources.bicep # Resource-group-scoped resources (module)
|
|
107
|
+
├── main.bicepparam # Default parameters
|
|
108
|
+
├── deploy.sh # One-command deployment
|
|
109
|
+
└── teardown.sh # Resource group deletion
|
|
110
|
+
|
|
111
|
+
src/
|
|
112
|
+
├── cli/ # Command handlers (workshop, dev, status, export)
|
|
113
|
+
├── develop/ # PoC generation & Ralph loop
|
|
114
|
+
│ ├── ralphLoop.ts # Autonomous iteration orchestrator
|
|
115
|
+
│ ├── pocScaffolder.ts # Project scaffolding
|
|
116
|
+
│ ├── codeGenerator.ts # LLM-driven code generation
|
|
117
|
+
│ ├── testRunner.ts # Test execution & result parsing
|
|
118
|
+
│ └── ...
|
|
119
|
+
├── loop/ # Multi-turn conversation orchestrator
|
|
120
|
+
├── phases/ # Phase handlers & JSON extractors
|
|
121
|
+
├── prompts/ # Versioned prompt templates
|
|
122
|
+
├── sessions/ # Session persistence & export
|
|
123
|
+
├── mcp/ # MCP server connection manager
|
|
124
|
+
├── shared/ # Schemas, events, error classification
|
|
125
|
+
│ └── schemas/ # Zod schemas for session state
|
|
126
|
+
└── vendor/ # Re-exports of external packages
|
|
127
|
+
|
|
128
|
+
specs/
|
|
129
|
+
├── 001-cli-workshop-rebuild/ # Workshop phases spec & tasks
|
|
130
|
+
├── 002-poc-generation/ # Develop phase spec & tasks
|
|
131
|
+
└── 003-next-spec-gaps.md # Outstanding gaps for next feature
|
|
132
|
+
|
|
133
|
+
docs/ # User-facing documentation
|
|
134
|
+
tests/
|
|
135
|
+
├── unit/ # Single-module tests
|
|
136
|
+
├── integration/ # Multi-module flow tests
|
|
137
|
+
├── e2e/ # PTY-based interactive tests
|
|
138
|
+
└── live/ # Tests requiring real MCP/LLM access
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Development
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# Run all tests
|
|
145
|
+
npm test
|
|
146
|
+
|
|
147
|
+
# Run specific test suites
|
|
148
|
+
npm run test:unit
|
|
149
|
+
npm run test:integration
|
|
150
|
+
npm run test:e2e
|
|
151
|
+
|
|
152
|
+
# Run live tests (requires SOFIA_LIVE_MCP_TESTS=true and real MCP access)
|
|
153
|
+
SOFIA_LIVE_MCP_TESTS=true npm test
|
|
154
|
+
|
|
155
|
+
# Watch mode (auto-reloads)
|
|
156
|
+
npm run dev -- workshop
|
|
157
|
+
|
|
158
|
+
# Lint & typecheck
|
|
159
|
+
npm run lint
|
|
160
|
+
npm run typecheck
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### TDD Workflow
|
|
164
|
+
|
|
165
|
+
All changes follow **Red → Green → Review**:
|
|
166
|
+
|
|
167
|
+
1. Write a failing test first
|
|
168
|
+
2. Implement the minimum code to make it pass
|
|
169
|
+
3. Review for edge cases and add tests if gaps found
|
|
170
|
+
4. Run the full suite before committing
|
|
171
|
+
|
|
172
|
+
See [.github/copilot-instructions.md](.github/copilot-instructions.md) for detailed conventions.
|
|
173
|
+
|
|
174
|
+
## Documentation
|
|
175
|
+
|
|
176
|
+
| Document | Contents |
|
|
177
|
+
| ---------------------------------------------- | -------------------------------------- |
|
|
178
|
+
| [docs/cli-usage.md](docs/cli-usage.md) | Commands, flags, examples |
|
|
179
|
+
| [docs/session-model.md](docs/session-model.md) | Session lifecycle, phases, persistence |
|
|
180
|
+
| [docs/export-format.md](docs/export-format.md) | Export artifacts and summary JSON |
|
|
181
|
+
| [docs/environment.md](docs/environment.md) | Environment variable configuration |
|
|
182
|
+
| [docs/architecture.md](docs/architecture.md) | Module overview and data flow |
|
|
183
|
+
|
|
184
|
+
## Current Status
|
|
185
|
+
|
|
186
|
+
- **Feature 001** (Workshop CLI): Discover → Ideate → Design → Select → Plan — **implemented and tested**
|
|
187
|
+
- **Feature 002** (PoC Generation): Develop phase with Ralph loop — **implemented and tested** (MCP integrations are simulated; see [specs/003-next-spec-gaps.md](specs/003-next-spec-gaps.md))
|
|
188
|
+
- **Feature 003** (MCP Integration): Real MCP tool invocation, resume/checkpoint, additional templates — **planned**
|
|
189
|
+
- **Feature 005** (AI Search Deploy): Azure AI Foundry infrastructure deployment + SDK-based web search integration — **implemented and tested**
|
|
190
|
+
|
|
191
|
+
## Web Search Setup
|
|
192
|
+
|
|
193
|
+
sofIA can search the web during the Discover phase to research companies, competitors, and industry trends. This requires an Azure AI Foundry deployment.
|
|
194
|
+
|
|
195
|
+
**Quick setup:**
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
# Deploy infrastructure (requires Azure CLI + subscription)
|
|
199
|
+
./infra/deploy.sh --subscription <id> --resource-group sofia-workshop-rg
|
|
200
|
+
|
|
201
|
+
# Configure sofIA with the output values
|
|
202
|
+
export FOUNDRY_PROJECT_ENDPOINT="<endpoint from deploy output>"
|
|
203
|
+
export FOUNDRY_MODEL_DEPLOYMENT_NAME="gpt-4.1-mini"
|
|
204
|
+
|
|
205
|
+
# Teardown when done
|
|
206
|
+
./infra/teardown.sh --resource-group sofia-workshop-rg
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
See [specs/005-ai-search-deploy/quickstart.md](specs/005-ai-search-deploy/quickstart.md) for detailed deployment instructions.
|
|
210
|
+
|
|
211
|
+
## License
|
|
212
|
+
|
|
213
|
+
See [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `sofia dev` command handler.
|
|
3
|
+
*
|
|
4
|
+
* Runs the Develop phase for a completed workshop session:
|
|
5
|
+
* - Validates the session has selection + plan
|
|
6
|
+
* - Derives checkpoint state for resume decisions
|
|
7
|
+
* - Creates a RalphLoop and runs it
|
|
8
|
+
* - Displays results (repo URL/path, final status)
|
|
9
|
+
*
|
|
10
|
+
* Contract: specs/002-poc-generation/tasks.md (T019, T029, T038)
|
|
11
|
+
* Contract: specs/004-dev-resume-hardening/contracts/cli.md
|
|
12
|
+
*/
|
|
13
|
+
import { join } from 'node:path';
|
|
14
|
+
import { existsSync, rmSync } from 'node:fs';
|
|
15
|
+
import { createNoOpSpinner } from '../shared/activitySpinner.js';
|
|
16
|
+
import { RalphLoop } from '../develop/ralphLoop.js';
|
|
17
|
+
import { McpContextEnricher } from '../develop/mcpContextEnricher.js';
|
|
18
|
+
import { deriveCheckpointState } from '../develop/checkpointState.js';
|
|
19
|
+
import { createDefaultRegistry, selectTemplate } from '../develop/templateRegistry.js';
|
|
20
|
+
import { PocScaffolder } from '../develop/pocScaffolder.js';
|
|
21
|
+
// ── Validation ────────────────────────────────────────────────────────────────
|
|
22
|
+
/**
|
|
23
|
+
* Validate that a session is ready for the Develop phase.
|
|
24
|
+
*
|
|
25
|
+
* Returns null if valid, or an error message if not.
|
|
26
|
+
*/
|
|
27
|
+
export function validateSessionForDevelop(session) {
|
|
28
|
+
if (!session.selection) {
|
|
29
|
+
return [
|
|
30
|
+
'Session is missing an idea selection.',
|
|
31
|
+
'Run the Select phase first: sofia workshop --session ' + session.sessionId,
|
|
32
|
+
].join('\n');
|
|
33
|
+
}
|
|
34
|
+
if (!session.plan) {
|
|
35
|
+
return [
|
|
36
|
+
'Session is missing an implementation plan.',
|
|
37
|
+
'Run the Plan phase first: sofia workshop --session ' + session.sessionId,
|
|
38
|
+
].join('\n');
|
|
39
|
+
}
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
// ── Command handler ───────────────────────────────────────────────────────────
|
|
43
|
+
/**
|
|
44
|
+
* Main handler for the `sofia dev` command.
|
|
45
|
+
*/
|
|
46
|
+
export async function developCommand(opts, deps) {
|
|
47
|
+
const { store, io, client } = deps;
|
|
48
|
+
const { mcpManager } = deps;
|
|
49
|
+
const json = opts.json ?? false;
|
|
50
|
+
// ── Resolve session ──────────────────────────────────────────────────────
|
|
51
|
+
let sessionId = opts.session;
|
|
52
|
+
if (!sessionId) {
|
|
53
|
+
// Try to find the most recent session
|
|
54
|
+
const sessions = await store.list();
|
|
55
|
+
if (sessions.length === 0) {
|
|
56
|
+
const msg = 'No sessions found. Start a workshop first: sofia workshop';
|
|
57
|
+
if (json) {
|
|
58
|
+
process.stdout.write(JSON.stringify({ error: msg }) + '\n');
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
io.writeActivity(msg);
|
|
62
|
+
}
|
|
63
|
+
process.exitCode = 1;
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
sessionId = sessions[sessions.length - 1];
|
|
67
|
+
io.writeActivity(`Using most recent session: ${sessionId}`);
|
|
68
|
+
}
|
|
69
|
+
// ── Load session ─────────────────────────────────────────────────────────
|
|
70
|
+
const session = await store.load(sessionId);
|
|
71
|
+
if (!session) {
|
|
72
|
+
const msg = `Session not found: ${sessionId}`;
|
|
73
|
+
if (json) {
|
|
74
|
+
process.stdout.write(JSON.stringify({ error: msg }) + '\n');
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
io.writeActivity(msg);
|
|
78
|
+
}
|
|
79
|
+
process.exitCode = 1;
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
// ── Validate session ─────────────────────────────────────────────────────
|
|
83
|
+
const validationError = validateSessionForDevelop(session);
|
|
84
|
+
if (validationError) {
|
|
85
|
+
if (json) {
|
|
86
|
+
process.stdout.write(JSON.stringify({ error: validationError }) + '\n');
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
process.stderr.write(`Error: ${validationError}\n`);
|
|
90
|
+
}
|
|
91
|
+
process.exitCode = 1;
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
// ── Determine output directory ───────────────────────────────────────────
|
|
95
|
+
const outputDir = opts.output
|
|
96
|
+
? join(process.cwd(), opts.output)
|
|
97
|
+
: join(process.cwd(), '..', 'poc', sessionId);
|
|
98
|
+
// ── Handle --force: reset session.poc AND output directory ───────────────
|
|
99
|
+
if (opts.force) {
|
|
100
|
+
// FR-008/009/010: Clear session state before doing anything else
|
|
101
|
+
session.poc = undefined;
|
|
102
|
+
await store.save(session);
|
|
103
|
+
const dirExists = existsSync(outputDir);
|
|
104
|
+
if (dirExists) {
|
|
105
|
+
try {
|
|
106
|
+
rmSync(outputDir, { recursive: true, force: true });
|
|
107
|
+
}
|
|
108
|
+
catch (err) {
|
|
109
|
+
const msg = `Failed to clear output directory: ${err instanceof Error ? err.message : String(err)}`;
|
|
110
|
+
if (json) {
|
|
111
|
+
process.stdout.write(JSON.stringify({ error: msg }) + '\n');
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
process.stderr.write(`Error: ${msg}\n`);
|
|
115
|
+
}
|
|
116
|
+
process.exitCode = 1;
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (!json) {
|
|
121
|
+
io.writeActivity('Cleared existing output directory and session state (--force)');
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
// ── Derive checkpoint state (resume detection) ───────────────────────────
|
|
125
|
+
const checkpoint = deriveCheckpointState(session, outputDir);
|
|
126
|
+
// FR-005: If PoC already succeeded, exit with completion message
|
|
127
|
+
if (!opts.force && checkpoint.priorFinalStatus === 'success') {
|
|
128
|
+
const msg = `PoC already complete for session ${sessionId}. Use --force to start fresh.`;
|
|
129
|
+
if (json) {
|
|
130
|
+
process.stdout.write(JSON.stringify({ status: 'already-complete', sessionId }) + '\n');
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
io.writeActivity(msg);
|
|
134
|
+
}
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
// FR-006: Default to resume for failed/partial
|
|
138
|
+
if (!opts.force && checkpoint.hasPriorRun) {
|
|
139
|
+
if (!json) {
|
|
140
|
+
io.writeActivity(`Resuming session ${sessionId} from iteration ${checkpoint.resumeFromIteration} (${checkpoint.completedIterations} completed iterations found)`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
// ── Template selection ────────────────────────────────────────────────────
|
|
144
|
+
const registry = createDefaultRegistry();
|
|
145
|
+
const template = selectTemplate(registry, session.plan?.architectureNotes, session.plan?.dependencies);
|
|
146
|
+
if (!json) {
|
|
147
|
+
const matchedPattern = template.matchPatterns.find((p) => [session.plan?.architectureNotes ?? '', ...(session.plan?.dependencies ?? [])]
|
|
148
|
+
.join(' ')
|
|
149
|
+
.toLowerCase()
|
|
150
|
+
.includes(p.toLowerCase()));
|
|
151
|
+
io.writeActivity(`Selected template: ${template.id}${matchedPattern ? ` (matched '${matchedPattern}' in architecture notes)` : ' (default)'}`);
|
|
152
|
+
}
|
|
153
|
+
// ── Create RalphLoop ─────────────────────────────────────────────────────
|
|
154
|
+
const spinner = createNoOpSpinner();
|
|
155
|
+
const enricher = mcpManager ? new McpContextEnricher(mcpManager) : undefined;
|
|
156
|
+
const ralph = new RalphLoop({
|
|
157
|
+
client,
|
|
158
|
+
io,
|
|
159
|
+
session,
|
|
160
|
+
spinner,
|
|
161
|
+
maxIterations: opts.maxIterations ?? 10,
|
|
162
|
+
outputDir,
|
|
163
|
+
enricher,
|
|
164
|
+
checkpoint,
|
|
165
|
+
scaffolder: new PocScaffolder(template),
|
|
166
|
+
templateEntry: template,
|
|
167
|
+
onSessionUpdate: async (updated) => {
|
|
168
|
+
await store.save(updated);
|
|
169
|
+
},
|
|
170
|
+
onEvent: (event) => {
|
|
171
|
+
if (opts.debug) {
|
|
172
|
+
io.writeActivity(`[event] ${event.type}: ${JSON.stringify(event)}`);
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
// ── Run the loop ─────────────────────────────────────────────────────────
|
|
177
|
+
if (!json) {
|
|
178
|
+
io.writeActivity(`Starting PoC generation for session: ${sessionId}\n` +
|
|
179
|
+
`Output: ${outputDir}\n` +
|
|
180
|
+
`Max iterations: ${opts.maxIterations ?? 10}`);
|
|
181
|
+
}
|
|
182
|
+
let result;
|
|
183
|
+
try {
|
|
184
|
+
result = await ralph.run();
|
|
185
|
+
}
|
|
186
|
+
catch (err) {
|
|
187
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
188
|
+
if (json) {
|
|
189
|
+
process.stdout.write(JSON.stringify({ error: msg }) + '\n');
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
process.stderr.write(`Error: ${msg}\n`);
|
|
193
|
+
}
|
|
194
|
+
process.exitCode = 1;
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
// ── Display results ──────────────────────────────────────────────────────
|
|
198
|
+
if (json) {
|
|
199
|
+
const output = {
|
|
200
|
+
sessionId,
|
|
201
|
+
finalStatus: result.finalStatus,
|
|
202
|
+
terminationReason: result.terminationReason,
|
|
203
|
+
iterationsCompleted: result.iterationsCompleted,
|
|
204
|
+
repoSource: result.session.poc?.repoSource ?? 'local',
|
|
205
|
+
repoUrl: result.session.poc?.repoUrl,
|
|
206
|
+
repoPath: result.session.poc?.repoPath ?? outputDir,
|
|
207
|
+
outputDir: result.outputDir,
|
|
208
|
+
};
|
|
209
|
+
process.stdout.write(JSON.stringify(output) + '\n');
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
const repoInfo = result.session.poc?.repoUrl
|
|
213
|
+
? `Repository URL: ${result.session.poc.repoUrl}`
|
|
214
|
+
: `Repository Path: ${result.session.poc?.repoPath ?? outputDir}`;
|
|
215
|
+
io.write([
|
|
216
|
+
'',
|
|
217
|
+
`PoC Generation Complete`,
|
|
218
|
+
`──────────────────────`,
|
|
219
|
+
`Status: ${result.finalStatus}`,
|
|
220
|
+
`Reason: ${result.terminationReason}`,
|
|
221
|
+
`Iterations: ${result.iterationsCompleted}`,
|
|
222
|
+
repoInfo,
|
|
223
|
+
'',
|
|
224
|
+
].join('\n'));
|
|
225
|
+
if (result.finalStatus !== 'success') {
|
|
226
|
+
io.write([
|
|
227
|
+
'Recovery options:',
|
|
228
|
+
` • Resume: sofia dev --session ${sessionId}`,
|
|
229
|
+
` • More iterations: sofia dev --session ${sessionId} --max-iterations 20`,
|
|
230
|
+
` • More iterations: sofia dev --session ${sessionId} --max-iterations 30`,
|
|
231
|
+
` • Start fresh: sofia dev --session ${sessionId} --force`,
|
|
232
|
+
'',
|
|
233
|
+
].join('\n'));
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
// Exit code based on final status
|
|
237
|
+
if (result.finalStatus === 'failed') {
|
|
238
|
+
process.exitCode = 1;
|
|
239
|
+
}
|
|
240
|
+
}
|