@hiroleague/taskmanager 0.0.1 → 0.0.3
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.
- package/LICENSE +21 -0
- package/README.md +41 -52
- package/dist/assets/architecture-YZFGNWBL-DoE0KxgG.js +1 -0
- package/dist/assets/architectureDiagram-Q4EWVU46-DeuBhy7X.js +36 -0
- package/dist/assets/{blockDiagram-DXYQGD6D-DfOGNphI.js → blockDiagram-DXYQGD6D-BDBy9ns9.js} +1 -1
- package/dist/assets/{c4Diagram-AHTNJAMY-B2Yfcwbo.js → c4Diagram-AHTNJAMY-CpqJj_8a.js} +1 -1
- package/dist/assets/channel-PHRyjspt.js +1 -0
- package/dist/assets/{chunk-2KRD3SAO-9yt00aGC.js → chunk-2KRD3SAO-DEpUsxdZ.js} +1 -1
- package/dist/assets/chunk-336JU56O-BGQvSwLk.js +2 -0
- package/dist/assets/chunk-426QAEUC-Cl9nQN9c.js +1 -0
- package/dist/assets/{chunk-4TB4RGXK-DF8yJBFl.js → chunk-4TB4RGXK-Dq7aiIrZ.js} +2 -2
- package/dist/assets/{chunk-5FUZZQ4R-XEga0hMC.js → chunk-5FUZZQ4R-B_HuuUjf.js} +1 -1
- package/dist/assets/{chunk-5PVQY5BW-BrmXs2Gs.js → chunk-5PVQY5BW-cGfZCZGU.js} +2 -2
- package/dist/assets/{chunk-67CJDMHE-5wFKo04G.js → chunk-67CJDMHE-BMYAVZfw.js} +1 -1
- package/dist/assets/{chunk-7N4EOEYR-BRRGX_NC.js → chunk-7N4EOEYR-Ct-EY7Nc.js} +1 -1
- package/dist/assets/{chunk-AA7GKIK3-DUZv_pNI.js → chunk-AA7GKIK3-Bd4HFpeo.js} +1 -1
- package/dist/assets/{chunk-CIAEETIT-mA5aM_d7.js → chunk-CIAEETIT-CrFUkPMT.js} +1 -1
- package/dist/assets/{chunk-EDXVE4YY-DxUqDyxy.js → chunk-EDXVE4YY-DMDyt0NF.js} +1 -1
- package/dist/assets/{chunk-ENJZ2VHE-BgZKYo1l.js → chunk-ENJZ2VHE-DrWzOrpd.js} +1 -1
- package/dist/assets/{chunk-FOC6F5B3-B-cqGCPC.js → chunk-FOC6F5B3-Bemzq96j.js} +1 -1
- package/dist/assets/{chunk-ICPOFSXX-BNR1V8rT.js → chunk-ICPOFSXX-DkUVjrLw.js} +5 -5
- package/dist/assets/{chunk-K5T4RW27-BLRDzioh.js → chunk-K5T4RW27-ALKIf000.js} +5 -5
- package/dist/assets/{chunk-KGLVRYIC-CTkQSeKy.js → chunk-KGLVRYIC-Bg6HNTZ-.js} +1 -1
- package/dist/assets/{chunk-LIHQZDEY-Cf34Nu3J.js → chunk-LIHQZDEY-DeyGongE.js} +1 -1
- package/dist/assets/{chunk-ORNJ4GCN-D3uXgbay.js → chunk-ORNJ4GCN-Bx83s1bJ.js} +1 -1
- package/dist/assets/{chunk-OYMX7WX6-syQho5jf.js → chunk-OYMX7WX6-BqRUtRpL.js} +1 -1
- package/dist/assets/{chunk-U2HBQHQK-DTJPeU7W.js → chunk-U2HBQHQK-DogcerR6.js} +1 -1
- package/dist/assets/{chunk-X2U36JSP-CrTnmMqG.js → chunk-X2U36JSP-CwVWdmZV.js} +1 -1
- package/dist/assets/chunk-XPW4576I-DQpNCogT.js +32 -0
- package/dist/assets/{chunk-YZCP3GAM-9wq0QKUn.js → chunk-YZCP3GAM-crQSbji9.js} +1 -1
- package/dist/assets/{chunk-ZZ45TVLE-D3I1kLlo.js → chunk-ZZ45TVLE-Bk1S1YtS.js} +1 -1
- package/dist/assets/classDiagram-6PBFFD2Q-B_TabGaU.js +1 -0
- package/dist/assets/classDiagram-v2-HSJHXN6E-CGnZkUWw.js +1 -0
- package/dist/assets/clone-D4ka472w.js +1 -0
- package/dist/assets/{cose-bilkent-S5V4N54A-BygGvZGW.js → cose-bilkent-S5V4N54A-RBTHUit8.js} +1 -1
- package/dist/assets/cytoscape.esm-BGJwlmkf.js +321 -0
- package/dist/assets/dagre-B32eYLtm.js +1 -0
- package/dist/assets/{dagre-KV5264BT-BBqulDtd.js → dagre-KV5264BT-nX7tuXXn.js} +1 -1
- package/dist/assets/diagram-5BDNPKRD-DRxMXlQr.js +10 -0
- package/dist/assets/diagram-G4DWMVQ6-CoojevGm.js +24 -0
- package/dist/assets/diagram-MMDJMWI5-CWtJyfVW.js +43 -0
- package/dist/assets/diagram-TYMM5635-CsDJC4Hq.js +24 -0
- package/dist/assets/{erDiagram-SMLLAGMA-BN5eJerP.js → erDiagram-SMLLAGMA-Cf7Xtd9A.js} +2 -2
- package/dist/assets/{flatten-C5NL-f24.js → flatten-CYX_pHZ7.js} +1 -1
- package/dist/assets/{flowDiagram-DWJPFMVM-CbFskc8S.js → flowDiagram-DWJPFMVM-DQaeR16a.js} +3 -3
- package/dist/assets/{ganttDiagram-T4ZO3ILL-OCTvbRxF.js → ganttDiagram-T4ZO3ILL-8EIcztcH.js} +1 -1
- package/dist/assets/gitGraph-7Q5UKJZL-BH9A1SAZ.js +1 -0
- package/dist/assets/{gitGraphDiagram-UUTBAWPF-wpqI2kyI.js → gitGraphDiagram-UUTBAWPF-DO9ODqYw.js} +1 -1
- package/dist/assets/graphlib-bPBqlJKT.js +1 -0
- package/dist/assets/identity-Me9aart9.js +1 -0
- package/dist/assets/index-oKG1C41_.js +273 -0
- package/dist/assets/info-OMHHGYJF-BvKR-zWh.js +1 -0
- package/dist/assets/infoDiagram-42DDH7IO-pRTXCm5C.js +2 -0
- package/dist/assets/isEmpty-Cu0k-j1j.js +1 -0
- package/dist/assets/{ishikawaDiagram-UXIWVN3A-Epc23N_0.js → ishikawaDiagram-UXIWVN3A-BP2YE5QI.js} +2 -2
- package/dist/assets/{journeyDiagram-VCZTEJTY-BkMxoaPq.js → journeyDiagram-VCZTEJTY-B3l2juoL.js} +1 -1
- package/dist/assets/{kanban-definition-6JOO6SKY-C8dW_26n.js → kanban-definition-6JOO6SKY-BpIpEOZZ.js} +4 -4
- package/dist/assets/{line-DNzQATGr.js → line-otOkzGl8.js} +1 -1
- package/dist/assets/mermaid-parser.core-xWsW24Gq.js +4 -0
- package/dist/assets/{mindmap-definition-QFDTVHPH-CvpNtrKT.js → mindmap-definition-QFDTVHPH-B9khyC7X.js} +3 -3
- package/dist/assets/packet-4T2RLAQJ-D8Dw3nmf.js +1 -0
- package/dist/assets/pie-ZZUOXDRM-ZghowlAE.js +1 -0
- package/dist/assets/{pieDiagram-DEJITSTG-eENymoXZ.js → pieDiagram-DEJITSTG-v32hL3i7.js} +1 -1
- package/dist/assets/{quadrantDiagram-34T5L4WZ-c0iZxo2I.js → quadrantDiagram-34T5L4WZ-DIL3GDFt.js} +1 -1
- package/dist/assets/radar-PYXPWWZC-D-PK3JOd.js +1 -0
- package/dist/assets/reduce-CImcgAcU.js +1 -0
- package/dist/assets/{requirementDiagram-MS252O5E-CmRO3hLp.js → requirementDiagram-MS252O5E-D8os2-4y.js} +2 -2
- package/dist/assets/{sankeyDiagram-XADWPNL6-woJZoQ58.js → sankeyDiagram-XADWPNL6-BV70D4l5.js} +1 -1
- package/dist/assets/{sequenceDiagram-FGHM5R23-B7qNcwNo.js → sequenceDiagram-FGHM5R23-Cwu8hQW1.js} +1 -1
- package/dist/assets/stateDiagram-FHFEXIEX-oYUWv7Fb.js +1 -0
- package/dist/assets/stateDiagram-v2-QKLJ7IA2-CFUTpFu-.js +1 -0
- package/dist/assets/{timeline-definition-GMOUNBTQ-CQWqDPGG.js → timeline-definition-GMOUNBTQ-CxSdKxpL.js} +1 -1
- package/dist/assets/treeView-SZITEDCU-uVgaJQzG.js +1 -0
- package/dist/assets/treemap-W4RFUUIX-Dcad_9AN.js +1 -0
- package/dist/assets/vennDiagram-DHZGUBPP-D4wgD7QI.js +34 -0
- package/dist/assets/wardley-RL74JXVD-CFXrK8mx.js +1 -0
- package/dist/assets/{wardleyDiagram-NUSXRM2D-DNhPIFCg.js → wardleyDiagram-NUSXRM2D-5Q201ea3.js} +1 -1
- package/dist/assets/{xychartDiagram-5P7HB3ND-BDblAZ11.js → xychartDiagram-5P7HB3ND-BPZv_axd.js} +3 -3
- package/dist/index.html +16 -12
- package/package.json +99 -92
- package/scripts/stubs/node-domexception/index.cjs +18 -0
- package/scripts/stubs/node-domexception/package.json +7 -0
- package/skills/hiro-task-manager-cli/SKILL.md +97 -0
- package/skills/hiro-task-manager-cli/reference/boards.md +143 -0
- package/skills/hiro-task-manager-cli/reference/cli-access-policy.md +72 -0
- package/skills/hiro-task-manager-cli/reference/errors.md +85 -0
- package/skills/hiro-task-manager-cli/reference/lists.md +106 -0
- package/skills/hiro-task-manager-cli/reference/releases.md +87 -0
- package/skills/hiro-task-manager-cli/reference/search.md +38 -0
- package/skills/hiro-task-manager-cli/reference/statuses.md +25 -0
- package/skills/hiro-task-manager-cli/reference/tasks.md +144 -0
- package/skills/hiro-task-manager-cli/reference/trash.md +50 -0
- package/src/cli/bootstrap/launcher.test.ts +66 -0
- package/src/cli/bootstrap/launcher.ts +389 -35
- package/src/cli/bootstrap/program.test.ts +46 -0
- package/src/cli/bootstrap/program.ts +54 -1
- package/src/cli/bootstrap/runtime.test.ts +15 -0
- package/src/cli/bootstrap/runtime.ts +27 -1
- package/src/cli/commands/query.ts +56 -56
- package/src/cli/commands/server.ts +27 -19
- package/src/cli/handlers/boards.test.ts +669 -669
- package/src/cli/handlers/cli-wiring.test.ts +1 -1
- package/src/cli/handlers/search.test.ts +374 -374
- package/src/cli/handlers/search.ts +17 -17
- package/src/cli/handlers/server.test.ts +55 -13
- package/src/cli/handlers/server.ts +16 -3
- package/src/cli/lib/api-client.test.ts +35 -2
- package/src/cli/lib/api-client.ts +43 -10
- package/src/cli/lib/cli-http-errors.test.ts +85 -85
- package/src/cli/lib/command-helpers.ts +161 -154
- package/src/cli/lib/config.ts +4 -0
- package/src/cli/lib/launcherUi.test.ts +74 -0
- package/src/cli/lib/launcherUi.ts +213 -0
- package/src/cli/lib/process.test.ts +24 -5
- package/src/cli/lib/process.ts +86 -55
- package/src/cli/ports/process.ts +8 -2
- package/src/cli/subprocess.real-stack.test.ts +611 -598
- package/src/cli/subprocess.smoke.test.ts +954 -969
- package/src/cli/types/config.ts +2 -6
- package/src/client/components/auth/AuthScreen.tsx +3 -3
- package/src/client/components/board/BoardStatsChips.tsx +233 -233
- package/src/client/components/board/BoardStatsContext.tsx +41 -41
- package/src/client/components/board/boardHeaderButtonStyles.ts +38 -38
- package/src/client/components/board/shortcuts/useBoardShortcutKeydown.ts +49 -49
- package/src/client/components/board/useBoardCanvasPanScroll.ts +108 -108
- package/src/client/components/board/useBoardTaskContainerDroppableReact.ts +33 -33
- package/src/client/components/board/useBoardTaskSortableReact.ts +26 -26
- package/src/client/components/multi-select.tsx +1206 -1206
- package/src/client/components/routing/BoardPage.tsx +20 -20
- package/src/client/components/routing/NavigationRegistrar.tsx +13 -13
- package/src/client/components/settings/SettingsPage.tsx +1 -1
- package/src/client/components/task/TaskCard.tsx +643 -643
- package/src/client/components/ui/badge.tsx +49 -49
- package/src/client/components/ui/button.tsx +65 -65
- package/src/client/components/ui/command.tsx +193 -193
- package/src/client/components/ui/dialog.tsx +163 -163
- package/src/client/components/ui/input-group.tsx +155 -155
- package/src/client/components/ui/input.tsx +19 -19
- package/src/client/components/ui/popover.tsx +87 -87
- package/src/client/components/ui/separator.tsx +28 -28
- package/src/client/components/ui/textarea.tsx +18 -18
- package/src/client/index.css +248 -248
- package/src/client/lib/appNavigate.ts +16 -16
- package/src/client/lib/taskCardDate.ts +111 -111
- package/src/client/lib/utils.ts +6 -6
- package/src/server/auth.ts +351 -302
- package/src/server/bootstrapDev.ts +11 -2
- package/src/server/bootstrapInstalled.ts +6 -1
- package/src/server/index.ts +33 -7
- package/src/server/migrations/013_cli_policy_and_provenance.ts +2 -2
- package/src/server/migrations/019_cli_global_create_board_default_on.ts +14 -0
- package/src/server/migrations/registry.ts +43 -41
- package/src/server/parseBootstrapProfile.ts +42 -0
- package/src/server/storage/cliPolicy.ts +2 -1
- package/src/shared/runtimeConfig.ts +256 -237
- package/src/shared/runtimeIdentity.test.ts +47 -0
- package/src/shared/runtimeIdentity.ts +35 -0
- package/src/shared/serverStatus.ts +21 -0
- package/src/shared/skillsInstall.ts +70 -0
- package/src/shared/terminalColors.ts +24 -0
- package/dist/assets/architecture-YZFGNWBL-3h1eIYfB.js +0 -1
- package/dist/assets/architectureDiagram-Q4EWVU46-DSQ1_74_.js +0 -36
- package/dist/assets/channel-yBmN_ln0.js +0 -1
- package/dist/assets/classDiagram-6PBFFD2Q-CotFZI8-.js +0 -1
- package/dist/assets/classDiagram-v2-HSJHXN6E-DAPzeDGn.js +0 -1
- package/dist/assets/clone-BRQpYu_n.js +0 -1
- package/dist/assets/cytoscape.esm-BIYWHPG0.js +0 -321
- package/dist/assets/dagre-rhyPjnsQ.js +0 -1
- package/dist/assets/diagram-5BDNPKRD-Ky3EXXj0.js +0 -10
- package/dist/assets/diagram-G4DWMVQ6-t7LbT0Uz.js +0 -24
- package/dist/assets/diagram-MMDJMWI5-CdnLXEMx.js +0 -43
- package/dist/assets/diagram-TYMM5635-CnzTqJBM.js +0 -24
- package/dist/assets/gitGraph-7Q5UKJZL-CG8f8JF7.js +0 -1
- package/dist/assets/graphlib-COiJG5Qv.js +0 -1
- package/dist/assets/identity-D4WOnl_h.js +0 -1
- package/dist/assets/index-lyyIVcc_.js +0 -304
- package/dist/assets/info-OMHHGYJF-C8_SHoRO.js +0 -1
- package/dist/assets/infoDiagram-42DDH7IO-BbvTdpSV.js +0 -2
- package/dist/assets/mermaid-parser.core-6Tn8epr_.js +0 -4
- package/dist/assets/packet-4T2RLAQJ-BvpAX0kJ.js +0 -1
- package/dist/assets/pie-ZZUOXDRM-Ow26Yf-E.js +0 -1
- package/dist/assets/radar-PYXPWWZC-e_ron5jQ.js +0 -1
- package/dist/assets/reduce-BDOBPIXr.js +0 -1
- package/dist/assets/stateDiagram-FHFEXIEX-CYfGMoR8.js +0 -1
- package/dist/assets/stateDiagram-v2-QKLJ7IA2-CO1W_n55.js +0 -1
- package/dist/assets/treeView-SZITEDCU-DsEr3xeq.js +0 -1
- package/dist/assets/treemap-W4RFUUIX-DV7nk2AB.js +0 -1
- package/dist/assets/vennDiagram-DHZGUBPP-BjTbuhcb.js +0 -34
- package/dist/assets/wardley-RL74JXVD-CrrFU9AE.js +0 -1
- /package/dist/assets/{chunk-4BX2VUAB-ean5NKtU.js → chunk-4BX2VUAB-C70mcfQR.js} +0 -0
- /package/dist/assets/{chunk-55IACEB6-CvSRyJqy.js → chunk-55IACEB6-CWfnqcLM.js} +0 -0
- /package/dist/assets/{chunk-BSJP7CBP-D8kBlJsf.js → chunk-BSJP7CBP-B0LrXV9y.js} +0 -0
- /package/dist/assets/{chunk-FMBD7UC4-DrNhFt1N.js → chunk-FMBD7UC4-_mV71Mwu.js} +0 -0
- /package/dist/assets/{chunk-QZHKN3VN-Csp3OYJY.js → chunk-QZHKN3VN-t2nrsegL.js} +0 -0
- /package/dist/assets/{katex-8mXVa4k3.js → katex-B2dtGfSp.js} +0 -0
- /package/dist/assets/{rough.esm-DtEqI08j.js → rough.esm-DEh6Frf9.js} +0 -0
|
@@ -1,969 +1,954 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Aspect 4 — integration depth: subprocess smoke.
|
|
3
|
-
* Spawns the real `hirotm` entry (argv → Commander → handlers) to catch wiring issues
|
|
4
|
-
* that in-process handler tests miss.
|
|
5
|
-
*/
|
|
6
|
-
import { describe, expect, test } from "bun:test";
|
|
7
|
-
import path from "node:path";
|
|
8
|
-
import { TASK_MANAGER_CLIENT_NAME_HEADER } from "../shared/boardCliAccess";
|
|
9
|
-
|
|
10
|
-
const repoRoot = path.resolve(import.meta.dir, "..", "..");
|
|
11
|
-
const hirotmEntry = path.join(repoRoot, "src", "cli", "bin", "hirotm.ts");
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
]);
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
expect(
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
},
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
readSubprocessStream(proc.
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
expect(
|
|
175
|
-
expect(
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
);
|
|
194
|
-
const [stdout, stderr] = await Promise.all([
|
|
195
|
-
readSubprocessStream(proc.stdout),
|
|
196
|
-
readSubprocessStream(proc.stderr),
|
|
197
|
-
]);
|
|
198
|
-
const code = await proc.exited;
|
|
199
|
-
|
|
200
|
-
expect(code).toBe(2);
|
|
201
|
-
expect(stdout.trim()).toBe("");
|
|
202
|
-
// Global --format human → stderr is plain text, not JSON (same as other human-mode errors).
|
|
203
|
-
expect(stderr).toContain("--quiet");
|
|
204
|
-
expect(stderr).toContain("ndjson");
|
|
205
|
-
} finally {
|
|
206
|
-
server.stop();
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
test("boards list with no server → exit 6 and stderr JSON contract", async () => {
|
|
211
|
-
const proc = spawnHirotm(["boards", "list"]
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
expect(
|
|
221
|
-
|
|
222
|
-
expect(
|
|
223
|
-
|
|
224
|
-
expect(err.
|
|
225
|
-
expect(err.
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
expect(
|
|
236
|
-
expect(stdout).toContain("
|
|
237
|
-
expect(stdout
|
|
238
|
-
expect(stdout).toContain("--
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
const
|
|
244
|
-
|
|
245
|
-
expect(
|
|
246
|
-
expect(boardsOut).toContain("
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
const
|
|
250
|
-
|
|
251
|
-
expect(
|
|
252
|
-
expect(qsOut).toContain("
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
const
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
expect(
|
|
267
|
-
expect(
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
expect(
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
expect(
|
|
308
|
-
expect(
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
const
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
])
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
"
|
|
551
|
-
"
|
|
552
|
-
"
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
);
|
|
563
|
-
const
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
)
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
);
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
const
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
);
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
);
|
|
956
|
-
const [stdout, stderr] = await Promise.all([
|
|
957
|
-
readSubprocessStream(proc.stdout),
|
|
958
|
-
readSubprocessStream(proc.stderr),
|
|
959
|
-
]);
|
|
960
|
-
const code = await proc.exited;
|
|
961
|
-
|
|
962
|
-
expect(code).toBe(0);
|
|
963
|
-
expect(stderr.trim()).toBe("");
|
|
964
|
-
expect(stdout).toContain("No rows.");
|
|
965
|
-
} finally {
|
|
966
|
-
server.stop();
|
|
967
|
-
}
|
|
968
|
-
});
|
|
969
|
-
});
|
|
1
|
+
/**
|
|
2
|
+
* Aspect 4 — integration depth: subprocess smoke.
|
|
3
|
+
* Spawns the real `hirotm` entry (argv → Commander → handlers) to catch wiring issues
|
|
4
|
+
* that in-process handler tests miss.
|
|
5
|
+
*/
|
|
6
|
+
import { describe, expect, test } from "bun:test";
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
import { TASK_MANAGER_CLIENT_NAME_HEADER } from "../shared/boardCliAccess";
|
|
9
|
+
|
|
10
|
+
const repoRoot = path.resolve(import.meta.dir, "..", "..");
|
|
11
|
+
const hirotmEntry = path.join(repoRoot, "src", "cli", "bin", "hirotm.ts");
|
|
12
|
+
|
|
13
|
+
function withPort(port: number | undefined, args: string[]): string[] {
|
|
14
|
+
if (port === undefined || !Number.isFinite(port)) {
|
|
15
|
+
throw new Error("withPort: expected a listening port from Bun.serve");
|
|
16
|
+
}
|
|
17
|
+
return ["--port", String(port), ...args];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async function readSubprocessStream(
|
|
21
|
+
stream: ReturnType<typeof Bun.spawn>["stdout"],
|
|
22
|
+
): Promise<string> {
|
|
23
|
+
// When `stdout: "pipe"`, Bun exposes a ReadableStream; types also allow fd numbers.
|
|
24
|
+
if (stream == null || typeof stream === "number") return "";
|
|
25
|
+
return await new Response(stream as ReadableStream<Uint8Array>).text();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function spawnHirotm(
|
|
29
|
+
args: string[],
|
|
30
|
+
envOverrides?: Record<string, string>,
|
|
31
|
+
): ReturnType<typeof Bun.spawn> {
|
|
32
|
+
return Bun.spawn({
|
|
33
|
+
cmd: ["bun", "run", hirotmEntry, ...args],
|
|
34
|
+
cwd: repoRoot,
|
|
35
|
+
stdout: "pipe",
|
|
36
|
+
stderr: "pipe",
|
|
37
|
+
env:
|
|
38
|
+
envOverrides == null
|
|
39
|
+
? process.env
|
|
40
|
+
: { ...process.env, ...envOverrides },
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
describe("hirotm subprocess smoke (aspect 4)", () => {
|
|
45
|
+
test("boards list hits stub API and prints NDJSON stdout (empty page → no lines) (exit 0)", async () => {
|
|
46
|
+
const server = Bun.serve({
|
|
47
|
+
port: 0,
|
|
48
|
+
fetch(req) {
|
|
49
|
+
const u = new URL(req.url);
|
|
50
|
+
if (u.pathname === "/api/boards" && req.method === "GET") {
|
|
51
|
+
return new Response(
|
|
52
|
+
JSON.stringify({
|
|
53
|
+
items: [],
|
|
54
|
+
total: 0,
|
|
55
|
+
limit: 0,
|
|
56
|
+
offset: 0,
|
|
57
|
+
}),
|
|
58
|
+
{
|
|
59
|
+
status: 200,
|
|
60
|
+
headers: { "content-type": "application/json" },
|
|
61
|
+
},
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
return new Response("not found", { status: 404 });
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
try {
|
|
69
|
+
const port = server.port;
|
|
70
|
+
const proc = spawnHirotm(withPort(port, ["boards", "list"]));
|
|
71
|
+
const [stdout, stderr] = await Promise.all([
|
|
72
|
+
readSubprocessStream(proc.stdout),
|
|
73
|
+
readSubprocessStream(proc.stderr),
|
|
74
|
+
]);
|
|
75
|
+
const code = await proc.exited;
|
|
76
|
+
|
|
77
|
+
expect(code).toBe(0);
|
|
78
|
+
expect(stderr.trim()).toBe("");
|
|
79
|
+
// Default list output is NDJSON; empty page emits no lines.
|
|
80
|
+
expect(stdout.trim()).toBe("");
|
|
81
|
+
} finally {
|
|
82
|
+
server.stop();
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
test("boards list --format human → fixed-width table stdout (exit 0)", async () => {
|
|
87
|
+
const server = Bun.serve({
|
|
88
|
+
port: 0,
|
|
89
|
+
fetch(req) {
|
|
90
|
+
const u = new URL(req.url);
|
|
91
|
+
if (u.pathname === "/api/boards" && req.method === "GET") {
|
|
92
|
+
return new Response(
|
|
93
|
+
JSON.stringify({
|
|
94
|
+
items: [
|
|
95
|
+
{
|
|
96
|
+
boardId: 1,
|
|
97
|
+
slug: "a",
|
|
98
|
+
name: "Alpha",
|
|
99
|
+
emoji: null,
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
total: 1,
|
|
103
|
+
limit: 1,
|
|
104
|
+
offset: 0,
|
|
105
|
+
}),
|
|
106
|
+
{
|
|
107
|
+
status: 200,
|
|
108
|
+
headers: { "content-type": "application/json" },
|
|
109
|
+
},
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
return new Response("not found", { status: 404 });
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
try {
|
|
117
|
+
const port = server.port;
|
|
118
|
+
const proc = spawnHirotm(withPort(port, ["boards", "list", "--format", "human"]));
|
|
119
|
+
const [stdout, stderr] = await Promise.all([
|
|
120
|
+
readSubprocessStream(proc.stdout),
|
|
121
|
+
readSubprocessStream(proc.stderr),
|
|
122
|
+
]);
|
|
123
|
+
const code = await proc.exited;
|
|
124
|
+
|
|
125
|
+
expect(code).toBe(0);
|
|
126
|
+
expect(stderr.trim()).toBe("");
|
|
127
|
+
expect(stdout).toContain("Slug");
|
|
128
|
+
expect(stdout).toContain("Alpha");
|
|
129
|
+
expect(stdout).toContain("total 1");
|
|
130
|
+
} finally {
|
|
131
|
+
server.stop();
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
test("boards list --quiet → one slug per line (exit 0)", async () => {
|
|
136
|
+
const server = Bun.serve({
|
|
137
|
+
port: 0,
|
|
138
|
+
fetch(req) {
|
|
139
|
+
const u = new URL(req.url);
|
|
140
|
+
if (u.pathname === "/api/boards" && req.method === "GET") {
|
|
141
|
+
return new Response(
|
|
142
|
+
JSON.stringify({
|
|
143
|
+
items: [
|
|
144
|
+
{
|
|
145
|
+
boardId: 1,
|
|
146
|
+
slug: "a",
|
|
147
|
+
name: "Alpha",
|
|
148
|
+
emoji: null,
|
|
149
|
+
},
|
|
150
|
+
],
|
|
151
|
+
total: 1,
|
|
152
|
+
limit: 1,
|
|
153
|
+
offset: 0,
|
|
154
|
+
}),
|
|
155
|
+
{
|
|
156
|
+
status: 200,
|
|
157
|
+
headers: { "content-type": "application/json" },
|
|
158
|
+
},
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
return new Response("not found", { status: 404 });
|
|
162
|
+
},
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
try {
|
|
166
|
+
const port = server.port;
|
|
167
|
+
const proc = spawnHirotm(withPort(port, ["--quiet", "boards", "list"]));
|
|
168
|
+
const [stdout, stderr] = await Promise.all([
|
|
169
|
+
readSubprocessStream(proc.stdout),
|
|
170
|
+
readSubprocessStream(proc.stderr),
|
|
171
|
+
]);
|
|
172
|
+
const code = await proc.exited;
|
|
173
|
+
|
|
174
|
+
expect(code).toBe(0);
|
|
175
|
+
expect(stderr.trim()).toBe("");
|
|
176
|
+
expect(stdout.trimEnd()).toBe("a");
|
|
177
|
+
} finally {
|
|
178
|
+
server.stop();
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
test("boards list --quiet --format human → exit 2 (stdout not JSON)", async () => {
|
|
183
|
+
const server = Bun.serve({
|
|
184
|
+
port: 0,
|
|
185
|
+
fetch() {
|
|
186
|
+
return new Response("unused", { status: 500 });
|
|
187
|
+
},
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
try {
|
|
191
|
+
const proc = spawnHirotm(
|
|
192
|
+
withPort(server.port, ["--quiet", "--format", "human", "boards", "list"]),
|
|
193
|
+
);
|
|
194
|
+
const [stdout, stderr] = await Promise.all([
|
|
195
|
+
readSubprocessStream(proc.stdout),
|
|
196
|
+
readSubprocessStream(proc.stderr),
|
|
197
|
+
]);
|
|
198
|
+
const code = await proc.exited;
|
|
199
|
+
|
|
200
|
+
expect(code).toBe(2);
|
|
201
|
+
expect(stdout.trim()).toBe("");
|
|
202
|
+
// Global --format human → stderr is plain text, not JSON (same as other human-mode errors).
|
|
203
|
+
expect(stderr).toContain("--quiet");
|
|
204
|
+
expect(stderr).toContain("ndjson");
|
|
205
|
+
} finally {
|
|
206
|
+
server.stop();
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
test("boards list with no server → exit 6 and stderr JSON contract", async () => {
|
|
211
|
+
const proc = spawnHirotm(withPort(59123, ["boards", "list"]));
|
|
212
|
+
const [stdout, stderr] = await Promise.all([
|
|
213
|
+
readSubprocessStream(proc.stdout),
|
|
214
|
+
readSubprocessStream(proc.stderr),
|
|
215
|
+
]);
|
|
216
|
+
const code = await proc.exited;
|
|
217
|
+
|
|
218
|
+
expect(code).toBe(6);
|
|
219
|
+
expect(stdout.trim()).toBe("");
|
|
220
|
+
expect(stderr.trim().split("\n").length).toBe(1);
|
|
221
|
+
const err = JSON.parse(stderr.trim()) as Record<string, unknown>;
|
|
222
|
+
expect(err.error).toBeDefined();
|
|
223
|
+
expect(err.code).toBe("server_unreachable");
|
|
224
|
+
expect(err.retryable).toBe(true);
|
|
225
|
+
expect(String(err.hint ?? "")).toContain("hirotm");
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
test("--help exits 0 (bootstrap + Commander)", async () => {
|
|
229
|
+
const proc = spawnHirotm(["--help"]);
|
|
230
|
+
const stdout = await readSubprocessStream(proc.stdout);
|
|
231
|
+
const code = await proc.exited;
|
|
232
|
+
|
|
233
|
+
expect(code).toBe(0);
|
|
234
|
+
expect(stdout).toContain("Usage:");
|
|
235
|
+
expect(stdout.toLowerCase()).toContain("hirotm");
|
|
236
|
+
expect(stdout).toContain("--format");
|
|
237
|
+
expect(stdout).toContain("--quiet");
|
|
238
|
+
expect(stdout).toContain("--port");
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
test("boards --help and query search --help (aspect 3 discoverability spot-check)", async () => {
|
|
242
|
+
const boards = spawnHirotm(["boards", "--help"]);
|
|
243
|
+
const boardsOut = await readSubprocessStream(boards.stdout);
|
|
244
|
+
expect(await boards.exited).toBe(0);
|
|
245
|
+
expect(boardsOut).toContain("Usage:");
|
|
246
|
+
expect(boardsOut.toLowerCase()).toContain("boards");
|
|
247
|
+
|
|
248
|
+
const qsearch = spawnHirotm(["query", "search", "--help"]);
|
|
249
|
+
const qsOut = await readSubprocessStream(qsearch.stdout);
|
|
250
|
+
expect(await qsearch.exited).toBe(0);
|
|
251
|
+
expect(qsOut).toContain("Usage:");
|
|
252
|
+
expect(qsOut).toContain("--board");
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
test("handler validation: empty query → exit 2 and stderr JSON (no server)", async () => {
|
|
256
|
+
const proc = spawnHirotm(withPort(59998, ["query", "search", ""]));
|
|
257
|
+
const [stdout, stderr] = await Promise.all([
|
|
258
|
+
readSubprocessStream(proc.stdout),
|
|
259
|
+
readSubprocessStream(proc.stderr),
|
|
260
|
+
]);
|
|
261
|
+
const code = await proc.exited;
|
|
262
|
+
|
|
263
|
+
expect(code).toBe(2);
|
|
264
|
+
expect(stdout.trim()).toBe("");
|
|
265
|
+
const err = JSON.parse(stderr.trim()) as Record<string, unknown>;
|
|
266
|
+
expect(err.error).toBe("Query required");
|
|
267
|
+
expect(err.code).toBe("missing_required");
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
test("Commander missing required argument → exit 1 (boards describe)", async () => {
|
|
271
|
+
const proc = spawnHirotm(["boards", "describe"]);
|
|
272
|
+
const [stdout, stderr] = await Promise.all([
|
|
273
|
+
readSubprocessStream(proc.stdout),
|
|
274
|
+
readSubprocessStream(proc.stderr),
|
|
275
|
+
]);
|
|
276
|
+
const code = await proc.exited;
|
|
277
|
+
|
|
278
|
+
expect(code).toBe(1);
|
|
279
|
+
expect(stdout.trim()).toBe("");
|
|
280
|
+
// Commander prints plain text; project contract prefers exit 2 for usage (see docs/cli-error-handling.md).
|
|
281
|
+
expect(stderr).toContain("missing required argument");
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
test("boards delete without --yes (piped stdin) → exit 2 confirmation_required", async () => {
|
|
285
|
+
const server = Bun.serve({
|
|
286
|
+
port: 0,
|
|
287
|
+
fetch() {
|
|
288
|
+
return new Response("unused", { status: 500 });
|
|
289
|
+
},
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
try {
|
|
293
|
+
const proc = spawnHirotm(withPort(server.port, ["boards", "delete", "x"]));
|
|
294
|
+
const [stdout, stderr] = await Promise.all([
|
|
295
|
+
readSubprocessStream(proc.stdout),
|
|
296
|
+
readSubprocessStream(proc.stderr),
|
|
297
|
+
]);
|
|
298
|
+
const code = await proc.exited;
|
|
299
|
+
|
|
300
|
+
expect(code).toBe(2);
|
|
301
|
+
expect(stdout.trim()).toBe("");
|
|
302
|
+
expect(stderr).toContain("boards delete");
|
|
303
|
+
expect(stderr).toContain("Trash");
|
|
304
|
+
const lines = stderr.trim().split("\n").filter((l) => l.length > 0);
|
|
305
|
+
const jsonLine = lines[lines.length - 1]!;
|
|
306
|
+
const err = JSON.parse(jsonLine) as Record<string, unknown>;
|
|
307
|
+
expect(err.code).toBe("confirmation_required");
|
|
308
|
+
expect(String(err.hint ?? "")).toContain("--yes");
|
|
309
|
+
} finally {
|
|
310
|
+
server.stop();
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
test("boards delete --yes with stub API → exit 0 and stdout JSON", async () => {
|
|
315
|
+
const server = Bun.serve({
|
|
316
|
+
port: 0,
|
|
317
|
+
fetch(req) {
|
|
318
|
+
const u = new URL(req.url);
|
|
319
|
+
if (u.pathname === "/api/boards/x" && req.method === "GET") {
|
|
320
|
+
return new Response(
|
|
321
|
+
JSON.stringify({
|
|
322
|
+
boardId: 1,
|
|
323
|
+
slug: "x",
|
|
324
|
+
name: "X",
|
|
325
|
+
emoji: null,
|
|
326
|
+
description: "",
|
|
327
|
+
lists: [],
|
|
328
|
+
tasks: [],
|
|
329
|
+
}),
|
|
330
|
+
{ status: 200, headers: { "content-type": "application/json" } },
|
|
331
|
+
);
|
|
332
|
+
}
|
|
333
|
+
if (u.pathname === "/api/boards/x" && req.method === "DELETE") {
|
|
334
|
+
return new Response(null, { status: 204 });
|
|
335
|
+
}
|
|
336
|
+
return new Response("not found", { status: 404 });
|
|
337
|
+
},
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
try {
|
|
341
|
+
const proc = spawnHirotm(withPort(server.port, ["boards", "delete", "x", "--yes"]));
|
|
342
|
+
const [stdout, stderr] = await Promise.all([
|
|
343
|
+
readSubprocessStream(proc.stdout),
|
|
344
|
+
readSubprocessStream(proc.stderr),
|
|
345
|
+
]);
|
|
346
|
+
const code = await proc.exited;
|
|
347
|
+
|
|
348
|
+
expect(code).toBe(0);
|
|
349
|
+
expect(stderr.trim()).toBe("");
|
|
350
|
+
const line = stdout.trim().split("\n").filter((l) => l.length > 0);
|
|
351
|
+
expect(line.length).toBeGreaterThanOrEqual(1);
|
|
352
|
+
const row = JSON.parse(line[0]!) as Record<string, unknown>;
|
|
353
|
+
expect(row.ok).toBe(true);
|
|
354
|
+
} finally {
|
|
355
|
+
server.stop();
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
test("boards list with stub 403 → exit 4 and stderr JSON (aspect 3 + 6)", async () => {
|
|
360
|
+
const server = Bun.serve({
|
|
361
|
+
port: 0,
|
|
362
|
+
fetch(req) {
|
|
363
|
+
const u = new URL(req.url);
|
|
364
|
+
if (u.pathname === "/api/boards" && req.method === "GET") {
|
|
365
|
+
return new Response(
|
|
366
|
+
JSON.stringify({ error: "denied", code: "forbidden" }),
|
|
367
|
+
{
|
|
368
|
+
status: 403,
|
|
369
|
+
headers: { "content-type": "application/json" },
|
|
370
|
+
},
|
|
371
|
+
);
|
|
372
|
+
}
|
|
373
|
+
return new Response("not found", { status: 404 });
|
|
374
|
+
},
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
try {
|
|
378
|
+
const proc = spawnHirotm(withPort(server.port, ["boards", "list"]));
|
|
379
|
+
const [stdout, stderr] = await Promise.all([
|
|
380
|
+
readSubprocessStream(proc.stdout),
|
|
381
|
+
readSubprocessStream(proc.stderr),
|
|
382
|
+
]);
|
|
383
|
+
const code = await proc.exited;
|
|
384
|
+
|
|
385
|
+
expect(code).toBe(4);
|
|
386
|
+
expect(stdout.trim()).toBe("");
|
|
387
|
+
const err = JSON.parse(stderr.trim()) as Record<string, unknown>;
|
|
388
|
+
expect(err.error).toBe("denied");
|
|
389
|
+
expect(err.code).toBe("forbidden");
|
|
390
|
+
} finally {
|
|
391
|
+
server.stop();
|
|
392
|
+
}
|
|
393
|
+
});
|
|
394
|
+
|
|
395
|
+
test("boards list + stub 401 → exit 10, stderr JSON unauthenticated", async () => {
|
|
396
|
+
const server = Bun.serve({
|
|
397
|
+
port: 0,
|
|
398
|
+
fetch(req) {
|
|
399
|
+
const u = new URL(req.url);
|
|
400
|
+
if (u.pathname === "/api/boards" && req.method === "GET") {
|
|
401
|
+
return new Response(
|
|
402
|
+
JSON.stringify({
|
|
403
|
+
error: "unauthenticated",
|
|
404
|
+
code: "unauthenticated",
|
|
405
|
+
}),
|
|
406
|
+
{
|
|
407
|
+
status: 401,
|
|
408
|
+
headers: { "content-type": "application/json" },
|
|
409
|
+
},
|
|
410
|
+
);
|
|
411
|
+
}
|
|
412
|
+
return new Response("not found", { status: 404 });
|
|
413
|
+
},
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
try {
|
|
417
|
+
const proc = spawnHirotm(withPort(server.port, ["boards", "list"]));
|
|
418
|
+
const [stdout, stderr] = await Promise.all([
|
|
419
|
+
readSubprocessStream(proc.stdout),
|
|
420
|
+
readSubprocessStream(proc.stderr),
|
|
421
|
+
]);
|
|
422
|
+
const code = await proc.exited;
|
|
423
|
+
|
|
424
|
+
expect(code).toBe(10);
|
|
425
|
+
expect(stdout.trim()).toBe("");
|
|
426
|
+
const err = JSON.parse(stderr.trim()) as Record<string, unknown>;
|
|
427
|
+
expect(err.code).toBe("unauthenticated");
|
|
428
|
+
} finally {
|
|
429
|
+
server.stop();
|
|
430
|
+
}
|
|
431
|
+
});
|
|
432
|
+
|
|
433
|
+
test("boards list + stub 404 → exit 3, stderr JSON not_found", async () => {
|
|
434
|
+
const server = Bun.serve({
|
|
435
|
+
port: 0,
|
|
436
|
+
fetch(req) {
|
|
437
|
+
const u = new URL(req.url);
|
|
438
|
+
if (u.pathname === "/api/boards" && req.method === "GET") {
|
|
439
|
+
return new Response(
|
|
440
|
+
JSON.stringify({ error: "not found", code: "not_found" }),
|
|
441
|
+
{
|
|
442
|
+
status: 404,
|
|
443
|
+
headers: { "content-type": "application/json" },
|
|
444
|
+
},
|
|
445
|
+
);
|
|
446
|
+
}
|
|
447
|
+
return new Response("not found", { status: 404 });
|
|
448
|
+
},
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
try {
|
|
452
|
+
const proc = spawnHirotm(withPort(server.port, ["boards", "list"]));
|
|
453
|
+
const [stdout, stderr] = await Promise.all([
|
|
454
|
+
readSubprocessStream(proc.stdout),
|
|
455
|
+
readSubprocessStream(proc.stderr),
|
|
456
|
+
]);
|
|
457
|
+
const code = await proc.exited;
|
|
458
|
+
|
|
459
|
+
expect(code).toBe(3);
|
|
460
|
+
expect(stdout.trim()).toBe("");
|
|
461
|
+
const err = JSON.parse(stderr.trim()) as Record<string, unknown>;
|
|
462
|
+
expect(err.code).toBe("not_found");
|
|
463
|
+
} finally {
|
|
464
|
+
server.stop();
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
|
|
468
|
+
test("boards list + stub 409 → exit 5, stderr JSON conflict", async () => {
|
|
469
|
+
const server = Bun.serve({
|
|
470
|
+
port: 0,
|
|
471
|
+
fetch(req) {
|
|
472
|
+
const u = new URL(req.url);
|
|
473
|
+
if (u.pathname === "/api/boards" && req.method === "GET") {
|
|
474
|
+
return new Response(
|
|
475
|
+
JSON.stringify({ error: "conflict", code: "conflict" }),
|
|
476
|
+
{
|
|
477
|
+
status: 409,
|
|
478
|
+
headers: { "content-type": "application/json" },
|
|
479
|
+
},
|
|
480
|
+
);
|
|
481
|
+
}
|
|
482
|
+
return new Response("not found", { status: 404 });
|
|
483
|
+
},
|
|
484
|
+
});
|
|
485
|
+
|
|
486
|
+
try {
|
|
487
|
+
const proc = spawnHirotm(withPort(server.port, ["boards", "list"]));
|
|
488
|
+
const [stdout, stderr] = await Promise.all([
|
|
489
|
+
readSubprocessStream(proc.stdout),
|
|
490
|
+
readSubprocessStream(proc.stderr),
|
|
491
|
+
]);
|
|
492
|
+
const code = await proc.exited;
|
|
493
|
+
|
|
494
|
+
expect(code).toBe(5);
|
|
495
|
+
expect(stdout.trim()).toBe("");
|
|
496
|
+
const err = JSON.parse(stderr.trim()) as Record<string, unknown>;
|
|
497
|
+
expect(err.code).toBe("conflict");
|
|
498
|
+
} finally {
|
|
499
|
+
server.stop();
|
|
500
|
+
}
|
|
501
|
+
});
|
|
502
|
+
|
|
503
|
+
test("tasks add + stub POST 200 → exit 0, stdout ok true", async () => {
|
|
504
|
+
const server = Bun.serve({
|
|
505
|
+
port: 0,
|
|
506
|
+
fetch(req) {
|
|
507
|
+
const u = new URL(req.url);
|
|
508
|
+
if (
|
|
509
|
+
u.pathname === "/api/boards/b/tasks" &&
|
|
510
|
+
req.method === "POST"
|
|
511
|
+
) {
|
|
512
|
+
return new Response(
|
|
513
|
+
JSON.stringify({
|
|
514
|
+
boardId: 1,
|
|
515
|
+
boardSlug: "b",
|
|
516
|
+
boardUpdatedAt: "2026-01-02T00:00:00.000Z",
|
|
517
|
+
entity: {
|
|
518
|
+
taskId: 42,
|
|
519
|
+
listId: 1,
|
|
520
|
+
groupId: 1,
|
|
521
|
+
title: "Hello",
|
|
522
|
+
body: "",
|
|
523
|
+
priorityId: 1,
|
|
524
|
+
status: "open",
|
|
525
|
+
order: 0,
|
|
526
|
+
createdAt: "2026-01-01T00:00:00.000Z",
|
|
527
|
+
updatedAt: "2026-01-01T00:00:00.000Z",
|
|
528
|
+
},
|
|
529
|
+
}),
|
|
530
|
+
{
|
|
531
|
+
status: 200,
|
|
532
|
+
headers: { "content-type": "application/json" },
|
|
533
|
+
},
|
|
534
|
+
);
|
|
535
|
+
}
|
|
536
|
+
return new Response("not found", { status: 404 });
|
|
537
|
+
},
|
|
538
|
+
});
|
|
539
|
+
|
|
540
|
+
try {
|
|
541
|
+
const proc = spawnHirotm(
|
|
542
|
+
withPort(server.port, [
|
|
543
|
+
"tasks",
|
|
544
|
+
"add",
|
|
545
|
+
"--board",
|
|
546
|
+
"b",
|
|
547
|
+
"--list",
|
|
548
|
+
"1",
|
|
549
|
+
"--group",
|
|
550
|
+
"1",
|
|
551
|
+
"--title",
|
|
552
|
+
"Hello",
|
|
553
|
+
]),
|
|
554
|
+
);
|
|
555
|
+
const [stdout, stderr] = await Promise.all([
|
|
556
|
+
readSubprocessStream(proc.stdout),
|
|
557
|
+
readSubprocessStream(proc.stderr),
|
|
558
|
+
]);
|
|
559
|
+
const code = await proc.exited;
|
|
560
|
+
|
|
561
|
+
expect(code).toBe(0);
|
|
562
|
+
expect(stderr.trim()).toBe("");
|
|
563
|
+
const row = JSON.parse(stdout.trim()) as Record<string, unknown>;
|
|
564
|
+
expect(row.ok).toBe(true);
|
|
565
|
+
} finally {
|
|
566
|
+
server.stop();
|
|
567
|
+
}
|
|
568
|
+
});
|
|
569
|
+
|
|
570
|
+
test("lists add + stub POST 200 → exit 0, stdout envelope", async () => {
|
|
571
|
+
const server = Bun.serve({
|
|
572
|
+
port: 0,
|
|
573
|
+
fetch(req) {
|
|
574
|
+
const u = new URL(req.url);
|
|
575
|
+
if (u.pathname === "/api/boards/b/lists" && req.method === "POST") {
|
|
576
|
+
return new Response(
|
|
577
|
+
JSON.stringify({
|
|
578
|
+
boardId: 1,
|
|
579
|
+
boardSlug: "b",
|
|
580
|
+
boardUpdatedAt: "2026-01-02T00:00:00.000Z",
|
|
581
|
+
entity: {
|
|
582
|
+
listId: 9,
|
|
583
|
+
name: "Backlog",
|
|
584
|
+
order: 0,
|
|
585
|
+
emoji: null,
|
|
586
|
+
},
|
|
587
|
+
}),
|
|
588
|
+
{
|
|
589
|
+
status: 200,
|
|
590
|
+
headers: { "content-type": "application/json" },
|
|
591
|
+
},
|
|
592
|
+
);
|
|
593
|
+
}
|
|
594
|
+
return new Response("not found", { status: 404 });
|
|
595
|
+
},
|
|
596
|
+
});
|
|
597
|
+
|
|
598
|
+
try {
|
|
599
|
+
const proc = spawnHirotm(
|
|
600
|
+
withPort(server.port, ["lists", "add", "--board", "b", "Backlog"]),
|
|
601
|
+
);
|
|
602
|
+
const [stdout, stderr] = await Promise.all([
|
|
603
|
+
readSubprocessStream(proc.stdout),
|
|
604
|
+
readSubprocessStream(proc.stderr),
|
|
605
|
+
]);
|
|
606
|
+
const code = await proc.exited;
|
|
607
|
+
|
|
608
|
+
expect(code).toBe(0);
|
|
609
|
+
expect(stderr.trim()).toBe("");
|
|
610
|
+
const row = JSON.parse(stdout.trim()) as Record<string, unknown>;
|
|
611
|
+
expect(row.ok).toBe(true);
|
|
612
|
+
expect((row.entity as Record<string, unknown>).type).toBe("list");
|
|
613
|
+
} finally {
|
|
614
|
+
server.stop();
|
|
615
|
+
}
|
|
616
|
+
});
|
|
617
|
+
|
|
618
|
+
test("releases list + stub GET paginated → exit 0, NDJSON lines", async () => {
|
|
619
|
+
const rel = {
|
|
620
|
+
releaseId: 1,
|
|
621
|
+
name: "1.0",
|
|
622
|
+
createdAt: "2026-01-01T00:00:00.000Z",
|
|
623
|
+
};
|
|
624
|
+
const server = Bun.serve({
|
|
625
|
+
port: 0,
|
|
626
|
+
fetch(req) {
|
|
627
|
+
const u = new URL(req.url);
|
|
628
|
+
if (
|
|
629
|
+
u.pathname === "/api/boards/b/releases" &&
|
|
630
|
+
req.method === "GET"
|
|
631
|
+
) {
|
|
632
|
+
return new Response(
|
|
633
|
+
JSON.stringify({
|
|
634
|
+
items: [rel],
|
|
635
|
+
total: 1,
|
|
636
|
+
limit: 50,
|
|
637
|
+
offset: 0,
|
|
638
|
+
}),
|
|
639
|
+
{
|
|
640
|
+
status: 200,
|
|
641
|
+
headers: { "content-type": "application/json" },
|
|
642
|
+
},
|
|
643
|
+
);
|
|
644
|
+
}
|
|
645
|
+
return new Response("not found", { status: 404 });
|
|
646
|
+
},
|
|
647
|
+
});
|
|
648
|
+
|
|
649
|
+
try {
|
|
650
|
+
const proc = spawnHirotm(
|
|
651
|
+
withPort(server.port, ["releases", "list", "--board", "b"]),
|
|
652
|
+
);
|
|
653
|
+
const [stdout, stderr] = await Promise.all([
|
|
654
|
+
readSubprocessStream(proc.stdout),
|
|
655
|
+
readSubprocessStream(proc.stderr),
|
|
656
|
+
]);
|
|
657
|
+
const code = await proc.exited;
|
|
658
|
+
|
|
659
|
+
expect(code).toBe(0);
|
|
660
|
+
expect(stderr.trim()).toBe("");
|
|
661
|
+
const lines = stdout.trimEnd().split("\n").filter((l) => l.length > 0);
|
|
662
|
+
expect(lines.length).toBe(1);
|
|
663
|
+
expect(JSON.parse(lines[0]!)).toMatchObject({ releaseId: 1, name: "1.0" });
|
|
664
|
+
} finally {
|
|
665
|
+
server.stop();
|
|
666
|
+
}
|
|
667
|
+
});
|
|
668
|
+
|
|
669
|
+
test("statuses list + stub GET array → exit 0, NDJSON lines", async () => {
|
|
670
|
+
const row = {
|
|
671
|
+
statusId: "open",
|
|
672
|
+
label: "Open",
|
|
673
|
+
sortOrder: 0,
|
|
674
|
+
isClosed: false,
|
|
675
|
+
};
|
|
676
|
+
const server = Bun.serve({
|
|
677
|
+
port: 0,
|
|
678
|
+
fetch(req) {
|
|
679
|
+
const u = new URL(req.url);
|
|
680
|
+
if (u.pathname === "/api/statuses" && req.method === "GET") {
|
|
681
|
+
return new Response(JSON.stringify([row]), {
|
|
682
|
+
status: 200,
|
|
683
|
+
headers: { "content-type": "application/json" },
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
return new Response("not found", { status: 404 });
|
|
687
|
+
},
|
|
688
|
+
});
|
|
689
|
+
|
|
690
|
+
try {
|
|
691
|
+
const proc = spawnHirotm(withPort(server.port, ["statuses", "list"]));
|
|
692
|
+
const [stdout, stderr] = await Promise.all([
|
|
693
|
+
readSubprocessStream(proc.stdout),
|
|
694
|
+
readSubprocessStream(proc.stderr),
|
|
695
|
+
]);
|
|
696
|
+
const code = await proc.exited;
|
|
697
|
+
|
|
698
|
+
expect(code).toBe(0);
|
|
699
|
+
expect(stderr.trim()).toBe("");
|
|
700
|
+
const lines = stdout.trimEnd().split("\n").filter((l) => l.length > 0);
|
|
701
|
+
expect(lines.length).toBe(1);
|
|
702
|
+
expect(JSON.parse(lines[0]!)).toMatchObject({ statusId: "open" });
|
|
703
|
+
} finally {
|
|
704
|
+
server.stop();
|
|
705
|
+
}
|
|
706
|
+
});
|
|
707
|
+
|
|
708
|
+
test("query search human + stub GET /search → exit 0, table has Board header", async () => {
|
|
709
|
+
const hit = {
|
|
710
|
+
taskId: 1,
|
|
711
|
+
boardId: 1,
|
|
712
|
+
boardSlug: "b",
|
|
713
|
+
boardName: "B",
|
|
714
|
+
listId: 1,
|
|
715
|
+
listName: "L",
|
|
716
|
+
title: "Task",
|
|
717
|
+
snippet: "…test…",
|
|
718
|
+
score: 0.1,
|
|
719
|
+
};
|
|
720
|
+
const server = Bun.serve({
|
|
721
|
+
port: 0,
|
|
722
|
+
fetch(req) {
|
|
723
|
+
const u = new URL(req.url);
|
|
724
|
+
if (u.pathname === "/api/search" && req.method === "GET") {
|
|
725
|
+
return new Response(
|
|
726
|
+
JSON.stringify({
|
|
727
|
+
items: [hit],
|
|
728
|
+
total: 1,
|
|
729
|
+
limit: 20,
|
|
730
|
+
offset: 0,
|
|
731
|
+
}),
|
|
732
|
+
{
|
|
733
|
+
status: 200,
|
|
734
|
+
headers: { "content-type": "application/json" },
|
|
735
|
+
},
|
|
736
|
+
);
|
|
737
|
+
}
|
|
738
|
+
return new Response("not found", { status: 404 });
|
|
739
|
+
},
|
|
740
|
+
});
|
|
741
|
+
|
|
742
|
+
try {
|
|
743
|
+
const proc = spawnHirotm(
|
|
744
|
+
withPort(server.port, ["query", "search", "test", "--format", "human"]),
|
|
745
|
+
);
|
|
746
|
+
const [stdout, stderr] = await Promise.all([
|
|
747
|
+
readSubprocessStream(proc.stdout),
|
|
748
|
+
readSubprocessStream(proc.stderr),
|
|
749
|
+
]);
|
|
750
|
+
const code = await proc.exited;
|
|
751
|
+
|
|
752
|
+
expect(code).toBe(0);
|
|
753
|
+
expect(stderr.trim()).toBe("");
|
|
754
|
+
expect(stdout).toContain("Board");
|
|
755
|
+
expect(stdout).toContain("b");
|
|
756
|
+
} finally {
|
|
757
|
+
server.stop();
|
|
758
|
+
}
|
|
759
|
+
});
|
|
760
|
+
|
|
761
|
+
test("tasks list --board b + stub GET paginated → exit 0, NDJSON", async () => {
|
|
762
|
+
const task = {
|
|
763
|
+
taskId: 7,
|
|
764
|
+
listId: 1,
|
|
765
|
+
groupId: 1,
|
|
766
|
+
title: "T",
|
|
767
|
+
body: "",
|
|
768
|
+
priorityId: 1,
|
|
769
|
+
status: "open",
|
|
770
|
+
order: 0,
|
|
771
|
+
createdAt: "2026-01-01T00:00:00.000Z",
|
|
772
|
+
updatedAt: "2026-01-01T00:00:00.000Z",
|
|
773
|
+
};
|
|
774
|
+
const server = Bun.serve({
|
|
775
|
+
port: 0,
|
|
776
|
+
fetch(req) {
|
|
777
|
+
const u = new URL(req.url);
|
|
778
|
+
if (
|
|
779
|
+
u.pathname === "/api/boards/b/tasks" &&
|
|
780
|
+
req.method === "GET"
|
|
781
|
+
) {
|
|
782
|
+
return new Response(
|
|
783
|
+
JSON.stringify({
|
|
784
|
+
items: [task],
|
|
785
|
+
total: 1,
|
|
786
|
+
limit: 500,
|
|
787
|
+
offset: 0,
|
|
788
|
+
}),
|
|
789
|
+
{
|
|
790
|
+
status: 200,
|
|
791
|
+
headers: { "content-type": "application/json" },
|
|
792
|
+
},
|
|
793
|
+
);
|
|
794
|
+
}
|
|
795
|
+
return new Response("not found", { status: 404 });
|
|
796
|
+
},
|
|
797
|
+
});
|
|
798
|
+
|
|
799
|
+
try {
|
|
800
|
+
const proc = spawnHirotm(
|
|
801
|
+
withPort(server.port, ["tasks", "list", "--board", "b"]),
|
|
802
|
+
);
|
|
803
|
+
const [stdout, stderr] = await Promise.all([
|
|
804
|
+
readSubprocessStream(proc.stdout),
|
|
805
|
+
readSubprocessStream(proc.stderr),
|
|
806
|
+
]);
|
|
807
|
+
const code = await proc.exited;
|
|
808
|
+
|
|
809
|
+
expect(code).toBe(0);
|
|
810
|
+
expect(stderr.trim()).toBe("");
|
|
811
|
+
const lines = stdout.trimEnd().split("\n").filter((l) => l.length > 0);
|
|
812
|
+
expect(lines.length).toBe(1);
|
|
813
|
+
expect(JSON.parse(lines[0]!)).toMatchObject({ taskId: 7, title: "T" });
|
|
814
|
+
} finally {
|
|
815
|
+
server.stop();
|
|
816
|
+
}
|
|
817
|
+
});
|
|
818
|
+
|
|
819
|
+
test("boards list --fields boardId → NDJSON lines only project boardId", async () => {
|
|
820
|
+
const server = Bun.serve({
|
|
821
|
+
port: 0,
|
|
822
|
+
fetch(req) {
|
|
823
|
+
const u = new URL(req.url);
|
|
824
|
+
if (u.pathname === "/api/boards" && req.method === "GET") {
|
|
825
|
+
return new Response(
|
|
826
|
+
JSON.stringify({
|
|
827
|
+
items: [
|
|
828
|
+
{
|
|
829
|
+
boardId: 1,
|
|
830
|
+
slug: "a",
|
|
831
|
+
name: "Alpha",
|
|
832
|
+
emoji: null,
|
|
833
|
+
},
|
|
834
|
+
],
|
|
835
|
+
total: 1,
|
|
836
|
+
limit: 1,
|
|
837
|
+
offset: 0,
|
|
838
|
+
}),
|
|
839
|
+
{
|
|
840
|
+
status: 200,
|
|
841
|
+
headers: { "content-type": "application/json" },
|
|
842
|
+
},
|
|
843
|
+
);
|
|
844
|
+
}
|
|
845
|
+
return new Response("not found", { status: 404 });
|
|
846
|
+
},
|
|
847
|
+
});
|
|
848
|
+
|
|
849
|
+
try {
|
|
850
|
+
const proc = spawnHirotm(
|
|
851
|
+
withPort(server.port, ["boards", "list", "--fields", "boardId"]),
|
|
852
|
+
);
|
|
853
|
+
const [stdout, stderr] = await Promise.all([
|
|
854
|
+
readSubprocessStream(proc.stdout),
|
|
855
|
+
readSubprocessStream(proc.stderr),
|
|
856
|
+
]);
|
|
857
|
+
const code = await proc.exited;
|
|
858
|
+
|
|
859
|
+
expect(code).toBe(0);
|
|
860
|
+
expect(stderr.trim()).toBe("");
|
|
861
|
+
const lines = stdout.trimEnd().split("\n").filter((l) => l.length > 0);
|
|
862
|
+
expect(lines.length).toBe(1);
|
|
863
|
+
const obj = JSON.parse(lines[0]!) as Record<string, unknown>;
|
|
864
|
+
expect(Object.keys(obj).sort()).toEqual(["boardId"]);
|
|
865
|
+
expect(obj.boardId).toBe(1);
|
|
866
|
+
} finally {
|
|
867
|
+
server.stop();
|
|
868
|
+
}
|
|
869
|
+
});
|
|
870
|
+
|
|
871
|
+
test("--client-name is sent as X-TaskManager-Client-Name on API requests", async () => {
|
|
872
|
+
const server = Bun.serve({
|
|
873
|
+
port: 0,
|
|
874
|
+
fetch(req) {
|
|
875
|
+
const u = new URL(req.url);
|
|
876
|
+
if (u.pathname === "/api/boards" && req.method === "GET") {
|
|
877
|
+
const name = req.headers.get(TASK_MANAGER_CLIENT_NAME_HEADER);
|
|
878
|
+
expect(name).toBe("Agent");
|
|
879
|
+
return new Response(
|
|
880
|
+
JSON.stringify({
|
|
881
|
+
items: [],
|
|
882
|
+
total: 0,
|
|
883
|
+
limit: 0,
|
|
884
|
+
offset: 0,
|
|
885
|
+
}),
|
|
886
|
+
{
|
|
887
|
+
status: 200,
|
|
888
|
+
headers: { "content-type": "application/json" },
|
|
889
|
+
},
|
|
890
|
+
);
|
|
891
|
+
}
|
|
892
|
+
return new Response("not found", { status: 404 });
|
|
893
|
+
},
|
|
894
|
+
});
|
|
895
|
+
|
|
896
|
+
try {
|
|
897
|
+
const proc = spawnHirotm(
|
|
898
|
+
withPort(server.port, ["--client-name", "Agent", "boards", "list"]),
|
|
899
|
+
);
|
|
900
|
+
const [stdout, stderr] = await Promise.all([
|
|
901
|
+
readSubprocessStream(proc.stdout),
|
|
902
|
+
readSubprocessStream(proc.stderr),
|
|
903
|
+
]);
|
|
904
|
+
const code = await proc.exited;
|
|
905
|
+
|
|
906
|
+
expect(code).toBe(0);
|
|
907
|
+
expect(stderr.trim()).toBe("");
|
|
908
|
+
expect(stdout.trim()).toBe("");
|
|
909
|
+
} finally {
|
|
910
|
+
server.stop();
|
|
911
|
+
}
|
|
912
|
+
});
|
|
913
|
+
|
|
914
|
+
test("boards list --format human + empty stub → stdout contains No rows.", async () => {
|
|
915
|
+
const server = Bun.serve({
|
|
916
|
+
port: 0,
|
|
917
|
+
fetch(req) {
|
|
918
|
+
const u = new URL(req.url);
|
|
919
|
+
if (u.pathname === "/api/boards" && req.method === "GET") {
|
|
920
|
+
return new Response(
|
|
921
|
+
JSON.stringify({
|
|
922
|
+
items: [],
|
|
923
|
+
total: 0,
|
|
924
|
+
limit: 0,
|
|
925
|
+
offset: 0,
|
|
926
|
+
}),
|
|
927
|
+
{
|
|
928
|
+
status: 200,
|
|
929
|
+
headers: { "content-type": "application/json" },
|
|
930
|
+
},
|
|
931
|
+
);
|
|
932
|
+
}
|
|
933
|
+
return new Response("not found", { status: 404 });
|
|
934
|
+
},
|
|
935
|
+
});
|
|
936
|
+
|
|
937
|
+
try {
|
|
938
|
+
const proc = spawnHirotm(
|
|
939
|
+
withPort(server.port, ["boards", "list", "--format", "human"]),
|
|
940
|
+
);
|
|
941
|
+
const [stdout, stderr] = await Promise.all([
|
|
942
|
+
readSubprocessStream(proc.stdout),
|
|
943
|
+
readSubprocessStream(proc.stderr),
|
|
944
|
+
]);
|
|
945
|
+
const code = await proc.exited;
|
|
946
|
+
|
|
947
|
+
expect(code).toBe(0);
|
|
948
|
+
expect(stderr.trim()).toBe("");
|
|
949
|
+
expect(stdout).toContain("No rows.");
|
|
950
|
+
} finally {
|
|
951
|
+
server.stop();
|
|
952
|
+
}
|
|
953
|
+
});
|
|
954
|
+
});
|