cssprobe-cli 0.2.6 → 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,40 +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)'),
68
- viewport: z.string().optional().describe('viewport size as WxH (e.g. 375x812, default 1280x720)'),
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'),
69
110
  }),
70
111
  });
71
- const login = (0, command_1.declareCommand)({
72
- 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',
73
140
  category: 'core',
74
- description: 'Open browser for interactive login, then save state for later use',
141
+ description: 'Import cookies from Netscape format file',
75
142
  args: z.object({
76
- url: urlArg,
143
+ file: z.string().optional().describe('Netscape cookie file path (reads from stdin if omitted)'),
77
144
  }),
78
145
  options: z.object({
79
- browser: z.enum(['chromium', 'firefox', 'webkit']).optional().describe('browser engine (default chromium)'),
80
- 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'),
81
148
  }),
82
149
  });
83
150
  // ── config ──
@@ -131,7 +198,7 @@ const configPath = (0, command_1.declareCommand)({
131
198
  const skillInstall = (0, command_1.declareCommand)({
132
199
  name: 'skill-install',
133
200
  category: 'skill',
134
- description: 'Install Agent Skill for cssprobe-cli (teaches agents how to use the CLI)',
201
+ description: 'Install Agent Skill for cssprobe-cli',
135
202
  options: z.object({
136
203
  target: z.string().optional().describe('agent target: auto, all, opencode, claude, codex, cursor, hermes, gemini (default: auto)'),
137
204
  local: z.boolean().optional().describe('install to current directory instead of home'),
@@ -148,35 +215,19 @@ const skillUninstall = (0, command_1.declareCommand)({
148
215
  path: z.string().optional().describe('custom base directory'),
149
216
  }),
150
217
  });
151
- const stateImport = (0, command_1.declareCommand)({
152
- name: 'state-import',
153
- category: 'core',
154
- description: 'Import cookies from Netscape format file into a Playwright state file',
155
- args: z.object({
156
- file: z.string().optional().describe('Netscape cookie file path (reads from stdin if omitted)'),
157
- }),
158
- options: z.object({
159
- out: z.string().optional().describe('output state file path (default: ~/.cssprobe-cli/states/imported.json)'),
160
- merge: z.string().optional().describe('existing state file to merge into'),
161
- }),
162
- });
163
- const interactive = (0, command_1.declareCommand)({
164
- name: 'interactive',
165
- category: 'core',
166
- description: 'Open browser and inspect interactively (REPL mode)',
167
- args: z.object({
168
- url: urlArg,
169
- }),
170
- options: z.object({
171
- browser: z.enum(['chromium', 'firefox', 'webkit']).optional().describe('browser engine (default chromium)'),
172
- state: z.string().optional().describe('path to saved state file (cookies + localStorage)'),
173
- depth: numberArg.optional().describe('DOM tree depth (default: auto, max 20)'),
174
- viewport: z.string().optional().describe('viewport size as WxH (e.g. 375x812, default 1280x720)'),
175
- }),
176
- });
218
+ // ── export ──
177
219
  const commandsArray = [
178
- 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
179
229
  configShow, configSet, configList, configUse, configNew, configPath,
230
+ // skill
180
231
  skillInstall, skillUninstall,
181
232
  ];
182
233
  exports.commands = Object.fromEntries(commandsArray.map(cmd => [cmd.name, cmd]));