raggrep 0.3.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.
- package/dist/app/indexer/index.d.ts +32 -4
- package/dist/cli/main.js +1459 -635
- package/dist/cli/main.js.map +17 -11
- package/dist/domain/entities/config.d.ts +6 -0
- package/dist/domain/ports/embedding.d.ts +4 -1
- package/dist/domain/ports/index.d.ts +2 -1
- package/dist/domain/ports/logger.d.ts +66 -0
- package/dist/domain/services/chunking.d.ts +66 -0
- package/dist/domain/services/index.d.ts +2 -0
- package/dist/domain/services/queryIntent.d.ts +55 -0
- package/dist/index.d.ts +45 -8
- package/dist/index.js +1500 -679
- package/dist/index.js.map +17 -11
- package/dist/infrastructure/index.d.ts +1 -0
- package/dist/infrastructure/logger/index.d.ts +6 -0
- package/dist/infrastructure/logger/loggers.d.ts +75 -0
- package/dist/modules/data/json/index.d.ts +47 -0
- package/dist/modules/docs/markdown/index.d.ts +47 -0
- package/dist/modules/language/typescript/index.d.ts +10 -1
- package/dist/modules/language/typescript/parseCode.d.ts +11 -7
- package/package.json +1 -1
|
@@ -8,3 +8,4 @@ export { NodeFileSystem, nodeFileSystem } from "./filesystem";
|
|
|
8
8
|
export { TransformersEmbeddingProvider, getCacheDir, isModelCached, } from "./embeddings";
|
|
9
9
|
export { FileIndexStorage, SymbolicIndex, getSymbolicPath } from "./storage";
|
|
10
10
|
export { DEFAULT_CONFIG, EMBEDDING_MODELS, getRaggrepDir, getModuleIndexPath, getModuleManifestPath, getGlobalManifestPath, getConfigPath, loadConfig, saveConfig, getModuleConfig, getEmbeddingConfigFromModule, } from "./config";
|
|
11
|
+
export { ConsoleLogger, InlineProgressLogger, SilentLogger, createLogger, createInlineLogger, createSilentLogger, } from "./logger";
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logger Implementations
|
|
3
|
+
*
|
|
4
|
+
* Provides different logging strategies for various use cases:
|
|
5
|
+
* - ConsoleLogger: Standard console output (default for SDK)
|
|
6
|
+
* - InlineProgressLogger: Progress with inline replacement (for CLI)
|
|
7
|
+
* - SilentLogger: No output (for quiet mode)
|
|
8
|
+
*/
|
|
9
|
+
import type { Logger } from "../../domain/ports";
|
|
10
|
+
/**
|
|
11
|
+
* Logger options
|
|
12
|
+
*/
|
|
13
|
+
export interface LoggerOptions {
|
|
14
|
+
/** Show debug messages */
|
|
15
|
+
verbose?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Standard console logger.
|
|
19
|
+
* Logs messages normally without inline replacement.
|
|
20
|
+
* Default for SDK usage.
|
|
21
|
+
*/
|
|
22
|
+
export declare class ConsoleLogger implements Logger {
|
|
23
|
+
private verbose;
|
|
24
|
+
constructor(options?: LoggerOptions);
|
|
25
|
+
info(message: string): void;
|
|
26
|
+
warn(message: string): void;
|
|
27
|
+
error(message: string): void;
|
|
28
|
+
debug(message: string): void;
|
|
29
|
+
progress(message: string): void;
|
|
30
|
+
clearProgress(): void;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* CLI logger with inline progress replacement.
|
|
34
|
+
* Uses carriage return to overwrite progress lines in place.
|
|
35
|
+
* Best for terminal environments with stdout/stderr.
|
|
36
|
+
*/
|
|
37
|
+
export declare class InlineProgressLogger implements Logger {
|
|
38
|
+
private verbose;
|
|
39
|
+
private lastProgressLength;
|
|
40
|
+
private hasProgress;
|
|
41
|
+
constructor(options?: LoggerOptions);
|
|
42
|
+
info(message: string): void;
|
|
43
|
+
warn(message: string): void;
|
|
44
|
+
error(message: string): void;
|
|
45
|
+
debug(message: string): void;
|
|
46
|
+
progress(message: string): void;
|
|
47
|
+
clearProgress(): void;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Silent logger that produces no output.
|
|
51
|
+
* Used for quiet mode or testing.
|
|
52
|
+
*/
|
|
53
|
+
export declare class SilentLogger implements Logger {
|
|
54
|
+
info(): void;
|
|
55
|
+
warn(): void;
|
|
56
|
+
error(): void;
|
|
57
|
+
debug(): void;
|
|
58
|
+
progress(): void;
|
|
59
|
+
clearProgress(): void;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Create a standard console logger.
|
|
63
|
+
* Default for SDK usage.
|
|
64
|
+
*/
|
|
65
|
+
export declare function createLogger(options?: LoggerOptions): Logger;
|
|
66
|
+
/**
|
|
67
|
+
* Create an inline progress logger for CLI usage.
|
|
68
|
+
* Progress messages replace the current line.
|
|
69
|
+
*/
|
|
70
|
+
export declare function createInlineLogger(options?: LoggerOptions): Logger;
|
|
71
|
+
/**
|
|
72
|
+
* Create a silent logger.
|
|
73
|
+
* Produces no output.
|
|
74
|
+
*/
|
|
75
|
+
export declare function createSilentLogger(): Logger;
|
|
@@ -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
|
*/
|
|
@@ -31,6 +39,7 @@ export declare class TypeScriptModule implements IndexModule {
|
|
|
31
39
|
private symbolicIndex;
|
|
32
40
|
private pendingSummaries;
|
|
33
41
|
private rootDir;
|
|
42
|
+
private logger;
|
|
34
43
|
initialize(config: ModuleConfig): Promise<void>;
|
|
35
44
|
indexFile(filepath: string, content: string, ctx: IndexContext): Promise<FileIndex | null>;
|
|
36
45
|
/**
|
|
@@ -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
|
|
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
|
|
37
|
+
* @param filepath - The file path (used for JSX detection)
|
|
34
38
|
* @returns Array of parsed chunks
|
|
35
39
|
*/
|
|
36
|
-
export declare function
|
|
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
|