/** * The `peaks …` runs a dispatch prompt carries, cut out of prose. * * Extraction only: it finds the runs, keeps the quotation boundaries that make a * quoted command quoted, and hands back tokens. It knows nothing about which * commands exist — that half lives in `./dispatch-cli-invocation-check.ts`. The * split is the repository's file-cap rule rather than a design statement. * * THE RUN BOUNDARY. A run ends at the backtick that closed its quotation, or at * a line break no continuation follows. Both ends matter: without the backtick * the sentence after a quoted command would be read as its arguments, and * without the continuation rule a wrapped invocation is read only to its first * line — a FALSE NEGATIVE that still reports clean, measured on the real corpus * text `peaks workflow verify-pipeline --rid ` wrapping onto * `--project --type `. * * THE CASE IS DELIBERATE. Matching is case-sensitive, and the decision is * measured: the corpus carries 51 lines using `Peaks` as this project's own name * in prose (`… bypassed Peaks worktree governance`, `the active Peaks skill`) and * NOT ONE of them is an invocation. Matching them case-insensitively would add 51 * findings — 47 that happen to resolve onto a command word and read clean, and 4 * that resolve onto nothing and would warn — every one of them on prose. * * COST IS BOUNDED IN TWO PLACES, both put there by a measurement on * caller-supplied text, and both recorded on the functions that carry them. * * CITATIONS. This file names the SHAPE of a corpus record rather than the record; * the tests name the record in full. That is not tidiness, it is a collision * between two of this campaign's own rules, and it has now bitten twice in one * night on two different slices. The rule that a red-direction case be built from * the REAL input makes a source comment want to cite the record it came from, and * real records are named with a request-id prefix — the very substring the * comment-hygiene marker for a request id matches. So the citation that gives a * reader the evidence is the line that raises a ceiling. Putting it in the test * file resolves it in the right direction: `tests/**` is outside the * comment-hygiene scope, the case is built from that record anyway, and the * source keeps the shape. A wording bent around the detector would have lowered * the ceiling by making the guard unable to see the case that raised it. */ /** * How much of a run is read, in characters. * * Without it a prompt carrying many invocations on one long line makes the scan * quadratic, because a run ends only at a delimiter: the 1772 runs in the corpus * never exceed 167 characters (mean 36.4), but a synthetic 123 KB prompt with * 5024 invocations on a single line took 7.2 seconds and an 800 KB one exhausted * a 4 GB heap. Its cost is stated rather than hidden: a run longer than this is * read only to the bound, so a flag spelled past it is not seen. */ export declare const PROMPT_CLI_RUN_LIMIT = 512; /** One `peaks …` run found in a prompt. */ export interface PromptCliInvocation { /** The run with the command word restored, as the prompt spells it. */ readonly text: string; /** The run's whitespace-separated tokens, each with trailing sentence punctuation trimmed. */ readonly tokens: readonly string[]; } /** * Every invocation of this CLI that `text` carries, in the order it carries them. * * A run end already found is reused by every later match inside it, because the * first delimiter after a later start is the same one. That reuse is the second * half of the cost bound: measured, 50024 invocations on one 958 KB line took * 4216 ms without it and 53 ms with it. */ export declare function extractPromptCliInvocations(text: string): PromptCliInvocation[];