Agent SkillsHKUDS/CLI-Anything › cli-anything-macrocli

cli-anything-macrocli

GitHub

提供MacroCLI命令行工具的使用指南,用于定义、列表、检查或执行GUI宏。支持参数化工作流的调用、干运行模拟及后端路由选择,帮助Agent通过CLI间接操作GUI。

macrocli/agent-harness/cli_anything/macrocli/skills/SKILL.md HKUDS/CLI-Anything

Trigger Scenarios

需要定义新的GUI宏 列出可用的GUI宏 检查宏的参数结构 执行GUI宏任务 查看支持的执行后端

Install

npx skills add HKUDS/CLI-Anything --skill cli-anything-macrocli -g -y
More Options

Non-standard path

npx skills add https://github.com/HKUDS/CLI-Anything/tree/main/macrocli/agent-harness/cli_anything/macrocli/skills -g -y

Use without installing

npx skills use HKUDS/CLI-Anything@cli-anything-macrocli

指定 Agent (Claude Code)

npx skills add HKUDS/CLI-Anything --skill cli-anything-macrocli -a claude-code -g -y

安装 repo 全部 skill

npx skills add HKUDS/CLI-Anything --all -g -y

预览 repo 内 skill

npx skills add HKUDS/CLI-Anything --list

SKILL.md

Frontmatter
{
    "name": "cli-anything-macrocli",
    "description": "Use when the agent wants to define, list, inspect, or execute GUI macros via the MacroCLI CLI. Macros are parameterized, CLI-callable workflows — the agent invokes `macro run <name>` and the system handles backend routing (plugin, file transform, accessibility, compiled GUI replay)."
}

MacroCLI CLI

What It Is

The MacroCLI converts valuable GUI workflows into parameterized, CLI-callable macros. Agents never touch the GUI directly — they call macros through this stable CLI, and the runtime routes execution to the best available backend (native plugin/API, file transformation, semantic UI control, or precompiled GUI macro replay).

Installation

cd macrocli/agent-harness
pip install -e .

Requirements: Python 3.10+, PyYAML, click, prompt-toolkit.

Quick Start (for agents)

# 1. See what macros are available
cli-anything-macrocli macro list --json

# 2. Inspect a macro's parameters
cli-anything-macrocli macro info export_file --json

# 3. Dry-run to check params without side effects
cli-anything-macrocli --dry-run macro run export_file \
    --param output=/tmp/test.txt --json

# 4. Execute a macro
cli-anything-macrocli macro run export_file \
    --param output=/tmp/result.txt --json

# 5. See what backends are available
cli-anything-macrocli backends --json

Command Reference

Global Flags

Flag Description
--json Machine-readable JSON output on stdout
--dry-run Simulate all steps, skip side effects
--session-id <id> Resume or create a named session

macro group

Command Description
macro list List all available macros
macro info <name> Show macro schema (parameters, steps, conditions)
macro run <name> --param k=v Execute a macro
macro dry-run <name> --param k=v Simulate without side effects
macro validate [name] Structural validation
macro define <name> Scaffold a new macro YAML

session group

Command Description
session status Show session statistics
session history Show recent run history
session save Persist session to disk
session list List all saved sessions

backends

cli-anything-macrocli backends --json
# Shows: native_api, file_transform, semantic_ui, gui_macro, recovery
# and whether each is available in the current environment.

Macro Parameters

Pass parameters with --param key=value. Repeat for multiple:

cli-anything-macrocli macro run transform_json \
    --param file=/path/to/data.json \
    --param key=settings.theme \
    --param value=dark \
    --json

Output Format (--json)

All commands output JSON when --json is set:

{
  "success": true,
  "macro_name": "export_file",
  "output": {
    "exported_file": "/tmp/result.txt"
  },
  "error": "",
  "telemetry": {
    "duration_ms": 312,
    "steps_total": 2,
    "steps_run": 2,
    "backends_used": ["native_api"],
    "dry_run": false
  }
}

On failure ("success": false), read the "error" field for the reason. Exit code is 1 on failure.

Execution Backends

Backends are selected automatically based on the macro step definition:

Backend Triggered by Use case
native_api backend: native_api Subprocess / shell command
file_transform backend: file_transform XML, JSON, text file editing
semantic_ui backend: semantic_ui Accessibility / keyboard shortcuts
gui_macro backend: gui_macro Precompiled coordinate replay
recovery backend: recovery Retry / fallback orchestration

Writing Macros

Macros are YAML files in cli_anything/macrocli/macro_definitions/. Scaffold one with:

cli-anything-macrocli macro define my_macro --output \
    cli_anything/macrocli/macro_definitions/examples/my_macro.yaml

Minimal schema:

name: my_macro
version: "1.0"
description: What this macro does.

parameters:
  output:
    type: string
    required: true
    description: Where to write results.
    example: /tmp/result.txt

preconditions:
  - file_exists: /path/to/input

steps:
  - id: step1
    backend: native_api
    action: run_command
    params:
      command: [my-app, --export, "${output}"]
    timeout_ms: 30000
    on_failure: fail  # or: skip, continue

postconditions:
  - file_exists: ${output}
  - file_size_gt: [${output}, 100]

outputs:
  - name: result_file
    path: ${output}

agent_hints:
  danger_level: safe  # safe | moderate | dangerous
  side_effects: [creates_file]
  reversible: true

Agent Usage Rules

  1. Always use --json for programmatic output.
  2. Use --dry-run to validate params before executing side-effectful macros.
  3. Check success field — do not assume success from exit code alone.
  4. Read error field when success is false — it explains what failed.
  5. Use macro info <name> to discover params before calling macro run.
  6. Use absolute paths for all file parameters.

Example Workflow

# Step 1: What's available?
cli-anything-macrocli macro list --json

# Step 2: What params does transform_json need?
cli-anything-macrocli macro info transform_json --json

# Step 3: Test safely
cli-anything-macrocli --dry-run macro run transform_json \
    --param file=/tmp/config.json \
    --param key=theme \
    --param value=dark --json

# Step 4: Execute for real
cli-anything-macrocli macro run transform_json \
    --param file=/tmp/config.json \
    --param key=theme \
    --param value=dark --json

Version

1.0.0

Version History

  • 6f372d3 Current 2026-08-20 06:41

Same Skill Collection

3MF/agent-harness/cli_anything/threemf/skills/SKILL.md
adguardhome/agent-harness/cli_anything/adguardhome/skills/SKILL.md
anygen/agent-harness/cli_anything/anygen/skills/SKILL.md
audacity/agent-harness/cli_anything/audacity/skills/SKILL.md
blender/agent-harness/cli_anything/blender/skills/SKILL.md
browser/agent-harness/cli_anything/browser/skills/SKILL.md
calibre/agent-harness/cli_anything/calibre/skills/SKILL.md
cc-switch/agent-harness/cli_anything/ccswitch/skills/SKILL.md
chromadb/agent-harness/cli_anything/chromadb/skills/SKILL.md
cli-hub-matrix/3d-cad/SKILL.md
cli-hub-matrix/game-development/SKILL.md
cli-hub-matrix/image-design/SKILL.md
cli-hub-matrix/knowledge-research/SKILL.md
cli-hub-meta-skill/SKILL.md
cloudanalyzer/agent-harness/cli_anything/cloudanalyzer/skills/SKILL.md
cloudcompare/agent-harness/cli_anything/cloudcompare/skills/SKILL.md
codex-skill/SKILL.md
comfyui/agent-harness/cli_anything/comfyui/skills/SKILL.md
dify-workflow/agent-harness/cli_anything/dify_workflow/skills/SKILL.md
drawio/agent-harness/cli_anything/drawio/skills/SKILL.md
eez-studio/agent-harness/cli_anything/eez_studio/skills/SKILL.md
eth2-quickstart/agent-harness/cli_anything/eth2_quickstart/skills/SKILL.md
exa/agent-harness/cli_anything/exa/skills/SKILL.md
firefly-iii/agent-harness/cli_anything/firefly_iii/skills/SKILL.md
firefly-iii/agent-harness/skills/cli-anything-firefly-iii/SKILL.md
gimp/agent-harness/cli_anything/gimp/skills/SKILL.md
godot/agent-harness/cli_anything/godot/skills/SKILL.md
hermes-skill/SKILL.md
inkscape/agent-harness/cli_anything/inkscape/skills/SKILL.md
intelwatch/agent-harness/cli_anything/intelwatch/skills/SKILL.md
joplin/agent-harness/cli_anything/joplin/skills/SKILL.md
jumpserver/agent-harness/cli_anything/jumpserver/skills/SKILL.md
kdenlive/agent-harness/cli_anything/kdenlive/skills/SKILL.md
krita/agent-harness/cli_anything/krita/skills/SKILL.md
libreoffice/agent-harness/cli_anything/libreoffice/skills/SKILL.md
live2d/agent-harness/cli_anything/live2d/skills/SKILL.md
macrocli/SKILL.md
mailchimp/agent-harness/cli_anything/mailchimp/skills/SKILL.md
mermaid/agent-harness/cli_anything/mermaid/skills/SKILL.md
minimax/agent-harness/cli_anything/minimax/skills/SKILL.md
mubu/agent-harness/cli_anything/mubu/skills/SKILL.md
musescore/agent-harness/cli_anything/musescore/skills/SKILL.md
n8n/agent-harness/cli_anything/n8n/skills/SKILL.md
notebooklm/agent-harness/cli_anything/notebooklm/skills/SKILL.md
novita/agent-harness/cli_anything/novita/skills/SKILL.md
nsight-graphics/agent-harness/cli_anything/nsight_graphics/skills/SKILL.md
nslogger/agent-harness/cli_anything/nslogger/skills/SKILL.md
obs-studio/agent-harness/cli_anything/obs_studio/skills/SKILL.md
obsidian/agent-harness/cli_anything/obsidian/skills/SKILL.md

Metadata

Files
0
Version
6f372d3
Hash
4b5f2fff
Indexed
2026-08-20 06:41

Home - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-22 10:25
浙ICP备14020137号-1 $Map of visitor$