Repository navigation
refactor(contracts): register CLI and MCP tools by family id - #8051
Conversation
Walk the published tool-family list once for each adapter so a new family id must supply both a CLI registrar and an MCP registrar.
|
@gensokyo-dev @dandgabr Tool registration now walks the published family id list. CLI and MCP each have an exhaustive registrar map, so a new family id fails typecheck until both adapters register it. |
Codex Review SummaryThis 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. |
[Medium impact] The PR appears safe to merge; both previous findings are fixed and no new actionable issues were found. SummaryCLI and MCP now register tools through complete maps keyed by
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
CLI["createCli registrar map"] --> Walker["registerToolFamilies"]
MCP["createServer registrar map"] --> Walker
IDs["TOOL_FAMILY_IDS"] --> Walker
Walker --> Calls["Call each family registrar in published order"]
Reviews (2) · Last reviewed commit: "fix(cli): keep family registration off t..." · Reviewed by Greptile |
Walk family ids from the startup-safe list, and register the web script commands with the application family that owns their MCP contracts.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
…uidance Resolve conflicts in CapabilityInventory.ts, createServer.ts, and registerSessionTools.ts. Main's morluto#8532 made unavailable ProviderAvailability carry the owner's remediation next to its reason, which is the same provider-ownership rule this change threads through AndroidAnalysisPort.setupGuidance. The resolutions keep both: availability remediation is the primary source, provider setup guidance (with the pinned JAR URL and SHA-256) replaces the two hardcoded literals main added to the application and server layers, and the reason field keeps reporting the observation rather than the repair. Main's morluto#8051 moved session registration into a family callback that already supplies the availability probes, so the standalone block is dropped in favour of adding androidSetupGuidance to that callback. The IDA effects fixture added on main needs setupGuidance to satisfy the widened AndroidAnalysisPort contract.
Summary
CLI and MCP now register tools by walking the published family id list. Adding a family id requires a registrar on both adapters, and TypeScript rejects a missing one. The walker lives with the id list, so a fresh CLI process does not load every tool contract. Web script commands are registered with the application family on both adapters.
Problem and expected behavior
Tool registration was a hand-written sequence in
src/cli.tsandsrc/server/createServer.ts. A new family could be added to the catalog without either adapter registering it. Both adapters should register every published family, in that family's catalog order, while still registering the same commands and tools. CLI startup, including help and setup, should not load the contract tables just to walk the ids.export_web_scripts,trace_web_module_imports, andtrace_web_source_locationbelong to the application family in the catalog, so both adapters register them there.Change and scope
registerToolFamilieslives insrc/contracts/toolFamilyIds.tsand walksTOOL_FAMILY_IDS.createCliandcreateServereach pass aRecord<ToolFamilyId, Registrar>. Setup commands stay outside the list because they are host lifecycle commands, not a tool family. Enhanced MCP workflows stay with core CLI analysis, so that CLI registrar is empty. Session CLI registration ismatch-native-functions, whose contract is in the session family.Registration order now follows the published family list. The set of CLI commands and MCP tools is unchanged. Follow the contribution scope.
Ordinary refactor of existing registration. Not applicable.
Contract and boundary impact
TOOL_FAMILY_IDSowns family order. CLI and MCP consume it when they build the process. No provider or evidence producer changed.TOOL_FAMILY_IDS. Web script commands and tools are both application-family registrations.docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs andskills/; edit authored instructions in.agents/skills/reverse-engineer-anything/and never commit build outputs): noneExpected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
Evidence and regression coverage
src/contracts/toolFamilies.test.tsasserts registrar invocation followsTOOL_FAMILY_IDS.tests/boundary/cli/cliToolFamilyOwners.test.tsasserts the CLI imports only the id module and that the three web script commands are application-owned on both adapters, matchingtoolFamilyId.toolFamilies.tsand the browser-versus-application split for web script commands.tools/listorder can follow family order. Names are unchanged.tools/listindex order.For boundary fixes, identify the applicable boundary regressions
and lifecycle regressions
covered by the evidence above, and explain relevant gaps.
CLI command coverage and the MCP package catalog check the registered names. Lifecycle regressions are not applicable.
For evidence-bearing changes:
Validation performed
npm run format:check— all matched files use the correct formatnpm run check:fast— typecheck and lint succeedednpm run test:focused -- src/contracts/toolFamilies.test.ts tests/boundary/cli/cliToolFamilyOwners.test.ts tests/boundary/cli/cliToolCoverage.test.ts tests/boundary/cli/dispatcher.test.ts— 21 passedCompatibility, safety, and release
Author readiness
Human owner: @morluto
Before merge
type(scope): outcome.