adhdev 0.1.42 → 0.1.44
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/index.js +7 -0
- package/package.json +2 -1
- package/providers/_builtin/cli/claude-cli/provider.js +125 -0
- package/providers/_builtin/cli/codex-cli/provider.js +77 -0
- package/providers/_builtin/cli/gemini-cli/provider.js +121 -0
- package/providers/_builtin/extension/cline/provider.js +77 -0
- package/providers/_builtin/extension/cline/scripts/focus_editor.js +48 -0
- package/providers/_builtin/extension/cline/scripts/list_chats.js +100 -0
- package/providers/_builtin/extension/cline/scripts/new_session.js +85 -0
- package/providers/_builtin/extension/cline/scripts/open_panel.js +25 -0
- package/providers/_builtin/extension/cline/scripts/read_chat.js +257 -0
- package/providers/_builtin/extension/cline/scripts/resolve_action.js +83 -0
- package/providers/_builtin/extension/cline/scripts/send_message.js +95 -0
- package/providers/_builtin/extension/cline/scripts/switch_session.js +206 -0
- package/providers/_builtin/extension/roo-code/provider.js +578 -0
- package/providers/_builtin/ide/antigravity/provider.js +92 -0
- package/providers/_builtin/ide/antigravity/scripts/focus_editor.js +20 -0
- package/providers/_builtin/ide/antigravity/scripts/list_chats.js +137 -0
- package/providers/_builtin/ide/antigravity/scripts/new_session.js +75 -0
- package/providers/_builtin/ide/antigravity/scripts/read_chat.js +240 -0
- package/providers/_builtin/ide/antigravity/scripts/resolve_action.js +64 -0
- package/providers/_builtin/ide/antigravity/scripts/send_message.js +56 -0
- package/providers/_builtin/ide/antigravity/scripts/switch_session.js +114 -0
- package/providers/_builtin/ide/cursor/provider.js +242 -0
- package/providers/_builtin/ide/cursor/provider.js.backup +116 -0
- package/providers/_builtin/ide/cursor/provider.js.bak +127 -0
- package/providers/_builtin/ide/cursor/scripts_backup/focus_editor.js +20 -0
- package/providers/_builtin/ide/cursor/scripts_backup/list_chats.js +111 -0
- package/providers/_builtin/ide/cursor/scripts_backup/new_session.js +62 -0
- package/providers/_builtin/ide/cursor/scripts_backup/open_panel.js +31 -0
- package/providers/_builtin/ide/cursor/scripts_backup/read_chat.js +433 -0
- package/providers/_builtin/ide/cursor/scripts_backup/resolve_action.js +90 -0
- package/providers/_builtin/ide/cursor/scripts_backup/send_message.js +86 -0
- package/providers/_builtin/ide/cursor/scripts_backup/switch_session.js +63 -0
- package/providers/_builtin/ide/vscode/provider.js +36 -0
- package/providers/_builtin/ide/vscode-insiders/provider.js +27 -0
- package/providers/_builtin/ide/vscodium/provider.js +27 -0
- package/providers/_builtin/ide/windsurf/provider.js +64 -0
- package/providers/_builtin/ide/windsurf/scripts/focus_editor.js +30 -0
- package/providers/_builtin/ide/windsurf/scripts/list_chats.js +117 -0
- package/providers/_builtin/ide/windsurf/scripts/new_session.js +69 -0
- package/providers/_builtin/ide/windsurf/scripts/open_panel.js +58 -0
- package/providers/_builtin/ide/windsurf/scripts/read_chat.js +297 -0
- package/providers/_builtin/ide/windsurf/scripts/resolve_action.js +68 -0
- package/providers/_builtin/ide/windsurf/scripts/send_message.js +87 -0
- package/providers/_builtin/ide/windsurf/scripts/switch_session.js +58 -0
- package/providers/_helpers/index.js +188 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider Helpers — 공유 유틸리티
|
|
3
|
+
*
|
|
4
|
+
* 각 provider.js에서 require해 사용할 수 있는 공통 함수들.
|
|
5
|
+
* 사용은 선택사항 — 각 provider.js는 독립적이어도 됨.
|
|
6
|
+
*
|
|
7
|
+
* 사용법 (provider.js 내부):
|
|
8
|
+
* const { getWebviewDoc, htmlToMd, waitFor } = require('../../_helpers/index.js');
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Extension webview iframe의 contentDocument 접근
|
|
13
|
+
* @param {string} [selector='iframe'] - iframe 셀렉터
|
|
14
|
+
* @returns {string} CDP evaluate용 JS 코드 (document 변수를 설정)
|
|
15
|
+
*/
|
|
16
|
+
function getWebviewDoc(selector = 'iframe') {
|
|
17
|
+
return `
|
|
18
|
+
const _iframe = document.querySelector('${selector}');
|
|
19
|
+
const _doc = _iframe ? (_iframe.contentDocument || _iframe.contentWindow?.document) : document;
|
|
20
|
+
`;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* React Fiber 데이터 추출 헬퍼 코드
|
|
25
|
+
* 특정 엔트리 포인트에서 시작해 memoizedState를 순회
|
|
26
|
+
* @param {string[]} entrySelectors - 엔트리 포인트 CSS 셀렉터
|
|
27
|
+
* @param {number} [maxDepth=200] - Fiber 트리 최대 순회 깊이
|
|
28
|
+
* @returns {string} CDP evaluate용 JS 코드 (변수 _fiberData를 설정)
|
|
29
|
+
*/
|
|
30
|
+
function getFiber(entrySelectors, maxDepth = 200) {
|
|
31
|
+
const sels = JSON.stringify(entrySelectors);
|
|
32
|
+
return `
|
|
33
|
+
let _fiberData = null;
|
|
34
|
+
const _entryPoints = ${sels};
|
|
35
|
+
for (const sel of _entryPoints) {
|
|
36
|
+
const el = document.querySelector(sel);
|
|
37
|
+
if (!el) continue;
|
|
38
|
+
const fk = Object.keys(el).find(k => k.startsWith('__reactFiber'));
|
|
39
|
+
if (!fk) continue;
|
|
40
|
+
let fib = el[fk];
|
|
41
|
+
for (let d = 0; d < ${maxDepth} && fib; d++) {
|
|
42
|
+
if (fib.memoizedState) {
|
|
43
|
+
let s = fib.memoizedState;
|
|
44
|
+
while (s) {
|
|
45
|
+
try {
|
|
46
|
+
const memo = s.memoizedState;
|
|
47
|
+
if (memo && typeof memo === 'object') {
|
|
48
|
+
_fiberData = memo;
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
} catch(e) {}
|
|
52
|
+
s = s.next;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (_fiberData) break;
|
|
56
|
+
fib = fib.return;
|
|
57
|
+
}
|
|
58
|
+
if (_fiberData) break;
|
|
59
|
+
}
|
|
60
|
+
`;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* 텍스트 입력 + Enter 전송 코드 생성
|
|
65
|
+
* @param {string} varName - 텍스트가 저장된 변수명
|
|
66
|
+
* @param {string} selectorExpr - 에디터 요소 참조 JS 표현식
|
|
67
|
+
* @returns {string} CDP evaluate용 JS 코드
|
|
68
|
+
*/
|
|
69
|
+
function typeAndSubmit(varName, selectorExpr) {
|
|
70
|
+
return `
|
|
71
|
+
const _editor = ${selectorExpr};
|
|
72
|
+
if (_editor) {
|
|
73
|
+
_editor.focus();
|
|
74
|
+
document.execCommand('selectAll', false, null);
|
|
75
|
+
document.execCommand('delete', false, null);
|
|
76
|
+
document.execCommand('insertText', false, ${varName});
|
|
77
|
+
_editor.dispatchEvent(new Event('input', { bubbles: true }));
|
|
78
|
+
await new Promise(r => setTimeout(r, 300));
|
|
79
|
+
const _enterOpts = { key: 'Enter', code: 'Enter', keyCode: 13, which: 13, bubbles: true, cancelable: true, composed: true };
|
|
80
|
+
_editor.dispatchEvent(new KeyboardEvent('keydown', _enterOpts));
|
|
81
|
+
_editor.dispatchEvent(new KeyboardEvent('keypress', _enterOpts));
|
|
82
|
+
_editor.dispatchEvent(new KeyboardEvent('keyup', _enterOpts));
|
|
83
|
+
}
|
|
84
|
+
`;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* 요소 대기 코드 생성
|
|
89
|
+
* @param {string} selector - CSS 셀렉터
|
|
90
|
+
* @param {number} [timeout=5000] - 최대 대기 시간 (ms)
|
|
91
|
+
* @returns {string} CDP evaluate용 JS 코드 (표현식 → 요소 또는 null)
|
|
92
|
+
*/
|
|
93
|
+
function waitFor(selector, timeout = 5000) {
|
|
94
|
+
return `
|
|
95
|
+
await new Promise((resolve) => {
|
|
96
|
+
const _t = Date.now();
|
|
97
|
+
const _check = () => {
|
|
98
|
+
const el = document.querySelector('${selector}');
|
|
99
|
+
if (el && el.offsetWidth > 0) return resolve(el);
|
|
100
|
+
if (Date.now() - _t > ${timeout}) return resolve(null);
|
|
101
|
+
setTimeout(_check, 200);
|
|
102
|
+
};
|
|
103
|
+
_check();
|
|
104
|
+
})
|
|
105
|
+
`;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* HTML → Markdown 변환 함수 (CDP 코드 문자열)
|
|
110
|
+
* 대시보드가 ReactMarkdown+remarkGfm을 사용하므로 HTML을 GFM으로 변환 필요
|
|
111
|
+
* @returns {string} htmlToMd, childrenToMd 함수 선언 코드
|
|
112
|
+
*/
|
|
113
|
+
function htmlToMdCode() {
|
|
114
|
+
return `
|
|
115
|
+
function htmlToMd(node) {
|
|
116
|
+
if (node.nodeType === 3) return node.textContent || '';
|
|
117
|
+
if (node.nodeType !== 1) return '';
|
|
118
|
+
const tag = node.tagName;
|
|
119
|
+
if (tag === 'STYLE' || tag === 'SCRIPT' || tag === 'SVG') return '';
|
|
120
|
+
if (tag === 'TABLE') {
|
|
121
|
+
const rows = Array.from(node.querySelectorAll('tr'));
|
|
122
|
+
if (rows.length === 0) return '';
|
|
123
|
+
const table = rows.map(tr => Array.from(tr.querySelectorAll('th, td')).map(cell => (cell.textContent || '').trim().replace(/\\|/g, '\\\\|')));
|
|
124
|
+
if (table.length === 0) return '';
|
|
125
|
+
const colCount = Math.max(...table.map(r => r.length));
|
|
126
|
+
const header = table[0];
|
|
127
|
+
const sep = Array(colCount).fill('---');
|
|
128
|
+
const body = table.slice(1);
|
|
129
|
+
let md = '| ' + header.join(' | ') + ' |\\n';
|
|
130
|
+
md += '| ' + sep.join(' | ') + ' |\\n';
|
|
131
|
+
for (const row of body) {
|
|
132
|
+
while (row.length < colCount) row.push('');
|
|
133
|
+
md += '| ' + row.join(' | ') + ' |\\n';
|
|
134
|
+
}
|
|
135
|
+
return '\\n' + md + '\\n';
|
|
136
|
+
}
|
|
137
|
+
if (tag === 'UL') return '\\n' + Array.from(node.children).map(li => '- ' + childrenToMd(li).trim()).join('\\n') + '\\n';
|
|
138
|
+
if (tag === 'OL') return '\\n' + Array.from(node.children).map((li, i) => (i + 1) + '. ' + childrenToMd(li).trim()).join('\\n') + '\\n';
|
|
139
|
+
if (tag === 'LI') return childrenToMd(node);
|
|
140
|
+
if (tag === 'H1') return '\\n# ' + childrenToMd(node).trim() + '\\n';
|
|
141
|
+
if (tag === 'H2') return '\\n## ' + childrenToMd(node).trim() + '\\n';
|
|
142
|
+
if (tag === 'H3') return '\\n### ' + childrenToMd(node).trim() + '\\n';
|
|
143
|
+
if (tag === 'H4') return '\\n#### ' + childrenToMd(node).trim() + '\\n';
|
|
144
|
+
if (tag === 'STRONG' || tag === 'B') return '**' + childrenToMd(node).trim() + '**';
|
|
145
|
+
if (tag === 'EM' || tag === 'I') return '*' + childrenToMd(node).trim() + '*';
|
|
146
|
+
if (tag === 'PRE') {
|
|
147
|
+
const codeEl = node.querySelector('code');
|
|
148
|
+
const lang = codeEl ? (codeEl.className.match(/language-(\\w+)/)?.[1] || '') : '';
|
|
149
|
+
const code = (codeEl || node).textContent || '';
|
|
150
|
+
return '\\n\`\`\`' + lang + '\\n' + code.trim() + '\\n\`\`\`\\n';
|
|
151
|
+
}
|
|
152
|
+
if (tag === 'CODE') {
|
|
153
|
+
if (node.parentElement && node.parentElement.tagName === 'PRE') return node.textContent || '';
|
|
154
|
+
return '\`' + (node.textContent || '').trim() + '\`';
|
|
155
|
+
}
|
|
156
|
+
if (tag === 'BLOCKQUOTE') return '\\n> ' + childrenToMd(node).trim().replace(/\\n/g, '\\n> ') + '\\n';
|
|
157
|
+
if (tag === 'A') return '[' + childrenToMd(node).trim() + '](' + (node.getAttribute('href') || '') + ')';
|
|
158
|
+
if (tag === 'BR') return '\\n';
|
|
159
|
+
if (tag === 'P') return '\\n' + childrenToMd(node).trim() + '\\n';
|
|
160
|
+
return childrenToMd(node);
|
|
161
|
+
}
|
|
162
|
+
function childrenToMd(node) {
|
|
163
|
+
return Array.from(node.childNodes).map(htmlToMd).join('');
|
|
164
|
+
}
|
|
165
|
+
`;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* 노이즈 텍스트 필터링 (상태 메시지, MCP 등)
|
|
170
|
+
* @param {string} text - 원본 텍스트
|
|
171
|
+
* @returns {boolean} true면 노이즈
|
|
172
|
+
*/
|
|
173
|
+
function isNoiseText(text) {
|
|
174
|
+
const low = (text || '').trim().toLowerCase();
|
|
175
|
+
if (low.length > 60) return false;
|
|
176
|
+
if (/^(analyzed\s+\d|edited\s+\d|ran\s+\S|terminal\s|reading|searching)/i.test(low)) return true;
|
|
177
|
+
if (/^(mcp|customizationmcp|serversexport)/i.test(low)) return true;
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
module.exports = {
|
|
182
|
+
getWebviewDoc,
|
|
183
|
+
getFiber,
|
|
184
|
+
typeAndSubmit,
|
|
185
|
+
waitFor,
|
|
186
|
+
htmlToMdCode,
|
|
187
|
+
isNoiseText,
|
|
188
|
+
};
|