ccjk 13.5.2 → 13.5.4

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 (35) hide show
  1. package/README.md +5 -5
  2. package/dist/chunks/boost.mjs +8 -1
  3. package/dist/chunks/ccjk-config.mjs +17 -0
  4. package/dist/chunks/ccr.mjs +2 -2
  5. package/dist/chunks/check-updates.mjs +1 -1
  6. package/dist/chunks/codex-config-switch.mjs +1 -1
  7. package/dist/chunks/codex-provider-manager.mjs +1 -1
  8. package/dist/chunks/codex.mjs +2 -2
  9. package/dist/chunks/completion.mjs +1 -1
  10. package/dist/chunks/config-switch.mjs +1 -1
  11. package/dist/chunks/context.mjs +316 -1
  12. package/dist/chunks/features.mjs +43 -14
  13. package/dist/chunks/index4.mjs +8 -1
  14. package/dist/chunks/init.mjs +2 -2
  15. package/dist/chunks/mcp-cli.mjs +3 -3
  16. package/dist/chunks/mcp.mjs +177 -35
  17. package/dist/{shared/ccjk.Crd_nEfj.mjs → chunks/memory-check.mjs} +18 -424
  18. package/dist/chunks/memory-paths.mjs +259 -0
  19. package/dist/chunks/memory-sync.mjs +209 -0
  20. package/dist/chunks/memory.mjs +140 -17
  21. package/dist/chunks/menu-hierarchical.mjs +2 -2
  22. package/dist/chunks/menu.mjs +1 -1
  23. package/dist/chunks/onboarding-wizard.mjs +8 -1
  24. package/dist/chunks/package.mjs +1 -1
  25. package/dist/chunks/quick-actions.mjs +8 -1
  26. package/dist/chunks/quick-setup.mjs +1 -1
  27. package/dist/chunks/smart-defaults.mjs +1 -20
  28. package/dist/chunks/status.mjs +8 -1
  29. package/dist/chunks/update.mjs +2 -2
  30. package/dist/cli.mjs +16 -4
  31. package/dist/shared/{ccjk.LTONy3IS.mjs → ccjk.BOfPON0N.mjs} +1 -1
  32. package/dist/shared/{ccjk.0aJQmVxS.mjs → ccjk.miT0g_vA.mjs} +3 -160
  33. package/dist/shared/ccjk.xkKNsC02.mjs +421 -0
  34. package/package.json +1 -1
  35. package/dist/chunks/auto-memory-bridge.mjs +0 -221
@@ -1,173 +1,24 @@
1
- import { existsSync, readdirSync, statSync, readFileSync } from 'node:fs';
2
- import { CLAUDE_AGENTS_DIR, SETTINGS_FILE, CCJK_SKILLS_DIR } from '../chunks/constants.mjs';
3
- import { j as join } from './ccjk.bQ7Dh1g4.mjs';
4
- import os__default from 'node:os';
5
1
  import path__default from 'node:path';
6
- import { c as commonjsGlobal, g as getDefaultExportFromCjs } from './ccjk.BAGoDD49.mjs';
2
+ import { c as commonjsGlobal, g as getDefaultExportFromCjs } from '../shared/ccjk.BAGoDD49.mjs';
7
3
  import require$$0$2 from 'fs';
8
4
  import require$$0 from 'constants';
9
5
  import require$$0$1 from 'stream';
10
6
  import require$$4 from 'util';
11
7
  import require$$5 from 'assert';
12
8
  import sysPath from 'path';
13
- import process__default from 'node:process';
14
-
15
- const agentsCheck = {
16
- name: "Agents",
17
- weight: 4,
18
- async check() {
19
- try {
20
- if (!existsSync(CLAUDE_AGENTS_DIR)) {
21
- return {
22
- name: this.name,
23
- status: "warn",
24
- score: 30,
25
- weight: this.weight,
26
- message: "No agents directory",
27
- fix: "Create agents for specialized tasks",
28
- command: "ccjk agents"
29
- };
30
- }
31
- const files = readdirSync(CLAUDE_AGENTS_DIR).filter((f) => f.endsWith(".md"));
32
- const agentCount = files.length;
33
- if (agentCount === 0) {
34
- return {
35
- name: this.name,
36
- status: "warn",
37
- score: 30,
38
- weight: this.weight,
39
- message: "No agents configured",
40
- fix: "Create agents for your project",
41
- command: "ccjk agents"
42
- };
43
- }
44
- const score = Math.min(100, 40 + agentCount * 15);
45
- return {
46
- name: this.name,
47
- status: score >= 60 ? "pass" : "warn",
48
- score,
49
- weight: this.weight,
50
- message: `${agentCount} agent${agentCount > 1 ? "s" : ""} configured`,
51
- details: files.slice(0, 5).map((f) => ` ${f.replace(".md", "")}`)
52
- };
53
- } catch {
54
- return { name: this.name, status: "fail", score: 0, weight: this.weight, message: "Failed to read agents" };
55
- }
56
- }
57
- };
58
-
59
- const claudeMdCheck = {
60
- name: "CLAUDE.md",
61
- weight: 7,
62
- async check() {
63
- const cwd = process.cwd();
64
- const claudeMdPath = join(cwd, "CLAUDE.md");
65
- try {
66
- if (!existsSync(claudeMdPath)) {
67
- return {
68
- name: this.name,
69
- status: "fail",
70
- score: 0,
71
- weight: this.weight,
72
- message: "No CLAUDE.md in project root",
73
- fix: "Create CLAUDE.md for project-specific AI instructions",
74
- command: "ccjk init --smart"
75
- };
76
- }
77
- const stat = statSync(claudeMdPath);
78
- const content = readFileSync(claudeMdPath, "utf-8");
79
- const lines = content.split("\n").length;
80
- const sizeKb = Math.round(stat.size / 1024);
81
- const hasHeaders = (content.match(/^#{1,3}\s/gm) || []).length;
82
- const hasCodeBlocks = (content.match(/```/g) || []).length / 2;
83
- const hasBuildCommands = /build|test|lint|dev/i.test(content);
84
- let score = 40;
85
- if (lines > 20)
86
- score += 15;
87
- if (hasHeaders >= 3)
88
- score += 15;
89
- if (hasCodeBlocks >= 1)
90
- score += 10;
91
- if (hasBuildCommands)
92
- score += 20;
93
- score = Math.min(100, score);
94
- return {
95
- name: this.name,
96
- status: score >= 60 ? "pass" : "warn",
97
- score,
98
- weight: this.weight,
99
- message: `${lines} lines, ${sizeKb}KB`,
100
- details: [
101
- ` Sections: ${hasHeaders}`,
102
- ` Code blocks: ${Math.floor(hasCodeBlocks)}`,
103
- ` Build info: ${hasBuildCommands ? "yes" : "no"}`
104
- ],
105
- ...score < 80 && { fix: "Enrich CLAUDE.md with more project context", command: "ccjk init --smart" }
106
- };
107
- } catch {
108
- return { name: this.name, status: "fail", score: 0, weight: this.weight, message: "Failed to read CLAUDE.md" };
109
- }
110
- }
111
- };
112
-
113
- const mcpCheck = {
114
- name: "MCP Services",
115
- weight: 8,
116
- async check() {
117
- try {
118
- if (!existsSync(SETTINGS_FILE)) {
119
- return {
120
- name: this.name,
121
- status: "fail",
122
- score: 0,
123
- weight: this.weight,
124
- message: "No settings.json found",
125
- fix: "Run ccjk init to create settings",
126
- command: "ccjk init"
127
- };
128
- }
129
- const settings = JSON.parse(readFileSync(SETTINGS_FILE, "utf-8"));
130
- const mcpServers = settings.mcpServers || {};
131
- const serverCount = Object.keys(mcpServers).length;
132
- if (serverCount === 0) {
133
- return {
134
- name: this.name,
135
- status: "fail",
136
- score: 0,
137
- weight: this.weight,
138
- message: "No MCP services configured",
139
- fix: "Install MCP services for enhanced capabilities",
140
- command: "ccjk mcp"
141
- };
142
- }
143
- const essentialServices = ["context7"];
144
- const hasEssentials = essentialServices.filter(
145
- (s) => Object.keys(mcpServers).some((k) => k.toLowerCase().includes(s))
146
- );
147
- const score = Math.min(100, serverCount * 20 + hasEssentials.length * 20);
148
- const status = score >= 60 ? "pass" : "warn";
149
- const details = Object.keys(mcpServers).map((name) => ` ${name}`);
150
- return {
151
- name: this.name,
152
- status,
153
- score,
154
- weight: this.weight,
155
- message: `${serverCount} service${serverCount > 1 ? "s" : ""} active`,
156
- details,
157
- ...score < 80 && { fix: "Add more MCP services", command: "ccjk mcp" }
158
- };
159
- } catch {
160
- return {
161
- name: this.name,
162
- status: "fail",
163
- score: 0,
164
- weight: this.weight,
165
- message: "Failed to read MCP configuration",
166
- command: "ccjk doctor"
167
- };
168
- }
169
- }
170
- };
9
+ import { getConfiguredMemoryDirectories, getClaudeProjectsDir } from './memory-paths.mjs';
10
+ import './constants.mjs';
11
+ import 'node:os';
12
+ import './index5.mjs';
13
+ import 'node:fs';
14
+ import 'node:process';
15
+ import 'node:url';
16
+ import '../shared/ccjk.bQ7Dh1g4.mjs';
17
+ import '../shared/ccjk.BBtCGd_g.mjs';
18
+ import './index6.mjs';
19
+ import './fs-operations.mjs';
20
+ import 'node:crypto';
21
+ import 'node:fs/promises';
171
22
 
172
23
  var fs$1 = {};
173
24
 
@@ -2981,9 +2832,9 @@ const memoryCheck = {
2981
2832
  details: []
2982
2833
  };
2983
2834
  try {
2984
- const homeDir = os__default.homedir();
2985
- const claudeProjectsDir = path__default.join(homeDir, ".claude", "projects");
2986
- const settingsPath = path__default.join(homeDir, ".claude", "settings.json");
2835
+ const memoryDirs = getConfiguredMemoryDirectories();
2836
+ const claudeProjectsDir = getClaudeProjectsDir(memoryDirs.claudeDir);
2837
+ const settingsPath = path__default.join(memoryDirs.claudeDir, "settings.json");
2987
2838
  let hasMemoryDir = false;
2988
2839
  let hasMemoryContent = false;
2989
2840
  let hasCcjkRules = false;
@@ -3119,261 +2970,4 @@ const memoryCheck = {
3119
2970
  }
3120
2971
  };
3121
2972
 
3122
- const modelCheck = {
3123
- name: "Default Model",
3124
- weight: 5,
3125
- async check() {
3126
- try {
3127
- if (!existsSync(SETTINGS_FILE)) {
3128
- return {
3129
- name: this.name,
3130
- status: "fail",
3131
- score: 0,
3132
- weight: this.weight,
3133
- message: "No settings file",
3134
- command: "ccjk init"
3135
- };
3136
- }
3137
- const settings = JSON.parse(readFileSync(SETTINGS_FILE, "utf-8"));
3138
- const hasModel = settings.model || settings.defaultModel || settings.preferredModel;
3139
- const hasApiKey = settings.apiKey || settings.env?.ANTHROPIC_API_KEY || process__default.env.ANTHROPIC_API_KEY;
3140
- if (!hasApiKey) {
3141
- return {
3142
- name: this.name,
3143
- status: "warn",
3144
- score: 40,
3145
- weight: this.weight,
3146
- message: "No API key configured (using default)",
3147
- fix: "Configure API for direct access",
3148
- command: "ccjk menu",
3149
- details: [" Using Claude Code default API"]
3150
- };
3151
- }
3152
- return {
3153
- name: this.name,
3154
- status: "pass",
3155
- score: hasModel ? 100 : 70,
3156
- weight: this.weight,
3157
- message: hasModel ? `Model: ${hasModel}` : "API configured (default model)"
3158
- };
3159
- } catch {
3160
- return { name: this.name, status: "fail", score: 0, weight: this.weight, message: "Failed to read model config" };
3161
- }
3162
- }
3163
- };
3164
-
3165
- const INVALID_PERMISSION_NAMES = /* @__PURE__ */ new Set([
3166
- "AllowEdit",
3167
- "AllowWrite",
3168
- "AllowRead",
3169
- "AllowExec",
3170
- "AllowCreateProcess",
3171
- "AllowKillProcess",
3172
- "AllowNetworkAccess",
3173
- "AllowFileSystemAccess",
3174
- "AllowShellAccess",
3175
- "AllowHttpAccess"
3176
- ]);
3177
- function isValidPermission(perm) {
3178
- if (INVALID_PERMISSION_NAMES.has(perm))
3179
- return false;
3180
- if (["mcp__.*", "mcp__*", "mcp__(*)"].includes(perm))
3181
- return false;
3182
- return true;
3183
- }
3184
- const permissionsCheck = {
3185
- name: "Permissions",
3186
- weight: 3,
3187
- async check() {
3188
- try {
3189
- if (!existsSync(SETTINGS_FILE)) {
3190
- return {
3191
- name: this.name,
3192
- status: "warn",
3193
- score: 30,
3194
- weight: this.weight,
3195
- message: "No settings file",
3196
- command: "ccjk init"
3197
- };
3198
- }
3199
- const settings = JSON.parse(readFileSync(SETTINGS_FILE, "utf-8"));
3200
- const allowedTools = settings.permissions?.allow || [];
3201
- if (allowedTools.length === 0) {
3202
- return {
3203
- name: this.name,
3204
- status: "warn",
3205
- score: 40,
3206
- weight: this.weight,
3207
- message: "No tool permissions configured",
3208
- fix: "Configure permissions to reduce prompts",
3209
- command: "ccjk menu"
3210
- };
3211
- }
3212
- const invalidPerms = allowedTools.filter((p) => !isValidPermission(p));
3213
- const validPerms = allowedTools.filter((p) => isValidPermission(p));
3214
- if (invalidPerms.length > 0) {
3215
- return {
3216
- name: this.name,
3217
- status: "warn",
3218
- score: 50,
3219
- weight: this.weight,
3220
- message: `${invalidPerms.length} invalid permission(s) found (${validPerms.length} valid)`,
3221
- fix: "Run ccjk init to repair permissions",
3222
- command: "ccjk init"
3223
- };
3224
- }
3225
- const score = Math.min(100, 60 + validPerms.length * 2);
3226
- return {
3227
- name: this.name,
3228
- status: "pass",
3229
- score,
3230
- weight: this.weight,
3231
- message: `${validPerms.length} valid permission${validPerms.length > 1 ? "s" : ""} configured`
3232
- };
3233
- } catch {
3234
- return { name: this.name, status: "fail", score: 0, weight: this.weight, message: "Failed to read permissions" };
3235
- }
3236
- }
3237
- };
3238
-
3239
- const skillsCheck = {
3240
- name: "Skills",
3241
- weight: 6,
3242
- async check() {
3243
- try {
3244
- if (!existsSync(CCJK_SKILLS_DIR)) {
3245
- return {
3246
- name: this.name,
3247
- status: "warn",
3248
- score: 20,
3249
- weight: this.weight,
3250
- message: "No skills directory found",
3251
- fix: "Install skills to enhance Claude Code",
3252
- command: "ccjk skills"
3253
- };
3254
- }
3255
- const files = readdirSync(CCJK_SKILLS_DIR).filter((f) => f.endsWith(".md"));
3256
- const skillCount = files.length;
3257
- if (skillCount === 0) {
3258
- return {
3259
- name: this.name,
3260
- status: "warn",
3261
- score: 20,
3262
- weight: this.weight,
3263
- message: "No skills installed",
3264
- fix: "Install skills based on your project",
3265
- command: "ccjk skills"
3266
- };
3267
- }
3268
- const score = Math.min(100, 30 + skillCount * 10);
3269
- return {
3270
- name: this.name,
3271
- status: score >= 60 ? "pass" : "warn",
3272
- score,
3273
- weight: this.weight,
3274
- message: `${skillCount} skill${skillCount > 1 ? "s" : ""} installed`,
3275
- details: files.slice(0, 8).map((f) => ` ${f.replace(".md", "")}`),
3276
- ...skillCount < 5 && { fix: "Install more project-specific skills", command: "ccjk skills" }
3277
- };
3278
- } catch {
3279
- return { name: this.name, status: "fail", score: 0, weight: this.weight, message: "Failed to read skills" };
3280
- }
3281
- }
3282
- };
3283
-
3284
- const DEFAULT_CHECKS = [
3285
- mcpCheck,
3286
- skillsCheck,
3287
- claudeMdCheck,
3288
- modelCheck,
3289
- agentsCheck,
3290
- permissionsCheck,
3291
- memoryCheck
3292
- ];
3293
- function calculateGrade(score) {
3294
- if (score >= 95)
3295
- return "S";
3296
- if (score >= 80)
3297
- return "A";
3298
- if (score >= 65)
3299
- return "B";
3300
- if (score >= 50)
3301
- return "C";
3302
- if (score >= 30)
3303
- return "D";
3304
- return "F";
3305
- }
3306
- function generateRecommendations(results) {
3307
- const recs = [];
3308
- for (const r of results) {
3309
- if (r.status === "fail" && r.command) {
3310
- recs.push({
3311
- priority: "high",
3312
- title: `Fix: ${r.name}`,
3313
- description: r.fix || r.message,
3314
- command: r.command,
3315
- category: mapCategory(r.name)
3316
- });
3317
- } else if (r.status === "warn" && r.command) {
3318
- recs.push({
3319
- priority: "medium",
3320
- title: `Improve: ${r.name}`,
3321
- description: r.fix || r.message,
3322
- command: r.command,
3323
- category: mapCategory(r.name)
3324
- });
3325
- }
3326
- }
3327
- const priorityOrder = { high: 0, medium: 1, low: 2 };
3328
- recs.sort((a, b) => priorityOrder[a.priority] - priorityOrder[b.priority]);
3329
- return recs;
3330
- }
3331
- function mapCategory(name) {
3332
- const lower = name.toLowerCase();
3333
- if (lower.includes("mcp"))
3334
- return "mcp";
3335
- if (lower.includes("skill"))
3336
- return "skills";
3337
- if (lower.includes("agent"))
3338
- return "agents";
3339
- if (lower.includes("model") || lower.includes("api"))
3340
- return "model";
3341
- if (lower.includes("memory"))
3342
- return "sync";
3343
- if (lower.includes("sync"))
3344
- return "sync";
3345
- if (lower.includes("perm"))
3346
- return "permissions";
3347
- return "general";
3348
- }
3349
- async function runHealthCheck(checks) {
3350
- const activeChecks = checks || DEFAULT_CHECKS;
3351
- const results = [];
3352
- const promises = activeChecks.map(async (check) => {
3353
- try {
3354
- return await check.check();
3355
- } catch {
3356
- return {
3357
- name: check.name,
3358
- status: "fail",
3359
- score: 0,
3360
- weight: check.weight,
3361
- message: "Check failed unexpectedly"
3362
- };
3363
- }
3364
- });
3365
- const settled = await Promise.all(promises);
3366
- results.push(...settled);
3367
- const totalWeight = results.reduce((sum, r) => sum + r.weight, 0);
3368
- const weightedSum = results.reduce((sum, r) => sum + r.score * r.weight, 0);
3369
- const totalScore = totalWeight > 0 ? Math.round(weightedSum / totalWeight) : 0;
3370
- return {
3371
- totalScore,
3372
- grade: calculateGrade(totalScore),
3373
- results,
3374
- recommendations: generateRecommendations(results),
3375
- timestamp: Date.now()
3376
- };
3377
- }
3378
-
3379
- export { runHealthCheck as r };
2973
+ export { memoryCheck };