Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Pina CLI

The pina command scaffolds programs, extracts Codama IDLs, renders clients, reads bundled reference material, profiles compiled SBF binaries, and plans explicit deployments. It is designed for both interactive use and scripted or agent-driven discovery.

Install

Install the prebuilt npm package. It selects the native binary for the current operating system, CPU, and Linux C library:

npm install --global @pina-rs/cli
pina --version

Or install from crates.io with Rust:

cargo install pina_cli
pina --version

Inside this repository, enter the development shell and use the pina shortcut:

devenv shell
pina --help

The shortcut runs cargo run -p pina_cli -- ... against the checked-out source.

Command map

CommandPurposePrimary output
pina initCreate a project-aware program scaffoldFiles plus next steps
pina lintRun the official security lints via the lint driverCompiler diagnostics and optional fixes
pina locksReport write-lock hotspots and conflicting instructionsText or JSON
pina mapChart instructions, account locks, and conflictsSelf-contained HTML or JSON
pina buildBuild SBF, optionally with deterministic verification inputsSBF, IDL, and optional build-record files
pina verifyCompare deployments and record verified sourceStatus or transaction
pina generateGenerate configured client ecosystemsGenerated clients
pina cpiGenerate a standalone Pina CPI crate from an IDLRust crate
pina importImport a foreign program’s IDL as a CPI crateRust crate with provenance
pina testRun native/Mollusk or SBF/Surfpool testsTest runner output
pina devStart an offline Surfpool watch/redeploy loopSurfpool UI and logs
pina idlExtract a Codama root-node IDLJSON
pina docsList or render bundled terminal docsTerminal text
pina keysInspect or explicitly change program identityText or JSON
pina doctorDiagnose project and toolchain readinessText or JSON
pina explainExplain which account check failed in a transactionText or JSON
pina completionsGenerate a shell completion scriptShell script
pina profileEstimate SBF compute cost, or trace it per line from testsText, JSON, folded stacks, or HTML
pina rehearseReplay real traffic against an upgrade before shipping itText or JSON
pina deployPlan and execute an explicit cluster deploymentPlan or JSON
pina generateGenerate IDLs and Rust, CPI, JavaScript, Dart, and CLI clientsGenerated directories

Discover the interface

The help tree is intentionally self-describing:

pina --help
pina build --help
pina verify --help
pina verify check --help
pina verify record --help
pina verify submit --help
pina verify status --help
pina generate --help
pina cpi --help
pina idl --help
pina docs --help
pina init --help
pina lint --help
pina locks --help
pina map --help
pina keys --help
pina doctor --help
pina explain --help
pina completions --help
pina profile --help
pina rehearse --help
pina deploy --help

Long help includes the input contract, output behavior, defaults, and copyable examples. Run pina docs with no topic to discover the bundled architecture references.

Streams and exit codes

Commandstdoutstderr
idlJSON when --output is omittedProgress, extraction counts, errors
docsTopic index or rendered MarkdownErrors
initCreated path and next stepsErrors
lintCompletion summaryCargo progress and lint diagnostics
locksLock report or JSONErrors and denied hotspots
mapWritten HTML path, or JSONProgress and errors
buildPublished artifact summaryCargo output and errors
verify checkMatching hashMismatch hashes and errors
verify recordUpstream streamed progressUpstream diagnostics and errors
generateIDL and client summaryRenderer output and errors
cpiGenerated crate summaryConversion and renderer errors
testChild test-runner outputBuild output and errors
devSurfpool UI and logsBuild output and errors
keysIdentity report or change summaryErrors
doctorDiagnostic reportErrors
explainExplanation reportErrors
completionsCompletion scriptErrors
profileReport when --output is omittedErrors; trace adds build and test output and warnings
rehearseRehearsal report (text or JSON)Progress and errors
deployPlan, rehearsal, and completionConfirmation, progress, errors
codama generateCompletion summaryErrors and renderer failures

Successful commands exit with code 0. Operational failures exit with code 1. Completed comparisons that find a difference exit with code 2: verification hash mismatches, profile compare regressions, and rehearse behaviour changes. rehearse exits with code 3 when it could compare no transaction. deploy --rehearse stops before sending anything with the same codes: 2 for behaviour changes, and 3 when nothing was compared or the program is not deployed yet. Invalid command-line syntax is rejected by Clap with a non-zero usage error before an operation begins.

For reliable automation, capture stdout only when the command documents it as machine-readable. See Automation and Agent Usage for a compact discovery protocol.

Path behavior

Relative paths are resolved from the process working directory. Project-aware commands discover the nearest pina.toml or unambiguous Cargo package and use Cargo metadata for the library source and target directory. Output commands create their documented output directories where applicable, but pina idl --output expects the parent directory to exist. Identity replacement requires pina keys new --force; profile reports are published atomically and cannot alias the input binary.

Environment

Project-aware commands read pina.toml and respect standard Cargo variables such as CARGO_TARGET_DIR and CARGO. The CLI also reads these Pina-specific optional environment variables:

VariableUsed byMeaning
PINA_TEMPLATES_DIRpina docsDirectory containing custom <topic>.t.md files
PINA_SURFPOOLpina dev, pina rehearseSurfpool executable to run instead of surfpool

No configuration file is required for an unambiguous Cargo package. pina init creates a small pina.toml so every tool and agent discovers the same program and client choices.

Agents that maintain Pina projects can install the companion @pina-rs/skill package.