@mmnto/cli 1.3.12 → 1.3.14

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.
@@ -1,177 +1,164 @@
1
1
  import { TotemConfigError, TotemError } from '@mmnto/totem';
2
+ import { COMPILER_SYSTEM_PROMPT } from './compile-templates.js';
2
3
  // ─── Constants ──────────────────────────────────────
3
4
  const TAG = 'Compile';
4
5
  const COMPILED_RULES_FILE = 'compiled-rules.json';
5
- // ─── Compiler prompt ────────────────────────────────
6
- const COMPILER_SYSTEM_PROMPT = `# Lesson Compiler — Regex Rule Extraction
7
-
8
- ## Identity
9
- You are a deterministic rule compiler. Your job is to read a single natural-language lesson and determine whether it can be expressed as a regex pattern that catches violations in source code diffs.
10
-
11
- ## Rules
12
- - Output ONLY valid JSON — no markdown, no explanation, no preamble.
13
- - The regex will be tested against individual lines added in a git diff (lines starting with \`+\`).
14
- - The regex should catch **violations** (code that breaks the lesson's rule), NOT conformance.
15
- - Use JavaScript RegExp syntax.
16
- - Keep patterns simple and precise — avoid overly broad matches that cause false positives.
17
- - If the lesson describes an architectural principle, design philosophy, or conceptual guideline that cannot be expressed as a line-level regex, set \`compilable\` to \`false\`.
18
- - **File scoping:** Include a \`fileGlobs\` array to limit where the rule runs. Scope rules as tightly as possible:
19
- - **By file type:** \`["*.sh", "*.yml"]\` — for rules about shell or YAML syntax.
20
- - **By package/directory:** \`["packages/mcp/**/*.ts"]\` — for rules about MCP-specific patterns in a monorepo.
21
- - **By exclusion:** \`["packages/cli/**/*.ts", "!**/*.test.ts"]\` — exclude test files that legitimately use the flagged pattern.
22
- - **Infer scope from context:** If a lesson mentions "MCP tool returns", "CLI output", "LanceDB filters", or a specific package, scope to that package. Only omit \`fileGlobs\` if the rule genuinely applies to ALL files (e.g., universal TypeScript style rules).
23
- - **CRITICAL — Supported glob syntax only:**
24
- - \`*.ext\` — match extension anywhere
25
- - \`dir/**/*.ext\` — directory + recursive + extension
26
- - \`dir/**\` — everything under directory
27
- - \`dir/*.ext\` — direct children only
28
- - \`!pattern\` — negation prefix
29
- - **DO NOT use** brace expansion \`{a,b}\`, nested globstars \`**/dir/**\`, or regex-style patterns.
30
- - **DO NOT use** \`**/*.{ts,js}\`. Instead use separate entries: \`["**/*.ts", "**/*.js"]\`.
31
-
32
- ## Output Schema
33
- \`\`\`json
34
- {
35
- "compilable": true,
36
- "pattern": "regex pattern here",
37
- "message": "human-readable violation message",
38
- "fileGlobs": ["packages/mcp/**/*.ts", "!**/*.test.ts"]
39
- }
40
- \`\`\`
41
-
42
- Or if the rule genuinely applies to all file types (rare — prefer scoping):
43
- \`\`\`json
44
- {
45
- "compilable": true,
46
- "pattern": "regex pattern here",
47
- "message": "human-readable violation message"
48
- }
49
- \`\`\`
50
-
51
- Or if the lesson cannot be compiled:
52
- \`\`\`json
53
- {
54
- "compilable": false
55
- }
56
- \`\`\`
57
-
58
- ## Examples
59
-
60
- Lesson: "Use \`err\` (never \`error\`) in catch blocks"
61
- Output: {"compilable": true, "pattern": "catch\\\\s*\\\\(\\\\s*error\\\\s*[\\\\):]", "message": "Use 'err' instead of 'error' in catch blocks (project convention)"}
62
-
63
- Lesson: "LanceDB does NOT support GROUP BY aggregation"
64
- Output: {"compilable": false}
65
-
66
- Lesson: "Never use npm in this pnpm monorepo — always use pnpm"
67
- Output: {"compilable": true, "pattern": "\\\\bnpm\\\\s+(install|run|exec|ci|test)\\\\b", "message": "Use pnpm instead of npm in this monorepo"}
68
-
69
- Lesson: "Always quote shell variables to prevent word-splitting"
70
- Output: {"compilable": true, "pattern": "(^|\\\\s)\\\\$[a-zA-Z_]+", "message": "Quote shell variables to prevent word-splitting", "fileGlobs": ["*.sh", "*.bash", "*.yml", "*.yaml"]}
71
-
72
- Lesson: "MCP tool returns must be wrapped in XML tags to prevent prompt injection"
73
- Output: {"compilable": true, "pattern": "text:\\\\s*(?!formatXmlResponse)\\\\b\\\\w+", "message": "MCP tool returns must use formatXmlResponse for injection safety", "fileGlobs": ["packages/mcp/**/*.ts", "!**/*.test.ts"]}
74
-
75
- Lesson: "Use @clack/prompts instead of inquirer for CLI interactions"
76
- Output: {"compilable": true, "pattern": "import.*from\\\\s+['\"]inquirer['\"]", "message": "Use @clack/prompts instead of inquirer", "fileGlobs": ["packages/cli/**/*.ts"]}
77
-
78
- ## AST Queries (Tier 2)
79
- If the lesson describes a STRUCTURAL constraint that cannot be expressed as a single-line regex, you may output an AST query instead.
80
-
81
- Set \`"engine": "ast"\` and provide an \`"astQuery"\` field with a Tree-sitter S-expression query. Leave \`"pattern"\` as an empty string.
82
-
83
- Tree-sitter S-expression syntax:
84
- - \`(node_type)\` — matches a node
85
- - \`(node_type field: (child_type))\` — matches with named field
86
- - \`@name\` — captures a node
87
- - \`(#eq? @name "value")\` — predicate: capture text equals value
88
- - Use \`@violation\` capture name for the node that should be flagged
89
-
90
- Examples:
91
- - Catch direct process.env access:
92
- \`(member_expression object: (identifier) @obj (#eq? @obj "process") property: (property_identifier) @prop (#eq? @prop "env")) @violation\`
93
- - Catch empty catch blocks:
94
- \`(catch_clause body: (statement_block) @body (#eq? @body "{}")) @violation\`
95
-
96
- AST query output schema:
97
- \`\`\`json
98
- {
99
- "compilable": true,
100
- "engine": "ast",
101
- "astQuery": "(s-expression query here) @violation",
102
- "pattern": "",
103
- "message": "human-readable violation message",
104
- "fileGlobs": ["**/*.ts", "**/*.tsx"]
105
- }
106
- \`\`\`
107
-
108
- IMPORTANT: Only use AST queries for TypeScript/JavaScript/TSX/JSX files. If the lesson applies to other file types, prefer regex or mark as non-compilable.
109
-
110
- ## ast-grep Patterns (Tier 2b — Preferred for structural rules)
111
- If the lesson describes a structural constraint, prefer ast-grep patterns over regex or S-expressions.
112
-
113
- ast-grep patterns look like the source code itself with $METAVAR placeholders:
114
- - \`console.log($ARG)\` — matches any console.log call
115
- - \`process.env.$PROP\` — matches any process.env access
116
- - \`throw new Error($MSG)\` — matches any Error throw
117
- - \`useState($INIT)\` — matches any useState hook
118
-
119
- Set \`"engine": "ast-grep"\` and provide an \`"astGrepPattern"\` field. Leave \`"pattern"\` as an empty string.
120
-
121
- ast-grep output schema:
122
- \`\`\`json
123
- {
124
- "compilable": true,
125
- "engine": "ast-grep",
126
- "astGrepPattern": "console.log($ARG)",
127
- "pattern": "",
128
- "message": "human-readable violation message",
129
- "fileGlobs": ["**/*.ts", "**/*.tsx"]
130
- }
131
- \`\`\`
132
-
133
- IMPORTANT: ast-grep patterns must be single valid AST nodes. Statements like \`catch ($E) {}\` won't work — use regex for those.
134
- Only use for TypeScript/JavaScript/TSX/JSX files.
135
- `;
136
- // ─── Glob sanitization ─────────────────────────────
137
- /**
138
- * Expand brace patterns and strip unsupported glob syntax.
139
- * e.g., "**\/*.{ts,js}" → ["**\/*.ts", "**\/*.js"]
140
- */
141
- function sanitizeFileGlobs(globs) {
142
- const result = [];
143
- for (const glob of globs) {
144
- // Expand brace patterns: **/*.{ts,js} → **/*.ts, **/*.js
145
- const braceMatch = /^(.*)\{([^}]+)\}(.*)$/.exec(glob);
146
- if (braceMatch) {
147
- const prefix = braceMatch[1];
148
- const alternatives = braceMatch[2].split(',').map((s) => s.trim());
149
- const suffix = braceMatch[3];
150
- for (const alt of alternatives) {
151
- result.push(prefix + alt + suffix);
6
+ // ─── Single-lesson compilation ──────────────────────
7
+ async function compileLesson(lesson, deps) {
8
+ const { extractManualPattern, validateRegex, parseCompilerResponse, sanitizeFileGlobs, engineFields, runOrchestrator, log, existingByHash, options, config, cwd, } = deps;
9
+ // ── Pipeline 1: Manual pattern (zero LLM) ────────
10
+ const manual = extractManualPattern(lesson.body);
11
+ if (manual) {
12
+ // Validate the manually provided pattern
13
+ if (manual.engine === 'regex') {
14
+ const validation = validateRegex(manual.pattern);
15
+ if (!validation.valid) {
16
+ log.warn(TAG, `[${lesson.heading}] Manual pattern rejected: ${validation.reason} — skipping`); // totem-ignore
17
+ return { status: 'failed' };
152
18
  }
153
- continue;
154
19
  }
155
- result.push(glob);
20
+ const now = new Date().toISOString();
21
+ const existing = existingByHash.get(lesson.hash);
22
+ const sanitizedGlobs = manual.fileGlobs ? sanitizeFileGlobs(manual.fileGlobs) : undefined;
23
+ return {
24
+ status: 'compiled',
25
+ rule: {
26
+ lessonHash: lesson.hash,
27
+ lessonHeading: lesson.heading,
28
+ message: lesson.heading,
29
+ engine: manual.engine,
30
+ severity: manual.severity,
31
+ ...engineFields(manual.engine, manual.pattern),
32
+ compiledAt: now,
33
+ createdAt: existing?.createdAt ?? now,
34
+ ...(sanitizedGlobs && sanitizedGlobs.length > 0 ? { fileGlobs: sanitizedGlobs } : {}),
35
+ },
36
+ };
37
+ }
38
+ // ── Pipeline 2: LLM compilation ──────────────────
39
+ const prompt = `${COMPILER_SYSTEM_PROMPT}\n\n## Lesson to Compile\n\nHeading: ${lesson.heading}\n\n${lesson.body}`;
40
+ const response = await runOrchestrator({
41
+ prompt,
42
+ tag: TAG,
43
+ options,
44
+ config,
45
+ cwd,
46
+ });
47
+ if (response == null) {
48
+ return { status: 'noop' };
49
+ }
50
+ const parsed = parseCompilerResponse(response);
51
+ if (!parsed) {
52
+ log.warn(TAG, `[${lesson.heading}] Failed to parse LLM response — skipping`); // totem-ignore
53
+ return { status: 'failed' };
54
+ }
55
+ if (!parsed.compilable) {
56
+ log.dim(TAG, `[${lesson.heading}] Not compilable (conceptual/architectural) — skipping`); // totem-ignore
57
+ return { status: 'skipped', hash: lesson.hash };
58
+ }
59
+ // ── Gate 1: Severity validation (Proposal 184) ──
60
+ const severity = parsed.severity ?? 'warning';
61
+ const engine = parsed.engine ?? 'regex';
62
+ // ── ast-grep engine ───────────────────────────
63
+ if (engine === 'ast-grep') {
64
+ if (!parsed.astGrepPattern || !parsed.message) {
65
+ log.warn(TAG, `[${lesson.heading}] Missing astGrepPattern or message — skipping`); // totem-ignore
66
+ return { status: 'failed' };
67
+ }
68
+ const now = new Date().toISOString();
69
+ const existing = existingByHash.get(lesson.hash);
70
+ const sanitizedGlobs = parsed.fileGlobs ? sanitizeFileGlobs(parsed.fileGlobs) : undefined;
71
+ return {
72
+ status: 'compiled',
73
+ rule: {
74
+ lessonHash: lesson.hash,
75
+ lessonHeading: lesson.heading,
76
+ message: parsed.message,
77
+ engine: 'ast-grep',
78
+ severity,
79
+ ...engineFields('ast-grep', parsed.astGrepPattern),
80
+ compiledAt: now,
81
+ createdAt: existing?.createdAt ?? now,
82
+ ...(sanitizedGlobs && sanitizedGlobs.length > 0 ? { fileGlobs: sanitizedGlobs } : {}),
83
+ },
84
+ };
85
+ }
86
+ // ── Tree-sitter AST engine ────────────────────
87
+ if (engine === 'ast') {
88
+ if (!parsed.astQuery || !parsed.message) {
89
+ log.warn(TAG, `[${lesson.heading}] Missing astQuery or message — skipping`); // totem-ignore
90
+ return { status: 'failed' };
91
+ }
92
+ const now = new Date().toISOString();
93
+ const existing = existingByHash.get(lesson.hash);
94
+ const sanitizedGlobs = parsed.fileGlobs ? sanitizeFileGlobs(parsed.fileGlobs) : undefined;
95
+ return {
96
+ status: 'compiled',
97
+ rule: {
98
+ lessonHash: lesson.hash,
99
+ lessonHeading: lesson.heading,
100
+ message: parsed.message,
101
+ engine: 'ast',
102
+ severity,
103
+ ...engineFields('ast', parsed.astQuery),
104
+ compiledAt: now,
105
+ createdAt: existing?.createdAt ?? now,
106
+ ...(sanitizedGlobs && sanitizedGlobs.length > 0 ? { fileGlobs: sanitizedGlobs } : {}),
107
+ },
108
+ };
109
+ }
110
+ // ── Regex engine (default) ────────────────────
111
+ if (!parsed.pattern || !parsed.message) {
112
+ log.warn(TAG, `[${lesson.heading}] Missing pattern or message — skipping`); // totem-ignore
113
+ return { status: 'failed' };
114
+ }
115
+ const validation = validateRegex(parsed.pattern);
116
+ if (!validation.valid) {
117
+ log.warn(TAG, `[${lesson.heading}] Rejected regex: ${validation.reason} — skipping`); // totem-ignore
118
+ return { status: 'failed' };
156
119
  }
157
- return result;
120
+ const now = new Date().toISOString();
121
+ const existing = existingByHash.get(lesson.hash);
122
+ const sanitizedGlobs = parsed.fileGlobs ? sanitizeFileGlobs(parsed.fileGlobs) : undefined;
123
+ return {
124
+ status: 'compiled',
125
+ rule: {
126
+ lessonHash: lesson.hash,
127
+ lessonHeading: lesson.heading,
128
+ message: parsed.message,
129
+ engine: 'regex',
130
+ severity,
131
+ ...engineFields('regex', parsed.pattern),
132
+ compiledAt: now,
133
+ createdAt: existing?.createdAt ?? now,
134
+ ...(sanitizedGlobs && sanitizedGlobs.length > 0 ? { fileGlobs: sanitizedGlobs } : {}),
135
+ },
136
+ };
158
137
  }
159
- /** Build engine-specific fields for a compiled rule. */
160
- function engineFields(engine, pattern) {
161
- switch (engine) {
162
- case 'regex':
163
- return { pattern: String(pattern) };
164
- case 'ast-grep':
165
- return { pattern: '', astGrepPattern: pattern };
166
- case 'ast':
167
- return { pattern: '', astQuery: String(pattern) };
138
+ function logCompiledRule(log, lesson, rule) {
139
+ const engine = rule.engine;
140
+ const severity = rule.severity ?? 'warning';
141
+ if (engine === 'ast-grep') {
142
+ log.success(TAG, `[${lesson.heading}] Compiled (ast-grep, ${severity}): ${rule.astGrepPattern}`); // totem-ignore
143
+ }
144
+ else if (engine === 'ast') {
145
+ log.success(TAG, `[${lesson.heading}] Compiled (ast, ${severity}): ${rule.astQuery}`); // totem-ignore
146
+ }
147
+ else if (rule.lessonHeading === rule.message) {
148
+ // Manual pattern — message equals heading
149
+ const manualEngine = rule.engine;
150
+ log.success(TAG, `[${lesson.heading}] Compiled (manual ${manualEngine}, ${severity}): ${rule.pattern}`); // totem-ignore
151
+ }
152
+ else {
153
+ log.success(TAG, `[${lesson.heading}] Compiled (regex, ${severity}): /${rule.pattern}/`); // totem-ignore
168
154
  }
169
155
  }
156
+ // ─── Main command ───────────────────────────────────
170
157
  export async function compileCommand(options) {
171
158
  const path = await import('node:path');
172
159
  const { log } = await import('../ui.js');
173
160
  const { loadConfig, loadEnv, resolveConfigPath, runOrchestrator } = await import('../utils.js');
174
- const { exportLessons, extractManualPattern, hashLesson, loadCompiledRulesFile, parseCompilerResponse, readAllLessons, saveCompiledRulesFile, validateRegex, } = await import('@mmnto/totem');
161
+ const { engineFields, exportLessons, extractManualPattern, hashLesson, loadCompiledRulesFile, parseCompilerResponse, readAllLessons, sanitizeFileGlobs, saveCompiledRulesFile, validateRegex, } = await import('@mmnto/totem');
175
162
  const cwd = process.cwd();
176
163
  const configPath = resolveConfigPath(cwd);
177
164
  loadEnv(cwd);
@@ -255,145 +242,37 @@ export async function compileCommand(options) {
255
242
  }
256
243
  newRules.length = 0;
257
244
  newRules.push(...freshRules);
245
+ const deps = {
246
+ extractManualPattern,
247
+ validateRegex,
248
+ parseCompilerResponse,
249
+ sanitizeFileGlobs,
250
+ engineFields,
251
+ runOrchestrator,
252
+ log,
253
+ existingByHash,
254
+ options,
255
+ config,
256
+ cwd,
257
+ };
258
258
  for (const lesson of toCompile) {
259
- // ── Pipeline 1: Manual pattern (zero LLM) ────────
260
- const manual = extractManualPattern(lesson.body);
261
- if (manual) {
262
- // Validate the manually provided pattern
263
- if (manual.engine === 'regex') {
264
- const validation = validateRegex(manual.pattern);
265
- if (!validation.valid) {
266
- log.warn(TAG, `[${lesson.heading}] Manual pattern rejected: ${validation.reason} — skipping`); // totem-ignore
267
- failed++;
268
- continue;
269
- }
270
- }
271
- const now = new Date().toISOString();
272
- const existing = existingByHash.get(lesson.hash);
273
- const sanitizedGlobs = manual.fileGlobs ? sanitizeFileGlobs(manual.fileGlobs) : undefined;
274
- newRules.push({
275
- lessonHash: lesson.hash,
276
- lessonHeading: lesson.heading,
277
- message: lesson.heading,
278
- engine: manual.engine,
279
- severity: manual.severity,
280
- ...engineFields(manual.engine, manual.pattern),
281
- compiledAt: now,
282
- createdAt: existing?.createdAt ?? now,
283
- ...(sanitizedGlobs && sanitizedGlobs.length > 0 ? { fileGlobs: sanitizedGlobs } : {}),
284
- });
285
- compiled++;
286
- log.success(TAG, `[${lesson.heading}] Compiled (manual ${manual.engine}, ${manual.severity}): ${manual.pattern}`); // totem-ignore
287
- continue;
288
- }
289
- // ── Pipeline 2: LLM compilation ──────────────────
290
- const prompt = `${COMPILER_SYSTEM_PROMPT}\n\n## Lesson to Compile\n\nHeading: ${lesson.heading}\n\n${lesson.body}`;
291
- const response = await runOrchestrator({
292
- prompt,
293
- tag: TAG,
294
- options,
295
- config,
296
- cwd,
297
- });
298
- if (response == null) {
299
- continue;
300
- }
301
- const parsed = parseCompilerResponse(response);
302
- if (!parsed) {
303
- log.warn(TAG, `[${lesson.heading}] Failed to parse LLM response — skipping`); // totem-ignore
304
- failed++;
305
- continue;
306
- }
307
- if (!parsed.compilable) {
308
- log.dim(TAG, `[${lesson.heading}] Not compilable (conceptual/architectural) — skipping`); // totem-ignore
309
- nonCompilableSet.add(lesson.hash);
310
- skipped++;
311
- continue;
312
- }
313
- // ── Gate 1: Severity validation (Proposal 184) ──
314
- // LLMs (especially Flash) frequently omit severity, producing rules
315
- // that default to 'error' and break CI on advisory patterns.
316
- // Default to 'warning' for new rules — they must be manually promoted.
317
- const severity = parsed.severity ?? 'warning';
318
- const engine = parsed.engine ?? 'regex';
319
- // ── ast-grep engine ───────────────────────────
320
- if (engine === 'ast-grep') {
321
- if (!parsed.astGrepPattern || !parsed.message) {
322
- log.warn(TAG, `[${lesson.heading}] Missing astGrepPattern or message — skipping`); // totem-ignore
323
- failed++;
324
- continue;
325
- }
326
- const now = new Date().toISOString();
327
- const existing = existingByHash.get(lesson.hash);
328
- const sanitizedGlobs = parsed.fileGlobs ? sanitizeFileGlobs(parsed.fileGlobs) : undefined;
329
- newRules.push({
330
- lessonHash: lesson.hash,
331
- lessonHeading: lesson.heading,
332
- message: parsed.message,
333
- engine: 'ast-grep',
334
- severity,
335
- ...engineFields('ast-grep', parsed.astGrepPattern),
336
- compiledAt: now,
337
- createdAt: existing?.createdAt ?? now,
338
- ...(sanitizedGlobs && sanitizedGlobs.length > 0 ? { fileGlobs: sanitizedGlobs } : {}),
339
- });
340
- compiled++;
341
- log.success(TAG, `[${lesson.heading}] Compiled (ast-grep, ${severity}): ${parsed.astGrepPattern}`); // totem-ignore
342
- continue;
343
- }
344
- // ── Tree-sitter AST engine ────────────────────
345
- if (engine === 'ast') {
346
- if (!parsed.astQuery || !parsed.message) {
347
- log.warn(TAG, `[${lesson.heading}] Missing astQuery or message — skipping`); // totem-ignore
259
+ const result = await compileLesson(lesson, deps);
260
+ switch (result.status) {
261
+ case 'compiled':
262
+ newRules.push(result.rule);
263
+ compiled++;
264
+ logCompiledRule(log, lesson, result.rule);
265
+ break;
266
+ case 'skipped':
267
+ nonCompilableSet.add(result.hash);
268
+ skipped++;
269
+ break;
270
+ case 'failed':
348
271
  failed++;
349
- continue;
350
- }
351
- const now = new Date().toISOString();
352
- const existing = existingByHash.get(lesson.hash);
353
- const sanitizedGlobs = parsed.fileGlobs ? sanitizeFileGlobs(parsed.fileGlobs) : undefined;
354
- newRules.push({
355
- lessonHash: lesson.hash,
356
- lessonHeading: lesson.heading,
357
- message: parsed.message,
358
- engine: 'ast',
359
- severity,
360
- ...engineFields('ast', parsed.astQuery),
361
- compiledAt: now,
362
- createdAt: existing?.createdAt ?? now,
363
- ...(sanitizedGlobs && sanitizedGlobs.length > 0 ? { fileGlobs: sanitizedGlobs } : {}),
364
- });
365
- compiled++;
366
- log.success(TAG, `[${lesson.heading}] Compiled (ast, ${severity}): ${parsed.astQuery}`); // totem-ignore
367
- continue;
272
+ break;
273
+ case 'noop':
274
+ break;
368
275
  }
369
- // ── Regex engine (default) ────────────────────
370
- if (!parsed.pattern || !parsed.message) {
371
- log.warn(TAG, `[${lesson.heading}] Missing pattern or message — skipping`); // totem-ignore
372
- failed++;
373
- continue;
374
- }
375
- const validation = validateRegex(parsed.pattern);
376
- if (!validation.valid) {
377
- log.warn(TAG, `[${lesson.heading}] Rejected regex: ${validation.reason} — skipping`); // totem-ignore
378
- failed++;
379
- continue;
380
- }
381
- const now = new Date().toISOString();
382
- const existing = existingByHash.get(lesson.hash);
383
- const sanitizedGlobs = parsed.fileGlobs ? sanitizeFileGlobs(parsed.fileGlobs) : undefined;
384
- newRules.push({
385
- lessonHash: lesson.hash,
386
- lessonHeading: lesson.heading,
387
- message: parsed.message,
388
- engine: 'regex',
389
- severity,
390
- ...engineFields('regex', parsed.pattern),
391
- compiledAt: now,
392
- createdAt: existing?.createdAt ?? now,
393
- ...(sanitizedGlobs && sanitizedGlobs.length > 0 ? { fileGlobs: sanitizedGlobs } : {}),
394
- });
395
- compiled++;
396
- log.success(TAG, `[${lesson.heading}] Compiled (regex, ${severity}): /${parsed.pattern}/`); // totem-ignore
397
276
  }
398
277
  if (!options.raw) {
399
278
  // Prune stale non-compilable hashes (lesson was edited or removed)
@@ -1 +1 @@
1
- {"version":3,"file":"compile.js","sourceRoot":"","sources":["../../src/commands/compile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE5D,uDAAuD;AAEvD,MAAM,GAAG,GAAG,SAAS,CAAC;AACtB,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AAElD,uDAAuD;AAEvD,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiI9B,CAAC;AAEF,sDAAsD;AAEtD;;;GAGG;AACH,SAAS,iBAAiB,CAAC,KAAe;IACxC,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,yDAAyD;QACzD,MAAM,UAAU,GAAG,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtD,IAAI,UAAU,EAAE,CAAC;YACf,MAAM,MAAM,GAAG,UAAU,CAAC,CAAC,CAAE,CAAC;YAC9B,MAAM,YAAY,GAAG,UAAU,CAAC,CAAC,CAAE,CAAC,KAAK,CAAC,GAAG,CAAC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E,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACnB,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAChE,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,0EAA0E,CAAC,CAAC;YAC1F,OAAO;QACT,CAAC;QAED,KAAK,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;YAC9D,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;YACzC,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAChC,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,YAAY,OAAO,CAAC,MAAM,aAAa,QAAQ,KAAK,IAAI,GAAG,CAAC,CAAC,CAAC,eAAe;QAChG,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -1,9 +1,14 @@
1
- export declare const DOCS_SYSTEM_PROMPT = "# Docs System Prompt \u2014 Automated Documentation Sync\n\n## Identity & Role\nYou are a meticulous Technical Writer responsible for keeping project documentation accurate and up-to-date. You rewrite documentation files to reflect the latest project state.\n\n## Core Mission\nGiven a documentation file, its purpose, and recent project changes (git log, closed issues), produce an updated version of the entire file that accurately reflects the current state.\n\n## Critical Rules\n- **Full Rewrite:** Output the ENTIRE updated file content \u2014 not a diff, not a patch, the complete file.\n- **Preserve Structure:** Maintain the existing document's structure, tone, and formatting conventions unless changes require restructuring.\n- **Evidence-Based:** Only update information that is supported by the provided git log, closed issues, or active work context. Do NOT invent features or status changes.\n- **Phase Numbering:** If the document references phases, use ONLY the phase numbering from the provided active_work.md context. Do NOT change or renumber phases.\n- **Conservative Updates:** When in doubt, keep the existing text. Only change what the evidence supports.\n- **Manual Content:** If `<manual_content>` blocks are provided, include them VERBATIM in the appropriate section of the document. Do NOT rewrite, summarize, or omit any part of manual content. These are hand-written by the maintainer and must survive regeneration.\n- **Checkbox Integrity:** NEVER change the checked/unchecked state of markdown checkboxes (`[x]` / `[ ]`) unless the commit history explicitly contains a revert, deprecation, or re-opening of the referenced item. Priority rankings in active_work.md are NOT evidence of completion status.\n- **XML Wrapper (MANDATORY):** Wrap your ENTIRE output inside `<updated_document>` and `</updated_document>` tags. No text before or after the tags. No markdown code fences. Example:\n\n```\n<updated_document>\n# My Document\nUpdated content here...\n</updated_document>\n```\n\n## Pinned Content (DO NOT change)\n- **README hero**: The tagline is: \"Stop repeating yourself to your AI.\" followed by the goldfish subtitle: \"AI coding agents are brilliant goldfish. Totem gives them a memory.\" Do not replace, rephrase, or revert these lines.\n- **README identity**: \"Totem doesn't ship with your app. It lives in your workflow.\" Do not remove this line.\n- **3-Layer pitch**: \"Your AI doesn't have to be obedient. It just has to push code.\" Do not remove or rephrase this line.\n- **Performance claim**: \"147 compiled rules in under 2 seconds\" on a 7,400-line PR. Do not inflate or deflate this number.\n- **Why Totem pillars**: The three pillars are: (1) Zero-LLM enforcement, (2) Shared memory across repos, (3) Works with any AI agent. These must appear near the top of the README.\n- **Works Without AI**: Totem's enforcement layer requires no AI/API keys/network. The AI helps write rules; the rules enforce themselves. Do not remove this distinction.\n- **Totem Mesh**: The \"totem link\" command connects repos into a shared knowledge mesh. Do not remove or bury this section.\n\n## Command Glossary (DO NOT confuse these)\n- **`totem lint`**: Runs compiled AST/regex rules against a diff. Zero LLM. Fast (~2s). No API keys needed. Used in pre-push hooks and CI. Lives in the Lite configuration tier.\n- **`totem shield`**: AI-powered code review. Queries LanceDB for context, sends diff + knowledge to an LLM. Slow (~18s). Requires API keys. Used before opening PRs. Lives in the Full configuration tier.\n- These are DIFFERENT commands with DIFFERENT purposes. Never describe `shield` as \"deterministic\" or `lint` as \"AI-powered.\"\n\n## Formatting Rules\n- **Sub-Bullet Threshold:** When a feature list exceeds 3 items, use nested sub-bullets instead of comma-separated inline lists. Group related items into named categories (e.g., \"Security:\", \"DX:\", \"Orchestration:\").\n- **Completed Phase Summary:** Phases marked `[x]` should be summarized in 1-2 sentences max. Do NOT expand completed phases with every PR number \u2014 use categorized sub-bullets for the key capability areas only.\n- **Line Length:** No single bullet point should exceed two short sentences. If it does, break it into sub-bullets or summarize. Readability is more important than completeness.\n- **PR References:** Reference PR numbers sparingly \u2014 only for the most significant items (1-3 per sub-bullet). Do NOT list every PR number for a capability area.\n";
1
+ export declare const DOCS_SYSTEM_PROMPT = "# Docs System Prompt \u2014 Automated Documentation Sync\n\n## Identity & Role\nYou are a meticulous Technical Writer responsible for keeping project documentation accurate and up-to-date. You rewrite documentation files to reflect the latest project state.\n\n## Core Mission\nGiven a documentation file, its purpose, and recent project changes (git log, closed issues), produce an updated version of the entire file that accurately reflects the current state.\n\n## Critical Rules\n- **Full Rewrite:** Output the ENTIRE updated file content \u2014 not a diff, not a patch, the complete file.\n- **Preserve Structure:** Maintain the existing document's structure, tone, and formatting conventions unless changes require restructuring.\n- **Evidence-Based:** Only update information that is supported by the provided git log, closed issues, or active work context. Do NOT invent features or status changes.\n- **Phase Numbering:** If the document references phases, use ONLY the phase numbering from the provided active_work.md context. Do NOT change or renumber phases.\n- **Conservative Updates:** When in doubt, keep the existing text. Only change what the evidence supports.\n- **Manual Content:** If `<manual_content>` blocks are provided, include them VERBATIM in the appropriate section of the document. Do NOT rewrite, summarize, or omit any part of manual content. These are hand-written by the maintainer and must survive regeneration.\n- **Checkbox Integrity:** NEVER change the checked/unchecked state of markdown checkboxes (`[x]` / `[ ]`) unless the commit history explicitly contains a revert, deprecation, or re-opening of the referenced item. Priority rankings in active_work.md are NOT evidence of completion status.\n- **XML Wrapper (MANDATORY):** Wrap your ENTIRE output inside `<updated_document>` and `</updated_document>` tags. No text before or after the tags. No markdown code fences. Example:\n\n```\n<updated_document>\n# My Document\nUpdated content here...\n</updated_document>\n```\n\n## Pinned Content (DO NOT change)\n- **README hero**: The tagline is: \"Stop repeating yourself to your AI.\" followed by the goldfish subtitle: \"AI coding agents are brilliant goldfish. Totem gives them a memory.\" Do not replace, rephrase, or revert these lines.\n- **README identity**: \"Totem doesn't ship with your app. It lives in your workflow.\" Do not remove this line.\n- **3-Layer pitch**: \"Your AI doesn't have to be obedient. It just has to push code.\" Do not remove or rephrase this line.\n- **Performance claim**: The rule count changes with each compile. Read the current count from `.totem/compiled-rules.json` if available in context, otherwise keep the existing number. The \"under 2 seconds\" benchmark is stable.\n- **Why Totem pillars**: The three pillars are: (1) Zero-LLM enforcement, (2) Shared memory across repos, (3) Works with any AI agent. These must appear near the top of the README.\n- **Works Without AI**: Totem's enforcement layer requires no AI/API keys/network. The AI helps write rules; the rules enforce themselves. Do not remove this distinction.\n- **Totem Mesh**: The \"totem link\" command connects repos into a shared knowledge mesh. Do not remove or bury this section.\n\n## Command Glossary (DO NOT confuse these)\n- **`totem lint`**: Runs compiled AST/regex rules against a diff. Zero LLM. Fast (~2s). No API keys needed. Used in pre-push hooks and CI. Lives in the Lite configuration tier.\n- **`totem shield`**: AI-powered code review. Queries LanceDB for context, sends diff + knowledge to an LLM. Slow (~18s). Requires API keys. Used before opening PRs. Lives in the Full configuration tier.\n- These are DIFFERENT commands with DIFFERENT purposes. Never describe `shield` as \"deterministic\" or `lint` as \"AI-powered.\"\n\n## Formatting Rules\n- **Sub-Bullet Threshold:** When a feature list exceeds 3 items, use nested sub-bullets instead of comma-separated inline lists. Group related items into named categories (e.g., \"Security:\", \"DX:\", \"Orchestration:\").\n- **Completed Phase Summary:** Phases marked `[x]` should be summarized in 1-2 sentences max. Do NOT expand completed phases with every PR number \u2014 use categorized sub-bullets for the key capability areas only.\n- **Line Length:** No single bullet point should exceed two short sentences. If it does, break it into sub-bullets or summarize. Readability is more important than completeness.\n- **No Issue/PR References:** NEVER include GitHub issue or PR references (e.g., `#714`, `(#801)`, `(#714, #801)`) in user-facing documentation. These are internal tracking artifacts. Describe features by what they do, not by which ticket shipped them.\n- **No Internal Jargon:** Do not use internal terms like \"Pipeline 1\", \"Pipeline 2\", \"ADR-058\", or \"Proposal 186\" in user-facing copy. Use plain language that a new user would understand.\n- **No Maintenance Comments:** Do not include comments about how documentation is maintained, generated, or structured. The output is the final document, not a template.\n";
2
2
  /**
3
3
  * Extract the file content from the LLM's `<updated_document>` wrapper.
4
4
  * Returns null if the closing tag is missing (truncated or malformed response).
5
5
  */
6
6
  export declare function extractUpdatedDocument(response: string): string | null;
7
+ /**
8
+ * Strip GitHub issue/PR references from user-facing docs.
9
+ * Handles: (#123), (#123, #456), (fixes #123), standalone #123 in prose.
10
+ */
11
+ export declare function stripIssueRefs(content: string): string;
7
12
  export interface DocsOptions {
8
13
  raw?: boolean;
9
14
  out?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/commands/docs.ts"],"names":[],"mappings":"AA4BA,eAAO,MAAM,kBAAkB,25IA4C9B,CAAC;AAgHF;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGtE;AAiCD,MAAM,WAAW,WAAW;IAC1B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CA2MvF"}
1
+ {"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/commands/docs.ts"],"names":[],"mappings":"AA4BA,eAAO,MAAM,kBAAkB,w8JA8C9B,CAAC;AAgHF;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,E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