@otto-assistant/bridge 0.4.92

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 (483) hide show
  1. package/bin.js +2 -0
  2. package/dist/agent-model.e2e.test.js +755 -0
  3. package/dist/ai-tool-to-genai.js +233 -0
  4. package/dist/ai-tool-to-genai.test.js +267 -0
  5. package/dist/ai-tool.js +6 -0
  6. package/dist/anthropic-auth-plugin.js +728 -0
  7. package/dist/anthropic-auth-plugin.test.js +125 -0
  8. package/dist/anthropic-auth-state.js +231 -0
  9. package/dist/bin.js +90 -0
  10. package/dist/channel-management.js +227 -0
  11. package/dist/cli-parsing.test.js +137 -0
  12. package/dist/cli-send-thread.e2e.test.js +356 -0
  13. package/dist/cli.js +3276 -0
  14. package/dist/commands/abort.js +65 -0
  15. package/dist/commands/action-buttons.js +245 -0
  16. package/dist/commands/add-project.js +113 -0
  17. package/dist/commands/agent.js +335 -0
  18. package/dist/commands/ask-question.js +274 -0
  19. package/dist/commands/btw.js +116 -0
  20. package/dist/commands/compact.js +120 -0
  21. package/dist/commands/context-usage.js +140 -0
  22. package/dist/commands/create-new-project.js +130 -0
  23. package/dist/commands/diff.js +63 -0
  24. package/dist/commands/file-upload.js +275 -0
  25. package/dist/commands/fork.js +220 -0
  26. package/dist/commands/gemini-apikey.js +70 -0
  27. package/dist/commands/login.js +885 -0
  28. package/dist/commands/mcp.js +239 -0
  29. package/dist/commands/memory-snapshot.js +24 -0
  30. package/dist/commands/mention-mode.js +44 -0
  31. package/dist/commands/merge-worktree.js +159 -0
  32. package/dist/commands/model-variant.js +364 -0
  33. package/dist/commands/model.js +776 -0
  34. package/dist/commands/new-worktree.js +366 -0
  35. package/dist/commands/paginated-select.js +57 -0
  36. package/dist/commands/permissions.js +274 -0
  37. package/dist/commands/queue.js +206 -0
  38. package/dist/commands/remove-project.js +115 -0
  39. package/dist/commands/restart-opencode-server.js +127 -0
  40. package/dist/commands/resume.js +149 -0
  41. package/dist/commands/run-command.js +79 -0
  42. package/dist/commands/screenshare.js +303 -0
  43. package/dist/commands/screenshare.test.js +20 -0
  44. package/dist/commands/session-id.js +78 -0
  45. package/dist/commands/session.js +176 -0
  46. package/dist/commands/share.js +80 -0
  47. package/dist/commands/tasks.js +205 -0
  48. package/dist/commands/types.js +2 -0
  49. package/dist/commands/undo-redo.js +305 -0
  50. package/dist/commands/unset-model.js +138 -0
  51. package/dist/commands/upgrade.js +42 -0
  52. package/dist/commands/user-command.js +155 -0
  53. package/dist/commands/verbosity.js +125 -0
  54. package/dist/commands/worktree-settings.js +43 -0
  55. package/dist/commands/worktrees.js +410 -0
  56. package/dist/condense-memory.js +33 -0
  57. package/dist/config.js +94 -0
  58. package/dist/context-awareness-plugin.js +363 -0
  59. package/dist/context-awareness-plugin.test.js +124 -0
  60. package/dist/critique-utils.js +95 -0
  61. package/dist/database.js +1310 -0
  62. package/dist/db.js +251 -0
  63. package/dist/db.test.js +138 -0
  64. package/dist/debounce-timeout.js +28 -0
  65. package/dist/debounced-process-flush.js +77 -0
  66. package/dist/discord-bot.js +1008 -0
  67. package/dist/discord-command-registration.js +524 -0
  68. package/dist/discord-urls.js +81 -0
  69. package/dist/discord-utils.js +591 -0
  70. package/dist/discord-utils.test.js +134 -0
  71. package/dist/errors.js +157 -0
  72. package/dist/escape-backticks.test.js +429 -0
  73. package/dist/event-stream-real-capture.e2e.test.js +533 -0
  74. package/dist/eventsource-parser.test.js +327 -0
  75. package/dist/exec-async.js +26 -0
  76. package/dist/external-opencode-sync.js +480 -0
  77. package/dist/format-tables.js +302 -0
  78. package/dist/format-tables.test.js +308 -0
  79. package/dist/forum-sync/config.js +79 -0
  80. package/dist/forum-sync/discord-operations.js +154 -0
  81. package/dist/forum-sync/index.js +5 -0
  82. package/dist/forum-sync/markdown.js +113 -0
  83. package/dist/forum-sync/sync-to-discord.js +417 -0
  84. package/dist/forum-sync/sync-to-files.js +190 -0
  85. package/dist/forum-sync/types.js +53 -0
  86. package/dist/forum-sync/watchers.js +307 -0
  87. package/dist/gateway-proxy-reconnect.e2e.test.js +394 -0
  88. package/dist/gateway-proxy.e2e.test.js +483 -0
  89. package/dist/genai-worker-wrapper.js +111 -0
  90. package/dist/genai-worker.js +311 -0
  91. package/dist/genai.js +232 -0
  92. package/dist/generated/browser.js +17 -0
  93. package/dist/generated/client.js +37 -0
  94. package/dist/generated/commonInputTypes.js +10 -0
  95. package/dist/generated/enums.js +52 -0
  96. package/dist/generated/internal/class.js +49 -0
  97. package/dist/generated/internal/prismaNamespace.js +253 -0
  98. package/dist/generated/internal/prismaNamespaceBrowser.js +223 -0
  99. package/dist/generated/models/bot_api_keys.js +1 -0
  100. package/dist/generated/models/bot_tokens.js +1 -0
  101. package/dist/generated/models/channel_agents.js +1 -0
  102. package/dist/generated/models/channel_directories.js +1 -0
  103. package/dist/generated/models/channel_mention_mode.js +1 -0
  104. package/dist/generated/models/channel_models.js +1 -0
  105. package/dist/generated/models/channel_verbosity.js +1 -0
  106. package/dist/generated/models/channel_worktrees.js +1 -0
  107. package/dist/generated/models/forum_sync_configs.js +1 -0
  108. package/dist/generated/models/global_models.js +1 -0
  109. package/dist/generated/models/ipc_requests.js +1 -0
  110. package/dist/generated/models/part_messages.js +1 -0
  111. package/dist/generated/models/scheduled_tasks.js +1 -0
  112. package/dist/generated/models/session_agents.js +1 -0
  113. package/dist/generated/models/session_events.js +1 -0
  114. package/dist/generated/models/session_models.js +1 -0
  115. package/dist/generated/models/session_start_sources.js +1 -0
  116. package/dist/generated/models/thread_sessions.js +1 -0
  117. package/dist/generated/models/thread_worktrees.js +1 -0
  118. package/dist/generated/models.js +1 -0
  119. package/dist/heap-monitor.js +122 -0
  120. package/dist/hrana-server.js +263 -0
  121. package/dist/hrana-server.test.js +370 -0
  122. package/dist/html-actions.js +123 -0
  123. package/dist/html-actions.test.js +70 -0
  124. package/dist/html-components.js +117 -0
  125. package/dist/html-components.test.js +34 -0
  126. package/dist/image-optimizer-plugin.js +153 -0
  127. package/dist/image-utils.js +112 -0
  128. package/dist/interaction-handler.js +397 -0
  129. package/dist/ipc-polling.js +252 -0
  130. package/dist/ipc-tools-plugin.js +193 -0
  131. package/dist/kimaki-digital-twin.e2e.test.js +161 -0
  132. package/dist/kimaki-opencode-plugin-loading.e2e.test.js +87 -0
  133. package/dist/kimaki-opencode-plugin.js +17 -0
  134. package/dist/kimaki-opencode-plugin.test.js +98 -0
  135. package/dist/limit-heading-depth.js +25 -0
  136. package/dist/limit-heading-depth.test.js +105 -0
  137. package/dist/logger.js +165 -0
  138. package/dist/markdown.js +342 -0
  139. package/dist/markdown.test.js +257 -0
  140. package/dist/message-finish-field.e2e.test.js +165 -0
  141. package/dist/message-formatting.js +413 -0
  142. package/dist/message-formatting.test.js +73 -0
  143. package/dist/message-preprocessing.js +330 -0
  144. package/dist/onboarding-tutorial.js +172 -0
  145. package/dist/onboarding-welcome.js +37 -0
  146. package/dist/openai-realtime.js +224 -0
  147. package/dist/opencode-command-detection.js +65 -0
  148. package/dist/opencode-command-detection.test.js +240 -0
  149. package/dist/opencode-command.js +129 -0
  150. package/dist/opencode-command.test.js +48 -0
  151. package/dist/opencode-interrupt-plugin.js +361 -0
  152. package/dist/opencode-interrupt-plugin.test.js +458 -0
  153. package/dist/opencode.js +861 -0
  154. package/dist/otto/branding.js +22 -0
  155. package/dist/otto/index.js +21 -0
  156. package/dist/parse-permission-rules.test.js +117 -0
  157. package/dist/patch-text-parser.js +97 -0
  158. package/dist/plugin-logger.js +59 -0
  159. package/dist/privacy-sanitizer.js +105 -0
  160. package/dist/queue-advanced-abort.e2e.test.js +293 -0
  161. package/dist/queue-advanced-action-buttons.e2e.test.js +206 -0
  162. package/dist/queue-advanced-e2e-setup.js +786 -0
  163. package/dist/queue-advanced-footer.e2e.test.js +472 -0
  164. package/dist/queue-advanced-model-switch.e2e.test.js +299 -0
  165. package/dist/queue-advanced-permissions-typing.e2e.test.js +180 -0
  166. package/dist/queue-advanced-question.e2e.test.js +261 -0
  167. package/dist/queue-advanced-typing-interrupt.e2e.test.js +114 -0
  168. package/dist/queue-advanced-typing.e2e.test.js +153 -0
  169. package/dist/queue-drain-after-interactive-ui.e2e.test.js +119 -0
  170. package/dist/queue-interrupt-drain.e2e.test.js +135 -0
  171. package/dist/queue-question-select-drain.e2e.test.js +120 -0
  172. package/dist/runtime-idle-sweeper.js +52 -0
  173. package/dist/runtime-lifecycle.e2e.test.js +508 -0
  174. package/dist/sentry.js +23 -0
  175. package/dist/session-handler/agent-utils.js +67 -0
  176. package/dist/session-handler/event-stream-state.js +420 -0
  177. package/dist/session-handler/event-stream-state.test.js +563 -0
  178. package/dist/session-handler/model-utils.js +124 -0
  179. package/dist/session-handler/opencode-session-event-log.js +94 -0
  180. package/dist/session-handler/thread-runtime-state.js +104 -0
  181. package/dist/session-handler/thread-session-runtime.js +3258 -0
  182. package/dist/session-handler.js +9 -0
  183. package/dist/session-search.js +100 -0
  184. package/dist/session-search.test.js +40 -0
  185. package/dist/session-title-rename.test.js +80 -0
  186. package/dist/startup-service.js +153 -0
  187. package/dist/startup-time.e2e.test.js +296 -0
  188. package/dist/store.js +17 -0
  189. package/dist/system-message.js +613 -0
  190. package/dist/system-message.test.js +602 -0
  191. package/dist/task-runner.js +295 -0
  192. package/dist/task-schedule.js +209 -0
  193. package/dist/task-schedule.test.js +71 -0
  194. package/dist/test-utils.js +299 -0
  195. package/dist/thinking-utils.js +35 -0
  196. package/dist/thread-message-queue.e2e.test.js +999 -0
  197. package/dist/tools.js +357 -0
  198. package/dist/undo-redo.e2e.test.js +161 -0
  199. package/dist/unnest-code-blocks.js +146 -0
  200. package/dist/unnest-code-blocks.test.js +673 -0
  201. package/dist/upgrade.js +114 -0
  202. package/dist/utils.js +144 -0
  203. package/dist/voice-attachment.js +34 -0
  204. package/dist/voice-handler.js +646 -0
  205. package/dist/voice-message.e2e.test.js +1021 -0
  206. package/dist/voice.js +447 -0
  207. package/dist/voice.test.js +235 -0
  208. package/dist/wait-session.js +94 -0
  209. package/dist/websockify.js +69 -0
  210. package/dist/worker-types.js +4 -0
  211. package/dist/worktree-lifecycle.e2e.test.js +308 -0
  212. package/dist/worktree-utils.js +3 -0
  213. package/dist/worktrees.js +929 -0
  214. package/dist/worktrees.test.js +189 -0
  215. package/dist/xml.js +92 -0
  216. package/dist/xml.test.js +32 -0
  217. package/package.json +98 -0
  218. package/schema.prisma +295 -0
  219. package/skills/batch/SKILL.md +87 -0
  220. package/skills/critique/SKILL.md +112 -0
  221. package/skills/egaki/SKILL.md +100 -0
  222. package/skills/errore/SKILL.md +647 -0
  223. package/skills/event-sourcing-state/SKILL.md +252 -0
  224. package/skills/gitchamber/SKILL.md +93 -0
  225. package/skills/goke/SKILL.md +644 -0
  226. package/skills/jitter/EDITOR.md +219 -0
  227. package/skills/jitter/EXPORT-INTERNALS.md +309 -0
  228. package/skills/jitter/SKILL.md +158 -0
  229. package/skills/jitter/jitter-clipboard.json +1042 -0
  230. package/skills/jitter/package.json +14 -0
  231. package/skills/jitter/tsconfig.json +15 -0
  232. package/skills/jitter/utils/actions.ts +212 -0
  233. package/skills/jitter/utils/export.ts +114 -0
  234. package/skills/jitter/utils/index.ts +141 -0
  235. package/skills/jitter/utils/snapshot.ts +154 -0
  236. package/skills/jitter/utils/traverse.ts +246 -0
  237. package/skills/jitter/utils/types.ts +279 -0
  238. package/skills/jitter/utils/wait.ts +133 -0
  239. package/skills/lintcn/SKILL.md +873 -0
  240. package/skills/new-skill/SKILL.md +211 -0
  241. package/skills/npm-package/SKILL.md +239 -0
  242. package/skills/playwriter/SKILL.md +35 -0
  243. package/skills/proxyman/SKILL.md +215 -0
  244. package/skills/security-review/SKILL.md +208 -0
  245. package/skills/simplify/SKILL.md +58 -0
  246. package/skills/spiceflow/SKILL.md +14 -0
  247. package/skills/termcast/SKILL.md +945 -0
  248. package/skills/tuistory/SKILL.md +250 -0
  249. package/skills/usecomputer/SKILL.md +264 -0
  250. package/skills/x-articles/SKILL.md +554 -0
  251. package/skills/zele/SKILL.md +112 -0
  252. package/skills/zustand-centralized-state/SKILL.md +1004 -0
  253. package/src/agent-model.e2e.test.ts +976 -0
  254. package/src/ai-tool-to-genai.test.ts +296 -0
  255. package/src/ai-tool-to-genai.ts +283 -0
  256. package/src/ai-tool.ts +39 -0
  257. package/src/anthropic-auth-plugin.test.ts +159 -0
  258. package/src/anthropic-auth-plugin.ts +861 -0
  259. package/src/anthropic-auth-state.ts +282 -0
  260. package/src/bin.ts +111 -0
  261. package/src/channel-management.ts +334 -0
  262. package/src/cli-parsing.test.ts +195 -0
  263. package/src/cli-send-thread.e2e.test.ts +464 -0
  264. package/src/cli.ts +4581 -0
  265. package/src/commands/abort.ts +89 -0
  266. package/src/commands/action-buttons.ts +364 -0
  267. package/src/commands/add-project.ts +149 -0
  268. package/src/commands/agent.ts +473 -0
  269. package/src/commands/ask-question.ts +390 -0
  270. package/src/commands/btw.ts +164 -0
  271. package/src/commands/compact.ts +157 -0
  272. package/src/commands/context-usage.ts +199 -0
  273. package/src/commands/create-new-project.ts +190 -0
  274. package/src/commands/diff.ts +91 -0
  275. package/src/commands/file-upload.ts +389 -0
  276. package/src/commands/fork.ts +321 -0
  277. package/src/commands/gemini-apikey.ts +104 -0
  278. package/src/commands/login.ts +1173 -0
  279. package/src/commands/mcp.ts +307 -0
  280. package/src/commands/memory-snapshot.ts +30 -0
  281. package/src/commands/mention-mode.ts +68 -0
  282. package/src/commands/merge-worktree.ts +223 -0
  283. package/src/commands/model-variant.ts +483 -0
  284. package/src/commands/model.ts +1053 -0
  285. package/src/commands/new-worktree.ts +510 -0
  286. package/src/commands/paginated-select.ts +81 -0
  287. package/src/commands/permissions.ts +397 -0
  288. package/src/commands/queue.ts +271 -0
  289. package/src/commands/remove-project.ts +155 -0
  290. package/src/commands/restart-opencode-server.ts +162 -0
  291. package/src/commands/resume.ts +230 -0
  292. package/src/commands/run-command.ts +123 -0
  293. package/src/commands/screenshare.test.ts +30 -0
  294. package/src/commands/screenshare.ts +366 -0
  295. package/src/commands/session-id.ts +109 -0
  296. package/src/commands/session.ts +227 -0
  297. package/src/commands/share.ts +106 -0
  298. package/src/commands/tasks.ts +293 -0
  299. package/src/commands/types.ts +25 -0
  300. package/src/commands/undo-redo.ts +386 -0
  301. package/src/commands/unset-model.ts +173 -0
  302. package/src/commands/upgrade.ts +52 -0
  303. package/src/commands/user-command.ts +198 -0
  304. package/src/commands/verbosity.ts +173 -0
  305. package/src/commands/worktree-settings.ts +70 -0
  306. package/src/commands/worktrees.ts +552 -0
  307. package/src/condense-memory.ts +36 -0
  308. package/src/config.ts +111 -0
  309. package/src/context-awareness-plugin.test.ts +142 -0
  310. package/src/context-awareness-plugin.ts +510 -0
  311. package/src/critique-utils.ts +139 -0
  312. package/src/database.ts +1876 -0
  313. package/src/db.test.ts +162 -0
  314. package/src/db.ts +286 -0
  315. package/src/debounce-timeout.ts +43 -0
  316. package/src/debounced-process-flush.ts +104 -0
  317. package/src/discord-bot.ts +1330 -0
  318. package/src/discord-command-registration.ts +693 -0
  319. package/src/discord-urls.ts +88 -0
  320. package/src/discord-utils.test.ts +153 -0
  321. package/src/discord-utils.ts +800 -0
  322. package/src/errors.ts +201 -0
  323. package/src/escape-backticks.test.ts +469 -0
  324. package/src/event-stream-real-capture.e2e.test.ts +692 -0
  325. package/src/eventsource-parser.test.ts +351 -0
  326. package/src/exec-async.ts +35 -0
  327. package/src/external-opencode-sync.ts +685 -0
  328. package/src/format-tables.test.ts +335 -0
  329. package/src/format-tables.ts +445 -0
  330. package/src/forum-sync/config.ts +92 -0
  331. package/src/forum-sync/discord-operations.ts +241 -0
  332. package/src/forum-sync/index.ts +9 -0
  333. package/src/forum-sync/markdown.ts +172 -0
  334. package/src/forum-sync/sync-to-discord.ts +595 -0
  335. package/src/forum-sync/sync-to-files.ts +294 -0
  336. package/src/forum-sync/types.ts +175 -0
  337. package/src/forum-sync/watchers.ts +454 -0
  338. package/src/gateway-proxy-reconnect.e2e.test.ts +523 -0
  339. package/src/gateway-proxy.e2e.test.ts +640 -0
  340. package/src/genai-worker-wrapper.ts +164 -0
  341. package/src/genai-worker.ts +386 -0
  342. package/src/genai.ts +321 -0
  343. package/src/generated/browser.ts +114 -0
  344. package/src/generated/client.ts +138 -0
  345. package/src/generated/commonInputTypes.ts +736 -0
  346. package/src/generated/enums.ts +88 -0
  347. package/src/generated/internal/class.ts +384 -0
  348. package/src/generated/internal/prismaNamespace.ts +2386 -0
  349. package/src/generated/internal/prismaNamespaceBrowser.ts +326 -0
  350. package/src/generated/models/bot_api_keys.ts +1288 -0
  351. package/src/generated/models/bot_tokens.ts +1656 -0
  352. package/src/generated/models/channel_agents.ts +1256 -0
  353. package/src/generated/models/channel_directories.ts +1859 -0
  354. package/src/generated/models/channel_mention_mode.ts +1300 -0
  355. package/src/generated/models/channel_models.ts +1288 -0
  356. package/src/generated/models/channel_verbosity.ts +1228 -0
  357. package/src/generated/models/channel_worktrees.ts +1300 -0
  358. package/src/generated/models/forum_sync_configs.ts +1452 -0
  359. package/src/generated/models/global_models.ts +1288 -0
  360. package/src/generated/models/ipc_requests.ts +1485 -0
  361. package/src/generated/models/part_messages.ts +1302 -0
  362. package/src/generated/models/scheduled_tasks.ts +2320 -0
  363. package/src/generated/models/session_agents.ts +1086 -0
  364. package/src/generated/models/session_events.ts +1439 -0
  365. package/src/generated/models/session_models.ts +1114 -0
  366. package/src/generated/models/session_start_sources.ts +1408 -0
  367. package/src/generated/models/thread_sessions.ts +1781 -0
  368. package/src/generated/models/thread_worktrees.ts +1356 -0
  369. package/src/generated/models.ts +30 -0
  370. package/src/heap-monitor.ts +152 -0
  371. package/src/hrana-server.test.ts +434 -0
  372. package/src/hrana-server.ts +314 -0
  373. package/src/html-actions.test.ts +87 -0
  374. package/src/html-actions.ts +174 -0
  375. package/src/html-components.test.ts +38 -0
  376. package/src/html-components.ts +181 -0
  377. package/src/image-optimizer-plugin.ts +194 -0
  378. package/src/image-utils.ts +149 -0
  379. package/src/interaction-handler.ts +576 -0
  380. package/src/ipc-polling.ts +326 -0
  381. package/src/ipc-tools-plugin.ts +236 -0
  382. package/src/kimaki-digital-twin.e2e.test.ts +199 -0
  383. package/src/kimaki-opencode-plugin-loading.e2e.test.ts +109 -0
  384. package/src/kimaki-opencode-plugin.test.ts +108 -0
  385. package/src/kimaki-opencode-plugin.ts +18 -0
  386. package/src/limit-heading-depth.test.ts +116 -0
  387. package/src/limit-heading-depth.ts +26 -0
  388. package/src/logger.ts +208 -0
  389. package/src/markdown.test.ts +308 -0
  390. package/src/markdown.ts +410 -0
  391. package/src/message-finish-field.e2e.test.ts +192 -0
  392. package/src/message-formatting.test.ts +81 -0
  393. package/src/message-formatting.ts +533 -0
  394. package/src/message-preprocessing.ts +455 -0
  395. package/src/onboarding-tutorial.ts +176 -0
  396. package/src/onboarding-welcome.ts +49 -0
  397. package/src/openai-realtime.ts +358 -0
  398. package/src/opencode-command-detection.test.ts +307 -0
  399. package/src/opencode-command-detection.ts +76 -0
  400. package/src/opencode-command.test.ts +70 -0
  401. package/src/opencode-command.ts +188 -0
  402. package/src/opencode-interrupt-plugin.test.ts +677 -0
  403. package/src/opencode-interrupt-plugin.ts +477 -0
  404. package/src/opencode.ts +1110 -0
  405. package/src/otto/branding.ts +23 -0
  406. package/src/otto/index.ts +22 -0
  407. package/src/parse-permission-rules.test.ts +127 -0
  408. package/src/patch-text-parser.ts +107 -0
  409. package/src/plugin-logger.ts +68 -0
  410. package/src/privacy-sanitizer.ts +142 -0
  411. package/src/queue-advanced-abort.e2e.test.ts +382 -0
  412. package/src/queue-advanced-action-buttons.e2e.test.ts +268 -0
  413. package/src/queue-advanced-e2e-setup.ts +873 -0
  414. package/src/queue-advanced-footer.e2e.test.ts +576 -0
  415. package/src/queue-advanced-model-switch.e2e.test.ts +383 -0
  416. package/src/queue-advanced-permissions-typing.e2e.test.ts +245 -0
  417. package/src/queue-advanced-question.e2e.test.ts +316 -0
  418. package/src/queue-advanced-typing-interrupt.e2e.test.ts +146 -0
  419. package/src/queue-advanced-typing.e2e.test.ts +199 -0
  420. package/src/queue-drain-after-interactive-ui.e2e.test.ts +151 -0
  421. package/src/queue-interrupt-drain.e2e.test.ts +166 -0
  422. package/src/queue-question-select-drain.e2e.test.ts +152 -0
  423. package/src/runtime-idle-sweeper.ts +76 -0
  424. package/src/runtime-lifecycle.e2e.test.ts +641 -0
  425. package/src/schema.sql +173 -0
  426. package/src/sentry.ts +26 -0
  427. package/src/session-handler/agent-utils.ts +97 -0
  428. package/src/session-handler/event-stream-fixtures/real-session-action-buttons.jsonl +45 -0
  429. package/src/session-handler/event-stream-fixtures/real-session-footer-suppressed-on-pre-idle-interrupt.jsonl +40 -0
  430. package/src/session-handler/event-stream-fixtures/real-session-permission-external-file.jsonl +23 -0
  431. package/src/session-handler/event-stream-fixtures/real-session-task-normal.jsonl +22 -0
  432. package/src/session-handler/event-stream-fixtures/real-session-task-three-parallel-sleeps.jsonl +277 -0
  433. package/src/session-handler/event-stream-fixtures/real-session-task-user-interruption.jsonl +46 -0
  434. package/src/session-handler/event-stream-fixtures/session-abort-after-idle-race.jsonl +21 -0
  435. package/src/session-handler/event-stream-fixtures/session-concurrent-messages-serialized.jsonl +56 -0
  436. package/src/session-handler/event-stream-fixtures/session-explicit-abort.jsonl +44 -0
  437. package/src/session-handler/event-stream-fixtures/session-normal-completion.jsonl +29 -0
  438. package/src/session-handler/event-stream-fixtures/session-tool-call-noisy-stream.jsonl +29 -0
  439. package/src/session-handler/event-stream-fixtures/session-two-completions-same-session.jsonl +50 -0
  440. package/src/session-handler/event-stream-fixtures/session-user-interruption.jsonl +59 -0
  441. package/src/session-handler/event-stream-fixtures/session-voice-queued-followup.jsonl +52 -0
  442. package/src/session-handler/event-stream-state.test.ts +645 -0
  443. package/src/session-handler/event-stream-state.ts +608 -0
  444. package/src/session-handler/model-utils.ts +183 -0
  445. package/src/session-handler/opencode-session-event-log.ts +130 -0
  446. package/src/session-handler/thread-runtime-state.ts +212 -0
  447. package/src/session-handler/thread-session-runtime.ts +4281 -0
  448. package/src/session-handler.ts +15 -0
  449. package/src/session-search.test.ts +50 -0
  450. package/src/session-search.ts +148 -0
  451. package/src/session-title-rename.test.ts +112 -0
  452. package/src/startup-service.ts +200 -0
  453. package/src/startup-time.e2e.test.ts +373 -0
  454. package/src/store.ts +122 -0
  455. package/src/system-message.test.ts +612 -0
  456. package/src/system-message.ts +723 -0
  457. package/src/task-runner.ts +421 -0
  458. package/src/task-schedule.test.ts +84 -0
  459. package/src/task-schedule.ts +311 -0
  460. package/src/test-utils.ts +435 -0
  461. package/src/thinking-utils.ts +61 -0
  462. package/src/thread-message-queue.e2e.test.ts +1219 -0
  463. package/src/tools.ts +430 -0
  464. package/src/undici.d.ts +12 -0
  465. package/src/undo-redo.e2e.test.ts +209 -0
  466. package/src/unnest-code-blocks.test.ts +713 -0
  467. package/src/unnest-code-blocks.ts +185 -0
  468. package/src/upgrade.ts +127 -0
  469. package/src/utils.ts +212 -0
  470. package/src/voice-attachment.ts +51 -0
  471. package/src/voice-handler.ts +908 -0
  472. package/src/voice-message.e2e.test.ts +1255 -0
  473. package/src/voice.test.ts +281 -0
  474. package/src/voice.ts +627 -0
  475. package/src/wait-session.ts +147 -0
  476. package/src/websockify.ts +101 -0
  477. package/src/worker-types.ts +64 -0
  478. package/src/worktree-lifecycle.e2e.test.ts +391 -0
  479. package/src/worktree-utils.ts +4 -0
  480. package/src/worktrees.test.ts +223 -0
  481. package/src/worktrees.ts +1294 -0
  482. package/src/xml.test.ts +38 -0
  483. package/src/xml.ts +121 -0
@@ -0,0 +1,211 @@
1
+ ---
2
+ name: new-skill
3
+ description: >
4
+ Best practices for creating a SKILL.md file. Covers file structure,
5
+ frontmatter, writing style, and where to place skills in a repository.
6
+ Use when the user wants to create a new skill, update an existing
7
+ skill, write a SKILL.md, or asks how skills work.
8
+ ---
9
+
10
+ # Creating a SKILL.md
11
+
12
+ A skill is a markdown file that teaches an AI agent a specific workflow, tool, or pattern. Skills are loaded into context when the agent recognizes a task that matches the skill's description.
13
+
14
+ ## File location
15
+
16
+ Place the skill at the root of your repository:
17
+
18
+ ```
19
+ skills/<skill-name>/SKILL.md
20
+ ```
21
+
22
+ For example: `skills/critique/SKILL.md`, `skills/errore/SKILL.md`.
23
+
24
+ The folder name should match the skill name in kebab-case. Each skill gets its own folder so it can include companion files if needed (scripts, templates, references).
25
+
26
+ For personal skills that follow you across all repos and are not meant for distribution in a GitHub repository, place them in:
27
+
28
+ ```
29
+ ~/.opencode/skills/<skill-name>/SKILL.md
30
+ ```
31
+
32
+ Personal skills are only available on your machine. Repository skills are shared with everyone who clones the repo.
33
+
34
+ ## Editing skills synced from other repositories
35
+
36
+ Some projects (like kimaki) sync skills from external GitHub repositories into a local skills folder. If a skill was synced from another repo, **never edit the synced copy**. The synced folder is overwritten on every sync and your changes will be lost.
37
+
38
+ Instead, find the source repository where the skill originates and edit the SKILL.md there. The sync process will pick up the changes on the next run. If you are unsure which repo a skill comes from, check for a sync script (e.g. `scripts/sync-skills.ts`) or a `source-repo` field in the skill's frontmatter.
39
+
40
+ ## Distribution and installation
41
+
42
+ When you publish skills in a GitHub repository, other users can install them with the `skills` CLI:
43
+
44
+ ```bash
45
+ npx skills add owner/repo
46
+ ```
47
+
48
+ This downloads the skills from the repo and symlinks them into the user's agent directories. Add this to your repo's README so users know how to install:
49
+
50
+ ```markdown
51
+ ## Install skill for AI agents
52
+
53
+ \`\`\`bash
54
+ npx -y skills add owner/repo
55
+ \`\`\`
56
+
57
+ This installs [skills](https://skills.sh) for AI coding agents like
58
+ Claude Code, Cursor, Windsurf, and others. Skills teach agents the
59
+ workflows, patterns, and tools specific to this project.
60
+ ```
61
+
62
+ ## Frontmatter
63
+
64
+ Every SKILL.md starts with YAML frontmatter containing two required fields:
65
+
66
+ ```yaml
67
+ ---
68
+ name: skill-name
69
+ description: >
70
+ One to three sentences explaining what this skill does and when to use it.
71
+ Start with a noun or verb phrase. Include trigger conditions so the agent
72
+ knows when to load this skill automatically.
73
+ ---
74
+ ```
75
+
76
+ - **name**: kebab-case identifier matching the folder name
77
+ - **description**: this is the most important field. The agent reads descriptions of all available skills and decides which to load based on this text. Be specific about when the skill applies. Include keywords the user might say.
78
+
79
+ Good description example:
80
+ ```yaml
81
+ description: >
82
+ Git diff viewer. Renders diffs as web pages, images, and PDFs
83
+ with syntax highlighting. Use this skill when working with critique
84
+ for showing diffs, generating diff URLs, or selective hunk staging.
85
+ ```
86
+
87
+ Bad description example:
88
+ ```yaml
89
+ description: A helpful tool for developers.
90
+ ```
91
+
92
+ ## File structure
93
+
94
+ After the frontmatter, write the skill as a normal markdown document. Follow this general structure:
95
+
96
+ ```markdown
97
+ # Skill Title
98
+
99
+ One paragraph explaining what this skill is and why it exists.
100
+
101
+ ## Key section
102
+
103
+ Core rules, commands, or patterns. Use code blocks for commands
104
+ and examples. Use numbered lists for sequential steps.
105
+
106
+ ## Another section
107
+
108
+ More detail, edge cases, gotchas, tips.
109
+ ```
110
+
111
+ There is no rigid template. Structure the content in whatever way communicates the workflow most clearly. Some skills are short (20 lines for a simple CLI tool), others are long (600+ lines for a complex pattern like errore).
112
+
113
+ ## Writing style
114
+
115
+ **Write for an AI agent, not a human.** The reader is a language model that will follow these instructions while helping a user. This changes how you write:
116
+
117
+ - **Be direct and imperative.** Say "Always run `tool --help` first" not "You might want to consider running the help command."
118
+ - **Include concrete commands and code.** The agent needs copy-pasteable examples, not abstract descriptions.
119
+ - **State rules as rules.** Use "Never", "Always", "Must" when something is non-negotiable.
120
+ - **Show the right way, not just the wrong way.** After saying what not to do, immediately show what to do instead.
121
+ - **Use code blocks with language hints.** The agent uses these to generate correct code.
122
+ - **Keep prose short between code blocks.** One or two sentences of explanation, then an example.
123
+ - **Call out common mistakes.** If there is a gotcha the agent will likely hit, warn about it explicitly.
124
+
125
+ ## What makes a good skill
126
+
127
+ A good skill captures **hard-won knowledge** that is not obvious from reading docs or source code alone. Focus on:
128
+
129
+ - **Correct usage patterns** — the commands and code that actually work, not just what the docs say
130
+ - **Gotchas and edge cases** — things that break in subtle ways (e.g. "libsql transaction() with file::memory: silently uses a separate empty database unless you add ?cache=shared")
131
+ - **Opinionated defaults** — when there are multiple ways to do something, state which way to use and why
132
+ - **Integration context** — how this tool fits into the broader workflow (e.g. "Always use critique when showing diffs to Discord users because they cannot see terminal output")
133
+
134
+ A bad skill is just a copy of the tool's README or man page. If the agent could figure it out from `--help`, it does not need a skill for it.
135
+
136
+ ## Skills for CLI tools
137
+
138
+ For CLI tools, put as much documentation as possible into the CLI itself — in command descriptions, option help text, and examples shown by `--help`. The skill file should not duplicate that content. Instead, the skill should instruct the agent to run the help command first:
139
+
140
+ ```markdown
141
+ **Always run `mytool --help` before using this tool.** The help output
142
+ is the source of truth for all commands, options, and examples.
143
+ ```
144
+
145
+ This keeps documentation in one place (the CLI binary) and avoids the skill going stale when the CLI updates.
146
+
147
+ When running help commands, the agent must read the **full untruncated output**. Never pipe help output through `head`, `tail`, `sed -n`, or any command that strips or truncates lines. Agents do this frequently and it causes them to miss critical options and context. The help output exists to be read in full.
148
+
149
+ ## Examples from real skills
150
+
151
+ **Simple CLI tool skill** (gitchamber — 93 lines):
152
+ ```markdown
153
+ ---
154
+ name: gitchamber
155
+ description: CLI to download npm packages, PyPI packages, crates, or GitHub
156
+ repo source code into node_modules/.gitchamber/ for analysis. Use when you
157
+ need to read a package's inner workings, documentation, examples, or source
158
+ code.
159
+ ---
160
+
161
+ # gitchamber
162
+
163
+ CLI to download source code for npm packages, PyPI packages, crates.io
164
+ crates, or GitHub repos into `node_modules/.gitchamber/`.
165
+
166
+ Always run `gitchamber --help` first. The help output has all commands,
167
+ options, and examples.
168
+
169
+ ## Fetch packages
170
+
171
+ \`\`\`bash
172
+ chamber zod
173
+ chamber pypi:requests
174
+ chamber github:owner/repo
175
+ \`\`\`
176
+ ```
177
+
178
+ **Pattern/convention skill** (errore — 647 lines):
179
+ ```markdown
180
+ ---
181
+ name: errore
182
+ description: >
183
+ errore is Go-style error handling for TypeScript: return errors instead
184
+ of throwing them. ALWAYS read this skill when a repo uses the errore
185
+ "errors as values" convention.
186
+ ---
187
+
188
+ # errore
189
+
190
+ Go-style error handling for TypeScript. Functions return errors instead
191
+ of throwing them.
192
+
193
+ ## Rules
194
+
195
+ 1. Always `import * as errore from 'errore'` — namespace import
196
+ 2. Never throw for expected failures — return errors as values
197
+ 3. Use `createTaggedError` for domain errors
198
+ ...
199
+ ```
200
+
201
+ Notice both follow the same pattern: minimal frontmatter, clear title, actionable content with code examples. The simple tool skill is short and focused on commands. The pattern skill is long and focused on rules and conventions.
202
+
203
+ ## Checklist
204
+
205
+ Before saving a new skill:
206
+
207
+ 1. Does the **description** clearly state when to load this skill? Would an agent reading just the description know whether to load it?
208
+ 2. Does the **name** match the folder name?
209
+ 3. Are there **concrete code examples** for the main workflows?
210
+ 4. Did you avoid duplicating content the agent can get from `--help` or standard docs?
211
+ 5. Did you capture the **gotchas** — the things that took trial and error to figure out?
@@ -0,0 +1,239 @@
1
+ ---
2
+ name: npm-package
3
+ description: >
4
+ Opinionated TypeScript npm package template for ESM packages. Enforces
5
+ src→dist builds with tsc, strict TypeScript defaults, explicit exports, and
6
+ publish-safe package metadata. Use this when creating or updating any npm
7
+ package in this repo.
8
+ version: 0.0.1
9
+ ---
10
+
11
+ <!-- Purpose: canonical checklist for TypeScript npm package layout and publish config. -->
12
+
13
+ # npm-package
14
+
15
+ Use this skill when scaffolding or fixing npm packages.
16
+
17
+ ## Package.json rules
18
+
19
+ 1. Always set `"type": "module"`.
20
+ 2. Always fill `"description"`.
21
+ 3. Always include GitHub metadata:
22
+ - `repository` with `type`, `url`, and `directory`
23
+ - `homepage`
24
+ - `bugs`
25
+ 4. Always include meaningful `keywords`.
26
+ 5. Always export `./package.json`.
27
+ 6. Exports structure must include:
28
+ - `"."` for runtime entrypoint (`dist`)
29
+ - `"./src"` and `"./src/*"` pointing to `.ts` source files
30
+ 7. In every export object, put `types` first.
31
+ - For runtime exports (for example `"."`), point `types` to emitted
32
+ declaration files in `dist`.
33
+ - For source exports (`"./src"`, `"./src/*"`), point `types` to source
34
+ files in `src` (not `./dist/*.d.ts`).
35
+ 8. Always include `default` in exports.
36
+ 9. `files` must include at least:
37
+ - `src`
38
+ - `dist`
39
+ - any runtime-required extra files (for example `schema.prisma`)
40
+ - docs like `README.md` and `CHANGELOG.md`
41
+ - if tests are inside src and gets included in dist, it's fine. don't try to exclude them
42
+ 10. `scripts.build` should be `rimraf dist "*.tsbuildinfo" && tsc && chmod +x dist/cli.js` (skip the chmod
43
+ if the package has no bin). No bundling. We remove dist to cleanup old transpiled files. Use `rimraf` here instead of bare shell globs so the script behaves the same in zsh, bash, and Windows shells even when no `.tsbuildinfo` file exists. This also removes the tsc incremental compilation state. Without that tsc would not generate again files to dist.
44
+ Optionally include running scripts with tsx if needed to generate build artifacts.
45
+ 11. `prepublishOnly` must always run `build` (optionally run generation before
46
+ build when required). Always add this script:
47
+ ```json
48
+ { "prepublishOnly": "pnpm build" }
49
+ ```
50
+ This ensures `dist/` is fresh before every `npm publish`.
51
+
52
+ ## bin field
53
+
54
+ Use `bin` as a plain string pointing to the compiled entrypoint, not an object:
55
+
56
+ ```json
57
+ { "bin": "dist/cli.js" }
58
+ ```
59
+
60
+ The bin file must be executable and start with a shebang. After creating or
61
+ building it, always run:
62
+
63
+ ```bash
64
+ chmod +x dist/cli.js
65
+ ```
66
+
67
+ Add the shebang as the first line of the source file (`src/cli.ts`):
68
+
69
+ ```ts
70
+ #!/usr/bin/env node
71
+ ```
72
+
73
+ `tsc` preserves the shebang in the emitted `.js` file. The `chmod +x` is
74
+ already part of the `build` script, so `prepublishOnly: "pnpm build"` handles
75
+ it automatically.
76
+
77
+ ## Reading package version at runtime
78
+
79
+ When Node code needs the package version, prefer reading it from `package.json`
80
+ via `createRequire`. This works cleanly in ESM packages without adding a JSON
81
+ import assertion.
82
+
83
+ ```ts
84
+ import { createRequire } from "node:module";
85
+
86
+ const require = createRequire(import.meta.url);
87
+ const packageJson = require("../package.json") as {
88
+ version: string;
89
+ };
90
+
91
+ export const packageVersion = packageJson.version;
92
+ ```
93
+
94
+ - Use a relative path from the current file to `package.json`.
95
+ - Read only the fields you need, usually `version`.
96
+ - Prefer this over hardcoding the version or duplicating it in source files.
97
+
98
+ ## Resolving paths relative to the package
99
+
100
+ ESM does not have `__dirname`. Derive it from `import.meta.url` with the
101
+ `node:url` and `node:path` modules, then resolve relative paths from there.
102
+
103
+ ```ts
104
+ import url from "node:url";
105
+ import path from "node:path";
106
+
107
+ const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
108
+
109
+ // e.g. from src/cli.ts → read SKILL.md at the package root
110
+ const skillPath = path.resolve(__dirname, "../SKILL.md");
111
+
112
+ // from dist/cli.js (after tsc) → reach back to src/
113
+ const srcFile = path.resolve(__dirname, "../src/template.md");
114
+ ```
115
+
116
+ - Remember that `tsc` compiles `src/` → `dist/`. At runtime the file lives in
117
+ `dist/`, so one `..` gets you back to the package root.
118
+ - From a file in `src/` during dev (running with `tsx`), `..` also reaches the
119
+ package root since `src/` is one level deep.
120
+ - Use `path.resolve(__dirname, ...)` instead of string concatenation so it
121
+ works on all platforms.
122
+
123
+ ## Detecting development mode
124
+
125
+ Check whether `import.meta.url` ends with `.ts` or `.tsx`. In dev you run
126
+ source files directly (via `tsx` or `bun`), so the URL points to a `.ts` file.
127
+ After `tsc` builds to `dist/`, the URL ends with `.js`.
128
+
129
+ ```ts
130
+ const isDev = import.meta.url.endsWith(".ts") || import.meta.url.endsWith(".tsx");
131
+ ```
132
+
133
+ This is useful for conditionally resolving paths that differ between `src/` and
134
+ `dist/`, or enabling dev-only logging without relying on `NODE_ENV`.
135
+
136
+ ## tsconfig rules
137
+
138
+ Use Node ESM-compatible compiler settings:
139
+
140
+ ```json
141
+ {
142
+ "compilerOptions": {
143
+ "allowImportingTsExtensions": true,
144
+ "rewriteRelativeImportExtensions": true,
145
+ "rootDir": "src",
146
+ "outDir": "dist",
147
+ "module": "nodenext",
148
+ "moduleResolution": "nodenext",
149
+ "target": "ESNext",
150
+ "lib": ["ESNext"],
151
+ "declaration": true,
152
+ "declarationMap": true,
153
+ "noEmit": false,
154
+ "strict": true,
155
+ "noUncheckedIndexedAccess": true,
156
+ "skipLibCheck": true,
157
+ "useUnknownInCatchVariables": false
158
+ },
159
+ "include": ["src"]
160
+ }
161
+ ```
162
+
163
+ - Always use "rootDir": "src"
164
+ - Add `"DOM"` to `lib` only when browser globals are needed.
165
+ - Use `.ts` and `.tsx` extensions in source imports. `tsc` rewrites them to
166
+ `.js` in the emitted `dist/` output automatically via
167
+ `rewriteRelativeImportExtensions`. This means source code works directly in
168
+ runtimes like `tsx`, `bun`, and frameworks like Next.js that expect `.ts`
169
+ extensions, while the published `dist/` has correct `.js` imports that Node.js
170
+ and other consumers resolve without issues.
171
+ ```ts
172
+ // source (src/index.ts) — use .ts/.tsx extensions
173
+ import { helper } from './utils.ts'
174
+ import { Button } from './button.tsx'
175
+
176
+ // emitted output (dist/index.js) — tsc rewrites to .js
177
+ // import { helper } from './utils.js'
178
+ // import { Button } from './button.js'
179
+ ```
180
+ - Only relative imports are rewritten. Path aliases (`paths` in tsconfig) are
181
+ not supported by `rewriteRelativeImportExtensions` — this is fine since npm
182
+ packages should use relative imports anyway.
183
+ - Requires TypeScript 5.7+.
184
+ - Install `@types/node` as a dev dependency whenever Node APIs are used.
185
+ - If generation is required, keep generators in `scripts/*.ts` and invoke them
186
+ from package scripts before build/publish.
187
+
188
+ > IMPORTANT! always use rootDir src. if there are other root level folders that should be type checked you should create other tsconfig.json files inside those folder. DO NOT add other folders inside src or the dist/ will contain dist/src, dist/other-folder. which breaks imports. the tsconfig.json inside these other folders can be minimal, using noEmit true, declaration false. Because usually these folders do not need to be emitted or compiled. just type checked. tests should still be put inside src. other folders can be things like `scripts` or `fixtures`.
189
+
190
+ ## Preferred exports template
191
+
192
+ ```json
193
+ {
194
+ "type": "module",
195
+ "main": "./dist/index.js",
196
+ "types": "./dist/index.d.ts",
197
+ "exports": {
198
+ "./package.json": "./package.json",
199
+ ".": {
200
+ "types": "./dist/index.d.ts",
201
+ "default": "./dist/index.js"
202
+ },
203
+ "./src": {
204
+ "types": "./src/index.ts",
205
+ "default": "./src/index.ts"
206
+ },
207
+ "./src/*": {
208
+ "types": "./src/*.ts",
209
+ "default": "./src/*.ts" // or .tsx for packages that export React components. if so all files should end with .tsx
210
+ }
211
+ }
212
+ }
213
+ ```
214
+
215
+
216
+ ## tests location
217
+
218
+ test files should be close with the associated source files. for example if you have an utils.ts file you will create utils.test.ts file next to it. with tests, importing from utils. preferred testing framework is vitest (or bun if project already using `bun test` or depends on bun APIs, rare)
219
+
220
+
221
+ ## .gitignore
222
+
223
+ For non-workspace (standalone) packages, always create a `.gitignore` with:
224
+
225
+ ```
226
+ node_modules
227
+ dist
228
+ *.tsbuildinfo
229
+ .DS_Store
230
+ ```
231
+
232
+ Workspace packages inside a monorepo inherit the root `.gitignore`, so this only applies to standalone packages.
233
+
234
+
235
+ ## common mistakes
236
+
237
+ - if you need to use zod always use latest version
238
+ - always install packages as dev dependencies if used only for scripts, testing or types only
239
+ - if the package uses `rimraf` in scripts, install it as a dev dependency instead of relying on platform-specific shell behavior
@@ -0,0 +1,35 @@
1
+ ---
2
+ name: playwriter
3
+ description: Control the user own Chrome browser via Playwriter extension with Playwright code snippets in a stateful local js sandbox via playwriter cli. Use this over other Playwright MCPs to automate the browser — it connects to the user's existing Chrome instead of launching a new one. Use this for JS-heavy websites (Instagram, Twitter, cookie/login walls, lazy-loaded UIs) instead of webfetch/curl. Run `playwriter skill` command to read the complete up to date skill
4
+ ---
5
+
6
+ ## REQUIRED: Read Full Documentation First
7
+
8
+ **Before using playwriter, you MUST run this command:**
9
+
10
+ ```bash
11
+ playwriter skill # IMPORTANT! do not use | head here. read in full!
12
+ ```
13
+
14
+ This outputs the complete documentation including:
15
+
16
+ - Session management and timeout configuration
17
+ - Selector strategies (and which ones to AVOID)
18
+ - Rules to prevent timeouts and failures
19
+ - Best practices for slow pages and SPAs
20
+ - Context variables, utility functions, and more
21
+
22
+ **Do NOT skip this step.** The quick examples below will fail without understanding timeouts, selector rules, and common pitfalls from the full docs.
23
+
24
+ **Read the ENTIRE output.** Do NOT pipe through `head`, `tail`, or any truncation command. The skill output must be read in its entirety — critical rules about timeouts, selectors, and common pitfalls are spread throughout the document, not just at the top.
25
+
26
+ ## Minimal Example (after reading full docs)
27
+
28
+ ```bash
29
+ playwriter session new
30
+ playwriter -s 1 -e 'await page.goto("https://example.com")'
31
+ ```
32
+
33
+ **Always use single quotes** for the `-e` argument. Single quotes prevent bash from interpreting `$`, backticks, and backslashes inside your JS code. Use double quotes or backtick template literals for strings inside the JS.
34
+
35
+ If `playwriter` is not found, use `npx playwriter@latest` or `bunx playwriter@latest`.
@@ -0,0 +1,215 @@
1
+ ---
2
+ name: proxyman
3
+ description: >
4
+ Reverse-engineer HTTP APIs using Proxyman for macOS. Intercept, record, and export
5
+ network traffic from CLI tools and apps (Node.js, Python, Ruby, Go, curl).
6
+ Export as HAR (JSON) and analyze with jq. Use this skill when the user wants
7
+ to capture, inspect, or reverse-engineer HTTP traffic from macOS applications.
8
+ ---
9
+
10
+ # proxyman — HTTP traffic capture and reverse-engineering
11
+
12
+ Proxyman is a macOS proxy that intercepts HTTP/HTTPS traffic. Use it to
13
+ reverse-engineer APIs: capture what an app sends, inspect headers and bodies,
14
+ and build SDKs or integrations from the captured data.
15
+
16
+ ## Important
17
+
18
+ **Always run `proxyman-cli --help` and `proxyman-cli <subcommand> --help`
19
+ before using.** The help output is the source of truth for all commands and
20
+ options. The CLI binary lives inside the app bundle:
21
+
22
+ ```
23
+ /Applications/Proxyman.app/Contents/MacOS/proxyman-cli
24
+ ```
25
+
26
+ **Proxyman GUI must be running** for the CLI to work. The CLI talks to the
27
+ running app — it does not work standalone or headless.
28
+
29
+ ```bash
30
+ open -a Proxyman
31
+ ```
32
+
33
+ ## Node.js, Python, Ruby, Go, curl do NOT use macOS system proxy
34
+
35
+ This is critical. Even though Proxyman auto-configures macOS system proxy
36
+ settings, **CLI tools and runtimes ignore them**. You must set env vars so
37
+ traffic routes through Proxyman (default port 9090):
38
+
39
+ ```bash
40
+ HTTPS_PROXY=http://127.0.0.1:9090 \
41
+ HTTP_PROXY=http://127.0.0.1:9090 \
42
+ NODE_TLS_REJECT_UNAUTHORIZED=0 \
43
+ <your-command-here>
44
+ ```
45
+
46
+ - `HTTPS_PROXY` / `HTTP_PROXY`: route traffic through Proxyman
47
+ - `NODE_TLS_REJECT_UNAUTHORIZED=0`: accept Proxyman's SSL cert for Node.js apps
48
+ - For Python: `REQUESTS_CA_BUNDLE` or `SSL_CERT_FILE` may be needed instead
49
+ - For curl: use `--proxy http://127.0.0.1:9090 -k` or set the env vars
50
+
51
+ Proxyman also has an "Automatic Setup" feature (Setup menu > Automatic Setup)
52
+ that opens a pre-configured terminal with all env vars set. But for scripting
53
+ and agent use, set the env vars explicitly as shown above.
54
+
55
+ ## CLI reference
56
+
57
+ ```
58
+ proxyman-cli clear-session Clear current captured traffic
59
+ proxyman-cli export-log [options] Export captured traffic to file
60
+ proxyman-cli export [options] Export debug tool rules (Map Local, etc)
61
+ proxyman-cli import --input <file> Import debug tool rules
62
+ proxyman-cli proxy on|off Toggle macOS system HTTP proxy
63
+ proxyman-cli breakpoint enable|disable Toggle Breakpoint tool
64
+ proxyman-cli maplocal enable|disable Toggle Map Local tool
65
+ proxyman-cli scripting enable|disable Toggle Scripting tool
66
+ proxyman-cli install-root-cert <file> Install custom root cert (requires sudo)
67
+ ```
68
+
69
+ ### export-log options
70
+
71
+ ```
72
+ -m, --mode <mode> all | domains (default: all)
73
+ -o, --output <path> Output file path (required)
74
+ -d, --domains <domain> Filter by domain (repeatable, only with -m domains)
75
+ -f, --format <format> proxymansession | har | raw (default: proxymansession)
76
+ ```
77
+
78
+ **Always use `-f har`** for agent workflows. HAR is JSON and works with jq.
79
+
80
+ ### export-log timing bug
81
+
82
+ The CLI can report "Exported Completed!" before the file is actually written.
83
+ Add `sleep 3` after export-log before reading the file:
84
+
85
+ ```bash
86
+ proxyman-cli export-log -m all -o capture.har -f har
87
+ sleep 3
88
+ jq '.log.entries | length' capture.har
89
+ ```
90
+
91
+ ## Reverse-engineering workflow
92
+
93
+ This is the primary use case. Example: figuring out how Claude Code talks to
94
+ the Anthropic API.
95
+
96
+ ```bash
97
+ # 1. Make sure Proxyman is running
98
+ open -a Proxyman
99
+
100
+ # 2. Clear previous traffic
101
+ proxyman-cli clear-session
102
+
103
+ # 3. Run the target app through the proxy
104
+ HTTPS_PROXY=http://127.0.0.1:9090 \
105
+ HTTP_PROXY=http://127.0.0.1:9090 \
106
+ NODE_TLS_REJECT_UNAUTHORIZED=0 \
107
+ claude -p "say hi" --max-turns 1
108
+
109
+ # 4. Export captured traffic as HAR
110
+ proxyman-cli export-log -m all -o capture.har -f har
111
+ sleep 3
112
+
113
+ # 5. Filter for the domain you care about
114
+ jq '[.log.entries[] | select(.request.url | test("anthropic"))]' capture.har
115
+ ```
116
+
117
+ ## Analyzing HAR files with jq
118
+
119
+ ### List all domains and request counts
120
+
121
+ ```bash
122
+ jq '[.log.entries[].request.url] | map(split("/")[2])
123
+ | group_by(.) | map({domain: .[0], count: length})
124
+ | sort_by(-.count)' capture.har
125
+ ```
126
+
127
+ ### Filter by domain
128
+
129
+ ```bash
130
+ jq '.log.entries[] | select(.request.url | test("api.example.com"))' capture.har
131
+ ```
132
+
133
+ ### Request summary (method, url, status)
134
+
135
+ ```bash
136
+ jq '[.log.entries[] | select(.request.url | test("api.example.com")) | {
137
+ method: .request.method,
138
+ url: .request.url,
139
+ status: .response.status
140
+ }]' capture.har
141
+ ```
142
+
143
+ ### Full request details (headers + body)
144
+
145
+ ```bash
146
+ jq '.log.entries[] | select(.request.url | test("v1/messages")) | {
147
+ url: .request.url,
148
+ method: .request.method,
149
+ status: .response.status,
150
+ request_headers: [.request.headers[] | {(.name): .value}] | add,
151
+ request_body: (.request.postData.text | fromjson? // .request.postData.text),
152
+ response_body: (.response.content.text | fromjson? // .response.content.text)
153
+ }' capture.har
154
+ ```
155
+
156
+ ### Request body structure (without full content)
157
+
158
+ Useful for large payloads — see the shape without the bulk:
159
+
160
+ ```bash
161
+ jq '.log.entries[] | select(.request.url | test("v1/messages"))
162
+ | .request.postData.text | fromjson
163
+ | {model, max_tokens, stream,
164
+ system_count: (.system | length),
165
+ messages_count: (.messages | length),
166
+ tools_count: (.tools | length),
167
+ messages: [.messages[] | {role, content_type: (.content | type)}]
168
+ }' capture.har
169
+ ```
170
+
171
+ ### Extract specific headers
172
+
173
+ ```bash
174
+ jq '.log.entries[] | select(.request.url | test("api.example.com"))
175
+ | {url: .request.url, auth: (.request.headers[] | select(.name == "authorization") | .value)}' capture.har
176
+ ```
177
+
178
+ ### Only failed requests
179
+
180
+ ```bash
181
+ jq '[.log.entries[] | select(.response.status >= 400) | {
182
+ url: .request.url,
183
+ status: .response.status,
184
+ error: .response.content.text
185
+ }]' capture.har
186
+ ```
187
+
188
+ ## Domain-filtered export
189
+
190
+ If you only care about one domain, filter at export time to get a smaller file:
191
+
192
+ ```bash
193
+ proxyman-cli export-log -m domains --domains 'api.anthropic.com' -o anthropic.har -f har
194
+ ```
195
+
196
+ Multiple domains:
197
+
198
+ ```bash
199
+ proxyman-cli export-log -m domains \
200
+ --domains 'api.anthropic.com' \
201
+ --domains 'mcp-proxy.anthropic.com' \
202
+ -o anthropic.har -f har
203
+ ```
204
+
205
+ ## SSL proxying
206
+
207
+ Proxyman needs to decrypt HTTPS to see request/response bodies. For Node.js
208
+ apps, `NODE_TLS_REJECT_UNAUTHORIZED=0` handles this. For system apps and
209
+ browsers, install and trust the Proxyman root certificate:
210
+
211
+ - Proxyman menu > Certificate > Install Certificate on this Mac
212
+ - Or via CLI: `proxyman-cli install-root-cert <path-to-cert>`
213
+
214
+ Without SSL proxying enabled for a domain, you'll see the connection but not
215
+ the decrypted body content.