diff --git a/src/cmdforge/gui/dialogs/publish_dialog.py b/src/cmdforge/gui/dialogs/publish_dialog.py index 96b7bf8..0f04855 100644 --- a/src/cmdforge/gui/dialogs/publish_dialog.py +++ b/src/cmdforge/gui/dialogs/publish_dialog.py @@ -658,6 +658,10 @@ class PublishDialog(QDialog): config_data = self._published_config.copy() config_data["registry_hash"] = config_hash config_data["registry_status"] = moderation_status + # Save the registry owner so rating lookups work + registry_owner = result.get("owner") + if registry_owner: + config_data["registry_owner"] = registry_owner # Clear any old feedback config_data.pop("registry_feedback", None) config_path.write_text(yaml.dump(config_data, default_flow_style=False, sort_keys=False)) diff --git a/src/cmdforge/gui/pages/tools_page.py b/src/cmdforge/gui/pages/tools_page.py index ded6a23..7154d79 100644 --- a/src/cmdforge/gui/pages/tools_page.py +++ b/src/cmdforge/gui/pages/tools_page.py @@ -89,6 +89,7 @@ class StatusSyncWorker(QThread): new_status = status_data.get("status", "pending") new_feedback = status_data.get("feedback") + new_owner = status_data.get("owner") old_status = config_data.get("registry_status", "pending") old_feedback = config_data.get("registry_feedback") @@ -103,6 +104,10 @@ class StatusSyncWorker(QThread): elif "registry_feedback" in config_data: del config_data["registry_feedback"] changed = True + # Backfill registry_owner from sync data + if new_owner and config_data.get("registry_owner") != new_owner: + config_data["registry_owner"] = new_owner + changed = True if changed: config_path.write_text(yaml.dump(config_data, default_flow_style=False, sort_keys=False)) @@ -182,7 +187,12 @@ def get_tool_registry_info(tool_name: str, fallback_owner: Optional[str] = None) owner, name = tool_name.split("/", 1) return (owner, name) - # Flat dir: check source.author or installed_from in config + # Flat dir: check registry_owner (saved at publish time) + registry_owner = config_data.get("registry_owner") + if registry_owner: + return (registry_owner, tool_name) + + # Check source.author or installed_from in config source = config_data.get("source", {}) if isinstance(source, dict) and source.get("author"): return (source["author"], tool_name) @@ -809,6 +819,10 @@ class ToolsPage(QWidget): self.info_text.setHtml("\n".join(lines)) + # Ensure slug is available for own published tools (fallback owner). + if not self._my_slug_fetched: + self._fetch_my_slug() + # Update rating bar below the detail text self._update_rating_bar(qname) @@ -1011,14 +1025,14 @@ class ToolsPage(QWidget): def _fetch_rating_if_needed(self, tool_name: str): """Fetch rating data for a registry tool if not cached.""" - registry_info = get_tool_registry_info(tool_name, self._my_slug) - if not registry_info: - return - # Ensure we have the user slug (non-blocking first time; runs in main thread once) if not self._my_slug_fetched: self._fetch_my_slug() + registry_info = get_tool_registry_info(tool_name, self._my_slug) + if not registry_info: + return + if tool_name in self._rating_cache: # Already cached - just update buttons self._update_rate_button()