mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-17 13:55:50 +00:00
Feat/integrate lint preview (#285)
* 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>
This commit is contained in:
@@ -145,9 +145,10 @@ async function main(): Promise<void> {
|
||||
// perf-sensitive. No enableConfigs(), no analytics sinks at this layer —
|
||||
// workers are lean. If a worker kind needs configs/auth (assistant will),
|
||||
// it calls them inside its run() fn.
|
||||
if (feature('DAEMON') && args[0] === '--daemon-worker') {
|
||||
if (feature('DAEMON') && (args[0] === '--daemon-worker' || args[0]?.startsWith('--daemon-worker='))) {
|
||||
const kind = args[0] === '--daemon-worker' ? args[1] : args[0].split('=')[1]
|
||||
const { runDaemonWorker } = await import('../daemon/workerRegistry.js')
|
||||
await runDaemonWorker(args[1])
|
||||
await runDaemonWorker(kind)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -207,11 +208,18 @@ async function main(): Promise<void> {
|
||||
return
|
||||
}
|
||||
|
||||
// Fast-path for `claude daemon [subcommand]`: long-running supervisor.
|
||||
if (feature('DAEMON') && args[0] === 'daemon') {
|
||||
// Fast-path for `claude daemon [subcommand]`: unified daemon + session management.
|
||||
// Handles both supervisor (start/stop) and background session (bg/attach/logs/kill)
|
||||
// subcommands under one namespace.
|
||||
if (
|
||||
(feature('DAEMON') || feature('BG_SESSIONS')) &&
|
||||
args[0] === 'daemon'
|
||||
) {
|
||||
profileCheckpoint('cli_daemon_path')
|
||||
const { enableConfigs } = await import('../utils/config.js')
|
||||
enableConfigs()
|
||||
const { setShellIfWindows } = await import('../utils/windowsPaths.js')
|
||||
setShellIfWindows()
|
||||
const { initSinks } = await import('../utils/sinks.js')
|
||||
initSinks()
|
||||
const { daemonMain } = await import('../daemon/main.js')
|
||||
@@ -219,51 +227,69 @@ async function main(): Promise<void> {
|
||||
return
|
||||
}
|
||||
|
||||
// Fast-path for `claude ps|logs|attach|kill` and `--bg`/`--background`.
|
||||
// Session management against the ~/.claude/sessions/ registry. Flag
|
||||
// literals are inlined so bg.js only loads when actually dispatching.
|
||||
// Fast-path for `--bg`/`--background` shortcut → daemon bg.
|
||||
if (
|
||||
feature('BG_SESSIONS') &&
|
||||
(args.includes('--bg') || args.includes('--background'))
|
||||
) {
|
||||
profileCheckpoint('cli_daemon_path')
|
||||
const { enableConfigs } = await import('../utils/config.js')
|
||||
enableConfigs()
|
||||
const { setShellIfWindows } = await import('../utils/windowsPaths.js')
|
||||
setShellIfWindows()
|
||||
const bg = await import('../cli/bg.js')
|
||||
await bg.handleBgStart(
|
||||
args.filter(a => a !== '--bg' && a !== '--background'),
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
// Backward-compat: ps/logs/attach/kill → daemon <sub> (deprecated)
|
||||
if (
|
||||
feature('BG_SESSIONS') &&
|
||||
(args[0] === 'ps' ||
|
||||
args[0] === 'logs' ||
|
||||
args[0] === 'attach' ||
|
||||
args[0] === 'kill' ||
|
||||
args.includes('--bg') ||
|
||||
args.includes('--background'))
|
||||
args[0] === 'kill')
|
||||
) {
|
||||
profileCheckpoint('cli_bg_path')
|
||||
const mapped = args[0] === 'ps' ? 'status' : args[0]
|
||||
console.error(
|
||||
`[deprecated] Use: claude daemon ${mapped}${args[1] ? ' ' + args[1] : ''}`,
|
||||
)
|
||||
profileCheckpoint('cli_daemon_path')
|
||||
const { enableConfigs } = await import('../utils/config.js')
|
||||
enableConfigs()
|
||||
const bg = await import('../cli/bg.js')
|
||||
switch (args[0]) {
|
||||
case 'ps':
|
||||
await bg.psHandler(args.slice(1))
|
||||
break
|
||||
case 'logs':
|
||||
await bg.logsHandler(args[1])
|
||||
break
|
||||
case 'attach':
|
||||
await bg.attachHandler(args[1])
|
||||
break
|
||||
case 'kill':
|
||||
await bg.killHandler(args[1])
|
||||
break
|
||||
default:
|
||||
await bg.handleBgFlag(args)
|
||||
}
|
||||
const { setShellIfWindows } = await import('../utils/windowsPaths.js')
|
||||
setShellIfWindows()
|
||||
const { initSinks } = await import('../utils/sinks.js')
|
||||
initSinks()
|
||||
const { daemonMain } = await import('../daemon/main.js')
|
||||
await daemonMain([args[0] === 'ps' ? 'status' : args[0]!, ...args.slice(1)])
|
||||
return
|
||||
}
|
||||
|
||||
// Fast-path for template job commands.
|
||||
// Fast-path for `claude job <subcommand>`: template jobs.
|
||||
if (feature('TEMPLATES') && args[0] === 'job') {
|
||||
profileCheckpoint('cli_templates_path')
|
||||
const { templatesMain } = await import('../cli/handlers/templateJobs.js')
|
||||
await templatesMain(args.slice(1))
|
||||
// process.exit (not return) — mountFleetView's Ink TUI can leave event
|
||||
// loop handles that prevent natural exit.
|
||||
// eslint-disable-next-line custom-rules/no-process-exit
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
// Backward-compat: new/list/reply → job <sub> (deprecated)
|
||||
if (
|
||||
feature('TEMPLATES') &&
|
||||
(args[0] === 'new' || args[0] === 'list' || args[0] === 'reply')
|
||||
) {
|
||||
console.error(
|
||||
`[deprecated] Use: claude job ${args[0]} ${args.slice(1).join(' ')}`.trim(),
|
||||
)
|
||||
profileCheckpoint('cli_templates_path')
|
||||
const { templatesMain } = await import('../cli/handlers/templateJobs.js')
|
||||
await templatesMain(args)
|
||||
// process.exit (not return) — mountFleetView's Ink TUI can leave event
|
||||
// loop handles that prevent natural exit.
|
||||
// eslint-disable-next-line custom-rules/no-process-exit
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user