devlens-mcp 0.3.0 → 0.3.1
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 +10 -21
- package/docs/setup-guide.md +11 -31
- package/package.json +1 -1
- package/.claude/settings.json +0 -12
- package/.claude/settings.local.json +0 -17
- package/bin/cli.ts +0 -22
- package/bin/register.ts +0 -96
- package/dist/src/config/devlens-config.d.ts +0 -92
- package/dist/src/config/devlens-config.d.ts.map +0 -1
- package/dist/src/config/devlens-config.js +0 -70
- package/dist/src/config/devlens-config.js.map +0 -1
- package/dist/src/index.d.ts +0 -35
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -8
- package/dist/src/index.js.map +0 -1
- package/dist/src/metro/cdp-client.d.ts +0 -48
- package/dist/src/metro/cdp-client.d.ts.map +0 -1
- package/dist/src/metro/cdp-client.js +0 -127
- package/dist/src/metro/cdp-client.js.map +0 -1
- package/dist/src/metro/log-collector.d.ts +0 -30
- package/dist/src/metro/log-collector.d.ts.map +0 -1
- package/dist/src/metro/log-collector.js +0 -114
- package/dist/src/metro/log-collector.js.map +0 -1
- package/dist/src/metro/metro-bridge.d.ts +0 -56
- package/dist/src/metro/metro-bridge.d.ts.map +0 -1
- package/dist/src/metro/metro-bridge.js +0 -255
- package/dist/src/metro/metro-bridge.js.map +0 -1
- package/dist/src/metro/network-inspector.d.ts +0 -34
- package/dist/src/metro/network-inspector.d.ts.map +0 -1
- package/dist/src/metro/network-inspector.js +0 -100
- package/dist/src/metro/network-inspector.js.map +0 -1
- package/dist/src/platform/android/adb.d.ts +0 -50
- package/dist/src/platform/android/adb.d.ts.map +0 -1
- package/dist/src/platform/android/adb.js +0 -137
- package/dist/src/platform/android/adb.js.map +0 -1
- package/dist/src/platform/android/android-device.d.ts +0 -21
- package/dist/src/platform/android/android-device.d.ts.map +0 -1
- package/dist/src/platform/android/android-device.js +0 -94
- package/dist/src/platform/android/android-device.js.map +0 -1
- package/dist/src/platform/android/ui-automator.d.ts +0 -17
- package/dist/src/platform/android/ui-automator.d.ts.map +0 -1
- package/dist/src/platform/android/ui-automator.js +0 -126
- package/dist/src/platform/android/ui-automator.js.map +0 -1
- package/dist/src/platform/device-manager.d.ts +0 -28
- package/dist/src/platform/device-manager.d.ts.map +0 -1
- package/dist/src/platform/device-manager.js +0 -185
- package/dist/src/platform/device-manager.js.map +0 -1
- package/dist/src/platform/device.d.ts +0 -86
- package/dist/src/platform/device.d.ts.map +0 -1
- package/dist/src/platform/device.js +0 -7
- package/dist/src/platform/device.js.map +0 -1
- package/dist/src/platform/ios/accessibility.d.ts +0 -17
- package/dist/src/platform/ios/accessibility.d.ts.map +0 -1
- package/dist/src/platform/ios/accessibility.js +0 -159
- package/dist/src/platform/ios/accessibility.js.map +0 -1
- package/dist/src/platform/ios/ios-device.d.ts +0 -22
- package/dist/src/platform/ios/ios-device.d.ts.map +0 -1
- package/dist/src/platform/ios/ios-device.js +0 -97
- package/dist/src/platform/ios/ios-device.js.map +0 -1
- package/dist/src/platform/ios/simctl.d.ts +0 -54
- package/dist/src/platform/ios/simctl.d.ts.map +0 -1
- package/dist/src/platform/ios/simctl.js +0 -192
- package/dist/src/platform/ios/simctl.js.map +0 -1
- package/dist/src/server.d.ts +0 -3
- package/dist/src/server.d.ts.map +0 -1
- package/dist/src/server.js +0 -176
- package/dist/src/server.js.map +0 -1
- package/dist/src/snapshot/formatter.d.ts +0 -18
- package/dist/src/snapshot/formatter.d.ts.map +0 -1
- package/dist/src/snapshot/formatter.js +0 -86
- package/dist/src/snapshot/formatter.js.map +0 -1
- package/dist/src/snapshot/ref-registry.d.ts +0 -67
- package/dist/src/snapshot/ref-registry.d.ts.map +0 -1
- package/dist/src/snapshot/ref-registry.js +0 -169
- package/dist/src/snapshot/ref-registry.js.map +0 -1
- package/dist/src/snapshot/snapshot-differ.d.ts +0 -57
- package/dist/src/snapshot/snapshot-differ.d.ts.map +0 -1
- package/dist/src/snapshot/snapshot-differ.js +0 -153
- package/dist/src/snapshot/snapshot-differ.js.map +0 -1
- package/dist/src/tools/app-tools.d.ts +0 -71
- package/dist/src/tools/app-tools.d.ts.map +0 -1
- package/dist/src/tools/app-tools.js +0 -97
- package/dist/src/tools/app-tools.js.map +0 -1
- package/dist/src/tools/device-tools.d.ts +0 -53
- package/dist/src/tools/device-tools.d.ts.map +0 -1
- package/dist/src/tools/device-tools.js +0 -86
- package/dist/src/tools/device-tools.js.map +0 -1
- package/dist/src/tools/ds-tools.d.ts +0 -65
- package/dist/src/tools/ds-tools.d.ts.map +0 -1
- package/dist/src/tools/ds-tools.js +0 -314
- package/dist/src/tools/ds-tools.js.map +0 -1
- package/dist/src/tools/interaction-tools.d.ts +0 -248
- package/dist/src/tools/interaction-tools.d.ts.map +0 -1
- package/dist/src/tools/interaction-tools.js +0 -391
- package/dist/src/tools/interaction-tools.js.map +0 -1
- package/dist/src/tools/metro-tools.d.ts +0 -115
- package/dist/src/tools/metro-tools.d.ts.map +0 -1
- package/dist/src/tools/metro-tools.js +0 -270
- package/dist/src/tools/metro-tools.js.map +0 -1
- package/dist/src/tools/navigation-tools.d.ts +0 -36
- package/dist/src/tools/navigation-tools.d.ts.map +0 -1
- package/dist/src/tools/navigation-tools.js +0 -60
- package/dist/src/tools/navigation-tools.js.map +0 -1
- package/dist/src/tools/screenshot-tools.d.ts +0 -298
- package/dist/src/tools/screenshot-tools.d.ts.map +0 -1
- package/dist/src/tools/screenshot-tools.js +0 -565
- package/dist/src/tools/screenshot-tools.js.map +0 -1
- package/dist/src/tools/snapshot-tools.d.ts +0 -161
- package/dist/src/tools/snapshot-tools.d.ts.map +0 -1
- package/dist/src/tools/snapshot-tools.js +0 -479
- package/dist/src/tools/snapshot-tools.js.map +0 -1
- package/dist/src/utils/image-preprocess.d.ts +0 -49
- package/dist/src/utils/image-preprocess.d.ts.map +0 -1
- package/dist/src/utils/image-preprocess.js +0 -322
- package/dist/src/utils/image-preprocess.js.map +0 -1
- package/dist/src/utils/retry.d.ts +0 -21
- package/dist/src/utils/retry.d.ts.map +0 -1
- package/dist/src/utils/retry.js +0 -33
- package/dist/src/utils/retry.js.map +0 -1
- package/dist/src/visual/comparator.d.ts +0 -51
- package/dist/src/visual/comparator.d.ts.map +0 -1
- package/dist/src/visual/comparator.js +0 -119
- package/dist/src/visual/comparator.js.map +0 -1
- package/dist/src/visual/layout-analyzer.d.ts +0 -64
- package/dist/src/visual/layout-analyzer.d.ts.map +0 -1
- package/dist/src/visual/layout-analyzer.js +0 -198
- package/dist/src/visual/layout-analyzer.js.map +0 -1
- package/dist/src/visual/screenshot.d.ts +0 -17
- package/dist/src/visual/screenshot.d.ts.map +0 -1
- package/dist/src/visual/screenshot.js +0 -39
- package/dist/src/visual/screenshot.js.map +0 -1
- package/src/config/devlens-config.ts +0 -76
- package/src/index.ts +0 -5
- package/src/metro/cdp-client.ts +0 -160
- package/src/metro/log-collector.ts +0 -137
- package/src/metro/metro-bridge.ts +0 -307
- package/src/metro/network-inspector.ts +0 -134
- package/src/platform/android/adb.ts +0 -200
- package/src/platform/android/android-device.ts +0 -116
- package/src/platform/android/ui-automator.ts +0 -141
- package/src/platform/device-manager.ts +0 -229
- package/src/platform/device.ts +0 -110
- package/src/platform/ios/accessibility.ts +0 -189
- package/src/platform/ios/ios-device.ts +0 -116
- package/src/platform/ios/simctl.ts +0 -244
- package/src/server.ts +0 -228
- package/src/snapshot/formatter.ts +0 -102
- package/src/snapshot/ref-registry.ts +0 -230
- package/src/snapshot/snapshot-differ.ts +0 -220
- package/src/tools/app-tools.ts +0 -111
- package/src/tools/device-tools.ts +0 -96
- package/src/tools/ds-tools.ts +0 -395
- package/src/tools/interaction-tools.ts +0 -467
- package/src/tools/metro-tools.ts +0 -320
- package/src/tools/navigation-tools.ts +0 -71
- package/src/tools/screenshot-tools.ts +0 -698
- package/src/tools/snapshot-tools.ts +0 -585
- package/src/utils/image-preprocess.ts +0 -430
- package/src/utils/retry.ts +0 -51
- package/src/visual/comparator.ts +0 -191
- package/src/visual/layout-analyzer.ts +0 -283
- package/src/visual/screenshot.ts +0 -49
package/README.md
CHANGED
|
@@ -14,26 +14,19 @@ Figma Design ──► AI Agent ──► Code Changes ──► Hot Reloa
|
|
|
14
14
|
|
|
15
15
|
## Quick Start
|
|
16
16
|
|
|
17
|
-
###
|
|
18
|
-
|
|
17
|
+
### Claude Code
|
|
19
18
|
```bash
|
|
20
|
-
|
|
21
|
-
cd mcp-devlens
|
|
22
|
-
npm install
|
|
23
|
-
npm run build
|
|
19
|
+
claude mcp add devlens -- npx devlens-mcp@latest
|
|
24
20
|
```
|
|
25
21
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
### Step 2 — Add to your AI client
|
|
29
|
-
|
|
30
|
-
**Cursor IDE** — edit `~/.cursor/mcp.json`:
|
|
22
|
+
### Cursor IDE
|
|
23
|
+
Add to `~/.cursor/mcp.json`:
|
|
31
24
|
```json
|
|
32
25
|
{
|
|
33
26
|
"mcpServers": {
|
|
34
27
|
"devlens": {
|
|
35
|
-
"command": "
|
|
36
|
-
"args": ["
|
|
28
|
+
"command": "npx",
|
|
29
|
+
"args": ["devlens-mcp@latest"],
|
|
37
30
|
"env": {
|
|
38
31
|
"METRO_PORT": "8081",
|
|
39
32
|
"FIGMA_TOKEN": "figd_xxxxx"
|
|
@@ -43,18 +36,14 @@ Note the **absolute path** to the cloned folder — you'll need it in the next s
|
|
|
43
36
|
}
|
|
44
37
|
```
|
|
45
38
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
claude mcp add devlens -- node /absolute/path/to/mcp-devlens/dist/bin/cli.js
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
**Claude Desktop** — edit `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
39
|
+
### Claude Desktop
|
|
40
|
+
Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
52
41
|
```json
|
|
53
42
|
{
|
|
54
43
|
"mcpServers": {
|
|
55
44
|
"devlens": {
|
|
56
|
-
"command": "
|
|
57
|
-
"args": ["
|
|
45
|
+
"command": "npx",
|
|
46
|
+
"args": ["devlens-mcp@latest"],
|
|
58
47
|
"env": {
|
|
59
48
|
"METRO_PORT": "8081",
|
|
60
49
|
"FIGMA_TOKEN": "figd_xxxxx"
|
package/docs/setup-guide.md
CHANGED
|
@@ -42,27 +42,14 @@ npx expo start
|
|
|
42
42
|
|
|
43
43
|
## Installation
|
|
44
44
|
|
|
45
|
-
###
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
git clone https://JioOmni@dev.azure.com/JioOmni/OmniAI/_git/mcp-devlens
|
|
49
|
-
cd mcp-devlens
|
|
50
|
-
npm install
|
|
51
|
-
npm run build
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
This produces `dist/bin/cli.js`. Note the **absolute path** to this file — you'll need it below.
|
|
55
|
-
|
|
56
|
-
### Step 2 — Register with your AI client
|
|
57
|
-
|
|
58
|
-
#### Cursor IDE
|
|
59
|
-
Edit `~/.cursor/mcp.json`:
|
|
45
|
+
### Option 1: Cursor IDE
|
|
46
|
+
Add to `~/.cursor/mcp.json`:
|
|
60
47
|
```json
|
|
61
48
|
{
|
|
62
49
|
"mcpServers": {
|
|
63
50
|
"devlens": {
|
|
64
|
-
"command": "
|
|
65
|
-
"args": ["
|
|
51
|
+
"command": "npx",
|
|
52
|
+
"args": ["devlens-mcp@latest"],
|
|
66
53
|
"env": {
|
|
67
54
|
"METRO_PORT": "8081",
|
|
68
55
|
"FIGMA_TOKEN": "figd_xxxxx",
|
|
@@ -75,26 +62,19 @@ Edit `~/.cursor/mcp.json`:
|
|
|
75
62
|
|
|
76
63
|
Restart Cursor after saving. DevLens tools will appear in the MCP tools panel.
|
|
77
64
|
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
claude mcp add devlens -- node /absolute/path/to/mcp-devlens/dist/bin/cli.js
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
Or run the auto-registration helper from the cloned repo:
|
|
65
|
+
### Option 2: Claude Code
|
|
84
66
|
```bash
|
|
85
|
-
|
|
67
|
+
claude mcp add devlens -- npx devlens-mcp@latest
|
|
86
68
|
```
|
|
87
69
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
#### Claude Desktop
|
|
91
|
-
Edit `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
70
|
+
### Option 3: Claude Desktop
|
|
71
|
+
Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
92
72
|
```json
|
|
93
73
|
{
|
|
94
74
|
"mcpServers": {
|
|
95
75
|
"devlens": {
|
|
96
|
-
"command": "
|
|
97
|
-
"args": ["
|
|
76
|
+
"command": "npx",
|
|
77
|
+
"args": ["devlens-mcp@latest"],
|
|
98
78
|
"env": {
|
|
99
79
|
"METRO_PORT": "8081",
|
|
100
80
|
"FIGMA_TOKEN": "figd_xxxxx",
|
|
@@ -105,7 +85,7 @@ Edit `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
|
105
85
|
}
|
|
106
86
|
```
|
|
107
87
|
|
|
108
|
-
> **
|
|
88
|
+
> **Note:** `npx` downloads and runs DevLens automatically on first use. No clone or build step needed.
|
|
109
89
|
|
|
110
90
|
---
|
|
111
91
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "devlens-mcp",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "DevLens — Playwright-style MCP server for mobile development. Take screenshots, compare with Figma designs, interact with iOS Simulators & Android Emulators, and access Metro bundler logs.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
package/.claude/settings.json
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"permissions": {
|
|
3
|
-
"allow": [
|
|
4
|
-
"Bash(git remote set-url origin \"https://JioOmni@dev.azure.com/JioOmni/OmniAI/_git/mcp-devlens\")",
|
|
5
|
-
"Bash(git add README.md docs/setup-guide.md)",
|
|
6
|
-
"Bash(PAT=\"9Myzk2VeYmr8RfL9i7uJbfQvMWnqy7M5NVkB8cIDEB2u9njYt19yJQQJ99CBACAAAAAUmMaZAAASAZDO1XcC\")",
|
|
7
|
-
"Bash(GIT_TERMINAL_PROMPT=0 git -c credential.helper= pull --rebase origin main)",
|
|
8
|
-
"Bash(GIT_TERMINAL_PROMPT=0 git -c credential.helper= push -u origin main)",
|
|
9
|
-
"Bash(npm whoami)"
|
|
10
|
-
]
|
|
11
|
-
}
|
|
12
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"permissions": {
|
|
3
|
-
"allow": [
|
|
4
|
-
"Bash(wc:*)",
|
|
5
|
-
"Bash(npx tsc:*)",
|
|
6
|
-
"Bash(sips:*)",
|
|
7
|
-
"Bash(npm run build)",
|
|
8
|
-
"Bash(npm run register)",
|
|
9
|
-
"Bash(claude mcp list)",
|
|
10
|
-
"WebFetch(domain:github.com)",
|
|
11
|
-
"WebFetch(domain:developers.figma.com)",
|
|
12
|
-
"WebFetch(domain:sharp.pixelplumbing.com)",
|
|
13
|
-
"WebFetch(domain:forum.figma.com)",
|
|
14
|
-
"Bash(ls /Users/siddhant1.singh/StudioProjects/devlens/*.md)"
|
|
15
|
-
]
|
|
16
|
-
}
|
|
17
|
-
}
|
package/bin/cli.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { createServer } from "../src/index.js";
|
|
4
|
-
|
|
5
|
-
async function main() {
|
|
6
|
-
const server = await createServer();
|
|
7
|
-
|
|
8
|
-
process.on("SIGINT", async () => {
|
|
9
|
-
await server.close();
|
|
10
|
-
process.exit(0);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
process.on("SIGTERM", async () => {
|
|
14
|
-
await server.close();
|
|
15
|
-
process.exit(0);
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
main().catch((error) => {
|
|
20
|
-
console.error("DevLens failed to start:", error);
|
|
21
|
-
process.exit(1);
|
|
22
|
-
});
|
package/bin/register.ts
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* DevLens MCP Registration Script
|
|
5
|
-
*
|
|
6
|
-
* Usage:
|
|
7
|
-
* node dist/bin/register.js — Check status + print instructions
|
|
8
|
-
* node dist/bin/register.js --register — Actually register with Claude Code
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { execFile } from "child_process";
|
|
12
|
-
import { promisify } from "util";
|
|
13
|
-
import { resolve } from "path";
|
|
14
|
-
import { existsSync, readFileSync } from "fs";
|
|
15
|
-
|
|
16
|
-
const execFileAsync = promisify(execFile);
|
|
17
|
-
|
|
18
|
-
async function register(): Promise<void> {
|
|
19
|
-
const cliPath = resolve(__dirname, "cli.js");
|
|
20
|
-
|
|
21
|
-
if (!existsSync(cliPath)) {
|
|
22
|
-
console.error("Error: dist/bin/cli.js not found. Run 'npm run build' first.");
|
|
23
|
-
process.exit(1);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const autoRegister = process.argv.includes("--register");
|
|
27
|
-
|
|
28
|
-
// Check common config locations for existing registration
|
|
29
|
-
const home = process.env.HOME || process.env.USERPROFILE || "~";
|
|
30
|
-
const configPaths = [
|
|
31
|
-
resolve(home, ".claude", "mcp.json"),
|
|
32
|
-
resolve(home, ".claude", "settings.json"),
|
|
33
|
-
resolve(home, ".config", "claude", "mcp.json"),
|
|
34
|
-
];
|
|
35
|
-
|
|
36
|
-
let alreadyRegistered = false;
|
|
37
|
-
for (const configPath of configPaths) {
|
|
38
|
-
if (existsSync(configPath)) {
|
|
39
|
-
try {
|
|
40
|
-
const content = readFileSync(configPath, "utf-8");
|
|
41
|
-
if (content.includes("devlens")) {
|
|
42
|
-
alreadyRegistered = true;
|
|
43
|
-
console.log(`DevLens already registered in: ${configPath}`);
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
} catch {
|
|
47
|
-
// Ignore read errors
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (alreadyRegistered) {
|
|
53
|
-
console.log("DevLens MCP server is already registered. No action needed.");
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const command = `claude mcp add devlens -- node ${cliPath}`;
|
|
58
|
-
|
|
59
|
-
if (autoRegister) {
|
|
60
|
-
console.log("Registering DevLens MCP server...");
|
|
61
|
-
console.log(`Running: ${command}`);
|
|
62
|
-
try {
|
|
63
|
-
const { stdout, stderr } = await execFileAsync("claude", [
|
|
64
|
-
"mcp",
|
|
65
|
-
"add",
|
|
66
|
-
"devlens",
|
|
67
|
-
"--",
|
|
68
|
-
"node",
|
|
69
|
-
cliPath,
|
|
70
|
-
]);
|
|
71
|
-
if (stdout) console.log(stdout);
|
|
72
|
-
if (stderr) console.error(stderr);
|
|
73
|
-
console.log("DevLens registered successfully!");
|
|
74
|
-
} catch (error: any) {
|
|
75
|
-
console.error(`Registration failed: ${error.message}`);
|
|
76
|
-
console.log(`\nPlease register manually:\n ${command}`);
|
|
77
|
-
process.exit(1);
|
|
78
|
-
}
|
|
79
|
-
} else {
|
|
80
|
-
console.log("");
|
|
81
|
-
console.log("=== DevLens MCP Registration ===");
|
|
82
|
-
console.log("");
|
|
83
|
-
console.log("DevLens is not registered as an MCP tool.");
|
|
84
|
-
console.log("To register, run one of these commands:");
|
|
85
|
-
console.log("");
|
|
86
|
-
console.log(` npm run register`);
|
|
87
|
-
console.log(` # or manually:`);
|
|
88
|
-
console.log(` ${command}`);
|
|
89
|
-
console.log("");
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
register().catch((err) => {
|
|
94
|
-
console.error("Registration error:", err);
|
|
95
|
-
process.exit(1);
|
|
96
|
-
});
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
/**
|
|
3
|
-
* DevLens configuration file support.
|
|
4
|
-
*
|
|
5
|
-
* Loaded from (in priority order):
|
|
6
|
-
* 1. Path pointed to by DEVLENS_CONFIG env var
|
|
7
|
-
* 2. ./devlens.config.json in CWD
|
|
8
|
-
*
|
|
9
|
-
* Place devlens.config.json in your consumer app root and point to it
|
|
10
|
-
* via the MCP env block:
|
|
11
|
-
*
|
|
12
|
-
* "env": {
|
|
13
|
-
* "METRO_PORT": "8081",
|
|
14
|
-
* "FIGMA_TOKEN": "figd_xxx",
|
|
15
|
-
* "DEVLENS_CONFIG": "/path/to/your-app/devlens.config.json"
|
|
16
|
-
* }
|
|
17
|
-
*/
|
|
18
|
-
export declare const DesignSystemConfigSchema: z.ZodObject<{
|
|
19
|
-
/** Design system identifier, e.g. "jds3" */
|
|
20
|
-
name: z.ZodString;
|
|
21
|
-
/** Absolute or CWD-relative path to the consumer app root */
|
|
22
|
-
projectRoot: z.ZodString;
|
|
23
|
-
/** Relative path from projectRoot to the tokens file, e.g. "src/constants/figmaTokens.ts" */
|
|
24
|
-
tokensFile: z.ZodString;
|
|
25
|
-
/** Relative path from projectRoot to the generated component interface directory */
|
|
26
|
-
componentsDir: z.ZodOptional<z.ZodString>;
|
|
27
|
-
/** Glob pattern for component source files (default: "src/**\/*.tsx") */
|
|
28
|
-
componentsGlob: z.ZodDefault<z.ZodString>;
|
|
29
|
-
}, "strip", z.ZodTypeAny, {
|
|
30
|
-
name: string;
|
|
31
|
-
projectRoot: string;
|
|
32
|
-
tokensFile: string;
|
|
33
|
-
componentsGlob: string;
|
|
34
|
-
componentsDir?: string | undefined;
|
|
35
|
-
}, {
|
|
36
|
-
name: string;
|
|
37
|
-
projectRoot: string;
|
|
38
|
-
tokensFile: string;
|
|
39
|
-
componentsDir?: string | undefined;
|
|
40
|
-
componentsGlob?: string | undefined;
|
|
41
|
-
}>;
|
|
42
|
-
export declare const DevLensConfigSchema: z.ZodObject<{
|
|
43
|
-
designSystem: z.ZodOptional<z.ZodObject<{
|
|
44
|
-
/** Design system identifier, e.g. "jds3" */
|
|
45
|
-
name: z.ZodString;
|
|
46
|
-
/** Absolute or CWD-relative path to the consumer app root */
|
|
47
|
-
projectRoot: z.ZodString;
|
|
48
|
-
/** Relative path from projectRoot to the tokens file, e.g. "src/constants/figmaTokens.ts" */
|
|
49
|
-
tokensFile: z.ZodString;
|
|
50
|
-
/** Relative path from projectRoot to the generated component interface directory */
|
|
51
|
-
componentsDir: z.ZodOptional<z.ZodString>;
|
|
52
|
-
/** Glob pattern for component source files (default: "src/**\/*.tsx") */
|
|
53
|
-
componentsGlob: z.ZodDefault<z.ZodString>;
|
|
54
|
-
}, "strip", z.ZodTypeAny, {
|
|
55
|
-
name: string;
|
|
56
|
-
projectRoot: string;
|
|
57
|
-
tokensFile: string;
|
|
58
|
-
componentsGlob: string;
|
|
59
|
-
componentsDir?: string | undefined;
|
|
60
|
-
}, {
|
|
61
|
-
name: string;
|
|
62
|
-
projectRoot: string;
|
|
63
|
-
tokensFile: string;
|
|
64
|
-
componentsDir?: string | undefined;
|
|
65
|
-
componentsGlob?: string | undefined;
|
|
66
|
-
}>>;
|
|
67
|
-
}, "strip", z.ZodTypeAny, {
|
|
68
|
-
designSystem?: {
|
|
69
|
-
name: string;
|
|
70
|
-
projectRoot: string;
|
|
71
|
-
tokensFile: string;
|
|
72
|
-
componentsGlob: string;
|
|
73
|
-
componentsDir?: string | undefined;
|
|
74
|
-
} | undefined;
|
|
75
|
-
}, {
|
|
76
|
-
designSystem?: {
|
|
77
|
-
name: string;
|
|
78
|
-
projectRoot: string;
|
|
79
|
-
tokensFile: string;
|
|
80
|
-
componentsDir?: string | undefined;
|
|
81
|
-
componentsGlob?: string | undefined;
|
|
82
|
-
} | undefined;
|
|
83
|
-
}>;
|
|
84
|
-
export type DevLensConfig = z.infer<typeof DevLensConfigSchema>;
|
|
85
|
-
export type DesignSystemConfig = z.infer<typeof DesignSystemConfigSchema>;
|
|
86
|
-
/**
|
|
87
|
-
* Load DevLens config from DEVLENS_CONFIG env var path, or ./devlens.config.json in CWD.
|
|
88
|
-
* Returns empty config {} if neither is found or both are invalid.
|
|
89
|
-
* Never throws — invalid config is logged and skipped.
|
|
90
|
-
*/
|
|
91
|
-
export declare function loadDevLensConfig(): Promise<DevLensConfig>;
|
|
92
|
-
//# sourceMappingURL=devlens-config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"devlens-config.d.ts","sourceRoot":"","sources":["../../../src/config/devlens-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;;;;;;;;;;;GAeG;AAEH,eAAO,MAAM,wBAAwB;IACnC,4CAA4C;;IAE5C,6DAA6D;;IAE7D,6FAA6F;;IAE7F,oFAAoF;;IAEpF,yEAAyE;;;;;;;;;;;;;;EAEzE,CAAC;AAEH,eAAO,MAAM,mBAAmB;;QAZ9B,4CAA4C;;QAE5C,6DAA6D;;QAE7D,6FAA6F;;QAE7F,oFAAoF;;QAEpF,yEAAyE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMzE,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E;;;;GAIG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,aAAa,CAAC,CA6BhE"}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DevLensConfigSchema = exports.DesignSystemConfigSchema = void 0;
|
|
4
|
-
exports.loadDevLensConfig = loadDevLensConfig;
|
|
5
|
-
const zod_1 = require("zod");
|
|
6
|
-
const promises_1 = require("fs/promises");
|
|
7
|
-
const path_1 = require("path");
|
|
8
|
-
/**
|
|
9
|
-
* DevLens configuration file support.
|
|
10
|
-
*
|
|
11
|
-
* Loaded from (in priority order):
|
|
12
|
-
* 1. Path pointed to by DEVLENS_CONFIG env var
|
|
13
|
-
* 2. ./devlens.config.json in CWD
|
|
14
|
-
*
|
|
15
|
-
* Place devlens.config.json in your consumer app root and point to it
|
|
16
|
-
* via the MCP env block:
|
|
17
|
-
*
|
|
18
|
-
* "env": {
|
|
19
|
-
* "METRO_PORT": "8081",
|
|
20
|
-
* "FIGMA_TOKEN": "figd_xxx",
|
|
21
|
-
* "DEVLENS_CONFIG": "/path/to/your-app/devlens.config.json"
|
|
22
|
-
* }
|
|
23
|
-
*/
|
|
24
|
-
exports.DesignSystemConfigSchema = zod_1.z.object({
|
|
25
|
-
/** Design system identifier, e.g. "jds3" */
|
|
26
|
-
name: zod_1.z.string(),
|
|
27
|
-
/** Absolute or CWD-relative path to the consumer app root */
|
|
28
|
-
projectRoot: zod_1.z.string(),
|
|
29
|
-
/** Relative path from projectRoot to the tokens file, e.g. "src/constants/figmaTokens.ts" */
|
|
30
|
-
tokensFile: zod_1.z.string(),
|
|
31
|
-
/** Relative path from projectRoot to the generated component interface directory */
|
|
32
|
-
componentsDir: zod_1.z.string().optional(),
|
|
33
|
-
/** Glob pattern for component source files (default: "src/**\/*.tsx") */
|
|
34
|
-
componentsGlob: zod_1.z.string().default("src/**/*.tsx"),
|
|
35
|
-
});
|
|
36
|
-
exports.DevLensConfigSchema = zod_1.z.object({
|
|
37
|
-
designSystem: exports.DesignSystemConfigSchema.optional(),
|
|
38
|
-
});
|
|
39
|
-
/**
|
|
40
|
-
* Load DevLens config from DEVLENS_CONFIG env var path, or ./devlens.config.json in CWD.
|
|
41
|
-
* Returns empty config {} if neither is found or both are invalid.
|
|
42
|
-
* Never throws — invalid config is logged and skipped.
|
|
43
|
-
*/
|
|
44
|
-
async function loadDevLensConfig() {
|
|
45
|
-
const candidates = [];
|
|
46
|
-
const envPath = process.env.DEVLENS_CONFIG;
|
|
47
|
-
if (envPath) {
|
|
48
|
-
candidates.push((0, path_1.resolve)(envPath));
|
|
49
|
-
}
|
|
50
|
-
candidates.push((0, path_1.resolve)(process.cwd(), "devlens.config.json"));
|
|
51
|
-
for (const candidate of candidates) {
|
|
52
|
-
try {
|
|
53
|
-
const raw = await (0, promises_1.readFile)(candidate, "utf-8");
|
|
54
|
-
const parsed = JSON.parse(raw);
|
|
55
|
-
const result = exports.DevLensConfigSchema.safeParse(parsed);
|
|
56
|
-
if (result.success) {
|
|
57
|
-
console.error(`[devlens] Config loaded from: ${candidate}`);
|
|
58
|
-
return result.data;
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
console.error(`[devlens] Config at ${candidate} is invalid:`, JSON.stringify(result.error.format(), null, 2));
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
catch {
|
|
65
|
-
// File not found or JSON parse error — try next candidate
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
return {};
|
|
69
|
-
}
|
|
70
|
-
//# sourceMappingURL=devlens-config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"devlens-config.js","sourceRoot":"","sources":["../../../src/config/devlens-config.ts"],"names":[],"mappings":";;;AA8CA,8CA6BC;AA3ED,6BAAwB;AACxB,0CAAuC;AACvC,+BAA+B;AAE/B;;;;;;;;;;;;;;;GAeG;AAEU,QAAA,wBAAwB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC/C,4CAA4C;IAC5C,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,6DAA6D;IAC7D,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE;IACvB,6FAA6F;IAC7F,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE;IACtB,oFAAoF;IACpF,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACpC,yEAAyE;IACzE,cAAc,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC;CACnD,CAAC,CAAC;AAEU,QAAA,mBAAmB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC1C,YAAY,EAAE,gCAAwB,CAAC,QAAQ,EAAE;CAClD,CAAC,CAAC;AAKH;;;;GAIG;AACI,KAAK,UAAU,iBAAiB;IACrC,MAAM,UAAU,GAAa,EAAE,CAAC;IAEhC,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;IAC3C,IAAI,OAAO,EAAE,CAAC;QACZ,UAAU,CAAC,IAAI,CAAC,IAAA,cAAO,EAAC,OAAO,CAAC,CAAC,CAAC;IACpC,CAAC;IACD,UAAU,CAAC,IAAI,CAAC,IAAA,cAAO,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,qBAAqB,CAAC,CAAC,CAAC;IAE/D,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,IAAA,mBAAQ,EAAC,SAAS,EAAE,OAAO,CAAC,CAAC;YAC/C,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC/B,MAAM,MAAM,GAAG,2BAAmB,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;YACrD,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACnB,OAAO,CAAC,KAAK,CAAC,iCAAiC,SAAS,EAAE,CAAC,CAAC;gBAC5D,OAAO,MAAM,CAAC,IAAI,CAAC;YACrB,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,KAAK,CACX,uBAAuB,SAAS,cAAc,EAC9C,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAC/C,CAAC;YACJ,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,0DAA0D;QAC5D,CAAC;IACH,CAAC;IAED,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
package/dist/src/index.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export declare function createServer(): Promise<import("@modelcontextprotocol/sdk/server").Server<{
|
|
2
|
-
method: string;
|
|
3
|
-
params?: {
|
|
4
|
-
[x: string]: unknown;
|
|
5
|
-
_meta?: {
|
|
6
|
-
[x: string]: unknown;
|
|
7
|
-
progressToken?: string | number | undefined;
|
|
8
|
-
"io.modelcontextprotocol/related-task"?: {
|
|
9
|
-
taskId: string;
|
|
10
|
-
} | undefined;
|
|
11
|
-
} | undefined;
|
|
12
|
-
} | undefined;
|
|
13
|
-
}, {
|
|
14
|
-
method: string;
|
|
15
|
-
params?: {
|
|
16
|
-
[x: string]: unknown;
|
|
17
|
-
_meta?: {
|
|
18
|
-
[x: string]: unknown;
|
|
19
|
-
progressToken?: string | number | undefined;
|
|
20
|
-
"io.modelcontextprotocol/related-task"?: {
|
|
21
|
-
taskId: string;
|
|
22
|
-
} | undefined;
|
|
23
|
-
} | undefined;
|
|
24
|
-
} | undefined;
|
|
25
|
-
}, {
|
|
26
|
-
[x: string]: unknown;
|
|
27
|
-
_meta?: {
|
|
28
|
-
[x: string]: unknown;
|
|
29
|
-
progressToken?: string | number | undefined;
|
|
30
|
-
"io.modelcontextprotocol/related-task"?: {
|
|
31
|
-
taskId: string;
|
|
32
|
-
} | undefined;
|
|
33
|
-
} | undefined;
|
|
34
|
-
}>>;
|
|
35
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,wBAAsB,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEjC"}
|
package/dist/src/index.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createServer = createServer;
|
|
4
|
-
const server_js_1 = require("./server.js");
|
|
5
|
-
async function createServer() {
|
|
6
|
-
return (0, server_js_1.startServer)();
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=index.js.map
|
package/dist/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;AAEA,oCAEC;AAJD,2CAA0C;AAEnC,KAAK,UAAU,YAAY;IAChC,OAAO,IAAA,uBAAW,GAAE,CAAC;AACvB,CAAC"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Chrome DevTools Protocol (CDP) client for communicating with the
|
|
3
|
-
* Metro/Hermes debugger. Connects via WebSocket and sends JSON-RPC messages.
|
|
4
|
-
*
|
|
5
|
-
* Metro exposes the debugger endpoint at:
|
|
6
|
-
* ws://localhost:{METRO_PORT}/inspector/device?device=0&page=-1
|
|
7
|
-
*
|
|
8
|
-
* Through CDP we can:
|
|
9
|
-
* - Get console logs (Console.enable → Console.messageAdded)
|
|
10
|
-
* - Intercept network requests (Network.enable → Network.requestWillBeSent)
|
|
11
|
-
* - Execute JavaScript in the RN context (Runtime.evaluate)
|
|
12
|
-
* - Trigger hot reload (via Runtime.evaluate)
|
|
13
|
-
*/
|
|
14
|
-
export interface CdpMessage {
|
|
15
|
-
id?: number;
|
|
16
|
-
method?: string;
|
|
17
|
-
params?: any;
|
|
18
|
-
result?: any;
|
|
19
|
-
error?: {
|
|
20
|
-
message: string;
|
|
21
|
-
code?: number;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
type MessageHandler = (message: CdpMessage) => void;
|
|
25
|
-
export declare class CdpClient {
|
|
26
|
-
private endpoint;
|
|
27
|
-
private ws;
|
|
28
|
-
private messageId;
|
|
29
|
-
private pendingRequests;
|
|
30
|
-
private eventHandlers;
|
|
31
|
-
private connected;
|
|
32
|
-
constructor(endpoint: string);
|
|
33
|
-
/** Connect to the CDP endpoint */
|
|
34
|
-
connect(): Promise<void>;
|
|
35
|
-
/** Send a CDP command and wait for the response */
|
|
36
|
-
send(method: string, params?: any): Promise<any>;
|
|
37
|
-
/** Register an event handler for CDP events */
|
|
38
|
-
on(method: string, handler: MessageHandler): void;
|
|
39
|
-
/** Remove event handlers for a method */
|
|
40
|
-
off(method: string): void;
|
|
41
|
-
/** Check if connected */
|
|
42
|
-
isConnected(): boolean;
|
|
43
|
-
/** Close the connection */
|
|
44
|
-
close(): void;
|
|
45
|
-
private handleMessage;
|
|
46
|
-
}
|
|
47
|
-
export {};
|
|
48
|
-
//# sourceMappingURL=cdp-client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cdp-client.d.ts","sourceRoot":"","sources":["../../../src/metro/cdp-client.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AAEH,MAAM,WAAW,UAAU;IACzB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,KAAK,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5C;AAED,KAAK,cAAc,GAAG,CAAC,OAAO,EAAE,UAAU,KAAK,IAAI,CAAC;AAEpD,qBAAa,SAAS;IAUR,OAAO,CAAC,QAAQ;IAT5B,OAAO,CAAC,EAAE,CAA0B;IACpC,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,eAAe,CAGT;IACd,OAAO,CAAC,aAAa,CAA4C;IACjE,OAAO,CAAC,SAAS,CAAkB;gBAEf,QAAQ,EAAE,MAAM;IAEpC,kCAAkC;IAC5B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAyC9B,mDAAmD;IAC7C,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IA6BtD,+CAA+C;IAC/C,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,IAAI;IAMjD,yCAAyC;IACzC,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAIzB,yBAAyB;IACzB,WAAW,IAAI,OAAO;IAItB,2BAA2B;IAC3B,KAAK,IAAI,IAAI;IAQb,OAAO,CAAC,aAAa;CAuBtB"}
|