lazycodex-ai 5.1.33 → 5.1.34

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 (86) hide show
  1. package/README.ja.md +1 -1
  2. package/README.ko.md +1 -1
  3. package/README.md +1 -1
  4. package/README.ru.md +1 -1
  5. package/README.zh-cn.md +1 -1
  6. package/dist/cli/account-keys/commands.d.ts +9 -0
  7. package/dist/cli/account-keys/keyring.d.ts +16 -0
  8. package/dist/cli/account-keys/keystore.d.ts +34 -0
  9. package/dist/cli/index.js +91401 -90585
  10. package/dist/cli/service-auth/accounts-closed.fixture.d.ts +1 -0
  11. package/dist/cli/service-auth/commands.d.ts +4 -1
  12. package/dist/cli/worktree-sweep/types.d.ts +3 -1
  13. package/dist/cli-node/index.js +91521 -90705
  14. package/package.json +1 -1
  15. package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
  16. package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +1 -0
  17. package/packages/omo-codex/plugin/components/bootstrap/hooks/hooks.json +1 -1
  18. package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
  19. package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
  20. package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
  21. package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
  22. package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
  23. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +1 -1
  24. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
  25. package/packages/omo-codex/plugin/components/lsp/dist/.omo-runtime-manifest.json +2 -2
  26. package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
  27. package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
  28. package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
  29. package/packages/omo-codex/plugin/components/rules/package.json +1 -1
  30. package/packages/omo-codex/plugin/components/teammode/hooks/hooks.json +1 -1
  31. package/packages/omo-codex/plugin/components/teammode/package.json +1 -1
  32. package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
  33. package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
  34. package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
  35. package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
  36. package/packages/omo-codex/plugin/components/ulw-execute-continuation/hooks/hooks.json +1 -1
  37. package/packages/omo-codex/plugin/components/ulw-execute-continuation/package.json +1 -1
  38. package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +5 -5
  39. package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
  40. package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +1 -1
  41. package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +1 -1
  42. package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +1 -1
  43. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-comments.json +1 -1
  44. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-lsp-diagnostics.json +1 -1
  45. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-thread-title-hygiene.json +1 -1
  46. package/packages/omo-codex/plugin/hooks/post-tool-use-matching-project-rules.json +1 -1
  47. package/packages/omo-codex/plugin/hooks/post-tool-use-recording-spawn-admission.json +1 -1
  48. package/packages/omo-codex/plugin/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json +1 -1
  49. package/packages/omo-codex/plugin/hooks/pre-tool-use-guarding-ulw-loop-spawns.json +1 -1
  50. package/packages/omo-codex/plugin/hooks/pre-tool-use-recommending-git-bash-mcp.json +1 -1
  51. package/packages/omo-codex/plugin/hooks/session-start-checking-auto-update.json +1 -1
  52. package/packages/omo-codex/plugin/hooks/session-start-checking-bootstrap-provisioning.json +1 -1
  53. package/packages/omo-codex/plugin/hooks/session-start-loading-project-rules.json +1 -1
  54. package/packages/omo-codex/plugin/hooks/session-start-recording-session-telemetry.json +1 -1
  55. package/packages/omo-codex/plugin/hooks/stop-checking-ulw-execute-continuation.json +1 -1
  56. package/packages/omo-codex/plugin/hooks/stop-checking-ulw-loop-resume.json +1 -1
  57. package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +1 -1
  58. package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ultrawork-trigger.json +1 -1
  59. package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ulw-loop-steering.json +1 -1
  60. package/packages/omo-codex/plugin/hooks/user-prompt-submit-loading-project-rules.json +1 -1
  61. package/packages/omo-codex/plugin/package-lock.json +12 -12
  62. package/packages/omo-codex/plugin/package.json +1 -1
  63. package/packages/omo-codex/plugin/skills/browser/runtime/omowright/index.js +6 -5
  64. package/packages/omo-codex/plugin/skills/browser/runtime/omowright/manifest.json +3 -3
  65. package/packages/omo-codex/plugin/skills/ulw-research/AGENTS.md +3 -2
  66. package/packages/omo-codex/plugin/skills/ulw-research/SKILL.md +3 -1
  67. package/packages/omo-codex/plugin/skills/ulw-research/references/deliverable-phase.md +1 -1
  68. package/packages/omo-codex/plugin/skills/ulw-research/references/report-gates.md +2 -0
  69. package/packages/omo-codex/plugin/skills/ulw-research/references/report-visualization.md +126 -0
  70. package/packages/omo-codex/plugin/skills/ulw-research/scripts/contracts.mjs +3 -1
  71. package/packages/omo-codex/plugin/skills/ulw-research/scripts/gates-figures.mjs +33 -1
  72. package/packages/omo-codex/plugin/skills/ulw-research/scripts/gates-static.mjs +2 -2
  73. package/packages/omo-codex/scripts/install-dist/install-local.mjs +3 -2
  74. package/packages/shared-skills/skills/browser/runtime/omowright/index.js +6 -5
  75. package/packages/shared-skills/skills/browser/runtime/omowright/manifest.json +3 -3
  76. package/packages/shared-skills/skills/ulw-research/AGENTS.md +3 -2
  77. package/packages/shared-skills/skills/ulw-research/SKILL.md +3 -1
  78. package/packages/shared-skills/skills/ulw-research/references/deliverable-phase.md +1 -1
  79. package/packages/shared-skills/skills/ulw-research/references/report-gates.md +2 -0
  80. package/packages/shared-skills/skills/ulw-research/references/report-visualization.md +126 -0
  81. package/packages/shared-skills/skills/ulw-research/scripts/contracts.mjs +3 -1
  82. package/packages/shared-skills/skills/ulw-research/scripts/contracts.test.ts +2 -0
  83. package/packages/shared-skills/skills/ulw-research/scripts/gates-figures.mjs +33 -1
  84. package/packages/shared-skills/skills/ulw-research/scripts/gates-static.mjs +2 -2
  85. package/packages/shared-skills/skills/ulw-research/scripts/gates-static.test.ts +56 -3
  86. package/packages/shared-skills/skills/ulw-research/scripts/tests/fixtures/bad-report.html +4 -0
@@ -0,0 +1,126 @@
1
+ # ulw-research - report visualization playbook
2
+
3
+ Read this before the asset lanes start in the final-materials phase. A report the reader has to dig through as plain text has failed even when every claim is right: people understand structure from a diagram and a trend from a chart faster than from prose. Every final report therefore carries visuals, and this file says which visual fits which finding, how to make each one, and how the gates check them.
4
+
5
+ ## 1. The binding minimum
6
+
7
+ - At least one data visualization of the report's own findings (a chart drawn from the run's data table), placed next to the claim it supports. The executive summary carries the headline visual.
8
+ - A diagram wherever structure matters: a process, an architecture, a timeline, a dependency or influence graph, a comparison of options, the evidence flow behind a contested claim.
9
+ - When the topic has visual or video source material (product screenshots, demo videos, talks, viral posts with media), the report embeds or links it with attribution. In a paginated format, use a captioned still frame plus the link and timestamp.
10
+ - Every visual sits in a `<figure>` with a caption that says what it shows and where the data came from (`[S<n>]` or a lineage tag), and every `<img>` has alt text.
11
+ - A light-tier answer (a chat or thread post) still carries one visual when it reports numbers or structure: a Mermaid block the destination renders, or a single chart image.
12
+
13
+ A report that ships with none of these is incomplete. The static gate raises `report_without_visual` for it and `image_missing_alt` for an image without alt text (section 6).
14
+
15
+ ## 2. Which tool for which finding
16
+
17
+ | Finding | Tool | Output |
18
+ | --- | --- | --- |
19
+ | Numbers: trends, comparisons, distributions, shares, rankings | A chart computed from a real data table | SVG with live text (PNG only for DOCX or slides) |
20
+ | Process, pipeline, decision flow, sequence of calls | Mermaid `flowchart` or `sequenceDiagram` | SVG |
21
+ | Timeline or history | Mermaid `timeline` or `gantt` | SVG |
22
+ | Relationships: who builds on whom, ownership, influence, dependency | Mermaid `flowchart` or `graph`; `mindmap` for a topic tree | SVG |
23
+ | System or product architecture | Mermaid `flowchart` with subgraphs, or `architecture-beta` where the renderer supports it | SVG |
24
+ | Neural-network architecture in a paper-format (LaTeX) report | PlotNeuralNet | PDF for LaTeX, SVG or PNG for HTML |
25
+ | A product, interface, or page the report discusses | A screenshot captured while reading the source, through the browser skill | PNG |
26
+ | A concept that has no data and no structure, a cover | The image-generation skill, only when it helps the reader understand | PNG |
27
+ | A source video or talk | An embed (web) or a still frame plus link and timestamp (paginated) | iframe or PNG |
28
+
29
+ Image generation never draws data, numbers, diagrams with labels, or anything the reader could mistake for evidence. Its caption says it is an illustration.
30
+
31
+ ## 3. How to make each one
32
+
33
+ Save every asset under `$SESSION_DIR/assets/` and confirm the file exists and is non-empty before the document references it.
34
+
35
+ ### Charts from data
36
+
37
+ Put the numbers in a table first (`$SESSION_DIR/data/<name>.csv`), then plot from the table, never from prose. Follow the data-scientist doctrine in SKILL.md (numpy, Polars, DuckDB, no pandas).
38
+
39
+ ```bash
40
+ uv run --with numpy --with polars --with matplotlib python plot_<name>.py
41
+ ```
42
+
43
+ - Keep chart text as real text: set `matplotlib.rcParams["svg.fonttype"] = "none"` before saving an SVG. The default converts text to paths, and the static gate then sees a chart with no title, ticks, or labels.
44
+ - Use the design spec's font family and palette tokens (`rcParams["font.family"]`, explicit colors from the spec). One accent color for the series that carries the finding; neutral tones for the rest.
45
+ - Title, axis labels with units, value labels on bars or end points, ticks at round values computed from the data range.
46
+ - One message per chart. A chart that needs a paragraph to explain is two charts.
47
+ - For a web deliverable, HTML/CSS bars or an inline SVG built from the same table are preferred over an image.
48
+
49
+ ### Mermaid diagrams
50
+
51
+ Write the source to `assets/<name>.mmd` and render it to SVG with the design spec's font and palette:
52
+
53
+ ```bash
54
+ cat > "$SESSION_DIR/assets/mermaid-config.json" <<'EOF'
55
+ { "theme": "base", "htmlLabels": false, "flowchart": { "htmlLabels": false }, "themeVariables": { "fontFamily": "<spec body font>", "primaryColor": "<spec surface>", "primaryTextColor": "<spec text>", "primaryBorderColor": "<spec accent>", "lineColor": "<spec rule>", "arrowheadColor": "<spec rule>" } }
56
+ EOF
57
+ npx -y @mermaid-js/mermaid-cli -i "$SESSION_DIR/assets/<name>.mmd" -o "$SESSION_DIR/assets/<name>.svg" -c "$SESSION_DIR/assets/mermaid-config.json" -b transparent
58
+ ```
59
+
60
+ - Keep `htmlLabels` off. With HTML labels the node text lands in `foreignObject` HTML instead of SVG `<text>`, so the static gate sees a diagram with no labels, and PDF and DOCX converters often drop it.
61
+ - The CLI drives its own headless renderer. When it cannot start in this session, keep the `.mmd` source, deliver the diagram as a Mermaid code block only where the destination renders Mermaid (GitHub, Notion, many Markdown viewers), and record the render as not run in the closing section. The static gate counts only rendered figures, so an HTML report still needs another rendered visual.
62
+ - Keep a diagram to about 15 nodes. Split a bigger one by subgraph or by step.
63
+ - Lay a chain of more than about five nodes out top to bottom (`flowchart TB`). A wide left-to-right diagram scaled down to the page width shrinks its labels below legible size, worst on a phone.
64
+ - Label every edge whose meaning is not obvious. Node text is short nouns; the caption carries the explanation.
65
+ - Inline the rendered SVG in HTML reports (the gates read its text) or reference the file inside a `<figure>`.
66
+
67
+ ### PlotNeuralNet (paper-format reports)
68
+
69
+ Use it when the deliverable is LaTeX or a paper-style PDF and the report describes a convolutional or encoder-decoder model whose layer shapes matter. It draws 3D layer blocks with TikZ from a short Python description. It needs a LaTeX toolchain (`pdflatex` with TikZ; on Debian or Ubuntu `texlive-latex-base`, `texlive-latex-extra`, `texlive-fonts-recommended`, `texlive-fonts-extra`; on macOS a TeX distribution) and Python 3. Source: https://github.com/HarisIqbal88/PlotNeuralNet
70
+
71
+ ```bash
72
+ git clone --depth 1 https://github.com/HarisIqbal88/PlotNeuralNet "$SESSION_DIR/tools/PlotNeuralNet"
73
+ mkdir -p "$SESSION_DIR/tools/PlotNeuralNet/report" && cd "$SESSION_DIR/tools/PlotNeuralNet/report"
74
+ # write arch.py from the README's Python example: to_head(".."), to_cor(), to_begin(), layers, to_connection(...), to_end()
75
+ python3 arch.py # writes arch.tex
76
+ pdflatex -interaction=nonstopmode arch.tex
77
+ pdftocairo -svg arch.pdf "$SESSION_DIR/assets/arch.svg" # for an HTML report; LaTeX reports \input the .tex or include the PDF
78
+ ```
79
+
80
+ - Run `pdflatex` directly instead of the repository's `tikzmake.sh`: that script deletes the generated `.tex` (which a LaTeX report needs to `\input`) and opens a PDF viewer. The repository has had no commits since 2020; pin the cloned commit in the closing section.
81
+ - Layer captions carry the real shapes and channel counts from the cited paper or code, with the citation in the figure caption.
82
+ - It does not fit transformers, graph models, or training pipelines well. Draw those with Mermaid or a hand-built TikZ figure instead.
83
+
84
+ ### Screenshots and video
85
+
86
+ - Capture product and page screenshots through the browser skill while the source is open, at a readable width, and crop to the part the claim is about. Caption with the source and the access date.
87
+ - Embed a video in a web report with the platform's embed and a timestamp; in a paginated report, use a still frame from the moment the claim refers to, with the link and timestamp in the caption.
88
+
89
+ ### Generated illustrations
90
+
91
+ Use the image-generation skill only for a cover or a concept illustration that helps the reader, prompted from the design spec's palette and register. Never let generated images carry text, numbers, or logos the reader could read as fact.
92
+
93
+ ## 4. Choosing the output format
94
+
95
+ A post by Andrej Karpathy on 2026-10-02 ranks the formats that make model output easier to understand, each better than the last: controlled clean writing, diagrams and images, interactive web pages, and custom explainer videos (https://x.com/karpathy/status/2105819303471976479). Apply it as follows:
96
+
97
+ - Prose: write in the direction of ASD-STE100 (simplified technical English): short sentences, one idea per sentence, active voice, the same word for the same thing. The post suggests asking for about "80% of the way" when the full spec is too strict.
98
+ - Before writing a long explanation of structure, draw it. A diagram usually replaces several paragraphs.
99
+ - When the destination allows it, prefer a self-contained HTML report with interactive elements (hover values, toggles between series, expandable evidence) over a static document.
100
+ - When the requester asks for it, or the topic is a process best seen in motion, an explainer video (for example a 3Blue1Brown-style animation, narrated with a speech API or a local text-to-speech model) is a valid extra deliverable. Record it in `outcome.json` like any other promised format.
101
+
102
+ ## 5. Quality bar
103
+
104
+ - Every figure follows the figure standard in SKILL.md: fixed container, contain-fit, aspect ratio preserved, spec fonts and palette.
105
+ - The caption alone tells the reader what the visual shows and what to conclude: "Median build time fell from 9.4 to 3.1 minutes after the cache change [S4]" beats "Build times".
106
+ - Alt text states the content, not the file: the key values or the shape of the trend for a chart, the main nodes and flow for a diagram. A purely decorative image takes `alt=""` plus `role="presentation"` and does not count as a visual; an empty alt without that marker is reported as missing.
107
+ - Every number in a visual comes from the data table and carries its source or lineage tag in the caption.
108
+ - Colors are never the only signal: label series directly or use distinct markers, so the figure reads in grayscale.
109
+
110
+ ## 6. QA checklist
111
+
112
+ The static gate (`report-tools check`) enforces the machine-checkable rows; visual QA checks the rest on the rendered pages.
113
+
114
+ | Check | Enforced by |
115
+ | --- | --- |
116
+ | The report has at least one chart, diagram, or figure image | `report_without_visual` |
117
+ | Every visual sits in a figure with a non-empty caption | `chart_without_figure` |
118
+ | Every chart SVG has a title, ticks, and a text label | `chart_svg_no_text`, `chart_svg_missing_labels` |
119
+ | Every `<img>` has alt text | `image_missing_alt` |
120
+ | Every referenced asset exists and is non-empty | `broken_asset_reference` |
121
+ | Chart and diagram colors are spec tokens | `palette_off_token` |
122
+ | No image is stretched, cropped, or spilling its container | `layout_image_distorted`, `layout_overflow` |
123
+ | Each major quantitative finding has a chart and each structural finding has a diagram | visual QA |
124
+ | Diagram and chart text renders in the spec font and is legible at phone width | visual QA |
125
+ | Source videos and screenshots are embedded or linked with attribution where the topic has them | visual QA |
126
+ | Generated illustrations carry no fake data or text and are captioned as illustrations | visual QA |
@@ -25,6 +25,8 @@ export const DEFECT_CODES = deepFreeze({
25
25
  chart_without_figure: { severity: "major", integrity: false, hint: "Wrap the image or chart in a figure container with a caption." },
26
26
  chart_svg_no_text: { severity: "major", integrity: false, hint: "Give the chart a title, axis labels, units, and value labels as SVG text." },
27
27
  chart_svg_missing_labels: { severity: "minor", integrity: false, hint: "Add the missing title, axis ticks, or unit label to the chart." },
28
+ report_without_visual: { severity: "major", integrity: false, hint: "Add at least one captioned visual of the findings: a chart from the data table, a rendered Mermaid diagram, or a figure image (references/report-visualization.md)." },
29
+ image_missing_alt: { severity: "minor", integrity: false, hint: "Give the image an alt attribute that states what it shows, not its file name; mark a purely decorative image alt=\"\" with role=\"presentation\"." },
28
30
  korean_serif_font: { severity: "major", integrity: false, hint: "Use a gothic (sans) Korean family; serif and brush families are banned by the design spec." },
29
31
  section_without_citation: { severity: "major", integrity: false, hint: "Cite at least one source inside this section or merge it into a cited one." },
30
32
  missing_closing_section: { severity: "blocker", integrity: true, hint: "Add the closing section that explains how the report was made (method, sources, gates)." },
@@ -40,7 +42,7 @@ export const DEFECT_CODES = deepFreeze({
40
42
  })
41
43
 
42
44
  const LAYOUT_PREFIX = "layout_"
43
- /** Codes checkStatic can raise (G1-G15). */
45
+ /** Codes checkStatic can raise (G1-G17). */
44
46
  export const STATIC_CODES = Object.freeze(
45
47
  Object.keys(DEFECT_CODES).filter((code) => !code.startsWith(LAYOUT_PREFIX) && code !== "missing_promised_deliverable"),
46
48
  )
@@ -33,6 +33,8 @@ const STATIC_CODES_EXPECTED = [
33
33
  "chart_without_figure",
34
34
  "chart_svg_no_text",
35
35
  "chart_svg_missing_labels",
36
+ "report_without_visual",
37
+ "image_missing_alt",
36
38
  "korean_serif_font",
37
39
  "section_without_citation",
38
40
  "missing_closing_section",
@@ -1,5 +1,5 @@
1
1
  // gates-figures.mjs - visual gates: G2 palette, G8 chart without figure, G9 chart svg text,
2
- // G10 Korean serif/brush fonts.
2
+ // G10 Korean serif/brush fonts, G16 report without any visual, G17 image without alt text.
3
3
  //
4
4
  // Each gate is { codes, skip?(ctx), run(ctx) -> Defect[] } over the context built by
5
5
  // gates-static.mjs. Plain Node ESM, sibling imports only.
@@ -84,6 +84,19 @@ function missingChartLabels(raw) {
84
84
  return missing
85
85
  }
86
86
 
87
+ const DECORATIVE_ROLE = /^(?:presentation|none)$/i
88
+
89
+ /** An image explicitly marked decorative: empty alt plus role=presentation|none or aria-hidden=true. */
90
+ function isDecorative(node) {
91
+ if (node.tag !== "img" || node.attrs.alt === undefined || String(node.attrs.alt).trim()) return false
92
+ return DECORATIVE_ROLE.test(String(node.attrs.role ?? "").trim()) || String(node.attrs["aria-hidden"] ?? "").trim() === "true"
93
+ }
94
+
95
+ /** A rendered diagram (Mermaid marks its root with aria-roledescription) has node labels, not axes and ticks. */
96
+ function isDiagram(node) {
97
+ return Boolean(node.attrs["aria-roledescription"])
98
+ }
99
+
87
100
  function colorUses(ctx) {
88
101
  const uses = new Map()
89
102
  const add = (hex, node) => {
@@ -147,6 +160,10 @@ export const figureGates = [
147
160
  for (const node of visuals(ctx)) {
148
161
  if (node.tag !== "svg") continue
149
162
  if (!((declaredSize(node) ?? 0) >= CHART_MIN || ctx.util.closest(node, isFigure(ctx)))) continue
163
+ if (isDiagram(node)) {
164
+ if (!svgTexts(node.raw ?? "").length) defects.push(ctx.defect("chart_svg_no_text", node, `${label(node)} diagram has no <text> labels (render Mermaid with htmlLabels off)`))
165
+ continue
166
+ }
150
167
  const missing = missingChartLabels(node.raw ?? "")
151
168
  if (missing === null) defects.push(ctx.defect("chart_svg_no_text", node, `${label(node)} chart has no <text> and no <title>`))
152
169
  else if (missing.length) defects.push(ctx.defect("chart_svg_missing_labels", node, `${label(node)} chart is missing: ${missing.join(", ")}`))
@@ -154,6 +171,21 @@ export const figureGates = [
154
171
  return defects
155
172
  },
156
173
  },
174
+ {
175
+ codes: ["report_without_visual"],
176
+ run(ctx) {
177
+ if (visuals(ctx).some((node) => declaredSize(node) !== 0 && !isDecorative(node))) return []
178
+ return [ctx.defect("report_without_visual", ctx.body, "the report has no chart, diagram, or figure image")]
179
+ },
180
+ },
181
+ {
182
+ codes: ["image_missing_alt"],
183
+ run(ctx) {
184
+ return visuals(ctx)
185
+ .filter((node) => node.tag === "img" && !String(node.attrs.alt ?? "").trim() && !isDecorative(node))
186
+ .map((node) => ctx.defect("image_missing_alt", node, `${label(node)} has no alt text`))
187
+ },
188
+ },
157
189
  {
158
190
  codes: ["korean_serif_font"],
159
191
  run(ctx) {
@@ -1,4 +1,4 @@
1
- // gates-static.mjs - deterministic static gates (G1-G15) over a parsed report.
1
+ // gates-static.mjs - deterministic static gates (G1-G17) over a parsed report.
2
2
  //
3
3
  // Builds one document context (a document-order walk with h2 sections, citation helpers and a
4
4
  // defect factory) and hands it to the text, figure and structure gate modules. Every severity
@@ -144,7 +144,7 @@ function buildContext(doc, options) {
144
144
  }
145
145
 
146
146
  /**
147
- * Run G1-G15 over a parsed report (html-lite root).
147
+ * Run G1-G17 over a parsed report (html-lite root).
148
148
  * @param {object} doc parseHtml(...) result
149
149
  * @param {{ palette?: Set<string>, lineageMode?: "inline"|"section", requireSections?: (RegExp|string)[],
150
150
  * baseDir?: string, fs?: { statSync(path: string): { size: number } }, closingPattern?: RegExp|string }} options
@@ -42,14 +42,14 @@ describe("checkStatic fixtures", () => {
42
42
  expect([...result.gatesRun].sort()).toEqual([...STATIC_CODES].sort())
43
43
  })
44
44
 
45
- test("#given the failing fixture report #when every gate runs #then each static code is raised exactly once", () => {
45
+ test("#given the failing fixture report #when every gate runs #then each static code except the no-visual one is raised exactly once", () => {
46
46
  // given
47
47
  const options = { requireSections: [/risks/i] }
48
48
  // when
49
49
  const result = run(BAD, options)
50
50
  // then
51
- expect([...codes(result)].sort()).toEqual([...STATIC_CODES].sort())
52
- expect(STATIC_CODES).toHaveLength(17)
51
+ expect([...codes(result)].sort()).toEqual(STATIC_CODES.filter((code) => code !== "report_without_visual").sort())
52
+ expect(STATIC_CODES).toHaveLength(19)
53
53
  expect(codes(result)).not.toContain("missing_promised_deliverable")
54
54
  })
55
55
 
@@ -228,6 +228,59 @@ describe("figures and charts", () => {
228
228
  })
229
229
  })
230
230
 
231
+ describe("report-level visuals", () => {
232
+ const figures = /<figure\b[\s\S]*?<\/figure>/g
233
+
234
+ test("#given the passing fixture with every figure removed #when checked #then only report_without_visual is raised", () => {
235
+ // given
236
+ const html = GOOD.replace(figures, "")
237
+ // when
238
+ const result = run(html, { requireSections: [/sources/i, /review/i] })
239
+ // then
240
+ expect(codes(result)).toEqual(["report_without_visual"])
241
+ expect(result.defects[0]?.severity).toBe("major")
242
+ })
243
+
244
+ test("#given a header logo, an unrendered Mermaid source block, a zero-size svg, then a rendered diagram #when checked #then only the rendered diagram counts as a visual", () => {
245
+ // given
246
+ const logo = '<header><img src="data:image/png;base64,iVBORw0KGgo=" alt="logo" width="120" height="40"></header><p>x</p>'
247
+ const unrendered = `${logo}<pre class="mermaid">flowchart LR\n A --> B</pre><figure><svg width="0" height="0"><text>A</text></svg><figcaption>c</figcaption></figure>`
248
+ const rendered = `${logo}<figure><svg width="600" height="300" aria-roledescription="flowchart-v2"><text>A</text><text>B</text></svg><figcaption>c</figcaption></figure>`
249
+ // when / then
250
+ expect(has(unrendered, "report_without_visual")).toBe(true)
251
+ expect(has(rendered, "report_without_visual")).toBe(false)
252
+ })
253
+
254
+ test("#given rendered Mermaid diagrams with SVG text labels and with HTML-only labels #when checked #then only the HTML-only one is flagged and neither needs chart ticks", () => {
255
+ // given
256
+ const diagram = (labels: string) => `<figure><svg width="600" height="300" aria-roledescription="flowchart-v2">${labels}</svg><figcaption>Gate order</figcaption></figure>`
257
+ const textLabels = diagram("<text>static check</text><text>repair decide</text>")
258
+ const htmlLabels = diagram("<foreignObject><div>static check</div></foreignObject>")
259
+ // when
260
+ const chartCodes = (html: string) => codes(run(html)).filter((code) => code.startsWith("chart_"))
261
+ // then
262
+ expect(chartCodes(textLabels)).toEqual([])
263
+ expect(chartCodes(htmlLabels)).toEqual(["chart_svg_no_text"])
264
+ })
265
+
266
+ test("#given figure images with no alt, a bare empty alt, role- and aria-marked decorative alts and a descriptive alt #when checked #then only the unmarked two raise image_missing_alt", () => {
267
+ // given
268
+ const img = (alt: string) => `<figure><img src="data:image/png;base64,iVBORw0KGgo=" ${alt} width="480" height="240"><figcaption>c</figcaption></figure>`
269
+ const html = ["", 'alt=""', 'alt="" role="presentation"', 'alt="" aria-hidden="true"', 'alt="Deploys per week, 2025"'].map(img).join("")
270
+ // when
271
+ const found = run(html).defects.filter((d) => d.code === "image_missing_alt")
272
+ // then
273
+ expect(found).toHaveLength(2)
274
+ })
275
+
276
+ test("#given a report whose only image is marked decorative #when checked #then report_without_visual is raised", () => {
277
+ // given
278
+ const html = '<figure><img src="data:image/png;base64,iVBORw0KGgo=" alt="" role="presentation" width="480" height="240"><figcaption>c</figcaption></figure>'
279
+ // when / then
280
+ expect(has(html, "report_without_visual")).toBe(true)
281
+ })
282
+ })
283
+
231
284
  describe("gate bookkeeping", () => {
232
285
  test("#given a spec with an empty palette #when checked #then palette_off_token is skipped, not run", () => {
233
286
  // given
@@ -34,6 +34,10 @@ body { background: var(--bg); color: var(--fg); font-family: "Nanum Myeongjo", s
34
34
  <img src="assets/missing-figure.png" alt="lost asset" width="480" height="240">
35
35
  <figcaption>Lost asset [S1]</figcaption>
36
36
  </figure>
37
+ <figure>
38
+ <img src="data:image/png;base64,iVBORw0KGgo=" width="480" height="240">
39
+ <figcaption>Image without alt text [S1]</figcaption>
40
+ </figure>
37
41
  </section>
38
42
  <section>
39
43
  <h2>팀 구성은 그대로였다</h2>