The official Command Line Interface (CLI) and script utility library for the Quatrain ecosystem.
This package serves two distinct purposes:
core): A global terminal command runner to scaffold projects, generate configurations, and manage deployments.Import these utilities directly in your TypeScript/JavaScript scripts to interact with the user or run external processes.
Command)The Command class provides a cross-platform, fluent builder-pattern interface to execute system subprocesses. It simplifies spawning commands, passing arguments, setting working directories, extending environment variables, and supports PowerShell routing.
import { Command } from '@quatrain/cli';
const result = await Command.create('kubectl')
.arg('apply')
.arg('-f')
.arg('deployment.yaml')
.cwd('/path/to/project')
.env({ KUBECONFIG: '/path/to/config' })
.execute();
if (result.success) {
console.log(`Success: ${result.stdout}`);
} else {
console.error(`Exit code: ${result.code}, Error: ${result.stderr}`);
}
Fluent Methods:
Command.create(bin) / new Command(bin): Start building a command for the given binary..arg(value) / .args([values]): Append command-line arguments..cwd(dir): Set the execution working directory..env({ KEY: VALUE }): Set or extend environment variables..inherit(): Direct stdout and stderr to the parent process terminal..usePowerShell(use, type): Force process execution through PowerShell (powershell.exe or pwsh) with safe quote escaping..execute(): Run the process asynchronously and return { stdout, stderr, code, success }.Helpers wrapping inquirer to prompt user inputs cleanly:
import { askConfirm, askInput, askChoice } from '@quatrain/cli';
// Yes/No Confirmations
const proceed = await askConfirm('Do you want to deploy now?');
// String Inputs
const name = await askInput('Enter your username:', 'default_user');
// Multi-choice select lists
const selected = await askChoice('Select action:', [
{ name: 'Sync Google Calendar', value: 'sync' },
{ name: 'Reset Database', value: 'reset' }
]);
A global CLI tool invoked via the core command (or quatrain depending on symlinks).
Install globally or run on-the-fly:
# Global
bun add -g @quatrain/cli
# Run on the fly
bunx @quatrain/cli <command>
core deployManage Kubernetes deployments (create, list, modify, promote, delete namespaces and manifests).
core generate scaffold <project-name>Initialize a new Quatrain project structure:
apps/, data/, config/, packages/, migrations/.package.json and a pre-configured tsconfig.json.core generate configStart an interactive wizard to generate the quatrain.json bootloader configuration file.
core generate migration <name>Scaffold a timestamped TypeScript migration file (e.g., migrations/20260427_name.ts) with template up() and down() blocks.
Recommendation: All text contents (logs, console prints, commit messages, comments) within the Quatrain ecosystem must be written in International English to ensure global team maintainability.