ccjk 12.0.7 → 12.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/dist/chunks/agent-teams.mjs +0 -136
- package/dist/chunks/agent.mjs +0 -1439
- package/dist/chunks/agents.mjs +0 -3778
- package/dist/chunks/api-cli.mjs +0 -132
- package/dist/chunks/api-providers.mjs +0 -129
- package/dist/chunks/api.mjs +0 -112
- package/dist/chunks/auto-bootstrap.mjs +0 -358
- package/dist/chunks/auto-init.mjs +0 -7584
- package/dist/chunks/auto-updater.mjs +0 -410
- package/dist/chunks/banner.mjs +0 -188
- package/dist/chunks/bash.mjs +0 -187
- package/dist/chunks/boost.mjs +0 -397
- package/dist/chunks/ccjk-agents.mjs +0 -414
- package/dist/chunks/ccjk-all.mjs +0 -1028
- package/dist/chunks/ccjk-config.mjs +0 -261
- package/dist/chunks/ccjk-hooks.mjs +0 -1074
- package/dist/chunks/ccjk-mcp.mjs +0 -761
- package/dist/chunks/ccjk-setup.mjs +0 -763
- package/dist/chunks/ccjk-skills.mjs +0 -514
- package/dist/chunks/ccr.mjs +0 -98
- package/dist/chunks/ccu.mjs +0 -40
- package/dist/chunks/check-updates.mjs +0 -108
- package/dist/chunks/claude-code-config-manager.mjs +0 -750
- package/dist/chunks/claude-code-incremental-manager.mjs +0 -623
- package/dist/chunks/claude-config.mjs +0 -236
- package/dist/chunks/claude-wrapper.mjs +0 -85
- package/dist/chunks/cleanup-migration.mjs +0 -20
- package/dist/chunks/cli-hook.mjs +0 -2285
- package/dist/chunks/cloud-sync.mjs +0 -29
- package/dist/chunks/codex-config-switch.mjs +0 -451
- package/dist/chunks/codex-provider-manager.mjs +0 -236
- package/dist/chunks/codex-uninstaller.mjs +0 -404
- package/dist/chunks/codex.mjs +0 -2077
- package/dist/chunks/commands.mjs +0 -108
- package/dist/chunks/commands2.mjs +0 -413
- package/dist/chunks/commit.mjs +0 -138
- package/dist/chunks/completion.mjs +0 -515
- package/dist/chunks/config-consolidator.mjs +0 -172
- package/dist/chunks/config-switch.mjs +0 -317
- package/dist/chunks/config.mjs +0 -379
- package/dist/chunks/config2.mjs +0 -477
- package/dist/chunks/config3.mjs +0 -470
- package/dist/chunks/constants.mjs +0 -133
- package/dist/chunks/context-loader.mjs +0 -343
- package/dist/chunks/context.mjs +0 -372
- package/dist/chunks/convoy-manager.mjs +0 -880
- package/dist/chunks/dashboard.mjs +0 -476
- package/dist/chunks/doctor.mjs +0 -964
- package/dist/chunks/evolution.mjs +0 -382
- package/dist/chunks/features.mjs +0 -698
- package/dist/chunks/fish.mjs +0 -181
- package/dist/chunks/fs-operations.mjs +0 -192
- package/dist/chunks/health-alerts.mjs +0 -304
- package/dist/chunks/health-check.mjs +0 -532
- package/dist/chunks/help.mjs +0 -340
- package/dist/chunks/hook-installer.mjs +0 -45
- package/dist/chunks/index.mjs +0 -24
- package/dist/chunks/index10.mjs +0 -1171
- package/dist/chunks/index11.mjs +0 -1008
- package/dist/chunks/index12.mjs +0 -193
- package/dist/chunks/index13.mjs +0 -218
- package/dist/chunks/index14.mjs +0 -663
- package/dist/chunks/index2.mjs +0 -19
- package/dist/chunks/index3.mjs +0 -19092
- package/dist/chunks/index4.mjs +0 -8
- package/dist/chunks/index5.mjs +0 -7600
- package/dist/chunks/index6.mjs +0 -171
- package/dist/chunks/index7.mjs +0 -3583
- package/dist/chunks/index8.mjs +0 -19
- package/dist/chunks/index9.mjs +0 -616
- package/dist/chunks/init.mjs +0 -1606
- package/dist/chunks/installer.mjs +0 -690
- package/dist/chunks/installer2.mjs +0 -179
- package/dist/chunks/interview.mjs +0 -2927
- package/dist/chunks/json-config.mjs +0 -60
- package/dist/chunks/linux.mjs +0 -3863
- package/dist/chunks/macos.mjs +0 -69
- package/dist/chunks/main.mjs +0 -635
- package/dist/chunks/manager.mjs +0 -1048
- package/dist/chunks/marketplace.mjs +0 -949
- package/dist/chunks/mcp-cli.mjs +0 -204
- package/dist/chunks/mcp-performance.mjs +0 -187
- package/dist/chunks/mcp.mjs +0 -1231
- package/dist/chunks/menu.mjs +0 -652
- package/dist/chunks/metrics-display.mjs +0 -153
- package/dist/chunks/migrator.mjs +0 -178
- package/dist/chunks/monitor.mjs +0 -1856
- package/dist/chunks/notification.mjs +0 -1864
- package/dist/chunks/onboarding.mjs +0 -385
- package/dist/chunks/package.mjs +0 -3
- package/dist/chunks/paradigm.mjs +0 -74
- package/dist/chunks/permission-manager.mjs +0 -132
- package/dist/chunks/permissions.mjs +0 -265
- package/dist/chunks/persistence-manager.mjs +0 -794
- package/dist/chunks/persistence.mjs +0 -667
- package/dist/chunks/platform.mjs +0 -391
- package/dist/chunks/plugin.mjs +0 -1936
- package/dist/chunks/powershell.mjs +0 -213
- package/dist/chunks/prompts.mjs +0 -241
- package/dist/chunks/providers.mjs +0 -260
- package/dist/chunks/quick-actions.mjs +0 -320
- package/dist/chunks/quick-provider.mjs +0 -682
- package/dist/chunks/quick-setup.mjs +0 -412
- package/dist/chunks/remote.mjs +0 -497
- package/dist/chunks/session.mjs +0 -878
- package/dist/chunks/sessions.mjs +0 -106
- package/dist/chunks/silent-updater.mjs +0 -396
- package/dist/chunks/simple-config.mjs +0 -98
- package/dist/chunks/skill.mjs +0 -117
- package/dist/chunks/skill2.mjs +0 -9003
- package/dist/chunks/skills-sync.mjs +0 -6460
- package/dist/chunks/skills.mjs +0 -567
- package/dist/chunks/slash-commands.mjs +0 -207
- package/dist/chunks/smart-defaults.mjs +0 -412
- package/dist/chunks/smart-guide.mjs +0 -194
- package/dist/chunks/startup.mjs +0 -487
- package/dist/chunks/stats.mjs +0 -410
- package/dist/chunks/status.mjs +0 -289
- package/dist/chunks/team.mjs +0 -63
- package/dist/chunks/thinking.mjs +0 -626
- package/dist/chunks/trace.mjs +0 -57
- package/dist/chunks/uninstall.mjs +0 -849
- package/dist/chunks/update.mjs +0 -167
- package/dist/chunks/upgrade-manager.mjs +0 -204
- package/dist/chunks/version-checker.mjs +0 -881
- package/dist/chunks/vim.mjs +0 -903
- package/dist/chunks/windows.mjs +0 -14
- package/dist/chunks/workflows.mjs +0 -633
- package/dist/chunks/wsl.mjs +0 -129
- package/dist/chunks/zero-config.mjs +0 -374
- package/dist/chunks/zsh.mjs +0 -182
- package/dist/cli.d.mts +0 -1
- package/dist/cli.d.ts +0 -1
- package/dist/cli.mjs +0 -2199
- package/dist/i18n/locales/en/agent-teams.json +0 -18
- package/dist/i18n/locales/en/agentBrowser.json +0 -79
- package/dist/i18n/locales/en/agents.json +0 -135
- package/dist/i18n/locales/en/api.json +0 -63
- package/dist/i18n/locales/en/ccjk-agents.json +0 -33
- package/dist/i18n/locales/en/ccjk-all.json +0 -23
- package/dist/i18n/locales/en/ccjk-skills.json +0 -22
- package/dist/i18n/locales/en/ccjk.json +0 -276
- package/dist/i18n/locales/en/ccr.json +0 -65
- package/dist/i18n/locales/en/claude-md.json +0 -73
- package/dist/i18n/locales/en/cli.json +0 -152
- package/dist/i18n/locales/en/cloud-setup.json +0 -31
- package/dist/i18n/locales/en/cloud-sync.json +0 -147
- package/dist/i18n/locales/en/cloud.json +0 -40
- package/dist/i18n/locales/en/cloudPlugins.json +0 -118
- package/dist/i18n/locales/en/codex.json +0 -127
- package/dist/i18n/locales/en/cometix.json +0 -29
- package/dist/i18n/locales/en/common.json +0 -68
- package/dist/i18n/locales/en/config.json +0 -108
- package/dist/i18n/locales/en/configuration.json +0 -226
- package/dist/i18n/locales/en/context.json +0 -85
- package/dist/i18n/locales/en/dashboard.json +0 -78
- package/dist/i18n/locales/en/errors.json +0 -26
- package/dist/i18n/locales/en/evolution.json +0 -54
- package/dist/i18n/locales/en/hooks.json +0 -74
- package/dist/i18n/locales/en/hooksSync.json +0 -133
- package/dist/i18n/locales/en/installation.json +0 -83
- package/dist/i18n/locales/en/interview.json +0 -104
- package/dist/i18n/locales/en/language.json +0 -19
- package/dist/i18n/locales/en/lsp.json +0 -78
- package/dist/i18n/locales/en/marketplace.json +0 -116
- package/dist/i18n/locales/en/mcp.json +0 -178
- package/dist/i18n/locales/en/memory.json +0 -92
- package/dist/i18n/locales/en/menu.json +0 -143
- package/dist/i18n/locales/en/multi-config.json +0 -79
- package/dist/i18n/locales/en/notification.json +0 -307
- package/dist/i18n/locales/en/permissions.json +0 -95
- package/dist/i18n/locales/en/persistence.json +0 -127
- package/dist/i18n/locales/en/plugins.json +0 -146
- package/dist/i18n/locales/en/quick-actions.json +0 -78
- package/dist/i18n/locales/en/registry.json +0 -54
- package/dist/i18n/locales/en/remote.json +0 -93
- package/dist/i18n/locales/en/sandbox.json +0 -44
- package/dist/i18n/locales/en/setup.json +0 -44
- package/dist/i18n/locales/en/shencha.json +0 -14
- package/dist/i18n/locales/en/skills.json +0 -100
- package/dist/i18n/locales/en/skillsSync.json +0 -74
- package/dist/i18n/locales/en/smartGuide.json +0 -49
- package/dist/i18n/locales/en/stats.json +0 -20
- package/dist/i18n/locales/en/subagent.json +0 -69
- package/dist/i18n/locales/en/superpowers.json +0 -117
- package/dist/i18n/locales/en/team.json +0 -7
- package/dist/i18n/locales/en/thinking.json +0 -65
- package/dist/i18n/locales/en/tools.json +0 -42
- package/dist/i18n/locales/en/uninstall.json +0 -56
- package/dist/i18n/locales/en/updater.json +0 -29
- package/dist/i18n/locales/en/vim.json +0 -169
- package/dist/i18n/locales/en/workflow.json +0 -55
- package/dist/i18n/locales/en/workspace.json +0 -108
- package/dist/i18n/locales/zh-CN/agent-teams.json +0 -18
- package/dist/i18n/locales/zh-CN/agentBrowser.json +0 -79
- package/dist/i18n/locales/zh-CN/agents.json +0 -135
- package/dist/i18n/locales/zh-CN/api.json +0 -63
- package/dist/i18n/locales/zh-CN/ccjk-agents.json +0 -33
- package/dist/i18n/locales/zh-CN/ccjk-all.json +0 -23
- package/dist/i18n/locales/zh-CN/ccjk-skills.json +0 -22
- package/dist/i18n/locales/zh-CN/ccjk.json +0 -276
- package/dist/i18n/locales/zh-CN/ccr.json +0 -65
- package/dist/i18n/locales/zh-CN/claude-md.json +0 -73
- package/dist/i18n/locales/zh-CN/cli.json +0 -152
- package/dist/i18n/locales/zh-CN/cloud-setup.json +0 -31
- package/dist/i18n/locales/zh-CN/cloud-sync.json +0 -147
- package/dist/i18n/locales/zh-CN/cloud.json +0 -40
- package/dist/i18n/locales/zh-CN/cloudPlugins.json +0 -118
- package/dist/i18n/locales/zh-CN/codex.json +0 -127
- package/dist/i18n/locales/zh-CN/cometix.json +0 -29
- package/dist/i18n/locales/zh-CN/common.json +0 -68
- package/dist/i18n/locales/zh-CN/config.json +0 -108
- package/dist/i18n/locales/zh-CN/configuration.json +0 -224
- package/dist/i18n/locales/zh-CN/context.json +0 -85
- package/dist/i18n/locales/zh-CN/dashboard.json +0 -78
- package/dist/i18n/locales/zh-CN/errors.json +0 -26
- package/dist/i18n/locales/zh-CN/evolution.json +0 -54
- package/dist/i18n/locales/zh-CN/hooks.json +0 -74
- package/dist/i18n/locales/zh-CN/hooksSync.json +0 -133
- package/dist/i18n/locales/zh-CN/installation.json +0 -83
- package/dist/i18n/locales/zh-CN/interview.json +0 -104
- package/dist/i18n/locales/zh-CN/language.json +0 -19
- package/dist/i18n/locales/zh-CN/lsp.json +0 -78
- package/dist/i18n/locales/zh-CN/marketplace.json +0 -116
- package/dist/i18n/locales/zh-CN/mcp.json +0 -178
- package/dist/i18n/locales/zh-CN/memory.json +0 -92
- package/dist/i18n/locales/zh-CN/menu.json +0 -143
- package/dist/i18n/locales/zh-CN/multi-config.json +0 -79
- package/dist/i18n/locales/zh-CN/notification.json +0 -307
- package/dist/i18n/locales/zh-CN/permissions.json +0 -95
- package/dist/i18n/locales/zh-CN/persistence.json +0 -127
- package/dist/i18n/locales/zh-CN/plugins.json +0 -146
- package/dist/i18n/locales/zh-CN/quick-actions.json +0 -78
- package/dist/i18n/locales/zh-CN/registry.json +0 -54
- package/dist/i18n/locales/zh-CN/remote.json +0 -93
- package/dist/i18n/locales/zh-CN/sandbox.json +0 -44
- package/dist/i18n/locales/zh-CN/setup.json +0 -44
- package/dist/i18n/locales/zh-CN/shencha.json +0 -14
- package/dist/i18n/locales/zh-CN/skills.json +0 -100
- package/dist/i18n/locales/zh-CN/skillsSync.json +0 -74
- package/dist/i18n/locales/zh-CN/smartGuide.json +0 -49
- package/dist/i18n/locales/zh-CN/stats.json +0 -20
- package/dist/i18n/locales/zh-CN/subagent.json +0 -69
- package/dist/i18n/locales/zh-CN/superpowers.json +0 -117
- package/dist/i18n/locales/zh-CN/team.json +0 -7
- package/dist/i18n/locales/zh-CN/thinking.json +0 -65
- package/dist/i18n/locales/zh-CN/tools.json +0 -42
- package/dist/i18n/locales/zh-CN/uninstall.json +0 -56
- package/dist/i18n/locales/zh-CN/updater.json +0 -29
- package/dist/i18n/locales/zh-CN/vim.json +0 -169
- package/dist/i18n/locales/zh-CN/workflow.json +0 -55
- package/dist/i18n/locales/zh-CN/workspace.json +0 -108
- package/dist/index.d.mts +0 -5295
- package/dist/index.d.ts +0 -5295
- package/dist/index.mjs +0 -4941
- package/dist/shared/ccjk.B364Fu0N.mjs +0 -1819
- package/dist/shared/ccjk.BAGoDD49.mjs +0 -36
- package/dist/shared/ccjk.BBtCGd_g.mjs +0 -899
- package/dist/shared/ccjk.BFQ7yr5S.mjs +0 -16
- package/dist/shared/ccjk.BFxsJM0k.mjs +0 -599
- package/dist/shared/ccjk.BIxuVL3_.mjs +0 -25
- package/dist/shared/ccjk.BRZ9ww8S.mjs +0 -142
- package/dist/shared/ccjk.BoApaI4j.mjs +0 -28
- package/dist/shared/ccjk.BrPUmTqm.mjs +0 -266
- package/dist/shared/ccjk.BtB1e5jm.mjs +0 -171
- package/dist/shared/ccjk.BwfbSKN2.mjs +0 -1051
- package/dist/shared/ccjk.BxSmJ8B7.mjs +0 -243
- package/dist/shared/ccjk.Bx_rmYfN.mjs +0 -69
- package/dist/shared/ccjk.C2jHOZVP.mjs +0 -52
- package/dist/shared/ccjk.CL4Yat0G.mjs +0 -303
- package/dist/shared/ccjk.COweQ1RR.mjs +0 -5
- package/dist/shared/ccjk.CePkJq2S.mjs +0 -223
- package/dist/shared/ccjk.CfKKcvWy.mjs +0 -126
- package/dist/shared/ccjk.Cjgrln_h.mjs +0 -297
- package/dist/shared/ccjk.Cjj8SVrn.mjs +0 -54
- package/dist/shared/ccjk.CxpGa6MC.mjs +0 -2724
- package/dist/shared/ccjk.D5MFQT7w.mjs +0 -400
- package/dist/shared/ccjk.D6ycHbak.mjs +0 -270
- package/dist/shared/ccjk.D8ZLYSZZ.mjs +0 -299
- package/dist/shared/ccjk.DG_o24cZ.mjs +0 -88
- package/dist/shared/ccjk.DLLw-h4Y.mjs +0 -460
- package/dist/shared/ccjk.DOwtZMk8.mjs +0 -4019
- package/dist/shared/ccjk.DS7UESmF.mjs +0 -2451
- package/dist/shared/ccjk.DTdjs-qK.mjs +0 -1447
- package/dist/shared/ccjk.DXRAZcix.mjs +0 -66
- package/dist/shared/ccjk.DsYaCCx4.mjs +0 -317
- package/dist/shared/ccjk.J8YiPsOw.mjs +0 -259
- package/dist/shared/ccjk.KfSWcGlE.mjs +0 -38
- package/dist/shared/ccjk.RyizuzOI.mjs +0 -21
- package/dist/shared/ccjk.SPoXMvZD.mjs +0 -1242
- package/dist/shared/ccjk.T_cX87dY.mjs +0 -15
- package/dist/shared/ccjk.UIvifqNE.mjs +0 -1486
- package/dist/shared/ccjk._dESH4Rk.mjs +0 -111
- package/dist/shared/ccjk.bQ7Dh1g4.mjs +0 -249
- package/dist/shared/ccjk.c-ETfBZ_.mjs +0 -617
- package/dist/shared/ccjk.gDEDGD_t.mjs +0 -38
- package/dist/shared/ccjk.hoqrwWdN.mjs +0 -333
- package/dist/shared/ccjk.waa2ikKJ.mjs +0 -351
|
@@ -1,410 +0,0 @@
|
|
|
1
|
-
import a from './index2.mjs';
|
|
2
|
-
import ora from './index7.mjs';
|
|
3
|
-
import { exec as q } from './main.mjs';
|
|
4
|
-
import { ensureI18nInitialized, i18n, format } from './index5.mjs';
|
|
5
|
-
import { s as shouldUseSudoForGlobalInstall } from './platform.mjs';
|
|
6
|
-
import { p as promptBoolean } from '../shared/ccjk.DOwtZMk8.mjs';
|
|
7
|
-
import { checkClaudeCodeVersion, fixBrokenNpmSymlink, checkCcrVersion, handleDuplicateInstallations, checkCometixLineVersion } from './version-checker.mjs';
|
|
8
|
-
import '../shared/ccjk.BAGoDD49.mjs';
|
|
9
|
-
import 'node:process';
|
|
10
|
-
import 'node:util';
|
|
11
|
-
import '../shared/ccjk.Cjgrln_h.mjs';
|
|
12
|
-
import 'module';
|
|
13
|
-
import 'node:child_process';
|
|
14
|
-
import 'node:path';
|
|
15
|
-
import 'node:stream';
|
|
16
|
-
import 'node:readline';
|
|
17
|
-
import 'node:fs';
|
|
18
|
-
import 'node:url';
|
|
19
|
-
import '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
20
|
-
import 'node:os';
|
|
21
|
-
import 'node:async_hooks';
|
|
22
|
-
import './index3.mjs';
|
|
23
|
-
import 'stream';
|
|
24
|
-
import 'node:tty';
|
|
25
|
-
import 'tty';
|
|
26
|
-
import 'fs';
|
|
27
|
-
import 'child_process';
|
|
28
|
-
import 'node:crypto';
|
|
29
|
-
import 'buffer';
|
|
30
|
-
import 'string_decoder';
|
|
31
|
-
import '../shared/ccjk.CxpGa6MC.mjs';
|
|
32
|
-
|
|
33
|
-
async function execWithSudoIfNeeded(command, args) {
|
|
34
|
-
const needsSudo = shouldUseSudoForGlobalInstall();
|
|
35
|
-
if (needsSudo) {
|
|
36
|
-
console.log(a.yellow(`
|
|
37
|
-
${i18n.t("updater:usingSudo")}`));
|
|
38
|
-
const result = await q("sudo", [command, ...args]);
|
|
39
|
-
if (result.exitCode !== 0) {
|
|
40
|
-
throw new Error(result.stderr || `Command failed with exit code ${result.exitCode}`);
|
|
41
|
-
}
|
|
42
|
-
return { usedSudo: true };
|
|
43
|
-
} else {
|
|
44
|
-
const result = await q(command, args);
|
|
45
|
-
if (result.exitCode !== 0) {
|
|
46
|
-
throw new Error(result.stderr || `Command failed with exit code ${result.exitCode}`);
|
|
47
|
-
}
|
|
48
|
-
return { usedSudo: false };
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
async function updateCcr(force = false, skipPrompt = false) {
|
|
52
|
-
ensureI18nInitialized();
|
|
53
|
-
const spinner = ora(i18n.t("updater:checkingVersion")).start();
|
|
54
|
-
try {
|
|
55
|
-
const { installed, currentVersion, latestVersion, needsUpdate } = await checkCcrVersion();
|
|
56
|
-
spinner.stop();
|
|
57
|
-
if (!installed) {
|
|
58
|
-
console.log(a.yellow(i18n.t("updater:ccrNotInstalled")));
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
if (!needsUpdate && !force) {
|
|
62
|
-
console.log(a.green(format(i18n.t("updater:ccrUpToDate"), { version: currentVersion || "" })));
|
|
63
|
-
return true;
|
|
64
|
-
}
|
|
65
|
-
if (!latestVersion) {
|
|
66
|
-
console.log(a.yellow(i18n.t("updater:cannotCheckVersion")));
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
69
|
-
console.log(a.green(format(i18n.t("updater:currentVersion"), { version: currentVersion || "" })));
|
|
70
|
-
console.log(a.green(format(i18n.t("updater:latestVersion"), { version: latestVersion })));
|
|
71
|
-
if (!skipPrompt) {
|
|
72
|
-
const confirm = await promptBoolean({
|
|
73
|
-
message: format(i18n.t("updater:confirmUpdate"), { tool: "CCR" }),
|
|
74
|
-
defaultValue: true
|
|
75
|
-
});
|
|
76
|
-
if (!confirm) {
|
|
77
|
-
console.log(a.gray(i18n.t("updater:updateSkipped")));
|
|
78
|
-
return true;
|
|
79
|
-
}
|
|
80
|
-
} else {
|
|
81
|
-
console.log(a.green(format(i18n.t("updater:autoUpdating"), { tool: "CCR" })));
|
|
82
|
-
}
|
|
83
|
-
const updateSpinner = ora(format(i18n.t("updater:updating"), { tool: "CCR" })).start();
|
|
84
|
-
try {
|
|
85
|
-
await execWithSudoIfNeeded("npm", ["update", "-g", "@musistudio/claude-code-router"]);
|
|
86
|
-
updateSpinner.succeed(format(i18n.t("updater:updateSuccess"), { tool: "CCR" }));
|
|
87
|
-
return true;
|
|
88
|
-
} catch (error) {
|
|
89
|
-
updateSpinner.fail(format(i18n.t("updater:updateFailed"), { tool: "CCR" }));
|
|
90
|
-
console.error(a.red(error instanceof Error ? error.message : String(error)));
|
|
91
|
-
return false;
|
|
92
|
-
}
|
|
93
|
-
} catch (error) {
|
|
94
|
-
spinner.fail(i18n.t("updater:checkFailed"));
|
|
95
|
-
console.error(a.red(error instanceof Error ? error.message : String(error)));
|
|
96
|
-
return false;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
async function updateClaudeCode(force = false, skipPrompt = false) {
|
|
100
|
-
ensureI18nInitialized();
|
|
101
|
-
const spinner = ora(i18n.t("updater:checkingVersion")).start();
|
|
102
|
-
try {
|
|
103
|
-
const { installed, currentVersion, latestVersion, needsUpdate, isHomebrew, installationSource, isBroken, hasWrongPackage, wrongPackageName } = await checkClaudeCodeVersion();
|
|
104
|
-
spinner.stop();
|
|
105
|
-
if (hasWrongPackage && wrongPackageName) {
|
|
106
|
-
console.log(a.yellow(`
|
|
107
|
-
\u26A0\uFE0F ${i18n.t("installation:wrongPackageDetected")}`));
|
|
108
|
-
console.log(a.red(` ${i18n.t("installation:installedPackage")}: ${wrongPackageName}`));
|
|
109
|
-
console.log(a.green(` ${i18n.t("installation:correctPackage")}: @anthropic-ai/claude-code`));
|
|
110
|
-
console.log();
|
|
111
|
-
if (!skipPrompt) {
|
|
112
|
-
const inquirer = (await import('./index3.mjs').then(function (n) { return n.c; })).default;
|
|
113
|
-
const { shouldFix } = await inquirer.prompt([
|
|
114
|
-
{
|
|
115
|
-
type: "confirm",
|
|
116
|
-
name: "shouldFix",
|
|
117
|
-
message: i18n.t("installation:confirmFixWrongPackage"),
|
|
118
|
-
default: true
|
|
119
|
-
}
|
|
120
|
-
]);
|
|
121
|
-
if (!shouldFix) {
|
|
122
|
-
console.log(a.gray(i18n.t("installation:wrongPackageSkipped")));
|
|
123
|
-
return false;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
const fixSpinner = ora(i18n.t("installation:fixingWrongPackage")).start();
|
|
127
|
-
try {
|
|
128
|
-
await execWithSudoIfNeeded("npm", ["uninstall", "-g", wrongPackageName]);
|
|
129
|
-
fixSpinner.text = i18n.t("installation:installingCorrectPackage");
|
|
130
|
-
await execWithSudoIfNeeded("npm", ["install", "-g", "@anthropic-ai/claude-code", "--force"]);
|
|
131
|
-
fixSpinner.succeed(a.green(`\u2713 ${i18n.t("installation:wrongPackageFixed")}`));
|
|
132
|
-
console.log(a.green(`
|
|
133
|
-
\u2713 ${i18n.t("installation:nowUsingCorrectPackage")}`));
|
|
134
|
-
return true;
|
|
135
|
-
} catch (error) {
|
|
136
|
-
fixSpinner.fail(a.red(`\u2717 ${i18n.t("installation:wrongPackageFixFailed")}`));
|
|
137
|
-
console.error(a.red(error instanceof Error ? error.message : String(error)));
|
|
138
|
-
console.log(a.gray(`
|
|
139
|
-
${i18n.t("installation:manualFixHint")}:`));
|
|
140
|
-
console.log(a.gray(` npm uninstall -g ${wrongPackageName}`));
|
|
141
|
-
console.log(a.gray(` npm install -g @anthropic-ai/claude-code`));
|
|
142
|
-
return false;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
if (!installed) {
|
|
146
|
-
console.log(a.yellow(i18n.t("updater:claudeCodeNotInstalled")));
|
|
147
|
-
return false;
|
|
148
|
-
}
|
|
149
|
-
if (!needsUpdate && !force) {
|
|
150
|
-
console.log(a.green(format(i18n.t("updater:claudeCodeUpToDate"), { version: currentVersion || "" })));
|
|
151
|
-
return true;
|
|
152
|
-
}
|
|
153
|
-
if (!latestVersion) {
|
|
154
|
-
console.log(a.yellow(i18n.t("updater:cannotCheckVersion")));
|
|
155
|
-
return false;
|
|
156
|
-
}
|
|
157
|
-
console.log(a.green(format(i18n.t("updater:currentVersion"), { version: currentVersion || "" })));
|
|
158
|
-
console.log(a.green(format(i18n.t("updater:latestVersion"), { version: latestVersion })));
|
|
159
|
-
if (isBroken) {
|
|
160
|
-
console.log(a.yellow(i18n.t("updater:installationBroken")));
|
|
161
|
-
const fixResult = await fixBrokenNpmSymlink();
|
|
162
|
-
if (fixResult.fixed) {
|
|
163
|
-
console.log(a.green(`\u2714 ${i18n.t("updater:symlinkFixed")}: ${fixResult.message}`));
|
|
164
|
-
const recheckResult = await checkClaudeCodeVersion();
|
|
165
|
-
if (!recheckResult.isBroken) {
|
|
166
|
-
console.log(a.green(i18n.t("updater:installationRepaired")));
|
|
167
|
-
if (!recheckResult.needsUpdate && !force) {
|
|
168
|
-
console.log(a.green(format(i18n.t("updater:claudeCodeUpToDate"), { version: recheckResult.currentVersion || "" })));
|
|
169
|
-
return true;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
} else {
|
|
173
|
-
console.log(a.gray(`\u2139 ${fixResult.message}`));
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
if (!skipPrompt) {
|
|
177
|
-
const confirm = await promptBoolean({
|
|
178
|
-
message: format(i18n.t("updater:confirmUpdate"), { tool: "Claude Code" }),
|
|
179
|
-
defaultValue: true
|
|
180
|
-
});
|
|
181
|
-
if (!confirm) {
|
|
182
|
-
console.log(a.gray(i18n.t("updater:updateSkipped")));
|
|
183
|
-
return true;
|
|
184
|
-
}
|
|
185
|
-
} else {
|
|
186
|
-
console.log(a.green(format(i18n.t("updater:autoUpdating"), { tool: "Claude Code" })));
|
|
187
|
-
}
|
|
188
|
-
const toolName = isHomebrew ? "Claude Code (Homebrew)" : "Claude Code";
|
|
189
|
-
const updateSpinner = ora(format(i18n.t("updater:updating"), { tool: toolName })).start();
|
|
190
|
-
try {
|
|
191
|
-
if (isHomebrew) {
|
|
192
|
-
const result = await q("brew", ["upgrade", "--cask", "claude-code"]);
|
|
193
|
-
if (result.exitCode !== 0) {
|
|
194
|
-
throw new Error(result.stderr || `Command failed with exit code ${result.exitCode}`);
|
|
195
|
-
}
|
|
196
|
-
} else {
|
|
197
|
-
if (isBroken) {
|
|
198
|
-
if (installationSource === "npm") {
|
|
199
|
-
await execWithSudoIfNeeded("npm", ["install", "-g", "@anthropic-ai/claude-code"]);
|
|
200
|
-
} else if (installationSource === "curl") {
|
|
201
|
-
const { detectAllClaudeCodeInstallations } = await import('./version-checker.mjs');
|
|
202
|
-
const installations = await detectAllClaudeCodeInstallations();
|
|
203
|
-
const curlInstall = installations.find((i) => i.source === "curl" && i.version);
|
|
204
|
-
if (curlInstall?.path) {
|
|
205
|
-
await execWithSudoIfNeeded(curlInstall.path, ["update"]);
|
|
206
|
-
} else {
|
|
207
|
-
throw new Error(i18n.t("updater:curlReinstallRequired"));
|
|
208
|
-
}
|
|
209
|
-
} else {
|
|
210
|
-
const { detectAllClaudeCodeInstallations } = await import('./version-checker.mjs');
|
|
211
|
-
const installations = await detectAllClaudeCodeInstallations();
|
|
212
|
-
const activeInstall = installations.find((i) => i.version);
|
|
213
|
-
if (activeInstall?.path) {
|
|
214
|
-
await execWithSudoIfNeeded(activeInstall.path, ["update"]);
|
|
215
|
-
} else {
|
|
216
|
-
throw new Error(i18n.t("updater:curlReinstallRequired"));
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
} else {
|
|
220
|
-
await execWithSudoIfNeeded("claude", ["update"]);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
const { commandExists } = await import('./platform.mjs').then(function (n) { return n.p; });
|
|
224
|
-
const claudeWorks = await commandExists("claude");
|
|
225
|
-
if (claudeWorks) {
|
|
226
|
-
updateSpinner.succeed(format(i18n.t("updater:updateSuccess"), { tool: "Claude Code" }));
|
|
227
|
-
} else {
|
|
228
|
-
updateSpinner.warn(format(i18n.t("updater:updateSuccess"), { tool: "Claude Code" }));
|
|
229
|
-
console.log(a.yellow(" \u26A0 claude command not found in PATH after update"));
|
|
230
|
-
console.log(a.gray(" Try: npm install -g @anthropic-ai/claude-code"));
|
|
231
|
-
}
|
|
232
|
-
return claudeWorks;
|
|
233
|
-
} catch (error) {
|
|
234
|
-
updateSpinner.fail(format(i18n.t("updater:updateFailed"), { tool: "Claude Code" }));
|
|
235
|
-
console.error(a.red(error instanceof Error ? error.message : String(error)));
|
|
236
|
-
return false;
|
|
237
|
-
}
|
|
238
|
-
} catch (error) {
|
|
239
|
-
spinner.fail(i18n.t("updater:checkFailed"));
|
|
240
|
-
console.error(a.red(error instanceof Error ? error.message : String(error)));
|
|
241
|
-
return false;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
async function updateCometixLine(force = false, skipPrompt = false) {
|
|
245
|
-
ensureI18nInitialized();
|
|
246
|
-
const spinner = ora(i18n.t("updater:checkingVersion")).start();
|
|
247
|
-
try {
|
|
248
|
-
const { installed, currentVersion, latestVersion, needsUpdate } = await checkCometixLineVersion();
|
|
249
|
-
spinner.stop();
|
|
250
|
-
if (!installed) {
|
|
251
|
-
console.log(a.yellow(i18n.t("updater:cometixLineNotInstalled")));
|
|
252
|
-
return false;
|
|
253
|
-
}
|
|
254
|
-
if (!needsUpdate && !force) {
|
|
255
|
-
console.log(a.green(format(i18n.t("updater:cometixLineUpToDate"), { version: currentVersion || "" })));
|
|
256
|
-
return true;
|
|
257
|
-
}
|
|
258
|
-
if (!latestVersion) {
|
|
259
|
-
console.log(a.yellow(i18n.t("updater:cannotCheckVersion")));
|
|
260
|
-
return false;
|
|
261
|
-
}
|
|
262
|
-
console.log(a.green(format(i18n.t("updater:currentVersion"), { version: currentVersion || "" })));
|
|
263
|
-
console.log(a.green(format(i18n.t("updater:latestVersion"), { version: latestVersion })));
|
|
264
|
-
if (!skipPrompt) {
|
|
265
|
-
const confirm = await promptBoolean({
|
|
266
|
-
message: format(i18n.t("updater:confirmUpdate"), { tool: "CCometixLine" }),
|
|
267
|
-
defaultValue: true
|
|
268
|
-
});
|
|
269
|
-
if (!confirm) {
|
|
270
|
-
console.log(a.gray(i18n.t("updater:updateSkipped")));
|
|
271
|
-
return true;
|
|
272
|
-
}
|
|
273
|
-
} else {
|
|
274
|
-
console.log(a.green(format(i18n.t("updater:autoUpdating"), { tool: "CCometixLine" })));
|
|
275
|
-
}
|
|
276
|
-
const updateSpinner = ora(format(i18n.t("updater:updating"), { tool: "CCometixLine" })).start();
|
|
277
|
-
try {
|
|
278
|
-
await execWithSudoIfNeeded("npm", ["update", "-g", "@cometix/ccline"]);
|
|
279
|
-
updateSpinner.succeed(format(i18n.t("updater:updateSuccess"), { tool: "CCometixLine" }));
|
|
280
|
-
return true;
|
|
281
|
-
} catch (error) {
|
|
282
|
-
updateSpinner.fail(format(i18n.t("updater:updateFailed"), { tool: "CCometixLine" }));
|
|
283
|
-
console.error(a.red(error instanceof Error ? error.message : String(error)));
|
|
284
|
-
return false;
|
|
285
|
-
}
|
|
286
|
-
} catch (error) {
|
|
287
|
-
spinner.fail(i18n.t("updater:checkFailed"));
|
|
288
|
-
console.error(a.red(error instanceof Error ? error.message : String(error)));
|
|
289
|
-
return false;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
async function checkAndUpdateTools(skipPrompt = false) {
|
|
293
|
-
ensureI18nInitialized();
|
|
294
|
-
console.log(a.bold.cyan(`
|
|
295
|
-
\u{1F50D} ${i18n.t("updater:checkingTools")}
|
|
296
|
-
`));
|
|
297
|
-
try {
|
|
298
|
-
const duplicateResult = await handleDuplicateInstallations(skipPrompt);
|
|
299
|
-
if (duplicateResult.hadDuplicates) {
|
|
300
|
-
console.log();
|
|
301
|
-
}
|
|
302
|
-
} catch (error) {
|
|
303
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
304
|
-
console.warn(a.yellow(`\u26A0 Duplicate installation check failed: ${errorMessage}`));
|
|
305
|
-
}
|
|
306
|
-
const results = [];
|
|
307
|
-
console.log(a.bold("\u{1F4E6} CCJK"));
|
|
308
|
-
try {
|
|
309
|
-
await checkCcjkVersionAndPrompt(skipPrompt);
|
|
310
|
-
results.push({ tool: "CCJK", success: true });
|
|
311
|
-
} catch (error) {
|
|
312
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
313
|
-
console.error(a.red(`\u274C ${format(i18n.t("updater:updateFailed"), { tool: "CCJK" })}: ${errorMessage}`));
|
|
314
|
-
results.push({ tool: "CCJK", success: false, error: errorMessage });
|
|
315
|
-
}
|
|
316
|
-
console.log();
|
|
317
|
-
console.log(a.bold("\u{1F500} CCR"));
|
|
318
|
-
try {
|
|
319
|
-
const success = await updateCcr(false, skipPrompt);
|
|
320
|
-
results.push({ tool: "CCR", success });
|
|
321
|
-
} catch (error) {
|
|
322
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
323
|
-
console.error(a.red(`\u274C ${format(i18n.t("updater:updateFailed"), { tool: "CCR" })}: ${errorMessage}`));
|
|
324
|
-
results.push({ tool: "CCR", success: false, error: errorMessage });
|
|
325
|
-
}
|
|
326
|
-
console.log();
|
|
327
|
-
try {
|
|
328
|
-
const success = await updateClaudeCode(false, skipPrompt);
|
|
329
|
-
results.push({ tool: "Claude Code", success });
|
|
330
|
-
} catch (error) {
|
|
331
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
332
|
-
console.error(a.red(`\u274C ${format(i18n.t("updater:updateFailed"), { tool: "Claude Code" })}: ${errorMessage}`));
|
|
333
|
-
results.push({ tool: "Claude Code", success: false, error: errorMessage });
|
|
334
|
-
}
|
|
335
|
-
console.log();
|
|
336
|
-
try {
|
|
337
|
-
const success = await updateCometixLine(false, skipPrompt);
|
|
338
|
-
results.push({ tool: "CCometixLine", success });
|
|
339
|
-
} catch (error) {
|
|
340
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
341
|
-
console.error(a.red(`\u274C ${format(i18n.t("updater:updateFailed"), { tool: "CCometixLine" })}: ${errorMessage}`));
|
|
342
|
-
results.push({ tool: "CCometixLine", success: false, error: errorMessage });
|
|
343
|
-
}
|
|
344
|
-
if (skipPrompt) {
|
|
345
|
-
console.log(a.bold.cyan(`
|
|
346
|
-
\u{1F4CB} ${i18n.t("updater:updateSummary")}`));
|
|
347
|
-
for (const result of results) {
|
|
348
|
-
if (result.success) {
|
|
349
|
-
console.log(a.green(`\u2714 ${result.tool}: ${i18n.t("updater:success")}`));
|
|
350
|
-
} else {
|
|
351
|
-
console.log(a.red(`\u274C ${result.tool}: ${i18n.t("updater:failed")} ${result.error ? `(${result.error})` : ""}`));
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
async function checkCcjkVersionAndPrompt(skipPrompt) {
|
|
357
|
-
try {
|
|
358
|
-
const { readFileSync } = await import('node:fs');
|
|
359
|
-
const { fileURLToPath } = await import('node:url');
|
|
360
|
-
const { dirname, join } = await import('./index8.mjs');
|
|
361
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
362
|
-
const pkgPath = join(__dirname, "..", "..", "package.json");
|
|
363
|
-
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
364
|
-
const currentVersion = pkg.version;
|
|
365
|
-
console.log(a.cyan(`${i18n.t("updater:currentVersion")} v${currentVersion}`));
|
|
366
|
-
const { stdout } = await q("npm", ["view", "ccjk", "version"]);
|
|
367
|
-
const latestVersion = stdout.trim();
|
|
368
|
-
console.log(a.cyan(`${i18n.t("updater:latestVersion")} v${latestVersion}`));
|
|
369
|
-
if (currentVersion === latestVersion) {
|
|
370
|
-
console.log(a.green(`\u2713 ${i18n.t("updater:alreadyLatest")}`));
|
|
371
|
-
return;
|
|
372
|
-
}
|
|
373
|
-
if (!skipPrompt) {
|
|
374
|
-
const inquirer = (await import('./index3.mjs').then(function (n) { return n.c; })).default;
|
|
375
|
-
const { shouldUpdate } = await inquirer.prompt([
|
|
376
|
-
{
|
|
377
|
-
type: "confirm",
|
|
378
|
-
name: "shouldUpdate",
|
|
379
|
-
message: format(i18n.t("updater:updatePrompt"), { tool: "CCJK", version: latestVersion }),
|
|
380
|
-
default: true
|
|
381
|
-
}
|
|
382
|
-
]);
|
|
383
|
-
if (!shouldUpdate) {
|
|
384
|
-
console.log(a.gray(i18n.t("updater:updateSkipped")));
|
|
385
|
-
return;
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
console.log(a.dim("Clearing npx cache..."));
|
|
389
|
-
try {
|
|
390
|
-
await q("npm", ["cache", "clean", "--force"]);
|
|
391
|
-
} catch {
|
|
392
|
-
}
|
|
393
|
-
const ora2 = (await import('./index7.mjs')).default;
|
|
394
|
-
const updateSpinner = ora2("Updating CCJK...").start();
|
|
395
|
-
try {
|
|
396
|
-
await execWithSudoIfNeeded("npm", ["install", "-g", "ccjk@latest", "--force"]);
|
|
397
|
-
updateSpinner.succeed(a.green(`\u2713 CCJK updated to v${latestVersion}`));
|
|
398
|
-
console.log(a.yellow("\n\u26A0 Please restart ccjk to use the new version"));
|
|
399
|
-
process.exit(0);
|
|
400
|
-
} catch (error) {
|
|
401
|
-
updateSpinner.fail(a.red("\u2717 CCJK update failed"));
|
|
402
|
-
console.error(a.red(error instanceof Error ? error.message : String(error)));
|
|
403
|
-
console.log(a.gray("\nTry manually: npm install -g ccjk@latest"));
|
|
404
|
-
}
|
|
405
|
-
} catch (error) {
|
|
406
|
-
console.error(a.red(`${i18n.t("updater:checkFailed")} ${error instanceof Error ? error.message : String(error)}`));
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
export { checkAndUpdateTools, execWithSudoIfNeeded, updateCcr, updateClaudeCode, updateCometixLine };
|
package/dist/chunks/banner.mjs
DELETED
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import a from './index2.mjs';
|
|
2
|
-
import { ensureI18nInitialized, i18n } from './index5.mjs';
|
|
3
|
-
import { a as getRuntimeHomepage, g as getRuntimeVersion } from '../shared/ccjk.gDEDGD_t.mjs';
|
|
4
|
-
import '../shared/ccjk.BAGoDD49.mjs';
|
|
5
|
-
import 'node:fs';
|
|
6
|
-
import 'node:process';
|
|
7
|
-
import 'node:url';
|
|
8
|
-
import '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
9
|
-
|
|
10
|
-
const theme = {
|
|
11
|
-
// === Core Colors ===
|
|
12
|
-
/** Terminal green - main text color */
|
|
13
|
-
primary: a.green,
|
|
14
|
-
/** Bright white - emphasis and highlights */
|
|
15
|
-
secondary: a.white,
|
|
16
|
-
/** Dim green - subtle accents */
|
|
17
|
-
accent: a.green,
|
|
18
|
-
// === Semantic Colors ===
|
|
19
|
-
/** Success - bright green checkmark */
|
|
20
|
-
success: a.bold.green,
|
|
21
|
-
/** Warning - amber/yellow for caution */
|
|
22
|
-
warning: a.yellow,
|
|
23
|
-
/** Error - red for failures */
|
|
24
|
-
error: a.red,
|
|
25
|
-
/** Info - cyan for informational messages */
|
|
26
|
-
info: a.cyan,
|
|
27
|
-
// === Text Styles ===
|
|
28
|
-
/** Muted text - gray for less important info */
|
|
29
|
-
muted: a.gray,
|
|
30
|
-
/** Bold text */
|
|
31
|
-
bold: a.bold,
|
|
32
|
-
/** Dim text - for background info */
|
|
33
|
-
dim: a.dim,
|
|
34
|
-
// === MUD-specific Styles ===
|
|
35
|
-
/** Command prompt style - bright green */
|
|
36
|
-
prompt: a.bold.green,
|
|
37
|
-
/** System message - white */
|
|
38
|
-
system: a.white,
|
|
39
|
-
/** NPC/hint text - dim green */
|
|
40
|
-
hint: a.green,
|
|
41
|
-
/** Quest/task highlight - bright */
|
|
42
|
-
quest: a.bold.green,
|
|
43
|
-
/** Item/feature name - white bold */
|
|
44
|
-
item: a.bold.white
|
|
45
|
-
};
|
|
46
|
-
const status = {
|
|
47
|
-
/** ✓ Success indicator */
|
|
48
|
-
ok: (text) => `${a.green("\u2713")} ${text}`,
|
|
49
|
-
/** ✗ Error indicator */
|
|
50
|
-
fail: (text) => `${a.red("\u2717")} ${text}`,
|
|
51
|
-
/** ⚠ Warning indicator */
|
|
52
|
-
warn: (text) => `${a.yellow("\u26A0")} ${text}`,
|
|
53
|
-
/** ℹ Info indicator */
|
|
54
|
-
info: (text) => `${a.cyan("\u2139")} ${text}`,
|
|
55
|
-
/** ○ Pending indicator */
|
|
56
|
-
wait: (text) => `${a.gray("\u25CB")} ${text}`,
|
|
57
|
-
/** ◐ In-progress indicator */
|
|
58
|
-
work: (text) => `${a.green("\u25D0")} ${text}`};
|
|
59
|
-
const box = {
|
|
60
|
-
single: { tl: "\u250C", tr: "\u2510", bl: "\u2514", br: "\u2518", h: "\u2500", v: "\u2502" },
|
|
61
|
-
double: { tl: "\u2554", tr: "\u2557", bl: "\u255A", br: "\u255D", h: "\u2550", v: "\u2551" },
|
|
62
|
-
rounded: { tl: "\u256D", tr: "\u256E", bl: "\u2570", br: "\u256F", h: "\u2500", v: "\u2502" },
|
|
63
|
-
heavy: { tl: "\u250F", tr: "\u2513", bl: "\u2517", br: "\u251B", h: "\u2501", v: "\u2503" }
|
|
64
|
-
};
|
|
65
|
-
function boxify(content, style = "double", title) {
|
|
66
|
-
const chars = box[style];
|
|
67
|
-
const lines = content.split("\n");
|
|
68
|
-
const getWidth = (s) => {
|
|
69
|
-
let w = 0;
|
|
70
|
-
for (const c of s) {
|
|
71
|
-
w += c.match(/[\u4E00-\u9FFF\uFF01-\uFF60\u3000-\u303F]/) ? 2 : 1;
|
|
72
|
-
}
|
|
73
|
-
return w;
|
|
74
|
-
};
|
|
75
|
-
const maxWidth = Math.max(
|
|
76
|
-
...lines.map(getWidth),
|
|
77
|
-
getWidth(title) + 4
|
|
78
|
-
);
|
|
79
|
-
const paddedLines = lines.map((line) => {
|
|
80
|
-
const padding = maxWidth - getWidth(line);
|
|
81
|
-
return `${chars.v} ${line}${" ".repeat(padding)} ${chars.v}`;
|
|
82
|
-
});
|
|
83
|
-
let topBorder = `${chars.tl}${chars.h.repeat(maxWidth + 2)}${chars.tr}`;
|
|
84
|
-
{
|
|
85
|
-
const pad = Math.floor((maxWidth - getWidth(title)) / 2);
|
|
86
|
-
topBorder = `${chars.tl}${chars.h.repeat(pad)} ${title} ${chars.h.repeat(maxWidth - pad - getWidth(title))}${chars.tr}`;
|
|
87
|
-
}
|
|
88
|
-
const bottomBorder = `${chars.bl}${chars.h.repeat(maxWidth + 2)}${chars.br}`;
|
|
89
|
-
return theme.primary([topBorder, ...paddedLines, bottomBorder].join("\n"));
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function getDisplayWidth(str) {
|
|
93
|
-
let width = 0;
|
|
94
|
-
for (const char of str) {
|
|
95
|
-
if (char.match(/[\u4E00-\u9FFF\uFF01-\uFF60\u3000-\u303F]/)) {
|
|
96
|
-
width += 2;
|
|
97
|
-
} else {
|
|
98
|
-
width += 1;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
return width;
|
|
102
|
-
}
|
|
103
|
-
function padToDisplayWidth(str, targetWidth) {
|
|
104
|
-
const currentWidth = getDisplayWidth(str);
|
|
105
|
-
const paddingNeeded = Math.max(0, targetWidth - currentWidth);
|
|
106
|
-
return str + " ".repeat(paddingNeeded);
|
|
107
|
-
}
|
|
108
|
-
function displayBanner(subtitle) {
|
|
109
|
-
ensureI18nInitialized();
|
|
110
|
-
const version = getRuntimeVersion();
|
|
111
|
-
const defaultSubtitle = i18n.t("cli:banner.subtitle");
|
|
112
|
-
const subtitleText = subtitle || defaultSubtitle;
|
|
113
|
-
const paddedSubtitle = padToDisplayWidth(subtitleText, 28);
|
|
114
|
-
console.log(
|
|
115
|
-
a.green.bold(`
|
|
116
|
-
\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557
|
|
117
|
-
\u2551 \u2551
|
|
118
|
-
\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557 \u2551
|
|
119
|
-
\u2551 \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2554\u255D \u2551
|
|
120
|
-
\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2554\u255D ${a.white.bold("JinKu")} \u2551
|
|
121
|
-
\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2588\u2588\u2557 ${a.gray(`v${version}`)}${" ".repeat(Math.max(0, 17 - version.length))}\u2551
|
|
122
|
-
\u2551 \u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u255A\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u2588\u2588\u2557 \u2551
|
|
123
|
-
\u2551 \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D ${a.gray(paddedSubtitle)} \u2551
|
|
124
|
-
\u2551 \u2551
|
|
125
|
-
\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D
|
|
126
|
-
`)
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
function displayBannerWithInfo(subtitle) {
|
|
130
|
-
const homepage = getRuntimeHomepage();
|
|
131
|
-
displayBanner(subtitle);
|
|
132
|
-
console.log(a.gray(` ${a.green("ccjk")} - Advanced AI Development Assistant`));
|
|
133
|
-
console.log(a.gray(` ${a.green(homepage)}
|
|
134
|
-
`));
|
|
135
|
-
}
|
|
136
|
-
function displayCommandDiscovery() {
|
|
137
|
-
ensureI18nInitialized();
|
|
138
|
-
const isZhCN = i18n.language === "zh-CN";
|
|
139
|
-
console.log(a.green.bold(`
|
|
140
|
-
${i18n.t("cli:commandDiscovery.title")}`));
|
|
141
|
-
console.log(a.gray("\u2500".repeat(60)));
|
|
142
|
-
const ccjkCommands = [
|
|
143
|
-
{ cmd: "/status", desc: i18n.t("cli:commandDiscovery.status"), descEn: "Brain Dashboard" },
|
|
144
|
-
{ cmd: "/health", desc: i18n.t("cli:commandDiscovery.health"), descEn: "Health Check" },
|
|
145
|
-
{ cmd: "/search", desc: i18n.t("cli:commandDiscovery.search"), descEn: "Search Contexts" },
|
|
146
|
-
{ cmd: "/compress", desc: i18n.t("cli:commandDiscovery.compress"), descEn: "Compression Stats" },
|
|
147
|
-
{ cmd: "/tasks", desc: i18n.t("cli:commandDiscovery.tasks"), descEn: "Task Manager" },
|
|
148
|
-
{ cmd: "/backup", desc: i18n.t("cli:commandDiscovery.backup"), descEn: "Create Backup" },
|
|
149
|
-
{ cmd: "/optimize", desc: i18n.t("cli:commandDiscovery.optimize"), descEn: "Optimize DB" }
|
|
150
|
-
];
|
|
151
|
-
for (const { cmd, desc, descEn } of ccjkCommands) {
|
|
152
|
-
const cmdPadded = cmd.padEnd(12);
|
|
153
|
-
if (isZhCN) {
|
|
154
|
-
console.log(` ${a.cyan(cmdPadded)} - ${a.white(desc)} ${a.gray(`(${descEn})`)}`);
|
|
155
|
-
} else {
|
|
156
|
-
console.log(` ${a.cyan(cmdPadded)} - ${a.white(desc)}`);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
console.log(a.green.bold(`
|
|
160
|
-
${i18n.t("cli:commandDiscovery.claudeCodeTitle")}`));
|
|
161
|
-
console.log(a.gray("\u2500".repeat(60)));
|
|
162
|
-
const claudeCommands = [
|
|
163
|
-
{ cmd: "/help", desc: i18n.t("cli:commandDiscovery.help"), descEn: "Show all commands" },
|
|
164
|
-
{ cmd: "/clear", desc: i18n.t("cli:commandDiscovery.clear"), descEn: "Clear conversation" },
|
|
165
|
-
{ cmd: "/reset", desc: i18n.t("cli:commandDiscovery.reset"), descEn: "Reset session" }
|
|
166
|
-
];
|
|
167
|
-
for (const { cmd, desc, descEn } of claudeCommands) {
|
|
168
|
-
const cmdPadded = cmd.padEnd(12);
|
|
169
|
-
if (isZhCN) {
|
|
170
|
-
console.log(` ${a.cyan(cmdPadded)} - ${a.white(desc)} ${a.gray(`(${descEn})`)}`);
|
|
171
|
-
} else {
|
|
172
|
-
console.log(` ${a.cyan(cmdPadded)} - ${a.white(desc)}`);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
console.log(a.gray("\n" + "\u2500".repeat(60)));
|
|
176
|
-
console.log(a.gray(` ${i18n.t("cli:commandDiscovery.footer")}
|
|
177
|
-
`));
|
|
178
|
-
}
|
|
179
|
-
const STATUS = {
|
|
180
|
-
success: status.ok,
|
|
181
|
-
error: status.fail,
|
|
182
|
-
warning: status.warn,
|
|
183
|
-
info: status.info,
|
|
184
|
-
pending: status.wait,
|
|
185
|
-
inProgress: status.work
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
export { theme as COLORS, STATUS, box, boxify, displayBanner, displayBannerWithInfo, displayCommandDiscovery, getDisplayWidth, padToDisplayWidth, status, theme };
|