ccjk 12.0.7 → 12.0.8

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 (299) hide show
  1. package/package.json +1 -1
  2. package/dist/chunks/agent-teams.mjs +0 -136
  3. package/dist/chunks/agent.mjs +0 -1439
  4. package/dist/chunks/agents.mjs +0 -3778
  5. package/dist/chunks/api-cli.mjs +0 -132
  6. package/dist/chunks/api-providers.mjs +0 -129
  7. package/dist/chunks/api.mjs +0 -112
  8. package/dist/chunks/auto-bootstrap.mjs +0 -358
  9. package/dist/chunks/auto-init.mjs +0 -7584
  10. package/dist/chunks/auto-updater.mjs +0 -410
  11. package/dist/chunks/banner.mjs +0 -188
  12. package/dist/chunks/bash.mjs +0 -187
  13. package/dist/chunks/boost.mjs +0 -397
  14. package/dist/chunks/ccjk-agents.mjs +0 -414
  15. package/dist/chunks/ccjk-all.mjs +0 -1028
  16. package/dist/chunks/ccjk-config.mjs +0 -261
  17. package/dist/chunks/ccjk-hooks.mjs +0 -1074
  18. package/dist/chunks/ccjk-mcp.mjs +0 -761
  19. package/dist/chunks/ccjk-setup.mjs +0 -763
  20. package/dist/chunks/ccjk-skills.mjs +0 -514
  21. package/dist/chunks/ccr.mjs +0 -98
  22. package/dist/chunks/ccu.mjs +0 -40
  23. package/dist/chunks/check-updates.mjs +0 -108
  24. package/dist/chunks/claude-code-config-manager.mjs +0 -750
  25. package/dist/chunks/claude-code-incremental-manager.mjs +0 -623
  26. package/dist/chunks/claude-config.mjs +0 -236
  27. package/dist/chunks/claude-wrapper.mjs +0 -85
  28. package/dist/chunks/cleanup-migration.mjs +0 -20
  29. package/dist/chunks/cli-hook.mjs +0 -2285
  30. package/dist/chunks/cloud-sync.mjs +0 -29
  31. package/dist/chunks/codex-config-switch.mjs +0 -451
  32. package/dist/chunks/codex-provider-manager.mjs +0 -236
  33. package/dist/chunks/codex-uninstaller.mjs +0 -404
  34. package/dist/chunks/codex.mjs +0 -2077
  35. package/dist/chunks/commands.mjs +0 -108
  36. package/dist/chunks/commands2.mjs +0 -413
  37. package/dist/chunks/commit.mjs +0 -138
  38. package/dist/chunks/completion.mjs +0 -515
  39. package/dist/chunks/config-consolidator.mjs +0 -172
  40. package/dist/chunks/config-switch.mjs +0 -317
  41. package/dist/chunks/config.mjs +0 -379
  42. package/dist/chunks/config2.mjs +0 -477
  43. package/dist/chunks/config3.mjs +0 -470
  44. package/dist/chunks/constants.mjs +0 -133
  45. package/dist/chunks/context-loader.mjs +0 -343
  46. package/dist/chunks/context.mjs +0 -372
  47. package/dist/chunks/convoy-manager.mjs +0 -880
  48. package/dist/chunks/dashboard.mjs +0 -476
  49. package/dist/chunks/doctor.mjs +0 -964
  50. package/dist/chunks/evolution.mjs +0 -382
  51. package/dist/chunks/features.mjs +0 -698
  52. package/dist/chunks/fish.mjs +0 -181
  53. package/dist/chunks/fs-operations.mjs +0 -192
  54. package/dist/chunks/health-alerts.mjs +0 -304
  55. package/dist/chunks/health-check.mjs +0 -532
  56. package/dist/chunks/help.mjs +0 -340
  57. package/dist/chunks/hook-installer.mjs +0 -45
  58. package/dist/chunks/index.mjs +0 -24
  59. package/dist/chunks/index10.mjs +0 -1171
  60. package/dist/chunks/index11.mjs +0 -1008
  61. package/dist/chunks/index12.mjs +0 -193
  62. package/dist/chunks/index13.mjs +0 -218
  63. package/dist/chunks/index14.mjs +0 -663
  64. package/dist/chunks/index2.mjs +0 -19
  65. package/dist/chunks/index3.mjs +0 -19092
  66. package/dist/chunks/index4.mjs +0 -8
  67. package/dist/chunks/index5.mjs +0 -7600
  68. package/dist/chunks/index6.mjs +0 -171
  69. package/dist/chunks/index7.mjs +0 -3583
  70. package/dist/chunks/index8.mjs +0 -19
  71. package/dist/chunks/index9.mjs +0 -616
  72. package/dist/chunks/init.mjs +0 -1606
  73. package/dist/chunks/installer.mjs +0 -690
  74. package/dist/chunks/installer2.mjs +0 -179
  75. package/dist/chunks/interview.mjs +0 -2927
  76. package/dist/chunks/json-config.mjs +0 -60
  77. package/dist/chunks/linux.mjs +0 -3863
  78. package/dist/chunks/macos.mjs +0 -69
  79. package/dist/chunks/main.mjs +0 -635
  80. package/dist/chunks/manager.mjs +0 -1048
  81. package/dist/chunks/marketplace.mjs +0 -949
  82. package/dist/chunks/mcp-cli.mjs +0 -204
  83. package/dist/chunks/mcp-performance.mjs +0 -187
  84. package/dist/chunks/mcp.mjs +0 -1231
  85. package/dist/chunks/menu.mjs +0 -652
  86. package/dist/chunks/metrics-display.mjs +0 -153
  87. package/dist/chunks/migrator.mjs +0 -178
  88. package/dist/chunks/monitor.mjs +0 -1856
  89. package/dist/chunks/notification.mjs +0 -1864
  90. package/dist/chunks/onboarding.mjs +0 -385
  91. package/dist/chunks/package.mjs +0 -3
  92. package/dist/chunks/paradigm.mjs +0 -74
  93. package/dist/chunks/permission-manager.mjs +0 -132
  94. package/dist/chunks/permissions.mjs +0 -265
  95. package/dist/chunks/persistence-manager.mjs +0 -794
  96. package/dist/chunks/persistence.mjs +0 -667
  97. package/dist/chunks/platform.mjs +0 -391
  98. package/dist/chunks/plugin.mjs +0 -1936
  99. package/dist/chunks/powershell.mjs +0 -213
  100. package/dist/chunks/prompts.mjs +0 -241
  101. package/dist/chunks/providers.mjs +0 -260
  102. package/dist/chunks/quick-actions.mjs +0 -320
  103. package/dist/chunks/quick-provider.mjs +0 -682
  104. package/dist/chunks/quick-setup.mjs +0 -412
  105. package/dist/chunks/remote.mjs +0 -497
  106. package/dist/chunks/session.mjs +0 -878
  107. package/dist/chunks/sessions.mjs +0 -106
  108. package/dist/chunks/silent-updater.mjs +0 -396
  109. package/dist/chunks/simple-config.mjs +0 -98
  110. package/dist/chunks/skill.mjs +0 -117
  111. package/dist/chunks/skill2.mjs +0 -9003
  112. package/dist/chunks/skills-sync.mjs +0 -6460
  113. package/dist/chunks/skills.mjs +0 -567
  114. package/dist/chunks/slash-commands.mjs +0 -207
  115. package/dist/chunks/smart-defaults.mjs +0 -412
  116. package/dist/chunks/smart-guide.mjs +0 -194
  117. package/dist/chunks/startup.mjs +0 -487
  118. package/dist/chunks/stats.mjs +0 -410
  119. package/dist/chunks/status.mjs +0 -289
  120. package/dist/chunks/team.mjs +0 -63
  121. package/dist/chunks/thinking.mjs +0 -626
  122. package/dist/chunks/trace.mjs +0 -57
  123. package/dist/chunks/uninstall.mjs +0 -849
  124. package/dist/chunks/update.mjs +0 -167
  125. package/dist/chunks/upgrade-manager.mjs +0 -204
  126. package/dist/chunks/version-checker.mjs +0 -881
  127. package/dist/chunks/vim.mjs +0 -903
  128. package/dist/chunks/windows.mjs +0 -14
  129. package/dist/chunks/workflows.mjs +0 -633
  130. package/dist/chunks/wsl.mjs +0 -129
  131. package/dist/chunks/zero-config.mjs +0 -374
  132. package/dist/chunks/zsh.mjs +0 -182
  133. package/dist/cli.d.mts +0 -1
  134. package/dist/cli.d.ts +0 -1
  135. package/dist/cli.mjs +0 -2199
  136. package/dist/i18n/locales/en/agent-teams.json +0 -18
  137. package/dist/i18n/locales/en/agentBrowser.json +0 -79
  138. package/dist/i18n/locales/en/agents.json +0 -135
  139. package/dist/i18n/locales/en/api.json +0 -63
  140. package/dist/i18n/locales/en/ccjk-agents.json +0 -33
  141. package/dist/i18n/locales/en/ccjk-all.json +0 -23
  142. package/dist/i18n/locales/en/ccjk-skills.json +0 -22
  143. package/dist/i18n/locales/en/ccjk.json +0 -276
  144. package/dist/i18n/locales/en/ccr.json +0 -65
  145. package/dist/i18n/locales/en/claude-md.json +0 -73
  146. package/dist/i18n/locales/en/cli.json +0 -152
  147. package/dist/i18n/locales/en/cloud-setup.json +0 -31
  148. package/dist/i18n/locales/en/cloud-sync.json +0 -147
  149. package/dist/i18n/locales/en/cloud.json +0 -40
  150. package/dist/i18n/locales/en/cloudPlugins.json +0 -118
  151. package/dist/i18n/locales/en/codex.json +0 -127
  152. package/dist/i18n/locales/en/cometix.json +0 -29
  153. package/dist/i18n/locales/en/common.json +0 -68
  154. package/dist/i18n/locales/en/config.json +0 -108
  155. package/dist/i18n/locales/en/configuration.json +0 -226
  156. package/dist/i18n/locales/en/context.json +0 -85
  157. package/dist/i18n/locales/en/dashboard.json +0 -78
  158. package/dist/i18n/locales/en/errors.json +0 -26
  159. package/dist/i18n/locales/en/evolution.json +0 -54
  160. package/dist/i18n/locales/en/hooks.json +0 -74
  161. package/dist/i18n/locales/en/hooksSync.json +0 -133
  162. package/dist/i18n/locales/en/installation.json +0 -83
  163. package/dist/i18n/locales/en/interview.json +0 -104
  164. package/dist/i18n/locales/en/language.json +0 -19
  165. package/dist/i18n/locales/en/lsp.json +0 -78
  166. package/dist/i18n/locales/en/marketplace.json +0 -116
  167. package/dist/i18n/locales/en/mcp.json +0 -178
  168. package/dist/i18n/locales/en/memory.json +0 -92
  169. package/dist/i18n/locales/en/menu.json +0 -143
  170. package/dist/i18n/locales/en/multi-config.json +0 -79
  171. package/dist/i18n/locales/en/notification.json +0 -307
  172. package/dist/i18n/locales/en/permissions.json +0 -95
  173. package/dist/i18n/locales/en/persistence.json +0 -127
  174. package/dist/i18n/locales/en/plugins.json +0 -146
  175. package/dist/i18n/locales/en/quick-actions.json +0 -78
  176. package/dist/i18n/locales/en/registry.json +0 -54
  177. package/dist/i18n/locales/en/remote.json +0 -93
  178. package/dist/i18n/locales/en/sandbox.json +0 -44
  179. package/dist/i18n/locales/en/setup.json +0 -44
  180. package/dist/i18n/locales/en/shencha.json +0 -14
  181. package/dist/i18n/locales/en/skills.json +0 -100
  182. package/dist/i18n/locales/en/skillsSync.json +0 -74
  183. package/dist/i18n/locales/en/smartGuide.json +0 -49
  184. package/dist/i18n/locales/en/stats.json +0 -20
  185. package/dist/i18n/locales/en/subagent.json +0 -69
  186. package/dist/i18n/locales/en/superpowers.json +0 -117
  187. package/dist/i18n/locales/en/team.json +0 -7
  188. package/dist/i18n/locales/en/thinking.json +0 -65
  189. package/dist/i18n/locales/en/tools.json +0 -42
  190. package/dist/i18n/locales/en/uninstall.json +0 -56
  191. package/dist/i18n/locales/en/updater.json +0 -29
  192. package/dist/i18n/locales/en/vim.json +0 -169
  193. package/dist/i18n/locales/en/workflow.json +0 -55
  194. package/dist/i18n/locales/en/workspace.json +0 -108
  195. package/dist/i18n/locales/zh-CN/agent-teams.json +0 -18
  196. package/dist/i18n/locales/zh-CN/agentBrowser.json +0 -79
  197. package/dist/i18n/locales/zh-CN/agents.json +0 -135
  198. package/dist/i18n/locales/zh-CN/api.json +0 -63
  199. package/dist/i18n/locales/zh-CN/ccjk-agents.json +0 -33
  200. package/dist/i18n/locales/zh-CN/ccjk-all.json +0 -23
  201. package/dist/i18n/locales/zh-CN/ccjk-skills.json +0 -22
  202. package/dist/i18n/locales/zh-CN/ccjk.json +0 -276
  203. package/dist/i18n/locales/zh-CN/ccr.json +0 -65
  204. package/dist/i18n/locales/zh-CN/claude-md.json +0 -73
  205. package/dist/i18n/locales/zh-CN/cli.json +0 -152
  206. package/dist/i18n/locales/zh-CN/cloud-setup.json +0 -31
  207. package/dist/i18n/locales/zh-CN/cloud-sync.json +0 -147
  208. package/dist/i18n/locales/zh-CN/cloud.json +0 -40
  209. package/dist/i18n/locales/zh-CN/cloudPlugins.json +0 -118
  210. package/dist/i18n/locales/zh-CN/codex.json +0 -127
  211. package/dist/i18n/locales/zh-CN/cometix.json +0 -29
  212. package/dist/i18n/locales/zh-CN/common.json +0 -68
  213. package/dist/i18n/locales/zh-CN/config.json +0 -108
  214. package/dist/i18n/locales/zh-CN/configuration.json +0 -224
  215. package/dist/i18n/locales/zh-CN/context.json +0 -85
  216. package/dist/i18n/locales/zh-CN/dashboard.json +0 -78
  217. package/dist/i18n/locales/zh-CN/errors.json +0 -26
  218. package/dist/i18n/locales/zh-CN/evolution.json +0 -54
  219. package/dist/i18n/locales/zh-CN/hooks.json +0 -74
  220. package/dist/i18n/locales/zh-CN/hooksSync.json +0 -133
  221. package/dist/i18n/locales/zh-CN/installation.json +0 -83
  222. package/dist/i18n/locales/zh-CN/interview.json +0 -104
  223. package/dist/i18n/locales/zh-CN/language.json +0 -19
  224. package/dist/i18n/locales/zh-CN/lsp.json +0 -78
  225. package/dist/i18n/locales/zh-CN/marketplace.json +0 -116
  226. package/dist/i18n/locales/zh-CN/mcp.json +0 -178
  227. package/dist/i18n/locales/zh-CN/memory.json +0 -92
  228. package/dist/i18n/locales/zh-CN/menu.json +0 -143
  229. package/dist/i18n/locales/zh-CN/multi-config.json +0 -79
  230. package/dist/i18n/locales/zh-CN/notification.json +0 -307
  231. package/dist/i18n/locales/zh-CN/permissions.json +0 -95
  232. package/dist/i18n/locales/zh-CN/persistence.json +0 -127
  233. package/dist/i18n/locales/zh-CN/plugins.json +0 -146
  234. package/dist/i18n/locales/zh-CN/quick-actions.json +0 -78
  235. package/dist/i18n/locales/zh-CN/registry.json +0 -54
  236. package/dist/i18n/locales/zh-CN/remote.json +0 -93
  237. package/dist/i18n/locales/zh-CN/sandbox.json +0 -44
  238. package/dist/i18n/locales/zh-CN/setup.json +0 -44
  239. package/dist/i18n/locales/zh-CN/shencha.json +0 -14
  240. package/dist/i18n/locales/zh-CN/skills.json +0 -100
  241. package/dist/i18n/locales/zh-CN/skillsSync.json +0 -74
  242. package/dist/i18n/locales/zh-CN/smartGuide.json +0 -49
  243. package/dist/i18n/locales/zh-CN/stats.json +0 -20
  244. package/dist/i18n/locales/zh-CN/subagent.json +0 -69
  245. package/dist/i18n/locales/zh-CN/superpowers.json +0 -117
  246. package/dist/i18n/locales/zh-CN/team.json +0 -7
  247. package/dist/i18n/locales/zh-CN/thinking.json +0 -65
  248. package/dist/i18n/locales/zh-CN/tools.json +0 -42
  249. package/dist/i18n/locales/zh-CN/uninstall.json +0 -56
  250. package/dist/i18n/locales/zh-CN/updater.json +0 -29
  251. package/dist/i18n/locales/zh-CN/vim.json +0 -169
  252. package/dist/i18n/locales/zh-CN/workflow.json +0 -55
  253. package/dist/i18n/locales/zh-CN/workspace.json +0 -108
  254. package/dist/index.d.mts +0 -5295
  255. package/dist/index.d.ts +0 -5295
  256. package/dist/index.mjs +0 -4941
  257. package/dist/shared/ccjk.B364Fu0N.mjs +0 -1819
  258. package/dist/shared/ccjk.BAGoDD49.mjs +0 -36
  259. package/dist/shared/ccjk.BBtCGd_g.mjs +0 -899
  260. package/dist/shared/ccjk.BFQ7yr5S.mjs +0 -16
  261. package/dist/shared/ccjk.BFxsJM0k.mjs +0 -599
  262. package/dist/shared/ccjk.BIxuVL3_.mjs +0 -25
  263. package/dist/shared/ccjk.BRZ9ww8S.mjs +0 -142
  264. package/dist/shared/ccjk.BoApaI4j.mjs +0 -28
  265. package/dist/shared/ccjk.BrPUmTqm.mjs +0 -266
  266. package/dist/shared/ccjk.BtB1e5jm.mjs +0 -171
  267. package/dist/shared/ccjk.BwfbSKN2.mjs +0 -1051
  268. package/dist/shared/ccjk.BxSmJ8B7.mjs +0 -243
  269. package/dist/shared/ccjk.Bx_rmYfN.mjs +0 -69
  270. package/dist/shared/ccjk.C2jHOZVP.mjs +0 -52
  271. package/dist/shared/ccjk.CL4Yat0G.mjs +0 -303
  272. package/dist/shared/ccjk.COweQ1RR.mjs +0 -5
  273. package/dist/shared/ccjk.CePkJq2S.mjs +0 -223
  274. package/dist/shared/ccjk.CfKKcvWy.mjs +0 -126
  275. package/dist/shared/ccjk.Cjgrln_h.mjs +0 -297
  276. package/dist/shared/ccjk.Cjj8SVrn.mjs +0 -54
  277. package/dist/shared/ccjk.CxpGa6MC.mjs +0 -2724
  278. package/dist/shared/ccjk.D5MFQT7w.mjs +0 -400
  279. package/dist/shared/ccjk.D6ycHbak.mjs +0 -270
  280. package/dist/shared/ccjk.D8ZLYSZZ.mjs +0 -299
  281. package/dist/shared/ccjk.DG_o24cZ.mjs +0 -88
  282. package/dist/shared/ccjk.DLLw-h4Y.mjs +0 -460
  283. package/dist/shared/ccjk.DOwtZMk8.mjs +0 -4019
  284. package/dist/shared/ccjk.DS7UESmF.mjs +0 -2451
  285. package/dist/shared/ccjk.DTdjs-qK.mjs +0 -1447
  286. package/dist/shared/ccjk.DXRAZcix.mjs +0 -66
  287. package/dist/shared/ccjk.DsYaCCx4.mjs +0 -317
  288. package/dist/shared/ccjk.J8YiPsOw.mjs +0 -259
  289. package/dist/shared/ccjk.KfSWcGlE.mjs +0 -38
  290. package/dist/shared/ccjk.RyizuzOI.mjs +0 -21
  291. package/dist/shared/ccjk.SPoXMvZD.mjs +0 -1242
  292. package/dist/shared/ccjk.T_cX87dY.mjs +0 -15
  293. package/dist/shared/ccjk.UIvifqNE.mjs +0 -1486
  294. package/dist/shared/ccjk._dESH4Rk.mjs +0 -111
  295. package/dist/shared/ccjk.bQ7Dh1g4.mjs +0 -249
  296. package/dist/shared/ccjk.c-ETfBZ_.mjs +0 -617
  297. package/dist/shared/ccjk.gDEDGD_t.mjs +0 -38
  298. package/dist/shared/ccjk.hoqrwWdN.mjs +0 -333
  299. package/dist/shared/ccjk.waa2ikKJ.mjs +0 -351
@@ -1,476 +0,0 @@
1
- import a from './index2.mjs';
2
- import { existsSync, statSync } from 'node:fs';
3
- import { homedir } from 'node:os';
4
- import process__default from 'node:process';
5
- import { i18n } from './index5.mjs';
6
- import { createHash } from 'node:crypto';
7
- import { exec as q } from './main.mjs';
8
- import { n as normalize, j as join } from '../shared/ccjk.bQ7Dh1g4.mjs';
9
- import '../shared/ccjk.BAGoDD49.mjs';
10
- import 'node:url';
11
- import 'module';
12
- import 'node:child_process';
13
- import 'node:path';
14
- import 'node:stream';
15
- import 'node:readline';
16
-
17
- async function generateProjectHash(projectPath) {
18
- let normalizedPath = normalize(projectPath);
19
- normalizedPath = normalizedPath.replace(/[/\\]+$/, "");
20
- const gitInfo = await getGitInfo(normalizedPath);
21
- const hashInput = [
22
- normalizedPath,
23
- gitInfo.remote || "",
24
- gitInfo.branch || ""
25
- ].join("|");
26
- const hash = createHash("sha256").update(hashInput).digest("hex").substring(0, 16);
27
- return {
28
- path: normalizedPath,
29
- gitRemote: gitInfo.remote,
30
- gitBranch: gitInfo.branch,
31
- hash
32
- };
33
- }
34
- async function getGitInfo(projectPath) {
35
- try {
36
- const gitDir = join(projectPath, ".git");
37
- if (!existsSync(gitDir)) {
38
- return {};
39
- }
40
- let remote;
41
- try {
42
- const remoteResult = await q("git", ["remote", "get-url", "origin"], {
43
- nodeOptions: { cwd: projectPath }
44
- });
45
- remote = remoteResult.stdout?.trim();
46
- } catch {
47
- }
48
- let branch;
49
- try {
50
- const branchResult = await q("git", ["rev-parse", "--abbrev-ref", "HEAD"], {
51
- nodeOptions: { cwd: projectPath }
52
- });
53
- branch = branchResult.stdout?.trim();
54
- } catch {
55
- }
56
- return { remote, branch };
57
- } catch {
58
- return {};
59
- }
60
- }
61
- class ProjectHashCache {
62
- cache = /* @__PURE__ */ new Map();
63
- cacheTimeout = 5 * 60 * 1e3;
64
- // 5 minutes
65
- timestamps = /* @__PURE__ */ new Map();
66
- /**
67
- * Get or generate project identity
68
- *
69
- * @param projectPath - Project directory path
70
- * @param forceRefresh - Force cache refresh
71
- * @returns Project identity
72
- */
73
- async get(projectPath, forceRefresh = false) {
74
- let normalizedPath = normalize(projectPath);
75
- normalizedPath = normalizedPath.replace(/[/\\]+$/, "");
76
- const now = Date.now();
77
- const timestamp = this.timestamps.get(normalizedPath);
78
- if (!forceRefresh && timestamp && now - timestamp < this.cacheTimeout) {
79
- const cached = this.cache.get(normalizedPath);
80
- if (cached) {
81
- return cached;
82
- }
83
- }
84
- const identity = await generateProjectHash(normalizedPath);
85
- this.cache.set(normalizedPath, identity);
86
- this.timestamps.set(normalizedPath, now);
87
- return identity;
88
- }
89
- /**
90
- * Clear cache for specific project or all projects
91
- *
92
- * @param projectPath - Optional project path to clear
93
- */
94
- clear(projectPath) {
95
- if (projectPath) {
96
- let normalizedPath = normalize(projectPath);
97
- normalizedPath = normalizedPath.replace(/[/\\]+$/, "");
98
- this.cache.delete(normalizedPath);
99
- this.timestamps.delete(normalizedPath);
100
- } else {
101
- this.cache.clear();
102
- this.timestamps.clear();
103
- }
104
- }
105
- /**
106
- * Get cache statistics
107
- */
108
- getStats() {
109
- const timestamps = Array.from(this.timestamps.values());
110
- return {
111
- size: this.cache.size,
112
- oldestEntry: timestamps.length > 0 ? Math.min(...timestamps) : void 0
113
- };
114
- }
115
- }
116
- const projectHashCache = new ProjectHashCache();
117
- async function getProjectIdentity(projectPath, forceRefresh = false) {
118
- return projectHashCache.get(projectPath, forceRefresh);
119
- }
120
-
121
- const DB_PATH = join(homedir(), ".ccjk", "context", "contexts.db");
122
- const WAL_PATH = `${DB_PATH}-wal`;
123
- const BACKUP_DIR = join(homedir(), ".ccjk", "context", "backups");
124
- const WAL_SIZE_WARNING = 10 * 1024 * 1024;
125
- const WAL_SIZE_CRITICAL = 50 * 1024 * 1024;
126
- const DB_SIZE_WARNING = 100 * 1024 * 1024;
127
- const DB_SIZE_CRITICAL = 500 * 1024 * 1024;
128
- function label(text) {
129
- return a.gray(text);
130
- }
131
- function val(text) {
132
- return a.white(text);
133
- }
134
- function heading(text) {
135
- return a.cyan.bold(text);
136
- }
137
- function divider() {
138
- return a.gray("\u2500".repeat(50));
139
- }
140
- function formatBytes(bytes) {
141
- if (bytes === 0) return "0 B";
142
- const k = 1024;
143
- const sizes = ["B", "KB", "MB", "GB"];
144
- const i = Math.floor(Math.log(bytes) / Math.log(k));
145
- return `${(bytes / Math.pow(k, i)).toFixed(2)} ${sizes[i]}`;
146
- }
147
- function formatNumber(num) {
148
- return num.toLocaleString();
149
- }
150
- function formatPercentage(ratio) {
151
- return `${(ratio * 100).toFixed(1)}%`;
152
- }
153
- function formatDate(timestamp) {
154
- const date = new Date(timestamp);
155
- const now = Date.now();
156
- 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`;
161
- return date.toLocaleDateString();
162
- }
163
- function statusIcon(status) {
164
- switch (status) {
165
- case "green":
166
- return a.green("\u25CF");
167
- case "yellow":
168
- return a.yellow("\u25CF");
169
- case "red":
170
- return a.red("\u25CF");
171
- }
172
- }
173
- async function collectDashboardData() {
174
- const isZh = i18n.language === "zh-CN";
175
- const data = {
176
- compression: {
177
- sessionSavings: 0,
178
- weeklySavings: 0,
179
- monthlySavings: 0,
180
- compressionRatio: 0
181
- },
182
- persistence: {
183
- totalContexts: 0,
184
- databaseSize: 0
185
- },
186
- health: {
187
- status: "green",
188
- message: isZh ? "\u6570\u636E\u5E93\u5065\u5EB7" : "Database healthy",
189
- details: []
190
- },
191
- wal: {
192
- size: 0,
193
- needsCheckpoint: false,
194
- message: isZh ? "WAL \u6B63\u5E38" : "WAL normal"
195
- },
196
- tiers: {
197
- hot: 0,
198
- warm: 0,
199
- cold: 0
200
- },
201
- cacheHitRate: 0,
202
- recommendations: []
203
- };
204
- try {
205
- const { getContextPersistence } = await import('./persistence.mjs');
206
- const persistence = getContextPersistence();
207
- const stats = persistence.getStats();
208
- data.persistence.totalContexts = stats.totalContexts;
209
- data.persistence.databaseSize = stats.totalSize;
210
- if (stats.totalOriginalTokens > 0) {
211
- const tokensSaved = stats.totalOriginalTokens - stats.totalCompressedTokens;
212
- data.compression.compressionRatio = stats.averageCompressionRatio;
213
- const oneHourAgo = Date.now() - 36e5;
214
- const recentContexts = persistence.queryContexts({
215
- startTime: oneHourAgo
216
- });
217
- data.compression.sessionSavings = recentContexts.reduce(
218
- (sum, ctx) => sum + (ctx.originalTokens - ctx.compressedTokens),
219
- 0
220
- );
221
- const oneWeekAgo = Date.now() - 6048e5;
222
- const weeklyContexts = persistence.queryContexts({
223
- startTime: oneWeekAgo
224
- });
225
- data.compression.weeklySavings = weeklyContexts.reduce(
226
- (sum, ctx) => sum + (ctx.originalTokens - ctx.compressedTokens),
227
- 0
228
- );
229
- const oneMonthAgo = Date.now() - 2592e6;
230
- const monthlyContexts = persistence.queryContexts({
231
- startTime: oneMonthAgo
232
- });
233
- data.compression.monthlySavings = monthlyContexts.reduce(
234
- (sum, ctx) => sum + (ctx.originalTokens - ctx.compressedTokens),
235
- 0
236
- );
237
- }
238
- try {
239
- const projectIdentity = await getProjectIdentity(process__default.cwd());
240
- const projectHash = projectIdentity.hash;
241
- const hotContexts = persistence.getHotContexts(projectHash, 100);
242
- const warmContexts = persistence.getWarmContexts(projectHash, 100);
243
- const coldContexts = persistence.getColdContexts(projectHash, 100);
244
- data.tiers.hot = hotContexts.length;
245
- data.tiers.warm = warmContexts.length;
246
- data.tiers.cold = coldContexts.length;
247
- } catch {
248
- }
249
- data.cacheHitRate = 0.75;
250
- } catch {
251
- }
252
- data.health = checkDatabaseHealth(data.persistence.databaseSize);
253
- data.wal = checkWalStatus();
254
- data.recommendations = generateRecommendations(data);
255
- return data;
256
- }
257
- function checkDatabaseHealth(dbSize) {
258
- const isZh = i18n.language === "zh-CN";
259
- if (!existsSync(DB_PATH)) {
260
- return {
261
- status: "yellow",
262
- message: isZh ? "\u6570\u636E\u5E93\u672A\u521D\u59CB\u5316" : "Database not initialized",
263
- details: [isZh ? "\u9996\u6B21\u4F7F\u7528\u65F6\u4F1A\u81EA\u52A8\u521B\u5EFA" : "Will be created on first use"]
264
- };
265
- }
266
- if (dbSize > DB_SIZE_CRITICAL) {
267
- return {
268
- status: "red",
269
- message: isZh ? "\u6570\u636E\u5E93\u8FC7\u5927" : "Database too large",
270
- details: [
271
- isZh ? `\u5F53\u524D\u5927\u5C0F: ${formatBytes(dbSize)}` : `Current size: ${formatBytes(dbSize)}`,
272
- isZh ? "\u5EFA\u8BAE\u8FD0\u884C VACUUM \u6E05\u7406" : "Recommend running VACUUM"
273
- ]
274
- };
275
- }
276
- if (dbSize > DB_SIZE_WARNING) {
277
- return {
278
- status: "yellow",
279
- message: isZh ? "\u6570\u636E\u5E93\u8F83\u5927" : "Database size warning",
280
- details: [
281
- isZh ? `\u5F53\u524D\u5927\u5C0F: ${formatBytes(dbSize)}` : `Current size: ${formatBytes(dbSize)}`,
282
- isZh ? "\u8003\u8651\u6E05\u7406\u65E7\u6570\u636E" : "Consider cleaning old data"
283
- ]
284
- };
285
- }
286
- return {
287
- status: "green",
288
- message: isZh ? "\u6570\u636E\u5E93\u5065\u5EB7" : "Database healthy",
289
- details: [isZh ? `\u5927\u5C0F: ${formatBytes(dbSize)}` : `Size: ${formatBytes(dbSize)}`]
290
- };
291
- }
292
- function checkWalStatus() {
293
- const isZh = i18n.language === "zh-CN";
294
- if (!existsSync(WAL_PATH)) {
295
- return {
296
- size: 0,
297
- needsCheckpoint: false,
298
- message: isZh ? "WAL \u6B63\u5E38" : "WAL normal"
299
- };
300
- }
301
- const walSize = statSync(WAL_PATH).size;
302
- if (walSize > WAL_SIZE_CRITICAL) {
303
- return {
304
- size: walSize,
305
- needsCheckpoint: true,
306
- message: isZh ? "WAL \u8FC7\u5927\uFF0C\u9700\u8981\u68C0\u67E5\u70B9" : "WAL too large, checkpoint needed"
307
- };
308
- }
309
- if (walSize > WAL_SIZE_WARNING) {
310
- return {
311
- size: walSize,
312
- needsCheckpoint: true,
313
- message: isZh ? "WAL \u8F83\u5927\uFF0C\u5EFA\u8BAE\u68C0\u67E5\u70B9" : "WAL size warning, checkpoint recommended"
314
- };
315
- }
316
- return {
317
- size: walSize,
318
- needsCheckpoint: false,
319
- message: isZh ? "WAL \u6B63\u5E38" : "WAL normal"
320
- };
321
- }
322
- function generateRecommendations(data) {
323
- const isZh = i18n.language === "zh-CN";
324
- const recommendations = [];
325
- if (data.health.status === "red") {
326
- recommendations.push({
327
- priority: "high",
328
- title: isZh ? "\u6E05\u7406\u6570\u636E\u5E93" : "Clean database",
329
- description: isZh ? "\u6570\u636E\u5E93\u8FC7\u5927\uFF0C\u8FD0\u884C VACUUM \u56DE\u6536\u7A7A\u95F4" : "Database too large, run VACUUM to reclaim space",
330
- command: "ccjk brain vacuum"
331
- });
332
- }
333
- if (data.wal.needsCheckpoint) {
334
- recommendations.push({
335
- priority: data.wal.size > WAL_SIZE_CRITICAL ? "high" : "medium",
336
- title: isZh ? "\u6267\u884C\u68C0\u67E5\u70B9" : "Run checkpoint",
337
- description: isZh ? "WAL \u6587\u4EF6\u8FC7\u5927\uFF0C\u6267\u884C\u68C0\u67E5\u70B9\u5408\u5E76\u5230\u4E3B\u6570\u636E\u5E93" : "WAL file too large, run checkpoint to merge into main database",
338
- command: "ccjk brain checkpoint"
339
- });
340
- }
341
- if (!existsSync(BACKUP_DIR) || data.persistence.totalContexts > 100) {
342
- const lastBackup = data.persistence.lastBackup;
343
- const needsBackup = !lastBackup || Date.now() - lastBackup > 6048e5;
344
- if (needsBackup) {
345
- recommendations.push({
346
- priority: "medium",
347
- title: isZh ? "\u5907\u4EFD\u6570\u636E\u5E93" : "Backup database",
348
- description: isZh ? "\u5EFA\u8BAE\u5B9A\u671F\u5907\u4EFD\u4E0A\u4E0B\u6587\u6570\u636E\u5E93" : "Recommend regular database backups",
349
- command: "ccjk brain backup"
350
- });
351
- }
352
- }
353
- if (data.compression.compressionRatio < 0.3 && data.persistence.totalContexts > 10) {
354
- recommendations.push({
355
- priority: "low",
356
- title: isZh ? "\u4F18\u5316\u538B\u7F29\u7B56\u7565" : "Optimize compression",
357
- description: isZh ? "\u538B\u7F29\u7387\u8F83\u4F4E\uFF0C\u8003\u8651\u8C03\u6574\u538B\u7F29\u7B56\u7565" : "Low compression ratio, consider adjusting strategy",
358
- command: "ccjk brain config"
359
- });
360
- }
361
- return recommendations;
362
- }
363
- function renderCompressionSection(data) {
364
- const isZh = i18n.language === "zh-CN";
365
- const lines = [];
366
- lines.push(heading(isZh ? "\u{1F4CA} \u538B\u7F29\u6307\u6807" : "\u{1F4CA} Compression Metrics"));
367
- lines.push("");
368
- if (data.persistence.totalContexts === 0) {
369
- lines.push(` ${a.gray(isZh ? "\u6682\u65E0\u538B\u7F29\u6570\u636E" : "No compression data yet")}`);
370
- return lines;
371
- }
372
- lines.push(` ${label((isZh ? "\u4F1A\u8BDD\u8282\u7701:" : "Session savings:").padEnd(20))} ${val(formatNumber(data.compression.sessionSavings))} ${a.gray("tokens")}`);
373
- lines.push(` ${label((isZh ? "\u672C\u5468\u8282\u7701:" : "Weekly savings:").padEnd(20))} ${val(formatNumber(data.compression.weeklySavings))} ${a.gray("tokens")}`);
374
- lines.push(` ${label((isZh ? "\u672C\u6708\u8282\u7701:" : "Monthly savings:").padEnd(20))} ${val(formatNumber(data.compression.monthlySavings))} ${a.gray("tokens")}`);
375
- lines.push(` ${label((isZh ? "\u538B\u7F29\u7387:" : "Compression ratio:").padEnd(20))} ${val(formatPercentage(data.compression.compressionRatio))}`);
376
- return lines;
377
- }
378
- function renderPersistenceSection(data) {
379
- const isZh = i18n.language === "zh-CN";
380
- const lines = [];
381
- lines.push(heading(isZh ? "\u{1F4BE} \u6301\u4E45\u5316\u7EDF\u8BA1" : "\u{1F4BE} Persistence Stats"));
382
- lines.push("");
383
- lines.push(` ${label((isZh ? "\u5B58\u50A8\u4E0A\u4E0B\u6587:" : "Stored contexts:").padEnd(20))} ${val(formatNumber(data.persistence.totalContexts))}`);
384
- lines.push(` ${label((isZh ? "\u6570\u636E\u5E93\u5927\u5C0F:" : "Database size:").padEnd(20))} ${val(formatBytes(data.persistence.databaseSize))}`);
385
- if (data.persistence.lastBackup) {
386
- lines.push(` ${label((isZh ? "\u6700\u540E\u5907\u4EFD:" : "Last backup:").padEnd(20))} ${val(formatDate(data.persistence.lastBackup))}`);
387
- } else {
388
- lines.push(` ${label((isZh ? "\u6700\u540E\u5907\u4EFD:" : "Last backup:").padEnd(20))} ${a.gray(isZh ? "\u4ECE\u672A\u5907\u4EFD" : "Never")}`);
389
- }
390
- return lines;
391
- }
392
- function renderHealthSection(data) {
393
- const isZh = i18n.language === "zh-CN";
394
- const lines = [];
395
- lines.push(heading(isZh ? "\u{1F3E5} \u5065\u5EB7\u72B6\u6001" : "\u{1F3E5} Health Status"));
396
- lines.push("");
397
- lines.push(` ${label((isZh ? "\u6570\u636E\u5E93\u5B8C\u6574\u6027:" : "Database integrity:").padEnd(20))} ${statusIcon(data.health.status)} ${val(data.health.message)}`);
398
- for (const detail of data.health.details) {
399
- lines.push(` ${a.gray(detail)}`);
400
- }
401
- lines.push(` ${label((isZh ? "WAL \u72B6\u6001:" : "WAL status:").padEnd(20))} ${statusIcon(data.wal.needsCheckpoint ? "yellow" : "green")} ${val(data.wal.message)}`);
402
- if (data.wal.size > 0) {
403
- lines.push(` ${a.gray(`${isZh ? "\u5927\u5C0F" : "Size"}: ${formatBytes(data.wal.size)}`)}`);
404
- }
405
- const diskStatus = data.persistence.databaseSize > DB_SIZE_WARNING ? "yellow" : "green";
406
- lines.push(` ${label((isZh ? "\u78C1\u76D8\u4F7F\u7528:" : "Disk utilization:").padEnd(20))} ${statusIcon(diskStatus)} ${val(formatBytes(data.persistence.databaseSize))}`);
407
- return lines;
408
- }
409
- function renderTierSection(data) {
410
- const isZh = i18n.language === "zh-CN";
411
- const lines = [];
412
- lines.push(heading(isZh ? "\u{1F525} \u5C42\u7EA7\u5206\u5E03" : "\u{1F525} Tier Distribution"));
413
- lines.push("");
414
- const total = data.tiers.hot + data.tiers.warm + data.tiers.cold;
415
- if (total === 0) {
416
- lines.push(` ${a.gray(isZh ? "\u6682\u65E0\u5C42\u7EA7\u6570\u636E" : "No tier data yet")}`);
417
- return lines;
418
- }
419
- lines.push(` ${label((isZh ? "L0 (\u70ED):" : "L0 (Hot):").padEnd(20))} ${val(formatNumber(data.tiers.hot))} ${a.gray(`(${formatPercentage(data.tiers.hot / total)})`)}`);
420
- lines.push(` ${label((isZh ? "L1 (\u6E29):" : "L1 (Warm):").padEnd(20))} ${val(formatNumber(data.tiers.warm))} ${a.gray(`(${formatPercentage(data.tiers.warm / total)})`)}`);
421
- lines.push(` ${label((isZh ? "L2 (\u51B7):" : "L2 (Cold):").padEnd(20))} ${val(formatNumber(data.tiers.cold))} ${a.gray(`(${formatPercentage(data.tiers.cold / total)})`)}`);
422
- lines.push(` ${label((isZh ? "\u7F13\u5B58\u547D\u4E2D\u7387:" : "Cache hit rate:").padEnd(20))} ${val(formatPercentage(data.cacheHitRate))}`);
423
- return lines;
424
- }
425
- function renderRecommendationsSection(data) {
426
- const isZh = i18n.language === "zh-CN";
427
- const lines = [];
428
- if (data.recommendations.length === 0) {
429
- return lines;
430
- }
431
- lines.push("");
432
- lines.push(a.yellow.bold(isZh ? "\u{1F4A1} \u5EFA\u8BAE" : "\u{1F4A1} Recommendations"));
433
- lines.push("");
434
- for (const rec of data.recommendations) {
435
- const priority = rec.priority === "high" ? a.red("!") : rec.priority === "medium" ? a.yellow("\u2022") : a.gray("\xB7");
436
- lines.push(` ${priority} ${a.bold(rec.title)}`);
437
- lines.push(` ${a.gray(rec.description)}`);
438
- if (rec.command) {
439
- lines.push(` ${a.gray("\u2192")} ${a.cyan(rec.command)}`);
440
- }
441
- }
442
- return lines;
443
- }
444
- async function dashboardCommand(options = {}) {
445
- try {
446
- const data = await collectDashboardData();
447
- if (options.json) {
448
- console.log(JSON.stringify(data, null, 2));
449
- return;
450
- }
451
- const sections = [];
452
- sections.push(renderCompressionSection(data));
453
- sections.push(renderPersistenceSection(data));
454
- sections.push(renderHealthSection(data));
455
- sections.push(renderTierSection(data));
456
- const recommendations = renderRecommendationsSection(data);
457
- if (recommendations.length > 0) {
458
- sections.push(recommendations);
459
- }
460
- console.log();
461
- for (let i = 0; i < sections.length; i++) {
462
- console.log(sections[i].join("\n"));
463
- if (i < sections.length - 1) {
464
- console.log();
465
- console.log(divider());
466
- console.log();
467
- }
468
- }
469
- console.log();
470
- } catch (error) {
471
- console.error(a.red("Error running dashboard command:"), error);
472
- process__default.exit(1);
473
- }
474
- }
475
-
476
- export { dashboardCommand };