@pierre/cli installs the pierre command. Each API command calls one operation of the HTTP API
through @pierre/sdk, with the same name and the same fields as the SDK method. The helpers sign
tokens and let plain Git work with each Code Storage repository.
The reference page of each operation shows its CLI command. This page gives the parts that every
command shares.
Install
npx @pierre/cli version. Use a global install for
pierre auth setup-git: Git stores the path of the pierre that it runs, and npx runs the CLI
from a cache that can change.
Sign in
Create a key on the Keys page of your organization dashboard. Authentication explains keys. Then store the private key for your Git host:--with-key, the CLI reads the PEM from stdin. You can also pass --from-file key.pem, or
paste the key at the prompt. The CLI checks the key with repos.list, then
stores it. --no-verify skips the check. The command prints the host, the organization, the key
file, the key ID, and the result of the check.
The CLI keeps one entry for each Git host in ~/.config/pierre/hosts.yml. It keeps the private key
in ~/.config/pierre/keys/<host>.pem, with mode 600. When XDG_CONFIG_HOME is set, it replaces
~/.config. PIERRE_CONFIG_DIR replaces the whole ~/.config/pierre path.
A host in the <org>.code.storage shape gives the organization and the API URL. For a Git host on
another domain, pass --org and --api-url once, at login. The Settings page of the dashboard
shows the Git host and the API URL.
Check the credential
pierre auth status reports each saved host: the organization, the API URL, the key source, the key
ID, a live check, and the Git helper settings. --hostname <host> reports one host, and --json
prints the report as JSON. When a check fails, the command exits with the code of the problem.
To rotate a key, run pierre auth login again for the same host with the new key. Then delete the
old key on the dashboard. pierre auth logout deletes only the local key file and the host entry,
so also revoke the key on the dashboard.
Select a host
Each command uses one Git host. The CLI takes the first match:--hostname <host>.PIERRE_GIT_HOST.- The Code Storage remote of the current Git repository: an HTTPS remote on a saved host or on a
*.code.storagehost. When several remotes match, a saved host comes first, then the remote namedstorage. - The single saved host.
<org>.code.storage, for the organization inPIERRE_ORGor in theissclaim ofPIERRE_TOKEN.
hosts.yml holds more than one host, and the first three give no host, the command stops with
exit code 2. The error lists the saved hosts:
--hostname for one command, or set PIERRE_GIT_HOST for the shell or the
job:
--hostnametakes the Git host, such asacme.code.storage, not the API URL. It accepts anhttp://orhttps://prefix.--hostnameis a global flag. Put it before or after the command.--hostnamewins overPIERRE_GIT_HOST, and both win over the remote of the current repository.- A saved host uses its host entry. Another host uses the variables of CI and containers, as the SDKs do.
pierre auth statusreports every saved host, so it needs no host.
CI and containers
A CI job usually has nohosts.yml. Give the credential in environment variables:
The CLI uses the first credential that it finds:
PIERRE_TOKEN, PIERRE_PRIVATE_KEY,
PIERRE_PRIVATE_KEY_FILE, then the key file of the host entry. A saved host entry sets the
organization and the API URL, so PIERRE_ORG and PIERRE_API_BASE_URL apply only to a host with no
entry. When the runner has a hosts.yml with several hosts, also set PIERRE_GIT_HOST.
In a container, configure Git when you build the image, and put no secret in the image:
PIERRE_PRIVATE_KEY. For a host in the <org>.code.storage shape, Git needs
nothing else: the helper gets the organization from the host. Also set PIERRE_ORG for a host on
another domain, and for an API command outside a clone. An API command on a host on another domain
also needs PIERRE_GIT_HOST and PIERRE_API_BASE_URL.
Command form
:, then add the
method. A name in camel case, such as createFromDiff or gitCredentials, becomes kebab case.
The reference page of each operation shows its command, for example
repos.branches.create. pierre --help lists the resources and their
methods. pierre <resource> <method> --help gives the flags, the catalog ID, the HTTP route, and
the scopes of one command:
pierre repos branches create is a usage error that names
pierre repos:branches create.
Singular nouns
Each resource also has a singular name.pierre repo list runs pierre repos list, and
pierre repo:branch create runs pierre repos:branches create. pierre repo view runs
pierre repos get.
Flags
The flags are the fields of the SDK method, with the wire names in kebab case.target_branch is
--target-branch, and base_ref is --base-ref.
- A boolean is
--forceor--no-force. - An array takes its flag once for each item.
- An object takes JSON,
@file, or@-for stdin. Each scalar field of the object also has a dotted flag, such as--author.nameand--author.email.
The argument
A command takes at most one positional argument: the resource that it acts on. The argument and its flag do the same thing:The repository
-R is the short form of --repo-name. Inside a clone with a Code Storage remote, --repo-name
defaults to the repository of that remote:
pierre repos delete has no default, so
name the repository. --debug prints the repository that the CLI took from the remote.
Global flags
Output
--json, an object prints its main fields, one row for each field. A list prints a table.
When an operation can answer with more than one success status, the output starts with the status.
pierre repos create prints 201 Created for a new repository, and 200 OK for an existing one.
--json prints the response body, with every field. Use it in scripts:
Lists
A list command prints one page.--limit and --cursor are the wire fields of the operation. When
more items exist, the CLI writes the next cursor to stderr:
More items: pass --cursor <cursor>, or --paginate.
--paginate reads every page. Without --json, it prints one table of all the items. With
--json, it prints one response body for each page.
Bytes
A byte response, such as the file ofpierre repos:files get, goes to stdout or to the file that
--output names:
--output, the command stops with a usage error. It sends
no request.
pierre api
pierre api <catalog-id> calls any operation through its SDK method, and prints the JSON response
body. As in gh api, path parameters are fields, with their wire names:
-F key=valuesends a typed value:true,false,null, an integer, the text of@file, stdin for@-, or text.-F 'key[name]=value'sets one field of an object. For an array, repeat-Fonce for each item.-f key=valuealways sends a string.--input <file>gives the body fields as one JSON object.--input -reads stdin. Then-Fand-fset only path, query, and header fields.--paginatereads every page of a list, and prints one body for each page.--output <file>writes a byte response to the file.
pierre api cannot call
repos.commits.create or repos.commits.createFromDiff, because their body is file content. Use
pierre repos:commits create and pierre repos:commits create-from-diff.
Exit codes and errors
The exit code comes from the class of the SDK error, never from the message text.
An API error prints its status, its problem
code, its detail, the request ID, and the docs of the
code:
pierre auth login command again. With --json, the CLI also prints the problem details
body on stdout. Error codes lists each code. A usage error stops the
command before it sends a request.
Debug output
--debug, or PIERRE_DEBUG=1, writes these lines to stderr:
- The repository that the CLI takes from the Git remote when you do not give
--repo-name. See The repository. - The steps of the Git credential helper: an operation that it ignores, the source of a token that it sends, or the scopes, the repository, the host, the organization, and the lifetime of a token that it signs.
- The scopes, the repository, the host, the organization, and the lifetime of a token that
pierre auth tokensigns.
--debug also prints the stack of an unexpected error. PIERRE_DEBUG=1 does not. An API error and
a usage error print no stack.
Debug output has no request and no response, and it never has a token or a key.
Helpers
pierre auth token
pierre auth token prints a token that your private key signs, for a script or for curl:
--scopeadds a scope. Repeat it for more. The scopes aregit:read,git:write,org:read, andrepo:write. The default isgit:readandgit:write.- A token whose scopes all cover the organization, such as
org:read, has norepoclaim. Another token needs--repo, which defaults to the Code Storage remote of the current repository. --ttlsets the lifetime, such as15m,1h, or900s. The default is 15 minutes, and the maximum is 1 hour.
PIERRE_TOKEN is set, the CLI signs no token, so pierre auth token stops.
Scopes gives the access of each scope.
pierre auth setup-git
pierre auth setup-git configures Git to get its credential for the host from pierre. Then
git clone, git fetch, and git push work, and no token appears in a URL or in a file. The
command writes these settings once for each host:
helper line stops Git from asking another helper, such as a keychain, for this host.
useHttpPath makes Git send the repository path, which the helper needs.
--hostname <host>selects the host. With several saved hosts, run the command once for each host.--localwrites the settings of the current repository instead of the global settings.--read-onlymakes the helper signgit:readonly, so the machine cannot push.--uninstallremoves the settings.
pierre on your PATH is this CLI, the helper runs that path. Otherwise, the helper names
the Node.js executable and the CLI script. Then run pierre auth setup-git again after you update
Node.js or move the CLI.
The Git credential helper
Git runspierre auth git-credential get for each operation on the host. Do not run it yourself. On
each call, the helper:
- Takes the host and the repository from the URL that Git sends. It removes
.git, and a+ephemeralor+importsuffix. - Finds the organization and the credential by the rules of
CI and containers. Git gives the host, so the helper needs no
--hostnameand noPIERRE_GIT_HOST. - Signs a token for that repository with
git:readandgit:write, or withgit:readonly in read-only mode. The token lives for 1 hour.PIERRE_TOKEN_TTLsets another lifetime in seconds, from 1 to 3600. WhenPIERRE_TOKENis set, the helper sends that token instead. - Gives Git the username
tand the token as the password. It stores nothing.
PIERRE_DEBUG=1 to see the diagnostics of the helper.
pierre mcp
pierre mcp prints the docs MCP server, the index of the Markdown pages, the auth note, and the
command that installs the pierre agent skill. When a host is selected, it also prints the
organization and the API URL of that host. pierre mcp --json prints a config block for an MCP
client:
SDKs
The CLI calls the methods of@pierre/sdk. To call the same operations from your code in
TypeScript, Python, or Go, read the SDK page.