@vibgrate/cli 2026.814.2 → 2026.817.1

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 (134) hide show
  1. package/dist/agent-CUYQKC6S.js +26 -0
  2. package/dist/{agent-5ANHRYEI.js.map → agent-CUYQKC6S.js.map} +1 -1
  3. package/dist/{approvals-T2KXPJLV.js → approvals-IPMUDEDV.js} +5 -5
  4. package/dist/{approvals-T2KXPJLV.js.map → approvals-IPMUDEDV.js.map} +1 -1
  5. package/dist/baseline-NZFGLMER.js +9 -0
  6. package/dist/{baseline-WVD6P5IO.js.map → baseline-NZFGLMER.js.map} +1 -1
  7. package/dist/{chunk-TFAXW7VM.js → chunk-2BURPMYA.js} +3 -3
  8. package/dist/{chunk-TFAXW7VM.js.map → chunk-2BURPMYA.js.map} +1 -1
  9. package/dist/{chunk-X76VPOYH.js → chunk-2GSMCOIC.js} +4 -4
  10. package/dist/{chunk-X76VPOYH.js.map → chunk-2GSMCOIC.js.map} +1 -1
  11. package/dist/{chunk-KGPX4EUN.js → chunk-2TJ5EY4I.js} +4 -4
  12. package/dist/{chunk-KGPX4EUN.js.map → chunk-2TJ5EY4I.js.map} +1 -1
  13. package/dist/{chunk-BH54SLGZ.js → chunk-3GZSDY35.js} +4 -4
  14. package/dist/{chunk-BH54SLGZ.js.map → chunk-3GZSDY35.js.map} +1 -1
  15. package/dist/{chunk-REIGWTTH.js → chunk-3HNPVXUK.js} +3 -3
  16. package/dist/{chunk-REIGWTTH.js.map → chunk-3HNPVXUK.js.map} +1 -1
  17. package/dist/{chunk-7NMXE6KG.js → chunk-45AKSS4A.js} +4 -4
  18. package/dist/{chunk-7NMXE6KG.js.map → chunk-45AKSS4A.js.map} +1 -1
  19. package/dist/{chunk-FOW5IF73.js → chunk-4W5SYK2M.js} +11 -34
  20. package/dist/chunk-4W5SYK2M.js.map +1 -0
  21. package/dist/{chunk-UTNNGKKX.js → chunk-6NOGNOE4.js} +4 -4
  22. package/dist/chunk-6NOGNOE4.js.map +1 -0
  23. package/dist/{chunk-N3XFY3PX.js → chunk-74UBGF4P.js} +3 -3
  24. package/dist/{chunk-N3XFY3PX.js.map → chunk-74UBGF4P.js.map} +1 -1
  25. package/dist/{chunk-YNV5M3JW.js → chunk-A7EKFLAN.js} +8 -8
  26. package/dist/{chunk-YNV5M3JW.js.map → chunk-A7EKFLAN.js.map} +1 -1
  27. package/dist/{chunk-N6ZMZ5AI.js → chunk-ANYL7SUI.js} +349 -46
  28. package/dist/chunk-ANYL7SUI.js.map +1 -0
  29. package/dist/{chunk-75LJM5XD.js → chunk-ENFSSUNK.js} +7 -3
  30. package/dist/chunk-ENFSSUNK.js.map +1 -0
  31. package/dist/{chunk-3LSG7Z4I.js → chunk-EZ7UC5Y5.js} +25 -4
  32. package/dist/chunk-EZ7UC5Y5.js.map +1 -0
  33. package/dist/{chunk-WWGLVF7D.js → chunk-FD2HPGX2.js} +8 -8
  34. package/dist/{chunk-WWGLVF7D.js.map → chunk-FD2HPGX2.js.map} +1 -1
  35. package/dist/{chunk-OWSFZQOP.js → chunk-FJG5AXKZ.js} +3 -3
  36. package/dist/{chunk-OWSFZQOP.js.map → chunk-FJG5AXKZ.js.map} +1 -1
  37. package/dist/chunk-FMS6G67U.js +467 -0
  38. package/dist/chunk-FMS6G67U.js.map +1 -0
  39. package/dist/{chunk-WHJMS7XC.js → chunk-I5LP55B6.js} +3 -3
  40. package/dist/{chunk-WHJMS7XC.js.map → chunk-I5LP55B6.js.map} +1 -1
  41. package/dist/{chunk-JCN6MSXQ.js → chunk-JHLCKMKF.js} +16 -29
  42. package/dist/chunk-JHLCKMKF.js.map +1 -0
  43. package/dist/{chunk-IHLLWBZU.js → chunk-K267DHCF.js} +6 -6
  44. package/dist/{chunk-IHLLWBZU.js.map → chunk-K267DHCF.js.map} +1 -1
  45. package/dist/{chunk-WQLZSVNF.js → chunk-MIYXVY57.js} +7 -6
  46. package/dist/chunk-MIYXVY57.js.map +1 -0
  47. package/dist/chunk-MS6V5XKB.js +33 -0
  48. package/dist/chunk-MS6V5XKB.js.map +1 -0
  49. package/dist/{chunk-5GLQNMTI.js → chunk-NHB53JTV.js} +6 -6
  50. package/dist/{chunk-5GLQNMTI.js.map → chunk-NHB53JTV.js.map} +1 -1
  51. package/dist/{chunk-DSUGC7F5.js → chunk-NKRWKCME.js} +4 -4
  52. package/dist/{chunk-DSUGC7F5.js.map → chunk-NKRWKCME.js.map} +1 -1
  53. package/dist/{chunk-7QDHQLUS.js → chunk-NQUWC2IA.js} +13 -11
  54. package/dist/chunk-NQUWC2IA.js.map +1 -0
  55. package/dist/{chunk-NKFXXP6W.js → chunk-OWSXI3PJ.js} +8 -6
  56. package/dist/chunk-OWSXI3PJ.js.map +1 -0
  57. package/dist/chunk-OZ3IFXRD.js +22 -0
  58. package/dist/chunk-OZ3IFXRD.js.map +1 -0
  59. package/dist/chunk-PV76EO4G.js +6 -0
  60. package/dist/{chunk-2H2U3DC7.js.map → chunk-PV76EO4G.js.map} +1 -1
  61. package/dist/{chunk-2U37PFB2.js → chunk-QPXVTQ7O.js} +3 -3
  62. package/dist/{chunk-2U37PFB2.js.map → chunk-QPXVTQ7O.js.map} +1 -1
  63. package/dist/{chunk-TNROG5CO.js → chunk-RJCRWQNS.js} +1855 -175
  64. package/dist/chunk-RJCRWQNS.js.map +1 -0
  65. package/dist/{chunk-54RGT2T5.js → chunk-RQAKBRAV.js} +3 -3
  66. package/dist/{chunk-54RGT2T5.js.map → chunk-RQAKBRAV.js.map} +1 -1
  67. package/dist/{chunk-YQNTIBKS.js → chunk-UBEVY5UT.js} +6 -6
  68. package/dist/{chunk-YQNTIBKS.js.map → chunk-UBEVY5UT.js.map} +1 -1
  69. package/dist/{chunk-IHXNOY3R.js → chunk-YL4OIUA5.js} +12 -12
  70. package/dist/{chunk-IHXNOY3R.js.map → chunk-YL4OIUA5.js.map} +1 -1
  71. package/dist/{chunk-TVDYEHIM.js → chunk-ZSECAGSU.js} +3 -3
  72. package/dist/{chunk-TVDYEHIM.js.map → chunk-ZSECAGSU.js.map} +1 -1
  73. package/dist/cli.js +416 -717
  74. package/dist/cli.js.map +1 -1
  75. package/dist/daemon-J2HX4GY3.js +25 -0
  76. package/dist/daemon-J2HX4GY3.js.map +1 -0
  77. package/dist/embed-worker-main.js +4 -4
  78. package/dist/ensure-map-5C6KG66X.js +32 -0
  79. package/dist/{ensure-map-HQ7A5NDL.js.map → ensure-map-5C6KG66X.js.map} +1 -1
  80. package/dist/graph-backend-HH5IIQ55.js +14 -0
  81. package/dist/{graph-backend-W2TNTMY7.js.map → graph-backend-HH5IIQ55.js.map} +1 -1
  82. package/dist/index.d.ts +9 -6
  83. package/dist/index.js +18 -16
  84. package/dist/index.js.map +1 -1
  85. package/dist/{interactive-EW2VJ3BZ.js → interactive-FXPAZAUJ.js} +33 -31
  86. package/dist/interactive-FXPAZAUJ.js.map +1 -0
  87. package/dist/load-OR2XVGAV.js +10 -0
  88. package/dist/{load-64RK5O6C.js.map → load-OR2XVGAV.js.map} +1 -1
  89. package/dist/local-runtime-6SNWKSA7.js +6 -0
  90. package/dist/{local-runtime-2ED33KK6.js.map → local-runtime-6SNWKSA7.js.map} +1 -1
  91. package/dist/model-manager-SXHZ5VD4.js +10 -0
  92. package/dist/{model-manager-GJ2YSTSK.js.map → model-manager-SXHZ5VD4.js.map} +1 -1
  93. package/dist/parse-worker.d.ts +1 -1
  94. package/dist/parse-worker.js +1 -1
  95. package/dist/{run-outcome-6QNQIHPV.js → run-outcome-M4546HLJ.js} +6 -6
  96. package/dist/{run-outcome-6QNQIHPV.js.map → run-outcome-M4546HLJ.js.map} +1 -1
  97. package/dist/runtime-session-6KKMFS6Q.js +21 -0
  98. package/dist/{runtime-session-RJHH3KMF.js.map → runtime-session-6KKMFS6Q.js.map} +1 -1
  99. package/dist/session-HCFJUSKN.js +16 -0
  100. package/dist/{session-4BGYASOH.js.map → session-HCFJUSKN.js.map} +1 -1
  101. package/dist/{stream-json-GY5N7WZT.js → stream-json-4DL65D6U.js} +16 -16
  102. package/dist/{stream-json-GY5N7WZT.js.map → stream-json-4DL65D6U.js.map} +1 -1
  103. package/dist/{types-DLH-Ritr.d.ts → types-8SYlXhzm.d.ts} +57 -6
  104. package/dist/version-UPIC3F4P.js +4 -0
  105. package/dist/{version-DPAMQW6M.js.map → version-UPIC3F4P.js.map} +1 -1
  106. package/dist/{vg-mcp-bridge-IGHJKKSL.js → vg-mcp-bridge-FZGX6DYO.js} +10 -10
  107. package/dist/{vg-mcp-bridge-IGHJKKSL.js.map → vg-mcp-bridge-FZGX6DYO.js.map} +1 -1
  108. package/dist/{vgd-ORPA5C2K.js → vgd-QR26FAZD.js} +9 -9
  109. package/dist/vgd-QR26FAZD.js.map +1 -0
  110. package/grammars/tree-sitter-hcl.wasm +0 -0
  111. package/package.json +3 -2
  112. package/dist/agent-5ANHRYEI.js +0 -26
  113. package/dist/baseline-WVD6P5IO.js +0 -9
  114. package/dist/chunk-2H2U3DC7.js +0 -6
  115. package/dist/chunk-3LSG7Z4I.js.map +0 -1
  116. package/dist/chunk-75LJM5XD.js.map +0 -1
  117. package/dist/chunk-7QDHQLUS.js.map +0 -1
  118. package/dist/chunk-FOW5IF73.js.map +0 -1
  119. package/dist/chunk-JCN6MSXQ.js.map +0 -1
  120. package/dist/chunk-N6ZMZ5AI.js.map +0 -1
  121. package/dist/chunk-NKFXXP6W.js.map +0 -1
  122. package/dist/chunk-TNROG5CO.js.map +0 -1
  123. package/dist/chunk-UTNNGKKX.js.map +0 -1
  124. package/dist/chunk-WQLZSVNF.js.map +0 -1
  125. package/dist/ensure-map-HQ7A5NDL.js +0 -30
  126. package/dist/graph-backend-W2TNTMY7.js +0 -14
  127. package/dist/interactive-EW2VJ3BZ.js.map +0 -1
  128. package/dist/load-64RK5O6C.js +0 -10
  129. package/dist/local-runtime-2ED33KK6.js +0 -6
  130. package/dist/model-manager-GJ2YSTSK.js +0 -10
  131. package/dist/runtime-session-RJHH3KMF.js +0 -21
  132. package/dist/session-4BGYASOH.js +0 -16
  133. package/dist/version-DPAMQW6M.js +0 -4
  134. package/dist/vgd-ORPA5C2K.js.map +0 -1
@@ -5447,59 +5447,362 @@ async function fetchTerraformVersionsBulk(items, manifest, offline = false) {
5447
5447
  await Promise.all(promises);
5448
5448
  return results;
5449
5449
  }
5450
+
5451
+ // src/core-open/scanners/hcl-blocks.ts
5452
+ function parseHclBlocks(source) {
5453
+ const blocks = [];
5454
+ let i = 0;
5455
+ const n = source.length;
5456
+ while (i < n) {
5457
+ const headerStart = skipTrivia(source, i);
5458
+ if (headerStart >= n) break;
5459
+ const header = readBlockHeader(source, headerStart);
5460
+ if (!header) {
5461
+ const nextLine = source.indexOf("\n", headerStart);
5462
+ if (nextLine === -1) break;
5463
+ i = nextLine + 1;
5464
+ continue;
5465
+ }
5466
+ const bodyEnd = matchBrace(source, header.braceIndex);
5467
+ if (bodyEnd === -1) break;
5468
+ blocks.push({
5469
+ type: header.type,
5470
+ labels: header.labels,
5471
+ body: source.slice(header.braceIndex + 1, bodyEnd),
5472
+ start: headerStart,
5473
+ end: bodyEnd + 1
5474
+ });
5475
+ i = bodyEnd + 1;
5476
+ }
5477
+ return blocks;
5478
+ }
5479
+ function parseHclAttributes(body) {
5480
+ const out = [];
5481
+ let i = 0;
5482
+ const n = body.length;
5483
+ while (i < n) {
5484
+ i = skipTrivia(body, i);
5485
+ if (i >= n) break;
5486
+ const nameMatch = /^([A-Za-z_][A-Za-z0-9_-]*)\s*=(?!=)/.exec(body.slice(i));
5487
+ if (!nameMatch) {
5488
+ const header = readBlockHeader(body, i);
5489
+ if (header) {
5490
+ const end = matchBrace(body, header.braceIndex);
5491
+ if (end === -1) break;
5492
+ i = end + 1;
5493
+ continue;
5494
+ }
5495
+ const nextLine = body.indexOf("\n", i);
5496
+ if (nextLine === -1) break;
5497
+ i = nextLine + 1;
5498
+ continue;
5499
+ }
5500
+ const valueStart = i + nameMatch[0].length;
5501
+ const valueEnd = readValueEnd(body, valueStart);
5502
+ out.push({
5503
+ name: nameMatch[1],
5504
+ value: body.slice(valueStart, valueEnd).trim()
5505
+ });
5506
+ i = valueEnd;
5507
+ const afterValue = skipInlineTrivia(body, i);
5508
+ i = body[afterValue] === "," ? afterValue + 1 : i;
5509
+ }
5510
+ return out;
5511
+ }
5512
+ function hclStringAttribute(body, name) {
5513
+ for (const attribute of parseHclAttributes(body)) {
5514
+ if (attribute.name !== name) continue;
5515
+ const quoted = /^"((?:[^"\\]|\\.)*)"$/.exec(attribute.value);
5516
+ if (quoted) return quoted[1];
5517
+ }
5518
+ return void 0;
5519
+ }
5520
+ function readBlockHeader(source, i) {
5521
+ const typeMatch = /^([A-Za-z_][A-Za-z0-9_-]*)/.exec(source.slice(i));
5522
+ if (!typeMatch) return null;
5523
+ let cursor = i + typeMatch[0].length;
5524
+ const labels = [];
5525
+ for (; ; ) {
5526
+ cursor = skipInlineTrivia(source, cursor);
5527
+ if (cursor >= source.length) return null;
5528
+ const ch = source[cursor];
5529
+ if (ch === "{") return { type: typeMatch[1], labels, braceIndex: cursor };
5530
+ if (ch === '"') {
5531
+ const end = readStringEnd(source, cursor);
5532
+ if (end === -1) return null;
5533
+ labels.push(source.slice(cursor + 1, end));
5534
+ cursor = end + 1;
5535
+ continue;
5536
+ }
5537
+ const identifier = /^([A-Za-z_][A-Za-z0-9_-]*)/.exec(source.slice(cursor));
5538
+ if (identifier) {
5539
+ labels.push(identifier[1]);
5540
+ cursor += identifier[0].length;
5541
+ continue;
5542
+ }
5543
+ return null;
5544
+ }
5545
+ }
5546
+ function matchBrace(source, open) {
5547
+ let depth = 0;
5548
+ let i = open;
5549
+ let mode = "code";
5550
+ let heredocTag = "";
5551
+ while (i < source.length) {
5552
+ const ch = source[i];
5553
+ if (mode === "string") {
5554
+ if (ch === "\\") i += 2;
5555
+ else if (ch === '"') {
5556
+ mode = "code";
5557
+ i++;
5558
+ } else i++;
5559
+ continue;
5560
+ }
5561
+ if (mode === "line-comment") {
5562
+ if (ch === "\n") mode = "code";
5563
+ i++;
5564
+ continue;
5565
+ }
5566
+ if (mode === "block-comment") {
5567
+ if (ch === "*" && source[i + 1] === "/") {
5568
+ mode = "code";
5569
+ i += 2;
5570
+ } else i++;
5571
+ continue;
5572
+ }
5573
+ if (mode === "heredoc") {
5574
+ if (ch === "\n") {
5575
+ const lineEnd = source.indexOf("\n", i + 1);
5576
+ const line = source.slice(i + 1, lineEnd === -1 ? source.length : lineEnd);
5577
+ if (line.trim() === heredocTag) {
5578
+ mode = "code";
5579
+ heredocTag = "";
5580
+ i = lineEnd === -1 ? source.length : lineEnd;
5581
+ continue;
5582
+ }
5583
+ }
5584
+ i++;
5585
+ continue;
5586
+ }
5587
+ if (ch === '"') {
5588
+ mode = "string";
5589
+ i++;
5590
+ continue;
5591
+ }
5592
+ if (ch === "#") {
5593
+ mode = "line-comment";
5594
+ i++;
5595
+ continue;
5596
+ }
5597
+ if (ch === "/" && source[i + 1] === "/") {
5598
+ mode = "line-comment";
5599
+ i += 2;
5600
+ continue;
5601
+ }
5602
+ if (ch === "/" && source[i + 1] === "*") {
5603
+ mode = "block-comment";
5604
+ i += 2;
5605
+ continue;
5606
+ }
5607
+ if (ch === "<" && source[i + 1] === "<") {
5608
+ const heredoc = /^<<[-~]?([A-Za-z_][A-Za-z0-9_]*)/.exec(source.slice(i));
5609
+ if (heredoc) {
5610
+ mode = "heredoc";
5611
+ heredocTag = heredoc[1];
5612
+ i += heredoc[0].length;
5613
+ continue;
5614
+ }
5615
+ }
5616
+ if (ch === "{") {
5617
+ depth++;
5618
+ i++;
5619
+ continue;
5620
+ }
5621
+ if (ch === "}") {
5622
+ depth--;
5623
+ if (depth === 0) return i;
5624
+ i++;
5625
+ continue;
5626
+ }
5627
+ i++;
5628
+ }
5629
+ return -1;
5630
+ }
5631
+ function readStringEnd(source, open) {
5632
+ let i = open + 1;
5633
+ while (i < source.length) {
5634
+ if (source[i] === "\\") {
5635
+ i += 2;
5636
+ continue;
5637
+ }
5638
+ if (source[i] === '"') return i;
5639
+ i++;
5640
+ }
5641
+ return -1;
5642
+ }
5643
+ function readValueEnd(source, start) {
5644
+ const i = skipInlineTrivia(source, start);
5645
+ if (source[i] === "{") {
5646
+ const close = matchBrace(source, i);
5647
+ if (close !== -1) return close + 1;
5648
+ }
5649
+ if (source[i] === "[") {
5650
+ const close = matchBracket(source, i);
5651
+ if (close !== -1) return close + 1;
5652
+ }
5653
+ const heredoc = /^<<[-~]?([A-Za-z_][A-Za-z0-9_]*)/.exec(source.slice(i));
5654
+ if (heredoc) {
5655
+ const tag = heredoc[1];
5656
+ let cursor2 = i;
5657
+ while (cursor2 < source.length) {
5658
+ const lineEnd = source.indexOf("\n", cursor2 + 1);
5659
+ const line = source.slice(cursor2 + 1, lineEnd === -1 ? source.length : lineEnd);
5660
+ if (line.trim() === tag) return lineEnd === -1 ? source.length : lineEnd;
5661
+ if (lineEnd === -1) break;
5662
+ cursor2 = lineEnd;
5663
+ }
5664
+ return source.length;
5665
+ }
5666
+ let cursor = i;
5667
+ let depth = 0;
5668
+ let inString = false;
5669
+ while (cursor < source.length) {
5670
+ const ch = source[cursor];
5671
+ if (inString) {
5672
+ if (ch === "\\") cursor += 2;
5673
+ else {
5674
+ if (ch === '"') inString = false;
5675
+ cursor++;
5676
+ }
5677
+ continue;
5678
+ }
5679
+ if (ch === '"') {
5680
+ inString = true;
5681
+ cursor++;
5682
+ continue;
5683
+ }
5684
+ if (ch === "(" || ch === "[" || ch === "{") {
5685
+ depth++;
5686
+ cursor++;
5687
+ continue;
5688
+ }
5689
+ if (ch === ")" || ch === "]" || ch === "}") {
5690
+ if (depth === 0) return cursor;
5691
+ depth--;
5692
+ cursor++;
5693
+ continue;
5694
+ }
5695
+ if (depth === 0) {
5696
+ if (ch === "\n" || ch === ",") return cursor;
5697
+ if (ch === " " || ch === " ") {
5698
+ if (/^\s+[A-Za-z_][A-Za-z0-9_-]*\s*=(?!=)/.test(source.slice(cursor))) return cursor;
5699
+ }
5700
+ if (ch === "#") return cursor;
5701
+ if (ch === "/" && (source[cursor + 1] === "/" || source[cursor + 1] === "*")) return cursor;
5702
+ }
5703
+ cursor++;
5704
+ }
5705
+ return source.length;
5706
+ }
5707
+ function matchBracket(source, open) {
5708
+ let depth = 0;
5709
+ let i = open;
5710
+ let inString = false;
5711
+ while (i < source.length) {
5712
+ const ch = source[i];
5713
+ if (inString) {
5714
+ if (ch === "\\") i += 2;
5715
+ else {
5716
+ if (ch === '"') inString = false;
5717
+ i++;
5718
+ }
5719
+ continue;
5720
+ }
5721
+ if (ch === '"') {
5722
+ inString = true;
5723
+ i++;
5724
+ continue;
5725
+ }
5726
+ if (ch === "[") depth++;
5727
+ else if (ch === "]") {
5728
+ depth--;
5729
+ if (depth === 0) return i;
5730
+ }
5731
+ i++;
5732
+ }
5733
+ return -1;
5734
+ }
5735
+ function skipTrivia(source, i) {
5736
+ for (; ; ) {
5737
+ while (i < source.length && /\s/.test(source[i])) i++;
5738
+ if (source[i] === "#" || source[i] === "/" && source[i + 1] === "/") {
5739
+ const nextLine = source.indexOf("\n", i);
5740
+ if (nextLine === -1) return source.length;
5741
+ i = nextLine + 1;
5742
+ continue;
5743
+ }
5744
+ if (source[i] === "/" && source[i + 1] === "*") {
5745
+ const close = source.indexOf("*/", i + 2);
5746
+ if (close === -1) return source.length;
5747
+ i = close + 2;
5748
+ continue;
5749
+ }
5750
+ return i;
5751
+ }
5752
+ }
5753
+ function skipInlineTrivia(source, i) {
5754
+ while (i < source.length && (source[i] === " " || source[i] === " ")) i++;
5755
+ return i;
5756
+ }
5757
+
5758
+ // src/core-open/scanners/terraform-scanner.ts
5450
5759
  async function parseTerraformFile(filePath, cache) {
5451
5760
  const content = cache ? await cache.readTextFile(filePath) : await readTextFile(filePath);
5761
+ return extractTerraformRequirements(content);
5762
+ }
5763
+ function extractTerraformRequirements(content) {
5452
5764
  const providers = [];
5453
5765
  const modules = [];
5454
5766
  let terraformVersion;
5455
- const tfVersionMatch = content.match(/terraform\s*\{[^}]*required_version\s*=\s*"([^"]+)"/s);
5456
- if (tfVersionMatch) {
5457
- terraformVersion = tfVersionMatch[1];
5458
- }
5459
- const requiredProvidersMatch = content.match(/required_providers\s*\{([^}]+)\}/s);
5460
- if (requiredProvidersMatch) {
5461
- const providersBlock = requiredProvidersMatch[1];
5462
- const providerRegex = /(\w+)\s*=\s*\{([^}]+)\}/g;
5463
- let match;
5464
- while ((match = providerRegex.exec(providersBlock)) !== null) {
5465
- const providerBlock = match[2];
5466
- const sourceMatch = providerBlock.match(/source\s*=\s*"([^"]+)"/);
5467
- if (!sourceMatch) continue;
5468
- const source = sourceMatch[1];
5469
- const versionMatch = providerBlock.match(/version\s*=\s*"([^"]+)"/);
5470
- const version = versionMatch ? versionMatch[1] : void 0;
5471
- providers.push({ source, version });
5472
- }
5473
- }
5474
- const providerBlockRegex = /provider\s+"(\w+)"\s*\{([^}]+)\}/g;
5475
- let providerMatch;
5476
- while ((providerMatch = providerBlockRegex.exec(content)) !== null) {
5477
- const providerName = providerMatch[1];
5478
- const block = providerMatch[2];
5479
- const versionMatch = block.match(/version\s*=\s*"([^"]+)"/);
5480
- if (versionMatch) {
5481
- const existingProvider = providers.find((p) => p.source.endsWith(`/${providerName}`));
5482
- if (!existingProvider) {
5483
- providers.push({
5484
- source: `hashicorp/${providerName}`,
5485
- version: versionMatch[1]
5486
- });
5767
+ for (const block of parseHclBlocks(content)) {
5768
+ if (block.type === "terraform") {
5769
+ terraformVersion ??= hclStringAttribute(block.body, "required_version");
5770
+ for (const inner of parseHclBlocks(block.body)) {
5771
+ if (inner.type !== "required_providers") continue;
5772
+ for (const entry of parseHclAttributes(inner.body)) {
5773
+ const objectBody = /^\{([\s\S]*)\}$/.exec(entry.value);
5774
+ if (objectBody) {
5775
+ const source2 = hclStringAttribute(objectBody[1], "source");
5776
+ if (!source2) continue;
5777
+ providers.push({ source: source2, version: hclStringAttribute(objectBody[1], "version") });
5778
+ continue;
5779
+ }
5780
+ const version = /^"((?:[^"\\]|\\.)*)"$/.exec(entry.value)?.[1];
5781
+ if (!version) continue;
5782
+ const source = `hashicorp/${entry.name}`;
5783
+ if (providers.some((p) => p.source === source)) continue;
5784
+ providers.push({ source, version });
5785
+ }
5487
5786
  }
5787
+ continue;
5488
5788
  }
5489
- }
5490
- const moduleRegex = /module\s+"[^"]+"\s*\{([^}]+)\}/g;
5491
- let moduleMatch;
5492
- while ((moduleMatch = moduleRegex.exec(content)) !== null) {
5493
- const block = moduleMatch[1];
5494
- const sourceMatch = block.match(/source\s*=\s*"([^"]+)"/);
5495
- if (!sourceMatch) continue;
5496
- const source = sourceMatch[1];
5497
- if (source.startsWith("./") || source.startsWith("../") || source.startsWith("git::")) {
5789
+ if (block.type === "provider") {
5790
+ const name = block.labels[0];
5791
+ if (!name) continue;
5792
+ const version = hclStringAttribute(block.body, "version");
5793
+ if (!version) continue;
5794
+ if (providers.some((p) => p.source.endsWith(`/${name}`))) continue;
5795
+ providers.push({ source: `hashicorp/${name}`, version });
5498
5796
  continue;
5499
5797
  }
5500
- const versionMatch = block.match(/version\s*=\s*"([^"]+)"/);
5501
- const version = versionMatch ? versionMatch[1] : void 0;
5502
- modules.push({ source, version });
5798
+ if (block.type === "module") {
5799
+ const source = hclStringAttribute(block.body, "source");
5800
+ if (!source) continue;
5801
+ if (source.startsWith("./") || source.startsWith("../") || source.startsWith("git::")) {
5802
+ continue;
5803
+ }
5804
+ modules.push({ source, version: hclStringAttribute(block.body, "version") });
5805
+ }
5503
5806
  }
5504
5807
  return { terraformVersion, providers, modules };
5505
5808
  }
@@ -11697,5 +12000,5 @@ async function computeTreeMetadataHash(rootDir, options) {
11697
12000
  }
11698
12001
 
11699
12002
  export { PROJECT_TYPE_TO_OSV_ECOSYSTEM, brandProgressBar, buildVersionTimelines, compactUiPurpose, computeDriftScore, computeRepoFingerprint, computeUpgradeImpact, detectVcs, driftBar, fetchRiskySymbols, fetchScanPreflight, findPackageAnyEcosystem, findPackageTimeline, findVersionCrossings, getChangelogSignals, gitHistoryAvailable, loadConfig, normalizeConstraint, parseDsn, perDependencyDrift, prepareCompressedUpload, projectTypeToVulnEcosystem, resolveHead, resolveRepositoryName, runCoreScan, severityRank, titleBox, versionSatisfies, workingTreeDirty, writeDefaultConfig };
11700
- //# sourceMappingURL=chunk-N6ZMZ5AI.js.map
11701
- //# sourceMappingURL=chunk-N6ZMZ5AI.js.map
12003
+ //# sourceMappingURL=chunk-ANYL7SUI.js.map
12004
+ //# sourceMappingURL=chunk-ANYL7SUI.js.map