@mmnto/cli 1.15.1 → 1.15.3

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.
Files changed (37) hide show
  1. package/dist/commands/compile-prune.test.js +56 -1
  2. package/dist/commands/compile-prune.test.js.map +1 -1
  3. package/dist/commands/compile-refresh-manifest.test.d.ts +2 -0
  4. package/dist/commands/compile-refresh-manifest.test.d.ts.map +1 -0
  5. package/dist/commands/compile-refresh-manifest.test.js +163 -0
  6. package/dist/commands/compile-refresh-manifest.test.js.map +1 -0
  7. package/dist/commands/compile-templates.d.ts +1 -1
  8. package/dist/commands/compile-templates.d.ts.map +1 -1
  9. package/dist/commands/compile-templates.js +134 -0
  10. package/dist/commands/compile-templates.js.map +1 -1
  11. package/dist/commands/compile.d.ts +30 -0
  12. package/dist/commands/compile.d.ts.map +1 -1
  13. package/dist/commands/compile.js +227 -41
  14. package/dist/commands/compile.js.map +1 -1
  15. package/dist/commands/lesson-archive.test.d.ts +2 -0
  16. package/dist/commands/lesson-archive.test.d.ts.map +1 -0
  17. package/dist/commands/lesson-archive.test.js +192 -0
  18. package/dist/commands/lesson-archive.test.js.map +1 -0
  19. package/dist/commands/lesson.d.ts +23 -0
  20. package/dist/commands/lesson.d.ts.map +1 -1
  21. package/dist/commands/lesson.js +124 -0
  22. package/dist/commands/lesson.js.map +1 -1
  23. package/dist/commands/lint.d.ts +8 -0
  24. package/dist/commands/lint.d.ts.map +1 -1
  25. package/dist/commands/lint.js +14 -1
  26. package/dist/commands/lint.js.map +1 -1
  27. package/dist/commands/lint.test.js +71 -1
  28. package/dist/commands/lint.test.js.map +1 -1
  29. package/dist/commands/run-compiled-rules.d.ts +15 -1
  30. package/dist/commands/run-compiled-rules.d.ts.map +1 -1
  31. package/dist/commands/run-compiled-rules.js +49 -4
  32. package/dist/commands/run-compiled-rules.js.map +1 -1
  33. package/dist/commands/run-compiled-rules.test.js +6 -2
  34. package/dist/commands/run-compiled-rules.test.js.map +1 -1
  35. package/dist/index.js +21 -0
  36. package/dist/index.js.map +1 -1
  37. package/package.json +2 -2
@@ -1,5 +1,5 @@
1
1
  import { describe, expect, it } from 'vitest';
2
- import { pruneStaleNonCompilable, pruneStaleRules } from './compile.js';
2
+ import { pruneStaleNonCompilable, pruneStaleRules, removeRuleByHash, upsertRule, } from './compile.js';
3
3
  // ─── 4-tuple helpers (mmnto-ai/totem#1481) ───────────
4
4
  function entry(title, reasonCode = 'out-of-scope', reason) {
5
5
  return reason === undefined ? { title, reasonCode } : { title, reasonCode, reason };
@@ -130,4 +130,59 @@ describe('pruneStaleRules', () => {
130
130
  expect(rules[1].lessonHash).toBe('stale');
131
131
  });
132
132
  });
133
+ // ─── upsertRule (mmnto-ai/totem#1587) ────────────────
134
+ describe('upsertRule', () => {
135
+ it('appends when no entry with the same lessonHash exists', () => {
136
+ const rules = [makeRule('abc'), makeRule('def')];
137
+ const fresh = makeRule('ghi', 'New rule');
138
+ upsertRule(rules, fresh);
139
+ expect(rules).toHaveLength(3);
140
+ expect(rules[2]).toBe(fresh);
141
+ });
142
+ it('replaces in-place when an entry with the same lessonHash exists', () => {
143
+ // Order preservation is load-bearing: re-compiling a mid-array rule
144
+ // under --force must NOT move it to the end. Appending instead of
145
+ // replacing causes diff churn in compiled-rules.json on every force
146
+ // run (CR finding on PR mmnto-ai/totem#1629).
147
+ const ruleA = makeRule('abc', 'Old A');
148
+ const ruleB = makeRule('def', 'B');
149
+ const ruleC = makeRule('ghi', 'C');
150
+ const rules = [ruleA, ruleB, ruleC];
151
+ const replacement = makeRule('abc', 'New A');
152
+ upsertRule(rules, replacement);
153
+ expect(rules).toHaveLength(3);
154
+ expect(rules[0]).toBe(replacement);
155
+ expect(rules[0].lessonHeading).toBe('New A');
156
+ expect(rules[1]).toBe(ruleB);
157
+ expect(rules[2]).toBe(ruleC);
158
+ });
159
+ it('is idempotent when called twice with the same rule object', () => {
160
+ const rules = [makeRule('abc', 'Original')];
161
+ const replacement = makeRule('abc', 'Updated');
162
+ upsertRule(rules, replacement);
163
+ upsertRule(rules, replacement);
164
+ expect(rules).toHaveLength(1);
165
+ expect(rules[0]).toBe(replacement);
166
+ });
167
+ });
168
+ // ─── removeRuleByHash (mmnto-ai/totem#1587 + mmnto-ai/totem#1629 cloud parity) ──
169
+ describe('removeRuleByHash', () => {
170
+ it('removes the matching rule in place and preserves order of the rest', () => {
171
+ const ruleA = makeRule('abc', 'A');
172
+ const ruleB = makeRule('def', 'B');
173
+ const ruleC = makeRule('ghi', 'C');
174
+ const rules = [ruleA, ruleB, ruleC];
175
+ removeRuleByHash(rules, 'def');
176
+ expect(rules).toHaveLength(2);
177
+ expect(rules[0]).toBe(ruleA);
178
+ expect(rules[1]).toBe(ruleC);
179
+ });
180
+ it('is a no-op when the hash does not match any rule', () => {
181
+ const rules = [makeRule('abc'), makeRule('def')];
182
+ removeRuleByHash(rules, 'missing');
183
+ expect(rules).toHaveLength(2);
184
+ expect(rules[0].lessonHash).toBe('abc');
185
+ expect(rules[1].lessonHash).toBe('def');
186
+ });
187
+ });
133
188
  //# sourceMappingURL=compile-prune.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"compile-prune.test.js","sourceRoot":"","sources":["../../src/commands/compile-prune.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAK9C,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAExE,wDAAwD;AAExD,SAAS,KAAK,CACZ,KAAa,EACb,aAAkD,cAAc,EAChE,MAAe;IAEf,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;AACtF,CAAC;AAED,wDAAwD;AAExD,SAAS,QAAQ,CAAC,UAAkB,EAAE,OAAO,GAAG,eAAe,UAAU,EAAE;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,KAAK,CAAC,CAAC,CAAE,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=compile-refresh-manifest.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compile-refresh-manifest.test.d.ts","sourceRoot":"","sources":["../../src/commands/compile-refresh-manifest.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,163 @@
1
+ import * as fs from 'node:fs';
2
+ import * as os from 'node:os';
3
+ import * as path from 'node:path';
4
+ import { afterEach, beforeEach, describe, expect, it } from 'vitest';
5
+ import { generateOutputHash, hashLesson, readCompileManifest } from '@mmnto/totem';
6
+ import { cleanTmpDir } from '../test-utils.js';
7
+ import { compileCommand } from './compile.js';
8
+ // ─── Helpers ─────────────────────────────────────────
9
+ //
10
+ // These tests exercise the `--refresh-manifest` primitive (mmnto-ai/totem#1587).
11
+ // The flag must recompute output_hash from the current compiled-rules.json
12
+ // state without invoking the LLM or touching any lessons. It is the non-LLM
13
+ // complement to #1348's input-hash drift refresh, covering the postmerge
14
+ // inline-archive workflow where a rule's `status: 'archived'` field is set
15
+ // directly by a curation script.
16
+ function makeTmpDir() {
17
+ return fs.mkdtempSync(path.join(os.tmpdir(), 'totem-refresh-manifest-'));
18
+ }
19
+ function lessonMarkdown(heading, body) {
20
+ return `## Lesson — ${heading}\n\n**Tags:** test\n\n${body}\n`;
21
+ }
22
+ function setupWorkspace(tmpDir, options) {
23
+ fs.writeFileSync(path.join(tmpDir, 'totem.config.ts'), [
24
+ 'export default {',
25
+ ' targets: [{ glob: "**/*.ts", type: "code", strategy: "typescript-ast" }],',
26
+ ' totemDir: ".totem",',
27
+ ' orchestrator: {',
28
+ ' provider: "shell",',
29
+ ' command: "echo should-never-run",',
30
+ ' defaultModel: "test-model",',
31
+ ' },',
32
+ '};',
33
+ '',
34
+ ].join('\n'), 'utf-8');
35
+ const totemDir = path.join(tmpDir, '.totem');
36
+ const lessonsDir = path.join(totemDir, 'lessons');
37
+ fs.mkdirSync(lessonsDir, { recursive: true });
38
+ for (const [name, body] of Object.entries(options.lessons)) {
39
+ fs.writeFileSync(path.join(lessonsDir, name), body, 'utf-8');
40
+ }
41
+ const rulesPath = path.join(totemDir, 'compiled-rules.json');
42
+ const now = '2026-04-22T00:00:00Z';
43
+ fs.writeFileSync(rulesPath, JSON.stringify({
44
+ version: 1,
45
+ rules: options.rules.map((r) => ({
46
+ lessonHash: r.lessonHash,
47
+ lessonHeading: r.lessonHeading,
48
+ pattern: 'dummy-never-matches',
49
+ message: r.lessonHeading,
50
+ engine: 'regex',
51
+ compiledAt: now,
52
+ ...(r.status ? { status: r.status } : {}),
53
+ })),
54
+ nonCompilable: [],
55
+ }, null, 2) + '\n', 'utf-8');
56
+ // Write manifest with an output_hash that matches the rules file as written.
57
+ // Tests that want drift will mutate the rules file AFTER setupWorkspace.
58
+ const manifestPath = path.join(totemDir, 'compile-manifest.json');
59
+ fs.writeFileSync(manifestPath, JSON.stringify({
60
+ compiled_at: now,
61
+ model: 'test-model',
62
+ input_hash: '0000000000000000000000000000000000000000000000000000000000000000',
63
+ output_hash: generateOutputHash(rulesPath),
64
+ rule_count: options.rules.length,
65
+ }, null, 2) + '\n', 'utf-8');
66
+ }
67
+ describe('compileCommand --refresh-manifest (#1587)', () => {
68
+ let tmpDir;
69
+ let originalCwd;
70
+ beforeEach(() => {
71
+ tmpDir = makeTmpDir();
72
+ originalCwd = process.cwd();
73
+ process.chdir(tmpDir);
74
+ });
75
+ afterEach(() => {
76
+ process.chdir(originalCwd);
77
+ cleanTmpDir(tmpDir);
78
+ });
79
+ it('updates manifest output_hash without invoking compilation when --refresh-manifest is passed', async () => {
80
+ // Scenario: a postmerge archive script mutates compiled-rules.json in
81
+ // place (flipping status to 'archived'). The output_hash in the manifest
82
+ // is now stale. `--refresh-manifest` must recompute it without running
83
+ // the LLM or touching lessons.
84
+ const heading = 'Use err in catch';
85
+ const body = 'Do not use the identifier "error" in catch blocks.';
86
+ const lessonHash = hashLesson(heading, body);
87
+ setupWorkspace(tmpDir, {
88
+ lessons: { 'use-err.md': lessonMarkdown(heading, body) },
89
+ rules: [{ lessonHash, lessonHeading: heading }],
90
+ });
91
+ const totemDir = path.join(tmpDir, '.totem');
92
+ const rulesPath = path.join(totemDir, 'compiled-rules.json');
93
+ const manifestPath = path.join(totemDir, 'compile-manifest.json');
94
+ const manifestBefore = readCompileManifest(manifestPath);
95
+ const hashBefore = manifestBefore.output_hash;
96
+ // Simulate the postmerge archive-in-place: mutate compiled-rules.json
97
+ // directly (flip status to 'archived' on the only rule).
98
+ const rulesJson = JSON.parse(fs.readFileSync(rulesPath, 'utf-8'));
99
+ rulesJson.rules[0].status = 'archived';
100
+ rulesJson.rules[0].archivedReason = 'test archive';
101
+ rulesJson.rules[0].archivedAt = '2026-04-23T00:00:00Z';
102
+ fs.writeFileSync(rulesPath, JSON.stringify(rulesJson, null, 2) + '\n', 'utf-8');
103
+ const rulesFileHashAfterMutation = generateOutputHash(rulesPath);
104
+ expect(rulesFileHashAfterMutation).not.toBe(hashBefore);
105
+ await compileCommand({ refreshManifest: true });
106
+ const manifestAfter = readCompileManifest(manifestPath);
107
+ expect(manifestAfter.output_hash).toBe(rulesFileHashAfterMutation);
108
+ });
109
+ it('is a no-op when the manifest is already fresh', async () => {
110
+ // Baseline: rules and manifest agree. `--refresh-manifest` must not
111
+ // write the manifest back (no compiled_at bump, no byte change).
112
+ const heading = 'Use err in catch';
113
+ const body = 'Do not use the identifier "error" in catch blocks.';
114
+ const lessonHash = hashLesson(heading, body);
115
+ setupWorkspace(tmpDir, {
116
+ lessons: { 'use-err.md': lessonMarkdown(heading, body) },
117
+ rules: [{ lessonHash, lessonHeading: heading }],
118
+ });
119
+ const totemDir = path.join(tmpDir, '.totem');
120
+ const manifestPath = path.join(totemDir, 'compile-manifest.json');
121
+ const manifestBytesBefore = fs.readFileSync(manifestPath, 'utf-8');
122
+ await compileCommand({ refreshManifest: true });
123
+ const manifestBytesAfter = fs.readFileSync(manifestPath, 'utf-8');
124
+ expect(manifestBytesAfter).toBe(manifestBytesBefore);
125
+ });
126
+ it('throws TotemConfigError when combined with --force', async () => {
127
+ // Strict exclusivity: --refresh-manifest is a no-LLM primitive and
128
+ // cannot combine with --force (an LLM-invoking regenerate). The combo
129
+ // is incoherent; fail loud rather than pick a silent resolution.
130
+ const heading = 'Use err in catch';
131
+ const body = 'Do not use the identifier "error" in catch blocks.';
132
+ const lessonHash = hashLesson(heading, body);
133
+ setupWorkspace(tmpDir, {
134
+ lessons: { 'use-err.md': lessonMarkdown(heading, body) },
135
+ rules: [{ lessonHash, lessonHeading: heading }],
136
+ });
137
+ await expect(compileCommand({ refreshManifest: true, force: true })).rejects.toMatchObject({
138
+ code: 'CONFIG_INVALID',
139
+ });
140
+ });
141
+ it('leaves the rules file untouched on a successful refresh', async () => {
142
+ // The primitive must be read-only w.r.t. compiled-rules.json. Only the
143
+ // manifest is written. Byte-for-byte equality is the strictest check.
144
+ const heading = 'Use err in catch';
145
+ const body = 'Do not use the identifier "error" in catch blocks.';
146
+ const lessonHash = hashLesson(heading, body);
147
+ setupWorkspace(tmpDir, {
148
+ lessons: { 'use-err.md': lessonMarkdown(heading, body) },
149
+ rules: [{ lessonHash, lessonHeading: heading, status: 'archived' }],
150
+ });
151
+ const totemDir = path.join(tmpDir, '.totem');
152
+ const rulesPath = path.join(totemDir, 'compiled-rules.json');
153
+ // Mutate the rules file so there is drift to refresh against.
154
+ const rulesJson = JSON.parse(fs.readFileSync(rulesPath, 'utf-8'));
155
+ rulesJson.rules[0].archivedReason = 'test archive drift';
156
+ fs.writeFileSync(rulesPath, JSON.stringify(rulesJson, null, 2) + '\n', 'utf-8');
157
+ const rulesBytesBefore = fs.readFileSync(rulesPath, 'utf-8');
158
+ await compileCommand({ refreshManifest: true });
159
+ const rulesBytesAfter = fs.readFileSync(rulesPath, 'utf-8');
160
+ expect(rulesBytesAfter).toBe(rulesBytesBefore);
161
+ });
162
+ });
163
+ //# sourceMappingURL=compile-refresh-manifest.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compile-refresh-manifest.test.js","sourceRoot":"","sources":["../../src/commands/compile-refresh-manifest.test.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAErE,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnF,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,wDAAwD;AACxD,EAAE;AACF,iFAAiF;AACjF,2EAA2E;AAC3E,4EAA4E;AAC5E,yEAAyE;AACzE,2EAA2E;AAC3E,iCAAiC;AAEjC,SAAS,UAAU;IACjB,OAAO,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,yBAAyB,CAAC,CAAC,CAAC;AAC3E,CAAC;AAED,SAAS,cAAc,CAAC,OAAe,EAAE,IAAY;IACnD,OAAO,eAAe,OAAO,yBAAyB,IAAI,IAAI,CAAC;AACjE,CAAC;AAOD,SAAS,cAAc,CAAC,MAAc,EAAE,OAAyB;IAC/D,EAAE,CAAC,aAAa,CACd,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,iBAAiB,CAAC,EACpC;QACE,kBAAkB;QAClB,6EAA6E;QAC7E,uBAAuB;QACvB,mBAAmB;QACnB,wBAAwB;QACxB,uCAAuC;QACvC,iCAAiC;QACjC,MAAM;QACN,IAAI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CAAC,aAAa,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC,CAAC;QAEhF,MAAM,gBAAgB,GAAG,EAAE,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAE7D,MAAM,cAAc,CAAC,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC;QAEhD,MAAM,eAAe,GAAG,EAAE,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAC5D,MAAM,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -25,5 +25,5 @@
25
25
  export declare const KIND_ALLOW_LIST: readonly ["for_statement", "for_in_statement", "while_statement", "do_statement", "try_statement", "catch_clause", "function_declaration", "method_definition", "arrow_function", "class_declaration", "class_body", "import_statement", "export_statement", "if_statement", "switch_statement"];
26
26
  export type KindAllowListEntry = (typeof KIND_ALLOW_LIST)[number];
27
27
  export declare const COMPILER_SYSTEM_PROMPT: string;
28
- export declare const PIPELINE3_COMPILER_PROMPT = "# Example-Based Rule Compiler \u2014 Pipeline 3\n\n## Identity\nYou are a deterministic rule compiler. Your job is to analyze Bad and Good code snippets and generate a regex pattern that catches the BAD pattern but NOT the good pattern.\n\n## Input\nYou will receive:\n1. A lesson heading describing the rule\n2. **Bad Code** \u2014 code that should trigger the rule (violations)\n3. **Good Code** \u2014 code that should NOT trigger (correct alternatives)\n4. The full lesson body for additional context\n\n## Strategy\n1. Identify the structural difference between Bad and Good code\n2. Find a regex pattern that matches the BAD lines but not the GOOD lines\n3. The pattern will be tested line-by-line against git diff additions\n4. Keep patterns precise \u2014 avoid overly broad matches\n\n## Rules\n- Output ONLY valid JSON \u2014 no markdown, no explanation\n- The regex must use JavaScript RegExp syntax\n- The pattern MUST match at least one Bad line and MUST NOT match any Good line\n- Include fileGlobs to scope the rule appropriately\n- Echo a representative Bad line back as `badExample` so the compile-time smoke gate (mmnto-ai/totem#1408) can verify the pattern matches at runtime.\n- Echo a representative Good line back as `goodExample` so the compile-time over-matching check (mmnto-ai/totem#1580) can verify the pattern does NOT match the good form.\n- **CRITICAL \u2014 Always use recursive glob patterns with `**/` prefix** (e.g., `**/*.ts`, `**/*.py`)\n- **CRITICAL \u2014 Supported glob syntax only:** `**/*.ext`, `dir/**/*.ext`, `!pattern` for negation. NO brace expansion.\n\n## Output Schema\n```json\n{\n \"compilable\": true,\n \"pattern\": \"regex pattern that catches Bad but not Good\",\n \"message\": \"human-readable violation message\",\n \"badExample\": \"one of the Bad lines, copied verbatim\",\n \"goodExample\": \"one of the Good lines, copied verbatim\",\n \"fileGlobs\": [\"**/*.ts\", \"!**/*.test.ts\"]\n}\n```\n\nOr if the difference cannot be expressed as a line-level regex:\n```json\n{\n \"compilable\": false,\n \"reason\": \"Explanation of why a regex cannot distinguish these snippets\"\n}\n```\n\nEvery compilable rule MUST include non-empty `badExample` AND `goodExample` fields. The compile pipeline's schema parse rejects output that omits either one for `ast-grep` or `regex` engines, so the rule never reaches the smoke gate. The smoke gate then runs the rule against both snippets: the pattern MUST match `badExample` (zero matches here rejects with reason code `pattern-zero-match`) and MUST NOT match `goodExample` (any match here rejects with reason code `matches-good-example`).\n";
28
+ export declare const PIPELINE3_COMPILER_PROMPT = "# Example-Based Rule Compiler \u2014 Pipeline 3\n\n## Identity\nYou are a deterministic rule compiler. Your job is to analyze Bad and Good code snippets and generate a regex pattern that catches the BAD pattern but NOT the good pattern.\n\n## Input\nYou will receive:\n1. A lesson heading describing the rule\n2. **Bad Code** \u2014 code that should trigger the rule (violations)\n3. **Good Code** \u2014 code that should NOT trigger (correct alternatives)\n4. The full lesson body for additional context\n\n## Strategy\n1. Identify the structural difference between Bad and Good code\n2. Find a regex pattern that matches the BAD lines but not the GOOD lines\n3. The pattern will be tested line-by-line against git diff additions\n4. Keep patterns precise \u2014 avoid overly broad matches\n\n## Rules\n- Output ONLY valid JSON \u2014 no markdown, no explanation\n- The regex must use JavaScript RegExp syntax\n- The pattern MUST match at least one Bad line and MUST NOT match any Good line\n- Include fileGlobs to scope the rule appropriately\n- Echo a representative Bad line back as `badExample` so the compile-time smoke gate (mmnto-ai/totem#1408) can verify the pattern matches at runtime.\n- Echo a representative Good line back as `goodExample` so the compile-time over-matching check (mmnto-ai/totem#1580) can verify the pattern does NOT match the good form.\n- **CRITICAL \u2014 Always use recursive glob patterns with `**/` prefix** (e.g., `**/*.ts`, `**/*.py`)\n- **CRITICAL \u2014 Supported glob syntax only:** `**/*.ext`, `dir/**/*.ext`, `!pattern` for negation. NO brace expansion.\n\n## Output Schema\n```json\n{\n \"compilable\": true,\n \"pattern\": \"regex pattern that catches Bad but not Good\",\n \"message\": \"human-readable violation message\",\n \"badExample\": \"one of the Bad lines, copied verbatim\",\n \"goodExample\": \"one of the Good lines, copied verbatim\",\n \"fileGlobs\": [\"**/*.ts\", \"!**/*.test.ts\"]\n}\n```\n\nOr if the difference cannot be expressed as a line-level regex:\n```json\n{\n \"compilable\": false,\n \"reason\": \"Explanation of why a regex cannot distinguish these snippets\"\n}\n```\n\n### Context Constraints Classifier (mmnto-ai/totem#1598)\n\nSome lessons describe **real code defects** whose hazard depends on a **context the pattern cannot capture**. The Bad snippet and Good snippet may look textually similar aside from their surrounding context \u2014 the violation is about WHERE the code appears, not just WHAT the code is. A naive regex derived from the Bad line would fire on every surface match, producing a false-positive-prone rule.\n\nMarkers in the lesson body that signal this class:\n- \"**inside** X\", \"**within** X\", \"**when wrapped in** X\", \"**when called from** X\" \u2014 scope guards\n- \"**only for new** X\", \"**only when** X\", \"**except when** X\" \u2014 conditional guards\n\nWhen you cannot write a regex that distinguishes the Bad lines from the Good lines because the distinguishing context lives outside the snippet itself (and `fileGlobs` alone cannot close the gap), emit:\n\n```json\n{\n \"compilable\": false,\n \"reasonCode\": \"context-required\",\n \"reason\": \"Lesson constrains scope to <the guard>; Bad and Good snippets differ only in surrounding context the pattern cannot see.\"\n}\n```\n\nThe `reasonCode` field is optional and narrow \u2014 `\"context-required\"` and `\"semantic-analysis-required\"` (see Semantic Analysis Classifier below) are the only values you may emit. Absence of the field keeps the default classification.\n\n**Anti-lazy guard:** when `fileGlobs` CAN express the distinguishing scope (e.g., \"only in JSON files\", \"only in test files\"), compile normally with the appropriate glob. Only fall back to `context-required` when the structural tools genuinely cannot reach the guard.\n\n### Semantic Analysis Classifier (mmnto-ai/totem#1634)\n\nEven with Bad and Good snippets in hand, some lessons describe hazards that require **semantic or multi-file analysis** the compiler cannot perform. Four sub-classes:\n\n- **Multi-file contracts.** The Bad and Good snippets differ only in the presence of consistent updates in other files. Pattern fires the same on both.\n- **Closure-body AST analysis.** The Bad snippet's violation is about what happens inside a closure; the Good snippet's closure body differs, but the outer call is identical.\n- **System-parameter-aware scoping.** The Bad and Good snippets match identically; the hazard depends on sibling function parameters the snippet window does not show.\n- **Project-state-conditional semantics.** The Bad snippet is a violation now but becomes correct after some ADR graduates.\n\nWhen the snippet pair cannot be distinguished by any single-line pattern because the distinguishing analysis lives outside the pattern's reach, emit:\n\n```json\n{\n \"compilable\": false,\n \"reasonCode\": \"semantic-analysis-required\",\n \"reason\": \"Bad and Good snippets differ only in analysis outside pattern reach (multi-file / closure-body / sibling-param / project-state).\"\n}\n```\n\nThe `reasonCode` field is narrow \u2014 `\"context-required\"` and `\"semantic-analysis-required\"` are the only values you may emit. Use `semantic-analysis-required` when the required analysis exceeds the compiler's capability; use `context-required` when a structural guard exists but the pattern vocabulary cannot express it.\n\n**Anti-lazy guard:** compile normally when the distinguishing difference is on the Bad/Good lines themselves or when `fileGlobs` can scope the rule. Only emit `semantic-analysis-required` when no pattern can discriminate the snippet pair regardless of vocabulary.\n\nEvery compilable rule MUST include non-empty `badExample` AND `goodExample` fields. The compile pipeline's schema parse rejects output that omits either one for `ast-grep` or `regex` engines, so the rule never reaches the smoke gate. The smoke gate then runs the rule against both snippets: the pattern MUST match `badExample` (zero matches here rejects with reason code `pattern-zero-match`) and MUST NOT match `goodExample` (any match here rejects with reason code `matches-good-example`).\n";
29
29
  //# sourceMappingURL=compile-templates.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compile-templates.d.ts","sourceRoot":"","sources":["../../src/commands/compile-templates.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,eAAe,kSAgBlB,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAIlE,eAAO,MAAM,sBAAsB,QA2TlC,CAAC;AAIF,eAAO,MAAM,yBAAyB,4lFAiDrC,CAAC"}
1
+ {"version":3,"file":"compile-templates.d.ts","sourceRoot":"","sources":["../../src/commands/compile-templates.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,eAAe,kSAgBlB,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAIlE,eAAO,MAAM,sBAAsB,QAoZlC,CAAC;AAIF,eAAO,MAAM,yBAAyB,2iMA8FrC,CAAC"}
@@ -108,6 +108,95 @@ Or if the lesson cannot be compiled:
108
108
 
109
109
  When setting \`"compilable": false\`, always include a \`"reason"\` field explaining why the lesson cannot be compiled into a regex/AST pattern (e.g., "Lesson describes a conceptual architectural principle, not a detectable code pattern").
110
110
 
111
+ ### Context Constraints Classifier (mmnto-ai/totem#1598)
112
+
113
+ Some lessons describe **real code defects** whose hazard is bounded by a **context the pattern cannot capture**. The violation depends on WHERE the code appears, not just WHAT the code is. A naive pattern would fire on every surface match, producing a false-positive-prone rule.
114
+
115
+ Markers that signal a context constraint in the lesson body:
116
+ - "**inside** X", "**within** X", "**when wrapped in** X", "**when called from** X" — scope guards
117
+ - "**only for new** X", "**only when** X", "**except when** X" — conditional guards
118
+ - "**must not** X ... **when** Y" — combined guards
119
+
120
+ When the lesson carries such a guard AND the guard cannot be captured structurally (i.e., no \`fileGlobs\` / \`kind:\` / \`inside:\` combinator in ast-grep can express it), emit:
121
+
122
+ \`\`\`json
123
+ {
124
+ "compilable": false,
125
+ "reasonCode": "context-required",
126
+ "reason": "Lesson constrains scope to <the guard>; the pattern cannot distinguish violations from legitimate usage."
127
+ }
128
+ \`\`\`
129
+
130
+ The \`reasonCode\` field is optional and narrow — \`"context-required"\` and \`"semantic-analysis-required"\` (see Semantic Analysis Classifier below) are the only values you may emit. Absence of the field means the existing generic out-of-scope classification applies.
131
+
132
+ **Worked examples (DO emit \`context-required\`):**
133
+
134
+ - Lesson: "\`sim.tick()\` must not advance inside \`_process\`"
135
+ - Naive pattern \`sim\\.tick\\(\` would fire on the legitimate \`_physics_process()\` body. The guard ("inside \`_process\`") is a Godot runtime callback name, not a file-level or node-level scope expressible in regex or ast-grep.
136
+ - Correct output: \`{"compilable": false, "reasonCode": "context-required", "reason": "Lesson restricts sim.tick() to non-_process callbacks; pattern cannot distinguish _process from _physics_process enclosure."}\`
137
+
138
+ - Lesson: "new follow-up proposal IDs must not collide with existing ones"
139
+ - Naive pattern \`Proposal\\s+0*([0-9]+)\` would fire on every existing \`Proposal 042\` reference in the repo. The guard ("new IDs only") requires knowing which IDs are new at compile time, which no pattern can express.
140
+ - Correct output: \`{"compilable": false, "reasonCode": "context-required", "reason": "Lesson applies only to newly-introduced IDs; pattern cannot distinguish new from existing references."}\`
141
+
142
+ **Anti-lazy guard (DO compile):**
143
+
144
+ The existence of this escape hatch does **not** license lazy rejection. A scope-sensitive lesson whose guard IS expressible structurally MUST still compile:
145
+
146
+ - Lesson: "Use double quotes inside JSON files" → scope is captured by \`fileGlobs: ["**/*.json"]\`. Compile normally.
147
+ - Lesson: "No \`console.log\` inside React render methods" → scope is captured by an ast-grep \`inside: { kind: 'method_definition', has: { kind: 'identifier', regex: '^render$' } }\` combinator. Compile normally if you can express it; only fall back to \`context-required\` when the structural tools genuinely cannot reach the guard.
148
+
149
+ **Rule of thumb:** ask "can any of \`fileGlobs\`, ast-grep \`kind:\`, \`inside:\`, \`has:\`, or \`regex:\` express the guard the lesson describes?" If yes, compile. If no, emit \`context-required\`.
150
+
151
+ ### Semantic Analysis Classifier (mmnto-ai/totem#1634)
152
+
153
+ Some lessons describe real code defects whose hazard requires **semantic or multi-file analysis** that a single-line pattern cannot perform. Unlike \`context-required\` (where the guard is expressible in principle but the LLM lacks the structural vocabulary), these lessons describe hazards the compiler genuinely cannot reach from the lesson body alone.
154
+
155
+ Four sub-classes signal this:
156
+
157
+ - **Multi-file contracts.** The hazard is cross-system drift (e.g., "renaming \`SpatialEntry.x\` must also update every consumer"). Matching one file in isolation says nothing about the contract.
158
+ - **Closure-body AST analysis.** The hazard depends on what happens inside a closure passed to a parallel iterator (e.g., "captured-float assignment inside \`.par_iter_mut().for_each(...)\`"). The outer call is fine; the violation is about the body.
159
+ - **System-parameter-aware scoping.** The hazard depends on other system parameters in the same function (e.g., "\`Local<Vec<T>>\` is banned only when the enclosing system uses \`par_iter_mut\` somewhere else"). Pattern sees only the one annotation.
160
+ - **Project-state-conditional semantics.** The hazard applies until some ADR graduates, then relaxes (e.g., "Do NOT introduce rayon — this rule applies pre-ADR-022, relaxes after"). No pattern can read project state.
161
+
162
+ When the lesson carries a hazard of any of these sub-classes AND the compiler cannot perform the required analysis, emit:
163
+
164
+ \`\`\`json
165
+ {
166
+ "compilable": false,
167
+ "reasonCode": "semantic-analysis-required",
168
+ "reason": "Hazard requires <multi-file / closure-body / system-param / project-state-conditional> analysis; single-pattern rule cannot express it."
169
+ }
170
+ \`\`\`
171
+
172
+ The \`reasonCode\` field is narrow — \`"context-required"\` and \`"semantic-analysis-required"\` are the only values you may emit. Use \`semantic-analysis-required\` when the compiler's analytical capability is the bottleneck; use \`context-required\` when the guard exists but the pattern cannot express it structurally.
173
+
174
+ **Worked examples (DO emit \`semantic-analysis-required\`):**
175
+
176
+ - Lesson: "Parallel float reductions break lockstep determinism (use \`Parallel<T>\` for scratch under \`par_iter_mut\`)"
177
+ - Hazard is a closure body that writes to a captured floating-point scalar. Pattern \`\\.par_iter_mut\\(\\)\\.for_each\\(\` matches every parallel iteration including the non-offending ones. Detecting the real hazard requires parsing the closure body.
178
+ - Output: \`{"compilable": false, "reasonCode": "semantic-analysis-required", "reason": "Closure-body AST analysis required to detect captured-float assignment inside par_iter_mut().for_each."}\`
179
+
180
+ - Lesson: "\`Local<Vec<T>>\` is banned under \`par_iter_mut\` (use \`Parallel<T>\`)"
181
+ - Hazard depends on whether the enclosing system uses \`par_iter_mut\` anywhere in its body. Pattern \`Local<Vec<\\$T>>\` fires on every Local<Vec<T>> regardless. Detecting the real hazard requires walking the SystemParam tuple.
182
+ - Output: \`{"compilable": false, "reasonCode": "semantic-analysis-required", "reason": "Hazard requires walking the SystemParam tuple; single-line pattern cannot see sibling parameters."}\`
183
+
184
+ - Lesson: "Do NOT introduce rayon (pre-ADR-022 only)"
185
+ - Hazard is project-state-conditional: applies before ADR-022 graduates, relaxes after. No pattern can read ADR state.
186
+ - Output: \`{"compilable": false, "reasonCode": "semantic-analysis-required", "reason": "Project-state-conditional: rule applies pre-ADR-022; compiler cannot read governance state."}\`
187
+
188
+ **Anti-lazy guard (DO compile):**
189
+
190
+ Not every lesson that mentions a parallel iterator or a system parameter requires semantic analysis. Compile normally when:
191
+
192
+ - The hazard is the surface pattern itself (e.g., "never use \`unwrap()\` in production code" — compile as \`\\bunwrap\\(\\)\`).
193
+ - The scope is expressible via \`fileGlobs\` (e.g., "no \`console.log\` in production" with \`fileGlobs: ["**/*.ts", "!**/*.test.ts"]\`).
194
+ - ast-grep \`kind:\` / \`inside:\` / \`has:\` can reach the enclosing context.
195
+
196
+ Only fall back to \`semantic-analysis-required\` when the analysis the lesson demands is genuinely outside the compiler's reach.
197
+
198
+ **Rule of thumb:** ask "does detecting the hazard require analyzing code the pattern cannot see (other files, closure bodies, sibling parameters, project state)?" If yes, emit \`semantic-analysis-required\`. If no, compile — or fall back to \`context-required\` if the guard is local but structurally inexpressible.
199
+
111
200
  ## Examples
112
201
 
113
202
  Lesson: "Use \`err\` (never \`error\`) in catch blocks"
@@ -406,6 +495,51 @@ Or if the difference cannot be expressed as a line-level regex:
406
495
  }
407
496
  \`\`\`
408
497
 
498
+ ### Context Constraints Classifier (mmnto-ai/totem#1598)
499
+
500
+ Some lessons describe **real code defects** whose hazard depends on a **context the pattern cannot capture**. The Bad snippet and Good snippet may look textually similar aside from their surrounding context — the violation is about WHERE the code appears, not just WHAT the code is. A naive regex derived from the Bad line would fire on every surface match, producing a false-positive-prone rule.
501
+
502
+ Markers in the lesson body that signal this class:
503
+ - "**inside** X", "**within** X", "**when wrapped in** X", "**when called from** X" — scope guards
504
+ - "**only for new** X", "**only when** X", "**except when** X" — conditional guards
505
+
506
+ When you cannot write a regex that distinguishes the Bad lines from the Good lines because the distinguishing context lives outside the snippet itself (and \`fileGlobs\` alone cannot close the gap), emit:
507
+
508
+ \`\`\`json
509
+ {
510
+ "compilable": false,
511
+ "reasonCode": "context-required",
512
+ "reason": "Lesson constrains scope to <the guard>; Bad and Good snippets differ only in surrounding context the pattern cannot see."
513
+ }
514
+ \`\`\`
515
+
516
+ The \`reasonCode\` field is optional and narrow — \`"context-required"\` and \`"semantic-analysis-required"\` (see Semantic Analysis Classifier below) are the only values you may emit. Absence of the field keeps the default classification.
517
+
518
+ **Anti-lazy guard:** when \`fileGlobs\` CAN express the distinguishing scope (e.g., "only in JSON files", "only in test files"), compile normally with the appropriate glob. Only fall back to \`context-required\` when the structural tools genuinely cannot reach the guard.
519
+
520
+ ### Semantic Analysis Classifier (mmnto-ai/totem#1634)
521
+
522
+ Even with Bad and Good snippets in hand, some lessons describe hazards that require **semantic or multi-file analysis** the compiler cannot perform. Four sub-classes:
523
+
524
+ - **Multi-file contracts.** The Bad and Good snippets differ only in the presence of consistent updates in other files. Pattern fires the same on both.
525
+ - **Closure-body AST analysis.** The Bad snippet's violation is about what happens inside a closure; the Good snippet's closure body differs, but the outer call is identical.
526
+ - **System-parameter-aware scoping.** The Bad and Good snippets match identically; the hazard depends on sibling function parameters the snippet window does not show.
527
+ - **Project-state-conditional semantics.** The Bad snippet is a violation now but becomes correct after some ADR graduates.
528
+
529
+ When the snippet pair cannot be distinguished by any single-line pattern because the distinguishing analysis lives outside the pattern's reach, emit:
530
+
531
+ \`\`\`json
532
+ {
533
+ "compilable": false,
534
+ "reasonCode": "semantic-analysis-required",
535
+ "reason": "Bad and Good snippets differ only in analysis outside pattern reach (multi-file / closure-body / sibling-param / project-state)."
536
+ }
537
+ \`\`\`
538
+
539
+ The \`reasonCode\` field is narrow — \`"context-required"\` and \`"semantic-analysis-required"\` are the only values you may emit. Use \`semantic-analysis-required\` when the required analysis exceeds the compiler's capability; use \`context-required\` when a structural guard exists but the pattern vocabulary cannot express it.
540
+
541
+ **Anti-lazy guard:** compile normally when the distinguishing difference is on the Bad/Good lines themselves or when \`fileGlobs\` can scope the rule. Only emit \`semantic-analysis-required\` when no pattern can discriminate the snippet pair regardless of vocabulary.
542
+
409
543
  Every compilable rule MUST include non-empty \`badExample\` AND \`goodExample\` fields. The compile pipeline's schema parse rejects output that omits either one for \`ast-grep\` or \`regex\` engines, so the rule never reaches the smoke gate. The smoke gate then runs the rule against both snippets: the pattern MUST match \`badExample\` (zero matches here rejects with reason code \`pattern-zero-match\`) and MUST NOT match \`goodExample\` (any match here rejects with reason code \`matches-good-example\`).
410
544
  `;
411
545
  //# sourceMappingURL=compile-templates.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"compile-templates.js","sourceRoot":"","sources":["../../src/commands/compile-templates.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,eAAe;IACf,kBAAkB;IAClB,iBAAiB;IACjB,cAAc;IACd,eAAe;IACf,cAAc;IACd,sBA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AAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgRpC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoIpD,CAAC;AAEF,uDAAuD;AAEvD,MAAM,CAAC,MAAM,yBAAyB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8FxC,CAAC"}
@@ -52,6 +52,16 @@ export interface CompileOptions {
52
52
  /** Telemetry directive to inject into the Pipeline 2 prompt for this lesson. */
53
53
  telemetryPrefix?: string;
54
54
  }>;
55
+ /**
56
+ * Recompute `compile-manifest.json`'s `output_hash` from the current
57
+ * `compiled-rules.json` state without invoking the LLM or touching any
58
+ * lessons (mmnto-ai/totem#1587). Exists to support the postmerge
59
+ * inline-archive workflow where a curation script mutates
60
+ * `status: 'archived'` on a rule directly; `--refresh-manifest` is the
61
+ * blessed way to re-sync the manifest afterwards. Cannot combine with
62
+ * `--force`.
63
+ */
64
+ refreshManifest?: boolean;
55
65
  }
56
66
  /**
57
67
  * Build the directive injected into the Sonnet system prompt for `--upgrade`.
@@ -112,6 +122,26 @@ export declare function pruneStaleRules(rules: readonly CompiledRule[], currentH
112
122
  fresh: CompiledRule[];
113
123
  pruned: number;
114
124
  };
125
+ /**
126
+ * Replace-by-lessonHash if an entry with the same hash is already in the
127
+ * array; otherwise append. Preserves array order for existing entries so
128
+ * the compile loop's output stays stable across runs.
129
+ *
130
+ * Used by the --force durability path (mmnto-ai/totem#1587) and the
131
+ * non-force add-new-rule path: all success-side pushes go through this
132
+ * helper so transient compile failures leave old rules intact and
133
+ * repeated successes do not double-insert.
134
+ */
135
+ export declare function upsertRule(rules: CompiledRule[], rule: CompiledRule): void;
136
+ /**
137
+ * Remove the first rule matching `lessonHash` from `rules`, in place.
138
+ * No-op when no match. Used on the `--force` / upgrade skipped paths in
139
+ * both local and cloud workers: when a lesson transitions to
140
+ * non-compilable, any pre-existing rule for the same hash must be evicted
141
+ * from the active set, otherwise --force leaves the old rule alive while
142
+ * also marking the hash non-compilable (mmnto-ai/totem#1629 CR finding).
143
+ */
144
+ export declare function removeRuleByHash(rules: CompiledRule[], lessonHash: string): void;
115
145
  /**
116
146
  * Format a lesson's trace array into a single multi-line block for the
117
147
  * `--verbose` renderer. Returns a string (no trailing newline — caller
@@ -1 +1 @@
1
- {"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/commands/compile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EAEZ,eAAe,EACf,WAAW,EACX,kBAAkB,EAClB,uBAAuB,EACxB,MAAM,cAAc,CAAC;AAYtB;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEvE,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,aAAa,CAAC;CACvB;AAED,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,GAAG,CAAC,EAAE,MAAM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