wizz-method 1.14.0 → 1.16.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.
Files changed (148) hide show
  1. package/package.json +3 -2
  2. package/skills-registry.yaml +4 -0
  3. package/src/bmm-skills/3-solutioning/wizz-architecture/scripts/__pycache__/lint_spine.cpython-313.pyc +0 -0
  4. package/src/bmm-skills/3-solutioning/wizz-architecture/scripts/tests/__pycache__/test_lint_spine.cpython-313-pytest-9.1.1.pyc +0 -0
  5. package/src/bmm-skills/4-implementation/wizz-code-review/SKILL.md +3 -5
  6. package/src/bmm-skills/4-implementation/wizz-code-review/customize.toml +71 -0
  7. package/src/bmm-skills/4-implementation/wizz-code-review/references/claims-check.md +14 -0
  8. package/src/bmm-skills/4-implementation/wizz-code-review/references/deletion-check.md +14 -0
  9. package/src/bmm-skills/4-implementation/wizz-code-review/review-prompts/edge-case-hunter.md +110 -0
  10. package/src/bmm-skills/4-implementation/wizz-code-review/review-prompts/verification-gap.md +113 -0
  11. package/src/bmm-skills/4-implementation/wizz-code-review/steps/step-01-gather-context.md +32 -23
  12. package/src/bmm-skills/4-implementation/wizz-code-review/steps/step-02-review.md +10 -13
  13. package/src/bmm-skills/4-implementation/wizz-code-review/steps/step-03-triage.md +16 -22
  14. package/src/bmm-skills/4-implementation/wizz-code-review/steps/step-04-present.md +4 -2
  15. package/src/bmm-skills/4-implementation/wizz-quick-dev/customize.toml +76 -0
  16. package/src/bmm-skills/4-implementation/wizz-quick-dev/references/claims-check.md +14 -0
  17. package/src/bmm-skills/4-implementation/wizz-quick-dev/references/deletion-check.md +14 -0
  18. package/src/bmm-skills/4-implementation/wizz-quick-dev/review-prompts/edge-case-hunter.md +110 -0
  19. package/src/bmm-skills/4-implementation/wizz-quick-dev/review-prompts/verification-gap.md +113 -0
  20. package/src/bmm-skills/4-implementation/wizz-quick-dev/step-04-review.md +38 -16
  21. package/src/bmm-skills/4-implementation/wizz-retrospective/SKILL.md +56 -1488
  22. package/src/bmm-skills/4-implementation/wizz-retrospective/customize.toml +3 -5
  23. package/src/bmm-skills/4-implementation/wizz-retrospective/references/acceptance-verdict.md +55 -0
  24. package/src/bmm-skills/4-implementation/wizz-retrospective/references/aggregate-views.md +17 -0
  25. package/src/bmm-skills/4-implementation/wizz-retrospective/references/evidence-gathering.md +30 -0
  26. package/src/bmm-skills/4-implementation/wizz-retrospective/references/retro-document.md +84 -0
  27. package/src/bmm-skills/4-implementation/wizz-retrospective/references/team-discussion.md +22 -0
  28. package/src/bmm-skills/4-implementation/wizz-retrospective/scripts/__pycache__/sprint_status.cpython-313.pyc +0 -0
  29. package/src/bmm-skills/4-implementation/wizz-retrospective/scripts/git_evidence.py +304 -0
  30. package/src/bmm-skills/4-implementation/wizz-retrospective/scripts/sprint_status.py +746 -0
  31. package/src/bmm-skills/4-implementation/wizz-retrospective/scripts/tests/__pycache__/test_git_evidence.cpython-313-pytest-9.1.1.pyc +0 -0
  32. package/src/bmm-skills/4-implementation/wizz-retrospective/scripts/tests/__pycache__/test_sprint_status.cpython-313-pytest-9.1.1.pyc +0 -0
  33. package/src/bmm-skills/4-implementation/wizz-retrospective/scripts/tests/fixtures/sprint-status-template.yaml +71 -0
  34. package/src/bmm-skills/4-implementation/wizz-retrospective/scripts/tests/test_git_evidence.py +750 -0
  35. package/src/bmm-skills/4-implementation/wizz-retrospective/scripts/tests/test_sprint_status.py +1579 -0
  36. package/src/bmm-skills/4-implementation/wizz-sprint-planning/SKILL.md +39 -296
  37. package/src/bmm-skills/4-implementation/wizz-sprint-planning/customize.toml +1 -3
  38. package/src/bmm-skills/4-implementation/wizz-sprint-planning/references/fix-sprint-status.md +30 -0
  39. package/src/bmm-skills/4-implementation/wizz-sprint-planning/references/generate-tracking.md +25 -0
  40. package/src/bmm-skills/4-implementation/wizz-sprint-planning/references/readiness-gate.md +20 -0
  41. package/src/bmm-skills/4-implementation/wizz-sprint-planning/references/status-view.md +14 -0
  42. package/src/bmm-skills/4-implementation/wizz-sprint-planning/references/validate.md +10 -0
  43. package/src/bmm-skills/4-implementation/wizz-sprint-planning/scripts/__pycache__/sprint_plan.cpython-313.pyc +0 -0
  44. package/src/bmm-skills/4-implementation/wizz-sprint-planning/scripts/sprint_plan.py +697 -0
  45. package/src/bmm-skills/4-implementation/wizz-sprint-planning/scripts/tests/__pycache__/test_sprint_plan.cpython-313-pytest-9.1.1.pyc +0 -0
  46. package/src/bmm-skills/4-implementation/wizz-sprint-planning/scripts/tests/test_sprint_plan.py +524 -0
  47. package/src/bmm-skills/4-implementation/wizz-sprint-planning/sprint-status-template.yaml +9 -7
  48. package/src/bmm-skills/module-help.csv +3 -3
  49. package/src/core-skills/_shared/handoff-protocol.md +7 -8
  50. package/src/core-skills/module-help.csv +1 -0
  51. package/src/core-skills/wizz-advanced-elicitation/SKILL.md +36 -114
  52. package/src/core-skills/wizz-advanced-elicitation/{methods.csv → assets/methods.csv} +29 -27
  53. package/src/core-skills/wizz-advanced-elicitation/customize.toml +54 -0
  54. package/src/core-skills/wizz-advanced-elicitation/scripts/__pycache__/pick_methods.cpython-313.pyc +0 -0
  55. package/src/core-skills/wizz-advanced-elicitation/scripts/pick_methods.py +233 -0
  56. package/src/core-skills/wizz-advanced-elicitation/scripts/tests/__pycache__/test_pick_methods.cpython-313-pytest-9.1.1.pyc +0 -0
  57. package/src/core-skills/wizz-advanced-elicitation/scripts/tests/test_pick_methods.py +228 -0
  58. package/src/core-skills/wizz-brainstorming/SKILL.md +2 -2
  59. package/src/core-skills/wizz-brainstorming/assets/brain-selector.html +2 -0
  60. package/src/core-skills/wizz-brainstorming/references/converge.md +1 -1
  61. package/src/core-skills/wizz-brainstorming/references/finalize.md +1 -1
  62. package/src/core-skills/wizz-brainstorming/references/headless.md +1 -1
  63. package/src/core-skills/wizz-brainstorming/references/mode-autonomous.md +1 -1
  64. package/src/core-skills/wizz-brainstorming/scripts/__pycache__/brain.cpython-313.pyc +0 -0
  65. package/src/core-skills/wizz-brainstorming/scripts/brain.py +36 -6
  66. package/src/core-skills/wizz-brainstorming/scripts/tests/__pycache__/test_brain.cpython-313-pytest-9.1.1.pyc +0 -0
  67. package/src/core-skills/wizz-brainstorming/scripts/tests/__pycache__/test_brain.cpython-314.pyc +0 -0
  68. package/src/core-skills/wizz-brainstorming/scripts/tests/test_brain.py +24 -2
  69. package/src/core-skills/wizz-customize/scripts/__pycache__/list_customizable_skills.cpython-313.pyc +0 -0
  70. package/src/core-skills/wizz-customize/scripts/tests/__pycache__/test_list_customizable_skills.cpython-313-pytest-9.1.1.pyc +0 -0
  71. package/src/core-skills/wizz-forge-idea/SKILL.md +107 -0
  72. package/src/core-skills/wizz-forge-idea/customize.toml +41 -0
  73. package/src/core-skills/wizz-forge-idea/scripts/__pycache__/resolve_personas.cpython-313.pyc +0 -0
  74. package/src/core-skills/wizz-forge-idea/scripts/__pycache__/resolve_personas.cpython-314.pyc +0 -0
  75. package/src/core-skills/wizz-forge-idea/scripts/resolve_personas.py +275 -0
  76. package/src/core-skills/wizz-forge-idea/scripts/tests/__pycache__/test_resolve_personas.cpython-313-pytest-9.1.1.pyc +0 -0
  77. package/src/core-skills/wizz-forge-idea/scripts/tests/__pycache__/test_resolve_personas.cpython-314.pyc +0 -0
  78. package/src/core-skills/wizz-forge-idea/scripts/tests/test_resolve_personas.py +138 -0
  79. package/src/core-skills/wizz-party-mode/SKILL.md +37 -54
  80. package/src/core-skills/wizz-party-mode/customize.toml +61 -2
  81. package/src/core-skills/wizz-party-mode/references/create-party.md +8 -3
  82. package/src/core-skills/wizz-party-mode/references/mode-agent-team.md +3 -1
  83. package/src/core-skills/wizz-party-mode/references/mode-subagent.md +16 -4
  84. package/src/core-skills/wizz-party-mode/references/party-memory.md +51 -0
  85. package/src/core-skills/wizz-party-mode/scripts/__pycache__/resolve_party.cpython-313.pyc +0 -0
  86. package/src/core-skills/wizz-party-mode/scripts/__pycache__/resolve_party.cpython-314.pyc +0 -0
  87. package/src/core-skills/wizz-party-mode/scripts/resolve_party.py +22 -7
  88. package/src/core-skills/wizz-party-mode/scripts/tests/__pycache__/test_resolve_party.cpython-313-pytest-9.1.1.pyc +0 -0
  89. package/src/core-skills/wizz-party-mode/scripts/tests/__pycache__/test_resolve_party.cpython-314.pyc +0 -0
  90. package/src/core-skills/wizz-party-mode/scripts/tests/{test-resolve_party.py → test_resolve_party.py} +8 -0
  91. package/src/core-skills/wizz-review-edge-case-hunter/SKILL.md +17 -3
  92. package/src/modules/wizz/README.md +1 -1
  93. package/src/modules/wizz/_shared/model-ladder.md +22 -0
  94. package/src/modules/wizz/_shared/token-economy.md +6 -2
  95. package/src/modules/wizz/agents/wizz-ads/customize.toml +1 -1
  96. package/src/modules/wizz/agents/wizz-copy/customize.toml +1 -1
  97. package/src/modules/wizz/agents/wizz-designer/customize.toml +1 -1
  98. package/src/modules/wizz/agents/wizz-growth/customize.toml +11 -1
  99. package/src/modules/wizz/agents/wizz-maestro/customize.toml +1 -1
  100. package/src/modules/wizz/agents/wizz-memoria/customize.toml +1 -1
  101. package/src/modules/wizz/agents/wizz-qa/customize.toml +1 -1
  102. package/src/modules/wizz/agents/wizz-seo/customize.toml +1 -1
  103. package/src/modules/wizz/agents/wizz-social/customize.toml +1 -1
  104. package/src/modules/wizz/overrides/wizz-agent-analyst.toml +1 -1
  105. package/src/modules/wizz/overrides/wizz-agent-architect.toml +1 -1
  106. package/src/modules/wizz/overrides/wizz-agent-dev.toml +1 -1
  107. package/src/modules/wizz/overrides/wizz-agent-pm.toml +1 -1
  108. package/src/modules/wizz/overrides/wizz-agent-tech-writer.toml +1 -1
  109. package/src/modules/wizz/overrides/wizz-agent-ux-designer.toml +1 -1
  110. package/src/modules/wizz/subagents/codex/wizz-exec-haiku.toml +16 -0
  111. package/src/modules/wizz/subagents/codex/wizz-exec-opus.toml +18 -0
  112. package/src/modules/wizz/subagents/codex/wizz-exec-review.toml +17 -0
  113. package/src/modules/wizz/subagents/codex/wizz-exec-sonnet.toml +17 -0
  114. package/src/modules/wizz/subagents/gemini/wizz-exec-haiku.md +15 -0
  115. package/src/modules/wizz/subagents/gemini/wizz-exec-opus.md +17 -0
  116. package/src/modules/wizz/subagents/gemini/wizz-exec-review.md +15 -0
  117. package/src/modules/wizz/subagents/gemini/wizz-exec-sonnet.md +16 -0
  118. package/src/modules/wizz/subagents/opencode/wizz-exec-haiku.md +14 -0
  119. package/src/modules/wizz/subagents/opencode/wizz-exec-opus.md +16 -0
  120. package/src/modules/wizz/subagents/opencode/wizz-exec-review.md +16 -0
  121. package/src/modules/wizz/subagents/opencode/wizz-exec-sonnet.md +15 -0
  122. package/src/modules/wizz/subagents/wizz-exec-opus.md +16 -0
  123. package/src/modules/wizz/subagents/wizz-exec-review.md +15 -0
  124. package/src/scripts/__pycache__/memlog.cpython-313.pyc +0 -0
  125. package/src/scripts/tests/__pycache__/test_memlog.cpython-313-pytest-9.1.1.pyc +0 -0
  126. package/src/scripts/tests/__pycache__/test_resolve_customization.cpython-313-pytest-9.1.1.pyc +0 -0
  127. package/src/skills-lib/pesquisa-de-publico-do-piva/README.md +83 -0
  128. package/src/skills-lib/pesquisa-de-publico-do-piva/SKILL.md +65 -0
  129. package/src/skills-lib/pesquisa-de-publico-do-piva/assets/template.html +414 -0
  130. package/src/skills-lib/pesquisa-de-publico-do-piva/prompts.md +131 -0
  131. package/src/skills-lib/wizz-offer-forge/README.md +13 -0
  132. package/src/skills-lib/wizz-offer-forge/SKILL.md +74 -0
  133. package/src/skills-lib/wizz-offer-forge/references/empilhamento-valor.md +25 -0
  134. package/src/skills-lib/wizz-offer-forge/references/garantia-reversa.md +22 -0
  135. package/src/skills-lib/wizz-offer-forge/references/mecanismo-unico.md +28 -0
  136. package/src/skills-lib/wizz-offer-forge/references/ponte-trafego.md +21 -0
  137. package/src/skills-lib/wizz-router/references/routing-table-flat.md +2 -0
  138. package/tools/installer/core/installer.js +57 -0
  139. package/tools/installer/ide/_config-driven.js +44 -30
  140. package/tools/installer/ide/platform-codes.yaml +42 -3
  141. package/tools/installer/modules/external-manager.js +140 -2
  142. package/tools/installer/modules/official-modules.js +68 -21
  143. package/tools/installer/prompts.js +45 -103
  144. package/tools/installer/ui.js +64 -7
  145. package/wizz-modules.yaml +65 -11
  146. package/src/bmm-skills/4-implementation/wizz-sprint-planning/checklist.md +0 -34
  147. package/src/core-skills/wizz-brainstorming/scripts/memlog.py +0 -202
  148. package/src/core-skills/wizz-brainstorming/scripts/tests/test_memlog.py +0 -265
@@ -30,12 +30,10 @@ activation_steps_append = []
30
30
  # - a file reference prefixed with `file:`, e.g. "file:{project-root}/docs/standards.md"
31
31
  # (glob patterns are supported; the file's contents are loaded and treated as facts).
32
32
 
33
- persistent_facts = [
34
- "file:{project-root}/**/project-context.md",
35
- ]
33
+ persistent_facts = []
36
34
 
37
- # Scalar: executed when the workflow reaches Step 13 (Final Summary and Handoff),
38
- # after the retrospective document is saved and sprint-status is updated. Override wins.
35
+ # Scalar: executed at the end of Phase 5 (Close), after the retrospective
36
+ # document is saved and sprint-status is updated. Override wins.
39
37
  # Leave empty for no custom post-completion behavior.
40
38
 
41
39
  on_complete = ""
@@ -0,0 +1,55 @@
1
+ # Decide: Routing and the Acceptance Verdict
2
+
3
+ Phase 4. Turn the consolidated findings into two outputs: routed action items the human can act on, and an honest verdict on whether the epic met its acceptance criteria. This skill proposes; it does not auto-apply fixes or edit the project spec. The human decides what executes.
4
+
5
+ ## Route each finding
6
+
7
+ Give every finding two independent dispositions:
8
+
9
+ - **What to do about this instance** — *fix now*, *defer*, or *accept as-is*. Fix-now findings become action items. Deferred findings carry enough context to be acted on later without re-investigation. Accepted deviations are recorded so later retros stop re-flagging them.
10
+ - **What would prevent the next one** — the upstream lesson: spec wording, story sizing, a missing convention or gate, or nothing. This is where a recurring finding becomes a process change rather than a one-off fix.
11
+
12
+ Findings from sub-agents or the team discussion are unverified reports, not established facts. Before an action item relies on one, re-check it against the primary source — reopen the file, the commit, the spec. A finding whose source does not hold up is dropped, not routed.
13
+
14
+ ## Action items
15
+
16
+ Compile fix-now findings and process lessons into specific, owned action items. Each names what to change and who owns it. Two kinds are *proposed, not applied* in this version:
17
+
18
+ - **Remediation** — code fixes are written up as action items (or story-shaped work) for the normal dev loop to execute later. The retrospective does not run the dev loop itself.
19
+ - **Spec reconciliation** — where the as-built diverges from the spec, propose the reconciliation as an action item with the evidence attached. The human applies it to the project contract; an uncertain interpretation is never written into the spec automatically.
20
+
21
+ ## Previous-retro follow-through
22
+
23
+ When a prior retro exists, check whether the action items it committed to were completed. Read `action_items` in `{implementation_artifacts}/sprint-status.yaml` and, for every entry belonging to an earlier epic that is not already `done`, record one line in the retrospective document's Previous-retro follow-through section:
24
+
25
+ - **How to address the item** — its `id`, exactly as the file spells it. Legacy entries written before ids existed have none; for those, record the item's `epic` (the integer in the file) plus its exact `action` text, character for character. One or the other is what Phase 5 needs to name the item at all.
26
+ - **Whether it landed** — with the source that shows it: the commit, the file and line, the test. An item you cannot point at is "no evidence found", not "not done" — the reader must be able to tell a checked item from an unchecked one.
27
+ - **The status it argues for** — `done` for a landed item, `in-progress` for one demonstrably underway, or nothing. A proposal, never a write.
28
+
29
+ That record is exactly what Phase 5's `--set-action-status` offer reads: the selector becomes the JSON, the evidence is what the user is asked to confirm, and the proposed status is written only if they confirm it. A run with no prior retro, or one whose `sprint-status.yaml` is unreadable or carries no `action_items`, records that there was nothing to follow through on — and which of those it was, so a missing file is never mistaken for "no outstanding items."
30
+
31
+ ## The verdict
32
+
33
+ Judge the final state against the epic's declared acceptance criteria. If the epic declared none, profile the criteria from the diff and stories and mark the verdict as **profiled** rather than declared. Weigh verification results (the Phase 2 behavior check) and unresolved findings. Render one of:
34
+
35
+ - **Accepted** — criteria demonstrably met in the evidence, no blocking findings open, and **no unfinished stories** for this epic.
36
+ - **Accepted-with-open-items** — criteria met, but named findings remain deferred and tracked — still only when every story of this epic is `done`.
37
+ - **Rejected** — criteria not met, a blocking finding stands unresolved, **or any of this epic's stories is still not `done`**.
38
+
39
+ ### Unfinished stories
40
+
41
+ `pending_stories` is authoritative for this epic's incomplete work, whichever mode produced it: sprint-status story keys in file order from `detect-epic`, or `stories.yaml` ids in list order whose artifact status is not `done`. When that list is non-empty:
42
+
43
+ - The **machine** verdict is **rejected**. Name every unfinished story key in the Acceptance verdict section as the evidence. Do not soften this to accepted-with-open-items: unfinished delivery is not an open finding about a finished epic — the epic itself is incomplete.
44
+ - Record the unfinished keys in Epic summary (interactive) or Assumptions (headless) as the Inputs section already requires.
45
+ - Headless runs have no human at the console: the document's verdict is **rejected** when `pending_stories` was non-empty. Interactive runs may still let a human override (rule 1 below) after seeing the list.
46
+
47
+ If the completeness check did not run (no readable `sprint-status.yaml`), do **not** render a rejected or accepted verdict from the absence of data — say the check was unavailable and weigh only the criteria and findings you have.
48
+
49
+ Three hard rules:
50
+
51
+ 1. A human decision always overrides the machine verdict.
52
+ 2. An epic that fails its criteria with **no** human decision is recorded as **not accepted** — never as silently accepted.
53
+ 3. A non-empty `pending_stories` list makes the machine verdict **rejected**, including in headless mode.
54
+
55
+ The verdict and its evidence carry into the Phase 5 document.
@@ -0,0 +1,17 @@
1
+ # Aggregate Views
2
+
3
+ Phase 2. An epic is many coding sessions, each validated in isolation; the defects that matter are the ones no single session — and no single diff hunk — could see. Nine sessions each added three hundred lines and none ever saw the 3,000-line class they collectively built. These views are properties of the *whole* change, derived across the full diff range from Phase 1.
4
+
5
+ Prefer deterministic derivation: a script that measures the codebase is evidence; a model's impression is not. Where you compute a view inline instead of by script, record the narrowed scope. Every observation that becomes a finding carries a source reference — the file, the symbol, the commits. `references/evidence-gathering.md` is authoritative for what every `git_evidence.py` key means, including the commit-level `is_merge` and `stories` (every story id a subject names, so a commit spanning two counts for both) — read it there before deriving anything from the numbers.
6
+
7
+ ## The catalog
8
+
9
+ - **Architecture delta** — how the dependency structure changed across the epic. Where a language-native dependency tool exists (dependency-cruiser, madge, pydeps, and the like), run it before and after the range and diff the graphs; otherwise derive the module/import graph from the changed files. Look for new cross-cutting dependencies, layering violations, and cycles introduced — structure the code's own conventions would forbid but no single story tripped.
10
+ - **Duplication map** — the same problem solved more than one way across stories. Two sessions independently writing near-identical logic, or a helper reimplemented because the second session did not know the first existed.
11
+ - **God-class / size growth** — files that grew past a healthy size *over the epic*, invisible per-commit because each session added only a little. The `git_evidence.py` pre-pass (Phase 1) reports `added` / `deleted` / `net` per path in `files` — *change volume*, not a file's absolute size or a per-commit growth rate. Those sums cover the range's **non-merge** commits only, and they are always integers: an unmeasurable revision is left out of them rather than nulling them. Rank on `files`, then open the top of the ranking and read each file's real current size and structure before calling anything a god-class — high net churn makes a file a candidate to inspect, not a verdict on its own. Three qualifiers say how far the ranking can be trusted: `binary_revisions` counts that path's revisions whose churn could not be measured, so its true volume is *at least* what the sums report; `merges_measured` short of `merge_count` means some merges were never measured at all, which caps how complete the ranking can be; and `merge_files` mostly restates churn `files` already counted, so summing the two double counts — but it is not redundant, because a merge's first-parent diff also carries whatever the conflict resolution itself added, code that lives in no non-merge commit and therefore appears in `files` nowhere. So read `merge_files` separately, for the paths whose churn shows up only there, rather than discarding it as double counting. Whether a flagged file is genuinely a god-class or legitimately large stays your judgment.
12
+ - **Pattern divergence** — where the epic's code diverges from the conventions the surrounding codebase already established: naming, error handling, test structure, module boundaries. Agents learn conventions by pattern-matching the code, so divergence compounds.
13
+ - **Spec-to-implementation reconciliation** — where the as-built diverges from what the epic spec and PRD/architecture described. Requirements silently dropped, added behavior nobody specified, intent reinterpreted between stories. Each divergence is either a defect (fix), an accepted deviation (record so later runs stop re-flagging it), or a spec that should be reconciled to reality (propose in Phase 4).
14
+
15
+ ## Delegation
16
+
17
+ When sub-agents are available, delegate the derivation: each returns evidence with source refs and checked scope, never a verdict — the parent consolidates and decides. Give each a narrow view and an explicit return format. When sub-agents are unavailable, compute the highest-value views inline (architecture delta and spec reconciliation first) and record which views were narrowed or skipped.
@@ -0,0 +1,30 @@
1
+ # Evidence Gathering
2
+
3
+ Phase 1 of the retrospective. Enumerate what the completed epic produced, so every later analysis works from real artifacts instead of memory. Output is an inventory: what exists, what is missing, and the diff range the rest of the retro will read.
4
+
5
+ ## Inventory checklist
6
+
7
+ Collect what the epic produced and note the source path or range of each:
8
+
9
+ - **Epic spec** — the epic file under `{planning_artifacts}`, including any declared acceptance criteria. If the spec declares how the epic will be judged, that governs Phase 4; if not, note that the verdict will be profiled from the diff.
10
+ - **Story files** — the story specs implemented under this epic (`{implementation_artifacts}`), each carrying its intent and context. These mark the boundaries between coding sessions.
11
+ - **Diff range and commits** — the full set of changes the epic introduced. Establish the range from the first and last story commits (or ask the user for it). The range must *include* the first story commit: `A..B` excludes `A`, so use the parent of the first commit as the left endpoint — `<first-commit>^..<last-commit>` — or the whole first story disappears from the diff, the commit attribution, and the verdict evidence. Then run `python3 {skill-root}/scripts/git_evidence.py --repo {project-root} --range <range> --stories <story-ids>` to get, as JSON, the per-story commit attribution and the per-file change volume — added / deleted / net across the range — that Phase 2 reads. Record the range explicitly; Phase 2's aggregate views and the `wizz-code-review` pass both read it. When the range cannot be established, say so and narrow the scope rather than guessing. Read the output keys precisely: each commit carries `is_merge` and `stories` — *every* id its subject names, so a commit spanning two stories counts for both. `files` sums non-merge commits only. `merge_files` is each measured merge's diff against its first parent, so it *restates* the churn that merge brought in plus whatever the conflict resolution added — never add it into `files`, and never read it as merge-introduced work on its own. `merges_measured` counts the merges on the range head's first-parent spine; `merge_count` counts every merge in the range, so a gap between the two means merges went unmeasured. `binary_revisions` is unmeasured churn, not zero churn.
12
+ - **Sprint status** — `{implementation_artifacts}/sprint-status.yaml`, for which stories are `done` and the current retro-key state.
13
+ - **Previous retrospective** — the prior epic's retro doc, if one exists, so Phase 4 can check whether last epic's action items landed.
14
+ - **Session logs** — conversation or session records for the epic's stories, when available. They are the only record of *why* a session took an unexpected turn — what was tried and abandoned. They are also the evidence most likely to be deleted or expire, so capture references now.
15
+
16
+ ## Stories mode
17
+
18
+ A stories-mode epic is a spec folder. Map it onto the checklist above: `SPEC.md` is the epic spec; `stories.yaml` in list order is the story list, each entry's artifact being the single `stories/<id>-*.md` it names; there is no sprint status; the previous retrospective, when resuming, is `{spec-folder}/RETROSPECTIVE.md`; session logs are unchanged.
19
+
20
+ The diff range differs. Each story records its own baseline in its artifact frontmatter — `baseline_revision` (deprecated) or `baseline_commit` — so there is no single epic-wide range. The range end is the next story's baseline in list order, which is exact because neither skill adds a commit of its own after the work. For the last story, when nothing records the end, derive it from the history — usually `HEAD`, though not always — and mark it inferred rather than recorded. A baseline that is absent or is not a revision leaves that story with no commit or diff evidence — record that too. Group the stories sharing an identical range and run `git_evidence.py` once per distinct range, passing that group's ids as one comma-separated `--stories` value. No `^` is needed here: unlike the sprint-mode range above, the recorded baseline is already the pre-change commit. Ranges may overlap or diverge; count a shared commit or file change once in the aggregate views while keeping each story's range as its provenance.
21
+
22
+ ## Missing evidence
23
+
24
+ Evidence availability varies; never hide a gap. Each later analysis declares what it needs and, when that input is absent, records a narrowed scope rather than guessing. A reader of the final retro must always be able to tell **"checked and clean"** from **"never checked."**
25
+
26
+ - Missing session logs → process-lesson analysis is skipped, and the retro says so.
27
+ - No declared acceptance criteria → the verdict is profiled from the diff and stories, flagged as profiled rather than declared.
28
+ - Sub-agents unavailable → analyses that would delegate run inline over a narrowed scope, and the narrowing is recorded.
29
+
30
+ Carry the inventory forward into Phase 2 as the authoritative list of what is available to read.
@@ -0,0 +1,84 @@
1
+ # Finalize: Retrospective Document and Sprint Status
2
+
3
+ Phase 5. Finalize the retrospective and update sprint tracking. Two writes: the retrospective document, and the `sprint-status.yaml` update. Stories mode makes only the first.
4
+
5
+ ## The retrospective document
6
+
7
+ This document is the run's working artifact: it is created as a skeleton once the epic is fixed and filled as each phase completes, so Phase 5 finalizes rather than writes it from scratch. It lives at `{implementation_artifacts}/epic-{{epic_number}}-retro-{date}.md`, in `{document_output_language}`, as readable markdown; ensure `{implementation_artifacts}` exists. In stories mode it lives at `{spec-folder}/RETROSPECTIVE.md` instead — a fixed name, so a resumed run finds it — and carries the same frontmatter without `epic`, which the folder already names.
8
+
9
+ Open the document with YAML frontmatter a machine can read without parsing the prose — an epic gate or orchestrator keys off `verdict` to decide whether to hold the next epic:
10
+
11
+ ```
12
+ ---
13
+ epic: {{epic_number}}
14
+ date: {date}
15
+ verdict: accepted | accepted-with-open-items | rejected
16
+ criteria: declared | profiled
17
+ headless: true | false
18
+ ---
19
+ ```
20
+
21
+ Keep `verdict` in sync with the Acceptance verdict section below. Do not encode the verdict in the sprint-status retro key — that key's value stays `done` so the existing lifecycle consumers (sprint planning's `optional ↔ done` transition, status TUIs) keep working unchanged.
22
+
23
+ That holds for a **rejected** epic too: the update below marks the retro key `done` whichever way the verdict went, because `done` there means *the retrospective ran*, not *the epic passed*. The script writes no verdict of any kind into `sprint-status.yaml` — there is no `retro_verdict` key and `--verdict` is only echoed back in the result JSON — so a gate or orchestrator that acts on the verdict **must** read this document's frontmatter. Reading sprint-status alone cannot tell a rejected epic from an accepted one.
24
+
25
+ Sections:
26
+
27
+ - **Epic summary** — which epic, the diff range, stories completed, any stories still unfinished (`pending_stories`) that the user accepted retro-ing over, the evidence inventory (what was available, what was missing). Unfinished stories force the machine acceptance verdict to **rejected** (see `references/acceptance-verdict.md`).
28
+ - **Findings** — grouped by aggregate view and by lens, each with its source reference and disposition (fix now / defer / accept). This is the record; do not summarize away the provenance.
29
+ - **Behavior verification** — what was exercised end to end and what was observed, or an explicit note that runtime behavior was not exercised.
30
+ - **Previous-retro follow-through** — if a prior retro exists, whether its action items landed, with evidence, and the selector Phase 5 would need to act on each (`references/acceptance-verdict.md` specifies what to record).
31
+ - **Action items** — the routed fix-now items and process lessons, each with an owner. Note which are proposed remediation or spec reconciliations awaiting human application.
32
+ - **Acceptance verdict** — accepted / accepted-with-open-items / rejected, whether the criteria were declared or profiled, and the evidence behind the call.
33
+ - **Open questions** — what a human answer would materially change, and anything the analyses could not resolve.
34
+ - **Assumptions** — in headless runs, every choice made without the user: which epic was selected (invocation or auto-detect), the `detect-epic --epic <N>` (or unflagged) result including any non-empty `pending_stories`, a machine **rejected** verdict forced by unfinished stories or rendered with no human decision, each proposed item. Omit in interactive runs — an interactive run records the same facts where the user confirmed them, in Epic summary.
35
+
36
+ Do not state time estimates anywhere in the document.
37
+
38
+ ## Sprint-status update
39
+
40
+ Do not hand-edit `sprint-status.yaml` — its comment blocks and quoting are exactly the write that most often corrupts the file. Use the bundled script, which round-trips through a comment-preserving YAML parser, force-quotes values so punctuation (a leading `#`, a colon) cannot break parsing, and validates the result — restoring the original file untouched if the write does not verify:
41
+
42
+ ```
43
+ uv run --no-cache {skill-root}/scripts/sprint_status.py update \
44
+ --file "{implementation_artifacts}/sprint-status.yaml" \
45
+ --epic {{epic_number}} --set-retro-done \
46
+ --add-action '[{"action":"...","owner":"..."}, ...]' \
47
+ --ref "{implementation_artifacts}/epic-{{epic_number}}-retro-{date}.md" \
48
+ --verdict "<accepted | accepted-with-open-items | rejected>" \
49
+ --date "{date}"
50
+ ```
51
+
52
+ Keep every value quoted. `--date` is parsed as `MM-DD-YYYY HH:MM` and nothing else — unpadded spellings like `1-2-2026 9:05` are accepted and normalized to the padded form, but a value that does not parse is rejected with `ok: false`, `restored: true` and exit 1, before the file is touched, and the whole update is a no-op. So pass `{date}` only if it is already in that form; otherwise reformat it, or omit the flag entirely and let the script stamp the current time itself. That format carries a space, which is why the flag must be quoted: unquoted, `--date 07-28-2026 14:23` splits into two argv words and dies at argparse (`{"ok": false, "error": "argument error: unrecognized arguments: 14:23"}`, exit 2). `--file` and `--ref` are quoted for the same reason — an `{implementation_artifacts}` path containing a space breaks them exactly the same way.
53
+
54
+ It sets `development_status["epic-{{epic_number}}-retrospective"]` to `done`, appends one `action_items` entry per proposed item, and bumps `last_updated`. Each appended item carries `status: open`, a stable `id` (`epic-<N>-retro-item-<n>-<slug>` derived from the action text, or the `id` you supply in the JSON), and a `ref` back to this retro document (from `--ref`, or a per-item `ref` in the JSON) — so an orchestrator can dedupe items across re-runs and dispatch each one to its full, sourced finding. `--verdict` is not written into the file; it is echoed back in the result JSON as a signal for consumers. It accepts exactly the frontmatter vocabulary — `accepted`, `accepted-with-open-items`, `rejected` — and any other spelling is rejected (`ok: false`, `restored: true`, exit 1) before the file is touched. Read the JSON it returns:
55
+
56
+ - `ok: true` → report the retro-key transition, `action_items_added`, `action_items_updated`, and the echoed `verdict`.
57
+ - `ok: false` → the file was left untouched (`restored: true`); surface the error, do not hand-edit. `restored: false` means the rollback write also failed and the file may be incomplete — warn the user explicitly.
58
+ - `restored` speaks only for a command that may have written. Every `update` failure carries it; `detect-epic` never emits it, because it never writes; and an invocation the parser itself rejects (`argument error: ...`, exit 2) carries neither the key nor a file to speak about. Read a missing `restored` as "nothing was at risk", never as `false`.
59
+ - `retro_key_found: false` → the retro key was absent, so nothing was marked done; the document still saved, but tell the user sprint-status needs a manual retro entry.
60
+ - `retro_key_found: null` → `--set-retro-done` was not passed, so the key was never looked for. Distinct from `false`, which is a real absence the user needs to be told about.
61
+
62
+ Moving a *previous* epic's action items off `open` is recorded in the retro document either way. When the Phase 4 follow-through has evidence an item landed, or the user says one did, offer to update the sprint-status entries too and run `--set-action-status` with exactly what the user confirms — that flag is the only supported way to change a status; hand-editing never is. It can be passed in the same invocation as the update above, or run on its own:
63
+
64
+ ```
65
+ uv run --no-cache {skill-root}/scripts/sprint_status.py update \
66
+ --file "{implementation_artifacts}/sprint-status.yaml" \
67
+ --epic {{epic_number}} \
68
+ --set-action-status '[{"id":"epic-1-retro-item-1-add-error-handling","status":"done"},{"epic":1,"action":"Exact action text","status":"in-progress"}]'
69
+ ```
70
+
71
+ Rules:
72
+
73
+ - Select an item by its `id`, or — for legacy entries written before ids existed — by `epic` plus the item's exact `action` text. An entry carrying both uses the `id`. Matching is exact: no trimming, no case folding, and `epic` must be a JSON integer. The `--epic` flag does not scope selectors; it only names the retro key and the epic recorded on appended items, so items from any epic are addressable in one call.
74
+ - The only statuses are `open`, `in-progress`, and `done`. `wizz-sprint-planning`'s status view counts both `open` and `in-progress` as open action items, so only `done` retires an item from the surfaced list — moving something to `in-progress` records progress, it does not quiet the dashboard.
75
+ - Every selector must resolve to exactly one item already in the file. Matching nothing, matching more than one, or colliding with another entry in the same array aborts the whole invocation — `ok: false`, `restored: true`, the file byte-identical and nothing partially applied. "Whole invocation" includes any `--set-retro-done` and `--add-action` passed in the same call: one mistyped selector drops the entire update, so re-run the full command after fixing it rather than assuming the retro key was set.
76
+ - Items appended by `--add-action` in the same run are not addressable in that run; they are always written as `open`.
77
+ - Only ever apply a status the user confirmed, and in a headless run do not pass this flag at all.
78
+ - Success reports `action_items_updated`.
79
+
80
+ Only ever apply a status the user confirmed: the evidence justifies proposing a transition, and only the user's confirmation justifies writing it. In a headless run do not use this flag at all — record the transitions you would have proposed in the Previous-retro follow-through section and leave the prior items' statuses alone.
81
+
82
+ ## Finish
83
+
84
+ Report where the document was saved, the verdict, and the action-item count. Then, if `{workflow.on_complete}` is non-empty, follow it as the final terminal instruction before exiting.
@@ -0,0 +1,22 @@
1
+ # Team Discussion (opt-in)
2
+
3
+ An optional discussion layer over Phase 2's findings, off by default. It exists for users who want the retrospective discussed from multiple perspectives, the way a team would. One rule: **the team discusses evidence, never invention.** Agents speak only to findings that carry source references. No agent may describe an event that did not happen or report a pattern the diff does not show.
4
+
5
+ ## When to run it
6
+
7
+ Only when asked — "discuss it as a team," "run party mode," or similar. A default run never enters this phase.
8
+
9
+ ## How to run it
10
+
11
+ Invoke **`wizz-party-mode`**, seeded with the consolidated Phase 2 findings and the epic context, so the installed agents react as real subagents with independent thinking rather than a scripted dialogue. Seed it with:
12
+
13
+ - The findings, each with its source reference, grouped by the aggregate view or lens that produced it.
14
+ - The improvements the evidence confirms — real gains, patterns that worked — so positive observations are grounded in fact.
15
+ - The epic's acceptance criteria (or the profiled stand-in), so the discussion can weigh the verdict.
16
+ - The previous epic's action items and whether they landed, when a prior retro exists, so accountability is grounded in fact.
17
+
18
+ If `wizz-party-mode` is unavailable, a discussion the user asked for must not silently fail to happen. Run it inline over the same seed — take each perspective yourself, hold every perspective to sourced findings — and record in the retrospective document that the discussion ran inline rather than through the installed agents. Record it as the narrowing it is: one model playing every role loses the independent disagreement that surfaces missed findings. State that in the document rather than omitting it.
19
+
20
+ Facilitate in `{communication_language}`, keep the user an active participant, and steer toward systemic understanding over blame — the point is which process or convention would have prevented a finding, not who wrote the line. Capture anything the discussion surfaces that the analyses missed; a genuinely new observation becomes a finding only once you can tie it to a source, otherwise it is a question for Phase 4, not a conclusion.
21
+
22
+ The discussion does not replace Phase 4. Its output feeds the action items and the verdict; it does not render them.
@@ -0,0 +1,304 @@
1
+ # /// script
2
+ # requires-python = ">=3.10"
3
+ # ///
4
+ """Measure git commit and file-change evidence over a revision range.
5
+
6
+ Prints ONLY JSON to stdout. Errors are emitted as JSON to stdout with a
7
+ non-zero exit code: 2 for invalid arguments (rejected before git runs),
8
+ 1 for git or I/O failures. This script only MEASURES — it never judges
9
+ acceleration or violations. The model interprets the numbers.
10
+
11
+ Two git passes. The first lists every commit in the range (merges included)
12
+ and sums the per-file churn of the non-merge commits, which is what `files`
13
+ reports. The second runs only when the range contains merges and measures
14
+ those merges alone, reported separately as `merge_files` — never folded into
15
+ `files`, because a merge's diff against its first parent restates the churn
16
+ of the commits it merged in, which the first pass already counted.
17
+ """
18
+
19
+ import argparse
20
+ import json
21
+ import os
22
+ import re
23
+ import subprocess
24
+ import sys
25
+
26
+ UNIT_SEP = "\x1f"
27
+ # sha, space-separated parents (empty for a root commit), subject.
28
+ LOG_FORMAT = f"--format=%H{UNIT_SEP}%P{UNIT_SEP}%s"
29
+
30
+
31
+ def _emit(obj, code=0):
32
+ sys.stdout.write(json.dumps(obj))
33
+ sys.exit(code)
34
+
35
+
36
+ class JsonArgumentParser(argparse.ArgumentParser):
37
+ """Emit argparse failures on the JSON-only stdout contract, not usage text.
38
+
39
+ The parser is constructed with ``add_help=False``. The override below covers
40
+ ``error()``, but ``-h`` never reaches it: the built-in help action calls
41
+ ``print_help()`` and ``exit(0)`` directly, which would put plain usage text
42
+ on stdout with a zero exit and break the JSON-only contract. Removing the
43
+ action instead of intercepting it routes ``-h`` through the already-tested
44
+ ``error()`` path as an ordinary unrecognized argument. The cost is that the
45
+ ``help=`` strings are unreachable from the CLI; the skill's references carry
46
+ the usage a human needs.
47
+ """
48
+
49
+ def error(self, message):
50
+ _emit({"ok": False, "error": f"argument error: {message}"}, 2)
51
+
52
+
53
+ def _parse_numstat_line(line):
54
+ # numstat lines: "<added>\t<deleted>\t<path>"; binary files use "-".
55
+ parts = line.split("\t")
56
+ if len(parts) < 3:
57
+ return None
58
+ added_raw, deleted_raw, path = parts[0], parts[1], "\t".join(parts[2:])
59
+ added = None if added_raw == "-" else int(added_raw)
60
+ deleted = None if deleted_raw == "-" else int(deleted_raw)
61
+ return added, deleted, path
62
+
63
+
64
+ def _git_log(repo, extra_args, rng):
65
+ """Run one `git log --numstat` pass over `rng` and return its stdout.
66
+
67
+ `core.quotePath=false` keeps non-ASCII paths as real UTF-8 strings instead
68
+ of octal escapes, and `--no-renames` makes a rename an honest delete + add
69
+ instead of an unopenable "src/{a => b}" pseudo-path that splits one file's
70
+ churn across several keys. Both matter for every pass, so both live here.
71
+
72
+ `log.diffMerges=separate` is pinned on the command line because it is what
73
+ `-m` means: a user or repo config setting it to `off` makes pass 2 emit no
74
+ file rows at all, so `merge_files` would come back empty beside a non-zero
75
+ `merges_measured` and read as "the merges changed nothing".
76
+ """
77
+ cmd = [
78
+ "git",
79
+ "-c",
80
+ "core.quotePath=false",
81
+ "-c",
82
+ "log.diffMerges=separate",
83
+ "-C",
84
+ repo,
85
+ "log",
86
+ "--numstat",
87
+ "--no-renames",
88
+ *extra_args,
89
+ LOG_FORMAT,
90
+ rng,
91
+ "--", # terminate rev parsing so the range can never match a pathspec
92
+ ]
93
+ try:
94
+ # Decode explicitly: git emits UTF-8 path bytes regardless of the
95
+ # caller's locale, and a C locale would otherwise decode them as ASCII.
96
+ # surrogateescape, not replace: replace maps every invalid byte to the
97
+ # same U+FFFD, so two distinct non-UTF-8 paths would collapse into one
98
+ # `files` key with their churn silently summed. Lone surrogates survive
99
+ # json.dumps (escaped as \udcXX under ensure_ascii) and json.loads.
100
+ proc = subprocess.run(
101
+ cmd,
102
+ capture_output=True,
103
+ text=True,
104
+ encoding="utf-8",
105
+ errors="surrogateescape",
106
+ env={k: v for k, v in os.environ.items() if not k.startswith("GIT_")},
107
+ )
108
+ except Exception as exc: # noqa: BLE001
109
+ _emit({"ok": False, "error": str(exc)}, 1)
110
+
111
+ if proc.returncode != 0:
112
+ # stderr can be empty (a signal kill, a quiet failure); the exit code is
113
+ # then the only thing left to report, so never emit an empty error.
114
+ _emit(
115
+ {
116
+ "ok": False,
117
+ "error": proc.stderr.strip() or f"git exited {proc.returncode}",
118
+ },
119
+ 1,
120
+ )
121
+ return proc.stdout
122
+
123
+
124
+ def _parse_log(output, stories):
125
+ """Turn one pass's log output into (commits, files_map). Shared by both."""
126
+ commits = []
127
+ files = {} # path -> {path, _added, _deleted, binary_revisions, commit_count}
128
+ seen = set()
129
+ counting = True
130
+
131
+ for raw in output.splitlines():
132
+ if UNIT_SEP in raw:
133
+ sha, parents, subject = raw.split(UNIT_SEP, 2)
134
+ # Under -m, git repeats a merge's header once per parent unless it
135
+ # also honours --first-parent (git 2.31+). Count only the first
136
+ # block for a sha — git emits parents in order, so that block is
137
+ # the first-parent diff either way, and no churn is double counted.
138
+ counting = sha not in seen
139
+ if not counting:
140
+ continue
141
+ seen.add(sha)
142
+ commits.append(
143
+ {
144
+ "sha": sha,
145
+ "subject": subject,
146
+ # Every id the subject names, in --stories order: a commit
147
+ # spanning two stories belongs to both. Word-boundary match
148
+ # so a story id like "1-2" does not also match "11-2".
149
+ "stories": [
150
+ sid
151
+ for sid in stories
152
+ if re.search(rf"\b{re.escape(sid)}\b", subject)
153
+ ],
154
+ "is_merge": len(parents.split()) > 1,
155
+ }
156
+ )
157
+ continue
158
+
159
+ if not counting or not raw.strip():
160
+ continue
161
+
162
+ parsed = _parse_numstat_line(raw)
163
+ if parsed is None:
164
+ continue
165
+ added, deleted, path = parsed
166
+
167
+ entry = files.get(path)
168
+ if entry is None:
169
+ # _added/_deleted are running sums over the path's text revisions.
170
+ entry = {
171
+ "path": path,
172
+ "_added": 0,
173
+ "_deleted": 0,
174
+ "binary_revisions": 0,
175
+ "commit_count": 0,
176
+ }
177
+ files[path] = entry
178
+
179
+ entry["commit_count"] += 1
180
+ if added is None or deleted is None:
181
+ # A binary revision is unmeasurable, not zero — count it alongside
182
+ # the sums instead of nulling the path's real measured churn.
183
+ entry["binary_revisions"] += 1
184
+ else:
185
+ entry["_added"] += added
186
+ entry["_deleted"] += deleted
187
+
188
+ return commits, files
189
+
190
+
191
+ def _file_list(files):
192
+ return [
193
+ {
194
+ "path": entry["path"],
195
+ "added": entry["_added"],
196
+ "deleted": entry["_deleted"],
197
+ "net": entry["_added"] - entry["_deleted"],
198
+ "commit_count": entry["commit_count"],
199
+ "binary_revisions": entry["binary_revisions"],
200
+ }
201
+ for entry in files.values()
202
+ ]
203
+
204
+
205
+ def main(argv=None):
206
+ parser = JsonArgumentParser(
207
+ description=(
208
+ "Measure commit and per-file change evidence over a git revision "
209
+ "range. Measures only; does not judge."
210
+ ),
211
+ add_help=False,
212
+ )
213
+ parser.add_argument("--repo", default=".", help="Path to the git repo (default: .)")
214
+ parser.add_argument("--range", dest="range", help="Revision range REV..REV")
215
+ parser.add_argument(
216
+ "--stories",
217
+ help="Comma-separated story ids to match against commit subjects.",
218
+ )
219
+ args = parser.parse_args(argv)
220
+
221
+ stories = []
222
+ if args.stories:
223
+ # dict.fromkeys dedupes while keeping the caller's order: a repeated id
224
+ # would otherwise land twice in a commit's `stories`, double counting
225
+ # that commit in any per-story total built from the output.
226
+ stories = list(
227
+ dict.fromkeys(s.strip() for s in args.stories.split(",") if s.strip())
228
+ )
229
+
230
+ if not args.range:
231
+ _emit(
232
+ {
233
+ "range": None,
234
+ "note": "no range supplied",
235
+ "commits": [],
236
+ "files": [],
237
+ }
238
+ )
239
+
240
+ # Accept only an explicit REV..REV range. Anything else silently measures
241
+ # the wrong thing: a leading "-" is consumed by git as an option, a single
242
+ # rev logs all history up to it, a bare pathspec logs by path, an empty
243
+ # endpoint ("..", "a..", "..b") makes git default that side to HEAD, and a
244
+ # three-dot "A...B" is a symmetric difference — a different commit set
245
+ # entirely. partition splits at the FIRST "..", so any of those extra-dot
246
+ # shapes leaves `right` empty or dot-prefixed.
247
+ left, _, right = args.range.partition("..")
248
+ if (
249
+ args.range != args.range.strip()
250
+ or args.range.startswith("-")
251
+ or not left
252
+ or not right
253
+ or right.startswith(".")
254
+ ):
255
+ _emit(
256
+ {
257
+ "ok": False,
258
+ "error": f"invalid --range {args.range!r}: expected a revision range like REV..REV",
259
+ },
260
+ 2,
261
+ )
262
+
263
+ # Pass 1 — the listing. No extra args, so full topology: every commit in
264
+ # the range including merges, which is what per-story attribution reads.
265
+ # Merges contribute no numstat rows here, so `files` is non-merge churn.
266
+ commits, files = _parse_log(_git_log(args.repo, [], args.range), stories)
267
+ merge_count = sum(1 for commit in commits if commit["is_merge"])
268
+
269
+ # Pass 2 — merge churn, only when there is any. `-m --first-parent
270
+ # --min-parents=2` walks the range head's first-parent spine and emits
271
+ # exactly one diff-against-first-parent block per merge sitting on it.
272
+ # Merges off that spine are counted in merge_count and never measured,
273
+ # which is precisely why merges_measured is a separate key: the gap
274
+ # between the two is a visible statement that some merges went
275
+ # unmeasured. This never folds into `files` — a merge's first-parent diff
276
+ # restates the churn of the commits it merged in, which pass 1 already
277
+ # counted, so adding it in would double count.
278
+ merge_commits, merge_files = [], {}
279
+ if merge_count:
280
+ merge_commits, merge_files = _parse_log(
281
+ _git_log(
282
+ args.repo,
283
+ ["-m", "--first-parent", "--min-parents=2"],
284
+ args.range,
285
+ ),
286
+ stories,
287
+ )
288
+
289
+ _emit(
290
+ {
291
+ "range": args.range,
292
+ "commit_count": len(commits),
293
+ "merge_count": merge_count,
294
+ "merges_measured": len(merge_commits),
295
+ "commits": commits,
296
+ "files": _file_list(files),
297
+ "merge_files": _file_list(merge_files),
298
+ "stories_supplied": stories,
299
+ }
300
+ )
301
+
302
+
303
+ if __name__ == "__main__":
304
+ main()