Files
Holocron/plugins/kyberforge/docs/research/docs/microsoft-apm/testing-and-validation.md
T
Defame1297 1d07d1a76b docs(kyberforge): add Microsoft APM research reference set
Capture Microsoft's Agent Package Manager (APM) — overview, install,
config, CLI reference, registries/marketplace, monorepo shapes,
testing/validation, troubleshooting, and examples — as structured
reference docs under plugins/kyberforge/docs/research/docs/microsoft-apm/.

Lays the groundwork for issue #88 (build agents/skills to execute a
marketplace-to-APM conversion of this repo).
2026-08-10 17:06:07 +00:00

2.6 KiB

topic, source_keys
topic source_keys
testing-and-validation
context7-microsoft-apm

apm audit

APM's built-in validation/integrity tool, usable both locally and as a CI gate:

apm audit                  # local: scan deployed files for hidden Unicode
apm audit --ci             # CI gate: lockfile consistency + drift replay
apm audit --file <path>    # standalone: scan an arbitrary file

apm audit --ci runs baseline lockfile checks, install-replay drift detection (does a clean apm install reproduce what's on disk), and org policy checks. It returns exit code 0 on success and 1 on any violation, so it composes as a normal CI gate step. It's meant to sit alongside — not replace — existing lint/test/security-scan CI steps: it specifically covers AI agent configuration integrity, hidden-content scanning, lockfile verification, and policy enforcement, not general code correctness.

Policy checks

apm audit --ci auto-discovers an org policy from the git remote if --policy/--policy-source isn't given explicitly; --no-policy skips policy discovery for a single invocation. This lets an org centrally define required checks (e.g., which primitive types are allowed, required metadata fields) without every package repo repeating the config.

Marketplace ref validation

Separately from apm audit, apm marketplace check validates that every package reference declared in a marketplace's apm.yml actually resolves (correct path/ref, manifest present) before you build or publish — this is the step that catches a typo'd local path or a stale pinned tag before it ships.

CI integration example (GitHub Actions)

jobs:
  apm-audit:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      security-events: write
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with: { python-version: "3.12" }
      - run: pip install apm-cli==X.Y.Z  # pin to the version you standardize on
      - run: apm install
      - run: apm audit --ci -f sarif --output apm-audit.sarif
      - uses: github/codeql-action/upload-sarif@v3
        with: { sarif_file: apm-audit.sarif }

-f sarif --output <file> emits SARIF, which GitHub Code Scanning can ingest directly for inline annotations on PRs — useful if this repo's CI already surfaces findings that way.

Frozen installs

apm install --frozen (seen in the private-registry install flow) fails instead of silently re-resolving if the lockfile is out of date — the CI equivalent of npm ci vs npm install. Worth using in any CI job that shouldn't be allowed to drift the lockfile.