Skip to content

docs(cli-generator): document named profiles for multi-tenant CLIs - #7021

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1789837675-cli-generator-profiles
Open

devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1789837675-cli-generator-profiles

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Summary

The CLI generator can now emit named profiles in generated CLIs: a profiles command group plus a global --profile / -p flag that stores a tenant's credential, parameter defaults, server URL variables, base URL, retry limit, and default output format under a name. This matters for users of multi-tenant APIs (account SIDs, org slugs, workspaces): they set the tenant context once instead of passing it on every command, secrets stay in the OS keychain rather than a config file, and CI environment variables still take precedence over a developer's stored profile. The feature is opt-in (profiles.enabled: true) and a CLI generated without it is unchanged.

Implements docs for: feat(cli-generator): add named profiles for multi-tenant CLIs (fern-api/fern#17654)

Sources: generators/cli/src/customConfig.ts (config schema: enabled, commandName, revokeOperation), generators/cli/sdk/docs/customize.md, and ADR-0011 on fern-api/fern main.

Pages changed

  • fern/products/cli-generator/configuration.mdx: new profiles ParamField with profiles.enabled, profiles.commandName, profiles.revokeOperation (all three verified in the generator's config schema) and a generators.yml example.
  • fern/products/cli-generator/authentication.mdx: new canonical ## Named profiles section (managing/selecting profiles, <PREFIX>_PROFILE, precedence incl. the explicit -p vs ambient-profile distinction from ADR-0011, keychain storage, single-level --parent inheritance).
  • fern/products/cli-generator/features.mdx: cross-refs from retries (--retries <N> resolution order), server URL variables (<PREFIX>_<VARIABLE> env var naming), and --schema (builtinCommands).
  • fern/products/cli-generator/state-of-the-world.mdx: added profiles to current capabilities and removed "Multiple credential profiles" from the roadmap's "Next" column.

Validation: fern check --warnings (0 errors; remaining warnings are preexisting) and pre-commit/vale on the changed files (0 errors/warnings).

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

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

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring


## Named profiles

For APIs where every call carries a tenant identifier (an account SID, an org slug, a workspace), a profile stores it once instead of it being typed on every command. A profile is a named bundle of request context resolved once per invocation: a credential, parameter defaults, [server URL variables](/learn/cli-generator/get-started/features#server-url-variables), an optional base URL, a [retry limit](/learn/cli-generator/get-started/features#retries-with-backoff), and a default output format. Nothing else is accepted; an unknown key is rejected at write time rather than stored and ignored.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📝 [vale] <FernStyles.Acronyms> reported by reviewdog 🐶
'SID' has no definition.


### Select a profile

A profile is selected by, in order, `--profile` / `-p`, the `<PREFIX>_PROFILE` environment variable, then the profile marked active by `profiles use`, where `<PREFIX>` is the binary name uppercased with `-` replaced by `_`. With no profile selected, the CLI behaves as if the feature were absent. A named profile that doesn't exist is an error rather than a fallthrough to environment credentials, so a command never silently runs against the wrong tenant. The `profiles` group itself always runs unprofiled, so a stale active pointer can be repaired.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📝 [vale] <FernStyles.Adverbs> reported by reviewdog 🐶
Remove 'silently' if it's not important to the meaning of the statement.

Suggested change
A profile is selected by, in order, `--profile` / `-p`, the `<PREFIX>_PROFILE` environment variable, then the profile marked active by `profiles use`, where `<PREFIX>` is the binary name uppercased with `-` replaced by `_`. With no profile selected, the CLI behaves as if the feature were absent. A named profile that doesn't exist is an error rather than a fallthrough to environment credentials, so a command never silently runs against the wrong tenant. The `profiles` group itself always runs unprofiled, so a stale active pointer can be repaired.
A profile is selected by, in order, `--profile` / `-p`, the `<PREFIX>_PROFILE` environment variable, then the profile marked active by `profiles use`, where `<PREFIX>` is the binary name uppercased with `-` replaced by `_`. With no profile selected, the CLI behaves as if the feature were absent. A named profile that doesn't exist is an error rather than a fallthrough to environment credentials, so a command never runs against the wrong tenant. The `profiles` group itself always runs unprofiled, so a stale active pointer can be repaired.

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.

0 participants