ccjk 13.3.14 → 13.3.16
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/dist/chunks/brain-config.mjs +75 -0
- package/dist/chunks/brain-status.mjs +83 -0
- package/dist/chunks/commit.mjs +2 -0
- package/dist/chunks/completion.mjs +1 -0
- package/dist/chunks/config.mjs +11 -4
- package/dist/chunks/help.mjs +1 -0
- package/dist/chunks/impact.mjs +651 -0
- package/dist/chunks/package.mjs +1 -1
- package/dist/chunks/persistence.mjs +38 -0
- package/dist/chunks/skills-sync.mjs +4 -0
- package/dist/chunks/stats.mjs +4 -223
- package/dist/cli.mjs +70 -0
- package/dist/shared/ccjk.Bb9Mpi2O.mjs +19 -0
- package/dist/shared/ccjk.DQXk596F.mjs +414 -0
- package/dist/shared/ccjk.OTnevPNE.mjs +225 -0
- package/package.json +1 -1
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { a as getSmartRouter } from '../shared/ccjk.DQXk596F.mjs';
|
|
2
|
+
import 'node:fs';
|
|
3
|
+
import 'node:fs/promises';
|
|
4
|
+
import 'node:os';
|
|
5
|
+
import '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
6
|
+
|
|
7
|
+
async function brainConfigCommand(options) {
|
|
8
|
+
try {
|
|
9
|
+
const router = getSmartRouter();
|
|
10
|
+
if (options.show) {
|
|
11
|
+
const config = router.getConfig();
|
|
12
|
+
console.log("\n\u2699\uFE0F Current Brain Configuration:\n");
|
|
13
|
+
console.log(` \u80FD\u529B\u504F\u597D: ${config.capabilityPreference}/5`);
|
|
14
|
+
console.log(` \u81EA\u52A8Subagent\u9608\u503C: ${config.autoSubagentThreshold}/10`);
|
|
15
|
+
console.log(` \u6700\u5927\u5E76\u884CAgent: ${config.maxParallelAgents}`);
|
|
16
|
+
console.log(` \u9065\u6D4B: ${config.enableTelemetry ? "\u542F\u7528" : "\u7981\u7528"}`);
|
|
17
|
+
console.log(` \u663E\u793A\u51B3\u7B56\u7406\u7531: ${config.showReasoning ? "\u542F\u7528" : "\u7981\u7528"}`);
|
|
18
|
+
console.log();
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (options.reset) {
|
|
22
|
+
router.updateConfig({
|
|
23
|
+
capabilityPreference: 2,
|
|
24
|
+
autoSubagentThreshold: 7,
|
|
25
|
+
maxParallelAgents: 3,
|
|
26
|
+
enableTelemetry: true,
|
|
27
|
+
showReasoning: true
|
|
28
|
+
});
|
|
29
|
+
console.log("\u2705 Configuration reset to defaults");
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const updates = {};
|
|
33
|
+
if (options.preference !== void 0) {
|
|
34
|
+
if (options.preference < 1 || options.preference > 5) {
|
|
35
|
+
console.error("\u274C Preference must be between 1 and 5");
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
updates.capabilityPreference = options.preference;
|
|
39
|
+
}
|
|
40
|
+
if (options.threshold !== void 0) {
|
|
41
|
+
if (options.threshold < 1 || options.threshold > 10) {
|
|
42
|
+
console.error("\u274C Threshold must be between 1 and 10");
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
updates.autoSubagentThreshold = options.threshold;
|
|
46
|
+
}
|
|
47
|
+
if (options.maxAgents !== void 0) {
|
|
48
|
+
if (options.maxAgents < 1 || options.maxAgents > 10) {
|
|
49
|
+
console.error("\u274C Max agents must be between 1 and 10");
|
|
50
|
+
process.exit(1);
|
|
51
|
+
}
|
|
52
|
+
updates.maxParallelAgents = options.maxAgents;
|
|
53
|
+
}
|
|
54
|
+
if (options.telemetry !== void 0) {
|
|
55
|
+
updates.enableTelemetry = options.telemetry === "on";
|
|
56
|
+
}
|
|
57
|
+
if (options.reasoning !== void 0) {
|
|
58
|
+
updates.showReasoning = options.reasoning === "on";
|
|
59
|
+
}
|
|
60
|
+
if (Object.keys(updates).length === 0) {
|
|
61
|
+
console.log("No configuration changes specified. Use --show to see current config.");
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
router.updateConfig(updates);
|
|
65
|
+
console.log("\u2705 Configuration updated:");
|
|
66
|
+
for (const [key, value] of Object.entries(updates)) {
|
|
67
|
+
console.log(` ${key}: ${value}`);
|
|
68
|
+
}
|
|
69
|
+
} catch (error) {
|
|
70
|
+
console.error("\u274C Error:", error instanceof Error ? error.message : String(error));
|
|
71
|
+
process.exit(1);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export { brainConfigCommand };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { g as getTelemetry, a as getSmartRouter, b as getCapabilityName } from '../shared/ccjk.DQXk596F.mjs';
|
|
2
|
+
import 'node:fs';
|
|
3
|
+
import 'node:fs/promises';
|
|
4
|
+
import 'node:os';
|
|
5
|
+
import '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
6
|
+
|
|
7
|
+
async function brainStatusCommand(options) {
|
|
8
|
+
try {
|
|
9
|
+
const telemetry = getTelemetry();
|
|
10
|
+
const router = getSmartRouter();
|
|
11
|
+
const stats = await telemetry.getStats();
|
|
12
|
+
const config = router.getConfig();
|
|
13
|
+
if (options.json) {
|
|
14
|
+
console.log(JSON.stringify({ stats, config }, null, 2));
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
console.log("\n\u{1F4CA} Brain Status Report\n");
|
|
18
|
+
console.log("\u2550".repeat(60));
|
|
19
|
+
console.log("\n\u2699\uFE0F Router Configuration:");
|
|
20
|
+
console.log(` \u80FD\u529B\u504F\u597D: ${config.capabilityPreference}/5 (${getPreferenceLabel(config.capabilityPreference)})`);
|
|
21
|
+
console.log(` \u81EA\u52A8Subagent\u9608\u503C: ${config.autoSubagentThreshold}/10`);
|
|
22
|
+
console.log(` \u6700\u5927\u5E76\u884CAgent: ${config.maxParallelAgents}`);
|
|
23
|
+
console.log(` \u9065\u6D4B: ${config.enableTelemetry ? "\u2705 \u542F\u7528" : "\u274C \u7981\u7528"}`);
|
|
24
|
+
console.log(` \u663E\u793A\u51B3\u7B56\u7406\u7531: ${config.showReasoning ? "\u2705 \u662F" : "\u274C \u5426"}`);
|
|
25
|
+
console.log("\n\u{1F4C8} Overall Statistics:");
|
|
26
|
+
console.log(` \u603B\u4EFB\u52A1\u6570: ${stats.totalTasks}`);
|
|
27
|
+
if (stats.totalTasks === 0) {
|
|
28
|
+
console.log("\n \u6682\u65E0\u4EFB\u52A1\u8BB0\u5F55");
|
|
29
|
+
console.log("\n\u2550".repeat(60));
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
console.log("\n\u{1F3AF} By Capability Level:");
|
|
33
|
+
for (const [level, levelStats] of Object.entries(stats.byLevel)) {
|
|
34
|
+
const levelNum = Number(level);
|
|
35
|
+
const name = getCapabilityName(levelNum);
|
|
36
|
+
const successRate = (levelStats.successRate * 100).toFixed(1);
|
|
37
|
+
const avgDuration = levelStats.avgDuration.toFixed(1);
|
|
38
|
+
const avgScore = levelStats.avgEffectScore.toFixed(1);
|
|
39
|
+
console.log(`
|
|
40
|
+
Level ${level} - ${name}:`);
|
|
41
|
+
console.log(` \u4EFB\u52A1\u6570: ${levelStats.count}`);
|
|
42
|
+
console.log(` \u6210\u529F\u7387: ${successRate}% ${getSuccessEmoji(levelStats.successRate)}`);
|
|
43
|
+
console.log(` \u5E73\u5747\u8017\u65F6: ${avgDuration}s`);
|
|
44
|
+
console.log(` \u5E73\u5747\u8BC4\u5206: ${avgScore}/10 ${getScoreEmoji(levelStats.avgEffectScore)}`);
|
|
45
|
+
}
|
|
46
|
+
if (options.detailed && stats.recentTrend.length > 0) {
|
|
47
|
+
console.log("\n\u{1F4C5} Recent Trend (Last 30 Days):");
|
|
48
|
+
const recentDays = stats.recentTrend.slice(-7);
|
|
49
|
+
for (const day of recentDays) {
|
|
50
|
+
const successRate = (day.successRate * 100).toFixed(1);
|
|
51
|
+
console.log(` ${day.date}: ${day.count} tasks, ${successRate}% success`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (stats.recommendations.length > 0) {
|
|
55
|
+
console.log("\n\u{1F4A1} Recommendations:");
|
|
56
|
+
for (const rec of stats.recommendations) {
|
|
57
|
+
console.log(` \u2022 ${rec}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
console.log("\n\u2550".repeat(60));
|
|
61
|
+
console.log();
|
|
62
|
+
} catch (error) {
|
|
63
|
+
console.error("\u274C Error:", error instanceof Error ? error.message : String(error));
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function getPreferenceLabel(pref) {
|
|
68
|
+
if (pref <= 2) return "\u4F18\u5148\u7B80\u5355";
|
|
69
|
+
if (pref >= 4) return "\u4F18\u5148\u590D\u6742";
|
|
70
|
+
return "\u5E73\u8861";
|
|
71
|
+
}
|
|
72
|
+
function getSuccessEmoji(rate) {
|
|
73
|
+
if (rate >= 0.9) return "\u{1F7E2}";
|
|
74
|
+
if (rate >= 0.7) return "\u{1F7E1}";
|
|
75
|
+
return "\u{1F534}";
|
|
76
|
+
}
|
|
77
|
+
function getScoreEmoji(score) {
|
|
78
|
+
if (score >= 8) return "\u{1F31F}";
|
|
79
|
+
if (score >= 6) return "\u{1F44D}";
|
|
80
|
+
return "\u{1F44E}";
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export { brainStatusCommand };
|
package/dist/chunks/commit.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import a from './index2.mjs';
|
|
2
2
|
import { i as inquirer } from './index3.mjs';
|
|
3
3
|
import { exec as q } from './main.mjs';
|
|
4
|
+
import { s as showImpactReminder } from '../shared/ccjk.Bb9Mpi2O.mjs';
|
|
4
5
|
import '../shared/ccjk.BAGoDD49.mjs';
|
|
5
6
|
import 'node:readline';
|
|
6
7
|
import 'stream';
|
|
@@ -129,6 +130,7 @@ async function commit(options = {}) {
|
|
|
129
130
|
try {
|
|
130
131
|
await commitChanges(message);
|
|
131
132
|
console.log(a.green("\n\u2713 Changes committed"));
|
|
133
|
+
showImpactReminder("commit");
|
|
132
134
|
} catch (error) {
|
|
133
135
|
console.log(a.red(`
|
|
134
136
|
\u2717 Commit failed: ${error}`));
|
|
@@ -290,6 +290,7 @@ const COMPLETION_COMMANDS = [
|
|
|
290
290
|
// Other Commands
|
|
291
291
|
{ name: "ccr", description: "Configure Claude Code Router" },
|
|
292
292
|
{ name: "ccu", description: "Claude Code usage analysis" },
|
|
293
|
+
{ name: "impact", description: "Usage impact page with daily token trends", aliases: ["gain"] },
|
|
293
294
|
{ name: "vim", description: "Vim mode configuration" },
|
|
294
295
|
{ name: "workflows", description: "Manage workflows", aliases: ["wf"] },
|
|
295
296
|
{ name: "stats", description: "Usage statistics" },
|
package/dist/chunks/config.mjs
CHANGED
|
@@ -18,9 +18,13 @@ const MODEL_ENV_KEYS = [
|
|
|
18
18
|
// Deprecated but still cleaned to avoid stale values
|
|
19
19
|
"ANTHROPIC_SMALL_FAST_MODEL"
|
|
20
20
|
];
|
|
21
|
-
function clearModelEnv(env) {
|
|
21
|
+
function clearModelEnv(env, mode = "reset") {
|
|
22
22
|
for (const key of MODEL_ENV_KEYS) {
|
|
23
|
-
|
|
23
|
+
if (mode === "reset" && key === "ANTHROPIC_MODEL") {
|
|
24
|
+
env[key] = "";
|
|
25
|
+
} else {
|
|
26
|
+
delete env[key];
|
|
27
|
+
}
|
|
24
28
|
}
|
|
25
29
|
}
|
|
26
30
|
|
|
@@ -157,7 +161,7 @@ function updateCustomModel(primaryModel, haikuModel, sonnetModel, opusModel) {
|
|
|
157
161
|
}
|
|
158
162
|
delete settings.model;
|
|
159
163
|
settings.env = settings.env || {};
|
|
160
|
-
clearModelEnv(settings.env);
|
|
164
|
+
clearModelEnv(settings.env, "override");
|
|
161
165
|
if (primaryModel?.trim()) {
|
|
162
166
|
settings.env.ANTHROPIC_MODEL = primaryModel.trim();
|
|
163
167
|
}
|
|
@@ -252,7 +256,10 @@ function getExistingModelConfig() {
|
|
|
252
256
|
if (!settings) {
|
|
253
257
|
return null;
|
|
254
258
|
}
|
|
255
|
-
const hasModelEnv = MODEL_ENV_KEYS.some((key) =>
|
|
259
|
+
const hasModelEnv = MODEL_ENV_KEYS.some((key) => {
|
|
260
|
+
const value = settings.env?.[key];
|
|
261
|
+
return value !== void 0 && value !== null && value !== "";
|
|
262
|
+
});
|
|
256
263
|
if (hasModelEnv) {
|
|
257
264
|
return "custom";
|
|
258
265
|
}
|
package/dist/chunks/help.mjs
CHANGED
|
@@ -25,6 +25,7 @@ const COMMAND_REFERENCE = [
|
|
|
25
25
|
{ name: "ccjk workflows", alias: "wf", description: "\u7BA1\u7406\u5DE5\u4F5C\u6D41", category: "other", examples: ["ccjk wf"] },
|
|
26
26
|
{ name: "ccjk ccr", description: "CCR \u4EE3\u7406\u7BA1\u7406", category: "other", examples: ["ccjk ccr"] },
|
|
27
27
|
{ name: "ccjk ccu", description: "\u4F7F\u7528\u91CF\u7EDF\u8BA1", category: "other", examples: ["ccjk ccu"] },
|
|
28
|
+
{ name: "ccjk impact", alias: "gain", description: "\u6BCF\u65E5 Token \u6548\u679C\u9875", category: "other", examples: ["ccjk impact", "ccjk impact --days 30"] },
|
|
28
29
|
{ name: "ccjk uninstall", description: "\u5378\u8F7D\u914D\u7F6E", category: "other", examples: ["ccjk uninstall"] }
|
|
29
30
|
];
|
|
30
31
|
const HELP_TOPICS = [
|