Skip to content

[fm-var] Add inspect and explain CLI workflows #122

Description

@DandyLyons

Problem / outcome

Expose read-only inspect and explain workflows so users and automation can understand every RFC 001 Rev 3 reference, source, projection, JSONPath result, effective format, cache, and status before validation or synchronization.

Epic: #111. Milestone: 4 — CLI workflows.

In scope

  • Add fm-var inspect / explain workflows following existing CLI conventions.
  • Support files/content trees, exclusions, hidden-file behavior, and deterministic document ordering through GlobalOptions.
  • Inspect element kind/location, raw src/query, resolved source, YAML-to-I-JSON projection metadata, nodelist cardinality/order, selected node/value shape, effective formatting, cached/expected content, and status.
  • Explain source policy, query-argument conversion, RFC 9535 query steps/functions, first-node or one-sequence rules, split fallback selection, coercion, cascade, and failures.
  • Human-readable and versioned structured JSON output with safe redaction/escaping.

Relevant specification sections

  • §2 all Rev 3 attributes.
  • §3.4–3.8 resolution, projection/querying, cardinality, fallback, and formatting.
  • §4 JSONPath querying/YAML projection.

Dependencies and blockers

Implementation considerations

  • Keep runners/renderers separate from Argument Parser structs for direct Swift Testing.
  • Avoid printing credentials, denied contents, full sensitive values, or unbounded nodelists.
  • Surface RFC object-enumeration ordering caveats and configured query limits without implying stronger determinism.
  • Provide stable reference identifiers based on document/source location.
  • Consume provenance emitted by Core rather than recomputing semantics.

Acceptance Criteria

  • Users can inspect all references in a file/tree without mutation.
  • Explain covers source resolution, query-argument projection, JSONPath/functions, nodelist/cardinality, selection, split fallback, coercion, cascade, expected cache, and status.
  • Output includes <fm-format> and both scalar/list references using raw decoded/authored query representations safely.
  • JSON output is versioned, deterministic within RFC guarantees, source-located, parseable, and unstyled.
  • Denied/sensitive sources and large query results are redacted/bounded appropriately.
  • No inspect/explain path writes files.

Test requirements

  • Parser/runner/renderer tests, structured-output decoding, multi-file ordering, nodelist/cardinality cases, query limits, selector ambiguity, redaction, and process boundary tests.

Documentation / CLI-help impact

  • CLI help, DocC, README examples, and structured report field definitions using Rev 3 terminology.

Explicitly deferred

  • Validation exit policy, writes, interactive selection, editor UI, network enablement, and browser hydration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions