@lesliechan721/aw 0.1.0-beta.3 → 0.1.0-beta.31
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/dist/authoring/assets/aw-config.mjs +100 -501
- package/dist/authoring/assets/aw-config.mjs.map +1 -1
- package/dist/authoring/scripts/add-skill.mjs +4 -4
- package/dist/authoring/scripts/add-skill.mjs.map +1 -1
- package/dist/authoring/scripts/init-plugin.mjs +67 -97
- package/dist/authoring/scripts/init-plugin.mjs.map +1 -1
- package/dist/authoring/scripts/lib/plugin-version-check.d.mts +15 -0
- package/dist/authoring/scripts/lib/plugin-version-check.mjs +239 -232
- package/dist/authoring/scripts/lib/plugin-version-check.mjs.map +1 -1
- package/dist/authoring/scripts/lib/skill-scaffold.d.mts +77 -90
- package/dist/authoring/scripts/lib/skill-scaffold.mjs +99 -120
- package/dist/authoring/scripts/lib/skill-scaffold.mjs.map +1 -1
- package/dist/authoring/scripts/plugin-status.mjs +8 -11
- package/dist/authoring/scripts/plugin-status.mjs.map +1 -1
- package/dist/authoring/scripts/remove-plugin.mjs +367 -0
- package/dist/authoring/scripts/remove-plugin.mjs.map +1 -0
- package/dist/authoring/scripts/validate-plugin.mjs +307 -1173
- package/dist/authoring/scripts/validate-plugin.mjs.map +1 -1
- package/dist/scripts/aw-skill-eval-materializer.d.ts +26 -0
- package/dist/scripts/aw-skill-eval-materializer.js +306 -0
- package/dist/scripts/aw-skill-eval-materializer.js.map +1 -0
- package/dist/scripts/bundle-plugins.d.ts +1 -2
- package/dist/scripts/bundle-plugins.js +24 -7
- package/dist/scripts/bundle-plugins.js.map +1 -1
- package/dist/scripts/plugin-staging.d.ts +7 -24
- package/dist/scripts/plugin-staging.js +22 -142
- package/dist/scripts/plugin-staging.js.map +1 -1
- package/dist/scripts/test-plugin-scripts.d.ts +2 -0
- package/dist/scripts/test-plugin-scripts.js +27 -75
- package/dist/scripts/test-plugin-scripts.js.map +1 -1
- package/dist/src/adapters/helpers.js +2 -2
- package/dist/src/adapters/helpers.js.map +1 -1
- package/dist/src/authoring/workspace-commands.d.ts +26 -2
- package/dist/src/authoring/workspace-commands.js +44 -19
- package/dist/src/authoring/workspace-commands.js.map +1 -1
- package/dist/src/commands/aw-capabilities.d.ts +78 -0
- package/dist/src/commands/aw-capabilities.js +256 -0
- package/dist/src/commands/aw-capabilities.js.map +1 -0
- package/dist/src/commands/catalog-dev-source.d.ts +154 -0
- package/dist/src/commands/catalog-dev-source.js +655 -0
- package/dist/src/commands/catalog-dev-source.js.map +1 -0
- package/dist/src/commands/catalog-generation.d.ts +21 -0
- package/dist/src/commands/catalog-generation.js +9 -0
- package/dist/src/commands/catalog-generation.js.map +1 -0
- package/dist/src/commands/catalog-publication-inspection.d.ts +138 -0
- package/dist/src/commands/catalog-publication-inspection.js +757 -0
- package/dist/src/commands/catalog-publication-inspection.js.map +1 -0
- package/dist/src/commands/catalog-publication-journal.d.ts +68 -0
- package/dist/src/commands/catalog-publication-journal.js +292 -0
- package/dist/src/commands/catalog-publication-journal.js.map +1 -0
- package/dist/src/commands/catalog-publication-target.d.ts +18 -0
- package/dist/src/commands/catalog-publication-target.js +95 -0
- package/dist/src/commands/catalog-publication-target.js.map +1 -0
- package/dist/src/commands/catalog-publish.d.ts +77 -7
- package/dist/src/commands/catalog-publish.js +746 -316
- package/dist/src/commands/catalog-publish.js.map +1 -1
- package/dist/src/commands/catalog-source.d.ts +60 -22
- package/dist/src/commands/catalog-source.js +311 -91
- package/dist/src/commands/catalog-source.js.map +1 -1
- package/dist/src/commands/catalog-status.d.ts +56 -0
- package/dist/src/commands/catalog-status.js +217 -0
- package/dist/src/commands/catalog-status.js.map +1 -0
- package/dist/src/commands/catalog-store.d.ts +104 -0
- package/dist/src/commands/catalog-store.js +685 -0
- package/dist/src/commands/catalog-store.js.map +1 -0
- package/dist/src/commands/catalog-workspace-resolution.d.ts +13 -0
- package/dist/src/commands/catalog-workspace-resolution.js +42 -0
- package/dist/src/commands/catalog-workspace-resolution.js.map +1 -0
- package/dist/src/commands/console.js +28 -17
- package/dist/src/commands/console.js.map +1 -1
- package/dist/src/commands/dependency-operation-plan.d.ts +52 -15
- package/dist/src/commands/dependency-operation-plan.js +289 -7
- package/dist/src/commands/dependency-operation-plan.js.map +1 -1
- package/dist/src/commands/init.d.ts +5 -11
- package/dist/src/commands/init.js +30 -51
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/offline-cleanup-evidence.d.ts +67 -0
- package/dist/src/commands/offline-cleanup-evidence.js +181 -0
- package/dist/src/commands/offline-cleanup-evidence.js.map +1 -0
- package/dist/src/commands/operation-plan.d.ts +127 -0
- package/dist/src/commands/operation-plan.js +71 -0
- package/dist/src/commands/operation-plan.js.map +1 -0
- package/dist/src/commands/operation-planner.d.ts +46 -0
- package/dist/src/commands/operation-planner.js +141 -0
- package/dist/src/commands/operation-planner.js.map +1 -0
- package/dist/src/commands/options.d.ts +9 -7
- package/dist/src/commands/options.js +83 -21
- package/dist/src/commands/options.js.map +1 -1
- package/dist/src/commands/plugin-capabilities.d.ts +22 -0
- package/dist/src/commands/plugin-capabilities.js +159 -0
- package/dist/src/commands/plugin-capabilities.js.map +1 -0
- package/dist/src/commands/rebuild-command.d.ts +77 -30
- package/dist/src/commands/rebuild-command.js +3993 -711
- package/dist/src/commands/rebuild-command.js.map +1 -1
- package/dist/src/commands/rebuild-integration.d.ts +120 -21
- package/dist/src/commands/rebuild-integration.js +2765 -1326
- package/dist/src/commands/rebuild-integration.js.map +1 -1
- package/dist/src/commands/rebuild-operations.d.ts +58 -30
- package/dist/src/commands/rebuild-operations.js +260 -319
- package/dist/src/commands/rebuild-operations.js.map +1 -1
- package/dist/src/commands/reconcile-operation-plan.d.ts +28 -0
- package/dist/src/commands/reconcile-operation-plan.js +47 -0
- package/dist/src/commands/reconcile-operation-plan.js.map +1 -0
- package/dist/src/commands/review-inspection.d.ts +228 -0
- package/dist/src/commands/review-inspection.js +1341 -0
- package/dist/src/commands/review-inspection.js.map +1 -0
- package/dist/src/commands/review-preparation.d.ts +49 -0
- package/dist/src/commands/review-preparation.js +427 -0
- package/dist/src/commands/review-preparation.js.map +1 -0
- package/dist/src/commands/runtime.d.ts +1 -5
- package/dist/src/commands/runtime.js +24 -50
- package/dist/src/commands/runtime.js.map +1 -1
- package/dist/src/commands/skill-eval.d.ts +38 -0
- package/dist/src/commands/skill-eval.js +388 -0
- package/dist/src/commands/skill-eval.js.map +1 -0
- package/dist/src/commands/status-v6.d.ts +279 -0
- package/dist/src/commands/status-v6.js +2697 -0
- package/dist/src/commands/status-v6.js.map +1 -0
- package/dist/src/commands/sync-command.d.ts +40 -0
- package/dist/src/commands/sync-command.js +250 -0
- package/dist/src/commands/sync-command.js.map +1 -0
- package/dist/src/commands/wizard.d.ts +3 -4
- package/dist/src/commands/wizard.js +2 -2
- package/dist/src/commands/wizard.js.map +1 -1
- package/dist/src/commands/write-commands.d.ts +9 -3
- package/dist/src/commands/write-commands.js +124 -31
- package/dist/src/commands/write-commands.js.map +1 -1
- package/dist/src/constants.d.ts +7 -1
- package/dist/src/constants.js +7 -1
- package/dist/src/constants.js.map +1 -1
- package/dist/src/eval/manifest-v1.d.ts +71 -0
- package/dist/src/eval/manifest-v1.js +370 -0
- package/dist/src/eval/manifest-v1.js.map +1 -0
- package/dist/src/generators/local-plugin.d.ts +5 -1
- package/dist/src/generators/local-plugin.js +225 -104
- package/dist/src/generators/local-plugin.js.map +1 -1
- package/dist/src/index.d.ts +10 -4
- package/dist/src/index.js +1787 -476
- package/dist/src/index.js.map +1 -1
- package/dist/src/output/command-receipt.d.ts +43 -46
- package/dist/src/output/command-receipt.js +256 -80
- package/dist/src/output/command-receipt.js.map +1 -1
- package/dist/src/output/model.d.ts +3 -44
- package/dist/src/output/model.js +1 -144
- package/dist/src/output/model.js.map +1 -1
- package/dist/src/output/rebuild-progress.js +1 -13
- package/dist/src/output/rebuild-progress.js.map +1 -1
- package/dist/src/portable/commands.d.ts +46 -7
- package/dist/src/portable/commands.js +349 -37
- package/dist/src/portable/commands.js.map +1 -1
- package/dist/src/portable/materializer.d.ts +17 -4
- package/dist/src/portable/materializer.js +160 -38
- package/dist/src/portable/materializer.js.map +1 -1
- package/dist/src/portable/skills-cli.d.ts +15 -7
- package/dist/src/portable/skills-cli.js +66 -19
- package/dist/src/portable/skills-cli.js.map +1 -1
- package/dist/src/review/eval-source-input.d.ts +43 -0
- package/dist/src/review/eval-source-input.js +207 -0
- package/dist/src/review/eval-source-input.js.map +1 -0
- package/dist/src/review/review-profile.d.ts +17 -0
- package/dist/src/review/review-profile.js +177 -0
- package/dist/src/review/review-profile.js.map +1 -0
- package/dist/src/review/review-selection.d.ts +30 -0
- package/dist/src/review/review-selection.js +527 -0
- package/dist/src/review/review-selection.js.map +1 -0
- package/dist/src/review/review-types.d.ts +68 -0
- package/dist/src/review/review-types.js +16 -0
- package/dist/src/review/review-types.js.map +1 -0
- package/dist/src/review/skill-materialization.d.ts +13 -0
- package/dist/src/review/skill-materialization.js +75 -0
- package/dist/src/review/skill-materialization.js.map +1 -0
- package/dist/src/review/source-binding.d.ts +182 -0
- package/dist/src/review/source-binding.js +682 -0
- package/dist/src/review/source-binding.js.map +1 -0
- package/dist/src/tui/catalog-freshness.d.ts +1 -0
- package/dist/src/tui/catalog-freshness.js +2 -0
- package/dist/src/tui/catalog-freshness.js.map +1 -0
- package/dist/src/tui/catalog-generation.d.ts +21 -0
- package/dist/src/tui/catalog-generation.js +156 -0
- package/dist/src/tui/catalog-generation.js.map +1 -0
- package/dist/src/tui/catalog-sources/projection.d.ts +4 -0
- package/dist/src/tui/catalog-sources/projection.js +17 -0
- package/dist/src/tui/catalog-sources/projection.js.map +1 -0
- package/dist/src/tui/catalog-sources/review.d.ts +3 -0
- package/dist/src/tui/catalog-sources/review.js +13 -0
- package/dist/src/tui/catalog-sources/review.js.map +1 -0
- package/dist/src/tui/catalog-sources/screens.d.ts +12 -0
- package/dist/src/tui/catalog-sources/screens.js +40 -0
- package/dist/src/tui/catalog-sources/screens.js.map +1 -0
- package/dist/src/tui/catalog-sources/session.d.ts +28 -0
- package/dist/src/tui/catalog-sources/session.js +295 -0
- package/dist/src/tui/catalog-sources/session.js.map +1 -0
- package/dist/src/tui/catalog-sources/types.d.ts +53 -0
- package/dist/src/tui/catalog-sources/types.js +2 -0
- package/dist/src/tui/catalog-sources/types.js.map +1 -0
- package/dist/src/tui/catalog-store-task.d.ts +16 -0
- package/dist/src/tui/catalog-store-task.js +19 -0
- package/dist/src/tui/catalog-store-task.js.map +1 -0
- package/dist/src/tui/components.d.ts +128 -0
- package/dist/src/tui/components.js +251 -7
- package/dist/src/tui/components.js.map +1 -1
- package/dist/src/tui/console-app-v4.d.ts +14 -4
- package/dist/src/tui/console-app-v4.js +9248 -1461
- package/dist/src/tui/console-app-v4.js.map +1 -1
- package/dist/src/tui/controller-runtime.d.ts +13 -1
- package/dist/src/tui/controller-runtime.js +3338 -410
- package/dist/src/tui/controller-runtime.js.map +1 -1
- package/dist/src/tui/controller.d.ts +614 -40
- package/dist/src/tui/controller.js +3478 -708
- package/dist/src/tui/controller.js.map +1 -1
- package/dist/src/tui/dependency-graph.d.ts +81 -0
- package/dist/src/tui/dependency-graph.js +455 -0
- package/dist/src/tui/dependency-graph.js.map +1 -0
- package/dist/src/tui/diagnostic-projection.d.ts +23 -0
- package/dist/src/tui/diagnostic-projection.js +567 -0
- package/dist/src/tui/diagnostic-projection.js.map +1 -0
- package/dist/src/tui/diagnostics.d.ts +30 -0
- package/dist/src/tui/diagnostics.js +76 -0
- package/dist/src/tui/diagnostics.js.map +1 -0
- package/dist/src/tui/glossary.d.ts +23 -0
- package/dist/src/tui/glossary.js +42 -0
- package/dist/src/tui/glossary.js.map +1 -0
- package/dist/src/tui/index.d.ts +11 -4
- package/dist/src/tui/index.js +8 -2
- package/dist/src/tui/index.js.map +1 -1
- package/dist/src/tui/input-display.d.ts +8 -0
- package/dist/src/tui/input-display.js +36 -0
- package/dist/src/tui/input-display.js.map +1 -0
- package/dist/src/tui/keys.d.ts +44 -0
- package/dist/src/tui/keys.js +43 -15
- package/dist/src/tui/keys.js.map +1 -1
- package/dist/src/tui/lifecycle-action-view.d.ts +6 -0
- package/dist/src/tui/lifecycle-action-view.js +36 -0
- package/dist/src/tui/lifecycle-action-view.js.map +1 -0
- package/dist/src/tui/model.d.ts +235 -27
- package/dist/src/tui/model.js +1652 -304
- package/dist/src/tui/model.js.map +1 -1
- package/dist/src/tui/operation-diagnostic-screens.d.ts +21 -0
- package/dist/src/tui/operation-diagnostic-screens.js +102 -0
- package/dist/src/tui/operation-diagnostic-screens.js.map +1 -0
- package/dist/src/tui/operation-history.d.ts +81 -0
- package/dist/src/tui/operation-history.js +135 -0
- package/dist/src/tui/operation-history.js.map +1 -0
- package/dist/src/tui/operation-review-planner.d.ts +21 -0
- package/dist/src/tui/operation-review-planner.js +1254 -0
- package/dist/src/tui/operation-review-planner.js.map +1 -0
- package/dist/src/tui/plugin-content.d.ts +23 -0
- package/dist/src/tui/plugin-content.js +336 -0
- package/dist/src/tui/plugin-content.js.map +1 -0
- package/dist/src/tui/plugin-write-task.d.ts +69 -0
- package/dist/src/tui/plugin-write-task.js +286 -0
- package/dist/src/tui/plugin-write-task.js.map +1 -0
- package/dist/src/tui/prompt.js +4 -15
- package/dist/src/tui/prompt.js.map +1 -1
- package/dist/src/tui/router.d.ts +183 -11
- package/dist/src/tui/router.js +352 -29
- package/dist/src/tui/router.js.map +1 -1
- package/dist/src/tui/screen-registry.d.ts +702 -0
- package/dist/src/tui/screen-registry.js +231 -0
- package/dist/src/tui/screen-registry.js.map +1 -0
- package/dist/src/tui/session-console-app.d.ts +6 -0
- package/dist/src/tui/session-console-app.js +13 -0
- package/dist/src/tui/session-console-app.js.map +1 -0
- package/dist/src/tui/session-host.d.ts +45 -0
- package/dist/src/tui/session-host.js +209 -0
- package/dist/src/tui/session-host.js.map +1 -0
- package/dist/src/tui/source-ref-presets.d.ts +3 -0
- package/dist/src/tui/source-ref-presets.js +11 -0
- package/dist/src/tui/source-ref-presets.js.map +1 -0
- package/dist/src/tui/theme.d.ts +18 -10
- package/dist/src/tui/theme.js +18 -10
- package/dist/src/tui/theme.js.map +1 -1
- package/dist/src/tui/viewport.d.ts +20 -0
- package/dist/src/tui/viewport.js +29 -0
- package/dist/src/tui/viewport.js.map +1 -0
- package/dist/src/tui/views.js +31 -3
- package/dist/src/tui/views.js.map +1 -1
- package/dist/src/tui/wizard.js +11 -9
- package/dist/src/tui/wizard.js.map +1 -1
- package/dist/src/types.d.ts +242 -20
- package/dist/src/types.js +1 -0
- package/dist/src/types.js.map +1 -1
- package/dist/src/utils/agent-version.d.ts +7 -1
- package/dist/src/utils/agent-version.js +41 -8
- package/dist/src/utils/agent-version.js.map +1 -1
- package/dist/src/utils/artifact-plan.d.ts +5 -4
- package/dist/src/utils/artifact-plan.js +18 -7
- package/dist/src/utils/artifact-plan.js.map +1 -1
- package/dist/src/utils/artifact-renderer.d.ts +13 -7
- package/dist/src/utils/artifact-renderer.js +196 -219
- package/dist/src/utils/artifact-renderer.js.map +1 -1
- package/dist/src/utils/artifact-request.d.ts +21 -0
- package/dist/src/utils/artifact-request.js +82 -0
- package/dist/src/utils/artifact-request.js.map +1 -0
- package/dist/src/utils/aw-home-mutation-lock.d.ts +1 -0
- package/dist/src/utils/aw-home-mutation-lock.js +32 -4
- package/dist/src/utils/aw-home-mutation-lock.js.map +1 -1
- package/dist/src/utils/bundle-integrity.d.ts +0 -1
- package/dist/src/utils/bundle-integrity.js +0 -25
- package/dist/src/utils/bundle-integrity.js.map +1 -1
- package/dist/src/utils/bundle-layout.js +14 -29
- package/dist/src/utils/bundle-layout.js.map +1 -1
- package/dist/src/utils/catalog-capability-projection.d.ts +8 -0
- package/dist/src/utils/catalog-capability-projection.js +14 -0
- package/dist/src/utils/catalog-capability-projection.js.map +1 -0
- package/dist/src/utils/catalog-digests.d.ts +10 -0
- package/dist/src/utils/catalog-digests.js +50 -2
- package/dist/src/utils/catalog-digests.js.map +1 -1
- package/dist/src/utils/catalog-generation-control-snapshot.d.ts +11 -0
- package/dist/src/utils/catalog-generation-control-snapshot.js +45 -0
- package/dist/src/utils/catalog-generation-control-snapshot.js.map +1 -0
- package/dist/src/utils/catalog-generation-error.d.ts +16 -0
- package/dist/src/utils/catalog-generation-error.js +30 -0
- package/dist/src/utils/catalog-generation-error.js.map +1 -0
- package/dist/src/utils/catalog-generation-resolver.d.ts +44 -0
- package/dist/src/utils/catalog-generation-resolver.js +273 -0
- package/dist/src/utils/catalog-generation-resolver.js.map +1 -0
- package/dist/src/utils/catalog-generation-service.d.ts +172 -0
- package/dist/src/utils/catalog-generation-service.js +1271 -0
- package/dist/src/utils/catalog-generation-service.js.map +1 -0
- package/dist/src/utils/catalog-generation-state.d.ts +22 -0
- package/dist/src/utils/catalog-generation-state.js +192 -0
- package/dist/src/utils/catalog-generation-state.js.map +1 -0
- package/dist/src/utils/catalog-generation-store.d.ts +58 -0
- package/dist/src/utils/catalog-generation-store.js +452 -0
- package/dist/src/utils/catalog-generation-store.js.map +1 -0
- package/dist/src/utils/catalog-manifest-v7.d.ts +5 -0
- package/dist/src/utils/{catalog-manifest-v4.js → catalog-manifest-v7.js} +35 -43
- package/dist/src/utils/catalog-manifest-v7.js.map +1 -0
- package/dist/src/utils/catalog-operation-context.d.ts +20 -0
- package/dist/src/utils/catalog-operation-context.js +142 -0
- package/dist/src/utils/catalog-operation-context.js.map +1 -0
- package/dist/src/utils/catalog-public-error.d.ts +7 -3
- package/dist/src/utils/catalog-public-error.js +28 -8
- package/dist/src/utils/catalog-public-error.js.map +1 -1
- package/dist/src/utils/catalog-runtime-projection.d.ts +4 -7
- package/dist/src/utils/catalog-runtime-projection.js +7 -102
- package/dist/src/utils/catalog-runtime-projection.js.map +1 -1
- package/dist/src/utils/catalog-snapshot.d.ts +5 -3
- package/dist/src/utils/catalog-snapshot.js +11 -3
- package/dist/src/utils/catalog-snapshot.js.map +1 -1
- package/dist/src/utils/catalog-source-identity.d.ts +1 -0
- package/dist/src/utils/catalog-source-identity.js +21 -2
- package/dist/src/utils/catalog-source-identity.js.map +1 -1
- package/dist/src/utils/catalog-source-impact.d.ts +21 -0
- package/dist/src/utils/catalog-source-impact.js +344 -0
- package/dist/src/utils/catalog-source-impact.js.map +1 -0
- package/dist/src/utils/catalog-source-references.d.ts +3 -2
- package/dist/src/utils/catalog-source-references.js +195 -347
- package/dist/src/utils/catalog-source-references.js.map +1 -1
- package/dist/src/utils/catalog-sources.d.ts +15 -1
- package/dist/src/utils/catalog-sources.js +206 -27
- package/dist/src/utils/catalog-sources.js.map +1 -1
- package/dist/src/utils/codex-config.d.ts +2 -0
- package/dist/src/utils/codex-config.js +26 -5
- package/dist/src/utils/codex-config.js.map +1 -1
- package/dist/src/utils/codex-manager.d.ts +79 -0
- package/dist/src/utils/codex-manager.js +745 -0
- package/dist/src/utils/codex-manager.js.map +1 -0
- package/dist/src/utils/codex-marketplace-path.d.ts +5 -0
- package/dist/src/utils/codex-marketplace-path.js +45 -0
- package/dist/src/utils/codex-marketplace-path.js.map +1 -0
- package/dist/src/utils/codex-native-observation.d.ts +49 -0
- package/dist/src/utils/codex-native-observation.js +154 -0
- package/dist/src/utils/codex-native-observation.js.map +1 -0
- package/dist/src/utils/codex-native-render-receipt.d.ts +40 -0
- package/dist/src/utils/codex-native-render-receipt.js +205 -0
- package/dist/src/utils/codex-native-render-receipt.js.map +1 -0
- package/dist/src/utils/codex-reconciler.d.ts +126 -0
- package/dist/src/utils/codex-reconciler.js +298 -0
- package/dist/src/utils/codex-reconciler.js.map +1 -0
- package/dist/src/utils/codex-shared-native.d.ts +43 -0
- package/dist/src/utils/codex-shared-native.js +81 -0
- package/dist/src/utils/codex-shared-native.js.map +1 -0
- package/dist/src/utils/codex-skill-staging.d.ts +2 -0
- package/dist/src/utils/codex-skill-staging.js.map +1 -1
- package/dist/src/utils/codex-surface-analysis.d.ts +46 -0
- package/dist/src/utils/codex-surface-analysis.js +247 -0
- package/dist/src/utils/codex-surface-analysis.js.map +1 -0
- package/dist/src/utils/dynamic-skill-tree.d.ts +4 -0
- package/dist/src/utils/dynamic-skill-tree.js +36 -6
- package/dist/src/utils/dynamic-skill-tree.js.map +1 -1
- package/dist/src/utils/git-catalog-provider.d.ts +18 -0
- package/dist/src/utils/git-catalog-provider.js +170 -144
- package/dist/src/utils/git-catalog-provider.js.map +1 -1
- package/dist/src/utils/local-marketplace.d.ts +15 -1
- package/dist/src/utils/local-marketplace.js +307 -84
- package/dist/src/utils/local-marketplace.js.map +1 -1
- package/dist/src/utils/manifest.d.ts +1 -4
- package/dist/src/utils/manifest.js +1 -4
- package/dist/src/utils/manifest.js.map +1 -1
- package/dist/src/utils/multi-source-catalog.d.ts +3 -9
- package/dist/src/utils/multi-source-catalog.js +54 -110
- package/dist/src/utils/multi-source-catalog.js.map +1 -1
- package/dist/src/utils/native-cli.d.ts +55 -7
- package/dist/src/utils/native-cli.js +386 -57
- package/dist/src/utils/native-cli.js.map +1 -1
- package/dist/src/utils/orphan-marketplace-cleanup.js +0 -4
- package/dist/src/utils/orphan-marketplace-cleanup.js.map +1 -1
- package/dist/src/utils/ownership.d.ts +84 -20
- package/dist/src/utils/ownership.js +179 -222
- package/dist/src/utils/ownership.js.map +1 -1
- package/dist/src/utils/path-catalog-provider.d.ts +1 -1
- package/dist/src/utils/path-catalog-provider.js +54 -65
- package/dist/src/utils/path-catalog-provider.js.map +1 -1
- package/dist/src/utils/paths.d.ts +0 -1
- package/dist/src/utils/paths.js +0 -1
- package/dist/src/utils/paths.js.map +1 -1
- package/dist/src/utils/plugin-config-impact.d.ts +33 -0
- package/dist/src/utils/plugin-config-impact.js +298 -0
- package/dist/src/utils/plugin-config-impact.js.map +1 -0
- package/dist/src/utils/plugin-config-write.d.ts +52 -27
- package/dist/src/utils/plugin-config-write.js +990 -298
- package/dist/src/utils/plugin-config-write.js.map +1 -1
- package/dist/src/utils/plugin-config.d.ts +140 -93
- package/dist/src/utils/plugin-config.js +992 -980
- package/dist/src/utils/plugin-config.js.map +1 -1
- package/dist/src/utils/plugin-intent-state.d.ts +49 -0
- package/dist/src/utils/plugin-intent-state.js +320 -0
- package/dist/src/utils/plugin-intent-state.js.map +1 -0
- package/dist/src/utils/plugin-scripts.d.ts +62 -125
- package/dist/src/utils/plugin-scripts.js +468 -525
- package/dist/src/utils/plugin-scripts.js.map +1 -1
- package/dist/src/utils/process-tree.d.ts +2 -2
- package/dist/src/utils/process-tree.js +1 -1
- package/dist/src/utils/process-tree.js.map +1 -1
- package/dist/src/utils/project-boundary.d.ts +11 -13
- package/dist/src/utils/project-boundary.js +28 -34
- package/dist/src/utils/project-boundary.js.map +1 -1
- package/dist/src/utils/safe-fs.d.ts +21 -0
- package/dist/src/utils/safe-fs.js +111 -0
- package/dist/src/utils/safe-fs.js.map +1 -0
- package/dist/src/utils/safe-operation-diagnostic.d.ts +15 -0
- package/dist/src/utils/safe-operation-diagnostic.js +33 -0
- package/dist/src/utils/safe-operation-diagnostic.js.map +1 -0
- package/dist/src/utils/sensitive-content.d.ts +4 -0
- package/dist/src/utils/sensitive-content.js +36 -0
- package/dist/src/utils/sensitive-content.js.map +1 -0
- package/dist/src/utils/skill-validation.d.ts +1 -1
- package/dist/src/utils/skill-validation.js +1 -1
- package/dist/src/utils/skill-validation.js.map +1 -1
- package/dist/src/utils/state-paths.d.ts +1 -0
- package/dist/src/utils/state-paths.js +12 -2
- package/dist/src/utils/state-paths.js.map +1 -1
- package/dist/src/utils/target-eligibility.d.ts +8 -2
- package/dist/src/utils/target-eligibility.js +17 -8
- package/dist/src/utils/target-eligibility.js.map +1 -1
- package/dist/src/utils/windows-claude-shim.d.ts +9 -0
- package/dist/src/utils/windows-claude-shim.js +141 -0
- package/dist/src/utils/windows-claude-shim.js.map +1 -0
- package/dist/vitest.config.js +91 -10
- package/dist/vitest.config.js.map +1 -1
- package/package.json +22 -19
- package/dist/authoring/scripts/check-plugin-versions.mjs +0 -5
- package/dist/authoring/scripts/check-plugin-versions.mjs.map +0 -1
- package/dist/scripts/aw-skill-eval-engine.d.ts +0 -13
- package/dist/scripts/aw-skill-eval-engine.js +0 -31
- package/dist/scripts/aw-skill-eval-engine.js.map +0 -1
- package/dist/scripts/codex-eval-app-server.d.ts +0 -89
- package/dist/scripts/codex-eval-app-server.js +0 -1228
- package/dist/scripts/codex-eval-app-server.js.map +0 -1
- package/dist/scripts/codex-eval-isolation.d.ts +0 -61
- package/dist/scripts/codex-eval-isolation.js +0 -318
- package/dist/scripts/codex-eval-isolation.js.map +0 -1
- package/dist/scripts/codex-eval-process-management.d.ts +0 -8
- package/dist/scripts/codex-eval-process-management.js +0 -69
- package/dist/scripts/codex-eval-process-management.js.map +0 -1
- package/dist/scripts/codex-eval-process-tree.d.ts +0 -38
- package/dist/scripts/codex-eval-process-tree.js +0 -803
- package/dist/scripts/codex-eval-process-tree.js.map +0 -1
- package/dist/scripts/codex-eval-runtime-config.d.ts +0 -62
- package/dist/scripts/codex-eval-runtime-config.js +0 -843
- package/dist/scripts/codex-eval-runtime-config.js.map +0 -1
- package/dist/scripts/codex-trigger-eval.d.ts +0 -84
- package/dist/scripts/codex-trigger-eval.js +0 -968
- package/dist/scripts/codex-trigger-eval.js.map +0 -1
- package/dist/scripts/eval-plugin-skills-audited.d.ts +0 -6
- package/dist/scripts/eval-plugin-skills-audited.js +0 -261
- package/dist/scripts/eval-plugin-skills-audited.js.map +0 -1
- package/dist/scripts/eval-plugin-skills.d.ts +0 -45
- package/dist/scripts/eval-plugin-skills.js +0 -1586
- package/dist/scripts/eval-plugin-skills.js.map +0 -1
- package/dist/scripts/eval-run-layout.d.ts +0 -17
- package/dist/scripts/eval-run-layout.js +0 -26
- package/dist/scripts/eval-run-layout.js.map +0 -1
- package/dist/scripts/plugin-eval-contract.d.ts +0 -185
- package/dist/scripts/plugin-eval-contract.js +0 -695
- package/dist/scripts/plugin-eval-contract.js.map +0 -1
- package/dist/scripts/plugin-eval-materializer.d.ts +0 -13
- package/dist/scripts/plugin-eval-materializer.js +0 -421
- package/dist/scripts/plugin-eval-materializer.js.map +0 -1
- package/dist/scripts/skill-reporting.d.ts +0 -212
- package/dist/scripts/skill-reporting.js +0 -922
- package/dist/scripts/skill-reporting.js.map +0 -1
- package/dist/src/commands/status-v4.d.ts +0 -102
- package/dist/src/commands/status-v4.js +0 -844
- package/dist/src/commands/status-v4.js.map +0 -1
- package/dist/src/commands/status.d.ts +0 -93
- package/dist/src/commands/status.js +0 -442
- package/dist/src/commands/status.js.map +0 -1
- package/dist/src/utils/active-marketplace-runtime-lock.d.ts +0 -12
- package/dist/src/utils/active-marketplace-runtime-lock.js +0 -133
- package/dist/src/utils/active-marketplace-runtime-lock.js.map +0 -1
- package/dist/src/utils/catalog-manifest-v3.d.ts +0 -2
- package/dist/src/utils/catalog-manifest-v3.js +0 -3
- package/dist/src/utils/catalog-manifest-v3.js.map +0 -1
- package/dist/src/utils/catalog-manifest-v4.d.ts +0 -5
- package/dist/src/utils/catalog-manifest-v4.js.map +0 -1
- package/dist/src/utils/catalog-source-cache.d.ts +0 -61
- package/dist/src/utils/catalog-source-cache.js +0 -276
- package/dist/src/utils/catalog-source-cache.js.map +0 -1
- package/dist/src/utils/codex-project-surface.d.ts +0 -3
- package/dist/src/utils/codex-project-surface.js +0 -49
- package/dist/src/utils/codex-project-surface.js.map +0 -1
- package/dist/src/utils/lifecycle-active-store.d.ts +0 -175
- package/dist/src/utils/lifecycle-active-store.js +0 -1276
- package/dist/src/utils/lifecycle-active-store.js.map +0 -1
- package/dist/src/utils/plugin-authoring-capabilities.d.ts +0 -23
- package/dist/src/utils/plugin-authoring-capabilities.js +0 -37
- package/dist/src/utils/plugin-authoring-capabilities.js.map +0 -1
- package/dist/src/utils/plugin-authoring-capabilities.json +0 -92
- package/dist/src/utils/plugin-release.d.ts +0 -2
- package/dist/src/utils/plugin-release.js +0 -2
- package/dist/src/utils/plugin-release.js.map +0 -1
- package/dist/src/utils/skill-frontmatter-capabilities.d.ts +0 -201
- package/dist/src/utils/skill-frontmatter-capabilities.js +0 -5
- package/dist/src/utils/skill-frontmatter-capabilities.js.map +0 -1
- package/dist/src/utils/skill-frontmatter-capabilities.json +0 -200
- /package/dist/authoring/scripts/{check-plugin-versions.d.mts → remove-plugin.d.mts} +0 -0
|
@@ -0,0 +1,655 @@
|
|
|
1
|
+
import crypto from 'node:crypto';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { DEFAULT_CATALOG_OUTPUT_PATH, readCatalogWorkspace, validateCatalogSnapshotComplete, } from '@lesliechan721/aw-plugin-core';
|
|
4
|
+
import { runCatalogBuildCommand } from '../authoring/workspace-commands.js';
|
|
5
|
+
import { probeCatalogSourceGeneration, readCatalogGenerationStatus, } from '../utils/catalog-generation-service.js';
|
|
6
|
+
import { readCatalogGenerationState } from '../utils/catalog-generation-state.js';
|
|
7
|
+
import { calculateCatalogSourceImpactDigest, inspectCatalogSourceImpact, } from '../utils/catalog-source-impact.js';
|
|
8
|
+
import { CLI_RESERVED_IMPORTS } from '../utils/manifest.js';
|
|
9
|
+
import { CATALOG_SOURCE_ID_PATTERN, addCatalogSource, calculateCatalogSourcesConfigDigest, CatalogSourcesConfigConflictError, isDefaultOfficialCatalogSource, readCatalogSourcesConfigSnapshot, setPrimaryCatalogSource, updateCatalogSource, } from '../utils/catalog-sources.js';
|
|
10
|
+
import { addCatalogSourceCommand, preflightCatalogSourceMutation, removeCatalogSourceCommand, setPrimaryCatalogSourceCommand, updateCatalogSourceCommand, } from './catalog-source.js';
|
|
11
|
+
import { syncCatalogSourceCommand } from './catalog-generation.js';
|
|
12
|
+
import { getCatalogStatus } from './catalog-status.js';
|
|
13
|
+
import { resolveCatalogWorkspaceRoot } from './catalog-workspace-resolution.js';
|
|
14
|
+
function managedSources(sources, workspaceIdentity) {
|
|
15
|
+
return sources.filter((source) => source.type === 'path'
|
|
16
|
+
&& source.managedBy?.kind === 'catalog-workspace'
|
|
17
|
+
&& source.managedBy.workspaceIdentity === workspaceIdentity);
|
|
18
|
+
}
|
|
19
|
+
function normalizeSuggestedSourceId(workspaceRoot) {
|
|
20
|
+
const stem = path.basename(workspaceRoot).toLowerCase()
|
|
21
|
+
.replace(/[^a-z0-9]+/gu, '-').replace(/^-+|-+$/gu, '');
|
|
22
|
+
const prefixed = /^[a-z]/u.test(stem) ? stem : `catalog-${stem}`;
|
|
23
|
+
const basename = (prefixed || 'catalog').slice(0, 28).replace(/-+$/u, '') || 'catalog';
|
|
24
|
+
return `${basename}-dev`;
|
|
25
|
+
}
|
|
26
|
+
function suffixedSourceId(base, workspaceIdentity) {
|
|
27
|
+
const suffix = crypto.createHash('sha256').update(workspaceIdentity).digest('hex').slice(0, 6);
|
|
28
|
+
const prefix = base.slice(0, 32 - suffix.length - 1).replace(/-+$/u, '');
|
|
29
|
+
return `${prefix}-${suffix}`;
|
|
30
|
+
}
|
|
31
|
+
export function suggestedCatalogDevSourceId(workspaceRoot, workspaceIdentity, occupiedSourceIds = []) {
|
|
32
|
+
const base = normalizeSuggestedSourceId(workspaceRoot);
|
|
33
|
+
return workspaceIdentity && occupiedSourceIds.includes(base)
|
|
34
|
+
? suffixedSourceId(base, workspaceIdentity)
|
|
35
|
+
: base;
|
|
36
|
+
}
|
|
37
|
+
class CatalogDevSourceError extends Error {
|
|
38
|
+
code;
|
|
39
|
+
constructor(code, message) {
|
|
40
|
+
super(message);
|
|
41
|
+
this.code = code;
|
|
42
|
+
this.name = 'CatalogDevSourceError';
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function assertExplicitSourceId(sourceId) {
|
|
46
|
+
if (!CATALOG_SOURCE_ID_PATTERN.test(sourceId)) {
|
|
47
|
+
throw new CatalogDevSourceError('invalidSourceId', 'Invalid Catalog development source ID.');
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export function createCatalogDevFailureReceipt(options) {
|
|
51
|
+
const workspaceRoot = path.resolve(options.cwd, options.workspaceRoot ?? '.');
|
|
52
|
+
if (options.command === 'activate') {
|
|
53
|
+
return {
|
|
54
|
+
receiptSchemaVersion: 2, command: 'catalog:dev:activate', ok: false, state: 'failed',
|
|
55
|
+
workspaceIdentity: null,
|
|
56
|
+
snapshot: { action: 'reused', digest: null },
|
|
57
|
+
source: { id: options.sourceId ?? suggestedCatalogDevSourceId(workspaceRoot), action: 'reused', primary: false },
|
|
58
|
+
active: { ready: false, snapshotDigest: null },
|
|
59
|
+
recovery: ['Fix the reported problem, then rerun catalog dev activate.'],
|
|
60
|
+
errors: [{ code: options.code, message: options.message }],
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
if (options.command === 'status') {
|
|
64
|
+
return {
|
|
65
|
+
receiptSchemaVersion: 4, command: 'catalog:dev:status', ok: false, ready: false,
|
|
66
|
+
workspaceIdentity: null,
|
|
67
|
+
snapshot: { state: 'absent', valid: false, digest: null },
|
|
68
|
+
source: { exists: false, id: null, pathMatches: null, primary: null },
|
|
69
|
+
active: {
|
|
70
|
+
exists: false, ready: false, digestMatchesSnapshot: false, snapshotDigest: null,
|
|
71
|
+
compatibility: null,
|
|
72
|
+
},
|
|
73
|
+
issues: [{ code: options.code, message: options.message, blocking: true }],
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
receiptSchemaVersion: 4, command: 'catalog:dev:deactivate', ok: false, state: 'failed',
|
|
78
|
+
workspaceIdentity: null,
|
|
79
|
+
source: { id: null, action: 'absent', previousPrimary: false },
|
|
80
|
+
replacementPrimarySourceId: null,
|
|
81
|
+
impact: null,
|
|
82
|
+
recovery: ['Fix the reported problem, then rerun catalog dev deactivate.'],
|
|
83
|
+
errors: [{ code: options.code, message: options.message }],
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function codedFailure(error, fallbackCode) {
|
|
87
|
+
const candidateCode = typeof error === 'object' && error !== null && 'code' in error
|
|
88
|
+
&& typeof error.code === 'string' ? error.code : undefined;
|
|
89
|
+
const typedCode = candidateCode === 'catalogImpactConfirmationRequired'
|
|
90
|
+
|| candidateCode === 'catalogSourceImpactConfirmationRequired'
|
|
91
|
+
|| candidateCode === 'operationReviewStale'
|
|
92
|
+
? candidateCode
|
|
93
|
+
: undefined;
|
|
94
|
+
return {
|
|
95
|
+
code: error instanceof CatalogDevSourceError ? error.code : typedCode ?? fallbackCode,
|
|
96
|
+
message: error instanceof CatalogDevSourceError ? error.message : 'The Catalog development operation failed.',
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
function failureImpact(error, fallback) {
|
|
100
|
+
if (typeof error !== 'object' || error === null || !('impact' in error))
|
|
101
|
+
return fallback;
|
|
102
|
+
const impact = error.impact;
|
|
103
|
+
return typeof impact === 'object' && impact !== null && 'inventorySchemaVersion' in impact
|
|
104
|
+
&& impact.inventorySchemaVersion === 2
|
|
105
|
+
? impact
|
|
106
|
+
: fallback;
|
|
107
|
+
}
|
|
108
|
+
async function resolveWorkspace(cwd, workspaceRoot) {
|
|
109
|
+
try {
|
|
110
|
+
const resolved = await resolveCatalogWorkspaceRoot({
|
|
111
|
+
cwd,
|
|
112
|
+
...(workspaceRoot === undefined ? {} : { explicitRoot: workspaceRoot }),
|
|
113
|
+
mode: 'existing',
|
|
114
|
+
});
|
|
115
|
+
const workspace = await readCatalogWorkspace(resolved.workspaceRoot, { reservedImports: CLI_RESERVED_IMPORTS });
|
|
116
|
+
return { resolved, workspace };
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
throw new CatalogDevSourceError('workspaceInvalid', 'Catalog Workspace is missing or invalid.');
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
export function catalogDevSourceError(error, fallbackCode = 'catalogDevSourceFailed') {
|
|
123
|
+
return codedFailure(error, fallbackCode);
|
|
124
|
+
}
|
|
125
|
+
export async function preflightCatalogDevSourceActivation(options) {
|
|
126
|
+
const { workspace } = await resolveWorkspace(options.cwd, options.workspaceRoot);
|
|
127
|
+
const status = await getCatalogStatus({
|
|
128
|
+
cwd: options.cwd,
|
|
129
|
+
workspaceRoot: workspace.workspaceRoot,
|
|
130
|
+
env: options.env,
|
|
131
|
+
});
|
|
132
|
+
if (options.forceBuild === true || status.snapshot.state !== 'current'
|
|
133
|
+
|| status.snapshot.snapshotDigest === null) {
|
|
134
|
+
throw new CatalogDevSourceError('catalogDevBuildRequired', 'Build and Review the current Catalog snapshot before activating the development source.');
|
|
135
|
+
}
|
|
136
|
+
const configSnapshot = await readCatalogSourcesConfigSnapshot(options.env);
|
|
137
|
+
const owned = managedSources(configSnapshot.config.sources, workspace.workspaceIdentity);
|
|
138
|
+
if (owned.length > 1) {
|
|
139
|
+
throw new CatalogDevSourceError('multipleManagedSources', 'Workspace owns multiple development sources.');
|
|
140
|
+
}
|
|
141
|
+
const existing = owned[0];
|
|
142
|
+
let sourceId = options.sourceId ?? suggestedCatalogDevSourceId(workspace.workspaceRoot, workspace.workspaceIdentity, configSnapshot.config.sources.map((source) => source.id));
|
|
143
|
+
if (options.sourceId !== undefined) {
|
|
144
|
+
assertExplicitSourceId(options.sourceId);
|
|
145
|
+
if (existing && existing.id !== options.sourceId) {
|
|
146
|
+
throw new CatalogDevSourceError('sourceIdConflict', 'Workspace already owns another development source.');
|
|
147
|
+
}
|
|
148
|
+
const collision = configSnapshot.config.sources.find((source) => source.id === options.sourceId);
|
|
149
|
+
if (collision && collision !== existing) {
|
|
150
|
+
throw new CatalogDevSourceError('sourceIdConflict', 'The selected source ID is already in use.');
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (existing)
|
|
154
|
+
sourceId = existing.id;
|
|
155
|
+
const snapshotPath = path.join(workspace.workspaceRoot, DEFAULT_CATALOG_OUTPUT_PATH);
|
|
156
|
+
let proposedConfig = configSnapshot.config;
|
|
157
|
+
let sourceMutation;
|
|
158
|
+
let sourceImpact;
|
|
159
|
+
const impacts = [];
|
|
160
|
+
if (!existing) {
|
|
161
|
+
const source = {
|
|
162
|
+
id: sourceId,
|
|
163
|
+
type: 'path',
|
|
164
|
+
path: snapshotPath,
|
|
165
|
+
primary: false,
|
|
166
|
+
managedBy: { kind: 'catalog-workspace', workspaceIdentity: workspace.workspaceIdentity },
|
|
167
|
+
};
|
|
168
|
+
const preview = await preflightCatalogSourceMutation({
|
|
169
|
+
request: { action: 'add', source },
|
|
170
|
+
cwd: workspace.workspaceRoot,
|
|
171
|
+
env: options.env,
|
|
172
|
+
managedByWorkspaceIdentity: workspace.workspaceIdentity,
|
|
173
|
+
});
|
|
174
|
+
proposedConfig = await addCatalogSource(configSnapshot.config, source, workspace.workspaceRoot);
|
|
175
|
+
sourceMutation = {
|
|
176
|
+
proposedConfigDigest: preview.proposedConfigDigest,
|
|
177
|
+
impactDigest: preview.impactDigest,
|
|
178
|
+
};
|
|
179
|
+
sourceImpact = preview.references;
|
|
180
|
+
}
|
|
181
|
+
else if (existing.path !== snapshotPath) {
|
|
182
|
+
const preview = await preflightCatalogSourceMutation({
|
|
183
|
+
request: { action: 'update', sourceId, update: { type: 'path', path: snapshotPath } },
|
|
184
|
+
cwd: workspace.workspaceRoot,
|
|
185
|
+
env: options.env,
|
|
186
|
+
managedByWorkspaceIdentity: workspace.workspaceIdentity,
|
|
187
|
+
});
|
|
188
|
+
proposedConfig = await updateCatalogSource(configSnapshot.config, sourceId, { type: 'path', path: snapshotPath }, workspace.workspaceRoot);
|
|
189
|
+
sourceMutation = {
|
|
190
|
+
proposedConfigDigest: preview.proposedConfigDigest,
|
|
191
|
+
impactDigest: preview.impactDigest,
|
|
192
|
+
};
|
|
193
|
+
sourceImpact = preview.references;
|
|
194
|
+
}
|
|
195
|
+
let primaryImpactDigest;
|
|
196
|
+
const configured = proposedConfig.sources.find((source) => source.id === sourceId);
|
|
197
|
+
if (options.primary === true && !configured.primary) {
|
|
198
|
+
const fromSourceId = proposedConfig.sources.find((source) => source.primary)?.id;
|
|
199
|
+
if (!fromSourceId)
|
|
200
|
+
throw new CatalogDevSourceError('sourceConfigInvalid', 'Catalog primary source is missing.');
|
|
201
|
+
const primaryImpact = await inspectCatalogSourceImpact({
|
|
202
|
+
sourceId,
|
|
203
|
+
cwd: workspace.workspaceRoot,
|
|
204
|
+
env: options.env,
|
|
205
|
+
primaryChange: { fromSourceId, toSourceId: sourceId },
|
|
206
|
+
mode: 'none',
|
|
207
|
+
});
|
|
208
|
+
impacts.push(primaryImpact);
|
|
209
|
+
primaryImpactDigest = calculateCatalogSourceImpactDigest(primaryImpact);
|
|
210
|
+
proposedConfig = setPrimaryCatalogSource(proposedConfig, sourceId);
|
|
211
|
+
}
|
|
212
|
+
const intendedSource = proposedConfig.sources.find((source) => source.id === sourceId);
|
|
213
|
+
const probe = await probeCatalogSourceGeneration({
|
|
214
|
+
sourceId,
|
|
215
|
+
source: intendedSource,
|
|
216
|
+
cliVersion: options.cliVersion,
|
|
217
|
+
env: options.env,
|
|
218
|
+
});
|
|
219
|
+
const generationImpact = await inspectCatalogSourceImpact({
|
|
220
|
+
sourceId,
|
|
221
|
+
cwd: workspace.workspaceRoot,
|
|
222
|
+
env: options.env,
|
|
223
|
+
sourcePrimary: intendedSource.primary,
|
|
224
|
+
mode: 'generation',
|
|
225
|
+
candidateManifest: probe.manifest,
|
|
226
|
+
});
|
|
227
|
+
impacts.push(generationImpact);
|
|
228
|
+
const active = (await readCatalogGenerationState(options.env)).sources[sourceId]?.active ?? null;
|
|
229
|
+
return {
|
|
230
|
+
review: {
|
|
231
|
+
workspaceIdentity: workspace.workspaceIdentity,
|
|
232
|
+
snapshotDigest: status.snapshot.snapshotDigest,
|
|
233
|
+
sourceId,
|
|
234
|
+
initialConfigDigest: configSnapshot.digest,
|
|
235
|
+
finalConfigDigest: calculateCatalogSourcesConfigDigest(proposedConfig),
|
|
236
|
+
...(sourceMutation ? { sourceMutation } : {}),
|
|
237
|
+
...(primaryImpactDigest ? { primaryImpactDigest } : {}),
|
|
238
|
+
candidate: probe.candidate,
|
|
239
|
+
active,
|
|
240
|
+
generationImpactDigest: calculateCatalogSourceImpactDigest(generationImpact),
|
|
241
|
+
},
|
|
242
|
+
impacts,
|
|
243
|
+
...(sourceImpact ? { sourceImpact } : {}),
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
export async function activateCatalogDevSource(options) {
|
|
247
|
+
const { resolved, workspace } = await resolveWorkspace(options.cwd, options.workspaceRoot);
|
|
248
|
+
const snapshotPath = path.join(workspace.workspaceRoot, DEFAULT_CATALOG_OUTPUT_PATH);
|
|
249
|
+
const staticStatus = await getCatalogStatus({
|
|
250
|
+
cwd: options.cwd, workspaceRoot: workspace.workspaceRoot, env: options.env,
|
|
251
|
+
});
|
|
252
|
+
let snapshotAction = 'reused';
|
|
253
|
+
let snapshotDigest = staticStatus.snapshot.snapshotDigest;
|
|
254
|
+
if (options.expectedReview) {
|
|
255
|
+
if (options.forceBuild === true
|
|
256
|
+
|| staticStatus.snapshot.state !== 'current'
|
|
257
|
+
|| snapshotDigest !== options.expectedReview.snapshotDigest
|
|
258
|
+
|| workspace.workspaceIdentity !== options.expectedReview.workspaceIdentity) {
|
|
259
|
+
throw new CatalogDevSourceError('operationReviewStale', 'Catalog Workspace snapshot changed after Review. Review it again.');
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
if (options.forceBuild === true || staticStatus.snapshot.state !== 'current') {
|
|
263
|
+
try {
|
|
264
|
+
await runCatalogBuildCommand({
|
|
265
|
+
workspaceRoot: workspace.workspaceRoot,
|
|
266
|
+
workspaceRootResolvedFrom: resolved.workspaceRootResolvedFrom,
|
|
267
|
+
force: options.forceBuild === true || staticStatus.snapshot.state !== 'absent',
|
|
268
|
+
io: { stdout: () => undefined, stderr: () => undefined },
|
|
269
|
+
});
|
|
270
|
+
snapshotDigest = (await validateCatalogSnapshotComplete(snapshotPath)).snapshotDigest;
|
|
271
|
+
snapshotAction = 'built';
|
|
272
|
+
}
|
|
273
|
+
catch (error) {
|
|
274
|
+
return {
|
|
275
|
+
receiptSchemaVersion: 2, command: 'catalog:dev:activate', ok: false, state: 'failed',
|
|
276
|
+
workspaceIdentity: workspace.workspaceIdentity,
|
|
277
|
+
snapshot: { action: 'built', digest: null },
|
|
278
|
+
source: { id: options.sourceId ?? normalizeSuggestedSourceId(workspace.workspaceRoot), action: 'reused', primary: false },
|
|
279
|
+
active: { ready: false, snapshotDigest: null },
|
|
280
|
+
recovery: ['Fix the Catalog Workspace, then rerun catalog dev activate.'],
|
|
281
|
+
errors: [codedFailure(error, 'snapshotBuildFailed')],
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
let selectedId = options.sourceId ?? normalizeSuggestedSourceId(workspace.workspaceRoot);
|
|
286
|
+
let sourceAction = 'reused';
|
|
287
|
+
let sourceCommitted = false;
|
|
288
|
+
try {
|
|
289
|
+
const configSnapshot = await readCatalogSourcesConfigSnapshot(options.env);
|
|
290
|
+
if (options.expectedReview && configSnapshot.digest !== options.expectedReview.initialConfigDigest) {
|
|
291
|
+
throw new CatalogDevSourceError('operationReviewStale', 'Catalog source configuration changed after Review. Review it again.');
|
|
292
|
+
}
|
|
293
|
+
const owned = managedSources(configSnapshot.config.sources, workspace.workspaceIdentity);
|
|
294
|
+
if (owned.length > 1) {
|
|
295
|
+
throw new CatalogDevSourceError('multipleManagedSources', 'Workspace owns multiple development sources.');
|
|
296
|
+
}
|
|
297
|
+
const existing = owned[0];
|
|
298
|
+
if (options.sourceId !== undefined) {
|
|
299
|
+
assertExplicitSourceId(options.sourceId);
|
|
300
|
+
if (existing && existing.id !== options.sourceId) {
|
|
301
|
+
throw new CatalogDevSourceError('sourceIdConflict', 'Workspace already owns another development source.');
|
|
302
|
+
}
|
|
303
|
+
const collision = configSnapshot.config.sources.find((source) => source.id === options.sourceId);
|
|
304
|
+
if (collision && collision !== existing) {
|
|
305
|
+
throw new CatalogDevSourceError('sourceIdConflict', 'The selected source ID is already in use.');
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
else if (!existing && configSnapshot.config.sources.some((source) => source.id === selectedId)) {
|
|
309
|
+
selectedId = suffixedSourceId(selectedId, workspace.workspaceIdentity);
|
|
310
|
+
if (configSnapshot.config.sources.some((source) => source.id === selectedId)) {
|
|
311
|
+
throw new CatalogDevSourceError('sourceIdConflict', 'The generated development source ID is already in use.');
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
if (existing)
|
|
315
|
+
selectedId = existing.id;
|
|
316
|
+
if (options.expectedReview && selectedId !== options.expectedReview.sourceId) {
|
|
317
|
+
throw new CatalogDevSourceError('operationReviewStale', 'Catalog development source selection changed after Review.');
|
|
318
|
+
}
|
|
319
|
+
let currentConfigDigest = configSnapshot.digest;
|
|
320
|
+
if (!existing) {
|
|
321
|
+
sourceAction = 'added';
|
|
322
|
+
const mutation = await addCatalogSourceCommand({
|
|
323
|
+
source: {
|
|
324
|
+
id: selectedId, type: 'path', path: snapshotPath, primary: false,
|
|
325
|
+
managedBy: { kind: 'catalog-workspace', workspaceIdentity: workspace.workspaceIdentity },
|
|
326
|
+
},
|
|
327
|
+
cliVersion: options.cliVersion, cwd: workspace.workspaceRoot, env: options.env,
|
|
328
|
+
runtime: options.runtime?.sourceRuntime,
|
|
329
|
+
managedByWorkspaceIdentity: workspace.workspaceIdentity,
|
|
330
|
+
expectedConfigDigest: options.expectedReview?.initialConfigDigest,
|
|
331
|
+
expectedProposedConfigDigest: options.expectedReview?.sourceMutation?.proposedConfigDigest,
|
|
332
|
+
expectedImpactDigest: options.expectedReview?.sourceMutation?.impactDigest,
|
|
333
|
+
});
|
|
334
|
+
currentConfigDigest = mutation.configDigest ?? currentConfigDigest;
|
|
335
|
+
sourceCommitted = true;
|
|
336
|
+
}
|
|
337
|
+
else if (existing.path !== snapshotPath) {
|
|
338
|
+
sourceAction = 'updated';
|
|
339
|
+
const mutation = await updateCatalogSourceCommand({
|
|
340
|
+
sourceId: existing.id, update: { type: 'path', path: snapshotPath },
|
|
341
|
+
cliVersion: options.cliVersion, cwd: workspace.workspaceRoot, env: options.env,
|
|
342
|
+
runtime: options.runtime?.sourceRuntime,
|
|
343
|
+
managedByWorkspaceIdentity: workspace.workspaceIdentity,
|
|
344
|
+
expectedConfigDigest: options.expectedReview?.initialConfigDigest,
|
|
345
|
+
expectedProposedConfigDigest: options.expectedReview?.sourceMutation?.proposedConfigDigest,
|
|
346
|
+
expectedImpactDigest: options.expectedReview?.sourceMutation?.impactDigest,
|
|
347
|
+
...(options.expectedReview ? {
|
|
348
|
+
requireIdentityChangeConfirmation: true,
|
|
349
|
+
confirmIdentityChange: options.yes === true,
|
|
350
|
+
} : {}),
|
|
351
|
+
});
|
|
352
|
+
currentConfigDigest = mutation.configDigest ?? currentConfigDigest;
|
|
353
|
+
sourceCommitted = true;
|
|
354
|
+
}
|
|
355
|
+
const current = (await readCatalogSourcesConfigSnapshot(options.env)).config.sources
|
|
356
|
+
.find((source) => source.id === selectedId);
|
|
357
|
+
if (options.primary === true && !current.primary) {
|
|
358
|
+
const mutation = await setPrimaryCatalogSourceCommand({
|
|
359
|
+
sourceId: selectedId, cwd: workspace.workspaceRoot, env: options.env,
|
|
360
|
+
runtime: options.runtime?.sourceRuntime,
|
|
361
|
+
requireImpactConfirmation: true,
|
|
362
|
+
confirmImpact: options.yes === true,
|
|
363
|
+
expectedConfigDigest: options.expectedReview ? currentConfigDigest : undefined,
|
|
364
|
+
expectedImpactDigest: options.expectedReview?.primaryImpactDigest,
|
|
365
|
+
});
|
|
366
|
+
currentConfigDigest = mutation.configDigest ?? currentConfigDigest;
|
|
367
|
+
sourceCommitted = true;
|
|
368
|
+
}
|
|
369
|
+
if (options.expectedReview && currentConfigDigest !== options.expectedReview.finalConfigDigest) {
|
|
370
|
+
throw new CatalogDevSourceError('operationReviewStale', 'Catalog source configuration no longer matches Review.');
|
|
371
|
+
}
|
|
372
|
+
await options.runtime?.beforeSync?.();
|
|
373
|
+
await syncCatalogSourceCommand({
|
|
374
|
+
sourceId: selectedId,
|
|
375
|
+
cliVersion: options.cliVersion,
|
|
376
|
+
cwd: workspace.workspaceRoot,
|
|
377
|
+
impactConfirmed: options.yes === true,
|
|
378
|
+
env: options.env,
|
|
379
|
+
expectedCandidate: options.expectedReview?.candidate,
|
|
380
|
+
expectedActive: options.expectedReview?.active,
|
|
381
|
+
expectedConfigDigest: options.expectedReview?.finalConfigDigest,
|
|
382
|
+
expectedImpactDigest: options.expectedReview?.generationImpactDigest,
|
|
383
|
+
});
|
|
384
|
+
await options.runtime?.afterSync?.();
|
|
385
|
+
const finalStatus = await getCatalogDevSourceStatus({
|
|
386
|
+
cwd: options.cwd,
|
|
387
|
+
workspaceRoot: workspace.workspaceRoot,
|
|
388
|
+
cliVersion: options.cliVersion,
|
|
389
|
+
env: options.env,
|
|
390
|
+
});
|
|
391
|
+
if (!finalStatus.ok
|
|
392
|
+
|| !finalStatus.ready
|
|
393
|
+
|| finalStatus.active.snapshotDigest !== snapshotDigest)
|
|
394
|
+
throw new CatalogDevSourceError('activeNotReady', 'Catalog development source sync completed, but final Active status is not ready.');
|
|
395
|
+
const configured = (await readCatalogSourcesConfigSnapshot(options.env)).config.sources
|
|
396
|
+
.find((source) => source.id === selectedId);
|
|
397
|
+
return {
|
|
398
|
+
receiptSchemaVersion: 2, command: 'catalog:dev:activate', ok: true, state: 'completed',
|
|
399
|
+
workspaceIdentity: workspace.workspaceIdentity,
|
|
400
|
+
snapshot: { action: snapshotAction, digest: snapshotDigest },
|
|
401
|
+
source: { id: selectedId, action: sourceAction, primary: configured.primary },
|
|
402
|
+
active: { ready: true, snapshotDigest: finalStatus.active.snapshotDigest },
|
|
403
|
+
recovery: [], errors: [],
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
catch (error) {
|
|
407
|
+
return {
|
|
408
|
+
receiptSchemaVersion: 2, command: 'catalog:dev:activate', ok: false,
|
|
409
|
+
state: snapshotAction === 'built' || sourceCommitted ? 'partial' : 'failed',
|
|
410
|
+
workspaceIdentity: workspace.workspaceIdentity,
|
|
411
|
+
snapshot: { action: snapshotAction, digest: snapshotDigest },
|
|
412
|
+
source: { id: selectedId, action: sourceAction, primary: false },
|
|
413
|
+
active: { ready: false, snapshotDigest: null },
|
|
414
|
+
recovery: ['The source configuration and snapshot were kept. Fix the problem, then rerun catalog dev activate.'],
|
|
415
|
+
errors: [codedFailure(error, sourceCommitted ? 'sourceSyncFailed' : 'sourceConfigFailed')],
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
export async function getCatalogDevSourceStatus(options) {
|
|
420
|
+
const empty = {
|
|
421
|
+
receiptSchemaVersion: 4, command: 'catalog:dev:status', ok: false, ready: false,
|
|
422
|
+
workspaceIdentity: null,
|
|
423
|
+
snapshot: { state: 'absent', valid: false, digest: null },
|
|
424
|
+
source: { exists: false, id: null, pathMatches: null, primary: null },
|
|
425
|
+
active: {
|
|
426
|
+
exists: false, ready: false, digestMatchesSnapshot: false, snapshotDigest: null,
|
|
427
|
+
compatibility: null,
|
|
428
|
+
},
|
|
429
|
+
issues: [],
|
|
430
|
+
};
|
|
431
|
+
let workspace;
|
|
432
|
+
try {
|
|
433
|
+
workspace = await resolveWorkspace(options.cwd, options.workspaceRoot);
|
|
434
|
+
}
|
|
435
|
+
catch (error) {
|
|
436
|
+
empty.issues.push({ ...codedFailure(error, 'workspaceInvalid'), blocking: true });
|
|
437
|
+
return empty;
|
|
438
|
+
}
|
|
439
|
+
empty.workspaceIdentity = workspace.workspace.workspaceIdentity;
|
|
440
|
+
const staticStatus = await getCatalogStatus({
|
|
441
|
+
cwd: options.cwd, workspaceRoot: workspace.workspace.workspaceRoot, env: options.env,
|
|
442
|
+
}).catch(() => null);
|
|
443
|
+
if (!staticStatus) {
|
|
444
|
+
empty.issues.push({ code: 'catalogStatusInvalid', message: 'Catalog snapshot status is invalid.', blocking: true });
|
|
445
|
+
return empty;
|
|
446
|
+
}
|
|
447
|
+
empty.snapshot = {
|
|
448
|
+
state: staticStatus.snapshot.state,
|
|
449
|
+
valid: staticStatus.snapshot.valid,
|
|
450
|
+
digest: staticStatus.snapshot.snapshotDigest,
|
|
451
|
+
};
|
|
452
|
+
const workspaceIssues = staticStatus.issues.filter((issue) => issue.blocking);
|
|
453
|
+
empty.issues.push(...workspaceIssues.map((issue) => ({
|
|
454
|
+
code: issue.code,
|
|
455
|
+
message: 'Catalog Workspace status has a blocking issue.',
|
|
456
|
+
blocking: true,
|
|
457
|
+
})));
|
|
458
|
+
if (staticStatus.snapshot.state !== 'current') {
|
|
459
|
+
empty.issues.push({
|
|
460
|
+
code: `snapshot${staticStatus.snapshot.state[0].toUpperCase()}${staticStatus.snapshot.state.slice(1)}`,
|
|
461
|
+
message: `Catalog development snapshot is ${staticStatus.snapshot.state}.`, blocking: true,
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
const config = await readCatalogSourcesConfigSnapshot(options.env).catch(() => null);
|
|
465
|
+
if (!config) {
|
|
466
|
+
empty.issues.push({ code: 'sourceConfigInvalid', message: 'Catalog source configuration is invalid.', blocking: true });
|
|
467
|
+
return empty;
|
|
468
|
+
}
|
|
469
|
+
const owned = managedSources(config.config.sources, workspace.workspace.workspaceIdentity);
|
|
470
|
+
if (owned.length !== 1) {
|
|
471
|
+
empty.issues.push({
|
|
472
|
+
code: owned.length === 0 ? 'sourceInactive' : 'multipleManagedSources',
|
|
473
|
+
message: owned.length === 0
|
|
474
|
+
? 'Workspace has no configured development source.'
|
|
475
|
+
: 'Workspace owns multiple development sources.',
|
|
476
|
+
blocking: true,
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
const source = owned.length === 1 ? owned[0] : null;
|
|
480
|
+
if (source) {
|
|
481
|
+
const snapshotPath = path.join(workspace.workspace.workspaceRoot, DEFAULT_CATALOG_OUTPUT_PATH);
|
|
482
|
+
const pathMatches = source.path === snapshotPath;
|
|
483
|
+
empty.source = { exists: true, id: source.id, pathMatches, primary: source.primary };
|
|
484
|
+
if (!pathMatches) {
|
|
485
|
+
empty.issues.push({ code: 'sourcePathMismatch', message: 'Managed source path does not match this Workspace.', blocking: true });
|
|
486
|
+
}
|
|
487
|
+
const status = await readCatalogGenerationStatus({ sourceId: source.id, env: options.env }).catch(() => null);
|
|
488
|
+
const entry = status?.sources[0];
|
|
489
|
+
const snapshotDigest = entry?.active?.snapshotDigest ?? null;
|
|
490
|
+
const digestMatchesSnapshot = snapshotDigest !== null && snapshotDigest === empty.snapshot.digest;
|
|
491
|
+
empty.active = {
|
|
492
|
+
exists: entry?.active !== undefined,
|
|
493
|
+
ready: entry?.activeReady === true,
|
|
494
|
+
digestMatchesSnapshot,
|
|
495
|
+
snapshotDigest,
|
|
496
|
+
compatibility: entry?.compatibility ?? null,
|
|
497
|
+
};
|
|
498
|
+
if (!entry?.active) {
|
|
499
|
+
empty.issues.push({ code: 'activeAbsent', message: 'Development source has no Active snapshot.', blocking: true });
|
|
500
|
+
}
|
|
501
|
+
else if (entry.compatibility?.state === 'unsupported') {
|
|
502
|
+
empty.issues.push({
|
|
503
|
+
code: 'awCapabilityUnsupported',
|
|
504
|
+
message: 'Development source Active snapshot is incompatible with this AW.',
|
|
505
|
+
blocking: true,
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
else if (!entry.activeReady) {
|
|
509
|
+
empty.issues.push({ code: entry.errorCode ?? 'activeNotReady', message: 'Development source Active snapshot is not ready.', blocking: true });
|
|
510
|
+
}
|
|
511
|
+
if (entry?.active && !digestMatchesSnapshot) {
|
|
512
|
+
empty.issues.push({ code: 'activeSnapshotDigestMismatch', message: 'Active digest does not match the Workspace snapshot.', blocking: true });
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
empty.ok = true;
|
|
516
|
+
empty.ready = empty.snapshot.state === 'current'
|
|
517
|
+
&& staticStatus.ok
|
|
518
|
+
&& workspaceIssues.length === 0
|
|
519
|
+
&& source !== null
|
|
520
|
+
&& empty.source.pathMatches === true
|
|
521
|
+
&& empty.active.ready
|
|
522
|
+
&& empty.active.digestMatchesSnapshot;
|
|
523
|
+
return empty;
|
|
524
|
+
}
|
|
525
|
+
export async function deactivateCatalogDevSource(options) {
|
|
526
|
+
if (options.workspaceRoot !== undefined && options.sourceId !== undefined) {
|
|
527
|
+
throw new CatalogDevSourceError('invalidArguments', '--workspace-root and --source-id are mutually exclusive.');
|
|
528
|
+
}
|
|
529
|
+
const config = await readCatalogSourcesConfigSnapshot(options.env).catch(() => {
|
|
530
|
+
throw new CatalogDevSourceError('sourceConfigInvalid', 'Catalog source configuration is invalid.');
|
|
531
|
+
});
|
|
532
|
+
let source;
|
|
533
|
+
let workspaceIdentity;
|
|
534
|
+
let workspaceRoot;
|
|
535
|
+
if (options.sourceId !== undefined) {
|
|
536
|
+
assertExplicitSourceId(options.sourceId);
|
|
537
|
+
const configuredSource = config.config.sources.find((entry) => entry.id === options.sourceId);
|
|
538
|
+
if (configuredSource?.type !== 'path' || configuredSource.managedBy?.kind !== 'catalog-workspace') {
|
|
539
|
+
throw new CatalogDevSourceError('managedSourceNotFound', 'The source is not a Workspace-managed path source.');
|
|
540
|
+
}
|
|
541
|
+
source = configuredSource;
|
|
542
|
+
workspaceIdentity = configuredSource.managedBy.workspaceIdentity;
|
|
543
|
+
workspaceRoot = options.cwd;
|
|
544
|
+
}
|
|
545
|
+
else {
|
|
546
|
+
const resolved = await resolveWorkspace(options.cwd, options.workspaceRoot);
|
|
547
|
+
workspaceIdentity = resolved.workspace.workspaceIdentity;
|
|
548
|
+
workspaceRoot = resolved.workspace.workspaceRoot;
|
|
549
|
+
const owned = managedSources(config.config.sources, workspaceIdentity);
|
|
550
|
+
if (owned.length > 1) {
|
|
551
|
+
throw new CatalogDevSourceError('multipleManagedSources', 'Workspace owns multiple development sources.');
|
|
552
|
+
}
|
|
553
|
+
source = owned[0];
|
|
554
|
+
}
|
|
555
|
+
if (!source) {
|
|
556
|
+
return {
|
|
557
|
+
receiptSchemaVersion: 4, command: 'catalog:dev:deactivate', ok: true, state: 'completed',
|
|
558
|
+
workspaceIdentity, source: { id: null, action: 'absent', previousPrimary: false },
|
|
559
|
+
replacementPrimarySourceId: null, impact: null, recovery: [], errors: [],
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
let replacementPrimarySourceId = null;
|
|
563
|
+
if (source.primary) {
|
|
564
|
+
const others = config.config.sources.filter((entry) => entry.id !== source.id);
|
|
565
|
+
const requested = options.replacementPrimary === undefined
|
|
566
|
+
? others.find(isDefaultOfficialCatalogSource)
|
|
567
|
+
?? (others.length === 1 ? others[0] : undefined)
|
|
568
|
+
: others.find((entry) => entry.id === options.replacementPrimary);
|
|
569
|
+
if (!requested) {
|
|
570
|
+
return {
|
|
571
|
+
receiptSchemaVersion: 4, command: 'catalog:dev:deactivate', ok: false, state: 'failed',
|
|
572
|
+
workspaceIdentity, source: { id: source.id, action: 'retained', previousPrimary: true },
|
|
573
|
+
replacementPrimarySourceId: null,
|
|
574
|
+
impact: null,
|
|
575
|
+
recovery: ['Select an existing replacement primary source.'],
|
|
576
|
+
errors: [{ code: 'replacementPrimaryUnavailable', message: 'A replacement primary source is required.' }],
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
replacementPrimarySourceId = requested.id;
|
|
580
|
+
}
|
|
581
|
+
else if (options.replacementPrimary !== undefined) {
|
|
582
|
+
throw new CatalogDevSourceError('replacementPrimaryInvalid', '--replacement-primary requires a primary target source.');
|
|
583
|
+
}
|
|
584
|
+
const preview = await preflightCatalogSourceMutation({
|
|
585
|
+
request: {
|
|
586
|
+
action: 'remove',
|
|
587
|
+
sourceId: source.id,
|
|
588
|
+
...(replacementPrimarySourceId === null ? {} : { replacementPrimarySourceId }),
|
|
589
|
+
},
|
|
590
|
+
cwd: workspaceRoot,
|
|
591
|
+
env: options.env,
|
|
592
|
+
managedByWorkspaceIdentity: workspaceIdentity,
|
|
593
|
+
});
|
|
594
|
+
const impact = preview.references;
|
|
595
|
+
if (options.sourceId !== undefined && options.yes !== true) {
|
|
596
|
+
return {
|
|
597
|
+
receiptSchemaVersion: 4, command: 'catalog:dev:deactivate', ok: false, state: 'failed',
|
|
598
|
+
workspaceIdentity,
|
|
599
|
+
source: { id: source.id, action: 'retained', previousPrimary: source.primary },
|
|
600
|
+
replacementPrimarySourceId,
|
|
601
|
+
impact,
|
|
602
|
+
recovery: ['Rerun with --source-id and --yes.'],
|
|
603
|
+
errors: [{ code: 'confirmationRequired', message: 'Recovery by source ID requires --yes.' }],
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
if ((!impact.inventoryComplete || impact.references.length > 0) && options.yes !== true) {
|
|
607
|
+
return {
|
|
608
|
+
receiptSchemaVersion: 4, command: 'catalog:dev:deactivate', ok: false, state: 'failed',
|
|
609
|
+
workspaceIdentity,
|
|
610
|
+
source: { id: source.id, action: 'retained', previousPrimary: source.primary },
|
|
611
|
+
replacementPrimarySourceId,
|
|
612
|
+
impact,
|
|
613
|
+
recovery: ['Review the source impact, then rerun catalog dev deactivate with --yes.'],
|
|
614
|
+
errors: [{
|
|
615
|
+
code: 'catalogSourceImpactConfirmationRequired',
|
|
616
|
+
message: 'Affected or unknown Catalog source references require --yes.',
|
|
617
|
+
}],
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
try {
|
|
621
|
+
await removeCatalogSourceCommand({
|
|
622
|
+
sourceId: source.id, cwd: workspaceRoot, env: options.env,
|
|
623
|
+
runtime: options.runtime?.sourceRuntime,
|
|
624
|
+
managedByWorkspaceIdentity: workspaceIdentity,
|
|
625
|
+
expectedConfigDigest: preview.configDigest,
|
|
626
|
+
expectedImpactDigest: preview.impactDigest,
|
|
627
|
+
requireImpactConfirmation: true,
|
|
628
|
+
confirmImpact: options.yes === true,
|
|
629
|
+
...(replacementPrimarySourceId === null ? {} : { replacementPrimarySourceId }),
|
|
630
|
+
});
|
|
631
|
+
return {
|
|
632
|
+
receiptSchemaVersion: 4, command: 'catalog:dev:deactivate', ok: true, state: 'completed',
|
|
633
|
+
workspaceIdentity, source: { id: source.id, action: 'removed', previousPrimary: source.primary },
|
|
634
|
+
replacementPrimarySourceId, impact, recovery: [], errors: [],
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
catch (error) {
|
|
638
|
+
const after = await readCatalogSourcesConfigSnapshot(options.env).catch(() => null);
|
|
639
|
+
const stillExists = after?.config.sources.some((entry) => entry.id === source.id) ?? true;
|
|
640
|
+
const configChanged = after !== null && after.digest !== preview.configDigest;
|
|
641
|
+
const stale = error instanceof CatalogSourcesConfigConflictError || configChanged;
|
|
642
|
+
return {
|
|
643
|
+
receiptSchemaVersion: 4, command: 'catalog:dev:deactivate', ok: false,
|
|
644
|
+
state: stale ? 'failed' : !stillExists ? 'partial' : 'failed', workspaceIdentity,
|
|
645
|
+
source: { id: source.id, action: stillExists ? 'retained' : 'removed', previousPrimary: source.primary },
|
|
646
|
+
replacementPrimarySourceId,
|
|
647
|
+
impact: failureImpact(error, impact),
|
|
648
|
+
recovery: ['Fix the source configuration, then rerun catalog dev deactivate.'],
|
|
649
|
+
errors: [stale
|
|
650
|
+
? { code: 'operationReviewStale', message: 'Catalog source evidence changed. Review it again.' }
|
|
651
|
+
: codedFailure(error, 'sourceConfigFailed')],
|
|
652
|
+
};
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
//# sourceMappingURL=catalog-dev-source.js.map
|