cssprobe-cli 0.2.8 → 0.2.9

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
 
@@ -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.9",
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": [
@@ -182,6 +182,9 @@ function buildSkillMd() {
182
182
  '# From file',
183
183
  'cssprobe-cli state-import cookies.txt --out mystate.json',
184
184
  '',
185
+ '# From file with custom name (saves to ~/.cssprobe-cli/states/<name>.json)',
186
+ 'cssprobe-cli state-import cookies.txt --name mysite',
187
+ '',
185
188
  '# From stdin',
186
189
  'cat cookies.txt | cssprobe-cli state-import --out mystate.json',
187
190
  '',
@@ -222,7 +225,7 @@ function buildSkillMd() {
222
225
  '',
223
226
  BT3 + 'bash',
224
227
  '# Import cookies first',
225
- 'cssprobe-cli state-import exported-cookies.txt --out ~/.cssprobe-cli/states/app.json',
228
+ 'cssprobe-cli state-import exported-cookies.txt --name app',
226
229
  '',
227
230
  '# Then inspect with state',
228
231
  'cssprobe-cli inspect https://app.example.com/dashboard ".main-panel" --state ~/.cssprobe-cli/states/app.json',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cssprobe-cli",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
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",