From 60efe8ed7b44e1281aea7104c610325a36942fa1 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sun, 18 Jan 2026 18:00:48 +0000 Subject: [PATCH] fix: restore bun runners for dev scripts --- package.json | 32 +++++++++++------------ scripts/gateway-watch.mjs | 53 --------------------------------------- 2 files changed, 16 insertions(+), 69 deletions(-) delete mode 100644 scripts/gateway-watch.mjs diff --git a/package.json b/package.json index 2cae1fa1a..5d6da168c 100644 --- a/package.json +++ b/package.json @@ -65,27 +65,27 @@ "dist/whatsapp/**" ], "scripts": { - "dev": "tsx src/entry.ts", + "dev": "bun src/entry.ts", "postinstall": "node scripts/postinstall.js", "prepack": "pnpm build", - "docs:list": "tsx scripts/docs-list.ts", + "docs:list": "bun scripts/docs-list.ts", "docs:bin": "bun build scripts/docs-list.ts --compile --outfile bin/docs-list", "docs:dev": "cd docs && mint dev", "docs:build": "cd docs && pnpm dlx --reporter append-only mint broken-links", - "build": "tsc -p tsconfig.json && tsx scripts/canvas-a2ui-copy.ts && tsx scripts/copy-hook-metadata.ts && tsx scripts/write-build-info.ts", - "plugins:sync": "tsx scripts/sync-plugin-versions.ts", - "release:check": "tsx scripts/release-check.ts", + "build": "tsc -p tsconfig.json && bun scripts/canvas-a2ui-copy.ts && bun scripts/copy-hook-metadata.ts && bun scripts/write-build-info.ts", + "plugins:sync": "bun scripts/sync-plugin-versions.ts", + "release:check": "bun scripts/release-check.ts", "ui:install": "node scripts/ui.js install", "ui:dev": "node scripts/ui.js dev", "ui:build": "node scripts/ui.js build", - "start": "tsx src/entry.ts", - "clawdbot": "tsx src/entry.ts", - "gateway:watch": "node scripts/gateway-watch.mjs gateway --force", - "gateway:dev": "CLAWDBOT_SKIP_CHANNELS=1 tsx src/entry.ts --dev gateway", - "gateway:dev:reset": "CLAWDBOT_SKIP_CHANNELS=1 tsx src/entry.ts --dev gateway --reset", - "tui": "tsx src/entry.ts tui", - "tui:dev": "CLAWDBOT_PROFILE=dev tsx src/entry.ts tui", - "clawdbot:rpc": "tsx src/entry.ts agent --mode rpc --json", + "start": "bun src/entry.ts", + "clawdbot": "bun src/entry.ts", + "gateway:watch": "bun --watch src/entry.ts gateway --force", + "gateway:dev": "CLAWDBOT_SKIP_CHANNELS=1 bun src/entry.ts --dev gateway", + "gateway:dev:reset": "CLAWDBOT_SKIP_CHANNELS=1 bun src/entry.ts --dev gateway --reset", + "tui": "bun src/entry.ts tui", + "tui:dev": "CLAWDBOT_PROFILE=dev bun src/entry.ts tui", + "clawdbot:rpc": "bun src/entry.ts agent --mode rpc --json", "ios:gen": "cd apps/ios && xcodegen generate", "ios:open": "cd apps/ios && xcodegen generate && open Clawdbot.xcodeproj", "ios:build": "bash -lc 'cd apps/ios && xcodegen generate && xcodebuild -project Clawdbot.xcodeproj -scheme Clawdbot -destination \"${IOS_DEST:-platform=iOS Simulator,name=iPhone 17}\" -configuration Debug build'", @@ -108,7 +108,7 @@ "test": "vitest run", "test:watch": "vitest", "test:ui": "pnpm --dir ui test", - "test:force": "tsx scripts/test-force.ts", + "test:force": "bun scripts/test-force.ts", "test:coverage": "vitest run --coverage", "test:e2e": "vitest run --config vitest.e2e.config.ts", "test:live": "CLAWDBOT_LIVE_TEST=1 vitest run --config vitest.live.config.ts", @@ -126,8 +126,8 @@ "test:install:smoke": "bash scripts/test-install-sh-docker.sh", "test:install:e2e:openai": "CLAWDBOT_E2E_MODELS=openai bash scripts/test-install-sh-e2e-docker.sh", "test:install:e2e:anthropic": "CLAWDBOT_E2E_MODELS=anthropic bash scripts/test-install-sh-e2e-docker.sh", - "protocol:gen": "tsx scripts/protocol-gen.ts", - "protocol:gen:swift": "tsx scripts/protocol-gen-swift.ts", + "protocol:gen": "bun scripts/protocol-gen.ts", + "protocol:gen:swift": "bun scripts/protocol-gen-swift.ts", "protocol:check": "pnpm protocol:gen && pnpm protocol:gen:swift && git diff --exit-code -- dist/protocol.schema.json apps/macos/Sources/ClawdbotProtocol/GatewayModels.swift", "canvas:a2ui:bundle": "bash scripts/bundle-a2ui.sh", "check:loc": "tsx scripts/check-ts-max-loc.ts --max 500" diff --git a/scripts/gateway-watch.mjs b/scripts/gateway-watch.mjs deleted file mode 100644 index 117daf926..000000000 --- a/scripts/gateway-watch.mjs +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env node -import { spawn } from "node:child_process"; -import { existsSync } from "node:fs"; -import { setTimeout as delay } from "node:timers/promises"; -import process from "node:process"; - -const args = process.argv.slice(2); -const env = { ...process.env }; -const cwd = process.cwd(); - -const tsc = spawn("pnpm", ["exec", "tsc", "--watch", "--preserveWatchOutput"], { - cwd, - env, - stdio: "inherit", -}); - -let nodeProcess = null; -let exiting = false; - -async function waitForEntry() { - while (!existsSync("dist/entry.js")) { - if (exiting) return; - await delay(200); - } -} - -function startNode() { - nodeProcess = spawn(process.execPath, ["--watch", "dist/entry.js", ...args], { - cwd, - env, - stdio: "inherit", - }); -} - -function cleanup(code = 0) { - if (exiting) return; - exiting = true; - nodeProcess?.kill("SIGTERM"); - tsc.kill("SIGTERM"); - process.exit(code); -} - -process.on("SIGINT", () => cleanup(130)); -process.on("SIGTERM", () => cleanup(143)); -process.on("exit", () => cleanup()); - -tsc.on("exit", (code) => { - if (exiting) return; - cleanup(code ?? 1); -}); - -await waitForEntry(); -if (!exiting) startNode();