@weavecode/weave 0.1.8 → 0.1.9

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 (351) hide show
  1. package/node_modules/@modelcontextprotocol/sdk/node_modules/@hono/node-server/dist/index.cjs +31 -6
  2. package/node_modules/@modelcontextprotocol/sdk/node_modules/@hono/node-server/dist/index.mjs +31 -6
  3. package/node_modules/@modelcontextprotocol/sdk/node_modules/@hono/node-server/package.json +1 -1
  4. package/node_modules/@modelcontextprotocol/sdk/node_modules/express-rate-limit/dist/index.cjs +1 -1
  5. package/node_modules/@modelcontextprotocol/sdk/node_modules/express-rate-limit/dist/index.mjs +1 -1
  6. package/node_modules/@modelcontextprotocol/sdk/node_modules/express-rate-limit/node_modules/ip-address/README.md +39 -39
  7. package/node_modules/@modelcontextprotocol/sdk/node_modules/express-rate-limit/node_modules/ip-address/dist/ipv6.js +1 -1
  8. package/node_modules/@modelcontextprotocol/sdk/node_modules/express-rate-limit/node_modules/ip-address/package.json +1 -1
  9. package/node_modules/@modelcontextprotocol/sdk/node_modules/express-rate-limit/package.json +1 -1
  10. package/node_modules/@weavecode/cli/dist/cli.js +4 -4
  11. package/node_modules/@weavecode/cli/dist/commands/chpass.js +1 -1
  12. package/node_modules/@weavecode/cli/dist/commands/daemon-auth.js +1 -1
  13. package/node_modules/@weavecode/cli/dist/commands/daemon.js +2 -2
  14. package/node_modules/@weavecode/cli/dist/commands/dashboard.js +2 -2
  15. package/node_modules/@weavecode/cli/dist/commands/doctor.js +1 -1
  16. package/node_modules/@weavecode/cli/dist/commands/init.js +1 -1
  17. package/node_modules/@weavecode/cli/dist/commands/msg.js +2 -2
  18. package/node_modules/@weavecode/cli/dist/commands/scan.js +1 -1
  19. package/node_modules/@weavecode/cli/dist/commands/status.js +2 -2
  20. package/node_modules/@weavecode/cli/dist/commands/uninstall.js +1 -1
  21. package/node_modules/@weavecode/cli/dist/i18n/dict/en.js +2 -2
  22. package/node_modules/@weavecode/cli/dist/i18n/dict/zh.d.ts +7 -0
  23. package/node_modules/@weavecode/cli/dist/i18n/dict/zh.js +3 -3
  24. package/node_modules/@weavecode/cli/dist/i18n/index.js +1 -1
  25. package/node_modules/@weavecode/cli/dist/i18n/t.js +1 -1
  26. package/node_modules/@weavecode/cli/dist/init/claudemd-gen.js +5 -5
  27. package/node_modules/@weavecode/cli/dist/init/executor.js +3 -3
  28. package/node_modules/@weavecode/cli/dist/init/git-commit.js +2 -2
  29. package/node_modules/@weavecode/cli/dist/init/git-exclude.d.ts +20 -0
  30. package/node_modules/@weavecode/cli/dist/init/git-exclude.js +7 -0
  31. package/node_modules/@weavecode/cli/dist/init/harnesses/claude.js +7 -7
  32. package/node_modules/@weavecode/cli/dist/init/harnesses/codex.js +1 -1
  33. package/node_modules/@weavecode/cli/dist/init/instruction-files.d.ts +14 -0
  34. package/node_modules/@weavecode/cli/dist/init/instruction-files.js +1 -0
  35. package/node_modules/@weavecode/cli/dist/init/instruction-link.js +1 -1
  36. package/node_modules/@weavecode/cli/dist/init/plugin-templates.js +1 -1
  37. package/node_modules/@weavecode/cli/dist/init/prompt.js +4 -4
  38. package/node_modules/@weavecode/cli/dist/init/provision.js +1 -1
  39. package/node_modules/@weavecode/cli/dist/init/uninstall.js +6 -6
  40. package/node_modules/@weavecode/cli/dist/init/wiring.js +1 -1
  41. package/node_modules/@weavecode/cli/dist/parser.js +1 -1
  42. package/node_modules/@weavecode/cli/dist/statusline/ansi.js +1 -1
  43. package/node_modules/@weavecode/cli/dist/statusline/mock-input.js +1 -1
  44. package/node_modules/@weavecode/cli/dist/statusline/preview.js +2 -2
  45. package/node_modules/@weavecode/cli/package.json +5 -5
  46. package/node_modules/@weavecode/core/dist/harness-checks.js +1 -1
  47. package/node_modules/@weavecode/core/dist/harness.d.ts +37 -0
  48. package/node_modules/@weavecode/core/dist/harness.js +1 -1
  49. package/node_modules/@weavecode/core/dist/index.d.ts +1 -1
  50. package/node_modules/@weavecode/core/dist/index.js +1 -1
  51. package/node_modules/@weavecode/core/dist/platform.js +1 -1
  52. package/node_modules/@weavecode/core/dist/types.d.ts +4 -4
  53. package/node_modules/@weavecode/core/dist/types.js +1 -1
  54. package/node_modules/@weavecode/core/dist/utils/fs.js +1 -1
  55. package/node_modules/@weavecode/core/package.json +1 -1
  56. package/node_modules/@weavecode/harness/dist/claude/assets.js +3 -3
  57. package/node_modules/@weavecode/harness/dist/claude/capture.js +9 -9
  58. package/node_modules/@weavecode/harness/dist/claude/commands.js +3 -3
  59. package/node_modules/@weavecode/harness/dist/claude/config.js +2 -2
  60. package/node_modules/@weavecode/harness/dist/claude/detect.js +1 -1
  61. package/node_modules/@weavecode/harness/dist/claude/edits.js +1 -1
  62. package/node_modules/@weavecode/harness/dist/claude/event-source.js +1 -1
  63. package/node_modules/@weavecode/harness/dist/claude/images.js +2 -2
  64. package/node_modules/@weavecode/harness/dist/claude/index.js +1 -1
  65. package/node_modules/@weavecode/harness/dist/claude/liveness.js +1 -1
  66. package/node_modules/@weavecode/harness/dist/claude/mcp-gen.js +1 -1
  67. package/node_modules/@weavecode/harness/dist/claude/messaging.js +2 -2
  68. package/node_modules/@weavecode/harness/dist/claude/model-aliases.js +1 -1
  69. package/node_modules/@weavecode/harness/dist/claude/narration.js +1 -1
  70. package/node_modules/@weavecode/harness/dist/claude/peers.js +1 -1
  71. package/node_modules/@weavecode/harness/dist/claude/plan.js +1 -1
  72. package/node_modules/@weavecode/harness/dist/claude/plugins.js +4 -4
  73. package/node_modules/@weavecode/harness/dist/claude/prompt-inbox.js +1 -1
  74. package/node_modules/@weavecode/harness/dist/claude/prompt.js +3 -3
  75. package/node_modules/@weavecode/harness/dist/claude/questions.js +2 -2
  76. package/node_modules/@weavecode/harness/dist/claude/resume.js +1 -1
  77. package/node_modules/@weavecode/harness/dist/claude/rewind.js +1 -1
  78. package/node_modules/@weavecode/harness/dist/claude/settings-gen.js +1 -1
  79. package/node_modules/@weavecode/harness/dist/claude/side-question.js +2 -2
  80. package/node_modules/@weavecode/harness/dist/claude/statusline/generator.d.ts +6 -0
  81. package/node_modules/@weavecode/harness/dist/claude/statusline/generator.js +21 -14
  82. package/node_modules/@weavecode/harness/dist/claude/statusline/git-cache.js +1 -1
  83. package/node_modules/@weavecode/harness/dist/claude/statusline/surface.js +2 -2
  84. package/node_modules/@weavecode/harness/dist/claude/transcript-cursor.js +2 -2
  85. package/node_modules/@weavecode/harness/dist/claude/transcript.js +7 -7
  86. package/node_modules/@weavecode/harness/dist/codex/assets.js +1 -1
  87. package/node_modules/@weavecode/harness/dist/codex/capture.js +2 -2
  88. package/node_modules/@weavecode/harness/dist/codex/commands.js +4 -4
  89. package/node_modules/@weavecode/harness/dist/codex/config.js +2 -2
  90. package/node_modules/@weavecode/harness/dist/codex/detect.js +1 -1
  91. package/node_modules/@weavecode/harness/dist/codex/event-source.js +2 -2
  92. package/node_modules/@weavecode/harness/dist/codex/images.js +1 -1
  93. package/node_modules/@weavecode/harness/dist/codex/index.js +1 -1
  94. package/node_modules/@weavecode/harness/dist/codex/liveness.js +1 -1
  95. package/node_modules/@weavecode/harness/dist/codex/mcp.js +1 -1
  96. package/node_modules/@weavecode/harness/dist/codex/messaging.js +2 -2
  97. package/node_modules/@weavecode/harness/dist/codex/narration.js +1 -1
  98. package/node_modules/@weavecode/harness/dist/codex/plugin-state.js +1 -1
  99. package/node_modules/@weavecode/harness/dist/codex/plugins.js +3 -3
  100. package/node_modules/@weavecode/harness/dist/codex/provision.js +1 -1
  101. package/node_modules/@weavecode/harness/dist/codex/questions.js +2 -2
  102. package/node_modules/@weavecode/harness/dist/codex/rollout.js +5 -5
  103. package/node_modules/@weavecode/harness/dist/codex/side-question.js +4 -4
  104. package/node_modules/@weavecode/harness/dist/codex/titles.js +4 -4
  105. package/node_modules/@weavecode/harness/dist/codex/toml.js +13 -13
  106. package/node_modules/@weavecode/harness/dist/codex/transcript.js +2 -2
  107. package/node_modules/@weavecode/harness/dist/driver.js +1 -1
  108. package/node_modules/@weavecode/harness/dist/init/generated.js +2 -2
  109. package/node_modules/@weavecode/harness/dist/init/pipeline.js +1 -1
  110. package/node_modules/@weavecode/harness/dist/registry-wiring.js +1 -1
  111. package/node_modules/@weavecode/harness/dist/shared/install-link.js +1 -1
  112. package/node_modules/@weavecode/harness/dist/shared/json-cap.js +1 -1
  113. package/node_modules/@weavecode/harness/dist/zcode/assets.js +1 -1
  114. package/node_modules/@weavecode/harness/dist/zcode/capture.js +3 -3
  115. package/node_modules/@weavecode/harness/dist/zcode/mcp.js +2 -2
  116. package/node_modules/@weavecode/harness/package.json +2 -2
  117. package/node_modules/@weavecode/server/dist/config/dotted.js +1 -1
  118. package/node_modules/@weavecode/server/dist/config/profiles.js +2 -2
  119. package/node_modules/@weavecode/server/dist/daemon/ai-config.js +2 -2
  120. package/node_modules/@weavecode/server/dist/daemon/ai-context.js +6 -6
  121. package/node_modules/@weavecode/server/dist/daemon/ai-routes.js +4 -4
  122. package/node_modules/@weavecode/server/dist/daemon/api-log.js +3 -3
  123. package/node_modules/@weavecode/server/dist/daemon/auth-routes.js +1 -1
  124. package/node_modules/@weavecode/server/dist/daemon/auto-start.js +3 -3
  125. package/node_modules/@weavecode/server/dist/daemon/capture-routes.js +1 -1
  126. package/node_modules/@weavecode/server/dist/daemon/config-routes.js +1 -1
  127. package/node_modules/@weavecode/server/dist/daemon/cron.js +1 -1
  128. package/node_modules/@weavecode/server/dist/daemon/dashboard-auth.js +2 -2
  129. package/node_modules/@weavecode/server/dist/daemon/dashboard-pusher.js +1 -1
  130. package/node_modules/@weavecode/server/dist/daemon/decision-config.js +2 -2
  131. package/node_modules/@weavecode/server/dist/daemon/dev-entry.js +1 -1
  132. package/node_modules/@weavecode/server/dist/daemon/entry.js +2 -2
  133. package/node_modules/@weavecode/server/dist/daemon/fs-browser.js +1 -1
  134. package/node_modules/@weavecode/server/dist/daemon/hook-pipeline.js +1 -1
  135. package/node_modules/@weavecode/server/dist/daemon/hooks-routes.js +1 -1
  136. package/node_modules/@weavecode/server/dist/daemon/http.js +1 -1
  137. package/node_modules/@weavecode/server/dist/daemon/liveness.js +1 -1
  138. package/node_modules/@weavecode/server/dist/daemon/mcp-orchestration.js +1 -1
  139. package/node_modules/@weavecode/server/dist/daemon/narration-watcher.js +2 -2
  140. package/node_modules/@weavecode/server/dist/daemon/opener/backend-ghostty.js +1 -1
  141. package/node_modules/@weavecode/server/dist/daemon/opener/backend-iterm.js +1 -1
  142. package/node_modules/@weavecode/server/dist/daemon/opener/backend-konsole.js +2 -2
  143. package/node_modules/@weavecode/server/dist/daemon/opener/backend-terminal-app.js +1 -1
  144. package/node_modules/@weavecode/server/dist/daemon/opener/backend-wezterm.js +1 -1
  145. package/node_modules/@weavecode/server/dist/daemon/opener/backend-wt.js +1 -1
  146. package/node_modules/@weavecode/server/dist/daemon/opener/backend.js +1 -1
  147. package/node_modules/@weavecode/server/dist/daemon/opener/launch.js +1 -1
  148. package/node_modules/@weavecode/server/dist/daemon/opener/pty-terminals.js +1 -1
  149. package/node_modules/@weavecode/server/dist/daemon/opener/shared.js +1 -1
  150. package/node_modules/@weavecode/server/dist/daemon/opener/wezterm-mux.js +1 -1
  151. package/node_modules/@weavecode/server/dist/daemon/opener/wt.js +3 -3
  152. package/node_modules/@weavecode/server/dist/daemon/opener.js +1 -1
  153. package/node_modules/@weavecode/server/dist/daemon/pet-seed.d.ts +4 -6
  154. package/node_modules/@weavecode/server/dist/daemon/pet-seed.js +2 -1
  155. package/node_modules/@weavecode/server/dist/daemon/pet-window.js +1 -1
  156. package/node_modules/@weavecode/server/dist/daemon/port.js +1 -1
  157. package/node_modules/@weavecode/server/dist/daemon/project-files.js +2 -2
  158. package/node_modules/@weavecode/server/dist/daemon/project-harnesses.js +2 -2
  159. package/node_modules/@weavecode/server/dist/daemon/project-updates-refresher.js +1 -1
  160. package/node_modules/@weavecode/server/dist/daemon/prompt-images.js +1 -1
  161. package/node_modules/@weavecode/server/dist/daemon/routes/hooks-admin.js +1 -1
  162. package/node_modules/@weavecode/server/dist/daemon/routes/installations.d.ts +29 -0
  163. package/node_modules/@weavecode/server/dist/daemon/routes/installations.js +1 -0
  164. package/node_modules/@weavecode/server/dist/daemon/routes/market.js +1 -1
  165. package/node_modules/@weavecode/server/dist/daemon/routes/orchestration.js +1 -1
  166. package/node_modules/@weavecode/server/dist/daemon/routes/path-refs.js +1 -1
  167. package/node_modules/@weavecode/server/dist/daemon/routes/pets.js +1 -1
  168. package/node_modules/@weavecode/server/dist/daemon/routes/project-files.js +1 -1
  169. package/node_modules/@weavecode/server/dist/daemon/routes/projects.js +1 -1
  170. package/node_modules/@weavecode/server/dist/daemon/routes/search.js +1 -1
  171. package/node_modules/@weavecode/server/dist/daemon/routes/session-control.js +1 -1
  172. package/node_modules/@weavecode/server/dist/daemon/routes/session-insights.js +1 -1
  173. package/node_modules/@weavecode/server/dist/daemon/routes/settings-statusline.js +1 -1
  174. package/node_modules/@weavecode/server/dist/daemon/routes/uploads.js +1 -1
  175. package/node_modules/@weavecode/server/dist/daemon/routes/visualizations.js +2 -2
  176. package/node_modules/@weavecode/server/dist/daemon/routes/watches.js +1 -1
  177. package/node_modules/@weavecode/server/dist/daemon/server.d.ts +2 -0
  178. package/node_modules/@weavecode/server/dist/daemon/server.js +8 -8
  179. package/node_modules/@weavecode/server/dist/daemon/session-open.js +1 -1
  180. package/node_modules/@weavecode/server/dist/daemon/session-probe.js +1 -1
  181. package/node_modules/@weavecode/server/dist/daemon/settings.js +2 -2
  182. package/node_modules/@weavecode/server/dist/daemon/snapshot-refresher.js +1 -1
  183. package/node_modules/@weavecode/server/dist/daemon/sse-hub.js +1 -1
  184. package/node_modules/@weavecode/server/dist/daemon/start.js +1 -1
  185. package/node_modules/@weavecode/server/dist/daemon/state.js +2 -2
  186. package/node_modules/@weavecode/server/dist/daemon/static.js +1 -1
  187. package/node_modules/@weavecode/server/dist/daemon/terminal-topology-refresher.js +1 -1
  188. package/node_modules/@weavecode/server/dist/daemon/tls.js +1 -1
  189. package/node_modules/@weavecode/server/dist/daemon/toolkit-routes.js +1 -1
  190. package/node_modules/@weavecode/server/dist/daemon/upload-sessions.js +1 -1
  191. package/node_modules/@weavecode/server/dist/db/db.js +2 -2
  192. package/node_modules/@weavecode/server/dist/db/layout.d.ts +5 -0
  193. package/node_modules/@weavecode/server/dist/db/layout.js +2 -1
  194. package/node_modules/@weavecode/server/dist/db/paths.d.ts +5 -0
  195. package/node_modules/@weavecode/server/dist/db/paths.js +1 -1
  196. package/node_modules/@weavecode/server/dist/hooks/answer-keys.js +1 -1
  197. package/node_modules/@weavecode/server/dist/hooks/dashboard-rate.js +1 -1
  198. package/node_modules/@weavecode/server/dist/hooks/decision-judge.js +1 -1
  199. package/node_modules/@weavecode/server/dist/hooks/delivery/ack-gate.js +1 -1
  200. package/node_modules/@weavecode/server/dist/hooks/delivery/channels.js +1 -1
  201. package/node_modules/@weavecode/server/dist/hooks/delivery/keys.js +1 -1
  202. package/node_modules/@weavecode/server/dist/hooks/delivery/queue.js +1 -1
  203. package/node_modules/@weavecode/server/dist/hooks/delivery/relay.js +1 -1
  204. package/node_modules/@weavecode/server/dist/hooks/delivery/send.js +2 -2
  205. package/node_modules/@weavecode/server/dist/hooks/delivery/views.js +1 -1
  206. package/node_modules/@weavecode/server/dist/hooks/dispatcher.js +6 -6
  207. package/node_modules/@weavecode/server/dist/hooks/edge-extract.js +1 -1
  208. package/node_modules/@weavecode/server/dist/hooks/handlers/webhook.js +1 -1
  209. package/node_modules/@weavecode/server/dist/hooks/headless-runner.js +2 -2
  210. package/node_modules/@weavecode/server/dist/hooks/inbox-socket.js +2 -2
  211. package/node_modules/@weavecode/server/dist/hooks/inbox-worker.js +3 -3
  212. package/node_modules/@weavecode/server/dist/hooks/match.js +1 -1
  213. package/node_modules/@weavecode/server/dist/hooks/message-deliverer.js +5 -5
  214. package/node_modules/@weavecode/server/dist/hooks/mirror.js +4 -4
  215. package/node_modules/@weavecode/server/dist/hooks/orchestration-engine.js +7 -7
  216. package/node_modules/@weavecode/server/dist/hooks/orchestration-graph.js +1 -1
  217. package/node_modules/@weavecode/server/dist/hooks/plugin-installer.js +3 -3
  218. package/node_modules/@weavecode/server/dist/hooks/plugin-loader.js +1 -1
  219. package/node_modules/@weavecode/server/dist/hooks/plugin-project-state.js +1 -1
  220. package/node_modules/@weavecode/server/dist/hooks/prompt-flusher.js +1 -1
  221. package/node_modules/@weavecode/server/dist/hooks/promptbox.js +8 -8
  222. package/node_modules/@weavecode/server/dist/hooks/push-notify.js +2 -2
  223. package/node_modules/@weavecode/server/dist/hooks/question-tracker.js +1 -1
  224. package/node_modules/@weavecode/server/dist/hooks/registry.js +1 -1
  225. package/node_modules/@weavecode/server/dist/hooks/resume-runner.js +1 -1
  226. package/node_modules/@weavecode/server/dist/hooks/session-purge.js +1 -1
  227. package/node_modules/@weavecode/server/dist/hooks/side-questions.js +1 -1
  228. package/node_modules/@weavecode/server/dist/hooks/synthetic-sessions.js +1 -1
  229. package/node_modules/@weavecode/server/dist/hooks/toolkit-scan.js +1 -1
  230. package/node_modules/@weavecode/server/dist/hooks/toolkit.js +5 -5
  231. package/node_modules/@weavecode/server/dist/hooks/watch-engine.js +1 -1
  232. package/node_modules/@weavecode/server/dist/install/apply-update.js +1 -1
  233. package/node_modules/@weavecode/server/dist/install/capabilities.js +1 -1
  234. package/node_modules/@weavecode/server/dist/install/codex-toml.js +1 -1
  235. package/node_modules/@weavecode/server/dist/install/file-assets.js +1 -1
  236. package/node_modules/@weavecode/server/dist/install/fingerprint.js +1 -1
  237. package/node_modules/@weavecode/server/dist/install/global-config.js +1 -1
  238. package/node_modules/@weavecode/server/dist/install/global-file-assets.js +1 -1
  239. package/node_modules/@weavecode/server/dist/install/init-files.d.ts +0 -9
  240. package/node_modules/@weavecode/server/dist/install/init-files.js +2 -2
  241. package/node_modules/@weavecode/server/dist/install/install-ledger.js +1 -1
  242. package/node_modules/@weavecode/server/dist/install/installer.js +1 -1
  243. package/node_modules/@weavecode/server/dist/install/library-index.js +1 -1
  244. package/node_modules/@weavecode/server/dist/install/mcp-rows.js +1 -1
  245. package/node_modules/@weavecode/server/dist/install/plugin-install.js +1 -1
  246. package/node_modules/@weavecode/server/dist/install/plugin-rows.js +1 -1
  247. package/node_modules/@weavecode/server/dist/install/plugin-templates.js +1 -1
  248. package/node_modules/@weavecode/server/dist/install/project-config.js +1 -1
  249. package/node_modules/@weavecode/server/dist/install/reader.js +1 -1
  250. package/node_modules/@weavecode/server/dist/install/scan-cache.js +1 -1
  251. package/node_modules/@weavecode/server/dist/install/scanner.js +1 -1
  252. package/node_modules/@weavecode/server/dist/install/settings-mcp.js +2 -2
  253. package/node_modules/@weavecode/server/dist/install/updates.js +1 -1
  254. package/node_modules/@weavecode/server/dist/market/builtin.js +1 -1
  255. package/node_modules/@weavecode/server/dist/market/identity.js +1 -1
  256. package/node_modules/@weavecode/server/dist/market/import.js +2 -2
  257. package/node_modules/@weavecode/server/dist/market/refresh.js +1 -1
  258. package/node_modules/@weavecode/server/dist/market/resolve.js +1 -1
  259. package/node_modules/@weavecode/server/dist/market/updates.js +1 -1
  260. package/node_modules/@weavecode/server/dist/registry.js +2 -2
  261. package/node_modules/@weavecode/server/dist/repositories/hook-dispatches.js +4 -4
  262. package/node_modules/@weavecode/server/dist/repositories/hook-events.js +6 -6
  263. package/node_modules/@weavecode/server/dist/repositories/hook-rules.js +4 -4
  264. package/node_modules/@weavecode/server/dist/repositories/libraries.js +1 -1
  265. package/node_modules/@weavecode/server/dist/repositories/orchestrations.js +7 -7
  266. package/node_modules/@weavecode/server/dist/repositories/plugin-states.js +1 -1
  267. package/node_modules/@weavecode/server/dist/repositories/projects.js +1 -1
  268. package/node_modules/@weavecode/server/dist/repositories/push-subscriptions.js +2 -2
  269. package/node_modules/@weavecode/server/dist/repositories/session-watches.js +4 -4
  270. package/node_modules/@weavecode/server/dist/repositories/sessions.js +2 -2
  271. package/node_modules/@weavecode/server/dist/repositories/uploads.js +11 -11
  272. package/node_modules/@weavecode/server/dist/statusline/cache-sweeper.js +1 -1
  273. package/node_modules/@weavecode/server/dist/statusline/generator.js +1 -1
  274. package/node_modules/@weavecode/server/dist/statusline/manager.js +3 -3
  275. package/node_modules/@weavecode/server/dist/surfaces.js +1 -1
  276. package/node_modules/@weavecode/server/dist/watch/cache.js +1 -1
  277. package/node_modules/@weavecode/server/dist/watch/classifier.js +1 -1
  278. package/node_modules/@weavecode/server/dist/watch/plugin-mods.js +1 -1
  279. package/node_modules/@weavecode/server/dist/watch/sync-scheduler.js +1 -1
  280. package/node_modules/@weavecode/server/dist/watch/watch-service.js +1 -1
  281. package/node_modules/@weavecode/server/package.json +4 -4
  282. package/node_modules/@weavecode/server/web/dist/assets/{abnfDiagram-WEYOIA3C-t5OQjhuS.js → abnfDiagram-WEYOIA3C-S1lL1V_n.js} +1 -1
  283. package/node_modules/@weavecode/server/web/dist/assets/{arc-De-uH_Q9.js → arc-CoTNHyHV.js} +1 -1
  284. package/node_modules/@weavecode/server/web/dist/assets/{architectureDiagram-ZHVYKT53-ImPclD43.js → architectureDiagram-ZHVYKT53-C6ttfnzW.js} +1 -1
  285. package/node_modules/@weavecode/server/web/dist/assets/{blockDiagram-RJAE7QA3-B5xEQs6X.js → blockDiagram-RJAE7QA3-CYr3Cpu9.js} +1 -1
  286. package/node_modules/@weavecode/server/web/dist/assets/{c4Diagram-XDPPPE54-DP8MjIgJ.js → c4Diagram-XDPPPE54-BFS7PhLD.js} +1 -1
  287. package/node_modules/@weavecode/server/web/dist/assets/channel-DxQHp3Yc.js +1 -0
  288. package/node_modules/@weavecode/server/web/dist/assets/{chunk-2E7WHVMD-C3UFIDyj.js → chunk-2E7WHVMD-DJ7X_Shu.js} +1 -1
  289. package/node_modules/@weavecode/server/web/dist/assets/{chunk-2Q5K7J3B-Bgw-3YfG.js → chunk-2Q5K7J3B-B8nr2rdz.js} +1 -1
  290. package/node_modules/@weavecode/server/web/dist/assets/{chunk-4EMNKR2T-Dy_Wq9qn.js → chunk-4EMNKR2T-DmnZmUMU.js} +1 -1
  291. package/node_modules/@weavecode/server/web/dist/assets/{chunk-55XCU76K-D32C0DXX.js → chunk-55XCU76K-Xz9a8dmp.js} +1 -1
  292. package/node_modules/@weavecode/server/web/dist/assets/{chunk-5VM5RSS4-Dpmi-9Gi.js → chunk-5VM5RSS4-Dg9mg7pf.js} +1 -1
  293. package/node_modules/@weavecode/server/web/dist/assets/{chunk-JWPE2WC7-CEYXaZDX.js → chunk-JWPE2WC7-CmjTZO8o.js} +1 -1
  294. package/node_modules/@weavecode/server/web/dist/assets/{chunk-VQ5W62QI-A616Pgzo.js → chunk-VQ5W62QI-D3YDdJ3E.js} +1 -1
  295. package/node_modules/@weavecode/server/web/dist/assets/{chunk-XXDRQBXY-CnxFMLWV.js → chunk-XXDRQBXY-s1OG9sqW.js} +1 -1
  296. package/node_modules/@weavecode/server/web/dist/assets/{chunk-ZCHMQSOR-BhjCTig8.js → chunk-ZCHMQSOR-C3hINQU3.js} +2 -2
  297. package/node_modules/@weavecode/server/web/dist/assets/{classDiagram-v2-4MYWR3UA-rzlq5tPv.js → classDiagram-v2-4MYWR3UA-BTsbYrVl.js} +1 -1
  298. package/node_modules/@weavecode/server/web/dist/assets/{cose-bilkent-JH36ORCC-CxWQXzj8.js → cose-bilkent-JH36ORCC-C0W8Y-jI.js} +1 -1
  299. package/node_modules/@weavecode/server/web/dist/assets/{cynefin-EF2NZ3EQ-AFHjx2wU.js → cynefin-EF2NZ3EQ-stAu4Rh-.js} +1 -1
  300. package/node_modules/@weavecode/server/web/dist/assets/{cynefinDiagram-WF24UDRP-Bp_Oaf9U.js → cynefinDiagram-WF24UDRP-CqYibiiv.js} +1 -1
  301. package/node_modules/@weavecode/server/web/dist/assets/{dagre-NK4GIZVX-7oUPIU35.js → dagre-NK4GIZVX-qqcoJAqB.js} +1 -1
  302. package/node_modules/@weavecode/server/web/dist/assets/{diagram-CBK3MWTC-D_rS_rSY.js → diagram-CBK3MWTC-D0YTopb7.js} +1 -1
  303. package/node_modules/@weavecode/server/web/dist/assets/{diagram-I5XIIV2D-Duc_cKMb.js → diagram-I5XIIV2D-Csvw6aYr.js} +1 -1
  304. package/node_modules/@weavecode/server/web/dist/assets/{diagram-ODIL2UCW-DA0XFVXm.js → diagram-ODIL2UCW-Dl0tYLkF.js} +1 -1
  305. package/node_modules/@weavecode/server/web/dist/assets/{diagram-PFBEJUXE-D1U0Xhtt.js → diagram-PFBEJUXE-BCPSWZPe.js} +1 -1
  306. package/node_modules/@weavecode/server/web/dist/assets/{diagram-RJA3I4VV-CbDFY871.js → diagram-RJA3I4VV-ETg-BrAJ.js} +1 -1
  307. package/node_modules/@weavecode/server/web/dist/assets/{diagram-TYUNFSNR-jPg9AxQv.js → diagram-TYUNFSNR-_M6ZxBG7.js} +1 -1
  308. package/node_modules/@weavecode/server/web/dist/assets/{ebnfDiagram-V4P3TTPT-ZHfGTB0N.js → ebnfDiagram-V4P3TTPT-C-e_W7qx.js} +1 -1
  309. package/node_modules/@weavecode/server/web/dist/assets/{elk-QONTBCTQ-C-ESJrUi.js → elk-QONTBCTQ-B5TBharB.js} +1 -1
  310. package/node_modules/@weavecode/server/web/dist/assets/{erDiagram-KYQIGQAA-DGK7TeHj.js → erDiagram-KYQIGQAA-D08rj2pv.js} +1 -1
  311. package/node_modules/@weavecode/server/web/dist/assets/{flowDiagram-IUGLLWBU-CVV4rL8v.js → flowDiagram-IUGLLWBU-BALTxsKh.js} +1 -1
  312. package/node_modules/@weavecode/server/web/dist/assets/{ganttDiagram-R7GPNTJY-CuAwNvbm.js → ganttDiagram-R7GPNTJY-Cts193jT.js} +1 -1
  313. package/node_modules/@weavecode/server/web/dist/assets/{gitGraphDiagram-PDYL7XHY-D_15Wtf-.js → gitGraphDiagram-PDYL7XHY-L9qYUX0v.js} +1 -1
  314. package/node_modules/@weavecode/server/web/dist/assets/{infoDiagram-MVDRKAX5-ClqhbrCa.js → infoDiagram-MVDRKAX5-Bv47rgU0.js} +1 -1
  315. package/node_modules/@weavecode/server/web/dist/assets/{ishikawaDiagram-HPEHV2GE-CUJ891JX.js → ishikawaDiagram-HPEHV2GE-Da8_s6cs.js} +1 -1
  316. package/node_modules/@weavecode/server/web/dist/assets/{journeyDiagram-BOSHW7O7-B4skiMu-.js → journeyDiagram-BOSHW7O7-Bj3CjZOf.js} +1 -1
  317. package/node_modules/@weavecode/server/web/dist/assets/{kanban-definition-FNSA4HC5-UNGJR_y_.js → kanban-definition-FNSA4HC5-D1hicmMu.js} +1 -1
  318. package/node_modules/@weavecode/server/web/dist/assets/{linear-BEB-UwbR.js → linear-CWQg2iA1.js} +1 -1
  319. package/node_modules/@weavecode/server/web/dist/assets/main-XLn3EZFh.css +11 -0
  320. package/node_modules/@weavecode/server/web/dist/assets/main-bsb0lQoL.js +1096 -0
  321. package/node_modules/@weavecode/server/web/dist/assets/{mermaid.core-knGXJfjz.js → mermaid.core-C-wP0Zg2.js} +4 -4
  322. package/node_modules/@weavecode/server/web/dist/assets/{mindmap-definition-6OY57UG3-CEldbr3a.js → mindmap-definition-6OY57UG3-Dk0VKqre.js} +1 -1
  323. package/node_modules/@weavecode/server/web/dist/assets/{pegDiagram-ECIUJNBX-cNCkGLx3.js → pegDiagram-ECIUJNBX-Bp1K_F9z.js} +1 -1
  324. package/node_modules/@weavecode/server/web/dist/assets/pet-J6izA90s.js +1 -0
  325. package/node_modules/@weavecode/server/web/dist/assets/{pieDiagram-GNMPY74T-CfMEFiQD.js → pieDiagram-GNMPY74T-BZ4rGy3t.js} +1 -1
  326. package/node_modules/@weavecode/server/web/dist/assets/{quadrantDiagram-D57K4MC3-knmi2rwP.js → quadrantDiagram-D57K4MC3-B4N5KRsR.js} +1 -1
  327. package/node_modules/@weavecode/server/web/dist/assets/{railroadDiagram-Y72NRBL7-BJ7AzhEo.js → railroadDiagram-Y72NRBL7-C8nx8oHf.js} +1 -1
  328. package/node_modules/@weavecode/server/web/dist/assets/{requirementDiagram-EQYSW5RA-Dte2LGQM.js → requirementDiagram-EQYSW5RA-VSH57d0d.js} +1 -1
  329. package/node_modules/@weavecode/server/web/dist/assets/{sankeyDiagram-SY24JHO5-3noLaWgd.js → sankeyDiagram-SY24JHO5-jUb1hcya.js} +1 -1
  330. package/node_modules/@weavecode/server/web/dist/assets/{sequenceDiagram-BLEHNHQU-CclOWTTc.js → sequenceDiagram-BLEHNHQU-E2BioCNi.js} +1 -1
  331. package/node_modules/@weavecode/server/web/dist/assets/{sizeCapture-INFHLROL-B82sbLhA.js → sizeCapture-INFHLROL-BdKrbRmI.js} +1 -1
  332. package/node_modules/@weavecode/server/web/dist/assets/{stateDiagram-v2-A6IESKWZ-BXfVDwSN.js → stateDiagram-v2-A6IESKWZ-tFz7uNM7.js} +1 -1
  333. package/node_modules/@weavecode/server/web/dist/assets/{swimlanes-B3ENRKFQ-D4lKZaeV.js → swimlanes-B3ENRKFQ-B9BAPDWw.js} +1 -1
  334. package/node_modules/@weavecode/server/web/dist/assets/swimlanesDiagram-AYQRV4AK-DQ2NPLl9.js +8 -0
  335. package/node_modules/@weavecode/server/web/dist/assets/{timeline-definition-JXYKGLGB-D6H6zP5b.js → timeline-definition-JXYKGLGB-CofNnFTK.js} +1 -1
  336. package/node_modules/@weavecode/server/web/dist/assets/{usecaseDiagram-WPOLBNNX-D2J2bKo_.js → usecaseDiagram-WPOLBNNX-DOvjhJjJ.js} +1 -1
  337. package/node_modules/@weavecode/server/web/dist/assets/{vennDiagram-Q3Y3IDCW-pdRbIkpB.js → vennDiagram-Q3Y3IDCW-BcFHWnhS.js} +1 -1
  338. package/node_modules/@weavecode/server/web/dist/assets/{wardleyDiagram-IVAIDKWA-Cyd2QPMf.js → wardleyDiagram-IVAIDKWA-Bz2aqRAs.js} +1 -1
  339. package/node_modules/@weavecode/server/web/dist/assets/{xychartDiagram-4URNHDU4-Bd4BkwVM.js → xychartDiagram-4URNHDU4-DpNF6Vsq.js} +1 -1
  340. package/node_modules/@weavecode/server/web/dist/index.html +2 -2
  341. package/node_modules/@weavecode/server/web/dist/pet.html +80 -10
  342. package/node_modules/@weavecode/templates/dist/resources/pets/weave-spider/pet.json +1 -1
  343. package/node_modules/@weavecode/templates/dist/resources/pets/weave-spider/spritesheet.png +0 -0
  344. package/node_modules/@weavecode/templates/package.json +2 -2
  345. package/package.json +6 -6
  346. package/scripts/preinstall.mjs +60 -22
  347. package/node_modules/@weavecode/server/web/dist/assets/channel-C0RGiobt.js +0 -1
  348. package/node_modules/@weavecode/server/web/dist/assets/main-B_0jS_Gz.js +0 -1096
  349. package/node_modules/@weavecode/server/web/dist/assets/main-Czzlavi4.css +0 -11
  350. package/node_modules/@weavecode/server/web/dist/assets/pet-DJCpIDM5.js +0 -1
  351. package/node_modules/@weavecode/server/web/dist/assets/swimlanesDiagram-AYQRV4AK-DbdFh_d6.js +0 -8
@@ -1 +1 @@
1
- import{t as c}from"./i18n/index.js";export class CommandParser{commands=new Map;globalOptions=[];constructor(){this.initGlobalOptions()}initGlobalOptions(){this.globalOptions=[{name:"help",short:"h",description:"flag.help",type:"boolean",default:!1},{name:"version",short:"V",description:"flag.version",type:"boolean",default:!1},{name:"verbose",short:"v",description:"flag.verbose",type:"boolean",default:!1},{name:"quiet",short:"q",description:"flag.quiet",type:"boolean",default:!1}]}registerCommand(e){if(this.commands.set(e.name,e),e.aliases)for(const t of e.aliases)this.commands.set(t,e)}getCommand(e){return this.commands.get(e)}getAllCommands(){const e=new Set;return Array.from(this.commands.values()).filter(t=>e.has(t)?!1:(e.add(t),!0))}parse(e){const t={command:[],flags:{_:[]},positional:[],raw:[...e]};let s;for(let r=0;r<e.length;r++){const i=e[r];if(i.startsWith("-"))break;if(t.command.length===0&&this.commands.has(i)){s=this.commands.get(i),t.command.push(i);continue}if(t.command.length===1&&s?.subcommands){const l=s.subcommands.find(u=>u.name===i||u.aliases?.includes(i));if(l){s=l,t.command.push(i);continue}}if(t.command.length===2&&s?.subcommands){const l=s.subcommands.find(u=>u.name===i||u.aliases?.includes(i));if(l){s=l,t.command.push(i);continue}}break}const f=this.buildAliases(s),n=this.booleanFlags(s);let a=!0,o=t.command.length;for(;o<e.length;){const r=e[o];if(r==="--"){a=!1,o++;continue}if(a&&r.startsWith("-")){const i=this.parseFlag(e,o,f,n);Object.assign(t.flags,i.flags),o=i.nextIndex;continue}t.positional.push(r),t.flags._.push(r),o++}return this.applyDefaults(t.flags,s),t}validateFlags(e,t){const s=[],f=[...this.globalOptions,...t?.options??[]];for(const n of f){const a=this.normalizeKey(n.name);if(n.required&&e[a]===void 0&&s.push(c("cli.missingRequired",{name:n.name})),n.choices&&e[a]!==void 0){const o=String(e[a]);n.choices.includes(o)||s.push(c("cli.invalidChoice",{name:n.name,value:o,choices:n.choices.join(", ")}))}if(n.validate&&e[a]!==void 0){const o=n.validate(e[a]);o!==!0&&s.push(o)}}return s}getGlobalOptions(){return[...this.globalOptions]}parseFlag(e,t,s,f){const n={},a=e[t];let o=t+1;if(a.startsWith("--")){const r=a.indexOf("=");if(r!==-1){const i=a.slice(2,r);n[this.normalizeKey(i)]=this.parseValue(a.slice(r+1))}else if(a.startsWith("--no-")){const i=a.slice(5);n[this.normalizeKey(i)]=!1}else{const i=a.slice(2),l=this.normalizeKey(i);f.has(l)?o<e.length&&this.isBooleanLiteral(e[o])?(n[l]=e[o].toLowerCase()==="true",o++):n[l]=!0:o<e.length&&this.isFlagValue(e[o])?(n[l]=this.parseValue(e[o]),o++):n[l]=!0}}else if(a.startsWith("-")){const r=a.slice(1);if(r.length===1){const i=s[r]||r,l=this.normalizeKey(i);f.has(l)?o<e.length&&this.isBooleanLiteral(e[o])?(n[l]=e[o].toLowerCase()==="true",o++):n[l]=!0:o<e.length&&this.isFlagValue(e[o])?(n[l]=this.parseValue(e[o]),o++):n[l]=!0}else for(const i of r){const l=s[i]||i;n[this.normalizeKey(l)]=!0}}return{flags:n,nextIndex:o}}isFlagValue(e){return e.startsWith("-")?/^-\d*\.?\d+(?:[eE][+-]?\d+)?$/.test(e):!0}isBooleanLiteral(e){const t=e.toLowerCase();return t==="true"||t==="false"}parseValue(e){if(e.toLowerCase()==="true")return!0;if(e.toLowerCase()==="false")return!1;const t=Number(e);return!isNaN(t)&&e.trim()!==""?t:e}normalizeKey(e){return e.replace(/-([a-z])/g,(t,s)=>s.toUpperCase())}buildAliases(e){const t={};for(const s of this.globalOptions)s.short&&(t[s.short]=s.name);if(e?.options)for(const s of e.options)s.short&&(t[s.short]=s.name);return t}booleanFlags(e){const t=new Set;for(const s of this.globalOptions)s.type==="boolean"&&t.add(this.normalizeKey(s.name));if(e?.options)for(const s of e.options)s.type==="boolean"?t.add(this.normalizeKey(s.name)):s.type&&t.delete(this.normalizeKey(s.name));return t}applyDefaults(e,t){const s=[];t?.options&&s.push(t.options),s.push(this.globalOptions);for(const f of s)for(const n of f){const a=this.normalizeKey(n.name);e[a]===void 0&&n.default!==void 0&&(e[a]=n.default)}}}
1
+ import{t as h}from"./i18n/index.js";export class CommandParser{commands=new Map;globalOptions=[];constructor(){this.initGlobalOptions()}initGlobalOptions(){this.globalOptions=[{name:"help",short:"h",description:"flag.help",type:"boolean",default:!1},{name:"version",short:"V",description:"flag.version",type:"boolean",default:!1},{name:"verbose",short:"v",description:"flag.verbose",type:"boolean",default:!1},{name:"quiet",short:"q",description:"flag.quiet",type:"boolean",default:!1}]}registerCommand(e){if(this.commands.set(e.name,e),e.aliases)for(const t of e.aliases)this.commands.set(t,e)}getCommand(e){return this.commands.get(e)}getAllCommands(){const e=new Set;return Array.from(this.commands.values()).filter(t=>e.has(t)?!1:(e.add(t),!0))}parse(e){const t={command:[],flags:{_:[]},positional:[],raw:[...e]};let o;for(let r=0;r<e.length;r++){const i=e[r];if(i.startsWith("-"))break;if(t.command.length===0&&this.commands.has(i)){o=this.commands.get(i),t.command.push(i);continue}if(t.command.length===1&&o?.subcommands){const l=o.subcommands.find(m=>m.name===i||m.aliases?.includes(i));if(l){o=l,t.command.push(i);continue}}if(t.command.length===2&&o?.subcommands){const l=o.subcommands.find(m=>m.name===i||m.aliases?.includes(i));if(l){o=l,t.command.push(i);continue}}break}const c=this.buildAliases(o),n=this.booleanFlags(o);let a=!0,s=t.command.length;for(;s<e.length;){const r=e[s];if(r==="--"){a=!1,s++;continue}if(a&&r.startsWith("-")){const i=this.parseFlag(e,s,c,n);Object.assign(t.flags,i.flags),s=i.nextIndex;continue}t.positional.push(r),t.flags._.push(r),s++}return this.applyDefaults(t.flags,o),t}validateFlags(e,t){const o=[],c=[...this.globalOptions,...t?.options??[]];for(const n of c){const a=this.normalizeKey(n.name);if(n.required&&e[a]===void 0&&o.push(h("cli.missingRequired",{name:n.name})),n.choices&&e[a]!==void 0){const s=String(e[a]);n.choices.includes(s)||o.push(h("cli.invalidChoice",{name:n.name,value:s,choices:n.choices.join(", ")}))}if(n.validate&&e[a]!==void 0){const s=n.validate(e[a]);s!==!0&&o.push(s)}}return o}getGlobalOptions(){return[...this.globalOptions]}parseFlag(e,t,o,c){const n={},a=e[t];let s=t+1;if(a.startsWith("--")){const r=a.indexOf("=");if(r!==-1){const i=a.slice(2,r);n[this.normalizeKey(i)]=this.parseValue(a.slice(r+1))}else if(a.startsWith("--no-")){const i=a.slice(5);n[this.normalizeKey(i)]=!1}else{const i=a.slice(2),l=this.normalizeKey(i);c.has(l)?s<e.length&&this.isBooleanLiteral(e[s])?(n[l]=e[s].toLowerCase()==="true",s++):n[l]=!0:s<e.length&&this.isFlagValue(e[s])?(n[l]=this.parseValue(e[s]),s++):n[l]=!0}}else if(a.startsWith("-")){const r=a.slice(1);if(r.length===1){const i=o[r]||r,l=this.normalizeKey(i);c.has(l)?s<e.length&&this.isBooleanLiteral(e[s])?(n[l]=e[s].toLowerCase()==="true",s++):n[l]=!0:s<e.length&&this.isFlagValue(e[s])?(n[l]=this.parseValue(e[s]),s++):n[l]=!0}else for(const i of r){const l=o[i]||i;n[this.normalizeKey(l)]=!0}}return{flags:n,nextIndex:s}}isFlagValue(e){return e.startsWith("-")?/^-\d*\.?\d+(?:[eE][+-]?\d+)?$/.test(e):!0}isBooleanLiteral(e){const t=e.toLowerCase();return t==="true"||t==="false"}parseValue(e){if(e.toLowerCase()==="true")return!0;if(e.toLowerCase()==="false")return!1;const t=Number(e);return!isNaN(t)&&e.trim()!==""?t:e}normalizeKey(e){return e.replace(/-([a-z])/g,(t,o)=>o.toUpperCase())}buildAliases(e){const t={};for(const o of this.globalOptions)o.short&&(t[o.short]=o.name);if(e?.options)for(const o of e.options)o.short&&(t[o.short]=o.name);return t}booleanFlags(e){const t=new Set;for(const o of this.globalOptions)o.type==="boolean"&&t.add(this.normalizeKey(o.name));if(e?.options)for(const o of e.options)o.type==="boolean"?t.add(this.normalizeKey(o.name)):o.type&&t.delete(this.normalizeKey(o.name));return t}applyDefaults(e,t){const o=[];t?.options&&o.push(t.options),o.push(this.globalOptions);for(const c of o)for(const n of c){const a=this.normalizeKey(n.name);e[a]===void 0&&n.default!==void 0&&(e[a]=n.default)}}}
@@ -1 +1 @@
1
- const m={31:"red",32:"green",33:"yellow",34:"blue",35:"magenta",36:"cyan",90:"gray"},p={41:"red",42:"green",43:"yellow",44:"blue",45:"magenta",46:"cyan",100:"gray"};function h(t,n,o){const e=u=>Math.max(0,Math.min(255,Math.round(u))).toString(16).padStart(2,"0");return`#${e(t)}${e(n)}${e(o)}`}export function toInkColor(t){const n="ansi256:";return t.startsWith(n)?`ansi256(${t.slice(n.length)})`:t}function b(t,n,o){if(t[n]!==o)return null;if(t[n+1]==="5"&&t[n+2]!==void 0){const e=Number(t[n+2]);return Number.isInteger(e)&&e>=0&&e<=255?{value:`ansi256:${e}`,next:n+3}:null}if(t[n+1]==="2"&&t[n+4]!==void 0){const[e,u,s]=[t[n+2],t[n+3],t[n+4]].map(Number);return[e,u,s].every(i=>Number.isFinite(i))?{value:h(e,u,s),next:n+5}:null}return null}export function parseAnsiSpans(t){const n=[];let o,e="";const u=()=>{o&&o.text&&n.push(o),o=void 0},s=()=>{e&&(n.push({text:e}),e="")},i=()=>(o||(s(),o={text:""}),o),d=t.split(/(\x1b\[[0-9;]*m)/);for(const c of d){const g=/^\x1b\[([0-9;]*)m$/.exec(c);if(!g){c&&(o?o.text+=c:e+=c);continue}const a=g[1].split(";").filter(r=>r!=="");for(let r=0;r<a.length;){const x=b(a,r,"38");if(x){i().color=x.value,r=x.next;continue}const f=b(a,r,"48");if(f){i().backgroundColor=f.value,r=f.next;continue}const l=a[r];l==="0"?u():l==="1"?i().bold=!0:l==="2"?i().dim=!0:m[l]?i().color=m[l]:p[l]&&(i().backgroundColor=p[l]),r++}}return u(),s(),n}export function stripAnsi(t){return t.replace(/\x1b\[[0-9;]*m/g,"")}
1
+ const m={31:"red",32:"green",33:"yellow",34:"blue",35:"magenta",36:"cyan",90:"gray"},p={41:"red",42:"green",43:"yellow",44:"blue",45:"magenta",46:"cyan",100:"gray"};function h(n,e,o){const t=i=>Math.max(0,Math.min(255,Math.round(i))).toString(16).padStart(2,"0");return`#${t(n)}${t(e)}${t(o)}`}export function toInkColor(n){const e="ansi256:";return n.startsWith(e)?`ansi256(${n.slice(e.length)})`:n}function b(n,e,o){if(n[e]!==o)return null;if(n[e+1]==="5"&&n[e+2]!==void 0){const t=Number(n[e+2]);return Number.isInteger(t)&&t>=0&&t<=255?{value:`ansi256:${t}`,next:e+3}:null}if(n[e+1]==="2"&&n[e+4]!==void 0){const[t,i,s]=[n[e+2],n[e+3],n[e+4]].map(Number);return[t,i,s].every(u=>Number.isFinite(u))?{value:h(t,i,s),next:e+5}:null}return null}export function parseAnsiSpans(n){const e=[];let o,t="";const i=()=>{o&&o.text&&e.push(o),o=void 0},s=()=>{t&&(e.push({text:t}),t="")},u=()=>(o||(s(),o={text:""}),o),d=n.split(/(\x1b\[[0-9;]*m)/);for(const c of d){const g=/^\x1b\[([0-9;]*)m$/.exec(c);if(!g){c&&(o?o.text+=c:t+=c);continue}const a=g[1].split(";").filter(r=>r!=="");for(let r=0;r<a.length;){const x=b(a,r,"38");if(x){u().color=x.value,r=x.next;continue}const f=b(a,r,"48");if(f){u().backgroundColor=f.value,r=f.next;continue}const l=a[r];l==="0"?i():l==="1"?u().bold=!0:l==="2"?u().dim=!0:m[l]?u().color=m[l]:p[l]&&(u().backgroundColor=p[l]),r++}}return i(),s(),e}export function stripAnsi(n){return n.replace(/\x1b\[[0-9;]*m/g,"")}
@@ -1,2 +1,2 @@
1
- import{mkdtempSync as _,writeFileSync as r}from"node:fs";import{tmpdir as a}from"node:os";import{join as n}from"node:path";export function writeFixtureTranscript(){const o=_(n(a(),"weave-sl-mock-")),t=n(o,"session.jsonl"),e=(s,i)=>`${JSON.stringify({type:"assistant",uuid:s,message:{id:s,usage:i}})}
1
+ import{mkdtempSync as _,writeFileSync as r}from"node:fs";import{tmpdir as a}from"node:os";import{join as s}from"node:path";export function writeFixtureTranscript(){const o=_(s(a(),"weave-sl-mock-")),t=s(o,"session.jsonl"),e=(n,i)=>`${JSON.stringify({type:"assistant",uuid:n,message:{id:n,usage:i}})}
2
2
  `;return r(t,e("msg_mock_1",{input_tokens:3e5,output_tokens:2e4,cache_read_input_tokens:1e5})+e("msg_mock_1",{input_tokens:3e5,output_tokens:2e4,cache_read_input_tokens:1e5})+e("msg_mock_2",{input_tokens:4e5,output_tokens:3e4,cache_read_input_tokens:110900})),t}export function buildMockInput(o,t=100,e=""){return{session_id:"mock-session",transcript_path:e,model:{display_name:"Fable 5",id:"claude-fable-5"},workspace:{current_dir:o},effort:{level:"high"},context_window:{used_percentage:42,remaining_percentage:58,context_window_size:1e6,total_input_tokens:42e4,total_output_tokens:0},cost:{total_cost_usd:1.234},rate_limits:{five_hour:{used_percentage:33,resets_at:0}},terminal:{columns:t}}}
@@ -1,3 +1,3 @@
1
- import{jsx as i,jsxs as w}from"react/jsx-runtime";import{spawnSync as Y}from"node:child_process";import _ from"node:path";import{useEffect as q,useState as b}from"react";import{render as U,Box as S,Text as a,useInput as V,useApp as X,useStdout as z}from"ink";import{applyStatuslineConfig as Q,generateStatuslineScript as W,readStatuslineConfig as Z,writeGlobalStatuslineConfig as ee}from"@weavecode/server";import{parseAnsiSpans as re,toInkColor as $}from"./ansi.js";import{buildMockInput as ne,writeFixtureTranscript as te}from"./mock-input.js";import{t as c}from"../i18n/index.js";const oe=["gray","red","green","yellow","blue","magenta","cyan"],le=["ansi256:196","ansi256:208","ansi256:39","#f7768e","#7aa2f7","#9ece6a"],x=[...oe,...le];export const COLOR_CYCLE=x;const I=[" \u2502 "," \xB7 "," \u2014 "," ",""],L=["left","center","right"],ie=["percent","bar","both"],A=[{fill:"\u2588",empty:"\u2591"},{fill:"\u25B0",empty:"\u25B1"},{fill:"=",empty:"\xB7"},{fill:"#",empty:"-"}],P=[": "," ",": "," \xBB "],ae={project:["","\u{1F4C1}"],git:["","\u{1F33F}"],git_user:["","\u{1F464}"],changes:["","\u270F\uFE0F"],model:["","\u{1F916}"],thinking:["","\u{1F9E9}"],context:["","\u{1F9E0}"],tokens:["","\u{1F522}"],cost:["","\u{1F4B8}"],rate:["","\u26A1"],time:["","\u{1F552}"]};let j;function ce(){return j===void 0&&(j=te()),j}export function runPreviewLines(e,r,t){const l=W(e).replace(/^#!.*\n/,""),h=JSON.stringify(ne(r,t,ce()));try{const n=Y(process.execPath,["-e",l],{input:h,encoding:"utf8",timeout:15e3,windowsHide:!0});return n.status!==0?{lines:[],error:(n.stderr||c("preview.scriptExit",{status:String(n.status)})).trim()}:{lines:(n.stdout??"").replace(/\r\n/g,`
1
+ import{jsx as i,jsxs as w}from"react/jsx-runtime";import{spawnSync as Y}from"node:child_process";import _ from"node:path";import{useEffect as q,useState as b}from"react";import{render as N,Box as S,Text as a,useInput as U,useApp as X,useStdout as z}from"ink";import{applyStatuslineConfig as Q,generateStatuslineScript as W,readStatuslineConfig as Z,writeGlobalStatuslineConfig as ee}from"@weavecode/server";import{parseAnsiSpans as re,toInkColor as $}from"./ansi.js";import{buildMockInput as ne,writeFixtureTranscript as te}from"./mock-input.js";import{t as c}from"../i18n/index.js";const oe=["gray","red","green","yellow","blue","magenta","cyan"],le=["ansi256:196","ansi256:208","ansi256:39","#f7768e","#7aa2f7","#9ece6a"],x=[...oe,...le];export const COLOR_CYCLE=x;const I=[" \u2502 "," \xB7 "," \u2014 "," ",""],L=["left","center","right"],ie=["percent","bar","both"],A=[{fill:"\u2588",empty:"\u2591"},{fill:"\u25B0",empty:"\u25B1"},{fill:"=",empty:"\xB7"},{fill:"#",empty:"-"}],P=[": "," ",": "," \xBB "],ae={project:["","\u{1F4C1}"],git:["","\u{1F33F}"],git_user:["","\u{1F464}"],changes:["","\u270F\uFE0F"],model:["","\u{1F916}"],thinking:["","\u{1F9E9}"],context:["","\u{1F9E0}"],tokens:["","\u{1F522}"],cost:["","\u{1F4B8}"],rate:["","\u26A1"],time:["","\u{1F552}"]};let j;function ce(){return j===void 0&&(j=te()),j}export function runPreviewLines(e,r,t){const l=W(e).replace(/^#!.*\n/,""),h=JSON.stringify(ne(r,t,ce()));try{const n=Y(process.execPath,["-e",l],{input:h,encoding:"utf8",timeout:15e3,windowsHide:!0});return n.status!==0?{lines:[],error:(n.stderr||c("preview.scriptExit",{status:String(n.status)})).trim()}:{lines:(n.stdout??"").replace(/\r\n/g,`
2
2
  `).split(`
3
- `).filter(v=>v!=="")}}catch(n){return{lines:[],error:String(n)}}}function y(e,r,t){return{...e,segments:{...e.segments,[r]:{...e.segments[r],...t}}}}export function toggleSegment(e,r){return y(e,r,{enabled:!e.segments[r].enabled})}export function cycleSegmentColor(e,r){const t=x.indexOf(e.segments[r].color);return y(e,r,{color:x[(t+1)%x.length]})}export function toggleSegmentBold(e,r){return y(e,r,{bold:!e.segments[r].bold})}export function toggleSegmentMerge(e,r){return y(e,r,{merge:!e.segments[r].merge})}export function cycleSegmentIcon(e,r){const t=ae[r]??[""],l=t.indexOf(e.segments[r].icon);return y(e,r,{icon:t[(l+1)%t.length]})}export function cycleContextStyle(e,r){if(r!=="context")return e;const t=ie,l=t.indexOf(e.segments[r].style??"both");return y(e,r,{style:t[(l+1)%t.length]})}export function cycleAlign(e){const r=L.indexOf(e.align);return{...e,align:L[(r+1)%L.length]}}export function togglePowerline(e){return{...e,powerline:{...e.powerline,enabled:!e.powerline.enabled}}}const k=["\uE0B0","\uE0B2","\uE0B4","\uE0B6"];export function cyclePowerlineGlyph(e){const r=e.powerline.separator??k[0],t=k.indexOf(r),l=k[(t+1)%k.length];return{...e,powerline:{...e.powerline,separator:l}}}export function cycleLogoColor(e){const r=x.indexOf(e.logoColor);return{...e,logoColor:x[(r+1)%x.length]}}export function cycleSeparator(e){const r=I.indexOf(e.separator);return{...e,separator:I[(r+1)%I.length]}}export function bumpRefreshInterval(e,r){return{...e,refreshInterval:Math.max(1,e.refreshInterval+r)}}export function setSegmentField(e,r,t,l){const h=l===""?{[t]:void 0}:{[t]:l};return y(e,r,h)}export function bumpBarCells(e,r){const t=Math.max(1,Math.min(40,e.bar.cells+r));return{...e,bar:{...e.bar,cells:t}}}export function cycleBarGlyph(e){const r=A.findIndex(l=>l.fill===e.bar.fill&&l.empty===e.bar.empty),t=A[(r+1)%A.length];return{...e,bar:{...e.bar,...t}}}export function cycleLabelSeparator(e){const r=P.indexOf(e.labelSeparator);return{...e,labelSeparator:P[(r+1)%P.length]}}export function clampCursor(e,r){const t=e.lines.length,l=Math.min(Math.max(r.row,0),t-1),h=e.lines[l]?.length??0,n=Math.min(Math.max(r.col,0),Math.max(0,h-1));return{row:l,col:n}}export function moveCursor(e,r,t,l){const h=e.lines.length;let n=Math.min(Math.max(r.row+t,0),h-1);for(;n!==r.row&&(e.lines[n]?.length??0)===0;)n-=Math.sign(n-r.row)||1;if((e.lines[n]?.length??0)===0)return r;const v=e.lines[n].length;let g=r.col+l;return g>=v&&(g=v-1),g<0&&(g=0),{row:n,col:g}}function se({line:e}){const r=re(e);return i(a,{children:r.map((t,l)=>i(a,{color:t.color?$(t.color):void 0,backgroundColor:t.backgroundColor?$(t.backgroundColor):void 0,bold:t.bold,dimColor:t.dim,children:t.text},l))})}function ue({segmentKey:e,seg:r,focused:t}){const l=`${r.enabled?"\u25CF":"\u25CB"}${r.icon?r.icon:""}${e}`;return i(a,{color:$(r.enabled?r.color:"gray"),bold:t,inverse:t,dimColor:!r.enabled,children:l})}function fe({initialConfig:e,projectPath:r,initialCursor:t}){const{exit:l}=X(),{stdout:h}=z(),[n,v]=b(e),[g,B]=b(t),[F,D]=b({lines:[]}),[J,T]=b(!1),[G,M]=b(null),[H,R]=b(!1),[m,C]=b(null),O=Math.max(60,h?.columns??100),f=n.lines[g.row]?.[g.col],p=s=>{v(s),T(!0),M(null)};q(()=>{const s=setTimeout(()=>{D(runPreviewLines(n,r,O))},60);return()=>clearTimeout(s)},[n,O,r]),V((s,u)=>{if(!H){if(m){if(u.escape){C(null);return}if(u.return){const{key:o,field:E,buf:K}=m;p(N=>setSegmentField(N,o,E,K)),C(null);return}if(u.backspace||u.delete){C({...m,buf:m.buf.slice(0,-1)});return}s&&!u.ctrl&&!u.meta&&C({...m,buf:m.buf+s});return}if(s==="q"){l();return}if(u.escape){l();return}if(u.upArrow){B(o=>moveCursor(n,o,-1,0));return}if(u.downArrow){B(o=>moveCursor(n,o,1,0));return}if(u.leftArrow){B(o=>moveCursor(n,o,0,-1));return}if(u.rightArrow){B(o=>moveCursor(n,o,0,1));return}if(!u.return){if(s==="B"){p(cycleBarGlyph);return}if(s==="L"){p(cycleLabelSeparator);return}if(s==="["){p(o=>bumpBarCells(o,-1));return}if(s==="]"){p(o=>bumpBarCells(o,1));return}if(f){if(s==="n"){C({key:f,field:"label",buf:n.segments[f].label??""});return}if(s==="f"){C({key:f,field:"format",buf:n.segments[f].format??""});return}switch(s.toLowerCase()){case" ":p(o=>toggleSegment(o,f));return;case"c":p(o=>cycleSegmentColor(o,f));return;case"b":p(o=>toggleSegmentBold(o,f));return;case"m":p(o=>toggleSegmentMerge(o,f));return;case"i":p(o=>cycleSegmentIcon(o,f));return;case"v":p(o=>cycleContextStyle(o,f));return;case"a":p(o=>cycleAlign(o));return;case"p":p(o=>togglePowerline(o));return;case"g":p(o=>cyclePowerlineGlyph(o));return;case"l":p(o=>cycleLogoColor(o));return;case"s":p(o=>cycleSeparator(o));return;case"r":D(runPreviewLines(n,r,O)),M(c("preview.reRendered"));return;case"w":(async()=>{R(!0);try{(n.source??"global")==="global"&&await ee(n),await Q(r,n),T(!1),M(c("preview.saved"))}catch(o){M(c("preview.writeFailed",{error:String(o)}))}finally{R(!1)}})();return;default:break}}}}});const d=f?n.segments[f]:void 0;return w(S,{flexDirection:"column",gap:0,children:[w(S,{children:[i(a,{bold:!0,color:"cyan",children:"weave statusline preview"}),w(a,{dimColor:!0,children:[" \u2014 ",_.basename(r)," "]}),i(a,{dimColor:!0,children:c("preview.headerMeta",{source:n.source??"global",refresh:n.refreshInterval,align:n.align,powerline:n.powerline.enabled?c("preview.on"):c("preview.off")})}),J&&i(a,{color:"yellow",children:c("preview.unsaved")})]}),i(S,{flexDirection:"column",borderStyle:"round",borderColor:"cyan",paddingX:1,marginY:0,children:F.error?i(a,{color:"red",children:c("preview.scriptError",{error:F.error})}):F.lines.length?F.lines.map((s,u)=>i(se,{line:s},u)):i(a,{dimColor:!0,children:c("preview.rendering")})}),w(S,{flexDirection:"column",children:[i(a,{dimColor:!0,children:c("preview.layoutHelp")}),n.lines.map((s,u)=>w(S,{gap:1,children:[i(a,{dimColor:!0,children:c("preview.rowLabel",{row:u+1})}),s.map((o,E)=>i(ue,{segmentKey:o,seg:n.segments[o],focused:g.row===u&&g.col===E},o))]},u))]}),w(S,{flexDirection:"column",gap:0,marginTop:1,children:[m?w(a,{children:[i(a,{bold:!0,color:"yellow",children:` ${m.key}.${m.field} `})," ",i(a,{children:m.buf}),i(a,{inverse:!0,children:" "}),i(a,{dimColor:!0,children:c("preview.editConfirm")})]}):d&&f?w(a,{children:[i(a,{bold:!0,inverse:!0,children:` ${f} `})," ",i(a,{dimColor:!0,children:c("preview.segDetail",{color:d.color,bold:d.bold?c("preview.on"):c("preview.off"),merge:d.merge?c("preview.on"):c("preview.off"),icon:d.icon||"\u2014",style:f==="context"?c("preview.styleSuffix",{style:d.style??"both"}):""})})]}):null,!m&&d&&f&&(d.label||d.format)?w(a,{dimColor:!0,children:[d.label?c("preview.labelValue",{value:`${d.label}${n.labelSeparator}`}):"",d.format?c("preview.formatValue",{value:d.format}):""]}):null,i(a,{dimColor:!0,children:c("preview.barLine",{cells:n.bar.cells,glyphs:`${n.bar.fill}${n.bar.empty}`,labelSep:JSON.stringify(n.labelSeparator)})}),i(a,{dimColor:!0,children:c("preview.keysHelp")}),G&&i(a,{color:"green",children:G}),H&&i(a,{color:"yellow",children:c("preview.writing")})]})]})}export async function runStatuslinePreview(e){const r=await Z(e),t=clampCursor(r,{row:0,col:0});await U(i(fe,{initialConfig:r,projectPath:e,initialCursor:t}),{exitOnCtrlC:!0}).waitUntilExit?.()}
3
+ `).filter(v=>v!=="")}}catch(n){return{lines:[],error:String(n)}}}function y(e,r,t){return{...e,segments:{...e.segments,[r]:{...e.segments[r],...t}}}}export function toggleSegment(e,r){return y(e,r,{enabled:!e.segments[r].enabled})}export function cycleSegmentColor(e,r){const t=x.indexOf(e.segments[r].color);return y(e,r,{color:x[(t+1)%x.length]})}export function toggleSegmentBold(e,r){return y(e,r,{bold:!e.segments[r].bold})}export function toggleSegmentMerge(e,r){return y(e,r,{merge:!e.segments[r].merge})}export function cycleSegmentIcon(e,r){const t=ae[r]??[""],l=t.indexOf(e.segments[r].icon);return y(e,r,{icon:t[(l+1)%t.length]})}export function cycleContextStyle(e,r){if(r!=="context")return e;const t=ie,l=t.indexOf(e.segments[r].style??"both");return y(e,r,{style:t[(l+1)%t.length]})}export function cycleAlign(e){const r=L.indexOf(e.align);return{...e,align:L[(r+1)%L.length]}}export function togglePowerline(e){return{...e,powerline:{...e.powerline,enabled:!e.powerline.enabled}}}const k=["\uE0B0","\uE0B2","\uE0B4","\uE0B6"];export function cyclePowerlineGlyph(e){const r=e.powerline.separator??k[0],t=k.indexOf(r),l=k[(t+1)%k.length];return{...e,powerline:{...e.powerline,separator:l}}}export function cycleLogoColor(e){const r=x.indexOf(e.logoColor);return{...e,logoColor:x[(r+1)%x.length]}}export function cycleSeparator(e){const r=I.indexOf(e.separator);return{...e,separator:I[(r+1)%I.length]}}export function bumpRefreshInterval(e,r){return{...e,refreshInterval:Math.max(1,e.refreshInterval+r)}}export function setSegmentField(e,r,t,l){const h=l===""?{[t]:void 0}:{[t]:l};return y(e,r,h)}export function bumpBarCells(e,r){const t=Math.max(1,Math.min(40,e.bar.cells+r));return{...e,bar:{...e.bar,cells:t}}}export function cycleBarGlyph(e){const r=A.findIndex(l=>l.fill===e.bar.fill&&l.empty===e.bar.empty),t=A[(r+1)%A.length];return{...e,bar:{...e.bar,...t}}}export function cycleLabelSeparator(e){const r=P.indexOf(e.labelSeparator);return{...e,labelSeparator:P[(r+1)%P.length]}}export function clampCursor(e,r){const t=e.lines.length,l=Math.min(Math.max(r.row,0),t-1),h=e.lines[l]?.length??0,n=Math.min(Math.max(r.col,0),Math.max(0,h-1));return{row:l,col:n}}export function moveCursor(e,r,t,l){const h=e.lines.length;let n=Math.min(Math.max(r.row+t,0),h-1);for(;n!==r.row&&(e.lines[n]?.length??0)===0;)n-=Math.sign(n-r.row)||1;if((e.lines[n]?.length??0)===0)return r;const v=e.lines[n].length;let g=r.col+l;return g>=v&&(g=v-1),g<0&&(g=0),{row:n,col:g}}function se({line:e}){const r=re(e);return i(a,{children:r.map((t,l)=>i(a,{color:t.color?$(t.color):void 0,backgroundColor:t.backgroundColor?$(t.backgroundColor):void 0,bold:t.bold,dimColor:t.dim,children:t.text},l))})}function ue({segmentKey:e,seg:r,focused:t}){const l=`${r.enabled?"\u25CF":"\u25CB"}${r.icon?r.icon:""}${e}`;return i(a,{color:$(r.enabled?r.color:"gray"),bold:t,inverse:t,dimColor:!r.enabled,children:l})}function fe({initialConfig:e,projectPath:r,initialCursor:t}){const{exit:l}=X(),{stdout:h}=z(),[n,v]=b(e),[g,B]=b(t),[F,D]=b({lines:[]}),[J,T]=b(!1),[G,M]=b(null),[H,R]=b(!1),[m,C]=b(null),O=Math.max(60,h?.columns??100),f=n.lines[g.row]?.[g.col],p=s=>{v(s),T(!0),M(null)};q(()=>{const s=setTimeout(()=>{D(runPreviewLines(n,r,O))},60);return()=>clearTimeout(s)},[n,O,r]),U((s,u)=>{if(!H){if(m){if(u.escape){C(null);return}if(u.return){const{key:o,field:E,buf:K}=m;p(V=>setSegmentField(V,o,E,K)),C(null);return}if(u.backspace||u.delete){C({...m,buf:m.buf.slice(0,-1)});return}s&&!u.ctrl&&!u.meta&&C({...m,buf:m.buf+s});return}if(s==="q"){l();return}if(u.escape){l();return}if(u.upArrow){B(o=>moveCursor(n,o,-1,0));return}if(u.downArrow){B(o=>moveCursor(n,o,1,0));return}if(u.leftArrow){B(o=>moveCursor(n,o,0,-1));return}if(u.rightArrow){B(o=>moveCursor(n,o,0,1));return}if(!u.return){if(s==="B"){p(cycleBarGlyph);return}if(s==="L"){p(cycleLabelSeparator);return}if(s==="["){p(o=>bumpBarCells(o,-1));return}if(s==="]"){p(o=>bumpBarCells(o,1));return}if(f){if(s==="n"){C({key:f,field:"label",buf:n.segments[f].label??""});return}if(s==="f"){C({key:f,field:"format",buf:n.segments[f].format??""});return}switch(s.toLowerCase()){case" ":p(o=>toggleSegment(o,f));return;case"c":p(o=>cycleSegmentColor(o,f));return;case"b":p(o=>toggleSegmentBold(o,f));return;case"m":p(o=>toggleSegmentMerge(o,f));return;case"i":p(o=>cycleSegmentIcon(o,f));return;case"v":p(o=>cycleContextStyle(o,f));return;case"a":p(o=>cycleAlign(o));return;case"p":p(o=>togglePowerline(o));return;case"g":p(o=>cyclePowerlineGlyph(o));return;case"l":p(o=>cycleLogoColor(o));return;case"s":p(o=>cycleSeparator(o));return;case"r":D(runPreviewLines(n,r,O)),M(c("preview.reRendered"));return;case"w":(async()=>{R(!0);try{(n.source??"global")==="global"&&await ee(n),await Q(r,n),T(!1),M(c("preview.saved"))}catch(o){M(c("preview.writeFailed",{error:String(o)}))}finally{R(!1)}})();return;default:break}}}}});const d=f?n.segments[f]:void 0;return w(S,{flexDirection:"column",gap:0,children:[w(S,{children:[i(a,{bold:!0,color:"cyan",children:"weave statusline preview"}),w(a,{dimColor:!0,children:[" \u2014 ",_.basename(r)," "]}),i(a,{dimColor:!0,children:c("preview.headerMeta",{source:n.source??"global",refresh:n.refreshInterval,align:n.align,powerline:n.powerline.enabled?c("preview.on"):c("preview.off")})}),J&&i(a,{color:"yellow",children:c("preview.unsaved")})]}),i(S,{flexDirection:"column",borderStyle:"round",borderColor:"cyan",paddingX:1,marginY:0,children:F.error?i(a,{color:"red",children:c("preview.scriptError",{error:F.error})}):F.lines.length?F.lines.map((s,u)=>i(se,{line:s},u)):i(a,{dimColor:!0,children:c("preview.rendering")})}),w(S,{flexDirection:"column",children:[i(a,{dimColor:!0,children:c("preview.layoutHelp")}),n.lines.map((s,u)=>w(S,{gap:1,children:[i(a,{dimColor:!0,children:c("preview.rowLabel",{row:u+1})}),s.map((o,E)=>i(ue,{segmentKey:o,seg:n.segments[o],focused:g.row===u&&g.col===E},o))]},u))]}),w(S,{flexDirection:"column",gap:0,marginTop:1,children:[m?w(a,{children:[i(a,{bold:!0,color:"yellow",children:` ${m.key}.${m.field} `})," ",i(a,{children:m.buf}),i(a,{inverse:!0,children:" "}),i(a,{dimColor:!0,children:c("preview.editConfirm")})]}):d&&f?w(a,{children:[i(a,{bold:!0,inverse:!0,children:` ${f} `})," ",i(a,{dimColor:!0,children:c("preview.segDetail",{color:d.color,bold:d.bold?c("preview.on"):c("preview.off"),merge:d.merge?c("preview.on"):c("preview.off"),icon:d.icon||"\u2014",style:f==="context"?c("preview.styleSuffix",{style:d.style??"both"}):""})})]}):null,!m&&d&&f&&(d.label||d.format)?w(a,{dimColor:!0,children:[d.label?c("preview.labelValue",{value:`${d.label}${n.labelSeparator}`}):"",d.format?c("preview.formatValue",{value:d.format}):""]}):null,i(a,{dimColor:!0,children:c("preview.barLine",{cells:n.bar.cells,glyphs:`${n.bar.fill}${n.bar.empty}`,labelSep:JSON.stringify(n.labelSeparator)})}),i(a,{dimColor:!0,children:c("preview.keysHelp")}),G&&i(a,{color:"green",children:G}),H&&i(a,{color:"yellow",children:c("preview.writing")})]})]})}export async function runStatuslinePreview(e){const r=await Z(e),t=clampCursor(r,{row:0,col:0});await N(i(fe,{initialConfig:r,projectPath:e,initialCursor:t}),{exitOnCtrlC:!0}).waitUntilExit?.()}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weavecode/cli",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "CLI entry point for weave — parser, commands, and init executor",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -22,9 +22,9 @@
22
22
  "node": ">=22.5.0"
23
23
  },
24
24
  "dependencies": {
25
- "@weavecode/core": "^0.1.8",
26
- "@weavecode/harness": "^0.1.8",
27
- "@weavecode/server": "^0.1.8",
28
- "@weavecode/templates": "^0.1.8"
25
+ "@weavecode/core": "^0.1.9",
26
+ "@weavecode/harness": "^0.1.9",
27
+ "@weavecode/server": "^0.1.9",
28
+ "@weavecode/templates": "^0.1.9"
29
29
  }
30
30
  }
@@ -1 +1 @@
1
- import a from"node:path";import{lstat as g,readFile as f,readlink as m,access as y}from"node:fs/promises";const o="CLAUDE.md",u="AGENTS.md",p=".claude/helpers/statusline.cjs",w=".claude/settings.json";async function h(t){try{return await y(t),!0}catch{return!1}}async function l(t){try{if(!(await g(t)).isSymbolicLink())return"file";const n=a.resolve(a.dirname(t),await m(t));return await h(n)?"link":"dangling"}catch{return"absent"}}async function S(t){const s=a.join(t,u);if(await l(s)!=="file")return null;const n=(await f(s,"utf-8").catch(()=>"")).trim();return{id:"instruction-link-not-materialised",params:{agents:u,claude:o},ok:n!==o}}async function j(t){const s=await l(a.join(t,o)),n=await l(a.join(t,u));return s==="absent"||n==="absent"?null:{id:"instruction-files-duplicated",params:{claude:o,agents:u},ok:!(s==="file"&&n==="file")}}async function E(t){const s=[];for(const n of[o,u]){const e=await l(a.join(t,n));if(e==="dangling"){s.push({id:"instruction-link-dangling",params:{name:n},ok:!1});break}e==="link"&&s.push({id:"instruction-link-dangling",params:{name:n},ok:!0})}return s}function L(t){const s=/"([^"]+)"/.exec(t);if(s)return s[1];const n=t.trim().split(/\s+/),e=n[n.length-1];return e&&d(e).includes(p)?e:null}function d(t){return t.replace(/\\/g,"/")}async function b(t){const s=a.join(t,w);let n;try{n=JSON.parse(await f(s,"utf-8"))}catch{return[]}const e=n.statusLine;if(!e||typeof e!="object")return[];const r=e.command;if(typeof r!="string"||!d(r).includes(p))return[];const i=L(r);if(!i)return[{id:"statusline-path-unresolved",params:{command:r},ok:!1}];const c=[{id:"statusline-path-unresolved",params:{command:r},ok:!0}],k=a.resolve(t)+a.sep;return a.resolve(i).startsWith(k)?(c.push({id:"statusline-path-foreign",params:{path:i},ok:!0}),c.push({id:"statusline-script-missing",params:{path:i},ok:await h(i)}),c):(c.push({id:"statusline-path-foreign",params:{path:i},ok:!1}),c)}export async function checkHarness(t){const[s,n,e,r]=await Promise.all([S(t),j(t),E(t),b(t)]);return[s,n,...e,...r].filter(i=>i!==null)}
1
+ import s from"node:path";import{lstat as k,readFile as p,readlink as g,access as y}from"node:fs/promises";import{HARNESS_KEYS as w,HARNESS_LOCAL_INSTRUCTION_FILES as S}from"./harness.js";const c="CLAUDE.md",u="AGENTS.md",d=".claude/helpers/statusline.cjs",j=".claude/settings.json";async function f(t){try{return await y(t),!0}catch{return!1}}async function l(t){try{if(!(await k(t)).isSymbolicLink())return"file";const n=s.resolve(s.dirname(t),await g(t));return await f(n)?"link":"dangling"}catch{return"absent"}}async function v(t){const n=s.join(t,u);if(await l(n)!=="file")return null;const a=(await p(n,"utf-8").catch(()=>"")).trim();return{id:"instruction-link-not-materialised",params:{agents:u,claude:c},ok:a!==c}}async function b(t){const n=await l(s.join(t,c)),a=await l(s.join(t,u));return n==="absent"||a==="absent"?null:{id:"instruction-files-duplicated",params:{claude:c,agents:u},ok:!(n==="file"&&a==="file")}}async function E(t){const n=[];for(const a of[c,u]){const i=await l(s.join(t,a));if(i==="dangling"){n.push({id:"instruction-link-dangling",params:{name:a},ok:!1});break}i==="link"&&n.push({id:"instruction-link-dangling",params:{name:a},ok:!0})}return n}function L(t){const n=/"([^"]+)"/.exec(t);if(n)return n[1];const a=t.trim().split(/\s+/),i=a[a.length-1];return i&&m(i).includes(d)?i:null}function m(t){return t.replace(/\\/g,"/")}async function N(t){const n=s.join(t,j);let a;try{a=JSON.parse(await p(n,"utf-8"))}catch{return[]}const i=a.statusLine;if(!i||typeof i!="object")return[];const e=i.command;if(typeof e!="string"||!m(e).includes(d))return[];const r=L(e);if(!r)return[{id:"statusline-path-unresolved",params:{command:e},ok:!1}];const o=[{id:"statusline-path-unresolved",params:{command:e},ok:!0}],h=s.resolve(t)+s.sep;return s.resolve(r).startsWith(h)?(o.push({id:"statusline-path-foreign",params:{path:r},ok:!0}),o.push({id:"statusline-script-missing",params:{path:r},ok:await f(r)}),o):(o.push({id:"statusline-path-foreign",params:{path:r},ok:!1}),o)}async function A(t){const n=[];for(const a of w){const{file:i,semantics:e}=S[a];await f(s.join(t,i))&&n.push({id:e==="override"?"local-instruction-override":"local-instruction-append",params:{file:i},ok:!0})}return n}export async function checkHarness(t){const[n,a,i,e,r]=await Promise.all([v(t),b(t),E(t),N(t),A(t)]);return[n,a,...i,...e,...r].filter(o=>o!==null)}
@@ -94,6 +94,29 @@ export declare const HARNESS_INSTRUCTION_FILES: {
94
94
  };
95
95
  /** 指令文件名(由注册表派生,不手写 union)。 */
96
96
  export type InstructionFile = (typeof HARNESS_INSTRUCTION_FILES)[Harness][number];
97
+ /**
98
+ * 本机私有指令面注册表——各 harness 宿主原生加载的 local 指令文件(不进仓、
99
+ * `.git/info/exclude` 清单由此派生)。**两 harness 不同构**(2026-11-03 源码
100
+ * 实测定案):claude 的 `CLAUDE.local.md` 是**追加**(与 CLAUDE.md 叠加生效);
101
+ * codex 的 `AGENTS.override.md` 是**覆盖**(agents_md.rs 的 candidate_filenames
102
+ * 命中即返回——override 在则同目录 AGENTS.md 不被宿主读取)。semantics 字段
103
+ * 让提示文案如实分叉,不把 override 冒充补充。
104
+ *
105
+ * init 的写入策略(local-first,实现见 weave-cli init/instruction-files.ts):
106
+ * claude 恒写本文件;codex 仅当根目录没有 AGENTS.md 时才写 override——已有
107
+ * 共享文件时块并入 AGENTS.md,避免 override 压掉用户自己的共享指令。
108
+ */
109
+ export declare const HARNESS_LOCAL_INSTRUCTION_FILES: {
110
+ readonly claude: {
111
+ readonly file: "CLAUDE.local.md";
112
+ readonly semantics: "append";
113
+ };
114
+ readonly codex: {
115
+ readonly file: "AGENTS.override.md";
116
+ readonly semantics: "override";
117
+ };
118
+ };
119
+ export type LocalInstructionSemantics = (typeof HARNESS_LOCAL_INSTRUCTION_FILES)[Harness]['semantics'];
97
120
  /** 任务分组生命周期表的条目形状(D7)——分组差异是 harness 知识。 */
98
121
  export interface HarnessLifecycle {
99
122
  /** 开启一个 turn 组的事件(组头)。 */
@@ -326,6 +349,18 @@ export declare const PET_SPRITE_CONTRACT: {
326
349
  readonly frameMs: 150;
327
350
  readonly finalMs: 280;
328
351
  };
352
+ readonly enter: {
353
+ readonly row: 9;
354
+ readonly frames: 8;
355
+ readonly frameMs: 90;
356
+ readonly finalMs: 200;
357
+ };
358
+ readonly sleep: {
359
+ readonly row: 10;
360
+ readonly frames: 6;
361
+ readonly frameMs: 420;
362
+ readonly finalMs: 900;
363
+ };
329
364
  };
330
365
  };
331
366
  /**
@@ -339,3 +374,5 @@ export declare const HARNESS_KEYS: readonly Harness[];
339
374
  * 其后为次名(链到主名)——`weave init` 的合一、卸载清扫与提交候选共用此序。
340
375
  */
341
376
  export declare const INSTRUCTION_FILES: readonly InstructionFile[];
377
+ /** 全部 local 指令文件名(exclude 清单与检测共用,由 local 面注册表派生)。 */
378
+ export declare const LOCAL_INSTRUCTION_FILES: readonly string[];
@@ -1 +1 @@
1
- export const HARNESS_NAMES=["claude","codex"];export function isHarness(e){return typeof e=="string"&&HARNESS_NAMES.includes(e)}export const HARNESS_EVENTS={claude:["PreToolUse","PostToolUse","UserPromptSubmit","SessionStart","Stop","StopFailure","SubagentStop","Notification","PostToolUseFailure","PermissionRequest","PermissionDenied","SubagentStart","PreCompact","SessionEnd","PreModelSwitch","PostModelSwitch"],codex:["SessionStart","UserPromptSubmit","Stop","TurnAborted","PostToolUse","SessionEnd","PreCompact","PostCompact","SubagentStart","SubagentStop","PermissionRequest"]},HARNESS_TOOL_EVENTS={claude:["PreToolUse","PostToolUse","PostToolUseFailure"],codex:["PostToolUse"]},INJECTABLE_EVENTS={claude:["PostToolUse","UserPromptSubmit","SessionStart","Stop","SubagentStop"],codex:[]},TITLE_EFFECTIVE_EVENTS={claude:["SessionStart","UserPromptSubmit"],codex:[]},HARNESS_EVENT_UNION=[...new Set(Object.values(HARNESS_EVENTS).flat())],HARNESS_DIRS={claude:{projectDir:".claude",userDir:".claude"},codex:{projectDir:".codex",userDir:".codex"}},HARNESS_INSTRUCTION_FILES={claude:["CLAUDE.md"],codex:["AGENTS.md"]},HARNESS_LIFECYCLE={claude:{open:"UserPromptSubmit",close:["Stop","StopFailure"],closeFailed:["StopFailure"],sessionMarkers:["SessionStart","SessionEnd"],subagentStop:"SubagentStop",questionTools:["AskUserQuestion","ExitPlanMode"],sessionExit:"SessionEnd"},codex:{open:"UserPromptSubmit",close:["Stop","TurnAborted"],closeFailed:[],sessionMarkers:["SessionStart","SessionEnd"],subagentStop:"SubagentStop",questionTools:[],sessionExit:"SessionEnd"}},HARNESS_COMPACTION={claude:{start:"PreCompact",end:"SessionStart",endSource:"compact"},codex:{start:null,end:null,endSource:null}},HARNESS_SESSION_CONTROL={claude:{modeNames:["default","acceptEdits","plan","auto","dontAsk","bypassPermissions"],modelNames:["default","opus","sonnet","haiku","fable"],modelFactEvents:["PostModelSwitch","SessionStart"],effortLevels:["low","medium","high","xhigh","max"]},codex:{modeNames:[],modelNames:[],modelFactEvents:[],effortLevels:[]}},VISUALIZATION_PROTOCOL={referencePrefix:"\uE200visualize\uE202",referenceSuffix:"\uE201",referencePrefixAliases:["\u{E0000}visualize\u{E0001}","visualize"],referenceSuffixAliases:["\u{E0002}"],maxFragmentBytes:1024*1024},PET_SPRITE_CONTRACT={cellWidth:192,cellHeight:208,columns:8,rowsV1:9,rowsV2:11,spriteVersionV2:2,maxSpritesheetBytes:8*1024*1024,animations:{idle:{row:0,frames:6,durationsMs:[1680,660,660,840,840,1920]},"running-right":{row:1,frames:8,frameMs:120,finalMs:220},"running-left":{row:2,frames:8,frameMs:120,finalMs:220},waving:{row:3,frames:4,frameMs:140,finalMs:280},jumping:{row:4,frames:5,frameMs:140,finalMs:280},failed:{row:5,frames:8,frameMs:140,finalMs:240},waiting:{row:6,frames:6,frameMs:150,finalMs:260},running:{row:7,frames:6,frameMs:120,finalMs:220},review:{row:8,frames:6,frameMs:150,finalMs:280}}},HARNESS_KEYS=HARNESS_NAMES,INSTRUCTION_FILES=[...new Set(HARNESS_KEYS.flatMap(e=>[...HARNESS_INSTRUCTION_FILES[e]]))];
1
+ export const HARNESS_NAMES=["claude","codex"];export function isHarness(e){return typeof e=="string"&&HARNESS_NAMES.includes(e)}export const HARNESS_EVENTS={claude:["PreToolUse","PostToolUse","UserPromptSubmit","SessionStart","Stop","StopFailure","SubagentStop","Notification","PostToolUseFailure","PermissionRequest","PermissionDenied","SubagentStart","PreCompact","SessionEnd","PreModelSwitch","PostModelSwitch"],codex:["SessionStart","UserPromptSubmit","Stop","TurnAborted","PostToolUse","SessionEnd","PreCompact","PostCompact","SubagentStart","SubagentStop","PermissionRequest"]},HARNESS_TOOL_EVENTS={claude:["PreToolUse","PostToolUse","PostToolUseFailure"],codex:["PostToolUse"]},INJECTABLE_EVENTS={claude:["PostToolUse","UserPromptSubmit","SessionStart","Stop","SubagentStop"],codex:[]},TITLE_EFFECTIVE_EVENTS={claude:["SessionStart","UserPromptSubmit"],codex:[]},HARNESS_EVENT_UNION=[...new Set(Object.values(HARNESS_EVENTS).flat())],HARNESS_DIRS={claude:{projectDir:".claude",userDir:".claude"},codex:{projectDir:".codex",userDir:".codex"}},HARNESS_INSTRUCTION_FILES={claude:["CLAUDE.md"],codex:["AGENTS.md"]},HARNESS_LOCAL_INSTRUCTION_FILES={claude:{file:"CLAUDE.local.md",semantics:"append"},codex:{file:"AGENTS.override.md",semantics:"override"}},HARNESS_LIFECYCLE={claude:{open:"UserPromptSubmit",close:["Stop","StopFailure"],closeFailed:["StopFailure"],sessionMarkers:["SessionStart","SessionEnd"],subagentStop:"SubagentStop",questionTools:["AskUserQuestion","ExitPlanMode"],sessionExit:"SessionEnd"},codex:{open:"UserPromptSubmit",close:["Stop","TurnAborted"],closeFailed:[],sessionMarkers:["SessionStart","SessionEnd"],subagentStop:"SubagentStop",questionTools:[],sessionExit:"SessionEnd"}},HARNESS_COMPACTION={claude:{start:"PreCompact",end:"SessionStart",endSource:"compact"},codex:{start:null,end:null,endSource:null}},HARNESS_SESSION_CONTROL={claude:{modeNames:["default","acceptEdits","plan","auto","dontAsk","bypassPermissions"],modelNames:["default","opus","sonnet","haiku","fable"],modelFactEvents:["PostModelSwitch","SessionStart"],effortLevels:["low","medium","high","xhigh","max"]},codex:{modeNames:[],modelNames:[],modelFactEvents:[],effortLevels:[]}},VISUALIZATION_PROTOCOL={referencePrefix:"\uE200visualize\uE202",referenceSuffix:"\uE201",referencePrefixAliases:["\u{E0000}visualize\u{E0001}","visualize"],referenceSuffixAliases:["\u{E0002}"],maxFragmentBytes:1024*1024},PET_SPRITE_CONTRACT={cellWidth:192,cellHeight:208,columns:8,rowsV1:9,rowsV2:11,spriteVersionV2:2,maxSpritesheetBytes:8*1024*1024,animations:{idle:{row:0,frames:6,durationsMs:[1680,660,660,840,840,1920]},"running-right":{row:1,frames:8,frameMs:120,finalMs:220},"running-left":{row:2,frames:8,frameMs:120,finalMs:220},waving:{row:3,frames:4,frameMs:140,finalMs:280},jumping:{row:4,frames:5,frameMs:140,finalMs:280},failed:{row:5,frames:8,frameMs:140,finalMs:240},waiting:{row:6,frames:6,frameMs:150,finalMs:260},running:{row:7,frames:6,frameMs:120,finalMs:220},review:{row:8,frames:6,frameMs:150,finalMs:280},enter:{row:9,frames:8,frameMs:90,finalMs:200},sleep:{row:10,frames:6,frameMs:420,finalMs:900}}},HARNESS_KEYS=HARNESS_NAMES,INSTRUCTION_FILES=[...new Set(HARNESS_KEYS.flatMap(e=>[...HARNESS_INSTRUCTION_FILES[e]]))],LOCAL_INSTRUCTION_FILES=HARNESS_KEYS.map(e=>HARNESS_LOCAL_INSTRUCTION_FILES[e].file);
@@ -4,7 +4,7 @@ export type { HookRule, HookRuleSource, HookRuleFilter, HookRuleOrigin, HandlerC
4
4
  export { HookRuleSchema, HookRuleSourceSchema, HookRuleFilterSchema, HookRuleOriginSchema, HandlerConfigSchema, HookDispatchStatusSchema, HookDispatchModeSchema, PluginRuleEntrySchema, WeavePluginManifestSchema, WEAVE_PLUGIN_MANIFEST, CLAUDE_HOOK_EVENTS, INJECTABLE_HOOK_EVENTS, } from './types.js';
5
5
  export { InitOptionsSchema, PresetSchema, resolveComponents } from './types.js';
6
6
  export { normalizeHookRuleSource, hookSourceHarness } from './types.js';
7
- export { type Harness, type InstructionFile, HARNESS_EVENTS, HARNESS_KEYS, HARNESS_NAMES, HARNESS_EVENT_UNION, HARNESS_TOOL_EVENTS, HARNESS_INSTRUCTION_FILES, INSTRUCTION_FILES, INJECTABLE_EVENTS, TITLE_EFFECTIVE_EVENTS, HARNESS_DIRS, HARNESS_LIFECYCLE, HARNESS_COMPACTION, HARNESS_SESSION_CONTROL, VISUALIZATION_PROTOCOL, PET_SPRITE_CONTRACT, type HarnessCompaction, isHarness, } from './harness.js';
7
+ export { type Harness, type InstructionFile, HARNESS_EVENTS, HARNESS_KEYS, HARNESS_NAMES, HARNESS_EVENT_UNION, HARNESS_TOOL_EVENTS, HARNESS_INSTRUCTION_FILES, HARNESS_LOCAL_INSTRUCTION_FILES, LOCAL_INSTRUCTION_FILES, INSTRUCTION_FILES, INJECTABLE_EVENTS, TITLE_EFFECTIVE_EVENTS, HARNESS_DIRS, HARNESS_LIFECYCLE, HARNESS_COMPACTION, HARNESS_SESSION_CONTROL, VISUALIZATION_PROTOCOL, PET_SPRITE_CONTRACT, type HarnessCompaction, isHarness, } from './harness.js';
8
8
  export { TERMINAL_LOCATOR_ENV, TERMINAL_LOCATOR_ENV_KEYS } from './terminal.js';
9
9
  export { type ToolScope, type ToolCategory, type EnableOverride, type InstallState, type ToolStateRow, } from './tool.js';
10
10
  export { DEFAULT_COMPONENTS, FULL_COMPONENTS, MINIMAL_COMPONENTS } from './types.js';
@@ -1 +1 @@
1
- export{HookRuleSchema,HookRuleSourceSchema,HookRuleFilterSchema,HookRuleOriginSchema,HandlerConfigSchema,HookDispatchStatusSchema,HookDispatchModeSchema,PluginRuleEntrySchema,WeavePluginManifestSchema,WEAVE_PLUGIN_MANIFEST,CLAUDE_HOOK_EVENTS,INJECTABLE_HOOK_EVENTS}from"./types.js";export{InitOptionsSchema,PresetSchema,resolveComponents}from"./types.js";export{normalizeHookRuleSource,hookSourceHarness}from"./types.js";export{HARNESS_EVENTS,HARNESS_KEYS,HARNESS_NAMES,HARNESS_EVENT_UNION,HARNESS_TOOL_EVENTS,HARNESS_INSTRUCTION_FILES,INSTRUCTION_FILES,INJECTABLE_EVENTS,TITLE_EFFECTIVE_EVENTS,HARNESS_DIRS,HARNESS_LIFECYCLE,HARNESS_COMPACTION,HARNESS_SESSION_CONTROL,VISUALIZATION_PROTOCOL,PET_SPRITE_CONTRACT,isHarness}from"./harness.js";export{TERMINAL_LOCATOR_ENV,TERMINAL_LOCATOR_ENV_KEYS}from"./terminal.js";export{DEFAULT_COMPONENTS,FULL_COMPONENTS,MINIMAL_COMPONENTS}from"./types.js";export{DEFAULT_HOOKS,DEFAULT_SKILLS,DEFAULT_COMMANDS,DEFAULT_AGENTS,DEFAULT_MCP}from"./types.js";export{detectPlatform}from"./platform.js";export{checkHarness}from"./harness-checks.js";export{ensureDir,writeFileIfAbsent,fileExists}from"./utils/fs.js";export{logger,formatTable}from"./utils/logger.js";
1
+ export{HookRuleSchema,HookRuleSourceSchema,HookRuleFilterSchema,HookRuleOriginSchema,HandlerConfigSchema,HookDispatchStatusSchema,HookDispatchModeSchema,PluginRuleEntrySchema,WeavePluginManifestSchema,WEAVE_PLUGIN_MANIFEST,CLAUDE_HOOK_EVENTS,INJECTABLE_HOOK_EVENTS}from"./types.js";export{InitOptionsSchema,PresetSchema,resolveComponents}from"./types.js";export{normalizeHookRuleSource,hookSourceHarness}from"./types.js";export{HARNESS_EVENTS,HARNESS_KEYS,HARNESS_NAMES,HARNESS_EVENT_UNION,HARNESS_TOOL_EVENTS,HARNESS_INSTRUCTION_FILES,HARNESS_LOCAL_INSTRUCTION_FILES,LOCAL_INSTRUCTION_FILES,INSTRUCTION_FILES,INJECTABLE_EVENTS,TITLE_EFFECTIVE_EVENTS,HARNESS_DIRS,HARNESS_LIFECYCLE,HARNESS_COMPACTION,HARNESS_SESSION_CONTROL,VISUALIZATION_PROTOCOL,PET_SPRITE_CONTRACT,isHarness}from"./harness.js";export{TERMINAL_LOCATOR_ENV,TERMINAL_LOCATOR_ENV_KEYS}from"./terminal.js";export{DEFAULT_COMPONENTS,FULL_COMPONENTS,MINIMAL_COMPONENTS}from"./types.js";export{DEFAULT_HOOKS,DEFAULT_SKILLS,DEFAULT_COMMANDS,DEFAULT_AGENTS,DEFAULT_MCP}from"./types.js";export{detectPlatform}from"./platform.js";export{checkHarness}from"./harness-checks.js";export{ensureDir,writeFileIfAbsent,fileExists}from"./utils/fs.js";export{logger,formatTable}from"./utils/logger.js";
@@ -1 +1 @@
1
- import n from"node:os";import i from"node:path";export function detectPlatform(){const c=n.platform(),a=n.arch(),s=n.homedir();let e,o,r;switch(c){case"win32":e="windows",o=process.env.PSModulePath?"powershell":"cmd",r=process.env.APPDATA||i.join(s,"AppData","Roaming");break;case"darwin":e="darwin",o=process.env.SHELL?.includes("zsh")?"zsh":"bash",r=i.join(s,"Library","Application Support");break;default:e="linux",o=process.env.SHELL?.includes("zsh")?"zsh":process.env.SHELL?.includes("bash")?"bash":"sh",r=process.env.XDG_CONFIG_HOME||i.join(s,".config")}return{os:e,arch:a,nodeVersion:process.version,shell:o,homeDir:s,configDir:r}}
1
+ import n from"node:os";import i from"node:path";export function detectPlatform(){const c=n.platform(),a=n.arch(),e=n.homedir();let s,o,r;switch(c){case"win32":s="windows",o=process.env.PSModulePath?"powershell":"cmd",r=process.env.APPDATA||i.join(e,"AppData","Roaming");break;case"darwin":s="darwin",o=process.env.SHELL?.includes("zsh")?"zsh":"bash",r=i.join(e,"Library","Application Support");break;default:s="linux",o=process.env.SHELL?.includes("zsh")?"zsh":process.env.SHELL?.includes("bash")?"bash":"sh",r=process.env.XDG_CONFIG_HOME||i.join(e,".config")}return{os:s,arch:a,nodeVersion:process.version,shell:o,homeDir:e,configDir:r}}
@@ -425,13 +425,13 @@ export declare const HookRuleSchema: z.ZodObject<{
425
425
  /** origin 为 plugin/builtin 时的插件 id;用户规则为 null。 */
426
426
  pluginId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
427
427
  }, "strip", z.ZodTypeAny, {
428
- id: string;
429
- name: string;
430
428
  filter: {
431
429
  toolNames?: string[] | undefined;
432
430
  pathGlobs?: string[] | undefined;
433
431
  crossProjectOnly?: boolean | undefined;
434
432
  };
433
+ id: string;
434
+ name: string;
435
435
  pluginId: string | null;
436
436
  enabled: boolean;
437
437
  priority: number;
@@ -545,7 +545,6 @@ export declare const WEAVE_PLUGIN_MANIFEST = "weave-plugin.json";
545
545
  * enabled 可省略(默认 true,但用户在 dashboard 的开关改动会被保留)。
546
546
  */
547
547
  export declare const PluginRuleEntrySchema: z.ZodObject<{
548
- name: z.ZodString;
549
548
  filter: z.ZodDefault<z.ZodObject<{
550
549
  /** 匹配 toolInput 的工具名(PostToolUse/PreToolUse 事件)。 */
551
550
  toolNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
@@ -562,6 +561,7 @@ export declare const PluginRuleEntrySchema: z.ZodObject<{
562
561
  pathGlobs?: string[] | undefined;
563
562
  crossProjectOnly?: boolean | undefined;
564
563
  }>>;
564
+ name: z.ZodString;
565
565
  pluginId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
566
566
  source: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
567
567
  kind: z.ZodLiteral<"hook-event">;
@@ -699,12 +699,12 @@ export declare const PluginRuleEntrySchema: z.ZodObject<{
699
699
  enabled: z.ZodOptional<z.ZodBoolean>;
700
700
  priority: z.ZodOptional<z.ZodNumber>;
701
701
  }, "strip", z.ZodTypeAny, {
702
- name: string;
703
702
  filter: {
704
703
  toolNames?: string[] | undefined;
705
704
  pathGlobs?: string[] | undefined;
706
705
  crossProjectOnly?: boolean | undefined;
707
706
  };
707
+ name: string;
708
708
  pluginId: string | null;
709
709
  source: {
710
710
  kind: "hook-event";
@@ -1 +1 @@
1
- import{z as e}from"zod";import{HARNESS_EVENTS as i,HARNESS_NAMES as r,INJECTABLE_EVENTS as s}from"./harness.js";export const PresetSchema=e.enum(["minimal","default","full"]),InitComponentsSchema=e.object({settings:e.boolean(),skills:e.boolean(),commands:e.boolean(),agents:e.boolean(),helpers:e.boolean(),mcp:e.boolean(),claudeMd:e.boolean(),agentsMd:e.boolean()}),HooksConfigSchema=e.object({preToolUse:e.boolean(),postToolUse:e.boolean(),userPromptSubmit:e.boolean(),sessionStart:e.boolean(),stop:e.boolean(),stopFailure:e.boolean(),subagentStop:e.boolean(),subagentStart:e.boolean(),notification:e.boolean(),postToolUseFailure:e.boolean(),permissionRequest:e.boolean(),permissionDenied:e.boolean(),preCompact:e.boolean(),sessionEnd:e.boolean(),preModelSwitch:e.boolean(),timeout:e.number().default(5e3),continueOnError:e.boolean().default(!0)}),CLAUDE_HOOK_EVENTS=i.claude,INJECTABLE_HOOK_EVENTS=s.claude;const a=e.enum(r),l=e.enum([...r,"any"]);export const HookRuleSourceSchema=e.discriminatedUnion("kind",[e.object({kind:e.literal("hook-event"),harness:l,event:e.string().min(1)}),e.object({kind:e.literal("webhook"),routeId:e.string().min(1)}),e.object({kind:e.literal("claude-event"),event:e.string().min(1)})]);export function normalizeHookRuleSource(t){return t.kind==="claude-event"?{kind:"hook-event",harness:"claude",event:t.event}:t}export function hookSourceHarness(t){return t.kind==="claude-event"?"claude":t.kind==="hook-event"?t.harness:null}export const HookRuleFilterSchema=e.object({toolNames:e.array(e.string().min(1)).optional(),pathGlobs:e.array(e.string().min(1)).optional(),crossProjectOnly:e.boolean().optional()}),HandlerConfigSchema=e.discriminatedUnion("type",[e.object({type:e.literal("log")}),e.object({type:e.literal("webhook"),url:e.string().url(),secret:e.string().optional(),headers:e.record(e.string(),e.string()).optional()}),e.object({type:e.literal("inject"),template:e.string().min(1)}),e.object({type:e.literal("manual"),template:e.string().min(1)}),e.object({type:e.literal("plugin"),pluginId:e.string().min(1),handlerType:e.string().min(1),config:e.record(e.string(),e.unknown()).optional()}),e.object({type:e.literal("classify"),prompt:e.string().min(1),prefilter:e.array(e.string().min(1)).optional(),cooldownMs:e.number().int().positive().optional(),routes:e.array(e.object({label:e.string().min(1),url:e.string().url(),secret:e.string().optional(),headers:e.record(e.string(),e.string()).optional()})).min(1)})]),HookRuleOriginSchema=e.enum(["user","plugin","builtin"]),HookRuleSchema=e.object({id:e.string().min(1),name:e.string().min(1),enabled:e.boolean(),priority:e.number().int(),projectId:e.number().int().nullable(),source:HookRuleSourceSchema,filter:HookRuleFilterSchema.default({}),handler:HandlerConfigSchema,timeoutMs:e.number().int().positive().default(5e3),record:e.boolean().default(!0),origin:HookRuleOriginSchema.default("user"),pluginId:e.string().min(1).nullable().default(null)}),WEAVE_PLUGIN_MANIFEST="weave-plugin.json",PluginRuleEntrySchema=HookRuleSchema.omit({id:!0,projectId:!0}).extend({enabled:e.boolean().optional(),priority:e.number().int().optional()}),WeavePluginManifestSchema=e.object({manifestVersion:e.literal(1),id:e.string().regex(/^[a-z][a-z0-9-]{0,63}$/),name:e.string().min(1),version:e.string().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/),description:e.string().optional(),author:e.string().optional(),engines:e.object({weave:e.string().optional()}).optional(),rules:e.array(e.string().min(1)).default([]),handlers:e.array(e.object({type:e.string().min(1),entry:e.string().min(1)})).default([]),requires:e.object({events:e.array(e.string().min(1)).optional()}).optional(),templates:e.object({skills:e.array(e.string().min(1)).optional(),commands:e.array(e.string().min(1)).optional(),agents:e.array(e.string().min(1)).optional()}).optional(),mcpServers:e.record(e.string(),e.unknown()).optional(),subscribe:e.object({events:e.array(e.string().min(1)),entry:e.string().min(1)}).optional(),statusline:e.object({entry:e.string().min(1)}).optional(),config:e.record(e.string(),e.unknown()).optional()}),HookDispatchStatusSchema=e.enum(["pending","injected","running","succeeded","failed","timeout"]),HookDispatchModeSchema=e.enum(["auto","manual"]),SkillsConfigSchema=e.object({core:e.boolean()}),CommandsConfigSchema=e.object({core:e.boolean()}),AgentsConfigSchema=e.object({core:e.boolean()}),MCPConfigSchema=e.object({weave:e.boolean(),autoStart:e.boolean().default(!1)}),RuntimeConfigSchema=e.object({initVersion:e.string(),initTimestamp:e.string(),preset:PresetSchema,harnesses:e.array(a).optional(),components:InitComponentsSchema,hooks:HooksConfigSchema.partial().optional(),mcp:MCPConfigSchema.partial().optional()}),PlatformInfoSchema=e.object({os:e.enum(["windows","darwin","linux"]),arch:e.enum(["x64","arm64"]),nodeVersion:e.string(),shell:e.enum(["powershell","cmd","bash","zsh","sh"]),homeDir:e.string(),configDir:e.string()}),InitOptionsSchema=e.object({targetDir:e.string().default(process.cwd()),force:e.boolean().default(!1),interactive:e.boolean().default(!0),preset:PresetSchema.default("default"),harnesses:e.array(a).optional(),components:InitComponentsSchema.partial().default({}),hooks:HooksConfigSchema.partial().default({}),skills:SkillsConfigSchema.partial().default({}),commands:CommandsConfigSchema.partial().default({}),agents:AgentsConfigSchema.partial().default({}),mcp:MCPConfigSchema.partial().default({})}),InitResultSchema=e.object({success:e.boolean(),platform:PlatformInfoSchema,created:e.object({directories:e.array(e.string()),files:e.array(e.string())}),skipped:e.array(e.string()),merged:e.array(e.string()),updated:e.array(e.string()),errors:e.array(e.string()),removed:e.array(e.string()),summary:e.object({skillsCount:e.number(),commandsCount:e.number(),agentsCount:e.number(),hooksEnabled:e.number()})}),MINIMAL_COMPONENTS={settings:!0,skills:!0,commands:!1,agents:!1,helpers:!1,mcp:!1,claudeMd:!0,agentsMd:!0},DEFAULT_COMPONENTS={settings:!0,skills:!0,commands:!1,agents:!1,helpers:!0,mcp:!0,claudeMd:!0,agentsMd:!0},FULL_COMPONENTS={settings:!0,skills:!0,commands:!0,agents:!0,helpers:!0,mcp:!0,claudeMd:!0,agentsMd:!0},DEFAULT_HOOKS={preToolUse:!0,postToolUse:!0,userPromptSubmit:!0,sessionStart:!0,stop:!0,stopFailure:!0,subagentStop:!0,subagentStart:!0,notification:!0,postToolUseFailure:!0,permissionRequest:!0,permissionDenied:!0,preCompact:!0,sessionEnd:!0,preModelSwitch:!0,timeout:5e3,continueOnError:!0},DEFAULT_SKILLS={core:!0},DEFAULT_COMMANDS={core:!0},DEFAULT_AGENTS={core:!0},DEFAULT_MCP={weave:!1,autoStart:!1};export function resolveComponents(t,o){const n=t==="minimal"?MINIMAL_COMPONENTS:t==="full"?FULL_COMPONENTS:DEFAULT_COMPONENTS;return o?{...n,...o}:{...n}}
1
+ import{z as e}from"zod";import{HARNESS_EVENTS as r,HARNESS_NAMES as a,INJECTABLE_EVENTS as s}from"./harness.js";export const PresetSchema=e.enum(["minimal","default","full"]),InitComponentsSchema=e.object({settings:e.boolean(),skills:e.boolean(),commands:e.boolean(),agents:e.boolean(),helpers:e.boolean(),mcp:e.boolean(),claudeMd:e.boolean(),agentsMd:e.boolean()}),HooksConfigSchema=e.object({preToolUse:e.boolean(),postToolUse:e.boolean(),userPromptSubmit:e.boolean(),sessionStart:e.boolean(),stop:e.boolean(),stopFailure:e.boolean(),subagentStop:e.boolean(),subagentStart:e.boolean(),notification:e.boolean(),postToolUseFailure:e.boolean(),permissionRequest:e.boolean(),permissionDenied:e.boolean(),preCompact:e.boolean(),sessionEnd:e.boolean(),preModelSwitch:e.boolean(),timeout:e.number().default(5e3),continueOnError:e.boolean().default(!0)}),CLAUDE_HOOK_EVENTS=r.claude,INJECTABLE_HOOK_EVENTS=s.claude;const i=e.enum(a),l=e.enum([...a,"any"]);export const HookRuleSourceSchema=e.discriminatedUnion("kind",[e.object({kind:e.literal("hook-event"),harness:l,event:e.string().min(1)}),e.object({kind:e.literal("webhook"),routeId:e.string().min(1)}),e.object({kind:e.literal("claude-event"),event:e.string().min(1)})]);export function normalizeHookRuleSource(n){return n.kind==="claude-event"?{kind:"hook-event",harness:"claude",event:n.event}:n}export function hookSourceHarness(n){return n.kind==="claude-event"?"claude":n.kind==="hook-event"?n.harness:null}export const HookRuleFilterSchema=e.object({toolNames:e.array(e.string().min(1)).optional(),pathGlobs:e.array(e.string().min(1)).optional(),crossProjectOnly:e.boolean().optional()}),HandlerConfigSchema=e.discriminatedUnion("type",[e.object({type:e.literal("log")}),e.object({type:e.literal("webhook"),url:e.string().url(),secret:e.string().optional(),headers:e.record(e.string(),e.string()).optional()}),e.object({type:e.literal("inject"),template:e.string().min(1)}),e.object({type:e.literal("manual"),template:e.string().min(1)}),e.object({type:e.literal("plugin"),pluginId:e.string().min(1),handlerType:e.string().min(1),config:e.record(e.string(),e.unknown()).optional()}),e.object({type:e.literal("classify"),prompt:e.string().min(1),prefilter:e.array(e.string().min(1)).optional(),cooldownMs:e.number().int().positive().optional(),routes:e.array(e.object({label:e.string().min(1),url:e.string().url(),secret:e.string().optional(),headers:e.record(e.string(),e.string()).optional()})).min(1)})]),HookRuleOriginSchema=e.enum(["user","plugin","builtin"]),HookRuleSchema=e.object({id:e.string().min(1),name:e.string().min(1),enabled:e.boolean(),priority:e.number().int(),projectId:e.number().int().nullable(),source:HookRuleSourceSchema,filter:HookRuleFilterSchema.default({}),handler:HandlerConfigSchema,timeoutMs:e.number().int().positive().default(5e3),record:e.boolean().default(!0),origin:HookRuleOriginSchema.default("user"),pluginId:e.string().min(1).nullable().default(null)}),WEAVE_PLUGIN_MANIFEST="weave-plugin.json",PluginRuleEntrySchema=HookRuleSchema.omit({id:!0,projectId:!0}).extend({enabled:e.boolean().optional(),priority:e.number().int().optional()}),WeavePluginManifestSchema=e.object({manifestVersion:e.literal(1),id:e.string().regex(/^[a-z][a-z0-9-]{0,63}$/),name:e.string().min(1),version:e.string().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/),description:e.string().optional(),author:e.string().optional(),engines:e.object({weave:e.string().optional()}).optional(),rules:e.array(e.string().min(1)).default([]),handlers:e.array(e.object({type:e.string().min(1),entry:e.string().min(1)})).default([]),requires:e.object({events:e.array(e.string().min(1)).optional()}).optional(),templates:e.object({skills:e.array(e.string().min(1)).optional(),commands:e.array(e.string().min(1)).optional(),agents:e.array(e.string().min(1)).optional()}).optional(),mcpServers:e.record(e.string(),e.unknown()).optional(),subscribe:e.object({events:e.array(e.string().min(1)),entry:e.string().min(1)}).optional(),statusline:e.object({entry:e.string().min(1)}).optional(),config:e.record(e.string(),e.unknown()).optional()}),HookDispatchStatusSchema=e.enum(["pending","injected","running","succeeded","failed","timeout"]),HookDispatchModeSchema=e.enum(["auto","manual"]),SkillsConfigSchema=e.object({core:e.boolean()}),CommandsConfigSchema=e.object({core:e.boolean()}),AgentsConfigSchema=e.object({core:e.boolean()}),MCPConfigSchema=e.object({weave:e.boolean(),autoStart:e.boolean().default(!1)}),RuntimeConfigSchema=e.object({initVersion:e.string(),initTimestamp:e.string(),preset:PresetSchema,harnesses:e.array(i).optional(),components:InitComponentsSchema,hooks:HooksConfigSchema.partial().optional(),mcp:MCPConfigSchema.partial().optional()}),PlatformInfoSchema=e.object({os:e.enum(["windows","darwin","linux"]),arch:e.enum(["x64","arm64"]),nodeVersion:e.string(),shell:e.enum(["powershell","cmd","bash","zsh","sh"]),homeDir:e.string(),configDir:e.string()}),InitOptionsSchema=e.object({targetDir:e.string().default(process.cwd()),force:e.boolean().default(!1),interactive:e.boolean().default(!0),preset:PresetSchema.default("default"),harnesses:e.array(i).optional(),components:InitComponentsSchema.partial().default({}),hooks:HooksConfigSchema.partial().default({}),skills:SkillsConfigSchema.partial().default({}),commands:CommandsConfigSchema.partial().default({}),agents:AgentsConfigSchema.partial().default({}),mcp:MCPConfigSchema.partial().default({})}),InitResultSchema=e.object({success:e.boolean(),platform:PlatformInfoSchema,created:e.object({directories:e.array(e.string()),files:e.array(e.string())}),skipped:e.array(e.string()),merged:e.array(e.string()),updated:e.array(e.string()),errors:e.array(e.string()),removed:e.array(e.string()),summary:e.object({skillsCount:e.number(),commandsCount:e.number(),agentsCount:e.number(),hooksEnabled:e.number()})}),MINIMAL_COMPONENTS={settings:!0,skills:!0,commands:!1,agents:!1,helpers:!1,mcp:!1,claudeMd:!0,agentsMd:!0},DEFAULT_COMPONENTS={settings:!0,skills:!0,commands:!1,agents:!1,helpers:!0,mcp:!0,claudeMd:!0,agentsMd:!0},FULL_COMPONENTS={settings:!0,skills:!0,commands:!0,agents:!0,helpers:!0,mcp:!0,claudeMd:!0,agentsMd:!0},DEFAULT_HOOKS={preToolUse:!0,postToolUse:!0,userPromptSubmit:!0,sessionStart:!0,stop:!0,stopFailure:!0,subagentStop:!0,subagentStart:!0,notification:!0,postToolUseFailure:!0,permissionRequest:!0,permissionDenied:!0,preCompact:!0,sessionEnd:!0,preModelSwitch:!0,timeout:5e3,continueOnError:!0},DEFAULT_SKILLS={core:!0},DEFAULT_COMMANDS={core:!0},DEFAULT_AGENTS={core:!0},DEFAULT_MCP={weave:!1,autoStart:!1};export function resolveComponents(n,o){const t=n==="minimal"?MINIMAL_COMPONENTS:n==="full"?FULL_COMPONENTS:DEFAULT_COMPONENTS;return o?{...t,...o}:{...t}}
@@ -1 +1 @@
1
- import{mkdir as i,readFile as a,writeFile as n,stat as u}from"node:fs/promises";import c from"node:path";export async function ensureDir(t){await i(t,{recursive:!0})}export async function writeFileIfAbsent(t,r,e){try{if(await a(t,"utf-8"),!e)return!1}catch{}return await ensureDir(c.dirname(t)),await n(t,r,"utf-8"),!0}export async function fileExists(t){try{return await u(t),!0}catch{return!1}}
1
+ import{mkdir as a,readFile as e,writeFile as n,stat as s}from"node:fs/promises";import c from"node:path";export async function ensureDir(t){await a(t,{recursive:!0})}export async function writeFileIfAbsent(t,r,i){try{if(await e(t,"utf-8"),!i)return!1}catch{}return await ensureDir(c.dirname(t)),await n(t,r,"utf-8"),!0}export async function fileExists(t){try{return await s(t),!0}catch{return!1}}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weavecode/core",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Core types, schemas, and utilities for weave",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,4 +1,4 @@
1
- import{readFile as d,writeFile as u}from"node:fs/promises";import n from"node:path";import{FILE_ASSET_SPECS as S}from"../shared/file-specs.js";const l=".mcp.json",p=".claude.json";export class ClaudeJsonCorruptError extends Error{constructor(t){super(t),this.name="ClaudeJsonCorruptError"}}function f(r){if(!r||r.includes("/")||r.includes("\\")||r.includes(".."))throw new Error(`Invalid asset name: "${r}"`)}async function j(r){try{const t=JSON.parse(await d(r,"utf-8"));return t&&typeof t=="object"?t:{}}catch{return{}}}export async function readClaudeJson(r){const t=n.join(r,p);let o;try{o=await d(t,"utf-8")}catch{return{}}let e;try{e=JSON.parse(o)}catch(s){throw new ClaudeJsonCorruptError(`~/.claude.json is not valid JSON \u2014 refusing to write: ${s instanceof Error?s.message:String(s)}`)}if(!e||typeof e!="object"||Array.isArray(e))throw new ClaudeJsonCorruptError("~/.claude.json is not a JSON object \u2014 refusing to write");return e}export const CLAUDE_ASSETS={harness:"claude",targetDir(r,t,o,e){const s=S[r].dirs.claude;if(t==="user"){if(!s?.user)throw new Error(`"${r}" is project-scoped only (no user-level directory)`);return n.join(e,...s.user.split("/"))}if(!s?.project)throw new Error(`"${r}" has no Claude project surface`);return n.join(o,...s.project.split("/"))},projectSkillsRoots:()=>[".claude/skills"],globalSkillsRoots:r=>[n.join(r,...".claude/skills".split("/"))],userConfigFile:r=>n.join(r,".claude","settings.json"),mcpScopes:()=>["project","user"],mcpDest:(r,t)=>r==="project"?".mcp.json":n.join(t,".claude.json"),pluginCacheDir:r=>n.join(r,".claude","plugins","cache"),async mcpRead(r,t,o){if(r==="project")return(await j(n.join(t,l))).mcpServers??{};const e=(await readClaudeJson(o)).mcpServers;return!e||typeof e!="object"||Array.isArray(e)?{}:e},async mcpWrite(r,t,o,e,s){if(f(e),r==="project"){const i=n.join(t,l),a=await j(i);a.mcpServers={...a.mcpServers??{},[e]:s},await u(i,`${JSON.stringify(a,null,2)}
2
- `,"utf-8");return}const c=await readClaudeJson(o);c.mcpServers={...c.mcpServers??{},[e]:s},await u(n.join(o,p),`${JSON.stringify(c,null,2)}
3
- `,"utf-8")},async mcpRemove(r,t,o,e){f(e);const s=r==="project"?n.join(t,l):n.join(o,p),c=r==="project"?await j(s):await readClaudeJson(o),i=c.mcpServers??{};return e in i?(delete i[e],c.mcpServers=i,await u(s,`${JSON.stringify(c,null,2)}
1
+ import{readFile as j,writeFile as u}from"node:fs/promises";import c from"node:path";import{FILE_ASSET_SPECS as m}from"../shared/file-specs.js";const l=".mcp.json",p=".claude.json";export class ClaudeJsonCorruptError extends Error{constructor(e){super(e),this.name="ClaudeJsonCorruptError"}}function f(r){if(!r||r.includes("/")||r.includes("\\")||r.includes(".."))throw new Error(`Invalid asset name: "${r}"`)}async function d(r){try{const e=JSON.parse(await j(r,"utf-8"));return e&&typeof e=="object"?e:{}}catch{return{}}}export async function readClaudeJson(r){const e=c.join(r,p);let o;try{o=await j(e,"utf-8")}catch{return{}}let t;try{t=JSON.parse(o)}catch(s){throw new ClaudeJsonCorruptError(`~/.claude.json is not valid JSON \u2014 refusing to write: ${s instanceof Error?s.message:String(s)}`)}if(!t||typeof t!="object"||Array.isArray(t))throw new ClaudeJsonCorruptError("~/.claude.json is not a JSON object \u2014 refusing to write");return t}export const CLAUDE_ASSETS={harness:"claude",targetDir(r,e,o,t){const s=m[r].dirs.claude;if(e==="user"){if(!s?.user)throw new Error(`"${r}" is project-scoped only (no user-level directory)`);return c.join(t,...s.user.split("/"))}if(!s?.project)throw new Error(`"${r}" has no Claude project surface`);return c.join(o,...s.project.split("/"))},projectSkillsRoots:()=>[".claude/skills"],globalSkillsRoots:r=>[c.join(r,...".claude/skills".split("/"))],userConfigFile:r=>c.join(r,".claude","settings.json"),mcpScopes:()=>["project","user"],mcpDest:(r,e)=>r==="project"?".mcp.json":c.join(e,".claude.json"),pluginCacheDir:r=>c.join(r,".claude","plugins","cache"),async mcpRead(r,e,o){if(r==="project")return(await d(c.join(e,l))).mcpServers??{};const t=(await readClaudeJson(o)).mcpServers;return!t||typeof t!="object"||Array.isArray(t)?{}:t},async mcpWrite(r,e,o,t,s){if(f(t),r==="project"){const a=c.join(e,l),i=await d(a);i.mcpServers={...i.mcpServers??{},[t]:s},await u(a,`${JSON.stringify(i,null,2)}
2
+ `,"utf-8");return}const n=await readClaudeJson(o);n.mcpServers={...n.mcpServers??{},[t]:s},await u(c.join(o,p),`${JSON.stringify(n,null,2)}
3
+ `,"utf-8")},async mcpRemove(r,e,o,t){f(t);const s=r==="project"?c.join(e,l):c.join(o,p),n=r==="project"?await d(s):await readClaudeJson(o),a=n.mcpServers??{};return t in a?(delete a[t],n.mcpServers=a,await u(s,`${JSON.stringify(n,null,2)}
4
4
  `,"utf-8"),!0):!1},classify(r){return r===".claude"||r.startsWith(".claude/")||r===".mcp.json"?!0:r.slice(r.lastIndexOf("/")+1)==="CLAUDE.md"},ignore(r){return r===".claude"||r.startsWith(".claude/")?r===".claude/projects"||r.startsWith(".claude/projects/")||r===".claude/cache"||r.startsWith(".claude/cache/")||r===".claude/worktrees"||r.startsWith(".claude/worktrees/"):r!==".mcp.json"&&r!=="CLAUDE.md"}};
@@ -1,4 +1,4 @@
1
- import{homedir as u}from"node:os";import{access as j,mkdir as f,readFile as h,unlink as _,writeFile as v}from"node:fs/promises";import i from"node:path";import{HARNESS_DIRS as d,HARNESS_EVENTS as N,INJECTABLE_EVENTS as k,TERMINAL_LOCATOR_ENV_KEYS as b,TITLE_EFFECTIVE_EVENTS as T}from"@weavecode/core";import{CLAUDE_PROMPT_INBOX as m}from"./prompt-inbox.js";export function generateHookHandler(e,t="claude"){return`#!/usr/bin/env node
1
+ import{homedir as l}from"node:os";import{access as k,mkdir as E,readFile as f,unlink as C,writeFile as h}from"node:fs/promises";import o from"node:path";import{HARNESS_DIRS as d,HARNESS_EVENTS as S,INJECTABLE_EVENTS as D,TERMINAL_LOCATOR_ENV_KEYS as w,TITLE_EFFECTIVE_EVENTS as j}from"@weavecode/core";import{CLAUDE_PROMPT_INBOX as v}from"./prompt-inbox.js";export function generateHookHandler(e,t="claude"){return`#!/usr/bin/env node
2
2
  /**
3
3
  * weave hook-handler \u2014 collects Claude Code hook events into the global weave
4
4
  * data directory and renders locally-mirrored injections. No network, no
@@ -28,15 +28,15 @@ const crypto = require('crypto');
28
28
  const HOOK_GUARD_MS = 2000;
29
29
  // Events that can carry additionalContext back via hook output (harness
30
30
  // contract; mirrors INJECTABLE_EVENTS server-side).
31
- const INJECTABLE_EVENTS = ${JSON.stringify(k[t])};
31
+ const INJECTABLE_EVENTS = ${JSON.stringify(D[t])};
32
32
  // The host applies hookSpecificOutput.sessionTitle ONLY on these events (mirrors
33
33
  // TITLE_EFFECTIVE_EVENTS) \u2014 tool events record hook_success but drop the field
34
34
  // (verified against Claude Code 2.1.296).
35
- const TITLE_EVENTS = ${JSON.stringify(T[t])};
35
+ const TITLE_EVENTS = ${JSON.stringify(j[t])};
36
36
  // Terminal pane locator env (mirrors TERMINAL_LOCATOR_ENV_KEYS in @weavecode/core):
37
37
  // captured in the pane's own child process and reported on the inbox line's side
38
38
  // channel, so the daemon can address THIS session's pane exactly.
39
- const TERMINAL_ENV_KEYS = ${JSON.stringify(b)};
39
+ const TERMINAL_ENV_KEYS = ${JSON.stringify(w)};
40
40
  const INBOX_MAX_BYTES = 4 * 1024 * 1024;
41
41
  const INBOX_MAX_LINES = 1000;
42
42
  const OUTBOX_MAX_LINES = 200;
@@ -80,9 +80,9 @@ function hooksDir() {
80
80
  // \u8BE5\u4F1A\u8BDD\u7684 hooks \u4E0E Bash\uFF09\uFF1Adaemon \u4FA7\u53EA\u653E\u5185\u5B58\u3001\u4E0D\u843D\u5E93\u4E0D\u8FDB UI \u2014\u2014 \u4E0A\u62A5\u8D70 inbox
81
81
  // \u884C\u7684\u65C1\u8DEF\u5B57\u6BB5\uFF08\u4E0D\u8FDB report/payload\uFF09\u3002
82
82
  function messagingEnv() {
83
- var sock = process.env.${m.socketEnv};
83
+ var sock = process.env.${v.socketEnv};
84
84
  if (!sock) return null;
85
- return { socket: sock, token: process.env.${m.tokenEnv} || null };
85
+ return { socket: sock, token: process.env.${v.tokenEnv} || null };
86
86
  }
87
87
 
88
88
  // \u7EC8\u7AEF\u628A\u300C\u672C pane\u300D\u5BFC\u51FA\u7684\u73AF\u5883\u53D8\u91CF\uFF08wezterm \u7B49\uFF09\u3002\u672C\u8FDB\u7A0B\u751F\u5728\u4F1A\u8BDD\u81EA\u5DF1\u7684 pane \u91CC\uFF0C
@@ -381,6 +381,6 @@ async function main() {
381
381
  }
382
382
 
383
383
  main().catch(function () { process.exit(0); });
384
- `}export const HOOK_HANDLER_MARKER=".claude/helpers/hook-handler.cjs";function l(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function E(e){return e.replace(/\\/g,"/")}export function groupIsWeave(e){if(!l(e))return!1;const t=e.hooks;return Array.isArray(t)?t.some(n=>l(n)&&typeof n.command=="string"&&E(n.command).includes(HOOK_HANDLER_MARKER)):!1}export function captureHookGroup(e,t){const n=`node "${E(t)}/hook-handler.cjs"`,r=!k.claude.includes(e);return[{matcher:"*",hooks:[{type:"command",command:n,...r?{async:!0}:{}}]}]}export function sweepWeaveHookEvents(e){if(!l(e))return;const t={};for(const[n,r]of Object.entries(e)){if(!Array.isArray(r)){t[n]=r;continue}const s=r.filter(a=>!groupIsWeave(a));s.length>0&&(t[n]=s)}return Object.keys(t).length>0?t:void 0}export function captureGroupsPresent(e){if(!l(e))return!1;const t=e.hooks;return l(t)?Object.values(t).some(n=>Array.isArray(n)&&n.some(groupIsWeave)):!1}function y(e){return i.join(e,d.claude.userDir,"settings.json")}function p(e){return i.join(e,d.claude.userDir,"helpers")}const S="@version weave@";async function I(e){try{return await j(e),!0}catch{return!1}}async function g(e){let t;try{t=await h(e,"utf-8")}catch{return{}}let n;try{n=JSON.parse(t)}catch{throw new Error(`user settings is not parseable JSON: ${e}`)}if(!l(n))throw new Error(`user settings is not a JSON object: ${e}`);return n}async function w(e){let t;try{t=await g(e)}catch{return}const n=sweepWeaveHookEvents(t.hooks);n===void 0?delete t.hooks:t.hooks=n,await f(i.dirname(e),{recursive:!0}),await v(e,JSON.stringify(t,null,2)+`
385
- `,"utf-8")}export async function readUserCapture(e={}){const t=e.home??u(),n=await g(y(t));return{installed:captureGroupsPresent(n),helperPresent:await I(i.join(p(t),"hook-handler.cjs"))}}export async function readScriptHealth(e={}){const t=e.home??u(),n=i.join(p(t),"hook-handler.cjs"),r=e.projectPath?i.join(e.projectPath,d.claude.projectDir,"helpers","hook-handler.cjs"):null,s=(await readUserCapture({home:t})).installed,a=s?"user":r?"project":"none",c=s?n:r??n;let o=null;try{o=await h(c,"utf-8")}catch{o=null}return{source:a,present:o!==null,weaveOwned:o!==null&&o.includes(S),generatedVersion:o?.match(/@version weave@(\S+)/)?.[1]??null,reportsInbox:o!==null&&o.includes(m.socketEnv),reportsPaneEnv:o!==null&&o.includes("terminalEnv()")}}export async function installUserCapture(e){const t=e.home??u(),n=p(t);await f(n,{recursive:!0}),await v(i.join(n,"hook-handler.cjs"),generateHookHandler(e.version),"utf-8");const r=y(t),s=await g(r),a=sweepWeaveHookEvents(s.hooks)??{};for(const c of N.claude){const o=a[c];a[c]=Array.isArray(o)?[...o,...captureHookGroup(c,n)]:captureHookGroup(c,n)}s.hooks=a,await f(i.dirname(r),{recursive:!0}),await v(r,JSON.stringify(s,null,2)+`
386
- `,"utf-8")}export async function uninstallUserCapture(e={}){const t=e.home??u();await w(y(t));const n=i.join(p(t),"hook-handler.cjs");try{(await h(n,"utf-8")).includes(S)&&await _(n)}catch{}}export async function stripProjectCapture(e){await w(i.join(e,d.claude.projectDir,"settings.json"))}export const CLAUDE_CAPTURE={harness:"claude",readUserCapture:e=>readUserCapture(e),installUserCapture:e=>installUserCapture(e),uninstallUserCapture:e=>uninstallUserCapture(e),stripProjectCapture,scriptHealth:e=>readScriptHealth(e)};
384
+ `}export const HOOK_HANDLER_MARKER=".claude/helpers/hook-handler.cjs";function c(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function y(e){return e.replace(/\\/g,"/")}export function groupIsWeave(e){if(!c(e))return!1;const t=e.hooks;return Array.isArray(t)?t.some(r=>c(r)&&typeof r.command=="string"&&y(r.command).includes(HOOK_HANDLER_MARKER)):!1}export function captureHookGroup(e,t){const r=`node "${y(t)}/hook-handler.cjs"`,u=!D.claude.includes(e);return[{matcher:"*",hooks:[{type:"command",command:r,...u?{async:!0}:{}}]}]}export function sweepWeaveHookEvents(e){if(!c(e))return;const t={};for(const[r,u]of Object.entries(e)){if(!Array.isArray(u)){t[r]=u;continue}const i=u.filter(s=>!groupIsWeave(s));i.length>0&&(t[r]=i)}return Object.keys(t).length>0?t:void 0}export function captureGroupsPresent(e){if(!c(e))return!1;const t=e.hooks;return c(t)?Object.values(t).some(r=>Array.isArray(r)&&r.some(groupIsWeave)):!1}function F(e){return o.join(e,d.claude.userDir,"settings.json")}function p(e){return o.join(e,d.claude.userDir,"helpers")}const g="@version weave@";async function B(e){try{return await k(e),!0}catch{return!1}}async function m(e){let t;try{t=await f(e,"utf-8")}catch{return{}}let r;try{r=JSON.parse(t)}catch{throw new Error(`user settings is not parseable JSON: ${e}`)}if(!c(r))throw new Error(`user settings is not a JSON object: ${e}`);return r}async function A(e){let t;try{t=await m(e)}catch{return}const r=sweepWeaveHookEvents(t.hooks);r===void 0?delete t.hooks:t.hooks=r,await E(o.dirname(e),{recursive:!0}),await h(e,JSON.stringify(t,null,2)+`
385
+ `,"utf-8")}export async function readUserCapture(e={}){const t=e.home??l(),r=await m(F(t));return{installed:captureGroupsPresent(r),helperPresent:await B(o.join(p(t),"hook-handler.cjs"))}}export async function readScriptHealth(e={}){const t=e.home??l(),r=o.join(p(t),"hook-handler.cjs"),u=e.projectPath?o.join(e.projectPath,d.claude.projectDir,"helpers","hook-handler.cjs"):null,i=(await readUserCapture({home:t})).installed,s=i?"user":u?"project":"none",a=i?r:u??r;let n=null;try{n=await f(a,"utf-8")}catch{n=null}return{source:s,present:n!==null,weaveOwned:n!==null&&n.includes(g),generatedVersion:n?.match(/@version weave@(\S+)/)?.[1]??null,reportsInbox:n!==null&&n.includes(v.socketEnv),reportsPaneEnv:n!==null&&n.includes("terminalEnv()")}}export async function installUserCapture(e){const t=e.home??l(),r=p(t);await E(r,{recursive:!0}),await h(o.join(r,"hook-handler.cjs"),generateHookHandler(e.version),"utf-8");const u=F(t),i=await m(u),s=sweepWeaveHookEvents(i.hooks)??{};for(const a of S.claude){const n=s[a];s[a]=Array.isArray(n)?[...n,...captureHookGroup(a,r)]:captureHookGroup(a,r)}i.hooks=s,await E(o.dirname(u),{recursive:!0}),await h(u,JSON.stringify(i,null,2)+`
386
+ `,"utf-8")}export async function uninstallUserCapture(e={}){const t=e.home??l();await A(F(t));const r=o.join(p(t),"hook-handler.cjs");try{(await f(r,"utf-8")).includes(g)&&await C(r)}catch{}}export async function stripProjectCapture(e){await A(o.join(e,d.claude.projectDir,"settings.json"))}export const CLAUDE_CAPTURE={harness:"claude",readUserCapture:e=>readUserCapture(e),installUserCapture:e=>installUserCapture(e),uninstallUserCapture:e=>uninstallUserCapture(e),stripProjectCapture,scriptHealth:e=>readScriptHealth(e)};
@@ -1,3 +1,3 @@
1
- import{readdir as k,readFile as S,stat as A}from"node:fs/promises";import{homedir as M}from"node:os";import c from"node:path";import{execCli as L}from"./plugins.js";import{readNewLines as j,transcriptSize as I}from"./transcript-cursor.js";const E=[{name:"add-dir",description:"Add a new working directory",argsHint:"[<path>]",source:"builtin"},{name:"artifacts",description:"Browse your published and shared artifacts",source:"builtin"},{name:"auto-mode-setup",description:"Teach auto mode about your environment, plus optional rule tweaks",source:"builtin"},{name:"autocompact",description:"Set how full the context gets before auto-summarizing",argsHint:"[auto|<tokens>]",source:"builtin"},{name:"background",description:"Send this session to the background and free the terminal",argsHint:"[prompt]",source:"builtin"},{name:"branch",description:"Create a branch of the current conversation at this point",argsHint:"[name]",source:"builtin"},{name:"brief",description:"Toggle brief-only mode",source:"builtin"},{name:"btw",description:"Ask a quick side question without interrupting the main conversation",argsHint:"[question]",source:"builtin"},{name:"bug",description:"Report a bug or share your conversation",argsHint:"[report]",source:"builtin"},{name:"cd",description:"Move this session to a new working directory",argsHint:"[<path>]",source:"builtin"},{name:"clear",description:"Start a new session with empty context; previous session stays on disk (resumable with /resume)",source:"builtin"},{name:"cloud-plugins",description:"Choose whether cloud sessions use the plugins enabled on this machine",source:"builtin"},{name:"code-review",description:"Review the current diff or a PR for bugs and cleanups",source:"builtin"},{name:"color",description:"Set the prompt bar color for this session",source:"builtin"},{name:"compact",description:"Free up context by summarizing the conversation so far",argsHint:"[instructions]",source:"builtin"},{name:"config",description:"Open settings",argsHint:"[key=value]",source:"builtin"},{name:"context",description:"Visualize current context usage as a colored grid",argsHint:"[all]",source:"builtin"},{name:"copy",description:"Copy Claude's last response to clipboard (or /copy N for the Nth-latest)",source:"builtin"},{name:"daemon",description:"Manage background services and routines",source:"builtin"},{name:"debug",description:"Turn on debug logging and investigate problems",argsHint:"[issue description]",source:"builtin"},{name:"design-login",description:"Authorize design-system access for /design-sync with your claude.ai account",source:"builtin"},{name:"diff",description:"View uncommitted changes and per-turn diffs",source:"builtin"},{name:"doctor",description:"Health-check your setup and fix issues: installation, unused extensions, duplicated or bloated memory files, slow hooks, updates, permissions",source:"builtin"},{name:"effort",description:"Set effort level for model usage",argsHint:"[level]",source:"builtin"},{name:"exit",description:"Exit the CLI",source:"builtin"},{name:"export",description:"Export the current conversation to a file or clipboard",argsHint:"[filename]",source:"builtin"},{name:"feedback",description:"Send feedback to Anthropic or report a bug",argsHint:"[report]",source:"builtin"},{name:"focus",description:"Toggle focus view: just your prompt, summary, and response",source:"builtin"},{name:"fork",description:"Spawn a background agent that inherits the full conversation",argsHint:"[<directive>]",source:"builtin"},{name:"goal",description:"Set a goal Claude checks before stopping",argsHint:"[<condition> | clear]",source:"builtin"},{name:"help",description:"Show help and available commands",source:"builtin"},{name:"hooks",description:"View hook configurations for tool events",argsHint:"[name]",source:"builtin"},{name:"ide",description:"Manage IDE integrations and show status",argsHint:"[open]",source:"builtin"},{name:"init",description:"Initialize a CLAUDE.md for this project",source:"builtin",inline:!0},{name:"insights",description:"Generate a report analyzing your Claude Code sessions",source:"builtin",inline:!0},{name:"install",description:"Install Claude Code native build",argsHint:"[options]",source:"builtin"},{name:"install-github-app",description:"Set up Claude GitHub Actions for a repository",source:"builtin"},{name:"install-slack-app",description:"Install the Claude Slack app",source:"builtin"},{name:"keybindings",description:"Open your keyboard shortcuts file",source:"builtin"},{name:"list-agents",description:"List subagents, teammates, and other Claude sessions you can message",source:"builtin"},{name:"login",description:"Sign in with your Anthropic account",source:"builtin"},{name:"logout",description:"Sign out from your Anthropic account",source:"builtin"},{name:"loops",description:"List, create, and delete loops",argsHint:"[name]",source:"builtin"},{name:"mcp",description:"Manage MCP servers",source:"builtin"},{name:"memory",description:"Edit CLAUDE.md files and memory settings",source:"builtin"},{name:"mobile",description:"Show QR code to download the Claude mobile app",source:"builtin"},{name:"model",description:"Set the AI model for Claude Code",argsHint:"[model]",source:"builtin"},{name:"permissions",description:"Manage allow and deny tool permission rules",argsHint:"[open|<description>]",source:"builtin"},{name:"plan",description:"Enable plan mode or view the current session plan",argsHint:"[open|<description>]",source:"builtin"},{name:"plugin",description:"Manage Claude Code plugins",source:"builtin"},{name:"powerup",description:"Discover Claude Code features through quick interactive lessons",argsHint:"[name]",source:"builtin"},{name:"privacy-settings",description:"View and update your privacy settings",source:"builtin"},{name:"radio",description:"Listen to Claude FM lo-fi radio",source:"builtin"},{name:"rate-limit-options",description:"Manage usage limits and upgrade options",source:"builtin"},{name:"recap",description:"Generate a one-line session recap now",source:"builtin"},{name:"release-notes",description:"View release notes",source:"builtin"},{name:"reload-plugins",description:"Activate pending plugin changes in the current session",argsHint:"[--force]",source:"builtin"},{name:"reload-skills",description:"Pick up skills added or changed on disk during this session",source:"builtin"},{name:"rename",description:"Rename the current conversation",argsHint:"[name]",source:"builtin"},{name:"resume",description:"Resume a previous conversation",argsHint:"[conversation id or search term]",source:"builtin"},{name:"rewind",description:"Restore the code and/or conversation to a previous point",source:"builtin"},{name:"scroll-speed",description:"Adjust mouse wheel scroll speed",source:"builtin"},{name:"security-review",description:"Complete a security review of the pending changes on the current branch",source:"builtin"},{name:"skill-doctor",description:"Show which loaded skills are unused and costing context",source:"builtin"},{name:"skills",description:"List available skills",source:"builtin"},{name:"status",description:"Show Claude Code status including version, model, account, API connectivity, and tool statuses",source:"builtin"},{name:"statusline",description:"Set up Claude Code's status line UI",source:"builtin",inline:!0},{name:"stickers",description:"Order Claude Code stickers",source:"builtin"},{name:"stop",description:"Stop this background session; transcript and worktree are kept",source:"builtin"},{name:"subtask",description:"Send a subagent off with your full context; its result comes back here",argsHint:"[<task>]",source:"builtin"},{name:"tasks",description:"View and manage everything running in the background",source:"builtin"},{name:"terminal-setup",description:"Check terminal setup for key bindings like Shift+Enter",source:"builtin"},{name:"theme",description:"Change the theme",source:"builtin"},{name:"tui",description:"Set the terminal UI renderer (default | fullscreen)",argsHint:"[default|fullscreen]",source:"builtin"},{name:"ultraplan",description:"Draft an editable plan in a cloud session",argsHint:"[<prompt>]",source:"builtin"},{name:"ultrareview",description:"Start a cloud agent that finds and verifies bugs in your branch",source:"builtin"},{name:"upgrade",description:"Upgrade to Max for higher rate limits and more Opus",source:"builtin"},{name:"usage",description:"Show session cost, plan usage, and activity stats",source:"builtin"},{name:"usage-credits",description:"Configure usage credits or request them from your admin when you hit a limit",source:"builtin"},{name:"version",description:"Show this session's version (autoupdate may have a newer one)",source:"builtin"},{name:"wellbeing",description:"Configure optional break reminders and quiet-hours nudges",source:"builtin"},{name:"workflows",description:"Browse running and completed workflows",source:"builtin"}];function v(n){const t=/^---\r?\n([\s\S]*?)\r?\n---/.exec(n)?.[1]??"",i=/^description:\s*(.+)$/m.exec(t)?.[1]?.trim().replace(/^["']|["']$/g,"");return i||(n.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/,"").split(`
2
- `).find(o=>o.trim()!==""&&!o.startsWith("#"))?.trim()??"")}async function C(n){try{const t=await A(n);return t.isDirectory()?"dir":t.isFile()?"file":"other"}catch{return"other"}}async function O(n){try{const t=[];for(const i of await k(n,{withFileTypes:!0})){if(!i.name.endsWith(".md"))continue;const e=c.join(n,i.name);(i.isFile()||i.isSymbolicLink()&&await C(e)==="file")&&t.push(e)}return t}catch{return[]}}async function m(n){try{const t=[];for(const i of await k(n,{withFileTypes:!0})){const e=c.join(n,i.name);(i.isDirectory()||i.isSymbolicLink()&&await C(e)==="dir")&&t.push(e)}return t}catch{return[]}}async function H(n){const t=[],i=async(e,o)=>{for(const s of await O(e)){const r=`${o}${c.basename(s,".md")}`,a=v(await S(s,"utf8").catch(()=>""));t.push({name:r,description:a,source:"command",inline:!0})}for(const s of await m(e))await i(s,`${o}${c.basename(s)}:`)};return await i(n,""),t}async function g(n,t="",i="skill"){const e=[];for(const o of await m(n)){const s=v(await S(c.join(o,"SKILL.md"),"utf8").catch(()=>""));e.push({name:`${t}${c.basename(o)}`,description:s,source:i,inline:!0})}return e}async function $(n){const t=[],i=new Set;for(const e of await m(c.join(n,"plugins","cache")))for(const o of await m(e)){const s=c.basename(o);if(!i.has(s))for(const r of await m(o)){const a=await g(c.join(r,"skills"),`${s}:`,"plugin");if(a.length>0){i.add(s),t.push(...a);break}}}return t}async function T(n){try{const{stdout:t}=await n(["plugin","list","--json"],{timeoutMs:15e3}),i=JSON.parse(t);if(!Array.isArray(i))return null;const e=[];for(const o of i){if(!o||typeof o!="object")continue;const s=o;if(typeof s.id!="string"||typeof s.installPath!="string")continue;const r=s.id.lastIndexOf("@");e.push({plugin:r>0?s.id.slice(0,r):s.id,enabled:s.enabled===!0,installPath:s.installPath})}return e}catch{return null}}async function z(n){const t=await T(n);if(!t)return null;const i=[];for(const e of t)e.enabled&&i.push(...await g(c.join(e.installPath,"skills"),`${e.plugin}:`,"plugin"));return i}function D(n){const t=new Set,i=[];for(const e of n)t.has(e.name)||(t.add(e.name),i.push(e));return i}const R=n=>typeof n=="string"?n:"";function _(n){return/<command-args>([\s\S]*?)<\/command-args>/.exec(n)?.[1]?.trim()??""}const d=new Map,F=64;export async function commandExecutions(n){const t=I(n);if(t===null)return d.delete(n),null;const i=d.get(n);d.delete(n);const e=i??{cur:{offset:0},out:[],pending:null};t<e.cur.offset&&(e.cur.offset=0,e.out=[],e.pending=null);const o=j(n,e.cur,t);if(o===null)return null;const s=e.out;let r=e.pending;for(const a of o){if(!a.includes("<command-")&&!a.includes("<local-command-stdout>")&&!a.includes("<bash-"))continue;let l;try{l=JSON.parse(a)}catch{continue}if(l===null||typeof l!="object")continue;const p=l,u=p.message?.content;if(typeof u!="string")continue;const f=R(p.timestamp),b=/<command-name>([^<]*)<\/command-name>/.exec(u)?.[1]?.trim();if(b?.startsWith("/")){r={name:b.slice(1),args:_(u),at:f};continue}const h=/<bash-input>([\s\S]*?)<\/bash-input>/.exec(u)?.[1];if(h!==void 0){r={name:h.trim(),args:"",at:f,sigil:"!"};continue}const x=/<local-command-stdout>([\s\S]*?)<\/local-command-stdout>/.exec(u)?.[1]??/<bash-stdout>([\s\S]*?)<\/bash-stdout>/.exec(u)?.[1]??"";if(r===null)continue;const w=/<bash-stderr>([\s\S]*?)<\/bash-stderr>/.exec(u)?.[1]?.trim()??"",y=[x.replace(/\u001b\[[0-9;]*m/g,"").trim(),w?`[stderr] ${w}`:""].filter(Boolean).join(`
3
- `);s.push({...r,...y!==""?{output:y}:{}}),r=null}if(e.pending=r,d.size>=F){const a=d.keys().next().value;a!==void 0&&d.delete(a)}return d.set(n,e),s}const U=6e4,N=16;export function createClaudeCommandSurface(n={}){const t=n.exec??L,i=new Map;return{harness:"claude",inputModes:[{kind:"slash",sigil:"/",named:!0},{kind:"bash",sigil:"!",named:!1}],async list({projectPath:e,homedir:o=M()}){const s=`${e}\0${o}`,r=Date.now(),a=i.get(s);if(a&&r-a.at<U)return a.rows;const l=c.join(o,".claude"),p=D([...E,...await H(c.join(e,".claude","commands")),...await H(c.join(l,"commands")),...await g(c.join(e,".claude","skills")),...await g(c.join(l,"skills")),...await z(t)??await $(l)]);if(i.size>=N){const u=i.keys().next().value;u!==void 0&&i.delete(u)}return i.set(s,{at:r,rows:p}),p},executions:e=>e?commandExecutions(e):Promise.resolve(null)}}export const CLAUDE_COMMANDS=createClaudeCommandSurface();
1
+ import{readdir as k,readFile as v,stat as j}from"node:fs/promises";import{homedir as A}from"node:os";import c from"node:path";import{execCli as M}from"./plugins.js";import{readNewLines as L,transcriptSize as $}from"./transcript-cursor.js";const I=[{name:"add-dir",description:"Add a new working directory",argsHint:"[<path>]",source:"builtin"},{name:"artifacts",description:"Browse your published and shared artifacts",source:"builtin"},{name:"auto-mode-setup",description:"Teach auto mode about your environment, plus optional rule tweaks",source:"builtin"},{name:"autocompact",description:"Set how full the context gets before auto-summarizing",argsHint:"[auto|<tokens>]",source:"builtin"},{name:"background",description:"Send this session to the background and free the terminal",argsHint:"[prompt]",source:"builtin"},{name:"branch",description:"Create a branch of the current conversation at this point",argsHint:"[name]",source:"builtin"},{name:"brief",description:"Toggle brief-only mode",source:"builtin"},{name:"btw",description:"Ask a quick side question without interrupting the main conversation",argsHint:"[question]",source:"builtin"},{name:"bug",description:"Report a bug or share your conversation",argsHint:"[report]",source:"builtin"},{name:"cd",description:"Move this session to a new working directory",argsHint:"[<path>]",source:"builtin"},{name:"clear",description:"Start a new session with empty context; previous session stays on disk (resumable with /resume)",source:"builtin"},{name:"cloud-plugins",description:"Choose whether cloud sessions use the plugins enabled on this machine",source:"builtin"},{name:"code-review",description:"Review the current diff or a PR for bugs and cleanups",source:"builtin"},{name:"color",description:"Set the prompt bar color for this session",source:"builtin"},{name:"compact",description:"Free up context by summarizing the conversation so far",argsHint:"[instructions]",source:"builtin"},{name:"config",description:"Open settings",argsHint:"[key=value]",source:"builtin"},{name:"context",description:"Visualize current context usage as a colored grid",argsHint:"[all]",source:"builtin"},{name:"copy",description:"Copy Claude's last response to clipboard (or /copy N for the Nth-latest)",source:"builtin"},{name:"daemon",description:"Manage background services and routines",source:"builtin"},{name:"debug",description:"Turn on debug logging and investigate problems",argsHint:"[issue description]",source:"builtin"},{name:"design-login",description:"Authorize design-system access for /design-sync with your claude.ai account",source:"builtin"},{name:"diff",description:"View uncommitted changes and per-turn diffs",source:"builtin"},{name:"doctor",description:"Health-check your setup and fix issues: installation, unused extensions, duplicated or bloated memory files, slow hooks, updates, permissions",source:"builtin"},{name:"effort",description:"Set effort level for model usage",argsHint:"[level]",source:"builtin"},{name:"exit",description:"Exit the CLI",source:"builtin"},{name:"export",description:"Export the current conversation to a file or clipboard",argsHint:"[filename]",source:"builtin"},{name:"feedback",description:"Send feedback to Anthropic or report a bug",argsHint:"[report]",source:"builtin"},{name:"focus",description:"Toggle focus view: just your prompt, summary, and response",source:"builtin"},{name:"fork",description:"Spawn a background agent that inherits the full conversation",argsHint:"[<directive>]",source:"builtin"},{name:"goal",description:"Set a goal Claude checks before stopping",argsHint:"[<condition> | clear]",source:"builtin"},{name:"help",description:"Show help and available commands",source:"builtin"},{name:"hooks",description:"View hook configurations for tool events",argsHint:"[name]",source:"builtin"},{name:"ide",description:"Manage IDE integrations and show status",argsHint:"[open]",source:"builtin"},{name:"init",description:"Initialize a CLAUDE.md for this project",source:"builtin",inline:!0},{name:"insights",description:"Generate a report analyzing your Claude Code sessions",source:"builtin",inline:!0},{name:"install",description:"Install Claude Code native build",argsHint:"[options]",source:"builtin"},{name:"install-github-app",description:"Set up Claude GitHub Actions for a repository",source:"builtin"},{name:"install-slack-app",description:"Install the Claude Slack app",source:"builtin"},{name:"keybindings",description:"Open your keyboard shortcuts file",source:"builtin"},{name:"list-agents",description:"List subagents, teammates, and other Claude sessions you can message",source:"builtin"},{name:"login",description:"Sign in with your Anthropic account",source:"builtin"},{name:"logout",description:"Sign out from your Anthropic account",source:"builtin"},{name:"loops",description:"List, create, and delete loops",argsHint:"[name]",source:"builtin"},{name:"mcp",description:"Manage MCP servers",source:"builtin"},{name:"memory",description:"Edit CLAUDE.md files and memory settings",source:"builtin"},{name:"mobile",description:"Show QR code to download the Claude mobile app",source:"builtin"},{name:"model",description:"Set the AI model for Claude Code",argsHint:"[model]",source:"builtin"},{name:"permissions",description:"Manage allow and deny tool permission rules",argsHint:"[open|<description>]",source:"builtin"},{name:"plan",description:"Enable plan mode or view the current session plan",argsHint:"[open|<description>]",source:"builtin"},{name:"plugin",description:"Manage Claude Code plugins",source:"builtin"},{name:"powerup",description:"Discover Claude Code features through quick interactive lessons",argsHint:"[name]",source:"builtin"},{name:"privacy-settings",description:"View and update your privacy settings",source:"builtin"},{name:"radio",description:"Listen to Claude FM lo-fi radio",source:"builtin"},{name:"rate-limit-options",description:"Manage usage limits and upgrade options",source:"builtin"},{name:"recap",description:"Generate a one-line session recap now",source:"builtin"},{name:"release-notes",description:"View release notes",source:"builtin"},{name:"reload-plugins",description:"Activate pending plugin changes in the current session",argsHint:"[--force]",source:"builtin"},{name:"reload-skills",description:"Pick up skills added or changed on disk during this session",source:"builtin"},{name:"rename",description:"Rename the current conversation",argsHint:"[name]",source:"builtin"},{name:"resume",description:"Resume a previous conversation",argsHint:"[conversation id or search term]",source:"builtin"},{name:"rewind",description:"Restore the code and/or conversation to a previous point",source:"builtin"},{name:"scroll-speed",description:"Adjust mouse wheel scroll speed",source:"builtin"},{name:"security-review",description:"Complete a security review of the pending changes on the current branch",source:"builtin"},{name:"skill-doctor",description:"Show which loaded skills are unused and costing context",source:"builtin"},{name:"skills",description:"List available skills",source:"builtin"},{name:"status",description:"Show Claude Code status including version, model, account, API connectivity, and tool statuses",source:"builtin"},{name:"statusline",description:"Set up Claude Code's status line UI",source:"builtin",inline:!0},{name:"stickers",description:"Order Claude Code stickers",source:"builtin"},{name:"stop",description:"Stop this background session; transcript and worktree are kept",source:"builtin"},{name:"subtask",description:"Send a subagent off with your full context; its result comes back here",argsHint:"[<task>]",source:"builtin"},{name:"tasks",description:"View and manage everything running in the background",source:"builtin"},{name:"terminal-setup",description:"Check terminal setup for key bindings like Shift+Enter",source:"builtin"},{name:"theme",description:"Change the theme",source:"builtin"},{name:"tui",description:"Set the terminal UI renderer (default | fullscreen)",argsHint:"[default|fullscreen]",source:"builtin"},{name:"ultraplan",description:"Draft an editable plan in a cloud session",argsHint:"[<prompt>]",source:"builtin"},{name:"ultrareview",description:"Start a cloud agent that finds and verifies bugs in your branch",source:"builtin"},{name:"upgrade",description:"Upgrade to Max for higher rate limits and more Opus",source:"builtin"},{name:"usage",description:"Show session cost, plan usage, and activity stats",source:"builtin"},{name:"usage-credits",description:"Configure usage credits or request them from your admin when you hit a limit",source:"builtin"},{name:"version",description:"Show this session's version (autoupdate may have a newer one)",source:"builtin"},{name:"wellbeing",description:"Configure optional break reminders and quiet-hours nudges",source:"builtin"},{name:"workflows",description:"Browse running and completed workflows",source:"builtin"}];function S(n){const t=/^---\r?\n([\s\S]*?)\r?\n---/.exec(n)?.[1]??"";return/^description:\s*(.+)$/m.exec(t)?.[1]?.trim().replace(/^["']|["']$/g,"")||(n.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/,"").split(`
2
+ `).find(i=>i.trim()!==""&&!i.startsWith("#"))?.trim()??"")}async function C(n){try{const t=await j(n);return t.isDirectory()?"dir":t.isFile()?"file":"other"}catch{return"other"}}async function D(n){try{const t=[];for(const i of await k(n,{withFileTypes:!0})){if(!i.name.endsWith(".md"))continue;const e=c.join(n,i.name);(i.isFile()||i.isSymbolicLink()&&await C(e)==="file")&&t.push(e)}return t}catch{return[]}}async function m(n){try{const t=[];for(const i of await k(n,{withFileTypes:!0})){const e=c.join(n,i.name);(i.isDirectory()||i.isSymbolicLink()&&await C(e)==="dir")&&t.push(e)}return t}catch{return[]}}async function x(n){const t=[],i=async(e,o)=>{for(const s of await D(e)){const r=`${o}${c.basename(s,".md")}`,a=S(await v(s,"utf8").catch(()=>""));t.push({name:r,description:a,source:"command",inline:!0})}for(const s of await m(e))await i(s,`${o}${c.basename(s)}:`)};return await i(n,""),t}async function g(n,t="",i="skill"){const e=[];for(const o of await m(n)){const s=S(await v(c.join(o,"SKILL.md"),"utf8").catch(()=>""));e.push({name:`${t}${c.basename(o)}`,description:s,source:i,inline:!0})}return e}async function E(n){const t=[],i=new Set;for(const e of await m(c.join(n,"plugins","cache")))for(const o of await m(e)){const s=c.basename(o);if(!i.has(s))for(const r of await m(o)){const a=await g(c.join(r,"skills"),`${s}:`,"plugin");if(a.length>0){i.add(s),t.push(...a);break}}}return t}async function P(n){try{const{stdout:t}=await n(["plugin","list","--json"],{timeoutMs:15e3}),i=JSON.parse(t);if(!Array.isArray(i))return null;const e=[];for(const o of i){if(!o||typeof o!="object")continue;const s=o;if(typeof s.id!="string"||typeof s.installPath!="string")continue;const r=s.id.lastIndexOf("@");e.push({plugin:r>0?s.id.slice(0,r):s.id,enabled:s.enabled===!0,installPath:s.installPath})}return e}catch{return null}}async function z(n){const t=await P(n);if(!t)return null;const i=[];for(const e of t)e.enabled&&i.push(...await g(c.join(e.installPath,"skills"),`${e.plugin}:`,"plugin"));return i}function O(n){const t=new Set,i=[];for(const e of n)t.has(e.name)||(t.add(e.name),i.push(e));return i}const F=n=>typeof n=="string"?n:"";function R(n){return/<command-args>([\s\S]*?)<\/command-args>/.exec(n)?.[1]?.trim()??""}const d=new Map,N=64;export async function commandExecutions(n){const t=$(n);if(t===null)return d.delete(n),null;const i=d.get(n);d.delete(n);const e=i??{cur:{offset:0},out:[],pending:null};t<e.cur.offset&&(e.cur.offset=0,e.out=[],e.pending=null);const o=L(n,e.cur,t);if(o===null)return null;const s=e.out;let r=e.pending;for(const a of o){if(!a.includes("<command-")&&!a.includes("<local-command-stdout>")&&!a.includes("<bash-"))continue;let l;try{l=JSON.parse(a)}catch{continue}if(l===null||typeof l!="object")continue;const p=l,u=p.message?.content;if(typeof u!="string")continue;const b=F(p.timestamp),h=/<command-name>([^<]*)<\/command-name>/.exec(u)?.[1]?.trim();if(h?.startsWith("/")){r={name:h.slice(1),args:R(u),at:b};continue}const f=/<bash-input>([\s\S]*?)<\/bash-input>/.exec(u)?.[1];if(f!==void 0){r={name:f.trim(),args:"",at:b,sigil:"!"};continue}const H=/<local-command-stdout>([\s\S]*?)<\/local-command-stdout>/.exec(u)?.[1]??/<bash-stdout>([\s\S]*?)<\/bash-stdout>/.exec(u)?.[1]??"";if(r===null)continue;const w=/<bash-stderr>([\s\S]*?)<\/bash-stderr>/.exec(u)?.[1]?.trim()??"",y=[H.replace(/\u001b\[[0-9;]*m/g,"").trim(),w?`[stderr] ${w}`:""].filter(Boolean).join(`
3
+ `);s.push({...r,...y!==""?{output:y}:{}}),r=null}if(e.pending=r,d.size>=N){const a=d.keys().next().value;a!==void 0&&d.delete(a)}return d.set(n,e),s}const T=6e4,U=16;export function createClaudeCommandSurface(n={}){const t=n.exec??M,i=new Map;return{harness:"claude",inputModes:[{kind:"slash",sigil:"/",named:!0},{kind:"bash",sigil:"!",named:!1}],async list({projectPath:e,homedir:o=A()}){const s=`${e}\0${o}`,r=Date.now(),a=i.get(s);if(a&&r-a.at<T)return a.rows;const l=c.join(o,".claude"),p=O([...I,...await x(c.join(e,".claude","commands")),...await x(c.join(l,"commands")),...await g(c.join(e,".claude","skills")),...await g(c.join(l,"skills")),...await z(t)??await E(l)]);if(i.size>=U){const u=i.keys().next().value;u!==void 0&&i.delete(u)}return i.set(s,{at:r,rows:p}),p},executions:e=>e?commandExecutions(e):Promise.resolve(null)}}export const CLAUDE_COMMANDS=createClaudeCommandSurface();
@@ -1,3 +1,3 @@
1
- import h from"node:fs/promises";import{homedir as m}from"node:os";import p from"node:path";import{CONFIG_SHAPE_OVERRIDES as _}from"./config-shapes.js";import{WEAVE_MARKETPLACE as P}from"./plugins.js";import{CLAUDE_ENV_VARS as R,CLAUDE_SETTINGS_GROUPS as I,CLAUDE_SETTINGS_KEYS as w}from"./settings-catalog.generated.js";import{WEAVE_PERMISSIONS_ALLOW as L,WEAVE_PERMISSIONS_DENY as b,statusLineIsWeave as $}from"./settings-gen.js";const O=2*1024*1024,C="https://api.anthropic.com",H="2023-06-01",U=["$comment","hooks","env.WEAVE_ENABLED"],k=[{id:"user",profiles:!0},{id:"project",profiles:!1},{id:"projectLocal",profiles:!1},{id:"global",profiles:!0}];function A(t,e){switch(t){case"user":return p.join(e.homedir,".claude","settings.json");case"project":return e.projectPath?p.join(e.projectPath,".claude","settings.json"):"";case"projectLocal":return e.projectPath?p.join(e.projectPath,".claude","settings.local.json"):"";case"global":return p.join(e.homedir,".claude.json")}}function v(t){return t==="projectLocal"?"local":t}function g(t){if(t==="global")return w.filter(r=>r.scope==="global");const e=v(t);return w.filter(r=>r.scope==="any"||r.scope===e)}function K(t){return t.map(e=>e.key in _?{...e,..._[e.key]}:e)}function T(t){return new Set(g(t).map(e=>e.key.split(".")[0]))}function u(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function D(t){return t==="__proto__"||t==="constructor"||t==="prototype"}function E(t,e){let r=t;for(const o of e.split(".")){if(!u(r))return;r=r[o]}return r}function j(t,e,r){const o=e.split(".");if(o.some(s=>!s||D(s)))throw new Error(`\u975E\u6CD5\u914D\u7F6E\u952E\uFF1A${e}`);let n=t;for(const s of o.slice(0,-1))u(n[s])||(n[s]={}),n=n[s];n[o[o.length-1]]=r}async function y(t){let e;try{if((await h.stat(t)).size>O)throw new Error(`\u914D\u7F6E\u6587\u4EF6\u8D85\u8FC7 ${O} \u5B57\u8282\uFF1A${t}`);e=await h.readFile(t,"utf8")}catch(n){if(n.code==="ENOENT")return{};throw n}const r=e.replace(/^/,"").trim();if(!r)return{};let o;try{o=JSON.parse(r)}catch{throw new Error(`\u914D\u7F6E\u6587\u4EF6\u4E0D\u662F\u5408\u6CD5 JSON\uFF1A${t}`)}if(!u(o))throw new Error(`\u914D\u7F6E\u6587\u4EF6\u9876\u5C42\u4E0D\u662F\u5BF9\u8C61\uFF1A${t}`);return o}async function S(t,e){await h.mkdir(p.dirname(t),{recursive:!0});const r=`${t}.${process.pid}.${Date.now()}.tmp`;await h.writeFile(r,`${JSON.stringify(e,null,2)}
2
- `,"utf8"),await h.rename(r,t)}function N(t,e){const r=A(t,e);if(!r)throw new Error(`\u914D\u7F6E\u6863\u4F4D ${t} \u9700\u8981\u9879\u76EE\u8DEF\u5F84`);return r}function V(t,e,r){const o=f=>f&&u(f.env)?f.env:{},n=(f,d)=>typeof f[d]=="string"?f[d]:"",s=o(t),a=o(e),i=r.apiKey||n(s,"ANTHROPIC_API_KEY")||(n(s,"ANTHROPIC_AUTH_TOKEN")?"":n(a,"ANTHROPIC_API_KEY")),l=r.authToken||n(s,"ANTHROPIC_AUTH_TOKEN")||(n(s,"ANTHROPIC_API_KEY")?"":n(a,"ANTHROPIC_AUTH_TOKEN"));return i?{header:{"x-api-key":i},credential:"apiKey"}:l?{header:{authorization:`Bearer ${l}`},credential:"authToken"}:{header:{},credential:"none"}}export async function ensureTrustAccepted(t){const e=A("global",{projectPath:null,homedir:m()}),r=await y(e),o=p.resolve(t).replace(/\\/g,"/"),n=u(r.projects)?r.projects:{},s=u(n[o])?n[o]:{};s.hasTrustDialogAccepted!==!0&&(n[o]={...s,hasTrustDialogAccepted:!0},r.projects=n,await S(e,r))}export const CLAUDE_CONFIG={harness:"claude",files(){return k.map(t=>({id:t.id,profiles:t.profiles,path:e=>A(t.id,e)}))},catalog(t){const e=K(g(t));return{groups:I.filter(r=>e.some(o=>o.group===r)),keys:e,envVars:t==="global"?[]:R}},async read(t,e){const r=await y(N(t,e)),o=T(t),n={};for(const s of o)s in r&&j(n,s,r[s]);return n},async write(t,e,r){const o=N(t,e),n=await y(o),s=T(t),a={...n};for(const i of Object.keys(n))s.has(i)&&!(i in r)&&delete a[i];for(const[i,l]of Object.entries(r))s.has(i.split(".")[0])&&j(a,i,l);await S(o,a)},managedKeys(t){const e=U.filter(r=>E(t,r)!==void 0);return t.statusLine!==void 0&&$(t.statusLine)&&e.push("statusLine"),e},managedEntries(t){const e=[];for(const[o,n]of[["permissions.allow",L],["permissions.deny",b]]){const s=E(t,o);if(Array.isArray(s))for(const a of n)s.includes(a)&&e.push({path:o,entry:a})}const r=E(t,"enabledPlugins");if(u(r))for(const o of Object.keys(r))o.endsWith(`@${P}`)&&e.push({path:"enabledPlugins",entry:o});return e},async models(t){const e=u(t.values.env)?t.values.env:{},r=typeof e.ANTHROPIC_BASE_URL=="string"?e.ANTHROPIC_BASE_URL:"",o=t.file&&t.file!=="user"?await y(A("user",{projectPath:null,homedir:t.homedir??m()})):null,n=o&&u(o.env)&&typeof o.env.ANTHROPIC_BASE_URL=="string"?o.env.ANTHROPIC_BASE_URL:"",s=(t.baseUrl||r||n||C).replace(/\/+$/,"").replace(/\/v1$/,""),{header:a,credential:i}=V(t.values,o,t),l=await fetch(`${s}/v1/models?limit=1000`,{headers:{"anthropic-version":H,...a},signal:AbortSignal.timeout(t.timeoutMs??1e4)});if(!l.ok){const c=(await l.text().catch(()=>"")).slice(0,200);throw new Error(`\u6A21\u578B\u5217\u8868\u8BF7\u6C42\u5931\u8D25\uFF1AHTTP ${l.status}${c?` ${c}`:""}`)}const f=await l.json(),d=[];if(Array.isArray(f.data))for(const c of f.data)!u(c)||typeof c.id!="string"||d.push({id:c.id,...typeof c.display_name=="string"?{name:c.display_name}:{},...typeof c.created_at=="string"?{createdAt:c.created_at}:{}});return{models:d,baseUrl:s,credential:i}},rawFormat:"json",parseRaw(t){const e=JSON.parse(t);if(typeof e!="object"||e===null||Array.isArray(e))throw new Error("\u9876\u5C42\u5FC5\u987B\u662F\u5BF9\u8C61");return e},serializeRaw(t){return`${JSON.stringify(t,null,2)}
1
+ import E from"node:fs/promises";import{homedir as y}from"node:os";import f from"node:path";import{CONFIG_SHAPE_OVERRIDES as _}from"./config-shapes.js";import{WEAVE_MARKETPLACE as P}from"./plugins.js";import{CLAUDE_ENV_VARS as C,CLAUDE_SETTINGS_GROUPS as S,CLAUDE_SETTINGS_KEYS as w}from"./settings-catalog.generated.js";import{WEAVE_PERMISSIONS_ALLOW as D,WEAVE_PERMISSIONS_DENY as I,statusLineIsWeave as R}from"./settings-gen.js";const F=2*1024*1024,v="https://api.anthropic.com",$="2023-06-01",L=["$comment","hooks","env.WEAVE_ENABLED"],b=[{id:"user",profiles:!0},{id:"project",profiles:!1},{id:"projectLocal",profiles:!1},{id:"global",profiles:!0}];function A(t,r){switch(t){case"user":return f.join(r.homedir,".claude","settings.json");case"project":return r.projectPath?f.join(r.projectPath,".claude","settings.json"):"";case"projectLocal":return r.projectPath?f.join(r.projectPath,".claude","settings.local.json"):"";case"global":return f.join(r.homedir,".claude.json")}}function H(t){return t==="projectLocal"?"local":t}function g(t){if(t==="global")return w.filter(e=>e.scope==="global");const r=H(t);return w.filter(e=>e.scope==="any"||e.scope===r)}function U(t){return t.map(r=>r.key in _?{...r,..._[r.key]}:r)}function j(t){return new Set(g(t).map(r=>r.key.split(".")[0]))}function c(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function k(t){return t==="__proto__"||t==="constructor"||t==="prototype"}function m(t,r){let e=t;for(const o of r.split(".")){if(!c(e))return;e=e[o]}return e}function N(t,r,e){const o=r.split(".");if(o.some(a=>!a||k(a)))throw new Error(`\u975E\u6CD5\u914D\u7F6E\u952E\uFF1A${r}`);let n=t;for(const a of o.slice(0,-1))c(n[a])||(n[a]={}),n=n[a];n[o[o.length-1]]=e}async function h(t){let r;try{if((await E.stat(t)).size>F)throw new Error(`\u914D\u7F6E\u6587\u4EF6\u8D85\u8FC7 ${F} \u5B57\u8282\uFF1A${t}`);r=await E.readFile(t,"utf8")}catch(n){if(n.code==="ENOENT")return{};throw n}const e=r.replace(/^/,"").trim();if(!e)return{};let o;try{o=JSON.parse(e)}catch{throw new Error(`\u914D\u7F6E\u6587\u4EF6\u4E0D\u662F\u5408\u6CD5 JSON\uFF1A${t}`)}if(!c(o))throw new Error(`\u914D\u7F6E\u6587\u4EF6\u9876\u5C42\u4E0D\u662F\u5BF9\u8C61\uFF1A${t}`);return o}async function O(t,r){await E.mkdir(f.dirname(t),{recursive:!0});const e=`${t}.${process.pid}.${Date.now()}.tmp`;await E.writeFile(e,`${JSON.stringify(r,null,2)}
2
+ `,"utf8"),await E.rename(e,t)}function T(t,r){const e=A(t,r);if(!e)throw new Error(`\u914D\u7F6E\u6863\u4F4D ${t} \u9700\u8981\u9879\u76EE\u8DEF\u5F84`);return e}function B(t,r,e){const o=p=>p&&c(p.env)?p.env:{},n=(p,d)=>typeof p[d]=="string"?p[d]:"",a=o(t),s=o(r),i=e.apiKey||n(a,"ANTHROPIC_API_KEY")||(n(a,"ANTHROPIC_AUTH_TOKEN")?"":n(s,"ANTHROPIC_API_KEY")),l=e.authToken||n(a,"ANTHROPIC_AUTH_TOKEN")||(n(a,"ANTHROPIC_API_KEY")?"":n(s,"ANTHROPIC_AUTH_TOKEN"));return i?{header:{"x-api-key":i},credential:"apiKey"}:l?{header:{authorization:`Bearer ${l}`},credential:"authToken"}:{header:{},credential:"none"}}export async function ensureTrustAccepted(t){const r=A("global",{projectPath:null,homedir:y()}),e=await h(r),o=f.resolve(t).replace(/\\/g,"/"),n=c(e.projects)?e.projects:{},a=c(n[o])?n[o]:{};a.hasTrustDialogAccepted!==!0&&(n[o]={...a,hasTrustDialogAccepted:!0},e.projects=n,await O(r,e))}export const CLAUDE_CONFIG={harness:"claude",files(){return b.map(t=>({id:t.id,profiles:t.profiles,path:r=>A(t.id,r)}))},catalog(t){const r=U(g(t));return{groups:S.filter(e=>r.some(o=>o.group===e)),keys:r,envVars:t==="global"?[]:C}},async read(t,r){const e=await h(T(t,r)),o=j(t),n={};for(const a of o)a in e&&N(n,a,e[a]);return n},async write(t,r,e){const o=T(t,r),n=await h(o),a=j(t),s={...n};for(const i of Object.keys(n))a.has(i)&&!(i in e)&&delete s[i];for(const[i,l]of Object.entries(e))a.has(i.split(".")[0])&&N(s,i,l);await O(o,s)},managedKeys(t){const r=L.filter(e=>m(t,e)!==void 0);return t.statusLine!==void 0&&R(t.statusLine)&&r.push("statusLine"),r},managedEntries(t){const r=[];for(const[o,n]of[["permissions.allow",D],["permissions.deny",I]]){const a=m(t,o);if(Array.isArray(a))for(const s of n)a.includes(s)&&r.push({path:o,entry:s})}const e=m(t,"enabledPlugins");if(c(e))for(const o of Object.keys(e))o.endsWith(`@${P}`)&&r.push({path:"enabledPlugins",entry:o});return r},async models(t){const r=c(t.values.env)?t.values.env:{},e=typeof r.ANTHROPIC_BASE_URL=="string"?r.ANTHROPIC_BASE_URL:"",o=t.file&&t.file!=="user"?await h(A("user",{projectPath:null,homedir:t.homedir??y()})):null,n=o&&c(o.env)&&typeof o.env.ANTHROPIC_BASE_URL=="string"?o.env.ANTHROPIC_BASE_URL:"",a=(t.baseUrl||e||n||v).replace(/\/+$/,"").replace(/\/v1$/,""),{header:s,credential:i}=B(t.values,o,t),l=await fetch(`${a}/v1/models?limit=1000`,{headers:{"anthropic-version":$,...s},signal:AbortSignal.timeout(t.timeoutMs??1e4)});if(!l.ok){const u=(await l.text().catch(()=>"")).slice(0,200);throw new Error(`\u6A21\u578B\u5217\u8868\u8BF7\u6C42\u5931\u8D25\uFF1AHTTP ${l.status}${u?` ${u}`:""}`)}const p=await l.json(),d=[];if(Array.isArray(p.data))for(const u of p.data)!c(u)||typeof u.id!="string"||d.push({id:u.id,...typeof u.display_name=="string"?{name:u.display_name}:{},...typeof u.created_at=="string"?{createdAt:u.created_at}:{}});return{models:d,baseUrl:a,credential:i}},rawFormat:"json",parseRaw(t){const r=JSON.parse(t);if(typeof r!="object"||r===null||Array.isArray(r))throw new Error("\u9876\u5C42\u5FC5\u987B\u662F\u5BF9\u8C61");return r},serializeRaw(t){return`${JSON.stringify(t,null,2)}
3
3
  `}};
@@ -1 +1 @@
1
- import{existsSync as o}from"node:fs";import s from"node:path";const t=[".claude","CLAUDE.md"];function r(e){return t.some(n=>o(s.join(e,n)))}export const CLAUDE_DETECTOR={markers:t,present:r,detect:e=>({harness:"claude",present:r(e)})};
1
+ import{existsSync as o}from"node:fs";import s from"node:path";const r=[".claude","CLAUDE.md"];function t(e){return r.some(n=>o(s.join(e,n)))}export const CLAUDE_DETECTOR={markers:r,present:t,detect:e=>({harness:"claude",present:t(e)})};