@ambystech/ambykit 1.6.0 → 2.0.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 (392) hide show
  1. package/CHANGELOG.md +152 -2
  2. package/README.md +12 -8
  3. package/dist/cli/add.js +9 -0
  4. package/dist/cli/add.js.map +1 -1
  5. package/dist/cli/analyze.js +25 -4
  6. package/dist/cli/analyze.js.map +1 -1
  7. package/dist/cli/base-command.d.ts +8 -0
  8. package/dist/cli/base-command.js +30 -0
  9. package/dist/cli/base-command.js.map +1 -1
  10. package/dist/cli/check.d.ts +2 -0
  11. package/dist/cli/check.js +38 -4
  12. package/dist/cli/check.js.map +1 -1
  13. package/dist/cli/dashboard.d.ts +1 -1
  14. package/dist/cli/dashboard.js +55 -14
  15. package/dist/cli/dashboard.js.map +1 -1
  16. package/dist/cli/edit.d.ts +17 -0
  17. package/dist/cli/edit.js +71 -0
  18. package/dist/cli/edit.js.map +1 -0
  19. package/dist/cli/fleet.d.ts +2 -0
  20. package/dist/cli/fleet.js +23 -1
  21. package/dist/cli/fleet.js.map +1 -1
  22. package/dist/cli/index.d.ts +1 -5
  23. package/dist/cli/index.js +21 -111
  24. package/dist/cli/index.js.map +1 -1
  25. package/dist/cli/init.js +9 -0
  26. package/dist/cli/init.js.map +1 -1
  27. package/dist/cli/lane.d.ts +38 -1
  28. package/dist/cli/lane.js +116 -5
  29. package/dist/cli/lane.js.map +1 -1
  30. package/dist/cli/main.d.ts +6 -0
  31. package/dist/cli/main.js +111 -0
  32. package/dist/cli/main.js.map +1 -0
  33. package/dist/cli/mcp.d.ts +2 -0
  34. package/dist/cli/mcp.js +4 -0
  35. package/dist/cli/mcp.js.map +1 -1
  36. package/dist/cli/migrate.d.ts +17 -0
  37. package/dist/cli/migrate.js +67 -0
  38. package/dist/cli/migrate.js.map +1 -0
  39. package/dist/cli/node-guard.d.ts +4 -0
  40. package/dist/cli/node-guard.js +12 -0
  41. package/dist/cli/node-guard.js.map +1 -0
  42. package/dist/cli/run-budget.d.ts +7 -0
  43. package/dist/cli/run-budget.js +42 -5
  44. package/dist/cli/run-budget.js.map +1 -1
  45. package/dist/cli/run-control.d.ts +12 -0
  46. package/dist/cli/run-control.js +24 -2
  47. package/dist/cli/run-control.js.map +1 -1
  48. package/dist/cli/run-files.d.ts +1 -1
  49. package/dist/cli/run-fleet-control.d.ts +16 -0
  50. package/dist/cli/run-fleet-control.js +23 -0
  51. package/dist/cli/run-fleet-control.js.map +1 -0
  52. package/dist/cli/run-fleet-loop.d.ts +77 -0
  53. package/dist/cli/run-fleet-loop.js +156 -0
  54. package/dist/cli/run-fleet-loop.js.map +1 -0
  55. package/dist/cli/run-fleet-merge.d.ts +22 -0
  56. package/dist/cli/run-fleet-merge.js +69 -0
  57. package/dist/cli/run-fleet-merge.js.map +1 -0
  58. package/dist/cli/run-fleet-prepare.d.ts +35 -0
  59. package/dist/cli/run-fleet-prepare.js +58 -0
  60. package/dist/cli/run-fleet-prepare.js.map +1 -0
  61. package/dist/cli/run-fleet.d.ts +28 -0
  62. package/dist/cli/run-fleet.js +382 -0
  63. package/dist/cli/run-fleet.js.map +1 -0
  64. package/dist/cli/run-gates.js +2 -2
  65. package/dist/cli/run-gates.js.map +1 -1
  66. package/dist/cli/run-launch.js +22 -5
  67. package/dist/cli/run-launch.js.map +1 -1
  68. package/dist/cli/run-loop.d.ts +2 -0
  69. package/dist/cli/run-loop.js +51 -4
  70. package/dist/cli/run-loop.js.map +1 -1
  71. package/dist/cli/run-merger.d.ts +6 -0
  72. package/dist/cli/run-merger.js +40 -2
  73. package/dist/cli/run-merger.js.map +1 -1
  74. package/dist/cli/run-phase-check.d.ts +32 -0
  75. package/dist/cli/run-phase-check.js +173 -0
  76. package/dist/cli/run-phase-check.js.map +1 -0
  77. package/dist/cli/run-plan.d.ts +1 -1
  78. package/dist/cli/run-plan.js +24 -11
  79. package/dist/cli/run-plan.js.map +1 -1
  80. package/dist/cli/run-process.d.ts +6 -0
  81. package/dist/cli/run-process.js +17 -5
  82. package/dist/cli/run-process.js.map +1 -1
  83. package/dist/cli/run-protocol-prompts.d.ts +11 -1
  84. package/dist/cli/run-protocol-prompts.js +32 -5
  85. package/dist/cli/run-protocol-prompts.js.map +1 -1
  86. package/dist/cli/run-protocol.d.ts +8 -1
  87. package/dist/cli/run-protocol.js +35 -6
  88. package/dist/cli/run-protocol.js.map +1 -1
  89. package/dist/cli/run-script.js +3 -2
  90. package/dist/cli/run-script.js.map +1 -1
  91. package/dist/cli/run-session.d.ts +33 -0
  92. package/dist/cli/run-session.js.map +1 -1
  93. package/dist/cli/run-stages.d.ts +11 -0
  94. package/dist/cli/run-stages.js +34 -0
  95. package/dist/cli/run-stages.js.map +1 -0
  96. package/dist/cli/run-supervisor.js +26 -3
  97. package/dist/cli/run-supervisor.js.map +1 -1
  98. package/dist/cli/run.d.ts +11 -3
  99. package/dist/cli/run.js +86 -12
  100. package/dist/cli/run.js.map +1 -1
  101. package/dist/cli/sync.js +10 -5
  102. package/dist/cli/sync.js.map +1 -1
  103. package/dist/cli/ui/dashboard/empty-state.d.ts +5 -0
  104. package/dist/cli/ui/dashboard/empty-state.js +7 -0
  105. package/dist/cli/ui/dashboard/empty-state.js.map +1 -1
  106. package/dist/cli/ui/dashboard/filter-line.d.ts +13 -0
  107. package/dist/cli/ui/dashboard/filter-line.js +20 -0
  108. package/dist/cli/ui/dashboard/filter-line.js.map +1 -0
  109. package/dist/cli/ui/dashboard/fleet-tab.d.ts +25 -0
  110. package/dist/cli/ui/dashboard/fleet-tab.js +91 -0
  111. package/dist/cli/ui/dashboard/fleet-tab.js.map +1 -0
  112. package/dist/cli/ui/dashboard/fleet-view.d.ts +1 -0
  113. package/dist/cli/ui/dashboard/fleet-view.js +1 -1
  114. package/dist/cli/ui/dashboard/fleet-view.js.map +1 -1
  115. package/dist/cli/ui/dashboard/help-overlay.d.ts +3 -1
  116. package/dist/cli/ui/dashboard/help-overlay.js +27 -5
  117. package/dist/cli/ui/dashboard/help-overlay.js.map +1 -1
  118. package/dist/cli/ui/dashboard/layout.d.ts +15 -0
  119. package/dist/cli/ui/dashboard/layout.js +22 -0
  120. package/dist/cli/ui/dashboard/layout.js.map +1 -1
  121. package/dist/cli/ui/dashboard/metrics-panel.d.ts +15 -0
  122. package/dist/cli/ui/dashboard/metrics-panel.js +143 -0
  123. package/dist/cli/ui/dashboard/metrics-panel.js.map +1 -0
  124. package/dist/cli/ui/dashboard/tab-bar.d.ts +14 -0
  125. package/dist/cli/ui/dashboard/tab-bar.js +37 -0
  126. package/dist/cli/ui/dashboard/tab-bar.js.map +1 -0
  127. package/dist/cli/ui/dashboard/tab-frame.d.ts +43 -0
  128. package/dist/cli/ui/dashboard/tab-frame.js +68 -0
  129. package/dist/cli/ui/dashboard/tab-frame.js.map +1 -0
  130. package/dist/cli/ui/dashboard/tab-tokens.d.ts +569 -0
  131. package/dist/cli/ui/dashboard/tab-tokens.js +570 -0
  132. package/dist/cli/ui/dashboard/tab-tokens.js.map +1 -0
  133. package/dist/cli/ui/interactive/fullscreen.js +13 -3
  134. package/dist/cli/ui/interactive/fullscreen.js.map +1 -1
  135. package/dist/cli/ui/interactive/list-filter.d.ts +25 -0
  136. package/dist/cli/ui/interactive/list-filter.js +38 -0
  137. package/dist/cli/ui/interactive/list-filter.js.map +1 -0
  138. package/dist/cli/ui/interactive/overview.d.ts +37 -2
  139. package/dist/cli/ui/interactive/overview.js +321 -31
  140. package/dist/cli/ui/interactive/overview.js.map +1 -1
  141. package/dist/cli/ui/interactive/tabs.d.ts +15 -0
  142. package/dist/cli/ui/interactive/tabs.js +27 -0
  143. package/dist/cli/ui/interactive/tabs.js.map +1 -0
  144. package/dist/cli/ui/tool-options.d.ts +5 -1
  145. package/dist/cli/ui/tool-options.js +9 -3
  146. package/dist/cli/ui/tool-options.js.map +1 -1
  147. package/dist/cli/update.js +13 -2
  148. package/dist/cli/update.js.map +1 -1
  149. package/dist/core/analyze.d.ts +11 -0
  150. package/dist/core/analyze.js +33 -3
  151. package/dist/core/analyze.js.map +1 -1
  152. package/dist/core/burndown.d.ts +1 -1
  153. package/dist/core/burndown.js +2 -2
  154. package/dist/core/burndown.js.map +1 -1
  155. package/dist/core/checkouts.js +3 -2
  156. package/dist/core/checkouts.js.map +1 -1
  157. package/dist/core/config-schema.d.ts +45 -0
  158. package/dist/core/config-schema.js +63 -0
  159. package/dist/core/config-schema.js.map +1 -0
  160. package/dist/core/config.d.ts +3 -0
  161. package/dist/core/config.js +10 -0
  162. package/dist/core/config.js.map +1 -1
  163. package/dist/core/dashboard.js +3 -2
  164. package/dist/core/dashboard.js.map +1 -1
  165. package/dist/core/decisions.d.ts +12 -1
  166. package/dist/core/decisions.js +7 -2
  167. package/dist/core/decisions.js.map +1 -1
  168. package/dist/core/deprecation.d.ts +15 -0
  169. package/dist/core/deprecation.js +27 -0
  170. package/dist/core/deprecation.js.map +1 -0
  171. package/dist/core/features.js +11 -5
  172. package/dist/core/features.js.map +1 -1
  173. package/dist/core/fleet/fleet-text.d.ts +2 -0
  174. package/dist/core/fleet/fleet-text.js +41 -0
  175. package/dist/core/fleet/fleet-text.js.map +1 -0
  176. package/dist/core/fleet/fleet-view.d.ts +35 -0
  177. package/dist/core/fleet/fleet-view.js +43 -0
  178. package/dist/core/fleet/fleet-view.js.map +1 -0
  179. package/dist/core/fleet/fleets.d.ts +18 -0
  180. package/dist/core/fleet/fleets.js +64 -0
  181. package/dist/core/fleet/fleets.js.map +1 -0
  182. package/dist/core/fleet/flow-input.js +3 -4
  183. package/dist/core/fleet/flow-input.js.map +1 -1
  184. package/dist/core/fleet/index.d.ts +3 -0
  185. package/dist/core/fleet/index.js +3 -0
  186. package/dist/core/fleet/index.js.map +1 -1
  187. package/dist/core/fleet/runs.d.ts +18 -2
  188. package/dist/core/fleet/runs.js +67 -16
  189. package/dist/core/fleet/runs.js.map +1 -1
  190. package/dist/core/fleet-plan/budget.d.ts +18 -0
  191. package/dist/core/fleet-plan/budget.js +13 -0
  192. package/dist/core/fleet-plan/budget.js.map +1 -0
  193. package/dist/core/fleet-plan/contain.d.ts +10 -0
  194. package/dist/core/fleet-plan/contain.js +37 -0
  195. package/dist/core/fleet-plan/contain.js.map +1 -0
  196. package/dist/core/fleet-plan/format.d.ts +4 -0
  197. package/dist/core/fleet-plan/format.js +52 -0
  198. package/dist/core/fleet-plan/format.js.map +1 -0
  199. package/dist/core/fleet-plan/index.d.ts +7 -0
  200. package/dist/core/fleet-plan/index.js +8 -0
  201. package/dist/core/fleet-plan/index.js.map +1 -0
  202. package/dist/core/fleet-plan/order.d.ts +30 -0
  203. package/dist/core/fleet-plan/order.js +96 -0
  204. package/dist/core/fleet-plan/order.js.map +1 -0
  205. package/dist/core/fleet-plan/ownership.d.ts +12 -0
  206. package/dist/core/fleet-plan/ownership.js +36 -0
  207. package/dist/core/fleet-plan/ownership.js.map +1 -0
  208. package/dist/core/fleet-plan/plan.d.ts +23 -0
  209. package/dist/core/fleet-plan/plan.js +40 -0
  210. package/dist/core/fleet-plan/plan.js.map +1 -0
  211. package/dist/core/fleet-plan/read.d.ts +19 -0
  212. package/dist/core/fleet-plan/read.js +35 -0
  213. package/dist/core/fleet-plan/read.js.map +1 -0
  214. package/dist/core/fleet-plan/schedule.d.ts +15 -0
  215. package/dist/core/fleet-plan/schedule.js +27 -0
  216. package/dist/core/fleet-plan/schedule.js.map +1 -0
  217. package/dist/core/fleet-plan/select.d.ts +20 -0
  218. package/dist/core/fleet-plan/select.js +64 -0
  219. package/dist/core/fleet-plan/select.js.map +1 -0
  220. package/dist/core/fleet-plan/types.d.ts +123 -0
  221. package/dist/core/fleet-plan/types.js +2 -0
  222. package/dist/core/fleet-plan/types.js.map +1 -0
  223. package/dist/core/fleet-view/group.d.ts +51 -0
  224. package/dist/core/fleet-view/group.js +73 -0
  225. package/dist/core/fleet-view/group.js.map +1 -0
  226. package/dist/core/graph-format.d.ts +2 -0
  227. package/dist/core/graph-format.js +4 -3
  228. package/dist/core/graph-format.js.map +1 -1
  229. package/dist/core/graph-types.d.ts +4 -0
  230. package/dist/core/graph.js +38 -1
  231. package/dist/core/graph.js.map +1 -1
  232. package/dist/core/index.d.ts +1 -0
  233. package/dist/core/index.js +1 -0
  234. package/dist/core/index.js.map +1 -1
  235. package/dist/core/lanes.d.ts +53 -0
  236. package/dist/core/lanes.js +131 -0
  237. package/dist/core/lanes.js.map +1 -1
  238. package/dist/core/legacy.d.ts +2 -1
  239. package/dist/core/legacy.js +7 -2
  240. package/dist/core/legacy.js.map +1 -1
  241. package/dist/core/markers.d.ts +7 -0
  242. package/dist/core/markers.js +3 -2
  243. package/dist/core/markers.js.map +1 -1
  244. package/dist/core/metrics/cycle.d.ts +3 -0
  245. package/dist/core/metrics/cycle.js +47 -0
  246. package/dist/core/metrics/cycle.js.map +1 -0
  247. package/dist/core/metrics/gap.d.ts +9 -0
  248. package/dist/core/metrics/gap.js +35 -0
  249. package/dist/core/metrics/gap.js.map +1 -0
  250. package/dist/core/metrics/index.d.ts +21 -0
  251. package/dist/core/metrics/index.js +67 -0
  252. package/dist/core/metrics/index.js.map +1 -0
  253. package/dist/core/metrics/model.d.ts +23 -0
  254. package/dist/core/metrics/model.js +46 -0
  255. package/dist/core/metrics/model.js.map +1 -0
  256. package/dist/core/metrics/revisions.d.ts +22 -0
  257. package/dist/core/metrics/revisions.js +88 -0
  258. package/dist/core/metrics/revisions.js.map +1 -0
  259. package/dist/core/metrics/types.d.ts +74 -0
  260. package/dist/core/metrics/types.js +3 -0
  261. package/dist/core/metrics/types.js.map +1 -0
  262. package/dist/core/migrate/convert-spec.d.ts +19 -0
  263. package/dist/core/migrate/convert-spec.js +99 -0
  264. package/dist/core/migrate/convert-spec.js.map +1 -0
  265. package/dist/core/migrate/convert-tasks.d.ts +16 -0
  266. package/dist/core/migrate/convert-tasks.js +121 -0
  267. package/dist/core/migrate/convert-tasks.js.map +1 -0
  268. package/dist/core/migrate/run.d.ts +36 -0
  269. package/dist/core/migrate/run.js +178 -0
  270. package/dist/core/migrate/run.js.map +1 -0
  271. package/dist/core/migrate/safety.d.ts +33 -0
  272. package/dist/core/migrate/safety.js +199 -0
  273. package/dist/core/migrate/safety.js.map +1 -0
  274. package/dist/core/migrate/summary.d.ts +36 -0
  275. package/dist/core/migrate/summary.js +140 -0
  276. package/dist/core/migrate/summary.js.map +1 -0
  277. package/dist/core/moved-targets.d.ts +73 -8
  278. package/dist/core/moved-targets.js +79 -1
  279. package/dist/core/moved-targets.js.map +1 -1
  280. package/dist/core/overview-types.d.ts +7 -0
  281. package/dist/core/overview-types.js.map +1 -1
  282. package/dist/core/overview.js +4 -0
  283. package/dist/core/overview.js.map +1 -1
  284. package/dist/core/query.js +3 -2
  285. package/dist/core/query.js.map +1 -1
  286. package/dist/core/run-launch-plan.d.ts +2 -0
  287. package/dist/core/run-launch-plan.js +6 -1
  288. package/dist/core/run-launch-plan.js.map +1 -1
  289. package/dist/core/run-prompt.d.ts +43 -1
  290. package/dist/core/run-prompt.js +40 -4
  291. package/dist/core/run-prompt.js.map +1 -1
  292. package/dist/core/run-result.d.ts +42 -0
  293. package/dist/core/run-result.js +163 -0
  294. package/dist/core/run-result.js.map +1 -0
  295. package/dist/core/run-stability.d.ts +23 -0
  296. package/dist/core/run-stability.js +38 -0
  297. package/dist/core/run-stability.js.map +1 -0
  298. package/dist/core/runners.d.ts +58 -3
  299. package/dist/core/runners.js +99 -13
  300. package/dist/core/runners.js.map +1 -1
  301. package/dist/core/sibling-reads.d.ts +41 -0
  302. package/dist/core/sibling-reads.js +100 -0
  303. package/dist/core/sibling-reads.js.map +1 -0
  304. package/dist/core/spec-format/blocks.d.ts +19 -0
  305. package/dist/core/spec-format/blocks.js +58 -0
  306. package/dist/core/spec-format/blocks.js.map +1 -0
  307. package/dist/core/spec-format/detect.d.ts +14 -0
  308. package/dist/core/spec-format/detect.js +30 -0
  309. package/dist/core/spec-format/detect.js.map +1 -0
  310. package/dist/core/spec-format/dispatch.d.ts +13 -0
  311. package/dist/core/spec-format/dispatch.js +64 -0
  312. package/dist/core/spec-format/dispatch.js.map +1 -0
  313. package/dist/core/spec-format/frontmatter.d.ts +18 -0
  314. package/dist/core/spec-format/frontmatter.js +37 -0
  315. package/dist/core/spec-format/frontmatter.js.map +1 -0
  316. package/dist/core/spec-format/legacy.d.ts +40 -0
  317. package/dist/core/spec-format/legacy.js +91 -0
  318. package/dist/core/spec-format/legacy.js.map +1 -0
  319. package/dist/core/spec-format/meta.d.ts +3 -0
  320. package/dist/core/spec-format/meta.js +24 -0
  321. package/dist/core/spec-format/meta.js.map +1 -0
  322. package/dist/core/spec-format/model.d.ts +50 -0
  323. package/dist/core/spec-format/model.js +9 -0
  324. package/dist/core/spec-format/model.js.map +1 -0
  325. package/dist/core/spec-format/read-spec.d.ts +4 -0
  326. package/dist/core/spec-format/read-spec.js +102 -0
  327. package/dist/core/spec-format/read-spec.js.map +1 -0
  328. package/dist/core/spec-format/read-tasks.d.ts +2 -0
  329. package/dist/core/spec-format/read-tasks.js +146 -0
  330. package/dist/core/spec-format/read-tasks.js.map +1 -0
  331. package/dist/core/spec-format/write.d.ts +23 -0
  332. package/dist/core/spec-format/write.js +382 -0
  333. package/dist/core/spec-format/write.js.map +1 -0
  334. package/dist/core/subagents.js +0 -2
  335. package/dist/core/subagents.js.map +1 -1
  336. package/dist/core/tasks-edit.d.ts +4 -1
  337. package/dist/core/tasks-edit.js +19 -6
  338. package/dist/core/tasks-edit.js.map +1 -1
  339. package/dist/core/types.d.ts +14 -0
  340. package/dist/emitters/index.d.ts +0 -4
  341. package/dist/emitters/index.js +0 -10
  342. package/dist/emitters/index.js.map +1 -1
  343. package/dist/index.d.ts +2 -2
  344. package/dist/index.js +2 -2
  345. package/dist/index.js.map +1 -1
  346. package/dist/plugins/api.d.ts +14 -8
  347. package/dist/plugins/api.js +9 -8
  348. package/dist/plugins/api.js.map +1 -1
  349. package/dist/plugins/index.d.ts +3 -2
  350. package/dist/plugins/index.js +3 -2
  351. package/dist/plugins/index.js.map +1 -1
  352. package/dist/plugins/loader.d.ts +8 -0
  353. package/dist/plugins/loader.js +36 -6
  354. package/dist/plugins/loader.js.map +1 -1
  355. package/dist/plugins/report.d.ts +1 -1
  356. package/dist/plugins/report.js +3 -4
  357. package/dist/plugins/report.js.map +1 -1
  358. package/dist/plugins/session.d.ts +1 -0
  359. package/dist/plugins/session.js +1 -1
  360. package/dist/plugins/session.js.map +1 -1
  361. package/dist/testkit/index.d.ts +1 -1
  362. package/docs/architecture.md +16 -1
  363. package/docs/artifacts/decision-record.md +15 -0
  364. package/docs/artifacts/spec.md +35 -6
  365. package/docs/artifacts/tasks.md +67 -16
  366. package/docs/cli-reference.md +205 -12
  367. package/docs/contributing.md +6 -0
  368. package/docs/migration.md +191 -0
  369. package/docs/plugin-api.md +21 -13
  370. package/docs/plugin-split.md +5 -3
  371. package/docs/plugin-trust.md +2 -2
  372. package/docs/plugins-release.md +105 -0
  373. package/docs/release.md +103 -0
  374. package/docs/stability.md +152 -0
  375. package/docs/tool-compatibility.md +27 -6
  376. package/docs/workflow.md +10 -6
  377. package/package.json +4 -2
  378. package/src/agents/worker.md +2 -1
  379. package/src/prompts/converge.md +2 -2
  380. package/src/prompts/implement.md +13 -11
  381. package/src/prompts/revise.md +5 -2
  382. package/src/prompts/run.md +7 -4
  383. package/src/prompts/specify.md +5 -3
  384. package/src/prompts/tasks.md +9 -8
  385. package/src/templates/spec.md +10 -4
  386. package/src/templates/tasks.md +35 -13
  387. package/dist/emitters/antigravity-cli.d.ts +0 -15
  388. package/dist/emitters/antigravity-cli.js +0 -20
  389. package/dist/emitters/antigravity-cli.js.map +0 -1
  390. package/dist/emitters/antigravity.d.ts +0 -20
  391. package/dist/emitters/antigravity.js +0 -24
  392. package/dist/emitters/antigravity.js.map +0 -1
@@ -0,0 +1,38 @@
1
+ /**
2
+ * List filter slice (feature 032, US-3): `{query, state}` over features, stories and lanes. Pure; the active filter is
3
+ * a string the renderer shows, so a person always sees what is applied (FR-006).
4
+ */
5
+ export const NO_FILTER = { query: "" };
6
+ export function isActive(f) {
7
+ return f.query.trim() !== "" || f.state !== undefined;
8
+ }
9
+ export function matches(item, f) {
10
+ const q = f.query.trim().toLowerCase();
11
+ if (q && !item.id.toLowerCase().includes(q) && !(item.title ?? "").toLowerCase().includes(q))
12
+ return false;
13
+ if (f.state !== undefined && item.state !== f.state)
14
+ return false;
15
+ return true;
16
+ }
17
+ export function applyListFilter(items, f) {
18
+ return isActive(f) ? items.filter((i) => matches(i, f)) : [...items];
19
+ }
20
+ /** The next state in `cycle` after the current one; the cycle's first entry stands for "every state" (undefined). */
21
+ export function cycleState(f, cycle) {
22
+ const i = cycle.indexOf(f.state);
23
+ return { ...f, state: cycle[(i + 1) % cycle.length] };
24
+ }
25
+ /** `search: "auth" · state: blocked`, or "" when nothing is applied. */
26
+ export function filterText(f) {
27
+ const parts = [];
28
+ if (f.query.trim())
29
+ parts.push(`search: "${f.query.trim()}"`);
30
+ if (f.state !== undefined)
31
+ parts.push(`state: ${f.state}`);
32
+ return parts.join(" · ");
33
+ }
34
+ /** What to say when the filter hides everything, with how to clear it. */
35
+ export function noMatchText(f) {
36
+ return `Nothing matches ${filterText(f)}. Press esc to clear the filter.`;
37
+ }
38
+ //# sourceMappingURL=list-filter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-filter.js","sourceRoot":"","sources":["../../../../src/cli/ui/interactive/list-filter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAeH,MAAM,CAAC,MAAM,SAAS,GAAe,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;AAEnD,MAAM,UAAU,QAAQ,CAAC,CAAa;IACpC,OAAO,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,IAAgB,EAAE,CAAa;IACrD,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACvC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IAC3G,IAAI,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,IAAI,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC;IAClE,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,eAAe,CAAuB,KAAmB,EAAE,CAAa;IACtF,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC;AACvE,CAAC;AAED,qHAAqH;AACrH,MAAM,UAAU,UAAU,CAAC,CAAa,EAAE,KAAsC;IAC9E,MAAM,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACjC,OAAO,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;AACxD,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,UAAU,CAAC,CAAa;IACtC,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE;QAAE,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC9D,IAAI,CAAC,CAAC,KAAK,KAAK,SAAS;QAAE,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;IAC3D,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC3B,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,WAAW,CAAC,CAAa;IACvC,OAAO,mBAAmB,UAAU,CAAC,CAAC,CAAC,kCAAkC,CAAC;AAC5E,CAAC"}
@@ -1,21 +1,34 @@
1
1
  import type { StoryProgress, TaskLine } from "../../../core/dashboard.js";
2
2
  import type { FeatureSnapshot, Filters, ParseIssue } from "../../../core/overview-types.js";
3
3
  import type { BurndownState } from "../dashboard/burndown-chart.js";
4
- import type { HeaderMeta } from "../dashboard/cards.js";
4
+ import { type HeaderMeta } from "../dashboard/cards.js";
5
5
  import type { FleetView } from "../../../core/fleet-view/types.js";
6
+ import type { FleetsView } from "../../../core/fleet/fleet-view.js";
7
+ import type { Metrics } from "../../../core/metrics/types.js";
6
8
  import type { FleetViewApi } from "../dashboard/fleet-view.js";
9
+ import type { FleetTabApi } from "../dashboard/fleet-tab.js";
7
10
  import type { GraphViewApi } from "../dashboard/graph-view.js";
8
11
  import { type LiveStatus } from "../dashboard/live-indicator.js";
9
12
  import { type PresenceView } from "../dashboard/worktrees-panel.js";
10
13
  import type { Capabilities } from "../types.js";
11
14
  import type { FleetTuiState } from "./fleet.js";
12
15
  import type { KeyEvent } from "./fullscreen.js";
16
+ import { type Tab } from "./tabs.js";
13
17
  /**
14
18
  * Interactive dashboard (features 014 and 017). Pure reducer + renderer over injected data; the
15
19
  * fullscreen host owns IO. Overview: `tab` cycles Attention → Up next → Worktrees & agents → Feature
16
20
  * completion and `⏎` opens the feature view; there `⏎` opens the story detail. `?` shows help on
17
21
  * every screen. Refreshed data arrives through `applyData`.
18
22
  */
23
+ /** Feature 032 (US-4): workflow metrics, read after the first paint; absent outside the interactive dashboard. */
24
+ export type MetricsState = {
25
+ status: "loading";
26
+ } | {
27
+ status: "ready";
28
+ metrics: Metrics;
29
+ } | {
30
+ status: "failed";
31
+ };
19
32
  export interface OverviewTuiData {
20
33
  features: FeatureSnapshot[];
21
34
  issues: ParseIssue[];
@@ -37,8 +50,19 @@ export interface OverviewTuiData {
37
50
  fleetView?: FleetViewApi;
38
51
  /** The current fleet run as read from spec 025's files; null/absent ⇒ no run. */
39
52
  fleet?: FleetView | null;
53
+ /** Feature 032: the metrics read, delivered without blocking; a failure leaves every other view working. */
54
+ metricsState?: MetricsState;
40
55
  /** Terminal rows, for the Fleet view's scroll window (default 24). */
41
56
  rows?: number;
57
+ /**
58
+ * Feature 032: draw the tabbed frame (tab bar, shared filter line, the metrics panel, grouped fleet) around every screen.
59
+ * Set only by the interactive command; absent ⇒ the screens render exactly as before 032.
60
+ */
61
+ tabs?: boolean;
62
+ /** Spec 031's fleets (features, their lanes and states), for the Fleet tab's grouping by feature. */
63
+ fleets?: FleetsView | null;
64
+ /** The grouped Fleet tab's renderer, injected after a dynamic import like the other views. */
65
+ fleetTab?: FleetTabApi;
42
66
  }
43
67
  export type Panel = 0 | 1 | 2 | 3;
44
68
  /** The feature view's story list, and the story detail opened from it. */
@@ -54,8 +78,10 @@ export interface OverviewTuiState {
54
78
  focus: Panel;
55
79
  cursors: [number, number, number, number];
56
80
  filters: Filters;
57
- /** Feature-filter text being typed after `f`; null when not typing. */
81
+ /** Feature-filter text being typed after `f` (or search text after `/`); null when not typing. */
58
82
  input: string | null;
83
+ /** The field being typed is the free-text search (`/`), not the exact feature filter (`f`). */
84
+ searching?: boolean;
59
85
  feature: string | null;
60
86
  story: StoryNav | null;
61
87
  /** Feature 023: the graph view's cursor over the open stories; null outside the graph view. */
@@ -64,6 +90,11 @@ export interface OverviewTuiState {
64
90
  } | null;
65
91
  /** Feature 029: the Fleet view's cursor, scroll, confirm dialog and intended action; null outside it. */
66
92
  fleet: FleetTuiState | null;
93
+ /** Feature 032: the grouped Fleet tab's cursor over feature and lane rows, and the collapsed features; null otherwise. */
94
+ fleetGroup: {
95
+ cursor: number;
96
+ collapsed: string[];
97
+ } | null;
67
98
  /** Help overlay open (FR-030). */
68
99
  help: boolean;
69
100
  /** Quality view open (feature 024, FR-013): uncovered requirements and analyze findings. */
@@ -95,5 +126,9 @@ export declare function checkedTasks(prev: FeatureSnapshot[], next: FeatureSnaps
95
126
  export declare function applyData(state: OverviewTuiState, prev: OverviewTuiData, next: OverviewTuiData): OverviewTuiState;
96
127
  /** Pure `(state, key) → state`. */
97
128
  export declare function reduceOverviewTui(data: OverviewTuiData, state: OverviewTuiState, key: KeyEvent): OverviewTuiState;
129
+ /** The tab a state is on: the feature view and story detail belong to the overview tab. */
130
+ export declare function tabOf(state: OverviewTuiState): Tab;
131
+ /** The 029 view of the feature under the grouped cursor (null on a feature that has not started, or outside the group). */
132
+ export declare function selectedFleetView(data: OverviewTuiData, state: OverviewTuiState): FleetView | null;
98
133
  /** Render the current frame, with the help overlay on top when it is open. */
99
134
  export declare function renderOverviewTui(caps: Capabilities, data: OverviewTuiData, state: OverviewTuiState): string;
@@ -1,5 +1,11 @@
1
1
  import { applyFilters, computeOverview } from "../../../core/overview.js";
2
+ import { header } from "../dashboard/cards.js";
2
3
  import { emptyState, noMatchLine } from "../dashboard/empty-state.js";
4
+ import { currentFleet, featureRunView, filterLanes, groupCounts, groupRows, isGrouped } from "../../../core/fleet-view/group.js";
5
+ import { renderMetricsPanel } from "../dashboard/metrics-panel.js";
6
+ import { fitBodyToRows, noMatchBody, renderFilterLine, renderTabFrame, tabEmptyBody } from "../dashboard/tab-frame.js";
7
+ import { layoutMode, tabLayout } from "../dashboard/layout.js";
8
+ import { applyListFilter } from "./list-filter.js";
3
9
  import { renderQualityView } from "../dashboard/quality-view.js";
4
10
  import { renderHelp } from "../dashboard/help-overlay.js";
5
11
  import { liveIndicator } from "../dashboard/live-indicator.js";
@@ -9,6 +15,7 @@ import { DETAIL_MAX_TASKS, maxScroll, renderStoryDetail } from "../dashboard/sto
9
15
  import { TOKENS } from "../dashboard/tokens.js";
10
16
  import { worktreeItems } from "../dashboard/worktrees-panel.js";
11
17
  import { paintToken } from "../theme.js";
18
+ import { tabForKey } from "./tabs.js";
12
19
  const PANELS = 4;
13
20
  const STATUS_CYCLE = [undefined, "draft", "ready", "in-progress", "blocked", "done", "deferred"];
14
21
  const NO_CURSORS = [0, 0, 0, 0];
@@ -23,6 +30,7 @@ export function initOverviewTui(filters = {}) {
23
30
  story: null,
24
31
  graph: null,
25
32
  fleet: null,
33
+ fleetGroup: null,
26
34
  help: false,
27
35
  quality: false,
28
36
  burndownReady: false,
@@ -138,10 +146,16 @@ export function applyData(state, prev, next) {
138
146
  changedTasks: checkedTasks(prev.features, next.features),
139
147
  };
140
148
  if (state.view === "fleet" && state.fleet && next.fleetView) {
141
- return { ...out, fleet: next.fleetView.clamp(next.fleet ?? null, state.fleet, next.fleetView.windowRows(next.rows ?? 24, next.fleet ?? null)) };
149
+ const entry = next.tabs ? currentFleet(next.fleets) : null;
150
+ if (state.fleetGroup && isGrouped(entry)) {
151
+ const n = groupRows(entry, state.fleetGroup.collapsed, groupFilterOf(state)).length;
152
+ return { ...out, fleetGroup: { ...state.fleetGroup, cursor: Math.max(0, Math.min(state.fleetGroup.cursor, n - 1)) } };
153
+ }
154
+ const view = visibleFleet(next, state);
155
+ return { ...out, fleet: next.fleetView.clamp(view, state.fleet, next.fleetView.windowRows(next.rows ?? 24, view)) };
142
156
  }
143
157
  if (state.view === "graph" && state.graph) {
144
- const n = next.graphView?.build(next.features).rows.length ?? 0;
158
+ const n = next.graphView ? graphModelFor(next, state).rows.length : 0;
145
159
  return { ...out, graph: { cursor: Math.max(0, Math.min(state.graph.cursor, n - 1)) } };
146
160
  }
147
161
  if (state.view !== "feature" || !state.feature)
@@ -162,26 +176,50 @@ export function reduceOverviewTui(data, state, key) {
162
176
  return { ...state, help: false }; // any key closes help and is not passed on
163
177
  if (state.input !== null)
164
178
  return reduceInput(state, key);
165
- if (state.quality)
166
- return key.name === "q" ? { ...state, done: true } : { ...state, quality: false };
167
179
  // An open Fleet confirmation owns the next key (even `?`), so a stray key can only cancel it (029 FR-008).
168
180
  if (state.view === "fleet" && state.fleet?.confirm)
169
181
  return reduceFleetView(data, state, key);
182
+ // Feature 032 (FR-004): `1`-`4`, `]` and `[` switch tabs from any screen; anything else is not a tab key.
183
+ const target = key.ctrl ? null : tabForKey(tabOf(state), key);
184
+ if (target)
185
+ return selectTab(data, state, target);
186
+ // Tab mode (feature 032): the quality tab is a tab like the others (help, the shared filter, esc to go back); a key that
187
+ // means nothing here changes nothing (FR-004). Without tab mode the quality view keeps its 024 behaviour: any key leaves it.
188
+ if (data.tabs && state.quality) {
189
+ if (key.name === "q")
190
+ return { ...state, done: true };
191
+ if (key.sequence === "?")
192
+ return { ...state, help: true };
193
+ const shared = reduceSharedFilter(state, key);
194
+ if (shared)
195
+ return shared;
196
+ return key.name === "escape" ? { ...state, quality: false } : state;
197
+ }
198
+ if (state.quality)
199
+ return key.name === "q" ? { ...state, done: true } : { ...state, quality: false };
170
200
  if (key.sequence === "?")
171
201
  return { ...state, help: true };
202
+ if (data.tabs && (state.view === "fleet" || state.view === "graph")) {
203
+ const shared = reduceSharedFilter(state, key);
204
+ if (shared)
205
+ return shared;
206
+ }
172
207
  if (state.view === "fleet")
173
208
  return reduceFleetView(data, state, key);
174
209
  if (state.view === "feature")
175
210
  return reduceFeature(data, state, key);
176
211
  if (state.view === "graph")
177
212
  return reduceGraph(data, state, key);
213
+ // `/` opens a free-text search over feature names and numbers (feature 032, US-3); `f` keeps the exact feature filter.
214
+ if (key.sequence === "/")
215
+ return { ...state, input: state.filters.search ?? "", searching: true };
178
216
  switch (key.name) {
179
217
  case "q":
180
218
  return { ...state, done: true };
181
219
  case "g":
182
220
  return data.graphView ? { ...state, view: "graph", graph: { cursor: 0 } } : state;
183
221
  case "l":
184
- return data.fleetView ? { ...state, view: "fleet", fleet: data.fleetView.init() } : state;
222
+ return data.fleetView ? { ...state, view: "fleet", ...enterFleet(data) } : state;
185
223
  case "tab": {
186
224
  const step = key.shift ? PANELS - 1 : 1;
187
225
  return { ...state, focus: ((state.focus + step) % PANELS) };
@@ -199,11 +237,11 @@ export function reduceOverviewTui(data, state, key) {
199
237
  case "enter":
200
238
  return openSelected(data, state);
201
239
  case "escape":
202
- return state.filters.feature || state.filters.status ? { ...state, filters: {}, cursors: NO_CURSORS } : state;
240
+ return state.filters.feature || state.filters.status || state.filters.search ? { ...state, filters: {}, cursors: NO_CURSORS } : state;
203
241
  case "c":
204
242
  return { ...state, quality: true };
205
243
  case "f":
206
- return { ...state, input: state.filters.feature ?? "" };
244
+ return { ...state, input: state.filters.feature ?? "", searching: false };
207
245
  case "s": {
208
246
  const i = STATUS_CYCLE.indexOf(state.filters.status);
209
247
  const status = STATUS_CYCLE[(i + 1) % STATUS_CYCLE.length];
@@ -213,12 +251,79 @@ export function reduceOverviewTui(data, state, key) {
213
251
  return state;
214
252
  }
215
253
  }
254
+ /** The tab a state is on: the feature view and story detail belong to the overview tab. */
255
+ export function tabOf(state) {
256
+ if (state.quality)
257
+ return "quality";
258
+ if (state.view === "fleet")
259
+ return "fleet";
260
+ if (state.view === "graph")
261
+ return "graph";
262
+ return "overview";
263
+ }
264
+ /** Switch to `tab`. A tab whose view is not available (no graph or fleet view injected) leaves the state unchanged. */
265
+ function selectTab(data, state, tab) {
266
+ const here = tabOf(state);
267
+ // Pressing the overview key from the feature view goes back up to the overview; any other same-tab key is a no-op.
268
+ if (tab === here && !(tab === "overview" && state.view !== "overview"))
269
+ return state;
270
+ const cleared = { ...state, view: "overview", feature: null, story: null, graph: null, fleet: null, fleetGroup: null, quality: false };
271
+ switch (tab) {
272
+ case "overview":
273
+ return cleared;
274
+ case "fleet":
275
+ return data.fleetView ? { ...cleared, view: "fleet", ...enterFleet(data) } : state;
276
+ case "graph":
277
+ return data.graphView ? { ...cleared, view: "graph", graph: { cursor: 0 } } : state;
278
+ case "quality":
279
+ return { ...cleared, quality: true };
280
+ }
281
+ }
282
+ /** Entering the Fleet tab: 029's slice, plus the group cursor when a fleet of two or more features is shown (tab mode). */
283
+ function enterFleet(data) {
284
+ return { fleet: data.fleetView.init(), fleetGroup: data.tabs && isGrouped(currentFleet(data.fleets)) ? { cursor: 0, collapsed: [] } : null };
285
+ }
286
+ /** The shared filter as a text-and-state filter over lanes (feature 032, US-3). */
287
+ function groupFilterOf(state) {
288
+ return { query: state.filters.search ?? state.filters.feature ?? "", ...(state.filters.status !== undefined ? { state: state.filters.status } : {}) };
289
+ }
290
+ /** The current run as the Fleet view shows it in tab mode: its lanes narrowed by the shared filter. */
291
+ function visibleFleet(data, state) {
292
+ const view = data.fleet ?? null;
293
+ if (!view || !data.tabs)
294
+ return view;
295
+ return { ...view, lanes: filterLanes(view.lanes, groupFilterOf(state)) };
296
+ }
297
+ /** The dependency graph narrowed by the shared filter: text over the story id and title, and the status as buildable/blocked. */
298
+ function graphModelFor(data, state) {
299
+ const model = data.graphView.build(data.features);
300
+ if (!data.tabs)
301
+ return model;
302
+ const f = groupFilterOf(state);
303
+ const status = f.state === undefined ? undefined : { blocked: "blocked", ready: "buildable" }[f.state] ?? "";
304
+ const rows = applyListFilter(model.rows.map((r) => ({ ...r, state: r.state })), { query: f.query, ...(status !== undefined ? { state: status } : {}) });
305
+ return { ...model, rows };
306
+ }
307
+ /** `/`, `s` and `esc` on a tab other than the overview: the same shared filter (feature 032, US-3). Null when not a filter key. */
308
+ function reduceSharedFilter(state, key) {
309
+ const reset = { cursors: NO_CURSORS, graph: state.graph ? { cursor: 0 } : state.graph, fleetGroup: state.fleetGroup ? { ...state.fleetGroup, cursor: 0 } : null, fleet: state.fleet ? { ...state.fleet, cursor: 0, scroll: 0 } : state.fleet };
310
+ if (key.sequence === "/")
311
+ return { ...state, input: state.filters.search ?? "", searching: true };
312
+ if (key.name === "s") {
313
+ const i = STATUS_CYCLE.indexOf(state.filters.status);
314
+ return { ...state, filters: { ...state.filters, status: STATUS_CYCLE[(i + 1) % STATUS_CYCLE.length] }, ...reset };
315
+ }
316
+ if (key.name === "escape" && (state.filters.feature || state.filters.status || state.filters.search))
317
+ return { ...state, filters: {}, ...reset };
318
+ return null;
319
+ }
216
320
  function reduceInput(state, key) {
217
321
  const text = state.input ?? "";
218
322
  if (key.name === "escape")
219
- return { ...state, input: null };
323
+ return { ...state, input: null, searching: false };
220
324
  if (key.name === "return" || key.name === "enter") {
221
- return { ...state, input: null, filters: { ...state.filters, feature: text || undefined }, cursors: NO_CURSORS };
325
+ const filters = state.searching ? { ...state.filters, search: text || undefined } : { ...state.filters, feature: text || undefined };
326
+ return { ...state, input: null, searching: false, filters, cursors: NO_CURSORS };
222
327
  }
223
328
  if (key.name === "backspace")
224
329
  return { ...state, input: text.slice(0, -1) };
@@ -232,20 +337,69 @@ function reduceInput(state, key) {
232
337
  function reduceFleetView(data, state, key) {
233
338
  const api = data.fleetView;
234
339
  if (!api || !state.fleet)
235
- return { ...state, view: "overview", fleet: null };
236
- const rows = api.windowRows(data.rows ?? 24, data.fleet ?? null);
237
- const next = api.reduce(data.fleet ?? null, state.fleet, key, rows);
340
+ return { ...state, view: "overview", fleet: null, fleetGroup: null };
341
+ const entry = data.tabs ? currentFleet(data.fleets) : null;
342
+ if (state.fleetGroup && isGrouped(entry))
343
+ return reduceFleetGroup(data, state, key, api, entry);
344
+ const view = visibleFleet(data, state);
345
+ const rows = api.windowRows(data.rows ?? 24, view);
346
+ const next = api.reduce(view, state.fleet, key, rows);
347
+ if (next.quit)
348
+ return { ...state, done: true };
349
+ if (next.back)
350
+ return { ...state, view: "overview", fleet: null, fleetGroup: null };
351
+ return { ...state, fleet: next };
352
+ }
353
+ /** The 029 view of the feature under the grouped cursor (null on a feature that has not started, or outside the group). */
354
+ export function selectedFleetView(data, state) {
355
+ const entry = data.tabs ? currentFleet(data.fleets) : null;
356
+ if (!state.fleetGroup || !isGrouped(entry))
357
+ return data.fleet ?? null;
358
+ const rows = groupRows(entry, state.fleetGroup.collapsed, groupFilterOf(state));
359
+ const row = rows[Math.min(state.fleetGroup.cursor, Math.max(0, rows.length - 1))];
360
+ return row ? featureRunView(row.feature, data.fleet?.now ?? state.now) : null;
361
+ }
362
+ /**
363
+ * The grouped Fleet tab's keys (feature 032, FR-018): `↑↓` move over feature and lane rows, `←`/`→` collapse and expand a
364
+ * feature, and every directive or approve key goes to 029's reducer for the feature under the cursor, so its confirm
365
+ * dialog and rules are the same ones (a lane action needs a lane row; `P U X a` work on the feature's run).
366
+ */
367
+ function reduceFleetGroup(data, state, key, api, entry) {
368
+ const group = state.fleetGroup;
369
+ const filter = groupFilterOf(state);
370
+ const rows = groupRows(entry, group.collapsed, filter);
371
+ const cursor = Math.min(group.cursor, Math.max(0, rows.length - 1));
372
+ const row = rows[cursor];
373
+ if (!state.fleet.confirm) {
374
+ if ((key.name === "up" || key.name === "down") && rows.length > 0) {
375
+ const step = key.name === "up" ? rows.length - 1 : 1;
376
+ return { ...state, fleetGroup: { ...group, cursor: (cursor + step) % rows.length }, fleet: { ...state.fleet, notice: null } };
377
+ }
378
+ if ((key.name === "left" || key.name === "right") && row) {
379
+ const name = row.feature.feature;
380
+ const collapsed = key.name === "left" ? (group.collapsed.includes(name) ? group.collapsed : [...group.collapsed, name]) : group.collapsed.filter((c) => c !== name);
381
+ const at = groupRows(entry, collapsed, filter).findIndex((r) => r.kind === "feature" && r.feature.feature === name);
382
+ return { ...state, fleetGroup: { collapsed, cursor: at >= 0 ? at : cursor } };
383
+ }
384
+ // A lane action needs a lane row: on a feature header say so instead of acting on its first lane.
385
+ if (row?.kind === "feature" && (key.sequence === "p" || key.sequence === "u" || key.sequence === "x")) {
386
+ return { ...state, fleet: { ...state.fleet, notice: "Select a lane to pause, continue or stop it; P, U and X act on the whole run." } };
387
+ }
388
+ }
389
+ const view = row ? featureRunView(row.feature, data.fleet?.now ?? state.now) : null;
390
+ const inner = { ...state.fleet, cursor: row?.kind === "lane" ? row.index : 0 };
391
+ const next = api.reduce(view, inner, key, data.rows ?? 24);
238
392
  if (next.quit)
239
393
  return { ...state, done: true };
240
394
  if (next.back)
241
- return { ...state, view: "overview", fleet: null };
395
+ return { ...state, view: "overview", fleet: null, fleetGroup: null };
242
396
  return { ...state, fleet: next };
243
397
  }
244
398
  function reduceGraph(data, state, key) {
245
399
  if (key.name === "q")
246
400
  return { ...state, done: true };
247
401
  const toOverview = { ...state, view: "overview", graph: null };
248
- const model = data.graphView?.build(data.features);
402
+ const model = data.graphView ? graphModelFor(data, state) : undefined;
249
403
  if (!model)
250
404
  return toOverview;
251
405
  if (key.name === "escape" || key.name === "backspace" || key.name === "left")
@@ -312,28 +466,111 @@ function keyHints(caps, pairs) {
312
466
  return pairs.map(([key, label]) => `${paintToken(caps, k["key-fg"], key)} ${paintToken(caps, k["label-fg"], label)}`).join(" ");
313
467
  }
314
468
  function filterNote(filters) {
315
- const parts = [filters.feature ? `feature=${filters.feature}` : "", filters.status ? `status=${filters.status}` : ""].filter(Boolean);
469
+ const parts = [filters.feature ? `feature=${filters.feature}` : "", filters.search ? `search=${filters.search}` : "", filters.status ? `status=${filters.status}` : ""].filter(Boolean);
316
470
  return parts.length ? ` [${parts.join(" ")}]` : "";
317
471
  }
318
472
  const FILTER_FIELD = 36;
319
473
  /** FilterInput (ui.md US-4): ` filter ( 017▏ ) ⏎ apply esc cancel` in the hint row. */
320
- function filterInput(caps, value) {
474
+ function filterInput(caps, value, label = "filter") {
321
475
  const t = LIVE_TOKENS.component.input;
322
476
  const caret = caps.unicode ? t.caret.u : t.caret.a;
323
477
  const shown = value.length > FILTER_FIELD - 2 ? value.slice(-(FILTER_FIELD - 2)) : value;
324
478
  const field = paintToken(caps, t.fg, shown) + paintToken(caps, t["frame-fg"], caret) + " ".repeat(Math.max(0, FILTER_FIELD - 1 - shown.length));
325
479
  const frame = (s) => paintToken(caps, t["frame-fg"], s);
326
- return ` ${paintToken(caps, t["label-fg"], "filter")} ${frame("(")} ${field}${frame(")")} ${keyHints(caps, [[caps.unicode ? "⏎" : "enter", "apply"], ["esc", "cancel"]])}`;
480
+ return ` ${paintToken(caps, t["label-fg"], label)} ${frame("(")} ${field}${frame(")")} ${keyHints(caps, [[caps.unicode ? "⏎" : "enter", "apply"], ["esc", "cancel"]])}`;
327
481
  }
328
482
  function metaOf(caps, data, state) {
329
483
  return { ...data.meta, interactive: true, ...(state.live ? { live: liveIndicator(caps, state.live, state.now) } : {}) };
330
484
  }
331
485
  /** EmptyState for the interactive overview: no specs at all, or a filter that matches nothing. */
332
486
  function emptyLines(caps, data, filters) {
487
+ if (data.tabs) {
488
+ return data.features.length === 0 ? tabEmptyBody(caps, "overview") : noMatchBody(caps, [filters.feature, filters.search, filters.status].filter(Boolean).join(" "));
489
+ }
333
490
  if (data.features.length === 0) {
334
491
  return emptyState(caps, "No feature specs yet.", { before: "Run ", command: "/amby.specify", after: " to create one." }, caps.columns);
335
492
  }
336
- return ["", noMatchLine(caps, [filters.feature, filters.status].filter(Boolean).join(" "))];
493
+ return ["", noMatchLine(caps, [filters.feature, filters.search, filters.status].filter(Boolean).join(" "))];
494
+ }
495
+ /** Which tabs have something to read first (ui.md "Tab bar"): a stalled or blocked lane, graph problems, findings. */
496
+ function tabBadges(data) {
497
+ const badges = {};
498
+ const attention = (v) => !!v && (v.run.needsDecision || v.lanes.some((l) => l.stalled || l.state === "blocked"));
499
+ const entry = currentFleet(data.fleets);
500
+ const fleetFlag = attention(data.fleet) || !!entry?.features.some((f) => f.state === "paused" || f.run?.needsDecision || f.lanes.some((l) => l.stalled || l.state === "blocked"));
501
+ if (fleetFlag)
502
+ badges.fleet = "attention";
503
+ if (data.graphView && data.graphView.build(data.features).problems > 0)
504
+ badges.graph = "warn";
505
+ const o = overviewOf(data, {});
506
+ if (o.attention.length > 0 || data.features.some((f) => (f.coverage?.uncovered.length ?? 0) > 0))
507
+ badges.quality = "warn";
508
+ return badges;
509
+ }
510
+ /** Items shown and the unfiltered total on a tab, for the filter line's "n of N match". */
511
+ function tabCounts(data, state, tab) {
512
+ switch (tab) {
513
+ case "fleet": {
514
+ const entry = currentFleet(data.fleets);
515
+ if (state.fleetGroup && isGrouped(entry))
516
+ return groupCounts(entry, groupFilterOf(state));
517
+ return { shown: visibleFleet(data, state)?.lanes.length ?? 0, total: data.fleet?.lanes.length ?? 0 };
518
+ }
519
+ case "graph":
520
+ return data.graphView ? { shown: graphModelFor(data, state).rows.length, total: data.graphView.build(data.features).rows.length } : { shown: 0, total: 0 };
521
+ case "quality":
522
+ return { shown: applyFilters(data.features, state.filters).length, total: data.features.length };
523
+ default:
524
+ return { shown: overviewOf(data, state.filters).features.length, total: data.features.length };
525
+ }
526
+ }
527
+ /**
528
+ * The tabbed frame (feature 032, US-1/US-3): the tab bar, the shared filter line and the screen body, with the key row
529
+ * leading with the tab keys (or shortened to "1-4 tab, ? help, q quit" on a narrow terminal). While typing, the filter
530
+ * line shows the text and the key row says how to apply or cancel.
531
+ */
532
+ function tabFramed(caps, data, state, rendered) {
533
+ const at = rendered.lastIndexOf("\n\n");
534
+ const body = at >= 0 ? rendered.slice(0, at) : rendered;
535
+ const hints = at >= 0 ? rendered.slice(at + 2) : "";
536
+ const tab = tabOf(state);
537
+ const f = state.filters;
538
+ const typing = state.input !== null;
539
+ const counts = tabCounts(data, state, tab);
540
+ const filterLine = renderFilterLine(caps, {
541
+ text: typing ? state.input : (f.search ?? f.feature ?? ""),
542
+ label: typing ? (state.searching ? "/" : "feature") : f.search || !f.feature ? "/" : "feature",
543
+ typing,
544
+ ...(f.status !== undefined ? { state: f.status } : {}),
545
+ ...counts,
546
+ });
547
+ const footer = typing
548
+ ? keyHints(caps, [[caps.unicode ? "⏎" : "enter", "apply"], ["esc", "cancel"]])
549
+ : tabLayout(caps) === "narrow"
550
+ ? keyHints(caps, [["1-4", "tab"], ["?", "help"], ["q", "quit"]])
551
+ : `${keyHints(caps, [["1-4", "tab"], ["] [", "next/prev"]])} ${hints}`;
552
+ // Never draw more rows than the terminal has (flicker fix): the tab bar, the filter line and the footer stay, the body is
553
+ // windowed around the cursor when it is too tall. Without a terminal height (tests, one-shot) nothing is cut.
554
+ const { top, rest } = pageHeader(caps, data, state, tab, body);
555
+ const fixed = top.length + 1 + (filterLine ? 1 : 0) + 1 + footer.split("\n").length;
556
+ const fitted = data.rows === undefined ? rest : fitBodyToRows(caps, rest.split("\n"), data.rows - fixed).join("\n");
557
+ const frame = renderTabFrame(caps, { active: tab, badges: tabBadges(data), filterLine, body: fitted });
558
+ return `${top.length ? `${top.join("\n")}\n` : ""}${frame}\n\n${footer}`;
559
+ }
560
+ /**
561
+ * The page header above the tab bar on every tab (032 ui.md decision 4: the tab bar sits directly under the header). The
562
+ * overview, feature and story screens draw their own header (title and rule), which is lifted above the tab bar; fleet,
563
+ * graph and quality get the same header with the tab's name in the crumb. Plain layout keeps its one-line header in the body.
564
+ */
565
+ function pageHeader(caps, data, state, tab, body) {
566
+ if (layoutMode(caps) === "plain")
567
+ return { top: [], rest: body };
568
+ const meta = metaOf(caps, data, state);
569
+ const lines = body.split("\n");
570
+ const rule = header(caps, meta, caps.columns)[1];
571
+ if (lines.length >= 2 && lines[1] === rule)
572
+ return { top: lines.slice(0, 2), rest: lines.slice(2).join("\n") };
573
+ return { top: header(caps, { ...meta, crumb: [...meta.crumb, tab] }, caps.columns), rest: body };
337
574
  }
338
575
  function renderScreen(caps, data, state) {
339
576
  const u = caps.unicode;
@@ -342,6 +579,15 @@ function renderScreen(caps, data, state) {
342
579
  const noticeMax = LIVE_TOKENS.limit["notice-max"];
343
580
  const presence = data.presence ? { presence: data.presence } : {};
344
581
  const nav = state.story;
582
+ if (data.tabs && state.quality) {
583
+ // Feature 032: the quality tab is the 024 view plus the FLOW panel (cycle time per phase, converge gap trend).
584
+ const o = overviewOf(data, state.filters);
585
+ const features = applyFilters(data.features, state.filters);
586
+ const empty = !data.features.some((f) => f.coverage) && o.attention.length === 0;
587
+ const base = empty ? tabEmptyBody(caps, "quality").join("\n") : renderQualityView(caps, features, o.attention);
588
+ const body = [base, "", ...renderMetricsPanel(caps, data.metricsState)].join("\n");
589
+ return { frame: `${body}\n\n${keyHints(caps, [["esc", "back"], ["/", "search"], ["s", "state"], ["?", "help"], ["q", "quit"]])}`, screen: "quality" };
590
+ }
345
591
  if (state.view === "feature" && state.feature && nav) {
346
592
  const filters = { ...state.filters, feature: state.feature };
347
593
  const feature = applyFilters(data.features, filters)[0];
@@ -378,15 +624,49 @@ function renderScreen(caps, data, state) {
378
624
  }
379
625
  if (state.view === "fleet" && data.fleetView && state.fleet) {
380
626
  const api = data.fleetView;
381
- const body = api.render(caps, {
382
- view: data.fleet ?? null,
383
- state: state.fleet,
384
- ...(state.live ? { live: state.live } : {}),
385
- now: state.now,
386
- rows: data.rows ?? 24,
387
- });
388
627
  const lane = u ? "↑↓" : "up/down";
389
- const run = data.fleet ?? null;
628
+ const entry = data.tabs ? currentFleet(data.fleets) : null;
629
+ if (data.tabs && state.fleetGroup && isGrouped(entry) && data.fleetTab) {
630
+ // Feature 032 (FR-018): lanes grouped by feature across features, with 029 rows, confirm and directive rules inside.
631
+ const rows = groupRows(entry, state.fleetGroup.collapsed, groupFilterOf(state));
632
+ const body = rows.length === 0
633
+ ? noMatchBody(caps, groupFilterOf(state).query).join("\n")
634
+ : data.fleetTab.render(caps, {
635
+ entry,
636
+ rows,
637
+ cursor: Math.min(state.fleetGroup.cursor, rows.length - 1),
638
+ inner: state.fleet,
639
+ selected: selectedFleetView(data, state),
640
+ ...(state.live ? { live: state.live } : {}),
641
+ now: state.now,
642
+ window: api.windowRows(data.rows ?? 24, null),
643
+ });
644
+ const hints = keyHints(caps, [
645
+ ["esc", "back"],
646
+ [lane, "item"],
647
+ [u ? "← →" : "left/right", "collapse"],
648
+ ["p", "pause"],
649
+ ["u", "continue"],
650
+ ["x", "stop"],
651
+ [u ? "⇧" : "shift", "whole run"],
652
+ ["a", "approve"],
653
+ ["?", "help"],
654
+ ["q", "quit"],
655
+ ]);
656
+ return { frame: `${body}\n\n${hints}`, screen: "fleet" };
657
+ }
658
+ const run = visibleFleet(data, state);
659
+ const body = data.tabs && !data.fleet
660
+ ? tabEmptyBody(caps, "fleet").join("\n")
661
+ : data.tabs && run && run.lanes.length === 0 && (data.fleet?.lanes.length ?? 0) > 0
662
+ ? noMatchBody(caps, groupFilterOf(state).query).join("\n")
663
+ : api.render(caps, {
664
+ view: run,
665
+ state: state.fleet,
666
+ ...(state.live ? { live: state.live } : {}),
667
+ now: state.now,
668
+ rows: data.rows ?? 24,
669
+ });
390
670
  const hints = keyHints(caps, [
391
671
  ["esc", "back"],
392
672
  [lane, "lane"],
@@ -401,8 +681,13 @@ function renderScreen(caps, data, state) {
401
681
  return { frame: `${body}\n\n${hints}`, screen: "fleet" };
402
682
  }
403
683
  if (state.view === "graph" && data.graphView) {
404
- const model = data.graphView.build(data.features);
405
- const body = data.graphView.render(caps, model, state.graph?.cursor ?? 0);
684
+ const model = graphModelFor(data, state);
685
+ const everything = data.tabs ? data.graphView.build(data.features) : model;
686
+ const body = data.tabs && everything.rows.length === 0 && everything.doneCount === 0
687
+ ? tabEmptyBody(caps, "graph").join("\n")
688
+ : data.tabs && model.rows.length === 0 && everything.rows.length > 0
689
+ ? noMatchBody(caps, groupFilterOf(state).query).join("\n")
690
+ : data.graphView.render(caps, model, state.graph?.cursor ?? 0);
406
691
  const hints = keyHints(caps, [["esc", "back"], [move, "move"], [enter, "open feature"], ["?", "help"], ["q", "quit"]]);
407
692
  return { frame: `${body}\n\n${hints}`, screen: "graph" };
408
693
  }
@@ -417,8 +702,8 @@ function renderScreen(caps, data, state) {
417
702
  noticeMax,
418
703
  ...presence,
419
704
  });
420
- const footer = state.input !== null
421
- ? filterInput(caps, state.input)
705
+ const footer = state.input !== null && !data.tabs
706
+ ? filterInput(caps, state.input, state.searching ? "search" : "filter")
422
707
  : keyHints(caps, [
423
708
  ["tab", "panel"],
424
709
  [move, "move"],
@@ -430,11 +715,16 @@ function renderScreen(caps, data, state) {
430
715
  ["c", "quality"],
431
716
  ["?", "help"],
432
717
  ["q", "quit"],
433
- ]) + filterNote(state.filters);
718
+ ]) + (data.tabs ? "" : filterNote(state.filters));
434
719
  return { frame: `${body}\n\n${footer}`, screen: "overview" };
435
720
  }
436
721
  /** Render the current frame, with the help overlay on top when it is open. */
437
722
  export function renderOverviewTui(caps, data, state) {
723
+ if (data.tabs) {
724
+ const { frame, screen } = renderScreen(caps, data, state);
725
+ const framed = tabFramed(caps, data, state, frame);
726
+ return state.help ? renderHelp(caps, framed, screen, data.issues.map((i) => `${i.file}: ${i.reason}`)) : framed;
727
+ }
438
728
  if (state.quality && state.view === "overview") {
439
729
  const o = overviewOf(data, state.filters);
440
730
  const hints = keyHints(caps, [["any key", "back"], ["q", "quit"]]);