lean-spec 0.2.8 → 0.2.9-dev.20251205030455

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,4 +1,4 @@
1
- import { loadConfig, loadAllSpecs, loadSubFiles } from './chunk-LXOJW2FE.js';
1
+ import { loadConfig, loadAllSpecs, loadSubFiles } from './chunk-RF5PKL6L.js';
2
2
  import * as fs from 'fs/promises';
3
3
  import * as path from 'path';
4
4
  import chalk3 from 'chalk';
@@ -1303,8 +1303,7 @@ var SpecDependencyGraph = class {
1303
1303
  this.specs.set(spec.path, spec);
1304
1304
  this.graph.set(spec.path, {
1305
1305
  dependsOn: new Set(spec.frontmatter.depends_on || []),
1306
- requiredBy: /* @__PURE__ */ new Set(),
1307
- related: new Set(spec.frontmatter.related || [])
1306
+ requiredBy: /* @__PURE__ */ new Set()
1308
1307
  });
1309
1308
  }
1310
1309
  for (const [specPath, node] of this.graph.entries()) {
@@ -1314,12 +1313,6 @@ var SpecDependencyGraph = class {
1314
1313
  depNode.requiredBy.add(specPath);
1315
1314
  }
1316
1315
  }
1317
- for (const rel of node.related) {
1318
- const relNode = this.graph.get(rel);
1319
- if (relNode) {
1320
- relNode.related.add(specPath);
1321
- }
1322
- }
1323
1316
  }
1324
1317
  }
1325
1318
  /**
@@ -1337,8 +1330,7 @@ var SpecDependencyGraph = class {
1337
1330
  return {
1338
1331
  current: spec,
1339
1332
  dependsOn: this.getSpecsByPaths(Array.from(node.dependsOn)),
1340
- requiredBy: this.getSpecsByPaths(Array.from(node.requiredBy)),
1341
- related: this.getSpecsByPaths(Array.from(node.related))
1333
+ requiredBy: this.getSpecsByPaths(Array.from(node.requiredBy))
1342
1334
  };
1343
1335
  }
1344
1336
  /**
@@ -1401,22 +1393,17 @@ var SpecDependencyGraph = class {
1401
1393
  }
1402
1394
  /**
1403
1395
  * Get impact radius - all specs affected by changes to this spec
1404
- * Includes upstream dependencies, downstream dependents, and related specs
1396
+ * Includes upstream dependencies and downstream dependents
1405
1397
  */
1406
1398
  getImpactRadius(specPath, maxDepth = 3) {
1407
1399
  const spec = this.specs.get(specPath);
1408
1400
  if (!spec) {
1409
1401
  throw new Error(`Spec not found: ${specPath}`);
1410
1402
  }
1411
- const node = this.graph.get(specPath);
1412
- if (!node) {
1413
- throw new Error(`Graph node not found: ${specPath}`);
1414
- }
1415
1403
  return {
1416
1404
  current: spec,
1417
1405
  upstream: this.getUpstream(specPath, maxDepth),
1418
- downstream: this.getDownstream(specPath, maxDepth),
1419
- related: this.getSpecsByPaths(Array.from(node.related))
1406
+ downstream: this.getDownstream(specPath, maxDepth)
1420
1407
  };
1421
1408
  }
1422
1409
  /**
@@ -2538,26 +2525,14 @@ var SubSpecValidator = class {
2538
2525
  }
2539
2526
  }
2540
2527
  };
2541
- var SPEC_REF_PATTERNS = [
2542
- // "spec 045", "Spec 045", "spec-045"
2543
- /\bspec[- ]?(\d{3})\b/gi,
2544
- // "045-unified-dashboard" (full spec folder name)
2545
- /\b(\d{3})-[a-z][a-z0-9-]+\b/gi
2546
- ];
2547
2528
  var DEPENDS_ON_PATTERNS = [
2548
2529
  /depends on[:\s]+.*?\b(\d{3})\b/gi,
2549
2530
  /blocked by[:\s]+.*?\b(\d{3})\b/gi,
2550
2531
  /requires[:\s]+.*?spec[:\s]*(\d{3})\b/gi,
2551
2532
  /prerequisite[:\s]+.*?\b(\d{3})\b/gi,
2552
- /after[:\s]+.*?spec[:\s]*(\d{3})\b/gi
2553
- ];
2554
- var RELATED_PATTERNS = [
2555
- /related to[:\s]+.*?\b(\d{3})\b/gi,
2556
- /see (also )?spec[:\s]*(\d{3})\b/gi,
2533
+ /after[:\s]+.*?spec[:\s]*(\d{3})\b/gi,
2557
2534
  /builds on[:\s]+.*?\b(\d{3})\b/gi,
2558
- /similar to[:\s]+.*?\b(\d{3})\b/gi,
2559
- /complements[:\s]+.*?\b(\d{3})\b/gi,
2560
- /\brelated[:\s]+\[?(\d{3})/gi
2535
+ /extends[:\s]+.*?\b(\d{3})\b/gi
2561
2536
  ];
2562
2537
  var DependencyAlignmentValidator = class {
2563
2538
  name = "dependency-alignment";
@@ -2590,38 +2565,19 @@ var DependencyAlignmentValidator = class {
2590
2565
  const frontmatter = parsed.data;
2591
2566
  const bodyContent = parsed.content;
2592
2567
  const currentDependsOn = this.normalizeDeps(frontmatter.depends_on);
2593
- const currentRelated = this.normalizeDeps(frontmatter.related);
2594
- const allCurrentDeps = /* @__PURE__ */ new Set([...currentDependsOn, ...currentRelated]);
2595
2568
  const selfNumber = this.extractSpecNumber(spec.name);
2596
2569
  const detectedRefs = this.detectReferences(bodyContent, selfNumber);
2597
2570
  const missingDependsOn = [];
2598
- const missingRelated = [];
2599
2571
  for (const ref of detectedRefs) {
2600
- if (allCurrentDeps.has(ref.specNumber)) continue;
2572
+ if (currentDependsOn.includes(ref.specNumber)) continue;
2601
2573
  if (this.existingSpecNumbers && !this.existingSpecNumbers.has(ref.specNumber)) continue;
2602
- if (ref.type === "depends_on") {
2603
- missingDependsOn.push(ref);
2604
- } else {
2605
- missingRelated.push(ref);
2606
- }
2574
+ missingDependsOn.push(ref);
2607
2575
  }
2608
2576
  if (missingDependsOn.length > 0) {
2609
2577
  const specNumbers = [...new Set(missingDependsOn.map((r) => r.specNumber))];
2610
2578
  const issue = {
2611
- message: `Content references blocking dependencies not in frontmatter: ${specNumbers.join(", ")}`,
2612
- suggestion: `Run: lean-spec link ${spec.name} --depends-on ${specNumbers.join(" ")}`
2613
- };
2614
- if (this.strict) {
2615
- errors.push(issue);
2616
- } else {
2617
- warnings.push(issue);
2618
- }
2619
- }
2620
- if (missingRelated.length > 0) {
2621
- const specNumbers = [...new Set(missingRelated.map((r) => r.specNumber))];
2622
- const issue = {
2623
- message: `Content references related specs not in frontmatter: ${specNumbers.join(", ")}`,
2624
- suggestion: `Run: lean-spec link ${spec.name} --related ${specNumbers.join(" ")}`
2579
+ message: `Content references dependencies not in frontmatter: ${specNumbers.join(", ")}`,
2580
+ suggestion: `Run: lean-spec link ${spec.name} --depends-on ${specNumbers.join(",")}`
2625
2581
  };
2626
2582
  if (this.strict) {
2627
2583
  errors.push(issue);
@@ -2655,7 +2611,7 @@ var DependencyAlignmentValidator = class {
2655
2611
  return match ? match[1] : null;
2656
2612
  }
2657
2613
  /**
2658
- * Detect spec references in content
2614
+ * Detect spec references in content that indicate dependencies
2659
2615
  */
2660
2616
  detectReferences(content, selfNumber) {
2661
2617
  const refs = [];
@@ -2674,35 +2630,6 @@ var DependencyAlignmentValidator = class {
2674
2630
  }
2675
2631
  }
2676
2632
  }
2677
- for (const pattern of RELATED_PATTERNS) {
2678
- const matches = content.matchAll(new RegExp(pattern));
2679
- for (const match of matches) {
2680
- const specNumber = match[2] || match[1];
2681
- if (specNumber && specNumber !== selfNumber && !seenNumbers.has(specNumber)) {
2682
- seenNumbers.add(specNumber);
2683
- refs.push({
2684
- specNumber,
2685
- type: "related",
2686
- context: match[0].substring(0, 50)
2687
- });
2688
- }
2689
- }
2690
- }
2691
- for (const pattern of SPEC_REF_PATTERNS) {
2692
- const matches = content.matchAll(new RegExp(pattern));
2693
- for (const match of matches) {
2694
- const specNumber = match[1];
2695
- if (specNumber && specNumber !== selfNumber && !seenNumbers.has(specNumber)) {
2696
- seenNumbers.add(specNumber);
2697
- refs.push({
2698
- specNumber,
2699
- type: "related",
2700
- // Default to related for ambiguous refs
2701
- context: match[0].substring(0, 50)
2702
- });
2703
- }
2704
- }
2705
- }
2706
2633
  return refs;
2707
2634
  }
2708
2635
  };
@@ -3059,5 +2986,5 @@ async function validateSpecs(options = {}) {
3059
2986
  }
3060
2987
 
3061
2988
  export { PRIORITY_CONFIG, STATUS_CONFIG, SpecDependencyGraph, TokenCounter, advancedSearchSpecs, analyzeMarkdownStructure, countLines, countTokens, createUpdatedFrontmatter, extractLines, getPriorityEmoji, getSearchSyntaxHelp, getStatusEmoji, getStatusIndicator, parseFrontmatterFromString, removeLines, sanitizeUserInput, validateCommand, validateSpecs, withSpinner };
3062
- //# sourceMappingURL=chunk-FUIUCGUV.js.map
3063
- //# sourceMappingURL=chunk-FUIUCGUV.js.map
2989
+ //# sourceMappingURL=chunk-CJMVV46H.js.map
2990
+ //# sourceMappingURL=chunk-CJMVV46H.js.map