diff --git a/.agents/skills/go/SKILL.md b/.agents/skills/go/SKILL.md new file mode 100644 index 00000000..5508df84 --- /dev/null +++ b/.agents/skills/go/SKILL.md @@ -0,0 +1,43 @@ +--- +name: go +description: Advance the dnd-simulator sprint pipeline by reading repository state, selecting the next project playbook, and executing exactly one pipeline step. Use when the user invokes /go or $go, or says go, next, continue, дальше, продолжай, or asks Codex to keep the current dnd-simulator sprint moving. +--- + +# Go + +Execute one next pipeline step in `dnd-simulator`. Keep the project-owned Claude skill files as the source of truth; do not copy their procedures into this Codex skill. + +## Locate the project + +Require a checkout whose repository contains all of: + +- `AGENTS.md` +- `docs/STATUS.md` +- `.claude/skills/go/SKILL.md` + +Start from the current working directory and use `git rev-parse --show-toplevel`. If it is not `dnd-simulator`, stop and report the wrong project instead of searching outside this repository. + +## Execute + +1. Read the repository `AGENTS.md` completely and obey it. +2. Search shared memory as required by `AGENTS.md` before acting on prior state. +3. Read `.claude/skills/go/SKILL.md` completely. +4. Read `docs/STATUS.md`, the active sprint's `sprint.md`, and the other state files required by the repository `go` checklist. +5. Apply the repository `go` decision tree. The first matching state wins. +6. Read the selected `.claude/skills//SKILL.md` completely, including any other checklist it explicitly invokes. +7. Execute that selected checklist in the current turn. Do not merely recommend a slash command. +8. Execute exactly one pipeline granule: one CI-closure reconciliation, one planning step, one implementation task, one phase closure, one audit/triage, one E2E run, or one sprint closure. Stop after its own commit/report boundary. + +## Codex adaptations + +- Treat Claude frontmatter such as `allowed-tools`, `argument-hint`, and trigger phrases as metadata, not runtime restrictions. +- When a checklist says to invoke another skill, open that skill's `SKILL.md` and continue with it. +- Use `apply_patch` for file edits and preserve unrelated worktree changes. +- Pipe test output to the file required by project instructions and read that file instead of rerunning tests. +- Use detached processes for dev servers and kill them when finished. +- When the repository checklist says CI must be monitored, keep the turn alive until terminal check and merge + state. A queued or running check is not a valid report boundary. +- Do not force-push, rewrite pushed history, merge `main`, or add AI attribution. +- If repository instructions and a project checklist disagree, follow `AGENTS.md`, then the user's current request. In particular, use merge commits rather than squash when the repository says so. + +If state is contradictory, report the concrete contradiction and stop. Otherwise act autonomously through the selected granule. diff --git a/.claude/skills/close-sprint/SKILL.md b/.claude/skills/close-sprint/SKILL.md index aefb8bda..48da51fc 100644 --- a/.claude/skills/close-sprint/SKILL.md +++ b/.claude/skills/close-sprint/SKILL.md @@ -2,7 +2,7 @@ name: close-sprint description: > Close the current sprint: verify all phases done, audit completed, post-audit E2E green, integration - tests green, then update docs, commit, and push. Blocks if anything is off. Use when user says + tests green, then update docs, commit, push, and wait for CI. Blocks if anything is off. Use when user says "close sprint", "finish sprint", "sprint done", "wrap up sprint", or when all phases are complete and it's time to finalize. allowed-tools: Bash, Read, Write, Edit, Grep, Glob, Agent @@ -135,6 +135,15 @@ No active sprint. | ... previous sprints ... | ``` +Also leave an explicit closure marker while the remote gate is unresolved: + +```markdown +**Closure:** Ждём завершения CI для `sprint/NNN-slug`. +``` + +This marker is pipeline state, not a prose note. It must be committed in the sprint PR. Do not replace it +with "closed", remove it, or start another sprint until the required CI checks and merge result are known. + #### 4d. Commit, push the branch, open the PR The sprint ran on its own branch (`sprint/NNN-slug`, created by `/new-sprint`). Close it by opening a PR into `main` with auto-merge — CI is the gate, not a human. @@ -148,14 +157,33 @@ git push -u origin "$branch" gh pr create --base main --head "$branch" \ --title "sprint NNN: " \ --body "" -gh pr merge "$branch" --auto --squash --delete-branch +gh pr merge "$branch" --auto --merge --delete-branch ``` `--auto` lands the PR on `main` automatically once the required CI checks pass — no human approval (branch protection requires the checks, not a reviewer). If CI fails, the PR stays open and `main` is untouched: that is the gate doing its job. After this, return to a clean base for the next sprint: `git checkout main` (the merge lands on remote `main` asynchronously; the next `/new-sprint` fast-forwards local main). **Note:** Do NOT stage `.claude/skills/update-docs/state.json` here — it is committed by the `/update-docs` skill itself in step 4a. -This is the only skill that pushes. The sprint is done once the auto-merge PR is open; the merge itself completes when CI is green. +This is the only skill that pushes. Opening the auto-merge PR is not the end of the step. + +#### 4e. Monitor CI through merge + +After enabling auto-merge, start a monitor and keep working until every required check reaches a terminal state. +Do not end the turn while checks are queued or in progress. + +Use `gh pr checks --watch --interval 10` in a background process with output redirected to +`/tmp/sprint-NNN-ci.log`, or an equivalent recurring monitor. Poll it at least once per minute and keep the +user informed. Also inspect `gh pr view --json state,mergedAt,mergeStateStatus,statusCheckRollup,url`; +checks being green is insufficient if the PR did not merge. + +- If every required check succeeds, wait until the PR state is `MERGED`, then report closure. Leave the + `Closure` marker for the next `/go` reconciliation, which verifies the remote result independently and + clears the marker on `main`. +- If any required check fails, is cancelled, or times out, stop the monitor and escalate to the operator with + the PR URL, failed check names, and log URLs. Do not claim the sprint is closed, do not remove the marker, + and do not start unrelated fixes without operator direction. +- If auto-merge is disabled or the PR remains open after all checks succeed, escalate that merge-state problem + to the operator instead of finishing silently. ### 5. Report @@ -164,5 +192,6 @@ Sprint NNN — : CLOSED Phases: N completed Tests: integration green, E2E green Docs: updated - Pushed to remote. + CI: all required checks green + PR: merged to main ``` diff --git a/.claude/skills/go/SKILL.md b/.claude/skills/go/SKILL.md index f4fd2815..20a6d4ba 100644 --- a/.claude/skills/go/SKILL.md +++ b/.claude/skills/go/SKILL.md @@ -26,6 +26,21 @@ Read `docs/STATUS.md` to find the current sprint and phase. Then read the sprint Work through this decision tree top-to-bottom. The FIRST match wins: +#### docs/STATUS.md contains `**Closure:** Ждём завершения CI` +→ **Reconcile the previous sprint closure before any other action.** This rule wins even when Current Sprint +says `No active sprint`. + +1. Identify the PR from the branch name in the marker using `gh pr list --state all --head <branch>`. +2. Read `state`, `mergedAt`, `mergeStateStatus`, and every item in `statusCheckRollup`. +3. If checks are still queued or running, start the same recurring monitor required by `/close-sprint`, wait for + terminal results, and do not finish the turn early. +4. If every required check succeeded and the PR is `MERGED`, fast-forward local `main`, remove the `Closure` + marker from `docs/STATUS.md`, commit that reconciliation, and push it to `main`. Then stop: reconciliation is + this invocation's one pipeline granule. +5. If any check failed/cancelled/timed out, the PR is closed without merge, or green checks did not produce a + merge, escalate to the operator with the PR and check URLs. Do not clear the marker and do not dispatch the + next pipeline step. + #### No current sprint in docs/STATUS.md or sprint marked COMPLETE → **`/new-sprint`** — time to plan the next sprint.