Repository navigation
refactor(cli): project Apple bundle commands onto a declared session target - #10656
Merged
morluto merged 1 commit intoNov 15, 2026
Conversation
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 PR appears safe to merge; no actionable issues were found. SummaryMoves four Apple commands to shared contract-based registration.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[CLI arguments] --> B[Shared command registration]
B --> C[Target path as typed]
B --> D[Contract options and defaults]
C --> E[Open target and run operation]
D --> E
E --> F[Await cleanup]
F --> G[Evidence or error]
G --> H[Rename input issue fields for CLI]
Reviews (1) · Last reviewed commit: "refactor(cli): project Apple bundle comm..." · Reviewed by Greptile |
morluto
force-pushed
the
refactor/cli-contract-path-lists-flattened
branch
from
November 14, 2026 20:10
5ae577b to
886a42d
Compare
morluto
force-pushed
the
refactor/cli-contract-session-target
branch
from
November 14, 2026 20:10
73dec66 to
bca9646
Compare
This was referenced Nov 14, 2026
morluto
force-pushed
the
refactor/cli-contract-path-lists-flattened
branch
from
November 14, 2026 20:33
886a42d to
15423d9
Compare
morluto
force-pushed
the
refactor/cli-contract-session-target
branch
from
November 14, 2026 20:33
bca9646 to
7092a1f
Compare
Merged
19 tasks
morluto
force-pushed
the
refactor/cli-contract-session-target
branch
from
November 15, 2026 01:45
7092a1f to
e21b171
Compare
morluto
force-pushed
the
refactor/cli-contract-path-lists-flattened
branch
2 times, most recently
from
November 15, 2026 05:58
96f5467 to
70dd410
Compare
morluto
force-pushed
the
refactor/cli-contract-session-target
branch
from
November 15, 2026 05:58
e21b171 to
d85f894
Compare
morluto
force-pushed
the
refactor/cli-contract-path-lists-flattened
branch
from
November 15, 2026 07:34
70dd410 to
6d01705
Compare
morluto
force-pushed
the
refactor/cli-contract-session-target
branch
from
November 15, 2026 07:34
d85f894 to
af4cad5
Compare
morluto
force-pushed
the
refactor/cli-contract-path-lists-flattened
branch
from
November 15, 2026 08:48
6d01705 to
cc1f1b2
Compare
…target Session-scoped operations take their target from the MCP session, so the CLI's target positional is not a contract field. The contract command description declares a session target: the CLI takes it as the first positional, opens it through runProviderAnalysis as the hand-written commands did, and passes the rest of the contract input. Input issues reported after argv parsing name renamed fields by their CLI key. inspect-keyed-archive, trace-dylib-resolution, inspect-asset-catalog and decode-interface-builder are the pilot; trace-dylib-resolution --root now admits only the roots its contract admits.
morluto
force-pushed
the
refactor/cli-contract-session-target
branch
from
November 15, 2026 09:34
af4cad5 to
edbf64e
Compare
morluto
force-pushed
the
refactor/cli-contract-path-lists-flattened
branch
from
November 15, 2026 09:34
cc1f1b2 to
1fbcfd3
Compare
morluto
added a commit
that referenced
this pull request
Nov 15, 2026
…ir contracts (#10648) * refactor(cli): project WASM inspection and firmware commands from their contracts The contract command description gains lists of caller paths and optional object fields flattened into one option per member. inspect-wasm-artifact, inspect-firmware-regions and extract-firmware are derived from their contracts. extract-firmware now records the caller's output_directory spelling in Evidence, like every other caller-path field. * refactor(cli): project Apple bundle commands onto a declared session target (#10656) Session-scoped operations take their target from the MCP session, so the CLI's target positional is not a contract field. The contract command description declares a session target: the CLI takes it as the first positional, opens it through runProviderAnalysis as the hand-written commands did, and passes the rest of the contract input. Input issues reported after argv parsing name renamed fields by their CLI key. inspect-keyed-archive, trace-dylib-resolution, inspect-asset-catalog and decode-interface-builder are the pilot; trace-dylib-resolution --root now admits only the roots its contract admits.
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
Tenth slice of plan W1, stacked on #10648 (base
refactor/cli-contract-path-lists-flattened; retarget as the lower PRs merge). Refs #10583.This PR designs a declared session-target projection and pilots it on the Apple bundle resource family:
inspect-keyed-archive,trace-dylib-resolution,inspect-asset-cataloganddecode-interface-builder.Problem and expected behavior
About 45 CLI commands (source count of
runProviderAnalysisandrunDirectAnalysisregistrations) run tools whose MCP contract takes the target from the session. These include the artifact, utility, core binary and core native families, plus managed commands. The CLI's positionalpathis therefore not a contract field. Every such command hand-writes all its options and its input mapping, so it cannot use the contract command description. Some of those options validate less than the contract;trace-dylib-resolution --rootaccepted any string.Expected: the command is described from the contract, with the target declared as CLI-only. The CLI opens the target the same way the hand-written command did, then runs the operation with the rest of the contract input.
Design: declared session target
sessionTarget: { description }declares that the operation runs on a target an MCP session would hold open.path. It is a nonempty, NUL-free local path, admitted like other caller paths, and is never a contract field. A contract field also keyedpathmust be renamed, or registration fails (keyed archive renames its relativepathtoarchive, as before).sessionTargetcarries the positional key and schema.parameters,toContractInputandcallerInputsnever see it, so the contract input is exactly the session operation's input.runOnSessionTarget(runProviderAnalysis, logger)passes it torunProviderAnalysis, the path every hand-written artifact, utility and managed command uses, with the contract name, the contract input and the command's cancellation signal.inputBinding(contract field → CLI key for renamed fields). The runner gives it toprojectCliAnalysisResult, so analysis-time input issues name the CLI key. This generalizes the keyed archive's hand-written{ path: "archive" }binding.coreBinaryCommandsandcoreNativeCommandsopen the target withrunDirectAnalysisplus open options (provider, format hint, architecture, entry point, snapshot) that MCP takes fromopen_binary. The next slice declares those assessionTarget.open, projected from the opening contract's own fields, and adds arunDirectAnalysisrunner. Operation fields still come from the operation contract.Change and scope
contractCliDescription.ts:sessionTargetandinputBinding. The target key takes part in the CLI-key collision check.contractCommand.ts:sessionTargetandinputBinding.runOnSessionTarget.artifactCommands.ts: the four hand-written commands, their register functions and the keyed-archive binding are replaced byregisterAppleBundleCommands.decode-interface-builderomitsdetailwith a reason, because the hand-written command never exposed it.inputBindingnames every renamed field.pathis refused.inspect-artifactandextract-artifact: ESP flash target selection and the extraction destination.openextension above.Contract and boundary impact
--schema: semantically identical for keyed archive, asset catalog and interface builder.trace-dylib-resolution --rootnow advertises its contract's root syntax andminItems.trace-dylib-resolution --root ../outsideis refused at argv parsing (VALIDATION_ERROR,root.0, the contract's own message) instead of by the analysis.rootinstead ofroots.runProviderAnalysiscall.npm run docs:checkpasses).Expected effects:
(No effect changes.)
Evidence and regression coverage
dylibResolutionCli: the escaping root now expects the argv refusal, and analysis-time root issues expectroot.--schema --format json,--helpand 21 argv runs before and after throughcreateCli().serve.trace-dylib-resolution /bin/ls --architecture arm64,inspect-asset-catalog,decode-interface-builderandinspect-keyed-archiveon/System/Applications/Calculator.app.trace-dylib-resolution /bin/ls --root ../../x, changed as described above.--schema: equal excepttrace-dylib-resolution'sroot.openextension for core commands is designed here but not implemented.Validation performed
npm run check:fast: passed.npm run knip: no findings.npm run docs:check: passed.npm run test:focused -- tests/boundary/cli/cliContractCommandParity.test.ts: 254 passed.npm run test:focused --18 keyed-archive, dylib, asset-catalog, interface-builder, bundle-resource and CLI-admission test files:dylibResolutionClifailed on the two expectations above. After updating it, that file passed (20 passed, 1 skipped); the other 17 files passed.Compatibility, safety, and release
Author readiness
Human owner:
Before merge
type(scope): outcome.