devlens-mcp 0.1.2 → 0.1.3
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 +4 -3
- package/dist/index.js +24 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,10 +25,11 @@ npx devlens-mcp init
|
|
|
25
25
|
|
|
26
26
|
This creates `.mcp.json`, `.claude/skills/devlens.md`, and `devlens.config.ts`, and installs the Chromium browser automatically.
|
|
27
27
|
|
|
28
|
-
Edit `devlens.config.
|
|
28
|
+
Edit `devlens.config.js` to map your source files to dev server routes, then restart Claude Code.
|
|
29
29
|
|
|
30
|
-
```
|
|
31
|
-
// devlens.config.
|
|
30
|
+
```js
|
|
31
|
+
// devlens.config.js
|
|
32
|
+
/** @type {import('devlens-mcp').DevLensConfig} */
|
|
32
33
|
const config = {
|
|
33
34
|
devServerUrl: 'http://localhost:5173',
|
|
34
35
|
routes: [
|
package/dist/index.js
CHANGED
|
@@ -64,7 +64,8 @@ call \`dl_capture\` immediately and show the result.
|
|
|
64
64
|
- Omit selector for full-page captures (slower, larger image)
|
|
65
65
|
- Prefer element-level captures during iteration, full-page before deploy
|
|
66
66
|
`;
|
|
67
|
-
var CONFIG_TEMPLATE = `// devlens.config.
|
|
67
|
+
var CONFIG_TEMPLATE = `// devlens.config.js \u2014 map your source files to dev server routes
|
|
68
|
+
/** @type {import('devlens-mcp').DevLensConfig} */
|
|
68
69
|
const config = {
|
|
69
70
|
devServerUrl: 'http://localhost:5173',
|
|
70
71
|
hmrDebounceMs: 150,
|
|
@@ -97,12 +98,12 @@ async function runInit() {
|
|
|
97
98
|
mkdirSync(skillsDir, { recursive: true });
|
|
98
99
|
writeFileSync(join(skillsDir, "devlens.md"), SKILL_CONTENT);
|
|
99
100
|
console.log(" \u2713 .claude/skills/devlens.md written");
|
|
100
|
-
const configPath = resolve(cwd, "devlens.config.
|
|
101
|
+
const configPath = resolve(cwd, "devlens.config.js");
|
|
101
102
|
if (!existsSync(configPath)) {
|
|
102
103
|
writeFileSync(configPath, CONFIG_TEMPLATE);
|
|
103
|
-
console.log(" \u2713 devlens.config.
|
|
104
|
+
console.log(" \u2713 devlens.config.js created (edit this to add your routes)");
|
|
104
105
|
} else {
|
|
105
|
-
console.log(" \u2713 devlens.config.
|
|
106
|
+
console.log(" \u2713 devlens.config.js already exists \u2014 skipped");
|
|
106
107
|
}
|
|
107
108
|
console.log(" Installing Chromium browser...");
|
|
108
109
|
const result = spawnSync("npx", ["playwright", "install", "chromium"], { stdio: "inherit", shell: true });
|
|
@@ -134,18 +135,26 @@ var defaults = {
|
|
|
134
135
|
hmrDebounceMs: 150
|
|
135
136
|
};
|
|
136
137
|
async function loadConfig(cwd = process.cwd()) {
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
...defaults,
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
138
|
+
const candidates = [
|
|
139
|
+
resolve2(cwd, "devlens.config.js"),
|
|
140
|
+
resolve2(cwd, "devlens.config.ts")
|
|
141
|
+
];
|
|
142
|
+
for (const configPath of candidates) {
|
|
143
|
+
try {
|
|
144
|
+
const mod = await import(pathToFileURL(configPath).href);
|
|
145
|
+
return { ...defaults, ...mod.default };
|
|
146
|
+
} catch (err) {
|
|
147
|
+
const code = err.code;
|
|
148
|
+
if (code === "ERR_MODULE_NOT_FOUND" || code === "MODULE_NOT_FOUND") continue;
|
|
149
|
+
console.error(`[devlens] Failed to load ${configPath}:`, err);
|
|
150
|
+
}
|
|
148
151
|
}
|
|
152
|
+
console.warn('[devlens] No devlens.config.js found \u2014 using defaults (routes: []). Run "npx devlens-mcp init" to create one.');
|
|
153
|
+
return {
|
|
154
|
+
...defaults,
|
|
155
|
+
devServerUrl: "http://localhost:5173",
|
|
156
|
+
routes: []
|
|
157
|
+
};
|
|
149
158
|
}
|
|
150
159
|
|
|
151
160
|
// src/browser/manager.ts
|