Skip to content

refactor(cli): project decompile-all from its contract onto a native session target - #10778

Merged
morluto merged 2 commits into
fix/selector-contracts-refuse-emptyfrom
refactor/cli-contract-decompile-directory
Nov 15, 2026
Merged

morluto merged 2 commits into
fix/selector-contracts-refuse-emptyfrom
refactor/cli-contract-decompile-directory

Conversation

@morluto

@morluto morluto commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

Part of plan W1 (CLI commands derived from their contracts). rea decompile-all re-declared every decompile_all input field by hand (11 options plus a field-by-field argument mapper). It now registers through registerContractCommand with a native session target, so its options, help and --schema come from the contract.

Refs #10583

This branch also carries #10784 (collapsed into it): six native utility commands are projected from their contracts, required runtime-JSON options are supported, and the shared JSON-option refusal now includes expected: "JSON". See #10784 for its scope, the inspect-plist exclusion and its validation.

Problem and expected behavior

The hand-written options duplicated the contract's fields with separate descriptions and a separate mapping, so contract changes had to be repeated in the CLI, and the command did not run under the shared command cancellation. Expected: one definition (the contract) drives both MCP and CLI admission.

Change and scope

  • src/cli/decompileDirectoryCommand.ts: replaced the hand-built cli.command and decompileAllArguments with a registerContractCommand projection: path session target via nativeTarget (snapshot, target format, architecture, entry point, provider), output_directory as caller path --output. Every other option is derived from the contract.
  • The command now uses the shared runDirectOnTarget handler, which runs under withCommandCancellation and binds input errors to CLI keys.
  • decompile-all joins the parity test's migrated list; the session-target parity case now checks that the target is never a caller input, rather than that a session-target command has no caller paths at all.

Not included: analyze, utility, managed and remaining families (later W1 PRs).

Contract and boundary impact

  • Semantic owner and earliest changed stage: the decompile_all contract (decompileDirectoryInputSchema) now owns CLI admission; the CLI's copied option shape and mapper are removed.
  • Contribution scope fit and linked maintainer decision: not applicable (refactor within existing boundaries).
  • CLI and MCP/tool-catalog contract: same flags and defaults. Help text for each option is now the contract's description (except --output and --snapshot, which keep CLI wording). MCP unchanged.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: unchanged; output_directory is still recorded resolved, as before.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): same target opening options; cancellation now goes through the shared command cancellation.
  • Generated metadata (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.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: tests/boundary/cli/cliContractCommandParity.test.ts (decompile-all in the migrated list, so every parity case covers it; session-target case generalized).
  • Base reproduction or other evidence: existing decompileAllCli.test.ts (relative --output, filters, --limit, resume against fake Kuna) passes unchanged through the new path.
  • User-visible CLI/MCP output (if applicable): rea decompile-all --help lists the same options (--output, --layout, --resume, --retry-failed, --name, --namespace, --address-start, --address-end, --limit, --snapshot, --target-format, --architecture, --entry-point, --provider) with contract descriptions.
  • Remaining proof gaps: no real-provider run.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npm run test:focused -- tests/boundary/cli/cliContractCommandParity.test.ts tests/boundary/cli/decompileAllCli.test.ts tests/boundary/cli/overnightBatch1CliSchemas.test.ts tests/boundary/cli/cliDecimalArguments.test.ts tests/acceptance/localPathAdmissionCli.test.ts — 535 passed, 1 failed (the session-target parity case, generalized as described)
  • npm run test:focused -- tests/boundary/cli/cliContractCommandParity.test.ts tests/boundary/cli/decompileAllCli.test.ts after the fix — 514 passed
  • npm run check:fast — passed
  • npm run docs:check — passed
  • node scripts/rea.mjs decompile-all --help — options as listed above

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: none (fake Kuna only).
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: none.

Author readiness

Human owner:

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T06:01:09.693736Z 2b33228 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Medium impact] The reviewed changes appear safe to merge, with no actionable new issues found.

Summary

Moves decompile-all and six native utility commands onto shared contract-driven registration.

  • The decompile-all command takes its options from the decompile_all contract.
  • Native UI commands take their input fields from their tool contracts.
  • Native inspection commands get their CLI inputs from their tool contracts.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[CLI arguments] --> B[Contract-derived options]
  B --> C[Decode JSON and check input]
  C --> D[Shared cancellation]
  D --> E[Open selected target]
  E --> F[Run operation]
  F --> G[Await cleanup]
  G --> H[Return Evidence or error]
Loading

Reviews (3) · Last reviewed commit: "refactor(cli): project native Mach-O, Sw..." · Reviewed by Greptile

@morluto
morluto force-pushed the fix/selector-contracts-refuse-empty branch from 175d82a to 2720e58 Compare November 15, 2026 05:58
@morluto
morluto force-pushed the refactor/cli-contract-decompile-directory branch from df32573 to 2b33228 Compare November 15, 2026 05:58
@morluto
morluto merged commit de7d5ad into fix/selector-contracts-refuse-empty Nov 15, 2026
@morluto
morluto deleted the refactor/cli-contract-decompile-directory branch November 15, 2026 06:06
morluto added a commit that referenced this pull request Nov 15, 2026
…session target (#10778)

* refactor(cli): project decompile-all from its contract onto a native session target

* refactor(cli): project native Mach-O, Swift and native UI commands from their contracts
morluto added a commit that referenced this pull request Nov 15, 2026
…ontracts (#10753)

* fix(contracts): refuse empty address and procedure selectors in the contracts

* refactor(cli): project decompile from its contract with --file-offset as an alternative selector (#10756)

* refactor(cli): project search from its contracts with --kind choosing the operation (#10761)

* refactor(cli): project search from its contracts with --kind choosing the operation

* fix(cli): check operation choices' option rules and bind errors to the selected contract

* test(cli): group operation-choice checks in their own block

* refactor(cli): project decompile-all from its contract onto a native session target (#10778)

* refactor(cli): project decompile-all from its contract onto a native session target

* refactor(cli): project native Mach-O, Swift and native UI commands from their contracts

* fix(cli): read search, decompile-all and native utility contracts from their groups so startup stays lazy

* test(cli): drop the empty-selector admission mismatches the contracts now refuse
@morluto morluto added the area: cli CLI adapter and one-shot commands label Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli CLI adapter and one-shot commands

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant