# Stella CLI — Policy Commands > **Audience:** Policy authors, reviewers, operators, and CI engineers using the `stella` CLI to interact with Policy Engine. > **Supported from:** `stella` CLI ≥ 0.20.0 (Policy Engine v2 sprint line). > **Prerequisites:** Authority-issued bearer token with the scopes noted per command (export `STELLA_TOKEN` or pass `--token`). > **2025-10-27 scope update:** CLI/CI tokens issued prior to Sprint 23 (AUTH-POLICY-23-001) must drop `policy:write`/`policy:submit`/`policy:edit` and instead request `policy:read`, `policy:author`, `policy:review`, and `policy:simulate` (plus `policy:approve`/`policy:operate`/`policy:activate` for promotion pipelines). --- ## 1 · Global Options & Output Modes All `stella policy *` commands honour the common CLI options: | Flag | Default | Description | |------|---------|-------------| | `--server ` | `https://stella.local` | Policy Engine gateway root. | | `--tenant ` | token default | Override tenant for multi-tenant installs. | | `--format ` | `table` for TTY, `json` otherwise | Output format for listings/diffs. | | `--output ` | stdout | Write full JSON payload to file. | | `--sealed` | false | Force sealed-mode behaviour (no outbound fetch). | | `--trace` | false | Emit verbose timing/log correlation info. | > **Tip:** Set `STELLA_PROFILE=policy` in CI to load saved defaults from `~/.stella/profiles/policy.toml`. --- ## 2 · Authoring & Drafting Commands ### 2.1 `stella policy new` Create a draft policy from a template or scratch. ``` stella policy new --policy-id P-7 --name "Default Org Policy" \ --template baseline --output-path policies/P-7.stella ``` Options: | Flag | Description | |------|-------------| | `--policy-id` *(required)* | Stable identifier (e.g., `P-7`). | | `--name` | Friendly display name. | | `--template` | `baseline`, `serverless`, `blank`. | | `--from` | Start from existing version (`policyId@version`). | | `--open` | Launches `$EDITOR` after creation. | Writes DSL to local file and registers draft version (`status=draft`). Requires `policy:write`. ### 2.2 `stella policy edit` Open an existing draft in the local editor. ``` stella policy edit P-7 --version 4 ``` - Auto-checks out latest draft if `--version` omitted. - Saves to temp file, uploads on editor exit (unless `--no-upload`). - Use `--watch` to keep command alive and re-upload on every save. ### 2.3 `stella policy lint` Static validation without submitting. ``` stella policy lint policies/P-7.stella --format json ``` Outputs diagnostics (line/column, code, message). Exit codes: | Code | Meaning | |------|---------| | `0` | No lint errors. | | `10` | Syntax/compile errors (`ERR_POL_001`). | | `11` | Unsupported syntax version. | ### 2.4 `stella policy compile` Emits IR digest and rule summary. ``` stella policy compile P-7 --version 4 ``` Returns JSON with `digest`, `rules.count`, action counts. Exit `0` success, `10` on compile errors. --- ## 3 · Lifecycle Workflow ### 3.1 Submit ``` stella policy submit P-7 --version 4 \ --reviewer user:kay --reviewer group:sec-reviewers \ --note "Simulated against golden SBOM set" \ --attach sims/P-7-v4-vs-v3.json ``` Requires `policy:submit`. CLI validates that lint/compile run within 24 h and bundle attachments exist. ### 3.2 Review ``` stella policy review P-7 --version 4 --approve \ --note "Looks good; ensure incident playbook updated." ``` - `--approve`, `--request-changes`, or `--comment`. - Provide `--blocking` to mark comment as blocking. - Requires `policy:review`. ### 3.3 Approve ``` stella policy approve P-7 --version 4 \ --note "Determinism CI green; simulation diff attached." \ --attach sims/P-7-v4-vs-v3.json ``` Prompts for confirmation; refuses if approver == submitter. Requires `policy:approve`. ### 3.4 Activate ``` stella policy activate P-7 --version 4 --run-now --priority high ``` - Optional `--scheduled-at 2025-10-27T02:00:00Z`. - Requires `policy:activate` and `policy:run`. **Options** - `--version ` (required) – target revision to promote. - `--note ` – record an activation note alongside the approval. - `--run-now` – enqueue an immediate full run after activation. - `--scheduled-at ` – schedule activation for a specific UTC time (ISO-8601 format). - `--priority