"CLI-Anything: Making ALL Software Agent-Native" -- CLI-Hub: https://clianything.cc/
Python
@ fix: address review feedback — doc create stdin, registry, drawio cleanup
hito469ef1d91dcb
diff --git a/drawio/agent-harness/cli_anything/drawio/core/export.py b/drawio/agent-harness/cli_anything/drawio/core/export.pyindex 1420a4c4d..c43392c25 100644--- a/drawio/agent-harness/cli_anything/drawio/core/export.py+++ b/drawio/agent-harness/cli_anything/drawio/core/export.py@@ -36,7 +36,6 @@ def render(session: Session, output_path: str,height: Optional[int] = None,transparent: bool = False,crop: bool = False,- border: int = 0,overwrite: bool = False) -> dict:"""Export the current project to a file.@@ -100,7 +99,6 @@ def render(session: Session, output_path: str,height=height,transparent=transparent,crop=crop,- border=border,overwrite=True, # We already checked above)result["action"] = "export"@@ -110,12 +108,12 @@ def render(session: Session, output_path: str,def render_or_save(session: Session, output_path: str,- fmt: str = "png", border: int = 0, **kwargs) -> dict:+ fmt: str = "png", **kwargs) -> dict:"""Export with fallback: if draw.io CLI is not available, save the .drawiofile and provide instructions for manual export."""try:- return render(session, output_path, fmt, border=border, **kwargs)+ return render(session, output_path, fmt, **kwargs)except RuntimeError as e:if "not installed" not in str(e):raisediff --git a/drawio/agent-harness/cli_anything/drawio/drawio_cli.py b/drawio/agent-harness/cli_anything/drawio/drawio_cli.pyindex 65f1623d2..875a6fba1 100644--- a/drawio/agent-harness/cli_anything/drawio/drawio_cli.py+++ b/drawio/agent-harness/cli_anything/drawio/drawio_cli.py@@ -521,11 +521,10 @@ def export():@click.option("--height", type=int, default=None, help="Output height (PNG)")@click.option("--transparent", is_flag=True, help="Transparent background (PNG)")@click.option("--crop", is_flag=True, help="Crop to content")[email protected]("--border", type=int, default=0, help="Border padding in pixels (PNG)")@click.option("--overwrite", is_flag=True, help="Overwrite existing file")@handle_errordef export_render(output_path, fmt, page_index, scale, width, height,- transparent, crop, border, overwrite):+ transparent, crop, overwrite):"""Export the diagram to a file."""session = get_session()result = export_mod.render_or_save(@@ -533,7 +532,7 @@ def export_render(output_path, fmt, page_index, scale, width, height,page_index=page_index, scale=scale,width=width, height=height,transparent=transparent, crop=crop,- border=border, overwrite=overwrite,+ overwrite=overwrite,)output(result, f"Exported to: {result.get('output', result.get('drawio_file', ''))}")diff --git a/registry.json b/registry.jsonindex 46a37776f..4a5854171 100644--- a/registry.json+++ b/registry.json@@ -1236,7 +1236,7 @@"category": "knowledge-management","requires": "SiYuan running with HTTP API enabled (default http://127.0.0.1:6806)","homepage": "https://github.com/siyuan-note/siyuan",- "source_url": "https://github.com/HKUDS/CLI-Anything",+ "source_url": null,"install_strategy": "pip","install_cmd": "pip install git+https://github.com/HKUDS/CLI-Anything.git#subdirectory=siyuan/agent-harness","skill_md": "skills/cli-anything-siyuan/SKILL.md",diff --git a/siyuan/agent-harness/cli_anything/siyuan/siyuan_cli.py b/siyuan/agent-harness/cli_anything/siyuan/siyuan_cli.pyindex dbc140a5e..a7bf135e7 100644--- a/siyuan/agent-harness/cli_anything/siyuan/siyuan_cli.py+++ b/siyuan/agent-harness/cli_anything/siyuan/siyuan_cli.py@@ -473,7 +473,7 @@ def doc():@doc.command("create")@click.argument("notebook_id")@click.argument("path")[email protected]("--md", default="", help="Markdown content. Use '-' or omit to read from stdin.")[email protected]("--md", default="", help="Markdown content. Use '-' to read from stdin.")@click.pass_objdef doc_create(ctx: SiYuanContext, notebook_id: str, path: str, md: str):"""Create a document with optional Markdown content.@@ -482,7 +482,7 @@ def doc_create(ctx: SiYuanContext, notebook_id: str, path: str, md: str):(backticks, quotes, parentheses), pipe Markdown via stdin:echo "## Title" | sy doc create nb1 /test --md -"""- if not md or md == "-":+ if md == "-":md = _read_stdin()doc_id = ctx.client.create_doc_with_md(notebook_id, path, md)if ctx.json_output:diff --git a/skills/cli-anything-siyuan/SKILL.md b/skills/cli-anything-siyuan/SKILL.mdindex a921df680..fc7c14539 100644--- a/skills/cli-anything-siyuan/SKILL.md+++ b/skills/cli-anything-siyuan/SKILL.md@@ -1,5 +1,5 @@----name: "cli-anything-siyuan"+name: cli-anything-siyuandescription: SiYuan (思源笔记) CLI — manage notebooks, documents, blocks, and search your knowledge base from the terminal.---@@ -73,8 +73,21 @@ documents, blocks, search, and export.# List notebooks (JSON)cli-anything-siyuan --json notebook list-# Create a document with Markdown-cli-anything-siyuan doc create nb1 /projects/new "## Title\n\nContent"+# Create a document with Markdown (--md flag, watch shell escaping)+cli-anything-siyuan doc create nb1 /projects/new --md "## Title\n\nContent"++# Create a document — pipe Markdown via stdin (avoids shell escaping)+# PowerShell here-string (literal, no escaping needed):+@'+## Title+Content with `backticks` and (parentheses) and "quotes"+'@ | cli-anything-siyuan doc create nb1 /projects/new --md -++# Bash heredoc:+# cat <<'EOF' | cli-anything-siyuan doc create nb1 /projects/new --md -+# ## Title+# Content with `backticks` and (parentheses)+# EOF# SQL searchcli-anything-siyuan sql "SELECT id, content FROM blocks WHERE content LIKE '%meeting%' LIMIT 5"