devlens-mcp 0.3.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/.claude/settings.json +12 -0
- package/.claude/settings.local.json +17 -0
- package/INSTALLATION_GUIDE.md +354 -0
- package/QUICK_START.md +153 -0
- package/README.md +354 -0
- package/bin/cli.ts +22 -0
- package/bin/register.ts +96 -0
- package/dist/bin/cli.d.ts +3 -0
- package/dist/bin/cli.d.ts.map +1 -0
- package/dist/bin/cli.js +20 -0
- package/dist/bin/cli.js.map +1 -0
- package/dist/bin/register.d.ts +10 -0
- package/dist/bin/register.d.ts.map +1 -0
- package/dist/bin/register.js +92 -0
- package/dist/bin/register.js.map +1 -0
- package/dist/src/config/devlens-config.d.ts +92 -0
- package/dist/src/config/devlens-config.d.ts.map +1 -0
- package/dist/src/config/devlens-config.js +70 -0
- package/dist/src/config/devlens-config.js.map +1 -0
- package/dist/src/index.d.ts +35 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +8 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/metro/cdp-client.d.ts +48 -0
- package/dist/src/metro/cdp-client.d.ts.map +1 -0
- package/dist/src/metro/cdp-client.js +127 -0
- package/dist/src/metro/cdp-client.js.map +1 -0
- package/dist/src/metro/log-collector.d.ts +30 -0
- package/dist/src/metro/log-collector.d.ts.map +1 -0
- package/dist/src/metro/log-collector.js +114 -0
- package/dist/src/metro/log-collector.js.map +1 -0
- package/dist/src/metro/metro-bridge.d.ts +56 -0
- package/dist/src/metro/metro-bridge.d.ts.map +1 -0
- package/dist/src/metro/metro-bridge.js +255 -0
- package/dist/src/metro/metro-bridge.js.map +1 -0
- package/dist/src/metro/network-inspector.d.ts +34 -0
- package/dist/src/metro/network-inspector.d.ts.map +1 -0
- package/dist/src/metro/network-inspector.js +100 -0
- package/dist/src/metro/network-inspector.js.map +1 -0
- package/dist/src/platform/android/adb.d.ts +50 -0
- package/dist/src/platform/android/adb.d.ts.map +1 -0
- package/dist/src/platform/android/adb.js +137 -0
- package/dist/src/platform/android/adb.js.map +1 -0
- package/dist/src/platform/android/android-device.d.ts +21 -0
- package/dist/src/platform/android/android-device.d.ts.map +1 -0
- package/dist/src/platform/android/android-device.js +94 -0
- package/dist/src/platform/android/android-device.js.map +1 -0
- package/dist/src/platform/android/ui-automator.d.ts +17 -0
- package/dist/src/platform/android/ui-automator.d.ts.map +1 -0
- package/dist/src/platform/android/ui-automator.js +126 -0
- package/dist/src/platform/android/ui-automator.js.map +1 -0
- package/dist/src/platform/device-manager.d.ts +28 -0
- package/dist/src/platform/device-manager.d.ts.map +1 -0
- package/dist/src/platform/device-manager.js +185 -0
- package/dist/src/platform/device-manager.js.map +1 -0
- package/dist/src/platform/device.d.ts +86 -0
- package/dist/src/platform/device.d.ts.map +1 -0
- package/dist/src/platform/device.js +7 -0
- package/dist/src/platform/device.js.map +1 -0
- package/dist/src/platform/ios/accessibility.d.ts +17 -0
- package/dist/src/platform/ios/accessibility.d.ts.map +1 -0
- package/dist/src/platform/ios/accessibility.js +159 -0
- package/dist/src/platform/ios/accessibility.js.map +1 -0
- package/dist/src/platform/ios/ios-device.d.ts +22 -0
- package/dist/src/platform/ios/ios-device.d.ts.map +1 -0
- package/dist/src/platform/ios/ios-device.js +97 -0
- package/dist/src/platform/ios/ios-device.js.map +1 -0
- package/dist/src/platform/ios/simctl.d.ts +54 -0
- package/dist/src/platform/ios/simctl.d.ts.map +1 -0
- package/dist/src/platform/ios/simctl.js +192 -0
- package/dist/src/platform/ios/simctl.js.map +1 -0
- package/dist/src/server.d.ts +3 -0
- package/dist/src/server.d.ts.map +1 -0
- package/dist/src/server.js +176 -0
- package/dist/src/server.js.map +1 -0
- package/dist/src/snapshot/formatter.d.ts +18 -0
- package/dist/src/snapshot/formatter.d.ts.map +1 -0
- package/dist/src/snapshot/formatter.js +86 -0
- package/dist/src/snapshot/formatter.js.map +1 -0
- package/dist/src/snapshot/ref-registry.d.ts +67 -0
- package/dist/src/snapshot/ref-registry.d.ts.map +1 -0
- package/dist/src/snapshot/ref-registry.js +169 -0
- package/dist/src/snapshot/ref-registry.js.map +1 -0
- package/dist/src/snapshot/snapshot-differ.d.ts +57 -0
- package/dist/src/snapshot/snapshot-differ.d.ts.map +1 -0
- package/dist/src/snapshot/snapshot-differ.js +153 -0
- package/dist/src/snapshot/snapshot-differ.js.map +1 -0
- package/dist/src/tools/app-tools.d.ts +71 -0
- package/dist/src/tools/app-tools.d.ts.map +1 -0
- package/dist/src/tools/app-tools.js +97 -0
- package/dist/src/tools/app-tools.js.map +1 -0
- package/dist/src/tools/device-tools.d.ts +53 -0
- package/dist/src/tools/device-tools.d.ts.map +1 -0
- package/dist/src/tools/device-tools.js +86 -0
- package/dist/src/tools/device-tools.js.map +1 -0
- package/dist/src/tools/ds-tools.d.ts +65 -0
- package/dist/src/tools/ds-tools.d.ts.map +1 -0
- package/dist/src/tools/ds-tools.js +314 -0
- package/dist/src/tools/ds-tools.js.map +1 -0
- package/dist/src/tools/interaction-tools.d.ts +248 -0
- package/dist/src/tools/interaction-tools.d.ts.map +1 -0
- package/dist/src/tools/interaction-tools.js +391 -0
- package/dist/src/tools/interaction-tools.js.map +1 -0
- package/dist/src/tools/metro-tools.d.ts +115 -0
- package/dist/src/tools/metro-tools.d.ts.map +1 -0
- package/dist/src/tools/metro-tools.js +270 -0
- package/dist/src/tools/metro-tools.js.map +1 -0
- package/dist/src/tools/navigation-tools.d.ts +36 -0
- package/dist/src/tools/navigation-tools.d.ts.map +1 -0
- package/dist/src/tools/navigation-tools.js +60 -0
- package/dist/src/tools/navigation-tools.js.map +1 -0
- package/dist/src/tools/screenshot-tools.d.ts +298 -0
- package/dist/src/tools/screenshot-tools.d.ts.map +1 -0
- package/dist/src/tools/screenshot-tools.js +565 -0
- package/dist/src/tools/screenshot-tools.js.map +1 -0
- package/dist/src/tools/snapshot-tools.d.ts +161 -0
- package/dist/src/tools/snapshot-tools.d.ts.map +1 -0
- package/dist/src/tools/snapshot-tools.js +479 -0
- package/dist/src/tools/snapshot-tools.js.map +1 -0
- package/dist/src/utils/image-preprocess.d.ts +49 -0
- package/dist/src/utils/image-preprocess.d.ts.map +1 -0
- package/dist/src/utils/image-preprocess.js +322 -0
- package/dist/src/utils/image-preprocess.js.map +1 -0
- package/dist/src/utils/retry.d.ts +21 -0
- package/dist/src/utils/retry.d.ts.map +1 -0
- package/dist/src/utils/retry.js +33 -0
- package/dist/src/utils/retry.js.map +1 -0
- package/dist/src/visual/comparator.d.ts +51 -0
- package/dist/src/visual/comparator.d.ts.map +1 -0
- package/dist/src/visual/comparator.js +119 -0
- package/dist/src/visual/comparator.js.map +1 -0
- package/dist/src/visual/layout-analyzer.d.ts +64 -0
- package/dist/src/visual/layout-analyzer.d.ts.map +1 -0
- package/dist/src/visual/layout-analyzer.js +198 -0
- package/dist/src/visual/layout-analyzer.js.map +1 -0
- package/dist/src/visual/screenshot.d.ts +17 -0
- package/dist/src/visual/screenshot.d.ts.map +1 -0
- package/dist/src/visual/screenshot.js +39 -0
- package/dist/src/visual/screenshot.js.map +1 -0
- package/docs/figma-workflow.md +289 -0
- package/docs/setup-guide.md +360 -0
- package/docs/tool-reference.md +622 -0
- package/package.json +57 -0
- package/src/config/devlens-config.ts +76 -0
- package/src/index.ts +5 -0
- package/src/metro/cdp-client.ts +160 -0
- package/src/metro/log-collector.ts +137 -0
- package/src/metro/metro-bridge.ts +307 -0
- package/src/metro/network-inspector.ts +134 -0
- package/src/platform/android/adb.ts +200 -0
- package/src/platform/android/android-device.ts +116 -0
- package/src/platform/android/ui-automator.ts +141 -0
- package/src/platform/device-manager.ts +229 -0
- package/src/platform/device.ts +110 -0
- package/src/platform/ios/accessibility.ts +189 -0
- package/src/platform/ios/ios-device.ts +116 -0
- package/src/platform/ios/simctl.ts +244 -0
- package/src/server.ts +228 -0
- package/src/snapshot/formatter.ts +102 -0
- package/src/snapshot/ref-registry.ts +230 -0
- package/src/snapshot/snapshot-differ.ts +220 -0
- package/src/tools/app-tools.ts +111 -0
- package/src/tools/device-tools.ts +96 -0
- package/src/tools/ds-tools.ts +395 -0
- package/src/tools/interaction-tools.ts +467 -0
- package/src/tools/metro-tools.ts +320 -0
- package/src/tools/navigation-tools.ts +71 -0
- package/src/tools/screenshot-tools.ts +698 -0
- package/src/tools/snapshot-tools.ts +585 -0
- package/src/utils/image-preprocess.ts +430 -0
- package/src/utils/retry.ts +51 -0
- package/src/visual/comparator.ts +191 -0
- package/src/visual/layout-analyzer.ts +283 -0
- package/src/visual/screenshot.ts +49 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.diffSnapshots = diffSnapshots;
|
|
4
|
+
exports.formatDiff = formatDiff;
|
|
5
|
+
/**
|
|
6
|
+
* Content-based signature — used for element identity.
|
|
7
|
+
* Intentionally excludes position/size so moved elements are matched
|
|
8
|
+
* to their previous version rather than treated as add+remove.
|
|
9
|
+
*/
|
|
10
|
+
function contentSignature(node) {
|
|
11
|
+
return [node.type, node.resourceId || "", node.text || "", node.label || ""].join("|");
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Compute a diff between two snapshot trees.
|
|
15
|
+
*
|
|
16
|
+
* Identity matching: uses content signature (type + resourceId + text + label).
|
|
17
|
+
* Elements with matching content but different position are reported as "moved".
|
|
18
|
+
* Elements with matching content+position but different size are reported as "resized".
|
|
19
|
+
* Elements present in current but not previous are "added".
|
|
20
|
+
* Elements present in previous but not current are "removed".
|
|
21
|
+
*/
|
|
22
|
+
function diffSnapshots(previous, current) {
|
|
23
|
+
const prevNodes = flattenTree(previous);
|
|
24
|
+
const currNodes = flattenTree(current);
|
|
25
|
+
const prevByContent = new Map();
|
|
26
|
+
for (const node of prevNodes) {
|
|
27
|
+
prevByContent.set(contentSignature(node), node);
|
|
28
|
+
}
|
|
29
|
+
const currByContent = new Map();
|
|
30
|
+
for (const node of currNodes) {
|
|
31
|
+
currByContent.set(contentSignature(node), node);
|
|
32
|
+
}
|
|
33
|
+
const added = [];
|
|
34
|
+
const removed = [];
|
|
35
|
+
const changed = [];
|
|
36
|
+
const moved = [];
|
|
37
|
+
const resized = [];
|
|
38
|
+
// Pass 1: find added, moved, resized, changed nodes
|
|
39
|
+
for (const [sig, currNode] of currByContent) {
|
|
40
|
+
const prevNode = prevByContent.get(sig);
|
|
41
|
+
if (!prevNode) {
|
|
42
|
+
added.push(currNode);
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
const posChanged = prevNode.bounds.x !== currNode.bounds.x ||
|
|
46
|
+
prevNode.bounds.y !== currNode.bounds.y;
|
|
47
|
+
const sizeChanged = prevNode.bounds.width !== currNode.bounds.width ||
|
|
48
|
+
prevNode.bounds.height !== currNode.bounds.height;
|
|
49
|
+
if (posChanged) {
|
|
50
|
+
moved.push({
|
|
51
|
+
node: currNode,
|
|
52
|
+
from: { x: prevNode.bounds.x, y: prevNode.bounds.y },
|
|
53
|
+
to: { x: currNode.bounds.x, y: currNode.bounds.y },
|
|
54
|
+
deltaX: currNode.bounds.x - prevNode.bounds.x,
|
|
55
|
+
deltaY: currNode.bounds.y - prevNode.bounds.y,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
if (sizeChanged) {
|
|
59
|
+
resized.push({
|
|
60
|
+
node: currNode,
|
|
61
|
+
from: { width: prevNode.bounds.width, height: prevNode.bounds.height },
|
|
62
|
+
to: { width: currNode.bounds.width, height: currNode.bounds.height },
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
const changes = detectChanges(prevNode, currNode);
|
|
66
|
+
if (changes.length > 0) {
|
|
67
|
+
changed.push({ node: currNode, changes });
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// Pass 2: find removed nodes
|
|
71
|
+
for (const [sig, node] of prevByContent) {
|
|
72
|
+
if (!currByContent.has(sig)) {
|
|
73
|
+
removed.push(node);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const structuralChange = added.length > prevNodes.length * 0.3 ||
|
|
77
|
+
removed.length > prevNodes.length * 0.3;
|
|
78
|
+
return { added, removed, changed, moved, resized, structuralChange };
|
|
79
|
+
}
|
|
80
|
+
/** Detect property-level changes between two nodes with the same identity */
|
|
81
|
+
function detectChanges(prev, curr) {
|
|
82
|
+
const changes = [];
|
|
83
|
+
if (prev.text !== curr.text) {
|
|
84
|
+
changes.push(`text: "${prev.text}" → "${curr.text}"`);
|
|
85
|
+
}
|
|
86
|
+
if (prev.value !== curr.value) {
|
|
87
|
+
changes.push(`value: "${prev.value}" → "${curr.value}"`);
|
|
88
|
+
}
|
|
89
|
+
if (prev.focused !== curr.focused) {
|
|
90
|
+
changes.push(`focused: ${prev.focused} → ${curr.focused}`);
|
|
91
|
+
}
|
|
92
|
+
if (prev.enabled !== curr.enabled) {
|
|
93
|
+
changes.push(`enabled: ${prev.enabled} → ${curr.enabled}`);
|
|
94
|
+
}
|
|
95
|
+
if (prev.label !== curr.label) {
|
|
96
|
+
changes.push(`label: "${prev.label}" → "${curr.label}"`);
|
|
97
|
+
}
|
|
98
|
+
return changes;
|
|
99
|
+
}
|
|
100
|
+
/** Flatten a tree into a list of all nodes */
|
|
101
|
+
function flattenTree(node) {
|
|
102
|
+
const result = [node];
|
|
103
|
+
for (const child of node.children) {
|
|
104
|
+
result.push(...flattenTree(child));
|
|
105
|
+
}
|
|
106
|
+
return result;
|
|
107
|
+
}
|
|
108
|
+
/** Format a diff for LLM consumption */
|
|
109
|
+
function formatDiff(diff) {
|
|
110
|
+
if (diff.structuralChange) {
|
|
111
|
+
return "[Major structural change — use full snapshot]";
|
|
112
|
+
}
|
|
113
|
+
const lines = [];
|
|
114
|
+
if (diff.added.length > 0) {
|
|
115
|
+
lines.push("ADDED:");
|
|
116
|
+
for (const node of diff.added) {
|
|
117
|
+
lines.push(` + ${node.type} ${node.text ? `"${node.text}"` : ""}`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (diff.removed.length > 0) {
|
|
121
|
+
lines.push("REMOVED:");
|
|
122
|
+
for (const node of diff.removed) {
|
|
123
|
+
lines.push(` - ${node.type} ${node.text ? `"${node.text}"` : ""}`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (diff.moved.length > 0) {
|
|
127
|
+
lines.push("MOVED:");
|
|
128
|
+
for (const m of diff.moved) {
|
|
129
|
+
const label = m.node.text ? `"${m.node.text}"` : m.node.type;
|
|
130
|
+
const dx = m.deltaX > 0 ? `+${m.deltaX}` : `${m.deltaX}`;
|
|
131
|
+
const dy = m.deltaY > 0 ? `+${m.deltaY}` : `${m.deltaY}`;
|
|
132
|
+
lines.push(` -> ${label} moved by (${dx}, ${dy})px`);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
if (diff.resized.length > 0) {
|
|
136
|
+
lines.push("RESIZED:");
|
|
137
|
+
for (const r of diff.resized) {
|
|
138
|
+
const label = r.node.text ? `"${r.node.text}"` : r.node.type;
|
|
139
|
+
lines.push(` <> ${label}: ${r.from.width}x${r.from.height} → ${r.to.width}x${r.to.height}`);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (diff.changed.length > 0) {
|
|
143
|
+
lines.push("CHANGED:");
|
|
144
|
+
for (const { node, changes } of diff.changed) {
|
|
145
|
+
lines.push(` ~ ${node.type} ${node.text ? `"${node.text}"` : ""}: ${changes.join(", ")}`);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (lines.length === 0) {
|
|
149
|
+
return "[No changes detected]";
|
|
150
|
+
}
|
|
151
|
+
return lines.join("\n");
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=snapshot-differ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot-differ.js","sourceRoot":"","sources":["../../../src/snapshot/snapshot-differ.ts"],"names":[],"mappings":";;AAqDA,sCA4EC;AAmCD,gCAuDC;AAxLD;;;;G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DeviceManager } from "../platform/device-manager.js";
|
|
3
|
+
export declare const appToolSchemas: {
|
|
4
|
+
devlens_launch_app: {
|
|
5
|
+
description: string;
|
|
6
|
+
parameters: z.ZodObject<{
|
|
7
|
+
appId: z.ZodString;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
appId: string;
|
|
10
|
+
}, {
|
|
11
|
+
appId: string;
|
|
12
|
+
}>;
|
|
13
|
+
};
|
|
14
|
+
devlens_terminate_app: {
|
|
15
|
+
description: string;
|
|
16
|
+
parameters: z.ZodObject<{
|
|
17
|
+
appId: z.ZodString;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
appId: string;
|
|
20
|
+
}, {
|
|
21
|
+
appId: string;
|
|
22
|
+
}>;
|
|
23
|
+
};
|
|
24
|
+
devlens_install_app: {
|
|
25
|
+
description: string;
|
|
26
|
+
parameters: z.ZodObject<{
|
|
27
|
+
path: z.ZodString;
|
|
28
|
+
}, "strip", z.ZodTypeAny, {
|
|
29
|
+
path: string;
|
|
30
|
+
}, {
|
|
31
|
+
path: string;
|
|
32
|
+
}>;
|
|
33
|
+
};
|
|
34
|
+
devlens_list_apps: {
|
|
35
|
+
description: string;
|
|
36
|
+
parameters: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export declare function createAppToolHandlers(deviceManager: DeviceManager): {
|
|
40
|
+
devlens_launch_app: (params: {
|
|
41
|
+
appId: string;
|
|
42
|
+
}) => Promise<{
|
|
43
|
+
content: {
|
|
44
|
+
type: "text";
|
|
45
|
+
text: string;
|
|
46
|
+
}[];
|
|
47
|
+
}>;
|
|
48
|
+
devlens_terminate_app: (params: {
|
|
49
|
+
appId: string;
|
|
50
|
+
}) => Promise<{
|
|
51
|
+
content: {
|
|
52
|
+
type: "text";
|
|
53
|
+
text: string;
|
|
54
|
+
}[];
|
|
55
|
+
}>;
|
|
56
|
+
devlens_install_app: (params: {
|
|
57
|
+
path: string;
|
|
58
|
+
}) => Promise<{
|
|
59
|
+
content: {
|
|
60
|
+
type: "text";
|
|
61
|
+
text: string;
|
|
62
|
+
}[];
|
|
63
|
+
}>;
|
|
64
|
+
devlens_list_apps: () => Promise<{
|
|
65
|
+
content: {
|
|
66
|
+
type: "text";
|
|
67
|
+
text: string;
|
|
68
|
+
}[];
|
|
69
|
+
}>;
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=app-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-tools.d.ts","sourceRoot":"","sources":["../../../src/tools/app-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgC1B,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,aAAa;iCAE3B;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE;;;;;;oCAcd;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE;;;;;;kCAcnB;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;;;EA2CvD"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.appToolSchemas = void 0;
|
|
4
|
+
exports.createAppToolHandlers = createAppToolHandlers;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
exports.appToolSchemas = {
|
|
7
|
+
devlens_launch_app: {
|
|
8
|
+
description: "Launch an app on the device by its bundle ID (iOS) or package name (Android). The app must already be installed.",
|
|
9
|
+
parameters: zod_1.z.object({
|
|
10
|
+
appId: zod_1.z
|
|
11
|
+
.string()
|
|
12
|
+
.describe("Bundle ID (iOS, e.g., com.example.app) or package name (Android, e.g., com.example.app)"),
|
|
13
|
+
}),
|
|
14
|
+
},
|
|
15
|
+
devlens_terminate_app: {
|
|
16
|
+
description: "Force stop a running app on the device.",
|
|
17
|
+
parameters: zod_1.z.object({
|
|
18
|
+
appId: zod_1.z.string().describe("Bundle ID or package name of the app to stop"),
|
|
19
|
+
}),
|
|
20
|
+
},
|
|
21
|
+
devlens_install_app: {
|
|
22
|
+
description: "Install an app from a local file path. Supports .apk (Android), .app/.ipa (iOS).",
|
|
23
|
+
parameters: zod_1.z.object({
|
|
24
|
+
path: zod_1.z
|
|
25
|
+
.string()
|
|
26
|
+
.describe("Local file path to the app binary (.apk, .app, or .ipa)"),
|
|
27
|
+
}),
|
|
28
|
+
},
|
|
29
|
+
devlens_list_apps: {
|
|
30
|
+
description: "List all third-party apps installed on the device. Returns app IDs and names.",
|
|
31
|
+
parameters: zod_1.z.object({}),
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
function createAppToolHandlers(deviceManager) {
|
|
35
|
+
return {
|
|
36
|
+
devlens_launch_app: async (params) => {
|
|
37
|
+
const device = await deviceManager.getDevice();
|
|
38
|
+
await device.launchApp(params.appId);
|
|
39
|
+
return {
|
|
40
|
+
content: [
|
|
41
|
+
{
|
|
42
|
+
type: "text",
|
|
43
|
+
text: `Launched app: ${params.appId}`,
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
};
|
|
47
|
+
},
|
|
48
|
+
devlens_terminate_app: async (params) => {
|
|
49
|
+
const device = await deviceManager.getDevice();
|
|
50
|
+
await device.terminateApp(params.appId);
|
|
51
|
+
return {
|
|
52
|
+
content: [
|
|
53
|
+
{
|
|
54
|
+
type: "text",
|
|
55
|
+
text: `Terminated app: ${params.appId}`,
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
devlens_install_app: async (params) => {
|
|
61
|
+
const device = await deviceManager.getDevice();
|
|
62
|
+
await device.installApp(params.path);
|
|
63
|
+
return {
|
|
64
|
+
content: [
|
|
65
|
+
{
|
|
66
|
+
type: "text",
|
|
67
|
+
text: `Installed app from: ${params.path}`,
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
devlens_list_apps: async () => {
|
|
73
|
+
const device = await deviceManager.getDevice();
|
|
74
|
+
const apps = await device.listApps();
|
|
75
|
+
if (apps.length === 0) {
|
|
76
|
+
return {
|
|
77
|
+
content: [
|
|
78
|
+
{
|
|
79
|
+
type: "text",
|
|
80
|
+
text: "No third-party apps found on the device.",
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
const lines = apps.map((app) => `${app.name} — ${app.appId}${app.isRunning ? " (running)" : ""}`);
|
|
86
|
+
return {
|
|
87
|
+
content: [
|
|
88
|
+
{
|
|
89
|
+
type: "text",
|
|
90
|
+
text: `Installed apps (${apps.length}):\n\n${lines.join("\n")}`,
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
};
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=app-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-tools.js","sourceRoot":"","sources":["../../../src/tools/app-tools.ts"],"names":[],"mappings":";;;AAqCA,sDAyEC;AA9GD,6BAAwB;AAGX,QAAA,cAAc,GAAG;IAC5B,kBAAkB,EAAE;QAClB,WAAW,EACT,kHAAkH;QACpH,UAAU,EAAE,OAAC,CAAC,MAAM,CAAC;YACnB,KAAK,EAAE,OAAC;iBACL,MAAM,EAAE;iBACR,QAAQ,CACP,yFAAyF,CAC1F;SACJ,CAAC;KACH;IACD,qBAAqB,EAAE;QACrB,WAAW,EAAE,yCAAyC;QACtD,UAAU,EAAE,OAAC,CAAC,MAAM,CAAC;YACnB,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8CAA8C,CAAC;SAC3E,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EAAE,MAAe;wBACrB,IAAI,EAAE,uBAAuB,MAAM,CAAC,IAAI,EAAE;qBAC3C;iBACF;aACF,CAAC;QACJ,CAAC;QAED,iBAAiB,EAAE,KAAK,IAAI,EAAE;YAC5B,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,SAAS,EAAE,CAAC;YAC/C,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,QAAQ,EAAE,CAAC;YAErC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACtB,OAAO;oBACL,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,MAAe;4BACrB,IAAI,EAAE,0CAA0C;yBACjD;qBACF;iBACF,CAAC;YACJ,CAAC;YAED,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CACpB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,IAAI,MAAM,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,EAAE,CAC1E,CAAC;YAEF,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,mBAAmB,IAAI,CAAC,MAAM,SAAS,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;qBAChE;iBACF;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { DeviceManager } from "../platform/device-manager.js";
|
|
3
|
+
export declare const deviceToolSchemas: {
|
|
4
|
+
devlens_list_devices: {
|
|
5
|
+
description: string;
|
|
6
|
+
parameters: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
7
|
+
};
|
|
8
|
+
devlens_device_info: {
|
|
9
|
+
description: string;
|
|
10
|
+
parameters: z.ZodObject<{
|
|
11
|
+
deviceId: z.ZodOptional<z.ZodString>;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
deviceId?: string | undefined;
|
|
14
|
+
}, {
|
|
15
|
+
deviceId?: string | undefined;
|
|
16
|
+
}>;
|
|
17
|
+
};
|
|
18
|
+
devlens_set_orientation: {
|
|
19
|
+
description: string;
|
|
20
|
+
parameters: z.ZodObject<{
|
|
21
|
+
orientation: z.ZodEnum<["portrait", "landscape"]>;
|
|
22
|
+
}, "strip", z.ZodTypeAny, {
|
|
23
|
+
orientation: "portrait" | "landscape";
|
|
24
|
+
}, {
|
|
25
|
+
orientation: "portrait" | "landscape";
|
|
26
|
+
}>;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export declare function createDeviceToolHandlers(deviceManager: DeviceManager): {
|
|
30
|
+
devlens_list_devices: () => Promise<{
|
|
31
|
+
content: {
|
|
32
|
+
type: "text";
|
|
33
|
+
text: string;
|
|
34
|
+
}[];
|
|
35
|
+
}>;
|
|
36
|
+
devlens_device_info: (params: {
|
|
37
|
+
deviceId?: string;
|
|
38
|
+
}) => Promise<{
|
|
39
|
+
content: {
|
|
40
|
+
type: "text";
|
|
41
|
+
text: string;
|
|
42
|
+
}[];
|
|
43
|
+
}>;
|
|
44
|
+
devlens_set_orientation: (params: {
|
|
45
|
+
orientation: "portrait" | "landscape";
|
|
46
|
+
}) => Promise<{
|
|
47
|
+
content: {
|
|
48
|
+
type: "text";
|
|
49
|
+
text: string;
|
|
50
|
+
}[];
|
|
51
|
+
}>;
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=device-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device-tools.d.ts","sourceRoot":"","sources":["../../../src/tools/device-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;CAwB7B,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,aAAa;;;;;;;kCA8B7B;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE;;;;;;sCAqBjB;QACtC,WAAW,EAAE,UAAU,GAAG,WAAW,CAAC;KACvC;;;;;;EAaJ"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deviceToolSchemas = void 0;
|
|
4
|
+
exports.createDeviceToolHandlers = createDeviceToolHandlers;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
exports.deviceToolSchemas = {
|
|
7
|
+
devlens_list_devices: {
|
|
8
|
+
description: "List all running iOS Simulators and Android Emulators. Returns device IDs, names, platforms, and OS versions.",
|
|
9
|
+
parameters: zod_1.z.object({}),
|
|
10
|
+
},
|
|
11
|
+
devlens_device_info: {
|
|
12
|
+
description: "Get detailed information about a specific device: screen size, OS version, orientation. If no deviceId is provided, uses the first available device.",
|
|
13
|
+
parameters: zod_1.z.object({
|
|
14
|
+
deviceId: zod_1.z
|
|
15
|
+
.string()
|
|
16
|
+
.optional()
|
|
17
|
+
.describe("Device ID from devlens_list_devices. Optional."),
|
|
18
|
+
}),
|
|
19
|
+
},
|
|
20
|
+
devlens_set_orientation: {
|
|
21
|
+
description: "Set the device orientation to portrait or landscape.",
|
|
22
|
+
parameters: zod_1.z.object({
|
|
23
|
+
orientation: zod_1.z
|
|
24
|
+
.enum(["portrait", "landscape"])
|
|
25
|
+
.describe("Target orientation"),
|
|
26
|
+
}),
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
function createDeviceToolHandlers(deviceManager) {
|
|
30
|
+
return {
|
|
31
|
+
devlens_list_devices: async () => {
|
|
32
|
+
const devices = await deviceManager.discoverDevices();
|
|
33
|
+
if (devices.length === 0) {
|
|
34
|
+
return {
|
|
35
|
+
content: [
|
|
36
|
+
{
|
|
37
|
+
type: "text",
|
|
38
|
+
text: "No running simulators or emulators found.\n\nTo start a device:\n- Android: Open Android Studio → Device Manager → Start an emulator\n- iOS: Open Xcode → Window → Devices and Simulators → Boot a simulator",
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
const lines = devices.map((d) => `${d.isBooted ? "●" : "○"} ${d.name} (${d.platform}, ${d.osVersion}) — id: ${d.id}`);
|
|
44
|
+
return {
|
|
45
|
+
content: [
|
|
46
|
+
{
|
|
47
|
+
type: "text",
|
|
48
|
+
text: `Found ${devices.length} device(s):\n\n${lines.join("\n")}`,
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
devlens_device_info: async (params) => {
|
|
54
|
+
const device = await deviceManager.getDevice(params.deviceId);
|
|
55
|
+
const info = await device.getInfo();
|
|
56
|
+
return {
|
|
57
|
+
content: [
|
|
58
|
+
{
|
|
59
|
+
type: "text",
|
|
60
|
+
text: [
|
|
61
|
+
`Device: ${info.name}`,
|
|
62
|
+
`Platform: ${info.platform}`,
|
|
63
|
+
`OS Version: ${info.osVersion}`,
|
|
64
|
+
`Screen: ${info.screenWidth}x${info.screenHeight}`,
|
|
65
|
+
`Orientation: ${info.orientation}`,
|
|
66
|
+
`ID: ${info.id}`,
|
|
67
|
+
].join("\n"),
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
devlens_set_orientation: async (params) => {
|
|
73
|
+
const device = await deviceManager.getDevice();
|
|
74
|
+
await device.setOrientation(params.orientation);
|
|
75
|
+
return {
|
|
76
|
+
content: [
|
|
77
|
+
{
|
|
78
|
+
type: "text",
|
|
79
|
+
text: `Orientation set to ${params.orientation}.`,
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
};
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=device-tools.js.map
|
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
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { DesignSystemConfig } from "../config/devlens-config.js";
|
|
3
|
+
/**
|
|
4
|
+
* Design System Context tool.
|
|
5
|
+
*
|
|
6
|
+
* When devlens.config.json is configured with a designSystem block,
|
|
7
|
+
* this tool scans the consumer project and returns:
|
|
8
|
+
* - Design token values (colors, spacing, typography, etc.)
|
|
9
|
+
* - TypeScript prop interfaces for DS components
|
|
10
|
+
* - Component usage patterns found in the codebase
|
|
11
|
+
*
|
|
12
|
+
* The AI uses this context to write DS-compliant code when fixing
|
|
13
|
+
* differences found by devlens_compare_with_figma.
|
|
14
|
+
*/
|
|
15
|
+
export interface TokenEntry {
|
|
16
|
+
name: string;
|
|
17
|
+
value: string;
|
|
18
|
+
group: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ComponentUsagePattern {
|
|
21
|
+
componentName: string;
|
|
22
|
+
importedFrom: string;
|
|
23
|
+
usageCount: number;
|
|
24
|
+
/** prop name → distinct values seen in the codebase */
|
|
25
|
+
sampleProps: Record<string, string[]>;
|
|
26
|
+
sourceFiles: string[];
|
|
27
|
+
}
|
|
28
|
+
export declare const dsToolSchemas: {
|
|
29
|
+
devlens_ds_context: {
|
|
30
|
+
description: string;
|
|
31
|
+
parameters: z.ZodObject<{
|
|
32
|
+
includeTokens: z.ZodDefault<z.ZodBoolean>;
|
|
33
|
+
includeComponents: z.ZodDefault<z.ZodBoolean>;
|
|
34
|
+
includeInterfaces: z.ZodDefault<z.ZodBoolean>;
|
|
35
|
+
}, "strip", z.ZodTypeAny, {
|
|
36
|
+
includeTokens: boolean;
|
|
37
|
+
includeComponents: boolean;
|
|
38
|
+
includeInterfaces: boolean;
|
|
39
|
+
}, {
|
|
40
|
+
includeTokens?: boolean | undefined;
|
|
41
|
+
includeComponents?: boolean | undefined;
|
|
42
|
+
includeInterfaces?: boolean | undefined;
|
|
43
|
+
}>;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export declare function createDsToolHandlers(dsConfig: DesignSystemConfig | undefined): {
|
|
47
|
+
devlens_ds_context: (params: {
|
|
48
|
+
includeTokens: boolean;
|
|
49
|
+
includeComponents: boolean;
|
|
50
|
+
includeInterfaces: boolean;
|
|
51
|
+
}) => Promise<{
|
|
52
|
+
content: {
|
|
53
|
+
type: "text";
|
|
54
|
+
text: string;
|
|
55
|
+
}[];
|
|
56
|
+
isError: boolean;
|
|
57
|
+
} | {
|
|
58
|
+
content: {
|
|
59
|
+
type: "text";
|
|
60
|
+
text: string;
|
|
61
|
+
}[];
|
|
62
|
+
isError?: undefined;
|
|
63
|
+
}>;
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=ds-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ds-tools.d.ts","sourceRoot":"","sources":["../../../src/tools/ds-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEtE;;;;;;;;;;;GAWG;AAIH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,uDAAuD;IACvD,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACtC,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAID,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;CAmBzB,CAAC;AAsQF,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,SAAS;iCAEtC;QACjC,aAAa,EAAE,OAAO,CAAC;QACvB,iBAAiB,EAAE,OAAO,CAAC;QAC3B,iBAAiB,EAAE,OAAO,CAAC;KAC5B;;;;;;;;;;;;;EAsEJ"}
|