electron-debug-skill 1.0.2 → 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 +21 -20
- 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
|
@@ -508,18 +508,19 @@ async function cmdScreenshot(args) {
|
|
|
508
508
|
// Try daemon mode first
|
|
509
509
|
const isDaemonRunning = await daemonCheck();
|
|
510
510
|
if (isDaemonRunning) {
|
|
511
|
-
const
|
|
511
|
+
const specifiedPath = String(args.path || '');
|
|
512
512
|
try {
|
|
513
513
|
const result = await daemonRequest('/screenshot', 'GET');
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
const
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
} else {
|
|
520
|
-
console.log(`Screenshot captured (${result.data.length} bytes, base64)`);
|
|
521
|
-
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`;
|
|
522
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}`);
|
|
523
524
|
} catch (err) {
|
|
524
525
|
console.error('Error:', err.message);
|
|
525
526
|
}
|
|
@@ -530,20 +531,20 @@ async function cmdScreenshot(args) {
|
|
|
530
531
|
console.log('Not connected. Use "daemon start" or "connect" first.');
|
|
531
532
|
return;
|
|
532
533
|
}
|
|
533
|
-
const
|
|
534
|
+
const specifiedPath = String(args.path || '');
|
|
534
535
|
const format = args.jpeg ? 'jpeg' : 'png';
|
|
535
536
|
const quality = args.jpeg ? 80 : undefined;
|
|
536
537
|
const result = await client.captureScreenshot(format, quality);
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
const
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
}
|
|
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}`);
|
|
547
548
|
}
|
|
548
549
|
async function cmdDom(args) {
|
|
549
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
|
|