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,207 @@
|
|
|
1
|
+
# CLI Usage
|
|
2
|
+
|
|
3
|
+
## Binary
|
|
4
|
+
|
|
5
|
+
The CLI is invoked via `npm run start --` (development) or `sofia` (after building and linking).
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Development mode (tsx, no watch)
|
|
9
|
+
npm run start -- <command> [options]
|
|
10
|
+
|
|
11
|
+
# Watch mode (auto-reloads on file changes)
|
|
12
|
+
npm run dev -- <command> [options]
|
|
13
|
+
|
|
14
|
+
# Built mode (requires `npm run build` first)
|
|
15
|
+
npm run sofia -- <command> [options]
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Global Options
|
|
19
|
+
|
|
20
|
+
| Flag | Description |
|
|
21
|
+
| ------------------- | ------------------------------------------------------------------- |
|
|
22
|
+
| `--version` | Print version and exit |
|
|
23
|
+
| `--help` | Print help and exit |
|
|
24
|
+
| `--session <id>` | Target a specific session by ID |
|
|
25
|
+
| `--json` | Machine-readable JSON output only on stdout |
|
|
26
|
+
| `--debug` | Enable debug telemetry |
|
|
27
|
+
| `--log-file <path>` | Write structured logs to the specified file |
|
|
28
|
+
| `--non-interactive` | Disallow prompts; fail with an actionable error if input is missing |
|
|
29
|
+
|
|
30
|
+
## Commands
|
|
31
|
+
|
|
32
|
+
### `workshop`
|
|
33
|
+
|
|
34
|
+
Start or resume a governed AI Discovery Workshop session.
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# Interactive: shows a menu to start new or resume existing session
|
|
38
|
+
npm run start -- workshop
|
|
39
|
+
|
|
40
|
+
# Start a new session directly
|
|
41
|
+
npm run start -- workshop --new-session
|
|
42
|
+
|
|
43
|
+
# Direct command mode: run a specific phase on an existing session
|
|
44
|
+
npm run start -- workshop --session <id> --phase Discover
|
|
45
|
+
|
|
46
|
+
# With retry for transient failures
|
|
47
|
+
npm run start -- workshop --session <id> --phase Ideate --retry 3
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Workshop-specific flags:**
|
|
51
|
+
|
|
52
|
+
| Flag | Description |
|
|
53
|
+
| ----------------- | ------------------------------------------------------ |
|
|
54
|
+
| `--new-session` | Skip menu and start a new session |
|
|
55
|
+
| `--phase <phase>` | Jump to a specific phase (requires `--session`) |
|
|
56
|
+
| `--retry <count>` | Retry transient failures N times (direct command mode) |
|
|
57
|
+
|
|
58
|
+
**Phases** (in order): `Discover`, `Ideate`, `Design`, `Select`, `Plan`, `Develop`
|
|
59
|
+
|
|
60
|
+
**Direct command mode** is activated when both `--session` and `--phase` are specified. In this mode:
|
|
61
|
+
|
|
62
|
+
- The workshop runs the specified phase without the interactive menu
|
|
63
|
+
- Supports `--non-interactive` for automation (fails fast if input is missing)
|
|
64
|
+
- Supports `--retry` to retry recoverable errors with exponential backoff
|
|
65
|
+
- `--json` constrains stdout to JSON-only (activity goes to stderr)
|
|
66
|
+
|
|
67
|
+
### `status`
|
|
68
|
+
|
|
69
|
+
Display session status and next expected action.
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# Human-readable table
|
|
73
|
+
npm run start -- status
|
|
74
|
+
|
|
75
|
+
# JSON output for a specific session
|
|
76
|
+
npm run start -- status --session <id> --json
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Output formats:**
|
|
80
|
+
|
|
81
|
+
- **TTY (human):** A table showing session ID, current phase, status, and last update time
|
|
82
|
+
- **JSON mode:** `{ "sessions": [{ "sessionId", "phase", "status", "updatedAt" }] }` or `{ "session": { ... } }` for a single session
|
|
83
|
+
|
|
84
|
+
### `dev`
|
|
85
|
+
|
|
86
|
+
Run the **Develop** phase for a completed workshop session. Generates a proof-of-concept (PoC) repository using a Ralph loop — an autonomous, iterative cycle where code is generated, tests run, failures fed back to the LLM, and fixes applied until tests pass or the iteration limit is reached.
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Generate a PoC from a completed session (uses most recent session by default)
|
|
90
|
+
npm run start -- dev
|
|
91
|
+
|
|
92
|
+
# Target a specific session
|
|
93
|
+
npm run start -- dev --session <id>
|
|
94
|
+
|
|
95
|
+
# Limit iterations and specify output directory
|
|
96
|
+
npm run start -- dev --session <id> --max-iterations 5 --output ./my-poc
|
|
97
|
+
|
|
98
|
+
# Overwrite existing output and start fresh
|
|
99
|
+
npm run start -- dev --session <id> --force
|
|
100
|
+
|
|
101
|
+
# Machine-readable JSON output
|
|
102
|
+
npm run start -- dev --session <id> --json
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**Dev-specific flags:**
|
|
106
|
+
|
|
107
|
+
| Flag | Description |
|
|
108
|
+
| ---------------------- | ------------------------------------------------------------ |
|
|
109
|
+
| `--session <id>` | Session ID (defaults to most recent session) |
|
|
110
|
+
| `--max-iterations <n>` | Maximum Ralph loop iterations (default: 10) |
|
|
111
|
+
| `--output <dir>` | Output directory for the PoC (default: `./poc/<sessionId>/`) |
|
|
112
|
+
| `--force` | Overwrite existing output directory and start fresh |
|
|
113
|
+
| `--json` | Machine-readable JSON output |
|
|
114
|
+
| `--debug` | Show iteration events during execution |
|
|
115
|
+
|
|
116
|
+
**Lifecycle:**
|
|
117
|
+
|
|
118
|
+
1. **Validate** — Checks the session has `selection` and `plan` populated (from Select and Plan phases)
|
|
119
|
+
2. **Scaffold** — Creates the initial PoC project structure (README, package.json, tsconfig.json, tests, etc.)
|
|
120
|
+
3. **Install** — Runs `npm install` in the PoC directory
|
|
121
|
+
4. **Iterate** — Runs tests → feeds failures to LLM → applies code changes → repeats
|
|
122
|
+
5. **Terminate** — Stops when tests pass, max iterations reached, or user presses Ctrl+C
|
|
123
|
+
|
|
124
|
+
**GitHub MCP integration:**
|
|
125
|
+
When GitHub MCP is available and authorized, the PoC is also pushed to a GitHub repository. When unavailable, it falls back to local-only output with a clear log message.
|
|
126
|
+
|
|
127
|
+
**JSON output format** (with `--json`):
|
|
128
|
+
|
|
129
|
+
```json
|
|
130
|
+
{
|
|
131
|
+
"sessionId": "abc123",
|
|
132
|
+
"finalStatus": "success",
|
|
133
|
+
"terminationReason": "tests-passing",
|
|
134
|
+
"iterationsCompleted": 4,
|
|
135
|
+
"repoSource": "local",
|
|
136
|
+
"repoPath": "./poc/abc123/",
|
|
137
|
+
"outputDir": "/absolute/path/to/poc/abc123"
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
**Recovery options** (shown on non-success outcomes):
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# Resume from where you left off
|
|
145
|
+
sofia dev --session <id>
|
|
146
|
+
|
|
147
|
+
# Allow more iterations
|
|
148
|
+
sofia dev --session <id> --max-iterations 20
|
|
149
|
+
|
|
150
|
+
# Start fresh
|
|
151
|
+
sofia dev --session <id> --force
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### `export`
|
|
155
|
+
|
|
156
|
+
Export workshop artifacts for a session.
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
# Export to default directory (./exports/<sessionId>/)
|
|
160
|
+
npm run start -- export --session <id>
|
|
161
|
+
|
|
162
|
+
# Export to a custom directory
|
|
163
|
+
npm run start -- export --session <id> --output ./my-export/
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**Export-specific flags:**
|
|
167
|
+
|
|
168
|
+
| Flag | Description |
|
|
169
|
+
| ---------------- | ----------------------------------------------------------- |
|
|
170
|
+
| `--output <dir>` | Custom output directory (default: `./exports/<sessionId>/`) |
|
|
171
|
+
|
|
172
|
+
## Exit Codes
|
|
173
|
+
|
|
174
|
+
| Code | Meaning |
|
|
175
|
+
| ---- | ------------------------------------------------------ |
|
|
176
|
+
| `0` | Success |
|
|
177
|
+
| `1` | General error (invalid input, session not found, etc.) |
|
|
178
|
+
|
|
179
|
+
In JSON mode, errors are emitted as JSON objects with a consistent envelope:
|
|
180
|
+
|
|
181
|
+
```json
|
|
182
|
+
{
|
|
183
|
+
"error": {
|
|
184
|
+
"code": "SESSION_NOT_FOUND",
|
|
185
|
+
"message": "Session \"abc\" not found."
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## Examples
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
# Full interactive workshop flow
|
|
194
|
+
npm run start -- workshop
|
|
195
|
+
|
|
196
|
+
# Automation: run Ideate phase, JSON output, no prompts
|
|
197
|
+
npm run start -- workshop --session abc123 --phase Ideate --json --non-interactive
|
|
198
|
+
|
|
199
|
+
# Check what phase a session is on
|
|
200
|
+
npm run start -- status --session abc123 --json
|
|
201
|
+
|
|
202
|
+
# Export artifacts after completing a workshop
|
|
203
|
+
npm run start -- export --session abc123
|
|
204
|
+
|
|
205
|
+
# Enable debug logging to file
|
|
206
|
+
npm run start -- workshop --debug --log-file .sofia/logs/dev.log
|
|
207
|
+
```
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Environment Variables
|
|
2
|
+
|
|
3
|
+
sofIA uses environment variables for optional integrations. All are optional — the CLI degrades gracefully when they are absent.
|
|
4
|
+
|
|
5
|
+
## Web Search (Azure AI Foundry)
|
|
6
|
+
|
|
7
|
+
| Variable | Description |
|
|
8
|
+
| ------------------------------- | ----------------------------------------------------------------------------------------------------------- |
|
|
9
|
+
| `FOUNDRY_PROJECT_ENDPOINT` | Azure AI Foundry project endpoint URL (e.g., `https://<name>.services.ai.azure.com/api/projects/<project>`) |
|
|
10
|
+
| `FOUNDRY_MODEL_DEPLOYMENT_NAME` | Model deployment name for the web search agent (e.g., `gpt-4.1-mini`) |
|
|
11
|
+
|
|
12
|
+
Both must be set for the `web.search` tool to be available. When not configured, the web search tool is disabled and the workshop proceeds without web search capabilities.
|
|
13
|
+
|
|
14
|
+
**Authentication:** sofIA authenticates to the Azure AI Foundry Agent Service using `DefaultAzureCredential` from `@azure/identity`. No API key is required — ensure you are logged in via `az login` or have another credential available (Managed Identity, environment variables, etc.).
|
|
15
|
+
|
|
16
|
+
### Migrating from Legacy Configuration
|
|
17
|
+
|
|
18
|
+
If you previously used `SOFIA_FOUNDRY_AGENT_ENDPOINT` / `SOFIA_FOUNDRY_AGENT_KEY`:
|
|
19
|
+
|
|
20
|
+
1. **Remove** the old variables from your environment
|
|
21
|
+
2. **Set** the new variables (`FOUNDRY_PROJECT_ENDPOINT`, `FOUNDRY_MODEL_DEPLOYMENT_NAME`)
|
|
22
|
+
3. **Ensure** you are logged in via `az login`
|
|
23
|
+
|
|
24
|
+
The CLI will display an error if it detects the old variables, guiding you through the migration.
|
|
25
|
+
|
|
26
|
+
> **Note**: `SOFIA_FOUNDRY_AGENT_ENDPOINT` and `SOFIA_FOUNDRY_AGENT_KEY` are no longer used. API key authentication has been replaced by Azure Identity credentials.
|
|
27
|
+
|
|
28
|
+
## Testing
|
|
29
|
+
|
|
30
|
+
| Variable | Description |
|
|
31
|
+
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
32
|
+
| `SOFIA_LIVE_MCP_TESTS` | Set to `true` to enable end-to-end tests that require real MCP server access and external API calls (e.g., web search). Default: `false` |
|
|
33
|
+
|
|
34
|
+
These tests are skipped by default because they:
|
|
35
|
+
|
|
36
|
+
- Require external service credentials
|
|
37
|
+
- May incur API costs
|
|
38
|
+
- Have longer execution times
|
|
39
|
+
- Depend on live network access
|
|
40
|
+
|
|
41
|
+
To run live tests:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
export SOFIA_LIVE_MCP_TESTS=true
|
|
45
|
+
npm test # or npm run test:e2e
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Copilot SDK
|
|
49
|
+
|
|
50
|
+
The `@github/copilot-sdk` reads its own environment variables for authentication. Refer to the [Copilot SDK documentation](https://github.com/github/copilot-sdk) for details.
|
|
51
|
+
|
|
52
|
+
## Logger Redaction
|
|
53
|
+
|
|
54
|
+
The following field names are automatically redacted in structured logs:
|
|
55
|
+
|
|
56
|
+
- `password`
|
|
57
|
+
- `token`
|
|
58
|
+
- `secret`
|
|
59
|
+
- `apiKey`
|
|
60
|
+
- `api_key`
|
|
61
|
+
- `authorization`
|
|
62
|
+
- `auth`
|
|
63
|
+
- `credential`
|
|
64
|
+
- `credentials`
|
|
65
|
+
|
|
66
|
+
Any log entry containing these field names will have their values replaced with `[REDACTED]`.
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# Export Format
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The `sofia export` command generates customer-ready artifacts from a workshop session. Exports include per-phase Markdown files and a machine-readable `summary.json`.
|
|
6
|
+
|
|
7
|
+
## Output Directory
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
exports/<sessionId>/
|
|
11
|
+
├── summary.json
|
|
12
|
+
├── discover.md
|
|
13
|
+
├── ideate.md
|
|
14
|
+
├── design.md
|
|
15
|
+
├── select.md
|
|
16
|
+
├── plan.md
|
|
17
|
+
└── develop.md
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Default path: `./exports/<sessionId>/`
|
|
21
|
+
Override with: `--output <dir>`
|
|
22
|
+
|
|
23
|
+
## summary.json
|
|
24
|
+
|
|
25
|
+
The summary file provides a machine-readable overview of the export.
|
|
26
|
+
|
|
27
|
+
```json
|
|
28
|
+
{
|
|
29
|
+
"sessionId": "ac516a6f-f5ee-4426-9a61-4d5c9c883ba7",
|
|
30
|
+
"exportedAt": "2026-02-27T10:30:00.000Z",
|
|
31
|
+
"phase": "Plan",
|
|
32
|
+
"status": "Active",
|
|
33
|
+
"files": [
|
|
34
|
+
{ "path": "discover.md", "type": "markdown" },
|
|
35
|
+
{ "path": "ideate.md", "type": "markdown" },
|
|
36
|
+
{ "path": "design.md", "type": "markdown" },
|
|
37
|
+
{ "path": "select.md", "type": "markdown" },
|
|
38
|
+
{ "path": "plan.md", "type": "markdown" },
|
|
39
|
+
{ "path": "summary.json", "type": "json" }
|
|
40
|
+
],
|
|
41
|
+
"highlights": [
|
|
42
|
+
"Business: Contoso Ltd — supply chain optimization",
|
|
43
|
+
"Selected idea: AI-powered demand forecasting",
|
|
44
|
+
"Plan: 3 milestones over 8 weeks"
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Fields
|
|
50
|
+
|
|
51
|
+
| Field | Type | Description |
|
|
52
|
+
| ------------ | --------------------- | ------------------------------------------------------ |
|
|
53
|
+
| `sessionId` | `string` | Session identifier |
|
|
54
|
+
| `exportedAt` | `string` | ISO-8601 timestamp of export |
|
|
55
|
+
| `phase` | `string` | Session phase at time of export |
|
|
56
|
+
| `status` | `string` | Session status at time of export |
|
|
57
|
+
| `files` | `Array<{path, type}>` | List of generated files (paths relative to export dir) |
|
|
58
|
+
| `highlights` | `string[]?` | Optional key takeaways from the session |
|
|
59
|
+
|
|
60
|
+
## Phase Markdown Files
|
|
61
|
+
|
|
62
|
+
Each completed phase generates a Markdown file with phase-specific content:
|
|
63
|
+
|
|
64
|
+
| File | Contents |
|
|
65
|
+
| ------------- | -------------------------------------------------------------- |
|
|
66
|
+
| `discover.md` | Business description, challenges, constraints, topic selection |
|
|
67
|
+
| `ideate.md` | Activities, workflow map, selected AI Envisioning Cards |
|
|
68
|
+
| `design.md` | Idea Cards with descriptions and architecture sketches |
|
|
69
|
+
| `select.md` | Evaluation matrix, selected idea, rationale |
|
|
70
|
+
| `plan.md` | Implementation milestones, architecture notes, dependencies |
|
|
71
|
+
| `develop.md` | PoC repository, tech stack, iteration history, test results |
|
|
72
|
+
|
|
73
|
+
Only phases that have been completed (or are in progress) generate Markdown files. If a phase has no data, its file is omitted.
|
|
74
|
+
|
|
75
|
+
### develop.md — Detailed Structure
|
|
76
|
+
|
|
77
|
+
The Develop export is generated from `PocDevelopmentState` and includes:
|
|
78
|
+
|
|
79
|
+
| Section | Content |
|
|
80
|
+
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
81
|
+
| **PoC Repository** | Local path (always local git repository), plus `repoSource` (`local`). Users push manually to GitHub when ready (safer approach). |
|
|
82
|
+
| **Technology Stack** | Language, runtime, test runner, framework (optional), build command (optional) |
|
|
83
|
+
| **Result** | `finalStatus` (`success`, `failed`, `partial`), `terminationReason` (`tests-passing`, `max-iterations`, `user-stopped`, `error`), total duration |
|
|
84
|
+
| **Final Test Results** | Passed/failed/skipped counts, duration, per-failure details (test name, message, expected/actual, file/line) |
|
|
85
|
+
| **Iteration Timeline** | Per-iteration: outcome, duration, changes summary, files changed, test results, error messages |
|
|
86
|
+
|
|
87
|
+
Example structure:
|
|
88
|
+
|
|
89
|
+
```markdown
|
|
90
|
+
# Develop Phase
|
|
91
|
+
|
|
92
|
+
## PoC Repository
|
|
93
|
+
|
|
94
|
+
**Repository Path**: ./poc/abc123/
|
|
95
|
+
**Source**: local
|
|
96
|
+
|
|
97
|
+
## Technology Stack
|
|
98
|
+
|
|
99
|
+
- **Language**: TypeScript
|
|
100
|
+
- **Runtime**: Node.js 20
|
|
101
|
+
- **Test Runner**: vitest
|
|
102
|
+
|
|
103
|
+
## Result
|
|
104
|
+
|
|
105
|
+
**Status**: success
|
|
106
|
+
**Termination Reason**: tests-passing
|
|
107
|
+
**Total Duration**: 45.2s
|
|
108
|
+
|
|
109
|
+
## Final Test Results
|
|
110
|
+
|
|
111
|
+
- **Passed**: 5
|
|
112
|
+
- **Failed**: 0
|
|
113
|
+
- **Skipped**: 0
|
|
114
|
+
- **Total**: 5
|
|
115
|
+
- **Duration**: 1200ms
|
|
116
|
+
|
|
117
|
+
## Iteration Timeline
|
|
118
|
+
|
|
119
|
+
### Iteration 1 — scaffold (2.1s)
|
|
120
|
+
|
|
121
|
+
Initial project scaffolding
|
|
122
|
+
**Files changed**: README.md, package.json, tsconfig.json, ...
|
|
123
|
+
|
|
124
|
+
### Iteration 2 — tests-failing (8.3s)
|
|
125
|
+
|
|
126
|
+
Added core implementation
|
|
127
|
+
**Files changed**: src/index.ts, tests/index.test.ts
|
|
128
|
+
**Tests**: 3 passed, 2 failed, 0 skipped (950ms)
|
|
129
|
+
|
|
130
|
+
### Iteration 3 — tests-passing (12.5s)
|
|
131
|
+
|
|
132
|
+
Fixed validation logic
|
|
133
|
+
**Files changed**: src/index.ts
|
|
134
|
+
**Tests**: 5 passed, 0 failed, 0 skipped (1100ms)
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Safety
|
|
138
|
+
|
|
139
|
+
- No secrets or tokens are included in exports
|
|
140
|
+
- File paths in `summary.json` are relative to the export directory
|
|
141
|
+
- Export is idempotent — re-exporting overwrites previous artifacts
|
|
142
|
+
|
|
143
|
+
## Related
|
|
144
|
+
|
|
145
|
+
- Export contract: [specs/001-cli-workshop-rebuild/contracts/export-summary-json.md](../specs/001-cli-workshop-rebuild/contracts/export-summary-json.md)
|
|
146
|
+
- Export writer source: `src/sessions/exportWriter.ts`
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Session Model
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
A **WorkshopSession** is the central data structure persisted throughout a workshop. It captures all artifacts from each phase and supports resume, backtracking, and export.
|
|
6
|
+
|
|
7
|
+
## Storage
|
|
8
|
+
|
|
9
|
+
- **Path:** `.sofia/sessions/<sessionId>.json`
|
|
10
|
+
- **Format:** UTF-8 JSON, overwritten atomically after every user turn
|
|
11
|
+
- **Schema versioning:** `schemaVersion` field enables forward migration
|
|
12
|
+
|
|
13
|
+
## Session Lifecycle
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
New Session → Active (Discover) → ... → Active (Plan) → Active (Develop) → Completed
|
|
17
|
+
↕ ↕
|
|
18
|
+
Paused Paused
|
|
19
|
+
↕ ↕
|
|
20
|
+
Active Active
|
|
21
|
+
↓ ↓
|
|
22
|
+
Errored Errored
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### States
|
|
26
|
+
|
|
27
|
+
| Status | Description |
|
|
28
|
+
|--------|-------------|
|
|
29
|
+
| `Active` | Session is in progress |
|
|
30
|
+
| `Paused` | Session paused (can resume) |
|
|
31
|
+
| `Completed` | All phases finished |
|
|
32
|
+
| `Errored` | Failed with an error (session is persisted before exit) |
|
|
33
|
+
|
|
34
|
+
## Phases
|
|
35
|
+
|
|
36
|
+
Phases follow a strict linear progression with decision gates:
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
Discover → Ideate → Design → Select → Plan → Develop → Complete
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
| Phase | Purpose | Key Artifacts |
|
|
43
|
+
|-------|---------|---------------|
|
|
44
|
+
| **Discover** | Understand the business, challenges, and context | `businessContext`, `topic` |
|
|
45
|
+
| **Ideate** | Brainstorm activities, explore AI Envisioning Cards | `activities`, `cards` |
|
|
46
|
+
| **Design** | Generate and refine Idea Cards with architecture sketches | `ideas` |
|
|
47
|
+
| **Select** | Evaluate ideas via feasibility/value matrix, pick the best | `evaluation`, `selection` |
|
|
48
|
+
| **Plan** | Create implementation roadmap and milestones | `plan` |
|
|
49
|
+
| **Develop** | Capture PoC requirements and intent (handoff to feature 002) | `poc` |
|
|
50
|
+
|
|
51
|
+
### Decision Gates
|
|
52
|
+
|
|
53
|
+
Phase transitions require explicit user confirmation. The system will **never** auto-advance to the next phase. After each phase completes, the user is prompted with a "Proceed to next phase?" decision gate.
|
|
54
|
+
|
|
55
|
+
### Backtracking
|
|
56
|
+
|
|
57
|
+
Users can backtrack to an earlier phase. When backtracking:
|
|
58
|
+
- All downstream phase artifacts are **invalidated** (marked for recomputation)
|
|
59
|
+
- The session moves to the target phase
|
|
60
|
+
- Invalidated phases must be re-run to regenerate their artifacts
|
|
61
|
+
|
|
62
|
+
## Session Fields
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
interface WorkshopSession {
|
|
66
|
+
sessionId: string; // Stable UUID
|
|
67
|
+
createdAt: string; // ISO-8601
|
|
68
|
+
updatedAt: string; // ISO-8601, monotonically increasing
|
|
69
|
+
schemaVersion: string; // e.g., "1.0.0"
|
|
70
|
+
phase: Phase; // Current phase
|
|
71
|
+
status: SessionStatus; // Active | Paused | Completed | Errored
|
|
72
|
+
participants: Participant[]; // Facilitator, attendees, observers
|
|
73
|
+
businessContext?: BusinessContext;
|
|
74
|
+
topic?: TopicSelection;
|
|
75
|
+
activities?: Activity[];
|
|
76
|
+
workflow?: WorkflowMap;
|
|
77
|
+
cards?: CardSelection;
|
|
78
|
+
ideas?: IdeaCard[];
|
|
79
|
+
evaluation?: IdeaEvaluation;
|
|
80
|
+
selection?: SelectedIdea;
|
|
81
|
+
plan?: ImplementationPlan;
|
|
82
|
+
poc?: PocDevelopmentState;
|
|
83
|
+
artifacts: ArtifactIndex;
|
|
84
|
+
errors?: ErrorRecord[];
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Key Sub-entities
|
|
89
|
+
|
|
90
|
+
| Entity | Purpose |
|
|
91
|
+
|--------|---------|
|
|
92
|
+
| `BusinessContext` | Company description, challenges, constraints, success metrics |
|
|
93
|
+
| `TopicSelection` | Chosen focus area and scope notes |
|
|
94
|
+
| `WorkflowMap` | Steps and edges describing the activity flow |
|
|
95
|
+
| `CardSelection` | Selected AI Envisioning Cards with scores |
|
|
96
|
+
| `IdeaCard` | Generated ideas with title, description, workflow links |
|
|
97
|
+
| `IdeaEvaluation` | Feasibility/value scoring for each idea |
|
|
98
|
+
| `SelectedIdea` | The chosen idea with rationale and user confirmation |
|
|
99
|
+
| `ImplementationPlan` | Milestones, architecture notes, dependencies |
|
|
100
|
+
| `PocDevelopmentState` | PoC repo path, iterations, final status |
|
|
101
|
+
|
|
102
|
+
## Safety
|
|
103
|
+
|
|
104
|
+
- Secrets and tokens are **never** persisted in session JSON
|
|
105
|
+
- Sensitive values from tool responses are redacted before writing
|
|
106
|
+
- The `schemaVersion` field supports future migrations without data loss
|
|
107
|
+
- Unknown fields are preserved when loading/saving (forward compatibility)
|
|
108
|
+
|
|
109
|
+
## Related
|
|
110
|
+
|
|
111
|
+
- Data model spec: [specs/001-cli-workshop-rebuild/data-model.md](../specs/001-cli-workshop-rebuild/data-model.md)
|
|
112
|
+
- Session JSON contract: [specs/001-cli-workshop-rebuild/contracts/session-json.md](../specs/001-cli-workshop-rebuild/contracts/session-json.md)
|
|
113
|
+
- Schema source: `src/shared/schemas/session.ts`
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import eslint from '@eslint/js';
|
|
2
|
+
import tseslint from 'typescript-eslint';
|
|
3
|
+
import prettier from 'eslint-config-prettier';
|
|
4
|
+
import pluginImport from 'eslint-plugin-import';
|
|
5
|
+
|
|
6
|
+
export default tseslint.config(
|
|
7
|
+
{
|
|
8
|
+
ignores: ['node_modules/', 'dist/', 'build/', 'coverage/', '*.min.js', '.sofia/', 'exports/'],
|
|
9
|
+
},
|
|
10
|
+
eslint.configs.recommended,
|
|
11
|
+
tseslint.configs.recommended,
|
|
12
|
+
prettier,
|
|
13
|
+
{
|
|
14
|
+
plugins: {
|
|
15
|
+
import: pluginImport,
|
|
16
|
+
},
|
|
17
|
+
rules: {
|
|
18
|
+
'@typescript-eslint/no-unused-vars': [
|
|
19
|
+
'error',
|
|
20
|
+
{
|
|
21
|
+
argsIgnorePattern: '^_',
|
|
22
|
+
varsIgnorePattern: '^_',
|
|
23
|
+
caughtErrorsIgnorePattern: '^_',
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
'import/order': [
|
|
27
|
+
'warn',
|
|
28
|
+
{
|
|
29
|
+
groups: [['builtin', 'external'], 'internal', ['parent', 'sibling', 'index']],
|
|
30
|
+
'newlines-between': 'always',
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
);
|