cssprobe-cli 0.2.5 → 0.2.7

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.
@@ -44,39 +44,107 @@ const numberArg = z.preprocess((val, ctx) => {
44
44
  return number;
45
45
  }, z.number());
46
46
  const urlArg = z.string().describe('URL, file:// path, or local HTML file path');
47
- // ── core ──
47
+ // ── session management ──
48
+ const open = (0, command_1.declareCommand)({
49
+ name: 'open',
50
+ category: 'core',
51
+ description: 'Open browser in session mode (non-blocking)',
52
+ args: z.object({
53
+ url: urlArg.optional(),
54
+ }),
55
+ options: z.object({
56
+ browser: z.enum(['chromium', 'firefox', 'webkit']).optional().describe('browser engine (default chromium)'),
57
+ headed: z.boolean().optional().describe('show the browser window'),
58
+ }),
59
+ });
60
+ const close = (0, command_1.declareCommand)({
61
+ name: 'close',
62
+ category: 'core',
63
+ description: 'Close the browser session',
64
+ });
65
+ const status = (0, command_1.declareCommand)({
66
+ name: 'status',
67
+ category: 'core',
68
+ description: 'Show current session status',
69
+ });
70
+ // ── cssprobe commands ──
48
71
  const inspect = (0, command_1.declareCommand)({
49
72
  name: 'inspect',
50
- category: 'core',
51
- description: 'Inspect the runtime CSS of a page (layout, scroll, colors, fonts, backgrounds)',
73
+ category: 'cssprobe',
74
+ description: 'Inspect the runtime CSS of a page element',
52
75
  args: z.object({
53
- url: urlArg,
54
- selector: z.string().optional().describe('CSS selector for the root element (auto-detected if omitted)'),
76
+ selector: z.string().describe('CSS selector for the root element'),
55
77
  }),
56
78
  options: z.object({
57
79
  json: z.boolean().optional().describe('output structured JSON instead of Markdown'),
58
- headed: z.boolean().optional().describe('show the browser window'),
59
- browser: z.enum(['chromium', 'firefox', 'webkit']).optional().describe('browser engine (default chromium)'),
60
- zoom: z.boolean().optional().describe('run 1x/0.5x viewport diagnosis'),
61
- depth: numberArg.optional().describe('DOM tree depth (default: auto, max 20)'),
62
- 'max-nodes': numberArg.optional().describe('node count cap (default 60)'),
63
- 'up-to': z.string().optional().describe('ancestor stop tag (default html)'),
64
- state: z.string().optional().describe('path to saved state file (cookies + localStorage)'),
65
80
  brief: z.boolean().optional().describe('compact output: tree sketch + warnings/errors only'),
66
81
  layout: z.boolean().optional().describe('ASCII layout diagram showing element positions and sizes'),
67
- wait: z.boolean().optional().describe('wait for user interaction before collecting (implies --headed)'),
82
+ depth: numberArg.optional().describe('DOM tree depth (default: auto, max 20)'),
83
+ }),
84
+ });
85
+ const tree = (0, command_1.declareCommand)({
86
+ name: 'tree',
87
+ category: 'cssprobe',
88
+ description: 'Show DOM tree structure',
89
+ args: z.object({
90
+ selector: z.string().describe('CSS selector for the root element'),
91
+ }),
92
+ options: z.object({
93
+ depth: numberArg.optional().describe('tree depth (default: auto, max 20)'),
94
+ }),
95
+ });
96
+ const layout = (0, command_1.declareCommand)({
97
+ name: 'layout',
98
+ category: 'cssprobe',
99
+ description: 'Show ASCII layout diagram',
100
+ args: z.object({
101
+ selector: z.string().describe('CSS selector for the root element'),
102
+ }),
103
+ });
104
+ const findings = (0, command_1.declareCommand)({
105
+ name: 'findings',
106
+ category: 'cssprobe',
107
+ description: 'Show only issues/warnings/errors',
108
+ args: z.object({
109
+ selector: z.string().describe('CSS selector for the root element'),
68
110
  }),
69
111
  });
70
- const login = (0, command_1.declareCommand)({
71
- name: 'login',
112
+ const injectCss = (0, command_1.declareCommand)({
113
+ name: 'inject-css',
114
+ category: 'cssprobe',
115
+ description: 'Inject CSS into the current page',
116
+ args: z.object({
117
+ css: z.string().describe('CSS code to inject'),
118
+ }),
119
+ });
120
+ // ── browser commands ──
121
+ const screenshot = (0, command_1.declareCommand)({
122
+ name: 'screenshot',
123
+ category: 'export',
124
+ description: 'Take a screenshot of the current page',
125
+ options: z.object({
126
+ 'full-page': z.boolean().optional().describe('take screenshot of the full scrollable page'),
127
+ }),
128
+ });
129
+ const evalCmd = (0, command_1.declareCommand)({
130
+ name: 'eval',
131
+ category: 'core',
132
+ description: 'Evaluate JavaScript expression on the page',
133
+ args: z.object({
134
+ expression: z.string().describe('JavaScript expression to evaluate'),
135
+ }),
136
+ });
137
+ // ── state management ──
138
+ const stateImport = (0, command_1.declareCommand)({
139
+ name: 'state-import',
72
140
  category: 'core',
73
- description: 'Open browser for interactive login, then save state for later use',
141
+ description: 'Import cookies from Netscape format file',
74
142
  args: z.object({
75
- url: urlArg,
143
+ file: z.string().optional().describe('Netscape cookie file path (reads from stdin if omitted)'),
76
144
  }),
77
145
  options: z.object({
78
- browser: z.enum(['chromium', 'firefox', 'webkit']).optional().describe('browser engine (default chromium)'),
79
- out: z.string().optional().describe('output state file path (default: ~/.cssprobe-cli/states/<domain>.json)'),
146
+ out: z.string().optional().describe('output state file path (default: ~/.cssprobe-cli/states/imported.json)'),
147
+ merge: z.string().optional().describe('existing state file to merge into'),
80
148
  }),
81
149
  });
82
150
  // ── config ──
@@ -93,7 +161,7 @@ const configSet = (0, command_1.declareCommand)({
93
161
  category: 'config',
94
162
  description: 'Set a configuration value',
95
163
  args: z.object({
96
- key: z.string().describe('Config key (browser, depth, headed)'),
164
+ key: z.string().describe('Config key (browser, depth, headed, viewport)'),
97
165
  value: z.string().describe('Config value'),
98
166
  }),
99
167
  options: z.object({
@@ -130,7 +198,7 @@ const configPath = (0, command_1.declareCommand)({
130
198
  const skillInstall = (0, command_1.declareCommand)({
131
199
  name: 'skill-install',
132
200
  category: 'skill',
133
- description: 'Install Agent Skill for cssprobe-cli (teaches agents how to use the CLI)',
201
+ description: 'Install Agent Skill for cssprobe-cli',
134
202
  options: z.object({
135
203
  target: z.string().optional().describe('agent target: auto, all, opencode, claude, codex, cursor, hermes, gemini (default: auto)'),
136
204
  local: z.boolean().optional().describe('install to current directory instead of home'),
@@ -147,34 +215,19 @@ const skillUninstall = (0, command_1.declareCommand)({
147
215
  path: z.string().optional().describe('custom base directory'),
148
216
  }),
149
217
  });
150
- const stateImport = (0, command_1.declareCommand)({
151
- name: 'state-import',
152
- category: 'core',
153
- description: 'Import cookies from Netscape format file into a Playwright state file',
154
- args: z.object({
155
- file: z.string().optional().describe('Netscape cookie file path (reads from stdin if omitted)'),
156
- }),
157
- options: z.object({
158
- out: z.string().optional().describe('output state file path (default: ~/.cssprobe-cli/states/imported.json)'),
159
- merge: z.string().optional().describe('existing state file to merge into'),
160
- }),
161
- });
162
- const interactive = (0, command_1.declareCommand)({
163
- name: 'interactive',
164
- category: 'core',
165
- description: 'Open browser and inspect interactively (REPL mode)',
166
- args: z.object({
167
- url: urlArg,
168
- }),
169
- options: z.object({
170
- browser: z.enum(['chromium', 'firefox', 'webkit']).optional().describe('browser engine (default chromium)'),
171
- state: z.string().optional().describe('path to saved state file (cookies + localStorage)'),
172
- depth: numberArg.optional().describe('DOM tree depth (default: auto, max 20)'),
173
- }),
174
- });
218
+ // ── export ──
175
219
  const commandsArray = [
176
- inspect, login, stateImport, interactive,
220
+ // session management
221
+ open, close, status,
222
+ // cssprobe
223
+ inspect, tree, layout, findings, injectCss,
224
+ // browser
225
+ screenshot, evalCmd,
226
+ // state
227
+ stateImport,
228
+ // config
177
229
  configShow, configSet, configList, configUse, configNew, configPath,
230
+ // skill
178
231
  skillInstall, skillUninstall,
179
232
  ];
180
233
  exports.commands = Object.fromEntries(commandsArray.map(cmd => [cmd.name, cmd]));