bigpowers 2.50.0 → 2.52.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 (91) hide show
  1. package/.pi/package.json +1 -1
  2. package/.pi/prompts/plan-release.md +0 -1
  3. package/.pi/prompts/release-branch.md +74 -56
  4. package/.pi/prompts/session-state.md +2 -0
  5. package/.pi/prompts/survey-context.md +1 -1
  6. package/.pi/skills/plan-release/SKILL.md +0 -1
  7. package/.pi/skills/release-branch/SKILL.md +74 -56
  8. package/.pi/skills/session-state/SKILL.md +2 -0
  9. package/.pi/skills/survey-context/SKILL.md +1 -1
  10. package/CHANGELOG.md +23 -0
  11. package/CLAUDE.md +9 -0
  12. package/package.json +1 -1
  13. package/scripts/audit-compliance.sh +1 -4
  14. package/scripts/record-cycle-time.sh +340 -0
  15. package/scripts/trace-stories.sh +612 -0
  16. package/scripts/validate-okf.sh +198 -0
  17. package/scripts/wait-for-ci.sh +130 -0
  18. package/skills/align-grid/SKILL.md +1 -0
  19. package/skills/assess-impact/SKILL.md +1 -0
  20. package/skills/audit-code/SKILL.md +1 -0
  21. package/skills/audit-plan/SKILL.md +1 -0
  22. package/skills/build-epic/SKILL.md +1 -0
  23. package/skills/change-request/SKILL.md +1 -0
  24. package/skills/commit-message/SKILL.md +1 -0
  25. package/skills/compose-workflow/SKILL.md +1 -0
  26. package/skills/craft-skill/SKILL.md +1 -0
  27. package/skills/deepen-architecture/SKILL.md +1 -0
  28. package/skills/define-language/SKILL.md +1 -0
  29. package/skills/define-success/SKILL.md +1 -0
  30. package/skills/delegate-task/SKILL.md +1 -0
  31. package/skills/deploy/SKILL.md +1 -0
  32. package/skills/design-interface/SKILL.md +1 -0
  33. package/skills/develop-tdd/SKILL.md +1 -0
  34. package/skills/diagnose-root/SKILL.md +1 -0
  35. package/skills/dispatch-agents/SKILL.md +1 -0
  36. package/skills/edit-document/SKILL.md +1 -0
  37. package/skills/elaborate-spec/SKILL.md +1 -0
  38. package/skills/enforce-first/SKILL.md +1 -0
  39. package/skills/evolve-skill/SKILL.md +1 -0
  40. package/skills/execute-plan/SKILL.md +1 -0
  41. package/skills/extract-design/SKILL.md +1 -0
  42. package/skills/fix-bug/SKILL.md +1 -0
  43. package/skills/grill-me/SKILL.md +1 -0
  44. package/skills/grill-with-docs/SKILL.md +1 -0
  45. package/skills/guard-git/SKILL.md +1 -0
  46. package/skills/hook-commits/SKILL.md +1 -0
  47. package/skills/inspect-quality/SKILL.md +1 -0
  48. package/skills/investigate-bug/SKILL.md +1 -0
  49. package/skills/kickoff-branch/SKILL.md +1 -0
  50. package/skills/map-codebase/SKILL.md +1 -0
  51. package/skills/migrate-spec/SKILL.md +1 -0
  52. package/skills/model-domain/SKILL.md +1 -0
  53. package/skills/orchestrate-project/SKILL.md +1 -0
  54. package/skills/organize-workspace/SKILL.md +1 -0
  55. package/skills/plan-refactor/SKILL.md +1 -0
  56. package/skills/plan-release/SKILL.md +1 -1
  57. package/skills/plan-work/SKILL.md +1 -0
  58. package/skills/publish-package/SKILL.md +1 -0
  59. package/skills/quick-fix/SKILL.md +1 -0
  60. package/skills/release-branch/REFERENCE.md +57 -54
  61. package/skills/release-branch/SKILL.md +20 -4
  62. package/skills/request-review/SKILL.md +1 -0
  63. package/skills/research-first/SKILL.md +1 -0
  64. package/skills/reset-baseline/SKILL.md +1 -0
  65. package/skills/respond-review/SKILL.md +1 -0
  66. package/skills/run-benchmark/SKILL.md +1 -0
  67. package/skills/run-evals/SKILL.md +1 -0
  68. package/skills/run-planning/SKILL.md +1 -0
  69. package/skills/scope-work/SKILL.md +1 -0
  70. package/skills/search-skills/SKILL.md +1 -0
  71. package/skills/security-review/SKILL.md +1 -0
  72. package/skills/seed-conventions/SKILL.md +1 -0
  73. package/skills/session-state/SKILL.md +3 -0
  74. package/skills/setup-environment/SKILL.md +1 -0
  75. package/skills/simulate-agents/SKILL.md +1 -0
  76. package/skills/slice-tasks/SKILL.md +1 -0
  77. package/skills/smoke-test/SKILL.md +1 -0
  78. package/skills/spike-prototype/SKILL.md +1 -0
  79. package/skills/stocktake-skills/SKILL.md +1 -0
  80. package/skills/survey-context/SKILL.md +2 -1
  81. package/skills/terse-mode/SKILL.md +1 -0
  82. package/skills/trace-requirement/SKILL.md +1 -0
  83. package/skills/using-bigpowers/SKILL.md +1 -0
  84. package/skills/validate-contracts/SKILL.md +1 -0
  85. package/skills/validate-fix/SKILL.md +1 -0
  86. package/skills/verify-work/SKILL.md +1 -0
  87. package/skills/visual-dashboard/SKILL.md +1 -0
  88. package/skills/wire-ci/SKILL.md +1 -0
  89. package/skills/wire-observability/SKILL.md +1 -0
  90. package/skills/write-document/SKILL.md +1 -0
  91. package/skills-lock.json +72 -72
@@ -0,0 +1,340 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # record-cycle-time.sh — deterministic, git-derived delivery metrics.
4
+ #
5
+ # Replaces the agent's hand-written story_start/story_end timestamps and
6
+ # hand-arithmetic (which produced fabricated / wall-clock-inflated rows in
7
+ # specs/metrics/cycle-times.yaml). Two metrics, honestly separated:
8
+ #
9
+ # effort_hours ADDITIVE. Idle-stripped estimated effort. Computed as a
10
+ # GLOBAL PARTITION of the commit stream so that
11
+ # Σ(per-story effort) == whole-repo effort, exactly.
12
+ # Overnight / weekend / UAT gaps are dropped by construction.
13
+ #
14
+ # lead_time_minutes NON-ADDITIVE. Calendar latency, first-commit → merge.
15
+ # Aggregate by median/p75 over many stories. NEVER sum.
16
+ #
17
+ # Effort model (git-hours, kimmobrunfeldt/git-hours src/index.js:15,18):
18
+ # * commits sorted by author-date across the WHOLE range;
19
+ # * gap < IDLE (120 min) -> real elapsed time, credited to the *later*
20
+ # commit's story (the work that produced it);
21
+ # * gap >= IDLE -> session boundary: credit a flat PAD (120 min)
22
+ # to the later commit's story, drop the idle time;
23
+ # * the very first commit of the stream is never padded (no left neighbour).
24
+ #
25
+ # Why not run git-hours per story and sum? Because it doesn't sum: each
26
+ # per-story run re-pads its own first commit and drops its own leading gap,
27
+ # so the sum leaks both ways. The global partition above is additive by
28
+ # construction. Attribution of a shared <120-min window to "the later commit's
29
+ # story" is a documented CONVENTION, not a physical truth — it is the only way
30
+ # to keep the numbers summable without double-counting.
31
+ #
32
+ # Story attribution: a `Story: <id>` trailer in the commit message. Commits
33
+ # with no trailer land in the `unattributed` bucket (surfaced, never dropped).
34
+ # Merge commits are excluded (--no-merges); duplicate SHAs cannot occur in a
35
+ # single range.
36
+ #
37
+ # Usage:
38
+ # scripts/record-cycle-time.sh report [--range <git-range>] [--story-key <key>]
39
+ # scripts/record-cycle-time.sh append --story <id> --bcps <n> \
40
+ # [--range <git-range>] [--merged-at <epoch>] [--file <path>] [--story-key <key>]
41
+ #
42
+ # `report` prints the per-story partition + an additivity self-check.
43
+ # `append` recomputes the partition and appends one row for <id> to the ledger.
44
+ #
45
+ set -euo pipefail
46
+
47
+ IDLE_SECONDS=$(( 120 * 60 )) # git-hours maxCommitDiffInMinutes
48
+ PAD_SECONDS=$(( 120 * 60 )) # git-hours firstCommitAdditionInMinutes
49
+ STORY_KEY="Story"
50
+
51
+ die() { echo "record-cycle-time: $*" >&2; exit 1; }
52
+
53
+ usage() {
54
+ cat <<'EOF'
55
+ Usage: scripts/record-cycle-time.sh <command> [flags]
56
+
57
+ Commands:
58
+ report Compute per-story effort partition + additivity self-check.
59
+ Flags: --range <git-range> --story-key <trailer-key>
60
+ append Recompute partition and append one row for a story.
61
+ Flags: --story <id> --bcps <n> [--range <git-range>]
62
+ [--merged-at <epoch>] [--file <path>] [--story-key <trailer-key>]
63
+ self-test Run report, then exit 0 on additivity PASS; exit 1 on FAIL.
64
+ Flags: --range <git-range> --story-key <trailer-key>
65
+ help Show this message.
66
+
67
+ Global flags:
68
+ --help Show this message (works with any subcommand).
69
+
70
+ Description:
71
+ Computes git-derived, additive effort from commit history.
72
+ Two metrics, separated: effort_hours (ADDITIVE, Σ = total) and
73
+ lead_time_minutes (calendar latency, median-aggregate, NEVER sum).
74
+
75
+ Uses the git-hours model: commits sorted by author-date across the
76
+ whole range; gaps < 120 min counted as effort; gaps >= 120 min
77
+ start a new session with a 120-min pad.
78
+ EOF
79
+ exit 0
80
+ }
81
+
82
+ command -v git >/dev/null 2>&1 || die "git not found"
83
+ ROOT="$(git rev-parse --show-toplevel 2>/dev/null)" || die "not inside a git repo"
84
+
85
+ # ---- engine ---------------------------------------------------------------
86
+ # Emits, per story bucket, a TSV line: story <TAB> effort_hours <TAB> commit_count <TAB> first_epoch <TAB> last_epoch
87
+ # Reads the whole range once and partitions globally, so the lines are additive.
88
+ partition() {
89
+ local range="$1" key="$2"
90
+ # US (\x1f) between fields; one commit per line, oldest→newest by author date.
91
+ git -C "$ROOT" log --no-merges "$range" \
92
+ --pretty=format:"%at%x1f%H%x1f%(trailers:key=${key},valueonly,separator=%x2C)" \
93
+ | sort -n \
94
+ | awk -F '\x1f' -v IDLE="$IDLE_SECONDS" -v PAD="$PAD_SECONDS" '
95
+ {
96
+ ts = $1 + 0
97
+ story = $3
98
+ gsub(/[[:space:]]/, "", story)
99
+ if (story == "") story = "unattributed"
100
+ count[story]++
101
+ seen[story] = 1
102
+ if (NR > 1) {
103
+ gap = ts - prev
104
+ if (gap < 0) gap = 0 # guard against author-date skew
105
+ if (gap < IDLE) eff[story] += gap # real elapsed effort -> later commit
106
+ else eff[story] += PAD # new session pad -> later commit
107
+ }
108
+ if (!(story in first)) first[story] = ts
109
+ last[story] = ts
110
+ prev = ts
111
+ }
112
+ END {
113
+ for (s in seen)
114
+ printf "%s\t%.4f\t%d\t%d\t%d\n", s, eff[s] / 3600.0, count[s], first[s], last[s]
115
+ }' \
116
+ | sort
117
+ }
118
+
119
+ # Whole-range effort in one bucket — the independent additivity oracle.
120
+ whole_range_hours() {
121
+ local range="$1"
122
+ git -C "$ROOT" log --no-merges "$range" --pretty=format:"%at" \
123
+ | sort -n \
124
+ | awk -v IDLE="$IDLE_SECONDS" -v PAD="$PAD_SECONDS" '
125
+ { ts=$1+0; if(NR>1){gap=ts-prev; if(gap<0)gap=0; if(gap<IDLE)e+=gap; else e+=PAD} prev=ts }
126
+ END { printf "%.4f\n", e/3600.0 }'
127
+ }
128
+
129
+ cmd_report() {
130
+ local range="HEAD" key="$STORY_KEY"
131
+ while [ $# -gt 0 ]; do
132
+ case "$1" in
133
+ --range) range="$2"; shift 2 ;;
134
+ --story-key) key="$2"; shift 2 ;;
135
+ *) die "unknown flag: $1" ;;
136
+ esac
137
+ done
138
+
139
+ local rows; rows="$(partition "$range" "$key")"
140
+ [ -n "$rows" ] || die "no commits in range '$range'"
141
+
142
+ printf '%-16s %12s %8s %s\n' "story" "effort_hours" "commits" "coding_span"
143
+ printf '%-16s %12s %8s %s\n' "----------------" "------------" "--------" "-----------------"
144
+ local sum
145
+ sum="$(printf '%s\n' "$rows" | awk -F'\t' '
146
+ {
147
+ span = ($5 - $4) / 60.0
148
+ printf "%-16s %12.2f %8d %.0f min\n", $1, $2, $3, span
149
+ total += $2
150
+ }
151
+ END { printf "__TOTAL__ %.4f\n", total > "/dev/stderr" }
152
+ ' 2> >(cat >&2))"
153
+ printf '%s\n' "$sum"
154
+
155
+ # Additivity self-check: Σ(per-story) must equal the whole-range oracle.
156
+ local part_total whole
157
+ part_total="$(printf '%s\n' "$rows" | awk -F'\t' '{t+=$2} END{printf "%.4f\n", t}')"
158
+ whole="$(whole_range_hours "$range")"
159
+ printf -- '----\n'
160
+ printf 'Σ(per-story effort_hours) = %s\n' "$part_total"
161
+ printf 'whole-range effort_hours = %s (independent oracle)\n' "$whole"
162
+ # Compare with a rounding tolerance (per-story values are rounded before summing).
163
+ if awk -v a="$part_total" -v b="$whole" 'BEGIN{d=a-b; if(d<0)d=-d; exit !(d < 0.01)}'; then
164
+ printf 'ADDITIVITY: PASS — the partition sums to the whole (within rounding).\n'
165
+ else
166
+ printf 'ADDITIVITY: FAIL — Σ(%s) != whole(%s)\n' "$part_total" "$whole" >&2
167
+ return 1
168
+ fi
169
+ }
170
+
171
+ cmd_append() {
172
+ local range="HEAD" key="$STORY_KEY" story="" bcps="" merged_at="" file="$ROOT/specs/metrics/cycle-times.yaml"
173
+ local telemetry="" # path to harness telemetry JSON (GSD-2/gsd-pi format, optional)
174
+ while [ $# -gt 0 ]; do
175
+ case "$1" in
176
+ --story) story="$2"; shift 2 ;;
177
+ --bcps) bcps="$2"; shift 2 ;;
178
+ --range) range="$2"; shift 2 ;;
179
+ --merged-at) merged_at="$2"; shift 2 ;;
180
+ --file) file="$2"; shift 2 ;;
181
+ --story-key) key="$2"; shift 2 ;;
182
+ --telemetry) telemetry="$2"; shift 2 ;;
183
+ *) die "unknown flag: $1" ;;
184
+ esac
185
+ done
186
+ [ -n "$story" ] || die "append requires --story <id>"
187
+ [ -n "$bcps" ] || die "append requires --bcps <n>"
188
+ [ -n "$merged_at" ] || merged_at="$(date -u +%s)"
189
+
190
+ local rows line eff count first last
191
+ rows="$(partition "$range" "$key")"
192
+ line="$(printf '%s\n' "$rows" | awk -F'\t' -v s="$story" '$1==s')"
193
+ [ -n "$line" ] || die "story '$story' has no attributable commits in range '$range' (check the 'Story: $story' trailer)"
194
+
195
+ eff="$(printf '%s' "$line" | cut -f2)"
196
+ count="$(printf '%s' "$line" | cut -f3)"
197
+ first="$(printf '%s' "$line" | cut -f4)"
198
+ last="$(printf '%s' "$line" | cut -f5)"
199
+
200
+ # lead time: first commit of the story -> merge (calendar latency; NEVER summed).
201
+ local lead_min
202
+ lead_min="$(awk -v m="$merged_at" -v f="$first" 'BEGIN{printf "%.0f", (m-f)/60.0}')"
203
+
204
+ local first_iso range_lo range_hi
205
+ first_iso="$(date -u -d "@$first" +%Y-%m-%dT%H:%M:%SZ 2>/dev/null || date -u -r "$first" +%Y-%m-%dT%H:%M:%SZ)"
206
+ range_lo="$(git -C "$ROOT" log --no-merges "$range" --pretty=%h --reverse 2>/dev/null \
207
+ | awk 'NR==1{print}')"
208
+ range_hi="$(git -C "$ROOT" rev-parse --short HEAD)"
209
+
210
+ local generated_at
211
+ generated_at="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
212
+
213
+ # ---- telemetry ingestion (GSD-2/gsd-pi style; e40s04) ----
214
+ # If --telemetry <json-file> is provided, read the harness data and populate
215
+ # agent.* fields. Otherwise, agent.* stays null (git effort is the fallback).
216
+ local agent_cost agent_tokens_in agent_tokens_out agent_tokens_cache_read
217
+ local agent_tokens_cache_write agent_tokens_total agent_cache_hit
218
+ local agent_compression agent_tool_calls agent_api_requests
219
+ local agent_duration_ms agent_model agent_tier agent_downgraded agent_skills
220
+ agent_cost="null"; agent_tokens_total="null"; agent_cache_hit="null"
221
+ agent_compression="null"; agent_tool_calls="null"; agent_api_requests="null"
222
+ agent_duration_ms="null"; agent_model="null"; agent_tier="null"
223
+ agent_downgraded="null"; agent_skills="[]"
224
+
225
+ if [ -n "$telemetry" ] && [ -f "$telemetry" ]; then
226
+ # GSD-2/gsd-pi snapshotUnitMetrics JSON format:
227
+ # { cost_usd, tokens: {input, output, cache_read, cache_write, total},
228
+ # cache_hit_rate_pct, compression_savings_pct, tool_calls, api_requests,
229
+ # agent_duration_ms, model, tier, model_downgraded, skills[] }
230
+ if command -v jq >/dev/null 2>&1; then
231
+ agent_cost="$(jq -r '.cost_usd // "null"' "$telemetry")"
232
+ agent_tokens_total="$(jq -r '.tokens.total // "null"' "$telemetry")"
233
+ agent_cache_hit="$(jq -r '.cache_hit_rate_pct // "null"' "$telemetry")"
234
+ agent_compression="$(jq -r '.compression_savings_pct // "null"' "$telemetry")"
235
+ agent_tool_calls="$(jq -r '.tool_calls // "null"' "$telemetry")"
236
+ agent_api_requests="$(jq -r '.api_requests // "null"' "$telemetry")"
237
+ agent_duration_ms="$(jq -r '.agent_duration_ms // "null"' "$telemetry")"
238
+ agent_model="$(jq -r '.model // "null"' "$telemetry")"
239
+ agent_tier="$(jq -r '.tier // "null"' "$telemetry")"
240
+ agent_downgraded="$(jq -r '.model_downgraded // "null"' "$telemetry")"
241
+ agent_skills="$(jq -c '.skills // []' "$telemetry")"
242
+ agent_tokens_in="$(jq -r '.tokens.input // "null"' "$telemetry")"
243
+ agent_tokens_out="$(jq -r '.tokens.output // "null"' "$telemetry")"
244
+ agent_tokens_cache_read="$(jq -r '.tokens.cache_read // "null"' "$telemetry")"
245
+ agent_tokens_cache_write="$(jq -r '.tokens.cache_write // "null"' "$telemetry")"
246
+ else
247
+ echo "record-cycle-time: jq not found — telemetry file ignored (git effort fallback)" >&2
248
+ fi
249
+ fi
250
+
251
+ # Emit OKF bundle (YAML frontmatter + markdown body) per story.
252
+ # This is the canonical format — see specs/templates/story-metrics.okf.md.
253
+ # Fields not yet populated (quality.*, flow.*) carry null placeholders.
254
+ {
255
+ printf -- '---\n'
256
+ printf -- 'okf_kind: story-metrics\n'
257
+ printf -- 'okf_version: "0.1"\n'
258
+ printf -- 'id: %s\n' "$story"
259
+ printf -- 'epic: %s\n' "${story%%s*}" # e40s03 → e40
260
+ printf -- 'bcps: %s\n' "$bcps"
261
+ printf -- 'commit_range: "%s..%s"\n' "${range_lo:-$range_hi}" "$range_hi"
262
+ printf -- 'source: measured\n'
263
+ printf -- 'generated_at: %s\n' "$generated_at"
264
+ printf -- 'generator: scripts/record-cycle-time.sh\n'
265
+ printf -- '\n'
266
+ printf -- '# DORA — the four keys (market standard). ⌀ median aggregate.\n'
267
+ printf -- 'dora:\n'
268
+ printf -- ' lead_time_for_changes_min: %s # ⌀ first commit → merge\n' "$lead_min"
269
+ printf -- ' deployment_frequency: null # %% populated by e40s05\n'
270
+ printf -- ' change_failure: null # %% populated by e40s05\n'
271
+ printf -- ' time_to_restore_min: null # ⌀ populated by e40s05\n'
272
+ printf -- '\n'
273
+ printf -- '# Agent code-generation telemetry (GSD-2 style). Σ additive.\n'
274
+ printf -- 'agent:\n'
275
+ printf -- ' cost_usd: %s # Σ harness telemetry (null = git effort fallback)\n' "$agent_cost"
276
+ printf -- ' tokens:\n'
277
+ printf -- ' input: %s\n' "$agent_tokens_in"
278
+ printf -- ' output: %s\n' "$agent_tokens_out"
279
+ printf -- ' cache_read: %s\n' "$agent_tokens_cache_read"
280
+ printf -- ' cache_write: %s\n' "$agent_tokens_cache_write"
281
+ printf -- ' total: %s\n' "$agent_tokens_total"
282
+ printf -- ' cache_hit_rate_pct: %s # %%\n' "$agent_cache_hit"
283
+ printf -- ' compression_savings_pct: %s # %%\n' "$agent_compression"
284
+ printf -- ' tool_calls: %s # Σ\n' "$agent_tool_calls"
285
+ printf -- ' api_requests: %s # Σ\n' "$agent_api_requests"
286
+ printf -- ' agent_duration_ms: %s # Σ (excludes human UAT wait)\n' "$agent_duration_ms"
287
+ printf -- ' model: %s # •\n' "$agent_model"
288
+ printf -- ' tier: %s # • light|standard|heavy\n' "$agent_tier"
289
+ printf -- ' model_downgraded: %s # •\n' "$agent_downgraded"
290
+ printf -- ' skills: %s # Σ\n' "$agent_skills"
291
+ printf -- '\n'
292
+ printf -- '# Effort (git-derived, idle-stripped, ADDITIVE).\n'
293
+ printf -- 'effort:\n'
294
+ printf -- ' effort_hours: %s # Σ idle-stripped (git-hours, 120-min threshold)\n' "$eff"
295
+ printf -- ' idle_threshold_min: 120 # • recorded for interpretability\n'
296
+ printf -- '\n'
297
+ printf -- '# Quality gate. ⌀ median / • static.\n'
298
+ printf -- 'quality:\n'
299
+ printf -- ' audit_score_pct: null # ⌀ populated by audit-code\n'
300
+ printf -- ' coverage_pct: null # ⌀ populated by test suite\n'
301
+ printf -- ' tests_passed: null # • populated by test suite\n'
302
+ printf -- ' verify_status: null # pass|waived\n'
303
+ printf -- ' rework_count: null # Σ reopens → feeds change_failure\n'
304
+ printf -- '\n'
305
+ printf -- '# Flow (worktree telemetry).\n'
306
+ printf -- 'flow:\n'
307
+ printf -- ' merge_duration_ms: null # ⌀ p50/p95 across stories\n'
308
+ printf -- ' merge_conflicts: null # Σ\n'
309
+ printf -- ' worktree_orphaned: null # •\n'
310
+ printf -- '---\n'
311
+ printf -- '\n'
312
+ printf -- '# Story metrics — %s\n' "$story"
313
+ printf -- '\n'
314
+ printf -- 'Effort derived from git commit history via the git-hours model\n'
315
+ printf -- '(src: kimmobrunfeldt/git-hours, 120-min idle threshold, 120-min\n'
316
+ printf -- 'first-commit pad). Lead time is calendar latency (first commit → merge).\n'
317
+ printf -- '\n'
318
+ printf -- 'Aggregation tags: Σ additive (sum → total) · ⌀ median/p95 (never sum)\n'
319
+ printf -- '· %% rate (ratio over window) · • static (identity).\n'
320
+ } >> "$file"
321
+
322
+ echo "record-cycle-time: OKF bundle written for $story → $file (effort=$eff h, lead=$lead_min min, commits=$count)"
323
+ }
324
+
325
+ [ $# -ge 1 ] || { usage; }
326
+
327
+ # Trap --help before subcommand dispatch
328
+ for a in "$@"; do
329
+ if [ "$a" = "--help" ] || [ "$a" = "-h" ]; then usage; fi
330
+ done
331
+
332
+ sub="$1"; shift
333
+ case "$sub" in
334
+ report) cmd_report "$@" ;;
335
+ append) cmd_append "$@" ;;
336
+ self-test) cmd_report "$@" ;;
337
+ help) usage ;;
338
+ --help) usage ;;
339
+ *) die "unknown subcommand '$sub' (run 'record-cycle-time.sh help' for usage)" ;;
340
+ esac