mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-15 21:05: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>
71 lines
2.1 KiB
TypeScript
71 lines
2.1 KiB
TypeScript
/**
|
|
* `claude rollback [target]` — roll back to a previous Claude Code version.
|
|
*
|
|
* ANT-only command (USER_TYPE === "ant").
|
|
*
|
|
* Options:
|
|
* --list List recent published versions
|
|
* --dry-run Show what would be installed without installing
|
|
* --safe Roll back to the server-pinned safe version
|
|
*/
|
|
export async function rollback(
|
|
target?: string,
|
|
options?: { list?: boolean; dryRun?: boolean; safe?: boolean },
|
|
): Promise<void> {
|
|
if (options?.list) {
|
|
console.log('Recent versions:')
|
|
console.log(' (version listing requires access to the release registry)')
|
|
console.log(' Use `claude update --list` for available versions.')
|
|
return
|
|
}
|
|
|
|
if (options?.safe) {
|
|
console.log('Safe rollback: would install the server-pinned safe version.')
|
|
if (options.dryRun) {
|
|
console.log(' (dry run — no changes made)')
|
|
return
|
|
}
|
|
console.log(' Safe version pinning requires access to the release API.')
|
|
console.log(' Contact oncall for the current safe version.')
|
|
return
|
|
}
|
|
|
|
if (!target) {
|
|
console.error(
|
|
'Usage: claude rollback [target]\n\n' +
|
|
'Options:\n' +
|
|
' -l, --list List recent published versions\n' +
|
|
' --dry-run Show what would be installed\n' +
|
|
' --safe Roll back to server-pinned safe version\n\n' +
|
|
'Examples:\n' +
|
|
' claude rollback 2.1.880\n' +
|
|
' claude rollback --list\n' +
|
|
' claude rollback --safe',
|
|
)
|
|
process.exitCode = 1
|
|
return
|
|
}
|
|
|
|
console.log(`Rolling back to version ${target}...`)
|
|
|
|
if (options?.dryRun) {
|
|
console.log(` (dry run — would install ${target})`)
|
|
return
|
|
}
|
|
|
|
// Version rollback via npm/bun
|
|
const { spawnSync } = await import('child_process')
|
|
const result = spawnSync(
|
|
'npm',
|
|
['install', '-g', `@anthropic-ai/claude-code@${target}`],
|
|
{ stdio: 'inherit' },
|
|
)
|
|
|
|
if (result.status !== 0) {
|
|
console.error(`Rollback failed with exit code ${result.status}`)
|
|
process.exitCode = result.status ?? 1
|
|
} else {
|
|
console.log(`Rolled back to ${target} successfully.`)
|
|
}
|
|
}
|