GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: add JSON output to coder ai-gateway keys create by nickvigilante · Pull Request #30139 · coder/coder

Conversation

@nickvigilante

@nickvigilante nickvigilante commented Sep 29, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Uses the cliui output helpers from #30508.

coder ai-gateway keys create printed the new key's secret as prose, while keys list supports -o json.

It now accepts -o text|json.
JSON is the existing CreateAIGatewayKeyResponse: ID, name, key prefix, created at, and the secret.

Behavior change: Additive.
Default text output is unchanged.

Closes CLI-18

CI flake note

test-go-pg (ubuntu-latest) failed in run 37823528159 on TestChatTurnStopsAtStepLimit/Default in coderd/x/chatd (context deadline exceeded).
This PR doesn't touch coderd/x/chatd, so the failed job was re-run.

This PR was generated by Coder Agents on behalf of @nickvigilante.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@linear-code

linear-code Bot commented Sep 29, 2026

Copy link
Copy Markdown

CLI-18

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot assigned nickvigilante Sep 30, 2026
@nickvigilante
nickvigilante marked this pull request as ready for review September 30, 2026 00:35
@nickvigilante
nickvigilante requested a review from matifali September 30, 2026 00:35
@nickvigilante nickvigilante added the cli Area: CLI label Oct 5, 2026
@nickvigilante
nickvigilante requested a review from jeremyruppel October 6, 2026 14:23
@jeremyruppel jeremyruppel mentioned this pull request Oct 7, 2026
feat: add JSON output to coder provisioner keys create #30152
Open
@nickvigilante nickvigilante mentioned this pull request Oct 8, 2026
feat(cli/cliui): add TextFormatFunc and OutputFormatter.WriteLine helpers #30508
Merged
@nickvigilante
nickvigilante force-pushed the vigilante/cli-18-coder-ai-gateway-keys-create-add-o-output-with-json branch from fef65c0 to c2d0597 Compare October 8, 2026 15:45
@nickvigilante
nickvigilante changed the base branch from main to vigilante/cli-56-cliui-add-shared-text-formatter-and-write-helpers-for-o October 8, 2026 15:45
@nickvigilante
nickvigilante force-pushed the vigilante/cli-18-coder-ai-gateway-keys-create-add-o-output-with-json branch from c2d0597 to 06f20e8 Compare October 8, 2026 18:20
nickvigilante added a commit that referenced this pull request Oct 8, 2026
@nickvigilante
feat(cli/cliui): add TextFormatFunc and OutputFormatter.WriteLine hel…
0efb574
…pers (#30508)

Adds two small helpers to `cli/cliui/output.go` so commands that add
`-o/--output` don't repeat the same boilerplate, as suggested in
#30152 (comment) by
@jeremyruppel.

- `TextFormatFunc[T]` wraps `ChangeFormatterData(TextFormat(), ...)`
with the type assertion and "expected X, got Y" error, so a command only
supplies its render function.
- `(*OutputFormatter).WriteLine` formats data and writes it to an
`io.Writer` with a trailing newline, replacing the `Format` + `Fprintln`
block.

No existing callers change in this PR. These PRs are stacked on it and
use the helpers:

- #30135 `coder tokens create`
- #30139 `coder ai-gateway keys create`
- #30145 `coder organizations members edit-roles`
- #30152 `coder provisioner keys create`

Migrating the existing callers on `main` (for example
`cli/organization.go`, `enterprise/cli/workspaceproxy.go`) is left for a
follow-up, since some of them print with `Fprint` rather than `Fprintln`
and need care to keep output identical.

Refs CLI-56

<details>
<summary>Decision log</summary>

- A global `-o` flag on the root command was ruled out because `coder
config-ssh` already uses `-o` for `--ssh-option`.
- The "one-time secret plus metadata" response structs in #30135 and
#30152 stay local to each command, since they embed different SDK types
and a shared helper would save little.
- `WriteLine` uses `Fprintln` to match the four stacked PRs and most
existing callers.
It was renamed from `Write` during review so the trailing newline is
visible at call sites and the method is not confused with `io.Writer`.

</details>

> [!NOTE]
> This PR was generated by Coder Agents on behalf of @nickvigilante.
Base automatically changed from vigilante/cli-56-cliui-add-shared-text-formatter-and-write-helpers-for-o to main October 8, 2026 19:41
@jeremyruppel
jeremyruppel requested a review from untra October 16, 2026 18:08
nickvigilante added 3 commits October 16, 2026 18:14
@nickvigilante
feat: add JSON output to coder ai-gateway keys create
ceaa309
`coder ai-gateway keys create` printed the new key's secret as prose,
while `keys list` supports `-o json`.

Linear: CLI-18
@nickvigilante
refactor: use cliui.TextFormatFunc and OutputFormatter.Write
4c07841
@nickvigilante
refactor: use cliui.OutputFormatter.WriteLine
21698c3
@nickvigilante
nickvigilante force-pushed the vigilante/cli-18-coder-ai-gateway-keys-create-add-o-output-with-json branch from 06f20e8 to 21698c3 Compare October 16, 2026 18:35
untra
untra approved these changes Oct 16, 2026
View reviewed changes
@nickvigilante
nickvigilante merged commit 93205d9 into main Oct 16, 2026
36 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@nickvigilante
nickvigilante deleted the vigilante/cli-18-coder-ai-gateway-keys-create-add-o-output-with-json branch October 16, 2026 20:01
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@untra untra untra approved these changes
@matifali matifali Awaiting requested review from matifali
@jeremyruppel jeremyruppel Awaiting requested review from jeremyruppel

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@nickvigilante nickvigilante

Labels

cli Area: CLI

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@nickvigilante @untra
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.