@mmnto/totem 1.19.0 → 1.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -50,7 +50,7 @@ export interface Stage4Baseline {
50
50
  /**
51
51
  * Glob patterns the rule MUST NOT fire on. Files matching any of these
52
52
  * globs are part of the verification baseline — a match on one of them
53
- * is evidence the pattern is over-broad. T1 ships with `DEFAULT_BASELINE_GLOBS`
53
+ * is evidence the pattern is over-broad. T1 shipped with `DEFAULT_BASELINE_GLOBS`
54
54
  * (test + fixture patterns); T2 (mmnto-ai/totem#1683) layers consumer
55
55
  * `extend` / `exclude` overrides via `review.stage4Baseline` config.
56
56
  *
@@ -59,6 +59,25 @@ export interface Stage4Baseline {
59
59
  * from `rule.fileGlobs` at evaluation time.
60
60
  */
61
61
  readonly excludeFileGlobs: readonly string[];
62
+ /**
63
+ * Provenance: globs added via `# stage4-baseline:` directives in the
64
+ * consumer's `.totemignore` file. Empty when no such directives. Read
65
+ * by `totem doctor` (T4) and trace events; the verifier itself only
66
+ * reads `excludeFileGlobs`.
67
+ */
68
+ readonly extendedFromIgnoreFile: readonly string[];
69
+ /**
70
+ * Provenance: globs added via `review.stage4Baseline.extend` in
71
+ * `totem.config.ts`. Empty when not configured.
72
+ */
73
+ readonly extendedFromConfig: readonly string[];
74
+ /**
75
+ * Provenance: globs removed from the default baseline via
76
+ * `review.stage4Baseline.exclude` in `totem.config.ts`. Empty when not
77
+ * configured. Useful for diagnosing why a rule fires on a path the
78
+ * consumer expected to be in the baseline.
79
+ */
80
+ readonly excludedFromConfig: readonly string[];
62
81
  }
63
82
  export type Stage4Outcome = 'no-matches' | 'out-of-scope' | 'in-scope-bad-example' | 'candidate-debt';
64
83
  export interface Stage4VerificationResult {
@@ -110,7 +129,81 @@ export interface Stage4VerifierDeps {
110
129
  * project legitimately treats `tests/` as production.
111
130
  */
112
131
  export declare const DEFAULT_BASELINE_GLOBS: readonly string[];
132
+ /**
133
+ * Backwards-compatible shorthand for `resolveStage4Baseline({})`. Returns the
134
+ * default baseline (test + fixture globs) with empty provenance arrays. Kept
135
+ * because pre-T2 callers (early CLI integration sites, tests) pass no
136
+ * overrides; new callers should prefer `resolveStage4Baseline` directly so
137
+ * config + .totemignore overrides flow through.
138
+ */
113
139
  export declare function getDefaultBaseline(): Stage4Baseline;
140
+ /**
141
+ * Static manifest paths excluded from Stage 4 corpus to prevent rules with
142
+ * a `badExample` field from self-matching against their own entry in the
143
+ * compiled manifest. CLI integration (`packages/cli/src/commands/compile.ts`)
144
+ * additionally computes a `totemDir`-aware path at runtime
145
+ * (`path.join(config.totemDir, 'compiled-rules.json')` normalized to forward
146
+ * slashes) and adds it to the exclusion set so consumers who override
147
+ * `config.totemDir` are covered too.
148
+ */
149
+ export declare const STAGE4_MANIFEST_EXCLUSIONS: readonly string[];
150
+ export interface ResolveStage4BaselineInput {
151
+ /** Globs parsed from `# stage4-baseline:` directives in `.totemignore`. */
152
+ readonly ignoreDirectives?: readonly string[];
153
+ /** Globs from `review.stage4Baseline.extend` in `totem.config.ts`. */
154
+ readonly configExtend?: readonly string[];
155
+ /** Globs from `review.stage4Baseline.exclude` in `totem.config.ts`. */
156
+ readonly configExclude?: readonly string[];
157
+ }
158
+ /**
159
+ * Compute the effective Stage 4 baseline for a compile run.
160
+ *
161
+ * Composition: `defaults ∪ ignoreDirectives ∪ configExtend ∖ configExclude`.
162
+ * `configExclude` is set-difference (LAST), so a consumer can remove a
163
+ * default baseline glob like `**\/tests/**` when their project legitimately
164
+ * treats `tests/` as production. Set membership uses byte-equal comparison
165
+ * on the glob string, NOT path matching — `exclude: ['**\/tests/**']`
166
+ * removes that exact default entry, not every glob that happens to match
167
+ * a `tests/` path.
168
+ *
169
+ * Pure function. Does NOT read the filesystem; the CLI integration site
170
+ * reads `.totemignore` and parses it via `parseStage4BaselineDirectives`
171
+ * before passing the directives in.
172
+ *
173
+ * @param input - The three composition inputs (all optional / default to `[]`).
174
+ * @returns A `Stage4Baseline` whose `excludeFileGlobs` is consumed by the
175
+ * verifier and whose three provenance arrays are read by `totem doctor`
176
+ * (T4 / `mmnto-ai/totem#1685`) and trace events.
177
+ */
178
+ export declare function resolveStage4Baseline(input: ResolveStage4BaselineInput): Stage4Baseline;
179
+ /**
180
+ * Extract `# stage4-baseline: <glob>` directives from `.totemignore` content
181
+ * (or any line-oriented text). The leading `#` is REQUIRED — the directive
182
+ * lives on a comment line so it doesn't interfere with the rest of
183
+ * `.totemignore`'s ignore semantics. Variable whitespace around the `#`,
184
+ * the colon, and the body is allowed; the regex collapses it.
185
+ *
186
+ * Returns the globs in source order. Empty / whitespace-only directive
187
+ * bodies are skipped silently (no throw). The directive name is
188
+ * case-sensitive to match `.totemignore`'s overall convention.
189
+ *
190
+ * Pure function (`string → string[]`) so it can be invoked from any core
191
+ * consumer. CLI reads the file and hands the content to this helper;
192
+ * MCP integrations may want the same surface in the future.
193
+ *
194
+ * @param content - Raw `.totemignore` text (or any line-oriented content).
195
+ * Empty or undefined returns `[]`. CRLF and LF line endings both work.
196
+ * @returns Glob strings extracted from `# stage4-baseline:` lines, in
197
+ * source order, excluding empty/whitespace-only directive bodies.
198
+ *
199
+ * @example
200
+ * ```ts
201
+ * parseStage4BaselineDirectives('# stage4-baseline: build/**\nsrc/temp/**');
202
+ * // → ['build/**'] (only the directive line; 'src/temp/**' is ordinary
203
+ * // .totemignore content, not a stage4 directive)
204
+ * ```
205
+ */
206
+ export declare function parseStage4BaselineDirectives(content: string): string[];
114
207
  /**
115
208
  * Run Stage 4 verification for a single compiled rule against the consumer's
116
209
  * codebase. Caller decides what to do with the returned outcome:
@@ -1 +1 @@
1
- {"version":3,"file":"stage4-verifier.d.ts","sourceRoot":"","sources":["../src/stage4-verifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,OAAO,KAAK,EAAE,YAAY,EAA2B,MAAM,sBAAsB,CAAC;AAClF,OAAO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AM,EAOnD,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,kBAAkB,IAAI,cAAc,CAEnD;AAID;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B,EAAE,SAAS,MAAM,EAAmC,CAAC;AAI5F,MAAM,WAAW,0BAA0B;IACzC,2EAA2E;IAC3E,QAAQ,CAAC,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9C,sEAAsE;IACtE,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,uEAAuE;IACvE,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5C;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,GAAG,cAAc,CAgBvF;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAWvE;AA0KD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,YAAY,EAClB,QAAQ,EAAE,cAAc,EACxB,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,wBAAwB,CAAC,CA2FnC"}
@@ -44,7 +44,7 @@
44
44
  * orchestration-only. CLI implementations back the callbacks with `git
45
45
  * ls-files` and `fs.readFile`; tests stub them with synthetic file maps.
46
46
  */
47
- import { applyAstRulesToAdditions, applyRulesToAdditions } from './rule-engine.js';
47
+ import { applyAstRulesToAdditions, applyRulesToAdditions, fileMatchesGlobs, } from './rule-engine.js';
48
48
  // ─── Default baseline ───────────────────────────────
49
49
  /**
50
50
  * Glob shapes the test-contract scope classifier (mmnto-ai/totem#1626 /
@@ -62,74 +62,108 @@ export const DEFAULT_BASELINE_GLOBS = [
62
62
  '**/__fixtures__/**',
63
63
  '**/fixtures/**',
64
64
  ];
65
+ /**
66
+ * Backwards-compatible shorthand for `resolveStage4Baseline({})`. Returns the
67
+ * default baseline (test + fixture globs) with empty provenance arrays. Kept
68
+ * because pre-T2 callers (early CLI integration sites, tests) pass no
69
+ * overrides; new callers should prefer `resolveStage4Baseline` directly so
70
+ * config + .totemignore overrides flow through.
71
+ */
65
72
  export function getDefaultBaseline() {
66
- // T1: the default baseline is rule-independent (every rule gets the same
67
- // test/fixture exclusion). T2 (mmnto-ai/totem#1683) introduces per-config
68
- // `extend`/`exclude` overrides; the function signature accepts a rule
69
- // parameter then so per-rule baseline derivation can layer on top.
70
- return { excludeFileGlobs: DEFAULT_BASELINE_GLOBS };
73
+ return resolveStage4Baseline({});
71
74
  }
72
- // ─── Glob matching (matches rule-engine semantics)
73
- function matchesGlob(filePath, glob) {
74
- // Normalize Windows backslashes to forward slashes globs use forward
75
- // slashes universally, repo paths come back from git-ls-files in either
76
- // shape on Windows depending on core.autocrlf.
77
- const normalized = filePath.replace(/\\/g, '/');
78
- // Exact glob match escape regex metacharacters except `*`, `?`, and
79
- // brace groups, then expand `**` to `.*`, `*` to `[^/]*`, `?` to `.`.
80
- if (glob.includes('*') || glob.includes('?') || glob.includes('{')) {
81
- const regexPattern = globToRegex(glob);
82
- return new RegExp(`^${regexPattern}$`).test(normalized);
83
- }
84
- // Literal filename match (e.g., "Dockerfile")
85
- return normalized === glob || normalized.endsWith('/' + glob);
75
+ // ─── Manifest exclusions (mmnto-ai/totem#1765) ──────
76
+ /**
77
+ * Static manifest paths excluded from Stage 4 corpus to prevent rules with
78
+ * a `badExample` field from self-matching against their own entry in the
79
+ * compiled manifest. CLI integration (`packages/cli/src/commands/compile.ts`)
80
+ * additionally computes a `totemDir`-aware path at runtime
81
+ * (`path.join(config.totemDir, 'compiled-rules.json')` normalized to forward
82
+ * slashes) and adds it to the exclusion set so consumers who override
83
+ * `config.totemDir` are covered too.
84
+ */
85
+ export const STAGE4_MANIFEST_EXCLUSIONS = ['.totem/compiled-rules.json'];
86
+ /**
87
+ * Compute the effective Stage 4 baseline for a compile run.
88
+ *
89
+ * Composition: `defaults ∪ ignoreDirectives ∪ configExtend ∖ configExclude`.
90
+ * `configExclude` is set-difference (LAST), so a consumer can remove a
91
+ * default baseline glob like `**\/tests/**` when their project legitimately
92
+ * treats `tests/` as production. Set membership uses byte-equal comparison
93
+ * on the glob string, NOT path matching — `exclude: ['**\/tests/**']`
94
+ * removes that exact default entry, not every glob that happens to match
95
+ * a `tests/` path.
96
+ *
97
+ * Pure function. Does NOT read the filesystem; the CLI integration site
98
+ * reads `.totemignore` and parses it via `parseStage4BaselineDirectives`
99
+ * before passing the directives in.
100
+ *
101
+ * @param input - The three composition inputs (all optional / default to `[]`).
102
+ * @returns A `Stage4Baseline` whose `excludeFileGlobs` is consumed by the
103
+ * verifier and whose three provenance arrays are read by `totem doctor`
104
+ * (T4 / `mmnto-ai/totem#1685`) and trace events.
105
+ */
106
+ export function resolveStage4Baseline(input) {
107
+ const ignoreDirectives = input.ignoreDirectives ?? [];
108
+ const configExtend = input.configExtend ?? [];
109
+ const configExclude = input.configExclude ?? [];
110
+ const excludeSet = new Set(DEFAULT_BASELINE_GLOBS);
111
+ for (const g of ignoreDirectives)
112
+ excludeSet.add(g);
113
+ for (const g of configExtend)
114
+ excludeSet.add(g);
115
+ for (const g of configExclude)
116
+ excludeSet.delete(g);
117
+ return {
118
+ excludeFileGlobs: [...excludeSet],
119
+ extendedFromIgnoreFile: [...ignoreDirectives],
120
+ extendedFromConfig: [...configExtend],
121
+ excludedFromConfig: [...configExclude],
122
+ };
86
123
  }
87
- function globToRegex(glob) {
88
- let result = '';
89
- let i = 0;
90
- while (i < glob.length) {
91
- const ch = glob[i];
92
- if (ch === '*') {
93
- if (glob[i + 1] === '*') {
94
- result += '.*';
95
- i += 2;
96
- // Consume trailing `/` if present so `**/foo` becomes `.*foo`
97
- if (glob[i] === '/')
98
- i++;
99
- continue;
100
- }
101
- result += '[^/]*';
102
- }
103
- else if (ch === '?') {
104
- result += '[^/]';
105
- }
106
- else if (ch === '{') {
107
- const end = glob.indexOf('}', i);
108
- if (end === -1) {
109
- result += '\\{';
110
- }
111
- else {
112
- const alts = glob.slice(i + 1, end).split(',');
113
- result += '(?:' + alts.map(escapeRegex).join('|') + ')';
114
- i = end + 1;
115
- continue;
116
- }
117
- }
118
- else if ('.+()[]^$|\\'.includes(ch)) {
119
- result += '\\' + ch;
120
- }
121
- else {
122
- result += ch;
123
- }
124
- i++;
124
+ // ─── .totemignore directive parser (mmnto-ai/totem#1683)
125
+ const STAGE4_BASELINE_DIRECTIVE_RE = /^#\s*stage4-baseline:\s*(.+?)\s*$/;
126
+ /**
127
+ * Extract `# stage4-baseline: <glob>` directives from `.totemignore` content
128
+ * (or any line-oriented text). The leading `#` is REQUIRED — the directive
129
+ * lives on a comment line so it doesn't interfere with the rest of
130
+ * `.totemignore`'s ignore semantics. Variable whitespace around the `#`,
131
+ * the colon, and the body is allowed; the regex collapses it.
132
+ *
133
+ * Returns the globs in source order. Empty / whitespace-only directive
134
+ * bodies are skipped silently (no throw). The directive name is
135
+ * case-sensitive to match `.totemignore`'s overall convention.
136
+ *
137
+ * Pure function (`string → string[]`) so it can be invoked from any core
138
+ * consumer. CLI reads the file and hands the content to this helper;
139
+ * MCP integrations may want the same surface in the future.
140
+ *
141
+ * @param content - Raw `.totemignore` text (or any line-oriented content).
142
+ * Empty or undefined returns `[]`. CRLF and LF line endings both work.
143
+ * @returns Glob strings extracted from `# stage4-baseline:` lines, in
144
+ * source order, excluding empty/whitespace-only directive bodies.
145
+ *
146
+ * @example
147
+ * ```ts
148
+ * parseStage4BaselineDirectives('# stage4-baseline: build/**\nsrc/temp/**');
149
+ * // → ['build/**'] (only the directive line; 'src/temp/**' is ordinary
150
+ * // .totemignore content, not a stage4 directive)
151
+ * ```
152
+ */
153
+ export function parseStage4BaselineDirectives(content) {
154
+ if (!content)
155
+ return [];
156
+ const out = [];
157
+ for (const rawLine of content.split(/\r?\n/)) {
158
+ const match = STAGE4_BASELINE_DIRECTIVE_RE.exec(rawLine);
159
+ if (!match)
160
+ continue;
161
+ const body = match[1]?.trim() ?? '';
162
+ if (body.length === 0)
163
+ continue;
164
+ out.push(body);
125
165
  }
126
- return result;
127
- }
128
- function escapeRegex(s) {
129
- return s.replace(/[.+()[\]^$|\\*?{}]/g, '\\$&');
130
- }
131
- function fileMatchesAnyGlob(filePath, globs) {
132
- return globs.some((g) => matchesGlob(filePath, g));
166
+ return out;
133
167
  }
134
168
  /**
135
169
  * A file is "in scope" for Stage 4 verification when it matches the rule's
@@ -138,19 +172,53 @@ function fileMatchesAnyGlob(filePath, globs) {
138
172
  * inside `**\/*.ts` scope counts as baseline, not in-scope, because the
139
173
  * verifier's job is to detect over-broad firing — including on tests the
140
174
  * rule is supposed to skip.
175
+ *
176
+ * Glob matching delegates to `fileMatchesGlobs` from `rule-engine.ts`
177
+ * (mmnto-ai/totem#1758) — single source of truth for glob semantics
178
+ * across rule classification and Stage 4 baseline classification. The
179
+ * earlier local regex-conversion matcher had a substring hole
180
+ * (`**\/tests/**` would match `src/contests/foo.ts`) which the
181
+ * pattern-specific matcher in rule-engine fixes by construction.
141
182
  */
142
183
  function classifyFile(filePath, ruleFileGlobs, baseline) {
143
184
  // Rule has explicit fileGlobs and this file doesn't match → baseline (out-of-scope).
144
185
  if (ruleFileGlobs && ruleFileGlobs.length > 0) {
145
- const positive = ruleFileGlobs.filter((g) => !g.startsWith('!'));
146
- const negative = ruleFileGlobs.filter((g) => g.startsWith('!')).map((g) => g.slice(1));
147
- const matchesPositive = positive.length === 0 || fileMatchesAnyGlob(filePath, positive);
148
- const matchesNegative = fileMatchesAnyGlob(filePath, negative);
149
- if (!matchesPositive || matchesNegative)
186
+ if (!fileMatchesGlobs(filePath, ruleFileGlobs))
150
187
  return 'baseline';
151
188
  }
152
189
  // File matches rule scope (or rule has no scope). Now check baseline overrides.
153
- if (fileMatchesAnyGlob(filePath, baseline.excludeFileGlobs))
190
+ //
191
+ // Subtract rule-declared scope from the baseline first (CR mmnto-ai/totem#1766 R3).
192
+ // A rule that explicitly scopes itself to test or fixture files (e.g.
193
+ // `fileGlobs: ['**/*.test.*']` for a test-contract rule) needs to fire
194
+ // on those exact files. If the baseline contains the same glob (the
195
+ // default `DEFAULT_BASELINE_GLOBS` includes `**/*.test.*`), then without
196
+ // this subtraction every match the rule produces on its intended corpus
197
+ // is classified as baseline → the outcome flips to `out-of-scope` and
198
+ // the rule is archived on its own scope. Byte-equal subtraction is
199
+ // consistent with `resolveStage4Baseline`'s `exclude` semantics: an
200
+ // explicit `fileGlobs` entry that matches a baseline entry is the rule's
201
+ // way of claiming that part of the baseline as its own.
202
+ const effectiveBaselineGlobs = ruleFileGlobs && ruleFileGlobs.length > 0
203
+ ? baseline.excludeFileGlobs.filter((g) => !ruleFileGlobs.includes(g))
204
+ : baseline.excludeFileGlobs;
205
+ // Guard against empty positive set explicitly. `fileMatchesGlobs` has
206
+ // default-allow semantics when its positive-glob set is empty (returns
207
+ // `true` so a rule with empty fileGlobs runs everywhere — that's the
208
+ // rule-engine's contract). Stage 4's baseline doesn't share that
209
+ // contract: an empty positive set means "nothing positively baseline-
210
+ // excluded", not "everything is baseline-excluded."
211
+ //
212
+ // Three empty-positive cases land here in practice:
213
+ // 1. Consumer `exclude`-s every default baseline glob → `excludeFileGlobs`
214
+ // is fully empty (Sonnet R0 catch).
215
+ // 2. Consumer `extend`-s with only `!`-prefixed entries AND `exclude`-s
216
+ // every default → `excludeFileGlobs` has only negatives, no positives
217
+ // (GCA mmnto-ai/totem#1766 R1 catch).
218
+ // 3. Rule `fileGlobs` covers every positive baseline entry → after the
219
+ // R3 subtraction above, `effectiveBaselineGlobs` has no positives.
220
+ const hasPositiveBaseline = effectiveBaselineGlobs.some((g) => !g.startsWith('!'));
221
+ if (hasPositiveBaseline && fileMatchesGlobs(filePath, effectiveBaselineGlobs))
154
222
  return 'baseline';
155
223
  return 'in-scope';
156
224
  }
@@ -1 +1 @@
1
- {"version":3,"file":"stage4-verifier.js","sourceRoot":"","sources":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