"CLI-Anything: Making ALL Software Agent-Native" -- CLI-Hub: https://clianything.cc/
Python
fix: doc tree accepts both files and tree response keys
hitoa769ce255de5
diff --git a/siyuan/agent-harness/cli_anything/siyuan/siyuan_cli.py b/siyuan/agent-harness/cli_anything/siyuan/siyuan_cli.pyindex 4510ee8f3..dbc140a5e 100644--- a/siyuan/agent-harness/cli_anything/siyuan/siyuan_cli.py+++ b/siyuan/agent-harness/cli_anything/siyuan/siyuan_cli.py@@ -277,7 +277,10 @@ def _handle_repl_command(skin: Any, cmd: str) -> None:for d in items])elif sub == "tree" and len(parts) >= 3:tree = client.list_doc_tree(parts[2])- items = tree.get("files", []) if isinstance(tree, dict) else tree+ if isinstance(tree, dict):+ items = tree.get("files") or tree.get("tree") or []+ else:+ items = treeif json_mode:click.echo(json.dumps(items, ensure_ascii=False))else:@@ -513,7 +516,10 @@ def doc_list(ctx: SiYuanContext, notebook_id: str, path: str):def doc_tree(ctx: SiYuanContext, notebook_id: str, path: str, depth: int):"""List document tree."""tree = ctx.client.list_doc_tree(notebook_id, path=path, max_depth=depth)- items = tree.get("files", []) if isinstance(tree, dict) else tree+ if isinstance(tree, dict):+ items = tree.get("files") or tree.get("tree") or []+ else:+ items = treeif ctx.json_output:click.echo(json.dumps(items, ensure_ascii=False))else: