CLI Reference
The kiw CLI is the unified entry point for the entire Krewire ecosystem. It drives all eight project kinds (app, cli, site, book, worker, service, gateway, infra) behind one binary and one configuration file (krewire.yaml).
kiw dogfoods Krewire's own pkg/tui and pkg/term libraries, ensuring zero external dependencies, near-instant startup times (<2ms), and consistent POSIX exit code discipline.
What is in this Chapter?
Detailed documentation of every kiw command: flags, usage syntax, supported workloads, and execution behavior.
Comprehensive specification of the krewire.yaml schema: project metadata, build targets, dev server ports, and workload-specific blocks.
Define custom pipeline tasks, test scripts, and build chains directly in krewire.yaml with cross-platform argument forwarding.
Global Options & Environment Variables
Every kiw command respects the following global flags and environment variable overrides:
| Flag / Variable | Type | Default | Description |
|---|---|---|---|
--help, -h |
Boolean | false |
Display command usage and flag descriptions. |
--verbose, -v |
Boolean | false |
Enable verbose debug output and diagnostics. |
--addr |
String | :8080 |
Listen address for krew serve/krew dev; overrides any port declared in krewire.yaml. |
KIW_ENV |
String | local |
Active runtime environment (local, production, testing). |
KIW_DEBUG |
Flag | false |
Enable debug mode (1, true, or yes). |
NO_COLOR |
Flag | false |
Disable ANSI color sequences in accordance with the NO_COLOR standard. |
POSIX Exit Code Contract
kiw adheres to strict exit code standards across all commands (pkg/errs):
| Exit Code | Constant | Meaning |
|---|---|---|
0 |
ExitCodeSuccess |
Command completed successfully with zero errors. |
1 |
ExitCodeFailure |
General operational or execution failure (build failed, tests failed, runtime error). |
2 |
ExitCodeUsage |
Command-line syntax error (invalid flag, missing required argument, unknown command). |