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/dist/cli/commands.js
CHANGED
|
@@ -44,40 +44,125 @@ 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
|
-
// ──
|
|
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
|
+
viewport: z.string().optional().describe('viewport size as WxH (e.g. 1280x720)'),
|
|
59
|
+
}),
|
|
60
|
+
});
|
|
61
|
+
const close = (0, command_1.declareCommand)({
|
|
62
|
+
name: 'close',
|
|
63
|
+
category: 'core',
|
|
64
|
+
description: 'Close the browser session',
|
|
65
|
+
});
|
|
66
|
+
const status = (0, command_1.declareCommand)({
|
|
67
|
+
name: 'status',
|
|
68
|
+
category: 'core',
|
|
69
|
+
description: 'Show current session status',
|
|
70
|
+
});
|
|
71
|
+
// ── cssprobe commands ──
|
|
48
72
|
const inspect = (0, command_1.declareCommand)({
|
|
49
73
|
name: 'inspect',
|
|
50
|
-
category: '
|
|
51
|
-
description: 'Inspect the runtime CSS of a page
|
|
74
|
+
category: 'cssprobe',
|
|
75
|
+
description: 'Inspect the runtime CSS of a page element',
|
|
52
76
|
args: z.object({
|
|
53
|
-
|
|
54
|
-
selector: z.string().optional().describe('CSS selector for the root element (auto-detected if omitted)'),
|
|
77
|
+
selector: z.string().describe('CSS selector for the root element'),
|
|
55
78
|
}),
|
|
56
79
|
options: z.object({
|
|
57
80
|
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
81
|
brief: z.boolean().optional().describe('compact output: tree sketch + warnings/errors only'),
|
|
66
82
|
layout: z.boolean().optional().describe('ASCII layout diagram showing element positions and sizes'),
|
|
67
|
-
|
|
68
|
-
|
|
83
|
+
depth: numberArg.optional().describe('DOM tree depth (default: auto, max 20)'),
|
|
84
|
+
}),
|
|
85
|
+
});
|
|
86
|
+
const tree = (0, command_1.declareCommand)({
|
|
87
|
+
name: 'tree',
|
|
88
|
+
category: 'cssprobe',
|
|
89
|
+
description: 'Show DOM tree structure',
|
|
90
|
+
args: z.object({
|
|
91
|
+
selector: z.string().describe('CSS selector for the root element'),
|
|
92
|
+
}),
|
|
93
|
+
options: z.object({
|
|
94
|
+
depth: numberArg.optional().describe('tree depth (default: auto, max 20)'),
|
|
95
|
+
}),
|
|
96
|
+
});
|
|
97
|
+
const layout = (0, command_1.declareCommand)({
|
|
98
|
+
name: 'layout',
|
|
99
|
+
category: 'cssprobe',
|
|
100
|
+
description: 'Show ASCII layout diagram',
|
|
101
|
+
args: z.object({
|
|
102
|
+
selector: z.string().describe('CSS selector for the root element'),
|
|
103
|
+
}),
|
|
104
|
+
});
|
|
105
|
+
const findings = (0, command_1.declareCommand)({
|
|
106
|
+
name: 'findings',
|
|
107
|
+
category: 'cssprobe',
|
|
108
|
+
description: 'Show only issues/warnings/errors',
|
|
109
|
+
args: z.object({
|
|
110
|
+
selector: z.string().describe('CSS selector for the root element'),
|
|
69
111
|
}),
|
|
70
112
|
});
|
|
71
|
-
const
|
|
72
|
-
name: '
|
|
113
|
+
const injectCss = (0, command_1.declareCommand)({
|
|
114
|
+
name: 'inject-css',
|
|
115
|
+
category: 'cssprobe',
|
|
116
|
+
description: 'Inject CSS into the current page',
|
|
117
|
+
args: z.object({
|
|
118
|
+
css: z.string().describe('CSS code to inject'),
|
|
119
|
+
}),
|
|
120
|
+
});
|
|
121
|
+
// ── browser commands ──
|
|
122
|
+
const screenshot = (0, command_1.declareCommand)({
|
|
123
|
+
name: 'screenshot',
|
|
124
|
+
category: 'export',
|
|
125
|
+
description: 'Take a screenshot of the current page',
|
|
126
|
+
options: z.object({
|
|
127
|
+
'full-page': z.boolean().optional().describe('take screenshot of the full scrollable page'),
|
|
128
|
+
}),
|
|
129
|
+
});
|
|
130
|
+
const resize = (0, command_1.declareCommand)({
|
|
131
|
+
name: 'resize',
|
|
73
132
|
category: 'core',
|
|
74
|
-
description: '
|
|
133
|
+
description: 'Resize the browser viewport',
|
|
75
134
|
args: z.object({
|
|
76
|
-
|
|
135
|
+
width: numberArg.describe('viewport width'),
|
|
136
|
+
height: numberArg.describe('viewport height'),
|
|
137
|
+
}),
|
|
138
|
+
});
|
|
139
|
+
const evalCmd = (0, command_1.declareCommand)({
|
|
140
|
+
name: 'eval',
|
|
141
|
+
category: 'core',
|
|
142
|
+
description: 'Evaluate JavaScript expression on the page (browser context)',
|
|
143
|
+
args: z.object({
|
|
144
|
+
expression: z.string().describe('JavaScript expression to evaluate'),
|
|
145
|
+
}),
|
|
146
|
+
});
|
|
147
|
+
const playwrightCmd = (0, command_1.declareCommand)({
|
|
148
|
+
name: 'playwright',
|
|
149
|
+
category: 'core',
|
|
150
|
+
description: 'Execute Playwright API call (Node.js context)',
|
|
151
|
+
args: z.object({
|
|
152
|
+
call: z.string().describe('Playwright API call, e.g. "page.setViewportSize({width: 1280, height: 720})"'),
|
|
153
|
+
}),
|
|
154
|
+
});
|
|
155
|
+
// ── state management ──
|
|
156
|
+
const stateImport = (0, command_1.declareCommand)({
|
|
157
|
+
name: 'state-import',
|
|
158
|
+
category: 'core',
|
|
159
|
+
description: 'Import cookies from Netscape format file',
|
|
160
|
+
args: z.object({
|
|
161
|
+
file: z.string().optional().describe('Netscape cookie file path (reads from stdin if omitted)'),
|
|
77
162
|
}),
|
|
78
163
|
options: z.object({
|
|
79
|
-
|
|
80
|
-
|
|
164
|
+
out: z.string().optional().describe('output state file path (default: ~/.cssprobe-cli/states/imported.json)'),
|
|
165
|
+
merge: z.string().optional().describe('existing state file to merge into'),
|
|
81
166
|
}),
|
|
82
167
|
});
|
|
83
168
|
// ── config ──
|
|
@@ -131,7 +216,7 @@ const configPath = (0, command_1.declareCommand)({
|
|
|
131
216
|
const skillInstall = (0, command_1.declareCommand)({
|
|
132
217
|
name: 'skill-install',
|
|
133
218
|
category: 'skill',
|
|
134
|
-
description: 'Install Agent Skill for cssprobe-cli
|
|
219
|
+
description: 'Install Agent Skill for cssprobe-cli',
|
|
135
220
|
options: z.object({
|
|
136
221
|
target: z.string().optional().describe('agent target: auto, all, opencode, claude, codex, cursor, hermes, gemini (default: auto)'),
|
|
137
222
|
local: z.boolean().optional().describe('install to current directory instead of home'),
|
|
@@ -148,35 +233,19 @@ const skillUninstall = (0, command_1.declareCommand)({
|
|
|
148
233
|
path: z.string().optional().describe('custom base directory'),
|
|
149
234
|
}),
|
|
150
235
|
});
|
|
151
|
-
|
|
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
|
-
});
|
|
236
|
+
// ── export ──
|
|
177
237
|
const commandsArray = [
|
|
178
|
-
|
|
238
|
+
// session management
|
|
239
|
+
open, close, status,
|
|
240
|
+
// cssprobe
|
|
241
|
+
inspect, tree, layout, findings, injectCss,
|
|
242
|
+
// browser
|
|
243
|
+
resize, evalCmd, playwrightCmd, screenshot,
|
|
244
|
+
// state
|
|
245
|
+
stateImport,
|
|
246
|
+
// config
|
|
179
247
|
configShow, configSet, configList, configUse, configNew, configPath,
|
|
248
|
+
// skill
|
|
180
249
|
skillInstall, skillUninstall,
|
|
181
250
|
];
|
|
182
251
|
exports.commands = Object.fromEntries(commandsArray.map(cmd => [cmd.name, cmd]));
|