Observed since 21 Oct, 09:31 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
AI-first CLI debugger with safe simulation, code-aware fixes, and LangChain support for OpenAI and Ollama.
why helps you understand what a terminal command will do, what went wrong, and what to try next.
It can:
Global install:
npm install -g @0xprathamesh/why-cli
Local development:
npm install
npm run build
npm link
After that, the why command is available from any folder.
Package name on npm:
@0xprathamesh/why-cli
Repository name on GitHub:
why
The install package is scoped, but the CLI command is still just:
why
Build the image:
docker build -t why-cli .
Show help from the container:
docker run --rm why-cli --help
Run a command through why inside the container:
docker run --rm why-cli --simulate -- git push origin main
If you want to use your current project inside the container:
docker run --rm -it -v "$PWD:/workspace" -w /workspace why-cli -- npm run build
If you want AI config inside Docker, pass env values or an env file:
docker run --rm --env-file .env why-cli --doctor
Run a normal command:
why -- npm run build
Simulate a risky command:
why --simulate -- git push origin main
Run a command for real even if auto mode would simulate it:
why --run -- git init
Check AI setup:
why --doctor
Interactive setup:
why --setup
For every command, why-cli goes through this pipeline:
command -> classify -> risk -> simulate/run -> analyze -> explain
That means:
auto modeauto modewhy-cli adds an AI explanation on topwhy-cli has 3 execution modes.
autoDefault mode.
Example:
why npm run build
why git init
why rm test.txt
runRuns the command for real.
why --run -- git init
why --run -- rm test.txt
simulateNever runs the real command. It only does a safe preview when supported.
why --simulate -- git add .
why --simulate -- npm install express
why --simulate -- mkdir demo-folder
If you run:
why git init
you may see simulation output instead of actual execution. That is expected in auto mode.
If you want the real command to run, use:
why --run -- git init
You can configure AI once and stop passing keys or model flags every time.
Recommended:
why --setup
This writes config to:
~/.config/why-cli/.env
You can also create that file manually.
Example:
WHY_PROVIDER=ollama
OPENAI_API_KEY=
OPENAI_MODEL=gpt-4.1
OPENAI_BASE_URL=https://api.openai.com/v1
OLLAMA_HOST=http://127.0.0.1:11434
OLLAMA_MODEL=gemma3:4b
WHY_SKILL=debug,fix
Supported config locations:
.env.local in the current folder.env in the current folder.env.local in parent folders.env in parent folders~/.config/why-cli/.env~/.envCheck provider health:
why --doctor
Supported providers:
autoopenaiollamanoneExamples:
why --provider openai --explain -- npm test
why --provider ollama --model gemma3:4b -- npm run build
why --provider none -- npm start
Run commands:
why -- npm run build
why -- npm start
why -- python3 script.py
why node -v
why npm -v
why cat README.md
Simulate commands:
why --simulate -- git add .
why --simulate -- git commit -m "test"
why --simulate -- git push
why --simulate -- npm install
why --simulate -- npm install express
why --simulate -- npm publish
why --simulate -- rm test.txt
why --simulate -- mkdir test-folder
why --simulate -- touch demo.txt
Run risky commands for real:
why --run -- git init
why --run -- git commit -m "ship"
why --run -- npm publish
Missing package:
why --simulate -- npm install some-invalid-package-xyz
Missing file:
why --simulate -- rm non-existing-file
why --simulate -- git add non-existing-file
Existing directory:
mkdir existing-folder
why --simulate -- mkdir existing-folder
Wrong Git push target:
why --simulate -- git push origin wrong-branch
Bad build:
why --explain -- npm run build
why-cli can stream logs for servers, watchers, and dev processes.
Examples:
why -- npm start
why --stream -- npm run dev
why --no-stream -- npm run build
Use:
--stream to force live logs--no-stream to wait until the command exitsCtrl+C to stop the child processWhen an error points to files in your project, why-cli can read local code context and include it in the explanation.
That helps with cases like:
This is most useful when you run why inside the project that failed.
Skills shape how the AI explains the result.
Built-in skills:
debugteachfixtestssecurityperfExamples:
why --skill debug --skill fix -- npm run build
why --provider ollama --skill teach -- python3 script.py
why --list-skills
You can also set default skills in your config:
WHY_SKILL=debug,fix
-h, --help
-v, --version
-s, --silent
--json
--no-color
-r, --raw
-e, --explain
--mode <auto|run|simulate>
--simulate
--run
--execute
--provider <auto|none|openai|ollama>
--model <name>
--cwd <path>
--timeout <ms>
--skill <name>
--list-skills
--doctor
--setup
--stream
--no-stream
--api-key <key>
--api-key-env <name>
--openai-base-url <url>
--ollama-host <url>
cd cannot change your parent shell session through why-cli.auto mode, risky commands are often simulated instead of executed.-- before the command.Example:
why -- node -v
why --simulate -- git status
GitHub Actions is included.
CI workflow:
.github/workflows/ci.ymlmain and on pull requests18 and 20npm cinpm run buildnpm pack --dry-runRelease workflow:
.github/workflows/release.ymlv1.1.0Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 1.1.1Registry latest | 4 Apr 2026 | 5 |
This describes our collected data; it is not a security assessment.
Observed since 21 Oct, 09:31 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:752eeae68e34868999a406d04285d49f3bae4b85ef9fdd41b9a7a6825c885c34