@phnx-labs/agents-cli 0.1.0 → 1.14.1

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 (554) hide show
  1. package/CHANGELOG.md +7 -1
  2. package/README.md +283 -372
  3. package/dist/commands/alias.d.ts +11 -0
  4. package/dist/commands/alias.js +117 -0
  5. package/dist/commands/beta.d.ts +2 -0
  6. package/dist/commands/beta.js +53 -0
  7. package/dist/commands/cloud.d.ts +8 -1
  8. package/dist/commands/cloud.js +108 -22
  9. package/dist/commands/commands.d.ts +9 -1
  10. package/dist/commands/commands.js +24 -172
  11. package/dist/commands/daemon.d.ts +8 -1
  12. package/dist/commands/daemon.js +13 -5
  13. package/dist/commands/doctor.d.ts +15 -0
  14. package/dist/commands/doctor.js +132 -0
  15. package/dist/commands/drive.d.ts +8 -1
  16. package/dist/commands/drive.js +20 -3
  17. package/dist/commands/exec.d.ts +8 -1
  18. package/dist/commands/exec.js +96 -27
  19. package/dist/commands/factory.d.ts +19 -0
  20. package/dist/commands/factory.js +71 -0
  21. package/dist/commands/fork.d.ts +8 -1
  22. package/dist/commands/fork.js +11 -4
  23. package/dist/commands/hooks.d.ts +9 -1
  24. package/dist/commands/hooks.js +30 -182
  25. package/dist/commands/init.d.ts +15 -1
  26. package/dist/commands/init.js +168 -74
  27. package/dist/commands/mcp.d.ts +9 -1
  28. package/dist/commands/mcp.js +11 -7
  29. package/dist/commands/models.d.ts +8 -1
  30. package/dist/commands/models.js +16 -4
  31. package/dist/commands/packages.d.ts +8 -1
  32. package/dist/commands/packages.js +13 -7
  33. package/dist/commands/permissions.d.ts +9 -1
  34. package/dist/commands/permissions.js +3 -3
  35. package/dist/commands/plugins.d.ts +8 -1
  36. package/dist/commands/plugins.js +13 -2
  37. package/dist/commands/profiles.d.ts +9 -1
  38. package/dist/commands/profiles.js +56 -7
  39. package/dist/commands/prune.d.ts +22 -0
  40. package/dist/commands/prune.js +191 -0
  41. package/dist/commands/pty.d.ts +1 -1
  42. package/dist/commands/pty.js +2 -1
  43. package/dist/commands/pull.d.ts +8 -1
  44. package/dist/commands/pull.js +58 -128
  45. package/dist/commands/refresh-memory.d.ts +7 -1
  46. package/dist/commands/refresh-memory.js +7 -1
  47. package/dist/commands/repo.d.ts +15 -0
  48. package/dist/commands/repo.js +570 -0
  49. package/dist/commands/resource-view.d.ts +10 -3
  50. package/dist/commands/resource-view.js +18 -5
  51. package/dist/commands/routines.d.ts +8 -1
  52. package/dist/commands/routines.js +17 -4
  53. package/dist/commands/rules.d.ts +9 -1
  54. package/dist/commands/rules.js +16 -11
  55. package/dist/commands/secrets.d.ts +8 -1
  56. package/dist/commands/secrets.js +235 -63
  57. package/dist/commands/sessions-picker.d.ts +2 -1
  58. package/dist/commands/sessions-picker.js +88 -11
  59. package/dist/commands/sessions-tail.d.ts +19 -0
  60. package/dist/commands/sessions-tail.js +235 -0
  61. package/dist/commands/sessions.d.ts +2 -1
  62. package/dist/commands/sessions.js +188 -7
  63. package/dist/commands/skills.d.ts +9 -1
  64. package/dist/commands/skills.js +28 -178
  65. package/dist/commands/status.d.ts +7 -1
  66. package/dist/commands/status.js +7 -1
  67. package/dist/commands/subagents.d.ts +8 -1
  68. package/dist/commands/subagents.js +11 -1
  69. package/dist/commands/sync.d.ts +8 -1
  70. package/dist/commands/sync.js +8 -1
  71. package/dist/commands/teams-picker.d.ts +4 -1
  72. package/dist/commands/teams-picker.js +55 -3
  73. package/dist/commands/teams.d.ts +15 -1
  74. package/dist/commands/teams.js +323 -69
  75. package/dist/commands/usage.d.ts +11 -0
  76. package/dist/commands/usage.js +60 -0
  77. package/dist/commands/utils.d.ts +6 -1
  78. package/dist/commands/utils.js +6 -1
  79. package/dist/commands/versions.d.ts +8 -1
  80. package/dist/commands/versions.js +4 -3
  81. package/dist/commands/view.d.ts +47 -2
  82. package/dist/commands/view.js +317 -24
  83. package/dist/index.d.ts +7 -2
  84. package/dist/index.js +172 -34
  85. package/dist/lib/acp/client.d.ts +31 -0
  86. package/dist/lib/acp/client.js +117 -0
  87. package/dist/lib/acp/harnesses.d.ts +26 -0
  88. package/dist/lib/acp/harnesses.js +65 -0
  89. package/dist/lib/acp/run.d.ts +18 -0
  90. package/dist/lib/acp/run.js +39 -0
  91. package/dist/lib/agents.d.ts +74 -2
  92. package/dist/lib/agents.js +197 -21
  93. package/dist/lib/artifact-actions.d.ts +8 -4
  94. package/dist/lib/artifact-actions.js +8 -6
  95. package/dist/lib/auto-pull-worker.d.ts +11 -0
  96. package/dist/lib/auto-pull-worker.js +121 -0
  97. package/dist/lib/auto-pull.d.ts +31 -0
  98. package/dist/lib/auto-pull.js +97 -0
  99. package/dist/lib/beta.d.ts +23 -0
  100. package/dist/lib/beta.js +90 -0
  101. package/dist/lib/capabilities.d.ts +29 -0
  102. package/dist/lib/capabilities.js +74 -0
  103. package/dist/lib/cloud/codex.d.ts +9 -3
  104. package/dist/lib/cloud/codex.js +53 -13
  105. package/dist/lib/cloud/factory.d.ts +8 -3
  106. package/dist/lib/cloud/factory.js +19 -3
  107. package/dist/lib/cloud/registry.d.ts +10 -1
  108. package/dist/lib/cloud/registry.js +14 -3
  109. package/dist/lib/cloud/rush.d.ts +63 -3
  110. package/dist/lib/cloud/rush.js +273 -20
  111. package/dist/lib/cloud/store.d.ts +13 -1
  112. package/dist/lib/cloud/store.js +23 -4
  113. package/dist/lib/cloud/stream.d.ts +6 -1
  114. package/dist/lib/cloud/stream.js +95 -39
  115. package/dist/lib/cloud/types.d.ts +153 -8
  116. package/dist/lib/cloud/types.js +34 -2
  117. package/dist/lib/command-skills.d.ts +20 -0
  118. package/dist/lib/command-skills.js +142 -0
  119. package/dist/lib/commands.d.ts +22 -2
  120. package/dist/lib/commands.js +51 -11
  121. package/dist/lib/convert.d.ts +10 -1
  122. package/dist/lib/convert.js +9 -1
  123. package/dist/lib/daemon.d.ts +21 -1
  124. package/dist/lib/daemon.js +97 -4
  125. package/dist/lib/drive-sync.d.ts +18 -1
  126. package/dist/lib/drive-sync.js +57 -15
  127. package/dist/lib/exec.d.ts +23 -6
  128. package/dist/lib/exec.js +53 -17
  129. package/dist/lib/fs-walk.d.ts +2 -0
  130. package/dist/lib/fs-walk.js +40 -0
  131. package/dist/lib/fuzzy.d.ts +53 -0
  132. package/dist/lib/fuzzy.js +72 -0
  133. package/dist/lib/gemini-settings.d.ts +4 -0
  134. package/dist/lib/gemini-settings.js +33 -0
  135. package/dist/lib/git.d.ts +12 -2
  136. package/dist/lib/git.js +17 -6
  137. package/dist/lib/help.d.ts +20 -1
  138. package/dist/lib/help.js +45 -6
  139. package/dist/lib/hooks/match.d.ts +32 -0
  140. package/dist/lib/hooks/match.js +120 -0
  141. package/dist/lib/hooks.d.ts +17 -4
  142. package/dist/lib/hooks.js +119 -101
  143. package/dist/lib/manifest.d.ts +6 -1
  144. package/dist/lib/manifest.js +15 -4
  145. package/dist/lib/markdown.d.ts +0 -1
  146. package/dist/lib/markdown.js +6 -1
  147. package/dist/lib/mcp.d.ts +0 -1
  148. package/dist/lib/mcp.js +29 -33
  149. package/dist/lib/memory-compile.d.ts +13 -3
  150. package/dist/lib/memory-compile.js +31 -9
  151. package/dist/lib/memory.d.ts +14 -7
  152. package/dist/lib/memory.js +67 -38
  153. package/dist/lib/migrate.d.ts +8 -0
  154. package/dist/lib/migrate.js +85 -0
  155. package/dist/lib/models.d.ts +10 -4
  156. package/dist/lib/models.js +36 -15
  157. package/dist/lib/onepassword.d.ts +63 -0
  158. package/dist/lib/onepassword.js +186 -0
  159. package/dist/lib/paths.d.ts +8 -0
  160. package/dist/lib/paths.js +20 -0
  161. package/dist/lib/permissions.d.ts +24 -2
  162. package/dist/lib/permissions.js +117 -48
  163. package/dist/lib/picker.d.ts +10 -1
  164. package/dist/lib/picker.js +15 -1
  165. package/dist/lib/plugins.d.ts +7 -1
  166. package/dist/lib/plugins.js +10 -1
  167. package/dist/lib/profiles-presets.d.ts +10 -1
  168. package/dist/lib/profiles-presets.js +9 -1
  169. package/dist/lib/profiles.d.ts +35 -1
  170. package/dist/lib/profiles.js +36 -15
  171. package/dist/lib/pty-client.d.ts +1 -1
  172. package/dist/lib/pty-client.js +0 -1
  173. package/dist/lib/pty-server.d.ts +16 -2
  174. package/dist/lib/pty-server.js +92 -3
  175. package/dist/lib/registry.d.ts +23 -3
  176. package/dist/lib/registry.js +153 -8
  177. package/dist/lib/resources.d.ts +28 -1
  178. package/dist/lib/resources.js +79 -1
  179. package/dist/lib/rotate.d.ts +40 -13
  180. package/dist/lib/rotate.js +238 -40
  181. package/dist/lib/routines.d.ts +29 -1
  182. package/dist/lib/routines.js +32 -5
  183. package/dist/lib/runner.d.ts +14 -1
  184. package/dist/lib/runner.js +22 -3
  185. package/dist/lib/sandbox.d.ts +16 -1
  186. package/dist/lib/sandbox.js +39 -16
  187. package/dist/lib/scheduler.d.ts +8 -1
  188. package/dist/lib/scheduler.js +8 -1
  189. package/dist/lib/secrets/AgentsKeychain.app/Contents/CodeResources +0 -0
  190. package/dist/lib/secrets/AgentsKeychain.app/Contents/Info.plist +22 -0
  191. package/dist/lib/secrets/AgentsKeychain.app/Contents/MacOS/AgentsKeychain +0 -0
  192. package/dist/lib/secrets/AgentsKeychain.app/Contents/_CodeSignature/CodeResources +123 -0
  193. package/dist/lib/secrets/AgentsKeychain.app/Contents/embedded.provisionprofile +0 -0
  194. package/dist/lib/{secrets-bundles.d.ts → secrets/bundles.d.ts} +12 -2
  195. package/dist/lib/{secrets-bundles.js → secrets/bundles.js} +38 -17
  196. package/dist/lib/secrets/index.d.ts +55 -0
  197. package/dist/lib/secrets/index.js +211 -0
  198. package/dist/lib/secrets/profiles.d.ts +10 -0
  199. package/dist/lib/secrets/profiles.js +13 -0
  200. package/dist/lib/session/active.d.ts +43 -0
  201. package/dist/lib/session/active.js +392 -0
  202. package/dist/lib/session/artifacts.d.ts +12 -1
  203. package/dist/lib/session/artifacts.js +25 -5
  204. package/dist/lib/session/cloud.d.ts +30 -0
  205. package/dist/lib/session/cloud.js +121 -0
  206. package/dist/lib/session/db.d.ts +23 -2
  207. package/dist/lib/session/db.js +76 -12
  208. package/dist/lib/session/discover.d.ts +19 -4
  209. package/dist/lib/session/discover.js +344 -48
  210. package/dist/lib/session/parse.d.ts +28 -1
  211. package/dist/lib/session/parse.js +267 -9
  212. package/dist/lib/session/prompt.d.ts +9 -1
  213. package/dist/lib/session/prompt.js +17 -3
  214. package/dist/lib/session/render.d.ts +13 -1
  215. package/dist/lib/session/render.js +20 -1
  216. package/dist/lib/session/team-filter.d.ts +9 -1
  217. package/dist/lib/session/team-filter.js +11 -2
  218. package/dist/lib/session/types.d.ts +16 -2
  219. package/dist/lib/session/types.js +10 -2
  220. package/dist/lib/shims.d.ts +64 -5
  221. package/dist/lib/shims.js +309 -47
  222. package/dist/lib/skills.d.ts +27 -2
  223. package/dist/lib/skills.js +127 -65
  224. package/dist/lib/sqlite.d.ts +43 -0
  225. package/dist/lib/sqlite.js +94 -0
  226. package/dist/lib/state.d.ts +112 -27
  227. package/dist/lib/state.js +320 -148
  228. package/dist/lib/subagents.d.ts +9 -1
  229. package/dist/lib/subagents.js +70 -63
  230. package/dist/lib/sync-manifest.d.ts +81 -0
  231. package/dist/lib/sync-manifest.js +450 -0
  232. package/dist/lib/teams/agents.d.ts +103 -5
  233. package/dist/lib/teams/agents.js +414 -91
  234. package/dist/lib/teams/api.d.ts +26 -3
  235. package/dist/lib/teams/api.js +63 -3
  236. package/dist/lib/teams/debug.d.ts +6 -1
  237. package/dist/lib/teams/debug.js +6 -1
  238. package/dist/lib/teams/file_ops.d.ts +7 -1
  239. package/dist/lib/teams/file_ops.js +7 -1
  240. package/dist/lib/teams/index.d.ts +15 -0
  241. package/dist/lib/teams/index.js +14 -0
  242. package/dist/lib/teams/parsers.d.ts +4 -1
  243. package/dist/lib/teams/parsers.js +11 -1
  244. package/dist/lib/teams/persistence.d.ts +15 -1
  245. package/dist/lib/teams/persistence.js +102 -20
  246. package/dist/lib/teams/registry.d.ts +12 -1
  247. package/dist/lib/teams/registry.js +116 -33
  248. package/dist/lib/teams/summarizer.d.ts +15 -1
  249. package/dist/lib/teams/summarizer.js +14 -1
  250. package/dist/lib/teams/supervisor.d.ts +48 -0
  251. package/dist/lib/teams/supervisor.js +73 -0
  252. package/dist/lib/template.d.ts +8 -6
  253. package/dist/lib/template.js +8 -6
  254. package/dist/lib/types.d.ts +147 -8
  255. package/dist/lib/types.js +26 -3
  256. package/dist/lib/usage.d.ts +32 -1
  257. package/dist/lib/usage.js +70 -6
  258. package/dist/lib/version-duplicates.d.ts +21 -0
  259. package/dist/lib/version-duplicates.js +90 -0
  260. package/dist/lib/versions.d.ts +33 -4
  261. package/dist/lib/versions.js +376 -108
  262. package/package.json +32 -17
  263. package/scripts/postinstall.js +126 -30
  264. package/dist/commands/__tests__/sessions.test.d.ts +0 -2
  265. package/dist/commands/__tests__/sessions.test.d.ts.map +0 -1
  266. package/dist/commands/__tests__/sessions.test.js +0 -636
  267. package/dist/commands/__tests__/sessions.test.js.map +0 -1
  268. package/dist/commands/cloud.d.ts.map +0 -1
  269. package/dist/commands/cloud.js.map +0 -1
  270. package/dist/commands/commands.d.ts.map +0 -1
  271. package/dist/commands/commands.js.map +0 -1
  272. package/dist/commands/daemon.d.ts.map +0 -1
  273. package/dist/commands/daemon.js.map +0 -1
  274. package/dist/commands/drive.d.ts.map +0 -1
  275. package/dist/commands/drive.js.map +0 -1
  276. package/dist/commands/exec.d.ts.map +0 -1
  277. package/dist/commands/exec.js.map +0 -1
  278. package/dist/commands/fork.d.ts.map +0 -1
  279. package/dist/commands/fork.js.map +0 -1
  280. package/dist/commands/hooks.d.ts.map +0 -1
  281. package/dist/commands/hooks.js.map +0 -1
  282. package/dist/commands/init.d.ts.map +0 -1
  283. package/dist/commands/init.js.map +0 -1
  284. package/dist/commands/mcp.d.ts.map +0 -1
  285. package/dist/commands/mcp.js.map +0 -1
  286. package/dist/commands/models.d.ts.map +0 -1
  287. package/dist/commands/models.js.map +0 -1
  288. package/dist/commands/packages.d.ts.map +0 -1
  289. package/dist/commands/packages.js.map +0 -1
  290. package/dist/commands/permissions.d.ts.map +0 -1
  291. package/dist/commands/permissions.js.map +0 -1
  292. package/dist/commands/plugins.d.ts.map +0 -1
  293. package/dist/commands/plugins.js.map +0 -1
  294. package/dist/commands/profiles.d.ts.map +0 -1
  295. package/dist/commands/profiles.js.map +0 -1
  296. package/dist/commands/pty.d.ts.map +0 -1
  297. package/dist/commands/pty.js.map +0 -1
  298. package/dist/commands/pull.d.ts.map +0 -1
  299. package/dist/commands/pull.js.map +0 -1
  300. package/dist/commands/push.d.ts +0 -3
  301. package/dist/commands/push.d.ts.map +0 -1
  302. package/dist/commands/push.js +0 -180
  303. package/dist/commands/push.js.map +0 -1
  304. package/dist/commands/refresh-memory.d.ts.map +0 -1
  305. package/dist/commands/refresh-memory.js.map +0 -1
  306. package/dist/commands/resource-view.d.ts.map +0 -1
  307. package/dist/commands/resource-view.js.map +0 -1
  308. package/dist/commands/routines.d.ts.map +0 -1
  309. package/dist/commands/routines.js.map +0 -1
  310. package/dist/commands/rules.d.ts.map +0 -1
  311. package/dist/commands/rules.js.map +0 -1
  312. package/dist/commands/secrets.d.ts.map +0 -1
  313. package/dist/commands/secrets.js.map +0 -1
  314. package/dist/commands/sessions-picker.d.ts.map +0 -1
  315. package/dist/commands/sessions-picker.js.map +0 -1
  316. package/dist/commands/sessions.d.ts.map +0 -1
  317. package/dist/commands/sessions.js.map +0 -1
  318. package/dist/commands/skills.d.ts.map +0 -1
  319. package/dist/commands/skills.js.map +0 -1
  320. package/dist/commands/status.d.ts.map +0 -1
  321. package/dist/commands/status.js.map +0 -1
  322. package/dist/commands/subagents.d.ts.map +0 -1
  323. package/dist/commands/subagents.js.map +0 -1
  324. package/dist/commands/sync.d.ts.map +0 -1
  325. package/dist/commands/sync.js.map +0 -1
  326. package/dist/commands/teams-picker.d.ts.map +0 -1
  327. package/dist/commands/teams-picker.js.map +0 -1
  328. package/dist/commands/teams.d.ts.map +0 -1
  329. package/dist/commands/teams.js.map +0 -1
  330. package/dist/commands/utils.d.ts.map +0 -1
  331. package/dist/commands/utils.js.map +0 -1
  332. package/dist/commands/versions.d.ts.map +0 -1
  333. package/dist/commands/versions.js.map +0 -1
  334. package/dist/commands/view.d.ts.map +0 -1
  335. package/dist/commands/view.js.map +0 -1
  336. package/dist/index.d.ts.map +0 -1
  337. package/dist/index.js.map +0 -1
  338. package/dist/lib/__tests__/bugfixes.test.d.ts +0 -2
  339. package/dist/lib/__tests__/bugfixes.test.d.ts.map +0 -1
  340. package/dist/lib/__tests__/bugfixes.test.js +0 -192
  341. package/dist/lib/__tests__/bugfixes.test.js.map +0 -1
  342. package/dist/lib/__tests__/exec.test.d.ts +0 -2
  343. package/dist/lib/__tests__/exec.test.d.ts.map +0 -1
  344. package/dist/lib/__tests__/exec.test.js +0 -446
  345. package/dist/lib/__tests__/exec.test.js.map +0 -1
  346. package/dist/lib/__tests__/git-sync.test.d.ts +0 -2
  347. package/dist/lib/__tests__/git-sync.test.d.ts.map +0 -1
  348. package/dist/lib/__tests__/git-sync.test.js +0 -138
  349. package/dist/lib/__tests__/git-sync.test.js.map +0 -1
  350. package/dist/lib/__tests__/hooks.test.d.ts +0 -2
  351. package/dist/lib/__tests__/hooks.test.d.ts.map +0 -1
  352. package/dist/lib/__tests__/hooks.test.js +0 -203
  353. package/dist/lib/__tests__/hooks.test.js.map +0 -1
  354. package/dist/lib/__tests__/memory-compile.test.d.ts +0 -2
  355. package/dist/lib/__tests__/memory-compile.test.d.ts.map +0 -1
  356. package/dist/lib/__tests__/memory-compile.test.js +0 -95
  357. package/dist/lib/__tests__/memory-compile.test.js.map +0 -1
  358. package/dist/lib/__tests__/models.test.d.ts +0 -2
  359. package/dist/lib/__tests__/models.test.d.ts.map +0 -1
  360. package/dist/lib/__tests__/models.test.js +0 -239
  361. package/dist/lib/__tests__/models.test.js.map +0 -1
  362. package/dist/lib/__tests__/rotate.test.d.ts +0 -2
  363. package/dist/lib/__tests__/rotate.test.d.ts.map +0 -1
  364. package/dist/lib/__tests__/rotate.test.js +0 -80
  365. package/dist/lib/__tests__/rotate.test.js.map +0 -1
  366. package/dist/lib/__tests__/secrets-bundles.test.d.ts +0 -2
  367. package/dist/lib/__tests__/secrets-bundles.test.d.ts.map +0 -1
  368. package/dist/lib/__tests__/secrets-bundles.test.js +0 -104
  369. package/dist/lib/__tests__/secrets-bundles.test.js.map +0 -1
  370. package/dist/lib/__tests__/secrets.test.d.ts +0 -2
  371. package/dist/lib/__tests__/secrets.test.d.ts.map +0 -1
  372. package/dist/lib/__tests__/secrets.test.js +0 -90
  373. package/dist/lib/__tests__/secrets.test.js.map +0 -1
  374. package/dist/lib/__tests__/shims.test.d.ts +0 -2
  375. package/dist/lib/__tests__/shims.test.d.ts.map +0 -1
  376. package/dist/lib/__tests__/shims.test.js +0 -39
  377. package/dist/lib/__tests__/shims.test.js.map +0 -1
  378. package/dist/lib/__tests__/usage.test.d.ts +0 -2
  379. package/dist/lib/__tests__/usage.test.d.ts.map +0 -1
  380. package/dist/lib/__tests__/usage.test.js +0 -220
  381. package/dist/lib/__tests__/usage.test.js.map +0 -1
  382. package/dist/lib/__tests__/versions.test.d.ts +0 -2
  383. package/dist/lib/__tests__/versions.test.d.ts.map +0 -1
  384. package/dist/lib/__tests__/versions.test.js +0 -63
  385. package/dist/lib/__tests__/versions.test.js.map +0 -1
  386. package/dist/lib/agents.d.ts.map +0 -1
  387. package/dist/lib/agents.js.map +0 -1
  388. package/dist/lib/artifact-actions.d.ts.map +0 -1
  389. package/dist/lib/artifact-actions.js.map +0 -1
  390. package/dist/lib/cloud/codex.d.ts.map +0 -1
  391. package/dist/lib/cloud/codex.js.map +0 -1
  392. package/dist/lib/cloud/factory.d.ts.map +0 -1
  393. package/dist/lib/cloud/factory.js.map +0 -1
  394. package/dist/lib/cloud/registry.d.ts.map +0 -1
  395. package/dist/lib/cloud/registry.js.map +0 -1
  396. package/dist/lib/cloud/rush.d.ts.map +0 -1
  397. package/dist/lib/cloud/rush.js.map +0 -1
  398. package/dist/lib/cloud/store.d.ts.map +0 -1
  399. package/dist/lib/cloud/store.js.map +0 -1
  400. package/dist/lib/cloud/stream.d.ts.map +0 -1
  401. package/dist/lib/cloud/stream.js.map +0 -1
  402. package/dist/lib/cloud/types.d.ts.map +0 -1
  403. package/dist/lib/cloud/types.js.map +0 -1
  404. package/dist/lib/commands.d.ts.map +0 -1
  405. package/dist/lib/commands.js.map +0 -1
  406. package/dist/lib/convert.d.ts.map +0 -1
  407. package/dist/lib/convert.js.map +0 -1
  408. package/dist/lib/daemon.d.ts.map +0 -1
  409. package/dist/lib/daemon.js.map +0 -1
  410. package/dist/lib/drive-sync.d.ts.map +0 -1
  411. package/dist/lib/drive-sync.js.map +0 -1
  412. package/dist/lib/exec.d.ts.map +0 -1
  413. package/dist/lib/exec.js.map +0 -1
  414. package/dist/lib/factory.d.ts +0 -57
  415. package/dist/lib/factory.d.ts.map +0 -1
  416. package/dist/lib/factory.js +0 -110
  417. package/dist/lib/factory.js.map +0 -1
  418. package/dist/lib/git.d.ts.map +0 -1
  419. package/dist/lib/git.js.map +0 -1
  420. package/dist/lib/help.d.ts.map +0 -1
  421. package/dist/lib/help.js.map +0 -1
  422. package/dist/lib/hooks.d.ts.map +0 -1
  423. package/dist/lib/hooks.js.map +0 -1
  424. package/dist/lib/manifest.d.ts.map +0 -1
  425. package/dist/lib/manifest.js.map +0 -1
  426. package/dist/lib/markdown.d.ts.map +0 -1
  427. package/dist/lib/markdown.js.map +0 -1
  428. package/dist/lib/mcp.d.ts.map +0 -1
  429. package/dist/lib/mcp.js.map +0 -1
  430. package/dist/lib/memory-compile.d.ts.map +0 -1
  431. package/dist/lib/memory-compile.js.map +0 -1
  432. package/dist/lib/memory.d.ts.map +0 -1
  433. package/dist/lib/memory.js.map +0 -1
  434. package/dist/lib/models.d.ts.map +0 -1
  435. package/dist/lib/models.js.map +0 -1
  436. package/dist/lib/permissions.d.ts.map +0 -1
  437. package/dist/lib/permissions.js.map +0 -1
  438. package/dist/lib/picker.d.ts.map +0 -1
  439. package/dist/lib/picker.js.map +0 -1
  440. package/dist/lib/plugins.d.ts.map +0 -1
  441. package/dist/lib/plugins.js.map +0 -1
  442. package/dist/lib/profiles-keychain.d.ts +0 -3
  443. package/dist/lib/profiles-keychain.d.ts.map +0 -1
  444. package/dist/lib/profiles-keychain.js +0 -10
  445. package/dist/lib/profiles-keychain.js.map +0 -1
  446. package/dist/lib/profiles-presets.d.ts.map +0 -1
  447. package/dist/lib/profiles-presets.js.map +0 -1
  448. package/dist/lib/profiles.d.ts.map +0 -1
  449. package/dist/lib/profiles.js.map +0 -1
  450. package/dist/lib/pty-client.d.ts.map +0 -1
  451. package/dist/lib/pty-client.js.map +0 -1
  452. package/dist/lib/pty-server.d.ts.map +0 -1
  453. package/dist/lib/pty-server.js.map +0 -1
  454. package/dist/lib/registry.d.ts.map +0 -1
  455. package/dist/lib/registry.js.map +0 -1
  456. package/dist/lib/resources.d.ts.map +0 -1
  457. package/dist/lib/resources.js.map +0 -1
  458. package/dist/lib/rotate.d.ts.map +0 -1
  459. package/dist/lib/rotate.js.map +0 -1
  460. package/dist/lib/routines.d.ts.map +0 -1
  461. package/dist/lib/routines.js.map +0 -1
  462. package/dist/lib/runner.d.ts.map +0 -1
  463. package/dist/lib/runner.js.map +0 -1
  464. package/dist/lib/sandbox.d.ts.map +0 -1
  465. package/dist/lib/sandbox.js.map +0 -1
  466. package/dist/lib/scheduler.d.ts.map +0 -1
  467. package/dist/lib/scheduler.js.map +0 -1
  468. package/dist/lib/secrets-bundles.d.ts.map +0 -1
  469. package/dist/lib/secrets-bundles.js.map +0 -1
  470. package/dist/lib/secrets.d.ts +0 -27
  471. package/dist/lib/secrets.d.ts.map +0 -1
  472. package/dist/lib/secrets.js +0 -127
  473. package/dist/lib/secrets.js.map +0 -1
  474. package/dist/lib/session/__tests__/db.test.d.ts +0 -2
  475. package/dist/lib/session/__tests__/db.test.d.ts.map +0 -1
  476. package/dist/lib/session/__tests__/db.test.js +0 -54
  477. package/dist/lib/session/__tests__/db.test.js.map +0 -1
  478. package/dist/lib/session/__tests__/discover.test.d.ts +0 -2
  479. package/dist/lib/session/__tests__/discover.test.d.ts.map +0 -1
  480. package/dist/lib/session/__tests__/discover.test.js +0 -63
  481. package/dist/lib/session/__tests__/discover.test.js.map +0 -1
  482. package/dist/lib/session/__tests__/prompt.test.d.ts +0 -2
  483. package/dist/lib/session/__tests__/prompt.test.d.ts.map +0 -1
  484. package/dist/lib/session/__tests__/prompt.test.js +0 -44
  485. package/dist/lib/session/__tests__/prompt.test.js.map +0 -1
  486. package/dist/lib/session/__tests__/render.test.d.ts +0 -2
  487. package/dist/lib/session/__tests__/render.test.d.ts.map +0 -1
  488. package/dist/lib/session/__tests__/render.test.js +0 -602
  489. package/dist/lib/session/__tests__/render.test.js.map +0 -1
  490. package/dist/lib/session/artifacts.d.ts.map +0 -1
  491. package/dist/lib/session/artifacts.js.map +0 -1
  492. package/dist/lib/session/db.d.ts.map +0 -1
  493. package/dist/lib/session/db.js.map +0 -1
  494. package/dist/lib/session/discover.d.ts.map +0 -1
  495. package/dist/lib/session/discover.js.map +0 -1
  496. package/dist/lib/session/parse.d.ts.map +0 -1
  497. package/dist/lib/session/parse.js.map +0 -1
  498. package/dist/lib/session/prompt.d.ts.map +0 -1
  499. package/dist/lib/session/prompt.js.map +0 -1
  500. package/dist/lib/session/prompt.test.d.ts +0 -2
  501. package/dist/lib/session/prompt.test.d.ts.map +0 -1
  502. package/dist/lib/session/prompt.test.js +0 -57
  503. package/dist/lib/session/prompt.test.js.map +0 -1
  504. package/dist/lib/session/render.d.ts.map +0 -1
  505. package/dist/lib/session/render.js.map +0 -1
  506. package/dist/lib/session/team-filter.d.ts.map +0 -1
  507. package/dist/lib/session/team-filter.js.map +0 -1
  508. package/dist/lib/session/team-filter.test.d.ts +0 -2
  509. package/dist/lib/session/team-filter.test.d.ts.map +0 -1
  510. package/dist/lib/session/team-filter.test.js +0 -157
  511. package/dist/lib/session/team-filter.test.js.map +0 -1
  512. package/dist/lib/session/types.d.ts.map +0 -1
  513. package/dist/lib/session/types.js.map +0 -1
  514. package/dist/lib/shims.d.ts.map +0 -1
  515. package/dist/lib/shims.js.map +0 -1
  516. package/dist/lib/skills.d.ts.map +0 -1
  517. package/dist/lib/skills.js.map +0 -1
  518. package/dist/lib/state.d.ts.map +0 -1
  519. package/dist/lib/state.js.map +0 -1
  520. package/dist/lib/subagents.d.ts.map +0 -1
  521. package/dist/lib/subagents.js.map +0 -1
  522. package/dist/lib/teams/agents.d.ts.map +0 -1
  523. package/dist/lib/teams/agents.js.map +0 -1
  524. package/dist/lib/teams/api.d.ts.map +0 -1
  525. package/dist/lib/teams/api.js.map +0 -1
  526. package/dist/lib/teams/cloud.d.ts +0 -11
  527. package/dist/lib/teams/cloud.d.ts.map +0 -1
  528. package/dist/lib/teams/cloud.js +0 -169
  529. package/dist/lib/teams/cloud.js.map +0 -1
  530. package/dist/lib/teams/debug.d.ts.map +0 -1
  531. package/dist/lib/teams/debug.js.map +0 -1
  532. package/dist/lib/teams/file_ops.d.ts.map +0 -1
  533. package/dist/lib/teams/file_ops.js.map +0 -1
  534. package/dist/lib/teams/parsers.d.ts.map +0 -1
  535. package/dist/lib/teams/parsers.js.map +0 -1
  536. package/dist/lib/teams/persistence.d.ts.map +0 -1
  537. package/dist/lib/teams/persistence.js.map +0 -1
  538. package/dist/lib/teams/ralph.d.ts +0 -8
  539. package/dist/lib/teams/ralph.d.ts.map +0 -1
  540. package/dist/lib/teams/ralph.js +0 -59
  541. package/dist/lib/teams/ralph.js.map +0 -1
  542. package/dist/lib/teams/registry.d.ts.map +0 -1
  543. package/dist/lib/teams/registry.js.map +0 -1
  544. package/dist/lib/teams/summarizer.d.ts.map +0 -1
  545. package/dist/lib/teams/summarizer.js.map +0 -1
  546. package/dist/lib/template.d.ts.map +0 -1
  547. package/dist/lib/template.js.map +0 -1
  548. package/dist/lib/types.d.ts.map +0 -1
  549. package/dist/lib/types.js.map +0 -1
  550. package/dist/lib/usage.d.ts.map +0 -1
  551. package/dist/lib/usage.js.map +0 -1
  552. package/dist/lib/versions.d.ts.map +0 -1
  553. package/dist/lib/versions.js.map +0 -1
  554. package/scripts/rebuild-sqlite.sh +0 -46
@@ -1,38 +1,182 @@
1
+ /**
2
+ * Cloud dispatch type definitions.
3
+ *
4
+ * Defines the provider-agnostic interface that all cloud backends (Rush, Codex,
5
+ * Factory) implement, plus the shared task and event types that flow through
6
+ * the dispatch pipeline.
7
+ */
8
+ /** Identifier for a supported cloud dispatch backend. */
1
9
  export type CloudProviderId = 'rush' | 'codex' | 'factory';
2
- export type CloudTaskStatus = 'queued' | 'allocating' | 'running' | 'input_required' | 'completed' | 'failed' | 'cancelled';
10
+ /**
11
+ * Lifecycle state of a cloud-dispatched task.
12
+ *
13
+ * `idle` represents a long-lived session that has stopped between turns and
14
+ * can be resumed via `message()`. Distinct from the terminal `completed |
15
+ * failed | cancelled` states, which cannot transition back to `running`.
16
+ */
17
+ export type CloudTaskStatus = 'queued' | 'allocating' | 'running' | 'idle' | 'input_required' | 'completed' | 'failed' | 'cancelled';
18
+ /** Snapshot of a dispatched task, stored locally and refreshed from the provider. */
3
19
  export interface CloudTask {
4
20
  id: string;
5
21
  provider: CloudProviderId;
6
22
  status: CloudTaskStatus;
7
23
  agent?: string;
8
24
  prompt: string;
25
+ /**
26
+ * First (or only) repo the task targets. Kept for back-compat with callers
27
+ * that treat one task as one repo. For multi-repo dispatches, see `repos`.
28
+ */
9
29
  repo?: string;
30
+ /**
31
+ * All repos the task targets, in dispatch order. Populated for multi-repo
32
+ * dispatches (Rush Cloud, and any provider that supports it). `repo`
33
+ * mirrors `repos[0]` when both are set.
34
+ */
35
+ repos?: string[];
10
36
  branch?: string;
11
37
  prUrl?: string;
12
38
  createdAt: string;
13
39
  updatedAt: string;
14
40
  summary?: string;
15
41
  }
16
- export interface CloudEvent {
17
- type: 'status' | 'output' | 'done' | 'error';
42
+ /**
43
+ * Single event emitted by a running cloud task.
44
+ *
45
+ * Discriminated union mirroring the local `SessionEvent` taxonomy so cloud
46
+ * streams can be rendered with the same UI primitives as local sessions. The
47
+ * `unknown` variant catches event names the provider emits that the client
48
+ * doesn't recognize — surfacing them rather than silently dropping is the
49
+ * point.
50
+ */
51
+ export type CloudEvent = {
52
+ type: 'text';
53
+ content: string;
54
+ timestamp?: string;
55
+ } | {
56
+ type: 'thinking';
57
+ content: string;
58
+ timestamp?: string;
59
+ } | {
60
+ type: 'tool_use';
61
+ tool: string;
62
+ input: unknown;
63
+ timestamp?: string;
64
+ } | {
65
+ type: 'tool_result';
66
+ tool: string;
67
+ output: unknown;
68
+ timestamp?: string;
69
+ } | {
70
+ type: 'status';
71
+ status: CloudTaskStatus;
72
+ timestamp?: string;
73
+ } | {
74
+ type: 'usage';
75
+ model?: string;
76
+ inputTokens?: number;
77
+ outputTokens?: number;
78
+ timestamp?: string;
79
+ } | {
80
+ type: 'done';
81
+ status?: CloudTaskStatus;
82
+ prUrl?: string;
83
+ summary?: string;
84
+ timestamp?: string;
85
+ } | {
86
+ type: 'error';
87
+ message: string;
88
+ timestamp?: string;
89
+ } | {
90
+ type: 'unknown';
91
+ name: string;
18
92
  data: string;
19
93
  timestamp?: string;
94
+ };
95
+ /** Reference to a skill that should ride along with a cloud dispatch. */
96
+ export interface SkillRef {
97
+ id: string;
98
+ version?: string;
99
+ }
100
+ /** A vision attachment carried along with a prompt (base64-encoded image bytes). */
101
+ export interface ImageAttachment {
102
+ data: string;
103
+ mimeType: 'image/png' | 'image/jpeg' | 'image/webp';
20
104
  }
105
+ /** Maximum images allowed per dispatch (matches Cursor Background Agents). */
106
+ export declare const MAX_IMAGES_PER_DISPATCH = 5;
107
+ /** Parameters for dispatching a new cloud task. */
21
108
  export interface DispatchOptions {
22
109
  prompt: string;
23
110
  agent?: string;
111
+ /**
112
+ * Legacy single-repo target. Still honored: if `repos` is empty, this
113
+ * becomes the only repo. Providers that support multi-repo treat
114
+ * `repos = [repo]` and `repo` as equivalent.
115
+ */
24
116
  repo?: string;
117
+ /**
118
+ * One or more repos the dispatch targets. Repeatable on the CLI via
119
+ * `--repo`. Providers handle multi-repo differently:
120
+ * - Rush Cloud clones each into /workspace/<owner>/<name>/
121
+ * - Codex Cloud rejects (multi-repo requires an env that bundles them)
122
+ * - Factory (local) clones each into the workspace before dispatch
123
+ */
124
+ repos?: string[];
25
125
  branch?: string;
26
126
  timeout?: string;
27
127
  model?: string;
128
+ /**
129
+ * Skills to ship with the dispatch. Providers that support skills mount
130
+ * them in the pod's skills directory before the agent runs. Providers
131
+ * without skill support reject via `capabilities().skills === false`.
132
+ */
133
+ skills?: SkillRef[];
134
+ /**
135
+ * Image attachments for vision-enabled dispatch (e.g., "fix this UI bug,
136
+ * here's the screenshot"). Capped at MAX_IMAGES_PER_DISPATCH.
137
+ */
138
+ images?: ImageAttachment[];
28
139
  /** Provider-specific options (e.g., codex env ID, factory computer name). */
29
- providerOptions?: Record<string, string>;
140
+ providerOptions?: Record<string, unknown>;
141
+ }
142
+ /**
143
+ * Collapse `repo` + `repos` into a single deduped list. Exported so callers,
144
+ * tests, and every provider share the same resolution — one source of truth
145
+ * for "which repos does this dispatch target?".
146
+ */
147
+ export declare function resolveDispatchRepos(options: DispatchOptions): string[];
148
+ /**
149
+ * What a provider can actually do. Replaces the single-bool `supports()` so
150
+ * callers can ask "does this provider support cancel?" without trying and
151
+ * catching. The CLI gates feature-specific calls on these flags and surfaces
152
+ * a typed error instead of letting throws bubble.
153
+ */
154
+ export interface ProviderCapabilities {
155
+ /** Configured + reachable (auth present, binary installed, etc.). */
156
+ available: boolean;
157
+ dispatch: boolean;
158
+ status: boolean;
159
+ list: boolean;
160
+ stream: boolean;
161
+ cancel: boolean;
162
+ message: boolean;
163
+ multiRepo: boolean;
164
+ skills: boolean;
165
+ images: boolean;
30
166
  }
167
+ /**
168
+ * Contract that every cloud backend must implement.
169
+ *
170
+ * Each provider translates between the unified dispatch interface and its
171
+ * backend-specific API (Rush Factory Floor, Codex Cloud CLI, Droid daemon).
172
+ *
173
+ * `message()` may transition a task from `idle` back to `running`.
174
+ */
31
175
  export interface CloudProvider {
32
176
  id: CloudProviderId;
33
177
  name: string;
34
- /** Whether the provider is configured and can handle this dispatch. */
35
- supports(options: DispatchOptions): boolean;
178
+ /** Static capability map for this provider. Read before calling feature methods. */
179
+ capabilities(): ProviderCapabilities;
36
180
  dispatch(options: DispatchOptions): Promise<CloudTask>;
37
181
  status(taskId: string): Promise<CloudTask>;
38
182
  list(filter?: {
@@ -41,9 +185,10 @@ export interface CloudProvider {
41
185
  /** Stream live output. Yields events until task completes or caller breaks. */
42
186
  stream(taskId: string): AsyncIterable<CloudEvent>;
43
187
  cancel(taskId: string): Promise<void>;
44
- /** Send a follow-up message to a finished/needs_review task. */
188
+ /** Send a follow-up message to a finished/idle/needs_review task. */
45
189
  message(taskId: string, content: string): Promise<void>;
46
190
  }
191
+ /** Per-provider configuration stored in the `cloud.providers` section of agents.yaml. */
47
192
  export interface CloudProviderConfig {
48
193
  rush?: Record<string, string>;
49
194
  codex?: {
@@ -53,8 +198,8 @@ export interface CloudProviderConfig {
53
198
  computer?: string;
54
199
  };
55
200
  }
201
+ /** Top-level `cloud` section of agents.yaml. */
56
202
  export interface CloudConfig {
57
203
  default_provider?: CloudProviderId;
58
204
  providers?: CloudProviderConfig;
59
205
  }
60
- //# sourceMappingURL=types.d.ts.map
@@ -1,2 +1,34 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
1
+ /**
2
+ * Cloud dispatch type definitions.
3
+ *
4
+ * Defines the provider-agnostic interface that all cloud backends (Rush, Codex,
5
+ * Factory) implement, plus the shared task and event types that flow through
6
+ * the dispatch pipeline.
7
+ */
8
+ /** Maximum images allowed per dispatch (matches Cursor Background Agents). */
9
+ export const MAX_IMAGES_PER_DISPATCH = 5;
10
+ /**
11
+ * Collapse `repo` + `repos` into a single deduped list. Exported so callers,
12
+ * tests, and every provider share the same resolution — one source of truth
13
+ * for "which repos does this dispatch target?".
14
+ */
15
+ export function resolveDispatchRepos(options) {
16
+ const out = [];
17
+ const seen = new Set();
18
+ const candidates = [];
19
+ if (options.repos)
20
+ candidates.push(...options.repos);
21
+ if (options.repo)
22
+ candidates.push(options.repo);
23
+ for (const raw of candidates) {
24
+ const trimmed = typeof raw === 'string' ? raw.trim() : '';
25
+ if (!trimmed)
26
+ continue;
27
+ const key = trimmed.toLowerCase();
28
+ if (seen.has(key))
29
+ continue;
30
+ seen.add(key);
31
+ out.push(trimmed);
32
+ }
33
+ return out;
34
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Convert slash-command markdown files into Codex skills for Codex releases
3
+ * that no longer load the legacy prompts/ directory.
4
+ */
5
+ import type { AgentId } from './types.js';
6
+ export declare function shouldInstallCommandAsSkill(agent: AgentId, version: string): boolean;
7
+ export declare function commandSkillName(commandName: string): string;
8
+ export declare function buildCommandSkillContent(commandName: string, sourcePath: string): string;
9
+ export declare function skillSourceExists(skillName: string, skillSourceDirs: Array<string | null | undefined>): boolean;
10
+ export declare function installCommandSkillToVersion(agentDir: string, commandName: string, sourcePath: string, skillSourceDirs?: Array<string | null | undefined>): {
11
+ success: boolean;
12
+ skipped?: boolean;
13
+ error?: string;
14
+ };
15
+ export declare function listCommandSkillsInVersion(agentDir: string): string[];
16
+ export declare function commandSkillMatches(agentDir: string, commandName: string, sourcePath: string): boolean;
17
+ export declare function removeCommandSkillFromVersion(agentDir: string, commandName: string): {
18
+ success: boolean;
19
+ error?: string;
20
+ };
@@ -0,0 +1,142 @@
1
+ /**
2
+ * Convert slash-command markdown files into Codex skills for Codex releases
3
+ * that no longer load the legacy prompts/ directory.
4
+ */
5
+ import * as fs from 'fs';
6
+ import * as path from 'path';
7
+ import * as yaml from 'yaml';
8
+ import { supports } from './capabilities.js';
9
+ import { safeJoin } from './paths.js';
10
+ const COMMAND_SKILL_MARKER = 'agents_command';
11
+ function readCommandMetadata(sourcePath) {
12
+ const content = fs.readFileSync(sourcePath, 'utf-8');
13
+ const lines = content.split('\n');
14
+ if (lines[0] !== '---') {
15
+ return { description: '', body: content };
16
+ }
17
+ const endIndex = lines.slice(1).findIndex((line) => line === '---');
18
+ if (endIndex < 0) {
19
+ return { description: '', body: content };
20
+ }
21
+ const frontmatterEnd = endIndex + 1;
22
+ const frontmatter = lines.slice(1, frontmatterEnd).join('\n');
23
+ const body = lines.slice(frontmatterEnd + 1).join('\n').trimStart();
24
+ try {
25
+ const parsed = yaml.parse(frontmatter);
26
+ const description = typeof parsed?.description === 'string' ? parsed.description.trim() : '';
27
+ return { description, body };
28
+ }
29
+ catch {
30
+ return { description: '', body };
31
+ }
32
+ }
33
+ function readSkillCommandMarker(skillMdPath) {
34
+ if (!fs.existsSync(skillMdPath))
35
+ return null;
36
+ const content = fs.readFileSync(skillMdPath, 'utf-8');
37
+ const lines = content.split('\n');
38
+ if (lines[0] !== '---')
39
+ return null;
40
+ const endIndex = lines.slice(1).findIndex((line) => line === '---');
41
+ if (endIndex < 0)
42
+ return null;
43
+ try {
44
+ const frontmatter = lines.slice(1, endIndex + 1).join('\n');
45
+ const parsed = yaml.parse(frontmatter);
46
+ return typeof parsed?.[COMMAND_SKILL_MARKER] === 'string' ? parsed[COMMAND_SKILL_MARKER] : null;
47
+ }
48
+ catch {
49
+ return null;
50
+ }
51
+ }
52
+ export function shouldInstallCommandAsSkill(agent, version) {
53
+ if (agent !== 'codex')
54
+ return false;
55
+ return !supports(agent, 'commands', version).ok && supports(agent, 'skills', version).ok;
56
+ }
57
+ export function commandSkillName(commandName) {
58
+ return commandName;
59
+ }
60
+ export function buildCommandSkillContent(commandName, sourcePath) {
61
+ const { description, body } = readCommandMetadata(sourcePath);
62
+ const skillDescription = description || `Slash command converted from /${commandName}`;
63
+ return [
64
+ '---',
65
+ `name: ${JSON.stringify(commandSkillName(commandName))}`,
66
+ `description: ${JSON.stringify(skillDescription)}`,
67
+ `${COMMAND_SKILL_MARKER}: ${JSON.stringify(commandName)}`,
68
+ '---',
69
+ '',
70
+ `# /${commandName}`,
71
+ '',
72
+ `This skill contains the behavior from the legacy \`/${commandName}\` slash command.`,
73
+ 'When invoked with `$' + commandSkillName(commandName) + '`, treat the text after the skill name as the original command arguments.',
74
+ '',
75
+ body.trimEnd(),
76
+ '',
77
+ ].join('\n');
78
+ }
79
+ export function skillSourceExists(skillName, skillSourceDirs) {
80
+ return skillSourceDirs.some((dir) => {
81
+ if (!dir)
82
+ return false;
83
+ const candidate = path.join(dir, skillName);
84
+ return fs.existsSync(candidate) && fs.lstatSync(candidate).isDirectory();
85
+ });
86
+ }
87
+ export function installCommandSkillToVersion(agentDir, commandName, sourcePath, skillSourceDirs = []) {
88
+ const skillName = commandSkillName(commandName);
89
+ if (skillSourceExists(skillName, skillSourceDirs)) {
90
+ return { success: false, skipped: true, error: `Skill '${skillName}' already exists` };
91
+ }
92
+ const skillsDir = safeJoin(agentDir, 'skills');
93
+ const skillDir = safeJoin(skillsDir, skillName);
94
+ try {
95
+ fs.rmSync(skillDir, { recursive: true, force: true });
96
+ fs.mkdirSync(skillDir, { recursive: true });
97
+ fs.writeFileSync(safeJoin(skillDir, 'SKILL.md'), buildCommandSkillContent(commandName, sourcePath), 'utf-8');
98
+ return { success: true };
99
+ }
100
+ catch (err) {
101
+ return { success: false, error: err.message };
102
+ }
103
+ }
104
+ export function listCommandSkillsInVersion(agentDir) {
105
+ const skillsDir = path.join(agentDir, 'skills');
106
+ if (!fs.existsSync(skillsDir))
107
+ return [];
108
+ const names = [];
109
+ for (const entry of fs.readdirSync(skillsDir, { withFileTypes: true })) {
110
+ if (!entry.isDirectory() || entry.name.startsWith('.'))
111
+ continue;
112
+ const marker = readSkillCommandMarker(path.join(skillsDir, entry.name, 'SKILL.md'));
113
+ if (marker)
114
+ names.push(marker);
115
+ }
116
+ return names.sort();
117
+ }
118
+ export function commandSkillMatches(agentDir, commandName, sourcePath) {
119
+ const skillMdPath = path.join(agentDir, 'skills', commandSkillName(commandName), 'SKILL.md');
120
+ if (!fs.existsSync(skillMdPath))
121
+ return false;
122
+ try {
123
+ return fs.readFileSync(skillMdPath, 'utf-8') === buildCommandSkillContent(commandName, sourcePath);
124
+ }
125
+ catch {
126
+ return false;
127
+ }
128
+ }
129
+ export function removeCommandSkillFromVersion(agentDir, commandName) {
130
+ const skillDir = path.join(agentDir, 'skills', commandSkillName(commandName));
131
+ const skillMdPath = path.join(skillDir, 'SKILL.md');
132
+ if (readSkillCommandMarker(skillMdPath) !== commandName) {
133
+ return { success: true };
134
+ }
135
+ try {
136
+ fs.rmSync(skillDir, { recursive: true, force: true });
137
+ return { success: true };
138
+ }
139
+ catch (err) {
140
+ return { success: false, error: err.message };
141
+ }
142
+ }
@@ -1,14 +1,26 @@
1
+ /**
2
+ * Slash command management -- discovery, installation, and syncing.
3
+ *
4
+ * Commands are markdown files in ~/.agents/commands/ exposed as `/command-name`
5
+ * shortcuts by agents. This module discovers them, converts between formats
6
+ * (markdown for Claude/Codex, TOML for Gemini), and installs them into
7
+ * agent version homes.
8
+ */
1
9
  import type { AgentId, CommandInstallation } from './types.js';
10
+ /** Scope of a command: user-global or project-local. */
2
11
  export type CommandScope = 'user' | 'project';
12
+ /** Parsed metadata from a command file's YAML frontmatter. */
3
13
  export interface CommandMetadata {
4
14
  name: string;
5
15
  description: string;
6
16
  }
17
+ /** Result of validating command metadata. */
7
18
  export interface ValidationResult {
8
19
  valid: boolean;
9
20
  errors: string[];
10
21
  warnings: string[];
11
22
  }
23
+ /** A command discovered in a repository's commands/ directory. */
12
24
  export interface DiscoveredCommand {
13
25
  name: string;
14
26
  description: string;
@@ -16,16 +28,22 @@ export interface DiscoveredCommand {
16
28
  isShared: boolean;
17
29
  validation: ValidationResult;
18
30
  }
31
+ /** A command installed in an agent's config directory. */
19
32
  export interface InstalledCommand {
20
33
  name: string;
21
34
  scope: CommandScope;
22
35
  path: string;
23
36
  description?: string;
24
37
  }
38
+ /** Parse command metadata (name, description) from YAML frontmatter or TOML headers. */
25
39
  export declare function parseCommandMetadata(filePath: string): CommandMetadata | null;
40
+ /** Validate command metadata, returning errors and warnings. */
26
41
  export declare function validateCommandMetadata(metadata: CommandMetadata | null, commandName: string): ValidationResult;
42
+ /** Discover all command markdown files in a repository's commands/ directory. */
27
43
  export declare function discoverCommands(repoPath: string): DiscoveredCommand[];
44
+ /** Find the source path for a command in a repository. */
28
45
  export declare function resolveCommandSource(repoPath: string, commandName: string): string | null;
46
+ /** Install a command into an agent's config directory, with optional format conversion. */
29
47
  export declare function installCommand(sourcePath: string, agentId: AgentId, commandName: string, method?: 'symlink' | 'copy'): CommandInstallation & {
30
48
  error?: string;
31
49
  warnings?: string[];
@@ -77,7 +95,9 @@ export declare function iterCommandsCapableVersions(filter?: {
77
95
  agent: AgentId;
78
96
  version: string;
79
97
  }>;
98
+ /** Remove a command from an agent's config directory. */
80
99
  export declare function uninstallCommand(agentId: AgentId, commandName: string): boolean;
100
+ /** List command names installed for an agent in the active version home. */
81
101
  export declare function listInstalledCommands(agentId: AgentId): string[];
82
102
  /**
83
103
  * Check if a command exists for an agent.
@@ -106,7 +126,8 @@ export declare function installCommandCentrally(sourcePath: string, commandName:
106
126
  warnings?: string[];
107
127
  };
108
128
  /**
109
- * List commands from central ~/.agents/commands/ directory.
129
+ * List commands from user (~/.agents/commands/) and system (~/.agents-system/commands/) dirs.
130
+ * User dir takes priority; deduplication preserves first occurrence.
110
131
  */
111
132
  export declare function listCentralCommands(): string[];
112
133
  /**
@@ -118,4 +139,3 @@ export declare function getCommandInfo(name: string): {
118
139
  path: string;
119
140
  content: string;
120
141
  } | null;
121
- //# sourceMappingURL=commands.d.ts.map
@@ -1,10 +1,20 @@
1
+ /**
2
+ * Slash command management -- discovery, installation, and syncing.
3
+ *
4
+ * Commands are markdown files in ~/.agents/commands/ exposed as `/command-name`
5
+ * shortcuts by agents. This module discovers them, converts between formats
6
+ * (markdown for Claude/Codex, TOML for Gemini), and installs them into
7
+ * agent version homes.
8
+ */
1
9
  import * as fs from 'fs';
2
10
  import * as path from 'path';
3
11
  import * as yaml from 'yaml';
4
12
  import { AGENTS, COMMANDS_CAPABLE_AGENTS, ensureCommandsDir } from './agents.js';
5
13
  import { markdownToToml } from './convert.js';
6
- import { getCommandsDir, getProjectAgentsDir } from './state.js';
14
+ import { getCommandsDir, getUserCommandsDir, getEnabledExtraRepos, getProjectAgentsDir, getSkillsDir } from './state.js';
7
15
  import { getEffectiveHome, getVersionHomePath, listInstalledVersions } from './versions.js';
16
+ import { commandSkillMatches, installCommandSkillToVersion, listCommandSkillsInVersion, removeCommandSkillFromVersion, shouldInstallCommandAsSkill, } from './command-skills.js';
17
+ /** Parse command metadata (name, description) from YAML frontmatter or TOML headers. */
8
18
  export function parseCommandMetadata(filePath) {
9
19
  if (!fs.existsSync(filePath)) {
10
20
  return null;
@@ -40,6 +50,7 @@ export function parseCommandMetadata(filePath) {
40
50
  return null;
41
51
  }
42
52
  }
53
+ /** Validate command metadata, returning errors and warnings. */
43
54
  export function validateCommandMetadata(metadata, commandName) {
44
55
  const errors = [];
45
56
  const warnings = [];
@@ -61,6 +72,7 @@ export function validateCommandMetadata(metadata, commandName) {
61
72
  }
62
73
  return { valid: errors.length === 0, errors, warnings };
63
74
  }
75
+ /** Discover all command markdown files in a repository's commands/ directory. */
64
76
  export function discoverCommands(repoPath) {
65
77
  const commands = [];
66
78
  const commandsDir = path.join(repoPath, 'commands');
@@ -93,6 +105,7 @@ function extractDescription(content) {
93
105
  const firstLine = content.split('\n').find((l) => l.trim() && !l.startsWith('---'));
94
106
  return firstLine?.slice(0, 80) || '';
95
107
  }
108
+ /** Find the source path for a command in a repository. */
96
109
  export function resolveCommandSource(repoPath, commandName) {
97
110
  const commandPath = path.join(repoPath, 'commands', `${commandName}.md`);
98
111
  if (fs.existsSync(commandPath)) {
@@ -100,6 +113,7 @@ export function resolveCommandSource(repoPath, commandName) {
100
113
  }
101
114
  return null;
102
115
  }
116
+ /** Install a command into an agent's config directory, with optional format conversion. */
103
117
  export function installCommand(sourcePath, agentId, commandName, method = 'symlink') {
104
118
  // Validate command metadata before installation
105
119
  const metadata = parseCommandMetadata(sourcePath);
@@ -149,6 +163,11 @@ export function getVersionCommandsDir(agent, version) {
149
163
  * List command names (without extension) installed in a specific version home.
150
164
  */
151
165
  export function listCommandsInVersionHome(agent, version) {
166
+ const versionHome = getVersionHomePath(agent, version);
167
+ const agentDir = path.join(versionHome, `.${agent}`);
168
+ if (shouldInstallCommandAsSkill(agent, version)) {
169
+ return listCommandSkillsInVersion(agentDir);
170
+ }
152
171
  const dir = getVersionCommandsDir(agent, version);
153
172
  if (!fs.existsSync(dir))
154
173
  return [];
@@ -166,6 +185,11 @@ function versionCommandMatches(agent, version, commandName) {
166
185
  const sourcePath = path.join(getCommandsDir(), `${commandName}.md`);
167
186
  if (!fs.existsSync(sourcePath))
168
187
  return false;
188
+ const versionHome = getVersionHomePath(agent, version);
189
+ const agentDir = path.join(versionHome, `.${agent}`);
190
+ if (shouldInstallCommandAsSkill(agent, version)) {
191
+ return commandSkillMatches(agentDir, commandName, sourcePath);
192
+ }
169
193
  const agentConfig = AGENTS[agent];
170
194
  const ext = agentConfig.format === 'toml' ? '.toml' : '.md';
171
195
  const installedPath = path.join(getVersionCommandsDir(agent, version), `${commandName}${ext}`);
@@ -220,6 +244,14 @@ export function installCommandToVersion(agent, version, commandName, method = 'c
220
244
  if (!fs.existsSync(sourcePath)) {
221
245
  return { success: false, error: `Command '${commandName}' not found in central` };
222
246
  }
247
+ const versionHome = getVersionHomePath(agent, version);
248
+ const agentDir = path.join(versionHome, `.${agent}`);
249
+ if (shouldInstallCommandAsSkill(agent, version)) {
250
+ return installCommandSkillToVersion(agentDir, commandName, sourcePath, [
251
+ getSkillsDir(),
252
+ ...getEnabledExtraRepos().map((repo) => path.join(repo.dir, 'skills')),
253
+ ]);
254
+ }
223
255
  const agentConfig = AGENTS[agent];
224
256
  const commandsDir = getVersionCommandsDir(agent, version);
225
257
  fs.mkdirSync(commandsDir, { recursive: true });
@@ -249,6 +281,11 @@ export function installCommandToVersion(agent, version, commandName, method = 'c
249
281
  * Remove a single command from a specific version home.
250
282
  */
251
283
  export function removeCommandFromVersion(agent, version, commandName) {
284
+ const versionHome = getVersionHomePath(agent, version);
285
+ const agentDir = path.join(versionHome, `.${agent}`);
286
+ if (shouldInstallCommandAsSkill(agent, version)) {
287
+ return removeCommandSkillFromVersion(agentDir, commandName);
288
+ }
252
289
  const ext = AGENTS[agent].format === 'toml' ? '.toml' : '.md';
253
290
  const targetPath = path.join(getVersionCommandsDir(agent, version), `${commandName}${ext}`);
254
291
  if (!fs.existsSync(targetPath) && !fs.lstatSync(targetPath, { throwIfNoEntry: false })) {
@@ -281,6 +318,7 @@ export function iterCommandsCapableVersions(filter) {
281
318
  }
282
319
  return pairs;
283
320
  }
321
+ /** Remove a command from an agent's config directory. */
284
322
  export function uninstallCommand(agentId, commandName) {
285
323
  const agent = AGENTS[agentId];
286
324
  const home = getEffectiveHome(agentId);
@@ -293,6 +331,7 @@ export function uninstallCommand(agentId, commandName) {
293
331
  }
294
332
  return false;
295
333
  }
334
+ /** List command names installed for an agent in the active version home. */
296
335
  export function listInstalledCommands(agentId) {
297
336
  const agent = AGENTS[agentId];
298
337
  const home = getEffectiveHome(agentId);
@@ -448,7 +487,7 @@ export function installCommandCentrally(sourcePath, commandName) {
448
487
  warnings: validation.warnings,
449
488
  };
450
489
  }
451
- const centralDir = getCommandsDir();
490
+ const centralDir = getUserCommandsDir();
452
491
  if (!fs.existsSync(centralDir)) {
453
492
  fs.mkdirSync(centralDir, { recursive: true });
454
493
  }
@@ -466,17 +505,19 @@ export function installCommandCentrally(sourcePath, commandName) {
466
505
  }
467
506
  }
468
507
  /**
469
- * List commands from central ~/.agents/commands/ directory.
508
+ * List commands from user (~/.agents/commands/) and system (~/.agents-system/commands/) dirs.
509
+ * User dir takes priority; deduplication preserves first occurrence.
470
510
  */
471
511
  export function listCentralCommands() {
472
- const centralDir = getCommandsDir();
473
- if (!fs.existsSync(centralDir)) {
474
- return [];
512
+ const seen = new Set();
513
+ for (const dir of [getUserCommandsDir(), getCommandsDir()]) {
514
+ if (!fs.existsSync(dir))
515
+ continue;
516
+ for (const f of fs.readdirSync(dir).filter((f) => f.endsWith('.md'))) {
517
+ seen.add(f.replace('.md', ''));
518
+ }
475
519
  }
476
- return fs
477
- .readdirSync(centralDir)
478
- .filter((f) => f.endsWith('.md'))
479
- .map((f) => f.replace('.md', ''));
520
+ return Array.from(seen);
480
521
  }
481
522
  /**
482
523
  * Get detailed info about a command from central storage.
@@ -496,4 +537,3 @@ export function getCommandInfo(name) {
496
537
  content,
497
538
  };
498
539
  }
499
- //# sourceMappingURL=commands.js.map
@@ -1,11 +1,20 @@
1
+ /**
2
+ * Format conversion between Markdown (Claude/Codex) and TOML (Gemini) command files.
3
+ *
4
+ * Handles frontmatter parsing and bidirectional translation so that slash commands
5
+ * authored in one format can be synced to agents that expect the other.
6
+ */
7
+ /** Parsed YAML frontmatter from a Markdown command file. */
1
8
  export interface MarkdownFrontmatter {
2
9
  description?: string;
3
10
  [key: string]: unknown;
4
11
  }
12
+ /** Extract YAML frontmatter and body from a Markdown string. Returns empty frontmatter if none found. */
5
13
  export declare function parseMarkdownFrontmatter(content: string): {
6
14
  frontmatter: MarkdownFrontmatter;
7
15
  body: string;
8
16
  };
17
+ /** Convert a Markdown command file to Gemini's TOML format, translating $ARGUMENTS to {{args}}. */
9
18
  export declare function markdownToToml(skillName: string, markdown: string): string;
19
+ /** Convert a Gemini TOML command file back to Markdown format, translating {{args}} to $ARGUMENTS. */
10
20
  export declare function tomlToMarkdown(toml: string): string;
11
- //# sourceMappingURL=convert.d.ts.map