@codyswann/lisa 4.80.1 → 4.81.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 (335) hide show
  1. package/README.md +6 -3
  2. package/all/copy-contents/gitignore +5 -0
  3. package/cdk/package-lisa/package.lisa.json +0 -2
  4. package/dist/cli/doctor-cdk-preset-adoption.js +2 -2
  5. package/dist/cli/doctor-cdk-preset-adoption.js.map +1 -1
  6. package/dist/cli/doctor-session-manager-trust.d.ts +62 -0
  7. package/dist/cli/doctor-session-manager-trust.d.ts.map +1 -0
  8. package/dist/cli/doctor-session-manager-trust.js +174 -0
  9. package/dist/cli/doctor-session-manager-trust.js.map +1 -0
  10. package/dist/cli/doctor-session-manager.d.ts +35 -0
  11. package/dist/cli/doctor-session-manager.d.ts.map +1 -0
  12. package/dist/cli/doctor-session-manager.js +209 -0
  13. package/dist/cli/doctor-session-manager.js.map +1 -0
  14. package/dist/cli/doctor.d.ts.map +1 -1
  15. package/dist/cli/doctor.js +3 -0
  16. package/dist/cli/doctor.js.map +1 -1
  17. package/dist/cli/lisa-test-run-bootstrap.js +28 -0
  18. package/dist/cli/lisa-test-run-bootstrap.js.map +1 -1
  19. package/dist/cli/session-manager-config-merge.d.ts +25 -0
  20. package/dist/cli/session-manager-config-merge.d.ts.map +1 -0
  21. package/dist/cli/session-manager-config-merge.js +54 -0
  22. package/dist/cli/session-manager-config-merge.js.map +1 -0
  23. package/dist/core/cdk-preset-adoption.d.ts +7 -2
  24. package/dist/core/cdk-preset-adoption.d.ts.map +1 -1
  25. package/dist/core/cdk-preset-adoption.js +10 -2
  26. package/dist/core/cdk-preset-adoption.js.map +1 -1
  27. package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
  28. package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
  29. package/dist/core/upstream-evidence-manifest.js +258 -13
  30. package/dist/core/upstream-evidence-manifest.js.map +1 -1
  31. package/package.json +4 -4
  32. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  33. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  34. package/plugins/lisa/.codex-plugin/skills/lisa-automation-status/SKILL.md +10 -0
  35. package/plugins/lisa/.codex-plugin/skills/lisa-implement/SKILL.md +17 -2
  36. package/plugins/lisa/.codex-plugin/skills/lisa-secrets-access/scripts/validate-config.mjs +377 -5
  37. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/SKILL.md +287 -0
  38. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/agents/openai.yaml +4 -0
  39. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/references/runbook-template.md +66 -0
  40. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/capacity.mjs +186 -0
  41. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-cycle.mjs +262 -0
  42. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-manager.mjs +308 -0
  43. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-queue.mjs +148 -0
  44. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-runtime.mjs +326 -0
  45. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-usage.mjs +114 -0
  46. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-workers.mjs +295 -0
  47. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/config.mjs +265 -0
  48. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/isolation.mjs +130 -0
  49. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/launch.mjs +234 -0
  50. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/ledger.mjs +445 -0
  51. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/reconcile.mjs +134 -0
  52. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/session-manager.mjs +274 -0
  53. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/state-dir.mjs +112 -0
  54. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/telegram-route.mjs +210 -0
  55. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/token.mjs +191 -0
  56. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/worker-launch.mjs +92 -0
  57. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/workers.mjs +406 -0
  58. package/plugins/lisa/.codex-plugin/skills/lisa-setup-session-manager/SKILL.md +158 -0
  59. package/plugins/lisa/.codex-plugin/skills/lisa-setup-session-manager/agents/openai.yaml +4 -0
  60. package/plugins/lisa/.codex-plugin/skills/lisa-tear-down-automations/SKILL.md +10 -0
  61. package/plugins/lisa/commands/implement.md +2 -2
  62. package/plugins/lisa/commands/session-manager.md +7 -0
  63. package/plugins/lisa/commands/setup/session-manager.md +6 -0
  64. package/plugins/lisa/rules/reference/automation-runbook-contract.md +14 -0
  65. package/plugins/lisa/rules/reference/config-resolution.md +58 -0
  66. package/plugins/lisa/scripts/automation-status-claude-adapter.mjs +4 -1
  67. package/plugins/lisa/scripts/automation-status-codex-adapter.mjs +4 -1
  68. package/plugins/lisa/scripts/automation-status-expected-fleet.mjs +98 -0
  69. package/plugins/lisa/scripts/automation-status-run-history.mjs +29 -7
  70. package/plugins/lisa/scripts/ready-queue-order.mjs +352 -0
  71. package/plugins/lisa/skills/lisa-automation-status/SKILL.md +10 -0
  72. package/plugins/lisa/skills/lisa-implement/SKILL.md +17 -2
  73. package/plugins/lisa/skills/lisa-secrets-access/scripts/validate-config.mjs +377 -5
  74. package/plugins/lisa/skills/lisa-session-manager/SKILL.md +285 -0
  75. package/plugins/lisa/skills/lisa-session-manager/agents/openai.yaml +4 -0
  76. package/plugins/lisa/skills/lisa-session-manager/references/runbook-template.md +66 -0
  77. package/plugins/lisa/skills/lisa-session-manager/scripts/capacity.mjs +186 -0
  78. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-cycle.mjs +262 -0
  79. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-manager.mjs +308 -0
  80. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-queue.mjs +148 -0
  81. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-runtime.mjs +326 -0
  82. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-usage.mjs +114 -0
  83. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-workers.mjs +295 -0
  84. package/plugins/lisa/skills/lisa-session-manager/scripts/config.mjs +265 -0
  85. package/plugins/lisa/skills/lisa-session-manager/scripts/isolation.mjs +130 -0
  86. package/plugins/lisa/skills/lisa-session-manager/scripts/launch.mjs +234 -0
  87. package/plugins/lisa/skills/lisa-session-manager/scripts/ledger.mjs +445 -0
  88. package/plugins/lisa/skills/lisa-session-manager/scripts/reconcile.mjs +134 -0
  89. package/plugins/lisa/skills/lisa-session-manager/scripts/session-manager.mjs +274 -0
  90. package/plugins/lisa/skills/lisa-session-manager/scripts/state-dir.mjs +112 -0
  91. package/plugins/lisa/skills/lisa-session-manager/scripts/telegram-route.mjs +210 -0
  92. package/plugins/lisa/skills/lisa-session-manager/scripts/token.mjs +191 -0
  93. package/plugins/lisa/skills/lisa-session-manager/scripts/worker-launch.mjs +92 -0
  94. package/plugins/lisa/skills/lisa-session-manager/scripts/workers.mjs +406 -0
  95. package/plugins/lisa/skills/lisa-setup-session-manager/SKILL.md +156 -0
  96. package/plugins/lisa/skills/lisa-setup-session-manager/agents/openai.yaml +4 -0
  97. package/plugins/lisa/skills/lisa-tear-down-automations/SKILL.md +10 -0
  98. package/plugins/lisa-agy/commands/lisa/implement.md +2 -2
  99. package/plugins/lisa-agy/commands/lisa/session-manager.md +7 -0
  100. package/plugins/lisa-agy/commands/lisa/setup/session-manager.md +6 -0
  101. package/plugins/lisa-agy/plugin.json +1 -1
  102. package/plugins/lisa-agy/scripts/automation-status-claude-adapter.mjs +4 -1
  103. package/plugins/lisa-agy/scripts/automation-status-codex-adapter.mjs +4 -1
  104. package/plugins/lisa-agy/scripts/automation-status-expected-fleet.mjs +98 -0
  105. package/plugins/lisa-agy/scripts/automation-status-run-history.mjs +29 -7
  106. package/plugins/lisa-agy/scripts/ready-queue-order.mjs +352 -0
  107. package/plugins/lisa-agy/skills/lisa-automation-status/SKILL.md +10 -0
  108. package/plugins/lisa-agy/skills/lisa-implement/SKILL.md +17 -2
  109. package/plugins/lisa-agy/skills/lisa-secrets-access/scripts/validate-config.mjs +377 -5
  110. package/plugins/lisa-agy/skills/lisa-session-manager/SKILL.md +285 -0
  111. package/plugins/lisa-agy/skills/lisa-session-manager/references/runbook-template.md +66 -0
  112. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/capacity.mjs +186 -0
  113. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-cycle.mjs +262 -0
  114. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-manager.mjs +308 -0
  115. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-queue.mjs +148 -0
  116. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-runtime.mjs +326 -0
  117. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-usage.mjs +114 -0
  118. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-workers.mjs +295 -0
  119. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/config.mjs +265 -0
  120. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/isolation.mjs +130 -0
  121. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/launch.mjs +234 -0
  122. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/ledger.mjs +445 -0
  123. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/reconcile.mjs +134 -0
  124. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/session-manager.mjs +274 -0
  125. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/state-dir.mjs +112 -0
  126. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/telegram-route.mjs +210 -0
  127. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/token.mjs +191 -0
  128. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/worker-launch.mjs +92 -0
  129. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/workers.mjs +406 -0
  130. package/plugins/lisa-agy/skills/lisa-setup-session-manager/SKILL.md +156 -0
  131. package/plugins/lisa-agy/skills/lisa-tear-down-automations/SKILL.md +10 -0
  132. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  133. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  134. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  135. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  136. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  137. package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
  138. package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
  139. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  140. package/plugins/lisa-copilot/commands/lisa/implement.md +2 -2
  141. package/plugins/lisa-copilot/commands/lisa/session-manager.md +7 -0
  142. package/plugins/lisa-copilot/commands/lisa/setup/session-manager.md +6 -0
  143. package/plugins/lisa-copilot/rules/reference/automation-runbook-contract.md +14 -0
  144. package/plugins/lisa-copilot/rules/reference/config-resolution.md +58 -0
  145. package/plugins/lisa-copilot/scripts/automation-status-claude-adapter.mjs +4 -1
  146. package/plugins/lisa-copilot/scripts/automation-status-codex-adapter.mjs +4 -1
  147. package/plugins/lisa-copilot/scripts/automation-status-expected-fleet.mjs +98 -0
  148. package/plugins/lisa-copilot/scripts/automation-status-run-history.mjs +29 -7
  149. package/plugins/lisa-copilot/scripts/ready-queue-order.mjs +352 -0
  150. package/plugins/lisa-copilot/skills/lisa-automation-status/SKILL.md +10 -0
  151. package/plugins/lisa-copilot/skills/lisa-implement/SKILL.md +17 -2
  152. package/plugins/lisa-copilot/skills/lisa-secrets-access/scripts/validate-config.mjs +377 -5
  153. package/plugins/lisa-copilot/skills/lisa-session-manager/SKILL.md +285 -0
  154. package/plugins/lisa-copilot/skills/lisa-session-manager/references/runbook-template.md +66 -0
  155. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/capacity.mjs +186 -0
  156. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-cycle.mjs +262 -0
  157. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-manager.mjs +308 -0
  158. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-queue.mjs +148 -0
  159. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-runtime.mjs +326 -0
  160. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-usage.mjs +114 -0
  161. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-workers.mjs +295 -0
  162. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/config.mjs +265 -0
  163. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/isolation.mjs +130 -0
  164. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/launch.mjs +234 -0
  165. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/ledger.mjs +445 -0
  166. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/reconcile.mjs +134 -0
  167. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/session-manager.mjs +274 -0
  168. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/state-dir.mjs +112 -0
  169. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/telegram-route.mjs +210 -0
  170. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/token.mjs +191 -0
  171. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/worker-launch.mjs +92 -0
  172. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/workers.mjs +406 -0
  173. package/plugins/lisa-copilot/skills/lisa-setup-session-manager/SKILL.md +156 -0
  174. package/plugins/lisa-copilot/skills/lisa-tear-down-automations/SKILL.md +10 -0
  175. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  176. package/plugins/lisa-cursor/commands/lisa/implement.md +2 -2
  177. package/plugins/lisa-cursor/commands/lisa/session-manager.md +7 -0
  178. package/plugins/lisa-cursor/commands/lisa/setup/session-manager.md +6 -0
  179. package/plugins/lisa-cursor/rules/automation-runbook-contract-reference.mdc +14 -0
  180. package/plugins/lisa-cursor/rules/config-resolution-reference.mdc +58 -0
  181. package/plugins/lisa-cursor/scripts/automation-status-claude-adapter.mjs +4 -1
  182. package/plugins/lisa-cursor/scripts/automation-status-codex-adapter.mjs +4 -1
  183. package/plugins/lisa-cursor/scripts/automation-status-expected-fleet.mjs +98 -0
  184. package/plugins/lisa-cursor/scripts/automation-status-run-history.mjs +29 -7
  185. package/plugins/lisa-cursor/scripts/ready-queue-order.mjs +352 -0
  186. package/plugins/lisa-cursor/skills/lisa-automation-status/SKILL.md +10 -0
  187. package/plugins/lisa-cursor/skills/lisa-implement/SKILL.md +17 -2
  188. package/plugins/lisa-cursor/skills/lisa-secrets-access/scripts/validate-config.mjs +377 -5
  189. package/plugins/lisa-cursor/skills/lisa-session-manager/SKILL.md +285 -0
  190. package/plugins/lisa-cursor/skills/lisa-session-manager/references/runbook-template.md +66 -0
  191. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/capacity.mjs +186 -0
  192. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-cycle.mjs +262 -0
  193. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-manager.mjs +308 -0
  194. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-queue.mjs +148 -0
  195. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-runtime.mjs +326 -0
  196. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-usage.mjs +114 -0
  197. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-workers.mjs +295 -0
  198. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/config.mjs +265 -0
  199. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/isolation.mjs +130 -0
  200. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/launch.mjs +234 -0
  201. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/ledger.mjs +445 -0
  202. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/reconcile.mjs +134 -0
  203. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/session-manager.mjs +274 -0
  204. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/state-dir.mjs +112 -0
  205. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/telegram-route.mjs +210 -0
  206. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/token.mjs +191 -0
  207. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/worker-launch.mjs +92 -0
  208. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/workers.mjs +406 -0
  209. package/plugins/lisa-cursor/skills/lisa-setup-session-manager/SKILL.md +156 -0
  210. package/plugins/lisa-cursor/skills/lisa-tear-down-automations/SKILL.md +10 -0
  211. package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
  212. package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
  213. package/plugins/lisa-devin/rules/reference/automation-runbook-contract.md +14 -0
  214. package/plugins/lisa-devin/rules/reference/config-resolution.md +58 -0
  215. package/plugins/lisa-devin/scripts/automation-status-claude-adapter.mjs +4 -1
  216. package/plugins/lisa-devin/scripts/automation-status-codex-adapter.mjs +4 -1
  217. package/plugins/lisa-devin/scripts/automation-status-expected-fleet.mjs +98 -0
  218. package/plugins/lisa-devin/scripts/automation-status-run-history.mjs +29 -7
  219. package/plugins/lisa-devin/scripts/ready-queue-order.mjs +352 -0
  220. package/plugins/lisa-devin/skills/lisa-automation-status/SKILL.md +10 -0
  221. package/plugins/lisa-devin/skills/lisa-implement/SKILL.md +17 -2
  222. package/plugins/lisa-devin/skills/lisa-secrets-access/scripts/validate-config.mjs +377 -5
  223. package/plugins/lisa-devin/skills/lisa-session-manager/SKILL.md +285 -0
  224. package/plugins/lisa-devin/skills/lisa-session-manager/references/runbook-template.md +66 -0
  225. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/capacity.mjs +186 -0
  226. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-cycle.mjs +262 -0
  227. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-manager.mjs +308 -0
  228. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-queue.mjs +148 -0
  229. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-runtime.mjs +326 -0
  230. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-usage.mjs +114 -0
  231. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-workers.mjs +295 -0
  232. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/config.mjs +265 -0
  233. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/isolation.mjs +130 -0
  234. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/launch.mjs +234 -0
  235. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/ledger.mjs +445 -0
  236. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/reconcile.mjs +134 -0
  237. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/session-manager.mjs +274 -0
  238. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/state-dir.mjs +112 -0
  239. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/telegram-route.mjs +210 -0
  240. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/token.mjs +191 -0
  241. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/worker-launch.mjs +92 -0
  242. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/workers.mjs +406 -0
  243. package/plugins/lisa-devin/skills/lisa-setup-session-manager/SKILL.md +156 -0
  244. package/plugins/lisa-devin/skills/lisa-tear-down-automations/SKILL.md +10 -0
  245. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  246. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  247. package/plugins/lisa-expo-agy/plugin.json +1 -1
  248. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  249. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  250. package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
  251. package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
  252. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  253. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  254. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  255. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  256. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  257. package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
  258. package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
  259. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  260. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  261. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  262. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  263. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  264. package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
  265. package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
  266. package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
  267. package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
  268. package/plugins/lisa-openclaw-agy/plugin.json +1 -1
  269. package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
  270. package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
  271. package/plugins/lisa-openclaw-devin/.claude-plugin/plugin.json +1 -1
  272. package/plugins/lisa-openclaw-devin/.devin-plugin/plugin.json +1 -1
  273. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  274. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  275. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  276. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  277. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  278. package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
  279. package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
  280. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  281. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  282. package/plugins/lisa-rails-agy/plugin.json +1 -1
  283. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  284. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  285. package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
  286. package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
  287. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  288. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  289. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  290. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  291. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  292. package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
  293. package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
  294. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  295. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  296. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  297. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  298. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  299. package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
  300. package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
  301. package/plugins/src/base/commands/implement.md +2 -2
  302. package/plugins/src/base/commands/session-manager.md +7 -0
  303. package/plugins/src/base/commands/setup/session-manager.md +6 -0
  304. package/plugins/src/base/rules/reference/automation-runbook-contract.md +14 -0
  305. package/plugins/src/base/rules/reference/config-resolution.md +58 -0
  306. package/plugins/src/base/scripts/automation-status-claude-adapter.mjs +4 -1
  307. package/plugins/src/base/scripts/automation-status-codex-adapter.mjs +4 -1
  308. package/plugins/src/base/scripts/automation-status-expected-fleet.mjs +98 -0
  309. package/plugins/src/base/scripts/automation-status-run-history.mjs +29 -7
  310. package/plugins/src/base/scripts/ready-queue-order.mjs +352 -0
  311. package/plugins/src/base/skills/lisa-automation-status/SKILL.md +10 -0
  312. package/plugins/src/base/skills/lisa-implement/SKILL.md +17 -2
  313. package/plugins/src/base/skills/lisa-secrets-access/scripts/validate-config.mjs +377 -5
  314. package/plugins/src/base/skills/lisa-session-manager/SKILL.md +285 -0
  315. package/plugins/src/base/skills/lisa-session-manager/references/runbook-template.md +66 -0
  316. package/plugins/src/base/skills/lisa-session-manager/scripts/capacity.mjs +186 -0
  317. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-cycle.mjs +262 -0
  318. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-manager.mjs +308 -0
  319. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-queue.mjs +148 -0
  320. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-runtime.mjs +326 -0
  321. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-usage.mjs +114 -0
  322. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-workers.mjs +295 -0
  323. package/plugins/src/base/skills/lisa-session-manager/scripts/config.mjs +265 -0
  324. package/plugins/src/base/skills/lisa-session-manager/scripts/isolation.mjs +130 -0
  325. package/plugins/src/base/skills/lisa-session-manager/scripts/launch.mjs +234 -0
  326. package/plugins/src/base/skills/lisa-session-manager/scripts/ledger.mjs +445 -0
  327. package/plugins/src/base/skills/lisa-session-manager/scripts/reconcile.mjs +134 -0
  328. package/plugins/src/base/skills/lisa-session-manager/scripts/session-manager.mjs +274 -0
  329. package/plugins/src/base/skills/lisa-session-manager/scripts/state-dir.mjs +112 -0
  330. package/plugins/src/base/skills/lisa-session-manager/scripts/telegram-route.mjs +210 -0
  331. package/plugins/src/base/skills/lisa-session-manager/scripts/token.mjs +191 -0
  332. package/plugins/src/base/skills/lisa-session-manager/scripts/worker-launch.mjs +92 -0
  333. package/plugins/src/base/skills/lisa-session-manager/scripts/workers.mjs +406 -0
  334. package/plugins/src/base/skills/lisa-setup-session-manager/SKILL.md +156 -0
  335. package/plugins/src/base/skills/lisa-tear-down-automations/SKILL.md +10 -0
@@ -0,0 +1,148 @@
1
+ /**
2
+ * The `queue` subcommand of the session-manager CLI: the Ready queue, mine
3
+ * first, paged to completion.
4
+ *
5
+ * "Page to completion" is executable here rather than prose. GitHub is
6
+ * fetched by this module with `gh api --paginate --slurp`, so every page is
7
+ * read or the command fails. Jira and Linear are fetched by their vendor
8
+ * skills (a script cannot reach them), which write an envelope
9
+ * `{complete, pages, items}`; anything but a literal `complete: true` is
10
+ * refused with exit 2, because ordering a partial queue would dispatch the
11
+ * wrong item with full confidence.
12
+ * @module session-manager/cli-queue
13
+ */
14
+ import { readFileSync } from "node:fs";
15
+
16
+ import {
17
+ assertPagedToCompletion,
18
+ normalizeGithubIssue,
19
+ normalizeJiraIssue,
20
+ normalizeLinearIssue,
21
+ orderReadyQueue,
22
+ } from "../../../scripts/ready-queue-order.mjs";
23
+ import { resolveRole } from "../../../scripts/resolve-lifecycle-role.mjs";
24
+ import {
25
+ CliError,
26
+ asSetupError,
27
+ humanNeededLabel,
28
+ loadProject,
29
+ mustRun,
30
+ validOrAbsent,
31
+ } from "./cli-runtime.mjs";
32
+ import { readLedger } from "./ledger.mjs";
33
+ import { scrubWorkerEnv } from "./workers.mjs";
34
+
35
+ const NORMALIZERS = { jira: normalizeJiraIssue, linear: normalizeLinearIssue };
36
+
37
+ const OWNER_REPO = /^[\w.-]+\/[\w.-]+$/;
38
+
39
+ /**
40
+ * Parse JSON, or exit 2 naming the source.
41
+ * @param {string} text - JSON text
42
+ * @param {string} source - Where it came from
43
+ * @returns {any} Parsed value
44
+ */
45
+ export function parseJson(text, source) {
46
+ try {
47
+ return JSON.parse(text);
48
+ } catch (error) {
49
+ throw new CliError(`${source} is not valid JSON: ${error.message}`, 2);
50
+ }
51
+ }
52
+
53
+ /**
54
+ * Read a JSON file named by a flag, or exit 2.
55
+ * @param {string} file - Path
56
+ * @returns {any} Parsed value
57
+ */
58
+ export function readJsonFile(file) {
59
+ const text = asSetupError(() => readFileSync(file, "utf8"));
60
+ return parseJson(text, file);
61
+ }
62
+
63
+ /**
64
+ * Fetch every open GitHub issue carrying the ready label, all pages.
65
+ * @param {object} ctx - CLI context
66
+ * @param {ReturnType<typeof loadProject>} project - Loaded project
67
+ * @returns {{ items: object[], pages: number }} Normalized items
68
+ */
69
+ function fetchGithubQueue(ctx, project) {
70
+ const merged = { ...project.global?.github, ...project.local?.github };
71
+ const repo =
72
+ ctx.values["github-repo"] ??
73
+ (merged.org && merged.repo ? `${merged.org}/${merged.repo}` : "");
74
+ if (!OWNER_REPO.test(repo)) {
75
+ throw new CliError(
76
+ "No GitHub repo: set github.org and github.repo, or pass --github-repo <owner/repo>.",
77
+ 2
78
+ );
79
+ }
80
+ const role = resolveRole({
81
+ role: "ready",
82
+ vendor: "github",
83
+ intent: "read",
84
+ local: project.local,
85
+ global: project.global,
86
+ });
87
+ const label = ctx.values.label ?? role.value;
88
+ if (!label) throw new CliError(role.message, 2);
89
+ const endpoint =
90
+ `repos/${repo}/issues?state=open&labels=${encodeURIComponent(label)}` +
91
+ `&per_page=100`;
92
+ const stdout = mustRun("gh", ["api", "--paginate", "--slurp", endpoint], {
93
+ env: scrubWorkerEnv(ctx.env),
94
+ });
95
+ const pages = parseJson(stdout, "gh api output");
96
+ const rows = Array.isArray(pages) ? pages.flat() : [];
97
+ return {
98
+ items: rows.map(row => normalizeGithubIssue(row, { repo })).filter(Boolean),
99
+ pages: Array.isArray(pages) ? pages.length : 0,
100
+ };
101
+ }
102
+
103
+ /**
104
+ * Read a vendor-skill envelope and normalize its raw issues.
105
+ * @param {object} ctx - CLI context
106
+ * @param {"jira"|"linear"} tracker - Vendor
107
+ * @returns {{ items: object[], pages: unknown }} Normalized items
108
+ */
109
+ function readEnvelopeQueue(ctx, tracker) {
110
+ const file = ctx.values.input;
111
+ if (!file) {
112
+ throw new CliError(`queue --tracker ${tracker} needs --input <file>.`, 2);
113
+ }
114
+ const envelope = readJsonFile(file);
115
+ asSetupError(() => assertPagedToCompletion(envelope));
116
+ if (!Array.isArray(envelope.items)) {
117
+ throw new CliError(`${file}: items must be an array.`, 2);
118
+ }
119
+ return {
120
+ items: envelope.items.map(NORMALIZERS[tracker]),
121
+ pages: envelope.pages ?? null,
122
+ };
123
+ }
124
+
125
+ /**
126
+ * `queue --tracker <github|jira|linear>`: the Ready queue, mine first.
127
+ * @param {object} ctx - CLI context
128
+ * @returns {Promise<{ json: object }>} `{tracker,me,total,pages,ordered,excluded}`
129
+ */
130
+ export async function queue(ctx) {
131
+ const tracker = ctx.values.tracker;
132
+ if (tracker !== "github" && !Object.hasOwn(NORMALIZERS, tracker ?? "")) {
133
+ throw new CliError("--tracker must be github, jira or linear.", 2);
134
+ }
135
+ const project = loadProject(ctx.root);
136
+ const config = validOrAbsent(project);
137
+ const { items, pages } =
138
+ tracker === "github"
139
+ ? fetchGithubQueue(ctx, project)
140
+ : readEnvelopeQueue(ctx, tracker);
141
+ const me = ctx.values.me ?? (await readLedger(ctx.root)).control.me ?? null;
142
+ const order = orderReadyQueue(items, {
143
+ me,
144
+ trustedAuthorIds: config?.trustedAuthorIds ?? undefined,
145
+ humanNeededLabel: humanNeededLabel(project, tracker),
146
+ });
147
+ return { json: { tracker, me, total: items.length, pages, ...order } };
148
+ }
@@ -0,0 +1,326 @@
1
+ /**
2
+ * Shared plumbing for the session-manager CLI subcommands: exit codes, the
3
+ * error type that carries one, config loading, child-process execution and
4
+ * stdin.
5
+ *
6
+ * Every subcommand module receives a `ctx` built once by `session-manager.mjs`
7
+ * (the only file that reads the real environment), so nothing here reaches for
8
+ * globals. Child processes are always started with `spawnSync(command, argv)`:
9
+ * there is no shell anywhere on this path, so ticket text, Telegram text and
10
+ * worker names can never be re-parsed as shell syntax.
11
+ * @module session-manager/cli-runtime
12
+ */
13
+ import { spawnSync } from "node:child_process";
14
+ import { existsSync, readFileSync } from "node:fs";
15
+ import path from "node:path";
16
+
17
+ import {
18
+ resolveSessionManagerConfig,
19
+ validateSessionManager,
20
+ } from "./config.mjs";
21
+ import {
22
+ HUMAN_GATE_SIGNAL,
23
+ resolveSignalLabel,
24
+ } from "../../../scripts/qa-signal-lifecycle.mjs";
25
+ import { normalizeAgents, scrubWorkerEnv } from "./workers.mjs";
26
+
27
+ /** Exit codes the manager skill branches on. */
28
+ export const EXIT = Object.freeze({
29
+ OK: 0,
30
+ FAILURE: 1,
31
+ SETUP: 2,
32
+ NO_CAPACITY: 3,
33
+ LIVE_WORKER: 4,
34
+ });
35
+
36
+ /** The config files Lisa reads, local over global per key. */
37
+ export const GLOBAL_CONFIG_FILE = ".lisa.config.json";
38
+ const LOCAL_CONFIG_FILE = ".lisa.config.local.json";
39
+
40
+ /** Child output can be a whole paginated queue; allow far more than 1 MiB. */
41
+ const MAX_BUFFER = 64 * 1024 * 1024;
42
+
43
+ /**
44
+ * A refusal or failure with the exit code the CLI should end with, and
45
+ * optionally a JSON body to print on stdout (e.g. the capacity report for
46
+ * exit 3, so the manager can say why it did not spawn).
47
+ */
48
+ export class CliError extends Error {
49
+ /**
50
+ * @param {string} message - Operator-readable reason, printed on stderr
51
+ * @param {number} [exitCode] - Process exit code
52
+ * @param {unknown} [json] - Optional stdout body
53
+ */
54
+ constructor(message, exitCode = EXIT.FAILURE, json = undefined) {
55
+ super(message);
56
+ this.name = "CliError";
57
+ this.exitCode = exitCode;
58
+ this.json = json;
59
+ }
60
+ }
61
+
62
+ /**
63
+ * Run `fn`, turning any plain error it throws (a validation refusal from a
64
+ * pure module) into a setup error, exit 2. System errors (they carry a
65
+ * `code` such as EACCES) and CliErrors pass through unchanged.
66
+ * @template T
67
+ * @param {() => T} fn - Work that may refuse its input
68
+ * @returns {T} Its result
69
+ */
70
+ export function asSetupError(fn) {
71
+ try {
72
+ return fn();
73
+ } catch (error) {
74
+ throw toSetupError(error);
75
+ }
76
+ }
77
+
78
+ /**
79
+ * Async form of {@link asSetupError}.
80
+ * @template T
81
+ * @param {() => Promise<T>} fn - Work that may refuse its input
82
+ * @returns {Promise<T>} Its result
83
+ */
84
+ export async function asSetupErrorAsync(fn) {
85
+ try {
86
+ return await fn();
87
+ } catch (error) {
88
+ throw toSetupError(error);
89
+ }
90
+ }
91
+
92
+ /**
93
+ * Map one thrown value to a CliError, keeping system errors as they are.
94
+ * @param {unknown} error - Thrown value
95
+ * @returns {unknown} Value to rethrow
96
+ */
97
+ function toSetupError(error) {
98
+ if (error instanceof CliError || typeof error?.code === "string") {
99
+ return error;
100
+ }
101
+ return new CliError(error?.message ?? String(error), error?.exitCode ?? 2);
102
+ }
103
+
104
+ /**
105
+ * Read and parse one JSON config file; absent is `undefined`.
106
+ * @param {string} file - Absolute path
107
+ * @returns {object | undefined} Parsed config
108
+ */
109
+ function readConfigFile(file) {
110
+ if (!existsSync(file)) return undefined;
111
+ try {
112
+ return JSON.parse(readFileSync(file, "utf8"));
113
+ } catch (error) {
114
+ throw new CliError(`${file} is not valid JSON: ${error.message}`, 2);
115
+ }
116
+ }
117
+
118
+ /**
119
+ * The view of a resolved block the validator expects: keys the resolver
120
+ * fills with `null` for "absent" are passed as absent.
121
+ * @param {object} config - Resolved block
122
+ * @returns {object} Block to validate
123
+ */
124
+ function validationView(config) {
125
+ return {
126
+ ...config,
127
+ repos: config.repos ?? undefined,
128
+ trustedAuthorIds: config.trustedAuthorIds ?? undefined,
129
+ };
130
+ }
131
+
132
+ /**
133
+ * Read both config files and resolve the `sessionManager` block.
134
+ * @param {string} root - Absolute project root
135
+ * @returns {{ global: object | undefined, local: object | undefined,
136
+ * config: object | null, errors: string[] }} Raw files, resolved block
137
+ * (null when absent) and validation errors
138
+ */
139
+ export function loadProject(root) {
140
+ const global = readConfigFile(path.join(root, GLOBAL_CONFIG_FILE));
141
+ const local = readConfigFile(path.join(root, LOCAL_CONFIG_FILE));
142
+ const config = resolveSessionManagerConfig(global, local);
143
+ const errors = config ? validateSessionManager(validationView(config)) : [];
144
+ return { global, local, config, errors };
145
+ }
146
+
147
+ /**
148
+ * The label that marks an item as waiting on a person, for this tracker.
149
+ *
150
+ * Each tracker keeps it somewhere different and Jira's default is spelled
151
+ * differently (`Human Needed`), so a hardcoded `human-needed` would let a held
152
+ * Jira item through to a worker. Local config wins over global, then the
153
+ * tracker's own default.
154
+ * @param {ReturnType<typeof loadProject>} project - Loaded project
155
+ * @param {string | undefined} tracker - `github`, `jira` or `linear`; the
156
+ * project's configured tracker when omitted
157
+ * @returns {string | undefined} The label, or undefined for an unknown tracker
158
+ */
159
+ export function humanNeededLabel(project, tracker) {
160
+ const vendor = tracker ?? project.local?.tracker ?? project.global?.tracker;
161
+ for (const config of [project.local, project.global]) {
162
+ const resolved = resolveSignalLabel({
163
+ signal: HUMAN_GATE_SIGNAL,
164
+ config,
165
+ vendor,
166
+ });
167
+ if (resolved.source === "config") return resolved.value;
168
+ }
169
+ const fallback = resolveSignalLabel({
170
+ signal: HUMAN_GATE_SIGNAL,
171
+ config: {},
172
+ vendor,
173
+ });
174
+ return fallback.value || undefined;
175
+ }
176
+
177
+ /**
178
+ * Throw exit 2 unless the block is valid; return it only when present.
179
+ * @param {ReturnType<typeof loadProject>} project - Loaded project
180
+ * @returns {object | null} Resolved block, or null when absent
181
+ */
182
+ export function validOrAbsent(project) {
183
+ if (project.errors.length > 0) {
184
+ throw new CliError(
185
+ `sessionManager config is invalid:\n- ${project.errors.join("\n- ")}`,
186
+ 2
187
+ );
188
+ }
189
+ return project.config;
190
+ }
191
+
192
+ /**
193
+ * The resolved block, or exit 2 when it is absent or invalid.
194
+ * @param {{ root: string }} ctx - CLI context
195
+ * @returns {object} Resolved `sessionManager` block
196
+ */
197
+ export function requireConfig(ctx) {
198
+ const config = validOrAbsent(loadProject(ctx.root));
199
+ if (!config) {
200
+ throw new CliError(
201
+ `No sessionManager block in ${path.join(ctx.root, GLOBAL_CONFIG_FILE)}. ` +
202
+ `Run /lisa:setup:session-manager first.`,
203
+ 2
204
+ );
205
+ }
206
+ return config;
207
+ }
208
+
209
+ /**
210
+ * Throw exit 2 unless `dir` carries a `.lisa.config.json`: a worker running
211
+ * `/lisa:implement` there would have no tracker or gates.
212
+ * @param {string} dir - Absolute repo dir
213
+ * @returns {string} The same dir
214
+ */
215
+ export function requireLisaRepo(dir) {
216
+ if (!existsSync(path.join(dir, GLOBAL_CONFIG_FILE))) {
217
+ throw new CliError(
218
+ `${dir} has no ${GLOBAL_CONFIG_FILE}; a worker cannot run /lisa:implement there.`,
219
+ 2
220
+ );
221
+ }
222
+ return dir;
223
+ }
224
+
225
+ /**
226
+ * Run a command with an argv array and no shell.
227
+ * @param {string} command - Executable, looked up on PATH
228
+ * @param {readonly string[]} args - argv
229
+ * @param {{ env: Record<string, string | undefined>, cwd?: string }} options
230
+ * - Environment and working directory
231
+ * @returns {{ status: number | null, stdout: string, stderr: string,
232
+ * missing: boolean }} Outcome; `missing` when the command is not on PATH
233
+ */
234
+ export function run(command, args, { env, cwd }) {
235
+ const result = spawnSync(command, args, {
236
+ cwd,
237
+ env,
238
+ encoding: "utf8",
239
+ maxBuffer: MAX_BUFFER,
240
+ });
241
+ return {
242
+ status: result.status,
243
+ stdout: result.stdout ?? "",
244
+ stderr: result.stderr ?? "",
245
+ missing: result.error?.code === "ENOENT",
246
+ };
247
+ }
248
+
249
+ /**
250
+ * Run a command and return its stdout, or throw exit 1 naming what failed.
251
+ * @param {string} command - Executable
252
+ * @param {readonly string[]} args - argv
253
+ * @param {{ env: Record<string, string | undefined>, cwd?: string }} options
254
+ * - Environment and working directory
255
+ * @returns {string} stdout
256
+ */
257
+ export function mustRun(command, args, options) {
258
+ const result = run(command, args, options);
259
+ if (result.missing) {
260
+ throw new CliError(`${command} is not on PATH.`, 1);
261
+ }
262
+ if (result.status !== 0) {
263
+ const detail = result.stderr.trim() || `exit ${result.status}`;
264
+ throw new CliError(`${command} ${args[0] ?? ""} failed: ${detail}`, 1);
265
+ }
266
+ return result.stdout;
267
+ }
268
+
269
+ /**
270
+ * Normalized `claude agents --json` rows. `all` adds finished sessions,
271
+ * which matter for naming (never reuse a name) but never for liveness.
272
+ * @param {{ env: Record<string, string | undefined> }} ctx - CLI context
273
+ * @param {{ all?: boolean }} [options] - Include finished sessions
274
+ * @returns {ReturnType<typeof normalizeAgents>} Rows
275
+ */
276
+ export function listAgents(ctx, { all = false } = {}) {
277
+ const args = all ? ["agents", "--json", "--all"] : ["agents", "--json"];
278
+ const stdout = mustRun("claude", args, { env: scrubWorkerEnv(ctx.env) });
279
+ try {
280
+ return normalizeAgents(JSON.parse(stdout));
281
+ } catch (error) {
282
+ throw new CliError(`claude agents --json: ${error.message}`, 1);
283
+ }
284
+ }
285
+
286
+ /**
287
+ * Text piped on stdin, trimmed. Untrusted text (answers, questions, reasons,
288
+ * summaries) always arrives here, never in argv.
289
+ * @param {{ readStdin: () => string }} ctx - CLI context
290
+ * @param {string} what - What the text is, for the error message
291
+ * @param {{ required?: boolean }} [options] - Refuse empty input
292
+ * @returns {string} Text
293
+ */
294
+ export function stdinText(ctx, what, { required = true } = {}) {
295
+ const text = ctx.readStdin().trim();
296
+ if (required && text === "") {
297
+ throw new CliError(`Pipe the ${what} on stdin; it was empty.`, 2);
298
+ }
299
+ return text;
300
+ }
301
+
302
+ /**
303
+ * Parse a non-negative integer flag, or exit 2.
304
+ * @param {string | undefined} value - Flag value
305
+ * @param {string} flag - Flag name for the message
306
+ * @returns {number | undefined} Integer, or undefined when absent
307
+ */
308
+ export function intFlag(value, flag) {
309
+ if (value === undefined) return undefined;
310
+ if (!/^\d+$/.test(value)) {
311
+ throw new CliError(`${flag} must be a non-negative integer.`, 2);
312
+ }
313
+ return Number(value);
314
+ }
315
+
316
+ /**
317
+ * The first positional, or exit 2.
318
+ * @param {{ positionals: string[] }} ctx - CLI context
319
+ * @param {string} what - Name for the message
320
+ * @returns {string} Value
321
+ */
322
+ export function requirePositional(ctx, what) {
323
+ const [value] = ctx.positionals;
324
+ if (!value) throw new CliError(`Missing <${what}>.`, 2);
325
+ return value;
326
+ }
@@ -0,0 +1,114 @@
1
+ /**
2
+ * The session-manager CLI's `--help` text: the single reference for every
3
+ * subcommand, flag, stdin input and exit code. The manager and setup skills
4
+ * use exactly what is written here, so a flag that is not listed does not
5
+ * exist.
6
+ * @module session-manager/cli-usage
7
+ */
8
+
9
+ export const USAGE = `Usage: node session-manager.mjs <subcommand> [args] [--project-root <abs>]
10
+
11
+ Every subcommand accepts --project-root <absolute dir> (default: the current
12
+ directory) and -h/--help. Output is one line of JSON on stdout (repo-dir --raw
13
+ prints a bare path); errors go to stderr. Untrusted text (answers, questions,
14
+ reasons, Telegram messages, summaries) is read from STDIN, never from argv.
15
+
16
+ Exit codes: 0 ok; 1 a command failed (claude, tmux or gh error); 2 bad repo,
17
+ bad config or bad usage; 3 no capacity; 4 a live worker already holds the ref.
18
+
19
+ Workers and capacity
20
+ capacity [--max-workers <n>]
21
+ {running,cap,free_slots,avail_gb,load1,cores,overloaded,can_spawn,
22
+ mem_source,paused}. Works without a sessionManager block (defaults).
23
+ Cap precedence: ledger control.maxWorkers, then --max-workers, then config.
24
+ (capacity and spawn also take --meminfo <file>, a TEST-ONLY flag that
25
+ reads memory from a Linux meminfo file instead of this host. Skills
26
+ never pass it.)
27
+ spawn <ref> [--repo <key>] [--max-workers <n>]
28
+ Checks, in order: repo dir resolves and has .lisa.config.json (exit 2);
29
+ capacity (exit 3, stdout = capacity report); no live wk- worker for the
30
+ ref (exit 4, stdout = {ref,worker,sessionId}). Then runs, with cwd = repo
31
+ dir and every TELEGRAM_* variable removed:
32
+ claude --bg -n wk-<token>-<MMDD-HHMM> --dangerously-skip-permissions
33
+ --settings {"crossSessionInbound":"accept"}
34
+ "/lisa:implement <ref> managedBy=<sessionManager.name>"
35
+ Records the ledger and sessions.jsonl. stdout {ref,name,sessionId,repo,cwd}.
36
+ resume <ref> STDIN: the message for the worker
37
+ claude --bg --resume <full session id> -- "<stdin>" in the worker's repo
38
+ dir, TELEGRAM_* removed; the full id comes from claude agents --json --all
39
+ (exit 2 when none does). stdout {ref,worker,sessionId,resumed:true}.
40
+ classify [<ref>]
41
+ Classifies one ledger item (or all) from claude agents --json --all and
42
+ a hash of claude logs <worker>; records the hash as progress. stdout
43
+ [{ref,worker,sessionId,repo,classification,attempts,agentStatus,
44
+ pendingQuestion}], classification one of finished|waiting|requestion|
45
+ working|stalled|dead|exhausted.
46
+ status
47
+ stdout {manager:{name,running},control,workers:[{ref,worker,sessionId,
48
+ repo,status,attempts,pendingQuestion,live}],untracked:[wk- names]}.
49
+
50
+ Manager
51
+ start [--settle-ms <n>]
52
+ Refuses (exit 2) without <notify.stateDir>/.env (mode 0600) or for
53
+ the shared default state dir. "already-running" when the tmux
54
+ session =<name> exists and was started in this project root;
55
+ exit 2 naming the conflict when it was started anywhere else.
56
+ Otherwise starts tmux new-session for the manager, then checks
57
+ has-session -t =<name> every 250 ms for --settle-ms (default
58
+ 3000, at most 60000): exit 2, with the foreground command to run
59
+ to see claude's error, when the session is gone.
60
+ stdout {status:"started"|"already-running",name,...}.
61
+ stop tmux kill-session -t =<name> only, and only for a session started
62
+ in this root (exit 2 otherwise); workers keep running.
63
+ stdout {status:"stopped"|"not-running",name}.
64
+ store-token [--replace]
65
+ Prompts for the bot token on the terminal (echo off) and writes
66
+ <stateDir>/.env. Exit 2 when a token is already there, unless
67
+ --replace. With no TTY: exit 0, stdout {stored:false,
68
+ reason:"no-tty",command} where command is the line the operator
69
+ runs in their own terminal. Bad input: exit 2.
70
+
71
+ Config and routing
72
+ repo-dir [--repo <key>] [--raw]
73
+ stdout {repo,dir}; --raw prints the bare dir. Exit 2 for an
74
+ unknown key or a dir without .lisa.config.json.
75
+ validate stdout {valid,errors}; exit 2 when invalid or absent.
76
+ init-config [--slug <slug>] [--write]
77
+ stdout {written,block[,reason:"exists"][,path]}. Detects
78
+ projects/*/.lisa.config.json. Default slug: <github.repo or
79
+ folder name>-<first 6 hex of sha256(realpath(root))>; --slug is
80
+ used as given. --write adds the block to .lisa.config.json,
81
+ never overwriting an existing one.
82
+
83
+ Per cycle
84
+ queue --tracker github [--me <id>] [--label <name>] [--github-repo <o/r>]
85
+ gh api --paginate --slurp repos/<o>/<r>/issues?state=open&labels=<ready>
86
+ Label default: the configured ready role; repo default: github.org/repo.
87
+ queue --tracker jira|linear --input <file> [--me <id>]
88
+ <file> = {complete:true,pages,items:[raw vendor issues]}; exit 2 unless
89
+ complete is exactly true.
90
+ Both print {tracker,me,total,pages,ordered,excluded:[{ref,reason}]}.
91
+ --me defaults to the ledger's control.me.
92
+ ledger get [<ref>]
93
+ ledger record-spawn <ref> --worker <name> [--session-id <id>] [--repo <key>]
94
+ ledger set-question <ref> [--telegram-message-id <n>] [--sender <name>]
95
+ STDIN: question
96
+ ledger clear-question <ref>
97
+ ledger finish <ref> --status DONE|FAILED [--sender <name>] STDIN: reason
98
+ --sender: exit 2 unless the ledger's worker for <ref> is exactly <name>.
99
+ ledger control [--paused true|false] [--max-workers <n>|none] [--me <id>|none]
100
+ route [--reply-to <telegram message id>] [--owner <name>] STDIN: message
101
+ stdout {kind:"answer",ref,body[,message]} | {kind:"command",name,...}
102
+ | {kind:"invalid-command",reason} | {kind:"ambiguous",candidates}.
103
+ --owner adds message "<owner>'s answer: ...".
104
+ blocked-plan [--input <file>] [--ref <ref>] STDIN (without --input): JSON
105
+ {labels,body,comments,humanNeededLabel?,edges,pendingQuestion?}.
106
+ Trusted hold releasers are sessionManager.trustedAuthorIds (none when
107
+ unset); trustedHumanActorIds in the input is ignored. stdout
108
+ {action:release|keep|escalate|skip-human-gate,reason,edges,gate}.
109
+ --ref fills pendingQuestion from the ledger.
110
+ record-cycle --outcome <outcome> [--ref <url>]... [--run-id <id>]
111
+ STDIN: one-line summary. Records loop session-manager with runbook
112
+ .lisa/automations/session-manager.runbook.md. stdout {path,appended,
113
+ loop_id,outcome,run_id}.
114
+ `;