Skip to main content

Module ls

Module ls 

Source
Expand description

grex ls — read-only tree listing of the pack graph.

Walks the workspace from a root pack.yaml without cloning, fetching, or executing anything. The actual walk is delegated to the shared grex_core::build_ls_tree backend so the CLI and the MCP ls tool stay byte-aligned (FIX-2 deduplication of the v1.1.1 reviewer findings). This file owns only argument plumbing, error-envelope shaping, and the human-mode renderer.

Output:

  • Default — box-drawing tree, one node per line, (<type>) suffix per node, ~ prefix on synthetic packs and (scripted, synthetic) in their suffix. Unsynced declared children render as <name> (declared, unsynced). Children whose on-disk .grex/pack.yaml failed to parse/read render with an [error: parse] (or read / other) suffix and the underlying detail is echoed to stderr by the shared backend.
  • --json{"workspace": "<abs>", "tree": [<node>, ...]} envelope pretty-printed via serde_json. Each node carries {id, name, path, type, synthetic, children} plus, when relevant, unsynced: true or error: {kind, message}.

Errors loading the root manifest surface as a structured envelope in JSON mode and as stderr + exit 2 in human mode, matching the sync verb’s usage convention. The envelope’s kind is "tree" (matching the documented per-verb taxonomy in man/reference/cli-json.md — FIX-5).

Functions§

run