Template cmd: Fetch custom template from API#134
Conversation
qboileau
left a comment
There was a problem hiding this comment.
Could you also update documentation and README
Only Topic and Connector kinds expose the `*-template` endpoint. Fail fast with a clear message instead of hitting the API and surfacing a confusing JSON parse error for unsupported kinds. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Note the new `template <kind> <name>` form and the Topic/Connector restriction so users know when the API is reachable. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Decouples the template-to-YAML rendering from the cmd layer so it can be reused. Signature takes kindName/apiVersion as primitives to keep printutils free of pkg/schema (avoids a printutils → schema → utils → resource → printutils cycle). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Would it not make sense here to just do an api call to fetch the templates and then let the user input which template they'd want to use? |
this interactive mode look nice but it's not usable inside scripts or by AI agents. We need a way to get a specific template from one cli call. And maybe a way to list existing templates too. |
this is a fair call out and I wasn't thinking about primary use case for our CLI which I suppose is working from within a CI/CD pipeline, maybe a waste of effort even if it feels cool |
|
@qboileau We should keep the current behavior as it is: if no parameter, return the default template. But this doesn't mean we can't support interactive mode. What I propose is: |
|
would be nice to also get the list of existing templates to automate |
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
Hooks the CLI into Console's new template API (
/public/console/v2/{kind}-template) forTopicandConnectorkinds. Other kinds keep returning the built-in offline example.--listand--interactiveare mutually exclusive with each other and with a positional template name.Test plan
go test ./...make buildconduktor template Topic <name>against a Console with templates configured returns the expected YAMLconduktor template Topic -ilists server-side templates and applies the chosen oneconduktor template Topic -i <name>errors withCannot use --interactive with a template nameconduktor template Topic -lprints template names one per line on stdoutconduktor template Topic -l <name>errors withCannot use --list with a template nameconduktor template Topic -l -ierrors withCannot use --list with --interactiveconduktor template TopicTemplate <name>(and other unsupported kinds) returns the cleardoes not support resource templateserror instead of the JSON parse errorconduktor template Topic(no name) still prints the built-in offline example🤖 Generated with Claude Code