Skip to content

refactor(contracts): own CLI command names, catalog identity and schema presentation in contracts - #11425

Merged
morluto merged 8 commits into
mainfrom
refactor/cli-command-names-contracts
Nov 15, 2026
Merged

morluto merged 8 commits into
mainfrom
refactor/cli-command-names-contracts

Conversation

@morluto

@morluto morluto commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

Moves src/cliCommandNames.ts to src/contracts/cliCommandNames.ts with git mv and specifier rewrites. The file holds cliCommandFor, which derives a contract's CLI command name from the contract name, and CLI_COMMANDS, the CLI commands that no contract names. It has no imports. Its own comment says the contract registry owns these names.

As a root-level file it sat in the adapters layer. That made three composition modules (apkSignature, evm, wasm) and catalogIdentity.ts import upward. The composition -> cliCommandNames.ts upward entry (3 imports) leaves the layer baseline.

This PR also carries #11435, which was folded into it. #11435 implements the decision on #11427:

  • catalogIdentity.ts, catalogDiscovery.ts and recordedCatalogDigests.ts move to src/contracts/catalog/.
  • serverIdentity.ts moves to src/process/ServerIdentity.ts.
  • The advertised MCP schema presentation (compact budgets and presentations, output profile names, advertisedToolPresentation) moves to src/contracts/mcpSchemaPresentation.ts. src/config keeps only the setting parsers.

With that, application -> catalogIdentity.ts (2), catalogDiscovery.ts (1) and serverIdentity.ts (1) also leave the baseline. See #11435 for its full description and validation.

Part of plan W9 (root-file adapter imports). Fixes #11427. Refs #11359.

Problem and expected behavior

Composition binds a few providers to their CLI command names, and the catalog identity digests the CLI command list. Both read src/cliCommandNames.ts, a root file that scripts/lib/module-layers.mjs places in the adapters layer, the outermost one. Expected: the command-name owner lives in the layer of the contract registry that names those commands, so composition and catalog code import inward.

Change and scope

  • Pure move: src/cliCommandNames.ts to src/contracts/cliCommandNames.ts, with 34 importers rewritten (CLI modules, composition, catalog identity and tests).
  • scripts/ci/scopes.mjs: the 8 lane globs that named the old path now name the new one.
  • scripts/lib/module-layers.mjs: the unit cliCommandNames.ts is removed from the adapters list, because src/contracts is already declared.
  • scripts/lib/module-layers.baseline.json: composition -> cliCommandNames.ts (3) is removed.

Not included:

Contract and boundary impact

  • Semantic owner and earliest changed stage: CLI command names. The owner moves from the root of src/ into src/contracts/, and the code is unchanged.
  • Contribution scope fit and linked maintainer decision: maintainer-approved W9 layering. No new capability.
  • CLI and MCP/tool-catalog contract: none. The names and the catalog digest inputs are unchanged.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: none. No script loads dist/cliCommandNames.js.

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: none. The rewritten tests (13 files) and tests/boundary/filesystem/ciChangeScope.test.ts run unchanged apart from specifiers.

  • Base reproduction or other evidence: node scripts/verify-module-boundaries.mjs reports composition -> cliCommandNames.ts: 0, baseline 3 after the move. That entry is removed.

  • User-visible CLI/MCP output (if applicable): none.

  • Remaining proof gaps: none known.

  • 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

Compatibility, safety, and release

  • Breaking changes or migration steps: none. This is an internal module.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: not applicable.

The squash is no longer a pure move, because it also carries #11435's presentation split and server-identity root fix. It will not be listed in .git-blame-ignore-revs.

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

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

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

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-15T19:42:11.908165Z
We couldn’t complete this review. Comment @codex review to try again.
052791f PR opened
ℹ️ 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@greptile-apps

greptile-apps Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Low impact] The PR appears safe to merge; no actionable issue was found.

Summary

Moves CLI names, catalog identity, and MCP schema presentation into contracts. Moves server identity into process and updates package-root lookup.

  • CLI command names now live with the contracts that define them.
  • Catalog discovery and identity now live beside the tool contracts.
  • MCP schema budgets and presentation choices now live with the contracts.
  • Server identity now lives in the process layer.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  Adapters["CLI and MCP adapters"] --> Catalog["contracts/catalog"]
  Adapters --> Presentation["contracts/mcpSchemaPresentation.ts"]
  Config["config: setting parsers"] --> Presentation
  Catalog --> Presentation
  Catalog --> Names["contracts/cliCommandNames.ts"]
  Composition["composition"] --> Names
  Application["application"] --> Catalog
  Application --> Identity["process/ServerIdentity.ts"]
Loading

Reviews (6) · Last reviewed commit: "refactor(contracts): import CLI command ..." · Reviewed by Greptile

…names-contracts

# Conflicts:
#	scripts/lib/module-layers.baseline.json
…ntity in process (#11435)

* refactor(contracts): move catalog identity into contracts and server identity into process

* refactor(contracts): own the advertised MCP schema presentation in contracts

* test(mcp): import the advertised presentation from contracts in toolSchemaValidity

* test(release): expect the catalog identity at its contracts path in the canary
…names-contracts

# Conflicts:
#	scripts/lib/module-layers.baseline.json
#	scripts/lib/module-layers.mjs
@morluto morluto changed the title refactor(contracts): move the CLI command name owner into src/contracts refactor(contracts): own CLI command names, catalog identity and schema presentation in contracts Nov 15, 2026
@morluto

morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

@greptileai please review the latest commit (103d02b). It now also carries #11435 (folded in).

@morluto
morluto merged commit 960a387 into main Nov 15, 2026
8 checks passed
@morluto
morluto deleted the refactor/cli-command-names-contracts branch November 15, 2026 21:31
Plastic-time added a commit to Plastic-time/rea that referenced this pull request Nov 16, 2026
Conflicts:
- src/contracts/toolEffects.ts: main morluto#11305 moved each tool's effect
  audit onto its contract. Take main's file; inspect_pe_rich_header now
  declares evidenceEffects through toolContractMetadata.
- src/cliCommandNames.ts: main morluto#11425 deleted it and derives CLI names
  from `cli: true` on the contract. Drop our entry, mark the contract
  `cli: true`, and stop passing `command` to registerContractCommand.
@morluto morluto added the area: domain Domain logic, errors, and pure functions label Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: domain Domain logic, errors, and pure functions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Design] Owner below application for the catalog identity, server identity and MCP startup policy root files

1 participant