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,328 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for WorkshopSession Zod schemas.
|
|
3
|
+
*
|
|
4
|
+
* Validates that the session data model matches the spec in data-model.md
|
|
5
|
+
* and the contract in contracts/session-json.md.
|
|
6
|
+
*/
|
|
7
|
+
import { describe, it, expect } from 'vitest';
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
Phase,
|
|
11
|
+
SessionStatus,
|
|
12
|
+
workshopSessionSchema,
|
|
13
|
+
type WorkshopSession,
|
|
14
|
+
} from '../../../src/shared/schemas/session.js';
|
|
15
|
+
|
|
16
|
+
// ── Helpers ──────────────────────────────────────────────────────────────────
|
|
17
|
+
|
|
18
|
+
function validSession(overrides: Partial<WorkshopSession> = {}): unknown {
|
|
19
|
+
return {
|
|
20
|
+
sessionId: 'test-001',
|
|
21
|
+
schemaVersion: '1',
|
|
22
|
+
createdAt: '2026-01-01T00:00:00Z',
|
|
23
|
+
updatedAt: '2026-01-01T00:00:00Z',
|
|
24
|
+
phase: 'Discover',
|
|
25
|
+
status: 'Active',
|
|
26
|
+
participants: [],
|
|
27
|
+
artifacts: { generatedFiles: [] },
|
|
28
|
+
...overrides,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// ── Phase enum ───────────────────────────────────────────────────────────────
|
|
33
|
+
|
|
34
|
+
describe('Phase', () => {
|
|
35
|
+
it('contains all seven governed phases', () => {
|
|
36
|
+
const expected = [
|
|
37
|
+
'Discover',
|
|
38
|
+
'Ideate',
|
|
39
|
+
'Design',
|
|
40
|
+
'Select',
|
|
41
|
+
'Plan',
|
|
42
|
+
'Develop',
|
|
43
|
+
'Complete',
|
|
44
|
+
];
|
|
45
|
+
expect(Phase).toEqual(expected);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// ── SessionStatus enum ───────────────────────────────────────────────────────
|
|
50
|
+
|
|
51
|
+
describe('SessionStatus', () => {
|
|
52
|
+
it('contains Active, Paused, Completed, Errored', () => {
|
|
53
|
+
expect(SessionStatus).toEqual(['Active', 'Paused', 'Completed', 'Errored']);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// ── workshopSessionSchema ────────────────────────────────────────────────────
|
|
58
|
+
|
|
59
|
+
describe('workshopSessionSchema', () => {
|
|
60
|
+
it('parses a minimal valid session', () => {
|
|
61
|
+
const result = workshopSessionSchema.parse(validSession());
|
|
62
|
+
expect(result.sessionId).toBe('test-001');
|
|
63
|
+
expect(result.phase).toBe('Discover');
|
|
64
|
+
expect(result.status).toBe('Active');
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('rejects missing required field sessionId', () => {
|
|
68
|
+
const data = validSession();
|
|
69
|
+
delete (data as Record<string, unknown>).sessionId;
|
|
70
|
+
expect(() => workshopSessionSchema.parse(data)).toThrow();
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('rejects invalid phase value', () => {
|
|
74
|
+
expect(() =>
|
|
75
|
+
workshopSessionSchema.parse(validSession({ phase: 'InvalidPhase' as (typeof Phase)[number] })),
|
|
76
|
+
).toThrow();
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it('rejects invalid status value', () => {
|
|
80
|
+
expect(() =>
|
|
81
|
+
workshopSessionSchema.parse(validSession({ status: 'Nope' as (typeof SessionStatus)[number] })),
|
|
82
|
+
).toThrow();
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it('accepts optional entity fields', () => {
|
|
86
|
+
const result = workshopSessionSchema.parse(
|
|
87
|
+
validSession({
|
|
88
|
+
businessContext: {
|
|
89
|
+
businessDescription: 'A retail company',
|
|
90
|
+
challenges: ['inventory tracking'],
|
|
91
|
+
},
|
|
92
|
+
topic: { topicArea: 'Supply Chain' },
|
|
93
|
+
}),
|
|
94
|
+
);
|
|
95
|
+
expect(result.businessContext?.businessDescription).toBe('A retail company');
|
|
96
|
+
expect(result.topic?.topicArea).toBe('Supply Chain');
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('preserves unknown extra fields (forward compat)', () => {
|
|
100
|
+
const base = validSession() as Record<string, unknown>;
|
|
101
|
+
base.futureField = 'hello';
|
|
102
|
+
const result = workshopSessionSchema.parse(base);
|
|
103
|
+
// Zod passthrough should keep the extra field
|
|
104
|
+
expect((result as Record<string, unknown>).futureField).toBe('hello');
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it('handles a full session with ideas and evaluation', () => {
|
|
108
|
+
const result = workshopSessionSchema.parse(
|
|
109
|
+
validSession({
|
|
110
|
+
ideas: [
|
|
111
|
+
{
|
|
112
|
+
id: 'idea-1',
|
|
113
|
+
title: 'Smart Onboarding',
|
|
114
|
+
description: 'AI-guided onboarding',
|
|
115
|
+
workflowStepIds: ['step-1'],
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
evaluation: {
|
|
119
|
+
ideas: [
|
|
120
|
+
{
|
|
121
|
+
ideaId: 'idea-1',
|
|
122
|
+
feasibility: 4,
|
|
123
|
+
value: 5,
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
method: 'feasibility-value-matrix',
|
|
127
|
+
},
|
|
128
|
+
}),
|
|
129
|
+
);
|
|
130
|
+
expect(result.ideas).toHaveLength(1);
|
|
131
|
+
expect(result.evaluation?.method).toBe('feasibility-value-matrix');
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
it('validates participant roles', () => {
|
|
135
|
+
const result = workshopSessionSchema.parse(
|
|
136
|
+
validSession({
|
|
137
|
+
participants: [
|
|
138
|
+
{ id: 'p1', displayName: 'Alice', role: 'Facilitator' },
|
|
139
|
+
{ id: 'p2', displayName: 'Bob', role: 'Attendee' },
|
|
140
|
+
],
|
|
141
|
+
}),
|
|
142
|
+
);
|
|
143
|
+
expect(result.participants).toHaveLength(2);
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
it('rejects invalid participant role', () => {
|
|
147
|
+
expect(() =>
|
|
148
|
+
workshopSessionSchema.parse(
|
|
149
|
+
validSession({
|
|
150
|
+
participants: [{ id: 'p1', displayName: 'Alice', role: 'Admin' as 'Facilitator' }],
|
|
151
|
+
}),
|
|
152
|
+
),
|
|
153
|
+
).toThrow();
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
it('validates ConversationTurn array in turns', () => {
|
|
157
|
+
const result = workshopSessionSchema.parse(
|
|
158
|
+
validSession({
|
|
159
|
+
turns: [
|
|
160
|
+
{
|
|
161
|
+
phase: 'Discover',
|
|
162
|
+
sequence: 1,
|
|
163
|
+
role: 'user',
|
|
164
|
+
content: 'We are a retail company',
|
|
165
|
+
timestamp: '2026-01-01T00:01:00Z',
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
phase: 'Discover',
|
|
169
|
+
sequence: 2,
|
|
170
|
+
role: 'assistant',
|
|
171
|
+
content: 'Got it! Tell me more about your challenges.',
|
|
172
|
+
timestamp: '2026-01-01T00:02:00Z',
|
|
173
|
+
},
|
|
174
|
+
],
|
|
175
|
+
}),
|
|
176
|
+
);
|
|
177
|
+
expect(result.turns).toHaveLength(2);
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
it('validates ArtifactIndex with generated files', () => {
|
|
181
|
+
const result = workshopSessionSchema.parse(
|
|
182
|
+
validSession({
|
|
183
|
+
artifacts: {
|
|
184
|
+
exportDir: './exports/test-001/',
|
|
185
|
+
generatedFiles: [
|
|
186
|
+
{
|
|
187
|
+
relativePath: 'discover.md',
|
|
188
|
+
type: 'markdown',
|
|
189
|
+
createdAt: '2026-01-01T00:05:00Z',
|
|
190
|
+
},
|
|
191
|
+
],
|
|
192
|
+
},
|
|
193
|
+
}),
|
|
194
|
+
);
|
|
195
|
+
expect(result.artifacts.generatedFiles).toHaveLength(1);
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
it('validates PocDevelopmentState', () => {
|
|
199
|
+
const result = workshopSessionSchema.parse(
|
|
200
|
+
validSession({
|
|
201
|
+
poc: {
|
|
202
|
+
repoSource: 'local',
|
|
203
|
+
iterations: [],
|
|
204
|
+
},
|
|
205
|
+
}),
|
|
206
|
+
);
|
|
207
|
+
expect(result.poc?.iterations).toEqual([]);
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
it('validates ImplementationPlan with milestones', () => {
|
|
211
|
+
const result = workshopSessionSchema.parse(
|
|
212
|
+
validSession({
|
|
213
|
+
plan: {
|
|
214
|
+
milestones: [
|
|
215
|
+
{ id: 'm1', title: 'Phase 1', items: ['Setup', 'Build'] },
|
|
216
|
+
],
|
|
217
|
+
},
|
|
218
|
+
}),
|
|
219
|
+
);
|
|
220
|
+
expect(result.plan?.milestones).toHaveLength(1);
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
it('validates BXT evaluation with classification', () => {
|
|
224
|
+
const result = workshopSessionSchema.parse(
|
|
225
|
+
validSession({
|
|
226
|
+
evaluation: {
|
|
227
|
+
ideas: [
|
|
228
|
+
{
|
|
229
|
+
ideaId: 'idea-1',
|
|
230
|
+
feasibility: 3,
|
|
231
|
+
value: 4,
|
|
232
|
+
risks: ['Data quality'],
|
|
233
|
+
dataNeeded: ['CRM data'],
|
|
234
|
+
humanValue: ['Time savings'],
|
|
235
|
+
kpisInfluenced: ['CSAT'],
|
|
236
|
+
},
|
|
237
|
+
],
|
|
238
|
+
method: 'feasibility-value-matrix',
|
|
239
|
+
},
|
|
240
|
+
}),
|
|
241
|
+
);
|
|
242
|
+
expect(result.evaluation?.ideas[0].risks).toContain('Data quality');
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
it('validates SelectedIdea', () => {
|
|
246
|
+
const result = workshopSessionSchema.parse(
|
|
247
|
+
validSession({
|
|
248
|
+
selection: {
|
|
249
|
+
ideaId: 'idea-1',
|
|
250
|
+
selectionRationale: 'Highest BXT score',
|
|
251
|
+
confirmedByUser: true,
|
|
252
|
+
confirmedAt: '2026-01-01T01:00:00Z',
|
|
253
|
+
},
|
|
254
|
+
}),
|
|
255
|
+
);
|
|
256
|
+
expect(result.selection?.confirmedByUser).toBe(true);
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
it('validates WorkflowMap with steps and edges', () => {
|
|
260
|
+
const result = workshopSessionSchema.parse(
|
|
261
|
+
validSession({
|
|
262
|
+
workflow: {
|
|
263
|
+
activities: [
|
|
264
|
+
{ id: 'step-1', name: 'Receive Order' },
|
|
265
|
+
{ id: 'step-2', name: 'Process Payment' },
|
|
266
|
+
],
|
|
267
|
+
edges: [{ fromStepId: 'step-1', toStepId: 'step-2' }],
|
|
268
|
+
},
|
|
269
|
+
}),
|
|
270
|
+
);
|
|
271
|
+
expect(result.workflow?.activities).toHaveLength(2);
|
|
272
|
+
expect(result.workflow?.edges).toHaveLength(1);
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
it('validates CardSelection', () => {
|
|
276
|
+
const result = workshopSessionSchema.parse(
|
|
277
|
+
validSession({
|
|
278
|
+
cards: {
|
|
279
|
+
selectedCards: [
|
|
280
|
+
{ id: 'extract-information', title: 'Extract Information' },
|
|
281
|
+
],
|
|
282
|
+
scores: [
|
|
283
|
+
{
|
|
284
|
+
cardId: 'extract-information',
|
|
285
|
+
dimensions: { relevance: 5, feasibility: 3 },
|
|
286
|
+
},
|
|
287
|
+
],
|
|
288
|
+
},
|
|
289
|
+
}),
|
|
290
|
+
);
|
|
291
|
+
expect(result.cards?.selectedCards).toHaveLength(1);
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
// ── T061: name field tests ─────────────────────────────────────────────────
|
|
295
|
+
|
|
296
|
+
it('accepts optional name field as string', () => {
|
|
297
|
+
const result = workshopSessionSchema.parse(
|
|
298
|
+
validSession({ name: 'Logistics AI Routing' }),
|
|
299
|
+
);
|
|
300
|
+
expect((result as Record<string, unknown>).name).toBe('Logistics AI Routing');
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
it('omits name field gracefully when not provided', () => {
|
|
304
|
+
const result = workshopSessionSchema.parse(validSession());
|
|
305
|
+
expect((result as Record<string, unknown>).name).toBeUndefined();
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
it('rejects non-string name field', () => {
|
|
309
|
+
expect(() =>
|
|
310
|
+
workshopSessionSchema.parse(validSession({ name: 42 as unknown as string })),
|
|
311
|
+
).toThrow();
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
it('validates ErrorRecord array', () => {
|
|
315
|
+
const result = workshopSessionSchema.parse(
|
|
316
|
+
validSession({
|
|
317
|
+
errors: [
|
|
318
|
+
{
|
|
319
|
+
timestamp: '2026-01-01T00:10:00Z',
|
|
320
|
+
code: 'MCP_TIMEOUT',
|
|
321
|
+
message: 'WorkIQ timed out after 30s',
|
|
322
|
+
},
|
|
323
|
+
],
|
|
324
|
+
}),
|
|
325
|
+
);
|
|
326
|
+
expect(result.errors).toHaveLength(1);
|
|
327
|
+
});
|
|
328
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for export path helpers.
|
|
3
|
+
*/
|
|
4
|
+
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
5
|
+
import { mkdtemp, rm, stat } from 'node:fs/promises';
|
|
6
|
+
import { join } from 'node:path';
|
|
7
|
+
import { tmpdir } from 'node:os';
|
|
8
|
+
|
|
9
|
+
import { getExportDir, ensureExportDir } from '../../../src/sessions/exportPaths.js';
|
|
10
|
+
|
|
11
|
+
describe('exportPaths', () => {
|
|
12
|
+
let tmpDir: string;
|
|
13
|
+
|
|
14
|
+
beforeEach(async () => {
|
|
15
|
+
tmpDir = await mkdtemp(join(tmpdir(), 'sofia-export-test-'));
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
afterEach(async () => {
|
|
19
|
+
await rm(tmpDir, { recursive: true, force: true });
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('getExportDir returns correct path', () => {
|
|
23
|
+
const dir = getExportDir('sess-42', tmpDir);
|
|
24
|
+
expect(dir).toBe(join(tmpDir, 'sess-42'));
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('ensureExportDir creates the directory', async () => {
|
|
28
|
+
const dir = await ensureExportDir('sess-42', tmpDir);
|
|
29
|
+
const stats = await stat(dir);
|
|
30
|
+
expect(stats.isDirectory()).toBe(true);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('ensureExportDir is idempotent', async () => {
|
|
34
|
+
await ensureExportDir('sess-42', tmpDir);
|
|
35
|
+
const dir = await ensureExportDir('sess-42', tmpDir);
|
|
36
|
+
expect(dir).toBe(join(tmpDir, 'sess-42'));
|
|
37
|
+
});
|
|
38
|
+
});
|