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,194 +0,0 @@
1
- import { existsSync } from 'node:fs';
2
- import { readFile, writeFile } from 'node:fs/promises';
3
- import { homedir } from 'node:os';
4
- import { j as join } from '../shared/ccjk.bQ7Dh1g4.mjs';
5
-
6
- const QUICK_ACTIONS = [
7
- {
8
- id: 1,
9
- name: "Smart Commit",
10
- nameZh: "\u667A\u80FD\u63D0\u4EA4",
11
- icon: "\u{1F4DD}",
12
- description: "Auto-generate commit message",
13
- descriptionZh: "\u81EA\u52A8\u751F\u6210 commit \u6D88\u606F",
14
- command: "/commit",
15
- autoActivate: true,
16
- triggers: ["commit", "git", "push", "save", "\u63D0\u4EA4", "\u4FDD\u5B58"]
17
- },
18
- {
19
- id: 2,
20
- name: "Code Review",
21
- nameZh: "\u4EE3\u7801\u5BA1\u67E5",
22
- icon: "\u{1F50D}",
23
- description: "Deep two-stage code review",
24
- descriptionZh: "\u6DF1\u5EA6\u4E24\u9636\u6BB5\u4EE3\u7801\u5BA1\u67E5",
25
- command: "/review",
26
- autoActivate: true,
27
- triggers: ["review", "check", "pr", "merge", "\u5BA1\u67E5", "\u68C0\u67E5", "\u5408\u5E76"]
28
- },
29
- {
30
- id: 3,
31
- name: "Write Tests",
32
- nameZh: "\u7F16\u5199\u6D4B\u8BD5",
33
- icon: "\u{1F9EA}",
34
- description: "TDD workflow",
35
- descriptionZh: "TDD \u5DE5\u4F5C\u6D41",
36
- command: "/tdd",
37
- autoActivate: true,
38
- triggers: ["test", "tdd", "unit", "spec", "\u6D4B\u8BD5", "\u5355\u5143\u6D4B\u8BD5"]
39
- },
40
- {
41
- id: 4,
42
- name: "Plan Feature",
43
- nameZh: "\u89C4\u5212\u529F\u80FD",
44
- icon: "\u{1F4CB}",
45
- description: "6-step development workflow",
46
- descriptionZh: "6\u6B65\u5F00\u53D1\u6D41\u7A0B",
47
- command: "/workflow",
48
- autoActivate: true,
49
- triggers: ["plan", "feature", "implement", "build", "create", "\u89C4\u5212", "\u529F\u80FD", "\u5B9E\u73B0", "\u521B\u5EFA"]
50
- },
51
- {
52
- id: 5,
53
- name: "Debug Issue",
54
- nameZh: "\u8C03\u8BD5\u95EE\u9898",
55
- icon: "\u{1F41B}",
56
- description: "Systematic debugging",
57
- descriptionZh: "\u7CFB\u7EDF\u6027\u8C03\u8BD5",
58
- command: "/debug",
59
- autoActivate: true,
60
- triggers: ["debug", "bug", "error", "fix", "issue", "problem", "\u8C03\u8BD5", "\u9519\u8BEF", "\u4FEE\u590D", "\u95EE\u9898"]
61
- },
62
- {
63
- id: 6,
64
- name: "Brainstorm",
65
- nameZh: "\u5934\u8111\u98CE\u66B4",
66
- icon: "\u{1F4A1}",
67
- description: "Explore ideas and solutions",
68
- descriptionZh: "\u63A2\u7D22\u60F3\u6CD5\u548C\u65B9\u6848",
69
- command: "/brainstorm",
70
- autoActivate: true,
71
- triggers: ["brainstorm", "idea", "design", "think", "explore", "\u5934\u8111\u98CE\u66B4", "\u60F3\u6CD5", "\u8BBE\u8BA1", "\u63A2\u7D22"]
72
- },
73
- {
74
- id: 7,
75
- name: "Verify Code",
76
- nameZh: "\u9A8C\u8BC1\u4EE3\u7801",
77
- icon: "\u2705",
78
- description: "Quality verification",
79
- descriptionZh: "\u8D28\u91CF\u9A8C\u8BC1",
80
- command: "/verify",
81
- autoActivate: true,
82
- triggers: ["verify", "validate", "quality", "deploy", "\u9A8C\u8BC1", "\u8D28\u91CF", "\u90E8\u7F72"]
83
- },
84
- {
85
- id: 8,
86
- name: "Write Docs",
87
- nameZh: "\u5199\u6587\u6863",
88
- icon: "\u{1F4D6}",
89
- description: "Generate documentation",
90
- descriptionZh: "\u751F\u6210\u6587\u6863",
91
- command: "/docs",
92
- autoActivate: false,
93
- triggers: ["doc", "docs", "readme", "documentation", "\u6587\u6863", "\u8BF4\u660E"]
94
- }
95
- ];
96
- function generateQuickActionsPanel(lang = "en") {
97
- const isZh = lang === "zh-CN";
98
- const title = isZh ? "\u{1F4A1} \u5FEB\u6377\u64CD\u4F5C\uFF08\u8F93\u5165\u6570\u5B57\u6267\u884C\uFF09\uFF1A" : "\u{1F4A1} Quick Actions (type number to execute):";
99
- const lines = [
100
- title,
101
- "\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510"
102
- ];
103
- for (const action of QUICK_ACTIONS) {
104
- const name = isZh ? action.nameZh : action.name;
105
- const desc = isZh ? action.descriptionZh : action.description;
106
- const line = `\u2502 ${action.id}. ${action.icon} ${name.padEnd(10)} - ${desc.padEnd(16)} \u2502`;
107
- lines.push(line);
108
- }
109
- lines.push("\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518");
110
- lines.push(isZh ? "\u8F93\u5165\u6570\u5B57 (1-8) \u6216\u63CF\u8FF0\u4F60\u7684\u4EFB\u52A1..." : "Type number (1-8) or describe your task...");
111
- return lines.join("\n");
112
- }
113
- function generateSmartGuideDirective(lang = "en") {
114
- const isZh = lang === "zh-CN";
115
- const directive = isZh ? `
116
- ## \u{1F3AF} CCJK \u667A\u80FD\u52A9\u624B\u6A21\u5F0F
117
-
118
- ### \u5BF9\u8BDD\u5F00\u59CB\u65F6
119
- \u5728\u6BCF\u6B21\u5BF9\u8BDD\u5F00\u59CB\u65F6\uFF0C\u663E\u793A\u5FEB\u6377\u64CD\u4F5C\u9762\u677F\uFF1A
120
-
121
- \`\`\`
122
- ${generateQuickActionsPanel("zh-CN")}
123
- \`\`\`
124
-
125
- ### \u6570\u5B57\u8F93\u5165\u5904\u7406
126
- \u5F53\u7528\u6237\u8F93\u5165\u5355\u4E2A\u6570\u5B57 (1-8) \u65F6\uFF0C\u81EA\u52A8\u6267\u884C\u5BF9\u5E94\u6280\u80FD\uFF1A
127
- ${QUICK_ACTIONS.map((a) => `- **${a.id}** \u2192 \u6267\u884C ${a.command} (${a.nameZh})`).join("\n")}
128
-
129
- ### \u667A\u80FD\u573A\u666F\u611F\u77E5
130
- \u6839\u636E\u7528\u6237\u8F93\u5165\u81EA\u52A8\u63A8\u8350\uFF1A
131
- - \u63D0\u5230"\u63D0\u4EA4/commit/push" \u2192 \u63A8\u8350\u8F93\u5165 **1**
132
- - \u63D0\u5230"\u5BA1\u67E5/review/\u68C0\u67E5" \u2192 \u63A8\u8350\u8F93\u5165 **2**
133
- - \u63D0\u5230"\u6D4B\u8BD5/test/tdd" \u2192 \u63A8\u8350\u8F93\u5165 **3**
134
- - \u63D0\u5230"\u529F\u80FD/feature/\u5B9E\u73B0" \u2192 \u63A8\u8350\u8F93\u5165 **4**
135
- - \u63D0\u5230"bug/\u9519\u8BEF/\u4FEE\u590D" \u2192 \u63A8\u8350\u8F93\u5165 **5**
136
- - \u63D0\u5230"\u60F3\u6CD5/\u8BBE\u8BA1/\u65B9\u6848" \u2192 \u63A8\u8350\u8F93\u5165 **6**
137
-
138
- ### \u5E2E\u52A9\u547D\u4EE4
139
- - \u7528\u6237\u8BF4"\u66F4\u591A"\u6216"\u5E2E\u52A9" \u2192 \u663E\u793A\u5B8C\u6574\u6280\u80FD\u5217\u8868
140
- - \u7528\u6237\u8BF4"?" \u2192 \u663E\u793A\u5FEB\u6377\u64CD\u4F5C\u9762\u677F
141
- ` : `
142
- ## \u{1F3AF} CCJK Smart Assistant Mode
143
-
144
- ### At Conversation Start
145
- Display quick actions panel at the start of each conversation:
146
-
147
- \`\`\`
148
- ${generateQuickActionsPanel("en")}
149
- \`\`\`
150
-
151
- ### Number Input Handling
152
- When user types a single number (1-8), automatically execute the corresponding skill:
153
- ${QUICK_ACTIONS.map((a) => `- **${a.id}** \u2192 Execute ${a.command} (${a.name})`).join("\n")}
154
-
155
- ### Intelligent Context Detection
156
- Auto-suggest based on user input:
157
- - Mentions "commit/push/save" \u2192 Suggest typing **1**
158
- - Mentions "review/check/pr" \u2192 Suggest typing **2**
159
- - Mentions "test/tdd/spec" \u2192 Suggest typing **3**
160
- - Mentions "feature/implement/build" \u2192 Suggest typing **4**
161
- - Mentions "bug/error/fix" \u2192 Suggest typing **5**
162
- - Mentions "idea/design/explore" \u2192 Suggest typing **6**
163
-
164
- ### Help Commands
165
- - User says "more" or "help" \u2192 Show full skill list
166
- - User says "?" \u2192 Show quick actions panel
167
- `;
168
- return directive;
169
- }
170
- function getClaudeMdPath() {
171
- return join(homedir(), ".claude", "CLAUDE.md");
172
- }
173
- async function injectSmartGuide(lang = "en") {
174
- const claudeMdPath = getClaudeMdPath();
175
- try {
176
- let content = "";
177
- if (existsSync(claudeMdPath)) {
178
- content = await readFile(claudeMdPath, "utf-8");
179
- if (content.includes("CCJK \u667A\u80FD\u52A9\u624B\u6A21\u5F0F") || content.includes("CCJK Smart Assistant Mode")) {
180
- content = content.replace(/\n## 🎯 CCJK (智能助手模式|Smart Assistant Mode)[\s\S]*?(?=\n## |$)/g, "");
181
- }
182
- }
183
- const directive = generateSmartGuideDirective(lang);
184
- content = `${content.trim()}
185
- ${directive}`;
186
- await writeFile(claudeMdPath, content, "utf-8");
187
- return true;
188
- } catch (error) {
189
- console.error("Failed to inject smart guide:", error);
190
- return false;
191
- }
192
- }
193
-
194
- export { QUICK_ACTIONS, generateQuickActionsPanel, generateSmartGuideDirective, injectSmartGuide };
@@ -1,487 +0,0 @@
1
- import { existsSync, mkdirSync, writeFileSync, readFileSync, readdirSync } from 'node:fs';
2
- import { mkdir } from 'node:fs/promises';
3
- import { homedir } from 'node:os';
4
- import { j as join, b as basename } from '../shared/ccjk.bQ7Dh1g4.mjs';
5
- import { i18n } from './index5.mjs';
6
- import 'node:process';
7
- import 'node:url';
8
-
9
- const DEFAULT_COMPACT_CONFIG = {
10
- warningThreshold: 0.7,
11
- // 70% 时警告
12
- compactThreshold: 0.85,
13
- // 85% 时建议清理
14
- messageThreshold: 100,
15
- // 100 条消息
16
- planningMessageThreshold: 50,
17
- // Plan 阶段 50 条消息
18
- defaultMaxTokens: 2e5
19
- // 200k tokens (Claude 3.5 Sonnet)
20
- };
21
- class CompactAdvisor {
22
- config;
23
- constructor(config = {}) {
24
- this.config = { ...DEFAULT_COMPACT_CONFIG, ...config };
25
- }
26
- /**
27
- * 检测是否需要建议 compact
28
- */
29
- shouldSuggestCompact(context) {
30
- const maxTokens = context.maxTokens || this.config.defaultMaxTokens;
31
- const usagePercent = context.currentTokens / maxTokens;
32
- if (usagePercent >= this.config.compactThreshold) {
33
- return {
34
- shouldCompact: true,
35
- reason: "token_threshold",
36
- message: this.getTokenThresholdMessage(usagePercent, context.currentTokens, maxTokens),
37
- usagePercent,
38
- estimatedSavings: Math.floor(context.currentTokens * 0.6),
39
- // 预计节省 60%
40
- suggestedActions: this.getSuggestedActions("token_threshold")
41
- };
42
- }
43
- if (context.messageCount >= this.config.messageThreshold) {
44
- return {
45
- shouldCompact: true,
46
- reason: "message_threshold",
47
- message: this.getMessageThresholdMessage(context.messageCount),
48
- usagePercent,
49
- estimatedSavings: Math.floor(context.currentTokens * 0.5),
50
- suggestedActions: this.getSuggestedActions("message_threshold")
51
- };
52
- }
53
- if (usagePercent >= this.config.warningThreshold) {
54
- return {
55
- shouldCompact: false,
56
- message: this.getWarningMessage(usagePercent, context.currentTokens, maxTokens),
57
- usagePercent,
58
- suggestedActions: []
59
- };
60
- }
61
- return {
62
- shouldCompact: false,
63
- message: this.getHealthyMessage(usagePercent),
64
- usagePercent,
65
- suggestedActions: []
66
- };
67
- }
68
- /**
69
- * 检测 Plan 阶段完成
70
- */
71
- detectPlanCompletion(planContent) {
72
- const completionPatterns = [
73
- /##\s*(实施计划|Implementation Plan|执行计划)/i,
74
- /##\s*(任务(清单|列表)|Task List|Tasks)/i,
75
- /##\s*(验收标准|Acceptance Criteria)/i,
76
- /✅\s*(规划完成|Plan Complete|Planning Complete)/i,
77
- /---[\t\v\f\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*\n\s*💡\s*(下一步|Next Step)/i
78
- ];
79
- return completionPatterns.some((pattern) => pattern.test(planContent));
80
- }
81
- /**
82
- * 生成 Plan 完成后的建议
83
- */
84
- generatePlanCompleteSuggestion(plan, context) {
85
- const maxTokens = context.maxTokens || this.config.defaultMaxTokens;
86
- const usagePercent = context.currentTokens / maxTokens;
87
- const planningMessages = context.planningMessageCount || 0;
88
- const shouldCompact = planningMessages >= this.config.planningMessageThreshold || usagePercent >= 0.3;
89
- return {
90
- shouldCompact,
91
- reason: "plan_complete",
92
- message: this.getPlanCompleteMessage(plan, context, usagePercent),
93
- usagePercent,
94
- estimatedSavings: Math.floor(context.currentTokens * 0.7),
95
- // Plan 阶段可节省 70%
96
- suggestedActions: this.getSuggestedActions("plan_complete")
97
- };
98
- }
99
- /**
100
- * 生成建议输出(用于显示给用户)
101
- */
102
- generateSuggestionOutput(suggestion, planPath) {
103
- const lines = [];
104
- const isZh = i18n.language === "zh-CN";
105
- lines.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501");
106
- if (suggestion.reason === "plan_complete") {
107
- lines.push(isZh ? "\u2705 \u89C4\u5212\u5B8C\u6210\uFF01" : "\u2705 Planning Complete!");
108
- } else if (suggestion.shouldCompact) {
109
- lines.push(isZh ? "\u26A0\uFE0F \u4E0A\u4E0B\u6587\u4F7F\u7528\u7387\u8F83\u9AD8" : "\u26A0\uFE0F High Context Usage");
110
- } else {
111
- lines.push(isZh ? "\u{1F4CA} \u4E0A\u4E0B\u6587\u72B6\u6001" : "\u{1F4CA} Context Status");
112
- }
113
- lines.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501");
114
- lines.push("");
115
- if (planPath) {
116
- lines.push(isZh ? `\u{1F4C4} Plan \u5DF2\u4FDD\u5B58: ${planPath}` : `\u{1F4C4} Plan saved: ${planPath}`);
117
- lines.push("");
118
- }
119
- lines.push(isZh ? "\u{1F4CA} \u5F53\u524D\u4E0A\u4E0B\u6587\u72B6\u6001:" : "\u{1F4CA} Current context status:");
120
- lines.push(` \u2022 Token ${isZh ? "\u4F7F\u7528" : "usage"}: ${(suggestion.usagePercent * 100).toFixed(1)}%`);
121
- if (suggestion.estimatedSavings) {
122
- lines.push(` \u2022 ${isZh ? "\u9884\u8BA1\u53EF\u8282\u7701" : "Estimated savings"}: ~${this.formatTokens(suggestion.estimatedSavings)} tokens`);
123
- }
124
- lines.push("");
125
- lines.push(suggestion.message);
126
- lines.push("");
127
- if (suggestion.shouldCompact && suggestion.suggestedActions.length > 0) {
128
- lines.push(isZh ? "\u{1F4A1} \u5EFA\u8BAE\u64CD\u4F5C:" : "\u{1F4A1} Suggested actions:");
129
- lines.push("");
130
- for (let i = 0; i < suggestion.suggestedActions.length; i++) {
131
- lines.push(` [${i + 1}] ${suggestion.suggestedActions[i]}`);
132
- }
133
- lines.push("");
134
- }
135
- lines.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501");
136
- return lines.join("\n");
137
- }
138
- // ==========================================================================
139
- // Private Helpers
140
- // ==========================================================================
141
- getTokenThresholdMessage(usagePercent, current, max) {
142
- const isZh = i18n.language === "zh-CN";
143
- const percent = (usagePercent * 100).toFixed(1);
144
- if (isZh) {
145
- return `\u4E0A\u4E0B\u6587\u4F7F\u7528\u7387\u5DF2\u8FBE ${percent}%\uFF08${this.formatTokens(current)} / ${this.formatTokens(max)}\uFF09\uFF0C\u5EFA\u8BAE\u6E05\u7406\u4EE5\u907F\u514D\u6027\u80FD\u4E0B\u964D\u3002`;
146
- }
147
- return `Context usage at ${percent}% (${this.formatTokens(current)} / ${this.formatTokens(max)}). Consider clearing to maintain performance.`;
148
- }
149
- getMessageThresholdMessage(count) {
150
- const isZh = i18n.language === "zh-CN";
151
- if (isZh) {
152
- return `\u5F53\u524D\u4F1A\u8BDD\u5DF2\u6709 ${count} \u6761\u6D88\u606F\uFF0C\u5EFA\u8BAE\u6E05\u7406\u4EE5\u4FDD\u6301\u54CD\u5E94\u8D28\u91CF\u3002`;
153
- }
154
- return `Current session has ${count} messages. Consider clearing to maintain response quality.`;
155
- }
156
- getWarningMessage(usagePercent, _current, _max) {
157
- const isZh = i18n.language === "zh-CN";
158
- const percent = (usagePercent * 100).toFixed(1);
159
- if (isZh) {
160
- return `\u26A0\uFE0F \u4E0A\u4E0B\u6587\u4F7F\u7528\u7387 ${percent}%\uFF0C\u63A5\u8FD1\u9608\u503C\u3002\u7EE7\u7EED\u5DE5\u4F5C\u65F6\u8BF7\u6CE8\u610F\u3002`;
161
- }
162
- return `\u26A0\uFE0F Context usage at ${percent}%, approaching threshold. Monitor as you continue.`;
163
- }
164
- getHealthyMessage(usagePercent) {
165
- const isZh = i18n.language === "zh-CN";
166
- const percent = (usagePercent * 100).toFixed(1);
167
- if (isZh) {
168
- return `\u2705 \u4E0A\u4E0B\u6587\u72B6\u6001\u826F\u597D\uFF08${percent}%\uFF09\uFF0C\u65E0\u9700\u6E05\u7406\u3002`;
169
- }
170
- return `\u2705 Context is healthy (${percent}%), no action needed.`;
171
- }
172
- getPlanCompleteMessage(plan, _context, _usagePercent) {
173
- const isZh = i18n.language === "zh-CN";
174
- if (isZh) {
175
- return `Claude Code \u65B0\u529F\u80FD\u652F\u6301\u5728\u63A5\u53D7\u8BA1\u5212\u540E\u81EA\u52A8\u6E05\u7A7A\u4E0A\u4E0B\u6587\uFF0C
176
- \u8FD9\u80FD\u8BA9 Claude \u66F4\u4E13\u6CE8\u4E8E\u6267\u884C\uFF0C\u63D0\u5347\u4EFB\u52A1\u5B8C\u6210\u8D28\u91CF\u3002
177
-
178
- Plan "${plan.name}" \u5DF2\u4FDD\u5B58\uFF0C\u60A8\u53EF\u4EE5\u9009\u62E9\uFF1A
179
-
180
- \u{1F9F9} \u6E05\u7A7A\u4E0A\u4E0B\u6587\u5E76\u6267\u884C\uFF08\u63A8\u8350\uFF09
181
- - \u81EA\u52A8\u6E05\u7406\u89C4\u5212\u9636\u6BB5\u7684\u8BA8\u8BBA
182
- - \u4FDD\u7559 Plan \u6587\u6863\u4F5C\u4E3A\u6267\u884C\u4F9D\u636E
183
- - \u83B7\u5F97\u5E72\u51C0\u7684\u4E0A\u4E0B\u6587\u7A97\u53E3
184
-
185
- \u{1F4CE} \u4FDD\u7559\u4E0A\u4E0B\u6587\u5E76\u6267\u884C
186
- - \u4FDD\u7559\u6240\u6709\u5386\u53F2\u5BF9\u8BDD
187
- - \u9002\u5408\u9700\u8981\u53C2\u8003\u8BA8\u8BBA\u7EC6\u8282\u7684\u60C5\u51B5`;
188
- }
189
- return `Claude Code now supports automatically clearing context after accepting a plan.
190
- This helps Claude stay focused and improves task completion quality.
191
-
192
- Plan "${plan.name}" has been saved. You can choose:
193
-
194
- \u{1F9F9} Clear context and execute (Recommended)
195
- - Automatically clear planning discussions
196
- - Keep Plan document as execution reference
197
- - Get a fresh context window
198
-
199
- \u{1F4CE} Keep context and execute
200
- - Preserve all conversation history
201
- - Suitable when you need to reference discussion details`;
202
- }
203
- getSuggestedActions(reason) {
204
- const isZh = i18n.language === "zh-CN";
205
- switch (reason) {
206
- case "plan_complete":
207
- return isZh ? [
208
- "\u{1F9F9} \u6E05\u7A7A\u4E0A\u4E0B\u6587\u5E76\u6267\u884C (\u63A8\u8350) - \u4F7F\u7528 Claude Code Plan Mode \u7684\u6E05\u7A7A\u9009\u9879",
209
- "\u{1F4CE} \u4FDD\u7559\u4E0A\u4E0B\u6587\u5E76\u6267\u884C - \u7EE7\u7EED\u5F53\u524D\u4F1A\u8BDD",
210
- "\u{1F4BE} \u4EC5\u4FDD\u5B58 Plan - \u7A0D\u540E\u6267\u884C"
211
- ] : [
212
- "\u{1F9F9} Clear context and execute (Recommended) - Use Claude Code Plan Mode clear option",
213
- "\u{1F4CE} Keep context and execute - Continue current session",
214
- "\u{1F4BE} Save Plan only - Execute later"
215
- ];
216
- case "token_threshold":
217
- case "message_threshold":
218
- return isZh ? [
219
- "\u6267\u884C /compact \u538B\u7F29\u4E0A\u4E0B\u6587",
220
- "\u5F00\u59CB\u65B0\u4F1A\u8BDD",
221
- "\u4FDD\u5B58\u5F53\u524D\u8FDB\u5EA6\u540E\u6E05\u7406"
222
- ] : [
223
- "Run /compact to compress context",
224
- "Start a new session",
225
- "Save progress and clear"
226
- ];
227
- default:
228
- return [];
229
- }
230
- }
231
- formatTokens(tokens) {
232
- if (tokens >= 1e6) {
233
- return `${(tokens / 1e6).toFixed(1)}M`;
234
- }
235
- if (tokens >= 1e3) {
236
- return `${(tokens / 1e3).toFixed(1)}k`;
237
- }
238
- return tokens.toString();
239
- }
240
- }
241
- let instance$1 = null;
242
- function getCompactAdvisor(config) {
243
- if (!instance$1) {
244
- instance$1 = new CompactAdvisor(config);
245
- }
246
- return instance$1;
247
- }
248
-
249
- class PlanPersistenceManager {
250
- baseDir;
251
- projectPlanDir;
252
- constructor(projectPath) {
253
- this.baseDir = join(homedir(), ".ccjk", "plans");
254
- const cwd = projectPath || process.cwd();
255
- this.projectPlanDir = join(cwd, ".ccjk", "plan", "current");
256
- this.ensureDirectories();
257
- }
258
- ensureDirectories() {
259
- for (const dir of [this.baseDir, this.projectPlanDir]) {
260
- if (!existsSync(dir)) {
261
- mkdirSync(dir, { recursive: true });
262
- }
263
- }
264
- }
265
- /**
266
- * 生成 Plan ID
267
- */
268
- generateId() {
269
- return `plan-${Date.now()}-${Math.random().toString(36).substring(2, 7)}`;
270
- }
271
- /**
272
- * 生成安全的文件名
273
- */
274
- sanitizeFileName(name) {
275
- return name.replace(/[<>:"/\\|?*]/g, "-").replace(/\s+/g, "-").replace(/-+/g, "-").substring(0, 50);
276
- }
277
- /**
278
- * 保存 Plan 文档
279
- */
280
- savePlan(plan, options = {}) {
281
- const now = /* @__PURE__ */ new Date();
282
- const id = this.generateId();
283
- const document = {
284
- ...plan,
285
- id,
286
- createdAt: now,
287
- updatedAt: now
288
- };
289
- const timestamp = now.toISOString().slice(0, 10).replace(/-/g, "");
290
- const safeName = this.sanitizeFileName(plan.name);
291
- const fileName = `${safeName}-${timestamp}.md`;
292
- const projectFilePath = join(this.projectPlanDir, fileName);
293
- this.writePlanFile(projectFilePath, document, options.overwrite);
294
- const globalFilePath = join(this.baseDir, fileName);
295
- this.writePlanFile(globalFilePath, document, true);
296
- return document;
297
- }
298
- /**
299
- * 写入 Plan 文件
300
- */
301
- writePlanFile(filePath, plan, overwrite = false) {
302
- if (existsSync(filePath) && !overwrite) {
303
- const ext = ".md";
304
- const base = filePath.slice(0, -ext.length);
305
- let counter = 1;
306
- let newPath = `${base}-v${counter}${ext}`;
307
- while (existsSync(newPath)) {
308
- counter++;
309
- newPath = `${base}-v${counter}${ext}`;
310
- }
311
- filePath = newPath;
312
- }
313
- const content = this.buildPlanMarkdown(plan);
314
- writeFileSync(filePath, content, "utf-8");
315
- }
316
- /**
317
- * 构建 Plan Markdown 内容
318
- */
319
- buildPlanMarkdown(plan) {
320
- const lines = [];
321
- lines.push("---");
322
- lines.push(`id: ${plan.id}`);
323
- lines.push(`name: ${plan.name}`);
324
- lines.push(`created: ${plan.createdAt.toISOString()}`);
325
- lines.push(`updated: ${plan.updatedAt.toISOString()}`);
326
- if (plan.sessionId) {
327
- lines.push(`session: ${plan.sessionId}`);
328
- }
329
- if (plan.sourceSkill) {
330
- lines.push(`skill: ${plan.sourceSkill}`);
331
- }
332
- if (plan.metadata.tokenEstimate) {
333
- lines.push(`tokens: ${plan.metadata.tokenEstimate}`);
334
- }
335
- lines.push("---");
336
- lines.push("");
337
- lines.push(plan.content);
338
- if (plan.metadata.tasks && plan.metadata.tasks.length > 0) {
339
- lines.push("");
340
- lines.push("## \u4EFB\u52A1\u6E05\u5355");
341
- lines.push("");
342
- for (const task of plan.metadata.tasks) {
343
- const checkbox = task.completed ? "[x]" : "[ ]";
344
- const priority = task.priority ? ` (${task.priority})` : "";
345
- lines.push(`- ${checkbox} ${task.title}${priority}`);
346
- if (task.description) {
347
- lines.push(` - ${task.description}`);
348
- }
349
- }
350
- }
351
- if (plan.metadata.keyDecisions && plan.metadata.keyDecisions.length > 0) {
352
- lines.push("");
353
- lines.push("## \u5173\u952E\u51B3\u7B56");
354
- lines.push("");
355
- for (const decision of plan.metadata.keyDecisions) {
356
- lines.push(`- ${decision}`);
357
- }
358
- }
359
- return lines.join("\n");
360
- }
361
- /**
362
- * 读取 Plan 文档
363
- */
364
- readPlan(fileName) {
365
- let filePath = join(this.projectPlanDir, fileName);
366
- if (!existsSync(filePath)) {
367
- filePath = join(this.baseDir, fileName);
368
- }
369
- if (!existsSync(filePath)) {
370
- return null;
371
- }
372
- return this.parsePlanFile(filePath);
373
- }
374
- /**
375
- * 解析 Plan 文件
376
- */
377
- parsePlanFile(filePath) {
378
- try {
379
- const content = readFileSync(filePath, "utf-8");
380
- const frontmatterMatch = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
381
- if (!frontmatterMatch) {
382
- return {
383
- id: basename(filePath, ".md"),
384
- name: basename(filePath, ".md"),
385
- content,
386
- createdAt: /* @__PURE__ */ new Date(),
387
- updatedAt: /* @__PURE__ */ new Date(),
388
- metadata: {}
389
- };
390
- }
391
- const frontmatter = frontmatterMatch[1];
392
- const body = frontmatterMatch[2];
393
- const meta = {};
394
- for (const line of frontmatter.split("\n")) {
395
- const match = line.match(/^(\w+):\s*(.*)$/);
396
- if (match) {
397
- meta[match[1]] = match[2];
398
- }
399
- }
400
- return {
401
- id: meta.id || basename(filePath, ".md"),
402
- name: meta.name || basename(filePath, ".md"),
403
- content: body.trim(),
404
- sessionId: meta.session,
405
- sourceSkill: meta.skill,
406
- createdAt: meta.created ? new Date(meta.created) : /* @__PURE__ */ new Date(),
407
- updatedAt: meta.updated ? new Date(meta.updated) : /* @__PURE__ */ new Date(),
408
- metadata: {
409
- tokenEstimate: meta.tokens ? Number.parseInt(meta.tokens, 10) : void 0
410
- }
411
- };
412
- } catch {
413
- return null;
414
- }
415
- }
416
- /**
417
- * 列出所有 Plan 文档
418
- */
419
- listPlans(location = "project") {
420
- const plans = [];
421
- if (location === "project" || location === "all") {
422
- if (existsSync(this.projectPlanDir)) {
423
- const files = readdirSync(this.projectPlanDir).filter((f) => f.endsWith(".md"));
424
- plans.push(...files.map((f) => join(this.projectPlanDir, f)));
425
- }
426
- }
427
- if (location === "global" || location === "all") {
428
- if (existsSync(this.baseDir)) {
429
- const files = readdirSync(this.baseDir).filter((f) => f.endsWith(".md"));
430
- plans.push(...files.map((f) => join(this.baseDir, f)));
431
- }
432
- }
433
- return plans;
434
- }
435
- /**
436
- * 获取最新的 Plan 文档
437
- */
438
- getLatestPlan() {
439
- const plans = this.listPlans("project");
440
- if (plans.length === 0) {
441
- return null;
442
- }
443
- const sorted = plans.map((p) => {
444
- const doc = this.parsePlanFile(p);
445
- return doc ? { path: p, doc } : null;
446
- }).filter((p) => p !== null).sort((a, b) => b.doc.updatedAt.getTime() - a.doc.updatedAt.getTime());
447
- return sorted[0]?.doc || null;
448
- }
449
- /**
450
- * 获取项目 Plan 目录路径
451
- */
452
- getProjectPlanDir() {
453
- return this.projectPlanDir;
454
- }
455
- }
456
- let instance = null;
457
- function getPlanPersistenceManager(projectPath) {
458
- if (!instance) {
459
- instance = new PlanPersistenceManager(projectPath);
460
- }
461
- return instance;
462
- }
463
-
464
- const PLAN_DIRECTORIES = [
465
- ".ccjk/plan/current",
466
- ".ccjk/plan/archive"
467
- ];
468
- const GLOBAL_PLAN_DIR = join(homedir(), ".ccjk", "plans");
469
- async function initializeContextFeatures() {
470
- try {
471
- if (!existsSync(GLOBAL_PLAN_DIR)) {
472
- await mkdir(GLOBAL_PLAN_DIR, { recursive: true });
473
- }
474
- const cwd = process.cwd();
475
- for (const dir of PLAN_DIRECTORIES) {
476
- const fullPath = join(cwd, dir);
477
- if (!existsSync(fullPath)) {
478
- await mkdir(fullPath, { recursive: true });
479
- }
480
- }
481
- getCompactAdvisor();
482
- getPlanPersistenceManager();
483
- } catch {
484
- }
485
- }
486
-
487
- export { initializeContextFeatures };