@tianhai/pi-workflow-kit 2.2.0 → 2.4.0

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.
@@ -9,21 +9,18 @@ Report on in-flight pipelines in this working tree (a worktree has its own `docs
9
9
 
10
10
  ## Process
11
11
 
12
- 0. **Verify the root** — run `pwd` (or your shell's equivalent) and `git rev-parse --show-toplevel`; if they differ, report both paths and stop — tell the user to restart the session at the repo root; never `cd` (a worktree root counts).
13
- 1. **Discover** — List `docs/plans` recursively, excluding docs/plans/completed/, one list per suffix: `*-design.md`, `*-implementation.md` (legacy — a 2.0 feature has no implementation doc; discovery covers both suffixes), `*-progress.md`, `overview.md` (umbrella docs live in `docs/plans/<date>-<umbrella>/` folders — archived topics are not in flight) — this working tree only. Use whatever recurses in your harness; one example: `find docs/plans -name '<suffix>' -not -path '*/completed/*'`.
14
- 2. **State per topic/part — extract, never ingest.** For each progress file take the `Feature phase:` line by matching it (e.g. `grep -m1 '^Feature phase:' <file>` — wherever the template puts it); the body (execution summary, review reports, code digest) carries nothing status needs, and neither do design docs. Map the line to the displayed state:
15
- - `done` → **`done`** — terminal, never shown as in-flight; append the tally as `N/N` when wanted — the Requirements-table row count (e.g. `grep -c '^| [0-9]' <file>`); at `done` every row is complete
12
+ 0. **Verify the root** — run `pwd` (or your shell's equivalent) and `git rev-parse --show-toplevel`; mismatch → report both paths and stop; never `cd` (a worktree root counts).
13
+ 1. **Discover** — List `docs/plans` recursively, excluding docs/plans/completed/, for `*-design.md`, `*-progress.md`, and `overview.md` (topic docs live in `docs/plans/<date>-<topic>/` folders — archived work is not in flight) — this working tree only. Use whatever recurses in your harness; one example: `find docs/plans -name '<suffix>' -not -path '*/completed/*'`.
14
+ 2. **State per topic/part — extract, never ingest.** For each progress file take the `Feature phase:` line by matching it (e.g. `grep -m1 '^Feature phase:' <file>` — wherever the template puts it); the body (execution summary, review reports, code digest) carries nothing status needs, and neither do design docs. A header reading `Setup: pending` renders the topic as **`awaiting setup`** — the setup checkpoint was never approved (the slot is only ever written when the design doc has a `## Setup` section, so the header alone decides — no design-doc read) — ahead of any phase-derived state below. Map the line to the displayed state:
15
+ - `done` → **`done`** — terminal, never shown as in-flight; every row is resolved (`✅` passed, `❌` failed, `⏭` skipped — resolved, not necessarily passed). Append the tally as `N/N` when wanted — the Requirements-table row count, scoped to that table because the Execution summary rows share the same `| <n> |` row shape and a bare grep would double it (e.g. `sed -n '/^## Requirements/,/^## Execution summary/p' <file> | grep -c '^| [0-9]'`) — and when that same scoped range finds any — `sed -n '/^## Requirements/,/^## Execution summary/p' <file> | grep -c '^| [0-9].*❌'` / `sed -n '/^## Requirements/,/^## Execution summary/p' <file> | grep -c '^| [0-9].*⏭'` (the same scoping, so Execution-summary rows — which share the row shape — and prose mentions of the glyphs do not inflate the count) — render the counts, e.g. `done (1 ❌ · 1 ⏭)`, noting finalizing will require `--force-failed` while `❌` rows stand
16
16
  - `implementing (k/N)` → `execute k/N` (the tally rides on the line itself — no extra read)
17
- - `e2e-written` → `execute 0/N` (the E2E is written and the run continues into implementation — never shown as a paused state)
18
- - `feature-spec-paused` (legacy — a progress file from before the notice replaced the stop) → `execute 0/N`
19
- - `reviewing`, legacy `feature-complete-paused` → `review`
20
- - `ship-paused` → `ship-paused`
17
+ - `e2e-written` → `execute 0/N` (the E2E is written and the run continues into implementation — never shown as a paused state; N comes from the same Requirements-table-scoped row count as `done` — so no tally renders without a defined source)
18
+ - `reviewing` → `review`
19
+ - `ship-paused` → `ship-paused` — next: `/skill:pwk-executing-tasks` (approve the ship checkpoint). Never hint finalizing: only `done` routes there.
21
20
  - no progress file, only `*-design.md` → `design` — next: `/skill:pwk-executing-tasks`
22
21
  - roster-only (named in the overview, no artifacts) → `not started`
23
22
  - no parseable `Feature phase` line → `execute` (with tally if parseable).
24
-
25
- A legacy 1.x topic (`*-implementation.md` stem-matched) uses the same phase-line inference on its progress file.
26
- 3. **Group by umbrella** — for each umbrella `overview.md` (read it — it is status-free and tiny), take its **parts** roster and roll the parts up by state (the overview carries no status): done parts, in-flight parts (design, execute, review, ship-paused), not-started parts. Print one roll-up line — `<umbrella> (umbrella): n done · n in-flight · n not-started` — and when every part is `done` append `— all parts done, ready for /skill:pwk-finalizing`. A `done` standalone topic gets the same hint. Once the umbrella finalizes, its folder — overview included — is disposed, so it no longer appears here. Topics not part of an overview print flat.
23
+ 3. **Group by umbrella** — for each `overview.md`, read its **`## Parts (build order)`** roster (the heading and the `N. <part> — <scope>` item shape are lint-pinned) and roll the parts up by state (the overview carries no status): done parts, in-flight parts (design, execute, review, ship-paused, awaiting setup), not-started parts. A part sitting at the feature-E2E notice (`e2e-written`) rolls up as execute — the notice is a routing moment, not a bucket of its own. Print one roll-up line — `<topic> (umbrella): n done · n in-flight · n not-started` — and when every part is `done` append `— all parts done, ready for /skill:pwk-finalizing`. A `done` single-leaf topic gets the same hint. Once the topic finalizes, its folder — overview included — is disposed, so it no longer appears here. Topics without an overview print flat.
27
24
  4. Print a compact table, grouped under any umbrellas, e.g.:
28
25
 
29
26
  ```text
@@ -32,7 +29,7 @@ Report on in-flight pipelines in this working tree (a worktree has its own `docs
32
29
  payments-ui execute 1/2
33
30
  payments-review review —
34
31
  payments-webhooks not started
35
- auth ship-paused — ready for /skill:pwk-finalizing
32
+ auth ship-paused — ready for /skill:pwk-executing-tasks
36
33
  ```
37
34
 
38
35
  If nothing, suggest `/skill:pwk-brainstorming`.
@@ -13,7 +13,7 @@ Five sections, always: Summary / How it works / Key flows / Gotchas & invariants
13
13
 
14
14
  ## Contract
15
15
 
16
- - **On demand only.** Someone asks (or finalize suggests it as an optional follow-up); it never runs unprompted.
16
+ - **On demand only.** Someone asks — or the ship checkpoint offers it when the code digest's Flow outgrows its cap (see `pwk-executing-tasks`); it never runs unprompted.
17
17
  - **Generated from code, not memory**: the branch diff (`<merge-base>...HEAD` — an unshipped branch is allowed, stamped at HEAD) plus the code as it exists now. Surviving artifacts (ADRs in `docs/adr/`, `docs/lessons.md`, an archived plan under `docs/plans/completed/`) are optional inputs — planning docs are usually gone by the time anyone asks, by design.
18
18
  - **Output**: `docs/walkthroughs/<topic>.md`, **stamped with the commit range** it describes.
19
19
  - **Regeneration overwrites wholesale.** The file is a generated cache of an explanation, never hand-edited; a re-run replaces it end to end. It is **never disposed** — finalize's globs do not touch `docs/walkthroughs/`.
@@ -28,7 +28,7 @@ Five sections, always: Summary / How it works / Key flows / Gotchas & invariants
28
28
  ```markdown
29
29
  # Walkthrough: <topic>
30
30
 
31
- Generated from <merge-base>..<HEAD> — file references are valid at that range.
31
+ Generated from <merge-base>...<HEAD> — file references are valid at that range.
32
32
 
33
33
  ## Summary
34
34
  2–4 sentences: what this feature does and what changed.
@@ -1,59 +0,0 @@
1
- ---
2
- name: pwk-diagnose
3
- description: "Disciplined debugging loop for hard bugs and performance regressions. Use when a test fails unexpectedly, a bug is found during execution, or something is broken. Use this skill whenever the user reports a bug, says 'this doesn't work', 'something's wrong', 'help me debug', or when tests fail for unclear reasons. Works at any point in the workflow — brainstorm, execute, or standalone."
4
- ---
5
-
6
- # Diagnose
7
-
8
- A 6-phase debugging discipline. Phase 1 is the skill — spend disproportionate effort here.
9
-
10
- Invoking `/skill:pwk-diagnose` **exits the gated design phase** (the workflow guard unlocks) — diagnosis needs to write failing tests and `[DEBUG-…]` instrumentation. If you only wanted read-only investigation, use `/skill:pwk-status` (stays gated) or reinstate the lock with `/pwk-guard on`.
11
-
12
- ## Phase 1 — Build a feedback loop
13
-
14
- Create a fast, deterministic, agent-runnable pass/fail signal for the bug before doing anything else. Try in this order: failing test, curl script, CLI invocation, headless browser script.
15
-
16
- Other strategies when the basics don't work:
17
- - **Bisection** — bug appeared between two known states? Automate "boot at state X, check, repeat" to bisect
18
- - **Replay** — save a real network request or event log to disk, replay it through the code path in isolation
19
-
20
- The loop must produce the failure mode the **user** described — not a nearby but different failure. Iterate on the loop itself: can you make it faster? Sharper? More deterministic?
21
-
22
- If you genuinely cannot build a loop, stop and say so. List what you tried. Ask for access to a reproducing environment or a captured artifact.
23
-
24
- Hold at Phase 1 until you have a loop you believe in. Everything downstream — hypotheses, instrumentation, the fix — depends on that loop actually reproducing the user's symptom.
25
-
26
- ## Phase 2 — Reproduce
27
-
28
- Run the loop. Confirm:
29
- - The failure matches the user's reported symptom
30
- - The failure is reproducible across multiple runs
31
- - You've captured the exact symptom (error message, wrong output, slow timing)
32
-
33
- Then **minimize the repro** — strip it down to the smallest input, shortest path, or fewest steps that still triggers the bug. A minimized repro dramatically narrows the hypothesis space.
34
-
35
- ## Phase 3 — Hypothesise
36
-
37
- Generate 3-5 ranked hypotheses. Each must be falsifiable:
38
-
39
- > "If `<X>` is the cause, then `<changing Y>` will make the bug disappear / `<changing Z>` will make it worse."
40
-
41
- Show the ranked list to the user before testing. They often have domain knowledge that re-ranks instantly.
42
-
43
- ## Phase 4 — Instrument
44
-
45
- Each probe must map to a specific hypothesis. Change one variable at a time. Tag every debug log with a unique prefix (e.g. `[DEBUG-a4f2]`) for easy cleanup later. Prefer a debugger breakpoint over logs when available.
46
-
47
- ## Phase 5 — Fix + regression test
48
-
49
- Write the regression test **before** the fix — but only if there's a correct seam (one that exercises the real bug pattern at the call site). If no correct seam exists, note it — the codebase architecture is preventing the bug from being locked down.
50
-
51
- ## Phase 6 — Cleanup
52
-
53
- Required before declaring done:
54
- - Original repro no longer triggers
55
- - Regression test passes (or absence of seam is documented)
56
- - All `[DEBUG-...]` instrumentation removed
57
- - Ask: what would have prevented this bug?
58
- - If the answer is a repeatable pattern, append a **generic** rule to `docs/lessons.md` (strip domain specifics) so future sessions catch it early.
59
- - If the bug was caused by an architectural problem (no good test seam, tangled callers, hidden coupling), suggest writing an ADR to `docs/adr/` capturing that insight