@lesliechan721/aw 0.1.0-beta.7 → 0.1.0-beta.9
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/scripts/add-skill.mjs +4 -4
- package/dist/authoring/scripts/add-skill.mjs.map +1 -1
- package/dist/authoring/scripts/init-plugin.mjs +8 -37
- package/dist/authoring/scripts/init-plugin.mjs.map +1 -1
- package/dist/authoring/scripts/lib/plugin-version-check.mjs +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 +2 -1
- package/dist/authoring/scripts/remove-plugin.mjs.map +1 -1
- package/dist/authoring/scripts/validate-plugin.mjs +64 -758
- package/dist/authoring/scripts/validate-plugin.mjs.map +1 -1
- package/dist/scripts/aw-skill-eval-materializer.d.ts +24 -0
- package/dist/scripts/{plugin-eval-materializer.js → aw-skill-eval-materializer.js} +34 -145
- 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 +2 -1
- package/dist/scripts/bundle-plugins.js.map +1 -1
- package/dist/scripts/plugin-staging.d.ts +6 -8
- package/dist/scripts/plugin-staging.js +15 -28
- package/dist/scripts/plugin-staging.js.map +1 -1
- package/dist/scripts/test-plugin-scripts.js +2 -33
- 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 +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 +254 -0
- package/dist/src/commands/aw-capabilities.js.map +1 -0
- package/dist/src/commands/catalog-dev-source.d.ts +118 -0
- package/dist/src/commands/catalog-dev-source.js +417 -0
- package/dist/src/commands/catalog-dev-source.js.map +1 -0
- package/dist/src/commands/catalog-generation.d.ts +13 -0
- package/dist/src/commands/catalog-generation.js +13 -0
- package/dist/src/commands/catalog-generation.js.map +1 -0
- package/dist/src/commands/catalog-publication-inspection.d.ts +29 -28
- package/dist/src/commands/catalog-publication-inspection.js +138 -50
- package/dist/src/commands/catalog-publication-inspection.js.map +1 -1
- package/dist/src/commands/catalog-publication-journal.d.ts +49 -0
- package/dist/src/commands/catalog-publication-journal.js +147 -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 +58 -15
- package/dist/src/commands/catalog-publish.js +590 -210
- package/dist/src/commands/catalog-publish.js.map +1 -1
- package/dist/src/commands/catalog-source.d.ts +12 -15
- package/dist/src/commands/catalog-source.js +61 -86
- 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-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/dependency-operation-plan.d.ts +88 -9
- package/dist/src/commands/dependency-operation-plan.js +331 -6
- 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 +43 -0
- package/dist/src/commands/offline-cleanup-evidence.js +116 -0
- package/dist/src/commands/offline-cleanup-evidence.js.map +1 -0
- package/dist/src/commands/options.d.ts +7 -1
- package/dist/src/commands/options.js +65 -6
- package/dist/src/commands/options.js.map +1 -1
- package/dist/src/commands/plugin-capabilities.js +5 -1
- package/dist/src/commands/plugin-capabilities.js.map +1 -1
- package/dist/src/commands/rebuild-command.d.ts +27 -13
- package/dist/src/commands/rebuild-command.js +1472 -471
- package/dist/src/commands/rebuild-command.js.map +1 -1
- package/dist/src/commands/rebuild-integration.d.ts +63 -8
- package/dist/src/commands/rebuild-integration.js +761 -439
- package/dist/src/commands/rebuild-integration.js.map +1 -1
- package/dist/src/commands/rebuild-operations.d.ts +2 -8
- package/dist/src/commands/rebuild-operations.js +48 -132
- package/dist/src/commands/rebuild-operations.js.map +1 -1
- package/dist/src/commands/runtime.js +21 -34
- package/dist/src/commands/runtime.js.map +1 -1
- package/dist/src/commands/skill-eval.d.ts +33 -0
- package/dist/src/commands/skill-eval.js +363 -0
- package/dist/src/commands/skill-eval.js.map +1 -0
- package/dist/src/commands/status-v6.d.ts +202 -0
- package/dist/src/commands/status-v6.js +1938 -0
- package/dist/src/commands/status-v6.js.map +1 -0
- package/dist/src/commands/sync-command.d.ts +21 -0
- package/dist/src/commands/sync-command.js +206 -0
- package/dist/src/commands/sync-command.js.map +1 -0
- package/dist/src/commands/wizard.d.ts +2 -2
- package/dist/src/commands/wizard.js +2 -2
- package/dist/src/commands/wizard.js.map +1 -1
- package/dist/src/commands/write-commands.js +33 -19
- 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 +66 -0
- package/dist/src/eval/manifest-v1.js +326 -0
- package/dist/src/eval/manifest-v1.js.map +1 -0
- package/dist/src/generators/local-plugin.d.ts +3 -0
- package/dist/src/generators/local-plugin.js +167 -45
- package/dist/src/generators/local-plugin.js.map +1 -1
- package/dist/src/index.d.ts +6 -1
- package/dist/src/index.js +863 -126
- package/dist/src/index.js.map +1 -1
- package/dist/src/output/command-receipt.d.ts +58 -8
- package/dist/src/output/command-receipt.js +141 -11
- 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 +0 -3
- package/dist/src/output/rebuild-progress.js.map +1 -1
- package/dist/src/portable/commands.d.ts +6 -2
- package/dist/src/portable/commands.js +57 -6
- package/dist/src/portable/commands.js.map +1 -1
- package/dist/src/portable/materializer.d.ts +4 -4
- package/dist/src/portable/materializer.js +61 -12
- package/dist/src/portable/materializer.js.map +1 -1
- package/dist/src/tui/catalog-generation.d.ts +35 -0
- package/dist/src/tui/catalog-generation.js +85 -0
- package/dist/src/tui/catalog-generation.js.map +1 -0
- package/dist/src/tui/components.js +1 -2
- package/dist/src/tui/components.js.map +1 -1
- package/dist/src/tui/console-app-v4.d.ts +1 -1
- package/dist/src/tui/console-app-v4.js +647 -196
- package/dist/src/tui/console-app-v4.js.map +1 -1
- package/dist/src/tui/controller-runtime.d.ts +6 -2
- package/dist/src/tui/controller-runtime.js +646 -137
- package/dist/src/tui/controller-runtime.js.map +1 -1
- package/dist/src/tui/controller.d.ts +77 -15
- package/dist/src/tui/controller.js +647 -306
- package/dist/src/tui/controller.js.map +1 -1
- package/dist/src/tui/diagnostics.d.ts +1 -2
- package/dist/src/tui/diagnostics.js.map +1 -1
- package/dist/src/tui/index.d.ts +1 -0
- package/dist/src/tui/index.js +1 -0
- 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/model.d.ts +102 -14
- package/dist/src/tui/model.js +630 -139
- package/dist/src/tui/model.js.map +1 -1
- package/dist/src/tui/router.d.ts +35 -0
- package/dist/src/tui/router.js.map +1 -1
- 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/views.js +31 -3
- package/dist/src/tui/views.js.map +1 -1
- package/dist/src/types.d.ts +104 -13
- 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/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 +8 -6
- package/dist/src/utils/bundle-layout.js.map +1 -1
- package/dist/src/utils/catalog-digests.d.ts +7 -0
- package/dist/src/utils/catalog-digests.js +40 -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 +13 -0
- package/dist/src/utils/catalog-generation-error.js +28 -0
- package/dist/src/utils/catalog-generation-error.js.map +1 -0
- package/dist/src/utils/catalog-generation-resolver.d.ts +20 -0
- package/dist/src/utils/catalog-generation-resolver.js +143 -0
- package/dist/src/utils/catalog-generation-resolver.js.map +1 -0
- package/dist/src/utils/catalog-generation-service.d.ts +43 -0
- package/dist/src/utils/catalog-generation-service.js +306 -0
- package/dist/src/utils/catalog-generation-service.js.map +1 -0
- package/dist/src/utils/catalog-generation-state.d.ts +17 -0
- package/dist/src/utils/catalog-generation-state.js +168 -0
- package/dist/src/utils/catalog-generation-state.js.map +1 -0
- package/dist/src/utils/catalog-generation-store.d.ts +34 -0
- package/dist/src/utils/catalog-generation-store.js +251 -0
- package/dist/src/utils/catalog-generation-store.js.map +1 -0
- package/dist/src/utils/catalog-manifest-v6.d.ts +5 -0
- package/dist/src/utils/{catalog-manifest-v4.js → catalog-manifest-v6.js} +35 -43
- package/dist/src/utils/catalog-manifest-v6.js.map +1 -0
- package/dist/src/utils/catalog-operation-context.d.ts +20 -0
- package/dist/src/utils/catalog-operation-context.js +141 -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 +21 -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-references.d.ts +7 -0
- package/dist/src/utils/catalog-source-references.js +44 -55
- package/dist/src/utils/catalog-source-references.js.map +1 -1
- package/dist/src/utils/catalog-sources.d.ts +1 -0
- package/dist/src/utils/catalog-sources.js +55 -20
- 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 +81 -0
- package/dist/src/utils/codex-manager.js +810 -0
- package/dist/src/utils/codex-manager.js.map +1 -0
- package/dist/src/utils/codex-reconciler.d.ts +131 -0
- package/dist/src/utils/codex-reconciler.js +327 -0
- package/dist/src/utils/codex-reconciler.js.map +1 -0
- package/dist/src/utils/codex-shared-native.d.ts +56 -0
- package/dist/src/utils/codex-shared-native.js +87 -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 +44 -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.js +66 -140
- package/dist/src/utils/git-catalog-provider.js.map +1 -1
- package/dist/src/utils/lifecycle-active-store.d.ts +0 -28
- package/dist/src/utils/lifecycle-active-store.js +35 -247
- package/dist/src/utils/lifecycle-active-store.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 +53 -110
- package/dist/src/utils/multi-source-catalog.js.map +1 -1
- package/dist/src/utils/native-cli.d.ts +49 -6
- package/dist/src/utils/native-cli.js +116 -33
- package/dist/src/utils/native-cli.js.map +1 -1
- package/dist/src/utils/orphan-marketplace-cleanup.js +1 -3
- package/dist/src/utils/orphan-marketplace-cleanup.js.map +1 -1
- package/dist/src/utils/ownership.d.ts +10 -11
- package/dist/src/utils/ownership.js +55 -112
- 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 +52 -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-write.js +18 -40
- package/dist/src/utils/plugin-config-write.js.map +1 -1
- package/dist/src/utils/plugin-config.d.ts +1 -12
- package/dist/src/utils/plugin-config.js +107 -226
- package/dist/src/utils/plugin-config.js.map +1 -1
- package/dist/src/utils/plugin-intent-state.d.ts +39 -0
- package/dist/src/utils/plugin-intent-state.js +325 -0
- package/dist/src/utils/plugin-intent-state.js.map +1 -0
- package/dist/src/utils/plugin-scripts.d.ts +1 -1
- package/dist/src/utils/plugin-scripts.js +1 -1
- package/dist/src/utils/plugin-scripts.js.map +1 -1
- 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 +9 -5
- package/dist/src/utils/target-eligibility.js.map +1 -1
- package/package.json +6 -4
- 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.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 -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/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,41 +1,29 @@
|
|
|
1
1
|
import crypto from 'node:crypto';
|
|
2
|
+
import os from 'node:os';
|
|
2
3
|
import path from 'node:path';
|
|
3
4
|
import fs from 'fs-extra';
|
|
4
5
|
import { validatePublishedCatalogSnapshot } from '@lesliechan721/aw-plugin-core';
|
|
5
|
-
import { disposeCatalogPublicationInspection, parseRemoteRefs, prepareCatalogPublicationInspection, publicationGit, publicationGitExit, } from './catalog-publication-inspection.js';
|
|
6
|
+
import { disposeCatalogPublicationInspection, inspectCatalogPublicationLiveContext, parseRemoteRefs, prepareCatalogPublicationInspection, publicationGit, publicationGitExit, readCatalogPublicationBranchState, } from './catalog-publication-inspection.js';
|
|
7
|
+
import { catalogPublicationJournalPath, catalogPublicationPlanDigest, catalogPublicationRepositoryName, catalogPublicationRepositoryPath, readCatalogPublicationJournal, writeCatalogPublicationJournalAtomic, } from './catalog-publication-journal.js';
|
|
8
|
+
import { resolveCatalogPublicationTarget, } from './catalog-publication-target.js';
|
|
9
|
+
import { resolveCatalogWorkspaceRoot, } from './catalog-workspace-resolution.js';
|
|
10
|
+
export { catalogPublicationPlanDigest, parseCatalogPublicationJournal, } from './catalog-publication-journal.js';
|
|
6
11
|
export { safeRemoteIdentity, sanitizedGitEnvironment } from './catalog-publication-inspection.js';
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return JSON.stringify(value);
|
|
18
|
-
}
|
|
19
|
-
export function catalogPublicationDescriptorDigest(descriptor) {
|
|
20
|
-
return digest(canonicalJson(descriptor));
|
|
21
|
-
}
|
|
22
|
-
async function writeJsonAtomic(filePath, value, exclusive) {
|
|
23
|
-
await fs.ensureDir(path.dirname(filePath));
|
|
24
|
-
const temporary = path.join(path.dirname(filePath), `.${path.basename(filePath)}.${crypto.randomUUID()}.tmp`);
|
|
25
|
-
await fs.writeFile(temporary, `${JSON.stringify(value, null, 2)}\n`, { flag: 'wx', mode: 0o600 });
|
|
26
|
-
try {
|
|
27
|
-
if (exclusive) {
|
|
28
|
-
await fs.link(temporary, filePath);
|
|
29
|
-
await fs.remove(temporary);
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
await fs.rename(temporary, filePath);
|
|
12
|
+
async function assertPublicationStatePathSafe(workspaceRoot) {
|
|
13
|
+
for (const candidate of [
|
|
14
|
+
path.join(workspaceRoot, '.aw'),
|
|
15
|
+
path.join(workspaceRoot, '.aw', 'publish'),
|
|
16
|
+
]) {
|
|
17
|
+
if (!(await fs.pathExists(candidate)))
|
|
18
|
+
continue;
|
|
19
|
+
const stats = await fs.lstat(candidate);
|
|
20
|
+
if (!stats.isDirectory() || stats.isSymbolicLink()) {
|
|
21
|
+
throw new Error('Catalog publication state path must contain only regular local directories.');
|
|
33
22
|
}
|
|
34
23
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
24
|
+
}
|
|
25
|
+
function sameDescriptor(left, right) {
|
|
26
|
+
return catalogPublicationPlanDigest(left) === catalogPublicationPlanDigest(right);
|
|
39
27
|
}
|
|
40
28
|
async function clearWorktree(repositoryRoot) {
|
|
41
29
|
for (const name of await fs.readdir(repositoryRoot)) {
|
|
@@ -53,46 +41,45 @@ async function assertNoGitAttributes(root, relative = '') {
|
|
|
53
41
|
await assertNoGitAttributes(root, child);
|
|
54
42
|
}
|
|
55
43
|
}
|
|
56
|
-
async function assertSnapshotBinding(snapshotRoot, descriptor) {
|
|
57
|
-
const [stats, validation
|
|
44
|
+
async function assertSnapshotBinding(snapshotRoot, descriptor, display) {
|
|
45
|
+
const [stats, validation] = await Promise.all([
|
|
58
46
|
fs.lstat(snapshotRoot),
|
|
59
47
|
validatePublishedCatalogSnapshot(snapshotRoot),
|
|
60
|
-
fs.readFile(path.join(snapshotRoot, 'plugin-release-ledger.json')),
|
|
61
48
|
]);
|
|
62
49
|
if (!stats.isDirectory() || stats.isSymbolicLink()) {
|
|
63
50
|
throw new Error('Prepared Catalog snapshot must be a regular local directory.');
|
|
64
51
|
}
|
|
65
52
|
const release = validation.manifest.release;
|
|
66
|
-
if (validation.manifest.catalogVersion !==
|
|
67
|
-
|| validation.manifest.channel !==
|
|
53
|
+
if (validation.manifest.catalogVersion !== display.catalogVersion
|
|
54
|
+
|| validation.manifest.channel !== display.channel
|
|
55
|
+
|| validation.manifest.entries.length !== display.pluginCount
|
|
68
56
|
|| validation.snapshotDigest !== descriptor.snapshotDigest
|
|
69
57
|
|| release.state !== 'published'
|
|
70
|
-
|| release.sourceHead !== descriptor.sourceHead
|
|
71
|
-
|
|
72
|
-
|| release.planId !== descriptor.planId
|
|
73
|
-
|| digest(ledgerBytes) !== descriptor.ledgerDigest) {
|
|
74
|
-
throw new Error('Prepared Catalog descriptor, snapshot, ledger, or plan identity changed.');
|
|
58
|
+
|| release.sourceHead !== descriptor.sourceHead) {
|
|
59
|
+
throw new Error('Prepared Catalog descriptor, snapshot, or plan identity changed.');
|
|
75
60
|
}
|
|
76
61
|
await assertNoGitAttributes(snapshotRoot);
|
|
77
62
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
throw new Error('Catalog publish state under .aw/publish must be ignored by Git. Add .aw/ to .gitignore.');
|
|
63
|
+
function displayFromPreparation(preparation) {
|
|
64
|
+
return {
|
|
65
|
+
catalogVersion: preparation.prepared.catalogVersion,
|
|
66
|
+
channel: preparation.prepared.channel,
|
|
67
|
+
pluginCount: preparation.prepared.pluginNames.length,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function assertLiveContextMatchesDescriptor(context, descriptor) {
|
|
71
|
+
if (context.workspaceIdentity !== descriptor.workspaceIdentity
|
|
72
|
+
|| context.sourceHead !== descriptor.sourceHead
|
|
73
|
+
|| context.remoteName !== descriptor.remote.name
|
|
74
|
+
|| context.remoteIdentityDigest !== descriptor.remote.identityDigest
|
|
75
|
+
|| context.branch !== descriptor.branch
|
|
76
|
+
|| context.tag !== descriptor.tag) {
|
|
77
|
+
throw new Error('Catalog publication identity changed. Increase the Catalog version and create a new plan.');
|
|
94
78
|
}
|
|
95
|
-
|
|
79
|
+
}
|
|
80
|
+
async function createPublicationCommit(preparation, descriptor, snapshotRoot, display) {
|
|
81
|
+
const { repositoryRoot, parent, tag, env } = preparation;
|
|
82
|
+
await assertSnapshotBinding(snapshotRoot, descriptor, display);
|
|
96
83
|
if (parent) {
|
|
97
84
|
await publicationGit(repositoryRoot, [
|
|
98
85
|
'checkout', '--quiet', '--detach', 'refs/aw/catalog-parent',
|
|
@@ -105,11 +92,13 @@ async function publishCatalogPublicationPreparation(options) {
|
|
|
105
92
|
}
|
|
106
93
|
await clearWorktree(repositoryRoot);
|
|
107
94
|
await fs.copy(snapshotRoot, repositoryRoot, { dereference: false });
|
|
108
|
-
await publicationGit(repositoryRoot, [
|
|
95
|
+
await publicationGit(repositoryRoot, [
|
|
96
|
+
'add', '--force', '--all',
|
|
97
|
+
], env, 'publicationCommitFailed', 'Could not stage the Catalog publication tree.');
|
|
109
98
|
await publicationGit(repositoryRoot, [
|
|
110
99
|
'-c', 'user.name=AW Catalog Publisher',
|
|
111
100
|
'-c', 'user.email=catalog-publisher@agent-workflows.invalid',
|
|
112
|
-
'commit', '--quiet', '-m', `Catalog ${
|
|
101
|
+
'commit', '--quiet', '-m', `Catalog ${display.catalogVersion}`,
|
|
113
102
|
], env, 'publicationCommitFailed', 'Could not create the Catalog publication commit.');
|
|
114
103
|
const commit = await publicationGit(repositoryRoot, [
|
|
115
104
|
'rev-parse', 'HEAD',
|
|
@@ -122,198 +111,589 @@ async function publishCatalogPublicationPreparation(options) {
|
|
|
122
111
|
if ((parent && (parents.length !== 1 || parents[0] !== parent)) || (!parent && parents.length !== 0)) {
|
|
123
112
|
throw new Error('Catalog publication commit has an invalid parent.');
|
|
124
113
|
}
|
|
125
|
-
const verificationRoot = path.join(temporaryRoot, 'verification');
|
|
114
|
+
const verificationRoot = path.join(preparation.temporaryRoot, 'verification');
|
|
126
115
|
await fs.ensureDir(verificationRoot);
|
|
127
116
|
await publicationGit(repositoryRoot, [
|
|
128
117
|
'--work-tree', verificationRoot, 'checkout', '--quiet', commit, '--', '.',
|
|
129
118
|
], env, 'publicationCommitFailed', 'Could not verify the Catalog publication commit tree.');
|
|
130
|
-
await assertSnapshotBinding(verificationRoot, descriptor);
|
|
119
|
+
await assertSnapshotBinding(verificationRoot, descriptor, display);
|
|
131
120
|
await publicationGit(repositoryRoot, [
|
|
132
121
|
'-c', 'user.name=AW Catalog Publisher',
|
|
133
122
|
'-c', 'user.email=catalog-publisher@agent-workflows.invalid',
|
|
134
|
-
'tag', '--annotate', tag, '--message', `Catalog ${
|
|
123
|
+
'tag', '--annotate', tag, '--message', `Catalog ${display.catalogVersion}`,
|
|
135
124
|
], env, 'publicationCommitFailed', 'Could not create the annotated Catalog tag.');
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
const
|
|
140
|
-
'
|
|
141
|
-
], env, '
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
125
|
+
return commit;
|
|
126
|
+
}
|
|
127
|
+
async function remoteRefState(cwd, remote, branchRef, tagRef, env) {
|
|
128
|
+
const refs = parseRemoteRefs(await publicationGit(cwd, [
|
|
129
|
+
'ls-remote', remote, branchRef, tagRef, `${tagRef}^{}`,
|
|
130
|
+
], env, 'remoteReadFailed', 'Could not inspect the Catalog publication remote.'));
|
|
131
|
+
const tagPresent = refs.has(tagRef) || refs.has(`${tagRef}^{}`);
|
|
132
|
+
return {
|
|
133
|
+
branchCommit: refs.get(branchRef) ?? null,
|
|
134
|
+
tagCommit: refs.get(`${tagRef}^{}`) ?? null,
|
|
135
|
+
tagPresent,
|
|
136
|
+
tagAnnotated: refs.has(tagRef) && refs.has(`${tagRef}^{}`),
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
function assertReconciliableRemoteState(state, journal) {
|
|
140
|
+
const branchAtExpected = state.branchCommit === journal.expectedCommit;
|
|
141
|
+
const branchAtParent = state.branchCommit === journal.descriptor.parent;
|
|
142
|
+
const tagAtExpected = state.tagAnnotated && state.tagCommit === journal.expectedCommit;
|
|
143
|
+
const tagAbsent = !state.tagPresent;
|
|
144
|
+
if ((branchAtExpected && tagAtExpected)
|
|
145
|
+
|| (branchAtParent && tagAbsent)
|
|
146
|
+
|| (branchAtExpected && tagAbsent)
|
|
147
|
+
|| (branchAtParent && tagAtExpected))
|
|
148
|
+
return;
|
|
149
|
+
throw new Error(`Catalog ${journal.display.catalogVersion} remote refs conflict with the prepared plan. Increase the Catalog version.`);
|
|
150
|
+
}
|
|
151
|
+
const PERSISTED_REPOSITORY_CONFIG = new Map([
|
|
152
|
+
['core.repositoryformatversion', new Set(['0'])],
|
|
153
|
+
['core.filemode', new Set(['true', 'false'])],
|
|
154
|
+
['core.bare', new Set(['false'])],
|
|
155
|
+
['core.logallrefupdates', new Set(['true'])],
|
|
156
|
+
['core.ignorecase', new Set(['true'])],
|
|
157
|
+
['core.precomposeunicode', new Set(['true'])],
|
|
158
|
+
['core.hookspath', new Set([os.devNull])],
|
|
159
|
+
['core.symlinks', new Set(['true'])],
|
|
160
|
+
]);
|
|
161
|
+
const REQUIRED_PERSISTED_REPOSITORY_CONFIG = [
|
|
162
|
+
'core.repositoryformatversion',
|
|
163
|
+
'core.filemode',
|
|
164
|
+
'core.bare',
|
|
165
|
+
'core.logallrefupdates',
|
|
166
|
+
'core.hookspath',
|
|
167
|
+
'core.symlinks',
|
|
168
|
+
];
|
|
169
|
+
async function assertRegularGitDirectory(root) {
|
|
170
|
+
const stats = await fs.lstat(root);
|
|
171
|
+
if (!stats.isDirectory() || stats.isSymbolicLink()) {
|
|
172
|
+
throw new Error('Pending Catalog publication Git directory is unsafe.');
|
|
150
173
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
174
|
+
}
|
|
175
|
+
async function assertRegularGitFile(filePath) {
|
|
176
|
+
const stats = await fs.lstat(filePath);
|
|
177
|
+
if (!stats.isFile() || stats.isSymbolicLink()) {
|
|
178
|
+
throw new Error('Pending Catalog publication Git control file is unsafe.');
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
async function assertGitTreeContainsOnlyLocalFiles(root) {
|
|
182
|
+
for (const entry of await fs.readdir(root, { withFileTypes: true })) {
|
|
183
|
+
const child = path.join(root, entry.name);
|
|
184
|
+
const stats = await fs.lstat(child);
|
|
185
|
+
if (stats.isSymbolicLink()) {
|
|
186
|
+
throw new Error('Pending Catalog publication Git data must not contain symbolic links.');
|
|
187
|
+
}
|
|
188
|
+
if (stats.isDirectory()) {
|
|
189
|
+
await assertGitTreeContainsOnlyLocalFiles(child);
|
|
190
|
+
}
|
|
191
|
+
else if (!stats.isFile()) {
|
|
192
|
+
throw new Error('Pending Catalog publication Git data must contain only regular local files.');
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
async function assertPathMissing(filePath) {
|
|
197
|
+
try {
|
|
198
|
+
await fs.lstat(filePath);
|
|
199
|
+
}
|
|
200
|
+
catch (error) {
|
|
201
|
+
if (error.code === 'ENOENT')
|
|
202
|
+
return;
|
|
203
|
+
throw error;
|
|
204
|
+
}
|
|
205
|
+
throw new Error('Pending Catalog publication repository must not use alternate object stores.');
|
|
206
|
+
}
|
|
207
|
+
async function validatePersistentRepositoryControlState(repositoryRoot, env) {
|
|
208
|
+
const gitRoot = path.join(repositoryRoot, '.git');
|
|
209
|
+
const configPath = path.join(gitRoot, 'config');
|
|
210
|
+
await assertRegularGitDirectory(gitRoot);
|
|
211
|
+
await assertRegularGitFile(configPath);
|
|
212
|
+
await assertRegularGitFile(path.join(gitRoot, 'HEAD'));
|
|
213
|
+
await assertRegularGitFile(path.join(gitRoot, 'index'));
|
|
214
|
+
await assertRegularGitDirectory(path.join(gitRoot, 'objects'));
|
|
215
|
+
await assertRegularGitDirectory(path.join(gitRoot, 'refs'));
|
|
216
|
+
await assertPathMissing(path.join(gitRoot, 'objects', 'info', 'alternates'));
|
|
217
|
+
await assertPathMissing(path.join(gitRoot, 'objects', 'info', 'http-alternates'));
|
|
218
|
+
await assertGitTreeContainsOnlyLocalFiles(gitRoot);
|
|
219
|
+
const entries = (await publicationGit(repositoryRoot, [
|
|
220
|
+
'config', '--file', configPath, '--no-includes', '--null', '--list',
|
|
221
|
+
], env, 'pendingRepositoryInvalid', 'Pending Catalog publication config is damaged.'))
|
|
222
|
+
.split('\0')
|
|
223
|
+
.filter(Boolean);
|
|
224
|
+
const seen = new Set();
|
|
225
|
+
for (const entry of entries) {
|
|
226
|
+
const separator = entry.indexOf('\n');
|
|
227
|
+
if (separator <= 0)
|
|
228
|
+
throw new Error('Pending Catalog publication config is damaged.');
|
|
229
|
+
const key = entry.slice(0, separator).toLowerCase();
|
|
230
|
+
const value = entry.slice(separator + 1);
|
|
231
|
+
if (seen.has(key) || !PERSISTED_REPOSITORY_CONFIG.get(key)?.has(value)) {
|
|
232
|
+
throw new Error('Pending Catalog publication config contains unsafe local settings.');
|
|
233
|
+
}
|
|
234
|
+
seen.add(key);
|
|
235
|
+
}
|
|
236
|
+
if (REQUIRED_PERSISTED_REPOSITORY_CONFIG.some((key) => !seen.has(key))) {
|
|
237
|
+
throw new Error('Pending Catalog publication config is incomplete.');
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
async function validatePersistentRepository(repositoryRoot, journal, env) {
|
|
241
|
+
const version = journal.display.catalogVersion;
|
|
242
|
+
let stats;
|
|
243
|
+
try {
|
|
244
|
+
stats = await fs.lstat(repositoryRoot);
|
|
245
|
+
}
|
|
246
|
+
catch (error) {
|
|
247
|
+
throw new Error(`Catalog ${version} pending publication repository is missing or damaged. Increase the Catalog version.`, { cause: error });
|
|
248
|
+
}
|
|
249
|
+
if (!stats.isDirectory() || stats.isSymbolicLink()) {
|
|
250
|
+
throw new Error(`Catalog ${version} pending publication repository is missing or damaged. Increase the Catalog version.`);
|
|
251
|
+
}
|
|
252
|
+
try {
|
|
253
|
+
await validatePersistentRepositoryControlState(repositoryRoot, env);
|
|
254
|
+
const [head, tagCommit, tagType, remotes, parents] = await Promise.all([
|
|
255
|
+
publicationGit(repositoryRoot, ['rev-parse', '--verify', 'HEAD'], env, 'pendingRepositoryInvalid', 'Pending Catalog publication repository is damaged.'),
|
|
256
|
+
publicationGit(repositoryRoot, ['rev-parse', `${journal.descriptor.tag}^{commit}`], env, 'pendingRepositoryInvalid', 'Pending Catalog publication tag is damaged.'),
|
|
257
|
+
publicationGit(repositoryRoot, ['cat-file', '-t', `refs/tags/${journal.descriptor.tag}`], env, 'pendingRepositoryInvalid', 'Pending Catalog publication tag is damaged.'),
|
|
258
|
+
publicationGit(repositoryRoot, ['remote'], env, 'pendingRepositoryInvalid', 'Pending Catalog publication repository is damaged.'),
|
|
259
|
+
publicationGit(repositoryRoot, ['show', '-s', '--format=%P', journal.expectedCommit], env, 'pendingRepositoryInvalid', 'Pending Catalog publication commit is damaged.'),
|
|
155
260
|
]);
|
|
261
|
+
const parentList = parents.split(/\s+/u).filter(Boolean);
|
|
262
|
+
if (head !== journal.expectedCommit
|
|
263
|
+
|| tagCommit !== journal.expectedCommit
|
|
264
|
+
|| tagType !== 'tag'
|
|
265
|
+
|| remotes !== ''
|
|
266
|
+
|| (journal.descriptor.parent === null
|
|
267
|
+
? parentList.length !== 0
|
|
268
|
+
: parentList.length !== 1 || parentList[0] !== journal.descriptor.parent))
|
|
269
|
+
throw new Error('Pending Catalog publication repository identity changed.');
|
|
270
|
+
const verificationRoot = path.join(path.dirname(repositoryRoot), `.${path.basename(repositoryRoot)}.${crypto.randomUUID()}.verify`);
|
|
271
|
+
try {
|
|
272
|
+
await fs.ensureDir(verificationRoot);
|
|
273
|
+
await publicationGit(repositoryRoot, [
|
|
274
|
+
'--work-tree', verificationRoot, 'checkout', '--quiet', journal.expectedCommit, '--', '.',
|
|
275
|
+
], env, 'pendingRepositoryInvalid', 'Pending Catalog publication commit tree is damaged.');
|
|
276
|
+
await assertSnapshotBinding(verificationRoot, journal.descriptor, journal.display);
|
|
277
|
+
}
|
|
278
|
+
finally {
|
|
279
|
+
await fs.remove(verificationRoot);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
catch (error) {
|
|
283
|
+
throw new Error(`Catalog ${version} pending publication repository is missing or damaged. Increase the Catalog version.`, { cause: error });
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
async function persistRepository(preparation, finalPath, journal) {
|
|
287
|
+
const parent = path.dirname(finalPath);
|
|
288
|
+
await fs.ensureDir(parent);
|
|
289
|
+
const staging = path.join(parent, `.${path.basename(finalPath)}.${crypto.randomUUID()}.tmp`);
|
|
290
|
+
try {
|
|
291
|
+
await publicationGit(preparation.repositoryRoot, [
|
|
292
|
+
'remote', 'remove', 'publish',
|
|
293
|
+
], preparation.env, 'temporaryRepositoryFailed', 'Could not seal the publication repository.');
|
|
294
|
+
await fs.copy(preparation.repositoryRoot, staging, { dereference: false, errorOnExist: true });
|
|
295
|
+
await validatePersistentRepository(staging, journal, preparation.env);
|
|
296
|
+
await fs.rename(staging, finalPath);
|
|
297
|
+
}
|
|
298
|
+
finally {
|
|
299
|
+
await fs.remove(staging);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
function receiptBase(context, journal, resolution) {
|
|
303
|
+
const repositoryPath = journal.repository === null
|
|
304
|
+
? null
|
|
305
|
+
: path.join(path.dirname(catalogPublicationJournalPath(context.catalogWorkspaceRoot, journal.display.catalogVersion)), journal.repository);
|
|
306
|
+
return {
|
|
307
|
+
ok: true,
|
|
308
|
+
workspaceRoot: context.catalogWorkspaceRoot,
|
|
309
|
+
workspaceRootResolvedFrom: resolution.workspaceRootResolvedFrom ?? 'explicit',
|
|
310
|
+
workspaceIdentity: journal.descriptor.workspaceIdentity,
|
|
311
|
+
catalogVersion: journal.display.catalogVersion,
|
|
312
|
+
channel: journal.display.channel,
|
|
313
|
+
remote: context.remote,
|
|
314
|
+
remoteResolvedFrom: resolution.remoteResolvedFrom ?? 'explicit',
|
|
315
|
+
remoteUrl: context.safeFetchUrl,
|
|
316
|
+
fetchUrl: context.safeFetchUrl,
|
|
317
|
+
pushUrl: context.safePushUrl,
|
|
318
|
+
branch: journal.descriptor.branch,
|
|
319
|
+
branchResolvedFrom: resolution.branchResolvedFrom ?? 'explicit',
|
|
320
|
+
parent: journal.descriptor.parent,
|
|
321
|
+
tag: journal.descriptor.tag,
|
|
322
|
+
expectedCommit: journal.expectedCommit,
|
|
323
|
+
sourceHead: journal.descriptor.sourceHead,
|
|
324
|
+
pluginCount: journal.display.pluginCount,
|
|
325
|
+
snapshotDigest: journal.descriptor.snapshotDigest,
|
|
326
|
+
planDigest: journal.planDigest,
|
|
327
|
+
descriptor: journal.descriptor,
|
|
328
|
+
journalPath: catalogPublicationJournalPath(context.catalogWorkspaceRoot, journal.display.catalogVersion),
|
|
329
|
+
repositoryPath,
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
async function readExistingPlan(context, resolution) {
|
|
333
|
+
await assertPublicationStatePathSafe(context.catalogWorkspaceRoot);
|
|
334
|
+
const journalPath = catalogPublicationJournalPath(context.catalogWorkspaceRoot, context.catalogVersion);
|
|
335
|
+
const repositoryPath = catalogPublicationRepositoryPath(context.catalogWorkspaceRoot, context.catalogVersion);
|
|
336
|
+
const journal = await readCatalogPublicationJournal(journalPath, context.catalogVersion);
|
|
337
|
+
if (!journal) {
|
|
338
|
+
if (await fs.pathExists(repositoryPath)) {
|
|
339
|
+
throw new Error(`Catalog ${context.catalogVersion} pending publication journal is missing. Increase the Catalog version.`);
|
|
340
|
+
}
|
|
341
|
+
return null;
|
|
342
|
+
}
|
|
343
|
+
assertLiveContextMatchesDescriptor(context, journal.descriptor);
|
|
344
|
+
if (journal.state !== 'published') {
|
|
345
|
+
await validatePersistentRepository(repositoryPath, journal, context.env);
|
|
346
|
+
}
|
|
347
|
+
const state = await remoteRefState(context.repoRoot, context.pushUrl, context.branchRef, context.tagRef, context.env);
|
|
348
|
+
if (journal.state === 'published'
|
|
349
|
+
&& (state.branchCommit !== journal.expectedCommit
|
|
350
|
+
|| !state.tagAnnotated
|
|
351
|
+
|| state.tagCommit !== journal.expectedCommit)) {
|
|
352
|
+
throw new Error(`Catalog ${journal.display.catalogVersion} published journal conflicts with remote refs. Increase the Catalog version.`);
|
|
353
|
+
}
|
|
354
|
+
assertReconciliableRemoteState(state, journal);
|
|
355
|
+
return {
|
|
356
|
+
command: 'catalog:publish:plan',
|
|
357
|
+
state: journal.state,
|
|
358
|
+
...receiptBase(context, journal, resolution),
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
async function persistNewPlan(options) {
|
|
362
|
+
const { preparation, descriptor, snapshotRoot, resolution } = options;
|
|
363
|
+
await assertPublicationStatePathSafe(preparation.catalogWorkspaceRoot);
|
|
364
|
+
if (!sameDescriptor(preparation.descriptor, descriptor)) {
|
|
365
|
+
throw new Error('Catalog publication descriptor changed during preparation.');
|
|
156
366
|
}
|
|
157
|
-
|
|
158
|
-
|
|
367
|
+
const display = displayFromPreparation(preparation);
|
|
368
|
+
const journalPath = catalogPublicationJournalPath(preparation.catalogWorkspaceRoot, display.catalogVersion);
|
|
369
|
+
const repositoryPath = catalogPublicationRepositoryPath(preparation.catalogWorkspaceRoot, display.catalogVersion);
|
|
370
|
+
if (!(await publicationGitExit(preparation.repoRoot, ['check-ignore', '-q', journalPath], preparation.env))) {
|
|
371
|
+
throw new Error('Catalog publish state under .aw/publish must be ignored by Git. Add .aw/ to .gitignore.');
|
|
159
372
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
], env, 'remoteDrift', 'Could not recheck the Catalog publication remote.'));
|
|
163
|
-
if ((liveRefs.get(branchRef) ?? null) !== parent || liveRefs.has(tagRef) || liveRefs.has(`${tagRef}^{}`)) {
|
|
164
|
-
throw new Error('Catalog remote changed during preparation. Increase the Catalog version before publishing again.');
|
|
373
|
+
if (await fs.pathExists(journalPath) || await fs.pathExists(repositoryPath)) {
|
|
374
|
+
throw new Error(`Catalog ${display.catalogVersion} already has publication state. Use its existing plan or increase the Catalog version.`);
|
|
165
375
|
}
|
|
166
|
-
if (
|
|
167
|
-
throw new Error(`Catalog ${descriptor.
|
|
168
|
-
+ 'Run aw catalog version <higher> before publishing again.');
|
|
376
|
+
if (!preparation.tagAvailable) {
|
|
377
|
+
throw new Error(`Remote Catalog tag ${descriptor.tag} already exists. Increase the Catalog version.`);
|
|
169
378
|
}
|
|
170
|
-
await
|
|
171
|
-
const
|
|
379
|
+
const expectedCommit = await createPublicationCommit(preparation, descriptor, snapshotRoot, display);
|
|
380
|
+
const context = await inspectCatalogPublicationLiveContext({
|
|
381
|
+
workspaceRoot: preparation.catalogWorkspaceRoot,
|
|
382
|
+
...(descriptor.remote.name === null ? { remoteUrl: preparation.pushUrl } : { remote: descriptor.remote.name }),
|
|
383
|
+
branch: descriptor.branch,
|
|
384
|
+
env: preparation.env,
|
|
385
|
+
});
|
|
386
|
+
assertLiveContextMatchesDescriptor(context, descriptor);
|
|
387
|
+
const liveRefs = await remoteRefState(preparation.repositoryRoot, 'publish', preparation.branchRef, preparation.tagRef, preparation.env);
|
|
388
|
+
if (liveRefs.branchCommit !== descriptor.parent || liveRefs.tagPresent) {
|
|
389
|
+
throw new Error(`Catalog ${display.catalogVersion} remote changed during plan creation. Increase the Catalog version.`);
|
|
390
|
+
}
|
|
391
|
+
const journal = {
|
|
172
392
|
schemaVersion: 1,
|
|
173
|
-
state: '
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
tag,
|
|
181
|
-
snapshotDigest: descriptor.snapshotDigest,
|
|
182
|
-
contentDigest: descriptor.contentDigest,
|
|
183
|
-
planId: descriptor.planId,
|
|
184
|
-
descriptorDigest: catalogPublicationDescriptorDigest(descriptor),
|
|
185
|
-
attemptedAt: new Date().toISOString(),
|
|
393
|
+
state: 'prepared',
|
|
394
|
+
planDigest: catalogPublicationPlanDigest(descriptor),
|
|
395
|
+
descriptor,
|
|
396
|
+
expectedCommit,
|
|
397
|
+
repository: catalogPublicationRepositoryName(display.catalogVersion),
|
|
398
|
+
display,
|
|
399
|
+
preparedAt: new Date().toISOString(),
|
|
186
400
|
};
|
|
401
|
+
await persistRepository(preparation, repositoryPath, journal);
|
|
187
402
|
try {
|
|
188
|
-
await
|
|
403
|
+
await writeCatalogPublicationJournalAtomic(journalPath, journal, true);
|
|
189
404
|
}
|
|
190
405
|
catch (error) {
|
|
191
406
|
if (error.code === 'EEXIST') {
|
|
192
|
-
throw new Error(`Catalog ${
|
|
193
|
-
+ 'Run aw catalog version <higher> before publishing again.');
|
|
407
|
+
throw new Error(`Catalog ${display.catalogVersion} publication journal already exists. Use its plan or increase the Catalog version.`);
|
|
194
408
|
}
|
|
195
409
|
throw error;
|
|
196
410
|
}
|
|
411
|
+
return {
|
|
412
|
+
command: 'catalog:publish:plan',
|
|
413
|
+
state: 'prepared',
|
|
414
|
+
...receiptBase(context, journal, resolution),
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
export async function persistCatalogPublicationPlan(options) {
|
|
418
|
+
return persistNewPlan({
|
|
419
|
+
preparation: options.preparation,
|
|
420
|
+
descriptor: options.descriptor ?? options.preparation.descriptor,
|
|
421
|
+
snapshotRoot: options.snapshotRoot ?? options.preparation.prepared.outputRoot,
|
|
422
|
+
resolution: options,
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
export async function prepareCatalogPublicationPlan(options) {
|
|
426
|
+
const context = await inspectCatalogPublicationLiveContext(options);
|
|
427
|
+
const existing = await readExistingPlan(context, options);
|
|
428
|
+
if (existing)
|
|
429
|
+
return existing;
|
|
430
|
+
const initialState = await remoteRefState(context.repoRoot, context.pushUrl, context.branchRef, context.tagRef, context.env);
|
|
431
|
+
if (initialState.tagPresent) {
|
|
432
|
+
throw new Error(`Remote Catalog tag ${context.tag} already exists. Increase the Catalog version.`);
|
|
433
|
+
}
|
|
434
|
+
if (initialState.branchCommit !== null) {
|
|
435
|
+
const branchState = await readCatalogPublicationBranchState({
|
|
436
|
+
workspaceRoot: context.catalogWorkspaceRoot,
|
|
437
|
+
...(options.remoteUrl === undefined ? { remote: options.remote } : { remoteUrl: options.remoteUrl }),
|
|
438
|
+
branch: context.branch,
|
|
439
|
+
env: options.env,
|
|
440
|
+
});
|
|
441
|
+
if (branchState?.version === context.catalogVersion) {
|
|
442
|
+
throw new Error(`Remote Catalog branch already contains version ${context.catalogVersion} without its journal. Increase the Catalog version.`);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
const preparation = await prepareCatalogPublicationInspection(options);
|
|
197
446
|
try {
|
|
198
|
-
await
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
447
|
+
return await persistNewPlan({
|
|
448
|
+
preparation,
|
|
449
|
+
descriptor: preparation.descriptor,
|
|
450
|
+
snapshotRoot: preparation.prepared.outputRoot,
|
|
451
|
+
resolution: options,
|
|
452
|
+
});
|
|
202
453
|
}
|
|
203
|
-
|
|
204
|
-
|
|
454
|
+
finally {
|
|
455
|
+
await disposeCatalogPublicationInspection(preparation);
|
|
205
456
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
457
|
+
}
|
|
458
|
+
async function markUncertain(journalPath, journal) {
|
|
459
|
+
const uncertain = {
|
|
460
|
+
schemaVersion: 1,
|
|
461
|
+
state: 'uncertain',
|
|
462
|
+
planDigest: journal.planDigest,
|
|
463
|
+
descriptor: journal.descriptor,
|
|
464
|
+
expectedCommit: journal.expectedCommit,
|
|
465
|
+
repository: journal.repository,
|
|
466
|
+
display: journal.display,
|
|
467
|
+
preparedAt: journal.preparedAt,
|
|
468
|
+
uncertainAt: new Date().toISOString(),
|
|
469
|
+
};
|
|
470
|
+
await writeCatalogPublicationJournalAtomic(journalPath, uncertain);
|
|
471
|
+
return uncertain;
|
|
472
|
+
}
|
|
473
|
+
export async function applyCatalogPublicationPlan(options) {
|
|
474
|
+
if (!/^sha256:[0-9a-f]{64}$/u.test(options.expectedPlanDigest)) {
|
|
475
|
+
throw new Error('Catalog publish apply requires --expected-plan-digest from catalog publish plan.');
|
|
476
|
+
}
|
|
477
|
+
const context = await inspectCatalogPublicationLiveContext(options);
|
|
478
|
+
await assertPublicationStatePathSafe(context.catalogWorkspaceRoot);
|
|
479
|
+
const journalPath = catalogPublicationJournalPath(context.catalogWorkspaceRoot, context.catalogVersion);
|
|
480
|
+
const repositoryPath = catalogPublicationRepositoryPath(context.catalogWorkspaceRoot, context.catalogVersion);
|
|
481
|
+
let journal = await readCatalogPublicationJournal(journalPath, context.catalogVersion);
|
|
482
|
+
if (!journal) {
|
|
483
|
+
const state = await remoteRefState(context.repoRoot, context.pushUrl, context.branchRef, context.tagRef, context.env);
|
|
484
|
+
const branchState = state.branchCommit === null
|
|
485
|
+
? null
|
|
486
|
+
: await readCatalogPublicationBranchState({
|
|
487
|
+
workspaceRoot: context.catalogWorkspaceRoot,
|
|
488
|
+
...(options.remoteUrl === undefined ? { remote: options.remote } : { remoteUrl: options.remoteUrl }),
|
|
489
|
+
branch: context.branch,
|
|
490
|
+
env: options.env,
|
|
491
|
+
});
|
|
492
|
+
if (state.tagPresent
|
|
493
|
+
|| await fs.pathExists(repositoryPath)
|
|
494
|
+
|| branchState?.version === context.catalogVersion) {
|
|
495
|
+
throw new Error(`Catalog ${context.catalogVersion} publication state is missing while the version is occupied. Increase the Catalog version.`);
|
|
496
|
+
}
|
|
497
|
+
throw new Error(`Catalog ${context.catalogVersion} has no prepared publication plan. Run catalog publish plan.`);
|
|
498
|
+
}
|
|
499
|
+
if (journal.planDigest !== options.expectedPlanDigest) {
|
|
500
|
+
throw new Error(`Catalog ${context.catalogVersion} plan does not match the authorized digest. Increase the Catalog version for a different plan.`);
|
|
501
|
+
}
|
|
502
|
+
assertLiveContextMatchesDescriptor(context, journal.descriptor);
|
|
503
|
+
if (journal.state === 'published') {
|
|
504
|
+
const state = await remoteRefState(context.repoRoot, context.pushUrl, context.branchRef, context.tagRef, context.env);
|
|
505
|
+
if (state.branchCommit !== journal.expectedCommit || !state.tagAnnotated || state.tagCommit !== journal.expectedCommit) {
|
|
506
|
+
throw new Error(`Catalog ${context.catalogVersion} published journal conflicts with remote refs. Increase the Catalog version.`);
|
|
507
|
+
}
|
|
508
|
+
if (await fs.pathExists(repositoryPath)) {
|
|
509
|
+
try {
|
|
510
|
+
await validatePersistentRepository(repositoryPath, {
|
|
511
|
+
schemaVersion: 1,
|
|
512
|
+
state: 'prepared',
|
|
513
|
+
planDigest: journal.planDigest,
|
|
514
|
+
descriptor: journal.descriptor,
|
|
515
|
+
expectedCommit: journal.expectedCommit,
|
|
516
|
+
repository: catalogPublicationRepositoryName(context.catalogVersion),
|
|
517
|
+
display: journal.display,
|
|
518
|
+
preparedAt: journal.preparedAt,
|
|
519
|
+
}, context.env);
|
|
520
|
+
await fs.remove(repositoryPath);
|
|
521
|
+
}
|
|
522
|
+
catch {
|
|
523
|
+
// Published remote refs are authoritative. Leave unrecognized local residue for safe manual cleanup.
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
return {
|
|
527
|
+
command: 'catalog:publish:apply',
|
|
528
|
+
state: 'published',
|
|
529
|
+
commit: journal.expectedCommit,
|
|
530
|
+
reconciliation: 'already-published',
|
|
531
|
+
...receiptBase(context, journal, options),
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
await validatePersistentRepository(repositoryPath, journal, context.env);
|
|
535
|
+
let state = await remoteRefState(repositoryPath, context.pushUrl, context.branchRef, context.tagRef, context.env);
|
|
536
|
+
assertReconciliableRemoteState(state, journal);
|
|
537
|
+
let reconciliation;
|
|
538
|
+
const branchAtExpected = state.branchCommit === journal.expectedCommit;
|
|
539
|
+
const tagAtExpected = state.tagAnnotated && state.tagCommit === journal.expectedCommit;
|
|
540
|
+
if (branchAtExpected && tagAtExpected) {
|
|
541
|
+
reconciliation = 'already-remote';
|
|
542
|
+
}
|
|
543
|
+
else {
|
|
544
|
+
await options.beforeRemoteWrite?.();
|
|
545
|
+
const writeContext = await inspectCatalogPublicationLiveContext(options);
|
|
546
|
+
assertLiveContextMatchesDescriptor(writeContext, journal.descriptor);
|
|
547
|
+
await validatePersistentRepository(repositoryPath, journal, writeContext.env);
|
|
548
|
+
state = await remoteRefState(repositoryPath, writeContext.pushUrl, writeContext.branchRef, writeContext.tagRef, writeContext.env);
|
|
549
|
+
assertReconciliableRemoteState(state, journal);
|
|
550
|
+
try {
|
|
551
|
+
if (state.branchCommit === journal.expectedCommit
|
|
552
|
+
&& state.tagAnnotated
|
|
553
|
+
&& state.tagCommit === journal.expectedCommit) {
|
|
554
|
+
reconciliation = 'already-remote';
|
|
555
|
+
}
|
|
556
|
+
else if (state.branchCommit === journal.descriptor.parent && !state.tagPresent) {
|
|
557
|
+
reconciliation = 'atomic';
|
|
558
|
+
await publicationGit(repositoryPath, [
|
|
559
|
+
'push', '--atomic',
|
|
560
|
+
`--force-with-lease=${writeContext.branchRef}:${journal.descriptor.parent ?? ''}`,
|
|
561
|
+
writeContext.pushUrl,
|
|
562
|
+
`${journal.expectedCommit}:${writeContext.branchRef}`,
|
|
563
|
+
`${writeContext.tagRef}:${writeContext.tagRef}`,
|
|
564
|
+
], writeContext.env, 'publicationUncertain', 'Catalog atomic push failed or its result is uncertain.');
|
|
565
|
+
}
|
|
566
|
+
else if (state.branchCommit === journal.expectedCommit && !state.tagPresent) {
|
|
567
|
+
reconciliation = 'tag';
|
|
568
|
+
await publicationGit(repositoryPath, [
|
|
569
|
+
'push', writeContext.pushUrl, `${writeContext.tagRef}:${writeContext.tagRef}`,
|
|
570
|
+
], writeContext.env, 'publicationUncertain', 'Catalog tag push failed or its result is uncertain.');
|
|
571
|
+
}
|
|
572
|
+
else {
|
|
573
|
+
reconciliation = 'branch';
|
|
574
|
+
await publicationGit(repositoryPath, [
|
|
575
|
+
'push', `--force-with-lease=${writeContext.branchRef}:${journal.descriptor.parent ?? ''}`,
|
|
576
|
+
writeContext.pushUrl, `${journal.expectedCommit}:${writeContext.branchRef}`,
|
|
577
|
+
], writeContext.env, 'publicationUncertain', 'Catalog branch push failed or its result is uncertain.');
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
catch (error) {
|
|
581
|
+
journal = await markUncertain(journalPath, journal);
|
|
582
|
+
throw new Error(`Catalog ${context.catalogVersion} publication result is uncertain. Retry apply with the same plan digest.`, { cause: error });
|
|
583
|
+
}
|
|
584
|
+
try {
|
|
585
|
+
state = await remoteRefState(repositoryPath, context.pushUrl, context.branchRef, context.tagRef, context.env);
|
|
586
|
+
}
|
|
587
|
+
catch (error) {
|
|
588
|
+
journal = await markUncertain(journalPath, journal);
|
|
589
|
+
throw new Error(`Catalog ${context.catalogVersion} publication result is uncertain. Retry apply with the same plan digest.`, { cause: error });
|
|
590
|
+
}
|
|
591
|
+
if (state.branchCommit !== journal.expectedCommit || !state.tagAnnotated || state.tagCommit !== journal.expectedCommit) {
|
|
592
|
+
journal = await markUncertain(journalPath, journal);
|
|
593
|
+
throw new Error(`Catalog ${context.catalogVersion} publication result is uncertain. Retry apply with the same plan digest.`);
|
|
594
|
+
}
|
|
211
595
|
}
|
|
212
|
-
|
|
213
|
-
|
|
596
|
+
const published = {
|
|
597
|
+
schemaVersion: 1,
|
|
214
598
|
state: 'published',
|
|
215
|
-
|
|
599
|
+
planDigest: journal.planDigest,
|
|
600
|
+
descriptor: journal.descriptor,
|
|
601
|
+
expectedCommit: journal.expectedCommit,
|
|
602
|
+
repository: null,
|
|
603
|
+
display: journal.display,
|
|
604
|
+
preparedAt: journal.preparedAt,
|
|
216
605
|
publishedAt: new Date().toISOString(),
|
|
217
|
-
}
|
|
606
|
+
};
|
|
607
|
+
await writeCatalogPublicationJournalAtomic(journalPath, published);
|
|
608
|
+
await fs.remove(repositoryPath);
|
|
218
609
|
return {
|
|
219
|
-
command: 'catalog:publish',
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
remote,
|
|
225
|
-
remoteUrl: safeFetchUrl,
|
|
226
|
-
fetchUrl: safeFetchUrl,
|
|
227
|
-
pushUrl: safePushUrl,
|
|
228
|
-
branch,
|
|
229
|
-
parent,
|
|
230
|
-
tag,
|
|
231
|
-
commit,
|
|
232
|
-
sourceHead,
|
|
233
|
-
pluginCount: descriptor.pluginNames.length,
|
|
234
|
-
snapshotDigest: descriptor.snapshotDigest,
|
|
235
|
-
planId: descriptor.planId,
|
|
236
|
-
descriptorDigest: catalogPublicationDescriptorDigest(descriptor),
|
|
610
|
+
command: 'catalog:publish:apply',
|
|
611
|
+
state: 'published',
|
|
612
|
+
commit: published.expectedCommit,
|
|
613
|
+
reconciliation,
|
|
614
|
+
...receiptBase(context, published, options),
|
|
237
615
|
};
|
|
238
616
|
}
|
|
239
|
-
export async function
|
|
240
|
-
const
|
|
241
|
-
|
|
617
|
+
export async function runCatalogPublishPlanCommand(options) {
|
|
618
|
+
const workspace = await resolveCatalogWorkspaceRoot({
|
|
619
|
+
cwd: options.cwd,
|
|
620
|
+
...(options.workspaceRoot === undefined ? {} : { explicitRoot: options.workspaceRoot }),
|
|
621
|
+
mode: 'existing',
|
|
622
|
+
});
|
|
623
|
+
const target = await resolveCatalogPublicationTarget({
|
|
624
|
+
workspaceRoot: workspace.workspaceRoot,
|
|
242
625
|
remote: options.remote,
|
|
243
|
-
remoteUrl: options.remoteUrl,
|
|
244
626
|
branch: options.branch,
|
|
245
627
|
env: options.env,
|
|
246
|
-
|
|
628
|
+
requireRemote: true,
|
|
629
|
+
});
|
|
630
|
+
return prepareCatalogPublicationPlan({
|
|
631
|
+
workspaceRoot: workspace.workspaceRoot,
|
|
632
|
+
remote: target.remote,
|
|
633
|
+
branch: target.branch,
|
|
634
|
+
env: options.env,
|
|
635
|
+
workspaceRootResolvedFrom: workspace.workspaceRootResolvedFrom,
|
|
636
|
+
remoteResolvedFrom: target.remoteResolvedFrom,
|
|
637
|
+
branchResolvedFrom: target.branchResolvedFrom,
|
|
247
638
|
});
|
|
248
|
-
try {
|
|
249
|
-
return await publishCatalogPublicationPreparation({
|
|
250
|
-
preparation: inspection,
|
|
251
|
-
descriptor: options.descriptor,
|
|
252
|
-
snapshotRoot: options.snapshotRoot,
|
|
253
|
-
beforeRemoteWrite: options.beforeRemoteWrite,
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
finally {
|
|
257
|
-
await disposeCatalogPublicationInspection(inspection);
|
|
258
|
-
}
|
|
259
639
|
}
|
|
260
|
-
export async function
|
|
640
|
+
export async function runCatalogPublishApplyCommand(options) {
|
|
261
641
|
if (options.json && !options.yes)
|
|
262
|
-
throw new Error('Catalog publish with --json requires --yes.');
|
|
642
|
+
throw new Error('Catalog publish apply with --json requires --yes.');
|
|
263
643
|
if (!options.interactive && !options.yes)
|
|
264
|
-
throw new Error('Non-interactive Catalog publish requires --yes.');
|
|
265
|
-
if (!/^sha256:[0-9a-f]{64}$/u.test(options.
|
|
266
|
-
throw new Error('Catalog publish requires --expected-
|
|
644
|
+
throw new Error('Non-interactive Catalog publish apply requires --yes.');
|
|
645
|
+
if (!/^sha256:[0-9a-f]{64}$/u.test(options.expectedPlanDigest ?? '')) {
|
|
646
|
+
throw new Error('Catalog publish apply requires --expected-plan-digest from catalog publish plan.');
|
|
267
647
|
}
|
|
268
|
-
const
|
|
269
|
-
|
|
270
|
-
|
|
648
|
+
const workspace = await resolveCatalogWorkspaceRoot({
|
|
649
|
+
cwd: options.cwd,
|
|
650
|
+
...(options.workspaceRoot === undefined ? {} : { explicitRoot: options.workspaceRoot }),
|
|
651
|
+
mode: 'existing',
|
|
271
652
|
});
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
`Branch: ${inspection.branchRef}`,
|
|
289
|
-
`Parent: ${inspection.parent ?? '<root>'}`,
|
|
290
|
-
`Tag: ${inspection.tagRef}`,
|
|
291
|
-
`Snapshot digest: ${inspection.descriptor.snapshotDigest}`,
|
|
292
|
-
`Plan ID: ${inspection.descriptor.planId}`,
|
|
293
|
-
`Descriptor digest: ${preparedDescriptorDigest}`,
|
|
294
|
-
`Plugins: ${inspection.descriptor.pluginNames.length}`,
|
|
295
|
-
'One atomic push will publish the branch and annotated tag.',
|
|
296
|
-
].join('\n') + '\n');
|
|
297
|
-
if (!options.confirm || !(await options.confirm('Publish this Catalog snapshot?'))) {
|
|
298
|
-
options.io.stderr('Catalog publication cancelled.\n');
|
|
299
|
-
return null;
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
return await publishCatalogPublicationPreparation({
|
|
303
|
-
preparation: inspection,
|
|
304
|
-
descriptor: inspection.descriptor,
|
|
305
|
-
snapshotRoot: inspection.prepared.outputRoot,
|
|
653
|
+
const target = await resolveCatalogPublicationTarget({
|
|
654
|
+
workspaceRoot: workspace.workspaceRoot,
|
|
655
|
+
remote: options.remote,
|
|
656
|
+
branch: options.branch,
|
|
657
|
+
env: options.env,
|
|
658
|
+
requireRemote: true,
|
|
659
|
+
});
|
|
660
|
+
if (!options.yes) {
|
|
661
|
+
const plan = await prepareCatalogPublicationPlan({
|
|
662
|
+
workspaceRoot: workspace.workspaceRoot,
|
|
663
|
+
remote: target.remote,
|
|
664
|
+
branch: target.branch,
|
|
665
|
+
env: options.env,
|
|
666
|
+
workspaceRootResolvedFrom: workspace.workspaceRootResolvedFrom,
|
|
667
|
+
remoteResolvedFrom: target.remoteResolvedFrom,
|
|
668
|
+
branchResolvedFrom: target.branchResolvedFrom,
|
|
306
669
|
});
|
|
670
|
+
options.io.stderr([
|
|
671
|
+
`Workspace identity: ${plan.workspaceIdentity}`,
|
|
672
|
+
`Source HEAD: ${plan.sourceHead}`,
|
|
673
|
+
`Remote: ${plan.remote}`,
|
|
674
|
+
`Fetch URL: ${plan.fetchUrl}`,
|
|
675
|
+
`Push URL: ${plan.pushUrl}`,
|
|
676
|
+
`Branch: refs/heads/${plan.branch}`,
|
|
677
|
+
`Parent: ${plan.parent ?? '<root>'}`,
|
|
678
|
+
`Tag: refs/tags/${plan.tag}`,
|
|
679
|
+
`Snapshot digest: ${plan.snapshotDigest}`,
|
|
680
|
+
`Expected commit: ${plan.expectedCommit}`,
|
|
681
|
+
`Plan digest: ${plan.planDigest}`,
|
|
682
|
+
].join('\n') + '\n');
|
|
683
|
+
if (!options.confirm || !(await options.confirm('Apply this Catalog publication plan?'))) {
|
|
684
|
+
options.io.stderr('Catalog publication cancelled.\n');
|
|
685
|
+
return null;
|
|
686
|
+
}
|
|
307
687
|
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
}
|
|
688
|
+
return applyCatalogPublicationPlan({
|
|
689
|
+
workspaceRoot: workspace.workspaceRoot,
|
|
690
|
+
remote: target.remote,
|
|
691
|
+
branch: target.branch,
|
|
692
|
+
expectedPlanDigest: options.expectedPlanDigest,
|
|
693
|
+
env: options.env,
|
|
694
|
+
workspaceRootResolvedFrom: workspace.workspaceRootResolvedFrom,
|
|
695
|
+
remoteResolvedFrom: target.remoteResolvedFrom,
|
|
696
|
+
branchResolvedFrom: target.branchResolvedFrom,
|
|
697
|
+
});
|
|
318
698
|
}
|
|
319
699
|
//# sourceMappingURL=catalog-publish.js.map
|