sweetlink 0.2.0 → 0.2.2
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 +21 -2
- package/LICENSE +1 -1
- package/README.md +6 -6
- package/dist/daemon/src/cli.d.ts +3 -0
- package/dist/daemon/src/cli.d.ts.map +1 -0
- package/dist/daemon/src/cli.js +14 -0
- package/dist/daemon/src/cli.js.map +1 -0
- package/dist/daemon/src/codename.d.ts.map +1 -1
- package/dist/daemon/src/codename.js +11 -11
- package/dist/daemon/src/codename.js.map +1 -1
- package/dist/daemon/src/index.d.ts +1 -1
- package/dist/daemon/src/index.js +143 -128
- package/dist/daemon/src/index.js.map +1 -1
- package/dist/shared/src/env.d.ts.map +1 -1
- package/dist/shared/src/env.js +12 -12
- package/dist/shared/src/env.js.map +1 -1
- package/dist/shared/src/index.d.ts +30 -30
- package/dist/shared/src/index.d.ts.map +1 -1
- package/dist/shared/src/index.js +17 -17
- package/dist/shared/src/index.js.map +1 -1
- package/dist/shared/src/node.d.ts +1 -1
- package/dist/shared/src/node.d.ts.map +1 -1
- package/dist/shared/src/node.js +18 -18
- package/dist/shared/src/node.js.map +1 -1
- package/dist/src/codex.d.ts +1 -1
- package/dist/src/codex.js +19 -19
- package/dist/src/codex.js.map +1 -1
- package/dist/src/commands/click.d.ts +1 -1
- package/dist/src/commands/click.d.ts.map +1 -1
- package/dist/src/commands/click.js +32 -24
- package/dist/src/commands/click.js.map +1 -1
- package/dist/src/commands/run-js.d.ts +1 -1
- package/dist/src/commands/run-js.d.ts.map +1 -1
- package/dist/src/commands/run-js.js +10 -10
- package/dist/src/commands/run-js.js.map +1 -1
- package/dist/src/commands/trust-ca.d.ts +1 -1
- package/dist/src/commands/trust-ca.js +15 -15
- package/dist/src/core/config-file.d.ts.map +1 -1
- package/dist/src/core/config-file.js +49 -41
- package/dist/src/core/config-file.js.map +1 -1
- package/dist/src/core/config.d.ts +2 -2
- package/dist/src/core/config.d.ts.map +1 -1
- package/dist/src/core/config.js +22 -18
- package/dist/src/core/config.js.map +1 -1
- package/dist/src/core/dev-bootstrap.d.ts +1 -1
- package/dist/src/core/dev-bootstrap.d.ts.map +1 -1
- package/dist/src/core/dev-bootstrap.js +12 -12
- package/dist/src/core/dev-bootstrap.js.map +1 -1
- package/dist/src/core/env.d.ts +1 -1
- package/dist/src/core/env.d.ts.map +1 -1
- package/dist/src/core/env.js +3 -3
- package/dist/src/core/env.js.map +1 -1
- package/dist/src/devtools-registry.d.ts.map +1 -1
- package/dist/src/devtools-registry.js +48 -46
- package/dist/src/devtools-registry.js.map +1 -1
- package/dist/src/env.d.ts +1 -1
- package/dist/src/env.js +1 -1
- package/dist/src/http.d.ts.map +1 -1
- package/dist/src/http.js +7 -6
- package/dist/src/http.js.map +1 -1
- package/dist/src/index.d.ts +7 -7
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +399 -367
- package/dist/src/index.js.map +1 -1
- package/dist/src/runtime/browser/client.d.ts +5 -4
- package/dist/src/runtime/browser/client.d.ts.map +1 -1
- package/dist/src/runtime/browser/client.js +79 -72
- package/dist/src/runtime/browser/client.js.map +1 -1
- package/dist/src/runtime/browser/commands/index.d.ts +2 -2
- package/dist/src/runtime/browser/commands/index.js +17 -17
- package/dist/src/runtime/browser/commands/index.js.map +1 -1
- package/dist/src/runtime/browser/dom-to-image-loader.d.ts.map +1 -1
- package/dist/src/runtime/browser/dom-to-image-loader.js +7 -7
- package/dist/src/runtime/browser/dom-to-image-loader.js.map +1 -1
- package/dist/src/runtime/browser/index.d.ts +3 -3
- package/dist/src/runtime/browser/index.js +2 -2
- package/dist/src/runtime/browser/module-loader.js +2 -2
- package/dist/src/runtime/browser/screenshot/hooks.d.ts +5 -5
- package/dist/src/runtime/browser/screenshot/hooks.d.ts.map +1 -1
- package/dist/src/runtime/browser/screenshot/hooks.js +32 -29
- package/dist/src/runtime/browser/screenshot/hooks.js.map +1 -1
- package/dist/src/runtime/browser/screenshot/index.d.ts +3 -3
- package/dist/src/runtime/browser/screenshot/index.d.ts.map +1 -1
- package/dist/src/runtime/browser/screenshot/index.js +17 -15
- package/dist/src/runtime/browser/screenshot/index.js.map +1 -1
- package/dist/src/runtime/browser/screenshot/renderers/dom-to-image.d.ts +1 -1
- package/dist/src/runtime/browser/screenshot/renderers/dom-to-image.js +13 -13
- package/dist/src/runtime/browser/screenshot/renderers/dom-to-image.js.map +1 -1
- package/dist/src/runtime/browser/screenshot/renderers/html2canvas.d.ts +1 -1
- package/dist/src/runtime/browser/screenshot/renderers/html2canvas.d.ts.map +1 -1
- package/dist/src/runtime/browser/screenshot/renderers/html2canvas.js +24 -24
- package/dist/src/runtime/browser/screenshot/renderers/html2canvas.js.map +1 -1
- package/dist/src/runtime/browser/screenshot/targets.d.ts +2 -2
- package/dist/src/runtime/browser/screenshot/targets.js +9 -9
- package/dist/src/runtime/browser/screenshot/utils.d.ts +1 -1
- package/dist/src/runtime/browser/screenshot/utils.d.ts.map +1 -1
- package/dist/src/runtime/browser/screenshot/utils.js +73 -71
- package/dist/src/runtime/browser/screenshot/utils.js.map +1 -1
- package/dist/src/runtime/browser/selector-discovery.d.ts +1 -1
- package/dist/src/runtime/browser/selector-discovery.d.ts.map +1 -1
- package/dist/src/runtime/browser/selector-discovery.js +24 -22
- package/dist/src/runtime/browser/selector-discovery.js.map +1 -1
- package/dist/src/runtime/browser/storage/session-storage.d.ts +10 -5
- package/dist/src/runtime/browser/storage/session-storage.d.ts.map +1 -1
- package/dist/src/runtime/browser/storage/session-storage.js +12 -10
- package/dist/src/runtime/browser/storage/session-storage.js.map +1 -1
- package/dist/src/runtime/browser/types.d.ts +7 -7
- package/dist/src/runtime/browser/types.js +1 -1
- package/dist/src/runtime/browser/utils/console.d.ts +1 -1
- package/dist/src/runtime/browser/utils/console.js +16 -16
- package/dist/src/runtime/browser/utils/console.js.map +1 -1
- package/dist/src/runtime/browser/utils/environment.js +2 -2
- package/dist/src/runtime/browser/utils/errors.d.ts.map +1 -1
- package/dist/src/runtime/browser/utils/errors.js +11 -11
- package/dist/src/runtime/browser/utils/number.d.ts.map +1 -1
- package/dist/src/runtime/browser/utils/number.js.map +1 -1
- package/dist/src/runtime/browser/utils/object.d.ts.map +1 -1
- package/dist/src/runtime/browser/utils/object.js +2 -2
- package/dist/src/runtime/browser/utils/object.js.map +1 -1
- package/dist/src/runtime/browser/utils/sanitize.js +2 -2
- package/dist/src/runtime/browser/utils/time.d.ts.map +1 -1
- package/dist/src/runtime/browser/utils/time.js +1 -1
- package/dist/src/runtime/chrome/cookies.d.ts +4 -4
- package/dist/src/runtime/chrome/cookies.d.ts.map +1 -1
- package/dist/src/runtime/chrome/cookies.js +31 -31
- package/dist/src/runtime/chrome/cookies.js.map +1 -1
- package/dist/src/runtime/chrome/deep-link.d.ts +1 -1
- package/dist/src/runtime/chrome/deep-link.d.ts.map +1 -1
- package/dist/src/runtime/chrome/deep-link.js +46 -36
- package/dist/src/runtime/chrome/deep-link.js.map +1 -1
- package/dist/src/runtime/chrome/diagnostics.d.ts.map +1 -1
- package/dist/src/runtime/chrome/diagnostics.js +13 -11
- package/dist/src/runtime/chrome/diagnostics.js.map +1 -1
- package/dist/src/runtime/chrome/focus.d.ts.map +1 -1
- package/dist/src/runtime/chrome/focus.js +5 -5
- package/dist/src/runtime/chrome/focus.js.map +1 -1
- package/dist/src/runtime/chrome/launch.d.ts.map +1 -1
- package/dist/src/runtime/chrome/launch.js +30 -30
- package/dist/src/runtime/chrome/launch.js.map +1 -1
- package/dist/src/runtime/chrome/puppeteer.d.ts +2 -2
- package/dist/src/runtime/chrome/puppeteer.d.ts.map +1 -1
- package/dist/src/runtime/chrome/puppeteer.js +16 -11
- package/dist/src/runtime/chrome/puppeteer.js.map +1 -1
- package/dist/src/runtime/chrome/reuse.d.ts.map +1 -1
- package/dist/src/runtime/chrome/reuse.js +38 -35
- package/dist/src/runtime/chrome/reuse.js.map +1 -1
- package/dist/src/runtime/chrome/session.d.ts +1 -1
- package/dist/src/runtime/chrome/session.d.ts.map +1 -1
- package/dist/src/runtime/chrome/session.js +12 -10
- package/dist/src/runtime/chrome/session.js.map +1 -1
- package/dist/src/runtime/chrome.d.ts +8 -8
- package/dist/src/runtime/chrome.js +8 -8
- package/dist/src/runtime/cookies.d.ts +1 -16
- package/dist/src/runtime/cookies.d.ts.map +1 -1
- package/dist/src/runtime/cookies.js +175 -286
- package/dist/src/runtime/cookies.js.map +1 -1
- package/dist/src/runtime/devstack.d.ts +1 -1
- package/dist/src/runtime/devstack.d.ts.map +1 -1
- package/dist/src/runtime/devstack.js +31 -28
- package/dist/src/runtime/devstack.js.map +1 -1
- package/dist/src/runtime/devtools/background.js +22 -22
- package/dist/src/runtime/devtools/cdp.d.ts +3 -3
- package/dist/src/runtime/devtools/cdp.d.ts.map +1 -1
- package/dist/src/runtime/devtools/cdp.js +59 -55
- package/dist/src/runtime/devtools/cdp.js.map +1 -1
- package/dist/src/runtime/devtools/config.d.ts.map +1 -1
- package/dist/src/runtime/devtools/config.js +15 -15
- package/dist/src/runtime/devtools/config.js.map +1 -1
- package/dist/src/runtime/devtools/constants.d.ts.map +1 -1
- package/dist/src/runtime/devtools/constants.js +18 -10
- package/dist/src/runtime/devtools/constants.js.map +1 -1
- package/dist/src/runtime/devtools/diagnostics.d.ts +4 -4
- package/dist/src/runtime/devtools/diagnostics.d.ts.map +1 -1
- package/dist/src/runtime/devtools/diagnostics.js +40 -38
- package/dist/src/runtime/devtools/diagnostics.js.map +1 -1
- package/dist/src/runtime/devtools/oauth.d.ts +1 -1
- package/dist/src/runtime/devtools/oauth.d.ts.map +1 -1
- package/dist/src/runtime/devtools/oauth.js +35 -28
- package/dist/src/runtime/devtools/oauth.js.map +1 -1
- package/dist/src/runtime/devtools/types.d.ts +3 -3
- package/dist/src/runtime/devtools/types.d.ts.map +1 -1
- package/dist/src/runtime/devtools.d.ts +7 -7
- package/dist/src/runtime/devtools.js +7 -7
- package/dist/src/runtime/next-devtools.d.ts.map +1 -1
- package/dist/src/runtime/next-devtools.js +12 -12
- package/dist/src/runtime/next-devtools.js.map +1 -1
- package/dist/src/runtime/screenshot.d.ts +9 -9
- package/dist/src/runtime/screenshot.d.ts.map +1 -1
- package/dist/src/runtime/screenshot.js +65 -46
- package/dist/src/runtime/screenshot.js.map +1 -1
- package/dist/src/runtime/scripts.d.ts +1 -1
- package/dist/src/runtime/scripts.d.ts.map +1 -1
- package/dist/src/runtime/scripts.js +28 -28
- package/dist/src/runtime/scripts.js.map +1 -1
- package/dist/src/runtime/session.d.ts +6 -6
- package/dist/src/runtime/session.d.ts.map +1 -1
- package/dist/src/runtime/session.js +35 -35
- package/dist/src/runtime/session.js.map +1 -1
- package/dist/src/runtime/smoke.d.ts +3 -3
- package/dist/src/runtime/smoke.d.ts.map +1 -1
- package/dist/src/runtime/smoke.js +85 -79
- package/dist/src/runtime/smoke.js.map +1 -1
- package/dist/src/runtime/url.d.ts +2 -2
- package/dist/src/runtime/url.d.ts.map +1 -1
- package/dist/src/runtime/url.js +20 -20
- package/dist/src/runtime/url.js.map +1 -1
- package/dist/src/screenshot-hooks.d.ts +1 -1
- package/dist/src/screenshot-hooks.d.ts.map +1 -1
- package/dist/src/screenshot-hooks.js +12 -12
- package/dist/src/screenshot-hooks.js.map +1 -1
- package/dist/src/shared/env.d.ts.map +1 -1
- package/dist/src/shared/env.js +11 -11
- package/dist/src/shared/env.js.map +1 -1
- package/dist/src/shared/index.d.ts +30 -30
- package/dist/src/shared/index.d.ts.map +1 -1
- package/dist/src/shared/index.js +17 -17
- package/dist/src/shared/index.js.map +1 -1
- package/dist/src/shared/node.d.ts +1 -1
- package/dist/src/shared/node.d.ts.map +1 -1
- package/dist/src/shared/node.js +18 -18
- package/dist/src/shared/node.js.map +1 -1
- package/dist/src/token.d.ts +1 -1
- package/dist/src/token.d.ts.map +1 -1
- package/dist/src/token.js +16 -16
- package/dist/src/token.js.map +1 -1
- package/dist/src/types.d.ts +1 -1
- package/dist/src/util/app-label.js +4 -4
- package/dist/src/util/errors.d.ts.map +1 -1
- package/dist/src/util/errors.js +12 -10
- package/dist/src/util/errors.js.map +1 -1
- package/dist/src/util/path.js +2 -2
- package/dist/src/util/regex.js +4 -4
- package/package.json +53 -45
package/dist/src/codex.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { spawn } from
|
|
2
|
-
import { describeAppForPrompt } from
|
|
3
|
-
import { extractEventMessage, isErrnoException } from
|
|
4
|
-
const CODEX_ARGS = [
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { describeAppForPrompt } from "./util/app-label.js";
|
|
3
|
+
import { extractEventMessage, isErrnoException } from "./util/errors.js";
|
|
4
|
+
const CODEX_ARGS = ["exec", "--yolo", "--skip-git-repo-check"];
|
|
5
5
|
/** Invokes the Codex CLI with optional stdin. */
|
|
6
6
|
async function runCodexExec(args, options = {}) {
|
|
7
7
|
const stdio = options.stdin
|
|
8
|
-
? [
|
|
9
|
-
: [
|
|
10
|
-
const child = spawn(
|
|
8
|
+
? ["pipe", "inherit", "inherit"]
|
|
9
|
+
: ["inherit", "inherit", "inherit"];
|
|
10
|
+
const child = spawn("codex", [...CODEX_ARGS, ...args], { stdio });
|
|
11
11
|
return await new Promise((resolve, reject) => {
|
|
12
|
-
child.once(
|
|
13
|
-
child.once(
|
|
12
|
+
child.once("error", (error) => reject(error));
|
|
13
|
+
child.once("close", (code) => resolve(code ?? 0));
|
|
14
14
|
if (options.stdin) {
|
|
15
|
-
const payload = options.stdin.endsWith(
|
|
15
|
+
const payload = options.stdin.endsWith("\n") ? options.stdin : `${options.stdin}\n`;
|
|
16
16
|
child.stdin?.write(payload);
|
|
17
17
|
child.stdin?.end();
|
|
18
18
|
}
|
|
@@ -20,8 +20,8 @@ async function runCodexExec(args, options = {}) {
|
|
|
20
20
|
}
|
|
21
21
|
/** Asks Codex about a screenshot file. */
|
|
22
22
|
export function runCodexImagePrompt(imagePath, prompt) {
|
|
23
|
-
const payload = prompt.endsWith(
|
|
24
|
-
return runCodexExec([
|
|
23
|
+
const payload = prompt.endsWith("\n") ? prompt : `${prompt}\n`;
|
|
24
|
+
return runCodexExec(["-i", imagePath, "-"], { stdin: payload });
|
|
25
25
|
}
|
|
26
26
|
/** Asks Codex about a text payload. */
|
|
27
27
|
export function runCodexTextPrompt(prompt) {
|
|
@@ -36,15 +36,15 @@ export async function analyzeConsoleWithCodex(selector, prompt, events, options
|
|
|
36
36
|
const lines = events.length > 0
|
|
37
37
|
? events.map((event) => {
|
|
38
38
|
const timestamp = new Date(event.timestamp ?? Date.now()).toLocaleTimeString();
|
|
39
|
-
const args = Array.isArray(event.args) ? event.args.map(String).join(
|
|
40
|
-
const suffix = args.length > 0 ? `: ${args}` :
|
|
39
|
+
const args = Array.isArray(event.args) ? event.args.map(String).join(" ") : "";
|
|
40
|
+
const suffix = args.length > 0 ? `: ${args}` : "";
|
|
41
41
|
return `[${timestamp}] ${event.level}${suffix}`;
|
|
42
42
|
})
|
|
43
|
-
: [
|
|
43
|
+
: ["(no console events were captured after the click)"];
|
|
44
44
|
const appDescription = describeAppForPrompt(options.appLabel);
|
|
45
45
|
const combinedPrompt = `You are analyzing console output from ${appDescription} immediately after triggering a click on selector "${selector}". ` +
|
|
46
|
-
|
|
47
|
-
`Console output:\n${lines.join(
|
|
46
|
+
"Review the log lines below (most recent last) and answer the agent’s question.\n\n" +
|
|
47
|
+
`Console output:\n${lines.join("\n")}\n\nQuestion: ${question}`;
|
|
48
48
|
if (!options.silent) {
|
|
49
49
|
console.log(`Asking Codex about console output after ${selector}: ${question}`);
|
|
50
50
|
}
|
|
@@ -58,8 +58,8 @@ export async function analyzeConsoleWithCodex(selector, prompt, events, options
|
|
|
58
58
|
}
|
|
59
59
|
catch (error) {
|
|
60
60
|
const message = extractEventMessage(error);
|
|
61
|
-
const missing = isErrnoException(error) && error.code ===
|
|
62
|
-
const prefix = missing ?
|
|
61
|
+
const missing = isErrnoException(error) && error.code === "ENOENT";
|
|
62
|
+
const prefix = missing ? "Codex CLI not found" : `Codex CLI failed: ${message}`;
|
|
63
63
|
console.warn(missing ? `${prefix}; install it or add it to $PATH to use --prompt.` : prefix);
|
|
64
64
|
return false;
|
|
65
65
|
}
|
package/dist/src/codex.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex.js","sourceRoot":"","sources":["../../src/codex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzE,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,uBAAuB,CAAC,CAAC;AAE/D,iDAAiD;AACjD,KAAK,UAAU,YAAY,CAAC,IAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"codex.js","sourceRoot":"","sources":["../../src/codex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzE,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,uBAAuB,CAAC,CAAC;AAE/D,iDAAiD;AACjD,KAAK,UAAU,YAAY,CAAC,IAAc,EAAE,OAAO,GAAuB,EAAE;IAC1E,MAAM,KAAK,GAA0B,OAAO,CAAC,KAAK;QAChD,CAAC,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,CAAC;QAChC,CAAC,CAAC,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;IACtC,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC,GAAG,UAAU,EAAE,GAAG,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,C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,kBAAkB,CAAC,cAAc,CAAC,CAAC;QAC1D,IAAI,QAAQ,KAAK,CAAC,EAAE,CAAC;YACnB,OAAO,CAAC,IAAI,CAAC,4BAA4B,QAAQ,GAAG,CAAC,CAAC;YACtD,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;QAC3C,MAAM,OAAO,GAAG,gBAAgB,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC;QACnE,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,qBAAqB,OAAO,EAAE,CAAC;QAChF,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,MAAM,kDAAkD,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;QAC7F,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"click.d.ts","sourceRoot":"","sources":["../../../src/commands/click.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA4BzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"click.d.ts","sourceRoot":"","sources":["../../../src/commands/click.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA4BzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAwD3D"}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { analyzeConsoleWithCodex } from
|
|
2
|
-
import { resolveConfig } from
|
|
3
|
-
import { readCommandOptions } from
|
|
4
|
-
import { sweetLinkDebug } from
|
|
5
|
-
import { renderCommandResult } from
|
|
6
|
-
import { buildClickScript, executeRunScriptCommand, fetchConsoleEvents, resolvePromptOption, resolveSessionIdFromHint, } from
|
|
7
|
-
import { extractEventMessage } from
|
|
8
|
-
import { delay } from
|
|
1
|
+
import { analyzeConsoleWithCodex } from "../codex.js";
|
|
2
|
+
import { resolveConfig } from "../core/config.js";
|
|
3
|
+
import { readCommandOptions } from "../core/env.js";
|
|
4
|
+
import { sweetLinkDebug } from "../env.js";
|
|
5
|
+
import { renderCommandResult } from "../runtime/scripts.js";
|
|
6
|
+
import { buildClickScript, executeRunScriptCommand, fetchConsoleEvents, resolvePromptOption, resolveSessionIdFromHint, } from "../runtime/session.js";
|
|
7
|
+
import { extractEventMessage } from "../util/errors.js";
|
|
8
|
+
import { delay } from "../util/time.js";
|
|
9
9
|
const POST_CLICK_CONSOLE_LIMIT = 20;
|
|
10
10
|
export function registerClickCommand(program) {
|
|
11
11
|
program
|
|
12
|
-
.command(
|
|
13
|
-
.description(
|
|
14
|
-
.requiredOption(
|
|
15
|
-
.option(
|
|
16
|
-
.option(
|
|
17
|
-
.option(
|
|
18
|
-
.option(
|
|
19
|
-
.addOption(program.createOption(
|
|
12
|
+
.command("click <sessionId>")
|
|
13
|
+
.description("Dispatch a click event on a selector inside a SweetLink session")
|
|
14
|
+
.requiredOption("-s, --selector <selector>", "CSS selector to click")
|
|
15
|
+
.option("--no-scroll", "Skip scrolling the element into view before clicking")
|
|
16
|
+
.option("--no-bubbles", "Dispatch the click event without bubbling")
|
|
17
|
+
.option("-t, --timeout <ms>", "Command timeout in milliseconds (default 15_000)", Number, 15_000)
|
|
18
|
+
.option("--prompt <prompt>", "Send console output after the click to Codex for analysis")
|
|
19
|
+
.addOption(program.createOption("--question <prompt>").hideHelp())
|
|
20
20
|
.action(async function (sessionId) {
|
|
21
21
|
const options = readCommandOptions(this);
|
|
22
22
|
const selector = options.selector?.trim();
|
|
23
23
|
if (!selector) {
|
|
24
|
-
throw new Error(
|
|
24
|
+
throw new Error("A --selector value is required for sweetlink click");
|
|
25
25
|
}
|
|
26
26
|
const prompt = resolvePromptOption(options);
|
|
27
27
|
const config = resolveConfig(this);
|
|
@@ -32,7 +32,9 @@ export function registerClickCommand(program) {
|
|
|
32
32
|
scrollIntoView: options.scroll !== false,
|
|
33
33
|
bubbles: options.bubbles !== false,
|
|
34
34
|
});
|
|
35
|
-
const timeoutMs = typeof options.timeout ===
|
|
35
|
+
const timeoutMs = typeof options.timeout === "number" && Number.isFinite(options.timeout)
|
|
36
|
+
? options.timeout
|
|
37
|
+
: 15_000;
|
|
36
38
|
const result = await executeRunScriptCommand(config, {
|
|
37
39
|
sessionId: resolvedSessionId,
|
|
38
40
|
code: script,
|
|
@@ -40,7 +42,13 @@ export function registerClickCommand(program) {
|
|
|
40
42
|
});
|
|
41
43
|
renderCommandResult(result);
|
|
42
44
|
await delay(250);
|
|
43
|
-
await reportConsoleAfterClick({
|
|
45
|
+
await reportConsoleAfterClick({
|
|
46
|
+
config,
|
|
47
|
+
sessionId: resolvedSessionId,
|
|
48
|
+
baselineIds,
|
|
49
|
+
prompt,
|
|
50
|
+
selector,
|
|
51
|
+
});
|
|
44
52
|
});
|
|
45
53
|
}
|
|
46
54
|
async function fetchBaselineConsoleIds(config, sessionId) {
|
|
@@ -50,7 +58,7 @@ async function fetchBaselineConsoleIds(config, sessionId) {
|
|
|
50
58
|
}
|
|
51
59
|
catch (error) {
|
|
52
60
|
if (sweetLinkDebug) {
|
|
53
|
-
console.warn(
|
|
61
|
+
console.warn("Failed to fetch baseline console events before click.", error);
|
|
54
62
|
}
|
|
55
63
|
return null;
|
|
56
64
|
}
|
|
@@ -72,22 +80,22 @@ async function reportConsoleAfterClick(params) {
|
|
|
72
80
|
}
|
|
73
81
|
}
|
|
74
82
|
if (recent.length > 0) {
|
|
75
|
-
console.log(`Console after click (${recent.length} event${recent.length === 1 ?
|
|
83
|
+
console.log(`Console after click (${recent.length} event${recent.length === 1 ? "" : "s"}):`);
|
|
76
84
|
for (const event of recent) {
|
|
77
85
|
const timestamp = new Date(event.timestamp ?? Date.now()).toLocaleTimeString();
|
|
78
86
|
console.log(` [${timestamp}] ${event.level}:`, ...event.args);
|
|
79
87
|
}
|
|
80
88
|
const dropped = newEvents.length - recent.length;
|
|
81
89
|
if (dropped > 0) {
|
|
82
|
-
console.log(` … ${dropped} more event${dropped === 1 ?
|
|
90
|
+
console.log(` … ${dropped} more event${dropped === 1 ? "" : "s"} omitted`);
|
|
83
91
|
}
|
|
84
92
|
}
|
|
85
93
|
else if (params.prompt) {
|
|
86
|
-
console.log(
|
|
94
|
+
console.log("Console after click: no new events captured.");
|
|
87
95
|
}
|
|
88
96
|
}
|
|
89
97
|
catch (error) {
|
|
90
|
-
console.warn(
|
|
98
|
+
console.warn("Unable to fetch console events after click:", extractEventMessage(error));
|
|
91
99
|
}
|
|
92
100
|
}
|
|
93
101
|
//# sourceMappingURL=click.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"click.js","sourceRoot":"","sources":["../../../src/commands/click.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAExC,MAAM,wBAAwB,GAAG,EAAE,CAAC;AAWpC,MAAM,UAAU,oBAAoB,CAAC,OAAgB;IACnD,OAAO;SACJ,OAAO,CA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AAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"run-js.d.ts","sourceRoot":"","sources":["../../../src/commands/run-js.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMzC,gDAAgD;AAChD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA4B3D"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { resolveConfig } from
|
|
2
|
-
import { readCommandOptions } from
|
|
3
|
-
import { renderCommandResult, resolveScript } from
|
|
4
|
-
import { executeRunScriptCommand, resolveSessionIdFromHint } from
|
|
1
|
+
import { resolveConfig } from "../core/config.js";
|
|
2
|
+
import { readCommandOptions } from "../core/env.js";
|
|
3
|
+
import { renderCommandResult, resolveScript } from "../runtime/scripts.js";
|
|
4
|
+
import { executeRunScriptCommand, resolveSessionIdFromHint } from "../runtime/session.js";
|
|
5
5
|
/** Registers the `sweetlink run-js` command. */
|
|
6
6
|
export function registerRunJsCommand(program) {
|
|
7
7
|
program
|
|
8
|
-
.command(
|
|
9
|
-
.description(
|
|
10
|
-
.option(
|
|
11
|
-
.option(
|
|
12
|
-
.option(
|
|
13
|
-
.option(
|
|
8
|
+
.command("run-js <sessionId> [inline...]")
|
|
9
|
+
.description("Execute JavaScript inside a SweetLink session")
|
|
10
|
+
.option("-c, --code <code...>", "Inline JavaScript to execute")
|
|
11
|
+
.option("-f, --file <path>", "Path to a file containing JavaScript")
|
|
12
|
+
.option("--capture-console", "Return console output from the page context", false)
|
|
13
|
+
.option("-t, --timeout <ms>", "Command timeout in milliseconds (default 15_000)", Number, 15_000)
|
|
14
14
|
.action(async function (sessionId, inline) {
|
|
15
15
|
const options = readCommandOptions(this);
|
|
16
16
|
const code = await resolveScript(options, inline);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-js.js","sourceRoot":"","sources":["../../../src/commands/run-js.ts"],"names":[],"mappings":"AACA,OAAO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AiB,EAAE,MAA4B;QACpF,MAAM,OAAO,GAAG,kBAAkB,CAAe,IAAI,CAAC,CAAC;QACvD,MAAM,IAAI,GAAG,MAAM,aAAa,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAClD,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;QACnC,MAAM,iBAAiB,GAAG,MAAM,wBAAwB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAE5E,MAAM,MAAM,GAAG,MAAM,uBAAuB,CAAC,MAAM,EAAE;YACnD,SAAS,EAAE,iBAAiB;YAC5B,IAAI;YACJ,SAAS,EAAE,OAAO,CAAC,OAAO;YAC1B,cAAc,EAAE,OAAO,CAAC,cAAc;SACvC,CAAC,CAAC;QAEH,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { spawn } from
|
|
2
|
-
import { access } from
|
|
3
|
-
import path from
|
|
4
|
-
const DEFAULT_MKCERT_PATH =
|
|
5
|
-
const MKCERT_INSTALL_ARGS = [
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { access } from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
const DEFAULT_MKCERT_PATH = "mkcert";
|
|
5
|
+
const MKCERT_INSTALL_ARGS = ["-install"];
|
|
6
6
|
async function resolveMkcertBinary(candidate) {
|
|
7
7
|
const bin = candidate?.trim() ?? DEFAULT_MKCERT_PATH;
|
|
8
8
|
if (path.isAbsolute(bin)) {
|
|
@@ -13,31 +13,31 @@ async function resolveMkcertBinary(candidate) {
|
|
|
13
13
|
}
|
|
14
14
|
export function registerTrustCaCommand(program) {
|
|
15
15
|
program
|
|
16
|
-
.command(
|
|
16
|
+
.command("trust-ca")
|
|
17
17
|
.description([
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
].join(
|
|
21
|
-
.option(
|
|
18
|
+
"Install or refresh the SweetLink TLS certificate.",
|
|
19
|
+
"Runs `mkcert -install` so browsers and the daemon share the same trusted CA.",
|
|
20
|
+
].join(" "))
|
|
21
|
+
.option("--mkcert <path>", "Explicit path to the mkcert binary")
|
|
22
22
|
.action(async (options) => {
|
|
23
23
|
const mkcertBinary = await resolveMkcertBinary(options.mkcert);
|
|
24
24
|
await new Promise((resolve, reject) => {
|
|
25
25
|
const child = spawn(mkcertBinary, MKCERT_INSTALL_ARGS, {
|
|
26
|
-
stdio:
|
|
26
|
+
stdio: "inherit",
|
|
27
27
|
});
|
|
28
|
-
child.on(
|
|
28
|
+
child.on("exit", (code) => {
|
|
29
29
|
if (code === 0) {
|
|
30
30
|
resolve();
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
|
-
reject(new Error(`mkcert exited with code ${code ??
|
|
33
|
+
reject(new Error(`mkcert exited with code ${code ?? "unknown"}. Ensure mkcert is installed (https://github.com/FiloSottile/mkcert) and rerun this command.`));
|
|
34
34
|
});
|
|
35
|
-
child.on(
|
|
35
|
+
child.on("error", (error) => {
|
|
36
36
|
reject(new Error(`Unable to execute mkcert at "${mkcertBinary}": ${error instanceof Error ? error.message : String(error)}`));
|
|
37
37
|
});
|
|
38
38
|
});
|
|
39
39
|
// eslint-disable-next-line no-console -- CLI feedback for operators
|
|
40
|
-
console.log(
|
|
40
|
+
console.log("✅ SweetLink certificate installed. Reload https://localhost:4455 in your browser to trust the daemon.");
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
//# sourceMappingURL=trust-ca.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-file.d.ts","sourceRoot":"","sources":["../../../src/core/config-file.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config-file.d.ts","sourceRoot":"","sources":["../../../src/core/config-file.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,MAAM,EAAE,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AI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;CACtC;AAMD,wBAAgB,6BAA6B,IAAI,IAAI,CAEpD;AAED,wBAAgB,uBAAuB,IAAI,YAAY,CA0BtD"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from
|
|
2
|
-
import path from
|
|
3
|
-
import { compact } from
|
|
4
|
-
import { TRAILING_SLASH_PATTERN } from
|
|
5
|
-
const CONFIG_BASENAMES = [
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { compact } from "es-toolkit";
|
|
4
|
+
import { TRAILING_SLASH_PATTERN } from "../util/regex.js";
|
|
5
|
+
const CONFIG_BASENAMES = ["sweetlink.json", "sweetlink.config.json"];
|
|
6
6
|
let cachedConfig = null;
|
|
7
7
|
export function resetSweetLinkFileConfigCache() {
|
|
8
8
|
cachedConfig = null;
|
|
@@ -17,7 +17,7 @@ export function loadSweetLinkFileConfig() {
|
|
|
17
17
|
return cachedConfig;
|
|
18
18
|
}
|
|
19
19
|
try {
|
|
20
|
-
const raw = readFileSync(resolvedPath,
|
|
20
|
+
const raw = readFileSync(resolvedPath, "utf8");
|
|
21
21
|
const parsed = JSON.parse(raw);
|
|
22
22
|
const baseDirectory = path.dirname(resolvedPath);
|
|
23
23
|
const config = normalizeConfig(parsed, baseDirectory);
|
|
@@ -49,37 +49,37 @@ function findConfigPath(initialDirectory) {
|
|
|
49
49
|
}
|
|
50
50
|
function normalizeConfig(raw, baseDirectory) {
|
|
51
51
|
const config = {};
|
|
52
|
-
if (typeof raw.appLabel ===
|
|
52
|
+
if (typeof raw.appLabel === "string") {
|
|
53
53
|
const trimmed = raw.appLabel.trim();
|
|
54
54
|
if (trimmed.length > 0) {
|
|
55
55
|
config.appLabel = trimmed;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
if (typeof raw.appUrl ===
|
|
58
|
+
if (typeof raw.appUrl === "string") {
|
|
59
59
|
const trimmed = raw.appUrl.trim();
|
|
60
60
|
if (trimmed.length > 0) {
|
|
61
61
|
config.appUrl = trimmed;
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
if (typeof raw.prodUrl ===
|
|
64
|
+
if (typeof raw.prodUrl === "string") {
|
|
65
65
|
const trimmed = raw.prodUrl.trim();
|
|
66
66
|
if (trimmed.length > 0) {
|
|
67
67
|
config.prodUrl = trimmed;
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
if (typeof raw.daemonUrl ===
|
|
70
|
+
if (typeof raw.daemonUrl === "string") {
|
|
71
71
|
const trimmed = raw.daemonUrl.trim();
|
|
72
72
|
if (trimmed.length > 0) {
|
|
73
73
|
config.daemonUrl = trimmed;
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
if (typeof raw.adminKey ===
|
|
76
|
+
if (typeof raw.adminKey === "string") {
|
|
77
77
|
const trimmed = raw.adminKey.trim();
|
|
78
78
|
if (trimmed.length > 0) {
|
|
79
79
|
config.adminKey = trimmed;
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
if (typeof raw.port ===
|
|
82
|
+
if (typeof raw.port === "number" && Number.isFinite(raw.port) && raw.port > 0) {
|
|
83
83
|
config.port = Math.floor(raw.port);
|
|
84
84
|
}
|
|
85
85
|
const cookieMappings = normalizeCookieMappingsSection(raw.cookieMappings);
|
|
@@ -106,7 +106,7 @@ function normalizeConfig(raw, baseDirectory) {
|
|
|
106
106
|
if (servers.length > 0) {
|
|
107
107
|
config.servers = servers;
|
|
108
108
|
}
|
|
109
|
-
if (typeof raw.oauthScript ===
|
|
109
|
+
if (typeof raw.oauthScript === "string") {
|
|
110
110
|
const trimmed = raw.oauthScript.trim();
|
|
111
111
|
if (trimmed.length > 0) {
|
|
112
112
|
const resolved = resolveConfigPath(trimmed, baseDirectory);
|
|
@@ -123,7 +123,7 @@ function resolveConfigPath(candidate, baseDirectory) {
|
|
|
123
123
|
return path.resolve(base, candidate);
|
|
124
124
|
}
|
|
125
125
|
function normalizeStringArray(value) {
|
|
126
|
-
if (typeof value ===
|
|
126
|
+
if (typeof value === "string") {
|
|
127
127
|
const trimmed = value.trim();
|
|
128
128
|
return trimmed.length > 0 ? [trimmed] : [];
|
|
129
129
|
}
|
|
@@ -131,7 +131,7 @@ function normalizeStringArray(value) {
|
|
|
131
131
|
return [];
|
|
132
132
|
}
|
|
133
133
|
return compact(value.map((item) => {
|
|
134
|
-
if (typeof item !==
|
|
134
|
+
if (typeof item !== "string") {
|
|
135
135
|
return null;
|
|
136
136
|
}
|
|
137
137
|
const trimmed = item.trim();
|
|
@@ -139,14 +139,14 @@ function normalizeStringArray(value) {
|
|
|
139
139
|
}));
|
|
140
140
|
}
|
|
141
141
|
function normalizeOptionalString(value) {
|
|
142
|
-
if (typeof value !==
|
|
142
|
+
if (typeof value !== "string") {
|
|
143
143
|
return null;
|
|
144
144
|
}
|
|
145
145
|
const trimmed = value.trim();
|
|
146
146
|
return trimmed.length > 0 ? trimmed : null;
|
|
147
147
|
}
|
|
148
148
|
function normalizeDevBootstrapSection(value) {
|
|
149
|
-
if (!value || typeof value !==
|
|
149
|
+
if (!value || typeof value !== "object") {
|
|
150
150
|
return null;
|
|
151
151
|
}
|
|
152
152
|
if (Array.isArray(value)) {
|
|
@@ -159,18 +159,24 @@ function normalizeDevBootstrapSection(value) {
|
|
|
159
159
|
if (!(endpoint || loginPath)) {
|
|
160
160
|
return null;
|
|
161
161
|
}
|
|
162
|
-
return {
|
|
162
|
+
return {
|
|
163
|
+
endpoint: endpoint ?? undefined,
|
|
164
|
+
loginPath: loginPath ?? undefined,
|
|
165
|
+
redirectParam: redirectParam ?? undefined,
|
|
166
|
+
};
|
|
163
167
|
}
|
|
164
168
|
function normalizeCookieMappingsSection(value) {
|
|
165
169
|
if (!Array.isArray(value)) {
|
|
166
170
|
return [];
|
|
167
171
|
}
|
|
168
172
|
return compact(value.map((entry) => {
|
|
169
|
-
if (!entry || typeof entry !==
|
|
173
|
+
if (!entry || typeof entry !== "object") {
|
|
170
174
|
return null;
|
|
171
175
|
}
|
|
172
|
-
const hostsRaw = normalizeStringArray(entry.hosts ??
|
|
173
|
-
|
|
176
|
+
const hostsRaw = normalizeStringArray(entry.hosts ??
|
|
177
|
+
entry.match);
|
|
178
|
+
const originsRaw = normalizeStringArray(entry.origins ??
|
|
179
|
+
entry.include);
|
|
174
180
|
if (hostsRaw.length === 0 || originsRaw.length === 0) {
|
|
175
181
|
return null;
|
|
176
182
|
}
|
|
@@ -181,19 +187,19 @@ function normalizeCookieMappingsSection(value) {
|
|
|
181
187
|
}));
|
|
182
188
|
}
|
|
183
189
|
function normalizeHealthChecksSection(value) {
|
|
184
|
-
if (!value || typeof value !==
|
|
190
|
+
if (!value || typeof value !== "object") {
|
|
185
191
|
return null;
|
|
186
192
|
}
|
|
187
193
|
const paths = normalizeStringArray(value.paths ?? value.path);
|
|
188
194
|
return paths.length > 0 ? { paths } : null;
|
|
189
195
|
}
|
|
190
196
|
function normalizeSmokeRoutesSection(value) {
|
|
191
|
-
if (!value || typeof value !==
|
|
197
|
+
if (!value || typeof value !== "object") {
|
|
192
198
|
return null;
|
|
193
199
|
}
|
|
194
200
|
const defaults = normalizeStringArray(value.defaults);
|
|
195
201
|
const rawPresets = value.presets;
|
|
196
|
-
const normalizedPresets = rawPresets && typeof rawPresets ===
|
|
202
|
+
const normalizedPresets = rawPresets && typeof rawPresets === "object"
|
|
197
203
|
? Object.fromEntries(compact(Object.entries(rawPresets).map(([key, routeList]) => {
|
|
198
204
|
const routes = normalizeStringArray(routeList);
|
|
199
205
|
return routes.length > 0 ? [key, routes] : null;
|
|
@@ -215,25 +221,27 @@ function normalizeServersSection(value, baseDirectory) {
|
|
|
215
221
|
return [];
|
|
216
222
|
}
|
|
217
223
|
return compact(value.map((entry) => {
|
|
218
|
-
if (!entry || typeof entry !==
|
|
224
|
+
if (!entry || typeof entry !== "object") {
|
|
219
225
|
return null;
|
|
220
226
|
}
|
|
221
227
|
const record = entry;
|
|
222
|
-
const envCandidate = typeof record.env ===
|
|
228
|
+
const envCandidate = typeof record.env === "string" ? record.env.trim() : "";
|
|
223
229
|
if (!envCandidate) {
|
|
224
230
|
return null;
|
|
225
231
|
}
|
|
226
232
|
const startCommand = normalizeCommandArray(record.start);
|
|
227
233
|
const checkCommand = normalizeCommandArray(record.check);
|
|
228
234
|
const timeoutMs = normalizeTimeout(record.timeoutMs);
|
|
229
|
-
const cwdRaw = typeof record.cwd ===
|
|
230
|
-
const cwdResolved = cwdRaw.length > 0
|
|
235
|
+
const cwdRaw = typeof record.cwd === "string" ? record.cwd.trim() : "";
|
|
236
|
+
const cwdResolved = cwdRaw.length > 0
|
|
237
|
+
? resolveConfigPath(cwdRaw, baseDirectory)
|
|
238
|
+
: (baseDirectory ?? process.cwd());
|
|
231
239
|
return {
|
|
232
240
|
env: envCandidate,
|
|
233
241
|
...(startCommand ? { start: startCommand } : {}),
|
|
234
242
|
...(checkCommand ? { check: checkCommand } : {}),
|
|
235
243
|
...(cwdResolved ? { cwd: cwdResolved } : {}),
|
|
236
|
-
...(typeof timeoutMs ===
|
|
244
|
+
...(typeof timeoutMs === "number" ? { timeoutMs } : {}),
|
|
237
245
|
};
|
|
238
246
|
}));
|
|
239
247
|
}
|
|
@@ -241,18 +249,18 @@ function normalizeCommandArray(value) {
|
|
|
241
249
|
if (!value) {
|
|
242
250
|
return null;
|
|
243
251
|
}
|
|
244
|
-
if (typeof value ===
|
|
252
|
+
if (typeof value === "string") {
|
|
245
253
|
const trimmed = value.trim();
|
|
246
254
|
if (trimmed.length === 0) {
|
|
247
255
|
return null;
|
|
248
256
|
}
|
|
249
|
-
return [
|
|
257
|
+
return ["sh", "-c", trimmed];
|
|
250
258
|
}
|
|
251
259
|
if (!Array.isArray(value)) {
|
|
252
260
|
return null;
|
|
253
261
|
}
|
|
254
262
|
const command = compact(value.map((item) => {
|
|
255
|
-
if (typeof item !==
|
|
263
|
+
if (typeof item !== "string") {
|
|
256
264
|
return null;
|
|
257
265
|
}
|
|
258
266
|
const trimmed = item.trim();
|
|
@@ -261,10 +269,10 @@ function normalizeCommandArray(value) {
|
|
|
261
269
|
return command.length > 0 ? command : null;
|
|
262
270
|
}
|
|
263
271
|
function normalizeTimeout(value) {
|
|
264
|
-
if (typeof value ===
|
|
272
|
+
if (typeof value === "number" && Number.isFinite(value) && value > 0) {
|
|
265
273
|
return Math.floor(value);
|
|
266
274
|
}
|
|
267
|
-
if (typeof value ===
|
|
275
|
+
if (typeof value === "string") {
|
|
268
276
|
const parsed = Number.parseInt(value, 10);
|
|
269
277
|
if (Number.isFinite(parsed) && parsed > 0) {
|
|
270
278
|
return parsed;
|
|
@@ -273,21 +281,21 @@ function normalizeTimeout(value) {
|
|
|
273
281
|
return null;
|
|
274
282
|
}
|
|
275
283
|
function canonicalizeRedirectPath(value) {
|
|
276
|
-
if (typeof value !==
|
|
284
|
+
if (typeof value !== "string") {
|
|
277
285
|
return null;
|
|
278
286
|
}
|
|
279
287
|
let normalized = value.trim();
|
|
280
|
-
if (!normalized.startsWith(
|
|
288
|
+
if (!normalized.startsWith("/")) {
|
|
281
289
|
normalized = `/${normalized}`;
|
|
282
290
|
}
|
|
283
|
-
normalized = normalized.replace(TRAILING_SLASH_PATTERN,
|
|
291
|
+
normalized = normalized.replace(TRAILING_SLASH_PATTERN, "");
|
|
284
292
|
if (!normalized) {
|
|
285
|
-
return
|
|
293
|
+
return "/";
|
|
286
294
|
}
|
|
287
|
-
return normalized ||
|
|
295
|
+
return normalized || "/";
|
|
288
296
|
}
|
|
289
297
|
function normalizeRedirectsSection(value) {
|
|
290
|
-
if (!value || typeof value !==
|
|
298
|
+
if (!value || typeof value !== "object") {
|
|
291
299
|
return;
|
|
292
300
|
}
|
|
293
301
|
const entries = Object.entries(value);
|
|
@@ -296,7 +304,7 @@ function normalizeRedirectsSection(value) {
|
|
|
296
304
|
}
|
|
297
305
|
const redirects = {};
|
|
298
306
|
for (const [rawSource, rawTarget] of entries) {
|
|
299
|
-
if (typeof rawSource !==
|
|
307
|
+
if (typeof rawSource !== "string" || typeof rawTarget !== "string") {
|
|
300
308
|
continue;
|
|
301
309
|
}
|
|
302
310
|
const sourcePath = canonicalizeRedirectPath(rawSource);
|