ccjk 13.3.5 → 13.3.7

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 (150) hide show
  1. package/dist/chunks/agent-teams.mjs +7 -5
  2. package/dist/chunks/agent.mjs +2 -2
  3. package/dist/chunks/agents.mjs +16 -16
  4. package/dist/chunks/api-cli.mjs +6 -6
  5. package/dist/chunks/api-providers.mjs +1 -1
  6. package/dist/chunks/api.mjs +4 -4
  7. package/dist/chunks/auto-bootstrap.mjs +1 -1
  8. package/dist/chunks/auto-fix.mjs +49 -4
  9. package/dist/chunks/auto-fixer.mjs +7 -5
  10. package/dist/chunks/auto-init.mjs +9 -7208
  11. package/dist/chunks/auto-memory-bridge.mjs +9 -3
  12. package/dist/chunks/auto-updater.mjs +9 -9
  13. package/dist/chunks/auto-upgrade.mjs +5 -3
  14. package/dist/chunks/banner.mjs +4 -3
  15. package/dist/chunks/boost.mjs +118 -62
  16. package/dist/chunks/ccjk-agents.mjs +3 -3
  17. package/dist/chunks/ccjk-all.mjs +7 -7
  18. package/dist/chunks/ccjk-config.mjs +2 -2
  19. package/dist/chunks/ccjk-hooks.mjs +4 -4
  20. package/dist/chunks/ccjk-mcp.mjs +5 -5
  21. package/dist/chunks/ccjk-setup.mjs +5 -5
  22. package/dist/chunks/ccjk-skills.mjs +5 -5
  23. package/dist/chunks/ccr.mjs +18 -16
  24. package/dist/chunks/ccu.mjs +2 -2
  25. package/dist/chunks/check-updates.mjs +8 -8
  26. package/dist/chunks/claude-code-config-manager.mjs +11 -8
  27. package/dist/chunks/claude-code-incremental-manager.mjs +7 -7
  28. package/dist/chunks/claude-config.mjs +1 -1
  29. package/dist/chunks/claude-wrapper.mjs +1 -1
  30. package/dist/chunks/cli-hook.mjs +15 -15
  31. package/dist/chunks/codex-config-switch.mjs +7 -7
  32. package/dist/chunks/codex-provider-manager.mjs +7 -7
  33. package/dist/chunks/codex-uninstaller.mjs +2 -2
  34. package/dist/chunks/codex.mjs +5 -5
  35. package/dist/chunks/commands.mjs +2 -2
  36. package/dist/chunks/commands2.mjs +3 -3
  37. package/dist/chunks/commit.mjs +2 -2
  38. package/dist/chunks/completion.mjs +2 -2
  39. package/dist/chunks/config-consolidator.mjs +2 -2
  40. package/dist/chunks/config-switch.mjs +8 -8
  41. package/dist/chunks/config.mjs +6 -5
  42. package/dist/chunks/config2.mjs +5 -5
  43. package/dist/chunks/config3.mjs +4 -4
  44. package/dist/chunks/constants.mjs +1 -1
  45. package/dist/chunks/context-opt.mjs +92 -90
  46. package/dist/chunks/context.mjs +659 -0
  47. package/dist/chunks/dashboard.mjs +14 -9
  48. package/dist/chunks/doctor.mjs +4 -4
  49. package/dist/chunks/eval.mjs +502 -0
  50. package/dist/chunks/evolution.mjs +46 -39
  51. package/dist/chunks/health-alerts.mjs +9 -9
  52. package/dist/chunks/help.mjs +1 -1
  53. package/dist/chunks/hook-installer.mjs +6 -3
  54. package/dist/chunks/index.mjs +23 -0
  55. package/dist/chunks/index10.mjs +634 -571
  56. package/dist/chunks/index11.mjs +1061 -569
  57. package/dist/chunks/index12.mjs +914 -1076
  58. package/dist/chunks/index13.mjs +136 -951
  59. package/dist/chunks/index14.mjs +209 -185
  60. package/dist/chunks/index2.mjs +19 -24
  61. package/dist/chunks/index3.mjs +19085 -12
  62. package/dist/chunks/index4.mjs +16 -19092
  63. package/dist/chunks/index5.mjs +7602 -16
  64. package/dist/chunks/index6.mjs +159 -7590
  65. package/dist/chunks/index7.mjs +1602 -171
  66. package/dist/chunks/index8.mjs +19 -1602
  67. package/dist/chunks/index9.mjs +612 -15
  68. package/dist/chunks/init.mjs +26 -19
  69. package/dist/chunks/installer.mjs +5 -5
  70. package/dist/chunks/installer2.mjs +2 -2
  71. package/dist/chunks/intent-engine.mjs +1 -1
  72. package/dist/chunks/interview.mjs +4 -4
  73. package/dist/chunks/manager.mjs +1 -1
  74. package/dist/chunks/marketplace.mjs +2 -2
  75. package/dist/chunks/mcp-cli.mjs +12 -12
  76. package/dist/chunks/mcp.mjs +8 -8
  77. package/dist/chunks/memory.mjs +8 -8
  78. package/dist/chunks/menu-hierarchical.mjs +24 -22
  79. package/dist/chunks/menu.mjs +27 -22
  80. package/dist/chunks/metrics-display.mjs +2 -2
  81. package/dist/chunks/migrator.mjs +1 -1
  82. package/dist/chunks/monitor.mjs +2 -2
  83. package/dist/chunks/notification.mjs +6 -6
  84. package/dist/chunks/onboarding-wizard.mjs +6 -5
  85. package/dist/chunks/onboarding.mjs +4 -4
  86. package/dist/chunks/package.mjs +1 -1
  87. package/dist/chunks/paradigm.mjs +2 -2
  88. package/dist/chunks/permission-manager.mjs +2 -2
  89. package/dist/chunks/permissions.mjs +3 -3
  90. package/dist/chunks/persistence-manager.mjs +19 -12
  91. package/dist/chunks/persistence.mjs +5 -3
  92. package/dist/chunks/plugin.mjs +2 -2
  93. package/dist/chunks/prompts.mjs +5 -5
  94. package/dist/chunks/providers.mjs +2 -2
  95. package/dist/chunks/quick-actions.mjs +7 -6
  96. package/dist/chunks/quick-provider.mjs +5 -4
  97. package/dist/chunks/quick-setup.mjs +20 -15
  98. package/dist/chunks/remote.mjs +15 -16
  99. package/dist/chunks/{convoy-manager.mjs → session-manager.mjs} +1129 -1095
  100. package/dist/chunks/session.mjs +2 -2
  101. package/dist/chunks/sessions.mjs +3 -3
  102. package/dist/chunks/silent-updater.mjs +1 -1
  103. package/dist/chunks/simple-config.mjs +2 -2
  104. package/dist/chunks/skill2.mjs +3 -3
  105. package/dist/chunks/skills-sync.mjs +5 -5
  106. package/dist/chunks/skills.mjs +3 -3
  107. package/dist/chunks/slash-commands.mjs +9 -8
  108. package/dist/chunks/smart-defaults.mjs +9 -5
  109. package/dist/chunks/startup.mjs +1 -1
  110. package/dist/chunks/stats.mjs +2 -2
  111. package/dist/chunks/status.mjs +37 -22
  112. package/dist/chunks/team.mjs +3 -3
  113. package/dist/chunks/thinking.mjs +4 -4
  114. package/dist/chunks/trace.mjs +2 -2
  115. package/dist/chunks/uninstall.mjs +9 -9
  116. package/dist/chunks/update.mjs +14 -11
  117. package/dist/chunks/upgrade-manager.mjs +3 -3
  118. package/dist/chunks/upgrade.mjs +25 -9
  119. package/dist/chunks/version-checker.mjs +4 -4
  120. package/dist/chunks/vim.mjs +3 -3
  121. package/dist/chunks/workflows.mjs +1 -1
  122. package/dist/chunks/wsl.mjs +1 -1
  123. package/dist/chunks/zero-config.mjs +4 -4
  124. package/dist/cli.mjs +60 -26
  125. package/dist/index.d.mts +4392 -4392
  126. package/dist/index.d.ts +4392 -4392
  127. package/dist/index.mjs +4314 -4314
  128. package/dist/shared/{ccjk.DcKLglJQ.mjs → ccjk.BIxuVL3_.mjs} +2 -2
  129. package/dist/shared/{ccjk.DJdmgr2d.mjs → ccjk.BJMRY2Ra.mjs} +5 -3
  130. package/dist/shared/{ccjk.B1TwPltj.mjs → ccjk.BOu1yav7.mjs} +3 -2
  131. package/dist/shared/{ccjk.mJpVRDZ8.mjs → ccjk.BWFpnOr3.mjs} +1 -1
  132. package/dist/shared/{ccjk.BfIpomdz.mjs → ccjk.CHUEFqmw.mjs} +3 -2
  133. package/dist/shared/{ccjk.CqdbaXqU.mjs → ccjk.CLUL0pAV.mjs} +9 -5
  134. package/dist/shared/{ccjk.Cot9p9_n.mjs → ccjk.Cjj8SVrn.mjs} +1 -1
  135. package/dist/shared/{ccjk.CfrpIIKy.mjs → ccjk.Crd_nEfj.mjs} +38 -20
  136. package/dist/shared/{ccjk.DCw2WnZU.mjs → ccjk.CvChMYvB.mjs} +1 -1
  137. package/dist/shared/{ccjk.CXzjn01x.mjs → ccjk.D8ZLYSZZ.mjs} +1 -1
  138. package/dist/shared/{ccjk.BrPUmTqm.mjs → ccjk.DJuyfrlL.mjs} +164 -82
  139. package/dist/shared/{ccjk.DHXfsrwn.mjs → ccjk.DRfdq6yl.mjs} +4 -4
  140. package/dist/shared/{ccjk.DXRAZcix.mjs → ccjk.DScm_NnL.mjs} +8 -4
  141. package/dist/shared/{ccjk.XsJWJuQP.mjs → ccjk.DfZKjHvG.mjs} +6 -128
  142. package/dist/shared/{ccjk.BFxsJM0k.mjs → ccjk.DwSebGy0.mjs} +4 -3
  143. package/dist/shared/ccjk.DxWqH-EF.mjs +170 -0
  144. package/dist/shared/{ccjk.Cwa_FiTX.mjs → ccjk.I6IuYdc_.mjs} +2 -2
  145. package/dist/shared/{ccjk.DpstNaeR.mjs → ccjk.KpFl2RDA.mjs} +3 -3
  146. package/dist/shared/{ccjk.dYDLfmph.mjs → ccjk._dESH4Rk.mjs} +1 -1
  147. package/dist/shared/{ccjk.BxSmJ8B7.mjs → ccjk.wLJHO0Af.mjs} +2 -1
  148. package/package.json +65 -67
  149. package/dist/chunks/index15.mjs +0 -218
  150. package/dist/shared/{ccjk.c-ETfBZ_.mjs → ccjk.eIn-g1yI.mjs} +96 -96
@@ -0,0 +1,659 @@
1
+ import { mkdir, writeFile, access, readFile, readdir, stat } from 'node:fs/promises';
2
+ import { d as dirname, j as join, r as relative } from '../shared/ccjk.bQ7Dh1g4.mjs';
3
+ import { constants } from 'node:fs';
4
+
5
+ function buildContextPack(intelligence, options = {}) {
6
+ const {
7
+ projectName = "Unknown Project",
8
+ projectDescription = "No description provided",
9
+ includeCommands = true,
10
+ includeRepoMap = true
11
+ } = options;
12
+ return {
13
+ projectIdentity: buildProjectIdentity(projectName, projectDescription, intelligence.stack),
14
+ stack: intelligence.stack,
15
+ commands: includeCommands ? intelligence.commands : [],
16
+ repoTopology: includeRepoMap ? buildRepoTopology(intelligence.repoMap) : "",
17
+ testPolicy: buildTestPolicy(intelligence.commands),
18
+ riskZones: identifyRiskZones(intelligence.repoMap),
19
+ retrievalInstructions: buildRetrievalInstructions(intelligence.stack),
20
+ generatedAt: (/* @__PURE__ */ new Date()).toISOString()
21
+ };
22
+ }
23
+ function buildProjectIdentity(name, description, stack) {
24
+ const parts = [
25
+ `Project: ${name}`,
26
+ `Description: ${description}`,
27
+ ""
28
+ ];
29
+ if (stack.languages.length > 0) {
30
+ parts.push(`Languages: ${stack.languages.join(", ")}`);
31
+ }
32
+ if (stack.frameworks.length > 0) {
33
+ const frameworkList = stack.frameworks.map((f) => `${f.name}${f.version ? ` ${f.version}` : ""}`).join(", ");
34
+ parts.push(`Frameworks: ${frameworkList}`);
35
+ }
36
+ if (stack.packageManager) {
37
+ parts.push(`Package Manager: ${stack.packageManager}`);
38
+ }
39
+ if (stack.runtime) {
40
+ parts.push(`Runtime: ${stack.runtime}`);
41
+ }
42
+ return parts.join("\n");
43
+ }
44
+ function buildRepoTopology(repoMap) {
45
+ const parts = ["Repository Structure:", ""];
46
+ const byType = /* @__PURE__ */ new Map();
47
+ for (const dir of repoMap.directories) {
48
+ const dirs = byType.get(dir.type) || [];
49
+ dirs.push(dir);
50
+ byType.set(dir.type, dirs);
51
+ }
52
+ const typeOrder = [
53
+ "source",
54
+ "test",
55
+ "config",
56
+ "docs",
57
+ "assets",
58
+ "other"
59
+ ];
60
+ for (const type of typeOrder) {
61
+ const dirs = byType.get(type);
62
+ if (dirs && dirs.length > 0) {
63
+ parts.push(`${type.toUpperCase()}:`);
64
+ for (const dir of dirs.slice(0, 5)) {
65
+ parts.push(` - ${dir.relativePath} (${dir.fileCount} files)`);
66
+ }
67
+ parts.push("");
68
+ }
69
+ }
70
+ parts.push(`Total: ${repoMap.totalFiles} files`);
71
+ return parts.join("\n");
72
+ }
73
+ function buildTestPolicy(commands) {
74
+ const testCommands = commands.filter((c) => c.type === "test");
75
+ if (testCommands.length === 0) {
76
+ return "No test commands detected. Consider adding tests before making changes.";
77
+ }
78
+ const parts = [
79
+ "Test Policy:",
80
+ "",
81
+ "Available test commands:"
82
+ ];
83
+ for (const cmd of testCommands) {
84
+ parts.push(` - ${cmd.name}: ${cmd.command}`);
85
+ }
86
+ parts.push("");
87
+ parts.push("Always run tests before committing changes.");
88
+ return parts.join("\n");
89
+ }
90
+ function identifyRiskZones(repoMap) {
91
+ const riskZones = [];
92
+ const buildDirs = repoMap.directories.filter((d) => d.type === "build");
93
+ for (const dir of buildDirs) {
94
+ riskZones.push(`${dir.relativePath} (generated files)`);
95
+ }
96
+ const largeDirs = repoMap.directories.filter((d) => d.fileCount > 100).sort((a, b) => b.fileCount - a.fileCount).slice(0, 3);
97
+ for (const dir of largeDirs) {
98
+ riskZones.push(`${dir.relativePath} (${dir.fileCount} files - high complexity)`);
99
+ }
100
+ return riskZones;
101
+ }
102
+ function buildRetrievalInstructions(stack) {
103
+ const parts = [
104
+ "Retrieval-First Instructions:",
105
+ ""
106
+ ];
107
+ if (stack.frameworks.length > 0) {
108
+ parts.push("For framework-specific questions:");
109
+ for (const framework of stack.frameworks) {
110
+ parts.push(` - ${framework.name}: Check local docs or official documentation for version ${framework.version || "latest"}`);
111
+ }
112
+ parts.push("");
113
+ }
114
+ parts.push("For repository conventions:");
115
+ parts.push(" - Check existing code patterns before implementing new features");
116
+ parts.push(" - Review test files to understand testing conventions");
117
+ parts.push(" - Consult configuration files for build and deployment settings");
118
+ return parts.join("\n");
119
+ }
120
+
121
+ async function writeClaudeContext(contextPack, outputPath) {
122
+ const content = formatClaudeContext(contextPack);
123
+ await mkdir(dirname(outputPath), { recursive: true });
124
+ await writeFile(outputPath, content, "utf-8");
125
+ }
126
+ function formatClaudeContext(pack) {
127
+ const sections = [];
128
+ sections.push("# CLAUDE.md");
129
+ sections.push("");
130
+ sections.push("This file provides guidance to Claude Code when working with code in this repository.");
131
+ sections.push("");
132
+ sections.push(`Generated: ${new Date(pack.generatedAt).toLocaleString()}`);
133
+ sections.push("");
134
+ sections.push("---");
135
+ sections.push("");
136
+ sections.push("## Project Information");
137
+ sections.push("");
138
+ sections.push(pack.projectIdentity);
139
+ sections.push("");
140
+ if (pack.stack.frameworks.length > 0) {
141
+ sections.push("## Technology Stack");
142
+ sections.push("");
143
+ for (const framework of pack.stack.frameworks) {
144
+ sections.push(`### ${framework.name}`);
145
+ if (framework.version) {
146
+ sections.push(`Version: ${framework.version}`);
147
+ }
148
+ sections.push(`Type: ${framework.type}`);
149
+ sections.push("");
150
+ }
151
+ }
152
+ if (pack.commands.length > 0) {
153
+ sections.push("## Available Commands");
154
+ sections.push("");
155
+ const commandsByType = /* @__PURE__ */ new Map();
156
+ for (const cmd of pack.commands) {
157
+ const cmds = commandsByType.get(cmd.type) || [];
158
+ cmds.push(cmd);
159
+ commandsByType.set(cmd.type, cmds);
160
+ }
161
+ for (const [type, commands] of commandsByType) {
162
+ sections.push(`### ${type.charAt(0).toUpperCase() + type.slice(1)}`);
163
+ sections.push("");
164
+ for (const cmd of commands) {
165
+ sections.push(`- \`${cmd.name}\`: ${cmd.command}`);
166
+ if (cmd.description) {
167
+ sections.push(` ${cmd.description}`);
168
+ }
169
+ }
170
+ sections.push("");
171
+ }
172
+ }
173
+ if (pack.repoTopology) {
174
+ sections.push("## Repository Structure");
175
+ sections.push("");
176
+ sections.push(pack.repoTopology);
177
+ sections.push("");
178
+ }
179
+ if (pack.testPolicy) {
180
+ sections.push("## Testing");
181
+ sections.push("");
182
+ sections.push(pack.testPolicy);
183
+ sections.push("");
184
+ }
185
+ if (pack.riskZones.length > 0) {
186
+ sections.push("## Risk Zones");
187
+ sections.push("");
188
+ sections.push("Be cautious when modifying these areas:");
189
+ sections.push("");
190
+ for (const zone of pack.riskZones) {
191
+ sections.push(`- ${zone}`);
192
+ }
193
+ sections.push("");
194
+ }
195
+ if (pack.retrievalInstructions) {
196
+ sections.push("## Development Guidelines");
197
+ sections.push("");
198
+ sections.push(pack.retrievalInstructions);
199
+ sections.push("");
200
+ }
201
+ return sections.join("\n");
202
+ }
203
+
204
+ async function detectCommands(projectRoot = ".") {
205
+ const commands = [];
206
+ const packageJsonPath = join(projectRoot, "package.json");
207
+ if (await fileExists$1(packageJsonPath)) {
208
+ commands.push(...await detectNpmScripts(packageJsonPath));
209
+ }
210
+ const makefilePath = join(projectRoot, "Makefile");
211
+ if (await fileExists$1(makefilePath)) {
212
+ commands.push(...await detectMakeTargets(makefilePath));
213
+ }
214
+ const pyprojectPath = join(projectRoot, "pyproject.toml");
215
+ if (await fileExists$1(pyprojectPath)) {
216
+ commands.push(...await detectPoetryScripts(pyprojectPath));
217
+ }
218
+ return commands;
219
+ }
220
+ async function detectNpmScripts(packageJsonPath) {
221
+ const commands = [];
222
+ try {
223
+ const content = await readFile(packageJsonPath, "utf-8");
224
+ const packageJson = JSON.parse(content);
225
+ if (packageJson.scripts) {
226
+ for (const [name, command] of Object.entries(packageJson.scripts)) {
227
+ commands.push({
228
+ name,
229
+ command,
230
+ type: inferCommandType(name)
231
+ });
232
+ }
233
+ }
234
+ } catch {
235
+ }
236
+ return commands;
237
+ }
238
+ async function detectMakeTargets(makefilePath) {
239
+ const commands = [];
240
+ try {
241
+ const content = await readFile(makefilePath, "utf-8");
242
+ const lines = content.split("\n");
243
+ for (const line of lines) {
244
+ const match = line.match(/^([\w-]+):\s*(.*)/);
245
+ if (match) {
246
+ const [, name, deps] = match;
247
+ if (!name.startsWith(".") && name !== "PHONY") {
248
+ commands.push({
249
+ name,
250
+ command: `make ${name}`,
251
+ type: inferCommandType(name),
252
+ description: deps || void 0
253
+ });
254
+ }
255
+ }
256
+ }
257
+ } catch {
258
+ }
259
+ return commands;
260
+ }
261
+ async function detectPoetryScripts(pyprojectPath) {
262
+ const commands = [];
263
+ try {
264
+ const content = await readFile(pyprojectPath, "utf-8");
265
+ const scriptsMatch = content.match(/\[tool\.poetry\.scripts\]([\s\S]*?)(?:\[|$)/);
266
+ if (scriptsMatch) {
267
+ const scriptsSection = scriptsMatch[1];
268
+ const lines = scriptsSection.split("\n");
269
+ for (const line of lines) {
270
+ const match = line.match(/^([\w-]+)\s*=\s*"([^"]+)"/);
271
+ if (match) {
272
+ const [, name, command] = match;
273
+ commands.push({
274
+ name,
275
+ command,
276
+ type: inferCommandType(name)
277
+ });
278
+ }
279
+ }
280
+ }
281
+ } catch {
282
+ }
283
+ return commands;
284
+ }
285
+ function inferCommandType(name) {
286
+ const lowerName = name.toLowerCase();
287
+ if (lowerName.includes("build") || lowerName.includes("compile")) {
288
+ return "build";
289
+ }
290
+ if (lowerName.includes("test") || lowerName.includes("spec")) {
291
+ return "test";
292
+ }
293
+ if (lowerName.includes("lint") || lowerName.includes("format")) {
294
+ return "lint";
295
+ }
296
+ if (lowerName.includes("dev") || lowerName.includes("watch")) {
297
+ return "dev";
298
+ }
299
+ if (lowerName.includes("start") || lowerName.includes("serve")) {
300
+ return "start";
301
+ }
302
+ if (lowerName.includes("deploy") || lowerName.includes("publish")) {
303
+ return "deploy";
304
+ }
305
+ return "other";
306
+ }
307
+ async function fileExists$1(path) {
308
+ try {
309
+ await access(path, constants.F_OK);
310
+ return true;
311
+ } catch {
312
+ return false;
313
+ }
314
+ }
315
+
316
+ async function mapRepository(projectRoot = ".", options = {}) {
317
+ const { maxDepth = 3, ignorePatterns = getDefaultIgnorePatterns() } = options;
318
+ const directories = [];
319
+ let totalFiles = 0;
320
+ let totalSize = 0;
321
+ await scanDirectory(projectRoot, projectRoot, 0, maxDepth, ignorePatterns, directories);
322
+ for (const dir of directories) {
323
+ totalFiles += dir.fileCount;
324
+ totalSize += dir.size;
325
+ }
326
+ return {
327
+ root: projectRoot,
328
+ directories,
329
+ totalFiles,
330
+ totalSize
331
+ };
332
+ }
333
+ async function scanDirectory(root, dir, depth, maxDepth, ignorePatterns, result) {
334
+ if (depth > maxDepth) {
335
+ return;
336
+ }
337
+ try {
338
+ const entries = await readdir(dir, { withFileTypes: true });
339
+ let fileCount = 0;
340
+ let size = 0;
341
+ for (const entry of entries) {
342
+ const fullPath = join(dir, entry.name);
343
+ const relativePath = relative(root, fullPath);
344
+ if (shouldIgnore(relativePath, ignorePatterns)) {
345
+ continue;
346
+ }
347
+ if (entry.isDirectory()) {
348
+ await scanDirectory(root, fullPath, depth + 1, maxDepth, ignorePatterns, result);
349
+ } else if (entry.isFile()) {
350
+ fileCount++;
351
+ try {
352
+ const stats = await stat(fullPath);
353
+ size += stats.size;
354
+ } catch {
355
+ }
356
+ }
357
+ }
358
+ if (fileCount > 0 || depth === 0) {
359
+ result.push({
360
+ path: dir,
361
+ relativePath: relative(root, dir) || ".",
362
+ type: inferDirectoryType(relative(root, dir)),
363
+ fileCount,
364
+ size
365
+ });
366
+ }
367
+ } catch {
368
+ }
369
+ }
370
+ function shouldIgnore(path, patterns) {
371
+ for (const pattern of patterns) {
372
+ if (path.includes(pattern)) {
373
+ return true;
374
+ }
375
+ }
376
+ return false;
377
+ }
378
+ function getDefaultIgnorePatterns() {
379
+ return [
380
+ "node_modules",
381
+ ".git",
382
+ "dist",
383
+ "build",
384
+ "out",
385
+ ".next",
386
+ ".nuxt",
387
+ "coverage",
388
+ ".cache",
389
+ ".turbo",
390
+ "__pycache__",
391
+ ".pytest_cache",
392
+ "venv",
393
+ ".venv",
394
+ "target",
395
+ "vendor"
396
+ ];
397
+ }
398
+ function inferDirectoryType(path) {
399
+ const lowerPath = path.toLowerCase();
400
+ if (lowerPath.match(/^(src|lib|app|packages|components|pages|views)/)) {
401
+ return "source";
402
+ }
403
+ if (lowerPath.match(/^(test|tests|__tests__|spec|specs|e2e)/)) {
404
+ return "test";
405
+ }
406
+ if (lowerPath.match(/^(config|configs|\.config|\.github|\.vscode)/)) {
407
+ return "config";
408
+ }
409
+ if (lowerPath.match(/^(docs|documentation|wiki)/)) {
410
+ return "docs";
411
+ }
412
+ if (lowerPath.match(/^(dist|build|out|\.next|\.nuxt|target)/)) {
413
+ return "build";
414
+ }
415
+ if (lowerPath.match(/^(public|static|assets|images|media)/)) {
416
+ return "assets";
417
+ }
418
+ return "other";
419
+ }
420
+
421
+ async function detectStack(projectRoot = ".") {
422
+ const languages = await detectLanguages(projectRoot);
423
+ const frameworks = await detectFrameworks(projectRoot);
424
+ const packageManager = await detectPackageManager(projectRoot);
425
+ const runtime = await detectRuntime(projectRoot);
426
+ return {
427
+ languages,
428
+ frameworks,
429
+ packageManager,
430
+ runtime
431
+ };
432
+ }
433
+ async function detectLanguages(projectRoot) {
434
+ const languages = /* @__PURE__ */ new Set();
435
+ if (await fileExists(join(projectRoot, "tsconfig.json"))) {
436
+ languages.add("TypeScript");
437
+ }
438
+ if (await fileExists(join(projectRoot, "package.json"))) {
439
+ languages.add("JavaScript");
440
+ }
441
+ if (await fileExists(join(projectRoot, "requirements.txt")) || await fileExists(join(projectRoot, "pyproject.toml")) || await fileExists(join(projectRoot, "setup.py"))) {
442
+ languages.add("Python");
443
+ }
444
+ if (await fileExists(join(projectRoot, "go.mod"))) {
445
+ languages.add("Go");
446
+ }
447
+ if (await fileExists(join(projectRoot, "Cargo.toml"))) {
448
+ languages.add("Rust");
449
+ }
450
+ if (await fileExists(join(projectRoot, "pom.xml")) || await fileExists(join(projectRoot, "build.gradle"))) {
451
+ languages.add("Java");
452
+ }
453
+ return Array.from(languages);
454
+ }
455
+ async function detectFrameworks(projectRoot) {
456
+ const frameworks = [];
457
+ const packageJsonPath = join(projectRoot, "package.json");
458
+ if (await fileExists(packageJsonPath)) {
459
+ const packageJson = await readPackageJson(packageJsonPath);
460
+ if (packageJson) {
461
+ frameworks.push(...detectNodeFrameworks(packageJson));
462
+ }
463
+ }
464
+ const requirementsPath = join(projectRoot, "requirements.txt");
465
+ if (await fileExists(requirementsPath)) {
466
+ frameworks.push(...await detectPythonFrameworks(requirementsPath));
467
+ }
468
+ return frameworks;
469
+ }
470
+ function detectNodeFrameworks(packageJson) {
471
+ const frameworks = [];
472
+ const deps = { ...packageJson.dependencies, ...packageJson.devDependencies };
473
+ const frameworkMap = {
474
+ next: { type: "fullstack" },
475
+ react: { type: "frontend" },
476
+ vue: { type: "frontend" },
477
+ nuxt: { type: "fullstack" },
478
+ svelte: { type: "frontend" },
479
+ angular: { type: "frontend" },
480
+ express: { type: "backend" },
481
+ fastify: { type: "backend" },
482
+ koa: { type: "backend" },
483
+ nestjs: { type: "backend" },
484
+ vitest: { type: "testing" },
485
+ jest: { type: "testing" },
486
+ vite: { type: "build" },
487
+ webpack: { type: "build" },
488
+ esbuild: { type: "build" }
489
+ };
490
+ for (const [name, config] of Object.entries(frameworkMap)) {
491
+ if (deps[name]) {
492
+ frameworks.push({
493
+ name,
494
+ version: deps[name].replace(/^[\^~]/, ""),
495
+ type: config.type
496
+ });
497
+ }
498
+ }
499
+ return frameworks;
500
+ }
501
+ async function detectPythonFrameworks(requirementsPath) {
502
+ const frameworks = [];
503
+ try {
504
+ const content = await readFile(requirementsPath, "utf-8");
505
+ const lines = content.split("\n");
506
+ const frameworkMap = {
507
+ django: { type: "fullstack" },
508
+ flask: { type: "backend" },
509
+ fastapi: { type: "backend" },
510
+ pytest: { type: "testing" }
511
+ };
512
+ for (const line of lines) {
513
+ const match = line.match(/^([\w-]+)(?:==|>=|<=)?([\d.]+)?/);
514
+ if (match) {
515
+ const [, name, version] = match;
516
+ const config = frameworkMap[name.toLowerCase()];
517
+ if (config) {
518
+ frameworks.push({
519
+ name,
520
+ version: version || null,
521
+ type: config.type
522
+ });
523
+ }
524
+ }
525
+ }
526
+ } catch {
527
+ }
528
+ return frameworks;
529
+ }
530
+ async function detectPackageManager(projectRoot) {
531
+ if (await fileExists(join(projectRoot, "pnpm-lock.yaml"))) {
532
+ return "pnpm";
533
+ }
534
+ if (await fileExists(join(projectRoot, "yarn.lock"))) {
535
+ return "yarn";
536
+ }
537
+ if (await fileExists(join(projectRoot, "package-lock.json"))) {
538
+ return "npm";
539
+ }
540
+ if (await fileExists(join(projectRoot, "bun.lockb"))) {
541
+ return "bun";
542
+ }
543
+ return null;
544
+ }
545
+ async function detectRuntime(projectRoot) {
546
+ const packageJsonPath = join(projectRoot, "package.json");
547
+ if (await fileExists(packageJsonPath)) {
548
+ const packageJson = await readPackageJson(packageJsonPath);
549
+ if (packageJson?.engines?.node) {
550
+ return `Node.js ${packageJson.engines.node}`;
551
+ }
552
+ return "Node.js";
553
+ }
554
+ if (await fileExists(join(projectRoot, "go.mod"))) {
555
+ return "Go";
556
+ }
557
+ if (await fileExists(join(projectRoot, "Cargo.toml"))) {
558
+ return "Rust";
559
+ }
560
+ return null;
561
+ }
562
+ async function readPackageJson(path) {
563
+ try {
564
+ const content = await readFile(path, "utf-8");
565
+ return JSON.parse(content);
566
+ } catch {
567
+ return null;
568
+ }
569
+ }
570
+ async function fileExists(path) {
571
+ try {
572
+ await access(path, constants.F_OK);
573
+ return true;
574
+ } catch {
575
+ return false;
576
+ }
577
+ }
578
+
579
+ async function analyzeProject(projectRoot = ".") {
580
+ const [stack, commands, repoMap] = await Promise.all([
581
+ detectStack(projectRoot),
582
+ detectCommands(projectRoot),
583
+ mapRepository(projectRoot)
584
+ ]);
585
+ return {
586
+ stack,
587
+ commands,
588
+ repoMap,
589
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
590
+ };
591
+ }
592
+
593
+ async function contextBuild(options = {}) {
594
+ const {
595
+ target: _target = "claude-code",
596
+ output = ".",
597
+ force: _force = false,
598
+ merge = false,
599
+ projectName,
600
+ projectDescription
601
+ } = options;
602
+ console.log("\u{1F50D} Analyzing project...");
603
+ const intelligence = await analyzeProject(".");
604
+ console.log("\u2705 Analysis complete");
605
+ console.log(` Languages: ${intelligence.stack.languages.join(", ")}`);
606
+ console.log(` Frameworks: ${intelligence.stack.frameworks.map((f) => f.name).join(", ")}`);
607
+ console.log(` Commands: ${intelligence.commands.length}`);
608
+ console.log("");
609
+ console.log("\u{1F4E6} Building context pack...");
610
+ const contextPack = buildContextPack(intelligence, {
611
+ projectName,
612
+ projectDescription,
613
+ includeCommands: true,
614
+ includeRepoMap: true
615
+ });
616
+ const outputPath = join(output, "CLAUDE.md");
617
+ if (merge) {
618
+ try {
619
+ await readFile(outputPath, "utf-8");
620
+ console.log("\u{1F4DD} Merging with existing CLAUDE.md...");
621
+ } catch {
622
+ }
623
+ }
624
+ await writeClaudeContext(contextPack, outputPath);
625
+ console.log(`\u2705 Context pack written to: ${outputPath}`);
626
+ }
627
+ async function contextRefresh() {
628
+ console.log("\u{1F504} Refreshing context pack...");
629
+ await contextBuild({ force: true, merge: true });
630
+ }
631
+ async function contextDoctor() {
632
+ console.log("\u{1F50D} Running context health check...");
633
+ const intelligence = await analyzeProject(".");
634
+ console.log("\n\u{1F4CA} Project Health:");
635
+ console.log(` \u2705 Languages detected: ${intelligence.stack.languages.length}`);
636
+ console.log(` \u2705 Frameworks detected: ${intelligence.stack.frameworks.length}`);
637
+ console.log(` \u2705 Commands detected: ${intelligence.commands.length}`);
638
+ console.log(` \u2705 Directories scanned: ${intelligence.repoMap.directories.length}`);
639
+ if (intelligence.commands.length === 0) {
640
+ console.log("\n\u26A0\uFE0F Warning: No commands detected. Consider adding package.json scripts.");
641
+ }
642
+ if (intelligence.stack.frameworks.length === 0) {
643
+ console.log("\n\u26A0\uFE0F Warning: No frameworks detected. Context may be generic.");
644
+ }
645
+ console.log("\n\u2705 Context health check complete");
646
+ }
647
+ async function contextCommand(options = {}) {
648
+ if (options.action === "refresh") {
649
+ await contextRefresh();
650
+ return;
651
+ }
652
+ if (options.action === "doctor") {
653
+ await contextDoctor();
654
+ return;
655
+ }
656
+ await contextBuild(options);
657
+ }
658
+
659
+ export { contextBuild, contextCommand, contextDoctor, contextRefresh };
@@ -1,8 +1,8 @@
1
- import a from './index3.mjs';
2
1
  import { existsSync, statSync } from 'node:fs';
3
2
  import { homedir } from 'node:os';
4
3
  import process__default from 'node:process';
5
- import { i18n } from './index6.mjs';
4
+ import a from './index2.mjs';
5
+ import { i18n } from './index5.mjs';
6
6
  import { createHash } from 'node:crypto';
7
7
  import { exec as q } from './main.mjs';
8
8
  import { n as normalize, j as join } from '../shared/ccjk.bQ7Dh1g4.mjs';
@@ -138,11 +138,12 @@ function divider() {
138
138
  return a.gray("\u2500".repeat(50));
139
139
  }
140
140
  function formatBytes(bytes) {
141
- if (bytes === 0) return "0 B";
141
+ if (bytes === 0)
142
+ return "0 B";
142
143
  const k = 1024;
143
144
  const sizes = ["B", "KB", "MB", "GB"];
144
145
  const i = Math.floor(Math.log(bytes) / Math.log(k));
145
- return `${(bytes / Math.pow(k, i)).toFixed(2)} ${sizes[i]}`;
146
+ return `${(bytes / k ** i).toFixed(2)} ${sizes[i]}`;
146
147
  }
147
148
  function formatNumber(num) {
148
149
  return num.toLocaleString();
@@ -154,10 +155,14 @@ function formatDate(timestamp) {
154
155
  const date = new Date(timestamp);
155
156
  const now = Date.now();
156
157
  const diff = now - timestamp;
157
- if (diff < 6e4) return "just now";
158
- if (diff < 36e5) return `${Math.floor(diff / 6e4)}m ago`;
159
- if (diff < 864e5) return `${Math.floor(diff / 36e5)}h ago`;
160
- if (diff < 6048e5) return `${Math.floor(diff / 864e5)}d ago`;
158
+ if (diff < 6e4)
159
+ return "just now";
160
+ if (diff < 36e5)
161
+ return `${Math.floor(diff / 6e4)}m ago`;
162
+ if (diff < 864e5)
163
+ return `${Math.floor(diff / 36e5)}h ago`;
164
+ if (diff < 6048e5)
165
+ return `${Math.floor(diff / 864e5)}d ago`;
161
166
  return date.toLocaleDateString();
162
167
  }
163
168
  function statusIcon(status) {
@@ -208,7 +213,7 @@ async function collectDashboardData() {
208
213
  data.persistence.totalContexts = stats.totalContexts;
209
214
  data.persistence.databaseSize = stats.totalSize;
210
215
  if (stats.totalOriginalTokens > 0) {
211
- const tokensSaved = stats.totalOriginalTokens - stats.totalCompressedTokens;
216
+ const _tokensSaved = stats.totalOriginalTokens - stats.totalCompressedTokens;
212
217
  data.compression.compressionRatio = stats.averageCompressionRatio;
213
218
  const oneHourAgo = Date.now() - 36e5;
214
219
  const recentContexts = persistence.queryContexts({