Publish the slim install refs: drop the prepare script, carry LICENSE and NOTICE (v3.2.5)

AI Assisted
This commit is contained in:
jparkerweb committed 2026-12-03 20:36:09 -08:00
1 parent 44434d5264
commit a03b825951
15 files changed
+49 -21

No files matched your search

+2
View File
@@ -57,6 +57,8 @@ export function compactRuntimeFiles(version) {
"install.js": readRepo("install.js"),
"package.json": `${JSON.stringify(pkg, null, 2)}\n`,
"version.json": `${JSON.stringify(versionJson, null, 2)}\n`,
"LICENSE": readRepo("LICENSE"),
"NOTICE": readRepo("NOTICE"),
};
for (const rel of walkFiles(path.join(ROOT, "src"), path.join(ROOT, "src"))) {
+6 -4
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env node
// Publishes the slim install refs of one release: a synthetic commit whose tree
// holds only the runtime payload (install.js, package.json, version.json and
// src/) plus a binding manifest, pushed once as the immutable
// holds only the runtime payload (install.js, package.json, version.json, LICENSE,
// NOTICE and src/) plus a binding manifest, pushed once as the immutable
// `refs/tags/install-vX.Y.Z` and as the new fast-forward tip of
// `refs/heads/release`. Dev-only: lives in scripts/ so it never ships inside a
// skill or the runtime payload it assembles.
@@ -26,7 +26,7 @@ import { fileURLToPath } from "node:url";
export const INSTALL_REF_MANIFEST = ".plan2code-install-ref.json";
// The package scripts that make npm prepare a git dependency with a full dev install (pacote).
const GIT_DEP_LIFECYCLE = new Set(["prepare", "build", "install", "preinstall", "postinstall", "prepack"]);
export const GIT_DEP_LIFECYCLE = new Set(["prepare", "build", "install", "preinstall", "postinstall", "prepack"]);
export const RELEASE_BRANCH_REF = "refs/heads/release";
export const REMOTE = "origin";
const TAG_SHAPE = /^v(\d+\.\d+\.\d+)$/;
@@ -40,7 +40,7 @@ const TAG_SHAPE = /^v(\d+\.\d+\.\d+)$/;
* required on top of these (`workflowSkillSources()`).
*/
export const RUNTIME_PAYLOAD = Object.freeze({
files: Object.freeze(["install.js", "package.json", "version.json"]),
files: Object.freeze(["install.js", "package.json", "version.json", "LICENSE", "NOTICE"]),
prefixes: Object.freeze(["src/"]),
excludedSegments: Object.freeze(["node_modules", ".git", "fixtures", "__fixtures__"]),
forbiddenTopLevel: Object.freeze([
@@ -58,6 +58,8 @@ export const RUNTIME_PAYLOAD = Object.freeze({
"install.js",
"package.json",
"version.json",
"LICENSE",
"NOTICE",
"src/launcher/plan2code.js",
"src/web-console/update-check.mjs",
"src/web-console/console.mjs",
+12 -1
View File
@@ -20,6 +20,7 @@ import { execFileSync, spawnSync } from "node:child_process";
import { ROOT, scrubbedEnv } from "./skill-script-helpers.mjs";
import {
GIT_DEP_LIFECYCLE,
INSTALL_REF_MANIFEST,
RUNTIME_PAYLOAD,
runtimePayloadAllowlist,
@@ -67,6 +68,8 @@ function runtimeTree(version) {
"install.js": { content: INSTALL_JS },
"package.json": { content: json({ name: "plan2code", version }) },
"version.json": { content: json({ name: "Plan2Code", version, releaseDate: "2026-12-01" }) },
"LICENSE": { content: "license\n" },
"NOTICE": { content: "notice\n" },
"src/launcher/plan2code.js": { content: `#!/usr/bin/env node\n// launcher ${version}\n`, mode: "100755" },
"src/web-console/update-check.mjs": { content: `// update-check ${version}\n` },
"src/web-console/console.mjs": { content: `// console ${version}\n` },
@@ -196,7 +199,7 @@ const indexHash = (fx) => crypto.createHash("sha256").update(fs.readFileSync(pat
test("allowlist: one constant-driven structure of explicit files and prefixes", () => {
const allow = runtimePayloadAllowlist();
assert.equal(allow, RUNTIME_PAYLOAD);
assert.deepEqual([...allow.files], ["install.js", "package.json", "version.json"]);
assert.deepEqual([...allow.files], ["install.js", "package.json", "version.json", "LICENSE", "NOTICE"]);
assert.deepEqual([...allow.prefixes], ["src/"]);
assert.ok(Object.isFrozen(allow) && Object.isFrozen(allow.files) && Object.isFrozen(allow.required));
for (const ok of ["install.js", "src/launcher/plan2code.js", "src/web-console/public/activities/snake.js"]) assert.equal(isAllowedPayloadPath(ok), true, ok);
@@ -237,6 +240,14 @@ test("arguments: unknown, missing and malformed arguments print the usage and ex
}
});
test("the real repository can be published: no lifecycle script npm would prepare a git package for, and every required file is here", () => {
const root = ROOT;
const pkg = JSON.parse(fs.readFileSync(path.join(root, "package.json"), "utf8"));
assert.deepEqual(Object.keys(pkg.scripts || {}).filter((name) => GIT_DEP_LIFECYCLE.has(name)), [], "rename the script: the release run refuses it after the release is public");
const required = [...RUNTIME_PAYLOAD.required, ...workflowSkillSources(fs.readFileSync(path.join(root, "install.js"), "utf8"))];
assert.deepEqual(required.filter((rel) => !fs.existsSync(path.join(root, rel))), []);
});
test("first publication: parents the legacy release tip, pushes one slim commit to both refs", (t) => {
const fx = createSource();
t.after(fx.cleanup);