Skip to content

Chat: contr-flow blocks draw as flow diagrams (#696, D284) - #738

Merged
contursofran merged 31 commits into
mainfrom
agent/696-diagrams-flow
Nov 11, 2026
Merged

contursofran merged 31 commits into
mainfrom
agent/696-diagrams-flow

Conversation

@contursofran

Copy link
Copy Markdown
Owner

Part of #696 (step 2, PR 1 of 2: flow diagrams).

What changed

  • New package internal/app/diagram: the flow parser, the layout and the Painter drawing, moved from the spike. Only the flow parts are here: no contr-seq, no Mermaid. Parse returns an error for each bad input. View builds nothing and returns false when the flow is too large: more than 12 nodes, a label over 28 characters, more than 6 layers, more than 4 nodes in a layer, or wider than maxW.
  • Chat: a contr-flow Code hook (flowBlock in chatview/content.go). The text uses the chat's ts (D272), and the box height grows with the text. The diagram is at most the column wide. A block that does not parse, does not fit or is still being written shows as markdown.DefaultCodeBlock, as before.
  • Sheet part ChatFlow; see.sh fixture chat-flow.
  • D284; docs/spec/ChatView.md gets a Diagrams section.

Steps

  1. Move the spike code to internal/app/diagram, flow only.
  2. Add the chat hook with the code-block fallback.
  3. Add the tests, the sheet part and the fixture.
  4. Update the docs.

Tests

  • diagram: TestParse, TestParseErrors (chain, empty, no arrow, bad state), TestLimits (12/13 nodes, long label, layers, fan-out, back edge), TestView (fits, too wide).
  • chatview: TestFlowBlock (good gives the diagram element; bad, large and wide give the code block).
  • e2e: scripts/see.sh chat-flow dark|light ran. In the .txt, the "Flow diagram" group shows between the two prose lines.

Size

The diff has about 740 added lines, about 270 of them tests. layout.go and view.go are the spike code, almost unchanged.

Pre-check

  1. Tests: with the change undone, each test failed. No hook: TestFlowBlock good. No chain check: TestParseErrors and TestFlowBlock bad. No width check: TestView and TestFlowBlock wide.
  2. Plan: all items done. contr-seq and the skill lines are left for PR 2, as the brief says.
  3. Contract: language contr-flow, decision D284, element label "Flow diagram".
  4. Up to date: main is merged in. Open PRs Chat: the composer shows Claude Code's suggested next prompt (#727, D281) #733 and Chat: brand marks of known servers on call lines (#709 S4, D274) #734 touch chatview; they may conflict in content.go or DECISIONS.md, but the conflicts would be small.
  5. The diff is read: no debug output and no unused code.
  6. Coverage: every acceptance item of step 2 is done for flow.
  7. Duties: nothing is removed. Other code blocks still go through the same hooks.
  8. Evidence: sheet and see PNGs, Dark and Light, checked by eye. All labels show (owner picks, PR, approved, blockers, six boxes).

scripts/check.sh: ok, run before the main merge. After the merge, gofmt, vet and the touched tests pass.

A connector, plugin or other MCP call of a known server shows the
monochrome Simple Icons mark of the server in ink-48 in place of the
kind icon. One table in chatview/tools.go maps the server name.
A worker of the Claude, OpenAI or DeepSeek family shows its mark in
place of its 6px dot, in the dot's ink, and hops while it works.
Another program keeps the dot. Adds the OpenAI and DeepSeek marks of
Simple Icons.
PR chips and the board's PR cell show the pull request Octicon of their
state (open, draft, merged, closed); issue chips show the issue Octicon
(open, closed). The icons are drawn in ink-48. The read of a number adds
isDraft. NOTICE credits Octicons (MIT).
@contursofran
contursofran marked this pull request as ready for review November 11, 2026 19:16
@contursofran
contursofran merged commit cb0fe79 into main Nov 11, 2026
3 checks passed
@contursofran
contursofran deleted the agent/696-diagrams-flow branch November 11, 2026 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant