Skip to content

fix(cli-generator): interpolate env prefix in help; correct README/reference format docs - #17624

Open
devin-ai-integration[bot] wants to merge 3 commits into
devin/1788370681-stack-3-fail-fast-authfrom
devin/1788370681-stack-4-help-docs
Open

fix(cli-generator): interpolate env prefix in help; correct README/reference format docs#17624
devin-ai-integration[bot] wants to merge 3 commits into
devin/1788370681-stack-3-fail-fast-authfrom
devin/1788370681-stack-4-help-docs

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Description

Stack 4/5 ("Benchling CLI fixes", split out of #17620). Stacked on #17623.

Global flag help leaked literal <NAME>_OUTPUT / <NAME>_USER_AGENT_SUFFIX, and the generated README documented a global --output <PATH> that doesn't exist and claimed the default format is JSON.

Changes Made

  • openapi/commands.rs: env_var_prefix(binary_name) (benchling-cliBENCHLING_CLI); app.rs / graphql/commands.rs use it in --format / --user-agent-suffix help and global_flags(&self.name) metadata.
  • --format help now lists json, table, yaml, csv, raw, jsonl, http and states the default (table on a TTY, json when piped).
  • emitReadme.ts / emitReference.ts: same format list + default; -o, --output <PATH> documented only for binary-response operations.
  • Changelog fix-help-placeholders-docs.yml; regenerated seed/cli/cli-basic-auth.

Testing

  • cargo build in generators/cli/sdk; pnpm turbo run compile --filter @fern-api/cli-generator
  • pnpm seed test --generator cli --fixture cli-basic-auth --skip-scripts --local 2/2 (README/reference diff in seed)
  • Manual testing completed (benchling --help shows BENCHLING_OUTPUT)
  • Updated README.md generator

Link to Devin session: https://app.devin.ai/sessions/d3e6c0a2eab24903ae7765c8a4c54032
Open in Devin Desktop: https://app.devin.ai/desktop/session/d3e6c0a2eab24903ae7765c8a4c54032?variant=devin


Devin Review

willkendall01 and others added 2 commits September 2, 2026 17:45
…ference format and --output docs

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@nitpickybot nitpickybot Bot 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.

AI Review Summary

Straightforward docs/help-text fix: env prefix is now interpolated into clap help strings via a new env_var_prefix helper, and generated README/reference tables list the real format values and default. Changes are mirrored consistently into both seed fixtures. Only minor nits below.

  • 🔵 2 suggestion(s)

To request another review, comment /ai-review on this pull request.

Comment on lines +114 to +116
pub fn env_var_prefix(binary_name: &str) -> String {
binary_name.to_uppercase().replace('-', "_")
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 suggestion

env_var_prefix only handles -; binary names with . or other non-alphanumeric chars (e.g. my.cli) would still produce an invalid env var name. Consider mapping any non-alphanumeric char to _ for robustness:

Suggested change
pub fn env_var_prefix(binary_name: &str) -> String {
binary_name.to_uppercase().replace('-', "_")
}
pub fn env_var_prefix(binary_name: &str) -> String {
binary_name
.to_uppercase()
.chars()
.map(|c| if c.is_ascii_alphanumeric() { c } else { '_' })
.collect()
}

.title
.clone()
.unwrap_or_else(|| format!("{} CLI", doc.name));
let env_prefix = crate::openapi::commands::env_var_prefix(&doc.name);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 suggestion

GraphQL command builder reaching into crate::openapi::commands for a generic string helper is odd coupling. Since this is now used from app.rs, openapi, and graphql, consider hoisting env_var_prefix to a shared module (e.g. crate::user_agent or a small env util) and re-exporting.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

2 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)

Devin Review

Comment thread generators/cli/src/emitReadme.ts
…ecific flags

Co-Authored-By: Devin AI <158243242+devin-ai-integration[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.

1 participant