feat: extract generate-action-types CLI into @metamask/messenger-cli#8378
feat: extract generate-action-types CLI into @metamask/messenger-cli#8378cryptodev-2s merged 16 commits intomainfrom
Conversation
561db3c to
23f4dfd
Compare
|
@metamaskbot publish-preview |
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
23f4dfd to
73e2323
Compare
|
@metamaskbot publish-preview |
73e2323 to
2951c0e
Compare
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
|
@metamaskbot publish-preview |
|
@metamaskbot publish-preview |
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
mcmire
left a comment
There was a problem hiding this comment.
A couple of things and then this is good.
|
@metamaskbot publish-preview |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
| ); | ||
|
|
||
| const expectedContent = generateActionTypesContent(source); | ||
| const expectedTempFile = actualFile.replace('.ts', '.tmp.ts'); |
There was a problem hiding this comment.
Temp file path breaks with .ts in directory name
Low Severity
actualFile.replace('.ts', '.tmp.ts') uses String.replace which only replaces the first occurrence. If the resolved directory path contains .ts (e.g., a folder like .ts-cache or my.ts.project), the replacement targets the wrong substring, producing an incorrect temp file path. Using a regex with $ anchor or targeting only the file extension would be safer.
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
mcmire
left a comment
There was a problem hiding this comment.
One more thing I noticed.
Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
|
@metamaskbot publish-preview |
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
) ## Explanation Migrates from the deprecated `messenger-generate-action-types` binary in `@metamask/messenger` to the new standalone `@metamask/messenger-cli` package. ### Changes - Add `@metamask/messenger-cli@^0.1.0` as devDependency to `snaps-controllers` - Add per-package scripts following `topic:action` pattern: - `messenger-action-types:check` — checks if generated files are up to date - `messenger-action-types:generate` — generates/updates action type files - Add root scripts delegating to `snaps-controllers` - Integrate `--check` into `lint` and `--generate` into `lint:fix` - Remove old `generate-method-action-types` script ## References - Depends on MetaMask/core#8378 ## 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 - [ ] I've highlighted breaking changes using the "BREAKING" keyword <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Low risk: changes are limited to developer tooling (scripts, lint integration, and devDependencies) and should not affect runtime behavior, though CI/lint may fail if the new action-type generation checks differ from the old ones. > > **Overview** > Migrates action-type code generation in `snaps-controllers` from the deprecated `messenger-generate-action-types` binary to the standalone `@metamask/messenger-cli` (`messenger-action-types`). > > Updates root and package scripts to use `messenger-action-types:check` during `lint` and `messenger-action-types:generate` during `lint:fix`, removes the old `generate-method-action-types` script, and adds `@metamask/messenger-cli` as a devDependency (with associated `yarn.lock` updates). > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 8f8175f. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->


Explanation
The
generate-action-typesCLI 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
@metamask/messenger-clipackage with all CLI source files and tests (100% coverage).eslintandtypescriptare peer dependencies (uses the project's versions to avoid formatting mismatches).@metamask/utilsandyargsare regular dependencies.messenger-action-types --generate/messenger-action-types --check@metamask/messengeris unchanged for consumers (non-breaking). The existing CLI and binary remain, with a deprecation warning pointing to the new package.messenger-action-types:generateandmessenger-action-types:check(matchingchangelog:update/changelog:validatepattern).tsxdevDependency from ~49 consumer packages (no longer needed per-package).messenger-action-types:checkandmessenger-action-types:generate.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-docsin a follow-up, consolidating all messenger CLI tooling in one place.References
generate-action-typesCLI tool as subpath export #8264Checklist
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 themessenger-action-typesbinary to generate and check*-method-action-types.tsfiles (including source discovery, JSDoc extraction, optional ESLint formatting, and full test coverage).Updates the monorepo to use the new CLI everywhere: root
lint/lint:fixand CI now runmessenger-action-types:*, and many workspacepackage.jsonscripts are renamed fromgenerate-method-action-typestomessenger-action-types:generate/:checkpointing at the new CLI.Marks the old
@metamask/messengermessenger-generate-action-typesCLI 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.Written by Cursor Bugbot for commit ab18925. This will update automatically on new commits. Configure here.