Files
heicode-win/cc-haha/desktop/sidecars/launcherRouting.ts
T
chenchenandClaude Opus 4.7 3a358ba5e1 refactor(client): full Claude→Heicode rebrand across desktop runtime
Beyond the i18n strings rebrand (b55d103) this pass cleans up everything
that still surfaced "Claude" in the built artifact:

Theme tokens (cc-haha/desktop/src/theme/globals.css)
- light-mode text-selection-bg rgba(197,165,114,*) → rgba(123,107,227,*)
  (selecting ANY text in light mode used to paint a gold highlight)
- dark + light diff-highlight-bg / -gutter switched from gold to brand
  violet rgba(123,107,227,*) — keeps semantic "highlight" without leaving
  the brand

Sidecar binary rename: claude-sidecar → heicode-sidecar
- desktop/sidecars/claude-sidecar.ts renamed (git mv)
- internal log prefix strings (12 occurrences) updated
- desktop/scripts/build-sidecars.ts: entrypoint / outfileBase / productName
  ('Heicode Sidecar') / publisher ('Heicode') — these last two are embedded
  in the .exe metadata you see in File Properties
- src-tauri/capabilities/default.json: 9 binaries/claude-sidecar references
  rewritten + description "Default capabilities for Heicode Desktop"
- src-tauri/src/lib.rs: 2 .sidecar("claude-sidecar") + 3 packaged sidecar
  exe filename strings + 1 doc comment
- desktop/sidecars/launcherRouting{,.test}.ts

After this rebuild, Task Manager shows heicode-sidecar-*.exe child
processes (was claude-sidecar-*.exe) and right-click → Properties on
that binary shows "Heicode Sidecar" / "Heicode" instead of "Claude Code".

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 15:56:03 +08:00

65 lines
1.6 KiB
TypeScript

import path from 'node:path'
export type SidecarMode = 'server' | 'cli' | 'adapters'
const EXPLICIT_MODES = new Set<SidecarMode>(['server', 'cli', 'adapters'])
const DESKTOP_CLI_NAMES = new Set(['claude-haha', 'claude-haha.exe'])
export function resolveSidecarInvocation(
rawArgs: string[],
execPath: string = process.execPath,
envAppRoot: string | null = process.env.CLAUDE_APP_ROOT ?? null,
): {
mode: SidecarMode | null
restArgs: string[]
defaultAppRoot: string | null
} {
const explicitMode = rawArgs[0]
if (explicitMode && EXPLICIT_MODES.has(explicitMode as SidecarMode)) {
return {
mode: explicitMode as SidecarMode,
restArgs: rawArgs.slice(1),
defaultAppRoot: envAppRoot,
}
}
const execName = path.basename(execPath).toLowerCase()
if (DESKTOP_CLI_NAMES.has(execName)) {
return {
mode: 'cli',
restArgs: rawArgs,
defaultAppRoot: envAppRoot ?? path.dirname(execPath),
}
}
return {
mode: null,
restArgs: rawArgs,
defaultAppRoot: envAppRoot,
}
}
export function parseLauncherArgs(
rawArgs: string[],
defaultAppRoot: string | null = process.env.CLAUDE_APP_ROOT ?? null,
): { appRoot: string; args: string[] } {
const nextArgs: string[] = []
let appRoot: string | null = defaultAppRoot
for (let index = 0; index < rawArgs.length; index++) {
const arg = rawArgs[index]
if (arg === '--app-root') {
appRoot = rawArgs[index + 1] ?? null
index += 1
continue
}
nextArgs.push(arg!)
}
if (!appRoot) {
throw new Error('Missing --app-root for heicode-sidecar')
}
return { appRoot, args: nextArgs }
}