From d1a0ebee61b8987df85c328d359967e46d1e5226 Mon Sep 17 00:00:00 2001 From: Shun Kakinoki Date: Fri, 26 Dec 2025 19:42:23 +0900 Subject: [PATCH 1/3] fix(health): correct CLIProxy port detection on macOS/Linux MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two bugs caused the health check to incorrectly report "Proxy not running": 1. lsof command used mutually exclusive flags (-t and -F) - Removed -t flag since -F already provides structured output 2. isCLIProxyProcess whitelist was missing common binary names - Added: cliproxyapi, cli-proxy-api-plus (and .exe variants) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- src/utils/port-utils.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/utils/port-utils.ts b/src/utils/port-utils.ts index e3351ac2..8416e97e 100644 --- a/src/utils/port-utils.ts +++ b/src/utils/port-utils.ts @@ -38,7 +38,7 @@ export async function getPortProcess(port: number): Promise */ async function getPortProcessUnix(port: number): Promise { try { - const { stdout } = await execAsync(`lsof -i :${port} -sTCP:LISTEN -t -F pcn`, { + const { stdout } = await execAsync(`lsof -i :${port} -sTCP:LISTEN -F pcn`, { timeout: 3000, }); @@ -117,7 +117,7 @@ export function isCLIProxyProcess(process: PortProcess | null): boolean { return false; } - // Match cli-proxy, cli-proxy.exe, cliproxy, cliproxy.exe, cli-proxy-api + // Match various CLIProxy binary names const name = process.processName.toLowerCase(); return [ 'cli-proxy', @@ -126,6 +126,10 @@ export function isCLIProxyProcess(process: PortProcess | null): boolean { 'cliproxy.exe', 'cli-proxy-api', 'cli-proxy-api.exe', + 'cliproxyapi', + 'cliproxyapi.exe', + 'cli-proxy-api-plus', + 'cli-proxy-api-plus.exe', ].includes(name); } From 91e7b9f93787e5b2d45bffdaed75e75c151281e4 Mon Sep 17 00:00:00 2001 From: kaitranntt Date: Fri, 26 Dec 2025 12:51:09 -0500 Subject: [PATCH 2/3] fix(health): use prefix matching for Linux process name truncation Linux kernel truncates process names to 15 chars, causing 'cli-proxy-api-plus' to appear as 'cli-proxy-api-p' in lsof output. Switch from exact whitelist to prefix matching for robust detection. --- src/utils/port-utils.ts | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/utils/port-utils.ts b/src/utils/port-utils.ts index 8416e97e..2359f1ab 100644 --- a/src/utils/port-utils.ts +++ b/src/utils/port-utils.ts @@ -111,26 +111,17 @@ async function getPortProcessWindows(port: number): Promise /** * Check if process is CLIProxy + * Uses prefix matching to handle Linux kernel's 15-char process name truncation + * (e.g., 'cli-proxy-api-plus' becomes 'cli-proxy-api-p' in lsof/ps output) */ export function isCLIProxyProcess(process: PortProcess | null): boolean { if (!process) { return false; } - // Match various CLIProxy binary names const name = process.processName.toLowerCase(); - return [ - 'cli-proxy', - 'cli-proxy.exe', - 'cliproxy', - 'cliproxy.exe', - 'cli-proxy-api', - 'cli-proxy-api.exe', - 'cliproxyapi', - 'cliproxyapi.exe', - 'cli-proxy-api-plus', - 'cli-proxy-api-plus.exe', - ].includes(name); + // All CLIProxy variants start with 'cli-proxy' or 'cliproxy' + return name.startsWith('cli-proxy') || name.startsWith('cliproxy'); } /** From 8b9da926f2152c7d653ddcbd1607640ab44e2cee Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Fri, 26 Dec 2025 18:09:26 +0000 Subject: [PATCH 3/3] chore(release): 7.7.1 [skip ci] ## [7.7.1](https://github.com/kaitranntt/ccs/compare/v7.7.0...v7.7.1) (2025-12-26) ### Bug Fixes * **health:** correct CLIProxy port detection on macOS/Linux ([d1a0ebe](https://github.com/kaitranntt/ccs/commit/d1a0ebee61b8987df85c328d359967e46d1e5226)) * **health:** use prefix matching for Linux process name truncation ([91e7b9f](https://github.com/kaitranntt/ccs/commit/91e7b9f93787e5b2d45bffdaed75e75c151281e4)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c0035f4..b7791b0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [7.7.1](https://github.com/kaitranntt/ccs/compare/v7.7.0...v7.7.1) (2025-12-26) + +### Bug Fixes + +* **health:** correct CLIProxy port detection on macOS/Linux ([d1a0ebe](https://github.com/kaitranntt/ccs/commit/d1a0ebee61b8987df85c328d359967e46d1e5226)) +* **health:** use prefix matching for Linux process name truncation ([91e7b9f](https://github.com/kaitranntt/ccs/commit/91e7b9f93787e5b2d45bffdaed75e75c151281e4)) + ## [7.7.0](https://github.com/kaitranntt/ccs/compare/v7.6.0...v7.7.0) (2025-12-25) ### Features diff --git a/package.json b/package.json index 309c77aa..e2edad01 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kaitranntt/ccs", - "version": "7.7.0", + "version": "7.7.1", "description": "Claude Code Switch - Instant profile switching between Claude Sonnet 4.5 and GLM 4.6", "keywords": [ "cli",