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: simplify multi-package publication
kashorin38741d3fb0e0
diff --git a/.github/workflows/npm-package.yml b/.github/workflows/npm-package.ymlindex 694f7f97..ab61b7c8 100644--- a/.github/workflows/npm-package.yml+++ b/.github/workflows/npm-package.yml@@ -11,7 +11,7 @@ on:outputs:version:description: Version of the installed and executed tarball- value: ${{ jobs.package.outputs.version }}+ value: ${{ jobs.build.outputs.version }}permissions:contents: read@@ -21,15 +21,43 @@ concurrency:cancel-in-progress: truejobs:- package:+ build:+ runs-on: ubuntu-latest+ timeout-minutes: 15+ outputs:+ version: ${{ steps.version.outputs.version }}+ steps:+ - uses: actions/checkout@v4+ with:+ persist-credentials: false+ - uses: pnpm/action-setup@v4+ - uses: actions/setup-node@v4+ with:+ node-version: 24+ cache: pnpm+ - run: pnpm install --frozen-lockfile+ - name: Read the package version+ id: version+ run: node --input-type=module -e 'import { readFileSync, appendFileSync } from "node:fs"; const { version } = JSON.parse(readFileSync("package.json", "utf8")); appendFileSync(process.env.GITHUB_OUTPUT, `version=${version}\n`);'+ - name: Build the release candidate without publishing+ run: npm run pack:release-candidate+ - uses: actions/upload-artifact@v4+ with:+ name: npm-package+ path: |+ dist/release/*.tgz+ dist/release/README.md+ dist/release/release-plan.json+ if-no-files-found: error++ verify:+ needs: buildruns-on: ${{ matrix.os }}strategy:fail-fast: falsematrix:os: [ubuntu-latest, windows-latest]timeout-minutes: 25- outputs:- version: ${{ steps.version.outputs.version }}steps:- uses: actions/checkout@v4with:@@ -48,19 +76,9 @@ jobs:- name: Prepare the local media toolchain on Windowsif: runner.os == 'Windows'run: choco install ffmpeg --yes --no-progress- - name: Read the package version- id: version- run: node --input-type=module -e 'import { readFileSync, appendFileSync } from "node:fs"; const { version } = JSON.parse(readFileSync("package.json", "utf8")); appendFileSync(process.env.GITHUB_OUTPUT, `version=${version}\n`);'- - name: Build the release candidate without publishing- run: npm run pack:release-candidate- - name: Install the complete candidate, render and export outside the checkout- run: npm run check:release-candidate- - uses: actions/upload-artifact@v4- if: runner.os == 'Linux'+ - uses: actions/download-artifact@v4with:name: npm-package- path: |- dist/release/*.tgz- dist/release/README.md- dist/release/release-plan.json- if-no-files-found: error+ path: dist/release+ - name: Install the complete candidate, render and export outside the checkout+ run: npm run check:release-candidatediff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.ymlindex a547c0d7..e397e7ad 100644--- a/.github/workflows/publish-npm.yml+++ b/.github/workflows/publish-npm.yml@@ -68,12 +68,12 @@ jobs:uses: ./.github/workflows/ci.ymlpackage:- needs: [version, checks]+ needs: versionuses: ./.github/workflows/npm-package.ymlpublish:if: github.event_name == 'release' || inputs.publish- needs: package+ needs: [checks, package]runs-on: ubuntu-latestpermissions:contents: readdiff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex baff2361..d84df421 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -73,23 +73,23 @@ and retains the temporary project on failure. The `npm package execution` workfland is reused by publication; publication uploads the same tarball that was installed and executed.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+`package.json` to `main`, then 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, 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.+repository checks and release-candidate construction in parallel, then installs and executes that+one candidate on Linux and Windows. It preflights every package in the release plan against npm,+publishes dependencies first and the Distribution last as `latest`, and attaches the Distribution+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 version-and leave **Publish to npm** unchecked for checks and downloadable packaging only; check it for a-manual npm publication. To finish a failed Release publication, fix the external problem and rerun-that Release's workflow. A failed check or package preflight does not consume the npm version. If no+and leave **Publish to npm** unchecked for an optional package-only rehearsal and downloadable+candidate; check it for a manual npm publication. Both paths build the candidate once and make both+operating systems consume the same uploaded files. To finish a failed Release publication, fix the+external problem and rerun that Release's workflow. A failed check or package preflight does not+consume the npm version. If nopackage from the candidate reached npm, the Release and tag may be withdrawn, the code fixed whileretaining the intended version, and the complete candidate validated again. If publication stopsafter some independent packages, rerun the same immutable candidate: matching versions are skipped@@ -105,6 +105,25 @@ repository `hypit`, workflow `publish-npm.yml`, with direct `npm publish` enablename. The publishing job uses OIDC; no npm token secret is needed. An already published versioncannot be overwritten. npm versions such as `0.1.2` are separate from the logical `@1` interfaces.+Trusted Publisher authority belongs to each npm package rather than to the `@hypit` scope. When a+new independently published package first enters the Distribution, prepare and check the exact+candidate locally, sign in with `npm login`, then run:++```sh+npm run publish:release-dependencies+npm run trust:release-dependencies -- --package=@hypit/new-package+```++The first command publishes only missing independent packages and never the root Distribution;+existing versions are skipped only when their registry integrity matches the candidate. The second+uses npm 11.15 or newer to bind the named package to this repository and workflow. Omit `--package`+only when bootstrapping every independent package in a new release plan. npm's first authorization+page can grant a five-minute window for the remaining package bindings; the command spaces requests+to stay within registry limits. This is package creation, not a normal release step. Do not retain a+long-lived npm publication token or publish the root Distribution from the workstation. After the+package bindings exist, rerun the Release workflow; it verifies matching immutable versions and+continues through OIDC.+Release notes should identify the changed user behavior and the affected installation. The npmDistribution and an installed Skill update separately: link the relevant Skill changes and describeboth update paths when a release changes both. A saved video project and its existing materialsdiff --git a/package.json b/package.jsonindex 010abd3f..b3cb327e 100644--- a/package.json+++ b/package.json@@ -293,6 +293,8 @@"check:distribution": "node scripts/check-distribution.mjs","pack:release-candidate": "node scripts/pack-release-candidate.mjs","check:release-candidate": "node scripts/check-release-candidate.mjs",+ "publish:release-dependencies": "node scripts/publish-release-candidate.mjs dist/release/release-plan.json --independent-only",+ "trust:release-dependencies": "npm exec --yes --package=npm@^11.15.0 -- node scripts/configure-release-publishers.mjs dist/release/release-plan.json","build:public-types": "node scripts/build-public-types.mjs","check": "tsc -p tsconfig.json --noEmit","docs:dev": "vitepress dev docs",diff --git a/scripts/configure-release-publishers.mjs b/scripts/configure-release-publishers.mjsnew file mode 100644index 00000000..02501b72--- /dev/null+++ b/scripts/configure-release-publishers.mjs@@ -0,0 +1,56 @@+import { execFileSync } from "node:child_process";+import { readFile } from "node:fs/promises";+import { resolve } from "node:path";++const arguments_ = process.argv.slice(2);+const dryRun = arguments_.includes("--dry-run");+const packageOptions = arguments_.filter((value) => value.startsWith("--package="));+const unknownOption = arguments_.find((value) => value.startsWith("--")+ && value !== "--dry-run" && !value.startsWith("--package="));+if (unknownOption !== undefined) throw new Error(`Unknown option: ${unknownOption}`);++const planPath = resolve(arguments_.find((value) => !value.startsWith("--"))+ ?? "dist/release/release-plan.json");+const plan = JSON.parse(await readFile(planPath, "utf8"));+if (plan.format !== "hypit.release-plan@1" || !Array.isArray(plan.independent)) {+ throw new Error(`${planPath} is not a Hypit release plan`);+}++const byName = new Map(plan.independent.map((item) => [item.name, item]));+const requested = packageOptions.map((value) => value.slice("--package=".length));+const selected = requested.length === 0+ ? plan.independent+ : requested.map((name) => {+ const item = byName.get(name);+ if (item === undefined) throw new Error(`${name} is not an independent package in ${planPath}`);+ return item;+ });+if (new Set(selected.map((item) => item.name)).size !== selected.length) {+ throw new Error("A package was selected more than once");+}++const npmVersion = execFileSync("npm", ["--version"], { encoding: "utf8" }).trim();+const [npmMajor, npmMinor] = npmVersion.split(".").map(Number);+if (npmMajor < 11 || (npmMajor === 11 && npmMinor < 15)) {+ throw new Error(`npm >= 11.15.0 is required for bulk trusted publishing; found ${npmVersion}`);+}++console.log(`${dryRun ? "Checking" : "Configuring"} GitHub trusted publishing for ${selected.length} packages.`);+for (const [index, item] of selected.entries()) {+ const args = [+ "trust",+ "github",+ item.name,+ "--file",+ "publish-npm.yml",+ "--repository",+ "hypit-ai/hypit",+ "--allow-publish",+ "--yes",+ ];+ if (dryRun) args.push("--dry-run");+ execFileSync("npm", args, { stdio: "inherit" });+ if (!dryRun && index + 1 < selected.length) {+ await new Promise((resolveDelay) => setTimeout(resolveDelay, 2000));+ }+}diff --git a/scripts/publish-release-candidate.mjs b/scripts/publish-release-candidate.mjsindex 87078133..5d8514b5 100644--- a/scripts/publish-release-candidate.mjs+++ b/scripts/publish-release-candidate.mjs@@ -4,9 +4,11 @@ import { readFile } from "node:fs/promises";import { basename, dirname, resolve, sep } from "node:path";const arguments_ = process.argv.slice(2);-const unknownOption = arguments_.find((value) => value.startsWith("--") && value !== "--preflight-only");+const knownOptions = new Set(["--preflight-only", "--independent-only"]);+const unknownOption = arguments_.find((value) => value.startsWith("--") && !knownOptions.has(value));if (unknownOption !== undefined) throw new Error(`Unknown option: ${unknownOption}`);const preflightOnly = arguments_.includes("--preflight-only");+const independentOnly = arguments_.includes("--independent-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"));@@ -68,7 +70,7 @@ async function inspect(item) {return { item, path, exists: false };}-const ordered = [...plan.independent, plan.distribution];+const ordered = independentOnly ? [...plan.independent] : [...plan.independent, plan.distribution];const identities = new Set();for (const item of ordered) {const identity = `${item.name}@${item.version}`;