cdp-skill 1.0.18 → 1.0.19
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/EXAMPLES.md
CHANGED
|
@@ -68,7 +68,7 @@ Close when done:
|
|
|
68
68
|
},
|
|
69
69
|
"screenshot": "/tmp/cdp-skill/t1.after.png",
|
|
70
70
|
"fullSnapshot": "/tmp/cdp-skill/t1.after.yaml",
|
|
71
|
-
"viewportSnapshot": "-
|
|
71
|
+
"viewportSnapshot": "/tmp/cdp-skill/t1.viewport.yaml",
|
|
72
72
|
"steps": [{"action": "goto", "status": "ok"}]
|
|
73
73
|
}
|
|
74
74
|
```
|
|
@@ -130,7 +130,7 @@ Close when done:
|
|
|
130
130
|
},
|
|
131
131
|
"screenshot": "/tmp/cdp-skill/t1.after.png",
|
|
132
132
|
"fullSnapshot": "/tmp/cdp-skill/t1.after.yaml",
|
|
133
|
-
"viewportSnapshot": "-
|
|
133
|
+
"viewportSnapshot": "/tmp/cdp-skill/t1.viewport.yaml",
|
|
134
134
|
"steps": [{"action": "click", "status": "ok"}]
|
|
135
135
|
}
|
|
136
136
|
```
|
package/SKILL.md
CHANGED
|
@@ -33,12 +33,12 @@ Tab IDs (t1, t2, ...) persist across CLI invocations. Chrome auto-launches if no
|
|
|
33
33
|
**Output fields:**
|
|
34
34
|
- `status`: "ok" or "error"
|
|
35
35
|
- `tab`: short tab ID (e.g. "t1")
|
|
36
|
-
- `siteProfile`:
|
|
36
|
+
- `siteProfile`: path to site profile file (after goto/newTab to known site)
|
|
37
37
|
- `actionRequired`: `{action, domain, message}` — **MUST be handled immediately** before continuing (see Site Profiles)
|
|
38
38
|
- `context`: `{url, title, scroll: {y, percent}, viewport: {width, height}, activeElement?, modal?}`
|
|
39
39
|
- `screenshot`: path to after-screenshot (auto-captured on every visual action)
|
|
40
40
|
- `fullSnapshot`: path to full-page accessibility snapshot file
|
|
41
|
-
- `viewportSnapshot`:
|
|
41
|
+
- `viewportSnapshot`: path to viewport-only accessibility snapshot file
|
|
42
42
|
- `changes`: `{summary, added[], removed[], changed[]}` — viewport diff on same-page interactions
|
|
43
43
|
- `navigated`: true when URL pathname changed
|
|
44
44
|
- `console`: `{errors, warnings, messages[]}` — captured errors/warnings
|
package/package.json
CHANGED
package/scripts/cdp-skill.js
CHANGED
|
@@ -785,15 +785,15 @@ async function main() {
|
|
|
785
785
|
truncated: result.truncated
|
|
786
786
|
};
|
|
787
787
|
|
|
788
|
-
// Remove null/undefined fields for compactness
|
|
788
|
+
// Remove null/undefined/false-y fields for compactness
|
|
789
789
|
if (!output.siteProfile) delete output.siteProfile;
|
|
790
790
|
if (!output.actionRequired) delete output.actionRequired;
|
|
791
|
-
if (output.navigated
|
|
791
|
+
if (!output.navigated) delete output.navigated;
|
|
792
792
|
if (!output.fullSnapshot) delete output.fullSnapshot;
|
|
793
793
|
if (!output.context) delete output.context;
|
|
794
794
|
if (!output.changes) delete output.changes;
|
|
795
795
|
if (!output.viewportSnapshot) delete output.viewportSnapshot;
|
|
796
|
-
if (output.truncated
|
|
796
|
+
if (!output.truncated) delete output.truncated;
|
|
797
797
|
if (!output.screenshot) delete output.screenshot;
|
|
798
798
|
if (!output.console) delete output.console;
|
|
799
799
|
if (output.errors.length === 0) delete output.errors;
|
|
@@ -408,13 +408,14 @@ function sanitizeDomain(domain) {
|
|
|
408
408
|
* Load a site profile for the given domain.
|
|
409
409
|
*
|
|
410
410
|
* @param {string} domain - hostname (e.g. "github.com")
|
|
411
|
-
* @returns {Promise<string|null>} profile
|
|
411
|
+
* @returns {Promise<string|null>} profile file path or null
|
|
412
412
|
*/
|
|
413
413
|
export async function loadSiteProfile(domain) {
|
|
414
414
|
const clean = sanitizeDomain(domain);
|
|
415
415
|
const profilePath = path.join(SITES_DIR, `${clean}.md`);
|
|
416
416
|
try {
|
|
417
|
-
|
|
417
|
+
await fs.access(profilePath);
|
|
418
|
+
return profilePath;
|
|
418
419
|
} catch {
|
|
419
420
|
return null;
|
|
420
421
|
}
|
|
@@ -452,9 +453,9 @@ export async function executeReadSiteProfile(params) {
|
|
|
452
453
|
throw new Error('readSiteProfile requires a domain string');
|
|
453
454
|
}
|
|
454
455
|
|
|
455
|
-
const
|
|
456
|
-
if (
|
|
457
|
-
return { found: true, domain,
|
|
456
|
+
const profilePath = await loadSiteProfile(domain);
|
|
457
|
+
if (profilePath) {
|
|
458
|
+
return { found: true, domain, path: profilePath };
|
|
458
459
|
}
|
|
459
460
|
return { found: false, domain };
|
|
460
461
|
}
|
|
@@ -668,7 +668,11 @@ export async function runSteps(deps, steps, options = {}) {
|
|
|
668
668
|
result.navigated = navigated;
|
|
669
669
|
result.fullSnapshot = fullSnapshotPath;
|
|
670
670
|
result.context = afterContext;
|
|
671
|
-
|
|
671
|
+
|
|
672
|
+
// Write viewport snapshot to file to keep response concise
|
|
673
|
+
const viewportPath = await resolveTempPath(`${options.tabAlias || 'command'}.viewport.yaml`, '.yaml');
|
|
674
|
+
await fs.writeFile(viewportPath, afterViewport.yaml || '', 'utf8');
|
|
675
|
+
result.viewportSnapshot = viewportPath;
|
|
672
676
|
result.truncated = afterViewport.truncated || false;
|
|
673
677
|
|
|
674
678
|
if (!navigated && beforeViewport?.yaml) {
|
|
@@ -680,7 +680,7 @@ describe('step-executors goto profile integration', () => {
|
|
|
680
680
|
assert.strictEqual(result.action, 'goto');
|
|
681
681
|
assert.strictEqual(result.status, 'ok');
|
|
682
682
|
assert.ok(result.siteProfile);
|
|
683
|
-
assert.ok(result.siteProfile.
|
|
683
|
+
assert.ok(result.siteProfile.endsWith('.md'), 'siteProfile should be a file path');
|
|
684
684
|
});
|
|
685
685
|
|
|
686
686
|
it('should return profileAvailable false on goto for unknown domain', async () => {
|