# CLI

@policygrain/cli ships two commands: policygrain for project setup, documents and live verification, and checkmydpdp for zero-dependency public DPDP website scans.

## Install @policygrain/cli

```bash
npx policygrain init --domain example.in
npx checkmydpdp https://example.in --json
```

## Commands

CLI subcommands

| Command | What it does |
| --- | --- |
| policygrain init [--domain <d>] [--dir <path>] | Creates .policygrain.json, checks POLICYGRAIN_API_KEY and prints next steps |
| checkmydpdp <url> [--json] [--poll] | Runs a CheckMyDPDP scan via POST /v1/scans and polls GET /v1/scans/{id} |
| policygrain scan <url> [--json] | Alias for checkmydpdp <url>, attaching POLICYGRAIN_API_KEY when set |
| policygrain verify <site-id> | Triggers POST /v1/sites/{id}/verifications for a verified site |
| policygrain docs <profile-id> | Lists generated documents and publication URLs for a profile |

## Running in CI with narrow scopes

Create a dedicated key via POST /v1/keys with only the scopes your job uses (for example documents or sites:write), inject it as POLICYGRAIN_API_KEY in CI secrets, and pass --json for machine-readable output.
