cssprobe-cli 0.2.12 → 0.2.14
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/AGENTS.md +4 -5
- package/README.md +1 -1
- package/dist/browser/launcher.d.ts +0 -12
- package/dist/browser/launcher.js +1 -123
- package/dist/cli/program.js +22 -21
- package/dist/collector-bundle.js +30 -3
- package/dist/daemon/daemon.js +4 -23
- package/dist/daemon/daemonEntry.js +13 -0
- package/dist/daemon/session.js +10 -0
- package/dist/engine/analyzer.js +4 -6
- package/dist/engine/collector.js +3 -3
- package/dist/engine/renderers/findings.js +1 -1
- package/dist/engine/specificity.d.ts +6 -0
- package/dist/engine/specificity.js +31 -0
- package/dist/installer/skill-template.js +65 -70
- package/dist/utils/socketConnection.d.ts +0 -1
- package/dist/utils/socketConnection.js +0 -14
- package/package.json +1 -1
- package/dist/daemonEntry.js +0 -1468
|
@@ -40,7 +40,7 @@ function buildSkillMd() {
|
|
|
40
40
|
'npx playwright install chromium',
|
|
41
41
|
BT3,
|
|
42
42
|
'',
|
|
43
|
-
'Verify: ' + BT + 'cssprobe-cli
|
|
43
|
+
'Verify: ' + BT + 'cssprobe-cli status' + BT,
|
|
44
44
|
'',
|
|
45
45
|
'## Command Discovery',
|
|
46
46
|
'',
|
|
@@ -54,20 +54,35 @@ function buildSkillMd() {
|
|
|
54
54
|
'',
|
|
55
55
|
'## Core Workflow: Inspect a Page',
|
|
56
56
|
'',
|
|
57
|
+
'cssprobe-cli is session-based: ' + BT + 'open' + BT + ' starts a browser daemon, then',
|
|
58
|
+
BT + 'inspect' + BT + ' / ' + BT + 'tree' + BT + ' / ' + BT + 'layout' + BT + ' / ' + BT + 'findings' + BT,
|
|
59
|
+
'run against that session. Close the session with ' + BT + 'close' + BT + '.',
|
|
60
|
+
'',
|
|
57
61
|
BT3 + 'bash',
|
|
58
|
-
'#
|
|
59
|
-
'cssprobe-cli
|
|
62
|
+
'# 1. Open a page in a browser session',
|
|
63
|
+
'cssprobe-cli open https://getbootstrap.com/docs/5.3/examples/checkout',
|
|
64
|
+
'',
|
|
65
|
+
'# 2. Inspect with an explicit selector',
|
|
66
|
+
'cssprobe-cli inspect body',
|
|
67
|
+
'',
|
|
68
|
+
'# 3. Auto-detect: when the page has modals/dialogs, "open" already picks a root',
|
|
69
|
+
'# candidate, but inspect still needs a selector or auto-detection from candidates.',
|
|
70
|
+
'# For diagnosis without a selector, use "findings" after open.',
|
|
71
|
+
'',
|
|
72
|
+
'# 4. Close the session when done',
|
|
73
|
+
'cssprobe-cli close',
|
|
74
|
+
BT3,
|
|
60
75
|
'',
|
|
61
|
-
'
|
|
62
|
-
'cssprobe-cli inspect https://getbootstrap.com/docs/5.3/examples/checkout',
|
|
76
|
+
'For local HTML files:',
|
|
63
77
|
'',
|
|
64
|
-
|
|
65
|
-
'cssprobe-cli
|
|
78
|
+
BT3 + 'bash',
|
|
79
|
+
'cssprobe-cli open ./test.html',
|
|
80
|
+
'cssprobe-cli inspect ".container"',
|
|
66
81
|
BT3,
|
|
67
82
|
'',
|
|
68
83
|
'## Login-Protected Pages',
|
|
69
84
|
'',
|
|
70
|
-
'Many pages require authentication.
|
|
85
|
+
'Many pages require authentication. Two approaches:',
|
|
71
86
|
'',
|
|
72
87
|
'### Option A: Import cookies from browser export',
|
|
73
88
|
'',
|
|
@@ -76,15 +91,16 @@ function buildSkillMd() {
|
|
|
76
91
|
'# 2. Import into cssprobe-cli',
|
|
77
92
|
'cssprobe-cli state-import cookies.txt --out ~/.cssprobe-cli/states/mysite.json',
|
|
78
93
|
'',
|
|
79
|
-
'# 3.
|
|
80
|
-
'cssprobe-cli
|
|
94
|
+
'# 3. Open the session with the saved state',
|
|
95
|
+
'cssprobe-cli open https://mysite.com/page --state ~/.cssprobe-cli/states/mysite.json',
|
|
96
|
+
'cssprobe-cli inspect ".target"',
|
|
81
97
|
BT3,
|
|
82
98
|
'',
|
|
83
99
|
'### Option B: Interactive login',
|
|
84
100
|
'',
|
|
85
101
|
BT3 + 'bash',
|
|
86
102
|
'cssprobe-cli open https://mysite.com --headed',
|
|
87
|
-
'# Browser opens -> complete login manually
|
|
103
|
+
'# Browser opens -> complete login manually',
|
|
88
104
|
'',
|
|
89
105
|
'cssprobe-cli inspect .target',
|
|
90
106
|
BT3,
|
|
@@ -95,46 +111,29 @@ function buildSkillMd() {
|
|
|
95
111
|
'cssprobe-cli state-import new-cookies.txt --merge existing.json --out merged.json',
|
|
96
112
|
BT3,
|
|
97
113
|
'',
|
|
98
|
-
'##
|
|
99
|
-
'',
|
|
100
|
-
'For pages that require clicking a button or opening a dialog before inspection:',
|
|
101
|
-
'',
|
|
102
|
-
BT3 + 'bash',
|
|
103
|
-
'cssprobe-cli inspect https://mysite.com/page ".dialog" --state ~/.cssprobe-cli/states/mysite.json --wait',
|
|
104
|
-
'# Browser opens -> perform actions (click, open dialog) -> press Enter -> inspect',
|
|
105
|
-
BT3,
|
|
106
|
-
'',
|
|
107
|
-
'## Interactive Mode (REPL)',
|
|
114
|
+
'## Session Mode (inspect multiple areas)',
|
|
108
115
|
'',
|
|
109
|
-
'
|
|
116
|
+
'Open once, run as many inspections as you need, then close:',
|
|
110
117
|
'',
|
|
111
118
|
BT3 + 'bash',
|
|
112
|
-
'cssprobe-cli
|
|
113
|
-
BT3,
|
|
119
|
+
'cssprobe-cli open https://mysite.com',
|
|
114
120
|
'',
|
|
115
|
-
'
|
|
121
|
+
'cssprobe-cli tree .dialog-A # DOM tree',
|
|
122
|
+
'cssprobe-cli layout .sidebar-B # ASCII layout diagram',
|
|
123
|
+
'cssprobe-cli findings .modal # Findings only',
|
|
124
|
+
'cssprobe-cli inspect .content --json # JSON output',
|
|
125
|
+
'cssprobe-cli inject-css ".sidebar { background: red; }" # inject CSS to test changes',
|
|
116
126
|
'',
|
|
117
|
-
|
|
118
|
-
'inspect> tree .dialog-A # DOM tree',
|
|
119
|
-
'inspect> layout .sidebar-B # ASCII layout diagram',
|
|
120
|
-
'inspect> sketch .content # Tree sketch (issues only)',
|
|
121
|
-
'inspect> findings .modal # Findings only',
|
|
122
|
-
'inspect> json .dialog-A # JSON output',
|
|
123
|
-
'inspect> report .dialog-A # Full report',
|
|
124
|
-
'inspect> .dialog-A # Shorthand for report',
|
|
125
|
-
'inspect> navigate https://other.com # Navigate to new URL',
|
|
126
|
-
'inspect> depth 10 # Set depth',
|
|
127
|
-
'inspect> help # Show help',
|
|
128
|
-
'inspect> quit # Exit',
|
|
127
|
+
'cssprobe-cli close # stop browser + daemon',
|
|
129
128
|
BT3,
|
|
130
129
|
'',
|
|
131
130
|
'## Output Modes',
|
|
132
131
|
'',
|
|
133
|
-
'
|
|
132
|
+
'Pass ' + BT + '--json' + BT + ' when consuming output programmatically:',
|
|
134
133
|
'',
|
|
135
134
|
BT3 + 'bash',
|
|
136
|
-
'cssprobe-cli inspect
|
|
137
|
-
'cssprobe-cli inspect
|
|
135
|
+
'cssprobe-cli inspect body --json',
|
|
136
|
+
'cssprobe-cli inspect body --json | jq ' + BT + "'.findings[] | {id, confidence, message}'" + BT,
|
|
138
137
|
BT3,
|
|
139
138
|
'',
|
|
140
139
|
'Without ' + BT + '--json' + BT + ', output is a Markdown report with ancestor chain,',
|
|
@@ -155,24 +154,28 @@ function buildSkillMd() {
|
|
|
155
154
|
'## inspect Options',
|
|
156
155
|
'',
|
|
157
156
|
BT3 + 'bash',
|
|
158
|
-
'cssprobe-cli inspect <
|
|
157
|
+
'cssprobe-cli inspect <selector> [options]',
|
|
159
158
|
'',
|
|
160
159
|
'Arguments:',
|
|
161
|
-
' <
|
|
162
|
-
' [selector] CSS selector for root (auto-detected if omitted)',
|
|
160
|
+
' <selector> CSS selector for the root element (required)',
|
|
163
161
|
'',
|
|
164
162
|
'Options:',
|
|
165
163
|
' --json Output structured JSON',
|
|
166
|
-
' --headed Show browser window',
|
|
167
|
-
' --browser <engine> chromium|firefox|webkit (default chromium)',
|
|
168
|
-
' --zoom Run 1x/0.5x viewport diagnosis',
|
|
169
|
-
' --depth <n> DOM tree depth (default: auto)',
|
|
170
|
-
' --max-nodes <n> Node count cap (default 60)',
|
|
171
|
-
' --up-to <tag> Ancestor stop tag (default html)',
|
|
172
|
-
' --state <file> Load saved state (cookies + localStorage)',
|
|
173
164
|
' --brief Compact output: tree sketch + warnings/errors only',
|
|
174
165
|
' --layout ASCII layout diagram showing element positions and sizes',
|
|
175
|
-
' --
|
|
166
|
+
' --depth <n> DOM tree depth (default: auto)',
|
|
167
|
+
BT3,
|
|
168
|
+
'',
|
|
169
|
+
'## open Options',
|
|
170
|
+
'',
|
|
171
|
+
BT3 + 'bash',
|
|
172
|
+
'cssprobe-cli open <url> [options]',
|
|
173
|
+
'',
|
|
174
|
+
'Options:',
|
|
175
|
+
' --browser <engine> chromium|firefox|webkit (default chromium)',
|
|
176
|
+
' --headed Show browser window',
|
|
177
|
+
' --viewport <WxH> Viewport size, e.g. 1280x720',
|
|
178
|
+
' --state <file> Load saved state (cookies + localStorage)',
|
|
176
179
|
BT3,
|
|
177
180
|
'',
|
|
178
181
|
'## state-import: Netscape Cookie Format',
|
|
@@ -204,20 +207,21 @@ function buildSkillMd() {
|
|
|
204
207
|
'',
|
|
205
208
|
BT3 + 'bash',
|
|
206
209
|
'# Inspect a specific component',
|
|
207
|
-
'cssprobe-cli
|
|
210
|
+
'cssprobe-cli open https://app.example.com/page',
|
|
211
|
+
'cssprobe-cli inspect ".modal-body"',
|
|
208
212
|
'',
|
|
209
213
|
'# Get structured data for programmatic analysis',
|
|
210
|
-
'cssprobe-cli
|
|
214
|
+
'cssprobe-cli inspect ".modal-body" --json | jq ' + BT + "'.findings[]'" + BT,
|
|
211
215
|
BT3,
|
|
212
216
|
'',
|
|
213
217
|
'### 2. Check if a page has overflow issues',
|
|
214
218
|
'',
|
|
215
219
|
BT3 + 'bash',
|
|
216
|
-
'#
|
|
217
|
-
'cssprobe-cli
|
|
220
|
+
'# Open and analyze',
|
|
221
|
+
'cssprobe-cli open https://getbootstrap.com/docs/5.3/examples/checkout',
|
|
218
222
|
'',
|
|
219
223
|
'# Look for findings with level "warning" or "error"',
|
|
220
|
-
'cssprobe-cli inspect
|
|
224
|
+
'cssprobe-cli inspect body --json | jq ' + BT + "'.findings[] | select(.level != \"info\")'" + BT,
|
|
221
225
|
BT3,
|
|
222
226
|
'',
|
|
223
227
|
'### 3. Inspect with authentication',
|
|
@@ -226,15 +230,9 @@ function buildSkillMd() {
|
|
|
226
230
|
'# Import cookies first',
|
|
227
231
|
'cssprobe-cli state-import exported-cookies.txt --name app',
|
|
228
232
|
'',
|
|
229
|
-
'# Then
|
|
230
|
-
'cssprobe-cli
|
|
231
|
-
|
|
232
|
-
'',
|
|
233
|
-
'### 4. Compare layouts at different viewports',
|
|
234
|
-
'',
|
|
235
|
-
BT3 + 'bash',
|
|
236
|
-
'# Use --zoom to compare 1x vs 0.5x viewport',
|
|
237
|
-
'cssprobe-cli inspect https://getbootstrap.com/docs/5.3/examples/checkout body --zoom',
|
|
233
|
+
'# Then open the session with state',
|
|
234
|
+
'cssprobe-cli open https://app.example.com/dashboard --state ~/.cssprobe-cli/states/app.json',
|
|
235
|
+
'cssprobe-cli inspect ".main-panel"',
|
|
238
236
|
BT3,
|
|
239
237
|
'',
|
|
240
238
|
'## Anti-patterns',
|
|
@@ -243,8 +241,6 @@ function buildSkillMd() {
|
|
|
243
241
|
'- ' + BT + 'viewport-overflow' + BT + ' flags on elements below the fold are normal for scrolling pages -- not bugs.',
|
|
244
242
|
'- Cross-origin stylesheet blocking is expected. Declared values from blocked sheets are',
|
|
245
243
|
' marked UNVERIFIABLE. Computed values from getComputedStyle() are still accurate.',
|
|
246
|
-
'- ' + BT + '--auto-root' + BT + ' picks the first modal/dialog/scroll-container -- for specific elements,',
|
|
247
|
-
' provide an explicit selector.',
|
|
248
244
|
'- Login state files contain cookies -- treat them as secrets.',
|
|
249
245
|
'',
|
|
250
246
|
].join('\n');
|
|
@@ -269,9 +265,8 @@ function buildPitfallsMd() {
|
|
|
269
265
|
'',
|
|
270
266
|
'## Selector Not Found',
|
|
271
267
|
'',
|
|
272
|
-
'- If ' + BT + 'cssprobe-cli inspect <
|
|
268
|
+
'- If ' + BT + 'cssprobe-cli inspect <selector>' + BT + ' returns ' + BT + 'Not found: <selector>' + BT + ',',
|
|
273
269
|
' the element doesn\'t exist in the DOM at page load.',
|
|
274
|
-
'- Use ' + BT + '--auto-root' + BT + ' (omit selector) to let cssprobe-cli pick a candidate.',
|
|
275
270
|
'- For SPAs that load content dynamically, use ' + BT + '--headed' + BT + ' to see what\'s on the page.',
|
|
276
271
|
'',
|
|
277
272
|
'## Login State',
|
|
@@ -297,7 +292,7 @@ function buildPitfallsMd() {
|
|
|
297
292
|
'',
|
|
298
293
|
'## JSON Output',
|
|
299
294
|
'',
|
|
300
|
-
'- Pass ' + BT + '--json' + BT + '
|
|
295
|
+
'- Pass ' + BT + '--json' + BT + ' AFTER the command name: ' + BT + 'cssprobe-cli inspect body --json' + BT + '.',
|
|
301
296
|
'- In JSON mode, errors are ' + BT + '{ "isError": true, "error": "message" }' + BT + ' and the',
|
|
302
297
|
' process exits with code 1. Check for ' + BT + 'isError' + BT + ' before parsing results.',
|
|
303
298
|
'',
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.SocketConnection = void 0;
|
|
8
|
-
exports.compareSemver = compareSemver;
|
|
9
8
|
class SocketConnection {
|
|
10
9
|
_socket;
|
|
11
10
|
_pendingBuffers = [];
|
|
@@ -61,17 +60,4 @@ class SocketConnection {
|
|
|
61
60
|
}
|
|
62
61
|
}
|
|
63
62
|
exports.SocketConnection = SocketConnection;
|
|
64
|
-
function compareSemver(a, b) {
|
|
65
|
-
const aBase = a.replace(/-.*$/, '');
|
|
66
|
-
const bBase = b.replace(/-.*$/, '');
|
|
67
|
-
const aParts = aBase.split('.').map(Number);
|
|
68
|
-
const bParts = bBase.split('.').map(Number);
|
|
69
|
-
for (let i = 0; i < 3; i++) {
|
|
70
|
-
if (aParts[i] > bParts[i])
|
|
71
|
-
return 1;
|
|
72
|
-
if (aParts[i] < bParts[i])
|
|
73
|
-
return -1;
|
|
74
|
-
}
|
|
75
|
-
return 0;
|
|
76
|
-
}
|
|
77
63
|
//# sourceMappingURL=socketConnection.js.map
|
package/package.json
CHANGED