feat: 品牌重命名 claude → csc 并注册 update 命令

- 将用户可见的 CLI 提示从 claude 替换为 csc(错误信息、用法说明、文档)
- 注册 csc update / csc upgrade 子命令
- 设置 MACRO.PACKAGE_URL 为 @costrict/csc
- 更新 auto-updater 和启动流文档
This commit is contained in:
y574444354 2026-04-15 14:15:50 +08:00
parent efedc9ff33
commit 4d446823ea
10 changed files with 28 additions and 18 deletions

View File

@ -16,7 +16,7 @@ Claude Code 拥有一套复杂的多策略自动更新系统,支持三种安
| `npm-global` | `npm install -g` / `bun install -g` | 是(静默) |
| `npm-local` | `npm install``~/.claude/local/` | 是(静默) |
| `package-manager` | 显示通知,附带对应操作系统的升级命令 | 否(仅通知) |
| `development` | 不适用 — 执行 `claude update` 时报错 | 不适用 |
| `development` | 不适用 — 执行 `csc update` 时报错 | 不适用 |
### 策略路由
@ -95,7 +95,7 @@ void assertMinVersion();
## 手动 CLI 命令
### `claude update` / `claude upgrade`
### `csc update` / `claude upgrade`
**文件**: `src/cli/update.ts`
@ -258,7 +258,7 @@ React hook `useUpdateNotification(updatedVersion)` — 确保每次 semver 变
| 文件 | 职责 |
|---|---|
| `src/utils/autoUpdater.ts` | 核心逻辑版本检查、npm 安装、文件锁、最低/最高版本门控 |
| `src/cli/update.ts` | `claude update` 命令处理 |
| `src/cli/update.ts` | `csc update` 命令处理 |
| `src/utils/nativeInstaller/installer.ts` | 原生二进制安装器:下载、版本管理、符号链接、清理 |
| `src/utils/nativeInstaller/download.ts` | 从 GCS/Artifactory 下载二进制文件并校验 |
| `src/utils/localInstaller.ts` | 本地安装器(`~/.claude/local/`)基于 npm |
@ -308,5 +308,5 @@ REPL 运行中(每 30 分钟)
└── 显示 "Run: brew upgrade ..."(不自动安装)
手动操作
└── claude update → 完整诊断 + 安装编排
└── csc update → 完整诊断 + 安装编排
```

View File

@ -294,7 +294,7 @@ action(async (prompt, options) => {
| `claude setup-token` | 4267 | 设置长期认证 token |
| `claude agents` | 4278 | 列出已配置的 agents |
| `claude doctor` | 4346 | 健康检查 |
| `claude update` | 4362 | 检查更新 |
| `csc update` | 4362 | 检查更新 |
| `claude install` | 4394 | 安装原生构建 |
| `claude log` | 4411 | 查看对话日志(内部) |
| `claude completion` | 4491 | Shell 自动补全 |

View File

@ -12,7 +12,7 @@ export function getMacroDefines(): Record<string, string> {
"MACRO.FEEDBACK_CHANNEL": JSON.stringify(""),
"MACRO.ISSUES_EXPLAINER": JSON.stringify(""),
"MACRO.NATIVE_PACKAGE_URL": JSON.stringify(""),
"MACRO.PACKAGE_URL": JSON.stringify(""),
"MACRO.PACKAGE_URL": JSON.stringify("@costrict/csc"),
"MACRO.VERSION_CHANGELOG": JSON.stringify(""),
};
}

View File

@ -421,7 +421,7 @@ export async function initReplBridge(
`[bridge:repl] Skipping: ${versionError}`,
true,
)
onStateChange?.('failed', 'run `claude update` to upgrade')
onStateChange?.('failed', 'run `csc update` to upgrade')
return null
}
logForDebugging(
@ -462,7 +462,7 @@ export async function initReplBridge(
const versionError = checkBridgeMinVersion()
if (versionError) {
logBridgeSkip('version_too_old', `[bridge:repl] Skipping: ${versionError}`)
onStateChange?.('failed', 'run `claude update` to upgrade')
onStateChange?.('failed', 'run `csc update` to upgrade')
return null
}

View File

@ -5051,7 +5051,7 @@ async function loadInitialMessages(
)
if (!parsedSessionId) {
let errorMessage =
'Error: --resume requires a valid session ID when used with --print. Usage: claude -p --resume <session-id>'
'Error: --resume requires a valid session ID when used with --print. Usage: csc -p --resume <session-id>'
if (typeof options.resume === 'string') {
errorMessage += `. Session IDs must be in UUID format (e.g., 550e8400-e29b-41d4-a716-446655440000). Provided value "${options.resume}" is not a valid UUID`
}

View File

@ -87,12 +87,12 @@ export function registerMcpAddCommand(mcp: Command): void {
if (!name) {
cliError(
'Error: Server name is required.\n' +
'Usage: claude mcp add <name> <command> [args...]',
'Usage: csc mcp add <name> <command> [args...]',
)
} else if (!actualCommand) {
cliError(
'Error: Command is required when server name is provided.\n' +
'Usage: claude mcp add <name> <command> [args...]',
'Usage: csc mcp add <name> <command> [args...]',
)
}

View File

@ -4937,7 +4937,7 @@ async function run(): Promise<CommanderCommand> {
if (!isRemoteTuiEnabled && !hasInitialPrompt) {
return await exitWithError(
root,
'Error: --remote requires a description.\nUsage: claude --remote "your task description"',
'Error: --remote requires a description.\nUsage: csc --remote "your task description"',
() => gracefulShutdown(1),
);
}
@ -6479,7 +6479,7 @@ async function run(): Promise<CommanderCommand> {
// (e.g. `--debug assistant`) and the position-0 predicate
// didn't match. Print usage like the ssh stub does.
process.stderr.write(
"Usage: claude assistant [sessionId]\n\n" +
"Usage: csc assistant [sessionId]\n\n" +
"Attach the REPL as a viewer client to a running bridge session.\n" +
"Omit sessionId to discover and pick from available sessions.\n",
);
@ -6487,6 +6487,16 @@ async function run(): Promise<CommanderCommand> {
});
}
// Update command - check and install updates
program
.command('update')
.alias('upgrade')
.description('Check for updates and install the latest version')
.action(async () => {
const { update } = await import('./cli/update.js')
await update()
})
// Doctor command - check installation health
program
.command('doctor')

View File

@ -61,7 +61,7 @@ export type MaxVersionConfig = {
*
* Versioning approach:
* 1. For version requirements/compatibility (assertMinVersion), we use semver comparison that ignores build metadata
* 2. For updates ('claude update'), we use exact string comparison to detect any change, including SHA
* 2. For updates ('csc update'), we use exact string comparison to detect any change, including SHA
* - This ensures users always get the latest build, even when only the SHA changes
* - The UI clearly shows both versions including build metadata
*
@ -87,7 +87,7 @@ It looks like your version of CoStrict (${MACRO.VERSION}) needs an update.
A newer version (${versionConfig.minVersion} or higher) is required to continue.
To update, please run:
claude update
csc update
This will ensure you have access to the latest features and improvements.
`)
@ -488,7 +488,7 @@ This configuration is not supported for updates.
To fix this issue:
1. Install Node.js within your Linux distribution: e.g. sudo apt install nodejs npm
2. Make sure Linux NPM is in your PATH before the Windows version
3. Try updating again with 'claude update'
3. Try updating again with 'csc update'
`)
return 'install_failed'
}

View File

@ -135,7 +135,7 @@ export async function setupShellCompletion(theme: ThemeName): Promise<string> {
/**
* Regenerate cached shell completion scripts in ~/.claude/.
* Called after `claude update` so completions stay in sync with the new binary.
* Called after `csc update` so completions stay in sync with the new binary.
*/
export async function regenerateCompletionCache(): Promise<void> {
const shell = detectShell()

View File

@ -137,7 +137,7 @@ function printResumeHint(): void {
) {
try {
const sessionId = getSessionId()
// Don't show resume hint if no session file exists (e.g., subcommands like `claude update`)
// Don't show resume hint if no session file exists (e.g., subcommands like `csc update`)
if (!sessionIdExists(sessionId)) {
return
}