$npx -y skills add pulumi/agent-skills --skill package-usageTrack which stacks across a Pulumi organization use a specific package and at what versions. Use for cross-stack audits, identifying outdated or unmaintained package versions across many stacks, finding affected stacks before publishing breaking changes to a component package, or
| 1 | ## API Reference |
| 2 | |
| 3 | Query the Pulumi Cloud API with the `pulumi api` CLI subcommand. It authenticates with your existing Pulumi credentials and returns JSON. |
| 4 | |
| 5 | ### Get the latest version of a package |
| 6 | |
| 7 | ``` |
| 8 | pulumi api /api/registry/packages -F name={package_name} -F orgLogin={orgName} |
| 9 | ``` |
| 10 | |
| 11 | Include `orgLogin` with the user's organization name. Omit `-F name=...` to list all packages visible to the organization (useful when the user has not named a specific package). The response contains a `packages` array. Each entry has a `version` field (the latest version), plus `name`, `publisher`, `source`, and `packageStatus`. |
| 12 | |
| 13 | ### Get stack usage for a package |
| 14 | |
| 15 | ``` |
| 16 | pulumi api /api/orgs/{orgName}/packages/usage -F packageName={package_name} |
| 17 | ``` |
| 18 | |
| 19 | Replace `{orgName}` with the org name from context, `PULUMI_ORG`, or ask the user. `packageName` is required; query one package at a time. |
| 20 | |
| 21 | Response fields: |
| 22 | - `packageName`: The queried package |
| 23 | - `stacks`: Array of `{stackName, projectName, version, lastUpdate}` |
| 24 | - `totalStacks`: Total count |
| 25 | |
| 26 | ## Workflow: Find outdated stacks |
| 27 | |
| 28 | Use when the user wants to know which stacks are using an outdated version of a package. |
| 29 | |
| 30 | 1. Get the latest version of the package |
| 31 | 2. Get stack usage for the package |
| 32 | 3. Compare each stack's `version` against the latest to identify outdated stacks |
| 33 | 4. Present results using the output format below |
| 34 | |
| 35 | ## Output Format |
| 36 | |
| 37 | Present results as a markdown table followed by a summary line: |
| 38 | |
| 39 | ``` |
| 40 | | Project | Stack | Current Version | Latest Version | Status | |
| 41 | |---------|-------|-----------------|----------------|--------| |
| 42 | | my-app | dev | 6.40.0 | 6.52.0 | Outdated | |
| 43 | | my-app | prod | 6.52.0 | 6.52.0 | Up-to-date | |
| 44 | |
| 45 | 2 of 2 stacks checked. 1 outdated. |
| 46 | ``` |
| 47 | |
| 48 | ## Out of scope: upgrading a specific stack |
| 49 | |
| 50 | This skill identifies outdated stacks. It does not perform the upgrade itself. For actually bumping a package version in a project — editing `package.json`, `requirements.txt`, `pyproject.toml`, `go.mod`, or `Pulumi.yaml`, running `pulumi preview`, and reconciling the diff — hand off to the `provider-upgrade` skill. |