@ashlr/hub 2.2.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 (477) hide show
  1. package/CHANGELOG.md +1158 -0
  2. package/LICENSE +21 -0
  3. package/README.md +833 -0
  4. package/bin/ashlr +8 -0
  5. package/dist/api/core.d.ts +28 -0
  6. package/dist/api/core.js +42 -0
  7. package/dist/api/core.js.map +1 -0
  8. package/dist/api/index.d.ts +9 -0
  9. package/dist/api/index.js +9 -0
  10. package/dist/api/index.js.map +1 -0
  11. package/dist/api/plugin.d.ts +12 -0
  12. package/dist/api/plugin.js +13 -0
  13. package/dist/api/plugin.js.map +1 -0
  14. package/dist/api/types.d.ts +9 -0
  15. package/dist/api/types.js +9 -0
  16. package/dist/api/types.js.map +1 -0
  17. package/dist/cli/args.d.ts +20 -0
  18. package/dist/cli/args.js +23 -0
  19. package/dist/cli/args.js.map +1 -0
  20. package/dist/cli/ask.d.ts +22 -0
  21. package/dist/cli/ask.js +240 -0
  22. package/dist/cli/ask.js.map +1 -0
  23. package/dist/cli/audit.d.ts +26 -0
  24. package/dist/cli/audit.js +199 -0
  25. package/dist/cli/audit.js.map +1 -0
  26. package/dist/cli/backlog.d.ts +26 -0
  27. package/dist/cli/backlog.js +322 -0
  28. package/dist/cli/backlog.js.map +1 -0
  29. package/dist/cli/completions.d.ts +18 -0
  30. package/dist/cli/completions.js +156 -0
  31. package/dist/cli/completions.js.map +1 -0
  32. package/dist/cli/daemon.d.ts +31 -0
  33. package/dist/cli/daemon.js +334 -0
  34. package/dist/cli/daemon.js.map +1 -0
  35. package/dist/cli/demo-sandbox.d.ts +78 -0
  36. package/dist/cli/demo-sandbox.js +227 -0
  37. package/dist/cli/demo-sandbox.js.map +1 -0
  38. package/dist/cli/demo.d.ts +76 -0
  39. package/dist/cli/demo.js +285 -0
  40. package/dist/cli/demo.js.map +1 -0
  41. package/dist/cli/digest.d.ts +46 -0
  42. package/dist/cli/digest.js +352 -0
  43. package/dist/cli/digest.js.map +1 -0
  44. package/dist/cli/doctor-init.d.ts +28 -0
  45. package/dist/cli/doctor-init.js +335 -0
  46. package/dist/cli/doctor-init.js.map +1 -0
  47. package/dist/cli/genome.d.ts +62 -0
  48. package/dist/cli/genome.js +1061 -0
  49. package/dist/cli/genome.js.map +1 -0
  50. package/dist/cli/gh.d.ts +27 -0
  51. package/dist/cli/gh.js +322 -0
  52. package/dist/cli/gh.js.map +1 -0
  53. package/dist/cli/goals.d.ts +55 -0
  54. package/dist/cli/goals.js +667 -0
  55. package/dist/cli/goals.js.map +1 -0
  56. package/dist/cli/health.d.ts +56 -0
  57. package/dist/cli/health.js +407 -0
  58. package/dist/cli/health.js.map +1 -0
  59. package/dist/cli/help.d.ts +51 -0
  60. package/dist/cli/help.js +436 -0
  61. package/dist/cli/help.js.map +1 -0
  62. package/dist/cli/inbox.d.ts +28 -0
  63. package/dist/cli/inbox.js +589 -0
  64. package/dist/cli/inbox.js.map +1 -0
  65. package/dist/cli/index.d.ts +41 -0
  66. package/dist/cli/index.js +1208 -0
  67. package/dist/cli/index.js.map +1 -0
  68. package/dist/cli/knowledge.d.ts +33 -0
  69. package/dist/cli/knowledge.js +575 -0
  70. package/dist/cli/knowledge.js.map +1 -0
  71. package/dist/cli/mcp.d.ts +26 -0
  72. package/dist/cli/mcp.js +487 -0
  73. package/dist/cli/mcp.js.map +1 -0
  74. package/dist/cli/models.d.ts +26 -0
  75. package/dist/cli/models.js +435 -0
  76. package/dist/cli/models.js.map +1 -0
  77. package/dist/cli/new.d.ts +32 -0
  78. package/dist/cli/new.js +565 -0
  79. package/dist/cli/new.js.map +1 -0
  80. package/dist/cli/notify.d.ts +20 -0
  81. package/dist/cli/notify.js +188 -0
  82. package/dist/cli/notify.js.map +1 -0
  83. package/dist/cli/onboard.d.ts +85 -0
  84. package/dist/cli/onboard.js +305 -0
  85. package/dist/cli/onboard.js.map +1 -0
  86. package/dist/cli/open.d.ts +38 -0
  87. package/dist/cli/open.js +86 -0
  88. package/dist/cli/open.js.map +1 -0
  89. package/dist/cli/orient.d.ts +14 -0
  90. package/dist/cli/orient.js +110 -0
  91. package/dist/cli/orient.js.map +1 -0
  92. package/dist/cli/picker.d.ts +21 -0
  93. package/dist/cli/picker.js +177 -0
  94. package/dist/cli/picker.js.map +1 -0
  95. package/dist/cli/plugins.d.ts +21 -0
  96. package/dist/cli/plugins.js +394 -0
  97. package/dist/cli/plugins.js.map +1 -0
  98. package/dist/cli/preflight.d.ts +29 -0
  99. package/dist/cli/preflight.js +131 -0
  100. package/dist/cli/preflight.js.map +1 -0
  101. package/dist/cli/pulse.d.ts +26 -0
  102. package/dist/cli/pulse.js +482 -0
  103. package/dist/cli/pulse.js.map +1 -0
  104. package/dist/cli/reflect.d.ts +42 -0
  105. package/dist/cli/reflect.js +381 -0
  106. package/dist/cli/reflect.js.map +1 -0
  107. package/dist/cli/run.d.ts +29 -0
  108. package/dist/cli/run.js +687 -0
  109. package/dist/cli/run.js.map +1 -0
  110. package/dist/cli/sandbox.d.ts +20 -0
  111. package/dist/cli/sandbox.js +345 -0
  112. package/dist/cli/sandbox.js.map +1 -0
  113. package/dist/cli/seams.d.ts +41 -0
  114. package/dist/cli/seams.js +167 -0
  115. package/dist/cli/seams.js.map +1 -0
  116. package/dist/cli/serve.d.ts +25 -0
  117. package/dist/cli/serve.js +249 -0
  118. package/dist/cli/serve.js.map +1 -0
  119. package/dist/cli/ship.d.ts +33 -0
  120. package/dist/cli/ship.js +433 -0
  121. package/dist/cli/ship.js.map +1 -0
  122. package/dist/cli/spec.d.ts +19 -0
  123. package/dist/cli/spec.js +478 -0
  124. package/dist/cli/spec.js.map +1 -0
  125. package/dist/cli/swarm.d.ts +42 -0
  126. package/dist/cli/swarm.js +1365 -0
  127. package/dist/cli/swarm.js.map +1 -0
  128. package/dist/cli/telemetry.d.ts +26 -0
  129. package/dist/cli/telemetry.js +364 -0
  130. package/dist/cli/telemetry.js.map +1 -0
  131. package/dist/cli/tui.d.ts +17 -0
  132. package/dist/cli/tui.js +52 -0
  133. package/dist/cli/tui.js.map +1 -0
  134. package/dist/cli/ui.d.ts +53 -0
  135. package/dist/cli/ui.js +66 -0
  136. package/dist/cli/ui.js.map +1 -0
  137. package/dist/cli/update.d.ts +38 -0
  138. package/dist/cli/update.js +682 -0
  139. package/dist/cli/update.js.map +1 -0
  140. package/dist/cli/vercel.d.ts +20 -0
  141. package/dist/cli/vercel.js +193 -0
  142. package/dist/cli/vercel.js.map +1 -0
  143. package/dist/cli/verify-safety.d.ts +96 -0
  144. package/dist/cli/verify-safety.js +509 -0
  145. package/dist/cli/verify-safety.js.map +1 -0
  146. package/dist/cli/wire.d.ts +22 -0
  147. package/dist/cli/wire.js +205 -0
  148. package/dist/cli/wire.js.map +1 -0
  149. package/dist/core/classify.d.ts +51 -0
  150. package/dist/core/classify.js +450 -0
  151. package/dist/core/classify.js.map +1 -0
  152. package/dist/core/config.d.ts +63 -0
  153. package/dist/core/config.js +474 -0
  154. package/dist/core/config.js.map +1 -0
  155. package/dist/core/daemon/loop.d.ts +74 -0
  156. package/dist/core/daemon/loop.js +618 -0
  157. package/dist/core/daemon/loop.js.map +1 -0
  158. package/dist/core/daemon/state.d.ts +66 -0
  159. package/dist/core/daemon/state.js +197 -0
  160. package/dist/core/daemon/state.js.map +1 -0
  161. package/dist/core/dashboard.d.ts +40 -0
  162. package/dist/core/dashboard.js +463 -0
  163. package/dist/core/dashboard.js.map +1 -0
  164. package/dist/core/digest/build.d.ts +51 -0
  165. package/dist/core/digest/build.js +230 -0
  166. package/dist/core/digest/build.js.map +1 -0
  167. package/dist/core/digest/deliver.d.ts +47 -0
  168. package/dist/core/digest/deliver.js +230 -0
  169. package/dist/core/digest/deliver.js.map +1 -0
  170. package/dist/core/digest/store.d.ts +57 -0
  171. package/dist/core/digest/store.js +223 -0
  172. package/dist/core/digest/store.js.map +1 -0
  173. package/dist/core/doctor-fix.d.ts +21 -0
  174. package/dist/core/doctor-fix.js +440 -0
  175. package/dist/core/doctor-fix.js.map +1 -0
  176. package/dist/core/doctor.d.ts +18 -0
  177. package/dist/core/doctor.js +806 -0
  178. package/dist/core/doctor.js.map +1 -0
  179. package/dist/core/env-bridge.d.ts +64 -0
  180. package/dist/core/env-bridge.js +103 -0
  181. package/dist/core/env-bridge.js.map +1 -0
  182. package/dist/core/genome/capture.d.ts +49 -0
  183. package/dist/core/genome/capture.js +352 -0
  184. package/dist/core/genome/capture.js.map +1 -0
  185. package/dist/core/genome/consolidate.d.ts +38 -0
  186. package/dist/core/genome/consolidate.js +426 -0
  187. package/dist/core/genome/consolidate.js.map +1 -0
  188. package/dist/core/genome/export.d.ts +29 -0
  189. package/dist/core/genome/export.js +102 -0
  190. package/dist/core/genome/export.js.map +1 -0
  191. package/dist/core/genome/playbook.d.ts +33 -0
  192. package/dist/core/genome/playbook.js +320 -0
  193. package/dist/core/genome/playbook.js.map +1 -0
  194. package/dist/core/genome/recall.d.ts +45 -0
  195. package/dist/core/genome/recall.js +293 -0
  196. package/dist/core/genome/recall.js.map +1 -0
  197. package/dist/core/genome/store.d.ts +62 -0
  198. package/dist/core/genome/store.js +711 -0
  199. package/dist/core/genome/store.js.map +1 -0
  200. package/dist/core/git.d.ts +34 -0
  201. package/dist/core/git.js +115 -0
  202. package/dist/core/git.js.map +1 -0
  203. package/dist/core/goals/advance.d.ts +82 -0
  204. package/dist/core/goals/advance.js +263 -0
  205. package/dist/core/goals/advance.js.map +1 -0
  206. package/dist/core/goals/planner.d.ts +58 -0
  207. package/dist/core/goals/planner.js +233 -0
  208. package/dist/core/goals/planner.js.map +1 -0
  209. package/dist/core/goals/store.d.ts +128 -0
  210. package/dist/core/goals/store.js +442 -0
  211. package/dist/core/goals/store.js.map +1 -0
  212. package/dist/core/inbox/apply.d.ts +36 -0
  213. package/dist/core/inbox/apply.js +407 -0
  214. package/dist/core/inbox/apply.js.map +1 -0
  215. package/dist/core/inbox/notify-proposal.d.ts +13 -0
  216. package/dist/core/inbox/notify-proposal.js +21 -0
  217. package/dist/core/inbox/notify-proposal.js.map +1 -0
  218. package/dist/core/inbox/store.d.ts +67 -0
  219. package/dist/core/inbox/store.js +258 -0
  220. package/dist/core/inbox/store.js.map +1 -0
  221. package/dist/core/index-engine.d.ts +62 -0
  222. package/dist/core/index-engine.js +486 -0
  223. package/dist/core/index-engine.js.map +1 -0
  224. package/dist/core/integrations/desktop-notify.d.ts +18 -0
  225. package/dist/core/integrations/desktop-notify.js +42 -0
  226. package/dist/core/integrations/desktop-notify.js.map +1 -0
  227. package/dist/core/integrations/editors.d.ts +50 -0
  228. package/dist/core/integrations/editors.js +216 -0
  229. package/dist/core/integrations/editors.js.map +1 -0
  230. package/dist/core/integrations/github.d.ts +66 -0
  231. package/dist/core/integrations/github.js +332 -0
  232. package/dist/core/integrations/github.js.map +1 -0
  233. package/dist/core/integrations/identity.d.ts +29 -0
  234. package/dist/core/integrations/identity.js +359 -0
  235. package/dist/core/integrations/identity.js.map +1 -0
  236. package/dist/core/integrations/notify.d.ts +23 -0
  237. package/dist/core/integrations/notify.js +96 -0
  238. package/dist/core/integrations/notify.js.map +1 -0
  239. package/dist/core/integrations/vercel.d.ts +37 -0
  240. package/dist/core/integrations/vercel.js +192 -0
  241. package/dist/core/integrations/vercel.js.map +1 -0
  242. package/dist/core/knowledge/ask.d.ts +34 -0
  243. package/dist/core/knowledge/ask.js +325 -0
  244. package/dist/core/knowledge/ask.js.map +1 -0
  245. package/dist/core/knowledge/graph.d.ts +51 -0
  246. package/dist/core/knowledge/graph.js +564 -0
  247. package/dist/core/knowledge/graph.js.map +1 -0
  248. package/dist/core/knowledge/index.d.ts +74 -0
  249. package/dist/core/knowledge/index.js +586 -0
  250. package/dist/core/knowledge/index.js.map +1 -0
  251. package/dist/core/learn/playbooks.d.ts +84 -0
  252. package/dist/core/learn/playbooks.js +241 -0
  253. package/dist/core/learn/playbooks.js.map +1 -0
  254. package/dist/core/learn/reflect.d.ts +87 -0
  255. package/dist/core/learn/reflect.js +435 -0
  256. package/dist/core/learn/reflect.js.map +1 -0
  257. package/dist/core/learn/store.d.ts +51 -0
  258. package/dist/core/learn/store.js +165 -0
  259. package/dist/core/learn/store.js.map +1 -0
  260. package/dist/core/learn/tuning.d.ts +48 -0
  261. package/dist/core/learn/tuning.js +201 -0
  262. package/dist/core/learn/tuning.js.map +1 -0
  263. package/dist/core/lifecycle/scaffold.d.ts +43 -0
  264. package/dist/core/lifecycle/scaffold.js +260 -0
  265. package/dist/core/lifecycle/scaffold.js.map +1 -0
  266. package/dist/core/lifecycle/ship.d.ts +48 -0
  267. package/dist/core/lifecycle/ship.js +513 -0
  268. package/dist/core/lifecycle/ship.js.map +1 -0
  269. package/dist/core/lifecycle/templates.d.ts +20 -0
  270. package/dist/core/lifecycle/templates.js +605 -0
  271. package/dist/core/lifecycle/templates.js.map +1 -0
  272. package/dist/core/mcp-gateway.d.ts +59 -0
  273. package/dist/core/mcp-gateway.js +385 -0
  274. package/dist/core/mcp-gateway.js.map +1 -0
  275. package/dist/core/mcp-native.d.ts +53 -0
  276. package/dist/core/mcp-native.js +507 -0
  277. package/dist/core/mcp-native.js.map +1 -0
  278. package/dist/core/mcp-registry.d.ts +36 -0
  279. package/dist/core/mcp-registry.js +180 -0
  280. package/dist/core/mcp-registry.js.map +1 -0
  281. package/dist/core/observability/budget-alert.d.ts +18 -0
  282. package/dist/core/observability/budget-alert.js +90 -0
  283. package/dist/core/observability/budget-alert.js.map +1 -0
  284. package/dist/core/observability/estimate.d.ts +27 -0
  285. package/dist/core/observability/estimate.js +188 -0
  286. package/dist/core/observability/estimate.js.map +1 -0
  287. package/dist/core/observability/forecast.d.ts +19 -0
  288. package/dist/core/observability/forecast.js +101 -0
  289. package/dist/core/observability/forecast.js.map +1 -0
  290. package/dist/core/observability/governance.d.ts +28 -0
  291. package/dist/core/observability/governance.js +101 -0
  292. package/dist/core/observability/governance.js.map +1 -0
  293. package/dist/core/observability/otlp.d.ts +88 -0
  294. package/dist/core/observability/otlp.js +217 -0
  295. package/dist/core/observability/otlp.js.map +1 -0
  296. package/dist/core/observability/rollup.d.ts +35 -0
  297. package/dist/core/observability/rollup.js +311 -0
  298. package/dist/core/observability/rollup.js.map +1 -0
  299. package/dist/core/observability/telemetry-sink.d.ts +63 -0
  300. package/dist/core/observability/telemetry-sink.js +350 -0
  301. package/dist/core/observability/telemetry-sink.js.map +1 -0
  302. package/dist/core/observability/usage-source.d.ts +60 -0
  303. package/dist/core/observability/usage-source.js +347 -0
  304. package/dist/core/observability/usage-source.js.map +1 -0
  305. package/dist/core/onboard.d.ts +27 -0
  306. package/dist/core/onboard.js +288 -0
  307. package/dist/core/onboard.js.map +1 -0
  308. package/dist/core/orient.d.ts +23 -0
  309. package/dist/core/orient.js +135 -0
  310. package/dist/core/orient.js.map +1 -0
  311. package/dist/core/phantom.d.ts +23 -0
  312. package/dist/core/phantom.js +279 -0
  313. package/dist/core/phantom.js.map +1 -0
  314. package/dist/core/plugins/host-api.d.ts +29 -0
  315. package/dist/core/plugins/host-api.js +113 -0
  316. package/dist/core/plugins/host-api.js.map +1 -0
  317. package/dist/core/plugins/integrity.d.ts +36 -0
  318. package/dist/core/plugins/integrity.js +73 -0
  319. package/dist/core/plugins/integrity.js.map +1 -0
  320. package/dist/core/plugins/manifest.d.ts +31 -0
  321. package/dist/core/plugins/manifest.js +316 -0
  322. package/dist/core/plugins/manifest.js.map +1 -0
  323. package/dist/core/plugins/registry.d.ts +87 -0
  324. package/dist/core/plugins/registry.js +415 -0
  325. package/dist/core/plugins/registry.js.map +1 -0
  326. package/dist/core/plugins/types.d.ts +182 -0
  327. package/dist/core/plugins/types.js +40 -0
  328. package/dist/core/plugins/types.js.map +1 -0
  329. package/dist/core/plugins/wrappers.d.ts +40 -0
  330. package/dist/core/plugins/wrappers.js +229 -0
  331. package/dist/core/plugins/wrappers.js.map +1 -0
  332. package/dist/core/portfolio/backlog.d.ts +40 -0
  333. package/dist/core/portfolio/backlog.js +177 -0
  334. package/dist/core/portfolio/backlog.js.map +1 -0
  335. package/dist/core/portfolio/scanners.d.ts +21 -0
  336. package/dist/core/portfolio/scanners.js +600 -0
  337. package/dist/core/portfolio/scanners.js.map +1 -0
  338. package/dist/core/providers.d.ts +34 -0
  339. package/dist/core/providers.js +250 -0
  340. package/dist/core/providers.js.map +1 -0
  341. package/dist/core/quality/conventions.d.ts +35 -0
  342. package/dist/core/quality/conventions.js +267 -0
  343. package/dist/core/quality/conventions.js.map +1 -0
  344. package/dist/core/quality/fixes.d.ts +56 -0
  345. package/dist/core/quality/fixes.js +209 -0
  346. package/dist/core/quality/fixes.js.map +1 -0
  347. package/dist/core/quality/health.d.ts +69 -0
  348. package/dist/core/quality/health.js +350 -0
  349. package/dist/core/quality/health.js.map +1 -0
  350. package/dist/core/quality/store.d.ts +56 -0
  351. package/dist/core/quality/store.js +195 -0
  352. package/dist/core/quality/store.js.map +1 -0
  353. package/dist/core/readiness.d.ts +112 -0
  354. package/dist/core/readiness.js +431 -0
  355. package/dist/core/readiness.js.map +1 -0
  356. package/dist/core/run/agent-loop.d.ts +40 -0
  357. package/dist/core/run/agent-loop.js +291 -0
  358. package/dist/core/run/agent-loop.js.map +1 -0
  359. package/dist/core/run/budget.d.ts +47 -0
  360. package/dist/core/run/budget.js +113 -0
  361. package/dist/core/run/budget.js.map +1 -0
  362. package/dist/core/run/engines.d.ts +75 -0
  363. package/dist/core/run/engines.js +199 -0
  364. package/dist/core/run/engines.js.map +1 -0
  365. package/dist/core/run/model-manager.d.ts +64 -0
  366. package/dist/core/run/model-manager.js +339 -0
  367. package/dist/core/run/model-manager.js.map +1 -0
  368. package/dist/core/run/orchestrator.d.ts +100 -0
  369. package/dist/core/run/orchestrator.js +1515 -0
  370. package/dist/core/run/orchestrator.js.map +1 -0
  371. package/dist/core/run/provider-client.d.ts +46 -0
  372. package/dist/core/run/provider-client.js +796 -0
  373. package/dist/core/run/provider-client.js.map +1 -0
  374. package/dist/core/run/retry.d.ts +19 -0
  375. package/dist/core/run/retry.js +68 -0
  376. package/dist/core/run/retry.js.map +1 -0
  377. package/dist/core/run/router.d.ts +50 -0
  378. package/dist/core/run/router.js +257 -0
  379. package/dist/core/run/router.js.map +1 -0
  380. package/dist/core/run/self-heal.d.ts +52 -0
  381. package/dist/core/run/self-heal.js +181 -0
  382. package/dist/core/run/self-heal.js.map +1 -0
  383. package/dist/core/run/streaming.d.ts +31 -0
  384. package/dist/core/run/streaming.js +122 -0
  385. package/dist/core/run/streaming.js.map +1 -0
  386. package/dist/core/run/verify.d.ts +30 -0
  387. package/dist/core/run/verify.js +204 -0
  388. package/dist/core/run/verify.js.map +1 -0
  389. package/dist/core/sandbox/audit.d.ts +31 -0
  390. package/dist/core/sandbox/audit.js +169 -0
  391. package/dist/core/sandbox/audit.js.map +1 -0
  392. package/dist/core/sandbox/policy.d.ts +61 -0
  393. package/dist/core/sandbox/policy.js +211 -0
  394. package/dist/core/sandbox/policy.js.map +1 -0
  395. package/dist/core/sandbox/worktree.d.ts +175 -0
  396. package/dist/core/sandbox/worktree.js +673 -0
  397. package/dist/core/sandbox/worktree.js.map +1 -0
  398. package/dist/core/seams/backlog.d.ts +47 -0
  399. package/dist/core/seams/backlog.js +47 -0
  400. package/dist/core/seams/backlog.js.map +1 -0
  401. package/dist/core/seams/daemon-coordinator.d.ts +72 -0
  402. package/dist/core/seams/daemon-coordinator.js +76 -0
  403. package/dist/core/seams/daemon-coordinator.js.map +1 -0
  404. package/dist/core/seams/genome.d.ts +45 -0
  405. package/dist/core/seams/genome.js +53 -0
  406. package/dist/core/seams/genome.js.map +1 -0
  407. package/dist/core/seams/identity.d.ts +40 -0
  408. package/dist/core/seams/identity.js +44 -0
  409. package/dist/core/seams/identity.js.map +1 -0
  410. package/dist/core/seams/inbox.d.ts +60 -0
  411. package/dist/core/seams/inbox.js +66 -0
  412. package/dist/core/seams/inbox.js.map +1 -0
  413. package/dist/core/seams/index.d.ts +20 -0
  414. package/dist/core/seams/index.js +21 -0
  415. package/dist/core/seams/index.js.map +1 -0
  416. package/dist/core/seams/portfolio.d.ts +50 -0
  417. package/dist/core/seams/portfolio.js +61 -0
  418. package/dist/core/seams/portfolio.js.map +1 -0
  419. package/dist/core/seams/registry.d.ts +42 -0
  420. package/dist/core/seams/registry.js +128 -0
  421. package/dist/core/seams/registry.js.map +1 -0
  422. package/dist/core/seams/run-swarm.d.ts +66 -0
  423. package/dist/core/seams/run-swarm.js +74 -0
  424. package/dist/core/seams/run-swarm.js.map +1 -0
  425. package/dist/core/seams/types.d.ts +123 -0
  426. package/dist/core/seams/types.js +35 -0
  427. package/dist/core/seams/types.js.map +1 -0
  428. package/dist/core/spec/spec-store.d.ts +62 -0
  429. package/dist/core/spec/spec-store.js +359 -0
  430. package/dist/core/spec/spec-store.js.map +1 -0
  431. package/dist/core/swarm/gate.d.ts +45 -0
  432. package/dist/core/swarm/gate.js +114 -0
  433. package/dist/core/swarm/gate.js.map +1 -0
  434. package/dist/core/swarm/planner.d.ts +32 -0
  435. package/dist/core/swarm/planner.js +293 -0
  436. package/dist/core/swarm/planner.js.map +1 -0
  437. package/dist/core/swarm/rollback.d.ts +56 -0
  438. package/dist/core/swarm/rollback.js +266 -0
  439. package/dist/core/swarm/rollback.js.map +1 -0
  440. package/dist/core/swarm/runner.d.ts +62 -0
  441. package/dist/core/swarm/runner.js +1263 -0
  442. package/dist/core/swarm/runner.js.map +1 -0
  443. package/dist/core/swarm/sign.d.ts +71 -0
  444. package/dist/core/swarm/sign.js +362 -0
  445. package/dist/core/swarm/sign.js.map +1 -0
  446. package/dist/core/swarm/store.d.ts +52 -0
  447. package/dist/core/swarm/store.js +195 -0
  448. package/dist/core/swarm/store.js.map +1 -0
  449. package/dist/core/tidy.d.ts +32 -0
  450. package/dist/core/tidy.js +354 -0
  451. package/dist/core/tidy.js.map +1 -0
  452. package/dist/core/tools-registry.d.ts +16 -0
  453. package/dist/core/tools-registry.js +308 -0
  454. package/dist/core/tools-registry.js.map +1 -0
  455. package/dist/core/types.d.ts +2545 -0
  456. package/dist/core/types.js +9 -0
  457. package/dist/core/types.js.map +1 -0
  458. package/dist/core/web/api.d.ts +53 -0
  459. package/dist/core/web/api.js +698 -0
  460. package/dist/core/web/api.js.map +1 -0
  461. package/dist/core/web/public/app.js +1906 -0
  462. package/dist/core/web/public/index.html +721 -0
  463. package/dist/core/web/public/styles.css +2007 -0
  464. package/dist/core/web/server.d.ts +18 -0
  465. package/dist/core/web/server.js +122 -0
  466. package/dist/core/web/server.js.map +1 -0
  467. package/dist/core/web/static.d.ts +18 -0
  468. package/dist/core/web/static.js +122 -0
  469. package/dist/core/web/static.js.map +1 -0
  470. package/dist/tui/app.d.ts +33 -0
  471. package/dist/tui/app.js +350 -0
  472. package/dist/tui/app.js.map +1 -0
  473. package/dist/tui/render.d.ts +20 -0
  474. package/dist/tui/render.js +558 -0
  475. package/dist/tui/render.js.map +1 -0
  476. package/package.json +80 -0
  477. package/schema/config.schema.json +223 -0
@@ -0,0 +1,293 @@
1
+ /**
2
+ * core/swarm/planner.ts — M12 swarm planner.
3
+ *
4
+ * planSwarm({goal, specBody?}, cfg): Promise<SwarmPlan>
5
+ *
6
+ * Decomposes a goal (+ optional spec body) into a phased SwarmPlan via a
7
+ * single bounded model call (LOCAL-first). Guardrails:
8
+ * - Single model call; never throws — all failures fall back to a sensible
9
+ * default plan.
10
+ * - Tasks per phase capped at <= 6; total tasks capped at <= 18.
11
+ * - BUILD-phase tasks are independent (no intra-build deps); later phases
12
+ * carry deps on the tasks from the prior phase.
13
+ * - IDs are stable slugs: scaffold-1, build-1..N, integrate-1, verify-1, review-1.
14
+ */
15
+ import { getActiveClient } from '../run/provider-client.js';
16
+ // ---------------------------------------------------------------------------
17
+ // Constants
18
+ // ---------------------------------------------------------------------------
19
+ const MAX_TASKS_PER_PHASE = 6;
20
+ const MAX_TOTAL_TASKS = 18;
21
+ // ---------------------------------------------------------------------------
22
+ // Planning prompt
23
+ // ---------------------------------------------------------------------------
24
+ const PLANNING_SYSTEM = `You are an expert software engineering planner. Given a goal (and optionally a detailed end-state spec), decompose the work into a phased plan suitable for a fleet of autonomous coding agents.
25
+
26
+ Output a JSON object with the following shape (STRICT — no markdown fences, no extra keys):
27
+ {
28
+ "scaffold": [
29
+ { "id": "scaffold-1", "goal": "<concrete task goal>" }
30
+ ],
31
+ "build": [
32
+ { "id": "build-1", "goal": "<concrete task goal>" },
33
+ { "id": "build-2", "goal": "<concrete task goal>" }
34
+ ],
35
+ "integrate": [
36
+ { "id": "integrate-1", "goal": "<concrete task goal>" }
37
+ ],
38
+ "verify": [
39
+ { "id": "verify-1", "goal": "<concrete task goal>" }
40
+ ],
41
+ "review": [
42
+ { "id": "review-1", "goal": "<concrete task goal>" }
43
+ ]
44
+ }
45
+
46
+ Phase meanings:
47
+ - scaffold: Set up project structure, config files, boilerplate (1-2 tasks).
48
+ - build: Core implementation tasks — these run IN PARALLEL and must be independent of each other (2-6 tasks).
49
+ - integrate: Wire together the built components (1-2 tasks).
50
+ - verify: Run tests, type-checks, linting, confirm correctness (1-2 tasks).
51
+ - review: Final review, documentation, cleanup (1-2 tasks).
52
+
53
+ Rules:
54
+ - scaffold: 1-2 tasks max.
55
+ - build: 2-6 tasks max (parallelizable, no mutual deps).
56
+ - integrate: 1-2 tasks max.
57
+ - verify: 1-2 tasks max.
58
+ - review: 1-2 tasks max.
59
+ - Total tasks across all phases: <= 18.
60
+ - Every task goal must be CONCRETE and actionable (not vague like "implement the feature").
61
+ - Every task goal must be CODE/BUILD/TEST work ONLY. NEVER include any outward or destructive action: no git push, no deploy/publish/release, no repository creation, no "ship"/"tidy --apply", no opening PRs. Tasks operate strictly within the target project directory.
62
+ - Output ONLY the raw JSON object — no explanation, no markdown, no surrounding text.`;
63
+ /**
64
+ * Extract a JSON object from model output that may contain prose or markdown
65
+ * fences. Tries the full string first, then scans for the first { ... } block.
66
+ */
67
+ function extractJson(raw) {
68
+ const trimmed = raw.trim();
69
+ // 1. Strip markdown code fences if present (```json ... ``` or ``` ... ```)
70
+ const fenceMatch = trimmed.match(/```(?:json)?\s*([\s\S]*?)```/);
71
+ const candidate = fenceMatch ? fenceMatch[1].trim() : trimmed;
72
+ // 2. Try direct parse
73
+ try {
74
+ return JSON.parse(candidate);
75
+ }
76
+ catch {
77
+ // fall through
78
+ }
79
+ // 3. Find first top-level { ... } block in the original raw string
80
+ const start = raw.indexOf('{');
81
+ const end = raw.lastIndexOf('}');
82
+ if (start !== -1 && end > start) {
83
+ try {
84
+ return JSON.parse(raw.slice(start, end + 1));
85
+ }
86
+ catch {
87
+ // fall through
88
+ }
89
+ }
90
+ return null;
91
+ }
92
+ /**
93
+ * Parse a raw phase array into SwarmTaskSpec[]. Caps at maxCount.
94
+ * Assigns canonical ids of the form "<phase>-<N>" if the model's ids look wrong.
95
+ */
96
+ function parsePhase(raw, phase, maxCount, budgetRemaining) {
97
+ if (!Array.isArray(raw) || raw.length === 0)
98
+ return [];
99
+ const tasks = [];
100
+ const effectiveMax = Math.min(maxCount, budgetRemaining);
101
+ for (let i = 0; i < Math.min(raw.length, effectiveMax); i++) {
102
+ const item = raw[i];
103
+ if (!item || typeof item !== 'object')
104
+ continue;
105
+ const goal = typeof item.goal === 'string' && item.goal.trim().length > 0
106
+ ? item.goal.trim()
107
+ : null;
108
+ if (!goal)
109
+ continue;
110
+ // Normalise id: use canonical form to guarantee uniqueness and phase tagging.
111
+ const id = `${phase}-${tasks.length + 1}`;
112
+ // deps are assigned by the caller based on phase ordering, not the model output.
113
+ tasks.push({ id, phase, goal, deps: [] });
114
+ }
115
+ return tasks;
116
+ }
117
+ /**
118
+ * Assign cross-phase deps so later phases depend on all tasks in the
119
+ * immediately preceding phase. Build-phase tasks are independent (no intra-
120
+ * build deps). Non-build phases get deps on the last-phase task ids.
121
+ *
122
+ * Phase ordering: scaffold -> build -> integrate -> verify -> review.
123
+ */
124
+ function wireDeps(tasks) {
125
+ const byPhase = {
126
+ scaffold: [],
127
+ build: [],
128
+ integrate: [],
129
+ verify: [],
130
+ review: [],
131
+ };
132
+ for (const t of tasks) {
133
+ byPhase[t.phase].push(t);
134
+ }
135
+ const phaseOrder = ['scaffold', 'build', 'integrate', 'verify', 'review'];
136
+ const wired = [];
137
+ let prevPhaseIds = [];
138
+ for (const phase of phaseOrder) {
139
+ const phaseTasks = byPhase[phase];
140
+ for (const t of phaseTasks) {
141
+ // BUILD tasks are parallel — all depend on scaffold tasks only (the
142
+ // previous phase), not on each other.
143
+ // All other phases depend on the entire previous phase completing.
144
+ wired.push({ ...t, deps: [...prevPhaseIds] });
145
+ }
146
+ // After processing this phase, its task ids become deps for the next phase.
147
+ prevPhaseIds = phaseTasks.map((t) => t.id);
148
+ }
149
+ return wired;
150
+ }
151
+ /**
152
+ * Try to parse a SwarmPlan from model output. Returns null if parsing fails
153
+ * or produces no tasks.
154
+ */
155
+ function parsePlan(raw, goal) {
156
+ const parsed = extractJson(raw);
157
+ if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed))
158
+ return null;
159
+ const rp = parsed;
160
+ // Track total budget across phases
161
+ let totalRemaining = MAX_TOTAL_TASKS;
162
+ const scaffoldTasks = parsePhase(rp.scaffold, 'scaffold', 2, totalRemaining);
163
+ totalRemaining -= scaffoldTasks.length;
164
+ const buildTasks = parsePhase(rp.build, 'build', MAX_TASKS_PER_PHASE, totalRemaining);
165
+ totalRemaining -= buildTasks.length;
166
+ const integrateTasks = parsePhase(rp.integrate, 'integrate', 2, totalRemaining);
167
+ totalRemaining -= integrateTasks.length;
168
+ const verifyTasks = parsePhase(rp.verify, 'verify', 2, totalRemaining);
169
+ totalRemaining -= verifyTasks.length;
170
+ const reviewTasks = parsePhase(rp.review, 'review', 2, totalRemaining);
171
+ const allTasks = [
172
+ ...scaffoldTasks,
173
+ ...buildTasks,
174
+ ...integrateTasks,
175
+ ...verifyTasks,
176
+ ...reviewTasks,
177
+ ];
178
+ if (allTasks.length === 0)
179
+ return null;
180
+ const wired = wireDeps(allTasks);
181
+ return { specId: null, goal, tasks: wired };
182
+ }
183
+ // ---------------------------------------------------------------------------
184
+ // Default fallback plan
185
+ // ---------------------------------------------------------------------------
186
+ /**
187
+ * Build a sensible default plan when model output cannot be parsed.
188
+ * 1 scaffold, 3 build (independent), 1 integrate, 1 verify, 1 review.
189
+ */
190
+ function defaultPlan(goal) {
191
+ const scaffoldTask = {
192
+ id: 'scaffold-1',
193
+ phase: 'scaffold',
194
+ goal: `Set up project structure and boilerplate for: ${goal}`,
195
+ deps: [],
196
+ };
197
+ const buildTasks = [
198
+ {
199
+ id: 'build-1',
200
+ phase: 'build',
201
+ goal: `Implement core data models and types for: ${goal}`,
202
+ deps: ['scaffold-1'],
203
+ },
204
+ {
205
+ id: 'build-2',
206
+ phase: 'build',
207
+ goal: `Implement primary business logic for: ${goal}`,
208
+ deps: ['scaffold-1'],
209
+ },
210
+ {
211
+ id: 'build-3',
212
+ phase: 'build',
213
+ goal: `Implement CLI or API interface for: ${goal}`,
214
+ deps: ['scaffold-1'],
215
+ },
216
+ ];
217
+ const integrateTask = {
218
+ id: 'integrate-1',
219
+ phase: 'integrate',
220
+ goal: `Wire together all components and ensure they work end-to-end for: ${goal}`,
221
+ deps: ['build-1', 'build-2', 'build-3'],
222
+ };
223
+ const verifyTask = {
224
+ id: 'verify-1',
225
+ phase: 'verify',
226
+ goal: `Run tests, type-checks, and lint; fix any failures for: ${goal}`,
227
+ deps: ['integrate-1'],
228
+ };
229
+ const reviewTask = {
230
+ id: 'review-1',
231
+ phase: 'review',
232
+ goal: `Review code quality, add documentation, and clean up for: ${goal}`,
233
+ deps: ['verify-1'],
234
+ };
235
+ return {
236
+ specId: null,
237
+ goal,
238
+ tasks: [scaffoldTask, ...buildTasks, integrateTask, verifyTask, reviewTask],
239
+ };
240
+ }
241
+ // ---------------------------------------------------------------------------
242
+ // Public API
243
+ // ---------------------------------------------------------------------------
244
+ /**
245
+ * Decompose a goal (+ optional spec body) into a phased SwarmPlan.
246
+ *
247
+ * CONTRACT (from docs/contracts/CONTRACT-M12.md):
248
+ * planSwarm(input: { goal: string; specBody?: string }, cfg: AshlrConfig): Promise<SwarmPlan>
249
+ *
250
+ * Guardrails:
251
+ * - Single bounded model call; never throws.
252
+ * - Tasks per phase <= 6; total tasks <= 18.
253
+ * - BUILD-phase tasks are independent (deps = scaffold tasks only).
254
+ * - Falls back to a sensible default plan on any failure.
255
+ * - LOCAL-first (opts.allowCloud defaults false).
256
+ */
257
+ export async function planSwarm(input, cfg) {
258
+ const { goal, specBody } = input;
259
+ // Build the user prompt
260
+ const userPrompt = specBody
261
+ ? `Goal: ${goal}\n\nSpec:\n${specBody.slice(0, 8000)}` // guard against enormous spec bodies
262
+ : `Goal: ${goal}`;
263
+ // Attempt a single LOCAL-first model call
264
+ let rawOutput;
265
+ try {
266
+ const client = await getActiveClient(cfg, { allowCloud: false });
267
+ const result = await client.chat([
268
+ { role: 'system', content: PLANNING_SYSTEM },
269
+ { role: 'user', content: userPrompt },
270
+ ]);
271
+ rawOutput = result.content;
272
+ }
273
+ catch (err) {
274
+ const msg = err instanceof Error ? err.message : String(err);
275
+ process.stderr.write(`[ashlr swarm] planner model call failed: ${msg} — using default plan\n`);
276
+ return defaultPlan(goal);
277
+ }
278
+ // Parse the model output
279
+ try {
280
+ const plan = parsePlan(rawOutput, goal);
281
+ if (plan && plan.tasks.length > 0) {
282
+ return plan;
283
+ }
284
+ }
285
+ catch (parseErr) {
286
+ const msg = parseErr instanceof Error ? parseErr.message : String(parseErr);
287
+ process.stderr.write(`[ashlr swarm] planner parse error: ${msg} — using default plan\n`);
288
+ }
289
+ // Fall back to default
290
+ process.stderr.write(`[ashlr swarm] planner could not extract a valid plan from model output — using default plan\n`);
291
+ return defaultPlan(goal);
292
+ }
293
+ //# sourceMappingURL=planner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"planner.js","sourceRoot":"","sources":["../../../src/core/swarm/planner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,8EAA8E;AAC9E,YAAY;AACZ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C,KAAK,CAAC,sCAAsC,GAAG,yBAAyB,CAAC,CAAC;IAC3F,CAAC;IAED,uBAAuB;IACvB,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,+FAA+F,CAChG,CAAC;IACF,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * core/swarm/rollback.ts — M17 rollback support.
3
+ *
4
+ * snapshotProject: READ-ONLY git snapshot taken before a swarm operates.
5
+ * Never throws; degrades gracefully to isRepo:false on any failure.
6
+ *
7
+ * rollbackTo: CONFIRM-GATED restore of a prior snapshot.
8
+ * The CLI gates this behind an explicit `ashlr swarm rollback <id>` command
9
+ * with a --yes confirm and optional --force; this function assumes that
10
+ * confirmation has already happened.
11
+ *
12
+ * GUARDRAILS (top priority):
13
+ * - rollbackTo is the ONLY potentially-destructive operation in M17.
14
+ * - NEVER pushes to a remote, NEVER deletes branches.
15
+ * - NEVER force-resets without opts.force === true.
16
+ * - Refuses (ok:false) on non-repo, or dirty tree without --force.
17
+ * - Never throws — all error paths return { ok: false, detail }.
18
+ * - Uses execFileSync with 10 s timeout and stdio:'pipe'.
19
+ */
20
+ import type { RollbackSnapshot } from '../types.js';
21
+ /**
22
+ * Take a READ-ONLY snapshot of the project's git state.
23
+ *
24
+ * Contract:
25
+ * - NEVER throws; degrades to { isRepo: false, ... } on any failure.
26
+ * - Does NOT modify the working tree (no commit, no stash pop, no checkout).
27
+ * - If the tree is dirty, creates a stash object via `git stash create`
28
+ * (which writes the object to the ODB but does NOT touch HEAD or the index)
29
+ * and stores the resulting object sha as `stashRef`. This ensures the dirty
30
+ * tree is preserved in the ODB and can be restored later via `git stash apply`.
31
+ */
32
+ export declare function snapshotProject(project: string | null): RollbackSnapshot;
33
+ /**
34
+ * Restore a project to a previously snapshotted git state.
35
+ *
36
+ * Contract:
37
+ * - CONFIRM-GATED by the CLI; this function assumes confirmation happened.
38
+ * - NEVER pushes to a remote.
39
+ * - NEVER deletes branches.
40
+ * - NEVER force-resets without opts.force === true.
41
+ * - Refuses (returns { ok: false, detail }) without throwing when:
42
+ * • snap.isRepo is false (nothing to restore)
43
+ * • the current working tree is dirty and opts.force is false
44
+ * • any git operation fails
45
+ * - With opts.force: uses `git reset --hard <head>` so local uncommitted
46
+ * changes are discarded. Without opts.force: uses `git checkout <head>`
47
+ * which refuses to overwrite a dirty tree, giving the user a safe fallback.
48
+ * - After restoring HEAD, if snap.stashRef is set, attempts `git stash apply`
49
+ * to re-apply the dirty tree captured at snapshot time.
50
+ */
51
+ export declare function rollbackTo(snap: RollbackSnapshot, opts: {
52
+ force: boolean;
53
+ }): Promise<{
54
+ ok: boolean;
55
+ detail: string;
56
+ }>;
@@ -0,0 +1,266 @@
1
+ /**
2
+ * core/swarm/rollback.ts — M17 rollback support.
3
+ *
4
+ * snapshotProject: READ-ONLY git snapshot taken before a swarm operates.
5
+ * Never throws; degrades gracefully to isRepo:false on any failure.
6
+ *
7
+ * rollbackTo: CONFIRM-GATED restore of a prior snapshot.
8
+ * The CLI gates this behind an explicit `ashlr swarm rollback <id>` command
9
+ * with a --yes confirm and optional --force; this function assumes that
10
+ * confirmation has already happened.
11
+ *
12
+ * GUARDRAILS (top priority):
13
+ * - rollbackTo is the ONLY potentially-destructive operation in M17.
14
+ * - NEVER pushes to a remote, NEVER deletes branches.
15
+ * - NEVER force-resets without opts.force === true.
16
+ * - Refuses (ok:false) on non-repo, or dirty tree without --force.
17
+ * - Never throws — all error paths return { ok: false, detail }.
18
+ * - Uses execFileSync with 10 s timeout and stdio:'pipe'.
19
+ */
20
+ import { execFileSync } from 'node:child_process';
21
+ // ---------------------------------------------------------------------------
22
+ // Internal helpers
23
+ // ---------------------------------------------------------------------------
24
+ const GIT_TIMEOUT = 10_000; // ms — rollback ops may take longer than reads
25
+ /**
26
+ * Run a git command inside `cwd`. Returns trimmed stdout or null on error.
27
+ */
28
+ function git(cwd, args) {
29
+ try {
30
+ const out = execFileSync('git', args, {
31
+ cwd,
32
+ timeout: GIT_TIMEOUT,
33
+ stdio: 'pipe',
34
+ encoding: 'utf8',
35
+ });
36
+ return typeof out === 'string' ? out.trim() : null;
37
+ }
38
+ catch {
39
+ return null;
40
+ }
41
+ }
42
+ /**
43
+ * Returns true when `dir` is the root of a git repository (standard .git dir,
44
+ * worktree file, or submodule pointer).
45
+ *
46
+ * Uses rev-parse rather than filesystem inspection so detached/bare repos and
47
+ * git worktrees are detected correctly. Returns false on any error.
48
+ */
49
+ function isGitRepo(dir) {
50
+ // git rev-parse --git-dir exits 0 only inside a git repo.
51
+ const result = git(dir, ['rev-parse', '--git-dir']);
52
+ return result !== null;
53
+ }
54
+ // ---------------------------------------------------------------------------
55
+ // Public API
56
+ // ---------------------------------------------------------------------------
57
+ /**
58
+ * Take a READ-ONLY snapshot of the project's git state.
59
+ *
60
+ * Contract:
61
+ * - NEVER throws; degrades to { isRepo: false, ... } on any failure.
62
+ * - Does NOT modify the working tree (no commit, no stash pop, no checkout).
63
+ * - If the tree is dirty, creates a stash object via `git stash create`
64
+ * (which writes the object to the ODB but does NOT touch HEAD or the index)
65
+ * and stores the resulting object sha as `stashRef`. This ensures the dirty
66
+ * tree is preserved in the ODB and can be restored later via `git stash apply`.
67
+ */
68
+ export function snapshotProject(project) {
69
+ const ts = new Date().toISOString();
70
+ const base = {
71
+ project,
72
+ isRepo: false,
73
+ head: null,
74
+ dirty: false,
75
+ stashRef: null,
76
+ ts,
77
+ };
78
+ if (!project)
79
+ return base;
80
+ try {
81
+ if (!isGitRepo(project))
82
+ return base;
83
+ // Resolve HEAD sha.
84
+ const head = git(project, ['rev-parse', 'HEAD']);
85
+ if (!head) {
86
+ // Repo exists but HEAD is unresolvable (e.g. fresh repo with no commits).
87
+ return { ...base, isRepo: true };
88
+ }
89
+ // Record the branch name HEAD points at (null when detached: rev-parse
90
+ // --abbrev-ref HEAD prints 'HEAD' in detached state). Lets a non-force
91
+ // rollback return to the original branch instead of leaving detached HEAD.
92
+ const abbrev = git(project, ['rev-parse', '--abbrev-ref', 'HEAD']);
93
+ const branch = abbrev && abbrev !== 'HEAD' ? abbrev : null;
94
+ // Determine whether the working tree is dirty (any tracked/untracked changes).
95
+ const porcelain = git(project, ['status', '--porcelain']);
96
+ const dirty = porcelain !== null && porcelain.length > 0;
97
+ let stashRef = null;
98
+ if (dirty) {
99
+ // `git stash create` writes a stash commit to the ODB and prints its sha,
100
+ // WITHOUT modifying HEAD, the index, or the working tree. Safe and
101
+ // non-destructive. Returns empty/null if nothing to stash.
102
+ const sha = git(project, ['stash', 'create', '--include-untracked']);
103
+ if (sha && sha.length > 0) {
104
+ stashRef = sha;
105
+ // DURABILITY: a raw `stash create` object is not referenced by any ref,
106
+ // so `git gc`/prune can collect it before rollback. Anchor it with a
107
+ // content-addressed ref so it survives GC until we apply + clean it up.
108
+ // Best-effort: if update-ref fails the sha is still recorded (it may
109
+ // simply be lost to GC after a long delay — same as before this change).
110
+ git(project, ['update-ref', `refs/ashlr/stash/${sha}`, sha]);
111
+ }
112
+ }
113
+ return {
114
+ project,
115
+ isRepo: true,
116
+ head,
117
+ branch,
118
+ dirty,
119
+ stashRef,
120
+ ts,
121
+ };
122
+ }
123
+ catch {
124
+ // Belt-and-suspenders: the inner git() calls never throw, but we guard the
125
+ // whole body so snapshot is unconditionally safe to call.
126
+ return base;
127
+ }
128
+ }
129
+ /**
130
+ * Restore a project to a previously snapshotted git state.
131
+ *
132
+ * Contract:
133
+ * - CONFIRM-GATED by the CLI; this function assumes confirmation happened.
134
+ * - NEVER pushes to a remote.
135
+ * - NEVER deletes branches.
136
+ * - NEVER force-resets without opts.force === true.
137
+ * - Refuses (returns { ok: false, detail }) without throwing when:
138
+ * • snap.isRepo is false (nothing to restore)
139
+ * • the current working tree is dirty and opts.force is false
140
+ * • any git operation fails
141
+ * - With opts.force: uses `git reset --hard <head>` so local uncommitted
142
+ * changes are discarded. Without opts.force: uses `git checkout <head>`
143
+ * which refuses to overwrite a dirty tree, giving the user a safe fallback.
144
+ * - After restoring HEAD, if snap.stashRef is set, attempts `git stash apply`
145
+ * to re-apply the dirty tree captured at snapshot time.
146
+ */
147
+ export async function rollbackTo(snap, opts) {
148
+ // --- Pre-condition: must be a git repo ---
149
+ if (!snap.isRepo || !snap.project) {
150
+ return {
151
+ ok: false,
152
+ detail: 'Rollback refused: the project is not a git repository. ' +
153
+ 'No git state can be restored.',
154
+ };
155
+ }
156
+ if (!snap.head) {
157
+ return {
158
+ ok: false,
159
+ detail: 'Rollback refused: no HEAD sha was recorded in the snapshot ' +
160
+ '(the repo may have had no commits when the snapshot was taken).',
161
+ };
162
+ }
163
+ const project = snap.project;
164
+ // --- Check current dirty state ---
165
+ try {
166
+ const porcelain = git(project, ['status', '--porcelain']);
167
+ const nowDirty = porcelain !== null && porcelain.length > 0;
168
+ if (nowDirty && !opts.force) {
169
+ return {
170
+ ok: false,
171
+ detail: 'Rollback refused: the working tree has uncommitted changes. ' +
172
+ 'Pass --force to discard them and restore the snapshot, or commit/stash ' +
173
+ 'your work first.',
174
+ };
175
+ }
176
+ const restoredLines = [];
177
+ // --- Restore HEAD ---
178
+ // With --force: hard reset (discards all local changes, replaces working tree).
179
+ // Without --force: checkout (safe; refuses to overwrite dirty files — but we
180
+ // already checked dirty above, so at this point nowDirty must be false).
181
+ let restoreResult;
182
+ let restoreMethod;
183
+ if (opts.force) {
184
+ // DESTRUCTIVE-TO-COMMITTED-WORK WARNING: `reset --hard` to an older sha
185
+ // silently discards any commits made AFTER the snapshot (they become
186
+ // unreferenced, recoverable only via reflog/GC window). Surface the count
187
+ // so the human approving this op sees exactly what is lost — the working
188
+ // tree warning alone understates the loss of committed work.
189
+ const aheadStr = git(project, ['rev-list', '--count', `${snap.head}..HEAD`]);
190
+ const ahead = aheadStr !== null ? parseInt(aheadStr, 10) : NaN;
191
+ if (Number.isFinite(ahead) && ahead > 0) {
192
+ restoredLines.push(`WARNING: this discarded ${ahead} commit(s) made since the snapshot. ` +
193
+ `They are unreferenced now and recoverable only via \`git reflog\` ` +
194
+ `until garbage-collected.`);
195
+ }
196
+ // ONLY force-reset when the caller explicitly passed --force.
197
+ restoreResult = git(project, ['reset', '--hard', snap.head]);
198
+ restoreMethod = `git reset --hard ${snap.head}`;
199
+ }
200
+ else {
201
+ // Prefer returning to the ORIGINAL BRANCH (avoids detached HEAD) when the
202
+ // recorded branch still resolves to the snapshot sha. Otherwise fall back
203
+ // to checking out the raw sha (which detaches HEAD — noted below).
204
+ const branchSha = snap.branch ? git(project, ['rev-parse', snap.branch]) : null;
205
+ if (snap.branch && branchSha === snap.head) {
206
+ restoreResult = git(project, ['checkout', snap.branch]);
207
+ restoreMethod = `git checkout ${snap.branch}`;
208
+ }
209
+ else {
210
+ restoreResult = git(project, ['checkout', snap.head]);
211
+ restoreMethod = `git checkout ${snap.head}`;
212
+ }
213
+ }
214
+ if (restoreResult === null) {
215
+ return {
216
+ ok: false,
217
+ detail: `Rollback failed: \`${restoreMethod}\` returned an error. ` +
218
+ 'The repository state was not modified.',
219
+ };
220
+ }
221
+ restoredLines.push(`Restored HEAD to ${snap.head} (via ${restoreMethod}).`);
222
+ // Detect a detached-HEAD result and tell the user how to reattach. This
223
+ // happens on the non-force path when the original branch no longer points
224
+ // at the snapshot sha (or none was recorded), so we checked out a raw sha.
225
+ const afterBranch = git(project, ['rev-parse', '--abbrev-ref', 'HEAD']);
226
+ if (afterBranch === 'HEAD') {
227
+ restoredLines.push(snap.branch
228
+ ? `Note: HEAD is now DETACHED (branch "${snap.branch}" has moved past the ` +
229
+ `snapshot). Reattach with \`git checkout ${snap.branch}\` when ready.`
230
+ : `Note: HEAD is now DETACHED at ${snap.head}. ` +
231
+ `Reattach to a branch with \`git checkout <branch>\` when ready.`);
232
+ }
233
+ // --- Re-apply stash if one was recorded ---
234
+ if (snap.stashRef) {
235
+ const applyResult = git(project, ['stash', 'apply', snap.stashRef]);
236
+ if (applyResult !== null) {
237
+ restoredLines.push(`Re-applied dirty-tree stash ${snap.stashRef}.`);
238
+ // Clean up the anchor ref we created at snapshot time (best-effort).
239
+ git(project, ['update-ref', '-d', `refs/ashlr/stash/${snap.stashRef}`]);
240
+ }
241
+ else {
242
+ // Non-fatal: stash apply failure leaves the repo at the restored HEAD
243
+ // which is still the correct base. Report but don't fail the rollback.
244
+ // Leave the anchor ref in place so the stash is not lost to GC and the
245
+ // user can apply it manually.
246
+ restoredLines.push(`Warning: could not re-apply dirty-tree stash ${snap.stashRef}. ` +
247
+ `HEAD was still restored to ${snap.head}. ` +
248
+ 'You may need to apply the stash manually: ' +
249
+ `\`git stash apply ${snap.stashRef}\``);
250
+ }
251
+ }
252
+ return {
253
+ ok: true,
254
+ detail: restoredLines.join('\n'),
255
+ };
256
+ }
257
+ catch {
258
+ // Belt-and-suspenders: inner calls never throw, but guard the whole body.
259
+ return {
260
+ ok: false,
261
+ detail: 'Rollback failed: an unexpected error occurred. ' +
262
+ 'The repository state may be unmodified.',
263
+ };
264
+ }
265
+ }
266
+ //# sourceMappingURL=rollback.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rollback.js","sourceRoot":"","sources":["../../../src/core/swarm/rollback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E;AAE9E,MAAM,WAAW,GAAG,MAAM,CAAC,CAAC,+CAA+C;AAE3E;;GAEG;AACH,SAAS,GAAG,CAAC,GAAW,EAAE,IAAc;IACtC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE;YACpC,GAAG;YACH,OAAO,EAAE,WAAW;YACpB,KAAK,EAAE,MAAM;YACb,QAAQ,EAAE,MAAM;SACjB,CAAC,CAAC;QACH,OAAO,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACrD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