Skip to main content

coding_tools/
lib.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2026 Jonathan Shook
3
4//! Shared library for the `coding_tools` command-line suite.
5//!
6//! The binaries (`ct` and the `ct-*` tools it dispatches to) are thin
7//! front-ends over the reusable, doctested pieces collected here.
8//!
9//! Cross-cutting surfaces, used by several commands:
10//!
11//! * [`pattern`] — the shared substring → glob → regex promotion that every
12//!   pattern-accepting option uses.
13//! * [`walk`] — the shared file-selection predicates (`--base`/`--name`/`--type`
14//!   /`--size`/`--hidden`/`--follow`) that `ct-search`/`ct-edit`/`ct-patch`/
15//!   `ct-tree` target with.
16//! * [`verdict`] — the shared `SUCCESS`/`ERROR` outcome, its exit-status
17//!   mapping, and the count [`Expect`](verdict::Expect)ation that frames a
18//!   search/edit/patch as a pass/fail test.
19//! * [`template`] — the `{TOKEN}` substitution engine behind every `--emit`
20//!   verdict template.
21//! * [`payload`] — the `file:` / `text:` value schemes every payload-typed
22//!   option resolves through.
23//! * [`block`] — line-anchored literal block matching (and the nearest-miss
24//!   diagnostic) behind multi-line patterns in `ct-search`/`ct-view`/`ct-edit`.
25//! * [`blockdoc`] — the `.ctb` block-document parser behind `ct-edit --script`.
26//! * [`editscript`] — the `--script` batch engine: compiled edits simulated
27//!   in memory under the prepare/confirm/write standard.
28//! * [`allowlist`] — the fixed command allow-gates behind `ct-test` and
29//!   `ct-each`.
30//! * [`explain`] — the `--explain` agent-documentation format selector.
31//! * [`pulse`] — the `--timeout` watchdog and `--heartbeat` liveness pulse
32//!   every tool carries.
33//! * [`rules`] — the `.ct/rules.jsonc` invariant surface shared by
34//!   `ct-rules` and `ct-check`: store model, defs, probe gate, the external
35//!   bridge, and outcome adapters.
36//! * [`supervise`] — bounded, captured child execution for the dispatching
37//!   tools (`ct-test`, `ct-each`), including suite sibling resolution.
38//!
39//! Per-command surfaces (the pure logic each `ct-*` tool is built on):
40//!
41//! * [`deps`] — the `deps` built-in check's crate-graph queries over `cargo
42//!   metadata` (including its in-process [`deps::check`] entry point).
43//! * [`modgraph`] — the `mods` built-in check's heuristic intra-crate module-use
44//!   graph, reusing [`deps`]'s assertions at module granularity.
45//! * [`okf`] — Open Knowledge Format support: frontmatter parsing, bundle
46//!   conformance, cross-link checking, and the `okf` built-in check, shared by
47//!   `ct-okf` and the OKF-aware file/structure tools.
48//! * [`okfscript`] — the `ct-okf --script` batch engine: `.ctb` OKF mutations
49//!   simulated over an in-memory overlay under the prepare/confirm/write standard.
50//! * [`outline`] — `ct-outline`'s heuristic per-language declaration
51//!   detection.
52//! * [`view`] — `ct-view`'s range parsing and context-window merging.
53//! * [`tree`] — `ct-tree`'s line/word/character counts and grouping.
54//! * [`edit`] — `ct-edit`'s line-scoped, byte-preserving replacement engine.
55//! * [`patch`] — `ct-patch`'s node-path / predicate / value parsing.
56//! * [`testrun`] — `ct-test`'s `--focus` output distiller.
57
58pub mod allowlist;
59pub mod block;
60pub mod blockdoc;
61pub mod cli;
62pub mod completion;
63pub mod deps;
64pub mod edit;
65pub mod editscript;
66pub mod explain;
67pub mod jsonout;
68pub mod modgraph;
69pub mod okf;
70pub mod okfscript;
71pub mod outline;
72pub mod patch;
73pub mod pattern;
74pub mod payload;
75pub mod pulse;
76pub mod rules;
77pub mod supervise;
78pub mod template;
79pub mod testrun;
80pub mod tree;
81pub mod verdict;
82pub mod view;
83pub mod walk;