@lesliechan721/aw 0.1.0-beta.8 → 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 +4 -4
- 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/remove-plugin.mjs +1 -1
- package/dist/authoring/scripts/remove-plugin.mjs.map +1 -1
- package/dist/authoring/scripts/validate-plugin.mjs +34 -778
- 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 +5 -6
- package/dist/scripts/plugin-staging.js +12 -13
- package/dist/scripts/plugin-staging.js.map +1 -1
- package/dist/src/authoring/workspace-commands.d.ts +2 -1
- package/dist/src/authoring/workspace-commands.js.map +1 -1
- package/dist/src/commands/aw-capabilities.d.ts +2 -2
- package/dist/src/commands/aw-capabilities.js +6 -11
- package/dist/src/commands/aw-capabilities.js.map +1 -1
- package/dist/src/commands/catalog-dev-source.d.ts +18 -12
- package/dist/src/commands/catalog-dev-source.js +241 -305
- package/dist/src/commands/catalog-dev-source.js.map +1 -1
- package/dist/src/commands/catalog-generation.d.ts +6 -19
- package/dist/src/commands/catalog-generation.js +10 -11
- package/dist/src/commands/catalog-generation.js.map +1 -1
- package/dist/src/commands/catalog-publication-inspection.d.ts +28 -27
- package/dist/src/commands/catalog-publication-inspection.js +139 -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 +2 -1
- package/dist/src/commands/catalog-publication-target.js +37 -2
- package/dist/src/commands/catalog-publication-target.js.map +1 -1
- package/dist/src/commands/catalog-publish.d.ts +51 -15
- package/dist/src/commands/catalog-publish.js +576 -219
- package/dist/src/commands/catalog-publish.js.map +1 -1
- package/dist/src/commands/catalog-source.d.ts +3 -28
- package/dist/src/commands/catalog-source.js +29 -140
- package/dist/src/commands/catalog-source.js.map +1 -1
- package/dist/src/commands/catalog-status.d.ts +6 -26
- package/dist/src/commands/catalog-status.js +8 -146
- 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 +20 -0
- package/dist/src/commands/offline-cleanup-evidence.js +87 -9
- package/dist/src/commands/offline-cleanup-evidence.js.map +1 -1
- package/dist/src/commands/options.d.ts +6 -1
- package/dist/src/commands/options.js +64 -6
- package/dist/src/commands/options.js.map +1 -1
- package/dist/src/commands/plugin-capabilities.js +4 -0
- package/dist/src/commands/plugin-capabilities.js.map +1 -1
- package/dist/src/commands/rebuild-command.d.ts +10 -8
- package/dist/src/commands/rebuild-command.js +1217 -426
- package/dist/src/commands/rebuild-command.js.map +1 -1
- package/dist/src/commands/rebuild-integration.d.ts +54 -6
- package/dist/src/commands/rebuild-integration.js +691 -364
- package/dist/src/commands/rebuild-integration.js.map +1 -1
- package/dist/src/commands/rebuild-operations.d.ts +2 -0
- package/dist/src/commands/rebuild-operations.js +31 -17
- package/dist/src/commands/rebuild-operations.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-v5.d.ts → status-v6.d.ts} +59 -26
- package/dist/src/commands/{status-v5.js → status-v6.js} +882 -79
- 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/write-commands.js +1 -43
- package/dist/src/commands/write-commands.js.map +1 -1
- package/dist/src/constants.d.ts +5 -4
- package/dist/src/constants.js +5 -4
- 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 +123 -55
- package/dist/src/generators/local-plugin.js.map +1 -1
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +412 -152
- 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 -11
- package/dist/src/portable/commands.d.ts +2 -2
- package/dist/src/portable/commands.js +2 -8
- package/dist/src/portable/commands.js.map +1 -1
- package/dist/src/portable/materializer.d.ts +1 -4
- package/dist/src/portable/materializer.js +0 -2
- package/dist/src/portable/materializer.js.map +1 -1
- package/dist/src/tui/catalog-generation.d.ts +20 -41
- package/dist/src/tui/catalog-generation.js +65 -224
- package/dist/src/tui/catalog-generation.js.map +1 -1
- package/dist/src/tui/components.js +1 -2
- package/dist/src/tui/components.js.map +1 -1
- package/dist/src/tui/console-app-v4.js +461 -330
- package/dist/src/tui/console-app-v4.js.map +1 -1
- package/dist/src/tui/controller-runtime.d.ts +3 -5
- package/dist/src/tui/controller-runtime.js +182 -187
- package/dist/src/tui/controller-runtime.js.map +1 -1
- package/dist/src/tui/controller.d.ts +42 -45
- package/dist/src/tui/controller.js +454 -407
- 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 -1
- package/dist/src/tui/index.js +1 -1
- package/dist/src/tui/index.js.map +1 -1
- package/dist/src/tui/model.d.ts +81 -13
- package/dist/src/tui/model.js +378 -95
- package/dist/src/tui/model.js.map +1 -1
- package/dist/src/tui/router.d.ts +9 -0
- package/dist/src/tui/router.js.map +1 -1
- package/dist/src/types.d.ts +54 -47
- package/dist/src/types.js.map +1 -1
- package/dist/src/utils/agent-version.d.ts +4 -1
- package/dist/src/utils/agent-version.js +28 -3
- package/dist/src/utils/agent-version.js.map +1 -1
- package/dist/src/utils/catalog-digests.d.ts +7 -0
- package/dist/src/utils/catalog-digests.js +27 -0
- 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 +2 -1
- package/dist/src/utils/catalog-generation-error.js +12 -0
- package/dist/src/utils/catalog-generation-error.js.map +1 -1
- package/dist/src/utils/catalog-generation-resolver.d.ts +10 -3
- package/dist/src/utils/catalog-generation-resolver.js +90 -76
- package/dist/src/utils/catalog-generation-resolver.js.map +1 -1
- package/dist/src/utils/catalog-generation-service.d.ts +24 -33
- package/dist/src/utils/catalog-generation-service.js +253 -567
- package/dist/src/utils/catalog-generation-service.js.map +1 -1
- package/dist/src/utils/catalog-generation-state.d.ts +4 -0
- package/dist/src/utils/catalog-generation-state.js +73 -106
- package/dist/src/utils/catalog-generation-state.js.map +1 -1
- package/dist/src/utils/catalog-generation-store.d.ts +16 -26
- package/dist/src/utils/catalog-generation-store.js +154 -290
- package/dist/src/utils/catalog-generation-store.js.map +1 -1
- package/dist/src/utils/catalog-manifest-v6.d.ts +5 -0
- package/dist/src/utils/{catalog-manifest-v5.js → catalog-manifest-v6.js} +23 -35
- package/dist/src/utils/catalog-manifest-v6.js.map +1 -0
- package/dist/src/utils/catalog-operation-context.d.ts +6 -14
- package/dist/src/utils/catalog-operation-context.js +68 -169
- package/dist/src/utils/catalog-operation-context.js.map +1 -1
- package/dist/src/utils/catalog-public-error.js +1 -4
- 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 +2 -2
- 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.js +25 -9
- 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 +22 -1
- package/dist/src/utils/codex-config.js.map +1 -1
- package/dist/src/utils/codex-manager.d.ts +50 -2
- package/dist/src/utils/codex-manager.js +160 -6
- package/dist/src/utils/codex-manager.js.map +1 -1
- 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-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/git-catalog-provider.js +56 -115
- package/dist/src/utils/git-catalog-provider.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 +1 -10
- package/dist/src/utils/multi-source-catalog.js +8 -175
- package/dist/src/utils/multi-source-catalog.js.map +1 -1
- package/dist/src/utils/native-cli.d.ts +34 -0
- package/dist/src/utils/native-cli.js +91 -0
- package/dist/src/utils/native-cli.js.map +1 -1
- package/dist/src/utils/orphan-marketplace-cleanup.js +1 -0
- package/dist/src/utils/orphan-marketplace-cleanup.js.map +1 -1
- package/dist/src/utils/ownership.d.ts +0 -10
- package/dist/src/utils/ownership.js +3 -88
- 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 +45 -62
- 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 +0 -5
- package/dist/src/utils/plugin-config-write.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/target-eligibility.d.ts +3 -2
- package/dist/src/utils/target-eligibility.js +4 -3
- package/dist/src/utils/target-eligibility.js.map +1 -1
- package/package.json +5 -4
- 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 -91
- package/dist/scripts/codex-eval-app-server.js +0 -1334
- 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 -1589
- 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 -189
- package/dist/scripts/plugin-eval-contract.js +0 -745
- 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/catalog-context.d.ts +0 -52
- package/dist/src/commands/catalog-context.js +0 -156
- package/dist/src/commands/catalog-context.js.map +0 -1
- package/dist/src/commands/status-v5.js.map +0 -1
- package/dist/src/utils/catalog-manifest-v5.d.ts +0 -5
- package/dist/src/utils/catalog-manifest-v5.js.map +0 -1
- package/dist/src/utils/catalog-source-cache.d.ts +0 -62
- package/dist/src/utils/catalog-source-cache.js +0 -321
- 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,42 +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
|
-
import {
|
|
5
|
-
import { disposeCatalogPublicationInspection, parseRemoteRefs, prepareCatalogPublicationInspection, publicationGit, publicationGitExit, } from './catalog-publication-inspection.js';
|
|
5
|
+
import { validatePublishedCatalogSnapshot } from '@lesliechan721/aw-plugin-core';
|
|
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';
|
|
6
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';
|
|
7
11
|
export { safeRemoteIdentity, sanitizedGitEnvironment } from './catalog-publication-inspection.js';
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return JSON.stringify(value);
|
|
19
|
-
}
|
|
20
|
-
export function catalogPublicationDescriptorDigest(descriptor) {
|
|
21
|
-
return digest(canonicalJson(descriptor));
|
|
22
|
-
}
|
|
23
|
-
async function writeJsonAtomic(filePath, value, exclusive) {
|
|
24
|
-
await fs.ensureDir(path.dirname(filePath));
|
|
25
|
-
const temporary = path.join(path.dirname(filePath), `.${path.basename(filePath)}.${crypto.randomUUID()}.tmp`);
|
|
26
|
-
await fs.writeFile(temporary, `${JSON.stringify(value, null, 2)}\n`, { flag: 'wx', mode: 0o600 });
|
|
27
|
-
try {
|
|
28
|
-
if (exclusive) {
|
|
29
|
-
await fs.link(temporary, filePath);
|
|
30
|
-
await fs.remove(temporary);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
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.');
|
|
34
22
|
}
|
|
35
23
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
24
|
+
}
|
|
25
|
+
function sameDescriptor(left, right) {
|
|
26
|
+
return catalogPublicationPlanDigest(left) === catalogPublicationPlanDigest(right);
|
|
40
27
|
}
|
|
41
28
|
async function clearWorktree(repositoryRoot) {
|
|
42
29
|
for (const name of await fs.readdir(repositoryRoot)) {
|
|
@@ -54,46 +41,45 @@ async function assertNoGitAttributes(root, relative = '') {
|
|
|
54
41
|
await assertNoGitAttributes(root, child);
|
|
55
42
|
}
|
|
56
43
|
}
|
|
57
|
-
async function assertSnapshotBinding(snapshotRoot, descriptor) {
|
|
58
|
-
const [stats, validation
|
|
44
|
+
async function assertSnapshotBinding(snapshotRoot, descriptor, display) {
|
|
45
|
+
const [stats, validation] = await Promise.all([
|
|
59
46
|
fs.lstat(snapshotRoot),
|
|
60
47
|
validatePublishedCatalogSnapshot(snapshotRoot),
|
|
61
|
-
fs.readFile(path.join(snapshotRoot, 'plugin-release-ledger.json')),
|
|
62
48
|
]);
|
|
63
49
|
if (!stats.isDirectory() || stats.isSymbolicLink()) {
|
|
64
50
|
throw new Error('Prepared Catalog snapshot must be a regular local directory.');
|
|
65
51
|
}
|
|
66
52
|
const release = validation.manifest.release;
|
|
67
|
-
if (validation.manifest.catalogVersion !==
|
|
68
|
-
|| validation.manifest.channel !==
|
|
53
|
+
if (validation.manifest.catalogVersion !== display.catalogVersion
|
|
54
|
+
|| validation.manifest.channel !== display.channel
|
|
55
|
+
|| validation.manifest.entries.length !== display.pluginCount
|
|
69
56
|
|| validation.snapshotDigest !== descriptor.snapshotDigest
|
|
70
57
|
|| release.state !== 'published'
|
|
71
|
-
|| release.sourceHead !== descriptor.sourceHead
|
|
72
|
-
|
|
73
|
-
|| release.planId !== descriptor.planId
|
|
74
|
-
|| digest(ledgerBytes) !== descriptor.ledgerDigest) {
|
|
75
|
-
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.');
|
|
76
60
|
}
|
|
77
61
|
await assertNoGitAttributes(snapshotRoot);
|
|
78
62
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
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.');
|
|
95
78
|
}
|
|
96
|
-
|
|
79
|
+
}
|
|
80
|
+
async function createPublicationCommit(preparation, descriptor, snapshotRoot, display) {
|
|
81
|
+
const { repositoryRoot, parent, tag, env } = preparation;
|
|
82
|
+
await assertSnapshotBinding(snapshotRoot, descriptor, display);
|
|
97
83
|
if (parent) {
|
|
98
84
|
await publicationGit(repositoryRoot, [
|
|
99
85
|
'checkout', '--quiet', '--detach', 'refs/aw/catalog-parent',
|
|
@@ -106,11 +92,13 @@ async function publishCatalogPublicationPreparation(options) {
|
|
|
106
92
|
}
|
|
107
93
|
await clearWorktree(repositoryRoot);
|
|
108
94
|
await fs.copy(snapshotRoot, repositoryRoot, { dereference: false });
|
|
109
|
-
await publicationGit(repositoryRoot, [
|
|
95
|
+
await publicationGit(repositoryRoot, [
|
|
96
|
+
'add', '--force', '--all',
|
|
97
|
+
], env, 'publicationCommitFailed', 'Could not stage the Catalog publication tree.');
|
|
110
98
|
await publicationGit(repositoryRoot, [
|
|
111
99
|
'-c', 'user.name=AW Catalog Publisher',
|
|
112
100
|
'-c', 'user.email=catalog-publisher@agent-workflows.invalid',
|
|
113
|
-
'commit', '--quiet', '-m', `Catalog ${
|
|
101
|
+
'commit', '--quiet', '-m', `Catalog ${display.catalogVersion}`,
|
|
114
102
|
], env, 'publicationCommitFailed', 'Could not create the Catalog publication commit.');
|
|
115
103
|
const commit = await publicationGit(repositoryRoot, [
|
|
116
104
|
'rev-parse', 'HEAD',
|
|
@@ -123,152 +111,539 @@ async function publishCatalogPublicationPreparation(options) {
|
|
|
123
111
|
if ((parent && (parents.length !== 1 || parents[0] !== parent)) || (!parent && parents.length !== 0)) {
|
|
124
112
|
throw new Error('Catalog publication commit has an invalid parent.');
|
|
125
113
|
}
|
|
126
|
-
const verificationRoot = path.join(temporaryRoot, 'verification');
|
|
114
|
+
const verificationRoot = path.join(preparation.temporaryRoot, 'verification');
|
|
127
115
|
await fs.ensureDir(verificationRoot);
|
|
128
116
|
await publicationGit(repositoryRoot, [
|
|
129
117
|
'--work-tree', verificationRoot, 'checkout', '--quiet', commit, '--', '.',
|
|
130
118
|
], env, 'publicationCommitFailed', 'Could not verify the Catalog publication commit tree.');
|
|
131
|
-
await assertSnapshotBinding(verificationRoot, descriptor);
|
|
119
|
+
await assertSnapshotBinding(verificationRoot, descriptor, display);
|
|
132
120
|
await publicationGit(repositoryRoot, [
|
|
133
121
|
'-c', 'user.name=AW Catalog Publisher',
|
|
134
122
|
'-c', 'user.email=catalog-publisher@agent-workflows.invalid',
|
|
135
|
-
'tag', '--annotate', tag, '--message', `Catalog ${
|
|
123
|
+
'tag', '--annotate', tag, '--message', `Catalog ${display.catalogVersion}`,
|
|
136
124
|
], env, 'publicationCommitFailed', 'Could not create the annotated Catalog tag.');
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
const
|
|
141
|
-
'
|
|
142
|
-
], env, '
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
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.');
|
|
151
173
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
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.'),
|
|
156
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);
|
|
157
297
|
}
|
|
158
|
-
|
|
159
|
-
|
|
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;
|
|
160
342
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
if ((liveRefs.get(branchRef) ?? null) !== parent || liveRefs.has(tagRef) || liveRefs.has(`${tagRef}^{}`)) {
|
|
165
|
-
throw new Error('Catalog remote changed during preparation. Increase the Catalog version before publishing again.');
|
|
343
|
+
assertLiveContextMatchesDescriptor(context, journal.descriptor);
|
|
344
|
+
if (journal.state !== 'published') {
|
|
345
|
+
await validatePersistentRepository(repositoryPath, journal, context.env);
|
|
166
346
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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.`);
|
|
170
353
|
}
|
|
171
|
-
|
|
172
|
-
|
|
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.');
|
|
366
|
+
}
|
|
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.');
|
|
372
|
+
}
|
|
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.`);
|
|
375
|
+
}
|
|
376
|
+
if (!preparation.tagAvailable) {
|
|
377
|
+
throw new Error(`Remote Catalog tag ${descriptor.tag} already exists. Increase the Catalog version.`);
|
|
378
|
+
}
|
|
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 = {
|
|
173
392
|
schemaVersion: 1,
|
|
174
|
-
state: '
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
tag,
|
|
182
|
-
snapshotDigest: descriptor.snapshotDigest,
|
|
183
|
-
contentDigest: descriptor.contentDigest,
|
|
184
|
-
planId: descriptor.planId,
|
|
185
|
-
descriptorDigest: catalogPublicationDescriptorDigest(descriptor),
|
|
186
|
-
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(),
|
|
187
400
|
};
|
|
401
|
+
await persistRepository(preparation, repositoryPath, journal);
|
|
188
402
|
try {
|
|
189
|
-
await
|
|
403
|
+
await writeCatalogPublicationJournalAtomic(journalPath, journal, true);
|
|
190
404
|
}
|
|
191
405
|
catch (error) {
|
|
192
406
|
if (error.code === 'EEXIST') {
|
|
193
|
-
throw new Error(`Catalog ${
|
|
194
|
-
+ '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.`);
|
|
195
408
|
}
|
|
196
409
|
throw error;
|
|
197
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);
|
|
198
446
|
try {
|
|
199
|
-
await
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
447
|
+
return await persistNewPlan({
|
|
448
|
+
preparation,
|
|
449
|
+
descriptor: preparation.descriptor,
|
|
450
|
+
snapshotRoot: preparation.prepared.outputRoot,
|
|
451
|
+
resolution: options,
|
|
452
|
+
});
|
|
203
453
|
}
|
|
204
|
-
|
|
205
|
-
|
|
454
|
+
finally {
|
|
455
|
+
await disposeCatalogPublicationInspection(preparation);
|
|
456
|
+
}
|
|
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.`);
|
|
206
498
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
], env, 'publicationUncertain', `Catalog publication result is uncertain. Do not retry ${descriptor.catalogVersion}; increase the Catalog version.`));
|
|
210
|
-
if (publishedRefs.get(branchRef) !== commit || publishedRefs.get(`${tagRef}^{}`) !== commit) {
|
|
211
|
-
throw new Error(`Catalog publication result is uncertain. Do not retry ${descriptor.catalogVersion}; run aw catalog version <higher>.`);
|
|
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.`);
|
|
212
501
|
}
|
|
213
|
-
|
|
214
|
-
|
|
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
|
+
}
|
|
595
|
+
}
|
|
596
|
+
const published = {
|
|
597
|
+
schemaVersion: 1,
|
|
215
598
|
state: 'published',
|
|
216
|
-
|
|
599
|
+
planDigest: journal.planDigest,
|
|
600
|
+
descriptor: journal.descriptor,
|
|
601
|
+
expectedCommit: journal.expectedCommit,
|
|
602
|
+
repository: null,
|
|
603
|
+
display: journal.display,
|
|
604
|
+
preparedAt: journal.preparedAt,
|
|
217
605
|
publishedAt: new Date().toISOString(),
|
|
218
|
-
}
|
|
606
|
+
};
|
|
607
|
+
await writeCatalogPublicationJournalAtomic(journalPath, published);
|
|
608
|
+
await fs.remove(repositoryPath);
|
|
219
609
|
return {
|
|
220
|
-
command: 'catalog:publish',
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
catalogVersion: descriptor.catalogVersion,
|
|
226
|
-
channel: descriptor.channel,
|
|
227
|
-
remote,
|
|
228
|
-
remoteResolvedFrom: options.remoteResolvedFrom ?? 'explicit',
|
|
229
|
-
remoteUrl: safeFetchUrl,
|
|
230
|
-
fetchUrl: safeFetchUrl,
|
|
231
|
-
pushUrl: safePushUrl,
|
|
232
|
-
branch,
|
|
233
|
-
branchResolvedFrom: options.branchResolvedFrom ?? 'explicit',
|
|
234
|
-
parent,
|
|
235
|
-
tag,
|
|
236
|
-
commit,
|
|
237
|
-
sourceHead,
|
|
238
|
-
pluginCount: descriptor.pluginNames.length,
|
|
239
|
-
snapshotDigest: descriptor.snapshotDigest,
|
|
240
|
-
planId: descriptor.planId,
|
|
241
|
-
descriptorDigest: catalogPublicationDescriptorDigest(descriptor),
|
|
610
|
+
command: 'catalog:publish:apply',
|
|
611
|
+
state: 'published',
|
|
612
|
+
commit: published.expectedCommit,
|
|
613
|
+
reconciliation,
|
|
614
|
+
...receiptBase(context, published, options),
|
|
242
615
|
};
|
|
243
616
|
}
|
|
244
|
-
export async function
|
|
245
|
-
const
|
|
246
|
-
|
|
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,
|
|
247
625
|
remote: options.remote,
|
|
248
|
-
remoteUrl: options.remoteUrl,
|
|
249
626
|
branch: options.branch,
|
|
250
627
|
env: options.env,
|
|
251
|
-
|
|
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,
|
|
252
638
|
});
|
|
253
|
-
try {
|
|
254
|
-
return await publishCatalogPublicationPreparation({
|
|
255
|
-
preparation: inspection,
|
|
256
|
-
descriptor: options.descriptor,
|
|
257
|
-
snapshotRoot: options.snapshotRoot,
|
|
258
|
-
beforeRemoteWrite: options.beforeRemoteWrite,
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
finally {
|
|
262
|
-
await disposeCatalogPublicationInspection(inspection);
|
|
263
|
-
}
|
|
264
639
|
}
|
|
265
|
-
export async function
|
|
640
|
+
export async function runCatalogPublishApplyCommand(options) {
|
|
266
641
|
if (options.json && !options.yes)
|
|
267
|
-
throw new Error('Catalog publish with --json requires --yes.');
|
|
642
|
+
throw new Error('Catalog publish apply with --json requires --yes.');
|
|
268
643
|
if (!options.interactive && !options.yes)
|
|
269
|
-
throw new Error('Non-interactive Catalog publish requires --yes.');
|
|
270
|
-
if (!/^sha256:[0-9a-f]{64}$/u.test(options.
|
|
271
|
-
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.');
|
|
272
647
|
}
|
|
273
648
|
const workspace = await resolveCatalogWorkspaceRoot({
|
|
274
649
|
cwd: options.cwd,
|
|
@@ -282,61 +657,43 @@ export async function runCatalogPublishCommand(options) {
|
|
|
282
657
|
env: options.env,
|
|
283
658
|
requireRemote: true,
|
|
284
659
|
});
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
});
|
|
292
|
-
try {
|
|
293
|
-
const preparedDescriptorDigest = catalogPublicationDescriptorDigest(inspection.descriptor);
|
|
294
|
-
if (options.expectedDescriptorDigest !== preparedDescriptorDigest) {
|
|
295
|
-
throw new Error('Catalog publication descriptor does not match the authorized preflight. Run preflight and authorize the current exact identity.');
|
|
296
|
-
}
|
|
297
|
-
if (!(await publicationGitExit(inspection.repoRoot, ['check-ignore', '-q', inspection.attemptPath], inspection.env))) {
|
|
298
|
-
throw new Error('Catalog publish state under .aw/publish must be ignored by Git. Add .aw/ to .gitignore.');
|
|
299
|
-
}
|
|
300
|
-
if (!options.yes) {
|
|
301
|
-
options.io.stderr([
|
|
302
|
-
`Workspace identity: ${inspection.descriptor.workspaceIdentity}`,
|
|
303
|
-
`Source HEAD: ${inspection.sourceHead}`,
|
|
304
|
-
`Catalog: ${inspection.descriptor.catalogVersion} (${inspection.descriptor.channel})`,
|
|
305
|
-
`Remote: ${inspection.remote}`,
|
|
306
|
-
`Fetch URL: ${inspection.safeFetchUrl}`,
|
|
307
|
-
`Push URL: ${inspection.safePushUrl}`,
|
|
308
|
-
`Branch: ${inspection.branchRef}`,
|
|
309
|
-
`Parent: ${inspection.parent ?? '<root>'}`,
|
|
310
|
-
`Tag: ${inspection.tagRef}`,
|
|
311
|
-
`Snapshot digest: ${inspection.descriptor.snapshotDigest}`,
|
|
312
|
-
`Plan ID: ${inspection.descriptor.planId}`,
|
|
313
|
-
`Descriptor digest: ${preparedDescriptorDigest}`,
|
|
314
|
-
`Plugins: ${inspection.descriptor.pluginNames.length}`,
|
|
315
|
-
'One atomic push will publish the branch and annotated tag.',
|
|
316
|
-
].join('\n') + '\n');
|
|
317
|
-
if (!options.confirm || !(await options.confirm('Publish this Catalog snapshot?'))) {
|
|
318
|
-
options.io.stderr('Catalog publication cancelled.\n');
|
|
319
|
-
return null;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
return await publishCatalogPublicationPreparation({
|
|
323
|
-
preparation: inspection,
|
|
324
|
-
descriptor: inspection.descriptor,
|
|
325
|
-
snapshotRoot: inspection.prepared.outputRoot,
|
|
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,
|
|
326
666
|
workspaceRootResolvedFrom: workspace.workspaceRootResolvedFrom,
|
|
327
667
|
remoteResolvedFrom: target.remoteResolvedFrom,
|
|
328
668
|
branchResolvedFrom: target.branchResolvedFrom,
|
|
329
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
|
+
}
|
|
330
687
|
}
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
}
|
|
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
|
+
});
|
|
341
698
|
}
|
|
342
699
|
//# sourceMappingURL=catalog-publish.js.map
|