@crouton-kit/capture 1.3.13 → 1.3.14
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/bin/capture +8 -4
- package/package.json +1 -1
- package/src/capture.ts +16 -1
package/bin/capture
CHANGED
|
@@ -9822,7 +9822,7 @@ function validateHarAppendBatch(value, source) {
|
|
|
9822
9822
|
return { entries, incompleteLifecycles };
|
|
9823
9823
|
}
|
|
9824
9824
|
function captureVersion() {
|
|
9825
|
-
const version = "1.3.
|
|
9825
|
+
const version = "1.3.14";
|
|
9826
9826
|
return typeof version === "string" && version.length > 0 ? version : "development";
|
|
9827
9827
|
}
|
|
9828
9828
|
function token() {
|
|
@@ -11581,7 +11581,7 @@ function wallTime(value) {
|
|
|
11581
11581
|
}
|
|
11582
11582
|
}
|
|
11583
11583
|
function captureVersion2() {
|
|
11584
|
-
const version = "1.3.
|
|
11584
|
+
const version = "1.3.14";
|
|
11585
11585
|
return typeof version === "string" && version.length > 0 ? version : "development";
|
|
11586
11586
|
}
|
|
11587
11587
|
function deepFreeze(value) {
|
|
@@ -241033,6 +241033,9 @@ init_motion();
|
|
|
241033
241033
|
init_cdp();
|
|
241034
241034
|
init_lib();
|
|
241035
241035
|
var ROOTS = ["session", "page", "tab", "measure", "motion", "cdp", "lib"];
|
|
241036
|
+
var GUESSABLE_HINTS = {
|
|
241037
|
+
screenshot: "page shot"
|
|
241038
|
+
};
|
|
241036
241039
|
var ROOT_BLOCKS = [
|
|
241037
241040
|
COMMAND_BLOCK,
|
|
241038
241041
|
COMMAND_BLOCK2,
|
|
@@ -241056,7 +241059,7 @@ CDP_PORT / CDP_TARGET pin the browser + tab for orchestrators \u2014 precedence:
|
|
|
241056
241059
|
explicit flag > active session > env.`;
|
|
241057
241060
|
}
|
|
241058
241061
|
function printVersion() {
|
|
241059
|
-
const declared = "1.3.
|
|
241062
|
+
const declared = "1.3.14";
|
|
241060
241063
|
if (declared) {
|
|
241061
241064
|
console.log(declared);
|
|
241062
241065
|
return;
|
|
@@ -241086,10 +241089,11 @@ async function main() {
|
|
|
241086
241089
|
if (ROOTS.includes(command) || command === "__bridge-serve") {
|
|
241087
241090
|
return cdpMain();
|
|
241088
241091
|
}
|
|
241092
|
+
const hint = GUESSABLE_HINTS[command];
|
|
241089
241093
|
throw captureError(
|
|
241090
241094
|
"invocation",
|
|
241091
241095
|
"unknown_command",
|
|
241092
|
-
`Unknown command ${command}; expected one of the seven roots: session, page, tab, measure, motion, cdp, lib.`
|
|
241096
|
+
hint ? `Unknown command ${command}; did you mean \`capture ${hint}\`? Expected one of the seven roots: session, page, tab, measure, motion, cdp, lib.` : `Unknown command ${command}; expected one of the seven roots: session, page, tab, measure, motion, cdp, lib.`
|
|
241093
241097
|
);
|
|
241094
241098
|
}
|
|
241095
241099
|
main().catch((error) => {
|
package/package.json
CHANGED
package/src/capture.ts
CHANGED
|
@@ -25,6 +25,18 @@ import { COMMAND_BLOCK as LIB_BLOCK } from './cdp/commands/lib.js';
|
|
|
25
25
|
/** The seven visible root children, in help order. */
|
|
26
26
|
const ROOTS = ['session', 'page', 'tab', 'measure', 'motion', 'cdp', 'lib'] as const;
|
|
27
27
|
|
|
28
|
+
/**
|
|
29
|
+
* Guessable former/legacy tokens with one unambiguous current destination —
|
|
30
|
+
* an orientation hint on the `unknown_command` error, never a second
|
|
31
|
+
* dispatchable path (the guessed token still fails; only the message
|
|
32
|
+
* changes). Deliberately small: an entry only earns a place here when its
|
|
33
|
+
* correct destination is unambiguous, so this stays a short discriminator
|
|
34
|
+
* rather than a growing synonym taxonomy.
|
|
35
|
+
*/
|
|
36
|
+
const GUESSABLE_HINTS: Readonly<Record<string, string>> = {
|
|
37
|
+
screenshot: 'page shot',
|
|
38
|
+
};
|
|
39
|
+
|
|
28
40
|
const ROOT_BLOCKS = [
|
|
29
41
|
SESSION_BLOCK,
|
|
30
42
|
PAGE_BLOCK,
|
|
@@ -90,10 +102,13 @@ async function main(): Promise<void> {
|
|
|
90
102
|
return cdpMain();
|
|
91
103
|
}
|
|
92
104
|
|
|
105
|
+
const hint = GUESSABLE_HINTS[command];
|
|
93
106
|
throw captureError(
|
|
94
107
|
'invocation',
|
|
95
108
|
'unknown_command',
|
|
96
|
-
|
|
109
|
+
hint
|
|
110
|
+
? `Unknown command ${command}; did you mean \`capture ${hint}\`? Expected one of the seven roots: session, page, tab, measure, motion, cdp, lib.`
|
|
111
|
+
: `Unknown command ${command}; expected one of the seven roots: session, page, tab, measure, motion, cdp, lib.`,
|
|
97
112
|
);
|
|
98
113
|
}
|
|
99
114
|
|