diff --git a/src/cmdforge/registry/app.py b/src/cmdforge/registry/app.py index daa13dd..28bfca5 100644 --- a/src/cmdforge/registry/app.py +++ b/src/cmdforge/registry/app.py @@ -2459,6 +2459,59 @@ def create_app() -> Flask: "meta": paginate(page, per_page, total), }) + @app.route("/api/v1/admin/tools/", methods=["GET"]) + @require_moderator + def admin_get_tool(tool_id: int) -> Response: + """Get full tool details for admin review.""" + tool = query_one( + g.db, + """ + SELECT t.*, p.display_name as publisher_name + FROM tools t + JOIN publishers p ON t.publisher_id = p.id + WHERE t.id = ? + """, + [tool_id], + ) + if not tool: + return error_response("TOOL_NOT_FOUND", "Tool not found", 404) + + # Parse config YAML to extract steps + config = {} + if tool["config_yaml"]: + try: + config = yaml.safe_load(tool["config_yaml"]) or {} + except yaml.YAMLError: + pass + + # Parse scrutiny report + scrutiny_report = None + if tool["scrutiny_report"]: + try: + scrutiny_report = json.loads(tool["scrutiny_report"]) + except (json.JSONDecodeError, TypeError): + pass + + return jsonify({ + "data": { + "id": tool["id"], + "owner": tool["owner"], + "name": tool["name"], + "version": tool["version"], + "description": tool["description"], + "category": tool["category"], + "tags": tool["tags"], + "published_at": tool["published_at"], + "publisher_name": tool["publisher_name"], + "visibility": tool["visibility"], + "moderation_status": tool["moderation_status"], + "scrutiny_status": tool["scrutiny_status"], + "scrutiny_report": scrutiny_report, + "config": config, + "readme": tool["readme"] or "", + } + }) + @app.route("/api/v1/admin/tools//approve", methods=["POST"]) @require_moderator def admin_approve_tool(tool_id: int) -> Response: diff --git a/src/cmdforge/web/templates/admin/pending.html b/src/cmdforge/web/templates/admin/pending.html index f7df4c6..9041d08 100644 --- a/src/cmdforge/web/templates/admin/pending.html +++ b/src/cmdforge/web/templates/admin/pending.html @@ -30,7 +30,9 @@
-
{{ tool.owner }}/{{ tool.name }}
+
v{{ tool.version }}
@@ -137,6 +139,51 @@ {% endif %} + + +