cssprobe-cli 0.1.2 → 0.2.5
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 +31 -1
- package/dist/browser/launcher.d.ts +4 -0
- package/dist/browser/launcher.js +27 -0
- package/dist/cli/commands.d.ts +6 -0
- package/dist/cli/commands.js +16 -1
- package/dist/cli/program.js +282 -2
- package/dist/engine/renderer.d.ts +1 -1
- package/dist/engine/renderer.js +17 -195
- package/dist/engine/renderers/ancestors.d.ts +2 -0
- package/dist/engine/renderers/ancestors.js +17 -0
- package/dist/engine/renderers/dom-tree.d.ts +2 -0
- package/dist/engine/renderers/dom-tree.js +43 -0
- package/dist/engine/renderers/findings.d.ts +3 -0
- package/dist/engine/renderers/findings.js +44 -0
- package/dist/engine/renderers/layout.d.ts +2 -0
- package/dist/engine/renderers/layout.js +203 -0
- package/dist/engine/renderers/sketch.d.ts +2 -0
- package/dist/engine/renderers/sketch.js +78 -0
- package/dist/engine/renderers/utils.d.ts +16 -0
- package/dist/engine/renderers/utils.js +54 -0
- package/dist/help.json +18 -3
- package/dist/installer/skill-template.js +36 -0
- package/docs/guide/installation.md +36 -1
- package/package.json +1 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CONF_BADGE = exports.BOX = void 0;
|
|
4
|
+
exports.nodeLabel = nodeLabel;
|
|
5
|
+
exports.smartLabel = smartLabel;
|
|
6
|
+
exports.isMultiColumn = isMultiColumn;
|
|
7
|
+
exports.confidenceSummary = confidenceSummary;
|
|
8
|
+
function nodeLabel(node) {
|
|
9
|
+
const cls = node.classes.length ? `.${node.classes.join('.')}` : '';
|
|
10
|
+
const id = node.id ? `#${node.id}` : '';
|
|
11
|
+
return `${node.tag}${id}${cls}`;
|
|
12
|
+
}
|
|
13
|
+
function smartLabel(node, maxLen) {
|
|
14
|
+
const full = nodeLabel(node);
|
|
15
|
+
if (full.length <= maxLen)
|
|
16
|
+
return full;
|
|
17
|
+
const id = node.id ? `#${node.id}` : '';
|
|
18
|
+
const firstCls = node.classes.length > 0 ? `.${node.classes[0]}` : '';
|
|
19
|
+
const short = `${node.tag}${id}${firstCls}`;
|
|
20
|
+
if (short.length <= maxLen)
|
|
21
|
+
return short;
|
|
22
|
+
const tagId = `${node.tag}${id}`;
|
|
23
|
+
if (tagId.length <= maxLen)
|
|
24
|
+
return tagId;
|
|
25
|
+
if (node.tag.length <= maxLen)
|
|
26
|
+
return node.tag;
|
|
27
|
+
return node.tag.slice(0, Math.max(maxLen - 3, 1)) + '...';
|
|
28
|
+
}
|
|
29
|
+
function isMultiColumn(node) {
|
|
30
|
+
const display = node.props.display;
|
|
31
|
+
return (node.shape?.role === 'flex-row' ||
|
|
32
|
+
(display === 'flex' && node.props.flexDirection !== 'column') ||
|
|
33
|
+
display === 'grid' ||
|
|
34
|
+
display === 'inline-grid');
|
|
35
|
+
}
|
|
36
|
+
exports.BOX = { tl: '\u250C', tr: '\u2510', bl: '\u2514', br: '\u2518', h: '\u2500', v: '\u2502' };
|
|
37
|
+
exports.CONF_BADGE = {
|
|
38
|
+
DEFINITE: 'DEFINITE',
|
|
39
|
+
INDEFINITE: 'INDEFINITE',
|
|
40
|
+
UNVERIFIABLE: 'UNVERIFIABLE',
|
|
41
|
+
};
|
|
42
|
+
function confidenceSummary(findings) {
|
|
43
|
+
const counts = findings.reduce((acc, f) => {
|
|
44
|
+
acc[f.confidence] = (acc[f.confidence] || 0) + 1;
|
|
45
|
+
return acc;
|
|
46
|
+
}, {});
|
|
47
|
+
const parts = [
|
|
48
|
+
`DEFINITE ${counts.DEFINITE || 0}`,
|
|
49
|
+
`INDEFINITE ${counts.INDEFINITE || 0}`,
|
|
50
|
+
`UNVERIFIABLE ${counts.UNVERIFIABLE || 0}`,
|
|
51
|
+
];
|
|
52
|
+
return parts.join(' | ');
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=utils.js.map
|
package/dist/help.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"global": "Usage: cssprobe-cli <command> [args] [options]\n\n\nInspection:\n inspect <url> [selector] inspect the runtime css of a page (layout, scroll, colors, fonts, backgrounds)\n login <url> open browser for interactive login, then save state for later use\n state-import [file] import cookies from netscape format file into a playwright state file\n\nConfiguration:\n config-show show current configuration\n config-set <key> <value> set a configuration value\n config-list list all profiles\n config-use <name> switch active profile\n config-new <name> create a new profile\n config-path show configuration file path\n\nAgent Skills:\n skill-install install agent skill for cssprobe-cli (teaches agents how to use the cli)\n skill-uninstall remove agent skill for cssprobe-cli\n\nGlobal options:\n --help [command] print help\n --json output response as JSON\n --raw output only the result value\n --version print version\n -p, --profile <name> use named profile (or CSSPROBE_PROFILE env)",
|
|
2
|
+
"global": "Usage: cssprobe-cli <command> [args] [options]\n\n\nInspection:\n inspect <url> [selector] inspect the runtime css of a page (layout, scroll, colors, fonts, backgrounds)\n login <url> open browser for interactive login, then save state for later use\n state-import [file] import cookies from netscape format file into a playwright state file\n interactive <url> open browser and inspect interactively (repl mode)\n\nConfiguration:\n config-show show current configuration\n config-set <key> <value> set a configuration value\n config-list list all profiles\n config-use <name> switch active profile\n config-new <name> create a new profile\n config-path show configuration file path\n\nAgent Skills:\n skill-install install agent skill for cssprobe-cli (teaches agents how to use the cli)\n skill-uninstall remove agent skill for cssprobe-cli\n\nGlobal options:\n --help [command] print help\n --json output response as JSON\n --raw output only the result value\n --version print version\n -p, --profile <name> use named profile (or CSSPROBE_PROFILE env)",
|
|
3
3
|
"commands": {
|
|
4
4
|
"inspect": {
|
|
5
|
-
"help": "cssprobe-cli inspect <url> [selector]\n\nInspect the runtime CSS of a page (layout, scroll, colors, fonts, backgrounds)\n\nArguments:\n <url> url, file:// path, or local html file path\n [selector] css selector for the root element (auto-detected if omitted)\nOptions:\n --json output structured json instead of markdown\n --headed show the browser window\n --browser browser engine (default chromium)\n --zoom run 1x/0.5x viewport diagnosis\n --depth dom tree depth (default: auto, max 20)\n --max-nodes node count cap (default 60)\n --up-to ancestor stop tag (default html)\n --state path to saved state file (cookies + localstorage)\n --brief compact output: tree sketch + warnings/errors only\n\nGlobal options:\n --json output as JSON\n --profile, -p <name> use named profile",
|
|
5
|
+
"help": "cssprobe-cli inspect <url> [selector]\n\nInspect the runtime CSS of a page (layout, scroll, colors, fonts, backgrounds)\n\nArguments:\n <url> url, file:// path, or local html file path\n [selector] css selector for the root element (auto-detected if omitted)\nOptions:\n --json output structured json instead of markdown\n --headed show the browser window\n --browser browser engine (default chromium)\n --zoom run 1x/0.5x viewport diagnosis\n --depth dom tree depth (default: auto, max 20)\n --max-nodes node count cap (default 60)\n --up-to ancestor stop tag (default html)\n --state path to saved state file (cookies + localstorage)\n --brief compact output: tree sketch + warnings/errors only\n --layout ascii layout diagram showing element positions and sizes\n --wait wait for user interaction before collecting (implies --headed)\n\nGlobal options:\n --json output as JSON\n --profile, -p <name> use named profile",
|
|
6
6
|
"flags": {
|
|
7
7
|
"json": "boolean",
|
|
8
8
|
"headed": "boolean",
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
"max-nodes": "string",
|
|
13
13
|
"up-to": "string",
|
|
14
14
|
"state": "string",
|
|
15
|
-
"brief": "boolean"
|
|
15
|
+
"brief": "boolean",
|
|
16
|
+
"layout": "boolean",
|
|
17
|
+
"wait": "boolean"
|
|
16
18
|
},
|
|
17
19
|
"args": [
|
|
18
20
|
"url",
|
|
@@ -39,6 +41,17 @@
|
|
|
39
41
|
"file"
|
|
40
42
|
]
|
|
41
43
|
},
|
|
44
|
+
"interactive": {
|
|
45
|
+
"help": "cssprobe-cli interactive <url>\n\nOpen browser and inspect interactively (REPL mode)\n\nArguments:\n <url> url, file:// path, or local html file path\nOptions:\n --browser browser engine (default chromium)\n --state path to saved state file (cookies + localstorage)\n --depth dom tree depth (default: auto, max 20)\n\nGlobal options:\n --json output as JSON\n --profile, -p <name> use named profile",
|
|
46
|
+
"flags": {
|
|
47
|
+
"browser": "string",
|
|
48
|
+
"state": "string",
|
|
49
|
+
"depth": "string"
|
|
50
|
+
},
|
|
51
|
+
"args": [
|
|
52
|
+
"url"
|
|
53
|
+
]
|
|
54
|
+
},
|
|
42
55
|
"config-show": {
|
|
43
56
|
"help": "cssprobe-cli config-show \n\nShow current configuration\n\nOptions:\n --profile profile name",
|
|
44
57
|
"flags": {
|
|
@@ -104,6 +117,8 @@
|
|
|
104
117
|
"headed",
|
|
105
118
|
"zoom",
|
|
106
119
|
"brief",
|
|
120
|
+
"layout",
|
|
121
|
+
"wait",
|
|
107
122
|
"local"
|
|
108
123
|
]
|
|
109
124
|
}
|
|
@@ -96,6 +96,39 @@ function buildSkillMd() {
|
|
|
96
96
|
'cssprobe-cli state-import new-cookies.txt --merge existing.json --out merged.json',
|
|
97
97
|
BT3,
|
|
98
98
|
'',
|
|
99
|
+
'## Wait for User Interaction',
|
|
100
|
+
'',
|
|
101
|
+
'For pages that require clicking a button or opening a dialog before inspection:',
|
|
102
|
+
'',
|
|
103
|
+
BT3 + 'bash',
|
|
104
|
+
'cssprobe-cli inspect https://mysite.com/page ".dialog" --state ~/.cssprobe-cli/states/mysite.json --wait',
|
|
105
|
+
'# Browser opens -> perform actions (click, open dialog) -> press Enter -> inspect',
|
|
106
|
+
BT3,
|
|
107
|
+
'',
|
|
108
|
+
'## Interactive Mode (REPL)',
|
|
109
|
+
'',
|
|
110
|
+
'For inspecting multiple areas of the same page:',
|
|
111
|
+
'',
|
|
112
|
+
BT3 + 'bash',
|
|
113
|
+
'cssprobe-cli interactive https://mysite.com --state ~/.cssprobe-cli/states/mysite.json',
|
|
114
|
+
BT3,
|
|
115
|
+
'',
|
|
116
|
+
'Runtime commands:',
|
|
117
|
+
'',
|
|
118
|
+
BT3,
|
|
119
|
+
'inspect> tree .dialog-A # DOM tree',
|
|
120
|
+
'inspect> layout .sidebar-B # ASCII layout diagram',
|
|
121
|
+
'inspect> sketch .content # Tree sketch (issues only)',
|
|
122
|
+
'inspect> findings .modal # Findings only',
|
|
123
|
+
'inspect> json .dialog-A # JSON output',
|
|
124
|
+
'inspect> report .dialog-A # Full report',
|
|
125
|
+
'inspect> .dialog-A # Shorthand for report',
|
|
126
|
+
'inspect> navigate https://other.com # Navigate to new URL',
|
|
127
|
+
'inspect> depth 10 # Set depth',
|
|
128
|
+
'inspect> help # Show help',
|
|
129
|
+
'inspect> quit # Exit',
|
|
130
|
+
BT3,
|
|
131
|
+
'',
|
|
99
132
|
'## Output Modes',
|
|
100
133
|
'',
|
|
101
134
|
'Always pass ' + BT + '--json' + BT + ' when consuming output programmatically:',
|
|
@@ -138,6 +171,9 @@ function buildSkillMd() {
|
|
|
138
171
|
' --max-nodes <n> Node count cap (default 60)',
|
|
139
172
|
' --up-to <tag> Ancestor stop tag (default html)',
|
|
140
173
|
' --state <file> Load saved state (cookies + localStorage)',
|
|
174
|
+
' --brief Compact output: tree sketch + warnings/errors only',
|
|
175
|
+
' --layout ASCII layout diagram showing element positions and sizes',
|
|
176
|
+
' --wait Wait for user interaction before collecting (implies --headed)',
|
|
141
177
|
BT3,
|
|
142
178
|
'',
|
|
143
179
|
'## state-import: Netscape Cookie Format',
|
|
@@ -125,9 +125,44 @@ cssprobe-cli inspect https://mysite.com/page ".target" --state ~/.cssprobe-cli/s
|
|
|
125
125
|
cssprobe-cli state-import new-cookies.txt --merge existing-state.json --out updated.json
|
|
126
126
|
```
|
|
127
127
|
|
|
128
|
+
### Option D: Wait for User Interaction
|
|
129
|
+
|
|
130
|
+
For pages that require clicking a button or opening a dialog before inspection:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
cssprobe-cli inspect https://mysite.com/page ".dialog" --state ~/.cssprobe-cli/states/mysite.json --wait
|
|
134
|
+
# Browser opens -> perform actions (click, open dialog) -> press Enter -> inspect
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Step 5: Interactive Mode (REPL)
|
|
140
|
+
|
|
141
|
+
For inspecting multiple areas of the same page without re-opening the browser:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
cssprobe-cli interactive https://mysite.com --state ~/.cssprobe-cli/states/mysite.json
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Runtime commands:
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
inspect> tree .dialog-A # DOM tree
|
|
151
|
+
inspect> layout .sidebar-B # ASCII layout diagram
|
|
152
|
+
inspect> sketch .content # Tree sketch (issues only)
|
|
153
|
+
inspect> findings .modal # Findings only
|
|
154
|
+
inspect> json .dialog-A # JSON output
|
|
155
|
+
inspect> report .dialog-A # Full report
|
|
156
|
+
inspect> .dialog-A # Shorthand for report
|
|
157
|
+
inspect> navigate https://other.com # Navigate to new URL
|
|
158
|
+
inspect> depth 10 # Set depth
|
|
159
|
+
inspect> help # Show help
|
|
160
|
+
inspect> quit # Exit
|
|
161
|
+
```
|
|
162
|
+
|
|
128
163
|
---
|
|
129
164
|
|
|
130
|
-
## Step
|
|
165
|
+
## Step 6: Understand the Output
|
|
131
166
|
|
|
132
167
|
### Markdown Report (default)
|
|
133
168
|
|
package/package.json
CHANGED