Multi-Agent Collaboration for Team and Friends
TypeScript agent-automationagent-orchestrationagent-workflowai-agentsai-collaborationai-memoryai-workforceautonomous-agentsclaude-codeclaude-code-skillscodexcoding-agentmulti-agentmultiple-agentone-person-businessone-person-companyone-person-teamopencodesolopreneur
fix(app): rewrite CI absolute paths in bundle for local onboard
Gus6de3a051dcb0
diff --git a/src/app/scripts/bundle.ts b/src/app/scripts/bundle.tsindex 9125f9332..d43b0a6ca 100644--- a/src/app/scripts/bundle.ts+++ b/src/app/scripts/bundle.ts@@ -20,6 +20,31 @@ function run(cmd: string, cwd: string) {execSync(cmd, { cwd, stdio: "inherit" });}+function rewriteAbsolutePaths(webDest: string): void {+ const handlerDir = join(webDest, ".open-next/server-functions/default/src/web");+ const metaPath = join(handlerDir, "handler.mjs.meta.json");+ const handlerPath = join(handlerDir, "handler.mjs");++ if (!existsSync(metaPath) || !existsSync(handlerPath)) return;++ let meta = readFileSync(metaPath, "utf-8");++ // Wrangler resolves "path" fields relative to the handler file's directory (src/web/).+ // Assets live at .open-next/server-functions/default/node_modules/... which is ../../node_modules/ from src/web/.+ const match = meta.match(/"path":\s*"(\/[^"]*?)\.open-next\/server-functions\/default\/node_modules\//);+ if (!match) return;++ const ciPrefix = match[1] + ".open-next/server-functions/default/node_modules/";+ console.log(`[bundle] Rewriting CI paths (prefix: ${ciPrefix})`);++ meta = meta.replaceAll(ciPrefix, "../../node_modules/");+ writeFileSync(metaPath, meta);++ let handler = readFileSync(handlerPath, "utf-8");+ handler = handler.replaceAll(ciPrefix, "../../node_modules/");+ writeFileSync(handlerPath, handler);+}+// Cleanif (existsSync(bundledDir)) rmSync(bundledDir, { recursive: true });@@ -63,6 +88,7 @@ try {const webDest = join(bundledDir, "web");mkdirSync(webDest, { recursive: true });cpSync(join(webSrc, ".open-next"), join(webDest, ".open-next"), { recursive: true });+rewriteAbsolutePaths(webDest);cpSync(join(webSrc, "wrangler.toml"), join(webDest, "wrangler.toml"));cpSync(join(webSrc, "custom-worker.ts"), join(webDest, "custom-worker.ts"));cpSync(join(webSrc, "migrations"), join(webDest, "migrations"), { recursive: true });diff --git a/src/app/src/lib/wrangler-config.ts b/src/app/src/lib/wrangler-config.tsindex aa67106f6..a05e322ec 100644--- a/src/app/src/lib/wrangler-config.ts+++ b/src/app/src/lib/wrangler-config.ts@@ -12,6 +12,18 @@ function setDevPort(tomlPath: string, port: number): void {writeFileSync(tomlPath, content);}+function setInspectorPort(tomlPath: string, inspectorPort: number): void {+ let content = readFileSync(tomlPath, "utf-8");+ if (content.includes("inspector_port")) {+ content = content.replace(/inspector_port\s*=\s*\d+/, `inspector_port = ${inspectorPort}`);+ } else if (content.includes("[dev]")) {+ content = content.replace(/(\[dev\][^\[]*)/, `$1inspector_port = ${inspectorPort}\n`);+ } else {+ content += `\n[dev]\ninspector_port = ${inspectorPort}\n`;+ }+ writeFileSync(tomlPath, content);+}+function setVar(content: string, key: string, value: string): string {const pattern = new RegExp(`${key}\\s*=\\s*"[^"]*"`);if (pattern.test(content)) {@@ -40,4 +52,8 @@ export function patchWranglerConfigs(ports: { web: number; emailWorker: number;setDevPort(join(SELF_HOSTED_DIR, "email-worker", "wrangler.toml"), ports.emailWorker);setDevPort(join(SELF_HOSTED_DIR, "ws-do", "wrangler.toml"), ports.wsDo);++ setInspectorPort(join(SELF_HOSTED_DIR, "web", "wrangler.toml"), 19229);+ setInspectorPort(join(SELF_HOSTED_DIR, "ws-do", "wrangler.toml"), 19230);+ setInspectorPort(join(SELF_HOSTED_DIR, "email-worker", "wrangler.toml"), 19231);}