embark-cli 1.3.0 → 1.3.2
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.json +6 -4
- package/dist/agents/claude.d.ts.map +1 -1
- package/dist/agents/claude.js +9 -8
- package/dist/agents/claude.js.map +1 -1
- package/dist/cli-index.d.ts.map +1 -1
- package/dist/cli-index.js +44 -6
- package/dist/cli-index.js.map +1 -1
- package/dist/embark-client.d.ts.map +1 -1
- package/dist/embark-client.js +53 -0
- package/dist/embark-client.js.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts +3 -0
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +28 -0
- package/dist/logger.js.map +1 -1
- package/dist/skills/embark-research/SKILL.md +68 -0
- package/dist/skills/embark-review/SKILL.md +82 -0
- package/dist/skills/index.d.ts +2 -2
- package/dist/skills/index.d.ts.map +1 -1
- package/dist/skills/index.js +41 -146
- package/dist/skills/index.js.map +1 -1
- package/dist/stats-server.d.ts.map +1 -1
- package/dist/stats-server.js +123 -9
- package/dist/stats-server.js.map +1 -1
- package/dist/stats.d.ts +23 -1
- package/dist/stats.d.ts.map +1 -1
- package/dist/stats.js +18 -0
- package/dist/stats.js.map +1 -1
- package/package.json +2 -2
- package/SKILL.md +0 -59
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: embark-research
|
|
3
|
+
context: fork
|
|
4
|
+
agent: Explore
|
|
5
|
+
description: "Research and understand unfamiliar codebases using semantic search with `embark search` and `embark history`"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
You need to gather all context for task $ARGUMENTS thoroughly.
|
|
9
|
+
|
|
10
|
+
## When to Use
|
|
11
|
+
|
|
12
|
+
- Understanding unfamiliar codebases or locating specific functionality
|
|
13
|
+
- Finding implementations, definitions, or usage patterns
|
|
14
|
+
- Identifying code related to specific features or concepts
|
|
15
|
+
- Before making changes to understand the context and impact
|
|
16
|
+
|
|
17
|
+
## Tools Available
|
|
18
|
+
|
|
19
|
+
### `embark search`
|
|
20
|
+
|
|
21
|
+
Semantic code search that finds code by meaning, not just exact keywords.
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
embark search "<descriptive query>" [path]
|
|
25
|
+
embark search -p <path> "<query>"
|
|
26
|
+
embark search --json "<query>" # For structured output
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**Query Tips:**
|
|
30
|
+
- Be descriptive: "function that validates user email addresses" > "email"
|
|
31
|
+
- Include context: "error handling middleware for HTTP requests with logging"
|
|
32
|
+
- Specify what you're looking for: "React component that renders a modal dialog"
|
|
33
|
+
|
|
34
|
+
### `embark history`
|
|
35
|
+
|
|
36
|
+
Search through commit messages and changes to understand how code evolved.
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
embark history "<query>"
|
|
40
|
+
embark history -n 20 "<query>" # Get more results
|
|
41
|
+
embark history --json "<query>" # For structured output
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Use Cases:**
|
|
45
|
+
- Find when a feature was added: "add user authentication"
|
|
46
|
+
- Find bug fixes: "fix memory leak in worker"
|
|
47
|
+
- Understand refactoring: "refactor database connection"
|
|
48
|
+
|
|
49
|
+
## Research Workflow
|
|
50
|
+
|
|
51
|
+
1. **Start broad**: Use `embark search` with general terms to understand the landscape
|
|
52
|
+
2. **Narrow down**: Add path filters (`-p`) once you identify relevant directories
|
|
53
|
+
3. **Check history**: Use `embark history` to understand why code was written a certain way
|
|
54
|
+
4. **Read the code**: Once you find relevant files, read them to understand the details
|
|
55
|
+
|
|
56
|
+
## Example Session
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# Find authentication-related code
|
|
60
|
+
embark search "user authentication login"
|
|
61
|
+
|
|
62
|
+
# Narrow to specific directory
|
|
63
|
+
embark search -p src/auth "JWT token validation"
|
|
64
|
+
|
|
65
|
+
# Understand how auth evolved
|
|
66
|
+
embark history "add JWT authentication"
|
|
67
|
+
embark history "fix authentication bug"
|
|
68
|
+
```
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: embark-review
|
|
3
|
+
description: "Use this skill to review code changes using semantic search to understand context and impact"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## When to Use
|
|
7
|
+
|
|
8
|
+
- Before committing changes to understand what you're about to commit
|
|
9
|
+
- Reviewing pull requests or branches
|
|
10
|
+
- Understanding the impact of changes on the rest of the codebase
|
|
11
|
+
|
|
12
|
+
## Review Workflow
|
|
13
|
+
|
|
14
|
+
### 1. Check Current Changes
|
|
15
|
+
|
|
16
|
+
First, see what's changed:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
git status
|
|
20
|
+
git diff # Unstaged changes
|
|
21
|
+
git diff --staged # Staged changes
|
|
22
|
+
git diff main...HEAD # All changes on current branch
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### 2. Understand Changed Code Context
|
|
26
|
+
|
|
27
|
+
For each significantly changed file, use semantic search to understand:
|
|
28
|
+
|
|
29
|
+
- **Similar patterns**: Find similar code elsewhere that might need the same change
|
|
30
|
+
- **Callers**: Find code that calls the modified functions
|
|
31
|
+
- **Dependencies**: Find code that the modified code depends on
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Find similar patterns
|
|
35
|
+
embark search "<code chunk that was changed>"
|
|
36
|
+
|
|
37
|
+
# Find callers of a modified function
|
|
38
|
+
embark search "calls to <function name> to understand impact"
|
|
39
|
+
|
|
40
|
+
# Find related test files
|
|
41
|
+
embark search -p test "tests for <feature being modified>"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### 3. Check Historical Context
|
|
45
|
+
|
|
46
|
+
Understand why the code was written this way:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# Find related commits
|
|
50
|
+
embark history "changes to <feature name>"
|
|
51
|
+
|
|
52
|
+
# Find bug fixes in this area
|
|
53
|
+
embark history "fix <area being modified>"
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### 4. Review Checklist
|
|
57
|
+
|
|
58
|
+
For each change, verify:
|
|
59
|
+
|
|
60
|
+
- [ ] The change is consistent with similar patterns in the codebase
|
|
61
|
+
- [ ] All callers of modified functions will still work correctly
|
|
62
|
+
- [ ] Related tests exist and cover the changes
|
|
63
|
+
- [ ] The change doesn't reintroduce previously fixed bugs
|
|
64
|
+
|
|
65
|
+
## Example Session
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# See what's changed
|
|
69
|
+
git diff --staged
|
|
70
|
+
|
|
71
|
+
# For a change to auth middleware, find similar patterns
|
|
72
|
+
embark search "authentication middleware pattern"
|
|
73
|
+
|
|
74
|
+
# Find what calls this middleware
|
|
75
|
+
embark search "uses auth middleware to protect routes"
|
|
76
|
+
|
|
77
|
+
# Check if there were related bug fixes
|
|
78
|
+
embark history "fix auth middleware"
|
|
79
|
+
|
|
80
|
+
# Find related tests
|
|
81
|
+
embark search -p test "auth middleware test"
|
|
82
|
+
```
|
package/dist/skills/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const EMBARK_RESEARCH_SKILL
|
|
2
|
-
export declare const EMBARK_REVIEW_SKILL
|
|
1
|
+
export declare const EMBARK_RESEARCH_SKILL: string;
|
|
2
|
+
export declare const EMBARK_REVIEW_SKILL: string;
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/skills/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/skills/index.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,qBAAqB,QAA+B,CAAC;AAClE,eAAO,MAAM,mBAAmB,QAA6B,CAAC"}
|
package/dist/skills/index.js
CHANGED
|
@@ -1,150 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.EMBARK_REVIEW_SKILL = exports.EMBARK_RESEARCH_SKILL = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
- Identifying code related to specific features or concepts
|
|
13
|
-
- Before making changes to understand the context and impact
|
|
14
|
-
|
|
15
|
-
## Tools Available
|
|
16
|
-
|
|
17
|
-
### \`embark search\`
|
|
18
|
-
|
|
19
|
-
Semantic code search that finds code by meaning, not just exact keywords.
|
|
20
|
-
|
|
21
|
-
\`\`\`bash
|
|
22
|
-
embark search "<descriptive query>" [path]
|
|
23
|
-
embark search -p <path> "<query>"
|
|
24
|
-
embark search --json "<query>" # For structured output
|
|
25
|
-
\`\`\`
|
|
26
|
-
|
|
27
|
-
**Query Tips:**
|
|
28
|
-
- Be descriptive: "function that validates user email addresses" > "email"
|
|
29
|
-
- Include context: "error handling middleware for HTTP requests with logging"
|
|
30
|
-
- Specify what you're looking for: "React component that renders a modal dialog"
|
|
31
|
-
|
|
32
|
-
### \`embark history\`
|
|
33
|
-
|
|
34
|
-
Search through commit messages and changes to understand how code evolved.
|
|
35
|
-
|
|
36
|
-
\`\`\`bash
|
|
37
|
-
embark history "<query>"
|
|
38
|
-
embark history -n 20 "<query>" # Get more results
|
|
39
|
-
embark history --json "<query>" # For structured output
|
|
40
|
-
\`\`\`
|
|
41
|
-
|
|
42
|
-
**Use Cases:**
|
|
43
|
-
- Find when a feature was added: "add user authentication"
|
|
44
|
-
- Find bug fixes: "fix memory leak in worker"
|
|
45
|
-
- Understand refactoring: "refactor database connection"
|
|
46
|
-
|
|
47
|
-
## Research Workflow
|
|
48
|
-
|
|
49
|
-
1. **Start broad**: Use \`embark search\` with general terms to understand the landscape
|
|
50
|
-
2. **Narrow down**: Add path filters (\`-p\`) once you identify relevant directories
|
|
51
|
-
3. **Check history**: Use \`embark history\` to understand why code was written a certain way
|
|
52
|
-
4. **Read the code**: Once you find relevant files, read them to understand the details
|
|
53
|
-
|
|
54
|
-
## Example Session
|
|
55
|
-
|
|
56
|
-
\`\`\`bash
|
|
57
|
-
# Find authentication-related code
|
|
58
|
-
embark search "user authentication login"
|
|
59
|
-
|
|
60
|
-
# Narrow to specific directory
|
|
61
|
-
embark search -p src/auth "JWT token validation"
|
|
62
|
-
|
|
63
|
-
# Understand how auth evolved
|
|
64
|
-
embark history "add JWT authentication"
|
|
65
|
-
embark history "fix authentication bug"
|
|
66
|
-
\`\`\`
|
|
67
|
-
`;
|
|
68
|
-
exports.EMBARK_REVIEW_SKILL = `# Embark Review
|
|
69
|
-
|
|
70
|
-
Use this skill to review code changes using semantic search to understand context and impact.
|
|
71
|
-
|
|
72
|
-
## When to Use
|
|
73
|
-
|
|
74
|
-
- Before committing changes to understand what you're about to commit
|
|
75
|
-
- Reviewing pull requests or branches
|
|
76
|
-
- Understanding the impact of changes on the rest of the codebase
|
|
77
|
-
|
|
78
|
-
## Review Workflow
|
|
79
|
-
|
|
80
|
-
### 1. Check Current Changes
|
|
81
|
-
|
|
82
|
-
First, see what's changed:
|
|
83
|
-
|
|
84
|
-
\`\`\`bash
|
|
85
|
-
git status
|
|
86
|
-
git diff # Unstaged changes
|
|
87
|
-
git diff --staged # Staged changes
|
|
88
|
-
git diff main...HEAD # All changes on current branch
|
|
89
|
-
\`\`\`
|
|
90
|
-
|
|
91
|
-
### 2. Understand Changed Code Context
|
|
92
|
-
|
|
93
|
-
For each significantly changed file, use semantic search to understand:
|
|
94
|
-
|
|
95
|
-
- **Similar patterns**: Find similar code elsewhere that might need the same change
|
|
96
|
-
- **Callers**: Find code that calls the modified functions
|
|
97
|
-
- **Dependencies**: Find code that the modified code depends on
|
|
98
|
-
|
|
99
|
-
\`\`\`bash
|
|
100
|
-
# Find similar patterns
|
|
101
|
-
embark search "similar implementation to <describe the change>"
|
|
102
|
-
|
|
103
|
-
# Find callers of a modified function
|
|
104
|
-
embark search "calls to <function name> to understand impact"
|
|
105
|
-
|
|
106
|
-
# Find related test files
|
|
107
|
-
embark search -p test "tests for <feature being modified>"
|
|
108
|
-
\`\`\`
|
|
109
|
-
|
|
110
|
-
### 3. Check Historical Context
|
|
111
|
-
|
|
112
|
-
Understand why the code was written this way:
|
|
113
|
-
|
|
114
|
-
\`\`\`bash
|
|
115
|
-
# Find related commits
|
|
116
|
-
embark history "changes to <feature name>"
|
|
117
|
-
|
|
118
|
-
# Find bug fixes in this area
|
|
119
|
-
embark history "fix <area being modified>"
|
|
120
|
-
\`\`\`
|
|
121
|
-
|
|
122
|
-
### 4. Review Checklist
|
|
123
|
-
|
|
124
|
-
For each change, verify:
|
|
125
|
-
|
|
126
|
-
- [ ] The change is consistent with similar patterns in the codebase
|
|
127
|
-
- [ ] All callers of modified functions will still work correctly
|
|
128
|
-
- [ ] Related tests exist and cover the changes
|
|
129
|
-
- [ ] The change doesn't reintroduce previously fixed bugs
|
|
130
|
-
|
|
131
|
-
## Example Session
|
|
132
|
-
|
|
133
|
-
\`\`\`bash
|
|
134
|
-
# See what's changed
|
|
135
|
-
git diff --staged
|
|
136
|
-
|
|
137
|
-
# For a change to auth middleware, find similar patterns
|
|
138
|
-
embark search "authentication middleware pattern"
|
|
139
|
-
|
|
140
|
-
# Find what calls this middleware
|
|
141
|
-
embark search "uses auth middleware to protect routes"
|
|
142
|
-
|
|
143
|
-
# Check if there were related bug fixes
|
|
144
|
-
embark history "fix auth middleware"
|
|
145
|
-
|
|
146
|
-
# Find related tests
|
|
147
|
-
embark search -p test "auth middleware test"
|
|
148
|
-
\`\`\`
|
|
149
|
-
`;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
function readSkill(skillName) {
|
|
40
|
+
const skillPath = path.join(__dirname, skillName, 'SKILL.md');
|
|
41
|
+
return fs.readFileSync(skillPath, 'utf-8');
|
|
42
|
+
}
|
|
43
|
+
exports.EMBARK_RESEARCH_SKILL = readSkill('embark-research');
|
|
44
|
+
exports.EMBARK_REVIEW_SKILL = readSkill('embark-review');
|
|
150
45
|
//# sourceMappingURL=index.js.map
|
package/dist/skills/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/skills/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/skills/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,SAAS,SAAS,CAAC,SAAiB;IAClC,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;IAC9D,OAAO,EAAE,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AAC7C,CAAC;AAEY,QAAA,qBAAqB,GAAG,SAAS,CAAC,iBAAiB,CAAC,CAAC;AACrD,QAAA,mBAAmB,GAAG,SAAS,CAAC,eAAe,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stats-server.d.ts","sourceRoot":"","sources":["../src/stats-server.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"stats-server.d.ts","sourceRoot":"","sources":["../src/stats-server.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAoExB,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAiCzE"}
|
package/dist/stats-server.js
CHANGED
|
@@ -54,7 +54,13 @@ function buildStatsSummary() {
|
|
|
54
54
|
acc.totalDependencySearches += day.dependencySearchCount;
|
|
55
55
|
acc.totalEstimatedTokens += day.estimatedTokens;
|
|
56
56
|
acc.totalDurationMs += day.totalDurationMs;
|
|
57
|
+
acc.totalIndexings += day.indexingCount;
|
|
58
|
+
acc.totalIndexingDurationMs += day.indexingTotalDurationMs;
|
|
57
59
|
acc.totalErrors += day.errorCount;
|
|
60
|
+
acc.errorCategories.notFound += day.errorCategories.notFound;
|
|
61
|
+
acc.errorCategories.timeout += day.errorCategories.timeout;
|
|
62
|
+
acc.errorCategories.serverError += day.errorCategories.serverError;
|
|
63
|
+
acc.errorCategories.other += day.errorCategories.other;
|
|
58
64
|
Object.entries(day.errorStatusCounts).forEach(([status, count]) => {
|
|
59
65
|
acc.errorStatusCounts[status] = (acc.errorStatusCounts[status] || 0) + count;
|
|
60
66
|
});
|
|
@@ -67,12 +73,19 @@ function buildStatsSummary() {
|
|
|
67
73
|
totalEstimatedTokens: 0,
|
|
68
74
|
totalDurationMs: 0,
|
|
69
75
|
averageDurationMs: 0,
|
|
76
|
+
totalIndexings: 0,
|
|
77
|
+
totalIndexingDurationMs: 0,
|
|
78
|
+
averageIndexingDurationMs: 0,
|
|
70
79
|
totalErrors: 0,
|
|
71
80
|
errorStatusCounts: {},
|
|
81
|
+
errorCategories: { notFound: 0, timeout: 0, serverError: 0, other: 0 },
|
|
72
82
|
});
|
|
73
83
|
totals.averageDurationMs = totals.totalSearches === 0
|
|
74
84
|
? 0
|
|
75
85
|
: totals.totalDurationMs / totals.totalSearches;
|
|
86
|
+
totals.averageIndexingDurationMs = totals.totalIndexings === 0
|
|
87
|
+
? 0
|
|
88
|
+
: totals.totalIndexingDurationMs / totals.totalIndexings;
|
|
76
89
|
const allEvents = days.flatMap((day) => day.events);
|
|
77
90
|
const allErrorEvents = allEvents.filter((event) => event.type === 'error');
|
|
78
91
|
const recentEvents = allEvents
|
|
@@ -94,16 +107,58 @@ function buildStatsSummary() {
|
|
|
94
107
|
recentErrors,
|
|
95
108
|
};
|
|
96
109
|
}
|
|
110
|
+
function categorizeError(event) {
|
|
111
|
+
// Check for timeout errors
|
|
112
|
+
if (event.type === 'error') {
|
|
113
|
+
const message = (event.message || '').toLowerCase();
|
|
114
|
+
const contextStr = event.context ? JSON.stringify(event.context).toLowerCase() : '';
|
|
115
|
+
// Check for timeout
|
|
116
|
+
if (message.includes('timed out') || message.includes('timeout') ||
|
|
117
|
+
contextStr.includes('timed out') || contextStr.includes('timeout') ||
|
|
118
|
+
contextStr.includes('-32001')) {
|
|
119
|
+
return 'timeout';
|
|
120
|
+
}
|
|
121
|
+
// Check for 404
|
|
122
|
+
if (message.includes('404') || message.includes('not found') ||
|
|
123
|
+
contextStr.includes('404') || contextStr.includes('"status":404')) {
|
|
124
|
+
return 'notFound';
|
|
125
|
+
}
|
|
126
|
+
// Check for 5xx
|
|
127
|
+
const statusMatch = contextStr.match(/"status":\s*(\d+)/);
|
|
128
|
+
if (statusMatch) {
|
|
129
|
+
const status = parseInt(statusMatch[1], 10);
|
|
130
|
+
if (status >= 500 && status < 600) {
|
|
131
|
+
return 'serverError';
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (message.includes('500') || message.includes('502') || message.includes('503') ||
|
|
135
|
+
message.includes('504') || message.includes('internal server error')) {
|
|
136
|
+
return 'serverError';
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
// Check search/api events for status codes
|
|
140
|
+
if (event.type === 'search' || event.type === 'api_call') {
|
|
141
|
+
const statusCode = event.statusCode;
|
|
142
|
+
if (statusCode === 404)
|
|
143
|
+
return 'notFound';
|
|
144
|
+
if (statusCode && statusCode >= 500 && statusCode < 600)
|
|
145
|
+
return 'serverError';
|
|
146
|
+
}
|
|
147
|
+
return 'other';
|
|
148
|
+
}
|
|
97
149
|
function summarizeDay(day) {
|
|
98
150
|
const searchEvents = day.events.filter((event) => event.type === 'search');
|
|
151
|
+
const indexingEvents = day.events.filter((event) => event.type === 'indexing');
|
|
99
152
|
const initializationCount = day.events.filter((event) => event.type === 'initialization').length;
|
|
100
153
|
const semanticSearchCount = searchEvents.filter((event) => event.searchKind === 'semantic').length;
|
|
101
154
|
const dependencySearchCount = searchEvents.filter((event) => event.searchKind === 'dependencies').length;
|
|
102
155
|
const estimatedTokens = searchEvents.reduce((sum, event) => sum + (event.estimatedTokens || 0), 0);
|
|
103
156
|
const totalDurationMs = searchEvents.reduce((sum, event) => sum + (event.durationMs || 0), 0);
|
|
157
|
+
const indexingTotalDurationMs = indexingEvents.reduce((sum, event) => sum + (event.durationMs || 0), 0);
|
|
104
158
|
const apiEvents = day.events.filter((event) => event.type === 'api_call');
|
|
105
159
|
const errorEvents = day.events.filter((event) => event.type === 'error');
|
|
106
160
|
const errorStatusCounts = {};
|
|
161
|
+
const errorCategories = { notFound: 0, timeout: 0, serverError: 0, other: 0 };
|
|
107
162
|
const registerStatus = (status) => {
|
|
108
163
|
if (!status) {
|
|
109
164
|
return;
|
|
@@ -114,13 +169,22 @@ function summarizeDay(day) {
|
|
|
114
169
|
searchEvents.forEach((event) => {
|
|
115
170
|
if (!event.success) {
|
|
116
171
|
registerStatus(event.statusCode);
|
|
172
|
+
const category = categorizeError(event);
|
|
173
|
+
errorCategories[category]++;
|
|
117
174
|
}
|
|
118
175
|
});
|
|
119
176
|
apiEvents.forEach((event) => {
|
|
120
177
|
if (!event.success) {
|
|
121
178
|
registerStatus(event.statusCode);
|
|
179
|
+
const category = categorizeError(event);
|
|
180
|
+
errorCategories[category]++;
|
|
122
181
|
}
|
|
123
182
|
});
|
|
183
|
+
// Categorize error events
|
|
184
|
+
errorEvents.forEach((event) => {
|
|
185
|
+
const category = categorizeError(event);
|
|
186
|
+
errorCategories[category]++;
|
|
187
|
+
});
|
|
124
188
|
return {
|
|
125
189
|
date: day.date,
|
|
126
190
|
initializationCount,
|
|
@@ -130,7 +194,11 @@ function summarizeDay(day) {
|
|
|
130
194
|
estimatedTokens,
|
|
131
195
|
totalDurationMs,
|
|
132
196
|
averageDurationMs: searchEvents.length === 0 ? 0 : totalDurationMs / searchEvents.length,
|
|
197
|
+
indexingCount: indexingEvents.length,
|
|
198
|
+
indexingTotalDurationMs,
|
|
199
|
+
indexingAverageDurationMs: indexingEvents.length === 0 ? 0 : indexingTotalDurationMs / indexingEvents.length,
|
|
133
200
|
errorStatusCounts,
|
|
201
|
+
errorCategories,
|
|
134
202
|
errorCount: errorEvents.length,
|
|
135
203
|
};
|
|
136
204
|
}
|
|
@@ -188,7 +256,7 @@ function renderHtml() {
|
|
|
188
256
|
<head>
|
|
189
257
|
<meta charset="UTF-8" />
|
|
190
258
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
191
|
-
<title>Embark MCP
|
|
259
|
+
<title>Embark CLI and MCP Dashboard</title>
|
|
192
260
|
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.1/dist/chart.umd.min.js"></script>
|
|
193
261
|
<style>
|
|
194
262
|
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; margin: 0; padding: 0; background: #0b1221; color: #f5f7ff; }
|
|
@@ -217,8 +285,8 @@ function renderHtml() {
|
|
|
217
285
|
</head>
|
|
218
286
|
<body>
|
|
219
287
|
<header>
|
|
220
|
-
<h1>Embark MCP
|
|
221
|
-
<p>Live metrics for local MCP usage. Data refreshes every 15 seconds.</p>
|
|
288
|
+
<h1>Embark CLI and MCP Dashboard</h1>
|
|
289
|
+
<p>Live metrics for local CLI and MCP usage. Data refreshes every 15 seconds.</p>
|
|
222
290
|
</header>
|
|
223
291
|
<main>
|
|
224
292
|
<div class="grid cards">
|
|
@@ -246,9 +314,18 @@ function renderHtml() {
|
|
|
246
314
|
<h2>Initializations</h2>
|
|
247
315
|
<p id="initializations">0</p>
|
|
248
316
|
</div>
|
|
317
|
+
<div class="card">
|
|
318
|
+
<h2>Total Indexings</h2>
|
|
319
|
+
<p id="total-indexings">0</p>
|
|
320
|
+
</div>
|
|
321
|
+
<div class="card">
|
|
322
|
+
<h2>Avg Indexing Duration (ms)</h2>
|
|
323
|
+
<p id="avg-indexing-duration">0</p>
|
|
324
|
+
</div>
|
|
249
325
|
<div class="card">
|
|
250
326
|
<h2>Error Events</h2>
|
|
251
327
|
<p id="total-errors">0</p>
|
|
328
|
+
<p class="muted" id="error-breakdown"></p>
|
|
252
329
|
</div>
|
|
253
330
|
</div>
|
|
254
331
|
|
|
@@ -360,8 +437,19 @@ function renderHtml() {
|
|
|
360
437
|
document.getElementById('total-tokens').textContent = totals.totalEstimatedTokens;
|
|
361
438
|
document.getElementById('avg-duration').textContent = totals.averageDurationMs.toFixed(1);
|
|
362
439
|
document.getElementById('initializations').textContent = totals.totalInitializations;
|
|
440
|
+
document.getElementById('total-indexings').textContent = totals.totalIndexings;
|
|
441
|
+
document.getElementById('avg-indexing-duration').textContent = totals.averageIndexingDurationMs.toFixed(1);
|
|
363
442
|
document.getElementById('total-errors').textContent = totals.totalErrors;
|
|
364
443
|
document.getElementById('stats-dir').textContent = data.statsDir;
|
|
444
|
+
|
|
445
|
+
// Error breakdown
|
|
446
|
+
const ec = totals.errorCategories || {};
|
|
447
|
+
const parts = [];
|
|
448
|
+
if (ec.notFound) parts.push(\`404: \${ec.notFound}\`);
|
|
449
|
+
if (ec.timeout) parts.push(\`Timeout: \${ec.timeout}\`);
|
|
450
|
+
if (ec.serverError) parts.push(\`5xx: \${ec.serverError}\`);
|
|
451
|
+
if (ec.other) parts.push(\`Other: \${ec.other}\`);
|
|
452
|
+
document.getElementById('error-breakdown').textContent = parts.length > 0 ? parts.join(' · ') : '';
|
|
365
453
|
}
|
|
366
454
|
|
|
367
455
|
function renderCharts(data) {
|
|
@@ -421,7 +509,10 @@ function renderHtml() {
|
|
|
421
509
|
|
|
422
510
|
function renderErrorsChart(data) {
|
|
423
511
|
const labels = data.days.map((day) => day.date);
|
|
424
|
-
const
|
|
512
|
+
const notFoundCounts = data.days.map((day) => day.errorCategories?.notFound || 0);
|
|
513
|
+
const timeoutCounts = data.days.map((day) => day.errorCategories?.timeout || 0);
|
|
514
|
+
const serverErrorCounts = data.days.map((day) => day.errorCategories?.serverError || 0);
|
|
515
|
+
const otherCounts = data.days.map((day) => day.errorCategories?.other || 0);
|
|
425
516
|
const emptyState = document.getElementById('errors-empty');
|
|
426
517
|
|
|
427
518
|
if (errorsChart) {
|
|
@@ -429,7 +520,10 @@ function renderHtml() {
|
|
|
429
520
|
errorsChart = null;
|
|
430
521
|
}
|
|
431
522
|
|
|
432
|
-
const hasErrors =
|
|
523
|
+
const hasErrors = notFoundCounts.some((c) => c > 0) ||
|
|
524
|
+
timeoutCounts.some((c) => c > 0) ||
|
|
525
|
+
serverErrorCounts.some((c) => c > 0) ||
|
|
526
|
+
otherCounts.some((c) => c > 0);
|
|
433
527
|
if (!hasErrors) {
|
|
434
528
|
emptyState.textContent = 'No errors recorded.';
|
|
435
529
|
return;
|
|
@@ -443,9 +537,24 @@ function renderHtml() {
|
|
|
443
537
|
labels,
|
|
444
538
|
datasets: [
|
|
445
539
|
{
|
|
446
|
-
label: '
|
|
447
|
-
data:
|
|
540
|
+
label: '404 Not Found',
|
|
541
|
+
data: notFoundCounts,
|
|
542
|
+
backgroundColor: '#f87171',
|
|
543
|
+
},
|
|
544
|
+
{
|
|
545
|
+
label: 'Timeout',
|
|
546
|
+
data: timeoutCounts,
|
|
448
547
|
backgroundColor: '#fbbf24',
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
label: '5xx Server Error',
|
|
551
|
+
data: serverErrorCounts,
|
|
552
|
+
backgroundColor: '#fb923c',
|
|
553
|
+
},
|
|
554
|
+
{
|
|
555
|
+
label: 'Other',
|
|
556
|
+
data: otherCounts,
|
|
557
|
+
backgroundColor: '#a78bfa',
|
|
449
558
|
}
|
|
450
559
|
],
|
|
451
560
|
},
|
|
@@ -453,8 +562,8 @@ function renderHtml() {
|
|
|
453
562
|
responsive: true,
|
|
454
563
|
maintainAspectRatio: false,
|
|
455
564
|
scales: {
|
|
456
|
-
x: { ticks: { color: '#cbd5f5' }, grid: { color: 'rgba(255,255,255,0.05)' } },
|
|
457
|
-
y: { ticks: { color: '#cbd5f5' }, grid: { color: 'rgba(255,255,255,0.05)' }, beginAtZero: true }
|
|
565
|
+
x: { stacked: true, ticks: { color: '#cbd5f5' }, grid: { color: 'rgba(255,255,255,0.05)' } },
|
|
566
|
+
y: { stacked: true, ticks: { color: '#cbd5f5' }, grid: { color: 'rgba(255,255,255,0.05)' }, beginAtZero: true }
|
|
458
567
|
},
|
|
459
568
|
plugins: { legend: { labels: { color: '#cbd5f5' } } }
|
|
460
569
|
},
|
|
@@ -615,6 +724,11 @@ function renderHtml() {
|
|
|
615
724
|
if (event.type === 'multi_repo_summary') {
|
|
616
725
|
return \`Multi-repo search for "\${event.query}" (\${event.successfulRepositories}/\${event.repositoryCount} succeeded)\`;
|
|
617
726
|
}
|
|
727
|
+
if (event.type === 'indexing') {
|
|
728
|
+
const status = event.success ? 'success' : 'failed';
|
|
729
|
+
const repo = event.repositoryUrl ? event.repositoryUrl.split('/').slice(-2).join('/') : 'unknown';
|
|
730
|
+
return \`\${event.mode} indexing for \${repo} (\${status}, \${event.durationMs}ms)\`;
|
|
731
|
+
}
|
|
618
732
|
return 'Event recorded';
|
|
619
733
|
}
|
|
620
734
|
|