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.
  • payload — the file: / text: value schemes every payload-typed option resolves through.
  • block — line-anchored literal block matching (and the nearest-miss diagnostic) behind multi-line patterns in ct-search/ct-view/ct-edit.
  • blockdoc — the .ctb block-document parser behind ct-edit --script.
  • editscript — the --script batch engine: compiled edits simulated in memory under the prepare/confirm/write standard.
  • allowlist — the fixed command allow-gates behind ct-test and ct-each.
  • explain — the --explain agent-documentation format selector.
  • pulse — the --timeout watchdog and --heartbeat liveness pulse every tool carries.
  • rules — the .ct/rules.jsonc invariant surface shared by ct-rules and ct-check: store model, defs, probe gate, the external bridge, and outcome adapters.
  • supervise — bounded, captured child execution for the dispatching tools (ct-test, ct-each), including suite sibling resolution.

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

  • depsct-deps’s crate-graph queries over cargo metadata.
  • outlinect-outline’s heuristic per-language declaration detection.
  • 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
The command allow-gates behind the dispatching tools.
block
Line-anchored literal block matching, shared by ct-search, ct-view, and ct-edit.
blockdoc
The ct block document (.ctb) — the suite’s one script format for batched operations whose payloads are verbatim text.
deps
ct-deps’s crate-graph queries.
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.
editscript
The ct-edit --script engine: a batch of edits applied under the prepare/confirm/write standard.
explain
The --explain agent-documentation format selector.
outline
ct-outline’s heuristic declaration detection.
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.
payload
The file: / text: value schemes shared by every payload-typed option.
pulse
Run-bounding and liveness, shared by every tool: the --timeout watchdog that keeps any run bounded, and the --heartbeat pulse that gives an agent a sign of life during a long one.
rules
The rule surface shared by ct-rules (say what the rules are) and ct-check (verify them): the .ct/rules.jsonc store model, upward discovery, def expansion, the probe gate, the external-tool bridge, and the expect outcome adapters.
supervise
Bounded child-command execution for the dispatching tools (ct-test, ct-each).
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.