@12ui/design 0.2.55 → 0.2.57

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 (222) hide show
  1. package/SKILL.md +1 -1
  2. package/dist/branch-client.d.ts +2 -0
  3. package/dist/branch-client.d.ts.map +1 -1
  4. package/dist/branch-client.js +1 -0
  5. package/dist/branch-client.js.map +1 -1
  6. package/dist/cli-arguments.d.ts.map +1 -1
  7. package/dist/cli-arguments.js +2 -0
  8. package/dist/cli-arguments.js.map +1 -1
  9. package/dist/cli-conversion-derivation.d.ts +2 -1
  10. package/dist/cli-conversion-derivation.d.ts.map +1 -1
  11. package/dist/cli-conversion-derivation.js +9 -1
  12. package/dist/cli-conversion-derivation.js.map +1 -1
  13. package/dist/cli-convert-command.d.ts.map +1 -1
  14. package/dist/cli-convert-command.js +111 -16
  15. package/dist/cli-convert-command.js.map +1 -1
  16. package/dist/cli-corpus-command.d.ts.map +1 -1
  17. package/dist/cli-corpus-command.js +5 -2
  18. package/dist/cli-corpus-command.js.map +1 -1
  19. package/dist/cli-corpus-evidence.d.ts.map +1 -1
  20. package/dist/cli-corpus-evidence.js +2 -1
  21. package/dist/cli-corpus-evidence.js.map +1 -1
  22. package/dist/cli-corpus-reference-downloads.d.ts +1 -0
  23. package/dist/cli-corpus-reference-downloads.d.ts.map +1 -1
  24. package/dist/cli-corpus-reference-downloads.js +13 -3
  25. package/dist/cli-corpus-reference-downloads.js.map +1 -1
  26. package/dist/cli-corpus-types.d.ts +2 -0
  27. package/dist/cli-corpus-types.d.ts.map +1 -1
  28. package/dist/cli-draft-command.d.ts +11 -0
  29. package/dist/cli-draft-command.d.ts.map +1 -1
  30. package/dist/cli-draft-command.js +10 -1
  31. package/dist/cli-draft-command.js.map +1 -1
  32. package/dist/cli-help/design.d.ts +2 -2
  33. package/dist/cli-help/design.d.ts.map +1 -1
  34. package/dist/cli-help/design.js +12 -2
  35. package/dist/cli-help/design.js.map +1 -1
  36. package/dist/cli-help/index.d.ts +2 -2
  37. package/dist/cli-improve-command.d.ts.map +1 -1
  38. package/dist/cli-improve-command.js +317 -70
  39. package/dist/cli-improve-command.js.map +1 -1
  40. package/dist/cli-next-command.d.ts.map +1 -1
  41. package/dist/cli-next-command.js +44 -4
  42. package/dist/cli-next-command.js.map +1 -1
  43. package/dist/cli-usage.js +2 -2
  44. package/dist/concept-input.d.ts +21 -0
  45. package/dist/concept-input.d.ts.map +1 -1
  46. package/dist/concept-input.js +32 -10
  47. package/dist/concept-input.js.map +1 -1
  48. package/dist/conversion-client.d.ts +39 -1
  49. package/dist/conversion-client.d.ts.map +1 -1
  50. package/dist/conversion-client.js +205 -3
  51. package/dist/conversion-client.js.map +1 -1
  52. package/dist/corpus-client.d.ts +7 -1
  53. package/dist/corpus-client.d.ts.map +1 -1
  54. package/dist/corpus-client.js +6 -2
  55. package/dist/corpus-client.js.map +1 -1
  56. package/dist/corpus-reference-download-retry.d.ts +68 -0
  57. package/dist/corpus-reference-download-retry.d.ts.map +1 -0
  58. package/dist/corpus-reference-download-retry.js +123 -0
  59. package/dist/corpus-reference-download-retry.js.map +1 -0
  60. package/dist/corpus-request-error.d.ts +17 -0
  61. package/dist/corpus-request-error.d.ts.map +1 -0
  62. package/dist/corpus-request-error.js +21 -0
  63. package/dist/corpus-request-error.js.map +1 -0
  64. package/dist/draft-run.d.ts +9 -0
  65. package/dist/draft-run.d.ts.map +1 -1
  66. package/dist/draft-run.js +22 -5
  67. package/dist/draft-run.js.map +1 -1
  68. package/dist/draft-workspace.d.ts +2 -1
  69. package/dist/draft-workspace.d.ts.map +1 -1
  70. package/dist/draft-workspace.js.map +1 -1
  71. package/dist/hosted-draft-identity.d.ts +1 -0
  72. package/dist/hosted-draft-identity.d.ts.map +1 -1
  73. package/dist/hosted-draft-identity.js +1 -0
  74. package/dist/hosted-draft-identity.js.map +1 -1
  75. package/dist/improve-added-specs.d.ts +9 -0
  76. package/dist/improve-added-specs.d.ts.map +1 -1
  77. package/dist/improve-added-specs.js +28 -7
  78. package/dist/improve-added-specs.js.map +1 -1
  79. package/dist/improve-bootstrap-secret.d.ts +35 -0
  80. package/dist/improve-bootstrap-secret.d.ts.map +1 -0
  81. package/dist/improve-bootstrap-secret.js +61 -0
  82. package/dist/improve-bootstrap-secret.js.map +1 -0
  83. package/dist/improve-capture-redirect.d.ts +46 -0
  84. package/dist/improve-capture-redirect.d.ts.map +1 -0
  85. package/dist/improve-capture-redirect.js +68 -0
  86. package/dist/improve-capture-redirect.js.map +1 -0
  87. package/dist/improve-concept.d.ts +14 -1
  88. package/dist/improve-concept.d.ts.map +1 -1
  89. package/dist/improve-concept.js +29 -8
  90. package/dist/improve-concept.js.map +1 -1
  91. package/dist/improve-conversion-attempts.d.ts +96 -0
  92. package/dist/improve-conversion-attempts.d.ts.map +1 -0
  93. package/dist/improve-conversion-attempts.js +93 -0
  94. package/dist/improve-conversion-attempts.js.map +1 -0
  95. package/dist/improve-conversion-stage.d.ts +14 -0
  96. package/dist/improve-conversion-stage.d.ts.map +1 -1
  97. package/dist/improve-conversion-stage.js +254 -70
  98. package/dist/improve-conversion-stage.js.map +1 -1
  99. package/dist/improve-convert-progress.d.ts +36 -0
  100. package/dist/improve-convert-progress.d.ts.map +1 -0
  101. package/dist/improve-convert-progress.js +43 -0
  102. package/dist/improve-convert-progress.js.map +1 -0
  103. package/dist/improve-convert-resilience.d.ts +116 -0
  104. package/dist/improve-convert-resilience.d.ts.map +1 -1
  105. package/dist/improve-convert-resilience.js +158 -1
  106. package/dist/improve-convert-resilience.js.map +1 -1
  107. package/dist/improve-delivery-stages.d.ts.map +1 -1
  108. package/dist/improve-delivery-stages.js +5 -0
  109. package/dist/improve-delivery-stages.js.map +1 -1
  110. package/dist/improve-dom-diff.d.ts +2 -0
  111. package/dist/improve-dom-diff.d.ts.map +1 -1
  112. package/dist/improve-dom-diff.js +7 -0
  113. package/dist/improve-dom-diff.js.map +1 -1
  114. package/dist/improve-dom-gate.d.ts +7 -0
  115. package/dist/improve-dom-gate.d.ts.map +1 -1
  116. package/dist/improve-dom-gate.js +13 -0
  117. package/dist/improve-dom-gate.js.map +1 -1
  118. package/dist/improve-generation-stages.d.ts +3 -0
  119. package/dist/improve-generation-stages.d.ts.map +1 -1
  120. package/dist/improve-generation-stages.js +56 -10
  121. package/dist/improve-generation-stages.js.map +1 -1
  122. package/dist/improve-icon-svg.d.ts +47 -0
  123. package/dist/improve-icon-svg.d.ts.map +1 -0
  124. package/dist/improve-icon-svg.js +83 -0
  125. package/dist/improve-icon-svg.js.map +1 -0
  126. package/dist/improve-kit-assets.d.ts +129 -0
  127. package/dist/improve-kit-assets.d.ts.map +1 -0
  128. package/dist/improve-kit-assets.js +333 -0
  129. package/dist/improve-kit-assets.js.map +1 -0
  130. package/dist/improve-kit-ignore.d.ts +32 -0
  131. package/dist/improve-kit-ignore.d.ts.map +1 -0
  132. package/dist/improve-kit-ignore.js +111 -0
  133. package/dist/improve-kit-ignore.js.map +1 -0
  134. package/dist/improve-kit-readme.d.ts +11 -2
  135. package/dist/improve-kit-readme.d.ts.map +1 -1
  136. package/dist/improve-kit-readme.js +282 -26
  137. package/dist/improve-kit-readme.js.map +1 -1
  138. package/dist/improve-kit-stall.d.ts +113 -0
  139. package/dist/improve-kit-stall.d.ts.map +1 -0
  140. package/dist/improve-kit-stall.js +311 -0
  141. package/dist/improve-kit-stall.js.map +1 -0
  142. package/dist/improve-kit-status.d.ts +105 -0
  143. package/dist/improve-kit-status.d.ts.map +1 -0
  144. package/dist/improve-kit-status.js +215 -0
  145. package/dist/improve-kit-status.js.map +1 -0
  146. package/dist/improve-options.d.ts +16 -1
  147. package/dist/improve-options.d.ts.map +1 -1
  148. package/dist/improve-options.js +65 -15
  149. package/dist/improve-options.js.map +1 -1
  150. package/dist/improve-plan-annotated-render.d.ts +45 -0
  151. package/dist/improve-plan-annotated-render.d.ts.map +1 -0
  152. package/dist/improve-plan-annotated-render.js +196 -0
  153. package/dist/improve-plan-annotated-render.js.map +1 -0
  154. package/dist/improve-plan-annotator.d.ts +7 -1
  155. package/dist/improve-plan-annotator.d.ts.map +1 -1
  156. package/dist/improve-plan-annotator.js +22 -45
  157. package/dist/improve-plan-annotator.js.map +1 -1
  158. package/dist/improve-raster-layers-section.d.ts +21 -0
  159. package/dist/improve-raster-layers-section.d.ts.map +1 -0
  160. package/dist/improve-raster-layers-section.js +45 -0
  161. package/dist/improve-raster-layers-section.js.map +1 -0
  162. package/dist/improve-reset.d.ts +122 -0
  163. package/dist/improve-reset.d.ts.map +1 -0
  164. package/dist/improve-reset.js +141 -0
  165. package/dist/improve-reset.js.map +1 -0
  166. package/dist/improve-run-summary.d.ts +35 -0
  167. package/dist/improve-run-summary.d.ts.map +1 -0
  168. package/dist/improve-run-summary.js +180 -0
  169. package/dist/improve-run-summary.js.map +1 -0
  170. package/dist/improve-stage-shared.d.ts +44 -1
  171. package/dist/improve-stage-shared.d.ts.map +1 -1
  172. package/dist/improve-stage-shared.js +80 -3
  173. package/dist/improve-stage-shared.js.map +1 -1
  174. package/dist/improve-stop-handler.d.ts +73 -0
  175. package/dist/improve-stop-handler.d.ts.map +1 -0
  176. package/dist/improve-stop-handler.js +126 -0
  177. package/dist/improve-stop-handler.js.map +1 -0
  178. package/dist/improve-terminal-event.d.ts +118 -0
  179. package/dist/improve-terminal-event.d.ts.map +1 -0
  180. package/dist/improve-terminal-event.js +87 -0
  181. package/dist/improve-terminal-event.js.map +1 -0
  182. package/dist/improve-token-patch.d.ts +2 -0
  183. package/dist/improve-token-patch.d.ts.map +1 -1
  184. package/dist/improve-token-patch.js +23 -5
  185. package/dist/improve-token-patch.js.map +1 -1
  186. package/dist/improve-workspace.d.ts +94 -2
  187. package/dist/improve-workspace.d.ts.map +1 -1
  188. package/dist/improve-workspace.js +19 -1
  189. package/dist/improve-workspace.js.map +1 -1
  190. package/dist/index.d.ts +2 -1
  191. package/dist/index.d.ts.map +1 -1
  192. package/dist/index.js +1 -0
  193. package/dist/index.js.map +1 -1
  194. package/dist/legacy-skill-catalog.d.ts.map +1 -1
  195. package/dist/legacy-skill-catalog.js +143 -0
  196. package/dist/legacy-skill-catalog.js.map +1 -1
  197. package/dist/mcp-tool-definitions.js +1 -1
  198. package/dist/mcp-tool-definitions.js.map +1 -1
  199. package/dist/mcp-tool-handler.d.ts.map +1 -1
  200. package/dist/mcp-tool-handler.js +3 -0
  201. package/dist/mcp-tool-handler.js.map +1 -1
  202. package/dist/redesign-capture.d.ts +17 -0
  203. package/dist/redesign-capture.d.ts.map +1 -1
  204. package/dist/redesign-capture.js +55 -3
  205. package/dist/redesign-capture.js.map +1 -1
  206. package/dist/responsive-alternative-materializer.d.ts +19 -0
  207. package/dist/responsive-alternative-materializer.d.ts.map +1 -0
  208. package/dist/responsive-alternative-materializer.js +76 -0
  209. package/dist/responsive-alternative-materializer.js.map +1 -0
  210. package/dist/run-journal-unfinished.d.ts +56 -0
  211. package/dist/run-journal-unfinished.d.ts.map +1 -0
  212. package/dist/run-journal-unfinished.js +126 -0
  213. package/dist/run-journal-unfinished.js.map +1 -0
  214. package/dist/run-journal.d.ts +25 -1
  215. package/dist/run-journal.d.ts.map +1 -1
  216. package/dist/run-journal.js +15 -1
  217. package/dist/run-journal.js.map +1 -1
  218. package/open-design.json +2 -2
  219. package/package.json +1 -1
  220. package/skills/12ui-design/SKILL.md +9 -1
  221. package/skills/12ui-design/improve.md +83 -6
  222. package/skills/12ui-design/inspire.md +1 -1
@@ -1,32 +1,288 @@
1
1
  import { writeFile } from 'node:fs/promises';
2
2
  import path from 'node:path';
3
- export const writeImproveReadme = async (record) => {
4
- const readme = path.join(record.runDir, 'README.md');
3
+ import { IMPROVE_ASSET_ROLE_COPY, IMPROVE_SCRIM_MAX_OPACITY_PCT, improveFrameMappingLine, readImproveKitAssets, } from './improve-kit-assets.js';
4
+ import { IMPROVE_AWAITING_PICK_RULE, IMPROVE_NO_APPROXIMATION_RULE, improveAwaitingPick, improveRecoveryLine, improveStageStatusLine, readImproveKitStatus, } from './improve-kit-status.js';
5
+ import { improveCapturedUrlLine } from './improve-capture-redirect.js';
6
+ import { improveKitIgnoreStatusLine } from './improve-kit-ignore.js';
7
+ import { improveAbandonedLines } from './improve-reset.js';
8
+ import { improvePaths } from './improve-workspace.js';
9
+ /**
10
+ * The kit's front door.
11
+ *
12
+ * It used to open with the directory anatomy, which answers a question nobody
13
+ * had. What two lanes actually needed, and did not get, was: did this run
14
+ * finish, what are these PNGs, and which of them must never be thrown away.
15
+ * Those three answers now come first, and the anatomy comes last.
16
+ */
17
+ /** The file-name shape a reader sees, per role, in the order the glossary reads best. */
18
+ const ROLE_GLOSSARY = [
19
+ { role: 'clean-plate', pattern: 'clean-N' },
20
+ { role: 'cutout', pattern: 'cutout-N' },
21
+ { role: 'upscaled-plate', pattern: 'upscaled-plate-N' },
22
+ { role: 'upscaled-region', pattern: 'upscaled-region-N' },
23
+ { role: 'source-crop', pattern: 'crop-N' },
24
+ ];
25
+ /**
26
+ * One sentence, wherever a resolved `plan/STALL.md` sits under this README.
27
+ *
28
+ * Freshdesk shipped a settled plan whose README said "settled" and whose
29
+ * STALL.md said "INCOMPLETE — no plan"; nothing in the kit said which was
30
+ * current (F21). The file is replaced when the stage settles, and the README
31
+ * says what it now is instead of pointing at it as a live stall.
32
+ */
33
+ const improveResolvedStallLines = (status) => (status.present.stallResolved
34
+ ? ['', '`plan/STALL.md` records an earlier stall in this kit that has since resolved.'
35
+ + ' The plan and target here are current.']
36
+ : []);
37
+ const statusSection = (args) => {
38
+ const lines = ['## Status', ''];
39
+ lines.push(...args.status.stages.map((stage) => `- ${improveStageStatusLine(stage)}`));
40
+ lines.push(`- Target: ${args.status.targetMode}`);
41
+ // The page this kit is actually about, whenever it is not the page that was
42
+ // asked for (F27). It goes in the status block, above everything a reader
43
+ // would otherwise act on, because every artifact below describes it.
44
+ const captured = improveCapturedUrlLine(args.record);
45
+ if (captured)
46
+ lines.push(`- ${captured}`);
47
+ // Where the kit sits relative to the repository being improved, because a
48
+ // committed kit is 100 MB of paid artifacts in someone's history (F17).
49
+ const ignore = improveKitIgnoreStatusLine(args.record.kitIgnore);
50
+ if (ignore)
51
+ lines.push(`- ${ignore}`);
52
+ lines.push(...improveAbandonedLines(args.record));
53
+ if (args.status.complete) {
54
+ lines.push('', ...(args.status.gateBlocked
55
+ ? ['The coverage gate blocked the anchored plan: `plan/GATE.md` replaced `plan-annotated.md`'
56
+ + ' and `token-patch.css`. Read `plan/GATE.md` before touching code; the target, its assets'
57
+ + ' and the raster layers it names are all still here.']
58
+ : args.record.convert?.layout === 'fixed'
59
+ // The event, not just the outcome (F8): a lane that watched a silent
60
+ // wait needs the kit to confirm the responsive export stalled, and
61
+ // `plan/STALL.md` is where the timings and the collect-it-later
62
+ // command live.
63
+ ? ['Responsive export stalled; the plan was built from the fixed-layout fallback.'
64
+ + ' The target HTML is fixed-layout, not responsive, and the LayerDoc and its assets'
65
+ + ' are the full-quality source of truth.',
66
+ ...(args.status.present.stall
67
+ ? ['', 'See `plan/STALL.md` for what stalled, how long it waited, and how to collect'
68
+ + ' the responsive export later if it completes.']
69
+ : [])]
70
+ // A complete kit that still has a STALL.md stalled once and then
71
+ // settled. Saying only "the kit is complete" left the reader to
72
+ // adjudicate this README against a file that said INCOMPLETE (F21).
73
+ : ['Every requested stage settled. The kit is complete.',
74
+ ...improveResolvedStallLines(args.status)]), '');
75
+ return lines;
76
+ }
77
+ lines.push('', `This kit is INCOMPLETE: ${args.status.missing.join(', ')}.`, ...(args.status.present.stall && !args.status.present.stallResolved
78
+ ? ['', 'See `plan/STALL.md` for what the run was waiting on.']
79
+ : improveResolvedStallLines(args.status)), '',
80
+ // A never-picked kit has one recovery, and it is not a resume: heading it
81
+ // "the first resumes" over a single `--from pick` line reads as a stall.
82
+ ...(improveAwaitingPick(args.record)
83
+ ? [IMPROVE_AWAITING_PICK_RULE, '', 'Recovery — pick a candidate; convert and plan run from there:']
84
+ : ['Recovery, in order — the first resumes and replays every settled stage:']), '', ...args.status.recovery.map(improveRecoveryLine), '', IMPROVE_NO_APPROXIMATION_RULE, '');
85
+ return lines;
86
+ };
87
+ const startHere = (args) => {
88
+ const design = path.relative(args.record.runDir, args.status.designImage);
89
+ const hasAssets = args.index.assets.length > 0;
90
+ // A gate block deletes the two files steps 3 and 4 name. Sending a reader to
91
+ // them is how a kit gets abandoned with its assets unread.
92
+ const planSteps = args.status.gateBlocked
93
+ ? ['3. Read `plan/GATE.md`. It says why no selector-anchored plan was emitted, and what to'
94
+ + ' re-capture; the raster layers it lists are still the design.']
95
+ : [
96
+ '3. Apply `plan/token-patch.css` once, at the token layer, not per element.',
97
+ '4. Work `plan/plan-annotated.md` in its own order: raster layers, then matched changes,'
98
+ + ' then added elements.',
99
+ ];
100
+ const frame = args.record.capture
101
+ ? { width: args.record.capture.width, height: args.record.capture.height }
102
+ : args.record.viewport;
103
+ return [
104
+ '## Start here',
105
+ '',
106
+ ...(args.status.complete
107
+ ? []
108
+ : [args.status.gateBlocked
109
+ ? 'Run the recovery above first: the steps below assume a target this kit has not finished.'
110
+ : improveAwaitingPick(args.record)
111
+ ? 'Pick a candidate first (command above); steps 2 to 4 need the target that the pick produces.'
112
+ : hasAssets
113
+ ? 'Run the recovery above first: steps 3 and 4 need a plan this kit does not have yet.'
114
+ : 'Run the recovery above first: steps 2 to 4 need a target this kit does not have yet.', '']),
115
+ // The frame a bound belongs to, before the first step that places anything:
116
+ // a lane read these percentages as `winner.png` pixels and placed short.
117
+ improveFrameMappingLine({
118
+ ...(frame ? { frame } : {}),
119
+ ...(args.index.canvas ? { design: args.index.canvas } : {}),
120
+ }),
121
+ '',
122
+ // A never-picked kit has no winner, so `design` is the capture. Calling
123
+ // that "the design" is the same wrong turn the recovery block used to make.
124
+ improveAwaitingPick(args.record)
125
+ ? '1. Open the candidate PNGs in `candidates/` and pick one (command above).'
126
+ + ' `capture/source.png` is the page as it is today, not the design.'
127
+ : args.status.designKind === 'layerdoc'
128
+ ? `1. Open \`${design}\`. The supplied target document is the design.`
129
+ : `1. Open \`${design}\`. It is the design.`,
130
+ '2. Copy the files the assets table below marks ship into the repository;'
131
+ + ' the rest are references and alternates.',
132
+ ...planSteps,
133
+ `${args.status.gateBlocked ? '4' : '5'}. Before committing, screenshot the page and put it`
134
+ + ` beside \`${design}\`.`,
135
+ '',
136
+ ];
137
+ };
138
+ const assetRow = (asset) => {
139
+ const role = `${asset.roleLabel}${asset.hero ? ' — hero imagery' : ''}`;
140
+ const layer = asset.layer ? `${asset.layer.kind} — ${asset.layer.name}` : 'whole design';
141
+ const bounds = asset.bounds
142
+ ? `${asset.bounds.width.toFixed(1)}% × ${asset.bounds.height.toFixed(1)}%`
143
+ + ` at ${asset.bounds.x.toFixed(1)}%, ${asset.bounds.y.toFixed(1)}%`
144
+ : 'full canvas';
145
+ const instruction = asset.present
146
+ ? asset.instruction
147
+ : `${asset.instruction} (declared by the manifest but missing from this kit)`;
148
+ return `| \`${asset.file}\` | ${asset.ship} | ${role} | ${layer} | ${bounds} | ${instruction} |`;
149
+ };
150
+ const assetsSection = (args) => {
151
+ const design = path.relative(args.record.runDir, args.status.designImage);
5
152
  const lines = [
6
- '# 12ui improve kit', '',
7
- `Input: ${record.input.kind} \`${record.input.value}\``,
8
- `Picked candidate: ${record.pick?.slot ?? (record.target ? 'bring-your-own target' : 'not yet picked')}`, '',
9
- '## Anatomy', '',
10
- '- `improve.json` is the durable stage, purchase, price-ceiling, and replay record.',
11
- `- ${record.input.kind === 'url' ? '`capture/` and `current.domdoc.json` hold the screenshot and selector-verified DOM extraction.' : '`source.png` is the normalized source screenshot.'}`,
12
- '- `candidates/` keeps every generated option and its draft record; `winner.png` is the explicit image target.',
13
- '- `target/` holds the target LayerDoc, responsive HTML when generated, and extracted assets.',
14
- '- `plan/` holds the diff, implementation plan, token patch, added-element assets, or `GATE.md` when anchoring was unsafe.', '',
15
- ...(record.convert?.layout === 'fixed' ? [
16
- '## Fixed-layout target', '',
17
- `- Warning: ${record.convert.responsiveWarning ?? 'Responsive HTML was unavailable.'}`,
18
- '- The target HTML is a fixed-layout fallback derived free from the successful LayerDoc conversion. It is not a responsive deliverable; the LayerDoc remains valid for planning.', '',
19
- ] : []),
20
- '## Next', '',
21
- '- Treat the target HTML when present and `target/winner.layerdoc.json` as the visual source of truth.',
22
- '- Apply the plan in the owning repository, then verify behavior and screenshots there. This kit never applies code.',
23
- '- Re-run from `pick` with another `--pick` slot to reuse capture and candidates; settled paid stages replay.', '',
24
- '## Guardrails', '',
25
- '- Preserve all real content, data, and controls; invent nothing.',
26
- '- Do not describe emptiness or thin content as a defect: that phrasing can invite fabricated UI.',
27
- '- Verify Tailwind v4 arbitrary custom-property syntax, quote CSS `url(...)` values, and update CSP before introducing data URIs.', '',
153
+ '## Assets: what each file is',
154
+ '',
155
+ ...ROLE_GLOSSARY.map(({ role, pattern }) => `- ${IMPROVE_ASSET_ROLE_COPY[role].label}`
156
+ + ` (\`${pattern}\`): ${IMPROVE_ASSET_ROLE_COPY[role].instruction}`),
157
+ `- \`${design}\`: ${IMPROVE_ASSET_ROLE_COPY.design.instruction}`,
158
+ // F30: the single `currentColor` file the plan used to write rendered black
159
+ // in every external form this README recommends.
160
+ '- Icons (`plan/assets/added-*.svg`): reference `<name>.svg` — it carries the design\'s'
161
+ + ' declared colour and is safe as an `<img>`, `background-image`, or `url()`; its'
162
+ + ' `<name>-inline.svg` sibling paints with `currentColor` and is for inlining in the markup'
163
+ + ' or masking with a token colour.',
164
+ '',
28
165
  ];
29
- await writeFile(readme, lines.join('\n'), 'utf8');
30
- return readme;
166
+ if (args.index.assets.length === 0) {
167
+ lines.push(args.status.present.layerDoc
168
+ ? 'This kit has a LayerDoc but no extracted assets yet. Resume before coding.'
169
+ : 'This kit has no extracted assets yet. Resume before coding.', '');
170
+ }
171
+ else {
172
+ lines.push('Ordered by how much of the canvas the layer covers.', '', 'Ship means copy this file into the repository. An alternate resolution is the same layer at'
173
+ + ' another size — pick one. An alternate backdrop is the same plate with a further layer'
174
+ + ' removed as well — it is the background only if you omit that layer. A reference is read,'
175
+ + ' never shipped.', '', 'Plates and cutouts come out at full resolution and run over a megabyte. Pick one resolution'
176
+ + ' per layer and optimise the PNG — or convert it to WebP where the repository already uses'
177
+ + ' one — before committing. Keep the filename stem so the plan still matches.', '', '| File | Ship | Role | Layer | Bounds | What to do with it |', '| --- | --- | --- | --- | --- | --- |', `| \`${design}\` | reference only | winner.png — hero imagery | whole design |`
178
+ + ` 100.0% × 100.0% at 0.0%, 0.0% | ${IMPROVE_ASSET_ROLE_COPY.design.instruction} |`, ...args.index.assets.map(assetRow), '');
179
+ }
180
+ // Only the carrier a layer actually ships is a must-keep; the upscaled twin is
181
+ // an alternative resolution, and naming it here would contradict "ship one".
182
+ const heroes = args.index.rasterLayers
183
+ .filter((layer) => layer.hero && layer.asset)
184
+ .map((layer) => layer.asset);
185
+ lines.push('### Never discard', '', `- \`${design}\`.`, args.index.assets.length > 0
186
+ ? '- Every cutout and plate this table names.'
187
+ : '- Every cutout and plate the kit extracts once the run completes.', ...heroes.map((asset) => ` - Hero imagery: \`${asset.file}\` (${asset.roleLabel}).`), '- All real content, data, controls, routes, and tests.', '', `Scrims over a plate stay light (at most ${IMPROVE_SCRIM_MAX_OPACITY_PCT}% opacity), and the plan`
188
+ + ' must say why one is used.', '');
189
+ return lines;
190
+ };
191
+ const guardrails = () => [
192
+ '## Guardrails',
193
+ '',
194
+ '- Preserve all real content, data, and controls; invent nothing.',
195
+ '- Do not describe emptiness or thin content as a defect: that phrasing can invite fabricated UI.',
196
+ '- Verify Tailwind v4 arbitrary custom-property syntax, quote CSS `url(...)` values, and update CSP before introducing data URIs.',
197
+ '- Never use the raw candidate PNG as a shipped asset; ship the extracted cutouts and plates.',
198
+ '- Never scrim imagery away. A heavy overlay is a fidelity defect, not a readability fix.',
199
+ '- Do not add decoration the design does not contain.',
200
+ '',
201
+ ];
202
+ const anatomy = (record) => [
203
+ '## Anatomy',
204
+ '',
205
+ '- `improve.json` is the durable stage, purchase, price-ceiling, and replay record.',
206
+ `- ${record.input.kind === 'url'
207
+ ? '`capture/` and `current.domdoc.json` hold the screenshot and selector-verified DOM extraction.'
208
+ : '`source.png` is the normalized source screenshot.'}`,
209
+ '- `candidates/` keeps every generated option and its draft record; `winner.png` is the explicit image target.',
210
+ '- `target/` holds the target LayerDoc, responsive HTML when generated, and extracted assets.',
211
+ '- `plan/` holds the diff, implementation plan, token patch, added-element assets, `GATE.md` when anchoring was unsafe, or `STALL.md` when a stage did not settle.',
212
+ '',
213
+ '## Replay',
214
+ '',
215
+ '- Apply the plan in the owning repository, then verify behavior and screenshots there. This kit never applies code.',
216
+ '- Re-run from `pick` with another `--pick` slot to reuse capture and candidates; settled paid stages replay.',
217
+ // A magic-link triple is a live credential and this file sits in the working
218
+ // tree (F31), so the kit says what it holds and what a re-capture needs.
219
+ ...(record.bootstrap.length > 0
220
+ ? ['- This kit captured with `--bootstrap`. `improve.json` keeps only the redacted triple'
221
+ + ` (${record.bootstrap.map((value) => `\`${value}\``).join(', ')}) and its sha256 — the live`
222
+ + ' value, session token included, is stored nowhere. A re-capture needs `--bootstrap` passed'
223
+ + ' again.']
224
+ : []),
225
+ '',
226
+ ];
227
+ /**
228
+ * The design's font, and whose job it is to load it (F23).
229
+ *
230
+ * `plan/token-patch.css` used to open with a hosted Google Fonts `@import`,
231
+ * and this README makes applying that patch step 3 of "Start here" — so the
232
+ * one step a lane is told to apply wholesale was also the step that added a
233
+ * third-party network dependency to a repository that declared none. The patch
234
+ * names the family; loading it is the repository's own decision.
235
+ */
236
+ const fontsSection = (record) => {
237
+ const fonts = record.plan?.fonts ?? [];
238
+ if (fonts.length === 0)
239
+ return [];
240
+ return [
241
+ '## Fonts',
242
+ '',
243
+ ...fonts.map(({ family, weights }) => (`- ${family} (weights ${weights.join(', ')}). \`plan/token-patch.css\` declares it as a`
244
+ + ' token and imports nothing. Load the family the way this repository already loads fonts'
245
+ + ' — self-host it, or add it to the existing loader — or keep the current family and skip'
246
+ + ' the token.')),
247
+ '',
248
+ ];
249
+ };
250
+ const fixedLayoutSection = (record) => (record.convert?.layout === 'fixed'
251
+ ? [
252
+ '## Fixed-layout target',
253
+ '',
254
+ `- Warning: ${record.convert.responsiveWarning ?? 'Responsive HTML was unavailable.'}`,
255
+ '- The target HTML is a fixed-layout fallback derived free from the successful LayerDoc conversion. It is not a responsive deliverable; the LayerDoc remains valid for planning.',
256
+ '',
257
+ ]
258
+ : []);
259
+ export const renderImproveReadme = (args) => [
260
+ '# 12ui improve kit',
261
+ '',
262
+ `Input: ${args.record.input.kind} \`${args.record.input.value}\``,
263
+ // Which candidate this kit was built from, and why that one: it is only
264
+ // ever an explicit --pick now, or a supplied target. Nothing is guessed.
265
+ `Picked candidate: ${args.record.pick
266
+ ? `${args.record.pick.slot} — chosen with --pick, and the target was converted from it`
267
+ : args.record.target
268
+ ? 'bring-your-own target'
269
+ : 'not yet picked — nothing has been converted'}`,
270
+ '',
271
+ ...statusSection(args),
272
+ ...startHere(args),
273
+ ...assetsSection(args),
274
+ ...guardrails(),
275
+ ...fontsSection(args.record),
276
+ ...fixedLayoutSection(args.record),
277
+ ...anatomy(args.record),
278
+ ].join('\n');
279
+ export const writeImproveReadme = async (record, context = {}) => {
280
+ const paths = improvePaths(record.runDir);
281
+ const [status, index] = await Promise.all([
282
+ readImproveKitStatus({ record, ...(context.requestedTo ? { requestedTo: context.requestedTo } : {}) }),
283
+ readImproveKitAssets({ runDir: record.runDir, layerDocPath: paths.targetLayerDoc }),
284
+ ]);
285
+ await writeFile(paths.readme, renderImproveReadme({ record, status, index }), 'utf8');
286
+ return paths.readme;
31
287
  };
32
288
  //# sourceMappingURL=improve-kit-readme.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"improve-kit-readme.js","sourceRoot":"","sources":["../src/improve-kit-readme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,IAAI,MAAM,WAAW,CAAC;AAI7B,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,EAAE,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AAO,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;QACtG,oBAAoB,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,CAAC,cAAc,EAAE,CAAC;KACpF,CAAC,CAAC;IACH,MAAM,SAAS,CAAC,KAAK,CAAC,MAAM,EAAE,mBAAmB,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;IACtF,OAAO,KAAK,CAAC,MAAM,CAAC;AACtB,CAAC,CAAC"}
@@ -0,0 +1,113 @@
1
+ import { type ImproveKitAssetIndex } from './improve-kit-assets.js';
2
+ import { type ImproveKitStatus } from './improve-kit-status.js';
3
+ import { type ImproveResumeConversion } from './improve-convert-resilience.js';
4
+ import { type RunJournalEntry } from './run-journal.js';
5
+ import { type ImproveRecord, type ImproveStage } from './improve-workspace.js';
6
+ /**
7
+ * A run that ran out of patience, a run somebody killed, and a run that
8
+ * recovered read differently.
9
+ *
10
+ * `fallback` is the third: the responsive export stalled and improve derived
11
+ * fixed-layout HTML free from the settled LayerDoc, so the kit is complete and
12
+ * the plan was built — but something DID stall, and F8 (wave-2, 2026-09-03)
13
+ * found that nothing said so anywhere a lane looks. No STALL.md exists in any
14
+ * of the six wave-2 kits, including the two that fell back. A recovered run is
15
+ * not a clean run, and this file is where the difference gets written down.
16
+ */
17
+ export type ImproveStallKind = 'stalled' | 'stopped' | 'fallback';
18
+ export type ImproveStallFacts = {
19
+ stage: ImproveStage;
20
+ kind: ImproveStallKind;
21
+ hostedRunId?: string;
22
+ waitedSeconds?: number;
23
+ typicalSeconds?: number;
24
+ /** The published bound the wait ran against, when the caller knows it. */
25
+ boundSeconds?: number;
26
+ serviceStage?: string;
27
+ /** The conversion the first recovery command will attach to, if the kit knows one. */
28
+ resume?: ImproveResumeConversion;
29
+ reason: string;
30
+ };
31
+ /**
32
+ * What the run was waiting on, from the journal it kept writing plus the error
33
+ * that ended the local process. The journal is authoritative for elapsed time
34
+ * because the error text carries none.
35
+ */
36
+ export declare const collectImproveStallFacts: (args: {
37
+ record: ImproveRecord;
38
+ stage: ImproveStage;
39
+ error: unknown;
40
+ kind?: ImproveStallKind;
41
+ /**
42
+ * A journal the caller has already read. The terminal-event path runs on a
43
+ * signal that may be followed by SIGKILL after a short grace, so it reads the
44
+ * journal exactly once and shares it rather than reading it twice before the
45
+ * end line is on disk.
46
+ */
47
+ entries?: readonly RunJournalEntry[];
48
+ /**
49
+ * This invocation still had a stage in flight when it ended, so the record's
50
+ * `convert` block is about an EARLIER conversion — `--fresh` clears convert
51
+ * from the DURABLE record inside the stage, and the in-memory copy a stop
52
+ * handler holds is only reassigned when that stage RETURNS. The journal is
53
+ * then the only truthful source for the hosted run: its newest paid line is
54
+ * this process's own heartbeat, and no end line for this invocation exists
55
+ * yet. Reading the record instead put an abandoned conversion's id and its
56
+ * 216s age on the pipedrive kit's end line while the live one was 75s old.
57
+ */
58
+ inFlight?: boolean;
59
+ }) => Promise<ImproveStallFacts>;
60
+ export declare const renderImproveStall: (args: {
61
+ record: ImproveRecord;
62
+ facts: ImproveStallFacts;
63
+ status: ImproveKitStatus;
64
+ index: ImproveKitAssetIndex;
65
+ }) => string;
66
+ /**
67
+ * The same file, for the run that recovered.
68
+ *
69
+ * The facts come off the durable record rather than out of an error, because
70
+ * there is no error: the responsive export stalled, the free derivation took
71
+ * over, and the run went on to build a plan. A kit written before
72
+ * `responsiveStall` existed records the fallback but not its timings, so this
73
+ * writes what it has and never invents a number.
74
+ */
75
+ export declare const writeImproveFallbackStall: (args: {
76
+ record: ImproveRecord;
77
+ requestedTo?: ImproveStage;
78
+ }) => Promise<string | undefined>;
79
+ /**
80
+ * The stall this kit recorded is over, so the file that recorded it stops
81
+ * saying the kit is INCOMPLETE (F21).
82
+ *
83
+ * Freshdesk's `--from convert` resume settled at 18:56:41Z and wrote a whole
84
+ * plan; the `plan/STALL.md` from 18:48:17Z survived beside it, still saying
85
+ * "this run was stopped", "no plan", and "resume or convert first" — directly
86
+ * contradicting the README above it, which said the plan was settled. A reader
87
+ * opening that kit cold got two mutually exclusive statuses and no way to tell
88
+ * which was current.
89
+ *
90
+ * The file is REPLACED rather than deleted: it is the durable record that this
91
+ * kit stalled once, which is worth keeping, and a README that links to it must
92
+ * not link to nothing. Its mtime is when the stall was written, which is the
93
+ * one timestamp neither the record nor the journal keeps.
94
+ */
95
+ export declare const resolveImproveStall: (args: {
96
+ record: ImproveRecord;
97
+ status: ImproveKitStatus;
98
+ now?: Date;
99
+ }) => Promise<string | undefined>;
100
+ /**
101
+ * Write `plan/STALL.md`, creating `plan/` when the plan stage never ran.
102
+ * Returns the file so the caller can journal it as an artifact.
103
+ */
104
+ export declare const writeImproveStallReport: (args: {
105
+ record: ImproveRecord;
106
+ stage: ImproveStage;
107
+ error: unknown;
108
+ requestedTo?: ImproveStage;
109
+ kind?: ImproveStallKind;
110
+ /** See `collectImproveStallFacts`: the hosted run then comes from the journal. */
111
+ inFlight?: boolean;
112
+ }) => Promise<string>;
113
+ //# sourceMappingURL=improve-kit-stall.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"improve-kit-stall.d.ts","sourceRoot":"","sources":["../src/improve-kit-stall.ts"],"names":[],"mappings":"AAIA,OAAO,EAAwB,KAAK,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC1F,OAAO,EAML,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAIL,KAAK,uBAAuB,EAC7B,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EAAkB,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAgB,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAe7F;;;;;;;;;;GAUG;AACH,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;AAElE,MAAM,MAAM,iBAAi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