Skip to content

Render cf CLI samples from the cf CLI's command metadata - #94

Merged
ematipico merged 1 commit into
mainfrom
fix/cli-snippet-arguments
Nov 4, 2026
Merged

ematipico merged 1 commit into
mainfrom
fix/cli-snippet-arguments

Conversation

@ematipico

Copy link
Copy Markdown
Collaborator

The cf CLI sample of an operation was guessed from its path parameters: each one became a positional, account_id included, and operations with a request body or a required query parameter had no sample at all. So cf agent-memory recall showed no sample, and cf agent-memory get-memory showed <account_id> <namespace_name> <profile_name> <memory_id>, which the CLI doesn't accept.

Now the sample comes from the cf CLI itself: dist/_meta/commands.json in the cf package, the metadata cf <command> --help is built from. The sample is the command that sends the operation, with its required positionals and then its required options:

cf agent-memory recall <profile-name> \
    --namespace-name <namespace-name> \
    --query <query>
  • Hand-written commands, such as cf ai run, get no sample here, since the site documents them separately.
  • When several commands send the same operation (cf workflows instances pause/restart/resume/terminate), the one named like the operation's SDK method is used.
  • cf is bumped from 1.0.0-beta.19 to 1.0.0-beta.27, whose metadata the tests check against.

Things to know:

  • dist/_meta/ isn't an exported path of the cf package, so it's read from the package's directory. A cf release that moves it fails the tests.
  • cf also runs the site's dev, build and deploy scripts. With beta.27, pnpm dev starts astro dev in the background and returns. cf build and cf deploy haven't been tried with beta.27.

The cf CLI sample of an operation was guessed from its path parameters: every
path parameter became a positional, including `account_id`, and operations
with a request body or a required query parameter got no sample at all. So
`cf agent-memory recall` had no sample, and `cf agent-memory get-memory` showed
`<account_id> <namespace_name> <profile_name> <memory_id>` instead of
`<memory-id> --namespace-name … --profile-name …`.

The sample now comes from `dist/_meta/commands.json` in the cf package, the
metadata `cf <command> --help` is built from: the command that sends the
operation, its required positionals, then its required options. Hand-written
commands are left out, as the site documents them separately.

cf is bumped to 1.0.0-beta.27, whose metadata the tests check against.
@ematipico
ematipico merged commit 0118fdf into main Nov 4, 2026
13 checks passed
@ematipico
ematipico deleted the fix/cli-snippet-arguments branch November 4, 2026 11:40
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.

2 participants