deepctl-cmd-update 0.2.5__tar.gz → 0.2.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (17) hide show
  1. {deepctl_cmd_update-0.2.5 → deepctl_cmd_update-0.2.7}/PKG-INFO +1 -1
  2. {deepctl_cmd_update-0.2.5 → deepctl_cmd_update-0.2.7}/pyproject.toml +1 -1
  3. {deepctl_cmd_update-0.2.5 → deepctl_cmd_update-0.2.7}/src/deepctl_cmd_update/command.py +25 -6
  4. {deepctl_cmd_update-0.2.5 → deepctl_cmd_update-0.2.7}/src/deepctl_cmd_update/plugin_update_check.py +18 -13
  5. {deepctl_cmd_update-0.2.5 → deepctl_cmd_update-0.2.7}/src/deepctl_cmd_update/startup_check.py +10 -4
  6. {deepctl_cmd_update-0.2.5 → deepctl_cmd_update-0.2.7}/src/deepctl_cmd_update.egg-info/PKG-INFO +1 -1
  7. {deepctl_cmd_update-0.2.5 → deepctl_cmd_update-0.2.7}/README.md +0 -0
  8. {deepctl_cmd_update-0.2.5 → deepctl_cmd_update-0.2.7}/setup.cfg +0 -0
  9. {deepctl_cmd_update-0.2.5 → deepctl_cmd_update-0.2.7}/src/deepctl_cmd_update/__init__.py +0 -0
  10. {deepctl_cmd_update-0.2.5 → deepctl_cmd_update-0.2.7}/src/deepctl_cmd_update/installation.py +0 -0
  11. {deepctl_cmd_update-0.2.5 → deepctl_cmd_update-0.2.7}/src/deepctl_cmd_update/models.py +0 -0
  12. {deepctl_cmd_update-0.2.5 → deepctl_cmd_update-0.2.7}/src/deepctl_cmd_update/version_check.py +0 -0
  13. {deepctl_cmd_update-0.2.5 → deepctl_cmd_update-0.2.7}/src/deepctl_cmd_update.egg-info/SOURCES.txt +0 -0
  14. {deepctl_cmd_update-0.2.5 → deepctl_cmd_update-0.2.7}/src/deepctl_cmd_update.egg-info/dependency_links.txt +0 -0
  15. {deepctl_cmd_update-0.2.5 → deepctl_cmd_update-0.2.7}/src/deepctl_cmd_update.egg-info/entry_points.txt +0 -0
  16. {deepctl_cmd_update-0.2.5 → deepctl_cmd_update-0.2.7}/src/deepctl_cmd_update.egg-info/requires.txt +0 -0
  17. {deepctl_cmd_update-0.2.5 → deepctl_cmd_update-0.2.7}/src/deepctl_cmd_update.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deepctl-cmd-update
3
- Version: 0.2.5
3
+ Version: 0.2.7
4
4
  Summary: Update command for deepctl
5
5
  Author-email: Deepgram <devrel@deepgram.com>
6
6
  Maintainer-email: Deepgram <devrel@deepgram.com>
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "deepctl-cmd-update"
7
- version = "0.2.5" # x-release-please-version
7
+ version = "0.2.7" # x-release-please-version
8
8
  description = "Update command for deepctl"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -69,8 +69,16 @@ class UpdateCommand(BaseCommand):
69
69
  auth_manager: Any, # Not used for update command
70
70
  client: Any, # Not used for update command
71
71
  **kwargs: Any,
72
- ) -> dict[str, Any]:
73
- """Handle the update command execution."""
72
+ ) -> UpdateResult | dict[str, Any]:
73
+ """Handle the update command execution.
74
+
75
+ Returns the model rather than a dict wherever the exit code has to
76
+ be non-zero: BaseCommand.exit_code_for reads `.status` off the
77
+ result, and a dict has none, so a dict always exits 0. The three
78
+ failure paths carry status="error" (exit 1) and the decline path
79
+ status="cancelled" (exit 2). output_result unwraps either, so the
80
+ JSON payload is the same shape from both.
81
+ """
74
82
  console = get_console()
75
83
 
76
84
  # Extract arguments from kwargs
@@ -93,10 +101,13 @@ class UpdateCommand(BaseCommand):
93
101
  version_info = asyncio.run(version_checker.check_version(force=True))
94
102
  except Exception as e:
95
103
  print_error(f"Failed to check for updates: {e}")
104
+ # status="error" on the model, not a dict: see the docstring.
105
+ # A command that failed has to exit 1, as the README says.
96
106
  return UpdateResult(
107
+ status="error",
97
108
  success=False,
98
109
  message=f"Failed to check for updates: {e}",
99
- ).model_dump()
110
+ )
100
111
 
101
112
  # Display version info
102
113
  message = format_version_message(version_info)
@@ -167,14 +178,20 @@ class UpdateCommand(BaseCommand):
167
178
  # Confirm update
168
179
  if not yes and not Confirm.ask("\nDo you want to proceed with the update?"):
169
180
  print_info("Update cancelled")
181
+ # Return the model, not .model_dump(): BaseCommand.exit_code_for
182
+ # reads `.status` off the result, and a plain dict has none -- a
183
+ # declined update used to exit 0 while its own payload said
184
+ # "Update cancelled by user". status="cancelled" is the documented
185
+ # exit 2.
170
186
  return UpdateResult(
187
+ status="cancelled",
171
188
  success=False,
172
189
  message="Update cancelled by user",
173
190
  current_version=version_info.current_version,
174
191
  latest_version=version_info.latest_version,
175
192
  update_available=version_info.update_available,
176
193
  installation_method=install_info.method.value,
177
- ).model_dump()
194
+ )
178
195
 
179
196
  # Execute update
180
197
  print_info("Updating deepctl...")
@@ -212,13 +229,14 @@ class UpdateCommand(BaseCommand):
212
229
  console.print(f"[yellow]{shlex.join(update_command)}[/yellow]")
213
230
 
214
231
  return UpdateResult(
232
+ status="error",
215
233
  success=False,
216
234
  message=f"Update failed: {error_msg}",
217
235
  current_version=version_info.current_version,
218
236
  latest_version=version_info.latest_version,
219
237
  update_available=version_info.update_available,
220
238
  installation_method=install_info.method.value,
221
- ).model_dump()
239
+ )
222
240
 
223
241
  except Exception as e:
224
242
  print_error(f"Failed to execute update: {e}")
@@ -228,10 +246,11 @@ class UpdateCommand(BaseCommand):
228
246
  console.print(f"[yellow]{update_command}[/yellow]")
229
247
 
230
248
  return UpdateResult(
249
+ status="error",
231
250
  success=False,
232
251
  message=f"Failed to execute update: {e}",
233
252
  current_version=version_info.current_version,
234
253
  latest_version=version_info.latest_version,
235
254
  update_available=version_info.update_available,
236
255
  installation_method=install_info.method.value,
237
- ).model_dump()
256
+ )
@@ -256,18 +256,23 @@ def print_pending_plugin_notifications() -> None:
256
256
  if not updates:
257
257
  return
258
258
 
259
- if len(updates) == 1:
260
- u = updates[0]
261
- sys.stderr.write(
262
- f"\033[33mPlugin update available: {u['name']} {u['current']} → {u['latest']}"
263
- f" — run 'deepctl plugin update {u['name']}' to upgrade\033[0m\n"
264
- )
265
- else:
266
- sys.stderr.write("\033[33mPlugin updates available:\033[0m\n")
267
- for u in updates:
259
+ try:
260
+ if len(updates) == 1:
261
+ u = updates[0]
268
262
  sys.stderr.write(
269
- f"\033[33m {u['name']} {u['current']} → {u['latest']}\033[0m\n"
263
+ f"\033[33mPlugin update available: {u['name']} {u['current']} → {u['latest']}"
264
+ f" — run 'deepctl plugin update {u['name']}' to upgrade\033[0m\n"
270
265
  )
271
- sys.stderr.write(
272
- "\033[33mRun 'deepctl plugin update <name>' to upgrade\033[0m\n"
273
- )
266
+ else:
267
+ sys.stderr.write("\033[33mPlugin updates available:\033[0m\n")
268
+ for u in updates:
269
+ sys.stderr.write(
270
+ f"\033[33m {u['name']} {u['current']} → {u['latest']}\033[0m\n"
271
+ )
272
+ sys.stderr.write(
273
+ "\033[33mRun 'deepctl plugin update <name>' to upgrade\033[0m\n"
274
+ )
275
+ except (BrokenPipeError, OSError, ValueError):
276
+ # The output stream closed (e.g. an MCP host disconnected stdio
277
+ # after `dg mcp` finished). These notifications are purely advisory.
278
+ pass
@@ -197,7 +197,13 @@ def print_pending_notification() -> None:
197
197
  latest = _result.get("latest")
198
198
  current = _result.get("current")
199
199
  if latest and current:
200
- sys.stderr.write(
201
- f"\n\033[33m Update available: {current} → {latest}"
202
- f" — run \033[1mdg update\033[0m\033[33m to upgrade\033[0m\n\n"
203
- )
200
+ try:
201
+ sys.stderr.write(
202
+ f"\n\033[33m Update available: {current} → {latest}"
203
+ f" — run \033[1mdg update\033[0m\033[33m to upgrade\033[0m\n\n"
204
+ )
205
+ except (BrokenPipeError, OSError, ValueError):
206
+ # The output stream closed (e.g. an MCP host disconnected stdio
207
+ # after `dg mcp` finished). Nothing useful to do — the notification
208
+ # is purely advisory.
209
+ pass
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deepctl-cmd-update
3
- Version: 0.2.5
3
+ Version: 0.2.7
4
4
  Summary: Update command for deepctl
5
5
  Author-email: Deepgram <devrel@deepgram.com>
6
6
  Maintainer-email: Deepgram <devrel@deepgram.com>