specdx 0.3.0-alpha.3 → 0.4.0-alpha.10

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 (82) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/LICENSE +21 -0
  3. package/dist/{changelog-OUP2RXWN.js → changelog-GR53T6IG.js} +18 -11
  4. package/dist/{changelog-OUP2RXWN.js.map → changelog-GR53T6IG.js.map} +1 -1
  5. package/dist/{check-3XQYO3HU.js → check-OMWCIY5D.js} +37 -10
  6. package/dist/check-OMWCIY5D.js.map +1 -0
  7. package/dist/chunk-3GMYCATE.js +526 -0
  8. package/dist/chunk-3GMYCATE.js.map +1 -0
  9. package/dist/{chunk-6BWZEAST.js → chunk-N77RNV7J.js} +161 -26
  10. package/dist/chunk-N77RNV7J.js.map +1 -0
  11. package/dist/{pack-PI6V6OR2.js → chunk-SDDTD4R3.js} +97 -171
  12. package/dist/chunk-SDDTD4R3.js.map +1 -0
  13. package/dist/{chunk-ZX4HVL5M.js → chunk-SJCIM4TC.js} +119 -17
  14. package/dist/chunk-SJCIM4TC.js.map +1 -0
  15. package/dist/{chunk-DDFLMRPC.js → chunk-VMMTEGYN.js} +15 -11
  16. package/dist/chunk-VMMTEGYN.js.map +1 -0
  17. package/dist/{chunk-PHR7AV6I.js → chunk-Z77VQUZ3.js} +156 -2
  18. package/dist/chunk-Z77VQUZ3.js.map +1 -0
  19. package/dist/diff-AUBYOQWU.js +107 -0
  20. package/dist/diff-AUBYOQWU.js.map +1 -0
  21. package/dist/dist-BXYQB2UO.js +306 -0
  22. package/dist/dist-BXYQB2UO.js.map +1 -0
  23. package/dist/dist-RL2DT3ZE.js +15 -0
  24. package/dist/{explain-I7AQMEEH.js → explain-EUID6MZF.js} +35 -28
  25. package/dist/explain-EUID6MZF.js.map +1 -0
  26. package/dist/{generate-PC7BIB7G.js → generate-U3EFOCNS.js} +3 -3
  27. package/dist/{generate-story-7WHPPFHY.js → generate-story-U6FMQIYZ.js} +8 -4
  28. package/dist/generate-story-U6FMQIYZ.js.map +1 -0
  29. package/dist/{generate-test-plan-U5LMWGKX.js → generate-test-plan-HOCWDYKF.js} +11 -6
  30. package/dist/generate-test-plan-HOCWDYKF.js.map +1 -0
  31. package/dist/graph-TA54D4XA.js +102 -0
  32. package/dist/graph-TA54D4XA.js.map +1 -0
  33. package/dist/index.js +777 -158
  34. package/dist/index.js.map +1 -1
  35. package/dist/{lint-6Z2TVWAQ.js → lint-L5WOBD25.js} +17 -6
  36. package/dist/lint-L5WOBD25.js.map +1 -0
  37. package/dist/main.js +100 -15
  38. package/dist/main.js.map +1 -1
  39. package/dist/mcp-GNQQGD7X.js +17 -0
  40. package/dist/mcp-GNQQGD7X.js.map +1 -0
  41. package/dist/{migrate-L7W5RHSS.js → migrate-YEJQWIMX.js} +4 -4
  42. package/dist/migrate-YEJQWIMX.js.map +1 -0
  43. package/dist/pack-AQH5XQUF.js +168 -0
  44. package/dist/pack-AQH5XQUF.js.map +1 -0
  45. package/dist/ready-DB5ORK2E.js +229 -0
  46. package/dist/ready-DB5ORK2E.js.map +1 -0
  47. package/dist/skills/specdx-check-drift.md +1 -1
  48. package/dist/skills/specdx-verify.md +12 -1
  49. package/dist/{status-AV5GSWVI.js → status-3QUQMF4L.js} +46 -31
  50. package/dist/status-3QUQMF4L.js.map +1 -0
  51. package/dist/{update-HIWDDEZQ.js → update-PE2DPYDR.js} +5 -5
  52. package/dist/update-PE2DPYDR.js.map +1 -0
  53. package/dist/validate-YNZMV6KZ.js +86 -0
  54. package/dist/validate-YNZMV6KZ.js.map +1 -0
  55. package/hooks/session-start +0 -0
  56. package/package.json +49 -16
  57. package/dist/check-3XQYO3HU.js.map +0 -1
  58. package/dist/chunk-6BWZEAST.js.map +0 -1
  59. package/dist/chunk-DDFLMRPC.js.map +0 -1
  60. package/dist/chunk-PHR7AV6I.js.map +0 -1
  61. package/dist/chunk-WTFWNYJA.js +0 -261
  62. package/dist/chunk-WTFWNYJA.js.map +0 -1
  63. package/dist/chunk-ZX4HVL5M.js.map +0 -1
  64. package/dist/diff-275PLXYH.js +0 -100
  65. package/dist/diff-275PLXYH.js.map +0 -1
  66. package/dist/dist-PQCG2XXF.js +0 -11
  67. package/dist/explain-I7AQMEEH.js.map +0 -1
  68. package/dist/generate-story-7WHPPFHY.js.map +0 -1
  69. package/dist/generate-test-plan-U5LMWGKX.js.map +0 -1
  70. package/dist/graph-RCAPF55A.js +0 -54
  71. package/dist/graph-RCAPF55A.js.map +0 -1
  72. package/dist/lint-6Z2TVWAQ.js.map +0 -1
  73. package/dist/migrate-L7W5RHSS.js.map +0 -1
  74. package/dist/pack-PI6V6OR2.js.map +0 -1
  75. package/dist/ready-B7IFPL3S.js +0 -159
  76. package/dist/ready-B7IFPL3S.js.map +0 -1
  77. package/dist/status-AV5GSWVI.js.map +0 -1
  78. package/dist/update-HIWDDEZQ.js.map +0 -1
  79. package/dist/validate-N2WSG75W.js +0 -34
  80. package/dist/validate-N2WSG75W.js.map +0 -1
  81. /package/dist/{dist-PQCG2XXF.js.map → dist-RL2DT3ZE.js.map} +0 -0
  82. /package/dist/{generate-PC7BIB7G.js.map → generate-U3EFOCNS.js.map} +0 -0
@@ -0,0 +1,526 @@
1
+ import {
2
+ buildRelationResolver
3
+ } from "./chunk-Z77VQUZ3.js";
4
+ import {
5
+ REQUIRED_SECTIONS
6
+ } from "./chunk-SJCIM4TC.js";
7
+
8
+ // ../lint/dist/engine.js
9
+ function createLintEngine(options) {
10
+ return {
11
+ lint(specs) {
12
+ const diagnostics = [];
13
+ for (const spec of specs) {
14
+ for (const rule of options.rules) {
15
+ const results = rule.run({
16
+ spec,
17
+ allSpecs: specs,
18
+ config: options.config,
19
+ graph: options.graph
20
+ });
21
+ diagnostics.push(...results);
22
+ }
23
+ }
24
+ return {
25
+ diagnostics,
26
+ hasErrors: diagnostics.some((d) => d.severity === "error"),
27
+ hasWarnings: diagnostics.some((d) => d.severity === "warn")
28
+ };
29
+ }
30
+ };
31
+ }
32
+
33
+ // ../lint/dist/rules/valid-frontmatter.js
34
+ var validFrontmatterRule = {
35
+ id: "structure/valid-frontmatter",
36
+ description: "Frontmatter matches the schema for the declared spec type",
37
+ severity: "error",
38
+ run(context) {
39
+ if (context.spec.valid)
40
+ return [];
41
+ const errors = context.spec.validationErrors ?? [];
42
+ return errors.map((err) => ({
43
+ ruleId: "structure/valid-frontmatter",
44
+ severity: "error",
45
+ message: `Invalid frontmatter: ${err.message ?? JSON.stringify(err)}`,
46
+ filePath: context.spec.filePath
47
+ }));
48
+ }
49
+ };
50
+
51
+ // ../lint/dist/rules/required-sections.js
52
+ var requiredSectionsRule = {
53
+ id: "structure/required-sections",
54
+ description: "Spec body contains all required sections for its type",
55
+ severity: "error",
56
+ run(context) {
57
+ const ext = context.spec.filePath.split(".").pop()?.toLowerCase();
58
+ if (ext === "yaml" || ext === "yml")
59
+ return [];
60
+ const specType = context.spec.frontmatter.type;
61
+ const required = REQUIRED_SECTIONS[specType];
62
+ if (!required)
63
+ return [];
64
+ const missing = required.filter((s) => !context.spec.sections.includes(s));
65
+ return missing.map((section) => ({
66
+ ruleId: "structure/required-sections",
67
+ severity: "error",
68
+ message: `Missing required section: "${section}"`,
69
+ filePath: context.spec.filePath,
70
+ section
71
+ }));
72
+ }
73
+ };
74
+
75
+ // ../lint/dist/rules/valid-references.js
76
+ var validReferencesRule = {
77
+ id: "structure/valid-references",
78
+ description: "All references in frontmatter point to specs that exist in the suite",
79
+ severity: "error",
80
+ run(context) {
81
+ const refs = context.spec.frontmatter.references;
82
+ if (!refs || refs.length === 0)
83
+ return [];
84
+ const allIds = new Set(context.allSpecs.map((s) => s.frontmatter.id));
85
+ return refs.filter((ref) => !allIds.has(ref.id)).map((ref) => ({
86
+ ruleId: "structure/valid-references",
87
+ severity: "error",
88
+ message: `Reference "${ref.id}" does not match any spec in the suite`,
89
+ filePath: context.spec.filePath
90
+ }));
91
+ }
92
+ };
93
+
94
+ // ../lint/dist/rules/no-circular-deps.js
95
+ var noCircularDepsRule = {
96
+ id: "structure/no-circular-deps",
97
+ description: "The dependency graph has no cycles",
98
+ severity: "error",
99
+ run() {
100
+ return [];
101
+ }
102
+ };
103
+
104
+ // ../lint/dist/rules/story-coverage.js
105
+ var FEATURE_PATTERN = /\*\*F\d+\*\*:\s*(.+)/g;
106
+ var storyCoverageRule = {
107
+ id: "completeness/story-coverage",
108
+ description: "Every feature listed in a PRD has at least one corresponding user story",
109
+ severity: "warn",
110
+ run(context) {
111
+ if (context.spec.frontmatter.type !== "prd")
112
+ return [];
113
+ const features = [];
114
+ let match;
115
+ const re = new RegExp(FEATURE_PATTERN.source, "g");
116
+ while ((match = re.exec(context.spec.content)) !== null) {
117
+ features.push(match[1].trim());
118
+ }
119
+ if (features.length === 0)
120
+ return [];
121
+ const stories = context.allSpecs.filter((s) => s.frontmatter.type === "user-story");
122
+ const storyContent = stories.map((s) => s.content + " " + s.frontmatter.title).join(" ");
123
+ return features.filter((feature) => !storyContent.toLowerCase().includes(feature.toLowerCase())).map((feature) => ({
124
+ ruleId: "completeness/story-coverage",
125
+ severity: "warn",
126
+ message: `Feature "${feature}" has no corresponding user story`,
127
+ filePath: context.spec.filePath
128
+ }));
129
+ }
130
+ };
131
+
132
+ // ../lint/dist/rules/staleness-check.js
133
+ function groupByEntry(config, specs) {
134
+ const byEntry = /* @__PURE__ */ new Map();
135
+ for (const key of Object.keys(config.specs))
136
+ byEntry.set(key, []);
137
+ for (const spec of specs) {
138
+ let bestKey;
139
+ let bestLen = -1;
140
+ for (const [key, entry] of Object.entries(config.specs)) {
141
+ const prefix = entry.path.split("*")[0] ?? "";
142
+ const normalized = spec.filePath.replace(/\\/g, "/");
143
+ if (normalized.includes(prefix) && prefix.length > bestLen) {
144
+ bestKey = key;
145
+ bestLen = prefix.length;
146
+ }
147
+ }
148
+ if (bestKey)
149
+ byEntry.get(bestKey).push(spec);
150
+ }
151
+ return byEntry;
152
+ }
153
+ function lastUpdated(spec) {
154
+ return spec.frontmatter.updated ?? spec.frontmatter.created ?? "";
155
+ }
156
+ var stalenessCheckRule = {
157
+ id: "freshness/staleness-check",
158
+ description: "Warns if a spec hasn't been updated since its upstream dependency changed",
159
+ severity: "warn",
160
+ run(context) {
161
+ const specId = context.spec.frontmatter.id;
162
+ if (typeof specId !== "string")
163
+ return [];
164
+ const specUpdated = lastUpdated(context.spec);
165
+ if (!specUpdated)
166
+ return [];
167
+ const specDate = new Date(specUpdated);
168
+ const byEntry = context.config ? groupByEntry(context.config, context.allSpecs) : /* @__PURE__ */ new Map([["", context.allSpecs]]);
169
+ const relations = buildRelationResolver(context.config, byEntry);
170
+ const upstreamIds = relations.getUpstream(specId);
171
+ const diagnostics = [];
172
+ for (const upstreamId of upstreamIds) {
173
+ const upstream = context.allSpecs.find((s) => s.frontmatter.id === upstreamId);
174
+ if (!upstream)
175
+ continue;
176
+ const upstreamUpdated = lastUpdated(upstream);
177
+ if (!upstreamUpdated)
178
+ continue;
179
+ if (new Date(upstreamUpdated) > specDate) {
180
+ diagnostics.push({
181
+ ruleId: "freshness/staleness-check",
182
+ severity: "warn",
183
+ message: `Potentially stale: upstream "${upstreamId}" was updated on ${upstreamUpdated}, but this spec was last updated on ${specUpdated}`,
184
+ filePath: context.spec.filePath
185
+ });
186
+ }
187
+ }
188
+ return diagnostics;
189
+ }
190
+ };
191
+
192
+ // ../lint/dist/rules/no-vague-language.js
193
+ var DEFAULT_VAGUE_PATTERNS = [
194
+ "as appropriate",
195
+ "handle edge cases",
196
+ "as needed",
197
+ "etc\\.",
198
+ "TBD",
199
+ "TODO",
200
+ "and so on",
201
+ "various",
202
+ "somehow",
203
+ "straightforward",
204
+ "obviously",
205
+ "simply",
206
+ "just need to"
207
+ ];
208
+ var noVagueLanguageRule = {
209
+ id: "clarity/no-vague-language",
210
+ description: "Flags known ambiguous phrases",
211
+ severity: "warn",
212
+ run(context) {
213
+ if (!context.spec.content)
214
+ return [];
215
+ const diagnostics = [];
216
+ for (const pattern of DEFAULT_VAGUE_PATTERNS) {
217
+ const regex = new RegExp(`\\b${pattern}`, "gi");
218
+ let match;
219
+ while ((match = regex.exec(context.spec.content)) !== null) {
220
+ diagnostics.push({
221
+ ruleId: "clarity/no-vague-language",
222
+ severity: "warn",
223
+ message: `Vague language: "${match[0]}"`,
224
+ filePath: context.spec.filePath
225
+ });
226
+ }
227
+ }
228
+ return diagnostics;
229
+ }
230
+ };
231
+
232
+ // ../lint/dist/rules/single-project-context.js
233
+ var singleProjectContextRule = {
234
+ id: "structure/single-project-context",
235
+ description: "Only one project-context spec should exist per suite",
236
+ severity: "warn",
237
+ run(context) {
238
+ if (context.spec.frontmatter.type !== "project-context")
239
+ return [];
240
+ const contextSpecs = context.allSpecs.filter((s) => s.frontmatter.type === "project-context");
241
+ if (contextSpecs.length > 1) {
242
+ return [
243
+ {
244
+ ruleId: "structure/single-project-context",
245
+ severity: "warn",
246
+ message: `Multiple project-context specs found (${contextSpecs.length}). Only one should exist per suite.`,
247
+ filePath: context.spec.filePath
248
+ }
249
+ ];
250
+ }
251
+ return [];
252
+ }
253
+ };
254
+
255
+ // ../lint/dist/rules/terminology.js
256
+ function normalizeCompound(term) {
257
+ return term.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[-_]/g, " ").toLowerCase().trim();
258
+ }
259
+ function extractCompoundTerms(content) {
260
+ const terms = [];
261
+ const camelCaseRegex = /\b[a-zA-Z]*[a-z][A-Z][a-zA-Z]*\b/g;
262
+ let match;
263
+ while ((match = camelCaseRegex.exec(content)) !== null) {
264
+ terms.push(match[0]);
265
+ }
266
+ const hyphenatedRegex = /\b[a-z][a-z0-9]*(?:-[a-z][a-z0-9]*)+\b/g;
267
+ while ((match = hyphenatedRegex.exec(content)) !== null) {
268
+ terms.push(match[0]);
269
+ }
270
+ return terms;
271
+ }
272
+ var terminologyRule = {
273
+ id: "consistency/terminology",
274
+ description: "Detects terminology drift (e.g., user-profile vs UserProfile vs user profile) across specs",
275
+ severity: "warn",
276
+ run(context) {
277
+ if (context.spec !== context.allSpecs[0])
278
+ return [];
279
+ const termMap = /* @__PURE__ */ new Map();
280
+ for (const spec of context.allSpecs) {
281
+ if (!spec.content)
282
+ continue;
283
+ const terms = extractCompoundTerms(spec.content);
284
+ for (const term of terms) {
285
+ const normalized = normalizeCompound(term);
286
+ if (!normalized.includes(" "))
287
+ continue;
288
+ if (!termMap.has(normalized)) {
289
+ termMap.set(normalized, /* @__PURE__ */ new Set());
290
+ }
291
+ termMap.get(normalized).add(term);
292
+ }
293
+ }
294
+ const diagnostics = [];
295
+ for (const [normalized, variants] of termMap) {
296
+ if (variants.size >= 2) {
297
+ const variantList = [...variants].join(", ");
298
+ diagnostics.push({
299
+ ruleId: "consistency/terminology",
300
+ severity: "warn",
301
+ message: `Inconsistent terminology for "${normalized}": found variants [${variantList}]. Standardize terminology across specs.`,
302
+ filePath: context.spec.filePath
303
+ });
304
+ }
305
+ }
306
+ return diagnostics;
307
+ }
308
+ };
309
+
310
+ // ../lint/dist/rules/edge-case-coverage.js
311
+ var EDGE_CASE_KEYWORDS = [
312
+ "error",
313
+ "invalid",
314
+ "empty",
315
+ "timeout",
316
+ "fails",
317
+ "failure",
318
+ "boundary",
319
+ "edge case",
320
+ "null",
321
+ "undefined",
322
+ "reject",
323
+ "unauthorized",
324
+ "forbidden",
325
+ "404",
326
+ "500",
327
+ "missing",
328
+ "malformed",
329
+ "overflow",
330
+ "duplicate",
331
+ "graceful",
332
+ "fall back",
333
+ "fallback",
334
+ "crash",
335
+ "nonexistent",
336
+ "corrupt"
337
+ ];
338
+ var edgeCaseCoverageRule = {
339
+ id: "completeness/edge-case-coverage",
340
+ description: "Flag user stories or test plans that don't mention error states or edge cases",
341
+ severity: "warn",
342
+ run(context) {
343
+ const type = context.spec.frontmatter.type;
344
+ if (type !== "user-story" && type !== "test-plan")
345
+ return [];
346
+ const content = context.spec.content.toLowerCase();
347
+ const hasEdgeCases = EDGE_CASE_KEYWORDS.some((kw) => content.includes(kw));
348
+ if (hasEdgeCases)
349
+ return [];
350
+ return [
351
+ {
352
+ ruleId: "completeness/edge-case-coverage",
353
+ severity: "warn",
354
+ message: "No error states or edge cases mentioned. Consider adding error handling, boundary conditions, or failure mode scenarios.",
355
+ filePath: context.spec.filePath
356
+ }
357
+ ];
358
+ }
359
+ };
360
+
361
+ // ../lint/dist/rules/naming-conventions.js
362
+ var namingConventionsRule = {
363
+ id: "consistency/naming-conventions",
364
+ description: "Enforce consistent naming conventions across specs",
365
+ severity: "warn",
366
+ run(context) {
367
+ const { spec } = context;
368
+ const type = spec.frontmatter.type;
369
+ const diagnostics = [];
370
+ if (type === "prd") {
371
+ const sectionParts = spec.content.split(/^(?=## )/m);
372
+ const featuresSection = sectionParts.find((p) => /^## Features\b/.test(p));
373
+ if (featuresSection) {
374
+ const bullets = featuresSection.match(/^- .+$/gm) ?? [];
375
+ for (const bullet of bullets) {
376
+ if (bullet.match(/^- \*\*F\d+\*\*:/) === null && bullet.trim().length > 2) {
377
+ diagnostics.push({
378
+ ruleId: "consistency/naming-conventions",
379
+ severity: "warn",
380
+ message: `PRD feature missing feature ID pattern (**F<N>**:): "${bullet.slice(0, 60)}"`,
381
+ filePath: spec.filePath
382
+ });
383
+ }
384
+ }
385
+ }
386
+ }
387
+ if (type === "user-story") {
388
+ const id = spec.frontmatter.id;
389
+ if (!id.startsWith("story-")) {
390
+ diagnostics.push({
391
+ ruleId: "consistency/naming-conventions",
392
+ severity: "warn",
393
+ message: `User story ID "${id}" should start with "story-" (e.g., "story-${id}")`,
394
+ filePath: spec.filePath
395
+ });
396
+ }
397
+ }
398
+ if (type === "api-contract") {
399
+ const endpointRe = /^###\s+(GET|POST|PUT|PATCH|DELETE)\s+(\S+)/gm;
400
+ let match;
401
+ while ((match = endpointRe.exec(spec.content)) !== null) {
402
+ const path = match[2];
403
+ if (/\/[a-z]+[A-Z]/.test(path)) {
404
+ diagnostics.push({
405
+ ruleId: "consistency/naming-conventions",
406
+ severity: "warn",
407
+ message: `Endpoint path "${path}" uses camelCase \u2014 use kebab-case instead (e.g., "${path.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase()}")`,
408
+ filePath: spec.filePath
409
+ });
410
+ }
411
+ }
412
+ }
413
+ return diagnostics;
414
+ }
415
+ };
416
+
417
+ // ../lint/dist/rules/threat-coverage.js
418
+ var STOPWORDS = /* @__PURE__ */ new Set(["the", "and", "for", "with", "from", "that", "this", "into", "via"]);
419
+ function extractThreats(content) {
420
+ const parts = content.split(/^(?=## )/m);
421
+ const threats = [];
422
+ for (const part of parts) {
423
+ if (!/^##\s+(Threats|Security)\b/i.test(part))
424
+ continue;
425
+ const bullets = part.match(/^- .+$/gm) ?? [];
426
+ threats.push(...bullets.map((b) => b.slice(2).trim()));
427
+ }
428
+ return threats;
429
+ }
430
+ function extractKeyTerms(text) {
431
+ return text.toLowerCase().split(/\W+/).filter((w) => w.length > 3).filter((w) => !STOPWORDS.has(w));
432
+ }
433
+ var threatCoverageRule = {
434
+ id: "security/threat-coverage",
435
+ description: "Technical design specs must address threats identified in other specs",
436
+ severity: "warn",
437
+ run(context) {
438
+ if (context.spec.frontmatter.type !== "technical-design")
439
+ return [];
440
+ const allThreats = [];
441
+ for (const spec of context.allSpecs) {
442
+ if (spec.filePath === context.spec.filePath)
443
+ continue;
444
+ allThreats.push(...extractThreats(spec.content));
445
+ }
446
+ if (allThreats.length === 0)
447
+ return [];
448
+ const techContent = context.spec.content.toLowerCase();
449
+ const diagnostics = [];
450
+ for (const threat of allThreats) {
451
+ const keyTerms = extractKeyTerms(threat);
452
+ const covered = keyTerms.some((term) => techContent.includes(term));
453
+ if (!covered) {
454
+ diagnostics.push({
455
+ ruleId: "security/threat-coverage",
456
+ severity: "warn",
457
+ message: `Threat not addressed in technical design: "${threat}". Ensure the design covers this threat.`,
458
+ filePath: context.spec.filePath
459
+ });
460
+ }
461
+ }
462
+ return diagnostics;
463
+ }
464
+ };
465
+
466
+ // ../lint/dist/rules/ambiguity-score-ai.js
467
+ var ambiguityScoreAiRule = {
468
+ id: "clarity/ambiguity-score-ai",
469
+ description: "AI-powered ambiguity detection (requires ANTHROPIC_API_KEY)",
470
+ severity: "info",
471
+ run(context) {
472
+ if (!process.env["ANTHROPIC_API_KEY"])
473
+ return [];
474
+ return [
475
+ {
476
+ ruleId: "clarity/ambiguity-score-ai",
477
+ severity: "info",
478
+ message: "AI ambiguity analysis available \u2014 run `sdx check --ai` for LLM-powered ambiguity detection",
479
+ filePath: context.spec.filePath
480
+ }
481
+ ];
482
+ }
483
+ };
484
+
485
+ // ../lint/dist/rules/index.js
486
+ var structureRules = [
487
+ validFrontmatterRule,
488
+ requiredSectionsRule,
489
+ validReferencesRule,
490
+ noCircularDepsRule,
491
+ singleProjectContextRule
492
+ ];
493
+ var contentRules = [
494
+ storyCoverageRule,
495
+ stalenessCheckRule,
496
+ noVagueLanguageRule,
497
+ terminologyRule,
498
+ edgeCaseCoverageRule,
499
+ namingConventionsRule,
500
+ threatCoverageRule,
501
+ ambiguityScoreAiRule
502
+ ];
503
+ var allBuiltinRules = [...structureRules, ...contentRules];
504
+
505
+ // ../lint/dist/presets.js
506
+ function getPreset(name) {
507
+ switch (name) {
508
+ case "minimal":
509
+ return structureRules;
510
+ case "recommended":
511
+ return allBuiltinRules;
512
+ case "strict":
513
+ return allBuiltinRules.map((rule) => ({ ...rule, severity: "error" }));
514
+ default:
515
+ throw new Error(`Unknown preset: "${name}". Use "minimal", "recommended", or "strict", or resolve external presets via resolvePreset() from @specdx/core.`);
516
+ }
517
+ }
518
+
519
+ // ../lint/dist/custom-rule-loader.js
520
+ import { pathToFileURL } from "url";
521
+
522
+ export {
523
+ createLintEngine,
524
+ getPreset
525
+ };
526
+ //# sourceMappingURL=chunk-3GMYCATE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../lint/src/engine.ts","../../lint/src/rules/valid-frontmatter.ts","../../lint/src/rules/required-sections.ts","../../lint/src/rules/valid-references.ts","../../lint/src/rules/no-circular-deps.ts","../../lint/src/rules/story-coverage.ts","../../lint/src/rules/staleness-check.ts","../../lint/src/rules/no-vague-language.ts","../../lint/src/rules/single-project-context.ts","../../lint/src/rules/terminology.ts","../../lint/src/rules/edge-case-coverage.ts","../../lint/src/rules/naming-conventions.ts","../../lint/src/rules/threat-coverage.ts","../../lint/src/rules/ambiguity-score-ai.ts","../../lint/src/rules/index.ts","../../lint/src/presets.ts","../../lint/src/custom-rule-loader.ts"],"sourcesContent":["import type { ParsedSpec, DependencyGraph } from \"@specdx/core\";\nimport type { SdxConfig } from \"@specdx/schema\";\nimport type { LintRule, LintResults, Diagnostic } from \"./types.js\";\n\nexport interface LintEngineOptions {\n rules: LintRule[];\n config?: SdxConfig;\n graph?: DependencyGraph;\n}\n\nexport interface LintEngine {\n lint(specs: ParsedSpec[]): LintResults;\n}\n\nexport function createLintEngine(options: LintEngineOptions): LintEngine {\n return {\n lint(specs: ParsedSpec[]): LintResults {\n const diagnostics: Diagnostic[] = [];\n for (const spec of specs) {\n for (const rule of options.rules) {\n const results = rule.run({\n spec,\n allSpecs: specs,\n config: options.config,\n graph: options.graph,\n });\n diagnostics.push(...results);\n }\n }\n return {\n diagnostics,\n hasErrors: diagnostics.some((d) => d.severity === \"error\"),\n hasWarnings: diagnostics.some((d) => d.severity === \"warn\"),\n };\n },\n };\n}\n","import type { LintRule } from \"../types.js\";\n\nexport const validFrontmatterRule: LintRule = {\n id: \"structure/valid-frontmatter\",\n description: \"Frontmatter matches the schema for the declared spec type\",\n severity: \"error\",\n run(context) {\n if (context.spec.valid) return [];\n const errors = context.spec.validationErrors ?? [];\n return errors.map((err) => ({\n ruleId: \"structure/valid-frontmatter\",\n severity: \"error\" as const,\n message: `Invalid frontmatter: ${err.message ?? JSON.stringify(err)}`,\n filePath: context.spec.filePath,\n }));\n },\n};\n","import type { LintRule } from \"../types.js\";\nimport { REQUIRED_SECTIONS } from \"@specdx/schema\";\nimport type { SpecType } from \"@specdx/schema\";\n\nexport const requiredSectionsRule: LintRule = {\n id: \"structure/required-sections\",\n description: \"Spec body contains all required sections for its type\",\n severity: \"error\",\n run(context) {\n // Skip YAML specs (no markdown body)\n const ext = context.spec.filePath.split(\".\").pop()?.toLowerCase();\n if (ext === \"yaml\" || ext === \"yml\") return [];\n\n const specType = context.spec.frontmatter.type as SpecType;\n const required = REQUIRED_SECTIONS[specType];\n if (!required) return [];\n\n const missing = required.filter((s) => !context.spec.sections.includes(s));\n return missing.map((section) => ({\n ruleId: \"structure/required-sections\",\n severity: \"error\" as const,\n message: `Missing required section: \"${section}\"`,\n filePath: context.spec.filePath,\n section,\n }));\n },\n};\n","import type { LintRule } from \"../types.js\";\n\nexport const validReferencesRule: LintRule = {\n id: \"structure/valid-references\",\n description: \"All references in frontmatter point to specs that exist in the suite\",\n severity: \"error\",\n run(context) {\n const refs = context.spec.frontmatter.references;\n if (!refs || refs.length === 0) return [];\n const allIds = new Set(context.allSpecs.map((s) => s.frontmatter.id));\n return refs\n .filter((ref) => !allIds.has(ref.id))\n .map((ref) => ({\n ruleId: \"structure/valid-references\",\n severity: \"error\" as const,\n message: `Reference \"${ref.id}\" does not match any spec in the suite`,\n filePath: context.spec.filePath,\n }));\n },\n};\n","import type { LintRule } from \"../types.js\";\n\nexport const noCircularDepsRule: LintRule = {\n id: \"structure/no-circular-deps\",\n description: \"The dependency graph has no cycles\",\n severity: \"error\",\n run() {\n // Cycle detection happens in buildGraph() — if graph construction succeeds, it's acyclic.\n // GraphErrors are surfaced as diagnostics by the lint command, not by this rule.\n return [];\n },\n};\n","import type { LintRule } from \"../types.js\";\n\nconst FEATURE_PATTERN = /\\*\\*F\\d+\\*\\*:\\s*(.+)/g;\n\nexport const storyCoverageRule: LintRule = {\n id: \"completeness/story-coverage\",\n description: \"Every feature listed in a PRD has at least one corresponding user story\",\n severity: \"warn\",\n run(context) {\n if (context.spec.frontmatter.type !== \"prd\") return [];\n const features: string[] = [];\n let match;\n const re = new RegExp(FEATURE_PATTERN.source, \"g\");\n while ((match = re.exec(context.spec.content)) !== null) {\n features.push(match[1]!.trim());\n }\n if (features.length === 0) return [];\n const stories = context.allSpecs.filter((s) => s.frontmatter.type === \"user-story\");\n const storyContent = stories.map((s) => s.content + \" \" + s.frontmatter.title).join(\" \");\n return features\n .filter((feature) => !storyContent.toLowerCase().includes(feature.toLowerCase()))\n .map((feature) => ({\n ruleId: \"completeness/story-coverage\",\n severity: \"warn\" as const,\n message: `Feature \"${feature}\" has no corresponding user story`,\n filePath: context.spec.filePath,\n }));\n },\n};\n","import { buildRelationResolver } from \"@specdx/core\";\nimport type { ParsedSpec } from \"@specdx/core\";\nimport type { SdxConfig } from \"@specdx/schema\";\nimport type { LintRule } from \"../types.js\";\n\n/**\n * Group specs by the config entry whose glob they came from, so config\n * `requires` edges can be mapped into spec id space. Matching is by the entry\n * path's directory prefix, which is enough for the resolver: an id that maps\n * to no entry simply contributes no `requires` edges.\n */\nfunction groupByEntry(config: SdxConfig, specs: ParsedSpec[]): Map<string, ParsedSpec[]> {\n const byEntry = new Map<string, ParsedSpec[]>();\n for (const key of Object.keys(config.specs)) byEntry.set(key, []);\n\n for (const spec of specs) {\n let bestKey: string | undefined;\n let bestLen = -1;\n for (const [key, entry] of Object.entries(config.specs)) {\n const prefix = entry.path.split(\"*\")[0] ?? \"\";\n const normalized = spec.filePath.replace(/\\\\/g, \"/\");\n if (normalized.includes(prefix) && prefix.length > bestLen) {\n bestKey = key;\n bestLen = prefix.length;\n }\n }\n if (bestKey) byEntry.get(bestKey)!.push(spec);\n }\n return byEntry;\n}\n\nfunction lastUpdated(spec: ParsedSpec): string {\n return (\n (spec.frontmatter.updated as string | undefined) ?? (spec.frontmatter.created as string) ?? \"\"\n );\n}\n\nexport const stalenessCheckRule: LintRule = {\n id: \"freshness/staleness-check\",\n description: \"Warns if a spec hasn't been updated since its upstream dependency changed\",\n severity: \"warn\",\n run(context) {\n const specId = context.spec.frontmatter.id;\n if (typeof specId !== \"string\") return [];\n\n const specUpdated = lastUpdated(context.spec);\n if (!specUpdated) return [];\n const specDate = new Date(specUpdated);\n\n // Upstream comes from config `requires` and frontmatter `references`\n // unioned, so a suite declaring dependencies either way gets the same\n // answer (ADR: references/requires unification).\n const byEntry = context.config\n ? groupByEntry(context.config, context.allSpecs)\n : new Map([[\"\", context.allSpecs]]);\n const relations = buildRelationResolver(context.config, byEntry);\n const upstreamIds = relations.getUpstream(specId);\n\n const diagnostics = [];\n for (const upstreamId of upstreamIds) {\n const upstream = context.allSpecs.find((s) => s.frontmatter.id === upstreamId);\n if (!upstream) continue;\n const upstreamUpdated = lastUpdated(upstream);\n if (!upstreamUpdated) continue;\n\n if (new Date(upstreamUpdated) > specDate) {\n diagnostics.push({\n ruleId: \"freshness/staleness-check\",\n severity: \"warn\" as const,\n message: `Potentially stale: upstream \"${upstreamId}\" was updated on ${upstreamUpdated}, but this spec was last updated on ${specUpdated}`,\n filePath: context.spec.filePath,\n });\n }\n }\n return diagnostics;\n },\n};\n","import type { LintRule } from \"../types.js\";\n\nconst DEFAULT_VAGUE_PATTERNS = [\n \"as appropriate\",\n \"handle edge cases\",\n \"as needed\",\n \"etc\\\\.\",\n \"TBD\",\n \"TODO\",\n \"and so on\",\n \"various\",\n \"somehow\",\n \"straightforward\",\n \"obviously\",\n \"simply\",\n \"just need to\",\n];\n\nexport const noVagueLanguageRule: LintRule = {\n id: \"clarity/no-vague-language\",\n description: \"Flags known ambiguous phrases\",\n severity: \"warn\",\n run(context) {\n if (!context.spec.content) return [];\n const diagnostics = [];\n for (const pattern of DEFAULT_VAGUE_PATTERNS) {\n const regex = new RegExp(`\\\\b${pattern}`, \"gi\");\n let match;\n while ((match = regex.exec(context.spec.content)) !== null) {\n diagnostics.push({\n ruleId: \"clarity/no-vague-language\",\n severity: \"warn\" as const,\n message: `Vague language: \"${match[0]}\"`,\n filePath: context.spec.filePath,\n });\n }\n }\n return diagnostics;\n },\n};\n","import type { LintRule } from \"../types.js\";\n\nexport const singleProjectContextRule: LintRule = {\n id: \"structure/single-project-context\",\n description: \"Only one project-context spec should exist per suite\",\n severity: \"warn\",\n run(context) {\n if (context.spec.frontmatter.type !== \"project-context\") return [];\n\n const contextSpecs = context.allSpecs.filter((s) => s.frontmatter.type === \"project-context\");\n\n if (contextSpecs.length > 1) {\n return [\n {\n ruleId: \"structure/single-project-context\",\n severity: \"warn\" as const,\n message: `Multiple project-context specs found (${contextSpecs.length}). Only one should exist per suite.`,\n filePath: context.spec.filePath,\n },\n ];\n }\n\n return [];\n },\n};\n","import type { LintRule } from \"../types.js\";\n\nfunction normalizeCompound(term: string): string {\n // Split camelCase: \"UserProfile\" → \"user profile\"\n // Split hyphens/underscores: \"user-profile\" → \"user profile\"\n return term\n .replace(/([a-z])([A-Z])/g, \"$1 $2\")\n .replace(/[-_]/g, \" \")\n .toLowerCase()\n .trim();\n}\n\nfunction extractCompoundTerms(content: string): string[] {\n const terms: string[] = [];\n\n // Extract camelCase words (e.g., UserProfile, userProfile)\n const camelCaseRegex = /\\b[a-zA-Z]*[a-z][A-Z][a-zA-Z]*\\b/g;\n let match;\n while ((match = camelCaseRegex.exec(content)) !== null) {\n terms.push(match[0]);\n }\n\n // Extract hyphenated words (e.g., user-profile, my-component)\n const hyphenatedRegex = /\\b[a-z][a-z0-9]*(?:-[a-z][a-z0-9]*)+\\b/g;\n while ((match = hyphenatedRegex.exec(content)) !== null) {\n terms.push(match[0]);\n }\n\n return terms;\n}\n\nexport const terminologyRule: LintRule = {\n id: \"consistency/terminology\",\n description:\n \"Detects terminology drift (e.g., user-profile vs UserProfile vs user profile) across specs\",\n severity: \"warn\",\n run(context) {\n // Only run on the first spec to avoid duplicate diagnostics\n if (context.spec !== context.allSpecs[0]) return [];\n\n // Build a map: normalized form → Set of original forms found across all specs\n const termMap = new Map<string, Set<string>>();\n\n for (const spec of context.allSpecs) {\n if (!spec.content) continue;\n const terms = extractCompoundTerms(spec.content);\n for (const term of terms) {\n const normalized = normalizeCompound(term);\n // Only track multi-word normalized forms (skip single words)\n if (!normalized.includes(\" \")) continue;\n if (!termMap.has(normalized)) {\n termMap.set(normalized, new Set());\n }\n termMap.get(normalized)!.add(term);\n }\n }\n\n const diagnostics = [];\n\n for (const [normalized, variants] of termMap) {\n if (variants.size >= 2) {\n const variantList = [...variants].join(\", \");\n diagnostics.push({\n ruleId: \"consistency/terminology\",\n severity: \"warn\" as const,\n message: `Inconsistent terminology for \"${normalized}\": found variants [${variantList}]. Standardize terminology across specs.`,\n filePath: context.spec.filePath,\n });\n }\n }\n\n return diagnostics;\n },\n};\n","import type { LintRule } from \"../types.js\";\n\nconst EDGE_CASE_KEYWORDS = [\n \"error\",\n \"invalid\",\n \"empty\",\n \"timeout\",\n \"fails\",\n \"failure\",\n \"boundary\",\n \"edge case\",\n \"null\",\n \"undefined\",\n \"reject\",\n \"unauthorized\",\n \"forbidden\",\n \"404\",\n \"500\",\n \"missing\",\n \"malformed\",\n \"overflow\",\n \"duplicate\",\n \"graceful\",\n \"fall back\",\n \"fallback\",\n \"crash\",\n \"nonexistent\",\n \"corrupt\",\n];\n\nexport const edgeCaseCoverageRule: LintRule = {\n id: \"completeness/edge-case-coverage\",\n description: \"Flag user stories or test plans that don't mention error states or edge cases\",\n severity: \"warn\",\n run(context) {\n const type = context.spec.frontmatter.type as string;\n if (type !== \"user-story\" && type !== \"test-plan\") return [];\n\n const content = context.spec.content.toLowerCase();\n const hasEdgeCases = EDGE_CASE_KEYWORDS.some((kw) => content.includes(kw));\n\n if (hasEdgeCases) return [];\n\n return [\n {\n ruleId: \"completeness/edge-case-coverage\",\n severity: \"warn\" as const,\n message:\n \"No error states or edge cases mentioned. Consider adding error handling, boundary conditions, or failure mode scenarios.\",\n filePath: context.spec.filePath,\n },\n ];\n },\n};\n","import type { LintRule } from \"../types.js\";\n\nexport const namingConventionsRule: LintRule = {\n id: \"consistency/naming-conventions\",\n description: \"Enforce consistent naming conventions across specs\",\n severity: \"warn\",\n run(context) {\n const { spec } = context;\n const type = spec.frontmatter.type as string;\n const diagnostics = [];\n\n if (type === \"prd\") {\n // Split content into sections and find the Features section\n const sectionParts = spec.content.split(/^(?=## )/m);\n const featuresSection = sectionParts.find((p) => /^## Features\\b/.test(p));\n if (featuresSection) {\n const bullets = featuresSection.match(/^- .+$/gm) ?? [];\n for (const bullet of bullets) {\n if (bullet.match(/^- \\*\\*F\\d+\\*\\*:/) === null && bullet.trim().length > 2) {\n diagnostics.push({\n ruleId: \"consistency/naming-conventions\",\n severity: \"warn\" as const,\n message: `PRD feature missing feature ID pattern (**F<N>**:): \"${bullet.slice(0, 60)}\"`,\n filePath: spec.filePath,\n });\n }\n }\n }\n }\n\n if (type === \"user-story\") {\n const id = spec.frontmatter.id as string;\n if (!id.startsWith(\"story-\")) {\n diagnostics.push({\n ruleId: \"consistency/naming-conventions\",\n severity: \"warn\" as const,\n message: `User story ID \"${id}\" should start with \"story-\" (e.g., \"story-${id}\")`,\n filePath: spec.filePath,\n });\n }\n }\n\n if (type === \"api-contract\") {\n // Check endpoints for camelCase path segments\n const endpointRe = /^###\\s+(GET|POST|PUT|PATCH|DELETE)\\s+(\\S+)/gm;\n let match;\n while ((match = endpointRe.exec(spec.content)) !== null) {\n const path = match[2]!;\n if (/\\/[a-z]+[A-Z]/.test(path)) {\n diagnostics.push({\n ruleId: \"consistency/naming-conventions\",\n severity: \"warn\" as const,\n message: `Endpoint path \"${path}\" uses camelCase — use kebab-case instead (e.g., \"${path.replace(/([a-z])([A-Z])/g, \"$1-$2\").toLowerCase()}\")`,\n filePath: spec.filePath,\n });\n }\n }\n }\n\n return diagnostics;\n },\n};\n","import type { LintRule } from \"../types.js\";\n\nconst STOPWORDS = new Set([\"the\", \"and\", \"for\", \"with\", \"from\", \"that\", \"this\", \"into\", \"via\"]);\n\nfunction extractThreats(content: string): string[] {\n // Split into sections at each ## heading, then filter for Threats/Security\n const parts = content.split(/^(?=## )/m);\n const threats: string[] = [];\n for (const part of parts) {\n if (!/^##\\s+(Threats|Security)\\b/i.test(part)) continue;\n const bullets = part.match(/^- .+$/gm) ?? [];\n threats.push(...bullets.map((b) => b.slice(2).trim()));\n }\n return threats;\n}\n\nfunction extractKeyTerms(text: string): string[] {\n return text\n .toLowerCase()\n .split(/\\W+/)\n .filter((w) => w.length > 3)\n .filter((w) => !STOPWORDS.has(w));\n}\n\nexport const threatCoverageRule: LintRule = {\n id: \"security/threat-coverage\",\n description: \"Technical design specs must address threats identified in other specs\",\n severity: \"warn\",\n run(context) {\n if (context.spec.frontmatter.type !== \"technical-design\") return [];\n\n const allThreats: string[] = [];\n for (const spec of context.allSpecs) {\n if (spec.filePath === context.spec.filePath) continue;\n allThreats.push(...extractThreats(spec.content));\n }\n\n if (allThreats.length === 0) return [];\n\n const techContent = context.spec.content.toLowerCase();\n const diagnostics = [];\n\n for (const threat of allThreats) {\n const keyTerms = extractKeyTerms(threat);\n const covered = keyTerms.some((term) => techContent.includes(term));\n if (!covered) {\n diagnostics.push({\n ruleId: \"security/threat-coverage\",\n severity: \"warn\" as const,\n message: `Threat not addressed in technical design: \"${threat}\". Ensure the design covers this threat.`,\n filePath: context.spec.filePath,\n });\n }\n }\n\n return diagnostics;\n },\n};\n","import type { LintRule } from \"../types.js\";\n\nexport const ambiguityScoreAiRule: LintRule = {\n id: \"clarity/ambiguity-score-ai\",\n description: \"AI-powered ambiguity detection (requires ANTHROPIC_API_KEY)\",\n severity: \"info\",\n run(context) {\n if (!process.env[\"ANTHROPIC_API_KEY\"]) return [];\n\n return [\n {\n ruleId: \"clarity/ambiguity-score-ai\",\n severity: \"info\" as const,\n message:\n \"AI ambiguity analysis available — run `sdx check --ai` for LLM-powered ambiguity detection\",\n filePath: context.spec.filePath,\n },\n ];\n },\n};\n","import { validFrontmatterRule } from \"./valid-frontmatter.js\";\nimport { requiredSectionsRule } from \"./required-sections.js\";\nimport { validReferencesRule } from \"./valid-references.js\";\nimport { noCircularDepsRule } from \"./no-circular-deps.js\";\nimport { storyCoverageRule } from \"./story-coverage.js\";\nimport { stalenessCheckRule } from \"./staleness-check.js\";\nimport { noVagueLanguageRule } from \"./no-vague-language.js\";\nimport { singleProjectContextRule } from \"./single-project-context.js\";\nimport { terminologyRule } from \"./terminology.js\";\nimport { edgeCaseCoverageRule } from \"./edge-case-coverage.js\";\nimport { namingConventionsRule } from \"./naming-conventions.js\";\nimport { threatCoverageRule } from \"./threat-coverage.js\";\nimport { ambiguityScoreAiRule } from \"./ambiguity-score-ai.js\";\nimport type { LintRule } from \"../types.js\";\n\nexport const structureRules: LintRule[] = [\n validFrontmatterRule,\n requiredSectionsRule,\n validReferencesRule,\n noCircularDepsRule,\n singleProjectContextRule,\n];\n\nexport const contentRules: LintRule[] = [\n storyCoverageRule,\n stalenessCheckRule,\n noVagueLanguageRule,\n terminologyRule,\n edgeCaseCoverageRule,\n namingConventionsRule,\n threatCoverageRule,\n ambiguityScoreAiRule,\n];\n\nexport const allBuiltinRules: LintRule[] = [...structureRules, ...contentRules];\n\nexport {\n validFrontmatterRule,\n requiredSectionsRule,\n validReferencesRule,\n noCircularDepsRule,\n storyCoverageRule,\n stalenessCheckRule,\n noVagueLanguageRule,\n singleProjectContextRule,\n terminologyRule,\n edgeCaseCoverageRule,\n namingConventionsRule,\n threatCoverageRule,\n ambiguityScoreAiRule,\n};\n","import type { LintRule } from \"./types.js\";\nimport { structureRules, allBuiltinRules } from \"./rules/index.js\";\n\nexport function getPreset(name: string): LintRule[] {\n switch (name) {\n case \"minimal\":\n return structureRules;\n case \"recommended\":\n return allBuiltinRules;\n case \"strict\":\n return allBuiltinRules.map((rule) => ({ ...rule, severity: \"error\" as const }));\n default:\n throw new Error(\n `Unknown preset: \"${name}\". Use \"minimal\", \"recommended\", or \"strict\", or resolve external presets via resolvePreset() from @specdx/core.`,\n );\n }\n}\n","import { pathToFileURL } from \"node:url\";\nimport type { LintRule } from \"./types.js\";\n\nexport async function loadCustomRule(filePath: string): Promise<LintRule> {\n const module = await import(pathToFileURL(filePath).href);\n const rule = module.default ?? module.rule;\n if (!rule || !rule.id || !rule.run) {\n throw new Error(\n `Custom rule at ${filePath} must export a default LintRule with id and run function`,\n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