raggrep 0.1.6 → 0.2.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/README.md +62 -95
- package/dist/app/indexer/index.d.ts +27 -2
- package/dist/cli/main.js +967 -604
- package/dist/cli/main.js.map +18 -17
- package/dist/{introspection/conventions/types.d.ts → domain/entities/conventions.d.ts} +6 -5
- package/dist/domain/entities/index.d.ts +2 -0
- package/dist/{introspection → domain/services}/conventions/configFiles.d.ts +1 -1
- package/dist/{introspection → domain/services}/conventions/entryPoints.d.ts +1 -1
- package/dist/{introspection → domain/services}/conventions/frameworks/convex.d.ts +1 -1
- package/dist/{introspection → domain/services}/conventions/frameworks/index.d.ts +1 -1
- package/dist/{introspection → domain/services}/conventions/frameworks/nextjs.d.ts +1 -1
- package/dist/{introspection → domain/services}/conventions/index.d.ts +5 -5
- package/dist/domain/services/introspection.d.ts +31 -0
- package/dist/index.js +671 -474
- package/dist/index.js.map +16 -16
- package/dist/{introspection/index.d.ts → infrastructure/introspection/IntrospectionIndex.d.ts} +3 -14
- package/dist/infrastructure/introspection/index.d.ts +9 -0
- package/dist/{introspection → infrastructure/introspection}/projectDetector.d.ts +3 -12
- package/dist/types.d.ts +4 -4
- package/package.json +1 -1
- package/dist/introspection/fileIntrospector.d.ts +0 -14
- /package/dist/{introspection/types.d.ts → domain/entities/introspection.d.ts} +0 -0
- /package/dist/{introspection → domain/services}/conventions/conventions.test.d.ts +0 -0
- /package/dist/{introspection → domain/services}/introspection.test.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,160 +1,127 @@
|
|
|
1
1
|
# RAGgrep
|
|
2
2
|
|
|
3
|
-
**Local
|
|
3
|
+
**Local semantic search for codebases** — find code using natural language queries.
|
|
4
4
|
|
|
5
|
-
RAGgrep indexes your code and
|
|
5
|
+
RAGgrep indexes your code and lets you search it using natural language. Everything runs locally — no external API calls required.
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
- **📝 TypeScript-optimized** — AST-based parsing extracts functions, classes, interfaces, types.
|
|
15
|
-
- **🎯 Zero config** — Works out of the box with sensible defaults.
|
|
9
|
+
- **Zero-config search** — Just run `raggrep query` and it works. Index is created and updated automatically.
|
|
10
|
+
- **Local-first** — All indexing and search happens on your machine. No cloud dependencies.
|
|
11
|
+
- **Incremental** — Only re-indexes files that have changed. Instant search when nothing changed.
|
|
12
|
+
- **Watch mode** — Keep the index fresh in real-time as you code.
|
|
13
|
+
- **Hybrid search** — Combines semantic similarity with keyword matching for best results.
|
|
16
14
|
|
|
17
15
|
## Installation
|
|
18
16
|
|
|
19
17
|
```bash
|
|
20
|
-
# Install globally
|
|
18
|
+
# Install globally
|
|
21
19
|
npm install -g raggrep
|
|
22
20
|
|
|
23
|
-
# Or with Bun (recommended)
|
|
24
|
-
bun install -g raggrep
|
|
25
|
-
|
|
26
21
|
# Or use without installing
|
|
27
|
-
npx raggrep
|
|
22
|
+
npx raggrep query "your search"
|
|
28
23
|
```
|
|
29
24
|
|
|
30
|
-
##
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
### Search Your Code
|
|
31
28
|
|
|
32
29
|
```bash
|
|
33
|
-
# Index your project
|
|
34
30
|
cd your-project
|
|
35
|
-
raggrep index
|
|
36
|
-
|
|
37
|
-
# Search your codebase
|
|
38
31
|
raggrep query "user authentication"
|
|
39
32
|
```
|
|
40
33
|
|
|
34
|
+
That's it. The first query creates the index automatically. Subsequent queries are instant if files haven't changed. Modified files are re-indexed on the fly.
|
|
35
|
+
|
|
41
36
|
### Example Output
|
|
42
37
|
|
|
43
38
|
```
|
|
39
|
+
Index updated: 42 indexed
|
|
40
|
+
|
|
41
|
+
RAGgrep Search
|
|
42
|
+
==============
|
|
43
|
+
|
|
44
|
+
Searching for: "user authentication"
|
|
45
|
+
|
|
44
46
|
Found 3 results:
|
|
45
47
|
|
|
46
48
|
1. src/auth/authService.ts:24-55 (login)
|
|
47
|
-
Score: 34.4% | Type: function | exported
|
|
48
|
-
export async function login(credentials: LoginCredentials): Promise<AuthResult>
|
|
49
|
+
Score: 34.4% | Type: function | via TypeScript | exported
|
|
50
|
+
export async function login(credentials: LoginCredentials): Promise<AuthResult> {
|
|
51
|
+
const { email, password } = credentials;
|
|
49
52
|
|
|
50
|
-
2. src/auth/
|
|
51
|
-
Score:
|
|
52
|
-
export
|
|
53
|
+
2. src/auth/session.ts:10-25 (createSession)
|
|
54
|
+
Score: 28.2% | Type: function | via TypeScript | exported
|
|
55
|
+
export function createSession(user: User): Session {
|
|
53
56
|
|
|
54
57
|
3. src/users/types.ts:3-12 (User)
|
|
55
|
-
Score: 26.0% | Type: interface | exported
|
|
58
|
+
Score: 26.0% | Type: interface | via TypeScript | exported
|
|
56
59
|
export interface User {
|
|
57
60
|
id: string;
|
|
58
61
|
```
|
|
59
62
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
```typescript
|
|
63
|
-
import raggrep from "raggrep";
|
|
64
|
-
|
|
65
|
-
// Index a directory
|
|
66
|
-
await raggrep.index("./my-project");
|
|
63
|
+
### Watch Mode
|
|
67
64
|
|
|
68
|
-
|
|
69
|
-
const results = await raggrep.search("./my-project", "user authentication");
|
|
70
|
-
console.log(raggrep.formatSearchResults(results));
|
|
65
|
+
Keep your index fresh in real-time while you code:
|
|
71
66
|
|
|
72
|
-
|
|
73
|
-
|
|
67
|
+
```bash
|
|
68
|
+
raggrep index --watch
|
|
74
69
|
```
|
|
75
70
|
|
|
76
|
-
|
|
71
|
+
This monitors file changes and re-indexes automatically. Useful during active development when you want instant search results.
|
|
77
72
|
|
|
78
|
-
```bash
|
|
79
|
-
# Index commands
|
|
80
|
-
raggrep index # Index current directory
|
|
81
|
-
raggrep index --watch # Watch mode: re-index on file changes
|
|
82
|
-
raggrep index --model bge-small-en-v1.5 # Use different embedding model
|
|
83
|
-
raggrep index --verbose # Show detailed progress
|
|
84
|
-
|
|
85
|
-
# Search commands
|
|
86
|
-
raggrep query "user login" # Basic search
|
|
87
|
-
raggrep query "error handling" --top 5 # Limit results
|
|
88
|
-
raggrep query "database" --min-score 0.1 # Lower threshold (more results)
|
|
89
|
-
raggrep query "interface" --type ts # Filter by file type
|
|
90
|
-
|
|
91
|
-
# Maintenance
|
|
92
|
-
raggrep cleanup # Remove stale index entries
|
|
93
|
-
raggrep status # Show index status
|
|
94
73
|
```
|
|
74
|
+
┌─────────────────────────────────────────┐
|
|
75
|
+
│ Watching for changes... (Ctrl+C to stop) │
|
|
76
|
+
└─────────────────────────────────────────┘
|
|
95
77
|
|
|
96
|
-
|
|
78
|
+
[Watch] language/typescript: 2 indexed, 0 errors
|
|
79
|
+
```
|
|
97
80
|
|
|
98
|
-
|
|
81
|
+
## CLI Quick Reference
|
|
99
82
|
|
|
100
|
-
|
|
83
|
+
```bash
|
|
84
|
+
# Search (auto-indexes if needed)
|
|
85
|
+
raggrep query "user login"
|
|
86
|
+
raggrep query "error handling" --top 5
|
|
87
|
+
raggrep query "database" --type ts
|
|
101
88
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
- Works on any text file
|
|
89
|
+
# Watch mode
|
|
90
|
+
raggrep index --watch
|
|
105
91
|
|
|
106
|
-
|
|
92
|
+
# Check index status
|
|
93
|
+
raggrep status
|
|
94
|
+
```
|
|
107
95
|
|
|
108
|
-
|
|
109
|
-
- **Semantic embeddings** for natural language understanding
|
|
110
|
-
- **Symbolic index** for fast BM25 candidate filtering
|
|
96
|
+
## How It Works
|
|
111
97
|
|
|
112
|
-
|
|
98
|
+
1. **First query** — Creates the index (takes 1-2 min for ~1000 files)
|
|
99
|
+
2. **Subsequent queries** — Uses cached index (instant if no changes)
|
|
100
|
+
3. **Files changed** — Re-indexes only modified files automatically
|
|
101
|
+
4. **Files deleted** — Stale entries cleaned up automatically
|
|
113
102
|
|
|
114
|
-
|
|
115
|
-
Query → Core (symbol/BM25) ─┐
|
|
116
|
-
├→ Merge & rank → Results
|
|
117
|
-
Query → TypeScript (BM25 filter → semantic) ─┘
|
|
118
|
-
```
|
|
103
|
+
The index is stored in a system temp directory, keeping your project clean.
|
|
119
104
|
|
|
120
105
|
## What Gets Indexed
|
|
121
106
|
|
|
122
|
-
**File types:** `.ts`, `.tsx`, `.js`, `.jsx`, `.py`, `.go`, `.rs`, `.java`, `.md`
|
|
123
|
-
|
|
124
|
-
**Code structures:**
|
|
125
|
-
|
|
126
|
-
- Functions (regular, async, arrow)
|
|
127
|
-
- Classes (including abstract)
|
|
128
|
-
- Interfaces
|
|
129
|
-
- Type aliases
|
|
130
|
-
- Enums
|
|
131
|
-
- Exported variables
|
|
107
|
+
**File types:** `.ts`, `.tsx`, `.js`, `.jsx`, `.py`, `.go`, `.rs`, `.java`, `.md`, `.txt`
|
|
132
108
|
|
|
133
|
-
**
|
|
109
|
+
**Code structures:** Functions, classes, interfaces, types, enums, exports
|
|
134
110
|
|
|
135
|
-
|
|
136
|
-
- `.next`, `.nuxt`, `__pycache__`, `venv`
|
|
137
|
-
- See [Configuration](./docs/configuration.md) for full list
|
|
111
|
+
**Automatically ignored:** `node_modules`, `dist`, `build`, `.git`, and other common directories
|
|
138
112
|
|
|
139
113
|
## Documentation
|
|
140
114
|
|
|
141
|
-
- [Getting Started](./docs/getting-started.md) — Installation and first steps
|
|
115
|
+
- [Getting Started](./docs/getting-started.md) — Installation options and first steps
|
|
142
116
|
- [CLI Reference](./docs/cli-reference.md) — All commands and options
|
|
143
|
-
- [
|
|
117
|
+
- [SDK Reference](./docs/sdk.md) — Programmatic API for Node.js/Bun
|
|
118
|
+
- [Advanced](./docs/advanced.md) — Configuration, maintenance commands
|
|
144
119
|
- [Architecture](./docs/architecture.md) — How RAGgrep works internally
|
|
145
120
|
|
|
146
|
-
## Performance
|
|
147
|
-
|
|
148
|
-
| Operation | Time | Notes |
|
|
149
|
-
| ------------------------ | ---------- | -------------------------------------- |
|
|
150
|
-
| Initial index (1k files) | 1-2 min | Embedding generation is the bottleneck |
|
|
151
|
-
| Incremental update | <2s | Only changed files |
|
|
152
|
-
| Search | ~100-500ms | Depends on codebase size |
|
|
153
|
-
|
|
154
121
|
## Requirements
|
|
155
122
|
|
|
156
123
|
- Node.js 18+ or Bun 1.0+
|
|
157
|
-
- ~50MB disk space for models (cached
|
|
124
|
+
- ~50MB disk space for models (cached at `~/.cache/raggrep/models/`)
|
|
158
125
|
|
|
159
126
|
## License
|
|
160
127
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EmbeddingModelName } from
|
|
1
|
+
import type { EmbeddingModelName } from "../../domain/ports";
|
|
2
2
|
export interface IndexResult {
|
|
3
3
|
moduleId: string;
|
|
4
4
|
indexed: number;
|
|
@@ -10,6 +10,16 @@ export interface IndexOptions {
|
|
|
10
10
|
model?: EmbeddingModelName;
|
|
11
11
|
/** Show detailed progress */
|
|
12
12
|
verbose?: boolean;
|
|
13
|
+
/** Suppress most output (for use during query) */
|
|
14
|
+
quiet?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface EnsureFreshResult {
|
|
17
|
+
/** Number of files indexed (new or modified) */
|
|
18
|
+
indexed: number;
|
|
19
|
+
/** Number of stale entries removed (deleted files) */
|
|
20
|
+
removed: number;
|
|
21
|
+
/** Number of files unchanged (used cache) */
|
|
22
|
+
unchanged: number;
|
|
13
23
|
}
|
|
14
24
|
export interface CleanupResult {
|
|
15
25
|
moduleId: string;
|
|
@@ -40,6 +50,21 @@ export interface IndexStatus {
|
|
|
40
50
|
* Index a directory using all enabled modules
|
|
41
51
|
*/
|
|
42
52
|
export declare function indexDirectory(rootDir: string, options?: IndexOptions): Promise<IndexResult[]>;
|
|
53
|
+
/**
|
|
54
|
+
* Ensure the index is fresh by checking for changes and updating incrementally.
|
|
55
|
+
* This function is designed to be called before search to transparently manage the index.
|
|
56
|
+
*
|
|
57
|
+
* - If no index exists, creates a full index
|
|
58
|
+
* - If index version is incompatible, rebuilds from scratch
|
|
59
|
+
* - If files have changed, re-indexes only the modified files
|
|
60
|
+
* - If files have been deleted, removes stale entries
|
|
61
|
+
* - If nothing changed, returns immediately (uses cache)
|
|
62
|
+
*
|
|
63
|
+
* @param rootDir - Root directory of the project
|
|
64
|
+
* @param options - Index options
|
|
65
|
+
* @returns Statistics about what was updated
|
|
66
|
+
*/
|
|
67
|
+
export declare function ensureIndexFresh(rootDir: string, options?: IndexOptions): Promise<EnsureFreshResult>;
|
|
43
68
|
/**
|
|
44
69
|
* Clean up stale index entries for files that no longer exist
|
|
45
70
|
* @param rootDir - Root directory of the project
|
|
@@ -55,4 +80,4 @@ export declare function cleanupIndex(rootDir: string, options?: {
|
|
|
55
80
|
* @returns Index status information
|
|
56
81
|
*/
|
|
57
82
|
export declare function getIndexStatus(rootDir: string): Promise<IndexStatus>;
|
|
58
|
-
export { watchDirectory, type WatchOptions, type FileWatcher } from
|
|
83
|
+
export { watchDirectory, type WatchOptions, type FileWatcher } from "./watcher";
|