mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-15 12:55:51 +00:00
* feat: 适配 zed acp 协议 * docs: 完善 acp 文档 * feat: integrate feature branches + daemon/job 命令层级化 + 跨平台后台引擎 Cherry-picked from origin/lint/preview (637c908), excluding lint-only changes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: correct detectMimeFromBase64 to decode raw bytes from base64 Cherry-picked from origin/lint/preview (ee36954). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: daemon 子进程 spawn 跨平台修复 + CliLaunchSpec 集中化重构 Cherry-picked from origin/lint/preview (c5f52cd), excluding lint-only formatting changes. - 新建 src/utils/cliLaunch.ts: 集中化 CLI 子进程启动层 - 修复 --daemon-worker=kind 等号格式解析 - 修复 daemon/bg fast path 缺少 setShellIfWindows() - 修复 checkPathExists 用 existsSync 替代 execSync('dir') - 7 个 spawn 站点迁移到 CliLaunchSpec Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: merge tsconfig.base.json into tsconfig.json with full compiler options The cherry-pick from637c908dropped jsx/strict/etc settings when removing tsconfig.base.json. This commit restores them in a single tsconfig.json. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: merge tsconfig.base.json into tsconfig.json with full compiler options The cherry-pick from637c908dropped jsx/strict/etc settings when removing tsconfig.base.json. This commit restores them in a single tsconfig.json. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
62 lines
2.0 KiB
TypeScript
62 lines
2.0 KiB
TypeScript
/**
|
|
* Tests for daemon/main.ts subcommand routing.
|
|
*
|
|
* The `status` and `bg` subcommands trigger dynamic imports of `cli/bg.ts`
|
|
* which depends on `envUtils.ts` → `lodash-es/memoize.js` (unavailable in
|
|
* raw test context without `bun run dev`'s define flags). We test only the
|
|
* self-contained subcommands: help and unknown.
|
|
*/
|
|
import { describe, test, expect, beforeEach, afterEach } from 'bun:test'
|
|
|
|
describe('daemonMain subcommand routing', () => {
|
|
const origLog = console.log
|
|
const origError = console.error
|
|
let logLines: string[]
|
|
|
|
beforeEach(() => {
|
|
logLines = []
|
|
console.log = (...a: unknown[]) => logLines.push(a.map(String).join(' '))
|
|
console.error = (...a: unknown[]) => logLines.push(a.map(String).join(' '))
|
|
})
|
|
|
|
afterEach(() => {
|
|
console.log = origLog
|
|
console.error = origError
|
|
process.exitCode = 0
|
|
})
|
|
|
|
test('unknown subcommand sets exitCode to 1', async () => {
|
|
const { daemonMain } = await import('../main.js')
|
|
await daemonMain(['unknown-command-xyz'])
|
|
expect(process.exitCode).toBe(1)
|
|
})
|
|
|
|
test('help subcommand prints usage', async () => {
|
|
const { daemonMain } = await import('../main.js')
|
|
await daemonMain(['help'])
|
|
const output = logLines.join('\n')
|
|
expect(output).toContain('SUBCOMMANDS')
|
|
expect(output).toContain('status')
|
|
expect(output).toContain('start')
|
|
expect(output).toContain('stop')
|
|
expect(output).toContain('bg')
|
|
expect(output).toContain('attach')
|
|
expect(output).toContain('logs')
|
|
expect(output).toContain('kill')
|
|
})
|
|
|
|
test('--help is alias for help', async () => {
|
|
const { daemonMain } = await import('../main.js')
|
|
await daemonMain(['--help'])
|
|
const output = logLines.join('\n')
|
|
expect(output).toContain('SUBCOMMANDS')
|
|
})
|
|
|
|
test('-h is alias for help', async () => {
|
|
const { daemonMain } = await import('../main.js')
|
|
await daemonMain(['-h'])
|
|
const output = logLines.join('\n')
|
|
expect(output).toContain('SUBCOMMANDS')
|
|
})
|
|
})
|