raggrep 0.4.0 → 0.5.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.
@@ -29,6 +29,10 @@ export declare class CoreModule implements IndexModule {
29
29
  readonly name = "Core Search";
30
30
  readonly description = "Language-agnostic text search with symbol extraction";
31
31
  readonly version = "1.0.0";
32
+ /**
33
+ * Core module accepts all files (it's the fallback).
34
+ */
35
+ supportsFile(_filepath: string): boolean;
32
36
  private symbolIndex;
33
37
  private bm25Index;
34
38
  private rootDir;
@@ -0,0 +1,49 @@
1
+ /**
2
+ * JSON Data Index Module
3
+ *
4
+ * Provides JSON file search using:
5
+ * - JSON structure parsing
6
+ * - Local text embeddings for semantic similarity
7
+ * - Key/value extraction for better search
8
+ *
9
+ * Supported file types: .json
10
+ *
11
+ * Index location: .raggrep/index/data/json/
12
+ */
13
+ import { IndexModule, IndexContext, SearchContext, SearchOptions, FileIndex, SearchResult, ModuleConfig } from "../../../types";
14
+ /** Default minimum similarity score for search results */
15
+ export declare const DEFAULT_MIN_SCORE = 0.15;
16
+ /** Default number of results to return */
17
+ export declare const DEFAULT_TOP_K = 10;
18
+ /** File extensions supported by this module */
19
+ export declare const JSON_EXTENSIONS: string[];
20
+ /**
21
+ * Check if a file is supported by this module.
22
+ */
23
+ export declare function isJsonFile(filepath: string): boolean;
24
+ export declare const supportsFile: typeof isJsonFile;
25
+ /**
26
+ * Module-specific data stored alongside file index
27
+ */
28
+ export interface JsonModuleData {
29
+ embeddings: number[][];
30
+ embeddingModel: string;
31
+ jsonKeys: string[];
32
+ [key: string]: unknown;
33
+ }
34
+ export declare class JsonModule implements IndexModule {
35
+ readonly id = "data/json";
36
+ readonly name = "JSON Search";
37
+ readonly description = "JSON file search with structure-aware indexing";
38
+ readonly version = "1.0.0";
39
+ supportsFile(filepath: string): boolean;
40
+ private embeddingConfig;
41
+ private symbolicIndex;
42
+ private pendingSummaries;
43
+ private rootDir;
44
+ private logger;
45
+ initialize(config: ModuleConfig): Promise<void>;
46
+ indexFile(filepath: string, content: string, ctx: IndexContext): Promise<FileIndex | null>;
47
+ finalize(ctx: IndexContext): Promise<void>;
48
+ search(query: string, ctx: SearchContext, options?: SearchOptions): Promise<SearchResult[]>;
49
+ }
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Markdown Documentation Index Module
3
+ *
4
+ * Provides Markdown file search using:
5
+ * - Heading-based section parsing
6
+ * - Local text embeddings for semantic similarity
7
+ * - Structure-aware chunking
8
+ *
9
+ * Supported file types: .md
10
+ *
11
+ * Index location: .raggrep/index/docs/markdown/
12
+ */
13
+ import { IndexModule, IndexContext, SearchContext, SearchOptions, FileIndex, SearchResult, ModuleConfig } from "../../../types";
14
+ /** Default minimum similarity score for search results */
15
+ export declare const DEFAULT_MIN_SCORE = 0.15;
16
+ /** Default number of results to return */
17
+ export declare const DEFAULT_TOP_K = 10;
18
+ /** File extensions supported by this module */
19
+ export declare const MARKDOWN_EXTENSIONS: string[];
20
+ /**
21
+ * Check if a file is supported by this module.
22
+ */
23
+ export declare function isMarkdownFile(filepath: string): boolean;
24
+ export declare const supportsFile: typeof isMarkdownFile;
25
+ /**
26
+ * Module-specific data stored alongside file index
27
+ */
28
+ export interface MarkdownModuleData {
29
+ embeddings: number[][];
30
+ embeddingModel: string;
31
+ headings: string[];
32
+ [key: string]: unknown;
33
+ }
34
+ export declare class MarkdownModule implements IndexModule {
35
+ readonly id = "docs/markdown";
36
+ readonly name = "Markdown Search";
37
+ readonly description = "Markdown documentation search with section-aware indexing";
38
+ readonly version = "1.0.0";
39
+ supportsFile(filepath: string): boolean;
40
+ private embeddingConfig;
41
+ private symbolicIndex;
42
+ private pendingSummaries;
43
+ private rootDir;
44
+ private logger;
45
+ initialize(config: ModuleConfig): Promise<void>;
46
+ indexFile(filepath: string, content: string, ctx: IndexContext): Promise<FileIndex | null>;
47
+ finalize(ctx: IndexContext): Promise<void>;
48
+ search(query: string, ctx: SearchContext, options?: SearchOptions): Promise<SearchResult[]>;
49
+ }
@@ -1,11 +1,13 @@
1
1
  /**
2
- * TypeScript Language Index Module
2
+ * TypeScript/JavaScript Language Index Module
3
3
  *
4
4
  * Provides TypeScript/JavaScript-aware code search using:
5
5
  * - AST parsing via TypeScript Compiler API
6
6
  * - Local text embeddings for semantic similarity
7
7
  * - BM25 keyword matching for fast filtering
8
8
  *
9
+ * Supported file types: .ts, .tsx, .js, .jsx, .mjs, .cjs, .mts, .cts
10
+ *
9
11
  * Index location: .raggrep/index/language/typescript/
10
12
  */
11
13
  import { IndexModule, IndexContext, SearchContext, SearchOptions, FileIndex, SearchResult, ModuleConfig } from "../../../types";
@@ -13,6 +15,13 @@ import { IndexModule, IndexContext, SearchContext, SearchOptions, FileIndex, Sea
13
15
  export declare const DEFAULT_MIN_SCORE = 0.15;
14
16
  /** Default number of results to return */
15
17
  export declare const DEFAULT_TOP_K = 10;
18
+ /** File extensions supported by this module */
19
+ export declare const TYPESCRIPT_EXTENSIONS: string[];
20
+ /**
21
+ * Check if a file is supported by this module.
22
+ */
23
+ export declare function isTypeScriptFile(filepath: string): boolean;
24
+ export declare const supportsFile: typeof isTypeScriptFile;
16
25
  /**
17
26
  * Module-specific data stored alongside file index
18
27
  */
@@ -27,6 +36,7 @@ export declare class TypeScriptModule implements IndexModule {
27
36
  readonly name = "TypeScript Search";
28
37
  readonly description = "TypeScript-aware code search with AST parsing and semantic embeddings";
29
38
  readonly version = "1.0.0";
39
+ supportsFile(filepath: string): boolean;
30
40
  private embeddingConfig;
31
41
  private symbolicIndex;
32
42
  private pendingSummaries;
@@ -3,11 +3,11 @@
3
3
  *
4
4
  * Uses the TypeScript Compiler API for accurate AST-based parsing.
5
5
  * Extracts semantic chunks: functions, classes, interfaces, types, enums.
6
+ *
7
+ * This parser is specifically for TypeScript/JavaScript files.
8
+ * For other file types, use the generic chunking in domain/services/chunking.
6
9
  */
7
- /**
8
- * Chunk types that can be extracted from code
9
- */
10
- export type ChunkType = 'function' | 'class' | 'interface' | 'type' | 'enum' | 'variable' | 'block' | 'file';
10
+ import type { ChunkType } from "../../../domain/entities";
11
11
  /**
12
12
  * Represents a parsed chunk of code with location information
13
13
  */
@@ -28,12 +28,16 @@ export interface ParsedChunk {
28
28
  jsDoc?: string;
29
29
  }
30
30
  /**
31
- * Parse code into semantic chunks based on file extension
31
+ * Parse TypeScript/JavaScript code into semantic chunks.
32
+ *
33
+ * Uses the TypeScript Compiler API for accurate AST-based parsing.
34
+ * Returns chunks for functions, classes, interfaces, types, enums, and exported variables.
35
+ *
32
36
  * @param content - The source code content
33
- * @param filepath - The file path (used to determine language)
37
+ * @param filepath - The file path (used for JSX detection)
34
38
  * @returns Array of parsed chunks
35
39
  */
36
- export declare function parseCode(content: string, filepath: string): ParsedChunk[];
40
+ export declare function parseTypeScriptCode(content: string, filepath: string): ParsedChunk[];
37
41
  /**
38
42
  * Generate a unique chunk ID from filepath and line numbers
39
43
  * @param filepath - The source file path
package/dist/types.d.ts CHANGED
@@ -71,6 +71,12 @@ export interface IndexModule {
71
71
  * Use for building secondary indexes (e.g., Tier 1 summaries, BM25 index).
72
72
  */
73
73
  finalize?(ctx: IndexContext): Promise<void>;
74
+ /**
75
+ * Optional: Check if this module supports a given file.
76
+ * Used to pre-filter files before indexing to show accurate progress.
77
+ * If not implemented, all files are passed to indexFile.
78
+ */
79
+ supportsFile?(filepath: string): boolean;
74
80
  /**
75
81
  * Optional: Cleanup resources
76
82
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "raggrep",
3
- "version": "0.4.0",
3
+ "version": "0.5.1",
4
4
  "description": "Local filesystem-based RAG system for codebases - semantic search using local embeddings",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",