cssprobe-cli 0.1.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/AGENTS.md +77 -0
- package/LICENSE +21 -0
- package/README.md +218 -0
- package/bin/cssprobe-cli.js +6 -0
- package/dist/browser/launcher.d.ts +25 -0
- package/dist/browser/launcher.js +213 -0
- package/dist/cli/command.d.ts +27 -0
- package/dist/cli/command.js +84 -0
- package/dist/cli/commands.d.ts +42 -0
- package/dist/cli/commands.js +166 -0
- package/dist/cli/minimist.d.ts +9 -0
- package/dist/cli/minimist.js +120 -0
- package/dist/cli/output.d.ts +26 -0
- package/dist/cli/output.js +80 -0
- package/dist/cli/program.d.ts +1 -0
- package/dist/cli/program.js +381 -0
- package/dist/collector-bundle.js +342 -0
- package/dist/config/config.d.ts +23 -0
- package/dist/config/config.js +128 -0
- package/dist/config/helpGenerator.d.ts +10 -0
- package/dist/config/helpGenerator.js +156 -0
- package/dist/engine/analyzer.d.ts +2 -0
- package/dist/engine/analyzer.js +385 -0
- package/dist/engine/collector.d.ts +3 -0
- package/dist/engine/collector.js +291 -0
- package/dist/engine/renderer.d.ts +3 -0
- package/dist/engine/renderer.js +159 -0
- package/dist/engine/types.d.ts +130 -0
- package/dist/engine/types.js +4 -0
- package/dist/help.json +107 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6 -0
- package/dist/installer/index.d.ts +3 -0
- package/dist/installer/index.js +12 -0
- package/dist/installer/skill-template.d.ts +9 -0
- package/dist/installer/skill-template.js +274 -0
- package/dist/installer/targets/registry.d.ts +9 -0
- package/dist/installer/targets/registry.js +121 -0
- package/dist/installer/targets/shared.d.ts +9 -0
- package/dist/installer/targets/shared.js +112 -0
- package/dist/installer/targets/types.d.ts +22 -0
- package/dist/installer/targets/types.js +3 -0
- package/docs/guide/installation.md +230 -0
- package/package.json +51 -0
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
# Installation Guide for LLM Agents
|
|
2
|
+
|
|
3
|
+
You are an AI agent (opencode, Claude Code, Codex, Cursor, etc.). This guide is written for you. Do not make the human read it.
|
|
4
|
+
|
|
5
|
+
## Quick Prompt (for humans to copy-paste)
|
|
6
|
+
|
|
7
|
+
If a human pasted this to you, follow the instructions below:
|
|
8
|
+
|
|
9
|
+
> Install and configure `cssprobe-cli` using the guide at `docs/guide/installation.md`. Then run `cssprobe-cli inspect <url> <selector>` to analyze the CSS layout of any page.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## What You're Installing
|
|
14
|
+
|
|
15
|
+
`cssprobe-cli` is a CLI that lets you (the agent) inspect the runtime CSS of any web page — layout, scroll behavior, overflow, colors, backgrounds, fonts — all from the command line. It launches a real browser, captures computed styles and DOM structure, and produces a structured report with confidence levels.
|
|
16
|
+
|
|
17
|
+
Humans should not type these commands. You should.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Step 1: Install the Package
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install -g cssprobe-cli
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Or run without installing (slower but zero setup):
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npx cssprobe-cli inspect https://example.com ".content"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Verify:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
which cssprobe-cli && cssprobe-cli --version
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
If `command not found`, your Node.js global bin isn't on `PATH`:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
export PATH="$(npm root -g)/../bin:$PATH"
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Step 2: Install Browser
|
|
48
|
+
|
|
49
|
+
cssprobe-cli uses Playwright to launch a real browser. Install Chromium:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npx playwright install chromium
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Verify:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
cssprobe-cli inspect https://example.com "body" --json | head -5
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
JSON output = it works. `Browser not installed` = run the install command above.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Step 3: Basic Usage
|
|
66
|
+
|
|
67
|
+
### Inspect a Public Page
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# With explicit selector
|
|
71
|
+
cssprobe-cli inspect https://example.com ".main-content"
|
|
72
|
+
|
|
73
|
+
# Auto-detect root element
|
|
74
|
+
cssprobe-cli inspect https://example.com
|
|
75
|
+
|
|
76
|
+
# Local HTML file
|
|
77
|
+
cssprobe-cli inspect ./test.html ".container"
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### JSON Output (for programmatic consumption)
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
cssprobe-cli inspect https://example.com ".content" --json
|
|
84
|
+
cssprobe-cli --json inspect https://example.com ".content" | jq '.findings[] | {id, confidence, message}'
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Step 4: Login-Protected Pages
|
|
90
|
+
|
|
91
|
+
Many pages require authentication. cssprobe-cli supports three approaches:
|
|
92
|
+
|
|
93
|
+
### Option A: Import Cookies from Browser Export
|
|
94
|
+
|
|
95
|
+
1. Export cookies from your browser in Netscape format (e.g., using "EditThisCookie" extension or browser dev tools)
|
|
96
|
+
2. Import into cssprobe-cli:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
cssprobe-cli state-import cookies.txt --out ~/.cssprobe-cli/states/mysite.json
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
3. Use the state file:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
cssprobe-cli inspect https://mysite.com/page ".target" --state ~/.cssprobe-cli/states/mysite.json
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Option B: Interactive Login
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
cssprobe-cli login https://mysite.com
|
|
112
|
+
# Browser opens → complete login manually → press Enter
|
|
113
|
+
# State saved to ~/.cssprobe-cli/states/mysite.com.json
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Then use:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
cssprobe-cli inspect https://mysite.com/page ".target" --state ~/.cssprobe-cli/states/mysite.com.json
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Option C: Merge Cookies into Existing State
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
cssprobe-cli state-import new-cookies.txt --merge existing-state.json --out updated.json
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Step 5: Understand the Output
|
|
131
|
+
|
|
132
|
+
### Markdown Report (default)
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
# cssprobe-cli report
|
|
136
|
+
viewport: 1280×720 | root: .container | nodes: 18
|
|
137
|
+
confidence: DEFINITE 8 | INDEFINITE 0 | UNVERIFIABLE 1
|
|
138
|
+
|
|
139
|
+
## Ancestor chain (root→html)
|
|
140
|
+
...
|
|
141
|
+
|
|
142
|
+
## DOM tree (6 levels deep)
|
|
143
|
+
...
|
|
144
|
+
|
|
145
|
+
## Findings
|
|
146
|
+
- ⚠ all heights are % or missing [UNVERIFIABLE] @ div.container
|
|
147
|
+
- ✔ div.modal-body scrollable (scrollHeight 2040 > clientHeight 576) [DEFINITE]
|
|
148
|
+
- ⚠ div.content overflows parent [DEFINITE]
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Confidence Levels
|
|
152
|
+
|
|
153
|
+
| Level | Meaning |
|
|
154
|
+
|-------|---------|
|
|
155
|
+
| **DEFINITE** | Based on computed values (facts) or accessible declared values |
|
|
156
|
+
| **INDEFINITE** | Declared value uses `%` — resolves at runtime |
|
|
157
|
+
| **UNVERIFIABLE** | Declared value missing or from blocked cross-origin stylesheet |
|
|
158
|
+
|
|
159
|
+
### JSON Output
|
|
160
|
+
|
|
161
|
+
```json
|
|
162
|
+
{
|
|
163
|
+
"meta": { "rootSelector": ".container", "viewport": {...}, "nodeCount": 18 },
|
|
164
|
+
"snapshot": { "ancestors": [...], "tree": {...} },
|
|
165
|
+
"findings": [
|
|
166
|
+
{ "id": "anchor-missing", "level": "warning", "confidence": "UNVERIFIABLE", "message": "..." },
|
|
167
|
+
{ "id": "scrollable", "level": "info", "confidence": "DEFINITE", "message": "..." }
|
|
168
|
+
],
|
|
169
|
+
"summary": { "total": 9, "confidence": { "DEFINITE": 8, "INDEFINITE": 0, "UNVERIFIABLE": 1 } }
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Common Failures Agents Face
|
|
176
|
+
|
|
177
|
+
**"Browser not installed"**
|
|
178
|
+
→ Run `npx playwright install chromium`.
|
|
179
|
+
|
|
180
|
+
**"File not found"**
|
|
181
|
+
→ Check the URL or file path. Local files need to exist on disk.
|
|
182
|
+
|
|
183
|
+
**"Could not auto-detect a root element"**
|
|
184
|
+
→ Provide an explicit selector: `cssprobe-cli inspect <url> <selector>`
|
|
185
|
+
|
|
186
|
+
**"No valid cookies found"**
|
|
187
|
+
→ Cookie file must be Netscape format (tab-separated: `domain\tflag\tpath\tsecure\texpires\tname\tvalue`).
|
|
188
|
+
|
|
189
|
+
**"collector bundle not found"**
|
|
190
|
+
→ Run `npm run build` in the cssprobe-cli project directory.
|
|
191
|
+
|
|
192
|
+
**Cross-origin stylesheet blocked**
|
|
193
|
+
→ This is expected. Declared values from blocked sheets are marked UNVERIFIABLE. Computed values from getComputedStyle() are still accurate.
|
|
194
|
+
|
|
195
|
+
**Page needs login**
|
|
196
|
+
→ Use `cssprobe-cli login <url>` for interactive login, or `cssprobe-cli state-import cookies.txt` to import cookies.
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Environment Variables (Skip Config)
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
export CSSPROBE_BROWSER=chromium
|
|
204
|
+
export CSSPROBE_DEPTH=6
|
|
205
|
+
export CSSPROBE_HEADED=true
|
|
206
|
+
export CSSPROBE_PROFILE=default
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Priority (highest to lowest):
|
|
210
|
+
1. CLI flags: `--browser`, `--depth`, `--headed`
|
|
211
|
+
2. Environment variables: `CSSPROBE_BROWSER`, `CSSPROBE_DEPTH`, `CSSPROBE_HEADED`
|
|
212
|
+
3. Config file: `~/.cssprobe-clirc`
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## The One-Liner
|
|
217
|
+
|
|
218
|
+
For agents that trust copy-paste:
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
npm install -g cssprobe-cli && npx playwright install chromium && cssprobe-cli inspect https://example.com "body"
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## Done
|
|
227
|
+
|
|
228
|
+
You now have programmatic control over CSS inspection. Analyze layout, detect overflow, check scroll behavior, verify anchors — all from a terminal an agent can automate.
|
|
229
|
+
|
|
230
|
+
If something breaks: check that Chromium is installed first. 90% of issues are missing browsers. The other 10% are wrong selectors.
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cssprobe-cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Runtime CSS probe — inspect layout, colors, backgrounds, fonts and more in a live browser. AI agents and shell automation.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"css",
|
|
7
|
+
"inspect",
|
|
8
|
+
"layout",
|
|
9
|
+
"dom",
|
|
10
|
+
"forensics",
|
|
11
|
+
"debug",
|
|
12
|
+
"browser",
|
|
13
|
+
"agent",
|
|
14
|
+
"automation"
|
|
15
|
+
],
|
|
16
|
+
"homepage": "https://github.com/mack-peng/cssprobe-cli#readme",
|
|
17
|
+
"repository": "github:mack-peng/cssprobe-cli",
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"author": "strikingly",
|
|
20
|
+
"main": "dist/index.js",
|
|
21
|
+
"bin": {
|
|
22
|
+
"cssprobe-cli": "./bin/cssprobe-cli.js"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"bin",
|
|
26
|
+
"dist",
|
|
27
|
+
"docs",
|
|
28
|
+
"README.md",
|
|
29
|
+
"LICENSE",
|
|
30
|
+
"AGENTS.md"
|
|
31
|
+
],
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=18"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "node scripts/build.js",
|
|
37
|
+
"typecheck": "tsc --noEmit",
|
|
38
|
+
"test": "npx tsx --test tests/*.test.ts",
|
|
39
|
+
"prepublishOnly": "npm run build"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"playwright-core": "^1.48.0",
|
|
43
|
+
"zod": "^3.23.0"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/node": "^22.0.0",
|
|
47
|
+
"esbuild": "^0.24.0",
|
|
48
|
+
"tsx": "^4.23.0",
|
|
49
|
+
"typescript": "^5.5.0"
|
|
50
|
+
}
|
|
51
|
+
}
|