embark-cli 1.3.4 → 1.3.6
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/.claude/settings.local.json +2 -1
- package/dist/cli-history.d.ts.map +1 -1
- package/dist/cli-history.js +22 -6
- package/dist/cli-history.js.map +1 -1
- package/dist/cli-search.d.ts.map +1 -1
- package/dist/cli-search.js +1 -1
- package/dist/cli-search.js.map +1 -1
- package/dist/cli-utils.d.ts +3 -0
- package/dist/cli-utils.d.ts.map +1 -1
- package/dist/cli-utils.js +52 -0
- package/dist/cli-utils.js.map +1 -1
- package/dist/embark-client.d.ts +7 -4
- package/dist/embark-client.d.ts.map +1 -1
- package/dist/embark-client.js +103 -7
- package/dist/embark-client.js.map +1 -1
- package/dist/skills/embark-research/SKILL.md +1 -0
- package/dist/stats-server.d.ts.map +1 -1
- package/dist/stats-server.js +9 -0
- package/dist/stats-server.js.map +1 -1
- package/docs/README.md +485 -0
- package/package.json +1 -1
package/docs/README.md
ADDED
|
@@ -0,0 +1,485 @@
|
|
|
1
|
+
# Embark CLI Documentation
|
|
2
|
+
|
|
3
|
+
Embark CLI is a command-line tool and MCP (Model Context Protocol) server that provides AI-powered semantic code search. It understands code meaning and context, not just keyword matching, making it ideal for exploring codebases and integrating with AI coding assistants.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Installation](#installation)
|
|
8
|
+
- [Authentication](#authentication)
|
|
9
|
+
- [CLI Commands](#cli-commands)
|
|
10
|
+
- [MCP Server Integration](#mcp-server-integration)
|
|
11
|
+
- [Agent Integration](#agent-integration)
|
|
12
|
+
- [Configuration](#configuration)
|
|
13
|
+
- [Skills](#skills)
|
|
14
|
+
- [Statistics Dashboard](#statistics-dashboard)
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
### From npm
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install -g embark-cli
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Verify Installation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
embark --version
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Authentication
|
|
31
|
+
|
|
32
|
+
Embark requires authentication to access the JetBrains AI API. There are two authentication methods:
|
|
33
|
+
|
|
34
|
+
### Method 1: JetBrains Account OAuth (Recommended)
|
|
35
|
+
|
|
36
|
+
On first use, Embark will open a browser window for you to log in with your JetBrains Account. The credentials are cached locally in `~/.embark/`.
|
|
37
|
+
|
|
38
|
+
**Requirements:**
|
|
39
|
+
- A JetBrains Account with an active license (IDE license, All Products Pack, etc.)
|
|
40
|
+
|
|
41
|
+
### Method 2: Direct JWT Token
|
|
42
|
+
|
|
43
|
+
Set the `GRAZIE_JWT_TOKEN` environment variable:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
export GRAZIE_JWT_TOKEN="your-token-here"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
This method is useful for CI/CD environments or when OAuth is not available.
|
|
50
|
+
|
|
51
|
+
## CLI Commands
|
|
52
|
+
|
|
53
|
+
### Search
|
|
54
|
+
|
|
55
|
+
Perform semantic code search in a repository.
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
embark search [options] <query> [path]
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Options:**
|
|
62
|
+
| Option | Description |
|
|
63
|
+
|--------|-------------|
|
|
64
|
+
| `-p, --path <path>` | Limit search to a directory or file |
|
|
65
|
+
| `-r, --repo <url>` | Git remote URL to search |
|
|
66
|
+
| `-R, --revision <rev>` | Git revision/branch/tag to search |
|
|
67
|
+
| `--json` | Output results as JSON |
|
|
68
|
+
| `--debug` | Output full HTTP request/response |
|
|
69
|
+
| `-h, --help` | Show help message |
|
|
70
|
+
|
|
71
|
+
**Examples:**
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# Basic search in current repository
|
|
75
|
+
embark search "authentication middleware"
|
|
76
|
+
|
|
77
|
+
# Search with path filter
|
|
78
|
+
embark search "user validation" src/auth
|
|
79
|
+
|
|
80
|
+
# Search specific repository
|
|
81
|
+
embark search --repo https://github.com/owner/repo.git "error handling"
|
|
82
|
+
|
|
83
|
+
# Search specific branch
|
|
84
|
+
embark search -R main "database connection pooling"
|
|
85
|
+
|
|
86
|
+
# Output as JSON for scripting
|
|
87
|
+
embark search --json "React modal component"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Query Tips:**
|
|
91
|
+
- Be descriptive: `"function that validates user email addresses"` > `"email"`
|
|
92
|
+
- Include context: `"error handling middleware for HTTP requests with logging"`
|
|
93
|
+
- Specify what you're looking for: `"React component that renders a modal dialog"`
|
|
94
|
+
|
|
95
|
+
### History
|
|
96
|
+
|
|
97
|
+
Search through commit history to understand how code evolved.
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
embark history [options] <query>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**Options:**
|
|
104
|
+
| Option | Description |
|
|
105
|
+
|--------|-------------|
|
|
106
|
+
| `-r, --repo <url>` | Git remote URL to search |
|
|
107
|
+
| `-R, --revision <rev>` | Git revision/branch/tag to search |
|
|
108
|
+
| `-n, --max-results <n>` | Maximum number of results (default: 10) |
|
|
109
|
+
| `--min-score <score>` | Minimum similarity score (default: 0.0) |
|
|
110
|
+
| `--json` | Output results as JSON |
|
|
111
|
+
| `--debug` | Output full HTTP request/response |
|
|
112
|
+
| `-h, --help` | Show help message |
|
|
113
|
+
|
|
114
|
+
**Examples:**
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# Find commits related to a feature
|
|
118
|
+
embark history "add user authentication"
|
|
119
|
+
|
|
120
|
+
# Get more results
|
|
121
|
+
embark history -n 20 "refactor database queries"
|
|
122
|
+
|
|
123
|
+
# Search specific repository
|
|
124
|
+
embark history --repo https://github.com/owner/repo.git "fix memory leak"
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
**Output includes:**
|
|
128
|
+
- Commit hash and timestamp
|
|
129
|
+
- Author name
|
|
130
|
+
- Commit message (first line)
|
|
131
|
+
- Files changed in the commit
|
|
132
|
+
- Similarity score
|
|
133
|
+
|
|
134
|
+
### Index
|
|
135
|
+
|
|
136
|
+
Schedule repository indexing for semantic search.
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
embark index [options]
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
**Modes:**
|
|
143
|
+
| Mode | Description |
|
|
144
|
+
|------|-------------|
|
|
145
|
+
| `local` (default) | Run indexing locally |
|
|
146
|
+
| `--remote` | Schedule remote indexing via Embark API |
|
|
147
|
+
| `--mock` | Run mock indexing for testing |
|
|
148
|
+
|
|
149
|
+
**Options:**
|
|
150
|
+
| Option | Description |
|
|
151
|
+
|--------|-------------|
|
|
152
|
+
| `-r, --repo <url>` | Git remote URL to index |
|
|
153
|
+
| `-R, --revision <rev>` | Revision/branch/tag to index |
|
|
154
|
+
| `--reschedule-period <int>` | Reschedule period for recurring jobs |
|
|
155
|
+
| `--debug` | Output full HTTP request/response |
|
|
156
|
+
| `-h, --help` | Show help message |
|
|
157
|
+
|
|
158
|
+
**Examples:**
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
# Local indexing (current directory)
|
|
162
|
+
embark index
|
|
163
|
+
|
|
164
|
+
# Remote indexing
|
|
165
|
+
embark index --remote
|
|
166
|
+
|
|
167
|
+
# Remote indexing for specific repository
|
|
168
|
+
embark index --remote --repo https://github.com/owner/repo.git
|
|
169
|
+
|
|
170
|
+
# Schedule recurring indexing
|
|
171
|
+
embark index --remote --revision main --reschedule-period 24
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Install
|
|
175
|
+
|
|
176
|
+
Install Embark integration for AI coding agents.
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
embark install [options]
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
**Options:**
|
|
183
|
+
| Option | Description |
|
|
184
|
+
|--------|-------------|
|
|
185
|
+
| `--agent <name>` | Specific agent: `claude`, `codex`, `amp`, `gemini` |
|
|
186
|
+
| `--scope <scope>` | Installation scope: `global` (default) or `project` |
|
|
187
|
+
| `--skills-only` | Only install skills, skip hooks |
|
|
188
|
+
| `--hooks-only` | Only install hooks, skip skills |
|
|
189
|
+
| `-h, --help` | Show help message |
|
|
190
|
+
|
|
191
|
+
**Examples:**
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
# Interactive mode - detect and install for all found agents
|
|
195
|
+
embark install
|
|
196
|
+
|
|
197
|
+
# Install for specific agent
|
|
198
|
+
embark install --agent claude
|
|
199
|
+
|
|
200
|
+
# Install in project-local config
|
|
201
|
+
embark install --scope project
|
|
202
|
+
|
|
203
|
+
# Install only skills (no hooks)
|
|
204
|
+
embark install --skills-only
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
**Supported Agents:**
|
|
208
|
+
- **Claude Code** (`~/.claude/`)
|
|
209
|
+
- **OpenAI Codex** (`~/.codex/`)
|
|
210
|
+
- **Amp** (`~/.amp/`)
|
|
211
|
+
- **Gemini Code Assist** (`~/.gemini/`)
|
|
212
|
+
|
|
213
|
+
### Stats
|
|
214
|
+
|
|
215
|
+
Open the statistics dashboard in your browser.
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
embark stats [--port <port>]
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
## MCP Server Integration
|
|
222
|
+
|
|
223
|
+
Embark runs as an MCP (Model Context Protocol) server, allowing AI coding assistants to use semantic code search.
|
|
224
|
+
|
|
225
|
+
### Starting the MCP Server
|
|
226
|
+
|
|
227
|
+
Simply run `embark` without any command:
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
embark
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
The server communicates via stdio and provides the `semantic_code_search` tool to MCP clients.
|
|
234
|
+
|
|
235
|
+
### Available MCP Tools
|
|
236
|
+
|
|
237
|
+
#### `semantic_code_search`
|
|
238
|
+
|
|
239
|
+
Performs AI-powered semantic code search.
|
|
240
|
+
|
|
241
|
+
**Parameters:**
|
|
242
|
+
| Parameter | Type | Required | Description |
|
|
243
|
+
|-----------|------|----------|-------------|
|
|
244
|
+
| `text` | string | Yes | Descriptive search query |
|
|
245
|
+
| `pathFilter` | string | No | Path to restrict search scope |
|
|
246
|
+
|
|
247
|
+
**Example usage by an AI agent:**
|
|
248
|
+
|
|
249
|
+
```json
|
|
250
|
+
{
|
|
251
|
+
"name": "semantic_code_search",
|
|
252
|
+
"arguments": {
|
|
253
|
+
"text": "function that validates user email addresses and returns boolean",
|
|
254
|
+
"pathFilter": "src/auth"
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### Configuring MCP Clients
|
|
260
|
+
|
|
261
|
+
#### Claude Desktop
|
|
262
|
+
|
|
263
|
+
Add to `~/.claude/claude_desktop_config.json`:
|
|
264
|
+
|
|
265
|
+
```json
|
|
266
|
+
{
|
|
267
|
+
"mcpServers": {
|
|
268
|
+
"embark": {
|
|
269
|
+
"command": "embark",
|
|
270
|
+
"env": {
|
|
271
|
+
"REPOSITORY_GIT_REMOTE_URL": "https://github.com/your/repo.git"
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
#### Claude Code
|
|
279
|
+
|
|
280
|
+
Add to `~/.claude/settings.json`:
|
|
281
|
+
|
|
282
|
+
```json
|
|
283
|
+
{
|
|
284
|
+
"mcpServers": {
|
|
285
|
+
"embark": {
|
|
286
|
+
"command": "embark"
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
## Agent Integration
|
|
293
|
+
|
|
294
|
+
Use `embark install` to automatically configure AI coding agents with Embark integration.
|
|
295
|
+
|
|
296
|
+
### What Gets Installed
|
|
297
|
+
|
|
298
|
+
1. **MCP Server Configuration** - Adds Embark as an MCP server
|
|
299
|
+
2. **Skills** - Adds `/embark-research` and `/embark-review` slash commands
|
|
300
|
+
3. **Hooks** - Adds session start/end hooks to trigger indexing
|
|
301
|
+
|
|
302
|
+
### Manual Configuration
|
|
303
|
+
|
|
304
|
+
#### Claude Code
|
|
305
|
+
|
|
306
|
+
1. Add to `~/.claude/settings.json`:
|
|
307
|
+
|
|
308
|
+
```json
|
|
309
|
+
{
|
|
310
|
+
"mcpServers": {
|
|
311
|
+
"embark-mcp": {
|
|
312
|
+
"command": "embark"
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
2. Copy skills from `src/skills/` to `~/.claude/skills/`
|
|
319
|
+
|
|
320
|
+
#### Codex
|
|
321
|
+
|
|
322
|
+
Add to `~/.codex/config.json`:
|
|
323
|
+
|
|
324
|
+
```json
|
|
325
|
+
{
|
|
326
|
+
"mcpServers": {
|
|
327
|
+
"embark-mcp": {
|
|
328
|
+
"command": "embark"
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
## Configuration
|
|
335
|
+
|
|
336
|
+
Embark is configured through environment variables.
|
|
337
|
+
|
|
338
|
+
### Environment Variables
|
|
339
|
+
|
|
340
|
+
| Variable | Description | Default |
|
|
341
|
+
|----------|-------------|---------|
|
|
342
|
+
| `JETBRAINS_AI_URL` | Embark API base URL | `https://api.jetbrains.ai` |
|
|
343
|
+
| `REPOSITORY_GIT_REMOTE_URL` | Default repository to search | Auto-detected from git |
|
|
344
|
+
| `REPOSITORY_REVISION` | Default revision/branch | `HEAD` |
|
|
345
|
+
| `WORKING_DIR` | Working directory for local operations | Current directory |
|
|
346
|
+
| `GRAZIE_JWT_TOKEN` | Direct JWT token (skips OAuth) | None |
|
|
347
|
+
| `TYPE_TOKEN` | Token type: `USER` or `APPLICATION` | `USER` |
|
|
348
|
+
| `ENABLE_REMOTE_LOGS` | Enable remote logging | `false` |
|
|
349
|
+
| `INCLUDE_REPOSITORY_URLS` | Comma-separated list of additional repos | None |
|
|
350
|
+
| `EXCLUDE_REPOSITORY_URLS` | Comma-separated list of repos to exclude | None |
|
|
351
|
+
|
|
352
|
+
### Multi-Repository Search
|
|
353
|
+
|
|
354
|
+
Embark automatically discovers Git repositories from MCP client roots. You can also configure multiple repositories:
|
|
355
|
+
|
|
356
|
+
```bash
|
|
357
|
+
# Include additional repositories
|
|
358
|
+
export INCLUDE_REPOSITORY_URLS="https://github.com/org/repo1.git,https://github.com/org/repo2.git"
|
|
359
|
+
|
|
360
|
+
# Exclude specific repositories
|
|
361
|
+
export EXCLUDE_REPOSITORY_URLS="https://github.com/org/legacy-repo.git"
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
## Skills
|
|
365
|
+
|
|
366
|
+
Skills are pre-configured workflows for common tasks. After running `embark install`, these are available as slash commands.
|
|
367
|
+
|
|
368
|
+
### `/embark-research`
|
|
369
|
+
|
|
370
|
+
Use this skill to research and understand unfamiliar codebases.
|
|
371
|
+
|
|
372
|
+
**When to use:**
|
|
373
|
+
- Understanding unfamiliar codebases
|
|
374
|
+
- Finding implementations or definitions
|
|
375
|
+
- Before making changes to understand context
|
|
376
|
+
|
|
377
|
+
**Example workflow:**
|
|
378
|
+
|
|
379
|
+
```bash
|
|
380
|
+
# Start broad
|
|
381
|
+
embark search "user authentication login"
|
|
382
|
+
|
|
383
|
+
# Narrow down
|
|
384
|
+
embark search -p src/auth "JWT token validation"
|
|
385
|
+
|
|
386
|
+
# Check history
|
|
387
|
+
embark history "add JWT authentication"
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
### `/embark-review`
|
|
391
|
+
|
|
392
|
+
Use this skill to review code changes using semantic search.
|
|
393
|
+
|
|
394
|
+
**When to use:**
|
|
395
|
+
- Before committing changes
|
|
396
|
+
- Reviewing pull requests
|
|
397
|
+
- Understanding impact of changes
|
|
398
|
+
|
|
399
|
+
**Example workflow:**
|
|
400
|
+
|
|
401
|
+
```bash
|
|
402
|
+
# See what's changed
|
|
403
|
+
git diff --staged
|
|
404
|
+
|
|
405
|
+
# Find similar patterns
|
|
406
|
+
embark search "authentication middleware pattern"
|
|
407
|
+
|
|
408
|
+
# Find callers
|
|
409
|
+
embark search "uses auth middleware to protect routes"
|
|
410
|
+
|
|
411
|
+
# Check for related bug fixes
|
|
412
|
+
embark history "fix auth middleware"
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
## Statistics Dashboard
|
|
416
|
+
|
|
417
|
+
Embark tracks usage statistics locally in `~/.embark/stats/`.
|
|
418
|
+
|
|
419
|
+
### Viewing Statistics
|
|
420
|
+
|
|
421
|
+
```bash
|
|
422
|
+
# Open dashboard in browser
|
|
423
|
+
embark stats
|
|
424
|
+
|
|
425
|
+
# Start server on specific port
|
|
426
|
+
embark stats --port 8080
|
|
427
|
+
|
|
428
|
+
# Start server without opening browser
|
|
429
|
+
embark stats-server --port 8080
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
### Dashboard Features
|
|
433
|
+
|
|
434
|
+
- **Total Searches** - Count of all search operations
|
|
435
|
+
- **Semantic/Dependency/History Searches** - Breakdown by search type
|
|
436
|
+
- **Estimated Tokens** - Query token estimates
|
|
437
|
+
- **Average Duration** - Search performance metrics
|
|
438
|
+
- **Repository Usage** - Searches per repository
|
|
439
|
+
- **Client Types** - Usage by different AI agents
|
|
440
|
+
- **Error Tracking** - Categorized error counts
|
|
441
|
+
|
|
442
|
+
### Data Location
|
|
443
|
+
|
|
444
|
+
Statistics are stored as daily JSON files in `~/.embark/stats/`:
|
|
445
|
+
|
|
446
|
+
```
|
|
447
|
+
~/.embark/stats/
|
|
448
|
+
2024-01-15.json
|
|
449
|
+
2024-01-16.json
|
|
450
|
+
...
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
## Troubleshooting
|
|
454
|
+
|
|
455
|
+
### Debug Mode
|
|
456
|
+
|
|
457
|
+
Add `--debug` to any command to see full HTTP request/response details:
|
|
458
|
+
|
|
459
|
+
```bash
|
|
460
|
+
embark search --debug "authentication"
|
|
461
|
+
embark history --debug "fix bug"
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
### Logs
|
|
465
|
+
|
|
466
|
+
Local logs are stored in `~/.embark/logs/`. Check these for detailed error information.
|
|
467
|
+
|
|
468
|
+
### Common Issues
|
|
469
|
+
|
|
470
|
+
**"Repository not found" (404 error)**
|
|
471
|
+
- The repository may not be indexed yet
|
|
472
|
+
- Run `embark index --remote` to schedule indexing
|
|
473
|
+
|
|
474
|
+
**"No valid license found"**
|
|
475
|
+
- Ensure you have an active JetBrains license
|
|
476
|
+
- Try logging out and back in: delete `~/.embark/jba-account.json`
|
|
477
|
+
|
|
478
|
+
**"No repositories available"**
|
|
479
|
+
- Set `REPOSITORY_GIT_REMOTE_URL` environment variable
|
|
480
|
+
- Or run from within a Git repository
|
|
481
|
+
|
|
482
|
+
### Getting Help
|
|
483
|
+
|
|
484
|
+
- Check the [GitHub Issues](https://github.com/jetbrains/embark-mcp/issues)
|
|
485
|
+
- Run `embark <command> --help` for command-specific help
|