Skip to content

gdx/godaddy CLI support - #4

Merged
jgowdy-godaddy merged 8 commits into
mainfrom
gdx-godaddy-features
May 27, 2026
Merged

jgowdy-godaddy merged 8 commits into
mainfrom
gdx-godaddy-features

Conversation

@jpage-godaddy

Copy link
Copy Markdown
Collaborator
  • Add support for streaming JSON
  • Add next actions support
  • Add guide command
  • Add PKCE OAuth provider
  • Allow auditor/authz/activity providers to be injected through builder
  • Add support for binary HTTP responses

- Add support for streaming JSON
- Add next actions support
- Add guide command
- Add PKCE OAuth provider
- Allow auditor/authz/activity providers to be injected through builder
- Add support for binary HTTP responses

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends cli-engine to better support agent-first CLIs by adding NDJSON streaming command execution, “next action” suggestions in envelopes, a built-in guide command, a feature-gated PKCE OAuth provider, injectable middleware providers (authz/audit/activity), and binary HTTP response handling.

Changes:

  • Add streaming command support (RuntimeCommandSpec::new_streaming) with NDJSON event writing to stdout.
  • Add next_actions to output envelopes + APIs to attach them from command results.
  • Add feature-gated PkceAuthProvider (OAuth2 Authorization Code + PKCE) with keychain storage and refresh.

Reviewed changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/transport/client.rs Adds get_bytes for downloading raw/binary HTTP responses.
src/output/mod.rs Re-exports NextAction and NextActionParam for public consumption.
src/output/envelope.rs Adds next_actions to envelopes and defines NextAction/NextActionParam.
src/middleware.rs Plumbs next_actions from CommandResultMetadata into the rendered envelope.
src/lib.rs Exposes new streaming and next-actions types in the public API surface.
src/command.rs Introduces streaming command handler types, StreamSender, and next-actions metadata on results.
src/cli.rs Adds guide subcommand wiring, injectable middleware deps, root-name matching, and streaming execution path.
src/auth/pkce.rs Adds a new PKCE auth provider implementation (feature-gated).
src/auth/mod.rs Exposes auth::pkce behind the pkce-auth Cargo feature.
README.md Documents the pkce-auth feature.
docs/design.md Updates design docs for auth layout, streaming commands, and next_actions in envelopes.
docs/concepts.md Documents streaming commands, PKCE provider, and next_actions.
docs/auth.md Adds PKCE provider documentation and usage notes.
Cargo.toml Adds optional deps + pkce-auth feature and enables Tokio io-std for stdout streaming.
Cargo.lock Locks new transitive deps introduced by PKCE feature and stdout streaming support.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/auth/pkce.rs Resolved
Comment thread src/auth/pkce.rs Resolved
Comment thread src/cli.rs Resolved
Comment thread docs/concepts.md Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 15 changed files in this pull request and generated 8 comments.

Comment thread src/auth/pkce.rs Resolved
Comment thread docs/concepts.md Resolved
Comment thread src/middleware.rs Resolved
Comment thread src/cli.rs Resolved
Comment thread src/cli.rs Resolved
Comment thread src/cli.rs Resolved
Comment thread docs/concepts.md Resolved
Comment thread src/output/envelope.rs Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 16 changed files in this pull request and generated 4 comments.

Comment thread src/cli.rs
Comment on lines +1792 to +1799
let writer = tokio::spawn(async move {
let mut stdout = tokio::io::stdout();
while let Some(event) = rx.recv().await {
let Ok(line) = serde_json::to_string(&event) else {
continue;
};
if stdout.write_all(line.as_bytes()).await.is_err()
|| stdout.write_all(b"\n").await.is_err()
Comment thread src/cli.rs
Comment on lines +1829 to +1835
match output {
Ok(out) => Ok(out.into()),
Err(err) => Ok(CliRunOutput {
exit_code: exit_code_for_error(&err),
rendered: render_cli_error(middleware, &err, middleware.app_id.as_str()).rendered,
}),
}
Comment thread src/auth/pkce.rs
Comment on lines +317 to +318
parse_token_response(response, "").await
}
Comment thread docs/concepts.md
Comment on lines +359 to +362
Command handlers can attach a list of follow-on command suggestions to any result using
`CommandResult::with_next_actions`. The framework includes these suggestions in every output
envelope under the `next_actions` key, regardless of output format:

…, rand upgrade

- Suppress trailing null-data envelope on successful streaming commands
  so NDJSON consumers see only event lines
- Carry forward existing refresh token when OAuth server omits it from
  the refresh response, preventing unnecessary browser re-logins
- Replace hand-rolled extract_query_param/url_decode with
  url::form_urlencoded::parse, fixing the ?-operator short-circuit on
  malformed query pairs and broken multi-byte UTF-8 decoding
- Upgrade rand from 0.8 to 0.9, eliminating duplicate dependency tree
- Add retry loop in wait_for_callback so stray connections don't
  consume the single OAuth callback accept
- Add streaming success test and extract_query_param unit tests
- Fix docs: scope next_actions to JSON/TOON, document streaming stdout
  bypass
- Read errors from stray connections now continue the accept loop
  instead of aborting the entire PKCE flow
- Valid state with no authorization code (user denied access) returns
  an immediate error instead of looping until timeout
…rding

- Add zeroize dependency behind pkce-auth feature
- StoredToken derives ZeroizeOnDrop so access_token and refresh_token
  are cleared from memory when the struct drops
- Manual Debug impl redacts token fields to prevent accidental logging
- Fix design.md streaming docs to describe backpressure instead of
  claiming deadlock avoidance
@jgowdy-godaddy
jgowdy-godaddy merged commit a5501d7 into main May 27, 2026
1 check passed
@jpage-godaddy
jpage-godaddy deleted the gdx-godaddy-features branch May 27, 2026 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants