|
| 1 | +--- |
| 2 | +title: "Operating installed context" |
| 3 | +description: "Day-to-day workflow for APM-managed projects: reproduce the lockfile in CI, see what is installed, diagnose environment problems. Maps every common operational question to the existing command." |
| 4 | +sidebar: |
| 5 | + order: 7 |
| 6 | +--- |
| 7 | + |
| 8 | +After `apm install` succeeds, the day-to-day operating questions are: what |
| 9 | +is installed, has anything drifted from the lockfile, and why is the |
| 10 | +environment broken when something fails. APM ships a command for each |
| 11 | +question -- this page maps the question to the command so you do not have |
| 12 | +to remember the flag matrix. |
| 13 | + |
| 14 | +## At a glance |
| 15 | + |
| 16 | +| You want to... | Run | Notes | |
| 17 | +|---|---|---| |
| 18 | +| Reproduce the lockfile exactly (CI gate) | `apm install --frozen` | Refuses to install when `apm.lock.yaml` is missing or out of sync with `apm.yml`. Equivalent in spirit to `npm ci` / `pnpm install --frozen-lockfile`. | |
| 19 | +| Refresh refs and rewrite the lockfile | `apm update` (or `apm update --yes` for CI) | Restructures the dependency graph against latest matching refs. | |
| 20 | +| Validate lockfile integrity for CI | `apm audit --ci` | Lockfile-consistency check + on-disk integrity. Pair with `--format sarif --output audit.sarif` for GitHub Code Scanning. | |
| 21 | +| See what is installed | `apm deps list` | Project scope. Add `--global` for `~/.apm/`. | |
| 22 | +| Inspect the dependency tree | `apm deps tree` | Hierarchical view of direct + transitive deps. | |
| 23 | +| Find out why a package is installed | `apm deps why <package>` | Reverse lookup -- "who pulled this in?". Add `--json` for scripts. | |
| 24 | +| See what is outdated | `apm outdated` | Locked refs vs latest matching upstream. | |
| 25 | +| Diagnose a broken environment | `apm doctor` | Aggregated pass/fail table: git, network, auth, gh CLI, and (if present) marketplace config. | |
| 26 | +| Inspect the cache | `apm cache info` | Disk usage and location. `apm cache clean` removes everything; `apm cache prune --days N` is incremental. | |
| 27 | +| Inspect resolved runtimes | `apm runtime status` | Active runtime and preference order. | |
| 28 | +| Inspect resolved targets | `apm targets` | Which harnesses APM will deploy to. Add `--json --all` to include meta-targets (e.g. `agent-skills`). | |
| 29 | +| Show package metadata | `apm view <package>` | Versions, refs, owner, declared scripts. | |
| 30 | + |
| 31 | +## Recommended CI block |
| 32 | + |
| 33 | +```yaml |
| 34 | +- run: apm install --frozen |
| 35 | +- run: apm audit --ci --format sarif --output apm-audit.sarif |
| 36 | +``` |
| 37 | +
|
| 38 | +The `--frozen` flag is the CI-safety primitive: if the lockfile is missing |
| 39 | +or has drifted from `apm.yml`, the install fails before producing any |
| 40 | +artifacts. `apm audit --ci` is then the integrity gate -- it validates that |
| 41 | +the locked content matches what was actually fetched. |
| 42 | + |
| 43 | +## Local refresh loop |
| 44 | + |
| 45 | +```bash |
| 46 | +apm update # refresh refs + rewrite the lockfile |
| 47 | +apm install # materialize the new lockfile |
| 48 | +apm audit # confirm integrity |
| 49 | +``` |
| 50 | + |
| 51 | +Use this when you intentionally want to take newer upstream refs. The |
| 52 | +lockfile change is the auditable record of the upgrade. |
| 53 | + |
| 54 | +## When something is broken |
| 55 | + |
| 56 | +The first stop for "I installed but it does not work" or "CI passes |
| 57 | +locally but fails on the runner" is `apm doctor`. It runs a bounded set of |
| 58 | +environment checks (git on PATH, github.com reachable, auth token |
| 59 | +detected, gh CLI present, optionally marketplace config) and renders a |
| 60 | +pass/fail table with a single non-zero exit code if a critical check |
| 61 | +fails. |
| 62 | + |
| 63 | +```bash |
| 64 | +apm doctor # quick pass/fail table |
| 65 | +apm doctor --verbose # plus detail per check |
| 66 | +``` |
| 67 | + |
| 68 | +For more targeted introspection: |
| 69 | + |
| 70 | +- `apm cache info` -- is the cache writable, how large is it |
| 71 | +- `apm runtime status` -- is the expected runtime installed |
| 72 | +- `apm config` -- is the configuration parseable, what is active |
| 73 | +- `APM_DEBUG=1 apm install --dry-run -v` -- full resolution trace |
| 74 | + |
| 75 | +## Vocabulary mapping for users coming from other ecosystems |
| 76 | + |
| 77 | +If you reach for a verb from another package manager and APM does not |
| 78 | +have it, the equivalent is almost always already in the table above. |
| 79 | +Common translations: |
| 80 | + |
| 81 | +| Other ecosystem | APM equivalent | |
| 82 | +|---|---| |
| 83 | +| `npm ci` | `apm install --frozen` | |
| 84 | +| `npm audit` | `apm audit` | |
| 85 | +| `npm why <pkg>` / `yarn why <pkg>` | `apm deps why <pkg>` | |
| 86 | +| `pnpm install --frozen-lockfile` | `apm install --frozen` | |
| 87 | +| `uv sync` | `apm install` (or `apm install --frozen` for the CI form) | |
| 88 | +| `uv lock --check` | `apm audit --ci` | |
| 89 | +| `cargo tree -i <pkg>` | `apm deps why <pkg>` | |
| 90 | +| `brew doctor` / `flutter doctor` | `apm doctor` | |
| 91 | +| `pip check` | `apm audit` | |
0 commit comments