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//! * [`steer`] — the redirection analyzer behind `ct-steer`: classify a shell
39//! command into the `ct` tool that serves it, the `PreToolUse` hook protocol,
40//! and the `.claude/settings.json` install/uninstall merge.
41//!
42//! Per-command surfaces (the pure logic each `ct-*` tool is built on):
43//!
44//! * [`deps`] — the `deps` built-in check's crate-graph queries over `cargo
45//! metadata` (including its in-process [`deps::check`] entry point).
46//! * [`modgraph`] — the `mods` built-in check's heuristic intra-crate module-use
47//! graph, reusing [`deps`]'s assertions at module granularity.
48//! * [`okf`] — Open Knowledge Format support: frontmatter parsing, bundle
49//! conformance, cross-link checking, and the `okf` built-in check, shared by
50//! `ct-okf` and the OKF-aware file/structure tools.
51//! * [`okfindex`] — the lazily-maintained fst-segment full-text index over OKF
52//! concept files behind `ct-okf search` (incremental layering + condense).
53//! * [`okfroots`] — OKF content-root discovery (`.okf` markers, `okf_version`
54//! index files, `.ct/okf.jsonc` config) and the concept-file feed for the index.
55//! * [`okfscript`] — the `ct-okf --script` batch engine: `.ctb` OKF mutations
56//! simulated over an in-memory overlay under the prepare/confirm/write standard.
57//! * [`outline`] — `ct-outline`'s heuristic per-language declaration
58//! detection.
59//! * [`view`] — `ct-view`'s range parsing and context-window merging.
60//! * [`tree`] — `ct-tree`'s line/word/character counts and grouping.
61//! * [`edit`] — `ct-edit`'s line-scoped, byte-preserving replacement engine.
62//! * [`patch`] — `ct-patch`'s node-path / predicate / value parsing.
63//! * [`testrun`] — `ct-test`'s `--focus` output distiller.
64
65pub mod allowlist;
66pub mod block;
67pub mod blockdoc;
68pub mod cli;
69pub mod completion;
70pub mod deps;
71pub mod edit;
72pub mod editscript;
73pub mod explain;
74pub mod jsonout;
75pub mod modgraph;
76pub mod okf;
77pub mod okfindex;
78pub mod okfroots;
79pub mod okfscript;
80pub mod outline;
81pub mod patch;
82pub mod pattern;
83pub mod payload;
84pub mod pulse;
85pub mod rules;
86pub mod steer;
87pub mod supervise;
88pub mod template;
89pub mod testrun;
90pub mod tree;
91pub mod verdict;
92pub mod view;
93pub mod walk;