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,1051 +0,0 @@
|
|
|
1
|
-
import a from '../chunks/index2.mjs';
|
|
2
|
-
import { i as inquirer } from '../chunks/index3.mjs';
|
|
3
|
-
import { CLAUDE_DIR, SETTINGS_FILE } from '../chunks/constants.mjs';
|
|
4
|
-
import { ensureI18nInitialized, i18n } from '../chunks/index5.mjs';
|
|
5
|
-
import { e as getExistingApiConfig, f as configureApi, s as switchToOfficialLogin, b as backupExistingConfig, a as applyAiLanguageDirective } from '../chunks/config.mjs';
|
|
6
|
-
import { fileURLToPath } from 'node:url';
|
|
7
|
-
import { updateZcfConfig } from '../chunks/ccjk-config.mjs';
|
|
8
|
-
import { exists, removeFile, ensureDir, copyFile } from '../chunks/fs-operations.mjs';
|
|
9
|
-
import { readJsonConfig, writeJsonConfig } from '../chunks/json-config.mjs';
|
|
10
|
-
import { m as mergeAndCleanPermissions } from './ccjk.DXRAZcix.mjs';
|
|
11
|
-
import { a as addNumbersToChoices } from './ccjk.BFQ7yr5S.mjs';
|
|
12
|
-
import { p as promptBoolean } from './ccjk.DOwtZMk8.mjs';
|
|
13
|
-
import { j as join, d as dirname } from './ccjk.bQ7Dh1g4.mjs';
|
|
14
|
-
import { existsSync } from 'node:fs';
|
|
15
|
-
import { rm, mkdir, copyFile as copyFile$1 } from 'node:fs/promises';
|
|
16
|
-
|
|
17
|
-
const OUTPUT_STYLES = [
|
|
18
|
-
// Custom styles (have template files) - 大神模式
|
|
19
|
-
{
|
|
20
|
-
id: "linus-mode",
|
|
21
|
-
isCustom: true,
|
|
22
|
-
filePath: "linus-mode.md"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
id: "uncle-bob-mode",
|
|
26
|
-
isCustom: true,
|
|
27
|
-
filePath: "uncle-bob-mode.md"
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
id: "dhh-mode",
|
|
31
|
-
isCustom: true,
|
|
32
|
-
filePath: "dhh-mode.md"
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
id: "carmack-mode",
|
|
36
|
-
isCustom: true,
|
|
37
|
-
filePath: "carmack-mode.md"
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
id: "jobs-mode",
|
|
41
|
-
isCustom: true,
|
|
42
|
-
filePath: "jobs-mode.md"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
id: "evan-you-mode",
|
|
46
|
-
isCustom: true,
|
|
47
|
-
filePath: "evan-you-mode.md"
|
|
48
|
-
},
|
|
49
|
-
// Built-in styles (no template files) - Claude Code native styles
|
|
50
|
-
{
|
|
51
|
-
id: "default",
|
|
52
|
-
isCustom: false
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
id: "explanatory",
|
|
56
|
-
isCustom: false
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
id: "learning",
|
|
60
|
-
isCustom: false
|
|
61
|
-
}
|
|
62
|
-
];
|
|
63
|
-
const LEGACY_FILES = ["personality.md", "rules.md", "technical-guides.md", "mcp.md", "language.md"];
|
|
64
|
-
function getAvailableOutputStyles() {
|
|
65
|
-
return OUTPUT_STYLES;
|
|
66
|
-
}
|
|
67
|
-
async function copyOutputStyles(selectedStyles, lang) {
|
|
68
|
-
const outputStylesDir = join(CLAUDE_DIR, "output-styles");
|
|
69
|
-
ensureDir(outputStylesDir);
|
|
70
|
-
const currentFilePath = fileURLToPath(import.meta.url);
|
|
71
|
-
const distDir = dirname(dirname(currentFilePath));
|
|
72
|
-
const rootDir = dirname(distDir);
|
|
73
|
-
const templateDir = join(rootDir, "templates", "common", "output-styles", lang);
|
|
74
|
-
for (const styleId of selectedStyles) {
|
|
75
|
-
const style = OUTPUT_STYLES.find((s) => s.id === styleId);
|
|
76
|
-
if (!style || !style.isCustom || !style.filePath) {
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
79
|
-
const sourcePath = join(templateDir, style.filePath);
|
|
80
|
-
const destPath = join(outputStylesDir, style.filePath);
|
|
81
|
-
if (exists(sourcePath)) {
|
|
82
|
-
copyFile(sourcePath, destPath);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
const BUILTIN_STYLE_IDS = /* @__PURE__ */ new Set(["default", "explanatory", "learning"]);
|
|
87
|
-
function setGlobalDefaultOutputStyle(styleId) {
|
|
88
|
-
if (BUILTIN_STYLE_IDS.has(styleId)) {
|
|
89
|
-
console.log(a.yellow(`\u26A0\uFE0F Note: Built-in output styles (${styleId}) are deprecated in Claude Code 2.1+.`));
|
|
90
|
-
console.log(a.gray(" Custom styles (linus-mode, etc.) stored as .md files are still fully supported."));
|
|
91
|
-
}
|
|
92
|
-
const templatePermissions = getTemplatePermissions();
|
|
93
|
-
const existingSettings = readJsonConfig(SETTINGS_FILE) || {};
|
|
94
|
-
const cleanedPermissions = mergeAndCleanPermissions(
|
|
95
|
-
templatePermissions,
|
|
96
|
-
existingSettings.permissions?.allow
|
|
97
|
-
);
|
|
98
|
-
const updatedSettings = {
|
|
99
|
-
...existingSettings,
|
|
100
|
-
outputStyle: styleId,
|
|
101
|
-
// Ensure clean permissions
|
|
102
|
-
permissions: {
|
|
103
|
-
allow: cleanedPermissions
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
if (updatedSettings.plansDirectory === null) {
|
|
107
|
-
delete updatedSettings.plansDirectory;
|
|
108
|
-
}
|
|
109
|
-
writeJsonConfig(SETTINGS_FILE, updatedSettings);
|
|
110
|
-
}
|
|
111
|
-
function getTemplatePermissions() {
|
|
112
|
-
try {
|
|
113
|
-
const { readFileSync } = require("node:fs");
|
|
114
|
-
const { fileURLToPath: fileURLToPath2 } = require("node:url");
|
|
115
|
-
const { dirname: dirname2, join: join2 } = require("pathe");
|
|
116
|
-
const currentFilePath = fileURLToPath2(import.meta.url);
|
|
117
|
-
const distDir = dirname2(dirname2(currentFilePath));
|
|
118
|
-
const rootDir = dirname2(distDir);
|
|
119
|
-
const templatePath = join2(rootDir, "templates", "claude-code", "common", "settings.json");
|
|
120
|
-
if (require("node:fs").existsSync(templatePath)) {
|
|
121
|
-
const template = JSON.parse(readFileSync(templatePath, "utf-8"));
|
|
122
|
-
return template.permissions?.allow || [];
|
|
123
|
-
}
|
|
124
|
-
} catch (_error) {
|
|
125
|
-
}
|
|
126
|
-
return [
|
|
127
|
-
"Bash(git *)",
|
|
128
|
-
"Bash(npm *)",
|
|
129
|
-
"Bash(pnpm *)",
|
|
130
|
-
"Bash(node *)",
|
|
131
|
-
"Read(*)",
|
|
132
|
-
"Edit(*)",
|
|
133
|
-
"Write(*)"
|
|
134
|
-
];
|
|
135
|
-
}
|
|
136
|
-
function hasLegacyPersonalityFiles() {
|
|
137
|
-
return LEGACY_FILES.some((filename) => exists(join(CLAUDE_DIR, filename)));
|
|
138
|
-
}
|
|
139
|
-
function cleanupLegacyPersonalityFiles() {
|
|
140
|
-
LEGACY_FILES.forEach((filename) => {
|
|
141
|
-
const filePath = join(CLAUDE_DIR, filename);
|
|
142
|
-
if (exists(filePath)) {
|
|
143
|
-
removeFile(filePath);
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
async function configureOutputStyle(preselectedStyles, preselectedDefault) {
|
|
148
|
-
ensureI18nInitialized();
|
|
149
|
-
const outputStyleList = [
|
|
150
|
-
{
|
|
151
|
-
id: "default",
|
|
152
|
-
name: i18n.t("configuration:outputStyles.default.name"),
|
|
153
|
-
description: i18n.t("configuration:outputStyles.default.description")
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
id: "linus-mode",
|
|
157
|
-
name: i18n.t("configuration:outputStyles.linus-mode.name"),
|
|
158
|
-
description: i18n.t("configuration:outputStyles.linus-mode.description")
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
id: "uncle-bob-mode",
|
|
162
|
-
name: i18n.t("configuration:outputStyles.uncle-bob-mode.name"),
|
|
163
|
-
description: i18n.t("configuration:outputStyles.uncle-bob-mode.description")
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
id: "dhh-mode",
|
|
167
|
-
name: i18n.t("configuration:outputStyles.dhh-mode.name"),
|
|
168
|
-
description: i18n.t("configuration:outputStyles.dhh-mode.description")
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
id: "carmack-mode",
|
|
172
|
-
name: i18n.t("configuration:outputStyles.carmack-mode.name"),
|
|
173
|
-
description: i18n.t("configuration:outputStyles.carmack-mode.description")
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
id: "jobs-mode",
|
|
177
|
-
name: i18n.t("configuration:outputStyles.jobs-mode.name"),
|
|
178
|
-
description: i18n.t("configuration:outputStyles.jobs-mode.description")
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
id: "evan-you-mode",
|
|
182
|
-
name: i18n.t("configuration:outputStyles.evan-you-mode.name"),
|
|
183
|
-
description: i18n.t("configuration:outputStyles.evan-you-mode.description")
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
id: "explanatory",
|
|
187
|
-
name: i18n.t("configuration:outputStyles.explanatory.name"),
|
|
188
|
-
description: i18n.t("configuration:outputStyles.explanatory.description")
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
id: "learning",
|
|
192
|
-
name: i18n.t("configuration:outputStyles.learning.name"),
|
|
193
|
-
description: i18n.t("configuration:outputStyles.learning.description")
|
|
194
|
-
}
|
|
195
|
-
];
|
|
196
|
-
const availableStyles = getAvailableOutputStyles();
|
|
197
|
-
if (hasLegacyPersonalityFiles() && !preselectedStyles) {
|
|
198
|
-
console.log(a.yellow(`\u26A0\uFE0F ${i18n.t("configuration:legacyFilesDetected")}`));
|
|
199
|
-
const cleanupLegacy = await promptBoolean({
|
|
200
|
-
message: i18n.t("configuration:cleanupLegacyFiles"),
|
|
201
|
-
defaultValue: true
|
|
202
|
-
});
|
|
203
|
-
if (cleanupLegacy) {
|
|
204
|
-
cleanupLegacyPersonalityFiles();
|
|
205
|
-
console.log(a.green(`\u2714 ${i18n.t("configuration:legacyFilesRemoved")}`));
|
|
206
|
-
}
|
|
207
|
-
} else if (hasLegacyPersonalityFiles() && preselectedStyles) {
|
|
208
|
-
cleanupLegacyPersonalityFiles();
|
|
209
|
-
}
|
|
210
|
-
let selectedStyles;
|
|
211
|
-
let defaultStyle;
|
|
212
|
-
if (preselectedStyles && preselectedDefault) {
|
|
213
|
-
selectedStyles = preselectedStyles;
|
|
214
|
-
defaultStyle = preselectedDefault;
|
|
215
|
-
} else {
|
|
216
|
-
const customStyles = availableStyles.filter((style) => style.isCustom);
|
|
217
|
-
const { selectedStyles: promptedStyles } = await inquirer.prompt({
|
|
218
|
-
type: "checkbox",
|
|
219
|
-
name: "selectedStyles",
|
|
220
|
-
message: `${i18n.t("configuration:selectOutputStyles")}${i18n.t("common:multiSelectHint")}`,
|
|
221
|
-
choices: addNumbersToChoices(customStyles.map((style) => {
|
|
222
|
-
const styleInfo = outputStyleList.find((s) => s.id === style.id);
|
|
223
|
-
return {
|
|
224
|
-
name: `${styleInfo?.name || style.id} - ${a.gray(styleInfo?.description || "")}`,
|
|
225
|
-
value: style.id,
|
|
226
|
-
checked: true
|
|
227
|
-
// Default to all selected
|
|
228
|
-
};
|
|
229
|
-
})),
|
|
230
|
-
validate: async (input) => input.length > 0 || i18n.t("configuration:selectAtLeastOne")
|
|
231
|
-
});
|
|
232
|
-
if (!promptedStyles || promptedStyles.length === 0) {
|
|
233
|
-
console.log(a.yellow(i18n.t("common:cancelled")));
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
|
-
selectedStyles = promptedStyles;
|
|
237
|
-
const { defaultStyle: promptedDefault } = await inquirer.prompt({
|
|
238
|
-
type: "list",
|
|
239
|
-
name: "defaultStyle",
|
|
240
|
-
message: i18n.t("configuration:selectDefaultOutputStyle"),
|
|
241
|
-
choices: addNumbersToChoices([
|
|
242
|
-
// Show selected custom styles first (only what user actually installed)
|
|
243
|
-
...selectedStyles.map((styleId) => {
|
|
244
|
-
const styleInfo = outputStyleList.find((s) => s.id === styleId);
|
|
245
|
-
return {
|
|
246
|
-
name: `${styleInfo?.name || styleId} - ${a.gray(styleInfo?.description || "")}`,
|
|
247
|
-
value: styleId,
|
|
248
|
-
short: styleInfo?.name || styleId
|
|
249
|
-
};
|
|
250
|
-
}),
|
|
251
|
-
// Then show all built-in styles (always available)
|
|
252
|
-
...availableStyles.filter((style) => !style.isCustom).map((style) => {
|
|
253
|
-
const styleInfo = outputStyleList.find((s) => s.id === style.id);
|
|
254
|
-
return {
|
|
255
|
-
name: `${styleInfo?.name || style.id} - ${a.gray(styleInfo?.description || "")}`,
|
|
256
|
-
value: style.id,
|
|
257
|
-
short: styleInfo?.name || style.id
|
|
258
|
-
};
|
|
259
|
-
})
|
|
260
|
-
]),
|
|
261
|
-
default: selectedStyles.includes("linus-mode") ? "linus-mode" : selectedStyles[0]
|
|
262
|
-
});
|
|
263
|
-
if (!promptedDefault) {
|
|
264
|
-
console.log(a.yellow(i18n.t("common:cancelled")));
|
|
265
|
-
return;
|
|
266
|
-
}
|
|
267
|
-
defaultStyle = promptedDefault;
|
|
268
|
-
}
|
|
269
|
-
await copyOutputStyles(selectedStyles, "zh-CN");
|
|
270
|
-
setGlobalDefaultOutputStyle(defaultStyle);
|
|
271
|
-
updateZcfConfig({
|
|
272
|
-
outputStyles: selectedStyles,
|
|
273
|
-
defaultOutputStyle: defaultStyle
|
|
274
|
-
});
|
|
275
|
-
console.log(a.green(`\u2714 ${i18n.t("configuration:outputStyleInstalled")}`));
|
|
276
|
-
console.log(a.gray(` ${i18n.t("configuration:selectedStyles")}: ${selectedStyles.join(", ")}`));
|
|
277
|
-
console.log(a.gray(` ${i18n.t("configuration:defaultStyle")}: ${defaultStyle}`));
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
function validateApiKey(apiKey) {
|
|
281
|
-
if (!apiKey || apiKey.trim() === "") {
|
|
282
|
-
return {
|
|
283
|
-
isValid: false,
|
|
284
|
-
// Note: This should use i18next, but due to sync constraint in inquirer validate,
|
|
285
|
-
// we temporarily use a generic message. This will be fixed when we refactor to async validation.
|
|
286
|
-
error: "API key cannot be empty"
|
|
287
|
-
};
|
|
288
|
-
}
|
|
289
|
-
return { isValid: true };
|
|
290
|
-
}
|
|
291
|
-
function formatApiKeyDisplay(apiKey) {
|
|
292
|
-
if (!apiKey || apiKey.length < 12) {
|
|
293
|
-
return apiKey;
|
|
294
|
-
}
|
|
295
|
-
return `${apiKey.substring(0, 8)}...${apiKey.substring(apiKey.length - 4)}`;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
async function configureApiCompletely(preselectedAuthType) {
|
|
299
|
-
ensureI18nInitialized();
|
|
300
|
-
let authType = preselectedAuthType;
|
|
301
|
-
if (!authType) {
|
|
302
|
-
const { authType: selectedAuthType } = await inquirer.prompt({
|
|
303
|
-
type: "list",
|
|
304
|
-
name: "authType",
|
|
305
|
-
message: i18n.t("api:configureApi"),
|
|
306
|
-
choices: addNumbersToChoices([
|
|
307
|
-
{
|
|
308
|
-
name: i18n.t("api:useOfficialLogin"),
|
|
309
|
-
value: "official",
|
|
310
|
-
short: i18n.t("api:useOfficialLogin")
|
|
311
|
-
},
|
|
312
|
-
{
|
|
313
|
-
name: `${i18n.t("api:useAuthToken")} - ${a.gray(i18n.t("api:authTokenDesc"))}`,
|
|
314
|
-
value: "auth_token",
|
|
315
|
-
short: i18n.t("api:useAuthToken")
|
|
316
|
-
},
|
|
317
|
-
{
|
|
318
|
-
name: `${i18n.t("api:useApiKey")} - ${a.gray(i18n.t("api:apiKeyDesc"))}`,
|
|
319
|
-
value: "api_key",
|
|
320
|
-
short: i18n.t("api:useApiKey")
|
|
321
|
-
}
|
|
322
|
-
])
|
|
323
|
-
});
|
|
324
|
-
if (!selectedAuthType) {
|
|
325
|
-
console.log(a.yellow(i18n.t("common:cancelled")));
|
|
326
|
-
return null;
|
|
327
|
-
}
|
|
328
|
-
authType = selectedAuthType;
|
|
329
|
-
}
|
|
330
|
-
if (authType === "official") {
|
|
331
|
-
const success = switchToOfficialLogin();
|
|
332
|
-
if (success) {
|
|
333
|
-
return null;
|
|
334
|
-
} else {
|
|
335
|
-
console.log(a.red(i18n.t("api:officialLoginFailed")));
|
|
336
|
-
return null;
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
const { url } = await inquirer.prompt({
|
|
340
|
-
type: "input",
|
|
341
|
-
name: "url",
|
|
342
|
-
message: i18n.t("api:enterApiUrl"),
|
|
343
|
-
validate: async (value) => {
|
|
344
|
-
if (!value)
|
|
345
|
-
return i18n.t("api:urlRequired");
|
|
346
|
-
try {
|
|
347
|
-
void new URL(value);
|
|
348
|
-
return true;
|
|
349
|
-
} catch {
|
|
350
|
-
return i18n.t("api:invalidUrl");
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
});
|
|
354
|
-
if (url === void 0) {
|
|
355
|
-
console.log(a.yellow(i18n.t("common:cancelled")));
|
|
356
|
-
return null;
|
|
357
|
-
}
|
|
358
|
-
const keyMessage = authType === "auth_token" ? i18n.t("api:enterAuthToken") : i18n.t("api:enterApiKey");
|
|
359
|
-
const { key } = await inquirer.prompt({
|
|
360
|
-
type: "input",
|
|
361
|
-
name: "key",
|
|
362
|
-
message: keyMessage,
|
|
363
|
-
validate: async (value) => {
|
|
364
|
-
if (!value) {
|
|
365
|
-
return i18n.t("api:keyRequired");
|
|
366
|
-
}
|
|
367
|
-
const validation = validateApiKey(value);
|
|
368
|
-
if (!validation.isValid) {
|
|
369
|
-
return validation.error || i18n.t("api:invalidKeyFormat");
|
|
370
|
-
}
|
|
371
|
-
return true;
|
|
372
|
-
}
|
|
373
|
-
});
|
|
374
|
-
if (key === void 0) {
|
|
375
|
-
console.log(a.yellow(i18n.t("common:cancelled")));
|
|
376
|
-
return null;
|
|
377
|
-
}
|
|
378
|
-
console.log(a.gray(` API Key: ${formatApiKeyDisplay(key)}`));
|
|
379
|
-
return { url, key, authType };
|
|
380
|
-
}
|
|
381
|
-
async function modifyApiConfigPartially(existingConfig) {
|
|
382
|
-
ensureI18nInitialized();
|
|
383
|
-
let currentConfig = { ...existingConfig };
|
|
384
|
-
const latestConfig = getExistingApiConfig();
|
|
385
|
-
if (latestConfig) {
|
|
386
|
-
currentConfig = latestConfig;
|
|
387
|
-
}
|
|
388
|
-
const { item } = await inquirer.prompt({
|
|
389
|
-
type: "list",
|
|
390
|
-
name: "item",
|
|
391
|
-
message: i18n.t("api:selectModifyItems"),
|
|
392
|
-
choices: addNumbersToChoices([
|
|
393
|
-
{ name: i18n.t("api:modifyApiUrl"), value: "url" },
|
|
394
|
-
{ name: i18n.t("api:modifyApiKey"), value: "key" },
|
|
395
|
-
{ name: i18n.t("api:modifyAuthType"), value: "authType" }
|
|
396
|
-
])
|
|
397
|
-
});
|
|
398
|
-
if (!item) {
|
|
399
|
-
console.log(a.yellow(i18n.t("common:cancelled")));
|
|
400
|
-
return;
|
|
401
|
-
}
|
|
402
|
-
if (item === "url") {
|
|
403
|
-
const { url } = await inquirer.prompt({
|
|
404
|
-
type: "input",
|
|
405
|
-
name: "url",
|
|
406
|
-
message: i18n.t("api:enterNewApiUrl").replace("{url}", currentConfig.url || i18n.t("common:none")),
|
|
407
|
-
default: currentConfig.url,
|
|
408
|
-
validate: async (value) => {
|
|
409
|
-
if (!value)
|
|
410
|
-
return i18n.t("api:urlRequired");
|
|
411
|
-
try {
|
|
412
|
-
void new URL(value);
|
|
413
|
-
return true;
|
|
414
|
-
} catch {
|
|
415
|
-
return i18n.t("api:invalidUrl");
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
});
|
|
419
|
-
if (url === void 0) {
|
|
420
|
-
console.log(a.yellow(i18n.t("common:cancelled")));
|
|
421
|
-
return;
|
|
422
|
-
}
|
|
423
|
-
currentConfig.url = url;
|
|
424
|
-
const savedConfig = configureApi(currentConfig);
|
|
425
|
-
if (savedConfig) {
|
|
426
|
-
console.log(a.green(`\u2714 ${i18n.t("api:modificationSaved")}`));
|
|
427
|
-
console.log(a.gray(` ${i18n.t("api:apiConfigUrl")}: ${savedConfig.url}`));
|
|
428
|
-
}
|
|
429
|
-
} else if (item === "key") {
|
|
430
|
-
const authType = currentConfig.authType || "auth_token";
|
|
431
|
-
const keyMessage = authType === "auth_token" ? i18n.t("api:enterNewApiKey").replace("{key}", currentConfig.key ? formatApiKeyDisplay(currentConfig.key) : i18n.t("common:none")) : i18n.t("api:enterNewApiKey").replace("{key}", currentConfig.key ? formatApiKeyDisplay(currentConfig.key) : i18n.t("common:none"));
|
|
432
|
-
const { key } = await inquirer.prompt({
|
|
433
|
-
type: "input",
|
|
434
|
-
name: "key",
|
|
435
|
-
message: keyMessage,
|
|
436
|
-
validate: async (value) => {
|
|
437
|
-
if (!value) {
|
|
438
|
-
return i18n.t("api:keyRequired");
|
|
439
|
-
}
|
|
440
|
-
const validation = validateApiKey(value);
|
|
441
|
-
if (!validation.isValid) {
|
|
442
|
-
return validation.error || i18n.t("api:invalidKeyFormat");
|
|
443
|
-
}
|
|
444
|
-
return true;
|
|
445
|
-
}
|
|
446
|
-
});
|
|
447
|
-
if (key === void 0) {
|
|
448
|
-
console.log(a.yellow(i18n.t("common:cancelled")));
|
|
449
|
-
return;
|
|
450
|
-
}
|
|
451
|
-
currentConfig.key = key;
|
|
452
|
-
const savedConfig = configureApi(currentConfig);
|
|
453
|
-
if (savedConfig) {
|
|
454
|
-
console.log(a.green(`\u2714 ${i18n.t("api:modificationSaved")}`));
|
|
455
|
-
console.log(a.gray(` ${i18n.t("api:apiConfigKey")}: ${formatApiKeyDisplay(savedConfig.key)}`));
|
|
456
|
-
}
|
|
457
|
-
} else if (item === "authType") {
|
|
458
|
-
const { authType } = await inquirer.prompt({
|
|
459
|
-
type: "list",
|
|
460
|
-
name: "authType",
|
|
461
|
-
message: i18n.t("api:selectNewAuthType").replace("{type}", currentConfig.authType || i18n.t("common:none")),
|
|
462
|
-
choices: addNumbersToChoices([
|
|
463
|
-
{ name: "Auth Token (OAuth)", value: "auth_token" },
|
|
464
|
-
{ name: "API Key", value: "api_key" }
|
|
465
|
-
]),
|
|
466
|
-
default: currentConfig.authType === "api_key" ? 1 : 0
|
|
467
|
-
});
|
|
468
|
-
if (authType === void 0) {
|
|
469
|
-
console.log(a.yellow(i18n.t("common:cancelled")));
|
|
470
|
-
return;
|
|
471
|
-
}
|
|
472
|
-
currentConfig.authType = authType;
|
|
473
|
-
const savedConfig = configureApi(currentConfig);
|
|
474
|
-
if (savedConfig) {
|
|
475
|
-
console.log(a.green(`\u2714 ${i18n.t("api:modificationSaved")}`));
|
|
476
|
-
console.log(a.gray(` ${i18n.t("api:apiConfigAuthType")}: ${savedConfig.authType}`));
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
async function updatePromptOnly(aiOutputLang) {
|
|
481
|
-
ensureI18nInitialized();
|
|
482
|
-
const backupDir = backupExistingConfig();
|
|
483
|
-
if (backupDir) {
|
|
484
|
-
console.log(a.gray(`\u2714 ${i18n.t("configuration:backupSuccess")}: ${backupDir}`));
|
|
485
|
-
}
|
|
486
|
-
if (aiOutputLang) {
|
|
487
|
-
applyAiLanguageDirective(aiOutputLang);
|
|
488
|
-
}
|
|
489
|
-
await configureOutputStyle();
|
|
490
|
-
console.log(a.green(`\u2714 ${i18n.t("configuration:configSuccess")} ${CLAUDE_DIR}`));
|
|
491
|
-
console.log(`
|
|
492
|
-
${a.green(i18n.t("common:complete"))}`);
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
const WORKFLOW_CONFIG_BASE = [
|
|
496
|
-
{
|
|
497
|
-
id: "interviewWorkflow",
|
|
498
|
-
defaultSelected: true,
|
|
499
|
-
order: 1,
|
|
500
|
-
commands: ["interview.md"],
|
|
501
|
-
agents: [],
|
|
502
|
-
autoInstallAgents: false,
|
|
503
|
-
category: "interview",
|
|
504
|
-
displayCategory: "planning",
|
|
505
|
-
outputDir: "interview",
|
|
506
|
-
metadata: {
|
|
507
|
-
version: "1.0.0",
|
|
508
|
-
addedDate: "2025-01",
|
|
509
|
-
tags: ["recommended", "popular"],
|
|
510
|
-
difficulty: "beginner"
|
|
511
|
-
}
|
|
512
|
-
},
|
|
513
|
-
{
|
|
514
|
-
id: "essentialTools",
|
|
515
|
-
defaultSelected: true,
|
|
516
|
-
order: 2,
|
|
517
|
-
commands: ["init-project.md", "feat.md"],
|
|
518
|
-
agents: [
|
|
519
|
-
{ id: "init-architect", filename: "init-architect.md", required: true },
|
|
520
|
-
{ id: "get-current-datetime", filename: "get-current-datetime.md", required: true },
|
|
521
|
-
{ id: "planner", filename: "planner.md", required: true },
|
|
522
|
-
{ id: "ui-ux-designer", filename: "ui-ux-designer.md", required: true }
|
|
523
|
-
],
|
|
524
|
-
autoInstallAgents: true,
|
|
525
|
-
category: "essential",
|
|
526
|
-
displayCategory: "planning",
|
|
527
|
-
outputDir: "essential",
|
|
528
|
-
metadata: {
|
|
529
|
-
version: "1.0.0",
|
|
530
|
-
addedDate: "2025-01",
|
|
531
|
-
tags: ["essential"],
|
|
532
|
-
difficulty: "beginner"
|
|
533
|
-
}
|
|
534
|
-
},
|
|
535
|
-
{
|
|
536
|
-
id: "gitWorkflow",
|
|
537
|
-
defaultSelected: true,
|
|
538
|
-
order: 3,
|
|
539
|
-
commands: ["git-commit.md", "git-rollback.md", "git-cleanBranches.md", "git-worktree.md"],
|
|
540
|
-
agents: [],
|
|
541
|
-
autoInstallAgents: false,
|
|
542
|
-
category: "git",
|
|
543
|
-
displayCategory: "versionControl",
|
|
544
|
-
outputDir: "git",
|
|
545
|
-
metadata: {
|
|
546
|
-
version: "1.0.0",
|
|
547
|
-
addedDate: "2025-01",
|
|
548
|
-
tags: ["popular"],
|
|
549
|
-
difficulty: "beginner"
|
|
550
|
-
}
|
|
551
|
-
},
|
|
552
|
-
{
|
|
553
|
-
id: "sixStepsWorkflow",
|
|
554
|
-
defaultSelected: false,
|
|
555
|
-
order: 4,
|
|
556
|
-
commands: ["workflow.md"],
|
|
557
|
-
agents: [],
|
|
558
|
-
autoInstallAgents: false,
|
|
559
|
-
category: "sixStep",
|
|
560
|
-
displayCategory: "development",
|
|
561
|
-
outputDir: "workflow",
|
|
562
|
-
metadata: {
|
|
563
|
-
version: "1.0.0",
|
|
564
|
-
addedDate: "2025-01",
|
|
565
|
-
tags: ["professional"],
|
|
566
|
-
difficulty: "intermediate"
|
|
567
|
-
}
|
|
568
|
-
},
|
|
569
|
-
{
|
|
570
|
-
id: "specFirstTDD",
|
|
571
|
-
defaultSelected: false,
|
|
572
|
-
order: 5,
|
|
573
|
-
commands: ["spec-first-tdd.md"],
|
|
574
|
-
agents: [],
|
|
575
|
-
autoInstallAgents: false,
|
|
576
|
-
category: "specFirstTDD",
|
|
577
|
-
displayCategory: "quality",
|
|
578
|
-
outputDir: "spec-first-tdd",
|
|
579
|
-
metadata: {
|
|
580
|
-
version: "1.0.0",
|
|
581
|
-
addedDate: "2025-02",
|
|
582
|
-
tags: ["professional", "new"],
|
|
583
|
-
difficulty: "advanced"
|
|
584
|
-
}
|
|
585
|
-
},
|
|
586
|
-
{
|
|
587
|
-
id: "continuousDelivery",
|
|
588
|
-
defaultSelected: false,
|
|
589
|
-
order: 6,
|
|
590
|
-
commands: ["continuous-delivery.md"],
|
|
591
|
-
agents: [],
|
|
592
|
-
autoInstallAgents: false,
|
|
593
|
-
category: "continuousDelivery",
|
|
594
|
-
displayCategory: "quality",
|
|
595
|
-
outputDir: "continuous-delivery",
|
|
596
|
-
metadata: {
|
|
597
|
-
version: "1.0.0",
|
|
598
|
-
addedDate: "2025-02",
|
|
599
|
-
tags: ["professional", "new"],
|
|
600
|
-
difficulty: "advanced"
|
|
601
|
-
}
|
|
602
|
-
},
|
|
603
|
-
{
|
|
604
|
-
id: "refactoringMaster",
|
|
605
|
-
defaultSelected: false,
|
|
606
|
-
order: 7,
|
|
607
|
-
commands: ["refactoring-master.md"],
|
|
608
|
-
agents: [],
|
|
609
|
-
autoInstallAgents: false,
|
|
610
|
-
category: "refactoringMaster",
|
|
611
|
-
displayCategory: "quality",
|
|
612
|
-
outputDir: "refactoring-master",
|
|
613
|
-
metadata: {
|
|
614
|
-
version: "1.0.0",
|
|
615
|
-
addedDate: "2025-02",
|
|
616
|
-
tags: ["professional", "new"],
|
|
617
|
-
difficulty: "advanced"
|
|
618
|
-
}
|
|
619
|
-
},
|
|
620
|
-
{
|
|
621
|
-
id: "linearMethod",
|
|
622
|
-
defaultSelected: false,
|
|
623
|
-
order: 8,
|
|
624
|
-
commands: ["linear-method.md"],
|
|
625
|
-
agents: [],
|
|
626
|
-
autoInstallAgents: false,
|
|
627
|
-
category: "linearMethod",
|
|
628
|
-
displayCategory: "planning",
|
|
629
|
-
outputDir: "linear-method",
|
|
630
|
-
metadata: {
|
|
631
|
-
version: "1.0.0",
|
|
632
|
-
addedDate: "2025-02",
|
|
633
|
-
tags: ["new"],
|
|
634
|
-
difficulty: "intermediate"
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
];
|
|
638
|
-
function getWorkflowConfigs() {
|
|
639
|
-
ensureI18nInitialized();
|
|
640
|
-
const workflowTranslations = [
|
|
641
|
-
{
|
|
642
|
-
id: "interviewWorkflow",
|
|
643
|
-
name: i18n.t("workflow:workflowOption.interviewWorkflow"),
|
|
644
|
-
description: i18n.t("workflow:workflowDescription.interviewWorkflow"),
|
|
645
|
-
stats: i18n.t("workflow:workflowStats.interviewWorkflow")
|
|
646
|
-
},
|
|
647
|
-
{
|
|
648
|
-
id: "essentialTools",
|
|
649
|
-
name: i18n.t("workflow:workflowOption.essentialTools"),
|
|
650
|
-
description: i18n.t("workflow:workflowDescription.essentialTools"),
|
|
651
|
-
stats: i18n.t("workflow:workflowStats.essentialTools")
|
|
652
|
-
},
|
|
653
|
-
{
|
|
654
|
-
id: "gitWorkflow",
|
|
655
|
-
name: i18n.t("workflow:workflowOption.gitWorkflow"),
|
|
656
|
-
description: i18n.t("workflow:workflowDescription.gitWorkflow"),
|
|
657
|
-
stats: i18n.t("workflow:workflowStats.gitWorkflow")
|
|
658
|
-
},
|
|
659
|
-
{
|
|
660
|
-
id: "sixStepsWorkflow",
|
|
661
|
-
name: i18n.t("workflow:workflowOption.sixStepsWorkflow"),
|
|
662
|
-
description: i18n.t("workflow:workflowDescription.sixStepsWorkflow"),
|
|
663
|
-
stats: i18n.t("workflow:workflowStats.sixStepsWorkflow")
|
|
664
|
-
},
|
|
665
|
-
{
|
|
666
|
-
id: "specFirstTDD",
|
|
667
|
-
name: i18n.t("workflow:workflowOption.specFirstTDD"),
|
|
668
|
-
description: i18n.t("workflow:workflowDescription.specFirstTDD"),
|
|
669
|
-
stats: i18n.t("workflow:workflowStats.specFirstTDD")
|
|
670
|
-
},
|
|
671
|
-
{
|
|
672
|
-
id: "continuousDelivery",
|
|
673
|
-
name: i18n.t("workflow:workflowOption.continuousDelivery"),
|
|
674
|
-
description: i18n.t("workflow:workflowDescription.continuousDelivery"),
|
|
675
|
-
stats: i18n.t("workflow:workflowStats.continuousDelivery")
|
|
676
|
-
},
|
|
677
|
-
{
|
|
678
|
-
id: "refactoringMaster",
|
|
679
|
-
name: i18n.t("workflow:workflowOption.refactoringMaster"),
|
|
680
|
-
description: i18n.t("workflow:workflowDescription.refactoringMaster"),
|
|
681
|
-
stats: i18n.t("workflow:workflowStats.refactoringMaster")
|
|
682
|
-
},
|
|
683
|
-
{
|
|
684
|
-
id: "linearMethod",
|
|
685
|
-
name: i18n.t("workflow:workflowOption.linearMethod"),
|
|
686
|
-
description: i18n.t("workflow:workflowDescription.linearMethod"),
|
|
687
|
-
stats: i18n.t("workflow:workflowStats.linearMethod")
|
|
688
|
-
}
|
|
689
|
-
];
|
|
690
|
-
return WORKFLOW_CONFIG_BASE.map((baseConfig) => {
|
|
691
|
-
const translation = workflowTranslations.find((t) => t.id === baseConfig.id);
|
|
692
|
-
return {
|
|
693
|
-
...baseConfig,
|
|
694
|
-
name: translation?.name || baseConfig.id,
|
|
695
|
-
description: translation?.description,
|
|
696
|
-
stats: translation?.stats
|
|
697
|
-
};
|
|
698
|
-
});
|
|
699
|
-
}
|
|
700
|
-
function getWorkflowConfig(workflowId) {
|
|
701
|
-
return getWorkflowConfigs().find((config) => config.id === workflowId);
|
|
702
|
-
}
|
|
703
|
-
function getOrderedWorkflows() {
|
|
704
|
-
return getWorkflowConfigs().sort((a, b) => a.order - b.order);
|
|
705
|
-
}
|
|
706
|
-
function getTagLabel(tag) {
|
|
707
|
-
ensureI18nInitialized();
|
|
708
|
-
const tagKeys = {
|
|
709
|
-
recommended: "workflow:tags.recommended",
|
|
710
|
-
popular: "workflow:tags.popular",
|
|
711
|
-
new: "workflow:tags.new",
|
|
712
|
-
essential: "workflow:tags.essential",
|
|
713
|
-
professional: "workflow:tags.professional"
|
|
714
|
-
};
|
|
715
|
-
return i18n.t(tagKeys[tag]);
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
function migrateSettingsForTokenRetrieval() {
|
|
719
|
-
ensureI18nInitialized();
|
|
720
|
-
const result = {
|
|
721
|
-
success: false,
|
|
722
|
-
changes: [],
|
|
723
|
-
backupPath: null,
|
|
724
|
-
errors: []
|
|
725
|
-
};
|
|
726
|
-
try {
|
|
727
|
-
if (!exists(SETTINGS_FILE)) {
|
|
728
|
-
result.errors.push(i18n.t("common:fileNotFound", { file: "settings.json" }));
|
|
729
|
-
return result;
|
|
730
|
-
}
|
|
731
|
-
const settings = readJsonConfig(SETTINGS_FILE);
|
|
732
|
-
if (!settings) {
|
|
733
|
-
result.errors.push(i18n.t("common:failedToReadFile", { file: "settings.json" }));
|
|
734
|
-
return result;
|
|
735
|
-
}
|
|
736
|
-
let modified = false;
|
|
737
|
-
if (settings.env) {
|
|
738
|
-
if ("CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC" in settings.env) {
|
|
739
|
-
delete settings.env.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC;
|
|
740
|
-
result.changes.push("Removed CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC (was blocking token retrieval)");
|
|
741
|
-
modified = true;
|
|
742
|
-
}
|
|
743
|
-
if (settings.env.MCP_TIMEOUT) {
|
|
744
|
-
const timeout = Number.parseInt(settings.env.MCP_TIMEOUT, 10);
|
|
745
|
-
if (!Number.isNaN(timeout) && timeout > 2e4) {
|
|
746
|
-
const oldValue = settings.env.MCP_TIMEOUT;
|
|
747
|
-
settings.env.MCP_TIMEOUT = "15000";
|
|
748
|
-
result.changes.push(`Reduced MCP_TIMEOUT from ${oldValue}ms to 15000ms (was causing slow failures)`);
|
|
749
|
-
modified = true;
|
|
750
|
-
}
|
|
751
|
-
}
|
|
752
|
-
}
|
|
753
|
-
if (!modified) {
|
|
754
|
-
result.success = true;
|
|
755
|
-
return result;
|
|
756
|
-
}
|
|
757
|
-
const backupPath = backupExistingConfig();
|
|
758
|
-
if (backupPath) {
|
|
759
|
-
result.backupPath = backupPath;
|
|
760
|
-
} else {
|
|
761
|
-
result.errors.push("Failed to create backup (continuing anyway)");
|
|
762
|
-
}
|
|
763
|
-
writeJsonConfig(SETTINGS_FILE, settings);
|
|
764
|
-
result.success = true;
|
|
765
|
-
return result;
|
|
766
|
-
} catch (error) {
|
|
767
|
-
result.errors.push(`Migration failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
768
|
-
return result;
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
function needsMigration() {
|
|
772
|
-
try {
|
|
773
|
-
if (!exists(SETTINGS_FILE)) {
|
|
774
|
-
return false;
|
|
775
|
-
}
|
|
776
|
-
const settings = readJsonConfig(SETTINGS_FILE);
|
|
777
|
-
if (!settings || !settings.env) {
|
|
778
|
-
return false;
|
|
779
|
-
}
|
|
780
|
-
const hasProblematicVar = "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC" in settings.env;
|
|
781
|
-
const hasExcessiveTimeout = settings.env.MCP_TIMEOUT && Number.parseInt(settings.env.MCP_TIMEOUT, 10) > 2e4;
|
|
782
|
-
return Boolean(hasProblematicVar || hasExcessiveTimeout);
|
|
783
|
-
} catch {
|
|
784
|
-
return false;
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
function displayMigrationResult(result) {
|
|
788
|
-
ensureI18nInitialized();
|
|
789
|
-
if (result.success) {
|
|
790
|
-
if (result.changes.length > 0) {
|
|
791
|
-
console.log(a.green(`
|
|
792
|
-
\u2705 ${i18n.t("common:configurationFixed")}
|
|
793
|
-
`));
|
|
794
|
-
console.log(a.bold("Changes made:"));
|
|
795
|
-
for (const change of result.changes) {
|
|
796
|
-
console.log(a.gray(` \u2022 ${change}`));
|
|
797
|
-
}
|
|
798
|
-
if (result.backupPath) {
|
|
799
|
-
console.log(a.gray(`
|
|
800
|
-
\u{1F4E6} Backup created: ${result.backupPath}`));
|
|
801
|
-
}
|
|
802
|
-
console.log(a.yellow("\n\u26A0\uFE0F Please restart Claude Code CLI for changes to take effect.\n"));
|
|
803
|
-
} else {
|
|
804
|
-
console.log(a.green(`
|
|
805
|
-
\u2705 ${i18n.t("common:noMigrationNeeded")}
|
|
806
|
-
`));
|
|
807
|
-
}
|
|
808
|
-
} else {
|
|
809
|
-
console.log(a.red(`
|
|
810
|
-
\u274C ${i18n.t("common:migrationFailed")}
|
|
811
|
-
`));
|
|
812
|
-
if (result.errors.length > 0) {
|
|
813
|
-
console.log(a.bold("Errors:"));
|
|
814
|
-
for (const error of result.errors) {
|
|
815
|
-
console.log(a.red(` \u2022 ${error}`));
|
|
816
|
-
}
|
|
817
|
-
}
|
|
818
|
-
if (result.backupPath) {
|
|
819
|
-
console.log(a.gray(`
|
|
820
|
-
\u{1F4E6} Backup available at: ${result.backupPath}`));
|
|
821
|
-
console.log(a.gray("You can restore with: cp <backup-path>/settings.json ~/.claude/settings.json\n"));
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
async function promptMigration() {
|
|
826
|
-
ensureI18nInitialized();
|
|
827
|
-
const inquirer = await import('../chunks/index3.mjs').then(function (n) { return n.c; });
|
|
828
|
-
console.log(a.yellow("\n\u26A0\uFE0F Problematic configuration detected!\n"));
|
|
829
|
-
console.log(a.gray("Your settings.json contains configurations that prevent Claude Code"));
|
|
830
|
-
console.log(a.gray("from retrieving token counts, causing /compact failures.\n"));
|
|
831
|
-
const { shouldMigrate } = await inquirer.default.prompt({
|
|
832
|
-
type: "confirm",
|
|
833
|
-
name: "shouldMigrate",
|
|
834
|
-
message: "Would you like to fix these issues automatically? (backup will be created)",
|
|
835
|
-
default: true
|
|
836
|
-
});
|
|
837
|
-
return shouldMigrate;
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
function getRootDir() {
|
|
841
|
-
const currentFilePath = fileURLToPath(import.meta.url);
|
|
842
|
-
const distDir = dirname(dirname(currentFilePath));
|
|
843
|
-
return dirname(distDir);
|
|
844
|
-
}
|
|
845
|
-
const DEFAULT_CODE_TOOL_TEMPLATE = "claude-code";
|
|
846
|
-
const COMMON_TEMPLATE_CATEGORIES = ["git", "sixStep", "essential", "interview", "specFirstTDD", "continuousDelivery", "refactoringMaster", "linearMethod"];
|
|
847
|
-
function formatTags(tags) {
|
|
848
|
-
const tagColors = {
|
|
849
|
-
recommended: (text) => a.bgGreen.black(` ${text} `),
|
|
850
|
-
popular: (text) => a.bgYellow.black(` ${text} `),
|
|
851
|
-
new: (text) => a.bgCyan.black(` ${text} `),
|
|
852
|
-
essential: (text) => a.bgBlue.white(` ${text} `),
|
|
853
|
-
professional: (text) => a.bgMagenta.white(` ${text} `)
|
|
854
|
-
};
|
|
855
|
-
return tags.map((tag) => tagColors[tag](getTagLabel(tag))).join(" ");
|
|
856
|
-
}
|
|
857
|
-
function buildWorkflowChoice(workflow) {
|
|
858
|
-
const tags = formatTags(workflow.metadata.tags);
|
|
859
|
-
const stats = workflow.stats ? a.dim(workflow.stats) : "";
|
|
860
|
-
const description = workflow.description ? a.gray(workflow.description) : "";
|
|
861
|
-
const nameLine = `${workflow.name} ${tags}`;
|
|
862
|
-
const detailLine = stats ? ` ${stats}` : "";
|
|
863
|
-
const descLine = description ? ` ${description}` : "";
|
|
864
|
-
const displayName = [nameLine, detailLine, descLine].filter(Boolean).join("\n");
|
|
865
|
-
return {
|
|
866
|
-
name: displayName,
|
|
867
|
-
value: workflow.id,
|
|
868
|
-
checked: workflow.defaultSelected
|
|
869
|
-
};
|
|
870
|
-
}
|
|
871
|
-
async function selectAndInstallWorkflows(configLang, preselectedWorkflows) {
|
|
872
|
-
ensureI18nInitialized();
|
|
873
|
-
const workflows = getOrderedWorkflows();
|
|
874
|
-
const choices = workflows.map((workflow) => buildWorkflowChoice(workflow));
|
|
875
|
-
let selectedWorkflows;
|
|
876
|
-
if (preselectedWorkflows) {
|
|
877
|
-
selectedWorkflows = preselectedWorkflows;
|
|
878
|
-
} else {
|
|
879
|
-
console.log("");
|
|
880
|
-
console.log(a.bold.cyan("\u2501".repeat(60)));
|
|
881
|
-
console.log(a.bold.white(` \u{1F680} ${i18n.t("workflow:selectWorkflowType")}`));
|
|
882
|
-
console.log(a.bold.cyan("\u2501".repeat(60)));
|
|
883
|
-
console.log("");
|
|
884
|
-
const response = await inquirer.prompt({
|
|
885
|
-
type: "checkbox",
|
|
886
|
-
name: "selectedWorkflows",
|
|
887
|
-
message: i18n.t("common:multiSelectHint"),
|
|
888
|
-
choices,
|
|
889
|
-
pageSize: 15
|
|
890
|
-
});
|
|
891
|
-
selectedWorkflows = response.selectedWorkflows;
|
|
892
|
-
}
|
|
893
|
-
if (!selectedWorkflows || selectedWorkflows.length === 0) {
|
|
894
|
-
console.log(a.yellow(i18n.t("common:cancelled")));
|
|
895
|
-
return;
|
|
896
|
-
}
|
|
897
|
-
await cleanupOldVersionFiles();
|
|
898
|
-
for (const workflowId of selectedWorkflows) {
|
|
899
|
-
const config = getWorkflowConfig(workflowId);
|
|
900
|
-
if (config) {
|
|
901
|
-
await installWorkflowWithDependencies(config, configLang);
|
|
902
|
-
}
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
async function installWorkflowWithDependencies(config, configLang) {
|
|
906
|
-
const rootDir = getRootDir();
|
|
907
|
-
ensureI18nInitialized();
|
|
908
|
-
const result = {
|
|
909
|
-
workflow: config.id,
|
|
910
|
-
success: true,
|
|
911
|
-
installedCommands: [],
|
|
912
|
-
installedAgents: [],
|
|
913
|
-
errors: []
|
|
914
|
-
};
|
|
915
|
-
const WORKFLOW_OPTION_KEYS = {
|
|
916
|
-
essentialTools: i18n.t("workflow:workflowOption.essentialTools"),
|
|
917
|
-
sixStepsWorkflow: i18n.t("workflow:workflowOption.sixStepsWorkflow"),
|
|
918
|
-
gitWorkflow: i18n.t("workflow:workflowOption.gitWorkflow"),
|
|
919
|
-
interviewWorkflow: i18n.t("workflow:workflowOption.interviewWorkflow"),
|
|
920
|
-
specFirstTDD: i18n.t("workflow:workflowOption.specFirstTDD"),
|
|
921
|
-
continuousDelivery: i18n.t("workflow:workflowOption.continuousDelivery"),
|
|
922
|
-
refactoringMaster: i18n.t("workflow:workflowOption.refactoringMaster"),
|
|
923
|
-
linearMethod: i18n.t("workflow:workflowOption.linearMethod")
|
|
924
|
-
};
|
|
925
|
-
const workflowName = WORKFLOW_OPTION_KEYS[config.id] || config.id;
|
|
926
|
-
console.log(a.green(`
|
|
927
|
-
\u{1F4E6} ${i18n.t("workflow:installingWorkflow")}: ${workflowName}...`));
|
|
928
|
-
const commandsDir = join(CLAUDE_DIR, "commands", "ccjk");
|
|
929
|
-
if (!existsSync(commandsDir)) {
|
|
930
|
-
await mkdir(commandsDir, { recursive: true });
|
|
931
|
-
}
|
|
932
|
-
for (const commandFile of config.commands) {
|
|
933
|
-
const isCommonTemplate = COMMON_TEMPLATE_CATEGORIES.includes(config.category);
|
|
934
|
-
const commandSource = isCommonTemplate ? join(
|
|
935
|
-
rootDir,
|
|
936
|
-
"templates",
|
|
937
|
-
"common",
|
|
938
|
-
"workflow",
|
|
939
|
-
config.category,
|
|
940
|
-
configLang,
|
|
941
|
-
commandFile
|
|
942
|
-
) : join(
|
|
943
|
-
rootDir,
|
|
944
|
-
"templates",
|
|
945
|
-
DEFAULT_CODE_TOOL_TEMPLATE,
|
|
946
|
-
configLang,
|
|
947
|
-
"workflow",
|
|
948
|
-
config.category,
|
|
949
|
-
"commands",
|
|
950
|
-
commandFile
|
|
951
|
-
);
|
|
952
|
-
const destFileName = commandFile;
|
|
953
|
-
const commandDest = join(commandsDir, destFileName);
|
|
954
|
-
if (existsSync(commandSource)) {
|
|
955
|
-
try {
|
|
956
|
-
await copyFile$1(commandSource, commandDest);
|
|
957
|
-
result.installedCommands.push(destFileName);
|
|
958
|
-
console.log(a.gray(` \u2714 ${i18n.t("workflow:installedCommand")}: ccjk/${destFileName}`));
|
|
959
|
-
} catch (error) {
|
|
960
|
-
const errorMsg = `${i18n.t("workflow:failedToInstallCommand")} ${commandFile}: ${error}`;
|
|
961
|
-
result.errors?.push(errorMsg);
|
|
962
|
-
console.error(a.red(` \u2717 ${errorMsg}`));
|
|
963
|
-
result.success = false;
|
|
964
|
-
}
|
|
965
|
-
}
|
|
966
|
-
}
|
|
967
|
-
if (config.autoInstallAgents && config.agents.length > 0) {
|
|
968
|
-
const agentsCategoryDir = join(CLAUDE_DIR, "agents", "ccjk", config.category);
|
|
969
|
-
if (!existsSync(agentsCategoryDir)) {
|
|
970
|
-
await mkdir(agentsCategoryDir, { recursive: true });
|
|
971
|
-
}
|
|
972
|
-
for (const agent of config.agents) {
|
|
973
|
-
const isCommonTemplate = COMMON_TEMPLATE_CATEGORIES.includes(config.category);
|
|
974
|
-
const agentSource = isCommonTemplate ? join(
|
|
975
|
-
rootDir,
|
|
976
|
-
"templates",
|
|
977
|
-
"common",
|
|
978
|
-
"workflow",
|
|
979
|
-
config.category,
|
|
980
|
-
configLang,
|
|
981
|
-
"agents",
|
|
982
|
-
agent.filename
|
|
983
|
-
) : join(
|
|
984
|
-
rootDir,
|
|
985
|
-
"templates",
|
|
986
|
-
DEFAULT_CODE_TOOL_TEMPLATE,
|
|
987
|
-
configLang,
|
|
988
|
-
"workflow",
|
|
989
|
-
config.category,
|
|
990
|
-
"agents",
|
|
991
|
-
agent.filename
|
|
992
|
-
);
|
|
993
|
-
const agentDest = join(agentsCategoryDir, agent.filename);
|
|
994
|
-
if (existsSync(agentSource)) {
|
|
995
|
-
try {
|
|
996
|
-
await copyFile$1(agentSource, agentDest);
|
|
997
|
-
result.installedAgents.push(agent.filename);
|
|
998
|
-
console.log(a.gray(` \u2714 ${i18n.t("workflow:installedAgent")}: ccjk/${config.category}/${agent.filename}`));
|
|
999
|
-
} catch (error) {
|
|
1000
|
-
const errorMsg = `${i18n.t("workflow:failedToInstallAgent")} ${agent.filename}: ${error}`;
|
|
1001
|
-
result.errors?.push(errorMsg);
|
|
1002
|
-
console.error(a.red(` \u2717 ${errorMsg}`));
|
|
1003
|
-
if (agent.required) {
|
|
1004
|
-
result.success = false;
|
|
1005
|
-
}
|
|
1006
|
-
}
|
|
1007
|
-
}
|
|
1008
|
-
}
|
|
1009
|
-
}
|
|
1010
|
-
if (result.success) {
|
|
1011
|
-
console.log(a.green(`\u2714 ${workflowName} ${i18n.t("workflow:workflowInstallSuccess")}`));
|
|
1012
|
-
} else {
|
|
1013
|
-
console.log(a.red(`\u2717 ${workflowName} ${i18n.t("workflow:workflowInstallError")}`));
|
|
1014
|
-
}
|
|
1015
|
-
return result;
|
|
1016
|
-
}
|
|
1017
|
-
async function cleanupOldVersionFiles() {
|
|
1018
|
-
ensureI18nInitialized();
|
|
1019
|
-
console.log(a.green(`
|
|
1020
|
-
\u{1F9F9} ${i18n.t("workflow:cleaningOldFiles")}...`));
|
|
1021
|
-
const oldCommandFiles = [
|
|
1022
|
-
join(CLAUDE_DIR, "commands", "workflow.md"),
|
|
1023
|
-
join(CLAUDE_DIR, "commands", "feat.md")
|
|
1024
|
-
];
|
|
1025
|
-
const oldAgentFiles = [
|
|
1026
|
-
join(CLAUDE_DIR, "agents", "planner.md"),
|
|
1027
|
-
join(CLAUDE_DIR, "agents", "ui-ux-designer.md")
|
|
1028
|
-
];
|
|
1029
|
-
for (const file of oldCommandFiles) {
|
|
1030
|
-
if (existsSync(file)) {
|
|
1031
|
-
try {
|
|
1032
|
-
await rm(file, { force: true });
|
|
1033
|
-
console.log(a.gray(` \u2714 ${i18n.t("workflow:removedOldFile")}: ${file.replace(CLAUDE_DIR, "~/.claude")}`));
|
|
1034
|
-
} catch {
|
|
1035
|
-
console.error(a.yellow(` \u26A0 ${i18n.t("errors:failedToRemoveFile")}: ${file.replace(CLAUDE_DIR, "~/.claude")}`));
|
|
1036
|
-
}
|
|
1037
|
-
}
|
|
1038
|
-
}
|
|
1039
|
-
for (const file of oldAgentFiles) {
|
|
1040
|
-
if (existsSync(file)) {
|
|
1041
|
-
try {
|
|
1042
|
-
await rm(file, { force: true });
|
|
1043
|
-
console.log(a.gray(` \u2714 ${i18n.t("workflow:removedOldFile")}: ${file.replace(CLAUDE_DIR, "~/.claude")}`));
|
|
1044
|
-
} catch {
|
|
1045
|
-
console.error(a.yellow(` \u26A0 ${i18n.t("errors:failedToRemoveFile")}: ${file.replace(CLAUDE_DIR, "~/.claude")}`));
|
|
1046
|
-
}
|
|
1047
|
-
}
|
|
1048
|
-
}
|
|
1049
|
-
}
|
|
1050
|
-
|
|
1051
|
-
export { WORKFLOW_CONFIG_BASE as W, modifyApiConfigPartially as a, configureApiCompletely as b, configureOutputStyle as c, displayMigrationResult as d, formatApiKeyDisplay as f, migrateSettingsForTokenRetrieval as m, needsMigration as n, promptMigration as p, selectAndInstallWorkflows as s, updatePromptOnly as u, validateApiKey as v };
|