@lesliechan721/aw 0.1.0-beta.5 → 0.1.0-beta.51
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/assets/aw-runtime-config.d.mts +13 -0
- package/dist/authoring/assets/aw-runtime-config.mjs +199 -0
- package/dist/authoring/assets/aw-runtime-config.mjs.map +1 -0
- 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-root.mjs +4 -4
- package/dist/authoring/scripts/lib/plugin-root.mjs.map +1 -1
- package/dist/authoring/scripts/lib/plugin-version-check.d.mts +1 -0
- package/dist/authoring/scripts/lib/plugin-version-check.mjs +229 -8
- package/dist/authoring/scripts/lib/plugin-version-check.mjs.map +1 -1
- package/dist/authoring/scripts/lib/skill-scaffold.d.mts +77 -92
- package/dist/authoring/scripts/lib/skill-scaffold.mjs +99 -124
- 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 +3 -2
- package/dist/authoring/scripts/remove-plugin.mjs.map +1 -1
- package/dist/authoring/scripts/validate-plugin.mjs +346 -1131
- 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 -0
- package/dist/scripts/bundle-plugins.js +20 -5
- package/dist/scripts/bundle-plugins.js.map +1 -1
- package/dist/scripts/plugin-staging.d.ts +7 -9
- package/dist/scripts/plugin-staging.js +18 -29
- 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 +47 -76
- package/dist/scripts/test-plugin-scripts.js.map +1 -1
- package/dist/scripts/test-workers.d.mts +24 -0
- package/dist/scripts/test-workers.mjs +59 -0
- package/dist/scripts/test-workers.mjs.map +1 -0
- 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 +17 -1
- package/dist/src/authoring/workspace-commands.js +21 -4
- 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 +263 -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 +71 -30
- package/dist/src/commands/catalog-publication-inspection.js +475 -63
- package/dist/src/commands/catalog-publication-inspection.js.map +1 -1
- 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 +73 -15
- package/dist/src/commands/catalog-publish.js +701 -212
- 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 +18 -22
- package/dist/src/commands/catalog-status.js +81 -115
- package/dist/src/commands/catalog-status.js.map +1 -1
- 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 +146 -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.js +23 -3
- package/dist/src/commands/plugin-capabilities.js.map +1 -1
- package/dist/src/commands/rebuild-command.d.ts +77 -31
- package/dist/src/commands/rebuild-command.js +4862 -729
- package/dist/src/commands/rebuild-command.js.map +1 -1
- package/dist/src/commands/rebuild-integration.d.ts +131 -21
- package/dist/src/commands/rebuild-integration.js +2866 -1339
- 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 +60 -0
- package/dist/src/commands/review-inspection.js +422 -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 +39 -0
- package/dist/src/commands/skill-eval.js +400 -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 +2787 -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 +8 -5
- package/dist/src/commands/wizard.js +6 -4
- 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 +127 -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 +68 -0
- package/dist/src/eval/manifest-v1.js +353 -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 +236 -109
- package/dist/src/generators/local-plugin.js.map +1 -1
- package/dist/src/index.d.ts +10 -4
- package/dist/src/index.js +1752 -608
- 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 +179 -41
- 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 +74 -20
- 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 +234 -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 +183 -0
- package/dist/src/review/source-binding.js +708 -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 +32 -0
- package/dist/src/tui/catalog-sources/session.js +300 -0
- package/dist/src/tui/catalog-sources/session.js.map +1 -0
- package/dist/src/tui/catalog-sources/types.d.ts +54 -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/clipboard.d.ts +13 -0
- package/dist/src/tui/clipboard.js +95 -0
- package/dist/src/tui/clipboard.js.map +1 -0
- package/dist/src/tui/components.d.ts +110 -3
- package/dist/src/tui/components.js +183 -36
- package/dist/src/tui/components.js.map +1 -1
- package/dist/src/tui/config-array-draft.d.ts +29 -0
- package/dist/src/tui/config-array-draft.js +48 -0
- package/dist/src/tui/config-array-draft.js.map +1 -0
- package/dist/src/tui/config-leaf-editor.d.ts +16 -0
- package/dist/src/tui/config-leaf-editor.js +206 -0
- package/dist/src/tui/config-leaf-editor.js.map +1 -0
- package/dist/src/tui/config-value-presentation.d.ts +20 -0
- package/dist/src/tui/config-value-presentation.js +104 -0
- package/dist/src/tui/config-value-presentation.js.map +1 -0
- package/dist/src/tui/console-app-v4.d.ts +14 -4
- package/dist/src/tui/console-app-v4.js +8941 -1872
- package/dist/src/tui/console-app-v4.js.map +1 -1
- package/dist/src/tui/content-item-card.d.ts +13 -0
- package/dist/src/tui/content-item-card.js +51 -0
- package/dist/src/tui/content-item-card.js.map +1 -0
- package/dist/src/tui/controller-runtime.d.ts +10 -2
- package/dist/src/tui/controller-runtime.js +3211 -388
- package/dist/src/tui/controller-runtime.js.map +1 -1
- package/dist/src/tui/controller.d.ts +615 -45
- package/dist/src/tui/controller.js +3558 -768
- package/dist/src/tui/controller.js.map +1 -1
- package/dist/src/tui/dependency-graph-view.d.ts +39 -0
- package/dist/src/tui/dependency-graph-view.js +121 -0
- package/dist/src/tui/dependency-graph-view.js.map +1 -0
- package/dist/src/tui/dependency-graph.d.ts +81 -0
- package/dist/src/tui/dependency-graph.js +452 -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 +3 -3
- package/dist/src/tui/diagnostics.js +14 -2
- package/dist/src/tui/diagnostics.js.map +1 -1
- package/dist/src/tui/entity-cards.d.ts +55 -0
- package/dist/src/tui/entity-cards.js +220 -0
- package/dist/src/tui/entity-cards.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 +6 -1
- package/dist/src/tui/index.js +5 -1
- package/dist/src/tui/index.js.map +1 -1
- package/dist/src/tui/input-display.d.ts +9 -0
- package/dist/src/tui/input-display.js +58 -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 +223 -31
- package/dist/src/tui/model.js +1510 -397
- package/dist/src/tui/model.js.map +1 -1
- package/dist/src/tui/operation-diagnostic-screens.d.ts +8 -0
- package/dist/src/tui/operation-diagnostic-screens.js +71 -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 +136 -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 +1295 -0
- package/dist/src/tui/operation-review-planner.js.map +1 -0
- package/dist/src/tui/plugin-content.d.ts +31 -0
- package/dist/src/tui/plugin-content.js +680 -0
- package/dist/src/tui/plugin-content.js.map +1 -0
- package/dist/src/tui/plugin-detail.d.ts +52 -0
- package/dist/src/tui/plugin-detail.js +165 -0
- package/dist/src/tui/plugin-detail.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/project-inventory.d.ts +68 -0
- package/dist/src/tui/project-inventory.js +203 -0
- package/dist/src/tui/project-inventory.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/query-header.d.ts +30 -0
- package/dist/src/tui/query-header.js +40 -0
- package/dist/src/tui/query-header.js.map +1 -0
- package/dist/src/tui/reader.d.ts +37 -0
- package/dist/src/tui/reader.js +47 -0
- package/dist/src/tui/reader.js.map +1 -0
- package/dist/src/tui/router.d.ts +197 -10
- package/dist/src/tui/router.js +338 -50
- package/dist/src/tui/router.js.map +1 -1
- package/dist/src/tui/screen-registry.d.ts +701 -0
- package/dist/src/tui/screen-registry.js +230 -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-detail-card.d.ts +29 -0
- package/dist/src/tui/source-detail-card.js +45 -0
- package/dist/src/tui/source-detail-card.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 +12 -0
- package/dist/src/tui/theme.js +12 -0
- package/dist/src/tui/theme.js.map +1 -1
- package/dist/src/tui/viewport.d.ts +1 -0
- package/dist/src/tui/viewport.js +23 -0
- package/dist/src/tui/viewport.js.map +1 -1
- package/dist/src/tui/views.js +31 -3
- package/dist/src/tui/views.js.map +1 -1
- package/dist/src/tui/wizard.js +37 -13
- package/dist/src/tui/wizard.js.map +1 -1
- package/dist/src/types.d.ts +244 -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 +17 -7
- package/dist/src/utils/artifact-renderer.js +214 -216
- 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 +78 -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 +22 -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 +57 -20
- 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 +3 -0
- package/dist/src/utils/catalog-runtime-projection.js +5 -40
- 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 +747 -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 +35 -5
- package/dist/src/utils/dynamic-skill-tree.js.map +1 -1
- package/dist/src/utils/git-catalog-provider.d.ts +16 -0
- package/dist/src/utils/git-catalog-provider.js +177 -145
- package/dist/src/utils/git-catalog-provider.js.map +1 -1
- package/dist/src/utils/local-marketplace.d.ts +18 -1
- package/dist/src/utils/local-marketplace.js +354 -84
- package/dist/src/utils/local-marketplace.js.map +1 -1
- package/dist/src/utils/manifest.d.ts +1 -3
- package/dist/src/utils/manifest.js +1 -3
- 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 +400 -58
- 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 +1000 -296
- package/dist/src/utils/plugin-config-write.js.map +1 -1
- package/dist/src/utils/plugin-config.d.ts +153 -93
- package/dist/src/utils/plugin-config.js +1116 -968
- 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 +65 -125
- package/dist/src/utils/plugin-scripts.js +484 -524
- 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/runtime-config.d.ts +20 -0
- package/dist/src/utils/runtime-config.js +75 -0
- package/dist/src/utils/runtime-config.js.map +1 -0
- 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/state-paths.js +7 -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 +7 -0
- package/dist/src/utils/windows-claude-shim.js +10 -0
- package/dist/src/utils/windows-claude-shim.js.map +1 -0
- package/dist/src/utils/windows-npm-shim.d.ts +14 -0
- package/dist/src/utils/windows-npm-shim.js +140 -0
- package/dist/src/utils/windows-npm-shim.js.map +1 -0
- package/dist/vitest.config.js +92 -10
- package/dist/vitest.config.js.map +1 -1
- package/package.json +27 -18
- package/dist/authoring/scripts/check-plugin-versions.d.mts +0 -2
- 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/review-publication.d.ts +0 -99
- package/dist/src/commands/review-publication.js +0 -904
- package/dist/src/commands/review-publication.js.map +0 -1
- package/dist/src/commands/status-v4.d.ts +0 -123
- package/dist/src/commands/status-v4.js +0 -905
- 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 -62
- package/dist/src/utils/catalog-source-cache.js +0 -296
- 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-release.d.ts +0 -2
- package/dist/src/utils/plugin-release.js +0 -2
- package/dist/src/utils/plugin-release.js.map +0 -1
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
import { realpath } from 'node:fs/promises';
|
|
1
2
|
import crypto from 'node:crypto';
|
|
2
3
|
import { execFile } from 'node:child_process';
|
|
3
4
|
import os from 'node:os';
|
|
4
5
|
import path from 'node:path';
|
|
5
6
|
import { promisify } from 'node:util';
|
|
6
7
|
import fs from 'fs-extra';
|
|
7
|
-
import { preparePublishedCatalogWorkspace, readCatalogWorkspace, validatePublishedCatalogSnapshot, } from '@lesliechan721/aw-plugin-core';
|
|
8
|
+
import { CATALOG_MANIFEST_FILENAME, GENERATED_OUTPUT_MARKER_FILENAME, preparePublishedCatalogWorkspace, readCatalogWorkspaceMarker, readCatalogWorkspace, validatePublishedCatalogSnapshot, validatePublishedCatalogSnapshotMetadata, } from '@lesliechan721/aw-plugin-core';
|
|
9
|
+
import { readGitBlobsBatch } from '../../authoring/scripts/lib/plugin-version-check.mjs';
|
|
8
10
|
import { bundleLocalPlugin, createCatalogRuntimeImportResolver } from '../../scripts/plugin-staging.js';
|
|
11
|
+
import { redactString } from '../output/redact.js';
|
|
12
|
+
import { sanitizeCatalogSourceErrorMessage } from '../utils/catalog-public-error.js';
|
|
9
13
|
import { CLI_RESERVED_IMPORTS } from '../utils/manifest.js';
|
|
10
14
|
import { resolveCliPackageRoot } from '../utils/paths.js';
|
|
11
15
|
const execFileAsync = promisify(execFile);
|
|
@@ -37,7 +41,8 @@ function directRemoteGitEnvironment(source) {
|
|
|
37
41
|
return {
|
|
38
42
|
...sanitizedGitEnvironment(source),
|
|
39
43
|
GIT_CONFIG_NOSYSTEM: '1',
|
|
40
|
-
|
|
44
|
+
// Git for Windows maps /dev/null itself; Node's device path is not a Git path.
|
|
45
|
+
GIT_CONFIG_GLOBAL: '/dev/null',
|
|
41
46
|
GIT_ATTR_NOSYSTEM: '1',
|
|
42
47
|
GIT_TERMINAL_PROMPT: '0',
|
|
43
48
|
};
|
|
@@ -61,21 +66,83 @@ export function safeRemoteIdentity(value) {
|
|
|
61
66
|
.replace(/^([^/@\s:]+):([^/@\s]+)@/u, '')
|
|
62
67
|
.replace(/^[^@\s]+@(?=[^:/\s]+[/:])/u, '');
|
|
63
68
|
}
|
|
64
|
-
function
|
|
65
|
-
|
|
69
|
+
function sanitizeCatalogPublicationMessage(message, env, sensitiveRoots, sensitiveValues = []) {
|
|
70
|
+
const normalized = redactString(message.replace(/[\p{Cc}\p{Cf}]+/gu, ' '));
|
|
71
|
+
const withoutSensitiveValues = [...sensitiveValues]
|
|
72
|
+
.filter((value) => value.length >= 4)
|
|
73
|
+
.sort((left, right) => right.length - left.length)
|
|
74
|
+
.reduce((output, value) => output.replaceAll(value, '[remote]'), normalized);
|
|
75
|
+
const withoutRemotes = withoutSensitiveValues
|
|
76
|
+
.replace(/[a-z][a-z\d+.-]*:\/\/[^\s"'<>]+/giu, '[remote]')
|
|
77
|
+
.replace(/[^\s"'<>@]+@[^\s"'<>:/]+[:/][^\s"'<>]+/gu, '[remote]');
|
|
78
|
+
const withoutKnownRoots = sanitizeCatalogSourceErrorMessage(withoutRemotes, env, sensitiveRoots);
|
|
79
|
+
return redactString(withoutKnownRoots).replace(/(?<![A-Za-z0-9._-])(?:[A-Za-z]:[\\/]|\/)(?:[^\s"'<>:]+[\\/])*[^\s"'<>:]*/gu, '[private-path]');
|
|
80
|
+
}
|
|
81
|
+
function remoteSensitiveValues(value) {
|
|
82
|
+
const values = new Set([value]);
|
|
83
|
+
if (/^[a-z][a-z\d+.-]*:\/\//iu.test(value)) {
|
|
84
|
+
try {
|
|
85
|
+
const url = new URL(value);
|
|
86
|
+
for (const part of [url.username, url.password, url.hostname, url.pathname, url.pathname.slice(1)]) {
|
|
87
|
+
if (part.length >= 4)
|
|
88
|
+
values.add(part);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
// The remote value is validated separately.
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
const match = /^(?:([^@:/]+)@)?([^:/]+)[:/](.+)$/u.exec(value);
|
|
97
|
+
for (const part of match?.slice(1) ?? []) {
|
|
98
|
+
if (part && part.length >= 4)
|
|
99
|
+
values.add(part);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return [...values];
|
|
103
|
+
}
|
|
104
|
+
export function catalogPublicationFailure(options) {
|
|
105
|
+
const original = options.error instanceof Error
|
|
106
|
+
? options.error.message
|
|
107
|
+
: String(options.error);
|
|
108
|
+
const message = sanitizeCatalogPublicationMessage(original, options.env, options.sensitiveRoots);
|
|
109
|
+
return {
|
|
110
|
+
ok: false,
|
|
111
|
+
code: options.error instanceof CatalogPublicationInspectionError
|
|
112
|
+
? options.error.code
|
|
113
|
+
: 'catalogPublicationFailed',
|
|
114
|
+
message,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function assertSafeRemoteUrl(value, options = {}) {
|
|
118
|
+
if (value.trim() === '' || value !== value.trim() || /[\s\p{Cc}]/u.test(value) || value.startsWith('-')) {
|
|
66
119
|
throw new CatalogPublicationInspectionError('remoteInvalid', 'Catalog remote URL is unsafe.');
|
|
67
120
|
}
|
|
68
|
-
if (/^[a-z][a-z\d+.-]*:\/\/[^/\s?#]*@/iu.test(value)) {
|
|
121
|
+
if (!options.allowCredentials && /^[a-z][a-z\d+.-]*:\/\/[^/\s?#]*@/iu.test(value)) {
|
|
69
122
|
throw new CatalogPublicationInspectionError('remoteInvalid', 'Catalog remote URL must not contain embedded credentials.');
|
|
70
123
|
}
|
|
71
124
|
return value;
|
|
72
125
|
}
|
|
73
|
-
|
|
74
|
-
|
|
126
|
+
function assertSafeRemoteName(value) {
|
|
127
|
+
if (value === '' || value !== value.trim() || value.startsWith('-') || /[\s\p{Cc}]/u.test(value)) {
|
|
128
|
+
throw new CatalogPublicationInspectionError('remoteInvalid', 'Catalog remote name is unsafe.');
|
|
129
|
+
}
|
|
130
|
+
return value;
|
|
131
|
+
}
|
|
132
|
+
function assertSafeBranchValue(value) {
|
|
133
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9._/-]*$/u.test(value)) {
|
|
134
|
+
throw new CatalogPublicationInspectionError('branchInvalid', 'Invalid Catalog publication branch name.');
|
|
135
|
+
}
|
|
136
|
+
return value;
|
|
75
137
|
}
|
|
76
|
-
export async function publicationGit(cwd, args, env, code, label) {
|
|
138
|
+
export async function publicationGit(cwd, args, env, code, label, sensitiveValues = []) {
|
|
77
139
|
try {
|
|
78
|
-
|
|
140
|
+
// Keep maintenance in the foreground before callers remove temporary repositories.
|
|
141
|
+
// Pending repositories and verification trees can exceed Windows MAX_PATH.
|
|
142
|
+
const result = await execFileAsync('git', [
|
|
143
|
+
'-c', 'core.hooksPath=/dev/null', '-c', 'core.longpaths=true',
|
|
144
|
+
'-c', 'gc.autoDetach=false', '-c', 'maintenance.autoDetach=false', ...args,
|
|
145
|
+
], {
|
|
79
146
|
cwd,
|
|
80
147
|
env,
|
|
81
148
|
encoding: 'utf8',
|
|
@@ -84,12 +151,33 @@ export async function publicationGit(cwd, args, env, code, label) {
|
|
|
84
151
|
return result.stdout.trim();
|
|
85
152
|
}
|
|
86
153
|
catch (error) {
|
|
87
|
-
|
|
154
|
+
const failure = error;
|
|
155
|
+
const status = typeof failure.code === 'number' && Number.isSafeInteger(failure.code)
|
|
156
|
+
? `exited with code ${failure.code}`
|
|
157
|
+
: typeof failure.code === 'string' && /^[A-Z0-9_]+$/u.test(failure.code)
|
|
158
|
+
? `failed with code ${failure.code}`
|
|
159
|
+
: 'failed';
|
|
160
|
+
const rawDetails = typeof failure.stderr === 'string' && failure.stderr.trim() !== ''
|
|
161
|
+
? failure.stderr
|
|
162
|
+
: typeof failure.message === 'string'
|
|
163
|
+
? failure.message
|
|
164
|
+
: '';
|
|
165
|
+
const details = sanitizeCatalogPublicationMessage(rawDetails, env, [cwd], sensitiveValues)
|
|
166
|
+
.replace(/\s+/gu, ' ')
|
|
167
|
+
.trim();
|
|
168
|
+
throw new CatalogPublicationInspectionError(code, `${label} Git ${status}${details ? `: ${details.slice(0, 2_000)}` : '.'}`, { cause: error });
|
|
88
169
|
}
|
|
89
170
|
}
|
|
90
171
|
export async function publicationGitExit(cwd, args, env) {
|
|
91
172
|
try {
|
|
92
|
-
await execFileAsync('git', [
|
|
173
|
+
await execFileAsync('git', [
|
|
174
|
+
'-c', 'core.hooksPath=/dev/null', '-c', 'core.longpaths=true',
|
|
175
|
+
'-c', 'gc.autoDetach=false', '-c', 'maintenance.autoDetach=false', ...args,
|
|
176
|
+
], {
|
|
177
|
+
cwd,
|
|
178
|
+
env,
|
|
179
|
+
encoding: 'utf8',
|
|
180
|
+
});
|
|
93
181
|
return true;
|
|
94
182
|
}
|
|
95
183
|
catch {
|
|
@@ -106,12 +194,17 @@ export async function materializeSourceHead(options) {
|
|
|
106
194
|
const archivePath = path.join(options.temporaryRoot, 'source-head.tar');
|
|
107
195
|
await fs.ensureDir(options.outputRoot);
|
|
108
196
|
await publicationGit(options.repoRoot, [
|
|
197
|
+
'-c', 'core.autocrlf=false', '-c', 'core.eol=lf',
|
|
109
198
|
'archive', '--format=tar', `--output=${archivePath}`, options.sourceHead,
|
|
110
199
|
], options.env, 'sourceArchiveFailed', 'Could not archive the committed source HEAD.');
|
|
111
200
|
const tarEnv = { ...options.env };
|
|
112
201
|
delete tarEnv.TAR_OPTIONS;
|
|
113
202
|
try {
|
|
114
|
-
await execFileAsync('tar', [
|
|
203
|
+
await execFileAsync('tar', [
|
|
204
|
+
'-xf', path.relative(options.temporaryRoot, archivePath),
|
|
205
|
+
'-C', path.relative(options.temporaryRoot, options.outputRoot),
|
|
206
|
+
], {
|
|
207
|
+
cwd: options.temporaryRoot,
|
|
115
208
|
env: tarEnv,
|
|
116
209
|
encoding: 'utf8',
|
|
117
210
|
maxBuffer: 16 * 1024 * 1024,
|
|
@@ -173,12 +266,108 @@ function inspectionError(code, error) {
|
|
|
173
266
|
cause: error,
|
|
174
267
|
});
|
|
175
268
|
}
|
|
269
|
+
async function validatePublishedCatalogSnapshotForWorkspace(snapshotRoot, workspaceIdentity) {
|
|
270
|
+
try {
|
|
271
|
+
const validation = await validatePublishedCatalogSnapshot(snapshotRoot);
|
|
272
|
+
const markerPath = path.join(snapshotRoot, GENERATED_OUTPUT_MARKER_FILENAME);
|
|
273
|
+
const markerStats = await fs.lstat(markerPath).catch((error) => {
|
|
274
|
+
if (error.code === 'ENOENT')
|
|
275
|
+
return null;
|
|
276
|
+
throw error;
|
|
277
|
+
});
|
|
278
|
+
if (!markerStats?.isFile() || markerStats.isSymbolicLink()) {
|
|
279
|
+
throw new Error('Published Catalog snapshot marker must be a regular local file.');
|
|
280
|
+
}
|
|
281
|
+
const marker = await fs.readJson(markerPath);
|
|
282
|
+
if (marker.workspaceIdentity !== workspaceIdentity) {
|
|
283
|
+
throw new Error('Published Catalog snapshot belongs to a different Workspace identity.');
|
|
284
|
+
}
|
|
285
|
+
return validation;
|
|
286
|
+
}
|
|
287
|
+
catch (error) {
|
|
288
|
+
throw inspectionError('remoteSnapshotInvalid', error);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
async function materializePublishedCatalogMetadata(options) {
|
|
292
|
+
await fs.remove(options.outputRoot);
|
|
293
|
+
await fs.ensureDir(options.outputRoot);
|
|
294
|
+
const metadataPaths = [GENERATED_OUTPUT_MARKER_FILENAME, CATALOG_MANIFEST_FILENAME];
|
|
295
|
+
const records = (await publicationGit(options.repositoryRoot, [
|
|
296
|
+
'ls-tree', options.commit, '--', ...metadataPaths,
|
|
297
|
+
], options.env, 'remoteBranchInvalid', 'Could not inspect published Catalog history.')).split('\n');
|
|
298
|
+
const metadata = metadataPaths.map((relative) => {
|
|
299
|
+
const record = records.find((value) => value.endsWith(`\t${relative}`)) ?? '';
|
|
300
|
+
const match = /^(100644|100755) blob ([0-9a-f]+)\t(.+)$/u.exec(record);
|
|
301
|
+
if (records.length !== metadataPaths.length || !match || match[3] !== relative) {
|
|
302
|
+
throw new CatalogPublicationInspectionError('remoteSnapshotInvalid', 'Published Catalog history metadata must contain regular files.');
|
|
303
|
+
}
|
|
304
|
+
return { relative, objectId: match[2] };
|
|
305
|
+
});
|
|
306
|
+
let contents;
|
|
307
|
+
try {
|
|
308
|
+
contents = await readGitBlobsBatch(options.repositoryRoot, metadata.map((entry) => entry.objectId), {
|
|
309
|
+
env: options.env,
|
|
310
|
+
argsPrefix: ['-c', 'core.hooksPath=/dev/null', '-c', 'core.longpaths=true'],
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
catch (error) {
|
|
314
|
+
const details = sanitizeCatalogPublicationMessage(error instanceof Error ? error.message : String(error), options.env, [options.repositoryRoot]).replace(/\s+/gu, ' ').trim();
|
|
315
|
+
throw new CatalogPublicationInspectionError('remoteBranchInvalid', `Could not read published Catalog history.${details ? ` ${details.slice(0, 2_000)}` : ''}`, { cause: error });
|
|
316
|
+
}
|
|
317
|
+
for (const { relative, objectId } of metadata) {
|
|
318
|
+
await fs.writeFile(path.join(options.outputRoot, relative), contents.get(objectId));
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
async function findPreviousPluginEntriesInFirstParentHistory(options) {
|
|
322
|
+
const missing = new Set(options.pluginNames);
|
|
323
|
+
const found = new Map();
|
|
324
|
+
const historyRoot = path.join(options.temporaryRoot, 'history-metadata');
|
|
325
|
+
let commit = options.tipCommit;
|
|
326
|
+
while (missing.size > 0) {
|
|
327
|
+
const parents = (await publicationGit(options.repositoryRoot, [
|
|
328
|
+
'show', '-s', '--format=%P', commit,
|
|
329
|
+
], options.env, 'remoteBranchInvalid', 'Could not inspect published Catalog history.'))
|
|
330
|
+
.split(/\s+/u)
|
|
331
|
+
.filter(Boolean);
|
|
332
|
+
const firstParent = parents[0];
|
|
333
|
+
if (!firstParent)
|
|
334
|
+
break;
|
|
335
|
+
commit = firstParent;
|
|
336
|
+
await materializePublishedCatalogMetadata({
|
|
337
|
+
repositoryRoot: options.repositoryRoot,
|
|
338
|
+
commit,
|
|
339
|
+
outputRoot: historyRoot,
|
|
340
|
+
env: options.env,
|
|
341
|
+
});
|
|
342
|
+
let metadata;
|
|
343
|
+
try {
|
|
344
|
+
metadata = await validatePublishedCatalogSnapshotMetadata(historyRoot);
|
|
345
|
+
if (metadata.workspaceIdentity !== options.workspaceIdentity) {
|
|
346
|
+
throw new Error('Published Catalog snapshot belongs to a different Workspace identity.');
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
catch (error) {
|
|
350
|
+
throw inspectionError('remoteSnapshotInvalid', error);
|
|
351
|
+
}
|
|
352
|
+
for (const entry of metadata.manifest.entries) {
|
|
353
|
+
if (!missing.delete(entry.name))
|
|
354
|
+
continue;
|
|
355
|
+
found.set(entry.name, entry);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
return options.pluginNames.flatMap((name) => {
|
|
359
|
+
const entry = found.get(name);
|
|
360
|
+
return entry ? [entry] : [];
|
|
361
|
+
});
|
|
362
|
+
}
|
|
176
363
|
export async function prepareCatalogPublicationInspection(options) {
|
|
177
364
|
if (options.remote !== undefined && options.remoteUrl !== undefined) {
|
|
178
365
|
throw new CatalogPublicationInspectionError('remoteInvalid', 'Catalog publication accepts a configured remote name or a direct remote URL, not both.');
|
|
179
366
|
}
|
|
180
|
-
const remote = options.
|
|
181
|
-
|
|
367
|
+
const remote = options.remoteUrl === undefined
|
|
368
|
+
? assertSafeRemoteName(options.remote ?? 'origin')
|
|
369
|
+
: 'direct';
|
|
370
|
+
const branch = assertSafeBranchValue(options.branch ?? 'catalog');
|
|
182
371
|
const env = options.remoteUrl === undefined
|
|
183
372
|
? sanitizedGitEnvironment(options.env)
|
|
184
373
|
: directRemoteGitEnvironment(options.env);
|
|
@@ -188,8 +377,23 @@ export async function prepareCatalogPublicationInspection(options) {
|
|
|
188
377
|
let safeFetchUrl = '';
|
|
189
378
|
let safePushUrl = '';
|
|
190
379
|
try {
|
|
191
|
-
const catalogWorkspaceRoot = await
|
|
192
|
-
const repoRoot = await publicationGit(catalogWorkspaceRoot, ['rev-parse', '--show-toplevel'], env, 'gitWorkspaceInvalid', 'Catalog Workspace must be inside a real Git worktree.');
|
|
380
|
+
const catalogWorkspaceRoot = await realpath(path.resolve(options.workspaceRoot));
|
|
381
|
+
const repoRoot = await realpath(await publicationGit(catalogWorkspaceRoot, ['rev-parse', '--show-toplevel'], env, 'gitWorkspaceInvalid', 'Catalog Workspace must be inside a real Git worktree.'));
|
|
382
|
+
await publicationGit(repoRoot, ['check-ref-format', '--branch', branch], env, 'branchInvalid', 'Invalid Catalog publication branch name.');
|
|
383
|
+
if (options.remoteUrl !== undefined) {
|
|
384
|
+
fetchUrl = assertSafeRemoteUrl(options.remoteUrl);
|
|
385
|
+
pushUrl = fetchUrl;
|
|
386
|
+
}
|
|
387
|
+
else {
|
|
388
|
+
const configuredRemotes = (await publicationGit(repoRoot, ['remote'], env, 'remoteMissing', 'Could not inspect configured Git remotes.')).split('\n').filter(Boolean);
|
|
389
|
+
if (!configuredRemotes.includes(remote)) {
|
|
390
|
+
throw new CatalogPublicationInspectionError('remoteInvalid', `Git remote ${JSON.stringify(remote)} is not configured.`);
|
|
391
|
+
}
|
|
392
|
+
fetchUrl = assertSafeRemoteUrl(await publicationGit(repoRoot, ['remote', 'get-url', remote], env, 'remoteMissing', `Git remote ${JSON.stringify(remote)} is not configured.`), { allowCredentials: true });
|
|
393
|
+
pushUrl = assertSafeRemoteUrl(await publicationGit(repoRoot, ['remote', 'get-url', '--push', remote], env, 'remoteMissing', `Git remote ${JSON.stringify(remote)} has no push URL.`), { allowCredentials: true });
|
|
394
|
+
}
|
|
395
|
+
safeFetchUrl = safeRemoteIdentity(fetchUrl);
|
|
396
|
+
safePushUrl = safeRemoteIdentity(pushUrl);
|
|
193
397
|
const sourceHead = await publicationGit(repoRoot, ['rev-parse', '--verify', 'HEAD'], env, 'sourceHeadMissing', 'Catalog Workspace Git HEAD must be committed and not unborn.');
|
|
194
398
|
const status = await publicationGit(repoRoot, [
|
|
195
399
|
'status', '--porcelain=v1', '--untracked-files=all', '--ignore-submodules=none',
|
|
@@ -207,7 +411,6 @@ export async function prepareCatalogPublicationInspection(options) {
|
|
|
207
411
|
throw new CatalogPublicationInspectionError('workspaceOutsideRepository', 'Catalog Workspace must stay inside its Git worktree root.');
|
|
208
412
|
}
|
|
209
413
|
const archivedCatalogWorkspaceRoot = path.join(sourceRoot, catalogWorkspaceRelative);
|
|
210
|
-
await publicationGit(repoRoot, ['check-ref-format', '--branch', branch], env, 'branchInvalid', 'Invalid Catalog publication branch name.');
|
|
211
414
|
let catalogWorkspace;
|
|
212
415
|
try {
|
|
213
416
|
catalogWorkspace = await readCatalogWorkspace(archivedCatalogWorkspaceRoot, { reservedImports: CLI_RESERVED_IMPORTS });
|
|
@@ -215,44 +418,30 @@ export async function prepareCatalogPublicationInspection(options) {
|
|
|
215
418
|
catch (error) {
|
|
216
419
|
throw inspectionError('workspaceInvalid', error);
|
|
217
420
|
}
|
|
421
|
+
const ownerUrl = catalogWorkspace.metadata.owner.url;
|
|
422
|
+
if (URL.canParse(ownerUrl) && new URL(ownerUrl).hostname === 'example.invalid') {
|
|
423
|
+
throw new CatalogPublicationInspectionError('catalogMetadataIncomplete', 'Catalog owner URL still uses the example.invalid placeholder. Set plugins/marketplace-source.json owner.url before publication.');
|
|
424
|
+
}
|
|
218
425
|
await validateCatalogPublicationPlugins(catalogWorkspace, env);
|
|
219
426
|
const catalogVersion = catalogWorkspace.metadata.catalog.version;
|
|
220
427
|
const tag = `catalog-v${catalogVersion}`;
|
|
221
428
|
await publicationGit(repoRoot, ['check-ref-format', `refs/tags/${tag}`], env, 'tagInvalid', 'Invalid Catalog publication tag.');
|
|
222
|
-
const attemptPath = catalogAttemptPath(catalogWorkspaceRoot, catalogVersion);
|
|
223
|
-
const attemptAvailable = !(await fs.pathExists(attemptPath));
|
|
224
|
-
if (!attemptAvailable && options.failOnUnavailable) {
|
|
225
|
-
throw new CatalogPublicationInspectionError('attemptUnavailable', `Catalog ${catalogVersion} already has an attempted publication record. Run aw catalog version <higher> before publishing again.`);
|
|
226
|
-
}
|
|
227
|
-
if (options.remoteUrl !== undefined) {
|
|
228
|
-
fetchUrl = assertSafeRemoteUrl(options.remoteUrl);
|
|
229
|
-
pushUrl = fetchUrl;
|
|
230
|
-
}
|
|
231
|
-
else {
|
|
232
|
-
fetchUrl = await publicationGit(repoRoot, ['remote', 'get-url', remote], env, 'remoteMissing', `Git remote ${JSON.stringify(remote)} is not configured.`);
|
|
233
|
-
pushUrl = await publicationGit(repoRoot, ['remote', 'get-url', '--push', remote], env, 'remoteMissing', `Git remote ${JSON.stringify(remote)} has no push URL.`);
|
|
234
|
-
}
|
|
235
|
-
safeFetchUrl = safeRemoteIdentity(fetchUrl);
|
|
236
|
-
safePushUrl = safeRemoteIdentity(pushUrl);
|
|
237
429
|
const remoteIdentityDigest = digest(JSON.stringify({ fetchUrl, pushUrl }));
|
|
238
430
|
const branchRef = `refs/heads/${branch}`;
|
|
239
431
|
const tagRef = `refs/tags/${tag}`;
|
|
240
432
|
const repositoryRoot = path.join(temporaryRoot, 'repository');
|
|
241
433
|
await fs.ensureDir(repositoryRoot);
|
|
242
434
|
await publicationGit(repositoryRoot, ['init', '--quiet'], env, 'temporaryRepositoryFailed', 'Could not create the isolated publication repository.');
|
|
243
|
-
await publicationGit(repositoryRoot, ['config', 'core.hooksPath',
|
|
435
|
+
await publicationGit(repositoryRoot, ['config', 'core.hooksPath', '/dev/null'], env, 'temporaryRepositoryFailed', 'Could not disable publication hooks.');
|
|
244
436
|
await publicationGit(repositoryRoot, ['config', 'core.symlinks', 'true'], env, 'temporaryRepositoryFailed', 'Could not configure the isolated publication repository.');
|
|
245
437
|
await publicationGit(repositoryRoot, ['remote', 'add', 'publish', pushUrl], env, 'temporaryRepositoryFailed', 'Could not configure the publication remote.');
|
|
246
438
|
const initialRefs = parseRemoteRefs(await publicationGit(repositoryRoot, [
|
|
247
439
|
'ls-remote', 'publish', branchRef, tagRef, `${tagRef}^{}`,
|
|
248
440
|
], env, 'remoteReadFailed', 'Could not inspect the Catalog publication remote.'));
|
|
249
441
|
const tagAvailable = !initialRefs.has(tagRef) && !initialRefs.has(`${tagRef}^{}`);
|
|
250
|
-
if (!tagAvailable && options.failOnUnavailable) {
|
|
251
|
-
throw new CatalogPublicationInspectionError('tagUnavailable', `Remote Catalog tag ${tag} already exists. Increase the Catalog version.`);
|
|
252
|
-
}
|
|
253
442
|
const parent = initialRefs.get(branchRef) ?? null;
|
|
254
443
|
let previousSnapshotRoot;
|
|
255
|
-
let
|
|
444
|
+
let historicalPluginEntries = [];
|
|
256
445
|
if (parent) {
|
|
257
446
|
await publicationGit(repositoryRoot, [
|
|
258
447
|
'fetch', '--quiet', '--no-tags', 'publish', `${branchRef}:refs/aw/catalog-parent`,
|
|
@@ -260,14 +449,23 @@ export async function prepareCatalogPublicationInspection(options) {
|
|
|
260
449
|
previousSnapshotRoot = path.join(temporaryRoot, 'previous');
|
|
261
450
|
await fs.ensureDir(previousSnapshotRoot);
|
|
262
451
|
await publicationGit(repositoryRoot, [
|
|
452
|
+
'-c', 'core.autocrlf=false', '-c', 'core.eol=lf',
|
|
263
453
|
'--work-tree', previousSnapshotRoot, 'checkout', '--quiet', 'refs/aw/catalog-parent', '--', '.',
|
|
264
454
|
], env, 'remoteBranchInvalid', 'Could not read the published Catalog snapshot.');
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
455
|
+
const previous = await validatePublishedCatalogSnapshotForWorkspace(previousSnapshotRoot, catalogWorkspace.workspaceIdentity);
|
|
456
|
+
const previousPluginNames = new Set(previous.manifest.entries.map((entry) => entry.name));
|
|
457
|
+
const missingPluginNames = catalogWorkspace.plugins
|
|
458
|
+
.map((plugin) => plugin.manifest.name)
|
|
459
|
+
.filter((name) => !previousPluginNames.has(name));
|
|
460
|
+
if (missingPluginNames.length > 0) {
|
|
461
|
+
historicalPluginEntries = await findPreviousPluginEntriesInFirstParentHistory({
|
|
462
|
+
repositoryRoot,
|
|
463
|
+
tipCommit: parent,
|
|
464
|
+
pluginNames: missingPluginNames,
|
|
465
|
+
workspaceIdentity: catalogWorkspace.workspaceIdentity,
|
|
466
|
+
temporaryRoot,
|
|
467
|
+
env,
|
|
468
|
+
});
|
|
271
469
|
}
|
|
272
470
|
}
|
|
273
471
|
let prepared;
|
|
@@ -276,6 +474,9 @@ export async function prepareCatalogPublicationInspection(options) {
|
|
|
276
474
|
workspaceRoot: archivedCatalogWorkspaceRoot,
|
|
277
475
|
sourceHead,
|
|
278
476
|
previousSnapshotRoot,
|
|
477
|
+
historicalPluginEntries,
|
|
478
|
+
officialPluginHistory: options.officialPluginHistory,
|
|
479
|
+
sourcePluginVersionsAtBaseline: options.sourcePluginVersionsAtBaseline,
|
|
279
480
|
adapter: publicationBuildAdapter,
|
|
280
481
|
reservedImports: CLI_RESERVED_IMPORTS,
|
|
281
482
|
});
|
|
@@ -298,16 +499,10 @@ export async function prepareCatalogPublicationInspection(options) {
|
|
|
298
499
|
|| finalRefs.has(`${tagRef}^{}`) !== initialRefs.has(`${tagRef}^{}`)) {
|
|
299
500
|
throw new CatalogPublicationInspectionError('remoteDrift', 'Catalog remote changed during preparation. Increase the Catalog version before publishing again.');
|
|
300
501
|
}
|
|
301
|
-
|
|
302
|
-
validatePublishedCatalogSnapshot(prepared.outputRoot),
|
|
303
|
-
fs.readFile(path.join(prepared.outputRoot, 'plugin-release-ledger.json')),
|
|
304
|
-
]);
|
|
305
|
-
const ledgerDigest = digest(ledgerBytes);
|
|
502
|
+
await validatePublishedCatalogSnapshot(prepared.outputRoot);
|
|
306
503
|
const descriptor = {
|
|
307
504
|
schemaVersion: 1,
|
|
308
505
|
workspaceIdentity: catalogWorkspace.workspaceIdentity,
|
|
309
|
-
catalogVersion: prepared.catalogVersion,
|
|
310
|
-
channel: prepared.channel,
|
|
311
506
|
sourceHead,
|
|
312
507
|
remote: {
|
|
313
508
|
name: options.remoteUrl === undefined ? remote : null,
|
|
@@ -317,11 +512,6 @@ export async function prepareCatalogPublicationInspection(options) {
|
|
|
317
512
|
parent,
|
|
318
513
|
tag,
|
|
319
514
|
snapshotDigest: prepared.snapshotDigest,
|
|
320
|
-
contentDigest: prepared.contentDigest,
|
|
321
|
-
planId: prepared.planId,
|
|
322
|
-
ledgerDigest,
|
|
323
|
-
minCliVersion: preparedValidation.manifest.compatibility.aw.minVersion,
|
|
324
|
-
pluginNames: [...prepared.pluginNames],
|
|
325
515
|
};
|
|
326
516
|
return {
|
|
327
517
|
temporaryRoot,
|
|
@@ -341,9 +531,6 @@ export async function prepareCatalogPublicationInspection(options) {
|
|
|
341
531
|
safePushUrl,
|
|
342
532
|
remoteIdentityDigest,
|
|
343
533
|
parent,
|
|
344
|
-
publishedVersion,
|
|
345
|
-
attemptPath,
|
|
346
|
-
attemptAvailable,
|
|
347
534
|
tagAvailable,
|
|
348
535
|
catalogWorkspace,
|
|
349
536
|
prepared,
|
|
@@ -367,6 +554,162 @@ export async function prepareCatalogPublicationInspection(options) {
|
|
|
367
554
|
throw new CatalogPublicationInspectionError('catalogPreflightFailed', safeMessage, { cause: error });
|
|
368
555
|
}
|
|
369
556
|
}
|
|
557
|
+
export async function inspectCatalogPublicationLiveContext(options) {
|
|
558
|
+
if (options.remote !== undefined && options.remoteUrl !== undefined) {
|
|
559
|
+
throw new CatalogPublicationInspectionError('remoteInvalid', 'Catalog publication accepts a configured remote name or a direct remote URL, not both.');
|
|
560
|
+
}
|
|
561
|
+
const remote = options.remoteUrl === undefined
|
|
562
|
+
? assertSafeRemoteName(options.remote ?? 'origin')
|
|
563
|
+
: 'direct';
|
|
564
|
+
const remoteName = options.remoteUrl === undefined ? remote : null;
|
|
565
|
+
const branch = assertSafeBranchValue(options.branch ?? 'catalog');
|
|
566
|
+
const env = options.remoteUrl === undefined
|
|
567
|
+
? sanitizedGitEnvironment(options.env)
|
|
568
|
+
: directRemoteGitEnvironment(options.env);
|
|
569
|
+
let fetchUrl = '';
|
|
570
|
+
let pushUrl = '';
|
|
571
|
+
let safeFetchUrl = '';
|
|
572
|
+
let safePushUrl = '';
|
|
573
|
+
try {
|
|
574
|
+
const catalogWorkspaceRoot = await realpath(path.resolve(options.workspaceRoot));
|
|
575
|
+
const repoRoot = await realpath(await publicationGit(catalogWorkspaceRoot, ['rev-parse', '--show-toplevel'], env, 'gitWorkspaceInvalid', 'Catalog Workspace must be inside a real Git worktree.'));
|
|
576
|
+
await publicationGit(repoRoot, ['check-ref-format', '--branch', branch], env, 'branchInvalid', 'Invalid Catalog publication branch name.');
|
|
577
|
+
const sourceHead = await publicationGit(repoRoot, ['rev-parse', '--verify', 'HEAD'], env, 'sourceHeadMissing', 'Catalog Workspace Git HEAD must be committed and not unborn.');
|
|
578
|
+
const status = await publicationGit(repoRoot, [
|
|
579
|
+
'status', '--porcelain=v1', '--untracked-files=all', '--ignore-submodules=none',
|
|
580
|
+
], env, 'sourceStatusFailed', 'Could not inspect the source worktree.');
|
|
581
|
+
if (status !== '') {
|
|
582
|
+
throw new CatalogPublicationInspectionError('sourceDirty', 'Catalog publish requires the complete source Git worktree to be clean.');
|
|
583
|
+
}
|
|
584
|
+
const catalogWorkspaceRelative = path.relative(repoRoot, catalogWorkspaceRoot);
|
|
585
|
+
if (catalogWorkspaceRelative === '..'
|
|
586
|
+
|| catalogWorkspaceRelative.startsWith(`..${path.sep}`)
|
|
587
|
+
|| path.isAbsolute(catalogWorkspaceRelative)) {
|
|
588
|
+
throw new CatalogPublicationInspectionError('workspaceOutsideRepository', 'Catalog Workspace must stay inside its Git worktree root.');
|
|
589
|
+
}
|
|
590
|
+
const catalogWorkspace = await readCatalogWorkspace(catalogWorkspaceRoot, {
|
|
591
|
+
reservedImports: CLI_RESERVED_IMPORTS,
|
|
592
|
+
});
|
|
593
|
+
const ownerUrl = catalogWorkspace.metadata.owner.url;
|
|
594
|
+
if (URL.canParse(ownerUrl) && new URL(ownerUrl).hostname === 'example.invalid') {
|
|
595
|
+
throw new CatalogPublicationInspectionError('catalogMetadataIncomplete', 'Catalog owner URL still uses the example.invalid placeholder. Set plugins/marketplace-source.json owner.url before publication.');
|
|
596
|
+
}
|
|
597
|
+
if (options.remoteUrl !== undefined) {
|
|
598
|
+
fetchUrl = assertSafeRemoteUrl(options.remoteUrl);
|
|
599
|
+
pushUrl = fetchUrl;
|
|
600
|
+
}
|
|
601
|
+
else {
|
|
602
|
+
const configuredRemotes = (await publicationGit(repoRoot, ['remote'], env, 'remoteMissing', 'Could not inspect configured Git remotes.')).split('\n').filter(Boolean);
|
|
603
|
+
if (!configuredRemotes.includes(remote)) {
|
|
604
|
+
throw new CatalogPublicationInspectionError('remoteInvalid', `Git remote ${JSON.stringify(remote)} is not configured.`);
|
|
605
|
+
}
|
|
606
|
+
fetchUrl = assertSafeRemoteUrl(await publicationGit(repoRoot, ['remote', 'get-url', remote], env, 'remoteMissing', `Git remote ${JSON.stringify(remote)} is not configured.`), { allowCredentials: true });
|
|
607
|
+
pushUrl = assertSafeRemoteUrl(await publicationGit(repoRoot, ['remote', 'get-url', '--push', remote], env, 'remoteMissing', `Git remote ${JSON.stringify(remote)} has no push URL.`), { allowCredentials: true });
|
|
608
|
+
}
|
|
609
|
+
safeFetchUrl = safeRemoteIdentity(fetchUrl);
|
|
610
|
+
safePushUrl = safeRemoteIdentity(pushUrl);
|
|
611
|
+
const catalogVersion = catalogWorkspace.metadata.catalog.version;
|
|
612
|
+
const tag = `catalog-v${catalogVersion}`;
|
|
613
|
+
await publicationGit(repoRoot, ['check-ref-format', `refs/tags/${tag}`], env, 'tagInvalid', 'Invalid Catalog publication tag.');
|
|
614
|
+
return {
|
|
615
|
+
catalogWorkspaceRoot,
|
|
616
|
+
repoRoot,
|
|
617
|
+
workspaceIdentity: catalogWorkspace.workspaceIdentity,
|
|
618
|
+
catalogVersion,
|
|
619
|
+
sourceHead,
|
|
620
|
+
remote,
|
|
621
|
+
remoteName,
|
|
622
|
+
branch,
|
|
623
|
+
branchRef: `refs/heads/${branch}`,
|
|
624
|
+
tag,
|
|
625
|
+
tagRef: `refs/tags/${tag}`,
|
|
626
|
+
fetchUrl,
|
|
627
|
+
pushUrl,
|
|
628
|
+
safeFetchUrl,
|
|
629
|
+
safePushUrl,
|
|
630
|
+
remoteIdentityDigest: digest(JSON.stringify({ fetchUrl, pushUrl })),
|
|
631
|
+
env,
|
|
632
|
+
};
|
|
633
|
+
}
|
|
634
|
+
catch (error) {
|
|
635
|
+
let safeMessage = error instanceof Error ? error.message : String(error);
|
|
636
|
+
if (fetchUrl)
|
|
637
|
+
safeMessage = safeMessage.replaceAll(fetchUrl, safeFetchUrl);
|
|
638
|
+
if (pushUrl)
|
|
639
|
+
safeMessage = safeMessage.replaceAll(pushUrl, safePushUrl);
|
|
640
|
+
if (error instanceof CatalogPublicationInspectionError) {
|
|
641
|
+
throw new CatalogPublicationInspectionError(error.code, safeMessage, { cause: error.cause });
|
|
642
|
+
}
|
|
643
|
+
throw new CatalogPublicationInspectionError('catalogInspectionFailed', safeMessage, { cause: error });
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
export async function inspectCatalogPublicationApplyContext(options) {
|
|
647
|
+
if (options.remote !== undefined && options.remoteUrl !== undefined) {
|
|
648
|
+
throw new CatalogPublicationInspectionError('remoteInvalid', 'Catalog publication accepts a configured remote name or a direct remote URL, not both.');
|
|
649
|
+
}
|
|
650
|
+
const remote = options.remoteUrl === undefined
|
|
651
|
+
? assertSafeRemoteName(options.remote ?? 'origin')
|
|
652
|
+
: 'direct';
|
|
653
|
+
const branch = assertSafeBranchValue(options.branch ?? 'catalog');
|
|
654
|
+
const env = options.remoteUrl === undefined
|
|
655
|
+
? sanitizedGitEnvironment(options.env)
|
|
656
|
+
: directRemoteGitEnvironment(options.env);
|
|
657
|
+
let fetchUrl = '';
|
|
658
|
+
let pushUrl = '';
|
|
659
|
+
let safeFetchUrl = '';
|
|
660
|
+
let safePushUrl = '';
|
|
661
|
+
try {
|
|
662
|
+
const catalogWorkspaceRoot = await realpath(path.resolve(options.workspaceRoot));
|
|
663
|
+
const marker = await readCatalogWorkspaceMarker(catalogWorkspaceRoot);
|
|
664
|
+
const repoRoot = await realpath(await publicationGit(catalogWorkspaceRoot, ['rev-parse', '--show-toplevel'], env, 'gitWorkspaceInvalid', 'Catalog Workspace must be inside a real Git worktree.'));
|
|
665
|
+
const catalogWorkspaceRelative = path.relative(repoRoot, catalogWorkspaceRoot);
|
|
666
|
+
if (catalogWorkspaceRelative === '..'
|
|
667
|
+
|| catalogWorkspaceRelative.startsWith(`..${path.sep}`)
|
|
668
|
+
|| path.isAbsolute(catalogWorkspaceRelative)) {
|
|
669
|
+
throw new CatalogPublicationInspectionError('workspaceOutsideRepository', 'Catalog Workspace must stay inside its Git worktree root.');
|
|
670
|
+
}
|
|
671
|
+
await publicationGit(repoRoot, ['check-ref-format', '--branch', branch], env, 'branchInvalid', 'Invalid Catalog publication branch name.');
|
|
672
|
+
if (options.remoteUrl !== undefined) {
|
|
673
|
+
fetchUrl = assertSafeRemoteUrl(options.remoteUrl);
|
|
674
|
+
pushUrl = fetchUrl;
|
|
675
|
+
}
|
|
676
|
+
else {
|
|
677
|
+
const configuredRemotes = (await publicationGit(repoRoot, ['remote'], env, 'remoteMissing', 'Could not inspect configured Git remotes.')).split('\n').filter(Boolean);
|
|
678
|
+
if (!configuredRemotes.includes(remote)) {
|
|
679
|
+
throw new CatalogPublicationInspectionError('remoteInvalid', `Git remote ${JSON.stringify(remote)} is not configured.`);
|
|
680
|
+
}
|
|
681
|
+
fetchUrl = assertSafeRemoteUrl(await publicationGit(repoRoot, ['remote', 'get-url', remote], env, 'remoteMissing', `Git remote ${JSON.stringify(remote)} is not configured.`), { allowCredentials: true });
|
|
682
|
+
pushUrl = assertSafeRemoteUrl(await publicationGit(repoRoot, ['remote', 'get-url', '--push', remote], env, 'remoteMissing', `Git remote ${JSON.stringify(remote)} has no push URL.`), { allowCredentials: true });
|
|
683
|
+
}
|
|
684
|
+
safeFetchUrl = safeRemoteIdentity(fetchUrl);
|
|
685
|
+
safePushUrl = safeRemoteIdentity(pushUrl);
|
|
686
|
+
return {
|
|
687
|
+
catalogWorkspaceRoot,
|
|
688
|
+
repoRoot,
|
|
689
|
+
workspaceIdentity: marker.workspaceIdentity,
|
|
690
|
+
remote,
|
|
691
|
+
branch,
|
|
692
|
+
branchRef: `refs/heads/${branch}`,
|
|
693
|
+
fetchUrl,
|
|
694
|
+
pushUrl,
|
|
695
|
+
safeFetchUrl,
|
|
696
|
+
safePushUrl,
|
|
697
|
+
remoteIdentityDigest: digest(JSON.stringify({ fetchUrl, pushUrl })),
|
|
698
|
+
env,
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
catch (error) {
|
|
702
|
+
let safeMessage = error instanceof Error ? error.message : String(error);
|
|
703
|
+
if (fetchUrl)
|
|
704
|
+
safeMessage = safeMessage.replaceAll(fetchUrl, safeFetchUrl);
|
|
705
|
+
if (pushUrl)
|
|
706
|
+
safeMessage = safeMessage.replaceAll(pushUrl, safePushUrl);
|
|
707
|
+
if (error instanceof CatalogPublicationInspectionError) {
|
|
708
|
+
throw new CatalogPublicationInspectionError(error.code, safeMessage, { cause: error.cause });
|
|
709
|
+
}
|
|
710
|
+
throw new CatalogPublicationInspectionError('catalogInspectionFailed', safeMessage, { cause: error });
|
|
711
|
+
}
|
|
712
|
+
}
|
|
370
713
|
async function resolveRemoteUrlForInspection(options) {
|
|
371
714
|
if (options.remote !== undefined && options.remoteUrl !== undefined) {
|
|
372
715
|
throw new CatalogPublicationInspectionError('remoteInvalid', 'Catalog publication accepts a configured remote name or a direct remote URL, not both.');
|
|
@@ -377,21 +720,22 @@ async function resolveRemoteUrlForInspection(options) {
|
|
|
377
720
|
if (options.remoteUrl !== undefined) {
|
|
378
721
|
return { remoteUrl: assertSafeRemoteUrl(options.remoteUrl), env };
|
|
379
722
|
}
|
|
380
|
-
const remote = options.remote ?? 'origin';
|
|
723
|
+
const remote = assertSafeRemoteName(options.remote ?? 'origin');
|
|
381
724
|
return {
|
|
382
|
-
remoteUrl: await publicationGit(options.workspaceRoot, ['remote', 'get-url', '--push', remote], env, 'remoteMissing', `Git remote ${JSON.stringify(remote)} has no push URL.`),
|
|
725
|
+
remoteUrl: assertSafeRemoteUrl(await publicationGit(options.workspaceRoot, ['remote', 'get-url', '--push', remote], env, 'remoteMissing', `Git remote ${JSON.stringify(remote)} has no push URL.`), { allowCredentials: true }),
|
|
383
726
|
env,
|
|
384
727
|
};
|
|
385
728
|
}
|
|
386
729
|
export async function listCatalogPublicationVersions(options) {
|
|
387
730
|
const resolved = await resolveRemoteUrlForInspection(options);
|
|
731
|
+
const sensitiveValues = remoteSensitiveValues(resolved.remoteUrl);
|
|
388
732
|
const temporaryRoot = await fs.mkdtemp(path.join(os.tmpdir(), 'aw-catalog-remote-read-'));
|
|
389
733
|
try {
|
|
390
734
|
await publicationGit(temporaryRoot, ['init', '--quiet'], resolved.env, 'temporaryRepositoryFailed', 'Could not create the Catalog inspection repository.');
|
|
391
735
|
await publicationGit(temporaryRoot, ['remote', 'add', 'publish', resolved.remoteUrl], resolved.env, 'temporaryRepositoryFailed', 'Could not configure the Catalog inspection remote.');
|
|
392
736
|
const refs = parseRemoteRefs(await publicationGit(temporaryRoot, [
|
|
393
737
|
'ls-remote', '--refs', 'publish', 'refs/tags/catalog-v*',
|
|
394
|
-
], resolved.env, 'remoteReadFailed', 'Could not inspect Catalog publication versions.'));
|
|
738
|
+
], resolved.env, 'remoteReadFailed', 'Could not inspect Catalog publication versions.', sensitiveValues));
|
|
395
739
|
return [...refs.keys()]
|
|
396
740
|
.filter((ref) => ref.startsWith('refs/tags/catalog-v'))
|
|
397
741
|
.map((ref) => ref.slice('refs/tags/catalog-v'.length));
|
|
@@ -400,7 +744,75 @@ export async function listCatalogPublicationVersions(options) {
|
|
|
400
744
|
await fs.remove(temporaryRoot);
|
|
401
745
|
}
|
|
402
746
|
}
|
|
747
|
+
export async function readCatalogPublicationPluginHistory(options) {
|
|
748
|
+
const marker = await readCatalogWorkspaceMarker(options.workspaceRoot);
|
|
749
|
+
const resolved = await resolveRemoteUrlForInspection(options);
|
|
750
|
+
const branchRefs = [...new Set(options.branches.map((branch) => `refs/heads/${assertSafeBranchValue(branch)}`))];
|
|
751
|
+
if (branchRefs.length === 0)
|
|
752
|
+
throw new Error('Catalog Plugin history requires at least one branch.');
|
|
753
|
+
const sensitiveValues = remoteSensitiveValues(resolved.remoteUrl);
|
|
754
|
+
const temporaryRoot = await fs.mkdtemp(path.join(os.tmpdir(), 'aw-catalog-plugin-history-'));
|
|
755
|
+
try {
|
|
756
|
+
await publicationGit(temporaryRoot, ['init', '--quiet'], resolved.env, 'temporaryRepositoryFailed', 'Could not create the Catalog history repository.');
|
|
757
|
+
await publicationGit(temporaryRoot, ['remote', 'add', 'publish', resolved.remoteUrl], resolved.env, 'temporaryRepositoryFailed', 'Could not configure the Catalog history remote.');
|
|
758
|
+
const refs = parseRemoteRefs(await publicationGit(temporaryRoot, [
|
|
759
|
+
'ls-remote', 'publish', ...branchRefs,
|
|
760
|
+
], resolved.env, 'remoteReadFailed', 'Could not inspect published Catalog history.', sensitiveValues));
|
|
761
|
+
const visited = new Set();
|
|
762
|
+
const entries = [];
|
|
763
|
+
const metadataRoot = path.join(temporaryRoot, 'history-metadata');
|
|
764
|
+
for (const [index, branchRef] of branchRefs.entries()) {
|
|
765
|
+
const tip = refs.get(branchRef);
|
|
766
|
+
if (!tip)
|
|
767
|
+
continue;
|
|
768
|
+
const localRef = `refs/aw/catalog-history-${index}`;
|
|
769
|
+
await publicationGit(temporaryRoot, [
|
|
770
|
+
'fetch', '--quiet', '--no-tags', 'publish', `${branchRef}:${localRef}`,
|
|
771
|
+
], resolved.env, 'remoteBranchInvalid', 'Could not fetch published Catalog history.', sensitiveValues);
|
|
772
|
+
const fetchedTip = await publicationGit(temporaryRoot, ['rev-parse', localRef], resolved.env, 'remoteBranchInvalid', 'Could not inspect published Catalog history.');
|
|
773
|
+
if (fetchedTip !== tip) {
|
|
774
|
+
throw new CatalogPublicationInspectionError('remoteDrift', 'Catalog history changed during inspection. Retry preparation.');
|
|
775
|
+
}
|
|
776
|
+
const commits = (await publicationGit(temporaryRoot, [
|
|
777
|
+
'rev-list', '--first-parent', tip,
|
|
778
|
+
], resolved.env, 'remoteBranchInvalid', 'Could not inspect published Catalog history.')).split('\n').filter(Boolean);
|
|
779
|
+
for (const commit of commits) {
|
|
780
|
+
if (visited.has(commit))
|
|
781
|
+
continue;
|
|
782
|
+
visited.add(commit);
|
|
783
|
+
await materializePublishedCatalogMetadata({
|
|
784
|
+
repositoryRoot: temporaryRoot,
|
|
785
|
+
commit,
|
|
786
|
+
outputRoot: metadataRoot,
|
|
787
|
+
env: resolved.env,
|
|
788
|
+
});
|
|
789
|
+
try {
|
|
790
|
+
const metadata = await validatePublishedCatalogSnapshotMetadata(metadataRoot);
|
|
791
|
+
if (metadata.workspaceIdentity !== marker.workspaceIdentity) {
|
|
792
|
+
throw new Error('Published Catalog snapshot belongs to a different Workspace identity.');
|
|
793
|
+
}
|
|
794
|
+
entries.push(...metadata.manifest.entries);
|
|
795
|
+
}
|
|
796
|
+
catch (error) {
|
|
797
|
+
throw inspectionError('remoteSnapshotInvalid', error);
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
const finalRefs = parseRemoteRefs(await publicationGit(temporaryRoot, [
|
|
802
|
+
'ls-remote', 'publish', ...branchRefs,
|
|
803
|
+
], resolved.env, 'remoteReadFailed', 'Could not recheck published Catalog history.', sensitiveValues));
|
|
804
|
+
if (branchRefs.some((ref) => refs.get(ref) !== finalRefs.get(ref))) {
|
|
805
|
+
throw new CatalogPublicationInspectionError('remoteDrift', 'Catalog history changed during inspection. Retry preparation.');
|
|
806
|
+
}
|
|
807
|
+
return entries;
|
|
808
|
+
}
|
|
809
|
+
finally {
|
|
810
|
+
await fs.remove(temporaryRoot);
|
|
811
|
+
}
|
|
812
|
+
}
|
|
403
813
|
export async function readCatalogPublicationBranchState(options) {
|
|
814
|
+
assertSafeBranchValue(options.branch);
|
|
815
|
+
const marker = await readCatalogWorkspaceMarker(options.workspaceRoot);
|
|
404
816
|
const resolved = await resolveRemoteUrlForInspection(options);
|
|
405
817
|
const temporaryRoot = await fs.mkdtemp(path.join(os.tmpdir(), 'aw-catalog-remote-read-'));
|
|
406
818
|
try {
|
|
@@ -423,14 +835,14 @@ export async function readCatalogPublicationBranchState(options) {
|
|
|
423
835
|
const snapshotRoot = path.join(temporaryRoot, 'snapshot');
|
|
424
836
|
await fs.ensureDir(snapshotRoot);
|
|
425
837
|
await publicationGit(temporaryRoot, [
|
|
838
|
+
'-c', 'core.autocrlf=false', '-c', 'core.eol=lf',
|
|
426
839
|
'--work-tree', snapshotRoot, 'checkout', '--quiet', 'refs/aw/catalog-parent', '--', '.',
|
|
427
840
|
], resolved.env, 'remoteBranchInvalid', 'Could not read the published Catalog snapshot.');
|
|
428
|
-
const validation = await
|
|
841
|
+
const validation = await validatePublishedCatalogSnapshotForWorkspace(snapshotRoot, marker.workspaceIdentity);
|
|
429
842
|
return {
|
|
430
843
|
commit,
|
|
431
844
|
version: validation.manifest.catalogVersion,
|
|
432
845
|
manifest: validation.manifest,
|
|
433
|
-
ledger: validation.ledger,
|
|
434
846
|
snapshotDigest: validation.snapshotDigest,
|
|
435
847
|
};
|
|
436
848
|
}
|