cssprobe-cli 0.2.8 → 0.2.10

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 CHANGED
@@ -56,6 +56,7 @@ src/
56
56
  ### Session Management
57
57
  - `open [url]` — Open browser in session mode (non-blocking)
58
58
  - `--viewport <WxH>` — Set viewport size (e.g. `--viewport 1280x720`)
59
+ - `--state <file>` — Load saved state (cookies + localStorage)
59
60
  - `close` — Close the browser session
60
61
  - `status` — Show current session status
61
62
 
@@ -76,6 +77,9 @@ src/
76
77
 
77
78
  ### State
78
79
  - `state-import [file]` — Import cookies from Netscape format
80
+ - `--out <file>` — Output state file path (default: `~/.cssprobe-cli/states/imported.json`)
81
+ - `--name <name>` — Custom name for the state file (e.g. `mysite` or `mysite.json`)
82
+ - `--merge <file>` — Existing state file to merge into
79
83
 
80
84
  ### Config
81
85
  - `config-show` / `config-set` / `config-list` / `config-use` / `config-new` / `config-path`
package/README.md CHANGED
@@ -71,6 +71,12 @@ cssprobe-cli close
71
71
  ```bash
72
72
  # Import cookies from browser export (Netscape format)
73
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
74
80
  ```
75
81
 
76
82
  ### 4. JSON Output
@@ -117,6 +123,7 @@ cssprobe-cli close
117
123
  ```bash
118
124
  cssprobe-cli open [url] # Open browser in session mode (non-blocking)
119
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
120
127
  cssprobe-cli close # Close browser session
121
128
  cssprobe-cli status # Show session status
122
129
  ```
@@ -214,6 +221,9 @@ Import cookies from Netscape format (browser export standard) into a Playwright
214
221
  # From file
215
222
  cssprobe-cli state-import cookies.txt --out mystate.json
216
223
 
224
+ # From file with custom name (saves to ~/.cssprobe-cli/states/<name>.json)
225
+ cssprobe-cli state-import cookies.txt --name mysite
226
+
217
227
  # From stdin
218
228
  cat cookies.txt | cssprobe-cli state-import --out mystate.json
219
229
 
File without changes
@@ -56,6 +56,7 @@ const open = (0, command_1.declareCommand)({
56
56
  browser: z.enum(['chromium', 'firefox', 'webkit']).optional().describe('browser engine (default chromium)'),
57
57
  headed: z.boolean().optional().describe('show the browser window'),
58
58
  viewport: z.string().optional().describe('viewport size as WxH (e.g. 1280x720)'),
59
+ state: z.string().optional().describe('path to saved state file (cookies + localStorage)'),
59
60
  }),
60
61
  });
61
62
  const close = (0, command_1.declareCommand)({
@@ -162,6 +163,7 @@ const stateImport = (0, command_1.declareCommand)({
162
163
  }),
163
164
  options: z.object({
164
165
  out: z.string().optional().describe('output state file path (default: ~/.cssprobe-cli/states/imported.json)'),
166
+ name: z.string().optional().describe('custom name for the state file (e.g. mysite or mysite.json)'),
165
167
  merge: z.string().optional().describe('existing state file to merge into'),
166
168
  }),
167
169
  });
@@ -112,6 +112,7 @@ async function handleOpen(command, args, output) {
112
112
  const browser = parsed.browser || 'chromium';
113
113
  const headed = !!parsed.headed;
114
114
  const viewportStr = parsed.viewport;
115
+ const state = parsed.state;
115
116
  // Parse viewport
116
117
  let viewport;
117
118
  if (viewportStr) {
@@ -133,6 +134,7 @@ async function handleOpen(command, args, output) {
133
134
  browser,
134
135
  headed,
135
136
  viewport,
137
+ state,
136
138
  _: ['open', url],
137
139
  }, 'open');
138
140
  // Wait a bit for daemon to start
@@ -394,7 +396,16 @@ async function handleStateImport(command, args, output) {
394
396
  const cmdArgs = splitArgs(args);
395
397
  const parsed = (0, command_1.parseCommand)(command, cmdArgs);
396
398
  const filePath = parsed.file;
397
- const outPath = parsed.out || path_1.default.join(os_1.default.homedir(), '.cssprobe-cli', 'states', 'imported.json');
399
+ const name = parsed.name;
400
+ let outPath = parsed.out;
401
+ if (!outPath && name) {
402
+ // Use custom name in default states directory
403
+ const fileName = name.endsWith('.json') ? name : `${name}.json`;
404
+ outPath = path_1.default.join(os_1.default.homedir(), '.cssprobe-cli', 'states', fileName);
405
+ }
406
+ else if (!outPath) {
407
+ outPath = path_1.default.join(os_1.default.homedir(), '.cssprobe-cli', 'states', 'imported.json');
408
+ }
398
409
  const mergePath = parsed.merge;
399
410
  let content;
400
411
  if (filePath) {
@@ -11,5 +11,6 @@ export interface DaemonOptions {
11
11
  width: number;
12
12
  height: number;
13
13
  };
14
+ state?: string;
14
15
  }
15
16
  export declare function startDaemon(sessionName: string, clientInfo: ClientInfo, options: DaemonOptions): Promise<string>;
@@ -34,6 +34,7 @@ async function startDaemon(sessionName, clientInfo, options) {
34
34
  browser: options.browser || 'chromium',
35
35
  headed: options.headed !== false,
36
36
  viewport: options.viewport,
37
+ state: options.state,
37
38
  });
38
39
  const server = net_1.default.createServer(socket => {
39
40
  const connection = new socketConnection_1.SocketConnection(socket);
@@ -12,6 +12,7 @@ const sessionName = args[0] || 'default';
12
12
  const options = {
13
13
  headed: args.includes('--headed'),
14
14
  browser: args.find(a => a.startsWith('--browser='))?.split('=')[1],
15
+ state: args.find(a => a.startsWith('--state='))?.split('=')[1],
15
16
  };
16
17
  async function main() {
17
18
  try {
@@ -84,6 +84,8 @@ class Session {
84
84
  daemonArgs.push('--headed');
85
85
  if (args.browser)
86
86
  daemonArgs.push(`--browser=${args.browser}`);
87
+ if (args.state)
88
+ daemonArgs.push(`--state=${args.state}`);
87
89
  const child = require('child_process').spawn(process.execPath, daemonArgs, {
88
90
  detached: true,
89
91
  stdio: ['ignore', 'pipe', err],
@@ -31,7 +31,7 @@ var require_package = __commonJS({
31
31
  "package.json"(exports2, module2) {
32
32
  module2.exports = {
33
33
  name: "cssprobe-cli",
34
- version: "0.2.8",
34
+ version: "0.2.10",
35
35
  description: "Runtime CSS probe \u2014 inspect layout, colors, backgrounds, fonts and more in a live browser. AI agents and shell automation.",
36
36
  keywords: [
37
37
  "css",
@@ -1184,7 +1184,8 @@ async function startDaemon(sessionName2, clientInfo, options2) {
1184
1184
  const launcher = new BrowserLauncher({
1185
1185
  browser: options2.browser || "chromium",
1186
1186
  headed: options2.headed !== false,
1187
- viewport: options2.viewport
1187
+ viewport: options2.viewport,
1188
+ state: options2.state
1188
1189
  });
1189
1190
  const server = import_net.default.createServer((socket) => {
1190
1191
  const connection = new SocketConnection(socket);
@@ -1452,7 +1453,8 @@ var args = process.argv.slice(2);
1452
1453
  var sessionName = args[0] || "default";
1453
1454
  var options = {
1454
1455
  headed: args.includes("--headed"),
1455
- browser: args.find((a) => a.startsWith("--browser="))?.split("=")[1]
1456
+ browser: args.find((a) => a.startsWith("--browser="))?.split("=")[1],
1457
+ state: args.find((a) => a.startsWith("--state="))?.split("=")[1]
1456
1458
  };
1457
1459
  async function main() {
1458
1460
  try {
package/dist/help.json CHANGED
@@ -2,11 +2,12 @@
2
2
  "global": "Usage: cssprobe-cli <command> [args] [options]\n\n\nSession Management:\n open [url] open browser in session mode (non-blocking)\n close close the browser session\n status show current session status\n resize <width> <height> resize the browser viewport\n eval <expression> evaluate javascript expression on the page (browser context)\n playwright <call> execute playwright api call (node.js context)\n state-import [file] import cookies from netscape format file\n\nCSS Inspection:\n inspect <selector> inspect the runtime css of a page element\n tree <selector> show dom tree structure\n layout <selector> show ascii layout diagram\n findings <selector> show only issues/warnings/errors\n inject-css <css> inject css into the current page\n\nExport:\n screenshot take a screenshot of the current page\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\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
  "open": {
5
- "help": "cssprobe-cli open [url]\n\nOpen browser in session mode (non-blocking)\n\nArguments:\n [url] url, file:// path, or local html file path\nOptions:\n --browser browser engine (default chromium)\n --headed show the browser window\n --viewport viewport size as wxh (e.g. 1280x720)\n\nGlobal options:\n --json output as JSON\n --profile, -p <name> use named profile",
5
+ "help": "cssprobe-cli open [url]\n\nOpen browser in session mode (non-blocking)\n\nArguments:\n [url] url, file:// path, or local html file path\nOptions:\n --browser browser engine (default chromium)\n --headed show the browser window\n --viewport viewport size as wxh (e.g. 1280x720)\n --state path to saved state file (cookies + localstorage)\n\nGlobal options:\n --json output as JSON\n --profile, -p <name> use named profile",
6
6
  "flags": {
7
7
  "browser": "string",
8
8
  "headed": "boolean",
9
- "viewport": "string"
9
+ "viewport": "string",
10
+ "state": "string"
10
11
  },
11
12
  "args": [
12
13
  "url"
@@ -94,9 +95,10 @@
94
95
  "args": []
95
96
  },
96
97
  "state-import": {
97
- "help": "cssprobe-cli state-import [file]\n\nImport cookies from Netscape format file\n\nArguments:\n [file] netscape cookie file path (reads from stdin if omitted)\nOptions:\n --out output state file path (default: ~/.cssprobe-cli/states/imported.json)\n --merge existing state file to merge into\n\nGlobal options:\n --json output as JSON\n --profile, -p <name> use named profile",
98
+ "help": "cssprobe-cli state-import [file]\n\nImport cookies from Netscape format file\n\nArguments:\n [file] netscape cookie file path (reads from stdin if omitted)\nOptions:\n --out output state file path (default: ~/.cssprobe-cli/states/imported.json)\n --name custom name for the state file (e.g. mysite or mysite.json)\n --merge existing state file to merge into\n\nGlobal options:\n --json output as JSON\n --profile, -p <name> use named profile",
98
99
  "flags": {
99
100
  "out": "string",
101
+ "name": "string",
100
102
  "merge": "string"
101
103
  },
102
104
  "args": [
@@ -1,8 +1,8 @@
1
1
  /**
2
- * cssprobe-cli-cli Agent Skill templates.
2
+ * cssprobe-cli Agent Skill templates.
3
3
  *
4
- * Installed into agent-specific skill directories via `cssprobe-cli-cli skill-install`.
5
- * Teaches agents how to use cssprobe-cli-cli for runtime CSS inspection — layout,
4
+ * Installed into agent-specific skill directories via `cssprobe-cli skill-install`.
5
+ * Teaches agents how to use cssprobe-cli for runtime CSS inspection — layout,
6
6
  * scroll, overflow, colors, backgrounds, fonts — with confidence levels.
7
7
  */
8
8
  export declare function buildSkillMd(): string;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  /**
3
- * cssprobe-cli-cli Agent Skill templates.
3
+ * cssprobe-cli Agent Skill templates.
4
4
  *
5
- * Installed into agent-specific skill directories via `cssprobe-cli-cli skill-install`.
6
- * Teaches agents how to use cssprobe-cli-cli for runtime CSS inspection — layout,
5
+ * Installed into agent-specific skill directories via `cssprobe-cli skill-install`.
6
+ * Teaches agents how to use cssprobe-cli for runtime CSS inspection — layout,
7
7
  * scroll, overflow, colors, backgrounds, fonts — with confidence levels.
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -15,20 +15,20 @@ const BT3 = '```'; // triple backtick
15
15
  function buildSkillMd() {
16
16
  return [
17
17
  FRONTMATTER_DELIM,
18
- 'name: cssprobe-cli-cli',
18
+ 'name: cssprobe-cli',
19
19
  'description: >',
20
- ' Runtime CSS probe for layout/scroll/overflow inspection. Use cssprobe-cli-cli to',
20
+ ' Runtime CSS probe for layout/scroll/overflow inspection. Use cssprobe-cli to',
21
21
  ' diagnose CSS issues in live browsers — height chains, scroll containers,',
22
22
  ' overflow, flex constraints, containing block hijacks. Produces structured',
23
23
  ' reports with DEFINITE/INDEFINITE/UNVERIFIABLE confidence levels.',
24
24
  'metadata:',
25
25
  ' requires:',
26
- ' bins: ["cssprobe-cli-cli", "playwright"]',
26
+ ' bins: ["cssprobe-cli", "playwright"]',
27
27
  FRONTMATTER_DELIM,
28
28
  '',
29
- '# cssprobe-cli-cli -- Runtime CSS Probe Skill',
29
+ '# cssprobe-cli -- Runtime CSS Probe Skill',
30
30
  '',
31
- 'Use cssprobe-cli-cli to inspect the runtime CSS of any web page. It launches a real',
31
+ 'Use cssprobe-cli to inspect the runtime CSS of any web page. It launches a real',
32
32
  'browser, captures computed styles and DOM structure, and produces a structured',
33
33
  'report with confidence levels.',
34
34
  '',
@@ -47,9 +47,9 @@ function buildSkillMd() {
47
47
  'Do NOT memorize all commands. Use:',
48
48
  '',
49
49
  BT3 + 'bash',
50
- 'cssprobe-cli-cli --help # all commands grouped by category',
51
- 'cssprobe-cli-cli inspect --help # specific command: args, options, description',
52
- 'cssprobe-cli-cli state-import --help # cookie import command',
50
+ 'cssprobe-cli --help # all commands grouped by category',
51
+ 'cssprobe-cli inspect --help # specific command: args, options, description',
52
+ 'cssprobe-cli state-import --help # cookie import command',
53
53
  BT3,
54
54
  '',
55
55
  '## Core Workflow: Inspect a Page',
@@ -83,11 +83,10 @@ function buildSkillMd() {
83
83
  '### Option B: Interactive login',
84
84
  '',
85
85
  BT3 + 'bash',
86
- 'cssprobe-cli login https://mysite.com',
87
- '# Browser opens -> complete login manually -> press Enter',
88
- '# State saved to ~/.cssprobe-cli/states/mysite.com.json',
86
+ 'cssprobe-cli open https://mysite.com --headed',
87
+ '# Browser opens -> complete login manually -> continue inspection',
89
88
  '',
90
- 'cssprobe-cli inspect https://mysite.com/page ".target" --state ~/.cssprobe-cli/states/mysite.com.json',
89
+ 'cssprobe-cli inspect .target',
91
90
  BT3,
92
91
  '',
93
92
  '### Option C: Merge cookies into existing state',
@@ -182,6 +181,9 @@ function buildSkillMd() {
182
181
  '# From file',
183
182
  'cssprobe-cli state-import cookies.txt --out mystate.json',
184
183
  '',
184
+ '# From file with custom name (saves to ~/.cssprobe-cli/states/<name>.json)',
185
+ 'cssprobe-cli state-import cookies.txt --name mysite',
186
+ '',
185
187
  '# From stdin',
186
188
  'cat cookies.txt | cssprobe-cli state-import --out mystate.json',
187
189
  '',
@@ -222,7 +224,7 @@ function buildSkillMd() {
222
224
  '',
223
225
  BT3 + 'bash',
224
226
  '# Import cookies first',
225
- 'cssprobe-cli state-import exported-cookies.txt --out ~/.cssprobe-cli/states/app.json',
227
+ 'cssprobe-cli state-import exported-cookies.txt --name app',
226
228
  '',
227
229
  '# Then inspect with state',
228
230
  'cssprobe-cli inspect https://app.example.com/dashboard ".main-panel" --state ~/.cssprobe-cli/states/app.json',
@@ -108,15 +108,10 @@ cssprobe-cli inspect https://mysite.com/page ".target" --state ~/.cssprobe-cli/s
108
108
  ### Option B: Interactive Login
109
109
 
110
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:
111
+ cssprobe-cli open https://mysite.com --headed
112
+ # Browser opens -> complete login manually -> continue inspection
117
113
 
118
- ```bash
119
- cssprobe-cli inspect https://mysite.com/page ".target" --state ~/.cssprobe-cli/states/mysite.com.json
114
+ cssprobe-cli inspect .target
120
115
  ```
121
116
 
122
117
  ### Option C: Merge Cookies into Existing State
@@ -125,39 +120,36 @@ cssprobe-cli inspect https://mysite.com/page ".target" --state ~/.cssprobe-cli/s
125
120
  cssprobe-cli state-import new-cookies.txt --merge existing-state.json --out updated.json
126
121
  ```
127
122
 
128
- ### Option D: Wait for User Interaction
129
-
130
- For pages that require clicking a button or opening a dialog before inspection:
123
+ ### Option D: Open with Saved State
131
124
 
132
125
  ```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
126
+ # Import cookies first
127
+ cssprobe-cli state-import cookies.txt --name mysite
128
+
129
+ # Open browser with saved state
130
+ cssprobe-cli open https://mysite.com --state ~/.cssprobe-cli/states/mysite.json
131
+
132
+ # Then inspect
133
+ cssprobe-cli inspect .target
135
134
  ```
136
135
 
137
136
  ---
138
137
 
139
- ## Step 5: Interactive Mode (REPL)
138
+ ## Step 5: Session Mode
140
139
 
141
140
  For inspecting multiple areas of the same page without re-opening the browser:
142
141
 
143
142
  ```bash
144
- cssprobe-cli interactive https://mysite.com --state ~/.cssprobe-cli/states/mysite.json
145
- ```
143
+ cssprobe-cli open https://mysite.com --state ~/.cssprobe-cli/states/mysite.json
146
144
 
147
- Runtime commands:
145
+ # Run multiple inspections
146
+ cssprobe-cli tree .dialog-A
147
+ cssprobe-cli layout .sidebar-B
148
+ cssprobe-cli findings .modal
149
+ cssprobe-cli inspect .dialog-A --json
148
150
 
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
151
+ # Close when done
152
+ cssprobe-cli close
161
153
  ```
162
154
 
163
155
  ---
@@ -228,7 +220,7 @@ confidence: DEFINITE 8 | INDEFINITE 0 | UNVERIFIABLE 1
228
220
  → This is expected. Declared values from blocked sheets are marked UNVERIFIABLE. Computed values from getComputedStyle() are still accurate.
229
221
 
230
222
  **Page needs login**
231
- → Use `cssprobe-cli login <url>` for interactive login, or `cssprobe-cli state-import cookies.txt` to import cookies.
223
+ → Use `cssprobe-cli open <url> --headed` for interactive login, or `cssprobe-cli state-import cookies.txt --name mysite` to import cookies.
232
224
 
233
225
  ---
234
226
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cssprobe-cli",
3
- "version": "0.2.8",
3
+ "version": "0.2.10",
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",