Commit a6bd8d0
fix: emit [] for empty JSON; correct workouts category prime note (#11)
Two gaps the new 'prime' subcommand surfaced when its examples and the
output-formats contract were exercised end-to-end:
- Every subcommand's --format json was emitting 'null' on empty windows
(the underlying slice was nil, which encoding/json marshals as null).
The prime promises "empty result ... JSON prints '[]'", and 'null'
also breaks the prime's sleep-efficiency jq pipeline. Special-case
nil slices in printJSON via reflect so all five subcommands emit
'[]' on empty.
- The workouts gotcha implied JSON carried both a string 'category' and
a numeric 'category_code', but JSON only carries the integer
'category' (the string mapping happens in markdown/CSV). Rewrite the
gotcha to describe actual behavior and list the common code values
inline so an LLM can filter by 'category == 16' without round-tripping
through markdown.
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>1 parent b6bb49e commit a6bd8d0
2 files changed
Lines changed: 12 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | | - | |
139 | | - | |
140 | | - | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
141 | 143 | | |
142 | 144 | | |
143 | 145 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
108 | 109 | | |
109 | 110 | | |
110 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
111 | 118 | | |
112 | 119 | | |
113 | 120 | | |
| |||
0 commit comments