Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/npm-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ jobs:
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 npm package and README
run: npm run pack:distribution
- name: Build the immutable Piko Runtime manifest
if: runner.os == 'Linux'
run: npm run pack:piko-runtime -- dist/release
- name: Install, render and export outside the checkout
run: npm run check:distribution -- "dist/release/hypit-hypit-${{ steps.version.outputs.version }}.tgz"
- uses: actions/upload-artifact@v4
Expand All @@ -61,5 +64,6 @@ jobs:
name: npm-package
path: |
dist/release/*.tgz
dist/release/hypit-runtime-*.json
dist/release/README.md
if-no-files-found: error
83 changes: 32 additions & 51 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Publish npm
run-name: "npm ${{ github.event.release.tag_name || inputs.version }} — ${{ (github.event_name == 'release' || inputs.publish) && 'publish' || 'package only' }}"
name: Publish release
run-name: "release ${{ github.event.release.tag_name || inputs.version }}"

on:
release:
Expand All @@ -10,10 +10,6 @@ on:
description: "Version already committed in main's package.json"
type: string
required: true
publish:
description: "Publish to npm (unchecked: checks and downloadable package only)"
type: boolean
default: false

permissions:
contents: read
Expand Down Expand Up @@ -71,52 +67,9 @@ jobs:
needs: [version, checks]
uses: ./.github/workflows/npm-package.yml

publish:
if: github.event_name == 'release' || inputs.publish
needs: package
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/setup-node@v4
with:
node-version: 24
registry-url: https://registry.npmjs.org
- name: Use npm with trusted publishing support
run: npm install --global npm@11
- uses: actions/download-artifact@v4
with:
name: npm-package
path: release
- name: Check whether the immutable npm version already exists
id: registry
env:
VERSION: ${{ needs.package.outputs.version }}
run: |
node --input-type=module <<'JS'
import { appendFileSync } from 'node:fs';
const response = await fetch(`https://registry.npmjs.org/@hypit%2fhypit/${process.env.VERSION}`,
{ signal: AbortSignal.timeout(30000) });
if (!response.ok && response.status !== 404) {
throw new Error(`npm version lookup failed: HTTP ${response.status}`);
}
const exists = response.ok;
appendFileSync(process.env.GITHUB_OUTPUT, `exists=${exists}\n`);
if (exists) {
appendFileSync(process.env.GITHUB_STEP_SUMMARY,
`@hypit/hypit@${process.env.VERSION} already exists; npm publish and latest are unchanged.\n`);
}
JS
- name: Publish the prepared tarball
if: steps.registry.outputs.exists == 'false'
env:
VERSION: ${{ needs.package.outputs.version }}
run: npm publish "./release/hypit-hypit-$VERSION.tgz" --access public --tag latest

release-assets:
if: github.event_name == 'release'
needs: [package, publish]
needs: package
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -135,7 +88,35 @@ jobs:
filename="hypit-hypit-$VERSION.tgz"
assets="$(gh release view "$RELEASE_TAG" --json assets --jq '.assets[].name')"
if printf '%s\n' "$assets" | grep -Fxq "$filename"; then
echo "Release already contains $filename; leaving it unchanged."
existing="$(mktemp -d)"
trap 'rm -rf "$existing"' EXIT
gh release download "$RELEASE_TAG" --pattern "$filename" --dir "$existing"
cmp -- "release/$filename" "$existing/$filename" || {
echo "Release asset $filename exists with different bytes; refusing to publish a mismatched Runtime."
exit 1
}
echo "Release already contains the matching $filename; leaving it unchanged."
else
gh release upload "$RELEASE_TAG" "release/$filename"
fi
- name: Attach the Piko Runtime manifest
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
RELEASE_TAG: ${{ github.event.release.tag_name }}
VERSION: ${{ needs.package.outputs.version }}
run: |
filename="hypit-runtime-$VERSION.json"
assets="$(gh release view "$RELEASE_TAG" --json assets --jq '.assets[].name')"
if printf '%s\n' "$assets" | grep -Fxq "$filename"; then
existing="$(mktemp -d)"
trap 'rm -rf "$existing"' EXIT
gh release download "$RELEASE_TAG" --pattern "$filename" --dir "$existing"
cmp -- "release/$filename" "$existing/$filename" || {
echo "Release asset $filename exists with different bytes; refusing to publish a mismatched Runtime."
exit 1
}
echo "Release already contains the matching $filename; leaving it unchanged."
else
gh release upload "$RELEASE_TAG" "release/$filename"
fi
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,13 @@ Hypit gives AI agents (Claude Code, Codex...) a language and system to create vi
## Install once

```bash
npx skills add hypit-ai/hypit -g
npx skills add dramaclaw/hypit -g
```

The Piko plugin uses the same fork and installs its pinned Runtime from the matching GitHub
Release asset. It never resolves the official `hypit-ai/hypit` package; the fork's
`@dramaclaw/provider-newapi` is part of the Runtime source.

This installs the Skill. On first use, your agent checks for the Hypit executable and helps prepare
it if needed. Your video project can live anywhere.

Expand Down
5 changes: 4 additions & 1 deletion README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,12 @@ Hypit 为 AI Agent(Claude Code、Codex 等)提供了一套制作视频的语
## 只安装一次

```bash
npx skills add hypit-ai/hypit -g
npx skills add dramaclaw/hypit -g
```

Piko 插件使用同一个 fork,并从对应的 GitHub Release 安装锁定的 Runtime。它不会解析官方
`hypit-ai/hypit` 包;Runtime 使用 fork 中的 `@dramaclaw/provider-newapi`。

这条命令安装 Skill。首次使用时,Agent 会检查 Hypit 可执行程序,并按需协助安装。

团队内部也提供[中文桌面安装包](./docs/zh/guide/desktop-installer.md)(macOS arm64 / Windows x64,未签名)。向导会预填团队 NewAPI 地址、OSS Endpoint 和 Bucket,均可修改;API Key 与 OSS AccessKey 仍须由使用者填写,并保存在系统凭据库。语音识别与字幕对齐通过 NewAPI 完成,安装包不会安装本地 WhisperX 或下载本地语音模型。Windows 当前仅完成 macOS 交叉打包、解包和静态验收,尚未完成 Windows 实机验证。
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "@hypit/hypit",
"version": "0.2.16",
"homepage": "https://hypit.ai",
"homepage": "https://github.com/dramaclaw/hypit",
"repository": {
"type": "git",
"url": "git+https://github.com/hypit-ai/hypit.git"
"url": "git+https://github.com/dramaclaw/hypit.git"
},
"description": "Hypit video authoring Distribution for AI agents",
"license": "SEE LICENSE IN LICENSE",
Expand Down Expand Up @@ -172,6 +172,7 @@
"desktop:dist:win": "pnpm --filter @hypit/desktop-setup dist:win",
"desktop:dist": "pnpm --filter @hypit/desktop-setup dist",
"pack:distribution": "node scripts/pack-distribution.mjs",
"pack:piko-runtime": "node scripts/pack-piko-runtime.mjs",
"check:distribution": "node scripts/check-distribution.mjs",
"build:public-types": "node scripts/build-public-types.mjs",
"check": "tsc -p tsconfig.json --noEmit",
Expand Down
7 changes: 5 additions & 2 deletions packages/desktop-setup/scripts/check-artifact.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,17 @@ export async function checkArtifact({ out, platform, arch, checkoutRoot: sourceR
checkMediaBinary(await readFile(binary), target, "ffmpeg");
const locked = media.lock.targets[`${platform}-${arch}`];
assert.deepEqual(files[`bin/${target.executable}`], { sha256: locked.ffmpeg.sha256, bytes: locked.ffmpeg.bytes }, "FFmpeg differs from locked binary");
if (platform === "darwin") assert.ok((await lstat(binary)).mode & 0o111, "FFmpeg is not executable");
// Unix executable bits are not representable on a Windows checkout. The
// target binary is still validated by its Mach-O header and locked digest;
// only enforce the mode when the host filesystem can preserve it.
if (platform === "darwin" && process.platform !== "win32") assert.ok((await lstat(binary)).mode & 0o111, "FFmpeg is not executable");
const probe = join(root, "bin", target.probe.executable);
checkMediaBinary(await readFile(probe), target, "ffprobe");
assert.deepEqual(files[`bin/${target.probe.executable}`], { sha256: locked.ffprobe.sha256, bytes: locked.ffprobe.bytes }, "FFprobe differs from locked binary");
const notices = await inventory(join(sourceRoot, "packages/desktop-setup/media-licenses", `${platform}-${arch}`));
assert.ok(notices.COPYING && notices["SOURCES.md"] && notices["VERSIONS.txt"], "Media license and source notices required");
assert.deepEqual(await inventory(join(root, "licenses")), notices, "Media license notices differ from checkout");
if (platform === "darwin") assert.ok((await lstat(probe)).mode & 0o111, "FFprobe is not executable");
if (platform === "darwin" && process.platform !== "win32") assert.ok((await lstat(probe)).mode & 0o111, "FFprobe is not executable");
return manifest;
}

Expand Down
4 changes: 2 additions & 2 deletions packages/desktop-setup/src/launcher-install.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { execFile } from "node:child_process";
import { createHash, randomUUID } from "node:crypto";
import { chmod, link, lstat, mkdir, mkdtemp, open, readFile, rename, rmdir, unlink } from "node:fs/promises";
import { dirname, isAbsolute, join, relative, win32 } from "node:path";
import { basename, dirname, isAbsolute, join, relative, win32 } from "node:path";
import { promisify } from "node:util";
import type { DesktopPaths } from "./paths.js";
import { exists } from "./skill-install.js";
Expand Down Expand Up @@ -190,7 +190,7 @@ export function prepareFileChange(before: FileSnapshot, bytes: Buffer | undefine
return {
async commit() {
await mkdir(dirname(before.path), { recursive: true });
recovery = await mkdtemp(`${before.path}.recovery-`);
recovery = await mkdtemp(join(dirname(before.path), `${basename(before.path)}.recovery-`));
if (process.platform !== "win32") await chmod(recovery, 0o700);
if (bytes !== undefined) {
await atomicFile(join(recovery, "staged"), bytes, mode);
Expand Down
5 changes: 4 additions & 1 deletion packages/desktop-setup/src/paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ export type DesktopPathOptions = {

/** Must match provider-whisperx-local's fixed default Program identity and loopback URL. */
export function whisperXProgramPaths(paths: Pick<DesktopPaths, "hostState">) {
const path = win32.isAbsolute(paths.hostState) && !posix.isAbsolute(paths.hostState) ? win32 : posix;
// Select by the path's spelling rather than `win32.isAbsolute`: on POSIX,
// the Win32 helper also considers `/tmp` absolute, which would turn a
// cross-target fixture into literal backslash-named files.
const path = /^(?:[A-Za-z]:[\\/]|\\\\)/u.test(paths.hostState) ? win32 : posix;
const home = path.join(paths.hostState, "programs", "whisperx-whisperx.local-127.0.0.1%3A8765");
return { home, state: path.join(paths.hostState, "desktop", "whisperx-state.json"),
installationLog: path.join(home, "install.log"), serviceLog: path.join(home, "program.log") };
Expand Down
10 changes: 5 additions & 5 deletions packages/desktop-setup/src/skill-install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,9 @@ export type PreparedSkillInstall = PreparedRemoval & { readonly marker: ManagedS
/** Stage a verified Skill and any user backup without changing the live tree. */
export async function prepareSkillInstall(options: SkillInstallOptions): Promise<PreparedSkillInstall> {
const { target } = options;
const stage = `${target.skillDirectory}.stage-${randomUUID()}`;
const previous = `${target.skillDirectory}.previous-${randomUUID()}`;
const backupStage = `${target.backupDirectory}.stage-${randomUUID()}`;
const stage = join(dirname(target.skillDirectory), `${basename(target.skillDirectory)}.stage-${randomUUID()}`);
const previous = join(dirname(target.skillDirectory), `${basename(target.skillDirectory)}.previous-${randomUUID()}`);
const backupStage = join(dirname(target.backupDirectory), `${basename(target.backupDirectory)}.stage-${randomUUID()}`);
let moved = false;
let backupCreated = false;
let committed = false;
Expand Down Expand Up @@ -435,8 +435,8 @@ export async function prepareSkillRemoval(options: { readonly target: AgentSkill

async function prepareOwnedRemoval(target: LegacyCodexPaths,
readMarker: () => Promise<{ readonly backupDirectory?: string } | undefined>): Promise<PreparedRemoval | undefined> {
const previous = `${target.skillDirectory}.removed-${randomUUID()}`;
const restoreStage = `${target.skillDirectory}.restore-${randomUUID()}`;
const previous = join(dirname(target.skillDirectory), `${basename(target.skillDirectory)}.removed-${randomUUID()}`);
const restoreStage = join(dirname(target.skillDirectory), `${basename(target.skillDirectory)}.restore-${randomUUID()}`);
let moved = false;
let restored = false;
let restoredLiveSnapshot: TreeSnapshot | undefined;
Expand Down
Loading
Loading