diff --git a/.gitignore b/.gitignore index ecf6b9c..0d52c3e 100644 --- a/.gitignore +++ b/.gitignore @@ -48,16 +48,16 @@ apm_modules/ .claude/hooks/ # `apm pack` bundle output. The pre-push gate runs pack with --dry-run, so this -# only appears after a bare `apm pack` during a release; it is not repo content. +# only appears after a non-dry-run `apm pack` during a release; it is not repo content. build/ # `apm pack`'s manifest for the *root* package. Emitted beside the marketplace -# manifest by a bare `apm pack`, and never tracked on any branch — the repo's +# manifest by `apm pack` run with no flags, and never tracked on any branch — the repo's # own paths hide it, since the apm-pack-check-clean pre-push hook, the only # thing that runs pack here, passes --dry-run. It is NOT write-only output: # pack reads an existing copy back in preference to apm.yml and only rewrites # it with --force, so a stale copy leaks an old version and config into every -# bundle. Pack releases with `apm pack --force`, or delete this file first. Scoped +# bundle. Pack releases with `uv run --frozen apm pack --force`, or delete this file first. Scoped # to the file, not the directory: the sibling .claude-plugin/marketplace.json is # compiled output that IS committed and must stay tracked. /.claude-plugin/plugin.json diff --git a/AGENTS.md b/AGENTS.md index e120c6a..cc3edae 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -28,9 +28,10 @@ Fall back to raw shell only when no skill covers it. ## Session rules - **Do not add repo-owned keys to `.claude/settings.json`.** apm treats it as its own deployed artifact and `apm audit --ci` replays the install and diffs, so anything apm would not have written is permanent drift that fails the `apm-audit-ci` pre-push hook. A hook you want here is authored in `plugins//.apm/hooks/` and deployed by apm, never hand-written into that file. The `SessionStart` entry already in it is exactly that: kyberforge authors it in `plugins/kyberforge/.apm/hooks/hooks.json` and apm merges it in, so it is apm's own output, it is what the replay expects, and it belongs in the commit — do not strip it (ADR-0019). Machine-specific settings go in the gitignored `.claude/settings.local.json`; shared enforcement goes in `.pre-commit-config.yaml`. -- **`apm.lock.yaml` turning up modified is expected, not a bug.** kyberforge's `SessionStart` hook keeps the install current on launch and rewrites the lock in the process (ADR-0019). On `main`, commit or discard it deliberately. On a feature branch, discard it (`git checkout -- apm.lock.yaml`, then `apm install`). This keeps unrelated lock churn out of the branch diff and keeps `apm pack --check-clean` consistent with the committed lock. The session then runs the older `main` that the lock records, which is accepted on a branch, and the next session start refreshes again. -- **A `.apm/` edit is not live until it is on the remote's `main`.** Root `apm.yml`'s first-party dependencies resolve from the holocron remote, unpinned against the default branch, so pushing a feature branch does not deploy it (ADR-0019). `apm install` deploys from the lock; `apm update` is what re-resolves refs. -- **No pre-push hook needs the network — once `apm install` has run.** Root `apm.yml`'s marketplace has no remote package entries, so every hook resolves locally. The guarantee is a property of a populated `apm_modules/`, not of the hook set: on a fresh clone `apm-audit-ci`'s `deployed-files-present` fails outright, and its `drift` and `config-consistency` install-replays have no cache to replay from and clone from the remote. Run `apm install` once on a new checkout and the offline guarantee holds from then on (`docs/spec/gates.md`, "Pushing without a network"). +- **`apm.lock.yaml` turning up modified is expected, not a bug.** kyberforge's `SessionStart` hook keeps the install current on launch and rewrites the lock in the process (ADR-0019). On `main`, commit or discard it deliberately. On a feature branch, discard it (`git checkout -- apm.lock.yaml`, then `uv run --frozen apm install`). This keeps unrelated lock churn out of the branch diff and keeps `apm pack --check-clean` consistent with the committed lock. The session then runs the older `main` that the lock records, which is accepted on a branch, and the next session start refreshes again. +- **A `.apm/` edit is not live until it is on the remote's `main`.** Root `apm.yml`'s first-party dependencies resolve from the holocron remote, unpinned against the default branch, so pushing a feature branch does not deploy it (ADR-0019). `uv run --frozen apm install` deploys from the lock; `uv run --frozen apm update` is what re-resolves refs. +- **Run apm only as `uv run --frozen apm …`.** The root `pyproject.toml` and `uv.lock` pin apm 0.39.3 (ADR-0034). A bare `apm` reaches the machine-global 0.28.0, which this repo does not use and which refuses the v4 `apm.lock.yaml`. +- **No pre-push hook needs the network — once the two one-time online steps have run.** A new checkout runs `uv sync --frozen`, then `uv run --frozen apm install`, each online once. Root `apm.yml`'s marketplace has no remote package entries, so every hook then resolves locally. The guarantee is a property of a synced `.venv/` and a populated `apm_modules/`, not of the hook set: on a fresh clone `apm-audit-ci`'s `deployed-files-present` fails outright, and its `drift` and `config-consistency` install-replays have no cache to replay from and clone from the remote. A checkout whose `.claude/skills`, `.claude/agents` and `.claude/commands` were deployed by 0.28 moves those three directories aside before its first 0.39 install, or apm refuses with "no trustworthy local deployment baseline" (`docs/spec/gates.md`, "Pushing without a network"). - **A plugin `version:` bump that has merged to `main` gets its release tag.** Run `git fetch origin --tags`, then `scripts/tag-plugin-releases.sh`; exit 1 means a tag is missing, and `--apply` creates it locally and prints the push command. The script reads local tags only, so OK means present locally, not published: confirm with `git ls-remote --tags origin '-v*'` before calling it done. A tag push is an irreversible publish, not a free Propose-tier push (ADR-0032): show the maintainer the exact tags and that command, and only on their explicit yes in this conversation run exactly it yourself (named tags, never `--tags` or other refs). Agents cut release tags only with the script, which never moves or deletes one; exit 2 means stop and report it to the maintainer, never hand-fix, move or delete a tag (ADR-0033). - **This repo and Gitea are the only source of truth.** All project state, decisions, and working conventions live here. Do not use an external memory system for this project — cached state diverges from the repo and you get a split brain. Before answering any design or architecture question, check `docs/adr/` for an existing decision. diff --git a/README.md b/README.md index 1d38d35..18ff47d 100644 --- a/README.md +++ b/README.md @@ -63,18 +63,22 @@ pre-commit install -t pre-commit -t commit-msg -t pre-push **`uv sync --frozen`** installs the apm that `uv.lock` pins into `.venv/`. Every apm command in this repo runs as `uv run --frozen apm ...`. -**`apm install`** deploys the plugins root `apm.yml` lists into `.claude/skills/` and `.claude/agents/`. Both are gitignored install output, *not* authoring source — `plugins//.apm/` remains the only place to edit. Both steps need the network once, and `apm install` materializes `apm_modules/` (which stays gitignored). +**`uv run --frozen apm install`** deploys the plugins root `apm.yml` lists into `.claude/skills/` and `.claude/agents/`. Both are gitignored install output, *not* authoring source — `plugins//.apm/` remains the only place to edit. Steps 1 and 2 each need the network once per checkout; the first apm 0.39 install also records commit-reachability verdicts. The install materializes `apm_modules/` (which stays gitignored). + +**Run apm only through `uv run --frozen apm`.** A bare `apm` reaches whatever is on `PATH`; on a machine with the global pipx apm 0.28.0, that one is not used in this repo and refuses the v4 `apm.lock.yaml`. + +**An existing checkout deployed by apm 0.28 needs one more step before step 2.** Move `.claude/skills`, `.claude/agents` and `.claude/commands` aside (or delete them if they hold no edits), then run `uv run --frozen apm install`. Without that, apm 0.39 refuses to replace the 0.28-deployed files with "no trustworthy local deployment baseline", because 0.28 recorded no deployment evidence for them. apm's own message suggests a bare `apm install`; use the `uv run --frozen` form instead. **Git hooks** must be wired for **all three stages**. This repo's `.pre-commit-config.yaml` has no `default_install_hook_types`, so a plain `pre-commit install` silently skips `commit-msg` (Conventional Commits) and `pre-push` (the full gate) — the `-t` flags above are not optional. The `pc-run` skill handles this and the troubleshooting around it, if you would rather not remember the flags. ## Keeping the install current -The first-party dependencies in root `apm.yml` are unpinned against the default branch, so deployed skills go stale whenever anyone merges. kyberforge's `SessionStart` hook keeps the install current automatically on launch, rewriting `apm.lock.yaml` in the process — an unexplained modification to it after opening a session is expected, not a bug. On `main`, commit or discard it deliberately. On a feature branch, discard it (`git checkout -- apm.lock.yaml`, then `apm install`). The committed lock records a `main` commit too, just an older one. Discarding keeps lock churn unrelated to the branch out of its diff, and keeps the deployed tree consistent with the committed lock that `apm pack --check-clean` reads. The trade-off: the session then runs the older `main` the lock records, which is accepted on a feature branch. The discard also lasts only until the next session start, when the hook finds the lock behind `main` and refreshes again. Mechanism and rationale: `docs/adr/0019-session-start-hook-keeps-the-apm-install-current.md`. +The first-party dependencies in root `apm.yml` are unpinned against the default branch, so deployed skills go stale whenever anyone merges. kyberforge's `SessionStart` hook keeps the install current automatically on launch, rewriting `apm.lock.yaml` in the process — an unexplained modification to it after opening a session is expected, not a bug. On `main`, commit or discard it deliberately. On a feature branch, discard it (`git checkout -- apm.lock.yaml`, then `uv run --frozen apm install`). The committed lock records a `main` commit too, just an older one. Discarding keeps lock churn unrelated to the branch out of its diff, and keeps the deployed tree consistent with the committed lock that `apm pack --check-clean` reads. The trade-off: the session then runs the older `main` the lock records, which is accepted on a feature branch. The discard also lasts only until the next session start, when the hook finds the lock behind `main` and refreshes again. Mechanism and rationale: `docs/adr/0019-session-start-hook-keeps-the-apm-install-current.md`. Note the difference between the two commands: -- `apm install` deploys from `apm.lock.yaml`. It does **not** pick up remote changes. -- `apm update` re-resolves refs. This is the command that pulls in a merged `.apm/` edit. +- `uv run --frozen apm install` deploys from `apm.lock.yaml`. It does **not** pick up remote changes. +- `uv run --frozen apm update` re-resolves refs. This is the command that pulls in a merged `.apm/` edit. ## Running tests @@ -97,7 +101,7 @@ pre-commit run --hook-stage pre-push --all-files See [`docs/spec/gates.md`](docs/spec/gates.md) for what each hook enforces and why. -**Offline?** No pre-push hook needs the network **once `uv sync --frozen` and `apm install` have each run once** (ADR-0034). Root `apm.yml`'s marketplace has no remote package entries (the last one, `mattpocock-skills`, was removed), so `apm-pack-check-clean` resolves everything from local sources, and `apm-audit-ci`'s install-replay is cache-only against a populated install. On a **fresh clone** there is no cache: `apm-audit-ci`'s `deployed-files-present` fails outright, and its `drift` and `config-consistency` checks clone from the holocron remote. The offline guarantee is a property of a populated `apm_modules/`, not of the hook set — run `uv sync --frozen` and `uv run --frozen apm install` once on a new checkout and it holds from then on. +**Offline?** No pre-push hook needs the network **once `uv sync --frozen` and `uv run --frozen apm install` have each run once, online** (ADR-0034). Root `apm.yml`'s marketplace has no remote package entries (the last one, `mattpocock-skills`, was removed), so `apm-pack-check-clean` resolves everything from local sources, and `apm-audit-ci`'s install-replay is cache-only against a populated install. On a **fresh clone** there is no cache: `apm-audit-ci`'s `deployed-files-present` fails outright, and its `drift` and `config-consistency` checks clone from the holocron remote. The offline guarantee is a property of a populated `apm_modules/`, not of the hook set — run `uv sync --frozen` and `uv run --frozen apm install` once on a new checkout and it holds from then on. ## Editing plugin content @@ -132,7 +136,7 @@ dependencies: ref: git-v1.3.9 ``` -Then run `apm install`. Without `ref:`, the entry tracks the default branch. To list a plugin's +Then run `apm install` in your own repo. Without `ref:`, the entry tracks the default branch. To list a plugin's releases, run `git ls-remote --tags https://git.rkdr.net/Mortis/Holocron.git '-v*'`; `apm outdated` also reports newer `-v` tags. diff --git a/docs/spec/architecture.md b/docs/spec/architecture.md index 447b9f3..b55680f 100644 --- a/docs/spec/architecture.md +++ b/docs/spec/architecture.md @@ -19,7 +19,7 @@ project repo (local overrides) - **Executables** (`DEPLOY_EXECUTABLES`): `providers/claude-code/statusline-command.sh` → `~/.claude/statusline-command.sh` (with `+x`) - **Directories** (`DEPLOY_DIRS`): `core/` → `~/.claude/core/` (destination fully replaced on each deploy) -Skills are **not** deployed by `install.sh`. They are distributed as plugins and installed separately — in this repo by `apm install` against the `dependencies.apm` entries in the root `apm.yml`, which lands them in `.claude/skills/` and `.claude/agents/` (ADR-0018). A consuming repo installs them the same way — apm is the only supported install path. +Skills are **not** deployed by `install.sh`. They are distributed as plugins and installed separately — in this repo by `uv run --frozen apm install` (the repo-pinned apm, ADR-0034) against the `dependencies.apm` entries in the root `apm.yml`, which lands them in `.claude/skills/` and `.claude/agents/` (ADR-0018). A consuming repo installs them the same way — apm is the only supported install path. `~/.claude/CLAUDE.md` is a thin adapter, not a content source. It imports `~/.agents/AGENTS.md` (always-on rules) and `governance.md` (always-on governance) and carries nothing else — the content index of on-demand instruction files sits in `core/AGENTS.md`, deployed to `~/.agents/AGENTS.md` and imported by it. All always-on content lives in `AGENTS.md` files so other providers can import the same source without duplication.