@pronghorn/cli
v0.1.0
Published
Official CLI for Pronghorn. Scaffold projects, generate routes/middlewares/plugins, and run dev/build workflows, powered by cli-atelier.
Maintainers
Readme
Pronghorn CLI 🛠️
The official command-line tool for Pronghorn, built entirely on cli-atelier. Scaffold new projects, generate routes/middlewares/plugins, and run dev/build workflows, all from one global command.
Installed globally via
bun i -g @pronghorn/cli, this is the Pronghorn equivalent offastify-cli.
Why the CLI
Pronghorn's createApp() is fully manual by design, but starting a brand new project by hand (directory structure, autoload conventions, boilerplate index.ts) is repetitive. The CLI automates that setup while staying out of the way of Pronghorn's programmatic, non-magic philosophy.
pronghorn newscaffolds a complete project interactively, with optional EJS, Prisma, JWT, and OpenAPI wiring.pronghorn generatecreates correctly-named route/middleware/plugin files matching Pronghorn's autoload conventions exactly.pronghorn devruns your app underbun --watchwith zero configuration.pronghorn buildbundles and type-checks your project the same way every@pronghorn/*package builds itself.- Every interactive step (forms, task lists, spinners) is rendered through
cli-atelier, a zero-dependency, pure-ANSI terminal framework built for Bun.
Installation
bun i -g @pronghorn/cliRequires Bun >=1.3.0. Installing under Node.js fails intentionally during preinstall, consistent with Pronghorn core's own Bun-only philosophy.
Verify the install:
pronghorn versionCommands
pronghorn new [name]
Scaffolds a new Pronghorn project into a directory named name (or prompts for one if omitted). Walks through an interactive form for the project name, optional features, and git initialization, then writes files, installs dependencies, and initializes git in sequence.
pronghorn new my-apiGenerated structure:
my-api/
├── package.json
├── .gitignore
├── .env.example
├── README.md
└── src/
├── index.ts
├── routes/
│ └── health.get.ts
├── middlewares/
├── plugins/
└── hooks/Selecting "EJS templating" also creates views/layout.ejs and views/home.ejs. Selecting "JWT auth" wires createJwtAuth into the generated index.ts automatically. Selecting "OpenAPI docs" adds @pronghorn/openapi as a dependency and registers it in index.ts.
pronghorn generate <kind> [name] [--method get]
Generates a single file matching Pronghorn's autoload naming conventions. kind is one of route, middleware, or plugin; if omitted, you're prompted to choose interactively.
pronghorn generate route users --method post
# -> src/routes/users.post.ts
pronghorn generate middleware admin-only
# -> src/middlewares/admin-only.middleware.ts
pronghorn generate plugin redis
# -> src/plugins/redis.plugin.tsBoth kind and name can be omitted entirely, the CLI falls back to interactive prompts for both.
pronghorn generate
# -> Select prompt: Route / Middleware / Plugin
# -> Text prompt: namepronghorn dev
Runs src/index.ts under bun --watch from the current directory, restarting automatically on file changes. Must be run from a Pronghorn project root (a directory containing src/index.ts).
pronghorn devpronghorn build
Bundles src/index.ts with bun build --target bun into ./dist, then emits type declarations via tsc if a tsconfig.json is present. Mirrors the exact build process used by every @pronghorn/* package.
pronghorn buildpronghorn version
Prints the installed CLI version.
pronghorn versionCommand Reference
| Command | Arguments | Flags | Description |
| ---------- | --------------- | ----------------------- | -------------------------------------------- |
| new | [name] | - | Scaffold a new project interactively |
| generate | [kind] [name] | --method (route only) | Generate a route, middleware, or plugin file |
| dev | - | - | Run the dev server with hot reload |
| build | - | - | Build the project for production |
| version | - | - | Print the CLI version |
Architecture
The CLI is split into commands and templates, each with a single responsibility.
| Module | Responsibility |
| ------------------------------ | --------------------------------------------------------------------------------------------------- |
| commands/new.command.ts | Interactive project scaffolding: Form for options, Task for the write/install/git-init pipeline |
| commands/generate.command.ts | Single-file generation with Select/Prompt fallbacks when arguments are omitted |
| commands/dev.command.ts | Spawns bun --watch as a child process with inherited stdio |
| commands/build.command.ts | Spawns bun build and tsc sequentially via Task, mirroring every package's own build script |
| templates/*.template.ts | Pure string-generating functions producing each scaffolded file's content, no I/O |
Every interactive surface (Form, Task, Select, Prompt, Spinner, Header, Log) is provided by cli-atelier, the CLI itself contains no custom terminal-rendering logic.
License
WTFPL (Do What the Fuck You Want to Public License), see LICENSE for details.
