Skip to content

chore: use @metamask/messenger CLI for action type generation#3934

Open
cryptodev-2s wants to merge 3 commits intomainfrom
feat/use-messenger-generate-action-types-cli
Open

chore: use @metamask/messenger CLI for action type generation#3934
cryptodev-2s wants to merge 3 commits intomainfrom
feat/use-messenger-generate-action-types-cli

Conversation

@cryptodev-2s
Copy link
Copy Markdown
Contributor

@cryptodev-2s cryptodev-2s commented Apr 1, 2026

Description

Replace the local scripts/generate-method-action-types.mts (773 lines) with the messenger-generate-action-types CLI shipped in @metamask/messenger@^1.1.0.

  • Delete duplicated script
  • Bump @metamask/messenger to ^1.1.0 in all packages
  • Regenerate all 7 action type files (header comment change only)

Checklist

  • The PR follows the repository guidelines
  • The PR has a meaningful title
  • New or updated code has been tested

Note

Low Risk
Low risk: this is a tooling/dependency update that swaps a local codegen script for the upstream @metamask/messenger CLI and only regenerates type files with header changes.

Overview
Switches method action type generation from the repo-local scripts/generate-method-action-types.mts to the messenger-generate-action-types CLI shipped by @metamask/messenger.

Bumps @metamask/messenger to ^1.1.0 across the monorepo (plus a root resolutions pin), removes the deleted generator script, and regenerates the affected *-method-action-types.ts outputs (content unchanged aside from the auto-generated header comment).

Written by Cursor Bugbot for commit d2afb44. This will update automatically on new commits. Configure here.

Replace local scripts/generate-method-action-types.mts with the
messenger-generate-action-types CLI from @metamask/messenger@^1.1.0.

- Delete 773-line duplicated script
- Bump @metamask/messenger to ^1.1.0 in all packages
- Update snaps-controllers generate script to use CLI
- Regenerate all 7 action type files
@socket-security
Copy link
Copy Markdown

socket-security bot commented Apr 1, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​metamask/​messenger@​1.0.0 ⏵ 1.1.09910078 +293 +3100

View full report

@cryptodev-2s cryptodev-2s marked this pull request as ready for review April 1, 2026 20:52
@cryptodev-2s cryptodev-2s requested a review from a team as a code owner April 1, 2026 20:52
@cryptodev-2s cryptodev-2s enabled auto-merge April 1, 2026 20:53
@cryptodev-2s cryptodev-2s mentioned this pull request Apr 1, 2026
@cryptodev-2s cryptodev-2s self-assigned this Apr 1, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.56%. Comparing base (6ad0161) to head (d2afb44).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3934   +/-   ##
=======================================
  Coverage   98.56%   98.56%           
=======================================
  Files         426      426           
  Lines       12316    12316           
  Branches     1935     1935           
=======================================
  Hits        12139    12139           
  Misses        177      177           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

"changelog:update": "../../scripts/update-changelog.sh @metamask/snaps-controllers",
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/snaps-controllers",
"generate-method-action-types": "tsx ../../scripts/generate-method-action-types.mts",
"generate-method-action-types": "messenger-generate-action-types",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem to work. It looks like we need to pass either --check or --fix.

Also... I wonder if "generate" was the right word to use for the executable. It seems that what we've really written is a linter. The other thing is that we are not checking all action types, just method action types. So I wonder if messenger-lint-method-action-types would have been a better name. Hmm 🤔

Regardless, I think we should have two package scripts here:

  • messenger-action-types:check (calls messenger-generate-action-types --check )
  • messenger-action-types:fix (calls messenger-generate-action-types --check )

And we should make sure that messenger-action-types:check is called in lint, and messenger-action-types:fix is called in lint:fix.

Lastly I think we should update yarn.config.cjs so that we can easily apply these changes across all packages.

What do you think?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works exactly the same way it used to: the options are passed from the root package.json, not from the workspaces.

I see what you mean, though. However, this would mean I need to update @metamask/messenger, since it now instructs people to run yarn generate-method-action-types --fix.

},
"resolutions": {
"@esbuild-plugins/node-modules-polyfill@^0.2.2": "patch:@esbuild-plugins/node-modules-polyfill@npm%3A0.2.2#./.yarn/patches/@esbuild-plugins-node-modules-polyfill-npm-0.2.2-f612681798.patch",
"@metamask/messenger": "^1.1.0",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need a resolution ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants