doc-detective 4.41.6 → 5.0.0-v5-rc.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/README.md +3 -3
- package/bin/runner-entrypoint.js +11 -6
- package/dist/agents/command.d.ts +2 -2
- package/dist/agents/command.d.ts.map +1 -1
- package/dist/agents/command.js +29 -40
- package/dist/agents/command.js.map +1 -1
- package/dist/agents/prompts.d.ts +2 -2
- package/dist/agents/prompts.d.ts.map +1 -1
- package/dist/agents/prompts.js +4 -3
- package/dist/agents/prompts.js.map +1 -1
- package/dist/agents/runner.d.ts.map +1 -1
- package/dist/agents/runner.js +6 -1
- package/dist/agents/runner.js.map +1 -1
- package/dist/cli.js +68 -108
- package/dist/cli.js.map +1 -1
- package/dist/cliHelp.d.ts +5 -0
- package/dist/cliHelp.d.ts.map +1 -0
- package/dist/cliHelp.js +229 -0
- package/dist/cliHelp.js.map +1 -0
- package/dist/cliOptions.d.ts +10 -0
- package/dist/cliOptions.d.ts.map +1 -0
- package/dist/cliOptions.js +128 -0
- package/dist/cliOptions.js.map +1 -0
- package/dist/cliOutput.d.ts +38 -0
- package/dist/cliOutput.d.ts.map +1 -0
- package/dist/cliOutput.js +164 -0
- package/dist/cliOutput.js.map +1 -0
- package/dist/cliProgram.d.ts +7 -0
- package/dist/cliProgram.d.ts.map +1 -0
- package/dist/cliProgram.js +77 -0
- package/dist/cliProgram.js.map +1 -0
- package/dist/common/src/schemas/schemas.json +2 -2
- package/dist/common/src/schemas/schemasReferenced.json +45 -6
- package/dist/common/src/schemas/validators.cjs +3 -3
- package/dist/common/src/schemas/validatorsCheck.cjs +1 -1
- package/dist/common/src/types/generated/config_v3.d.ts +86 -72
- package/dist/common/src/types/generated/config_v3.d.ts.map +1 -1
- package/dist/common/src/types/generated/resolvedTests_v3.d.ts +86 -72
- package/dist/common/src/types/generated/resolvedTests_v3.d.ts.map +1 -1
- package/dist/common/src/validate.d.ts +0 -10
- package/dist/common/src/validate.d.ts.map +1 -1
- package/dist/common/src/validate.js +7 -1
- package/dist/common/src/validate.js.map +1 -1
- package/dist/core/detectTests.d.ts.map +1 -1
- package/dist/core/detectTests.js +26 -4
- package/dist/core/detectTests.js.map +1 -1
- package/dist/core/files.d.ts.map +1 -1
- package/dist/core/files.js +1 -0
- package/dist/core/files.js.map +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +11 -14
- package/dist/core/index.js.map +1 -1
- package/dist/core/progress.d.ts +4 -0
- package/dist/core/progress.d.ts.map +1 -0
- package/dist/core/progress.js +14 -0
- package/dist/core/progress.js.map +1 -0
- package/dist/core/signals.d.ts +7 -0
- package/dist/core/signals.d.ts.map +1 -0
- package/dist/core/signals.js +32 -0
- package/dist/core/signals.js.map +1 -0
- package/dist/core/telem.d.ts.map +1 -1
- package/dist/core/telem.js +3 -3
- package/dist/core/telem.js.map +1 -1
- package/dist/core/telemLite.d.ts +5 -1
- package/dist/core/telemLite.d.ts.map +1 -1
- package/dist/core/telemLite.js +25 -9
- package/dist/core/telemLite.js.map +1 -1
- package/dist/core/tests/loadCookie.js +1 -1
- package/dist/core/tests/loadCookie.js.map +1 -1
- package/dist/core/tests/saveCookie.js +1 -1
- package/dist/core/tests/saveCookie.js.map +1 -1
- package/dist/core/tests.d.ts.map +1 -1
- package/dist/core/tests.js +14 -8
- package/dist/core/tests.js.map +1 -1
- package/dist/core/utils.d.ts +3 -1
- package/dist/core/utils.d.ts.map +1 -1
- package/dist/core/utils.js +73 -7
- package/dist/core/utils.js.map +1 -1
- package/dist/debug/command.d.ts +3 -2
- package/dist/debug/command.d.ts.map +1 -1
- package/dist/debug/command.js +75 -67
- package/dist/debug/command.js.map +1 -1
- package/dist/debug/index.d.ts +3 -1
- package/dist/debug/index.d.ts.map +1 -1
- package/dist/debug/index.js +10 -3
- package/dist/debug/index.js.map +1 -1
- package/dist/debug/provenance.d.ts.map +1 -1
- package/dist/debug/provenance.js +4 -3
- package/dist/debug/provenance.js.map +1 -1
- package/dist/hints/context.d.ts +1 -1
- package/dist/hints/context.js +2 -2
- package/dist/hints/context.js.map +1 -1
- package/dist/hints/hints.d.ts.map +1 -1
- package/dist/hints/hints.js +24 -8
- package/dist/hints/hints.js.map +1 -1
- package/dist/hints/index.js +3 -3
- package/dist/hints/index.js.map +1 -1
- package/dist/hints/render.d.ts.map +1 -1
- package/dist/hints/render.js +6 -10
- package/dist/hints/render.js.map +1 -1
- package/dist/index.cjs +459 -106
- package/dist/lsp/command.d.ts +5 -9
- package/dist/lsp/command.d.ts.map +1 -1
- package/dist/lsp/command.js +17 -18
- package/dist/lsp/command.js.map +1 -1
- package/dist/lsp/server.d.ts.map +1 -1
- package/dist/lsp/server.js +2 -4
- package/dist/lsp/server.js.map +1 -1
- package/dist/reporters/htmlReporter.d.ts.map +1 -1
- package/dist/reporters/htmlReporter.js +1 -4
- package/dist/reporters/htmlReporter.js.map +1 -1
- package/dist/runtime/cacheDir.d.ts +12 -1
- package/dist/runtime/cacheDir.d.ts.map +1 -1
- package/dist/runtime/cacheDir.js +22 -3
- package/dist/runtime/cacheDir.js.map +1 -1
- package/dist/runtime/installCommand.d.ts +15 -8
- package/dist/runtime/installCommand.d.ts.map +1 -1
- package/dist/runtime/installCommand.js +99 -112
- package/dist/runtime/installCommand.js.map +1 -1
- package/dist/runtime/selfUpdate.d.ts.map +1 -1
- package/dist/runtime/selfUpdate.js +19 -3
- package/dist/runtime/selfUpdate.js.map +1 -1
- package/dist/utils.d.ts +5 -4
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +274 -275
- package/dist/utils.js.map +1 -1
- package/package.json +9 -12
- package/scripts/postinstall.js +1 -1
- package/bin/doc-detective-lsp.js +0 -6
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ Doc Detective has multiple components to integrate with your workflows as you ne
|
|
|
23
23
|
|
|
24
24
|
1. Install prerequisites:
|
|
25
25
|
|
|
26
|
-
- [Node.js](https://nodejs.org/) (tested on
|
|
26
|
+
- [Node.js](https://nodejs.org/) v24.15 or later (tested on v24 and v26)
|
|
27
27
|
|
|
28
28
|
1. In a terminal, install Doc Detective globally:
|
|
29
29
|
|
|
@@ -37,7 +37,7 @@ Doc Detective has multiple components to integrate with your workflows as you ne
|
|
|
37
37
|
|
|
38
38
|
### Lazy-installed runtime
|
|
39
39
|
|
|
40
|
-
`npm i doc-detective` installs the CLI, then pre-installs the heavy runtime assets at postinstall. Those are browsers (Chrome, Firefox), drivers (ChromeDriver, Geckodriver), ffmpeg, and the npm packages that drive them. That last group includes webdriverio, appium, and sharp. They land in `~/.doc-detective
|
|
40
|
+
`npm i doc-detective` installs the CLI, then pre-installs the heavy runtime assets at postinstall. Those are browsers (Chrome, Firefox), drivers (ChromeDriver, Geckodriver), ffmpeg, and the npm packages that drive them. That last group includes webdriverio, appium, and sharp. They land in a per-user cache: `$XDG_CACHE_HOME/doc-detective` or `~/.cache/doc-detective`, `%LOCALAPPDATA%\doc-detective` on Windows, an existing `~/.doc-detective`, or `DOC_DETECTIVE_CACHE_DIR`. This keeps a fresh install ready to run without a separate step, as it does any Docker image built `FROM` it. The pre-install runs in a child process whose output is captured. npm's deprecation warnings from the heavy transitive trees therefore never reach your terminal.
|
|
41
41
|
|
|
42
42
|
**Opt out of the heavy pre-install** by setting `DOC_DETECTIVE_AUTOINSTALL=0`, which also accepts `false`, `no`, and `off`. The CLI install then stays small, with no browser download and no heavy npm packages. The heavy assets install lazily the first time a test needs them, or up front through `doc-detective install all`.
|
|
43
43
|
|
|
@@ -71,7 +71,7 @@ Either way, the *published* package declares the heavy packages in neither `depe
|
|
|
71
71
|
|
|
72
72
|
### Auto-update
|
|
73
73
|
|
|
74
|
-
By default, `doc-detective` checks the npm registry on startup and self-updates if a newer release is available. Global installs run `npm install -g`, and `npx` invocations re-exec through `npx -y doc-detective@latest`. Local project installs print an "update available" hint instead of mutating your `package.json`. To opt out:
|
|
74
|
+
By default, `doc-detective` checks the npm registry on startup and self-updates if a newer release is available. Global installs run `npm install -g`, and `npx` invocations re-exec through `npx -y doc-detective@latest`. Local project installs print an "update available" hint instead of mutating your `package.json`. Self-update never crosses a major version. To opt out:
|
|
75
75
|
|
|
76
76
|
- `--no-auto-update` on the CLI
|
|
77
77
|
- `autoUpdate: false` in `.doc-detective.json`
|
package/bin/runner-entrypoint.js
CHANGED
|
@@ -407,7 +407,10 @@ function buildEffectiveConfig(configSnapshot, source, workspaceDir = WORKSPACE_D
|
|
|
407
407
|
// to. main() resolves it once from DD_WORKSPACE_DIR and threads
|
|
408
408
|
// it through both functions so the CLI's view of the filesystem
|
|
409
409
|
// can't drift from where the runner actually wrote specs/output.
|
|
410
|
-
effective.
|
|
410
|
+
effective.outputDir = path.posix.join(workspaceDir, OUTPUT_SUBDIR);
|
|
411
|
+
// Also the results file, so a repository's own config can't write outside the
|
|
412
|
+
// workspace: this config overlays it.
|
|
413
|
+
effective.output = path.posix.join(workspaceDir, OUTPUT_SUBDIR, 'testResults.json');
|
|
411
414
|
if (source.type === 'inline') {
|
|
412
415
|
effective.input = path.posix.join(workspaceDir, SPECS_SUBDIR);
|
|
413
416
|
}
|
|
@@ -746,6 +749,10 @@ async function main() {
|
|
|
746
749
|
};
|
|
747
750
|
} else if (exitCode === 0) {
|
|
748
751
|
finalizeBody = { status: 'succeeded', exit_code: 0, summary: {} };
|
|
752
|
+
} else if (exitCode === 1) {
|
|
753
|
+
// The run worked and a test failed (ADR 01146). The platform reads this
|
|
754
|
+
// from the exit code and shows it as a tests-failed outcome.
|
|
755
|
+
finalizeBody = { status: 'succeeded', exit_code: 1, summary: { reason: 'tests_failed' } };
|
|
749
756
|
} else {
|
|
750
757
|
finalizeBody = {
|
|
751
758
|
status: 'failed',
|
|
@@ -771,11 +778,9 @@ async function main() {
|
|
|
771
778
|
// Module-import guard so the test file can `import` from this module
|
|
772
779
|
// without triggering main().
|
|
773
780
|
//
|
|
774
|
-
//
|
|
775
|
-
//
|
|
776
|
-
//
|
|
777
|
-
// import.meta.url is the realpath under node_modules — hence realpathSync
|
|
778
|
-
// before comparing. And a hand-built `file://${...}` template mangles
|
|
781
|
+
// Hosted images run this through `doc-detective runner`, which calls main()
|
|
782
|
+
// itself. This guard covers running the file directly. Both halves of the
|
|
783
|
+
// comparison matter: argv[1] can be a symlink, so realpathSync before comparing. And a hand-built `file://${...}` template mangles
|
|
779
784
|
// Windows paths and anything containing a space or `#`, so the conversion
|
|
780
785
|
// goes through pathToFileURL. Getting either wrong makes this silently
|
|
781
786
|
// false: main() never runs, nothing is logged, and the process exits 0
|
package/dist/agents/command.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Command } from "commander";
|
|
2
2
|
export interface InstallAgentsArgv {
|
|
3
3
|
agent?: string[];
|
|
4
4
|
scope?: "project" | "global";
|
|
@@ -7,5 +7,5 @@ export interface InstallAgentsArgv {
|
|
|
7
7
|
"dry-run": boolean;
|
|
8
8
|
dryRun?: boolean;
|
|
9
9
|
}
|
|
10
|
-
export declare
|
|
10
|
+
export declare function buildInstallAgentsCommand(handler?: (argv: any) => Promise<void> | void): Command;
|
|
11
11
|
//# sourceMappingURL=command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/agents/command.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/agents/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAG5C,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC7B,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,OAAO,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAiBD,wBAAgB,yBAAyB,CACvC,OAAO,GAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAA2B,GAClE,OAAO,CAsBT"}
|
package/dist/agents/command.js
CHANGED
|
@@ -1,41 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
type: "boolean",
|
|
31
|
-
default: false,
|
|
32
|
-
describe: "Print the actions that would be taken without executing them.",
|
|
33
|
-
}),
|
|
34
|
-
handler: async (argv) => {
|
|
35
|
-
// Lazy-load so unrelated subcommands don't pay the import cost.
|
|
36
|
-
const { runInstallAgents } = await import("./runner.js");
|
|
37
|
-
const { createPrompts } = await import("./prompts.js");
|
|
38
|
-
await runInstallAgents(argv, { prompts: createPrompts() });
|
|
39
|
-
},
|
|
40
|
-
};
|
|
1
|
+
import { Command, Option } from "commander";
|
|
2
|
+
import { addGlobalOptions, cliArgv } from "../cliOptions.js";
|
|
3
|
+
async function installAgentsHandler(argv) {
|
|
4
|
+
// Lazy-load so unrelated subcommands don't pay the import cost.
|
|
5
|
+
const { runInstallAgents } = await import("./runner.js");
|
|
6
|
+
const { createPrompts } = await import("./prompts.js");
|
|
7
|
+
const reports = await runInstallAgents(argv, {
|
|
8
|
+
prompts: createPrompts(),
|
|
9
|
+
// With --json, stdout holds the JSON document and nothing else.
|
|
10
|
+
...(argv.json ? { logger: (message) => console.error(message) } : {}),
|
|
11
|
+
});
|
|
12
|
+
if (argv.json)
|
|
13
|
+
console.log(JSON.stringify(reports, null, 2));
|
|
14
|
+
}
|
|
15
|
+
const AGENT_GROUP = "Agent options:";
|
|
16
|
+
// `handler` is replaceable for tests.
|
|
17
|
+
export function buildInstallAgentsCommand(handler = installAgentsHandler) {
|
|
18
|
+
return addGlobalOptions(new Command("agents"))
|
|
19
|
+
.addOption(new Option("--agent <id...>", "Install for this agent; repeatable. One of claude, copilot, gemini, codex, qwen, or opencode").helpGroup(AGENT_GROUP))
|
|
20
|
+
.addOption(new Option("--scope <scope>", "Install for this project or for your user: project or global")
|
|
21
|
+
.choices(["project", "global"])
|
|
22
|
+
.helpGroup(AGENT_GROUP))
|
|
23
|
+
.addOption(new Option("-y, --yes", "Don't prompt; needs --agent and --scope").helpGroup(AGENT_GROUP))
|
|
24
|
+
.addOption(new Option("-f, --force", "Reinstall even if up to date").helpGroup(AGENT_GROUP))
|
|
25
|
+
.addOption(new Option("-n, --dry-run", "Show what would happen without doing it").helpGroup(AGENT_GROUP))
|
|
26
|
+
.action(async (_options, command) => {
|
|
27
|
+
await handler(cliArgv(command));
|
|
28
|
+
});
|
|
29
|
+
}
|
|
41
30
|
//# sourceMappingURL=command.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../src/agents/command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../src/agents/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAW7D,KAAK,UAAU,oBAAoB,CAAC,IAAS;IAC3C,gEAAgE;IAChE,MAAM,EAAE,gBAAgB,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;IACzD,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,CAAC;IACvD,MAAM,OAAO,GAAG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O,CAAC,OAAO,CAAC,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/dist/agents/prompts.d.ts
CHANGED
|
@@ -13,8 +13,8 @@ export declare function pickScope(supported: Scope[]): Promise<Scope>;
|
|
|
13
13
|
export declare function confirmForce(modifiedFiles: string[]): Promise<boolean>;
|
|
14
14
|
/**
|
|
15
15
|
* Factory to hand into {@link runInstallAgents} as its `prompts` dep. The
|
|
16
|
-
* `install
|
|
17
|
-
* `import("./prompts.js")` from the
|
|
16
|
+
* `install agents` command already imports this module lazily (dynamic
|
|
17
|
+
* `import("./prompts.js")` from the command's action) so other subcommands
|
|
18
18
|
* don't pay the inquirer load cost.
|
|
19
19
|
*/
|
|
20
20
|
export declare function createPrompts(): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/agents/prompts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/agents/prompts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEtD;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,SAAS,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAY7E;AAED;;;GAGG;AACH,wBAAsB,SAAS,CAAC,SAAS,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,CASlE;AAED,wBAAsB,YAAY,CAAC,aAAa,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAY5E;AAED;;;;;GAKG;AACH,wBAAgB,aAAa;;;EAE5B"}
|
package/dist/agents/prompts.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isInteractive } from "../cliOutput.js";
|
|
1
2
|
import { checkbox, select, confirm } from "@inquirer/prompts";
|
|
2
3
|
/**
|
|
3
4
|
* Ask the user which detected agents to install into. Pre-selects all of them
|
|
@@ -46,15 +47,15 @@ export async function confirmForce(modifiedFiles) {
|
|
|
46
47
|
}
|
|
47
48
|
/**
|
|
48
49
|
* Factory to hand into {@link runInstallAgents} as its `prompts` dep. The
|
|
49
|
-
* `install
|
|
50
|
-
* `import("./prompts.js")` from the
|
|
50
|
+
* `install agents` command already imports this module lazily (dynamic
|
|
51
|
+
* `import("./prompts.js")` from the command's action) so other subcommands
|
|
51
52
|
* don't pay the inquirer load cost.
|
|
52
53
|
*/
|
|
53
54
|
export function createPrompts() {
|
|
54
55
|
return { pickAgents, pickScope };
|
|
55
56
|
}
|
|
56
57
|
function assertTTY() {
|
|
57
|
-
if (!
|
|
58
|
+
if (!isInteractive()) {
|
|
58
59
|
throw new Error("No TTY detected; run interactively or pass --agent and --scope with --yes.");
|
|
59
60
|
}
|
|
60
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../src/agents/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG9D;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,SAAyB;IACxD,SAAS,EAAE,CAAC;IACZ,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACtC,OAAO,QAAQ,CAAC;QACd,OAAO,EAAE,sDAAsD;QAC/D,OAAO,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAC7B,IAAI,EAAE,CAAC,CAAC,WAAW;YACnB,KAAK,EAAE,CAAC,CAAC,EAAE;YACX,OAAO,EAAE,IAAI;SACd,CAAC,CAAC;QACH,QAAQ,EAAE,KAAK;KAChB,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,SAAkB;IAChD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AACH,MAAM,UAAU,aAAa;IAC3B,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;AACnC,CAAC;AAED,SAAS,SAAS;IAChB,IAAI,CAAC,aAAa,EAAE,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CACb,4EAA4E,CAC7E,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,SAAkB;IAC3C,MAAM,MAAM,GAAyD;QACnE,OAAO,EAAE;YACP,IAAI,EAAE,qCAAqC;YAC3C,WAAW,EAAE,8CAA8C;SAC5D;QACD,MAAM,EAAE;YACN,IAAI,EAAE,sDAAsD;YAC5D,WAAW,EAAE,yCAAyC;SACvD;KACF,CAAC;IACF,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;AACxG,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/agents/runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/agents/runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAG/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEtD,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;IAC1B,OAAO,CAAC,EAAE;QACR,UAAU,EAAE,CAAC,SAAS,EAAE,YAAY,EAAE,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QAC7D,SAAS,EAAE,CAAC,SAAS,EAAE,KAAK,EAAE,KAAK,OAAO,CAAC,KAAK,CAAC,CAAC;KACnD,CAAC;IACF,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,QAAQ,KAAK,IAAI,CAAC;IACrD,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC;CACvB;AAOD,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,iBAAiB,EACvB,IAAI,GAAE,UAAe,GACpB,OAAO,CAAC,aAAa,EAAE,CAAC,CA2F1B"}
|
package/dist/agents/runner.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { listAdapters } from "./registry.js";
|
|
2
|
+
import { isInteractive } from "../cliOutput.js";
|
|
2
3
|
const defaultLogger = (msg, level = "info") => {
|
|
3
4
|
if (level === "error")
|
|
4
5
|
console.error(msg);
|
|
@@ -8,7 +9,7 @@ const defaultLogger = (msg, level = "info") => {
|
|
|
8
9
|
export async function runInstallAgents(argv, deps = {}) {
|
|
9
10
|
const adapters = deps.adapters ?? listAdapters();
|
|
10
11
|
const logger = deps.logger ?? defaultLogger;
|
|
11
|
-
const isTTY = deps.isTTY ?? (() =>
|
|
12
|
+
const isTTY = deps.isTTY ?? (() => isInteractive());
|
|
12
13
|
const dryRun = argv["dry-run"] === true;
|
|
13
14
|
// --yes requires explicit --agent and --scope; no prompts.
|
|
14
15
|
if (argv.yes) {
|
|
@@ -19,6 +20,10 @@ export async function runInstallAgents(argv, deps = {}) {
|
|
|
19
20
|
throw new Error("--yes requires --scope project|global.");
|
|
20
21
|
}
|
|
21
22
|
}
|
|
23
|
+
// Fail before detection, which can take seconds, when there's no way to ask.
|
|
24
|
+
if (!isTTY() && (!argv.agent || argv.agent.length === 0)) {
|
|
25
|
+
throw new Error("Cannot prompt for agents in a non-TTY environment. Pass --agent explicitly (repeatable).");
|
|
26
|
+
}
|
|
22
27
|
// Resolve which agents to target.
|
|
23
28
|
const targeted = await resolveTargetAgents(argv, adapters, {
|
|
24
29
|
isTTY: isTTY(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/agents/runner.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/agents/runner.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAahD,MAAM,aAAa,GAAG,CAAC,GAAW,EAAE,KAAK,GAAa,MAAM,EAAE,EAAE;IAC9D,IAAI,KAAK,KAAK,OAAO;QAAE,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;;QACrC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACxB,CAAC,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,IAAuB,EACvB,IAAI,GAAe,EAAE;IAErB,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,YAAY,EAAE,CAAC;IACjD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,aAAa,CAAC;IAC5C,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,CAAC,GAAG,EAAE,CAAC,aAAa,EAAE,CAAC,CAAC;IAEpD,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC;IAExC,2DAA2D;IAC3D,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC3C,MAAM,IAAI,KAAK,CACb,oEAAoE,CACrE,CAAC;QACJ,CAAC;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AAC,MAAM,EAAE,CAAC;QACjB,KAAK,WAAW;YACd,OAAO,cAAc,GAAG,EAAE,CAAC;QAC7B,KAAK,SAAS;YACZ,OAAO,YAAY,GAAG,EAAE,CAAC;QAC3B,KAAK,oBAAoB;YACvB,OAAO,uBAAuB,GAAG,EAAE,CAAC;QACtC,KAAK,QAAQ;YACX,OAAO,qBAAqB,GAAG,EAAE,CAAC;QACpC,KAAK,SAAS;YACZ,OAAO,wBAAwB,CAAC;QAClC,KAAK,UAAU;YACb,OAAO,iCAAiC,GAAG,EAAE,CAAC;QAChD;YACE,OAAO,KAAK,CAAC,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC;IACjC,CAAC;AACH,CAAC"}
|
package/dist/cli.js
CHANGED
|
@@ -1,65 +1,56 @@
|
|
|
1
1
|
import { runTests, awaitTelemetryFlush } from "./core/index.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { runExitCode } from "./core/utils.js";
|
|
3
|
+
import { CommanderError } from "commander";
|
|
4
|
+
import { setConfig, outputResults, setMeta, getVersionData, log, logLevelEnabled, getResolvedTestsFromEnv, reportResults, loadProjectEnv, readStdinInputs, writeResultsFile, } from "./utils.js";
|
|
5
|
+
import { buildProgram } from "./cliProgram.js";
|
|
5
6
|
import { maybeShowHint } from "./hints/index.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { printDebug, defaultDebugDir } from "./debug/index.js";
|
|
9
|
-
import { debugCommand } from "./debug/command.js";
|
|
7
|
+
import { applyColorFlags, applyInputFlag, diag, reportCrash, showRunProgress, verdictLine } from "./cliOutput.js";
|
|
8
|
+
import { runProgress } from "./core/progress.js";
|
|
10
9
|
import { argv as processArgv } from "node:process";
|
|
11
10
|
import path from "node:path";
|
|
12
11
|
import fs from "node:fs";
|
|
13
12
|
import { createRequire } from "node:module";
|
|
14
13
|
const cliRequire = createRequire(import.meta.url);
|
|
15
14
|
// Run
|
|
16
|
-
setMeta();
|
|
17
15
|
main(processArgv).catch((err) => {
|
|
18
|
-
//
|
|
19
|
-
// escapes (including our rethrown errors) so the process exits non-zero.
|
|
16
|
+
// Catches anything main() rethrows, so the process exits non-zero.
|
|
20
17
|
// c8 ignore: the `?? err` / `|| err` fallback branches (err nullish, or a
|
|
21
18
|
// non-Error thrown value without a `.message`) are structurally dead under
|
|
22
|
-
// every current throw site — setConfig() always rejects with a real Error
|
|
23
|
-
//
|
|
24
|
-
//
|
|
25
|
-
//
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
// every current throw site — setConfig() always rejects with a real Error —
|
|
20
|
+
// so `err` here is always a real Error with a non-empty `.message`. Defensive
|
|
21
|
+
// fallback for future throw sites, not reachable today.
|
|
22
|
+
// A mistake in a command gets its message. A bug gets a bug report. Reaching
|
|
23
|
+
// here with one of these types means a defect in Doc Detective, not bad input.
|
|
24
|
+
if (err instanceof TypeError || err instanceof ReferenceError || err instanceof RangeError) {
|
|
25
|
+
reportCrash(err, { version: cliRequire("../package.json").version });
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
console.error(`Error: ${err?.message || err}`);
|
|
29
|
+
}
|
|
30
|
+
process.exit(2);
|
|
28
31
|
});
|
|
29
32
|
async function main(argv) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
//
|
|
38
|
-
//
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
.command({ ...installAgentsCommand, describe: false })
|
|
47
|
-
.command(installCommand)
|
|
48
|
-
.command(lspCommand)
|
|
49
|
-
.command(debugCommand)
|
|
50
|
-
.strict()
|
|
51
|
-
.demandCommand(0)
|
|
52
|
-
// Suppress yargs' default help-dump on failure; surface the concrete error
|
|
53
|
-
// message instead. The top-level .catch() prints it and sets exit code.
|
|
54
|
-
.fail((msg, err) => {
|
|
55
|
-
if (err)
|
|
56
|
-
throw err;
|
|
57
|
-
throw new Error(msg);
|
|
58
|
-
})
|
|
59
|
-
.parseAsync();
|
|
33
|
+
applyColorFlags(argv);
|
|
34
|
+
setMeta();
|
|
35
|
+
try {
|
|
36
|
+
await buildProgram({ runTests: runTestsHandler }).parseAsync(applyInputFlag(argv));
|
|
37
|
+
}
|
|
38
|
+
catch (err) {
|
|
39
|
+
// exitOverride makes commander throw on every terminating condition,
|
|
40
|
+
// including --help and --version. Commander has already written any message.
|
|
41
|
+
// process.exitCode, not process.exit(), so queued stderr writes still flush.
|
|
42
|
+
if (err instanceof CommanderError) {
|
|
43
|
+
// Commander exits 1 on usage errors. The contract's usage code is 2.
|
|
44
|
+
process.exitCode = err.exitCode === 0 ? 0 : 2;
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
throw err;
|
|
48
|
+
}
|
|
60
49
|
}
|
|
61
50
|
// Legacy "run tests" flow — unchanged behavior when no subcommand is given.
|
|
62
51
|
async function runTestsHandler(args) {
|
|
52
|
+
await loadProjectEnv(args);
|
|
53
|
+
await readStdinInputs(args);
|
|
63
54
|
// Get .doc-detective JSON or YAML config, if it exists, preferring a config arg if provided
|
|
64
55
|
const configPathJSON = path.resolve(process.cwd(), ".doc-detective.json");
|
|
65
56
|
const configPathYAML = path.resolve(process.cwd(), ".doc-detective.yaml");
|
|
@@ -77,57 +68,8 @@ async function runTestsHandler(args) {
|
|
|
77
68
|
: fs.existsSync(configPathYML)
|
|
78
69
|
? configPathYML
|
|
79
70
|
: null;
|
|
80
|
-
// Detect env-var debug intent before setConfig so we can still emit
|
|
81
|
-
// the diagnostic dump when validation fails. `isDebugRequested`
|
|
82
|
-
// reads `process.env.DOC_DETECTIVE_DEBUG`. Users who want diagnostic
|
|
83
|
-
// output on the CLI should prefer the dedicated `doc-detective
|
|
84
|
-
// debug` subcommand (which also supports `--include-env`); this
|
|
85
|
-
// env-var path stays as the CI-friendly trigger.
|
|
86
|
-
const debugRequested = isDebugRequested();
|
|
87
71
|
// Set config
|
|
88
|
-
|
|
89
|
-
try {
|
|
90
|
-
config = await setConfig({ configPath: configPath, args: args });
|
|
91
|
-
}
|
|
92
|
-
catch (err) {
|
|
93
|
-
if (debugRequested) {
|
|
94
|
-
// Build a minimal stub config so the dump can still render.
|
|
95
|
-
// `printDebug` tolerates undefined fields; the configError banner
|
|
96
|
-
// surfaces the underlying validation message.
|
|
97
|
-
const stubConfig = {
|
|
98
|
-
logLevel: typeof args.logLevel === "string" ? args.logLevel : "info",
|
|
99
|
-
input: typeof args.input === "string" ? args.input : ".",
|
|
100
|
-
};
|
|
101
|
-
await printDebug({
|
|
102
|
-
config: stubConfig,
|
|
103
|
-
configPath: configPath,
|
|
104
|
-
configError: err instanceof Error ? err : new Error(String(err)),
|
|
105
|
-
outDir: defaultDebugDir(),
|
|
106
|
-
args,
|
|
107
|
-
});
|
|
108
|
-
// The env-var dump replaced a real test run; a broken config must
|
|
109
|
-
// still fail the process so CI doesn't go green on an unran suite.
|
|
110
|
-
process.exitCode = 1;
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
throw err;
|
|
114
|
-
}
|
|
115
|
-
// Diagnostic dump — fires when DOC_DETECTIVE_DEBUG is truthy. The
|
|
116
|
-
// env-var path intentionally does NOT enable --include-env; users
|
|
117
|
-
// who want the full process.env must run `doc-detective debug
|
|
118
|
-
// --include-env` explicitly. (There is no config-file equivalent —
|
|
119
|
-
// the `debug` config field is deprecated and ignored; diagnostics live
|
|
120
|
-
// behind this env var and the `debug` subcommand.)
|
|
121
|
-
if (debugRequested) {
|
|
122
|
-
await printDebug({
|
|
123
|
-
config,
|
|
124
|
-
configPath,
|
|
125
|
-
configError: null,
|
|
126
|
-
outDir: defaultDebugDir(),
|
|
127
|
-
args,
|
|
128
|
-
});
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
72
|
+
const config = await setConfig({ configPath: configPath, args: args });
|
|
131
73
|
// Guard the pretty-print dumps behind a cheap level check so the (large)
|
|
132
74
|
// JSON.stringify only runs when the debug message would actually print.
|
|
133
75
|
if (logLevelEnabled("debug", config)) {
|
|
@@ -204,14 +146,23 @@ async function runTestsHandler(args) {
|
|
|
204
146
|
const resolvedTests = api?.resolvedTests || null;
|
|
205
147
|
const apiConfig = api?.apiConfig || null;
|
|
206
148
|
// Run tests
|
|
207
|
-
|
|
208
|
-
const
|
|
209
|
-
? await
|
|
210
|
-
:
|
|
149
|
+
// Progress is for people, so it follows the same switch as other info output.
|
|
150
|
+
const stopProgress = logLevelEnabled("info", config)
|
|
151
|
+
? await showRunProgress(runProgress)
|
|
152
|
+
: () => { };
|
|
153
|
+
const strictSpecs = config.exitOnFail !== false;
|
|
154
|
+
const results = await (resolvedTests
|
|
155
|
+
? runTests(config, { resolvedTests, updateJoin, strictSpecs })
|
|
156
|
+
: runTests(config, { updateJoin, strictSpecs })).finally(stopProgress);
|
|
211
157
|
// Dry-run already emitted the resolved-tests JSON inside runTests().
|
|
212
158
|
// Skip both reporters (which assume executed-result shape) and the
|
|
213
159
|
// orchestration-API report-back path.
|
|
214
160
|
if (config.dryRun) {
|
|
161
|
+
if (!results && config.exitOnFail !== false) {
|
|
162
|
+
// Dry runs silence logs to keep stdout clean, so say why there's no plan.
|
|
163
|
+
console.error("No tests found, so there's no test plan to print.");
|
|
164
|
+
process.exitCode = 2;
|
|
165
|
+
}
|
|
215
166
|
return;
|
|
216
167
|
}
|
|
217
168
|
// c8 ignore justification for the `apiConfig` branch body below: reachable
|
|
@@ -233,18 +184,27 @@ async function runTestsHandler(args) {
|
|
|
233
184
|
else {
|
|
234
185
|
// Output results — config.reporters (populated from args.reporters by
|
|
235
186
|
// setConfig) is the source of truth for which reporters run.
|
|
236
|
-
await outputResults(config,
|
|
187
|
+
await outputResults(config, config.outputDir, results, { command: "runTests" });
|
|
188
|
+
writeResultsFile(config.output, results);
|
|
237
189
|
// Optionally print one contextual hint after the reporters finish.
|
|
238
190
|
// Wrapped in its own try/catch internally — never throws.
|
|
239
191
|
await maybeShowHint(config, results);
|
|
240
192
|
}
|
|
241
|
-
//
|
|
242
|
-
//
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
193
|
+
// Last on stdout, so it's what a person reads first. Modes that make stdout
|
|
194
|
+
// machine-readable, and -l silent, leave it out.
|
|
195
|
+
if (!args.json && !args.plain && args.output !== "-" && config.logLevel !== "silent") {
|
|
196
|
+
console.log(verdictLine(results));
|
|
197
|
+
}
|
|
198
|
+
// A bare command in the wrong folder is the likeliest first-run mistake.
|
|
199
|
+
const testCounts = Object.values(results?.summary?.tests ?? {});
|
|
200
|
+
const nothingRan = testCounts.every((count) => count === 0);
|
|
201
|
+
if (nothingRan && !args.input && !args.inputs?.length && logLevelEnabled("info", config)) {
|
|
202
|
+
diag("No tests found here. Point at your docs with `doc-detective -i <path>`, or see `doc-detective --help`.");
|
|
203
|
+
}
|
|
204
|
+
// Results are written before the exit code is set (ADR 01146). The guard
|
|
205
|
+
// preserves any non-zero code an earlier stage already set.
|
|
206
|
+
if (!process.exitCode) {
|
|
207
|
+
process.exitCode = runExitCode(results, config);
|
|
248
208
|
}
|
|
249
209
|
// Join the telemetry flush started inside runTests. Awaited only NOW — after
|
|
250
210
|
// reporters + hint — so the PostHog round-trip overlaps that I/O instead of
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAA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AAE,EAAE,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC;IAC5D,IAAI,UAAU,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,IAAI,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;QACzF,IAAI,CAAC,wGAAwG,CAAC,CAAC;IACjH,CAAC;IAED,yEAAyE;IACzE,4DAA4D;IAC5D,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;QACtB,OAAO,CAAC,QAAQ,GAAG,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAClD,CAAC;IAED,6EAA6E;IAC7E,4EAA4E;IAC5E,4EAA4E;IAC5E,4CAA4C;IAC5C,MAAM,mBAAmB,EAAE,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
export declare function applyHelpText(command: Command): void;
|
|
3
|
+
export declare function nearestCommand(word: string, names: string[]): string | undefined;
|
|
4
|
+
export declare function rewriteRootError(message: string, commandNames: string[]): string;
|
|
5
|
+
//# sourceMappingURL=cliHelp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cliHelp.d.ts","sourceRoot":"","sources":["../src/cliHelp.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAiLzC,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,QAiB7C;AAgBD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAWhF;AAID,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,MAAM,CAOhF"}
|