cssprobe-cli 0.2.15 → 0.2.21

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 (2) hide show
  1. package/README.md +106 -189
  2. package/package.json +5 -2
package/README.md CHANGED
@@ -2,22 +2,78 @@
2
2
 
3
3
  Runtime CSS probe — inspect layout, scroll, colors, backgrounds, fonts and more in a live browser. Built for both humans and AI agents.
4
4
 
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Node.js](https://img.shields.io/badge/Node.js-%3E%3D22.5.0-brightgreen.svg)](https://nodejs.org/)
6
+
7
+ ---
8
+
9
+ ## Why cssprobe-cli?
10
+
11
+ When an AI agent needs to debug CSS — why is this element overflowing, what's the actual rendered layout, is this container scrollable — it can't see the browser. It guesses from static code, missing runtime-only issues like overflow, scroll chains, and containing block hijacks.
12
+
13
+ **cssprobe-cli gives the agent eyes.** It opens a real browser, collects computed styles and metrics via injected JavaScript, analyzes them with a confidence model, and returns structured findings — all in one command. The agent asks a question about any selector and gets back the DOM tree, ASCII layout diagram, overflow warnings, and scroll diagnosis without leaving the terminal.
14
+
15
+ ---
16
+
5
17
  ## Installation
6
18
 
7
19
  ### For Humans
8
20
 
9
- ```bash
10
- npm install -g cssprobe-cli
21
+ Copy and paste this prompt to your LLM agent (Claude Code, Cursor, Codex, etc.):
22
+
23
+ ```
24
+ Install and configure cssprobe-cli by following the instructions here:
25
+ https://raw.githubusercontent.com/mack-peng/cssprobe-cli/main/docs/guide/installation.md
11
26
  ```
12
27
 
28
+ Or read the [Installation Guide](docs/guide/installation.md), but seriously, let an agent do it. Humans fat-finger configs.
29
+
13
30
  ### For LLM Agents
14
31
 
32
+ Fetch the installation guide and follow it:
33
+
15
34
  ```bash
35
+ curl -s https://raw.githubusercontent.com/mack-peng/cssprobe-cli/main/docs/guide/installation.md
36
+ ```
37
+
38
+ Or install directly:
39
+
40
+ ```bash
41
+ npm install -g cssprobe-cli
16
42
  cssprobe-cli skill-install
17
43
  ```
18
44
 
19
45
  ---
20
46
 
47
+ ## How It Works
48
+
49
+ ```
50
+ ┌───────────────────────────────────────────────────────────┐
51
+ │ AI Agent │
52
+ │ │
53
+ │ "Is .sidebar overflowing?" │
54
+ │ calls: cssprobe-cli inspect .sidebar │
55
+ │ │ │
56
+ └─────────────────────────────┬─────────────────────────────┘
57
+ │
58
+ ▼
59
+ ┌───────────────────────────────────────────────────────────┐
60
+ │ cssprobe-cli daemon │
61
+ │ │
62
+ │ collector (IIFE) → analyzer (pure) → renderer (md/json) │
63
+ │ │ │
64
+ │ ▼ │
65
+ │ Playwright browser (Chromium) │
66
+ │ getBoundingClientRect · getComputedStyle · DOM walk │
67
+ └───────────────────────────────────────────────────────────┘
68
+ ```
69
+
70
+ 1. **Session** — `open` spawns a daemon process managing a browser. Commands connect via Unix socket.
71
+ 2. **Collector** — Injected as IIFE into the page. Walks the DOM, reads computed styles, declared values, and element metrics.
72
+ 3. **Analyzer** — Pure Node.js functions. Classifies findings with confidence levels (DEFINITE / INDEFINITE / UNVERIFIABLE).
73
+ 4. **Renderer** — Outputs Markdown (default) or JSON. Includes ASCII layout diagram, DOM tree, and findings.
74
+
75
+ ---
76
+
21
77
  ## Quick Start
22
78
 
23
79
  ### 1. Inspect a Page
@@ -26,15 +82,9 @@ cssprobe-cli skill-install
26
82
  # Open browser (non-blocking, starts daemon session)
27
83
  cssprobe-cli open https://getbootstrap.com/docs/5.3/examples/checkout
28
84
 
29
- # Open with custom viewport
30
- cssprobe-cli open https://example.com --viewport 1280x720
31
-
32
85
  # Inspect with CSS selector
33
86
  cssprobe-cli inspect .container
34
87
 
35
- # Show DOM tree
36
- cssprobe-cli tree .container --depth 3
37
-
38
88
  # Show ASCII layout diagram
39
89
  cssprobe-cli layout .container
40
90
 
@@ -53,65 +103,18 @@ cssprobe-cli open https://mysite.com --headed
53
103
 
54
104
  # User manually logs in...
55
105
 
56
- # Run diagnosis on authenticated page
57
- cssprobe-cli inspect .dashboard
58
-
59
- # Inject CSS to test changes
60
- cssprobe-cli inject-css ".sidebar { background: #f0f0f0; }"
61
-
62
- # Take screenshot
63
- cssprobe-cli screenshot
106
+ # Save session state for future use
107
+ cssprobe-cli playwright "page.context().storageState({path: 'state.json'})"
64
108
 
65
- # Close when done
66
- cssprobe-cli close
67
- ```
68
-
69
- ### 3. Import Cookies
70
-
71
- ```bash
72
- # Import cookies from browser export (Netscape format)
73
- cssprobe-cli state-import cookies.txt --out ~/.cssprobe-cli/states/mysite.json
74
-
75
- # Or use --name for simpler syntax
76
- cssprobe-cli state-import cookies.txt --name mysite
77
-
78
- # Open browser with saved state
79
- cssprobe-cli open https://mysite.com --state ~/.cssprobe-cli/states/mysite.json
109
+ # Reopen with saved state (no login needed)
110
+ cssprobe-cli open https://mysite.com --state state.json --headed
80
111
  ```
81
112
 
82
- ### 4. JSON Output
113
+ ### 3. JSON Output
83
114
 
84
115
  ```bash
85
- cssprobe-cli open https://getbootstrap.com/docs/5.3/examples/checkout
86
116
  cssprobe-cli inspect body --json
87
117
  cssprobe-cli inspect body --json | jq '.findings[] | {id, confidence, message}'
88
- cssprobe-cli close
89
- ```
90
-
91
- ---
92
-
93
- ## Session Mode
94
-
95
- cssprobe-cli uses a session-based architecture for non-browser interaction:
96
-
97
- ```bash
98
- # Start session (opens browser, returns immediately)
99
- cssprobe-cli open <url>
100
-
101
- # Run commands (each command is independent, non-blocking)
102
- cssprobe-cli inspect <selector>
103
- cssprobe-cli tree <selector>
104
- cssprobe-cli layout <selector>
105
- cssprobe-cli findings <selector>
106
- cssprobe-cli inject-css <css>
107
- cssprobe-cli screenshot
108
- cssprobe-cli eval <expression>
109
-
110
- # Check session status
111
- cssprobe-cli status
112
-
113
- # End session (closes browser)
114
- cssprobe-cli close
115
118
  ```
116
119
 
117
120
  ---
@@ -120,122 +123,58 @@ cssprobe-cli close
120
123
 
121
124
  ### Session Management
122
125
 
123
- ```bash
124
- cssprobe-cli open [url] # Open browser in session mode (non-blocking)
125
- cssprobe-cli open [url] --viewport 1280x720 # Open with custom viewport
126
- cssprobe-cli open [url] --state ~/.cssprobe-cli/states/mysite.json # Open with saved state
127
- cssprobe-cli close # Close browser session
128
- cssprobe-cli status # Show session status
129
- ```
126
+ | Command | Description |
127
+ |---------|-------------|
128
+ | `open [url]` | Open browser in session mode (non-blocking) |
129
+ | `open [url] --headed` | Show browser window |
130
+ | `open [url] --state <file>` | Open with saved cookies + localStorage |
131
+ | `open [url] --viewport 1280x720` | Custom viewport size |
132
+ | `close` | Close browser session |
133
+ | `status` | Show session status |
130
134
 
131
135
  ### CSS Inspection
132
136
 
133
- ```bash
134
- cssprobe-cli inspect <selector> # Full CSS diagnosis
135
- cssprobe-cli tree <selector> # DOM tree structure
136
- cssprobe-cli layout <selector> # ASCII layout diagram
137
- cssprobe-cli findings <selector> # Only issues/warnings/errors
138
- ```
137
+ | Command | Description |
138
+ |---------|-------------|
139
+ | `inspect <selector>` | Full CSS diagnosis (computed values, declared values, findings) |
140
+ | `inspect <selector> --layout` | Include ASCII layout diagram |
141
+ | `inspect <selector> --brief` | Compact: tree sketch + warnings/errors only |
142
+ | `inspect <selector> --json` | Structured JSON output |
143
+ | `tree <selector>` | DOM tree structure |
144
+ | `layout <selector>` | ASCII layout diagram |
145
+ | `findings <selector>` | Only issues/warnings/errors |
139
146
 
140
147
  ### CSS Injection
141
148
 
142
- ```bash
143
- cssprobe-cli inject-css <css> # Inject CSS into current page
144
- ```
149
+ | Command | Description |
150
+ |---------|-------------|
151
+ | `inject-css <css>` | Inject CSS into current page |
145
152
 
146
153
  ### Browser
147
154
 
148
- ```bash
149
- cssprobe-cli resize <width> <height> # Resize browser viewport
150
- cssprobe-cli eval <expression> # Evaluate JavaScript (browser context)
151
- cssprobe-cli playwright <call> # Execute Playwright API (Node.js context)
152
- cssprobe-cli screenshot # Take screenshot
153
- ```
155
+ | Command | Description |
156
+ |---------|-------------|
157
+ | `resize <width> <height>` | Resize browser viewport |
158
+ | `eval <expression>` | Evaluate JavaScript (browser context) |
159
+ | `playwright <call>` | Execute Playwright API (Node.js context) |
160
+ | `screenshot` | Take screenshot |
154
161
 
155
162
  ### State
156
163
 
157
- ```bash
158
- cssprobe-cli state-import [file] # Import cookies from Netscape format
159
- ```
164
+ | Command | Description |
165
+ |---------|-------------|
166
+ | `state-import <file>` | Import cookies from Netscape format |
160
167
 
161
168
  ### Configuration
162
169
 
163
- ```bash
164
- cssprobe-cli config-show # Show current config
165
- cssprobe-cli config-set <key> <value> # Set config value
166
- cssprobe-cli config-list # List all profiles
167
- cssprobe-cli config-use <name> # Switch active profile
168
- cssprobe-cli config-new <name> # Create new profile
169
- cssprobe-cli config-path # Show config file path
170
- ```
171
-
172
- ---
173
-
174
- ## inspect Options
175
-
176
- ```bash
177
- cssprobe-cli inspect <selector> [options]
178
-
179
- Arguments:
180
- <selector> CSS selector for root element
181
-
182
- Options:
183
- --json Output structured JSON
184
- --brief Compact output: tree sketch + warnings/errors only
185
- --layout ASCII layout diagram
186
- --depth <n> DOM tree depth (default: auto, max 20)
187
- ```
188
-
189
- ---
190
-
191
- ## tree Options
192
-
193
- ```bash
194
- cssprobe-cli tree <selector> [options]
195
-
196
- Arguments:
197
- <selector> CSS selector for root element
198
-
199
- Options:
200
- --depth <n> Tree depth (default: auto, max 20)
201
- ```
202
-
203
- ---
204
-
205
- ## inject-css
206
-
207
- ```bash
208
- cssprobe-cli inject-css <css>
209
-
210
- Arguments:
211
- <css> CSS code to inject into the current page
212
- ```
213
-
214
- ---
215
-
216
- ## state-import
217
-
218
- Import cookies from Netscape format (browser export standard) into a Playwright state file.
219
-
220
- ```bash
221
- # From file
222
- cssprobe-cli state-import cookies.txt --out mystate.json
223
-
224
- # From file with custom name (saves to ~/.cssprobe-cli/states/<name>.json)
225
- cssprobe-cli state-import cookies.txt --name mysite
226
-
227
- # From stdin
228
- cat cookies.txt | cssprobe-cli state-import --out mystate.json
229
-
230
- # Merge into existing state
231
- cssprobe-cli state-import new-cookies.txt --merge existing.json --out merged.json
232
- ```
233
-
234
- Netscape format (tab-separated):
235
- ```
236
- .example.com TRUE / TRUE 1813025057 session_id abc123
237
- .example.com TRUE / FALSE -1 lang zh-CN
238
- ```
170
+ | Command | Description |
171
+ |---------|-------------|
172
+ | `config-show` | Show current config |
173
+ | `config-set <key> <value>` | Set config value |
174
+ | `config-list` | List all profiles |
175
+ | `config-use <name>` | Switch active profile |
176
+ | `config-new <name>` | Create new profile |
177
+ | `config-path` | Show config file path |
239
178
 
240
179
  ---
241
180
 
@@ -261,14 +200,10 @@ cssprobe-cli config-set browser chromium
261
200
  cssprobe-cli config-set depth 8
262
201
  cssprobe-cli config-set viewport 375x812
263
202
 
264
- # Show current config
265
- cssprobe-cli config-show
266
-
267
203
  # Profile management
268
204
  cssprobe-cli config-new staging
269
205
  cssprobe-cli -p staging config-set browser firefox
270
206
  cssprobe-cli config-use staging
271
- cssprobe-cli config-list
272
207
  ```
273
208
 
274
209
  Priority: CLI flags > Environment variables > Config file
@@ -285,31 +220,13 @@ Config file: `~/.cssprobe-clirc`
285
220
 
286
221
  ---
287
222
 
288
- ## Agent Skill
289
-
290
- ```bash
291
- # Install skill for all detected agents
292
- cssprobe-cli skill-install
293
-
294
- # Install for a specific agent
295
- cssprobe-cli skill-install --target opencode
296
- cssprobe-cli skill-install --target claude
297
-
298
- # Remove installed skills
299
- cssprobe-cli skill-uninstall
300
- ```
301
-
302
- ---
303
-
304
- ## Global Options
223
+ ## Supported Platforms
305
224
 
306
- ```
307
- --json Output as JSON (default: Markdown)
308
- --raw Output raw result without formatting
309
- --help [command] Show help for a command or global
310
- --version Show version
311
- -p, --profile Use named config profile
312
- ```
225
+ | Platform | Architectures |
226
+ |----------|---------------|
227
+ | macOS | x64, arm64 |
228
+ | Linux | x64, arm64 |
229
+ | Windows | x64, arm64 |
313
230
 
314
231
  ---
315
232
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cssprobe-cli",
3
- "version": "0.2.15",
3
+ "version": "0.2.21",
4
4
  "description": "Runtime CSS probe — inspect layout, colors, backgrounds, fonts and more in a live browser. AI agents and shell automation.",
5
5
  "keywords": [
6
6
  "css",
@@ -14,7 +14,10 @@
14
14
  "automation"
15
15
  ],
16
16
  "homepage": "https://github.com/mack-peng/cssprobe-cli#readme",
17
- "repository": "github:mack-peng/cssprobe-cli",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "https://github.com/mack-peng/cssprobe-cli.git"
20
+ },
18
21
  "license": "MIT",
19
22
  "author": "strikingly",
20
23
  "main": "dist/index.js",