@bloomreach/brxm-upgrade 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +217 -0
- package/dist/ai/index.d.ts +3 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +2 -0
- package/dist/ai/index.js.map +1 -0
- package/dist/ai/providers.d.ts +27 -0
- package/dist/ai/providers.d.ts.map +1 -0
- package/dist/ai/providers.js +105 -0
- package/dist/ai/providers.js.map +1 -0
- package/dist/ai/types.d.ts +47 -0
- package/dist/ai/types.d.ts.map +1 -0
- package/dist/ai/types.js +2 -0
- package/dist/ai/types.js.map +1 -0
- package/dist/capture/change-scanner.d.ts +20 -0
- package/dist/capture/change-scanner.d.ts.map +1 -0
- package/dist/capture/change-scanner.js +71 -0
- package/dist/capture/change-scanner.js.map +1 -0
- package/dist/capture/conflict-resolver.d.ts +21 -0
- package/dist/capture/conflict-resolver.d.ts.map +1 -0
- package/dist/capture/conflict-resolver.js +45 -0
- package/dist/capture/conflict-resolver.js.map +1 -0
- package/dist/capture/critique-types.d.ts +60 -0
- package/dist/capture/critique-types.d.ts.map +1 -0
- package/dist/capture/critique-types.js +2 -0
- package/dist/capture/critique-types.js.map +1 -0
- package/dist/capture/entry-critique.d.ts +30 -0
- package/dist/capture/entry-critique.d.ts.map +1 -0
- package/dist/capture/entry-critique.js +137 -0
- package/dist/capture/entry-critique.js.map +1 -0
- package/dist/capture/entry-generator.d.ts +32 -0
- package/dist/capture/entry-generator.d.ts.map +1 -0
- package/dist/capture/entry-generator.js +209 -0
- package/dist/capture/entry-generator.js.map +1 -0
- package/dist/capture/entry-qa.d.ts +28 -0
- package/dist/capture/entry-qa.d.ts.map +1 -0
- package/dist/capture/entry-qa.js +84 -0
- package/dist/capture/entry-qa.js.map +1 -0
- package/dist/capture/entry-regeneration.d.ts +29 -0
- package/dist/capture/entry-regeneration.d.ts.map +1 -0
- package/dist/capture/entry-regeneration.js +164 -0
- package/dist/capture/entry-regeneration.js.map +1 -0
- package/dist/capture/entry-validator.d.ts +18 -0
- package/dist/capture/entry-validator.d.ts.map +1 -0
- package/dist/capture/entry-validator.js +47 -0
- package/dist/capture/entry-validator.js.map +1 -0
- package/dist/capture/heuristics.d.ts +30 -0
- package/dist/capture/heuristics.d.ts.map +1 -0
- package/dist/capture/heuristics.js +223 -0
- package/dist/capture/heuristics.js.map +1 -0
- package/dist/capture/index.d.ts +7 -0
- package/dist/capture/index.d.ts.map +1 -0
- package/dist/capture/index.js +11 -0
- package/dist/capture/index.js.map +1 -0
- package/dist/capture/quality-report.d.ts +19 -0
- package/dist/capture/quality-report.d.ts.map +1 -0
- package/dist/capture/quality-report.js +161 -0
- package/dist/capture/quality-report.js.map +1 -0
- package/dist/capture/review-flow.d.ts +37 -0
- package/dist/capture/review-flow.d.ts.map +1 -0
- package/dist/capture/review-flow.js +212 -0
- package/dist/capture/review-flow.js.map +1 -0
- package/dist/capture/types.d.ts +114 -0
- package/dist/capture/types.d.ts.map +1 -0
- package/dist/capture/types.js +2 -0
- package/dist/capture/types.js.map +1 -0
- package/dist/commands/discover.d.ts +6 -0
- package/dist/commands/discover.d.ts.map +1 -0
- package/dist/commands/discover.js +147 -0
- package/dist/commands/discover.js.map +1 -0
- package/dist/commands/execute.d.ts +12 -0
- package/dist/commands/execute.d.ts.map +1 -0
- package/dist/commands/execute.js +113 -0
- package/dist/commands/execute.js.map +1 -0
- package/dist/commands/export.d.ts +26 -0
- package/dist/commands/export.d.ts.map +1 -0
- package/dist/commands/export.js +291 -0
- package/dist/commands/export.js.map +1 -0
- package/dist/commands/finalize.d.ts +12 -0
- package/dist/commands/finalize.d.ts.map +1 -0
- package/dist/commands/finalize.js +225 -0
- package/dist/commands/finalize.js.map +1 -0
- package/dist/commands/guide.d.ts +12 -0
- package/dist/commands/guide.d.ts.map +1 -0
- package/dist/commands/guide.js +28 -0
- package/dist/commands/guide.js.map +1 -0
- package/dist/commands/index.d.ts +6 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +22 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/log-change.d.ts +14 -0
- package/dist/commands/log-change.d.ts.map +1 -0
- package/dist/commands/log-change.js +243 -0
- package/dist/commands/log-change.js.map +1 -0
- package/dist/commands/plan.d.ts +12 -0
- package/dist/commands/plan.d.ts.map +1 -0
- package/dist/commands/plan.js +162 -0
- package/dist/commands/plan.js.map +1 -0
- package/dist/commands/review-manifest.d.ts +39 -0
- package/dist/commands/review-manifest.d.ts.map +1 -0
- package/dist/commands/review-manifest.js +178 -0
- package/dist/commands/review-manifest.js.map +1 -0
- package/dist/commands/setup-manifests.d.ts +12 -0
- package/dist/commands/setup-manifests.d.ts.map +1 -0
- package/dist/commands/setup-manifests.js +229 -0
- package/dist/commands/setup-manifests.js.map +1 -0
- package/dist/config/defaults.d.ts +15 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/defaults.js +36 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/index.d.ts +17 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +104 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/schema.d.ts +33 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +110 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/core/index.d.ts +12 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +16 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/phase-manager.d.ts +53 -0
- package/dist/core/phase-manager.d.ts.map +1 -0
- package/dist/core/phase-manager.js +124 -0
- package/dist/core/phase-manager.js.map +1 -0
- package/dist/core/upgrade-state.d.ts +24 -0
- package/dist/core/upgrade-state.d.ts.map +1 -0
- package/dist/core/upgrade-state.js +32 -0
- package/dist/core/upgrade-state.js.map +1 -0
- package/dist/discovery/index.d.ts +5 -0
- package/dist/discovery/index.d.ts.map +1 -0
- package/dist/discovery/index.js +4 -0
- package/dist/discovery/index.js.map +1 -0
- package/dist/discovery/orchestrator.d.ts +46 -0
- package/dist/discovery/orchestrator.d.ts.map +1 -0
- package/dist/discovery/orchestrator.js +124 -0
- package/dist/discovery/orchestrator.js.map +1 -0
- package/dist/discovery/scanners/config-detector.d.ts +24 -0
- package/dist/discovery/scanners/config-detector.d.ts.map +1 -0
- package/dist/discovery/scanners/config-detector.js +82 -0
- package/dist/discovery/scanners/config-detector.js.map +1 -0
- package/dist/discovery/scanners/cv-scanner.d.ts +30 -0
- package/dist/discovery/scanners/cv-scanner.d.ts.map +1 -0
- package/dist/discovery/scanners/cv-scanner.js +85 -0
- package/dist/discovery/scanners/cv-scanner.js.map +1 -0
- package/dist/discovery/scanners/index.d.ts +6 -0
- package/dist/discovery/scanners/index.d.ts.map +1 -0
- package/dist/discovery/scanners/index.js +6 -0
- package/dist/discovery/scanners/index.js.map +1 -0
- package/dist/discovery/scanners/maven-scanner.d.ts +33 -0
- package/dist/discovery/scanners/maven-scanner.d.ts.map +1 -0
- package/dist/discovery/scanners/maven-scanner.js +96 -0
- package/dist/discovery/scanners/maven-scanner.js.map +1 -0
- package/dist/discovery/scanners/repo-scanner.d.ts +9 -0
- package/dist/discovery/scanners/repo-scanner.d.ts.map +1 -0
- package/dist/discovery/scanners/repo-scanner.js +80 -0
- package/dist/discovery/scanners/repo-scanner.js.map +1 -0
- package/dist/discovery/scanners/version-resolver.d.ts +45 -0
- package/dist/discovery/scanners/version-resolver.d.ts.map +1 -0
- package/dist/discovery/scanners/version-resolver.js +119 -0
- package/dist/discovery/scanners/version-resolver.js.map +1 -0
- package/dist/discovery/types.d.ts +156 -0
- package/dist/discovery/types.d.ts.map +1 -0
- package/dist/discovery/types.js +2 -0
- package/dist/discovery/types.js.map +1 -0
- package/dist/discovery/validators/index.d.ts +2 -0
- package/dist/discovery/validators/index.d.ts.map +1 -0
- package/dist/discovery/validators/index.js +2 -0
- package/dist/discovery/validators/index.js.map +1 -0
- package/dist/discovery/validators/upgrade-validator.d.ts +34 -0
- package/dist/discovery/validators/upgrade-validator.d.ts.map +1 -0
- package/dist/discovery/validators/upgrade-validator.js +135 -0
- package/dist/discovery/validators/upgrade-validator.js.map +1 -0
- package/dist/docs/docs-client.d.ts +44 -0
- package/dist/docs/docs-client.d.ts.map +1 -0
- package/dist/docs/docs-client.js +161 -0
- package/dist/docs/docs-client.js.map +1 -0
- package/dist/docs/docs-context.d.ts +23 -0
- package/dist/docs/docs-context.d.ts.map +1 -0
- package/dist/docs/docs-context.js +41 -0
- package/dist/docs/docs-context.js.map +1 -0
- package/dist/docs/index.d.ts +4 -0
- package/dist/docs/index.d.ts.map +1 -0
- package/dist/docs/index.js +3 -0
- package/dist/docs/index.js.map +1 -0
- package/dist/docs/types.d.ts +27 -0
- package/dist/docs/types.d.ts.map +1 -0
- package/dist/docs/types.js +2 -0
- package/dist/docs/types.js.map +1 -0
- package/dist/execution/diff-presenter.d.ts +52 -0
- package/dist/execution/diff-presenter.d.ts.map +1 -0
- package/dist/execution/diff-presenter.js +148 -0
- package/dist/execution/diff-presenter.js.map +1 -0
- package/dist/execution/executors/ai-assisted.d.ts +28 -0
- package/dist/execution/executors/ai-assisted.d.ts.map +1 -0
- package/dist/execution/executors/ai-assisted.js +226 -0
- package/dist/execution/executors/ai-assisted.js.map +1 -0
- package/dist/execution/executors/automated.d.ts +15 -0
- package/dist/execution/executors/automated.d.ts.map +1 -0
- package/dist/execution/executors/automated.js +37 -0
- package/dist/execution/executors/automated.js.map +1 -0
- package/dist/execution/executors/cv-gate.d.ts +23 -0
- package/dist/execution/executors/cv-gate.d.ts.map +1 -0
- package/dist/execution/executors/cv-gate.js +63 -0
- package/dist/execution/executors/cv-gate.js.map +1 -0
- package/dist/execution/executors/index.d.ts +7 -0
- package/dist/execution/executors/index.d.ts.map +1 -0
- package/dist/execution/executors/index.js +7 -0
- package/dist/execution/executors/index.js.map +1 -0
- package/dist/execution/executors/manual.d.ts +18 -0
- package/dist/execution/executors/manual.d.ts.map +1 -0
- package/dist/execution/executors/manual.js +31 -0
- package/dist/execution/executors/manual.js.map +1 -0
- package/dist/execution/executors/override-resolution.d.ts +27 -0
- package/dist/execution/executors/override-resolution.d.ts.map +1 -0
- package/dist/execution/executors/override-resolution.js +79 -0
- package/dist/execution/executors/override-resolution.js.map +1 -0
- package/dist/execution/executors/version-bump.d.ts +20 -0
- package/dist/execution/executors/version-bump.d.ts.map +1 -0
- package/dist/execution/executors/version-bump.js +65 -0
- package/dist/execution/executors/version-bump.js.map +1 -0
- package/dist/execution/file-transformer.d.ts +25 -0
- package/dist/execution/file-transformer.d.ts.map +1 -0
- package/dist/execution/file-transformer.js +74 -0
- package/dist/execution/file-transformer.js.map +1 -0
- package/dist/execution/index.d.ts +7 -0
- package/dist/execution/index.d.ts.map +1 -0
- package/dist/execution/index.js +9 -0
- package/dist/execution/index.js.map +1 -0
- package/dist/execution/state-manager.d.ts +27 -0
- package/dist/execution/state-manager.d.ts.map +1 -0
- package/dist/execution/state-manager.js +48 -0
- package/dist/execution/state-manager.js.map +1 -0
- package/dist/execution/step-executor.d.ts +68 -0
- package/dist/execution/step-executor.d.ts.map +1 -0
- package/dist/execution/step-executor.js +243 -0
- package/dist/execution/step-executor.js.map +1 -0
- package/dist/execution/types.d.ts +92 -0
- package/dist/execution/types.d.ts.map +1 -0
- package/dist/execution/types.js +2 -0
- package/dist/execution/types.js.map +1 -0
- package/dist/guide/GuideRunner.d.ts +62 -0
- package/dist/guide/GuideRunner.d.ts.map +1 -0
- package/dist/guide/GuideRunner.js +390 -0
- package/dist/guide/GuideRunner.js.map +1 -0
- package/dist/guide/chat/ChatContextBuilder.d.ts +44 -0
- package/dist/guide/chat/ChatContextBuilder.d.ts.map +1 -0
- package/dist/guide/chat/ChatContextBuilder.js +121 -0
- package/dist/guide/chat/ChatContextBuilder.js.map +1 -0
- package/dist/guide/chat/ChatLoop.d.ts +18 -0
- package/dist/guide/chat/ChatLoop.d.ts.map +1 -0
- package/dist/guide/chat/ChatLoop.js +59 -0
- package/dist/guide/chat/ChatLoop.js.map +1 -0
- package/dist/guide/chat/StepCoach.d.ts +22 -0
- package/dist/guide/chat/StepCoach.d.ts.map +1 -0
- package/dist/guide/chat/StepCoach.js +39 -0
- package/dist/guide/chat/StepCoach.js.map +1 -0
- package/dist/guide/chat/index.d.ts +4 -0
- package/dist/guide/chat/index.d.ts.map +1 -0
- package/dist/guide/chat/index.js +4 -0
- package/dist/guide/chat/index.js.map +1 -0
- package/dist/guide/index.d.ts +3 -0
- package/dist/guide/index.d.ts.map +1 -0
- package/dist/guide/index.js +2 -0
- package/dist/guide/index.js.map +1 -0
- package/dist/guide/phases/DiscoveryPhase.d.ts +30 -0
- package/dist/guide/phases/DiscoveryPhase.d.ts.map +1 -0
- package/dist/guide/phases/DiscoveryPhase.js +238 -0
- package/dist/guide/phases/DiscoveryPhase.js.map +1 -0
- package/dist/guide/phases/ExecutionPhase.d.ts +80 -0
- package/dist/guide/phases/ExecutionPhase.d.ts.map +1 -0
- package/dist/guide/phases/ExecutionPhase.js +574 -0
- package/dist/guide/phases/ExecutionPhase.js.map +1 -0
- package/dist/guide/phases/PlanPhase.d.ts +22 -0
- package/dist/guide/phases/PlanPhase.d.ts.map +1 -0
- package/dist/guide/phases/PlanPhase.js +200 -0
- package/dist/guide/phases/PlanPhase.js.map +1 -0
- package/dist/guide/phases/index.d.ts +4 -0
- package/dist/guide/phases/index.d.ts.map +1 -0
- package/dist/guide/phases/index.js +4 -0
- package/dist/guide/phases/index.js.map +1 -0
- package/dist/guide/rendering/formatters.d.ts +126 -0
- package/dist/guide/rendering/formatters.d.ts.map +1 -0
- package/dist/guide/rendering/formatters.js +340 -0
- package/dist/guide/rendering/formatters.js.map +1 -0
- package/dist/guide/rendering/index.d.ts +2 -0
- package/dist/guide/rendering/index.d.ts.map +1 -0
- package/dist/guide/rendering/index.js +2 -0
- package/dist/guide/rendering/index.js.map +1 -0
- package/dist/guide/rendering/platform-changes.d.ts +18 -0
- package/dist/guide/rendering/platform-changes.d.ts.map +1 -0
- package/dist/guide/rendering/platform-changes.js +86 -0
- package/dist/guide/rendering/platform-changes.js.map +1 -0
- package/dist/guide/types.d.ts +100 -0
- package/dist/guide/types.d.ts.map +1 -0
- package/dist/guide/types.js +2 -0
- package/dist/guide/types.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +138 -0
- package/dist/index.js.map +1 -0
- package/dist/manifests/maven-settings.d.ts +7 -0
- package/dist/manifests/maven-settings.d.ts.map +1 -0
- package/dist/manifests/maven-settings.js +33 -0
- package/dist/manifests/maven-settings.js.map +1 -0
- package/dist/manifests/parent-properties.d.ts +12 -0
- package/dist/manifests/parent-properties.d.ts.map +1 -0
- package/dist/manifests/parent-properties.js +28 -0
- package/dist/manifests/parent-properties.js.map +1 -0
- package/dist/manifests/schema.json +198 -0
- package/dist/manifests/unreleased.yaml +3 -0
- package/dist/mcp/index.d.ts +3 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +13 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/resources/index.d.ts +32 -0
- package/dist/mcp/resources/index.d.ts.map +1 -0
- package/dist/mcp/resources/index.js +55 -0
- package/dist/mcp/resources/index.js.map +1 -0
- package/dist/mcp/server.d.ts +9 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +162 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tools/complete-step.d.ts +26 -0
- package/dist/mcp/tools/complete-step.d.ts.map +1 -0
- package/dist/mcp/tools/complete-step.js +73 -0
- package/dist/mcp/tools/complete-step.js.map +1 -0
- package/dist/mcp/tools/create-upgrade-plan.d.ts +36 -0
- package/dist/mcp/tools/create-upgrade-plan.d.ts.map +1 -0
- package/dist/mcp/tools/create-upgrade-plan.js +143 -0
- package/dist/mcp/tools/create-upgrade-plan.js.map +1 -0
- package/dist/mcp/tools/discover-project.d.ts +33 -0
- package/dist/mcp/tools/discover-project.d.ts.map +1 -0
- package/dist/mcp/tools/discover-project.js +96 -0
- package/dist/mcp/tools/discover-project.js.map +1 -0
- package/dist/mcp/tools/get-next-step.d.ts +54 -0
- package/dist/mcp/tools/get-next-step.d.ts.map +1 -0
- package/dist/mcp/tools/get-next-step.js +110 -0
- package/dist/mcp/tools/get-next-step.js.map +1 -0
- package/dist/mcp/tools/get-upgrade-status.d.ts +25 -0
- package/dist/mcp/tools/get-upgrade-status.d.ts.map +1 -0
- package/dist/mcp/tools/get-upgrade-status.js +79 -0
- package/dist/mcp/tools/get-upgrade-status.js.map +1 -0
- package/dist/mcp/tools/upgrade-targets.d.ts +19 -0
- package/dist/mcp/tools/upgrade-targets.d.ts.map +1 -0
- package/dist/mcp/tools/upgrade-targets.js +132 -0
- package/dist/mcp/tools/upgrade-targets.js.map +1 -0
- package/dist/planning/ai-analyzer.d.ts +20 -0
- package/dist/planning/ai-analyzer.d.ts.map +1 -0
- package/dist/planning/ai-analyzer.js +97 -0
- package/dist/planning/ai-analyzer.js.map +1 -0
- package/dist/planning/index.d.ts +8 -0
- package/dist/planning/index.d.ts.map +1 -0
- package/dist/planning/index.js +13 -0
- package/dist/planning/index.js.map +1 -0
- package/dist/planning/manifest-loader.d.ts +54 -0
- package/dist/planning/manifest-loader.d.ts.map +1 -0
- package/dist/planning/manifest-loader.js +233 -0
- package/dist/planning/manifest-loader.js.map +1 -0
- package/dist/planning/manifest-schema.d.ts +41 -0
- package/dist/planning/manifest-schema.d.ts.map +1 -0
- package/dist/planning/manifest-schema.js +71 -0
- package/dist/planning/manifest-schema.js.map +1 -0
- package/dist/planning/override-analyzer.d.ts +12 -0
- package/dist/planning/override-analyzer.d.ts.map +1 -0
- package/dist/planning/override-analyzer.js +42 -0
- package/dist/planning/override-analyzer.js.map +1 -0
- package/dist/planning/plan-generator.d.ts +15 -0
- package/dist/planning/plan-generator.d.ts.map +1 -0
- package/dist/planning/plan-generator.js +250 -0
- package/dist/planning/plan-generator.js.map +1 -0
- package/dist/planning/project-matcher.d.ts +65 -0
- package/dist/planning/project-matcher.d.ts.map +1 -0
- package/dist/planning/project-matcher.js +265 -0
- package/dist/planning/project-matcher.js.map +1 -0
- package/dist/planning/types.d.ts +237 -0
- package/dist/planning/types.d.ts.map +1 -0
- package/dist/planning/types.js +2 -0
- package/dist/planning/types.js.map +1 -0
- package/dist/types/index.d.ts +90 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/command-helpers.d.ts +14 -0
- package/dist/utils/command-helpers.d.ts.map +1 -0
- package/dist/utils/command-helpers.js +18 -0
- package/dist/utils/command-helpers.js.map +1 -0
- package/dist/utils/diff.d.ts +42 -0
- package/dist/utils/diff.d.ts.map +1 -0
- package/dist/utils/diff.js +80 -0
- package/dist/utils/diff.js.map +1 -0
- package/dist/utils/error.d.ts +5 -0
- package/dist/utils/error.d.ts.map +1 -0
- package/dist/utils/error.js +8 -0
- package/dist/utils/error.js.map +1 -0
- package/dist/utils/fs.d.ts +50 -0
- package/dist/utils/fs.d.ts.map +1 -0
- package/dist/utils/fs.js +117 -0
- package/dist/utils/fs.js.map +1 -0
- package/dist/utils/index.d.ts +9 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +9 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logger.d.ts +31 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +62 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/output-writer.d.ts +26 -0
- package/dist/utils/output-writer.d.ts.map +1 -0
- package/dist/utils/output-writer.js +62 -0
- package/dist/utils/output-writer.js.map +1 -0
- package/dist/utils/pom-parser.d.ts +94 -0
- package/dist/utils/pom-parser.d.ts.map +1 -0
- package/dist/utils/pom-parser.js +120 -0
- package/dist/utils/pom-parser.js.map +1 -0
- package/dist/utils/spinner.d.ts +35 -0
- package/dist/utils/spinner.d.ts.map +1 -0
- package/dist/utils/spinner.js +46 -0
- package/dist/utils/spinner.js.map +1 -0
- package/package.json +75 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { GuidePhase, GuideContext, PhaseResult } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Execution phase: iterates through plan steps with AI coaching,
|
|
4
|
+
* prompts the user for actions, and delegates to executors for
|
|
5
|
+
* prepare/apply operations.
|
|
6
|
+
*
|
|
7
|
+
* This phase wraps the lower-level executor infrastructure with
|
|
8
|
+
* StepCoach interactions, providing briefings, Q&A, and a ChatLoop
|
|
9
|
+
* for each step.
|
|
10
|
+
*/
|
|
11
|
+
export declare class ExecutionPhase implements GuidePhase {
|
|
12
|
+
readonly name = "Execution";
|
|
13
|
+
readonly phaseNumber = 3;
|
|
14
|
+
readonly totalPhases = 3;
|
|
15
|
+
readonly canChat = true;
|
|
16
|
+
private static readonly MAX_SPINNER_LABEL_LENGTH;
|
|
17
|
+
run(context: GuideContext): Promise<PhaseResult>;
|
|
18
|
+
/**
|
|
19
|
+
* Execute a single step in a prompt loop, handling user actions
|
|
20
|
+
* like show_diff, ask_question, and ask_ai_help before the final
|
|
21
|
+
* apply or skip decision.
|
|
22
|
+
*/
|
|
23
|
+
private executeStepLoop;
|
|
24
|
+
/**
|
|
25
|
+
* Prompt the user for an action.
|
|
26
|
+
* Always interactive — AI options are shown but disabled when no coach is available.
|
|
27
|
+
*/
|
|
28
|
+
private promptStepAction;
|
|
29
|
+
/**
|
|
30
|
+
* Prepares steps that need instructions shown before the user chooses an action.
|
|
31
|
+
*/
|
|
32
|
+
private prepareForDisplay;
|
|
33
|
+
/**
|
|
34
|
+
* Show step-specific instructions or guidance before the prompt.
|
|
35
|
+
*/
|
|
36
|
+
private showPreparedGuidance;
|
|
37
|
+
private getSpinnerStepLabel;
|
|
38
|
+
private formatStepBriefingOutput;
|
|
39
|
+
private showLabeledText;
|
|
40
|
+
/**
|
|
41
|
+
* Build step-specific action choices for the execution prompt.
|
|
42
|
+
*/
|
|
43
|
+
private getStepActionChoices;
|
|
44
|
+
/**
|
|
45
|
+
* Prompt the user when step preparation fails validation.
|
|
46
|
+
*/
|
|
47
|
+
private promptValidationError;
|
|
48
|
+
/**
|
|
49
|
+
* Prompt for revision instructions for an AI-assisted proposal.
|
|
50
|
+
*/
|
|
51
|
+
private promptRevisionRequest;
|
|
52
|
+
/**
|
|
53
|
+
* Create all executor instances.
|
|
54
|
+
*/
|
|
55
|
+
private createExecutors;
|
|
56
|
+
/**
|
|
57
|
+
* Select the appropriate executor for a step based on its type and
|
|
58
|
+
* automation level.
|
|
59
|
+
*/
|
|
60
|
+
private getExecutorForStep;
|
|
61
|
+
/**
|
|
62
|
+
* Initialize or resume execution state from context.
|
|
63
|
+
*/
|
|
64
|
+
private initializeState;
|
|
65
|
+
/**
|
|
66
|
+
* Determine the starting index in the steps array for resume support.
|
|
67
|
+
* Skips steps that are already completed or skipped in the execution state.
|
|
68
|
+
*/
|
|
69
|
+
private getStartIndex;
|
|
70
|
+
/**
|
|
71
|
+
* Verification and manual steps are completed by the user after reviewing
|
|
72
|
+
* guidance rather than by writing prepared changes here.
|
|
73
|
+
*/
|
|
74
|
+
private completesWithoutAutomaticApply;
|
|
75
|
+
/**
|
|
76
|
+
* Narrow an executor to the AI-assisted executor when revision support is available.
|
|
77
|
+
*/
|
|
78
|
+
private isAIAssistedExecutor;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=ExecutionPhase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExecutionPhase.d.ts","sourceRoot":"","sources":["../../../src/guide/phases/ExecutionPhase.ts"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAgB,MAAM,aAAa,CAAC;AAQvF;;;;;;;;GAQG;AACH,qBAAa,cAAe,YAAW,UAAU;IAC/C,QAAQ,CAAC,IAAI,eAAe;IAC5B,QAAQ,CAAC,WAAW,KAAK;IACzB,QAAQ,CAAC,WAAW,KAAK;IACzB,QAAQ,CAAC,OAAO,QAAQ;IACxB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAM;IAEhD,GAAG,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC;IAuJtD;;;;OAIG;YACW,eAAe;IA8M7B;;;OAGG;YACW,gBAAgB;IAoB9B;;OAEG;YACW,iBAAiB;IAyC/B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAmB5B,OAAO,CAAC,mBAAmB;IAY3B,OAAO,CAAC,wBAAwB;IAiBhC,OAAO,CAAC,eAAe;IAMvB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAqD5B;;OAEG;YACW,qBAAqB;IAsBnC;;OAEG;YACW,qBAAqB;IAYnC;;OAEG;IACH,OAAO,CAAC,eAAe;IAUvB;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAmB1B;;OAEG;IACH,OAAO,CAAC,eAAe;IAmBvB;;;OAGG;IACH,OAAO,CAAC,aAAa;IAUrB;;;OAGG;IACH,OAAO,CAAC,8BAA8B;IAItC;;OAEG;IACH,OAAO,CAAC,oBAAoB;CAG7B"}
|
|
@@ -0,0 +1,574 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import inquirer from 'inquirer';
|
|
4
|
+
import { AutomatedExecutor, AIAssistedExecutor, ManualExecutor, VersionBumpExecutor, CVGateExecutor, } from '../../execution/executors/index.js';
|
|
5
|
+
import { StateManager } from '../../execution/state-manager.js';
|
|
6
|
+
import { DiffPresenter } from '../../execution/diff-presenter.js';
|
|
7
|
+
import { createSpinner } from '../../utils/spinner.js';
|
|
8
|
+
import { StepCoach } from '../chat/StepCoach.js';
|
|
9
|
+
import { ChatLoop } from '../chat/ChatLoop.js';
|
|
10
|
+
import { ChatContextBuilder } from '../chat/ChatContextBuilder.js';
|
|
11
|
+
import { formatPhaseHeader, formatPhaseIntro, formatStepBriefing, formatOutro, wrapIndentedText, } from '../rendering/formatters.js';
|
|
12
|
+
import { formatPlatformChangesSummary } from '../rendering/platform-changes.js';
|
|
13
|
+
/**
|
|
14
|
+
* Execution phase: iterates through plan steps with AI coaching,
|
|
15
|
+
* prompts the user for actions, and delegates to executors for
|
|
16
|
+
* prepare/apply operations.
|
|
17
|
+
*
|
|
18
|
+
* This phase wraps the lower-level executor infrastructure with
|
|
19
|
+
* StepCoach interactions, providing briefings, Q&A, and a ChatLoop
|
|
20
|
+
* for each step.
|
|
21
|
+
*/
|
|
22
|
+
export class ExecutionPhase {
|
|
23
|
+
name = 'Execution';
|
|
24
|
+
phaseNumber = 3;
|
|
25
|
+
totalPhases = 3;
|
|
26
|
+
canChat = true;
|
|
27
|
+
static MAX_SPINNER_LABEL_LENGTH = 40;
|
|
28
|
+
async run(context) {
|
|
29
|
+
console.log(formatPhaseHeader(this.phaseNumber, this.totalPhases, this.name));
|
|
30
|
+
console.log(formatPhaseIntro('Execute'));
|
|
31
|
+
if (!context.plan) {
|
|
32
|
+
return {
|
|
33
|
+
success: false,
|
|
34
|
+
summary: 'Execution failed — missing prerequisites',
|
|
35
|
+
error: 'No plan available. Run the planning phase first.',
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
const plan = context.plan;
|
|
39
|
+
const steps = plan.steps;
|
|
40
|
+
const totalSteps = steps.length;
|
|
41
|
+
// Initialize executors
|
|
42
|
+
const executors = this.createExecutors(context.ai);
|
|
43
|
+
const stateManager = new StateManager(context.projectRoot);
|
|
44
|
+
const diffPresenter = new DiffPresenter();
|
|
45
|
+
const coach = context.ai ? new StepCoach(context.ai) : undefined;
|
|
46
|
+
const contextBuilder = new ChatContextBuilder();
|
|
47
|
+
// Initialize or resume execution state
|
|
48
|
+
const state = this.initializeState(context, plan.generatedAt);
|
|
49
|
+
context.executionState = state;
|
|
50
|
+
// Determine the starting step index (for resume support)
|
|
51
|
+
const processedSteps = new Set([...state.completedSteps, ...state.skippedSteps]);
|
|
52
|
+
const startIndex = this.getStartIndex(state, steps);
|
|
53
|
+
const results = [];
|
|
54
|
+
for (let i = startIndex; i < steps.length; i++) {
|
|
55
|
+
const step = steps[i];
|
|
56
|
+
// Skip steps already processed in a prior partial run (handles failed→completed gaps)
|
|
57
|
+
if (processedSteps.has(step.stepNumber)) {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
state.currentStep = step.stepNumber;
|
|
61
|
+
// Step action loop: prompt, handle action, re-prompt if needed
|
|
62
|
+
const result = await this.executeStepLoop(step, totalSteps, context, executors, diffPresenter, coach, contextBuilder);
|
|
63
|
+
results.push(result);
|
|
64
|
+
// Update execution state
|
|
65
|
+
if (result.success) {
|
|
66
|
+
if (result.decision === 'accept') {
|
|
67
|
+
state.completedSteps.push(step.stepNumber);
|
|
68
|
+
}
|
|
69
|
+
else if (result.decision === 'skip') {
|
|
70
|
+
state.skippedSteps.push(step.stepNumber);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
state.failedSteps.push(step.stepNumber);
|
|
75
|
+
// "Abort upgrade" should stop the entire execution loop, not just the current step
|
|
76
|
+
if (result.decision === 'reject') {
|
|
77
|
+
state.updatedAt = new Date().toISOString();
|
|
78
|
+
await stateManager.saveState(state);
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
state.updatedAt = new Date().toISOString();
|
|
83
|
+
await stateManager.saveState(state);
|
|
84
|
+
}
|
|
85
|
+
// Store results in context
|
|
86
|
+
context.executionResults = results;
|
|
87
|
+
// Mark complete when all steps have been processed (accounts for resumed partial runs)
|
|
88
|
+
const allProcessed = new Set([...state.completedSteps, ...state.skippedSteps]);
|
|
89
|
+
if (allProcessed.size >= totalSteps) {
|
|
90
|
+
state.isComplete = true;
|
|
91
|
+
await stateManager.saveState(state);
|
|
92
|
+
}
|
|
93
|
+
// Use cumulative state counts so resumed runs report total progress
|
|
94
|
+
const applied = state.completedSteps.length;
|
|
95
|
+
const skipped = state.skippedSteps.length;
|
|
96
|
+
const failed = state.failedSteps.length;
|
|
97
|
+
// -- Build final summary --
|
|
98
|
+
const allResults = context.executionResults ?? [];
|
|
99
|
+
const completedStepNumbers = new Set(state.completedSteps);
|
|
100
|
+
const skippedStepNumbers = new Set(state.skippedSteps);
|
|
101
|
+
const manualStepsRemaining = plan.steps.filter((s) => !completedStepNumbers.has(s.stepNumber)
|
|
102
|
+
&& (s.automatable === 'false'
|
|
103
|
+
|| skippedStepNumbers.has(s.stepNumber)));
|
|
104
|
+
const totalDuration = allResults.reduce((sum, r) => sum + r.duration, 0);
|
|
105
|
+
console.log(formatOutro({
|
|
106
|
+
fromVersion: context.currentVersion ?? 'unknown',
|
|
107
|
+
toVersion: context.targetVersion ?? 'unknown',
|
|
108
|
+
applied,
|
|
109
|
+
skipped,
|
|
110
|
+
failed,
|
|
111
|
+
duration: totalDuration,
|
|
112
|
+
manualStepsRemaining: manualStepsRemaining.map(s => ({
|
|
113
|
+
stepNumber: s.stepNumber,
|
|
114
|
+
description: s.description,
|
|
115
|
+
manualSteps: s.manualSteps,
|
|
116
|
+
})),
|
|
117
|
+
}));
|
|
118
|
+
// Show Platform Changes Summary if there are informational entries
|
|
119
|
+
if (plan.informationalEntries && plan.informationalEntries.length > 0) {
|
|
120
|
+
console.log(formatPlatformChangesSummary(plan.informationalEntries, plan.fromVersion, plan.toVersion));
|
|
121
|
+
}
|
|
122
|
+
const guideSummary = {
|
|
123
|
+
fromVersion: context.currentVersion ?? 'unknown',
|
|
124
|
+
toVersion: context.targetVersion ?? 'unknown',
|
|
125
|
+
completedSteps: applied,
|
|
126
|
+
skippedSteps: skipped,
|
|
127
|
+
manualStepsRemaining,
|
|
128
|
+
duration: totalDuration,
|
|
129
|
+
};
|
|
130
|
+
const summaryText = failed > 0
|
|
131
|
+
? `Upgrade completed with errors: ${String(applied)} applied, ${String(skipped)} skipped, ${String(failed)} failed`
|
|
132
|
+
: `Execution complete: ${String(applied)} applied, ${String(skipped)} skipped, ${String(failed)} failed`;
|
|
133
|
+
return {
|
|
134
|
+
success: true,
|
|
135
|
+
summary: summaryText,
|
|
136
|
+
data: guideSummary,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Execute a single step in a prompt loop, handling user actions
|
|
141
|
+
* like show_diff, ask_question, and ask_ai_help before the final
|
|
142
|
+
* apply or skip decision.
|
|
143
|
+
*/
|
|
144
|
+
async executeStepLoop(step, totalSteps, context, executors, diffPresenter, coach, contextBuilder) {
|
|
145
|
+
const startTime = Date.now();
|
|
146
|
+
const executor = this.getExecutorForStep(step, executors);
|
|
147
|
+
const suppressStepBriefingLeadingBlankLine = step.automatable === 'partial' && this.isAIAssistedExecutor(executor);
|
|
148
|
+
let preparedChanges = await this.prepareForDisplay(step, executor, context.projectRoot);
|
|
149
|
+
console.log(this.formatStepBriefingOutput(step, totalSteps, suppressStepBriefingLeadingBlankLine));
|
|
150
|
+
if (coach) {
|
|
151
|
+
const briefingSpinner = createSpinner({ text: 'Generating context...', color: 'cyan' });
|
|
152
|
+
briefingSpinner.start();
|
|
153
|
+
try {
|
|
154
|
+
const aiBriefing = await coach.generateBriefing(step, context.discovery);
|
|
155
|
+
briefingSpinner.stop();
|
|
156
|
+
this.showLabeledText('Context', aiBriefing);
|
|
157
|
+
}
|
|
158
|
+
catch {
|
|
159
|
+
briefingSpinner.stop();
|
|
160
|
+
// Context is nice-to-have — continue without it
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
this.showPreparedGuidance(step, preparedChanges);
|
|
164
|
+
while (true) {
|
|
165
|
+
const action = await this.promptStepAction(step, !!coach, preparedChanges);
|
|
166
|
+
switch (action) {
|
|
167
|
+
case 'apply': {
|
|
168
|
+
const executor = this.getExecutorForStep(step, executors);
|
|
169
|
+
// Prepare if not already prepared (from show_diff)
|
|
170
|
+
if (!preparedChanges) {
|
|
171
|
+
preparedChanges = await executor.prepare(step, context.projectRoot);
|
|
172
|
+
}
|
|
173
|
+
if (!preparedChanges.isValid) {
|
|
174
|
+
const errorAction = await this.promptValidationError(preparedChanges.validationErrors ?? ['Unknown validation error']);
|
|
175
|
+
switch (errorAction) {
|
|
176
|
+
case 'skip':
|
|
177
|
+
return {
|
|
178
|
+
stepNumber: step.stepNumber,
|
|
179
|
+
entryId: step.entryId,
|
|
180
|
+
success: true,
|
|
181
|
+
decision: 'skip',
|
|
182
|
+
modifiedFiles: [],
|
|
183
|
+
modifiedFileCount: 0,
|
|
184
|
+
duration: Date.now() - startTime,
|
|
185
|
+
};
|
|
186
|
+
case 'mark_done':
|
|
187
|
+
return {
|
|
188
|
+
stepNumber: step.stepNumber,
|
|
189
|
+
entryId: step.entryId,
|
|
190
|
+
success: true,
|
|
191
|
+
decision: 'accept',
|
|
192
|
+
modifiedFiles: [],
|
|
193
|
+
modifiedFileCount: 0,
|
|
194
|
+
duration: Date.now() - startTime,
|
|
195
|
+
};
|
|
196
|
+
case 'abort':
|
|
197
|
+
return {
|
|
198
|
+
stepNumber: step.stepNumber,
|
|
199
|
+
entryId: step.entryId,
|
|
200
|
+
success: false,
|
|
201
|
+
decision: 'reject',
|
|
202
|
+
modifiedFiles: [],
|
|
203
|
+
modifiedFileCount: 0,
|
|
204
|
+
error: preparedChanges.validationErrors?.join(', '),
|
|
205
|
+
duration: Date.now() - startTime,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
if (step.automatable === 'partial' && preparedChanges.changes.length === 0) {
|
|
210
|
+
return {
|
|
211
|
+
stepNumber: step.stepNumber,
|
|
212
|
+
entryId: step.entryId,
|
|
213
|
+
success: true,
|
|
214
|
+
decision: 'accept',
|
|
215
|
+
modifiedFiles: [],
|
|
216
|
+
modifiedFileCount: 0,
|
|
217
|
+
duration: Date.now() - startTime,
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
if (this.completesWithoutAutomaticApply(step)) {
|
|
221
|
+
return {
|
|
222
|
+
stepNumber: step.stepNumber,
|
|
223
|
+
entryId: step.entryId,
|
|
224
|
+
success: true,
|
|
225
|
+
decision: 'accept',
|
|
226
|
+
modifiedFiles: [],
|
|
227
|
+
modifiedFileCount: 0,
|
|
228
|
+
duration: Date.now() - startTime,
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
try {
|
|
232
|
+
const modifiedFiles = await executor.apply(preparedChanges, context.projectRoot);
|
|
233
|
+
return {
|
|
234
|
+
stepNumber: step.stepNumber,
|
|
235
|
+
entryId: step.entryId,
|
|
236
|
+
success: true,
|
|
237
|
+
decision: 'accept',
|
|
238
|
+
modifiedFiles: modifiedFiles.map((f) => f.filePath),
|
|
239
|
+
modifiedFileCount: modifiedFiles.length,
|
|
240
|
+
duration: Date.now() - startTime,
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
catch (error) {
|
|
244
|
+
return {
|
|
245
|
+
stepNumber: step.stepNumber,
|
|
246
|
+
entryId: step.entryId,
|
|
247
|
+
success: false,
|
|
248
|
+
decision: 'reject',
|
|
249
|
+
modifiedFiles: [],
|
|
250
|
+
modifiedFileCount: 0,
|
|
251
|
+
error: error instanceof Error ? error.message : 'Unknown error',
|
|
252
|
+
duration: Date.now() - startTime,
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
case 'show_diff': {
|
|
257
|
+
// Prepare changes if not yet prepared
|
|
258
|
+
if (!preparedChanges) {
|
|
259
|
+
preparedChanges = await executor.prepare(step, context.projectRoot);
|
|
260
|
+
}
|
|
261
|
+
diffPresenter.showFullDiff(preparedChanges);
|
|
262
|
+
// Re-prompt
|
|
263
|
+
break;
|
|
264
|
+
}
|
|
265
|
+
case 'ask_ai_help': {
|
|
266
|
+
if (context.ai) {
|
|
267
|
+
const chatContext = contextBuilder.buildStepContext(step, context.discovery);
|
|
268
|
+
const chatLoop = new ChatLoop(context.ai);
|
|
269
|
+
await chatLoop.run(chatContext, contextBuilder.buildSystemPrompt());
|
|
270
|
+
}
|
|
271
|
+
// Re-prompt
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
case 'revise_ai': {
|
|
275
|
+
if (this.isAIAssistedExecutor(executor)) {
|
|
276
|
+
const revisionRequest = await this.promptRevisionRequest();
|
|
277
|
+
console.log('');
|
|
278
|
+
const spinnerLabel = this.getSpinnerStepLabel(step);
|
|
279
|
+
const spinner = createSpinner({
|
|
280
|
+
text: `Revising AI proposal for ${spinnerLabel}...`,
|
|
281
|
+
color: 'cyan',
|
|
282
|
+
});
|
|
283
|
+
spinner.start();
|
|
284
|
+
try {
|
|
285
|
+
preparedChanges = await executor.revise(step, context.projectRoot, preparedChanges ?? {
|
|
286
|
+
step,
|
|
287
|
+
changes: [],
|
|
288
|
+
totalFiles: 0,
|
|
289
|
+
isValid: true,
|
|
290
|
+
}, revisionRequest);
|
|
291
|
+
spinner.stop();
|
|
292
|
+
this.showPreparedGuidance(step, preparedChanges);
|
|
293
|
+
}
|
|
294
|
+
catch (error) {
|
|
295
|
+
spinner.fail('Failed to revise AI proposal');
|
|
296
|
+
console.log(chalk.yellow(` ${error instanceof Error ? error.message : 'Unable to revise AI proposal.'}`));
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
// Re-prompt
|
|
300
|
+
break;
|
|
301
|
+
}
|
|
302
|
+
case 'skip': {
|
|
303
|
+
return {
|
|
304
|
+
stepNumber: step.stepNumber,
|
|
305
|
+
entryId: step.entryId,
|
|
306
|
+
success: true,
|
|
307
|
+
decision: 'skip',
|
|
308
|
+
modifiedFiles: [],
|
|
309
|
+
modifiedFileCount: 0,
|
|
310
|
+
duration: Date.now() - startTime,
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Prompt the user for an action.
|
|
318
|
+
* Always interactive — AI options are shown but disabled when no coach is available.
|
|
319
|
+
*/
|
|
320
|
+
async promptStepAction(step, hasAI, preparedChanges) {
|
|
321
|
+
const choices = this.getStepActionChoices(step, hasAI, preparedChanges);
|
|
322
|
+
console.log('');
|
|
323
|
+
const { action } = (await inquirer.prompt([
|
|
324
|
+
{
|
|
325
|
+
type: 'select',
|
|
326
|
+
name: 'action',
|
|
327
|
+
message: chalk.cyan('What would you like to do?'),
|
|
328
|
+
choices,
|
|
329
|
+
},
|
|
330
|
+
]));
|
|
331
|
+
return action;
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Prepares steps that need instructions shown before the user chooses an action.
|
|
335
|
+
*/
|
|
336
|
+
async prepareForDisplay(step, executor, projectRoot) {
|
|
337
|
+
if (step.type === 'verification_gate') {
|
|
338
|
+
return executor.prepare(step, projectRoot);
|
|
339
|
+
}
|
|
340
|
+
if (step.automatable === 'partial') {
|
|
341
|
+
if (!this.isAIAssistedExecutor(executor)) {
|
|
342
|
+
return {
|
|
343
|
+
step,
|
|
344
|
+
changes: [],
|
|
345
|
+
totalFiles: 0,
|
|
346
|
+
aiAnalysis: step.aiGuidance ??
|
|
347
|
+
step.analysis ??
|
|
348
|
+
'AI assistance is unavailable for this step. Review it manually and mark it as done when finished.',
|
|
349
|
+
isValid: true,
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
console.log('');
|
|
353
|
+
const spinnerLabel = this.getSpinnerStepLabel(step);
|
|
354
|
+
const spinner = createSpinner({
|
|
355
|
+
text: `Preparing AI guidance for ${spinnerLabel}...`,
|
|
356
|
+
color: 'cyan',
|
|
357
|
+
});
|
|
358
|
+
spinner.start();
|
|
359
|
+
try {
|
|
360
|
+
const prepared = await executor.prepare(step, projectRoot);
|
|
361
|
+
spinner.stop();
|
|
362
|
+
return prepared;
|
|
363
|
+
}
|
|
364
|
+
catch (error) {
|
|
365
|
+
spinner.fail('Failed to prepare AI guidance');
|
|
366
|
+
throw error;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
return undefined;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Show step-specific instructions or guidance before the prompt.
|
|
373
|
+
*/
|
|
374
|
+
showPreparedGuidance(step, preparedChanges) {
|
|
375
|
+
if (step.manualSteps && step.manualSteps.length > 0) {
|
|
376
|
+
this.showLabeledText('Instructions', step.manualSteps.map((manualStep, index) => `${index + 1}. ${manualStep}`).join('\n'));
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
if (preparedChanges?.aiAnalysis) {
|
|
380
|
+
this.showLabeledText('AI Guidance', preparedChanges.aiAnalysis);
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
if (preparedChanges?.message) {
|
|
384
|
+
this.showLabeledText('Instructions', preparedChanges.message);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
getSpinnerStepLabel(step) {
|
|
388
|
+
const description = step.description.trim();
|
|
389
|
+
if (description.length > 0
|
|
390
|
+
&& description.length <= ExecutionPhase.MAX_SPINNER_LABEL_LENGTH
|
|
391
|
+
&& !description.includes('\n')) {
|
|
392
|
+
return description;
|
|
393
|
+
}
|
|
394
|
+
return `step ${step.stepNumber}`;
|
|
395
|
+
}
|
|
396
|
+
formatStepBriefingOutput(step, totalSteps, suppressLeadingBlankLine = false) {
|
|
397
|
+
const briefing = formatStepBriefing({
|
|
398
|
+
stepNumber: step.stepNumber,
|
|
399
|
+
totalSteps,
|
|
400
|
+
description: step.description,
|
|
401
|
+
type: step.type,
|
|
402
|
+
automatable: step.automatable,
|
|
403
|
+
riskLevel: step.riskLevel,
|
|
404
|
+
affectedFileCount: step.affectedFileCount,
|
|
405
|
+
});
|
|
406
|
+
return suppressLeadingBlankLine ? briefing.replace(/^\n/, '') : briefing;
|
|
407
|
+
}
|
|
408
|
+
showLabeledText(label, text) {
|
|
409
|
+
console.log('');
|
|
410
|
+
console.log(chalk.bold(`${label}:`));
|
|
411
|
+
console.log(wrapIndentedText(text));
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Build step-specific action choices for the execution prompt.
|
|
415
|
+
*/
|
|
416
|
+
getStepActionChoices(step, hasAI, preparedChanges) {
|
|
417
|
+
const aiDisabledHint = '(requires AI key)';
|
|
418
|
+
const askAIChoice = {
|
|
419
|
+
name: `${step.automatable === 'partial' ? 'Ask AI for help first' : 'Ask AI for help'}${hasAI ? '' : ` ${aiDisabledHint}`}`,
|
|
420
|
+
value: 'ask_ai_help',
|
|
421
|
+
disabled: !hasAI,
|
|
422
|
+
};
|
|
423
|
+
if (step.type === 'verification_gate') {
|
|
424
|
+
return [
|
|
425
|
+
{ name: 'Mark this check as done', value: 'apply' },
|
|
426
|
+
askAIChoice,
|
|
427
|
+
{ name: 'Skip this step', value: 'skip' },
|
|
428
|
+
];
|
|
429
|
+
}
|
|
430
|
+
if (step.automatable === 'false') {
|
|
431
|
+
return [
|
|
432
|
+
{ name: 'Mark this step as done', value: 'apply' },
|
|
433
|
+
askAIChoice,
|
|
434
|
+
{ name: 'Skip this step', value: 'skip' },
|
|
435
|
+
];
|
|
436
|
+
}
|
|
437
|
+
if (step.automatable === 'partial') {
|
|
438
|
+
if (preparedChanges && preparedChanges.changes.length > 0) {
|
|
439
|
+
return [
|
|
440
|
+
{ name: 'Show diff first', value: 'show_diff' },
|
|
441
|
+
{ name: 'Apply proposed change', value: 'apply' },
|
|
442
|
+
{ name: `Ask AI to revise${hasAI ? '' : ` ${aiDisabledHint}`}`, value: 'revise_ai', disabled: !hasAI },
|
|
443
|
+
{ name: 'Skip this step', value: 'skip' },
|
|
444
|
+
];
|
|
445
|
+
}
|
|
446
|
+
return [
|
|
447
|
+
{ name: 'Mark this step as done', value: 'apply' },
|
|
448
|
+
{ name: `Ask AI to revise${hasAI ? '' : ` ${aiDisabledHint}`}`, value: 'revise_ai', disabled: !hasAI },
|
|
449
|
+
askAIChoice,
|
|
450
|
+
{ name: 'Skip this step', value: 'skip' },
|
|
451
|
+
];
|
|
452
|
+
}
|
|
453
|
+
return [
|
|
454
|
+
{ name: 'Apply this change', value: 'apply' },
|
|
455
|
+
{ name: 'Show the diff first', value: 'show_diff' },
|
|
456
|
+
askAIChoice,
|
|
457
|
+
{ name: 'Skip this step', value: 'skip' },
|
|
458
|
+
];
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Prompt the user when step preparation fails validation.
|
|
462
|
+
*/
|
|
463
|
+
async promptValidationError(errors) {
|
|
464
|
+
console.log('');
|
|
465
|
+
console.log(chalk.yellow(' ⚠ Step validation issue: ') + errors.join(', '));
|
|
466
|
+
const { action } = (await inquirer.prompt([
|
|
467
|
+
{
|
|
468
|
+
type: 'select',
|
|
469
|
+
name: 'action',
|
|
470
|
+
message: chalk.cyan('What would you like to do?'),
|
|
471
|
+
choices: [
|
|
472
|
+
{ name: 'Skip this step', value: 'skip' },
|
|
473
|
+
{ name: 'Mark as done (I handled it myself)', value: 'mark_done' },
|
|
474
|
+
{ name: 'Abort upgrade', value: 'abort' },
|
|
475
|
+
],
|
|
476
|
+
},
|
|
477
|
+
]));
|
|
478
|
+
return action;
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* Prompt for revision instructions for an AI-assisted proposal.
|
|
482
|
+
*/
|
|
483
|
+
async promptRevisionRequest() {
|
|
484
|
+
const { revisionRequest } = (await inquirer.prompt([
|
|
485
|
+
{
|
|
486
|
+
type: 'input',
|
|
487
|
+
name: 'revisionRequest',
|
|
488
|
+
message: chalk.cyan('What should the AI change about the proposal?'),
|
|
489
|
+
},
|
|
490
|
+
]));
|
|
491
|
+
return revisionRequest.trim();
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Create all executor instances.
|
|
495
|
+
*/
|
|
496
|
+
createExecutors(ai) {
|
|
497
|
+
return {
|
|
498
|
+
automated: new AutomatedExecutor(),
|
|
499
|
+
aiAssisted: ai ? new AIAssistedExecutor(ai) : undefined,
|
|
500
|
+
manual: new ManualExecutor(),
|
|
501
|
+
versionBump: new VersionBumpExecutor(),
|
|
502
|
+
cvGate: new CVGateExecutor(),
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Select the appropriate executor for a step based on its type and
|
|
507
|
+
* automation level.
|
|
508
|
+
*/
|
|
509
|
+
getExecutorForStep(step, executors) {
|
|
510
|
+
if (step.type === 'verification_gate') {
|
|
511
|
+
return executors.cvGate;
|
|
512
|
+
}
|
|
513
|
+
if (step.type === 'version_bump') {
|
|
514
|
+
return executors.versionBump;
|
|
515
|
+
}
|
|
516
|
+
switch (step.automatable) {
|
|
517
|
+
case 'true':
|
|
518
|
+
return executors.automated;
|
|
519
|
+
case 'partial':
|
|
520
|
+
return executors.aiAssisted ?? executors.manual;
|
|
521
|
+
case 'false':
|
|
522
|
+
return executors.manual;
|
|
523
|
+
default:
|
|
524
|
+
return executors.manual;
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* Initialize or resume execution state from context.
|
|
529
|
+
*/
|
|
530
|
+
initializeState(context, planGeneratedAt) {
|
|
531
|
+
if (context.executionState && context.executionState.planGeneratedAt === planGeneratedAt) {
|
|
532
|
+
return context.executionState;
|
|
533
|
+
}
|
|
534
|
+
const now = new Date().toISOString();
|
|
535
|
+
return {
|
|
536
|
+
planFile: '.brxm-upgrade/plan.json',
|
|
537
|
+
planGeneratedAt,
|
|
538
|
+
currentStep: 1,
|
|
539
|
+
completedSteps: [],
|
|
540
|
+
skippedSteps: [],
|
|
541
|
+
failedSteps: [],
|
|
542
|
+
startedAt: now,
|
|
543
|
+
updatedAt: now,
|
|
544
|
+
isComplete: false,
|
|
545
|
+
};
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* Determine the starting index in the steps array for resume support.
|
|
549
|
+
* Skips steps that are already completed or skipped in the execution state.
|
|
550
|
+
*/
|
|
551
|
+
getStartIndex(state, steps) {
|
|
552
|
+
const processedSteps = new Set([...state.completedSteps, ...state.skippedSteps]);
|
|
553
|
+
for (let i = 0; i < steps.length; i++) {
|
|
554
|
+
if (!processedSteps.has(steps[i].stepNumber)) {
|
|
555
|
+
return i;
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
return steps.length;
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* Verification and manual steps are completed by the user after reviewing
|
|
562
|
+
* guidance rather than by writing prepared changes here.
|
|
563
|
+
*/
|
|
564
|
+
completesWithoutAutomaticApply(step) {
|
|
565
|
+
return step.type === 'verification_gate' || step.automatable === 'false';
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* Narrow an executor to the AI-assisted executor when revision support is available.
|
|
569
|
+
*/
|
|
570
|
+
isAIAssistedExecutor(executor) {
|
|
571
|
+
return executor instanceof AIAssistedExecutor;
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
//# sourceMappingURL=ExecutionPhase.js.map
|