Skip to content

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.

fix(motion): verify DEV candidates before promoting npm test

罗高32f22a1f688f
diff --git a/.github/scripts/motion-registry-smoke.mjs b/.github/scripts/motion-registry-smoke.mjs
index 679dc28f..be099b08 100644
--- a/.github/scripts/motion-registry-smoke.mjs
+++ b/.github/scripts/motion-registry-smoke.mjs
@@ -52,7 +52,7 @@ export async function registrySmoke(directory) {
await checkpoint(phase);
try {
const work = await mkdtemp(path.join(os.tmpdir(), 'om-registry-')), env = consumerEnvironment(work);
- for (const file of ['user.npmrc', 'global.npmrc']) await writeFile(path.join(work, file), '');
+ for (const name of ['user.npmrc', 'global.npmrc']) await writeFile(path.join(work, name), '');
const project = path.join(work, 'project'), host = path.join(work, 'host');
await mkdir(project); await mkdir(env.CODEX_HOME);
await writeFile(path.join(env.CODEX_HOME, 'config.toml'), '[mcp_servers.unrelated]\ncommand = "keep-this-server"\n');
@@ -84,6 +84,11 @@ export async function registrySmoke(directory) {
assert.equal(first.appRoot, second.appRoot); assert.equal((await readdir(path.join(home, 'apps'))).length, 1);
assert.match(await readFile(path.join(env.CODEX_HOME, 'config.toml'), 'utf8'), /keep-this-server/);
const manifest = JSON.parse(await readFile(path.join(directory, 'release-npm.json')));
+ assert.equal(manifest.templateEnvironment, 'dev');
+ const state = JSON.parse(await readFile(path.join(home, 'install.json')));
+ assert.equal(state.templateEnvironment, manifest.templateEnvironment);
+ const templateConfig = JSON.parse(await readFile(path.join(first.appRoot, 'shared/template-config.json')));
+ assert.equal(templateConfig.environment, manifest.templateEnvironment);
for (const skill of manifest.skills) await access(path.join(skills, 'openmotion/skills', skill, 'SKILL.md'));
console.log('Preparing the checksum-pinned browser, FFmpeg and ffprobe');
await checkpoint('native-prepare');
@@ -94,7 +99,7 @@ export async function registrySmoke(directory) {
await checkpoint('mcp-discovery');
await discover(installed.transport, env, c.version, manifest.mcp.tools);
const report = { status: 'passed', platform, version: c.version, sourceCommit: c.sourceCommit, tgzSHA256: c.tgzSHA256,
- node: process.version, codex: '0.166.0', registryColdInstall: 'passed', repeatSetup: 'passed', unrelatedSettings: 'preserved',
+ node: process.version, codex: '0.166.0', templateEnvironment: templateConfig.environment, registryColdInstall: 'passed', repeatSetup: 'passed', unrelatedSettings: 'preserved',
nativePreparation: 'passed', mcpTools: manifest.mcp.tools.length, skills: manifest.skills.length, resources: 'passed',
realModelTurn: 'not-run', humanPlayback: 'not-run', windowsDesktopAcceptance: 'not-run' };
await writeJSON(file, report); return report;
diff --git a/.github/scripts/motion-release.mjs b/.github/scripts/motion-release.mjs
index f0749db2..fa8561de 100644
--- a/.github/scripts/motion-release.mjs
+++ b/.github/scripts/motion-release.mjs
@@ -51,7 +51,7 @@ export async function sealCandidate(build, output, source, env = process.env) {
const manifest = await json(path.join(build, 'release-npm.json'));
assert.equal(manifest.commit, (await runFile('git', ['rev-parse', 'HEAD'], { cwd: source })).trim());
assert.equal(manifest.commit, env.MOTION_SOURCE_SHA); assert.equal(manifest.version, env.MOTION_VERSION);
- assert(manifest.version.includes('-test.') && manifest.templateEnvironment === 'prod');
+ assert(manifest.version.includes('-test.') && manifest.templateEnvironment === 'dev', 'Test candidates require DEV template defaults');
assert.match(env.GITHUB_SHA || '', /^[a-f0-9]{40}$/);
assert.equal(env.GITHUB_WORKFLOW_REF, `${repository}/${candidateWorkflow}@refs/heads/main`);
assert(/^[1-9]\d*$/.test(env.GITHUB_RUN_ID || '') && /^[1-9]\d*$/.test(env.GITHUB_RUN_ATTEMPT || ''));
@@ -67,7 +67,7 @@ export async function sealCandidate(build, output, source, env = process.env) {
const identity = { package: `${guide.packageName}@${guide.version}`, sourceCommit: guide.commit,
workflowCommit: env.GITHUB_SHA, candidateRun: Number(env.GITHUB_RUN_ID), attempt: Number(env.GITHUB_RUN_ATTEMPT),
tgz: filename, tgzSHA256: await sha256(path.join(output, filename)), applicationSHA256: guide.applicationSHA256, locks: guide.locks,
- templateEnvironment: 'prod' };
+ templateEnvironment: guide.templateEnvironment };
await writeFile(path.join(output, 'acceptance.md'), template.replace('<!-- CANDIDATE_IDENTITY -->', '```json\n' + JSON.stringify(identity, null, 2) + '\n```'));
const installTemplate = await readFile(new URL('../../docs/templates/candidate-install.md', import.meta.url), 'utf8');
const values = { VERSION: guide.version, TGZ: filename, SHA256: identity.tgzSHA256, SOURCE_SHA: guide.commit,
@@ -148,10 +148,11 @@ export async function verifyCandidate(directory, expectedSHA256, run) {
assert.equal(integrity(await readFile(path.join(directory, candidate.tgz))), candidate.integrity);
const guide = await json(path.join(directory, 'install-record.json'));
assert.equal(guide.commit, candidate.sourceCommit); assert.equal(guide.version, candidate.version); assert.equal(guide.packageName, candidate.packageName);
- assert.equal(guide.tgzSHA256, expectedSHA256); assert.equal(guide.channel, 'test'); assert.equal(guide.templateEnvironment, 'prod');
+ assert.equal(guide.tgzSHA256, expectedSHA256); assert.equal(guide.channel, 'test'); assert.equal(guide.templateEnvironment, 'dev');
assert.equal(guide.guideSHA256, candidate.files['install.md']); assert.equal(guide.candidate, false);
const manifest = await json(path.join(directory, 'release-npm.json'));
assert.equal(manifest.commit, candidate.sourceCommit); assert.equal(manifest.version, candidate.version);
+ assert.equal(manifest.templateEnvironment, guide.templateEnvironment);
assert.equal(manifest.installer.sha256, expectedSHA256);
for (const name of ['source-scan.json', 'package-scan.json']) assert.equal((await json(path.join(directory, name))).status, 'passed');
return candidate;
@@ -171,6 +172,7 @@ export async function platformReports(directory, candidate) {
assert.equal(report.status, 'passed'); assert.equal(report.platform, platform);
assert.equal(report.version, candidate.version); assert.equal(report.tgzSHA256, candidate.tgzSHA256);
assert.equal(report.sourceCommit, candidate.sourceCommit);
+ assert.equal(report.templateEnvironment, 'dev');
assert.equal(report.registryColdInstall, 'passed'); assert.equal(report.nativePreparation, 'passed');
assert.equal(report.repeatSetup, 'passed'); assert.equal(report.resources, 'passed');
assert.equal(report.mcpTools, 11); assert.equal(report.skills, 5);
@@ -238,17 +240,46 @@ export async function publishNpm(directory, inputs, { fetcher = fetch, run = run
await writeJSON(path.join(directory, 'npm-publication.json'), record);
if (!before.version) {
// OIDC authenticates this publisher; its main SHA is not the prebuilt application's source.
- await run('npm', ['publish', path.join(directory, candidate.tgz), '--access', 'public', '--tag', 'test', '--ignore-scripts', '--provenance=false', '--registry=https://registry.npmjs.org/']);
+ await run('npm', ['publish', path.join(directory, candidate.tgz), '--access', 'public', '--tag', 'candidate', '--ignore-scripts', '--provenance=false', '--registry=https://registry.npmjs.org/']);
record.status = 'published-awaiting-registry'; await writeJSON(path.join(directory, 'npm-publication.json'), record);
}
return record;
}
+export async function promoteTest(directory, inputs, { fetcher = fetch, run = runFile, env = process.env } = {}) {
+ const candidate = await verifyDownloaded(directory, inputs.expectedSHA256, inputs.version);
+ await verifyAuthorization(directory, inputs, env);
+ const platforms = await platformReports(directory, candidate);
+ const npm = await json(path.join(directory, 'npm-publication.json'));
+ assert.equal(npm.tgzSHA256, candidate.tgzSHA256);
+ const before = await registryPackage(candidate, fetcher);
+ assert(before.version, 'Exact npm version is not public');
+ assert.equal(before.tags.latest ?? null, npm.previousLatest, 'npm latest changed unexpectedly; stop before channel promotion');
+ const superseded = before.tags.test && compareReleaseVersions(before.tags.test, candidate.version) > 0;
+ let status = inputs.action === 'archive-only' ? 'archive-only' : superseded ? 'superseded' : 'already-promoted';
+ if (inputs.action === 'publish-test' && !superseded && before.tags.test !== candidate.version) {
+ await run('npm', ['dist-tag', 'add', `${candidate.packageName}@${candidate.version}`, 'test', '--registry=https://registry.npmjs.org/']);
+ const after = await registryPackage(candidate, fetcher);
+ assert(after.version); assert.equal(after.tags.test, candidate.version, 'npm test promotion readback failed');
+ assert.equal(after.tags.latest ?? null, npm.previousLatest, 'npm latest changed unexpectedly');
+ status = 'promoted';
+ }
+ const record = { schemaVersion: 1, version: candidate.version, tgzSHA256: candidate.tgzSHA256, action: inputs.action,
+ publicationRun: env.GITHUB_RUN_ID, platformVerification: platforms, previousTest: before.tags.test ?? null, status };
+ await writeJSON(path.join(directory, 'test-promotion.json'), record);
+ return record;
+}
+
export async function archiveRelease(directory, inputs, config, { run = runFile, fetcher = fetch, env = process.env } = {}) {
await writeJSON(path.join(directory, 'release-attempt.json'), { action: inputs.action, tgzSHA256: inputs.expectedSHA256, stage: 'verifying-release', runId: env.GITHUB_RUN_ID });
const candidate = await verifyDownloaded(directory, inputs.expectedSHA256);
const authorization = await verifyAuthorization(directory, inputs, env);
const platforms = await platformReports(directory, candidate);
+ const promotion = await json(path.join(directory, 'test-promotion.json'));
+ assert.equal(promotion.version, candidate.version); assert.equal(promotion.tgzSHA256, candidate.tgzSHA256);
+ assert.equal(promotion.action, inputs.action); assert.equal(promotion.publicationRun, env.GITHUB_RUN_ID);
+ assert.deepEqual(promotion.platformVerification, platforms);
+ assert((inputs.action === 'archive-only' ? ['archive-only'] : ['promoted', 'already-promoted', 'superseded']).includes(promotion.status), 'Require a successful channel verification');
const record = await json(path.join(directory, 'install-record.json')), plan = storagePlan(record, config);
assert.equal(candidate.tgzSHA256, inputs.expectedSHA256);
const registry = await registryPackage(candidate, fetcher); assert(registry.version, 'Exact npm version is not public');
@@ -270,7 +301,8 @@ export async function archiveRelease(directory, inputs, config, { run = runFile,
let release = { schemaVersion: 2, packageName: candidate.packageName, version: candidate.version, sourceCommit: candidate.sourceCommit,
tgzSHA256: candidate.tgzSHA256, integrity: candidate.integrity, candidateRun: candidate.workflow,
authorization, publicationRun: env.GITHUB_RUN_ID,
- platformVerification: platforms, status: 'registry-verified', publishedAt: new Date().toISOString() };
+ platformVerification: platforms, channelPromotion: promotion, templateEnvironment: record.templateEnvironment,
+ status: 'registry-verified', publishedAt: new Date().toISOString() };
if (prior) {
const existing = JSON.parse(prior);
for (const key of ['packageName', 'version', 'sourceCommit', 'tgzSHA256', 'integrity']) assert.equal(existing[key], release[key], 'Existing release record differs: ' + key);
@@ -325,6 +357,7 @@ if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.me
} finally { await runFile('git', ['worktree', 'remove', '--force', work], { cwd: extra }).catch(() => {}); }
} else if (command === 'verify') await verifyDownloaded(directory, inputs.expectedSHA256, inputs.version);
else if (command === 'npm') await publishNpm(directory, inputs);
+ else if (command === 'promote-test') await promoteTest(directory, inputs);
else if (command === 'archive') {
for (const name of ['AWS_ACCESS_KEY_ID', 'AWS_SECRET_ACCESS_KEY']) assert(process.env[name], 'Missing R2 credential: ' + name);
await archiveRelease(directory, inputs, { endpoint: process.env.MOTION_R2_ENDPOINT, bucket: process.env.MOTION_R2_BUCKET, publicOrigin: process.env.MOTION_INSTALL_PUBLIC_ORIGIN });
diff --git a/.github/scripts/motion-scan.mjs b/.github/scripts/motion-scan.mjs
index 53103b0f..c578f203 100644
--- a/.github/scripts/motion-scan.mjs
+++ b/.github/scripts/motion-scan.mjs
@@ -7,6 +7,7 @@ import os from 'node:os';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { download, runFile, sha256, writeJSON } from '../../scripts/runtime-assets.mjs';
+import { releaseTemplateEnvironment } from '../../scripts/release-version.mjs';
const root = fileURLToPath(new URL('../../', import.meta.url));
export const scannerVersion = '8.30.1';
@@ -127,13 +128,15 @@ export async function scanPackage(tgz, binary) {
const pkg = JSON.parse(await readFile(path.join(outer, 'package.json')));
assert.equal(pkg.name, '@openmotion/app'); assert.equal(pkg.private, false);
const manifest = JSON.parse(await readFile(path.join(outer, 'payload/release-npm.json')));
- assert.equal(manifest.format, 'npm'); assert.equal(manifest.templateEnvironment, 'prod'); assert.equal(manifest.version, pkg.version);
+ assert.equal(manifest.format, 'npm'); assert.equal(manifest.templateEnvironment, releaseTemplateEnvironment(pkg.version)); assert.equal(manifest.version, pkg.version);
const appName = manifest.application.url.replace(/^\.\//, ''); assert.equal(path.basename(appName), appName);
const appArchive = path.join(outer, 'payload', appName); assert.equal(await sha256(appArchive), manifest.application.sha256);
await unpackChecked(appArchive, path.join(work, 'application'));
assert.equal(await sha256(path.join(work, 'application/package-lock.json')), manifest.locks.npm);
assert.equal(await sha256(path.join(work, 'application/scripts/runtime-lock.json')), manifest.locks.native);
const applicationPkg = JSON.parse(await readFile(path.join(work, 'application/package.json'))); assert.equal(applicationPkg.version, pkg.version);
+ const templates = JSON.parse(await readFile(path.join(work, 'application/shared/template-config.json')));
+ assert.equal(templates.environment, manifest.templateEnvironment, 'Application template defaults differ from the manifest');
const reports = await Promise.all([scanTree(path.join(work, 'outer'), 'package', binary), scanTree(path.join(work, 'application'), 'package', binary)]);
return { status: 'passed', version: pkg.version, tgzSHA256: await sha256(tgz), applicationSHA256: manifest.application.sha256, reports };
} finally { await rm(work, { recursive: true, force: true }); }
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index a1428106..caa48742 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -16,8 +16,8 @@ on:
template_environment:
description: 'Template configuration platform used by the package'
type: choice
- options: [prod, dev]
- default: prod
+ options: [dev, prod]
+ default: dev
publish:
description: 'Publication is disabled during migration; leave unchecked'
type: boolean
@@ -89,7 +89,7 @@ jobs:
- name: Build immutable standalone artifacts
env:
PACKAGE_FORMAT: ${{ inputs.format || 'npm' }}
- TEMPLATE_ENVIRONMENT: ${{ inputs.template_environment || 'prod' }}
+ TEMPLATE_ENVIRONMENT: ${{ inputs.template_environment || 'dev' }}
run: |
version=$(node scripts/test-package.mjs version "$GITHUB_RUN_NUMBER" "${GITHUB_RUN_ATTEMPT:-1}")
if [ "$PACKAGE_FORMAT" = npm ]; then
@@ -101,14 +101,14 @@ jobs:
done
fi
- name: Generate candidate installation guide
- if: (inputs.format || 'npm') == 'npm' && (inputs.template_environment || 'prod') == 'prod'
+ if: (inputs.format || 'npm') == 'npm' && (inputs.template_environment || 'dev') == 'dev'
run: |
version=$(node scripts/test-package.mjs version "$GITHUB_RUN_NUMBER" "${GITHUB_RUN_ATTEMPT:-1}")
candidate=$(node --input-type=module -e 'import fs from "node:fs"; const m=JSON.parse(fs.readFileSync(process.argv[1]));process.stdout.write(m.installer.url.replace(/^\.\//,""));' "dist/$version/release-npm.json")
node --experimental-strip-types scripts/install-guide.mjs "dist/$version/$candidate" .artifacts/install-guide --candidate
node .github/scripts/motion-scan.mjs package "dist/$version/$candidate" "$RUNNER_TEMP/package-scan.json" "$RUNNER_TEMP/scanner/gitleaks"
- name: Retain candidate installation guide for review
- if: (inputs.format || 'npm') == 'npm' && (inputs.template_environment || 'prod') == 'prod'
+ if: (inputs.format || 'npm') == 'npm' && (inputs.template_environment || 'dev') == 'dev'
uses: actions/[email protected]
with:
name: motion-install-guide-preview-${{ github.run_id }}-${{ github.run_attempt }}
diff --git a/.github/workflows/motion-candidate.yml b/.github/workflows/motion-candidate.yml
index b3e995ce..bfdd406d 100644
--- a/.github/workflows/motion-candidate.yml
+++ b/.github/workflows/motion-candidate.yml
@@ -69,11 +69,11 @@ jobs:
npm run package:phase1
archive="$PWD/dist/motion-$(node -p "require('./package.json').version")-phase1.zip"
node tests/phase1-package.mjs "$archive" "$RUNNER_TEMP/phase1-e2e"
- - name: Build the final prod application tgz once and scan both archives
+ - name: Build the final DEV application tgz once and scan both archives
env:
MOTION_SOURCE_SHA: ${{ steps.source.outputs.source_sha }}
run: |
- node source/scripts/package-npm.mjs "$RUNNER_TEMP/build" "$MOTION_VERSION" --template-env=prod
+ node source/scripts/package-npm.mjs "$RUNNER_TEMP/build" "$MOTION_VERSION" --template-env=dev
cp "$RUNNER_TEMP/source-scan.json" "$RUNNER_TEMP/build/source-scan.json"
node control/.github/scripts/motion-scan.mjs package "$RUNNER_TEMP/build/openmotion-app-$MOTION_VERSION.tgz" "$RUNNER_TEMP/build/package-scan.json" "$RUNNER_TEMP/scanner/gitleaks"
node control/.github/scripts/motion-release.mjs seal "$RUNNER_TEMP/build" "$RUNNER_TEMP/candidate" source
diff --git a/.github/workflows/motion-publish-test.yml b/.github/workflows/motion-publish-test.yml
index 8c5571fa..9b9e26c7 100644
--- a/.github/workflows/motion-publish-test.yml
+++ b/.github/workflows/motion-publish-test.yml
@@ -104,6 +104,8 @@ jobs:
github-token: ${{ github.token }}
run-id: ${{ github.run_id }}
path: ${{ runner.temp }}/candidate
+ - name: Use the pinned npm CLI with trusted dist-tag support
+ run: npm install --global [email protected] --ignore-scripts --no-audit --no-fund
- name: Record explicit operator acceptance authorization
env:
GH_TOKEN: ${{ github.token }}
@@ -196,14 +198,19 @@ jobs:
retention-days: 30
if-no-files-found: warn
- snapshot:
+ promote-test:
if: ${{ always() && !cancelled() && needs.verify.result == 'success' && needs.npm.result == 'success' && needs.registry-mac.result == 'success' && needs.registry-windows.result == 'success' }}
env:
MOTION_EXPECTED_SHA256: ${{ needs.verify.outputs.tgz_sha256 }}
- MOTION_INSTALL_PUBLIC_ORIGIN: ${{ vars.CLOUDFLARE_R2_RELEASES_PUBLIC_ORIGIN }}
needs: [verify, npm, registry-mac, registry-windows]
runs-on: ubuntu-24.04
timeout-minutes: 15
+ outputs:
+ artifact_id: ${{ steps.artifact.outputs.artifact-id }}
+ permissions:
+ contents: read
+ actions: read
+ id-token: write
steps:
- uses: actions/[email protected]
with:
@@ -212,6 +219,9 @@ jobs:
- uses: actions/setup-node@v6
with:
node-version: '26.11.1'
+ registry-url: 'https://registry.npmjs.org'
+ - name: Use the pinned npm CLI with trusted dist-tag support
+ run: npm install --global [email protected] --ignore-scripts --no-audit --no-fund
- uses: actions/[email protected]
with:
artifact-ids: ${{ needs.verify.outputs.artifact_id }}
@@ -236,6 +246,64 @@ jobs:
github-token: ${{ github.token }}
run-id: ${{ github.run_id }}
path: ${{ runner.temp }}/candidate
+ - name: Advance npm test only after both native registry checks pass
+ run: node .github/scripts/motion-release.mjs promote-test "$RUNNER_TEMP/candidate"
+ - name: Retain the verified channel result
+ id: artifact
+ if: always()
+ uses: actions/[email protected]
+ with:
+ name: test-promotion-${{ github.run_id }}-${{ github.run_attempt }}
+ path: ${{ runner.temp }}/candidate/test-promotion.json
+ retention-days: 30
+ if-no-files-found: warn
+
+ snapshot:
+ if: ${{ always() && !cancelled() && needs.verify.result == 'success' && needs.npm.result == 'success' && needs.registry-mac.result == 'success' && needs.registry-windows.result == 'success' && needs.promote-test.result == 'success' }}
+ env:
+ MOTION_EXPECTED_SHA256: ${{ needs.verify.outputs.tgz_sha256 }}
+ MOTION_INSTALL_PUBLIC_ORIGIN: ${{ vars.CLOUDFLARE_R2_RELEASES_PUBLIC_ORIGIN }}
+ needs: [verify, npm, registry-mac, registry-windows, promote-test]
+ runs-on: ubuntu-24.04
+ timeout-minutes: 15
+ steps:
+ - uses: actions/[email protected]
+ with:
+ ref: ${{ github.sha }}
+ persist-credentials: false
+ - uses: actions/setup-node@v6
+ with:
+ node-version: '26.11.1'
+ - uses: actions/[email protected]
+ with:
+ artifact-ids: ${{ needs.verify.outputs.artifact_id }}
+ github-token: ${{ github.token }}
+ run-id: ${{ github.run_id }}
+ path: ${{ runner.temp }}/candidate
+ - uses: actions/[email protected]
+ with:
+ artifact-ids: ${{ needs.npm.outputs.artifact_id }}
+ github-token: ${{ github.token }}
+ run-id: ${{ github.run_id }}
+ path: ${{ runner.temp }}/candidate
+ - uses: actions/[email protected]
+ with:
+ artifact-ids: ${{ needs.registry-mac.outputs.artifact_id }}
+ github-token: ${{ github.token }}
+ run-id: ${{ github.run_id }}
+ path: ${{ runner.temp }}/candidate
+ - uses: actions/[email protected]
+ with:
+ artifact-ids: ${{ needs.registry-windows.outputs.artifact_id }}
+ github-token: ${{ github.token }}
+ run-id: ${{ github.run_id }}
+ path: ${{ runner.temp }}/candidate
+ - uses: actions/[email protected]
+ with:
+ artifact-ids: ${{ needs.promote-test.outputs.artifact_id }}
+ github-token: ${{ github.token }}
+ run-id: ${{ github.run_id }}
+ path: ${{ runner.temp }}/candidate
- name: Archive exact-version snapshots, verify canonical public bytes, then promote the default guide last
env:
AWS_ACCESS_KEY_ID: ${{ secrets.CLOUDFLARE_R2_RELEASES_AK }}
diff --git a/AGENTS.md b/AGENTS.md
index 7459f1fc..f519602e 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -45,6 +45,6 @@ Phase one exposes eleven motion_ Tools (nine project tools plus catalog fetch an
## Candidate and publication controls
-Follow [the release workflow manual](docs/release-workflows.md): separate manual candidate-build and test-publication entries, plus snapshot-only recovery. Download and accept the local tgz using candidate-install.md; keep completed acceptance.md private. The publication operator enters the accepted version and explicitly confirms acceptance, without manually copying hashes. No independent approval environment is enabled at this stage. Public candidates must use an exact reviewed source SHA integrated into `feature/motion`, a new test version and prod template defaults. Scan tracked source plus the outer npm tgz and inner application; preserve the positive distribution list and licenses. Keep candidate, native registry installation, real Agent creation and human acceptance evidence separate.
+Follow [the release workflow manual](docs/release-workflows.md): separate manual candidate-build and test-publication entries, plus snapshot-only recovery. Download and accept the local tgz using candidate-install.md; keep completed acceptance.md private. The publication operator enters the accepted version and explicitly confirms acceptance, without manually copying hashes. No independent approval environment is enabled at this stage. Public candidates must use an exact reviewed source SHA integrated into `feature/motion`, a new test version and DEV template defaults. Scan tracked source plus the outer npm tgz and inner application; preserve the positive distribution list and licenses. Keep candidate, native registry installation, real Agent creation and human acceptance evidence separate.
-Publication uses the accepted candidate bytes, never a rebuild. Only the separately authorized manual test publication workflow may use npm OIDC or R2 credentials; validate candidate provenance and hashes first, archive immutable version records, and update the moving guide last. Archive-only work must not move tags or default entries. Never overwrite published versions, put private DEV data/internal acceptance material into public artifacts, or infer merge/publication authorization from green CI. Main registration, npm trust, main cutover and repository rename remain separate operations.
+Publication uses the accepted candidate bytes, never a rebuild. Publish under `candidate` first; only the credential-isolated promotion job may move npm `test` after both matching DEV native reports pass. Stable publication, npm `latest` promotion and platform/marketplace Skills distribution are not implemented by these entries. Only the separately authorized manual test publication workflow may use npm OIDC or R2 credentials; validate candidate provenance and hashes first, archive immutable version records, and update the moving guide last. Archive-only work must not move tags or default entries. Never overwrite published versions, put private template payloads/internal acceptance material into public artifacts, or infer merge/publication authorization from green CI. Main registration, npm trust, main cutover and repository rename remain separate operations.
diff --git a/README.md b/README.md
index 7baf8ec0..df52e7ed 100644
--- a/README.md
+++ b/README.md
@@ -62,7 +62,7 @@ After each editing turn, the Agent requests the latest preview in the same chat
## Start in Codex
-For a packaged test installation, give your Agent the [test installation instructions](https://releases.open-design.ai/open-motion/dev/install.md). They pin an exact npm version and describe isolated setup and native preparation. To reproduce a particular version, use `https://releases.open-design.ai/open-motion/dev/<exact-version>/install.md`; see the [current delivery record and limitations](docs/release-guide.md#published-test-candidate-064-test6). Software test versions default to the production template environment.
+For a packaged test installation, give your Agent the [test installation instructions](https://releases.open-design.ai/open-motion/dev/install.md). They pin an exact npm version and describe isolated setup and native preparation. To reproduce a particular version, use `https://releases.open-design.ai/open-motion/dev/<exact-version>/install.md`; see the [current delivery record and limitations](docs/release-guide.md#published-test-candidate-064-test6). New test builds default to DEV templates; existing published versions retain their embedded defaults.
For source development, clone this public repository at `feature/motion` and open the checkout in Codex. You'll need Git, Node.js **22.18+** with npm, and a Codex CLI that supports plugins. MP4 export also requires Chrome/Chromium and FFmpeg/FFprobe. See [Windows test packages](docs/test-packages.md) for that installation path.
@@ -106,4 +106,4 @@ Multiple local conversations can keep different projects open through one native
Studio and MCP read the same disk-cached Prism catalog. `motion_list_templates({})` returns a local JSONL index path, total and catalog version; the Agent searches that file with its own shell tools. `motion_get_template({templateId})` reads one template and its editing guide. `motion_create_project` with `projectType=template` downloads its files into a new editable project.
-`npm run dev` reads DEV content. Standard packages read production; `npm run package:phase1 -- --template-env=dev` creates a separate DEV ZIP. The environment is stored in the package, so GUI and MCP agree without extra host configuration. `MOTION_TEMPLATE_ENV` can override it for debugging. DEV uses a separate default workspace and cache; environments never fall back to each other. See [catalog configuration and build commands](docs/template-catalog.md).
+`npm run dev` reads DEV content. New test npm builds read DEV; stable packages read production; `npm run package:phase1 -- --template-env=dev` creates a separate DEV ZIP. The environment is stored in the package, so GUI and MCP agree without extra host configuration. `MOTION_TEMPLATE_ENV` can override it for debugging. DEV uses a separate default workspace and cache; environments never fall back to each other. See [catalog configuration and build commands](docs/template-catalog.md).
diff --git a/docs/install.md b/docs/install.md
index 8e24a319..fd494a3e 100644
--- a/docs/install.md
+++ b/docs/install.md
@@ -35,7 +35,7 @@ Repeat an explicit `--home` from setup on prepare. Setup installs the selected h
Setup copies the checked application into a managed writable directory and installs its locked production npm dependencies. The application and user projects do not run from the temporary npx cache. Prepare or first native use prepares the platform's independent native archives concurrently: browser/FFmpeg/ffprobe separately on macOS, browser/combined media on Windows. It waits for all components and reports a failure if any component fails; successful checked components remain reusable. This is not an offline package.
-There is no persisted switch-environment command in this version. Internal DEV testing uses its separately configured installation; merely setting an environment variable while running setup does not configure a later desktop Agent. Do not silently fall back from one environment to another.
+There is no persisted switch-environment command in this version. Test versions embed DEV defaults and use an environment-specific installation; stable versions embed prod. DEV access still requires the service network/authentication. A public npm package does not grant access or bundle private catalog contents. When changing environment, use a separate home/data/profile; merely setting an environment variable while running setup does not configure a later desktop Agent. Do not silently fall back from one environment to another.
## Upgrade, recovery and feedback
diff --git a/docs/npm-installation.md b/docs/npm-installation.md
index 6c874752..eb8eb39b 100644
--- a/docs/npm-installation.md
+++ b/docs/npm-installation.md
@@ -59,13 +59,13 @@ These are documented commands, not proof of Windows acceptance. Use a directly e
## Test template data (DEV)
-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:
+New explicitly versioned test npm packages default to **DEV**; stable packages default to **prod**. Existing published versions retain their original environment (test.6 used prod). To test Prism templates, publish the resource to **DEV**, then download an accepted DEV candidate or build one locally:
```sh
npm run package:npm -- dist/npm-dev 0.6.4-test.1 --template-env=dev
```
-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.
+Use that tgz in the installation commands above, with an **independent Codex profile, home, data and Skills directory**. Explicit test/DEV builds are publishable under the candidate channel. Unversioned builds and channel/environment mismatches remain `private:true`. Public packaging exposes DEV routing configuration, not credentials or cached catalog contents; network access/authentication remains a service prerequisite. 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.
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.
@@ -107,7 +107,7 @@ Compatible phase-one updates do not require closing existing MCP connections or
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.
-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.
+Source package manifests remain `private:true`. Only an explicit test/DEV or stable/prod build produces publishable tgz metadata. Test artifacts default to `candidate`; the manual publisher advances `test` only after matching Mac/Windows registry installation checks. Stable artifacts default to `stage`; stable publication and `latest` promotion are separate follow-ups. Local/default and channel/environment-mismatched 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.
After publication, the intended user entry is `npx --yes --package @openmotion/app@<exact-version> -- openmotion setup --host codex`, followed by `prepare` and host discovery/reload for a new installation. `@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.
diff --git a/docs/product/architecture.md b/docs/product/architecture.md
index 82d30ea4..bbc0cb95 100644
--- a/docs/product/architecture.md
+++ b/docs/product/architecture.md
@@ -190,13 +190,13 @@ The following product measures still require agreed observation windows and vali
The `@openmotion/app` 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).
+Explicit test/DEV and stable/prod builds produce publishable artifact metadata with candidate/stage defaults; source manifests, unversioned builds and channel/environment mismatches stay private. New public test versions use DEV template routing; catalog access still depends on service network/authentication. No private catalog payloads or credentials are bundled. Existing versions retain their original defaults. 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).
## 演进约束
-The application npm format is the default; complete platform ZIPs are backups. Ordinary PR CI scans tracked source and both npm archive layers without publication credentials. Separate manual candidate-build and test-publication entries implement build → download/accept → publish. The build freezes an integrated source SHA, builds one immutable prod candidate and generates a local candidate-install.md plus an identity-filled acceptance checklist. Publication resolves a unique unexpired versioned artifact from a completed successful build, validates official ZIP/file hashes and source integration, and requires explicit operator acceptance. No independent approval environment is enabled; the manual operator receipt is not proof of private tests or independent review. The same tgz is published to npm test, checked anonymously on separate Mac/Windows runners and archived before conditionally advancing the default guide. Builds can continue during acceptance; publication-only serialization, version checks and ETag writes prevent late older candidates from rolling the moving entry backward. Snapshot-only recovery requires an existing identical npm version and does not move the default. Private DEV template artifacts remain outside these public workflows. Stable publication is a separate authorized process. Trusted default-branch registration and npm OIDC setup remain separate prerequisites, not enabled by this feature PR. Build, native installation, real Agent creation and human playback remain separate evidence. See [release workflows](../release-workflows.md) and [package checks](../test-packages.md).
+The application npm format is the default; complete platform ZIPs are backups. Ordinary PR CI scans tracked source and both npm archive layers without publication credentials. Separate manual candidate-build and test-publication entries implement build → download/accept → publish. The build freezes an integrated source SHA, builds one immutable DEV candidate and generates a local candidate-install.md plus an identity-filled acceptance checklist. Publication resolves a unique unexpired versioned artifact from a completed successful build, validates official ZIP/file hashes and source integration, and requires explicit operator acceptance. No independent approval environment is enabled; the manual operator receipt is not proof of private tests or independent review. The same tgz is published under npm candidate, checked anonymously on separate Mac/Windows runners, then promoted to test in an npm-OIDC-only job before archiving and conditionally advancing the default guide. Failed native checks leave test unchanged; the exact candidate version is already public. R2 failure after tag promotion can leave the guide on the earlier accepted version. Builds can continue during acceptance; publication-only serialization, version checks and ETag writes prevent late older candidates from rolling the moving entry backward. Snapshot-only recovery requires an existing identical npm version and does not move the default. DEV configuration is public; private template contents and credentials remain outside the artifacts. Stable publication is a separate authorized process. Trusted default-branch registration and npm OIDC setup remain separate prerequisites, not enabled by this feature PR. Build, native installation, real Agent creation and human playback remain separate evidence. See [release workflows](../release-workflows.md) and [package checks](../test-packages.md).
-Downstream publication jobs consume immutable producer artifact IDs retained across partial retries; native Mac and Windows jobs expose separate report identities. OIDC authenticates publication, but automatic npm provenance is disabled for prebuilt candidates because the publication workflow SHA differs from the application source. Candidate/manifest/hash records provide traceability without claiming a signed build attestation. Stable version construction and URL contracts exist; a stable candidate/publication workflow is not implemented.
+Downstream publication jobs consume immutable producer artifact IDs retained across partial retries; native Mac and Windows jobs expose separate report identities. OIDC authenticates publication, but automatic npm provenance is disabled for prebuilt candidates because the publication workflow SHA differs from the application source. Candidate/manifest/hash records provide traceability without claiming a signed build attestation. Stable version construction and URL contracts exist; stable candidate/publication, npm latest promotion and Skills marketplace/platform publication are not implemented. The bundled Skills are installed into local hosts only.
已确认方向是继续支持多 Agent 接入、可编辑工程与一个工作区内的发现/制作闭环。
diff --git a/docs/release-guide.md b/docs/release-guide.md
index fb0c713c..12dc10f9 100644
--- a/docs/release-guide.md
+++ b/docs/release-guide.md
@@ -6,7 +6,7 @@ This is the maintainer and tester manual for the application npm format. It defi
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.
+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: new public test packages default to DEV and stable packages to prod; isolated local builds remain available. Existing published prod test versions are not rewritten.
### Published test candidate: 0.6.4-test.6
@@ -36,13 +36,16 @@ Mac arm64 and Windows x64 require separate results; absent runners are not passe
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`.
+4. Confirm the exact public package/scope and authorized publisher. Explicit test/DEV and stable/prod artifacts are publishable; source/unversioned/channel-environment-mismatched manifests stay private. The build does not publish. Test-candidate metadata selects `candidate`; native registry acceptance must precede `test` promotion; 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
+# The manual test workflow performs these two steps with native checks between them:
+npm publish /absolute/final-test.tgz --access public --tag candidate
+# After both exact-version native checks pass:
+npm dist-tag add @openmotion/app@<exact-test-version> 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
@@ -60,13 +63,13 @@ Each defect needs exact package/source/OS/host/environment/catalog identity, pro
[docs/install.md](install.md) is the public Agent-facing source template. The generator reads the actual complete npm tgz and its embedded manifest, pins the npm name/version and built source SHA, and records the guide and package hashes. It does not build or publish the application.
-Ordinary npm/prod CI builds generate a **candidate-only** guide and retain it as an Actions artifact for 14 days. The publisher rejects candidate previews. DEV/private packages cannot produce a public guide.
+Ordinary npm/DEV CI builds generate a **candidate-only** guide and retain it as an Actions artifact for 14 days. The publisher rejects candidate previews. Public guides require test/DEV or stable/prod identity; private builds cannot produce them.
Maintainers follow [build → download and accept → publish](release-workflows.md): first run Motion candidate build with a new test version, download its frozen candidate and follow the included `candidate-install.md` to install the local tgz in an isolated host. Keep completed `acceptance.md` privately. After acceptance, run Motion test publication with that exact version and confirm acceptance. Candidate lookup and hashes are automatic; no independent approval environment is enabled. The same accepted bytes receive anonymous native registry checks and immutable snapshots before the moving test guide can advance. Snapshot-only recovery is a separate maintenance entry. The former CI guide-only upload route is removed so it cannot bypass these checks. Ordinary PR CI remains read-only.
-These manual entries support test versions only. Stable package construction and the stable URL contract exist, but stable candidate/publication/channel promotion still require a separate implementation and authorization. Partial retries retain the actual successful producer artifact IDs; automatic npm provenance is disabled for prebuilt candidates while OIDC authentication remains enabled. See the workflow manual for the source/hash evidence and recovery limits.
+These manual entries support test versions only. Stable package construction and the stable URL contract exist, but stable candidate/publication, npm `latest` promotion and Skills platform/marketplace distribution still require separate implementation and authorization. Bundling five Skills and registering them locally does not publish them to a platform. Partial retries retain the actual successful producer artifact IDs; automatic npm provenance is disabled for prebuilt candidates while OIDC authentication remains enabled. See the workflow manual for the source/hash evidence and recovery limits.
-The short test/stable version URL contract and historical `/versions/` URLs remain as documented in that manual. Test software uses prod template defaults; private DEV template testing stays separate.
+The short test/stable version URL contract and historical `/versions/` URLs remain as documented in that manual. New test software uses DEV template defaults. DEV service access still depends on network/authentication; private template snapshots and credentials must never be embedded. The earlier test.6 retains prod defaults.
The configured destination bucket is `open-design-releases` and the public origin is `https://releases.open-design.ai`. After stable publication, the website can give the Agent a short prompt: "Read `https://releases.open-design.ai/open-motion/install.md`, install OpenMotion MCP and Skills for my current supported Agent host, preserve existing projects/settings, and report installation and preparation results." Use `https://releases.open-design.ai/open-motion/dev/install.md` for the test software channel. The test guide now pins `@openmotion/[email protected]`, with an immutable copy at `open-motion/dev/0.6.4-test.6/install.md`; both canonical public URLs were verified byte-for-byte against guide SHA256 `4b6f6b25c782c23d5529d225c6c0506d524b245a242f54d84fbf8d4dd61f4f05` after the [upload run](https://github.com/nexu-io/html-anything/actions/runs/42633147999). The short test.6 URL was added by [run 42638072025](https://github.com/nexu-io/html-anything/actions/runs/42638072025), with the same verified bytes as the retained legacy `/versions/0.6.4-test.6/install.md` URL. The older test.5 and test.4 immutable instructions remain unchanged; test.4 records the historical `@open-design/motion` name. Their existence does not imply those old npm versions were published. The stable entry is untouched and currently returns HTTP 404. Guide publication and npm publication remain separate operations.
diff --git a/docs/release-workflows.md b/docs/release-workflows.md
index 670c2aa7..191727ed 100644
--- a/docs/release-workflows.md
+++ b/docs/release-workflows.md
@@ -6,11 +6,11 @@ Use two manual Actions entries: **Motion candidate build**, then **Motion test p
| --- | --- |
| Build: enter a new test version | Freeze the current `feature/motion` SHA, check/build/scan once, retain the candidate and show download/install instructions |
| Download and accept | Use `candidate-install.md` and the local tgz in an isolated host; retain completed `acceptance.md` internally |
-| Publish: enter the accepted version and confirm acceptance | Find the unique candidate automatically, verify its source/hashes, publish the same tgz to npm `test`, check native installations, archive snapshots and update the default guide last |
+| Publish: enter the accepted version and confirm acceptance | Find the unique candidate automatically, verify its source/hashes, publish the same tgz under `candidate`, check native installations, then advance npm `test`, archive snapshots and update the default guide last |
**No independent approval environment is enabled at this stage.** The publication checkbox is explicit authorization by the operator, not evidence of an independent review or proof that the tests happened. Anyone able to dispatch the trusted publication workflow can authorize publication; the team must control that access and keep the acceptance record. Adding a separate required reviewer later is a separate decision.
-Public test software uses **prod templates**. A URL containing `dev` selects the test software channel, not private DEV template data. Stable version construction and URL contracts exist, but a stable release workflow is not implemented.
+New public test packages use **DEV templates**; stable packages use prod. The `dev` URL path selects the test software channel, whose newly built packages now embed DEV configuration. Package visibility does not grant DEV network access or authorization; no private catalog snapshot or credential is embedded. Existing prod-based test versions are immutable and remain unchanged. Stable publication, npm `latest` promotion and Skills marketplace/platform upload are separate follow-ups; the five Skills are only included in the npm application and registered locally.
## First-time administrator setup
@@ -24,7 +24,7 @@ Register these files together:
Protect changes to the trusted control files and `main`. There is no `motion-test-publish` GitHub Environment prerequisite or Review deployments step in this version.
-For `@openmotion/app`, open npm **Settings → Trusted publishing → Add trusted publisher → GitHub Actions**. Set owner **`nexu-io`**, repository **`html-anything`**, workflow filename **`motion-publish-test.yml`** (no directory), **leave Environment blank**, and allow **npm publish**. Do not grant tag-management actions. If an older entry names an environment, it must be updated to match this workflow before publication. GitHub-hosted runners use Node 26.11.1/npm 11.20.0 and `id-token: write`; no stored npm token is needed. The recovery caller never calls npm publish. See [npm trusted publishing](https://docs.npmjs.com/trusted-publishers/).
+For `@openmotion/app`, open npm **Settings → Trusted publishing → Add trusted publisher → GitHub Actions**. Set owner **`nexu-io`**, repository **`html-anything`**, workflow filename **`motion-publish-test.yml`** (no directory), **leave Environment blank**, and allow **npm publish** plus **Allow npm dist-tag**. The latter is separately required to advance `test` after native acceptance; enabling publish alone is insufficient. If an older entry names an environment, it must be updated to match this workflow before publication. GitHub-hosted runners use Node 26.11.1; credentialed npm jobs explicitly install npm 11.21.2 for OIDC dist-tag support and `id-token: write`; no stored npm token is needed. The recovery caller never calls npm publish or dist-tag. npm does not support a dist-tag dry-run; do not test that command against the real registry without channel-write authorization. See [npm trusted publishing](https://docs.npmjs.com/trusted-publishers/).
Reuse the existing R2 settings. Only the final snapshot step receives the storage credentials:
@@ -41,7 +41,7 @@ Open **Actions → Motion candidate build → Run workflow**, select `main` and
Normally leave **source_sha** empty. The build fetches `feature/motion`, resolves its current full SHA once, records it and checks out exactly that SHA. To test a particular reviewed integrated commit, supply its full 40-character SHA. A later branch update cannot silently change this candidate. Confirm the chosen source has completed the required integration review.
-The build scans tracked source before dependency installation, runs the technical checks/Studio regression/eleven-Tool ZIP E2E, builds the final prod npm tgz once and scans its outer and inner archives. It has no npm OIDC or R2 credentials. Successful output is retained as **`motion-candidate-<version>` for 30 days**. Wait for the whole build run to succeed before publication.
+The build scans tracked source before dependency installation, runs the technical checks/Studio regression/eleven-Tool ZIP E2E, builds the final DEV npm tgz once and scans its outer and inner archives. It has no npm OIDC or R2 credentials. Successful output is retained as **`motion-candidate-<version>` for 30 days**. Wait for the whole build run to succeed before publication.
The artifact contains nine files: `openmotion-app-<version>.tgz`, `release-npm.json`, `source-scan.json`, `package-scan.json`, `install.md`, `install-record.json`, **`candidate-install.md`**, `acceptance.md` and `candidate.json`. The schema-2 candidate records source/control SHA, producer run/attempt and file hashes. Its acceptance state remains `not-performed`. The generated checklist fills machine identity only; human results start at `NOT RUN`.
@@ -67,10 +67,11 @@ The workflow searches GitHub artifacts by the exact versioned name and requires
It then automatically:
-1. Publishes only the accepted tgz with `--tag test --ignore-scripts --provenance=false`, or verifies an already published identical version. It rejects an older test version than the current npm test channel and never overwrites different bytes.
+1. Publishes only the accepted tgz with `--tag candidate --ignore-scripts --provenance=false`, or verifies an already published identical version. It rejects an older test version than the current npm test channel and never overwrites different bytes.
2. On separate macOS arm64 and Windows x64 runners without publication credentials, anonymously downloads the exact registry version, verifies its hashes, prepares Chromium/FFmpeg/ffprobe, runs isolated setup/repeat setup and checks the eleven Tools/resources and five Skills. These are native technical checks, not real-model or human playback acceptance.
-3. Requires both platform reports, archives immutable R2 snapshots and checks canonical public bytes. Only then conditionally advances the default test guide. The snapshot job consumes the operator authorization and both native reports, executes trusted `main` controls and never executes the candidate application.
-4. Shows the exact version, publication phase, versioned installation guide and default guide in the run summary.
+3. In a separate npm-OIDC-only job, requires both successful reports for the same tgz/source and DEV environment before advancing `test`. Verifies the registry result; an identical retry does not retag, and a newer `test` is never regressed.
+4. Archives immutable R2 snapshots and checks canonical public bytes. Only then conditionally advances the default test guide. The snapshot job consumes the operator authorization and both native reports, executes trusted `main` controls and never executes the candidate application.
+5. Shows the exact version, publication phase, versioned installation guide and default guide in the run summary.
OIDC authenticates the publisher. Automatic npm provenance remains disabled because this trusted control workflow's `main` SHA differs from the selected application source SHA. Candidate/manifest/lock/hash records provide traceability, not a signed build attestation.
@@ -78,12 +79,12 @@ OIDC authenticates the publisher. Automatic npm provenance remains disabled beca
| Channel | Moving guide, updated last | Immutable guide |
| --- | --- | --- |
-| Test software, prod templates | `/open-motion/dev/install.md` | `/open-motion/dev/<version>/install.md` |
+| Test software, DEV templates | `/open-motion/dev/install.md` | `/open-motion/dev/<version>/install.md` |
| Stable software, prod templates | `/open-motion/install.md` | `/open-motion/<version>/install.md` |
This workflow does not publish stable versions or move npm `latest`. The storage helper supports stable paths without providing a stable publication job. Existing legacy `/versions/<version>/install.md` objects remain immutable.
-Each test version archives the exact tgz, manifests, generated blank acceptance checklist, both installation guides, scans, candidate identity, both platform reports and the schema-2 release record. The release record contains package/source identity and the manual operator authorization; it does not claim independent review or attest private test results. Completed private acceptance material is never uploaded. Snapshot recovery preserves a prior immutable release record while retaining its own fresh operator authorization in its attempt artifact.
+Each test version archives the exact tgz, manifests, generated blank acceptance checklist, both installation guides, scans, candidate identity, both platform reports and the schema-2 release record. The release record contains package/source identity and the manual operator authorization; it does not claim independent review or attest private test results. Completed private acceptance material is never uploaded. `test-promotion.json` retains the prior tag, exact package, native-report hashes and promotion outcome. The immutable release record includes this channel verification and template environment. Snapshot recovery preserves a prior immutable release record while retaining its own fresh operator authorization in its attempt artifact.
Builds have no publication lock, so another version can build during acceptance. Publication and snapshot recovery share one workflow-wide concurrency group with cancellation disabled. GitHub concurrency is not a durable FIFO: it retains one running and one newest pending run; do not enqueue a batch. Publish one accepted version at a time. A superseded candidate can retain version snapshots without moving the default. Default-guide version comparison plus ETag conditional writes prevent late older completion from rolling a newer entry back; unrecognized or conflicting same-version guide bytes require inspection.
@@ -92,7 +93,7 @@ Actions artifacts and attempt records expire after **30 days**. R2 snapshots fol
## Failure and snapshot recovery
- Before clicking publish: building, downloading and testing publish nothing. Discard an unwanted candidate. Fix code under a new version when bytes change.
-- After clicking publish: npm may already be public if a native or R2 stage fails. The default guide stays unchanged until its checks pass. Inspect retained npm state and release-attempt/publication files; do not rebuild or blindly republish.
+- After clicking publish: the exact version and `candidate` tag are public even before native validation. A failed native check leaves `test` and the default guide unchanged. Once native checks and tag readback pass, `test` can advance before R2 finishes; if R2 fails it points to a verified version while the guide can remain on the previous version. npm and R2 are not one transaction. Inspect retained npm state and release-attempt/publication files; do not rebuild or blindly republish.
- Use **Re-run failed jobs** for a partial publication failure. Consumers use successful producer artifact IDs rather than guessing their own attempt. Re-running publication reuses the existing candidate and original accepted version; it does not rebuild. A candidate build rerun is different: a successful new artifact must be accepted again, and duplicate version artifacts block publication.
- **Motion snapshot recovery** is a separate maintenance entry. Select `main`, enter the existing candidate version and confirm snapshot-only recovery. It requires an already published identical npm version, repeats native checks and fills missing immutable snapshots. It never builds, publishes npm, moves npm tags or accesses the moving guide. Missing/expired/ambiguous candidates stop.
- Version writes use conditional create and byte comparison. Same bytes resume; different immutable bytes stop. A public readback error blocks promotion. A failure after `fixed-write-attempted` may mean the moving write completed: inspect storage and its canonical URL before retrying.
diff --git a/docs/template-catalog.md b/docs/template-catalog.md
index 24e9563b..4bdc721d 100644
--- a/docs/template-catalog.md
+++ b/docs/template-catalog.md
@@ -2,7 +2,7 @@
## 当前: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.
+For application npm DEV builds, isolated installation and source MCP overrides, follow [test template data](npm-installation.md#test-template-data-dev). npm tags select software versions. Newly built test npm versions embed DEV defaults; stable versions embed prod. Previously published versions keep their embedded 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。
@@ -17,9 +17,9 @@ Studio 使用发布的模板和三个内置示例;旧 891 条参考快照只
| `npm run dev` | DEV:`r.powerformer.net` |
| `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:npm -- dist/npm-dev --template-env=dev` | Unversioned local DEV artifact (private); explicit `X.Y.Z-test.N` npm builds default to DEV, stable builds to prod |
| `npm run package:test -- build <target> <release-version> --template-env=dev` | DEV 完整运行包;省略环境参数则为线上 |
-| Actions → Run workflow → `template_environment` | 选择 `prod`(默认)或 `dev`,适用于 npm 和完整 ZIP |
+| Actions → Run workflow → `template_environment` | Select `dev` (default) or `prod` for npm and backup ZIP builds |
环境写入包内 `shared/template-config.json`,不要求安装用户另设变量,GUI 和 MCP 读取同一配置。正式构建默认线上,不受打包机器的 `MOTION_TEMPLATE_ENV` 影响。运行时可显式用该变量覆盖包默认值;从源码独立启动 MCP 调试时设为 dev。
diff --git a/docs/templates/candidate-install.md b/docs/templates/candidate-install.md
index 19072324..ad41b47b 100644
--- a/docs/templates/candidate-install.md
+++ b/docs/templates/candidate-install.md
@@ -1,6 +1,6 @@
# Install the OpenMotion {{VERSION}} candidate
-This is a **local candidate installation guide**. It installs the complete `{{TGZ}}` next to this file, not an unpublished npm registry version. The application, MCP, built Studio and five Skills are embedded. Native browser/FFmpeg/ffprobe and locked npm dependencies still need network access when prepared. Public test software defaults to prod templates.
+This is a **local candidate installation guide**. It installs the complete `{{TGZ}}` next to this file, not an unpublished npm registry version. The application, MCP, built Studio and five Skills are embedded. Native browser/FFmpeg/ffprobe and locked npm dependencies still need network access when prepared. Public test software defaults to DEV templates. The source address is public configuration; access still requires the DEV service network/authentication. The package contains no private catalog snapshot or credentials.
## Frozen identity
@@ -21,7 +21,7 @@ This is a **local candidate installation guide**. It installs the complete `{{TG
```
Replace `HOST` with `codex`, `claude`, `deepseek` or `workbuddy`. Carry the explicit `--home`, `--data-dir`, `--skills-dir` and host-specific options from the platform recipe; repeat the same home for prepare. Wait for setup and prepare to finish before native use. Keep using this local package; no sidecar application/manifest download or source build is required.
-4. Follow this host's discovery/reload action. Verify the actual application version, prod template environment, eleven MCP Tools, resources and five Skills, including a `motion_get_project` call against the isolated data directory. Registration or installation success alone is not host loading or creative acceptance.
+4. Follow this host's discovery/reload action. Verify the actual application version, DEV template environment, eleven MCP Tools, resources and five Skills, including a `motion_get_project` call against the isolated data directory. Registration or installation success alone is not host loading or creative acceptance.
5. Follow the tester's requested acceptance cases in `acceptance.md`: use an independent test project for template creation, editing, save/reopen and MP4 export. Do not modify an existing user project or start a paid provider call without its separate authorization. Retain technical export checks separately from real Agent creation and human audio/video playback.
6. Fill a **private copy** of `acceptance.md` with actual PASS / FAIL / NOT RUN results and evidence. Report failures and retain the generated candidate identity. Do not edit/re-upload the frozen candidate artifact. Do not publish npm, upload a guide or change a tag as part of installation/testing.
diff --git a/docs/templates/release-record.md b/docs/templates/release-record.md
index 2f187e6c..5396bce0 100644
--- a/docs/templates/release-record.md
+++ b/docs/templates/release-record.md
@@ -44,7 +44,8 @@ Use PASS / FAIL / NOT RUN and link retained evidence. CI success alone cannot fi
## Publication follow-up
- Publication run / npm exact version / registry hash and integrity:
-- Native registry cold-install report per platform:
+- Native registry cold-install report per platform, including embedded/installed template environment:
+- Verified npm test promotion / prior test version / promotion run:
- Immutable R2 version / release-record / guide URL and verified hash:
- Default entry / previous entry / final publication phase:
- Failure, recovery or user feedback:
diff --git a/docs/test-packages.md b/docs/test-packages.md
index 9a8dc063..1253212e 100644
--- a/docs/test-packages.md
+++ b/docs/test-packages.md
@@ -10,7 +10,7 @@ MCP 公开入口由包内 `shared/mcp-release.json` 固化,详见[一期注册
合入后,在本仓库 → 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#环境与构建).
+`template_environment` selects the configuration platform for either format: `dev` (default in standalone CI, `r.powerformer.net`) or `prod` (`r.open-design.ai`). 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#环境与构建).
| 选择 | 构建产物 | 运行时 |
| --- | --- | --- |
@@ -19,7 +19,7 @@ MCP 公开入口由包内 `shared/mcp-release.json` 固化,详见[一期注册
Ordinary builds retain candidate installation-guide artifacts for review; they do not publish npm, Release or R2 objects. Separate manual guide publication follows the release guide; 两种格式误勾 `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).
-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.
+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. Explicit test npm builds default to DEV and candidate; stable npm builds default to prod and stage. Unversioned and channel/environment-mismatched builds remain private. The backup ZIP builder still defaults to prod unless explicitly selected. Publication remains disabled.
PR / main 工作流执行清单、类型、Studio 构建与回归、安装/打包测试,以及十一个 Tool 的真实 ZIP E2E。Linux 是组装与测试环境,不是已支持的用户运行平台。Mac / Windows 的最终安装和真实出片仍须在对应系统验收;当前 本仓库工作流没有 Windows 或 Mac 原生验收 job,不把产包成功写成通过。
diff --git a/scripts/install-guide.mjs b/scripts/install-guide.mjs
index 7f072eab..2b756ac9 100644
--- a/scripts/install-guide.mjs
+++ b/scripts/install-guide.mjs
@@ -3,7 +3,7 @@ import { mkdir, readFile } from 'node:fs/promises';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { runFile, sha256, writeAtomic, writeJSON } from './runtime-assets.mjs';
-import { checkReleaseVersion } from './release-version.mjs';
+import { checkReleaseVersion, releaseTemplateEnvironment } from './release-version.mjs';
export function validateGuideSpec(name, version) {
assert.match(name || '', /^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/, 'Require an npm package name');
@@ -17,7 +17,7 @@ export function validateGuideIdentity(pkg, manifest) {
assert.equal(pkg.private, false, 'Only public release candidates may have a public installation guide');
assert.equal(pkg.version, manifest.version, 'Package and embedded manifest versions differ');
assert.equal(manifest.schemaVersion, 1, 'Unsupported release manifest');
- assert.equal(manifest.templateEnvironment, 'prod', 'Public guides require prod defaults');
+ assert.equal(manifest.templateEnvironment, releaseTemplateEnvironment(pkg.version), 'Template defaults must match the release channel');
assert.equal(pkg.bin?.openmotion, 'scripts/npm-installer.mjs', 'Missing Motion entry point');
assert.match(manifest.commit || '', /^[a-f0-9]{40}$/, 'Require the built source SHA');
for (const hash of [manifest.application?.sha256, manifest.locks?.npm, manifest.locks?.native]) assert.match(hash || '', /^[a-f0-9]{64}$/, 'Require release checksums');
diff --git a/scripts/package-npm.mjs b/scripts/package-npm.mjs
index 88ec2760..50d8953a 100644
--- a/scripts/package-npm.mjs
+++ b/scripts/package-npm.mjs
@@ -7,7 +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 './release-version.mjs';
+import { checkReleaseVersion, releaseTemplateEnvironment } from './release-version.mjs';
const root = fileURLToPath(new URL('../', import.meta.url));
export function checkReleaseLocks(pkg, lockfile, runtime) {
@@ -32,11 +32,11 @@ export function checkReleaseLocks(pkg, lockfile, runtime) {
}
}
-export async function packageNpm(output = path.join(root, 'dist/npm-local'), version, templateEnvironment = 'prod') {
- const templateConfig = packageTemplateConfig(templateEnvironment);
+export async function packageNpm(output = path.join(root, 'dist/npm-local'), version, templateEnvironment) {
output = path.resolve(output);
const explicitVersion = version !== undefined;
if (explicitVersion) checkReleaseVersion(version);
+ const templateConfig = packageTemplateConfig(templateEnvironment ?? (explicitVersion ? releaseTemplateEnvironment(version) : 'prod'));
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'));
@@ -61,8 +61,8 @@ export async function packageNpm(output = path.join(root, 'dist/npm-local'), ver
const installerPkg = JSON.parse(await readFile(path.join(root, 'packages/npm/package.json'), 'utf8'));
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' };
+ installerPkg.private = !explicitVersion || templateConfig.environment !== releaseTemplateEnvironment(version);
+ installerPkg.publishConfig = { access: 'public', registry: 'https://registry.npmjs.org/', tag: version.includes('-test.') ? 'candidate' : 'stage' };
await writeJSON(path.join(installer, 'package.json'), installerPkg);
const commit = (await runFile('git', ['rev-parse', 'HEAD'], { cwd: root })).trim();
const repository = `https://github.com/nexu-io/html-anything/blob/${commit}/`;
diff --git a/scripts/release-version.mjs b/scripts/release-version.mjs
index e487f0bc..d64755f7 100644
--- a/scripts/release-version.mjs
+++ b/scripts/release-version.mjs
@@ -4,6 +4,11 @@ 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 releaseTemplateEnvironment(version) {
+ checkReleaseVersion(version);
+ return version.includes('-test.') ? 'dev' : 'prod';
+}
+
export function compareReleaseVersions(left, right) {
checkReleaseVersion(left); checkReleaseVersion(right);
const parts = value => {
diff --git a/tests/install-guide.test.ts b/tests/install-guide.test.ts
index 31c41348..67cbb19d 100644
--- a/tests/install-guide.test.ts
+++ b/tests/install-guide.test.ts
@@ -8,7 +8,7 @@ import { publishGuide, storagePlan } from '../.github/scripts/publish-install-gu
import { runFile } from '../scripts/runtime-assets.mjs';
const pkg = { name: '@openmotion/app', version: '0.6.4-test.1', private: false, bin: { openmotion: 'scripts/npm-installer.mjs' } };
-const manifest = { schemaVersion: 1, version: pkg.version, templateEnvironment: 'prod', commit: 'a'.repeat(40),
+const manifest = { schemaVersion: 1, version: pkg.version, templateEnvironment: 'dev', commit: 'a'.repeat(40),
application: { sha256: 'b'.repeat(64) }, locks: { npm: 'c'.repeat(64), native: 'd'.repeat(64) },
runtime: { targets: { mac: { platform: 'darwin', arch: 'arm64', minimumOS: '26.0' } } } };
const config = { endpoint: 'https://example.r2.cloudflarestorage.com', bucket: 'example-guides', publicOrigin: 'https://download.example.invalid' };
@@ -61,8 +61,11 @@ test('guide rendering pins the exact npm package, built source and hash while re
for (const name of ['https://evil.invalid/a', 'x;echo bad', '--script', '@bad/no/extra']) assert.throws(() => validateGuideSpec(name, pkg.version));
assert.throws(() => validateGuideSpec(pkg.name, 'latest'));
assert.throws(() => validateGuideIdentity({ ...pkg, private: true }, manifest), /public/);
- assert.throws(() => validateGuideIdentity(pkg, { ...manifest, templateEnvironment: 'dev' }), /prod/);
+ assert.throws(() => validateGuideIdentity(pkg, { ...manifest, templateEnvironment: 'prod' }), /Template defaults/);
assert.throws(() => validateGuideIdentity(pkg, { ...manifest, version: '0.6.4' }), /versions differ/);
+ const stable = { ...pkg, version: '0.6.4' };
+ assert.equal(validateGuideIdentity(stable, { ...manifest, version: stable.version, templateEnvironment: 'prod' }), 'stable');
+ assert.throws(() => validateGuideIdentity(stable, { ...manifest, version: stable.version }), /Template defaults/);
});
test('publication verifies the immutable URL before conditional fixed promotion and retains the prior guide', async t => {
diff --git a/tests/npm-package.test.ts b/tests/npm-package.test.ts
index dab67626..1d8c65b9 100644
--- a/tests/npm-package.test.ts
+++ b/tests/npm-package.test.ts
@@ -34,7 +34,7 @@ test('test npm artifacts contain their application, locked manifest and no bundl
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');
+ assert.equal(release.templateEnvironment, 'dev');
assert.equal(release.mcp.profile, 'phase1'); assert.deepEqual(release.mcp.tools, mcpRegistry().tools.map(tool => tool.name));
assert.deepEqual(release.skills, [...phase1Skills].sort());
assert.equal(release.installer.sha256, await sha256(built.installer)); assert.equal(release.application.sha256, await sha256(built.application));
@@ -52,7 +52,7 @@ test('test npm artifacts contain their application, locked manifest and no bundl
assert(!readme.startsWith('# Motion application npm package'));
assert.equal(await readFile(path.join(application, 'README.md'), 'utf8'), await readFile('README.md', 'utf8'), 'The embedded repository README retains its local links');
assert.equal((await json(path.join(application, 'package.json'))).version, version);
- assert.equal((await json(path.join(application, 'shared/template-config.json'))).environment, 'prod');
+ assert.equal((await json(path.join(application, 'shared/template-config.json'))).environment, 'dev');
assert.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);
@@ -64,7 +64,7 @@ test('test npm artifacts contain their application, locked manifest and no bundl
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.name, (await json('packages/npm/package.json')).name);
- assert.equal(metadata.publishConfig.tag, 'test'); assert.equal(metadata.publishConfig.access, 'public');
+ assert.equal(metadata.publishConfig.tag, 'candidate'); assert.equal(metadata.publishConfig.access, 'public');
assert.equal(metadata.bin.openmotion, 'scripts/npm-installer.mjs');
const cli = path.join(installer, 'package', metadata.bin.openmotion);
assert.equal((await runFile(process.execPath, [cli, '--version'])).trim(), version);
@@ -103,7 +103,7 @@ test('DEV npm packages carry their catalog environment without changing the chec
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(path.join(unpacked, 'package/package.json'))).private, false);
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');
@@ -119,9 +119,16 @@ test('stable artifacts stage publication instead of replacing latest and retain
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((await json(built.manifest)).templateEnvironment, 'prod');
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);
+ for (const [version, environment] of [['0.6.4-test.3', 'prod'], ['0.6.4', 'dev']]) {
+ const alternate = await packageNpm(path.join(directory, version + '-' + environment), version, environment);
+ const unpacked = path.join(directory, version + '-' + environment + '-npm');
+ await extractArchive(alternate.installer, unpacked);
+ assert.equal((await json(path.join(unpacked, 'package/package.json'))).private, true, 'Non-channel environment builds stay private');
+ }
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'));
diff --git a/tests/release-fixture.mjs b/tests/release-fixture.mjs
index b4988e20..0024f91a 100644
--- a/tests/release-fixture.mjs
+++ b/tests/release-fixture.mjs
@@ -3,7 +3,7 @@ import os from 'node:os';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { runFile, sha256, writeJSON } from '../scripts/runtime-assets.mjs';
-import { sealCandidate, repository, candidateWorkflow, publicationWorkflow, authorizationReceipt } from '../.github/scripts/motion-release.mjs';
+import { sealCandidate, repository, candidateWorkflow, publicationWorkflow, authorizationReceipt, platformReports } from '../.github/scripts/motion-release.mjs';
export async function candidateFixture(t) {
const work = await mkdtemp(path.join(os.tmpdir(), 'motion-release-test-'));
@@ -11,12 +11,13 @@ export async function candidateFixture(t) {
const root = fileURLToPath(new URL('../', import.meta.url)), build = path.join(work, 'build'), directory = path.join(work, 'candidate');
const commit = (await runFile('git', ['rev-parse', 'HEAD'], { cwd: root })).trim(), version = '0.6.4-test.99';
const app = path.join(work, 'app'), pkg = path.join(work, 'package');
- await mkdir(path.join(app, 'scripts'), { recursive: true }); await mkdir(path.join(pkg, 'payload'), { recursive: true }); await mkdir(build);
+ await mkdir(path.join(app, 'scripts'), { recursive: true }); await mkdir(path.join(app, 'shared')); await mkdir(path.join(pkg, 'payload'), { recursive: true }); await mkdir(build);
await writeJSON(path.join(app, 'package.json'), { version }); await writeJSON(path.join(app, 'package-lock.json'), {});
await writeJSON(path.join(app, 'scripts/runtime-lock.json'), {});
- const application = path.join(pkg, 'payload', `openmotion-application-${version}.tar.gz`);
+ await writeJSON(path.join(app, 'shared/template-config.json'), { environment: 'dev' });
+ const application = path.join(pkg, 'payload', `openmotion-application-${version}-dev.tar.gz`);
await runFile('tar', ['-czf', application, '-C', app, '.']);
- const manifest = { schemaVersion: 1, version, format: 'npm', templateEnvironment: 'prod', commit,
+ const manifest = { schemaVersion: 1, version, format: 'npm', templateEnvironment: 'dev', commit,
application: { url: './' + path.basename(application), sha256: await sha256(application) },
locks: { npm: await sha256(path.join(app, 'package-lock.json')), native: await sha256(path.join(app, 'scripts/runtime-lock.json')) },
runtime: { targets: { mac: { platform: 'darwin', arch: 'arm64', minimumOS: '26.0' } } } };
@@ -38,9 +39,10 @@ export async function candidateFixture(t) {
const authorization = authorizationReceipt(candidate, { id: 800, run_attempt: 1, actor: { login: 'operator' } }, inputs.action);
await writeJSON(path.join(directory, 'authorization.json'), authorization);
for (const platform of ['darwin-arm64', 'win32-x64']) await writeJSON(path.join(directory, `registry-${platform}.json`), {
- status: 'passed', platform, version, sourceCommit: commit, tgzSHA256: candidate.tgzSHA256,
+ status: 'passed', templateEnvironment: 'dev', platform, version, sourceCommit: commit, tgzSHA256: candidate.tgzSHA256,
registryColdInstall: 'passed', nativePreparation: 'passed', repeatSetup: 'passed', resources: 'passed', mcpTools: 11, skills: 5,
});
await writeJSON(path.join(directory, 'npm-publication.json'), { tgzSHA256: candidate.tgzSHA256, previousLatest: '0.5.0' });
+ await writeJSON(path.join(directory, 'test-promotion.json'), { version, tgzSHA256: candidate.tgzSHA256, action: inputs.action, publicationRun: publicationEnv.GITHUB_RUN_ID, status: 'already-promoted', platformVerification: await platformReports(directory, candidate) });
return { work, root, build, directory, candidate, inputs, provenance, app, pkg, manifest, authorization, env: publicationEnv };
}
diff --git a/tests/release-scan.test.mjs b/tests/release-scan.test.mjs
index 2aba686c..2246c8b3 100644
--- a/tests/release-scan.test.mjs
+++ b/tests/release-scan.test.mjs
@@ -39,11 +39,20 @@ test('tracked source is scanned without ignore-file bypasses; secret errors expo
test('the scanner opens the nested application, rejects hidden private content and rejects linked archive entries', async t => {
const f = await candidateFixture(t), { binary } = await scanner(t);
assert.equal((await scanPackage(path.join(f.directory, f.candidate.tgz), binary)).status, 'passed');
- await writeFile(path.join(f.app, '.env'), 'EXAMPLE=not-a-real-secret');
+ const templates = path.join(f.app, 'shared/template-config.json');
+ await writeJSON(templates, { environment: 'prod' });
const appArchive = path.join(f.pkg, 'payload', f.manifest.application.url.slice(2));
- await runFile('tar', ['-czf', appArchive, '-C', f.app, '.']);
- await writeJSON(path.join(f.pkg, 'payload/release-npm.json'), { ...f.manifest, application: { ...f.manifest.application, sha256: await sha256(appArchive) } });
- const tgz = path.join(f.work, 'hidden.tgz'); await runFile('tar', ['-czf', tgz, '-C', f.work, 'package']);
+ const tgz = path.join(f.work, 'hidden.tgz');
+ const repack = async () => {
+ await runFile('tar', ['-czf', appArchive, '-C', f.app, '.']);
+ await writeJSON(path.join(f.pkg, 'payload/release-npm.json'), { ...f.manifest, application: { ...f.manifest.application, sha256: await sha256(appArchive) } });
+ await runFile('tar', ['-czf', tgz, '-C', f.work, 'package']);
+ };
+ await repack();
+ await assert.rejects(scanPackage(tgz, binary), /template defaults differ/);
+ await writeJSON(templates, { environment: 'dev' });
+ await writeFile(path.join(f.app, '.env'), 'EXAMPLE=not-a-real-secret');
+ await repack();
await assert.rejects(scanPackage(tgz, binary), /environment-file/);
await symlink('package.json', path.join(f.app, 'linked')); const linked = path.join(f.work, 'linked.tar.gz');
await runFile('tar', ['-czf', linked, '-C', f.app, '.']);
diff --git a/tests/release-workflows.test.mjs b/tests/release-workflows.test.mjs
index 01c18606..20858b6b 100644
--- a/tests/release-workflows.test.mjs
+++ b/tests/release-workflows.test.mjs
@@ -1,10 +1,10 @@
import test from 'node:test';
import assert from 'node:assert/strict';
-import { readFile, writeFile } from 'node:fs/promises';
+import { readFile, writeFile, rm } from 'node:fs/promises';
import path from 'node:path';
import { createHash } from 'node:crypto';
import { candidateFixture } from './release-fixture.mjs';
-import { releaseInputs, resolveSource, validateSource, validateRun, verifyDownloaded, downloadCandidate, publishNpm, archiveRelease, repository, candidateWorkflow, recoveryWorkflow, publicationWorkflow, candidateJobName, findCandidate, authorizationReceipt, recordAuthorization } from '../.github/scripts/motion-release.mjs';
+import { releaseInputs, resolveSource, validateSource, validateRun, verifyDownloaded, downloadCandidate, publishNpm, promoteTest, archiveRelease, repository, candidateWorkflow, recoveryWorkflow, publicationWorkflow, candidateJobName, findCandidate, authorizationReceipt, recordAuthorization } from '../.github/scripts/motion-release.mjs';
import { compareReleaseVersions } from '../scripts/release-version.mjs';
import { consumerEnvironment } from '../.github/scripts/motion-registry-smoke.mjs';
import { runFile } from '../scripts/runtime-assets.mjs';
@@ -109,7 +109,7 @@ function registry(candidate, exists = true, tag = candidate.version, latest = '0
test('npm publishes only new exact bytes; identical retry and archive-only never write, mismatches fail', async t => {
const f = await candidateFixture(t); let calls = 0;
assert.notEqual(f.candidate.sourceCommit, f.candidate.workflow.sha, 'Application and workflow source identities are independent');
- const run = async (command, args) => { calls++; assert.equal(command, 'npm'); assert(args.includes('--ignore-scripts') && args.includes('test')); assert(args.includes('--provenance=false'), 'Do not attest the publication main SHA as the prebuilt application source'); assert.equal(args[1], path.join(f.directory, f.candidate.tgz)); };
+ const run = async (command, args) => { calls++; assert.equal(command, 'npm'); assert(args.includes('--ignore-scripts') && args.includes('candidate')); assert(args.includes('--provenance=false'), 'Do not attest the publication main SHA as the prebuilt application source'); assert.equal(args[1], path.join(f.directory, f.candidate.tgz)); };
await publishNpm(f.directory, f.inputs, { run, fetcher: registry(f.candidate, false), env: f.env }); assert.equal(calls, 1);
await publishNpm(f.directory, f.inputs, { run, fetcher: registry(f.candidate), env: f.env });
await assert.rejects(publishNpm(f.directory, f.inputs, { run, fetcher: registry({ ...f.candidate, integrity: 'different' }), env: f.env }), /different bytes/); assert.equal(calls, 1);
@@ -128,6 +128,37 @@ test('a stale candidate or authorization from another run cannot publish or move
assert.equal(calls, 0);
});
+test('test promotion requires both matching DEV native reports and preserves the old channel on failure', async t => {
+ const f = await candidateFixture(t); let writes = 0, tag = '0.6.4-test.1';
+ const options = { env: f.env, fetcher: () => registry(f.candidate, true, tag)(), run: async (command, args) => {
+ assert.equal(command, 'npm'); assert.deepEqual(args.slice(0, 4), ['dist-tag', 'add', '@openmotion/app@' + f.candidate.version, 'test']);
+ writes++; tag = f.candidate.version;
+ } };
+ const file = path.join(f.directory, 'registry-win32-x64.json'), original = await readFile(file, 'utf8');
+ for (const patch of [{ status: 'failed' }, { tgzSHA256: '0'.repeat(64) }, { templateEnvironment: 'prod' }, { nativePreparation: 'failed' }]) {
+ await writeFile(file, JSON.stringify({ ...JSON.parse(original), ...patch }));
+ await assert.rejects(promoteTest(f.directory, f.inputs, options));
+ assert.equal(writes, 0); assert.equal(tag, '0.6.4-test.1');
+ }
+ await rm(file); await assert.rejects(promoteTest(f.directory, f.inputs, options), /ENOENT/);
+ assert.equal(writes, 0); assert.equal(tag, '0.6.4-test.1');
+ await writeFile(file, original);
+ await assert.rejects(promoteTest(f.directory, f.inputs, { ...options, fetcher: registry(f.candidate, true, tag, '0.6.4') }), /latest changed/);
+ await assert.rejects(promoteTest(f.directory, f.inputs, { ...options, env: { GITHUB_RUN_ID: '801' } }), /another publication run/);
+ assert.equal(writes, 0);
+ assert.equal((await promoteTest(f.directory, f.inputs, options)).status, 'promoted');
+ assert.equal(writes, 1); assert.equal(tag, f.candidate.version);
+ assert.equal((await promoteTest(f.directory, f.inputs, options)).status, 'already-promoted');
+ assert.equal(writes, 1);
+});
+
+test('promotion never regresses a newer test tag and archive-only has no npm write', async t => {
+ const f = await candidateFixture(t), run = async () => { throw Error('Unexpected npm mutation'); };
+ assert.equal((await promoteTest(f.directory, f.inputs, { run, env: f.env, fetcher: registry(f.candidate, true, '0.6.4-test.100') })).status, 'superseded');
+ await writeFile(path.join(f.directory, 'authorization.json'), JSON.stringify({ ...f.authorization, action: 'archive-only' }));
+ assert.equal((await promoteTest(f.directory, { ...f.inputs, action: 'archive-only' }, { run, env: f.env, fetcher: registry(f.candidate) })).status, 'archive-only');
+});
+
test('test version ordering handles numeric suffixes, stable versions and unsafe numeric widths', () => {
for (const [a, b] of [['0.6.4-test.10', '0.6.4-test.9'], ['0.6.4', '0.6.4-test.99'], ['0.6.5-test.1', '0.6.4'], ['0.6.4-test.1.2', '0.6.4-test.1'], ['0.6.4-test.9007199254740993', '0.6.4-test.9007199254740992']]) {
assert.equal(compareReleaseVersions(a, b), 1); assert.equal(compareReleaseVersions(b, a), -1);
@@ -139,22 +170,26 @@ test('test version ordering handles numeric suffixes, stable versions and unsafe
test('partial publication retries use the retained producer artifact IDs across attempts', async () => {
const workflow = await readFile(new URL('../.github/workflows/motion-publish-test.yml', import.meta.url), 'utf8');
const jobs = Object.fromEntries(workflow.split('\njobs:\n')[1].split(/(?=^ [\w-]+:\n)/m).filter(s => s.trim()).map(s => [s.match(/^ ([\w-]+):\n/)[1], s]));
- const producers = ['verify', 'npm', 'registry-mac', 'registry-windows'];
+ const producers = ['verify', 'npm', 'registry-mac', 'registry-windows', 'promote-test'];
const render = (value, attempt) => value.replaceAll('${{ github.run_id }}', '800').replaceAll('${{ github.run_attempt }}', String(attempt));
for (const id of producers) {
assert(jobs[id], 'A platform needs its own retained output: ' + id);
assert(jobs[id].includes('artifact_id: ${{ steps.artifact.outputs.artifact-id }}'), 'Expose the actual uploaded artifact ID');
assert(jobs[id].includes(' id: artifact\n'));
}
- for (const id of ['npm', 'registry-mac', 'registry-windows', 'snapshot']) {
+ for (const id of ['npm', 'registry-mac', 'registry-windows', 'promote-test', 'snapshot']) {
assert(jobs[id].includes('if: ${{ always() && !cancelled() && needs.verify.result'), 'Successful retained producers must still supply partial retry consumers: ' + id);
}
const downloads = id => [...jobs[id].matchAll(/artifact-ids: \$\{\{ needs\.([\w-]+)\.outputs\.artifact_id \}\}/g)].map(m => m[1]);
assert.deepEqual(downloads('npm'), ['verify']);
assert.deepEqual(downloads('registry-mac'), ['verify']);
assert.deepEqual(downloads('registry-windows'), ['verify']);
+ assert.deepEqual(downloads('promote-test'), producers.slice(0, -1));
assert.deepEqual(downloads('snapshot'), producers);
- assert(jobs.snapshot.includes('needs: [verify, npm, registry-mac, registry-windows]'));
+ assert(jobs.snapshot.includes('needs: [verify, npm, registry-mac, registry-windows, promote-test]'));
+ assert(jobs['promote-test'].includes('needs.registry-mac.result') && jobs['promote-test'].includes('needs.registry-windows.result'));
+ assert(jobs['promote-test'].includes('id-token: write') && !jobs.snapshot.includes('id-token: write'));
+ assert(jobs['promote-test'].includes('[email protected]'));
assert(jobs.npm.includes(' actions: read\n'), 'The credentialed npm job needs only read access to input artifacts');
for (const job of Object.values(jobs)) {
for (const step of job.split(/(?=^ - )/m).filter(s => s.includes('uses: actions/download-artifact@'))) {
@@ -183,6 +218,7 @@ test('daily build and publication are separate manual entries without an indepen
const header = workflow.split('\njobs:\n')[0];
assert(build.includes('workflow_dispatch:') && build.includes('version:') && build.includes('source_sha:'));
assert(build.includes('name: ' + candidateJobName) && build.includes('ref: ${{ steps.source.outputs.source_sha }}'));
+ assert(build.includes('--template-env=dev') && !build.includes('--template-env=prod'));
assert(build.includes('name: motion-candidate-${{ inputs.version }}') && build.includes('candidate-install.md'));
assert(!build.includes('concurrency:') && !build.includes('secrets.') && !build.includes('id-token:'));
assert(header.includes('version:') && header.includes('accepted:') && header.includes('default: false'));
@@ -226,8 +262,10 @@ test('interrupted archive resumes identical snapshots, verifies the exact public
test('archive-only never reads or writes the moving entry, and failed platform acceptance blocks all storage calls', async t => {
const f = await candidateFixture(t), store = storage(f.candidate);
await writeFile(path.join(f.directory, 'authorization.json'), JSON.stringify({ ...f.authorization, action: 'archive-only' }));
+ await promoteTest(f.directory, { ...f.inputs, action: 'archive-only' }, { fetcher: registry(f.candidate), env: f.env, run: async () => { throw Error('Archive-only cannot write npm'); } });
await archiveRelease(f.directory, { ...f.inputs, action: 'archive-only' }, config, store);
assert(!store.reads.includes('open-motion/dev/install.md') && !store.writes.includes('open-motion/dev/install.md'));
+ await writeFile(path.join(f.directory, 'authorization.json'), JSON.stringify(f.authorization));
await writeFile(path.join(f.directory, 'registry-win32-x64.json'), JSON.stringify({ status: 'failed' }));
const before = store.reads.length; await assert.rejects(archiveRelease(f.directory, f.inputs, config, store)); assert.equal(store.reads.length, before);
});
@@ -265,15 +303,17 @@ test('no-publication rehearsal carries one accepted candidate through npm and st
const run = { ...origin, id: 800, path: publicationWorkflow, actor: { login: 'operator' } };
const github = async url => { assert(String(url).endsWith('/actions/runs/800')); return Response.json(run); };
await writeFile(path.join(f.directory, 'authorization.json'), '{}');
- let npmWrites = 0, published = false;
- const npm = { env: f.env, fetcher: () => registry(f.candidate, published)(), run: async (command, args) => {
- assert.equal(command, 'npm'); assert.equal(args[1], path.join(f.directory, f.candidate.tgz));
- npmWrites++; published = true;
+ let npmWrites = 0, tagWrites = 0, published = false, testTag = '0.6.4-test.1';
+ const npm = { env: f.env, fetcher: () => registry(f.candidate, published, testTag)(), run: async (command, args) => {
+ assert.equal(command, 'npm');
+ if (args[0] === 'dist-tag') { tagWrites++; testTag = f.candidate.version; }
+ else { assert.equal(args[1], path.join(f.directory, f.candidate.tgz)); assert.equal(args[args.indexOf('--tag') + 1], 'candidate'); npmWrites++; published = true; }
} };
await assert.rejects(publishNpm(f.directory, f.inputs, npm));
assert.equal(npmWrites, 0, 'No authorization means no registry write');
await recordAuthorization(f.directory, f.inputs, github, f.env);
await publishNpm(f.directory, f.inputs, npm);
+ await promoteTest(f.directory, f.inputs, npm);
await archiveRelease(f.directory, f.inputs, config, store);
assert.equal(npmWrites, 1);
const release = JSON.parse(store.objects.get(`open-motion/dev/${f.candidate.version}/release-record.json`));
@@ -282,6 +322,8 @@ test('no-publication rehearsal carries one accepted candidate through npm and st
assert.equal(release.tgzSHA256, f.candidate.tgzSHA256);
assert.equal(store.writes.at(-1), 'open-motion/dev/install.md');
await publishNpm(f.directory, f.inputs, npm);
+ await promoteTest(f.directory, f.inputs, npm);
await archiveRelease(f.directory, f.inputs, config, store);
assert.equal(npmWrites, 1, 'Retry never repacks or republishes the accepted bytes');
+ assert.equal(tagWrites, 1, 'Retry never moves an already verified tag again');
});