minimal-agent 0.9.0 → 0.10.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.
- package/README.md +11 -8
- package/package.json +34 -1
- package/plugins/cron-runner/.claude-plugin/plugin.json +5 -0
- package/plugins/cron-runner/commands/cron.md +26 -0
- package/plugins/cron-runner/commands/crons.md +7 -0
- package/plugins/cron-runner/plugin.js +34 -0
- package/plugins/cron-runner/src/commands.js +348 -0
- package/plugins/cron-runner/src/cronTime.js +148 -0
- package/plugins/cron-runner/src/lock.js +68 -0
- package/plugins/cron-runner/src/runs.js +89 -0
- package/plugins/cron-runner/src/scheduleEngine.js +72 -0
- package/plugins/cron-runner/src/scheduler.js +355 -0
- package/plugins/cron-runner/src/schema.js +140 -0
- package/plugins/cron-runner/src/service.js +167 -0
- package/plugins/cron-runner/src/store.js +298 -0
- package/plugins/cron-runner/src/types.js +1 -0
- package/plugins/workflow-runner/commands/workflow.md +4 -4
- package/plugins/workflow-runner/commands/workflows.md +1 -1
- package/plugins/workflow-runner/plugin.js +2 -1
- package/plugins/workflow-runner/src/agentCommon.js +172 -9
- package/plugins/workflow-runner/src/dslManifest.js +72 -0
- package/plugins/workflow-runner/src/expressions.js +150 -13
- package/plugins/workflow-runner/src/index.js +39 -8
- package/plugins/workflow-runner/src/loader.js +216 -64
- package/plugins/workflow-runner/src/multimodal.js +37 -0
- package/plugins/workflow-runner/src/recovery.js +26 -24
- package/plugins/workflow-runner/src/runner.js +693 -287
- package/plugins/workflow-runner/src/stepExecutors/agent.js +126 -37
- package/plugins/workflow-runner/src/stepExecutors/assert.js +3 -2
- package/plugins/workflow-runner/src/stepExecutors/llm.js +38 -30
- package/plugins/workflow-runner/src/stepExecutors/skill.js +27 -38
- package/plugins/workflow-runner/src/stepExecutors/tool.js +56 -3
- package/plugins/workflow-runner/src/stepExecutors/verify.js +19 -10
- package/plugins/workflow-runner/src/taskIdentity.js +185 -30
- package/plugins/workflow-runner/src/types.js +18 -7
- package/plugins/workflow-runner/src/workflowState.js +355 -55
- package/skills/ai-image/SKILL.md +89 -0
- package/skills/ai-image/scripts/generate.mjs +497 -0
- package/skills/ai-image/scripts/generate_from_plan.mjs +469 -0
- package/skills/ai-image/scripts/generate_from_plan_test.mjs +223 -0
- package/skills/ai-image/scripts/generate_test.mjs +74 -0
- package/skills/browser-automation/SKILL.md +47 -0
- package/skills/docx/SKILL.md +25 -3
- package/skills/docx/scripts/office/helpers/__pycache__/__init__.cpython-314.pyc +0 -0
- package/skills/docx/scripts/office/helpers/__pycache__/merge_runs.cpython-314.pyc +0 -0
- package/skills/docx/scripts/office/helpers/__pycache__/simplify_redlines.cpython-314.pyc +0 -0
- package/skills/docx/scripts/office/validators/__pycache__/__init__.cpython-314.pyc +0 -0
- package/skills/docx/scripts/office/validators/__pycache__/base.cpython-314.pyc +0 -0
- package/skills/docx/scripts/office/validators/__pycache__/docx.cpython-314.pyc +0 -0
- package/skills/docx/scripts/office/validators/__pycache__/pptx.cpython-314.pyc +0 -0
- package/skills/docx/scripts/office/validators/__pycache__/redlining.cpython-314.pyc +0 -0
- package/skills/docx/scripts/opc_check.py +253 -0
- package/skills/image-gen-openrouter/SKILL.md +10 -2
- package/skills/image-stats/SKILL.md +65 -0
- package/skills/image-stats/scripts/__pycache__/image_stats.cpython-314.pyc +0 -0
- package/skills/image-stats/scripts/__pycache__/image_stats_test.cpython-314.pyc +0 -0
- package/skills/image-stats/scripts/image_stats.py +368 -0
- package/skills/image-stats/scripts/image_stats_test.py +181 -0
- package/skills/pptx/SKILL.md +123 -95
- package/skills/pptx/design.md +82 -0
- package/skills/pptx/examples/README.md +29 -0
- package/skills/pptx/examples/hybrid_example.mjs +107 -0
- package/skills/pptx/examples/hybrid_example.pptx +0 -0
- package/skills/pptx/pptxgenjs.md +41 -0
- package/skills/pptx/scripts/deck_helpers.mjs +224 -0
- package/skills/pptx/scripts/layout_lint.py +293 -0
- package/skills/pptx/scripts/layout_lint_test.py +160 -0
- package/skills/pptx/scripts/opc_check.py +339 -0
- package/skills/pptx/scripts/svg_fallback.mjs +145 -0
- package/skills/pptx/svg.md +67 -0
- package/skills/tts-zh/SKILL.md +19 -2
- package/skills/ui-design/SKILL.md +158 -0
- package/skills/ui-design/claude_design.md +309 -0
- package/skills/ui-design/evals/evals.json +254 -0
- package/skills/ui-design/references/aesthetic-direction.md +83 -0
- package/skills/ui-design/references/claude-design-protocol.md +36 -0
- package/skills/ui-design/references/design-context.md +53 -0
- package/skills/ui-design/references/design-execution-playbook.md +82 -0
- package/skills/ui-design/references/export-pptx.md +124 -0
- package/skills/ui-design/references/layout-composition.md +654 -0
- package/skills/ui-design/references/preview-feedback.md +37 -0
- package/skills/ui-design/references/source-image-layout.md +189 -0
- package/skills/ui-design/references/starter-components.md +78 -0
- package/skills/ui-design/references/vi-aegis-vector.md +144 -0
- package/skills/ui-design/references/vi-amber-prism.md +133 -0
- package/skills/ui-design/references/vi-aqua-glass.md +200 -0
- package/skills/ui-design/references/vi-comfort-vision.md +147 -0
- package/skills/ui-design/references/vi-ember-prism.md +140 -0
- package/skills/ui-design/references/vi-nebula-console.md +151 -0
- package/skills/ui-design/references/vi-obsidian-optics.md +139 -0
- package/skills/ui-design/references/vi-obsidian-xui.md +143 -0
- package/skills/ui-design/references/vi-precision-horizon-dark.md +117 -0
- package/skills/ui-design/references/vi-precision-horizon.md +215 -0
- package/skills/ui-design/references/vi-solar-relay.md +130 -0
- package/skills/ui-design/references/vi-template-workflow.md +48 -0
- package/skills/ui-design/references/vi-verdant-grid.md +141 -0
- package/skills/ui-design/references/vi-violet-meridian.md +172 -0
- package/skills/ui-design/scripts/__pycache__/assemble_material.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/assemble_material_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/chart_sanity_check.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/check_language_policy.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/check_ui_artifact.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/check_ui_artifact_pptx_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/deck_pages_check.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/deck_pages_check_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/deck_visual_style_check.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/deck_visual_style_check_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/design_budget_check.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/design_budget_check_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/design_repair_hints.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/design_repair_hints_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/design_style_check.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/design_style_check_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/draft_coverage_check.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/extract_source_assets.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/extract_source_assets_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/generated_image_review_collect.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/generated_image_review_collect_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/image_plan_lint.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/image_plan_lint_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/image_prompt_rewrite.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/image_prompt_rewrite_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/layout_balance.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/layout_balance_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/normalize_design_json.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/normalize_design_json_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/plan_source_layout.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/plan_source_layout_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/resolve_source_hint.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/resolve_source_hint_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/resolve_source_input.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/resolve_source_input_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/scaffold_ui_artifact.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/source_usage_check.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/source_usage_check_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/text_readability_pixel.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/visual_quality_gate.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/visual_quality_gate_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/assemble_material.py +217 -0
- package/skills/ui-design/scripts/assemble_material_test.py +149 -0
- package/skills/ui-design/scripts/browser_check_ui_artifact.mjs +221 -0
- package/skills/ui-design/scripts/chart_sanity_check.py +261 -0
- package/skills/ui-design/scripts/chart_sanity_check_test.py +165 -0
- package/skills/ui-design/scripts/check_language_policy.py +351 -0
- package/skills/ui-design/scripts/check_ui_artifact.py +435 -0
- package/skills/ui-design/scripts/check_ui_artifact_pptx_test.py +251 -0
- package/skills/ui-design/scripts/deck_pages_check.py +158 -0
- package/skills/ui-design/scripts/deck_pages_check_test.py +134 -0
- package/skills/ui-design/scripts/deck_visual_style_check.py +767 -0
- package/skills/ui-design/scripts/deck_visual_style_check_test.py +713 -0
- package/skills/ui-design/scripts/design_budget_check.py +271 -0
- package/skills/ui-design/scripts/design_budget_check_test.py +183 -0
- package/skills/ui-design/scripts/design_repair_hints.py +162 -0
- package/skills/ui-design/scripts/design_repair_hints_test.py +54 -0
- package/skills/ui-design/scripts/design_style_check.py +397 -0
- package/skills/ui-design/scripts/design_style_check_test.py +233 -0
- package/skills/ui-design/scripts/draft_coverage_check.py +184 -0
- package/skills/ui-design/scripts/draft_coverage_check_test.py +131 -0
- package/skills/ui-design/scripts/export_pptx_from_html.mjs +2367 -0
- package/skills/ui-design/scripts/extract_source_assets.py +607 -0
- package/skills/ui-design/scripts/extract_source_assets_test.py +256 -0
- package/skills/ui-design/scripts/generated_image_review_collect.py +206 -0
- package/skills/ui-design/scripts/generated_image_review_collect_test.py +91 -0
- package/skills/ui-design/scripts/image_plan_lint.py +571 -0
- package/skills/ui-design/scripts/image_plan_lint_test.py +515 -0
- package/skills/ui-design/scripts/image_prompt_rewrite.py +713 -0
- package/skills/ui-design/scripts/image_prompt_rewrite_test.py +966 -0
- package/skills/ui-design/scripts/layout_balance.py +881 -0
- package/skills/ui-design/scripts/layout_balance_test.py +927 -0
- package/skills/ui-design/scripts/normalize_design_json.py +272 -0
- package/skills/ui-design/scripts/normalize_design_json_test.py +119 -0
- package/skills/ui-design/scripts/plan_source_layout.py +1450 -0
- package/skills/ui-design/scripts/plan_source_layout_test.py +1136 -0
- package/skills/ui-design/scripts/resolve_source_input.py +270 -0
- package/skills/ui-design/scripts/resolve_source_input_test.py +98 -0
- package/skills/ui-design/scripts/scaffold_ui_artifact.py +377 -0
- package/skills/ui-design/scripts/source_usage_check.py +581 -0
- package/skills/ui-design/scripts/source_usage_check_test.py +427 -0
- package/skills/ui-design/scripts/text_readability_pixel.py +340 -0
- package/skills/ui-design/scripts/text_readability_pixel_test.py +219 -0
- package/skills/ui-design/scripts/visual_quality_gate.py +301 -0
- package/skills/ui-design/scripts/visual_quality_gate_test.py +233 -0
- package/skills/ui-design/tests/e2e/prompts/deck.md +19 -0
- package/skills/ui-design/tests/e2e/prompts/webpage.md +17 -0
- package/skills/ui-design/tests/e2e/render_check.mjs +101 -0
- package/skills/ui-design/tests/e2e/rubric.json +54 -0
- package/skills/ui-design/tests/e2e/runs/aegis-vector-preview-1/checks/browser-check.json +49 -0
- package/skills/ui-design/tests/e2e/runs/aegis-vector-preview-1/checks/language-check.txt +12 -0
- package/skills/ui-design/tests/e2e/runs/aegis-vector-preview-1/checks/static-check.txt +15 -0
- package/skills/ui-design/tests/e2e/runs/aegis-vector-preview-1/outputs/index.html +837 -0
- package/skills/ui-design/tests/e2e/runs/aegis-vector-preview-1/prompt.md +12 -0
- package/skills/ui-design/tests/e2e/runs/aegis-vector-preview-1/review.md +21 -0
- package/skills/ui-design/tests/e2e/runs/aegis-vector-preview-1/screenshots/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/aegis-vector-preview-1/screenshots/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/outputs/homepage.html +373 -0
- package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/outputs/platform.html +378 -0
- package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/prompt.md +13 -0
- package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/review.md +26 -0
- package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/screenshots/homepage/browser-check.json +49 -0
- package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/screenshots/homepage/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/screenshots/homepage/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/screenshots/platform/browser-check.json +49 -0
- package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/screenshots/platform/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/screenshots/platform/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-iteration-1/checks/static-check.txt +2 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-iteration-1/outputs/index.html +656 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-iteration-1/prompt.md +12 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-iteration-1/render_check.mjs +67 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-iteration-2/checks/static-check.txt +2 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-iteration-2/outputs/index.html +587 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-iteration-2/prompt.md +12 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-iteration-2/review.md +36 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-volcano-refresh-1/checks/browser-check.json +49 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-volcano-refresh-1/checks/language-check.txt +8 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-volcano-refresh-1/checks/static-check.txt +16 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-volcano-refresh-1/outputs/index.html +739 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-volcano-refresh-1/prompt.md +11 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-volcano-refresh-1/review.md +22 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-volcano-refresh-1/screenshots/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-volcano-refresh-1/screenshots/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/comfort-vision-preview-1/checks/browser-check.json +52 -0
- package/skills/ui-design/tests/e2e/runs/comfort-vision-preview-1/outputs/index.html +641 -0
- package/skills/ui-design/tests/e2e/runs/comfort-vision-preview-1/screenshots/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/comfort-vision-preview-1/screenshots/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-red-preview-1/outputs/index.html +467 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-red-preview-1/screenshots/browser-check.json +49 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-red-preview-1/screenshots/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-red-preview-1/screenshots/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/outputs/homepage.html +373 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/outputs/platform.html +378 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/prompt.md +13 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/review.md +26 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/screenshots/homepage/browser-check.json +49 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/screenshots/homepage/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/screenshots/homepage/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/screenshots/platform/browser-check.json +49 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/screenshots/platform/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/screenshots/platform/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/empty-agent-protocol-check/checks/browser-check.json +49 -0
- package/skills/ui-design/tests/e2e/runs/empty-agent-protocol-check/checks/language-check.txt +4 -0
- package/skills/ui-design/tests/e2e/runs/empty-agent-protocol-check/checks/static-check.txt +2 -0
- package/skills/ui-design/tests/e2e/runs/empty-agent-protocol-check/execution_notes.md +10 -0
- package/skills/ui-design/tests/e2e/runs/empty-agent-protocol-check/outputs/index.html +587 -0
- package/skills/ui-design/tests/e2e/runs/empty-agent-protocol-check/prompt.md +14 -0
- package/skills/ui-design/tests/e2e/runs/empty-agent-protocol-check/review.md +13 -0
- package/skills/ui-design/tests/e2e/runs/empty-agent-protocol-check/screenshots/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/empty-agent-protocol-check/screenshots/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/deck/checks/browser-check.json +24 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/deck/checks/static-check.txt +2 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/deck/execution_notes.md +21 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/deck/outputs/deck.html +451 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/deck/screenshots/slide-01.png +0 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/deck/screenshots/slide-02.png +0 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/review.md +79 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/webpage/checks/browser-check.json +26 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/webpage/checks/static-check.txt +2 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/webpage/execution_notes.md +20 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/webpage/outputs/index.html +534 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/webpage/screenshots/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/webpage/screenshots/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/checks/browser-check.json +64 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/checks/language-check.txt +7 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/checks/quick-validate.txt +1 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/checks/static-console.txt +2 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/checks/static-homepage.txt +2 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/outputs/console.html +600 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/outputs/homepage.html +556 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/prompt.md +29 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/review.md +57 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/screenshots/console-desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/screenshots/console-mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/screenshots/homepage-desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/screenshots/homepage-mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-optics-iteration-1/checks/browser-check.json +33 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-optics-iteration-1/checks/language-check.txt +6 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-optics-iteration-1/checks/quick-validate.txt +1 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-optics-iteration-1/checks/static-check.txt +2 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-optics-iteration-1/outputs/index.html +682 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-optics-iteration-1/prompt.md +13 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-optics-iteration-1/review.md +59 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-optics-iteration-1/screenshots/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-optics-iteration-1/screenshots/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-xui-screenshot-check-1/outputs/page-01.html +466 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-xui-screenshot-check-1/outputs/page-02.html +433 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-xui-screenshot-check-1/prompt.md +13 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-xui-screenshot-check-1/screenshots/page-01/browser-check.json +49 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-xui-screenshot-check-1/screenshots/page-01/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-xui-screenshot-check-1/screenshots/page-01/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-xui-screenshot-check-1/screenshots/page-02/browser-check.json +49 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-xui-screenshot-check-1/screenshots/page-02/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-xui-screenshot-check-1/screenshots/page-02/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-1/checks/browser-check.json +49 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-1/checks/language-check.txt +3 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-1/checks/static-check.txt +2 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-1/execution_notes.md +24 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-1/outputs/index.html +723 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-1/prompt.md +15 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-1/review.md +26 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-1/screenshots/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-1/screenshots/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/checks/browser-dark.json +49 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/checks/browser-light.json +49 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/checks/language-check.txt +11 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/checks/static-dark.txt +2 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/checks/static-light.txt +3 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/execution_notes.md +23 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/outputs/dark.html +392 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/outputs/light.html +476 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/prompt.md +23 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/review.md +41 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/screenshots/dark/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/screenshots/dark/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/screenshots/light/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/screenshots/light/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/solar-relay-iteration-1/checks/browser-check.json +54 -0
- package/skills/ui-design/tests/e2e/runs/solar-relay-iteration-1/checks/language-check.txt +5 -0
- package/skills/ui-design/tests/e2e/runs/solar-relay-iteration-1/checks/quick-validate.txt +1 -0
- package/skills/ui-design/tests/e2e/runs/solar-relay-iteration-1/checks/static-check.txt +2 -0
- package/skills/ui-design/tests/e2e/runs/solar-relay-iteration-1/outputs/index.html +765 -0
- package/skills/ui-design/tests/e2e/runs/solar-relay-iteration-1/prompt.md +15 -0
- package/skills/ui-design/tests/e2e/runs/solar-relay-iteration-1/review.md +59 -0
- package/skills/ui-design/tests/e2e/runs/solar-relay-iteration-1/screenshots/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/solar-relay-iteration-1/screenshots/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/verdant-grid-preview-1/outputs/index.html +508 -0
- package/skills/ui-design/tests/e2e/runs/verdant-grid-preview-1/screenshots/browser-check.json +49 -0
- package/skills/ui-design/tests/e2e/runs/verdant-grid-preview-1/screenshots/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/verdant-grid-preview-1/screenshots/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/violet-meridian-iteration-1/checks/browser-check.json +54 -0
- package/skills/ui-design/tests/e2e/runs/violet-meridian-iteration-1/checks/language-check.txt +6 -0
- package/skills/ui-design/tests/e2e/runs/violet-meridian-iteration-1/checks/quick-validate.txt +1 -0
- package/skills/ui-design/tests/e2e/runs/violet-meridian-iteration-1/checks/static-check.txt +2 -0
- package/skills/ui-design/tests/e2e/runs/violet-meridian-iteration-1/outputs/index.html +788 -0
- package/skills/ui-design/tests/e2e/runs/violet-meridian-iteration-1/prompt.md +14 -0
- package/skills/ui-design/tests/e2e/runs/violet-meridian-iteration-1/review.md +60 -0
- package/skills/ui-design/tests/e2e/runs/violet-meridian-iteration-1/screenshots/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/violet-meridian-iteration-1/screenshots/mobile.png +0 -0
- package/skills/video-compose/SKILL.md +8 -1
- package/skills/web-crawler/SKILL.md +70 -0
- package/skills/web-crawler/scripts/crawl.mjs +538 -0
- package/skills/web-crawler/scripts/crawl.test.mjs +204 -0
- package/skills/xlsx/SKILL.md +12 -0
- package/skills/xlsx/scripts/opc_check.py +253 -0
- package/src/advisorState.js +22 -0
- package/src/askBridge.js +87 -3
- package/src/bootstrap/workingDir.js +12 -1
- package/src/cli/args.js +17 -1
- package/src/cli/configMenu.js +236 -0
- package/src/cli/configWizard.js +7 -5
- package/src/cli/print.js +37 -4
- package/src/cli/streamJson.js +77 -24
- package/src/cli/wizards/advisorWizard.js +147 -0
- package/src/cli/wizards/fieldForm.js +149 -0
- package/src/cli/wizards/imageWizard.js +60 -0
- package/src/cli/wizards/openRouterWizard.js +23 -0
- package/src/cli/wizards/providerPresets.js +95 -0
- package/src/cli/wizards/providerWizard.js +219 -0
- package/src/cli/wizards/searchWizard.js +23 -0
- package/src/cli/wizards/ttsWizard.js +34 -0
- package/src/config/configFile.js +441 -83
- package/src/config/configService.js +446 -0
- package/src/config.js +24 -64
- package/src/context/agentHome.js +9 -0
- package/src/context/archive.js +3 -2
- package/src/context/compact.js +8 -5
- package/src/context/contextLock.js +81 -0
- package/src/context/persistContext.js +30 -11
- package/src/context/reactiveCompact.js +4 -2
- package/src/context/recentDirs.js +21 -61
- package/src/context/sessionPath.js +97 -23
- package/src/context/sessionRegistry.js +303 -24
- package/src/context/tokenCounter.js +18 -0
- package/src/context/workspaceIndex.js +731 -0
- package/src/infra/verification.js +3 -2
- package/src/llm/client.js +293 -206
- package/src/llm/providers/anthropicFormat.js +241 -0
- package/src/llm/providers/openaiFormat.js +190 -0
- package/src/loop.js +211 -27
- package/src/main.js +61 -11
- package/src/messageQueue.js +97 -0
- package/src/multimodal.js +203 -0
- package/src/plugin-sdk.js +15 -0
- package/src/plugins/commandRouter.js +3 -0
- package/src/plugins/hookEngine.js +5 -1
- package/src/plugins/pluginLifecycle.js +28 -0
- package/src/plugins/pluginRunner.js +40 -0
- package/src/plugins/transcript.js +4 -3
- package/src/prompts/pluginList.js +2 -2
- package/src/prompts/projectInstructions.js +3 -3
- package/src/prompts/promptAssembly.js +133 -109
- package/src/prompts/skillList.js +12 -22
- package/src/session/runAgentTurn.js +70 -0
- package/src/session/runTurn.js +41 -6
- package/src/toolGate.js +17 -0
- package/src/tools/advisor/advisor.js +379 -0
- package/src/tools/agent/agent.js +555 -0
- package/src/tools/agent/agentTypes.js +59 -0
- package/src/tools/agent/coordinator.js +93 -0
- package/src/tools/agent/worktree.js +270 -0
- package/src/tools/ask/ask.js +7 -2
- package/src/tools/bash/bash.js +112 -18
- package/src/tools/download/download.js +144 -0
- package/src/tools/edit/edit.js +1 -0
- package/src/tools/edit/multi-edit.js +1 -0
- package/src/tools/genimage/genimage.js +242 -0
- package/src/tools/genspeech/genspeech.js +67 -0
- package/src/tools/glob/glob.js +1 -0
- package/src/tools/grep/grep.js +3 -0
- package/src/tools/grep/rgPath.js +2 -0
- package/src/tools/index.js +25 -2
- package/src/tools/read/read.js +1 -0
- package/src/tools/shared/killTree.js +52 -0
- package/src/tools/toolProgressBridge.js +48 -0
- package/src/tools/webbrowser/agentBrowserPath.js +258 -0
- package/src/tools/webbrowser/browser.js +59 -42
- package/src/tools/webbrowser/browserControl.js +118 -0
- package/src/tools/webbrowser/browserDaemon.js +97 -0
- package/src/tools/webbrowser/browserService.js +27 -0
- package/src/tools/webbrowser/browserStream.js +119 -0
- package/src/tools/webbrowser/webbrowser.js +699 -130
- package/src/tools/webfetch/webfetch.js +1 -0
- package/src/tools/websearch/websearch.js +134 -51
- package/src/tools/write/write.js +1 -0
- package/src/ui/App.js +249 -22
- package/src/ui/AskQuestion.js +19 -17
- package/src/ui/InputBox.js +34 -9
- package/src/ui/LiveArea.js +112 -19
- package/src/ui/MessageList.js +100 -14
- package/src/ui/ModelPicker.js +56 -0
- package/src/ui/QueuedMessagesBanner.js +14 -0
- package/src/ui/Root.js +18 -10
- package/src/ui/SessionPicker.js +102 -0
- package/src/ui/StatusLine.js +13 -4
- package/src/ui/WorkspacePicker.js +55 -0
- package/src/ui/figures.js +44 -0
- package/src/ui/hooks/askSlot.js +82 -0
- package/src/ui/hooks/useChat.js +345 -64
- package/src/ui/hooks/usePasteHandler.js +11 -1
- package/src/ui/hooks/useTextBuffer.js +1 -3
- package/src/ui/liveViewport.js +5 -1
- package/src/ui/markdown.js +206 -0
- package/src/ui/textBuffer.js +0 -7
- package/src/ui/theme.js +32 -0
- package/src/utils/debugLog.js +0 -4
- package/src/utils/resourcePaths.js +2 -2
- package/src/utils/stripThink.js +50 -0
- package/src/web/browserBridge.js +447 -0
- package/src/web/protocol.js +19 -0
- package/workflows/adaptive-research.yaml +9 -2
- package/workflows/book-review-short.yaml +31 -7
- package/workflows/e2e-write-greet.yaml +3 -0
- package/workflows/illustrate.yaml +227 -0
- package/workflows/plan.yaml +437 -207
- package/workflows/ppt.yaml +1659 -0
- package/workflows/ralph-loop.yaml +142 -112
- package/workflows/schema.json +81 -23
- package/workflows/webppt.yaml +496 -0
- package/workflows/word.yaml +710 -0
- package/workflows/youtube-shorts.yaml +38 -10
- package/MINIMAL-TRACE.md +0 -77
- package/plugins/workflow-runner/src/voteHelpers.js +0 -110
- package/skills/config/SKILL.md +0 -123
- package/skills/frontend-design/LICENSE.txt +0 -177
- package/skills/frontend-design/SKILL.md +0 -42
- package/skills/pptx/scripts/office/__pycache__/soffice.cpython-314.pyc +0 -0
- package/src/ui/ProgressPanel.js +0 -54
- package/src/ui/StreamingBlock.js +0 -11
- package/src/ui/ToolStatus.js +0 -11
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""
|
|
4
|
+
chart_sanity_check.py —— SVG 图表「数据一致性 + 标签容纳性」确定性闸门(ppt 视觉门专用)。
|
|
5
|
+
|
|
6
|
+
为什么需要这个脚本(2026-07-02 逐页体检根因 ⑧)
|
|
7
|
+
====================
|
|
8
|
+
弱模型手写 SVG 图表会犯两类**几何可判**的错,此前无人检查、直接出货:
|
|
9
|
+
- 数据映射颠倒:标注 ~20% 的柱画得比 ~80% 的柱还大(真机 slide11 事故);
|
|
10
|
+
- 标签装不下:图内 <text> 估算宽度超出所属 <rect>(「蓝光 / 磁带」150px 塞进 120px 柱,
|
|
11
|
+
视觉上与相邻标签互撞——真机 slide11/19 事故)。
|
|
12
|
+
|
|
13
|
+
检查口径(fail-open:解析不了/配不上对/图元过多,一律跳过不误伤)
|
|
14
|
+
====================
|
|
15
|
+
逐 <section class="slide"> 找内联 <svg>:
|
|
16
|
+
A. 百分比柱一致性:`NN%` 文本按横向中心就近配对 <rect> 柱;≥2 对时,数值排序必须与
|
|
17
|
+
柱尺寸排序一致(纵柱比高、横柱比宽,5% 容差)→ 不一致 ERROR。
|
|
18
|
+
A2. 绝对数值柱一致性(2026-07-07 真机复盘:page10 成本结构图,柱内标签是 22,800 /
|
|
19
|
+
4,000–9,000 / 45,000 这类绝对数值而非百分比,check A 的 PERCENT_RE 完全配不上,
|
|
20
|
+
0 pairs 静默跳过——45,000 那根柱实际画得比 22,800 那根还窄,数据颠倒未被拦截):
|
|
21
|
+
锚点落在某 <rect> 内的纯数字/数字区间文本(同 B 的容纳关系,区间取均值),
|
|
22
|
+
≥2 个时同样按数值排序 vs 柱尺寸排序(5% 容差)校验,口径与 A 一致,只是配对方式
|
|
23
|
+
用「锚点在柱内」而非「横向就近」(这类绝对数值标签通常画在柱内部,比就近配对更准)。
|
|
24
|
+
B. 标签容纳性:锚点落在某 <rect> 内的 <text>,按字宽估算(CJK≈1.0×fontSize、其余≈0.6×)
|
|
25
|
+
超出该 rect 宽度 8% 以上 → ERROR(修法:加宽图形/缩短标签,不是缩字)。
|
|
26
|
+
|
|
27
|
+
仅标准库(re/json/argparse);生成的 SVG 是扁平结构(无 transform 嵌套),正则解析足够;
|
|
28
|
+
出现 transform 或 rect>12 的复杂图直接跳过(宁漏勿误)。
|
|
29
|
+
|
|
30
|
+
用法:python chart_sanity_check.py <deck.html> [-v]
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
import argparse
|
|
34
|
+
import re
|
|
35
|
+
import sys
|
|
36
|
+
|
|
37
|
+
MAX_RECTS = 12 # rect 数超过此 = 复杂图(架构图/网络图),跳过不猜
|
|
38
|
+
PAIR_MAX_DX_FRAC = 0.6 # 百分比文本与柱中心的横向距离 ≤ 柱宽×此值 才算配上对
|
|
39
|
+
SIZE_TOLERANCE = 0.05 # 柱尺寸比较容差(5%):近似等高不算颠倒
|
|
40
|
+
LABEL_OVER_FRAC = 1.08 # 标签估宽 > rect 宽 ×此值 → 装不下
|
|
41
|
+
PERCENT_RE = re.compile(r"^[~≈约]?\s*(\d+(?:\.\d+)?)\s*%$")
|
|
42
|
+
# 纯绝对数值/数值区间(含千分位逗号、可选¥/$、可选区间):22,800 / 4,000–9,000 / 45000
|
|
43
|
+
NUMBER_RANGE_RE = re.compile(
|
|
44
|
+
r"^[¥$]?\s*(\d[\d,]*(?:\.\d+)?)\s*(?:[–—-]\s*[¥$]?\s*(\d[\d,]*(?:\.\d+)?))?\s*$"
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
SECTION_RE = re.compile(r'<section class="slide[\s\S]*?(?=<section class="slide|</body>|$)')
|
|
48
|
+
LABEL_RE = re.compile(r'data-screen-label="([^"]*)"')
|
|
49
|
+
SVG_RE = re.compile(r"<svg\b[\s\S]*?</svg>")
|
|
50
|
+
RECT_RE = re.compile(r"<rect\b([^>]*?)/?>")
|
|
51
|
+
TEXT_RE = re.compile(r"<text\b([^>]*)>([\s\S]*?)</text>")
|
|
52
|
+
ATTR_RE = re.compile(r'([a-zA-Z_:][-a-zA-Z0-9_:.]*)\s*=\s*"([^"]*)"')
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def _attrs(s):
|
|
56
|
+
return dict(ATTR_RE.findall(s or ""))
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def _num(v, default=None):
|
|
60
|
+
try:
|
|
61
|
+
return float(v)
|
|
62
|
+
except (TypeError, ValueError):
|
|
63
|
+
return default
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def _est_text_width(text, font_size):
|
|
67
|
+
"""按字宽估算文本渲染宽度:CJK/全角 ≈ 1.0×fontSize,其余 ≈ 0.6×。宁窄勿宽(少误报)。"""
|
|
68
|
+
w = 0.0
|
|
69
|
+
for ch in text:
|
|
70
|
+
w += font_size * (1.0 if ord(ch) > 0x2E7F else 0.6)
|
|
71
|
+
return w
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def _strip_tags(s):
|
|
75
|
+
return re.sub(r"<[^>]+>", "", s or "").strip()
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def _parse_bar_number(text):
|
|
79
|
+
"""纯绝对数值(含千分位/区间)转可比较值;不是纯数字(如含%/中文)则返回 None。区间取均值。"""
|
|
80
|
+
m = NUMBER_RANGE_RE.match((text or "").strip())
|
|
81
|
+
if not m:
|
|
82
|
+
return None
|
|
83
|
+
a = float(m.group(1).replace(",", ""))
|
|
84
|
+
if m.group(2):
|
|
85
|
+
b = float(m.group(2).replace(",", ""))
|
|
86
|
+
return (a + b) / 2
|
|
87
|
+
return a
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def _containing_rect(text_item, rects):
|
|
91
|
+
"""取锚点落在其内的最小 rect(柱优先于底板),落不进任何 rect 则 None。"""
|
|
92
|
+
holder = None
|
|
93
|
+
for r in rects:
|
|
94
|
+
if r["x"] <= text_item["x"] <= r["x"] + r["w"] and r["y"] <= text_item["y"] <= r["y"] + r["h"]:
|
|
95
|
+
if holder is None or r["w"] * r["h"] < holder["w"] * holder["h"]:
|
|
96
|
+
holder = r
|
|
97
|
+
return holder
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def check_charts(html, verbose=False):
|
|
101
|
+
"""返回 (problems, notes)。problems 非空 = 有 ERROR 级图表缺陷。"""
|
|
102
|
+
problems = []
|
|
103
|
+
notes = []
|
|
104
|
+
|
|
105
|
+
for section in SECTION_RE.findall(html):
|
|
106
|
+
m = LABEL_RE.search(section)
|
|
107
|
+
label = m.group(1) if m else "未知页"
|
|
108
|
+
for svg_i, svg in enumerate(SVG_RE.findall(section), start=1):
|
|
109
|
+
if "transform=" in svg:
|
|
110
|
+
notes.append(f"{label} svg#{svg_i}:含 transform,跳过(复杂图不猜)。")
|
|
111
|
+
continue
|
|
112
|
+
rects = []
|
|
113
|
+
for rm in RECT_RE.finditer(svg):
|
|
114
|
+
a = _attrs(rm.group(1))
|
|
115
|
+
x, y = _num(a.get("x"), 0.0), _num(a.get("y"), 0.0)
|
|
116
|
+
w, h = _num(a.get("width")), _num(a.get("height"))
|
|
117
|
+
if w is None or h is None or w <= 0 or h <= 0:
|
|
118
|
+
continue
|
|
119
|
+
rects.append({"x": x, "y": y, "w": w, "h": h})
|
|
120
|
+
if not rects:
|
|
121
|
+
continue
|
|
122
|
+
if len(rects) > MAX_RECTS:
|
|
123
|
+
notes.append(f"{label} svg#{svg_i}:{len(rects)} 个 rect(复杂图),跳过。")
|
|
124
|
+
continue
|
|
125
|
+
texts = []
|
|
126
|
+
for tm in TEXT_RE.finditer(svg):
|
|
127
|
+
a = _attrs(tm.group(1))
|
|
128
|
+
content = _strip_tags(tm.group(2))
|
|
129
|
+
if not content:
|
|
130
|
+
continue
|
|
131
|
+
texts.append({
|
|
132
|
+
"x": _num(a.get("x"), 0.0),
|
|
133
|
+
"y": _num(a.get("y"), 0.0),
|
|
134
|
+
"font": _num(a.get("font-size"), 16.0),
|
|
135
|
+
"anchor": a.get("text-anchor", "start"),
|
|
136
|
+
"text": content,
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
# ── A. 百分比柱一致性:数值排序 vs 柱尺寸排序 ──
|
|
140
|
+
pairs = []
|
|
141
|
+
for t in texts:
|
|
142
|
+
pm = PERCENT_RE.match(t["text"])
|
|
143
|
+
if not pm:
|
|
144
|
+
continue
|
|
145
|
+
value = float(pm.group(1))
|
|
146
|
+
best = None
|
|
147
|
+
best_dx = None
|
|
148
|
+
for r in rects:
|
|
149
|
+
dx = abs(t["x"] - (r["x"] + r["w"] / 2))
|
|
150
|
+
if dx <= r["w"] * PAIR_MAX_DX_FRAC and (best_dx is None or dx < best_dx):
|
|
151
|
+
best, best_dx = r, dx
|
|
152
|
+
if best is not None:
|
|
153
|
+
pairs.append((value, best, t["text"]))
|
|
154
|
+
if len(pairs) >= 2:
|
|
155
|
+
heights = [p[1]["h"] for p in pairs]
|
|
156
|
+
widths = [p[1]["w"] for p in pairs]
|
|
157
|
+
# 纵柱(宽相近、高不同)比高;横柱比宽
|
|
158
|
+
spread = lambda vals: (max(vals) - min(vals)) / max(max(vals), 1e-9)
|
|
159
|
+
dim = "h" if spread(heights) >= spread(widths) else "w"
|
|
160
|
+
ordered = sorted(pairs, key=lambda p: p[0])
|
|
161
|
+
for (v1, r1, t1), (v2, r2, t2) in zip(ordered, ordered[1:]):
|
|
162
|
+
if v2 - v1 < 5:
|
|
163
|
+
continue # 数值太接近不判(近似档位)
|
|
164
|
+
if r1[dim] > r2[dim] * (1 + SIZE_TOLERANCE):
|
|
165
|
+
problems.append(
|
|
166
|
+
f"【图表数据颠倒】{label} · svg#{svg_i} · "
|
|
167
|
+
f"标注 {t1} 的柱({'高' if dim == 'h' else '宽'} {r1[dim]:.0f})"
|
|
168
|
+
f"画得比标注 {t2} 的柱({r2[dim]:.0f})还大——数值与图形不一致"
|
|
169
|
+
f" |可参考修法(非强制):按数值重算柱{'高' if dim == 'h' else '宽'}"
|
|
170
|
+
f"(尺寸 ∝ 数值),别让示意图撒谎"
|
|
171
|
+
)
|
|
172
|
+
if verbose and pairs:
|
|
173
|
+
notes.append(f"{label} svg#{svg_i}:配对 {len(pairs)} 组百分比柱。")
|
|
174
|
+
|
|
175
|
+
# ── A2. 绝对数值柱一致性:锚点落在柱内的纯数字/数字区间标签,同样按数值排序
|
|
176
|
+
# vs 柱尺寸排序校验(percent 已在上面用掉,这里跳过避免重复配对)──
|
|
177
|
+
value_pairs = []
|
|
178
|
+
for t in texts:
|
|
179
|
+
if PERCENT_RE.match(t["text"]):
|
|
180
|
+
continue
|
|
181
|
+
val = _parse_bar_number(t["text"])
|
|
182
|
+
if val is None:
|
|
183
|
+
continue
|
|
184
|
+
holder = _containing_rect(t, rects)
|
|
185
|
+
if holder is not None:
|
|
186
|
+
value_pairs.append((val, holder, t["text"]))
|
|
187
|
+
if len(value_pairs) >= 2:
|
|
188
|
+
heights = [p[1]["h"] for p in value_pairs]
|
|
189
|
+
widths = [p[1]["w"] for p in value_pairs]
|
|
190
|
+
spread = lambda vals: (max(vals) - min(vals)) / max(max(vals), 1e-9)
|
|
191
|
+
dim = "h" if spread(heights) >= spread(widths) else "w"
|
|
192
|
+
ordered = sorted(value_pairs, key=lambda p: p[0])
|
|
193
|
+
for (v1, r1, t1), (v2, r2, t2) in zip(ordered, ordered[1:]):
|
|
194
|
+
if v1 > 0 and (v2 - v1) / v1 < 0.05:
|
|
195
|
+
continue # 数值太接近不判(近似档位)
|
|
196
|
+
if r1[dim] > r2[dim] * (1 + SIZE_TOLERANCE):
|
|
197
|
+
problems.append(
|
|
198
|
+
f"【图表数据颠倒】{label} · svg#{svg_i} · "
|
|
199
|
+
f"标注 {t1} 的柱({'高' if dim == 'h' else '宽'} {r1[dim]:.0f})"
|
|
200
|
+
f"画得比标注 {t2} 的柱({r2[dim]:.0f})还大——数值 {t1} < {t2} 但图形更大"
|
|
201
|
+
f" |可参考修法(非强制):按数值重算柱{'高' if dim == 'h' else '宽'}"
|
|
202
|
+
f"(尺寸 ∝ 数值),别让示意图撒谎"
|
|
203
|
+
)
|
|
204
|
+
if verbose and value_pairs:
|
|
205
|
+
notes.append(f"{label} svg#{svg_i}:配对 {len(value_pairs)} 组绝对数值柱。")
|
|
206
|
+
|
|
207
|
+
# ── B. 标签容纳性:锚点在 rect 内的文本估宽必须装得下 ──
|
|
208
|
+
for t in texts:
|
|
209
|
+
holder = _containing_rect(t, rects)
|
|
210
|
+
if holder is None:
|
|
211
|
+
continue
|
|
212
|
+
est = _est_text_width(t["text"], t["font"])
|
|
213
|
+
if t["anchor"] == "middle":
|
|
214
|
+
left, right = t["x"] - est / 2, t["x"] + est / 2
|
|
215
|
+
elif t["anchor"] == "end":
|
|
216
|
+
left, right = t["x"] - est, t["x"]
|
|
217
|
+
else:
|
|
218
|
+
left, right = t["x"], t["x"] + est
|
|
219
|
+
overflow = max(holder["x"] - left, right - (holder["x"] + holder["w"]), 0.0)
|
|
220
|
+
if est > holder["w"] * LABEL_OVER_FRAC and overflow > 0:
|
|
221
|
+
problems.append(
|
|
222
|
+
f"【图表标签装不下】{label} · svg#{svg_i} · "
|
|
223
|
+
f"「{t['text'][:16]}」估宽 {est:.0f} 超出所属图形宽 {holder['w']:.0f}"
|
|
224
|
+
f"(溢出 {overflow:.0f})"
|
|
225
|
+
f" |可参考修法(非强制):把图形画大装下标签 / 缩短标签文案 / 标签移到图形外侧"
|
|
226
|
+
f"——**不是缩字**(图内文字须 ≥24px)"
|
|
227
|
+
)
|
|
228
|
+
|
|
229
|
+
return problems, notes
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
def main() -> int:
|
|
233
|
+
parser = argparse.ArgumentParser(
|
|
234
|
+
description="SVG 图表数据一致性 + 标签容纳性闸门(仅标准库;复杂图 fail-open 跳过)"
|
|
235
|
+
)
|
|
236
|
+
parser.add_argument("html", help="deck.html 路径")
|
|
237
|
+
parser.add_argument("-v", "--verbose", action="store_true")
|
|
238
|
+
args = parser.parse_args()
|
|
239
|
+
|
|
240
|
+
try:
|
|
241
|
+
with open(args.html, "r", encoding="utf-8") as f:
|
|
242
|
+
html = f.read()
|
|
243
|
+
except OSError as exc:
|
|
244
|
+
print(f"SKIP: 读取 {args.html} 失败:{exc}")
|
|
245
|
+
return 0 # fail-open:文件问题由上游门管
|
|
246
|
+
|
|
247
|
+
problems, notes = check_charts(html, verbose=args.verbose)
|
|
248
|
+
if args.verbose:
|
|
249
|
+
for n in notes:
|
|
250
|
+
print("NOTE: " + n)
|
|
251
|
+
if problems:
|
|
252
|
+
print(f"SVG 图表一致性检查 FAILED —— {len(problems)} 处缺陷:")
|
|
253
|
+
for p in problems:
|
|
254
|
+
print(" - " + p)
|
|
255
|
+
return 1
|
|
256
|
+
print("SVG 图表一致性检查 PASSED(复杂图/无图表页自动跳过)")
|
|
257
|
+
return 0
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
if __name__ == "__main__":
|
|
261
|
+
sys.exit(main())
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""
|
|
4
|
+
chart_sanity_check_test.py —— SVG 图表一致性门的回归锚(stdlib unittest)。
|
|
5
|
+
|
|
6
|
+
夹具仿真机 slide11 事故(标注 ~20% 的柱比 ~80% 还大)与派生场景,锁定:
|
|
7
|
+
- 数据颠倒 ERROR / 数值正序通过;
|
|
8
|
+
- 标签估宽超出所属 rect → ERROR;装得下 → 通过;
|
|
9
|
+
- 复杂图(rect>12 / 带 transform)与无图表页 fail-open 跳过。
|
|
10
|
+
|
|
11
|
+
运行:python skills/ui-design/scripts/chart_sanity_check_test.py
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
import os
|
|
15
|
+
import sys
|
|
16
|
+
import unittest
|
|
17
|
+
|
|
18
|
+
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
19
|
+
from chart_sanity_check import check_charts # noqa: E402
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def deck(svg_body, label="11 测试页"):
|
|
23
|
+
return (
|
|
24
|
+
f'<body><section class="slide" data-screen-label="{label}">'
|
|
25
|
+
f'<svg viewBox="0 0 600 280">{svg_body}</svg></section></body>'
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# 真机 slide11 事故复刻:20% 柱高 160 > 80% 柱高 140
|
|
30
|
+
INVERTED = """
|
|
31
|
+
<rect x="60" y="80" width="120" height="160" fill="blue"/>
|
|
32
|
+
<text x="120" y="60" text-anchor="middle" font-size="28">~20%</text>
|
|
33
|
+
<rect x="240" y="100" width="120" height="140" fill="navy"/>
|
|
34
|
+
<text x="300" y="80" text-anchor="middle" font-size="28">~80%</text>
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
CORRECT = """
|
|
38
|
+
<rect x="60" y="200" width="120" height="40" fill="blue"/>
|
|
39
|
+
<text x="120" y="190" text-anchor="middle" font-size="28">~20%</text>
|
|
40
|
+
<rect x="240" y="80" width="120" height="160" fill="navy"/>
|
|
41
|
+
<text x="300" y="60" text-anchor="middle" font-size="28">~80%</text>
|
|
42
|
+
"""
|
|
43
|
+
|
|
44
|
+
# 标签装不下:8 个 CJK ×22 ≈ 176 > 柱宽 120
|
|
45
|
+
LABEL_OVERFLOW = """
|
|
46
|
+
<rect x="240" y="100" width="120" height="140" fill="navy"/>
|
|
47
|
+
<text x="300" y="128" text-anchor="middle" font-size="22">蓝光磁带历史归档库</text>
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
LABEL_FITS = """
|
|
51
|
+
<rect x="240" y="100" width="120" height="140" fill="navy"/>
|
|
52
|
+
<text x="300" y="128" text-anchor="middle" font-size="22">SSD</text>
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
# 真机 2026-07-07 page10 成本结构图事故复刻:柱内标签是绝对数值(非百分比),
|
|
56
|
+
# 45,000 那根柱(宽 220/高 28)画得比 22,800 那根(宽 380/高 70)还小——check A 的
|
|
57
|
+
# PERCENT_RE 配不上这类标签,0 pairs 静默跳过,数据颠倒未被拦截。
|
|
58
|
+
ABSOLUTE_VALUE_INVERTED = """
|
|
59
|
+
<rect x="180" y="100" width="380" height="70" fill="#2477a6"/>
|
|
60
|
+
<text x="370" y="146" text-anchor="middle" font-size="30">22,800</text>
|
|
61
|
+
<rect x="600" y="142" width="180" height="28" fill="#5a90b5"/>
|
|
62
|
+
<text x="690" y="166" text-anchor="middle" font-size="24">4,000–9,000</text>
|
|
63
|
+
<rect x="820" y="142" width="220" height="28" fill="#9bb9d0"/>
|
|
64
|
+
<text x="930" y="166" text-anchor="middle" font-size="24">45,000</text>
|
|
65
|
+
"""
|
|
66
|
+
|
|
67
|
+
ABSOLUTE_VALUE_CORRECT = """
|
|
68
|
+
<rect x="180" y="100" width="200" height="20" fill="#5a90b5"/>
|
|
69
|
+
<text x="280" y="115" text-anchor="middle" font-size="24">4,000–9,000</text>
|
|
70
|
+
<rect x="420" y="80" width="380" height="60" fill="#2477a6"/>
|
|
71
|
+
<text x="610" y="115" text-anchor="middle" font-size="30">22,800</text>
|
|
72
|
+
<rect x="840" y="40" width="560" height="100" fill="#9bb9d0"/>
|
|
73
|
+
<text x="1120" y="95" text-anchor="middle" font-size="24">45,000</text>
|
|
74
|
+
"""
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class ChartSanityTest(unittest.TestCase):
|
|
78
|
+
def test_inverted_bars_error(self):
|
|
79
|
+
problems, _n = check_charts(deck(INVERTED))
|
|
80
|
+
self.assertTrue(any("数据颠倒" in p for p in problems), problems)
|
|
81
|
+
self.assertTrue(any("~20%" in p and "~80%" in p for p in problems), problems)
|
|
82
|
+
|
|
83
|
+
def test_correct_bars_pass(self):
|
|
84
|
+
problems, _n = check_charts(deck(CORRECT))
|
|
85
|
+
self.assertEqual(problems, [], problems)
|
|
86
|
+
|
|
87
|
+
def test_label_overflow_error(self):
|
|
88
|
+
problems, _n = check_charts(deck(LABEL_OVERFLOW))
|
|
89
|
+
self.assertTrue(any("标签装不下" in p for p in problems), problems)
|
|
90
|
+
|
|
91
|
+
def test_label_fits_pass(self):
|
|
92
|
+
problems, _n = check_charts(deck(LABEL_FITS))
|
|
93
|
+
self.assertEqual(problems, [], problems)
|
|
94
|
+
|
|
95
|
+
def test_absolute_value_inverted_bars_error(self):
|
|
96
|
+
# 真机 page10 事故:柱内标签是绝对数值(非百分比),PERCENT_RE 配不上,
|
|
97
|
+
# 此前 0 pairs 静默跳过;45,000 的柱画得比 22,800 的柱还小必须被拦截。
|
|
98
|
+
problems, _n = check_charts(deck(ABSOLUTE_VALUE_INVERTED))
|
|
99
|
+
self.assertTrue(any("数据颠倒" in p for p in problems), problems)
|
|
100
|
+
self.assertTrue(any("22,800" in p and "45,000" in p for p in problems), problems)
|
|
101
|
+
|
|
102
|
+
def test_absolute_value_correct_bars_pass(self):
|
|
103
|
+
problems, _n = check_charts(deck(ABSOLUTE_VALUE_CORRECT))
|
|
104
|
+
self.assertEqual(problems, [], problems)
|
|
105
|
+
|
|
106
|
+
def test_absolute_value_close_not_judged(self):
|
|
107
|
+
# 数值相对差 <5% 不判(近似档位画同尺寸属正常示意)。
|
|
108
|
+
svg = """
|
|
109
|
+
<rect x="60" y="80" width="120" height="150" fill="blue"/>
|
|
110
|
+
<text x="120" y="115" text-anchor="middle" font-size="28">9,800</text>
|
|
111
|
+
<rect x="240" y="90" width="120" height="140" fill="navy"/>
|
|
112
|
+
<text x="300" y="123" text-anchor="middle" font-size="28">10,200</text>
|
|
113
|
+
"""
|
|
114
|
+
problems, _n = check_charts(deck(svg))
|
|
115
|
+
self.assertEqual(problems, [], problems)
|
|
116
|
+
|
|
117
|
+
def test_percent_text_not_double_counted_as_absolute_value(self):
|
|
118
|
+
# 百分比文本(如 "~20%")不该被 A2 的绝对数值正则二次配对——NUMBER_RANGE_RE
|
|
119
|
+
# 不该匹配带 % 的字符串,否则会和 check A 重复判定甚至互相打架。
|
|
120
|
+
problems, _n = check_charts(deck(INVERTED))
|
|
121
|
+
# INVERTED 本身应仍只报一次数据颠倒(来自 check A,不应被 A2 重复计入/干扰)。
|
|
122
|
+
inverted_msgs = [p for p in problems if "数据颠倒" in p]
|
|
123
|
+
self.assertEqual(len(inverted_msgs), 1, problems)
|
|
124
|
+
|
|
125
|
+
def test_close_values_not_judged(self):
|
|
126
|
+
# 数值差 <5 个百分点不判(近似档位画同高属正常示意)。
|
|
127
|
+
svg = """
|
|
128
|
+
<rect x="60" y="80" width="120" height="150" fill="blue"/>
|
|
129
|
+
<text x="120" y="60" text-anchor="middle" font-size="28">48%</text>
|
|
130
|
+
<rect x="240" y="90" width="120" height="140" fill="navy"/>
|
|
131
|
+
<text x="300" y="70" text-anchor="middle" font-size="28">52%</text>
|
|
132
|
+
"""
|
|
133
|
+
problems, _n = check_charts(deck(svg))
|
|
134
|
+
self.assertEqual(problems, [], problems)
|
|
135
|
+
|
|
136
|
+
def test_complex_svg_skipped(self):
|
|
137
|
+
# rect > 12(架构图/网络图):fail-open 跳过,绝不误判。
|
|
138
|
+
rects = "".join(
|
|
139
|
+
f'<rect x="{i*40}" y="80" width="30" height="{100+i}" fill="b"/>' for i in range(14)
|
|
140
|
+
)
|
|
141
|
+
svg = rects + '<text x="20" y="60" font-size="28">20%</text>'
|
|
142
|
+
problems, notes = check_charts(deck(svg))
|
|
143
|
+
self.assertEqual(problems, [], problems)
|
|
144
|
+
self.assertTrue(any("复杂图" in n for n in notes), notes)
|
|
145
|
+
|
|
146
|
+
def test_transform_svg_skipped(self):
|
|
147
|
+
svg = ('<g transform="translate(10,10)">'
|
|
148
|
+
'<rect x="60" y="80" width="120" height="160"/></g>'
|
|
149
|
+
'<text x="120" y="60" font-size="28">20%</text>')
|
|
150
|
+
problems, notes = check_charts(deck(svg))
|
|
151
|
+
self.assertEqual(problems, [], problems)
|
|
152
|
+
self.assertTrue(any("transform" in n for n in notes), notes)
|
|
153
|
+
|
|
154
|
+
def test_no_svg_page_passes(self):
|
|
155
|
+
problems, _n = check_charts('<body><section class="slide" data-screen-label="01 无图">'
|
|
156
|
+
"<h1>标题</h1></section></body>")
|
|
157
|
+
self.assertEqual(problems, [], problems)
|
|
158
|
+
|
|
159
|
+
def test_error_message_carries_page_label(self):
|
|
160
|
+
problems, _n = check_charts(deck(INVERTED, label="11 存储与平台层"))
|
|
161
|
+
self.assertTrue(any("11 存储与平台层" in p for p in problems), problems)
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
if __name__ == "__main__":
|
|
165
|
+
unittest.main(verbosity=2)
|