Repository navigation
refactor(cli): project inspect, xrefs, trace, function and instructions from their contracts - #10747
Merged
morluto merged 1 commit intoNov 15, 2026
Conversation
…ns from their contracts The five core binary commands are derived from their contracts on the native session target with the snapshot option, using named selector options for the procedure, address and query. A selector projection may require a selector the contract lets the MCP caller omit: xrefs' address defaults to Hopper's cursor, which a one-shot CLI command does not have. A selector names one object, so neither spelling may be empty, as before, even where the contract's text admits it. open_binary's pairing rules now refuse an unpaired --target-format, --architecture or --entry-point for inspect before the target is opened, naming the CLI key.
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. SummaryMoves
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[CLI arguments and options] --> B[Contract-based registration]
B --> C[Check selector and delivery choices]
C --> D[Check native opening choices]
D --> E[Open target and run direct analysis]
E --> F[Await provider cleanup]
F --> G{Evidence delivery requested?}
G -->|No| H[Return analysis result]
G -->|Yes| I[Return complete Evidence or save bundle and summary]
Reviews (1) · Last reviewed commit: "refactor(cli): project inspect, xrefs, t..." · Reviewed by Greptile |
22 tasks
morluto
merged commit Nov 15, 2026
3bebed9
into
refactor/cli-contract-selector-options
1 check passed
22 tasks
morluto
added a commit
that referenced
this pull request
Nov 15, 2026
…ns from their contracts (#10747) The five core binary commands are derived from their contracts on the native session target with the snapshot option, using named selector options for the procedure, address and query. A selector projection may require a selector the contract lets the MCP caller omit: xrefs' address defaults to Hopper's cursor, which a one-shot CLI command does not have. A selector names one object, so neither spelling may be empty, as before, even where the contract's text admits it. open_binary's pairing rules now refuse an unpaired --target-format, --architecture or --entry-point for inspect before the target is opened, naming the CLI key.
morluto
added a commit
that referenced
this pull request
Nov 15, 2026
…ns from their contracts (#10747) The five core binary commands are derived from their contracts on the native session target with the snapshot option, using named selector options for the procedure, address and query. A selector projection may require a selector the contract lets the MCP caller omit: xrefs' address defaults to Hopper's cursor, which a one-shot CLI command does not have. A selector names one object, so neither spelling may be empty, as before, even where the contract's text admits it. open_binary's pairing rules now refuse an unpaired --target-format, --architecture or --entry-point for inspect before the target is opened, naming the CLI key.
morluto
added a commit
that referenced
this pull request
Nov 15, 2026
…th named selector options (#10738) * refactor(cli): project procedure-references and inspect-native-api with named selector options A contract projection may let the caller give a positional selector with a named option instead, for values that begin with a dash. The positional becomes optional; equal values agree (native addresses by identity), and different values, or neither for a required field, are refused before the target is opened. selectCliAnalysisSelector owns that rule and returns a Result; resolveCliAnalysisSelector remains for the hand-written core binary commands. procedure-references and inspect-native-api are now derived from their contracts on the native session target, which completes the core native family. * fix(cli): refuse empty named and positional selectors before opening the target * refactor(cli): project inspect, xrefs, trace, function and instructions from their contracts (#10747) The five core binary commands are derived from their contracts on the native session target with the snapshot option, using named selector options for the procedure, address and query. A selector projection may require a selector the contract lets the MCP caller omit: xrefs' address defaults to Hopper's cursor, which a one-shot CLI command does not have. A selector names one object, so neither spelling may be empty, as before, even where the contract's text admits it. open_binary's pairing rules now refuse an unpaired --target-format, --architecture or --entry-point for inspect before the target is opened, naming the CLI key. * fix(cli): read core binary contracts from their contract groups so startup stays lazy
morluto
added a commit
that referenced
this pull request
Nov 15, 2026
…ptions (#10736) * refactor(cli): project core native commands with open_binary target options A session target's opening fields may now be caller paths, admitted resolved and passed on as the caller spelled them, and a union of text forms such as the provider selector renders as one argv token. nativeTarget declares a native executable opened with open_binary's format, architecture, entry point and provider fields, plus the snapshot where a command loads one. runDirectOnTarget runs an operation on that target through runDirectAnalysis, with Evidence delivery when declared. Eleven core native commands are now derived from their contracts. Their inputs are admitted by the service's contract parse, which replaces the CLI's copies of the byte-pattern and data-type selector checks. inspect-native-dispatch-metadata now exposes the contract's Objective-C class import address fields. * fix(cli): read core native contracts from their contract groups so startup stays lazy * refactor(cli): project procedure-references and inspect-native-api with named selector options (#10738) * refactor(cli): project procedure-references and inspect-native-api with named selector options A contract projection may let the caller give a positional selector with a named option instead, for values that begin with a dash. The positional becomes optional; equal values agree (native addresses by identity), and different values, or neither for a required field, are refused before the target is opened. selectCliAnalysisSelector owns that rule and returns a Result; resolveCliAnalysisSelector remains for the hand-written core binary commands. procedure-references and inspect-native-api are now derived from their contracts on the native session target, which completes the core native family. * fix(cli): refuse empty named and positional selectors before opening the target * refactor(cli): project inspect, xrefs, trace, function and instructions from their contracts (#10747) The five core binary commands are derived from their contracts on the native session target with the snapshot option, using named selector options for the procedure, address and query. A selector projection may require a selector the contract lets the MCP caller omit: xrefs' address defaults to Hopper's cursor, which a one-shot CLI command does not have. A selector names one object, so neither spelling may be empty, as before, even where the contract's text admits it. open_binary's pairing rules now refuse an unpaired --target-format, --architecture or --entry-point for inspect before the target is opened, naming the CLI key. * fix(cli): read core binary contracts from their contract groups so startup stays lazy
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
Next slice of plan W1, stacked on #10738 (base
refactor/cli-contract-selector-options; retarget as the lower PRs merge). Refs #10583.inspect,xrefs,trace,functionandinstructionsare now derived from their contracts (binary_overview,xrefs,trace_feature,analyze_function,read_function_instructions). They use the native session target from #10736 and the named selector options from #10738.Problem and expected behavior
The five commands were hand-written. Each re-declared its contract fields, the native open flags and the selector option, and built the contract input itself.
traceandfunctionheld their own copies of the summary-delivery preflight.Expected behavior: the same arguments, options, defaults and help. Missing, empty and conflicting selectors are still refused before the target is opened.
Change and scope
contractCliDescription.ts:requiredwhen the command needs a selector the contract lets callers omit.xrefs' contractaddressis optional because Hopper falls back to its cursor; a one-shot CLI command has no cursor.""(xrefs.address,read_function_instructions.procedure).coreBinaryCommands.ts:nativeTarget(..., true), which includes--snapshot.functionandinstructionstake the procedure positionally ([address]) or as--procedure.xrefstakes[address]or--address.tracetakes[query]or--query.traceandfunctionkeep Evidence delivery. The CLI--detaildefault stayscomplete;analyze_function's MCP default issummary.documentfield is omitted.analyze, which routes JavaScript targets to another lane.decompile, which has a third selector,--file-offset.search, where--kindselects between two contracts.decompile-directory, and the utility and managed families.Contribution scope: not applicable. Target selection and authority are unchanged.
Contract and boundary impact
open_binaryowns the pairing rules for the target interpretation. Removed: five hand-written commands and two copies of the delivery preflight.--target-format raw-binary/gamecube-dolwith--architectureor--entry-pointis now refused byopen_binary's input schema before the target is opened, asinvalid_requestwithdetails.issues[].pathnaming the CLI key (architecture). The message text is unchanged. Before, the target resolver refused it withdetails.reason. refactor(cli): project core native commands with open_binary target options #10736's commands behave the same way.inspect,xrefsandinstructionsnow run under the command's cancellation signal. Otherwise unchanged.Expected effects (unchanged from the existing commands; left for the human owner to check):
Evidence and regression coverage
cliContractCommandParity.test.ts:required. Forxrefs, that checks the CLI-only requirement.""to be refused.rawBinaryCli.test.ts: the GameCube-with-architecture and raw-binary-without-architecture refusals now assert the issue path and message, notdetails.reason.cliInputSchemaRequired.test.ts: selector discovery in schema, help and the LLM manifest, including that empty values are refused forxrefsandinstructions.analysisSelectorCli.test.ts: missing, conflicting and dash-leading selectors through the real CLI.analyzeFunctionDetail,nativeFeatureTraceDelivery,commandEvidenceDelivery,procedureAliasSearchCli,directAnalysisSnapshotReplay,localToolContracts,completionsand others listed below.cliInputSchemaRequiredfailed forxrefsandinstructionsuntil empty selectors were refused, which caught the contract's weaker text rule.coreBinaryCommands.tswas rendered with incur from refactor(cli): project inspect-artifact and extract-artifact with open_binary target options #10722's tree and this branch and diffed: only option order differs.For evidence-bearing changes:
Validation performed
npm run test:focused -- tests/boundary/cli/cliContractCommandParity.test.ts tests/boundary/cli/cliInputSchemaRequired.test.ts tests/boundary/cli/rawBinaryCli.test.ts tests/boundary/cli/analysisSelectorCli.test.ts: 536 passed. Before the empty-selector rule and therawBinaryCliupdate, 4 failed: 2 incliInputSchemaRequiredand 2 inrawBinaryCli.npm run test:focused --with 18 files (analyzeFunctionDetail,markdownArgumentErrors,commandEvidenceDelivery,nativeFeatureTraceDelivery,emptyLocalTargetAdmission,overnightBatch1CliSchemas,javascriptIntegrityPolicyCli,cliWorkerCompletion,completions,cliEvidenceCallerPath,cliLogLevelConfiguration,procedureAliasSearchCli,filesystem/directAnalysisSnapshotReplay,acceptance/tools/localToolContracts,procedureReferencesDelivery,acceptance/applications/erlangBeamViews,process-global/pwntoolsCliFinalization,process-global/setupPolicySnapshot): 178 passed, 2 skipped.npm run check:fast: passed.npm run knip: no findings.npx oxfmt --check src/cli tests/boundary/cli: clean.Compatibility, safety, and release
issuesinstead ofreason) of the unpaired target-interpretation refusal change.Author readiness
Human owner:
Before merge
type(scope): outcome.