# pkgjson-cli

Inspect and query `package.json` files from the command line. A prettier, faster alternative to manually reading package.json or running `npm outdated`.

## Install

```bash
npm install -g pkgjson-cli
```

## Usage

### Pretty-print package.json

```bash
pkgjson
```

Displays name, version, description, license, author, dependency counts, and script counts in a clean format.

### List dependencies

```bash
pkgjson deps
```

Shows all dependencies (prod, dev, peer, optional) sorted alphabetically with version ranges.

### List scripts

```bash
pkgjson scripts
```

Shows all npm scripts defined in package.json.

### Query npm registry

```bash
pkgjson info <package>
```

Fetches and displays package info from the npm registry — latest version, license, homepage, maintainers, total versions.

### Check outdated dependencies

```bash
pkgjson outdated
```

Checks all prod and dev dependencies against the npm registry. Color-coded by update severity:
- **Red** — major update
- **Yellow** — minor update
- **Green** — patch update

### Estimate node_modules size

```bash
pkgjson size
```

Scans `node_modules` directory and reports total file count and disk usage.

## Flags

| Flag | Description |
|------|-------------|
| `--json` | Output as JSON (works with all commands) |
| `-d, --dir <path>` | Target a different directory |
| `-V, --version` | Show version |
| `-h, --help` | Show help |

## Examples

```bash
# JSON output for scripts
pkgjson --json scripts

# Check outdated in a specific project
pkgjson -d /path/to/project outdated

# Get registry info as JSON
pkgjson --json info react
```

## License

MIT
