Skip to content

apm policy

Diagnostic surface for the policy enforcement layer. Lets admins and CI pipelines verify what apm-policy.yml was discovered, how fresh the cache is, the resolved extends: chain, and the count of effective rules — without running a full apm install or apm audit.

Terminal window
apm policy status [--policy-source SOURCE] [--no-cache]
[-o table|json] [--json] [--check]

apm policy groups diagnostic subcommands for the organization-level policy APM resolves at install / audit time. Today the group exposes a single subcommand, status.

The command is always exit 0 by default. Discovery failures are reported in the output (table or JSON), never via process exit code, so it stays safe for human inspection and SIEM ingestion. Pass --check to opt into a CI-friendly contract that exits 1 when no usable policy is resolved.

For the apm-policy.yml schema and enforcement model, see Policy reference.

Render a diagnostic snapshot of the active APM policy: discovery outcome, source, enforcement level, cache age, resolved extends: chain, and effective rule counts.

Terminal window
apm policy status [OPTIONS]
FlagDescription
--policy-source SOURCEOverride discovery. Accepts org (auto-discover from the project’s git remote), owner/repo (defaults to github.com), an https:// URL, or a local file path.
--no-cacheForce a fresh fetch; skip the policy cache.
-o, --output {table,json}Output format. Default: table.
--jsonEmit JSON. Alias of -o json.
--checkExit 1 when no usable policy is resolved (any outcome other than found). Default exit is always 0.

The table and JSON renderers expose the same fields:

FieldMeaning
outcomeDiscovery result: found, absent, disabled, no_git_remote, cache_miss_fetch_fail, …
sourceResolved source label (e.g. org:owner/repo, url:https://..., file:./path).
enforcementEffective enforcement mode: block, warn, or off.
cache_age_humanAge of the cached policy entry, with stale / refresh-failure context.
cache_stale, cached, cache_age_secondsRaw cache state (JSON only).
extends_chainResolved extends: ancestors of the leaf policy.
rule_summaryHuman one-liners for non-empty rule axes.
rule_countsPer-axis integer counts. -1 means “no opinion” (allow-list omitted); 0 means “explicitly empty”. JSON only.
fetch_error, errorPopulated when discovery or refresh failed.
Modeoutcome=foundAnything else
default00
--check01

To gate on rule violations rather than resolvability, use apm audit --ci instead.

Terminal window
# Show resolved policy state for the current project
apm policy status
# Force a fresh fetch (bypass cache)
apm policy status --no-cache
# Machine-readable JSON for SIEM or CI inspection
apm policy status --json
# Inspect a draft policy without committing it
apm policy status --policy-source ./draft-policy.yml
# Inspect an explicit org policy by repo
apm policy status --policy-source acme-corp/apm-policies
# CI pre-check: fail the job when no usable policy is resolved
apm policy status --check

Sample table output:

APM Policy Status
-----------------
Outcome found
Source org:acme-corp/apm-policies
Enforcement block
Cache age 4m ago
Extends chain acme-corp/apm-baseline
Effective rules 3 dependency denies; 2 mcp denies; 1 required manifest fields
  • apm install — enforces policy during dependency resolution; honors --no-policy to bypass.
  • apm audit — gate on rule violations with --ci; complements apm policy status --check.
  • Policy reference — canonical apm-policy.yml schema and enforcement semantics.
  • Governance overview — how policy fits the broader enterprise governance model.
  • APM policy: getting started — author and publish your first apm-policy.yml.
  • Enforce in CI — wire audit and policy status into pipelines.