"CLI-Anything: Making ALL Software Agent-Native" -- CLI-Hub: https://clianything.cc/
Python
fix: support stdin pipe for doc create --md to avoid shell escaping
hitob7a067c59c8d
diff --git a/siyuan/agent-harness/cli_anything/siyuan/siyuan_cli.py b/siyuan/agent-harness/cli_anything/siyuan/siyuan_cli.pyindex 62c67803a..1efd3b09c 100644--- a/siyuan/agent-harness/cli_anything/siyuan/siyuan_cli.py+++ b/siyuan/agent-harness/cli_anything/siyuan/siyuan_cli.py@@ -455,10 +455,17 @@ def doc():@doc.command("create")@click.argument("notebook_id")@click.argument("path")[email protected]("--md", default="", help="Markdown content")[email protected]("--md", default="", help="Markdown content. Use '-' or omit 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."""+ """Create a document with optional Markdown content.++ To avoid shell escaping issues with special characters+ (backticks, quotes, parentheses), pipe Markdown via stdin:+ echo "## Title" | sy doc create nb1 /test --md -+ """+ if not md or md == "-":+ md = click.get_text_stream("stdin").read()doc_id = ctx.client.create_doc_with_md(notebook_id, path, md)if ctx.json_output:click.echo(json.dumps({"id": doc_id}, ensure_ascii=False))diff --git a/siyuan/agent-harness/cli_anything/siyuan/skills/SKILL.md b/siyuan/agent-harness/cli_anything/siyuan/skills/SKILL.mdindex 49455c3c5..fc7c14539 100644--- a/siyuan/agent-harness/cli_anything/siyuan/skills/SKILL.md+++ b/siyuan/agent-harness/cli_anything/siyuan/skills/SKILL.md@@ -73,9 +73,22 @@ documents, blocks, search, and export.# List notebooks (JSON)cli-anything-siyuan --json notebook list-# Create a document with Markdown (use --md flag)+# 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"