@phnx-labs/agents-cli 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (486) hide show
  1. package/CHANGELOG.md +316 -0
  2. package/LICENSE +21 -0
  3. package/README.md +537 -0
  4. package/dist/commands/__tests__/sessions.test.d.ts +2 -0
  5. package/dist/commands/__tests__/sessions.test.d.ts.map +1 -0
  6. package/dist/commands/__tests__/sessions.test.js +636 -0
  7. package/dist/commands/__tests__/sessions.test.js.map +1 -0
  8. package/dist/commands/cloud.d.ts +3 -0
  9. package/dist/commands/cloud.d.ts.map +1 -0
  10. package/dist/commands/cloud.js +322 -0
  11. package/dist/commands/cloud.js.map +1 -0
  12. package/dist/commands/commands.d.ts +3 -0
  13. package/dist/commands/commands.d.ts.map +1 -0
  14. package/dist/commands/commands.js +628 -0
  15. package/dist/commands/commands.js.map +1 -0
  16. package/dist/commands/daemon.d.ts +3 -0
  17. package/dist/commands/daemon.d.ts.map +1 -0
  18. package/dist/commands/daemon.js +110 -0
  19. package/dist/commands/daemon.js.map +1 -0
  20. package/dist/commands/drive.d.ts +3 -0
  21. package/dist/commands/drive.d.ts.map +1 -0
  22. package/dist/commands/drive.js +166 -0
  23. package/dist/commands/drive.js.map +1 -0
  24. package/dist/commands/exec.d.ts +3 -0
  25. package/dist/commands/exec.d.ts.map +1 -0
  26. package/dist/commands/exec.js +241 -0
  27. package/dist/commands/exec.js.map +1 -0
  28. package/dist/commands/fork.d.ts +3 -0
  29. package/dist/commands/fork.d.ts.map +1 -0
  30. package/dist/commands/fork.js +139 -0
  31. package/dist/commands/fork.js.map +1 -0
  32. package/dist/commands/hooks.d.ts +3 -0
  33. package/dist/commands/hooks.d.ts.map +1 -0
  34. package/dist/commands/hooks.js +689 -0
  35. package/dist/commands/hooks.js.map +1 -0
  36. package/dist/commands/init.d.ts +6 -0
  37. package/dist/commands/init.d.ts.map +1 -0
  38. package/dist/commands/init.js +127 -0
  39. package/dist/commands/init.js.map +1 -0
  40. package/dist/commands/mcp.d.ts +3 -0
  41. package/dist/commands/mcp.d.ts.map +1 -0
  42. package/dist/commands/mcp.js +581 -0
  43. package/dist/commands/mcp.js.map +1 -0
  44. package/dist/commands/models.d.ts +3 -0
  45. package/dist/commands/models.d.ts.map +1 -0
  46. package/dist/commands/models.js +158 -0
  47. package/dist/commands/models.js.map +1 -0
  48. package/dist/commands/packages.d.ts +3 -0
  49. package/dist/commands/packages.d.ts.map +1 -0
  50. package/dist/commands/packages.js +541 -0
  51. package/dist/commands/packages.js.map +1 -0
  52. package/dist/commands/permissions.d.ts +3 -0
  53. package/dist/commands/permissions.d.ts.map +1 -0
  54. package/dist/commands/permissions.js +723 -0
  55. package/dist/commands/permissions.js.map +1 -0
  56. package/dist/commands/plugins.d.ts +3 -0
  57. package/dist/commands/plugins.d.ts.map +1 -0
  58. package/dist/commands/plugins.js +382 -0
  59. package/dist/commands/plugins.js.map +1 -0
  60. package/dist/commands/profiles.d.ts +3 -0
  61. package/dist/commands/profiles.d.ts.map +1 -0
  62. package/dist/commands/profiles.js +242 -0
  63. package/dist/commands/profiles.js.map +1 -0
  64. package/dist/commands/pty.d.ts +20 -0
  65. package/dist/commands/pty.d.ts.map +1 -0
  66. package/dist/commands/pty.js +389 -0
  67. package/dist/commands/pty.js.map +1 -0
  68. package/dist/commands/pull.d.ts +3 -0
  69. package/dist/commands/pull.d.ts.map +1 -0
  70. package/dist/commands/pull.js +448 -0
  71. package/dist/commands/pull.js.map +1 -0
  72. package/dist/commands/push.d.ts +3 -0
  73. package/dist/commands/push.d.ts.map +1 -0
  74. package/dist/commands/push.js +180 -0
  75. package/dist/commands/push.js.map +1 -0
  76. package/dist/commands/refresh-memory.d.ts +9 -0
  77. package/dist/commands/refresh-memory.d.ts.map +1 -0
  78. package/dist/commands/refresh-memory.js +45 -0
  79. package/dist/commands/refresh-memory.js.map +1 -0
  80. package/dist/commands/resource-view.d.ts +31 -0
  81. package/dist/commands/resource-view.d.ts.map +1 -0
  82. package/dist/commands/resource-view.js +183 -0
  83. package/dist/commands/resource-view.js.map +1 -0
  84. package/dist/commands/routines.d.ts +3 -0
  85. package/dist/commands/routines.d.ts.map +1 -0
  86. package/dist/commands/routines.js +579 -0
  87. package/dist/commands/routines.js.map +1 -0
  88. package/dist/commands/rules.d.ts +3 -0
  89. package/dist/commands/rules.d.ts.map +1 -0
  90. package/dist/commands/rules.js +488 -0
  91. package/dist/commands/rules.js.map +1 -0
  92. package/dist/commands/secrets.d.ts +3 -0
  93. package/dist/commands/secrets.d.ts.map +1 -0
  94. package/dist/commands/secrets.js +339 -0
  95. package/dist/commands/secrets.js.map +1 -0
  96. package/dist/commands/sessions-picker.d.ts +16 -0
  97. package/dist/commands/sessions-picker.d.ts.map +1 -0
  98. package/dist/commands/sessions-picker.js +256 -0
  99. package/dist/commands/sessions-picker.js.map +1 -0
  100. package/dist/commands/sessions.d.ts +16 -0
  101. package/dist/commands/sessions.d.ts.map +1 -0
  102. package/dist/commands/sessions.js +1077 -0
  103. package/dist/commands/sessions.js.map +1 -0
  104. package/dist/commands/skills.d.ts +3 -0
  105. package/dist/commands/skills.d.ts.map +1 -0
  106. package/dist/commands/skills.js +716 -0
  107. package/dist/commands/skills.js.map +1 -0
  108. package/dist/commands/status.d.ts +3 -0
  109. package/dist/commands/status.d.ts.map +1 -0
  110. package/dist/commands/status.js +19 -0
  111. package/dist/commands/status.js.map +1 -0
  112. package/dist/commands/subagents.d.ts +3 -0
  113. package/dist/commands/subagents.d.ts.map +1 -0
  114. package/dist/commands/subagents.js +350 -0
  115. package/dist/commands/subagents.js.map +1 -0
  116. package/dist/commands/sync.d.ts +3 -0
  117. package/dist/commands/sync.d.ts.map +1 -0
  118. package/dist/commands/sync.js +62 -0
  119. package/dist/commands/sync.js.map +1 -0
  120. package/dist/commands/teams-picker.d.ts +14 -0
  121. package/dist/commands/teams-picker.d.ts.map +1 -0
  122. package/dist/commands/teams-picker.js +278 -0
  123. package/dist/commands/teams-picker.js.map +1 -0
  124. package/dist/commands/teams.d.ts +3 -0
  125. package/dist/commands/teams.d.ts.map +1 -0
  126. package/dist/commands/teams.js +917 -0
  127. package/dist/commands/teams.js.map +1 -0
  128. package/dist/commands/utils.d.ts +39 -0
  129. package/dist/commands/utils.d.ts.map +1 -0
  130. package/dist/commands/utils.js +100 -0
  131. package/dist/commands/utils.js.map +1 -0
  132. package/dist/commands/versions.d.ts +3 -0
  133. package/dist/commands/versions.d.ts.map +1 -0
  134. package/dist/commands/versions.js +700 -0
  135. package/dist/commands/versions.js.map +1 -0
  136. package/dist/commands/view.d.ts +8 -0
  137. package/dist/commands/view.d.ts.map +1 -0
  138. package/dist/commands/view.js +626 -0
  139. package/dist/commands/view.js.map +1 -0
  140. package/dist/index.d.ts +3 -0
  141. package/dist/index.d.ts.map +1 -0
  142. package/dist/index.js +484 -0
  143. package/dist/index.js.map +1 -0
  144. package/dist/lib/__tests__/bugfixes.test.d.ts +2 -0
  145. package/dist/lib/__tests__/bugfixes.test.d.ts.map +1 -0
  146. package/dist/lib/__tests__/bugfixes.test.js +192 -0
  147. package/dist/lib/__tests__/bugfixes.test.js.map +1 -0
  148. package/dist/lib/__tests__/exec.test.d.ts +2 -0
  149. package/dist/lib/__tests__/exec.test.d.ts.map +1 -0
  150. package/dist/lib/__tests__/exec.test.js +446 -0
  151. package/dist/lib/__tests__/exec.test.js.map +1 -0
  152. package/dist/lib/__tests__/git-sync.test.d.ts +2 -0
  153. package/dist/lib/__tests__/git-sync.test.d.ts.map +1 -0
  154. package/dist/lib/__tests__/git-sync.test.js +138 -0
  155. package/dist/lib/__tests__/git-sync.test.js.map +1 -0
  156. package/dist/lib/__tests__/hooks.test.d.ts +2 -0
  157. package/dist/lib/__tests__/hooks.test.d.ts.map +1 -0
  158. package/dist/lib/__tests__/hooks.test.js +203 -0
  159. package/dist/lib/__tests__/hooks.test.js.map +1 -0
  160. package/dist/lib/__tests__/memory-compile.test.d.ts +2 -0
  161. package/dist/lib/__tests__/memory-compile.test.d.ts.map +1 -0
  162. package/dist/lib/__tests__/memory-compile.test.js +95 -0
  163. package/dist/lib/__tests__/memory-compile.test.js.map +1 -0
  164. package/dist/lib/__tests__/models.test.d.ts +2 -0
  165. package/dist/lib/__tests__/models.test.d.ts.map +1 -0
  166. package/dist/lib/__tests__/models.test.js +239 -0
  167. package/dist/lib/__tests__/models.test.js.map +1 -0
  168. package/dist/lib/__tests__/rotate.test.d.ts +2 -0
  169. package/dist/lib/__tests__/rotate.test.d.ts.map +1 -0
  170. package/dist/lib/__tests__/rotate.test.js +80 -0
  171. package/dist/lib/__tests__/rotate.test.js.map +1 -0
  172. package/dist/lib/__tests__/secrets-bundles.test.d.ts +2 -0
  173. package/dist/lib/__tests__/secrets-bundles.test.d.ts.map +1 -0
  174. package/dist/lib/__tests__/secrets-bundles.test.js +104 -0
  175. package/dist/lib/__tests__/secrets-bundles.test.js.map +1 -0
  176. package/dist/lib/__tests__/secrets.test.d.ts +2 -0
  177. package/dist/lib/__tests__/secrets.test.d.ts.map +1 -0
  178. package/dist/lib/__tests__/secrets.test.js +90 -0
  179. package/dist/lib/__tests__/secrets.test.js.map +1 -0
  180. package/dist/lib/__tests__/shims.test.d.ts +2 -0
  181. package/dist/lib/__tests__/shims.test.d.ts.map +1 -0
  182. package/dist/lib/__tests__/shims.test.js +39 -0
  183. package/dist/lib/__tests__/shims.test.js.map +1 -0
  184. package/dist/lib/__tests__/usage.test.d.ts +2 -0
  185. package/dist/lib/__tests__/usage.test.d.ts.map +1 -0
  186. package/dist/lib/__tests__/usage.test.js +220 -0
  187. package/dist/lib/__tests__/usage.test.js.map +1 -0
  188. package/dist/lib/__tests__/versions.test.d.ts +2 -0
  189. package/dist/lib/__tests__/versions.test.d.ts.map +1 -0
  190. package/dist/lib/__tests__/versions.test.js +63 -0
  191. package/dist/lib/__tests__/versions.test.js.map +1 -0
  192. package/dist/lib/agents.d.ts +107 -0
  193. package/dist/lib/agents.d.ts.map +1 -0
  194. package/dist/lib/agents.js +1096 -0
  195. package/dist/lib/agents.js.map +1 -0
  196. package/dist/lib/artifact-actions.d.ts +22 -0
  197. package/dist/lib/artifact-actions.d.ts.map +1 -0
  198. package/dist/lib/artifact-actions.js +55 -0
  199. package/dist/lib/artifact-actions.js.map +1 -0
  200. package/dist/lib/cloud/codex.d.ts +19 -0
  201. package/dist/lib/cloud/codex.d.ts.map +1 -0
  202. package/dist/lib/cloud/codex.js +210 -0
  203. package/dist/lib/cloud/codex.js.map +1 -0
  204. package/dist/lib/cloud/factory.d.ts +26 -0
  205. package/dist/lib/cloud/factory.d.ts.map +1 -0
  206. package/dist/lib/cloud/factory.js +37 -0
  207. package/dist/lib/cloud/factory.js.map +1 -0
  208. package/dist/lib/cloud/registry.d.ts +6 -0
  209. package/dist/lib/cloud/registry.d.ts.map +1 -0
  210. package/dist/lib/cloud/registry.js +56 -0
  211. package/dist/lib/cloud/registry.js.map +1 -0
  212. package/dist/lib/cloud/rush.d.ts +15 -0
  213. package/dist/lib/cloud/rush.d.ts.map +1 -0
  214. package/dist/lib/cloud/rush.js +185 -0
  215. package/dist/lib/cloud/rush.js.map +1 -0
  216. package/dist/lib/cloud/store.d.ts +10 -0
  217. package/dist/lib/cloud/store.d.ts.map +1 -0
  218. package/dist/lib/cloud/store.js +96 -0
  219. package/dist/lib/cloud/store.js.map +1 -0
  220. package/dist/lib/cloud/stream.d.ts +18 -0
  221. package/dist/lib/cloud/stream.d.ts.map +1 -0
  222. package/dist/lib/cloud/stream.js +138 -0
  223. package/dist/lib/cloud/stream.js.map +1 -0
  224. package/dist/lib/cloud/types.d.ts +60 -0
  225. package/dist/lib/cloud/types.d.ts.map +1 -0
  226. package/dist/lib/cloud/types.js +2 -0
  227. package/dist/lib/cloud/types.js.map +1 -0
  228. package/dist/lib/commands.d.ts +121 -0
  229. package/dist/lib/commands.d.ts.map +1 -0
  230. package/dist/lib/commands.js +499 -0
  231. package/dist/lib/commands.js.map +1 -0
  232. package/dist/lib/convert.d.ts +11 -0
  233. package/dist/lib/convert.d.ts.map +1 -0
  234. package/dist/lib/convert.js +45 -0
  235. package/dist/lib/convert.js.map +1 -0
  236. package/dist/lib/daemon.d.ts +22 -0
  237. package/dist/lib/daemon.d.ts.map +1 -0
  238. package/dist/lib/daemon.js +311 -0
  239. package/dist/lib/daemon.js.map +1 -0
  240. package/dist/lib/drive-sync.d.ts +28 -0
  241. package/dist/lib/drive-sync.d.ts.map +1 -0
  242. package/dist/lib/drive-sync.js +193 -0
  243. package/dist/lib/drive-sync.js.map +1 -0
  244. package/dist/lib/exec.d.ts +85 -0
  245. package/dist/lib/exec.d.ts.map +1 -0
  246. package/dist/lib/exec.js +423 -0
  247. package/dist/lib/exec.js.map +1 -0
  248. package/dist/lib/factory.d.ts +57 -0
  249. package/dist/lib/factory.d.ts.map +1 -0
  250. package/dist/lib/factory.js +110 -0
  251. package/dist/lib/factory.js.map +1 -0
  252. package/dist/lib/git.d.ts +146 -0
  253. package/dist/lib/git.d.ts.map +1 -0
  254. package/dist/lib/git.js +635 -0
  255. package/dist/lib/git.js.map +1 -0
  256. package/dist/lib/help.d.ts +3 -0
  257. package/dist/lib/help.d.ts.map +1 -0
  258. package/dist/lib/help.js +63 -0
  259. package/dist/lib/help.js.map +1 -0
  260. package/dist/lib/hooks.d.ts +116 -0
  261. package/dist/lib/hooks.d.ts.map +1 -0
  262. package/dist/lib/hooks.js +837 -0
  263. package/dist/lib/hooks.js.map +1 -0
  264. package/dist/lib/manifest.d.ts +8 -0
  265. package/dist/lib/manifest.d.ts.map +1 -0
  266. package/dist/lib/manifest.js +36 -0
  267. package/dist/lib/manifest.js.map +1 -0
  268. package/dist/lib/markdown.d.ts +5 -0
  269. package/dist/lib/markdown.d.ts.map +1 -0
  270. package/dist/lib/markdown.js +11 -0
  271. package/dist/lib/markdown.js.map +1 -0
  272. package/dist/lib/mcp.d.ts +64 -0
  273. package/dist/lib/mcp.d.ts.map +1 -0
  274. package/dist/lib/mcp.js +327 -0
  275. package/dist/lib/mcp.js.map +1 -0
  276. package/dist/lib/memory-compile.d.ts +56 -0
  277. package/dist/lib/memory-compile.d.ts.map +1 -0
  278. package/dist/lib/memory-compile.js +167 -0
  279. package/dist/lib/memory-compile.js.map +1 -0
  280. package/dist/lib/memory.d.ts +56 -0
  281. package/dist/lib/memory.d.ts.map +1 -0
  282. package/dist/lib/memory.js +267 -0
  283. package/dist/lib/memory.js.map +1 -0
  284. package/dist/lib/models.d.ts +91 -0
  285. package/dist/lib/models.d.ts.map +1 -0
  286. package/dist/lib/models.js +706 -0
  287. package/dist/lib/models.js.map +1 -0
  288. package/dist/lib/permissions.d.ts +204 -0
  289. package/dist/lib/permissions.d.ts.map +1 -0
  290. package/dist/lib/permissions.js +1022 -0
  291. package/dist/lib/permissions.js.map +1 -0
  292. package/dist/lib/picker.d.ts +17 -0
  293. package/dist/lib/picker.d.ts.map +1 -0
  294. package/dist/lib/picker.js +95 -0
  295. package/dist/lib/picker.js.map +1 -0
  296. package/dist/lib/plugins.d.ts +73 -0
  297. package/dist/lib/plugins.d.ts.map +1 -0
  298. package/dist/lib/plugins.js +549 -0
  299. package/dist/lib/plugins.js.map +1 -0
  300. package/dist/lib/profiles-keychain.d.ts +3 -0
  301. package/dist/lib/profiles-keychain.d.ts.map +1 -0
  302. package/dist/lib/profiles-keychain.js +10 -0
  303. package/dist/lib/profiles-keychain.js.map +1 -0
  304. package/dist/lib/profiles-presets.d.ts +15 -0
  305. package/dist/lib/profiles-presets.d.ts.map +1 -0
  306. package/dist/lib/profiles-presets.js +95 -0
  307. package/dist/lib/profiles-presets.js.map +1 -0
  308. package/dist/lib/profiles.d.ts +35 -0
  309. package/dist/lib/profiles.d.ts.map +1 -0
  310. package/dist/lib/profiles.js +123 -0
  311. package/dist/lib/profiles.js.map +1 -0
  312. package/dist/lib/pty-client.d.ts +22 -0
  313. package/dist/lib/pty-client.d.ts.map +1 -0
  314. package/dist/lib/pty-client.js +181 -0
  315. package/dist/lib/pty-client.js.map +1 -0
  316. package/dist/lib/pty-server.d.ts +16 -0
  317. package/dist/lib/pty-server.d.ts.map +1 -0
  318. package/dist/lib/pty-server.js +422 -0
  319. package/dist/lib/pty-server.js.map +1 -0
  320. package/dist/lib/registry.d.ts +28 -0
  321. package/dist/lib/registry.d.ts.map +1 -0
  322. package/dist/lib/registry.js +203 -0
  323. package/dist/lib/registry.js.map +1 -0
  324. package/dist/lib/resources.d.ts +50 -0
  325. package/dist/lib/resources.d.ts.map +1 -0
  326. package/dist/lib/resources.js +103 -0
  327. package/dist/lib/resources.js.map +1 -0
  328. package/dist/lib/rotate.d.ts +52 -0
  329. package/dist/lib/rotate.d.ts.map +1 -0
  330. package/dist/lib/rotate.js +87 -0
  331. package/dist/lib/rotate.js.map +1 -0
  332. package/dist/lib/routines.d.ts +70 -0
  333. package/dist/lib/routines.d.ts.map +1 -0
  334. package/dist/lib/routines.js +325 -0
  335. package/dist/lib/routines.js.map +1 -0
  336. package/dist/lib/runner.d.ts +12 -0
  337. package/dist/lib/runner.d.ts.map +1 -0
  338. package/dist/lib/runner.js +311 -0
  339. package/dist/lib/runner.js.map +1 -0
  340. package/dist/lib/sandbox.d.ts +10 -0
  341. package/dist/lib/sandbox.d.ts.map +1 -0
  342. package/dist/lib/sandbox.js +201 -0
  343. package/dist/lib/sandbox.js.map +1 -0
  344. package/dist/lib/scheduler.d.ts +18 -0
  345. package/dist/lib/scheduler.d.ts.map +1 -0
  346. package/dist/lib/scheduler.js +69 -0
  347. package/dist/lib/scheduler.js.map +1 -0
  348. package/dist/lib/secrets-bundles.d.ts +29 -0
  349. package/dist/lib/secrets-bundles.d.ts.map +1 -0
  350. package/dist/lib/secrets-bundles.js +168 -0
  351. package/dist/lib/secrets-bundles.js.map +1 -0
  352. package/dist/lib/secrets.d.ts +27 -0
  353. package/dist/lib/secrets.d.ts.map +1 -0
  354. package/dist/lib/secrets.js +127 -0
  355. package/dist/lib/secrets.js.map +1 -0
  356. package/dist/lib/session/__tests__/db.test.d.ts +2 -0
  357. package/dist/lib/session/__tests__/db.test.d.ts.map +1 -0
  358. package/dist/lib/session/__tests__/db.test.js +54 -0
  359. package/dist/lib/session/__tests__/db.test.js.map +1 -0
  360. package/dist/lib/session/__tests__/discover.test.d.ts +2 -0
  361. package/dist/lib/session/__tests__/discover.test.d.ts.map +1 -0
  362. package/dist/lib/session/__tests__/discover.test.js +63 -0
  363. package/dist/lib/session/__tests__/discover.test.js.map +1 -0
  364. package/dist/lib/session/__tests__/prompt.test.d.ts +2 -0
  365. package/dist/lib/session/__tests__/prompt.test.d.ts.map +1 -0
  366. package/dist/lib/session/__tests__/prompt.test.js +44 -0
  367. package/dist/lib/session/__tests__/prompt.test.js.map +1 -0
  368. package/dist/lib/session/__tests__/render.test.d.ts +2 -0
  369. package/dist/lib/session/__tests__/render.test.d.ts.map +1 -0
  370. package/dist/lib/session/__tests__/render.test.js +602 -0
  371. package/dist/lib/session/__tests__/render.test.js.map +1 -0
  372. package/dist/lib/session/artifacts.d.ts +5 -0
  373. package/dist/lib/session/artifacts.d.ts.map +1 -0
  374. package/dist/lib/session/artifacts.js +75 -0
  375. package/dist/lib/session/artifacts.js.map +1 -0
  376. package/dist/lib/session/db.d.ts +118 -0
  377. package/dist/lib/session/db.d.ts.map +1 -0
  378. package/dist/lib/session/db.js +576 -0
  379. package/dist/lib/session/db.js.map +1 -0
  380. package/dist/lib/session/discover.d.ts +60 -0
  381. package/dist/lib/session/discover.d.ts.map +1 -0
  382. package/dist/lib/session/discover.js +1272 -0
  383. package/dist/lib/session/discover.js.map +1 -0
  384. package/dist/lib/session/parse.d.ts +23 -0
  385. package/dist/lib/session/parse.d.ts.map +1 -0
  386. package/dist/lib/session/parse.js +650 -0
  387. package/dist/lib/session/parse.js.map +1 -0
  388. package/dist/lib/session/prompt.d.ts +4 -0
  389. package/dist/lib/session/prompt.d.ts.map +1 -0
  390. package/dist/lib/session/prompt.js +64 -0
  391. package/dist/lib/session/prompt.js.map +1 -0
  392. package/dist/lib/session/prompt.test.d.ts +2 -0
  393. package/dist/lib/session/prompt.test.d.ts.map +1 -0
  394. package/dist/lib/session/prompt.test.js +57 -0
  395. package/dist/lib/session/prompt.test.js.map +1 -0
  396. package/dist/lib/session/render.d.ts +90 -0
  397. package/dist/lib/session/render.d.ts.map +1 -0
  398. package/dist/lib/session/render.js +778 -0
  399. package/dist/lib/session/render.js.map +1 -0
  400. package/dist/lib/session/team-filter.d.ts +26 -0
  401. package/dist/lib/session/team-filter.d.ts.map +1 -0
  402. package/dist/lib/session/team-filter.js +66 -0
  403. package/dist/lib/session/team-filter.js.map +1 -0
  404. package/dist/lib/session/team-filter.test.d.ts +2 -0
  405. package/dist/lib/session/team-filter.test.d.ts.map +1 -0
  406. package/dist/lib/session/team-filter.test.js +157 -0
  407. package/dist/lib/session/team-filter.test.js.map +1 -0
  408. package/dist/lib/session/types.d.ts +69 -0
  409. package/dist/lib/session/types.d.ts.map +1 -0
  410. package/dist/lib/session/types.js +2 -0
  411. package/dist/lib/session/types.js.map +1 -0
  412. package/dist/lib/shims.d.ts +228 -0
  413. package/dist/lib/shims.d.ts.map +1 -0
  414. package/dist/lib/shims.js +1170 -0
  415. package/dist/lib/shims.js.map +1 -0
  416. package/dist/lib/skills.d.ts +134 -0
  417. package/dist/lib/skills.d.ts.map +1 -0
  418. package/dist/lib/skills.js +783 -0
  419. package/dist/lib/skills.js.map +1 -0
  420. package/dist/lib/state.d.ts +53 -0
  421. package/dist/lib/state.d.ts.map +1 -0
  422. package/dist/lib/state.js +299 -0
  423. package/dist/lib/state.js.map +1 -0
  424. package/dist/lib/subagents.d.ts +75 -0
  425. package/dist/lib/subagents.d.ts.map +1 -0
  426. package/dist/lib/subagents.js +402 -0
  427. package/dist/lib/subagents.js.map +1 -0
  428. package/dist/lib/teams/agents.d.ts +146 -0
  429. package/dist/lib/teams/agents.d.ts.map +1 -0
  430. package/dist/lib/teams/agents.js +1072 -0
  431. package/dist/lib/teams/agents.js.map +1 -0
  432. package/dist/lib/teams/api.d.ts +77 -0
  433. package/dist/lib/teams/api.d.ts.map +1 -0
  434. package/dist/lib/teams/api.js +229 -0
  435. package/dist/lib/teams/api.js.map +1 -0
  436. package/dist/lib/teams/cloud.d.ts +11 -0
  437. package/dist/lib/teams/cloud.d.ts.map +1 -0
  438. package/dist/lib/teams/cloud.js +169 -0
  439. package/dist/lib/teams/cloud.js.map +1 -0
  440. package/dist/lib/teams/debug.d.ts +2 -0
  441. package/dist/lib/teams/debug.d.ts.map +1 -0
  442. package/dist/lib/teams/debug.js +6 -0
  443. package/dist/lib/teams/debug.js.map +1 -0
  444. package/dist/lib/teams/file_ops.d.ts +6 -0
  445. package/dist/lib/teams/file_ops.d.ts.map +1 -0
  446. package/dist/lib/teams/file_ops.js +59 -0
  447. package/dist/lib/teams/file_ops.js.map +1 -0
  448. package/dist/lib/teams/parsers.d.ts +5 -0
  449. package/dist/lib/teams/parsers.d.ts.map +1 -0
  450. package/dist/lib/teams/parsers.js +826 -0
  451. package/dist/lib/teams/parsers.js.map +1 -0
  452. package/dist/lib/teams/persistence.d.ts +28 -0
  453. package/dist/lib/teams/persistence.d.ts.map +1 -0
  454. package/dist/lib/teams/persistence.js +289 -0
  455. package/dist/lib/teams/persistence.js.map +1 -0
  456. package/dist/lib/teams/ralph.d.ts +8 -0
  457. package/dist/lib/teams/ralph.d.ts.map +1 -0
  458. package/dist/lib/teams/ralph.js +59 -0
  459. package/dist/lib/teams/ralph.js.map +1 -0
  460. package/dist/lib/teams/registry.d.ts +11 -0
  461. package/dist/lib/teams/registry.d.ts.map +1 -0
  462. package/dist/lib/teams/registry.js +56 -0
  463. package/dist/lib/teams/registry.js.map +1 -0
  464. package/dist/lib/teams/summarizer.d.ts +58 -0
  465. package/dist/lib/teams/summarizer.d.ts.map +1 -0
  466. package/dist/lib/teams/summarizer.js +766 -0
  467. package/dist/lib/teams/summarizer.js.map +1 -0
  468. package/dist/lib/template.d.ts +24 -0
  469. package/dist/lib/template.d.ts.map +1 -0
  470. package/dist/lib/template.js +57 -0
  471. package/dist/lib/template.js.map +1 -0
  472. package/dist/lib/types.d.ts +282 -0
  473. package/dist/lib/types.d.ts.map +1 -0
  474. package/dist/lib/types.js +18 -0
  475. package/dist/lib/types.js.map +1 -0
  476. package/dist/lib/usage.d.ts +73 -0
  477. package/dist/lib/usage.d.ts.map +1 -0
  478. package/dist/lib/usage.js +623 -0
  479. package/dist/lib/usage.js.map +1 -0
  480. package/dist/lib/versions.d.ts +248 -0
  481. package/dist/lib/versions.d.ts.map +1 -0
  482. package/dist/lib/versions.js +1737 -0
  483. package/dist/lib/versions.js.map +1 -0
  484. package/package.json +82 -0
  485. package/scripts/postinstall.js +72 -0
  486. package/scripts/rebuild-sqlite.sh +46 -0
@@ -0,0 +1,626 @@
1
+ import chalk from 'chalk';
2
+ import ora from 'ora';
3
+ import * as fs from 'fs';
4
+ import * as path from 'path';
5
+ import * as yaml from 'yaml';
6
+ import { AGENTS, ALL_AGENT_IDS, getAllCliStates, getAccountInfo, resolveAgentName, formatAgentError, agentLabel, colorAgent, } from '../lib/agents.js';
7
+ import { formatUsageSection, formatUsageSummary, getUsageInfoForIdentity, getUsageInfoByIdentity, getUsageLookupKey, } from '../lib/usage.js';
8
+ import { readManifest } from '../lib/manifest.js';
9
+ import { listInstalledVersions, getGlobalDefault, getVersionHomePath, getVersionDir, getAvailableResources, getActuallySyncedResources, getNewResources, hasNewResources, promptNewResourceSelection, syncResourcesToVersion, } from '../lib/versions.js';
10
+ import { getShimsDir, isShimsInPath, ensureVersionedAliasCurrent, } from '../lib/shims.js';
11
+ import { getAgentResources } from '../lib/resources.js';
12
+ import { getAgentsDir, getPromptcutsPath } from '../lib/state.js';
13
+ import { isGitRepo, getGitSyncStatus } from '../lib/git.js';
14
+ import { getCentralMemoryFileName } from '../lib/memory.js';
15
+ import { formatPath, isPromptCancelled } from './utils.js';
16
+ function formatLastActive(date) {
17
+ if (!date)
18
+ return '';
19
+ const now = Date.now();
20
+ const diff = now - date.getTime();
21
+ const mins = Math.floor(diff / 60000);
22
+ const hours = Math.floor(diff / 3600000);
23
+ const days = Math.floor(diff / 86400000);
24
+ if (mins < 1)
25
+ return chalk.green('just now');
26
+ if (mins < 60)
27
+ return chalk.green(`${mins}m ago`);
28
+ if (hours < 24)
29
+ return chalk.white(`${hours}h ago`);
30
+ if (days < 7)
31
+ return chalk.gray(`${days}d ago`);
32
+ return chalk.gray(`${days}d ago`);
33
+ }
34
+ function visibleWidth(s) {
35
+ return s.replace(/\u001b\[[0-9;]*m/g, '').length;
36
+ }
37
+ function compareVersions(a, b) {
38
+ const partsA = a.split('.').map(Number);
39
+ const partsB = b.split('.').map(Number);
40
+ for (let i = 0; i < 3; i++) {
41
+ if (partsA[i] > partsB[i])
42
+ return 1;
43
+ if (partsA[i] < partsB[i])
44
+ return -1;
45
+ }
46
+ return 0;
47
+ }
48
+ function getProjectVersionFromCwd(agent) {
49
+ const manifestPath = path.join(process.cwd(), '.agents', 'agents.yaml');
50
+ if (!fs.existsSync(manifestPath)) {
51
+ return null;
52
+ }
53
+ try {
54
+ const manifest = readManifest(process.cwd());
55
+ return manifest?.agents?.[agent] || null;
56
+ }
57
+ catch {
58
+ return null;
59
+ }
60
+ }
61
+ /**
62
+ * Show installed versions for one or all agents.
63
+ * Called when: `agents view` or `agents view claude`
64
+ */
65
+ async function showInstalledVersions(filterAgentId) {
66
+ const spinnerText = filterAgentId
67
+ ? `Checking ${agentLabel(filterAgentId)} agents...`
68
+ : 'Checking installed agents...';
69
+ const spinner = ora({ text: spinnerText, isSilent: !process.stdout.isTTY }).start();
70
+ const cliStates = await getAllCliStates();
71
+ spinner.stop();
72
+ const agentsToShow = filterAgentId ? [filterAgentId] : ALL_AGENT_IDS;
73
+ const showPaths = !!filterAgentId;
74
+ // Auto-heal stale versioned aliases. Pre-v2 aliases (e.g. pre-CLAUDE_CONFIG_DIR
75
+ // claude shims) silently route login through the default version's symlinked
76
+ // home, so `agents view` would never reflect the right account. Regenerate on
77
+ // sight — it's safe, idempotent, and fixes the symptom exactly where the user
78
+ // notices it.
79
+ const healedAliases = [];
80
+ for (const agentId of agentsToShow) {
81
+ for (const version of listInstalledVersions(agentId)) {
82
+ const status = ensureVersionedAliasCurrent(agentId, version);
83
+ if (status === 'updated' || status === 'created') {
84
+ healedAliases.push(`${agentId}@${version}`);
85
+ }
86
+ }
87
+ }
88
+ if (healedAliases.length > 0) {
89
+ console.log(chalk.gray(`Refreshed stale shims: ${healedAliases.join(', ')}`));
90
+ console.log();
91
+ }
92
+ console.log(chalk.bold('Installed Agent CLIs\n'));
93
+ // Pre-fetch account info for all versions in parallel
94
+ const infoFetches = [];
95
+ const globalInfoFetches = [];
96
+ for (const agentId of agentsToShow) {
97
+ const versions = listInstalledVersions(agentId);
98
+ if (versions.length > 0) {
99
+ for (const ver of versions) {
100
+ const home = getVersionHomePath(agentId, ver);
101
+ infoFetches.push(getAccountInfo(agentId, home).then((info) => ({
102
+ agentId,
103
+ version: ver,
104
+ home,
105
+ info,
106
+ })));
107
+ }
108
+ }
109
+ else {
110
+ globalInfoFetches.push(getAccountInfo(agentId).then((info) => ({
111
+ agentId,
112
+ cliVersion: cliStates[agentId]?.version || null,
113
+ info,
114
+ })));
115
+ }
116
+ }
117
+ const infoResults = await Promise.all(infoFetches);
118
+ const globalInfoResults = await Promise.all(globalInfoFetches);
119
+ // Build lookup: agentId:version -> AccountInfo
120
+ const infoMap = new Map();
121
+ for (const { agentId, version, info } of infoResults) {
122
+ infoMap.set(`${agentId}:${version}`, info);
123
+ }
124
+ const globalInfoMap = new Map();
125
+ for (const { agentId, info } of globalInfoResults) {
126
+ globalInfoMap.set(agentId, info);
127
+ }
128
+ // Usage status, plan, and overage credits belong to the same underlying account
129
+ // or org scope, not a specific installed version. Version homes cache those
130
+ // values independently, so older installs can show stale values. Reuse the
131
+ // freshest cache entry per stable usage identity and keep lastActive per version.
132
+ const { canonicalByUsageKey, usageByKey } = await getUsageInfoByIdentity([
133
+ ...infoResults.map(({ agentId, home, version, info }) => ({
134
+ agentId,
135
+ home,
136
+ cliVersion: version,
137
+ info,
138
+ })),
139
+ ...globalInfoResults.map(({ agentId, cliVersion, info }) => ({
140
+ agentId,
141
+ cliVersion,
142
+ info,
143
+ })),
144
+ ]);
145
+ const mergeCanonical = (info) => {
146
+ const key = getUsageLookupKey(info);
147
+ if (!key)
148
+ return info;
149
+ const canon = canonicalByUsageKey.get(key);
150
+ if (!canon)
151
+ return info;
152
+ return {
153
+ ...info,
154
+ plan: canon.plan,
155
+ usageStatus: canon.usageStatus,
156
+ overageCredits: canon.overageCredits,
157
+ };
158
+ };
159
+ // Separate version-managed from globally-installed agents
160
+ const versionManaged = [];
161
+ const globallyInstalled = [];
162
+ for (const agentId of agentsToShow) {
163
+ const versions = listInstalledVersions(agentId);
164
+ const cliState = cliStates[agentId];
165
+ if (versions.length > 0) {
166
+ versionManaged.push(agentId);
167
+ }
168
+ else if (cliState?.installed) {
169
+ globallyInstalled.push(agentId);
170
+ }
171
+ }
172
+ // Show version-managed agents
173
+ if (versionManaged.length > 0) {
174
+ // Calculate column widths across all agents for alignment
175
+ let maxVerLabel = 0;
176
+ let maxEmail = 0;
177
+ let maxPlanWidth = 3;
178
+ let maxUsageWidth = 0;
179
+ for (const agentId of versionManaged) {
180
+ const versions = listInstalledVersions(agentId);
181
+ const globalDefault = getGlobalDefault(agentId);
182
+ for (const v of versions) {
183
+ const label = v === globalDefault ? `${v} (default)` : v;
184
+ maxVerLabel = Math.max(maxVerLabel, label.length);
185
+ const rawInfo = infoMap.get(`${agentId}:${v}`);
186
+ const info = rawInfo ? mergeCanonical(rawInfo) : undefined;
187
+ if (info?.email)
188
+ maxEmail = Math.max(maxEmail, info.email.length);
189
+ if (info?.plan)
190
+ maxPlanWidth = Math.max(maxPlanWidth, info.plan.length);
191
+ }
192
+ }
193
+ // Second pass: compute max visible usage width (now that maxPlanWidth is settled)
194
+ for (const agentId of versionManaged) {
195
+ const versions = listInstalledVersions(agentId);
196
+ for (const v of versions) {
197
+ const rawInfo = infoMap.get(`${agentId}:${v}`);
198
+ const info = rawInfo ? mergeCanonical(rawInfo) : undefined;
199
+ const usageKey = getUsageLookupKey(info);
200
+ const usageInfo = usageKey ? usageByKey.get(usageKey) : undefined;
201
+ const usageStr = formatUsageSummary(info?.plan || null, usageInfo?.snapshot || null, maxPlanWidth);
202
+ maxUsageWidth = Math.max(maxUsageWidth, visibleWidth(usageStr));
203
+ }
204
+ }
205
+ for (const agentId of versionManaged) {
206
+ const agent = AGENTS[agentId];
207
+ const versions = listInstalledVersions(agentId);
208
+ const globalDefault = getGlobalDefault(agentId);
209
+ const noDefaultLabel = !globalDefault ? chalk.yellow(' (no default)') : '';
210
+ console.log(` ${chalk.bold(agentLabel(agentId))}${noDefaultLabel}`);
211
+ // Sort versions with default first, then by semver descending
212
+ const sortedVersions = [...versions].sort((a, b) => {
213
+ if (a === globalDefault)
214
+ return -1;
215
+ if (b === globalDefault)
216
+ return 1;
217
+ return compareVersions(b, a);
218
+ });
219
+ for (const version of sortedVersions) {
220
+ const isDefault = version === globalDefault;
221
+ const base = isDefault ? `${version} (default)` : version;
222
+ const padded = base.padEnd(maxVerLabel);
223
+ const label = isDefault ? `${version}${chalk.green(' (default)')}${' '.repeat(maxVerLabel - base.length)}` : padded;
224
+ const rawInfo = infoMap.get(`${agentId}:${version}`);
225
+ const vInfo = rawInfo ? mergeCanonical(rawInfo) : undefined;
226
+ const usageKey = getUsageLookupKey(vInfo);
227
+ const usageInfo = usageKey ? usageByKey.get(usageKey) : undefined;
228
+ // Build columns, trimming trailing whitespace when columns are empty
229
+ const parts = [` ${label}`];
230
+ const hasEmail = !!vInfo?.email;
231
+ const usageStr = formatUsageSummary(vInfo?.plan || null, usageInfo?.snapshot || null, maxPlanWidth);
232
+ const hasUsage = usageStr.length > 0;
233
+ // Only show lastActive for versions with an actual logged-in account.
234
+ // Otherwise it reflects install time (misleading "just now" for fresh installs).
235
+ const activeStr = vInfo && hasEmail ? formatLastActive(vInfo.lastActive) : '';
236
+ const hasActive = activeStr.length > 0;
237
+ if (!hasEmail && !hasUsage) {
238
+ // Installed but never signed in
239
+ parts.push(chalk.gray('(not signed in — run ' + agent.cliCommand + ' to log in)'));
240
+ }
241
+ else {
242
+ if (hasEmail || hasUsage || hasActive) {
243
+ const emailCol = (vInfo?.email || '').padEnd(maxEmail);
244
+ parts.push(hasEmail ? chalk.cyan(emailCol) : ' '.repeat(maxEmail));
245
+ }
246
+ if (hasUsage || hasActive) {
247
+ const usagePad = ' '.repeat(Math.max(0, maxUsageWidth - visibleWidth(usageStr)));
248
+ parts.push(usageStr + usagePad);
249
+ }
250
+ if (hasActive)
251
+ parts.push(activeStr);
252
+ }
253
+ console.log(parts.join(' '));
254
+ if (showPaths) {
255
+ const versionDir = getVersionDir(agentId, version);
256
+ console.log(chalk.gray(` ${versionDir}`));
257
+ }
258
+ }
259
+ // Check for project override
260
+ const projectVersion = getProjectVersionFromCwd(agentId);
261
+ if (projectVersion && projectVersion !== globalDefault) {
262
+ console.log(chalk.cyan(` -> ${projectVersion} (project)`));
263
+ }
264
+ console.log();
265
+ }
266
+ }
267
+ // Show globally installed (not managed) agents
268
+ if (globallyInstalled.length > 0) {
269
+ console.log(chalk.bold('Not Managed by Agents CLI\n'));
270
+ // Calculate max version label width for alignment
271
+ const globalMaxVerLabel = Math.max(...globallyInstalled.map((agentId) => {
272
+ const cliState = cliStates[agentId];
273
+ return `${cliState?.version || 'installed'} (global)`.length;
274
+ }));
275
+ for (const agentId of globallyInstalled) {
276
+ const agent = AGENTS[agentId];
277
+ const cliState = cliStates[agentId];
278
+ console.log(` ${chalk.bold(agentLabel(agentId))}`);
279
+ const gInfoRaw = globalInfoMap.get(agentId);
280
+ const gInfo = gInfoRaw ? mergeCanonical(gInfoRaw) : undefined;
281
+ const verLabel = `${cliState?.version || 'installed'} ${chalk.gray('(global)')}`;
282
+ const verLabelLen = `${cliState?.version || 'installed'} (global)`.length;
283
+ const padding = ' '.repeat(Math.max(0, globalMaxVerLabel - verLabelLen));
284
+ const parts = [` ${verLabel}${padding}`];
285
+ const gUsageKey = getUsageLookupKey(gInfo);
286
+ const gUsage = gUsageKey ? usageByKey.get(gUsageKey) : undefined;
287
+ const gUsageStr = formatUsageSummary(gInfo?.plan || null, gUsage?.snapshot || null);
288
+ const gActiveStr = gInfo ? formatLastActive(gInfo.lastActive) : '';
289
+ if (gInfo?.email || gUsageStr || gActiveStr)
290
+ parts.push(gInfo?.email ? chalk.cyan(gInfo.email) : '');
291
+ if (gUsageStr || gActiveStr)
292
+ parts.push(gUsageStr);
293
+ if (gActiveStr)
294
+ parts.push(gActiveStr);
295
+ console.log(parts.join(' '));
296
+ if (showPaths && cliState?.path) {
297
+ console.log(chalk.gray(` ${cliState.path}`));
298
+ }
299
+ if (agent.npmPackage && cliState?.version) {
300
+ console.log(chalk.gray(` Manage: agents add ${agentId}@${cliState.version} -y`));
301
+ }
302
+ console.log();
303
+ }
304
+ }
305
+ // If filtering to a specific agent and not found
306
+ if (filterAgentId && versionManaged.length === 0 && globallyInstalled.length === 0) {
307
+ console.log(` ${chalk.bold(agentLabel(filterAgentId))}: ${chalk.gray('not installed')}`);
308
+ console.log();
309
+ }
310
+ // No agents installed at all
311
+ if (versionManaged.length === 0 && globallyInstalled.length === 0 && !filterAgentId) {
312
+ console.log(chalk.gray(' No agent CLIs installed.'));
313
+ console.log(chalk.gray(' Run: agents add claude@latest'));
314
+ console.log();
315
+ }
316
+ // Show shims path status at the end (only for full list with managed versions)
317
+ if (versionManaged.length > 0 && !filterAgentId) {
318
+ const shimsDir = getShimsDir();
319
+ if (isShimsInPath()) {
320
+ console.log(chalk.gray(`Shims: ${shimsDir} (in PATH)`));
321
+ }
322
+ else {
323
+ console.log(chalk.yellow(`Shims: ${shimsDir} (not in PATH)`));
324
+ console.log(chalk.gray('Add to PATH for automatic version switching'));
325
+ }
326
+ }
327
+ // Check for new resources when viewing a specific agent
328
+ if (filterAgentId && versionManaged.length > 0) {
329
+ const defaultVersion = getGlobalDefault(filterAgentId);
330
+ if (defaultVersion) {
331
+ const available = getAvailableResources();
332
+ const synced = getActuallySyncedResources(filterAgentId, defaultVersion);
333
+ const newResources = getNewResources(available, synced);
334
+ if (hasNewResources(newResources, filterAgentId)) {
335
+ try {
336
+ const selection = await promptNewResourceSelection(filterAgentId, newResources);
337
+ if (selection && Object.keys(selection).length > 0) {
338
+ const result = syncResourcesToVersion(filterAgentId, defaultVersion, selection);
339
+ const synced = [];
340
+ if (result.commands)
341
+ synced.push('commands');
342
+ if (result.skills)
343
+ synced.push('skills');
344
+ if (result.hooks)
345
+ synced.push('hooks');
346
+ if (result.memory.length > 0)
347
+ synced.push('memory');
348
+ if (result.permissions)
349
+ synced.push('permissions');
350
+ if (result.mcp.length > 0)
351
+ synced.push('mcp');
352
+ if (result.plugins.length > 0)
353
+ synced.push('plugins');
354
+ if (synced.length > 0) {
355
+ console.log(chalk.green(`\nSynced to ${agentLabel(filterAgentId)}@${defaultVersion}: ${synced.join(', ')}`));
356
+ }
357
+ }
358
+ }
359
+ catch (err) {
360
+ if (isPromptCancelled(err))
361
+ return;
362
+ throw err;
363
+ }
364
+ }
365
+ }
366
+ }
367
+ }
368
+ /**
369
+ * Show detailed resources for a specific agent version.
370
+ * Called when: `agents view claude@2.0.65` or `agents view claude@default`
371
+ */
372
+ async function showAgentResources(agentId, requestedVersion) {
373
+ const spinner = ora({ text: 'Loading...', isSilent: !process.stdout.isTTY }).start();
374
+ const cwd = process.cwd();
375
+ const agentsDir = getAgentsDir();
376
+ const cliStates = await getAllCliStates();
377
+ // Resolve 'default' to actual version
378
+ let version = null;
379
+ if (requestedVersion === 'default') {
380
+ version = getGlobalDefault(agentId);
381
+ if (!version) {
382
+ spinner.stop();
383
+ console.log(chalk.yellow(`No default version set for ${agentLabel(agentId)}`));
384
+ console.log(chalk.gray(`Run: agents use ${agentId}@<version>`));
385
+ return;
386
+ }
387
+ }
388
+ else {
389
+ const versions = listInstalledVersions(agentId);
390
+ if (versions.includes(requestedVersion)) {
391
+ version = requestedVersion;
392
+ }
393
+ else {
394
+ spinner.stop();
395
+ console.log(chalk.red(`Version ${requestedVersion} not installed for ${agentLabel(agentId)}`));
396
+ console.log(chalk.gray(`Installed versions: ${versions.join(', ') || 'none'}`));
397
+ return;
398
+ }
399
+ }
400
+ const home = getVersionHomePath(agentId, version);
401
+ // Get git sync status if ~/.agents/ is a git repo
402
+ const hasGitRepo = isGitRepo(agentsDir);
403
+ const commandsSync = hasGitRepo ? await getGitSyncStatus(agentsDir, 'commands') : null;
404
+ const skillsSync = hasGitRepo ? await getGitSyncStatus(agentsDir, 'skills') : null;
405
+ const hooksSync = hasGitRepo ? await getGitSyncStatus(agentsDir, 'hooks') : null;
406
+ const memorySync = hasGitRepo ? await getGitSyncStatus(agentsDir, 'memory') : null;
407
+ // Helper to determine sync state for a resource
408
+ const getSyncState = (resourceName, resourceType, syncStatus) => {
409
+ if (!syncStatus)
410
+ return undefined;
411
+ let relativePath;
412
+ if (resourceType === 'commands') {
413
+ relativePath = `commands/${resourceName}.md`;
414
+ }
415
+ else if (resourceType === 'skills') {
416
+ relativePath = `skills/${resourceName}`;
417
+ }
418
+ else if (resourceType === 'hooks') {
419
+ relativePath = `hooks/${resourceName}`;
420
+ }
421
+ else {
422
+ // Memory files: map agent-specific name (CLAUDE.md) back to canonical (AGENTS.md)
423
+ const centralName = getCentralMemoryFileName(agentId);
424
+ relativePath = `memory/${centralName}`;
425
+ }
426
+ const matchesPath = (f) => f === relativePath || f.startsWith(relativePath + '/');
427
+ const isNew = syncStatus.new.some(matchesPath);
428
+ const isStaged = syncStatus.staged.some(matchesPath);
429
+ const isModified = syncStatus.modified.some(matchesPath);
430
+ const isDeleted = syncStatus.deleted.some(matchesPath);
431
+ const isSynced = syncStatus.synced.some(matchesPath);
432
+ if (isNew || isStaged) {
433
+ return 'new';
434
+ }
435
+ if (isModified) {
436
+ return 'modified';
437
+ }
438
+ if (isDeleted) {
439
+ return 'deleted';
440
+ }
441
+ if (isSynced) {
442
+ return 'synced';
443
+ }
444
+ // Not in any array = local-only (untracked with no files)
445
+ return 'new';
446
+ };
447
+ const resources = getAgentResources(agentId, {
448
+ cwd,
449
+ scope: 'all',
450
+ cliInstalled: cliStates[agentId]?.installed ?? false,
451
+ home,
452
+ });
453
+ const agentData = {
454
+ agentId,
455
+ agentName: agentLabel(agentId),
456
+ version,
457
+ commands: resources.commands.map(r => ({
458
+ ...r,
459
+ syncState: r.scope === 'project' ? undefined : getSyncState(r.name, 'commands', commandsSync),
460
+ })),
461
+ skills: resources.skills.map(r => ({
462
+ ...r,
463
+ syncState: r.scope === 'project' ? undefined : getSyncState(r.name, 'skills', skillsSync),
464
+ })),
465
+ skillErrors: resources.skillErrors,
466
+ mcp: resources.mcp.map(r => ({ name: r.name, scope: r.scope, syncState: r.scope === 'project' ? undefined : 'synced' })),
467
+ memory: resources.memory.map(r => ({
468
+ ...r,
469
+ syncState: r.scope === 'project' ? undefined : getSyncState(r.name, 'memory', memorySync),
470
+ })),
471
+ hooks: resources.hooks.map(r => ({
472
+ ...r,
473
+ syncState: r.scope === 'project' ? undefined : getSyncState(r.name, 'hooks', hooksSync),
474
+ })),
475
+ };
476
+ spinner.stop();
477
+ // Render helper for resources
478
+ function renderSection(title, items) {
479
+ console.log(chalk.bold(`\n${title}\n`));
480
+ if (items.length === 0) {
481
+ console.log(` ${chalk.gray('none')}`);
482
+ return;
483
+ }
484
+ const versionStr = agentData.version ? ` (${agentData.version})` : '';
485
+ console.log(` ${chalk.bold(agentData.agentName)}${chalk.gray(versionStr)}:`);
486
+ for (const r of items) {
487
+ let nameColor = chalk.cyan;
488
+ if (r.syncState === 'synced')
489
+ nameColor = chalk.green;
490
+ else if (r.syncState === 'new')
491
+ nameColor = chalk.blue;
492
+ else if (r.syncState === 'modified')
493
+ nameColor = chalk.yellow;
494
+ else if (r.syncState === 'deleted')
495
+ nameColor = chalk.red;
496
+ let display = nameColor(r.name);
497
+ if (r.ruleCount !== undefined)
498
+ display += chalk.gray(` (${r.ruleCount} rules)`);
499
+ if (r.scope === 'project') {
500
+ display += chalk.gray(' [project]');
501
+ }
502
+ const pathStr = r.path ? chalk.gray(formatPath(r.path, cwd)) : '';
503
+ const syncStr = r.syncState ? chalk.gray(` [${r.syncState}]`) : '';
504
+ console.log(` ${display.padEnd(24)} ${pathStr}${syncStr}`);
505
+ }
506
+ }
507
+ // Render the single ~/.agents/promptcuts.yaml (cross-agent, not per-version).
508
+ // Reads the file to surface the shortcut count — cheap (<1KB typical).
509
+ function renderPromptcuts() {
510
+ console.log(chalk.bold(`\nPromptcuts\n`));
511
+ const promptcutsPath = getPromptcutsPath();
512
+ if (!fs.existsSync(promptcutsPath)) {
513
+ console.log(` ${chalk.gray('none')}`);
514
+ return;
515
+ }
516
+ let count = 0;
517
+ try {
518
+ const parsed = yaml.parse(fs.readFileSync(promptcutsPath, 'utf-8'));
519
+ count = parsed?.shortcuts ? Object.keys(parsed.shortcuts).length : 0;
520
+ }
521
+ catch {
522
+ count = 0;
523
+ }
524
+ const label = `${count} shortcut${count === 1 ? '' : 's'}`;
525
+ console.log(` ${chalk.green(label).padEnd(24)} ${chalk.gray(formatPath(promptcutsPath, cwd))}`);
526
+ }
527
+ // 1. Agent CLI info
528
+ console.log(chalk.bold('Agent CLIs\n'));
529
+ const accountInfo = await getAccountInfo(agentId, home);
530
+ const usageInfo = await getUsageInfoForIdentity({
531
+ agentId,
532
+ home,
533
+ cliVersion: version,
534
+ info: accountInfo,
535
+ });
536
+ const emailStr = accountInfo.email ? chalk.cyan(` ${accountInfo.email}`) : '';
537
+ const status = chalk.green(version);
538
+ const usageStr = formatUsageSummary(accountInfo.plan, null);
539
+ const usagePart = usageStr ? ` ${usageStr}` : '';
540
+ console.log(` ${colorAgent(agentId)(AGENTS[agentId].name.padEnd(14))} ${status}${emailStr}${usagePart}`);
541
+ const usageLines = formatUsageSection(usageInfo);
542
+ if (usageLines.length > 0) {
543
+ console.log();
544
+ for (const line of usageLines) {
545
+ console.log(line);
546
+ }
547
+ }
548
+ // 2. Resources
549
+ renderSection('Commands', agentData.commands);
550
+ renderSection('Skills', agentData.skills);
551
+ // Show skill parse errors if any
552
+ if (agentData.skillErrors.length > 0) {
553
+ console.log(`\n ${chalk.red('Skill Errors')}:`);
554
+ for (const err of agentData.skillErrors) {
555
+ console.log(` ${chalk.red(err.name.padEnd(20))} ${chalk.gray(err.error)}`);
556
+ console.log(` ${chalk.gray(formatPath(err.path, cwd))}`);
557
+ }
558
+ }
559
+ renderSection('MCP Servers', agentData.mcp);
560
+ renderSection('Rules', agentData.memory);
561
+ renderSection('Hooks', agentData.hooks);
562
+ renderPromptcuts();
563
+ // Show legend at the end if git repo exists
564
+ if (hasGitRepo) {
565
+ console.log();
566
+ console.log(chalk.gray('Legend:'), chalk.green('Tracked'), chalk.blue('Local-only'), chalk.yellow('Modified'), chalk.red('Deleted'));
567
+ }
568
+ }
569
+ /**
570
+ * Main view action handler.
571
+ * Exported for use by deprecated aliases.
572
+ */
573
+ export async function viewAction(agentArg) {
574
+ if (!agentArg) {
575
+ // No argument: show all installed versions
576
+ await showInstalledVersions();
577
+ return;
578
+ }
579
+ // Parse agent@version syntax
580
+ const parts = agentArg.split('@');
581
+ const agentName = parts[0];
582
+ const requestedVersion = parts[1] || null;
583
+ const agentId = resolveAgentName(agentName);
584
+ if (!agentId) {
585
+ console.log(chalk.red(formatAgentError(agentName)));
586
+ process.exit(1);
587
+ }
588
+ if (requestedVersion) {
589
+ // Specific version requested: show detailed resources
590
+ await showAgentResources(agentId, requestedVersion);
591
+ }
592
+ else {
593
+ // Just agent name: show versions for that agent
594
+ await showInstalledVersions(agentId);
595
+ }
596
+ }
597
+ export function registerViewCommand(program) {
598
+ program
599
+ .command('view [agent]')
600
+ .description('Show what agent CLIs are installed and which versions you have. Inspect resources when you pass agent@version.')
601
+ .addHelpText('after', `
602
+ Examples:
603
+ # Show all installed agents with versions, accounts, and usage
604
+ agents view
605
+
606
+ # Show versions for one agent
607
+ agents view claude
608
+
609
+ # Detailed view: resources, commands, skills, MCP servers for a specific version
610
+ agents view claude@2.1.112
611
+ agents view claude@default
612
+
613
+ When to use:
614
+ - Checking which agents are installed and what their default versions are
615
+ - Seeing which account each version is logged into (useful for multi-account setups)
616
+ - Inspecting commands, skills, hooks, and MCP servers synced to a version
617
+ - Verifying a version is installed before running it
618
+
619
+ Output:
620
+ - Without arguments: table of all agents with versions, emails, usage stats
621
+ - With agent name: versions for that agent, showing which is the default
622
+ - With agent@version: detailed breakdown of resources synced to that version
623
+ `)
624
+ .action(viewAction);
625
+ }
626
+ //# sourceMappingURL=view.js.map