Repository navigation
Commit 9074367
committed
refactor(cli): derive the common flag readers from the common-field table
commonInputFromFlags and selectionOptionsFromFlags in
src/commands/cli-grammar/common.ts each hand-restated the common input
key list as object literals. A key added to the common-field table in
commands/common-input-fields.ts (the schema/read/clientKey/audience
source of truth) had no structural link to either flag reader, so
keeping a new key flowing through the CLI depended on remembering to
touch both literals by hand (the failure mode #1304/#1305 hit for
--no-record).
Add a flagKey/flagIn column to CommonInputFieldSpec: flagKey names the
CliFlags property when its spelling differs from the row (only
deviceTarget, which reads flags.target), and flagIn lists which of the
two flag-derived projections ('input', 'selection') the row joins.
commonFlagProjection(flags, projection) walks the table once and
reuses the existing clientKey renaming (deviceTarget -> target) for
the 'selection' projection, matching commonToClientOptions's existing
convention. commonInputFromFlags and selectionOptionsFromFlags become
thin wrappers over that projection; COMMON_COMMAND_SUPPORTED_FLAG_KEYS
in flag-groups.ts is untouched, per its own documented reason for
staying separate.
Added src/commands/cli-grammar/common.test.ts as a characterization
test before touching the implementation: it feeds a CliFlags fixture
with every common flag set, and one with none set, and asserts the
literal objects both functions return. It passed unmodified against
both the old hand-written implementation and the new table-derived
one, proving the projections are byte-identical.
Validation: pnpm vitest run --project unit-core src/commands (575
tests, all green); pnpm check:quick (lint + typecheck) clean;
pnpm check:layering clean (cli-grammar/common.ts importing
commands/common-input-fields.ts is an intra-commands-zone import, not
core/daemon reaching into commands, so R2 commands-floor does not
apply).1 parent fa06c8c commit 9074367
3 files changed
Lines changed: 162 additions & 56 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
59 | 76 | | |
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 | | - | |
| 77 | + | |
87 | 78 | | |
88 | 79 | | |
89 | 80 | | |
| |||
101 | 92 | | |
102 | 93 | | |
103 | 94 | | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
111 | 102 | | |
112 | 103 | | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
| 104 | + | |
123 | 105 | | |
124 | 106 | | |
125 | 107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| |||
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
36 | 45 | | |
37 | 46 | | |
38 | | - | |
39 | | - | |
40 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
41 | 51 | | |
42 | 52 | | |
43 | 53 | | |
| |||
48 | 58 | | |
49 | 59 | | |
50 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
51 | 65 | | |
52 | 66 | | |
53 | 67 | | |
| |||
64 | 78 | | |
65 | 79 | | |
66 | 80 | | |
| 81 | + | |
67 | 82 | | |
68 | 83 | | |
69 | 84 | | |
| |||
72 | 87 | | |
73 | 88 | | |
74 | 89 | | |
| 90 | + | |
75 | 91 | | |
76 | 92 | | |
77 | 93 | | |
| |||
81 | 97 | | |
82 | 98 | | |
83 | 99 | | |
| 100 | + | |
| 101 | + | |
84 | 102 | | |
85 | 103 | | |
86 | 104 | | |
| |||
97 | 115 | | |
98 | 116 | | |
99 | 117 | | |
| 118 | + | |
100 | 119 | | |
101 | 120 | | |
102 | 121 | | |
| |||
105 | 124 | | |
106 | 125 | | |
107 | 126 | | |
| 127 | + | |
108 | 128 | | |
109 | 129 | | |
110 | 130 | | |
111 | 131 | | |
112 | 132 | | |
113 | 133 | | |
114 | 134 | | |
| 135 | + | |
115 | 136 | | |
116 | 137 | | |
117 | 138 | | |
| |||
120 | 141 | | |
121 | 142 | | |
122 | 143 | | |
| 144 | + | |
123 | 145 | | |
124 | 146 | | |
125 | 147 | | |
| |||
128 | 150 | | |
129 | 151 | | |
130 | 152 | | |
| 153 | + | |
131 | 154 | | |
132 | 155 | | |
133 | 156 | | |
| |||
136 | 159 | | |
137 | 160 | | |
138 | 161 | | |
| 162 | + | |
139 | 163 | | |
140 | 164 | | |
141 | 165 | | |
| |||
144 | 168 | | |
145 | 169 | | |
146 | 170 | | |
| 171 | + | |
147 | 172 | | |
148 | 173 | | |
149 | 174 | | |
150 | 175 | | |
151 | 176 | | |
152 | 177 | | |
153 | 178 | | |
| 179 | + | |
154 | 180 | | |
155 | 181 | | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
160 | 188 | | |
| 189 | + | |
161 | 190 | | |
162 | 191 | | |
163 | 192 | | |
| |||
227 | 256 | | |
228 | 257 | | |
229 | 258 | | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
235 | 263 | | |
236 | 264 | | |
237 | 265 | | |
238 | 266 | | |
239 | 267 | | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
240 | 289 | | |
241 | 290 | | |
242 | 291 | | |
| |||
0 commit comments