ccjk 12.3.5 → 13.3.2

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.
@@ -1,7 +1,7 @@
1
1
  import a from './index3.mjs';
2
2
  import { i18n } from './index6.mjs';
3
3
  import { d as configureApi, g as getExistingApiConfig } from './config.mjs';
4
- import { g as getAllPresets } from '../shared/ccjk.CL4Yat0G.mjs';
4
+ import { g as getAllPresets } from '../shared/ccjk.DopKzo3z.mjs';
5
5
  import '../shared/ccjk.BAGoDD49.mjs';
6
6
  import 'node:fs';
7
7
  import 'node:process';
@@ -1,8 +1,8 @@
1
1
  import a from './index3.mjs';
2
2
  import { i18n, format } from './index6.mjs';
3
3
  import { STATUS, COLORS as theme } from './banner.mjs';
4
- import { r as runConfigWizard, t as testApiConnection, d as displayCurrentStatus, q as quickSetup } from '../shared/ccjk.DfXjf8EC.mjs';
5
- import { g as getAllPresets } from '../shared/ccjk.CL4Yat0G.mjs';
4
+ import { r as runConfigWizard, t as testApiConnection, d as displayCurrentStatus, q as quickSetup } from '../shared/ccjk.Cwa_FiTX.mjs';
5
+ import { g as getAllPresets } from '../shared/ccjk.DopKzo3z.mjs';
6
6
  import '../shared/ccjk.BAGoDD49.mjs';
7
7
  import 'node:fs';
8
8
  import 'node:process';
@@ -0,0 +1,148 @@
1
+ import { existsSync, readFileSync, writeFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { homedir } from 'node:os';
4
+
5
+ async function detectSettingsIssues() {
6
+ const issues = [];
7
+ const settingsPath = join(homedir(), ".claude", "settings.json");
8
+ if (!existsSync(settingsPath)) {
9
+ issues.push({
10
+ type: "missing",
11
+ severity: "critical",
12
+ description: "settings.json not found",
13
+ fix: async () => {
14
+ try {
15
+ const { init } = await import('./init.mjs').then(function (n) { return n.c; });
16
+ await init({ silent: true, skipPrompt: true });
17
+ return true;
18
+ } catch {
19
+ return false;
20
+ }
21
+ }
22
+ });
23
+ return issues;
24
+ }
25
+ try {
26
+ const content = readFileSync(settingsPath, "utf-8");
27
+ const settings = JSON.parse(content);
28
+ if (!settings.apiType) {
29
+ issues.push({
30
+ type: "invalid",
31
+ severity: "critical",
32
+ description: "Missing apiType in settings.json",
33
+ fix: async () => {
34
+ settings.apiType = "anthropic";
35
+ writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
36
+ return true;
37
+ }
38
+ });
39
+ }
40
+ if (!settings.apiKey && !process.env.ANTHROPIC_API_KEY) {
41
+ issues.push({
42
+ type: "missing",
43
+ severity: "warning",
44
+ description: "No API key configured",
45
+ fix: async () => {
46
+ console.log("\u26A0\uFE0F Please run: ccjk init --api-key YOUR_KEY");
47
+ return false;
48
+ }
49
+ });
50
+ }
51
+ } catch (error) {
52
+ issues.push({
53
+ type: "invalid",
54
+ severity: "critical",
55
+ description: "Invalid JSON format in settings.json",
56
+ fix: async () => {
57
+ try {
58
+ const backupPath = `${settingsPath}.backup`;
59
+ const content = readFileSync(settingsPath, "utf-8");
60
+ writeFileSync(backupPath, content);
61
+ const { init } = await import('./init.mjs').then(function (n) { return n.c; });
62
+ await init({ silent: true, skipPrompt: true, force: true });
63
+ return true;
64
+ } catch {
65
+ return false;
66
+ }
67
+ }
68
+ });
69
+ }
70
+ return issues;
71
+ }
72
+ async function detectMcpIssues() {
73
+ const issues = [];
74
+ const mcpConfigPath = join(homedir(), ".claude", "mcp_settings.json");
75
+ if (!existsSync(mcpConfigPath)) {
76
+ return issues;
77
+ }
78
+ try {
79
+ const content = readFileSync(mcpConfigPath, "utf-8");
80
+ JSON.parse(content);
81
+ } catch {
82
+ issues.push({
83
+ type: "invalid",
84
+ severity: "warning",
85
+ description: "Invalid MCP configuration",
86
+ fix: async () => {
87
+ try {
88
+ const backupPath = `${mcpConfigPath}.backup`;
89
+ const content = readFileSync(mcpConfigPath, "utf-8");
90
+ writeFileSync(backupPath, content);
91
+ writeFileSync(mcpConfigPath, JSON.stringify({ mcpServers: {} }, null, 2));
92
+ return true;
93
+ } catch {
94
+ return false;
95
+ }
96
+ }
97
+ });
98
+ }
99
+ return issues;
100
+ }
101
+ async function autoFixAll(silent = true) {
102
+ const allIssues = [
103
+ ...await detectSettingsIssues(),
104
+ ...await detectMcpIssues()
105
+ ];
106
+ let fixed = 0;
107
+ let failed = 0;
108
+ for (const issue of allIssues) {
109
+ if (issue.severity === "info") {
110
+ continue;
111
+ }
112
+ if (!silent) {
113
+ console.log(`\u{1F527} Fixing: ${issue.description}`);
114
+ }
115
+ try {
116
+ const success = await issue.fix();
117
+ if (success) {
118
+ fixed++;
119
+ if (!silent) {
120
+ console.log(` \u2705 Fixed`);
121
+ }
122
+ } else {
123
+ failed++;
124
+ if (!silent) {
125
+ console.log(` \u274C Failed`);
126
+ }
127
+ }
128
+ } catch (error) {
129
+ failed++;
130
+ if (!silent) {
131
+ console.log(` \u274C Error: ${error}`);
132
+ }
133
+ }
134
+ }
135
+ return {
136
+ fixed,
137
+ failed,
138
+ total: allIssues.length
139
+ };
140
+ }
141
+ async function runAutoFixOnStartup() {
142
+ try {
143
+ await autoFixAll(true);
144
+ } catch {
145
+ }
146
+ }
147
+
148
+ export { autoFixAll, detectMcpIssues, detectSettingsIssues, runAutoFixOnStartup };
@@ -0,0 +1,150 @@
1
+ import { execSync } from 'node:child_process';
2
+ import { existsSync, readFileSync, writeFileSync } from 'node:fs';
3
+ import { join } from 'node:path';
4
+ import { homedir } from 'node:os';
5
+
6
+ function getCurrentVersion() {
7
+ try {
8
+ const packagePath = join(__dirname, "../../package.json");
9
+ const pkg = JSON.parse(readFileSync(packagePath, "utf-8"));
10
+ return pkg.version;
11
+ } catch {
12
+ return "0.0.0";
13
+ }
14
+ }
15
+ async function getLatestVersion() {
16
+ try {
17
+ const result = execSync("npm view @cometx/ccjk version", {
18
+ encoding: "utf-8",
19
+ timeout: 3e3,
20
+ stdio: ["pipe", "pipe", "ignore"]
21
+ // 忽略 stderr
22
+ });
23
+ return result.trim();
24
+ } catch {
25
+ return getCurrentVersion();
26
+ }
27
+ }
28
+ function compareVersions(v1, v2) {
29
+ const parts1 = v1.split(".").map(Number);
30
+ const parts2 = v2.split(".").map(Number);
31
+ for (let i = 0; i < 3; i++) {
32
+ const p1 = parts1[i] || 0;
33
+ const p2 = parts2[i] || 0;
34
+ if (p1 > p2)
35
+ return 1;
36
+ if (p1 < p2)
37
+ return -1;
38
+ }
39
+ return 0;
40
+ }
41
+ function detectUpdateType(current, latest) {
42
+ const c = current.split(".").map(Number);
43
+ const l = latest.split(".").map(Number);
44
+ if (l[0] > c[0])
45
+ return "major";
46
+ if (l[1] > c[1])
47
+ return "minor";
48
+ if (l[2] > c[2])
49
+ return "patch";
50
+ return null;
51
+ }
52
+ async function checkForUpdates() {
53
+ const current = getCurrentVersion();
54
+ const latest = await getLatestVersion();
55
+ const hasUpdate = compareVersions(latest, current) > 0;
56
+ const updateType = hasUpdate ? detectUpdateType(current, latest) : null;
57
+ return {
58
+ current,
59
+ latest,
60
+ hasUpdate,
61
+ updateType
62
+ };
63
+ }
64
+ const PROMPT_STATE_FILE = join(homedir(), ".claude", ".upgrade-state.json");
65
+ const CHECK_INTERVAL = 24 * 60 * 60 * 1e3;
66
+ const PROMPT_INTERVAL = 7 * 24 * 60 * 60 * 1e3;
67
+ function readPromptState() {
68
+ try {
69
+ if (existsSync(PROMPT_STATE_FILE)) {
70
+ return JSON.parse(readFileSync(PROMPT_STATE_FILE, "utf-8"));
71
+ }
72
+ } catch {
73
+ }
74
+ return {
75
+ lastChecked: 0,
76
+ lastPrompted: 0
77
+ };
78
+ }
79
+ function savePromptState(state) {
80
+ try {
81
+ writeFileSync(PROMPT_STATE_FILE, JSON.stringify(state, null, 2));
82
+ } catch {
83
+ }
84
+ }
85
+ function shouldShowPrompt(versionInfo, state) {
86
+ const now = Date.now();
87
+ if (state.dismissedVersion === versionInfo.latest) {
88
+ return false;
89
+ }
90
+ if (now - state.lastPrompted < PROMPT_INTERVAL) {
91
+ return false;
92
+ }
93
+ return versionInfo.hasUpdate;
94
+ }
95
+ function showUpgradePrompt(versionInfo) {
96
+ const { current, latest, updateType } = versionInfo;
97
+ console.log("\n" + "=".repeat(60));
98
+ console.log("\u{1F680} New version available!");
99
+ console.log(` Current: v${current}`);
100
+ console.log(` Latest: v${latest} (${updateType} update)`);
101
+ console.log("\n Upgrade now:");
102
+ console.log(" npm install -g @cometx/ccjk@latest");
103
+ console.log(" # or");
104
+ console.log(" pnpm add -g @cometx/ccjk@latest");
105
+ console.log("=".repeat(60) + "\n");
106
+ }
107
+ async function autoCheckUpdates(silent = false) {
108
+ try {
109
+ const state = readPromptState();
110
+ const now = Date.now();
111
+ if (now - state.lastChecked < CHECK_INTERVAL) {
112
+ return;
113
+ }
114
+ state.lastChecked = now;
115
+ savePromptState(state);
116
+ const versionInfo = await checkForUpdates();
117
+ if (!silent && shouldShowPrompt(versionInfo, state)) {
118
+ showUpgradePrompt(versionInfo);
119
+ state.lastPrompted = now;
120
+ savePromptState(state);
121
+ }
122
+ } catch {
123
+ }
124
+ }
125
+ async function performUpgrade() {
126
+ try {
127
+ console.log("\u{1F680} Upgrading CCJK...");
128
+ let packageManager = "npm";
129
+ try {
130
+ execSync("pnpm --version", { stdio: "ignore" });
131
+ packageManager = "pnpm";
132
+ } catch {
133
+ try {
134
+ execSync("yarn --version", { stdio: "ignore" });
135
+ packageManager = "yarn";
136
+ } catch {
137
+ }
138
+ }
139
+ const command = packageManager === "yarn" ? "yarn global add @cometx/ccjk@latest" : `${packageManager} add -g @cometx/ccjk@latest`;
140
+ console.log(` Running: ${command}`);
141
+ execSync(command, { stdio: "inherit" });
142
+ console.log("\n\u2705 Upgrade completed!");
143
+ return true;
144
+ } catch (error) {
145
+ console.error("\u274C Upgrade failed:", error);
146
+ return false;
147
+ }
148
+ }
149
+
150
+ export { autoCheckUpdates, checkForUpdates, performUpgrade };
@@ -1,6 +1,5 @@
1
1
  import process__default, { cwd } from 'node:process';
2
- import { c as consola, g as getTemplatesClient } from '../shared/ccjk.UIvifqNE.mjs';
3
- import { P as ProjectAnalyzer } from '../shared/ccjk.hrRv8G6j.mjs';
2
+ import { c as consola, P as ProjectAnalyzer, g as getTemplatesClient } from '../shared/ccjk.DHXfsrwn.mjs';
4
3
  import { i18n } from './index6.mjs';
5
4
  import { existsSync, readFileSync, writeFileSync, readdirSync } from 'node:fs';
6
5
  import { CLAUDE_AGENTS_DIR } from './constants.mjs';
@@ -1,11 +1,10 @@
1
1
  import a from './index3.mjs';
2
- import { c as consola } from '../shared/ccjk.UIvifqNE.mjs';
3
- import { c as createCompleteCloudClient } from '../shared/ccjk.CtXhbEqb.mjs';
2
+ import { c as consola, a as analyzeProject } from '../shared/ccjk.DHXfsrwn.mjs';
3
+ import { c as createCompleteCloudClient } from '../shared/ccjk.CqdbaXqU.mjs';
4
4
  import { i18n, ensureI18nInitialized } from './index6.mjs';
5
5
  import { createHash } from 'node:crypto';
6
6
  import { promises, readFileSync } from 'node:fs';
7
7
  import { join } from 'node:path';
8
- import { a as analyzeProject } from '../shared/ccjk.hrRv8G6j.mjs';
9
8
  import { c as createDefaultGateway } from '../shared/ccjk.BtB1e5jm.mjs';
10
9
  import { ccjkAgents } from './ccjk-agents.mjs';
11
10
  import { ccjkHooks } from './ccjk-hooks.mjs';
@@ -13,12 +12,12 @@ import { ccjkMcp } from './ccjk-mcp.mjs';
13
12
  import { ccjkSkills } from './ccjk-skills.mjs';
14
13
  import { e as extractString } from '../shared/ccjk.C2jHOZVP.mjs';
15
14
  import '../shared/ccjk.BAGoDD49.mjs';
16
- import 'node:url';
17
- import 'node:process';
18
- import '../shared/ccjk.bQ7Dh1g4.mjs';
19
15
  import './index9.mjs';
16
+ import '../shared/ccjk.bQ7Dh1g4.mjs';
20
17
  import 'tinyglobby';
21
18
  import '../shared/ccjk.BBtCGd_g.mjs';
19
+ import 'node:url';
20
+ import 'node:process';
22
21
  import './constants.mjs';
23
22
  import 'node:os';
24
23
  import '../shared/ccjk.D6ycHbak.mjs';
@@ -1,13 +1,15 @@
1
1
  import { performance } from 'node:perf_hooks';
2
- import { c as consola, g as getTemplatesClient } from '../shared/ccjk.UIvifqNE.mjs';
2
+ import { c as consola, P as ProjectAnalyzer, g as getTemplatesClient } from '../shared/ccjk.DHXfsrwn.mjs';
3
3
  import { i as inquirer } from './index4.mjs';
4
- import { P as ProjectAnalyzer } from '../shared/ccjk.hrRv8G6j.mjs';
5
4
  import { existsSync, readFileSync, mkdirSync, writeFileSync } from 'node:fs';
6
5
  import process__default from 'node:process';
7
6
  import { exec } from 'node:child_process';
8
7
  import { promisify } from 'node:util';
9
8
  import { j as join, d as dirname } from '../shared/ccjk.bQ7Dh1g4.mjs';
10
9
  import { i18n } from './index6.mjs';
10
+ import './index9.mjs';
11
+ import 'tinyglobby';
12
+ import '../shared/ccjk.BBtCGd_g.mjs';
11
13
  import 'node:readline';
12
14
  import '../shared/ccjk.BAGoDD49.mjs';
13
15
  import 'stream';
@@ -22,9 +24,6 @@ import 'node:os';
22
24
  import 'node:crypto';
23
25
  import 'buffer';
24
26
  import 'string_decoder';
25
- import './index9.mjs';
26
- import 'tinyglobby';
27
- import '../shared/ccjk.BBtCGd_g.mjs';
28
27
  import 'node:url';
29
28
 
30
29
  var HookType = /* @__PURE__ */ ((HookType2) => {
@@ -1,14 +1,18 @@
1
1
  import { join } from 'node:path';
2
2
  import { cwd } from 'node:process';
3
3
  import a from './index3.mjs';
4
- import { c as consola, g as getTemplatesClient } from '../shared/ccjk.UIvifqNE.mjs';
4
+ import { c as consola, a as analyzeProject, g as getTemplatesClient } from '../shared/ccjk.DHXfsrwn.mjs';
5
5
  import { i as inquirer } from './index4.mjs';
6
- import { a as analyzeProject } from '../shared/ccjk.hrRv8G6j.mjs';
7
6
  import { CLAUDE_DIR } from './constants.mjs';
8
7
  import { ensureI18nInitialized, i18n } from './index6.mjs';
9
8
  import { c as backupMcpConfig, r as readMcpConfig, m as mergeMcpServers, w as writeMcpConfig } from './claude-config.mjs';
10
9
  import { e as commandExists } from './platform.mjs';
11
10
  import '../shared/ccjk.BAGoDD49.mjs';
11
+ import 'node:fs';
12
+ import './index9.mjs';
13
+ import '../shared/ccjk.bQ7Dh1g4.mjs';
14
+ import 'tinyglobby';
15
+ import '../shared/ccjk.BBtCGd_g.mjs';
12
16
  import 'node:readline';
13
17
  import 'stream';
14
18
  import 'node:tty';
@@ -22,11 +26,6 @@ import 'node:os';
22
26
  import 'node:crypto';
23
27
  import 'buffer';
24
28
  import 'string_decoder';
25
- import 'node:fs';
26
- import './index9.mjs';
27
- import '../shared/ccjk.bQ7Dh1g4.mjs';
28
- import 'tinyglobby';
29
- import '../shared/ccjk.BBtCGd_g.mjs';
30
29
  import 'node:url';
31
30
  import './json-config.mjs';
32
31
  import '../shared/ccjk.RyizuzOI.mjs';
@@ -1,6 +1,5 @@
1
1
  import a from './index3.mjs';
2
- import { c as consola } from '../shared/ccjk.UIvifqNE.mjs';
3
- import { P as ProjectAnalyzer } from '../shared/ccjk.hrRv8G6j.mjs';
2
+ import { c as consola, P as ProjectAnalyzer } from '../shared/ccjk.DHXfsrwn.mjs';
4
3
  import { i18n } from './index6.mjs';
5
4
  import { promises } from 'node:fs';
6
5
  import { performance } from 'node:perf_hooks';
@@ -3,12 +3,15 @@ import { homedir } from 'node:os';
3
3
  import { join, dirname } from 'node:path';
4
4
  import { fileURLToPath } from 'node:url';
5
5
  import a from './index3.mjs';
6
- import { c as consola, g as getTemplatesClient } from '../shared/ccjk.UIvifqNE.mjs';
6
+ import { c as consola, a as analyzeProject, g as getTemplatesClient } from '../shared/ccjk.DHXfsrwn.mjs';
7
7
  import { i as inquirer } from './index4.mjs';
8
- import { a as analyzeProject } from '../shared/ccjk.hrRv8G6j.mjs';
9
8
  import { i18n } from './index6.mjs';
10
9
  import { g as getSkillParser } from '../shared/ccjk.DsYaCCx4.mjs';
11
10
  import '../shared/ccjk.BAGoDD49.mjs';
11
+ import './index9.mjs';
12
+ import '../shared/ccjk.bQ7Dh1g4.mjs';
13
+ import 'tinyglobby';
14
+ import '../shared/ccjk.BBtCGd_g.mjs';
12
15
  import 'node:readline';
13
16
  import 'stream';
14
17
  import 'node:tty';
@@ -22,10 +25,6 @@ import 'child_process';
22
25
  import 'node:crypto';
23
26
  import 'buffer';
24
27
  import 'string_decoder';
25
- import './index9.mjs';
26
- import '../shared/ccjk.bQ7Dh1g4.mjs';
27
- import 'tinyglobby';
28
- import '../shared/ccjk.BBtCGd_g.mjs';
29
28
 
30
29
  const __filename = fileURLToPath(import.meta.url);
31
30
  const __dirname = dirname(__filename);
@@ -60,8 +60,7 @@ import '../shared/ccjk.dYDLfmph.mjs';
60
60
  import './simple-config.mjs';
61
61
  import './commands.mjs';
62
62
  import './ccjk-agents.mjs';
63
- import '../shared/ccjk.UIvifqNE.mjs';
64
- import '../shared/ccjk.hrRv8G6j.mjs';
63
+ import '../shared/ccjk.DHXfsrwn.mjs';
65
64
  import './index9.mjs';
66
65
  import 'tinyglobby';
67
66
  import '../shared/ccjk.CfKKcvWy.mjs';
@@ -1,10 +1,20 @@
1
1
  import process__default from 'node:process';
2
2
  import a from './index3.mjs';
3
- import { checkAgentBrowserInstalled, getInstallPath } from './installer2.mjs';
3
+ import { checkAgentBrowserInstalled } from './installer2.mjs';
4
4
  import '../shared/ccjk.BAGoDD49.mjs';
5
+ import 'node:child_process';
6
+ import 'node:util';
7
+ import './index6.mjs';
5
8
  import 'node:fs';
9
+ import 'node:url';
10
+ import '../shared/ccjk.bQ7Dh1g4.mjs';
11
+ import './platform.mjs';
6
12
  import 'node:os';
13
+ import './main.mjs';
14
+ import 'module';
7
15
  import 'node:path';
16
+ import 'node:stream';
17
+ import 'node:readline';
8
18
 
9
19
  const { cyan: _cyan, yellow: yellow$1, gray: _gray, green: green$1, red: _red, blue: _blue$1, bold: _bold, dim: _dim$1 } = a;
10
20
  class AgentBrowserSession {
@@ -284,10 +294,8 @@ async function agentBrowserStatus(options) {
284
294
  ${bold(cyan("Agent Browser Status"))}
285
295
  `);
286
296
  const installed = await checkAgentBrowserInstalled();
287
- const installPath = getInstallPath();
288
297
  if (installed) {
289
298
  console.log(` ${green("\u2713")} Agent Browser is ${green("installed")}`);
290
- console.log(` ${gray("Path:")} ${installPath}`);
291
299
  try {
292
300
  const { execSync } = await import('node:child_process');
293
301
  const version = execSync('agent-browser --version 2>/dev/null || echo "unknown"', {
@@ -10,11 +10,12 @@ import './index6.mjs';
10
10
  import 'node:url';
11
11
 
12
12
  const CORE_SKILLS = [
13
- "agent-browser",
14
- "tdd",
15
- "debugging",
16
- "code-review",
17
- "git-worktrees"
13
+ "brainstorming",
14
+ "writing-plans",
15
+ "executing-plans",
16
+ "systematic-debugging",
17
+ "test-driven-development",
18
+ "using-git-worktrees"
18
19
  ];
19
20
 
20
21
  function getSuperpowersDir$1() {
@@ -1,5 +1,5 @@
1
- export { c as configureOfficialMode, a as configureSimpleMode, b as configureWithPreset, e as detectCurrentMode, d as displayCurrentStatus, g as getCurrentConfig, q as quickSetup, r as runConfigWizard, t as testApiConnection, v as validateApiKey } from '../shared/ccjk.DfXjf8EC.mjs';
2
- export { P as PROVIDER_PRESETS, g as getAllPresets, a as getChinesePresets, b as getPresetById, c as getRecommendedPresets } from '../shared/ccjk.CL4Yat0G.mjs';
1
+ export { c as configureOfficialMode, a as configureSimpleMode, b as configureWithPreset, e as detectCurrentMode, d as displayCurrentStatus, g as getCurrentConfig, q as quickSetup, r as runConfigWizard, t as testApiConnection, v as validateApiKey } from '../shared/ccjk.Cwa_FiTX.mjs';
2
+ export { P as PROVIDER_PRESETS, g as getAllPresets, a as getChinesePresets, b as getPresetById, c as getRecommendedPresets } from '../shared/ccjk.DopKzo3z.mjs';
3
3
  import './index3.mjs';
4
4
  import '../shared/ccjk.BAGoDD49.mjs';
5
5
  import './index4.mjs';