diff --git a/src/cmdforge/gui/dialogs/publish_dialog.py b/src/cmdforge/gui/dialogs/publish_dialog.py index 06484dd..c17c0dd 100644 --- a/src/cmdforge/gui/dialogs/publish_dialog.py +++ b/src/cmdforge/gui/dialogs/publish_dialog.py @@ -177,15 +177,31 @@ class PublishDialog(QDialog): def _on_success(self, result: dict): """Handle publish success.""" + import yaml + self.progress.hide() self.status_label.setText("Published successfully!") self.status_label.setStyleSheet("color: #38a169; font-weight: 600;") - QMessageBox.information( - self, "Success", - f"Tool '{self._tool.name}' has been published.\n\n" - f"It will be available after review." - ) + # Save registry_hash to local config for publish state tracking + config_hash = result.get("config_hash") + if config_hash and hasattr(self._tool, 'path') and self._tool.path: + try: + config_path = self._tool.path + if config_path.exists(): + config_data = yaml.safe_load(config_path.read_text()) or {} + config_data["registry_hash"] = config_hash + config_path.write_text(yaml.dump(config_data, default_flow_style=False, sort_keys=False)) + except Exception: + pass # Non-critical - just won't show publish state + + status = result.get("status", "pending") + if status == "approved": + msg = f"Tool '{self._tool.name}' has been published and is now live!" + else: + msg = f"Tool '{self._tool.name}' has been published.\n\nIt will be available after review." + + QMessageBox.information(self, "Success", msg) self.accept() def _on_error(self, error: str): diff --git a/src/cmdforge/registry/app.py b/src/cmdforge/registry/app.py index 315d97e..91bbdd8 100644 --- a/src/cmdforge/registry/app.py +++ b/src/cmdforge/registry/app.py @@ -1862,6 +1862,7 @@ def create_app() -> Flask: "owner": owner, "name": name, "version": version, + "config_hash": config_hash, "pr_url": "", "status": moderation_status, "visibility": visibility,