specweave 0.21.2 → 0.22.0
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/CLAUDE.md +429 -10
- package/README.md +33 -3
- package/dist/plugins/specweave-github/lib/CodeValidator.d.ts +101 -0
- package/dist/plugins/specweave-github/lib/CodeValidator.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/CodeValidator.js +219 -0
- package/dist/plugins/specweave-github/lib/CodeValidator.js.map +1 -0
- package/dist/plugins/specweave-github/lib/IssueStateManager.d.ts +98 -0
- package/dist/plugins/specweave-github/lib/IssueStateManager.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/IssueStateManager.js +146 -0
- package/dist/plugins/specweave-github/lib/IssueStateManager.js.map +1 -0
- package/dist/plugins/specweave-github/lib/ThreeLayerSyncManager.d.ts +182 -0
- package/dist/plugins/specweave-github/lib/ThreeLayerSyncManager.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/ThreeLayerSyncManager.js +603 -0
- package/dist/plugins/specweave-github/lib/ThreeLayerSyncManager.js.map +1 -0
- package/dist/plugins/specweave-github/lib/types.d.ts +34 -0
- package/dist/plugins/specweave-github/lib/types.d.ts.map +1 -1
- package/dist/plugins/specweave-github/lib/user-story-issue-builder.d.ts.map +1 -1
- package/dist/plugins/specweave-github/lib/user-story-issue-builder.js +6 -0
- package/dist/plugins/specweave-github/lib/user-story-issue-builder.js.map +1 -1
- package/dist/src/cli/commands/check-hooks.d.ts +11 -0
- package/dist/src/cli/commands/check-hooks.d.ts.map +1 -0
- package/dist/src/cli/commands/check-hooks.js +144 -0
- package/dist/src/cli/commands/check-hooks.js.map +1 -0
- package/dist/src/cli/commands/cicd-monitor.js +3 -3
- package/dist/src/cli/commands/cicd-monitor.js.map +1 -1
- package/dist/src/cli/commands/import-docs.js +2 -2
- package/dist/src/cli/commands/import-docs.js.map +1 -1
- package/dist/src/cli/commands/init-multiproject.js +4 -4
- package/dist/src/cli/commands/init-multiproject.js.map +1 -1
- package/dist/src/cli/commands/init.d.ts.map +1 -1
- package/dist/src/cli/commands/init.js +60 -5
- package/dist/src/cli/commands/init.js.map +1 -1
- package/dist/src/cli/commands/migrate-to-multiproject.js +3 -3
- package/dist/src/cli/commands/migrate-to-multiproject.js.map +1 -1
- package/dist/src/cli/commands/plan/agent-invoker.d.ts +79 -0
- package/dist/src/cli/commands/plan/agent-invoker.d.ts.map +1 -0
- package/dist/src/cli/commands/plan/agent-invoker.js +383 -0
- package/dist/src/cli/commands/plan/agent-invoker.js.map +1 -0
- package/dist/src/cli/commands/plan/increment-detector.d.ts +27 -0
- package/dist/src/cli/commands/plan/increment-detector.d.ts.map +1 -0
- package/dist/src/cli/commands/plan/increment-detector.js +159 -0
- package/dist/src/cli/commands/plan/increment-detector.js.map +1 -0
- package/dist/src/cli/commands/plan/plan-orchestrator.d.ts +45 -0
- package/dist/src/cli/commands/plan/plan-orchestrator.d.ts.map +1 -0
- package/dist/src/cli/commands/plan/plan-orchestrator.js +229 -0
- package/dist/src/cli/commands/plan/plan-orchestrator.js.map +1 -0
- package/dist/src/cli/commands/plan/plan-validator.d.ts +36 -0
- package/dist/src/cli/commands/plan/plan-validator.d.ts.map +1 -0
- package/dist/src/cli/commands/plan/plan-validator.js +174 -0
- package/dist/src/cli/commands/plan/plan-validator.js.map +1 -0
- package/dist/src/cli/commands/plan/types.d.ts +170 -0
- package/dist/src/cli/commands/plan/types.d.ts.map +1 -0
- package/dist/src/cli/commands/plan/types.js +42 -0
- package/dist/src/cli/commands/plan/types.js.map +1 -0
- package/dist/src/cli/commands/plan-command.d.ts +16 -0
- package/dist/src/cli/commands/plan-command.d.ts.map +1 -0
- package/dist/src/cli/commands/plan-command.js +127 -0
- package/dist/src/cli/commands/plan-command.js.map +1 -0
- package/dist/src/cli/commands/switch-project.js +3 -3
- package/dist/src/cli/commands/switch-project.js.map +1 -1
- package/dist/src/cli/commands/validate-parent-repo.js +1 -1
- package/dist/src/cli/commands/validate-parent-repo.js.map +1 -1
- package/dist/src/config/ConfigManager.d.ts +69 -0
- package/dist/src/config/ConfigManager.d.ts.map +1 -0
- package/dist/src/config/ConfigManager.js +130 -0
- package/dist/src/config/ConfigManager.js.map +1 -0
- package/dist/src/config/types.d.ts +1357 -0
- package/dist/src/config/types.d.ts.map +1 -0
- package/dist/src/config/types.js +67 -0
- package/dist/src/config/types.js.map +1 -0
- package/dist/src/core/brownfield/importer.d.ts +1 -1
- package/dist/src/core/brownfield/importer.d.ts.map +1 -1
- package/dist/src/core/brownfield/importer.js +3 -3
- package/dist/src/core/brownfield/importer.js.map +1 -1
- package/dist/src/core/cicd/config-loader.d.ts +1 -1
- package/dist/src/core/cicd/config-loader.d.ts.map +1 -1
- package/dist/src/core/cicd/index.d.ts +6 -6
- package/dist/src/core/cicd/index.d.ts.map +1 -1
- package/dist/src/core/cicd/index.js +6 -6
- package/dist/src/core/cicd/index.js.map +1 -1
- package/dist/src/core/cicd/monitor-service.d.ts +3 -3
- package/dist/src/core/cicd/monitor-service.d.ts.map +1 -1
- package/dist/src/core/cicd/monitor-service.js +3 -3
- package/dist/src/core/cicd/monitor-service.js.map +1 -1
- package/dist/src/core/cicd/notifier.d.ts +1 -1
- package/dist/src/core/cicd/notifier.d.ts.map +1 -1
- package/dist/src/core/cicd/state-manager.d.ts +1 -1
- package/dist/src/core/cicd/state-manager.d.ts.map +1 -1
- package/dist/src/core/cicd/state-manager.js +1 -1
- package/dist/src/core/cicd/state-manager.js.map +1 -1
- package/dist/src/core/cicd/workflow-monitor.d.ts +1 -1
- package/dist/src/core/cicd/workflow-monitor.d.ts.map +1 -1
- package/dist/src/core/cicd/workflow-monitor.js +1 -1
- package/dist/src/core/cicd/workflow-monitor.js.map +1 -1
- package/dist/src/core/cost-tracker.d.ts +2 -2
- package/dist/src/core/cost-tracker.d.ts.map +1 -1
- package/dist/src/core/cost-tracker.js +1 -1
- package/dist/src/core/cost-tracker.js.map +1 -1
- package/dist/src/core/hooks/HealthReporter.d.ts +55 -0
- package/dist/src/core/hooks/HealthReporter.d.ts.map +1 -0
- package/dist/src/core/hooks/HealthReporter.js +268 -0
- package/dist/src/core/hooks/HealthReporter.js.map +1 -0
- package/dist/src/core/hooks/HookAutoFixer.d.ts +41 -0
- package/dist/src/core/hooks/HookAutoFixer.d.ts.map +1 -0
- package/dist/src/core/hooks/HookAutoFixer.js +222 -0
- package/dist/src/core/hooks/HookAutoFixer.js.map +1 -0
- package/dist/src/core/hooks/HookExecutor.d.ts +57 -0
- package/dist/src/core/hooks/HookExecutor.d.ts.map +1 -0
- package/dist/src/core/hooks/HookExecutor.js +287 -0
- package/dist/src/core/hooks/HookExecutor.js.map +1 -0
- package/dist/src/core/hooks/HookHealthChecker.d.ts +51 -0
- package/dist/src/core/hooks/HookHealthChecker.d.ts.map +1 -0
- package/dist/src/core/hooks/HookHealthChecker.js +212 -0
- package/dist/src/core/hooks/HookHealthChecker.js.map +1 -0
- package/dist/src/core/hooks/HookScanner.d.ts +65 -0
- package/dist/src/core/hooks/HookScanner.d.ts.map +1 -0
- package/dist/src/core/hooks/HookScanner.js +214 -0
- package/dist/src/core/hooks/HookScanner.js.map +1 -0
- package/dist/src/core/hooks/types.d.ts +281 -0
- package/dist/src/core/hooks/types.d.ts.map +1 -0
- package/dist/src/core/hooks/types.js +10 -0
- package/dist/src/core/hooks/types.js.map +1 -0
- package/dist/src/core/iac/index.d.ts +10 -0
- package/dist/src/core/iac/index.d.ts.map +1 -0
- package/dist/src/core/iac/index.js +11 -0
- package/dist/src/core/iac/index.js.map +1 -0
- package/dist/src/core/iac/template-engine.d.ts +77 -0
- package/dist/src/core/iac/template-engine.d.ts.map +1 -0
- package/dist/src/core/iac/template-engine.js +182 -0
- package/dist/src/core/iac/template-engine.js.map +1 -0
- package/dist/src/core/increment/ac-status-manager.d.ts +115 -0
- package/dist/src/core/increment/ac-status-manager.d.ts.map +1 -0
- package/dist/src/core/increment/ac-status-manager.js +343 -0
- package/dist/src/core/increment/ac-status-manager.js.map +1 -0
- package/dist/src/core/increment/auto-transition-manager.d.ts +60 -0
- package/dist/src/core/increment/auto-transition-manager.d.ts.map +1 -0
- package/dist/src/core/increment/auto-transition-manager.js +192 -0
- package/dist/src/core/increment/auto-transition-manager.js.map +1 -0
- package/dist/src/core/increment/limits.d.ts +1 -1
- package/dist/src/core/increment/limits.d.ts.map +1 -1
- package/dist/src/core/increment/limits.js +2 -2
- package/dist/src/core/increment/limits.js.map +1 -1
- package/dist/src/core/increment/spec-sync-manager.d.ts +177 -0
- package/dist/src/core/increment/spec-sync-manager.d.ts.map +1 -0
- package/dist/src/core/increment/spec-sync-manager.js +496 -0
- package/dist/src/core/increment/spec-sync-manager.js.map +1 -0
- package/dist/src/core/increment/status-auto-transition.d.ts +46 -0
- package/dist/src/core/increment/status-auto-transition.d.ts.map +1 -0
- package/dist/src/core/increment/status-auto-transition.js +178 -0
- package/dist/src/core/increment/status-auto-transition.js.map +1 -0
- package/dist/src/core/increment/task-state-manager.d.ts +75 -0
- package/dist/src/core/increment/task-state-manager.d.ts.map +1 -0
- package/dist/src/core/increment/task-state-manager.js +117 -0
- package/dist/src/core/increment/task-state-manager.js.map +1 -0
- package/dist/src/core/living-docs/CodeValidator.d.ts +68 -0
- package/dist/src/core/living-docs/CodeValidator.d.ts.map +1 -0
- package/dist/src/core/living-docs/CodeValidator.js +160 -0
- package/dist/src/core/living-docs/CodeValidator.js.map +1 -0
- package/dist/src/core/living-docs/CompletionPropagator.d.ts +84 -0
- package/dist/src/core/living-docs/CompletionPropagator.d.ts.map +1 -0
- package/dist/src/core/living-docs/CompletionPropagator.js +206 -0
- package/dist/src/core/living-docs/CompletionPropagator.js.map +1 -0
- package/dist/src/core/living-docs/ProjectDetector.d.ts +29 -0
- package/dist/src/core/living-docs/ProjectDetector.d.ts.map +1 -0
- package/dist/src/core/living-docs/ProjectDetector.js +94 -0
- package/dist/src/core/living-docs/ProjectDetector.js.map +1 -0
- package/dist/src/core/living-docs/SpecDistributor.d.ts +60 -0
- package/dist/src/core/living-docs/SpecDistributor.d.ts.map +1 -0
- package/dist/src/core/living-docs/SpecDistributor.js +228 -0
- package/dist/src/core/living-docs/SpecDistributor.js.map +1 -0
- package/dist/src/core/living-docs/ThreeLayerSyncManager.d.ts +116 -0
- package/dist/src/core/living-docs/ThreeLayerSyncManager.d.ts.map +1 -0
- package/dist/src/core/living-docs/ThreeLayerSyncManager.js +356 -0
- package/dist/src/core/living-docs/ThreeLayerSyncManager.js.map +1 -0
- package/dist/src/core/living-docs/hierarchy-mapper.d.ts.map +1 -1
- package/dist/src/core/living-docs/hierarchy-mapper.js +2 -1
- package/dist/src/core/living-docs/hierarchy-mapper.js.map +1 -1
- package/dist/src/core/living-docs/index.d.ts +1 -1
- package/dist/src/core/living-docs/index.d.ts.map +1 -1
- package/dist/src/core/living-docs/index.js +5 -1
- package/dist/src/core/living-docs/index.js.map +1 -1
- package/dist/src/core/living-docs/project-detector.d.ts.map +1 -1
- package/dist/src/core/living-docs/project-detector.js +38 -0
- package/dist/src/core/living-docs/project-detector.js.map +1 -1
- package/dist/src/core/living-docs/types.d.ts +70 -300
- package/dist/src/core/living-docs/types.d.ts.map +1 -1
- package/dist/src/core/living-docs/types.js +2 -10
- package/dist/src/core/living-docs/types.js.map +1 -1
- package/dist/src/core/project-manager.d.ts +1 -1
- package/dist/src/core/project-manager.d.ts.map +1 -1
- package/dist/src/core/project-manager.js +2 -2
- package/dist/src/core/project-manager.js.map +1 -1
- package/dist/src/core/qa/quality-gate-decider.d.ts +1 -1
- package/dist/src/core/qa/quality-gate-decider.d.ts.map +1 -1
- package/dist/src/core/qa/risk-calculator.d.ts +1 -1
- package/dist/src/core/qa/risk-calculator.d.ts.map +1 -1
- package/dist/src/core/repo-structure/setup-summary.d.ts +1 -1
- package/dist/src/core/repo-structure/setup-summary.d.ts.map +1 -1
- package/dist/src/core/rfc-generator-v2.d.ts +1 -1
- package/dist/src/core/rfc-generator-v2.d.ts.map +1 -1
- package/dist/src/core/rfc-generator-v2.js +1 -1
- package/dist/src/core/rfc-generator-v2.js.map +1 -1
- package/dist/src/core/serverless/context-detector.d.ts +12 -0
- package/dist/src/core/serverless/context-detector.d.ts.map +1 -0
- package/dist/src/core/serverless/context-detector.js +213 -0
- package/dist/src/core/serverless/context-detector.js.map +1 -0
- package/dist/src/core/serverless/cost-comparison.d.ts +73 -0
- package/dist/src/core/serverless/cost-comparison.d.ts.map +1 -0
- package/dist/src/core/serverless/cost-comparison.js +198 -0
- package/dist/src/core/serverless/cost-comparison.js.map +1 -0
- package/dist/src/core/serverless/cost-estimator.d.ts +69 -0
- package/dist/src/core/serverless/cost-estimator.d.ts.map +1 -0
- package/dist/src/core/serverless/cost-estimator.js +127 -0
- package/dist/src/core/serverless/cost-estimator.js.map +1 -0
- package/dist/src/core/serverless/cost-optimizer.d.ts +57 -0
- package/dist/src/core/serverless/cost-optimizer.d.ts.map +1 -0
- package/dist/src/core/serverless/cost-optimizer.js +221 -0
- package/dist/src/core/serverless/cost-optimizer.js.map +1 -0
- package/dist/src/core/serverless/index.d.ts +20 -0
- package/dist/src/core/serverless/index.d.ts.map +1 -0
- package/dist/src/core/serverless/index.js +26 -0
- package/dist/src/core/serverless/index.js.map +1 -0
- package/dist/src/core/serverless/learning-path-recommender.d.ts +152 -0
- package/dist/src/core/serverless/learning-path-recommender.d.ts.map +1 -0
- package/dist/src/core/serverless/learning-path-recommender.js +389 -0
- package/dist/src/core/serverless/learning-path-recommender.js.map +1 -0
- package/dist/src/core/serverless/platform-data-loader.d.ts +22 -0
- package/dist/src/core/serverless/platform-data-loader.d.ts.map +1 -0
- package/dist/src/core/serverless/platform-data-loader.js +49 -0
- package/dist/src/core/serverless/platform-data-loader.js.map +1 -0
- package/dist/src/core/serverless/platform-selector.d.ts +20 -0
- package/dist/src/core/serverless/platform-selector.d.ts.map +1 -0
- package/dist/src/core/serverless/platform-selector.js +279 -0
- package/dist/src/core/serverless/platform-selector.js.map +1 -0
- package/dist/src/core/serverless/recommendation-formatter.d.ts +24 -0
- package/dist/src/core/serverless/recommendation-formatter.d.ts.map +1 -0
- package/dist/src/core/serverless/recommendation-formatter.js +70 -0
- package/dist/src/core/serverless/recommendation-formatter.js.map +1 -0
- package/dist/src/core/serverless/suitability-analyzer.d.ts +22 -0
- package/dist/src/core/serverless/suitability-analyzer.d.ts.map +1 -0
- package/dist/src/core/serverless/suitability-analyzer.js +262 -0
- package/dist/src/core/serverless/suitability-analyzer.js.map +1 -0
- package/dist/src/core/serverless/types.d.ts +96 -0
- package/dist/src/core/serverless/types.d.ts.map +1 -0
- package/dist/src/core/serverless/types.js +5 -0
- package/dist/src/core/serverless/types.js.map +1 -0
- package/dist/src/core/sync/bidirectional-engine.d.ts +1 -1
- package/dist/src/core/sync/bidirectional-engine.d.ts.map +1 -1
- package/dist/src/core/sync/enhanced-content-builder.d.ts +1 -1
- package/dist/src/core/sync/enhanced-content-builder.d.ts.map +1 -1
- package/dist/src/core/sync/profile-manager.d.ts +1 -1
- package/dist/src/core/sync/profile-manager.d.ts.map +1 -1
- package/dist/src/core/sync/profile-selector.d.ts +1 -1
- package/dist/src/core/sync/profile-selector.d.ts.map +1 -1
- package/dist/src/core/sync/profile-selector.js +1 -1
- package/dist/src/core/sync/profile-selector.js.map +1 -1
- package/dist/src/core/sync/project-context.d.ts +1 -1
- package/dist/src/core/sync/project-context.d.ts.map +1 -1
- package/dist/src/core/sync/rate-limiter.d.ts +1 -1
- package/dist/src/core/sync/rate-limiter.d.ts.map +1 -1
- package/dist/src/core/sync/status-sync-engine.d.ts +2 -2
- package/dist/src/core/sync/status-sync-engine.d.ts.map +1 -1
- package/dist/src/core/sync/status-sync-engine.js +2 -2
- package/dist/src/core/sync/status-sync-engine.js.map +1 -1
- package/dist/src/core/sync/time-range-selector.d.ts +1 -1
- package/dist/src/core/sync/time-range-selector.d.ts.map +1 -1
- package/dist/src/core/sync/time-range-selector.js +1 -1
- package/dist/src/core/sync/time-range-selector.js.map +1 -1
- package/dist/src/core/types/config.d.ts +23 -0
- package/dist/src/core/types/config.d.ts.map +1 -1
- package/dist/src/core/types/config.js +10 -0
- package/dist/src/core/types/config.js.map +1 -1
- package/dist/src/core/types/increment-metadata.d.ts +27 -0
- package/dist/src/core/types/increment-metadata.d.ts.map +1 -1
- package/dist/src/core/types/increment-metadata.js +45 -1
- package/dist/src/core/types/increment-metadata.js.map +1 -1
- package/dist/src/core/types/sync-profile.d.ts +2 -0
- package/dist/src/core/types/sync-profile.d.ts.map +1 -1
- package/dist/src/core/types/sync-profile.js.map +1 -1
- package/dist/src/core/validation/increment-structure-validator.d.ts +47 -0
- package/dist/src/core/validation/increment-structure-validator.d.ts.map +1 -0
- package/dist/src/core/validation/increment-structure-validator.js +187 -0
- package/dist/src/core/validation/increment-structure-validator.js.map +1 -0
- package/dist/src/core/validation/three-file-validator.d.ts +82 -0
- package/dist/src/core/validation/three-file-validator.d.ts.map +1 -0
- package/dist/src/core/validation/three-file-validator.js +320 -0
- package/dist/src/core/validation/three-file-validator.js.map +1 -0
- package/dist/src/core/workflow/phase-detector.d.ts +103 -0
- package/dist/src/core/workflow/phase-detector.d.ts.map +1 -0
- package/dist/src/core/workflow/phase-detector.js +704 -0
- package/dist/src/core/workflow/phase-detector.js.map +1 -0
- package/dist/src/core/workflow/types.d.ts +153 -0
- package/dist/src/core/workflow/types.d.ts.map +1 -0
- package/dist/src/core/workflow/types.js +47 -0
- package/dist/src/core/workflow/types.js.map +1 -0
- package/dist/src/init/ArchitecturePresenter.d.ts +47 -0
- package/dist/src/init/ArchitecturePresenter.d.ts.map +1 -0
- package/dist/src/init/ArchitecturePresenter.js +180 -0
- package/dist/src/init/ArchitecturePresenter.js.map +1 -0
- package/dist/src/init/InitFlow.d.ts +37 -0
- package/dist/src/init/InitFlow.d.ts.map +1 -0
- package/dist/src/init/InitFlow.js +238 -0
- package/dist/src/init/InitFlow.js.map +1 -0
- package/dist/src/init/architecture/ArchitectureDecisionEngine.d.ts +107 -0
- package/dist/src/init/architecture/ArchitectureDecisionEngine.d.ts.map +1 -0
- package/dist/src/init/architecture/ArchitectureDecisionEngine.js +405 -0
- package/dist/src/init/architecture/ArchitectureDecisionEngine.js.map +1 -0
- package/dist/src/init/architecture/CloudCreditsDatabase.d.ts +11 -0
- package/dist/src/init/architecture/CloudCreditsDatabase.d.ts.map +1 -0
- package/dist/src/init/architecture/CloudCreditsDatabase.js +92 -0
- package/dist/src/init/architecture/CloudCreditsDatabase.js.map +1 -0
- package/dist/src/init/architecture/CostEstimator.d.ts +52 -0
- package/dist/src/init/architecture/CostEstimator.d.ts.map +1 -0
- package/dist/src/init/architecture/CostEstimator.js +107 -0
- package/dist/src/init/architecture/CostEstimator.js.map +1 -0
- package/dist/src/init/architecture/InfrastructureMapper.d.ts +41 -0
- package/dist/src/init/architecture/InfrastructureMapper.d.ts.map +1 -0
- package/dist/src/init/architecture/InfrastructureMapper.js +140 -0
- package/dist/src/init/architecture/InfrastructureMapper.js.map +1 -0
- package/dist/src/init/architecture/ProjectGenerator.d.ts +44 -0
- package/dist/src/init/architecture/ProjectGenerator.d.ts.map +1 -0
- package/dist/src/init/architecture/ProjectGenerator.js +216 -0
- package/dist/src/init/architecture/ProjectGenerator.js.map +1 -0
- package/dist/src/init/architecture/types.d.ts +251 -0
- package/dist/src/init/architecture/types.d.ts.map +1 -0
- package/dist/src/init/architecture/types.js +54 -0
- package/dist/src/init/architecture/types.js.map +1 -0
- package/dist/src/init/compliance/ComplianceDetector.d.ts +17 -0
- package/dist/src/init/compliance/ComplianceDetector.d.ts.map +1 -0
- package/dist/src/init/compliance/ComplianceDetector.js +64 -0
- package/dist/src/init/compliance/ComplianceDetector.js.map +1 -0
- package/dist/src/init/compliance/standards-database.d.ts +48 -0
- package/dist/src/init/compliance/standards-database.d.ts.map +1 -0
- package/dist/src/init/compliance/standards-database.js +506 -0
- package/dist/src/init/compliance/standards-database.js.map +1 -0
- package/dist/src/init/compliance/types.d.ts +91 -0
- package/dist/src/init/compliance/types.d.ts.map +1 -0
- package/dist/src/init/compliance/types.js +43 -0
- package/dist/src/init/compliance/types.js.map +1 -0
- package/dist/src/init/repo/GitHubAPIClient.d.ts +51 -0
- package/dist/src/init/repo/GitHubAPIClient.d.ts.map +1 -0
- package/dist/src/init/repo/GitHubAPIClient.js +144 -0
- package/dist/src/init/repo/GitHubAPIClient.js.map +1 -0
- package/dist/src/init/repo/RepositorySelector.d.ts +45 -0
- package/dist/src/init/repo/RepositorySelector.d.ts.map +1 -0
- package/dist/src/init/repo/RepositorySelector.js +106 -0
- package/dist/src/init/repo/RepositorySelector.js.map +1 -0
- package/dist/src/init/repo/types.d.ts +95 -0
- package/dist/src/init/repo/types.d.ts.map +1 -0
- package/dist/src/init/repo/types.js +25 -0
- package/dist/src/init/repo/types.js.map +1 -0
- package/dist/src/init/research/CompetitorAnalyzer.d.ts +79 -0
- package/dist/src/init/research/CompetitorAnalyzer.d.ts.map +1 -0
- package/dist/src/init/research/CompetitorAnalyzer.js +265 -0
- package/dist/src/init/research/CompetitorAnalyzer.js.map +1 -0
- package/dist/src/init/research/MarketDetector.d.ts +62 -0
- package/dist/src/init/research/MarketDetector.d.ts.map +1 -0
- package/dist/src/init/research/MarketDetector.js +247 -0
- package/dist/src/init/research/MarketDetector.js.map +1 -0
- package/dist/src/init/research/OpportunityScorer.d.ts +58 -0
- package/dist/src/init/research/OpportunityScorer.d.ts.map +1 -0
- package/dist/src/init/research/OpportunityScorer.js +194 -0
- package/dist/src/init/research/OpportunityScorer.js.map +1 -0
- package/dist/src/init/research/QuestionGenerator.d.ts +68 -0
- package/dist/src/init/research/QuestionGenerator.d.ts.map +1 -0
- package/dist/src/init/research/QuestionGenerator.js +244 -0
- package/dist/src/init/research/QuestionGenerator.js.map +1 -0
- package/dist/src/init/research/ReportGenerator.d.ts +36 -0
- package/dist/src/init/research/ReportGenerator.d.ts.map +1 -0
- package/dist/src/init/research/ReportGenerator.js +125 -0
- package/dist/src/init/research/ReportGenerator.js.map +1 -0
- package/dist/src/init/research/VisionAnalyzer.d.ts +129 -0
- package/dist/src/init/research/VisionAnalyzer.d.ts.map +1 -0
- package/dist/src/init/research/VisionAnalyzer.js +212 -0
- package/dist/src/init/research/VisionAnalyzer.js.map +1 -0
- package/dist/src/init/research/keyword-extractor.d.ts +78 -0
- package/dist/src/init/research/keyword-extractor.d.ts.map +1 -0
- package/dist/src/init/research/keyword-extractor.js +230 -0
- package/dist/src/init/research/keyword-extractor.js.map +1 -0
- package/dist/src/init/research/src/config/ConfigManager.d.ts +14 -0
- package/dist/src/init/research/src/config/ConfigManager.d.ts.map +1 -0
- package/dist/src/init/research/src/config/ConfigManager.js +45 -0
- package/dist/src/init/research/src/config/ConfigManager.js.map +1 -0
- package/dist/src/init/research/src/config/types.d.ts +102 -0
- package/dist/src/init/research/src/config/types.d.ts.map +1 -0
- package/dist/src/init/research/src/config/types.js +24 -0
- package/dist/src/init/research/src/config/types.js.map +1 -0
- package/dist/src/init/research/types.d.ts +183 -0
- package/dist/src/init/research/types.d.ts.map +1 -0
- package/dist/src/init/research/types.js +65 -0
- package/dist/src/init/research/types.js.map +1 -0
- package/dist/src/init/team/ServerlessSavingsCalculator.d.ts +136 -0
- package/dist/src/init/team/ServerlessSavingsCalculator.d.ts.map +1 -0
- package/dist/src/init/team/ServerlessSavingsCalculator.js +360 -0
- package/dist/src/init/team/ServerlessSavingsCalculator.js.map +1 -0
- package/dist/src/init/team/TeamRecommender.d.ts +122 -0
- package/dist/src/init/team/TeamRecommender.d.ts.map +1 -0
- package/dist/src/init/team/TeamRecommender.js +405 -0
- package/dist/src/init/team/TeamRecommender.js.map +1 -0
- package/dist/src/init/team/types.d.ts +95 -0
- package/dist/src/init/team/types.d.ts.map +1 -0
- package/dist/src/init/team/types.js +23 -0
- package/dist/src/init/team/types.js.map +1 -0
- package/dist/src/integrations/jira/jira-mapper.d.ts +1 -1
- package/dist/src/integrations/jira/jira-mapper.d.ts.map +1 -1
- package/dist/src/types/cost-tracking.d.ts +1 -1
- package/dist/src/types/cost-tracking.d.ts.map +1 -1
- package/dist/src/utils/cost-reporter.d.ts +2 -2
- package/dist/src/utils/cost-reporter.d.ts.map +1 -1
- package/dist/src/utils/docs-preview/config-generator.d.ts +1 -1
- package/dist/src/utils/docs-preview/config-generator.d.ts.map +1 -1
- package/dist/src/utils/docs-preview/config-generator.js +1 -1
- package/dist/src/utils/docs-preview/docusaurus-setup.d.ts +1 -1
- package/dist/src/utils/docs-preview/docusaurus-setup.d.ts.map +1 -1
- package/dist/src/utils/docs-preview/docusaurus-setup.js +4 -4
- package/dist/src/utils/docs-preview/docusaurus-setup.js.map +1 -1
- package/dist/src/utils/docs-preview/index.d.ts +6 -6
- package/dist/src/utils/docs-preview/index.d.ts.map +1 -1
- package/dist/src/utils/docs-preview/index.js +6 -6
- package/dist/src/utils/docs-preview/index.js.map +1 -1
- package/dist/src/utils/docs-preview/package-installer.d.ts +1 -1
- package/dist/src/utils/docs-preview/package-installer.d.ts.map +1 -1
- package/dist/src/utils/docs-preview/package-installer.js +1 -1
- package/dist/src/utils/docs-preview/package-installer.js.map +1 -1
- package/dist/src/utils/docs-preview/server-manager.d.ts +1 -1
- package/dist/src/utils/docs-preview/server-manager.d.ts.map +1 -1
- package/dist/src/utils/docs-preview/server-manager.js +1 -1
- package/dist/src/utils/docs-preview/server-manager.js.map +1 -1
- package/dist/src/utils/docs-preview/sidebar-builder.d.ts +1 -1
- package/dist/src/utils/docs-preview/sidebar-builder.d.ts.map +1 -1
- package/dist/src/utils/generate-skills-index.d.ts +1 -1
- package/dist/src/utils/generate-skills-index.js +1 -1
- package/dist/src/utils/project-detection.js +1 -1
- package/dist/src/utils/project-detection.js.map +1 -1
- package/package.json +17 -10
- package/plugins/specweave/agents/architect/AGENT.md +605 -0
- package/plugins/specweave/agents/infrastructure/AGENT.md +760 -0
- package/plugins/specweave/agents/pm/AGENT.md +14 -13
- package/plugins/specweave/commands/specweave-check-hooks.md +186 -0
- package/plugins/specweave/commands/specweave-plan.md +151 -0
- package/plugins/specweave/commands/specweave-sync-acs.md +342 -0
- package/plugins/specweave/commands/specweave-validate.md +60 -11
- package/plugins/specweave/hooks/lib/update-status-line.sh +8 -4
- package/plugins/specweave/hooks/post-increment-change.sh +4 -0
- package/plugins/specweave/hooks/post-increment-completion.sh +7 -1
- package/plugins/specweave/hooks/post-increment-planning.sh +4 -0
- package/plugins/specweave/hooks/post-increment-status-change.sh +4 -0
- package/plugins/specweave/hooks/user-prompt-submit.sh +78 -0
- package/plugins/specweave/iac-templates/aws-lambda/README.md.hbs +280 -0
- package/plugins/specweave/iac-templates/aws-lambda/defaults.json +118 -0
- package/plugins/specweave/iac-templates/aws-lambda/environments/dev.defaults.json +46 -0
- package/plugins/specweave/iac-templates/aws-lambda/environments/prod.defaults.json +67 -0
- package/plugins/specweave/iac-templates/aws-lambda/environments/staging.defaults.json +47 -0
- package/plugins/specweave/iac-templates/aws-lambda/main.tf.hbs +241 -0
- package/plugins/specweave/iac-templates/aws-lambda/outputs.tf.hbs +61 -0
- package/plugins/specweave/iac-templates/aws-lambda/provider.tf.hbs +15 -0
- package/plugins/specweave/iac-templates/aws-lambda/variables.tf.hbs +88 -0
- package/plugins/specweave/iac-templates/azure-functions/README.md.hbs +315 -0
- package/plugins/specweave/iac-templates/azure-functions/defaults.json +65 -0
- package/plugins/specweave/iac-templates/azure-functions/environments/dev.defaults.json +30 -0
- package/plugins/specweave/iac-templates/azure-functions/environments/prod.defaults.json +34 -0
- package/plugins/specweave/iac-templates/azure-functions/environments/staging.defaults.json +31 -0
- package/plugins/specweave/iac-templates/azure-functions/iam.tf.hbs +34 -0
- package/plugins/specweave/iac-templates/azure-functions/main.tf.hbs +247 -0
- package/plugins/specweave/iac-templates/azure-functions/outputs.tf.hbs +72 -0
- package/plugins/specweave/iac-templates/azure-functions/provider.tf.hbs +14 -0
- package/plugins/specweave/iac-templates/azure-functions/variables.tf.hbs +64 -0
- package/plugins/specweave/iac-templates/firebase/README.md.hbs +487 -0
- package/plugins/specweave/iac-templates/firebase/defaults.json +55 -0
- package/plugins/specweave/iac-templates/firebase/environments/dev.defaults.json +44 -0
- package/plugins/specweave/iac-templates/firebase/environments/prod.defaults.json +52 -0
- package/plugins/specweave/iac-templates/firebase/environments/staging.defaults.json +43 -0
- package/plugins/specweave/iac-templates/firebase/iam.tf.hbs +75 -0
- package/plugins/specweave/iac-templates/firebase/main.tf.hbs +297 -0
- package/plugins/specweave/iac-templates/firebase/outputs.tf.hbs +67 -0
- package/plugins/specweave/iac-templates/firebase/provider.tf.hbs +26 -0
- package/plugins/specweave/iac-templates/firebase/variables.tf.hbs +68 -0
- package/plugins/specweave/iac-templates/gcp-cloud-functions/README.md.hbs +330 -0
- package/plugins/specweave/iac-templates/gcp-cloud-functions/defaults.json +69 -0
- package/plugins/specweave/iac-templates/gcp-cloud-functions/environments/dev.defaults.json +33 -0
- package/plugins/specweave/iac-templates/gcp-cloud-functions/environments/prod.defaults.json +40 -0
- package/plugins/specweave/iac-templates/gcp-cloud-functions/environments/staging.defaults.json +33 -0
- package/plugins/specweave/iac-templates/gcp-cloud-functions/iam.tf.hbs +54 -0
- package/plugins/specweave/iac-templates/gcp-cloud-functions/main.tf.hbs +211 -0
- package/plugins/specweave/iac-templates/gcp-cloud-functions/outputs.tf.hbs +44 -0
- package/plugins/specweave/iac-templates/gcp-cloud-functions/provider.tf.hbs +14 -0
- package/plugins/specweave/iac-templates/gcp-cloud-functions/variables.tf.hbs +82 -0
- package/plugins/specweave/iac-templates/supabase/README.md.hbs +534 -0
- package/plugins/specweave/iac-templates/supabase/defaults.json +69 -0
- package/plugins/specweave/iac-templates/supabase/environments/dev.defaults.json +55 -0
- package/plugins/specweave/iac-templates/supabase/environments/prod.defaults.json +75 -0
- package/plugins/specweave/iac-templates/supabase/environments/staging.defaults.json +54 -0
- package/plugins/specweave/iac-templates/supabase/iam.tf.hbs +146 -0
- package/plugins/specweave/iac-templates/supabase/main.tf.hbs +310 -0
- package/plugins/specweave/iac-templates/supabase/outputs.tf.hbs +74 -0
- package/plugins/specweave/iac-templates/supabase/provider.tf.hbs +19 -0
- package/plugins/specweave/iac-templates/supabase/variables.tf.hbs +78 -0
- package/plugins/specweave/knowledge-base/serverless/FRESHNESS.md +69 -0
- package/plugins/specweave/knowledge-base/serverless/learning-paths.json +865 -0
- package/plugins/specweave/knowledge-base/serverless/platforms/aws-lambda.json +41 -0
- package/plugins/specweave/knowledge-base/serverless/platforms/azure-functions.json +41 -0
- package/plugins/specweave/knowledge-base/serverless/platforms/firebase.json +46 -0
- package/plugins/specweave/knowledge-base/serverless/platforms/gcp-cloud-functions.json +41 -0
- package/plugins/specweave/knowledge-base/serverless/platforms/supabase.json +41 -0
- package/plugins/specweave/knowledge-base/serverless/schema.json +155 -0
- package/plugins/specweave/lib/hooks/auto-transition.js +50 -0
- package/plugins/specweave/lib/hooks/auto-transition.ts +84 -0
- package/plugins/specweave/lib/hooks/invoke-translator-skill.js +1 -1
- package/plugins/specweave/lib/hooks/invoke-translator-skill.ts +1 -1
- package/plugins/specweave/lib/hooks/sync-living-docs.js +4 -31
- package/plugins/specweave/lib/hooks/{sync-living-docs.ts → sync-living-docs.ts.DISABLED} +9 -48
- package/plugins/specweave/lib/hooks/translate-file.js +1 -1
- package/plugins/specweave/lib/hooks/translate-file.ts +1 -1
- package/plugins/specweave/lib/hooks/update-ac-status.js +24 -75
- package/plugins/specweave/lib/hooks/update-ac-status.ts +46 -135
- package/plugins/specweave/lib/hooks/update-tasks-md.js +115 -3
- package/plugins/specweave/lib/hooks/update-tasks-md.ts +182 -10
- package/plugins/specweave/lib/utils/validate-dev-setup.sh +133 -0
- package/plugins/specweave/skills/increment-planner/SKILL.md +25 -15
- package/plugins/specweave/skills/serverless-recommender/SKILL.md +368 -0
- package/plugins/specweave/templates/iac/aws-lambda/templates/iam.tf.hbs +137 -0
- package/plugins/specweave/templates/iac/aws-lambda/templates/main.tf.hbs +216 -0
- package/plugins/specweave-ado/lib/enhanced-ado-sync.js +170 -0
- package/plugins/specweave-github/lib/CodeValidator.js +195 -0
- package/plugins/specweave-github/lib/CodeValidator.ts +284 -0
- package/plugins/specweave-github/lib/IssueStateManager.js +117 -0
- package/plugins/specweave-github/lib/IssueStateManager.ts +231 -0
- package/plugins/specweave-github/lib/ThreeLayerSyncManager.js +545 -0
- package/plugins/specweave-github/lib/ThreeLayerSyncManager.ts +809 -0
- package/plugins/specweave-github/lib/types.ts +38 -0
- package/plugins/specweave-github/lib/user-story-issue-builder.js +7 -0
- package/plugins/specweave-github/lib/user-story-issue-builder.ts +11 -0
- package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +1200 -0
- package/plugins/specweave-ui/.mcp.json +0 -10
- package/plugins/specweave-ui/README.md +26 -26
- package/plugins/specweave-ui/skills/browser-automation/SKILL.md +31 -18
- package/src/templates/AGENTS.md.template +22 -1
- package/src/templates/tasks.md.template +51 -33
- package/dist/plugins/specweave/lib/hooks/git-diff-analyzer.d.ts +0 -89
- package/dist/plugins/specweave/lib/hooks/git-diff-analyzer.d.ts.map +0 -1
- package/dist/plugins/specweave/lib/hooks/git-diff-analyzer.js +0 -226
- package/dist/plugins/specweave/lib/hooks/git-diff-analyzer.js.map +0 -1
- package/dist/plugins/specweave/lib/hooks/invoke-translator-skill.d.ts +0 -60
- package/dist/plugins/specweave/lib/hooks/invoke-translator-skill.d.ts.map +0 -1
- package/dist/plugins/specweave/lib/hooks/invoke-translator-skill.js +0 -201
- package/dist/plugins/specweave/lib/hooks/invoke-translator-skill.js.map +0 -1
- package/dist/plugins/specweave/lib/hooks/prepare-reflection-context.d.ts +0 -42
- package/dist/plugins/specweave/lib/hooks/prepare-reflection-context.d.ts.map +0 -1
- package/dist/plugins/specweave/lib/hooks/prepare-reflection-context.js +0 -123
- package/dist/plugins/specweave/lib/hooks/prepare-reflection-context.js.map +0 -1
- package/dist/plugins/specweave/lib/hooks/reflection-config-loader.d.ts +0 -45
- package/dist/plugins/specweave/lib/hooks/reflection-config-loader.d.ts.map +0 -1
- package/dist/plugins/specweave/lib/hooks/reflection-config-loader.js +0 -132
- package/dist/plugins/specweave/lib/hooks/reflection-config-loader.js.map +0 -1
- package/dist/plugins/specweave/lib/hooks/reflection-parser.d.ts +0 -33
- package/dist/plugins/specweave/lib/hooks/reflection-parser.d.ts.map +0 -1
- package/dist/plugins/specweave/lib/hooks/reflection-parser.js +0 -419
- package/dist/plugins/specweave/lib/hooks/reflection-parser.js.map +0 -1
- package/dist/plugins/specweave/lib/hooks/reflection-prompt-builder.d.ts +0 -56
- package/dist/plugins/specweave/lib/hooks/reflection-prompt-builder.d.ts.map +0 -1
- package/dist/plugins/specweave/lib/hooks/reflection-prompt-builder.js +0 -239
- package/dist/plugins/specweave/lib/hooks/reflection-prompt-builder.js.map +0 -1
- package/dist/plugins/specweave/lib/hooks/reflection-storage.d.ts +0 -64
- package/dist/plugins/specweave/lib/hooks/reflection-storage.d.ts.map +0 -1
- package/dist/plugins/specweave/lib/hooks/reflection-storage.js +0 -305
- package/dist/plugins/specweave/lib/hooks/reflection-storage.js.map +0 -1
- package/dist/plugins/specweave/lib/hooks/run-self-reflection.d.ts +0 -43
- package/dist/plugins/specweave/lib/hooks/run-self-reflection.d.ts.map +0 -1
- package/dist/plugins/specweave/lib/hooks/run-self-reflection.js +0 -203
- package/dist/plugins/specweave/lib/hooks/run-self-reflection.js.map +0 -1
- package/dist/plugins/specweave/lib/hooks/sync-living-docs.d.ts +0 -32
- package/dist/plugins/specweave/lib/hooks/sync-living-docs.d.ts.map +0 -1
- package/dist/plugins/specweave/lib/hooks/sync-living-docs.js +0 -405
- package/dist/plugins/specweave/lib/hooks/sync-living-docs.js.map +0 -1
- package/dist/plugins/specweave/lib/hooks/translate-file.d.ts +0 -59
- package/dist/plugins/specweave/lib/hooks/translate-file.d.ts.map +0 -1
- package/dist/plugins/specweave/lib/hooks/translate-file.js +0 -350
- package/dist/plugins/specweave/lib/hooks/translate-file.js.map +0 -1
- package/dist/plugins/specweave/lib/hooks/translate-living-docs.d.ts +0 -13
- package/dist/plugins/specweave/lib/hooks/translate-living-docs.d.ts.map +0 -1
- package/dist/plugins/specweave/lib/hooks/translate-living-docs.js +0 -175
- package/dist/plugins/specweave/lib/hooks/translate-living-docs.js.map +0 -1
- package/dist/plugins/specweave/lib/hooks/types/reflection-types.d.ts +0 -164
- package/dist/plugins/specweave/lib/hooks/types/reflection-types.d.ts.map +0 -1
- package/dist/plugins/specweave/lib/hooks/types/reflection-types.js +0 -73
- package/dist/plugins/specweave/lib/hooks/types/reflection-types.js.map +0 -1
- package/dist/plugins/specweave/lib/hooks/update-ac-status.d.ts +0 -21
- package/dist/plugins/specweave/lib/hooks/update-ac-status.d.ts.map +0 -1
- package/dist/plugins/specweave/lib/hooks/update-ac-status.js +0 -162
- package/dist/plugins/specweave/lib/hooks/update-ac-status.js.map +0 -1
- package/dist/plugins/specweave/lib/hooks/update-tasks-md.d.ts +0 -29
- package/dist/plugins/specweave/lib/hooks/update-tasks-md.d.ts.map +0 -1
- package/dist/plugins/specweave/lib/hooks/update-tasks-md.js +0 -203
- package/dist/plugins/specweave/lib/hooks/update-tasks-md.js.map +0 -1
- package/dist/src/core/living-docs/spec-distributor.d.ts +0 -180
- package/dist/src/core/living-docs/spec-distributor.d.ts.map +0 -1
- package/dist/src/core/living-docs/spec-distributor.js +0 -1840
- package/dist/src/core/living-docs/spec-distributor.js.map +0 -1
|
@@ -0,0 +1,704 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Phase Detector - Auto-detect current workflow phase
|
|
3
|
+
*
|
|
4
|
+
* Analyzes user prompts, commands, file states, and context to determine
|
|
5
|
+
* the current phase of the SpecWeave development workflow.
|
|
6
|
+
*
|
|
7
|
+
* Detection Algorithm:
|
|
8
|
+
* - Keyword Analysis (40% weight): Match keywords in user prompt
|
|
9
|
+
* - Command Analysis (30% weight): Analyze recent command history
|
|
10
|
+
* - Context Analysis (20% weight): Check file states and increment status
|
|
11
|
+
* - Hint Analysis (10% weight): Detect explicit user hints
|
|
12
|
+
*
|
|
13
|
+
* Part of increment 0039: Ultra-Smart Next Command (US-001)
|
|
14
|
+
*/
|
|
15
|
+
import { WorkflowPhase, EvidenceType } from './types.js';
|
|
16
|
+
import * as fs from 'fs';
|
|
17
|
+
import * as path from 'path';
|
|
18
|
+
import { MetadataManager } from '../increment/metadata-manager.js';
|
|
19
|
+
/**
|
|
20
|
+
* Default configuration for PhaseDetector
|
|
21
|
+
*/
|
|
22
|
+
const DEFAULT_CONFIG = {
|
|
23
|
+
keywordWeight: 0.4,
|
|
24
|
+
commandWeight: 0.3,
|
|
25
|
+
contextWeight: 0.2,
|
|
26
|
+
hintWeight: 0.1,
|
|
27
|
+
confidenceThreshold: 0.6,
|
|
28
|
+
includeAlternatives: true
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Keyword mappings for each workflow phase
|
|
32
|
+
*/
|
|
33
|
+
const KEYWORD_MAPPINGS = [
|
|
34
|
+
// SPEC_WRITING phase
|
|
35
|
+
{
|
|
36
|
+
phase: WorkflowPhase.SPEC_WRITING,
|
|
37
|
+
keywords: [
|
|
38
|
+
'spec', 'specification', 'requirements', 'user story', 'user stories',
|
|
39
|
+
'acceptance criteria', 'AC', 'functional requirement', 'non-functional',
|
|
40
|
+
'define', 'document', 'describe', 'outline', 'detail',
|
|
41
|
+
'what should', 'how should', 'requirements gathering', 'product requirements',
|
|
42
|
+
'write spec', 'update spec', 'edit spec', 'create spec'
|
|
43
|
+
],
|
|
44
|
+
weight: 1.0
|
|
45
|
+
},
|
|
46
|
+
// PLAN_GENERATION phase
|
|
47
|
+
{
|
|
48
|
+
phase: WorkflowPhase.PLAN_GENERATION,
|
|
49
|
+
keywords: [
|
|
50
|
+
'plan', 'architecture', 'design', 'approach', 'strategy',
|
|
51
|
+
'technical design', 'system design', 'component design',
|
|
52
|
+
'how to implement', 'implementation plan', 'technical approach',
|
|
53
|
+
'architect', 'module', 'component', 'service',
|
|
54
|
+
'generate plan', 'create plan', 'plan.md'
|
|
55
|
+
],
|
|
56
|
+
weight: 1.0
|
|
57
|
+
},
|
|
58
|
+
// TASK_BREAKDOWN phase
|
|
59
|
+
{
|
|
60
|
+
phase: WorkflowPhase.TASK_BREAKDOWN,
|
|
61
|
+
keywords: [
|
|
62
|
+
'task', 'tasks', 'todo', 'checklist', 'breakdown', 'split',
|
|
63
|
+
'divide', 'organize', 'prioritize', 'order',
|
|
64
|
+
'task list', 'work items', 'backlog items',
|
|
65
|
+
'create tasks', 'generate tasks', 'tasks.md', 'task breakdown'
|
|
66
|
+
],
|
|
67
|
+
weight: 1.0
|
|
68
|
+
},
|
|
69
|
+
// IMPLEMENTATION phase
|
|
70
|
+
{
|
|
71
|
+
phase: WorkflowPhase.IMPLEMENTATION,
|
|
72
|
+
keywords: [
|
|
73
|
+
'implement', 'code', 'develop', 'build', 'create', 'add',
|
|
74
|
+
'write code', 'programming', 'coding', 'development',
|
|
75
|
+
'feature', 'functionality', 'component implementation',
|
|
76
|
+
'let\'s build', 'let\'s implement', 'let\'s code', 'let\'s develop',
|
|
77
|
+
'start working', 'begin implementation', 'write', 'fix bug', 'bug fix'
|
|
78
|
+
],
|
|
79
|
+
weight: 1.2 // Slightly higher weight as implementation is common
|
|
80
|
+
},
|
|
81
|
+
// TESTING phase
|
|
82
|
+
{
|
|
83
|
+
phase: WorkflowPhase.TESTING,
|
|
84
|
+
keywords: [
|
|
85
|
+
'test', 'testing', 'unit test', 'integration test', 'e2e test',
|
|
86
|
+
'test case', 'test suite', 'coverage', 'tdd', 'test-driven',
|
|
87
|
+
'write tests', 'run tests', 'test coverage', 'jest', 'mocha',
|
|
88
|
+
'assertions', 'expect', 'verify', 'validate tests',
|
|
89
|
+
'test plan', 'test strategy'
|
|
90
|
+
],
|
|
91
|
+
weight: 1.1
|
|
92
|
+
},
|
|
93
|
+
// DOCUMENTATION phase
|
|
94
|
+
{
|
|
95
|
+
phase: WorkflowPhase.DOCUMENTATION,
|
|
96
|
+
keywords: [
|
|
97
|
+
'document', 'documentation', 'docs', 'readme', 'guide',
|
|
98
|
+
'api documentation', 'user guide', 'developer guide',
|
|
99
|
+
'write docs', 'update docs', 'sync docs', 'living docs',
|
|
100
|
+
'markdown', 'comments', 'jsdoc', 'docstring'
|
|
101
|
+
],
|
|
102
|
+
weight: 0.9
|
|
103
|
+
},
|
|
104
|
+
// REVIEW phase
|
|
105
|
+
{
|
|
106
|
+
phase: WorkflowPhase.REVIEW,
|
|
107
|
+
keywords: [
|
|
108
|
+
'review', 'code review', 'qa', 'quality', 'validate', 'check',
|
|
109
|
+
'quality assurance', 'quality check', 'peer review',
|
|
110
|
+
'inspect', 'audit', 'verify quality', 'quality gate',
|
|
111
|
+
'pull request', 'pr', 'merge request', 'mr'
|
|
112
|
+
],
|
|
113
|
+
weight: 0.9
|
|
114
|
+
},
|
|
115
|
+
// COMPLETION phase
|
|
116
|
+
{
|
|
117
|
+
phase: WorkflowPhase.COMPLETION,
|
|
118
|
+
keywords: [
|
|
119
|
+
'done', 'complete', 'finish', 'close', 'wrap up', 'finalize',
|
|
120
|
+
'completed', 'finished', 'all done', 'ready to close',
|
|
121
|
+
'increment done', 'increment complete', 'archive',
|
|
122
|
+
'mark as done', 'mark complete', 'close increment'
|
|
123
|
+
],
|
|
124
|
+
weight: 1.0
|
|
125
|
+
}
|
|
126
|
+
];
|
|
127
|
+
/**
|
|
128
|
+
* Command mappings for each workflow phase
|
|
129
|
+
*/
|
|
130
|
+
const COMMAND_MAPPINGS = [
|
|
131
|
+
// SPEC_WRITING
|
|
132
|
+
{
|
|
133
|
+
phase: WorkflowPhase.SPEC_WRITING,
|
|
134
|
+
commandPattern: '/specweave:increment',
|
|
135
|
+
weight: 1.2
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
phase: WorkflowPhase.SPEC_WRITING,
|
|
139
|
+
commandPattern: '/specweave:validate',
|
|
140
|
+
weight: 0.8
|
|
141
|
+
},
|
|
142
|
+
// PLAN_GENERATION
|
|
143
|
+
{
|
|
144
|
+
phase: WorkflowPhase.PLAN_GENERATION,
|
|
145
|
+
commandPattern: '/specweave:plan',
|
|
146
|
+
weight: 1.5
|
|
147
|
+
},
|
|
148
|
+
// IMPLEMENTATION
|
|
149
|
+
{
|
|
150
|
+
phase: WorkflowPhase.IMPLEMENTATION,
|
|
151
|
+
commandPattern: '/specweave:do',
|
|
152
|
+
weight: 1.5
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
phase: WorkflowPhase.IMPLEMENTATION,
|
|
156
|
+
commandPattern: '/specweave:progress',
|
|
157
|
+
weight: 1.0
|
|
158
|
+
},
|
|
159
|
+
// TESTING
|
|
160
|
+
{
|
|
161
|
+
phase: WorkflowPhase.TESTING,
|
|
162
|
+
commandPattern: '/specweave:test',
|
|
163
|
+
weight: 1.3
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
phase: WorkflowPhase.TESTING,
|
|
167
|
+
commandPattern: 'npm test',
|
|
168
|
+
weight: 1.2
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
phase: WorkflowPhase.TESTING,
|
|
172
|
+
commandPattern: 'jest',
|
|
173
|
+
weight: 1.2
|
|
174
|
+
},
|
|
175
|
+
// DOCUMENTATION
|
|
176
|
+
{
|
|
177
|
+
phase: WorkflowPhase.DOCUMENTATION,
|
|
178
|
+
commandPattern: '/specweave:sync-docs',
|
|
179
|
+
weight: 1.4
|
|
180
|
+
},
|
|
181
|
+
// REVIEW
|
|
182
|
+
{
|
|
183
|
+
phase: WorkflowPhase.REVIEW,
|
|
184
|
+
commandPattern: '/specweave:qa',
|
|
185
|
+
weight: 1.3
|
|
186
|
+
},
|
|
187
|
+
// COMPLETION
|
|
188
|
+
{
|
|
189
|
+
phase: WorkflowPhase.COMPLETION,
|
|
190
|
+
commandPattern: '/specweave:done',
|
|
191
|
+
weight: 1.5
|
|
192
|
+
}
|
|
193
|
+
];
|
|
194
|
+
/**
|
|
195
|
+
* PhaseDetector - Detect current workflow phase
|
|
196
|
+
*/
|
|
197
|
+
export class PhaseDetector {
|
|
198
|
+
constructor(config = {}) {
|
|
199
|
+
this.DEFAULT_CACHE_TTL = 5000; // 5 seconds
|
|
200
|
+
// Performance tracking
|
|
201
|
+
this.detectionCount = 0;
|
|
202
|
+
this.cacheHits = 0;
|
|
203
|
+
this.cacheMisses = 0;
|
|
204
|
+
this.totalDetectionTime = 0;
|
|
205
|
+
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
206
|
+
this.fileStateCache = new Map();
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Get performance statistics
|
|
210
|
+
*/
|
|
211
|
+
getPerformanceStats() {
|
|
212
|
+
return {
|
|
213
|
+
detectionCount: this.detectionCount,
|
|
214
|
+
cacheHits: this.cacheHits,
|
|
215
|
+
cacheMisses: this.cacheMisses,
|
|
216
|
+
cacheHitRate: this.cacheHits / Math.max(this.cacheHits + this.cacheMisses, 1),
|
|
217
|
+
averageDetectionTime: this.totalDetectionTime / Math.max(this.detectionCount, 1)
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Reset performance statistics
|
|
222
|
+
*/
|
|
223
|
+
resetPerformanceStats() {
|
|
224
|
+
this.detectionCount = 0;
|
|
225
|
+
this.cacheHits = 0;
|
|
226
|
+
this.cacheMisses = 0;
|
|
227
|
+
this.totalDetectionTime = 0;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Clear the file state cache
|
|
231
|
+
*/
|
|
232
|
+
clearCache() {
|
|
233
|
+
this.fileStateCache.clear();
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Get cached file states if available and not expired
|
|
237
|
+
*/
|
|
238
|
+
getCachedFileStates(incrementDir) {
|
|
239
|
+
const cached = this.fileStateCache.get(incrementDir);
|
|
240
|
+
if (!cached) {
|
|
241
|
+
this.cacheMisses++;
|
|
242
|
+
return null;
|
|
243
|
+
}
|
|
244
|
+
const now = Date.now();
|
|
245
|
+
if (now - cached.timestamp > cached.ttl) {
|
|
246
|
+
// Cache expired
|
|
247
|
+
this.fileStateCache.delete(incrementDir);
|
|
248
|
+
this.cacheMisses++;
|
|
249
|
+
return null;
|
|
250
|
+
}
|
|
251
|
+
this.cacheHits++;
|
|
252
|
+
return cached.states;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Cache file states for future use
|
|
256
|
+
*/
|
|
257
|
+
cacheFileStates(incrementDir, states) {
|
|
258
|
+
this.fileStateCache.set(incrementDir, {
|
|
259
|
+
states,
|
|
260
|
+
timestamp: Date.now(),
|
|
261
|
+
ttl: this.DEFAULT_CACHE_TTL
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Detect the current workflow phase from context
|
|
266
|
+
*/
|
|
267
|
+
async detect(context) {
|
|
268
|
+
const startTime = Date.now();
|
|
269
|
+
const evidence = [];
|
|
270
|
+
// 1. Keyword Analysis (40% weight)
|
|
271
|
+
const keywordEvidence = this.analyzeKeywords(context.userPrompt);
|
|
272
|
+
evidence.push(...keywordEvidence);
|
|
273
|
+
// 2. Command Analysis (30% weight)
|
|
274
|
+
if (context.recentCommands && context.recentCommands.length > 0) {
|
|
275
|
+
const commandEvidence = this.analyzeCommands(context.recentCommands);
|
|
276
|
+
evidence.push(...commandEvidence);
|
|
277
|
+
}
|
|
278
|
+
// 3. Context Analysis (20% weight)
|
|
279
|
+
const contextEvidence = await this.analyzeContext(context);
|
|
280
|
+
evidence.push(...contextEvidence);
|
|
281
|
+
// 4. Hint Analysis (10% weight)
|
|
282
|
+
if (context.explicitHint) {
|
|
283
|
+
const hintEvidence = this.analyzeHint(context.explicitHint);
|
|
284
|
+
evidence.push(...hintEvidence);
|
|
285
|
+
}
|
|
286
|
+
// Calculate phase scores
|
|
287
|
+
const phaseScores = this.calculatePhaseScores(evidence);
|
|
288
|
+
// Get top phase and alternatives
|
|
289
|
+
const sortedPhases = Object.entries(phaseScores)
|
|
290
|
+
.map(([phase, score]) => ({ phase: phase, score }))
|
|
291
|
+
.sort((a, b) => b.score - a.score);
|
|
292
|
+
const topPhase = sortedPhases[0];
|
|
293
|
+
const alternatives = sortedPhases
|
|
294
|
+
.slice(1, 4) // Top 3 alternatives
|
|
295
|
+
.map(p => ({
|
|
296
|
+
phase: p.phase,
|
|
297
|
+
confidence: p.score,
|
|
298
|
+
reason: `Score: ${p.score.toFixed(2)} (lower than primary phase)`
|
|
299
|
+
}));
|
|
300
|
+
// Generate suggestion
|
|
301
|
+
const suggestion = this.generateSuggestion(topPhase.phase, topPhase.score);
|
|
302
|
+
// Track performance
|
|
303
|
+
const elapsedTime = Date.now() - startTime;
|
|
304
|
+
this.detectionCount++;
|
|
305
|
+
this.totalDetectionTime += elapsedTime;
|
|
306
|
+
return {
|
|
307
|
+
phase: topPhase.phase,
|
|
308
|
+
confidence: topPhase.score,
|
|
309
|
+
evidence: evidence.filter(e => e.weight > 0), // Filter out zero-weight evidence
|
|
310
|
+
alternatives: this.config.includeAlternatives ? alternatives : [],
|
|
311
|
+
suggestedCommand: suggestion?.command,
|
|
312
|
+
suggestionReason: suggestion?.reason
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Analyze keywords in user prompt
|
|
317
|
+
*/
|
|
318
|
+
analyzeKeywords(userPrompt) {
|
|
319
|
+
const evidence = [];
|
|
320
|
+
const promptLower = userPrompt.toLowerCase();
|
|
321
|
+
for (const mapping of KEYWORD_MAPPINGS) {
|
|
322
|
+
const matchedKeywords = [];
|
|
323
|
+
for (const keyword of mapping.keywords) {
|
|
324
|
+
const keywordLower = keyword.toLowerCase();
|
|
325
|
+
if (promptLower.includes(keywordLower)) {
|
|
326
|
+
matchedKeywords.push(keyword);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
if (matchedKeywords.length > 0) {
|
|
330
|
+
// Weight = (base weight) * (mapping weight) * (number of matches)
|
|
331
|
+
const baseWeight = this.config.keywordWeight;
|
|
332
|
+
const weight = baseWeight * (mapping.weight || 1.0) * Math.min(matchedKeywords.length, 3) / 3;
|
|
333
|
+
evidence.push({
|
|
334
|
+
type: EvidenceType.KEYWORD,
|
|
335
|
+
description: `Keywords found: ${matchedKeywords.join(', ')}`,
|
|
336
|
+
weight,
|
|
337
|
+
source: `keyword: ${matchedKeywords[0]}`
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
return evidence;
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Analyze recent command history
|
|
345
|
+
*/
|
|
346
|
+
analyzeCommands(recentCommands) {
|
|
347
|
+
const evidence = [];
|
|
348
|
+
// Most recent command has highest weight
|
|
349
|
+
const weights = [1.0, 0.7, 0.5, 0.3, 0.2]; // Decay for older commands
|
|
350
|
+
for (let i = 0; i < Math.min(recentCommands.length, 5); i++) {
|
|
351
|
+
const command = recentCommands[i];
|
|
352
|
+
const recencyWeight = weights[i];
|
|
353
|
+
for (const mapping of COMMAND_MAPPINGS) {
|
|
354
|
+
if (command.includes(mapping.commandPattern)) {
|
|
355
|
+
const baseWeight = this.config.commandWeight;
|
|
356
|
+
const weight = baseWeight * (mapping.weight || 1.0) * recencyWeight;
|
|
357
|
+
evidence.push({
|
|
358
|
+
type: EvidenceType.COMMAND,
|
|
359
|
+
description: `Recent command: ${command}`,
|
|
360
|
+
weight,
|
|
361
|
+
source: `command: ${mapping.commandPattern}`
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
return evidence;
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Analyze explicit user hint
|
|
370
|
+
*/
|
|
371
|
+
analyzeHint(hint) {
|
|
372
|
+
const evidence = [];
|
|
373
|
+
const hintLower = hint.toLowerCase();
|
|
374
|
+
// Check for phase names directly mentioned
|
|
375
|
+
for (const phase of Object.values(WorkflowPhase)) {
|
|
376
|
+
if (hintLower.includes(phase) || hintLower.includes(phase.replace('-', ' '))) {
|
|
377
|
+
evidence.push({
|
|
378
|
+
type: EvidenceType.USER_HINT,
|
|
379
|
+
description: `Explicit phase hint: ${phase}`,
|
|
380
|
+
weight: this.config.hintWeight * 2.0, // Strong signal
|
|
381
|
+
source: `hint: ${phase}`
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
return evidence;
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Analyze context (file states and increment status)
|
|
389
|
+
*/
|
|
390
|
+
async analyzeContext(context) {
|
|
391
|
+
const evidence = [];
|
|
392
|
+
// Determine working directory
|
|
393
|
+
const workingDir = context.workingDirectory || process.cwd();
|
|
394
|
+
// Check if we're in a SpecWeave project
|
|
395
|
+
const specweaveDir = path.join(workingDir, '.specweave');
|
|
396
|
+
if (!fs.existsSync(specweaveDir)) {
|
|
397
|
+
// Not in a SpecWeave project, no context evidence
|
|
398
|
+
return evidence;
|
|
399
|
+
}
|
|
400
|
+
// If incrementId provided, analyze increment-specific context
|
|
401
|
+
if (context.incrementId) {
|
|
402
|
+
const incrementDir = path.join(specweaveDir, 'increments', context.incrementId);
|
|
403
|
+
if (fs.existsSync(incrementDir)) {
|
|
404
|
+
// Analyze file states
|
|
405
|
+
const fileStates = this.getFileStates(incrementDir);
|
|
406
|
+
const fileEvidence = this.analyzeFileStates(fileStates);
|
|
407
|
+
evidence.push(...fileEvidence);
|
|
408
|
+
// Analyze increment metadata
|
|
409
|
+
try {
|
|
410
|
+
const metadata = MetadataManager.read(context.incrementId);
|
|
411
|
+
const statusEvidence = this.analyzeIncrementStatus(metadata.status);
|
|
412
|
+
evidence.push(...statusEvidence);
|
|
413
|
+
}
|
|
414
|
+
catch (error) {
|
|
415
|
+
// Metadata not found or invalid, skip status evidence
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
return evidence;
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Get file states for key increment files (with caching)
|
|
423
|
+
*/
|
|
424
|
+
getFileStates(incrementDir) {
|
|
425
|
+
// Check cache first
|
|
426
|
+
const cached = this.getCachedFileStates(incrementDir);
|
|
427
|
+
if (cached) {
|
|
428
|
+
return cached;
|
|
429
|
+
}
|
|
430
|
+
// Cache miss, compute file states
|
|
431
|
+
const files = ['spec.md', 'plan.md', 'tasks.md'];
|
|
432
|
+
const states = [];
|
|
433
|
+
for (const file of files) {
|
|
434
|
+
const filePath = path.join(incrementDir, file);
|
|
435
|
+
const exists = fs.existsSync(filePath);
|
|
436
|
+
if (exists) {
|
|
437
|
+
const stats = fs.statSync(filePath);
|
|
438
|
+
const isEmpty = stats.size === 0;
|
|
439
|
+
states.push({
|
|
440
|
+
path: file,
|
|
441
|
+
exists: true,
|
|
442
|
+
empty: isEmpty,
|
|
443
|
+
lastModified: stats.mtime
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
else {
|
|
447
|
+
states.push({
|
|
448
|
+
path: file,
|
|
449
|
+
exists: false
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
// Cache the result
|
|
454
|
+
this.cacheFileStates(incrementDir, states);
|
|
455
|
+
return states;
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Analyze file states to determine likely phase
|
|
459
|
+
*/
|
|
460
|
+
analyzeFileStates(fileStates) {
|
|
461
|
+
const evidence = [];
|
|
462
|
+
const specExists = fileStates.find(f => f.path === 'spec.md')?.exists || false;
|
|
463
|
+
const planExists = fileStates.find(f => f.path === 'plan.md')?.exists || false;
|
|
464
|
+
const tasksExist = fileStates.find(f => f.path === 'tasks.md')?.exists || false;
|
|
465
|
+
const specEmpty = fileStates.find(f => f.path === 'spec.md')?.empty || false;
|
|
466
|
+
const planEmpty = fileStates.find(f => f.path === 'plan.md')?.empty || false;
|
|
467
|
+
// Spec exists but empty → SPEC_WRITING
|
|
468
|
+
if (specExists && specEmpty) {
|
|
469
|
+
evidence.push({
|
|
470
|
+
type: EvidenceType.FILE_STATE,
|
|
471
|
+
description: 'spec.md exists but is empty',
|
|
472
|
+
weight: this.config.contextWeight * 1.3,
|
|
473
|
+
source: 'file-state: spec-empty'
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
// Spec exists but plan doesn't → PLAN_GENERATION
|
|
477
|
+
if (specExists && !specEmpty && !planExists) {
|
|
478
|
+
evidence.push({
|
|
479
|
+
type: EvidenceType.FILE_STATE,
|
|
480
|
+
description: 'spec.md exists, plan.md missing',
|
|
481
|
+
weight: this.config.contextWeight * 1.5,
|
|
482
|
+
source: 'file-state: plan-missing'
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
// Plan exists but empty → PLAN_GENERATION
|
|
486
|
+
if (planExists && planEmpty) {
|
|
487
|
+
evidence.push({
|
|
488
|
+
type: EvidenceType.FILE_STATE,
|
|
489
|
+
description: 'plan.md exists but is empty',
|
|
490
|
+
weight: this.config.contextWeight * 1.2,
|
|
491
|
+
source: 'file-state: plan-empty'
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
// Plan exists but tasks don't → TASK_BREAKDOWN
|
|
495
|
+
if (planExists && !planEmpty && !tasksExist) {
|
|
496
|
+
evidence.push({
|
|
497
|
+
type: EvidenceType.FILE_STATE,
|
|
498
|
+
description: 'plan.md exists, tasks.md missing',
|
|
499
|
+
weight: this.config.contextWeight * 1.4,
|
|
500
|
+
source: 'file-state: tasks-missing'
|
|
501
|
+
});
|
|
502
|
+
}
|
|
503
|
+
// All files exist → likely IMPLEMENTATION or TESTING
|
|
504
|
+
if (specExists && planExists && tasksExist && !specEmpty && !planEmpty) {
|
|
505
|
+
evidence.push({
|
|
506
|
+
type: EvidenceType.FILE_STATE,
|
|
507
|
+
description: 'All increment files present',
|
|
508
|
+
weight: this.config.contextWeight * 1.0,
|
|
509
|
+
source: 'file-state: all-present'
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
return evidence;
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Analyze increment status to determine likely phase
|
|
516
|
+
*/
|
|
517
|
+
analyzeIncrementStatus(status) {
|
|
518
|
+
const evidence = [];
|
|
519
|
+
switch (status.toLowerCase()) {
|
|
520
|
+
case 'planning':
|
|
521
|
+
evidence.push({
|
|
522
|
+
type: EvidenceType.INCREMENT_STATUS,
|
|
523
|
+
description: 'Increment status: PLANNING',
|
|
524
|
+
weight: this.config.contextWeight * 1.3,
|
|
525
|
+
source: 'status: planning'
|
|
526
|
+
});
|
|
527
|
+
break;
|
|
528
|
+
case 'active':
|
|
529
|
+
evidence.push({
|
|
530
|
+
type: EvidenceType.INCREMENT_STATUS,
|
|
531
|
+
description: 'Increment status: ACTIVE',
|
|
532
|
+
weight: this.config.contextWeight * 1.2,
|
|
533
|
+
source: 'status: active'
|
|
534
|
+
});
|
|
535
|
+
break;
|
|
536
|
+
case 'paused':
|
|
537
|
+
evidence.push({
|
|
538
|
+
type: EvidenceType.INCREMENT_STATUS,
|
|
539
|
+
description: 'Increment status: PAUSED',
|
|
540
|
+
weight: this.config.contextWeight * 0.8,
|
|
541
|
+
source: 'status: paused'
|
|
542
|
+
});
|
|
543
|
+
break;
|
|
544
|
+
case 'completed':
|
|
545
|
+
evidence.push({
|
|
546
|
+
type: EvidenceType.INCREMENT_STATUS,
|
|
547
|
+
description: 'Increment status: COMPLETED',
|
|
548
|
+
weight: this.config.contextWeight * 1.5,
|
|
549
|
+
source: 'status: completed'
|
|
550
|
+
});
|
|
551
|
+
break;
|
|
552
|
+
}
|
|
553
|
+
return evidence;
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* Calculate aggregated phase scores from evidence
|
|
557
|
+
*/
|
|
558
|
+
calculatePhaseScores(evidence) {
|
|
559
|
+
const scores = {};
|
|
560
|
+
// Initialize all phases to 0
|
|
561
|
+
for (const phase of Object.values(WorkflowPhase)) {
|
|
562
|
+
scores[phase] = 0;
|
|
563
|
+
}
|
|
564
|
+
// Group evidence by phase
|
|
565
|
+
const evidenceByPhase = this.groupEvidenceByPhase(evidence);
|
|
566
|
+
// Calculate score for each phase
|
|
567
|
+
for (const [phase, phaseEvidence] of Object.entries(evidenceByPhase)) {
|
|
568
|
+
const totalWeight = phaseEvidence.reduce((sum, e) => sum + e.weight, 0);
|
|
569
|
+
scores[phase] = Math.min(totalWeight, 1.0); // Cap at 1.0
|
|
570
|
+
}
|
|
571
|
+
return scores;
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* Group evidence by the phase it suggests
|
|
575
|
+
*/
|
|
576
|
+
groupEvidenceByPhase(evidence) {
|
|
577
|
+
const grouped = {};
|
|
578
|
+
for (const ev of evidence) {
|
|
579
|
+
// Extract phase from source (e.g., "keyword: implement" -> IMPLEMENTATION)
|
|
580
|
+
const phase = this.inferPhaseFromSource(ev.source);
|
|
581
|
+
if (phase) {
|
|
582
|
+
if (!grouped[phase]) {
|
|
583
|
+
grouped[phase] = [];
|
|
584
|
+
}
|
|
585
|
+
grouped[phase].push(ev);
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
return grouped;
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* Infer workflow phase from evidence source
|
|
592
|
+
*/
|
|
593
|
+
inferPhaseFromSource(source) {
|
|
594
|
+
// Source format: "keyword: <keyword>" or "command: <command>" or "file-state: <state>" or "status: <status>"
|
|
595
|
+
const [type, value] = source.split(': ');
|
|
596
|
+
if (type === 'keyword') {
|
|
597
|
+
// Find keyword mapping
|
|
598
|
+
for (const mapping of KEYWORD_MAPPINGS) {
|
|
599
|
+
if (mapping.keywords.some(k => k.toLowerCase() === value.toLowerCase())) {
|
|
600
|
+
return mapping.phase;
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
else if (type === 'command') {
|
|
605
|
+
// Find command mapping
|
|
606
|
+
for (const mapping of COMMAND_MAPPINGS) {
|
|
607
|
+
if (value.includes(mapping.commandPattern)) {
|
|
608
|
+
return mapping.phase;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
else if (type === 'hint') {
|
|
613
|
+
// Hint directly contains phase name
|
|
614
|
+
return value;
|
|
615
|
+
}
|
|
616
|
+
else if (type === 'file-state') {
|
|
617
|
+
// Map file states to phases
|
|
618
|
+
switch (value) {
|
|
619
|
+
case 'spec-empty':
|
|
620
|
+
return WorkflowPhase.SPEC_WRITING;
|
|
621
|
+
case 'plan-missing':
|
|
622
|
+
case 'plan-empty':
|
|
623
|
+
return WorkflowPhase.PLAN_GENERATION;
|
|
624
|
+
case 'tasks-missing':
|
|
625
|
+
return WorkflowPhase.TASK_BREAKDOWN;
|
|
626
|
+
case 'all-present':
|
|
627
|
+
return WorkflowPhase.IMPLEMENTATION;
|
|
628
|
+
default:
|
|
629
|
+
return null;
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
else if (type === 'status') {
|
|
633
|
+
// Map increment status to phases
|
|
634
|
+
switch (value) {
|
|
635
|
+
case 'planning':
|
|
636
|
+
return WorkflowPhase.PLAN_GENERATION;
|
|
637
|
+
case 'active':
|
|
638
|
+
return WorkflowPhase.IMPLEMENTATION;
|
|
639
|
+
case 'completed':
|
|
640
|
+
return WorkflowPhase.COMPLETION;
|
|
641
|
+
case 'paused':
|
|
642
|
+
// Paused doesn't indicate a specific phase
|
|
643
|
+
return null;
|
|
644
|
+
default:
|
|
645
|
+
return null;
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
return null;
|
|
649
|
+
}
|
|
650
|
+
/**
|
|
651
|
+
* Generate command suggestion based on detected phase
|
|
652
|
+
*/
|
|
653
|
+
generateSuggestion(phase, confidence) {
|
|
654
|
+
// Only suggest if confidence is above threshold
|
|
655
|
+
if (confidence < this.config.confidenceThreshold) {
|
|
656
|
+
return null;
|
|
657
|
+
}
|
|
658
|
+
switch (phase) {
|
|
659
|
+
case WorkflowPhase.SPEC_WRITING:
|
|
660
|
+
return {
|
|
661
|
+
command: '/specweave:increment',
|
|
662
|
+
reason: 'Create new increment with spec.md template'
|
|
663
|
+
};
|
|
664
|
+
case WorkflowPhase.PLAN_GENERATION:
|
|
665
|
+
return {
|
|
666
|
+
command: '/specweave:plan',
|
|
667
|
+
reason: 'Generate implementation plan from spec.md'
|
|
668
|
+
};
|
|
669
|
+
case WorkflowPhase.TASK_BREAKDOWN:
|
|
670
|
+
return {
|
|
671
|
+
command: '/specweave:plan',
|
|
672
|
+
reason: 'Generate tasks.md with embedded test plans'
|
|
673
|
+
};
|
|
674
|
+
case WorkflowPhase.IMPLEMENTATION:
|
|
675
|
+
return {
|
|
676
|
+
command: '/specweave:do',
|
|
677
|
+
reason: 'Execute tasks from tasks.md'
|
|
678
|
+
};
|
|
679
|
+
case WorkflowPhase.TESTING:
|
|
680
|
+
return {
|
|
681
|
+
command: '/specweave:test',
|
|
682
|
+
reason: 'Run test suite and validate coverage'
|
|
683
|
+
};
|
|
684
|
+
case WorkflowPhase.DOCUMENTATION:
|
|
685
|
+
return {
|
|
686
|
+
command: '/specweave:sync-docs',
|
|
687
|
+
reason: 'Sync increment to living documentation'
|
|
688
|
+
};
|
|
689
|
+
case WorkflowPhase.REVIEW:
|
|
690
|
+
return {
|
|
691
|
+
command: '/specweave:qa',
|
|
692
|
+
reason: 'Run quality assessment on increment'
|
|
693
|
+
};
|
|
694
|
+
case WorkflowPhase.COMPLETION:
|
|
695
|
+
return {
|
|
696
|
+
command: '/specweave:done',
|
|
697
|
+
reason: 'Close increment and update status'
|
|
698
|
+
};
|
|
699
|
+
default:
|
|
700
|
+
return null;
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
//# sourceMappingURL=phase-detector.js.map
|