The open-source full-stack studio for Opus 5.5 motion video. Reverse engineering for any video. Code video with HTML: recreate, edit and render. BYOA + BYOK · Motion.md · Images, Video, Music & Voice.
TypeScript agent-skillsagentic-aiai-agentsai-videobyokclaude-codecodexdeepseek-harnessdsh-plugingenerative-ailocal-firstmcpmotionmotion-graphicsmultimodalopenmotionreverse-engineeringvideo-editingvideo-generationworkbuddy
feat(motion): bundle complete npm application with test-channel versions
罗高61a0e7d9e4d4
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex d8a9d77f..05155512 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -9,7 +9,7 @@ on:workflow_dispatch:inputs:format:- description: 'Build npm lightweight artifacts or complete ZIP backups'+ description: 'Build self-contained npm application artifacts or complete ZIP backups'type: choiceoptions: [npm, full]default: npmdiff --git a/README.md b/README.mdindex 92532b08..de47b2f9 100644--- a/README.md+++ b/README.md@@ -78,7 +78,7 @@ Media panels open beside the triggering button or timeline selection and adjust## MCP and lightweight installation-The [lightweight npm installer](docs/npm-installation.md) installs eleven MCP Tools and five Skills for Codex, Claude Code, DeepSeek Harness or WorkBuddy. It shares the application and prepares verified native tools on demand. Build locally with `npm run package:npm`; the npm package is not publicly published. Complete ZIPs remain available as a backup.+The [Motion application npm package](docs/npm-installation.md) includes the application and default manifest alongside its installer. It installs eleven MCP Tools and five Skills for Codex, Claude Code, DeepSeek Harness or WorkBuddy without adjacent files; locked npm dependencies and native tools are prepared separately. Build an test with `npm run package:npm -- dist/npm-test 0.6.4-test.1`. [test/stable acceptance](docs/release-guide.md) and isolated DEV template instructions are documented; no npm version has been published by this change. Complete platform ZIPs remain a backup.The five entries are [motion-production](skills/motion-production/SKILL.md), [motion-director](skills/motion-director/SKILL.md), [motion-template-to-video](skills/motion-template-to-video/SKILL.md), [motion-recreate](skills/motion-recreate/SKILL.md), and [motion-video-to-template](skills/motion-video-to-template/SKILL.md). Reference recreation is implemented. Product UI follows the [OpenDesign visual system](docs/design-system.md); video artwork keeps its own styles.diff --git a/docs/README.md b/docs/README.mdindex dff24ec3..2e9ac412 100644--- a/docs/README.md+++ b/docs/README.md@@ -19,6 +19,7 @@- [motion-director.md](motion-director.md)- [motion-extension-scope.md](motion-extension-scope.md)- [npm-installation.md](npm-installation.md)+- [test and stable acceptance](release-guide.md)- [product/architecture.md](product/architecture.md)- [product/media-generation-design.md](product/media-generation-design.md)- [project-workspace.md](project-workspace.md)diff --git a/docs/README.zh-CN.md b/docs/README.zh-CN.mdindex 7915c374..6a249acf 100644--- a/docs/README.zh-CN.md+++ b/docs/README.zh-CN.md@@ -78,7 +78,7 @@## MCP 与轻量安装-[npm 轻量安装器](npm-installation.md) 可为 Codex、Claude Code、DeepSeek Harness、WorkBuddy 同装11 个 MCP Tool 和五个 Skill,共用应用并按需准备经过校验的原生工具。运行 `npm run package:npm` 本地构建;npm 包尚未公开发布,完整 ZIP 保留备用。+The [Motion application npm package](npm-installation.md) bundles the application and default manifest, installs 11 MCP Tools and five Skills, and prepares locked dependencies/native tools separately. [test/stable acceptance](release-guide.md) includes DEV isolation and upgrade/recovery checks. Build locally with `npm run package:npm`; this change does not publish a package.五个入口为 [motion-production](../skills/motion-production/SKILL.md)、[motion-director](../skills/motion-director/SKILL.md)、[motion-template-to-video](../skills/motion-template-to-video/SKILL.md)、[motion-recreate](../skills/motion-recreate/SKILL.md)、[motion-video-to-template](../skills/motion-video-to-template/SKILL.md)。参考复刻已实现;产品 UI 沿用 [OpenDesign 视觉规范](design-system.md),视频作品保留自身样式。diff --git a/docs/npm-installation.md b/docs/npm-installation.mdindex 5c29bfef..d8eb9283 100644--- a/docs/npm-installation.md+++ b/docs/npm-installation.md@@ -1,78 +1,103 @@-# npm 轻量安装包(仅本地验证)+# Motion application npm package-当前源码位于 仓库根目录;下列模块命令在该目录执行。活动工作流在仓库根目录 `.github/workflows/ci.yml`,发布保持关闭。迁移基线及历史验收范围见[迁移说明](repository-migration.md)。+The npm tgz contains the installer, a prebuilt Motion application archive and its pinned release manifest. One `setup` installs the application, eleven public MCP Tools and five Skills for the selected host. No adjacent application archive or `--manifest` is needed. The application runs from a managed, writable directory, never from the npx cache; projects remain outside application/cache directories.-这条安装渠道服务已有 Codex、Claude Code、DeepSeek Harness 或 WorkBuddy,以及 Node.js 22.18+ 和 npm 的用户。一次 setup 为所选宿主安装一期 11 Tool MCP 连接与 production/director/template/recreate/video-to-template 五个 Skills;应用、用户工程和原生工具各自保存。当前没有发布 npm 包或公开下载源,包的 `private: true` 保留,以下命令只使用本地制品。+This branch does not publish packages. `@openmotion/installer` is the current package metadata name, not a claim that this npm scope is owned or a registry version is available. Registry examples apply only after a separately authorized release.-## 构建与安装+## Requirements and package contents-在源码目录执行 `npm ci`、`npm run package:npm`。构建会生成:+Users provide Node.js 22.18+ with npm and their Agent host. Builds use the Node version pinned in CI. npm installs locked production dependencies with `npm ci --omit=dev --ignore-scripts`; FFmpeg, ffprobe and the browser are downloaded and checked separately by `prepare` or the first native operation. Node, native binaries, node_modules, user projects and credentials are not bundled in this npm format. It is not an offline package. Complete platform ZIPs remain a backup.-- `dist/npm-local/openmotion-installer-0.6.3-local.1.tgz`:无 npm 依赖的 JS 安装入口,不含应用、Node、FFmpeg、浏览器或用户数据。-- `dist/npm-local/openmotion-application-0.6.3.tar.gz`:单独的应用资源,包含服务源码、预先构建的 Studio、Skills 和文档,不含 node_modules 或原生程序。-- `dist/npm-local/release.local.json`:固定应用 SHA256 与原生工具来源、版本和 SHA256。应用地址相对本清单解析,可将两个文件一起移动。+The embedded application uses `scripts/distribution.ts`'s positive file list: MCP/backend, prebuilt Studio, five Skills and references, bundled examples, npm/native locks, licenses and approved documentation. Remote Prism templates are fetched separately. The embedded manifest omits the containing tgz's hash; the external delivery manifest records that hash without a circular self-reference.++## Build and install a local test++From a clean checkout based on `feature/motion`:```sh-npx --yes --package /absolute/dist/npm-local/openmotion-installer-0.6.3-local.1.tgz openmotion setup --host codex --manifest /absolute/dist/npm-local/release.local.json+npm ci --no-audit --no-fund+npm run package:npm -- dist/npm-test 0.6.4-test.1```-默认应用根目录是 macOS/Linux 的 `~/.local/share/openmotion` 或 Windows 的 `%LOCALAPPDATA%/openmotion`;用户工程在该目录的 `data/`,应用和缓存分别在 `apps/`、`cache/`。可用 `--home`、`--data-dir` 选择位置;不允许工程放进应用、缓存或受管理的宿主组合包。setup 不需要管理员权限或修改全局 PATH。+The version is an example. Use a new empty output directory for every candidate. Files include `openmotion-installer-<version>.tgz`, the application archive, `release-npm.json` and SHA256 sidecars. Only the tgz is required by a consumer; the remaining files are delivery evidence and the explicit-manifest fallback. Copy the tgz alone to another directory to verify this property.-通过 `--host codex|claude|deepseek|workbuddy` 选择宿主,省略时兼容保留 Codex。四家使用同一个 `--home` 和清单时,复用同一应用、Node 绝对路径、`run-mcp.mjs`、工程目录与原生缓存;每个客户端仍启动自己的 stdio 连接。宿主选择和配置位置记录在 `install.json.hosts`,新增宿主不会丢失先前安装记录。+An isolated macOS Codex installation:-| 宿主 | MCP 注册 | Skills 加载 |-| --- | --- | --- |-| Codex | 官方 `codex mcp add openmotion` | `~/.agents/skills/openmotion/` 下完整技能/文档包,递归发现 |-| Claude Code | 官方 `claude mcp add-json -s user openmotion` | `${CLAUDE_CONFIG_DIR:-~/.claude}/skills/` 中直接子目录;保留全部 5 个 Skills |-| DeepSeek Harness | 官方 `dsh plugin --profile web add <本地组合包> --ignore-scripts` | 独立的 Skill provider 扫描组合包 `skills/` 的直接子项,保留已有 provider 和配置 |-| WorkBuddy | 合并 `${WORKBUDDY_CONFIG_DIR:-~/.workbuddy}/mcp.json` 中的 `mcpServers.openmotion` | 同一配置根目录的 `skills/` 直接子目录;本地自定义 MCP + Skills,不发布 Connector |+```sh+motion_tgz="/absolute/path/openmotion-installer-0.6.4-test.1.tgz"+motion_test="$HOME/Library/Application Support/OpenMotion-test/0.6.4-test.1"+mkdir -p "$motion_test/profile" "$motion_test/workspace"+export CODEX_HOME="$motion_test/profile"+npx --yes --package "$motion_tgz" -- openmotion setup --host codex \+ --home "$motion_test/app" --data-dir "$motion_test/data" \+ --skills-dir "$motion_test/workspace/.agents/skills" &&+npx --yes --package "$motion_tgz" -- openmotion prepare --home "$motion_test/app" &&+cd "$motion_test/workspace" &&+codex+```-Claude Code 和 WorkBuddy 的平铺技能目录内写入 `openmotion-install.json`,记录应用位置;共享文档链接在安装时改写为有效绝对路径。Codex/Harness 保留完整包的相对资料布局。新会话或重新加载后使用 Skills。+Run `prepare` only after successful setup. Wait for it to finish before starting a native project operation: slow first downloads can exceed the backend startup timeout. The isolated Codex profile may require its own login; do not copy credentials into the package.++Equivalent Windows PowerShell commands:++```powershell+$motionTgz = 'C:\path\openmotion-installer-0.6.4-test.1.tgz'+$motionTest = Join-Path $env:LOCALAPPDATA 'OpenMotion-test\0.6.4-test.1'+New-Item -ItemType Directory -Force "$motionTest\profile", "$motionTest\workspace" | Out-Null+$env:CODEX_HOME = "$motionTest\profile"+npx --yes --package "$motionTgz" -- openmotion setup --host codex --home "$motionTest\app" --data-dir "$motionTest\data" --skills-dir "$motionTest\workspace\.agents\skills"+if ($LASTEXITCODE -ne 0) { throw 'Motion setup failed' }+npx --yes --package "$motionTgz" -- openmotion prepare --home "$motionTest\app"+if ($LASTEXITCODE -ne 0) { throw 'Native preparation failed' }+Set-Location "$motionTest\workspace"+codex+```-升级前关闭旧 MCP 连接,并按 [共享编辑器说明](shared-editor.md) 停止同一数据目录的旧后台;安装后重新连接 MCP、重新加载 Skills。后台身份包含 npm 原生下载器和原生锁文件,遇到版本或代码不兼容会报错要求停止旧后台,安装器不自动结束已有进程。+These are documented commands, not proof of Windows acceptance. Use a directly executable host or pass its JavaScript CLI through `--codex`. The native lock declares Mac arm64/macOS 26 and Windows x64/Windows 11; other platforms are not implied supported by npm installation.-`--skills-dir` 可选择 Codex、Claude Code、WorkBuddy 的技能根目录;Harness 使用其专属 provider 根目录,不改动用户的全局技能目录。`--codex`、`--claude`、`--dsh` 可指定可执行文件,Harness 的 `--profile` 默认 `web`;macOS 本机没有 dsh 命令时优先使用已安装桌面包的官方 CLI。Windows 应使用能直接启动的宿主可执行文件。注册阶段使用宿主自身配置根(`CODEX_HOME`、`CLAUDE_CONFIG_DIR`、`DSH_HOME`、`WORKBUDDY_CONFIG_DIR`);应用根始终由 `--home` 控制,二者不混用。+## Test template data (DEV)-例如在同一台机器依次执行(其他参数与上面的 setup 相同):+The software channel (`test`/`latest`) and template environment (`dev`/`prod`) are independent. Public test candidates and stable packages default to **prod**. To debug unpublished/test Prism templates, publish them to Prism **DEV**, then build a local DEV candidate:```sh-openmotion setup --host claude --manifest /absolute/release.local.json --home /absolute/shared-openmotion-openmotion setup --host deepseek --profile web --manifest /absolute/release.local.json --home /absolute/shared-openmotion-openmotion setup --host workbuddy --manifest /absolute/release.local.json --home /absolute/shared-openmotion+npm run package:npm -- dist/npm-dev 0.6.4-test.1 --template-env=dev```-安装器保留其他 MCP、Skills 与用户配置。已有同名入口或 Skills 若不是本安装器管理则拒绝覆盖。WorkBuddy 配置在独立锁内重新读取并合并,保留其他设置;Harness 的本地组合包由官方配置工具加入所选 profile,不手工拼接或覆盖现有 YAML。重复安装复用同一应用与数据,更新同一个安装根目录时不允许隐式切换工程目录。安装失败回退本次 Skills 和安装记录;已校验的应用缓存保留供重试。+Use that tgz in the installation commands above, with an **independent Codex profile, home, data and Skills directory**. DEV packages remain `private:true`, even with an explicit test version. DEV setup defaults to `openmotion-dev` instead of `openmotion`; `prepare` uses the same environment-specific default. Explicit `--home` must be identical for setup and prepare. An existing installation refuses an implicit data-directory change or a dev/prod switch: use a different home rather than altering the old projects.-## Actions 默认轻量产物+The environment is embedded in `shared/template-config.json`; the resulting `install.json.templateEnvironment` identifies the installation. Studio and MCP read the same source. [Template configuration](template-catalog.md#environment-and-build) explains the current Resource and catalog behavior. Saving a CMS draft does not publish it. Refresh the catalog, find the template ID and record its catalog/publication version; existing projects are independent copies and do not change when a template is republished.-本仓库的 **Motion standalone checks** 手动工作流默认 `format=npm`,`format=full` 保留 Mac arm64 / Windows x64 完整 ZIP 组装。当前工作流只在 runner 内构建和校验,不上传 Actions 制品,不发布 npm、Release 或存储对象;两种格式误勾 `publish` 都会拒绝。公开下载服务不属于本次迁移。+For **source development**, `npm run dev` already selects DEV. An independently launched MCP can use `MOTION_TEMPLATE_ENV=dev MOTION_DATA_DIR=/absolute/isolated-dev-data npm run mcp`. For an installed package, advanced overrides must be supplied to the actual MCP/Agent process and inherited by the backend. Setting a shell variable only while running setup does not persist it into a later GUI host. Stop the owned old backend and reconnect after changing configuration. Prefer the embedded DEV package over editing installed files or sharing production data.-CI 在 Studio 构建后执行 `node scripts/package-npm.mjs dist/<beta> <beta>`,生成 `openmotion-installer-<beta>.tgz`、`openmotion-application-<beta>.tar.gz`、`release-npm.json` 与 SHA256 文件。安装器与应用/MCP 统一使用唯一 beta 版本;源 checkout 不被 bump,已有 beta 输出目录拒绝覆盖。清单同时固定应用、安装器、npm 锁文件与原生锁文件的 SHA256 和源码/构建身份。+There is no automatic fallback from prod to DEV and no `switch-env` CLI. This selects the template catalog, not model keys, accounts or every remote service.-本地生成制品后,将上文 npx 命令里的 tgz 替换为该 beta 文件,`--manifest` 指向相邻 `release-npm.json`。生产 npm 依赖在应用目录用 `npm ci` 安装;不是依赖消费者自动采用 tgz 内的 package-lock.json。一期应用按同一 phase1 注册表仅包含 11 个公开 Tool 和五个入口;平铺宿主升级会移除本安装器拥有的已退出入口,并保留其他宿主/用户技能。依赖和原生版本沿用迁移源锁文件。+## Host adapters and ownership-目标系统验收继续使用 `scripts/smoke-npm-package.mjs`,支持 `--codex` 对应的 `.js` / `.mjs` CLI 入口。检查实际安装、原生 Skill 发现、MCP、延迟下载、缓存、Studio、音画导出与技术校验;独立播放器和模型回合仍需单独验证。本仓库工作流当前执行 Linux 组装与九 Tool ZIP E2E,不包含 Windows 实机验收;Windows 与 Mac 的安装验收在对应机器运行,不能从组装成功推断通过。+| Host | Registration | Skills |+| --- | --- | --- |+| Codex | `codex mcp add openmotion` | Complete bundle under the selected Skills root |+| Claude Code | `claude mcp add-json -s user openmotion` | Flat entries under `${CLAUDE_CONFIG_DIR:-~/.claude}/skills` |+| DeepSeek Harness | `dsh plugin --profile web add <managed bundle> --ignore-scripts` | Its dedicated bundle/provider Skill root |+| WorkBuddy | Merge `mcpServers.openmotion` into its `mcp.json` | Flat entries under its configuration root |-## 按需下载与复用+Select `--host codex|claude|deepseek|workbuddy`. `--skills-dir` selects the Codex/Claude/WorkBuddy root; Harness uses its own provider. Executable overrides are `--codex`, `--claude`, `--dsh`; Harness also accepts `--profile`. Isolate host configuration with `CODEX_HOME`, `CLAUDE_CONFIG_DIR`, `DSH_HOME` or `WORKBUDDY_CONFIG_DIR`; `--home` controls the application installation, not the host profile.-setup 仅获取应用并按 lockfile 运行 `npm ci --omit=dev --ignore-scripts`,不运行依赖安装脚本、不下载原生工具。MCP 握手、工具发现、工作流和引擎指南资源读取也不触发原生下载。首次工程操作需要启动本地服务时(例如创建工程或打开预览),准备固定的 FFmpeg、ffprobe 和 Chromium;也可在安装后主动执行:+An installation can serve multiple hosts using the same home/data. `install.json.hosts` retains each host. Skill documentation links are rewritten for flat layouts; Codex/Harness retain bundle-relative links. Re-run setup for each installed host when upgrading Skills. Unowned same-name MCP/Skills are refused. Unrelated settings/Skills and existing projects are retained. Registration failure restores the prior install state and Skills; checked application caches remain available for retry.-```sh-npx --yes --package /absolute/dist/npm-local/openmotion-installer-0.6.3-local.1.tgz openmotion prepare --home /absolute/install-root-```+## Versions, upgrades and publication boundary-npm 可以通过带 `os/cpu` 的平台包及安装脚本自动配置原生程序。本渠道保留“首次使用再下载”的时机,因此由运行时按固定清单自动准备;不要求用户手动安装 FFmpeg/ffprobe,也不执行 brew/winget。+Explicit builds accept `MAJOR.MINOR.PATCH-test.N[.N]` or `MAJOR.MINOR.PATCH`. CI-generated candidates use next-patch `test.<run>.<attempt>`; manually assigned candidates can use `test.1`, `test.2`. Every artifact has one identity across the installer, app package/lock and plugin metadata. Build numbers never overwrite old output; source versions are not bumped by packaging.-原生依赖按 OS/CPU 和内容 SHA256 保存到用户缓存,采用互斥锁、校验后解包和完成标记,后续直接复用。下载失败不标记为可用;不会自动换版本或执行 brew/winget。显式指定 `HYPERFRAMES_FFMPEG_PATH` / `HYPERFRAMES_FFPROBE_PATH` / `HYPERFRAMES_BROWSER_PATH` 时使用用户的程序(旧媒体路径变量和 `MOTION_BROWSER_PATH` 也支持);缺失的组件仍按固定版本下载。Node/npm 由宿主已有环境提供,不随轻量包下载。+Source package manifests remain `private:true`. Only an explicitly versioned **prod** build produces publishable tgz metadata. test artifacts default to the `test` npm tag; stable artifacts default to `stage` so a later authorized registry smoke can precede moving `latest`. Local/default and DEV artifacts remain private. No command here publishes or changes npm tags. See [test and stable acceptance](release-guide.md) for separate maintainer authorization and gates.-固定源与完整测试包共用 `scripts/runtime-lock.json`,目前只有 Mac arm64、Windows x64。Mac 使用 [Martin Riedl 公开的 9.0.2 发布构建](https://ffmpeg.martin-riedl.de/):FFmpeg 和 ffprobe 分别固定带构建日期/版本的 ZIP 地址及上游 SHA256,分别缓存和验证,不使用 latest;Windows 继续使用固定 Gyan 公开归档。浏览器来自固定版本的 Chrome for Testing。所有原生下载均无需公司账号或仓库凭据,下载器不附带仓库 Token。安装器自动选择 OS/CPU、下载、校验和设置路径,用户不需要手动安装 FFmpeg/ffprobe。当前仍以 macOS 26、Windows 11 为已声明目标,按需下载不自动扩大系统兼容范围。+After publication, the intended user entry is `npx --yes --package @openmotion/installer@<exact-version> -- openmotion setup --host codex`, followed by `prepare` and host reconnection. `@test` and `@latest` select channels; acceptance always records the exact resolved version. Installing/running npx alone, publishing a new package or moving a tag does not update an existing managed app.-本地清单也允许显式 `file:` 资源,用于离线夹具或验证已冻结的原字节;同样检查 SHA256。HTTP、凭据嵌入 URL、非法解包路径或缺少校验值会被拒绝。被强制终止的安装可能留下 PID 锁;确认对应进程已经退出后才能删除锁重试。+Before upgrading, stop your own old MCP connections and incompatible backend, back up projects/configuration, run setup with the new exact tgz and the **same** home/data/Skills paths, prepare and reconnect. Do not terminate unrelated services. Older app directories may remain, but rollback requires a compatible old package and data; back up before an irreversible format change. There is no automatic update or arbitrary-version rollback promise.-## 本地验收+## Native tools and diagnostics-隔离设置四家各自的配置根,并通过 `--home`、`--skills-dir`、`--data-dir` 指定全新目录;不把测试安装进日常配置。验收最终 npm tgz、Skills 发现、宿主实际解析的 MCP 启动配置、首次原生下载、第二次缓存复用、Studio 以及一秒有声音和运动的导出。定向自动测试覆盖清单/路径校验、校验失败、锁、配置冲突、重复安装和失败回退。+The runtime lock pins HTTPS URLs, versions, target OS/CPU and SHA256 for FFmpeg, ffprobe and Chrome for Testing. Downloads require no repository credentials, never attach repository tokens, and do not run brew/winget. Separate component locks, temporary extraction and completion markers support retry/cache reuse. A failed download is not ready. Explicit native path overrides remain supported. See [runtime details](test-packages.md).-Installation, MCP connectivity and technical export checks do not replace model creation, independent playback or other operating-system acceptance. See the current [11-tool contract](mcp-phase1-tools.md). Record actual validation against the relevant commit in its PR or delivery log; earlier 28-tool or four-Skill prototype checks are not current phase-one acceptance.+A local `--manifest /absolute/release-npm.json` remains available for legacy delivery and controlled fixtures. HTTP, URL credentials, unsafe extraction paths and invalid hashes are rejected. Do not remove a leftover install lock until its owning process is confirmed stopped.-WorkBuddy 桌面对话/模型调用、Windows 实机和公网冷下载须分别验收。本渠道不改变系统支持范围,不新增发布、自动升级、账号或计费能力。+For defects, include exact package/app version, source SHA, OS/CPU, Node/Agent version, template environment/catalog version, project/revision, reproduction steps and redacted logs. Installation, native preparation, host discovery, model creation, technical MP4 checks and human playback are separate evidence. Follow the [acceptance manual](release-guide.md); unrun Windows/host/creation checks remain unrun.diff --git a/docs/product/architecture.md b/docs/product/architecture.mdindex 5fdf5549..faa5672d 100644--- a/docs/product/architecture.md+++ b/docs/product/architecture.md@@ -175,13 +175,15 @@ flowchart LR开始采集前需记录事件定义、观察窗口、样本来源和隐私边界。人物、商业和指标实验的证据写回对应文档,不能用开源仓库热度或模板原帖播放量替代。-## npm 本地安装渠道+## Application npm distribution-当前分支增加独立于插件的 npm 轻量安装入口(本地 / Actions 测试制品,不发布 npm):按宿主安装 Codex、Claude Code、DeepSeek Harness、WorkBuddy 的 一期 11 Tool MCP 与 production/director/template/recreate/video-to-template 五个 Skills,共用应用、工程目录和依赖缓存;固定原生依赖首次使用时下载到用户缓存。应用不从临时 npx 缓存运行,作品与应用/依赖目录分开;已有插件和完整测试包保留。下载来源、版本和校验值共用运行时清单;Mac FFmpeg/ffprobe 使用独立的公开 9.0.2 ZIP 并自动安装,原生依赖无需公司仓库凭据,尚未发布 npm。实现与验证边界见 [npm 安装](../npm-installation.md)。+The standalone npm tgz contains installer scripts, the prebuilt application archive and its pinned default manifest. Setup needs only that tgz, stages the checked application into a managed writable directory, installs production npm dependencies from its lock and registers the selected host's eleven MCP Tools and five Skills. It never runs the app or writes projects in the npx cache. Node/Agent remain user-provided; FFmpeg, ffprobe and the browser are checked downloads, deferred until prepare or native use. Existing plugin and complete platform ZIP channels remain available.++Explicit test/stable prod builds produce publishable artifact metadata with test/stage defaults; the source manifests and local/DEV artifacts stay private. Packaging does not publish, update users, move main or rename the repository. DEV packages embed their template source, default to a separate installation home and refuse cross-environment reuse. Application, project data, host configuration and dependency cache retain distinct ownership. See [installation](../npm-installation.md) and [test/stable acceptance](../release-guide.md).## 演进约束-本地测试包按 mac-arm64 / win-x64 准备固定公开原生依赖。npm 为默认轻量格式,完整 ZIP 为备用;平台安装和真实出片必须独立验收。工程保留在包外,当前 CI 只构建与校验,不上传或发布。见 [测试包说明](../test-packages.md)。+本地测试包按 mac-arm64 / win-x64 准备固定公开原生依赖。The application npm format is the default; complete platform ZIPs are backups. Native installation, Agent creation and human playback need separate evidence. Projects remain outside the package; CI only builds and validates, without upload or publication. See [package checks](../test-packages.md).已确认方向是继续支持多 Agent 接入、可编辑工程与一个工作区内的发现/制作闭环。diff --git a/docs/release-guide.md b/docs/release-guide.mdnew file mode 100644index 00000000..4aad953d--- /dev/null+++ b/docs/release-guide.md@@ -0,0 +1,49 @@+# Test and stable package acceptance++This is the maintainer and tester manual for the application npm format. It defines required checks, not a claim that all platforms or a published registry version have passed. [Installation](npm-installation.md) supplies macOS/PowerShell commands, DEV template setup, host adapters and recovery boundaries. Ordinary CI still does not upload or publish packages.++## One record per candidate++Record package name/exact version, full source SHA, CI run/attempt, tgz SHA256 and npm integrity when available, application/manifest and both lock hashes, template environment/Resource/locale/catalog version, OS/CPU/Node/npm/Agent versions, installation paths, results and evidence links, known problems, acceptance owner and prior usable version. Keep internal logs, credentials and user material outside public packages.++Use `0.6.4-test.1`, `0.6.4-test.2`, then `0.6.4` as examples, not previously published versions. Any changed release bytes require a new candidate identity. Never overwrite a published version or reuse a Git tag. Software channel and template environment are separate: public test/stable default to prod; local DEV candidates remain private and isolated.++## Test candidate acceptance++Before any authorized publication to the npm `test` tag:++1. Freeze a reviewed `feature/motion` commit. Run the required check/typecheck/Studio build, affected deterministic tests and current-head CI. Verify final package contents, public-boundary/secret scans, dependencies, licenses and disabled upstream telemetry.+2. Build the **final tgz once** into a new directory. Check all identities and hashes. Copy only that tgz to a clean consumer directory; no application sidecar or source checkout may be required by setup.+3. On each promised OS/CPU, use a clean npm cache, isolated Agent profile, app home, data and Skills roots. Install with the exact tgz, run prepare, reconnect and compare the actual Tools/Skills/resources with its manifest (currently 11 Tools and 5 Skills).+4. Test initial native downloads, checked executables, second-run cache reuse, same-version setup, wrong checksum, interrupted download/retry, ownership conflicts and failed host registration. Preserve existing user content and unrelated host settings.+5. In Studio and the actual Agent, find the same published template, read detail, create an independent editable copy and record the catalog/publication version. Test DEV/prod isolation, first-load failure, existing-cache warning, catalog refresh and preservation of existing projects as relevant.+6. Use fixed material and a real Agent task: create/adapt, preview, change copy/media, save/reopen and export MP4. Record project/revision and output. Technical decoded audio/video, real model creation and normal-speed human visual/audio playback have distinct results. Include version restore/cancel and other affected Tools when changed.++A first test candidate may be distributed with declared, accepted non-blocking issues after local package checks. Credential leakage, destructive updates, mixed environments, broken installation or missing required export are blockers. After separately authorized publication, repeat a **real registry cold install of the exact test version**; local tgz acceptance cannot prove registry availability. File failures against that identity and issue a new test version after fixes.++Mac arm64 and Windows x64 require separate results; absent runners are not passes. A fixture-tested adapter is not proof of a real host conversation. Mark PASS / FAIL / NOT RUN explicitly; flaky or infrastructure failures do not count as acceptance.++## Stable acceptance++1. Candidate blockers are resolved; remaining issues have an explicit acceptance owner and workaround. Required host/platform, true Agent creation and human playback results are complete.+2. Freeze stable source, dependencies and prod configuration. Build the stable version without `-test` once. The version change changes bytes: verify the **stable tgz** rather than renaming a test archive or copying its hash. Record the source/config delta against the accepted test candidate.+3. Repeat stable-package cold installation, prepare, template creation, preview/edit/save/export on all promised targets. Test upgrade from the prior test or stable release with existing projects/material/config retained; exercise compatible rollback or backup/restore. Do not promise older versions can read a migrated format without proof.+4. Confirm the exact public package/scope and authorized publisher. Explicit prod artifacts are publishable; source/local/DEV manifests stay private. The build does not publish. Test-candidate metadata selects `test`; stable metadata selects temporary `stage`, not `latest`.+5. Only after separate publication authorization: publish the verified stable tgz, install that exact registry version, then move `latest` after the registry check passes and announce supported platforms/known issues. A stage tag does not hide a public package. npm tags do not update machines already installed.++Maintainer commands below are examples, not automatically executed release steps:++```sh+npm publish /absolute/final-test.tgz --access public --tag test+npm publish /absolute/final-stable.tgz --access public --tag stage+# After exact stable registry-install acceptance and channel authorization:+npm dist-tag add <verified-package-name>@0.6.4 latest+```++Confirm npm ownership/authentication and target versions first. A public Release attachment is optional and independent of npm. Main cutover, repository rename and publication are different actions; none is implied by merging a feature PR or passing CI.++## Recovery and feedback++Stop recommending a failed candidate. Under channel-management authorization, point test/latest back to an already verified compatible version; do not overwrite/unpublish it as a recovery mechanism. Users still need an explicit compatible reinstall/reconnect or backup restoration. If there is no prior stable release, state that instead of inventing a rollback target.++Each defect needs exact package/source/OS/host/environment/catalog identity, project/revision, steps, expected/actual behavior, redacted logs and artifact links. Keep installation, host discovery, technical export, real creation and human acceptance as separate statuses.diff --git a/docs/template-catalog.md b/docs/template-catalog.mdindex 52862a3c..c08f863c 100644--- a/docs/template-catalog.md+++ b/docs/template-catalog.md@@ -2,11 +2,15 @@## 当前:Prism 目录、界面与 Agent 共用+For application npm DEV builds, isolated installation and source MCP overrides, follow [test template data](npm-installation.md#test-template-data-dev). npm test/latest selects software versions; it does not select the template environment.+模板通过一个 Prism Resource 的 `main.json` 发布。当前绑定 Resource `1500c9af-186b-457f-b74d-a58113f657d8`,默认语言 `zh-CN`。消费现有 `content[locale].templates`:templateId、sortOrder、original 展示信息、coverUrl、previewUrl 和 files(path/url/bytes/sha256)。不新增后台接口或另一套模板 Schema。Studio 使用发布的模板和三个内置示例;旧 891 条参考快照只供内部 legacy 工具与历史来源使用,不与发布目录混成两个可编辑来源。-### 环境与构建+<a id="环境与构建"></a>++### Environment and build| 入口 | 模板环境 || --- | --- |@@ -14,7 +18,7 @@ Studio 使用发布的模板和三个内置示例;旧 891 条参考快照只| `npm run package:phase1` | 线上:`r.open-design.ai` || `npm run package:phase1 -- --template-env=dev` | DEV,ZIP 文件名带 `-dev` || `npm run package:npm -- dist/npm-dev --template-env=dev` | DEV npm 安装产物;省略环境参数则为线上 |-| `npm run package:test -- build <target> <beta-version> --template-env=dev` | DEV 完整运行包;省略环境参数则为线上 |+| `npm run package:test -- build <target> <release-version> --template-env=dev` | DEV 完整运行包;省略环境参数则为线上 || Actions → Run workflow → `template_environment` | 选择 `prod`(默认)或 `dev`,适用于 npm 和完整 ZIP |环境写入包内 `shared/template-config.json`,不要求安装用户另设变量,GUI 和 MCP 读取同一配置。正式构建默认线上,不受打包机器的 `MOTION_TEMPLATE_ENV` 影响。运行时可显式用该变量覆盖包默认值;从源码独立启动 MCP 调试时设为 dev。diff --git a/docs/test-packages.md b/docs/test-packages.mdindex 984f02db..da7382d9 100644--- a/docs/test-packages.md+++ b/docs/test-packages.md@@ -2,24 +2,24 @@当前源码位于 仓库根目录;下列模块命令在该目录执行。活动工作流在仓库根目录 `.github/workflows/ci.yml`,发布保持关闭。迁移基线及历史验收范围见[迁移说明](repository-migration.md)。-MCP 公开入口由包内 `shared/mcp-release.json` 固化,详见[一期注册清单](mcp-phase1-tools.md)。`build <target> <beta-version> [legacy|phase1]` 将 profile 和工具名写入 `release.json`;默认沿用源码的 phase1,公开11个 motion_ Tool 并包含5个配套 Skill。缺注册时在创建 staging/ZIP 前失败;本次验证的插件 ZIP 不等于各平台完整原生包已重新验收。+MCP 公开入口由包内 `shared/mcp-release.json` 固化,详见[一期注册清单](mcp-phase1-tools.md)。`build <target> <release-version> [legacy|phase1]` 将 profile 和工具名写入 `release.json`;默认沿用源码的 phase1,公开11个 motion_ Tool 并包含5个配套 Skill。缺注册时在创建 staging/ZIP 前失败;本次验证的插件 ZIP 不等于各平台完整原生包已重新验收。本流程服务于团队试装和问题复现;当前只有测试渠道,尚未启用正式包或自动升级。编辑器和模板业务使用同一份源码。完整包同时包含模型网关 gateway/;供应商 Key 和本机 Agent 登录仍由用户配置,不随包分发。## 手动构建-合入后,在本仓库 → Actions → **Motion standalone checks** → Run workflow 选择 `format`。默认 `npm`,`full` 组装两个已声明目标的完整 ZIP。两种格式共用源码、锁定依赖和唯一 beta 版本。+合入后,在本仓库 → Actions → **Motion standalone checks** → Run workflow 选择 `format`。默认 `npm`,`full` 组装两个已声明目标的完整 ZIP。两种格式共用源码、锁定依赖和unique test versions。`template_environment` selects the configuration platform for either format: `prod` (default, `r.open-design.ai`) or `dev` (`r.powerformer.net`). Local builders accept `--template-env=dev|prod`. The choice is embedded in `shared/template-config.json` and recorded as `templateEnvironment` in the release manifest; Studio and MCP share it. DEV application archives and full ZIP manifests have a `-dev` suffix. This selects the template source, not a publication channel; publishing remains disabled. See [template configuration](template-catalog.md#环境与构建).| 选择 | 构建产物 | 运行时 || --- | --- | --- |-| `npm`(默认) | 轻量安装器 `.tgz`、应用 `.tar.gz`、`release-npm.json`、SHA256 | 目标机按应用 lockfile 安装 npm 依赖;首次需要时下载固定原生工具 |+| `npm`(默认) | Application npm `.tgz` with embedded app/manifest, plus external archive, release record and SHA256 | 目标机按应用 lockfile 安装 npm 依赖;首次需要时下载固定原生工具 || `full`(备用) | Mac arm64 / Windows x64 完整 ZIP、SHA256、`release-<target>.json` | 内置目标平台 Node、生产依赖和原生工具 |-当前 本仓库工作流只构建和校验,不上传 Actions 制品,不发布 npm、Release 或存储对象;两种格式误勾 `publish` 均会失败。本地构建的制品位于 `dist/`,按 [npm 安装说明](npm-installation.md) 使用相邻的安装器、应用归档和清单。+当前 本仓库工作流只构建和校验,不上传 Actions 制品,不发布 npm、Release 或存储对象;两种格式误勾 `publish` 均会失败。本地构建的制品位于 `dist/`,The tgz alone is sufficient for setup; adjacent application/manifest files are evidence and an explicit-manifest fallback. See [installation](npm-installation.md) and [test/stable acceptance](release-guide.md).-版本为 `下一补丁版本-beta.<run-number>.<attempt>`。例如源码 0.6.2 的第 42 次构建生成 0.6.3-beta.42.1。npm 安装器、应用 package.json、应用锁文件和 MCP 版本一致;清单记录源码 HEAD、构建身份和校验值,既有输出目录拒绝覆盖,源码版本不会被构建改写。+Explicit builds accept stable `MAJOR.MINOR.PATCH` or `MAJOR.MINOR.PATCH-test.N[.N]`. The CI helper selects next-patch `test.<run>.<attempt>` (for example, 0.6.3 → 0.6.4-test.42.1). All embedded identities agree; output directories cannot be overwritten and source versions do not change. DEV and unversioned local builds remain private; explicit prod test/stable metadata selects test/stage. Publication remains disabled.PR / main 工作流执行清单、类型、Studio 构建与回归、安装/打包测试,以及十一个 Tool 的真实 ZIP E2E。Linux 是组装与测试环境,不是已支持的用户运行平台。Mac / Windows 的最终安装和真实出片仍须在对应系统验收;当前 本仓库工作流没有 Windows 或 Mac 原生验收 job,不把产包成功写成通过。@@ -59,7 +59,7 @@ codex plugin list --marketplace openmotion-test## 本地复现与验收-默认轻量格式在 `npm ci`、`npm run build:studio` 后执行:+Default application npm format在 `npm ci`、`npm run build:studio` 后执行:```shversion=$(node scripts/test-package.mjs version 42 1)@@ -75,7 +75,7 @@ node scripts/smoke-npm-package.mjs "dist/$version/release-npm.json" /absolute/panpm run package:test -- prepare mac-arm64npm cinpm run build:studio-npm run package:test -- build mac-arm64 0.6.2-beta.42.1+npm run package:test -- build mac-arm64 0.6.4-test.42.1npm install --prefix .tools/codex-cli --ignore-scripts --no-audit --no-fund @openai/[email protected]node scripts/smoke-test-package.mjs <最终ZIP路径> .tools/codex-cli/node_modules/@openai/codex/bin/codex.js```diff --git a/packages/npm/package.json b/packages/npm/package.jsonindex 9a3f649e..30e62d66 100644--- a/packages/npm/package.json+++ b/packages/npm/package.json@@ -1,8 +1,8 @@{"name": "@openmotion/installer",- "version": "0.6.2-local.1",+ "version": "0.6.3-local.1","private": true,- "description": "Local-only OpenMotion MCP and Skills installer for Codex, Claude Code, DeepSeek Harness and WorkBuddy",+ "description": "OpenMotion application, MCP and Skills installer for local Agent hosts","type": "module","engines": {"node": ">=22.18.0"@@ -12,6 +12,9 @@},"files": ["scripts/",- "README.md"- ]+ "payload/",+ "README.md",+ "LICENSE"+ ],+ "license": "Apache-2.0"}diff --git a/scripts/distribution.ts b/scripts/distribution.tsindex 7e2485fc..4eed6157 100644--- a/scripts/distribution.ts+++ b/scripts/distribution.ts@@ -11,7 +11,7 @@ export const distributionDocuments = ['docs/product/architecture.md', 'docs/product/media-generation-design.md','docs/agent-adapters.md', 'docs/browser-runtime.md', 'docs/design-system.md', 'docs/editor-fork.md','docs/hyperframes.md', 'docs/mcp-phase1-tools.md', 'docs/model-gateway.md', 'docs/motion-director.md',- 'docs/motion-extension-scope.md', 'docs/npm-installation.md', 'docs/project-workspace.md',+ 'docs/motion-extension-scope.md', 'docs/npm-installation.md', 'docs/release-guide.md', 'docs/project-workspace.md','docs/repository-migration.md', 'docs/session-architecture.md', 'docs/shared-editor.md','docs/README.zh-CN.md', 'docs/usage.md', 'docs/motion-md.md', 'docs/motion-md.zh-CN.md','docs/collections/README.md', 'docs/collections/README.zh-CN.md',diff --git a/scripts/npm-installer.mjs b/scripts/npm-installer.mjsindex fa0e5459..11f9826a 100644--- a/scripts/npm-installer.mjs+++ b/scripts/npm-installer.mjs@@ -11,7 +11,8 @@ import { ensureNativeRuntime } from './npm-runtime.mjs';import { hostPlan, skillTargets, obsoleteSkills, checkSkillOwner, copyHostSkills } from './npm-hosts.mjs';export const managedBy = '@openmotion/installer';-const defaultHome = () => path.join(process.platform === 'win32' ? process.env.LOCALAPPDATA || os.homedir() : path.join(os.homedir(), '.local/share'), 'openmotion');+const bundledManifest = fileURLToPath(new URL('../payload/release-npm.json', import.meta.url));+const defaultHome = (environment = 'prod') => path.join(process.platform === 'win32' ? process.env.LOCALAPPDATA || os.homedir() : path.join(os.homedir(), '.local/share'), environment === 'dev' ? 'openmotion-dev' : 'openmotion');const contains = (parent, child) => { const rel = path.relative(parent, child); return rel === '' || (!rel.startsWith('..' + path.sep) && rel !== '..' && !path.isAbsolute(rel)); };export async function localManifest(filename) {@@ -37,8 +38,11 @@ export async function localManifest(filename) {}export async function setup(options) {- let { manifest: filename, home = defaultHome(), dataDirectory } = options;- const manifest = await localManifest(filename);+ const manifest = await localManifest(options.manifest || bundledManifest);+ if (!options.manifest) assert.equal(manifest.version, (await readJSON(new URL('../package.json', import.meta.url))).version, 'Bundled application must match the npm package version');+ const templateEnvironment = manifest.templateEnvironment ?? 'prod';+ assert(['dev', 'prod'].includes(templateEnvironment), 'Invalid template environment');+ let { home = defaultHome(templateEnvironment), dataDirectory } = options;home = await canonical(home);dataDirectory = await canonical(dataDirectory || path.join(home, 'data'));assert(!contains(dataDirectory, home) && !['apps', 'cache', 'hosts'].some(name => contains(path.join(home, name), dataDirectory)),@@ -48,6 +52,7 @@ export async function setup(options) {const stateFile = path.join(home, 'install.json'), previous = await readJSON(stateFile);assert(previous === null || previous.managedBy === managedBy, 'Installation directory belongs to another application');assert(!previous || previous.dataDirectory === dataDirectory, 'This installation already uses another data directory; choose a separate --home');+ assert(!previous || (previous.templateEnvironment ?? 'prod') === templateEnvironment, 'This installation uses another template environment; choose a separate --home');const launcher = path.join(home, 'run-mcp.mjs');if (!previous) await readFile(launcher).then(() => { throw new Error('Refusing to replace an unowned MCP launcher'); }, error => { if (error.code !== 'ENOENT') throw error; });const plan = await hostPlan(options, home, launcher, previous);@@ -67,6 +72,7 @@ export async function setup(options) {await extractArchive(archive, temporary);const pkg = await readJSON(path.join(temporary, 'package.json'));assert.equal(pkg?.version, manifest.version, 'Application version does not match manifest');+ if (manifest.templateEnvironment) assert.equal((await readJSON(path.join(temporary, 'shared/template-config.json')))?.environment, templateEnvironment, 'Application template environment does not match manifest');for (const file of ['mcp.ts', 'scripts/npm-runtime.mjs', 'studio/build/index.html', 'skills/motion-production/SKILL.md']) await readFile(path.join(temporary, file));assert(!contains(temporary, process.execPath), 'Node must remain external to the lightweight application');const npm = process.env.npm_execpath || path.join(path.dirname(process.execPath), process.platform === 'win32' ? 'node_modules/npm/bin/npm-cli.js' : '../lib/node_modules/npm/bin/npm-cli.js');@@ -98,7 +104,7 @@ export async function setup(options) {await writeAtomic(launcher, `import { readFile } from 'node:fs/promises';\nimport { spawn } from 'node:child_process';\nimport { pathToFileURL } from 'node:url';\nconst state = JSON.parse(await readFile(new URL('./install.json', import.meta.url), 'utf8'));\nawait (await import(pathToFileURL(state.appRoot + '/scripts/npm-runtime.mjs'))).configureNativeEnvironment(state.appRoot);\nconst child = spawn(process.execPath, ['--experimental-strip-types', state.appRoot + '/mcp.ts'], { cwd: state.appRoot, env: { ...process.env, MOTION_DATA_DIR: state.dataDirectory }, stdio: 'inherit', windowsHide: true });\nfor (const signal of ['SIGTERM', 'SIGINT']) process.on(signal, () => child.kill(signal));\nchild.once('error', error => { console.error(error.message); process.exitCode = 1; });\nchild.once('exit', code => { process.exitCode = code ?? 1; });\n`);wroteLauncher = true;const registered = previous?.hosts || (previous?.skillsDirectory ? { codex: { skillsDirectory: previous.skillsDirectory } } : {});- const state = { ...previous, managedBy, version: manifest.version, appRoot, dataDirectory, launcher,+ const state = { ...previous, managedBy, version: manifest.version, templateEnvironment, appRoot, dataDirectory, launcher,hosts: { ...registered, [plan.host]: plan.metadata },...(plan.host === 'codex' ? { skillsDirectory: targets[0] } : {}) };await writeJSON(stateFile, state); wroteState = true;@@ -123,12 +129,12 @@ async function main() {manifest: { type: 'string' }, home: { type: 'string' }, 'data-dir': { type: 'string' }, 'skills-dir': { type: 'string' }, host: { type: 'string' }, codex: { type: 'string' }, claude: { type: 'string' }, dsh: { type: 'string' }, profile: { type: 'string' },} });const [command] = positionals;- assert(positionals.length === 1, 'Usage: openmotion setup --host codex|claude|deepseek|workbuddy --manifest FILE [--home DIR] [--data-dir DIR] [--skills-dir DIR] [--codex EXECUTABLE] | prepare --home DIR');+ assert(positionals.length === 1, 'Usage: openmotion setup --host codex|claude|deepseek|workbuddy [--manifest FILE] [--home DIR] [--data-dir DIR] [--skills-dir DIR] [--codex EXECUTABLE] | prepare --home DIR');if (command === 'setup') {- assert(values.manifest, 'Local validation requires --manifest FILE; no public release is configured');console.log(JSON.stringify(await setup({ manifest: values.manifest, home: values.home, dataDirectory: values['data-dir'], skillsDirectory: values['skills-dir'], host: values.host, codex: values.codex, claude: values.claude, dsh: values.dsh, profile: values.profile }), null, 2));} else if (command === 'prepare') {- const state = await readJSON(path.join(values.home || defaultHome(), 'install.json'));+ const environment = (await readJSON(bundledManifest))?.templateEnvironment;+ const state = await readJSON(path.join(values.home || defaultHome(environment), 'install.json'));assert(state?.managedBy === managedBy, 'Run setup first');await ensureNativeRuntime(state.appRoot);console.log('Pinned FFmpeg, ffprobe and browser are ready.');diff --git a/scripts/package-npm.mjs b/scripts/package-npm.mjsindex 7783f91b..ca218038 100644--- a/scripts/package-npm.mjs+++ b/scripts/package-npm.mjs@@ -7,6 +7,7 @@ import { PUPPETEER_REVISIONS } from 'puppeteer-core';import { releaseProfile } from '../shared/mcp-registry.ts';import { distributionFiles } from './distribution.ts';import { packageTemplateConfig } from '../shared/template-config.ts';+import { checkReleaseVersion } from './test-package.mjs';const root = fileURLToPath(new URL('../', import.meta.url));export function checkReleaseLocks(pkg, lockfile, runtime) {@@ -34,15 +35,17 @@ export function checkReleaseLocks(pkg, lockfile, runtime) {export async function packageNpm(output = path.join(root, 'dist/npm-local'), version, templateEnvironment = 'prod') {const templateConfig = packageTemplateConfig(templateEnvironment);output = path.resolve(output);- if (version) assert.match(version, /^\d+\.\d+\.\d+-beta\.[1-9]\d*\.[1-9]\d*$/, 'Use a unique beta run and attempt');+ const explicitVersion = version !== undefined;+ if (explicitVersion) checkReleaseVersion(version);const pkg = JSON.parse(await readFile(path.join(root, 'package.json'), 'utf8'));const lockfile = JSON.parse(await readFile(path.join(root, 'package-lock.json'), 'utf8'));const runtime = JSON.parse(await readFile(path.join(root, 'scripts/runtime-lock.json'), 'utf8'));checkReleaseLocks(pkg, lockfile, runtime);+ version ??= pkg.version + '-local.1';const { mcpRegistry } = await import('../mcp.ts');const registry = mcpRegistry();await mkdir(output, { recursive: true });- if (version) assert.equal((await readdir(output)).length, 0, 'Use a new output directory; beta artifacts are immutable');+ assert.equal((await readdir(output)).length, 0, 'Use a new output directory; artifacts are immutable');const temporary = await mkdtemp(path.join(output, '.build-'));try {const application = path.join(temporary, 'application'), installer = path.join(temporary, 'installer');@@ -56,30 +59,35 @@ export async function packageNpm(output = path.join(root, 'dist/npm-local'), verfor (const name of ['runtime-assets.mjs', 'npm-runtime.mjs', 'npm-hosts.mjs', 'npm-installer.mjs']) await cp(path.join(root, 'scripts', name), path.join(installer, 'scripts', name));await chmod(path.join(installer, 'scripts/npm-installer.mjs'), 0o755);const installerPkg = JSON.parse(await readFile(path.join(root, 'packages/npm/package.json'), 'utf8'));- if (version) installerPkg.version = version;- assert.equal(installerPkg.private, true, 'The installer must remain unpublished');+ assert.equal(installerPkg.private, true, 'Keep the source package protected; publish only an explicitly versioned artifact');+ installerPkg.version = version;+ installerPkg.private = !explicitVersion || templateConfig.environment === 'dev';+ installerPkg.publishConfig = { access: 'public', registry: 'https://registry.npmjs.org/', tag: version.includes('-test.') ? 'test' : 'stage' };await writeJSON(path.join(installer, 'package.json'), installerPkg);await cp(path.join(root, 'docs/npm-installation.md'), path.join(installer, 'README.md'));- if (version) {- pkg.version = version; lockfile.version = version; lockfile.packages[''].version = version;- await writeJSON(path.join(application, 'package.json'), pkg);- await writeJSON(path.join(application, 'package-lock.json'), lockfile);- const plugin = JSON.parse(await readFile(path.join(application, '.codex-plugin/plugin.json'), 'utf8'));- plugin.version = version;- await writeJSON(path.join(application, '.codex-plugin/plugin.json'), plugin);- }+ await cp(path.join(root, 'LICENSE'), path.join(installer, 'LICENSE'));+ pkg.version = version; lockfile.version = version; lockfile.packages[''].version = version;+ await writeJSON(path.join(application, 'package.json'), pkg);+ await writeJSON(path.join(application, 'package-lock.json'), lockfile);+ const plugin = JSON.parse(await readFile(path.join(application, '.codex-plugin/plugin.json'), 'utf8'));+ plugin.version = version;+ await writeJSON(path.join(application, '.codex-plugin/plugin.json'), plugin);const archive = path.join(output, `openmotion-application-${pkg.version}${templateConfig.environment === 'dev' ? '-dev' : ''}.tar.gz`);await runFile(process.platform === 'win32' ? path.join(process.env.SystemRoot, 'System32/tar.exe') : 'tar', ['-czf', archive, '-C', application, '.'], { env: { ...process.env, COPYFILE_DISABLE: '1' } });- const npm = process.env.npm_execpath || path.join(path.dirname(process.execPath), process.platform === 'win32' ? 'node_modules/npm/bin/npm-cli.js' : '../lib/node_modules/npm/bin/npm-cli.js');- const packed = JSON.parse(await runFile(process.execPath, [npm, 'pack', '--json', '--ignore-scripts', '--pack-destination', output], { cwd: installer }))[0];- const installerFile = path.join(output, packed.filename);const manifest = { schemaVersion: 1, version: pkg.version, format: 'npm', templateEnvironment: templateConfig.environment,commit: (await runFile('git', ['rev-parse', 'HEAD'], { cwd: root })).trim(), run: process.env.GITHUB_RUN_ID || null, attempt: process.env.GITHUB_RUN_ATTEMPT || '1',application: { url: './' + path.basename(archive), sha256: await sha256(archive) },- installer: { version: installerPkg.version, url: './' + packed.filename, sha256: await sha256(installerFile) },locks: { npm: await sha256(path.join(application, 'package-lock.json')), native: await sha256(path.join(root, 'scripts/runtime-lock.json')) },mcp: { profile: registry.profile, tools: registry.tools.map(tool => tool.name) }, skills, runtime };- const manifestPath = path.join(output, version ? 'release-npm.json' : 'release.local.json');+ // The embedded manifest omits the containing tgz's identity to avoid a self-hash cycle.+ await mkdir(path.join(installer, 'payload'));+ await cp(archive, path.join(installer, 'payload', path.basename(archive)));+ await writeJSON(path.join(installer, 'payload/release-npm.json'), manifest);+ const npm = process.env.npm_execpath || path.join(path.dirname(process.execPath), process.platform === 'win32' ? 'node_modules/npm/bin/npm-cli.js' : '../lib/node_modules/npm/bin/npm-cli.js');+ const packed = JSON.parse(await runFile(process.execPath, [npm, 'pack', '--json', '--ignore-scripts', '--pack-destination', output], { cwd: installer }))[0];+ const installerFile = path.join(output, packed.filename);+ manifest.installer = { version, url: './' + packed.filename, sha256: await sha256(installerFile) };+ const manifestPath = path.join(output, explicitVersion ? 'release-npm.json' : 'release.local.json');await writeJSON(manifestPath, manifest);for (const file of [archive, installerFile, manifestPath]) await writeAtomic(file + '.sha256', `${await sha256(file)} ${path.basename(file)}\n`);return { installer: installerFile, installerBytes: packed.size, application: archive, manifest: manifestPath };diff --git a/scripts/smoke-npm-package.mjs b/scripts/smoke-npm-package.mjsindex 43474149..cfc4c6bd 100644--- a/scripts/smoke-npm-package.mjs+++ b/scripts/smoke-npm-package.mjs@@ -1,5 +1,5 @@import assert from 'node:assert/strict';-import { access, mkdir, mkdtemp, readFile, readdir, writeFile } from 'node:fs/promises';+import { access, cp, mkdir, mkdtemp, readFile, readdir, writeFile } from 'node:fs/promises';import os from 'node:os';import path from 'node:path';import { fileURLToPath } from 'node:url';@@ -21,10 +21,12 @@ export async function smokeNpm(filename, codexJS) {const profile = path.join(out, 'codex'), project = path.join(out, 'project'), skills = path.join(project, '.agents/skills');await mkdir(profile); await mkdir(project);await writeFile(path.join(profile, 'config.toml'), 'cli_auth_credentials_store = "file"\nmcp_oauth_credentials_store = "file"\n[mcp_servers.unrelated]\ncommand = "keep-this-server"\n');- const env = { ...process.env, CODEX_HOME: profile, PORT: process.env.D4_LANE_PORT_RANGE?.split('-')[0] || process.env.SEATS_PORT || process.env.PORT || String(await testPort()) };+ const candidate = path.join(out, 'candidate.tgz');+ await cp(installer, candidate);+ const env = { ...process.env, npm_config_cache: path.join(out, 'npm-cache'), CODEX_HOME: profile, PORT: process.env.D4_LANE_PORT_RANGE?.split('-')[0] || process.env.SEATS_PORT || process.env.PORT || String(await testPort()) };for (const key of ['HYPERFRAMES_FFMPEG_PATH', 'HYPERFRAMES_FFPROBE_PATH', 'HYPERFRAMES_BROWSER_PATH', 'FFMPEG_PATH', 'FFPROBE_PATH', 'MOTION_BROWSER_PATH']) delete env[key];const npm = process.env.npm_execpath || path.join(path.dirname(process.execPath), process.platform === 'win32' ? 'node_modules/npm/bin/npm-cli.js' : '../lib/node_modules/npm/bin/npm-cli.js');- const setup = [npm, 'exec', '--yes', '--package', installer, '--', 'openmotion', 'setup', '--host', 'codex', '--manifest', filename, '--home', home, '--data-dir', data, '--skills-dir', skills, '--codex', codexJS];+ const setup = [npm, 'exec', '--yes', '--package', candidate, '--', 'openmotion', 'setup', '--host', 'codex', '--home', home, '--data-dir', data, '--skills-dir', skills, '--codex', codexJS];console.error('Install final npm artifact into isolated profile: ' + out);const first = JSON.parse(await runFile(process.execPath, setup, { env, cwd: project }));const again = JSON.parse(await runFile(process.execPath, setup, { env, cwd: project }));@@ -44,14 +46,16 @@ export async function smokeNpm(filename, codexJS) {const installed = JSON.parse(await runFile(process.execPath, [codexJS, 'mcp', 'get', 'openmotion', '--json'], { env, cwd: project }));assert.equal(installed.transport.command, process.execPath); assert.deepEqual(installed.transport.args, [first.launcher]);const native = await nativeConfiguration(first.appRoot);+ await assert.rejects(access(path.join(home, 'cache/native')), { code: 'ENOENT' });+ // Three sequential native downloads each have a five-minute bound; allow extraction as well.+ await runFile(process.execPath, [npm, 'exec', '--yes', '--package', candidate, '--', 'openmotion', 'prepare', '--home', home], { env, cwd: project, timeout: 16 * 60_000 });const reportFile = path.join(path.dirname(filename), `smoke-npm-${target}.json`);const report = await acceptTransport({ transport: { ...installed.transport, cwd: first.appRoot },env: { ...env, PATH: process.platform === 'win32' ? path.join(process.env.SystemRoot, 'System32') : '/usr/bin:/bin' }, data,metadata: { ...manifest, target }, archive: installer, ffmpeg: native.paths.HYPERFRAMES_FFMPEG_PATH, reportFile,- deferredNativeDirectory: path.join(home, 'cache/native'),- installation: { format: 'npm', applicationSHA256: manifest.application.sha256, npmLockSHA256: manifest.locks.npm, nativeLockSHA256: manifest.locks.native, repeatInstall: 'passed', nativeSkills: 'passed', deferredNativeDownload: 'passed', isolatedDirectory: out } });+ installation: { format: 'npm', applicationSHA256: manifest.application.sha256, npmLockSHA256: manifest.locks.npm, nativeLockSHA256: manifest.locks.native, repeatInstall: 'passed', nativeSkills: 'passed', setupDefersNativeDownload: 'passed', explicitNativePreparation: 'passed', bundledApplicationInstall: 'passed', isolatedDirectory: out } });const before = await readFile(path.join(native.cache, 'browser-' + native.info.browser.sha256, 'ready.json'), 'utf8');- await runFile(process.execPath, [npm, 'exec', '--yes', '--package', installer, '--', 'openmotion', 'prepare', '--home', home], { env, cwd: project });+ await runFile(process.execPath, [npm, 'exec', '--yes', '--package', candidate, '--', 'openmotion', 'prepare', '--home', home], { env, cwd: project });assert.equal(await readFile(path.join(native.cache, 'browser-' + native.info.browser.sha256, 'ready.json'), 'utf8'), before);report.nativeCacheReuse = 'passed';await writeFile(reportFile, JSON.stringify(report, null, 2) + '\n');diff --git a/scripts/test-package.mjs b/scripts/test-package.mjsindex ab719a59..42b3eb4c 100644--- a/scripts/test-package.mjs+++ b/scripts/test-package.mjs@@ -18,11 +18,14 @@ export function targetInfo(target) {assert(info, `Unsupported target: ${target}`);return info;}+export function checkReleaseVersion(version) {+ assert.match(version, /^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-test\.[1-9]\d*(?:\.[1-9]\d*)*)?$/, 'Use MAJOR.MINOR.PATCH or MAJOR.MINOR.PATCH-test.N[.N]');+}export function testVersion(base, run, attempt = '1') {assert(/^\d+\.\d+\.\d+$/.test(base), 'Source version must be MAJOR.MINOR.PATCH');assert(/^[1-9]\d*$/.test(String(run)) && /^[1-9]\d*$/.test(String(attempt)), 'Use positive run and attempt numbers');const [major, minor, patch] = base.split('.').map(Number);- return `${major}.${minor}.${patch + 1}-beta.${run}.${attempt}`;+ return `${major}.${minor}.${patch + 1}-test.${run}.${attempt}`;}export async function run(command, args, options = {}) {await new Promise((resolve, reject) => {@@ -71,7 +74,7 @@ export async function prepare(target) {export async function build(target, version, profile = releaseProfile, templateEnvironment = 'prod') {const info = targetInfo(target);const templateConfig = packageTemplateConfig(templateEnvironment);- assert(/^\d+\.\d+\.\d+-beta\.\d+\.\d+$/.test(version), 'Only uniquely numbered beta packages are supported');+ checkReleaseVersion(version);const { mcpRegistry } = await import('../mcp.ts');const registry = mcpRegistry(profile);const suffix = templateConfig.environment === 'dev' ? '-dev' : '';@@ -114,7 +117,7 @@ export async function build(target, version, profile = releaseProfile, templateEchild.stdout.on('data', chunk => { value += chunk; }); child.once('error', reject);child.once('exit', code => code === 0 ? resolve(value.trim()) : reject(new Error('git rev-parse failed')));});- const metadata = { schemaVersion: 1, version, channel: 'prerelease', templateEnvironment: templateConfig.environment, commit, run: process.env.GITHUB_RUN_ID || null,+ const metadata = { schemaVersion: 1, version, channel: version.includes('-test.') ? 'test' : 'stable', templateEnvironment: templateConfig.environment, commit, run: process.env.GITHUB_RUN_ID || null,mcp: { profile, tools: registry.tools.map(tool => tool.name) },attempt: process.env.GITHUB_RUN_ATTEMPT || '1', target, minimumOS: info.minimumOS, builtOn: `${process.platform}-${process.arch}`,runtime: { node: lock.node, chromium: lock.chromium, ffmpeg: lock.ffmpeg, hyperframes: lock.hyperframes } };@@ -134,5 +137,5 @@ if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meif (command === 'prepare') console.log(JSON.stringify(await prepare(target)));else if (command === 'build') console.log(JSON.stringify(await build(target, version, profile, flag?.split('=')[1])));else if (command === 'version') console.log(testVersion(JSON.parse(await readFile(path.join(root, 'package.json'), 'utf8')).version, target, version));- else throw new Error('Usage: test-package.mjs prepare <target> | build <target> <beta-version> [legacy|phase1] [--template-env=dev|prod] | version <run> <attempt>');+ else throw new Error('Usage: test-package.mjs prepare <target> | build <target> <release-version> [legacy|phase1] [--template-env=dev|prod] | version <run> <attempt>');}diff --git a/tests/npm-installer.test.ts b/tests/npm-installer.test.tsindex f61ce44e..c0be0246 100644--- a/tests/npm-installer.test.ts+++ b/tests/npm-installer.test.ts@@ -1,6 +1,6 @@import test from 'node:test';import assert from 'node:assert/strict';-import { chmod, mkdir, mkdtemp, readFile, readdir, rm, symlink, writeFile } from 'node:fs/promises';+import { chmod, cp, mkdir, mkdtemp, readFile, readdir, rm, symlink, writeFile } from 'node:fs/promises';import path from 'node:path';import { tmpdir } from 'node:os';import { pathToFileURL } from 'node:url';@@ -32,9 +32,10 @@ function clearNativeEnvironment(t: any) {}async function setupFixture(t: any) {const directory = await fixture(t), application = path.join(directory, 'source'), home = path.join(directory, 'install'), skillsDirectory = path.join(directory, 'skills');- for (const name of ['scripts', 'studio/build', 'skills/motion-production', 'docs']) await mkdir(path.join(application, name), { recursive: true });+ for (const name of ['scripts', 'shared', 'studio/build', 'skills/motion-production', 'docs']) await mkdir(path.join(application, name), { recursive: true });for (const name of ['mcp.ts', 'scripts/npm-runtime.mjs', 'studio/build/index.html', 'README.md', 'AGENTS.md', 'CLAUDE.md']) await writeFile(path.join(application, name), 'fixture');await writeFile(path.join(application, 'skills/motion-production/SKILL.md'), '---\nname: motion-production\ndescription: fixture\n---\nFixture');+ await writeJSON(path.join(application, 'shared/template-config.json'), { environment: 'prod' });await writeJSON(path.join(application, 'package.json'), { name: 'motion-fixture', version: '1.2.3', private: true });await writeJSON(path.join(application, 'package-lock.json'), { name: 'motion-fixture', version: '1.2.3', lockfileVersion: 3, packages: { '': { name: 'motion-fixture', version: '1.2.3' } } });const manifest = path.join(directory, 'release.json');@@ -46,6 +47,40 @@ async function setupFixture(t: any) {return { directory, application, home, skillsDirectory, manifest, codex, config };}+test('bundled CLI installs without a sidecar manifest, isolates DEV defaults and rejects a mixed-environment home', async t => {+ const options = await setupFixture(t), bundle = path.join(options.directory, 'bundle');+ await mkdir(path.join(bundle, 'scripts'), { recursive: true }); await mkdir(path.join(bundle, 'payload'));+ for (const file of ['npm-installer.mjs', 'npm-hosts.mjs', 'npm-runtime.mjs', 'runtime-assets.mjs']) {+ await cp(new URL('../scripts/' + file, import.meta.url), path.join(bundle, 'scripts', file));+ }+ await writeJSON(path.join(bundle, 'package.json'), { version: '1.2.3', type: 'module' });+ const metadata = JSON.parse(await readFile(options.manifest, 'utf8'));+ metadata.templateEnvironment = 'dev';+ await writeJSON(path.join(options.application, 'shared/template-config.json'), { environment: 'dev' });+ metadata.application = await archive(options.directory, options.application, 'dev-application');+ await cp(new URL(metadata.application.url), path.join(bundle, 'payload/application.tar.gz'));+ metadata.application.url = './application.tar.gz';+ await writeJSON(path.join(bundle, 'payload/release-npm.json'), metadata);+ const env = { ...process.env, HOME: options.directory, USERPROFILE: options.directory, LOCALAPPDATA: options.directory,+ WORKBUDDY_CONFIG_DIR: path.join(options.directory, 'buddy'), npm_config_cache: path.join(options.directory, 'npm-cache') };+ const cli = path.join(bundle, 'scripts/npm-installer.mjs');+ const command = [cli, 'setup', '--host', 'workbuddy', '--skills-dir', options.skillsDirectory];+ const first = JSON.parse(await runFile(process.execPath, command, { env }));+ assert.equal(path.basename(path.dirname(first.launcher)), 'openmotion-dev');+ assert.equal(first.templateEnvironment, 'dev');+ assert.equal((await runFile(process.execPath, command, { env })).includes(first.appRoot), true);+ const stateBefore = await readFile(path.join(path.dirname(first.launcher), 'install.json'), 'utf8');+ metadata.templateEnvironment = 'prod';+ await writeJSON(path.join(bundle, 'payload/release-npm.json'), metadata);+ await assert.rejects(runFile(process.execPath, [...command, '--home', path.dirname(first.launcher)], { env }), /another template environment/);+ assert.equal(await readFile(path.join(path.dirname(first.launcher), 'install.json'), 'utf8'), stateBefore);+ await assert.rejects(runFile(process.execPath, [cli, 'setup', '--host', 'workbuddy', '--home', path.join(options.directory, 'other-app'), '--skills-dir', path.join(options.directory, 'other-skills')], {+ env: { ...env, WORKBUDDY_CONFIG_DIR: path.join(options.directory, 'other-buddy') },+ }), /template environment does not match manifest/);+ await writeJSON(path.join(bundle, 'package.json'), { version: '9.9.9', type: 'module' });+ await assert.rejects(runFile(process.execPath, command, { env }), /match the npm package version/);+});+test('local assets require pinned checksums and preserve earlier cache after corruption', async t => {const dir = await fixture(t), source = path.join(dir, 'source'), destination = path.join(dir, 'cached');await writeFile(source, 'corrupted'); await writeFile(destination, 'keep');diff --git a/tests/npm-package.test.ts b/tests/npm-package.test.tsindex 57b34e70..c19c1041 100644--- a/tests/npm-package.test.ts+++ b/tests/npm-package.test.ts@@ -25,13 +25,13 @@ test('release packaging rejects floating npm versions, lock drift, unpinned natiassert.throws(() => checkReleaseLocks(pkg, lock, browser), /Browser must match/);});-test('beta npm artifacts carry one immutable version, both lock identities and no bundled native runtime', { timeout: 60_000 }, async () => {+test('test npm artifacts contain their application, locked manifest and no bundled native runtime', { timeout: 60_000 }, async () => {const directory = await mkdtemp(path.join(tmpdir(), 'motion-npm-pack-'));const before = await readFile('package.json', 'utf8');const unapproved = ['docs/private-sentinel.md', 'scripts/private-sentinel.mjs', 'private-sentinel.ts'];for (const file of unapproved) await writeFile(file, 'must not ship');try {- const version = '0.6.2-beta.999001.1', output = path.join(directory, 'build');+ const version = '0.6.4-test.1', output = path.join(directory, 'build');const built = await packageNpm(output, version), release = await json(built.manifest);assert.equal(release.version, version); assert.equal(release.installer.version, version); assert.equal(release.format, 'npm');assert.equal(release.templateEnvironment, 'prod');@@ -46,7 +46,16 @@ test('beta npm artifacts carry one immutable version, both lock identities and nassert.equal((await json(path.join(application, '.codex-plugin/plugin.json'))).version, version);assert.equal((await json(path.join(application, 'package-lock.json'))).packages[''].version, version);assert.equal((await json(path.join(installer, 'package/package.json'))).version, version);- assert.equal((await json(path.join(installer, 'package/package.json'))).private, true);+ assert.equal((await json(path.join(installer, 'package/package.json'))).private, false);+ const bundled = path.join(installer, 'package/payload');+ const embedded = await json(path.join(bundled, 'release-npm.json'));+ assert.equal(embedded.installer, undefined, 'The containing archive cannot include its own hash');+ assert.equal(embedded.version, version);+ assert.equal(await sha256(path.join(bundled, embedded.application.url)), release.application.sha256);+ const metadata = await json(path.join(installer, 'package/package.json'));+ assert.equal(metadata.publishConfig.tag, 'test'); assert.equal(metadata.publishConfig.access, 'public');+ assert.equal(metadata.bin.openmotion, 'scripts/npm-installer.mjs');+ await readFile(path.join(installer, 'package/LICENSE'));assert.deepEqual((await readdir(path.join(application, 'skills'))).sort(), [...phase1Skills].sort());assert.equal(await sha256(path.join(application, 'package-lock.json')), release.locks.npm);assert.equal(await sha256(path.join(application, 'scripts/runtime-lock.json')), release.locks.native);@@ -64,7 +73,7 @@ test('beta npm artifacts carry one immutable version, both lock identities and nassert(entries.includes('template-library/NOTICE.md'));assert(!entries.includes('studio/build/index.html.map'));await assert.rejects(packageNpm(output, version), /immutable/);- await assert.rejects(packageNpm(path.join(directory, 'invalid'), 'latest'), /unique beta/);+ await assert.rejects(packageNpm(path.join(directory, 'invalid'), 'latest'), /MAJOR.MINOR.PATCH/);assert.equal(await readFile('package.json', 'utf8'), before, 'Packaging must not bump the checkout');} finally {for (const file of unapproved) await rm(file, { force: true });@@ -76,8 +85,11 @@ test('DEV npm packages carry their catalog environment without changing the checconst directory = await mkdtemp(path.join(tmpdir(), 'motion-npm-dev-'));try {const before = await readFile('shared/template-config.json', 'utf8');- const built = await packageNpm(path.join(directory, 'build'), undefined, 'dev');+ const built = await packageNpm(path.join(directory, 'build'), '0.6.4-test.2', 'dev');assert.equal((await json(built.manifest)).templateEnvironment, 'dev');+ const unpacked = path.join(directory, 'npm'); await extractArchive(built.installer, unpacked);+ assert.equal((await json(path.join(unpacked, 'package/package.json'))).private, true);+ assert.equal((await json(built.manifest)).installer.version, (await json(built.manifest)).version);assert.match(built.application, /-dev\.tar\.gz$/);const application = path.join(directory, 'app');await extractArchive(built.application, application);@@ -86,6 +98,23 @@ test('DEV npm packages carry their catalog environment without changing the chec} finally { await rm(directory, { recursive: true, force: true }); }});+test('stable artifacts stage publication instead of replacing latest and retain source publish guards', { timeout: 60_000 }, async () => {+ const directory = await mkdtemp(path.join(tmpdir(), 'motion-npm-stable-'));+ try {+ const built = await packageNpm(path.join(directory, 'build'), '0.6.4');+ await extractArchive(built.installer, path.join(directory, 'npm'));+ const metadata = await json(path.join(directory, 'npm/package/package.json'));+ assert.equal(metadata.version, '0.6.4'); assert.equal(metadata.private, false); assert.equal(metadata.publishConfig.tag, 'stage');+ assert.equal((await json('package.json')).private, true);+ assert.equal((await json('packages/npm/package.json')).private, true);+ const local = await packageNpm(path.join(directory, 'local'));+ await extractArchive(local.installer, path.join(directory, 'local-npm'));+ const localPkg = await json(path.join(directory, 'local-npm/package/package.json'));+ assert.equal(localPkg.private, true); assert.match(localPkg.version, /-local\.1$/);+ assert.equal((await json(local.manifest)).version, localPkg.version);+ } finally { await rm(directory, { recursive: true, force: true }); }+});+test('the actual dispatch validation permits unpublished npm and backup ZIP, and rejects npm publication', async () => {const workflow = await readFile(new URL('../.github/workflows/ci.yml', import.meta.url), 'utf8');const step = workflow.split(' - name: Validate manual package selection\n')[1].split(' - name:')[0];@@ -109,7 +138,7 @@ test('manual CI passes the selected template environment to both package formatsconst step = workflow.split(' - name: Build immutable standalone artifacts\n')[1].split(' - name:')[0];const script = step.split(' run: |\n')[1].replace(/^ {10}/gm, '');const calls = path.join(directory, 'calls.txt');- await writeFile(path.join(directory, 'node'), '#!/bin/sh\nprintf "%s\\n" "$*" >> "$MOTION_PACKAGE_CALLS"\nif [ "$2" = version ]; then echo 0.6.4-beta.42.1; fi\n', { mode: 0o755 });+ await writeFile(path.join(directory, 'node'), '#!/bin/sh\nprintf "%s\\n" "$*" >> "$MOTION_PACKAGE_CALLS"\nif [ "$2" = version ]; then echo 0.6.4-test.42.1; fi\n', { mode: 0o755 });for (const format of ['npm', 'full']) for (const environment of ['prod', 'dev']) {await writeFile(calls, '');await runFile('bash', ['-c', script], { env: { ...process.env,@@ -118,10 +147,10 @@ test('manual CI passes the selected template environment to both package formats} });const commands = (await readFile(calls, 'utf8')).trim().split('\n');assert.deepEqual(commands, ['scripts/test-package.mjs version 42 1', ...(format === 'npm'- ? [`scripts/package-npm.mjs dist/0.6.4-beta.42.1 0.6.4-beta.42.1 --template-env=${environment}`]+ ? [`scripts/package-npm.mjs dist/0.6.4-test.42.1 0.6.4-test.42.1 --template-env=${environment}`]: ['mac-arm64', 'win-x64'].flatMap(target => [`scripts/test-package.mjs prepare ${target}`,- `scripts/test-package.mjs build ${target} 0.6.4-beta.42.1 --template-env=${environment}`,+ `scripts/test-package.mjs build ${target} 0.6.4-test.42.1 --template-env=${environment}`,]))]);}} finally { await rm(directory, { recursive: true, force: true }); }diff --git a/tests/package.test.ts b/tests/package.test.tsindex 4c2d7730..a2bf430c 100644--- a/tests/package.test.ts+++ b/tests/package.test.ts@@ -7,6 +7,7 @@ import { getWorkflow, workflowRegistry } from '../shared/workflow.ts';test('every distribution preserves public workflow dependencies and licenses while excluding development material', async () => {for (const profile of ['phase1', 'legacy']) {const files = new Set(await distributionFiles(profile));+ assert(files.has('docs/release-guide.md'), 'The public test/stable manual must ship');for (const file of ['studio/build/index.html', 'studio/LICENSE', 'template-library/LICENSE', 'template-library/NOTICE.md', 'web/design-system/fonts/Albert-Sans-OFL.txt', 'scripts/distribution.ts', 'shared/editor-launch.pl', 'shared/workspace-studio.ts', 'shared/owned-studio.mjs', 'shared/workflow-entry.js', 'skills/motion-recreate/scripts/measure_frame.mjs']) assert(files.has(file), 'Missing runtime or license: ' + file);assert(![...files].some(file => /^(?:tests\/|studio\/(?:src|tests)\/)|\.map$|publish-test-package|acceptance\.md$/.test(file)));for (const [workflow, definition] of Object.entries(workflowRegistry)) {diff --git a/tests/test-package.test.ts b/tests/test-package.test.tsindex 9a86c4c5..898662b2 100644--- a/tests/test-package.test.ts+++ b/tests/test-package.test.ts@@ -4,18 +4,24 @@ import { mkdtemp, writeFile, readFile, rm, access } from 'node:fs/promises';import { tmpdir } from 'node:os';import path from 'node:path';import { createHash } from 'node:crypto';-import { download, testVersion, lock, targetInfo } from '../scripts/test-package.mjs';+import { download, testVersion, checkReleaseVersion, lock, targetInfo } from '../scripts/test-package.mjs';import { nativeComponents } from '../scripts/runtime-assets.mjs';test('test versions sort above an already distributed source version and distinguish attempts', () => {- assert.equal(testVersion('0.6.1', '42', '1'), '0.6.2-beta.42.1');- assert.equal(testVersion('0.6.1', '42', '2'), '0.6.2-beta.42.2');+ assert.equal(testVersion('0.6.1', '42', '1'), '0.6.2-test.42.1');+ assert.equal(testVersion('0.6.1', '42', '2'), '0.6.2-test.42.2');assert.throws(() => testVersion('0.6.1', '../x'), /positive/);assert.throws(() => testVersion('0.6.1-beta.1', '1'), /MAJOR/);assert.equal(targetInfo('mac-arm64').platform, 'darwin');assert.equal(targetInfo('win-x64').platform, 'win32');assert.throws(() => targetInfo('unknown'), /Unsupported/);});+test('release versions accept test and stable versions and reject ambiguous or non-test candidates', () => {+ for (const version of ['0.6.4-test.1', '0.6.4-test.42.2', '0.6.4']) checkReleaseVersion(version);+ for (const version of ['latest', '0.6.4-beta.1', '0.6.4-rc.1', '0.6.4-test.1.0', '0.6.4-test.0', '0.6.4-test.01', '01.6.4', '0.6.4+local', '../x']) {+ assert.throws(() => checkReleaseVersion(version), /MAJOR.MINOR.PATCH/);+ }+});test('public runtime downloads never attach repository credentials and reject HTTPS downgrades', async t => {const dir = await mkdtemp(path.join(tmpdir(), 'motion-redirect-')), filename = path.join(dir, 'runtime.zip');const previous = process.env.FORGEJO_TOKEN;