codex-chatgpt-control 0.1.0-alpha.1 → 0.2.0-alpha.1
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/CHANGELOG.md +6 -0
- package/README.md +55 -0
- package/contracts/v1/fixtures/backend-capabilities.json +7 -0
- package/contracts/v1/fixtures/blocker-explanation-profiles.json +114 -0
- package/contracts/v1/fixtures/command-descriptors.json +192 -15
- package/contracts/v1/fixtures/doctor-bridge-upload.json +8 -0
- package/contracts/v1/fixtures/doctor-scenario-preflight.json +108 -0
- package/contracts/v1/fixtures/existing-tab-diagnostics-blocker.json +57 -0
- package/contracts/v1/fixtures/files-preflight-success.json +32 -0
- package/contracts/v1/fixtures/help-root.json +1 -1
- package/contracts/v1/fixtures/output-json-parse-success.json +17 -2
- package/contracts/v1/fixtures/project-sources-plan-add.json +71 -0
- package/contracts/v1/fixtures/read-latest-clipped.json +31 -0
- package/contracts/v1/fixtures/reports-create-redacted.json +15 -0
- package/contracts/v1/fixtures/responses-basic-success.json +11 -0
- package/contracts/v1/fixtures/run-basic-success.json +15 -0
- package/contracts/v1/fixtures/run-browser-bridge-blocker.json +2 -2
- package/contracts/v1/fixtures/run-timeout-partial.json +2 -2
- package/contracts/v1/fixtures/runner-budget-blocker.json +1 -1
- package/contracts/v1/fixtures/stream-blocked.ndjson +1 -1
- package/contracts/v1/fixtures/stream-submitted-completed.ndjson +1 -1
- package/contracts/v1/manifest.json +30 -0
- package/contracts/v1/parity-suite.json +72 -6
- package/contracts/v1/schemas/backend-request.schema.json +3 -0
- package/contracts/v1/schemas/command-result.schema.json +48 -0
- package/contracts/v1/schemas/response.schema.json +28 -0
- package/contracts/v1/schemas/run-result.schema.json +84 -0
- package/contracts/v1/surface-drift-policy.json +210 -0
- package/dist/codex-chatgpt-control-backend.mjs +5137 -488
- package/dist/codex-chatgpt-control.bundle.mjs +5001 -286
- package/dist/src/backend/client.d.ts +6 -1
- package/dist/src/backend/client.js +5 -0
- package/dist/src/backend/protocol.d.ts +1 -1
- package/dist/src/backend/protocol.js +7 -0
- package/dist/src/backend/session.js +14 -0
- package/dist/src/browser/attach.js +128 -20
- package/dist/src/browser/downloads.js +2 -1
- package/dist/src/browser/page-state.js +6 -3
- package/dist/src/client.d.ts +16 -1
- package/dist/src/client.js +86 -7
- package/dist/src/commands/artifacts.d.ts +5 -0
- package/dist/src/commands/artifacts.js +432 -0
- package/dist/src/commands/context.js +5 -2
- package/dist/src/commands/doctor.d.ts +10 -2
- package/dist/src/commands/doctor.js +242 -14
- package/dist/src/commands/files.d.ts +2 -1
- package/dist/src/commands/files.js +352 -18
- package/dist/src/commands/messages.d.ts +2 -1
- package/dist/src/commands/messages.js +232 -40
- package/dist/src/commands/modes.js +202 -20
- package/dist/src/commands/project-sources.d.ts +10 -0
- package/dist/src/commands/project-sources.js +643 -0
- package/dist/src/commands/registry.js +76 -14
- package/dist/src/commands/reports.d.ts +9 -0
- package/dist/src/commands/reports.js +83 -6
- package/dist/src/commands/response-actions.js +33 -0
- package/dist/src/commands/sequence.js +14 -0
- package/dist/src/commands/threads.js +2 -1
- package/dist/src/commands/timeouts.d.ts +2 -0
- package/dist/src/commands/timeouts.js +18 -0
- package/dist/src/diagnostics/blockers.d.ts +54 -0
- package/dist/src/diagnostics/blockers.js +299 -0
- package/dist/src/dom/artifacts.d.ts +7 -0
- package/dist/src/dom/artifacts.js +198 -0
- package/dist/src/dom/generation-state.d.ts +8 -0
- package/dist/src/dom/generation-state.js +103 -0
- package/dist/src/dom/locale/am.d.ts +28 -0
- package/dist/src/dom/locale/am.js +28 -0
- package/dist/src/dom/locale/ar.d.ts +28 -0
- package/dist/src/dom/locale/ar.js +28 -0
- package/dist/src/dom/locale/bg.d.ts +28 -0
- package/dist/src/dom/locale/bg.js +28 -0
- package/dist/src/dom/locale/bn.d.ts +28 -0
- package/dist/src/dom/locale/bn.js +28 -0
- package/dist/src/dom/locale/bs.d.ts +28 -0
- package/dist/src/dom/locale/bs.js +28 -0
- package/dist/src/dom/locale/ca.d.ts +28 -0
- package/dist/src/dom/locale/ca.js +28 -0
- package/dist/src/dom/locale/cs.d.ts +28 -0
- package/dist/src/dom/locale/cs.js +28 -0
- package/dist/src/dom/locale/da.d.ts +28 -0
- package/dist/src/dom/locale/da.js +28 -0
- package/dist/src/dom/locale/de.d.ts +30 -0
- package/dist/src/dom/locale/de.js +30 -0
- package/dist/src/dom/locale/el.d.ts +28 -0
- package/dist/src/dom/locale/el.js +28 -0
- package/dist/src/dom/locale/en.d.ts +50 -0
- package/dist/src/dom/locale/en.js +56 -0
- package/dist/src/dom/locale/es-419.d.ts +28 -0
- package/dist/src/dom/locale/es-419.js +28 -0
- package/dist/src/dom/locale/es-ES.d.ts +28 -0
- package/dist/src/dom/locale/es-ES.js +28 -0
- package/dist/src/dom/locale/et.d.ts +28 -0
- package/dist/src/dom/locale/et.js +28 -0
- package/dist/src/dom/locale/fa.d.ts +28 -0
- package/dist/src/dom/locale/fa.js +28 -0
- package/dist/src/dom/locale/fi.d.ts +28 -0
- package/dist/src/dom/locale/fi.js +28 -0
- package/dist/src/dom/locale/fr-CA.d.ts +29 -0
- package/dist/src/dom/locale/fr-CA.js +29 -0
- package/dist/src/dom/locale/fr-FR.d.ts +30 -0
- package/dist/src/dom/locale/fr-FR.js +30 -0
- package/dist/src/dom/locale/gu.d.ts +28 -0
- package/dist/src/dom/locale/gu.js +28 -0
- package/dist/src/dom/locale/hi.d.ts +28 -0
- package/dist/src/dom/locale/hi.js +28 -0
- package/dist/src/dom/locale/hr.d.ts +28 -0
- package/dist/src/dom/locale/hr.js +28 -0
- package/dist/src/dom/locale/hu.d.ts +28 -0
- package/dist/src/dom/locale/hu.js +28 -0
- package/dist/src/dom/locale/hy.d.ts +28 -0
- package/dist/src/dom/locale/hy.js +28 -0
- package/dist/src/dom/locale/id.d.ts +28 -0
- package/dist/src/dom/locale/id.js +28 -0
- package/dist/src/dom/locale/index.d.ts +79 -0
- package/dist/src/dom/locale/index.js +202 -0
- package/dist/src/dom/locale/is.d.ts +28 -0
- package/dist/src/dom/locale/is.js +28 -0
- package/dist/src/dom/locale/it.d.ts +27 -0
- package/dist/src/dom/locale/it.js +27 -0
- package/dist/src/dom/locale/ja.d.ts +27 -0
- package/dist/src/dom/locale/ja.js +27 -0
- package/dist/src/dom/locale/ka.d.ts +28 -0
- package/dist/src/dom/locale/ka.js +28 -0
- package/dist/src/dom/locale/kk.d.ts +28 -0
- package/dist/src/dom/locale/kk.js +28 -0
- package/dist/src/dom/locale/kn.d.ts +28 -0
- package/dist/src/dom/locale/kn.js +28 -0
- package/dist/src/dom/locale/ko.d.ts +28 -0
- package/dist/src/dom/locale/ko.js +28 -0
- package/dist/src/dom/locale/lt.d.ts +28 -0
- package/dist/src/dom/locale/lt.js +28 -0
- package/dist/src/dom/locale/lv.d.ts +28 -0
- package/dist/src/dom/locale/lv.js +28 -0
- package/dist/src/dom/locale/mk.d.ts +28 -0
- package/dist/src/dom/locale/mk.js +28 -0
- package/dist/src/dom/locale/ml.d.ts +28 -0
- package/dist/src/dom/locale/ml.js +28 -0
- package/dist/src/dom/locale/mn.d.ts +28 -0
- package/dist/src/dom/locale/mn.js +28 -0
- package/dist/src/dom/locale/mr.d.ts +28 -0
- package/dist/src/dom/locale/mr.js +28 -0
- package/dist/src/dom/locale/ms.d.ts +28 -0
- package/dist/src/dom/locale/ms.js +28 -0
- package/dist/src/dom/locale/my.d.ts +28 -0
- package/dist/src/dom/locale/my.js +28 -0
- package/dist/src/dom/locale/nb.d.ts +28 -0
- package/dist/src/dom/locale/nb.js +28 -0
- package/dist/src/dom/locale/nl.d.ts +28 -0
- package/dist/src/dom/locale/nl.js +28 -0
- package/dist/src/dom/locale/pa.d.ts +28 -0
- package/dist/src/dom/locale/pa.js +28 -0
- package/dist/src/dom/locale/pl.d.ts +28 -0
- package/dist/src/dom/locale/pl.js +28 -0
- package/dist/src/dom/locale/pt-BR.d.ts +28 -0
- package/dist/src/dom/locale/pt-BR.js +28 -0
- package/dist/src/dom/locale/pt-PT.d.ts +28 -0
- package/dist/src/dom/locale/pt-PT.js +28 -0
- package/dist/src/dom/locale/ro.d.ts +28 -0
- package/dist/src/dom/locale/ro.js +28 -0
- package/dist/src/dom/locale/ru.d.ts +28 -0
- package/dist/src/dom/locale/ru.js +28 -0
- package/dist/src/dom/locale/sk.d.ts +28 -0
- package/dist/src/dom/locale/sk.js +28 -0
- package/dist/src/dom/locale/sl.d.ts +28 -0
- package/dist/src/dom/locale/sl.js +28 -0
- package/dist/src/dom/locale/so.d.ts +28 -0
- package/dist/src/dom/locale/so.js +28 -0
- package/dist/src/dom/locale/sq.d.ts +28 -0
- package/dist/src/dom/locale/sq.js +28 -0
- package/dist/src/dom/locale/sr.d.ts +28 -0
- package/dist/src/dom/locale/sr.js +28 -0
- package/dist/src/dom/locale/sv.d.ts +28 -0
- package/dist/src/dom/locale/sv.js +28 -0
- package/dist/src/dom/locale/sw.d.ts +28 -0
- package/dist/src/dom/locale/sw.js +28 -0
- package/dist/src/dom/locale/ta.d.ts +28 -0
- package/dist/src/dom/locale/ta.js +28 -0
- package/dist/src/dom/locale/te.d.ts +28 -0
- package/dist/src/dom/locale/te.js +28 -0
- package/dist/src/dom/locale/th.d.ts +28 -0
- package/dist/src/dom/locale/th.js +28 -0
- package/dist/src/dom/locale/tl.d.ts +28 -0
- package/dist/src/dom/locale/tl.js +28 -0
- package/dist/src/dom/locale/tr.d.ts +28 -0
- package/dist/src/dom/locale/tr.js +28 -0
- package/dist/src/dom/locale/types.d.ts +45 -0
- package/dist/src/dom/locale/types.js +1 -0
- package/dist/src/dom/locale/uk.d.ts +28 -0
- package/dist/src/dom/locale/uk.js +28 -0
- package/dist/src/dom/locale/ur.d.ts +28 -0
- package/dist/src/dom/locale/ur.js +28 -0
- package/dist/src/dom/locale/vi.d.ts +28 -0
- package/dist/src/dom/locale/vi.js +28 -0
- package/dist/src/dom/locale/zh-HK.d.ts +28 -0
- package/dist/src/dom/locale/zh-HK.js +28 -0
- package/dist/src/dom/locale/zh-Hans.d.ts +28 -0
- package/dist/src/dom/locale/zh-Hans.js +28 -0
- package/dist/src/dom/locale/zh-TW.d.ts +29 -0
- package/dist/src/dom/locale/zh-TW.js +29 -0
- package/dist/src/dom/locale-labels.d.ts +26 -0
- package/dist/src/dom/locale-labels.js +26 -0
- package/dist/src/dom/menus.d.ts +6 -0
- package/dist/src/dom/menus.js +34 -8
- package/dist/src/dom/message-format.d.ts +2 -1
- package/dist/src/dom/message-format.js +67 -10
- package/dist/src/dom/messages.d.ts +2 -1
- package/dist/src/dom/messages.js +2 -4
- package/dist/src/dom/selectors.d.ts +1 -0
- package/dist/src/dom/selectors.js +42 -15
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.js +5 -0
- package/dist/src/platform/local-paths.d.ts +4 -0
- package/dist/src/platform/local-paths.js +20 -0
- package/dist/src/runner/interruptions.js +15 -4
- package/dist/src/runner/responses.js +18 -1
- package/dist/src/runner/result.js +15 -0
- package/dist/src/runner/resume.js +1 -0
- package/dist/src/runner/types.d.ts +3 -0
- package/dist/src/safety/risk.d.ts +7 -0
- package/dist/src/safety/risk.js +7 -0
- package/dist/src/safety/untrusted-output.d.ts +73 -0
- package/dist/src/safety/untrusted-output.js +199 -0
- package/dist/src/scripts/apply-intelligence-locale-captures.d.ts +1 -0
- package/dist/src/scripts/apply-intelligence-locale-captures.js +184 -0
- package/dist/src/scripts/capture-intelligence-locales.d.ts +25 -0
- package/dist/src/scripts/capture-intelligence-locales.js +669 -0
- package/dist/src/scripts/check-surface-drift.d.ts +1 -0
- package/dist/src/scripts/check-surface-drift.js +11 -0
- package/dist/src/scripts/live-smoke/scenarios.js +84 -0
- package/dist/src/scripts/locale-capture/language-coverage.d.ts +10 -0
- package/dist/src/scripts/locale-capture/language-coverage.js +39 -0
- package/dist/src/testing/surface-drift.d.ts +66 -0
- package/dist/src/testing/surface-drift.js +363 -0
- package/dist/src/types.d.ts +201 -2
- package/package.json +2 -1
- package/references/backend-protocol.md +93 -1
- package/references/language-coverage.md +142 -0
- package/references/localization.md +247 -0
- package/references/python-parity.md +63 -1
- package/references/safety.md +2 -0
- package/references/troubleshooting.md +58 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
2
|
+
import { dirname, resolve } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { readLanguageCoverage } from "./locale-capture/language-coverage.js";
|
|
5
|
+
const ENGLISH_MODE_LABELS = new Set(["Latest", "Instant", "Thinking", "Extended", "Medium", "High", "Extra High", "Pro"]);
|
|
6
|
+
const UPDATE_NOTE = " * Intelligence picker labels updated 2026-06-10 from a visible ChatGPT Pro session.";
|
|
7
|
+
class ApplyUsageError extends Error {
|
|
8
|
+
exitCode;
|
|
9
|
+
constructor(message, exitCode = 2) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.exitCode = exitCode;
|
|
12
|
+
this.name = "ApplyUsageError";
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
const USAGE = [
|
|
16
|
+
"Usage:",
|
|
17
|
+
" npm run apply:intelligence-locales -- --in ../../outputs/intelligence-locale-captures/2026-06-10-intelligence-picker.jsonl --reviewed",
|
|
18
|
+
"",
|
|
19
|
+
"Options:",
|
|
20
|
+
" --in JSONL capture file to apply.",
|
|
21
|
+
" --reviewed Required to write locale files.",
|
|
22
|
+
" --coverage-path Path to language-coverage.md."
|
|
23
|
+
].join("\n");
|
|
24
|
+
export async function main(argv = process.argv.slice(2)) {
|
|
25
|
+
let options;
|
|
26
|
+
try {
|
|
27
|
+
options = parseArgs(argv);
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
if (error instanceof ApplyUsageError) {
|
|
31
|
+
console.log(error.message);
|
|
32
|
+
return error.exitCode;
|
|
33
|
+
}
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
const root = packageRoot();
|
|
37
|
+
const languages = await readLanguageCoverage(options.coveragePath);
|
|
38
|
+
const captures = latestSuccessfulCaptures(await readFile(options.input, "utf8"));
|
|
39
|
+
const planned = [];
|
|
40
|
+
for (const language of languages) {
|
|
41
|
+
if (/^en(?:-|$)/i.test(language.bcp47))
|
|
42
|
+
continue;
|
|
43
|
+
const record = captures.get(language.bcp47);
|
|
44
|
+
if (record === undefined) {
|
|
45
|
+
throw new ApplyUsageError(`Missing successful capture for ${language.bcp47}.`, 1);
|
|
46
|
+
}
|
|
47
|
+
const labels = observedNonEnglishLabels(record);
|
|
48
|
+
if (labels.length === 0)
|
|
49
|
+
continue;
|
|
50
|
+
planned.push({
|
|
51
|
+
locale: language.bcp47,
|
|
52
|
+
file: resolve(root, "src/dom/locale", `${language.bcp47}.ts`),
|
|
53
|
+
labels,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
if (!options.reviewed) {
|
|
57
|
+
for (const change of planned) {
|
|
58
|
+
console.log(`${change.locale.padEnd(8)} ${change.labels.join(" | ")}`);
|
|
59
|
+
}
|
|
60
|
+
console.log(`\nRefusing to write without --reviewed. Planned locale files: ${planned.length}.`);
|
|
61
|
+
return 2;
|
|
62
|
+
}
|
|
63
|
+
for (const change of planned) {
|
|
64
|
+
const before = await readFile(change.file, "utf8");
|
|
65
|
+
const after = mergeModeLabels(before, change.labels);
|
|
66
|
+
if (after !== before) {
|
|
67
|
+
await writeFile(change.file, after, "utf8");
|
|
68
|
+
console.log(`updated ${change.locale} labels=${change.labels.length}`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return 0;
|
|
72
|
+
}
|
|
73
|
+
function latestSuccessfulCaptures(jsonl) {
|
|
74
|
+
const latest = new Map();
|
|
75
|
+
for (const line of jsonl.split(/\r?\n/)) {
|
|
76
|
+
if (line.trim().length === 0)
|
|
77
|
+
continue;
|
|
78
|
+
const record = JSON.parse(line);
|
|
79
|
+
if (record.status === "ok" && Array.isArray(record.intelligenceLabels)) {
|
|
80
|
+
latest.set(record.requestedLocale, record);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return latest;
|
|
84
|
+
}
|
|
85
|
+
function observedNonEnglishLabels(record) {
|
|
86
|
+
const seen = new Set();
|
|
87
|
+
const labels = [];
|
|
88
|
+
for (const label of record.intelligenceLabels ?? []) {
|
|
89
|
+
if (ENGLISH_MODE_LABELS.has(label) || seen.has(label))
|
|
90
|
+
continue;
|
|
91
|
+
seen.add(label);
|
|
92
|
+
labels.push(label);
|
|
93
|
+
}
|
|
94
|
+
return labels;
|
|
95
|
+
}
|
|
96
|
+
function mergeModeLabels(source, labels) {
|
|
97
|
+
let text = updateComment(source);
|
|
98
|
+
const existing = parseExistingModeLabels(text);
|
|
99
|
+
const merged = dedupe([...existing, ...labels]);
|
|
100
|
+
const line = ` modeLabels: [${merged.map(label => JSON.stringify(label)).join(", ")}],`;
|
|
101
|
+
if (/^\s*modeLabels:\s*\[[^\]]*\],/m.test(text)) {
|
|
102
|
+
return text.replace(/^\s*modeLabels:\s*\[[^\]]*\],/m, line);
|
|
103
|
+
}
|
|
104
|
+
if (/^\s*copyResponse:\s*.*,\n/m.test(text)) {
|
|
105
|
+
return text.replace(/^(\s*copyResponse:\s*.*,\n)/m, `$1${line}\n`);
|
|
106
|
+
}
|
|
107
|
+
return text.replace(/^export const \w+ = \{\n/m, match => `${match}${line}\n`);
|
|
108
|
+
}
|
|
109
|
+
function parseExistingModeLabels(source) {
|
|
110
|
+
const match = /^\s*modeLabels:\s*\[(?<body>[^\]]*)\],/m.exec(source);
|
|
111
|
+
const body = match?.groups?.body;
|
|
112
|
+
if (body === undefined)
|
|
113
|
+
return [];
|
|
114
|
+
const labels = [];
|
|
115
|
+
for (const stringMatch of body.matchAll(/"((?:\\"|[^"])*)"/g)) {
|
|
116
|
+
labels.push(JSON.parse(`"${stringMatch[1]}"`));
|
|
117
|
+
}
|
|
118
|
+
return labels;
|
|
119
|
+
}
|
|
120
|
+
function updateComment(source) {
|
|
121
|
+
let text = source.replace(/\n \* Omitted because they match English case-insensitively: `modeLabels`[\s\S]*?blocker copy\.\n/g, "\n * Some non-Intelligence surfaces may still fall back to English + `selector_drift`.\n");
|
|
122
|
+
if (!text.includes(UPDATE_NOTE)) {
|
|
123
|
+
text = text.replace(/\n \*\//, `\n *\n${UPDATE_NOTE}\n */`);
|
|
124
|
+
}
|
|
125
|
+
return text;
|
|
126
|
+
}
|
|
127
|
+
function dedupe(values) {
|
|
128
|
+
const seen = new Set();
|
|
129
|
+
const result = [];
|
|
130
|
+
for (const value of values) {
|
|
131
|
+
if (seen.has(value))
|
|
132
|
+
continue;
|
|
133
|
+
seen.add(value);
|
|
134
|
+
result.push(value);
|
|
135
|
+
}
|
|
136
|
+
return result;
|
|
137
|
+
}
|
|
138
|
+
function parseArgs(argv) {
|
|
139
|
+
let input;
|
|
140
|
+
let reviewed = false;
|
|
141
|
+
let coveragePath;
|
|
142
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
143
|
+
const arg = argv[index];
|
|
144
|
+
switch (arg) {
|
|
145
|
+
case "--help":
|
|
146
|
+
case "-h":
|
|
147
|
+
throw new ApplyUsageError(USAGE, 0);
|
|
148
|
+
case "--in":
|
|
149
|
+
input = requiredValue(argv, ++index, arg);
|
|
150
|
+
break;
|
|
151
|
+
case "--reviewed":
|
|
152
|
+
reviewed = true;
|
|
153
|
+
break;
|
|
154
|
+
case "--coverage-path":
|
|
155
|
+
coveragePath = requiredValue(argv, ++index, arg);
|
|
156
|
+
break;
|
|
157
|
+
default:
|
|
158
|
+
throw new ApplyUsageError(`Unknown option: ${arg}\n\n${USAGE}`);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
if (input === undefined) {
|
|
162
|
+
throw new ApplyUsageError(`--in is required.\n\n${USAGE}`);
|
|
163
|
+
}
|
|
164
|
+
const root = packageRoot();
|
|
165
|
+
return {
|
|
166
|
+
input: resolve(root, input),
|
|
167
|
+
reviewed,
|
|
168
|
+
coveragePath: resolve(root, coveragePath ?? "references/language-coverage.md"),
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
function requiredValue(argv, index, flag) {
|
|
172
|
+
const value = argv[index];
|
|
173
|
+
if (value === undefined || value.startsWith("--")) {
|
|
174
|
+
throw new ApplyUsageError(`${flag} requires a value.\n\n${USAGE}`);
|
|
175
|
+
}
|
|
176
|
+
return value;
|
|
177
|
+
}
|
|
178
|
+
function packageRoot() {
|
|
179
|
+
return resolve(dirname(fileURLToPath(import.meta.url)), "../..");
|
|
180
|
+
}
|
|
181
|
+
if (process.argv[1] === fileURLToPath(import.meta.url)) {
|
|
182
|
+
const exitCode = await main();
|
|
183
|
+
process.exitCode = exitCode;
|
|
184
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { BrowserLike, ExistingTabPolicy } from "../types.js";
|
|
2
|
+
type CaptureOptions = {
|
|
3
|
+
locale: string | undefined;
|
|
4
|
+
nativeName: string | undefined;
|
|
5
|
+
out: string;
|
|
6
|
+
printQueue: boolean;
|
|
7
|
+
autoSwitch: boolean;
|
|
8
|
+
all: boolean;
|
|
9
|
+
limit: number | undefined;
|
|
10
|
+
locales: string[] | undefined;
|
|
11
|
+
openVersionSubmenu: boolean;
|
|
12
|
+
restore: boolean;
|
|
13
|
+
settleMs: number;
|
|
14
|
+
switchTimeoutMs: number;
|
|
15
|
+
coveragePath: string;
|
|
16
|
+
ifMissing: NonNullable<ExistingTabPolicy["ifMissing"]>;
|
|
17
|
+
tabId: string | undefined;
|
|
18
|
+
};
|
|
19
|
+
type CaptureRuntime = {
|
|
20
|
+
agent?: unknown;
|
|
21
|
+
browser?: BrowserLike;
|
|
22
|
+
};
|
|
23
|
+
export declare function main(argv?: string[], runtime?: CaptureRuntime): Promise<number>;
|
|
24
|
+
export declare function parseArgs(argv: readonly string[]): CaptureOptions;
|
|
25
|
+
export {};
|