stream_weaver 0.3.0
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.
- checksums.yaml +7 -0
- data/.beads/.gitignore +77 -0
- data/.beads/README.md +81 -0
- data/.beads/config.yaml +54 -0
- data/.beads/metadata.json +7 -0
- data/.rspec +3 -0
- data/AGENTS.md +91 -0
- data/CHANGELOG.md +294 -0
- data/CLAUDE.md +67 -0
- data/LICENSE.txt +21 -0
- data/README.md +565 -0
- data/Rakefile +13 -0
- data/assets/streamweaver-hero.jpg +0 -0
- data/bench/baselines/ledger.rb +58 -0
- data/bench/baselines/warroom.rb +51 -0
- data/bench/fixtures/ledger.rb +76 -0
- data/bench/fixtures/warroom.rb +60 -0
- data/bench/results/6daf8b8.md +102 -0
- data/bench/results/c8d749b.md +102 -0
- data/bench/results/eb06ab9.md +102 -0
- data/bench/run.rb +151 -0
- data/bench/support.rb +84 -0
- data/copy_this/dto_run_sample_run_7631.html +220 -0
- data/docs/SERVICE_MODE.md +302 -0
- data/docs/architecture/how_streamweaver_works.md +772 -0
- data/docs/blog/2026-01-16-streamweaver-introduction.md +515 -0
- data/docs/bug-2026-08-31-canvas-bridge-socket-collision.md +83 -0
- data/docs/canvas-ipc-session-summary.md +127 -0
- data/docs/canvas-panel-workflow.md +172 -0
- data/docs/canvas-read.md +147 -0
- data/docs/canvas-roadmap.md +275 -0
- data/docs/case-studies/2026-09-03-didx-canvas-read-shelf.md +147 -0
- data/docs/claude-code-companion-skill-spec.md +567 -0
- data/docs/components_reference.md +1223 -0
- data/docs/crud-patterns.md +265 -0
- data/docs/endpoints.md +122 -0
- data/docs/for_llms.md +1 -0
- data/docs/form-patterns.md +165 -0
- data/docs/frontend-only.md +169 -0
- data/docs/html-artifact-audit.md +238 -0
- data/docs/ideas/2025-01-01-as-a-service.md +203 -0
- data/docs/ideas/2026-01-16-charm-tui-exploration.md +542 -0
- data/docs/ideas/2026-08-27-static-doc-shelf-export.md +153 -0
- data/docs/ideas/dhh-review-future-refactors.md +142 -0
- data/docs/opal-jamstack.md +47 -0
- data/docs/opal-npm-direction.md +184 -0
- data/docs/opal-spike-findings.md +194 -0
- data/docs/plans/2025-12-16-form-blocks-design.md +124 -0
- data/docs/plans/2025-12-30-examples-browser-design.md +152 -0
- data/docs/plans/2026-01-02-charts-design.md +288 -0
- data/docs/plans/2026-01-10-canvas-ipc-design.md +247 -0
- data/docs/plans/2026-01-19-cabinet-control-components.md +176 -0
- data/docs/plans/2026-01-26-gem-release-and-panel.md +140 -0
- data/docs/plans/canvas-claude-project-design.md +238 -0
- data/docs/plans/canvas-doc-location-and-discovery.md +32 -0
- data/docs/plans/org-doc-preview-surfaces.md +293 -0
- data/docs/plans/shadcn-polish-plan.md +417 -0
- data/docs/porting-artifacts.md +252 -0
- data/docs/reference/agent-skills-comparison.md +369 -0
- data/docs/reference/travel-state-prd.artifact.html +780 -0
- data/docs/research/2026-08-17-hotwire-alike-landscape.md +268 -0
- data/docs/research/2026-08-17-hotwire-concept-map.md +404 -0
- data/docs/research/2026-08-22-lazy-fragments-trigger-decision.md +246 -0
- data/docs/research/2026-08-22-learnhotwire-syllabus-coverage.md +239 -0
- data/docs/research/frontend-only-matrix.md +278 -0
- data/docs/research/streamweaver-way-spike-findings.md +529 -0
- data/docs/resource-dsl.md +342 -0
- data/docs/routing.md +302 -0
- data/docs/ruby-ui-comparison.md +319 -0
- data/docs/shared-dsl-fragments.md +356 -0
- data/docs/streamweaver-for-ai-agents.md +401 -0
- data/docs/streamweaver-frontend-vision.md +123 -0
- data/docs/streamweaver_canvas/glimmer_initial_final_layer.rb +77 -0
- data/docs/streamweaver_canvas/save_example.rb +9 -0
- data/docs/templates.md +213 -0
- data/docs/testing.md +155 -0
- data/docs/theming-hooks.md +281 -0
- data/docs/tutorials/the-streamweaver-way.md +882 -0
- data/docs/university/capability-inventory.md +137 -0
- data/docs/university/dependency-survey.md +114 -0
- data/docs/university/design-spec.md +217 -0
- data/docs/university/mockups/code-block-doc-theme-dark.png +0 -0
- data/docs/university/mockups/code-block-doc-theme-light.png +0 -0
- data/docs/university/mockups/course-list-dark.png +0 -0
- data/docs/university/mockups/course-list-light.png +0 -0
- data/docs/university/mockups/course_canvas_mockup.rb +741 -0
- data/docs/university/mockups/step-screen-dark.png +0 -0
- data/docs/university/mockups/step-screen-light.png +0 -0
- data/docs/university/roadmap.md +72 -0
- data/docs/university/send-to-coworker.md +77 -0
- data/docs/university/worker-session-mining.md +109 -0
- data/docs/visual/browser-rendering-spike.md +173 -0
- data/docs/visual/builder-visual-plan-analysis.md +378 -0
- data/docs/visual/sw-plan-format-exploration.md +511 -0
- data/docs/visual/sw-plan-rendering-deep-dive.md +453 -0
- data/docs/visual-skills/PROGRESS.md +60 -0
- data/docs/visual-skills/SESSION-CONTEXT.md +207 -0
- data/docs/visual-skills/analysis/components.md +317 -0
- data/docs/visual-skills/analysis/overlap.md +360 -0
- data/docs/visual-skills/analysis/pi-design-deck.md +1102 -0
- data/docs/visual-skills/analysis/streamweaver-inventory.md +93 -0
- data/docs/visual-skills/analysis/unified-specs.feature +1003 -0
- data/docs/visual-skills/analysis/visual-explainer.md +964 -0
- data/docs/visual-skills/blog/blog-series-outline.md +39 -0
- data/docs/visual-skills/blog/token-efficiency.md +73 -0
- data/docs/visual-skills/design/architecture.md +1725 -0
- data/docs/visual-skills/design/codex-review.md +340 -0
- data/docs/visual-skills/design/dhh-review.md +209 -0
- data/docs/visual-skills/design/evolution.md +100 -0
- data/docs/visual-skills/design/gemini-review.md +55 -0
- data/docs/visual-skills/design/review-synthesis.md +149 -0
- data/docs/visual-skills/implementation/STATE.md +22 -0
- data/docs/visual-skills/implementation/plan.md +347 -0
- data/docs/visual-skills/implementation/spike-findings.md +237 -0
- data/docs/visual-skills/implementation/tasks.md +702 -0
- data/docs/visual-skills/lessons-learned/process.md +145 -0
- data/examples/README.md +96 -0
- data/examples/advanced/all_components.rb +177 -0
- data/examples/advanced/examples_browser.rb +394 -0
- data/examples/advanced/teachables_browser.rb +261 -0
- data/examples/advanced/theme_tweaker.rb +366 -0
- data/examples/advanced/tutorial.rb +1528 -0
- data/examples/agentic/agentic_form.rb +30 -0
- data/examples/agentic/agentic_form_autoclose.rb +30 -0
- data/examples/agentic/cultivation_tracker.rb +69 -0
- data/examples/basic/hello_world.rb +22 -0
- data/examples/basic/opal_tabs_table.rb +44 -0
- data/examples/basic/todo_list.rb +39 -0
- data/examples/button_loading_test.rb +36 -0
- data/examples/canvas/mermaid_canvas_demo.sh +151 -0
- data/examples/charts/bar_chart_demo.rb +57 -0
- data/examples/charts/line_chart_demo.rb +73 -0
- data/examples/charts/pie_area_demo.rb +87 -0
- data/examples/charts/stacked_bar_chart_demo.rb +69 -0
- data/examples/claude_code/README.md +85 -0
- data/examples/claude_code/codebreaker/.claude/commands/infiltrate.md +632 -0
- data/examples/claude_code/codebreaker/.claude/settings.json +11 -0
- data/examples/claude_code/codebreaker/.claude/settings.local.json +17 -0
- data/examples/claude_code/codebreaker/.claude/skills/infiltrate.md +0 -0
- data/examples/claude_code/codebreaker/README.md +213 -0
- data/examples/claude_code/tutorial/.claude/commands/learn.md +453 -0
- data/examples/claude_code/tutorial/README.md +102 -0
- data/examples/claude_code/verification_flow/.claude/commands/verify.md +171 -0
- data/examples/claude_code/verification_flow/README.md +126 -0
- data/examples/components/annotated_code_demo.rb +54 -0
- data/examples/components/callout_demo.rb +33 -0
- data/examples/components/checkbox_group_demo.rb +46 -0
- data/examples/components/design_review.css +468 -0
- data/examples/components/design_review_demo.rb +44 -0
- data/examples/components/design_review_dsl.rb +300 -0
- data/examples/components/diff_block_demo.rb +112 -0
- data/examples/components/events_demo.rb +184 -0
- data/examples/components/form_demo.rb +62 -0
- data/examples/components/lesson_demo.rb +53 -0
- data/examples/components/markdown_demo.rb +110 -0
- data/examples/components/mermaid_demo.rb +166 -0
- data/examples/components/pareto_set.rb +64 -0
- data/examples/components/prd_demo.rb +21 -0
- data/examples/components/prd_dsl.rb +385 -0
- data/examples/components/quiz_demo.rb +47 -0
- data/examples/components/run_viewer_demo.rb +100 -0
- data/examples/components/score_and_collapsible_demo.rb +82 -0
- data/examples/components/select_stale_value_smoke_test.rb +39 -0
- data/examples/components/table_demo.rb +247 -0
- data/examples/components/timer_with_state_demo.rb +58 -0
- data/examples/components/todo_due_dates.rb +63 -0
- data/examples/components/uat_gaps_demo.rb +112 -0
- data/examples/dashboard/feed_simulator.rb +60 -0
- data/examples/dashboard/live_dashboard.rb +80 -0
- data/examples/dashboard_components.rb +108 -0
- data/examples/deferred_fragments_demo.rb +62 -0
- data/examples/generate_more_spike/README.md +63 -0
- data/examples/generate_more_spike/app.rb +441 -0
- data/examples/git_health.sh +401 -0
- data/examples/layout/layout_components_demo.rb +174 -0
- data/examples/layout/modal_demo.rb +215 -0
- data/examples/layout/navigation_demo.rb +227 -0
- data/examples/layout/route_tabs_demo.rb +52 -0
- data/examples/layout/routing_demo.rb +52 -0
- data/examples/layout/scroll_box_demo.rb +154 -0
- data/examples/lazy_fragments_demo.rb +151 -0
- data/examples/my_todos/README.md +29 -0
- data/examples/my_todos/my_todos.rb +312 -0
- data/examples/my_todos/store.rb +86 -0
- data/examples/opal/reactive_demo.rb +62 -0
- data/examples/opal/scenarios/s1_counter.rb +15 -0
- data/examples/opal/scenarios/s2_search_filter.rb +17 -0
- data/examples/opal/scenarios/s3_sibling_tabs.rb +25 -0
- data/examples/opal/scenarios/s4_shopping_cart.rb +34 -0
- data/examples/opal/scenarios/s5_watch.rb +39 -0
- data/examples/opal/scenarios/s6_on_start.rb +20 -0
- data/examples/opal/scenarios/s7_wizard.rb +33 -0
- data/examples/opal/scenarios/s8_loan_calculator.rb +21 -0
- data/examples/opal/scenarios/s9_dashboard.rb +27 -0
- data/examples/operations_dashboard_demo.rb +167 -0
- data/examples/panel_demo.sh +447 -0
- data/examples/parity/assets/tyrion_slice.css +86 -0
- data/examples/parity/rivet_people_slice.rb +182 -0
- data/examples/parity/tyrion_components.css +777 -0
- data/examples/parity/tyrion_warroom_components.rb +414 -0
- data/examples/parity/tyrion_warroom_slice.rb +549 -0
- data/examples/puma_dev/README.md +124 -0
- data/examples/puma_dev/config.ru +34 -0
- data/examples/puma_dev/standalone_app.rb +34 -0
- data/examples/scaffolding/blog.rb +49 -0
- data/examples/scaffolding/utf_lite.rb +105 -0
- data/examples/styling/feedback_demo.rb +229 -0
- data/examples/styling/style_showcase.rb +172 -0
- data/examples/styling/theme_demo.rb +508 -0
- data/examples/timer_health_checker.rb +111 -0
- data/examples/timer_showcase.rb +131 -0
- data/examples/tutorials/render_markdown.rb +112 -0
- data/examples/tutorials/streamweaver_way_tutorial.rb +44 -0
- data/examples/tutorials/tutorial_content.rb +1082 -0
- data/examples/visual_skills/design_deck_demo.rb +314 -0
- data/examples/visual_skills/explainer_demo.rb +499 -0
- data/exe/streamweaver +9 -0
- data/gsd/ROADMAP-1.0.md +167 -0
- data/gsd/STATE.md +13 -0
- data/gsd/research/market-positioning-research.md +139 -0
- data/gsd/research/production-patterns-research.md +270 -0
- data/gsd/research/repo-audit-1.0.md +274 -0
- data/lib/stream_weaver/action_token.rb +58 -0
- data/lib/stream_weaver/adapter/alpinejs.rb +8249 -0
- data/lib/stream_weaver/adapter/base.rb +591 -0
- data/lib/stream_weaver/adapter/opal.rb +334 -0
- data/lib/stream_weaver/adapter/static.rb +1118 -0
- data/lib/stream_weaver/admin.rb +176 -0
- data/lib/stream_weaver/app.rb +1821 -0
- data/lib/stream_weaver/assets/js/sw-copy.js +50 -0
- data/lib/stream_weaver/assets/js/sw-heredoc-rewrite.js +68 -0
- data/lib/stream_weaver/assets/js/sw-keyboard.js +165 -0
- data/lib/stream_weaver/assets/js/sw-mermaid-zoom.js +621 -0
- data/lib/stream_weaver/assets/js/sw-route-tabs.js +53 -0
- data/lib/stream_weaver/assets/js/sw-sidebar-toc.js +116 -0
- data/lib/stream_weaver/assets/js/sw-slide-nav.js +103 -0
- data/lib/stream_weaver/canvas/bridge.rb +239 -0
- data/lib/stream_weaver/canvas/bridge_server.rb +646 -0
- data/lib/stream_weaver/canvas/client.rb +298 -0
- data/lib/stream_weaver/canvas/doc_roots.rb +233 -0
- data/lib/stream_weaver/canvas/doc_store.rb +252 -0
- data/lib/stream_weaver/canvas/gist_publisher.rb +264 -0
- data/lib/stream_weaver/canvas/gist_save_handler.rb +89 -0
- data/lib/stream_weaver/canvas/gist_store.rb +135 -0
- data/lib/stream_weaver/canvas/helpers.rb +109 -0
- data/lib/stream_weaver/canvas/history.rb +90 -0
- data/lib/stream_weaver/canvas/protocol.rb +86 -0
- data/lib/stream_weaver/canvas/reader.rb +853 -0
- data/lib/stream_weaver/canvas/save_doc_widget.rb +457 -0
- data/lib/stream_weaver/canvas/scroll_top_hint.rb +21 -0
- data/lib/stream_weaver/canvas/session.rb +132 -0
- data/lib/stream_weaver/cli.rb +3235 -0
- data/lib/stream_weaver/component_assets.rb +70 -0
- data/lib/stream_weaver/component_registry.rb +67 -0
- data/lib/stream_weaver/component_renderer.rb +48 -0
- data/lib/stream_weaver/components/annotated_code.rb +53 -0
- data/lib/stream_weaver/components/api_endpoint.rb +42 -0
- data/lib/stream_weaver/components/callout.rb +59 -0
- data/lib/stream_weaver/components/chart.rb +84 -0
- data/lib/stream_weaver/components/code_block.rb +77 -0
- data/lib/stream_weaver/components/comparison.rb +39 -0
- data/lib/stream_weaver/components/decision.rb +38 -0
- data/lib/stream_weaver/components/deck/close_overlay.rb +84 -0
- data/lib/stream_weaver/components/deck/confirmation_bar.rb +60 -0
- data/lib/stream_weaver/components/deck/deck_option.rb +61 -0
- data/lib/stream_weaver/components/deck/deck_slide.rb +77 -0
- data/lib/stream_weaver/components/deck/deck_state.rb +469 -0
- data/lib/stream_weaver/components/deck/deck_summary.rb +73 -0
- data/lib/stream_weaver/components/deck/design_deck.rb +60 -0
- data/lib/stream_weaver/components/deck/generate_more_controls.rb +84 -0
- data/lib/stream_weaver/components/deck/model_selector.rb +84 -0
- data/lib/stream_weaver/components/deck/skeleton_placeholder.rb +36 -0
- data/lib/stream_weaver/components/diff_block.rb +125 -0
- data/lib/stream_weaver/components/doc_header.rb +57 -0
- data/lib/stream_weaver/components/image_block.rb +70 -0
- data/lib/stream_weaver/components/implementation_map.rb +33 -0
- data/lib/stream_weaver/components/keyboard_shortcuts.rb +94 -0
- data/lib/stream_weaver/components/kpi_dashboard.rb +78 -0
- data/lib/stream_weaver/components/mermaid.rb +79 -0
- data/lib/stream_weaver/components/pipeline.rb +63 -0
- data/lib/stream_weaver/components/sidebar_toc.rb +46 -0
- data/lib/stream_weaver/components/slide_container.rb +141 -0
- data/lib/stream_weaver/components/timeline_event.rb +58 -0
- data/lib/stream_weaver/components/wireframe.rb +29 -0
- data/lib/stream_weaver/components/wireframe_block.rb +34 -0
- data/lib/stream_weaver/components.rb +2711 -0
- data/lib/stream_weaver/css.rb +230 -0
- data/lib/stream_weaver/dev_fallback_overlay.rb +61 -0
- data/lib/stream_weaver/display_dsl.rb +1004 -0
- data/lib/stream_weaver/export/html_exporter.rb +478 -0
- data/lib/stream_weaver/feed.rb +34 -0
- data/lib/stream_weaver/feed_builder.rb +31 -0
- data/lib/stream_weaver/fonts.rb +33 -0
- data/lib/stream_weaver/interaction_runner.rb +487 -0
- data/lib/stream_weaver/iterm.rb +460 -0
- data/lib/stream_weaver/layout_registry.rb +92 -0
- data/lib/stream_weaver/opal/bridge.rb +52 -0
- data/lib/stream_weaver/opal/builder.rb +193 -0
- data/lib/stream_weaver/opal/env.rb +29 -0
- data/lib/stream_weaver/opal/reactive_state.rb +75 -0
- data/lib/stream_weaver/opal/regexp_anchor_patch.rb +62 -0
- data/lib/stream_weaver/opal/renderer.rb +77 -0
- data/lib/stream_weaver/opal/runtime.rb +250 -0
- data/lib/stream_weaver/opal/shell.rb +145 -0
- data/lib/stream_weaver/opal/string_bridge.rb +50 -0
- data/lib/stream_weaver/opal/stubs/diff.min.js +1 -0
- data/lib/stream_weaver/opal/stubs/digest.rb +15 -0
- data/lib/stream_weaver/opal/stubs/marked.umd.js +79 -0
- data/lib/stream_weaver/opal/stubs/md5.rb +3 -0
- data/lib/stream_weaver/opal/stubs/morphdom.min.js +775 -0
- data/lib/stream_weaver/opal/stubs/prism-tomorrow.min.css +1 -0
- data/lib/stream_weaver/opal/stubs/prism.min.js +1967 -0
- data/lib/stream_weaver/opal_entry.rb +136 -0
- data/lib/stream_weaver/org/inline.rb +95 -0
- data/lib/stream_weaver/org/reader.rb +561 -0
- data/lib/stream_weaver/org/recording_context.rb +86 -0
- data/lib/stream_weaver/org/source_splitter.rb +63 -0
- data/lib/stream_weaver/org/writer.rb +300 -0
- data/lib/stream_weaver/page_shell.rb +530 -0
- data/lib/stream_weaver/portfile.rb +79 -0
- data/lib/stream_weaver/pushable.rb +42 -0
- data/lib/stream_weaver/resource/default_views.rb +111 -0
- data/lib/stream_weaver/resource/field_input.rb +25 -0
- data/lib/stream_weaver/resource/state_keys.rb +16 -0
- data/lib/stream_weaver/resource/store.rb +18 -0
- data/lib/stream_weaver/resource.rb +104 -0
- data/lib/stream_weaver/server.rb +1471 -0
- data/lib/stream_weaver/service.rb +1240 -0
- data/lib/stream_weaver/service_client.rb +104 -0
- data/lib/stream_weaver/session_store.rb +186 -0
- data/lib/stream_weaver/skills/streamweaver-canvas-safe/SKILL.md +66 -0
- data/lib/stream_weaver/skills/streamweaver-canvas-safe/examples/canvas-safe-showcase.rb +98 -0
- data/lib/stream_weaver/skills/streamweaver-canvas-safe/references/actions-and-buttons.md +47 -0
- data/lib/stream_weaver/skills/streamweaver-canvas-safe/references/charts-and-diagrams.md +38 -0
- data/lib/stream_weaver/skills/streamweaver-canvas-safe/references/deck.md +32 -0
- data/lib/stream_weaver/skills/streamweaver-canvas-safe/references/inputs-and-forms.md +65 -0
- data/lib/stream_weaver/skills/streamweaver-canvas-safe/references/tabs-and-navigation.md +53 -0
- data/lib/stream_weaver/skills/streamweaver-doc-builder/SKILL.md +298 -0
- data/lib/stream_weaver/skills/streamweaver-visual-companion/SKILL.md +130 -0
- data/lib/stream_weaver/skills/streamweaver-visual-companion/examples/design-review-example.css +468 -0
- data/lib/stream_weaver/skills/streamweaver-visual-companion/examples/design-review-example.rb +39 -0
- data/lib/stream_weaver/skills/streamweaver-visual-companion/examples/design-review-example_dsl.rb +300 -0
- data/lib/stream_weaver/skills/streamweaver-visual-companion/examples/doc-parity-example.rb +24 -0
- data/lib/stream_weaver/skills/streamweaver-visual-companion/examples/doc-parity-example_dsl.rb +385 -0
- data/lib/stream_weaver/skills/streamweaver-visual-companion/references/checkpoints-and-forms.md +28 -0
- data/lib/stream_weaver/skills/streamweaver-visual-companion/references/cleanup-and-panel.md +44 -0
- data/lib/stream_weaver/skills/streamweaver-visual-companion/references/example-gallery.md +8 -0
- data/lib/stream_weaver/skills/streamweaver-visual-companion/references/persistence.md +58 -0
- data/lib/stream_weaver/skills/streamweaver-way/SKILL.md +396 -0
- data/lib/stream_weaver/skills/visual-plan/SKILL.md +201 -0
- data/lib/stream_weaver/skills/visual-recap/SKILL.md +244 -0
- data/lib/stream_weaver/streamer.rb +63 -0
- data/lib/stream_weaver/templates/choices.rb +149 -0
- data/lib/stream_weaver/templates/code.rb +157 -0
- data/lib/stream_weaver/templates/confirm.rb +110 -0
- data/lib/stream_weaver/templates/diff.rb +195 -0
- data/lib/stream_weaver/templates/info.rb +142 -0
- data/lib/stream_weaver/templates/table.rb +169 -0
- data/lib/stream_weaver/templates/wizard.rb +271 -0
- data/lib/stream_weaver/theme/auto_mode.rb +116 -0
- data/lib/stream_weaver/theme/presets.rb +555 -0
- data/lib/stream_weaver/theme.rb +639 -0
- data/lib/stream_weaver/university/canvas.rb +924 -0
- data/lib/stream_weaver/university/course.rb +699 -0
- data/lib/stream_weaver/university/demos/counter.rb +33 -0
- data/lib/stream_weaver/university/demos/dashboard.rb +147 -0
- data/lib/stream_weaver/university/demos/decision_form.rb +143 -0
- data/lib/stream_weaver/university/demos.rb +50 -0
- data/lib/stream_weaver/university/listener.rb +467 -0
- data/lib/stream_weaver/university/progress.rb +201 -0
- data/lib/stream_weaver/university/runner.rb +138 -0
- data/lib/stream_weaver/university/scripts/growing_doc.rb +609 -0
- data/lib/stream_weaver/university/scripts/growing_doc_state.rb +91 -0
- data/lib/stream_weaver/utils.rb +31 -0
- data/lib/stream_weaver/version.rb +5 -0
- data/lib/stream_weaver/views/canvas/reader_layout.erb +800 -0
- data/lib/stream_weaver/views.rb +3940 -0
- data/lib/stream_weaver.rb +122 -0
- data/llms.txt +1269 -0
- data/sig/stream_weaver.rbs +4 -0
- metadata +598 -0
|
@@ -0,0 +1,964 @@
|
|
|
1
|
+
# Visual Explainer - Comprehensive Analysis for StreamWeaver Port
|
|
2
|
+
|
|
3
|
+
**Source:** https://github.com/nicobailon/visual-explainer
|
|
4
|
+
**Version:** 0.6.3
|
|
5
|
+
**Author:** nicobailon
|
|
6
|
+
**License:** MIT
|
|
7
|
+
**Date of analysis:** 2026-03-12
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 1. Core Intent
|
|
12
|
+
|
|
13
|
+
### Problem
|
|
14
|
+
Developers working with AI coding agents (Claude Code, Pi, Codex) receive complex technical information as raw text -- ASCII tables, textual architecture descriptions, plain diff output. This is hard to parse, impossible to share, and loses context. Visual Explainer transforms that information into magazine-quality, self-contained HTML pages that open in a browser.
|
|
15
|
+
|
|
16
|
+
### User
|
|
17
|
+
Developers using AI agents for code review, planning, architecture understanding, and project management. The agent itself is the primary "author" -- it generates the HTML pages as part of its workflow.
|
|
18
|
+
|
|
19
|
+
### Workflow
|
|
20
|
+
1. User invokes a slash command (e.g., `/diff-review main`) or the agent proactively decides to generate HTML (for complex tables)
|
|
21
|
+
2. The agent reads reference materials (SKILL.md, templates, CSS patterns)
|
|
22
|
+
3. The agent gathers data from the codebase (git commands, file reads, etc.)
|
|
23
|
+
4. The agent generates a complete self-contained HTML file with inline CSS, optional JS
|
|
24
|
+
5. The file is written to `~/.agent/diagrams/` and opened in the browser
|
|
25
|
+
6. Optionally, the user can `/share` to deploy to Vercel for a live URL
|
|
26
|
+
|
|
27
|
+
### Key Design Philosophy
|
|
28
|
+
- **Never fall back to ASCII art** -- everything visual goes to the browser
|
|
29
|
+
- **Proactive table rendering** -- tables with 4+ rows or 3+ columns auto-generate HTML
|
|
30
|
+
- **Self-contained** -- single HTML file, no external assets except CDN links (fonts, Mermaid, Chart.js)
|
|
31
|
+
- **Both themes** -- every page must work in both light and dark mode via `prefers-color-scheme`
|
|
32
|
+
- **Anti-slop** -- extensive forbidden patterns to prevent generic AI-looking output
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## 2. Feature Inventory
|
|
37
|
+
|
|
38
|
+
### Slash Commands
|
|
39
|
+
|
|
40
|
+
#### /generate-web-diagram
|
|
41
|
+
- **Purpose:** Generate an HTML diagram for any topic
|
|
42
|
+
- **Input:** Free-form topic description (`$@`)
|
|
43
|
+
- **Output:** Self-contained HTML page
|
|
44
|
+
- **Behavior:** Picks aesthetic, reads reference template, generates diagram, writes to `~/.agent/diagrams/`, opens in browser. Optional surf-cli image generation.
|
|
45
|
+
|
|
46
|
+
#### /generate-visual-plan
|
|
47
|
+
- **Purpose:** Visual implementation plan for a feature specification
|
|
48
|
+
- **Input:** Feature description (`$@`)
|
|
49
|
+
- **Data gathering:** Parse feature request, read relevant codebase, understand extension points, check prior art
|
|
50
|
+
- **Design phase:** State design, API design, integration design, edge cases
|
|
51
|
+
- **Output sections (10):**
|
|
52
|
+
1. Header (feature name, description, scope)
|
|
53
|
+
2. The Problem (before/after comparison panels)
|
|
54
|
+
3. State Machine (Mermaid flowchart/stateDiagram)
|
|
55
|
+
4. State Variables (card grid)
|
|
56
|
+
5. Modified Functions (code snippets with explanations)
|
|
57
|
+
6. Commands/API (table)
|
|
58
|
+
7. Edge Cases (table)
|
|
59
|
+
8. Test Requirements (table/cards)
|
|
60
|
+
9. File References (table)
|
|
61
|
+
10. Implementation Notes (callout boxes with colored borders)
|
|
62
|
+
- **Verification checkpoint** before HTML generation
|
|
63
|
+
|
|
64
|
+
#### /generate-slides
|
|
65
|
+
- **Purpose:** Magazine-quality slide deck presentation
|
|
66
|
+
- **Input:** Topic description (`$@`)
|
|
67
|
+
- **Output:** Scroll-snap based slide deck, 100dvh per slide
|
|
68
|
+
- **Slide types (10):** Title, Section Divider, Content, Split, Diagram, Dashboard, Table, Code, Quote, Full-Bleed
|
|
69
|
+
- **Features:** Keyboard/touch/wheel navigation, progress bar, nav dots, slide counter, hints, staggered child reveals, per-slide background variation
|
|
70
|
+
- **Presets (4):** Midnight Editorial, Warm Signal, Terminal Mono, Swiss Clean
|
|
71
|
+
- **Key constraint:** Content completeness -- every section of source must appear in deck; add more slides rather than cutting content
|
|
72
|
+
|
|
73
|
+
#### /diff-review
|
|
74
|
+
- **Purpose:** Visual diff review with architecture comparison and code review
|
|
75
|
+
- **Input:** Branch name, commit hash, HEAD, PR number, range, or no argument (defaults to main)
|
|
76
|
+
- **Data gathering:** git diff --stat, git diff --name-status, line counts, new API surface, feature inventory, read all changed files, check CHANGELOG/README, reconstruct decision rationale
|
|
77
|
+
- **Verification checkpoint** before HTML generation
|
|
78
|
+
- **Output sections (10):**
|
|
79
|
+
1. Executive summary (hero depth, "aha moment" clarity)
|
|
80
|
+
2. KPI dashboard (lines added/removed, files changed, housekeeping indicators)
|
|
81
|
+
3. Module architecture (Mermaid dependency graph with zoom controls)
|
|
82
|
+
4. Major feature comparisons (side-by-side before/after panels)
|
|
83
|
+
5. Flow diagrams (Mermaid for new lifecycle/pipeline patterns)
|
|
84
|
+
6. File map (color-coded new/modified/deleted, collapsible)
|
|
85
|
+
7. Test coverage (before/after)
|
|
86
|
+
8. Code review (Good/Bad/Ugly/Questions with colored accent cards)
|
|
87
|
+
9. Decision log (decision, rationale, alternatives, confidence level)
|
|
88
|
+
10. Re-entry context (invariants, coupling, gotchas, follow-ups)
|
|
89
|
+
|
|
90
|
+
#### /plan-review
|
|
91
|
+
- **Purpose:** Compare proposed implementation plan against current codebase
|
|
92
|
+
- **Input:** Plan file path (`$1`), optional codebase path (`$2`)
|
|
93
|
+
- **Data gathering:** Read plan file, read every referenced file, map blast radius, cross-reference plan vs code
|
|
94
|
+
- **Output sections (9):**
|
|
95
|
+
1. Plan summary (hero depth)
|
|
96
|
+
2. Impact dashboard (files to modify/create/delete, completeness indicator)
|
|
97
|
+
3. Current architecture (Mermaid diagram)
|
|
98
|
+
4. Planned architecture (Mermaid diagram, same node names for visual diff)
|
|
99
|
+
5. Change-by-change breakdown (side-by-side panels with rationale)
|
|
100
|
+
6. Dependency and ripple analysis (collapsible)
|
|
101
|
+
7. Risk assessment (edge cases, assumptions, ordering, rollback, cognitive complexity)
|
|
102
|
+
8. Plan review (Good/Bad/Ugly/Questions)
|
|
103
|
+
9. Understanding gaps (decision-rationale gaps dashboard)
|
|
104
|
+
|
|
105
|
+
#### /project-recap
|
|
106
|
+
- **Purpose:** Rebuild mental model of a project for context-switching
|
|
107
|
+
- **Input:** Time window (`$1` -- e.g., `2w`, `30d`, `3m`; default `2w`)
|
|
108
|
+
- **Data gathering:** Project identity, recent git activity, current state, decision context, architecture scan
|
|
109
|
+
- **Output sections (8):**
|
|
110
|
+
1. Project identity (current-state summary, not README blurb)
|
|
111
|
+
2. Architecture snapshot (Mermaid diagram of system as-is)
|
|
112
|
+
3. Recent activity (human-readable narrative grouped by theme)
|
|
113
|
+
4. Decision log (extracted from commits/conversations/docs)
|
|
114
|
+
5. State of things (KPI dashboard: working/in-progress/broken/blocked)
|
|
115
|
+
6. Mental model essentials (invariants, coupling, gotchas, naming conventions)
|
|
116
|
+
7. Cognitive debt hotspots (amber cards with severity indicators)
|
|
117
|
+
8. Next steps (inferred from recent activity)
|
|
118
|
+
|
|
119
|
+
#### /fact-check
|
|
120
|
+
- **Purpose:** Verify factual accuracy of a document against actual code
|
|
121
|
+
- **Input:** File path (`$1`) or defaults to most recent HTML in `~/.agent/diagrams/`
|
|
122
|
+
- **Phases:**
|
|
123
|
+
1. Extract claims (quantitative, naming, behavioral, structural, temporal)
|
|
124
|
+
2. Verify against source (re-read files, re-run git commands)
|
|
125
|
+
3. Correct in place (surgical text replacements)
|
|
126
|
+
4. Add verification summary (banner or section)
|
|
127
|
+
5. Report results
|
|
128
|
+
- **Key principle:** Not a re-review -- only verifies factual claims, doesn't change opinions or structure
|
|
129
|
+
|
|
130
|
+
#### /share
|
|
131
|
+
- **Purpose:** Deploy HTML page to Vercel for a live URL
|
|
132
|
+
- **Input:** File path to HTML file
|
|
133
|
+
- **Implementation:** Shell script (`share.sh`) that copies to temp dir as index.html, deploys via vercel-deploy skill
|
|
134
|
+
- **Output:** Live URL + claim URL (for transferring to Vercel account)
|
|
135
|
+
- **Requirements:** vercel-deploy skill
|
|
136
|
+
- **Retention:** Default 30 days, public access
|
|
137
|
+
|
|
138
|
+
### Auto-Trigger Behavior
|
|
139
|
+
- **Threshold:** Tables with 4+ rows OR 3+ columns
|
|
140
|
+
- **Behavior:** Agent generates HTML page instead of ASCII box-drawing table
|
|
141
|
+
- **Scope:** Comparisons, audits, feature matrices, status reports, configuration matrices, test results, dependency lists, permission tables, API inventories
|
|
142
|
+
- **UX:** Agent can include a brief text summary in chat, but the table itself is HTML in browser
|
|
143
|
+
|
|
144
|
+
### Page Types
|
|
145
|
+
1. **Architecture diagrams** -- CSS Grid cards + flow arrows (text-heavy) or Mermaid (topology-focused) or hybrid (15+ elements)
|
|
146
|
+
2. **Flowcharts/Pipelines** -- Mermaid with `graph TD` preferred
|
|
147
|
+
3. **Sequence diagrams** -- Mermaid `sequenceDiagram`
|
|
148
|
+
4. **Data flow diagrams** -- Mermaid with edge labels
|
|
149
|
+
5. **Schema/ER diagrams** -- Mermaid `erDiagram`
|
|
150
|
+
6. **State machines** -- Mermaid `stateDiagram-v2` (simple labels) or `flowchart TD` (complex labels)
|
|
151
|
+
7. **Mind maps** -- Mermaid `mindmap`
|
|
152
|
+
8. **Class diagrams** -- Mermaid `classDiagram`
|
|
153
|
+
9. **C4 architecture** -- Mermaid `graph TD` + `subgraph` (NOT native C4Context)
|
|
154
|
+
10. **Data tables** -- HTML `<table>` with sticky headers, alternating rows, status badges
|
|
155
|
+
11. **Timelines** -- CSS central line + cards
|
|
156
|
+
12. **Dashboards** -- CSS Grid + Chart.js
|
|
157
|
+
13. **Implementation plans** -- Structured multi-section with state machines and code snippets
|
|
158
|
+
14. **Slide decks** -- Scroll-snap 100dvh slides with 10 slide types
|
|
159
|
+
15. **Prose/documentation** -- Card grids, numbered flows, tables, callout boxes
|
|
160
|
+
|
|
161
|
+
### Mermaid Integration
|
|
162
|
+
- CDN: `mermaid@11` ESM module
|
|
163
|
+
- Optional ELK layout: `@mermaid-js/layout-elk` (separate CDN import)
|
|
164
|
+
- Always `theme: 'base'` with custom `themeVariables`
|
|
165
|
+
- Dark mode detection at load time via `matchMedia`
|
|
166
|
+
- CSS overrides for node/edge labels, colors
|
|
167
|
+
- Full zoom/pan engine (~200 lines JS): +/- buttons, Ctrl/Cmd+scroll zoom, click-and-drag pan, touch pinch zoom, double-click to fit, click-to-expand in new tab
|
|
168
|
+
- Smart fit algorithm: contain, width-priority, height-priority based on diagram aspect ratio
|
|
169
|
+
- Adaptive container height based on SVG dimensions
|
|
170
|
+
- Max 10-12 nodes per Mermaid diagram; hybrid pattern for 15+ elements
|
|
171
|
+
- Preferred direction: `flowchart TD` (top-down) over LR for complex diagrams
|
|
172
|
+
|
|
173
|
+
### Chart.js Integration
|
|
174
|
+
- CDN: `chart.js@4` UMD bundle
|
|
175
|
+
- Dark mode aware: reads `prefers-color-scheme` for text/grid colors
|
|
176
|
+
- Reads CSS custom properties for font family
|
|
177
|
+
- Used for bar, line, pie/doughnut, radar charts in dashboard pages
|
|
178
|
+
|
|
179
|
+
### Theme Support
|
|
180
|
+
- **Auto (default):** Uses `prefers-color-scheme` media query
|
|
181
|
+
- **Light-first:** `:root` = light, `@media (prefers-color-scheme: dark)` = dark
|
|
182
|
+
- **Dark-first:** `:root` = dark, `@media (prefers-color-scheme: light)` = light
|
|
183
|
+
- **Manual toggle:** `data-theme` attribute with JS toggle function
|
|
184
|
+
- Both themes must look intentional, not broken
|
|
185
|
+
|
|
186
|
+
### Responsive Navigation / Sticky TOC
|
|
187
|
+
- For pages with 4+ sections
|
|
188
|
+
- Desktop: Sticky sidebar TOC (170px column) with scroll spy via IntersectionObserver
|
|
189
|
+
- Mobile (<1000px): Horizontal scrollable sticky bar at top
|
|
190
|
+
- Active section highlighting with smooth scroll-into-view on mobile
|
|
191
|
+
- Smooth scroll on click with URL hash update
|
|
192
|
+
|
|
193
|
+
### Optional AI Image Generation
|
|
194
|
+
- Via `surf-cli` (Gemini-powered)
|
|
195
|
+
- Check availability with `which surf`
|
|
196
|
+
- Generate images, base64 encode, embed as data URIs
|
|
197
|
+
- Use cases: hero banners, conceptual illustrations, slide backgrounds
|
|
198
|
+
- Graceful degradation when not available
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## 3. Architecture and Implementation
|
|
203
|
+
|
|
204
|
+
### Plugin Structure
|
|
205
|
+
```
|
|
206
|
+
visual-explainer/
|
|
207
|
+
.claude-plugin/
|
|
208
|
+
plugin.json # Top-level: marketplace distribution metadata
|
|
209
|
+
marketplace.json # Marketplace listing metadata
|
|
210
|
+
plugins/visual-explainer/
|
|
211
|
+
.claude-plugin/
|
|
212
|
+
plugin.json # Inner: skill metadata (name, version, author, repo)
|
|
213
|
+
SKILL.md # The main brain -- teaches the agent everything
|
|
214
|
+
commands/
|
|
215
|
+
diff-review.md # Slash command prompt template
|
|
216
|
+
fact-check.md
|
|
217
|
+
generate-slides.md
|
|
218
|
+
generate-visual-plan.md
|
|
219
|
+
generate-web-diagram.md
|
|
220
|
+
plan-review.md
|
|
221
|
+
project-recap.md
|
|
222
|
+
share.md
|
|
223
|
+
references/
|
|
224
|
+
css-patterns.md # ~1700 lines of CSS patterns, layout, theming
|
|
225
|
+
libraries.md # CDN library usage (Mermaid, Chart.js, anime.js, fonts)
|
|
226
|
+
responsive-nav.md # Sticky sidebar TOC + mobile horizontal bar
|
|
227
|
+
slide-patterns.md # ~1300 lines of slide deck patterns
|
|
228
|
+
templates/
|
|
229
|
+
architecture.html # Reference: CSS Grid architecture layout
|
|
230
|
+
data-table.html # Reference: data tables with KPIs and status badges
|
|
231
|
+
mermaid-flowchart.html # Reference: Mermaid with full zoom/pan engine
|
|
232
|
+
slide-deck.html # Reference: all 10 slide types in one deck
|
|
233
|
+
scripts/
|
|
234
|
+
share.sh # Vercel deployment script
|
|
235
|
+
package.json # NPM package metadata (for claude-code-plugin distribution)
|
|
236
|
+
install-pi.sh # Pi-specific installation script
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### How SKILL.md Teaches the Agent
|
|
240
|
+
SKILL.md is the central document (~475 lines) that the agent reads at the start of every command. It provides:
|
|
241
|
+
|
|
242
|
+
1. **Workflow (4 steps):** Think > Structure > Style > Deliver
|
|
243
|
+
2. **Think phase:** Choose aesthetic direction, audience, content type. Constrained aesthetics preferred (Blueprint, Editorial, Paper/ink, Terminal). Forbidden patterns (neon dashboard, gradient mesh, Inter font + violet accents).
|
|
244
|
+
3. **Structure phase:** Read the right reference template for the content type. Routing table maps content types to rendering approaches (Mermaid, CSS Grid, HTML table, etc.). Detailed Mermaid configuration rules.
|
|
245
|
+
4. **Style phase:** Typography (font pairings with forbidden defaults), color palettes (forbidden accent colors), surface depth hierarchy, background atmosphere, animation choreography.
|
|
246
|
+
5. **Deliver phase:** Write to `~/.agent/diagrams/`, open in browser, tell user the file path.
|
|
247
|
+
6. **Diagram types:** Detailed guidance for each of ~15 diagram types.
|
|
248
|
+
7. **Slide deck mode:** Opt-in only, separate medium with different rules.
|
|
249
|
+
8. **Quality checks:** Squint test, swap test, both themes, information completeness, overflow, Mermaid zoom controls.
|
|
250
|
+
9. **Anti-patterns:** Exhaustive list of "AI slop" signals to avoid.
|
|
251
|
+
|
|
252
|
+
### How the Agent Generates HTML
|
|
253
|
+
The agent does NOT use traditional templates with variable substitution. Instead:
|
|
254
|
+
1. Agent reads SKILL.md to understand the workflow
|
|
255
|
+
2. Agent reads relevant reference files (css-patterns.md, libraries.md, etc.)
|
|
256
|
+
3. Agent reads relevant template HTML for structural patterns
|
|
257
|
+
4. Agent gathers data from the codebase (git commands, file reads)
|
|
258
|
+
5. Agent generates the ENTIRE HTML file from scratch, incorporating patterns from references
|
|
259
|
+
6. The HTML is a complete `<!DOCTYPE html>` document with inline `<style>` and optional `<script>`
|
|
260
|
+
7. Every generation is unique -- different fonts, palettes, layouts per the variety requirements
|
|
261
|
+
|
|
262
|
+
### Cross-Tool Compatibility
|
|
263
|
+
- **Pi:** Commands are slash commands (`/diff-review`). Installed to `~/.pi/agent/skills/`. Uses `{{skill_dir}}` placeholder replaced at install time.
|
|
264
|
+
- **Claude Code:** Namespaced commands (`/visual-explainer:diff-review`). Installed via `npm` (package.json has `claude-code-plugin` keyword).
|
|
265
|
+
- **Codex:** Uses `$visual-explainer` with description, or `/prompts:diff-review` if installed to `~/.codex/prompts/`.
|
|
266
|
+
|
|
267
|
+
### Output Location
|
|
268
|
+
- All diagrams written to `~/.agent/diagrams/`
|
|
269
|
+
- Descriptive filenames: `modem-architecture.html`, `pipeline-flow.html`
|
|
270
|
+
- Directory persists across sessions
|
|
271
|
+
- Opened via `open` (macOS) or `xdg-open` (Linux)
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
## 4. UI/UX Patterns
|
|
276
|
+
|
|
277
|
+
### Typography
|
|
278
|
+
- **Font pairings** (13 recommended, rotate each generation):
|
|
279
|
+
- DM Sans + Fira Code (technical, precise)
|
|
280
|
+
- Instrument Serif + JetBrains Mono (editorial, refined)
|
|
281
|
+
- IBM Plex Sans + IBM Plex Mono (reliable, readable)
|
|
282
|
+
- Bricolage Grotesque + Fragment Mono (bold, characterful)
|
|
283
|
+
- Plus Jakarta Sans + Azeret Mono (rounded, approachable)
|
|
284
|
+
- Outfit + Space Mono (clean geometric)
|
|
285
|
+
- Sora + IBM Plex Mono (technical)
|
|
286
|
+
- Crimson Pro + Noto Sans Mono (scholarly)
|
|
287
|
+
- Fraunces + Source Code Pro (warm, distinctive)
|
|
288
|
+
- Geist + Geist Mono (sharp, modern)
|
|
289
|
+
- Red Hat Display + Red Hat Mono (cohesive)
|
|
290
|
+
- Libre Franklin + Inconsolata (classic)
|
|
291
|
+
- Playfair Display + Roboto Mono (elegant contrast)
|
|
292
|
+
- **Forbidden body fonts:** Inter, Roboto, Arial, Helvetica, system-ui alone
|
|
293
|
+
- **Prose typography by voice:** Literary (Literata, Lora), Technical (IBM Plex), Bold (Bricolage Grotesque), Minimal (Source Serif 4)
|
|
294
|
+
- All loaded via Google Fonts CDN with `display=swap`
|
|
295
|
+
- System font fallback in font-family stack
|
|
296
|
+
|
|
297
|
+
### Color Palettes
|
|
298
|
+
- **Required CSS custom properties:** `--bg`, `--surface`, `--border`, `--text`, `--text-dim`, 3-5 accent colors with dim variants
|
|
299
|
+
- **Recommended palettes:**
|
|
300
|
+
- Terracotta + sage (`#c2410c`, `#65a30d`)
|
|
301
|
+
- Teal + slate (`#0891b2`, `#0369a1`)
|
|
302
|
+
- Rose + cranberry (`#be123c`, `#881337`)
|
|
303
|
+
- Amber + emerald (`#d97706`, `#059669`)
|
|
304
|
+
- Deep blue + gold (`#1e3a5f`, `#d4a73a`)
|
|
305
|
+
- **Forbidden colors:** `#8b5cf6`, `#7c3aed`, `#a78bfa` (indigo/violet), `#d946ef` (fuchsia), cyan+magenta+pink combination
|
|
306
|
+
- **Forbidden effects:** Gradient text on headings, animated glowing box-shadows, neon haze
|
|
307
|
+
|
|
308
|
+
### Layout System
|
|
309
|
+
- **Max width:** Typically 1000-1400px centered
|
|
310
|
+
- **Surface depth tiers (4):**
|
|
311
|
+
- Hero: accent-tinted background, elevated shadow, demanding attention
|
|
312
|
+
- Elevated: subtle shadow, for KPIs and key sections
|
|
313
|
+
- Default: flat card with border
|
|
314
|
+
- Recessed: inset shadow, for code blocks and secondary content
|
|
315
|
+
- **Background atmosphere:** Never flat solid -- use subtle gradients, dot grids, diagonal lines, or gradient mesh
|
|
316
|
+
- **Card component:** `.ve-card` (not `.node` -- Mermaid collision)
|
|
317
|
+
- **Grid layouts:** Architecture (2-column sidebar), Pipeline (horizontal flex), Card grid (auto-fit), Data tables (HTML `<table>`)
|
|
318
|
+
|
|
319
|
+
### Responsive Design
|
|
320
|
+
- Single breakpoint at 768px
|
|
321
|
+
- Grids collapse to single column
|
|
322
|
+
- Pipeline arrows hidden on mobile
|
|
323
|
+
- Body padding reduces from 40px to 16px
|
|
324
|
+
- TOC switches from sidebar to horizontal bar at 1000px
|
|
325
|
+
- Slide decks have height-based breakpoints (700px, 600px, 500px)
|
|
326
|
+
|
|
327
|
+
### Navigation Patterns
|
|
328
|
+
- **Sticky sidebar TOC:** 170px column, scroll spy via IntersectionObserver, active state with accent border
|
|
329
|
+
- **Mobile horizontal bar:** Sticky top, horizontal scroll, auto-scroll active tab to center
|
|
330
|
+
- **Slide navigation:** Keyboard (arrows, space, page up/down, home/end), touch swipe, scroll snap, progress bar, nav dots, slide counter, keyboard hints
|
|
331
|
+
|
|
332
|
+
### Animations
|
|
333
|
+
- **Staggered fade-in:** `fadeUp` keyframe with `--i` CSS variable for delay (0.04-0.06s per element)
|
|
334
|
+
- **Scale-fade:** `fadeScale` for KPI cards and badges
|
|
335
|
+
- **SVG draw-in:** `drawIn` for connectors using stroke-dashoffset
|
|
336
|
+
- **CSS counter:** `@property --count` for animating numbers without JS
|
|
337
|
+
- **Hover lift:** translateY(-2px) with subtle shadow
|
|
338
|
+
- **Slide transitions:** fade + translateY(40px) + scale(0.98), staggered child reveals (0.1s increment)
|
|
339
|
+
- **Forbidden:** Animated glowing shadows, pulsing/breathing effects, continuous animations after page load
|
|
340
|
+
- **Always:** `@media (prefers-reduced-motion: reduce)` to disable animations
|
|
341
|
+
|
|
342
|
+
### Interactive Elements
|
|
343
|
+
- **Mermaid zoom controls:** +/- buttons, reset, 1:1, expand (new tab)
|
|
344
|
+
- **Mermaid pan:** Click-and-drag with cursor change, Ctrl/Cmd+scroll zoom, touch pinch zoom
|
|
345
|
+
- **Mermaid click-to-expand:** Click without dragging opens full-size in new tab
|
|
346
|
+
- **Collapsible sections:** Native `<details>/<summary>` with styled disclosure chevron
|
|
347
|
+
- **Table row hover:** Background highlight for scanability
|
|
348
|
+
- **Theme toggle:** Optional button with sun/moon SVG icons
|
|
349
|
+
|
|
350
|
+
---
|
|
351
|
+
|
|
352
|
+
## 5. Gherkin/Cucumber Scenarios
|
|
353
|
+
|
|
354
|
+
### Generate Web Diagram
|
|
355
|
+
|
|
356
|
+
```gherkin
|
|
357
|
+
Feature: Generate Web Diagram
|
|
358
|
+
As a developer using an AI agent
|
|
359
|
+
I want to generate visual HTML diagrams
|
|
360
|
+
So that I can understand complex systems better than ASCII art
|
|
361
|
+
|
|
362
|
+
Scenario: Basic diagram generation
|
|
363
|
+
Given the visual-explainer skill is loaded
|
|
364
|
+
When the user invokes "/generate-web-diagram WebSocket message flow"
|
|
365
|
+
Then the agent reads SKILL.md for workflow guidance
|
|
366
|
+
And the agent reads the appropriate reference template
|
|
367
|
+
And the agent picks a distinctive aesthetic direction
|
|
368
|
+
And the agent generates a self-contained HTML file
|
|
369
|
+
And the file is written to "~/.agent/diagrams/" with a descriptive filename
|
|
370
|
+
And the file is opened in the default browser
|
|
371
|
+
And the agent tells the user the file path
|
|
372
|
+
|
|
373
|
+
Scenario: Diagram has light and dark themes
|
|
374
|
+
Given a diagram has been generated
|
|
375
|
+
When the OS is set to light mode
|
|
376
|
+
Then the page renders with light palette colors
|
|
377
|
+
When the OS is switched to dark mode
|
|
378
|
+
Then the page renders with dark palette colors via prefers-color-scheme
|
|
379
|
+
And both themes look intentional, not broken
|
|
380
|
+
|
|
381
|
+
Scenario: Diagram uses distinctive typography
|
|
382
|
+
Given a diagram is being generated
|
|
383
|
+
Then the body font is NOT Inter, Roboto, Arial, Helvetica, or system-ui alone
|
|
384
|
+
And the font pairing is loaded from Google Fonts CDN
|
|
385
|
+
And a system font fallback is included in the font-family stack
|
|
386
|
+
|
|
387
|
+
Scenario: Diagram avoids AI slop patterns
|
|
388
|
+
Given a diagram is being generated
|
|
389
|
+
Then the accent colors do NOT include #8b5cf6, #7c3aed, or #a78bfa
|
|
390
|
+
And headings do NOT use gradient text with background-clip
|
|
391
|
+
And section headers do NOT use emoji icons
|
|
392
|
+
And cards do NOT have animated glowing box-shadows
|
|
393
|
+
And the layout is NOT perfectly uniform with identical card styling
|
|
394
|
+
|
|
395
|
+
Scenario: Diagram with surf-cli available
|
|
396
|
+
Given surf-cli is installed (which surf returns a path)
|
|
397
|
+
When generating a diagram where an image would enhance the page
|
|
398
|
+
Then the agent generates an image via "surf gemini --generate-image"
|
|
399
|
+
And base64-encodes it as a data URI
|
|
400
|
+
And embeds it in the HTML
|
|
401
|
+
And cleans up the temporary file
|
|
402
|
+
|
|
403
|
+
Scenario: Diagram without surf-cli
|
|
404
|
+
Given surf-cli is NOT installed
|
|
405
|
+
When generating a diagram
|
|
406
|
+
Then the agent skips image generation without erroring
|
|
407
|
+
And the page stands on its own with CSS and typography alone
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
### Auto-Trigger on Complex Tables
|
|
411
|
+
|
|
412
|
+
```gherkin
|
|
413
|
+
Feature: Proactive Table Rendering
|
|
414
|
+
As a developer
|
|
415
|
+
I want complex data automatically rendered as HTML
|
|
416
|
+
So that I don't have to ask for visual treatment of tabular data
|
|
417
|
+
|
|
418
|
+
Scenario: Table with 4+ rows triggers HTML generation
|
|
419
|
+
Given the agent is about to present tabular data
|
|
420
|
+
And the table has 4 or more rows
|
|
421
|
+
Then the agent generates an HTML page instead of ASCII art
|
|
422
|
+
And opens it in the browser
|
|
423
|
+
And tells the user the file path
|
|
424
|
+
And may include a brief text summary in chat
|
|
425
|
+
|
|
426
|
+
Scenario: Table with 3+ columns triggers HTML generation
|
|
427
|
+
Given the agent is about to present tabular data
|
|
428
|
+
And the table has 3 or more columns
|
|
429
|
+
Then the agent generates an HTML page instead of ASCII art
|
|
430
|
+
|
|
431
|
+
Scenario: Small table does not trigger
|
|
432
|
+
Given the agent is about to present tabular data
|
|
433
|
+
And the table has fewer than 4 rows AND fewer than 3 columns
|
|
434
|
+
Then the agent renders it as normal text in the terminal
|
|
435
|
+
|
|
436
|
+
Scenario: Auto-generated table has proper styling
|
|
437
|
+
Given an HTML table is auto-generated
|
|
438
|
+
Then the table has a sticky header
|
|
439
|
+
And alternating row backgrounds via tr:nth-child(even)
|
|
440
|
+
And row hover highlighting
|
|
441
|
+
And status indicators use styled spans, never emoji
|
|
442
|
+
And the table wraps in a scrollable container for wide content
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
### Diff Review
|
|
446
|
+
|
|
447
|
+
```gherkin
|
|
448
|
+
Feature: Diff Review
|
|
449
|
+
As a developer
|
|
450
|
+
I want a visual HTML diff review
|
|
451
|
+
So that I can understand code changes with architecture context
|
|
452
|
+
|
|
453
|
+
Scenario: Diff review against main branch
|
|
454
|
+
Given the visual-explainer skill is loaded
|
|
455
|
+
When the user invokes "/diff-review" with no argument
|
|
456
|
+
Then the agent diffs working tree against main branch
|
|
457
|
+
And gathers data: git diff --stat, --name-status, line counts, API surface
|
|
458
|
+
And reads all changed files in full
|
|
459
|
+
And checks CHANGELOG.md and README.md for updates needed
|
|
460
|
+
And generates a verification fact sheet before HTML
|
|
461
|
+
And generates an HTML page with all 10 sections
|
|
462
|
+
And opens it in the browser
|
|
463
|
+
|
|
464
|
+
Scenario: Diff review of a specific PR
|
|
465
|
+
Given the user invokes "/diff-review #42"
|
|
466
|
+
Then the agent runs "gh pr diff 42" for the diff data
|
|
467
|
+
And proceeds with the standard review process
|
|
468
|
+
|
|
469
|
+
Scenario: Diff review of a commit hash
|
|
470
|
+
Given the user invokes "/diff-review abc123"
|
|
471
|
+
Then the agent runs "git show abc123" for the diff data
|
|
472
|
+
|
|
473
|
+
Scenario: Diff review of uncommitted changes
|
|
474
|
+
Given the user invokes "/diff-review HEAD"
|
|
475
|
+
Then the agent runs "git diff" and "git diff --staged"
|
|
476
|
+
And reviews only uncommitted changes
|
|
477
|
+
|
|
478
|
+
Scenario: Executive summary provides "aha moment"
|
|
479
|
+
Given a diff review has been generated
|
|
480
|
+
Then the executive summary section uses hero depth styling
|
|
481
|
+
And it leads with WHY the changes exist
|
|
482
|
+
And provides the core insight
|
|
483
|
+
And a reader of only this section understands the essence of the change
|
|
484
|
+
|
|
485
|
+
Scenario: Code review has Good/Bad/Ugly structure
|
|
486
|
+
Given a diff review has been generated
|
|
487
|
+
Then the code review section has 4 categories: Good, Bad, Ugly, Questions
|
|
488
|
+
And each uses colored left-border cards (green, red, amber, blue)
|
|
489
|
+
And each item references specific files and line ranges
|
|
490
|
+
And empty categories say "None found" rather than being omitted
|
|
491
|
+
|
|
492
|
+
Scenario: Decision log captures rationale
|
|
493
|
+
Given a diff review has been generated
|
|
494
|
+
Then each decision card has: decision, rationale, alternatives, confidence
|
|
495
|
+
And confidence levels have visual treatment: green (high), blue (medium), amber (low)
|
|
496
|
+
And low-confidence items warn "document before committing"
|
|
497
|
+
|
|
498
|
+
Scenario: Mermaid diagram has zoom controls
|
|
499
|
+
Given a diff review contains a Mermaid dependency graph
|
|
500
|
+
Then the diagram is wrapped in .mermaid-wrap container
|
|
501
|
+
And has zoom controls: +, -, reset, 1:1, expand
|
|
502
|
+
And supports Ctrl/Cmd+scroll zoom
|
|
503
|
+
And supports click-and-drag panning
|
|
504
|
+
And clicking without dragging opens full-size in new tab
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
### Plan Review
|
|
508
|
+
|
|
509
|
+
```gherkin
|
|
510
|
+
Feature: Plan Review
|
|
511
|
+
As a developer
|
|
512
|
+
I want to compare a plan against the actual codebase
|
|
513
|
+
So that I can identify gaps, risks, and incorrect assumptions before implementation
|
|
514
|
+
|
|
515
|
+
Scenario: Plan review with plan file path
|
|
516
|
+
Given the user invokes "/plan-review docs/plan.md"
|
|
517
|
+
Then the agent reads the plan file in full
|
|
518
|
+
And reads every file the plan references
|
|
519
|
+
And reads files that import/depend on referenced files
|
|
520
|
+
And maps the blast radius
|
|
521
|
+
And cross-references plan claims against actual code
|
|
522
|
+
And generates a verification fact sheet
|
|
523
|
+
And generates an HTML page with all 9 sections
|
|
524
|
+
|
|
525
|
+
Scenario: Current vs planned architecture diagrams
|
|
526
|
+
Given a plan review has been generated
|
|
527
|
+
Then the current architecture Mermaid diagram uses the same node names as the planned diagram
|
|
528
|
+
And the layout direction matches between both diagrams
|
|
529
|
+
And new nodes in the planned diagram are highlighted with accent borders
|
|
530
|
+
And removed nodes have reduced opacity or strikethrough
|
|
531
|
+
|
|
532
|
+
Scenario: Risk assessment includes cognitive complexity
|
|
533
|
+
Given a plan review has been generated
|
|
534
|
+
Then the risk assessment section includes cognitive complexity flags
|
|
535
|
+
And each flag has a severity indicator (high/medium/low)
|
|
536
|
+
And each has a concrete mitigation suggestion
|
|
537
|
+
And cognitive complexity is distinct from bug risk
|
|
538
|
+
|
|
539
|
+
Scenario: Understanding gaps dashboard
|
|
540
|
+
Given a plan review has been generated
|
|
541
|
+
Then the closing section rolls up rationale gaps and complexity flags
|
|
542
|
+
And includes a visual bar chart of clear vs missing rationale
|
|
543
|
+
And provides explicit recommendations for pre-implementation documentation
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
### Project Recap
|
|
547
|
+
|
|
548
|
+
```gherkin
|
|
549
|
+
Feature: Project Recap
|
|
550
|
+
As a developer returning to a project after time away
|
|
551
|
+
I want a visual mental model snapshot
|
|
552
|
+
So that I can quickly re-orient and resume productive work
|
|
553
|
+
|
|
554
|
+
Scenario: Default 2-week recap
|
|
555
|
+
Given the user invokes "/project-recap" with no argument
|
|
556
|
+
Then the agent uses a 2-week time window
|
|
557
|
+
And reads README.md, CHANGELOG.md, package.json
|
|
558
|
+
And runs git log --since="2 weeks ago"
|
|
559
|
+
And checks for uncommitted changes and stale branches
|
|
560
|
+
And reads recent commit messages for decision context
|
|
561
|
+
And generates an 8-section HTML page
|
|
562
|
+
|
|
563
|
+
Scenario: Custom time window
|
|
564
|
+
Given the user invokes "/project-recap 3m"
|
|
565
|
+
Then the agent uses a 3-month time window
|
|
566
|
+
And adjusts git log --since="3 months ago"
|
|
567
|
+
|
|
568
|
+
Scenario: Cognitive debt hotspots are surfaced
|
|
569
|
+
Given a project recap has been generated
|
|
570
|
+
Then the cognitive debt section uses amber-tinted cards
|
|
571
|
+
And each hotspot has a severity indicator (red/amber/blue left border)
|
|
572
|
+
And each has a concrete suggestion for remediation
|
|
573
|
+
And areas include: undocumented changes, untested complex modules, overlapping modifications
|
|
574
|
+
|
|
575
|
+
Scenario: Architecture snapshot is the visual anchor
|
|
576
|
+
Given a project recap has been generated
|
|
577
|
+
Then the architecture Mermaid diagram uses hero depth styling
|
|
578
|
+
And labels nodes with what they DO, not just file names
|
|
579
|
+
And the rest of the page conceptually hangs off this diagram
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
### Slide Deck Mode
|
|
583
|
+
|
|
584
|
+
```gherkin
|
|
585
|
+
Feature: Slide Deck Mode
|
|
586
|
+
As a presenter
|
|
587
|
+
I want to convert technical content into a presentation
|
|
588
|
+
So that I can present findings to a team
|
|
589
|
+
|
|
590
|
+
Scenario: Slide deck is opt-in only
|
|
591
|
+
Given the visual-explainer skill is loaded
|
|
592
|
+
When the agent encounters complex content
|
|
593
|
+
Then it NEVER auto-selects slide format
|
|
594
|
+
And slides are only generated via /generate-slides, --slides flag, or explicit request
|
|
595
|
+
|
|
596
|
+
Scenario: Generate slides command
|
|
597
|
+
Given the user invokes "/generate-slides API Gateway Redesign"
|
|
598
|
+
Then the agent reads slide-patterns.md and slide-deck.html template
|
|
599
|
+
And picks one of the 4 slide presets or adapts an existing aesthetic
|
|
600
|
+
And plans the slide sequence with compositions before writing HTML
|
|
601
|
+
And generates a scroll-snap deck with 100dvh slides
|
|
602
|
+
And writes to ~/.agent/diagrams/ and opens in browser
|
|
603
|
+
|
|
604
|
+
Scenario: --slides flag on diff-review
|
|
605
|
+
Given the user invokes "/diff-review main --slides"
|
|
606
|
+
Then the agent gathers data using diff-review's normal process
|
|
607
|
+
But presents content as a slide deck instead of scrollable page
|
|
608
|
+
And coverage matches what the scrollable version would have included
|
|
609
|
+
|
|
610
|
+
Scenario: Content completeness in slides
|
|
611
|
+
Given a source document has 7 sections and 6 decisions
|
|
612
|
+
Then the slide deck covers all 7 sections
|
|
613
|
+
And presents all 6 decisions
|
|
614
|
+
And collapsible details from the source become their own slides
|
|
615
|
+
And a 22-slide complete deck beats a 13-slide polished but incomplete deck
|
|
616
|
+
|
|
617
|
+
Scenario: Slide navigation works
|
|
618
|
+
Given a slide deck is displayed
|
|
619
|
+
When the user presses ArrowRight or ArrowDown
|
|
620
|
+
Then the next slide scrolls into view smoothly
|
|
621
|
+
When the user presses ArrowLeft or ArrowUp
|
|
622
|
+
Then the previous slide scrolls into view
|
|
623
|
+
And Space, PageDown, PageUp, Home, End keys also work
|
|
624
|
+
And touch swipe (>50px) navigates between slides
|
|
625
|
+
And a progress bar shows current position
|
|
626
|
+
And nav dots on the right indicate all slides with clickable navigation
|
|
627
|
+
And a slide counter shows "X / Y"
|
|
628
|
+
|
|
629
|
+
Scenario: Keyboard navigation skips interactive elements
|
|
630
|
+
Given a slide deck has a Mermaid diagram or scrollable table
|
|
631
|
+
When keyboard focus is inside .mermaid-wrap, .table-scroll, or .code-scroll
|
|
632
|
+
Then arrow keys do NOT trigger slide navigation
|
|
633
|
+
And are handled by the interactive element instead
|
|
634
|
+
|
|
635
|
+
Scenario: Slide transitions are cinematic
|
|
636
|
+
Given a slide scrolls into view
|
|
637
|
+
Then it fades in from opacity 0 with translateY(40px) and scale(0.98)
|
|
638
|
+
And child elements with .reveal class stagger in at 0.1s intervals
|
|
639
|
+
And transitions use cubic-bezier(0.16, 1, 0.3, 1) easing
|
|
640
|
+
And @media (prefers-reduced-motion: reduce) disables all transitions
|
|
641
|
+
|
|
642
|
+
Scenario: Compositional variety
|
|
643
|
+
Given a slide deck is being generated
|
|
644
|
+
Then consecutive slides vary their spatial approach
|
|
645
|
+
And the deck alternates between centered, left-heavy, right-heavy, split, edge-aligned, and full-bleed
|
|
646
|
+
And three centered slides in a row means at least one gets pushed off-axis
|
|
647
|
+
```
|
|
648
|
+
|
|
649
|
+
### Fact Check
|
|
650
|
+
|
|
651
|
+
```gherkin
|
|
652
|
+
Feature: Fact Check
|
|
653
|
+
As a developer
|
|
654
|
+
I want to verify that generated documents match the actual code
|
|
655
|
+
So that I can trust the information in reviews and plans
|
|
656
|
+
|
|
657
|
+
Scenario: Fact check the most recent diagram
|
|
658
|
+
Given the user invokes "/fact-check" with no argument
|
|
659
|
+
Then the agent finds the most recently modified HTML in ~/.agent/diagrams/
|
|
660
|
+
And extracts every verifiable claim
|
|
661
|
+
And verifies each against the actual codebase
|
|
662
|
+
And corrects inaccuracies in place
|
|
663
|
+
And adds a verification summary section
|
|
664
|
+
And reports results
|
|
665
|
+
|
|
666
|
+
Scenario: Fact check a specific file
|
|
667
|
+
Given the user invokes "/fact-check ~/.agent/diagrams/diff-review.html"
|
|
668
|
+
Then the agent reads that specific file
|
|
669
|
+
And proceeds with the standard verification process
|
|
670
|
+
|
|
671
|
+
Scenario: Claims are classified
|
|
672
|
+
Given a fact check is in progress
|
|
673
|
+
Then each claim is classified as Confirmed, Corrected, or Unverifiable
|
|
674
|
+
And the verification summary includes counts for each category
|
|
675
|
+
And corrections list what was fixed with specific details
|
|
676
|
+
|
|
677
|
+
Scenario: Corrections preserve page structure
|
|
678
|
+
Given corrections are being applied to an HTML file
|
|
679
|
+
Then layout, CSS, animations, and Mermaid diagrams are preserved
|
|
680
|
+
And only factual content is changed
|
|
681
|
+
And subjective analysis is never modified
|
|
682
|
+
```
|
|
683
|
+
|
|
684
|
+
### Share/Deploy
|
|
685
|
+
|
|
686
|
+
```gherkin
|
|
687
|
+
Feature: Share via Vercel
|
|
688
|
+
As a developer
|
|
689
|
+
I want to share generated pages with a live URL
|
|
690
|
+
So that teammates can view them without local file access
|
|
691
|
+
|
|
692
|
+
Scenario: Share a diagram
|
|
693
|
+
Given the user invokes "/share ~/.agent/diagrams/my-diagram.html"
|
|
694
|
+
And vercel-deploy skill is installed
|
|
695
|
+
Then the script copies the HTML to a temp directory as index.html
|
|
696
|
+
And deploys via vercel-deploy
|
|
697
|
+
And returns a live URL immediately
|
|
698
|
+
And returns a claim URL for account transfer
|
|
699
|
+
And the deployment is public
|
|
700
|
+
|
|
701
|
+
Scenario: Share without vercel-deploy
|
|
702
|
+
Given the user invokes "/share"
|
|
703
|
+
But vercel-deploy skill is NOT installed
|
|
704
|
+
Then the script errors with "vercel-deploy skill not found"
|
|
705
|
+
And suggests "pi install npm:vercel-deploy"
|
|
706
|
+
|
|
707
|
+
Scenario: Share with invalid file
|
|
708
|
+
Given the user invokes "/share nonexistent.html"
|
|
709
|
+
Then the script errors with "File not found"
|
|
710
|
+
```
|
|
711
|
+
|
|
712
|
+
### Theme Switching
|
|
713
|
+
|
|
714
|
+
```gherkin
|
|
715
|
+
Feature: Theme Support
|
|
716
|
+
As a user
|
|
717
|
+
I want pages to respect my OS color scheme
|
|
718
|
+
So that the visual output matches my environment
|
|
719
|
+
|
|
720
|
+
Scenario: Automatic theme detection
|
|
721
|
+
Given a page is generated with CSS custom properties
|
|
722
|
+
And :root defines light values
|
|
723
|
+
And @media (prefers-color-scheme: dark) defines dark values
|
|
724
|
+
When the OS is in light mode
|
|
725
|
+
Then the page renders with light palette
|
|
726
|
+
When the OS switches to dark mode
|
|
727
|
+
Then the page renders with dark palette
|
|
728
|
+
And no page reload is required for CSS-only elements
|
|
729
|
+
|
|
730
|
+
Scenario: Mermaid uses static theme
|
|
731
|
+
Given a page contains a Mermaid diagram
|
|
732
|
+
Then the Mermaid theme is determined once at load time via matchMedia
|
|
733
|
+
And does NOT reactively switch when OS theme changes
|
|
734
|
+
And CSS overrides on the container still respond to prefers-color-scheme
|
|
735
|
+
|
|
736
|
+
Scenario: Optional manual theme toggle
|
|
737
|
+
Given a page includes the theme toggle pattern
|
|
738
|
+
Then a toggle button appears in the top-right corner
|
|
739
|
+
And clicking switches between data-theme="light" and data-theme="dark"
|
|
740
|
+
And the toggle has sun/moon SVG icons
|
|
741
|
+
```
|
|
742
|
+
|
|
743
|
+
---
|
|
744
|
+
|
|
745
|
+
## 6. Design System / CSS Patterns
|
|
746
|
+
|
|
747
|
+
### Design Tokens (CSS Custom Properties)
|
|
748
|
+
|
|
749
|
+
**Required minimum set:**
|
|
750
|
+
```
|
|
751
|
+
--font-body Body text font family
|
|
752
|
+
--font-mono Monospace font family
|
|
753
|
+
--bg Page background
|
|
754
|
+
--surface Card/container background
|
|
755
|
+
--surface-elevated Elevated card background (optional)
|
|
756
|
+
--surface2 Secondary surface (optional)
|
|
757
|
+
--border Low-opacity border (rgba, ~0.06-0.08 alpha)
|
|
758
|
+
--border-bright Visible border (rgba, ~0.12-0.15 alpha)
|
|
759
|
+
--text Primary text color
|
|
760
|
+
--text-dim Dimmed/secondary text color
|
|
761
|
+
--accent Primary accent color
|
|
762
|
+
--accent-dim Accent at ~0.08-0.12 alpha
|
|
763
|
+
--node-a/b/c Semantic accent colors for diagram elements (with -dim variants)
|
|
764
|
+
--green/red/orange Status colors (with -dim variants)
|
|
765
|
+
--code-bg Code block background (optional, for slides)
|
|
766
|
+
--code-text Code block text color (optional)
|
|
767
|
+
```
|
|
768
|
+
|
|
769
|
+
### Surface Depth Tiers
|
|
770
|
+
| Tier | Use | Background | Shadow |
|
|
771
|
+
|------|-----|-----------|--------|
|
|
772
|
+
| Hero | Executive summary, focal elements | accent-tinted via color-mix | 4px 20px spread |
|
|
773
|
+
| Elevated | KPIs, key sections | --surface-elevated | 2px 8px spread |
|
|
774
|
+
| Default | Standard cards | --surface | 1px border only |
|
|
775
|
+
| Recessed | Code blocks, secondary content | mixed bg/surface | Inset shadow |
|
|
776
|
+
| Glass | Special overlays (rare) | 60% surface + backdrop-filter: blur | Transparent border |
|
|
777
|
+
|
|
778
|
+
### Component Inventory
|
|
779
|
+
|
|
780
|
+
| Component | CSS Class | Usage |
|
|
781
|
+
|-----------|----------|-------|
|
|
782
|
+
| Card | `.ve-card` | Base container (NOT `.node` -- Mermaid collision) |
|
|
783
|
+
| Card variants | `.ve-card--elevated`, `--recessed`, `--hero`, `--glass` | Depth tiers |
|
|
784
|
+
| Card accent | `.ve-card--accent-a/b/c` | Colored left border |
|
|
785
|
+
| Card label | `.ve-card__label` | Monospace uppercase label with dot |
|
|
786
|
+
| Section label | `.section-label` + `.dot` | Section header with colored dot |
|
|
787
|
+
| Flow arrow | `.flow-arrow` | Vertical arrow with SVG icon and label |
|
|
788
|
+
| Pipeline | `.pipeline`, `.pipeline-step`, `.pipeline-arrow` | Horizontal step flow |
|
|
789
|
+
| Inner grid | `.inner-grid`, `.inner-card` | 2-column grid within a section card |
|
|
790
|
+
| Data table | `.data-table` in `.table-wrap` > `.table-scroll` | Styled HTML table |
|
|
791
|
+
| Status badge | `.status--match/gap/partial/info` | Colored status indicators with dots |
|
|
792
|
+
| Status dot | `.status-dot--match/gap/warn` | Compact dot indicators |
|
|
793
|
+
| KPI card | `.kpi-card`, `.kpi-card__value`, `.kpi-card__label` | Metric display |
|
|
794
|
+
| KPI row | `.kpi-row` | Auto-fit grid for KPI cards |
|
|
795
|
+
| Code block | `.code-block`, `.code-block--scroll` | Styled code with pre-wrap |
|
|
796
|
+
| Code file | `.code-file`, `.code-file__header`, `.code-file__body` | Code with file header |
|
|
797
|
+
| Directory tree | `.dir-tree` | Pre-formatted file tree |
|
|
798
|
+
| Diff panels | `.diff-panels`, `.diff-panel__header--before/after` | Before/after comparison |
|
|
799
|
+
| Collapsible | `details.collapsible` | Native details/summary with styled chevron |
|
|
800
|
+
| Callout | `.callout`, `.callout--info/warning/success` | Warning/tip/note boxes |
|
|
801
|
+
| Legend | `.legend`, `.legend-item`, `.legend-swatch` | Color legend |
|
|
802
|
+
| Tags | `.tag` | Small inline labels |
|
|
803
|
+
| Node list | `.node-list` | List with chevron markers |
|
|
804
|
+
| Responsive nav | `.toc`, `.wrap`, `.main` | Sidebar/horizontal TOC |
|
|
805
|
+
| Mermaid container | `.diagram-shell` > `.mermaid-wrap` > `.mermaid-viewport` > `.mermaid-canvas` | Full zoom/pan diagram |
|
|
806
|
+
| Zoom controls | `.zoom-controls` | +/-/reset/1:1/expand buttons |
|
|
807
|
+
| Prose | `.prose`, `.prose--narrow`, `.prose--wide` | Reading-optimized text |
|
|
808
|
+
| Lead paragraph | `.lead`, `.lead--dropcap` | Opening paragraph |
|
|
809
|
+
| Pull quote | `.pullquote`, `.pullquote--centered` | Highlighted quotes |
|
|
810
|
+
| Article hero | `.hero--centered`, `.hero--editorial` | Page headers |
|
|
811
|
+
| Theme toggle | `.theme-toggle` | Light/dark switch button |
|
|
812
|
+
| Sparkline | Inline SVG `<polyline>` | Simple inline charts |
|
|
813
|
+
| Progress bar | Inline div with CSS gradient | Simple progress |
|
|
814
|
+
|
|
815
|
+
### Slide-Specific Components
|
|
816
|
+
|
|
817
|
+
| Component | CSS Class | Usage |
|
|
818
|
+
|-----------|----------|-------|
|
|
819
|
+
| Deck container | `.deck` | Scroll-snap container |
|
|
820
|
+
| Slide base | `.slide` | 100dvh viewport slide |
|
|
821
|
+
| Slide types | `.slide--title/divider/content/split/diagram/dashboard/table/code/quote/bleed` | Layout variants |
|
|
822
|
+
| Display text | `.slide__display` | 48-120px hero text |
|
|
823
|
+
| Heading | `.slide__heading` | 28-48px heading |
|
|
824
|
+
| Body | `.slide__body` | 16-24px body text |
|
|
825
|
+
| Label | `.slide__label` | 10-14px mono uppercase |
|
|
826
|
+
| Subtitle | `.slide__subtitle` | 12-18px mono subtitle |
|
|
827
|
+
| Reveal | `.reveal` | Staggered child animation |
|
|
828
|
+
| Decorative SVG | `.slide__decor` | Absolute positioned accents |
|
|
829
|
+
| Section number | `.slide__number` | Giant decorative number |
|
|
830
|
+
| KPI value | `.slide__kpi-val` | 36-64px metric |
|
|
831
|
+
| Code block | `.slide__code-block`, `.slide__code-filename` | Code with floating filename |
|
|
832
|
+
| Quote mark | `.slide__quote-mark` | Giant decorative quotation mark |
|
|
833
|
+
| Background | `.slide__bg`, `.slide__bg--gradient` | Full-bleed backgrounds |
|
|
834
|
+
| Scrim | `.slide__scrim` | Gradient overlay for text readability |
|
|
835
|
+
| Panels | `.slide__panels`, `.slide__panel--primary/secondary` | Split layout panels |
|
|
836
|
+
| Bullets | `.slide__bullets` | Styled bullet list |
|
|
837
|
+
| CSS Pipeline | `.pipeline`, `.pipeline__step`, `.pipeline__arrow` | Step flow for slides |
|
|
838
|
+
| Progress bar | `.deck-progress` | Fixed top progress bar |
|
|
839
|
+
| Nav dots | `.deck-dots`, `.deck-dot` | Fixed right nav dots |
|
|
840
|
+
| Slide counter | `.deck-counter` | Fixed bottom-right counter |
|
|
841
|
+
| Hints | `.deck-hints` | Auto-fading keyboard hints |
|
|
842
|
+
|
|
843
|
+
### Animation Library
|
|
844
|
+
|
|
845
|
+
| Animation | Keyframe | Use for | Stagger |
|
|
846
|
+
|-----------|----------|---------|---------|
|
|
847
|
+
| fadeUp | opacity 0->1, translateY 12->0 | Cards, sections | `--i * 0.05s` |
|
|
848
|
+
| fadeScale | opacity 0->1, scale 0.92->1 | KPIs, badges | `--i * 0.06s` |
|
|
849
|
+
| drawIn | stroke-dashoffset to 0 | SVG connectors | `--i * 0.1s` |
|
|
850
|
+
| countUp | @property --count integer | Hero numbers | Single, 1.2s |
|
|
851
|
+
| Slide entrance | opacity, translateY(40px), scale(0.98) | Slides | 0.6s |
|
|
852
|
+
| Reveal | opacity, translateY(20px) | Slide children | nth-child * 0.1s |
|
|
853
|
+
|
|
854
|
+
---
|
|
855
|
+
|
|
856
|
+
## 7. Token Cost Analysis
|
|
857
|
+
|
|
858
|
+
### Current Approach: Full HTML Generation
|
|
859
|
+
|
|
860
|
+
Every invocation generates a complete HTML document from scratch. Typical token costs:
|
|
861
|
+
|
|
862
|
+
| Page Type | Estimated Output Tokens | Notes |
|
|
863
|
+
|-----------|------------------------|-------|
|
|
864
|
+
| Simple diagram | 3,000-5,000 | CSS + HTML, no JS |
|
|
865
|
+
| Mermaid diagram | 5,000-8,000 | CSS + HTML + ~200 lines zoom JS + Mermaid init |
|
|
866
|
+
| Data table | 4,000-7,000 | CSS + HTML table rows |
|
|
867
|
+
| Diff review | 12,000-20,000 | 10 sections, Mermaid, tables, KPIs, all inline CSS |
|
|
868
|
+
| Plan review | 10,000-18,000 | 9 sections, 2 Mermaid diagrams, tables |
|
|
869
|
+
| Project recap | 8,000-15,000 | 8 sections, Mermaid, KPIs |
|
|
870
|
+
| Slide deck | 15,000-25,000 | 15-25 slides, SlideEngine JS, Mermaid, all CSS |
|
|
871
|
+
|
|
872
|
+
**Input tokens per invocation** (reference material the agent reads):
|
|
873
|
+
| File | Lines | Estimated Tokens |
|
|
874
|
+
|------|-------|-----------------|
|
|
875
|
+
| SKILL.md | 475 | ~3,500 |
|
|
876
|
+
| css-patterns.md | ~1,700 | ~12,000 |
|
|
877
|
+
| libraries.md | ~612 | ~4,500 |
|
|
878
|
+
| responsive-nav.md | ~213 | ~1,500 |
|
|
879
|
+
| slide-patterns.md | ~1,300 | ~9,500 |
|
|
880
|
+
| Template HTML (1 of 4) | 300-900 | ~2,500-6,000 |
|
|
881
|
+
| **Total input per invocation** | | **~24,000-37,000** |
|
|
882
|
+
|
|
883
|
+
**Total cost per generation:**
|
|
884
|
+
- Simple: ~27,000-42,000 tokens (input + output)
|
|
885
|
+
- Complex: ~49,000-62,000 tokens (input + output)
|
|
886
|
+
|
|
887
|
+
### StreamWeaver DSL Approach (Estimated)
|
|
888
|
+
|
|
889
|
+
With a DSL, the agent would emit DSL calls instead of raw HTML. The reference material stays on the server side, not in the prompt.
|
|
890
|
+
|
|
891
|
+
**Input token savings:**
|
|
892
|
+
- No need to read css-patterns.md, libraries.md, etc. in the prompt
|
|
893
|
+
- SKILL.md equivalent would be much shorter (just DSL API reference)
|
|
894
|
+
- Estimated input: ~3,000-5,000 tokens (DSL API docs + command template)
|
|
895
|
+
|
|
896
|
+
**Output token savings:**
|
|
897
|
+
- DSL calls instead of full HTML: ~70-85% reduction
|
|
898
|
+
- A diff review that generates 15,000 tokens of HTML might need ~2,000-4,000 tokens of DSL calls
|
|
899
|
+
- No inline CSS duplication
|
|
900
|
+
- No boilerplate HTML structure
|
|
901
|
+
- Mermaid zoom/pan JS lives in the framework, not regenerated each time
|
|
902
|
+
|
|
903
|
+
**Estimated DSL costs:**
|
|
904
|
+
|
|
905
|
+
| Page Type | Estimated Output Tokens | Savings vs Current |
|
|
906
|
+
|-----------|------------------------|-------------------|
|
|
907
|
+
| Simple diagram | 500-1,000 | ~80% |
|
|
908
|
+
| Mermaid diagram | 800-1,500 | ~80% |
|
|
909
|
+
| Data table | 600-1,200 | ~80% |
|
|
910
|
+
| Diff review | 2,000-4,000 | ~80% |
|
|
911
|
+
| Plan review | 2,000-3,500 | ~80% |
|
|
912
|
+
| Project recap | 1,500-3,000 | ~80% |
|
|
913
|
+
| Slide deck | 3,000-6,000 | ~75% |
|
|
914
|
+
|
|
915
|
+
**Total DSL cost per generation:**
|
|
916
|
+
- Simple: ~3,500-6,000 tokens (vs 27,000-42,000) -- **~85% reduction**
|
|
917
|
+
- Complex: ~7,000-11,000 tokens (vs 49,000-62,000) -- **~82% reduction**
|
|
918
|
+
|
|
919
|
+
### Key Insight for the Port
|
|
920
|
+
|
|
921
|
+
The massive token cost is split between:
|
|
922
|
+
1. **Reference material in the prompt (~24,000-37,000 input tokens)** -- This is the design system, CSS patterns, Mermaid configuration, etc. In StreamWeaver, this lives in the framework as Ruby code and CSS files, costing 0 prompt tokens.
|
|
923
|
+
2. **Generated HTML/CSS/JS output (~3,000-25,000 output tokens)** -- This is the actual page content duplicated with inline styles every time. In StreamWeaver, the agent emits DSL calls like `mermaid_diagram(title: "...", code: "graph TD\n...")` and the framework handles rendering.
|
|
924
|
+
|
|
925
|
+
The design system itself (typography, color palettes, depth tiers, animation patterns, layout components, Mermaid zoom engine) is reusable infrastructure that belongs in the framework, not in every agent conversation.
|
|
926
|
+
|
|
927
|
+
---
|
|
928
|
+
|
|
929
|
+
## 8. Key Findings for StreamWeaver Port
|
|
930
|
+
|
|
931
|
+
### What Must Be Preserved
|
|
932
|
+
1. **Visual quality** -- The extensive anti-slop rules, font pairings, color palettes, and depth tiers are critical to the output quality
|
|
933
|
+
2. **Self-contained output** -- Single HTML file that works offline (except CDN fonts)
|
|
934
|
+
3. **Both themes** -- Every component must work in light and dark mode
|
|
935
|
+
4. **Mermaid zoom/pan** -- The ~200-line zoom engine is essential for usability
|
|
936
|
+
5. **Responsive nav** -- Sidebar TOC on desktop, horizontal bar on mobile
|
|
937
|
+
6. **Animation choreography** -- Staggered reveals guide the eye through hierarchy
|
|
938
|
+
7. **Data gathering workflows** -- Each command has specific git commands and codebase reads
|
|
939
|
+
8. **Verification checkpoints** -- Fact sheets before HTML generation prevent hallucinated data
|
|
940
|
+
|
|
941
|
+
### What StreamWeaver Adds
|
|
942
|
+
1. **Token efficiency** -- 80-85% reduction in per-generation token cost
|
|
943
|
+
2. **Consistent quality** -- Design system is enforced by framework, not agent memory
|
|
944
|
+
3. **Reactive updates** -- StreamWeaver's reactive model enables live-updating pages
|
|
945
|
+
4. **Component reuse** -- Mermaid zoom engine, slide engine, nav written once
|
|
946
|
+
5. **Ruby DSL** -- More concise than raw HTML, more expressive than templates
|
|
947
|
+
|
|
948
|
+
### Architecture Recommendation
|
|
949
|
+
The visual-explainer design system should map to StreamWeaver components:
|
|
950
|
+
|
|
951
|
+
| Visual Explainer Pattern | StreamWeaver Component |
|
|
952
|
+
|-------------------------|----------------------|
|
|
953
|
+
| `.ve-card` with depth tiers | `card(depth: :hero\|:elevated\|:default\|:recessed)` |
|
|
954
|
+
| `.data-table` with sticky headers | `data_table(headers: [...], rows: [...])` |
|
|
955
|
+
| `.mermaid-wrap` with zoom engine | `mermaid_diagram(code: "...")` |
|
|
956
|
+
| `.kpi-row` + `.kpi-card` | `kpi_dashboard(metrics: [...])` |
|
|
957
|
+
| `.diff-panels` | `comparison(before: ..., after: ...)` |
|
|
958
|
+
| `.pipeline` | `pipeline(steps: [...])` |
|
|
959
|
+
| `details.collapsible` | `collapsible(title: "...") { ... }` |
|
|
960
|
+
| Responsive TOC | `page_with_nav(sections: [...])` |
|
|
961
|
+
| Slide deck | `slide_deck { slide(:title) { ... } }` |
|
|
962
|
+
| Theme tokens | Framework-level CSS with preset selection |
|
|
963
|
+
| Staggered animations | Automatic based on render order |
|
|
964
|
+
| Font pairing selection | `theme(preset: :editorial)` or auto-rotation |
|