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(robinhood-feed): build the SDK when a fresh clone has no dist directory

nirholasda32f982fcb0
diff --git a/workers/robinhood-feed/scripts/ensure-sdk.mjs b/workers/robinhood-feed/scripts/ensure-sdk.mjs
new file mode 100644
index 000000000..a938836ba
--- /dev/null
+++ b/workers/robinhood-feed/scripts/ensure-sdk.mjs
@@ -0,0 +1,35 @@
+// Build the local `hoodchain` SDK if its dist/ is missing.
+//
+// package.json depends on the SDK through `file:../../robinhood/robinhood-chain-sdk`,
+// which npm resolves by symlinking the source directory. npm does NOT run that
+// directory's build for a file: dependency, and the SDK ships TypeScript whose
+// dist/ is gitignored, so a fresh clone gets a symlink to a package with no
+// entry point and `node index.js` dies with ERR_MODULE_NOT_FOUND. This runs as
+// the worker's `prestart`/`presmoke` hook so `npm start` works from a clean
+// checkout with no manual step.
+
+import { execFileSync } from 'node:child_process';
+import { existsSync } from 'node:fs';
+import { dirname, join } from 'node:path';
+import { fileURLToPath } from 'node:url';
+
+const workerDir = dirname(dirname(fileURLToPath(import.meta.url)));
+const sdkDir = join(workerDir, '..', '..', 'robinhood', 'robinhood-chain-sdk');
+const entry = join(sdkDir, 'dist', 'index.js');
+
+if (existsSync(entry)) {
+ process.exit(0);
+}
+
+if (!existsSync(join(sdkDir, 'package.json'))) {
+ console.error(`[ensure-sdk] hoodchain source not found at ${sdkDir}`);
+ console.error('[ensure-sdk] install the published package instead: npm install hoodchain');
+ process.exit(1);
+}
+
+const run = (args) => execFileSync('npm', args, { cwd: sdkDir, stdio: 'inherit' });
+
+console.log('[ensure-sdk] building hoodchain from source (dist/ is gitignored and absent)');
+if (!existsSync(join(sdkDir, 'node_modules'))) run(['install', '--no-audit', '--no-fund']);
+run(['run', 'build']);
+console.log('[ensure-sdk] hoodchain dist/ ready');