refactorai-cli 0.3.8__tar.gz → 0.3.9__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 (36) hide show
  1. {refactorai_cli-0.3.8 → refactorai_cli-0.3.9}/PKG-INFO +2 -2
  2. {refactorai_cli-0.3.8 → refactorai_cli-0.3.9}/pyproject.toml +2 -2
  3. {refactorai_cli-0.3.8 → refactorai_cli-0.3.9}/refactorai_cli/__init__.py +1 -1
  4. {refactorai_cli-0.3.8 → refactorai_cli-0.3.9}/refactorai_cli/cloud_rr.py +145 -18
  5. {refactorai_cli-0.3.8 → refactorai_cli-0.3.9}/refactorai_cli/commands/run_cmds.py +34 -0
  6. refactorai_cli-0.3.9/refactorai_cli/commands/toolchains_cmds.py +57 -0
  7. {refactorai_cli-0.3.8 → refactorai_cli-0.3.9}/refactorai_cli/main.py +4 -0
  8. {refactorai_cli-0.3.8 → refactorai_cli-0.3.9}/refactorai_cli.egg-info/PKG-INFO +2 -2
  9. {refactorai_cli-0.3.8 → refactorai_cli-0.3.9}/refactorai_cli.egg-info/SOURCES.txt +2 -1
  10. {refactorai_cli-0.3.8 → refactorai_cli-0.3.9}/refactorai_cli.egg-info/requires.txt +1 -1
  11. {refactorai_cli-0.3.8 → refactorai_cli-0.3.9}/README.md +0 -0
  12. {refactorai_cli-0.3.8 → refactorai_cli-0.3.9}/refactorai_cli/auth.py +0 -0
  13. {refactorai_cli-0.3.8 → refactorai_cli-0.3.9}/refactorai_cli/client.py +0 -0
  14. {refactorai_cli-0.3.8 → refactorai_cli-0.3.9}/refactorai_cli/commands/__init__.py +0 -0
  15. {refactorai_cli-0.3.8 → refactorai_cli-0.3.9}/refactorai_cli/commands/account_cmds.py +0 -0
  16. {refactorai_cli-0.3.8 → refactorai_cli-0.3.9}/refactorai_cli/commands/auth_cmds.py +0 -0
  17. {refactorai_cli-0.3.8 → refactorai_cli-0.3.9}/refactorai_cli/commands/cloud_cmds.py +0 -0
  18. {refactorai_cli-0.3.8 → refactorai_cli-0.3.9}/refactorai_cli/commands/engine_cmds.py +0 -0
  19. {refactorai_cli-0.3.8 → refactorai_cli-0.3.9}/refactorai_cli/commands/model_cmds.py +0 -0
  20. {refactorai_cli-0.3.8 → refactorai_cli-0.3.9}/refactorai_cli/commands/rules_cmds.py +0 -0
  21. {refactorai_cli-0.3.8 → refactorai_cli-0.3.9}/refactorai_cli/commands/runtime_cmds.py +0 -0
  22. {refactorai_cli-0.3.8 → refactorai_cli-0.3.9}/refactorai_cli/commands/runtime_proxy_cmds.py +0 -0
  23. {refactorai_cli-0.3.8 → refactorai_cli-0.3.9}/refactorai_cli/commands/setup_cmds.py +0 -0
  24. {refactorai_cli-0.3.8 → refactorai_cli-0.3.9}/refactorai_cli/control_plane.py +0 -0
  25. {refactorai_cli-0.3.8 → refactorai_cli-0.3.9}/refactorai_cli/credentials.py +0 -0
  26. {refactorai_cli-0.3.8 → refactorai_cli-0.3.9}/refactorai_cli/local_constitution.py +0 -0
  27. {refactorai_cli-0.3.8 → refactorai_cli-0.3.9}/refactorai_cli/local_engine_runtime.py +0 -0
  28. {refactorai_cli-0.3.8 → refactorai_cli-0.3.9}/refactorai_cli/local_paths.py +0 -0
  29. {refactorai_cli-0.3.8 → refactorai_cli-0.3.9}/refactorai_cli/model_policy.py +0 -0
  30. {refactorai_cli-0.3.8 → refactorai_cli-0.3.9}/refactorai_cli/runtime_manager.py +0 -0
  31. {refactorai_cli-0.3.8 → refactorai_cli-0.3.9}/refactorai_cli/settings.py +0 -0
  32. {refactorai_cli-0.3.8 → refactorai_cli-0.3.9}/refactorai_cli/setup_flow.py +0 -0
  33. {refactorai_cli-0.3.8 → refactorai_cli-0.3.9}/refactorai_cli.egg-info/dependency_links.txt +0 -0
  34. {refactorai_cli-0.3.8 → refactorai_cli-0.3.9}/refactorai_cli.egg-info/entry_points.txt +0 -0
  35. {refactorai_cli-0.3.8 → refactorai_cli-0.3.9}/refactorai_cli.egg-info/top_level.txt +0 -0
  36. {refactorai_cli-0.3.8 → refactorai_cli-0.3.9}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: refactorai-cli
3
- Version: 0.3.8
3
+ Version: 0.3.9
4
4
  Summary: Local-first CLI for the refactor platform
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -8,7 +8,7 @@ Requires-Dist: typer>=0.12.0
8
8
  Requires-Dist: httpx>=0.27.0
9
9
  Requires-Dist: rich>=13.7.0
10
10
  Requires-Dist: PyYAML>=6.0.1
11
- Requires-Dist: refactorai-core>=3.0.5
11
+ Requires-Dist: refactorai-core>=3.1.0
12
12
 
13
13
  # refactorai-cli
14
14
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "refactorai-cli"
3
- version = "0.3.8"
3
+ version = "0.3.9"
4
4
  description = "Local-first CLI for the refactor platform"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -12,7 +12,7 @@ dependencies = [
12
12
  "httpx>=0.27.0",
13
13
  "rich>=13.7.0",
14
14
  "PyYAML>=6.0.1",
15
- "refactorai-core>=3.0.5",
15
+ "refactorai-core>=3.1.0",
16
16
  ]
17
17
 
18
18
  [project.scripts]
@@ -5,4 +5,4 @@ the shared `refactor_core` pipeline from a project folder while staying
5
5
  authenticated to the hosted platform via a developer key.
6
6
  """
7
7
 
8
- __version__ = "0.3.8"
8
+ __version__ = "0.3.9"
@@ -50,6 +50,7 @@ from refactor_core.refactor_requests import (
50
50
  rr_test_dir,
51
51
  save_request,
52
52
  )
53
+ from refactor_core.host_toolchain import provision_for_command
53
54
  from refactor_core.store import create_run
54
55
  from refactor_core.testcmd import (
55
56
  _SKIP_DIRS,
@@ -98,7 +99,9 @@ def _read_source(project_root: Path, rel: str) -> str:
98
99
  return ""
99
100
 
100
101
 
101
- def _run_test(project_root: Path, test_command: str | None) -> tuple[bool, str]:
102
+ def _run_test(
103
+ project_root: Path, test_command: str | None, *, env: dict | None = None
104
+ ) -> tuple[bool, str]:
102
105
  """Run the configured test command on the host; (passed, detail).
103
106
 
104
107
  Cloud runs execute tests client-side because the developer's code + deps live
@@ -106,6 +109,9 @@ def _run_test(project_root: Path, test_command: str | None) -> tuple[bool, str]:
106
109
  command is configured we return ``(False, ...)`` so the server defers the RR
107
110
  rather than applying an unverifiable change. This differs from local's
108
111
  permissive skip on purpose -- cloud never applies an unverified change.
112
+
113
+ ``env`` optionally overrides the process environment (e.g. a managed host
114
+ toolchain prepended to ``PATH``); when None the inherited environment is used.
109
115
  """
110
116
  if not test_command or not str(test_command).strip():
111
117
  return False, "no test command configured; cannot verify behavior preservation"
@@ -120,6 +126,7 @@ def _run_test(project_root: Path, test_command: str | None) -> tuple[bool, str]:
120
126
  capture_output=True,
121
127
  text=True,
122
128
  timeout=600,
129
+ env=env,
123
130
  )
124
131
  except (subprocess.SubprocessError, OSError) as exc:
125
132
  return False, f"test command error: {exc}"
@@ -128,31 +135,132 @@ def _run_test(project_root: Path, test_command: str | None) -> tuple[bool, str]:
128
135
  return False, (proc.stdout or proc.stderr or "")[-500:]
129
136
 
130
137
 
131
- def _client_preflight_command(project_root: Path, command: str | None) -> bool:
138
+ def _leading_binary(command: str | None) -> str | None:
139
+ """Return the leading executable of a simple command, or None.
140
+
141
+ Returns None for composite/shell commands (``&&``, subshells, pipes) that
142
+ can't be reduced to a single binary, and for env-only prefixes.
143
+ """
144
+ if not command or not str(command).strip():
145
+ return None
146
+ if any(op in command for op in ("&&", "||", ";", "|", "(", ")")):
147
+ return None
148
+ try:
149
+ tokens = shlex.split(command, posix=True)
150
+ except ValueError:
151
+ return None
152
+ while tokens and _ENV_ASSIGN_RE.match(tokens[0]):
153
+ tokens.pop(0)
154
+ if not tokens:
155
+ return None
156
+ return tokens[0]
157
+
158
+
159
+ def _client_preflight_command(
160
+ project_root: Path, command: str | None, *, env: dict | None = None
161
+ ) -> bool:
132
162
  """Return True when ``command`` looks runnable on this host.
133
163
 
134
164
  Composite/shell commands (``&&``, subshells, pipes) run under ``shell=True``
135
165
  and can't be reduced to one binary, so we trust them and let the real exit
136
166
  code gate. Simple commands are validated by checking the leading binary is on
137
167
  PATH — this guards against running (and charging for) a server-suggested
138
- command whose toolchain isn't installed.
168
+ command whose toolchain isn't installed. ``env`` optionally supplies the
169
+ PATH to check against (e.g. after a managed toolchain is provisioned).
139
170
  """
140
171
  if not command or not str(command).strip():
141
172
  return False
142
173
  if any(op in command for op in ("&&", "||", ";", "|", "(", ")")):
143
174
  return True
144
- try:
145
- tokens = shlex.split(command, posix=True)
146
- except ValueError:
175
+ binary = _leading_binary(command)
176
+ if not binary:
147
177
  return False
148
- while tokens and _ENV_ASSIGN_RE.match(tokens[0]):
149
- tokens.pop(0)
150
- if not tokens:
151
- return False
152
- binary = tokens[0]
153
178
  if "/" in binary:
154
179
  return Path(binary).expanduser().exists()
155
- return shutil.which(binary) is not None
180
+ search_path = (env or {}).get("PATH") if env else None
181
+ return shutil.which(binary, path=search_path) is not None
182
+
183
+
184
+ def _managed_toolchain_enabled(config: dict) -> bool:
185
+ """Whether managed host-toolchain provisioning is enabled (default on).
186
+
187
+ Reads ``verification.managed_toolchain`` from the project config; absent =>
188
+ enabled, so cloud modes provision runtimes for the developer by default.
189
+ """
190
+ verification = (config or {}).get("verification")
191
+ if isinstance(verification, dict) and "managed_toolchain" in verification:
192
+ return bool(verification.get("managed_toolchain"))
193
+ return True
194
+
195
+
196
+ def _provision_toolchain(
197
+ project_root: Path,
198
+ test_command: str | None,
199
+ config: dict,
200
+ *,
201
+ consent_cb: Callable[[dict], bool] | None,
202
+ progress_cb: Callable[[dict], None] | None,
203
+ ) -> tuple[dict | None, str]:
204
+ """Provision a managed runtime for ``test_command`` when it's missing locally.
205
+
206
+ Returns ``(env, note)``. ``env`` (with the toolchain on ``PATH``) is returned
207
+ only when a runtime was actually provisioned; otherwise ``None`` (the caller
208
+ then runs with the inherited environment). No-ops when the command is already
209
+ runnable, has no managed runtime, or provisioning is disabled/declined.
210
+ """
211
+ if not test_command or not _managed_toolchain_enabled(config):
212
+ return None, ""
213
+ if _client_preflight_command(project_root, test_command):
214
+ return None, "" # already runnable on the host
215
+ binary = _leading_binary(test_command)
216
+ if not binary:
217
+ return None, ""
218
+ from refactor_core.host_toolchain import binary_to_runtime, guidance_for_binary
219
+
220
+ runtime = binary_to_runtime(binary)
221
+ if runtime is None:
222
+ # No self-provisionable runtime -> Tier 3 guided-install guidance so the
223
+ # developer gets an actionable message instead of a silent defer.
224
+ guidance = guidance_for_binary(binary)
225
+ if guidance:
226
+ return None, f"'{binary}' is not installed and cannot be auto-provisioned. {guidance}"
227
+ return None, ""
228
+
229
+ if consent_cb is not None:
230
+ approved = bool(consent_cb({"binary": binary, "runtime": runtime}))
231
+ if not approved:
232
+ return None, f"managed toolchain for '{binary}' declined; skipping provisioning."
233
+
234
+ def _on_progress(msg: str) -> None:
235
+ _emit(progress_cb, phase="rr", event="toolchain_provisioning", detail=msg)
236
+
237
+ env, note = provision_for_command(binary, on_progress=_on_progress)
238
+ if env is None:
239
+ return None, note
240
+ _emit(progress_cb, phase="rr", event="toolchain_ready", runtime=runtime)
241
+ _restore_dependencies(project_root, runtime, env, progress_cb)
242
+ return env, note
243
+
244
+
245
+ def _restore_dependencies(
246
+ project_root: Path, runtime: str, env: dict, progress_cb: Callable[[dict], None] | None
247
+ ) -> None:
248
+ """Restore project dependencies with the provisioned toolchain (best effort).
249
+
250
+ Mirrors the sandbox dependency-restore step so the test command has its deps
251
+ present. Failures are non-fatal: the test run surfaces the real error.
252
+ """
253
+ if runtime == "node" and (project_root / "package.json").is_file():
254
+ _emit(progress_cb, phase="rr", event="toolchain_provisioning", detail="npm install")
255
+ _run_test(project_root, "npm install", env=env)
256
+ elif runtime == "python":
257
+ if (project_root / "requirements.txt").is_file():
258
+ _emit(progress_cb, phase="rr", event="toolchain_provisioning",
259
+ detail="pip install -r requirements.txt")
260
+ _run_test(project_root, "python -m pip install -r requirements.txt", env=env)
261
+ elif (project_root / "pyproject.toml").is_file() or (project_root / "setup.py").is_file():
262
+ _emit(progress_cb, phase="rr", event="toolchain_provisioning", detail="pip install -e .")
263
+ _run_test(project_root, "python -m pip install -e .", env=env)
156
264
 
157
265
 
158
266
  def _collect_test_manifests(
@@ -410,6 +518,7 @@ def run_cloud_refactor_requests(
410
518
  progress_cb: Callable[[dict], None] | None = None,
411
519
  approval_cb: Callable[[dict], bool] | None = None,
412
520
  apply_byok_payload: Callable[[dict, object], None] | None = None,
521
+ toolchain_consent_cb: Callable[[dict], bool] | None = None,
413
522
  ) -> RunArtifact:
414
523
  """Drive pending RRs through the cloud server-run loop and return a summary.
415
524
 
@@ -417,6 +526,8 @@ def run_cloud_refactor_requests(
417
526
  (``_rr_progress_logger`` / ``_rr_approval_prompt``), so the run streams the
418
527
  same events and prompts per RR mid-run (FR8). ``apply_byok_payload`` is the
419
528
  shared BYOK resolver injected by the caller to avoid a circular import.
529
+ ``toolchain_consent_cb`` gates first-run managed-toolchain provisioning; when
530
+ None, provisioning proceeds without prompting (e.g. ``--auto-approve``).
420
531
  """
421
532
  project_root = Path(project_root)
422
533
  progress_cb = progress_cb or (lambda e: None)
@@ -434,6 +545,18 @@ def run_cloud_refactor_requests(
434
545
  apply_byok_payload=apply_byok_payload,
435
546
  )
436
547
 
548
+ # Managed host toolchain: when the resolved command's runtime is missing from
549
+ # the host PATH, download a pinned runtime into the central store and run
550
+ # tests with it (no container, no system changes). ``toolchain_env`` is None
551
+ # when nothing was provisioned (already runnable / no managed runtime).
552
+ toolchain_env, toolchain_note = _provision_toolchain(
553
+ project_root,
554
+ test_command,
555
+ config,
556
+ consent_cb=toolchain_consent_cb,
557
+ progress_cb=progress_cb,
558
+ )
559
+
437
560
  if requests is None:
438
561
  requests = pending_requests(project_root)
439
562
 
@@ -451,6 +574,8 @@ def run_cloud_refactor_requests(
451
574
  notes: list[str] = []
452
575
  if testcmd_note:
453
576
  notes.append(testcmd_note)
577
+ if toolchain_note:
578
+ notes.append(toolchain_note)
454
579
  stopped = False
455
580
  stop_reason = ""
456
581
  model_id = resolved_model
@@ -534,9 +659,10 @@ def run_cloud_refactor_requests(
534
659
  current_rr_id = action.get("rr_id", "") or current_rr_id
535
660
  _emit(progress_cb, phase="rr", event="test_generating", rr_id=current_rr_id)
536
661
  _write_generated_test(project_root, current_rr_id, action, by_id)
537
- passed, detail = _run_test(project_root, test_command)
662
+ passed, detail = _run_test(project_root, test_command, env=toolchain_env)
538
663
  _emit(progress_cb, phase="rr", event="baseline_test", rr_id=current_rr_id,
539
- passed=passed, detail=detail, execution_env="host")
664
+ passed=passed, detail=detail,
665
+ execution_env="host+toolchain" if toolchain_env else "host")
540
666
  action = session.step(
541
667
  _step_payload(token, current_rr_id, "baseline_result", by_id, project_root,
542
668
  baseline_passed=passed, baseline_detail=detail)
@@ -585,7 +711,7 @@ def run_cloud_refactor_requests(
585
711
  current_rr_id = action.get("rr_id", "") or current_rr_id
586
712
  diff_text = _PENDING_DIFF.get(current_rr_id, "")
587
713
  passed, detail, files = _apply_and_verify(
588
- project_root, run_store.run_dir, diff_text, test_command
714
+ project_root, run_store.run_dir, diff_text, test_command, env=toolchain_env
589
715
  )
590
716
  if passed:
591
717
  _emit(progress_cb, phase="rr", event="rr_applied", rr_id=current_rr_id, files=files)
@@ -661,13 +787,14 @@ def _write_generated_test(project_root: Path, rr_id: str, action: dict, by_id: d
661
787
 
662
788
 
663
789
  def _apply_and_verify(
664
- project_root: Path, run_dir: Path, diff_text: str, test_command
790
+ project_root: Path, run_dir: Path, diff_text: str, test_command, *, env: dict | None = None
665
791
  ) -> tuple[bool, str, list[str]]:
666
792
  """Apply the diff (with backup), run the test; revert on red.
667
793
 
668
794
  Returns ``(passed, detail, changed_files)``. ``changed_files`` is computed
669
795
  from the diff BEFORE applying (the tree is mutated in place afterward, so it
670
- cannot be recomputed against the modified files).
796
+ cannot be recomputed against the modified files). ``env`` optionally supplies
797
+ the managed-toolchain environment used to run the test.
671
798
  """
672
799
  if not diff_text:
673
800
  return False, "empty diff", []
@@ -682,7 +809,7 @@ def _apply_and_verify(
682
809
  apply_changes(project_root, run_dir, changes)
683
810
  except Exception as exc:
684
811
  return False, f"apply failed: {exc}", changed_files
685
- passed, detail = _run_test(project_root, test_command)
812
+ passed, detail = _run_test(project_root, test_command, env=env)
686
813
  if not passed:
687
814
  try:
688
815
  revert_from_backup(project_root, run_dir)
@@ -460,6 +460,29 @@ def _rr_approval_prompt(*, auto_approve: bool) -> Callable[[dict], bool]:
460
460
  return _ask
461
461
 
462
462
 
463
+ def _toolchain_consent_prompt(*, auto_approve: bool) -> Callable[[dict], bool]:
464
+ """First-run consent for downloading a managed language runtime.
465
+
466
+ Managed toolchains are downloaded into the central store (``~/.refactor``),
467
+ never system paths, so this is low-risk; we still confirm once per run before
468
+ fetching. ``--auto-approve`` and non-interactive terminals proceed silently.
469
+ """
470
+
471
+ def _ask(info: dict) -> bool:
472
+ binary = str(info.get("binary", "?"))
473
+ runtime = str(info.get("runtime", "?"))
474
+ if auto_approve or not sys.stdin.isatty():
475
+ return True
476
+ console.print(
477
+ f"[dim]'{binary}' was not found on your PATH. refactor can download a "
478
+ f"pinned {runtime} runtime into ~/.refactor (no system changes, no container).[/dim]"
479
+ )
480
+ raw = typer.prompt("Download managed toolchain? (Y/n)", default="Y")
481
+ return raw.strip().lower() in {"", "y", "yes"}
482
+
483
+ return _ask
484
+
485
+
463
486
  def _rr_progress_logger(status=None) -> Callable[[dict], None]:
464
487
  """Render the per-RR interactive flow with clear, dynamic messages."""
465
488
 
@@ -482,6 +505,16 @@ def _rr_progress_logger(status=None) -> Callable[[dict], None]:
482
505
  f"[bold cyan]code:[/bold cyan] running in sandbox: [dim]{cmd}[/dim] "
483
506
  f"(container={container or '?'})"
484
507
  )
508
+ elif ev == "toolchain_provisioning":
509
+ detail = str(event.get("detail", "") or "")
510
+ if status:
511
+ status.update(f"[cyan]code[/cyan] provisioning toolchain: {detail}")
512
+ console.print(f"[dim] toolchain: {detail}[/dim]")
513
+ elif ev == "toolchain_ready":
514
+ console.print(
515
+ f"[green] toolchain ready:[/green] {event.get('runtime', '?')} "
516
+ "(managed; no container required)"
517
+ )
485
518
  elif ev == "rr_start":
486
519
  if status:
487
520
  status.update(f"[cyan]code[/cyan] working on {event.get('location', '?')}...")
@@ -2211,6 +2244,7 @@ def code(
2211
2244
  progress_cb=_rr_progress_logger(status=status),
2212
2245
  approval_cb=_rr_approval_prompt(auto_approve=auto_approve),
2213
2246
  apply_byok_payload=_apply_byok_payload,
2247
+ toolchain_consent_cb=_toolchain_consent_prompt(auto_approve=auto_approve),
2214
2248
  )
2215
2249
  else:
2216
2250
  # Local mode is unchanged: dispatch to the local executor with the
@@ -0,0 +1,57 @@
1
+ """Managed host-toolchain commands: inspect and prune provisioned runtimes.
2
+
3
+ Managed toolchains are pinned language runtimes (Node/Python/Go) downloaded into
4
+ the central store (``~/.refactor/toolchains``) so cloud modes can run tests on
5
+ the host without a container. These commands let developers see and clean up
6
+ what has been provisioned.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ import typer
12
+ from rich.console import Console
13
+ from rich.table import Table
14
+
15
+ from refactor_core import host_toolchain as ht
16
+
17
+ console = Console()
18
+ app = typer.Typer(help="Inspect and manage managed language toolchains.")
19
+
20
+
21
+ @app.command("list")
22
+ def list_toolchains() -> None:
23
+ """List runtimes provisioned into the central store."""
24
+ installed = ht.list_installed()
25
+ if not installed:
26
+ console.print("[dim]No managed toolchains provisioned.[/dim]")
27
+ return
28
+ table = Table(title="Managed toolchains")
29
+ table.add_column("runtime")
30
+ table.add_column("version")
31
+ table.add_column("platform")
32
+ table.add_column("path", overflow="fold")
33
+ for entry in installed:
34
+ table.add_row(entry["runtime"], entry["version"], entry["platform"], entry["path"])
35
+ console.print(table)
36
+
37
+
38
+ @app.command("prune")
39
+ def prune_toolchains(
40
+ runtime: str = typer.Option(
41
+ None, "--runtime", help="Only remove this runtime (e.g. node, python, go)."
42
+ ),
43
+ yes: bool = typer.Option(False, "--yes", "-y", help="Skip confirmation."),
44
+ ) -> None:
45
+ """Remove provisioned toolchains to reclaim disk space."""
46
+ target = runtime or "all managed toolchains"
47
+ if not yes:
48
+ confirm = typer.prompt(f"Remove {target}? (y/N)", default="N")
49
+ if confirm.strip().lower() not in {"y", "yes"}:
50
+ console.print("[dim]Aborted.[/dim]")
51
+ raise typer.Exit(code=0)
52
+ removed = ht.prune(runtime=runtime)
53
+ if not removed:
54
+ console.print("[dim]Nothing to remove.[/dim]")
55
+ return
56
+ for path in removed:
57
+ console.print(f"[green]removed[/green] {path}")
@@ -17,6 +17,7 @@ from refactorai_cli.commands import (
17
17
  runtime_cmds,
18
18
  runtime_proxy_cmds,
19
19
  setup_cmds,
20
+ toolchains_cmds,
20
21
  )
21
22
 
22
23
  app = typer.Typer(
@@ -130,6 +131,9 @@ app.add_typer(model_cmds.app, name="model")
130
131
  # Cloud (BYOK) credential management (R20).
131
132
  app.add_typer(cloud_cmds.app, name="cloud")
132
133
 
134
+ # Managed host toolchains (R24 Phase 2).
135
+ app.add_typer(toolchains_cmds.app, name="toolchains")
136
+
133
137
 
134
138
  if __name__ == "__main__":
135
139
  app()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: refactorai-cli
3
- Version: 0.3.8
3
+ Version: 0.3.9
4
4
  Summary: Local-first CLI for the refactor platform
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -8,7 +8,7 @@ Requires-Dist: typer>=0.12.0
8
8
  Requires-Dist: httpx>=0.27.0
9
9
  Requires-Dist: rich>=13.7.0
10
10
  Requires-Dist: PyYAML>=6.0.1
11
- Requires-Dist: refactorai-core>=3.0.5
11
+ Requires-Dist: refactorai-core>=3.1.0
12
12
 
13
13
  # refactorai-cli
14
14
 
@@ -30,4 +30,5 @@ refactorai_cli/commands/rules_cmds.py
30
30
  refactorai_cli/commands/run_cmds.py
31
31
  refactorai_cli/commands/runtime_cmds.py
32
32
  refactorai_cli/commands/runtime_proxy_cmds.py
33
- refactorai_cli/commands/setup_cmds.py
33
+ refactorai_cli/commands/setup_cmds.py
34
+ refactorai_cli/commands/toolchains_cmds.py
@@ -2,4 +2,4 @@ typer>=0.12.0
2
2
  httpx>=0.27.0
3
3
  rich>=13.7.0
4
4
  PyYAML>=6.0.1
5
- refactorai-core>=3.0.5
5
+ refactorai-core>=3.1.0
File without changes
File without changes