A fully-featured starter boilerplate for building and publishing your own CLI tools using Node.js + npm.
cli global command and modular generatorscli bump version bump tool--dry-run modenpm publish--framework override--tsChoose the workflow that fits your needs.
cli in an existing projectnpm install -g @greenarmor/cli-boilerplate
cd path/to/your-existing-project
cli generate:component Button
The generators detect your framework and drop files into your project automatically.
git config --global user.name "your_github_username"
git config --global user.email "your_email@example.com"
npx @greenarmor/cli-boilerplate my-cli
--with-emoji – show emoji-enhanced output--full-stack – add ESLint, Prettier, Husky, Lint-Staged, Jest, ZX, Inquirer, Update Notifier, and more CLI polish librariesnpx @greenarmor/cli-boilerplate my-cli --with-emoji --full-stack
cd my-cli
npm install
npm link
my-cli --help
Chat with the CLI using natural language to run allowed generator commands.
npm run chat
# or
cli chat
Requires OPENAI_API_KEY in your environment. Put the key in a .env or export it globally:
echo 'export OPENAI_API_KEY="sk-..."' >> ~/.bashrc && source ~/.bashrcsetx OPENAI_API_KEY "sk-..."NODE_ENV=production disables chat mode.
Inside chat mode you can express commands naturally:
AI> generate a component called Button
AI> scan the project with the npm scanner
AI> initialize the scanner config
AI> list patches
AI> apply patch readme-fix.patch
AI> bump the version
AI> generate the changelog
AI> install shell completion
AI> start the mcp server
AI> index docs for rag
AI> query rag for authentication
Start the MCP server directly (development only):
NODE_ENV=development cli mcp:serve
cli generate:component Button
cli generate:hook useAuth
cli generate:context Auth
cli generate:authlogin auth
Other supported generators:
pagelayoutservicestyletestcontextauthloginUse the --ts flag to scaffold TypeScript files.
cli generate:authlogin outputs an auth/schema.sql file defining a users
table (id, email unique, password_hash, created_at). Apply the schema
with your preferred migration tool, e.g.:
psql -f auth/schema.sql
Run cli scan:init to generate a .cli-scannersrc file with sample scanner
definitions.
The cli scan command runs pluggable security tools. Register scanners under
cli.scanners in package.json or provide defaults in .cli-scannersrc.
Install required scanners first (ZAP is not bundled):
npm audit to inspect dependencies. Requires Node.js and npm
(v7+) in your PATH.zap-baseline.py or
zap.sh. Download ZAP or install with a
package manager (brew install zaproxy) or Docker.cli scan usageRun a registered scanner against a project directory or URL:
# run npm audit on the current project
cli scan --scanner npm --target .
# run OWASP ZAP against a URL, save an HTML report, and only show high issues
cli scan --scanner zap --target https://example.com \
--report zap-report.html --severity high
Use --report <file> to write findings to a JSON or HTML report. The
--severity <level> flag filters results below the threshold (info, low,
moderate, high, critical).
Configure defaults or pass arguments per scanner in your project:
{
"cli": {
"scanners": {
"npm": "./scripts/scanners/npm.js",
"zap": "./scripts/scanners/zap.js"
}
},
"scan": {
"severity": "moderate",
"zap": { "args": ["-r", "zap-report.html"] }
}
}
Include cli scan in CI pipelines to fail builds on severe vulnerabilities:
cli scan --scanner npm --severity high
Always scan only systems you own or have explicit permission to test.
cli bump [--github-release] [-u] [-r <count>]
Supports patch/minor/major, changelog preview, optional push + publish, -u for Unreleased notes, --github-release to create a GitHub release (requires GITHUB_TOKEN), and --dry-run.
export GITHUB_TOKEN=ghp_YourTokenHere
cli bump --github-release
Runs scripts/release-to-github.js after pushing tags. You can also invoke the script directly:
node scripts/release-to-github.js
Requirements:
NPM_TOKEN in GitHub Actions secretsGITHUB_TOKEN in GitHub Actions secretsMIT — Customize and distribute freely under your own CLI brand.