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
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# minimal-agent
|
|
2
2
|
|
|
3
3
|
> 一个**最小化但功能完整**的 AI 编程助手 —— Bun + React + TypeScript + Ink TUI 构建,
|
|
4
|
-
> OpenAI 兼容、多 provider,
|
|
4
|
+
> OpenAI 兼容、多 provider,16 个内置工具 + Skills + 插件 + Workflow DSL + 自动上下文压缩。
|
|
5
5
|
> 为**学习与教学**而生:代码量克制、注释充分,把一个 agent「从输入到工具循环到落盘」讲透。
|
|
6
6
|
|
|
7
7
|
`v0.5.1` · Runtime: **Bun**(主)/ Node ≥ 20 · License: **PolyForm Noncommercial 1.0.0**
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|
## 特性
|
|
24
24
|
|
|
25
|
-
- **
|
|
25
|
+
- **16 个内置工具**:Read / Write / Edit / MultiEdit / Glob / Grep / WebSearch / WebFetch / WebBrowser / Download / GenerateImage / GenerateSpeech / Bash / AskUserQuestion(向用户提结构化选择题,动态工作流交互底座)/ Advisor(独立配置的第二个 LLM,关键节点取第二意见)/ Agent(并行子任务分身:explore 只读调研 / general 读写执行,可 git worktree 隔离)
|
|
26
26
|
- **OpenAI 兼容**:Message 形状对齐 Chat Completions,一套代码接 MiniMax / 火山 ARK / DeepSeek / OpenAI / Moonshot…
|
|
27
27
|
- **Skills 系统**:放一个 `SKILL.md` 就能扩展能力,运行时实时扫描注入 prompt,改文件即生效
|
|
28
28
|
- **插件系统**:`plugins/<id>/` drop-in,自带 `/workflow`(YAML 工作流引擎,支持 while 循环 + 验证门 + fresh_context)
|
|
@@ -51,15 +51,15 @@ bun run start # 启动 TUI
|
|
|
51
51
|
|
|
52
52
|
```bash
|
|
53
53
|
npm install -g minimal-agent
|
|
54
|
-
minimal-agent #
|
|
54
|
+
minimal-agent # 首次运行进入配置菜单(逐项配置,完成退出后进入对话)
|
|
55
55
|
```
|
|
56
56
|
|
|
57
57
|
## 配置
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
两种方式任选其一(**配置文件优先于环境变量**——env 只在没有任何 `config.json` 时作兜底;`MINIMAL_AGENT_CONFIG_MODE=env` 可强制只用环境变量):
|
|
60
60
|
|
|
61
61
|
1. **`.env` 文件**(源码模式,Bun 自动加载)—— 复制 `.env.example` 改值。
|
|
62
|
-
2.
|
|
62
|
+
2. **配置菜单** —— 首次运行 `minimal-agent`(TUI)会弹出菜单(基座模型/搜索引擎/生图模型/顾问模型/语音合成/OpenRouter 逐项配置),写到 `~/.minimal-agent/config.json`;会话中可用 `/config` 随时再次打开。
|
|
63
63
|
|
|
64
64
|
必需三项 + 可选项:
|
|
65
65
|
|
|
@@ -152,8 +152,8 @@ minimal-agent -p --output-format json "做点事" # 一行结构化结
|
|
|
152
152
|
- **Skills**:每个 `skills/<name>/SKILL.md`(带 frontmatter)。运行时实时扫描注入 prompt,prompt 体按需懒加载。
|
|
153
153
|
cwd 优先、包内 fallback,用户可在自己项目里覆盖或新增。内置 20+ 个(`/init`、`/config`、文档生成、设计等)。
|
|
154
154
|
- **插件**(`plugins/<id>/`,drop-in,`src/` 一行不改):
|
|
155
|
-
- **`/workflow` · `/workflows`**(workflow-runner)—— YAML 工作流引擎,
|
|
156
|
-
-
|
|
155
|
+
- **`/workflow` · `/workflows`**(workflow-runner)—— YAML 工作流引擎,13 种 step(tool/llm/skill/agent + assert/verify/set/branch/loop/break/continue/echo/pause),支持 while 循环 + fresh_context + 验证门。内置 `ralph-loop` 等工作流定义
|
|
156
|
+
- **可视化编辑器**:`../minimal-workflow/` 子项目(与本仓库平级,Bun + Vite + React Flow)拖拽编排 workflow YAML(不属于 npm 发布物)。
|
|
157
157
|
|
|
158
158
|
---
|
|
159
159
|
|
|
@@ -218,10 +218,13 @@ minimal-agent/
|
|
|
218
218
|
├─ workflows/ # 内置 workflow(YAML)
|
|
219
219
|
├─ vendor/ripgrep/ # Grep 自带的 6 平台 ripgrep 二进制
|
|
220
220
|
├─ scripts/ # 构建脚本(含绿色版 build-green.ts)
|
|
221
|
-
├─ editor/ # workflow 可视化编辑器(独立子项目)
|
|
222
221
|
├─ test/ # 测试
|
|
223
222
|
├─ GREEN-BUILD.md # 绿色版/U 盘分发指南
|
|
224
223
|
└─ CLAUDE.md # 架构与开发指南
|
|
224
|
+
|
|
225
|
+
../minimal-desktop/ # React/Tauri 桌面产品与本机 Agent Runtime
|
|
226
|
+
../minimal-server/ # 中央账号、好友、群聊、附件与 Agent Node 路由
|
|
227
|
+
../minimal-workflow/ # workflow 可视化编辑器
|
|
225
228
|
```
|
|
226
229
|
|
|
227
230
|
## License
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "minimal-agent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "最小化 Agent 系统 —— 10 工具 + 插件系统 + workflow DSL + 自动压缩 + OpenAI 兼容 + Ink TUI;NodeNext + tsc 原地编译,dev 用 Bun .ts、install 用 Node .js(学习/教学用)",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": "Bill Wang <leiwang0359@gmail.com>",
|
|
@@ -29,6 +29,31 @@
|
|
|
29
29
|
"bin": {
|
|
30
30
|
"minimal-agent": "src/main.js"
|
|
31
31
|
},
|
|
32
|
+
"exports": {
|
|
33
|
+
"./protocol": {
|
|
34
|
+
"types": "./src/web/protocol.ts",
|
|
35
|
+
"bun": "./src/web/protocol.ts",
|
|
36
|
+
"default": "./src/web/protocol.js"
|
|
37
|
+
},
|
|
38
|
+
"./config-service": {
|
|
39
|
+
"types": "./src/config/configService.ts",
|
|
40
|
+
"bun": "./src/config/configService.ts",
|
|
41
|
+
"default": "./src/config/configService.js"
|
|
42
|
+
},
|
|
43
|
+
"./provider-presets": {
|
|
44
|
+
"types": "./src/cli/wizards/providerPresets.ts",
|
|
45
|
+
"bun": "./src/cli/wizards/providerPresets.ts",
|
|
46
|
+
"default": "./src/cli/wizards/providerPresets.js"
|
|
47
|
+
},
|
|
48
|
+
"./tools/agent/worktree": {
|
|
49
|
+
"types": "./src/tools/agent/worktree.ts",
|
|
50
|
+
"bun": "./src/tools/agent/worktree.ts",
|
|
51
|
+
"default": "./src/tools/agent/worktree.js"
|
|
52
|
+
},
|
|
53
|
+
"./src/*.js": "./src/*.ts",
|
|
54
|
+
"./plugins/*.js": "./plugins/*.ts",
|
|
55
|
+
"./package.json": "./package.json"
|
|
56
|
+
},
|
|
32
57
|
"engines": {
|
|
33
58
|
"node": ">=20"
|
|
34
59
|
},
|
|
@@ -53,16 +78,19 @@
|
|
|
53
78
|
"dev": "bun --watch src/main.tsx",
|
|
54
79
|
"build": "tsc --build",
|
|
55
80
|
"clean": "bun scripts/clean-build.ts",
|
|
81
|
+
"check:build-artifacts": "bun scripts/check-build-artifacts.ts",
|
|
56
82
|
"test": "bun test",
|
|
57
83
|
"typecheck": "tsc --noEmit -p tsconfig.typecheck.json",
|
|
58
84
|
"verify-all": "bun scripts/verify-all.ts",
|
|
59
85
|
"compile:green": "bun scripts/build-green.ts",
|
|
60
86
|
"compile:green:host": "bun scripts/build-green.ts --host",
|
|
87
|
+
"doc:gen": "node doc/scripts/gen-pptx.mjs",
|
|
61
88
|
"prepublishOnly": "bun run clean && bun run build"
|
|
62
89
|
},
|
|
63
90
|
"dependencies": {
|
|
64
91
|
"fast-glob": "^3.3.2",
|
|
65
92
|
"ink": "^5.0.1",
|
|
93
|
+
"marked": "^18.0.6",
|
|
66
94
|
"react": "^18.3.1",
|
|
67
95
|
"turndown": "^7.2.4",
|
|
68
96
|
"yaml": "^2.9.0",
|
|
@@ -74,5 +102,10 @@
|
|
|
74
102
|
"@types/react": "^18.3.0",
|
|
75
103
|
"bun-types": "^1.3.13",
|
|
76
104
|
"typescript": "^5.5.0"
|
|
105
|
+
},
|
|
106
|
+
"optionalDependencies": {
|
|
107
|
+
"playwright-core": "^1.40.0",
|
|
108
|
+
"pngjs": "^7.0.0",
|
|
109
|
+
"pptxgenjs": "^4.0.1"
|
|
77
110
|
}
|
|
78
111
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Create and manage scheduled cron tasks"
|
|
3
|
+
argument-hint: "create|list|pause|resume|delete|run|show|missed ..."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
The cron-runner plugin handles this command in plugin.ts.
|
|
7
|
+
|
|
8
|
+
Supported forms:
|
|
9
|
+
|
|
10
|
+
- `/cron 120m Prompt`
|
|
11
|
+
- `/cron 1d Task description /workflow daily-news.yaml Extra workflow prompt`
|
|
12
|
+
- `/cron 1m Task description workflow inspect-homework.yaml camera.jpg`
|
|
13
|
+
- `/cron 每天 6:07 Prompt`
|
|
14
|
+
- `/cron 工作日 6:07 Prompt`
|
|
15
|
+
- `/cron 每周一 6:07 Prompt`
|
|
16
|
+
- `/cron create --name "Name" --cron "7 6 * * 1" --prompt "Prompt"`
|
|
17
|
+
- `/cron create --name "Once" --cron "5 13 * * *" --prompt "Prompt" --once`
|
|
18
|
+
- `/cron create --name "Workflow" --cron "7 6 * * 1" --workflow "plan \"Weekly report\"" --permanent`
|
|
19
|
+
- `/cron create --name "Fresh workflow" --cron "7 6 * * *" --workflow "daily-news.yaml" --fresh-session`
|
|
20
|
+
- `/cron list`
|
|
21
|
+
- `/cron show <id>`
|
|
22
|
+
- `/cron pause <id>`
|
|
23
|
+
- `/cron resume <id>`
|
|
24
|
+
- `/cron run <id>`
|
|
25
|
+
- `/cron missed`
|
|
26
|
+
- `/cron delete <id>`
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { handleCronCommand } from './src/commands.js';
|
|
2
|
+
import { Scheduler } from './src/scheduler.js';
|
|
3
|
+
import { migrateCronTasks } from './src/store.js';
|
|
4
|
+
let scheduler = null;
|
|
5
|
+
let schedulerStop = null;
|
|
6
|
+
export function getCronScheduler() {
|
|
7
|
+
return scheduler;
|
|
8
|
+
}
|
|
9
|
+
const api = {
|
|
10
|
+
async activate(ctx) {
|
|
11
|
+
await migrateCronTasks();
|
|
12
|
+
await scheduler?.stop();
|
|
13
|
+
await schedulerStop;
|
|
14
|
+
const instance = new Scheduler(ctx);
|
|
15
|
+
scheduler = instance;
|
|
16
|
+
instance.start();
|
|
17
|
+
return () => {
|
|
18
|
+
if (scheduler === instance)
|
|
19
|
+
scheduler = null;
|
|
20
|
+
let tracked;
|
|
21
|
+
tracked = instance.stop().finally(() => {
|
|
22
|
+
if (schedulerStop === tracked)
|
|
23
|
+
schedulerStop = null;
|
|
24
|
+
});
|
|
25
|
+
schedulerStop = tracked;
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
async *runCommand(commandName, args) {
|
|
29
|
+
const text = await handleCronCommand(commandName, args, scheduler);
|
|
30
|
+
yield { type: 'text', delta: text };
|
|
31
|
+
yield { type: 'turn_done' };
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
export default api;
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
import { getWorkingDir } from '../../../src/plugin-sdk.js';
|
|
2
|
+
import { formatDateTime } from './cronTime.js';
|
|
3
|
+
import { createTask, deleteTask, getTask, listMissed, listTasks, recentRuns, updateTask, upsertTask, } from './store.js';
|
|
4
|
+
import { validateCron, validateIsoDate } from './schema.js';
|
|
5
|
+
export async function handleCronCommand(commandName, args, scheduler) {
|
|
6
|
+
if (commandName === 'crons')
|
|
7
|
+
return await formatTaskList(await listTasks());
|
|
8
|
+
const argv = tokenize(args);
|
|
9
|
+
const action = argv.shift() ?? 'list';
|
|
10
|
+
if (action === 'list')
|
|
11
|
+
return await formatTaskList(await listTasks());
|
|
12
|
+
if (action === 'create')
|
|
13
|
+
return await createFromArgs(argv);
|
|
14
|
+
if (action === 'pause' || action === 'resume')
|
|
15
|
+
return await setStatus(argv[0], action === 'resume' ? 'active' : 'paused');
|
|
16
|
+
if (action === 'delete' || action === 'remove')
|
|
17
|
+
return await remove(argv[0]);
|
|
18
|
+
if (action === 'show')
|
|
19
|
+
return await show(argv[0]);
|
|
20
|
+
if (action === 'run')
|
|
21
|
+
return await runNow(argv[0], scheduler);
|
|
22
|
+
if (action === 'missed')
|
|
23
|
+
return await formatMissed();
|
|
24
|
+
if (action === 'help')
|
|
25
|
+
return helpText();
|
|
26
|
+
const shortcut = await createFromShortcut(action, argv);
|
|
27
|
+
if (shortcut)
|
|
28
|
+
return shortcut;
|
|
29
|
+
if (/^\d+\S*$/.test(action)) {
|
|
30
|
+
return `无效间隔:${action}。支持 1m、2h、1d、1w(最小 1 分钟)。`;
|
|
31
|
+
}
|
|
32
|
+
return `未知 /cron 子命令:${action}\n\n${helpText()}`;
|
|
33
|
+
}
|
|
34
|
+
async function createFromArgs(argv) {
|
|
35
|
+
const opts = parseOptions(argv);
|
|
36
|
+
const cron = opts.cron;
|
|
37
|
+
const name = opts.name;
|
|
38
|
+
const prompt = opts.prompt;
|
|
39
|
+
const workflow = opts.workflow;
|
|
40
|
+
if (!cron || !name || (!prompt && !workflow)) {
|
|
41
|
+
return helpText();
|
|
42
|
+
}
|
|
43
|
+
const cronValidation = validateCron(cron);
|
|
44
|
+
if (!cronValidation.ok) {
|
|
45
|
+
return `无效 cron 表达式:${cron}\n${cronValidation.error}`;
|
|
46
|
+
}
|
|
47
|
+
const maxTurns = opts.maxTurns ? Number.parseInt(opts.maxTurns, 10) : undefined;
|
|
48
|
+
if (opts.maxTurns && (!Number.isFinite(maxTurns) || maxTurns <= 0)) {
|
|
49
|
+
return `无效 maxTurns:${opts.maxTurns}`;
|
|
50
|
+
}
|
|
51
|
+
const maxRuns = opts.maxRuns ? Number.parseInt(opts.maxRuns, 10) : undefined;
|
|
52
|
+
if (opts.maxRuns && (!Number.isFinite(maxRuns) || maxRuns <= 0)) {
|
|
53
|
+
return `无效 max-runs:${opts.maxRuns}(须是正整数,跑满这么多次后自动暂停)`;
|
|
54
|
+
}
|
|
55
|
+
if (opts.expiresAt) {
|
|
56
|
+
const expiresAtValidation = validateIsoDate(opts.expiresAt, 'expires-at');
|
|
57
|
+
if (!expiresAtValidation.ok)
|
|
58
|
+
return expiresAtValidation.error;
|
|
59
|
+
}
|
|
60
|
+
const task = createTask({
|
|
61
|
+
name,
|
|
62
|
+
...(opts.description ? { description: opts.description } : {}),
|
|
63
|
+
cron,
|
|
64
|
+
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone || 'local',
|
|
65
|
+
cwd: getWorkingDir(),
|
|
66
|
+
...(opts.model ? { model: opts.model } : {}),
|
|
67
|
+
...(maxTurns ? { maxTurns } : {}),
|
|
68
|
+
kind: opts.once === 'true' ? 'once' : 'recurring',
|
|
69
|
+
...(opts.permanent === 'true' ? { permanent: true } : {}),
|
|
70
|
+
...(opts.expiresAt ? { expiresAt: opts.expiresAt } : {}),
|
|
71
|
+
...(maxRuns ? { maxRuns } : {}),
|
|
72
|
+
sessionMode: opts.freshSession === 'true' ? 'fresh' : 'persistent',
|
|
73
|
+
action: workflow
|
|
74
|
+
? { type: 'workflow', command: workflow }
|
|
75
|
+
: { type: 'prompt', prompt: prompt },
|
|
76
|
+
});
|
|
77
|
+
await upsertTask(task);
|
|
78
|
+
return `已创建 cron:${task.id}\n${await formatTask(task)}`;
|
|
79
|
+
}
|
|
80
|
+
async function createFromShortcut(head, rest) {
|
|
81
|
+
const parsed = parseShortcutSchedule(head, rest);
|
|
82
|
+
if (!parsed)
|
|
83
|
+
return null;
|
|
84
|
+
if ('error' in parsed)
|
|
85
|
+
return parsed.error;
|
|
86
|
+
const task = createTask({
|
|
87
|
+
name: parsed.name,
|
|
88
|
+
...(parsed.description ? { description: parsed.description } : {}),
|
|
89
|
+
...(parsed.cron ? { cron: parsed.cron } : {}),
|
|
90
|
+
...(parsed.intervalMs ? { intervalMs: parsed.intervalMs, anchorAt: new Date().toISOString() } : {}),
|
|
91
|
+
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone || 'local',
|
|
92
|
+
cwd: getWorkingDir(),
|
|
93
|
+
action: parsed.action,
|
|
94
|
+
});
|
|
95
|
+
await upsertTask(task);
|
|
96
|
+
return `已创建 cron:${task.id}\n${await formatTask(task)}`;
|
|
97
|
+
}
|
|
98
|
+
export function parseShortcutSchedule(head, rest) {
|
|
99
|
+
const intervalMs = parseIntervalShortcut(head);
|
|
100
|
+
let actionTokens = rest;
|
|
101
|
+
let cron;
|
|
102
|
+
if (!intervalMs) {
|
|
103
|
+
const time = rest[0];
|
|
104
|
+
if (!time)
|
|
105
|
+
return null;
|
|
106
|
+
const parsedTime = parseClockTime(time);
|
|
107
|
+
if (!parsedTime)
|
|
108
|
+
return null;
|
|
109
|
+
actionTokens = rest.slice(1);
|
|
110
|
+
const { hour, minute } = parsedTime;
|
|
111
|
+
const cronTime = `${minute} ${hour}`;
|
|
112
|
+
if (head === '每天' || head === '每日')
|
|
113
|
+
cron = `${cronTime} * * *`;
|
|
114
|
+
else if (head === '工作日')
|
|
115
|
+
cron = `${cronTime} * * 1-5`;
|
|
116
|
+
else {
|
|
117
|
+
const weekly = head.match(/^每周([一二三四五六日天])$/);
|
|
118
|
+
if (!weekly)
|
|
119
|
+
return null;
|
|
120
|
+
cron = `${cronTime} * * ${weekdayNumber(weekly[1])}`;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
const parsedAction = parseShortcutAction(actionTokens);
|
|
124
|
+
if ('error' in parsedAction)
|
|
125
|
+
return parsedAction;
|
|
126
|
+
return {
|
|
127
|
+
...(cron ? { cron } : {}),
|
|
128
|
+
...(intervalMs ? { intervalMs } : {}),
|
|
129
|
+
...parsedAction,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
export function parseIntervalShortcut(text) {
|
|
133
|
+
const match = text.match(/^(\d+)(m|min|分钟|h|小时|d|天|w|周)$/i);
|
|
134
|
+
if (!match)
|
|
135
|
+
return null;
|
|
136
|
+
const value = Number.parseInt(match[1], 10);
|
|
137
|
+
if (!Number.isFinite(value) || value <= 0)
|
|
138
|
+
return null;
|
|
139
|
+
const unit = match[2].toLowerCase();
|
|
140
|
+
const multiplier = unit === 'w' || unit === '周'
|
|
141
|
+
? 7 * 24 * 60 * 60_000
|
|
142
|
+
: unit === 'd' || unit === '天'
|
|
143
|
+
? 24 * 60 * 60_000
|
|
144
|
+
: unit === 'h' || unit === '小时'
|
|
145
|
+
? 60 * 60_000
|
|
146
|
+
: 60_000;
|
|
147
|
+
const intervalMs = value * multiplier;
|
|
148
|
+
return Number.isSafeInteger(intervalMs) && intervalMs >= 60_000 ? intervalMs : null;
|
|
149
|
+
}
|
|
150
|
+
function parseShortcutAction(tokens) {
|
|
151
|
+
if (tokens.length === 0) {
|
|
152
|
+
return { error: '请在时间后面写提示词或 workflow。\n例如:/cron 1d /workflow daily-news.yaml 生成中文新闻稿' };
|
|
153
|
+
}
|
|
154
|
+
const markerIndex = tokens.findIndex((token) => token === '/workflow' || token === 'workflow');
|
|
155
|
+
if (markerIndex < 0) {
|
|
156
|
+
const prompt = tokens.join(' ').trim();
|
|
157
|
+
return { action: { type: 'prompt', prompt }, name: deriveName(prompt) };
|
|
158
|
+
}
|
|
159
|
+
const workflowName = tokens[markerIndex + 1];
|
|
160
|
+
if (!workflowName)
|
|
161
|
+
return { error: 'workflow 标记后缺少 YAML 名称。' };
|
|
162
|
+
const description = tokens.slice(0, markerIndex).join(' ').trim();
|
|
163
|
+
const command = serializeTokens(tokens.slice(markerIndex + 1));
|
|
164
|
+
return {
|
|
165
|
+
action: { type: 'workflow', command },
|
|
166
|
+
...(description ? { description } : {}),
|
|
167
|
+
name: description || deriveName(workflowName.replace(/\.ya?ml$/i, '')),
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
function serializeTokens(tokens) {
|
|
171
|
+
return tokens
|
|
172
|
+
.map((token) => (/\s|["'\\]/.test(token) ? JSON.stringify(token) : token))
|
|
173
|
+
.join(' ');
|
|
174
|
+
}
|
|
175
|
+
function parseClockTime(text) {
|
|
176
|
+
const match = text.match(/^(\d{1,2})[::](\d{1,2})$/);
|
|
177
|
+
if (!match)
|
|
178
|
+
return null;
|
|
179
|
+
const hour = Number.parseInt(match[1], 10);
|
|
180
|
+
const minute = Number.parseInt(match[2], 10);
|
|
181
|
+
if (hour < 0 || hour > 23 || minute < 0 || minute > 59)
|
|
182
|
+
return null;
|
|
183
|
+
return { hour, minute };
|
|
184
|
+
}
|
|
185
|
+
function weekdayNumber(day) {
|
|
186
|
+
return { 日: 0, 天: 0, 一: 1, 二: 2, 三: 3, 四: 4, 五: 5, 六: 6 }[day] ?? 1;
|
|
187
|
+
}
|
|
188
|
+
function deriveName(prompt) {
|
|
189
|
+
const compact = prompt.replace(/\s+/g, ' ').trim();
|
|
190
|
+
return compact.length > 18 ? `${compact.slice(0, 18)}...` : compact || 'cron task';
|
|
191
|
+
}
|
|
192
|
+
async function setStatus(id, status) {
|
|
193
|
+
if (!id)
|
|
194
|
+
return '请提供任务 id。';
|
|
195
|
+
const task = await getTask(id);
|
|
196
|
+
if (!task)
|
|
197
|
+
return `未找到任务:${id}`;
|
|
198
|
+
await updateTask(task.id, (latest) => ({ ...latest, status }));
|
|
199
|
+
return `已${status === 'active' ? '恢复' : '暂停'} ${task.id}`;
|
|
200
|
+
}
|
|
201
|
+
async function remove(id) {
|
|
202
|
+
if (!id)
|
|
203
|
+
return '请提供任务 id。';
|
|
204
|
+
return (await deleteTask(id)) ? `已删除 ${id}` : `未找到任务:${id}`;
|
|
205
|
+
}
|
|
206
|
+
async function show(id) {
|
|
207
|
+
if (!id)
|
|
208
|
+
return '请提供任务 id。';
|
|
209
|
+
const task = await getTask(id);
|
|
210
|
+
if (!task)
|
|
211
|
+
return `未找到任务:${id}`;
|
|
212
|
+
const runs = await recentRuns(task.id, 5);
|
|
213
|
+
const runLines = runs.length === 0
|
|
214
|
+
? '最近运行:无'
|
|
215
|
+
: `最近运行:\n${runs.map((r) => `- ${formatDateTime(r.startedAt)} ${r.status}${r.error ? ` · ${r.error}` : ''}`).join('\n')}`;
|
|
216
|
+
return `${await formatTask(task)}\n${runLines}`;
|
|
217
|
+
}
|
|
218
|
+
async function runNow(id, scheduler) {
|
|
219
|
+
if (!id)
|
|
220
|
+
return '请提供任务 id。';
|
|
221
|
+
if (!scheduler)
|
|
222
|
+
return 'cron scheduler 尚未启动;请在 TUI 中运行。';
|
|
223
|
+
const task = await getTask(id);
|
|
224
|
+
if (!task)
|
|
225
|
+
return `未找到任务:${id}`;
|
|
226
|
+
void scheduler.runTaskNow(task.id);
|
|
227
|
+
return `已开始手动运行 ${task.id}`;
|
|
228
|
+
}
|
|
229
|
+
async function formatMissed() {
|
|
230
|
+
const missed = await listMissed(20);
|
|
231
|
+
if (missed.length === 0)
|
|
232
|
+
return '暂无错过任务。';
|
|
233
|
+
return [
|
|
234
|
+
'错过任务:',
|
|
235
|
+
...missed.map((m) => `- ${m.taskId} · ${m.taskName} · ${m.reason === 'overlap' ? '运行重叠' : m.reason === 'binding_unavailable' ? '会话绑定失效' : '宿主离线'}跳过 ${m.missedCount} 次 · 计划 ${formatDateTime(m.scheduledFor)} · ${m.actionPreview}`),
|
|
236
|
+
].join('\n');
|
|
237
|
+
}
|
|
238
|
+
async function formatTaskList(tasks) {
|
|
239
|
+
if (tasks.length === 0)
|
|
240
|
+
return '暂无 cron 任务。';
|
|
241
|
+
const missed = await listMissed(1);
|
|
242
|
+
const header = missed.length > 0 ? `提示:有错过任务,可用 /cron missed 查看。\n\n` : '';
|
|
243
|
+
const body = await Promise.all(tasks.map(formatTask));
|
|
244
|
+
return `${header}${body.join('\n\n')}`;
|
|
245
|
+
}
|
|
246
|
+
async function formatTask(task) {
|
|
247
|
+
const action = task.action.type === 'workflow'
|
|
248
|
+
? `/workflow ${task.action.command}`
|
|
249
|
+
: task.action.prompt;
|
|
250
|
+
const runs = await recentRuns(task.id, 1);
|
|
251
|
+
const recent = runs[0]
|
|
252
|
+
? `${runs[0].status}${runs[0].error ? ` · ${runs[0].error}` : ''}`
|
|
253
|
+
: '-';
|
|
254
|
+
return [
|
|
255
|
+
`${task.id} · ${task.name}`,
|
|
256
|
+
`状态:${task.status === 'active' ? '活跃' : '暂停'}`,
|
|
257
|
+
`类型:${task.kind === 'once' ? '一次性' : task.maxRuns ? `限 ${task.maxRuns} 次` : '重复'}`,
|
|
258
|
+
`下次运行:${formatDateTime(task.schedule.nextRunAt)}`,
|
|
259
|
+
`上次运行时间:${formatDateTime(task.stats.lastRunAt)}`,
|
|
260
|
+
`详情:${task.description ?? '-'}`,
|
|
261
|
+
`运行环境:${task.runtime.environment}`,
|
|
262
|
+
`项目:${task.runtime.cwd}`,
|
|
263
|
+
`重复次数:${task.stats.runCount}${task.maxRuns ? `/${task.maxRuns}(跑满自动暂停)` : ''}`,
|
|
264
|
+
`跳过次数:${task.stats.skippedCount}`,
|
|
265
|
+
`会话:${task.runtime.sessionMode === 'fresh' ? '每次全新' : '持续会话'}`,
|
|
266
|
+
`模型:${task.runtime.model ?? '-'}`,
|
|
267
|
+
`最近结果:${recent}`,
|
|
268
|
+
`计划:${task.schedule.human} (${task.schedule.type === 'cron' ? `${task.schedule.cron}, ${task.schedule.timezone}` : `锚点 ${formatDateTime(task.schedule.anchorAt)}`})`,
|
|
269
|
+
`动作:${action}`,
|
|
270
|
+
].join('\n');
|
|
271
|
+
}
|
|
272
|
+
function helpText() {
|
|
273
|
+
return [
|
|
274
|
+
'用法:',
|
|
275
|
+
'/cron 120m 整理最近 AI 新闻',
|
|
276
|
+
'/cron 1d 整理每日国际新闻 /workflow daily-news.yaml 生成中文新闻稿',
|
|
277
|
+
'/cron 1m 检查学生作业 workflow inspect-homework.yaml 摄像头画面在 camera.jpg',
|
|
278
|
+
'/cron 每天 6:07 写国际 AI 晨间简报',
|
|
279
|
+
'/cron 工作日 6:07 写过去 48 小时国际 AI 大事',
|
|
280
|
+
'/cron 每周一 6:07 整理国际 AI 超级个体创业案例',
|
|
281
|
+
'/cron create --name "晨间简报" --cron "7 6 * * 2-6,0" --prompt "写国际 AI 简报"',
|
|
282
|
+
'/cron create --name "提醒" --cron "5 13 * * *" --prompt "执行提醒" --once',
|
|
283
|
+
'/cron create --name "周报" --cron "7 6 * * 1" --workflow "plan \\"整理周报\\"" --permanent',
|
|
284
|
+
'/cron create --name "定时PPT" --cron "0 */2 * * *" --workflow "ppt.yaml 做个X方案" --max-runs 5',
|
|
285
|
+
'/cron create --name "独立日报" --cron "7 6 * * *" --workflow "daily-news.yaml" --fresh-session',
|
|
286
|
+
'/cron list',
|
|
287
|
+
'/cron pause <id>',
|
|
288
|
+
'/cron resume <id>',
|
|
289
|
+
'/cron run <id>',
|
|
290
|
+
'/cron show <id>',
|
|
291
|
+
'/cron missed',
|
|
292
|
+
'/cron delete <id>',
|
|
293
|
+
].join('\n');
|
|
294
|
+
}
|
|
295
|
+
function tokenize(input) {
|
|
296
|
+
const out = [];
|
|
297
|
+
let cur = '';
|
|
298
|
+
let quote = null;
|
|
299
|
+
for (let i = 0; i < input.length; i++) {
|
|
300
|
+
const ch = input[i];
|
|
301
|
+
if (quote) {
|
|
302
|
+
if (ch === '\\' && i + 1 < input.length) {
|
|
303
|
+
cur += input[++i];
|
|
304
|
+
}
|
|
305
|
+
else if (ch === quote) {
|
|
306
|
+
quote = null;
|
|
307
|
+
}
|
|
308
|
+
else {
|
|
309
|
+
cur += ch;
|
|
310
|
+
}
|
|
311
|
+
continue;
|
|
312
|
+
}
|
|
313
|
+
if (ch === '"' || ch === "'") {
|
|
314
|
+
quote = ch;
|
|
315
|
+
continue;
|
|
316
|
+
}
|
|
317
|
+
if (/\s/.test(ch)) {
|
|
318
|
+
if (cur) {
|
|
319
|
+
out.push(cur);
|
|
320
|
+
cur = '';
|
|
321
|
+
}
|
|
322
|
+
continue;
|
|
323
|
+
}
|
|
324
|
+
cur += ch;
|
|
325
|
+
}
|
|
326
|
+
if (cur)
|
|
327
|
+
out.push(cur);
|
|
328
|
+
return out;
|
|
329
|
+
}
|
|
330
|
+
function parseOptions(argv) {
|
|
331
|
+
const map = {};
|
|
332
|
+
for (let i = 0; i < argv.length; i++) {
|
|
333
|
+
const key = argv[i];
|
|
334
|
+
if (!key.startsWith('--'))
|
|
335
|
+
continue;
|
|
336
|
+
const value = argv[i + 1];
|
|
337
|
+
if (!value || value.startsWith('--')) {
|
|
338
|
+
map[toCamel(key.slice(2))] = 'true';
|
|
339
|
+
continue;
|
|
340
|
+
}
|
|
341
|
+
map[toCamel(key.slice(2))] = value;
|
|
342
|
+
i++;
|
|
343
|
+
}
|
|
344
|
+
return map;
|
|
345
|
+
}
|
|
346
|
+
function toCamel(s) {
|
|
347
|
+
return s.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
348
|
+
}
|