raggrep 0.2.1 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/main.js CHANGED
@@ -24,7 +24,7 @@ class TransformersEmbeddingProvider {
24
24
  constructor(config) {
25
25
  this.config = {
26
26
  model: config?.model ?? "all-MiniLM-L6-v2",
27
- showProgress: config?.showProgress ?? true
27
+ showProgress: config?.showProgress ?? false
28
28
  };
29
29
  }
30
30
  async initialize(config) {
@@ -160,7 +160,7 @@ var init_transformersEmbedding = __esm(() => {
160
160
  };
161
161
  globalConfig = {
162
162
  model: "all-MiniLM-L6-v2",
163
- showProgress: true
163
+ showProgress: false
164
164
  };
165
165
  });
166
166
 
@@ -306,7 +306,7 @@ function getEmbeddingConfigFromModule(moduleConfig) {
306
306
  }
307
307
  return {
308
308
  model: modelName,
309
- showProgress: options.showProgress !== false
309
+ showProgress: options.showProgress === true
310
310
  };
311
311
  }
312
312
  var DEFAULT_CONFIG, RAGGREP_TEMP_BASE, EMBEDDING_MODELS2;
@@ -2006,7 +2006,6 @@ class CoreModule {
2006
2006
  bm25Data: this.bm25Index.serialize()
2007
2007
  };
2008
2008
  await fs2.writeFile(path6.join(coreDir, "symbols.json"), JSON.stringify(symbolIndexData, null, 2));
2009
- console.log(` [Core] Symbol index built with ${this.symbolIndex.size} files`);
2010
2009
  }
2011
2010
  async search(query, ctx, options) {
2012
2011
  const config = ctx.config;
@@ -2736,7 +2735,9 @@ class TypeScriptModule {
2736
2735
  embeddings,
2737
2736
  embeddingModel: currentConfig.model
2738
2737
  };
2739
- const chunkTypes = [...new Set(parsedChunks.map((pc) => pc.type))];
2738
+ const chunkTypes = [
2739
+ ...new Set(parsedChunks.map((pc) => pc.type))
2740
+ ];
2740
2741
  const exports = parsedChunks.filter((pc) => pc.isExported && pc.name).map((pc) => pc.name);
2741
2742
  const allKeywords = new Set;
2742
2743
  for (const pc of parsedChunks) {
@@ -2776,26 +2777,26 @@ class TypeScriptModule {
2776
2777
  }
2777
2778
  this.symbolicIndex.buildBM25Index();
2778
2779
  await this.symbolicIndex.save();
2779
- console.log(` Symbolic index built with ${this.pendingSummaries.size} file summaries`);
2780
2780
  this.pendingSummaries.clear();
2781
2781
  }
2782
2782
  async search(query, ctx, options = {}) {
2783
- const { topK = DEFAULT_TOP_K2, minScore = DEFAULT_MIN_SCORE2, filePatterns } = options;
2783
+ const {
2784
+ topK = DEFAULT_TOP_K2,
2785
+ minScore = DEFAULT_MIN_SCORE2,
2786
+ filePatterns
2787
+ } = options;
2784
2788
  const indexDir = getRaggrepDir(ctx.rootDir, ctx.config);
2785
2789
  const symbolicIndex = new SymbolicIndex(indexDir, this.id);
2786
- let candidateFiles;
2790
+ let allFiles;
2787
2791
  try {
2788
2792
  await symbolicIndex.initialize();
2789
- const maxCandidates = topK * TIER1_CANDIDATE_MULTIPLIER;
2790
- candidateFiles = symbolicIndex.findCandidates(query, maxCandidates);
2791
- if (candidateFiles.length === 0) {
2792
- candidateFiles = symbolicIndex.getAllFiles();
2793
- }
2793
+ allFiles = symbolicIndex.getAllFiles();
2794
2794
  } catch {
2795
- candidateFiles = await ctx.listIndexedFiles();
2795
+ allFiles = await ctx.listIndexedFiles();
2796
2796
  }
2797
+ let filesToSearch = allFiles;
2797
2798
  if (filePatterns && filePatterns.length > 0) {
2798
- candidateFiles = candidateFiles.filter((filepath) => {
2799
+ filesToSearch = allFiles.filter((filepath) => {
2799
2800
  return filePatterns.some((pattern) => {
2800
2801
  if (pattern.startsWith("*.")) {
2801
2802
  const ext = pattern.slice(1);
@@ -2808,7 +2809,7 @@ class TypeScriptModule {
2808
2809
  const queryEmbedding = await getEmbedding(query);
2809
2810
  const bm25Index = new BM25Index;
2810
2811
  const allChunksData = [];
2811
- for (const filepath of candidateFiles) {
2812
+ for (const filepath of filesToSearch) {
2812
2813
  const fileIndex = await ctx.loadFileIndex(filepath);
2813
2814
  if (!fileIndex)
2814
2815
  continue;
@@ -2835,7 +2836,7 @@ class TypeScriptModule {
2835
2836
  }
2836
2837
  const queryTerms = query.toLowerCase().split(/\s+/).filter((t) => t.length > 2);
2837
2838
  const pathBoosts = new Map;
2838
- for (const filepath of candidateFiles) {
2839
+ for (const filepath of filesToSearch) {
2839
2840
  const summary = symbolicIndex.getFileSummary(filepath);
2840
2841
  if (summary?.pathContext) {
2841
2842
  let boost = 0;
@@ -2900,7 +2901,7 @@ class TypeScriptModule {
2900
2901
  return references;
2901
2902
  }
2902
2903
  }
2903
- var DEFAULT_MIN_SCORE2 = 0.15, DEFAULT_TOP_K2 = 10, SEMANTIC_WEIGHT = 0.7, BM25_WEIGHT = 0.3, TIER1_CANDIDATE_MULTIPLIER = 3;
2904
+ var DEFAULT_MIN_SCORE2 = 0.15, DEFAULT_TOP_K2 = 10, SEMANTIC_WEIGHT = 0.7, BM25_WEIGHT = 0.3;
2904
2905
  var init_typescript = __esm(() => {
2905
2906
  init_embeddings();
2906
2907
  init_config2();
@@ -2914,10 +2915,9 @@ var init_typescript = __esm(() => {
2914
2915
  class ModuleRegistryImpl {
2915
2916
  modules = new Map;
2916
2917
  register(module) {
2917
- if (this.modules.has(module.id)) {
2918
- console.warn(`Module '${module.id}' is already registered, overwriting...`);
2918
+ if (!this.modules.has(module.id)) {
2919
+ this.modules.set(module.id, module);
2919
2920
  }
2920
- this.modules.set(module.id, module);
2921
2921
  }
2922
2922
  get(id) {
2923
2923
  return this.modules.get(id);
@@ -3157,7 +3157,6 @@ class IntrospectionIndex {
3157
3157
  await fs5.mkdir(path10.dirname(introFilePath), { recursive: true });
3158
3158
  await fs5.writeFile(introFilePath, JSON.stringify(intro, null, 2));
3159
3159
  }
3160
- console.log(` [Introspection] Saved metadata for ${this.files.size} files`);
3161
3160
  }
3162
3161
  async load(config) {
3163
3162
  const introDir = path10.join(getRaggrepDir(this.rootDir, config), "introspection");
@@ -4025,7 +4024,7 @@ init_embeddings();
4025
4024
  // package.json
4026
4025
  var package_default = {
4027
4026
  name: "raggrep",
4028
- version: "0.2.1",
4027
+ version: "0.2.3",
4029
4028
  description: "Local filesystem-based RAG system for codebases - semantic search using local embeddings",
4030
4029
  type: "module",
4031
4030
  main: "./dist/index.js",
@@ -4294,6 +4293,9 @@ Examples:
4294
4293
  model: flags.model,
4295
4294
  quiet: true
4296
4295
  });
4296
+ console.log("RAGgrep Search");
4297
+ console.log(`==============
4298
+ `);
4297
4299
  if (freshStats.indexed > 0 || freshStats.removed > 0) {
4298
4300
  const parts = [];
4299
4301
  if (freshStats.indexed > 0) {
@@ -4302,12 +4304,12 @@ Examples:
4302
4304
  if (freshStats.removed > 0) {
4303
4305
  parts.push(`${freshStats.removed} removed`);
4304
4306
  }
4305
- console.log(`Index updated: ${parts.join(", ")}
4307
+ console.log(`Using updated index: ${parts.join(", ")}
4306
4308
  `);
4307
- }
4308
- console.log("RAGgrep Search");
4309
- console.log(`==============
4309
+ } else {
4310
+ console.log(`Using cached index (no changes detected).
4310
4311
  `);
4312
+ }
4311
4313
  const filePatterns = flags.fileType ? [`*.${flags.fileType}`] : undefined;
4312
4314
  const results = await search2(process.cwd(), query, {
4313
4315
  topK: flags.topK ?? 10,
@@ -4459,4 +4461,4 @@ Run 'raggrep <command> --help' for more information.
4459
4461
  }
4460
4462
  main();
4461
4463
 
4462
- //# debugId=8D69E082C39BA9C964756E2164756E21
4464
+ //# debugId=DB928D21A583DAC064756E2164756E21