qbraid-cli 0.16.18__tar.gz → 0.16.19__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 (78) hide show
  1. {qbraid_cli-0.16.18/qbraid_cli.egg-info → qbraid_cli-0.16.19}/PKG-INFO +4 -4
  2. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/pyproject.toml +4 -4
  3. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/configure/app.py +41 -8
  4. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/devices/app.py +1 -1
  5. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/envs/app.py +14 -1
  6. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/handlers.py +32 -0
  7. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/jobs/app.py +11 -1
  8. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/skills/app.py +46 -5
  9. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19/qbraid_cli.egg-info}/PKG-INFO +4 -4
  10. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli.egg-info/SOURCES.txt +1 -0
  11. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli.egg-info/requires.txt +3 -3
  12. qbraid_cli-0.16.19/tests/test_status_colors.py +157 -0
  13. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/LICENSE +0 -0
  14. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/README.md +0 -0
  15. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/__init__.py +0 -0
  16. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/_build_info.py +0 -0
  17. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/_version.py +0 -0
  18. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/account/__init__.py +0 -0
  19. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/account/app.py +0 -0
  20. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/admin/__init__.py +0 -0
  21. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/admin/app.py +0 -0
  22. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/admin/headers.py +0 -0
  23. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/admin/validation.py +0 -0
  24. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/agents/__init__.py +0 -0
  25. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/agents/app.py +0 -0
  26. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/agents/keep_alive.py +0 -0
  27. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/agents/permission_response.py +0 -0
  28. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/agents/provider_children.py +0 -0
  29. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/agents/queue.py +0 -0
  30. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/agents/work.py +0 -0
  31. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/ai/__init__.py +0 -0
  32. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/ai/app.py +0 -0
  33. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/ai/token.py +0 -0
  34. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/artifacts/__init__.py +0 -0
  35. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/artifacts/app.py +0 -0
  36. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/comms/__init__.py +0 -0
  37. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/comms/app.py +0 -0
  38. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/compute/__init__.py +0 -0
  39. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/compute/app.py +0 -0
  40. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/compute/instances.py +0 -0
  41. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/compute/profiles.py +0 -0
  42. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/compute/server.py +0 -0
  43. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/compute/ssh.py +0 -0
  44. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/configure/__init__.py +0 -0
  45. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/configure/actions.py +0 -0
  46. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/devices/__init__.py +0 -0
  47. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/devices/validation.py +0 -0
  48. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/envs/__init__.py +0 -0
  49. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/envs/activate.py +0 -0
  50. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/envs/create.py +0 -0
  51. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/envs/data_handling.py +0 -0
  52. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/envs/groups.py +0 -0
  53. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/envs/publish.py +0 -0
  54. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/envs/registry.py +0 -0
  55. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/envs/share.py +0 -0
  56. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/exceptions.py +0 -0
  57. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/jobs/__init__.py +0 -0
  58. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/jobs/groups.py +0 -0
  59. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/kernels/__init__.py +0 -0
  60. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/kernels/app.py +0 -0
  61. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/lab/__init__.py +0 -0
  62. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/lab/app.py +0 -0
  63. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/main.py +0 -0
  64. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/pip/__init__.py +0 -0
  65. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/pip/app.py +0 -0
  66. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/pip/hooks.py +0 -0
  67. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/projects/__init__.py +0 -0
  68. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/projects/app.py +0 -0
  69. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/py.typed +0 -0
  70. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/skills/__init__.py +0 -0
  71. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/troubleshoot/__init__.py +0 -0
  72. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli/troubleshoot/app.py +0 -0
  73. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli.egg-info/dependency_links.txt +0 -0
  74. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli.egg-info/entry_points.txt +0 -0
  75. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/qbraid_cli.egg-info/top_level.txt +0 -0
  76. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/setup.cfg +0 -0
  77. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/tests/test_cli_e2e.py +0 -0
  78. {qbraid_cli-0.16.18 → qbraid_cli-0.16.19}/tests/test_version.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: qbraid-cli
3
- Version: 0.16.18
3
+ Version: 0.16.19
4
4
  Summary: Command Line Interface for interacting with all parts of the qBraid platform.
5
5
  Author-email: qBraid Development Team <contact@qbraid.com>
6
6
  License-Expression: LicenseRef-Proprietary
@@ -30,11 +30,11 @@ Requires-Dist: typer>=0.12.1
30
30
  Requires-Dist: rich>=10.11.0
31
31
  Requires-Dist: click<=8.5.0
32
32
  Requires-Dist: questionary>=2.0.0
33
- Requires-Dist: qbraid-core>=0.6.45
33
+ Requires-Dist: qbraid-core>=0.6.46
34
34
  Provides-Extra: compute
35
- Requires-Dist: qbraid-core[compute]>=0.6.45; extra == "compute"
35
+ Requires-Dist: qbraid-core[compute]>=0.6.46; extra == "compute"
36
36
  Provides-Extra: envs
37
- Requires-Dist: qbraid-core[environments]>=0.6.45; extra == "envs"
37
+ Requires-Dist: qbraid-core[environments]>=0.6.46; extra == "envs"
38
38
  Provides-Extra: dev
39
39
  Requires-Dist: isort; extra == "dev"
40
40
  Requires-Dist: black; extra == "dev"
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "qbraid-cli"
7
- version = "0.16.18"
7
+ version = "0.16.19"
8
8
  description = "Command Line Interface for interacting with all parts of the qBraid platform."
9
9
  readme = "README.md"
10
10
  authors = [{ name = "qBraid Development Team", email = "contact@qbraid.com" }]
@@ -32,7 +32,7 @@ dependencies = [
32
32
  "rich>=10.11.0",
33
33
  "click<=8.5.0",
34
34
  "questionary>=2.0.0",
35
- "qbraid-core>=0.6.45",
35
+ "qbraid-core>=0.6.46",
36
36
  ]
37
37
  requires-python = ">= 3.10"
38
38
 
@@ -43,8 +43,8 @@ Documentation = "https://docs.qbraid.com/v2/cli/api-reference/qbraid"
43
43
  Discord = "https://discord.gg/KugF6Cnncm"
44
44
 
45
45
  [project.optional-dependencies]
46
- compute = ["qbraid-core[compute]>=0.6.45"]
47
- envs = ["qbraid-core[environments]>=0.6.45"]
46
+ compute = ["qbraid-core[compute]>=0.6.46"]
47
+ envs = ["qbraid-core[environments]>=0.6.46"]
48
48
  dev = ["isort", "black", "pytest", "pytest-cov", "pytest-asyncio"]
49
49
 
50
50
  [project.scripts]
@@ -12,6 +12,7 @@ from rich.console import Console
12
12
  from rich.table import Table
13
13
 
14
14
  from qbraid_cli.configure.actions import default_action
15
+ from qbraid_cli.handlers import require_tty
15
16
 
16
17
  # disable pretty_exceptions_show_locals to avoid printing sensative information in the traceback
17
18
  configure_app = typer.Typer(
@@ -26,6 +27,36 @@ configure_app = typer.Typer(
26
27
  )
27
28
 
28
29
 
30
+ _SECRET_WORDS = ("token", "secret", "password", "passwd", "credential")
31
+
32
+
33
+ def is_secret_config_key(name: str) -> bool:
34
+ """Whether a config key holds a secret.
35
+
36
+ api-key and named api-key-* keys, plus any key whose name contains token,
37
+ secret, password, passwd or credential. Config keys are case-insensitive
38
+ (configparser), so the check is too, and underscore or run-together
39
+ spellings (api_key, apikey, refresh_token, accesstoken) count.
40
+ """
41
+ key = name.lower().replace("_", "-")
42
+ if key in ("api-key", "apikey") or key.startswith(("api-key-", "apikey-")):
43
+ return True
44
+ return any(word in key for word in _SECRET_WORDS)
45
+
46
+
47
+ def mask_config_value(name: str, value: str) -> str:
48
+ """Return a config value for display.
49
+
50
+ Secrets are shown as `*****` plus their last three characters, or as `*****`
51
+ alone when they are shorter than 12 characters, so a short secret is not
52
+ mostly revealed.
53
+ """
54
+ if value and is_secret_config_key(name):
55
+ text = str(value)
56
+ return f"*****{text[-3:]}" if len(text) >= 12 else "*****"
57
+ return str(value)
58
+
59
+
29
60
  @configure_app.callback(invoke_without_command=True)
30
61
  def configure(ctx: typer.Context):
31
62
  """
@@ -38,6 +69,12 @@ def configure(ctx: typer.Context):
38
69
 
39
70
  """
40
71
  if ctx.invoked_subcommand is None:
72
+ require_tty(
73
+ "qbraid configure",
74
+ "interactive",
75
+ "Use 'qbraid configure set <name> <value>', or export QBRAID_API_KEY "
76
+ "to keep the key out of shell history.",
77
+ )
41
78
  default_action()
42
79
 
43
80
 
@@ -66,6 +103,7 @@ def configure_set(
66
103
  def configure_get(
67
104
  name: str = typer.Argument(..., help="Config name"),
68
105
  profile: str = typer.Option("default", "--profile", "-p", help="Profile name"),
106
+ show: bool = typer.Option(False, "--show", help="Print a secret (API key or token) unmasked."),
69
107
  ):
70
108
  """Get configuration value from qbraidrc file."""
71
109
  # pylint: disable-next=import-outside-toplevel
@@ -81,7 +119,8 @@ def configure_get(
81
119
  typer.echo(f"Configuration '{name}' not found in profile '{profile}'.")
82
120
  raise typer.Exit(1)
83
121
 
84
- typer.echo(config[profile][name])
122
+ value = config[profile][name]
123
+ typer.echo(value if show else mask_config_value(name, value))
85
124
 
86
125
 
87
126
  @configure_app.command(name="list")
@@ -106,14 +145,8 @@ def configure_list():
106
145
  table.add_column("Name", style="cyan")
107
146
  table.add_column("Value", style="green")
108
147
 
109
- sensitive_keys = {"api-key", "refresh-token"}
110
-
111
148
  for name, value in config[profile].items():
112
- if name in sensitive_keys and value:
113
- masked_value = f"*****{str(value)[-3:]}"
114
- else:
115
- masked_value = str(value)
116
- table.add_row(name, masked_value)
149
+ table.add_row(name, mask_config_value(name, value))
117
150
 
118
151
  console.print(table)
119
152
 
@@ -129,7 +129,7 @@ def devices_list(
129
129
  elif device_status == "UNAVAILABLE":
130
130
  status_color = "yellow"
131
131
  else:
132
- status_color = "grey"
132
+ status_color = "grey50"
133
133
 
134
134
  console.print(
135
135
  f"{device.qrn.ljust(qrn_width)}"
@@ -28,7 +28,7 @@ from rich.progress import (
28
28
  from qbraid_cli.envs.create import create_qbraid_env_assets, create_venv
29
29
  from qbraid_cli.envs.data_handling import get_envs_data as installed_envs_data
30
30
  from qbraid_cli.envs.data_handling import validate_env_name
31
- from qbraid_cli.handlers import QbraidException, handle_error, run_progress_task
31
+ from qbraid_cli.handlers import QbraidException, handle_error, require_tty, run_progress_task
32
32
 
33
33
  from .groups import groups_app
34
34
  from .publish import publish_app
@@ -238,6 +238,11 @@ def envs_create( # pylint: disable=too-many-statements
238
238
  interactive = name is None
239
239
 
240
240
  if interactive:
241
+ require_tty(
242
+ "qbraid envs create",
243
+ "interactive",
244
+ "Re-run with --name <name> --yes.",
245
+ )
241
246
  # Interactive mode: walk user through each field
242
247
  form = _interactive_create(console)
243
248
  name = form["name"]
@@ -263,6 +268,14 @@ def envs_create( # pylint: disable=too-many-statements
263
268
  except ValueError as err:
264
269
  handle_error(error_type="ValueError", include_traceback=False, message=str(err))
265
270
 
271
+ # Report bad input first, but fail before any work if the summary can't be confirmed.
272
+ if not auto_confirm:
273
+ require_tty(
274
+ "qbraid envs create",
275
+ "confirmation required",
276
+ "Re-run with --yes.",
277
+ )
278
+
266
279
  # Parse tags
267
280
  tag_list = [t.strip() for t in tags.split(",") if t.strip()] if tags else None
268
281
 
@@ -8,6 +8,7 @@ and executing operations with progress tracking within the qBraid CLI.
8
8
  """
9
9
 
10
10
  import os
11
+ import sys
11
12
  import traceback
12
13
  from pathlib import Path
13
14
  from time import sleep
@@ -68,6 +69,37 @@ def handle_error(
68
69
  raise typer.Exit(code=1)
69
70
 
70
71
 
72
+ def require_tty(command: str, reason: str, hint: str) -> None:
73
+ """Exit with a hint instead of blocking on a prompt when stdin is not a terminal.
74
+
75
+ A prompt with no terminal behind it (CI, scripts, ``ssh host 'cmd'``, a subprocess
76
+ with an open pipe) waits forever. Call this before prompting.
77
+
78
+ Some interactive terminals do not report a TTY (for example mintty in Git Bash
79
+ without winpty); set ``QBRAID_INTERACTIVE=1`` to prompt anyway.
80
+
81
+ Args:
82
+ command (str): The command as the user typed it, e.g. ``"qbraid configure"``.
83
+ reason (str): Why the command would prompt, e.g. ``"interactive"``.
84
+ hint (str): What to run instead.
85
+
86
+ Raises:
87
+ typer.Exit: With status code 2 when stdin is not a TTY.
88
+ """
89
+ try:
90
+ is_tty = sys.stdin is not None and sys.stdin.isatty()
91
+ except (AttributeError, ValueError): # closed or replaced stdin
92
+ is_tty = False
93
+ if is_tty or os.environ.get("QBRAID_INTERACTIVE") == "1":
94
+ return
95
+ typer.echo(
96
+ f"{command}: {reason}; stdin is not a TTY. {hint} "
97
+ "(Set QBRAID_INTERACTIVE=1 if this is an interactive terminal.)",
98
+ err=True,
99
+ )
100
+ raise typer.Exit(code=2)
101
+
102
+
71
103
  def handle_filesystem_operation(operation: Callable[[], None], path: Path) -> None:
72
104
  """
73
105
  Executes a filesystem operation with error handling.
@@ -66,10 +66,17 @@ EXTENSION_FORMAT_MAP: dict[str, Optional[ProgramFormat]] = {
66
66
  class JobVendor(str, Enum):
67
67
  """Vendor filter for job listing."""
68
68
 
69
+ AQT = "aqt"
69
70
  AWS = "aws"
70
71
  AZURE = "azure"
72
+ DIRAQ = "diraq"
71
73
  IBM = "ibm"
72
74
  IONQ = "ionq"
75
+ OPENQUANTUM = "openquantum"
76
+ QPERFECT = "qperfect"
77
+ QUANTINUUM = "quantinuum"
78
+ QUDORA = "qudora"
79
+ RIGETTI = "rigetti"
73
80
  QBRAID = "qbraid"
74
81
 
75
82
 
@@ -79,6 +86,7 @@ class JobProvider(str, Enum):
79
86
  AQT = "aqt"
80
87
  AWS = "aws"
81
88
  AZURE = "azure"
89
+ DIRAQ = "diraq"
82
90
  EQUAL1 = "equal1"
83
91
  IBM = "ibm"
84
92
  IQM = "iqm"
@@ -86,7 +94,9 @@ class JobProvider(str, Enum):
86
94
  NEC = "nec"
87
95
  OQC = "oqc"
88
96
  PASQAL = "pasqal"
97
+ QPERFECT = "qperfect"
89
98
  QUANTINUUM = "quantinuum"
99
+ QUDORA = "qudora"
90
100
  QUERA = "quera"
91
101
  RIGETTI = "rigetti"
92
102
  QBRAID = "qbraid"
@@ -367,7 +377,7 @@ def jobs_list(
367
377
  elif job_status in ["INITIALIZING", "QUEUED", "VALIDATING", "RUNNING"]:
368
378
  status_color = "blue"
369
379
  else:
370
- status_color = "grey"
380
+ status_color = "grey50"
371
381
 
372
382
  job_qrn = job.jobQrn
373
383
  console.print(
@@ -64,6 +64,35 @@ class VisibilityOption(str, Enum):
64
64
  SHARED = "shared"
65
65
 
66
66
 
67
+ # Visibilities a skill owner may set directly. A skill becomes public only
68
+ # through `request-publish` and admin review; the API refuses `public` on
69
+ # create (400) and update (403).
70
+ _SETTABLE_VISIBILITY = (VisibilityOption.PRIVATE, VisibilityOption.SHARED)
71
+ _SETTABLE_VISIBILITY_METAVAR = "<" + "|".join(v.value for v in _SETTABLE_VISIBILITY) + ">"
72
+
73
+
74
+ def _settable_visibility(value: Optional[str]) -> Optional[str]:
75
+ """Validate --visibility on create/update, pointing `public` at request-publish."""
76
+ if value is None:
77
+ return None
78
+ for option in _SETTABLE_VISIBILITY:
79
+ if value.lower() == option.value:
80
+ return option.value
81
+ if value.lower() == VisibilityOption.PUBLIC.value:
82
+ raise typer.BadParameter(
83
+ "skills are made public through review, not --visibility. "
84
+ "Create the skill (private by default), upload it, then run "
85
+ "'qbraid skills request-publish <slug>'."
86
+ )
87
+ choices = ", ".join(f"'{v.value}'" for v in _SETTABLE_VISIBILITY)
88
+ raise typer.BadParameter(f"'{value}' is not one of {choices}.")
89
+
90
+
91
+ def _complete_settable_visibility() -> list[str]:
92
+ """Shell completion for --visibility on create/update."""
93
+ return [v.value for v in _SETTABLE_VISIBILITY]
94
+
95
+
67
96
  # =============================================================================
68
97
  # Core Commands
69
98
  # =============================================================================
@@ -870,8 +899,13 @@ def skills_create(
870
899
  ),
871
900
  version: str = typer.Option("1.0.0", "--version", "-v", help="Skill version"),
872
901
  tags: Optional[str] = typer.Option(None, "--tags", "-t", help="Comma-separated tags"),
873
- visibility: VisibilityOption = typer.Option(
874
- VisibilityOption.PRIVATE, "--visibility", help="Skill visibility"
902
+ visibility: str = typer.Option(
903
+ VisibilityOption.PRIVATE.value,
904
+ "--visibility",
905
+ metavar=_SETTABLE_VISIBILITY_METAVAR,
906
+ callback=_settable_visibility,
907
+ autocompletion=_complete_settable_visibility,
908
+ help="Skill visibility. To publish, use 'qbraid skills request-publish'.",
875
909
  ),
876
910
  directory: Optional[str] = typer.Option(
877
911
  None, "--dir", help="Path to skill directory to upload after creation"
@@ -896,7 +930,7 @@ def skills_create(
896
930
  description=description,
897
931
  version=version,
898
932
  tags=tag_list,
899
- visibility=CoreVisibility(visibility.value),
933
+ visibility=CoreVisibility(visibility),
900
934
  )
901
935
 
902
936
  try:
@@ -985,7 +1019,14 @@ def skills_update(
985
1019
  description: Optional[str] = typer.Option(None, "--description", "-d", help="New description"),
986
1020
  version: Optional[str] = typer.Option(None, "--version", "-v", help="New version"),
987
1021
  tags: Optional[str] = typer.Option(None, "--tags", "-t", help="New comma-separated tags"),
988
- visibility: Optional[VisibilityOption] = typer.Option(None, "--visibility", help="New visibility"),
1022
+ visibility: Optional[str] = typer.Option(
1023
+ None,
1024
+ "--visibility",
1025
+ metavar=_SETTABLE_VISIBILITY_METAVAR,
1026
+ callback=_settable_visibility,
1027
+ autocompletion=_complete_settable_visibility,
1028
+ help="New visibility. To publish, use 'qbraid skills request-publish'.",
1029
+ ),
989
1030
  ) -> None:
990
1031
  """Update skill metadata."""
991
1032
  from qbraid_core.services.skills import SkillsClient
@@ -1002,7 +1043,7 @@ def skills_update(
1002
1043
  description=description,
1003
1044
  version=version,
1004
1045
  tags=tag_list,
1005
- visibility=visibility.value if visibility else None,
1046
+ visibility=visibility,
1006
1047
  )
1007
1048
 
1008
1049
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: qbraid-cli
3
- Version: 0.16.18
3
+ Version: 0.16.19
4
4
  Summary: Command Line Interface for interacting with all parts of the qBraid platform.
5
5
  Author-email: qBraid Development Team <contact@qbraid.com>
6
6
  License-Expression: LicenseRef-Proprietary
@@ -30,11 +30,11 @@ Requires-Dist: typer>=0.12.1
30
30
  Requires-Dist: rich>=10.11.0
31
31
  Requires-Dist: click<=8.5.0
32
32
  Requires-Dist: questionary>=2.0.0
33
- Requires-Dist: qbraid-core>=0.6.45
33
+ Requires-Dist: qbraid-core>=0.6.46
34
34
  Provides-Extra: compute
35
- Requires-Dist: qbraid-core[compute]>=0.6.45; extra == "compute"
35
+ Requires-Dist: qbraid-core[compute]>=0.6.46; extra == "compute"
36
36
  Provides-Extra: envs
37
- Requires-Dist: qbraid-core[environments]>=0.6.45; extra == "envs"
37
+ Requires-Dist: qbraid-core[environments]>=0.6.46; extra == "envs"
38
38
  Provides-Extra: dev
39
39
  Requires-Dist: isort; extra == "dev"
40
40
  Requires-Dist: black; extra == "dev"
@@ -72,4 +72,5 @@ qbraid_cli/skills/app.py
72
72
  qbraid_cli/troubleshoot/__init__.py
73
73
  qbraid_cli/troubleshoot/app.py
74
74
  tests/test_cli_e2e.py
75
+ tests/test_status_colors.py
75
76
  tests/test_version.py
@@ -2,10 +2,10 @@ typer>=0.12.1
2
2
  rich>=10.11.0
3
3
  click<=8.5.0
4
4
  questionary>=2.0.0
5
- qbraid-core>=0.6.45
5
+ qbraid-core>=0.6.46
6
6
 
7
7
  [compute]
8
- qbraid-core[compute]>=0.6.45
8
+ qbraid-core[compute]>=0.6.46
9
9
 
10
10
  [dev]
11
11
  isort
@@ -15,4 +15,4 @@ pytest-cov
15
15
  pytest-asyncio
16
16
 
17
17
  [envs]
18
- qbraid-core[environments]>=0.6.45
18
+ qbraid-core[environments]>=0.6.46
@@ -0,0 +1,157 @@
1
+ # Copyright (c) 2026, qBraid Development Team
2
+ # All rights reserved.
3
+
4
+ """
5
+ Every colour or style the CLI hands to Rich must be one Rich understands.
6
+ Rich silently drops an unknown style, so an invalid name (such as ``"grey"``)
7
+ leaves the text unstyled instead of failing.
8
+
9
+ The test scans every module under ``qbraid_cli`` for:
10
+
11
+ - markup tags in strings that contain a closing tag (``[bold red]...[/bold red]``),
12
+ - string constants assigned to a name ending in ``color`` or ``style``,
13
+ - string values of dict literals assigned to such a name,
14
+ - string defaults of ``.get(...)`` on such a dict,
15
+ - string ``style=`` / ``color=`` keyword arguments.
16
+ """
17
+
18
+ import ast
19
+ import re
20
+ from pathlib import Path
21
+ from unittest.mock import MagicMock, patch
22
+
23
+ import pytest
24
+ import typer.testing
25
+ from rich.console import Console
26
+ from rich.default_styles import DEFAULT_STYLES
27
+ from rich.errors import StyleSyntaxError
28
+ from rich.style import Style
29
+
30
+ import qbraid_cli
31
+ from qbraid_cli.devices.app import devices_app
32
+ from qbraid_cli.jobs.app import jobs_app
33
+
34
+ runner = typer.testing.CliRunner()
35
+ PACKAGE = Path(qbraid_cli.__file__).parent
36
+ MODULES = sorted(PACKAGE.rglob("*.py"))
37
+
38
+ # An opening or closing markup tag such as [bold red] or [/grey50], but not an
39
+ # escaped "\\[n]". Link and action tags and a bare [/] do not match.
40
+ _TAG = re.compile(r"(?<!\\)\[/?([a-z][a-z0-9_ .]*)\]")
41
+ _COLOR_NAME = re.compile(r"(?:^|_)(colou?r|style)s?$", re.IGNORECASE)
42
+
43
+
44
+ def _is_style_name(name: str) -> bool:
45
+ return bool(_COLOR_NAME.search(name))
46
+
47
+
48
+ def _target_name(node: ast.AST) -> str:
49
+ if isinstance(node, ast.Name):
50
+ return node.id
51
+ if isinstance(node, ast.Attribute):
52
+ return node.attr
53
+ if isinstance(node, ast.Subscript):
54
+ return _target_name(node.value)
55
+ return ""
56
+
57
+
58
+ def _strings(node: ast.AST):
59
+ if isinstance(node, ast.Constant) and isinstance(node.value, str):
60
+ yield node.value
61
+ elif isinstance(node, ast.Dict):
62
+ for value in node.values:
63
+ yield from _strings(value)
64
+ elif isinstance(node, ast.IfExp):
65
+ yield from _strings(node.body)
66
+ yield from _strings(node.orelse)
67
+
68
+
69
+ def _styles_in(path: Path):
70
+ tree = ast.parse(path.read_text(encoding="utf-8"))
71
+ for node in ast.walk(tree):
72
+ if isinstance(node, ast.Constant) and isinstance(node.value, str) and "[/" in node.value:
73
+ # Only strings with a closing tag are Rich markup; this skips TOML
74
+ # section names, prompt choices like "[y/n]" and type hints.
75
+ for match in _TAG.finditer(node.value):
76
+ yield node.lineno, match.group(1)
77
+ elif isinstance(node, (ast.Assign, ast.AnnAssign)):
78
+ targets = node.targets if isinstance(node, ast.Assign) else [node.target]
79
+ if node.value is not None and any(_is_style_name(_target_name(t)) for t in targets):
80
+ for value in _strings(node.value):
81
+ yield node.lineno, value
82
+ if isinstance(node.value, ast.Call):
83
+ call = node.value
84
+ if isinstance(call.func, ast.Attribute) and call.func.attr == "get":
85
+ for value in _strings(call.func.value):
86
+ yield node.lineno, value
87
+ for arg in call.args[1:]:
88
+ for value in _strings(arg):
89
+ yield node.lineno, value
90
+ elif isinstance(node, ast.keyword) and node.arg in {"style", "color"}:
91
+ for value in _strings(node.value):
92
+ yield getattr(node.value, "lineno", 0), value
93
+
94
+
95
+ def _invalid(value: str) -> bool:
96
+ if not value or "{" in value or "[" in value: # empty, placeholder, or markup text
97
+ return False
98
+ if value in DEFAULT_STYLES or value.startswith(("link", "@")): # theme name, link, action
99
+ return False
100
+ try:
101
+ Style.parse(value)
102
+ except StyleSyntaxError:
103
+ return True
104
+ return False
105
+
106
+
107
+ def test_scanner_catches_the_grey_regression():
108
+ """The scanner itself flags the colour name that caused #182."""
109
+ assert _invalid("grey")
110
+ assert not _invalid("grey50")
111
+ assert not _invalid("bold bright_black")
112
+
113
+
114
+ @pytest.mark.parametrize("path", MODULES, ids=lambda p: str(p.relative_to(PACKAGE)))
115
+ def test_every_rich_style_parses(path):
116
+ """No module passes Rich a colour or style name it would silently ignore."""
117
+ bad = [f"{path.name}:{line}: {value!r}" for line, value in _styles_in(path) if _invalid(value)]
118
+ assert not bad, "invalid Rich styles:\n" + "\n".join(bad)
119
+
120
+
121
+ def _colour_console(*_args, **_kwargs):
122
+ return Console(force_terminal=True, color_system="256", width=200)
123
+
124
+
125
+ GREY50 = "\x1b[38;5;244m" # grey50 in the 256-colour palette
126
+
127
+
128
+ def test_jobs_list_colours_an_unknown_status_grey():
129
+ """An unrecognised job status is printed in grey50, not left unstyled (#182)."""
130
+ job = MagicMock(jobQrn="qbraid:job:1", timeStamps=None)
131
+ job.status.value = "UNKNOWN"
132
+ client = MagicMock()
133
+ client.list_jobs.return_value = [job]
134
+ with (
135
+ patch("qbraid_core.services.runtime.QuantumRuntimeClient", return_value=client),
136
+ patch("qbraid_cli.jobs.app.run_progress_task", lambda fn, *a, **k: fn()),
137
+ patch("qbraid_cli.jobs.app.Console", _colour_console),
138
+ ):
139
+ result = runner.invoke(jobs_app, ["list"])
140
+ assert result.exit_code == 0, result.output
141
+ assert f"{GREY50}UNKNOWN" in result.output
142
+
143
+
144
+ def test_devices_list_colours_an_unknown_status_grey():
145
+ """An unrecognised device status is printed in grey50, not left unstyled (#182)."""
146
+ device = MagicMock(qrn="qbraid:device:1")
147
+ device.status.value = "RETIRED"
148
+ client = MagicMock()
149
+ client.list_devices.return_value = [device]
150
+ with (
151
+ patch("qbraid_core.services.runtime.QuantumRuntimeClient", return_value=client),
152
+ patch("qbraid_cli.devices.app.run_progress_task", lambda fn, *a, **k: fn()),
153
+ patch("qbraid_cli.devices.app.Console", _colour_console),
154
+ ):
155
+ result = runner.invoke(devices_app, ["list"])
156
+ assert result.exit_code == 0, result.output
157
+ assert f"{GREY50}RETIRED" in result.output
File without changes
File without changes
File without changes