raggrep 0.4.0 → 0.5.0

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.
@@ -0,0 +1,47 @@
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
+ /**
25
+ * Module-specific data stored alongside file index
26
+ */
27
+ export interface JsonModuleData {
28
+ embeddings: number[][];
29
+ embeddingModel: string;
30
+ jsonKeys: string[];
31
+ [key: string]: unknown;
32
+ }
33
+ export declare class JsonModule implements IndexModule {
34
+ readonly id = "data/json";
35
+ readonly name = "JSON Search";
36
+ readonly description = "JSON file search with structure-aware indexing";
37
+ readonly version = "1.0.0";
38
+ private embeddingConfig;
39
+ private symbolicIndex;
40
+ private pendingSummaries;
41
+ private rootDir;
42
+ private logger;
43
+ initialize(config: ModuleConfig): Promise<void>;
44
+ indexFile(filepath: string, content: string, ctx: IndexContext): Promise<FileIndex | null>;
45
+ finalize(ctx: IndexContext): Promise<void>;
46
+ search(query: string, ctx: SearchContext, options?: SearchOptions): Promise<SearchResult[]>;
47
+ }
@@ -0,0 +1,47 @@
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
+ /**
25
+ * Module-specific data stored alongside file index
26
+ */
27
+ export interface MarkdownModuleData {
28
+ embeddings: number[][];
29
+ embeddingModel: string;
30
+ headings: string[];
31
+ [key: string]: unknown;
32
+ }
33
+ export declare class MarkdownModule implements IndexModule {
34
+ readonly id = "docs/markdown";
35
+ readonly name = "Markdown Search";
36
+ readonly description = "Markdown documentation search with section-aware indexing";
37
+ readonly version = "1.0.0";
38
+ private embeddingConfig;
39
+ private symbolicIndex;
40
+ private pendingSummaries;
41
+ private rootDir;
42
+ private logger;
43
+ initialize(config: ModuleConfig): Promise<void>;
44
+ indexFile(filepath: string, content: string, ctx: IndexContext): Promise<FileIndex | null>;
45
+ finalize(ctx: IndexContext): Promise<void>;
46
+ search(query: string, ctx: SearchContext, options?: SearchOptions): Promise<SearchResult[]>;
47
+ }
@@ -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,12 @@ 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;
16
24
  /**
17
25
  * Module-specific data stored alongside file index
18
26
  */
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "raggrep",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
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",