Clone any viral video with AI agents. Not just a script, the whole workflow: swap the face, the words, the B-roll, ship 100 variants in one command, and get your 100M views.
TypeScript agentic-aiaiai-agentsai-videocompilerdslffmpeggenerative-aillmmarkup-languagemonorepoplugin-systemprogramming-languagetext-to-videotypescriptvideovideo-automationvideo-clonevideo-editingvideo-generation
build: preflight the complete npm release
kashorin43b54eadfead
diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.ymlindex 693e7543..a547c0d7 100644--- a/.github/workflows/publish-npm.yml+++ b/.github/workflows/publish-npm.yml@@ -93,7 +93,7 @@ jobs:with:name: npm-packagepath: release- - name: Publish dependencies first and the Distribution last+ - name: Preflight every package, then publish dependencies first and the Distribution lastrun: node scripts/publish-release-candidate.mjs release/release-plan.jsonrelease-assets:diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 27284ff0..baff2361 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -72,20 +72,30 @@ diagnostics, and prepares the browser in an isolated cache. It uses a separate Hand retains the temporary project on failure. The `npm package execution` workflow runs this on PRsand is reused by publication; publication uploads the same tarball that was installed and executed.-For a formal release, use the existing GitHub Release workflow. Commit the next stable npm version-in `package.json` to `main`. Open+For a formal release, use the existing GitHub workflows. Commit the next stable npm version in+`package.json` to `main`, then first run **Actions → Publish npm → Run workflow** on `main` with+that version and **Publish to npm** unchecked. This exercises the complete immutable candidate on+Linux and Windows and retains it as a downloadable artifact without changing npm. After that exact+commit succeeds, open**Releases → Draft a new release**, choose that commit with tag `v<version>` (for example `v0.1.8`),write the release notes, and publish the Release. The tagged commit must contain this workflow.`Publish npm` verifies the tag/version match and that the commit belongs to main's history, runs-Linux/Windows checks, builds and checks the packaged CLI, then publishes to npm as `latest` and-attaches the tarball to the Release. Checks and packaging use the triggering commit, even if main-advances meanwhile. This path supports stable releases, not prereleases.+Linux/Windows checks, builds and checks the packaged CLI, preflights every package in the release+plan against npm, then publishes dependencies first and the Distribution last as `latest` and+attaches the tarball to the Release. No npm write occurs unless every check, package installation and+registry preflight succeeds. Checks and packaging use the triggering commit, even if main advances+meanwhile. This path supports stable releases, not prereleases.**Actions → Publish npm → Run workflow** on `main` remains available: enter the committed versionand leave **Publish to npm** unchecked for checks and downloadable packaging only; check it for amanual npm publication. To finish a failed Release publication, fix the external problem and rerun-that Release's workflow. If code must change, prepare a new version and Release. An existing npm-version is skipped without changing `latest`; an existing Release attachment is retained.+that Release's workflow. A failed check or package preflight does not consume the npm version. If no+package from the candidate reached npm, the Release and tag may be withdrawn, the code fixed while+retaining the intended version, and the complete candidate validated again. If publication stops+after some independent packages, rerun the same immutable candidate: matching versions are skipped+and publication resumes in dependency order. Only after the root Distribution version exists on npm+does a root code change require a new patch version; a failed asset upload or other external step can+still be rerun without one. An existing Release attachment is retained.Pushing main, pushing a tag alone, or saving a draft Release does not publish npm. The workflowdoes not edit versions or create tags. A visible Release can precede successful npm publication;check its Actions result before announcing that the npm version is available.diff --git a/scripts/publish-release-candidate.mjs b/scripts/publish-release-candidate.mjsindex 22698467..87078133 100644--- a/scripts/publish-release-candidate.mjs+++ b/scripts/publish-release-candidate.mjs@@ -3,7 +3,11 @@ import { createHash } from "node:crypto";import { readFile } from "node:fs/promises";import { basename, dirname, resolve, sep } from "node:path";-const planPath = resolve(process.argv[2] ?? "dist/release/release-plan.json");+const arguments_ = process.argv.slice(2);+const unknownOption = arguments_.find((value) => value.startsWith("--") && value !== "--preflight-only");+if (unknownOption !== undefined) throw new Error(`Unknown option: ${unknownOption}`);+const preflightOnly = arguments_.includes("--preflight-only");+const planPath = resolve(arguments_.find((value) => !value.startsWith("--")) ?? "dist/release/release-plan.json");const releaseDirectory = dirname(planPath);const plan = JSON.parse(await readFile(planPath, "utf8"));if (plan.format !== "hypit.release-plan@1" || !Array.isArray(plan.independent)@@ -44,7 +48,7 @@ async function registryVersion(name, version) {return await response.json();}-async function publish(item) {+async function inspect(item) {const path = tarballPath(item);const manifest = tarballManifest(path);if (manifest.name !== item.name || manifest.version !== item.version) {@@ -59,10 +63,9 @@ async function publish(item) {? existing.dist.integrity === integrity: existing.dist?.shasum === shasum;if (!same) throw new Error(`${item.name}@${item.version} already exists with different immutable bytes`);- console.log(`${item.name}@${item.version} already exists with the same npm integrity; skipping.`);- return;+ return { item, path, exists: true };}- execFileSync("npm", ["publish", path, "--access", "public", "--tag", "latest"], { stdio: "inherit" });+ return { item, path, exists: false };}const ordered = [...plan.independent, plan.distribution];@@ -71,5 +74,20 @@ for (const item of ordered) {const identity = `${item.name}@${item.version}`;if (identities.has(identity)) throw new Error(`Release plan repeats ${identity}`);identities.add(identity);- await publish(item);+}++// Inspect the complete immutable candidate before the first external write. A conflict or registry+// outage late in the dependency order must not leave an avoidable partial publication behind.+const inspected = [];+for (const item of ordered) inspected.push(await inspect(item));+console.log(`Preflight passed for ${inspected.length} npm packages.`);++if (!preflightOnly) {+ for (const candidate of inspected) {+ if (candidate.exists) {+ console.log(`${candidate.item.name}@${candidate.item.version} already exists with the same npm integrity; skipping.`);+ continue;+ }+ execFileSync("npm", ["publish", candidate.path, "--access", "public", "--tag", "latest"], { stdio: "inherit" });+ }}