CLI commands
Every corfedo command with its arguments and main options, the options every command takes, and the CLI's exit codes.
The corfedo CLI talks to one workspace through a profile. corfedo --help and corfedo COMMAND --help print the options of the installed version. corfedo capabilities lists the commands it implements, and corfedo schema --command NAME prints a command's request fields. Task guides are under CLI.
Options of every command
| Option | Default | Meaning |
|---|---|---|
--profile NAME | The default profile | The profile to use for this run |
--format text|json|jsonl | text | Output format, see Output formats |
--timeout SECONDS | 30, and 5 minutes for auth login | Time limit of each request, 1 to 300. For ask it limits each request, not the whole answer. |
--non-interactive | Off | Fail with interaction_required instead of opening a browser |
--allow-partial | Off | Exit 0 instead of 7 for a partial result |
--max-output-bytes N | 8 MiB | Output limit of a command, 4 KiB to 64 MiB. A single result over it fails with output_limit_exceeded and exit 2. |
--request FILE | The complete API request as JSON, or - for standard input. Replaces the arguments. Read commands only. | |
--help | Print the command's options |
Set up and profiles
| Command | What it does |
|---|---|
version | Shows the CLI version and its API contract |
update [--check] | Updates the CLI itself to its latest release, or only reports one with --check. A Corfedo installation updates with install.sh update. |
capabilities | Lists the implemented commands and request schemas |
schema --command NAME | Shows a command's request schema |
auth login --api URL [--replace] [--client-id ID] [--expected-tenant ID] | Signs in with the browser and saves the profile. --replace signs in again to an existing profile. --client-id overrides the client ID, and --expected-tenant requires that workspace. |
auth configure-api-key --key-file PATH | Saves a profile for an API key file |
auth status | Shows the profile's local credential state without contacting the workspace |
auth logout | Deletes the profile's local credentials and keeps the profile |
auth disconnect --yes | Reports that remote revocation is not available, and exits 10. Revoke access in Connect › Manage connections. |
profile list, profile show NAME | Lists or shows local profiles |
profile use NAME | Makes a profile the default |
profile remove NAME --local-only --yes | Forgets a profile on this machine |
connection show | Shows the profile's connection to the workspace |
Search and read
| Command | What it does |
|---|---|
repositories list [--limit N] [--cursor CURSOR] [--all] | Lists the repositories you can read, 25 per page by default |
scope lookup | Looks up repository, saved context and owner names by prefix. Takes --request, see corfedo schema --command 'scope lookup'. |
search --query QUERY | Searches code with the search syntax |
read REPO PATH [--lines START:END|START:] [--rev SHA] [--max-bytes N] | Reads a file. Lines are one-based and inclusive. |
tree REPO [DIR] [--rev SHA] | Lists a directory |
outline REPO PATH [--rev SHA] | Lists the declarations in a file |
symbols NAME [--match exact|contains|regex] [--kind KIND] [--repo NAME|GLOB ...] | Finds declarations by name across repositories |
chunks REPO PATH --span START:END ... [--rev SHA] | Reads snippets around byte spans, as search returns them |
completions | Suggests file name, path or symbol prefixes. Takes --request, see corfedo schema --command completions. |
REPO is a canonical name such as github.com/acme/payments, or acme/payments when only one repository you can read has that name. --rev takes a full commit SHA or a unique prefix of at least seven characters. Without it, a command reads the commit the repository serves now. See Search and read.
Saved contexts
| Command | What it does |
|---|---|
contexts list | Lists your contexts, then the workspace's |
contexts show NAME|ID [--workspace] | Shows a context and its repositories |
contexts create NAME [--workspace] [--description TEXT] [--repo NAME ...] [--repo-id ID ...] | Creates a context |
contexts change NAME|ID [--workspace] [--name NAME] [--description TEXT] [--add NAME ...] [--add-id ID ...] [--remove NAME ...] [--remove-id ID ...] [--remove-inaccessible] | Renames a context or changes its description or repositories |
contexts delete NAME|ID [--workspace] --yes | Deletes a context |
A name means your own context before a workspace context of the same name. --workspace selects the workspace's. Repositories are given by exact name or ID, and patterns such as * are rejected. When the context changed meanwhile, change and delete exit 2 with conflict. See Contexts.
Dependencies and security
| Command | What it does |
|---|---|
dependencies REPO [--query TEXT] [--ecosystem E] [--package NAME] [--version V] [--directness direct|transitive|unknown] [--vulnerable] | Lists a repository's packages |
packages complete [PREFIX] [--ecosystem E] [--name NAME] [--version-prefix V] | Completes package names, or lists an ecosystem's most used packages |
packages usage ECOSYSTEM/NAME | Counts the repositories that use a package, per version |
packages uses ECOSYSTEM/NAME [--origin installed|declared|action --version V] [--revision R] | Lists the repositories that use a package, and where |
security findings [--repo NAME] [--state S ...] [--severity S ...] [--classification C ...] [--ecosystem E] [--package NAME] [--advisory ID] [--query TEXT] [--version V] [--sort severity|newest|repository] | Lists security findings |
security finding REPO FINDING-ID | Shows a finding with its evidence |
security package ECOSYSTEM/NAME | Shows a package's findings per version |
security advisories [--query TEXT] [--severity S ...] [--affected] [--ecosystem E] [--package NAME] | Searches advisories |
security advisory ADVISORY-ID | Shows an advisory |
A package is written ecosystem/name, such as npm/react or github-actions/actions/checkout.
Corfedo AI
| Command | What it does |
|---|---|
ask "TEXT" [--conversation ID | --continue] [--repo NAME|GLOB ...] [--json] [--no-stream] | Asks Corfedo AI and prints the answer, see Ask from the CLI |
conversations list [--limit N] [--cursor CURSOR] | Lists conversations, most recently active first |
conversations show ID [--limit N] [--before-ordinal N] | Shows a conversation's messages and answers |
conversations delete ID --yes | Deletes a conversation |
Paging
The dependency and security list commands, conversations list and repositories list take --limit and --cursor for one page. search, tree and outline continue from the continuation of a --request file. --all with --format jsonl reads every page. --all works on repositories list, search, tree, outline, dependencies, packages uses, security findings and security advisories. --max-pages (default 20) and --max-output-bytes stop it early. See Read every page.
Exit codes
| Code | Meaning |
|---|---|
| 0 | Complete result, including a page with more pages after it |
| 1 | Unexpected internal error |
| 2 | Usage error, including ambiguous_repository, profile_required and conflict |
| 3 | Authentication needed: authentication_required, reauthorization_required or interaction_required, or connection_mismatch when the profile, key or session belongs to another workspace |
| 4 | Permission denied, including missing_scope |
| 5 | Not found or stale: an unknown repository, path, context, finding or advisory, or a revision or continuation that is no longer served |
| 6 | Service unavailable, a timeout, a spending limit reached, or dependencies or security coverage not available |
| 7 | Partial result, or an answer limited by a budget |
| 8 | The CLI and the workspace do not agree on the API contract. Update the CLI. |
| 9 | Local file or credential storage failed, including an unsafe key file |
| 10 | Remote revocation could not be confirmed |
| 11 | Corfedo AI run failed |
| 130 | Cancelled |
Ask from the CLI lists the codes of ask.