codegen: add file generator, templates, and CLI entry point (PRINFRA-121) - #14
Merged
somanshreddy merged 2 commits intoApr 1, 2026
Conversation
Collaborator
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
This was referenced Mar 31, 2026
somanshreddy
force-pushed
the
03-31-codegen_add_renderer_templates_and_cli_entry_point
branch
from
March 31, 2026 18:29
5a6a098 to
a8b1753
Compare
somanshreddy
force-pushed
the
03-31-codegen_add_endpoint_grouper_and_subcommand_naming_algorithm
branch
from
March 31, 2026 18:29
803d72a to
1ac674a
Compare
PRINFRA-121 CLI M1: OpenAPI codegen pipeline
Build the code generation pipeline that reads Scope
Mapping Rules
Acceptance Criteria
|
somanshreddy
force-pushed
the
03-31-codegen_add_endpoint_grouper_and_subcommand_naming_algorithm
branch
from
March 31, 2026 19:41
1ac674a to
612f394
Compare
somanshreddy
force-pushed
the
03-31-codegen_add_renderer_templates_and_cli_entry_point
branch
2 times, most recently
from
March 31, 2026 20:08
0b9e0be to
2f5c57f
Compare
somanshreddy
force-pushed
the
03-31-codegen_add_endpoint_grouper_and_subcommand_naming_algorithm
branch
from
March 31, 2026 20:08
612f394 to
16bd8ed
Compare
somanshreddy
force-pushed
the
03-31-codegen_add_renderer_templates_and_cli_entry_point
branch
from
March 31, 2026 20:59
2f5c57f to
b3208f9
Compare
somanshreddy
force-pushed
the
03-31-codegen_add_endpoint_grouper_and_subcommand_naming_algorithm
branch
2 times, most recently
from
March 31, 2026 21:06
b29c389 to
f03c006
Compare
somanshreddy
force-pushed
the
03-31-codegen_add_renderer_templates_and_cli_entry_point
branch
from
March 31, 2026 21:06
b3208f9 to
16055f5
Compare
somanshreddy
force-pushed
the
03-31-codegen_add_endpoint_grouper_and_subcommand_naming_algorithm
branch
from
March 31, 2026 21:25
f03c006 to
cfec8dd
Compare
somanshreddy
force-pushed
the
03-31-codegen_add_renderer_templates_and_cli_entry_point
branch
from
March 31, 2026 21:25
16055f5 to
7f8ff00
Compare
somanshreddy
force-pushed
the
03-31-codegen_add_endpoint_grouper_and_subcommand_naming_algorithm
branch
from
March 31, 2026 21:31
cfec8dd to
868657e
Compare
somanshreddy
force-pushed
the
03-31-codegen_add_renderer_templates_and_cli_entry_point
branch
2 times, most recently
from
March 31, 2026 21:41
8b6e2ae to
5e10411
Compare
somanshreddy
force-pushed
the
03-31-codegen_add_endpoint_grouper_and_subcommand_naming_algorithm
branch
from
March 31, 2026 21:41
868657e to
2c83785
Compare
somanshreddy
force-pushed
the
03-31-codegen_add_renderer_templates_and_cli_entry_point
branch
from
March 31, 2026 21:55
5e10411 to
a56bcde
Compare
somanshreddy
force-pushed
the
03-31-codegen_add_endpoint_grouper_and_subcommand_naming_algorithm
branch
from
March 31, 2026 21:58
21f7dfa to
c337bb8
Compare
somanshreddy
force-pushed
the
03-31-codegen_add_renderer_templates_and_cli_entry_point
branch
2 times, most recently
from
March 31, 2026 22:02
89b530d to
30040af
Compare
somanshreddy
force-pushed
the
03-31-codegen_add_endpoint_grouper_and_subcommand_naming_algorithm
branch
2 times, most recently
from
March 31, 2026 22:04
5a7da12 to
a4d0678
Compare
somanshreddy
force-pushed
the
03-31-codegen_add_renderer_templates_and_cli_entry_point
branch
from
April 1, 2026 07:23
5e0e76b to
1918c31
Compare
somanshreddy
force-pushed
the
graphite-base/14
branch
from
April 1, 2026 07:23
acbd3f9 to
a61cb00
Compare
somanshreddy
changed the base branch from
graphite-base/14
to
03-31-codegen_add_endpoint_grouper_and_subcommand_naming_algorithm
April 1, 2026 07:23
somanshreddy
force-pushed
the
03-31-codegen_add_renderer_templates_and_cli_entry_point
branch
from
April 1, 2026 07:26
1918c31 to
8e8040e
Compare
somanshreddy
force-pushed
the
03-31-codegen_add_endpoint_grouper_and_subcommand_naming_algorithm
branch
from
April 1, 2026 07:26
a61cb00 to
0a34434
Compare
somanshreddy
force-pushed
the
03-31-codegen_add_renderer_templates_and_cli_entry_point
branch
from
April 1, 2026 07:41
8e8040e to
ff74333
Compare
somanshreddy
force-pushed
the
03-31-codegen_add_endpoint_grouper_and_subcommand_naming_algorithm
branch
from
April 1, 2026 07:41
0a34434 to
23a6763
Compare
somanshreddy
changed the base branch from
03-31-codegen_add_endpoint_grouper_and_subcommand_naming_algorithm
to
graphite-base/14
April 1, 2026 07:42
somanshreddy
force-pushed
the
graphite-base/14
branch
from
April 1, 2026 08:14
23a6763 to
f6691d3
Compare
somanshreddy
force-pushed
the
03-31-codegen_add_renderer_templates_and_cli_entry_point
branch
from
April 1, 2026 08:14
ff74333 to
cb080cf
Compare
somanshreddy
changed the base branch from
graphite-base/14
to
03-31-codegen_add_endpoint_grouper_and_subcommand_naming_algorithm
April 1, 2026 08:14
somanshreddy
force-pushed
the
03-31-codegen_add_renderer_templates_and_cli_entry_point
branch
from
April 1, 2026 16:38
cb080cf to
c0cc301
Compare
somanshreddy
marked this pull request as ready for review
April 1, 2026 16:49
somanshreddy
force-pushed
the
03-31-codegen_add_renderer_templates_and_cli_entry_point
branch
from
April 1, 2026 17:01
c0cc301 to
bc62a76
Compare
somanshreddy
force-pushed
the
03-31-codegen_add_endpoint_grouper_and_subcommand_naming_algorithm
branch
from
April 1, 2026 17:02
f6691d3 to
57dd9f1
Compare
jrusso1020
approved these changes
Apr 1, 2026
Collaborator
Author
Merge activity
|
somanshreddy
changed the base branch from
03-31-codegen_add_endpoint_grouper_and_subcommand_naming_algorithm
to
graphite-base/14
April 1, 2026 19:18
Go text/templates produce one file per command group + registry.go. Renderer executes templates and runs gofmt. CLI entry point accepts -spec, -out, -overrides flags and orchestrates the pipeline. make generate target added. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Renderer executes Go text/templates to produce command.Spec struct literals. CLI entry point orchestrates the full pipeline. make generate target clears gen/ and runs codegen. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
somanshreddy
force-pushed
the
03-31-codegen_add_renderer_templates_and_cli_entry_point
branch
from
April 1, 2026 19:20
bc62a76 to
99252ba
Compare
somanshreddy
deleted the
03-31-codegen_add_renderer_templates_and_cli_entry_point
branch
April 1, 2026 19:22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
The output stage of the codegen pipeline. Takes the grouped command specs from the previous PR and writes them as Go source files.
What it produces: For each command group, a
.gofile with exportedcommand.Specvariables. Plus a registry file that maps group names to their specs.Example — given this grouper output:
The generator writes
gen/video.go:And
gen/registry.go:How it works:
Generate()ingenerate.goiterates groups in sorted order, executes Go text/templates, and writes gofmt'd outputcommand.go.tmplproduces one file per group with all specs as exported vars. Variable names are PascalCase from group + command name (e.g.,VideoList,WebhookEndpointsCreate)registry.go.tmplproduces theGroupsmap that the runtime builder reads at startupstrcase.ToCamelfor PascalCase,intPtrLiteralfor min/max pointers,stringSlicefor enum arraysCLI entry point —
go run ./codegen/ -spec <path> -out gen/ -examples codegen/examples.yamlorchestrates the full pipeline: load examples → load spec → group endpoints → validate examples → generate files. Fails if any command is missing examples.make generatetarget —make generate SPEC=path/to/external-api.jsonclears gen/, runs codegen, formats output.Testing
Tested via golden file tests in the next PR.
Files
codegen/generate.go— Generate function, template loading, gofmt, template helperscodegen/main.go— CLI entry point with -spec, -out, -examples flagscodegen/templates/command.go.tmpl— per-group command file templatecodegen/templates/registry.go.tmpl— registry map templateMakefile— added generate target