Skip to content

feat: surface next_actions as a "Next steps" footer in human output#36

Merged
jpage-godaddy merged 2 commits into
mainfrom
cli-engine-human-next-steps
Jul 1, 2026
Merged

feat: surface next_actions as a "Next steps" footer in human output#36
jpage-godaddy merged 2 commits into
mainfrom
cli-engine-human-next-steps

Conversation

@jpage-godaddy

Copy link
Copy Markdown
Collaborator

What

next_actions (the suggested follow-up commands an Envelope can carry) were
only rendered in --output json/toon. The human/terminal renderer
(render_human_with_view) ignored the field entirely, so commands that suggest
next steps gave the user no on-screen guidance.

This adds a "Next steps:" footer to human output, built from the envelope's
next_actions:

domain: example.com
price:  11.99

Next steps:
  domain purchase --quote-token <token> --agree --confirm
      Register at the quoted price (within ~10 minutes)

Details

  • render_human_with_view now renders the data body (unchanged) and then appends
    the footer when next_actions is non-empty. The data rendering was factored
    into a small render_data_body helper so the footer is appended once across
    both the column-view and plain paths.
  • No behavior change when there are no actions — an empty next_actions
    adds nothing, so existing human output is byte-for-byte identical.
  • Error envelopes render only the error (no footer).
  • Command templates are shown as-is (placeholders like <domain> are displayed
    literally, matching the JSON representation).

Note: a command that registers a custom human-view renderer
(register_func) bypasses render_human_with_view and so won't get the footer;
the default and column-view paths (what commands use in practice) are covered.

Tests

Added unit tests in src/output/human.rs: footer present with actions, absent
without, and never on error envelopes. cargo fmt --check, clippy --workspace --all-targets -D warnings, and the full cargo test --workspace suite pass.

🤖 Generated with Claude Code

Human/terminal output dropped an envelope's `next_actions` entirely — they
appeared only in JSON/TOON — so commands that suggest follow-up steps gave no
on-screen guidance. `render_human_with_view` now appends a "Next steps:" footer
listing each action's command template (placeholders like `<domain>` shown
as-is) with its description. Error envelopes and empty action lists render
exactly as before.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

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 updates the Rust cli_engine human/terminal output renderer to surface Envelope.next_actions as a “Next steps:” footer, bringing the human output feature set in line with the existing JSON/TOON output envelopes.

Changes:

  • Append a “Next steps:” footer to human output when next_actions is non-empty, and keep error envelopes footer-free.
  • Refactor the success-path renderer to split data rendering into a render_data_body helper and footer rendering into render_next_actions.
  • Add unit tests covering footer present/absent cases and ensuring error envelopes do not include the footer.

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

Comment thread src/output/human.rs Outdated
Comment thread src/output/human.rs Outdated
Address Copilot review: render the footer by writing directly into the data
body instead of `format!`-ing a new string. The no-footer path now leaves the
body untouched (no realloc/copy), and each action is pushed straight into the
buffer (no per-action temporaries). Output is unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

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 1 out of 1 changed files in this pull request and generated no new comments.

@jbrooks2-godaddy jbrooks2-godaddy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

One qq on custom output registered, lgtm

Comment thread src/output/human.rs
return format!("Error: {}\n", error.message);
}
if let Some(data) = &envelope.data
&& let Some(custom) = registry.custom(schema_id)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This skips the extra next action footer if we have custom human output, I think that's reasonable?

@jpage-godaddy jpage-godaddy merged commit 2408910 into main Jul 1, 2026
3 checks passed
@jpage-godaddy jpage-godaddy deleted the cli-engine-human-next-steps branch July 1, 2026 23:15
jpage-godaddy pushed a commit that referenced this pull request Jul 2, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.3.5](cli-engine-v0.3.4...cli-engine-v0.3.5)
(2026-07-01)


### Features

* surface next_actions as a "Next steps" footer in human output
([#36](#36))
([2408910](2408910))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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