audrey 1.1.3 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +97 -0
- package/README.md +39 -12
- package/dist/mcp-server/codex-hooks-probe.d.ts +22 -0
- package/dist/mcp-server/codex-hooks-probe.d.ts.map +1 -0
- package/dist/mcp-server/codex-hooks-probe.js +160 -0
- package/dist/mcp-server/codex-hooks-probe.js.map +1 -0
- package/dist/mcp-server/config.d.ts +26 -2
- package/dist/mcp-server/config.d.ts.map +1 -1
- package/dist/mcp-server/config.js +54 -22
- package/dist/mcp-server/config.js.map +1 -1
- package/dist/mcp-server/hooks.d.ts +28 -0
- package/dist/mcp-server/hooks.d.ts.map +1 -1
- package/dist/mcp-server/hooks.js +91 -2
- package/dist/mcp-server/hooks.js.map +1 -1
- package/dist/mcp-server/index.d.ts +242 -2
- package/dist/mcp-server/index.d.ts.map +1 -1
- package/dist/mcp-server/index.js +806 -240
- package/dist/mcp-server/index.js.map +1 -1
- package/dist/mcp-server/tool-schemas.d.ts +32 -2
- package/dist/mcp-server/tool-schemas.d.ts.map +1 -1
- package/dist/mcp-server/tool-schemas.js +55 -0
- package/dist/mcp-server/tool-schemas.js.map +1 -1
- package/dist/src/audrey.d.ts +14 -2
- package/dist/src/audrey.d.ts.map +1 -1
- package/dist/src/audrey.js +152 -28
- package/dist/src/audrey.js.map +1 -1
- package/dist/src/autopilot.d.ts +22 -0
- package/dist/src/autopilot.d.ts.map +1 -1
- package/dist/src/autopilot.js +271 -50
- package/dist/src/autopilot.js.map +1 -1
- package/dist/src/capsule.d.ts +23 -0
- package/dist/src/capsule.d.ts.map +1 -1
- package/dist/src/capsule.js +56 -11
- package/dist/src/capsule.js.map +1 -1
- package/dist/src/confidence.d.ts +9 -1
- package/dist/src/confidence.d.ts.map +1 -1
- package/dist/src/confidence.js +16 -2
- package/dist/src/confidence.js.map +1 -1
- package/dist/src/consolidate.d.ts +4 -0
- package/dist/src/consolidate.d.ts.map +1 -1
- package/dist/src/consolidate.js +206 -34
- package/dist/src/consolidate.js.map +1 -1
- package/dist/src/controller.d.ts +17 -1
- package/dist/src/controller.d.ts.map +1 -1
- package/dist/src/controller.js +244 -128
- package/dist/src/controller.js.map +1 -1
- package/dist/src/db.d.ts.map +1 -1
- package/dist/src/db.js +233 -56
- package/dist/src/db.js.map +1 -1
- package/dist/src/encode.d.ts +2 -1
- package/dist/src/encode.d.ts.map +1 -1
- package/dist/src/encode.js +41 -4
- package/dist/src/encode.js.map +1 -1
- package/dist/src/events.d.ts +48 -1
- package/dist/src/events.d.ts.map +1 -1
- package/dist/src/events.js +160 -62
- package/dist/src/events.js.map +1 -1
- package/dist/src/export.d.ts.map +1 -1
- package/dist/src/export.js +4 -4
- package/dist/src/export.js.map +1 -1
- package/dist/src/grounding.d.ts +111 -0
- package/dist/src/grounding.d.ts.map +1 -0
- package/dist/src/grounding.js +259 -0
- package/dist/src/grounding.js.map +1 -0
- package/dist/src/hybrid-recall.d.ts +16 -7
- package/dist/src/hybrid-recall.d.ts.map +1 -1
- package/dist/src/hybrid-recall.js +22 -11
- package/dist/src/hybrid-recall.js.map +1 -1
- package/dist/src/import.d.ts +10 -0
- package/dist/src/import.d.ts.map +1 -1
- package/dist/src/import.js +122 -22
- package/dist/src/import.js.map +1 -1
- package/dist/src/llm.d.ts.map +1 -1
- package/dist/src/llm.js +16 -0
- package/dist/src/llm.js.map +1 -1
- package/dist/src/preflight.d.ts.map +1 -1
- package/dist/src/preflight.js +89 -47
- package/dist/src/preflight.js.map +1 -1
- package/dist/src/project.d.ts +4 -1
- package/dist/src/project.d.ts.map +1 -1
- package/dist/src/project.js +65 -5
- package/dist/src/project.js.map +1 -1
- package/dist/src/recall.d.ts.map +1 -1
- package/dist/src/recall.js +138 -13
- package/dist/src/recall.js.map +1 -1
- package/dist/src/redact.d.ts +1 -1
- package/dist/src/redact.d.ts.map +1 -1
- package/dist/src/redact.js +185 -5
- package/dist/src/redact.js.map +1 -1
- package/dist/src/routes.d.ts.map +1 -1
- package/dist/src/routes.js +91 -18
- package/dist/src/routes.js.map +1 -1
- package/dist/src/trust.d.ts +35 -0
- package/dist/src/trust.d.ts.map +1 -0
- package/dist/src/trust.js +77 -0
- package/dist/src/trust.js.map +1 -0
- package/dist/src/types.d.ts +24 -0
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +3 -37
- package/benchmarks/adapter-kit.mjs +0 -20
- package/benchmarks/adapter-self-test.mjs +0 -170
- package/benchmarks/adapters/example-allow.mjs +0 -31
- package/benchmarks/adapters/mem0-platform.mjs +0 -274
- package/benchmarks/adapters/registry.json +0 -51
- package/benchmarks/adapters/zep-cloud.mjs +0 -304
- package/benchmarks/baselines.js +0 -174
- package/benchmarks/build-leaderboard.mjs +0 -183
- package/benchmarks/cases.js +0 -549
- package/benchmarks/create-conformance-card.mjs +0 -148
- package/benchmarks/create-submission-bundle.mjs +0 -190
- package/benchmarks/dry-run-external-adapters.mjs +0 -177
- package/benchmarks/guardbench.js +0 -1265
- package/benchmarks/output/adapter-self-test/guardbench-adapter-self-test.json +0 -50
- package/benchmarks/output/external/guardbench-external-dry-run.json +0 -69
- package/benchmarks/output/external/guardbench-external-evidence.json +0 -56
- package/benchmarks/output/guardbench-conformance-card.json +0 -63
- package/benchmarks/output/guardbench-manifest.json +0 -414
- package/benchmarks/output/guardbench-raw.json +0 -1279
- package/benchmarks/output/guardbench-summary.json +0 -2123
- package/benchmarks/output/leaderboard/guardbench-leaderboard.json +0 -93
- package/benchmarks/output/leaderboard/guardbench-leaderboard.md +0 -7
- package/benchmarks/output/submission-bundle/guardbench-conformance-card.json +0 -63
- package/benchmarks/output/submission-bundle/guardbench-manifest.json +0 -414
- package/benchmarks/output/submission-bundle/guardbench-raw.json +0 -1279
- package/benchmarks/output/submission-bundle/guardbench-summary.json +0 -2123
- package/benchmarks/output/submission-bundle/schemas/guardbench-adapter-registry.schema.json +0 -69
- package/benchmarks/output/submission-bundle/schemas/guardbench-adapter-self-test.schema.json +0 -156
- package/benchmarks/output/submission-bundle/schemas/guardbench-conformance-card.schema.json +0 -184
- package/benchmarks/output/submission-bundle/schemas/guardbench-external-dry-run.schema.json +0 -74
- package/benchmarks/output/submission-bundle/schemas/guardbench-external-evidence.schema.json +0 -108
- package/benchmarks/output/submission-bundle/schemas/guardbench-external-run.schema.json +0 -160
- package/benchmarks/output/submission-bundle/schemas/guardbench-leaderboard.schema.json +0 -179
- package/benchmarks/output/submission-bundle/schemas/guardbench-manifest.schema.json +0 -213
- package/benchmarks/output/submission-bundle/schemas/guardbench-publication-verification.schema.json +0 -47
- package/benchmarks/output/submission-bundle/schemas/guardbench-raw.schema.json +0 -184
- package/benchmarks/output/submission-bundle/schemas/guardbench-submission-manifest.schema.json +0 -151
- package/benchmarks/output/submission-bundle/schemas/guardbench-summary.schema.json +0 -249
- package/benchmarks/output/submission-bundle/submission-manifest.json +0 -131
- package/benchmarks/output/submission-bundle/validation-report.json +0 -31
- package/benchmarks/output/summary.json +0 -2354
- package/benchmarks/perf-snapshot.js +0 -307
- package/benchmarks/perf.bench.js +0 -169
- package/benchmarks/public-paths.mjs +0 -97
- package/benchmarks/reference-results.js +0 -75
- package/benchmarks/report.js +0 -280
- package/benchmarks/run-external-guardbench.mjs +0 -303
- package/benchmarks/run.js +0 -735
- package/benchmarks/schemas/guardbench-adapter-registry.schema.json +0 -69
- package/benchmarks/schemas/guardbench-adapter-self-test.schema.json +0 -156
- package/benchmarks/schemas/guardbench-conformance-card.schema.json +0 -184
- package/benchmarks/schemas/guardbench-external-dry-run.schema.json +0 -74
- package/benchmarks/schemas/guardbench-external-evidence.schema.json +0 -108
- package/benchmarks/schemas/guardbench-external-run.schema.json +0 -160
- package/benchmarks/schemas/guardbench-leaderboard.schema.json +0 -179
- package/benchmarks/schemas/guardbench-manifest.schema.json +0 -213
- package/benchmarks/schemas/guardbench-publication-verification.schema.json +0 -47
- package/benchmarks/schemas/guardbench-raw.schema.json +0 -184
- package/benchmarks/schemas/guardbench-submission-manifest.schema.json +0 -151
- package/benchmarks/schemas/guardbench-summary.schema.json +0 -249
- package/benchmarks/snapshots/perf-0.22.2.json +0 -123
- package/benchmarks/snapshots/perf-0.23.0.json +0 -123
- package/benchmarks/validate-adapter-module.mjs +0 -107
- package/benchmarks/validate-adapter-registry.mjs +0 -145
- package/benchmarks/validate-adapter-self-test.mjs +0 -96
- package/benchmarks/validate-guardbench-artifacts.mjs +0 -400
- package/benchmarks/verify-external-evidence.mjs +0 -351
- package/benchmarks/verify-publication-artifacts.mjs +0 -309
- package/benchmarks/verify-submission-bundle.mjs +0 -172
- package/docs/AUDREY_PAPER_OUTLINE.md +0 -178
- package/docs/MEMORY_BENCHMARKING.md +0 -59
- package/docs/PRODUCTION_BACKLOG.md +0 -321
- package/docs/assets/audrey-feature-grid.jpg +0 -0
- package/docs/assets/audrey-logo.svg +0 -45
- package/docs/assets/audrey-wordmark.png +0 -0
- package/docs/paper/00-master.md +0 -48
- package/docs/paper/01-introduction.md +0 -27
- package/docs/paper/02-related-work.md +0 -47
- package/docs/paper/03-problem-definition.md +0 -108
- package/docs/paper/04-design.md +0 -164
- package/docs/paper/05-guardbench-spec.md +0 -412
- package/docs/paper/06-implementation.md +0 -115
- package/docs/paper/07-evaluation.md +0 -168
- package/docs/paper/08-discussion-limitations.md +0 -61
- package/docs/paper/09-conclusion.md +0 -11
- package/docs/paper/SUBMISSION_README.md +0 -162
- package/docs/paper/appendix-a-demo-transcript.md +0 -114
- package/docs/paper/arxiv-compile-report.schema.json +0 -116
- package/docs/paper/arxiv-source.schema.json +0 -61
- package/docs/paper/audrey-paper-v1.md +0 -1108
- package/docs/paper/browser-launch-plan.json +0 -209
- package/docs/paper/browser-launch-plan.schema.json +0 -100
- package/docs/paper/browser-launch-results.json +0 -86
- package/docs/paper/browser-launch-results.schema.json +0 -66
- package/docs/paper/claim-register.json +0 -138
- package/docs/paper/claim-register.schema.json +0 -81
- package/docs/paper/evidence-ledger.md +0 -103
- package/docs/paper/output/arxiv/README-arxiv.txt +0 -8
- package/docs/paper/output/arxiv/arxiv-manifest.json +0 -41
- package/docs/paper/output/arxiv/main.tex +0 -951
- package/docs/paper/output/arxiv/references.bib +0 -222
- package/docs/paper/output/arxiv-compile-report.json +0 -24
- package/docs/paper/output/submission-bundle/LICENSE +0 -21
- package/docs/paper/output/submission-bundle/README.md +0 -440
- package/docs/paper/output/submission-bundle/benchmarks/output/adapter-self-test/guardbench-adapter-self-test.json +0 -50
- package/docs/paper/output/submission-bundle/benchmarks/output/external/guardbench-external-dry-run.json +0 -69
- package/docs/paper/output/submission-bundle/benchmarks/output/external/guardbench-external-evidence.json +0 -56
- package/docs/paper/output/submission-bundle/benchmarks/output/guardbench-conformance-card.json +0 -63
- package/docs/paper/output/submission-bundle/benchmarks/output/guardbench-manifest.json +0 -414
- package/docs/paper/output/submission-bundle/benchmarks/output/guardbench-raw.json +0 -1279
- package/docs/paper/output/submission-bundle/benchmarks/output/guardbench-summary.json +0 -2123
- package/docs/paper/output/submission-bundle/benchmarks/output/leaderboard/guardbench-leaderboard.json +0 -93
- package/docs/paper/output/submission-bundle/benchmarks/output/leaderboard/guardbench-leaderboard.md +0 -7
- package/docs/paper/output/submission-bundle/benchmarks/output/submission-bundle/submission-manifest.json +0 -131
- package/docs/paper/output/submission-bundle/benchmarks/output/submission-bundle/validation-report.json +0 -31
- package/docs/paper/output/submission-bundle/benchmarks/output/summary.json +0 -2354
- package/docs/paper/output/submission-bundle/benchmarks/schemas/guardbench-adapter-registry.schema.json +0 -69
- package/docs/paper/output/submission-bundle/benchmarks/schemas/guardbench-adapter-self-test.schema.json +0 -156
- package/docs/paper/output/submission-bundle/benchmarks/schemas/guardbench-conformance-card.schema.json +0 -184
- package/docs/paper/output/submission-bundle/benchmarks/schemas/guardbench-external-dry-run.schema.json +0 -74
- package/docs/paper/output/submission-bundle/benchmarks/schemas/guardbench-external-evidence.schema.json +0 -108
- package/docs/paper/output/submission-bundle/benchmarks/schemas/guardbench-external-run.schema.json +0 -160
- package/docs/paper/output/submission-bundle/benchmarks/schemas/guardbench-leaderboard.schema.json +0 -179
- package/docs/paper/output/submission-bundle/benchmarks/schemas/guardbench-manifest.schema.json +0 -213
- package/docs/paper/output/submission-bundle/benchmarks/schemas/guardbench-publication-verification.schema.json +0 -47
- package/docs/paper/output/submission-bundle/benchmarks/schemas/guardbench-raw.schema.json +0 -184
- package/docs/paper/output/submission-bundle/benchmarks/schemas/guardbench-submission-manifest.schema.json +0 -151
- package/docs/paper/output/submission-bundle/benchmarks/schemas/guardbench-summary.schema.json +0 -249
- package/docs/paper/output/submission-bundle/docs/AUDREY_PAPER_OUTLINE.md +0 -178
- package/docs/paper/output/submission-bundle/docs/paper/00-master.md +0 -48
- package/docs/paper/output/submission-bundle/docs/paper/01-introduction.md +0 -27
- package/docs/paper/output/submission-bundle/docs/paper/02-related-work.md +0 -47
- package/docs/paper/output/submission-bundle/docs/paper/03-problem-definition.md +0 -108
- package/docs/paper/output/submission-bundle/docs/paper/04-design.md +0 -164
- package/docs/paper/output/submission-bundle/docs/paper/05-guardbench-spec.md +0 -412
- package/docs/paper/output/submission-bundle/docs/paper/06-implementation.md +0 -115
- package/docs/paper/output/submission-bundle/docs/paper/07-evaluation.md +0 -168
- package/docs/paper/output/submission-bundle/docs/paper/08-discussion-limitations.md +0 -61
- package/docs/paper/output/submission-bundle/docs/paper/09-conclusion.md +0 -11
- package/docs/paper/output/submission-bundle/docs/paper/SUBMISSION_README.md +0 -162
- package/docs/paper/output/submission-bundle/docs/paper/appendix-a-demo-transcript.md +0 -114
- package/docs/paper/output/submission-bundle/docs/paper/arxiv-compile-report.schema.json +0 -116
- package/docs/paper/output/submission-bundle/docs/paper/arxiv-source.schema.json +0 -61
- package/docs/paper/output/submission-bundle/docs/paper/audrey-paper-v1.md +0 -1108
- package/docs/paper/output/submission-bundle/docs/paper/browser-launch-plan.json +0 -209
- package/docs/paper/output/submission-bundle/docs/paper/browser-launch-plan.schema.json +0 -100
- package/docs/paper/output/submission-bundle/docs/paper/browser-launch-results.json +0 -86
- package/docs/paper/output/submission-bundle/docs/paper/browser-launch-results.schema.json +0 -66
- package/docs/paper/output/submission-bundle/docs/paper/claim-register.json +0 -138
- package/docs/paper/output/submission-bundle/docs/paper/claim-register.schema.json +0 -81
- package/docs/paper/output/submission-bundle/docs/paper/evidence-ledger.md +0 -103
- package/docs/paper/output/submission-bundle/docs/paper/output/arxiv/README-arxiv.txt +0 -8
- package/docs/paper/output/submission-bundle/docs/paper/output/arxiv/arxiv-manifest.json +0 -41
- package/docs/paper/output/submission-bundle/docs/paper/output/arxiv/main.tex +0 -951
- package/docs/paper/output/submission-bundle/docs/paper/output/arxiv/references.bib +0 -222
- package/docs/paper/output/submission-bundle/docs/paper/output/arxiv-compile-report.json +0 -24
- package/docs/paper/output/submission-bundle/docs/paper/paper-submission-bundle.schema.json +0 -70
- package/docs/paper/output/submission-bundle/docs/paper/publication-pack.json +0 -81
- package/docs/paper/output/submission-bundle/docs/paper/publication-pack.schema.json +0 -60
- package/docs/paper/output/submission-bundle/docs/paper/references.bib +0 -222
- package/docs/paper/output/submission-bundle/package.json +0 -235
- package/docs/paper/output/submission-bundle/paper-submission-manifest.json +0 -379
- package/docs/paper/paper-submission-bundle.schema.json +0 -70
- package/docs/paper/publication-pack.json +0 -81
- package/docs/paper/publication-pack.schema.json +0 -60
- package/docs/paper/references.bib +0 -222
- package/scripts/audit-release-completion.mjs +0 -440
- package/scripts/create-arxiv-source.mjs +0 -368
- package/scripts/create-paper-submission-bundle.mjs +0 -214
- package/scripts/finalize-release.mjs +0 -601
- package/scripts/prepare-release-cut.mjs +0 -277
- package/scripts/publish-release-bundle.mjs +0 -252
- package/scripts/publish-release-github-api.mjs +0 -494
- package/scripts/run-vitest.mjs +0 -34
- package/scripts/smoke-cli.js +0 -92
- package/scripts/sync-paper-artifacts.mjs +0 -112
- package/scripts/verify-arxiv-compile.mjs +0 -476
- package/scripts/verify-arxiv-source.mjs +0 -224
- package/scripts/verify-browser-launch-plan.mjs +0 -254
- package/scripts/verify-browser-launch-results.mjs +0 -303
- package/scripts/verify-paper-artifacts.mjs +0 -798
- package/scripts/verify-paper-claims.mjs +0 -254
- package/scripts/verify-paper-submission-bundle.mjs +0 -218
- package/scripts/verify-publication-pack.mjs +0 -210
- package/scripts/verify-python-package.py +0 -201
- package/scripts/verify-release-readiness.mjs +0 -920
|
@@ -1,601 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { spawnSync } from 'node:child_process';
|
|
4
|
-
import { createHash } from 'node:crypto';
|
|
5
|
-
import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
6
|
-
import { dirname, isAbsolute, join, relative, resolve } from 'node:path';
|
|
7
|
-
import { fileURLToPath } from 'node:url';
|
|
8
|
-
|
|
9
|
-
const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
|
10
|
-
const DEFAULT_VERSION = '1.1.1';
|
|
11
|
-
const DEFAULT_ARTIFACT_DIR = '.tmp/release-artifacts';
|
|
12
|
-
const NPM_REGISTRY = 'https://registry.npmjs.org/';
|
|
13
|
-
const RELEASE_COMMANDS = new Set(['git', 'node', 'npm', 'python']);
|
|
14
|
-
const RELEASE_VERSION_PATTERN = /^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/;
|
|
15
|
-
const INHERITED_ENV_KEYS = [
|
|
16
|
-
'PATH',
|
|
17
|
-
'Path',
|
|
18
|
-
'PATHEXT',
|
|
19
|
-
'SystemRoot',
|
|
20
|
-
'SYSTEMROOT',
|
|
21
|
-
'WINDIR',
|
|
22
|
-
'HOME',
|
|
23
|
-
'USERPROFILE',
|
|
24
|
-
'APPDATA',
|
|
25
|
-
'LOCALAPPDATA',
|
|
26
|
-
'TEMP',
|
|
27
|
-
'TMP',
|
|
28
|
-
'NPM_CONFIG_USERCONFIG',
|
|
29
|
-
'NPM_TOKEN',
|
|
30
|
-
'TWINE_USERNAME',
|
|
31
|
-
'TWINE_PASSWORD',
|
|
32
|
-
];
|
|
33
|
-
|
|
34
|
-
function fromRoot(path) {
|
|
35
|
-
return resolve(ROOT, path);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function readJson(path) {
|
|
39
|
-
return JSON.parse(readFileSync(fromRoot(path), 'utf-8'));
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function safeString(value, label) {
|
|
43
|
-
if (typeof value !== 'string' || value.length === 0 || value.includes('\0')) {
|
|
44
|
-
throw new Error(`${label} must be a non-empty string without NUL bytes`);
|
|
45
|
-
}
|
|
46
|
-
return value;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function safeVersion(value) {
|
|
50
|
-
const version = safeString(value, '--version');
|
|
51
|
-
if (!RELEASE_VERSION_PATTERN.test(version)) {
|
|
52
|
-
throw new Error(`Invalid release version: ${version}`);
|
|
53
|
-
}
|
|
54
|
-
return version;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function safeRepoRelativePath(value, label) {
|
|
58
|
-
const raw = safeString(value, label);
|
|
59
|
-
const resolved = fromRoot(raw);
|
|
60
|
-
const rel = relative(ROOT, resolved);
|
|
61
|
-
if (!rel || rel.startsWith('..') || isAbsolute(rel)) {
|
|
62
|
-
throw new Error(`${label} must stay inside the Audrey repository`);
|
|
63
|
-
}
|
|
64
|
-
return rel.replaceAll('\\', '/');
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function normalizeArgs(args) {
|
|
68
|
-
args.version = safeVersion(args.version);
|
|
69
|
-
args.artifactDir = safeRepoRelativePath(args.artifactDir, '--artifact-dir');
|
|
70
|
-
if (args.commitMessage !== null)
|
|
71
|
-
args.commitMessage = safeString(args.commitMessage, '--commit-message');
|
|
72
|
-
if (args.npmOtp !== null) args.npmOtp = safeString(args.npmOtp, '--npm-otp');
|
|
73
|
-
return args;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function releaseEnv(extra = {}) {
|
|
77
|
-
const env = {};
|
|
78
|
-
for (const key of INHERITED_ENV_KEYS) {
|
|
79
|
-
if (process.env[key]) env[key] = process.env[key];
|
|
80
|
-
}
|
|
81
|
-
for (const [key, value] of Object.entries(extra)) {
|
|
82
|
-
env[key] = safeString(String(value), `environment ${key}`);
|
|
83
|
-
}
|
|
84
|
-
return {
|
|
85
|
-
...env,
|
|
86
|
-
GIT_TERMINAL_PROMPT: '0',
|
|
87
|
-
GCM_INTERACTIVE: 'never',
|
|
88
|
-
GIT_ASKPASS: '',
|
|
89
|
-
SSH_ASKPASS: '',
|
|
90
|
-
TWINE_NON_INTERACTIVE: '1',
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function parseArgs(argv = process.argv.slice(2)) {
|
|
95
|
-
const args = {
|
|
96
|
-
version: DEFAULT_VERSION,
|
|
97
|
-
artifactDir: DEFAULT_ARTIFACT_DIR,
|
|
98
|
-
apply: false,
|
|
99
|
-
json: false,
|
|
100
|
-
commit: false,
|
|
101
|
-
tag: false,
|
|
102
|
-
push: false,
|
|
103
|
-
pack: false,
|
|
104
|
-
sourceBundle: false,
|
|
105
|
-
publishNpm: false,
|
|
106
|
-
publishPypi: false,
|
|
107
|
-
npmOtp: null,
|
|
108
|
-
commitMessage: null,
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
for (let i = 0; i < argv.length; i++) {
|
|
112
|
-
const token = argv[i];
|
|
113
|
-
if ((token === '--version' || token === '--target-version') && argv[i + 1])
|
|
114
|
-
args.version = argv[++i];
|
|
115
|
-
else if (token === '--artifact-dir' && argv[i + 1]) args.artifactDir = argv[++i];
|
|
116
|
-
else if (token === '--commit-message' && argv[i + 1]) args.commitMessage = argv[++i];
|
|
117
|
-
else if (token === '--npm-otp' && argv[i + 1]) args.npmOtp = argv[++i];
|
|
118
|
-
else if (token === '--apply') args.apply = true;
|
|
119
|
-
else if (token === '--json') args.json = true;
|
|
120
|
-
else if (token === '--commit') args.commit = true;
|
|
121
|
-
else if (token === '--tag') args.tag = true;
|
|
122
|
-
else if (token === '--push') args.push = true;
|
|
123
|
-
else if (token === '--pack') args.pack = true;
|
|
124
|
-
else if (token === '--source-bundle') args.sourceBundle = true;
|
|
125
|
-
else if (token === '--publish-npm') args.publishNpm = true;
|
|
126
|
-
else if (token === '--publish-pypi') args.publishPypi = true;
|
|
127
|
-
else if (token === '--all') {
|
|
128
|
-
args.commit = true;
|
|
129
|
-
args.tag = true;
|
|
130
|
-
args.push = true;
|
|
131
|
-
args.pack = true;
|
|
132
|
-
args.sourceBundle = true;
|
|
133
|
-
args.publishNpm = true;
|
|
134
|
-
args.publishPypi = true;
|
|
135
|
-
} else if (token === '--help' || token === '-h') args.help = true;
|
|
136
|
-
else throw new Error(`Unknown argument: ${token}`);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
return normalizeArgs(args);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
function usage() {
|
|
143
|
-
return `Usage: node scripts/finalize-release.mjs [options]
|
|
144
|
-
|
|
145
|
-
Options:
|
|
146
|
-
--apply Execute selected release actions. Dry-run by default.
|
|
147
|
-
--version <version> Release version. Default: ${DEFAULT_VERSION}.
|
|
148
|
-
--artifact-dir <path> Local ignored artifact directory. Default: ${DEFAULT_ARTIFACT_DIR}.
|
|
149
|
-
--commit git add + commit the release candidate.
|
|
150
|
-
--tag Create annotated v<version> tag.
|
|
151
|
-
--push Push HEAD and tags to origin/master.
|
|
152
|
-
--pack Create npm tarball and artifact manifest.
|
|
153
|
-
--source-bundle Create ignored Git bundle for external source publication.
|
|
154
|
-
--publish-npm Publish the packaged npm tarball.
|
|
155
|
-
--publish-pypi Upload Python wheel/sdist with twine.
|
|
156
|
-
--npm-otp <code> Optional npm one-time password.
|
|
157
|
-
--commit-message <message> Override the default release commit message.
|
|
158
|
-
--all Commit, tag, push, pack, and publish npm/PyPI.
|
|
159
|
-
--json Print the machine-readable plan/report.
|
|
160
|
-
`;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
function commandFor(command, args) {
|
|
164
|
-
if (!RELEASE_COMMANDS.has(command)) {
|
|
165
|
-
throw new Error(`Unsupported release command: ${command}`);
|
|
166
|
-
}
|
|
167
|
-
const safeArgs = args.map((arg, index) =>
|
|
168
|
-
safeString(String(arg), `${command} argument ${index + 1}`),
|
|
169
|
-
);
|
|
170
|
-
if (process.platform === 'win32' && command === 'npm') {
|
|
171
|
-
return { command: 'cmd.exe', args: ['/d', '/c', 'npm', ...safeArgs] };
|
|
172
|
-
}
|
|
173
|
-
return { command, args: safeArgs };
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
function run(command, args, options = {}) {
|
|
177
|
-
const prepared = commandFor(command, args);
|
|
178
|
-
const result = spawnSync(prepared.command, prepared.args, {
|
|
179
|
-
cwd: ROOT,
|
|
180
|
-
encoding: 'utf-8',
|
|
181
|
-
stdio: options.stdio ?? 'pipe',
|
|
182
|
-
timeout: options.timeout ?? 120_000,
|
|
183
|
-
env: releaseEnv(options.env),
|
|
184
|
-
});
|
|
185
|
-
return {
|
|
186
|
-
command: [command, ...args].join(' '),
|
|
187
|
-
ok: result.status === 0,
|
|
188
|
-
status: result.status,
|
|
189
|
-
stdout: result.stdout?.trim() ?? '',
|
|
190
|
-
stderr: result.stderr?.trim() ?? '',
|
|
191
|
-
error: result.error?.message ?? null,
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
function commandFailure(result) {
|
|
196
|
-
return result.error || result.stderr || result.stdout || `exited ${result.status}`;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
function assertOk(result) {
|
|
200
|
-
if (!result.ok) throw new Error(`${result.command} failed: ${commandFailure(result)}`);
|
|
201
|
-
return result;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
function sha256(path) {
|
|
205
|
-
return createHash('sha256').update(readFileSync(path)).digest('hex');
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
function listArtifacts(artifactDir, version) {
|
|
209
|
-
const files = [];
|
|
210
|
-
const npmTarball = join(artifactDir, `audrey-${version}.tgz`);
|
|
211
|
-
const gitBundle = join(artifactDir, `audrey-${version}.git.bundle`);
|
|
212
|
-
if (existsSync(npmTarball)) files.push(npmTarball);
|
|
213
|
-
if (existsSync(gitBundle)) files.push(gitBundle);
|
|
214
|
-
|
|
215
|
-
const pythonDist = fromRoot('python/dist');
|
|
216
|
-
if (existsSync(pythonDist)) {
|
|
217
|
-
for (const name of readdirSync(pythonDist)) {
|
|
218
|
-
if (name.includes(version) && (name.endsWith('.whl') || name.endsWith('.tar.gz'))) {
|
|
219
|
-
files.push(join(pythonDist, name));
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
return files.map(path => ({
|
|
225
|
-
path: path.startsWith(ROOT)
|
|
226
|
-
? path.slice(ROOT.length + 1).replaceAll('\\', '/')
|
|
227
|
-
: path.replaceAll('\\', '/'),
|
|
228
|
-
sha256: sha256(path),
|
|
229
|
-
bytes: readFileSync(path).byteLength,
|
|
230
|
-
}));
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
function npmTarballPath(artifactDir, version) {
|
|
234
|
-
return join(artifactDir, `audrey-${version}.tgz`);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
function pythonArtifactPaths(version) {
|
|
238
|
-
const dist = fromRoot('python/dist');
|
|
239
|
-
if (!existsSync(dist)) return [];
|
|
240
|
-
return readdirSync(dist)
|
|
241
|
-
.filter(name => name.includes(version) && (name.endsWith('.whl') || name.endsWith('.tar.gz')))
|
|
242
|
-
.map(name => join('python/dist', name));
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
function pypiCredentialEnv() {
|
|
246
|
-
if (process.env.TWINE_PASSWORD) return {};
|
|
247
|
-
const token = process.env.PYPI_API_TOKEN ?? process.env.UV_PUBLISH_TOKEN;
|
|
248
|
-
if (!token) return null;
|
|
249
|
-
return {
|
|
250
|
-
TWINE_USERNAME: process.env.TWINE_USERNAME ?? '__token__',
|
|
251
|
-
TWINE_PASSWORD: token,
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
function selectedActions(args) {
|
|
256
|
-
return [
|
|
257
|
-
args.commit && 'commit',
|
|
258
|
-
args.tag && 'tag',
|
|
259
|
-
args.push && 'push',
|
|
260
|
-
args.pack && 'pack',
|
|
261
|
-
args.sourceBundle && 'source-bundle',
|
|
262
|
-
args.publishNpm && 'publish-npm',
|
|
263
|
-
args.publishPypi && 'publish-pypi',
|
|
264
|
-
].filter(Boolean);
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
function ensurePackageVersion(version) {
|
|
268
|
-
const pkg = readJson('package.json');
|
|
269
|
-
if (pkg.version !== version) {
|
|
270
|
-
throw new Error(`package.json version is ${pkg.version}, expected ${version}`);
|
|
271
|
-
}
|
|
272
|
-
return pkg;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
function buildPlan(args) {
|
|
276
|
-
const pkg = ensurePackageVersion(args.version);
|
|
277
|
-
const tagName = `v${args.version}`;
|
|
278
|
-
const artifactDir = fromRoot(args.artifactDir);
|
|
279
|
-
const commitMessage = args.commitMessage ?? `Release Audrey ${args.version}`;
|
|
280
|
-
const actions = selectedActions(args);
|
|
281
|
-
const commands = [];
|
|
282
|
-
const blockers = [];
|
|
283
|
-
|
|
284
|
-
commands.push('node scripts/verify-release-readiness.mjs --allow-pending --json');
|
|
285
|
-
if (args.commit) commands.push('git add --all', `git commit -m "${commitMessage}"`);
|
|
286
|
-
if (args.tag) commands.push(`git tag -a ${tagName} -m "Audrey ${args.version}"`);
|
|
287
|
-
if (args.push) commands.push(`git push origin HEAD:master --follow-tags`);
|
|
288
|
-
if (args.pack) commands.push(`npm pack --pack-destination ${args.artifactDir}`);
|
|
289
|
-
if (args.sourceBundle)
|
|
290
|
-
commands.push(
|
|
291
|
-
`git bundle create ${args.artifactDir}/audrey-${args.version}.git.bundle refs/heads/master refs/tags/v${args.version}`,
|
|
292
|
-
);
|
|
293
|
-
if (args.publishNpm) {
|
|
294
|
-
const otp = args.npmOtp ? ' --otp <provided>' : '';
|
|
295
|
-
commands.push(
|
|
296
|
-
`npm publish ${args.artifactDir}/audrey-${args.version}.tgz --access public --registry ${NPM_REGISTRY}${otp}`,
|
|
297
|
-
);
|
|
298
|
-
}
|
|
299
|
-
if (args.publishPypi)
|
|
300
|
-
commands.push(`python -m twine upload python/dist/audrey_memory-${args.version}*`);
|
|
301
|
-
|
|
302
|
-
if (actions.length === 0) {
|
|
303
|
-
blockers.push(
|
|
304
|
-
'Select at least one action such as --pack, --source-bundle, --commit, --tag, --push, --publish-npm, or --publish-pypi',
|
|
305
|
-
);
|
|
306
|
-
}
|
|
307
|
-
if (args.publishPypi && !pypiCredentialEnv()) {
|
|
308
|
-
blockers.push('Set TWINE_PASSWORD, PYPI_API_TOKEN, or UV_PUBLISH_TOKEN before --publish-pypi');
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
return {
|
|
312
|
-
schemaVersion: '1.0.0',
|
|
313
|
-
suite: 'Audrey release finalization',
|
|
314
|
-
generatedAt: new Date().toISOString(),
|
|
315
|
-
apply: args.apply,
|
|
316
|
-
version: args.version,
|
|
317
|
-
packageName: pkg.name,
|
|
318
|
-
tagName,
|
|
319
|
-
artifactDir: args.artifactDir,
|
|
320
|
-
actions,
|
|
321
|
-
commands,
|
|
322
|
-
blockers,
|
|
323
|
-
results: [],
|
|
324
|
-
artifacts: listArtifacts(artifactDir, args.version),
|
|
325
|
-
};
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
function runReadiness(plan) {
|
|
329
|
-
const readiness = run(
|
|
330
|
-
'node',
|
|
331
|
-
['scripts/verify-release-readiness.mjs', '--allow-pending', '--json'],
|
|
332
|
-
{ timeout: 180_000 },
|
|
333
|
-
);
|
|
334
|
-
plan.results.push(readiness);
|
|
335
|
-
assertOk(readiness);
|
|
336
|
-
const report = JSON.parse(readiness.stdout);
|
|
337
|
-
if (!report.ok) {
|
|
338
|
-
throw new Error(
|
|
339
|
-
`release readiness failed: ${report.failures?.join('; ') || 'unknown failure'}`,
|
|
340
|
-
);
|
|
341
|
-
}
|
|
342
|
-
plan.readiness = {
|
|
343
|
-
ok: report.ok,
|
|
344
|
-
ready: report.ready,
|
|
345
|
-
blockers: report.blockers ?? [],
|
|
346
|
-
};
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
function gitObjectEnv(timestamp) {
|
|
350
|
-
const objectDir = fromRoot('.tmp/git-object-store');
|
|
351
|
-
const indexFile = fromRoot('.tmp/release.index');
|
|
352
|
-
return {
|
|
353
|
-
GIT_OBJECT_DIRECTORY: objectDir,
|
|
354
|
-
GIT_ALTERNATE_OBJECT_DIRECTORIES: fromRoot('.git/objects'),
|
|
355
|
-
GIT_INDEX_FILE: indexFile,
|
|
356
|
-
GIT_AUTHOR_NAME: 'Tyler Eveland',
|
|
357
|
-
GIT_AUTHOR_EMAIL: 'j.tyler.eveland@gmail.com',
|
|
358
|
-
GIT_COMMITTER_NAME: 'Tyler Eveland',
|
|
359
|
-
GIT_COMMITTER_EMAIL: 'j.tyler.eveland@gmail.com',
|
|
360
|
-
GIT_AUTHOR_DATE: `${timestamp} -0500`,
|
|
361
|
-
GIT_COMMITTER_DATE: `${timestamp} -0500`,
|
|
362
|
-
};
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
function createSourceBundle(args, plan) {
|
|
366
|
-
const objectDir = fromRoot('.tmp/git-object-store');
|
|
367
|
-
const indexFile = fromRoot('.tmp/release.index');
|
|
368
|
-
const gitDir = fromRoot('.tmp/release-gitdir');
|
|
369
|
-
const artifactDir = fromRoot(args.artifactDir);
|
|
370
|
-
const bundlePath = join(artifactDir, `audrey-${args.version}.git.bundle`);
|
|
371
|
-
const headTime = assertOk(run('git', ['show', '-s', '--format=%ct', 'HEAD'])).stdout;
|
|
372
|
-
const timestamp = Number.parseInt(headTime, 10) + 1;
|
|
373
|
-
const env = gitObjectEnv(timestamp);
|
|
374
|
-
|
|
375
|
-
rmSync(objectDir, { recursive: true, force: true });
|
|
376
|
-
rmSync(indexFile, { force: true });
|
|
377
|
-
rmSync(gitDir, { recursive: true, force: true });
|
|
378
|
-
mkdirSync(objectDir, { recursive: true });
|
|
379
|
-
mkdirSync(artifactDir, { recursive: true });
|
|
380
|
-
|
|
381
|
-
for (const result of [
|
|
382
|
-
run('git', ['read-tree', 'HEAD'], { env }),
|
|
383
|
-
run('git', ['add', '--all'], { env }),
|
|
384
|
-
]) {
|
|
385
|
-
plan.results.push(result);
|
|
386
|
-
assertOk(result);
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
const tree = assertOk(run('git', ['write-tree'], { env })).stdout;
|
|
390
|
-
const commit = assertOk(
|
|
391
|
-
run(
|
|
392
|
-
'git',
|
|
393
|
-
[
|
|
394
|
-
'commit-tree',
|
|
395
|
-
tree,
|
|
396
|
-
'-p',
|
|
397
|
-
'HEAD',
|
|
398
|
-
'-m',
|
|
399
|
-
args.commitMessage ?? `Release Audrey ${args.version}`,
|
|
400
|
-
],
|
|
401
|
-
{ env },
|
|
402
|
-
),
|
|
403
|
-
).stdout;
|
|
404
|
-
const tagContent = [
|
|
405
|
-
`object ${commit}`,
|
|
406
|
-
'type commit',
|
|
407
|
-
`tag v${args.version}`,
|
|
408
|
-
`tagger Tyler Eveland <j.tyler.eveland@gmail.com> ${timestamp + 1} -0500`,
|
|
409
|
-
'',
|
|
410
|
-
`Audrey ${args.version}`,
|
|
411
|
-
'',
|
|
412
|
-
].join('\n');
|
|
413
|
-
const tagFile = fromRoot('.tmp/release-tag.txt');
|
|
414
|
-
writeFileSync(tagFile, tagContent, 'utf-8');
|
|
415
|
-
const tag = assertOk(run('git', ['hash-object', '-t', 'tag', '-w', tagFile], { env })).stdout;
|
|
416
|
-
|
|
417
|
-
mkdirSync(join(gitDir, 'refs', 'heads'), { recursive: true });
|
|
418
|
-
mkdirSync(join(gitDir, 'refs', 'tags'), { recursive: true });
|
|
419
|
-
writeFileSync(join(gitDir, 'HEAD'), 'ref: refs/heads/master\n', 'utf-8');
|
|
420
|
-
writeFileSync(
|
|
421
|
-
join(gitDir, 'config'),
|
|
422
|
-
'[core]\n\trepositoryformatversion = 0\n\tfilemode = false\n\tbare = true\n',
|
|
423
|
-
'utf-8',
|
|
424
|
-
);
|
|
425
|
-
writeFileSync(join(gitDir, 'refs', 'heads', 'master'), `${commit}\n`, 'utf-8');
|
|
426
|
-
writeFileSync(join(gitDir, 'refs', 'tags', `v${args.version}`), `${tag}\n`, 'utf-8');
|
|
427
|
-
|
|
428
|
-
const bundle = run(
|
|
429
|
-
'git',
|
|
430
|
-
[
|
|
431
|
-
'--git-dir',
|
|
432
|
-
gitDir,
|
|
433
|
-
'bundle',
|
|
434
|
-
'create',
|
|
435
|
-
bundlePath,
|
|
436
|
-
'refs/heads/master',
|
|
437
|
-
`refs/tags/v${args.version}`,
|
|
438
|
-
],
|
|
439
|
-
{
|
|
440
|
-
env: {
|
|
441
|
-
GIT_OBJECT_DIRECTORY: objectDir,
|
|
442
|
-
GIT_ALTERNATE_OBJECT_DIRECTORIES: fromRoot('.git/objects'),
|
|
443
|
-
},
|
|
444
|
-
timeout: 180_000,
|
|
445
|
-
},
|
|
446
|
-
);
|
|
447
|
-
plan.results.push(bundle);
|
|
448
|
-
assertOk(bundle);
|
|
449
|
-
|
|
450
|
-
const verify = run('git', ['bundle', 'verify', bundlePath], { timeout: 60_000 });
|
|
451
|
-
plan.results.push(verify);
|
|
452
|
-
assertOk(verify);
|
|
453
|
-
|
|
454
|
-
const objectReport = {
|
|
455
|
-
tree,
|
|
456
|
-
commit,
|
|
457
|
-
tag,
|
|
458
|
-
objectDir: '.tmp/git-object-store',
|
|
459
|
-
indexFile: '.tmp/release.index',
|
|
460
|
-
bundle: args.artifactDir.replaceAll('\\', '/') + `/audrey-${args.version}.git.bundle`,
|
|
461
|
-
};
|
|
462
|
-
writeFileSync(
|
|
463
|
-
fromRoot('.tmp/release-git-object-report.json'),
|
|
464
|
-
`${JSON.stringify(objectReport, null, 2)}\n`,
|
|
465
|
-
'utf-8',
|
|
466
|
-
);
|
|
467
|
-
plan.sourceControl = objectReport;
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
function execute(args, plan) {
|
|
471
|
-
const artifactDir = fromRoot(args.artifactDir);
|
|
472
|
-
mkdirSync(artifactDir, { recursive: true });
|
|
473
|
-
runReadiness(plan);
|
|
474
|
-
|
|
475
|
-
if (args.commit) {
|
|
476
|
-
assertOk(run('git', ['add', '--all']));
|
|
477
|
-
const commitMessage = args.commitMessage ?? `Release Audrey ${args.version}`;
|
|
478
|
-
const commit = run('git', ['commit', '-m', commitMessage]);
|
|
479
|
-
plan.results.push(commit);
|
|
480
|
-
assertOk(commit);
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
if (args.tag) {
|
|
484
|
-
const tag = run('git', ['tag', '-a', `v${args.version}`, '-m', `Audrey ${args.version}`]);
|
|
485
|
-
plan.results.push(tag);
|
|
486
|
-
assertOk(tag);
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
if (args.push) {
|
|
490
|
-
const push = run(
|
|
491
|
-
'git',
|
|
492
|
-
[
|
|
493
|
-
'-c',
|
|
494
|
-
'http.sslBackend=openssl',
|
|
495
|
-
'-c',
|
|
496
|
-
'credential.helper=',
|
|
497
|
-
'-c',
|
|
498
|
-
'core.askPass=',
|
|
499
|
-
'push',
|
|
500
|
-
'origin',
|
|
501
|
-
'HEAD:master',
|
|
502
|
-
'--follow-tags',
|
|
503
|
-
],
|
|
504
|
-
{ timeout: 45_000 },
|
|
505
|
-
);
|
|
506
|
-
plan.results.push(push);
|
|
507
|
-
assertOk(push);
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
if (args.pack || args.publishNpm) {
|
|
511
|
-
const pack = run('npm', ['pack', '--pack-destination', args.artifactDir], { timeout: 180_000 });
|
|
512
|
-
plan.results.push(pack);
|
|
513
|
-
assertOk(pack);
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
if (args.sourceBundle) {
|
|
517
|
-
createSourceBundle(args, plan);
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
if (args.publishNpm) {
|
|
521
|
-
const whoami = run('npm', ['whoami', '--registry', NPM_REGISTRY]);
|
|
522
|
-
plan.results.push(whoami);
|
|
523
|
-
assertOk(whoami);
|
|
524
|
-
const publishArgs = [
|
|
525
|
-
'publish',
|
|
526
|
-
npmTarballPath(args.artifactDir, args.version),
|
|
527
|
-
'--access',
|
|
528
|
-
'public',
|
|
529
|
-
'--registry',
|
|
530
|
-
NPM_REGISTRY,
|
|
531
|
-
];
|
|
532
|
-
if (args.npmOtp) publishArgs.push('--otp', args.npmOtp);
|
|
533
|
-
const publish = run('npm', publishArgs, { timeout: 180_000 });
|
|
534
|
-
plan.results.push(publish);
|
|
535
|
-
assertOk(publish);
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
if (args.publishPypi) {
|
|
539
|
-
const uploadEnv = pypiCredentialEnv();
|
|
540
|
-
if (!uploadEnv)
|
|
541
|
-
throw new Error(
|
|
542
|
-
'Missing PyPI credentials: set TWINE_PASSWORD, PYPI_API_TOKEN, or UV_PUBLISH_TOKEN',
|
|
543
|
-
);
|
|
544
|
-
const build = run('npm', ['run', 'python:release:check'], { timeout: 180_000 });
|
|
545
|
-
plan.results.push(build);
|
|
546
|
-
assertOk(build);
|
|
547
|
-
const artifacts = pythonArtifactPaths(args.version);
|
|
548
|
-
if (artifacts.length === 0) throw new Error(`No Python artifacts found for ${args.version}`);
|
|
549
|
-
const upload = run('python', ['-m', 'twine', 'upload', ...artifacts], {
|
|
550
|
-
timeout: 180_000,
|
|
551
|
-
env: uploadEnv,
|
|
552
|
-
});
|
|
553
|
-
plan.results.push(upload);
|
|
554
|
-
assertOk(upload);
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
plan.artifacts = listArtifacts(artifactDir, args.version);
|
|
558
|
-
writeFileSync(
|
|
559
|
-
join(artifactDir, 'release-finalize-report.json'),
|
|
560
|
-
`${JSON.stringify(plan, null, 2)}\n`,
|
|
561
|
-
'utf-8',
|
|
562
|
-
);
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
function printPlan(plan, json) {
|
|
566
|
-
if (json) {
|
|
567
|
-
console.log(JSON.stringify(plan, null, 2));
|
|
568
|
-
return;
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
console.log(`${plan.apply ? 'Ran' : 'Planned'} Audrey ${plan.version} release finalization`);
|
|
572
|
-
console.log(`Actions: ${plan.actions.length ? plan.actions.join(', ') : 'none selected'}`);
|
|
573
|
-
for (const command of plan.commands) console.log(`- ${command}`);
|
|
574
|
-
if (plan.blockers.length) {
|
|
575
|
-
console.log('Blockers:');
|
|
576
|
-
for (const blocker of plan.blockers) console.log(`- ${blocker}`);
|
|
577
|
-
}
|
|
578
|
-
if (plan.artifacts.length) {
|
|
579
|
-
console.log('Artifacts:');
|
|
580
|
-
for (const artifact of plan.artifacts)
|
|
581
|
-
console.log(`- ${artifact.path} sha256=${artifact.sha256}`);
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
async function main() {
|
|
586
|
-
const args = parseArgs();
|
|
587
|
-
if (args.help) {
|
|
588
|
-
console.log(usage());
|
|
589
|
-
return;
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
const plan = buildPlan(args);
|
|
593
|
-
if (args.apply && plan.blockers.length === 0) execute(args, plan);
|
|
594
|
-
printPlan(plan, args.json);
|
|
595
|
-
if (plan.blockers.length) process.exit(1);
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
main().catch(error => {
|
|
599
|
-
console.error(error.message);
|
|
600
|
-
process.exit(1);
|
|
601
|
-
});
|