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.
Files changed (131) hide show
  1. package/dist/cli-entrypoint.js +29083 -0
  2. package/dist/cli-entrypoint.js.map +1 -0
  3. package/dist/index.js +26970 -11054
  4. package/dist/index.js.map +1 -0
  5. package/package.json +19 -16
  6. package/providers/_builtin/COMPATIBILITY.md +217 -0
  7. package/providers/_builtin/acp/agentpool/provider.json +54 -0
  8. package/providers/_builtin/acp/amp/provider.json +52 -0
  9. package/providers/_builtin/acp/auggie/provider.json +57 -0
  10. package/providers/_builtin/acp/autodev/provider.json +54 -0
  11. package/providers/_builtin/acp/autohand/provider.json +52 -0
  12. package/providers/_builtin/acp/blackbox-ai/provider.json +54 -0
  13. package/providers/_builtin/acp/claude-agent/provider.json +57 -0
  14. package/providers/_builtin/acp/cline-acp/provider.json +54 -0
  15. package/providers/_builtin/acp/codebuddy/provider.json +54 -0
  16. package/providers/_builtin/acp/codex-cli/provider.json +57 -0
  17. package/providers/_builtin/acp/corust-agent/provider.json +52 -0
  18. package/providers/_builtin/acp/crow-cli/provider.json +54 -0
  19. package/providers/_builtin/acp/cursor-acp/provider.json +54 -0
  20. package/providers/_builtin/acp/deepagents/provider.json +52 -0
  21. package/providers/_builtin/acp/dimcode/provider.json +54 -0
  22. package/providers/_builtin/acp/docker-cagent/provider.json +57 -0
  23. package/providers/_builtin/acp/factory-droid/provider.json +60 -0
  24. package/providers/_builtin/acp/fast-agent/provider.json +52 -0
  25. package/providers/_builtin/acp/gemini-cli/provider.json +114 -0
  26. package/providers/_builtin/acp/github-copilot/provider.json +54 -0
  27. package/providers/_builtin/acp/goose/provider.json +57 -0
  28. package/providers/_builtin/acp/junie/provider.json +52 -0
  29. package/providers/_builtin/acp/kilo/provider.json +54 -0
  30. package/providers/_builtin/acp/kimi-cli/provider.json +57 -0
  31. package/providers/_builtin/acp/minion-code/provider.json +52 -0
  32. package/providers/_builtin/acp/mistral-vibe/provider.json +57 -0
  33. package/providers/_builtin/acp/nova/provider.json +54 -0
  34. package/providers/_builtin/acp/openclaw/provider.json +54 -0
  35. package/providers/_builtin/acp/opencode/provider.json +52 -0
  36. package/providers/_builtin/acp/openhands/provider.json +54 -0
  37. package/providers/_builtin/acp/pi-acp/provider.json +52 -0
  38. package/providers/_builtin/acp/qoder/provider.json +54 -0
  39. package/providers/_builtin/acp/qwen-code/provider.json +60 -0
  40. package/providers/_builtin/acp/stakpak/provider.json +54 -0
  41. package/providers/_builtin/acp/vtcode/provider.json +54 -0
  42. package/providers/_builtin/cli/claude-cli/provider.json +100 -0
  43. package/providers/_builtin/cli/codex-cli/provider.json +89 -0
  44. package/providers/_builtin/cli/gemini-cli/provider.json +93 -0
  45. package/providers/_builtin/docs/CDP_SELECTOR_GUIDE.md +370 -0
  46. package/providers/_builtin/docs/PROVIDER_GUIDE.md +916 -0
  47. package/providers/_builtin/extension/cline/provider.json +35 -0
  48. package/providers/_builtin/extension/cline/scripts/open_panel.js +1 -1
  49. package/providers/_builtin/extension/cline/{provider.js → scripts.js} +29 -55
  50. package/providers/_builtin/extension/roo-code/provider.json +35 -0
  51. package/providers/_builtin/extension/roo-code/{provider.js → scripts.js} +27 -97
  52. package/providers/_builtin/ide/antigravity/provider.json +63 -0
  53. package/providers/_builtin/ide/antigravity/scripts/legacy/list_models.js +38 -0
  54. package/providers/_builtin/ide/antigravity/scripts/legacy/list_modes.js +48 -0
  55. package/providers/_builtin/ide/antigravity/scripts/legacy/scripts.js +64 -0
  56. package/providers/_builtin/ide/antigravity/scripts/legacy/set_mode.js +34 -0
  57. package/providers/_builtin/ide/antigravity/scripts/legacy/set_model.js +47 -0
  58. package/providers/_builtin/ide/antigravity/scripts/list_models.js +31 -8
  59. package/providers/_builtin/ide/antigravity/scripts/list_modes.js +37 -13
  60. package/providers/_builtin/ide/antigravity/scripts/set_mode.js +49 -16
  61. package/providers/_builtin/ide/antigravity/scripts/set_model.js +47 -22
  62. package/providers/_builtin/ide/antigravity/scripts.js +67 -0
  63. package/providers/_builtin/ide/cursor/provider.json +59 -0
  64. package/providers/_builtin/ide/cursor/{provider.js → scripts.js} +47 -79
  65. package/providers/_builtin/ide/kiro/provider.json +60 -0
  66. package/providers/_builtin/ide/kiro/scripts.js +62 -0
  67. package/providers/_builtin/ide/pearai/provider.json +60 -0
  68. package/providers/_builtin/ide/pearai/scripts.js +74 -0
  69. package/providers/_builtin/ide/trae/provider.json +59 -0
  70. package/providers/_builtin/ide/trae/scripts.js +57 -0
  71. package/providers/_builtin/ide/vscode/provider.json +57 -0
  72. package/providers/_builtin/ide/vscode-insiders/provider.json +55 -0
  73. package/providers/_builtin/ide/vscodium/provider.json +56 -0
  74. package/providers/_builtin/ide/windsurf/provider.json +46 -0
  75. package/providers/_builtin/ide/windsurf/scripts.js +57 -0
  76. package/README.md +0 -43
  77. package/dist/dev-console-monaco.js +0 -176
  78. package/dist/dev-console.css +0 -326
  79. package/dist/dev-console.html +0 -148
  80. package/dist/dev-console.js +0 -1165
  81. package/dist/index.d.ts +0 -2
  82. package/providers/_builtin/acp/agentpool/provider.js +0 -59
  83. package/providers/_builtin/acp/amp/provider.js +0 -61
  84. package/providers/_builtin/acp/auggie/provider.js +0 -60
  85. package/providers/_builtin/acp/autodev/provider.js +0 -59
  86. package/providers/_builtin/acp/autohand/provider.js +0 -59
  87. package/providers/_builtin/acp/blackbox-ai/provider.js +0 -59
  88. package/providers/_builtin/acp/claude-agent/provider.js +0 -61
  89. package/providers/_builtin/acp/cline-acp/provider.js +0 -62
  90. package/providers/_builtin/acp/code-assistant/provider.js +0 -59
  91. package/providers/_builtin/acp/codebuddy/provider.js +0 -59
  92. package/providers/_builtin/acp/codex-cli/provider.js +0 -64
  93. package/providers/_builtin/acp/corust-agent/provider.js +0 -59
  94. package/providers/_builtin/acp/crow-cli/provider.js +0 -59
  95. package/providers/_builtin/acp/cursor-acp/provider.js +0 -59
  96. package/providers/_builtin/acp/deepagents/provider.js +0 -59
  97. package/providers/_builtin/acp/dimcode/provider.js +0 -58
  98. package/providers/_builtin/acp/docker-cagent/provider.js +0 -59
  99. package/providers/_builtin/acp/factory-droid/provider.js +0 -59
  100. package/providers/_builtin/acp/fast-agent/provider.js +0 -59
  101. package/providers/_builtin/acp/fount/provider.js +0 -59
  102. package/providers/_builtin/acp/gemini-cli/provider.js +0 -104
  103. package/providers/_builtin/acp/github-copilot/provider.js +0 -60
  104. package/providers/_builtin/acp/goose/provider.js +0 -64
  105. package/providers/_builtin/acp/junie/provider.js +0 -62
  106. package/providers/_builtin/acp/kilo/provider.js +0 -59
  107. package/providers/_builtin/acp/kimi-cli/provider.js +0 -63
  108. package/providers/_builtin/acp/kiro-cli/provider.js +0 -59
  109. package/providers/_builtin/acp/minion-code/provider.js +0 -59
  110. package/providers/_builtin/acp/mistral-vibe/provider.js +0 -63
  111. package/providers/_builtin/acp/nova/provider.js +0 -59
  112. package/providers/_builtin/acp/openclaw/provider.js +0 -59
  113. package/providers/_builtin/acp/opencode/provider.js +0 -60
  114. package/providers/_builtin/acp/openhands/provider.js +0 -59
  115. package/providers/_builtin/acp/pi-acp/provider.js +0 -59
  116. package/providers/_builtin/acp/qoder/provider.js +0 -58
  117. package/providers/_builtin/acp/qwen-code/provider.js +0 -61
  118. package/providers/_builtin/acp/stakpak/provider.js +0 -59
  119. package/providers/_builtin/acp/vtcode/provider.js +0 -59
  120. package/providers/_builtin/cli/claude-cli/provider.js +0 -128
  121. package/providers/_builtin/cli/codex-cli/provider.js +0 -80
  122. package/providers/_builtin/cli/gemini-cli/provider.js +0 -124
  123. package/providers/_builtin/ide/antigravity/provider.js +0 -114
  124. package/providers/_builtin/ide/kiro/provider.js +0 -90
  125. package/providers/_builtin/ide/pearai/provider.js +0 -100
  126. package/providers/_builtin/ide/trae/provider.js +0 -83
  127. package/providers/_builtin/ide/vscode/provider.js +0 -36
  128. package/providers/_builtin/ide/vscode-insiders/provider.js +0 -27
  129. package/providers/_builtin/ide/vscodium/provider.js +0 -27
  130. package/providers/_builtin/ide/windsurf/provider.js +0 -76
  131. 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
- });