Skip to main content

Crate coding_tools

Crate coding_tools 

Source
Expand description

Shared library for the coding_tools command-line suite.

The binaries (ct and the ct-* tools it dispatches to) are thin front-ends over the reusable, doctested pieces collected here.

Cross-cutting surfaces, used by several commands:

  • pattern — the shared substring → glob → regex promotion that every pattern-accepting option uses.
  • walk — the shared file-selection predicates (--base/--name/--type /--size/--hidden/--follow) that ct-search/ct-edit/ct-patch/ ct-tree target with.
  • verdict — the shared SUCCESS/ERROR outcome, its exit-status mapping, and the count Expectation that frames a search/edit/patch as a pass/fail test.
  • template — the {TOKEN} substitution engine behind every --emit verdict template.
  • allowlistct-test’s fixed, read-only command allow-gate.
  • explain — the --explain agent-documentation format selector.

Per-command surfaces (the pure logic each ct-* tool is built on):

  • viewct-view’s range parsing and context-window merging.
  • treect-tree’s line/word/character counts and grouping.
  • editct-edit’s line-scoped, byte-preserving replacement engine.
  • patchct-patch’s node-path / predicate / value parsing.
  • testrunct-test’s --focus output distiller.

Modules§

allowlist
ct-test’s command allow-gate.
edit
The per-file replacement engine behind ct-edit: a line-scoped find/replace that preserves every untouched byte (line terminators, indentation, and surrounding text) and records the changed lines.
explain
The --explain agent-documentation format selector.
patch
ct-patch’s structured-edit engine for JSON / JSONC / JSONL / YAML.
pattern
Substring → glob → regex pattern promotion, shared by every tool option that accepts a pattern.
template
Token substitution for --emit verdict templates, shared by every tool.
testrun
Pure helpers behind ct-test’s output handling — currently the --focus distiller, which reduces a captured stream to the lines that matter.
tree
Pure helpers behind ct-tree’s reporting: per-file line/word/character counts, the metric-bound predicate, and the immediate-parent grouping used by the per-folder predicate and the directory summary.
verdict
The shared framed-verdict spine: the SUCCESS/ERROR outcome every tool emits, its 0/1 exit-status mapping, and the Expectation that turns a search’s match count into a Verdict.
view
Pure line-selection helpers behind ct-view’s bounded, context-aware reads: parsing a --range spec, expanding --match hits into context windows, and grouping the kept line indices into contiguous runs for display.
walk
Shared file-selection traversal.