raggrep 0.14.2 → 0.16.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.
Files changed (38) hide show
  1. package/README.md +83 -3
  2. package/dist/app/search/index.d.ts +16 -0
  3. package/dist/cli/main.js +940 -435
  4. package/dist/cli/main.js.map +26 -20
  5. package/dist/domain/entities/index.d.ts +1 -1
  6. package/dist/domain/entities/searchResult.d.ts +54 -0
  7. package/dist/domain/ports/filesystem.d.ts +3 -1
  8. package/dist/domain/services/chunkContext.d.ts +76 -0
  9. package/dist/domain/services/index.d.ts +2 -0
  10. package/dist/domain/services/simpleSearch.d.ts +75 -0
  11. package/dist/domain/usecases/exactSearch.d.ts +53 -0
  12. package/dist/domain/usecases/index.d.ts +1 -0
  13. package/dist/index.d.ts +38 -3
  14. package/dist/index.js +894 -407
  15. package/dist/index.js.map +24 -20
  16. package/dist/types.d.ts +1 -1
  17. package/package.json +2 -1
  18. package/dist/domain/services/bm25.test.d.ts +0 -4
  19. package/dist/domain/services/configValidator.test.d.ts +0 -1
  20. package/dist/domain/services/conventions/conventions.test.d.ts +0 -4
  21. package/dist/domain/services/introspection.test.d.ts +0 -4
  22. package/dist/domain/services/jsonPathExtractor.test.d.ts +0 -4
  23. package/dist/domain/services/lexicon.test.d.ts +0 -6
  24. package/dist/domain/services/literalExtractor.test.d.ts +0 -6
  25. package/dist/domain/services/phraseMatch.test.d.ts +0 -4
  26. package/dist/domain/services/queryLiteralParser.test.d.ts +0 -7
  27. package/dist/infrastructure/embeddings/embeddings.test.d.ts +0 -4
  28. package/dist/infrastructure/parsing/parsing.test.d.ts +0 -10
  29. package/dist/modules/core/symbols.test.d.ts +0 -4
  30. package/dist/modules/language/go/index.test.d.ts +0 -1
  31. package/dist/modules/language/rust/index.test.d.ts +0 -1
  32. package/dist/modules/language/typescript/parseCode.test.d.ts +0 -4
  33. package/dist/tests/integration.test.d.ts +0 -9
  34. package/dist/tests/ranking.test.d.ts +0 -12
  35. package/dist/tests/simulation-phrase-matching.test.d.ts +0 -14
  36. package/dist/tests/simulation-vocabulary.test.d.ts +0 -17
  37. package/dist/tests/vocabulary-scoring.test.d.ts +0 -16
  38. package/dist/tests/vocabulary.test.d.ts +0 -10
package/README.md CHANGED
@@ -12,7 +12,9 @@ RAGgrep indexes your code and lets you search it using natural language. Everyth
12
12
  - **Local-first** — All indexing and search happens on your machine. No cloud dependencies.
13
13
  - **Incremental** — Only re-indexes files that have changed. Instant search when nothing changed.
14
14
  - **Watch mode** — Keep the index fresh in real-time as you code.
15
- - **Hybrid search** — Combines semantic similarity with keyword matching for best results.
15
+ - **Hybrid search** — Combines semantic similarity, keyword matching, and exact text matching for best results.
16
+ - **Exact match track** — Finds identifiers in ANY file type (YAML, .env, config, not just code) with grep-like precision.
17
+ - **Fusion boosting** — Semantic results containing exact matches get boosted (1.5x) for better ranking.
16
18
  - **Literal boosting** — Exact identifier matches get priority. Use backticks for precise matching: `` `AuthService` ``.
17
19
  - **Phrase matching** — Exact phrases in documentation are found even when semantic similarity is low.
18
20
  - **Semantic expansion** — Domain-specific synonyms improve recall (function ↔ method, auth ↔ authentication).
@@ -40,6 +42,59 @@ That's it. The first query creates the index automatically. Subsequent queries a
40
42
 
41
43
  ### Example Output
42
44
 
45
+ **Natural Language Query:**
46
+ ```
47
+ Index updated: 42 indexed
48
+
49
+ RAGgrep Search
50
+ =============
51
+
52
+ Searching for: "user authentication"
53
+
54
+ Found 3 results:
55
+
56
+ 1. src/auth/authService.ts:24-55 (login)
57
+ Score: 34.4% | Type: function | via TypeScript | exported
58
+ export async function login(credentials: LoginCredentials): Promise<AuthResult> {
59
+ const { email, password } = credentials;
60
+
61
+ 2. src/auth/session.ts:10-25 (createSession)
62
+ Score: 28.2% | Type: function | via TypeScript | exported
63
+ export function createSession(user: User): Session {
64
+
65
+ 3. src/users/types.ts:3-12 (User)
66
+ Score: 26.0% | Type: interface | via TypeScript | exported
67
+ export interface User {
68
+ id: string;
69
+ ```
70
+
71
+ **Exact Identifier Query (shows both tracks):**
72
+ ```
73
+ Index updated: 42 indexed
74
+
75
+ Searching for: "AUTH_SERVICE_URL"
76
+
77
+ ┌─ Exact Matches (4 files, 6 matches) ─┐
78
+ │ Query: "AUTH_SERVICE_URL"
79
+ └─────────────────────────────────────────────────────────────────────┘
80
+
81
+ 1. config.yaml (2 matches)
82
+ 8 │ auth:
83
+ 9 │ url: AUTH_SERVICE_URL
84
+ ► 10 │ grpc_url: AUTH_SERVICE_GRPC_URL
85
+ 11 │ timeout: 5000
86
+
87
+ 2. .env.example (1 match)
88
+ 2 │ AUTH_SERVICE_URL=https://auth.example.com
89
+ ► 3 │ AUTH_SERVICE_GRPC_URL=grpc://auth.example.com:9000
90
+
91
+ ┌─ Semantic Results (boosted by exact matches) ─┐
92
+ └─────────────────────────────────────────────────────────────────────┘
93
+
94
+ 1. src/auth/authService.ts:2-10 (AuthService)
95
+ Score: 45.2% | Type: class | via TypeScript | exported | exact match
96
+ export class AuthService {
97
+ private baseUrl = AUTH_SERVICE_URL;
43
98
  ```
44
99
  Index updated: 42 indexed
45
100
 
@@ -97,13 +152,14 @@ raggrep reset # Clear the index
97
152
  ### Query Options
98
153
 
99
154
  ```bash
100
- raggrep query "user login" # Basic search
155
+ raggrep query "user login" # Natural language query
156
+ raggrep query "AUTH_SERVICE_URL" # Exact identifier (auto-triggers exact match)
157
+ raggrep query "\`AuthService\`" # Backticks force exact match
101
158
  raggrep query "error handling" --top 5 # Limit results
102
159
  raggrep query "database" --min-score 0.2 # Set minimum score threshold
103
160
  raggrep query "interface" --type ts # Filter by file extension
104
161
  raggrep query "auth" --filter src/auth # Filter by path
105
162
  raggrep query "api" -f src/api -f src/routes # Multiple path filters
106
- raggrep query "\`AuthService\` class" # Exact identifier match (backticks)
107
163
  ```
108
164
 
109
165
  | Flag | Short | Description |
@@ -150,6 +206,30 @@ raggrep query "config" --filter "*.json" --filter "*.yaml" --filter config/
150
206
 
151
207
  This is useful when you know whether you're looking for code or documentation.
152
208
 
209
+ ### Exact Match Search
210
+
211
+ For identifier-like queries (SCREAMING_SNAKE_CASE, camelCase, PascalCase), RAGgrep automatically runs exact match search:
212
+
213
+ ```bash
214
+ # Finds AUTH_SERVICE_URL in ALL file types (YAML, .env, config, etc.)
215
+ raggrep query "AUTH_SERVICE_URL"
216
+
217
+ # Finds the function by exact name
218
+ raggrep query "getUserById"
219
+
220
+ # Use backticks for explicit exact matching (even natural words)
221
+ raggrep query "`configuration`"
222
+ ```
223
+
224
+ **What Gets Searched:**
225
+ - **Source code**: `.ts`, `.js`, `.py`, `.go`, `.rs`
226
+ - **Config files**: `.yaml`, `.yml`, `.json`, `.toml`, `.env`
227
+ - **Documentation**: `.md`, `.txt`
228
+
229
+ **Ignored:** `node_modules`, `.git`, `dist`, `build`, `.cache`, etc.
230
+
231
+ Exact matches are shown in a separate section with line numbers and context. Semantic results containing the same identifier get boosted (1.5x score multiplier).
232
+
153
233
  ### Index Options
154
234
 
155
235
  ```bash
@@ -1,11 +1,27 @@
1
1
  import { SearchOptions, SearchResult } from "../../types";
2
+ import type { HybridSearchResults } from "../../domain/entities";
2
3
  /**
3
4
  * Search across all enabled modules
4
5
  */
5
6
  export declare function search(rootDir: string, query: string, options?: SearchOptions): Promise<SearchResult[]>;
7
+ /**
8
+ * Hybrid search with both semantic and exact match tracks.
9
+ *
10
+ * Returns:
11
+ * - results: Semantic/BM25 results (existing behavior), with fusion boosting if applicable
12
+ * - exactMatches: Exact match results for identifier queries (optional)
13
+ */
14
+ export declare function hybridSearch(rootDir: string, query: string, options?: SearchOptions): Promise<HybridSearchResults>;
6
15
  /**
7
16
  * Format search results for display
8
17
  * @param results - Array of search results to format
9
18
  * @returns Formatted string for console output
10
19
  */
11
20
  export declare function formatSearchResults(results: SearchResult[]): string;
21
+ /**
22
+ * Format hybrid search results including exact matches.
23
+ *
24
+ * @param hybridResults - Results from hybridSearch
25
+ * @returns Formatted string for console output
26
+ */
27
+ export declare function formatHybridSearchResults(hybridResults: HybridSearchResults): string;