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,66 +0,0 @@
1
- const INVALID_PERMISSION_NAMES = /* @__PURE__ */ new Set([
2
- "AllowEdit",
3
- "AllowWrite",
4
- "AllowRead",
5
- "AllowExec",
6
- "AllowCreateProcess",
7
- "AllowKillProcess",
8
- "AllowNetworkAccess",
9
- "AllowFileSystemAccess",
10
- "AllowShellAccess",
11
- "AllowHttpAccess"
12
- ]);
13
- function isValidPermission(perm) {
14
- if (INVALID_PERMISSION_NAMES.has(perm)) {
15
- return false;
16
- }
17
- if (["mcp__.*", "mcp__*", "mcp__(*)"].includes(perm)) {
18
- return false;
19
- }
20
- if (/^[a-z]/.test(perm) && !perm.startsWith("mcp__")) {
21
- return false;
22
- }
23
- return true;
24
- }
25
- function isCoveredByWildcard(perm, wildcardPerm) {
26
- const wildcardMatch = wildcardPerm.match(/^(\w+)\((.+)\)$/);
27
- if (!wildcardMatch) return false;
28
- const [, tool, wildcardArg] = wildcardMatch;
29
- if (!wildcardArg.includes("*")) return false;
30
- const permMatch = perm.match(/^(\w+)\((.+)\)$/);
31
- if (!permMatch) return false;
32
- const [, permTool, permArg] = permMatch;
33
- if (tool !== permTool) return false;
34
- const regexStr = wildcardArg.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".+");
35
- return new RegExp(`^${regexStr}$`).test(permArg);
36
- }
37
- function mergeAndCleanPermissions(templatePermissions, userPermissions) {
38
- const template = templatePermissions || [];
39
- const user = userPermissions || [];
40
- const result = [...template];
41
- for (const perm of user) {
42
- if (result.includes(perm)) {
43
- continue;
44
- }
45
- if (!isValidPermission(perm)) {
46
- continue;
47
- }
48
- let isRedundant = false;
49
- for (const templatePerm of template) {
50
- if (perm.startsWith(`${templatePerm}(`)) {
51
- isRedundant = true;
52
- break;
53
- }
54
- if (isCoveredByWildcard(perm, templatePerm)) {
55
- isRedundant = true;
56
- break;
57
- }
58
- }
59
- if (!isRedundant) {
60
- result.push(perm);
61
- }
62
- }
63
- return result;
64
- }
65
-
66
- export { mergeAndCleanPermissions as m };
@@ -1,317 +0,0 @@
1
- import { readFileSync, existsSync, readdirSync } from 'node:fs';
2
- import { d as dirname, j as join, b as basename } from './ccjk.bQ7Dh1g4.mjs';
3
-
4
- const PRIORITY_KEYWORDS = {
5
- critical: "critical",
6
- CRITICAL: "critical",
7
- \u5173\u952E: "critical",
8
- high: "high",
9
- HIGH: "high",
10
- \u9AD8: "high",
11
- medium: "medium",
12
- MEDIUM: "medium",
13
- \u4E2D: "medium",
14
- low: "low",
15
- LOW: "low",
16
- \u4F4E: "low"
17
- };
18
- class SkillParser {
19
- /**
20
- * Parse a SKILL.md file
21
- *
22
- * @param filePath - Path to SKILL.md file
23
- * @returns Parsed skill document
24
- */
25
- parse(filePath) {
26
- const content = readFileSync(filePath, "utf-8");
27
- return this.parseContent(content, dirname(filePath));
28
- }
29
- /**
30
- * Parse SKILL.md content
31
- *
32
- * @param content - Raw markdown content
33
- * @param basePath - Base path for resolving references
34
- * @returns Parsed skill document
35
- */
36
- parseContent(content, basePath) {
37
- const lines = content.split("\n");
38
- const title = this.extractTitle(lines);
39
- const description = this.extractDescription(lines);
40
- const applicability = this.extractApplicability(content);
41
- const sections = this.extractSections(content);
42
- const rules = this.extractRules(content, basePath);
43
- const examples = this.extractExamples(content);
44
- return {
45
- title,
46
- description,
47
- applicability,
48
- sections,
49
- rules,
50
- examples,
51
- rawContent: content
52
- };
53
- }
54
- /**
55
- * Parse a skill directory (SKILL.md + references/)
56
- *
57
- * @param dirPath - Path to skill directory
58
- * @returns Parsed skill document with references
59
- */
60
- parseDirectory(dirPath) {
61
- const skillPath = join(dirPath, "SKILL.md");
62
- if (!existsSync(skillPath)) {
63
- throw new Error(`SKILL.md not found in ${dirPath}`);
64
- }
65
- const skill = this.parse(skillPath);
66
- const references = this.loadReferences(dirPath);
67
- return {
68
- ...skill,
69
- references
70
- };
71
- }
72
- // ==========================================================================
73
- // Extraction Methods
74
- // ==========================================================================
75
- /**
76
- * Extract title from markdown
77
- */
78
- extractTitle(lines) {
79
- for (const line of lines) {
80
- const match = line.match(/^#\s+(.+)$/);
81
- if (match) {
82
- return match[1].trim();
83
- }
84
- }
85
- return "Untitled Skill";
86
- }
87
- /**
88
- * Extract description from markdown
89
- */
90
- extractDescription(lines) {
91
- let inDescription = false;
92
- const descLines = [];
93
- for (const line of lines) {
94
- if (line.match(/^#\s+/)) {
95
- inDescription = true;
96
- continue;
97
- }
98
- if (line.match(/^##\s+/)) {
99
- break;
100
- }
101
- if (inDescription && line.trim()) {
102
- descLines.push(line);
103
- }
104
- }
105
- return descLines.join("\n").trim();
106
- }
107
- /**
108
- * Extract applicability section
109
- */
110
- extractApplicability(content) {
111
- const applicability = {
112
- taskTypes: [],
113
- fileTypes: [],
114
- contexts: []
115
- };
116
- const applicabilityMatch = content.match(
117
- /##\s*(?:When to Apply|Applicability|适用场景|何时使用)[^\n]*\n([\s\S]*?)(?=\n##|\n$|$)/i
118
- );
119
- if (applicabilityMatch) {
120
- const section = applicabilityMatch[1];
121
- const taskMatches = section.matchAll(/[-*]\s*(.+)/g);
122
- for (const match of taskMatches) {
123
- const task = match[1].trim();
124
- if (task) {
125
- applicability.taskTypes.push(task);
126
- }
127
- }
128
- }
129
- const fileTypeMatch = content.match(
130
- /(?:file types?|文件类型)[:\s]*([^\n]+)/i
131
- );
132
- if (fileTypeMatch) {
133
- applicability.fileTypes = fileTypeMatch[1].split(/[,,]/).map((t) => t.trim()).filter(Boolean);
134
- }
135
- return applicability;
136
- }
137
- /**
138
- * Extract sections from markdown
139
- */
140
- extractSections(content) {
141
- const sections = [];
142
- const lines = content.split("\n");
143
- let currentSection = null;
144
- let currentContent = [];
145
- let currentSubsections = [];
146
- for (const line of lines) {
147
- const h2Match = line.match(/^##\s+(.+)$/);
148
- if (h2Match) {
149
- if (currentSection) {
150
- currentSection.content = currentContent.join("\n").trim();
151
- currentSection.subsections = currentSubsections.length > 0 ? currentSubsections : void 0;
152
- sections.push(currentSection);
153
- }
154
- currentSection = {
155
- title: h2Match[1].trim(),
156
- content: "",
157
- priority: this.detectPriority(h2Match[1])
158
- };
159
- currentContent = [];
160
- currentSubsections = [];
161
- continue;
162
- }
163
- const h3Match = line.match(/^###\s+(.+)$/);
164
- if (h3Match && currentSection) {
165
- currentSubsections.push({
166
- title: h3Match[1].trim(),
167
- content: "",
168
- // Will be filled by subsequent lines
169
- priority: this.detectPriority(h3Match[1])
170
- });
171
- continue;
172
- }
173
- if (currentSection) {
174
- currentContent.push(line);
175
- }
176
- }
177
- if (currentSection) {
178
- currentSection.content = currentContent.join("\n").trim();
179
- currentSection.subsections = currentSubsections.length > 0 ? currentSubsections : void 0;
180
- sections.push(currentSection);
181
- }
182
- return sections;
183
- }
184
- /**
185
- * Extract rules from markdown
186
- */
187
- extractRules(content, basePath) {
188
- const rules = [];
189
- const rulePattern = /###?\s*(?:`([a-z]+-\d+)`|(\w+-\d+))[:\s]*(.+?)(?=\n###?|\n##|$)/gs;
190
- let match;
191
- while ((match = rulePattern.exec(content)) !== null) {
192
- const id = match[1] || match[2];
193
- const titleAndContent = match[3];
194
- const titleMatch = titleAndContent.match(/^[:\s]*(.+)(?:\n|$)/);
195
- const title = titleMatch ? titleMatch[1].trim() : id;
196
- const category = id.split("-")[0];
197
- const priority = this.detectPriority(titleAndContent);
198
- const description = titleAndContent.replace(/^[:\s]*(.+)(?:\n|$)/, "").trim();
199
- let referencePath;
200
- if (basePath) {
201
- const refPath = join(basePath, "references", "rules", `${id}.md`);
202
- if (existsSync(refPath)) {
203
- referencePath = refPath;
204
- }
205
- }
206
- rules.push({
207
- id,
208
- title,
209
- category,
210
- priority,
211
- description,
212
- referencePath
213
- });
214
- }
215
- const numberedPattern = /(?:^|\n)(\d+)\.\s+\*\*(.+?)\*\*[:\s]*(.+?)(?=\n\d+\.|\n##|$)/gs;
216
- while ((match = numberedPattern.exec(content)) !== null) {
217
- const num = match[1];
218
- const title = match[2].trim();
219
- const description = match[3].trim();
220
- const id = `rule-${num.padStart(3, "0")}`;
221
- rules.push({
222
- id,
223
- title,
224
- category: "general",
225
- priority: this.detectPriority(description),
226
- description
227
- });
228
- }
229
- return rules;
230
- }
231
- /**
232
- * Extract code examples from markdown
233
- */
234
- extractExamples(content) {
235
- const examples = [];
236
- const examplePattern = /###?\s*(?:Example|示例|案例)[:\s]*(.+?)(?=\n###?|\n##|$)/gis;
237
- let match;
238
- while ((match = examplePattern.exec(content)) !== null) {
239
- const exampleContent = match[1];
240
- const inputMatch = exampleContent.match(/(?:Input|输入)[:\s]*(.+?)(?=Output|输出|$)/is);
241
- const outputMatch = exampleContent.match(/(?:Output|输出)[:\s]*(.+)$/is);
242
- if (inputMatch || outputMatch) {
243
- examples.push({
244
- title: "Example",
245
- input: inputMatch ? inputMatch[1].trim() : "",
246
- output: outputMatch ? outputMatch[1].trim() : ""
247
- });
248
- }
249
- }
250
- return examples;
251
- }
252
- /**
253
- * Extract code blocks from content
254
- */
255
- extractCodeBlocks(content) {
256
- const blocks = [];
257
- const codePattern = /```(\w+)?\n([\s\S]*?)```/g;
258
- let match;
259
- while ((match = codePattern.exec(content)) !== null) {
260
- blocks.push({
261
- language: match[1] || "text",
262
- code: match[2].trim()
263
- });
264
- }
265
- return blocks;
266
- }
267
- /**
268
- * Load reference documents from references/ directory
269
- */
270
- loadReferences(dirPath) {
271
- const references = [];
272
- const refsPath = join(dirPath, "references");
273
- if (!existsSync(refsPath)) {
274
- return references;
275
- }
276
- const loadDir = (dir, prefix = "") => {
277
- const entries = readdirSync(dir, { withFileTypes: true });
278
- for (const entry of entries) {
279
- const fullPath = join(dir, entry.name);
280
- if (entry.isDirectory()) {
281
- loadDir(fullPath, `${prefix}${entry.name}/`);
282
- } else if (entry.name.endsWith(".md")) {
283
- const content = readFileSync(fullPath, "utf-8");
284
- const title = this.extractTitle(content.split("\n")) || basename(entry.name, ".md");
285
- references.push({
286
- path: `${prefix}${entry.name}`,
287
- title,
288
- content
289
- });
290
- }
291
- }
292
- };
293
- loadDir(refsPath);
294
- return references;
295
- }
296
- /**
297
- * Detect priority from text
298
- */
299
- detectPriority(text) {
300
- const lowerText = text.toLowerCase();
301
- for (const [keyword, priority] of Object.entries(PRIORITY_KEYWORDS)) {
302
- if (lowerText.includes(keyword.toLowerCase())) {
303
- return priority;
304
- }
305
- }
306
- return "medium";
307
- }
308
- }
309
- let parserInstance = null;
310
- function getSkillParser() {
311
- if (!parserInstance) {
312
- parserInstance = new SkillParser();
313
- }
314
- return parserInstance;
315
- }
316
-
317
- export { getSkillParser as g };
@@ -1,259 +0,0 @@
1
- const DEFAULT_CONFIG = {
2
- checkInterval: 5 * 60 * 1e3,
3
- // 5 minutes
4
- timeout: 1e4,
5
- // 10 seconds
6
- degradedLatencyThreshold: 2e3,
7
- // 2 seconds
8
- unhealthyLatencyThreshold: 5e3,
9
- // 5 seconds
10
- degradedSuccessRateThreshold: 0.8,
11
- // 80%
12
- unhealthySuccessRateThreshold: 0.5,
13
- // 50%
14
- maxConsecutiveFailures: 3
15
- };
16
- class ProviderHealthMonitor {
17
- healthData = /* @__PURE__ */ new Map();
18
- monitoringInterval = null;
19
- config;
20
- providers = [];
21
- constructor(config) {
22
- this.config = { ...DEFAULT_CONFIG, ...config };
23
- }
24
- /**
25
- * Set providers to monitor
26
- */
27
- setProviders(providers) {
28
- this.providers = providers;
29
- for (const provider of providers) {
30
- if (!this.healthData.has(provider.id)) {
31
- this.healthData.set(provider.id, {
32
- providerId: provider.id,
33
- latency: 0,
34
- successRate: 1,
35
- lastCheck: 0,
36
- status: "unknown",
37
- consecutiveFailures: 0,
38
- totalRequests: 0,
39
- successfulRequests: 0
40
- });
41
- }
42
- }
43
- }
44
- /**
45
- * Check health of a single provider
46
- */
47
- async checkHealth(provider) {
48
- const startTime = Date.now();
49
- try {
50
- const baseUrl = provider.claudeCode?.baseUrl || provider.codex?.baseUrl;
51
- if (!baseUrl) {
52
- return {
53
- success: false,
54
- latency: 0,
55
- error: "No base URL configured",
56
- timestamp: Date.now()
57
- };
58
- }
59
- const controller = new AbortController();
60
- const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);
61
- try {
62
- const response = await fetch(baseUrl, {
63
- method: "HEAD",
64
- signal: controller.signal,
65
- headers: {
66
- "User-Agent": "CCJK-Health-Monitor/1.0"
67
- }
68
- });
69
- clearTimeout(timeoutId);
70
- const latency = Date.now() - startTime;
71
- const success = response.ok || response.status === 404;
72
- return {
73
- success,
74
- latency,
75
- timestamp: Date.now()
76
- };
77
- } catch (error) {
78
- clearTimeout(timeoutId);
79
- if (error instanceof Error && error.name === "AbortError") {
80
- return {
81
- success: false,
82
- latency: this.config.timeout,
83
- error: "Request timeout",
84
- timestamp: Date.now()
85
- };
86
- }
87
- return {
88
- success: false,
89
- latency: Date.now() - startTime,
90
- error: error instanceof Error ? error.message : "Unknown error",
91
- timestamp: Date.now()
92
- };
93
- }
94
- } catch (error) {
95
- return {
96
- success: false,
97
- latency: Date.now() - startTime,
98
- error: error instanceof Error ? error.message : "Unknown error",
99
- timestamp: Date.now()
100
- };
101
- }
102
- }
103
- /**
104
- * Update health data based on check result
105
- */
106
- updateHealthData(providerId, result) {
107
- const health = this.healthData.get(providerId);
108
- if (!health) {
109
- return;
110
- }
111
- health.totalRequests++;
112
- if (result.success) {
113
- health.successfulRequests++;
114
- health.consecutiveFailures = 0;
115
- } else {
116
- health.consecutiveFailures++;
117
- }
118
- health.successRate = health.successfulRequests / health.totalRequests;
119
- if (result.success) {
120
- health.latency = health.latency === 0 ? result.latency : health.latency * 0.7 + result.latency * 0.3;
121
- }
122
- health.lastCheck = result.timestamp;
123
- health.status = this.determineStatus(health);
124
- this.healthData.set(providerId, health);
125
- }
126
- /**
127
- * Determine provider status based on health metrics
128
- */
129
- determineStatus(health) {
130
- if (health.consecutiveFailures >= this.config.maxConsecutiveFailures) {
131
- return "unhealthy";
132
- }
133
- if (health.successRate < this.config.unhealthySuccessRateThreshold) {
134
- return "unhealthy";
135
- }
136
- if (health.successRate < this.config.degradedSuccessRateThreshold) {
137
- return "degraded";
138
- }
139
- if (health.successfulRequests > 0) {
140
- if (health.latency > this.config.unhealthyLatencyThreshold) {
141
- return "unhealthy";
142
- }
143
- if (health.latency > this.config.degradedLatencyThreshold) {
144
- return "degraded";
145
- }
146
- }
147
- return "healthy";
148
- }
149
- /**
150
- * Get health data for a specific provider
151
- */
152
- getProviderHealth(providerId) {
153
- return this.healthData.get(providerId);
154
- }
155
- /**
156
- * Get all healthy providers
157
- */
158
- getHealthyProviders() {
159
- return this.providers.filter((provider) => {
160
- const health = this.healthData.get(provider.id);
161
- return health && health.status === "healthy";
162
- });
163
- }
164
- /**
165
- * Get all providers sorted by health score
166
- */
167
- getProvidersByHealth() {
168
- return [...this.providers].sort((a, b) => {
169
- const healthA = this.healthData.get(a.id);
170
- const healthB = this.healthData.get(b.id);
171
- if (!healthA || !healthB) {
172
- return 0;
173
- }
174
- const scoreA = this.calculateHealthScore(healthA);
175
- const scoreB = this.calculateHealthScore(healthB);
176
- return scoreB - scoreA;
177
- });
178
- }
179
- /**
180
- * Calculate health score for a provider
181
- */
182
- calculateHealthScore(health) {
183
- const statusWeight = {
184
- healthy: 1,
185
- degraded: 0.6,
186
- unhealthy: 0.2,
187
- unknown: 0.5
188
- };
189
- const normalizedLatency = Math.max(0, 1 - health.latency / 1e4);
190
- return statusWeight[health.status] * 0.4 + health.successRate * 0.4 + normalizedLatency * 0.2;
191
- }
192
- /**
193
- * Get the best provider based on health metrics
194
- */
195
- getBestProvider() {
196
- const sortedProviders = this.getProvidersByHealth();
197
- return sortedProviders.length > 0 ? sortedProviders[0] : null;
198
- }
199
- /**
200
- * Start monitoring all providers
201
- */
202
- async startMonitoring() {
203
- if (this.monitoringInterval) {
204
- return;
205
- }
206
- await this.checkAllProviders();
207
- this.monitoringInterval = setInterval(async () => {
208
- await this.checkAllProviders();
209
- }, this.config.checkInterval);
210
- }
211
- /**
212
- * Stop monitoring
213
- */
214
- stopMonitoring() {
215
- if (this.monitoringInterval) {
216
- clearInterval(this.monitoringInterval);
217
- this.monitoringInterval = null;
218
- }
219
- }
220
- /**
221
- * Check health of all providers
222
- */
223
- async checkAllProviders() {
224
- const checks = this.providers.map(async (provider) => {
225
- const result = await this.checkHealth(provider);
226
- this.updateHealthData(provider.id, result);
227
- });
228
- await Promise.all(checks);
229
- }
230
- /**
231
- * Get all health data
232
- */
233
- getAllHealthData() {
234
- return new Map(this.healthData);
235
- }
236
- /**
237
- * Reset health data for a provider
238
- */
239
- resetProviderHealth(providerId) {
240
- const health = this.healthData.get(providerId);
241
- if (health) {
242
- health.consecutiveFailures = 0;
243
- health.totalRequests = 0;
244
- health.successfulRequests = 0;
245
- health.successRate = 1;
246
- health.latency = 0;
247
- health.status = "unknown";
248
- this.healthData.set(providerId, health);
249
- }
250
- }
251
- /**
252
- * Clear all health data
253
- */
254
- clearAllHealthData() {
255
- this.healthData.clear();
256
- }
257
- }
258
-
259
- export { ProviderHealthMonitor as P };
@@ -1,38 +0,0 @@
1
- function chunkify(iterable, chunkSize) {
2
- if (typeof iterable[Symbol.iterator] !== 'function') {
3
- throw new TypeError('Expected an `Iterable` in the first argument');
4
- }
5
-
6
- if (!(Number.isSafeInteger(chunkSize) && chunkSize > 0)) {
7
- throw new TypeError(`Expected \`chunkSize\` to be an integer from 1 and up, got \`${chunkSize}\``);
8
- }
9
-
10
- return {
11
- * [Symbol.iterator]() {
12
- if (Array.isArray(iterable)) {
13
- for (let index = 0; index < iterable.length; index += chunkSize) {
14
- yield iterable.slice(index, index + chunkSize);
15
- }
16
-
17
- return;
18
- }
19
-
20
- let chunk = [];
21
-
22
- for (const value of iterable) {
23
- chunk.push(value);
24
-
25
- if (chunk.length === chunkSize) {
26
- yield chunk;
27
- chunk = [];
28
- }
29
- }
30
-
31
- if (chunk.length > 0) {
32
- yield chunk;
33
- }
34
- },
35
- };
36
- }
37
-
38
- export { chunkify as c };