@simplens/create-simplens-plugin
v1.0.0
Published
CLI tool to scaffold new SimpleNS notification plugins
Downloads
110
Maintainers
Readme
@simplens/create-simplens-plugin
CLI tool to scaffold new SimpleNS notification plugins. Generates all required boilerplate so you can focus on writing the notification delivery logic.
Installation
# Via npx (recommended)
npx @simplens/create-simplens-plugin
# Global installation
npm install -g @simplens/create-simplens-plugin
create-simplens-pluginUsage
Interactive Mode
Simply run the CLI and answer the prompts:
npx @simplens/create-simplens-pluginYou'll be asked for:
- Plugin name - kebab-case identifier (e.g.,
discord,telegram,twilio-sms) - Display name - Human readable name
- Description - What your plugin does
- Channel - Channel identifier for routing
- Author - Your name and email
- Git/npm options - Whether to initialize git and install dependencies
Non-Interactive Mode
Use CLI flags for automation:
npx @simplens/create-simplens-plugin --name discord --channel discord --yesCommand Line Options
Usage: create-simplens-plugin [options]
Options:
-n, --name <name> Plugin name (e.g., discord, telegram)
-c, --channel <channel> Channel identifier
-d, --directory <dir> Output directory (default: plugin-<name>)
-y, --yes Use defaults, skip prompts
--no-git Skip git initialization
--no-install Skip npm install
-h, --help Show help
-V, --version Show versionGenerated Files
plugin-<name>/
├── package.json # NPM package configuration
├── tsconfig.json # TypeScript configuration
├── src/
│ ├── index.ts # Provider class (implement send() here)
│ └── index.test.ts # Test suite
├── README.md # Plugin documentation
└── .gitignore # Git ignore rulesWhat to Implement
After scaffolding, you need to:
Define schemas in
src/index.ts:recipientSchema- Who receives notificationscontentSchema- What the notification contains
Implement
send()method:- Add your API client initialization
- Implement the delivery logic
- Handle errors appropriately
Add tests in
src/index.test.tsUpdate README.md with your plugin's documentation
Example
$ npx @simplens/create-simplens-plugin
🔌 Create SimpleNS Plugin
? Plugin name: discord
? Display name: Discord
? Description: Send notifications via Discord webhooks
? Channel identifier: discord
? Author name: John Doe
? Author email: [email protected]
? Select required credentials: webhook_url
? Select recipient fields: channelId
? Select content fields: message, title
? Output directory: plugin-discord
? Initialize git repository? Yes
? Install dependencies after generation? Yes
✅ Plugin created successfully!
📁 Created plugin-discord/
├── package.json
├── tsconfig.json
├── src/
│ ├── index.ts ← Implement your send() logic here
│ └── index.test.ts
├── README.md
└── .gitignore
🚀 Next steps:
1. cd plugin-discord
2. Edit src/index.ts # Add your delivery logic
3. npm test # Run tests
4. npm run build # Build for publishing
5. npm publish --access public # Publish to npmDevelopment
Build
npm run buildTest
npm testRun Locally
npm run devLicense
MIT
