Skip to content

Add CLI tool for asset management and improve documentation#1715

Open
drqsatoshi wants to merge 6 commits intoMetaMask:masterfrom
drqsatoshi:mh/add-cli-to-update-tokens
Open

Add CLI tool for asset management and improve documentation#1715
drqsatoshi wants to merge 6 commits intoMetaMask:masterfrom
drqsatoshi:mh/add-cli-to-update-tokens

Conversation

@drqsatoshi
Copy link

@drqsatoshi drqsatoshi commented Feb 5, 2026

Introduce a CLI tool for managing CAIP-19 contract metadata and icons, along with comprehensive documentation. This update also includes bug fixes and tests to ensure functionality, such as verifying asset integrity and handling image format changes.


Note

Medium Risk
Introduces new filesystem- and network-touching CLI behavior (downloading/writing/removing asset files) plus new dependency (zod), which could affect contributor workflows if edge cases aren’t handled.

Overview
Adds a new cli-update-asset.js command-line tool to create/update, verify, and list CAIP-19 assets, including downloading icons from URLs, validating metadata with zod, and cleaning up stale icon files when formats change.

Updates package.json with asset:* scripts and adds tests covering icon replacement and verify robustness, plus expands documentation in README.md and adds AI instruction pointers (.cursorrules, CLAUDE.md, .github/copilot-instructions.md).

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

@drqsatoshi drqsatoshi requested review from a team and MRabenda as code owners February 5, 2026 19:52
@socket-security
Copy link

socket-security bot commented Feb 5, 2026

No dependency changes detected. Learn more about Socket for GitHub.

👍 No dependency changes detected in pull request

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

const CAIP19Schema = z.string().regex(
/^[-a-z0-9]{3,8}:[-a-zA-Z0-9]{1,32}\/[-a-z0-9]{3,8}:[a-zA-Z0-9]+$/,
'Invalid CAIP-19 format. Expected: namespace:chainId/assetNamespace:assetReference'
);
Copy link

Choose a reason for hiding this comment

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

CAIP-19 regex rejects valid asset references with hyphens

Medium Severity

The CAIP19Schema regex uses [a-zA-Z0-9]+ for the asset reference segment, but the CAIP-19 specification defines asset references as [-a-zA-Z0-9]{1,64}. The regex is missing the hyphen character class and the max-length constraint. This causes the tool to reject valid CAIP-19 identifiers whose asset references contain hyphens, which some chain ecosystems may use. The fix would be changing the trailing segment to [-a-zA-Z0-9]{1,64}.

Fix in Cursor Fix in Web

Copy link
Author

Choose a reason for hiding this comment

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

ooooo this is why Regex is hard. trailing commas, trailing egements.... segmentation faults suck.

@drqsatoshi drqsatoshi marked this pull request as draft February 15, 2026 06:20
@drqsatoshi drqsatoshi force-pushed the mh/add-cli-to-update-tokens branch from a11139b to 9a52db5 Compare February 15, 2026 06:59
@drqsatoshi drqsatoshi mentioned this pull request Feb 15, 2026
@drqsatoshi drqsatoshi marked this pull request as ready for review February 15, 2026 07:07
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.

1 participant