inspect
Prints offline project diagnostics. No fixtures run, and no network call is made.
Print offline project diagnostics
Usage: stellar-canary inspect [OPTIONS]
Options:
--protocol <PROTOCOL> Target protocol version (overrides configuration)
--fixtures-dir <FIXTURES_DIR> Directory containing fixture files to inspect [default: fixtures]
--project-root <PATH> Directory to treat as the project root (default: the current directory)
--config <CONFIG> Path to a configuration file (default: .stellar-canary.toml in the project root)
--format <FORMAT> Output format [default: terminal] [possible values: terminal, json]
--json Shorthand for --format json
--verbose Include verbose diagnostic details in output
-h, --help Print help
What it inspects
The same project-detection logic check uses internally, surfaced on its
own: the project root, its detected type, which Stellar-related
dependencies/artifacts were detected, the configured target protocol, and
which surfaces (xdr/rpc/soroban) are currently enabled.
With --fixtures-dir and --protocol, inspect drives the same
compatibility-planner preview described in the README: it lists fixtures that
would run and fixtures skipped for a protocol mismatch, disabled surface, or
missing project capability, without contacting Stellar RPC or Soroban endpoints.
Example
Run inside a checkout of Protocol-Canary itself:
stellar-canary inspect
Project root: /home/hollujay/Protocol-Canary
Project type: unknown
Detected Stellar SDK/XDR dependency: false
Detected Soroban contract usage: false
Detected RPC client dependency: false
Detected WASM artifact: false
Configured protocol: 28
Available compatibility surfaces:
xdr: enabled
rpc: enabled
soroban: enabled
Project type: unknown here is correct — this repository is Canary’s own
source code, not a Stellar application, so none of the detection
heuristics (Soroban contract, RPC client, stellar-sdk dependency, WASM
artifact) match. Run inspect inside your own project to see its actual
detected type and which fixtures’ required_capabilities it will satisfy.
inspect is useful before check when you want to confirm project
detection or configuration without waiting on a live network call.
JSON output (--format json)
--format json (or the shorthand --json) prints the CA-03 inspection
document: one JSON document on stdout, nothing on stderr. It still makes
no network call — offline is always true in the document. The output
is deterministic: no timestamps, and project.root is relative to the
current directory, never absolute. The full contract is
CA-03,
and the machine-readable schema is
inspect-v1.schema.json.
stellar-canary inspect --fixtures-dir ProtocolCanary-Fixtures/protocol-28 --protocol 28 --json
{
"inspectVersion": 1,
"toolVersion": "0.2.0",
"offline": true,
"project": {
"root": ".",
"rootSelectedBy": "current-directory",
"type": "soroban",
"typeSource": "detected",
"detectedType": "soroban",
"capabilities": [
"soroban-contract",
"wasm-artifact"
],
"workspace": {
"members": []
},
"detection": {
"evidenceVersion": 1,
"root": ".",
"capabilities": [],
"inspected": [
"Cargo.toml"
],
"diagnostics": [],
"projectType": {
"value": "soroban",
"source": "detected"
}
}
},
"config": {
"found": false,
"path": null,
"version": 1,
"protocol": 28,
"projectType": "auto",
"tests": {
"xdr": true,
"rpc": false,
"soroban": false
},
"policy": {
"warningsAreFailures": false
}
},
"target": {
"protocol": 28,
"source": "flag"
},
"fixtures": {
"directoryFound": true,
"loaded": 2
},
"plan": {
"wouldRun": [
{
"id": "p28-xdr-cap83-empty-tx-set",
"surface": "xdr"
}
],
"skipped": [
{
"id": "p27-xdr-old",
"surface": "xdr",
"code": "UNSUPPORTED_PROTOCOL",
"reason": "fixture targets protocol 27, this run targets protocol 28"
}
],
"checkWouldRefuse": false,
"refusal": null
},
"workspace": {
"members": []
},
"fingerprint": {
"fingerprintVersion": 1,
"detector": 1,
"digest": "sha256:859e9ac27cdbe3ee8bbaac66355d2e4ab98879e7c27f5d8a099e5a34ec0144bc",
"inputs": 1
}
}
(Example output trimmed; project.detection carries the evidence the
detector collected, and workspace.members lists workspace members
when one is detected.)
Field reference
| Field | Type | Meaning |
|---|---|---|
inspectVersion | integer | Document format version; always 1 today. Consumers must reject an unknown version. |
toolVersion | string | The CLI’s own semver. Informational — never use it for feature detection. |
offline | boolean | Always true: inspect is offline in every mode. |
project | object | Project root (root, relative), how it was selected (rootSelectedBy: current-directory or flag), the effective type and where it came from (typeSource: detected or config), what detection alone produced (detectedType), the sorted capabilities list, and the detection evidence block. |
config | object | Configuration file status and effective settings: found, path (null when absent), version, protocol, projectType, the per-surface tests switches, and policy.warningsAreFailures. |
target | object | The protocol actually targeted and its source: flag, config or default. |
fixtures | object | directoryFound and loaded: how many fixtures the directory yielded in total (all protocols), before planning. |
plan | object | The compatibility plan — see below. |
workspace | object | Workspace member diagnostics. |
fingerprint | object | The CA-04 project fingerprint: fingerprintVersion, detector, digest (sha256:<64 lowercase hex>) and inputs. The digest is not a secret and not anonymous; see CA-04. |
project.type and project.detectedType are one of soroban,
rpc-consumer, stellar-sdk, generic-stellar or unknown. Unknown
values in a newer document must be treated as unknown.
project.detection fields
project.detection is the evidence block collected by project detection.
It is always present, and its capabilities entries are the detailed
evidence behind the sorted name list in project.capabilities. All six keys
are always serialized:
| Field | JSON type | Meaning |
|---|---|---|
evidenceVersion | integer | Evidence format version (1 today). Treat an unknown value as unsupported rather than guessing at its contents. |
root | string | The root that was inspected, relative to the directory the command was started in (normally "."). |
capabilities | array of objects | One capability evidence entry per capability detection produced; [] when none were found. |
inspected | array of strings | Root-relative paths the detector read, such as Cargo.toml, sorted and deduplicated. |
diagnostics | array of objects | One detection diagnostic per non-fatal detection problem; [] when detection was clean. These do not fail inspect. |
projectType | object | The resolved project-type evidence. |
Capability evidence
Each object in capabilities names one capability and lists the matches
that produced it:
| Field | JSON type | Optional? | Meaning |
|---|---|---|---|
capability | string | no | Lowercase kebab-case name from project.capabilities, e.g. soroban-contract. |
evidence | array of evidence items | no | The individual matches supporting the capability; may be empty. |
Evidence item
Each object in a capability’s evidence has the keys below. Required keys
are always serialized; optional keys are omitted when absent (not
emitted as null), matching the serializer:
| Field | JSON type | Optional? | Meaning |
|---|---|---|---|
manifest | string | no | Root-relative manifest or artifact path the detector read. |
ecosystem | string | no | Source ecosystem, e.g. cargo, npm, go, python or wasm. |
dependency | string | yes | Dependency name for manifest evidence; omitted for artifact evidence. |
section | string | yes | Manifest section such as dependencies; omitted when not applicable. |
sourceFile | string | yes | Normalized root-relative path to the file that yielded the match. |
matchedText | string | yes | The matched dependency, string or artifact identifier. |
reason | string | yes | Human-readable reason the match assigns the capability. |
Detection diagnostic
Each object in diagnostics has two keys, both always serialized:
| Field | JSON type | Optional? | Meaning |
|---|---|---|---|
code | string | no | Machine-readable CF-07 diagnostic code, e.g. manifest-unparseable. |
detail | string | no | Human-readable context, including a root-relative path when one is involved. |
Project-type evidence
projectType records the effective type and where it came from:
| Field | JSON type | Optional? | Meaning |
|---|---|---|---|
value | string | no | Effective type, one of the five values listed for project.type above. |
source | string | no | detected when auto-detection chose the type, config when configuration overrode it. |
detectedValue | string | yes | The auto-detected type when source is config and it differs from value; omitted otherwise. |
The plan
plan mirrors what check would do with the same project, fixtures
directory and protocol, without running anything:
wouldRunis the ordered list of fixturescheckwould execute, in execution order: XDR first, then RPC, then Soroban, each in planned order. A consumer can compare it against a report’sresults.skippedlists every fixture left out, sorted byid, each with a machine-readablecode, thesurface, and the same free-textreasoncheckrecords. Codes are the CF-01 skip codes:UNSUPPORTED_PROTOCOL,SURFACE_DISABLED,MISSING_CAPABILITY, and theUNKNOWNfallback. New codes may be added by a changelog entry; consumers must treat a code they do not know as “other”.checkWouldRefuseistruewhen no fixture applies — the situation wherecheck(without--allow-empty) would fail with exit code2.refusalthen holds the human-readable explanationcheckwould print; otherwise it isnull.
An empty plan is reported in the document, not as an exit code:
inspect still exits 0, because its purpose is to explain the
situation.
Examples with jq
# How many fixtures check would run.
stellar-canary inspect --json | jq '.plan.wouldRun | length'
# Ids and reasons for everything that gets skipped.
stellar-canary inspect --json | jq -r '.plan.skipped[] | "\(.id): \(.code) (\(.reason))"'
# Fail a CI step when check would refuse to run anything.
stellar-canary inspect --json | jq -e '.plan.checkWouldRefuse | not' > /dev/null
# The project fingerprint, e.g. to key a CI cache on.
stellar-canary inspect --json | jq -r '.fingerprint.digest'
Failure behavior
| Situation | Exit code | stdout | stderr |
|---|---|---|---|
| Any successful inspection, including an empty plan | 0 | the document | empty |
Invalid or unreadable configuration, invalid --protocol, unreadable root | 2 | empty | the error |
| Invalid fixture, duplicate id, unsafe reference, symbolic link | 4 | empty | the error |
A failure never prints a partial or empty-looking JSON document, so a
consumer that parses stdout can treat “not parseable” as failure. See
Exit Codes for the full contract, and
fixtures --format json for the fixture inventory.