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,545 @@
|
|
|
1
|
+
import fs from "fs-extra";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { execFileNoThrow } from "../../../src/utils/execFileNoThrow.js";
|
|
4
|
+
import { CodeValidator } from "./CodeValidator.js";
|
|
5
|
+
class ThreeLayerSyncManager {
|
|
6
|
+
constructor(projectRoot = process.cwd()) {
|
|
7
|
+
this.userStoryFileCache = /* @__PURE__ */ new Map();
|
|
8
|
+
this.projectRoot = projectRoot;
|
|
9
|
+
this.codeValidator = new CodeValidator({ projectRoot });
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Clear User Story file cache
|
|
13
|
+
* Call this when file structure changes or for testing
|
|
14
|
+
*/
|
|
15
|
+
clearCache() {
|
|
16
|
+
this.userStoryFileCache.clear();
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Sync from GitHub to Increment (Flow 1: GitHub → Living Docs → Increment)
|
|
20
|
+
*
|
|
21
|
+
* Triggered when stakeholder checks AC/Task checkbox in GitHub issue.
|
|
22
|
+
*/
|
|
23
|
+
async syncGitHubToIncrement(issueNumber, incrementPath, livingDocsPath) {
|
|
24
|
+
const result = {
|
|
25
|
+
acsUpdated: 0,
|
|
26
|
+
tasksUpdated: 0,
|
|
27
|
+
tasksReopened: 0,
|
|
28
|
+
conflicts: [],
|
|
29
|
+
errors: []
|
|
30
|
+
};
|
|
31
|
+
try {
|
|
32
|
+
console.log(`\u{1F504} Syncing GitHub issue #${issueNumber} \u2192 Increment`);
|
|
33
|
+
const githubState = await this.fetchGitHubIssueState(issueNumber);
|
|
34
|
+
const githubAcs = this.extractAcsFromIssue(githubState.body);
|
|
35
|
+
const githubTasks = this.extractTasksFromIssue(githubState.body);
|
|
36
|
+
const acUpdatePromises = githubAcs.map(async (ac) => {
|
|
37
|
+
const userStoryPath = await this.findUserStoryFile(livingDocsPath, ac.userStoryId);
|
|
38
|
+
if (userStoryPath) {
|
|
39
|
+
await this.updateUserStoryAc(userStoryPath, ac.id, ac.completed);
|
|
40
|
+
result.acsUpdated++;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
const taskUpdatePromises = githubTasks.map(async (task) => {
|
|
44
|
+
const userStoryPath = await this.findUserStoryFileForTask(livingDocsPath, task.id);
|
|
45
|
+
if (userStoryPath) {
|
|
46
|
+
await this.updateUserStoryTask(userStoryPath, task.id, task.completed);
|
|
47
|
+
result.tasksUpdated++;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
await Promise.all([...acUpdatePromises, ...taskUpdatePromises]);
|
|
51
|
+
await this.updateIncrementAcsWithConflictResolution(incrementPath, githubAcs, result);
|
|
52
|
+
await this.updateIncrementTasksWithConflictResolution(incrementPath, githubTasks, result);
|
|
53
|
+
const completedTasks = githubTasks.filter((t) => t.completed);
|
|
54
|
+
const validationPromises = completedTasks.map(async (task) => {
|
|
55
|
+
const codeExists = await this.validateCodeExists(task);
|
|
56
|
+
if (!codeExists) {
|
|
57
|
+
console.log(`\u26A0\uFE0F Task ${task.id} marked complete but code missing - reopening`);
|
|
58
|
+
await this.reopenTask(task.id, incrementPath, livingDocsPath, issueNumber);
|
|
59
|
+
result.tasksReopened++;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
await Promise.all(validationPromises);
|
|
63
|
+
console.log(`\u2705 Sync complete: ${result.acsUpdated} ACs, ${result.tasksUpdated} tasks updated`);
|
|
64
|
+
if (result.tasksReopened > 0) {
|
|
65
|
+
console.log(` ${result.tasksReopened} tasks reopened due to missing code`);
|
|
66
|
+
}
|
|
67
|
+
} catch (error) {
|
|
68
|
+
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
69
|
+
result.errors.push(errorMsg);
|
|
70
|
+
console.error(`\u274C Error syncing GitHub \u2192 Increment:`, error);
|
|
71
|
+
}
|
|
72
|
+
return result;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Sync from Increment to GitHub (Flow 2: Increment → Living Docs → GitHub)
|
|
76
|
+
*
|
|
77
|
+
* Triggered when developer completes work and updates increment files.
|
|
78
|
+
*/
|
|
79
|
+
async syncIncrementToGitHub(incrementPath, livingDocsPath, issueNumber) {
|
|
80
|
+
const result = {
|
|
81
|
+
acsUpdated: 0,
|
|
82
|
+
tasksUpdated: 0,
|
|
83
|
+
tasksReopened: 0,
|
|
84
|
+
conflicts: [],
|
|
85
|
+
errors: []
|
|
86
|
+
};
|
|
87
|
+
try {
|
|
88
|
+
console.log(`\u{1F504} Syncing Increment \u2192 GitHub issue #${issueNumber}`);
|
|
89
|
+
const specPath = path.join(incrementPath, "spec.md");
|
|
90
|
+
const tasksPath = path.join(incrementPath, "tasks.md");
|
|
91
|
+
const specContent = await fs.readFile(specPath, "utf-8");
|
|
92
|
+
const tasksContent = await fs.readFile(tasksPath, "utf-8");
|
|
93
|
+
const acs = this.parseAcceptanceCriteria(specContent);
|
|
94
|
+
const tasks = this.parseTasks(tasksContent);
|
|
95
|
+
const acsByUserStory = this.groupAcsByUserStory(acs);
|
|
96
|
+
for (const [userStoryId, userStoryAcs] of Object.entries(acsByUserStory)) {
|
|
97
|
+
const userStoryPath = await this.findUserStoryFile(livingDocsPath, userStoryId);
|
|
98
|
+
if (userStoryPath) {
|
|
99
|
+
await this.updateUserStoryAcs(userStoryPath, userStoryAcs);
|
|
100
|
+
result.acsUpdated += userStoryAcs.length;
|
|
101
|
+
const acIds = userStoryAcs.map((ac) => ac.id);
|
|
102
|
+
const userStoryTasks = this.filterTasksByAcIds(tasks, acIds);
|
|
103
|
+
await this.updateUserStoryTasks(userStoryPath, userStoryTasks);
|
|
104
|
+
result.tasksUpdated += userStoryTasks.length;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
await this.updateGitHubIssue(issueNumber, acs, tasks);
|
|
108
|
+
console.log(`\u2705 Sync complete: ${result.acsUpdated} ACs, ${result.tasksUpdated} tasks updated`);
|
|
109
|
+
} catch (error) {
|
|
110
|
+
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
111
|
+
result.errors.push(errorMsg);
|
|
112
|
+
console.error(`\u274C Error syncing Increment \u2192 GitHub:`, error);
|
|
113
|
+
}
|
|
114
|
+
return result;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Validate that code exists for completed task
|
|
118
|
+
* Uses CodeValidator for comprehensive validation
|
|
119
|
+
*/
|
|
120
|
+
async validateCodeExists(task) {
|
|
121
|
+
const validationResult = await this.codeValidator.validateTask(task.title, task.id);
|
|
122
|
+
return validationResult.valid;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Reopen task if code validation fails
|
|
126
|
+
*/
|
|
127
|
+
async reopenTask(taskId, incrementPath, livingDocsPath, issueNumber) {
|
|
128
|
+
const tasksPath = path.join(incrementPath, "tasks.md");
|
|
129
|
+
let tasksContent = await fs.readFile(tasksPath, "utf-8");
|
|
130
|
+
const taskRegex = new RegExp(`(### ${taskId}:[^#]*?)\\*\\*Completed\\*\\*:[^\\n]*\\n`, "s");
|
|
131
|
+
tasksContent = tasksContent.replace(taskRegex, "$1");
|
|
132
|
+
await fs.writeFile(tasksPath, tasksContent, "utf-8");
|
|
133
|
+
const userStoryPath = await this.findUserStoryFileForTask(livingDocsPath, taskId);
|
|
134
|
+
if (userStoryPath) {
|
|
135
|
+
await this.updateUserStoryTask(userStoryPath, taskId, false);
|
|
136
|
+
}
|
|
137
|
+
await this.addGitHubComment(
|
|
138
|
+
issueNumber,
|
|
139
|
+
`\u26A0\uFE0F Task ${taskId} reopened: Code validation failed (missing or empty file). Please implement the required code.`
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Propagate completion from Tasks → ACs → User Stories (bottom-up)
|
|
144
|
+
*/
|
|
145
|
+
async propagateCompletion(incrementPath, livingDocsPath) {
|
|
146
|
+
const specPath = path.join(incrementPath, "spec.md");
|
|
147
|
+
const tasksPath = path.join(incrementPath, "tasks.md");
|
|
148
|
+
const specContent = await fs.readFile(specPath, "utf-8");
|
|
149
|
+
const tasksContent = await fs.readFile(tasksPath, "utf-8");
|
|
150
|
+
const acs = this.parseAcceptanceCriteria(specContent);
|
|
151
|
+
const tasks = this.parseTasks(tasksContent);
|
|
152
|
+
for (const ac of acs) {
|
|
153
|
+
const acTasks = tasks.filter((t) => t.acIds.includes(ac.id));
|
|
154
|
+
const allTasksComplete = acTasks.length > 0 && acTasks.every((t) => t.completed);
|
|
155
|
+
if (allTasksComplete && !ac.completed) {
|
|
156
|
+
console.log(`\u2705 All tasks for ${ac.id} complete - marking AC as complete`);
|
|
157
|
+
await this.updateIncrementAc(incrementPath, ac.id, true);
|
|
158
|
+
const userStoryPath = await this.findUserStoryFile(livingDocsPath, ac.userStoryId);
|
|
159
|
+
if (userStoryPath) {
|
|
160
|
+
await this.updateUserStoryAc(userStoryPath, ac.id, true);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
const acsByUserStory = this.groupAcsByUserStory(acs);
|
|
165
|
+
for (const [userStoryId, userStoryAcs] of Object.entries(acsByUserStory)) {
|
|
166
|
+
const allAcsComplete = userStoryAcs.every((ac) => ac.completed);
|
|
167
|
+
if (allAcsComplete) {
|
|
168
|
+
console.log(`\u2705 All ACs for ${userStoryId} complete - User Story complete`);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
// ==================== Helper Methods ====================
|
|
173
|
+
/**
|
|
174
|
+
* Fetch GitHub issue state
|
|
175
|
+
*/
|
|
176
|
+
async fetchGitHubIssueState(issueNumber) {
|
|
177
|
+
const result = await execFileNoThrow("gh", [
|
|
178
|
+
"issue",
|
|
179
|
+
"view",
|
|
180
|
+
String(issueNumber),
|
|
181
|
+
"--json",
|
|
182
|
+
"body,state"
|
|
183
|
+
]);
|
|
184
|
+
if (result.stderr) {
|
|
185
|
+
throw new Error(`Failed to fetch GitHub issue: ${result.stderr}`);
|
|
186
|
+
}
|
|
187
|
+
return JSON.parse(result.stdout);
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Extract ACs from GitHub issue body
|
|
191
|
+
*/
|
|
192
|
+
extractAcsFromIssue(body) {
|
|
193
|
+
const acs = [];
|
|
194
|
+
const lines = body.split("\n");
|
|
195
|
+
const acRegex = /^- \[([ x])\] (AC-[A-Z0-9]+-\d+):\s*(.+)$/;
|
|
196
|
+
for (const line of lines) {
|
|
197
|
+
const match = line.match(acRegex);
|
|
198
|
+
if (match) {
|
|
199
|
+
const completed = match[1] === "x";
|
|
200
|
+
const id = match[2];
|
|
201
|
+
const description = match[3];
|
|
202
|
+
const userStoryMatch = id.match(/AC-([A-Z0-9]+)-\d+/);
|
|
203
|
+
const userStoryId = userStoryMatch ? userStoryMatch[1] : "";
|
|
204
|
+
acs.push({
|
|
205
|
+
id,
|
|
206
|
+
userStoryId,
|
|
207
|
+
description,
|
|
208
|
+
completed,
|
|
209
|
+
projects: [],
|
|
210
|
+
rawLine: line
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return acs;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Extract Tasks from GitHub issue body
|
|
218
|
+
*/
|
|
219
|
+
extractTasksFromIssue(body) {
|
|
220
|
+
const tasks = [];
|
|
221
|
+
const lines = body.split("\n");
|
|
222
|
+
const taskRegex = /^- \[([ x])\] (T-\d+):\s*(.+)$/;
|
|
223
|
+
for (const line of lines) {
|
|
224
|
+
const match = line.match(taskRegex);
|
|
225
|
+
if (match) {
|
|
226
|
+
const completed = match[1] === "x";
|
|
227
|
+
const id = match[2];
|
|
228
|
+
const title = match[3];
|
|
229
|
+
tasks.push({
|
|
230
|
+
id,
|
|
231
|
+
title,
|
|
232
|
+
completed,
|
|
233
|
+
acIds: []
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return tasks;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Parse ACs from spec.md
|
|
241
|
+
*/
|
|
242
|
+
parseAcceptanceCriteria(specContent) {
|
|
243
|
+
const acs = [];
|
|
244
|
+
const lines = specContent.split("\n");
|
|
245
|
+
const acRegex = /^- \[([ x])\] (AC-[A-Z0-9]+-\d+):\s*(.+)$/;
|
|
246
|
+
for (const line of lines) {
|
|
247
|
+
const match = line.match(acRegex);
|
|
248
|
+
if (match) {
|
|
249
|
+
const completed = match[1] === "x";
|
|
250
|
+
const id = match[2];
|
|
251
|
+
const description = match[3];
|
|
252
|
+
const userStoryMatch = id.match(/AC-([A-Z0-9]+)-\d+/);
|
|
253
|
+
const userStoryId = userStoryMatch ? userStoryMatch[1] : "";
|
|
254
|
+
acs.push({
|
|
255
|
+
id,
|
|
256
|
+
userStoryId,
|
|
257
|
+
description,
|
|
258
|
+
completed,
|
|
259
|
+
projects: [],
|
|
260
|
+
rawLine: line
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
return acs;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Parse Tasks from tasks.md
|
|
268
|
+
*/
|
|
269
|
+
parseTasks(tasksContent) {
|
|
270
|
+
const tasks = [];
|
|
271
|
+
const lines = tasksContent.split("\n");
|
|
272
|
+
let currentTask = null;
|
|
273
|
+
for (const line of lines) {
|
|
274
|
+
const headerMatch = line.match(/^### (T-\d+):\s*(.+?)\s*\(P\d+\)$/);
|
|
275
|
+
if (headerMatch) {
|
|
276
|
+
if (currentTask && currentTask.id) {
|
|
277
|
+
tasks.push(currentTask);
|
|
278
|
+
}
|
|
279
|
+
currentTask = {
|
|
280
|
+
id: headerMatch[1],
|
|
281
|
+
title: headerMatch[2],
|
|
282
|
+
completed: false,
|
|
283
|
+
acIds: []
|
|
284
|
+
};
|
|
285
|
+
continue;
|
|
286
|
+
}
|
|
287
|
+
const completedMatch = line.match(/^\*\*Completed\*\*:\s*(.+)$/);
|
|
288
|
+
if (completedMatch && currentTask) {
|
|
289
|
+
currentTask.completed = true;
|
|
290
|
+
currentTask.completedDate = completedMatch[1];
|
|
291
|
+
}
|
|
292
|
+
const acMatch = line.match(/\*\*AC\*\*:\s*(.+)$/);
|
|
293
|
+
if (acMatch && currentTask) {
|
|
294
|
+
const acIds = acMatch[1].split(",").map((id) => id.trim());
|
|
295
|
+
currentTask.acIds = acIds;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
if (currentTask && currentTask.id) {
|
|
299
|
+
tasks.push(currentTask);
|
|
300
|
+
}
|
|
301
|
+
return tasks;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Group ACs by User Story ID
|
|
305
|
+
*/
|
|
306
|
+
groupAcsByUserStory(acs) {
|
|
307
|
+
const grouped = {};
|
|
308
|
+
for (const ac of acs) {
|
|
309
|
+
if (!grouped[ac.userStoryId]) {
|
|
310
|
+
grouped[ac.userStoryId] = [];
|
|
311
|
+
}
|
|
312
|
+
grouped[ac.userStoryId].push(ac);
|
|
313
|
+
}
|
|
314
|
+
return grouped;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Filter tasks by AC IDs
|
|
318
|
+
*/
|
|
319
|
+
filterTasksByAcIds(tasks, acIds) {
|
|
320
|
+
return tasks.filter(
|
|
321
|
+
(task) => task.acIds.some((acId) => acIds.includes(acId))
|
|
322
|
+
);
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Find User Story file by ID (with caching for performance)
|
|
326
|
+
*/
|
|
327
|
+
async findUserStoryFile(livingDocsPath, userStoryId) {
|
|
328
|
+
const cacheKey = `${livingDocsPath}:${userStoryId}`;
|
|
329
|
+
if (this.userStoryFileCache.has(cacheKey)) {
|
|
330
|
+
return this.userStoryFileCache.get(cacheKey);
|
|
331
|
+
}
|
|
332
|
+
const specsPath = path.join(livingDocsPath, "internal", "specs");
|
|
333
|
+
const pattern = `**/us-*${userStoryId.toLowerCase()}*.md`;
|
|
334
|
+
const { glob } = await import("glob");
|
|
335
|
+
const files = await glob(pattern, { cwd: specsPath, absolute: true });
|
|
336
|
+
const result = files.length > 0 ? files[0] : null;
|
|
337
|
+
this.userStoryFileCache.set(cacheKey, result);
|
|
338
|
+
return result;
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Find User Story file that contains specific task
|
|
342
|
+
*/
|
|
343
|
+
async findUserStoryFileForTask(livingDocsPath, taskId) {
|
|
344
|
+
const specsPath = path.join(livingDocsPath, "internal", "specs");
|
|
345
|
+
const { glob } = await import("glob");
|
|
346
|
+
const files = await glob("**/us-*.md", { cwd: specsPath, absolute: true });
|
|
347
|
+
for (const file of files) {
|
|
348
|
+
const content = await fs.readFile(file, "utf-8");
|
|
349
|
+
if (content.includes(taskId)) {
|
|
350
|
+
return file;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
return null;
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Update AC in User Story file
|
|
357
|
+
*/
|
|
358
|
+
async updateUserStoryAc(userStoryPath, acId, completed) {
|
|
359
|
+
let content = await fs.readFile(userStoryPath, "utf-8");
|
|
360
|
+
const checkboxState = completed ? "x" : " ";
|
|
361
|
+
const regex = new RegExp(`(- \\[)[ x](\\] ${acId}:)`, "g");
|
|
362
|
+
content = content.replace(regex, `$1${checkboxState}$2`);
|
|
363
|
+
await fs.writeFile(userStoryPath, content, "utf-8");
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Update Task in User Story file
|
|
367
|
+
*/
|
|
368
|
+
async updateUserStoryTask(userStoryPath, taskId, completed) {
|
|
369
|
+
let content = await fs.readFile(userStoryPath, "utf-8");
|
|
370
|
+
const checkboxState = completed ? "x" : " ";
|
|
371
|
+
const regex = new RegExp(`(- \\[)[ x](\\] ${taskId}:)`, "g");
|
|
372
|
+
content = content.replace(regex, `$1${checkboxState}$2`);
|
|
373
|
+
await fs.writeFile(userStoryPath, content, "utf-8");
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Update multiple ACs in User Story file
|
|
377
|
+
*/
|
|
378
|
+
async updateUserStoryAcs(userStoryPath, acs) {
|
|
379
|
+
let content = await fs.readFile(userStoryPath, "utf-8");
|
|
380
|
+
for (const ac of acs) {
|
|
381
|
+
const checkboxState = ac.completed ? "x" : " ";
|
|
382
|
+
const regex = new RegExp(`(- \\[)[ x](\\] ${ac.id}:)`, "g");
|
|
383
|
+
content = content.replace(regex, `$1${checkboxState}$2`);
|
|
384
|
+
}
|
|
385
|
+
await fs.writeFile(userStoryPath, content, "utf-8");
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Update multiple Tasks in User Story file
|
|
389
|
+
*/
|
|
390
|
+
async updateUserStoryTasks(userStoryPath, tasks) {
|
|
391
|
+
let content = await fs.readFile(userStoryPath, "utf-8");
|
|
392
|
+
for (const task of tasks) {
|
|
393
|
+
const checkboxState = task.completed ? "x" : " ";
|
|
394
|
+
const regex = new RegExp(`(- \\[)[ x](\\] ${task.id}:)`, "g");
|
|
395
|
+
content = content.replace(regex, `$1${checkboxState}$2`);
|
|
396
|
+
}
|
|
397
|
+
await fs.writeFile(userStoryPath, content, "utf-8");
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Update AC in increment spec.md
|
|
401
|
+
*/
|
|
402
|
+
async updateIncrementAc(incrementPath, acId, completed) {
|
|
403
|
+
const specPath = path.join(incrementPath, "spec.md");
|
|
404
|
+
let content = await fs.readFile(specPath, "utf-8");
|
|
405
|
+
const checkboxState = completed ? "x" : " ";
|
|
406
|
+
const regex = new RegExp(`(- \\[)[ x](\\] ${acId}:)`, "g");
|
|
407
|
+
content = content.replace(regex, `$1${checkboxState}$2`);
|
|
408
|
+
await fs.writeFile(specPath, content, "utf-8");
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Update multiple ACs in increment spec.md
|
|
412
|
+
*/
|
|
413
|
+
async updateIncrementAcs(incrementPath, acs) {
|
|
414
|
+
const specPath = path.join(incrementPath, "spec.md");
|
|
415
|
+
let content = await fs.readFile(specPath, "utf-8");
|
|
416
|
+
for (const ac of acs) {
|
|
417
|
+
const checkboxState = ac.completed ? "x" : " ";
|
|
418
|
+
const regex = new RegExp(`(- \\[)[ x](\\] ${ac.id}:)`, "g");
|
|
419
|
+
content = content.replace(regex, `$1${checkboxState}$2`);
|
|
420
|
+
}
|
|
421
|
+
await fs.writeFile(specPath, content, "utf-8");
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Update multiple Tasks in increment tasks.md
|
|
425
|
+
*/
|
|
426
|
+
async updateIncrementTasks(incrementPath, tasks) {
|
|
427
|
+
const tasksPath = path.join(incrementPath, "tasks.md");
|
|
428
|
+
let content = await fs.readFile(tasksPath, "utf-8");
|
|
429
|
+
for (const task of tasks) {
|
|
430
|
+
if (task.completed) {
|
|
431
|
+
const taskHeader = `### ${task.id}:`;
|
|
432
|
+
const completedMarker = `**Completed**: ${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}`;
|
|
433
|
+
if (!content.includes(`${taskHeader}`) || !content.includes(`**Completed**`)) {
|
|
434
|
+
const regex = new RegExp(`(### ${task.id}:[^#]*?)(###|$)`, "s");
|
|
435
|
+
content = content.replace(regex, `$1
|
|
436
|
+
${completedMarker}
|
|
437
|
+
|
|
438
|
+
$2`);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
await fs.writeFile(tasksPath, content, "utf-8");
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Update ACs in increment with conflict resolution (Increment wins)
|
|
446
|
+
*
|
|
447
|
+
* If GitHub and Increment disagree, Increment state wins as it's the source of truth.
|
|
448
|
+
* Conflicts are logged for transparency.
|
|
449
|
+
*/
|
|
450
|
+
async updateIncrementAcsWithConflictResolution(incrementPath, githubAcs, result) {
|
|
451
|
+
const specPath = path.join(incrementPath, "spec.md");
|
|
452
|
+
const currentContent = await fs.readFile(specPath, "utf-8");
|
|
453
|
+
const currentAcs = this.parseAcceptanceCriteria(currentContent);
|
|
454
|
+
let content = currentContent;
|
|
455
|
+
for (const githubAc of githubAcs) {
|
|
456
|
+
const currentAc = currentAcs.find((ac) => ac.id === githubAc.id);
|
|
457
|
+
if (currentAc && currentAc.completed !== githubAc.completed) {
|
|
458
|
+
const conflictMsg = `AC ${githubAc.id}: GitHub says ${githubAc.completed ? "complete" : "incomplete"}, Increment says ${currentAc.completed ? "complete" : "incomplete"} \u2192 Increment wins`;
|
|
459
|
+
result.conflicts.push(conflictMsg);
|
|
460
|
+
console.log(`\u26A0\uFE0F CONFLICT RESOLVED: ${conflictMsg}`);
|
|
461
|
+
continue;
|
|
462
|
+
}
|
|
463
|
+
const checkboxState = githubAc.completed ? "x" : " ";
|
|
464
|
+
const regex = new RegExp(`(- \\[)[ x](\\] ${githubAc.id}:)`, "g");
|
|
465
|
+
content = content.replace(regex, `$1${checkboxState}$2`);
|
|
466
|
+
}
|
|
467
|
+
await fs.writeFile(specPath, content, "utf-8");
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Update Tasks in increment with conflict resolution (Increment wins)
|
|
471
|
+
*/
|
|
472
|
+
async updateIncrementTasksWithConflictResolution(incrementPath, githubTasks, result) {
|
|
473
|
+
const tasksPath = path.join(incrementPath, "tasks.md");
|
|
474
|
+
const currentContent = await fs.readFile(tasksPath, "utf-8");
|
|
475
|
+
const currentTasks = this.parseTasks(currentContent);
|
|
476
|
+
let content = currentContent;
|
|
477
|
+
for (const githubTask of githubTasks) {
|
|
478
|
+
const currentTask = currentTasks.find((t) => t.id === githubTask.id);
|
|
479
|
+
if (currentTask && currentTask.completed !== githubTask.completed) {
|
|
480
|
+
const conflictMsg = `Task ${githubTask.id}: GitHub says ${githubTask.completed ? "complete" : "incomplete"}, Increment says ${currentTask.completed ? "complete" : "incomplete"} \u2192 Increment wins`;
|
|
481
|
+
result.conflicts.push(conflictMsg);
|
|
482
|
+
console.log(`\u26A0\uFE0F CONFLICT RESOLVED: ${conflictMsg}`);
|
|
483
|
+
continue;
|
|
484
|
+
}
|
|
485
|
+
if (githubTask.completed) {
|
|
486
|
+
const taskHeader = `### ${githubTask.id}:`;
|
|
487
|
+
const completedMarker = `**Completed**: ${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}`;
|
|
488
|
+
if (!content.includes(`${taskHeader}`) || !content.includes(`**Completed**`)) {
|
|
489
|
+
const regex = new RegExp(`(### ${githubTask.id}:[^#]*?)(###|$)`, "s");
|
|
490
|
+
content = content.replace(regex, `$1
|
|
491
|
+
${completedMarker}
|
|
492
|
+
|
|
493
|
+
$2`);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
await fs.writeFile(tasksPath, content, "utf-8");
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* Update GitHub issue with ACs and Tasks
|
|
501
|
+
*/
|
|
502
|
+
async updateGitHubIssue(issueNumber, acs, tasks) {
|
|
503
|
+
const result = await execFileNoThrow("gh", [
|
|
504
|
+
"issue",
|
|
505
|
+
"view",
|
|
506
|
+
String(issueNumber),
|
|
507
|
+
"--json",
|
|
508
|
+
"body"
|
|
509
|
+
]);
|
|
510
|
+
const { body } = JSON.parse(result.stdout);
|
|
511
|
+
let updatedBody = body;
|
|
512
|
+
for (const ac of acs) {
|
|
513
|
+
const checkboxState = ac.completed ? "x" : " ";
|
|
514
|
+
const regex = new RegExp(`(- \\[)[ x](\\] ${ac.id}:)`, "g");
|
|
515
|
+
updatedBody = updatedBody.replace(regex, `$1${checkboxState}$2`);
|
|
516
|
+
}
|
|
517
|
+
for (const task of tasks) {
|
|
518
|
+
const checkboxState = task.completed ? "x" : " ";
|
|
519
|
+
const regex = new RegExp(`(- \\[)[ x](\\] ${task.id}:)`, "g");
|
|
520
|
+
updatedBody = updatedBody.replace(regex, `$1${checkboxState}$2`);
|
|
521
|
+
}
|
|
522
|
+
await execFileNoThrow("gh", [
|
|
523
|
+
"issue",
|
|
524
|
+
"edit",
|
|
525
|
+
String(issueNumber),
|
|
526
|
+
"--body",
|
|
527
|
+
updatedBody
|
|
528
|
+
]);
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Add comment to GitHub issue
|
|
532
|
+
*/
|
|
533
|
+
async addGitHubComment(issueNumber, comment) {
|
|
534
|
+
await execFileNoThrow("gh", [
|
|
535
|
+
"issue",
|
|
536
|
+
"comment",
|
|
537
|
+
String(issueNumber),
|
|
538
|
+
"--body",
|
|
539
|
+
comment
|
|
540
|
+
]);
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
export {
|
|
544
|
+
ThreeLayerSyncManager
|
|
545
|
+
};
|