Full Code of HKUDS/CLI-Anything for AI

main 8ad7efaf7969 cached
5 files
79.5 KB
25.2k tokens
1 requests
Download .txt
Repository: HKUDS/CLI-Anything
Branch: main
Commit: 8ad7efaf7969
Files: 5
Total size: 79.5 KB

Directory structure:
gitextract_12ysvy81/

├── .gitignore
├── CONTRIBUTING.md
├── README.md
├── README_CN.md
└── registry.json

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
# ============================================================
# Only track:
#   - cli-anything-plugin/**
#   - codex-skill/**
#   - */agent-harness/**  (under each software dir)
#   - .gitignore
# Everything else is ignored.
# ============================================================

# Step 1: Ignore everything at the root
/*

# Step 2: Allow .gitignore, README, assets, and marketplace
!.gitignore
!/README.md
!/CONTRIBUTING.md
!/assets/
!/.claude-plugin/
!/.github/

# Step 3: Allow cli-anything-plugin, codex-skill, and skill_generation tests
!/cli-anything-plugin/
!/codex-skill/
!/skill_generation/
!/openclaw-skill/

# Step 4: Allow each software dir (top level only)
!/gimp/
!/blender/
!/inkscape/
!/audacity/
!/libreoffice/
!/mubu/
!/obs-studio/
!/kdenlive/
!/shotcut/
!/anygen/
!/zoom/
!/drawio/
!/mermaid/
!/adguardhome/
!/ollama/

# Step 5: Inside each software dir, ignore everything (including dotfiles)
/gimp/*
/gimp/.*
/blender/*
/blender/.*
/inkscape/*
/inkscape/.*
/audacity/*
/audacity/.*
/libreoffice/*
/libreoffice/.*
/mubu/*
/mubu/.*
/obs-studio/*
/obs-studio/.*
/kdenlive/*
/kdenlive/.*
/shotcut/*
/shotcut/.*
/anygen/*
/anygen/.*
/zoom/*
/zoom/.*
/drawio/*
/drawio/.*
/mermaid/*
/mermaid/.*
/adguardhome/*
/adguardhome/.*
/ollama/*
/ollama/.*

# Step 6: ...except agent-harness/
!/gimp/agent-harness/
!/blender/agent-harness/
!/inkscape/agent-harness/
!/audacity/agent-harness/
!/libreoffice/agent-harness/
!/mubu/agent-harness/
!/obs-studio/agent-harness/
!/kdenlive/agent-harness/
!/shotcut/agent-harness/
!/anygen/agent-harness/
!/zoom/agent-harness/
!/drawio/agent-harness/
!/mermaid/agent-harness/
!/adguardhome/agent-harness/
!/ollama/agent-harness/

# Step 7: Ignore build artifacts within allowed dirs
**/__pycache__/
**/*.egg-info/
**/*.pyc
**/dist/
**/build/
**/.pytest_cache/
**/*.egg
**/*.mp4
**/*.wav
**/*.blend
**/*.xcf
**/*.mlt
**/*.drawio

# Step 8: But allow assets images
!/assets/*.png
!/assets/*.jpg

assets/gen_typing_gif.py
!README_CN.md
!opencode-commands/
!/qoder-plugin/

# Step 10: Allow CLI Hub registry and frontend
!/registry.json
!/docs/
/docs/*
!/docs/hub/
!/notebooklm/
/notebooklm/*
/notebooklm/.*
!/notebooklm/agent-harness/


================================================
FILE: CONTRIBUTING.md
================================================
# Contributing to CLI-Anything

Thank you for your interest in contributing to CLI-Anything! This guide will help you get started.

## Types of Contributions

We welcome three main categories of contributions:

### A) CLIs for New Software

Adding a new CLI harness is the most impactful contribution. Before submitting a PR, ensure the following are in place:

1. **`<SOFTWARE>.md`** — the SOP document exists at `<software>/agent-harness/<SOFTWARE>.md` describing the harness architecture.
2. **`SKILL.md`** — the AI-discoverable skill definition exists inside the Python package at `cli_anything/<software>/SKILL.md`.
3. **Tests** — unit tests (`test_core.py`, passable without backend) and E2E tests (`test_full_e2e.py`) are present and passing.
4. **`README.md`** — the project README includes the new software with a link to its harness directory.
5. **`registry.json`** — add an entry for the new software so it appears on the [CLI-Hub](https://hkuds.github.io/CLI-Anything/hub/).
6. **`repl_skin.py`** — an unmodified copy from the plugin exists in `utils/`.

### B) New Features

Feature contributions improve existing harnesses or the plugin framework. Examples include new CLI commands, output formats, backend improvements, or cross-platform fixes.

- Open an issue first to discuss the feature before starting work.
- Follow existing code patterns and conventions in the target harness.
- Include tests for any new functionality.

### C) Bug Fixes

Bug fixes resolve incorrect behavior in existing harnesses or the plugin.

- Reference the related issue in your PR (e.g., `Fixes #123`).
- Include a test that reproduces the bug and verifies the fix.
- Ensure all existing tests for the affected harness still pass.

## CLI-Hub & Registry

All available CLIs are listed in `registry.json` at the repo root and displayed on the [CLI-Hub](https://hkuds.github.io/CLI-Anything/hub/). The hub reads `registry.json` directly from `main`, so it updates immediately when a PR is merged.

### Adding a new CLI to the Hub

Include an entry in `registry.json` as part of your PR. Each entry has this shape:

```json
{
  "name": "my-software",
  "display_name": "My Software",
  "version": "1.0.0",
  "description": "Short description of what the CLI does",
  "requires": "backend software or null",
  "install_cmd": "pip install git+https://github.com/HKUDS/CLI-Anything.git#subdirectory=my-software/agent-harness",
  "entry_point": "cli-anything-my-software",
  "skill_md": "my-software/agent-harness/cli_anything/my_software/skills/SKILL.md",
  "category": "category-name"
}
```

### Updating an existing CLI on the Hub

When you modify an existing harness, update its `registry.json` entry in the same PR:

- Bump the `version` field to reflect the change.
- Update `description`, `requires`, or `category` if they changed.
- The hub will reflect the update as soon as the PR is merged to `main`.

## Development Setup

Each generated CLI lives in `<software>/agent-harness/` and is an independent Python package:

```bash
# Clone the repo
git clone https://github.com/HKUDS/CLI-Anything.git
cd CLI-Anything

# Install a harness in editable mode
cd <software>/agent-harness
pip install -e .

# Run tests
python3 -m pytest cli_anything/<software>/tests/ -v
```

### Requirements

- Python 3.10+
- Click 8.0+
- pytest 7.0+

## Code Style

- Follow PEP 8 conventions.
- Use type hints where practical.
- All CLI commands must support the `--json` flag for machine-readable output.

## Commit Messages

Use clear, descriptive commit messages following the conventional format:

```
feat: add Krita CLI harness
fix: resolve Blender backend path on macOS
docs: update README with new software entry
test: add unit tests for Inkscape layer commands
```

## Running Tests

```bash
# Unit tests (no backend software needed)
python3 -m pytest cli_anything/<software>/tests/test_core.py -v

# E2E tests (requires real backend installed)
python3 -m pytest cli_anything/<software>/tests/test_full_e2e.py -v

# All tests for a harness
python3 -m pytest cli_anything/<software>/tests/ -v
```

## Submitting a Pull Request

1. Fork the repository and create a feature branch from `main`.
2. Make your changes following the guidelines above.
3. Ensure all tests pass for any harnesses you modified.
4. Push your branch and open a Pull Request against `main`.
5. Fill out the PR template completely.

## Questions?

If you have questions, feel free to open a [Discussion](https://github.com/HKUDS/CLI-Anything/discussions) or an issue tagged with `type: question`.


================================================
FILE: README.md
================================================
<h1 align="center"><img src="assets/icon.png" alt="" width="64" style="vertical-align: middle;">&nbsp; CLI-Anything: Making ALL Software Agent-Native</h1>

<p align="center">
  <strong>Today's Software Serves Humans👨‍💻. Tomorrow's Users will be Agents🤖.<br>
CLI-Anything: Bridging the Gap Between AI Agents and the World's Software</strong><br>
</p>

<p align="center">
  <a href="#-quick-start"><img src="https://img.shields.io/badge/Quick_Start-5_min-blue?style=for-the-badge" alt="Quick Start"></a>
  <a href="https://hkuds.github.io/CLI-Anything/hub/"><img src="https://img.shields.io/badge/CLI_Hub-Browse_%26_Install-ff69b4?style=for-the-badge" alt="CLI Hub"></a>
  <a href="#-demonstrations"><img src="https://img.shields.io/badge/Demos-16_Apps-green?style=for-the-badge" alt="Demos"></a>
  <a href="#-test-results"><img src="https://img.shields.io/badge/Tests-1%2C839_Passing-brightgreen?style=for-the-badge" alt="Tests"></a>
  <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-yellow?style=for-the-badge" alt="License"></a>
</p>

<p align="center">
  <img src="https://img.shields.io/badge/python-≥3.10-blue?logo=python&logoColor=white" alt="Python">
  <img src="https://img.shields.io/badge/click-≥8.0-green" alt="Click">
  <img src="https://img.shields.io/badge/pytest-100%25_pass-brightgreen" alt="Pytest">
  <img src="https://img.shields.io/badge/coverage-unit_%2B_e2e-orange" alt="Coverage">
  <img src="https://img.shields.io/badge/output-JSON_%2B_Human-blueviolet" alt="Output">
  <a href="https://github.com/HKUDS/.github/blob/main/profile/README.md"><img src="https://img.shields.io/badge/Feishu-Group-E9DBFC?style=flat&logo=feishu&logoColor=white" alt="Feishu"></a>
<a href="https://github.com/HKUDS/.github/blob/main/profile/README.md"><img src="https://img.shields.io/badge/WeChat-Group-C5EAB4?style=flat&logo=wechat&logoColor=white" alt="WeChat"></a>
</p>

**One Command Line**: Make any software agent-ready for OpenClaw, nanobot, Cursor, Claude Code, etc.&nbsp;&nbsp;[**中文文档**](README_CN.md) | [**日本語ドキュメント**](README_JA.md)

**🌐 [CLI-Hub](https://hkuds.github.io/CLI-Anything/hub/)**: Browse & install all community CLIs in one place. Have a CLI for a new software? [Open a PR](https://github.com/HKUDS/CLI-Anything/blob/main/CONTRIBUTING.md) — the hub updates instantly.

<p align="center">
  <img src="assets/cli-typing.gif" alt="CLI-Anything typing demo" width="800">
</p>

<p align="center">
  <img src="assets/teaser.png" alt="CLI-Anything Teaser" width="800">
</p>

---

## 📰 News

> Thanks to all invaluable efforts from the community! More updates continuously on the way everyday..

- **2026-03-17** 🌐 Launched the **[CLI-Hub](https://hkuds.github.io/CLI-Anything/hub/)** — a central registry where you can browse, search, and install any CLI with a single `pip` command. Contributors can add new CLIs or update existing ones by simply opening a PR with a `registry.json` entry. The hub updates automatically on merge.

- **2026-03-16** 🤖 Added **SKILL.md generation** (Phase 6.5) — every generated CLI now ships with an AI-discoverable skill definition inside the Python package. ReplSkin auto-detects the skill file after `pip install`, and the REPL banner displays the absolute path for agents. Includes `skill_generator.py`, Jinja2 template, `package_data` in all setup.py files, and 51 new tests.

- **2026-03-15** 🐾 Support for **OpenClaw** from the community! Merged Windows `cygpath` guard to ensure CLI-Anything works reliably in Windows bash environments. Community contributions continue to strengthen cross-platform support.

- **2026-03-14** 🔒 Fixed a GIMP Script-Fu path injection vulnerability and added **Japanese README** translation. OpenCode version requirements documented alongside several Windows compatibility improvements.

<details>
<summary>Earlier news</summary>

- **2026-03-13** 🔌 **Qodercli** plugin officially merged as a community contribution with dedicated setup scripts. Codex skill gained a Windows install script, and placeholder URLs were cleaned up across the project.

- **2026-03-12** 📦 **Codex skill** integration landed, bringing CLI-Anything to yet another AI coding platform. Qodercli support was also introduced, and documentation was updated with limitations and experimental labels.

- **2026-03-11** 📞 **Zoom** video conferencing harness added as the 11th supported application. Multiple community fixes shipped for Shotcut auto-save, LibreOffice Windows/macOS backend, and OpenCode support.

</details>

---

## 🤔 Why CLI?

CLI is the universal interface for both humans and AI agents:

• **Structured & Composable** - Text commands match LLM format and chain for complex workflows

• **Lightweight & Universal** - Minimal overhead, works across all systems without dependencies

• **Self-Describing** - --help flags provide automatic documentation agents can discover

• **Proven Success** - Claude Code runs thousands of real workflows through CLI daily

• **Agent-First Design** - Structured JSON output eliminates parsing complexity

• **Deterministic & Reliable** - Consistent results enable predictable agent behavior

## 🚀 Quick Start

### Prerequisites

- **Python 3.10+**
- Target software installed (e.g., GIMP, Blender, LibreOffice, or your own application)
- A supported AI coding agent: [Claude Code](#-claude-code) | [OpenClaw](#-openclaw) | [OpenCode](#-opencode) | [Codex](#-codex) | [Qodercli](#-qodercli) | [More Platforms](#-more-platforms-coming-soon)

### Pick Your Platform

<details open>
<summary><h4 id="-claude-code">⚡ Claude Code</h4></summary>

**Step 1: Add the Marketplace**

CLI-Anything is distributed as a Claude Code plugin marketplace hosted on GitHub.

```bash
# Add the CLI-Anything marketplace
/plugin marketplace add HKUDS/CLI-Anything
```

**Step 2: Install the Plugin**

```bash
# Install the cli-anything plugin from the marketplace
/plugin install cli-anything
```

That's it. The plugin is now available in your Claude Code session.

> **Note for Win Users:** Claude Code runs shell commands via `bash`. On Windows, install Git for Windows (includes `bash` and
`cygpath`) or use WSL; otherwise commands may fail with `cygpath: command not found`.

**Step 3: Build a CLI in One Command**

```bash
# /cli-anything:cli-anything <software-path-or-repo>
# Generate a complete CLI for GIMP (all 7 phases)
/cli-anything:cli-anything ./gimp

# Note: If your Claude Code is under 2.x, use "/cli-anything" instead.
```

This runs the full pipeline:
1. 🔍 **Analyze** — Scans source code, maps GUI actions to APIs
2. 📐 **Design** — Architects command groups, state model, output formats
3. 🔨 **Implement** — Builds Click CLI with REPL, JSON output, undo/redo
4. 📋 **Plan Tests** — Creates TEST.md with unit + E2E test plans
5. 🧪 **Write Tests** — Implements comprehensive test suite
6. 📝 **Document** — Updates TEST.md with results
7. 📦 **Publish** — Creates `setup.py`, installs to PATH

**Step 4 (Optional): Refine and Improve the CLI**

After the initial build, you can iteratively refine the CLI to expand coverage and add missing capabilities:

```bash
# Broad refinement — agent analyzes gaps across all capabilities
/cli-anything:refine ./gimp

# Focused refinement — target a specific functionality area
/cli-anything:refine ./gimp "I want more CLIs on image batch processing and filters"
```

The refine command performs gap analysis between the software's full capabilities and current CLI coverage, then implements new commands, tests, and documentation for the identified gaps. You can run it multiple times to steadily expand coverage — each run is incremental and non-destructive.

<details>
<summary><strong>Alternative: Manual Installation</strong></summary>

If you prefer not to use the marketplace:

```bash
# Clone the repo
git clone https://github.com/HKUDS/CLI-Anything.git

# Copy plugin to Claude Code plugins directory
cp -r CLI-Anything/cli-anything-plugin ~/.claude/plugins/cli-anything

# Reload plugins
/reload-plugins
```

</details>

</details>

<details>
<summary><h4 id="-opencode">⚡ OpenCode (Experimental)</h4></summary>

**Step 1: Install the Commands**

> **Note:** Please upgrade to the latest OpenCode. Older versions may use a different commands path.

Copy the CLI-Anything commands **and** `HARNESS.md` to your OpenCode commands directory:

```bash
# Clone the repo
git clone https://github.com/HKUDS/CLI-Anything.git

# Global install (available in all projects)
cp CLI-Anything/opencode-commands/*.md ~/.config/opencode/commands/
cp CLI-Anything/cli-anything-plugin/HARNESS.md ~/.config/opencode/commands/

# Or project-level install
cp CLI-Anything/opencode-commands/*.md .opencode/commands/
cp CLI-Anything/cli-anything-plugin/HARNESS.md .opencode/commands/
```

> **Note:** `HARNESS.md` is the methodology spec that all commands reference. It must be in the same directory as the commands.

This adds 5 slash commands: `/cli-anything`, `/cli-anything-refine`, `/cli-anything-test`, `/cli-anything-validate`, and `/cli-anything-list`.

**Step 2: Build a CLI in One Command**

```bash
# Generate a complete CLI for GIMP (all 7 phases)
/cli-anything ./gimp

# Build from a GitHub repo
/cli-anything https://github.com/blender/blender
```

The command runs as a subtask and follows the same 7-phase methodology as Claude Code.

**Step 3 (Optional): Refine and Improve the CLI**

```bash
# Broad refinement — agent analyzes gaps across all capabilities
/cli-anything-refine ./gimp

# Focused refinement — target a specific functionality area
/cli-anything-refine ./gimp "batch processing and filters"
```

</details>

<details>
<summary><h4 id="-goose">⚡ Goose (Desktop / CLI) <sup><code>Experimental</code></sup> <sup><code>Community</code></sup></h4></summary>

**Step 1: Install Goose**

Install Goose (Desktop or CLI) using the official Goose instructions for your OS.

**Step 2: Configure a CLI Provider**

Configure Goose to use a CLI provider such as Claude Code, and make sure that CLI is installed and authenticated.

**Step 3: Use CLI-Anything in a Goose Session**

Once Goose is configured, start a session and use the same CLI-Anything commands described above for Claude Code, for example:

```bash
/cli-anything:cli-anything ./gimp
/cli-anything:refine ./gimp "batch processing and filters"
```

> Note: When Goose runs through a CLI provider, it uses that provider's capabilities and command format.
</details>

<details>

<summary><h4 id="-qodercli">⚡ Qodercli <sup><code>Community</code></sup></h4></summary>

**Step 1: Register the Plugin**

```bash
git clone https://github.com/HKUDS/CLI-Anything.git
bash CLI-Anything/qoder-plugin/setup-qodercli.sh
```

This registers the cli-anything plugin in `~/.qoder.json`. Start a new Qodercli session after registration.

**Step 2: Use CLI-Anything from Qodercli**

```bash
/cli-anything:cli-anything ./gimp
/cli-anything:refine ./gimp "batch processing and filters"
/cli-anything:validate ./gimp
```
</details>

<details>

<summary><h4 id="-openclaw">⚡ OpenClaw <sup><code>Community</code></sup></h4></summary>

**Step 1: Install the Skill**

CLI-Anything provides a native OpenClaw `SKILL.md` file. Copy it to your OpenClaw skills directory:

```bash
# Clone the repo
git clone https://github.com/HKUDS/CLI-Anything.git

# Install to the global skills folder
mkdir -p ~/.openclaw/skills/cli-anything
cp CLI-Anything/openclaw-skill/SKILL.md ~/.openclaw/skills/cli-anything/SKILL.md
```

**Step 2: Build a CLI**

Now you can invoke the skill inside OpenClaw:

`@cli-anything build a CLI for ./gimp`

The skill follows the same 7-phase methodology as Claude Code and OpenCode.

</details>

<details>

<summary><h4 id="-codex">⚡ Codex <sup><code>Experimental</code></sup> <sup><code>Community</code></sup></h4></summary>

**Step 1: Install the Skill**

Run the bundled installer:

```bash
# Clone the repo
git clone https://github.com/HKUDS/CLI-Anything.git

# Install the skill
bash CLI-Anything/codex-skill/scripts/install.sh
```

On Windows PowerShell, use:

```powershell
.\CLI-Anything\codex-skill\scripts\install.ps1
```

This installs the skill to `$CODEX_HOME/skills/cli-anything` (or `~/.codex/skills/cli-anything` if `CODEX_HOME` is unset).

Restart Codex after installation so it is discovered.

**Step 2: Use CLI-Anything from Codex**

Describe the task in natural language, for example:

```text
Use CLI-Anything to build a harness for ./gimp
Use CLI-Anything to refine ./shotcut for picture-in-picture workflows
Use CLI-Anything to validate ./libreoffice
```

The Codex skill adapts the same methodology used by the Claude Code plugin and
OpenCode commands, while keeping the generated Python harness format unchanged.
</details>

<details>
<summary><h4 id="-more-platforms-coming-soon">🔮 More Platforms (Coming Soon)</h4></summary>

CLI-Anything is designed to be platform-agnostic. Support for more AI coding agents is planned:

- **Codex** — available via the bundled skill in `codex-skill/`
- **Cursor** — coming soon
- **Windsurf** — coming soon
- **Your favorite tool** — contributions welcome! See the `opencode-commands/` directory for a reference implementation.

</details>

### Use the Generated CLI

Regardless of which platform you used to build it, the generated CLI works the same way:

```bash
# Install to PATH
cd gimp/agent-harness && pip install -e .

# Use from anywhere
cli-anything-gimp --help
cli-anything-gimp project new --width 1920 --height 1080 -o poster.json
cli-anything-gimp --json layer add -n "Background" --type solid --color "#1a1a2e"

# Enter interactive REPL
cli-anything-gimp
```

Each installed CLI ships with a [`SKILL.md`](#-skillmd-generation) inside the Python package (`cli_anything/<software>/skills/SKILL.md`). The REPL banner automatically displays the absolute path to this file so AI agents know exactly where to read the skill definition. No extra configuration needed — `pip install` makes the skill discoverable.

---

## 💡 CLI-Anything's Vision: Building Agent-Native Software

• 🌐 **Universal Access** - Every software becomes instantly agent-controllable through structured CLI.

• 🔗 **Seamless Integration** - Agents control any application without APIs, GUI, rebuilding or complex wrappers.

• 🚀 **Future-Ready Ecosystem** - Transform human-designed software into agent-native tools with one command.

---

## 🔧 When to Use CLI-Anything

| Category | How to be Agent-native | Notable Examples |
|----------|----------------------|----------|
| **📂 GitHub Repositories** | Transform any open-source project into agent-controllable tools through automatic CLI generation | VSCodium, WordPress, Calibre, Zotero, Joplin, Logseq, Penpot, Super Productivity |
| **🤖 AI/ML Platforms** | Automate model training, inference pipelines, and hyperparameter tuning through structured commands | Stable Diffusion WebUI, ComfyUI, Ollama, InvokeAI, Text-generation-webui, Open WebUI, Fooocus, Kohya_ss, AnythingLLM, SillyTavern |
| **📊 Data & Analytics** | Enable programmatic data processing, visualization, and statistical analysis workflows | JupyterLab, Apache Superset, Metabase, Redash, DBeaver, KNIME, Orange, OpenSearch Dashboards, Lightdash |
| **💻 Development Tools** | Streamline code editing, building, testing, and deployment processes via command interfaces | Jenkins, Gitea, Hoppscotch, Portainer, pgAdmin, SonarQube, ArgoCD, OpenLens, Insomnia, Beekeeper Studio |
| **🎨 Creative & Media** | Control content creation, editing, and rendering workflows programmatically | Blender, GIMP, OBS Studio, Audacity, Krita, Kdenlive, Shotcut, Inkscape, Darktable, LMMS, Ardour |
| **🔬 Scientific Computing** | Automate research workflows, simulations, and complex calculations | ImageJ, FreeCAD, QGIS, ParaView, Gephi, LibreCAD, Stellarium, KiCad, JASP, Jamovi |
| **🏢 Enterprise & Office** | Convert business applications and productivity tools into agent-accessible systems | NextCloud, GitLab, Grafana, Mattermost, LibreOffice, AppFlowy, NocoDB, Odoo (Community), Plane, ERPNext |
| **📞 Communication & Collaboration** | Automate meeting scheduling, participant management, recording retrieval, and reporting through structured CLI | Zoom, Jitsi Meet, BigBlueButton, Mattermost |
| **📐 Diagramming & Visualization** | Create and manipulate diagrams, flowcharts, architecture diagrams, and visual documentation programmatically | Draw.io (diagrams.net), Mermaid, PlantUML, Excalidraw, yEd |
| **🌐 Network & Infrastructure** | Manage network services, DNS, ad-blocking, and infrastructure through structured CLI commands | AdGuardHome |
| **✨ AI Content Generation** | Generate professional deliverables (slides, docs, diagrams, websites, research reports) through AI-powered cloud APIs | [AnyGen](https://www.anygen.io), Gamma, Beautiful.ai, Tome |

---

## CLI-Anything's Key Features

### The Agent-Software Gap
AI agents are great at reasoning but terrible at using real professional software. Current solutions are fragile UI automation, limited APIs, or dumbed-down reimplementations that miss 90% of functionality.

**CLI-Anything's Solution**: Transform any professional software into agent-native tools without losing capabilities.

| **Current Pain Point** | **CLI-Anything's Fix** |
|----------|----------------------|
| 🤖 "AI can't use real tools" | Direct integration with actual software backends (Blender, LibreOffice, FFmpeg) — full professional capabilities, zero compromises |
| 💸 "UI automation breaks constantly" | No screenshots, no clicking, no RPA fragility. Pure command-line reliability with structured interfaces |
| 📊 "Agents need structured data" | Built-in JSON output for seamless agent consumption + human-readable formats for debugging |
| 🔧 "Custom integrations are expensive" | One Claude plugin auto-generates CLIs for ANY codebase through proven 7-phase pipeline |
| ⚡ "Prototype vs Production gap" | 1,839+ tests with real software validation. Battle-tested across 16 major applications |

---

## 🎯 What Can You Do with CLI-Anything?

<table>
<tr>
<td width="33%">

### 🛠️ Let Agents Take Your Workflows

Professional or everyday — just throw the codebase at `/cli-anything`. GIMP, Blender, Shotcut for creative work. LibreOffice, OBS Studio for daily tasks. Don't have the source? Find an open-source alternative and throw *that* in. You'll instantly get a full CLI your agents can use.

</td>
<td width="33%">

### 🔗 Unify Scattered APIs into One CLI

Tired of juggling fragmented web service APIs? Feed the docs or SDK manuscripts to `/cli-anything` and your agents get a **powerful, stateful CLI** that wraps those individual endpoints into coherent command groups. One tool instead of dozens of raw API calls — stronger capabilities while saving tokens.

</td>
<td width="33%">

### 🚀 Replace or Supercharge GUI Agents

CLI-Anything can flat-out **replace GUI-based agent approaches** — no more screenshots, no brittle pixel-clicking. But here's the fun part: once you `/cli-anything` a GUI software, you can **synthesize agent tasks, evaluators, and benchmarks** entirely via code and terminal — fully automated, iteratively refinable, massively more efficient.

</td>
</tr>
</table>

---

## ✨ ⚙️ How CLI-Anything Works

<table>
<tr>
<td width="50%">

### 🏗️ Fully Automated 7-Phase Pipeline
From codebase analysis to PyPI publishing — the plugin handles architecture design, implementation, test planning, test writing, and documentation completely automatically.

</td>
<td width="50%">

### 🎯 Authentic Software Integration
Direct calls to real applications for actual rendering. LibreOffice generates PDFs, Blender renders 3D scenes, Audacity processes audio via sox. **Zero compromises**, **Zero toy implementations**.

</td>
</tr>
<tr>
<td width="50%">

### 🔁 Smart Session Management
Persistent project state with undo/redo capabilities, plus unified REPL interface (ReplSkin) that delivers consistent interactive experience across all CLIs.

</td>
<td width="50%">

### 📦 Zero-Config Installation
Simple pip install -e . puts cli-anything-<software> directly on PATH. Agents discover tools via standard which commands. No setup, no wrappers.

</td>
</tr>
<tr>
<td width="50%">

### 🧪 Production-Grade Testing
Multi-layered validation: unit tests with synthetic data, end-to-end tests with real files and software, plus CLI subprocess verification of installed commands.

</td>
<td width="50%">

### 🐍 Clean Package Architecture
All CLIs organized under cli_anything.* namespace — conflict-free, pip-installable, with consistent naming: cli-anything-gimp, cli-anything-blender, etc.

</td>
</tr>
</table>

### 🤖 SKILL.md Generation

Each generated CLI includes a `SKILL.md` file inside the Python package at `cli_anything/<software>/skills/SKILL.md`. This self-contained skill definition enables AI agents to discover and use the CLI through Claude Code's skill system or other agent frameworks.

**What SKILL.md provides:**
- **YAML frontmatter** with name and description for agent skill discovery
- **Command groups** with all available subcommands documented
- **Usage examples** for common workflows
- **Agent-specific guidance** for JSON output, error handling, and programmatic use

SKILL.md files are auto-generated during Phase 6.5 of the pipeline using `skill_generator.py`, which extracts metadata directly from the CLI's Click decorators, setup.py, and README. Because the file lives inside the package, it is installed alongside the CLI via `pip install` and auto-detected by the REPL banner — agents can read the absolute path displayed at startup.

---

## 🎬 Demonstrations

### 🎯 General-Purpose
CLI-Anything works on any software with a codebase — no domain restrictions or architectural limitations.

### 🏭 Professional-Grade Testing
Tested across 16 diverse, complex applications spanning creative, productivity, communication, diagramming, AI image generation, AI content generation, network ad blocking, and local LLM inference domains previously inaccessible to AI agents.

### 🎨 Diverse Domain Coverage
From creative workflows (image editing, 3D modeling, vector graphics) to production tools (audio, office, live streaming, video editing).

### ✅ Full CLI Generation
Each application received complete, production-ready CLI interfaces — not demos, but comprehensive tool access preserving full capabilities.

<table>
<tr>
<th align="center">Software</th>
<th align="center">Domain</th>
<th align="center">CLI Command</th>
<th align="center">Backend</th>
<th align="center">Tests</th>
</tr>
<tr>
<td align="center"><strong>🎨 GIMP</strong></td>
<td>Image Editing</td>
<td><code>cli-anything-gimp</code></td>
<td>Pillow + GEGL/Script-Fu</td>
<td align="center">✅ 107</td>
</tr>
<tr>
<td align="center"><strong>🧊 Blender</strong></td>
<td>3D Modeling & Rendering</td>
<td><code>cli-anything-blender</code></td>
<td>bpy (Python scripting)</td>
<td align="center">✅ 208</td>
</tr>
<tr>
<td align="center"><strong>✏️ Inkscape</strong></td>
<td>Vector Graphics</td>
<td><code>cli-anything-inkscape</code></td>
<td>Direct SVG/XML manipulation</td>
<td align="center">✅ 202</td>
</tr>
<tr>
<td align="center"><strong>🎵 Audacity</strong></td>
<td>Audio Production</td>
<td><code>cli-anything-audacity</code></td>
<td>Python wave + sox</td>
<td align="center">✅ 161</td>
</tr>
<tr>
<td align="center"><strong>📄 LibreOffice</strong></td>
<td>Office Suite (Writer, Calc, Impress)</td>
<td><code>cli-anything-libreoffice</code></td>
<td>ODF generation + headless LO</td>
<td align="center">✅ 158</td>
</tr>
<tr>
<td align="center"><strong>📝 <a href="mubu/agent-harness/">Mubu</a></strong></td>
<td>Knowledge Management &amp; Outlining</td>
<td><code>cli-anything-mubu</code></td>
<td>Local Mubu data + sync logs</td>
<td align="center">✅ 96</td>
</tr>
<tr>
<td align="center"><strong>📹 OBS Studio</strong></td>
<td>Live Streaming & Recording</td>
<td><code>cli-anything-obs-studio</code></td>
<td>JSON scene + obs-websocket</td>
<td align="center">✅ 153</td>
</tr>
<tr>
<td align="center"><strong>🎞️ Kdenlive</strong></td>
<td>Video Editing</td>
<td><code>cli-anything-kdenlive</code></td>
<td>MLT XML + melt renderer</td>
<td align="center">✅ 155</td>
</tr>
<tr>
<td align="center"><strong>🎬 Shotcut</strong></td>
<td>Video Editing</td>
<td><code>cli-anything-shotcut</code></td>
<td>Direct MLT XML + melt</td>
<td align="center">✅ 154</td>
</tr>
<tr>
<td align="center"><strong>📞 Zoom</strong></td>
<td>Video Conferencing</td>
<td><code>cli-anything-zoom</code></td>
<td>Zoom REST API (OAuth2)</td>
<td align="center">✅ 22</td>
</tr>
<tr>
<td align="center"><strong>📐 Draw.io</strong></td>
<td>Diagramming</td>
<td><code>cli-anything-drawio</code></td>
<td>mxGraph XML + draw.io CLI</td>
<td align="center">✅ 138</td>
</tr>
<tr>
<td align="center"><strong>🧜 Mermaid Live Editor</strong></td>
<td>Diagramming</td>
<td><code>cli-anything-mermaid</code></td>
<td>Mermaid state + mermaid.ink renderer</td>
<td align="center">✅ 10</td>
</tr>
<tr>
<td align="center"><strong>✨ AnyGen</strong></td>
<td>AI Content Generation</td>
<td><code>cli-anything-anygen</code></td>
<td>AnyGen REST API (anygen.io)</td>
<td align="center">✅ 50</td>
</tr>
<tr>
<td align="center"><strong>🧠 NotebookLM</strong></td>
<td>AI Research Assistant</td>
<td><code>cli-anything-notebooklm</code></td>
<td>NotebookLM CLI wrapper (experimental)</td>
<td align="center">✅ 21</td>
</tr>
<tr>
<td align="center"><strong>🖼️ ComfyUI</strong></td>
<td>AI Image Generation</td>
<td><code>cli-anything-comfyui</code></td>
<td>ComfyUI REST API</td>
<td align="center">✅ 70</td>
</tr>
<tr>
<td align="center"><strong>🛡️ AdGuard Home</strong></td>
<td>Network-wide Ad Blocking</td>
<td><code>cli-anything-adguardhome</code></td>
<td>AdGuard Home REST API</td>
<td align="center">✅ 36</td>
</tr>
<tr>
<td align="center"><strong>🦙 Ollama</strong></td>
<td>Local LLM Inference</td>
<td><code>cli-anything-ollama</code></td>
<td>Ollama REST API</td>
<td align="center">✅ 98</td>
</tr>
<tr>
<td align="center" colspan="4"><strong>Total</strong></td>
<td align="center"><strong>✅ 1,839</strong></td>
</tr>
</table>

> **100% pass rate** across all 1,839 tests — 1,355 unit tests + 484 end-to-end tests.

---

## 📊 Test Results

Each CLI harness undergoes rigorous multi-layered testing to ensure production reliability:

| Layer | What it tests | Example |
|-------|---------------|---------|
| **Unit tests** | Every core function in isolation with synthetic data | `test_core.py` — project creation, layer ops, filter params |
| **E2E tests (native)** | Project file generation pipeline | Valid ODF ZIP structure, correct MLT XML, SVG well-formedness |
| **E2E tests (true backend)** | Real software invocation + output verification | LibreOffice → PDF with `%PDF-` magic bytes, Blender → rendered PNG |
| **CLI subprocess tests** | Installed command via `subprocess.run` | `cli-anything-gimp --json project new` → valid JSON output |

```
================================ Test Summary ================================
gimp          107 passed  ✅   (64 unit + 43 e2e)
blender       208 passed  ✅   (150 unit + 58 e2e)
inkscape      202 passed  ✅   (148 unit + 54 e2e)
audacity      161 passed  ✅   (107 unit + 54 e2e)
libreoffice   158 passed  ✅   (89 unit + 69 e2e)
mubu           96 passed  ✅   (85 unit + 11 e2e)
obs-studio    153 passed  ✅   (116 unit + 37 e2e)
kdenlive      155 passed  ✅   (111 unit + 44 e2e)
shotcut       154 passed  ✅   (110 unit + 44 e2e)
zoom           22 passed  ✅   (22 unit + 0 e2e)
drawio        138 passed  ✅   (116 unit + 22 e2e)
mermaid        10 passed  ✅   (5 unit + 5 e2e)
anygen         50 passed  ✅   (40 unit + 10 e2e)
notebooklm     21 passed  ✅   (21 unit + 0 e2e)
comfyui        70 passed  ✅   (60 unit + 10 e2e)
adguardhome    36 passed  ✅   (24 unit + 12 e2e)
ollama         98 passed  ✅   (87 unit + 11 e2e)
──────────────────────────────────────────────────────────────────────────────
TOTAL        1,839 passed  ✅   100% pass rate
```

---

## 🏗️ CLI-Anything's Architecture

<p align="center">
  <img src="assets/architecture.png" alt="CLI-Anything Architecture" width="750">
</p>

### 🎯 Core Design Principles

1. **Authentic Software Integration** — The CLI generates valid project files (ODF, MLT XML, SVG) and delegates to real applications for rendering. **We build structured interfaces TO software, not replacements**.

2. **Flexible Interaction Models** — Every CLI operates in dual modes: stateful REPL for interactive agent sessions + subcommand interface for scripting/pipelines. **Run bare command → enter REPL mode**.

3. **Consistent User Experience** — All generated CLIs share unified REPL interface (repl_skin.py) with branded banners, styled prompts, command history, progress indicators, and standardized formatting.

4. **Agent-Native Design** — Built-in --json flag on every command delivers structured data for machine consumption, while human-readable tables serve interactive use. **Agents discover capabilities via standard --help and which commands**.

5. **Zero Compromise Dependencies** — Real software is a hard requirement — no fallbacks, no graceful degradation. **Tests fail (not skip) when backends are missing, ensuring authentic functionality**.

---

## 📂 Project Structure

```
cli-anything/
├── 📄 README.md                          # You are here
├── 📁 assets/                            # Images and media
│   ├── icon.png                          # Project icon
│   └── teaser.png                        # Teaser figure
│
├── 🔌 cli-anything-plugin/               # The Claude Code plugin
│   ├── HARNESS.md                        # Methodology SOP (source of truth)
│   ├── README.md                         # Plugin documentation
│   ├── QUICKSTART.md                     # 5-minute getting started
│   ├── PUBLISHING.md                     # Distribution guide
│   ├── repl_skin.py                      # Unified REPL interface
│   ├── commands/                         # Plugin command definitions
│   │   ├── cli-anything.md               # Main build command
│   │   ├── refine.md                     # Expand existing harness coverage
│   │   ├── test.md                       # Test runner
│   │   └── validate.md                   # Standards validation
│   └── scripts/
│       └── setup-cli-anything.sh         # Setup script
│
├── 🤖 codex-skill/                      # Codex skill entry point
├── 🎨 gimp/agent-harness/               # GIMP CLI (107 tests)
├── 🧊 blender/agent-harness/            # Blender CLI (208 tests)
├── ✏️ inkscape/agent-harness/            # Inkscape CLI (202 tests)
├── 🎵 audacity/agent-harness/           # Audacity CLI (161 tests)
├── 📄 libreoffice/agent-harness/        # LibreOffice CLI (158 tests)
├── 📝 mubu/agent-harness/               # Mubu CLI (96 tests)
├── 📹 obs-studio/agent-harness/         # OBS Studio CLI (153 tests)
├── 🎞️ kdenlive/agent-harness/           # Kdenlive CLI (155 tests)
├── 🎬 shotcut/agent-harness/            # Shotcut CLI (154 tests)
├── 📞 zoom/agent-harness/               # Zoom CLI (22 tests)
├── 📐 drawio/agent-harness/             # Draw.io CLI (138 tests)
├── 🧜 mermaid/agent-harness/            # Mermaid Live Editor CLI (10 tests)
├── ✨ anygen/agent-harness/             # AnyGen CLI (50 tests)
├── 🖼️ comfyui/agent-harness/            # ComfyUI CLI (70 tests)
├── 🧠 notebooklm/agent-harness/         # NotebookLM CLI (experimental, 21 tests)
├── 🖼️ comfyui/agent-harness/            # ComfyUI CLI (70 tests)
├── 🛡️ adguardhome/agent-harness/       # AdGuard Home CLI (36 tests)
└── 🦙 ollama/agent-harness/             # Ollama CLI (98 tests)
```

Each `agent-harness/` contains an installable Python package under `cli_anything.<software>/` with Click CLI, core modules, utils (including `repl_skin.py` and backend wrapper), and comprehensive tests.

---

## 🎯 Plugin Commands

| Command | Description |
|---------|-------------|
| `/cli-anything <software-path-or-repo>` | Build complete CLI harness — all 7 phases |
| `/cli-anything:refine <software-path> [focus]` | Refine an existing harness — expand coverage with gap analysis |
| `/cli-anything:test <software-path-or-repo>` | Run tests and update TEST.md with results |
| `/cli-anything:validate <software-path-or-repo>` | Validate against HARNESS.md standards |

### Examples

```bash
# Build a complete CLI for GIMP from local source
/cli-anything /home/user/gimp

# Build from a GitHub repo
/cli-anything https://github.com/blender/blender

# Refine an existing harness — broad gap analysis
/cli-anything:refine /home/user/gimp

# Refine with a specific focus area
/cli-anything:refine /home/user/shotcut "vid-in-vid and picture-in-picture compositing"

# Run tests and update TEST.md
/cli-anything:test /home/user/inkscape

# Validate against HARNESS.md standards
/cli-anything:validate /home/user/audacity
```

---

## 🎮 Demo: Using a Generated CLI

Here's what an agent can do with `cli-anything-libreoffice`:

```bash
# Create a new Writer document
$ cli-anything-libreoffice document new -o report.json --type writer
✓ Created Writer document: report.json

# Add content
$ cli-anything-libreoffice --project report.json writer add-heading -t "Q1 Report" --level 1
✓ Added heading: "Q1 Report"

$ cli-anything-libreoffice --project report.json writer add-table --rows 4 --cols 3
✓ Added 4×3 table

# Export to real PDF via LibreOffice headless
$ cli-anything-libreoffice --project report.json export render output.pdf -p pdf --overwrite
✓ Exported: output.pdf (42,831 bytes) via libreoffice-headless

# JSON mode for agent consumption
$ cli-anything-libreoffice --json document info --project report.json
{
  "name": "Q1 Report",
  "type": "writer",
  "pages": 1,
  "elements": 2,
  "modified": true
}
```

### REPL Mode

```
$ cli-anything-blender
╔══════════════════════════════════════════╗
║       cli-anything-blender v1.0.0       ║
║     Blender CLI for AI Agents           ║
╚══════════════════════════════════════════╝

blender> scene new --name ProductShot
✓ Created scene: ProductShot

blender[ProductShot]> object add-mesh --type cube --location 0 0 1
✓ Added mesh: Cube at (0, 0, 1)

blender[ProductShot]*> render execute --output render.png --engine CYCLES
✓ Rendered: render.png (1920×1080, 2.3 MB) via blender --background

blender[ProductShot]> exit
Goodbye! 👋
```

---

## 📖 The Standard Playbook: HARNESS.md

HARNESS.md is our definitive SOP for making any software agent-accessible via automated CLI generation.

It encodes proven patterns and methodologies refined through automated generation processes.

The playbook distills key insights from successfully building all 16 diverse, production-ready harnesses.

### Critical Lessons

| Lesson | Description |
|--------|-------------|
| **Use the real software** | The CLI MUST call the actual application for rendering. No Pillow replacements for GIMP, no custom renderers for Blender. Generate valid project files → invoke the real backend. |
| **The Rendering Gap** | GUI apps apply effects at render time. If your CLI manipulates project files but uses a naive export tool, effects get silently dropped. Solution: native renderer → filter translation → render script. |
| **Filter Translation** | When mapping effects between formats (MLT → ffmpeg), watch for duplicate filter merging, interleaved stream ordering, parameter space differences, and unmappable effects. |
| **Timecode Precision** | Non-integer frame rates (29.97fps) cause cumulative rounding. Use `round()` not `int()`, integer arithmetic for display, and ±1 frame tolerance in tests. |
| **Output Verification** | Never trust that export worked because it exited 0. Verify: magic bytes, ZIP/OOXML structure, pixel analysis, audio RMS levels, duration checks. |

> See the full methodology: [`cli-anything-plugin/HARNESS.md`](cli-anything-plugin/HARNESS.md)

---

## 📦 Installation & Usage

### For Plugin Users (Claude Code)

```bash
# Add marketplace & install (recommended)
/plugin marketplace add HKUDS/CLI-Anything
/plugin install cli-anything

# Build a CLI for any software with a codebase
/cli-anything <software-name>
```

### For Generated CLIs

```bash
# Install any generated CLI
cd <software>/agent-harness
pip install -e .

# Verify
which cli-anything-<software>

# Use
cli-anything-<software> --help
cli-anything-<software>                    # enters REPL
cli-anything-<software> --json <command>   # JSON output for agents
```

### Running Tests

```bash
# Run tests for a specific CLI
cd <software>/agent-harness
python3 -m pytest cli_anything/<software>/tests/ -v

# Force-installed mode (recommended for validation)
CLI_ANYTHING_FORCE_INSTALLED=1 python3 -m pytest cli_anything/<software>/tests/ -v -s
```

---

## 🤝 Contributing

We welcome contributions! CLI-Anything is designed to be extensible:

- **New software targets** — Use the plugin to generate a CLI for any software with a codebase, then submit your harness via [`cli-anything-plugin/PUBLISHING.md`](cli-anything-plugin/PUBLISHING.md).
- **Methodology improvements** — PRs to `HARNESS.md` that encode new lessons learned
- **Plugin enhancements** — New commands, phase improvements, better validation
- **Test coverage** — More E2E scenarios, edge cases, workflow tests

### Limitations

- **Requires strong foundation models** — CLI-Anything relies on frontier-class models (e.g., Claude Opus 4.6, Claude Sonnet 4.6, GPT-5.4) for reliable harness generation. Weaker or smaller models may produce incomplete or incorrect CLIs that require significant manual correction.
- **Relies on available source code** — The 7-phase pipeline analyzes and generates from source code. When the target software only provides compiled binaries that require decompilation, harness quality and coverage will degrade substantially.
- **May require iterative refinement** — A single `/cli-anything` run may not fully cover all capabilities. Running `/refine` one or more times is often needed to push the CLI's performance and coverage to production quality.

### Roadmap

- [ ] Support for more application categories (CAD, DAW, IDE, EDA, scientific tools)
- [ ] Benchmark suite for agent task completion rates
- [ ] Community-contributed CLI harnesses for internal/custom software
- [ ] Integration with additional agent frameworks beyond Claude Code
- [ ] Support packaging APIs for closed-source software and web services into CLIs
- [x] Produce SKILL.md alongside the CLI for agent skill discovery and orchestration

---

## 📖 Documentation

| Document | Description |
|----------|-------------|
| [`cli-anything-plugin/HARNESS.md`](cli-anything-plugin/HARNESS.md) | The methodology SOP — single source of truth |
| [`cli-anything-plugin/README.md`](cli-anything-plugin/README.md) | Plugin documentation — commands, options, phases |
| [`cli-anything-plugin/QUICKSTART.md`](cli-anything-plugin/QUICKSTART.md) | 5-minute getting started guide |
| [`cli-anything-plugin/PUBLISHING.md`](cli-anything-plugin/PUBLISHING.md) | Distribution and publishing guide |

Each generated harness also includes:
- `<SOFTWARE>.md` — Architecture SOP specific to that application
- `tests/TEST.md` — Test plan and results documentation

---

## ⭐ Star History

If CLI-Anything helps make your software Agent-native, give us a star! ⭐

<div align="center">
  <a href="https://star-history.com/#HKUDS/CLI-Anything&Date">
    <picture>
      <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=HKUDS/CLI-Anything&type=Date&theme=dark" />
      <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=HKUDS/CLI-Anything&type=Date" />
      <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=HKUDS/CLI-Anything&type=Date" />
    </picture>
  </a>
</div>

---

## 📄 License

MIT License — free to use, modify, and distribute.

---

<div align="center">

**CLI-Anything** — *Make any software with a codebase Agent-native.*

<sub>A methodology for the age of AI agents | 16 professional software demos | 1,839 passing tests</sub>

<br>

<img src="assets/icon.png" alt="CLI-Anything Icon" width="80">

</div>

<p align="center">
  <em> Thanks for visiting ✨ CLI-Anything!</em><br><br>
  <img src="https://visitor-badge.laobi.icu/badge?page_id=HKUDS.CLI-Anything&style=for-the-badge&color=00d4ff" alt="Views">
</p>


================================================
FILE: README_CN.md
================================================
<h1 align="center"><img src="assets/icon.png" alt="" width="64" style="vertical-align: middle;">&nbsp; CLI-Anything: 让所有软件都能被 Agent 驱动</h1>

<p align="center">
  <strong>今天的软件为人而生👨‍💻,明天的用户是 Agent🤖<br>
CLI-Anything:连接 AI Agent 与全世界软件的桥梁</strong><br>
</p>

<p align="center">
  <a href="#-快速上手"><img src="https://img.shields.io/badge/快速上手-5_分钟-blue?style=for-the-badge" alt="Quick Start"></a>
  <a href="#-实测展示"><img src="https://img.shields.io/badge/Demo-11_款软件-green?style=for-the-badge" alt="Demos"></a>
  <a href="#-测试结果"><img src="https://img.shields.io/badge/测试-1%2C508_通过-brightgreen?style=for-the-badge" alt="Tests"></a>
  <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-yellow?style=for-the-badge" alt="License"></a>
</p>

<p align="center">
  <img src="https://img.shields.io/badge/python-≥3.10-blue?logo=python&logoColor=white" alt="Python">
  <img src="https://img.shields.io/badge/click-≥8.0-green" alt="Click">
  <img src="https://img.shields.io/badge/pytest-100%25_pass-brightgreen" alt="Pytest">
  <img src="https://img.shields.io/badge/coverage-unit_%2B_e2e-orange" alt="Coverage">
  <img src="https://img.shields.io/badge/output-JSON_%2B_Human-blueviolet" alt="Output">
  <a href="https://github.com/HKUDS/.github/blob/main/profile/README.md"><img src="https://img.shields.io/badge/飞书-交流群-E9DBFC?style=flat&logo=feishu&logoColor=white" alt="Feishu"></a>
<a href="https://github.com/HKUDS/.github/blob/main/profile/README.md"><img src="https://img.shields.io/badge/微信-交流群-C5EAB4?style=flat&logo=wechat&logoColor=white" alt="WeChat"></a>
</p>

**一行命令**,让任意软件接入 OpenClaw、nanobot、Cursor、Claude Code 等 Agent 框架。

<p align="center">
  <img src="assets/cli-typing.gif" alt="CLI-Anything typing demo" width="800">
</p>

<p align="center">
  <img src="assets/teaser.png" alt="CLI-Anything Teaser" width="800">
</p>

---

## 🤔 为什么是 CLI?

CLI 是人类和 AI Agent 共通的万能接口:

• **结构化、可组合** - 文本命令天然匹配 LLM 的输入格式,可自由串联成复杂工作流

• **轻量且通用** - 几乎零开销,跨平台运行,不依赖额外环境

• **自描述** - 一个 `--help` 就能让 Agent 自动发现所有功能

• **久经验证** - Claude Code 每天通过 CLI 执行数以千计的真实任务

• **Agent 友好** - 结构化 JSON 输出,Agent 无需任何额外解析

• **确定且可靠** - 输出稳定一致,Agent 行为可预测

## 🚀 快速上手

### 环境要求

- **Python 3.10+**
- 目标软件已安装(如 GIMP、Blender、LibreOffice 或你自己的应用)
- 支持的 AI 编程工具之一:[Claude Code](#-claude-code) | [OpenClaw](#-openclaw) | [OpenCode](#-opencode) | [Codex](#-codex) | [Qodercli](#-qodercli) | [更多平台](#-更多平台即将支持)

### 选择你的平台

<details open>
<summary><h4 id="-claude-code">⚡ Claude Code</h4></summary>

**第一步:添加插件市场**

CLI-Anything 以 Claude Code 插件市场的形式托管在 GitHub 上。

```bash
# 添加 CLI-Anything 插件市场
/plugin marketplace add HKUDS/CLI-Anything
```

**第二步:安装插件**

```bash
# 从市场安装 cli-anything 插件
/plugin install cli-anything
```

搞定。插件已经在你的 Claude Code 会话中可用了。

**Windows 注意:** Claude Code 通过 `bash` 执行命令。Windows 下请安装 Git for Windows(包含 `bash` 和 `cygpath`)
或使用 WSL,否则可能出现 `cygpath: command not found`。

**第三步:一行命令生成 CLI**

```bash
# /cli-anything:cli-anything <软件路径或仓库地址>
# 为 GIMP 生成完整的 CLI(7 个阶段全自动)
/cli-anything:cli-anything ./gimp

# 注意:如果你的 Claude Code 版本低于 2.x,请使用 "/cli-anything"。
```

完整流水线自动执行:
1. 🔍 **分析** — 扫描源码,将 GUI 操作映射到 API
2. 📐 **设计** — 规划命令分组、状态模型、输出格式
3. 🔨 **实现** — 构建 Click CLI,包含 REPL、JSON 输出、撤销/重做
4. 📋 **规划测试** — 生成 TEST.md,涵盖单元测试和端到端测试计划
5. 🧪 **编写测试** — 实现完整测试套件
6. 📝 **文档** — 更新 TEST.md,写入测试结果
7. 📦 **发布** — 生成 `setup.py`,安装到 PATH

**第四步(可选):优化和扩展 CLI**

初始构建完成后,你可以迭代优化 CLI,扩展覆盖面并补充缺失的功能:

```bash
# 全面优化 — Agent 分析所有功能的覆盖差距
/cli-anything:refine ./gimp

# 定向优化 — 指定特定功能领域
/cli-anything:refine ./gimp "我需要更多图像批处理和滤镜相关的 CLI"
```

优化命令会对软件的完整功能与当前 CLI 覆盖范围进行差距分析,然后为识别到的差距实现新命令、测试和文档。你可以多次运行该命令,逐步扩大功能覆盖范围 — 每次运行都是增量的、非破坏性的。

<details>
<summary><strong>备选方案:手动安装</strong></summary>

如果你不想用插件市场:

```bash
# 克隆仓库
git clone https://github.com/HKUDS/CLI-Anything.git

# 复制插件到 Claude Code 插件目录
cp -r CLI-Anything/cli-anything-plugin ~/.claude/plugins/cli-anything

# 重新加载插件
/reload-plugins
```

</details>

</details>

<details>
<summary><h4 id="-opencode">⚡ OpenCode (实验性支持)</h4></summary>

**第一步:安装命令**

**注意:** 请升级到最新 OpenCode,旧版本可能使用不同的命令目录路径。

将 CLI-Anything 命令**和** `HARNESS.md` 复制到 OpenCode 命令目录:

```bash
# 克隆仓库
git clone https://github.com/HKUDS/CLI-Anything.git

# 全局安装(所有项目可用)
cp CLI-Anything/opencode-commands/*.md ~/.config/opencode/commands/
cp CLI-Anything/cli-anything-plugin/HARNESS.md ~/.config/opencode/commands/

# 或项目级安装
cp CLI-Anything/opencode-commands/*.md .opencode/commands/
cp CLI-Anything/cli-anything-plugin/HARNESS.md .opencode/commands/
```

> **注意:** `HARNESS.md` 是所有命令引用的方法论规范,必须和命令文件放在同一目录下。

安装后获得 5 个斜杠命令:`/cli-anything`、`/cli-anything-refine`、`/cli-anything-test`、`/cli-anything-validate` 和 `/cli-anything-list`。

**第二步:一行命令生成 CLI**

```bash
# 为 GIMP 生成完整的 CLI(7 个阶段全自动)
/cli-anything ./gimp

# 从 GitHub 仓库构建
/cli-anything https://github.com/blender/blender
```

命令以子任务方式运行,遵循与 Claude Code 相同的 7 阶段方法论。

**第三步(可选):优化和扩展 CLI**

```bash
# 全面优化 — Agent 分析所有功能的覆盖差距
/cli-anything-refine ./gimp

# 定向优化 — 指定特定功能领域
/cli-anything-refine ./gimp "批处理和滤镜"
```

</details>

<details>

<summary><h4 id="-qodercli">⚡ Qodercli <sup><code>社区贡献</code></sup></h4></summary>

**第一步:注册插件**

```bash
git clone https://github.com/HKUDS/CLI-Anything.git
bash CLI-Anything/qoder-plugin/setup-qodercli.sh
```

脚本会将 cli-anything 插件注册到 `~/.qoder.json`。注册后开启新的 Qodercli 会话即可使用。

**第二步:在 Qodercli 中使用 CLI-Anything**

```bash
/cli-anything:cli-anything ./gimp
/cli-anything:refine ./gimp "批处理和滤镜"
/cli-anything:validate ./gimp
```
</details>

<details>

<summary><h4 id="-openclaw">⚡ OpenClaw</h4></summary>

**第一步:安装 Skill**

CLI-Anything 提供了原生的 OpenClaw `SKILL.md` 文件。请将其复制到你的 OpenClaw 技能目录:

```bash
# Clone the repo
git clone https://github.com/HKUDS/CLI-Anything.git

# Install to the global skills folder
mkdir -p ~/.openclaw/skills/cli-anything
cp CLI-Anything/openclaw-skill/SKILL.md ~/.openclaw/skills/cli-anything/SKILL.md
```

**第二步:构建 CLI**

安装完成后,你就可以在 OpenClaw 中直接调用:

`@cli-anything build a CLI for ./gimp`

该技能采用了与 Claude Code 和 OpenCode 一致的 7 步构建流程。

</details>

<details>

<summary><h4 id="-codex">⚡ Codex <sup><code>实验性</code></sup> <sup><code>社区贡献</code></sup></h4></summary>

**第一步:安装 Skill**

运行仓库内置的安装脚本:

```bash
# 克隆仓库
git clone https://github.com/HKUDS/CLI-Anything.git

# 安装 skill
bash CLI-Anything/codex-skill/scripts/install.sh
```

在 Windows PowerShell 中,可以使用:

```powershell
.\CLI-Anything\codex-skill\scripts\install.ps1
```

脚本会把 skill 安装到 `$CODEX_HOME/skills/cli-anything`;如果没有设置 `CODEX_HOME`,则默认安装到 `~/.codex/skills/cli-anything`。

安装后重启 Codex,让它重新发现这个 skill。

**第二步:在 Codex 里使用 CLI-Anything**

直接用自然语言描述任务,例如:

```text
Use CLI-Anything to build a harness for ./gimp
Use CLI-Anything to refine ./shotcut for picture-in-picture workflows
Use CLI-Anything to validate ./libreoffice
```

这个 Codex skill 复用了 Claude Code 插件和 OpenCode 命令所使用的同一套方法论,
不会改变生成出来的 Python harness 结构。

</details>

<details>
<summary><h4 id="-更多平台即将支持">🔮 更多平台(即将支持)</h4></summary>

CLI-Anything 的设计是平台无关的,计划支持更多 AI 编程工具:

- **Codex** — 已通过 `codex-skill/` 提供接入
- **Cursor** — 即将支持
- **Windsurf** — 即将支持
- **你喜欢的工具** — 欢迎贡献!参考 `opencode-commands/` 目录的实现。

</details>

### 开始使用生成的 CLI

无论你用哪个平台构建,生成的 CLI 使用方式完全一样:

```bash
# 安装到 PATH
cd gimp/agent-harness && pip install -e .

# 随处可用
cli-anything-gimp --help
cli-anything-gimp project new --width 1920 --height 1080 -o poster.json
cli-anything-gimp --json layer add -n "Background" --type solid --color "#1a1a2e"

# 进入交互式 REPL
cli-anything-gimp
```

---

## 💡 CLI-Anything 的愿景:构建 Agent 原生的软件生态

• 🌐 **无门槛接入** - 任何软件都能通过结构化 CLI 即刻被 Agent 操控。

• 🔗 **无缝集成** - 不需要专门的 API、不需要操控 GUI、不需要重构代码,也不需要复杂的适配层。

• 🚀 **面向未来** - 一条命令,就能把为人类设计的软件变成 Agent 的原生工具。

---

## 🔧 适用场景

| 类别 | 如何接入 Agent | 典型软件 |
|------|--------------|---------|
| **📂 GitHub 开源项目** | 通过自动生成 CLI,将任意开源项目转化为 Agent 可控工具 | VSCodium、WordPress、Calibre、Zotero、Joplin、Logseq、Penpot、Super Productivity |
| **🤖 AI/ML 平台** | 用结构化命令驱动模型训练、推理流水线和超参搜索 | Stable Diffusion WebUI、ComfyUI、InvokeAI、Text-generation-webui、Open WebUI、Fooocus、Kohya_ss、AnythingLLM、SillyTavern |
| **📊 数据与分析** | 以编程方式完成数据处理、可视化和统计分析工作流 | JupyterLab、Apache Superset、Metabase、Redash、DBeaver、KNIME、Orange、OpenSearch Dashboards、Lightdash |
| **💻 开发工具** | 通过 CLI 串联代码编辑、构建、测试与部署流程 | Jenkins、Gitea、Hoppscotch、Portainer、pgAdmin、SonarQube、ArgoCD、OpenLens、Insomnia、Beekeeper Studio |
| **🎨 创意与媒体** | 以编程方式控制内容创作、编辑和渲染工作流 | Blender、GIMP、OBS Studio、Audacity、Krita、Kdenlive、Shotcut、Inkscape、Darktable、LMMS、Ardour |
| **📐 图表与可视化** | 以编程方式创建和操作流程图、架构图、ER 图等各类图表 | Draw.io (diagrams.net)、Mermaid、PlantUML、Excalidraw、yEd |
| **🔬 科学计算** | 自动化科研工作流、仿真模拟和复杂计算 | ImageJ、FreeCAD、QGIS、ParaView、Gephi、LibreCAD、Stellarium、KiCad、JASP、Jamovi |
| **🏢 企业与办公** | 将商业应用和生产力工具转化为 Agent 可访问的系统 | NextCloud、GitLab、Grafana、Mattermost、LibreOffice、AppFlowy、NocoDB、Odoo (Community)、Plane、ERPNext |
| **📞 通信与协作** | 通过结构化 CLI 自动化会议调度、参会人管理、录制获取和报告生成 | Zoom、Jitsi Meet、BigBlueButton、Mattermost |

---

## CLI-Anything 的核心优势

### Agent 与软件之间的鸿沟

AI Agent 推理能力很强,但操控真实专业软件的能力很弱。现有方案要么是脆弱的 GUI 自动化,要么是覆盖面有限的 API,要么是阉割了 90% 功能的重新实现。

**CLI-Anything 的解法**:把任何专业软件变成 Agent 原生工具,功能一个不少。

| **现有痛点** | **CLI-Anything 怎么解** |
|------------|----------------------|
| 🤖 "AI 用不了真正的专业工具" | 直接对接真实软件后端(Blender、LibreOffice、FFmpeg)—— 完整的专业能力,零妥协 |
| 💸 "GUI 自动化三天两头崩" | 告别截图、点击和 RPA 的脆弱性,纯命令行操控,结构化接口 |
| 📊 "Agent 需要结构化数据" | 内置 JSON 输出供 Agent 直接消费,同时保留可读格式方便调试 |
| 🔧 "定制集成太贵了" | 一个插件就能为任意代码库自动生成 CLI,经过验证的 7 阶段流水线 |
| ⚡ "原型和生产之间差十万八千里" | 1,508+ 测试用例,全部在真实软件上验证通过,覆盖 11 款主流应用 |

---

## 🎯 CLI-Anything 能做什么?

<table>
<tr>
<td width="33%">

### 🛠️ 让 Agent 接管你的工作流

不管是专业场景还是日常事务 —— 把代码库扔给 `/cli-anything` 就行。GIMP、Blender、Shotcut 搞创作,LibreOffice、OBS Studio 干日常。没有源码?找个开源替代品,照样能用。你会立刻得到一套 Agent 可以直接调用的完整 CLI。

</td>
<td width="33%">

### 🔗 把散装 API 统一成一个 CLI

受够了一堆零碎的 Web 服务 API?把文档或 SDK 手册喂给 `/cli-anything`,你的 Agent 就能拿到一个**有状态的、功能完整的 CLI**,把那些零散的接口整合成逻辑清晰的命令组。一个工具可替代几十个裸 API 调用 —— 能力更强,token 更省。

</td>
<td width="33%">

### 🚀 取代 GUI Agent,或让它更强

CLI-Anything 可直接**替代基于 GUI 的 Agent 方案** —— 无需截图,也无需繁琐地点击像素操作。更实用的是:只要你对 GUI 软件执行过 `/cli-anything` 命令,就能**全自动生成 Agent 任务、评测器及 Benchmark** —— 全程采用纯代码与终端操作,支持迭代优化,显著提升效率。

</td>
</tr>
</table>

---

## ✨ ⚙️ CLI-Anything 的工作方式

<table>
<tr>
<td width="50%">

### 🏗️ 全自动 7 阶段流水线

从代码分析到发布上线 —— 插件自动完成架构设计、代码实现、测试规划、测试编写和文档生成,全程无需人工介入。

</td>
<td width="50%">

### 🎯 真实软件集成

直接调用真实应用进行渲染。LibreOffice 生成 PDF,Blender 渲染 3D 场景,Audacity 通过 sox 处理音频。**零妥协**,**零玩具实现**。

</td>
</tr>
<tr>
<td width="50%">

### 🔁 智能会话管理

持久化项目状态,支持撤销/重做,加上统一的 REPL 交互界面(ReplSkin),所有 CLI 的使用体验保持一致。

</td>
<td width="50%">

### 📦 零配置安装

`pip install -e .` 即可将 cli-anything-<软件名> 装到 PATH。Agent 通过标准的 `which` 命令发现工具,不需要额外配置。

</td>
</tr>
<tr>
<td width="50%">

### 🧪 生产级测试

多层验证:使用合成数据的单元测试、使用真实文件和软件的端到端测试,外加已安装命令的 CLI 子进程验证。

</td>
<td width="50%">

### 🐍 干净的包架构

所有 CLI 统一在 cli_anything.* 命名空间下 —— 无冲突、可 pip 安装、命名规范统一:cli-anything-gimp、cli-anything-blender 等。

</td>
</tr>
</table>

---

## 🎬 实测展示

### 🎯 通用性

CLI-Anything 适用于任何有代码库的软件 —— 不限领域,不限架构。

### 🏭 专业级测试

在 11 款复杂应用上进行了实测,涵盖创意、生产力、通信、图表和 AI 内容生成领域 —— 这些软件此前对 AI Agent 来说几乎不可触及。

### 🎨 覆盖多元领域

从创意工作流(图像编辑、3D 建模、矢量图形)到生产工具(音频、办公、直播、视频剪辑)。

### ✅ 完整的 CLI 生成

每款软件都生成了完整的、可投产的 CLI 接口 —— 不是 demo,而是保留全部功能的完整工具接入。

<table>
<tr>
<th align="center">软件</th>
<th align="center">领域</th>
<th align="center">CLI 命令</th>
<th align="center">后端</th>
<th align="center">测试</th>
</tr>
<tr>
<td align="center"><strong>🎨 GIMP</strong></td>
<td>图像编辑</td>
<td><code>cli-anything-gimp</code></td>
<td>Pillow + GEGL/Script-Fu</td>
<td align="center">✅ 107</td>
</tr>
<tr>
<td align="center"><strong>🧊 Blender</strong></td>
<td>3D 建模与渲染</td>
<td><code>cli-anything-blender</code></td>
<td>bpy (Python scripting)</td>
<td align="center">✅ 208</td>
</tr>
<tr>
<td align="center"><strong>✏️ Inkscape</strong></td>
<td>矢量图形</td>
<td><code>cli-anything-inkscape</code></td>
<td>Direct SVG/XML manipulation</td>
<td align="center">✅ 202</td>
</tr>
<tr>
<td align="center"><strong>🎵 Audacity</strong></td>
<td>音频制作</td>
<td><code>cli-anything-audacity</code></td>
<td>Python wave + sox</td>
<td align="center">✅ 161</td>
</tr>
<tr>
<td align="center"><strong>📄 LibreOffice</strong></td>
<td>办公套件(Writer、Calc、Impress)</td>
<td><code>cli-anything-libreoffice</code></td>
<td>ODF generation + headless LO</td>
<td align="center">✅ 158</td>
</tr>
<tr>
<td align="center"><strong>📹 OBS Studio</strong></td>
<td>直播与录制</td>
<td><code>cli-anything-obs-studio</code></td>
<td>JSON scene + obs-websocket</td>
<td align="center">✅ 153</td>
</tr>
<tr>
<td align="center"><strong>🎞️ Kdenlive</strong></td>
<td>视频剪辑</td>
<td><code>cli-anything-kdenlive</code></td>
<td>MLT XML + melt renderer</td>
<td align="center">✅ 155</td>
</tr>
<tr>
<td align="center"><strong>🎬 Shotcut</strong></td>
<td>视频剪辑</td>
<td><code>cli-anything-shotcut</code></td>
<td>Direct MLT XML + melt</td>
<td align="center">✅ 154</td>
</tr>
<tr>
<td align="center"><strong>📞 Zoom</strong></td>
<td>视频会议</td>
<td><code>cli-anything-zoom</code></td>
<td>Zoom REST API (OAuth2)</td>
<td align="center">✅ 22</td>
</tr>
<tr>
<td align="center"><strong>📐 Draw.io</strong></td>
<td>图表绘制</td>
<td><code>cli-anything-drawio</code></td>
<td>mxGraph XML + draw.io CLI</td>
<td align="center">✅ 138</td>
</tr>
<tr>
<td align="center"><strong>✨ AnyGen</strong></td>
<td>AI 内容生成</td>
<td><code>cli-anything-anygen</code></td>
<td>AnyGen REST API (anygen.io)</td>
<td align="center">✅ 50</td>
</tr>
<tr>
<td align="center" colspan="4"><strong>合计</strong></td>
<td align="center"><strong>✅ 1,508</strong></td>
</tr>
</table>

> 全部 1,508 项测试 **100% 通过** —— 1,073 项单元测试 + 435 项端到端测试。

---

## 📊 测试结果

每个 CLI 都经过多层严格测试,确保生产可用:

| 测试层级 | 测什么 | 示例 |
|---------|-------|------|
| **单元测试** | 每个核心函数的隔离验证,使用合成数据 | `test_core.py` — 项目创建、图层操作、滤镜参数 |
| **端到端测试(原生)** | 项目文件的完整生成流程 | ODF ZIP 结构合法性、MLT XML 正确性、SVG 格式完整性 |
| **端到端测试(真实后端)** | 调用真实软件并验证输出 | LibreOffice → 含 `%PDF-` 魔术字节的 PDF,Blender → 渲染后的 PNG |
| **CLI 子进程测试** | 通过 `subprocess.run` 调用已安装命令 | `cli-anything-gimp --json project new` → 合法 JSON 输出 |

```
================================ Test Summary ================================
gimp          107 passed  ✅   (64 unit + 43 e2e)
blender       208 passed  ✅   (150 unit + 58 e2e)
inkscape      202 passed  ✅   (148 unit + 54 e2e)
audacity      161 passed  ✅   (107 unit + 54 e2e)
libreoffice   158 passed  ✅   (89 unit + 69 e2e)
obs-studio    153 passed  ✅   (116 unit + 37 e2e)
kdenlive      155 passed  ✅   (111 unit + 44 e2e)
shotcut       154 passed  ✅   (110 unit + 44 e2e)
zoom           22 passed  ✅   (22 unit + 0 e2e)
drawio        138 passed  ✅   (116 unit + 22 e2e)
anygen         50 passed  ✅   (40 unit + 10 e2e)
──────────────────────────────────────────────────────────────────────────────
TOTAL        1,508 passed  ✅   100% pass rate
```

---

## 🏗️ CLI-Anything 的架构

<p align="center">
  <img src="assets/architecture.png" alt="CLI-Anything Architecture" width="750">
</p>

### 🎯 核心设计原则

1. **真实软件集成** — CLI 生成合法的项目文件(ODF、MLT XML、SVG),然后交给真实应用去渲染。**我们做的是软件的结构化接口,而不是替代品**。
2. **灵活的交互模式** — 每个 CLI 都支持两种模式:有状态的 REPL 用于 Agent 交互会话,子命令模式用于脚本和流水线。**直接运行命令即进入 REPL**。
3. **一致的使用体验** — 所有生成的 CLI 共享统一的 REPL 界面(repl_skin.py),带有品牌横幅、风格化提示符、命令历史、进度指示器和标准化格式。
4. **Agent 原生设计** — 每个命令内置 `--json` 参数,输出结构化数据供 Agent 消费,同时可读的表格格式服务于交互调试。**Agent 通过标准的 `--help` 和 `which` 命令发现能力**。
5. **零妥协的依赖策略** — 真实软件是硬性要求 —— 没有兜底,没有降级。**后端缺失时测试直接失败(而非跳过),确保功能的真实性**。

---

## 📂 项目结构

```
cli-anything/
├── 📄 README.md                          # 英文文档
├── 📄 README_CN.md                       # 中文文档(你在这里)
├── 📁 assets/                            # 图片和媒体文件
│   ├── icon.png                          # 项目图标
│   └── teaser.png                        # 概览图
│
├── 🔌 cli-anything-plugin/               # Claude Code 插件
│   ├── HARNESS.md                        # 方法论 SOP(唯一权威来源)
│   ├── README.md                         # 插件文档
│   ├── QUICKSTART.md                     # 5 分钟快速上手
│   ├── PUBLISHING.md                     # 分发与发布指南
│   ├── repl_skin.py                      # 统一 REPL 界面
│   ├── commands/                         # 插件命令定义
│   │   ├── cli-anything.md               # 主构建命令
│   │   ├── refine.md                     # 扩展已有 harness 覆盖面
│   │   ├── test.md                       # 测试运行器
│   │   ├── validate.md                   # 标准验证
│   │   └── list.md                       # 列出所有 CLI 工具
│   └── scripts/
│       └── setup-cli-anything.sh         # 安装脚本
│
├── 📋 opencode-commands/                # OpenCode 命令
│   ├── cli-anything.md                  # 主构建命令
│   ├── cli-anything-refine.md           # 优化扩展命令
│   ├── cli-anything-test.md             # 测试运行器
│   ├── cli-anything-validate.md         # 标准验证
│   └── cli-anything-list.md             # 列出所有 CLI 工具
│
├── 🤖 codex-skill/                      # Codex skill 接入层
├── 🎨 gimp/agent-harness/               # GIMP CLI(107 项测试)
├── 🧊 blender/agent-harness/            # Blender CLI(208 项测试)
├── ✏️ inkscape/agent-harness/            # Inkscape CLI(202 项测试)
├── 🎵 audacity/agent-harness/           # Audacity CLI(161 项测试)
├── 📄 libreoffice/agent-harness/        # LibreOffice CLI(158 项测试)
├── 📹 obs-studio/agent-harness/         # OBS Studio CLI(153 项测试)
├── 🎞️ kdenlive/agent-harness/           # Kdenlive CLI(155 项测试)
├── 🎬 shotcut/agent-harness/            # Shotcut CLI(154 项测试)
├── 📞 zoom/agent-harness/               # Zoom CLI(22 项测试)
├── 📐 drawio/agent-harness/             # Draw.io CLI(138 项测试)
└── ✨ anygen/agent-harness/             # AnyGen CLI(50 项测试)
```

每个 `agent-harness/` 包含一个可安装的 Python 包,位于 `cli_anything.<软件名>/` 下,包含 Click CLI、核心模块、工具类(含 `repl_skin.py` 和后端适配器)以及完整的测试。

---

## 🎯 插件命令

| 命令 | 说明 |
|-----|------|
| `/cli-anything <软件路径或仓库>` | 构建完整的 CLI —— 全部 7 个阶段 |
| `/cli-anything:refine <软件路径> [聚焦方向]` | 优化已有的 CLI —— 通过差距分析扩展覆盖面 |
| `/cli-anything:test <软件路径或仓库>` | 运行测试并更新 TEST.md |
| `/cli-anything:validate <软件路径或仓库>` | 按照 HARNESS.md 标准进行验证 |
| `/cli-anything:list` | 列出所有已安装和已生成的 CLI 工具 |

### 使用示例

```bash
# 从本地源码为 GIMP 构建完整 CLI
/cli-anything /home/user/gimp

# 从 GitHub 仓库构建
/cli-anything https://github.com/blender/blender

# 优化已有的 CLI —— 全面差距分析
/cli-anything:refine /home/user/gimp

# 带聚焦方向的优化
/cli-anything:refine /home/user/shotcut "画中画和视频叠加合成"

# 运行测试并更新 TEST.md
/cli-anything:test /home/user/inkscape

# 按照 HARNESS.md 标准验证
/cli-anything:validate /home/user/audacity
```

---

## 🎮 实际操作演示

以 `cli-anything-libreoffice` 为例,看看 Agent 能做什么:

```bash
# 创建一个 Writer 文档
$ cli-anything-libreoffice document new -o report.json --type writer
✓ Created Writer document: report.json

# 添加内容
$ cli-anything-libreoffice --project report.json writer add-heading -t "Q1 Report" --level 1
✓ Added heading: "Q1 Report"

$ cli-anything-libreoffice --project report.json writer add-table --rows 4 --cols 3
✓ Added 4×3 table

# 通过 LibreOffice headless 导出为真实 PDF
$ cli-anything-libreoffice --project report.json export render output.pdf -p pdf --overwrite
✓ Exported: output.pdf (42,831 bytes) via libreoffice-headless

# JSON 模式供 Agent 消费
$ cli-anything-libreoffice --json document info --project report.json
{
  "name": "Q1 Report",
  "type": "writer",
  "pages": 1,
  "elements": 2,
  "modified": true
}
```

### REPL 模式

```
$ cli-anything-blender
╔══════════════════════════════════════════╗
║       cli-anything-blender v1.0.0       ║
║     Blender CLI for AI Agents           ║
╚══════════════════════════════════════════╝

blender> scene new --name ProductShot
✓ Created scene: ProductShot

blender[ProductShot]> object add-mesh --type cube --location 0 0 1
✓ Added mesh: Cube at (0, 0, 1)

blender[ProductShot]*> render execute --output render.png --engine CYCLES
✓ Rendered: render.png (1920×1080, 2.3 MB) via blender --background

blender[ProductShot]> exit
Goodbye! 👋
```

---

## 📖 标准手册:HARNESS.md

HARNESS.md 是我们通过自动化 CLI 生成,使任意软件具备 Agent 可用性的权威标准操作流程(SOP)。

它记录了在自动化生成过程中经验证并沉淀出的模式与方法论。

这本手册提炼了成功构建全部 11 套生产级 CLI 的关键经验。

### 核心经验

| 经验 | 说明 |
|-----|------|
| **必须用真实软件** | CLI 必须调用真实应用进行渲染。不能用 Pillow 替代 GIMP,不能自己写渲染器替代 Blender。正确做法:生成合法的项目文件 → 调用真实后端。 |
| **渲染鸿沟** | GUI 应用在渲染时才应用特效。如果你的 CLI 操作了项目文件但用了简陋的导出工具,特效会被静默丢弃。正确做法:原生渲染器 → 滤镜转译 → 渲染脚本。 |
| **滤镜转译** | 在不同格式间映射特效时(如 MLT → ffmpeg),要注意:重复滤镜合并、交错的流排序、参数空间差异、无法映射的特效。 |
| **时间码精度** | 非整数帧率(如 29.97fps)会导致累积舍入误差。用 `round()` 而非 `int()`,显示时用整数运算,测试中允许 ±1 帧容差。 |
| **输出验证** | 永远不要因为进程退出码为 0 就信任导出成功。要验证:魔术字节、ZIP/OOXML 结构、像素分析、音频 RMS 电平、时长检查。 |

> 完整方法论见:[`cli-anything-plugin/HARNESS.md`](cli-anything-plugin/HARNESS.md)

---

## 📦 安装与使用

### Claude Code 用户

```bash
# 添加市场并安装(推荐)
/plugin marketplace add HKUDS/CLI-Anything
/plugin install cli-anything

# 为任何有代码库的软件生成 CLI
/cli-anything:cli-anything <软件路径或仓库>
```

### OpenCode 用户

```bash
# 克隆仓库
git clone https://github.com/HKUDS/CLI-Anything.git

# 请确保使用最新 OpenCode,旧版本可能使用不同的命令目录路径
# 复制命令和 HARNESS.md 到 OpenCode 命令目录
cp CLI-Anything/opencode-commands/*.md ~/.config/opencode/commands/
cp CLI-Anything/cli-anything-plugin/HARNESS.md ~/.config/opencode/commands/

# 为任何有代码库的软件生成 CLI
/cli-anything <软件路径或仓库>
```

### 使用生成的 CLI

```bash
# 安装任意生成的 CLI
cd <软件名>/agent-harness
pip install -e .

# 验证安装
which cli-anything-<软件名>

# 开始使用
cli-anything-<软件名> --help
cli-anything-<软件名>                    # 进入 REPL
cli-anything-<软件名> --json <命令>      # JSON 输出供 Agent 使用
```

### 运行测试

```bash
# 运行某个 CLI 的测试
cd <软件名>/agent-harness
python3 -m pytest cli_anything/<软件名>/tests/ -v

# 强制安装模式(推荐用于验证)
CLI_ANYTHING_FORCE_INSTALLED=1 python3 -m pytest cli_anything/<软件名>/tests/ -v -s
```

---

## 🤝 参与贡献

欢迎贡献!CLI-Anything 天然支持扩展:

- **新的目标软件** — 用插件为任意有代码库的软件生成 CLI,然后通过 [`cli-anything-plugin/PUBLISHING.md`](cli-anything-plugin/PUBLISHING.md) 提交你的成果。
- **方法论改进** — 向 `HARNESS.md` 提 PR,把新的经验教训沉淀下来
- **插件增强** — 新命令、阶段优化、更好的验证逻辑
- **测试覆盖** — 更多端到端场景、边界情况、工作流测试

### 已知局限

- **依赖强大的基础模型** — CLI-Anything 依赖前沿级别的模型(如 Claude Opus 4.6、Claude Sonnet 4.6、GPT-5.4)才能可靠地生成 harness。较弱或较小的模型可能产出不完整或有误的 CLI,需要大量人工修正。
- **依赖可用的源代码** — `/cli-anything` 基于源码进行分析和生成。如果目标软件只提供编译后的二进制文件,需要反编译才能获取代码,harness 的质量和覆盖率会显著下降。
- **可能需要迭代优化** — 单次 `/cli-anything` 运行不一定能完整覆盖所有功能。通常需要执行一次或多次 `/refine` 命令,才能将 CLI 的性能和覆盖率推到生产级水平。

---

## 📖 文档

| 文档 | 说明 |
|-----|------|
| [`cli-anything-plugin/HARNESS.md`](cli-anything-plugin/HARNESS.md) | 方法论 SOP — 唯一权威来源 |
| [`cli-anything-plugin/README.md`](cli-anything-plugin/README.md) | 插件文档 — 命令、选项、阶段 |
| [`cli-anything-plugin/QUICKSTART.md`](cli-anything-plugin/QUICKSTART.md) | 5 分钟快速上手 |
| [`cli-anything-plugin/PUBLISHING.md`](cli-anything-plugin/PUBLISHING.md) | 分发与发布指南 |

每个生成的 CLI 还包含:

- `<软件名>.md` — 该应用的架构 SOP
- `tests/TEST.md` — 测试计划和结果文档

---

## ⭐ Star History

如果 CLI-Anything 帮到了你,给个 Star 吧!⭐

<!-- Uncomment when published:
<div align="center">
  <a href="https://star-history.com/#HKUDS/CLI-Anything&Date">
    <picture>
      <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=HKUDS/CLI-Anything&type=Date&theme=dark" />
      <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=HKUDS/CLI-Anything&type=Date" />
      <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=HKUDS/CLI-Anything&type=Date" />
    </picture>
  </a>
</div>
-->

---

## 📄 License

MIT License — 可自由使用、修改和分发。

---

<div align="center">

**CLI-Anything** — *一行命令,让任何软件成为 Agent 的原生工具。*

<sub>为 AI Agent 时代而生 | 11 款专业软件实测 | 1,508 项测试全部通过</sub>

<br>

<img src="assets/icon.png" alt="CLI-Anything Icon" width="80">

</div>

<p align="center">
  <em>感谢访问 ✨ CLI-Anything!</em><br><br>
  <img src="https://visitor-badge.laobi.icu/badge?page_id=HKUDS.CLI-Anything&style=for-the-badge&color=00d4ff" alt="Views">
</p>


================================================
FILE: registry.json
================================================
{
  "meta": {
    "repo": "https://github.com/HKUDS/CLI-Anything",
    "description": "CLI-Hub — Agent-native stateful CLI interfaces for softwares, codebases, and Web Services",
    "updated": "2026-03-18"
  },
  "clis": [
    {
      "name": "anygen",
      "display_name": "AnyGen",
      "version": "1.0.0",
      "description": "Generate docs, slides, websites and more via AnyGen cloud API",
      "requires": "ANYGEN_API_KEY",
      "homepage": "https://anygen.com",
      "install_cmd": "pip install git+https://github.com/HKUDS/CLI-Anything.git#subdirectory=anygen/agent-harness",
      "entry_point": "cli-anything-anygen",
      "skill_md": "anygen/agent-harness/cli_anything/anygen/skills/SKILL.md",
      "category": "generation",
      "contributor": "koltyu-anygen",
      "contributor_url": "https://github.com/koltyu-anygen"
    },
    {
      "name": "adguardhome",
      "display_name": "AdGuardHome",
      "version": "1.0.0",
      "description": "DNS ad-blocking and network infrastructure management via AdGuardHome REST API",
      "requires": "AdGuardHome instance running",
      "homepage": "https://adguard.com/adguard-home/overview.html",
      "install_cmd": "pip install git+https://github.com/HKUDS/CLI-Anything.git#subdirectory=adguardhome/agent-harness",
      "entry_point": "cli-anything-adguardhome",
      "skill_md": null,
      "category": "network",
      "contributor": "pyxl-dev",
      "contributor_url": "https://github.com/pyxl-dev"
    },
    {
      "name": "audacity",
      "display_name": "Audacity",
      "version": "1.0.0",
      "description": "Audio editing and processing via sox",
      "requires": "sox (apt install sox)",
      "homepage": "https://www.audacityteam.org",
      "install_cmd": "pip install git+https://github.com/HKUDS/CLI-Anything.git#subdirectory=audacity/agent-harness",
      "entry_point": "cli-anything-audacity",
      "skill_md": "audacity/agent-harness/cli_anything/audacity/skills/SKILL.md",
      "category": "audio",
      "contributor": "CLI-Anything-Team",
      "contributor_url": "https://github.com/HKUDS/CLI-Anything"
    },
    {
      "name": "blender",
      "display_name": "Blender",
      "version": "1.0.0",
      "description": "3D modeling, animation, and rendering via blender --background --python",
      "requires": "blender",
      "homepage": "https://www.blender.org",
      "install_cmd": "pip install git+https://github.com/HKUDS/CLI-Anything.git#subdirectory=blender/agent-harness",
      "entry_point": "cli-anything-blender",
      "skill_md": "blender/agent-harness/cli_anything/blender/skills/SKILL.md",
      "category": "3d",
      "contributor": "CLI-Anything-Team",
      "contributor_url": "https://github.com/HKUDS/CLI-Anything"
    },
    {
      "name": "comfyui",
      "display_name": "ComfyUI",
      "version": "1.0.0",
      "description": "AI image generation workflow management via ComfyUI REST API",
      "requires": "ComfyUI running at http://localhost:8188",
      "homepage": "https://github.com/comfyanonymous/ComfyUI",
      "install_cmd": "pip install git+https://github.com/HKUDS/CLI-Anything.git#subdirectory=comfyui/agent-harness",
      "entry_point": "cli-anything-comfyui",
      "skill_md": null,
      "category": "ai",
      "contributor": "Bortlesboat",
      "contributor_url": "https://github.com/Bortlesboat"
    },
    {
      "name": "drawio",
      "display_name": "Draw.io",
      "version": "1.0.0",
      "description": "Diagram creation and export via draw.io CLI",
      "requires": "draw.io desktop app",
      "homepage": "https://www.drawio.com",
      "install_cmd": "pip install git+https://github.com/HKUDS/CLI-Anything.git#subdirectory=drawio/agent-harness",
      "entry_point": "cli-anything-drawio",
      "skill_md": "drawio/agent-harness/cli_anything/drawio/skills/SKILL.md",
      "category": "diagrams",
      "contributor": "zhangxilong-43",
      "contributor_url": "https://github.com/zhangxilong-43"
    },
    {
      "name": "gimp",
      "display_name": "GIMP",
      "version": "1.0.0",
      "description": "Raster image processing via gimp -i -b (batch mode)",
      "requires": "gimp (apt install gimp)",
      "homepage": "https://www.gimp.org",
      "install_cmd": "pip install git+https://github.com/HKUDS/CLI-Anything.git#subdirectory=gimp/agent-harness",
      "entry_point": "cli-anything-gimp",
      "skill_md": "gimp/agent-harness/cli_anything/gimp/skills/SKILL.md",
      "category": "image",
      "contributor": "CLI-Anything-Team",
      "contributor_url": "https://github.com/HKUDS/CLI-Anything"
    },
    {
      "name": "inkscape",
      "display_name": "Inkscape",
      "version": "1.0.0",
      "description": "SVG vector graphics with export via inkscape --export-filename",
      "requires": "inkscape (apt install inkscape)",
      "homepage": "https://inkscape.org",
      "install_cmd": "pip install git+https://github.com/HKUDS/CLI-Anything.git#subdirectory=inkscape/agent-harness",
      "entry_point": "cli-anything-inkscape",
      "skill_md": "inkscape/agent-harness/cli_anything/inkscape/skills/SKILL.md",
      "category": "image",
      "contributor": "CLI-Anything-Team",
      "contributor_url": "https://github.com/HKUDS/CLI-Anything"
    },
    {
      "name": "kdenlive",
      "display_name": "Kdenlive",
      "version": "1.0.0",
      "description": "Video editing and rendering via melt",
      "requires": "melt (apt install melt)",
      "homepage": "https://kdenlive.org",
      "install_cmd": "pip install git+https://github.com/HKUDS/CLI-Anything.git#subdirectory=kdenlive/agent-harness",
      "entry_point": "cli-anything-kdenlive",
      "skill_md": "kdenlive/agent-harness/cli_anything/kdenlive/skills/SKILL.md",
      "category": "video",
      "contributor": "CLI-Anything-Team",
      "contributor_url": "https://github.com/HKUDS/CLI-Anything"
    },
    {
      "name": "libreoffice",
      "display_name": "LibreOffice",
      "version": "1.0.0",
      "description": "Create and manipulate ODF documents, export to PDF/DOCX/XLSX/PPTX via headless mode",
      "requires": "libreoffice",
      "homepage": "https://www.libreoffice.org",
      "install_cmd": "pip install git+https://github.com/HKUDS/CLI-Anything.git#subdirectory=libreoffice/agent-harness",
      "entry_point": "cli-anything-libreoffice",
      "skill_md": "libreoffice/agent-harness/cli_anything/libreoffice/skills/SKILL.md",
      "category": "office",
      "contributor": "CLI-Anything-Team",
      "contributor_url": "https://github.com/HKUDS/CLI-Anything"
    },
    {
      "name": "mubu",
      "display_name": "Mubu",
      "version": "0.1.1",
      "description": "Knowledge management and outlining via local Mubu desktop data",
      "requires": "Mubu desktop app",
      "homepage": "https://mubu.com",
      "install_cmd": "pip install git+https://github.com/HKUDS/CLI-Anything.git#subdirectory=mubu/agent-harness",
      "entry_point": "cli-anything-mubu",
      "skill_md": "mubu/agent-harness/cli_anything/mubu/skills/SKILL.md",
      "category": "office",
      "contributor": "cnfjlhj",
      "contributor_url": "https://github.com/cnfjlhj"
    },
    {
      "name": "mermaid",
      "display_name": "Mermaid",
      "version": "1.0.0",
      "description": "Mermaid Live Editor state files and renderer URLs",
      "requires": null,
      "homepage": "https://mermaid.js.org",
      "install_cmd": "pip install git+https://github.com/HKUDS/CLI-Anything.git#subdirectory=mermaid/agent-harness",
      "entry_point": "cli-anything-mermaid",
      "skill_md": null,
      "category": "diagrams",
      "contributor": "getmored-create",
      "contributor_url": "https://github.com/getmored-create"
    },
    {
      "name": "notebooklm",
      "display_name": "NotebookLM",
      "version": "0.1.0",
      "description": "Experimental NotebookLM harness scaffold wrapping the installed notebooklm CLI for notebook, source, chat, artifact, download, and sharing workflows",
      "requires": "notebooklm CLI from notebooklm-py + valid local NotebookLM login session",
      "homepage": "https://notebooklm.google.com",
      "install_cmd": "pip install git+https://github.com/HKUDS/CLI-Anything.git#subdirectory=notebooklm/agent-harness",
      "entry_point": "cli-anything-notebooklm",
      "skill_md": "notebooklm/agent-harness/cli_anything/notebooklm/skills/SKILL.md",
      "category": "ai",
      "contributor": "Haimbeau1o",
      "contributor_url": "https://github.com/Haimbeau1o"
    },
    {
      "name": "ollama",
      "display_name": "Ollama",
      "version": "1.0.1",
      "description": "Local LLM inference and model management via Ollama REST API",
      "requires": "Ollama running at http://localhost:11434",
      "homepage": "https://ollama.com",
      "install_cmd": "pip install git+https://github.com/HKUDS/CLI-Anything.git#subdirectory=ollama/agent-harness",
      "entry_point": "cli-anything-ollama",
      "skill_md": "ollama/agent-harness/cli_anything/ollama/skills/SKILL.md",
      "category": "ai"
    },
    {
      "name": "obs-studio",
      "display_name": "OBS Studio",
      "version": "1.0.0",
      "description": "Create and manage streaming/recording scenes via command line",
      "requires": "obs-studio",
      "homepage": "https://obsproject.com",
      "install_cmd": "pip install git+https://github.com/HKUDS/CLI-Anything.git#subdirectory=obs-studio/agent-harness",
      "entry_point": "cli-anything-obs-studio",
      "skill_md": "obs-studio/agent-harness/cli_anything/obs_studio/skills/SKILL.md",
      "category": "streaming",
      "contributor": "CLI-Anything-Team",
      "contributor_url": "https://github.com/HKUDS/CLI-Anything"
    },
    {
      "name": "shotcut",
      "display_name": "Shotcut",
      "version": "1.0.0",
      "description": "Video editing and rendering via melt/ffmpeg",
      "requires": "melt (apt install melt), ffmpeg (apt install ffmpeg)",
      "homepage": "https://shotcut.org",
      "install_cmd": "pip install git+https://github.com/HKUDS/CLI-Anything.git#subdirectory=shotcut/agent-harness",
      "entry_point": "cli-anything-shotcut",
      "skill_md": "shotcut/agent-harness/cli_anything/shotcut/skills/SKILL.md",
      "category": "video",
      "contributor": "CLI-Anything-Team",
      "contributor_url": "https://github.com/HKUDS/CLI-Anything"
    },
    {
      "name": "zoom",
      "display_name": "Zoom",
      "version": "1.0.0",
      "description": "Meeting management via Zoom REST API (OAuth2)",
      "requires": "Zoom account + OAuth app credentials",
      "homepage": "https://zoom.us",
      "install_cmd": "pip install git+https://github.com/HKUDS/CLI-Anything.git#subdirectory=zoom/agent-harness",
      "entry_point": "cli-anything-zoom",
      "skill_md": "zoom/agent-harness/cli_anything/zoom/skills/SKILL.md",
      "category": "communication",
      "contributor": "zhangxilong-43",
      "contributor_url": "https://github.com/zhangxilong-43"
    }
  ]
}
Download .txt
gitextract_12ysvy81/

├── .gitignore
├── CONTRIBUTING.md
├── README.md
├── README_CN.md
└── registry.json
Condensed preview — 5 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (85K chars).
[
  {
    "path": ".gitignore",
    "chars": 2189,
    "preview": "# ============================================================\n# Only track:\n#   - cli-anything-plugin/**\n#   - codex-sk"
  },
  {
    "path": "CONTRIBUTING.md",
    "chars": 4552,
    "preview": "# Contributing to CLI-Anything\n\nThank you for your interest in contributing to CLI-Anything! This guide will help you ge"
  },
  {
    "path": "README.md",
    "chars": 40244,
    "preview": "<h1 align=\"center\"><img src=\"assets/icon.png\" alt=\"\" width=\"64\" style=\"vertical-align: middle;\">&nbsp; CLI-Anything: Mak"
  },
  {
    "path": "README_CN.md",
    "chars": 23409,
    "preview": "<h1 align=\"center\"><img src=\"assets/icon.png\" alt=\"\" width=\"64\" style=\"vertical-align: middle;\">&nbsp; CLI-Anything: 让所有"
  },
  {
    "path": "registry.json",
    "chars": 11009,
    "preview": "{\n  \"meta\": {\n    \"repo\": \"https://github.com/HKUDS/CLI-Anything\",\n    \"description\": \"CLI-Hub — Agent-native stateful C"
  }
]

About this extraction

This page contains the full source code of the HKUDS/CLI-Anything GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 5 files (79.5 KB), approximately 25.2k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!