From 847d62dacb54ce4e7f308bd0349d2c19d5500f98 Mon Sep 17 00:00:00 2001 From: Ben Brandt Date: Mon, 27 Oct 2025 13:45:58 +0100 Subject: [PATCH] Revert entrypoint changes (#127) --- CHANGELOG.md | 5 +++++ package-lock.json | 6 +++--- package.json | 12 ++++++------ src/cli.ts | 26 ------------------------- src/index.ts | 49 ++++++++++++++++++++++++----------------------- src/lib.ts | 25 ++++++++++++++++++++++++ 6 files changed, 64 insertions(+), 59 deletions(-) delete mode 100644 src/cli.ts create mode 100644 src/lib.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 47dfd7d6..d245e7ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.8.0 + +- Revert changes to filename for cli entrypoint +- Provide library entrypoint via lib.ts + ## 0.7.0 - Allow importing from this package as a library in addition to running it as a CLI. Allows for easier integration into existing node applications. diff --git a/package-lock.json b/package-lock.json index 673ae32c..b877d2b2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@zed-industries/claude-code-acp", - "version": "0.7.0", + "version": "0.8.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@zed-industries/claude-code-acp", - "version": "0.7.0", + "version": "0.8.0", "license": "Apache-2.0", "dependencies": { "@agentclientprotocol/sdk": "0.5.1", @@ -19,7 +19,7 @@ "uuid": "13.0.0" }, "bin": { - "claude-code-acp": "dist/cli.js" + "claude-code-acp": "dist/index.js" }, "devDependencies": { "@anthropic-ai/sdk": "0.67.0", diff --git a/package.json b/package.json index d4016f17..20702cd9 100644 --- a/package.json +++ b/package.json @@ -3,12 +3,12 @@ "publishConfig": { "access": "public" }, - "bin": { - "claude-code-acp": "./dist/cli.js" - }, - "version": "0.7.0", + "version": "0.8.0", "description": "An ACP-compatible coding agent powered by the Claude Code SDK (TypeScript)", - "main": "dist/index.js", + "main": "dist/lib.js", + "bin": { + "claude-code-acp": "./dist/index.js" + }, "type": "module", "files": [ "dist/", @@ -18,7 +18,7 @@ ], "scripts": { "build": "tsc", - "start": "node dist/cli.js", + "start": "node dist/index.js", "dev": "npm run build && npm run start", "lint": "eslint src --ext .ts", "lint:fix": "eslint src --ext .ts --fix", diff --git a/src/cli.ts b/src/cli.ts deleted file mode 100644 index 753205b4..00000000 --- a/src/cli.ts +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env node - -// Load managed settings and apply environment variables -import { loadManagedSettings, applyEnvironmentSettings } from "./utils.js"; - -const managedSettings = loadManagedSettings(); -if (managedSettings) { - applyEnvironmentSettings(managedSettings); -} - -// stdout is used to send messages to the client -// we redirect everything else to stderr to make sure it doesn't interfere with ACP -console.log = console.error; -console.info = console.error; -console.warn = console.error; -console.debug = console.error; - -process.on("unhandledRejection", (reason, promise) => { - console.error("Unhandled Rejection at:", promise, "reason:", reason); -}); - -import { runAcp } from "./acp-agent.js"; -runAcp(); - -// Keep process alive -process.stdin.resume(); diff --git a/src/index.ts b/src/index.ts index 4d60a83c..753205b4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,25 +1,26 @@ -// Export the main agent class and utilities for library usage -export { - ClaudeAcpAgent, - runAcp, - toAcpNotifications, - streamEventToAcpNotifications, -} from "./acp-agent.js"; -export { - loadManagedSettings, - applyEnvironmentSettings, - nodeToWebReadable, - nodeToWebWritable, - Pushable, - unreachable, -} from "./utils.js"; -export { - createMcpServer, - createPermissionMcpServer, - PERMISSION_TOOL_NAME, - toolNames, -} from "./mcp-server.js"; -export { toolInfoFromToolUse, planEntries, toolUpdateFromToolResult } from "./tools.js"; +#!/usr/bin/env node -// Export types -export type { ClaudePlanEntry } from "./tools.js"; +// Load managed settings and apply environment variables +import { loadManagedSettings, applyEnvironmentSettings } from "./utils.js"; + +const managedSettings = loadManagedSettings(); +if (managedSettings) { + applyEnvironmentSettings(managedSettings); +} + +// stdout is used to send messages to the client +// we redirect everything else to stderr to make sure it doesn't interfere with ACP +console.log = console.error; +console.info = console.error; +console.warn = console.error; +console.debug = console.error; + +process.on("unhandledRejection", (reason, promise) => { + console.error("Unhandled Rejection at:", promise, "reason:", reason); +}); + +import { runAcp } from "./acp-agent.js"; +runAcp(); + +// Keep process alive +process.stdin.resume(); diff --git a/src/lib.ts b/src/lib.ts new file mode 100644 index 00000000..4d60a83c --- /dev/null +++ b/src/lib.ts @@ -0,0 +1,25 @@ +// Export the main agent class and utilities for library usage +export { + ClaudeAcpAgent, + runAcp, + toAcpNotifications, + streamEventToAcpNotifications, +} from "./acp-agent.js"; +export { + loadManagedSettings, + applyEnvironmentSettings, + nodeToWebReadable, + nodeToWebWritable, + Pushable, + unreachable, +} from "./utils.js"; +export { + createMcpServer, + createPermissionMcpServer, + PERMISSION_TOOL_NAME, + toolNames, +} from "./mcp-server.js"; +export { toolInfoFromToolUse, planEntries, toolUpdateFromToolResult } from "./tools.js"; + +// Export types +export type { ClaudePlanEntry } from "./tools.js";