Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
fix(deploy): fail audit:deploy when a workspace package.json and the lockfile disagree
nirholas4fb24a25c719
diff --git a/scripts/audit-deploy-artifacts.mjs b/scripts/audit-deploy-artifacts.mjsindex 823f5d99a..e076d9dcd 100644--- a/scripts/audit-deploy-artifacts.mjs+++ b/scripts/audit-deploy-artifacts.mjs@@ -33,6 +33,13 @@* and /.well-known/x402 answered 500 while local tests (on 2.14.0)* stayed green.*+ * 4. A workspace package.json that the lockfile does not describe. Renaming+ * or bumping a workspace (packages/*, the SDKs) without regenerating+ * package-lock.json leaves the local tree working, because the workspace+ * is a symlink, while npm ci in the image refuses the whole install. On+ * 2026-10-10 the rename of packages/three-ws-cli to @three-ws/cli failed+ * the Docker step with "Missing: @three-ws/[email protected] from lock file".+ ** Runs standalone (`node scripts/audit-deploy-artifacts.mjs`), as phase 1 of* scripts/build-vercel.mjs, and via tests/deploy-artifacts.test.js.*/@@ -327,6 +334,44 @@ export function findLockDrift({ lock, root = ROOT } = {}) {return drift;}+// ---------------------------------------------------------------------------+// 6. Every workspace package.json matches its lockfile entry+// ---------------------------------------------------------------------------++/**+ * Returns each workspace whose package.json name or version differs from its+ * package-lock.json entry, or that has no entry at all. npm ci rejects the+ * install on any of these, so the image build would fail at the Docker step.+ */+export function findWorkspaceLockMismatch({ lock, pkg, root = ROOT } = {}) {+ if (!lock) lock = JSON.parse(readFileSync(resolve(root, 'package-lock.json'), 'utf8'));+ if (!pkg) pkg = JSON.parse(readFileSync(resolve(root, 'package.json'), 'utf8'));+ const entries = lock.packages || {};+ const mismatches = [];+ for (const dir of pkg.workspaces || []) {+ let manifest;+ try {+ manifest = JSON.parse(readFileSync(resolve(root, dir, 'package.json'), 'utf8'));+ } catch {+ continue;+ }+ const locked = entries[dir];+ if (!locked) {+ mismatches.push({ dir, name: manifest.name, version: manifest.version, locked: null });+ continue;+ }+ if (locked.name !== manifest.name || locked.version !== manifest.version) {+ mismatches.push({+ dir,+ name: manifest.name,+ version: manifest.version,+ locked: `${locked.name}@${locked.version}`,+ });+ }+ }+ return mismatches;+}+// ---------------------------------------------------------------------------// CLI// ---------------------------------------------------------------------------@@ -395,12 +440,23 @@ if (isMain) {);}+ const workspaceDrift = findWorkspaceLockMismatch();+ if (workspaceDrift.length) {+ failed = true;+ console.error(+ `[audit:deploy] FAIL: ${workspaceDrift.length} workspace package.json(s) disagree with package-lock.json, so npm ci in the image will refuse to install (the @three-ws/cli rename). Run \`npm install --package-lock-only --ignore-scripts\` in the shared tree and commit package-lock.json:`,+ );+ for (const w of workspaceDrift) {+ console.error(` ${w.dir} is ${w.name}@${w.version}, lockfile has ${w.locked ?? 'no entry'}`);+ }+ }+const elapsed = ((Date.now() - start) / 1000).toFixed(1);if (failed) {console.error(`\n[audit:deploy] failed in ${elapsed}s`);process.exit(1);}console.log(- `[audit:deploy] clean in ${elapsed}s: no committed symlinks, no unsatisfied peers, no undeclared api imports, install tree matches the lockfile, decoder assets ${distAssets.skipped ? 'skipped (no dist/)' : 'present'}`,+ `[audit:deploy] clean in ${elapsed}s: no committed symlinks, no unsatisfied peers, no undeclared api imports, install tree and workspaces match the lockfile, decoder assets ${distAssets.skipped ? 'skipped (no dist/)' : 'present'}`,);}diff --git a/tests/deploy-artifacts.test.js b/tests/deploy-artifacts.test.jsindex 4f63e74ee..720748e75 100644--- a/tests/deploy-artifacts.test.js+++ b/tests/deploy-artifacts.test.js@@ -25,6 +25,7 @@ import {findUnsatisfiedPeers,findUndeclaredApiImports,findLockDrift,+ findWorkspaceLockMismatch,} from '../scripts/audit-deploy-artifacts.mjs';const scratchDirs = [];@@ -53,6 +54,44 @@ describe('deploy artifacts', () => {it('runs against the dependency versions the lockfile will install in the image', () => {expect(findLockDrift()).toEqual([]);});++ it('describes every workspace package.json in the lockfile, or npm ci in the image refuses to install', () => {+ expect(findWorkspaceLockMismatch()).toEqual([]);+ });+});++describe('findWorkspaceLockMismatch logic', () => {+ function workspace(root, dir, manifest) {+ mkdirSync(join(root, dir), { recursive: true });+ writeFileSync(join(root, dir, 'package.json'), JSON.stringify(manifest));+ }++ it('reports a renamed, a bumped and an unlocked workspace', () => {+ const root = scratchDir();+ workspace(root, 'packages/cli', { name: '@scope/cli', version: '0.1.1' });+ workspace(root, 'packages/mcp', { name: '@scope/mcp', version: '0.2.7' });+ workspace(root, 'packages/new', { name: '@scope/new', version: '1.0.0' });+ const pkg = { workspaces: ['packages/cli', 'packages/mcp', 'packages/new'] };+ const lock = {+ packages: {+ 'packages/cli': { name: 'cli', version: '0.1.1' },+ 'packages/mcp': { name: '@scope/mcp', version: '0.2.6' },+ },+ };+ expect(findWorkspaceLockMismatch({ lock, pkg, root })).toEqual([+ { dir: 'packages/cli', name: '@scope/cli', version: '0.1.1', locked: '[email protected]' },+ { dir: 'packages/mcp', name: '@scope/mcp', version: '0.2.7', locked: '@scope/[email protected]' },+ { dir: 'packages/new', name: '@scope/new', version: '1.0.0', locked: null },+ ]);+ });++ it('passes a workspace whose name and version match its lock entry', () => {+ const root = scratchDir();+ workspace(root, 'packages/cli', { name: '@scope/cli', version: '0.1.1' });+ const pkg = { workspaces: ['packages/cli'] };+ const lock = { packages: { 'packages/cli': { name: '@scope/cli', version: '0.1.1' } } };+ expect(findWorkspaceLockMismatch({ lock, pkg, root })).toEqual([]);+ });});describe('findUndeclaredApiImports logic', () => {