@autodev/codebase 0.0.6 → 1.0.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 CHANGED
@@ -1,17 +1,20 @@
1
1
  # @autodev/codebase
2
2
 
3
- <div align="center">
3
+ <p align="center">
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/@autodev/codebase)](https://www.npmjs.com/package/@autodev/codebase)
6
6
  [![GitHub stars](https://img.shields.io/github/stars/anrgct/autodev-codebase)](https://github.com/anrgct/autodev-codebase)
7
7
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
8
 
9
- </div>
9
+ </p>
10
+
11
+ A vector embedding-based code semantic search tool with MCP server and multi-model integration. Can be used as a pure CLI tool. Supports Ollama for fully local embedding and reranking, enabling complete offline operation and privacy protection for your code repository.
10
12
 
11
13
  ```sh
14
+ # Semantic code search - Find code by meaning, not just keywords
12
15
  ╭─ ~/workspace/autodev-codebase
13
- ╰─❯ codebase --demo --search="user manage"
14
- Found 3 results in 2 files for: "user manage"
16
+ ╰─❯ codebase search "user manage" --demo
17
+ Found 20 results in 5 files for: "user manage"
15
18
 
16
19
  ==================================================
17
20
  File: "hello.js"
@@ -31,36 +34,44 @@ class UserManager {
31
34
  return this.users;
32
35
  }
33
36
  }
37
+ ……
34
38
 
35
- ==================================================
36
- File: "README.md" | 2 snippets
37
- ==================================================
38
- < md_h1 Demo Project > md_h2 Usage > md_h3 JavaScript Functions > (L16-20)
39
- ### JavaScript Functions
40
-
41
- - greetUser(name) - Greets a user by name
42
- - UserManager - Class for managing user data
43
-
44
- ─────
45
- < md_h1 Demo Project > md_h2 Search Examples > (L27-38)
46
- ## Search Examples
47
-
48
- Try searching for:
49
- - "greet user"
50
- - "process data"
51
- - "user management"
52
- - "batch processing"
53
- - "YOLO model"
54
- - "computer vision"
55
- - "object detection"
56
- - "model training"
39
+ # Call graph analysis - Trace function call relationships and execution paths
40
+ ╭─ ~/workspace/autodev-codebase
41
+ ╰─❯ codebase call --demo --query="app,addUser"
42
+ Connections between app, addUser:
43
+
44
+ Found 2 matching node(s):
45
+ - demo/app:L1-29
46
+ - demo/hello.UserManager.addUser:L12-15
47
+
48
+ Direct connections:
49
+ - demo/app:L1-29 demo/hello.UserManager.addUser:L12-15
50
+
51
+ Chains found:
52
+ - demo/app:L1-29 → demo/hello.UserManager.addUser:L12-15
57
53
 
54
+ # Code outline with AI summaries - Understand code structure at a glance
55
+ ╭─ ~/workspace/autodev-codebase
56
+ ╰─❯ codebase outline 'hello.js' --demo --summarize
57
+ # hello.js (23 lines)
58
+ └─ Defines a greeting function that logs a personalized hello message and returns a welcome string. Implements a UserManager class managing an array of users with methods to add users and retrieve the current user list. Exports both components for external use.
59
+
60
+ 2--5 | function greetUser
61
+ └─ Implements user greeting logic by logging a personalized hello message and returning a welcome message
62
+
63
+ 7--20 | class UserManager
64
+ └─ Manages user data with methods to add users to a list and retrieve all stored users
65
+
66
+ 12--15 | method addUser
67
+ └─ Adds a user to the users array and logs a confirmation message with the user's name.
58
68
  ```
59
- A vector embedding-based code semantic search tool with MCP server and multi-model integration. Can be used as a pure CLI tool. Supports Ollama for fully local embedding and reranking, enabling complete offline operation and privacy protection for your code repository.
69
+
60
70
 
61
71
  ## 🚀 Features
62
72
 
63
73
  - **🔍 Semantic Code Search**: Vector-based search using advanced embedding models
74
+ - **🔗 Call Graph Analysis**: Trace function call relationships and execution paths
64
75
  - **🌐 MCP Server**: HTTP-based MCP server with SSE and stdio adapters
65
76
  - **💻 Pure CLI Tool**: Standalone command-line interface without GUI dependencies
66
77
  - **⚙️ Layered Configuration**: CLI, project, and global config management
@@ -70,6 +81,8 @@ A vector embedding-based code semantic search tool with MCP server and multi-mod
70
81
  - **🔄 Multiple Providers**: OpenAI, Ollama, Jina, Gemini, Mistral, OpenRouter, Vercel
71
82
  - **📊 Real-time Watching**: Automatic index updates
72
83
  - **⚡ Batch Processing**: Efficient parallel processing
84
+ - **📝 Code Outline Extraction**: Generate structured code outlines with AI summaries
85
+ - **💨 Dependency Analysis Cache**: Intelligent caching for 10-50x faster re-analysis
73
86
 
74
87
  ## 📦 Installation
75
88
 
@@ -88,7 +101,7 @@ docker run -d -p 6333:6333 -p 6334:6334 --name qdrant qdrant/qdrant
88
101
  ### 3. Install
89
102
  ```bash
90
103
  npm install -g @autodev/codebase
91
- codebase --set-config embedderProvider=ollama,embedderModelId=nomic-embed-text
104
+ codebase config --set embedderProvider=ollama,embedderModelId=nomic-embed-text
92
105
  ```
93
106
 
94
107
  ## 🛠️ Quick Start
@@ -98,68 +111,125 @@ codebase --set-config embedderProvider=ollama,embedderModelId=nomic-embed-text
98
111
  # Creates a demo directory in current working directory for testing
99
112
 
100
113
  # Index & search
101
- codebase --demo --index
102
- codebase --demo --search="user greet"
114
+ codebase index --demo
115
+ codebase search "user greet" --demo
116
+
117
+ # Call graph analysis
118
+ codebase call --demo --query="app,addUser"
103
119
 
104
120
  # MCP server
105
- codebase --demo --serve
121
+ codebase index --serve --demo
106
122
  ```
107
123
 
108
124
  ## 📋 Commands
109
125
 
110
- ### Indexing & Search
126
+ ### 📝 Code Outlines
127
+ ```bash
128
+ # Extract code structure (functions, classes, methods)
129
+ codebase outline "src/**/*.ts"
130
+
131
+ # Generate code structure with AI summaries
132
+ codebase outline "src/**/*.ts" --summarize
133
+
134
+ # View only file-level summaries
135
+ codebase outline "src/**/*.ts" --summarize --title
136
+
137
+ # Clear summary cache
138
+ codebase outline --clear-summarize-cache
139
+ ```
140
+
141
+ ### 🔗 Call Graph Analysis
142
+ ```bash
143
+ # Analyze function call relationships
144
+ codebase call --query="functionA,functionB"
145
+
146
+ # Analyze specific directory
147
+ codebase call src/commands
148
+
149
+ # Export analysis results
150
+ codebase call --output=graph.json
151
+
152
+ # Open interactive graph viewer
153
+ codebase call --open
154
+
155
+ # Set analysis depth
156
+ codebase call --query="main" --depth=3
157
+
158
+ # Specify workspace path
159
+ codebase call --path=/my/project
160
+ ```
161
+
162
+ **Query Patterns:**
163
+ - **Exact match**: `--query="functionName"` or `--query="ClassName.methodName"`
164
+ - **Wildcards**: `*` (any characters), `?` (single character)
165
+ - Examples: `--query="get*"`, `--query="*User*"`, `--query="*.*.get*"`
166
+ - **Single pattern**: `--query="main"` - Shows dependency tree (what it calls, who calls it)
167
+ - Use `--depth` to control tree depth (default: 10)
168
+ - **Multiple patterns**: `--query="main,helper"` - Analyzes connections between functions
169
+ - Connection search depth is fixed at 10 (--depth is ignored)
170
+
171
+ **Supported Languages:**
172
+ - **TypeScript/JavaScript** (.ts, .tsx, .js, .jsx)
173
+ - **Python** (.py)
174
+ - **Java** (.java)
175
+ - **C/C++** (.c, .h, .cpp, .cc, .cxx, .hpp, .hxx, .c++)
176
+ - **C#** (.cs)
177
+ - **Rust** (.rs)
178
+ - **Go** (.go)
179
+
180
+ ### 🔍 Indexing & Search
111
181
  ```bash
112
182
  # Index the codebase
113
- codebase --index --path=/my/project --force
183
+ codebase index --path=/my/project --force
114
184
 
115
185
  # Search with filters
116
- codebase --search="error handling" --path-filters="src/**/*.ts"
186
+ codebase search "error handling" --path-filters="src/**/*.ts"
117
187
 
118
188
  # Search with custom limit and minimum score
119
- codebase --search="authentication" --limit=20 --min-score=0.7
120
- codebase --search="API" -l 30 -s 0.5
189
+ codebase search "authentication" --limit=20 --min-score=0.7
190
+ codebase search "API" -l 30 -S 0.5
121
191
 
122
192
  # Search in JSON format
123
- codebase --search="authentication" --json
193
+ codebase search "authentication" --json
124
194
 
125
195
  # Clear index data
126
- codebase --clear --path=/my/project
196
+ codebase index --clear-cache --path=/my/project
127
197
  ```
128
198
 
129
- ### MCP Server
199
+ ### 🌐 MCP Server
130
200
  ```bash
131
201
  # HTTP mode (recommended)
132
- codebase --serve --port=3001 --path=/my/project
202
+ codebase index --serve --port=3001 --path=/my/project
133
203
 
134
204
  # Stdio adapter
135
- codebase --stdio-adapter --server-url=http://localhost:3001/mcp
205
+ codebase stdio --server-url=http://localhost:3001/mcp
136
206
  ```
137
207
 
138
- ### Configuration
208
+ ### ⚙️ Configuration
139
209
  ```bash
140
210
  # View config
141
- codebase --get-config
142
- codebase --get-config embedderProvider --json
211
+ codebase config --get
212
+ codebase config --get embedderProvider --json
143
213
 
144
214
  # Set config
145
- codebase --set-config embedderProvider=ollama,embedderModelId=nomic-embed-text
146
- codebase --set-config --global qdrantUrl=http://localhost:6333
215
+ codebase config --set embedderProvider=ollama,embedderModelId=nomic-embed-text
216
+ codebase config --set --global qdrantUrl=http://localhost:6333
147
217
  ```
148
218
 
149
- ### Advanced Features
219
+ ### 🚀 Advanced Features
150
220
 
151
221
  #### 🔍 LLM-Powered Search Reranking
152
222
  Enable LLM reranking to dramatically improve search relevance:
153
223
 
154
224
  ```bash
155
225
  # Enable reranking with Ollama (recommended)
156
- codebase --set-config rerankerEnabled=true,rerankerProvider=ollama,rerankerOllamaModelId=qwen3-vl:4b-instruct
226
+ codebase config --set rerankerEnabled=true,rerankerProvider=ollama,rerankerOllamaModelId=qwen3-vl:4b-instruct
157
227
 
158
228
  # Or use OpenAI-compatible providers
159
- codebase --set-config rerankerEnabled=true,rerankerProvider=openai-compatible,rerankerOpenAiCompatibleModelId=deepseek-chat
229
+ codebase config --set rerankerEnabled=true,rerankerProvider=openai-compatible,rerankerOpenAiCompatibleModelId=deepseek-chat
160
230
 
161
231
  # Search with automatic reranking
162
- codebase --search="user authentication" # Results are automatically reranked by LLM
232
+ codebase search "user authentication" # Results are automatically reranked by LLM
163
233
  ```
164
234
 
165
235
  **Benefits:**
@@ -171,11 +241,22 @@ codebase --search="user authentication" # Results are automatically reranked by
171
241
  #### Path Filtering & Export
172
242
  ```bash
173
243
  # Path filtering with brace expansion and exclusions
174
- codebase --search="API" --path-filters="src/**/*.ts,lib/**/*.js"
175
- codebase --search="utils" --path-filters="{src,test}/**/*.ts"
244
+ codebase search "API" --path-filters="src/**/*.ts,lib/**/*.js"
245
+ codebase search "utils" --path-filters="{src,test}/**/*.ts"
246
+
247
+ # Export results in JSON format for scripts
248
+ codebase search "auth" --json
249
+ ```
250
+
251
+ #### Path Filtering & Export
252
+
253
+ ```bash
254
+ # Path filtering with brace expansion and exclusions
255
+ codebase search "API" --path-filters="src/**/*.ts,lib/**/*.js"
256
+ codebase search "utils" --path-filters="{src,test}/**/*.ts"
176
257
 
177
258
  # Export results in JSON format for scripts
178
- codebase --search="auth" --json
259
+ codebase search "auth" --json
179
260
  ```
180
261
 
181
262
  ## ⚙️ Configuration
@@ -186,7 +267,7 @@ codebase --search="auth" --json
186
267
  3. **Global Config** - `~/.autodev-cache/autodev-config.json`
187
268
  4. **Built-in Defaults** - Fallback values
188
269
 
189
- **Note:** CLI arguments provide runtime override for paths, logging, and operational behavior. For persistent configuration (embedderProvider, API keys, search parameters), use `--set-config` to save to config files.
270
+ **Note:** CLI arguments provide runtime override for paths, logging, and operational behavior. For persistent configuration (embedderProvider, API keys, search parameters), use `config --set` to save to config files.
190
271
 
191
272
  ### Common Config Examples
192
273
 
@@ -228,33 +309,45 @@ codebase --search="auth" --json
228
309
  | **Vector Store** | `qdrantUrl`, `qdrantApiKey` | Qdrant connection |
229
310
  | **Search** | `vectorSearchMinScore`, `vectorSearchMaxResults` | Search behavior |
230
311
  | **Reranker** | `rerankerEnabled`, `rerankerProvider` | Result reranking |
312
+ | **Summarizer** | `summarizerProvider`, `summarizerLanguage`, `summarizerBatchSize` | AI summary generation |
231
313
 
232
314
  **Key CLI Arguments:**
233
- - `--serve` / `--index` / `--search` - Core operations
234
- - `--get-config` / `--set-config` - Configuration management
315
+ - `index` - Index the codebase
316
+ - `search <query>` - Search the codebase (required positional argument)
317
+ - `outline <pattern>` - Extract code outlines (supports glob patterns)
318
+ - `call` - Analyze function call relationships and dependency graphs
319
+ - `stdio` - Start stdio adapter for MCP
320
+ - `config` - Manage configuration (use with --get or --set)
321
+ - `--serve` - Start MCP HTTP server (use with `index` command)
322
+ - `--summarize` - Generate AI summaries for code outlines
323
+ - `--dry-run` - Preview operations before execution
324
+ - `--title` - Show only file-level summaries
325
+ - `--clear-summarize-cache` - Clear all summary caches
235
326
  - `--path`, `--demo`, `--force` - Common options
236
327
  - `--limit` / `-l <number>` - Maximum number of search results (default: from config, max 50)
237
- - `--min-score` / `-s <number>` - Minimum similarity score for search results (0-1, default: from config)
328
+ - `--min-score` / `-S <number>` - Minimum similarity score for search results (0-1, default: from config)
329
+ - `--query <patterns>` - Query patterns for call graph analysis (comma-separated)
330
+ - `--output <file>` - Export analysis results to JSON file
331
+ - `--open` - Open interactive graph viewer
332
+ - `--depth <number>` - Set analysis depth for call graphs
238
333
  - `--help` - Show all available options
239
334
 
240
- For complete CLI reference, see [CONFIG.md](CONFIG.md).
241
-
242
335
  **Configuration Commands:**
243
336
  ```bash
244
337
  # View config
245
- codebase --get-config
246
- codebase --get-config --json
338
+ codebase config --get
339
+ codebase config --get --json
247
340
 
248
341
  # Set config (saves to file)
249
- codebase --set-config embedderProvider=ollama,embedderModelId=nomic-embed-text
250
- codebase --set-config --global embedderProvider=openai,embedderOpenAiApiKey=sk-xxx
342
+ codebase config --set embedderProvider=ollama,embedderModelId=nomic-embed-text
343
+ codebase config --set --global embedderProvider=openai,embedderOpenAiApiKey=sk-xxx
251
344
 
252
345
  # Use custom config file
253
- codebase --config=/path/to/config.json --get-config
254
- codebase --config=/path/to/config.json --set-config embedderProvider=ollama
346
+ codebase --config=/path/to/config.json config --get
347
+ codebase --config=/path/to/config.json config --set embedderProvider=ollama
255
348
 
256
349
  # Runtime override (paths, logging, etc.)
257
- codebase --index --path=/my/project --log-level=info --force
350
+ codebase index --path=/my/project --log-level=info --force
258
351
  ```
259
352
 
260
353
  For complete configuration reference, see [CONFIG.md](CONFIG.md).
@@ -263,7 +356,7 @@ For complete configuration reference, see [CONFIG.md](CONFIG.md).
263
356
 
264
357
  ### HTTP Streamable Mode (Recommended)
265
358
  ```bash
266
- codebase --serve --port=3001
359
+ codebase index --serve --port=3001
267
360
  ```
268
361
 
269
362
  **IDE Config:**
@@ -280,10 +373,10 @@ codebase --serve --port=3001
280
373
  ### Stdio Adapter
281
374
  ```bash
282
375
  # First start the MCP server in one terminal
283
- codebase --serve --port=3001
376
+ codebase index --serve --port=3001
284
377
 
285
378
  # Then connect via stdio adapter in another terminal (for IDEs that require stdio)
286
- codebase --stdio-adapter --server-url=http://localhost:3001/mcp
379
+ codebase stdio --server-url=http://localhost:3001/mcp
287
380
  ```
288
381
 
289
382
  **IDE Config:**
@@ -292,7 +385,7 @@ codebase --stdio-adapter --server-url=http://localhost:3001/mcp
292
385
  "mcpServers": {
293
386
  "codebase": {
294
387
  "command": "codebase",
295
- "args": ["stdio-adapter", "--server-url=http://localhost:3001/mcp"]
388
+ "args": ["stdio", "--server-url=http://localhost:3001/mcp"]
296
389
  }
297
390
  }
298
391
  }