ccjk 9.6.1 → 9.8.0

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.
Files changed (56) hide show
  1. package/dist/chunks/boost.mjs +246 -7
  2. package/dist/chunks/ccjk-mcp.mjs +1 -1
  3. package/dist/chunks/ccr.mjs +25 -28
  4. package/dist/chunks/check-updates.mjs +4 -3
  5. package/dist/chunks/claude-code-config-manager.mjs +1 -1
  6. package/dist/chunks/claude-code-incremental-manager.mjs +1 -1
  7. package/dist/chunks/claude-config.mjs +1 -1
  8. package/dist/chunks/codex-config-switch.mjs +3 -4
  9. package/dist/chunks/codex-provider-manager.mjs +1 -2
  10. package/dist/chunks/codex.mjs +204 -3
  11. package/dist/chunks/config-switch.mjs +2 -3
  12. package/dist/chunks/config.mjs +1 -1
  13. package/dist/chunks/doctor.mjs +1 -1
  14. package/dist/chunks/features.mjs +24 -15
  15. package/dist/chunks/hook-installer.mjs +44 -0
  16. package/dist/chunks/index3.mjs +32 -32
  17. package/dist/chunks/init.mjs +129 -87
  18. package/dist/chunks/installer2.mjs +1 -1
  19. package/dist/chunks/interview.mjs +1 -1
  20. package/dist/chunks/mcp.mjs +1058 -17
  21. package/dist/chunks/menu.mjs +140 -56
  22. package/dist/chunks/package.mjs +2 -210
  23. package/dist/chunks/platform.mjs +1 -1
  24. package/dist/chunks/quick-setup.mjs +35 -18
  25. package/dist/chunks/simple-config.mjs +1 -1
  26. package/dist/{shared/ccjk.q1koQxEE.mjs → chunks/smart-defaults.mjs} +77 -79
  27. package/dist/chunks/status.mjs +208 -101
  28. package/dist/chunks/thinking.mjs +1 -1
  29. package/dist/chunks/uninstall.mjs +6 -4
  30. package/dist/chunks/update.mjs +4 -7
  31. package/dist/chunks/version-checker.mjs +1 -1
  32. package/dist/cli.mjs +4 -80
  33. package/dist/index.d.mts +17 -1482
  34. package/dist/index.d.ts +17 -1482
  35. package/dist/index.mjs +12 -4191
  36. package/dist/shared/{ccjk.CSkyCZIM.mjs → ccjk.Bndhan7G.mjs} +4 -242
  37. package/dist/shared/ccjk.CeE8RLG2.mjs +62 -0
  38. package/dist/shared/ccjk.DKojSRzw.mjs +266 -0
  39. package/dist/shared/{ccjk.CItD1fpl.mjs → ccjk.DvIrK0wz.mjs} +1 -1
  40. package/dist/shared/ccjk.LsPZ2PYo.mjs +1048 -0
  41. package/package.json +1 -1
  42. package/dist/chunks/api-adapter.mjs +0 -180
  43. package/dist/chunks/cli.mjs +0 -2227
  44. package/dist/chunks/context-menu.mjs +0 -913
  45. package/dist/chunks/hooks-sync.mjs +0 -1627
  46. package/dist/chunks/mcp-market.mjs +0 -1077
  47. package/dist/chunks/mcp-server.mjs +0 -776
  48. package/dist/chunks/project-detector.mjs +0 -131
  49. package/dist/chunks/provider-registry.mjs +0 -92
  50. package/dist/chunks/setup-wizard.mjs +0 -362
  51. package/dist/chunks/tools.mjs +0 -143
  52. package/dist/chunks/workflows2.mjs +0 -232
  53. package/dist/shared/ccjk.C0pb50xH.mjs +0 -347
  54. package/dist/shared/ccjk.ChMkBmdL.mjs +0 -490
  55. package/dist/shared/ccjk.CtSfXUSh.mjs +0 -209
  56. package/dist/shared/ccjk.xfAjmbJp.mjs +0 -75
@@ -1,347 +0,0 @@
1
- import ansis from 'ansis';
2
- import { SETTINGS_FILE, CLAUDE_DIR } from '../chunks/constants.mjs';
3
- import { ensureI18nInitialized, i18n } from '../chunks/index.mjs';
4
- import { b as backupExistingConfig } from '../chunks/config.mjs';
5
- import { exists } from '../chunks/fs-operations.mjs';
6
- import { readJsonConfig, writeJsonConfig } from '../chunks/json-config.mjs';
7
- import { existsSync } from 'node:fs';
8
- import { rm, mkdir, copyFile } from 'node:fs/promises';
9
- import { fileURLToPath } from 'node:url';
10
- import inquirer from 'inquirer';
11
- import { join, dirname } from 'pathe';
12
- import { getOrderedWorkflows, getWorkflowConfig, getTagLabel } from '../chunks/workflows2.mjs';
13
-
14
- function migrateSettingsForTokenRetrieval() {
15
- ensureI18nInitialized();
16
- const result = {
17
- success: false,
18
- changes: [],
19
- backupPath: null,
20
- errors: []
21
- };
22
- try {
23
- if (!exists(SETTINGS_FILE)) {
24
- result.errors.push(i18n.t("common:fileNotFound", { file: "settings.json" }));
25
- return result;
26
- }
27
- const settings = readJsonConfig(SETTINGS_FILE);
28
- if (!settings) {
29
- result.errors.push(i18n.t("common:failedToReadFile", { file: "settings.json" }));
30
- return result;
31
- }
32
- let modified = false;
33
- if (settings.env) {
34
- if ("CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC" in settings.env) {
35
- delete settings.env.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC;
36
- result.changes.push("Removed CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC (was blocking token retrieval)");
37
- modified = true;
38
- }
39
- if (settings.env.MCP_TIMEOUT) {
40
- const timeout = Number.parseInt(settings.env.MCP_TIMEOUT, 10);
41
- if (!Number.isNaN(timeout) && timeout > 2e4) {
42
- const oldValue = settings.env.MCP_TIMEOUT;
43
- settings.env.MCP_TIMEOUT = "15000";
44
- result.changes.push(`Reduced MCP_TIMEOUT from ${oldValue}ms to 15000ms (was causing slow failures)`);
45
- modified = true;
46
- }
47
- }
48
- }
49
- if (!modified) {
50
- result.success = true;
51
- return result;
52
- }
53
- const backupPath = backupExistingConfig();
54
- if (backupPath) {
55
- result.backupPath = backupPath;
56
- } else {
57
- result.errors.push("Failed to create backup (continuing anyway)");
58
- }
59
- writeJsonConfig(SETTINGS_FILE, settings);
60
- result.success = true;
61
- return result;
62
- } catch (error) {
63
- result.errors.push(`Migration failed: ${error instanceof Error ? error.message : String(error)}`);
64
- return result;
65
- }
66
- }
67
- function needsMigration() {
68
- try {
69
- if (!exists(SETTINGS_FILE)) {
70
- return false;
71
- }
72
- const settings = readJsonConfig(SETTINGS_FILE);
73
- if (!settings || !settings.env) {
74
- return false;
75
- }
76
- const hasProblematicVar = "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC" in settings.env;
77
- const hasExcessiveTimeout = settings.env.MCP_TIMEOUT && Number.parseInt(settings.env.MCP_TIMEOUT, 10) > 2e4;
78
- return Boolean(hasProblematicVar || hasExcessiveTimeout);
79
- } catch {
80
- return false;
81
- }
82
- }
83
- function displayMigrationResult(result) {
84
- ensureI18nInitialized();
85
- if (result.success) {
86
- if (result.changes.length > 0) {
87
- console.log(ansis.green(`
88
- \u2705 ${i18n.t("common:configurationFixed")}
89
- `));
90
- console.log(ansis.bold("Changes made:"));
91
- for (const change of result.changes) {
92
- console.log(ansis.gray(` \u2022 ${change}`));
93
- }
94
- if (result.backupPath) {
95
- console.log(ansis.gray(`
96
- \u{1F4E6} Backup created: ${result.backupPath}`));
97
- }
98
- console.log(ansis.yellow("\n\u26A0\uFE0F Please restart Claude Code CLI for changes to take effect.\n"));
99
- } else {
100
- console.log(ansis.green(`
101
- \u2705 ${i18n.t("common:noMigrationNeeded")}
102
- `));
103
- }
104
- } else {
105
- console.log(ansis.red(`
106
- \u274C ${i18n.t("common:migrationFailed")}
107
- `));
108
- if (result.errors.length > 0) {
109
- console.log(ansis.bold("Errors:"));
110
- for (const error of result.errors) {
111
- console.log(ansis.red(` \u2022 ${error}`));
112
- }
113
- }
114
- if (result.backupPath) {
115
- console.log(ansis.gray(`
116
- \u{1F4E6} Backup available at: ${result.backupPath}`));
117
- console.log(ansis.gray("You can restore with: cp <backup-path>/settings.json ~/.claude/settings.json\n"));
118
- }
119
- }
120
- }
121
- async function promptMigration() {
122
- ensureI18nInitialized();
123
- const inquirer = await import('inquirer');
124
- console.log(ansis.yellow("\n\u26A0\uFE0F Problematic configuration detected!\n"));
125
- console.log(ansis.gray("Your settings.json contains configurations that prevent Claude Code"));
126
- console.log(ansis.gray("from retrieving token counts, causing /compact failures.\n"));
127
- const { shouldMigrate } = await inquirer.default.prompt({
128
- type: "confirm",
129
- name: "shouldMigrate",
130
- message: "Would you like to fix these issues automatically? (backup will be created)",
131
- default: true
132
- });
133
- return shouldMigrate;
134
- }
135
-
136
- function getRootDir() {
137
- const currentFilePath = fileURLToPath(import.meta.url);
138
- const distDir = dirname(dirname(currentFilePath));
139
- return dirname(distDir);
140
- }
141
- const DEFAULT_CODE_TOOL_TEMPLATE = "claude-code";
142
- const COMMON_TEMPLATE_CATEGORIES = ["git", "sixStep", "essential", "interview", "specFirstTDD", "continuousDelivery", "refactoringMaster", "linearMethod"];
143
- function formatTags(tags) {
144
- const tagColors = {
145
- recommended: (text) => ansis.bgGreen.black(` ${text} `),
146
- popular: (text) => ansis.bgYellow.black(` ${text} `),
147
- new: (text) => ansis.bgCyan.black(` ${text} `),
148
- essential: (text) => ansis.bgBlue.white(` ${text} `),
149
- professional: (text) => ansis.bgMagenta.white(` ${text} `)
150
- };
151
- return tags.map((tag) => tagColors[tag](getTagLabel(tag))).join(" ");
152
- }
153
- function buildWorkflowChoice(workflow) {
154
- const tags = formatTags(workflow.metadata.tags);
155
- const stats = workflow.stats ? ansis.dim(workflow.stats) : "";
156
- const description = workflow.description ? ansis.gray(workflow.description) : "";
157
- const nameLine = `${workflow.name} ${tags}`;
158
- const detailLine = stats ? ` ${stats}` : "";
159
- const descLine = description ? ` ${description}` : "";
160
- const displayName = [nameLine, detailLine, descLine].filter(Boolean).join("\n");
161
- return {
162
- name: displayName,
163
- value: workflow.id,
164
- checked: workflow.defaultSelected
165
- };
166
- }
167
- async function selectAndInstallWorkflows(configLang, preselectedWorkflows) {
168
- ensureI18nInitialized();
169
- const workflows = getOrderedWorkflows();
170
- const choices = workflows.map((workflow) => buildWorkflowChoice(workflow));
171
- let selectedWorkflows;
172
- if (preselectedWorkflows) {
173
- selectedWorkflows = preselectedWorkflows;
174
- } else {
175
- console.log("");
176
- console.log(ansis.bold.cyan("\u2501".repeat(60)));
177
- console.log(ansis.bold.white(` \u{1F680} ${i18n.t("workflow:selectWorkflowType")}`));
178
- console.log(ansis.bold.cyan("\u2501".repeat(60)));
179
- console.log("");
180
- const response = await inquirer.prompt({
181
- type: "checkbox",
182
- name: "selectedWorkflows",
183
- message: i18n.t("common:multiSelectHint"),
184
- choices,
185
- pageSize: 15
186
- });
187
- selectedWorkflows = response.selectedWorkflows;
188
- }
189
- if (!selectedWorkflows || selectedWorkflows.length === 0) {
190
- console.log(ansis.yellow(i18n.t("common:cancelled")));
191
- return;
192
- }
193
- await cleanupOldVersionFiles();
194
- for (const workflowId of selectedWorkflows) {
195
- const config = getWorkflowConfig(workflowId);
196
- if (config) {
197
- await installWorkflowWithDependencies(config, configLang);
198
- }
199
- }
200
- }
201
- async function installWorkflowWithDependencies(config, configLang) {
202
- const rootDir = getRootDir();
203
- ensureI18nInitialized();
204
- const result = {
205
- workflow: config.id,
206
- success: true,
207
- installedCommands: [],
208
- installedAgents: [],
209
- errors: []
210
- };
211
- const WORKFLOW_OPTION_KEYS = {
212
- essentialTools: i18n.t("workflow:workflowOption.essentialTools"),
213
- sixStepsWorkflow: i18n.t("workflow:workflowOption.sixStepsWorkflow"),
214
- gitWorkflow: i18n.t("workflow:workflowOption.gitWorkflow"),
215
- interviewWorkflow: i18n.t("workflow:workflowOption.interviewWorkflow"),
216
- specFirstTDD: i18n.t("workflow:workflowOption.specFirstTDD"),
217
- continuousDelivery: i18n.t("workflow:workflowOption.continuousDelivery"),
218
- refactoringMaster: i18n.t("workflow:workflowOption.refactoringMaster"),
219
- linearMethod: i18n.t("workflow:workflowOption.linearMethod")
220
- };
221
- const workflowName = WORKFLOW_OPTION_KEYS[config.id] || config.id;
222
- console.log(ansis.green(`
223
- \u{1F4E6} ${i18n.t("workflow:installingWorkflow")}: ${workflowName}...`));
224
- const commandsDir = join(CLAUDE_DIR, "commands", "ccjk");
225
- if (!existsSync(commandsDir)) {
226
- await mkdir(commandsDir, { recursive: true });
227
- }
228
- for (const commandFile of config.commands) {
229
- const isCommonTemplate = COMMON_TEMPLATE_CATEGORIES.includes(config.category);
230
- const commandSource = isCommonTemplate ? join(
231
- rootDir,
232
- "templates",
233
- "common",
234
- "workflow",
235
- config.category,
236
- configLang,
237
- commandFile
238
- ) : join(
239
- rootDir,
240
- "templates",
241
- DEFAULT_CODE_TOOL_TEMPLATE,
242
- configLang,
243
- "workflow",
244
- config.category,
245
- "commands",
246
- commandFile
247
- );
248
- const destFileName = commandFile;
249
- const commandDest = join(commandsDir, destFileName);
250
- if (existsSync(commandSource)) {
251
- try {
252
- await copyFile(commandSource, commandDest);
253
- result.installedCommands.push(destFileName);
254
- console.log(ansis.gray(` \u2714 ${i18n.t("workflow:installedCommand")}: ccjk/${destFileName}`));
255
- } catch (error) {
256
- const errorMsg = `${i18n.t("workflow:failedToInstallCommand")} ${commandFile}: ${error}`;
257
- result.errors?.push(errorMsg);
258
- console.error(ansis.red(` \u2717 ${errorMsg}`));
259
- result.success = false;
260
- }
261
- }
262
- }
263
- if (config.autoInstallAgents && config.agents.length > 0) {
264
- const agentsCategoryDir = join(CLAUDE_DIR, "agents", "ccjk", config.category);
265
- if (!existsSync(agentsCategoryDir)) {
266
- await mkdir(agentsCategoryDir, { recursive: true });
267
- }
268
- for (const agent of config.agents) {
269
- const isCommonTemplate = COMMON_TEMPLATE_CATEGORIES.includes(config.category);
270
- const agentSource = isCommonTemplate ? join(
271
- rootDir,
272
- "templates",
273
- "common",
274
- "workflow",
275
- config.category,
276
- configLang,
277
- "agents",
278
- agent.filename
279
- ) : join(
280
- rootDir,
281
- "templates",
282
- DEFAULT_CODE_TOOL_TEMPLATE,
283
- configLang,
284
- "workflow",
285
- config.category,
286
- "agents",
287
- agent.filename
288
- );
289
- const agentDest = join(agentsCategoryDir, agent.filename);
290
- if (existsSync(agentSource)) {
291
- try {
292
- await copyFile(agentSource, agentDest);
293
- result.installedAgents.push(agent.filename);
294
- console.log(ansis.gray(` \u2714 ${i18n.t("workflow:installedAgent")}: ccjk/${config.category}/${agent.filename}`));
295
- } catch (error) {
296
- const errorMsg = `${i18n.t("workflow:failedToInstallAgent")} ${agent.filename}: ${error}`;
297
- result.errors?.push(errorMsg);
298
- console.error(ansis.red(` \u2717 ${errorMsg}`));
299
- if (agent.required) {
300
- result.success = false;
301
- }
302
- }
303
- }
304
- }
305
- }
306
- if (result.success) {
307
- console.log(ansis.green(`\u2714 ${workflowName} ${i18n.t("workflow:workflowInstallSuccess")}`));
308
- } else {
309
- console.log(ansis.red(`\u2717 ${workflowName} ${i18n.t("workflow:workflowInstallError")}`));
310
- }
311
- return result;
312
- }
313
- async function cleanupOldVersionFiles() {
314
- ensureI18nInitialized();
315
- console.log(ansis.green(`
316
- \u{1F9F9} ${i18n.t("workflow:cleaningOldFiles")}...`));
317
- const oldCommandFiles = [
318
- join(CLAUDE_DIR, "commands", "workflow.md"),
319
- join(CLAUDE_DIR, "commands", "feat.md")
320
- ];
321
- const oldAgentFiles = [
322
- join(CLAUDE_DIR, "agents", "planner.md"),
323
- join(CLAUDE_DIR, "agents", "ui-ux-designer.md")
324
- ];
325
- for (const file of oldCommandFiles) {
326
- if (existsSync(file)) {
327
- try {
328
- await rm(file, { force: true });
329
- console.log(ansis.gray(` \u2714 ${i18n.t("workflow:removedOldFile")}: ${file.replace(CLAUDE_DIR, "~/.claude")}`));
330
- } catch {
331
- console.error(ansis.yellow(` \u26A0 ${i18n.t("errors:failedToRemoveFile")}: ${file.replace(CLAUDE_DIR, "~/.claude")}`));
332
- }
333
- }
334
- }
335
- for (const file of oldAgentFiles) {
336
- if (existsSync(file)) {
337
- try {
338
- await rm(file, { force: true });
339
- console.log(ansis.gray(` \u2714 ${i18n.t("workflow:removedOldFile")}: ${file.replace(CLAUDE_DIR, "~/.claude")}`));
340
- } catch {
341
- console.error(ansis.yellow(` \u26A0 ${i18n.t("errors:failedToRemoveFile")}: ${file.replace(CLAUDE_DIR, "~/.claude")}`));
342
- }
343
- }
344
- }
345
- }
346
-
347
- export { displayMigrationResult as d, migrateSettingsForTokenRetrieval as m, needsMigration as n, promptMigration as p, selectAndInstallWorkflows as s };