codegen: add examples.yaml and simplify ArgSpec (PRINFRA-121) - #11
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
PRINFRA-121 CLI M1: OpenAPI codegen pipeline
Build the code generation pipeline that reads Scope
Mapping Rules
Acceptance Criteria
|
24ee2cb to
ee89581
Compare
b1e332c to
3ddc75a
Compare
15e4901 to
cae4380
Compare
3ddc75a to
1c9bc16
Compare
cae4380 to
9e4f567
Compare
0a899f1 to
7c07ef5
Compare
9e4f567 to
89d91d3
Compare
7c07ef5 to
aea9abd
Compare
89d91d3 to
1a1881e
Compare
aea9abd to
7eff426
Compare
1a1881e to
545c7f1
Compare
7eff426 to
f9090ec
Compare
545c7f1 to
85397ad
Compare
f9090ec to
38cc346
Compare
85397ad to
0c9a4f9
Compare
2810bf7 to
b240371
Compare
5a3e6ad to
b08f6d2
Compare
b08f6d2 to
6e8db51
Compare
| # Mandatory — make generate fails if any endpoint is missing. | ||
| # Format: "METHOD /path" → list of example commands. | ||
|
|
||
| "GET /v3/videos": |
There was a problem hiding this comment.
I will work on proper examples once we have more of the CLI complete. This is just for basic functionality.
There was a problem hiding this comment.
instead of one massive examples.yaml can we split it by command/request or something? alongside the command code? basicaly a cleaner structure and will keep files smaller
There was a problem hiding this comment.
Right now, these are manual examples. Is this suggestion that we split these manual examples into a per-command file? Like
codegen/examples/video.yaml`` ``codegen/examples/avatar.yaml`` ``codegen/examples/voice.yaml
These don't sit beside the command code until the codegen pipeline (PR #14) runs.
We can also auto-generate them as well and place it in the command files directly but we need to come up with an algorithm to determine appropriate/representative examples. This seemed a bit too complex so I skipped it for now.
6e8db51 to
ef458e1
Compare
Hand-curated usage examples for every generated command. Mandatory — make generate fails if any endpoint is missing. Examples help both humans (copy-paste) and agents (pattern-matching working commands). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ef458e1 to
89e818b
Compare
Merge activity
|

Description
Adds curated examples, simplifies the type system, and introduces dependencies for the codegen pipeline.
examples.yaml — hand-written CLI usage examples for every generated command. Mandatory —
make generatefails if any endpoint is missing. Examples help both humans (copy-paste) and agents (pattern-matching working commands). This is the only CLI-side configuration file — naming and visibility are controlled in the OpenAPI spec.ArgSpec simplified — positional arguments now only come from URL path parameters. Body fields and file paths are always named flags (
--flag), never positional. This is an agent-first design: named flags are self-documenting.FlagSpec extended —
Sourcefield gains a third value"file"(alongside"query"and"body"). Flags withSource: "file"route toinv.FilePathfor multipart upload (e.g.,--file ./video.mp4). BuildInvocation handles the routing.command.Groups type — named type
map[string][]*Specwith aSortedNames()helper. Used as the return type for the grouper and input to the renderer. Readscommand.Groupsinstead of raw map type everywhere.Libraries added:
jinzhu/inflection— singularize group names from OpenAPI tagskin-openapi— parse OpenAPI specs (used by the grouper in a later PR)iancoleman/strcase— kebab-case and PascalCase conversionTesting
Existing tests updated: ArgSpec Target field removed, body/file positional arg tests removed. All remaining tests pass.
Files
internal/command/spec.go— ArgSpec simplified, FlagSpec Source:"file" added, Groups type added, BuildInvocation updatedinternal/command/spec_test.go— updated for simplified ArgSpeccmd/heygen/builder_test.go— updated for simplified ArgSpeccodegen/examples.go— Examples type, YAML loadingcodegen/examples.yaml— curated examples for all v3 endpointscodegen/testdata/test_examples.yaml— test fixturego.mod/go.sum— dependencies added