Skip to content

feat: add mex pattern add command - #9

Merged
theDakshJaitly merged 3 commits into
mex-memory:mainfrom
Bhavesh-0409:feat/pattern-add
Mar 29, 2026
Merged

feat: add mex pattern add command#9
theDakshJaitly merged 3 commits into
mex-memory:mainfrom
Bhavesh-0409:feat/pattern-add

Conversation

@Bhavesh-0409

Copy link
Copy Markdown
Contributor

Adds a new CLI command mex pattern add <name> to create pattern files and update INDEX.md automatically.

  • Creates pattern file with standard template
  • Updates INDEX.md
  • Handles duplicate patterns safely

@Bhavesh-0409

Copy link
Copy Markdown
Contributor Author

I made the required changes , please review my PR

@theDakshJaitly theDakshJaitly left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice work overall, clean structure and good tests. A few things to address:

1. Missing patterns/ directory creation
If the patterns/ dir doesn't exist yet, writeFileSync will throw. Add a mkdirSync(patternsDir, { recursive: true }) before writing the file.

2. INDEX.md append could break formatting
appendFileSync just tacks on the entry. If INDEX.md doesn't end with a newline, the new row gets glued to the last line. Worth reading the file first and adding a newline if needed.

3. No validation on the name argument
Spaces or special characters in the name would create weird file paths. Something like mex pattern add "foo bar" would produce foo bar.md. Should probably validate that the name is a simple slug (letters, numbers, hyphens).

4. Minor: [description] placeholder in INDEX.md
The appended row has a hardcoded [description] placeholder. Not a blocker but worth noting that the user has to manually edit INDEX.md after running the command. Could mention that in the console output.

Please fix #1 and #3, the others are optional but nice to have.

@theDakshJaitly theDakshJaitly left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good, all feedback addressed. Nice work!

@theDakshJaitly
theDakshJaitly merged commit c7f08b3 into mex-memory:main Mar 29, 2026
3 checks passed
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.

2 participants