adhdev 0.1.54 → 0.4.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/dist/cli-entrypoint.js +29083 -0
- package/dist/cli-entrypoint.js.map +1 -0
- package/dist/index.js +26970 -11054
- package/dist/index.js.map +1 -0
- package/package.json +19 -16
- package/providers/_builtin/COMPATIBILITY.md +217 -0
- package/providers/_builtin/acp/agentpool/provider.json +54 -0
- package/providers/_builtin/acp/amp/provider.json +52 -0
- package/providers/_builtin/acp/auggie/provider.json +57 -0
- package/providers/_builtin/acp/autodev/provider.json +54 -0
- package/providers/_builtin/acp/autohand/provider.json +52 -0
- package/providers/_builtin/acp/blackbox-ai/provider.json +54 -0
- package/providers/_builtin/acp/claude-agent/provider.json +57 -0
- package/providers/_builtin/acp/cline-acp/provider.json +54 -0
- package/providers/_builtin/acp/codebuddy/provider.json +54 -0
- package/providers/_builtin/acp/codex-cli/provider.json +57 -0
- package/providers/_builtin/acp/corust-agent/provider.json +52 -0
- package/providers/_builtin/acp/crow-cli/provider.json +54 -0
- package/providers/_builtin/acp/cursor-acp/provider.json +54 -0
- package/providers/_builtin/acp/deepagents/provider.json +52 -0
- package/providers/_builtin/acp/dimcode/provider.json +54 -0
- package/providers/_builtin/acp/docker-cagent/provider.json +57 -0
- package/providers/_builtin/acp/factory-droid/provider.json +60 -0
- package/providers/_builtin/acp/fast-agent/provider.json +52 -0
- package/providers/_builtin/acp/gemini-cli/provider.json +114 -0
- package/providers/_builtin/acp/github-copilot/provider.json +54 -0
- package/providers/_builtin/acp/goose/provider.json +57 -0
- package/providers/_builtin/acp/junie/provider.json +52 -0
- package/providers/_builtin/acp/kilo/provider.json +54 -0
- package/providers/_builtin/acp/kimi-cli/provider.json +57 -0
- package/providers/_builtin/acp/minion-code/provider.json +52 -0
- package/providers/_builtin/acp/mistral-vibe/provider.json +57 -0
- package/providers/_builtin/acp/nova/provider.json +54 -0
- package/providers/_builtin/acp/openclaw/provider.json +54 -0
- package/providers/_builtin/acp/opencode/provider.json +52 -0
- package/providers/_builtin/acp/openhands/provider.json +54 -0
- package/providers/_builtin/acp/pi-acp/provider.json +52 -0
- package/providers/_builtin/acp/qoder/provider.json +54 -0
- package/providers/_builtin/acp/qwen-code/provider.json +60 -0
- package/providers/_builtin/acp/stakpak/provider.json +54 -0
- package/providers/_builtin/acp/vtcode/provider.json +54 -0
- package/providers/_builtin/cli/claude-cli/provider.json +100 -0
- package/providers/_builtin/cli/codex-cli/provider.json +89 -0
- package/providers/_builtin/cli/gemini-cli/provider.json +93 -0
- package/providers/_builtin/docs/CDP_SELECTOR_GUIDE.md +370 -0
- package/providers/_builtin/docs/PROVIDER_GUIDE.md +916 -0
- package/providers/_builtin/extension/cline/provider.json +35 -0
- package/providers/_builtin/extension/cline/scripts/open_panel.js +1 -1
- package/providers/_builtin/extension/cline/{provider.js → scripts.js} +29 -55
- package/providers/_builtin/extension/roo-code/provider.json +35 -0
- package/providers/_builtin/extension/roo-code/{provider.js → scripts.js} +27 -97
- package/providers/_builtin/ide/antigravity/provider.json +63 -0
- package/providers/_builtin/ide/antigravity/scripts/legacy/list_models.js +38 -0
- package/providers/_builtin/ide/antigravity/scripts/legacy/list_modes.js +48 -0
- package/providers/_builtin/ide/antigravity/scripts/legacy/scripts.js +64 -0
- package/providers/_builtin/ide/antigravity/scripts/legacy/set_mode.js +34 -0
- package/providers/_builtin/ide/antigravity/scripts/legacy/set_model.js +47 -0
- package/providers/_builtin/ide/antigravity/scripts/list_models.js +31 -8
- package/providers/_builtin/ide/antigravity/scripts/list_modes.js +37 -13
- package/providers/_builtin/ide/antigravity/scripts/set_mode.js +49 -16
- package/providers/_builtin/ide/antigravity/scripts/set_model.js +47 -22
- package/providers/_builtin/ide/antigravity/scripts.js +67 -0
- package/providers/_builtin/ide/cursor/provider.json +59 -0
- package/providers/_builtin/ide/cursor/{provider.js → scripts.js} +47 -79
- package/providers/_builtin/ide/kiro/provider.json +60 -0
- package/providers/_builtin/ide/kiro/scripts.js +62 -0
- package/providers/_builtin/ide/pearai/provider.json +60 -0
- package/providers/_builtin/ide/pearai/scripts.js +74 -0
- package/providers/_builtin/ide/trae/provider.json +59 -0
- package/providers/_builtin/ide/trae/scripts.js +57 -0
- package/providers/_builtin/ide/vscode/provider.json +57 -0
- package/providers/_builtin/ide/vscode-insiders/provider.json +55 -0
- package/providers/_builtin/ide/vscodium/provider.json +56 -0
- package/providers/_builtin/ide/windsurf/provider.json +46 -0
- package/providers/_builtin/ide/windsurf/scripts.js +57 -0
- package/README.md +0 -43
- package/dist/dev-console-monaco.js +0 -176
- package/dist/dev-console.css +0 -326
- package/dist/dev-console.html +0 -148
- package/dist/dev-console.js +0 -1165
- package/dist/index.d.ts +0 -2
- package/providers/_builtin/acp/agentpool/provider.js +0 -59
- package/providers/_builtin/acp/amp/provider.js +0 -61
- package/providers/_builtin/acp/auggie/provider.js +0 -60
- package/providers/_builtin/acp/autodev/provider.js +0 -59
- package/providers/_builtin/acp/autohand/provider.js +0 -59
- package/providers/_builtin/acp/blackbox-ai/provider.js +0 -59
- package/providers/_builtin/acp/claude-agent/provider.js +0 -61
- package/providers/_builtin/acp/cline-acp/provider.js +0 -62
- package/providers/_builtin/acp/code-assistant/provider.js +0 -59
- package/providers/_builtin/acp/codebuddy/provider.js +0 -59
- package/providers/_builtin/acp/codex-cli/provider.js +0 -64
- package/providers/_builtin/acp/corust-agent/provider.js +0 -59
- package/providers/_builtin/acp/crow-cli/provider.js +0 -59
- package/providers/_builtin/acp/cursor-acp/provider.js +0 -59
- package/providers/_builtin/acp/deepagents/provider.js +0 -59
- package/providers/_builtin/acp/dimcode/provider.js +0 -58
- package/providers/_builtin/acp/docker-cagent/provider.js +0 -59
- package/providers/_builtin/acp/factory-droid/provider.js +0 -59
- package/providers/_builtin/acp/fast-agent/provider.js +0 -59
- package/providers/_builtin/acp/fount/provider.js +0 -59
- package/providers/_builtin/acp/gemini-cli/provider.js +0 -104
- package/providers/_builtin/acp/github-copilot/provider.js +0 -60
- package/providers/_builtin/acp/goose/provider.js +0 -64
- package/providers/_builtin/acp/junie/provider.js +0 -62
- package/providers/_builtin/acp/kilo/provider.js +0 -59
- package/providers/_builtin/acp/kimi-cli/provider.js +0 -63
- package/providers/_builtin/acp/kiro-cli/provider.js +0 -59
- package/providers/_builtin/acp/minion-code/provider.js +0 -59
- package/providers/_builtin/acp/mistral-vibe/provider.js +0 -63
- package/providers/_builtin/acp/nova/provider.js +0 -59
- package/providers/_builtin/acp/openclaw/provider.js +0 -59
- package/providers/_builtin/acp/opencode/provider.js +0 -60
- package/providers/_builtin/acp/openhands/provider.js +0 -59
- package/providers/_builtin/acp/pi-acp/provider.js +0 -59
- package/providers/_builtin/acp/qoder/provider.js +0 -58
- package/providers/_builtin/acp/qwen-code/provider.js +0 -61
- package/providers/_builtin/acp/stakpak/provider.js +0 -59
- package/providers/_builtin/acp/vtcode/provider.js +0 -59
- package/providers/_builtin/cli/claude-cli/provider.js +0 -128
- package/providers/_builtin/cli/codex-cli/provider.js +0 -80
- package/providers/_builtin/cli/gemini-cli/provider.js +0 -124
- package/providers/_builtin/ide/antigravity/provider.js +0 -114
- package/providers/_builtin/ide/kiro/provider.js +0 -90
- package/providers/_builtin/ide/pearai/provider.js +0 -100
- package/providers/_builtin/ide/trae/provider.js +0 -83
- package/providers/_builtin/ide/vscode/provider.js +0 -36
- package/providers/_builtin/ide/vscode-insiders/provider.js +0 -27
- package/providers/_builtin/ide/vscodium/provider.js +0 -27
- package/providers/_builtin/ide/windsurf/provider.js +0 -76
- package/providers/_helpers/index.js +0 -188
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "vscode-insiders",
|
|
3
|
+
"name": "Visual Studio Code - Insiders",
|
|
4
|
+
"category": "ide",
|
|
5
|
+
"displayName": "VS Code Insiders",
|
|
6
|
+
"icon": "💚",
|
|
7
|
+
"cli": "code-insiders",
|
|
8
|
+
"cdpPorts": [
|
|
9
|
+
9341,
|
|
10
|
+
9342
|
|
11
|
+
],
|
|
12
|
+
"processNames": {
|
|
13
|
+
"darwin": "Visual Studio Code - Insiders",
|
|
14
|
+
"win32": [
|
|
15
|
+
"Code - Insiders.exe"
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
"paths": {
|
|
19
|
+
"darwin": [
|
|
20
|
+
"/Applications/Visual Studio Code - Insiders.app"
|
|
21
|
+
],
|
|
22
|
+
"win32": [
|
|
23
|
+
"C:\\Program Files\\Microsoft VS Code Insiders\\Code - Insiders.exe"
|
|
24
|
+
],
|
|
25
|
+
"linux": [
|
|
26
|
+
"/usr/share/code-insiders"
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
"inputMethod": "cdp-type-and-send",
|
|
30
|
+
"inputSelector": "[contenteditable=\"true\"][role=\"textbox\"]",
|
|
31
|
+
"settings": {
|
|
32
|
+
"approvalAlert": {
|
|
33
|
+
"type": "boolean",
|
|
34
|
+
"default": true,
|
|
35
|
+
"public": true,
|
|
36
|
+
"label": "Approval Notifications",
|
|
37
|
+
"description": "Show notification when approval is needed"
|
|
38
|
+
},
|
|
39
|
+
"longGeneratingAlert": {
|
|
40
|
+
"type": "boolean",
|
|
41
|
+
"default": true,
|
|
42
|
+
"public": true,
|
|
43
|
+
"label": "Long Generation Alert",
|
|
44
|
+
"description": "Alert when generation takes too long"
|
|
45
|
+
},
|
|
46
|
+
"longGeneratingThresholdSec": {
|
|
47
|
+
"type": "number",
|
|
48
|
+
"default": 180,
|
|
49
|
+
"public": true,
|
|
50
|
+
"label": "Long Generation Threshold (sec)",
|
|
51
|
+
"min": 30,
|
|
52
|
+
"max": 600
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "vscodium",
|
|
3
|
+
"name": "VSCodium",
|
|
4
|
+
"category": "ide",
|
|
5
|
+
"displayName": "VSCodium",
|
|
6
|
+
"icon": "💚",
|
|
7
|
+
"cli": "codium",
|
|
8
|
+
"cdpPorts": [
|
|
9
|
+
9343,
|
|
10
|
+
9344
|
|
11
|
+
],
|
|
12
|
+
"processNames": {
|
|
13
|
+
"darwin": "VSCodium",
|
|
14
|
+
"win32": [
|
|
15
|
+
"VSCodium.exe"
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
"paths": {
|
|
19
|
+
"darwin": [
|
|
20
|
+
"/Applications/VSCodium.app"
|
|
21
|
+
],
|
|
22
|
+
"win32": [
|
|
23
|
+
"C:\\Program Files\\VSCodium\\VSCodium.exe"
|
|
24
|
+
],
|
|
25
|
+
"linux": [
|
|
26
|
+
"/usr/share/codium",
|
|
27
|
+
"/snap/codium/current"
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
"inputMethod": "cdp-type-and-send",
|
|
31
|
+
"inputSelector": "[contenteditable=\"true\"][role=\"textbox\"]",
|
|
32
|
+
"settings": {
|
|
33
|
+
"approvalAlert": {
|
|
34
|
+
"type": "boolean",
|
|
35
|
+
"default": true,
|
|
36
|
+
"public": true,
|
|
37
|
+
"label": "Approval Notifications",
|
|
38
|
+
"description": "Show notification when approval is needed"
|
|
39
|
+
},
|
|
40
|
+
"longGeneratingAlert": {
|
|
41
|
+
"type": "boolean",
|
|
42
|
+
"default": true,
|
|
43
|
+
"public": true,
|
|
44
|
+
"label": "Long Generation Alert",
|
|
45
|
+
"description": "Alert when generation takes too long"
|
|
46
|
+
},
|
|
47
|
+
"longGeneratingThresholdSec": {
|
|
48
|
+
"type": "number",
|
|
49
|
+
"default": 180,
|
|
50
|
+
"public": true,
|
|
51
|
+
"label": "Long Generation Threshold (sec)",
|
|
52
|
+
"min": 30,
|
|
53
|
+
"max": 600
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "windsurf",
|
|
3
|
+
"name": "Windsurf",
|
|
4
|
+
"category": "ide",
|
|
5
|
+
"displayName": "Windsurf",
|
|
6
|
+
"icon": "🏄",
|
|
7
|
+
"cli": "windsurf",
|
|
8
|
+
"cdpPorts": [
|
|
9
|
+
9337,
|
|
10
|
+
9338
|
|
11
|
+
],
|
|
12
|
+
"processNames": {
|
|
13
|
+
"darwin": "Windsurf"
|
|
14
|
+
},
|
|
15
|
+
"paths": {
|
|
16
|
+
"darwin": [
|
|
17
|
+
"/Applications/Windsurf.app"
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
"inputMethod": "cdp-type-and-send",
|
|
21
|
+
"inputSelector": "[contenteditable=\"true\"][role=\"textbox\"]",
|
|
22
|
+
"settings": {
|
|
23
|
+
"approvalAlert": {
|
|
24
|
+
"type": "boolean",
|
|
25
|
+
"default": true,
|
|
26
|
+
"public": true,
|
|
27
|
+
"label": "Approval Notifications",
|
|
28
|
+
"description": "Show notification when approval is needed"
|
|
29
|
+
},
|
|
30
|
+
"longGeneratingAlert": {
|
|
31
|
+
"type": "boolean",
|
|
32
|
+
"default": true,
|
|
33
|
+
"public": true,
|
|
34
|
+
"label": "Long Generation Alert",
|
|
35
|
+
"description": "Alert when generation takes too long"
|
|
36
|
+
},
|
|
37
|
+
"longGeneratingThresholdSec": {
|
|
38
|
+
"type": "number",
|
|
39
|
+
"default": 180,
|
|
40
|
+
"public": true,
|
|
41
|
+
"label": "Long Generation Threshold (sec)",
|
|
42
|
+
"min": 30,
|
|
43
|
+
"max": 600
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CDP Scripts for Windsurf
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
const SCRIPTS_DIR = path.join(__dirname, 'scripts');
|
|
8
|
+
function loadScript(name) {
|
|
9
|
+
try { return fs.readFileSync(path.join(SCRIPTS_DIR, name), 'utf8'); }
|
|
10
|
+
catch { return null; }
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
module.exports.readChat = function readChat() { return loadScript('read_chat.js'); };
|
|
15
|
+
|
|
16
|
+
module.exports.sendMessage = function sendMessage(text) {
|
|
17
|
+
const s = loadScript('send_message.js');
|
|
18
|
+
return s ? s.replace(/\$\{\s*MESSAGE\s*\}/g, JSON.stringify(text)) : null;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
module.exports.listSessions = function listSessions() { return loadScript('list_chats.js'); };
|
|
22
|
+
|
|
23
|
+
module.exports.switchSession = function switchSession(sessionId) {
|
|
24
|
+
const s = loadScript('switch_session.js');
|
|
25
|
+
return s ? s.replace(/\$\{\s*SESSION_ID\s*\}/g, JSON.stringify(sessionId)) : null;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
module.exports.newSession = function newSession() { return loadScript('new_session.js'); };
|
|
29
|
+
|
|
30
|
+
module.exports.resolveAction = function resolveAction(params) {
|
|
31
|
+
const action = typeof params === 'string' ? params : params?.action || 'approve';
|
|
32
|
+
const buttonText = params?.button || params?.buttonText
|
|
33
|
+
|| (action === 'approve' ? 'Accept' : action === 'reject' ? 'Reject' : action);
|
|
34
|
+
const s = loadScript('resolve_action.js');
|
|
35
|
+
return s ? s.replace(/\$\{\s*BUTTON_TEXT\s*\}/g, JSON.stringify(buttonText)) : null;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
module.exports.focusEditor = function focusEditor() { return loadScript('focus_editor.js'); };
|
|
39
|
+
|
|
40
|
+
module.exports.listModels = function listModels() { return loadScript('list_models.js'); };
|
|
41
|
+
|
|
42
|
+
module.exports.setModel = function setModel(params) {
|
|
43
|
+
const model = typeof params === 'string' ? params : params?.model;
|
|
44
|
+
const s = loadScript('set_model.js');
|
|
45
|
+
return s ? s.replace(/\$\{\s*MODEL\s*\}/g, JSON.stringify(model)) : null;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
module.exports.listModes = function listModes() { return loadScript('list_modes.js'); };
|
|
49
|
+
|
|
50
|
+
module.exports.setMode = function setMode(params) {
|
|
51
|
+
const mode = typeof params === 'string' ? params : params?.mode;
|
|
52
|
+
const s = loadScript('set_mode.js');
|
|
53
|
+
return s ? s.replace(/\$\{\s*MODE\s*\}/g, JSON.stringify(mode)) : null;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
module.exports.openPanel = function openPanel() { return loadScript('open_panel.js'); };
|
|
57
|
+
|
package/README.md
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
# adhdev
|
|
2
|
-
|
|
3
|
-
**ADHDev CLI** — Setup wizard for the ADHDev platform. Detect, install, and configure IDE + AI agent extensions.
|
|
4
|
-
|
|
5
|
-
## Quick Start
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npx adhdev
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
Or install globally:
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
npm install -g adhdev
|
|
15
|
-
adhdev setup
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Commands
|
|
19
|
-
|
|
20
|
-
| Command | Description |
|
|
21
|
-
|---------|-------------|
|
|
22
|
-
| `adhdev setup` | Interactive setup wizard |
|
|
23
|
-
| `adhdev status` | Show current configuration |
|
|
24
|
-
| `adhdev detect` | Detect installed IDEs |
|
|
25
|
-
| `adhdev reset` | Reset all configuration |
|
|
26
|
-
|
|
27
|
-
## Supported IDEs
|
|
28
|
-
|
|
29
|
-
- ✅ VS Code
|
|
30
|
-
- ✅ Cursor
|
|
31
|
-
- ✅ Antigravity
|
|
32
|
-
- 🔜 JetBrains (coming soon)
|
|
33
|
-
|
|
34
|
-
## What it does
|
|
35
|
-
|
|
36
|
-
1. **Detects** installed IDEs on your system
|
|
37
|
-
2. **Installs** the ADHDev Bridge extension
|
|
38
|
-
3. **Configures** connection to your ADHDev dashboard
|
|
39
|
-
4. **Verifies** the setup is working
|
|
40
|
-
|
|
41
|
-
## License
|
|
42
|
-
|
|
43
|
-
Proprietary — All rights reserved.
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
require.config({ paths: { vs: 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.52.2/min/vs' } });
|
|
2
|
-
|
|
3
|
-
require(['vs/editor/editor.main'], function() {
|
|
4
|
-
// ─── Custom Dark Theme ───
|
|
5
|
-
monaco.editor.defineTheme('adhdev-dark', {
|
|
6
|
-
base: 'vs-dark',
|
|
7
|
-
inherit: true,
|
|
8
|
-
rules: [
|
|
9
|
-
{ token: 'comment', foreground: '6a9955', fontStyle: 'italic' },
|
|
10
|
-
{ token: 'keyword', foreground: 'c586c0' },
|
|
11
|
-
{ token: 'string', foreground: 'ce9178' },
|
|
12
|
-
{ token: 'number', foreground: 'b5cea8' },
|
|
13
|
-
{ token: 'type', foreground: '4ec9b0' },
|
|
14
|
-
{ token: 'identifier', foreground: '9cdcfe' },
|
|
15
|
-
{ token: 'delimiter', foreground: 'd4d4d4' },
|
|
16
|
-
],
|
|
17
|
-
colors: {
|
|
18
|
-
'editor.background': '#0d1117',
|
|
19
|
-
'editor.foreground': '#c9d1d9',
|
|
20
|
-
'editor.lineHighlightBackground': '#161b2280',
|
|
21
|
-
'editorLineNumber.foreground': '#484f58',
|
|
22
|
-
'editorLineNumber.activeForeground': '#8b949e',
|
|
23
|
-
'editor.selectionBackground': '#264f7840',
|
|
24
|
-
'editorCursor.foreground': '#58a6ff',
|
|
25
|
-
'editor.inactiveSelectionBackground': '#264f7820',
|
|
26
|
-
'editorGutter.background': '#0d1117',
|
|
27
|
-
'minimap.background': '#0d1117',
|
|
28
|
-
'editorWidget.background': '#161b22',
|
|
29
|
-
'editorSuggestWidget.background': '#161b22',
|
|
30
|
-
'editorSuggestWidget.border': '#30363d',
|
|
31
|
-
'editorSuggestWidget.selectedBackground': '#1f6feb40',
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
// ─── Helper Function Typedefs (autocomplete) ───
|
|
36
|
-
const helperDefs = `
|
|
37
|
-
/** Log a message to DevConsole output */
|
|
38
|
-
declare function log(message: any, ...args: any[]): void;
|
|
39
|
-
/** Probe an element — returns bounds, styles, attributes */
|
|
40
|
-
declare function probe(el: Element, opts?: { bounds?: boolean, styles?: string[], attributes?: boolean }): { tag: string, id: string, classes: string[], bounds?: DOMRect, styles?: Record<string, string>, attributes?: Record<string, string> };
|
|
41
|
-
/** Query all elements matching selector, returns summary array */
|
|
42
|
-
declare function queryAll(selector: string, limit?: number): Array<{ index: number, tag: string, text: string, visible: boolean, bounds: DOMRect }>;
|
|
43
|
-
/** Click an element by selector */
|
|
44
|
-
declare function click(selector: string): boolean;
|
|
45
|
-
/** Wait for an element to appear (polls) */
|
|
46
|
-
declare function waitFor(selector: string, timeoutMs?: number): Promise<Element | null>;
|
|
47
|
-
/** Get computed style value */
|
|
48
|
-
declare function getStyle(el: Element, prop: string): string;
|
|
49
|
-
/** Sleep for ms */
|
|
50
|
-
declare function sleep(ms: number): Promise<void>;
|
|
51
|
-
`;
|
|
52
|
-
monaco.languages.typescript.javascriptDefaults.addExtraLib(helperDefs, 'helpers.d.ts');
|
|
53
|
-
monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
|
|
54
|
-
noSemanticValidation: true,
|
|
55
|
-
noSyntaxValidation: false,
|
|
56
|
-
});
|
|
57
|
-
monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
|
|
58
|
-
target: monaco.languages.typescript.ScriptTarget.ES2020,
|
|
59
|
-
allowNonTsExtensions: true,
|
|
60
|
-
allowJs: true,
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
const defaultCode = `// Write JS to evaluate via CDP — Ctrl+Enter to run
|
|
64
|
-
// Helpers: log(), probe(), queryAll(), click(), waitFor()
|
|
65
|
-
|
|
66
|
-
(() => {
|
|
67
|
-
const title = document.title;
|
|
68
|
-
log('Page title:', title);
|
|
69
|
-
return title;
|
|
70
|
-
})()`;
|
|
71
|
-
|
|
72
|
-
const container = document.getElementById('editor-container');
|
|
73
|
-
const monacoEditor = monaco.editor.create(container, {
|
|
74
|
-
value: defaultCode,
|
|
75
|
-
language: 'javascript',
|
|
76
|
-
theme: 'adhdev-dark',
|
|
77
|
-
fontFamily: "'JetBrains Mono', monospace",
|
|
78
|
-
fontSize: 13,
|
|
79
|
-
lineHeight: 22,
|
|
80
|
-
minimap: { enabled: true, scale: 1, showSlider: 'mouseover' },
|
|
81
|
-
scrollBeyondLastLine: false,
|
|
82
|
-
renderLineHighlight: 'all',
|
|
83
|
-
cursorBlinking: 'smooth',
|
|
84
|
-
cursorSmoothCaretAnimation: 'on',
|
|
85
|
-
smoothScrolling: true,
|
|
86
|
-
bracketPairColorization: { enabled: true },
|
|
87
|
-
autoIndent: 'full',
|
|
88
|
-
formatOnPaste: true,
|
|
89
|
-
tabSize: 2,
|
|
90
|
-
wordWrap: 'on',
|
|
91
|
-
padding: { top: 8 },
|
|
92
|
-
suggest: {
|
|
93
|
-
showKeywords: true,
|
|
94
|
-
showSnippets: true,
|
|
95
|
-
showFunctions: true,
|
|
96
|
-
},
|
|
97
|
-
quickSuggestions: true,
|
|
98
|
-
parameterHints: { enabled: true },
|
|
99
|
-
automaticLayout: true,
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
// Ctrl+Enter → Run
|
|
103
|
-
monacoEditor.addAction({
|
|
104
|
-
id: 'run-script',
|
|
105
|
-
label: 'Run Script',
|
|
106
|
-
keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.Enter],
|
|
107
|
-
run: () => window.runEditor?.(),
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
// ─── Proxy textarea.value → Monaco ───
|
|
111
|
-
const ta = document.getElementById('editor');
|
|
112
|
-
Object.defineProperty(ta, 'value', {
|
|
113
|
-
get() { return monacoEditor.getValue(); },
|
|
114
|
-
set(v) { monacoEditor.setValue(v); },
|
|
115
|
-
});
|
|
116
|
-
ta.focus = () => monacoEditor.focus();
|
|
117
|
-
|
|
118
|
-
window.monacoEditor = monacoEditor;
|
|
119
|
-
|
|
120
|
-
// ─── Snippets ───
|
|
121
|
-
monaco.languages.registerCompletionItemProvider('javascript', {
|
|
122
|
-
provideCompletionItems: (model, position) => {
|
|
123
|
-
const word = model.getWordUntilPosition(position);
|
|
124
|
-
const range = {
|
|
125
|
-
startLineNumber: position.lineNumber,
|
|
126
|
-
endLineNumber: position.lineNumber,
|
|
127
|
-
startColumn: word.startColumn,
|
|
128
|
-
endColumn: word.endColumn,
|
|
129
|
-
};
|
|
130
|
-
return {
|
|
131
|
-
suggestions: [
|
|
132
|
-
{
|
|
133
|
-
label: 'iife',
|
|
134
|
-
kind: monaco.languages.CompletionItemKind.Snippet,
|
|
135
|
-
insertText: '(() => {\n ${1:// code}\n return ${2:result};\n})()',
|
|
136
|
-
insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
137
|
-
documentation: 'Immediately Invoked Function Expression (CDP pattern)',
|
|
138
|
-
range,
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
label: 'aiife',
|
|
142
|
-
kind: monaco.languages.CompletionItemKind.Snippet,
|
|
143
|
-
insertText: '(async () => {\n ${1:// async code}\n return ${2:result};\n})()',
|
|
144
|
-
insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
145
|
-
documentation: 'Async IIFE (for await/Promise)',
|
|
146
|
-
range,
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
label: 'qsa',
|
|
150
|
-
kind: monaco.languages.CompletionItemKind.Snippet,
|
|
151
|
-
insertText: "[...document.querySelectorAll('${1:selector}')].map(el => ({\n tag: el.tagName,\n text: el.textContent?.trim().substring(0, 100),\n visible: el.offsetWidth > 0,\n}))",
|
|
152
|
-
insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
153
|
-
documentation: 'QuerySelectorAll with element mapping',
|
|
154
|
-
range,
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
label: 'readchat',
|
|
158
|
-
kind: monaco.languages.CompletionItemKind.Snippet,
|
|
159
|
-
insertText: "(() => {\n const msgs = [];\n document.querySelectorAll('${1:.message}').forEach((el, i) => {\n msgs.push({\n role: el.classList.contains('${2:user}') ? 'user' : 'assistant',\n content: el.textContent.trim().substring(0, 6000),\n index: i,\n });\n });\n return JSON.stringify({ messages: msgs, status: 'idle' });\n})()",
|
|
160
|
-
insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
161
|
-
documentation: 'readChat template',
|
|
162
|
-
range,
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
label: 'probe',
|
|
166
|
-
kind: monaco.languages.CompletionItemKind.Snippet,
|
|
167
|
-
insertText: "(() => {\n const el = document.querySelector('${1:selector}');\n if (!el) return JSON.stringify({ error: 'not found' });\n const r = el.getBoundingClientRect();\n return JSON.stringify({\n tag: el.tagName, id: el.id,\n classes: [...el.classList],\n text: el.textContent?.trim().substring(0, 200),\n bounds: { top: r.top, left: r.left, width: r.width, height: r.height },\n styles: { color: getComputedStyle(el).color, bg: getComputedStyle(el).background },\n attrs: Object.fromEntries([...el.attributes].map(a => [a.name, a.value])),\n });\n})()",
|
|
168
|
-
insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
169
|
-
documentation: 'Probe element details (bounds, styles, attrs)',
|
|
170
|
-
range,
|
|
171
|
-
},
|
|
172
|
-
],
|
|
173
|
-
};
|
|
174
|
-
},
|
|
175
|
-
});
|
|
176
|
-
});
|