diff --git a/src/cmdforge/cli/__init__.py b/src/cmdforge/cli/__init__.py index 5b5d393..5d17ef6 100644 --- a/src/cmdforge/cli/__init__.py +++ b/src/cmdforge/cli/__init__.py @@ -192,7 +192,7 @@ def main(): # registry update-readme p_reg_update_readme = registry_sub.add_parser("update-readme", help="Update README for a published tool") - p_reg_update_readme.add_argument("tool", help="Tool name (local name, will resolve owner)") + p_reg_update_readme.add_argument("tool", nargs="?", default="", help="Tool name (local name, will resolve owner)") p_reg_update_readme.add_argument("--all", action="store_true", dest="update_all", help="Update README for all published tools that have a local README.md") p_reg_update_readme.set_defaults(func=cmd_registry) diff --git a/src/cmdforge/cli/registry_commands.py b/src/cmdforge/cli/registry_commands.py index 0feb048..1204d0e 100644 --- a/src/cmdforge/cli/registry_commands.py +++ b/src/cmdforge/cli/registry_commands.py @@ -688,6 +688,9 @@ def _cmd_registry_update_readme(args): # Single tool mode tool_name = args.tool + if not tool_name: + print("Error: tool name required (or use --all)", file=sys.stderr) + return 1 tool_dir = TOOLS_DIR / tool_name config_path = tool_dir / "config.yaml" readme_path = tool_dir / "README.md" diff --git a/src/cmdforge/registry/app.py b/src/cmdforge/registry/app.py index ce1402d..8cd49f9 100644 --- a/src/cmdforge/registry/app.py +++ b/src/cmdforge/registry/app.py @@ -2819,7 +2819,8 @@ def create_app() -> Flask: @require_token def update_tool_readme(owner: str, name: str) -> Response: """Update the README for an existing tool without affecting config or hash.""" - if g.current_publisher["slug"] != owner: + is_admin = g.current_publisher.get("role") == "admin" + if g.current_publisher["slug"] != owner and not is_admin: return error_response("FORBIDDEN", "You can only update your own tools", 403) data = request.get_json() or {}