@gotgenes/pi-autoformat 0.1.0 → 4.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +1 -3
- package/.github/workflows/release-please.yml +29 -0
- package/.markdownlint-cli2.yaml +14 -2
- package/.pi/extensions/pi-autoformat/config.json +3 -6
- package/.pi/prompts/README.md +59 -0
- package/.pi/prompts/plan-issue.md +64 -0
- package/.pi/prompts/retro.md +144 -0
- package/.pi/prompts/ship-issue.md +77 -0
- package/.pi/prompts/tdd-plan.md +67 -0
- package/.pi/skills/pi-extension-lifecycle/SKILL.md +256 -0
- package/.release-please-manifest.json +1 -1
- package/AGENTS.md +39 -0
- package/CHANGELOG.md +365 -0
- package/README.md +42 -109
- package/biome.json +1 -1
- package/docs/assets/logo.png +0 -0
- package/docs/assets/logo.svg +533 -0
- package/docs/configuration.md +358 -38
- package/docs/plans/0001-initial-implementation-plan.md +17 -9
- package/docs/plans/0002-richer-tui-formatter-summaries.md +220 -0
- package/docs/plans/0003-additional-pi-mutation-tools.md +273 -0
- package/docs/plans/0004-shell-driven-mutation-coverage.md +296 -0
- package/docs/plans/0010-acceptance-test-coverage.md +240 -0
- package/docs/plans/0012-remove-unused-formatter-extensions-field.md +152 -0
- package/docs/plans/0013-fallback-chain-step-type.md +280 -0
- package/docs/plans/0014-batch-by-default-formatter-dispatch.md +195 -0
- package/docs/plans/0015-builtin-treefmt-and-treefmt-nix-support.md +290 -0
- package/docs/plans/0016-detailed-formatter-output-on-failure.md +245 -0
- package/docs/plans/0022-pi-coding-agent-types.md +201 -0
- package/docs/plans/0027-format-before-agent-exit-follow-up-turn.md +355 -0
- package/docs/plans/0031-turn-end-flush-with-change-detection.md +365 -0
- package/docs/retro/0002-richer-tui-formatter-summaries.md +47 -0
- package/docs/retro/0013-fallback-chain-step-type.md +67 -0
- package/docs/retro/0015-builtin-treefmt-and-treefmt-nix-support.md +56 -0
- package/docs/retro/0016-detailed-formatter-output-on-failure.md +60 -0
- package/docs/retro/0022-pi-coding-agent-types.md +62 -0
- package/docs/testing.md +95 -0
- package/package.json +30 -11
- package/prek.toml +2 -2
- package/schemas/pi-autoformat.schema.json +145 -21
- package/src/builtin-formatters.ts +205 -0
- package/src/command-probe.ts +66 -0
- package/src/config-loader.ts +829 -90
- package/src/custom-mutation-tools.ts +125 -0
- package/src/extension.ts +469 -82
- package/src/format-scope.ts +118 -0
- package/src/formatter-config.ts +73 -36
- package/src/formatter-executor.ts +230 -34
- package/src/formatter-output-report.ts +149 -0
- package/src/formatter-registry.ts +139 -30
- package/src/index.ts +26 -5
- package/src/prompt-autoformatter.ts +148 -23
- package/src/shell-mutation-detector.ts +572 -0
- package/src/touched-files-queue.ts +72 -11
- package/test/acceptance-event-bus.test.ts +138 -0
- package/test/acceptance.test.ts +69 -0
- package/test/builtin-formatters.test.ts +382 -0
- package/test/command-probe.test.ts +79 -0
- package/test/config-loader.test.ts +640 -21
- package/test/custom-mutation-tools.test.ts +190 -0
- package/test/extension.test.ts +1535 -158
- package/test/fallback-acceptance.test.ts +98 -0
- package/test/fixtures/event-bus-emitter.ts +26 -0
- package/test/fixtures/formatter-recorder.mjs +25 -0
- package/test/format-scope.test.ts +139 -0
- package/test/formatter-config.test.ts +56 -5
- package/test/formatter-executor.test.ts +555 -35
- package/test/formatter-output-report.test.ts +178 -0
- package/test/formatter-registry.test.ts +330 -37
- package/test/helpers/rpc.ts +146 -0
- package/test/prompt-autoformatter.test.ts +315 -22
- package/test/schema.test.ts +149 -0
- package/test/shell-mutation-detector.test.ts +221 -0
- package/test/touched-files-queue.test.ts +40 -1
- package/test/types/theme-stub.test-d.ts +42 -0
package/.github/workflows/ci.yml
CHANGED
|
@@ -15,8 +15,6 @@ jobs:
|
|
|
15
15
|
- uses: actions/checkout@v6
|
|
16
16
|
|
|
17
17
|
- uses: pnpm/action-setup@v4
|
|
18
|
-
with:
|
|
19
|
-
version: latest
|
|
20
18
|
|
|
21
19
|
- uses: actions/setup-node@v6
|
|
22
20
|
with:
|
|
@@ -26,7 +24,7 @@ jobs:
|
|
|
26
24
|
- run: pnpm install --frozen-lockfile
|
|
27
25
|
|
|
28
26
|
- name: Type check
|
|
29
|
-
run: pnpm
|
|
27
|
+
run: pnpm run typecheck
|
|
30
28
|
|
|
31
29
|
- name: Lint
|
|
32
30
|
run: pnpm run lint
|
|
@@ -11,12 +11,41 @@ env:
|
|
|
11
11
|
permissions:
|
|
12
12
|
contents: write
|
|
13
13
|
pull-requests: write
|
|
14
|
+
id-token: write
|
|
14
15
|
|
|
15
16
|
jobs:
|
|
16
17
|
release-please:
|
|
17
18
|
runs-on: ubuntu-latest
|
|
18
19
|
steps:
|
|
19
20
|
- uses: googleapis/release-please-action@v4.4.1
|
|
21
|
+
id: release
|
|
20
22
|
with:
|
|
21
23
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
22
24
|
config-file: release-please-config.json
|
|
25
|
+
|
|
26
|
+
- uses: actions/checkout@v6
|
|
27
|
+
if: ${{ steps.release.outputs.release_created }}
|
|
28
|
+
|
|
29
|
+
- uses: pnpm/action-setup@v4
|
|
30
|
+
if: ${{ steps.release.outputs.release_created }}
|
|
31
|
+
|
|
32
|
+
- uses: actions/setup-node@v6
|
|
33
|
+
with:
|
|
34
|
+
node-version: 24
|
|
35
|
+
registry-url: "https://registry.npmjs.org"
|
|
36
|
+
cache: pnpm
|
|
37
|
+
if: ${{ steps.release.outputs.release_created }}
|
|
38
|
+
|
|
39
|
+
- run: pnpm install --frozen-lockfile
|
|
40
|
+
if: ${{ steps.release.outputs.release_created }}
|
|
41
|
+
|
|
42
|
+
- run: pnpm run lint
|
|
43
|
+
if: ${{ steps.release.outputs.release_created }}
|
|
44
|
+
|
|
45
|
+
- run: pnpm test
|
|
46
|
+
if: ${{ steps.release.outputs.release_created }}
|
|
47
|
+
|
|
48
|
+
# Trusted publishing via OIDC — no NPM_TOKEN needed.
|
|
49
|
+
# Provenance is generated automatically with trusted publishing.
|
|
50
|
+
- run: pnpm publish --no-git-checks
|
|
51
|
+
if: ${{ steps.release.outputs.release_created }}
|
package/.markdownlint-cli2.yaml
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
# CHANGELOG.md is machine-generated by release-please. Its double blank lines
|
|
2
|
+
# between sections are intentional; exclude it from linting entirely.
|
|
3
|
+
ignores:
|
|
4
|
+
- "CHANGELOG.md"
|
|
5
|
+
|
|
1
6
|
config:
|
|
2
|
-
|
|
3
|
-
|
|
7
|
+
line-length: false
|
|
8
|
+
no-duplicate-heading:
|
|
9
|
+
siblings_only: true
|
|
10
|
+
# Allow the centered logo image at the top of README.md
|
|
11
|
+
no-inline-html:
|
|
12
|
+
allowed_elements:
|
|
13
|
+
- p
|
|
14
|
+
- img
|
|
15
|
+
first-line-heading: false
|
|
@@ -10,14 +10,11 @@
|
|
|
10
10
|
"biome",
|
|
11
11
|
"check",
|
|
12
12
|
"--write",
|
|
13
|
-
"--files-ignore-unknown=true"
|
|
14
|
-
|
|
15
|
-
],
|
|
16
|
-
"extensions": [".ts", ".json"]
|
|
13
|
+
"--files-ignore-unknown=true"
|
|
14
|
+
]
|
|
17
15
|
},
|
|
18
16
|
"markdownlint-cli2": {
|
|
19
|
-
"command": ["pnpm", "exec", "markdownlint-cli2", "--fix"
|
|
20
|
-
"extensions": [".md"]
|
|
17
|
+
"command": ["pnpm", "exec", "markdownlint-cli2", "--fix"]
|
|
21
18
|
}
|
|
22
19
|
},
|
|
23
20
|
"chains": {
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Project prompt templates
|
|
2
|
+
|
|
3
|
+
Slash commands for this repository's issue-driven workflow. Loaded automatically by [`pi-prompt-template-model`](https://github.com/nicobailon/pi-prompt-template-model) when run from a project that contains `.pi/prompts/`.
|
|
4
|
+
|
|
5
|
+
## The workflow
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
gh issue → /plan-issue N → /tdd-plan [N] → /ship-issue N → /retro [N]
|
|
9
|
+
(writes plan, (red→green→ (push, close, (synthesize friction/
|
|
10
|
+
asks design Qs, commit per TDD merge release- wins, propose small
|
|
11
|
+
commits plan) step; lint+test; please PR) edits, persist to
|
|
12
|
+
doc commit) docs/retro/)
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Each step ends at a natural review breakpoint. You can rerun any step independently.
|
|
16
|
+
|
|
17
|
+
## Templates
|
|
18
|
+
|
|
19
|
+
### `/plan-issue <issue-number>`
|
|
20
|
+
|
|
21
|
+
Reads issue #N, gathers context (`AGENTS.md`, related plans, prerequisite issues, relevant source), surfaces 1–2 focused design questions via `ask-user` if anything is genuinely ambiguous, and writes a numbered plan to `docs/plans/NNNN-<slug>.md`. Commits the plan as `docs: plan ... (#N)`. Stops there.
|
|
22
|
+
|
|
23
|
+
### `/tdd-plan [issue-number-or-path]`
|
|
24
|
+
|
|
25
|
+
Loads the plan (by issue number, by path, or the most recently modified plan if no arg). For each step in the plan's "TDD Order":
|
|
26
|
+
|
|
27
|
+
1. Write failing tests, confirm red.
|
|
28
|
+
2. Implement, confirm green.
|
|
29
|
+
3. Commit with the suggested Conventional Commits message (`feat:`, `feat!:`, etc.).
|
|
30
|
+
|
|
31
|
+
Then runs the full suite + linter, updates docs (`README.md`, `docs/configuration.md`, schemas) the plan flags, and commits as `docs:`. Never edits `CHANGELOG.md` — release-please owns it.
|
|
32
|
+
|
|
33
|
+
### `/ship-issue <issue-number>`
|
|
34
|
+
|
|
35
|
+
Pushes, waits for CI, closes the issue with a summary built from the commit log, then merges any open release-please PR with `--rebase` and pulls the release commit. Refuses to force-push or merge a non-`CLEAN` PR.
|
|
36
|
+
|
|
37
|
+
### `/retro [issue-number]`
|
|
38
|
+
|
|
39
|
+
Reviews the session for friction/wins, writes `docs/retro/NNNN-<slug>.md`, surfaces per-proposal context, then uses `ask-user` to confirm small (~1–3 file) edits to `AGENTS.md` or prompts. Records what changed in a `### Changes made` subsection and commits as `docs(retro): ...`. Larger reworks are recorded as follow-ups, not landed inline.
|
|
40
|
+
|
|
41
|
+
## Why three templates and not one?
|
|
42
|
+
|
|
43
|
+
Each command corresponds to a different review surface:
|
|
44
|
+
|
|
45
|
+
- **Plan review** — design choices, scope, TDD ordering. Easy to revise before any code is written.
|
|
46
|
+
- **Code review** — the actual diff in commits, one per TDD cycle. Easy to bisect and revert.
|
|
47
|
+
- **Ship review** — push, close, release. The "is this really done?" gate.
|
|
48
|
+
|
|
49
|
+
Combining them would skip those gates. Splitting also lets you rerun any phase: regenerate a plan, redo TDD on the same plan, ship after a manual fixup.
|
|
50
|
+
|
|
51
|
+
## Conventions assumed by these templates
|
|
52
|
+
|
|
53
|
+
- `AGENTS.md` at the repo root with project priorities.
|
|
54
|
+
- `docs/plans/NNNN-<slug>.md` plan layout with a "TDD Order" section.
|
|
55
|
+
- Conventional Commits.
|
|
56
|
+
- release-please PRs auto-opened by a GitHub Actions workflow.
|
|
57
|
+
- `pnpm` test/lint scripts: `pnpm exec vitest run`, `pnpm run lint`, `pnpm run lint:fix`.
|
|
58
|
+
|
|
59
|
+
These match this repo's setup (see `AGENTS.md`, `package.json`, `.github/workflows/release-please.yml`).
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Read a GitHub issue, gather context, and write a numbered plan to docs/plans/
|
|
3
|
+
---
|
|
4
|
+
# Plan a GitHub issue
|
|
5
|
+
|
|
6
|
+
Issue number: `$1`
|
|
7
|
+
|
|
8
|
+
Your job is to produce a numbered implementation plan at `docs/plans/NNNN-<slug>.md` for issue #$1, then commit it. Stop after the commit. Do **not** start implementation — the next step is `/tdd-plan`.
|
|
9
|
+
|
|
10
|
+
## Sync with remote (do this first)
|
|
11
|
+
|
|
12
|
+
Before reading anything, make sure the working tree is up to date with the remote so the plan is written against current `main`:
|
|
13
|
+
|
|
14
|
+
1. Run `git pull --ff-only`.
|
|
15
|
+
2. If it fails for **any** reason — uncommitted changes, divergent history, merge conflict, network error, detached HEAD — stop immediately and report the failure to the user. Do not attempt to stash, rebase, force, or otherwise resolve.
|
|
16
|
+
3. Only proceed once the pull reports a clean fast-forward (or `Already up to date.`).
|
|
17
|
+
|
|
18
|
+
## Gather context (do this first, in parallel where possible)
|
|
19
|
+
|
|
20
|
+
1. Run `gh issue view $1` to read the issue body and labels.
|
|
21
|
+
2. Read `AGENTS.md` for project priorities, constraints, and code-style rules. Honor them in the plan.
|
|
22
|
+
3. List `docs/plans/` to see numbering and style conventions (create the directory if it does not exist yet). Pick the next free `NNNN` (prefer matching the issue number when reasonable).
|
|
23
|
+
4. Read every issue the body references as a prerequisite or related (`gh issue view <n>`). Note whether each is implemented yet — your plan must say what it depends on vs. defers.
|
|
24
|
+
5. Open the source files most relevant to the change and skim them before writing.
|
|
25
|
+
|
|
26
|
+
## Decide
|
|
27
|
+
|
|
28
|
+
Before writing the plan, identify any genuinely ambiguous design choices. If there are 1–2 such choices (breaking-vs-non-breaking, result-shape change, fallback semantics, etc.), use the `ask-user` skill once to surface them with a short context summary and concrete options. Skip this step if the issue's "Proposed change" section is unambiguous.
|
|
29
|
+
|
|
30
|
+
## Write the plan
|
|
31
|
+
|
|
32
|
+
File: `docs/plans/NNNN-<short-slug>.md`.
|
|
33
|
+
|
|
34
|
+
Start with YAML frontmatter (see `AGENTS.md` § Documentation frontmatter):
|
|
35
|
+
|
|
36
|
+
```yaml
|
|
37
|
+
---
|
|
38
|
+
issue: $1
|
|
39
|
+
issue_title: "<exact title from `gh issue view`>"
|
|
40
|
+
---
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Then the body, sections in this order:
|
|
44
|
+
|
|
45
|
+
- **Problem Statement** — quote the issue's framing in your own words.
|
|
46
|
+
- **Goals** — bullet list, scoped to this change.
|
|
47
|
+
- **Non-Goals** — explicitly defer anything tangential (sibling issues, follow-ups).
|
|
48
|
+
- **Background** — relevant existing modules/functions and how they relate.
|
|
49
|
+
- **Design Overview** — dispatch model, data shapes, separation of concerns, edge cases. Include code-fenced TS types when shape changes.
|
|
50
|
+
- **Module-Level Changes** — file-by-file list of what's added, changed, or removed.
|
|
51
|
+
- **TDD Order** — numbered red→green→commit cycles. Each item names the test surface, what's covered, and the suggested commit message (`test:`, `feat:`, `feat!:`, `docs:`).
|
|
52
|
+
- **Risks and Mitigations** — concrete risks and how the plan addresses each.
|
|
53
|
+
- **Open Questions** — defer-until-needed items.
|
|
54
|
+
|
|
55
|
+
If the change is breaking, say so explicitly in Goals and use `feat!:` in the suggested commit messages.
|
|
56
|
+
|
|
57
|
+
## Commit
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
git add docs/plans/NNNN-*.md
|
|
61
|
+
git commit -m "docs: plan <short summary> (#$1)"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Then print a 5-line summary of the plan's key decisions and stop.
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Review this session for workflow improvements and persist retro notes to docs/retro/
|
|
3
|
+
deterministic:
|
|
4
|
+
run: |
|
|
5
|
+
echo "=== Recent commits ==="
|
|
6
|
+
git log --oneline -25
|
|
7
|
+
echo
|
|
8
|
+
echo "=== Existing retros ==="
|
|
9
|
+
ls docs/retro/ 2>/dev/null || echo "(docs/retro/ does not exist yet)"
|
|
10
|
+
echo
|
|
11
|
+
echo "=== Plans referenced this session ==="
|
|
12
|
+
ls -t docs/plans/ 2>/dev/null | head -5
|
|
13
|
+
handoff: always
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# Review session and persist retro notes
|
|
17
|
+
|
|
18
|
+
The user wants a retrospective on this session. Issue number (if provided): `$1`
|
|
19
|
+
|
|
20
|
+
You **must** load the `ask-user` skill before proposing any changes.
|
|
21
|
+
|
|
22
|
+
## Step 1 — Identify the retro file
|
|
23
|
+
|
|
24
|
+
1. If `$1` is set, treat it as the issue number `N`.
|
|
25
|
+
2. Otherwise, infer `N` from the most recent commit subject in the deterministic output above (look for `(#N)` at the end of `feat:`, `fix:`, or `docs:` commits). If multiple issues appear, list them and ask the user which to retro on with `ask-user`.
|
|
26
|
+
3. Resolve a slug from `docs/plans/NNNN-<slug>.md` if a matching plan exists; otherwise derive a short slug from the issue title via `gh issue view N --json title -q .title`.
|
|
27
|
+
4. The retro file is `docs/retro/NNNN-<slug>.md`. Create the directory if missing.
|
|
28
|
+
|
|
29
|
+
## Step 2 — Synthesize observations
|
|
30
|
+
|
|
31
|
+
Review what happened across this session — the user prompts, your tool calls, corrections, rework, and commits. Be specific: cite file paths, commit subjects, and concrete tool sequences. Categorize each friction point with one label:
|
|
32
|
+
|
|
33
|
+
- `premature-convergence` — picked the first viable approach without exploring alternatives
|
|
34
|
+
- `missing-context` — didn't check existing code, docs, conventions, or upstream specs
|
|
35
|
+
- `wrong-abstraction` — operated at the wrong level (mechanical when strategy was needed, or vice versa)
|
|
36
|
+
- `scope-drift` — went beyond what was asked or missed the actual ask
|
|
37
|
+
- `rabbit-hole` — chased symptoms instead of questioning assumptions
|
|
38
|
+
- `instruction-violation` — had clear instructions in `AGENTS.md` or the prompt but didn't follow them
|
|
39
|
+
- `other` — describe
|
|
40
|
+
|
|
41
|
+
For each friction point describe the **concrete impact**: time wasted, rework caused, follow-up commits needed, or "added friction but no rework."
|
|
42
|
+
|
|
43
|
+
Note whether each `instruction-violation` was **self-identified** (you caught it mid-session) or **user-caught** (the user pointed it out).
|
|
44
|
+
Self-identified failures usually indicate a salience tweak; user-caught failures may indicate the rule needs to be more prominent.
|
|
45
|
+
|
|
46
|
+
### Bidirectional feedback
|
|
47
|
+
|
|
48
|
+
Look for moments where the user could have shared context earlier, intervened with a redirecting question instead of a correction, or where their involvement was mechanical oversight rather than strategic judgment. Frame as opportunity, not criticism.
|
|
49
|
+
|
|
50
|
+
### Novel wins only
|
|
51
|
+
|
|
52
|
+
Record wins only if they are novel or surprising — a new pattern working for the first time, a tool proving its value, a notably clean execution. Skip routine successes.
|
|
53
|
+
|
|
54
|
+
## Step 3 — Write the retro file
|
|
55
|
+
|
|
56
|
+
Append (or create) `docs/retro/NNNN-<slug>.md` with this structure.
|
|
57
|
+
When creating a new file, include YAML frontmatter (see `AGENTS.md` § Documentation frontmatter):
|
|
58
|
+
|
|
59
|
+
```markdown
|
|
60
|
+
---
|
|
61
|
+
issue: N
|
|
62
|
+
issue_title: "<exact title from `gh issue view N`>"
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
# Retro: #N — <issue title>
|
|
66
|
+
|
|
67
|
+
## Final Retrospective (<ISO timestamp>)
|
|
68
|
+
|
|
69
|
+
### Session summary
|
|
70
|
+
|
|
71
|
+
2–3 sentences on what was accomplished.
|
|
72
|
+
|
|
73
|
+
### Observations
|
|
74
|
+
|
|
75
|
+
#### What went well
|
|
76
|
+
|
|
77
|
+
- ...
|
|
78
|
+
|
|
79
|
+
#### What caused friction (agent side)
|
|
80
|
+
|
|
81
|
+
- `<label>` — <description>. Impact: <concrete impact>.
|
|
82
|
+
|
|
83
|
+
#### What caused friction (user side)
|
|
84
|
+
|
|
85
|
+
- ...
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Wrap all code identifiers, filenames, route paths, CLI names, and any text containing underscores in backticks. Use sequential numbering in ordered lists.
|
|
89
|
+
|
|
90
|
+
## Step 4 — Present highlights and proposals (before asking)
|
|
91
|
+
|
|
92
|
+
Surface the synthesis as regular message text **before** invoking `ask-user`. The message must include:
|
|
93
|
+
|
|
94
|
+
1. **Cross-session highlights** — 2–4 short paragraphs synthesizing dominant friction patterns and any wins worth promoting. Not a copy of the retro file — the bridge between observations and proposals.
|
|
95
|
+
2. **Per-proposal context** — for each proposed change: the concrete pain (with tool-call counts or specific examples), why the proposed location is the right home, and the proposed content as a fenced block.
|
|
96
|
+
3. **What you considered but did not propose** — name candidate changes you rejected and why.
|
|
97
|
+
|
|
98
|
+
Candidate change locations for this repo:
|
|
99
|
+
|
|
100
|
+
- `AGENTS.md` — project-wide priorities, code style, conventions.
|
|
101
|
+
- `.pi/prompts/*.md` — slash-command prompt bodies.
|
|
102
|
+
- `docs/configuration.md`, `README.md`, `schemas/pi-autoformat.schema.json` — keep aligned per `AGENTS.md`.
|
|
103
|
+
- New skill or new prompt — only if the rule is reusable across many sessions.
|
|
104
|
+
|
|
105
|
+
## Step 5 — Ask before editing
|
|
106
|
+
|
|
107
|
+
Use the `ask-user` skill once to confirm which proposals to implement. The question itself stays a single sentence; the context belongs in the message above.
|
|
108
|
+
|
|
109
|
+
## Step 6 — Implement approved changes (with scope discipline)
|
|
110
|
+
|
|
111
|
+
The retro session is scoped to **observations and small consensus-driven adjustments**, not substantive rework. A retro commit (`docs(retro): ...`) should land the retro file plus small (~1–3 file) prompt or `AGENTS.md` adjustments the user explicitly confirmed.
|
|
112
|
+
|
|
113
|
+
If a proposed change is larger — touches more than ~3 files, restructures content significantly, or rewrites a prompt's scope — record it in the retro file as a follow-up but **do not** implement it inline. Suggest the user open a GitHub issue and run `/plan-issue` on it.
|
|
114
|
+
|
|
115
|
+
## Step 7 — Verbosity check before landing changes
|
|
116
|
+
|
|
117
|
+
Retro-driven additions to `AGENTS.md` and prompt bodies should land as **rule + tight example**, not **rule + rationale + worked example**. The retro file is the right home for rationale and worked examples.
|
|
118
|
+
|
|
119
|
+
Before landing any change, ask:
|
|
120
|
+
|
|
121
|
+
1. **Rationale placement** — is the _why_ in the retro file, or has it leaked into `AGENTS.md`/prompt? If the latter, move it back and leave a one-clause justification (or a `Refs #N` pointer).
|
|
122
|
+
2. **Example tightness** — can the example fit in one or two lines?
|
|
123
|
+
3. **Hedging audit** — phrases like "should generally," "typically," "usually" often signal the rule isn't crisp enough. Name the exceptions or drop the hedge.
|
|
124
|
+
4. **Sentence length** — sentences over ~30 words usually carry rationale that should be split out.
|
|
125
|
+
|
|
126
|
+
## Step 8 — Record changes made
|
|
127
|
+
|
|
128
|
+
After implementing, edit the retro file directly to append a `### Changes made` subsection under the Final Retrospective stage entry — a numbered list of changes with file paths. Do not split this into multiple sections; one coherent list per retro.
|
|
129
|
+
|
|
130
|
+
## Step 9 — Commit and push
|
|
131
|
+
|
|
132
|
+
1. `git add docs/retro/ AGENTS.md .pi/prompts/` (and any other touched files).
|
|
133
|
+
2. Commit as `docs(retro): add retro notes for issue #N`.
|
|
134
|
+
3. `git push`.
|
|
135
|
+
|
|
136
|
+
If the user suggests further refinements after the commit, implement them, append to the same `### Changes made` section, and commit again. Every change made during the retro must be recorded before the session ends.
|
|
137
|
+
|
|
138
|
+
## Rules
|
|
139
|
+
|
|
140
|
+
- Be conservative — only propose changes clearly justified by evidence in this session.
|
|
141
|
+
- Be specific — provide exact proposed text, not vague suggestions.
|
|
142
|
+
- Look for removals alongside additions.
|
|
143
|
+
- Don't duplicate — check whether a rule already exists in `AGENTS.md` or a prompt before adding.
|
|
144
|
+
- Do not edit `CHANGELOG.md` — release-please owns it.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Push, close a GitHub issue with a summary, and merge the release-please PR
|
|
3
|
+
---
|
|
4
|
+
# Ship the implementation
|
|
5
|
+
|
|
6
|
+
Argument: `$1` is the issue number that was just implemented.
|
|
7
|
+
|
|
8
|
+
## 1. Sync with remote
|
|
9
|
+
|
|
10
|
+
Before pushing, make sure local `HEAD` is current with the remote:
|
|
11
|
+
|
|
12
|
+
1. Run `git pull --ff-only`.
|
|
13
|
+
2. If it fails for **any** reason — uncommitted changes, divergent history, merge conflict, network error, detached HEAD — stop immediately and report the failure to the user. Do not attempt to stash, rebase, force, or otherwise resolve.
|
|
14
|
+
3. Only proceed once the pull reports a clean fast-forward (or `Already up to date.`).
|
|
15
|
+
|
|
16
|
+
## 2. Push
|
|
17
|
+
|
|
18
|
+
- Determine the current branch (`git branch --show-current`).
|
|
19
|
+
- `git push origin HEAD` (or `<branch>:<branch>`).
|
|
20
|
+
- If the push is rejected as non-fast-forward, stop and report — do not force-push.
|
|
21
|
+
|
|
22
|
+
## 3. Verify CI on the pushed commit
|
|
23
|
+
|
|
24
|
+
- Run `gh run list --branch <branch> --limit 3` and find the run for the latest commit (`git rev-parse HEAD`).
|
|
25
|
+
- If the latest run is `in_progress` or `queued`, wait (`sleep 15`) and re-check up to ~3 times.
|
|
26
|
+
- If it lands `failure`, stop and report. Do not close the issue or merge anything.
|
|
27
|
+
- If it lands `success`, continue.
|
|
28
|
+
|
|
29
|
+
## 4. Close the issue
|
|
30
|
+
|
|
31
|
+
Build the close comment from the commits since the previous release:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
git log --oneline <previous-tag-or-base>..HEAD
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The comment should include:
|
|
38
|
+
|
|
39
|
+
- The commit hash that lands the change ("Implemented in `<sha>` …").
|
|
40
|
+
- A short bullet list of feature/breaking commits.
|
|
41
|
+
- One sentence on user-visible behavior change.
|
|
42
|
+
- A note flagging any breaking change (matches `feat!:` commits).
|
|
43
|
+
- If the change unblocks or partially addresses other issues, mention them.
|
|
44
|
+
|
|
45
|
+
Then:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
gh issue close $1 --comment "<the summary above>"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## 5. Merge release-please PR (if present)
|
|
52
|
+
|
|
53
|
+
- `gh pr list --search "release-please" --state open` — find an open release PR for `main`.
|
|
54
|
+
- If none exists, skip to step 6.
|
|
55
|
+
- If one exists:
|
|
56
|
+
- `gh pr view <num> --json mergeable,mergeStateStatus,title` — confirm `MERGEABLE` and `CLEAN`.
|
|
57
|
+
- Note: release-please PRs typically have **no CI runs** because PRs created by the default `GITHUB_TOKEN` do not trigger workflows. This is expected; do not block on it.
|
|
58
|
+
- `gh pr merge <num> --rebase`.
|
|
59
|
+
- `git pull --ff-only` to pick up the release commit and any tag. If this pull fails, stop and report — same rules as step 1.
|
|
60
|
+
|
|
61
|
+
If the release-please PR is in any state other than `CLEAN`/`MERGEABLE`, stop and report — let the user decide.
|
|
62
|
+
|
|
63
|
+
## 6. Final report
|
|
64
|
+
|
|
65
|
+
Print:
|
|
66
|
+
|
|
67
|
+
- The new HEAD on `main` (`git log --oneline -1`).
|
|
68
|
+
- The released version, if a release commit just landed (`git tag --points-at HEAD` or read `package.json`).
|
|
69
|
+
- Issue close confirmation.
|
|
70
|
+
- Anything that was skipped and why.
|
|
71
|
+
|
|
72
|
+
## Constraints
|
|
73
|
+
|
|
74
|
+
- Never force-push.
|
|
75
|
+
- Never merge a release-please PR that is not `MERGEABLE`/`CLEAN`.
|
|
76
|
+
- If CI fails, the issue stays open.
|
|
77
|
+
- If multiple release-please PRs exist for the same component, stop and ask — that's a configuration issue, not a normal merge.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Execute the TDD steps from a docs/plans/ plan as red→green→commit cycles
|
|
3
|
+
---
|
|
4
|
+
# Execute a plan with TDD
|
|
5
|
+
|
|
6
|
+
Argument: `$1` is either a plan path, an issue number, or empty (use the most recently modified plan).
|
|
7
|
+
|
|
8
|
+
## Sync with remote (do this first)
|
|
9
|
+
|
|
10
|
+
Before locating or reading the plan, make sure the working tree is up to date with the remote:
|
|
11
|
+
|
|
12
|
+
1. Run `git pull --ff-only`.
|
|
13
|
+
2. If it fails for **any** reason — uncommitted changes, divergent history, merge conflict, network error, detached HEAD — stop immediately and report the failure to the user. Do not attempt to stash, rebase, force, or otherwise resolve.
|
|
14
|
+
3. Only proceed once the pull reports a clean fast-forward (or `Already up to date.`).
|
|
15
|
+
|
|
16
|
+
## Locate the plan
|
|
17
|
+
|
|
18
|
+
- If `$1` looks like a path, use it.
|
|
19
|
+
- If `$1` is a number, find `docs/plans/NNNN-*.md` matching that integer (issue number or plan number).
|
|
20
|
+
- Otherwise, use the newest file in `docs/plans/` (by mtime).
|
|
21
|
+
|
|
22
|
+
Read the plan in full before doing anything else. If "TDD Order" is missing or empty, stop and report — re-run `/plan-issue` first.
|
|
23
|
+
|
|
24
|
+
## Read project rules
|
|
25
|
+
|
|
26
|
+
Read `AGENTS.md`. The relevant rules for this template:
|
|
27
|
+
|
|
28
|
+
- TypeScript only; avoid `any`.
|
|
29
|
+
- Conventional Commits; commit at meaningful checkpoints.
|
|
30
|
+
- Don't remove functionality without explicit user discussion.
|
|
31
|
+
- Keep `schemas/`, `docs/configuration.md`, `README.md`, and the config loader aligned when any one of them changes.
|
|
32
|
+
|
|
33
|
+
## Execute the TDD cycle
|
|
34
|
+
|
|
35
|
+
For **each** step in the plan's "TDD Order", in order:
|
|
36
|
+
|
|
37
|
+
1. **Red.** Write the failing tests the step describes. Run only the affected test file:
|
|
38
|
+
`pnpm exec vitest run <test-path>` and confirm failures.
|
|
39
|
+
2. **Green.** Implement the minimum code to make those tests pass. Re-run the same file and confirm green.
|
|
40
|
+
3. **Commit.** Use the commit message the plan suggests, or a Conventional Commits message that matches:
|
|
41
|
+
- `test:` for test-only commits (rare; usually folded into the feat).
|
|
42
|
+
- `feat:` for new behavior.
|
|
43
|
+
- `feat!:` for breaking changes the plan calls out (include a `BREAKING CHANGE:` footer).
|
|
44
|
+
- `fix:` for bug fixes.
|
|
45
|
+
|
|
46
|
+
One logical change per commit. Do not bundle multiple TDD steps into one commit.
|
|
47
|
+
|
|
48
|
+
If a step uncovers a problem the plan didn't anticipate (e.g. a downstream test breaks), fix it as part of the same commit and note the deviation in the commit body. If the deviation is large, stop and ask.
|
|
49
|
+
|
|
50
|
+
## After the last TDD step
|
|
51
|
+
|
|
52
|
+
1. Run the full suite: `pnpm exec vitest run`. Must be all green.
|
|
53
|
+
2. Run the type check: `pnpm run typecheck` (`tsc --noEmit`). Must succeed — Vitest does not typecheck.
|
|
54
|
+
3. Run the linter: `pnpm run lint`. If it fails, run `pnpm run lint:fix` and re-check. Commit any fixup as part of the most recent feat commit (amend) only if you haven't pushed; otherwise as a `style:` commit. The fixup must NOT land in a `docs:` commit.
|
|
55
|
+
4. Update docs the plan flags: `README.md`, `docs/configuration.md`, schemas, etc. Commit as `docs: <summary>`.
|
|
56
|
+
5. **Do not edit `CHANGELOG.md`** — release-please owns it and will generate entries from your Conventional Commit messages on the next release.
|
|
57
|
+
|
|
58
|
+
## Summarize
|
|
59
|
+
|
|
60
|
+
Print:
|
|
61
|
+
|
|
62
|
+
- `git log --oneline <N>` for the commits you just made (N = number of TDD steps + docs).
|
|
63
|
+
- One-line summary of behavioral change.
|
|
64
|
+
- Any test-count delta.
|
|
65
|
+
- Any deviations from the plan.
|
|
66
|
+
|
|
67
|
+
Stop. The next step is `/ship-issue`.
|