
Security News
TeamPCP and BreachForums Launch $1,000 Contest for Supply Chain Attacks
TeamPCP and BreachForums are promoting a Shai-Hulud supply chain attack contest with a $1,000 prize for the biggest package compromise.
@kysera/cli
Advanced tools
Comprehensive command-line interface for Kysera - A production-ready type-safe data access toolkit for TypeScript with enterprise-grade features.
# NPM
npm install -g @kysera/cli
# PNPM (recommended)
pnpm add -g @kysera/cli
# Yarn
yarn global add @kysera/cli
# Bun
bun add -g @kysera/cli
# Project-specific installation
pnpm add -D @kysera/cli
# Initialize a new project
kysera init my-app --dialect postgres --typescript
# Create and run migrations
kysera migrate create add_users_table
kysera migrate up
# Generate models and repositories
kysera generate model User --table users
kysera generate repository User --with-validation
# Generate complete CRUD with API
kysera generate crud Post --api --tests
# Check database health
kysera health check
Kysera CLI provides shell completion scripts for Bash, Zsh, and Fish shells to enhance your development experience with tab completion for commands, subcommands, and options.
System-wide installation:
sudo cp scripts/completions/kysera.bash /etc/bash_completion.d/kysera
# or on macOS with Homebrew:
sudo cp scripts/completions/kysera.bash /usr/local/etc/bash_completion.d/kysera
User installation:
# Add to your ~/.bashrc or ~/.bash_profile:
source /path/to/kysera-cli/scripts/completions/kysera.bash
Then reload your shell:
source ~/.bashrc
System-wide installation:
sudo cp scripts/completions/kysera.zsh /usr/local/share/zsh/site-functions/_kysera
User installation:
# Create completions directory if it doesn't exist
mkdir -p ~/.zsh/completions
# Copy the completion file
cp scripts/completions/kysera.zsh ~/.zsh/completions/_kysera
# Add to your ~/.zshrc:
fpath=(~/.zsh/completions $fpath)
autoload -U compinit && compinit
Then reload your shell:
source ~/.zshrc
Installation:
# User installation (recommended)
cp scripts/completions/kysera.fish ~/.config/fish/completions/
# System-wide installation
sudo cp scripts/completions/kysera.fish /usr/share/fish/vendor_completions.d/
Fish will automatically load completions - no need to reload.
The completion scripts provide intelligent suggestions for:
init, migrate, generate, db, etc.)migrate up, generate model)--dialect, --validation, --strategy# Type and press TAB:
kysera <TAB>
# Shows: init migrate generate db health audit debug query repository test plugin help
kysera migrate <TAB>
# Shows: create up down status list reset fresh rollback
kysera generate --validation <TAB>
# Shows: zod yup joi none
kysera --config <TAB>
# Shows: file path completions for .ts, .js, .json files
| Command | Description | Aliases |
|---|---|---|
init | Initialize a new Kysera project | |
migrate | Database migration management | |
generate | Code generation utilities | g |
db | Database management tools | |
health | Health monitoring and metrics | |
audit | Audit logging and history | |
query | Query analysis and utilities | |
test | Test environment management | |
plugin | Plugin management | |
debug | Debug and diagnostic tools | |
repository | Repository pattern utilities | |
hello | Test command to verify CLI setup | |
stats | Show CLI performance statistics |
Some commands support short aliases for faster typing:
# Generate command has 'g' alias
kysera g model User
kysera generate model User # equivalent
# Both commands do the same thing
kysera g repository Post
kysera generate repository Post # equivalent
Kysera CLI uses cosmiconfig for flexible configuration loading. The CLI will automatically search for configuration in the following locations (in order of priority):
kysera.config.ts (recommended for TypeScript projects)kysera.config.jskysera.config.mjskysera.config.cjskysera.config.json.kyserarc.ts.kyserarc.js.kyserarc.jsonYou can also specify a custom config file using the --config flag:
kysera migrate up --config ./custom-config.ts
Create kysera.config.ts in your project root (recommended):
import { defineConfig } from '@kysera/cli'
export default defineConfig({
database: {
dialect: 'postgres',
host: process.env.DB_HOST || 'localhost',
port: parseInt(process.env.DB_PORT || '5432'),
database: process.env.DB_NAME || 'myapp',
user: process.env.DB_USER || 'postgres',
password: process.env.DB_PASSWORD,
pool: { min: 2, max: 10 }
},
migrations: {
directory: './migrations',
tableName: 'kysera_migrations',
timezone: 'UTC'
},
generation: {
outputDir: './src/generated',
typescript: true,
validation: 'zod'
},
plugins: {
'@kysera/soft-delete': { enabled: true },
'@kysera/timestamps': { enabled: true },
'@kysera/audit': { enabled: true }
}
})
For simpler projects, you can use kysera.config.json:
{
"database": {
"dialect": "postgres",
"host": "localhost",
"port": 5432,
"database": "myapp"
},
"migrations": {
"directory": "./migrations"
}
}
All commands support these global options:
| Option | Description | Default |
|---|---|---|
--verbose | Enable detailed output with debug information | false |
-q, --quiet | Suppress non-essential output | false |
--dry-run | Preview changes without executing | false |
--config <path> | Path to custom configuration file | Auto-detect |
--json | Output results as JSON | false |
--no-color | Disable colored output | false |
--env <environment> | Set environment (development/production/test) | development |
--stats | Show performance statistics after command execution | false |
# Verbose output with debug information
kysera migrate up --verbose
# Quiet mode - minimal output
kysera generate model User --quiet
# Preview changes without executing
kysera db reset --dry-run
# Use custom config file
kysera migrate up --config ./config/db.ts
# JSON output for scripting
kysera health check --json
# Disable colors for CI/CD
kysera test setup --no-color
# Set environment
kysera migrate up --env production
# Show performance stats
kysera generate crud Post --stats
Test command to verify CLI setup and configuration:
# Basic hello
kysera hello
# Output: Hello, World! π
# With custom name
kysera hello --name John
# Output: Hello, John! π
# With verbose output
kysera hello --verbose
# Output:
# Hello, World! π
# CLI is working correctly!
Show CLI performance statistics including command load times, cache hit rates, and usage patterns:
kysera stats
Example output:
CLI Performance Statistics
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Command Load Times:
migrate: 45ms (used 23 times)
generate: 38ms (used 15 times)
health: 12ms (used 8 times)
Cache Hit Rate: 85%
Most Used Commands:
1. migrate
2. generate
3. health
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Startup time: 124ms
The stats command helps you:
# Setup test environment
kysera test setup --env test
# Seed test data
kysera test seed --count 1000 --strategy realistic
# Load fixtures
kysera test fixtures users.json posts.yaml
# Teardown
kysera test teardown --env test --force
# Start test databases
docker compose -f docker-compose.test.yml up -d
# Run multi-database tests
TEST_POSTGRES=true TEST_MYSQL=true pnpm test
kysera migrate up
β Running migration: 001_create_users.ts
β Running migration: 002_create_posts.ts [45%]
kysera migrate up --dry-run
[DRY RUN] Would execute:
- 001_create_users.ts
- 002_create_posts.ts
kysera stats
Command Load Times:
migrate: 45ms (23 uses)
Cache Hit Rate: 85%
MIT Β© Kysera Team
FAQs
Comprehensive CLI for Kysera data access toolkit
The npm package @kysera/cli receives a total of 20 weekly downloads. As such, @kysera/cli popularity was classified as not popular.
We found that @kysera/cli demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.Β It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
TeamPCP and BreachForums are promoting a Shai-Hulud supply chain attack contest with a $1,000 prize for the biggest package compromise.

Security News
Packagist urges PHP projects to update Composer after a GitHub token format change exposed some GitHub Actions tokens in CI logs.

Research
GemStuffer abuses RubyGems as an exfiltration channel, packaging scraped UK council portal data into junk gems published from new accounts.