v1.0.6 · Now Available

Ship Healthier Code.

project-healthy · TypeScript CLI · MIT

An AI-powered health score for your repositories. Scan, fix, review, and track the quality of your codebase — all from the terminal.

$ npm install -g project-healthy
8
Modules
0–100
Health Score
AI
Powered
Repos
Explore Commands
CLI Reference

Every Command,
Documented.

Hover any card to see detailed usage, flags, and examples.

🚀
ph init Setup
Bootstrap project-healthy in any repository
Creates a .ph-cache/ directory, generates a default project-health.config.ts, installs a post-commit git hook, and drops you into an interactive shell. Running ph scan without prior init will auto-run this step.
--skip-hook --config <path>
🔍
ph scan Core
Run all 8 analysis modules in parallel
Produces a weighted health score from 0–100 across CI/CD, code quality, docs, flakiness, security, PR complexity, environment integrity, and build performance.
-m <module-id> --output json|html|sarif --fail-under <n> -w (watch)
📊
ph score Quick
Print the cached score from last scan
No re-analysis. Reads the result from .ph-cache/ and prints the aggregate score along with per-module breakdown instantly.
--json --verbose
ph ci-check CI
Fast critical-only scan for build pipelines
Runs only security and environment modules by default with a 60-second timeout. Built to fail fast inside your CI pipeline without the full scan overhead.
--modules <ids> --timeout <ms> --fail-under <n>
🔀
ph diff Delta
Compare branch against main, scope to changed files
Detects which files changed versus main and runs only the relevant modules. Reports an impact score, new findings, and resolved issues compared to baseline.
--base <branch> --json
📈
ph trend History
Score history with sparkline chart in terminal
Renders a sparkline trajectory of your health score over time directly in the terminal. See whether your codebase is improving or degrading commit by commit.
--limit <n> --json
AI
🤖
ph chat AI REPL
Interactive AI chat about your codebase
Launches a REPL with RAG-backed context from your AST index. Answers reference specific files and line numbers. Supports one-shot mode: ph chat "explain the auth flow".
--full-context "<question>"
AI
🔎
ph review AI Review
AI code review for local diffs or GitHub PRs
Analyzes your staged diff or a specific GitHub PR number. Provides a senior-level review with targeted findings. Can post the review directly as a GitHub PR comment.
--pr <number> --post --json
AI
📝
ph brief Onboarding
Generate ONBOARDING.md for new developers
Analyzes file structure, entry points, code ownership from git history, and complexity indicators. Uses AI to write a comprehensive onboarding guide into ONBOARDING.md.
--update (git hook) --output <path>
📦
ph context Export
Pack repo into LLM-ready XML context file
Exports directory structure, file contents, git diffs, and recent commits into a single XML optimised for LLM consumption. Supports splitting large repos into multiple files.
--split --max-size <mb> --include <glob>
🗺️
ph explore Web UI
Interactive browser UI with file heat map
Opens a web browser with a file tree heat map (hot red → cold green based on activity), clickable commit history with inline diffs, and an overview tab with module scores and top findings.
--port <n> --no-open
📡
ph dashboard Live
Real-time web dashboard with live updates
Circular health gauge, module bars, severity-sorted findings, priority actions. Uses server-sent events for live push updates. File watcher auto-rescans on save.
--port <n> --no-watch
AI
🔧
ph fix Self-Heal
Auto-fix findings from the last scan
Interactive mode: pick findings to fix. Auto mode: fixes top critical issues. AI mode handles complex fixes like JSDoc generation, complexity refactoring, dead code removal. Commit to new branch with --commit.
--auto --ai --dry-run --commit
⚙️
ph config Config
View, set config values or run setup wizard
ph config wizard — interactive setup for modules, scoring weights, complexity thresholds, and API tokens. ph config get <key> / ph config set <key> <val> for individual values.
wizard get <key> set <key> <val>
🔐
ph auth Auth
Manage authentication via OS keychain
ph auth login stores a JWT in your OS keychain. ph auth logout removes it. ph auth status checks if you're currently authenticated.
login logout status
💻
ph shell REPL
Interactive REPL for all ph commands
Launched automatically after ph init. All commands work inside the shell without the ph prefix. Type help to list commands and exit to quit.
help exit
Analysis Engine

8 Modules.
Every Angle Covered.

Each module independently scores a dimension of repository health. Run all in parallel or target a specific one with -m.

🔄
CI/CD Pipeline
M-01 · cicd
Code Quality
M-02 · quality
📚
Documentation
M-03 · docs
🎲
Test Flakiness
M-04 · flakiness
🛡️
Dependency Security
M-05 · security
🔀
PR Complexity
M-06 · prComplexity
🔏
Environment & Secrets
M-07 · environment
Build Performance
M-08 · buildPerf
88
Health Score

Know Your Baseline.

The health score is a weighted average across all 8 modules. Each finding is categorised by severity and contributes to the final result. Track it over time with ph trend.

terminal — project-healthy
$ph scan
⠦ Running 8 modules in parallel…
─────────────────────────────
CI/CD 92
Code Quality 85
Docs 71
Flakiness 96
Security 89
PR Complexity 88
Environment 94
Build Perf 80
─────────────────────────────
Overall Score 88 / 100
Artificial Intelligence

AI That Understands
Your Codebase.

Four AI-powered commands backed by RAG, AST indexing, and your preferred LLM.

💬
ph chat
RAG-powered REPL with AST context. Ask anything about your code.
Pulls file-level and line-level context from your AST index. One-shot: ph chat "explain auth flow". Full-context mode loads the entire repo for richer answers.
🔬
ph review
Senior-level AI code review for diffs or PRs. Post directly to GitHub.
Analyzes diff context and produces targeted findings. With --post it comments the review directly on the GitHub PR.
📋
ph brief
Auto-generate an ONBOARDING.md for any repository.
Uses git history for ownership analysis, entry-point detection, and complexity indicators to create a rich developer guide. Stays fresh with --update.
🔩
ph fix --ai
Self-healing engine. AI fixes JSDoc, complexity, dead code.
Standard mode fixes lint and simple issues. With --ai it handles complex refactors. Use --dry-run to preview every change before it's applied.

Start shipping
healthier code.

One command to install. One command to scan. Instantly know where your repo stands.

↗ View on GitHub Browse Commands