mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-10-08 03:10:26 +00:00
parent
8345417db2
commit
03165a7e35
5 changed files with 162 additions and 8 deletions
|
|
@ -1,23 +1,27 @@
|
|||
{
|
||||
"timestamp": "2026-03-16T02:00:24.568155Z",
|
||||
"current_node": "preflight_lint",
|
||||
"timestamp": "2026-03-16T02:04:55.416450Z",
|
||||
"current_node": "implement",
|
||||
"completed_nodes": [
|
||||
"start",
|
||||
"toolchain",
|
||||
"preflight_compile",
|
||||
"preflight_lint"
|
||||
"preflight_lint",
|
||||
"implement"
|
||||
],
|
||||
"node_retries": {
|
||||
"preflight_lint": 1,
|
||||
"preflight_compile": 1,
|
||||
"start": 1,
|
||||
"implement": 1,
|
||||
"toolchain": 1
|
||||
},
|
||||
"context_values": {
|
||||
"internal.thread_id": "preflight_compile",
|
||||
"last_stage": "implement",
|
||||
"thread.preflight_lint.current_node": "implement",
|
||||
"internal.thread_id": "preflight_lint",
|
||||
"internal.retry_count.start": 1,
|
||||
"thread.toolchain.current_node": "preflight_compile",
|
||||
"current.preamble": "Goal: # Style SVG output from `fabro graph` and API\n\n## Context\n\nSVGs from `fabro graph` use raw Graphviz defaults (black strokes, white bg, Times-serif). The docs SVGs look much better: teal nodes, gray edges, Helvetica font, transparent bg, dark mode CSS. The goal is to make `fabro graph` and the API `get_graph` endpoint produce the same styled output without building a layout engine.\n\n## Approach: DOT defaults + SVG post-processing\n\n### Step 1: `inject_dot_style_defaults(source: &str) -> String` in `graph.rs`\n\nFind first `{`, insert after it:\n```dot\n bgcolor=\"transparent\"\n node [color=\"#357f9e\", fontname=\"Helvetica\", fontsize=12, fontcolor=\"#1a1a1a\"]\n edge [color=\"#666666\", fontname=\"Helvetica\", fontsize=10, fontcolor=\"#666666\"]\n```\nThese are DOT defaults — per-node/edge attrs override them. Applies to both SVG and PNG.\n\n### Step 2: `postprocess_svg(raw: Vec<u8>) -> Vec<u8>` in `graph.rs`\n\nSVG-only. Two string operations:\n1. Remove line containing `<polygon fill=\"white\" stroke=\"none\"` (the white background)\n2. Insert dark mode `<style>` block after the `<svg ...>` closing `>`\n\n### Step 3: Wire into `render_dot()` in `graph.rs`\n\n- Call `inject_dot_style_defaults` on source before piping to `dot`\n- Call `postprocess_svg` on output when format is SVG\n\n### Step 4: Wire into `get_graph()` in `server.rs` (line ~1440, ~1467, ~1472)\n\n- Wrap `dot_source` with `inject_dot_style_defaults`\n- Wrap `output.stdout` with `postprocess_svg`\n\n### Step 5: Wire into `get_run_graph()` in `demo/mod.rs` (line ~227, ~248, ~252)\n\nSame two wraps.\n\n### Step 6: Tests in `graph.rs`\n\n- `inject_dot_style_defaults` inserts expected attrs\n- `inject_dot_style_defaults` returns unchanged if no `{`\n- `postprocess_svg` removes white background\n- `postprocess_svg` injects dark mode style block\n- Update `graph_valid_workflow_svg` to assert styled output\n\n## Files to modify\n\n1. `lib/crates/fabro-workflows/src/cli/graph.rs` — add 2 pub fns, modify `render_dot`, add tests\n2. `lib/crates/fabro-api/src/server.rs` — 2-line change in `get_graph`\n3. `lib/crates/fabro-api/src/demo/mod.rs` — 2-line change in `get_run_graph`\n\n## Verification\n\n1. `cargo test -p fabro-workflows -- graph` — unit tests pass\n2. `cargo test -p fabro-api` — API tests pass\n3. `cargo clippy --workspace -- -D warnings` — no warnings\n4. `fabro graph fabro/workflows/implement/workflow.fabro -o /tmp/test.svg` — visually inspect:\n - Teal node strokes, gray edges, Helvetica font\n - No white background\n - Dark mode `<style>` block present\n - Compare with `docs/images/tutorial-plan-implement.svg`\n\n\n## Completed stages\n- **toolchain**: success\n - Script: `command -v cargo >/dev/null || { curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && sudo ln -sf $HOME/.cargo/bin/* /usr/local/bin/; }; cargo --version 2>&1`\n - Stdout:\n ```\n cargo 1.94.0 (85eff7c80 2026-01-15)\n ```\n - Stderr: (empty)\n- **preflight_compile**: success\n - Script: `cargo check -q --workspace 2>&1`\n - Stdout: (empty)\n - Stderr: (empty)\n",
|
||||
"current.preamble": "Goal: # Style SVG output from `fabro graph` and API\n\n## Context\n\nSVGs from `fabro graph` use raw Graphviz defaults (black strokes, white bg, Times-serif). The docs SVGs look much better: teal nodes, gray edges, Helvetica font, transparent bg, dark mode CSS. The goal is to make `fabro graph` and the API `get_graph` endpoint produce the same styled output without building a layout engine.\n\n## Approach: DOT defaults + SVG post-processing\n\n### Step 1: `inject_dot_style_defaults(source: &str) -> String` in `graph.rs`\n\nFind first `{`, insert after it:\n```dot\n bgcolor=\"transparent\"\n node [color=\"#357f9e\", fontname=\"Helvetica\", fontsize=12, fontcolor=\"#1a1a1a\"]\n edge [color=\"#666666\", fontname=\"Helvetica\", fontsize=10, fontcolor=\"#666666\"]\n```\nThese are DOT defaults — per-node/edge attrs override them. Applies to both SVG and PNG.\n\n### Step 2: `postprocess_svg(raw: Vec<u8>) -> Vec<u8>` in `graph.rs`\n\nSVG-only. Two string operations:\n1. Remove line containing `<polygon fill=\"white\" stroke=\"none\"` (the white background)\n2. Insert dark mode `<style>` block after the `<svg ...>` closing `>`\n\n### Step 3: Wire into `render_dot()` in `graph.rs`\n\n- Call `inject_dot_style_defaults` on source before piping to `dot`\n- Call `postprocess_svg` on output when format is SVG\n\n### Step 4: Wire into `get_graph()` in `server.rs` (line ~1440, ~1467, ~1472)\n\n- Wrap `dot_source` with `inject_dot_style_defaults`\n- Wrap `output.stdout` with `postprocess_svg`\n\n### Step 5: Wire into `get_run_graph()` in `demo/mod.rs` (line ~227, ~248, ~252)\n\nSame two wraps.\n\n### Step 6: Tests in `graph.rs`\n\n- `inject_dot_style_defaults` inserts expected attrs\n- `inject_dot_style_defaults` returns unchanged if no `{`\n- `postprocess_svg` removes white background\n- `postprocess_svg` injects dark mode style block\n- Update `graph_valid_workflow_svg` to assert styled output\n\n## Files to modify\n\n1. `lib/crates/fabro-workflows/src/cli/graph.rs` — add 2 pub fns, modify `render_dot`, add tests\n2. `lib/crates/fabro-api/src/server.rs` — 2-line change in `get_graph`\n3. `lib/crates/fabro-api/src/demo/mod.rs` — 2-line change in `get_run_graph`\n\n## Verification\n\n1. `cargo test -p fabro-workflows -- graph` — unit tests pass\n2. `cargo test -p fabro-api` — API tests pass\n3. `cargo clippy --workspace -- -D warnings` — no warnings\n4. `fabro graph fabro/workflows/implement/workflow.fabro -o /tmp/test.svg` — visually inspect:\n - Teal node strokes, gray edges, Helvetica font\n - No white background\n - Dark mode `<style>` block present\n - Compare with `docs/images/tutorial-plan-implement.svg`\n\n\n## Completed stages\n- **toolchain**: success\n - Script: `command -v cargo >/dev/null || { curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && sudo ln -sf $HOME/.cargo/bin/* /usr/local/bin/; }; cargo --version 2>&1`\n - Stdout:\n ```\n cargo 1.94.0 (85eff7c80 2026-01-15)\n ```\n - Stderr: (empty)\n- **preflight_compile**: success\n - Script: `cargo check -q --workspace 2>&1`\n - Stdout: (empty)\n - Stderr: (empty)\n- **preflight_lint**: success\n - Script: `cargo clippy -q --workspace -- -D warnings 2>&1`\n - Stdout: (empty)\n - Stderr: (empty)\n",
|
||||
"internal.run_id": "01KKT5VWYY8VQFETNRC7RTYKDW",
|
||||
"failure_class": "",
|
||||
"outcome": "success",
|
||||
|
|
@ -25,7 +29,7 @@
|
|||
"internal.retry_count.preflight_lint": 1,
|
||||
"internal.node_visit_count": 1,
|
||||
"internal.fidelity": "compact",
|
||||
"current_node": "preflight_lint",
|
||||
"current_node": "implement",
|
||||
"graph.rankdir": "LR",
|
||||
"internal.retry_count.toolchain": 1,
|
||||
"command.output": "",
|
||||
|
|
@ -34,7 +38,10 @@
|
|||
"thread.preflight_compile.current_node": "preflight_lint",
|
||||
"graph.goal": "# Style SVG output from `fabro graph` and API\n\n## Context\n\nSVGs from `fabro graph` use raw Graphviz defaults (black strokes, white bg, Times-serif). The docs SVGs look much better: teal nodes, gray edges, Helvetica font, transparent bg, dark mode CSS. The goal is to make `fabro graph` and the API `get_graph` endpoint produce the same styled output without building a layout engine.\n\n## Approach: DOT defaults + SVG post-processing\n\n### Step 1: `inject_dot_style_defaults(source: &str) -> String` in `graph.rs`\n\nFind first `{`, insert after it:\n```dot\n bgcolor=\"transparent\"\n node [color=\"#357f9e\", fontname=\"Helvetica\", fontsize=12, fontcolor=\"#1a1a1a\"]\n edge [color=\"#666666\", fontname=\"Helvetica\", fontsize=10, fontcolor=\"#666666\"]\n```\nThese are DOT defaults — per-node/edge attrs override them. Applies to both SVG and PNG.\n\n### Step 2: `postprocess_svg(raw: Vec<u8>) -> Vec<u8>` in `graph.rs`\n\nSVG-only. Two string operations:\n1. Remove line containing `<polygon fill=\"white\" stroke=\"none\"` (the white background)\n2. Insert dark mode `<style>` block after the `<svg ...>` closing `>`\n\n### Step 3: Wire into `render_dot()` in `graph.rs`\n\n- Call `inject_dot_style_defaults` on source before piping to `dot`\n- Call `postprocess_svg` on output when format is SVG\n\n### Step 4: Wire into `get_graph()` in `server.rs` (line ~1440, ~1467, ~1472)\n\n- Wrap `dot_source` with `inject_dot_style_defaults`\n- Wrap `output.stdout` with `postprocess_svg`\n\n### Step 5: Wire into `get_run_graph()` in `demo/mod.rs` (line ~227, ~248, ~252)\n\nSame two wraps.\n\n### Step 6: Tests in `graph.rs`\n\n- `inject_dot_style_defaults` inserts expected attrs\n- `inject_dot_style_defaults` returns unchanged if no `{`\n- `postprocess_svg` removes white background\n- `postprocess_svg` injects dark mode style block\n- Update `graph_valid_workflow_svg` to assert styled output\n\n## Files to modify\n\n1. `lib/crates/fabro-workflows/src/cli/graph.rs` — add 2 pub fns, modify `render_dot`, add tests\n2. `lib/crates/fabro-api/src/server.rs` — 2-line change in `get_graph`\n3. `lib/crates/fabro-api/src/demo/mod.rs` — 2-line change in `get_run_graph`\n\n## Verification\n\n1. `cargo test -p fabro-workflows -- graph` — unit tests pass\n2. `cargo test -p fabro-api` — API tests pass\n3. `cargo clippy --workspace -- -D warnings` — no warnings\n4. `fabro graph fabro/workflows/implement/workflow.fabro -o /tmp/test.svg` — visually inspect:\n - Teal node strokes, gray edges, Helvetica font\n - No white background\n - Dark mode `<style>` block present\n - Compare with `docs/images/tutorial-plan-implement.svg`\n",
|
||||
"failure_signature": "",
|
||||
"thread.start.current_node": "toolchain"
|
||||
"thread.start.current_node": "toolchain",
|
||||
"internal.retry_count.implement": 1,
|
||||
"last_response": "Everything looks good. Let me provide a summary of all changes made:\n\n## Summary\n\n### Changes made across 3 files:\n\n**1. `lib/crates/fabro-workflows/src/cli/graph.rs`** — Core implementation + tests",
|
||||
"response.implement": "Everything looks good. Let me provide a summary of all changes made:\n\n## Summary\n\n### Changes made across 3 files:\n\n**1. `lib/crates/fabro-workflows/src/cli/graph.rs`** — Core implementation + tests\n\n- Added `DARK_MODE_STYLE` constant — CSS `<style>` block with `@media (prefers-color-scheme: dark)` that adjusts text fill, stroke colors, and polygon fills for dark mode viewing\n- Added `pub fn inject_dot_style_defaults(source: &str) -> String` — Inserts DOT graph-level defaults (`bgcolor=\"transparent\"`, teal node styling with `#357f9e`, gray edge styling with `#666666`, Helvetica font) after the first `{` in DOT source. Returns unchanged if no `{` found.\n- Added `pub fn postprocess_svg(raw: Vec<u8>) -> Vec<u8>` — Removes the white background `<polygon>` line and inserts the dark mode `<style>` block after the opening `<svg ...>` tag\n- Modified `render_dot()` — Calls `inject_dot_style_defaults` on source before piping to `dot`, and calls `postprocess_svg` on output when format is SVG\n- Added 4 new unit tests: `inject_dot_style_defaults_inserts_attrs`, `inject_dot_style_defaults_no_brace`, `postprocess_svg_removes_white_bg`, `postprocess_svg_injects_dark_mode`\n- Updated `graph_valid_workflow_svg` test to assert dark mode style block is present and white background is removed\n\n**2. `lib/crates/fabro-api/src/server.rs`** — API `get_graph` endpoint\n\n- Wrapped `dot_source` with `inject_dot_style_defaults` before piping to `dot`\n- Wrapped `output.stdout` with `postprocess_svg` in the success response\n\n**3. `lib/crates/fabro-api/src/demo/mod.rs`** — Demo `get_run_graph` endpoint\n\n- Same two wraps: `inject_dot_style_defaults` on the DOT source, `postprocess_svg` on the output\n\n### Verification results:\n- ✅ `cargo test -p fabro-workflows -- graph` — 108 tests pass (including 4 new + 1 updated)\n- ✅ `cargo test -p fabro-api` — 76 tests pass (62 unit + 14 integration)\n- ✅ `cargo clippy --workspace -- -D warnings` — zero warnings"
|
||||
},
|
||||
"logs": [],
|
||||
"node_outcomes": {
|
||||
|
|
@ -56,6 +63,30 @@
|
|||
"notes": "Script completed: cargo clippy -q --workspace -- -D warnings 2>&1",
|
||||
"duration_ms": 16369
|
||||
},
|
||||
"implement": {
|
||||
"status": "success",
|
||||
"context_updates": {
|
||||
"response.implement": "Everything looks good. Let me provide a summary of all changes made:\n\n## Summary\n\n### Changes made across 3 files:\n\n**1. `lib/crates/fabro-workflows/src/cli/graph.rs`** — Core implementation + tests\n\n- Added `DARK_MODE_STYLE` constant — CSS `<style>` block with `@media (prefers-color-scheme: dark)` that adjusts text fill, stroke colors, and polygon fills for dark mode viewing\n- Added `pub fn inject_dot_style_defaults(source: &str) -> String` — Inserts DOT graph-level defaults (`bgcolor=\"transparent\"`, teal node styling with `#357f9e`, gray edge styling with `#666666`, Helvetica font) after the first `{` in DOT source. Returns unchanged if no `{` found.\n- Added `pub fn postprocess_svg(raw: Vec<u8>) -> Vec<u8>` — Removes the white background `<polygon>` line and inserts the dark mode `<style>` block after the opening `<svg ...>` tag\n- Modified `render_dot()` — Calls `inject_dot_style_defaults` on source before piping to `dot`, and calls `postprocess_svg` on output when format is SVG\n- Added 4 new unit tests: `inject_dot_style_defaults_inserts_attrs`, `inject_dot_style_defaults_no_brace`, `postprocess_svg_removes_white_bg`, `postprocess_svg_injects_dark_mode`\n- Updated `graph_valid_workflow_svg` test to assert dark mode style block is present and white background is removed\n\n**2. `lib/crates/fabro-api/src/server.rs`** — API `get_graph` endpoint\n\n- Wrapped `dot_source` with `inject_dot_style_defaults` before piping to `dot`\n- Wrapped `output.stdout` with `postprocess_svg` in the success response\n\n**3. `lib/crates/fabro-api/src/demo/mod.rs`** — Demo `get_run_graph` endpoint\n\n- Same two wraps: `inject_dot_style_defaults` on the DOT source, `postprocess_svg` on the output\n\n### Verification results:\n- ✅ `cargo test -p fabro-workflows -- graph` — 108 tests pass (including 4 new + 1 updated)\n- ✅ `cargo test -p fabro-api` — 76 tests pass (62 unit + 14 integration)\n- ✅ `cargo clippy --workspace -- -D warnings` — zero warnings",
|
||||
"last_response": "Everything looks good. Let me provide a summary of all changes made:\n\n## Summary\n\n### Changes made across 3 files:\n\n**1. `lib/crates/fabro-workflows/src/cli/graph.rs`** — Core implementation + tests",
|
||||
"last_stage": "implement"
|
||||
},
|
||||
"notes": "Stage completed: implement",
|
||||
"usage": {
|
||||
"model": "claude-opus-4-6",
|
||||
"input_tokens": 37563,
|
||||
"output_tokens": 7761,
|
||||
"cache_read_tokens": 383259,
|
||||
"cache_write_tokens": 37057,
|
||||
"reasoning_tokens": 47,
|
||||
"cost": 1.1455199999999999
|
||||
},
|
||||
"files_touched": [
|
||||
"/home/daytona/workspace/lib/crates/fabro-api/src/demo/mod.rs",
|
||||
"/home/daytona/workspace/lib/crates/fabro-api/src/server.rs",
|
||||
"/home/daytona/workspace/lib/crates/fabro-workflows/src/cli/graph.rs"
|
||||
],
|
||||
"duration_ms": 268508
|
||||
},
|
||||
"preflight_compile": {
|
||||
"status": "success",
|
||||
"context_updates": {
|
||||
|
|
@ -70,9 +101,10 @@
|
|||
"duration_ms": 0
|
||||
}
|
||||
},
|
||||
"next_node_id": "implement",
|
||||
"next_node_id": "simplify_opus",
|
||||
"node_visits": {
|
||||
"preflight_lint": 1,
|
||||
"implement": 1,
|
||||
"start": 1,
|
||||
"toolchain": 1,
|
||||
"preflight_compile": 1
|
||||
|
|
|
|||
83
nodes/implement/prompt.md
Normal file
83
nodes/implement/prompt.md
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
Goal: # Style SVG output from `fabro graph` and API
|
||||
|
||||
## Context
|
||||
|
||||
SVGs from `fabro graph` use raw Graphviz defaults (black strokes, white bg, Times-serif). The docs SVGs look much better: teal nodes, gray edges, Helvetica font, transparent bg, dark mode CSS. The goal is to make `fabro graph` and the API `get_graph` endpoint produce the same styled output without building a layout engine.
|
||||
|
||||
## Approach: DOT defaults + SVG post-processing
|
||||
|
||||
### Step 1: `inject_dot_style_defaults(source: &str) -> String` in `graph.rs`
|
||||
|
||||
Find first `{`, insert after it:
|
||||
```dot
|
||||
bgcolor="transparent"
|
||||
node [color="#357f9e", fontname="Helvetica", fontsize=12, fontcolor="#1a1a1a"]
|
||||
edge [color="#666666", fontname="Helvetica", fontsize=10, fontcolor="#666666"]
|
||||
```
|
||||
These are DOT defaults — per-node/edge attrs override them. Applies to both SVG and PNG.
|
||||
|
||||
### Step 2: `postprocess_svg(raw: Vec<u8>) -> Vec<u8>` in `graph.rs`
|
||||
|
||||
SVG-only. Two string operations:
|
||||
1. Remove line containing `<polygon fill="white" stroke="none"` (the white background)
|
||||
2. Insert dark mode `<style>` block after the `<svg ...>` closing `>`
|
||||
|
||||
### Step 3: Wire into `render_dot()` in `graph.rs`
|
||||
|
||||
- Call `inject_dot_style_defaults` on source before piping to `dot`
|
||||
- Call `postprocess_svg` on output when format is SVG
|
||||
|
||||
### Step 4: Wire into `get_graph()` in `server.rs` (line ~1440, ~1467, ~1472)
|
||||
|
||||
- Wrap `dot_source` with `inject_dot_style_defaults`
|
||||
- Wrap `output.stdout` with `postprocess_svg`
|
||||
|
||||
### Step 5: Wire into `get_run_graph()` in `demo/mod.rs` (line ~227, ~248, ~252)
|
||||
|
||||
Same two wraps.
|
||||
|
||||
### Step 6: Tests in `graph.rs`
|
||||
|
||||
- `inject_dot_style_defaults` inserts expected attrs
|
||||
- `inject_dot_style_defaults` returns unchanged if no `{`
|
||||
- `postprocess_svg` removes white background
|
||||
- `postprocess_svg` injects dark mode style block
|
||||
- Update `graph_valid_workflow_svg` to assert styled output
|
||||
|
||||
## Files to modify
|
||||
|
||||
1. `lib/crates/fabro-workflows/src/cli/graph.rs` — add 2 pub fns, modify `render_dot`, add tests
|
||||
2. `lib/crates/fabro-api/src/server.rs` — 2-line change in `get_graph`
|
||||
3. `lib/crates/fabro-api/src/demo/mod.rs` — 2-line change in `get_run_graph`
|
||||
|
||||
## Verification
|
||||
|
||||
1. `cargo test -p fabro-workflows -- graph` — unit tests pass
|
||||
2. `cargo test -p fabro-api` — API tests pass
|
||||
3. `cargo clippy --workspace -- -D warnings` — no warnings
|
||||
4. `fabro graph fabro/workflows/implement/workflow.fabro -o /tmp/test.svg` — visually inspect:
|
||||
- Teal node strokes, gray edges, Helvetica font
|
||||
- No white background
|
||||
- Dark mode `<style>` block present
|
||||
- Compare with `docs/images/tutorial-plan-implement.svg`
|
||||
|
||||
|
||||
## Completed stages
|
||||
- **toolchain**: success
|
||||
- Script: `command -v cargo >/dev/null || { curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && sudo ln -sf $HOME/.cargo/bin/* /usr/local/bin/; }; cargo --version 2>&1`
|
||||
- Stdout:
|
||||
```
|
||||
cargo 1.94.0 (85eff7c80 2026-01-15)
|
||||
```
|
||||
- Stderr: (empty)
|
||||
- **preflight_compile**: success
|
||||
- Script: `cargo check -q --workspace 2>&1`
|
||||
- Stdout: (empty)
|
||||
- Stderr: (empty)
|
||||
- **preflight_lint**: success
|
||||
- Script: `cargo clippy -q --workspace -- -D warnings 2>&1`
|
||||
- Stdout: (empty)
|
||||
- Stderr: (empty)
|
||||
|
||||
|
||||
Read the plan file referenced in the goal and implement every step. Make all the code changes described in the plan. Use red/green TDD.
|
||||
5
nodes/implement/provider_used.json
Normal file
5
nodes/implement/provider_used.json
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"mode": "agent",
|
||||
"provider": "anthropic",
|
||||
"model": "claude-opus-4-6"
|
||||
}
|
||||
28
nodes/implement/response.md
Normal file
28
nodes/implement/response.md
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
Everything looks good. Let me provide a summary of all changes made:
|
||||
|
||||
## Summary
|
||||
|
||||
### Changes made across 3 files:
|
||||
|
||||
**1. `lib/crates/fabro-workflows/src/cli/graph.rs`** — Core implementation + tests
|
||||
|
||||
- Added `DARK_MODE_STYLE` constant — CSS `<style>` block with `@media (prefers-color-scheme: dark)` that adjusts text fill, stroke colors, and polygon fills for dark mode viewing
|
||||
- Added `pub fn inject_dot_style_defaults(source: &str) -> String` — Inserts DOT graph-level defaults (`bgcolor="transparent"`, teal node styling with `#357f9e`, gray edge styling with `#666666`, Helvetica font) after the first `{` in DOT source. Returns unchanged if no `{` found.
|
||||
- Added `pub fn postprocess_svg(raw: Vec<u8>) -> Vec<u8>` — Removes the white background `<polygon>` line and inserts the dark mode `<style>` block after the opening `<svg ...>` tag
|
||||
- Modified `render_dot()` — Calls `inject_dot_style_defaults` on source before piping to `dot`, and calls `postprocess_svg` on output when format is SVG
|
||||
- Added 4 new unit tests: `inject_dot_style_defaults_inserts_attrs`, `inject_dot_style_defaults_no_brace`, `postprocess_svg_removes_white_bg`, `postprocess_svg_injects_dark_mode`
|
||||
- Updated `graph_valid_workflow_svg` test to assert dark mode style block is present and white background is removed
|
||||
|
||||
**2. `lib/crates/fabro-api/src/server.rs`** — API `get_graph` endpoint
|
||||
|
||||
- Wrapped `dot_source` with `inject_dot_style_defaults` before piping to `dot`
|
||||
- Wrapped `output.stdout` with `postprocess_svg` in the success response
|
||||
|
||||
**3. `lib/crates/fabro-api/src/demo/mod.rs`** — Demo `get_run_graph` endpoint
|
||||
|
||||
- Same two wraps: `inject_dot_style_defaults` on the DOT source, `postprocess_svg` on the output
|
||||
|
||||
### Verification results:
|
||||
- ✅ `cargo test -p fabro-workflows -- graph` — 108 tests pass (including 4 new + 1 updated)
|
||||
- ✅ `cargo test -p fabro-api` — 76 tests pass (62 unit + 14 integration)
|
||||
- ✅ `cargo clippy --workspace -- -D warnings` — zero warnings
|
||||
6
nodes/implement/status.json
Normal file
6
nodes/implement/status.json
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"status": "success",
|
||||
"notes": "Stage completed: implement",
|
||||
"failure_reason": null,
|
||||
"timestamp": "2026-03-16T02:04:55.415534+00:00"
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue