@ulpi/cli 0.1.1 → 0.1.2

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 (25) hide show
  1. package/dist/{chunk-6JCMYYBT.js → chunk-FNPD3V2X.js} +194 -110
  2. package/dist/{chunk-4KRVDKGB.js → chunk-S253WCQJ.js} +1 -1
  3. package/dist/{chunk-Q4HIY43N.js → chunk-UA6EFK64.js} +7 -11
  4. package/dist/{chunk-DBMUNBNB.js → chunk-VGZLMUNO.js} +148 -18
  5. package/dist/{chunk-247GVVKK.js → chunk-ZLYRPD7I.js} +18 -16
  6. package/dist/{codemap-RRJIDBQ5.js → codemap-3BVYMMVM.js} +49 -17
  7. package/dist/{dist-7LHZ65GC.js → dist-3SNTTNM3.js} +4 -3
  8. package/dist/{dist-R5F4MX3I.js → dist-57UMTPGR.js} +4 -3
  9. package/dist/{dist-LZKZFPVX.js → dist-MFFX7TZW.js} +5 -2
  10. package/dist/{dist-W7K4WPAF.js → dist-QYFQYSXP.js} +41 -13
  11. package/dist/{dist-R5ZJ4LX5.js → dist-YA2BWZB2.js} +1 -1
  12. package/dist/{history-Q2LDADFW.js → history-UG65BCO6.js} +5 -2
  13. package/dist/index.js +32 -20
  14. package/dist/{init-AY5C2ZAS.js → init-22PO3EQB.js} +2 -2
  15. package/dist/{memory-J3G24QHS.js → memory-IT4H3WRD.js} +114 -24
  16. package/dist/{server-MOYPE4SM-N7SE2AN7.js → server-KYER5KX3-43RQQ4MY.js} +1 -1
  17. package/dist/skills/ulpi-generate-guardian/SKILL.md +246 -7
  18. package/dist/skills/ulpi-generate-guardian/references/framework-rules.md +161 -4
  19. package/dist/skills/ulpi-generate-guardian/references/language-rules.md +13 -18
  20. package/dist/{ui-L7UAWXDY.js → ui-3EFREFSY.js} +2 -2
  21. package/dist/ui.html +99 -99
  22. package/dist/{update-DJ227LL3.js → update-364RHTAO.js} +1 -1
  23. package/dist/{version-checker-M37KI7DY.js → version-checker-DTAS4ZYK.js} +1 -1
  24. package/package.json +29 -28
  25. package/LICENSE +0 -21
@@ -8,6 +8,9 @@ import {
8
8
  import {
9
9
  CodemapConfigSchema
10
10
  } from "./chunk-74WVVWJ4.js";
11
+ import {
12
+ extractTagsFromTree
13
+ } from "./chunk-ZLYRPD7I.js";
11
14
  import {
12
15
  LOGS_DIR,
13
16
  codemapBranchDir,
@@ -527,6 +530,7 @@ function getLanguageId(filePath) {
527
530
  }
528
531
  var ParserCtor = null;
529
532
  var LanguageClass = null;
533
+ var QueryCtor = null;
530
534
  var initialized = false;
531
535
  var languageCache = /* @__PURE__ */ new Map();
532
536
  var require2 = createRequire(import.meta.url);
@@ -535,6 +539,7 @@ async function initTreeSitter() {
535
539
  const mod = await import("web-tree-sitter");
536
540
  ParserCtor = mod.Parser;
537
541
  LanguageClass = mod.Language;
542
+ QueryCtor = mod.Query;
538
543
  const wasmPath = require2.resolve("web-tree-sitter/web-tree-sitter.wasm");
539
544
  const wasmDir = path4.dirname(wasmPath) + "/";
540
545
  await ParserCtor.init({
@@ -556,6 +561,12 @@ async function loadLanguage(langConfig) {
556
561
  languageCache.set(cacheKey, language);
557
562
  return language;
558
563
  }
564
+ function createTreeSitterQuery(language, source) {
565
+ if (!QueryCtor) {
566
+ throw new Error("Tree-sitter not initialized. Call initTreeSitter() first.");
567
+ }
568
+ return new QueryCtor(language, source);
569
+ }
559
570
  async function parseSource(content, langConfig) {
560
571
  if (!ParserCtor) {
561
572
  throw new Error("Tree-sitter not initialized. Call initTreeSitter() first.");
@@ -1532,14 +1543,9 @@ async function runPipelineInner(projectDir, onProgress, branch) {
1532
1543
  total: scannedFiles.length,
1533
1544
  message: "Chunking files..."
1534
1545
  });
1535
- let extractTagsFromTree = null;
1536
- try {
1537
- const depgraph = await import("./dist-R5ZJ4LX5.js");
1538
- extractTagsFromTree = depgraph.extractTagsFromTree;
1539
- } catch {
1540
- }
1541
1546
  await initTreeSitter();
1542
1547
  const allTags = /* @__PURE__ */ new Map();
1548
+ let tagExtractionFailures = 0;
1543
1549
  const chunks = [];
1544
1550
  const filePaths = scannedFiles.map((f) => f.filePath);
1545
1551
  for (let i = 0; i < filePaths.length; i++) {
@@ -1561,15 +1567,19 @@ async function runPipelineInner(projectDir, onProgress, branch) {
1561
1567
  const fallbackChunks = await chunkFile(filePath, content, config.chunking);
1562
1568
  chunks.push(...fallbackChunks);
1563
1569
  }
1564
- if (extractTagsFromTree && result.tree && result.language && langId && langConfig.hasTagQuery) {
1570
+ if (result.tree && result.language && langId && langConfig.hasTagQuery) {
1565
1571
  try {
1566
1572
  const lang = result.language;
1567
- const createQuery = (source) => lang.query(source);
1573
+ const createQuery = (source) => createTreeSitterQuery(lang, source);
1568
1574
  const tags = extractTagsFromTree(createQuery, result.tree.rootNode, filePath, langId);
1569
1575
  if (tags.length > 0) {
1570
1576
  allTags.set(filePath, tags);
1571
1577
  }
1572
- } catch {
1578
+ } catch (tagErr) {
1579
+ tagExtractionFailures++;
1580
+ if (tagExtractionFailures <= 3) {
1581
+ log("warn", `Tag extraction failed for ${filePath}: ${tagErr instanceof Error ? tagErr.message : String(tagErr)}`);
1582
+ }
1573
1583
  }
1574
1584
  }
1575
1585
  if (result.tree) {
@@ -1594,6 +1604,13 @@ async function runPipelineInner(projectDir, onProgress, branch) {
1594
1604
  total: scannedFiles.length,
1595
1605
  message: `Created ${chunks.length} chunks`
1596
1606
  });
1607
+ log("info", `Tag extraction: ${allTags.size} files tagged, ${tagExtractionFailures} failures out of ${scannedFiles.length} files`);
1608
+ if (tagExtractionFailures > 3) {
1609
+ log("warn", `Tag extraction failed for ${tagExtractionFailures} files (only first 3 logged above)`);
1610
+ }
1611
+ if (allTags.size === 0) {
1612
+ log("warn", "No tags extracted \u2014 depgraph will be skipped. Check tree-sitter language support.");
1613
+ }
1597
1614
  assignChunkIds(chunks, config.chunking.version);
1598
1615
  onProgress?.({
1599
1616
  phase: "finalizing",
@@ -1646,20 +1663,20 @@ async function runPipelineInner(projectDir, onProgress, branch) {
1646
1663
  let depgraphResult;
1647
1664
  if (allTags.size > 0) {
1648
1665
  try {
1649
- const depgraph = await import("./dist-R5ZJ4LX5.js");
1666
+ const { buildReferenceGraph, computePageRank, savePageRank, computeMetrics, saveMetrics, saveGraph } = await import("./dist-YA2BWZB2.js");
1650
1667
  onProgress?.({
1651
1668
  phase: "graph",
1652
1669
  current: 0,
1653
1670
  total: 3,
1654
1671
  message: "Building dependency graph..."
1655
1672
  });
1656
- const graph = depgraph.buildReferenceGraph(allTags, filePaths);
1673
+ const graph = buildReferenceGraph(allTags, filePaths);
1657
1674
  for (const sf of scannedFiles) {
1658
1675
  if (graph.nodes[sf.filePath]) {
1659
1676
  graph.nodes[sf.filePath].sizeBytes = sf.sizeBytes;
1660
1677
  }
1661
1678
  }
1662
- depgraph.saveGraph(graph, projectDir, resolvedBranch);
1679
+ saveGraph(graph, projectDir, resolvedBranch);
1663
1680
  onProgress?.({
1664
1681
  phase: "graph",
1665
1682
  current: 1,
@@ -1672,8 +1689,8 @@ async function runPipelineInner(projectDir, onProgress, branch) {
1672
1689
  total: 3,
1673
1690
  message: "Computing PageRank..."
1674
1691
  });
1675
- const pageRank = depgraph.computePageRank(graph);
1676
- depgraph.savePageRank(pageRank, projectDir, resolvedBranch);
1692
+ const pageRank = computePageRank(graph);
1693
+ savePageRank(pageRank, projectDir, resolvedBranch);
1677
1694
  onProgress?.({
1678
1695
  phase: "ranking",
1679
1696
  current: 2,
@@ -1686,8 +1703,8 @@ async function runPipelineInner(projectDir, onProgress, branch) {
1686
1703
  total: 3,
1687
1704
  message: "Computing metrics..."
1688
1705
  });
1689
- const metrics = depgraph.computeMetrics(graph, pageRank);
1690
- depgraph.saveMetrics(metrics, projectDir, resolvedBranch);
1706
+ const metrics = computeMetrics(graph, pageRank);
1707
+ saveMetrics(metrics, projectDir, resolvedBranch);
1691
1708
  onProgress?.({
1692
1709
  phase: "metrics",
1693
1710
  current: 3,
@@ -1741,6 +1758,98 @@ async function runPipelineInner(projectDir, onProgress, branch) {
1741
1758
  depgraph: depgraphResult
1742
1759
  };
1743
1760
  }
1761
+ async function rebuildDepgraph(projectDir, onProgress, branch) {
1762
+ const resolvedBranch = branch ?? getCurrentBranch(projectDir);
1763
+ acquireCodemapLock(projectDir, resolvedBranch);
1764
+ try {
1765
+ return await rebuildDepgraphInner(projectDir, onProgress, resolvedBranch);
1766
+ } finally {
1767
+ releaseCodemapLock(projectDir, resolvedBranch);
1768
+ }
1769
+ }
1770
+ async function rebuildDepgraphInner(projectDir, onProgress, branch) {
1771
+ const startTime = Date.now();
1772
+ const config = loadCodemapConfig(projectDir);
1773
+ const resolvedBranch = branch ?? getCurrentBranch(projectDir);
1774
+ const codemapDir = codemapBranchDir(projectDir, resolvedBranch);
1775
+ fs9.mkdirSync(codemapDir, { recursive: true });
1776
+ onProgress?.({ phase: "scanning", current: 0, total: 0, message: "Scanning repository..." });
1777
+ const scannedFiles = scanRepository(projectDir, config);
1778
+ const filePaths = scannedFiles.map((f) => f.filePath);
1779
+ onProgress?.({ phase: "scanning", current: scannedFiles.length, total: scannedFiles.length, message: `Found ${scannedFiles.length} files` });
1780
+ if (scannedFiles.length === 0) {
1781
+ return { nodeCount: 0, edgeCount: 0, definitionCount: 0, referenceCount: 0, cycleCount: 0, durationMs: Date.now() - startTime, taggedFiles: 0, totalFiles: 0 };
1782
+ }
1783
+ await initTreeSitter();
1784
+ const allTags = /* @__PURE__ */ new Map();
1785
+ let tagFailures = 0;
1786
+ for (let i = 0; i < filePaths.length; i++) {
1787
+ const filePath = filePaths[i];
1788
+ const absPath = path11.join(projectDir, filePath);
1789
+ let content;
1790
+ try {
1791
+ content = fs9.readFileSync(absPath, "utf-8");
1792
+ } catch {
1793
+ continue;
1794
+ }
1795
+ const langConfig = getLanguageConfig(filePath);
1796
+ const langId = getLanguageId(filePath);
1797
+ if (langConfig && langConfig.hasTagQuery && langId) {
1798
+ const result = await parseAndChunkFile(filePath, content, config.chunking);
1799
+ if (result.tree && result.language) {
1800
+ try {
1801
+ const lang = result.language;
1802
+ const createQuery = (source) => createTreeSitterQuery(lang, source);
1803
+ const tags = extractTagsFromTree(createQuery, result.tree.rootNode, filePath, langId);
1804
+ if (tags.length > 0) {
1805
+ allTags.set(filePath, tags);
1806
+ }
1807
+ } catch {
1808
+ tagFailures++;
1809
+ }
1810
+ }
1811
+ if (result.tree) result.tree.delete();
1812
+ }
1813
+ if ((i + 1) % 100 === 0 || i === filePaths.length - 1) {
1814
+ onProgress?.({ phase: "chunking", current: i + 1, total: scannedFiles.length, message: `Parsed ${i + 1}/${scannedFiles.length} files (${allTags.size} tagged)` });
1815
+ }
1816
+ }
1817
+ log("info", `DepGraph rebuild: ${allTags.size} files tagged, ${tagFailures} failures out of ${scannedFiles.length} files`);
1818
+ if (allTags.size === 0) {
1819
+ log("warn", "No tags extracted \u2014 cannot build depgraph");
1820
+ return { nodeCount: 0, edgeCount: 0, definitionCount: 0, referenceCount: 0, cycleCount: 0, durationMs: Date.now() - startTime, taggedFiles: 0, totalFiles: scannedFiles.length };
1821
+ }
1822
+ const { buildReferenceGraph, computePageRank, savePageRank, computeMetrics, saveMetrics, saveGraph } = await import("./dist-YA2BWZB2.js");
1823
+ onProgress?.({ phase: "graph", current: 0, total: 3, message: "Building dependency graph..." });
1824
+ const graph = buildReferenceGraph(allTags, filePaths);
1825
+ for (const sf of scannedFiles) {
1826
+ if (graph.nodes[sf.filePath]) {
1827
+ graph.nodes[sf.filePath].sizeBytes = sf.sizeBytes;
1828
+ }
1829
+ }
1830
+ saveGraph(graph, projectDir, resolvedBranch);
1831
+ onProgress?.({ phase: "graph", current: 1, total: 3, message: `Graph: ${Object.keys(graph.nodes).length} nodes, ${graph.edges.length} edges` });
1832
+ onProgress?.({ phase: "ranking", current: 1, total: 3, message: "Computing PageRank..." });
1833
+ const pageRank = computePageRank(graph);
1834
+ savePageRank(pageRank, projectDir, resolvedBranch);
1835
+ onProgress?.({ phase: "ranking", current: 2, total: 3, message: `PageRank: ${pageRank.iterations} iterations, converged=${pageRank.converged}` });
1836
+ onProgress?.({ phase: "metrics", current: 2, total: 3, message: "Computing metrics..." });
1837
+ const metrics = computeMetrics(graph, pageRank);
1838
+ saveMetrics(metrics, projectDir, resolvedBranch);
1839
+ onProgress?.({ phase: "metrics", current: 3, total: 3, message: `Metrics: ${metrics.cycles.length} cycles, ${metrics.totalDefinitions} defs, ${metrics.totalReferences} refs` });
1840
+ const durationMs = Date.now() - startTime;
1841
+ log("info", `DepGraph rebuild: ${metrics.totalFiles} nodes, ${metrics.totalEdges} edges, ${metrics.totalDefinitions} defs, ${metrics.totalReferences} refs, ${metrics.cycles.length} cycles in ${(durationMs / 1e3).toFixed(1)}s`);
1842
+ return {
1843
+ nodeCount: metrics.totalFiles,
1844
+ edgeCount: metrics.totalEdges,
1845
+ definitionCount: metrics.totalDefinitions,
1846
+ referenceCount: metrics.totalReferences,
1847
+ cycleCount: metrics.cycles.length,
1848
+ durationMs,
1849
+ taggedFiles: allTags.size,
1850
+ totalFiles: scannedFiles.length
1851
+ };
1852
+ }
1744
1853
  var STORE_BATCH_SIZE = 5e3;
1745
1854
  async function embedAndStore(embedder, texts, chunks, store, batchConfig, onProgress) {
1746
1855
  if (texts.length === 0) return;
@@ -1981,7 +2090,7 @@ async function searchCode(projectDir, query, options = {}) {
1981
2090
  let graphRanks;
1982
2091
  if (weights.graphRank && weights.graphRank > 0) {
1983
2092
  try {
1984
- const { loadPageRankMap } = await import("./dist-R5ZJ4LX5.js");
2093
+ const { loadPageRankMap } = await import("./dist-YA2BWZB2.js");
1985
2094
  graphRanks = loadPageRankMap(projectDir, resolvedBranch) ?? void 0;
1986
2095
  } catch {
1987
2096
  }
@@ -2511,7 +2620,7 @@ var GITHUB_MAX_FILE_BYTES = 100 * 1024 * 1024;
2511
2620
  var GITHUB_WARN_FILE_BYTES = 50 * 1024 * 1024;
2512
2621
  function ensureBranch(projectDir, branchName) {
2513
2622
  if (historyBranchExists(projectDir, branchName)) return;
2514
- const emptyBlob = execFileSync2("git", ["hash-object", "-t", "blob", "--stdin"], {
2623
+ const emptyBlob = execFileSync2("git", ["hash-object", "-w", "-t", "blob", "--stdin"], {
2515
2624
  cwd: projectDir,
2516
2625
  input: "",
2517
2626
  encoding: "utf-8",
@@ -2591,6 +2700,26 @@ async function exportIndex(projectDir, branch) {
2591
2700
  };
2592
2701
  writeAndStage(worktreeDir, "export-meta.json", JSON.stringify(exportMeta, null, 2) + "\n");
2593
2702
  filesExported++;
2703
+ const readme = [
2704
+ "# ULPI CodeMap Index",
2705
+ "",
2706
+ "This branch stores the semantic code search index for this repository.",
2707
+ "It is maintained automatically by [ULPI](https://github.com/ulpi-io/ulpi).",
2708
+ "",
2709
+ "## Contents",
2710
+ "",
2711
+ "- `schema.json` \u2014 Index schema (embedding provider, model, dimensions)",
2712
+ "- `manifest.json` \u2014 File/chunk manifest for incremental updates",
2713
+ "- `config.json` \u2014 CodeMap configuration",
2714
+ "- `stats.json` \u2014 Index statistics",
2715
+ "- `index/lance/` \u2014 LanceDB vector index",
2716
+ "- `index/metadata/` \u2014 BM25 text index + symbol index",
2717
+ "- `export-meta.json` \u2014 Export metadata",
2718
+ "",
2719
+ `_Exported: ${exportMeta.exportedAt}_`
2720
+ ].join("\n") + "\n";
2721
+ writeAndStage(worktreeDir, "README.md", readme);
2722
+ filesExported++;
2594
2723
  return commitInWorktree(worktreeDir, `codemap: export index (${filesExported} files)`);
2595
2724
  });
2596
2725
  const commitMessage = `codemap: export index (${filesExported} files)`;
@@ -3027,6 +3156,7 @@ export {
3027
3156
  isCodemapLocked,
3028
3157
  buildEmbeddingTexts,
3029
3158
  runInitPipeline,
3159
+ rebuildDepgraph,
3030
3160
  DEFAULT_HYBRID_WEIGHTS,
3031
3161
  normalizeScores,
3032
3162
  computePathBoost,
@@ -42,7 +42,7 @@ var TAG_QUERIES = {
42
42
  (comment)* @doc
43
43
  .
44
44
  [
45
- (function
45
+ (function_expression
46
46
  name: (identifier) @name.definition.function)
47
47
  (function_declaration
48
48
  name: (identifier) @name.definition.function)
@@ -59,7 +59,7 @@ var TAG_QUERIES = {
59
59
  (lexical_declaration
60
60
  (variable_declarator
61
61
  name: (identifier) @name.definition.function
62
- value: [(arrow_function) (function)]) @definition.function)
62
+ value: [(arrow_function) (function_expression)]) @definition.function)
63
63
  )
64
64
 
65
65
  (
@@ -68,7 +68,7 @@ var TAG_QUERIES = {
68
68
  (variable_declaration
69
69
  (variable_declarator
70
70
  name: (identifier) @name.definition.function
71
- value: [(arrow_function) (function)]) @definition.function)
71
+ value: [(arrow_function) (function_expression)]) @definition.function)
72
72
  )
73
73
 
74
74
  (assignment_expression
@@ -77,12 +77,12 @@ var TAG_QUERIES = {
77
77
  (member_expression
78
78
  property: (property_identifier) @name.definition.function)
79
79
  ]
80
- right: [(arrow_function) (function)]
80
+ right: [(arrow_function) (function_expression)]
81
81
  ) @definition.function
82
82
 
83
83
  (pair
84
84
  key: (property_identifier) @name.definition.function
85
- value: [(arrow_function) (function)]) @definition.function
85
+ value: [(arrow_function) (function_expression)]) @definition.function
86
86
 
87
87
  (
88
88
  (call_expression
@@ -127,7 +127,7 @@ var TAG_QUERIES = {
127
127
  (comment)* @doc
128
128
  .
129
129
  [
130
- (function
130
+ (function_expression
131
131
  name: (identifier) @name.definition.function)
132
132
  (function_declaration
133
133
  name: (identifier) @name.definition.function)
@@ -144,7 +144,7 @@ var TAG_QUERIES = {
144
144
  (lexical_declaration
145
145
  (variable_declarator
146
146
  name: (identifier) @name.definition.function
147
- value: [(arrow_function) (function)]) @definition.function)
147
+ value: [(arrow_function) (function_expression)]) @definition.function)
148
148
  )
149
149
 
150
150
  (
@@ -153,7 +153,7 @@ var TAG_QUERIES = {
153
153
  (variable_declaration
154
154
  (variable_declarator
155
155
  name: (identifier) @name.definition.function
156
- value: [(arrow_function) (function)]) @definition.function)
156
+ value: [(arrow_function) (function_expression)]) @definition.function)
157
157
  )
158
158
 
159
159
  (assignment_expression
@@ -162,12 +162,12 @@ var TAG_QUERIES = {
162
162
  (member_expression
163
163
  property: (property_identifier) @name.definition.function)
164
164
  ]
165
- right: [(arrow_function) (function)]
165
+ right: [(arrow_function) (function_expression)]
166
166
  ) @definition.function
167
167
 
168
168
  (pair
169
169
  key: (property_identifier) @name.definition.function
170
- value: [(arrow_function) (function)]) @definition.function
170
+ value: [(arrow_function) (function_expression)]) @definition.function
171
171
 
172
172
  (
173
173
  (call_expression
@@ -256,7 +256,7 @@ var TAG_QUERIES = {
256
256
  (comment)* @doc
257
257
  .
258
258
  [
259
- (function
259
+ (function_expression
260
260
  name: (identifier) @name.definition.function)
261
261
  (function_declaration
262
262
  name: (identifier) @name.definition.function)
@@ -273,7 +273,7 @@ var TAG_QUERIES = {
273
273
  (lexical_declaration
274
274
  (variable_declarator
275
275
  name: (identifier) @name.definition.function
276
- value: [(arrow_function) (function)]) @definition.function)
276
+ value: [(arrow_function) (function_expression)]) @definition.function)
277
277
  )
278
278
 
279
279
  (
@@ -282,7 +282,7 @@ var TAG_QUERIES = {
282
282
  (variable_declaration
283
283
  (variable_declarator
284
284
  name: (identifier) @name.definition.function
285
- value: [(arrow_function) (function)]) @definition.function)
285
+ value: [(arrow_function) (function_expression)]) @definition.function)
286
286
  )
287
287
 
288
288
  (assignment_expression
@@ -291,12 +291,12 @@ var TAG_QUERIES = {
291
291
  (member_expression
292
292
  property: (property_identifier) @name.definition.function)
293
293
  ]
294
- right: [(arrow_function) (function)]
294
+ right: [(arrow_function) (function_expression)]
295
295
  ) @definition.function
296
296
 
297
297
  (pair
298
298
  key: (property_identifier) @name.definition.function
299
- value: [(arrow_function) (function)]) @definition.function
299
+ value: [(arrow_function) (function_expression)]) @definition.function
300
300
 
301
301
  (
302
302
  (call_expression
@@ -1693,7 +1693,9 @@ function extractTagsFromTree(createQuery, rootNode, filePath, lang) {
1693
1693
  let query;
1694
1694
  try {
1695
1695
  query = createQuery(querySource);
1696
- } catch {
1696
+ } catch (err) {
1697
+ const msg = err instanceof Error ? err.message : String(err);
1698
+ console.error(`[depgraph] Query compilation failed for ${lang} (${filePath}): ${msg}`);
1697
1699
  return [];
1698
1700
  }
1699
1701
  try {
@@ -38,6 +38,8 @@ async function runCodemap(args, projectDir) {
38
38
  return await cyclesSubcommand(projectDir);
39
39
  case "coupling":
40
40
  return await couplingSubcommand(args.slice(1), projectDir);
41
+ case "depgraph":
42
+ return await depgraphSubcommand(projectDir);
41
43
  default:
42
44
  console.log(`
43
45
  Usage: ulpi codemap <subcommand>
@@ -59,6 +61,7 @@ Subcommands:
59
61
  rank [--limit N] Show top-ranked files by PageRank
60
62
  cycles Detect circular dependencies
61
63
  coupling [path] Show coupling metrics for files
64
+ depgraph Rebuild dependency graph (without re-embedding)
62
65
  `.trim());
63
66
  }
64
67
  }
@@ -66,7 +69,7 @@ async function initSubcommand(projectDir) {
66
69
  console.log(chalk.bold("\nCodeMap \u2014 Index Project\n"));
67
70
  const { getCurrentBranch } = await import("./dist-RKOGLK7R.js");
68
71
  const branch = getCurrentBranch(projectDir);
69
- const { runInitPipeline, loadCodemapConfig } = await import("./dist-LZKZFPVX.js");
72
+ const { runInitPipeline, loadCodemapConfig } = await import("./dist-MFFX7TZW.js");
70
73
  const config = loadCodemapConfig(projectDir);
71
74
  if (config.embedding.provider === "openai") {
72
75
  const { resolveApiKey } = await import("./dist-RKOGLK7R.js");
@@ -128,7 +131,7 @@ async function searchSubcommand(args, projectDir) {
128
131
  const noDocs = args.includes("--no-docs");
129
132
  const { getCurrentBranch } = await import("./dist-RKOGLK7R.js");
130
133
  const branch = getCurrentBranch(projectDir);
131
- const { searchCode, getCodemapStatus } = await import("./dist-LZKZFPVX.js");
134
+ const { searchCode, getCodemapStatus } = await import("./dist-MFFX7TZW.js");
132
135
  const status = getCodemapStatus(projectDir, branch);
133
136
  if (!status.initialized) {
134
137
  console.log(chalk.red("Error: CodeMap index not initialized."));
@@ -174,7 +177,7 @@ CodeMap Search \u2014 "${query}"
174
177
  async function statusSubcommand(projectDir) {
175
178
  const { getCurrentBranch } = await import("./dist-RKOGLK7R.js");
176
179
  const branch = getCurrentBranch(projectDir);
177
- const { getCodemapStatus } = await import("./dist-LZKZFPVX.js");
180
+ const { getCodemapStatus } = await import("./dist-MFFX7TZW.js");
178
181
  const status = getCodemapStatus(projectDir, branch);
179
182
  console.log(chalk.bold("\nCodeMap Status\n"));
180
183
  if (!status.initialized) {
@@ -205,15 +208,44 @@ async function reindexSubcommand(projectDir) {
205
208
  console.log(chalk.bold("\nCodeMap \u2014 Re-index Project\n"));
206
209
  const { getCurrentBranch } = await import("./dist-RKOGLK7R.js");
207
210
  const branch = getCurrentBranch(projectDir);
208
- const { getCodemapStatus } = await import("./dist-LZKZFPVX.js");
211
+ const { getCodemapStatus } = await import("./dist-MFFX7TZW.js");
209
212
  const status = getCodemapStatus(projectDir, branch);
210
213
  if (!status.initialized) {
211
214
  console.log(chalk.yellow("Index not initialized. Running init instead..."));
212
215
  }
213
216
  return initSubcommand(projectDir);
214
217
  }
218
+ async function depgraphSubcommand(projectDir) {
219
+ console.log(chalk.bold("\nCodeMap \u2014 Rebuild Dependency Graph\n"));
220
+ const { getCurrentBranch } = await import("./dist-RKOGLK7R.js");
221
+ const branch = getCurrentBranch(projectDir);
222
+ const { getCodemapStatus, rebuildDepgraph } = await import("./dist-MFFX7TZW.js");
223
+ const status = getCodemapStatus(projectDir, branch);
224
+ if (!status.initialized) {
225
+ console.log(chalk.red("Error: CodeMap index not initialized. Run 'ulpi codemap init' first."));
226
+ process.exit(1);
227
+ }
228
+ const ora = (await import("ora")).default;
229
+ const spinner = ora("Rebuilding dependency graph...").start();
230
+ try {
231
+ const result = await rebuildDepgraph(projectDir, (progress) => {
232
+ spinner.text = progress.message;
233
+ }, branch);
234
+ spinner.succeed(`Dependency graph rebuilt in ${(result.durationMs / 1e3).toFixed(1)}s`);
235
+ console.log(` Files tagged: ${result.taggedFiles}/${result.totalFiles}`);
236
+ console.log(` Nodes: ${result.nodeCount}`);
237
+ console.log(` Edges: ${result.edgeCount}`);
238
+ console.log(` Definitions: ${result.definitionCount}`);
239
+ console.log(` References: ${result.referenceCount}`);
240
+ console.log(` Cycles: ${result.cycleCount}`);
241
+ } catch (err) {
242
+ spinner.fail("Dependency graph rebuild failed");
243
+ console.log(chalk.red(err instanceof Error ? err.message : String(err)));
244
+ process.exit(1);
245
+ }
246
+ }
215
247
  async function configSubcommand(args, projectDir) {
216
- const { loadCodemapConfig, saveCodemapConfig } = await import("./dist-LZKZFPVX.js");
248
+ const { loadCodemapConfig, saveCodemapConfig } = await import("./dist-MFFX7TZW.js");
217
249
  const config = loadCodemapConfig(projectDir);
218
250
  if (args.length === 0) {
219
251
  console.log(chalk.bold("\nCodeMap Configuration\n"));
@@ -286,7 +318,7 @@ async function watchSubcommand(projectDir) {
286
318
  console.log(chalk.bold("\nCodeMap \u2014 Watch Mode\n"));
287
319
  const { getCurrentBranch } = await import("./dist-RKOGLK7R.js");
288
320
  const branch = getCurrentBranch(projectDir);
289
- const { getCodemapStatus, CodemapWatcher } = await import("./dist-LZKZFPVX.js");
321
+ const { getCodemapStatus, CodemapWatcher } = await import("./dist-MFFX7TZW.js");
290
322
  const status = getCodemapStatus(projectDir, branch);
291
323
  if (!status.initialized) {
292
324
  console.log(chalk.yellow("Index not initialized. Running init first..."));
@@ -317,7 +349,7 @@ async function exportSubcommand(projectDir) {
317
349
  console.log(chalk.bold("\nCodeMap \u2014 Export Index\n"));
318
350
  const { getCurrentBranch } = await import("./dist-RKOGLK7R.js");
319
351
  const branch = getCurrentBranch(projectDir);
320
- const { exportIndex } = await import("./dist-LZKZFPVX.js");
352
+ const { exportIndex } = await import("./dist-MFFX7TZW.js");
321
353
  try {
322
354
  const result = await exportIndex(projectDir, branch);
323
355
  console.log(chalk.green("\u2713 Export complete"));
@@ -336,7 +368,7 @@ async function importSubcommand(projectDir) {
336
368
  console.log(chalk.bold("\nCodeMap \u2014 Import Index\n"));
337
369
  const { getCurrentBranch } = await import("./dist-RKOGLK7R.js");
338
370
  const branch = getCurrentBranch(projectDir);
339
- const { importIndex } = await import("./dist-LZKZFPVX.js");
371
+ const { importIndex } = await import("./dist-MFFX7TZW.js");
340
372
  try {
341
373
  const result = await importIndex(projectDir, branch);
342
374
  if (!result.success) {
@@ -360,7 +392,7 @@ async function importSubcommand(projectDir) {
360
392
  async function serveSubcommand(projectDir) {
361
393
  const { getCurrentBranch } = await import("./dist-RKOGLK7R.js");
362
394
  const branch = getCurrentBranch(projectDir);
363
- const { getCodemapStatus } = await import("./dist-LZKZFPVX.js");
395
+ const { getCodemapStatus } = await import("./dist-MFFX7TZW.js");
364
396
  const status = getCodemapStatus(projectDir, branch);
365
397
  if (!status.initialized) {
366
398
  console.error(chalk.red("Error: CodeMap index not initialized. Run 'ulpi codemap init' first."));
@@ -369,11 +401,11 @@ async function serveSubcommand(projectDir) {
369
401
  console.error(chalk.dim("[codemap-mcp] Starting MCP server..."));
370
402
  console.error(chalk.dim(`[codemap-mcp] Project: ${projectDir}`));
371
403
  console.error(chalk.dim(`[codemap-mcp] Index: ${status.totalFiles} files, ${status.totalChunks} chunks`));
372
- const { startMcpServer } = await import("./dist-W7K4WPAF.js");
404
+ const { startMcpServer } = await import("./dist-QYFQYSXP.js");
373
405
  await startMcpServer({ projectDir, branch });
374
406
  }
375
407
  async function evalSubcommand(args, projectDir) {
376
- const { runEvalHarness } = await import("./dist-LZKZFPVX.js");
408
+ const { runEvalHarness } = await import("./dist-MFFX7TZW.js");
377
409
  const path = await import("path");
378
410
  const datasetIdx = args.indexOf("--dataset");
379
411
  let datasetPath;
@@ -416,7 +448,7 @@ async function evalSubcommand(args, projectDir) {
416
448
  }
417
449
  async function migrateIndexSubcommand(projectDir) {
418
450
  console.log(chalk.bold("\nCodeMap \u2014 Migrate Legacy Index\n"));
419
- const { migrateFromLegacy } = await import("./dist-LZKZFPVX.js");
451
+ const { migrateFromLegacy } = await import("./dist-MFFX7TZW.js");
420
452
  try {
421
453
  const result = await migrateFromLegacy(projectDir);
422
454
  if (!result.migrated) {
@@ -444,7 +476,7 @@ async function depsSubcommand(args, projectDir) {
444
476
  const maxDepth = depthIdx >= 0 ? parseInt(args[depthIdx + 1], 10) || 5 : 5;
445
477
  const { getCurrentBranch } = await import("./dist-RKOGLK7R.js");
446
478
  const branch = getCurrentBranch(projectDir);
447
- const { loadGraph, getOutgoingEdges, getTransitiveDeps } = await import("./dist-R5ZJ4LX5.js");
479
+ const { loadGraph, getOutgoingEdges, getTransitiveDeps } = await import("./dist-YA2BWZB2.js");
448
480
  const graph = loadGraph(projectDir, branch);
449
481
  if (!graph) {
450
482
  console.log(chalk.yellow("No dependency graph found. Run 'ulpi codemap init' first."));
@@ -495,7 +527,7 @@ async function dependentsSubcommand(args, projectDir) {
495
527
  const maxDepth = depthIdx >= 0 ? parseInt(args[depthIdx + 1], 10) || 5 : 5;
496
528
  const { getCurrentBranch } = await import("./dist-RKOGLK7R.js");
497
529
  const branch = getCurrentBranch(projectDir);
498
- const { loadGraph, getIncomingEdges, getTransitiveRdeps } = await import("./dist-R5ZJ4LX5.js");
530
+ const { loadGraph, getIncomingEdges, getTransitiveRdeps } = await import("./dist-YA2BWZB2.js");
499
531
  const graph = loadGraph(projectDir, branch);
500
532
  if (!graph) {
501
533
  console.log(chalk.yellow("No dependency graph found. Run 'ulpi codemap init' first."));
@@ -540,7 +572,7 @@ async function rankSubcommand(args, projectDir) {
540
572
  const limit = limitIdx >= 0 ? parseInt(args[limitIdx + 1], 10) || 20 : 20;
541
573
  const { getCurrentBranch } = await import("./dist-RKOGLK7R.js");
542
574
  const branch = getCurrentBranch(projectDir);
543
- const { loadPageRank, loadGraph } = await import("./dist-R5ZJ4LX5.js");
575
+ const { loadPageRank, loadGraph } = await import("./dist-YA2BWZB2.js");
544
576
  const result = loadPageRank(projectDir, branch);
545
577
  if (!result) {
546
578
  console.log(chalk.yellow("No PageRank data found. Run 'ulpi codemap init' first."));
@@ -572,7 +604,7 @@ Top ${sorted.length} files by PageRank
572
604
  async function cyclesSubcommand(projectDir) {
573
605
  const { getCurrentBranch } = await import("./dist-RKOGLK7R.js");
574
606
  const branch = getCurrentBranch(projectDir);
575
- const { loadMetrics, loadGraph, detectCycles } = await import("./dist-R5ZJ4LX5.js");
607
+ const { loadMetrics, loadGraph, detectCycles } = await import("./dist-YA2BWZB2.js");
576
608
  let cycles;
577
609
  const metrics = loadMetrics(projectDir, branch);
578
610
  if (metrics) {
@@ -605,7 +637,7 @@ async function couplingSubcommand(args, projectDir) {
605
637
  const modulePath = args.filter((a) => !a.startsWith("--"))[0] || "";
606
638
  const { getCurrentBranch } = await import("./dist-RKOGLK7R.js");
607
639
  const branch = getCurrentBranch(projectDir);
608
- const { loadGraph, computeCoupling } = await import("./dist-R5ZJ4LX5.js");
640
+ const { loadGraph, computeCoupling } = await import("./dist-YA2BWZB2.js");
609
641
  const graph = loadGraph(projectDir, branch);
610
642
  if (!graph) {
611
643
  console.log(chalk.yellow("No dependency graph found. Run 'ulpi codemap init' first."));
@@ -15,15 +15,16 @@ import {
15
15
  removeEntry,
16
16
  searchMemory,
17
17
  updateEntry
18
- } from "./chunk-6JCMYYBT.js";
19
- import "./chunk-DBMUNBNB.js";
18
+ } from "./chunk-FNPD3V2X.js";
19
+ import "./chunk-VGZLMUNO.js";
20
20
  import "./chunk-NNUWU6CV.js";
21
21
  import "./chunk-YM2HV4IA.js";
22
22
  import "./chunk-74WVVWJ4.js";
23
23
  import "./chunk-KIKPIH6N.js";
24
+ import "./chunk-ZLYRPD7I.js";
24
25
  import "./chunk-2HEE5OKX.js";
25
- import "./chunk-KLEASXUR.js";
26
26
  import "./chunk-7LXY5UVC.js";
27
+ import "./chunk-KLEASXUR.js";
27
28
  import "./chunk-4VNS5WPM.js";
28
29
 
29
30
  // ../../packages/memory-mcp/dist/index.js
@@ -46,15 +46,16 @@ import {
46
46
  toClassificationEvent,
47
47
  updateEntry,
48
48
  writeMemoryStats
49
- } from "./chunk-6JCMYYBT.js";
50
- import "./chunk-DBMUNBNB.js";
49
+ } from "./chunk-FNPD3V2X.js";
50
+ import "./chunk-VGZLMUNO.js";
51
51
  import "./chunk-NNUWU6CV.js";
52
52
  import "./chunk-YM2HV4IA.js";
53
53
  import "./chunk-74WVVWJ4.js";
54
54
  import "./chunk-KIKPIH6N.js";
55
+ import "./chunk-ZLYRPD7I.js";
55
56
  import "./chunk-2HEE5OKX.js";
56
- import "./chunk-KLEASXUR.js";
57
57
  import "./chunk-7LXY5UVC.js";
58
+ import "./chunk-KLEASXUR.js";
58
59
  import "./chunk-4VNS5WPM.js";
59
60
  export {
60
61
  DEFAULT_MEMORY_CONFIG,