Skip to content

Commit 5785f0f

Browse files
author
DavidQ
committed
Remove legacy preview tool and refactor Preview Generator V2 toward class-based structure - PR_26126_034-preview-generator-v2-cleanup-and-class-review
1 parent 77a663e commit 5785f0f

10 files changed

Lines changed: 5088 additions & 2623 deletions

docs/design/tools/TOOLS_REENGINEERING_INDEX.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ This index lists the remaining rebuild anchors, schema baseline, and support fol
2626
| `schemas` | `tools/schemas` | schema folder | reference-only | none | schema baseline only; no schema changes in this PR |
2727
| `codex` | `tools/codex` | support folder | reference-only | none | reference only; no normal rebuild doc |
2828
| `dev` | `tools/dev` | support folder | reference-only | none | reference only; no normal rebuild doc |
29-
| `preview` | `tools/preview` | support folder | reference-only | none | reference only; no normal rebuild doc |
3029
| `shared` | `tools/shared` | support folder | reference-only | none | reference only; no normal rebuild doc |
3130
| `templates` | `tools/templates` | support folder | reference-only | none | reference only; no normal rebuild doc |
3231

docs/dev/codex_commands.md

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,48 @@
1-
# Codex Commands - PR_26126_033-preview-generator-v2-paths-stretch-layout
1+
# Codex Commands - PR_26126_034-preview-generator-v2-cleanup-and-class-review
22

33
```bash
4-
codex run "Create PR_26126_033-preview-generator-v2-paths-stretch-layout. Fix Preview Generator V2 layout only. Preserve existing generation behavior. In the left column, make the \"Paths or IDs\" accordion section stretch to fill all remaining vertical space down to the bottom of the panel above \"Last Generated Image\". Implement using flex layout: left panel column must be a flex container with column direction; set the Paths or IDs section to flex-grow:1 and its textarea to height:100% (or flex:1) so it expands fully. Do not use inline styles. Keep Last Generated Image fixed height below it. Do not modify samples. Do not add schema. Produce review artifacts."
4+
codex run "Create PR_26126_034-preview-generator-v2-cleanup-and-class-review. Fix Preview Generator V2 cleanup and structure. Remove legacy tools/preview/* completely. Keep tools/preview-generator-v2 as the active tool. Refactor Preview Generator V2 JavaScript away from one large script body. Use classes for major responsibilities: PreviewGeneratorV2App, PreviewGeneratorV2Ui, PreviewGeneratorV2Capture, PreviewGeneratorV2RepoAccess, PreviewGeneratorV2Logger. Preserve current working behavior exactly. Do not rewrite generation logic. Do not add schema. Do not modify samples. Produce review artifacts and include notes explaining class responsibilities."
55
```
66

77
## Validation Commands
88

99
```powershell
10+
node --check tools/preview-generator-v2/previewGeneratorV2.js
1011
@'
1112
const fs = require('fs');
1213
const html = fs.readFileSync('tools/preview-generator-v2/index.html', 'utf8');
13-
const required = [
14-
'.preview-generator-v2__center-panel .preview-generator-v2__paths-section',
15-
'flex: 1 1 auto;',
16-
'.preview-generator-v2__paths-section .accordion-v2__content',
17-
'height: 100%;',
18-
'.preview-generator-v2__center-panel .preview-generator-v2__last-generated-section',
19-
'flex: 0 0 auto;',
20-
'preview-generator-v2__paths-section is-open'
21-
];
22-
for (const token of required) {
23-
if (!html.includes(token)) throw new Error(`Missing layout token: ${token}`);
24-
}
25-
if (/<[^>]+style=/.test(html)) throw new Error('Inline style attribute found');
26-
console.log('paths stretch layout tokens ok');
27-
'@ | node -
28-
@'
29-
const fs = require('fs');
30-
const html = fs.readFileSync('tools/preview-generator-v2/index.html', 'utf8');
31-
const scripts = [...html.matchAll(/<script(?![^>]*\bsrc=)[^>]*>([\s\S]*?)<\/script>/gi)].map((match) => match[1]);
32-
scripts.forEach((script, index) => {
14+
const inlineScripts = [...html.matchAll(/<script(?![^>]*\bsrc=)[^>]*>([\s\S]*?)<\/script>/gi)].map((match) => match[1]);
15+
inlineScripts.forEach((script, index) => {
3316
new Function(script);
3417
console.log(`inline script ${index + 1} syntax ok`);
3518
});
3619
'@ | node -
37-
git diff --check -- tools/preview-generator-v2/index.html docs/dev/codex_commands.md docs/dev/commit_comment.txt docs/dev/reports/codex_review.diff docs/dev/reports/codex_changed_files.txt
20+
@'
21+
const fs = require('fs');
22+
const js = fs.readFileSync('tools/preview-generator-v2/previewGeneratorV2.js', 'utf8');
23+
for (const name of ['PreviewGeneratorV2App','PreviewGeneratorV2Ui','PreviewGeneratorV2Capture','PreviewGeneratorV2RepoAccess','PreviewGeneratorV2Logger']) {
24+
if (!js.includes(`class ${name}`)) throw new Error(`Missing class ${name}`);
25+
}
26+
if (!js.includes('new PreviewGeneratorV2App().init();')) throw new Error('App init missing');
27+
console.log('required classes present');
28+
'@ | node -
29+
if (Test-Path tools/preview) { throw 'tools/preview still exists' } else { 'tools/preview removed' }
30+
$legacyMatches = rg -n "preview_svg_generator|tools/preview" tools src docs/design --glob '!docs/dev/reports/*'
31+
if ($LASTEXITCODE -eq 0) { $legacyMatches; throw 'Active legacy preview reference found' }
32+
if ($LASTEXITCODE -eq 1) { 'no active legacy preview references' }
33+
if ($LASTEXITCODE -gt 1) { exit $LASTEXITCODE }
34+
git diff --check -- tools/preview-generator-v2/index.html tools/preview-generator-v2/previewGeneratorV2.js docs/design/tools/TOOLS_REENGINEERING_INDEX.md docs/dev/codex_commands.md docs/dev/commit_comment.txt docs/dev/reports/preview_generator_v2_class_responsibilities.md docs/dev/reports/codex_review.diff docs/dev/reports/codex_changed_files.txt
3835
npm run test:workspace-v2
3936
```
4037

4138
## Playwright
4239

43-
No new Playwright test was added. This PR changes Preview Generator V2 layout CSS/section classing only, with existing `accordionV2` behavior unchanged. `npm run test:workspace-v2` is attempted as the standard command if available.
40+
No new Playwright test was added. This PR restructures Preview Generator V2 JavaScript and removes the legacy preview folder while preserving the existing Preview Generator V2 UI and behavior. `npm run test:workspace-v2` is attempted as the standard command if available.
4441

4542
## Test Notes
4643

4744
`npm run test:workspace-v2` is not defined in the current `package.json`.
4845

4946
## Manual Test
5047

51-
Open Preview Generator V2 and confirm the `Paths or IDs` accordion stretches through the available column height above `Last Generated Image`. Confirm the `Paths or IDs` textarea grows with the section, `Last Generated Image` stays fixed below it, and generation behavior is unchanged.
48+
Open Preview Generator V2 from the tool registry. Confirm the tool loads, the repo picker/generate gating/log clear/stop controls still behave as before, and the Last Generated Image and Paths accordion layout from the previous PRs remains intact.

docs/dev/commit_comment.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Stretch Preview Generator V2 Paths accordion above fixed Last Generated Image - PR_26126_033-preview-generator-v2-paths-stretch-layout
1+
Remove legacy preview tool and class-structure Preview Generator V2 runtime - PR_26126_034-preview-generator-v2-cleanup-and-class-review
Lines changed: 32 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,39 @@
11
# Full git status --short
2-
MM docs/dev/codex_commands.md
3-
MM docs/dev/commit_comment.txt
4-
M docs/dev/reports/codex_changed_files.txt
5-
MM docs/dev/reports/codex_review.diff
6-
M samples/phase-02/0201/assets/images/preview.svg
7-
M samples/phase-02/0202/assets/images/preview.svg
8-
M samples/phase-02/0203/assets/images/preview.svg
9-
M samples/phase-02/0204/assets/images/preview.svg
10-
M samples/phase-02/0205/assets/images/preview.svg
11-
M samples/phase-02/0207/assets/images/preview.svg
12-
M samples/phase-02/0208/assets/images/preview.svg
13-
M samples/phase-02/0209/assets/images/preview.svg
14-
M samples/phase-02/0210/assets/images/preview.svg
15-
M samples/phase-02/0211/assets/images/preview.svg
16-
M samples/phase-02/0212/assets/images/preview.svg
17-
M samples/phase-02/0213/assets/images/preview.svg
18-
M samples/phase-02/0214/assets/images/preview.svg
19-
M samples/phase-02/0215/assets/images/preview.svg
20-
M samples/phase-02/0216/assets/images/preview.svg
21-
M samples/phase-02/0217/assets/images/preview.svg
22-
M samples/phase-02/0219/assets/images/preview.svg
23-
M samples/phase-02/0222/assets/images/preview.svg
24-
M samples/phase-02/0224/assets/images/preview.svg
25-
M samples/phase-02/0225/assets/images/preview.svg
26-
M samples/phase-02/0226/assets/images/preview.svg
27-
M samples/phase-02/0227/assets/images/preview.svg
28-
M samples/phase-12/1212/assets/images/preview.svg
29-
M samples/phase-12/1213/assets/images/preview.svg
30-
M samples/phase-12/1214/assets/images/preview.svg
31-
M samples/phase-12/1215/assets/images/preview.svg
32-
M samples/phase-12/1216/assets/images/preview.svg
33-
M samples/phase-12/1217/assets/images/preview.svg
34-
M samples/phase-12/1218/assets/images/preview.svg
35-
M samples/phase-12/1219/assets/images/preview.svg
36-
M samples/phase-12/1220/assets/images/preview.svg
37-
MM tools/preview-generator-v2/index.html
2+
M docs/design/tools/TOOLS_REENGINEERING_INDEX.md
3+
M docs/dev/codex_commands.md
4+
M docs/dev/commit_comment.txt
5+
M docs/dev/reports/codex_review.diff
6+
M tools/preview-generator-v2/index.html
7+
D tools/preview.zip
8+
D tools/preview/preview_svg_generator.html
9+
?? docs/dev/reports/preview_generator_v2_class_responsibilities.md
10+
?? tools/preview-generator-v2/previewGeneratorV2.js
3811

3912
# PR scoped git diff --cached --stat
40-
docs/dev/codex_commands.md | 44 +++++++++++++++++++++---------
41-
docs/dev/commit_comment.txt | 2 +-
42-
tools/preview-generator-v2/index.html | 51 ++++++++++++++++++++---------------
43-
3 files changed, 62 insertions(+), 35 deletions(-)
4413

4514
# PR scoped git diff --stat
46-
docs/dev/codex_commands.md | 34 +++---
47-
docs/dev/commit_comment.txt | 2 +-
48-
docs/dev/reports/codex_review.diff | 215 +++++++++++++++++++++++++---------
49-
tools/preview-generator-v2/index.html | 17 ++-
50-
4 files changed, 191 insertions(+), 77 deletions(-)
15+
docs/design/tools/TOOLS_REENGINEERING_INDEX.md | 1 -
16+
docs/dev/codex_commands.md | 47 +-
17+
docs/dev/commit_comment.txt | 2 +-
18+
tools/preview-generator-v2/index.html | 1238 +-----------------------
19+
tools/preview.zip | Bin 19111 -> 0 bytes
20+
tools/preview/preview_svg_generator.html | 1042 --------------------
21+
6 files changed, 24 insertions(+), 2306 deletions(-)
22+
23+
# New file diff stat: tools/preview-generator-v2/previewGeneratorV2.js
24+
.../preview-generator-v2/previewGeneratorV2.js | 1317 ++++++++++++++++++++
25+
1 file changed, 1317 insertions(+)
26+
27+
# New file diff stat: docs/dev/reports/preview_generator_v2_class_responsibilities.md
28+
.../reports/preview_generator_v2_class_responsibilities.md | 11 +++++++++++
29+
1 file changed, 11 insertions(+)
5130

5231
# Full git diff --stat
53-
docs/dev/codex_commands.md | 34 ++--
54-
docs/dev/commit_comment.txt | 2 +-
55-
docs/dev/reports/codex_review.diff | 215 +++++++++++++++++-------
56-
samples/phase-02/0210/assets/images/preview.svg | 6 +-
57-
samples/phase-02/0225/assets/images/preview.svg | 24 +--
58-
samples/phase-02/0226/assets/images/preview.svg | 21 +--
59-
samples/phase-02/0227/assets/images/preview.svg | 21 +--
60-
samples/phase-12/1212/assets/images/preview.svg | 17 +-
61-
samples/phase-12/1213/assets/images/preview.svg | 17 +-
62-
samples/phase-12/1214/assets/images/preview.svg | 17 +-
63-
samples/phase-12/1215/assets/images/preview.svg | 40 +++--
64-
samples/phase-12/1216/assets/images/preview.svg | 40 +++--
65-
samples/phase-12/1217/assets/images/preview.svg | 40 +++--
66-
samples/phase-12/1218/assets/images/preview.svg | 17 +-
67-
samples/phase-12/1219/assets/images/preview.svg | 17 +-
68-
samples/phase-12/1220/assets/images/preview.svg | 17 +-
69-
tools/preview-generator-v2/index.html | 17 +-
70-
17 files changed, 299 insertions(+), 263 deletions(-)
32+
docs/design/tools/TOOLS_REENGINEERING_INDEX.md | 1 -
33+
docs/dev/codex_commands.md | 47 +-
34+
docs/dev/commit_comment.txt | 2 +-
35+
docs/dev/reports/codex_review.diff | 3958 ++++++++++++++++++++++--
36+
tools/preview-generator-v2/index.html | 1238 +-------
37+
tools/preview.zip | Bin 19111 -> 0 bytes
38+
tools/preview/preview_svg_generator.html | 1042 -------
39+
7 files changed, 3728 insertions(+), 2560 deletions(-)

0 commit comments

Comments
 (0)