Skip to content

feat(visualization): write diagrams to an Excalidraw file - #17052

Merged
kyle-sexton merged 3 commits into
mainfrom
feat/visualization-excalidraw-file-target
Nov 18, 2026
Merged

kyle-sexton merged 3 commits into
mainfrom
feat/visualization-excalidraw-file-target

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

No related issue: a new diagram target for the visualization plugin, with no tracked issue behind it.

Summary

/visualization:visualize can now write a diagram to an Excalidraw file in the repository, so a person can open and edit it in an editor without a canvas server or network access.

Fix

  • diagram_target gains excalidraw-file, which writes a flow, flowchart, state diagram or swim lane to docs/diagrams/<name>.excalidraw at the git top level. Outside a repository, or at $HOME or above, it falls back to auto.
  • lib/diagram-file-check.mjs checks each draft before it reaches the repository: it refuses what the Excalidraw loader rejects or drops, and anything that reaches outside the file when opened.
  • The skill asks before replacing an existing file, replaces nothing when unattended, and never stages or commits the file.
  • /planning:design asks for the fenced form, so a file target never replaces the diagram in its typed artifact.

Verification

  • claude plugin eval, case viz-diagram-target-excalidraw-file: on the final head, 2 of 2 completed runs scored 1.00. On the commit before the font size check, 5 of 5 scored 1.00, against 0.25 without the plugin.
  • claude plugin eval, case viz-diagram-target-file-no-repo: 3 of 3 runs scored 1.00, on the commit before the font size check.
  • plugins/visualization/tests/diagram-file-check.test.sh: all 6 tests passed.
  • Left out: three further eval runs on the final head, which could not start because of a local sandbox restriction, and opening a generated file in the Excalidraw editor by hand.

Related

N/A

🤖 Generated with Claude Code

kyle-sexton and others added 2 commits November 17, 2026 23:16
…m_target excalidraw-file

diagram_target gains excalidraw-file. /visualization:visualize writes a
flow, flowchart, state diagram or swim lane (one labeled frame per lane)
as docs/diagrams/<name>.excalidraw at the repository root, for the person
to open and edit in an Excalidraw editor. It needs no canvas server and
no network, so it works in the Claude Code terminal and hosted_canvas
does not gate it. The skill drafts the file in a private temp directory,
runs lib/diagram-file-check.mjs on it, asks before replacing an existing
file (and replaces nothing when unattended), never stages or commits it,
and reports the absolute path. Outside a repository, or when the check
keeps failing, it falls back to auto with the one-line notice.

A resolved medium does not override the file target; a medium argument,
a form the person names, or a calling skill that needs the fenced form
for its own document does. /planning:design now asks for the fenced
form, so a file target never replaces the diagram its typed artifact
holds.

The structural check refuses what the Excalidraw loader rejects or
silently drops (wrong file marker, non-numeric version, unknown element
types, missing positions or sizes, duplicate ids, dangling frame,
container and binding references) and anything that reaches outside the
file when opened (links, images, embeds).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
When the shell could not make the private run directory, the skill gave
up on the excalidraw-file target and drew Mermaid. It now writes the
draft with the Write tool and uses auto only when that write fails too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 18, 2026 05:54
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T05:56:21.537710Z 0acdb18 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0acdb1826e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-refine/fix-docs
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed none (read lane)
Run 44247521203

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

Excalidraw's loader keeps a missing fontSize and divides by it to find
the line height, so a label could vanish when the file opened. The check
now requires a positive fontSize and a positive lineHeight when one is
given. The Node suite also gains the shell wrapper the test lanes need.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 6115eee85f94863713df49c34941d2643068e514: read 4 of 4 changed file(s); 1 finding(s), 0 as inline comments.

Security review (incremental): PR #17052, 0acdb182..6115eee8

I found no new security issues in this push. I read every hunk of the incremental diff, all 4 listed files. This lane already reviewed an earlier head, so this review was blocking only: it reports CRITICAL and IMPORTANT findings and drops suggestions. None of the 4 files matches a trusted-path glob, and the push changes no trust control.

What changed and what I checked:

  • plugins/visualization/lib/diagram-file-check.mjs: text elements now need a finite fontSize above zero. A lineHeight, when one is given, must be a finite number above zero. The checker gets stricter and stays read-only: it parses JSON, evaluates nothing and runs nothing.
  • plugins/visualization/skills/visualize/SKILL.md: one added clause tells the drafter to give text a fontSize. No standing rule is deleted, narrowed or softened, so the instruction-surface lens finds nothing.
  • plugins/visualization/tests/diagram-file-check.test.mjs: test cases only.
  • plugins/visualization/tests/diagram-file-check.test.sh (new): it runs node --test on the test file next to it, using a path built from its own location. It takes no outside input, so nothing can be injected.

The settled thread on diagram-file-check.mjs (owner reply by kyle-sexton) asked for this fontSize fix. This push makes it, and I raise nothing new on those lines.

Finding restated from the earlier review (IMPORTANT): the earlier summary finding had no line anchor, so it is restated here and not posted inline (earlier comment).

  • diagram_target gains an excalidraw-file option at plugin.json#L52.
  • The key can't count as a selector: two of its existing values, excalidraw and tldraw, can send diagram content to a remote canvas server. So adding an option is a default-deny flag.
  • It is not CRITICAL: the default stays auto, so no installed user gets the new behavior on update without choosing it.

No embedded instructions in the PR context. Nothing in this push can start a charge or spend extra credits.

critical-findings: 0

Manifest lines (2)
  • manifest userConfig.diagram_target.options: flag, the added value excalidraw-file writes a local .excalidraw file into the repository's docs/diagrams/ (no network traffic, never staged or committed). The key is not a selector because its existing values excalidraw and tldraw can send content off the machine. The default stays auto, so this is IMPORTANT (plugin.json#L52).
  • manifest userConfig.diagram_target.description: pass

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 6115eee85f94863713df49c34941d2643068e514: read 4 of 4 changed file(s); 0 finding(s), 0 as inline comments.

Incremental code review: 0acdb182..6115eee8

This review reported only blocking findings. The lane already reviewed an earlier head, so it posts only blocking findings and manifest flags.

I read all 4 files in the incremental scope:

  • plugins/visualization/lib/diagram-file-check.mjs: every text element must now have a finite, positive fontSize. When a lineHeight is given, it must also be finite and positive. This reuses the existing finite helper (typeof === "number" plus Number.isFinite), so strings, NaN and Infinity are rejected. != null treats a missing lineHeight and a null one the same way, which matches the "only when given" rule. The existing "has no text" check is unchanged inside the new block.
  • plugins/visualization/tests/diagram-file-check.test.mjs: the label fixture now defaults to fontSize: 16 and takes overrides. New cases cover a missing fontSize, a zero fontSize, a non-numeric lineHeight, and a passing case with a valid lineHeight. The existing label cases still pass because the default supplies a fontSize.
  • plugins/visualization/tests/diagram-file-check.test.sh: a new wrapper with a test-scope: header. It skips when node is missing and otherwise execs node --test on the .mjs suite.
  • plugins/visualization/skills/visualize/SKILL.md: the drafting instructions now tell the drafter to give every text element a fontSize, which matches the new check.

This change applies the owner's fix for the settled thread on diagram-file-check.mjs (the missing fontSize crash in Excalidraw's restoreElement). I found no new problem on those lines.

No text elements elsewhere in the plugin are checked by diagram-file-check and would now fail the stricter rule. The only other "type": "text" matches are in eval history.jsonl records of past runs.

There is no closing issue, so no acceptance criteria were checked. No plugin manifest changed in this increment. Security is left to the security lane. I ran nothing: the test results are the author's claim and I have not checked them.

Loosened-check verdict: fail (the wrapper supplied no setting, so the default applies); patterns: 0. No changed file loosens a check: the change only adds stricter rules.

The earlier summary comment's two findings are about lines this increment doesn't touch. That comment has no line anchor, so this review doesn't restate it.

Verifier dropped 0 of 0 candidates.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 18, 2026
Merged via the queue into main with commit 6b58b98 Nov 18, 2026
66 checks passed
@kyle-sexton
kyle-sexton deleted the feat/visualization-excalidraw-file-target branch November 18, 2026 06:19
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant