electron-debug-skill 1.0.1 → 1.0.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 +20 -9
- package/dist/index.js +44 -21
- package/package.json +1 -1
- package/screenshot-20260409154214.png +0 -0
- package/skills/electron-debug/SKILL.md +3 -6
- package/skills-lock.json +10 -0
package/README.md
CHANGED
|
@@ -22,10 +22,28 @@
|
|
|
22
22
|
|
|
23
23
|
## Installation
|
|
24
24
|
|
|
25
|
+
### Two-Step Setup (Recommended)
|
|
26
|
+
|
|
27
|
+
**Step 1: Install Claude Code Skill** (enables `/electron-debug` commands in Claude Code)
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npx skills add kvenLin/electron-debug@electron-debug
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Step 2: Install CLI Tool** (required for the skill to work)
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm install -g electron-debug-skill
|
|
37
|
+
```
|
|
38
|
+
|
|
25
39
|
### Option 1: via skills.sh (Recommended)
|
|
26
40
|
|
|
27
41
|
```bash
|
|
42
|
+
# Step 1: Install skill definition
|
|
28
43
|
npx skills add kvenLin/electron-debug@electron-debug
|
|
44
|
+
|
|
45
|
+
# Step 2: Install CLI tool
|
|
46
|
+
npm install -g electron-debug-skill
|
|
29
47
|
```
|
|
30
48
|
|
|
31
49
|
### Option 2: Manual Install
|
|
@@ -35,15 +53,8 @@ npx skills add kvenLin/electron-debug@electron-debug
|
|
|
35
53
|
git clone https://github.com/kvenLin/electron-debug.git
|
|
36
54
|
cd electron-debug
|
|
37
55
|
|
|
38
|
-
# Install
|
|
39
|
-
npm install
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### Option 3: Development (Symlink)
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
ln -s ~/path/to/electron-debug ~/.claude/skills/electron-debug
|
|
46
|
-
/reload-plugins
|
|
56
|
+
# Install CLI tool globally
|
|
57
|
+
npm install -g
|
|
47
58
|
```
|
|
48
59
|
|
|
49
60
|
## Quick Start
|
package/dist/index.js
CHANGED
|
@@ -308,9 +308,31 @@ async function cmdStatus() {
|
|
|
308
308
|
}
|
|
309
309
|
}
|
|
310
310
|
async function cmdListPages(args) {
|
|
311
|
+
// Use daemon API
|
|
312
|
+
const isDaemonRunning = await daemonCheck();
|
|
313
|
+
if (isDaemonRunning) {
|
|
314
|
+
try {
|
|
315
|
+
const targets = await daemonRequest('/targets', 'GET');
|
|
316
|
+
console.log('\nAvailable Pages:');
|
|
317
|
+
console.log('─'.repeat(60));
|
|
318
|
+
(targets || [])
|
|
319
|
+
.filter((t) => t.type === 'page')
|
|
320
|
+
.forEach((t, i) => {
|
|
321
|
+
const marker = t.id === currentTargetId ? '→ ' : ' ';
|
|
322
|
+
console.log(`${marker}[${i + 1}] ${t.title}`);
|
|
323
|
+
console.log(` URL: ${t.url}`);
|
|
324
|
+
console.log(` ID: ${t.id}`);
|
|
325
|
+
console.log('');
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
catch (err) {
|
|
329
|
+
console.error('Error:', err.message);
|
|
330
|
+
}
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
// Fallback to direct connection
|
|
311
334
|
const port = Number(args.port) || connectionPort;
|
|
312
335
|
const host = args.host ? String(args.host) : connectionHost;
|
|
313
|
-
// Fetch targets via HTTP JSON endpoint (doesn't require connection)
|
|
314
336
|
const http = await import('http');
|
|
315
337
|
const targetsJson = await new Promise((resolve, reject) => {
|
|
316
338
|
http.get(`http://${host}:${port}/json`, (res) => {
|
|
@@ -486,18 +508,19 @@ async function cmdScreenshot(args) {
|
|
|
486
508
|
// Try daemon mode first
|
|
487
509
|
const isDaemonRunning = await daemonCheck();
|
|
488
510
|
if (isDaemonRunning) {
|
|
489
|
-
const
|
|
511
|
+
const specifiedPath = String(args.path || '');
|
|
490
512
|
try {
|
|
491
513
|
const result = await daemonRequest('/screenshot', 'GET');
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
const
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
} else {
|
|
498
|
-
console.log(`Screenshot captured (${result.data.length} bytes, base64)`);
|
|
499
|
-
console.log(`Preview: data:image/${result.format || 'png'};base64,${result.data.slice(0, 100)}...`);
|
|
514
|
+
let savePath = specifiedPath;
|
|
515
|
+
if (!savePath) {
|
|
516
|
+
const now = new Date();
|
|
517
|
+
const timestamp = now.toISOString().replace(/[-:T]/g, '').slice(0, 14);
|
|
518
|
+
savePath = `${process.cwd()}/screenshot-${timestamp}.png`;
|
|
500
519
|
}
|
|
520
|
+
const fs = await import('fs/promises');
|
|
521
|
+
const buffer = Buffer.from(result.data, 'base64');
|
|
522
|
+
await fs.writeFile(savePath, buffer);
|
|
523
|
+
console.log(`Screenshot saved to: ${savePath}`);
|
|
501
524
|
} catch (err) {
|
|
502
525
|
console.error('Error:', err.message);
|
|
503
526
|
}
|
|
@@ -508,20 +531,20 @@ async function cmdScreenshot(args) {
|
|
|
508
531
|
console.log('Not connected. Use "daemon start" or "connect" first.');
|
|
509
532
|
return;
|
|
510
533
|
}
|
|
511
|
-
const
|
|
534
|
+
const specifiedPath = String(args.path || '');
|
|
512
535
|
const format = args.jpeg ? 'jpeg' : 'png';
|
|
513
536
|
const quality = args.jpeg ? 80 : undefined;
|
|
514
537
|
const result = await client.captureScreenshot(format, quality);
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
const
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
}
|
|
538
|
+
let savePath = specifiedPath;
|
|
539
|
+
if (!savePath) {
|
|
540
|
+
const now = new Date();
|
|
541
|
+
const timestamp = now.toISOString().replace(/[-:T]/g, '').slice(0, 14);
|
|
542
|
+
savePath = `${process.cwd()}/screenshot-${timestamp}.png`;
|
|
543
|
+
}
|
|
544
|
+
const fs = await import('fs/promises');
|
|
545
|
+
const buffer = Buffer.from(result.data, 'base64');
|
|
546
|
+
await fs.writeFile(savePath, buffer);
|
|
547
|
+
console.log(`Screenshot saved to: ${savePath}`);
|
|
525
548
|
}
|
|
526
549
|
async function cmdDom(args) {
|
|
527
550
|
// Try daemon mode first
|
package/package.json
CHANGED
|
Binary file
|
|
@@ -85,9 +85,6 @@ Electron 应用调试技能,支持 Chrome DevTools Protocol (CDP) 完整调试
|
|
|
85
85
|
|
|
86
86
|
# 截图并保存到文件
|
|
87
87
|
/electron-debug screenshot --path ./screenshot.png
|
|
88
|
-
|
|
89
|
-
# 全页面截图
|
|
90
|
-
/electron-debug screenshot --full
|
|
91
88
|
```
|
|
92
89
|
|
|
93
90
|
## 元素交互
|
|
@@ -107,10 +104,10 @@ Electron 应用调试技能,支持 Chrome DevTools Protocol (CDP) 完整调试
|
|
|
107
104
|
/electron-debug eval "document.title"
|
|
108
105
|
/electron-debug eval "navigator.userAgent"
|
|
109
106
|
|
|
110
|
-
|
|
107
|
+
# 调用函数
|
|
111
108
|
/electron-debug eval "Math.random()"
|
|
112
109
|
|
|
113
|
-
|
|
110
|
+
# 多行表达式
|
|
114
111
|
/electron-debug eval "(() => { return document.querySelector('#output').textContent; })()"
|
|
115
112
|
```
|
|
116
113
|
|
|
@@ -121,7 +118,7 @@ Electron 应用调试技能,支持 Chrome DevTools Protocol (CDP) 完整调试
|
|
|
121
118
|
/electron-debug dom --selector "#my-element"
|
|
122
119
|
/electron-debug dom --selector ".class-name"
|
|
123
120
|
|
|
124
|
-
|
|
121
|
+
# 查看元素属性
|
|
125
122
|
/electron-debug dom --selector "#my-input" --props "id,value,disabled"
|
|
126
123
|
```
|
|
127
124
|
|