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

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

FieldTypeMeaning
inspectVersionintegerDocument format version; always 1 today. Consumers must reject an unknown version.
toolVersionstringThe CLI’s own semver. Informational — never use it for feature detection.
offlinebooleanAlways true: inspect is offline in every mode.
projectobjectProject 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.
configobjectConfiguration file status and effective settings: found, path (null when absent), version, protocol, projectType, the per-surface tests switches, and policy.warningsAreFailures.
targetobjectThe protocol actually targeted and its source: flag, config or default.
fixturesobjectdirectoryFound and loaded: how many fixtures the directory yielded in total (all protocols), before planning.
planobjectThe compatibility plan — see below.
workspaceobjectWorkspace member diagnostics.
fingerprintobjectThe 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:

FieldJSON typeMeaning
evidenceVersionintegerEvidence format version (1 today). Treat an unknown value as unsupported rather than guessing at its contents.
rootstringThe root that was inspected, relative to the directory the command was started in (normally ".").
capabilitiesarray of objectsOne capability evidence entry per capability detection produced; [] when none were found.
inspectedarray of stringsRoot-relative paths the detector read, such as Cargo.toml, sorted and deduplicated.
diagnosticsarray of objectsOne detection diagnostic per non-fatal detection problem; [] when detection was clean. These do not fail inspect.
projectTypeobjectThe resolved project-type evidence.
Capability evidence

Each object in capabilities names one capability and lists the matches that produced it:

FieldJSON typeOptional?Meaning
capabilitystringnoLowercase kebab-case name from project.capabilities, e.g. soroban-contract.
evidencearray of evidence itemsnoThe 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:

FieldJSON typeOptional?Meaning
manifeststringnoRoot-relative manifest or artifact path the detector read.
ecosystemstringnoSource ecosystem, e.g. cargo, npm, go, python or wasm.
dependencystringyesDependency name for manifest evidence; omitted for artifact evidence.
sectionstringyesManifest section such as dependencies; omitted when not applicable.
sourceFilestringyesNormalized root-relative path to the file that yielded the match.
matchedTextstringyesThe matched dependency, string or artifact identifier.
reasonstringyesHuman-readable reason the match assigns the capability.
Detection diagnostic

Each object in diagnostics has two keys, both always serialized:

FieldJSON typeOptional?Meaning
codestringnoMachine-readable CF-07 diagnostic code, e.g. manifest-unparseable.
detailstringnoHuman-readable context, including a root-relative path when one is involved.
Project-type evidence

projectType records the effective type and where it came from:

FieldJSON typeOptional?Meaning
valuestringnoEffective type, one of the five values listed for project.type above.
sourcestringnodetected when auto-detection chose the type, config when configuration overrode it.
detectedValuestringyesThe 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:

  • wouldRun is the ordered list of fixtures check would execute, in execution order: XDR first, then RPC, then Soroban, each in planned order. A consumer can compare it against a report’s results.
  • skipped lists every fixture left out, sorted by id, each with a machine-readable code, the surface, and the same free-text reason check records. Codes are the CF-01 skip codes: UNSUPPORTED_PROTOCOL, SURFACE_DISABLED, MISSING_CAPABILITY, and the UNKNOWN fallback. New codes may be added by a changelog entry; consumers must treat a code they do not know as “other”.
  • checkWouldRefuse is true when no fixture applies — the situation where check (without --allow-empty) would fail with exit code 2. refusal then holds the human-readable explanation check would print; otherwise it is null.

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

SituationExit codestdoutstderr
Any successful inspection, including an empty plan0the documentempty
Invalid or unreadable configuration, invalid --protocol, unreadable root2emptythe error
Invalid fixture, duplicate id, unsafe reference, symbolic link4emptythe 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.