fabro/test/docs/examples/solitaire/build-solitaire.dot
Bryan Helmkamp 69e82a22f0 Fix two validation warnings in docs workflows and treat warnings as failures
- nlspec-conformance: add retry_target="fix" to goal_gate node test_full
- solitaire: fix fallback_retry_target reference from impl_game_logic to impl_logic
- run_tests.sh: fail validate phase on warnings, not just errors

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 11:54:54 -05:00

170 lines
6.1 KiB
Text

digraph BuildSolitaire {
graph [
goal="Build a terminal-based solitaire (Klondike) game in Python",
rankdir=LR,
default_max_retry=3,
retry_target="impl_setup",
fallback_retry_target="impl_logic",
model_stylesheet="
* { llm_model: claude-sonnet; llm_provider: anthropic; }
.hard { llm_model: claude-opus; llm_provider: anthropic; }
.verify { llm_model: claude-haiku; llm_provider: anthropic; }
"
]
start [shape=Mdiamond, label="Start"]
exit [shape=Msquare, label="Exit"]
// Phase 0: Expand the goal into a detailed spec
expand_spec [
label="Expand Spec",
prompt="Expand the goal into a detailed spec covering:\n\
- Game rules and data structures (Card, Deck, Pile types)\n\
- Terminal rendering approach (curses library)\n\
- Input handling and move validation\n\
- Win/loss detection\n\
- UI layout\n\
- Test strategy\n\n\
Write the spec to spec.md."
]
// Phase 1: Project setup
impl_setup [
label="Setup Project",
prompt="Read spec.md. Create the Python project structure:\n\
pyproject.toml, src/ directory, tests/ directory, main.py stub.\n\
Run: python3 -m py_compile src/*.py"
]
verify_setup [label="Verify Setup", class="verify",
prompt="Verify project setup: check pyproject.toml exists,\n\
source directories exist, and files compile without errors.\n\
Run: python3 -m py_compile src/*.py"
]
check_setup [shape=diamond, label="Setup OK?"]
// Phase 2: Core data structures
impl_data [
label="Data Structures",
prompt="Read spec.md. Implement Card, Deck, and Pile types\n\
with unit tests. Run: python3 -m pytest tests/ -v"
]
verify_data [label="Verify Data", class="verify",
prompt="Verify data structures: build, run tests, check that\n\
Card, Deck, and Pile types are defined and basic operations work.\n\
Run: python3 -m pytest tests/ -v"
]
check_data [shape=diamond, label="Data OK?"]
// Phase 3: Game logic (hardest phase)
impl_logic [
label="Game Logic",
class="hard",
max_retries=2,
prompt="Read spec.md and the data structure files.\n\
Implement Klondike rules: initial deal, move validation,\n\
auto-complete detection, win condition, undo.\n\
Write tests for legal/illegal moves, win detection, edge cases.\n\
Run: python3 -m pytest tests/ -v"
]
verify_logic [label="Verify Logic", class="verify",
prompt="Verify game logic: run all tests, check move validation,\n\
win detection, and undo.\n\
Run: python3 -m pytest tests/ -v"
]
check_logic [shape=diamond, label="Logic OK?"]
// Phase 4: Terminal UI
impl_ui [
label="Terminal UI",
class="hard",
max_retries=2,
prompt="Read spec.md and game logic files.\n\
Implement terminal UI with curses: card rendering (ASCII art),\n\
board layout, keyboard input, move selection, help text.\n\
Run: python3 -m pytest tests/ && python3 -m py_compile src/*.py"
]
verify_ui [label="Verify UI", class="verify",
prompt="Verify terminal UI: build, run tests, check that\n\
renderer and input handler exist, game can be instantiated.\n\
Run: python3 -m pytest tests/"
]
check_ui [shape=diamond, label="UI OK?"]
// Phase 5: Integration
impl_integration [
label="Integrate",
prompt="Wire up main.py to start the game loop.\n\
Connect UI input to game logic. Add game over screen,\n\
help menu, and README with build/run instructions.\n\
Run: python3 -m pytest tests/"
]
verify_integration [label="Verify Integration", class="verify",
prompt="Verify integration: build, run all tests, check README\n\
exists, verify the game starts without errors.\n\
Run: python3 -m pytest tests/"
]
check_integration [shape=diamond, label="Integration OK?"]
// Phase 6: Final review (goal gate)
review [
label="Final Review",
class="hard",
goal_gate=true,
prompt="Read spec.md in full. Review the complete implementation:\n\
- All Klondike rules correctly implemented\n\
- Terminal UI works and is intuitive\n\
- Tests comprehensive and passing\n\
- README clear and accurate\n\n\
Run the full test suite. Write a review to review.md.\n\
Run: python3 -m pytest tests/ -v"
]
check_review [shape=diamond, label="Review OK?"]
// Wiring: linear phases with verify-gate loops
start -> expand_spec -> impl_setup -> verify_setup -> check_setup
check_setup -> impl_data [condition="outcome=success"]
check_setup -> impl_setup [condition="outcome=fail", label="Retry"]
check_setup -> impl_setup
impl_data -> verify_data -> check_data
check_data -> impl_logic [condition="outcome=success"]
check_data -> impl_data [condition="outcome=fail", label="Retry"]
check_data -> impl_data
impl_logic -> verify_logic -> check_logic
check_logic -> impl_ui [condition="outcome=success"]
check_logic -> impl_logic [condition="outcome=fail", label="Retry"]
check_logic -> impl_logic
impl_ui -> verify_ui -> check_ui
check_ui -> impl_integration [condition="outcome=success"]
check_ui -> impl_ui [condition="outcome=fail", label="Retry"]
check_ui -> impl_ui
impl_integration -> verify_integration -> check_integration
check_integration -> review [condition="outcome=success"]
check_integration -> impl_integration [condition="outcome=fail", label="Retry"]
check_integration -> impl_integration
review -> check_review
check_review -> exit [condition="outcome=success"]
check_review -> impl_ui [condition="outcome=fail", label="Fix"]
check_review -> impl_ui
}