Commit bc06233
committed
refactor: converge command pipelines onto a typed metadata model + catalog
Extract the metadata logic duplicated across schema/cmdutil/registry into
two new single-purpose modules and thin the command layer to adapters over
them — net -924 lines of behavior-preserving moves and de-duplication, plus
a few agent-facing additions and fixes found along the way.
Moved / de-duplicated
- New internal/meta: typed model over meta_data.json. Absorbs field-value
normalization and the access-token<->identity bijection previously split
across schema.convertAccessTokens, cmdutil.AccessTokensToIdentities and
registry.IdentityToAccessToken — three duplicate token interpreters
collapsed into one (cmdutil identity/risk/fileupload now defer to it).
- New internal/apicatalog: navigation over the typed model. Path resolution
moved here (internal/schema/path.go -> internal/apicatalog/path.go); the
resolve<->walk round-trip is closed for nested resources.
- internal/schema is now render-only — dropped its cmdutil and registry
imports; risk-level constants moved to the new internal/core/risk.go.
- internal/registry keeps only source adapter + scope policy; its scope
collectors and cmd/service registration now walk the catalog instead of
hand-rolling traversal. cmd/service param-flag handling extracted into
paramflags.go/flaggroups.go and no longer imports schema.
New (agent-facing)
- Typed flags for raw API commands; grouped --help by input kind with inline
enum value=meaning and method affordance in Long help; envelope carries
enumDescriptions (parallel to enum) for per-value meanings.
Fixed (found during the convergence)
- meta.Option.Value is tolerant `any` and already-typed literals normalize to
the canonical type, so one bad option value can't blank the whole catalog
and numeric enums sort correctly.
- nested-resource descent extended to completion; auth-hint resolves the
nested catalog path instead of a hard-coded depth.
Removed
- The byte-for-byte envelope golden: it snapshotted metadata fetched at build
time, baking real API data into git with no way to desensitize (CI
regenerates from fresh real data and compares exactly). Assembler logic is
covered on synthetic data instead.
Behavior preserved: public command tree/paths, request planning, pagination,
dry-run, confirmation. Typed enum flags are documentation, not hard-validated.
Change-Id: I2d6c5127a9e76955fb467a45557ae155299a26601 parent 99e314f commit bc06233
50 files changed
Lines changed: 3788 additions & 2864 deletions
File tree
- cmd
- auth
- schema
- service
- internal
- apicatalog
- cmdutil
- core
- meta
- registry
- schema
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
96 | | - | |
| 95 | + | |
97 | 96 | | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
105 | 100 | | |
106 | 101 | | |
107 | 102 | | |
| |||
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
118 | 119 | | |
119 | 120 | | |
120 | 121 | | |
121 | | - | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
122 | 128 | | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
| 129 | + | |
128 | 130 | | |
129 | 131 | | |
130 | | - | |
| 132 | + | |
| 133 | + | |
131 | 134 | | |
132 | 135 | | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
| 136 | + | |
| 137 | + | |
145 | 138 | | |
146 | 139 | | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
0 commit comments