cssprobe-cli 0.2.6 → 0.2.8
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 +86 -15
- package/README.md +128 -69
- package/dist/browser/launcher.d.ts +3 -0
- package/dist/browser/launcher.js +4 -0
- package/dist/cli/command.d.ts +1 -1
- package/dist/cli/commands.d.ts +6 -33
- package/dist/cli/commands.js +117 -48
- package/dist/cli/program.js +165 -386
- package/dist/config/helpGenerator.js +3 -1
- package/dist/daemon/daemon.d.ts +15 -0
- package/dist/daemon/daemon.js +259 -0
- package/dist/daemon/daemonEntry.d.ts +6 -0
- package/dist/daemon/daemonEntry.js +27 -0
- package/dist/daemon/session.d.ts +52 -0
- package/dist/daemon/session.js +220 -0
- package/dist/daemonEntry.js +1466 -0
- package/dist/help.json +82 -34
- package/dist/utils/socketConnection.d.ts +21 -0
- package/dist/utils/socketConnection.js +77 -0
- package/docs/code-design-session-mode.md +393 -0
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
## Project
|
|
4
4
|
|
|
5
|
-
`cssprobe-cli` — Runtime CSS probe for layout/scroll/overflow/color/font inspection. Entrypoint: `bin/cssprobe-cli.js` → `require('../dist/index')`.
|
|
6
|
-
Build: `npm run build` (= `tsc` + `esbuild` collector IIFE bundle + `tsx scripts/generate-help.ts`).
|
|
7
|
-
Test: `npm test` (= `tsx --test tests/*.test.ts` — Node.js built-in test runner,
|
|
5
|
+
`cssprobe-cli` — Runtime CSS probe for layout/scroll/overflow/color/font inspection with session-based browser management. Entrypoint: `bin/cssprobe-cli.js` → `require('../dist/index')`.
|
|
6
|
+
Build: `npm run build` (= `tsc` + `esbuild` collector IIFE bundle + `esbuild` daemon entry + `tsx scripts/generate-help.ts`).
|
|
7
|
+
Test: `npm test` (= `tsx --test tests/*.test.ts` — Node.js built-in test runner, 45 tests).
|
|
8
8
|
Dependencies: `playwright-core`, `zod`. Dev: `typescript`, `@types/node`, `tsx`, `esbuild`.
|
|
9
9
|
|
|
10
10
|
## Architecture
|
|
@@ -13,36 +13,76 @@ Dependencies: `playwright-core`, `zod`. Dev: `typescript`, `@types/node`, `tsx`,
|
|
|
13
13
|
src/
|
|
14
14
|
├── index.ts # export { program } from './cli/program'
|
|
15
15
|
├── cli/
|
|
16
|
-
│ ├── program.ts # Entry: minimist parse →
|
|
17
|
-
│ ├── commands.ts #
|
|
16
|
+
│ ├── program.ts # Entry: minimist parse → session command dispatch
|
|
17
|
+
│ ├── commands.ts # Command definitions — all Zod schemas
|
|
18
18
|
│ ├── command.ts # declareCommand(), parseCommand() (Zod validation)
|
|
19
19
|
│ ├── output.ts # TextOutput / JsonOutput strategy pattern
|
|
20
20
|
│ └── minimist.ts # Arguments parser (forked from playwright-cli)
|
|
21
|
+
├── daemon/
|
|
22
|
+
│ ├── session.ts # Session management (single session, Unix socket)
|
|
23
|
+
│ ├── daemon.ts # Daemon process: browser lifecycle + command execution
|
|
24
|
+
│ └── daemonEntry.ts # Daemon entry point (spawned as child process)
|
|
21
25
|
├── engine/
|
|
22
26
|
│ ├── types.ts # Shared types: Snapshot, TreeNode, Finding, Confidence
|
|
23
27
|
│ ├── collector.ts # Browser-side: DOM traversal, computed styles, declared values
|
|
24
28
|
│ ├── analyzer.ts # Node-side: pure functions, confidence model, pattern detection
|
|
25
29
|
│ └── renderer.ts # Markdown / JSON rendering
|
|
26
30
|
├── browser/
|
|
27
|
-
│ └── launcher.ts # Playwright wrapper: launch, navigate, inject collector
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
│ └── launcher.ts # Playwright wrapper: launch, navigate, inject collector
|
|
32
|
+
├── config/
|
|
33
|
+
│ ├── config.ts # Config loader (CLI → env → ~/.cssprobe-clirc profiles)
|
|
34
|
+
│ └── helpGenerator.ts # Build-time: Zod schemas → dist/help.json
|
|
35
|
+
└── utils/
|
|
36
|
+
└── socketConnection.ts # Socket communication (adapted from playwright-cli)
|
|
31
37
|
```
|
|
32
38
|
|
|
33
39
|
## Key Patterns
|
|
34
40
|
|
|
41
|
+
- **Session-based architecture**: Inspired by playwright-cli. `open` starts a daemon process, subsequent commands connect via Unix socket. Single session (default) mode.
|
|
42
|
+
- **Daemon process**: Long-running background process that manages the browser and executes commands. Communicates via Unix domain socket.
|
|
35
43
|
- **Three-layer engine**: `collector.ts` (browser, esbuild IIFE) → `analyzer.ts` (Node, pure functions) → `renderer.ts` (Markdown/JSON). Collector only gathers facts; analyzer does inference with confidence; renderer formats output.
|
|
36
44
|
- **Collector bundling**: `collector.ts` is bundled by esbuild as an IIFE (`format: 'iife', globalName: '__cssprobe-cli'`). The launcher injects it via `page.addScriptTag({ content })`, then calls `window.__cssprobe-cli.collect(cfg)`.
|
|
37
45
|
- **Confidence model**: Every `Finding` carries `confidence: 'DEFINITE' | 'INDEFINITE' | 'UNVERIFIABLE'`. Computed values = DEFINITE. Percent declarations = INDEFINITE. Missing/blocked declarations = UNVERIFIABLE.
|
|
38
46
|
- **Command definition**: `declareCommand({ name, category, description, args?, options? })` — purely declarative, no execution logic.
|
|
39
|
-
- **Command dispatch**: `minimist` parse → `parseCommand()` Zod validate →
|
|
47
|
+
- **Command dispatch**: `minimist` parse → `parseCommand()` Zod validate → session command execution via daemon socket.
|
|
40
48
|
- **Output strategy**: `Output` interface → `TextOutput` (Markdown for inspect, tables for lists) / `JsonOutput` (machine-readable JSON).
|
|
41
49
|
- **Config priority**: CLI flags → env vars → `~/.cssprobe-clirc` profiles. Switch with `-p <profile>`.
|
|
42
|
-
- **State management**:
|
|
50
|
+
- **State management**: `state-import` converts Netscape cookies. Session persists browser state until `close`.
|
|
43
51
|
- **Browser discovery**: `findBrowserExecutable()` scans `~/Library/Caches/ms-playwright/chromium-*` for existing Chrome installations.
|
|
44
52
|
- **Error format**: `Error: <message>` → JSON mode: `{ isError: true, error: "<message>" }` → `process.exit(1)`
|
|
45
53
|
|
|
54
|
+
## Commands
|
|
55
|
+
|
|
56
|
+
### Session Management
|
|
57
|
+
- `open [url]` — Open browser in session mode (non-blocking)
|
|
58
|
+
- `--viewport <WxH>` — Set viewport size (e.g. `--viewport 1280x720`)
|
|
59
|
+
- `close` — Close the browser session
|
|
60
|
+
- `status` — Show current session status
|
|
61
|
+
|
|
62
|
+
### CSS Inspection
|
|
63
|
+
- `inspect <selector>` — Inspect runtime CSS of a page element
|
|
64
|
+
- `tree <selector>` — Show DOM tree structure
|
|
65
|
+
- `layout <selector>` — Show ASCII layout diagram
|
|
66
|
+
- `findings <selector>` — Show only issues/warnings/errors
|
|
67
|
+
|
|
68
|
+
### CSS Injection
|
|
69
|
+
- `inject-css <css>` — Inject CSS into the current page
|
|
70
|
+
|
|
71
|
+
### Browser
|
|
72
|
+
- `resize <width> <height>` — Resize browser viewport
|
|
73
|
+
- `eval <expression>` — Evaluate JavaScript (browser context)
|
|
74
|
+
- `playwright <call>` — Execute Playwright API call (Node.js context)
|
|
75
|
+
- `screenshot` — Take a screenshot
|
|
76
|
+
|
|
77
|
+
### State
|
|
78
|
+
- `state-import [file]` — Import cookies from Netscape format
|
|
79
|
+
|
|
80
|
+
### Config
|
|
81
|
+
- `config-show` / `config-set` / `config-list` / `config-use` / `config-new` / `config-path`
|
|
82
|
+
|
|
83
|
+
### Skills
|
|
84
|
+
- `skill-install` / `skill-uninstall`
|
|
85
|
+
|
|
46
86
|
## Adding a Command
|
|
47
87
|
|
|
48
88
|
1. Add `declareCommand({...})` in `src/cli/commands.ts` following the existing pattern
|
|
@@ -57,11 +97,42 @@ src/
|
|
|
57
97
|
npm run build
|
|
58
98
|
├── 1. tsc # Compile TS → dist/ (includes .d.ts)
|
|
59
99
|
├── 2. esbuild collector.ts # Bundle browser-side code → dist/collector-bundle.js (IIFE)
|
|
60
|
-
|
|
100
|
+
├── 3. esbuild daemonEntry.ts # Bundle daemon entry → dist/daemonEntry.js (CJS)
|
|
101
|
+
└── 4. tsx generate-help.ts # Zod schemas → dist/help.json
|
|
61
102
|
```
|
|
62
103
|
|
|
63
104
|
The collector bundle is a self-contained IIFE that exposes `window.__cssprobe-cli.collect(cfg)`. It runs entirely in the browser context — no Node imports.
|
|
64
105
|
|
|
106
|
+
## Session Mode
|
|
107
|
+
|
|
108
|
+
cssprobe-cli uses a session-based architecture inspired by playwright-cli:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# Open browser (starts daemon, non-blocking)
|
|
112
|
+
cssprobe-cli open https://example.com
|
|
113
|
+
|
|
114
|
+
# User operates manually in the browser...
|
|
115
|
+
|
|
116
|
+
# Run CSS diagnosis
|
|
117
|
+
cssprobe-cli inspect .sidebar --json
|
|
118
|
+
cssprobe-cli tree .content --depth 3
|
|
119
|
+
cssprobe-cli layout .header
|
|
120
|
+
|
|
121
|
+
# Inject CSS to test changes
|
|
122
|
+
cssprobe-cli inject-css ".sidebar { background: red; }"
|
|
123
|
+
|
|
124
|
+
# Close browser (stops daemon)
|
|
125
|
+
cssprobe-cli close
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### How It Works
|
|
129
|
+
|
|
130
|
+
1. `open` spawns a daemon process that manages the browser
|
|
131
|
+
2. Daemon listens on a Unix socket at `~/Library/Caches/cssprobe-cli/daemon/<hash>/default.sock`
|
|
132
|
+
3. Subsequent commands connect to the socket and send commands
|
|
133
|
+
4. Daemon executes commands using Playwright's browser API
|
|
134
|
+
5. `close` stops the daemon and closes the browser
|
|
135
|
+
|
|
65
136
|
## What Makes This Different from dom-report
|
|
66
137
|
|
|
67
138
|
| | dom-report (old) | cssprobe-cli (new) |
|
|
@@ -72,6 +143,6 @@ The collector bundle is a self-contained IIFE that exposes `window.__cssprobe-cl
|
|
|
72
143
|
| Output | Single markdown string | Markdown (default) / JSON (--json) |
|
|
73
144
|
| Config | `window.__DOM_REPORT_CFG` global + eval two-step | CLI flags → env → rc file, one command |
|
|
74
145
|
| ROOT_SELECTOR | Manual or eval probe | `--auto-root` auto-detection |
|
|
75
|
-
| Tests | None |
|
|
76
|
-
| Build | Regex stripping CJS module.exports | esbuild IIFE bundle, clean build |
|
|
77
|
-
|
|
|
146
|
+
| Tests | None | 45 unit tests (command, analyzer, output, renderer) |
|
|
147
|
+
| Build | Regex stripping CJS module.exports | esbuild IIFE + CJS bundle, clean build |
|
|
148
|
+
| Session | None (blocking commands) | Session-based daemon architecture |
|
package/README.md
CHANGED
|
@@ -23,100 +23,143 @@ cssprobe-cli skill-install
|
|
|
23
23
|
### 1. Inspect a Page
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
|
-
#
|
|
27
|
-
cssprobe-cli
|
|
26
|
+
# Open browser (non-blocking, starts daemon session)
|
|
27
|
+
cssprobe-cli open https://getbootstrap.com/docs/5.3/examples/checkout
|
|
28
28
|
|
|
29
|
-
#
|
|
30
|
-
cssprobe-cli
|
|
29
|
+
# Open with custom viewport
|
|
30
|
+
cssprobe-cli open https://example.com --viewport 1280x720
|
|
31
31
|
|
|
32
|
-
#
|
|
33
|
-
cssprobe-cli inspect
|
|
32
|
+
# Inspect with CSS selector
|
|
33
|
+
cssprobe-cli inspect .container
|
|
34
|
+
|
|
35
|
+
# Show DOM tree
|
|
36
|
+
cssprobe-cli tree .container --depth 3
|
|
37
|
+
|
|
38
|
+
# Show ASCII layout diagram
|
|
39
|
+
cssprobe-cli layout .container
|
|
40
|
+
|
|
41
|
+
# Show only issues/warnings
|
|
42
|
+
cssprobe-cli findings .container
|
|
43
|
+
|
|
44
|
+
# Close browser when done
|
|
45
|
+
cssprobe-cli close
|
|
34
46
|
```
|
|
35
47
|
|
|
36
48
|
### 2. Login-Protected Pages
|
|
37
49
|
|
|
38
50
|
```bash
|
|
39
|
-
#
|
|
40
|
-
cssprobe-cli
|
|
51
|
+
# Open browser in headed mode
|
|
52
|
+
cssprobe-cli open https://mysite.com --headed
|
|
41
53
|
|
|
42
|
-
#
|
|
43
|
-
cssprobe-cli login https://mysite.com
|
|
54
|
+
# User manually logs in...
|
|
44
55
|
|
|
45
|
-
#
|
|
46
|
-
cssprobe-cli inspect
|
|
56
|
+
# Run diagnosis on authenticated page
|
|
57
|
+
cssprobe-cli inspect .dashboard
|
|
47
58
|
|
|
48
|
-
#
|
|
49
|
-
cssprobe-cli
|
|
50
|
-
```
|
|
59
|
+
# Inject CSS to test changes
|
|
60
|
+
cssprobe-cli inject-css ".sidebar { background: #f0f0f0; }"
|
|
51
61
|
|
|
52
|
-
|
|
62
|
+
# Take screenshot
|
|
63
|
+
cssprobe-cli screenshot
|
|
53
64
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
cssprobe-cli interactive https://mysite.com --state ~/.cssprobe-cli/states/mysite.json
|
|
65
|
+
# Close when done
|
|
66
|
+
cssprobe-cli close
|
|
57
67
|
```
|
|
58
68
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
inspect> findings .modal # Findings only
|
|
65
|
-
inspect> json .dialog-A # JSON output
|
|
66
|
-
inspect> report .dialog-A # Full report
|
|
67
|
-
inspect> .dialog-A # Shorthand for report
|
|
68
|
-
inspect> navigate https://other.com # Navigate to new URL
|
|
69
|
-
inspect> depth 10 # Set depth
|
|
70
|
-
inspect> help # Show help
|
|
71
|
-
inspect> quit # Exit
|
|
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
|
|
72
74
|
```
|
|
73
75
|
|
|
74
76
|
### 4. JSON Output
|
|
75
77
|
|
|
76
78
|
```bash
|
|
77
|
-
cssprobe-cli
|
|
78
|
-
cssprobe-cli inspect
|
|
79
|
+
cssprobe-cli open https://getbootstrap.com/docs/5.3/examples/checkout
|
|
80
|
+
cssprobe-cli inspect body --json
|
|
81
|
+
cssprobe-cli inspect body --json | jq '.findings[] | {id, confidence, message}'
|
|
82
|
+
cssprobe-cli close
|
|
79
83
|
```
|
|
80
84
|
|
|
81
85
|
---
|
|
82
86
|
|
|
83
|
-
##
|
|
87
|
+
## Session Mode
|
|
88
|
+
|
|
89
|
+
cssprobe-cli uses a session-based architecture for non-browser interaction:
|
|
84
90
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
+
```bash
|
|
92
|
+
# Start session (opens browser, returns immediately)
|
|
93
|
+
cssprobe-cli open <url>
|
|
94
|
+
|
|
95
|
+
# Run commands (each command is independent, non-blocking)
|
|
96
|
+
cssprobe-cli inspect <selector>
|
|
97
|
+
cssprobe-cli tree <selector>
|
|
98
|
+
cssprobe-cli layout <selector>
|
|
99
|
+
cssprobe-cli findings <selector>
|
|
100
|
+
cssprobe-cli inject-css <css>
|
|
101
|
+
cssprobe-cli screenshot
|
|
102
|
+
cssprobe-cli eval <expression>
|
|
103
|
+
|
|
104
|
+
# Check session status
|
|
105
|
+
cssprobe-cli status
|
|
106
|
+
|
|
107
|
+
# End session (closes browser)
|
|
108
|
+
cssprobe-cli close
|
|
109
|
+
```
|
|
91
110
|
|
|
92
111
|
---
|
|
93
112
|
|
|
94
113
|
## Commands
|
|
95
114
|
|
|
96
|
-
###
|
|
115
|
+
### Session Management
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
cssprobe-cli open [url] # Open browser in session mode (non-blocking)
|
|
119
|
+
cssprobe-cli open [url] --viewport 1280x720 # Open with custom viewport
|
|
120
|
+
cssprobe-cli close # Close browser session
|
|
121
|
+
cssprobe-cli status # Show session status
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### CSS Inspection
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
cssprobe-cli inspect <selector> # Full CSS diagnosis
|
|
128
|
+
cssprobe-cli tree <selector> # DOM tree structure
|
|
129
|
+
cssprobe-cli layout <selector> # ASCII layout diagram
|
|
130
|
+
cssprobe-cli findings <selector> # Only issues/warnings/errors
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### CSS Injection
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
cssprobe-cli inject-css <css> # Inject CSS into current page
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Browser
|
|
97
140
|
|
|
98
141
|
```bash
|
|
99
|
-
cssprobe-cli
|
|
100
|
-
cssprobe-cli
|
|
101
|
-
cssprobe-cli
|
|
102
|
-
cssprobe-cli
|
|
142
|
+
cssprobe-cli resize <width> <height> # Resize browser viewport
|
|
143
|
+
cssprobe-cli eval <expression> # Evaluate JavaScript (browser context)
|
|
144
|
+
cssprobe-cli playwright <call> # Execute Playwright API (Node.js context)
|
|
145
|
+
cssprobe-cli screenshot # Take screenshot
|
|
103
146
|
```
|
|
104
147
|
|
|
105
|
-
###
|
|
148
|
+
### State
|
|
106
149
|
|
|
107
150
|
```bash
|
|
108
|
-
cssprobe-cli
|
|
151
|
+
cssprobe-cli state-import [file] # Import cookies from Netscape format
|
|
109
152
|
```
|
|
110
153
|
|
|
111
154
|
### Configuration
|
|
112
155
|
|
|
113
156
|
```bash
|
|
114
|
-
cssprobe-cli config-show
|
|
115
|
-
cssprobe-cli config-set <key> <value>
|
|
116
|
-
cssprobe-cli config-list
|
|
117
|
-
cssprobe-cli config-use <name>
|
|
118
|
-
cssprobe-cli config-new <name>
|
|
119
|
-
cssprobe-cli config-path
|
|
157
|
+
cssprobe-cli config-show # Show current config
|
|
158
|
+
cssprobe-cli config-set <key> <value> # Set config value
|
|
159
|
+
cssprobe-cli config-list # List all profiles
|
|
160
|
+
cssprobe-cli config-use <name> # Switch active profile
|
|
161
|
+
cssprobe-cli config-new <name> # Create new profile
|
|
162
|
+
cssprobe-cli config-path # Show config file path
|
|
120
163
|
```
|
|
121
164
|
|
|
122
165
|
---
|
|
@@ -124,25 +167,41 @@ cssprobe-cli config-path # Show config file path
|
|
|
124
167
|
## inspect Options
|
|
125
168
|
|
|
126
169
|
```bash
|
|
127
|
-
cssprobe-cli inspect <
|
|
170
|
+
cssprobe-cli inspect <selector> [options]
|
|
128
171
|
|
|
129
172
|
Arguments:
|
|
130
|
-
<
|
|
131
|
-
[selector] CSS selector for root (auto-detected if omitted)
|
|
173
|
+
<selector> CSS selector for root element
|
|
132
174
|
|
|
133
175
|
Options:
|
|
134
176
|
--json Output structured JSON
|
|
135
|
-
--headed Show browser window
|
|
136
|
-
--browser <engine> chromium|firefox|webkit (default chromium)
|
|
137
|
-
--zoom Run 1x/0.5x viewport diagnosis
|
|
138
|
-
--depth <n> DOM tree depth (default: auto)
|
|
139
|
-
--max-nodes <n> Node count cap (default 60)
|
|
140
|
-
--up-to <tag> Ancestor stop tag (default html)
|
|
141
|
-
--state <file> Load saved state (cookies + localStorage)
|
|
142
177
|
--brief Compact output: tree sketch + warnings/errors only
|
|
143
|
-
--layout ASCII layout diagram
|
|
144
|
-
--
|
|
145
|
-
|
|
178
|
+
--layout ASCII layout diagram
|
|
179
|
+
--depth <n> DOM tree depth (default: auto, max 20)
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## tree Options
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
cssprobe-cli tree <selector> [options]
|
|
188
|
+
|
|
189
|
+
Arguments:
|
|
190
|
+
<selector> CSS selector for root element
|
|
191
|
+
|
|
192
|
+
Options:
|
|
193
|
+
--depth <n> Tree depth (default: auto, max 20)
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## inject-css
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
cssprobe-cli inject-css <css>
|
|
202
|
+
|
|
203
|
+
Arguments:
|
|
204
|
+
<css> CSS code to inject into the current page
|
|
146
205
|
```
|
|
147
206
|
|
|
148
207
|
---
|
|
@@ -248,8 +307,8 @@ cssprobe-cli skill-uninstall
|
|
|
248
307
|
|
|
249
308
|
```bash
|
|
250
309
|
npm install
|
|
251
|
-
npm run build # tsc + esbuild collector
|
|
252
|
-
npm test # Run unit tests
|
|
310
|
+
npm run build # tsc + esbuild collector + daemon entry + generate help.json
|
|
311
|
+
npm test # Run unit tests (45 tests)
|
|
253
312
|
npx tsc --noEmit # Type check only
|
|
254
313
|
```
|
|
255
314
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type Page } from 'playwright-core';
|
|
1
2
|
import type { Snapshot, CollectConfig } from '../engine/types';
|
|
2
3
|
export interface LauncherOptions {
|
|
3
4
|
browser?: string;
|
|
@@ -32,5 +33,7 @@ export declare class BrowserLauncher {
|
|
|
32
33
|
* Returns the path to the saved state file.
|
|
33
34
|
*/
|
|
34
35
|
loginAndSave(url: string, statePath: string): Promise<string>;
|
|
36
|
+
/** Get the current page object. */
|
|
37
|
+
getPage(): Page | null;
|
|
35
38
|
close(): Promise<void>;
|
|
36
39
|
}
|
package/dist/browser/launcher.js
CHANGED
|
@@ -247,6 +247,10 @@ class BrowserLauncher {
|
|
|
247
247
|
console.error(` State saved to: ${resolvedPath}`);
|
|
248
248
|
return resolvedPath;
|
|
249
249
|
}
|
|
250
|
+
/** Get the current page object. */
|
|
251
|
+
getPage() {
|
|
252
|
+
return this.page;
|
|
253
|
+
}
|
|
250
254
|
async close() {
|
|
251
255
|
if (this.context)
|
|
252
256
|
await this.context.close().catch(() => { });
|
package/dist/cli/command.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as z from 'zod';
|
|
2
2
|
import type zodType from 'zod';
|
|
3
|
-
export type Category = 'core' | 'config' | 'skill';
|
|
3
|
+
export type Category = 'core' | 'config' | 'skill' | 'cssprobe' | 'export';
|
|
4
4
|
export interface HelpEntry {
|
|
5
5
|
help: string;
|
|
6
6
|
flags: Record<string, 'boolean' | 'string'>;
|
package/dist/cli/commands.d.ts
CHANGED
|
@@ -4,51 +4,24 @@ export declare const commands: {
|
|
|
4
4
|
[k: string]: AnyCommandSchema;
|
|
5
5
|
};
|
|
6
6
|
export declare const inspectCommand: import("./command").CommandSchema<z.ZodObject<{
|
|
7
|
-
|
|
8
|
-
selector: z.ZodOptional<z.ZodString>;
|
|
7
|
+
selector: z.ZodString;
|
|
9
8
|
}, "strip", z.ZodTypeAny, {
|
|
10
|
-
|
|
11
|
-
selector?: string | undefined;
|
|
9
|
+
selector: string;
|
|
12
10
|
}, {
|
|
13
|
-
|
|
14
|
-
selector?: string | undefined;
|
|
11
|
+
selector: string;
|
|
15
12
|
}>, z.ZodObject<{
|
|
16
13
|
json: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
-
headed: z.ZodOptional<z.ZodBoolean>;
|
|
18
|
-
browser: z.ZodOptional<z.ZodEnum<["chromium", "firefox", "webkit"]>>;
|
|
19
|
-
zoom: z.ZodOptional<z.ZodBoolean>;
|
|
20
|
-
depth: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, unknown>>;
|
|
21
|
-
'max-nodes': z.ZodOptional<z.ZodEffects<z.ZodNumber, number, unknown>>;
|
|
22
|
-
'up-to': z.ZodOptional<z.ZodString>;
|
|
23
|
-
state: z.ZodOptional<z.ZodString>;
|
|
24
14
|
brief: z.ZodOptional<z.ZodBoolean>;
|
|
25
15
|
layout: z.ZodOptional<z.ZodBoolean>;
|
|
26
|
-
|
|
27
|
-
viewport: z.ZodOptional<z.ZodString>;
|
|
16
|
+
depth: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, unknown>>;
|
|
28
17
|
}, "strip", z.ZodTypeAny, {
|
|
29
18
|
json?: boolean | undefined;
|
|
30
|
-
headed?: boolean | undefined;
|
|
31
|
-
browser?: "chromium" | "firefox" | "webkit" | undefined;
|
|
32
|
-
zoom?: boolean | undefined;
|
|
33
|
-
depth?: number | undefined;
|
|
34
|
-
'max-nodes'?: number | undefined;
|
|
35
|
-
'up-to'?: string | undefined;
|
|
36
|
-
state?: string | undefined;
|
|
37
19
|
brief?: boolean | undefined;
|
|
38
20
|
layout?: boolean | undefined;
|
|
39
|
-
|
|
40
|
-
viewport?: string | undefined;
|
|
21
|
+
depth?: number | undefined;
|
|
41
22
|
}, {
|
|
42
23
|
json?: boolean | undefined;
|
|
43
|
-
headed?: boolean | undefined;
|
|
44
|
-
browser?: "chromium" | "firefox" | "webkit" | undefined;
|
|
45
|
-
zoom?: boolean | undefined;
|
|
46
|
-
depth?: unknown;
|
|
47
|
-
'max-nodes'?: unknown;
|
|
48
|
-
'up-to'?: string | undefined;
|
|
49
|
-
state?: string | undefined;
|
|
50
24
|
brief?: boolean | undefined;
|
|
51
25
|
layout?: boolean | undefined;
|
|
52
|
-
|
|
53
|
-
viewport?: string | undefined;
|
|
26
|
+
depth?: unknown;
|
|
54
27
|
}>>;
|