From 4b1f3cee528dc8d50d293cf0c82964ac60c85ade Mon Sep 17 00:00:00 2001 From: rob Date: Fri, 16 Jan 2026 07:12:20 -0400 Subject: [PATCH] Save registry_hash after publish for state tracking MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add config_hash to publish API response - Save registry_hash to local tool config after successful publish - Show appropriate message based on moderation status (approved vs pending) This enables the GUI to show publish state indicators (✓ published, ● modified) for tools that have been published to the registry. Co-Authored-By: Claude Opus 4.5 --- src/cmdforge/gui/dialogs/publish_dialog.py | 26 +++++++++++++++++----- src/cmdforge/registry/app.py | 1 + 2 files changed, 22 insertions(+), 5 deletions(-) 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,