kimi-plugin-cc 2.7.3 → 3.1.0

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 (317) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +3 -16
  3. package/README.md +428 -515
  4. package/assets/logo.svg +6 -0
  5. package/cordis.patch.yml +18 -0
  6. package/dist/background-spawn.js +14 -19
  7. package/dist/cli-client.js +163 -105
  8. package/dist/commands/ask.js +44 -96
  9. package/dist/commands/cancel.js +11 -59
  10. package/dist/commands/cli-helpers.js +102 -1
  11. package/dist/commands/models.js +2 -3
  12. package/dist/commands/pursue.js +8 -21
  13. package/dist/commands/registry.js +7 -26
  14. package/dist/commands/repair-sessions.js +121 -12
  15. package/dist/commands/replay.js +4 -3
  16. package/dist/commands/rescue.js +29 -87
  17. package/dist/commands/result.js +7 -1
  18. package/dist/commands/review.js +28 -18
  19. package/dist/commands/setup.js +813 -462
  20. package/dist/commands/status.js +2 -2
  21. package/dist/commands/swarm.js +112 -125
  22. package/dist/commands/worker.js +1 -2
  23. package/dist/companion.js +145 -19
  24. package/dist/git.js +1 -9
  25. package/dist/help.js +13 -9
  26. package/dist/hook-escape.js +7 -16
  27. package/dist/hooks/approval-hook.js +1766 -87
  28. package/dist/hooks/approval-policy.js +86 -19
  29. package/dist/hooks/config-safety.js +31 -64
  30. package/dist/hooks/hook-timing.js +48 -0
  31. package/dist/hooks/install-paths.js +179 -107
  32. package/dist/hooks/install.js +126 -53
  33. package/dist/hooks/managed-block.js +121 -127
  34. package/dist/job-store.js +206 -166
  35. package/dist/jobs.js +66 -19
  36. package/dist/kimi-command.js +74 -1
  37. package/dist/kimi-engine.js +198 -127
  38. package/dist/kimi-errors.js +15 -70
  39. package/dist/kimi-home.js +6 -0
  40. package/dist/kimi-journal.js +42 -0
  41. package/dist/kimi-releases.js +123 -0
  42. package/dist/kimi-timeouts.js +2 -16
  43. package/dist/kimi-version-probe.js +24 -108
  44. package/dist/logging.js +12 -7
  45. package/dist/mcp/binding.js +13 -4
  46. package/dist/mcp/job-control.js +390 -95
  47. package/dist/mcp/launcher.js +13 -7
  48. package/dist/mcp/operations.js +405 -179
  49. package/dist/mcp/protocol.js +124 -33
  50. package/dist/mcp/skills.js +130 -0
  51. package/dist/mcp/stdio.js +18 -4
  52. package/dist/model-command.js +5 -3
  53. package/dist/native-v2-preflight.js +243 -80
  54. package/dist/parsing.js +211 -243
  55. package/dist/paths.js +28 -10
  56. package/dist/plugin-data.js +28 -83
  57. package/dist/process-tree.js +35 -24
  58. package/dist/read-scope.js +435 -0
  59. package/dist/render.js +58 -46
  60. package/dist/rescue-approval.js +461 -84
  61. package/dist/session-references.js +216 -0
  62. package/dist/session-title.js +26 -6
  63. package/dist/stream-json.js +1 -3
  64. package/dist/surface-routing.js +108 -0
  65. package/dist/swarm-activation.js +74 -188
  66. package/dist/swarm-policy.js +2 -1
  67. package/dist/swarm-recovery.js +2 -1
  68. package/dist/util.js +28 -0
  69. package/dist/version.js +1 -1
  70. package/docs/migration.md +45 -206
  71. package/docs/models.md +24 -66
  72. package/docs/safety.md +198 -353
  73. package/docs/session-visibility.md +25 -13
  74. package/docs/swarm-recovery.md +26 -20
  75. package/dsh/index.json +54 -0
  76. package/mcp_config.json +10 -0
  77. package/package.json +23 -82
  78. package/plugin.json +19 -0
  79. package/plugins/kimi-codex/.codex-plugin/plugin.json +7 -7
  80. package/plugins/kimi-codex/.mcp.json +3 -3
  81. package/plugins/kimi-codex/dist/background-spawn.js +14 -19
  82. package/plugins/kimi-codex/dist/cli-client.js +163 -105
  83. package/plugins/kimi-codex/dist/commands/ask.js +44 -96
  84. package/plugins/kimi-codex/dist/commands/cancel.js +11 -59
  85. package/plugins/kimi-codex/dist/commands/cli-helpers.js +102 -1
  86. package/plugins/kimi-codex/dist/commands/models.js +2 -3
  87. package/plugins/kimi-codex/dist/commands/pursue.js +8 -21
  88. package/plugins/kimi-codex/dist/commands/registry.js +7 -26
  89. package/plugins/kimi-codex/dist/commands/repair-sessions.js +121 -12
  90. package/plugins/kimi-codex/dist/commands/replay.js +4 -3
  91. package/plugins/kimi-codex/dist/commands/rescue.js +29 -87
  92. package/plugins/kimi-codex/dist/commands/result.js +7 -1
  93. package/plugins/kimi-codex/dist/commands/review.js +28 -18
  94. package/plugins/kimi-codex/dist/commands/setup.js +813 -462
  95. package/plugins/kimi-codex/dist/commands/status.js +2 -2
  96. package/plugins/kimi-codex/dist/commands/swarm.js +112 -125
  97. package/plugins/kimi-codex/dist/commands/worker.js +1 -2
  98. package/plugins/kimi-codex/dist/companion.js +145 -19
  99. package/plugins/kimi-codex/dist/git.js +1 -9
  100. package/plugins/kimi-codex/dist/help.js +13 -9
  101. package/plugins/kimi-codex/dist/hook-escape.js +7 -16
  102. package/plugins/kimi-codex/dist/hooks/approval-hook.js +1766 -87
  103. package/plugins/kimi-codex/dist/hooks/approval-policy.js +86 -19
  104. package/plugins/kimi-codex/dist/hooks/config-safety.js +31 -64
  105. package/plugins/kimi-codex/dist/hooks/hook-timing.js +48 -0
  106. package/plugins/kimi-codex/dist/hooks/install-paths.js +179 -107
  107. package/plugins/kimi-codex/dist/hooks/install.js +126 -53
  108. package/plugins/kimi-codex/dist/hooks/managed-block.js +121 -127
  109. package/plugins/kimi-codex/dist/job-store.js +206 -166
  110. package/plugins/kimi-codex/dist/jobs.js +66 -19
  111. package/plugins/kimi-codex/dist/kimi-command.js +74 -1
  112. package/plugins/kimi-codex/dist/kimi-engine.js +198 -127
  113. package/plugins/kimi-codex/dist/kimi-errors.js +15 -70
  114. package/plugins/kimi-codex/dist/kimi-home.js +6 -0
  115. package/plugins/kimi-codex/dist/kimi-journal.js +42 -0
  116. package/plugins/kimi-codex/dist/kimi-releases.js +123 -0
  117. package/plugins/kimi-codex/dist/kimi-timeouts.js +2 -16
  118. package/plugins/kimi-codex/dist/kimi-version-probe.js +24 -108
  119. package/plugins/kimi-codex/dist/logging.js +12 -7
  120. package/plugins/kimi-codex/dist/mcp/binding.js +13 -4
  121. package/plugins/kimi-codex/dist/mcp/job-control.js +390 -95
  122. package/plugins/kimi-codex/dist/mcp/launcher.js +13 -7
  123. package/plugins/kimi-codex/dist/mcp/operations.js +405 -179
  124. package/plugins/kimi-codex/dist/mcp/protocol.js +124 -33
  125. package/plugins/kimi-codex/dist/mcp/skills.js +130 -0
  126. package/plugins/kimi-codex/dist/mcp/stdio.js +18 -4
  127. package/plugins/kimi-codex/dist/model-command.js +5 -3
  128. package/plugins/kimi-codex/dist/native-v2-preflight.js +243 -80
  129. package/plugins/kimi-codex/dist/parsing.js +211 -243
  130. package/plugins/kimi-codex/dist/paths.js +28 -10
  131. package/plugins/kimi-codex/dist/plugin-data.js +28 -83
  132. package/plugins/kimi-codex/dist/process-tree.js +35 -24
  133. package/plugins/kimi-codex/dist/read-scope.js +435 -0
  134. package/plugins/kimi-codex/dist/render.js +58 -46
  135. package/plugins/kimi-codex/dist/rescue-approval.js +461 -84
  136. package/plugins/kimi-codex/dist/session-references.js +216 -0
  137. package/plugins/kimi-codex/dist/session-title.js +26 -6
  138. package/plugins/kimi-codex/dist/stream-json.js +1 -3
  139. package/plugins/kimi-codex/dist/surface-routing.js +108 -0
  140. package/plugins/kimi-codex/dist/swarm-activation.js +74 -188
  141. package/plugins/kimi-codex/dist/swarm-policy.js +2 -1
  142. package/plugins/kimi-codex/dist/swarm-recovery.js +2 -1
  143. package/plugins/kimi-codex/dist/util.js +28 -0
  144. package/plugins/kimi-codex/dist/version.js +1 -1
  145. package/plugins/kimi-codex/scripts/companion.sh +4 -15
  146. package/plugins/kimi-codex/skills/kimi/SKILL.md +77 -0
  147. package/plugins/kimi-codex/skills/kimi/agents/openai.yaml +6 -0
  148. package/scripts/companion.sh +4 -15
  149. package/skills/kimi/SKILL.md +77 -0
  150. package/skills/kimi/agents/openai.yaml +6 -0
  151. package/CHANGELOG.md +0 -1333
  152. package/agents/kimi-ask.md +0 -89
  153. package/agents/kimi-challenge.md +0 -86
  154. package/agents/kimi-pursue.md +0 -93
  155. package/agents/kimi-rescue.md +0 -92
  156. package/agents/kimi-review.md +0 -86
  157. package/agents/kimi-swarm-write.md +0 -96
  158. package/agents/kimi-swarm.md +0 -86
  159. package/commands/README.md +0 -16
  160. package/commands/ask.md +0 -38
  161. package/commands/cancel.md +0 -17
  162. package/commands/challenge.md +0 -35
  163. package/commands/pursue.md +0 -41
  164. package/commands/replay.md +0 -13
  165. package/commands/rescue.md +0 -38
  166. package/commands/result.md +0 -13
  167. package/commands/review.md +0 -35
  168. package/commands/setup.md +0 -23
  169. package/commands/status.md +0 -13
  170. package/commands/swarm.md +0 -44
  171. package/dist/commands/not-implemented.js +0 -4
  172. package/dist/commands/review-gate.js +0 -390
  173. package/dist/config.js +0 -22
  174. package/dist/dsh/companion.js +0 -177
  175. package/dist/dsh/index.js +0 -169
  176. package/dist/hooks/review-gate-stop.js +0 -19
  177. package/dist/schemas/review-gate-output.js +0 -43
  178. package/docs/registry-releases.md +0 -228
  179. package/docs/upstream-2.4.1-certification.md +0 -54
  180. package/docs/upstream-2.5.0-certification.md +0 -52
  181. package/docs/upstream-2.5.1-certification.md +0 -47
  182. package/docs/upstream-2.5.2-certification.md +0 -40
  183. package/docs/upstream-2.5.3-certification.md +0 -73
  184. package/docs/upstream-2.6.0-certification.md +0 -65
  185. package/docs/upstream-2.6.2-certification.md +0 -144
  186. package/docs/upstream-2.6.3-certification.md +0 -100
  187. package/docs/upstream-2.7.2-certification.md +0 -113
  188. package/docs/upstream-2.7.3-certification.md +0 -83
  189. package/docs/windows-validation.md +0 -39
  190. package/hooks/README.md +0 -9
  191. package/hooks/hooks.json +0 -16
  192. package/plugins/kimi-codex/dist/commands/not-implemented.js +0 -4
  193. package/plugins/kimi-codex/dist/commands/review-gate.js +0 -390
  194. package/plugins/kimi-codex/dist/config.js +0 -22
  195. package/plugins/kimi-codex/dist/dsh/companion.js +0 -177
  196. package/plugins/kimi-codex/dist/dsh/index.js +0 -169
  197. package/plugins/kimi-codex/dist/hooks/review-gate-stop.js +0 -19
  198. package/plugins/kimi-codex/dist/schemas/review-gate-output.js +0 -43
  199. package/plugins/kimi-codex/scripts/review-gate-hook.sh +0 -32
  200. package/plugins/kimi-codex/skills/kimi-ask/SKILL.md +0 -35
  201. package/plugins/kimi-codex/skills/kimi-ask/agents/openai.yaml +0 -6
  202. package/plugins/kimi-codex/skills/kimi-cancel/SKILL.md +0 -25
  203. package/plugins/kimi-codex/skills/kimi-cancel/agents/openai.yaml +0 -6
  204. package/plugins/kimi-codex/skills/kimi-challenge/SKILL.md +0 -34
  205. package/plugins/kimi-codex/skills/kimi-challenge/agents/openai.yaml +0 -6
  206. package/plugins/kimi-codex/skills/kimi-pursue/SKILL.md +0 -32
  207. package/plugins/kimi-codex/skills/kimi-pursue/agents/openai.yaml +0 -6
  208. package/plugins/kimi-codex/skills/kimi-replay/SKILL.md +0 -25
  209. package/plugins/kimi-codex/skills/kimi-replay/agents/openai.yaml +0 -6
  210. package/plugins/kimi-codex/skills/kimi-rescue/SKILL.md +0 -34
  211. package/plugins/kimi-codex/skills/kimi-rescue/agents/openai.yaml +0 -6
  212. package/plugins/kimi-codex/skills/kimi-result/SKILL.md +0 -25
  213. package/plugins/kimi-codex/skills/kimi-result/agents/openai.yaml +0 -6
  214. package/plugins/kimi-codex/skills/kimi-review/SKILL.md +0 -34
  215. package/plugins/kimi-codex/skills/kimi-review/agents/openai.yaml +0 -6
  216. package/plugins/kimi-codex/skills/kimi-setup/SKILL.md +0 -34
  217. package/plugins/kimi-codex/skills/kimi-setup/agents/openai.yaml +0 -6
  218. package/plugins/kimi-codex/skills/kimi-status/SKILL.md +0 -25
  219. package/plugins/kimi-codex/skills/kimi-status/agents/openai.yaml +0 -6
  220. package/plugins/kimi-codex/skills/kimi-swarm/SKILL.md +0 -35
  221. package/plugins/kimi-codex/skills/kimi-swarm/agents/openai.yaml +0 -6
  222. package/plugins/kimi-codex/skills/kimi-swarm-write/SKILL.md +0 -36
  223. package/plugins/kimi-codex/skills/kimi-swarm-write/agents/openai.yaml +0 -6
  224. package/plugins/kimi-dsh/LICENSE +0 -201
  225. package/plugins/kimi-dsh/README.md +0 -83
  226. package/plugins/kimi-dsh/cordis.patch.yml +0 -45
  227. package/plugins/kimi-dsh/dist/background-spawn.js +0 -216
  228. package/plugins/kimi-dsh/dist/cli-cancellation.js +0 -43
  229. package/plugins/kimi-dsh/dist/cli-client.js +0 -1078
  230. package/plugins/kimi-dsh/dist/commands/ask.js +0 -336
  231. package/plugins/kimi-dsh/dist/commands/cancel.js +0 -216
  232. package/plugins/kimi-dsh/dist/commands/cli-helpers.js +0 -201
  233. package/plugins/kimi-dsh/dist/commands/models.js +0 -140
  234. package/plugins/kimi-dsh/dist/commands/not-implemented.js +0 -4
  235. package/plugins/kimi-dsh/dist/commands/pursue.js +0 -307
  236. package/plugins/kimi-dsh/dist/commands/recover-swarm.js +0 -140
  237. package/plugins/kimi-dsh/dist/commands/registry.js +0 -74
  238. package/plugins/kimi-dsh/dist/commands/repair-sessions.js +0 -160
  239. package/plugins/kimi-dsh/dist/commands/replay.js +0 -124
  240. package/plugins/kimi-dsh/dist/commands/rescue.js +0 -347
  241. package/plugins/kimi-dsh/dist/commands/result.js +0 -66
  242. package/plugins/kimi-dsh/dist/commands/review-gate.js +0 -390
  243. package/plugins/kimi-dsh/dist/commands/review.js +0 -220
  244. package/plugins/kimi-dsh/dist/commands/setup.js +0 -1129
  245. package/plugins/kimi-dsh/dist/commands/status.js +0 -27
  246. package/plugins/kimi-dsh/dist/commands/swarm.js +0 -849
  247. package/plugins/kimi-dsh/dist/commands/worker.js +0 -25
  248. package/plugins/kimi-dsh/dist/companion.js +0 -97
  249. package/plugins/kimi-dsh/dist/config.js +0 -22
  250. package/plugins/kimi-dsh/dist/dsh/companion.js +0 -177
  251. package/plugins/kimi-dsh/dist/dsh/index.js +0 -169
  252. package/plugins/kimi-dsh/dist/errors.js +0 -40
  253. package/plugins/kimi-dsh/dist/git.js +0 -224
  254. package/plugins/kimi-dsh/dist/help.js +0 -43
  255. package/plugins/kimi-dsh/dist/hook-escape.js +0 -71
  256. package/plugins/kimi-dsh/dist/hooks/approval-hook.js +0 -104
  257. package/plugins/kimi-dsh/dist/hooks/approval-policy.js +0 -233
  258. package/plugins/kimi-dsh/dist/hooks/config-safety.js +0 -665
  259. package/plugins/kimi-dsh/dist/hooks/install-paths.js +0 -428
  260. package/plugins/kimi-dsh/dist/hooks/install.js +0 -210
  261. package/plugins/kimi-dsh/dist/hooks/managed-block.js +0 -684
  262. package/plugins/kimi-dsh/dist/hooks/review-gate-stop.js +0 -19
  263. package/plugins/kimi-dsh/dist/job-id.js +0 -12
  264. package/plugins/kimi-dsh/dist/job-store.js +0 -659
  265. package/plugins/kimi-dsh/dist/jobs.js +0 -217
  266. package/plugins/kimi-dsh/dist/kimi-command.js +0 -71
  267. package/plugins/kimi-dsh/dist/kimi-engine.js +0 -675
  268. package/plugins/kimi-dsh/dist/kimi-errors.js +0 -260
  269. package/plugins/kimi-dsh/dist/kimi-home.js +0 -9
  270. package/plugins/kimi-dsh/dist/kimi-timeouts.js +0 -52
  271. package/plugins/kimi-dsh/dist/kimi-version-probe.js +0 -234
  272. package/plugins/kimi-dsh/dist/logging.js +0 -22
  273. package/plugins/kimi-dsh/dist/mcp/binding.js +0 -58
  274. package/plugins/kimi-dsh/dist/mcp/job-control.js +0 -345
  275. package/plugins/kimi-dsh/dist/mcp/launcher.js +0 -257
  276. package/plugins/kimi-dsh/dist/mcp/operations.js +0 -301
  277. package/plugins/kimi-dsh/dist/mcp/protocol.js +0 -275
  278. package/plugins/kimi-dsh/dist/mcp/server.js +0 -8
  279. package/plugins/kimi-dsh/dist/mcp/stdio.js +0 -78
  280. package/plugins/kimi-dsh/dist/mcp/supervised-child.js +0 -15
  281. package/plugins/kimi-dsh/dist/mcp/tool-result.js +0 -7
  282. package/plugins/kimi-dsh/dist/mcp/workspace.js +0 -34
  283. package/plugins/kimi-dsh/dist/model-command.js +0 -32
  284. package/plugins/kimi-dsh/dist/native-v2-preflight.js +0 -525
  285. package/plugins/kimi-dsh/dist/package.json +0 -1
  286. package/plugins/kimi-dsh/dist/parsing.js +0 -620
  287. package/plugins/kimi-dsh/dist/paths.js +0 -27
  288. package/plugins/kimi-dsh/dist/plugin-data.js +0 -98
  289. package/plugins/kimi-dsh/dist/process-tree.js +0 -586
  290. package/plugins/kimi-dsh/dist/prompt-size.js +0 -18
  291. package/plugins/kimi-dsh/dist/render.js +0 -177
  292. package/plugins/kimi-dsh/dist/rescue-approval.js +0 -865
  293. package/plugins/kimi-dsh/dist/schemas/review-gate-output.js +0 -43
  294. package/plugins/kimi-dsh/dist/session-recovery.js +0 -202
  295. package/plugins/kimi-dsh/dist/session-title.js +0 -293
  296. package/plugins/kimi-dsh/dist/stream-json.js +0 -346
  297. package/plugins/kimi-dsh/dist/swarm-activation.js +0 -1197
  298. package/plugins/kimi-dsh/dist/swarm-policy.js +0 -73
  299. package/plugins/kimi-dsh/dist/swarm-recovery.js +0 -165
  300. package/plugins/kimi-dsh/dist/swarm-tool-policy.js +0 -146
  301. package/plugins/kimi-dsh/dist/types.js +0 -1
  302. package/plugins/kimi-dsh/dist/vendor/shell-quote/LICENSE +0 -24
  303. package/plugins/kimi-dsh/dist/vendor/shell-quote/index.js +0 -1
  304. package/plugins/kimi-dsh/dist/vendor/shell-quote/parse.js +0 -229
  305. package/plugins/kimi-dsh/dist/vendor/smol-toml/LICENSE +0 -24
  306. package/plugins/kimi-dsh/dist/vendor/smol-toml/date.js +0 -156
  307. package/plugins/kimi-dsh/dist/vendor/smol-toml/error.js +0 -67
  308. package/plugins/kimi-dsh/dist/vendor/smol-toml/extract.js +0 -293
  309. package/plugins/kimi-dsh/dist/vendor/smol-toml/parse.js +0 -164
  310. package/plugins/kimi-dsh/dist/vendor/smol-toml/primitive.js +0 -151
  311. package/plugins/kimi-dsh/dist/vendor/smol-toml/struct.js +0 -156
  312. package/plugins/kimi-dsh/dist/vendor/smol-toml/util.js +0 -57
  313. package/plugins/kimi-dsh/dist/version.js +0 -7
  314. package/plugins/kimi-dsh/package.json +0 -78
  315. package/plugins/kimi-dsh/scripts/companion.sh +0 -37
  316. package/plugins/kimi-dsh/scripts/review-gate-hook.sh +0 -32
  317. package/scripts/review-gate-hook.sh +0 -32
@@ -1,151 +0,0 @@
1
- /*!
2
- * Copyright (c) Squirrel Chat et al., All rights reserved.
3
- * SPDX-License-Identifier: BSD-3-Clause
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions are met:
7
- *
8
- * 1. Redistributions of source code must retain the above copyright notice, this
9
- * list of conditions and the following disclaimer.
10
- * 2. Redistributions in binary form must reproduce the above copyright notice,
11
- * this list of conditions and the following disclaimer in the
12
- * documentation and/or other materials provided with the distribution.
13
- * 3. Neither the name of the copyright holder nor the names of its contributors
14
- * may be used to endorse or promote products derived from this software without
15
- * specific prior written permission.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
- */
28
- import { TomlError } from './error.js';
29
- /** @internal */
30
- export function parseString(ctx) {
31
- let startPtr = ctx.p;
32
- let c = ctx.s.charCodeAt(ctx.p++);
33
- let first = c;
34
- let isLiteral = c === 0x27; /* ' */
35
- let isMultiline = c === ctx.s.charCodeAt(ctx.p) && c === ctx.s.charCodeAt(ctx.p + 1);
36
- if (isMultiline) {
37
- // Trim initial newline
38
- if ((c = ctx.s.charCodeAt(ctx.p += 2)) === 0xa /* \n */)
39
- ctx.p++;
40
- else if (c === 0xd /* \r */ && ctx.s.charCodeAt(ctx.p + 1) === 0xa /* \n */)
41
- ctx.p += 2;
42
- }
43
- // For the record: it is not worth it to use a fast-path for literal strings using `indexOf`.
44
- // Doing a char-by-char iteration ends up dispatching less instructions, for the same wall-clock runtime.
45
- let parsed = '';
46
- let sliceStart = ctx.p;
47
- // states:
48
- // 0 - decoding
49
- // 1 - decoding escape
50
- // 2 - whitespace escape (no newline encountered yet, must fail on non-whitespace)
51
- // 3 - whitespace escape (newline encountered, allowed to transition back to normal decode)
52
- let state = 0;
53
- for (; ctx.p < ctx.s.length; ctx.p++) {
54
- c = ctx.s.charCodeAt(ctx.p);
55
- // Deal with newlines first, since that simplifies control character checking and handling across all states
56
- if (isMultiline && (c === 0xa /* \n */ || (c === 0xd /* \r */ && ctx.s.charCodeAt(ctx.p + 1) === 0xa /* \n */))) {
57
- state = state && 3;
58
- }
59
- // Control characters are banned in TOML, so we throw an error if we encounter them
60
- else if ((c < 0x20 && c !== 0x9 /* \t */) || c === 0x7f) {
61
- TomlError.x('control characters are not allowed in strings', ctx);
62
- }
63
- // The string might terminate while we're parsing through a newline escape.
64
- // It must have encountered a newline; otherwise, it'll simply fail in another branch.
65
- else if ((!state || state === 3) && c === first && (!isMultiline || (ctx.s.charCodeAt(ctx.p + 1) === first && ctx.s.charCodeAt(ctx.p + 2) === first))) {
66
- if (isMultiline) {
67
- // If the string ends with 4-5 quotes, then the first 1-2 are part of the string
68
- if (ctx.s.charCodeAt(ctx.p + 3) === first)
69
- ctx.p++;
70
- if (ctx.s.charCodeAt(ctx.p + 3) === first)
71
- ctx.p++;
72
- }
73
- // If we're in a newline escape still, then there's nothing to add.
74
- if (!state) {
75
- // Avoid a useless concat operation if the string can be used as-is.
76
- let s = ctx.s.slice(sliceStart, ctx.p);
77
- parsed = parsed ? parsed + s : s;
78
- }
79
- ctx.p += isMultiline ? 3 : 1;
80
- return parsed;
81
- }
82
- // Baseline state; keep moving forward unless an escape sequence starts
83
- else if (!state) {
84
- if (!isLiteral && c === 0x5c /* \ */) {
85
- parsed += ctx.s.slice(sliceStart, (sliceStart = ctx.p));
86
- state = 1;
87
- }
88
- }
89
- else if (state === 1) {
90
- if (c === 0x78 /* x */ || c === 0x75 /* u */ || c === 0x55 /* U */) { // Unicode escape
91
- let errPtr = ctx.p++ - 1;
92
- let value = 0;
93
- let len = c === 0x78 /* x */ ? 2 : c === 0x75 /* u */ ? 4 : 8;
94
- for (let j = 0; j < len; j++, ctx.p++) {
95
- let hex = ctx.s.charCodeAt(ctx.p);
96
- let digit =
97
- /* 0-9 */ hex >= 0x30 && hex <= 0x39 ? hex - 0x30 :
98
- /* A-F */ hex >= 0x41 && hex <= 0x46 ? hex - 0x41 + 10 :
99
- /* a-f */ hex >= 0x61 && hex <= 0x66 ? hex - 0x61 + 10 : -1;
100
- if (digit < 0)
101
- TomlError.x('invalid non-hex character in unicode escape', ctx);
102
- value = (value << 4) | digit;
103
- }
104
- // Because JS does bitwise on signed 32bit integers, all 0xfzzzzzzz values are actually seen as negative
105
- if (value < 0 || value > 0x10ffff || (value >= 0xd800 && value <= 0xdfff)) {
106
- TomlError.x('invalid unicode escape', ctx, errPtr);
107
- }
108
- parsed += String.fromCodePoint(value);
109
- sliceStart = ctx.p--;
110
- state = 0;
111
- }
112
- // Newline escape sequence. We only need to care about spaces and tabs; newlines are dealt with earlier
113
- else if (isMultiline && (c === 0x20 || c === 0x9 /* \t */)) {
114
- state = 2;
115
- }
116
- // Basic escape sequence
117
- else {
118
- if (c === 0x62 /* b */)
119
- parsed += '\b';
120
- else if (c === 0x74 /* t */)
121
- parsed += '\t';
122
- else if (c === 0x6e /* n */)
123
- parsed += '\n';
124
- else if (c === 0x66 /* f */)
125
- parsed += '\f';
126
- else if (c === 0x72 /* r */)
127
- parsed += '\r';
128
- else if (c === 0x65 /* e */)
129
- parsed += '\x1b';
130
- else if (c === 0x22 /* " */)
131
- parsed += '"';
132
- else if (c === 0x5c /* \ */)
133
- parsed += '\\';
134
- else
135
- TomlError.x('unrecognised escape sequence', ctx);
136
- sliceStart = ctx.p + 1;
137
- state = 0;
138
- }
139
- }
140
- // Newline escape continuation: keep moving forward until the first non-whitespace char
141
- else if (c !== 0x20 && c !== 0x9 /* \t */) {
142
- if (state === 2)
143
- TomlError.x('invalid escape: only line-ending whitespace may be escaped', ctx, sliceStart);
144
- // State cannot be zero, or we'd have branched earlier already.
145
- // If it's a backslash, immediately transition to the escape state so it can be processed.
146
- state = !isLiteral && c === 0x5c /* \ */ ? 1 : 0;
147
- sliceStart = ctx.p;
148
- }
149
- }
150
- TomlError.x('unfinished string', ctx, startPtr);
151
- }
@@ -1,156 +0,0 @@
1
- /*!
2
- * Copyright (c) Squirrel Chat et al., All rights reserved.
3
- * SPDX-License-Identifier: BSD-3-Clause
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions are met:
7
- *
8
- * 1. Redistributions of source code must retain the above copyright notice, this
9
- * list of conditions and the following disclaimer.
10
- * 2. Redistributions in binary form must reproduce the above copyright notice,
11
- * this list of conditions and the following disclaimer in the
12
- * documentation and/or other materials provided with the distribution.
13
- * 3. Neither the name of the copyright holder nor the names of its contributors
14
- * may be used to endorse or promote products derived from this software without
15
- * specific prior written permission.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
- */
28
- import { parseString } from './primitive.js';
29
- import { extractValue } from './extract.js';
30
- import { skipVoid } from './util.js';
31
- import { TomlError } from './error.js';
32
- /** @internal */
33
- export function parseKey(ctx, end = 0x3d /* = */) {
34
- // States:
35
- // 0: before first char
36
- // 1: parsing bare key
37
- // 2: after key component
38
- let startPtr;
39
- let state = 0;
40
- let parsed = [];
41
- let sliceStart;
42
- let c = ctx.s.charCodeAt(startPtr = ctx.p);
43
- do {
44
- // End of key
45
- if (c === end) {
46
- if (!state)
47
- TomlError.x('unexpected end of key', ctx);
48
- if (state === 1)
49
- parsed.push(ctx.s.slice(sliceStart, ctx.p));
50
- return ctx.p++, parsed;
51
- }
52
- // Dotted key separator
53
- else if (c === 0x2e /* . */) {
54
- if (!state)
55
- TomlError.x('illegal empty bare key', ctx);
56
- if (state === 1)
57
- parsed.push(ctx.s.slice(sliceStart, ctx.p));
58
- state = 0;
59
- }
60
- // Quoted key
61
- else if (!state && (c === 0x22 /* " */ || c === 0x27 /* ' */)) {
62
- if (c === ctx.s.charCodeAt(ctx.p + 1) && c === ctx.s.charCodeAt(ctx.p + 2))
63
- TomlError.x('illegal quoted key: multiline strings are not allowed', ctx);
64
- parsed.push(parseString(ctx));
65
- state = 2;
66
- ctx.p--;
67
- }
68
- // Whitespace; no-op in state 0 and 2, end of bare key in state 1
69
- else if (c === 0x20 || c === 0x9 /* \t */) {
70
- if (state === 1) {
71
- parsed.push(ctx.s.slice(sliceStart, ctx.p));
72
- state = 2;
73
- }
74
- }
75
- // If state is post-key, no character is allowed; otherwise ensure it's a bare-key component
76
- else if (state === 2 || (c < 0x30 && c !== 0x2d /* - */) || (c > 0x39 && c < 0x41) || (c > 0x5a && c < 0x61 && c !== 0x5f /* _ */) || c > 0x7a) {
77
- TomlError.x('illegal character in key', ctx);
78
- }
79
- // Illegal character
80
- else if (!state) {
81
- state = 1;
82
- sliceStart = ctx.p;
83
- }
84
- } while (c = ctx.s.charCodeAt(++ctx.p));
85
- TomlError.x('incomplete key-value: cannot find end of key', ctx, startPtr);
86
- }
87
- /** @internal */
88
- export function parseInlineTable(ctx) {
89
- let startPtr = ctx.p++;
90
- let res = Object.create(null);
91
- let seen = new Set();
92
- let c;
93
- while (ctx.p < ctx.s.length) {
94
- skipVoid(ctx);
95
- if ((c = ctx.s.charCodeAt(ctx.p)) === 0x7d /* } */) {
96
- ctx.p++;
97
- return res;
98
- }
99
- let k;
100
- let t = res;
101
- let hasOwn = false;
102
- let errPtr = ctx.p;
103
- let key = parseKey(ctx);
104
- for (let i = 0; i < key.length; i++) {
105
- if (i)
106
- t = hasOwn ? t[k] : (t[k] = Object.create(null));
107
- k = key[i];
108
- if ((hasOwn = Object.hasOwn(t, k)) && (typeof t[k] !== 'object' || seen.has(t[k]))) {
109
- TomlError.x('trying to redefine an already defined value', ctx, errPtr);
110
- }
111
- let unsafe = k === '__proto__';
112
- if (ctx.uk && (unsafe || k === 'constructor')) {
113
- t = ctx.uk !== 1 && TomlError.x('document contains an unsafe property', ctx, errPtr);
114
- break;
115
- }
116
- if (!hasOwn && unsafe) {
117
- Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
118
- }
119
- }
120
- if (hasOwn) {
121
- TomlError.x('trying to redefine an already defined value', ctx, errPtr);
122
- }
123
- skipVoid(ctx, true, true);
124
- let value = extractValue(ctx, 0x7d /* } */);
125
- if (t && typeof (t[k] = value) === 'object')
126
- seen.add(value);
127
- skipVoid(ctx);
128
- if ((c = ctx.s.charCodeAt(ctx.p++)) === 0x7d /* } */) {
129
- return res;
130
- }
131
- if (c !== 0x2c /* , */)
132
- TomlError.x('expected comma or end of structure', ctx, ctx.p - 1);
133
- }
134
- TomlError.x('unfinished table', ctx, startPtr);
135
- }
136
- /** @internal */
137
- export function parseArray(ctx) {
138
- let startPtr = ctx.p++;
139
- let res = [];
140
- let c;
141
- while (ctx.p < ctx.s.length) {
142
- skipVoid(ctx);
143
- if ((c = ctx.s.charCodeAt(ctx.p)) === 0x5d /* ] */) {
144
- ctx.p++;
145
- return res;
146
- }
147
- res.push(extractValue(ctx, 0x5d /* ] */));
148
- skipVoid(ctx);
149
- if ((c = ctx.s.charCodeAt(ctx.p++)) === 0x5d /* ] */) {
150
- return res;
151
- }
152
- if (c !== 0x2c /* , */)
153
- TomlError.x('expected comma or end of structure', ctx, ctx.p - 1);
154
- }
155
- TomlError.x('unfinished array', ctx, startPtr);
156
- }
@@ -1,57 +0,0 @@
1
- /*!
2
- * Copyright (c) Squirrel Chat et al., All rights reserved.
3
- * SPDX-License-Identifier: BSD-3-Clause
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions are met:
7
- *
8
- * 1. Redistributions of source code must retain the above copyright notice, this
9
- * list of conditions and the following disclaimer.
10
- * 2. Redistributions in binary form must reproduce the above copyright notice,
11
- * this list of conditions and the following disclaimer in the
12
- * documentation and/or other materials provided with the distribution.
13
- * 3. Neither the name of the copyright holder nor the names of its contributors
14
- * may be used to endorse or promote products derived from this software without
15
- * specific prior written permission.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
- */
28
- import { TomlError } from './error.js';
29
- /** @internal */
30
- export function skipComment(ctx) {
31
- for (; ctx.p < ctx.s.length; ctx.p++) {
32
- let c = ctx.s.charCodeAt(ctx.p);
33
- if (c === 0xa /* \n */)
34
- break;
35
- if (c === 0xd /* \r */ && ctx.s.charCodeAt(ctx.p + 1) === 0xa /* \n */) {
36
- ctx.p++;
37
- break;
38
- }
39
- if ((c < 0x20 && c !== 0x9 /* \t */) || c === 0x7f) {
40
- TomlError.x('control characters are not allowed in comments', ctx);
41
- }
42
- }
43
- }
44
- /** @internal */
45
- export function skipVoid(ctx, banNewLines, banComments) {
46
- let c;
47
- while (ctx.p < ctx.s.length) {
48
- while (ctx.p < ctx.s.length && ((c = ctx.s.charCodeAt(ctx.p)) === 0x20 ||
49
- c === 0x9 /* \t */ ||
50
- (!banNewLines &&
51
- (c === 0xa /* \n */ || (c === 0xd /* \r */ && ctx.s.charCodeAt(ctx.p + 1) === 0xa /* \n */)))))
52
- ctx.p++;
53
- if (banComments || c !== 0x23 /* # */)
54
- break;
55
- skipComment(ctx);
56
- }
57
- }
@@ -1,7 +0,0 @@
1
- // Single source of truth for the plugin version that the runtime reports
2
- // in setup output and managed-block markers. Keep this in sync with
3
- // package.json, .claude-plugin/plugin.json, .claude-plugin/marketplace.json,
4
- // and AGENTS.md on every release. A future improvement would read this from
5
- // package.json at build time, but that adds a build-step dependency we
6
- // don't want yet.
7
- export const KIMI_PLUGIN_CC_VERSION = "2.7.3";
@@ -1,78 +0,0 @@
1
- {
2
- "name": "kimi-plugin-cc",
3
- "version": "2.7.3",
4
- "description": "Kimi Code subagents for DeepSeek Harness: all seven ask, review, challenge, rescue, pursue, swarm, and swarm-write operations through the kimi-plugin-cc companion runtime.",
5
- "type": "module",
6
- "main": "dist/dsh/index.js",
7
- "exports": {
8
- ".": "./dist/dsh/index.js",
9
- "./cordis.patch.yml": "./cordis.patch.yml",
10
- "./package.json": "./package.json"
11
- },
12
- "files": [
13
- "cordis.patch.yml",
14
- "dist/",
15
- "scripts/",
16
- "README.md",
17
- "LICENSE"
18
- ],
19
- "engines": {
20
- "node": ">=24.9.0",
21
- "dsh": ">=0.2.1-rc.5 <0.3.0"
22
- },
23
- "dsh": {
24
- "bundle": {
25
- "patch": "./cordis.patch.yml"
26
- }
27
- },
28
- "peerDependencies": {
29
- "@deepseek-ai/cordis": "~4.0.5",
30
- "@deepseek-ai/dsh-commands": ">=0.2.1-rc.5 <0.3.0",
31
- "@deepseek-ai/dsh-llm": ">=0.2.1-rc.5 <0.3.0",
32
- "@deepseek-ai/dsh-session": ">=0.2.1-rc.5 <0.3.0",
33
- "@deepseek-ai/dsh-subagent": ">=0.2.1-rc.5 <0.3.0",
34
- "@deepseek-ai/dsh-subprocess": ">=0.2.1-rc.5 <0.3.0",
35
- "@deepseek-ai/dsh-system-prompt": ">=0.2.1-rc.5 <0.3.0",
36
- "@deepseek-ai/dsh-working-directory": ">=0.2.1-rc.5 <0.3.0",
37
- "@deepseek-ai/dsh-tool-subagent": ">=0.2.1-rc.5 <0.3.0"
38
- },
39
- "peerDependenciesMeta": {
40
- "@deepseek-ai/cordis": {
41
- "optional": true
42
- },
43
- "@deepseek-ai/dsh-commands": {
44
- "optional": true
45
- },
46
- "@deepseek-ai/dsh-llm": {
47
- "optional": true
48
- },
49
- "@deepseek-ai/dsh-session": {
50
- "optional": true
51
- },
52
- "@deepseek-ai/dsh-subagent": {
53
- "optional": true
54
- },
55
- "@deepseek-ai/dsh-subprocess": {
56
- "optional": true
57
- },
58
- "@deepseek-ai/dsh-system-prompt": {
59
- "optional": true
60
- },
61
- "@deepseek-ai/dsh-working-directory": {
62
- "optional": true
63
- },
64
- "@deepseek-ai/dsh-tool-subagent": {
65
- "optional": true
66
- }
67
- },
68
- "dependencies": {
69
- "@deepseek-ai/dsh-brand": ">=0.2.1-rc.5 <0.3.0",
70
- "@deepseek-ai/schemastery": "~3.18.5"
71
- },
72
- "license": "Apache-2.0",
73
- "repository": {
74
- "type": "git",
75
- "url": "git+https://github.com/linxule/kimi-plugin-cc.git",
76
- "directory": "plugins/kimi-dsh"
77
- }
78
- }
@@ -1,37 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
-
4
- # Entry point for slash commands. Launches the compiled Node runtime from the plugin root so
5
- # that runtime dependencies resolve against the plugin's node_modules, while preserving the
6
- # user's working directory via KIMI_PLUGIN_CC_WORKSPACE_CWD.
7
- #
8
- # Required env: CLAUDE_PLUGIN_ROOT (set by Claude Code when the plugin is installed).
9
- # Codex plugin hosts may provide PLUGIN_ROOT/PLUGIN_DATA instead; accept those as aliases.
10
- # When running from the repo checkout, both root env vars may be unset — default to the
11
- # script's parent directory so `bun run` style local invocation still works.
12
-
13
- : "${CLAUDE_PLUGIN_ROOT:=${PLUGIN_ROOT:-$(cd "$(dirname "$0")/.." && pwd)}}"
14
- export CLAUDE_PLUGIN_ROOT
15
- export PLUGIN_ROOT="${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT}}"
16
- # Data-root selection lives in the runtime so commands, workers, and Stop agree.
17
- # Preserve shared variables verbatim: conflicting values must not be hidden.
18
- export KIMI_PLUGIN_CC_SHELL_LAUNCH=1
19
- export KIMI_PLUGIN_CC_WORKSPACE_CWD="${KIMI_PLUGIN_CC_WORKSPACE_CWD:-$PWD}"
20
-
21
- NODE_BIN="${KIMI_PLUGIN_CC_NODE_BIN:-$(command -v node 2>/dev/null || true)}"
22
- if [ -z "${NODE_BIN}" ]; then
23
- echo "kimi-plugin-cc: unable to locate 'node'. Install Node >= 22.5 or set KIMI_PLUGIN_CC_NODE_BIN to an absolute path." >&2
24
- exit 127
25
- fi
26
-
27
- NODE_VERSION_OUT="$("${NODE_BIN}" --version 2>/dev/null || true)"
28
- NODE_MAJOR="$(printf '%s\n' "${NODE_VERSION_OUT}" | sed -En 's/^v([0-9]+)\..*/\1/p')"
29
- NODE_MINOR="$(printf '%s\n' "${NODE_VERSION_OUT}" | sed -En 's/^v[0-9]+\.([0-9]+)\..*/\1/p')"
30
- if [ -z "${NODE_MAJOR}" ] || [ -z "${NODE_MINOR}" ] || [ "${NODE_MAJOR}" -lt 22 ] || \
31
- { [ "${NODE_MAJOR}" -eq 22 ] && [ "${NODE_MINOR}" -lt 5 ]; }; then
32
- echo "kimi-plugin-cc requires Node >= 22.5.0 (node:sqlite is a built-in, introduced in 22.5). Found: ${NODE_VERSION_OUT:-unknown}. Upgrade Node or set KIMI_PLUGIN_CC_NODE_BIN to a qualifying binary." >&2
33
- exit 127
34
- fi
35
-
36
- cd "${CLAUDE_PLUGIN_ROOT}"
37
- exec "${NODE_BIN}" dist/companion.js "$@"
@@ -1,32 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
-
4
- # Entry point for the Claude Code/Codex Stop hook. Same cwd/env dance as companion.sh —
5
- # launches the compiled Node runtime from the plugin root while preserving the user's
6
- # workspace cwd, and honors KIMI_PLUGIN_CC_NODE_BIN so sanitized-PATH environments still work.
7
-
8
- : "${CLAUDE_PLUGIN_ROOT:=${PLUGIN_ROOT:-$(cd "$(dirname "$0")/.." && pwd)}}"
9
- export CLAUDE_PLUGIN_ROOT
10
- export PLUGIN_ROOT="${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT}}"
11
- # Data-root selection lives in the runtime so commands, workers, and Stop agree.
12
- # Preserve shared variables verbatim: conflicting values must not be hidden.
13
- export KIMI_PLUGIN_CC_SHELL_LAUNCH=1
14
- export KIMI_PLUGIN_CC_WORKSPACE_CWD="${KIMI_PLUGIN_CC_WORKSPACE_CWD:-$PWD}"
15
-
16
- NODE_BIN="${KIMI_PLUGIN_CC_NODE_BIN:-$(command -v node 2>/dev/null || true)}"
17
- if [ -z "${NODE_BIN}" ]; then
18
- echo "kimi-plugin-cc: unable to locate 'node'. Install Node >= 22.5 or set KIMI_PLUGIN_CC_NODE_BIN to an absolute path." >&2
19
- exit 127
20
- fi
21
-
22
- NODE_VERSION_OUT="$("${NODE_BIN}" --version 2>/dev/null || true)"
23
- NODE_MAJOR="$(printf '%s\n' "${NODE_VERSION_OUT}" | sed -En 's/^v([0-9]+)\..*/\1/p')"
24
- NODE_MINOR="$(printf '%s\n' "${NODE_VERSION_OUT}" | sed -En 's/^v[0-9]+\.([0-9]+)\..*/\1/p')"
25
- if [ -z "${NODE_MAJOR}" ] || [ -z "${NODE_MINOR}" ] || [ "${NODE_MAJOR}" -lt 22 ] || \
26
- { [ "${NODE_MAJOR}" -eq 22 ] && [ "${NODE_MINOR}" -lt 5 ]; }; then
27
- echo "kimi-plugin-cc requires Node >= 22.5.0 (node:sqlite is a built-in, introduced in 22.5). Found: ${NODE_VERSION_OUT:-unknown}. Upgrade Node or set KIMI_PLUGIN_CC_NODE_BIN to a qualifying binary." >&2
28
- exit 127
29
- fi
30
-
31
- cd "${CLAUDE_PLUGIN_ROOT}"
32
- exec "${NODE_BIN}" dist/hooks/review-gate-stop.js
@@ -1,32 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
-
4
- # Entry point for the Claude Code/Codex Stop hook. Same cwd/env dance as companion.sh —
5
- # launches the compiled Node runtime from the plugin root while preserving the user's
6
- # workspace cwd, and honors KIMI_PLUGIN_CC_NODE_BIN so sanitized-PATH environments still work.
7
-
8
- : "${CLAUDE_PLUGIN_ROOT:=${PLUGIN_ROOT:-$(cd "$(dirname "$0")/.." && pwd)}}"
9
- export CLAUDE_PLUGIN_ROOT
10
- export PLUGIN_ROOT="${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT}}"
11
- # Data-root selection lives in the runtime so commands, workers, and Stop agree.
12
- # Preserve shared variables verbatim: conflicting values must not be hidden.
13
- export KIMI_PLUGIN_CC_SHELL_LAUNCH=1
14
- export KIMI_PLUGIN_CC_WORKSPACE_CWD="${KIMI_PLUGIN_CC_WORKSPACE_CWD:-$PWD}"
15
-
16
- NODE_BIN="${KIMI_PLUGIN_CC_NODE_BIN:-$(command -v node 2>/dev/null || true)}"
17
- if [ -z "${NODE_BIN}" ]; then
18
- echo "kimi-plugin-cc: unable to locate 'node'. Install Node >= 22.5 or set KIMI_PLUGIN_CC_NODE_BIN to an absolute path." >&2
19
- exit 127
20
- fi
21
-
22
- NODE_VERSION_OUT="$("${NODE_BIN}" --version 2>/dev/null || true)"
23
- NODE_MAJOR="$(printf '%s\n' "${NODE_VERSION_OUT}" | sed -En 's/^v([0-9]+)\..*/\1/p')"
24
- NODE_MINOR="$(printf '%s\n' "${NODE_VERSION_OUT}" | sed -En 's/^v[0-9]+\.([0-9]+)\..*/\1/p')"
25
- if [ -z "${NODE_MAJOR}" ] || [ -z "${NODE_MINOR}" ] || [ "${NODE_MAJOR}" -lt 22 ] || \
26
- { [ "${NODE_MAJOR}" -eq 22 ] && [ "${NODE_MINOR}" -lt 5 ]; }; then
27
- echo "kimi-plugin-cc requires Node >= 22.5.0 (node:sqlite is a built-in, introduced in 22.5). Found: ${NODE_VERSION_OUT:-unknown}. Upgrade Node or set KIMI_PLUGIN_CC_NODE_BIN to a qualifying binary." >&2
28
- exit 127
29
- fi
30
-
31
- cd "${CLAUDE_PLUGIN_ROOT}"
32
- exec "${NODE_BIN}" dist/hooks/review-gate-stop.js