feat(messenger): add generate-action-types CLI tool as subpath export#8264
Merged
cryptodev-2s merged 44 commits intomainfrom Apr 1, 2026
Merged
feat(messenger): add generate-action-types CLI tool as subpath export#8264cryptodev-2s merged 44 commits intomainfrom
generate-action-types CLI tool as subpath export#8264cryptodev-2s merged 44 commits intomainfrom
Conversation
@metamask/messenger-generate-action-types packagegenerate-action-types CLI tool as subpath export
Contributor
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
Extract `scripts/generate-method-action-types.ts` into a publishable CLI package so it can be reused across repositories. - Scaffold `@metamask/messenger-generate-action-types` with bin entry - Split script into modular source files (parse, generate, check, fix) - Use named TypeScript imports, optional ESLint peer dependency - Update 44 consuming packages to use the new binary - Update package template, CODEOWNERS, teams.json, eslint config - Add ESLint config exception for Node.js module imports - Regenerate all action type files with updated header - Delete old `scripts/generate-method-action-types.ts`
The binary requires a build step before it can be used. Using tsx to run the source TypeScript directly avoids this dependency.
Move the CLI tool into @metamask/messenger as a subpath export instead of a separate package. This keeps the library lightweight while making the codegen available via optional peer dependencies. - Move source files to packages/messenger/src/generate-action-types/ - Add ./generate-action-types subpath export and bin entry - typescript, yargs, eslint are optional peerDependencies - @metamask/utils added as dependency (needed by codegen) - Remove standalone @metamask/messenger-generate-action-types package - Update 44 consuming packages to point to new location - Revert CODEOWNERS, teams.json, tsconfig, README changes
- Remove unused `MethodInfo.signature` field - Remove redundant `ControllerInfo.exposedMethods` (derivable from methods) - Extract shared ESLint types to `types.ts`, deduplicate across check/fix - Combine eslint/eslintStatic params into single `ESLint | null` object - Inline single-use `capitalize()` helper - Remove unused `Identifier` type import and `extractMethodSignature`
89da66f to
0202e79
Compare
…ion-types tests Replace manual mkdtemp/rm temp directory management with the createSandbox utility from @metamask/utils/node across all 4 test files. Add @metamask/utils/node subpath mapping to the shared jest.config.packages.js so all packages can resolve it.
Return boolean from checkActionTypesFiles and generateAllActionTypesFiles instead of setting process.exitCode directly. Only cli.ts now sets the exit code, keeping the global side effect in a single location.
Replace the wrapped outputFixes/getErrorResults functions with an eslintClass reference so callers use the static methods directly, making it clear these are class-level operations.
… load failure Add directory exclusions (node_modules, dist, .git, coverage) to the recursive file walker to avoid traversing irrelevant trees. Also log a warning when ESLint fails to load instead of silently skipping formatting.
…te-action-types-package
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
| console.error('\n💥 Some action type files are out of date or missing.'); | ||
| console.error( | ||
| 'Run `yarn generate-method-action-types --fix` to update them.', | ||
| ); |
There was a problem hiding this comment.
Contributor
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
Mrtenz
reviewed
Apr 1, 2026
Allow consumers on TypeScript 5.x beyond 5.3 while keeping devDependency pinned.
Mrtenz
approved these changes
Apr 1, 2026
abretonc7s
approved these changes
Apr 1, 2026
wantedsystem
approved these changes
Apr 1, 2026
github-merge-queue bot
pushed a commit
that referenced
this pull request
Apr 2, 2026
## Explanation This release bumps `@metamask/compliance-controller` from `1.0.2` to `2.0.0`. The major version bump is required due to breaking changes in the compliance controller — see the [changelog](https://github.com/MetaMask/core/blob/release/900.0.0/packages/compliance-controller/CHANGELOG.md) for full details. ### Packages released | Package | From | To | Type | |---|---|---|---| | `@metamask/compliance-controller` | `1.0.2` | `2.0.0` | major | ### Summary of changes **Added** - `generate-action-types` CLI tool available as a subpath export via the `@metamask/messenger` bump ([#8264](#8264)) **Breaking changes** - Removed proactive bulk-fetch pattern from `ComplianceController` and `ComplianceService` ([#8365](#8365)) - `state.blockedWallets` and `state.blockedWalletsLastFetched` removed — consumers with persisted state must drop these fields on migration - `init()`, `updateBlockedWallets()` controller methods removed - `blockedWalletsRefreshInterval` constructor option removed - `ComplianceControllerInitAction`, `ComplianceControllerUpdateBlockedWalletsAction`, `ComplianceServiceUpdateBlockedWalletsAction`, `BlockedWalletsInfo` removed from public API - `checkWalletCompliance` / `checkWalletsCompliance` now fall back to the per-address cache on API failure - `selectIsWalletBlocked` now reads solely from `walletComplianceStatusMap` ## References - [#8365](#8365) — refactor(compliance): remove initial block wallets call ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've communicated my changes to consumers by updating changelogs for packages I've changed - [x] I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Release-only changes, but it publishes a new major `@metamask/compliance-controller` version with breaking API/state removals that downstream consumers must migrate to. > > **Overview** > Bumps the monorepo version to `900.0.0` and releases `@metamask/compliance-controller` `2.0.0`. > > Updates the compliance-controller changelog to document the **breaking** removal of the blocked-wallets bulk-fetch flow and related public API/state fields, and adjusts the `[Unreleased]`/`[2.0.0]` compare links accordingly. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 7060084. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: cryptodev-2s <109512101+cryptodev-2s@users.noreply.github.com>
This was referenced Apr 3, 2026
github-merge-queue bot
pushed a commit
that referenced
this pull request
Apr 3, 2026
…8378) ## Explanation The `generate-action-types` CLI tool currently lives inside `@metamask/messenger`. Consumers may use different ESLint or TypeScript versions, which complicates usage when these are peer dependencies. This PR extracts the CLI into its own dedicated package (`@metamask/messenger-cli`) so consumers can install it as a devDependency with their own ESLint/TypeScript versions. ### Changes - **New `@metamask/messenger-cli` package** with all CLI source files and tests (100% coverage). - `eslint` and `typescript` are peer dependencies (uses the project's versions to avoid formatting mismatches). - `@metamask/utils` and `yargs` are regular dependencies. - CLI-only package — no public API exports, no typedoc. - Binary: `messenger-action-types --generate` / `messenger-action-types --check` - **`@metamask/messenger` is unchanged for consumers** (non-breaking). The existing CLI and binary remain, with a deprecation warning pointing to the new package. - **Per-package scripts** renamed to `messenger-action-types:generate` and `messenger-action-types:check` (matching `changelog:update`/`changelog:validate` pattern). - **Removed `tsx` devDependency** from ~49 consumer packages (no longer needed per-package). - **Updated root scripts** to `messenger-action-types:check` and `messenger-action-types:generate`. - **Updated CI, docs, and metadata** (`lint-build-test.yml`, `controller-guidelines.md`, `teams.json`, `CODEOWNERS`, `eslint.config.mjs`, `yarn.config.cjs`). This package will also serve as the home for `@metamask/messenger-docs` in a follow-up, consolidating all messenger CLI tooling in one place. ## References - Related to #8264 ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've communicated my changes to consumers by updating changelogs for packages I've changed - [ ] I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Mostly build/dev-tooling changes, but it rewires lint/CI scripts and per-package workflows; mistakes could break generation checks or CI across many workspaces. > > **Overview** > Introduces a new workspace package, `@metamask/messenger-cli`, that provides the `messenger-action-types` binary to **generate** and **check** `*-method-action-types.ts` files (including source discovery, JSDoc extraction, optional ESLint formatting, and full test coverage). > > Updates the monorepo to use the new CLI everywhere: root `lint`/`lint:fix` and CI now run `messenger-action-types:*`, and many workspace `package.json` scripts are renamed from `generate-method-action-types` to `messenger-action-types:generate`/`:check` pointing at the new CLI. > > Marks the old `@metamask/messenger` `messenger-generate-action-types` CLI as **deprecated** via a runtime warning, and updates docs/metadata/config (`README`, controller guidelines, `CODEOWNERS`, `teams.json`, `eslint.config.mjs`, `tsconfig*`, `yarn.config.cjs`) to register the new package and its build exceptions. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit ab18925. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
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.


Explanation
The script
scripts/generate-method-action-types.tsgenerates TypeScript action type files for controllers/services that defineMESSENGER_EXPOSED_METHODS. It was a monorepo-local script invoked viatsx ../../scripts/generate-method-action-types.tsfrom 44 packages.This PR moves it into
@metamask/messengeras a CLI tool, keeping the library lightweight while making the codegen reusable in other repositories.What changed:
generate-action-types/subdirectory underpackages/messenger/src/with modular source files (parse-source.ts,generate-content.ts,check.ts,fix.ts,cli.ts)messenger-generate-action-typesbin entry to@metamask/messengeryargsis the only runtime dependency;@metamask/utils,typescript, andeslintare non-optional peer dependencies (required for the CLI, but provided by the consuming project). The coreMessengerlibrary remains lightweight.tsx ../../packages/messenger/src/generate-action-types/cli.tsscripts/generate-method-action-types.tsexeca+tsxverify exact generated output for controllers and servicesWorking examples in external repos:
References
Checklist
Note
Medium Risk
Mostly build/tooling changes, but it touches many packages and changes the action-type generation pipeline; failures would surface as broken scripts or mismatched generated files across the monorepo.
Overview
Adds a new
@metamask/messengercodegen CLI (messenger-generate-action-types) that discovers controllers/services withMESSENGER_EXPOSED_METHODSand supports--fixand--checkworkflows, including optional ESLint formatting and extensive unit/functional tests.Migrates dozens of packages’
generate-method-action-typesscripts to call the new CLI entrypoint, deletes the legacyscripts/generate-method-action-types.ts, and updates generated*-method-action-types.tsoutputs (header/JSDoc normalization and some regenerated action unions). Also updates repo config to support the new tooling (ESLint rule exception for the generator folder and Jest module mapping for@metamask/utils/node).Written by Cursor Bugbot for commit ca19d18. This will update automatically on new commits. Configure here.