cssprobe-cli 0.3.0 → 0.4.0
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 +59 -6
- package/CHANGELOG.md +21 -0
- package/README.md +111 -2
- package/dist/browser/frames.d.ts +15 -0
- package/dist/browser/frames.js +60 -0
- package/dist/browser/interactions.d.ts +49 -0
- package/dist/browser/interactions.js +96 -0
- package/dist/browser/launcher.d.ts +30 -2
- package/dist/browser/launcher.js +141 -34
- package/dist/browser/sampler.d.ts +43 -0
- package/dist/browser/sampler.js +111 -0
- package/dist/cli/commands.d.ts +3 -0
- package/dist/cli/commands.js +162 -4
- package/dist/cli/input.d.ts +6 -0
- package/dist/cli/input.js +24 -0
- package/dist/cli/program.js +171 -1
- package/dist/cli/session-ops.d.ts +10 -1
- package/dist/cli/session-ops.js +27 -56
- package/dist/cli/state-check.d.ts +17 -0
- package/dist/cli/state-check.js +43 -0
- package/dist/cli/url-guard.d.ts +2 -0
- package/dist/cli/url-guard.js +24 -0
- package/dist/daemon/daemon.js +162 -18
- package/dist/daemon/expect.d.ts +8 -0
- package/dist/daemon/expect.js +47 -0
- package/dist/daemon/flowRunner.d.ts +73 -0
- package/dist/daemon/flowRunner.js +177 -0
- package/dist/engine/evalSerializer.d.ts +1 -0
- package/dist/engine/evalSerializer.js +43 -0
- package/dist/help.json +156 -16
- package/dist/installer/skill-template.js +43 -0
- package/dist/scenario/assertions.d.ts +13 -0
- package/dist/scenario/assertions.js +111 -0
- package/dist/scenario/reporters.d.ts +13 -0
- package/dist/scenario/reporters.js +79 -0
- package/dist/scenario/runner.d.ts +10 -0
- package/dist/scenario/runner.js +244 -0
- package/dist/scenario/schema.d.ts +1210 -0
- package/dist/scenario/schema.js +145 -0
- package/dist/utils/screenshot.d.ts +1 -0
- package/dist/utils/screenshot.js +58 -0
- package/docs/guide/installation.md +1 -1
- package/llms.txt +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.suiteSchema = exports.caseSchema = exports.stepSchema = void 0;
|
|
37
|
+
const z = __importStar(require("zod"));
|
|
38
|
+
const waitUntil = z.enum(['domcontentloaded', 'load', 'networkidle']).optional();
|
|
39
|
+
const matcherFields = {
|
|
40
|
+
eq: z.unknown().optional(),
|
|
41
|
+
ne: z.unknown().optional(),
|
|
42
|
+
match: z.string().optional(),
|
|
43
|
+
within: z.object({ expected: z.number(), tolerance: z.number() }).optional(),
|
|
44
|
+
min: z.number().optional(),
|
|
45
|
+
max: z.number().optional(),
|
|
46
|
+
};
|
|
47
|
+
const gotoStep = z.object({
|
|
48
|
+
do: z.literal('goto'),
|
|
49
|
+
url: z.string(),
|
|
50
|
+
waitUntil,
|
|
51
|
+
save: z.string().optional(),
|
|
52
|
+
});
|
|
53
|
+
const reloadStep = z.object({
|
|
54
|
+
do: z.literal('reload'),
|
|
55
|
+
waitUntil,
|
|
56
|
+
save: z.string().optional(),
|
|
57
|
+
});
|
|
58
|
+
const evalStep = z.object({
|
|
59
|
+
do: z.literal('eval'),
|
|
60
|
+
expression: z.string(),
|
|
61
|
+
frame: z.string().optional(),
|
|
62
|
+
save: z.string().optional(),
|
|
63
|
+
});
|
|
64
|
+
const sampleStep = z.object({
|
|
65
|
+
do: z.literal('sample'),
|
|
66
|
+
expression: z.string(),
|
|
67
|
+
interval: z.number().optional(),
|
|
68
|
+
duration: z.number().optional(),
|
|
69
|
+
key: z.string().optional(),
|
|
70
|
+
tailFrom: z.number().optional(),
|
|
71
|
+
ignoreErrors: z.boolean().optional(),
|
|
72
|
+
frame: z.string().optional(),
|
|
73
|
+
save: z.string().optional(),
|
|
74
|
+
});
|
|
75
|
+
const waitStableStep = z.object({
|
|
76
|
+
do: z.literal('waitStable'),
|
|
77
|
+
expression: z.string(),
|
|
78
|
+
tolerance: z.number().optional(),
|
|
79
|
+
window: z.number().optional(),
|
|
80
|
+
timeout: z.number().optional(),
|
|
81
|
+
interval: z.number().optional(),
|
|
82
|
+
frame: z.string().optional(),
|
|
83
|
+
save: z.string().optional(),
|
|
84
|
+
});
|
|
85
|
+
const clickStep = z.object({
|
|
86
|
+
do: z.literal('click'),
|
|
87
|
+
selector: z.string(),
|
|
88
|
+
nth: z.number().optional(),
|
|
89
|
+
timeout: z.number().optional(),
|
|
90
|
+
});
|
|
91
|
+
const waitForStep = z.object({
|
|
92
|
+
do: z.literal('waitFor'),
|
|
93
|
+
selector: z.string().optional(),
|
|
94
|
+
js: z.string().optional(),
|
|
95
|
+
networkIdle: z.boolean().optional(),
|
|
96
|
+
state: z.enum(['visible', 'hidden', 'attached', 'detached']).optional(),
|
|
97
|
+
timeout: z.number().optional(),
|
|
98
|
+
});
|
|
99
|
+
const screenshotStep = z.object({
|
|
100
|
+
do: z.literal('screenshot'),
|
|
101
|
+
path: z.string().optional(),
|
|
102
|
+
fullPage: z.boolean().optional(),
|
|
103
|
+
});
|
|
104
|
+
const assertStep = z.object({
|
|
105
|
+
do: z.literal('assert'),
|
|
106
|
+
label: z.string().optional(),
|
|
107
|
+
on: z.string().optional(),
|
|
108
|
+
path: z.string().optional(),
|
|
109
|
+
url: z.string().optional(),
|
|
110
|
+
globals: z.record(z.string(), z.string()).optional(),
|
|
111
|
+
absent: z.array(z.string()).optional(),
|
|
112
|
+
...matcherFields,
|
|
113
|
+
});
|
|
114
|
+
exports.stepSchema = z.discriminatedUnion('do', [
|
|
115
|
+
gotoStep,
|
|
116
|
+
reloadStep,
|
|
117
|
+
evalStep,
|
|
118
|
+
sampleStep,
|
|
119
|
+
waitStableStep,
|
|
120
|
+
clickStep,
|
|
121
|
+
waitForStep,
|
|
122
|
+
screenshotStep,
|
|
123
|
+
assertStep,
|
|
124
|
+
]);
|
|
125
|
+
const viewportSchema = z.object({ width: z.number(), height: z.number() });
|
|
126
|
+
exports.caseSchema = z.object({
|
|
127
|
+
name: z.string(),
|
|
128
|
+
url: z.string().optional(),
|
|
129
|
+
state: z.string().optional(),
|
|
130
|
+
frame: z.string().optional(),
|
|
131
|
+
steps: z.array(exports.stepSchema).min(1),
|
|
132
|
+
});
|
|
133
|
+
exports.suiteSchema = z.object({
|
|
134
|
+
name: z.string(),
|
|
135
|
+
defaults: z
|
|
136
|
+
.object({
|
|
137
|
+
url: z.string().optional(),
|
|
138
|
+
state: z.string().optional(),
|
|
139
|
+
frame: z.string().optional(),
|
|
140
|
+
viewport: viewportSchema.optional(),
|
|
141
|
+
})
|
|
142
|
+
.optional(),
|
|
143
|
+
cases: z.array(exports.caseSchema).min(1),
|
|
144
|
+
});
|
|
145
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function saveScreenshotFile(dataUrl: string, out?: string): string;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.saveScreenshotFile = saveScreenshotFile;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const os = __importStar(require("os"));
|
|
39
|
+
const path = __importStar(require("path"));
|
|
40
|
+
function saveScreenshotFile(dataUrl, out) {
|
|
41
|
+
const base64 = dataUrl.replace(/^data:image\/png;base64,/, '');
|
|
42
|
+
const buffer = Buffer.from(base64, 'base64');
|
|
43
|
+
const resolvedOut = out
|
|
44
|
+
? path.resolve(out)
|
|
45
|
+
: (() => {
|
|
46
|
+
const dir = path.join(os.homedir(), '.cssprobe-cli', 'screenshots');
|
|
47
|
+
if (!fs.existsSync(dir))
|
|
48
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
49
|
+
const ts = new Date().toISOString().replace(/[:.]/g, '-');
|
|
50
|
+
return path.join(dir, `screenshot-${ts}.png`);
|
|
51
|
+
})();
|
|
52
|
+
const dir = path.dirname(resolvedOut);
|
|
53
|
+
if (!fs.existsSync(dir))
|
|
54
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
55
|
+
fs.writeFileSync(resolvedOut, buffer);
|
|
56
|
+
return resolvedOut;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=screenshot.js.map
|
|
@@ -215,7 +215,7 @@ confidence: DEFINITE 8 | INDEFINITE 0 | UNVERIFIABLE 1
|
|
|
215
215
|
## Common Failures Agents Face
|
|
216
216
|
|
|
217
217
|
**"Browser not installed"**
|
|
218
|
-
→ Run `npx playwright install chromium`.
|
|
218
|
+
→ Run `cssprobe-cli doctor` first: it reports the expected vs installed Playwright revision and the exact install command. If a build is missing, run the printed command, usually `npx playwright install chromium`.
|
|
219
219
|
|
|
220
220
|
**"File not found"**
|
|
221
221
|
→ Check the URL or file path. Local files need to exist on disk.
|
package/llms.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# cssprobe-cli
|
|
2
2
|
|
|
3
|
-
> Runtime CSS probe — inspect layout, scroll, colors, backgrounds, fonts in a live browser. Returns DOM tree, ASCII layout diagram and confidence-classified findings for humans and AI agents.
|
|
3
|
+
> Runtime CSS probe — inspect layout, scroll, colors, backgrounds, fonts in a live browser. Returns DOM tree, ASCII layout diagram and confidence-classified findings for humans and AI agents. Interaction commands (click / hover / type / wait-for) drive the page; `sample` / `wait-stable` capture timeline regressions; `frames` targets iframes; `doctor` diagnoses browser installs; `run <file>` executes scripted multi-step flows with assertions and page-error capture; `scenario run <suite.json>` runs repeatable regression suites with artifacts and JUnit output.
|
|
4
4
|
|
|
5
5
|
## Documentation
|
|
6
6
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cssprobe-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"mcpName": "io.github.mack-peng/cssprobe-cli",
|
|
5
5
|
"description": "Runtime CSS probe — inspect layout, colors, backgrounds, fonts and more in a live browser. AI agents and shell automation.",
|
|
6
6
|
"keywords": [
|