feat: implement Extension system #27
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
codetease/mep!27
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/extension-system"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #23
Summary by CodeRabbit
New Features
API Updates
Examples
Documentation
Tests
Chores
📝 Walkthrough
Walkthrough
Adds a typed extension system: a public
PromptConstructortype, an emptyExtensionRegistryinterface for declaration merging, a runtime registry onMepCLIwithregister()andprompt(), new exports from the index, atruncateutils alias, plus example, docs, tests, and a package bump.Changes
src/base.tsexport type PromptConstructor<T, O> = new (options: O) => Prompt<T, O>;— new exported constructor type only.src/core.tsprivate static registry = new Map<string, any>(),static register(...)to store prompt constructors, andstatic prompt(...)to lookup, instantiate, and run registered prompts; typed againstExtensionRegistryandPromptConstructor.src/types.tsexport interface ExtensionRegistry { }to enable consumer declaration merging for custom prompt types.src/index.ts,src/utils.tsANSI,InputParser,Promptandtype PromptConstructor; re-exportedstringWidth,truncate(alias forLayout.truncate), andstripAnsi.examples/extension-registry.ts,test/extension-registry.test.tsConfettiPromptand tests demonstrating registration, duplicate overwrite warning, prompt invocation, and error for unregistered types; tests include a local module augmentation forExtensionRegistry.README.md,docs/.../extension-registry.md,docs/guides/custom-prompts.md,docs/README.mdpackage.json2.0.0-beta.4; added@types/jestand updated@types/node.Sequence Diagram(s)
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~25 minutes
Poem
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
#23by implementing a complete extension system with registry, type safety, documentation, examples, and tests as required.✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing Touches
🧪 Generate unit tests (beta)
feat/extension-system📝 Coding Plan
Comment
@coderabbitai helpto get the list of available commands and usage tips.🧹 Nitpick comments (2)
🤖 Prompt for all review comments with AI agents
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID:
dd22002f-4700-41e9-beb7-14977f0228d9📥 Commits
Reviewing files that changed from the base of the PR and between
b275a73159and3ae5af4836.📒 Files selected for processing (5)
src/base.tssrc/core.tssrc/index.tssrc/types.tssrc/utils.ts@ -0,0 +1,113 @@import { MepCLI } from '../src/core';Unused variable, import, function or class
Unused variable delay.
In general, the correct way to fix an unused variable warning is either to remove the declaration if it is truly unused, or to refactor code so that the variable is actually used if it was intended to be. For a test helper function in a unit test file, the usual fix is simply to delete it when it is no longer needed.
The best fix here, without changing existing functionality, is to remove the unused
delayconstant declaration entirely fromtest/extension-registry.test.ts. Since it is not referenced in the visible tests and is only a helper, deleting it will not affect the behavior of the tests. No other lines need to be adjusted, and no imports or type declarations depend ondelay.Concretely, in
test/extension-registry.test.ts, delete line 34 that declaresdelay. No additional methods, imports, or definitions are required.🧹 Nitpick comments (2)
🤖 Prompt for all review comments with AI agents
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID:
2cc4728e-58e7-4e9c-8ec2-95b777ff3a82📥 Commits
Reviewing files that changed from the base of the PR and between
dd62c550e0and724cd3c193.⛔ Files ignored due to path filters (1)
bun.lockis excluded by!**/*.lock📒 Files selected for processing (3)
examples/extension-registry.tspackage.jsontest/extension-registry.test.tsActionable comments posted: 1
🧹 Nitpick comments (3)
🤖 Prompt for all review comments with AI agents
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID:
2db53302-5ecf-41aa-903d-f56c81f40d09📥 Commits
Reviewing files that changed from the base of the PR and between
724cd3c193and11e2e2b645.📒 Files selected for processing (2)
examples/extension-registry.tstest/extension-registry.test.ts@ -0,0 +1,101 @@/**⚠️ Potential issue | 🟠 Major
🧩 Analysis chain
🏁 Script executed:
Repository: CodeTease/mep
Length of output: 803
🏁 Script executed:
Repository: CodeTease/mep
Length of output: 1640
🏁 Script executed:
Repository: CodeTease/mep
Length of output: 297
🏁 Script executed:
Repository: CodeTease/mep
Length of output: 718
🏁 Script executed:
Repository: CodeTease/mep
Length of output: 111
🏁 Script executed:
Repository: CodeTease/mep
Length of output: 39
🏁 Script executed:
Repository: CodeTease/mep
Length of output: 427
🏁 Script executed:
Repository: CodeTease/mep
Length of output: 1118
🏁 Script executed:
Repository: CodeTease/mep
Length of output: 1224
🏁 Script executed:
Repository: CodeTease/mep
Length of output: 510
Invalid TypeScript syntax:
typeof NodeJS.setIntervaldoes not exist.NodeJS.setIntervalis not a valid property—setIntervalis a global function, not part of theNodeJSnamespace. This line will produce a TypeScript compilation error. The correct type for the return value ofsetInterval()isNodeJS.Timeout, which is consistently used throughout the codebase (e.g.,src/spinner.ts,src/tasks.ts,src/prompts/wait.ts).🐛 Fix
📝 Committable suggestion
🤖 Prompt for AI Agents
✅ Addressed in commits
610e390tof648265@coderabbitai review
✅ Actions performed
Review triggered.
🧹 Nitpick comments (1)
🤖 Prompt for all review comments with AI agents
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID:
9d746738-a5a4-4404-b4b8-8c516adcebaf📥 Commits
Reviewing files that changed from the base of the PR and between
724cd3c193and71c4fbd871.⛔ Files ignored due to path filters (1)
bun.lockis excluded by!**/*.lock📒 Files selected for processing (7)
README.mddocs/README.mddocs/guides/custom-prompts.mddocs/guides/extension-registry.mdexamples/extension-registry.tspackage.jsontest/extension-registry.test.ts✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)