Skip to content

armgit / hypit

Public Imported from GitHub
0

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.

fix(distribution): adapt npm README and publish 0.1.1

kashorinaeebe0b6d0c4
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index f284650d..6856e048 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -50,6 +50,14 @@ pnpm check # TypeScript type-check
pnpm test # package and service-adapter tests
```
+## Package the Distribution
+
+Run `npm run pack:distribution` to build public types and write the release tarball to
+`dist/release/`. This stages npm's selected files in a temporary directory and adapts the English
+README for the npm page: public image URLs, both GIFs, and a link to the full video examples.
+The repository READMEs remain unchanged. `dist/release/README.md` shows the packaged text.
+Publish the resulting tarball with `npm publish dist/release/hypit-hypit-<version>.tgz --access public`.
+
## Open the pull request
Branch names and commit subjects share the same prefix: `feat/`, `fix/`, `docs/` for branches and
diff --git a/CONTRIBUTING.zh-CN.md b/CONTRIBUTING.zh-CN.md
index a4a93622..98dc177c 100644
--- a/CONTRIBUTING.zh-CN.md
+++ b/CONTRIBUTING.zh-CN.md
@@ -42,6 +42,14 @@ pnpm check # TypeScript 类型检查
pnpm test # 包与服务适配器测试
```
+## 打包 Distribution
+
+运行 `npm run pack:distribution`,构建公共类型并将发布 tarball 写入 `dist/release/`。
+脚本在临时目录中使用 npm 选定的文件,从英文 README 生成 npm 页面版本:使用公开图片地址,
+保留两个 GIF,并将完整视频示例改为链接。仓库的两份 README 保持原样。
+`dist/release/README.md` 可用于检查打包后的文案。
+使用 `npm publish dist/release/hypit-hypit-<version>.tgz --access public` 发布生成的 tarball。
+
## 提交 Pull Request
分支名与提交信息使用同一套前缀:分支用 `feat/`、`fix/`、`docs/`,提交信息用 `feat:`、`fix:`、`docs:`。
diff --git a/package.json b/package.json
index 3808e852..7e207f2a 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,11 @@
{
"name": "@hypit/hypit",
- "version": "0.1.0",
+ "version": "0.1.1",
+ "homepage": "https://hypit.ai",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/hypit-ai/hypit.git"
+ },
"description": "Hypit video authoring Distribution for AI agents",
"license": "SEE LICENSE IN LICENSE",
"type": "module",
@@ -145,6 +150,7 @@
"examples/semantic-composition/hypit.runtime.json"
],
"scripts": {
+ "pack:distribution": "node scripts/pack-distribution.mjs",
"build:public-types": "node scripts/build-public-types.mjs",
"check": "tsc -p tsconfig.json --noEmit",
"docs:dev": "vitepress dev docs",
diff --git a/scripts/pack-distribution.mjs b/scripts/pack-distribution.mjs
new file mode 100644
index 00000000..096caa0a
--- /dev/null
+++ b/scripts/pack-distribution.mjs
@@ -0,0 +1,57 @@
+import { execFileSync } from "node:child_process";
+import { copyFile, mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
+import { tmpdir } from "node:os";
+import { dirname, resolve } from "node:path";
+import { fileURLToPath } from "node:url";
+
+const root = resolve(dirname(fileURLToPath(import.meta.url)), "..");
+const output = resolve(root, "dist/release");
+const github = "https://github.com/hypit-ai/hypit/blob/main/";
+const assets = "https://storage.googleapis.com/hypit-public-assets/showcase/2026-09-09/";
+
+// Run through npm so its CLI entry is portable, including on Windows.
+const npmCli = process.env.npm_execpath;
+if (!npmCli || !npmCli.endsWith("npm-cli.js")) {
+ throw new Error("Run npm run pack:distribution to prepare the npm release.");
+}
+function npm(args, cwd, capture = false) {
+ return execFileSync(process.execPath, [npmCli, ...args], {
+ cwd, encoding: "utf8", stdio: capture ? ["ignore", "pipe", "inherit"] : "inherit",
+ });
+}
+
+npm(["run", "build:public-types"], root);
+const [inventory] = JSON.parse(npm(["pack", "--dry-run", "--ignore-scripts", "--json"], root, true));
+let readme = await readFile(resolve(root, "README.md"), "utf8");
+const examples = readme.indexOf("## Examples\n");
+const next = readme.indexOf("## Use the Hypit skill\n", examples);
+if (examples < 0 || next < 0) throw new Error("README Examples section could not be located.");
+readme = readme.slice(0, examples)
+ + "[Watch the complete video examples on GitHub](https://github.com/hypit-ai/hypit#examples).\n\n"
+ + readme.slice(next);
+readme = readme
+ .replace(/<picture>[\s\S]*?<\/picture>/u,
+ '<img alt="Hypit" src="https://raw.githubusercontent.com/hypit-ai/hypit/main/docs/public/hypit-logo-dark.svg" width="400" height="122">')
+ .replaceAll("https://github.com/user-attachments/assets/981c28e8-ddab-4164-85bc-03b5d71275dc", `${assets}demo.gif`)
+ .replaceAll("https://github.com/user-attachments/assets/cc929974-96b8-4166-b81d-008e130b0f24", `${assets}star.gif`)
+ .replaceAll('href="./', `href="${github}`)
+ .replaceAll("](./", `](${github}`)
+ .replace("## Install once\n", "## Install once\n\nInstall the Hypit CLI (Node.js 22.12 or newer):\n\n```bash\nnpm install -g @hypit/hypit\n```\n\nAdd the Skill to your coding agent:\n");
+
+const stage = await mkdtemp(resolve(tmpdir(), "hypit-npm-"));
+try {
+ // Use npm's own file selection; only the package-page README differs from the repository.
+ for (const { path } of inventory.files) {
+ if (path === "README.zh-CN.md") continue;
+ const target = resolve(stage, path);
+ await mkdir(dirname(target), { recursive: true });
+ await copyFile(resolve(root, path), target);
+ }
+ await writeFile(resolve(stage, "README.md"), readme);
+ await mkdir(output, { recursive: true });
+ const packed = npm(["pack", "--ignore-scripts", "--pack-destination", output, "--json"], stage, true);
+ await writeFile(resolve(output, "README.md"), readme);
+ console.log(packed);
+} finally {
+ await rm(stage, { recursive: true, force: true });
+}