Repository navigation
refactor(cli): project native Mach-O, Swift and native UI commands from their contracts - #10784
Merged
morluto merged 1 commit intoNov 15, 2026
Conversation
…om their contracts
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Contributor
[Medium impact] The reviewed changes appear safe to merge. SummarySix native utility commands now derive their CLI fields from contracts and use the shared session-target handler.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Native tool contracts] --> B[CLI arguments and options]
B --> C[Decode scenario steps]
C --> D[Check decoded request]
D --> E[Shared command cancellation]
E --> F[Run on selected target]
F --> G[Await cleanup and return Evidence]
Reviews (2) · Last reviewed commit: "refactor(cli): project native Mach-O, Sw..." · Reviewed by Greptile |
morluto
merged commit Nov 15, 2026
df32573
into
refactor/cli-contract-decompile-directory
1 check passed
22 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Part of plan W1 (CLI commands derived from their contracts). Six utility commands (
inspect-macho,inspect-signature,list-architectures,demangle-swift,observe-native-ui,capture-native-ui-scenario) re-declared their contract fields by hand. They now register throughregisterContractCommandon a session target with the sharedrunOnSessionTargethandler, so options, help and--schemacome from the contracts.Refs #10583
Problem and expected behavior
Each command repeated its contract's fields (decimal wrappers, renames, a per-command mapper), and
capture-native-ui-scenariohad its own JSON decoding and error wrapper for--steps. Expected: one definition (the contract) drives both MCP and CLI admission, with shared JSON decoding.Change and scope
src/cli/utilityCommands.ts: the six commands are contract projections; the native UI scope mapper, the scenario's JSON decoding andinvalidNativeUiScenarioInputare removed.--stepsis a runtime-JSON field.src/cli/contractCliDescription.ts: a runtime-JSON field the contract requires is now a required option (it previously refused to register). The parity test checks that the option is required exactly when the contract field is.src/cli/cliJsonOption.ts: the shared JSON-option refusal now carriesexpected: "JSON", as the other JSON-format producers (cliJsonInput,JsonInputFile, browser commands, the removed scenario copy) do. This adds a field to existing refusals from runtime-JSON options; messages are unchanged.inspect-machoomits the contract'sdetail(the CLI returns complete Evidence, as before).Intentionally not included:
inspect-plistkeeps its hand-written option. Its contract'spathfield is the CLI's--relative-path, butNativePlistSource.unreadablePlistreports a plist that the target itself selects (nopathgiven) under the same["path"]issue path. With the rename, that case would namerelativePath, which the caller never supplied. The producer needs to report the target separately first (proposed follow-up).capabilities/providers(no contract input) andimport-reference-source(W1 item 4, raw.meta()).Contract and boundary impact
--pid,--window-id,--max-nodes,--steps,demangle-swiftsymbols). Malformed--stepsJSON is stillinvalid_requestat["steps"],reason: invalid_format,expected: "JSON", and now has the shared messagesteps must be valid JSON. MCP unchanged.registerContractCommand.docs/public/product-catalog.json), package, or installation impact: none.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
Evidence and regression coverage
tests/boundary/cli/cliContractCommandParity.test.ts: the six commands are in the migrated list, so every parity case covers them. The runtime-JSON case now checks required-ness against the contract, and the argv-mapping case decodes runtime JSON as admission does.rea capture-native-ui-scenario --helplists--pid,--window-id,--screenshot,--accessibility,--max-nodes,--native-ui-deadline-msand--steps, as before.For evidence-bearing changes:
Validation performed
npm run test:focused --33 files (cliContractCommandParity, the native Mach-O/plist/signature/demangle/UI-scenario CLI suites, cliInputSchemaRequired, emptyLocalTargetAdmission, cliOptionAliases, utilityIntegerOptions, the app-bundle and Mach-O acceptance suites, nativeDeadlineFlags, androidPackageViewCli, apktoolCli, projectCliAnalysisResult, cliDomainFieldSchema): 734 passed, 1 skipped. An earlier run, withinspect-plistmigrated, failed 12 tests: the plist selection-failure cases described above, two parity cases since fixed, and the scenarioexpected: "JSON"case.npm run check:fast: passed.node scripts/rea.mjs capture-native-ui-scenario --help: output as described above.Compatibility, safety, and release
expected: "JSON"issue field (additive).Author readiness
Human owner:
Before merge
type(scope): outcome.