@tekyzinc/gsd-t 4.19.11 → 4.19.13

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/CHANGELOG.md CHANGED
@@ -2,6 +2,24 @@
2
2
 
3
3
  All notable changes to GSD-T are documented here. Updated with each release.
4
4
 
5
+ ## [4.19.13] - 2026-07-07
6
+
7
+ ### Fixed — `/gsd-t-stories`: reserve label space when a diagram is height-constrained
8
+
9
+ The aspect-ratio "contain" fit (v4.19.12) set a tall image to the FULL page height, leaving no room for the `Flow Diagram:` label above it — so keep-with-next pushed the whole image to the next page (observed on Newman). The height constraint is now `avail_height = page_height − label_reserve` (label_reserve ≈ 0.5in) instead of full page height, so the label + image always fit on one page. Width-constrained images are unaffected.
10
+
11
+ - `commands/gsd-t-stories.md`: Step 4b — label-reserved page box (`avail_height`), clamp height to it not full page.
12
+ - `templates/playbooks/tekyz-user-stories-format.md`: same.
13
+
14
+ ## [4.19.12] - 2026-07-07
15
+
16
+ ### Fixed — `/gsd-t-stories` diagrams: deterministic aspect-ratio fit + heading placement + no orphans
17
+
18
+ Three layout corrections. **(1) Fit-to-page** rewritten from the vague "prefer LR / verify not clipped" heuristic to the deterministic **aspect-ratio "contain"** algorithm: measure the rendered PNG's pixel W×H, compare `img_AR` to the page aspect ratio, and clamp ONLY the constraining dimension (`width = page_width` if the image is wider than the page, else `height = page_height`) — embedded via an HTML `<img>` with a single dimension so it always fits with no clipping or distortion. **(2) Heading placement** — each section label (`Story:`, `Workflow:`, `Flow Diagram:`, `Mapped Test Cases:`) must sit ABOVE its content, never below the block it introduces. **(3) No orphaned headings** — a heading must stay with its first content on the same page (keep-with-next).
19
+
20
+ - `commands/gsd-t-stories.md`: Step 4b aspect-ratio algorithm + 4c measure/clamp/embed; heading-order + orphan-control rules.
21
+ - `templates/playbooks/tekyz-user-stories-format.md`: same.
22
+
5
23
  ## [4.19.11] - 2026-07-07
6
24
 
7
25
  ### Fixed — `/gsd-t-stories` diagrams: semantic coloring + fit-to-page
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # GSD-T: Contract-Driven Development for Claude Code
2
2
 
3
- **v4.19.11** - A methodology for reliable, parallelizable development using Claude Code with optional Agent Teams support.
3
+ **v4.19.13** - A methodology for reliable, parallelizable development using Claude Code with optional Agent Teams support.
4
4
 
5
5
  **Eliminates context rot** — task-level fresh dispatch (one subagent per task, ~10-20% context each) means compaction never triggers.
6
6
  **Compaction-proof debug loops** — `gsd-t headless --debug-loop` runs test-fix-retest cycles as separate `claude -p` sessions. A JSONL debug ledger persists all hypothesis/fix/learning history across fresh sessions. Anti-repetition preamble injection prevents retrying failed hypotheses. Escalation tiers (sonnet → opus → human) and a hard iteration ceiling enforced externally.
@@ -35,6 +35,10 @@ For EACH story, author in EXACTLY this order (per the format reference):
35
35
  6. **Flow Diagram:** a per-story Mermaid flowchart of THIS story's workflow → rendered PNG → embedded (Step 4).
36
36
  7. **Mapped Test Cases:** table `TC ID | Type | Test Title | Expected Result`. `TC-NNN` sequential across the whole doc; `Type` ∈ {Positive, Negative, Edge}; cover happy-path + failure + boundary; every acceptance-criteria group represented by ≥1 test case.
37
37
 
38
+ **Heading placement + no orphans (MANDATORY layout rules):**
39
+ - **Each section label sits ABOVE the content it introduces — never below it.** The `Flow Diagram:` label immediately PRECEDES its image; `Mapped Test Cases:` immediately PRECEDES its table; `Workflow:` precedes its steps. A label rendered after/below its block is a defect. In markdown, ensure the label line comes on the line(s) directly before the block with no intervening content.
40
+ - **Headings must NOT be orphaned across a page break.** A section label (`Flow Diagram:`, `Mapped Test Cases:`, a story `PREFIX-NNN` title, an epic `EP-NN`) must stay on the same page as at least the first line of its content (keep-with-next). To enforce this in the `.docx` conversion, apply pandoc's page-break control: use a paragraph style / raw-openxml `keepNext` on heading paragraphs, OR insert an explicit page break BEFORE a heading that would otherwise strand at a page bottom, so the heading travels with its content. Never leave a heading alone at the foot of a page with its table/diagram/steps starting on the next.
41
+
38
42
  **No confabulation** (`feedback_no_confabulated_examples`): every story, workflow step, and test case must trace to something in the actual input source. If the source is silent on a needed detail, mark it a `[TODO: confirm with client]` — never invent product specifics.
39
43
 
40
44
  ## Step 3: Scope Summary (§3)
@@ -63,22 +67,35 @@ classDef newfeat fill:#e2f0fb,stroke:#5b9bd5,color:#1f4e79,stroke-dasharray:4
63
67
  - Label decision-branch edges (`-->|Yes|`, `-->|Returning User|`).
64
68
  - Reference the sample styling in `~/.claude/playbooks/tekyz-user-stories-format.md`.
65
69
 
66
- ### 4b. Fit-to-page (MANDATORY — the whole diagram must fit)
70
+ ### 4b. Fit-to-page by ASPECT-RATIO CONTAIN (MANDATORY — the deterministic method)
71
+
72
+ The whole diagram MUST fit inside the page's visible area. **Compare aspect ratios first, then clamp ONLY the constraining dimension** — this is the standard "contain" fit; it guarantees no clipping and no distortion. Do NOT eyeball it or rely on layout luck.
73
+
74
+ **Page dimensions** (the visible printable area) default to **US Letter portrait content box ≈ 6.5in × 9in** (W×H, i.e. 8.5×11 minus 1in margins) unless the deliverable specifies otherwise.
75
+
76
+ **⚠️ RESERVE LABEL SPACE — critical.** Every diagram has a heading label ABOVE it (`Flow Diagram:`) that must sit on the SAME page (4b keep-with-next). If the image is set to the FULL page height, there is no room for the label → keep-with-next pushes the whole image to the next page (the Newman failure). So the height the image may occupy is **`avail_height = page_height − label_reserve`**, where `label_reserve ≈ 0.5in` (heading line + gap). Use `avail_height` — NOT the full `page_height` — as the height constraint. Width is unaffected (`avail_width = page_width`). `page_AR = avail_width / avail_height`.
77
+
78
+ **Algorithm — run per rendered diagram:**
79
+ 1. **Render** the Mermaid to PNG (Step 4c), then **measure its actual pixel dimensions** `img_w × img_h` (e.g. via `sips -g pixelWidth -g pixelHeight <png>` on macOS, or `mmdc` output metadata). `img_AR = img_w / img_h`.
80
+ 2. **Compute both aspect ratios** against the **label-reserved** page box — compare SHAPES, not sizes yet.
81
+ 3. **Clamp the constraining dimension:**
82
+ - **If `img_AR > page_AR`** (image is *wider* than the available box) → **width is the constraint → set embedded `width = avail_width` (= page_width)** (height scales proportionally, lands ≤ avail_height). *Example: a 5-wide × 4-tall image → set width = page width.*
83
+ - **If `img_AR < page_AR`** (image is *taller* than the available box) → **height is the constraint → set embedded `height = avail_height` (= page_height − label_reserve, NOT full page height)** (width scales proportionally). This is what leaves room for the label above. *Example: a 2-wide × 4-tall image → set height = page_height − 0.5in.*
84
+ - **If equal** → either works; set width = avail_width.
85
+ 4. **Embed at that ONE clamped dimension** so the renderer scales the other proportionally. In markdown, use an HTML `<img>` with only the clamped side set (e.g. `<img src="media/<name>.png" width="…" />` or `height="…"`) — never set both (that distorts). For `.docx`, pandoc honors the single dimension. The label + image together now fit on one page.
67
86
 
68
- A long top-down flow overflows the page (the failure the user flagged). Keep EVERY diagram fully on one page:
87
+ **Layout still matters as an INPUT to the ratio** (not a substitute for it): choose `flowchart LR` for long linear flows and `TD` for short ones so the rendered `img_AR` is closer to the page shape *before* clamping this maximizes the final on-page size. But the aspect-ratio clamp above is what GUARANTEES the fit; the direction choice only optimizes how much of the page it fills.
69
88
 
70
- - **Prefer `flowchart LR`** (left-to-right) for long linear flows — wide pages fit more than tall ones. Use `TD` only for short (≤6-node) flows.
71
- - For a flow with many nodes, **break into logical lanes with `subgraph`s**, or split into a "part 1 / part 2" pair of diagrams rather than one that runs off-page.
72
- - Render with an explicit width/scale and padding so nothing is clipped: `mmdc -i <src>.mmd -o share/media/<name>.png --width 1600 --backgroundColor white --scale 2 --padding 20` (a mermaid config `{ "flowchart": { "useMaxWidth": true } }` via `-c` also helps).
73
- - **After rendering, VERIFY the image isn't clipped** — check the PNG's dimensions are sane and, if a node count is high, that the layout direction kept it on-page. If a diagram still overflows, switch direction (`TD`→`LR`) or split it, and re-render. Do NOT ship a clipped diagram (`feedback_no_silent_degradation`).
89
+ Never ship a diagram wider or taller than the page (`feedback_no_silent_degradation`).
74
90
 
75
91
  ### 4c. Render pipeline
76
92
 
77
93
  1. Write each diagram's Mermaid source (with the `classDef` block + role classes + fit-appropriate direction) to `.gsd-t/user-stories/diagrams/<name>.mmd` (app-flow = `app-flow`, per-story = `<PREFIX>-NNN-flow`).
78
94
  2. Render each to PNG: `mmdc -i <src>.mmd -o share/media/<name>.png --width 1600 --backgroundColor white --scale 2 --padding 20` (Mermaid CLI `@mermaid-js/mermaid-cli`; fall back to `npx @mermaid-js/mermaid-cli …`).
79
95
  3. **If `mmdc` is unavailable → HALT** and tell the user to install it (`npm i -g @mermaid-js/mermaid-cli`). Do NOT silently ship raw Mermaid where an embedded image is expected (`feedback_no_silent_degradation`).
80
- 4. Embed each rendered PNG in the markdown at its `Flow Diagram:` / §1 position: `![Flow Diagram](media/<name>.png)`.
81
- 5. Keep the `.mmd` source (editable, version-controllable) alongside the PNG.
96
+ 4. **Measure + clamp per the 4b aspect-ratio algorithm:** read the rendered PNG's pixel `img_w × img_h` (`sips -g pixelWidth -g pixelHeight share/media/<name>.png`), compute `img_AR` vs `page_AR`, and pick the ONE clamped dimension (width=page_width if wider, else height=page_height).
97
+ 5. Embed each rendered PNG at that clamped dimension using an HTML `<img>` with only the constraining side set — e.g. `<img src="media/<name>.png" width="6.5in" />` OR `<img src="media/<name>.png" height="9in" />` (never both). Place it at the `Flow Diagram:` / §1 position.
98
+ 6. Keep the `.mmd` source (editable, version-controllable) alongside the PNG.
82
99
 
83
100
  ## Step 5: Assemble + Deliver
84
101
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tekyzinc/gsd-t",
3
- "version": "4.19.11",
3
+ "version": "4.19.13",
4
4
  "description": "GSD-T: Contract-Driven Development for Claude Code — 54 slash commands with headless-by-default workflow spawning, unattended supervisor relay with event stream, graph-powered code analysis, real-time agent dashboard, task telemetry, doc-ripple enforcement, backlog management, impact analysis, test sync, milestone archival, and PRD generation",
5
5
  "author": "Tekyz, Inc.",
6
6
  "license": "MIT",
@@ -92,6 +92,15 @@ embedded (`![Flow Diagram](media/<PREFIX>-NNN-flow.png)`) — matching the sampl
92
92
  - Cover the happy path (Positive), failure modes (Negative), and boundaries (Edge). Every
93
93
  acceptance-criteria group should be represented by at least one test case.
94
94
 
95
+ ### Heading placement + no orphans (MANDATORY)
96
+
97
+ - Every section label sits ABOVE its content, never below. `Flow Diagram:` precedes its image;
98
+ `Mapped Test Cases:` precedes its table; `Workflow:` precedes its steps. A label below the
99
+ block it introduces is a defect.
100
+ - A heading must NOT be orphaned at a page bottom with its content on the next page — it stays
101
+ with at least the first line of its content (keep-with-next). In `.docx`, enforce with
102
+ `keepNext` on heading paragraphs or an explicit page break before a heading that would strand.
103
+
95
104
  ---
96
105
 
97
106
  ## §3 — Scope Summary
@@ -125,13 +134,30 @@ Green = go/success/action · Orange = decision · Red = destructive/irreversible
125
134
  = new/optional · Purple = screen/state · White = terminal. Decisions are diamonds `{...}`;
126
135
  terminals are round `([...])`; label decision-branch edges (`-->|Yes|`).
127
136
 
128
- ### Fit-to-page (MANDATORY — the whole diagram must fit)
129
-
130
- A long top-down flow overflows the page. Keep EVERY diagram fully on one page:
131
- - Prefer `flowchart LR` (left-to-right) for long linear flows; use `TD` only for 6-node flows.
132
- - For many nodes, break into `subgraph` lanes or split into part-1/part-2 diagrams.
133
- - Render with explicit sizing so nothing clips, then VERIFY the PNG isn't clipped; if it is,
134
- switch direction or split and re-render. Never ship a clipped diagram.
137
+ ### Fit-to-page by ASPECT-RATIO CONTAIN (MANDATORY — deterministic)
138
+
139
+ Compare aspect ratios FIRST, then clamp only the constraining dimension (standard "contain" fit
140
+ no clipping, no distortion). Page = visible content box, default US Letter portrait ≈ 6.5in × 9in (W×H).
141
+
142
+ **RESERVE LABEL SPACE:** each diagram's `Flow Diagram:` label sits above it on the same page. If the
143
+ image is set to FULL page height, no room is left for the label and keep-with-next pushes the image to
144
+ the next page (the Newman bug). So use `avail_height = page_height − label_reserve` (label_reserve ≈
145
+ 0.5in) as the height constraint, NOT full page_height. `avail_width = page_width`;
146
+ `page_AR = avail_width / avail_height`.
147
+
148
+ 1. Render to PNG, then MEASURE its pixels `img_w × img_h` (`sips -g pixelWidth -g pixelHeight`);
149
+ `img_AR = img_w / img_h`.
150
+ 2. Compare shapes against the label-reserved box:
151
+ - `img_AR > page_AR` (wider) → **set width = avail_width (= page_width)** (height scales, fits).
152
+ - `img_AR < page_AR` (taller) → **set height = avail_height (= page_height − 0.5in, NOT full page)**
153
+ (width scales) — this leaves room for the label above.
154
+ - equal → set width = avail_width.
155
+ 3. Embed with ONLY the clamped side set (`<img … width>` OR `height`, never both). Label + image fit
156
+ on one page.
157
+
158
+ Direction (`LR` for long flows, `TD` for short) is chosen to bring `img_AR` closer to `page_AR`
159
+ BEFORE clamping (maximizes final on-page size) — but the ratio clamp is what guarantees the fit.
160
+ Never ship a diagram larger than the page.
135
161
 
136
162
  ### Render
137
163