Skip to content

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.

fix(scripts): reclaim deploy worktrees that are dirty with nothing but build-regenerated output

nirholas63b258284196
diff --git a/scripts/clean-deploy-worktrees.mjs b/scripts/clean-deploy-worktrees.mjs
index 3203a254c..97c48def0 100644
--- a/scripts/clean-deploy-worktrees.mjs
+++ b/scripts/clean-deploy-worktrees.mjs
@@ -84,10 +84,38 @@ export function parseWorktrees(porcelain) {
return out;
}
+/**
+ * Tracked files the build rewrites in place. `npm run build:pages`
+ * (scripts/build-page-index.mjs) regenerates these index/feed JSONs and injects
+ * the og:image and twitter:image meta into every pages/*.html on every run, and
+ * the sibling generators (build-examples-index, mirror-examples-index,
+ * build-atlas-index, build-mcp-catalog) rewrite the rest. A deploy worktree
+ * therefore comes out of a build permanently modified, which used to make every
+ * one of them unreclaimable forever: on 2026-09-09 three had accumulated
+ * holding 11.3 GB, dirty with nothing but this generated output, while the disk
+ * sat at 99%. Regenerating any of it costs one command, so it is not work.
+ */
+const REGENERATED_TRACKED = [
+ /^CHANGELOG\.md$/,
+ /^data\/examples\.json$/,
+ /^pages\/[^/]+\.html$/,
+ /^public\/atlas-index\.json$/,
+ /^public\/changelog(-recent)?\.(json|xml)$/,
+ /^public\/examples\.json$/,
+ /^public\/features\.json$/,
+ /^public\/locales\/localized-pages\.json$/,
+ /^public\/mcp-catalog\.json$/,
+];
+
/**
* Untracked node_modules and build output are hardlinked or generated by the
* runbook itself, so they are not "work". Everything else counts as dirty.
*
+ * A tracked file counts as regenerable only when the build rewrites it in place
+ * (status ` M`, both index and worktree modifications). A deletion, rename or
+ * brand-new tracked file is never generator output, so those still disqualify
+ * the worktree no matter which path they touch.
+ *
* @param {string} porcelain output of `git status --porcelain`
* @returns {number} count of lines that represent real uncommitted work
*/
@@ -96,9 +124,11 @@ export function dirtyCount(porcelain) {
.split('\n')
.filter(Boolean)
.filter((l) => {
+ const status = l.slice(0, 2);
const file = l.slice(3);
- if (!l.startsWith('??')) return true;
- return !/(^|\/)(node_modules|dist|build)(\/|$)/.test(file);
+ if (status === '??') return !/(^|\/)(node_modules|dist|build)(\/|$)/.test(file);
+ if (!/^[ M]M$/.test(status)) return true;
+ return !REGENERATED_TRACKED.some((re) => re.test(file));
}).length;
}