feat(delivery): add delivery-repo-doc skill #210

Merged
Defame1297 merged 2 commits from feat/delivery-repo-doc into main 2026-11-23 07:26:22 +00:00
3 changed files with 294 additions and 0 deletions

No files matched your search

@@ -0,0 +1,78 @@
---
name: delivery-repo-doc
description: >
Use when onboarding a repo to the delivery team or when its `docs/agents/delivery.md` has
drifted, e.g. a renamed CI check. Owns that file's format. Not writing AGENTS.md ->
`agentsmd-author`.
compatibility: Requires git and a forge remote. Gitea needs the Gitea MCP server (through the
gitea-* skills); GitHub needs an authenticated gh CLI.
allowed-tools: Bash Read Write Edit
metadata:
category: delivery
version: "0.1.1"
---
## Gotchas
- A glob with no installed tool skill is left out, never mapped to the closest-sounding skill: a
guess stalls every consumer stage.
- A status-check name derived from a workflow file is a candidate; the forge's reported string is
what consumers match, character for character.
- Commit authors, CODEOWNERS and collaborator lists are not sources for the allowlist or bot user:
they name who *can* act, not who is *allowed* to.
- The git remote's owner casing can differ from the forge's. Take user and owner names from the
forge or the human, never the remote URL.
- The kubeconfig is recorded as a path. Opening it, or any credential file, is outside this skill's
Read and Propose tiers.
## Step 1 — Locate
Work in the consuming repo's checkout, on its default branch, fast-forward pulled via
`git-branches`. On a dirty working tree, stop and report it. Identify the forge from
the `origin` remote (Gitea or GitHub). If `docs/agents/delivery.md` exists, this run is an
**update**; otherwise a **draft**.
Read `references/format.md` now; it is the only definition of the file's syntax.
## Step 2 — Gather repo facts
Read `references/gathering.md` and collect every repo-sourced value: contents → skills, CI check
names with roles, test paths, convention pointers. Done when every section 1–3 and 6 value has a
named source file or forge status.
## Step 3 — Ask for human facts
A human fact the caller already supplied, directly or through a source it named, is used as given.
Ask once, in one message, for every other human-sourced value `references/gathering.md` lists. On
an update, ask only for values the human must re-confirm because the repo changed. A source the
human points at, such as a tracker issue's resolution comment, counts as an answer; quote the value
from it. Wait for the answer. A value the human declines to give stays out, and the PR body names it
as open.
## Step 4 — Write
- **Draft**: write `docs/agents/delivery.md` from the format's skeleton, with this repo's values.
- **Update**: compare each existing item against the facts from Steps 2–3 and edit only the
drifted items. Leave every confirmed item byte-for-byte.
Then the pointer line: if the root `AGENTS.md` lacks the exact line from `references/format.md`,
add it where that file's placement rule says. If the repo has no root `AGENTS.md`, invoke `agentsmd-author` to create one carrying that
line, and edit nothing else in it.
Run the format's validation checklist. Every box ticked is the completion bar.
## Step 5 — Propose
Both files go in one PR. Every command here is in the Read or Propose tier. A branch name or commit
message the caller gives overrides the defaults below.
1. Branch `docs/delivery-repo-doc` from the default branch via `git-branches`.
2. Commit via `git-commits`: `docs(agents): add delivery repo facts` on a draft,
`docs(agents): update delivery repo facts` on an update. On a hook failure, fix the cause and
re-run only that hook, then commit again; `--no-verify` and `SKIP=` stay off the table.
3. Push via `git-remotes`.
4. Open the PR: Gitea via `gitea-prs`; GitHub via `gh pr create`. The body lists each value's source
(file, forge status, or the human's answer and where it was given) and any open values.
Report the PR link and stop. A human merges: `docs/agents/**` and `AGENTS.md` sit behind protected
file patterns, and the merge is theirs either way.
@@ -0,0 +1,159 @@
# The `docs/agents/delivery.md` format
This file is the single source of truth for the format. `delivery-handoff`, `delivery-ci-checks`,
`delivery-qa` and `delivery-operator` cite it as "`delivery-repo-doc`'s `references/format.md`" and
do not restate it. A format change is an edit here, plus the consumers' parsers.
## File rules
- Path: `docs/agents/delivery.md` at the consuming repo's root. One file per repo.
- First line: `# Delivery`.
- Exactly six `##` sections, with these headings verbatim and in this order:
1. `## Contents → skills`
2. `## CI checks`
3. `## Test paths`
4. `## Human allowlist`
5. `## Credential boundary`
6. `## Conventions`
- No other `##` headings, and no `###` headings inside sections 1–4.
- Sections 1–4 are **parsed**: they contain only list items in the item syntax below, one per line,
starting `- ` at column 0. Blank lines are allowed; prose, sub-bullets, tables and comments are
not. Every backticked value is taken verbatim, with no escaping.
- An empty parsed section holds the single item `- none`. Section 4 is never empty.
- Sections 5–6 are read by agents, not parsers; their item labels below are a convention.
## Item syntax
### 1. Contents → skills
```text
- `<glob>`: `<skill>`, `<skill>`
```
- `<glob>` is a repo-relative path glob (`**` crosses directories).
- One or more installed skill names, each backticked, comma-separated.
- A consumer loads exactly the listed skills for a changed path matching the glob, the union across
every matching line. A listed skill that is not installed is a hard stop for the consumer
(`Status/Ready for Human`, handoff "missing skill `<name>`"), so a glob with no installed tool
skill is left out entirely.
### 2. CI checks
```text
- `<status check name>`: <role>
```
- `<status check name>` is the exact string the forge shows on a PR's head commit.
- `<role>` is exactly one of: `dry-run`, `test-path`, `test`, `lint`, `build`, `other`.
- `dry-run` appears on exactly one item. `test-path` appears on at most one item, and on exactly
one when the repo has a test-path check.
- Whatever its role, a consumer treats a check reported as "skipped" (a path-filtered workflow
whose paths did not match) as passing.
### 3. Test paths
Either a pointer, as the only item, when the repo's test-path check reads its own globs file:
```text
- globs file: `<repo-relative path>`
```
or one item per glob:
```text
- `<glob>`
```
These are the paths the test author owns; after the commit with trailer
`Delivery-Stage: test-author`, the implementer may not touch them.
### 4. Human allowlist
```text
- `<forge username>`
```
Humans only. Stage leads accept a gate label or an approval only when the issue or PR timeline shows
a user on this list set it.
### 5. Credential boundary
```text
- Bot user: `<forge username>`
- Kubeconfig: `<absolute path>` | none
- Branch protection: in place | pending ([<title>](<url>))
- Accepted risks: [<title>](<url>), … | none
```
Every link in this section is a markdown link. Delivery sessions export the kubeconfig path as
`KUBECONFIG`. The value is a path only. Accepted risks are linked, never restated.
### 6. Conventions
Short prose or bullets pointing at the repo's own docs (`AGENTS.md`, ADRs, contributing guides) for
anything else a delivery agent needs. Pointers only; no restating.
## AGENTS.md pointer line
The consuming repo's root `AGENTS.md` carries this line verbatim, exactly once:
```text
- Delivery team facts (checks, test paths, human allowlist, credential boundary): `docs/agents/delivery.md`
```
Placement only decides where the line sits; the line itself never changes:
- The heading that lists agent docs holds a flat bullet list: add the line to that list.
- That heading uses `###` subsections with prose: add a `### Delivery` subsection under it, holding
only the line.
- No such heading: add the line at the end of the file.
## Full skeleton
```markdown
# Delivery
## Contents → skills
- `clusters/**`: `flux-diagnose`, `k8s-diagnose`
- `roles/**`: `ansible-lint`
## CI checks
- `ci / render-diff (pull_request)`: dry-run
- `ci / test-paths (pull_request)`: test-path
- `ci / lint (pull_request)`: lint
## Test paths
- globs file: `.gitea/test-paths`
## Human allowlist
- `alice`
## Credential boundary
- Bot user: `delivery-bot`
- Kubeconfig: `/etc/delivery/kubeconfig-readonly`
- Branch protection: pending ([Branch protection setup](https://example.org/issues/12))
- Accepted risks: [ADR-0032](https://example.org/adr/0032)
## Conventions
Repo conventions live in `AGENTS.md`; decisions in `docs/adr/`.
```
The values in the skeleton are illustrative only; every real value comes from the repo or the human.
## Validation checklist
- [ ] First line `# Delivery`; six `##` headings, verbatim, in order.
- [ ] Sections 1–4 hold only items in the syntax above, or `- none`.
- [ ] Every skill in section 1 is installed. A listed skill that is not installed makes every
consumer hard-stop on any change matching its glob.
- [ ] Section 2: exactly one `dry-run`; one `test-path` if the repo has that check.
- [ ] Section 3 is the `globs file:` pointer whenever a test-path check reads a globs file.
- [ ] Section 4 is non-empty and every name came from the human or a source they named.
- [ ] Section 5 holds paths and markdown links, no secret values.
- [ ] Root `AGENTS.md` carries the pointer line exactly once.
@@ -0,0 +1,57 @@
# Gathering the facts
Every value in `docs/agents/delivery.md` has exactly one source. Facts the repo holds come from the
repo; facts only a human holds come from the human. A value with no source stays out.
## Repo-sourced
### Contents → skills
1. List the repo's top-level layout and the tool each area belongs to: Flux/Kustomize manifests
(`kustomization.yaml`, `HelmRelease`), Kubernetes manifests, Ansible (`playbooks/`, `roles/`,
`inventory/`, `ansible.cfg`), OpenTofu (`*.tf`, `.terraform.lock.hcl`).
2. The installed skills are the session's available-skills listing. Map a glob only to tool skills
in that listing whose description covers the area's tool.
3. In a mixed repo (for example Ansible at the top level, Flux under `clusters/`), map each area
with its own glob, and leave out any area with no installed tool skill.
### CI checks
1. Read every workflow under `.gitea/workflows/` or `.github/workflows/` that runs on
`pull_request`. A path-filtered `pull_request` workflow still counts: Gitea reports it as
"skipped" when its paths don't match. List it, usually with role `test`. Workflows that run only
on push, schedule or dispatch are not PR checks; leave them out.
2. Derive each candidate name:
- Gitea Actions: `<workflow name> / <job name> (<event>)`. The workflow name is the file's
top-level `name:` (else the file name); the job name is the job's `name:` (else the job id).
- GitHub Actions: the job's `name:` (else the job id); matrix jobs append their values in
parentheses.
3. Confirm each candidate against the statuses the forge reports on the head commit of a recent PR
where that check reported at least once. Gitea: `gitea-prs` → `pull_request_read` method
`get_status`, or `commit_read` status on the head SHA; GitHub: `gh pr checks <number>`. The
forge's string wins over the derived one. With no PR to read, keep the derived name and say so in the PR body.
4. Assign roles. `test-path` is the check that fails when a commit after the
`Delivery-Stage: test-author` commit touches the test globs. `dry-run` comes from the human.
### Test paths
1. Read the test-path check's workflow and find the file it reads its globs from (for example
`.gitea/test-paths`). If one exists, the section is the `globs file:` pointer.
2. Otherwise list the globs where the repo's tests live (Molecule scenarios, `tests/`, policy tests).
Confirm them with the human in the Step 3 question.
### Conventions
Point at the root `AGENTS.md`, `docs/adr/`, and any contributing or runbook docs that exist. A list
of pointers the human or caller supplies replaces these defaults.
## Human-sourced
SKILL.md Step 3 asks for these:
- Human allowlist: forge usernames.
- Bot user the agents act as.
- Read-only kubeconfig path, or "no cluster".
- Branch-protection status: in place, or pending with the tracking link.
- Which CI check is the dry run.
- Accepted risks: the ADR or issue links, or "none".