fix(cli): advertise domain constraints for selector and path options (#9181)

* fix(cli): advertise domain constraints for selector and path options

Android class, method, and mapping fields, ADB setting keys, and browser
endpoints used bare strings in --schema. They now reuse the domain fields,
so empty selectors, relative mapping paths, and malformed setting keys
fail in the advertised schema.

* fix(cli): keep selector limits when argument parsing rejects them

Empty browser and Electron selectors now fail in the CLI parser, so their
diagnostics are VALIDATION_ERROR with the one-character minimum. ADB
setting keys stay on the selector repair path, which restores maximum 256
and the identifier pattern.

* test(cli): assert empty-selector codes without frozen prose

Empty browser and Electron selectors still fail as VALIDATION_ERROR
too_small on the named field. The tests no longer copy Zod's sentence.

* test(cli): compare endpoint diagnostics with the domain schema

Browser and Inspector tests take custom issue text from the schema that
owns it, and empty capture comparison must name both missing inspection
fields.

* fix(cli): remove duplicate merged schema import

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
This commit is contained in:
morlutoandCursor Agent authored and GitHub committed 2026-11-07 16:17:09 +08:00
1 parent 562779bd71
commit b31fc5d5fb
13 files changed
+418 -125

No files matched your search

+10 -5
View File
@@ -7,6 +7,7 @@ import {
} from "../application/javascript/JavaScriptRuntimeObservationService.js";
import { createJavaScriptRuntimeObservationProvider } from "../composition/javascriptRuntimeObservation.js";
import { V8InspectorAdmission } from "../inspector/V8InspectorProvider.js";
import { cliDomainInput } from "./domainInput.js";
import { cliDecimalField } from "./options.js";
import { CLI_COMMANDS } from "../cliCommandNames.js";
import { logCliCommand } from "../cliLogging.js";
@@ -49,7 +50,9 @@ export const registerJavaScriptRuntimeObservationCommands = (
cli.command(CLI_COMMANDS.listJavaScriptRuntimeTargets, {
description: "List Node/Electron V8 Inspector targets",
args: z.object({
endpoint: z.string().describe("Literal-loopback Inspector endpoint"),
endpoint: cliDomainInput(
listJavaScriptRuntimeTargetsInputSchema.shape.inspector_endpoint,
).describe("Literal-loopback Inspector endpoint"),
}),
run: ({ args }) =>
withCommandCancellation((signal) =>
@@ -90,10 +93,12 @@ export const registerJavaScriptRuntimeObservationCommands = (
cli.command(CLI_COMMANDS.observeJavaScriptRuntime, {
description: "Passively observe one exact Node/Electron Inspector target",
args: z.object({
endpoint: z.string().describe("Literal-loopback Inspector endpoint"),
targetId: z
.string()
.describe("Target from list-javascript-runtime-targets"),
endpoint: cliDomainInput(
listJavaScriptRuntimeTargetsInputSchema.shape.inspector_endpoint,
).describe("Literal-loopback Inspector endpoint"),
targetId: observeJavaScriptRuntimeInputSchema.shape.target_id.describe(
"Target from list-javascript-runtime-targets",
),
}),
options: observeOptionsSchema,
run: ({ args, options }) =>