跳到正文
Skillpedia
自动化58k · #3221

cli-anything-macrocli

它能做什么

这个技能让 AI 智能体列出、检查和运行 GUI 宏。宏是可以设置输入的已保存工作流。适合希望通过可靠命令完成日常应用任务的人。

适用场景

  • ✓当你想让智能体用特定设置运行已保存的桌面工作流的时候。
  • ✓当你需要查看有哪些宏,以及每个宏需要哪些输入的时候。
  • ✓当你想先试运行,查看工作流会做什么而不做任何改动的时候。

技能链接

https://github.com/HKUDS/CLI-Anything/blob/main/macrocli/agent-harness/cli_anything/macrocli/skills/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/HKUDS/CLI-Anything/blob/main/macrocli/agent-harness/cli_anything/macrocli/skills/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“我想在 Q3 报告上运行我的导出宏,并把结果保存到我的“文档”文件夹。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体通过一条命令传入宏名称及其输入,系统会选择执行每一步的最佳方式。试运行可以先显示各个步骤。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

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
常见问题

智能体会自己在应用界面上点击吗?

不会。该技能说明,智能体通过稳定的命令行调用宏,由运行时决定每一步如何执行。

我可以在宏真正修改内容之前测试它吗?

可以。该技能说明了一个试运行选项,它会模拟各个步骤并跳过副作用。

使用它需要安装什么?

该技能需要 Python 3.10 或更高版本,以及一些配套的 Python 包,需要从封装文件夹中安装。

详情

作者的原始描述

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).

repo: HKUDS/CLI-Anything

热度

GitHub 星标
58k
排名
#3221
许可证
Apache-2.0
更新时间
2026/9/21

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能