@12ui/design 0.2.55 → 0.2.56
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/SKILL.md +1 -1
- package/dist/cli-arguments.d.ts.map +1 -1
- package/dist/cli-arguments.js +1 -0
- package/dist/cli-arguments.js.map +1 -1
- package/dist/cli-conversion-derivation.d.ts +2 -1
- package/dist/cli-conversion-derivation.d.ts.map +1 -1
- package/dist/cli-conversion-derivation.js +9 -1
- package/dist/cli-conversion-derivation.js.map +1 -1
- package/dist/cli-convert-command.js +1 -1
- package/dist/cli-convert-command.js.map +1 -1
- package/dist/cli-draft-command.d.ts +11 -0
- package/dist/cli-draft-command.d.ts.map +1 -1
- package/dist/cli-draft-command.js +10 -1
- package/dist/cli-draft-command.js.map +1 -1
- package/dist/cli-help/design.d.ts +1 -1
- package/dist/cli-help/design.d.ts.map +1 -1
- package/dist/cli-help/design.js +7 -1
- package/dist/cli-help/design.js.map +1 -1
- package/dist/cli-help/index.d.ts +1 -1
- package/dist/cli-improve-command.d.ts.map +1 -1
- package/dist/cli-improve-command.js +252 -68
- package/dist/cli-improve-command.js.map +1 -1
- package/dist/cli-next-command.d.ts.map +1 -1
- package/dist/cli-next-command.js +44 -4
- package/dist/cli-next-command.js.map +1 -1
- package/dist/cli-usage.js +1 -1
- package/dist/improve-conversion-attempts.d.ts +92 -0
- package/dist/improve-conversion-attempts.d.ts.map +1 -0
- package/dist/improve-conversion-attempts.js +88 -0
- package/dist/improve-conversion-attempts.js.map +1 -0
- package/dist/improve-conversion-stage.d.ts +7 -0
- package/dist/improve-conversion-stage.d.ts.map +1 -1
- package/dist/improve-conversion-stage.js +197 -30
- package/dist/improve-conversion-stage.js.map +1 -1
- package/dist/improve-convert-resilience.d.ts +125 -0
- package/dist/improve-convert-resilience.d.ts.map +1 -1
- package/dist/improve-convert-resilience.js +165 -1
- package/dist/improve-convert-resilience.js.map +1 -1
- package/dist/improve-delivery-stages.d.ts.map +1 -1
- package/dist/improve-delivery-stages.js +1 -0
- package/dist/improve-delivery-stages.js.map +1 -1
- package/dist/improve-dom-diff.d.ts +2 -0
- package/dist/improve-dom-diff.d.ts.map +1 -1
- package/dist/improve-dom-diff.js +7 -0
- package/dist/improve-dom-diff.js.map +1 -1
- package/dist/improve-dom-gate.d.ts +7 -0
- package/dist/improve-dom-gate.d.ts.map +1 -1
- package/dist/improve-dom-gate.js +13 -0
- package/dist/improve-dom-gate.js.map +1 -1
- package/dist/improve-generation-stages.d.ts +3 -0
- package/dist/improve-generation-stages.d.ts.map +1 -1
- package/dist/improve-generation-stages.js +24 -7
- package/dist/improve-generation-stages.js.map +1 -1
- package/dist/improve-kit-assets.d.ts +129 -0
- package/dist/improve-kit-assets.d.ts.map +1 -0
- package/dist/improve-kit-assets.js +333 -0
- package/dist/improve-kit-assets.js.map +1 -0
- package/dist/improve-kit-readme.d.ts +11 -2
- package/dist/improve-kit-readme.d.ts.map +1 -1
- package/dist/improve-kit-readme.js +192 -26
- package/dist/improve-kit-readme.js.map +1 -1
- package/dist/improve-kit-stall.d.ts +67 -0
- package/dist/improve-kit-stall.d.ts.map +1 -0
- package/dist/improve-kit-stall.js +159 -0
- package/dist/improve-kit-stall.js.map +1 -0
- package/dist/improve-kit-status.d.ts +69 -0
- package/dist/improve-kit-status.d.ts.map +1 -0
- package/dist/improve-kit-status.js +145 -0
- package/dist/improve-kit-status.js.map +1 -0
- package/dist/improve-options.d.ts +10 -1
- package/dist/improve-options.d.ts.map +1 -1
- package/dist/improve-options.js +62 -15
- package/dist/improve-options.js.map +1 -1
- package/dist/improve-plan-annotated-render.d.ts +33 -0
- package/dist/improve-plan-annotated-render.d.ts.map +1 -0
- package/dist/improve-plan-annotated-render.js +175 -0
- package/dist/improve-plan-annotated-render.js.map +1 -0
- package/dist/improve-plan-annotator.d.ts +2 -1
- package/dist/improve-plan-annotator.d.ts.map +1 -1
- package/dist/improve-plan-annotator.js +21 -45
- package/dist/improve-plan-annotator.js.map +1 -1
- package/dist/improve-raster-layers-section.d.ts +21 -0
- package/dist/improve-raster-layers-section.d.ts.map +1 -0
- package/dist/improve-raster-layers-section.js +45 -0
- package/dist/improve-raster-layers-section.js.map +1 -0
- package/dist/improve-reset.d.ts +122 -0
- package/dist/improve-reset.d.ts.map +1 -0
- package/dist/improve-reset.js +141 -0
- package/dist/improve-reset.js.map +1 -0
- package/dist/improve-run-summary.d.ts +35 -0
- package/dist/improve-run-summary.d.ts.map +1 -0
- package/dist/improve-run-summary.js +134 -0
- package/dist/improve-run-summary.js.map +1 -0
- package/dist/improve-stage-shared.d.ts +5 -0
- package/dist/improve-stage-shared.d.ts.map +1 -1
- package/dist/improve-stage-shared.js.map +1 -1
- package/dist/improve-stop-handler.d.ts +73 -0
- package/dist/improve-stop-handler.d.ts.map +1 -0
- package/dist/improve-stop-handler.js +126 -0
- package/dist/improve-stop-handler.js.map +1 -0
- package/dist/improve-terminal-event.d.ts +118 -0
- package/dist/improve-terminal-event.d.ts.map +1 -0
- package/dist/improve-terminal-event.js +81 -0
- package/dist/improve-terminal-event.js.map +1 -0
- package/dist/improve-workspace.d.ts +15 -0
- package/dist/improve-workspace.d.ts.map +1 -1
- package/dist/improve-workspace.js +3 -0
- package/dist/improve-workspace.js.map +1 -1
- package/dist/legacy-skill-catalog.d.ts.map +1 -1
- package/dist/legacy-skill-catalog.js +20 -0
- package/dist/legacy-skill-catalog.js.map +1 -1
- package/dist/redesign-capture.d.ts +16 -0
- package/dist/redesign-capture.d.ts.map +1 -1
- package/dist/redesign-capture.js +49 -3
- package/dist/redesign-capture.js.map +1 -1
- package/dist/run-journal-unfinished.d.ts +56 -0
- package/dist/run-journal-unfinished.d.ts.map +1 -0
- package/dist/run-journal-unfinished.js +126 -0
- package/dist/run-journal-unfinished.js.map +1 -0
- package/dist/run-journal.d.ts +25 -1
- package/dist/run-journal.d.ts.map +1 -1
- package/dist/run-journal.js +15 -1
- package/dist/run-journal.js.map +1 -1
- package/open-design.json +2 -2
- package/package.json +1 -1
- package/skills/12ui-design/SKILL.md +2 -0
- package/skills/12ui-design/improve.md +67 -5
|
@@ -1,32 +1,198 @@
|
|
|
1
1
|
import { writeFile } from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { IMPROVE_ASSET_ROLE_COPY, IMPROVE_SCRIM_MAX_OPACITY_PCT, improveFrameMappingLine, readImproveKitAssets, } from './improve-kit-assets.js';
|
|
4
|
+
import { IMPROVE_NO_APPROXIMATION_RULE, improveRecoveryLine, improveStageStatusLine, readImproveKitStatus, } from './improve-kit-status.js';
|
|
5
|
+
import { improveAbandonedLines } from './improve-reset.js';
|
|
6
|
+
import { improvePaths } from './improve-workspace.js';
|
|
7
|
+
/**
|
|
8
|
+
* The kit's front door.
|
|
9
|
+
*
|
|
10
|
+
* It used to open with the directory anatomy, which answers a question nobody
|
|
11
|
+
* had. What two lanes actually needed, and did not get, was: did this run
|
|
12
|
+
* finish, what are these PNGs, and which of them must never be thrown away.
|
|
13
|
+
* Those three answers now come first, and the anatomy comes last.
|
|
14
|
+
*/
|
|
15
|
+
/** The file-name shape a reader sees, per role, in the order the glossary reads best. */
|
|
16
|
+
const ROLE_GLOSSARY = [
|
|
17
|
+
{ role: 'clean-plate', pattern: 'clean-N' },
|
|
18
|
+
{ role: 'cutout', pattern: 'cutout-N' },
|
|
19
|
+
{ role: 'upscaled-plate', pattern: 'upscaled-plate-N' },
|
|
20
|
+
{ role: 'upscaled-region', pattern: 'upscaled-region-N' },
|
|
21
|
+
{ role: 'source-crop', pattern: 'crop-N' },
|
|
22
|
+
];
|
|
23
|
+
const statusSection = (args) => {
|
|
24
|
+
const lines = ['## Status', ''];
|
|
25
|
+
lines.push(...args.status.stages.map((stage) => `- ${improveStageStatusLine(stage)}`));
|
|
26
|
+
lines.push(`- Target: ${args.status.targetMode}`);
|
|
27
|
+
lines.push(...improveAbandonedLines(args.record));
|
|
28
|
+
if (args.status.complete) {
|
|
29
|
+
lines.push('', ...(args.status.gateBlocked
|
|
30
|
+
? ['The coverage gate blocked the anchored plan: `plan/GATE.md` replaced `plan-annotated.md`'
|
|
31
|
+
+ ' and `token-patch.css`. Read `plan/GATE.md` before touching code; the target, its assets'
|
|
32
|
+
+ ' and the raster layers it names are all still here.']
|
|
33
|
+
: args.record.convert?.layout === 'fixed'
|
|
34
|
+
? ['Convert fell back: the target HTML is fixed-layout, not responsive.'
|
|
35
|
+
+ ' The LayerDoc and its assets are the full-quality source of truth.']
|
|
36
|
+
: ['Every requested stage settled. The kit is complete.']), '');
|
|
37
|
+
return lines;
|
|
38
|
+
}
|
|
39
|
+
lines.push('', `This kit is INCOMPLETE: ${args.status.missing.join(', ')}.`, ...(args.status.present.stall ? ['', 'See `plan/STALL.md` for what the run was waiting on.'] : []), '', 'Recovery, in order — the first resumes and replays every settled stage:', '', ...args.status.recovery.map(improveRecoveryLine), '', IMPROVE_NO_APPROXIMATION_RULE, '');
|
|
40
|
+
return lines;
|
|
41
|
+
};
|
|
42
|
+
const startHere = (args) => {
|
|
43
|
+
const design = path.relative(args.record.runDir, args.status.designImage);
|
|
44
|
+
const hasAssets = args.index.assets.length > 0;
|
|
45
|
+
// A gate block deletes the two files steps 3 and 4 name. Sending a reader to
|
|
46
|
+
// them is how a kit gets abandoned with its assets unread.
|
|
47
|
+
const planSteps = args.status.gateBlocked
|
|
48
|
+
? ['3. Read `plan/GATE.md`. It says why no selector-anchored plan was emitted, and what to'
|
|
49
|
+
+ ' re-capture; the raster layers it lists are still the design.']
|
|
50
|
+
: [
|
|
51
|
+
'3. Apply `plan/token-patch.css` once, at the token layer, not per element.',
|
|
52
|
+
'4. Work `plan/plan-annotated.md` in its own order: raster layers, then matched changes,'
|
|
53
|
+
+ ' then added elements.',
|
|
54
|
+
];
|
|
55
|
+
const frame = args.record.capture
|
|
56
|
+
? { width: args.record.capture.width, height: args.record.capture.height }
|
|
57
|
+
: args.record.viewport;
|
|
58
|
+
return [
|
|
59
|
+
'## Start here',
|
|
60
|
+
'',
|
|
61
|
+
...(args.status.complete
|
|
62
|
+
? []
|
|
63
|
+
: [args.status.gateBlocked
|
|
64
|
+
? 'Run the recovery above first: the steps below assume a target this kit has not finished.'
|
|
65
|
+
: hasAssets
|
|
66
|
+
? 'Run the recovery above first: steps 3 and 4 need a plan this kit does not have yet.'
|
|
67
|
+
: 'Run the recovery above first: steps 2 to 4 need a target this kit does not have yet.', '']),
|
|
68
|
+
// The frame a bound belongs to, before the first step that places anything:
|
|
69
|
+
// a lane read these percentages as `winner.png` pixels and placed short.
|
|
70
|
+
improveFrameMappingLine({
|
|
71
|
+
...(frame ? { frame } : {}),
|
|
72
|
+
...(args.index.canvas ? { design: args.index.canvas } : {}),
|
|
73
|
+
}),
|
|
74
|
+
'',
|
|
75
|
+
args.status.designKind === 'layerdoc'
|
|
76
|
+
? `1. Open \`${design}\`. The supplied target document is the design.`
|
|
77
|
+
: `1. Open \`${design}\`. It is the design.`,
|
|
78
|
+
'2. Copy the files the assets table below marks ship into the repository;'
|
|
79
|
+
+ ' the rest are references and alternates.',
|
|
80
|
+
...planSteps,
|
|
81
|
+
`${args.status.gateBlocked ? '4' : '5'}. Before committing, screenshot the page and put it`
|
|
82
|
+
+ ` beside \`${design}\`.`,
|
|
83
|
+
'',
|
|
84
|
+
];
|
|
85
|
+
};
|
|
86
|
+
const assetRow = (asset) => {
|
|
87
|
+
const role = `${asset.roleLabel}${asset.hero ? ' — hero imagery' : ''}`;
|
|
88
|
+
const layer = asset.layer ? `${asset.layer.kind} — ${asset.layer.name}` : 'whole design';
|
|
89
|
+
const bounds = asset.bounds
|
|
90
|
+
? `${asset.bounds.width.toFixed(1)}% × ${asset.bounds.height.toFixed(1)}%`
|
|
91
|
+
+ ` at ${asset.bounds.x.toFixed(1)}%, ${asset.bounds.y.toFixed(1)}%`
|
|
92
|
+
: 'full canvas';
|
|
93
|
+
const instruction = asset.present
|
|
94
|
+
? asset.instruction
|
|
95
|
+
: `${asset.instruction} (declared by the manifest but missing from this kit)`;
|
|
96
|
+
return `| \`${asset.file}\` | ${asset.ship} | ${role} | ${layer} | ${bounds} | ${instruction} |`;
|
|
97
|
+
};
|
|
98
|
+
const assetsSection = (args) => {
|
|
99
|
+
const design = path.relative(args.record.runDir, args.status.designImage);
|
|
5
100
|
const lines = [
|
|
6
|
-
'
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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.', '',
|
|
101
|
+
'## Assets: what each file is',
|
|
102
|
+
'',
|
|
103
|
+
...ROLE_GLOSSARY.map(({ role, pattern }) => `- ${IMPROVE_ASSET_ROLE_COPY[role].label}`
|
|
104
|
+
+ ` (\`${pattern}\`): ${IMPROVE_ASSET_ROLE_COPY[role].instruction}`),
|
|
105
|
+
`- \`${design}\`: ${IMPROVE_ASSET_ROLE_COPY.design.instruction}`,
|
|
106
|
+
'',
|
|
28
107
|
];
|
|
29
|
-
|
|
30
|
-
|
|
108
|
+
if (args.index.assets.length === 0) {
|
|
109
|
+
lines.push(args.status.present.layerDoc
|
|
110
|
+
? 'This kit has a LayerDoc but no extracted assets yet. Resume before coding.'
|
|
111
|
+
: 'This kit has no extracted assets yet. Resume before coding.', '');
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
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'
|
|
115
|
+
+ ' another size — pick one. An alternate backdrop is the same plate with a further layer'
|
|
116
|
+
+ ' removed as well — it is the background only if you omit that layer. A reference is read,'
|
|
117
|
+
+ ' never shipped.', '', 'Plates and cutouts come out at full resolution and run over a megabyte. Pick one resolution'
|
|
118
|
+
+ ' per layer and optimise the PNG — or convert it to WebP where the repository already uses'
|
|
119
|
+
+ ' 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 |`
|
|
120
|
+
+ ` 100.0% × 100.0% at 0.0%, 0.0% | ${IMPROVE_ASSET_ROLE_COPY.design.instruction} |`, ...args.index.assets.map(assetRow), '');
|
|
121
|
+
}
|
|
122
|
+
// Only the carrier a layer actually ships is a must-keep; the upscaled twin is
|
|
123
|
+
// an alternative resolution, and naming it here would contradict "ship one".
|
|
124
|
+
const heroes = args.index.rasterLayers
|
|
125
|
+
.filter((layer) => layer.hero && layer.asset)
|
|
126
|
+
.map((layer) => layer.asset);
|
|
127
|
+
lines.push('### Never discard', '', `- \`${design}\`.`, args.index.assets.length > 0
|
|
128
|
+
? '- Every cutout and plate this table names.'
|
|
129
|
+
: '- 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`
|
|
130
|
+
+ ' must say why one is used.', '');
|
|
131
|
+
return lines;
|
|
132
|
+
};
|
|
133
|
+
const guardrails = () => [
|
|
134
|
+
'## Guardrails',
|
|
135
|
+
'',
|
|
136
|
+
'- Preserve all real content, data, and controls; invent nothing.',
|
|
137
|
+
'- Do not describe emptiness or thin content as a defect: that phrasing can invite fabricated UI.',
|
|
138
|
+
'- Verify Tailwind v4 arbitrary custom-property syntax, quote CSS `url(...)` values, and update CSP before introducing data URIs.',
|
|
139
|
+
'- Never use the raw candidate PNG as a shipped asset; ship the extracted cutouts and plates.',
|
|
140
|
+
'- Never scrim imagery away. A heavy overlay is a fidelity defect, not a readability fix.',
|
|
141
|
+
'- Do not add decoration the design does not contain.',
|
|
142
|
+
'',
|
|
143
|
+
];
|
|
144
|
+
const anatomy = (record) => [
|
|
145
|
+
'## Anatomy',
|
|
146
|
+
'',
|
|
147
|
+
'- `improve.json` is the durable stage, purchase, price-ceiling, and replay record.',
|
|
148
|
+
`- ${record.input.kind === 'url'
|
|
149
|
+
? '`capture/` and `current.domdoc.json` hold the screenshot and selector-verified DOM extraction.'
|
|
150
|
+
: '`source.png` is the normalized source screenshot.'}`,
|
|
151
|
+
'- `candidates/` keeps every generated option and its draft record; `winner.png` is the explicit image target.',
|
|
152
|
+
'- `target/` holds the target LayerDoc, responsive HTML when generated, and extracted assets.',
|
|
153
|
+
'- `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.',
|
|
154
|
+
'',
|
|
155
|
+
'## Replay',
|
|
156
|
+
'',
|
|
157
|
+
'- Apply the plan in the owning repository, then verify behavior and screenshots there. This kit never applies code.',
|
|
158
|
+
'- Re-run from `pick` with another `--pick` slot to reuse capture and candidates; settled paid stages replay.',
|
|
159
|
+
'',
|
|
160
|
+
];
|
|
161
|
+
const fixedLayoutSection = (record) => (record.convert?.layout === 'fixed'
|
|
162
|
+
? [
|
|
163
|
+
'## Fixed-layout target',
|
|
164
|
+
'',
|
|
165
|
+
`- Warning: ${record.convert.responsiveWarning ?? 'Responsive HTML was unavailable.'}`,
|
|
166
|
+
'- 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.',
|
|
167
|
+
'',
|
|
168
|
+
]
|
|
169
|
+
: []);
|
|
170
|
+
export const renderImproveReadme = (args) => [
|
|
171
|
+
'# 12ui improve kit',
|
|
172
|
+
'',
|
|
173
|
+
`Input: ${args.record.input.kind} \`${args.record.input.value}\``,
|
|
174
|
+
// Which candidate this kit was built from, and why that one: it is only
|
|
175
|
+
// ever an explicit --pick now, or a supplied target. Nothing is guessed.
|
|
176
|
+
`Picked candidate: ${args.record.pick
|
|
177
|
+
? `${args.record.pick.slot} — chosen with --pick, and the target was converted from it`
|
|
178
|
+
: args.record.target
|
|
179
|
+
? 'bring-your-own target'
|
|
180
|
+
: 'not yet picked — nothing has been converted'}`,
|
|
181
|
+
'',
|
|
182
|
+
...statusSection(args),
|
|
183
|
+
...startHere(args),
|
|
184
|
+
...assetsSection(args),
|
|
185
|
+
...guardrails(),
|
|
186
|
+
...fixedLayoutSection(args.record),
|
|
187
|
+
...anatomy(args.record),
|
|
188
|
+
].join('\n');
|
|
189
|
+
export const writeImproveReadme = async (record, context = {}) => {
|
|
190
|
+
const paths = improvePaths(record.runDir);
|
|
191
|
+
const [status, index] = await Promise.all([
|
|
192
|
+
readImproveKitStatus({ record, ...(context.requestedTo ? { requestedTo: context.requestedTo } : {}) }),
|
|
193
|
+
readImproveKitAssets({ runDir: record.runDir, layerDocPath: paths.targetLayerDoc }),
|
|
194
|
+
]);
|
|
195
|
+
await writeFile(paths.readme, renderImproveReadme({ record, status, index }), 'utf8');
|
|
196
|
+
return paths.readme;
|
|
31
197
|
};
|
|
32
198
|
//# 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;
|
|
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;AAE7B,OAAO,EACL,uBAAuB,EACvB,6BAA6B,EAC7B,uBAAuB,EACvB,oBAAoB,GAIrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,6BAA6B,EAC7B,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,GAErB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAyC,MAAM,wBAAwB,CAAC;AAE7F;;;;;;;GAOG;AAEH,yFAAyF;AACzF,MAAM,aAAa,GAAuD;IACxE,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,SAAS,EAAE;IAC3C,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE;IACvC,EAAE,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,kBAAkB,EAAE;IACvD,EAAE,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,mBAAmB,EAAE;IACzD,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,QAAQ,EAAE;CAC3C,CAAC;AAEF,MAAM,aAAa,GAAG,CAAC,IAAyD,EAAY,EAAE;IAC5F,MAAM,KAAK,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC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AAqB,EACrB,UAA0C,EAAE,EAC3B,EAAE;IACnB,MAAM,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC1C,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACxC,oBAAoB,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,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,67 @@
|
|
|
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
|
+
/** A run that ran out of patience and a run somebody killed read differently. */
|
|
7
|
+
export type ImproveStallKind = 'stalled' | 'stopped';
|
|
8
|
+
export type ImproveStallFacts = {
|
|
9
|
+
stage: ImproveStage;
|
|
10
|
+
kind: ImproveStallKind;
|
|
11
|
+
hostedRunId?: string;
|
|
12
|
+
waitedSeconds?: number;
|
|
13
|
+
typicalSeconds?: number;
|
|
14
|
+
serviceStage?: string;
|
|
15
|
+
/** The conversion the first recovery command will attach to, if the kit knows one. */
|
|
16
|
+
resume?: ImproveResumeConversion;
|
|
17
|
+
reason: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* What the run was waiting on, from the journal it kept writing plus the error
|
|
21
|
+
* that ended the local process. The journal is authoritative for elapsed time
|
|
22
|
+
* because the error text carries none.
|
|
23
|
+
*/
|
|
24
|
+
export declare const collectImproveStallFacts: (args: {
|
|
25
|
+
record: ImproveRecord;
|
|
26
|
+
stage: ImproveStage;
|
|
27
|
+
error: unknown;
|
|
28
|
+
kind?: ImproveStallKind;
|
|
29
|
+
/**
|
|
30
|
+
* A journal the caller has already read. The terminal-event path runs on a
|
|
31
|
+
* signal that may be followed by SIGKILL after a short grace, so it reads the
|
|
32
|
+
* journal exactly once and shares it rather than reading it twice before the
|
|
33
|
+
* end line is on disk.
|
|
34
|
+
*/
|
|
35
|
+
entries?: readonly RunJournalEntry[];
|
|
36
|
+
/**
|
|
37
|
+
* This invocation still had a stage in flight when it ended, so the record's
|
|
38
|
+
* `convert` block is about an EARLIER conversion — `--fresh` clears convert
|
|
39
|
+
* from the DURABLE record inside the stage, and the in-memory copy a stop
|
|
40
|
+
* handler holds is only reassigned when that stage RETURNS. The journal is
|
|
41
|
+
* then the only truthful source for the hosted run: its newest paid line is
|
|
42
|
+
* this process's own heartbeat, and no end line for this invocation exists
|
|
43
|
+
* yet. Reading the record instead put an abandoned conversion's id and its
|
|
44
|
+
* 216s age on the pipedrive kit's end line while the live one was 75s old.
|
|
45
|
+
*/
|
|
46
|
+
inFlight?: boolean;
|
|
47
|
+
}) => Promise<ImproveStallFacts>;
|
|
48
|
+
export declare const renderImproveStall: (args: {
|
|
49
|
+
record: ImproveRecord;
|
|
50
|
+
facts: ImproveStallFacts;
|
|
51
|
+
status: ImproveKitStatus;
|
|
52
|
+
index: ImproveKitAssetIndex;
|
|
53
|
+
}) => string;
|
|
54
|
+
/**
|
|
55
|
+
* Write `plan/STALL.md`, creating `plan/` when the plan stage never ran.
|
|
56
|
+
* Returns the file so the caller can journal it as an artifact.
|
|
57
|
+
*/
|
|
58
|
+
export declare const writeImproveStallReport: (args: {
|
|
59
|
+
record: ImproveRecord;
|
|
60
|
+
stage: ImproveStage;
|
|
61
|
+
error: unknown;
|
|
62
|
+
requestedTo?: ImproveStage;
|
|
63
|
+
kind?: ImproveStallKind;
|
|
64
|
+
/** See `collectImproveStallFacts`: the hosted run then comes from the journal. */
|
|
65
|
+
inFlight?: boolean;
|
|
66
|
+
}) => Promise<string>;
|
|
67
|
+
//# 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,EAIL,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,iFAAiF;AACjF,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,SAAS,CAAC;AAErD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,YAAY,CAAC;IACpB,IAAI,EAAE,gBAAgB,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sFAAsF;IACtF,MAAM,CAAC,EAAE,uBAAuB,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,GAAU,MAAM;IACnD,MAAM,EAAE,aAAa,CAAC;IACtB,KAAK,EAAE,YAAY,CAAC;IACpB,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;IACrC;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,KAAG,OAAO,CAAC,iBAAiB,CAgC5B,CAAC;AAgDF,eAAO,MAAM,kBAAkB,GAAI,MAAM;IACvC,MAAM,EAAE,aAAa,CAAC;IACtB,KAAK,EAAE,iBAAiB,CAAC;IACzB,MAAM,EAAE,gBAAgB,CAAC;IACzB,KAAK,EAAE,oBAAoB,CAAC;CAC7B,KAAG,MAoCH,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,GAAU,MAAM;IAClD,MAAM,EAAE,aAAa,CAAC;IACtB,KAAK,EAAE,YAAY,CAAC;IACpB,KAAK,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,YAAY,CAAC;IAC3B,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,kFAAkF;IAClF,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,KAAG,OAAO,CAAC,MAAM,CAoBjB,CAAC"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { mkdir, writeFile } from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { formatDuration } from './cli-progress.js';
|
|
4
|
+
import { readImproveKitAssets } from './improve-kit-assets.js';
|
|
5
|
+
import { IMPROVE_NO_APPROXIMATION_RULE, improveRecoveryLine, readImproveKitStatus, } from './improve-kit-status.js';
|
|
6
|
+
import { improveConversionIdFromText, improveErrorText, improveResumeConversion, } from './improve-convert-resilience.js';
|
|
7
|
+
import { renderImproveRasterLayers } from './improve-raster-layers-section.js';
|
|
8
|
+
import { improveAbandonedLines } from './improve-reset.js';
|
|
9
|
+
import { readRunJournal } from './run-journal.js';
|
|
10
|
+
import { improvePaths } from './improve-workspace.js';
|
|
11
|
+
/**
|
|
12
|
+
* A stalled run still writes a plan directory.
|
|
13
|
+
*
|
|
14
|
+
* Pipedrive's conversion sat in `materializing_assets` for sixteen minutes and
|
|
15
|
+
* never journalled a terminal event, so the kit had an empty `target/`, no
|
|
16
|
+
* `plan/`, and nothing at all telling the lane what to do. It hand-authored the
|
|
17
|
+
* hero in CSS. This file is what should have been there instead: which stage,
|
|
18
|
+
* how long it waited, the hosted run id, what exists, and the three commands
|
|
19
|
+
* that recover — plus the raster layers, whenever a LayerDoc survived.
|
|
20
|
+
*/
|
|
21
|
+
const UUID = /[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}/iu;
|
|
22
|
+
/**
|
|
23
|
+
* What the run was waiting on, from the journal it kept writing plus the error
|
|
24
|
+
* that ended the local process. The journal is authoritative for elapsed time
|
|
25
|
+
* because the error text carries none.
|
|
26
|
+
*/
|
|
27
|
+
export const collectImproveStallFacts = async (args) => {
|
|
28
|
+
const text = improveErrorText(args.error);
|
|
29
|
+
const entries = args.entries
|
|
30
|
+
?? (await readRunJournal({ workspace: args.record.runDir }).catch(() => ({ entries: [] }))).entries;
|
|
31
|
+
const progress = [...entries].reverse().find((entry) => (entry.event === 'progress' && entry.paid && entry.elapsed_seconds !== undefined));
|
|
32
|
+
const journalled = [...entries].reverse().find((entry) => (entry.paid && typeof entry.run_id === 'string' && UUID.test(entry.run_id)))?.run_id;
|
|
33
|
+
const recorded = args.record.convert?.sourceConversionId;
|
|
34
|
+
const hostedRunId = args.inFlight
|
|
35
|
+
? journalled ?? improveConversionIdFromText(text) ?? recorded
|
|
36
|
+
: recorded ?? improveConversionIdFromText(text) ?? journalled;
|
|
37
|
+
const resume = improveResumeConversion(args.record);
|
|
38
|
+
// An attempt whose id never reached the record, named from the journal
|
|
39
|
+
// instead. It is the same conversion: the open attempt is what THIS
|
|
40
|
+
// invocation dispatched, and `inFlight` is what makes the journal's newest
|
|
41
|
+
// paid line this invocation's own heartbeat rather than an earlier run's.
|
|
42
|
+
const named = resume && !resume.id && args.inFlight && hostedRunId
|
|
43
|
+
? { ...resume, id: hostedRunId }
|
|
44
|
+
: resume;
|
|
45
|
+
return {
|
|
46
|
+
stage: args.stage,
|
|
47
|
+
kind: args.kind ?? 'stalled',
|
|
48
|
+
...(hostedRunId ? { hostedRunId } : {}),
|
|
49
|
+
...(named ? { resume: named } : {}),
|
|
50
|
+
...(progress?.elapsed_seconds === undefined ? {} : { waitedSeconds: progress.elapsed_seconds }),
|
|
51
|
+
...(progress?.typical_seconds === undefined ? {} : { typicalSeconds: progress.typical_seconds }),
|
|
52
|
+
...(progress?.stage ? { serviceStage: progress.stage } : {}),
|
|
53
|
+
reason: text.split('\n')[0]?.trim() || 'The stage ended without settling.',
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
const targetContents = (status) => {
|
|
57
|
+
if (!status.present.layerDoc)
|
|
58
|
+
return 'nothing';
|
|
59
|
+
if (!status.present.assets)
|
|
60
|
+
return 'the LayerDoc only';
|
|
61
|
+
return status.present.targetHtml
|
|
62
|
+
? 'the LayerDoc, its assets, and target HTML'
|
|
63
|
+
: 'the LayerDoc and its assets';
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Which conversion the recovery command below actually reaches, and — when this
|
|
67
|
+
* run was watching a different one — that the one it was watching is gone.
|
|
68
|
+
*
|
|
69
|
+
* A `--fresh` or retry conversion is recorded by its exact key before it is
|
|
70
|
+
* dispatched (`improve-conversion-attempts.ts`), so a run stopped inside one
|
|
71
|
+
* resumes onto the conversion it was actually watching. The "cannot be
|
|
72
|
+
* resumed" line survives for kits written before that ledger: they hold two
|
|
73
|
+
* conversions, the base-key one `--fresh` rotated away from, which the resume
|
|
74
|
+
* lands back on, and the fresh one dispatched under a one-off nonce nothing
|
|
75
|
+
* recorded. Naming only the second reads as "resume and you get this back",
|
|
76
|
+
* which is false and costs a conversion when the reader buys another instead.
|
|
77
|
+
*/
|
|
78
|
+
const resumeLines = (facts) => {
|
|
79
|
+
if (!facts.resume)
|
|
80
|
+
return [];
|
|
81
|
+
const reaches = facts.resume.reason === 'settled'
|
|
82
|
+
? 'the first command below replays it and buys nothing'
|
|
83
|
+
: 'the first command below rebuilds this kit\'s conversion key and re-attaches to it,'
|
|
84
|
+
+ ' rather than buying another';
|
|
85
|
+
const lines = [
|
|
86
|
+
facts.resume.id
|
|
87
|
+
? `- Resume attaches to: \`${facts.resume.id}\` — ${reaches}`
|
|
88
|
+
: '- Resume attaches to: the conversion this kit dispatched under its recorded key —'
|
|
89
|
+
+ ' it never reported an id, but the key is on the record, so'
|
|
90
|
+
+ ` ${reaches}`,
|
|
91
|
+
];
|
|
92
|
+
if (facts.resume.reason === 'fresh-rotated-away'
|
|
93
|
+
&& facts.hostedRunId
|
|
94
|
+
&& facts.hostedRunId !== facts.resume.id) {
|
|
95
|
+
lines.push(`- Cannot be resumed: \`${facts.hostedRunId}\` — this run dispatched it under a one-off`
|
|
96
|
+
+ ' `--fresh` key that nothing durable records, so no later command can re-attach to it.'
|
|
97
|
+
+ ' It keeps running and keeps billing.');
|
|
98
|
+
}
|
|
99
|
+
return lines;
|
|
100
|
+
};
|
|
101
|
+
export const renderImproveStall = (args) => {
|
|
102
|
+
const waited = args.facts.waitedSeconds === undefined
|
|
103
|
+
? 'unrecorded'
|
|
104
|
+
: `${formatDuration(args.facts.waitedSeconds)}`
|
|
105
|
+
+ `${args.facts.typicalSeconds === undefined
|
|
106
|
+
? ''
|
|
107
|
+
: ` against a typical ${formatDuration(args.facts.typicalSeconds)}`}`;
|
|
108
|
+
const lines = [
|
|
109
|
+
`# INCOMPLETE — this run ${args.facts.kind === 'stopped' ? 'was stopped' : 'stalled'}`,
|
|
110
|
+
'',
|
|
111
|
+
`- Stage: ${args.facts.stage}`
|
|
112
|
+
+ `${args.facts.serviceStage ? ` (service stage \`${args.facts.serviceStage}\`)` : ''}`,
|
|
113
|
+
`- Waited: ${waited}`,
|
|
114
|
+
`- Hosted run: ${args.facts.hostedRunId ? `\`${args.facts.hostedRunId}\`` : 'not recorded'}`,
|
|
115
|
+
...resumeLines(args.facts),
|
|
116
|
+
`- In \`target/\`: ${targetContents(args.status)}`,
|
|
117
|
+
`- Reason: ${args.facts.reason}`,
|
|
118
|
+
...improveAbandonedLines(args.record),
|
|
119
|
+
'',
|
|
120
|
+
'## Recovery',
|
|
121
|
+
'',
|
|
122
|
+
'Run the first command; it resumes and replays every settled stage rather than buying them again.',
|
|
123
|
+
'',
|
|
124
|
+
...args.status.recovery.map(improveRecoveryLine),
|
|
125
|
+
'',
|
|
126
|
+
IMPROVE_NO_APPROXIMATION_RULE,
|
|
127
|
+
'',
|
|
128
|
+
];
|
|
129
|
+
if (args.status.present.layerDoc) {
|
|
130
|
+
lines.push('A LayerDoc survived this run, so the design\'s raster layers are usable without a plan.', '', ...renderImproveRasterLayers({ layers: args.index.rasterLayers }));
|
|
131
|
+
}
|
|
132
|
+
return lines.join('\n');
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Write `plan/STALL.md`, creating `plan/` when the plan stage never ran.
|
|
136
|
+
* Returns the file so the caller can journal it as an artifact.
|
|
137
|
+
*/
|
|
138
|
+
export const writeImproveStallReport = async (args) => {
|
|
139
|
+
const paths = improvePaths(args.record.runDir);
|
|
140
|
+
const [facts, status, index] = await Promise.all([
|
|
141
|
+
collectImproveStallFacts({
|
|
142
|
+
record: args.record,
|
|
143
|
+
stage: args.stage,
|
|
144
|
+
error: args.error,
|
|
145
|
+
...(args.kind ? { kind: args.kind } : {}),
|
|
146
|
+
...(args.inFlight === undefined ? {} : { inFlight: args.inFlight }),
|
|
147
|
+
}),
|
|
148
|
+
readImproveKitStatus({
|
|
149
|
+
record: args.record,
|
|
150
|
+
...(args.requestedTo ? { requestedTo: args.requestedTo } : {}),
|
|
151
|
+
}),
|
|
152
|
+
readImproveKitAssets({ runDir: args.record.runDir, layerDocPath: paths.targetLayerDoc }),
|
|
153
|
+
]);
|
|
154
|
+
await mkdir(paths.planDir, { recursive: true });
|
|
155
|
+
const file = path.join(paths.planDir, 'STALL.md');
|
|
156
|
+
await writeFile(file, renderImproveStall({ record: args.record, facts, status, index }), 'utf8');
|
|
157
|
+
return file;
|
|
158
|
+
};
|
|
159
|
+
//# sourceMappingURL=improve-kit-stall.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"improve-kit-stall.js","sourceRoot":"","sources":["../src/improve-kit-stall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAA6B,MAAM,yBAAyB,CAAC;AAC1F,OAAO,EACL,6BAA6B,EAC7B,mBAAmB,EACnB,oBAAoB,GAErB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,2BAA2B,EAC3B,gBAAgB,EAChB,uBAAuB,GAExB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAwB,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAyC,MAAM,wBAAwB,CAAC;AAE7F;;;;;;;;;GASG;AAEH,MAAM,IAAI,GAAG,+CAA+C,CAAC;AAiB7D;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,KAAK,EAAE,IAuB9C,EAA8B,EAAE;IAC/B,MAAM,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1C,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO;WACvB,CAAC,MAAM,cAAc,CAAC,EAAE,SAAS,EAAE,IAA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 +1,69 @@
|
|
|
1
|
+
import { type ImproveRecord, type ImproveStage } from './improve-workspace.js';
|
|
2
|
+
/**
|
|
3
|
+
* One honest reading of "how far did this kit actually get".
|
|
4
|
+
*
|
|
5
|
+
* Read from the durable record AND the filesystem, because the record only
|
|
6
|
+
* ever describes stages that settled: a run killed inside `materializing_assets`
|
|
7
|
+
* leaves a record that says capture, draft and pick are fine and says nothing
|
|
8
|
+
* at all about the empty `target/` the reader is looking at.
|
|
9
|
+
*/
|
|
10
|
+
export type ImproveStageState = 'settled' | 'replayed' | 'skipped' | 'fallback' | 'blocked' | 'incomplete' | 'not-requested';
|
|
11
|
+
export type ImproveStageStatus = {
|
|
12
|
+
stage: ImproveStage;
|
|
13
|
+
state: ImproveStageState;
|
|
14
|
+
detail?: string;
|
|
15
|
+
};
|
|
16
|
+
export type ImproveTargetMode = 'responsive HTML' | 'fixed-layout fallback' | 'LayerDoc only' | 'none';
|
|
17
|
+
/** One recovery command and what running it costs. */
|
|
18
|
+
export type ImproveRecoveryCommand = {
|
|
19
|
+
command: string;
|
|
20
|
+
spends: string;
|
|
21
|
+
};
|
|
22
|
+
export type ImproveKitStatus = {
|
|
23
|
+
stages: ImproveStageStatus[];
|
|
24
|
+
/** Every requested stage settled and the artifacts it promises are on disk. */
|
|
25
|
+
complete: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* The coverage gate blocked the anchored plan, so `plan/GATE.md` replaced
|
|
28
|
+
* `plan-annotated.md` and `token-patch.css`. Nothing is missing and nothing
|
|
29
|
+
* stalled: it is a third outcome, and a reader sent to files the gate deleted
|
|
30
|
+
* is a reader who gives up on the kit.
|
|
31
|
+
*/
|
|
32
|
+
gateBlocked: boolean;
|
|
33
|
+
/** What a reader will not find, in the words the recovery commands answer. */
|
|
34
|
+
missing: string[];
|
|
35
|
+
targetMode: ImproveTargetMode;
|
|
36
|
+
present: {
|
|
37
|
+
design: boolean;
|
|
38
|
+
layerDoc: boolean;
|
|
39
|
+
assets: boolean;
|
|
40
|
+
targetHtml: boolean;
|
|
41
|
+
plan: boolean;
|
|
42
|
+
gate: boolean;
|
|
43
|
+
stall: boolean;
|
|
44
|
+
};
|
|
45
|
+
/** The file a reader should look at and a conversion can be re-run from. */
|
|
46
|
+
designImage: string;
|
|
47
|
+
/** A supplied `*.layerdoc.json` target kit has a document, not a picture. */
|
|
48
|
+
designKind: 'image' | 'layerdoc';
|
|
49
|
+
recovery: ImproveRecoveryCommand[];
|
|
50
|
+
};
|
|
51
|
+
export declare const IMPROVE_NO_APPROXIMATION_RULE: string;
|
|
52
|
+
/**
|
|
53
|
+
* A recovery command is presented as copy-and-run, so it has to survive being
|
|
54
|
+
* pasted. Capture URLs carry query strings and `--out-dir` paths carry spaces;
|
|
55
|
+
* either one unquoted breaks the line or backgrounds it at the `&`.
|
|
56
|
+
*/
|
|
57
|
+
export declare const shellArg: (value: string) => string;
|
|
58
|
+
export declare const improveRecoveryCommands: (args: {
|
|
59
|
+
record: ImproveRecord;
|
|
60
|
+
designImage: string;
|
|
61
|
+
}) => ImproveRecoveryCommand[];
|
|
62
|
+
/** One indented, copy-pasteable line; the cost rides along as a shell comment. */
|
|
63
|
+
export declare const improveRecoveryLine: (entry: ImproveRecoveryCommand) => string;
|
|
64
|
+
export declare const readImproveKitStatus: (args: {
|
|
65
|
+
record: ImproveRecord;
|
|
66
|
+
requestedTo?: ImproveStage;
|
|
67
|
+
}) => Promise<ImproveKitStatus>;
|
|
68
|
+
export declare const improveStageStatusLine: (status: ImproveStageStatus) => string;
|
|
69
|
+
//# sourceMappingURL=improve-kit-status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"improve-kit-status.d.ts","sourceRoot":"","sources":["../src/improve-kit-status.ts"],"names":[],"mappings":"AAGA,OAAO,EAAgC,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE7G;;;;;;;GAOG;AAEH,MAAM,MAAM,iBAAiB,GACzB,SAAS,GACT,UAA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