+
Skip to content

Will-create/totalgen

Repository files navigation

npm version npm downloads license

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 totalgen

Usage

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 revert

Features

  • Generate files for:

    • migration
    • controller
    • schema
    • plugin
  • 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

  • CLI Generator: controller, migration, schema, plugin
  • tgconfig.json support
  • 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

About

Total.js Code Generator powered by AI

Resources

Stars

Watchers

Forks

Packages

No packages published
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载