totalgen
v1.4.3
Published
Total.js CLI tool inspired by Artisan — generate migrations, controllers, schemas, etc.
Maintainers
Readme
totalgen
A simple, powerful CLI generator for Node.js in general and Total.js specicially, with AI-enhanced output and custom project configuration.
Installation
npm install -g totalgenUsage
Run in terminal:
tg <command> <name> [--prompt="enhance with AI"]Examples
- Template files generation commands
tg generate:migration create_users_table
tg generate:controller user
tg generate:plugin auth --prompt="secure JWT login system"- Migrations specific commands
tg migrate # Run migrations
tg migration:migrate # Run migrations
tg migration:rollback # Run migrations rollback operation to revertFeatures
Generate files for:
migrationcontrollerschemaplugin
AI Integration with
--prompt:Enhance generated files using your prompt (e.g. "add validation", "make RESTful", etc.)
Configurable via
tgconfig.json:Set your preferred structure
Define AI integration keys and presets
Project Config (tgconfig.json)
You can place a tgconfig.json at the root of your project:
{
"debug": false,
"location": "/",
"table": "migrations",
"db": {
"host": "localhost",
"port": 5432,
"user": "postgres",
"password": "postgres",
"database": "tgconfig",
"link": "postgresql://user:password@hostname:5432/database"
},
"ai": {
"enabled": true,
"provider": "openai",
"apiKey": "YOUR_API_KEY"
}
}AI Prompting Example
tg plugin notification --prompt="create a plugin to send email and SMS alerts"The output will be enhanced based on your prompt using your preferred AI provider.
Roadmap
- [x] CLI Generator: controller, migration, schema, plugin
- [x]
tgconfig.jsonsupport - [x] AI prompt enhancement (
--prompt) - [ ] Route auto-injection
- [ ] Custom file templates
Author
Built with precision by Louis Bertson GitHub: @louisbertson
Contribute
Found a bug or want to add a new generator? Pull requests welcome. Open an issue or fork it!
License
MIT
