Documentation
¶
Overview ¶
Purpose: This file is the project-local command-line entrypoint for the GoStack framework. It bootstraps configuration parameters, registers core CLI commands (migrations, rollbacks, generators), and executes commands based on terminal inputs.
Philosophy: We believe local command execution (`go run cmd/gostack/main.go`) is superior to global binaries in statically compiled languages. It guarantees that code generators, migration scripts, and model schemas are compiled with the active project's exact dependency versions and package registrations, keeping command environments safe and version-aligned.
Architecture: Acts as the CLI entrypoint (main package). It binds and runs the `console.Kernel` with our core commands, bridging OS terminal inputs (`os.Args`) directly to CLI runners.
Choice: We chose this local entrypoint design over external CLI wrappers to support compile-time checking of custom project migrations and registration blocks before command runner execution.
Implementation:
- main(): Loads database environment configs, executes database connection handshake (optional), registers Migrate, Rollback, MakeMigration, and MakeController commands, and runs the kernel.