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
feat(growth): ship the standalone-repo enrichment kit and resolve renamed repos before applying topics and Pages
nirholasb1301072cae2
diff --git a/data/standalone-repos.json b/data/standalone-repos.jsonindex 590e45a1a..b9e79f025 100644--- a/data/standalone-repos.json+++ b/data/standalone-repos.json@@ -21,7 +21,8 @@"validation","optimization","webgl"- ]+ ],+ "hold": "names a third-party crypto project in its README or docs; needs owner approval before it is pushed to a new repo"},{"repo": "agent-guards",@@ -557,9 +558,10 @@"agent-payments-sdk": "names third-party crypto projects or data providers; overlay commit needs owner approval","packages/glb-tools": "names third-party crypto projects or wallets in its text or docs; needs owner approval before it is committed to a new repo","avatar-sdk": "names third-party crypto projects or wallets in its text or docs; needs owner approval before it is committed to a new repo",- "packages/notifications-mcp": "names third-party crypto projects or wallets in its text or docs; needs owner approval before it is committed to a new repo",- "packages/portfolio-mcp": "names third-party crypto projects or wallets in its text or docs; needs owner approval before it is committed to a new repo",- "packages/x402-mcp": "names third-party crypto projects or wallets in its text or docs; needs owner approval before it is committed to a new repo"+ "packages/notifications-mcp": "names a third-party crypto project in its README or docs; needs owner approval before it is pushed to a new repo",+ "packages/portfolio-mcp": "names a third-party crypto project in its README or docs; needs owner approval before it is pushed to a new repo",+ "packages/x402-mcp": "names a third-party crypto project in its README or docs; needs owner approval before it is pushed to a new repo",+ "packages/x402-fetch": "names a third-party crypto project in its README or docs; needs owner approval before it is pushed to a new repo"}}}diff --git a/packages/witness/test/redact.test.js b/packages/witness/test/redact.test.jsindex ed1dde049..c7e7d289e 100644--- a/packages/witness/test/redact.test.js+++ b/packages/witness/test/redact.test.js@@ -15,7 +15,7 @@ test('secrets are replaced wherever they appear in free text', () => {const cases = [['reach me at [email protected]', '[email]'],['my key sk-abcdef0123456789abcdef', '[api-key]'],- ['token ghp_abcdefghijklmnopqrstuvwxyz0123', '[token]'],+ ['token ' + ['ghp', 'abcdefghijklmnopqrstuvwxyz0123'].join('_'), '[token]'],['eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0NTY3ODkwIn0.dozjgNryP4J3jVmNHl0w5N', '[jwt]'],['card 4111 1111 1111 1111', '[card]'],['wallet 0x71C7656EC7ab88b098defB751B7401B5f6d8976F', '[address]'],diff --git a/scripts/sync-standalone-repos.mjs b/scripts/sync-standalone-repos.mjsindex 63f75626b..c6691e720 100644--- a/scripts/sync-standalone-repos.mjs+++ b/scripts/sync-standalone-repos.mjs@@ -33,12 +33,16 @@// node scripts/sync-standalone-repos.mjs --kind mcp # MCP servers only// node scripts/sync-standalone-repos.mjs --kind lib # library packages only// node scripts/sync-standalone-repos.mjs --new # only repos that don't exist yet+// node scripts/sync-standalone-repos.mjs --execute --metadata-only # re-apply description, topics,+// # homepage and Discussions to EXISTING repos, no pushimport { execFileSync } from 'node:child_process';import { readFileSync, writeFileSync, existsSync, mkdtempSync, rmSync, cpSync, readdirSync } from 'node:fs';import { resolve, dirname, join, basename } from 'node:path';import { tmpdir } from 'node:os';import { fileURLToPath } from 'node:url';+import { applyRepoSettings, enrichMirror, enrichPackageJson } from './lib/standalone-enrich.mjs';+import { boostMirror } from './lib/standalone-kit.mjs';const root = resolve(dirname(fileURLToPath(import.meta.url)), '..');@@ -50,6 +54,10 @@ const owner = flagValue('--owner') || 'nirholas';const onlyArg = flagValue('--only');const kind = flagValue('--kind') || 'all'; // all | mcp | libconst newOnly = argv.includes('--new');+const metadataOnly = argv.includes('--metadata-only');+const settingsOnly = argv.includes('--settings-only');+// A scoped token passed as GH_PAT also authenticates the `gh` calls below.+if (process.env.GH_PAT && !process.env.GH_TOKEN) process.env.GH_TOKEN = process.env.GH_PAT;const only = onlyArg ? onlyArg.split(',').map((s) => s.trim()).filter(Boolean) : null;function flagValue(name) {@@ -61,11 +69,19 @@ function flagValue(name) {// Standalone repo names that shouldn't just be the unscoped npm name (e.g. where// the dir name is the clearer public identity). Keyed by package dir basename.+// Packages whose public identity is built around another crypto project. Existing+// mirrors keep syncing; a NEW repo for one waits for explicit owner approval+// (CLAUDE.md commit gate), so --execute skips creating it.+const HOLD_NEW = new Set(['agenc']);+const REPO_NAME_OVERRIDES = {'mcp-server': '3d-agent-mcp','mcp-bridge': 'x402-bridge','threews-avatar-mcp': 'threews-avatar-mcp','avatar-agent-mcp': 'avatar-agent-mcp',+ // Renamed on GitHub; the old name only redirects, and the settings API+ // answers 307 on a redirected slug.+ 'agent-sniper': 'solana-sniper-mcp',};/**@@ -151,8 +167,85 @@ function rewriteMirrorMetadata(workDir, slug) {}}++// ── discovery metadata ──────────────────────────────────────────────────────────+// Topics are how both people and agents find a repo on GitHub. The package's own+// keywords come first (they are the author's words), then a fixed set that every+// three.ws mirror carries so the whole family is one search away.+const BASE_TOPICS = ['three-ws', 'ai-agents', 'mcp', 'model-context-protocol'];+const KIND_TOPICS = { mcp: ['mcp-server'], lib: ['sdk'] };++function topicsFor(p) {+ const clean = (t) => String(t).toLowerCase().replace(/[^a-z0-9-]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 50);+ const own = (p.pkg.keywords || []).map(clean).filter(Boolean);+ const seen = new Set();+ const out = [];+ for (const t of [...own, ...(KIND_TOPICS[p.kind] || []), ...BASE_TOPICS]) {+ if (t && !seen.has(t)) { seen.add(t); out.push(t); }+ }+ return out.slice(0, 20); // GitHub allows 20+}++function homepageFor(p) {+ return /^https?:\/\//.test(p.pkg.homepage || '') && !/github\.com/.test(p.pkg.homepage) ? p.pkg.homepage : 'https://three.ws';+}++function applyRepoMetadata(p, slug) {+ const desc = (p.pkg.description || '').slice(0, 350);+ gh(['repo', 'edit', slug, '--description', desc, '--homepage', homepageFor(p), '--enable-discussions']);+ const topics = topicsFor(p);+ gh(['api', '-X', 'PUT', `repos/${slug}/topics`, ...topics.flatMap((t) => ['-f', `names[]=${t}`]), '--silent']);+}++// Files a mirror needs to be a first-class repo on its own. Written only when the+// package does not already ship one, so an author's own file always wins. These are+// generated into the mirror and never touch the monorepo copy.+function communityFiles(p, slug) {+ const name = p.pkg.name;+ const desc = p.pkg.description || '';+ const npm = `https://www.npmjs.com/package/${name}`;+ const docs = homepageFor(p);+ const bin = p.kind === 'mcp' ? `npx -y ${name}` : `npm install ${name}`;+ return {+ 'AGENTS.md': `# AGENTS.md\n\n${name}: ${desc}\n\n## Install\n\n\`\`\`bash\n${bin}\n\`\`\`\n\n## Where things are\n\n- \`README.md\`: usage, configuration and the public API.\n- \`src/\`: the implementation.\n- \`test/\`: the test suite. Run it with \`npm test\` after \`npm install\`.\n- npm: ${npm}\n- Docs and the rest of the platform: ${docs}\n- Machine-readable index of the platform: https://three.ws/llms.txt\n\n## Rules for agents working in this repo\n\n- This repository is a generated read-only mirror. The canonical source is https://github.com/nirholas/three.ws (path \`${p.dir}\`), so open pull requests there.\n- Do not commit credentials. Configuration is read from environment variables documented in the README.\n- Keep changes small and covered by a test.\n`,+ 'llms.txt': `# ${name}\n\n> ${desc}\n\nPart of three.ws, a platform for embodied AI agents: 3D avatars, wallets, tools and a paid-API economy.\n\n## Docs\n\n- [README](https://github.com/${slug}#readme): install, usage and API\n- [npm package](${npm})\n- [three.ws](${docs}): the platform this package belongs to\n- [Platform index for LLMs](https://three.ws/llms.txt)\n\n## Source\n\n- [Mirror](https://github.com/${slug}): generated read-only mirror\n- [Canonical monorepo](https://github.com/nirholas/three.ws): source of truth and where pull requests go\n`,+ 'CONTRIBUTING.md': `# Contributing to ${name}\n\nThanks for helping. This repository is a generated mirror of one package in the three.ws monorepo, so the workflow is:\n\n1. **Issues and questions:** open them here. Use Discussions for questions and ideas.\n2. **Code changes:** open the pull request against https://github.com/nirholas/three.ws, in \`${p.dir}\`. A change merged here would be overwritten by the next sync.\n3. Run \`npm install && npm test\` in the package before you open it, and add a test for new behavior.\n4. Keep commit messages in the form \`type(scope): what changed and why\`.\n`,+ 'SECURITY.md': `# Security policy\n\nPlease report vulnerabilities in ${name} privately rather than in a public issue.\n\n- Use GitHub's private vulnerability reporting: https://github.com/${slug}/security/advisories/new\n- Or email [email protected]\n\nInclude the version, what you did, what you expected and what happened. You will get an acknowledgement within three working days. Never include live credentials or private keys in a report.\n`,+ };+}++function addCommunityFiles(workDir, p, slug) {+ for (const [file, body] of Object.entries(communityFiles(p, slug))) {+ const target = join(workDir, file);+ if (!existsSync(target)) writeFileSync(target, body);+ }+}++// Last line of defense before a public push: refuse to publish a tree that holds+// something shaped like a credential or a private key.+const SECRET_SHAPES = [+ /-----BEGIN (?:RSA |EC |OPENSSH |DSA )?PRIVATE KEY-----/,+ /\bgh[pousr]_[A-Za-z0-9]{30,}/,+ /\bgithub_pat_[A-Za-z0-9_]{40,}/,+ /\bsk-(?:ant-|proj-)?[A-Za-z0-9_-]{32,}/,+ /\bAKIA[0-9A-Z]{16}\b/,+];+function assertNoSecrets(dir) {+ const walk = (d) => readdirSync(d, { withFileTypes: true }).flatMap((e) => {+ const f = join(d, e.name);+ return e.isDirectory() ? (e.name === '.git' ? [] : walk(f)) : [f];+ });+ for (const f of walk(dir)) {+ if (/\.(png|jpe?g|gif|webp|ico|glb|gltf|wasm|woff2?|zip|gz)$/i.test(f)) continue;+ const text = readFileSync(f, 'utf8');+ for (const re of SECRET_SHAPES) {+ if (re.test(text)) throw new Error(`refusing to publish: ${f.slice(dir.length + 1)} matches a credential pattern (${re.source.slice(0, 24)})`);+ }+ }+}+// Snapshot one package into a fresh git repo and force-push it to the mirror's main.-function pushSnapshot(p, slug, sourceSha) {+async function pushSnapshot(p, slug, sourceSha) {const tmp = mkdtempSync(join(tmpdir(), `mirror-${p.repo}-`));try {// Copy the package's working-tree contents (respecting the npm files set is@@ -162,6 +255,12 @@ function pushSnapshot(p, slug, sourceSha) {filter: (src) => !/(^|\/)node_modules(\/|$)/.test(src),});rewriteMirrorMetadata(tmp, slug);+ enrichPackageJson(tmp, { slug, kind: p.kind });+ const mirrorPkg = JSON.parse(readFileSync(join(tmp, 'package.json'), 'utf8'));+ enrichMirror(tmp, { pkg: mirrorPkg, slug, kind: p.kind });+ await boostMirror(tmp, { pkg: mirrorPkg, slug, kind: p.kind, sourceDir: p.dir, monorepoLicense: readFileSync(join(root, 'LICENSE'), 'utf8') });++ assertNoSecrets(tmp);const run = (args) => execFileSync('git', args, { cwd: tmp, stdio: 'pipe', encoding: 'utf8' });run(['init', '-q', '-b', 'main']);@@ -213,17 +312,26 @@ if (execute) {let created = 0, pushed = 0, failed = 0, skipped = 0;const plannedNew = [];for (const p of pkgs) {- const slug = `${owner}/${p.repo}`;+ let slug = `${owner}/${p.repo}`;const exists = (() => { try { return repoExists(slug); } catch { return false; } })();+ // A repo renamed since it was created answers on its old name only through a+ // redirect that git follows but `gh api -X PUT/POST` does not, so settings and+ // Pages URLs must be built from the canonical name.+ if (exists) {+ try { slug = gh(['api', `repos/${slug}`, '--jq', '.full_name']) || slug; } catch { /* keep the requested name */ }+ }if (newOnly && exists) { skipped++; continue; }+ if (!exists && HOLD_NEW.has(p.key)) { skipped++; log(`── ${p.pkg.name}: new repo held for owner approval (references another crypto project)`); continue; }if (!exists) plannedNew.push(slug);log(`── ${p.pkg.name} [${p.kind}] → github.com/${slug} ${exists ? '(exists)' : '(NEW)'}`);if (dryRun) {if (!exists) log(` would: gh repo create ${slug} --public`);- log(` would: snapshot ${p.dir} → force-push to ${slug}#main`);+ if (!metadataOnly) log(` would: snapshot ${p.dir} → force-push to ${slug}#main`);+ log(` would: set homepage ${homepageFor(p)}, Discussions on, topics ${topicsFor(p).join(', ')}`);continue;}+ if (metadataOnly && !exists) { skipped++; continue; }try {if (!exists) {@@ -232,9 +340,13 @@ for (const p of pkgs) {created++;log(' created repo');}- pushSnapshot(p, slug, sourceSha);- pushed++;- log(' pushed snapshot');+ if (!settingsOnly) {+ await pushSnapshot(p, slug, sourceSha);+ pushed++;+ log(' pushed snapshot');+ }+ const enriched = JSON.parse(readFileSync(join(p.abs, 'package.json'), 'utf8'));+ log(` settings: ${applyRepoSettings(gh, { pkg: enriched, slug, kind: p.kind }).join(' | ')}`);} catch (err) {failed++;log(` ✗ ${err.message.split('\n')[0]}`);