From 735d84a2d5e79e23199295ee23764998148b7748 Mon Sep 17 00:00:00 2001 From: NiveditJain Date: Mon, 6 Apr 2026 20:57:14 +0000 Subject: [PATCH] fix: default binary to production mode and fix standalone next start - `failproofai` now launches production dashboard by default (was dev mode) - Removes `--start` flag from binary (production is the only mode for end users) - `scripts/launch.ts`: use `node .next/standalone/server.js` for start mode, fixing the "next start does not work with output: standalone" warning - `package.json`: add `predev`/`prestart` hooks to auto-run `bun link` so `which failproofai` resolves during local development without a manual step Co-Authored-By: Claude Sonnet 4.6 --- bin/failproofai.mjs | 8 +++----- package.json | 2 ++ scripts/launch.ts | 16 +++++++++++++++- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/bin/failproofai.mjs b/bin/failproofai.mjs index 7b5d6767..e6f4d0e7 100644 --- a/bin/failproofai.mjs +++ b/bin/failproofai.mjs @@ -8,8 +8,7 @@ * --install-policies Install hooks + enable policies in Claude Code settings * --remove-policies Remove hooks or disable policies from Claude Code settings * --list-policies List available policies and their status - * (default) Launch Next.js in dev mode - * --start Launch Next.js in production mode + * (default) Launch production dashboard */ import { version } from "../package.json"; @@ -90,7 +89,6 @@ if (args.includes("--list-policies")) { process.exit(0); } -// Dashboard launch — dev mode by default, --start for production +// Dashboard launch — always production mode const { launch } = await import("../scripts/launch"); -const mode = args.includes("--start") ? "start" : "dev"; -launch(mode); +launch("start"); diff --git a/package.json b/package.json index 50b74444..10e80399 100644 --- a/package.json +++ b/package.json @@ -18,8 +18,10 @@ "bun": ">=1.3.0" }, "scripts": { + "predev": "bun link", "dev": "FAILPROOFAI_TELEMETRY_DISABLED=1 bun scripts/dev.ts --port 8020", "build": "bun --bun next build", + "prestart": "bun link", "start": "FAILPROOFAI_TELEMETRY_DISABLED=1 bun scripts/start.ts", "test": "vitest", "test:run": "vitest run", diff --git a/scripts/launch.ts b/scripts/launch.ts index 3b928e64..e68b707c 100644 --- a/scripts/launch.ts +++ b/scripts/launch.ts @@ -29,7 +29,21 @@ export function launch(mode: "dev" | "start"): void { process.env.CLAUDE_PROJECTS_PATH = claudeProjectsPath; - const nextProcess = spawn("bunx", ["--bun", "next", mode, ...remainingArgs], { + let cmd: string; + let cmdArgs: string[]; + if (mode === "start") { + const portIdx = remainingArgs.indexOf("--port"); + const port = portIdx >= 0 ? remainingArgs[portIdx + 1] : "8020"; + process.env.PORT = port; + process.env.HOSTNAME = "0.0.0.0"; + cmd = "node"; + cmdArgs = [".next/standalone/server.js"]; + } else { + cmd = "bunx"; + cmdArgs = ["--bun", "next", "dev", ...remainingArgs]; + } + + const nextProcess = spawn(cmd, cmdArgs, { stdio: "inherit", env: { ...process.env,