arize-ax-cli 0.35.0__tar.gz → 0.37.0__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 (72) hide show
  1. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/PKG-INFO +4 -2
  2. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/pyproject.toml +9 -1
  3. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/cli.py +7 -1
  4. arize_ax_cli-0.37.0/src/ax/coding_agents.py +229 -0
  5. arize_ax_cli-0.37.0/src/ax/commands/instrument.py +36 -0
  6. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/commands/role_bindings.py +2 -2
  7. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/commands/skills.py +86 -118
  8. arize_ax_cli-0.37.0/src/ax/instrument/__init__.py +315 -0
  9. arize_ax_cli-0.37.0/src/ax/instrument/flow.py +231 -0
  10. arize_ax_cli-0.37.0/src/ax/instrument/launch.py +99 -0
  11. arize_ax_cli-0.37.0/src/ax/instrument/links.py +19 -0
  12. arize_ax_cli-0.37.0/src/ax/instrument/prompt.py +170 -0
  13. arize_ax_cli-0.37.0/src/ax/instrument/selfinstall.py +223 -0
  14. arize_ax_cli-0.37.0/src/ax/instrument/staging.py +205 -0
  15. arize_ax_cli-0.37.0/src/ax/skills_installer.py +100 -0
  16. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/utils/http.py +36 -1
  17. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/version.py +1 -1
  18. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/.gitignore +0 -0
  19. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/LICENSE +0 -0
  20. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/README.md +0 -0
  21. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/__init__.py +0 -0
  22. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/__main__.py +0 -0
  23. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/ascii_art.py +0 -0
  24. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/auth/__init__.py +0 -0
  25. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/auth/bearer.py +0 -0
  26. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/auth/oauth_client.py +0 -0
  27. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/auth/oauth_flow.py +0 -0
  28. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/commands/__init__.py +0 -0
  29. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/commands/ai_integrations.py +0 -0
  30. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/commands/annotation_configs.py +0 -0
  31. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/commands/annotation_queues.py +0 -0
  32. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/commands/api_keys.py +0 -0
  33. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/commands/auth.py +0 -0
  34. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/commands/datasets.py +0 -0
  35. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/commands/evaluators.py +0 -0
  36. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/commands/experiments.py +0 -0
  37. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/commands/integrations.py +0 -0
  38. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/commands/organizations.py +0 -0
  39. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/commands/profiles.py +0 -0
  40. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/commands/projects.py +0 -0
  41. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/commands/prompts.py +0 -0
  42. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/commands/resource_restrictions.py +0 -0
  43. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/commands/roles.py +0 -0
  44. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/commands/spaces.py +0 -0
  45. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/commands/spans.py +0 -0
  46. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/commands/tasks.py +0 -0
  47. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/commands/traces.py +0 -0
  48. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/commands/upgrade.py +0 -0
  49. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/commands/users.py +0 -0
  50. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/config/__init__.py +0 -0
  51. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/config/input_readers.py +0 -0
  52. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/config/manager.py +0 -0
  53. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/config/schema.py +0 -0
  54. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/config/setup.py +0 -0
  55. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/core/__init__.py +0 -0
  56. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/core/client_factory.py +0 -0
  57. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/core/decorators.py +0 -0
  58. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/core/error_formatter.py +0 -0
  59. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/core/exceptions.py +0 -0
  60. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/core/headers.py +0 -0
  61. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/core/output.py +0 -0
  62. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/core/pydantic.py +0 -0
  63. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/utils/__init__.py +0 -0
  64. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/utils/annotations.py +0 -0
  65. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/utils/console.py +0 -0
  66. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/utils/datetime_parse.py +0 -0
  67. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/utils/dotenv.py +0 -0
  68. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/utils/export.py +0 -0
  69. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/utils/file_io.py +0 -0
  70. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/utils/json_source.py +0 -0
  71. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/utils/text_source.py +0 -0
  72. {arize_ax_cli-0.35.0 → arize_ax_cli-0.37.0}/src/ax/utils/upgrade_check.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: arize-ax-cli
3
- Version: 0.35.0
3
+ Version: 0.37.0
4
4
  Summary: Official Arize CLI tool for managing datasets, experiments, and more
5
5
  Project-URL: Homepage, https://arize.com
6
6
  Project-URL: Documentation, https://arize.com/docs/api-clients/cli/
@@ -20,7 +20,8 @@ Classifier: Programming Language :: Python :: 3.13
20
20
  Classifier: Programming Language :: Python :: 3.14
21
21
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
22
  Requires-Python: >=3.11
23
- Requires-Dist: arize==8.53.0
23
+ Requires-Dist: arize==8.56.0
24
+ Requires-Dist: cryptography<45,>=44.0.0
24
25
  Requires-Dist: filelock<4,>=3.12.0
25
26
  Requires-Dist: packaging>=21.0
26
27
  Requires-Dist: pydantic<3,>=2.0.0
@@ -29,6 +30,7 @@ Requires-Dist: requests<3,>=2.31.0
29
30
  Requires-Dist: rich<14,>=13.0.0
30
31
  Requires-Dist: shellingham<2,>=1.5.0
31
32
  Requires-Dist: tomli-w<2,>=1.0.0
33
+ Requires-Dist: truststore<1,>=0.10.0
32
34
  Requires-Dist: typer<1,>=0.12.0
33
35
  Provides-Extra: dev
34
36
  Requires-Dist: mypy==1.19.1; extra == 'dev'
@@ -21,7 +21,8 @@ classifiers = [
21
21
  ]
22
22
  dynamic = ["version"]
23
23
  dependencies = [
24
- "arize==8.53.0",
24
+ "arize==8.56.0",
25
+ "cryptography>=44.0.0, <45",
25
26
  "filelock>=3.12.0, <4", # For concurrent-safe token refresh in OAuth profiles
26
27
  "pydantic>=2.0.0, <3",
27
28
  "questionary>=2.0.0, <3",
@@ -29,6 +30,7 @@ dependencies = [
29
30
  "rich>=13.0.0, <14",
30
31
  "shellingham>=1.5.0, <2", # For shell detection in completion
31
32
  "tomli-w>=1.0.0, <2", # For TOML writing
33
+ "truststore>=0.10.0, <1", # For Windows and macOS certificate stores
32
34
  "typer>=0.12.0, <1",
33
35
  "packaging>=21.0",
34
36
  ]
@@ -52,6 +54,12 @@ Repository = "https://github.com/Arize-ai/arize-ax-cli"
52
54
 
53
55
  [project.scripts]
54
56
  ax = "ax.cli:app"
57
+ # Second name for the same app so `uvx arize-ax-cli <command>` resolves. uvx
58
+ # derives the executable name from the package name, and without this it errors
59
+ # with "An executable named `arize-ax-cli` is not provided by package
60
+ # `arize-ax-cli`". `ax instrument` is the reason this matters: it is the entry
61
+ # point for someone who has nothing installed yet.
62
+ arize-ax-cli = "ax.cli:app"
55
63
 
56
64
  [build-system]
57
65
  requires = ["hatchling>=1.26.0,<2"]
@@ -74,8 +74,14 @@ def main(
74
74
 
75
75
  invoked = ctx.invoked_subcommand
76
76
 
77
+ # `instrument` hands the terminal to a coding agent, and its no-terminal
78
+ # path prints a two-line message that an agent relays to the user. An
79
+ # upgrade notice appended to either is noise at best; appended to the
80
+ # relayed message it is what gets passed on instead of the instruction.
81
+ _NO_UPGRADE_NOTICE = ("upgrade", "instrument")
82
+
77
83
  def _after_command() -> None:
78
- if invoked == "upgrade":
84
+ if invoked in _NO_UPGRADE_NOTICE:
79
85
  return
80
86
  if upgrade_thread is not None:
81
87
  from ax.utils.upgrade_check import PYPI_TIMEOUT
@@ -0,0 +1,229 @@
1
+ """Shared definitions for supported AI coding agents."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import shutil
6
+ import sys
7
+ from dataclasses import dataclass
8
+ from pathlib import Path
9
+
10
+ _ALL_PLATFORMS = frozenset({"darwin", "linux", "win32"})
11
+
12
+
13
+ @dataclass(frozen=True)
14
+ class CodingAgentAdapter:
15
+ """Describe one coding agent's skills and launch integration.
16
+
17
+ Attributes:
18
+ id: Stable identifier and primary executable name.
19
+ slug: Value accepted by ``ax skills --agent``.
20
+ label: Human-readable agent name.
21
+ home_marker: Relative home path that indicates the agent is configured.
22
+ detection_binaries: Executable names that identify an installed agent.
23
+ launch_binaries: Executable names verified for seeded instrumentation.
24
+ global_skills_subdir: Skills path relative to the user's home directory.
25
+ project_skills_subdir: Skills path relative to a project directory.
26
+ platforms: Platform identifiers where the agent integration is supported.
27
+ seeded_handoff_verified: Whether its seeded interactive launch is verified.
28
+ install_url: Installation documentation for launchable agents.
29
+ seed_flag: Flag used to pass a seeded prompt at launch time.
30
+ """
31
+
32
+ id: str
33
+ slug: str
34
+ label: str
35
+ home_marker: str
36
+ detection_binaries: tuple[str, ...]
37
+ launch_binaries: tuple[str, ...]
38
+ global_skills_subdir: str
39
+ project_skills_subdir: str
40
+ platforms: frozenset[str]
41
+ seeded_handoff_verified: bool = False
42
+ install_url: str | None = None
43
+ seed_flag: str | None = None
44
+
45
+ @property
46
+ def supports_instrumentation(self) -> bool:
47
+ """Whether AX can launch this agent with an onboarding prompt."""
48
+ return (
49
+ self.seeded_handoff_verified
50
+ and self.install_url is not None
51
+ and sys.platform in self.platforms
52
+ )
53
+
54
+ @property
55
+ def instrumentation_url(self) -> str:
56
+ """Return the installation URL for an instrumentation-capable agent."""
57
+ if not self.supports_instrumentation or self.install_url is None:
58
+ raise ValueError(f"{self.label} does not support instrumentation")
59
+ return self.install_url
60
+
61
+ def skills_dir(
62
+ self, *, is_global: bool, target_root: Path | None = None
63
+ ) -> Path:
64
+ """Return the directory where this agent reads Arize skills."""
65
+ if is_global:
66
+ return Path.home() / self.global_skills_subdir
67
+ root = target_root if target_root is not None else Path.cwd()
68
+ return root / self.project_skills_subdir
69
+
70
+ def _resolve(self, binaries: tuple[str, ...]) -> str | None:
71
+ """Return the first executable from *binaries* found on PATH."""
72
+ for binary in binaries:
73
+ if path := shutil.which(binary):
74
+ return path
75
+ return None
76
+
77
+ def resolve_detection_binary(self) -> str | None:
78
+ """Return an executable path that establishes the agent is installed."""
79
+ return self._resolve(self.detection_binaries)
80
+
81
+ def resolve_launch_binary(self) -> str | None:
82
+ """Return a verified executable path for seeded instrumentation."""
83
+ return self._resolve(self.launch_binaries)
84
+
85
+ def is_detected(self) -> bool:
86
+ """Return whether the agent has a home marker or executable on PATH."""
87
+ return (
88
+ Path.home() / self.home_marker
89
+ ).exists() or self.resolve_detection_binary() is not None
90
+
91
+ def is_launchable(self) -> bool:
92
+ """Return whether this agent can be launched for instrumentation now."""
93
+ return (
94
+ self.supports_instrumentation
95
+ and self.resolve_launch_binary() is not None
96
+ )
97
+
98
+ def argv(self, binary: str, seed: str) -> list[str]:
99
+ """Return the argv that launches this agent with *seed*."""
100
+ if self.seed_flag:
101
+ return [binary, self.seed_flag, seed]
102
+ return [binary, seed]
103
+
104
+
105
+ CODING_AGENTS: tuple[CodingAgentAdapter, ...] = (
106
+ CodingAgentAdapter(
107
+ "claude",
108
+ "claude-code",
109
+ "Claude Code",
110
+ ".claude",
111
+ ("claude",),
112
+ ("claude",),
113
+ ".claude/skills",
114
+ ".claude/skills",
115
+ _ALL_PLATFORMS,
116
+ True,
117
+ "https://docs.claude.com/en/docs/claude-code",
118
+ ),
119
+ CodingAgentAdapter(
120
+ "codex",
121
+ "codex",
122
+ "Codex",
123
+ ".codex",
124
+ ("codex",),
125
+ ("codex",),
126
+ ".codex/skills",
127
+ ".codex/skills",
128
+ _ALL_PLATFORMS,
129
+ True,
130
+ "https://developers.openai.com/codex/cli",
131
+ ),
132
+ CodingAgentAdapter(
133
+ "cursor-agent",
134
+ "cursor",
135
+ "Cursor",
136
+ ".cursor",
137
+ ("cursor-agent", "cursor"),
138
+ ("cursor-agent",),
139
+ ".cursor/skills",
140
+ ".cursor/skills",
141
+ _ALL_PLATFORMS,
142
+ True,
143
+ "https://docs.cursor.com/en/cli/overview",
144
+ ),
145
+ CodingAgentAdapter(
146
+ "windsurf",
147
+ "windsurf",
148
+ "Windsurf",
149
+ ".windsurf",
150
+ ("windsurf",),
151
+ ("windsurf",),
152
+ ".windsurf/skills",
153
+ ".windsurf/skills",
154
+ _ALL_PLATFORMS,
155
+ ),
156
+ CodingAgentAdapter(
157
+ "copilot",
158
+ "github-copilot",
159
+ "GitHub Copilot",
160
+ ".copilot",
161
+ ("copilot",),
162
+ ("copilot",),
163
+ ".agents/skills",
164
+ ".agents/skills",
165
+ _ALL_PLATFORMS,
166
+ True,
167
+ "https://github.com/features/copilot/cli",
168
+ seed_flag="-i",
169
+ ),
170
+ CodingAgentAdapter(
171
+ "agy",
172
+ "antigravity-cli",
173
+ "Antigravity CLI",
174
+ ".gemini/antigravity-cli",
175
+ ("agy",),
176
+ ("agy",),
177
+ ".gemini/antigravity-cli/skills",
178
+ ".agents/skills",
179
+ _ALL_PLATFORMS,
180
+ True,
181
+ "https://antigravity.google/docs/cli/getting-started",
182
+ seed_flag="-i",
183
+ ),
184
+ )
185
+
186
+
187
+ def agent_slugs() -> tuple[str, ...]:
188
+ """Return the stable command-line slugs in registry order."""
189
+ return tuple(agent.slug for agent in CODING_AGENTS)
190
+
191
+
192
+ def agent_labels() -> tuple[str, ...]:
193
+ """Return human-readable agent names in registry order."""
194
+ return tuple(agent.label for agent in CODING_AGENTS)
195
+
196
+
197
+ def agent_for_slug(slug: str) -> CodingAgentAdapter | None:
198
+ """Return the adapter identified by *slug*, if supported."""
199
+ return next((agent for agent in CODING_AGENTS if agent.slug == slug), None)
200
+
201
+
202
+ def agent_for_label(label: str) -> CodingAgentAdapter | None:
203
+ """Return the adapter identified by *label*, if supported."""
204
+ return next(
205
+ (agent for agent in CODING_AGENTS if agent.label == label), None
206
+ )
207
+
208
+
209
+ def instrumentation_agents() -> tuple[CodingAgentAdapter, ...]:
210
+ """Return adapters with a verified seeded instrumentation handoff."""
211
+ return tuple(
212
+ agent for agent in CODING_AGENTS if agent.supports_instrumentation
213
+ )
214
+
215
+
216
+ def detected_agents(
217
+ agents: tuple[CodingAgentAdapter, ...] = CODING_AGENTS,
218
+ ) -> list[CodingAgentAdapter]:
219
+ """Return installed agents, preserving registry order."""
220
+ return [agent for agent in agents if agent.is_detected()]
221
+
222
+
223
+ def launchable_agents(
224
+ agents: tuple[CodingAgentAdapter, ...] | None = None,
225
+ ) -> list[CodingAgentAdapter]:
226
+ """Return agents that can receive an interactive instrumentation handoff."""
227
+ if agents is None:
228
+ agents = instrumentation_agents()
229
+ return [agent for agent in agents if agent.is_launchable()]
@@ -0,0 +1,36 @@
1
+ """Onboarding command: set up Arize AX tracing with a coding agent."""
2
+
3
+ import typer
4
+
5
+ from ax.core.decorators import handle_errors
6
+
7
+ app = typer.Typer(
8
+ name="instrument",
9
+ help="Set up Arize AX tracing with your coding agent",
10
+ invoke_without_command=True,
11
+ context_settings={"help_option_names": ["--help", "-h"]},
12
+ )
13
+
14
+
15
+ @app.callback(invoke_without_command=True)
16
+ @handle_errors
17
+ def instrument(ctx: typer.Context) -> None:
18
+ """Set up Arize AX tracing with your coding agent.
19
+
20
+ Chooses a coding agent, installs the AX CLI and the Arize skills so the agent
21
+ can use them, then launches it with a guided setup that takes you from Arize
22
+ signup to your first traces.
23
+
24
+ Examples:
25
+ ax instrument
26
+
27
+ uvx arize-ax-cli instrument # with nothing installed yet
28
+ """
29
+ if ctx.invoked_subcommand is not None:
30
+ return
31
+
32
+ from ax.instrument import run
33
+
34
+ code = run()
35
+ if code:
36
+ raise typer.Exit(code)
@@ -43,7 +43,7 @@ def list_role_bindings(
43
43
  str | None,
44
44
  typer.Option(
45
45
  "--user-id",
46
- help="Filter by user ID (global ID)",
46
+ help="Filter by user ID (global ID). For a service key, pass its bot user's ID",
47
47
  ),
48
48
  ] = None,
49
49
  limit: Annotated[
@@ -112,7 +112,7 @@ def create_role_binding(
112
112
  str,
113
113
  typer.Option(
114
114
  "--user-id",
115
- help="Global ID of the user to bind the role to",
115
+ help="Global ID of the user to bind the role to. For a service key, use its bot user's ID",
116
116
  prompt=True,
117
117
  ),
118
118
  ],
@@ -2,7 +2,6 @@
2
2
 
3
3
  import shutil
4
4
  import tempfile
5
- import zipfile
6
5
  from pathlib import Path
7
6
  from typing import Annotated
8
7
 
@@ -11,9 +10,22 @@ import typer
11
10
  from rich.console import Console
12
11
  from rich.table import Table
13
12
 
13
+ from ax.coding_agents import (
14
+ agent_for_label,
15
+ agent_for_slug,
16
+ agent_labels,
17
+ agent_slugs,
18
+ detected_agents,
19
+ )
14
20
  from ax.config.manager import ConfigManager
15
21
  from ax.core.decorators import handle_errors
16
- from ax.core.exceptions import ConfigError, FileIOError, UsageError
22
+ from ax.core.exceptions import ConfigError, UsageError
23
+ from ax.skills_installer import (
24
+ available_skills,
25
+ download_skills,
26
+ extract_skills,
27
+ install_skills,
28
+ )
17
29
  from ax.utils.console import (
18
30
  emphasis,
19
31
  info,
@@ -23,42 +35,15 @@ from ax.utils.console import (
23
35
  text_dimmed,
24
36
  warning,
25
37
  )
26
- from ax.utils.http import download_url
27
-
28
- # NOTE: Downloads from `main` by default. This is intentional for now — the repo
29
- # is internal and skills are just Markdown files. A future improvement would pin
30
- # to a tagged release and verify a checksum before extracting.
31
- # TODO: consider pinning to a tagged release + checksum verification once
32
- # arize-skills adopts a release cadence.
33
- SKILLS_REPO_ZIP = (
34
- "https://github.com/Arize-ai/arize-skills/archive/refs/heads/main.zip"
35
- )
36
- _SKILLS_ZIP_INNER_DIR = "arize-skills-main"
37
-
38
- # agent display name -> (home config dir, binary name, skills subdir)
39
- AGENTS: dict[str, tuple[str, str, str]] = {
40
- "Claude Code": (".claude", "claude", ".claude/skills"),
41
- "Cursor": (".cursor", "cursor", ".cursor/skills"),
42
- "Codex": (".codex", "codex", ".codex/skills"),
43
- "Windsurf": (".windsurf", "windsurf", ".windsurf/skills"),
44
- }
45
-
46
- # CLI slug -> display name (used for --agent option values)
47
- AGENT_SLUGS: dict[str, str] = {
48
- "claude-code": "Claude Code",
49
- "cursor": "Cursor",
50
- "codex": "Codex",
51
- "windsurf": "Windsurf",
52
- }
53
38
 
54
39
  _INSTALL_AGENT_OPTION_HELP = (
55
40
  "Agent to install for (can be repeated). "
56
- f"Valid: {', '.join(AGENT_SLUGS)}. "
41
+ f"Valid: {', '.join(agent_slugs())}. "
57
42
  "Required when using --yes."
58
43
  )
59
44
  _CLEAR_AGENT_OPTION_HELP = (
60
45
  "Agent to clear skills for (can be repeated). "
61
- f"Valid: {', '.join(AGENT_SLUGS)}."
46
+ f"Valid: {', '.join(agent_slugs())}."
62
47
  )
63
48
 
64
49
  app = typer.Typer(
@@ -71,19 +56,35 @@ app = typer.Typer(
71
56
  _console = Console(stderr=True)
72
57
 
73
58
 
59
+ def skills_dir_for(
60
+ agent: str, *, is_global: bool, target_root: Path | None = None
61
+ ) -> Path:
62
+ """Return the skills directory for *agent*.
63
+
64
+ Args:
65
+ agent: Agent display name in the shared coding-agent registry.
66
+ is_global: Install into the home directory rather than a project.
67
+ target_root: Project root, required when *is_global* is False.
68
+
69
+ Returns:
70
+ The directory skills should be written into.
71
+
72
+ Raises:
73
+ UsageError: If *agent* is not a known agent.
74
+ """
75
+ adapter = agent_for_label(agent)
76
+ if adapter is None:
77
+ raise UsageError(f"Unknown agent: {agent}")
78
+ return adapter.skills_dir(is_global=is_global, target_root=target_root)
79
+
80
+
74
81
  def _detect_agents() -> list[str]:
75
82
  """Return agent display names that appear to be installed on this machine."""
76
- detected = []
77
- for name, (home_dir, binary, _) in AGENTS.items():
78
- if (Path.home() / home_dir).exists() or shutil.which(
79
- binary
80
- ) is not None:
81
- detected.append(name)
82
- return detected
83
+ return [agent.label for agent in detected_agents()]
83
84
 
84
85
 
85
86
  def _resolve_agents(
86
- agent_slugs: list[str] | None, yes: bool, detected: list[str]
87
+ requested_slugs: list[str] | None, yes: bool, detected: list[str]
87
88
  ) -> list[str]:
88
89
  """Return the list of agent display names to target.
89
90
 
@@ -91,19 +92,22 @@ def _resolve_agents(
91
92
  If --yes is given without --agent, raises UsageError (unsafe to default to all agents).
92
93
  Otherwise, shows an interactive checkbox with detected agents pre-checked.
93
94
  """
94
- if agent_slugs is not None:
95
- for slug in agent_slugs:
96
- if slug not in AGENT_SLUGS:
97
- valid = ", ".join(AGENT_SLUGS)
95
+ if requested_slugs is not None:
96
+ resolved = []
97
+ for slug in requested_slugs:
98
+ adapter = agent_for_slug(slug)
99
+ if adapter is None:
100
+ valid = ", ".join(agent_slugs())
98
101
  raise UsageError(
99
102
  f"Unknown agent '{slug}'. Valid values: {valid}"
100
103
  )
101
- return [AGENT_SLUGS[slug] for slug in agent_slugs]
104
+ resolved.append(adapter.label)
105
+ return resolved
102
106
 
103
107
  if yes:
104
108
  raise UsageError(
105
109
  "Specify at least one --agent when using --yes "
106
- f"(e.g. --agent claude-code). Valid values: {', '.join(AGENT_SLUGS)}"
110
+ f"(e.g. --agent claude-code). Valid values: {', '.join(agent_slugs())}"
107
111
  )
108
112
 
109
113
  # Interactive checkbox — pre-check detected agents
@@ -112,7 +116,7 @@ def _resolve_agents(
112
116
  info("You can still select agents to install for.")
113
117
  new_line()
114
118
 
115
- all_agent_names = list(AGENTS.keys())
119
+ all_agent_names = agent_labels()
116
120
  try:
117
121
  result: list[str] | None = questionary.checkbox(
118
122
  "Which agents to install skills for?",
@@ -129,7 +133,7 @@ def _resolve_agents(
129
133
  raise UsageError(
130
134
  "Interactive selection requires a TTY. "
131
135
  f"Specify agents non-interactively: --agent claude-code --yes "
132
- f"(valid agents: {', '.join(AGENT_SLUGS)})"
136
+ f"(valid agents: {', '.join(agent_slugs())})"
133
137
  ) from None
134
138
  if result is None:
135
139
  raise typer.Abort()
@@ -159,50 +163,6 @@ def _select_skills(yes: bool, available: list[str]) -> list[str]:
159
163
  return result
160
164
 
161
165
 
162
- def _download_zip(tmp_dir: Path, *, verify: bool = True) -> Path:
163
- """Download the arize-skills zipball to tmp_dir and return the path."""
164
- dest = tmp_dir / "arize-skills.zip"
165
- download_url(SKILLS_REPO_ZIP, dest, timeout=30, verify=verify)
166
- return dest
167
-
168
-
169
- def _extract_zip(zip_path: Path, tmp_dir: Path) -> Path:
170
- """Extract the zipball and return the path to the skills/ subdirectory."""
171
- extract_dir = tmp_dir / "extracted"
172
- try:
173
- with zipfile.ZipFile(zip_path) as zf:
174
- zf.extractall(extract_dir)
175
- except Exception as e:
176
- raise FileIOError(f"Failed to extract skills archive: {e}") from e
177
-
178
- skills_root = extract_dir / _SKILLS_ZIP_INNER_DIR / "skills"
179
- if not skills_root.exists():
180
- raise FileIOError(
181
- f"Unexpected archive structure: skills/ not found inside {_SKILLS_ZIP_INNER_DIR}"
182
- )
183
- return skills_root
184
-
185
-
186
- def _copy_skill(
187
- skill: str, source_root: Path, target_dir: Path, *, force: bool
188
- ) -> bool:
189
- """Copy a skill directory from source_root into target_dir.
190
-
191
- Returns True if the skill was copied, False if skipped (dest exists and force=False).
192
- """
193
- src = source_root / skill
194
- dest = target_dir / skill
195
- if not src.exists():
196
- return False
197
- if dest.exists() and not force:
198
- return False
199
- target_dir.mkdir(parents=True, exist_ok=True)
200
- if dest.exists():
201
- shutil.rmtree(dest)
202
- shutil.copytree(src, dest)
203
- return True
204
-
205
-
206
166
  def _resolve_target_root(
207
167
  global_install: bool, project_dir: Path | None
208
168
  ) -> tuple[bool, Path]:
@@ -295,15 +255,12 @@ def install(
295
255
  tmp_dir = Path(tmp_str)
296
256
 
297
257
  with spinner("Downloading skills from GitHub"):
298
- zip_path = _download_zip(tmp_dir, verify=verify)
258
+ zip_path = download_skills(tmp_dir, verify=verify)
299
259
 
300
260
  with spinner("Extracting skills"):
301
- source_root = _extract_zip(zip_path, tmp_dir)
261
+ source_root = extract_skills(zip_path, tmp_dir)
302
262
 
303
- available_skills = sorted(
304
- d.name for d in source_root.iterdir() if d.is_dir()
305
- )
306
- selected_skills = _select_skills(yes, available_skills)
263
+ selected_skills = _select_skills(yes, available_skills(source_root))
307
264
  if not selected_skills:
308
265
  info("No skills selected. Exiting.")
309
266
  raise typer.Exit()
@@ -314,11 +271,14 @@ def install(
314
271
  results: dict[str, list[str]] = {a: [] for a in selected_agents}
315
272
 
316
273
  for current_agent in selected_agents:
317
- _, _, subdir = AGENTS[current_agent]
318
- target_dir = (
319
- Path.home() / subdir if is_global else target_root / subdir
274
+ adapter = agent_for_label(current_agent)
275
+ if adapter is None:
276
+ raise UsageError(f"Unknown agent: {current_agent}")
277
+ target_dir = adapter.skills_dir(
278
+ is_global=is_global, target_root=target_root
320
279
  )
321
280
  info(f"Installing skills for {current_agent}...")
281
+ to_install: list[str] = []
322
282
 
323
283
  for skill in selected_skills:
324
284
  dest = target_dir / skill
@@ -337,11 +297,17 @@ def install(
337
297
  # --yes without --force: skip existing skills
338
298
  should_copy = False
339
299
 
340
- # Pass force=True: the outer logic already decided to proceed
341
- if should_copy and _copy_skill(
342
- skill, source_root, target_dir, force=True
343
- ):
344
- results[current_agent].append(skill)
300
+ if should_copy:
301
+ to_install.append(skill)
302
+
303
+ results[current_agent] = install_skills(
304
+ adapter,
305
+ is_global=is_global,
306
+ target_root=target_root,
307
+ force=True,
308
+ source_root=source_root,
309
+ skills=to_install,
310
+ )
345
311
 
346
312
  # Summary table
347
313
  new_line()
@@ -407,21 +373,16 @@ def clear(
407
373
 
408
374
  # If --agent is given, validate and use those; otherwise scan all known agents.
409
375
  if agent is not None:
410
- for slug in agent:
411
- if slug not in AGENT_SLUGS:
412
- valid = ", ".join(AGENT_SLUGS)
413
- raise UsageError(
414
- f"Unknown agent '{slug}'. Valid values: {valid}"
415
- )
416
- selected_agents = [AGENT_SLUGS[slug] for slug in agent]
376
+ selected_agents = _resolve_agents(agent, yes=False, detected=[])
417
377
  else:
418
- selected_agents = list(AGENTS.keys())
378
+ selected_agents = list(agent_labels())
419
379
 
420
380
  # Find which skills exist for the selected agents
421
381
  to_remove: dict[str, list[str]] = {}
422
382
  for current_agent in selected_agents:
423
- _, _, subdir = AGENTS[current_agent]
424
- skills_dir = Path.home() / subdir if is_global else target_root / subdir
383
+ skills_dir = skills_dir_for(
384
+ current_agent, is_global=is_global, target_root=target_root
385
+ )
425
386
 
426
387
  found = (
427
388
  sorted(
@@ -460,11 +421,18 @@ def clear(
460
421
 
461
422
  removed: dict[str, list[str]] = {}
462
423
  for current_agent, skill_names in to_remove.items():
463
- _, _, subdir = AGENTS[current_agent]
464
- skills_dir = Path.home() / subdir if is_global else target_root / subdir
424
+ skills_dir = skills_dir_for(
425
+ current_agent, is_global=is_global, target_root=target_root
426
+ )
465
427
  removed[current_agent] = []
466
428
  for skill_name in skill_names:
467
- shutil.rmtree(skills_dir / skill_name)
429
+ # Several agents read project skills from the same `.agents/skills`
430
+ # directory, so by the time a later agent is processed its skills may
431
+ # already have been removed. Still reported against each agent,
432
+ # because each one has genuinely lost them.
433
+ target = skills_dir / skill_name
434
+ if target.is_dir():
435
+ shutil.rmtree(target)
468
436
  removed[current_agent].append(skill_name)
469
437
 
470
438
  # Summary