fix(kyberforge): run the repo-pinned apm from apm-workflow

apm-workflow spelled every command as bare apm, which in a repo that pins
apm with uv runs whatever is on PATH, possibly an apm that refuses the
repo's lockfile. Add a step that checks for the pin and runs
uv run --frozen apm there, and the PATH apm otherwise. apm-orchestrate's
version check now probes the same apm.

Bring the references level with apm 0.39.3: the Copilot marketplace
output profile, get_effective_type() still ignoring the declared type,
plain apm audit's exit codes, the uv form of the CI example, and audit
--ci needing an apm at least as new as the lock's writer. Bump
metadata.version to 1.0.4.

Refs: #273

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
This commit is contained in:
Defame1297andClaude Opus 5.5 committed 2026-12-02 11:59:17 +00:00
1 parent b81af32425
commit 0fb106b731
7 files changed
+63 -11

No files matched your search

@@ -4,6 +4,9 @@ source_keys:
- context7-microsoft-apm
- context7-websites-code-claude
- claude-code-plugins-docs
- apm-v0-39-3-source
- apm-v0-39-3-docs
- apm-cli-0-39-3-uv-experiments
---
## `apm audit`
@@ -14,7 +17,7 @@ apm audit --ci # CI gate: lockfile consistency + drift replay + pol
apm audit --file <path> # standalone: scan an arbitrary file
```
Exit code `0` on success, `1` on any violation — composes as a normal CI gate step. It does not replace general lint/test/security-scan CI steps, it sits alongside them.
`apm audit --ci` exits `0` when every check passes and `1` when any fails, so it composes as a normal CI gate step. Plain `apm audit` exits `0` when clean, `1` on a critical finding and `2` on warnings only. It does not replace general lint/test/security-scan CI steps, it sits alongside them.
## Policy checks
@@ -46,6 +49,10 @@ jobs:
`-f sarif --output <file>` emits SARIF for GitHub Code Scanning's inline PR annotations.
In a repo that pins apm with uv, replace the `pip install` step with `uv sync --frozen` and run each apm step as `uv run --frozen apm …`, so CI runs the repo's own apm.
The apm that runs `apm audit --ci` must be at least as new as the newest apm that wrote `apm.lock.yaml`: it fails on lockfile fields it does not know, where plain `apm audit` only warns.
## Frozen installs
`apm install --frozen` fails instead of silently re-resolving if the lockfile is out of date — the CI equivalent of `npm ci` vs `npm install`. Use in any CI job that must not be allowed to drift the lockfile.
@@ -2,6 +2,7 @@
topic: compile
source_keys:
- context7-microsoft-apm
- apm-cli-0-39-3-experiments
---
## Compile
@@ -12,7 +13,7 @@ apm compile --clean # zero-write sanity check; use for skill/agent-o
apm compile --clean --dry-run # pure preview, no writes
```
Compiles `.apm/instructions/` + `.apm/agents/*.agent.md` primitives into consumer-side context files (AGENTS.md/CLAUDE.md CONTEXT files) for the deployment target, per the `compilation:` block in `apm.yml`. This is the consumer/deployment side — it is NOT the producer of `plugin.json`/`marketplace.json`; that's `apm pack`'s job (below). Run `apm compile` after any change to `.apm/instructions/`/`.apm/agents/` content or to `compilation:`/`targets:` in `apm.yml`. To author an instructions file, use `instructions-author` — it covers which fields each target drops. `apm compile` never reads `.apm/prompts/`; to author a prompt file, use `prompt-author` — verification there is a throwaway `apm install`.
Compiles `.apm/instructions/` + `.apm/agents/*.agent.md` primitives into consumer-side context files (AGENTS.md/CLAUDE.md CONTEXT files) for the deployment target, per the `compilation:` block in `apm.yml`. For the `claude` target, apm 0.38 and later write the instructions into `AGENTS.md` and a `CLAUDE.md` that only imports it (`@AGENTS.md`). This is the consumer/deployment side — it is NOT the producer of `plugin.json`/`marketplace.json`; that's `apm pack`'s job (below). Run `apm compile` after any change to `.apm/instructions/`/`.apm/agents/` content or to `compilation:`/`targets:` in `apm.yml`. To author an instructions file, use `instructions-author` — it covers which fields each target drops. `apm compile` never reads `.apm/prompts/`; to author a prompt file, use `prompt-author` — verification there is a throwaway `apm install`.
## Pack
@@ -63,5 +64,5 @@ Executes a named script defined under `scripts:` in `apm.yml`, with `--param` su
## Gotchas
- Plain `apm compile` HARD-FAILS with exit 1 and `No instruction files found in .apm/ directory` on any package that has skills/agents but no `.apm/instructions/` content — the common case for a skill-only or skill+agent package. Use `apm compile --clean` as the zero-write sanity-check substitute: it sets `allow_empty=True` internally and exits 0 cleanly with zero writes; add `--dry-run` for a pure preview. `compile` ≠ `pack` — see above.
- Plain `apm compile` HARD-FAILS with exit 1 and `No instruction files found in .apm/ directory` (re-run on apm 0.39.3) on any package that has skills/agents but no `.apm/instructions/` content — the common case for a skill-only or skill+agent package. Use `apm compile --clean` as the zero-write sanity-check substitute: it sets `allow_empty=True` internally and exits 0 cleanly with zero writes; add `--dry-run` for a pure preview. `compile` ≠ `pack` — see above.
- `claude plugin validate --strict` auto-scans every `.md` file directly under a compiled plugin's `agents/` directory and treats it as an agent definition requiring frontmatter, independent of any manifest declaration (an empirically observed Claude Code platform behavior, not an `apm` mechanic). A non-agent `.md` file (notes, provenance record, README) that ends up under `.apm/agents/` in the source tree will still fail validation once compiled to the `claude` target. Keep such files outside `.apm/agents/` (e.g. at the package root), regardless of what `apm.yml` declares.
@@ -2,6 +2,7 @@
topic: configure
source_keys:
- context7-microsoft-apm
- apm-v0-39-3-source
---
## Scaffolding a new package
@@ -90,6 +91,6 @@ apm config set registry.corp-main.default true
## Gotchas
- `apm.yml`'s `type:` field validates nothing about `.apm/`. It selects processing: `instructions` compiles to AGENTS.md only, `skill` installs a native skill only, `prompts` emits commands only, `hybrid` does both (see `apm_cli/models/validation.py`, `PackageContentType`). apm checks only that the value parses to one of those four strings; no check anywhere compares it against the primitives actually on disk, and no mismatch diagnostic exists. A package declaring `type: instructions` while shipping `.apm/skills/` therefore raises no error — the mismatch resolves silently, either by omitting that primitive from the install/compile output or, in apm 0.28.0 where `get_effective_type()` routes off the on-disk layout and never reads the declared field, by ignoring the declared value outright. Both directions are silent: `apm install` and `apm compile` can exit 0 having shipped none of the primitives you expected. Set `type:` to cover every primitive the package ships, and confirm the deployed output rather than the exit code.
- `apm.yml`'s `type:` field validates nothing about `.apm/`. It selects processing: `instructions` compiles to AGENTS.md only, `skill` installs a native skill only, `prompts` emits commands only, `hybrid` does both (see `apm_cli/models/validation.py`, `PackageContentType`). apm checks only that the value parses to one of those four strings; no check anywhere compares it against the primitives actually on disk, and no mismatch diagnostic exists. A package declaring `type: instructions` while shipping `.apm/skills/` therefore raises no error — the mismatch resolves silently, either by omitting that primitive from the install/compile output or, in apm 0.28.0 and still in 0.39.3, where `get_effective_type()` routes off the detected package layout and never reads the declared field, by ignoring the declared value outright. Both directions are silent: `apm install` and `apm compile` can exit 0 having shipped none of the primitives you expected. Set `type:` to cover every primitive the package ships, and confirm the deployed output rather than the exit code.
- `apm experimental enable registries` must run before any `registry.*` config takes effect. Declaring a `registries:` block or running `apm config set registry.*` without it silently does nothing — no error, no warning.
- `apm plugin init <name>` run with a positional name argument, from inside a directory already named `<name>`, creates a wrongly-nested `<name>/<name>/` subdirectory — it treats the positional arg as "create a new project directory named X," not "confirm the current directory is X." Fix: omit the positional argument entirely when already cd'd into the target package directory — run `apm plugin init --yes --target claude,copilot` instead.
@@ -5,6 +5,7 @@ source_keys:
- context7-websites-code-claude
- claude-code-plugins-docs
- apm-github-repo
- apm-v0-39-3-source
---
## Building a marketplace from a producer repo
@@ -114,6 +115,6 @@ hook.
## Gotchas
- `apm marketplace add` and `apm marketplace package add` point in opposite directions and are easy to conflate: `add` registers someone else's catalog for you to *consume*; `package add` registers a package by remote reference (`owner/repo`, host URL, or full URL) into a marketplace you are *building*. `package add` does not accept a local path — register a local package by hand-editing `marketplace.packages[]`, as above.
- Only `claude` and `codex` marketplace output profiles exist in apm 0.28.0 — confirmed via source (`apm_cli/marketplace/output_profiles.py`: `MARKETPLACE_OUTPUTS = {claude: ..., codex: ...}`, nothing else). There is no native Copilot marketplace output; `apm pack` will not generate one. A repo needing a Copilot-consumable marketplace manifest must maintain it separately by other means.
- The marketplace output profiles depend on the apm version. apm 0.39.3 has three, `claude` (`.claude-plugin/marketplace.json`), `codex` (`.agents/plugins/marketplace.json`) and `copilot` (`.github/plugin/marketplace.json`), confirmed in `apm_cli/marketplace/output_profiles.py`. apm 0.28.0 had only `claude` and `codex`, so an older apm cannot emit a Copilot marketplace manifest. Add the output under `marketplace.outputs` only once every apm that packs the repo has it.
- A package/plugin `name` compiling to the `claude` target must avoid Claude Code's reserved name prefixes/values — `anthropic-*`, `claude-*`, `agent-skills`, `official-claude-plugins` — otherwise the compiled `.claude-plugin/marketplace.json` is rejected by Claude Code's validator. This is a Claude Code platform constraint, independent of how the manifest gets authored.
- Removing a package from `marketplace.packages[]` in `apm.yml` and re-packing changes the public/consumed catalog. Confirm with the user in conversation before removing the entry and running `apm pack` — this is a normal `apm.yml` edit (not a distinct apm-orchestrate operation with its own gate), so the confirmation is conversational, the same as any other consequential manifest edit.
@@ -11,7 +11,7 @@
## apm-github-repo
- **URL:** https://github.com/microsoft/apm
- **Description:** APM's own Python source (`src/apm_cli/`), read directly for schema and compile-mapping ground truth where Context7's doc snippets were thin. Backs the marketplace output-profile claim (`apm_cli/marketplace/output_profiles.py` — only `claude` and `codex` profiles exist, so there is no native Copilot marketplace output) and the `apm pack --check-clean`/`--check-versions` semantics.
- **Description:** APM's own Python source (`src/apm_cli/`), read directly for schema and compile-mapping ground truth where Context7's doc snippets were thin. Backs the `apm pack --check-clean`/`--check-versions` semantics, and the 0.28.0 marketplace output profiles (`claude` and `codex` only).
- **Research doc:** plugins/kyberforge/docs/research/docs/microsoft-apm/sources.md
- **Contributing files:** references/marketplace.md
- **Status:** `extracted`
@@ -39,3 +39,35 @@
- **Research doc:** plugins/kyberforge/docs/research/docs/claude-code-plugins/sources.md
- **Contributing files:** (none)
- **Status:** `referenced`
## apm-v0-39-3-source
- **URL:** https://github.com/microsoft/apm/tree/v0.39.3/src/apm_cli
- **Description:** apm source at tag v0.39.3, read from the pinned install: the three marketplace output profiles in `marketplace/output_profiles.py`, `get_effective_type()` in `integration/skill_package_routing.py` still routing off the detected package layout, and the `apm audit` exit codes.
- **Research doc:** plugins/kyberforge/docs/research/docs/microsoft-apm/sources.md (digest: plugins/kyberforge/docs/research/docs/microsoft-apm/cli-reference.md)
- **Contributing files:** references/marketplace.md, references/configure.md, references/audit.md
- **Status:** `extracted`
## apm-v0-39-3-docs
- **URL:** https://github.com/microsoft/apm/tree/v0.39.3/docs/src/content/docs
- **Description:** apm docs at tag v0.39.3: `apm audit --ci` refusing lockfile fields it does not know, so the auditing apm must be at least as new as the lock's writer.
- **Research doc:** plugins/kyberforge/docs/research/docs/microsoft-apm/sources.md (digest: plugins/kyberforge/docs/research/docs/microsoft-apm/lockfile-and-compatibility.md)
- **Contributing files:** references/audit.md
- **Status:** `extracted`
## apm-cli-0-39-3-uv-experiments
- **URL:** https://pypi.org/project/apm-cli/0.39.3/
- **Description:** Throwaway uv projects pinning apm-cli 0.39.3. Grounds the pinned invocation `uv run --frozen apm` in `SKILL.md` Step 2 and in the CI note, and the need for one online `uv sync --frozen` per machine.
- **Research doc:** plugins/kyberforge/docs/research/docs/microsoft-apm/sources.md (digest: plugins/kyberforge/docs/research/docs/microsoft-apm/installation.md)
- **Contributing files:** SKILL.md, references/audit.md
- **Status:** `extracted`
## apm-cli-0-39-3-experiments
- **URL:** https://pypi.org/project/apm-cli/0.39.3/
- **Description:** The repo-pinned apm-cli 0.39.3 run in throwaway packages outside the repo (holocron#273): the Claude compile writing a `CLAUDE.md` that imports `AGENTS.md`, and a skills-only package's plain compile still exiting 1 while `--clean` exits 0.
- **Research doc:** plugins/kyberforge/docs/research/docs/microsoft-apm/sources.md (digest: plugins/kyberforge/docs/research/docs/microsoft-apm/instructions-gotchas.md)
- **Contributing files:** references/compile.md
- **Status:** `extracted`