Expand description
mandible-core: the shared intermediate representation (IR) every mandible
extraction tier normalizes into, and the merge logic that combines
several tiers’ output for the same node into one.
See spec §4. This crate has no knowledge of any specific tool, tier, or terminal library — it is pure data model plus the sanitization and merge rules that keep that data model trustworthy.
Structs§
- Authority
- The two-axis trust level a
Sourcecarries. See spec §4.4’s authority table — the tier with the best structure is frequently not the tier with the best prose, so merge resolves each axis independently rather than by a single priority order. - Command
Node - One command or subcommand in the tree:
git,git rebase,git rebase --onto’s parent, and so on. - Example
- A worked example: a command line plus an optional explanation.
- Flag
- A single flag/option, e.g.
-i, --interactive. - Positional
- A positional argument, e.g.
<pathspec>.... - Provenance
- Which extraction source(s) contributed to an item, in contribution order, plus a confidence score set only by heuristic tiers.
- Text
- Sanitized, display-safe text.
Enums§
- Axis
- One axis of
Authority: structural facts (names, nesting, arity, which flags exist) vs. prose (descriptions, summaries, examples). - FlagKey
- Identifies a flag within a node’s flag list.
- ManFormat
- Which man page macro package produced a
Source::ManPageitem. - Merge
Error - Errors merge can return.
- NodeRef
- A reference to a command or a specific flag within the tree, by name path.
- Source
- The origin of a piece of extracted data. See spec §4.2 and §7.
- Value
Kind - Whether a flag takes a value, and if so, whether it’s required.
Constants§
- MAX_
TEXT_ CHARS - Hard cap on sanitized text length, in
chars. Applied after all other normalization. Generous enough for any legitimate flag description or man page section, small enough that a pathological multi-megabyte string from a misbehaving tool cannot make its way into a render buffer.
Functions§
- is_
command_ name_ shaped - True if
slooks like a real command/subcommand name: lowercase, starting with a letter, and otherwise only letters/digits/_/./-(^[a-z][a-z0-9_.-]*$, spec §7 Tier B rule 3). - merge_
flag_ lists - Merge flags by identity (long name, else short letter, else description-as-fallback) across several already alias-paired flag lists, applying the same two-axis authority resolution per field.
- merge_
nodes - Merge several same-node extraction results into one, per spec §4.4.
- merge_
positional_ lists - Merge positionals across candidate lists by name identity.
- merge_
subcommand_ lists - Merge subcommand lists recursively by name (spec §4.4: “Subcommands merge recursively by name”).
- pair_
aliases - Unify flags that arrived as separate short/long rows from the same
source, per spec §4.4: sources legitimately emit a flag’s short and long
forms as distinct items (e.g.
gh __complete pr -returns--repoand-Ras separate rows with identical descriptions). Within one node’s flag list, items whose descriptions match exactly and whose short/long slots are complementary unify into oneFlag. Must run before merge. - resolve
- Resolve a name path to the
CommandNodeit addresses, starting fromroot.pathincludesroot’s own name as its first element. - resolve_
flag - Resolve a
NodeRefto the flag it addresses, if any. - resolve_
mut - Mutable counterpart of
resolve, used by the extraction runner to splice a newly-extracted subtree into the cached tree in place.