refactorai-cli 0.7.8__tar.gz → 0.7.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 (53) hide show
  1. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/PKG-INFO +2 -2
  2. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/pyproject.toml +2 -2
  3. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/__init__.py +1 -1
  4. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/cloud_rr.py +74 -15
  5. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli.egg-info/PKG-INFO +2 -2
  6. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli.egg-info/requires.txt +1 -1
  7. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/README.md +0 -0
  8. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/auth.py +0 -0
  9. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/client.py +0 -0
  10. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/commands/__init__.py +0 -0
  11. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/commands/account_cmds.py +0 -0
  12. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/commands/auth_cmds.py +0 -0
  13. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/commands/branch_cmds.py +0 -0
  14. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/commands/cloud_cmds.py +0 -0
  15. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/commands/engine_cmds.py +0 -0
  16. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/commands/hook_cmds.py +0 -0
  17. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/commands/model_cmds.py +0 -0
  18. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/commands/policy_cmds.py +0 -0
  19. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/commands/pre_push_cmds.py +0 -0
  20. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/commands/request_cmds.py +0 -0
  21. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/commands/rules_cmds.py +0 -0
  22. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/commands/run_cmds.py +0 -0
  23. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/commands/runtime_cmds.py +0 -0
  24. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/commands/runtime_proxy_cmds.py +0 -0
  25. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/commands/setup_cmds.py +0 -0
  26. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/commands/toolchains_cmds.py +0 -0
  27. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/commands/watch_cmds.py +0 -0
  28. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/commands/workspace_cmds.py +0 -0
  29. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/commit_queue.py +0 -0
  30. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/commit_telemetry.py +0 -0
  31. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/control_plane.py +0 -0
  32. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/credentials.py +0 -0
  33. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/dotenv_loader.py +0 -0
  34. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/git_scope.py +0 -0
  35. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/local_constitution.py +0 -0
  36. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/local_engine_runtime.py +0 -0
  37. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/local_paths.py +0 -0
  38. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/main.py +0 -0
  39. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/model_policy.py +0 -0
  40. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/pre_push_gate.py +0 -0
  41. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/refactor_branch_store.py +0 -0
  42. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/review_runner.py +0 -0
  43. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/runtime_manager.py +0 -0
  44. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/settings.py +0 -0
  45. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/setup_flow.py +0 -0
  46. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/watch_ledger.py +0 -0
  47. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/watch_state.py +0 -0
  48. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli/watch_supervisor.py +0 -0
  49. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli.egg-info/SOURCES.txt +0 -0
  50. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli.egg-info/dependency_links.txt +0 -0
  51. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli.egg-info/entry_points.txt +0 -0
  52. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/refactorai_cli.egg-info/top_level.txt +0 -0
  53. {refactorai_cli-0.7.8 → refactorai_cli-0.7.9}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: refactorai-cli
3
- Version: 0.7.8
3
+ Version: 0.7.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.2.19
11
+ Requires-Dist: refactorai-core>=3.2.20
12
12
 
13
13
  # refactorai-cli
14
14
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "refactorai-cli"
3
- version = "0.7.8"
3
+ version = "0.7.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.2.19",
15
+ "refactorai-core>=3.2.20",
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.7.8"
8
+ __version__ = "0.7.9"
@@ -328,6 +328,20 @@ def _missing_binaries(command: str | None, *, env: dict | None = None) -> list[s
328
328
  return [b for b in _required_binaries(command) if not _binary_on_path(b, env=env)]
329
329
 
330
330
 
331
+ def _command_runtimes(command: str | None) -> list[str]:
332
+ """Managed runtime ids implied by the command's required binaries."""
333
+ if not command:
334
+ return []
335
+ from refactor_core.host_toolchain import binary_to_runtime
336
+
337
+ out: list[str] = []
338
+ for binary in _required_binaries(command):
339
+ runtime = binary_to_runtime(binary)
340
+ if runtime and runtime not in out:
341
+ out.append(runtime)
342
+ return out
343
+
344
+
331
345
  def _normalize_command_interpreters(command: str | None, *, env: dict | None = None) -> str | None:
332
346
  """Rewrite a bare ``python`` command token to ``python3`` when needed.
333
347
 
@@ -521,12 +535,12 @@ def _provision_toolchain(
521
535
  ) -> tuple[dict | None, str]:
522
536
  """Provision managed runtimes for every missing binary in ``test_command``.
523
537
 
524
- Returns ``(env, note)``. ``env`` (with the toolchain(s) on ``PATH``) is
525
- returned only when at least one runtime was actually provisioned; otherwise
526
- ``None`` (the caller runs with the inherited environment). Composite commands
527
- are handled per segment so a monorepo runner like ``cd client && npm test &&
528
- cd server && pytest`` provisions BOTH node and python. No-ops when the command
529
- is already runnable, has no managed runtime, or provisioning is disabled.
538
+ Returns ``(env, note)``. ``env`` (with provisioned toolchain(s) on ``PATH``)
539
+ is returned only when at least one runtime was provisioned; otherwise
540
+ ``None`` (caller uses inherited env). Composite commands are handled per
541
+ segment so e.g. ``cd client && npm test && cd server && pytest`` can
542
+ provision BOTH node and python. Dependency restore is run-level and handled
543
+ by the caller after provisioning.
530
544
  """
531
545
  if not test_command or not _managed_toolchain_enabled(config):
532
546
  return None, ""
@@ -570,10 +584,6 @@ def _provision_toolchain(
570
584
  continue
571
585
  _emit(progress_cb, phase="rr", event="toolchain_ready", runtime=runtime)
572
586
  merged_env = _merge_toolchain_env(merged_env, env)
573
- _restore_dependencies(
574
- execution_root, runtime, merged_env, progress_cb,
575
- config=config, dep_locator_cb=dep_locator_cb,
576
- )
577
587
 
578
588
  return merged_env, " ".join(n for n in notes if n).strip()
579
589
 
@@ -1607,10 +1617,18 @@ def run_cloud_refactor_requests(
1607
1617
  if toolchain_note:
1608
1618
  notes.append(toolchain_note)
1609
1619
 
1610
- if not requests:
1611
- return _build_artifact(
1612
- run_store, run_id, constitution, model_id, outcomes, counts,
1613
- notes, stopped=False, stop_reason="", test_command=test_command,
1620
+ # Run-level dependency preflight: always attempt dependency restoration for
1621
+ # runtimes implied by the configured test command, even when binaries are
1622
+ # already present on PATH. This prevents import-time baseline failures from
1623
+ # deferring requests one-by-one later in the loop.
1624
+ for runtime in _command_runtimes(test_command):
1625
+ _restore_dependencies(
1626
+ execution_root,
1627
+ runtime,
1628
+ toolchain_env,
1629
+ progress_cb,
1630
+ config=config,
1631
+ dep_locator_cb=_dep_locator,
1614
1632
  )
1615
1633
 
1616
1634
  # Fail-fast: if a test command is configured but STILL not runnable after
@@ -1642,6 +1660,43 @@ def run_cloud_refactor_requests(
1642
1660
  notes, stopped=True, stop_reason=reason, test_command=test_command,
1643
1661
  )
1644
1662
 
1663
+ # Run-level baseline characterization: execute ONCE and reuse for all RR
1664
+ # steps. If baseline is red, stop the run before opening the RR session so
1665
+ # requests are not deferred one-by-one for dependency/env failures.
1666
+ baseline_ok, baseline_detail = _run_test(execution_root, test_command, env=toolchain_env)
1667
+ _emit(
1668
+ progress_cb,
1669
+ phase="rr",
1670
+ event="baseline_test",
1671
+ rr_id="",
1672
+ passed=baseline_ok,
1673
+ detail=baseline_detail,
1674
+ execution_env="host+toolchain" if toolchain_env else "host",
1675
+ )
1676
+ if not baseline_ok:
1677
+ reason = (
1678
+ "baseline characterization test is not green. "
1679
+ f"Fix test/dependency issues, then retry. Detail: {baseline_detail}"
1680
+ )
1681
+ _emit(
1682
+ progress_cb,
1683
+ phase="rr",
1684
+ event="preflight_failed",
1685
+ reason=reason,
1686
+ test_command=test_command or "",
1687
+ )
1688
+ notes.append(reason)
1689
+ return _build_artifact(
1690
+ run_store, run_id, constitution, model_id, outcomes, counts,
1691
+ notes, stopped=True, stop_reason=reason, test_command=test_command,
1692
+ )
1693
+
1694
+ if not requests:
1695
+ return _build_artifact(
1696
+ run_store, run_id, constitution, model_id, outcomes, counts,
1697
+ notes, stopped=False, stop_reason="", test_command=test_command,
1698
+ )
1699
+
1645
1700
  session = _Session(
1646
1701
  auth_ctx=auth_ctx,
1647
1702
  execution_mode=execution_mode,
@@ -1704,6 +1759,10 @@ def run_cloud_refactor_requests(
1704
1759
 
1705
1760
  guard = 0
1706
1761
  max_iters = max(50, len(requests) * 25)
1762
+ # Cache the single run-level baseline result and reuse it whenever the
1763
+ # server asks for `run_baseline_test` for a specific RR.
1764
+ cached_baseline: tuple[bool, str] = (baseline_ok, baseline_detail)
1765
+
1707
1766
  while guard < max_iters:
1708
1767
  guard += 1
1709
1768
  act = str(action.get("action", ""))
@@ -1716,7 +1775,7 @@ def run_cloud_refactor_requests(
1716
1775
  current_rr_id = action.get("rr_id", "") or current_rr_id
1717
1776
  _emit(progress_cb, phase="rr", event="test_generating", rr_id=current_rr_id)
1718
1777
  _write_generated_test(project_root, current_rr_id, action, by_id)
1719
- passed, detail = _run_test(execution_root, test_command, env=toolchain_env)
1778
+ passed, detail = cached_baseline
1720
1779
  _emit(progress_cb, phase="rr", event="baseline_test", rr_id=current_rr_id,
1721
1780
  passed=passed, detail=detail,
1722
1781
  execution_env="host+toolchain" if toolchain_env else "host")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: refactorai-cli
3
- Version: 0.7.8
3
+ Version: 0.7.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.2.19
11
+ Requires-Dist: refactorai-core>=3.2.20
12
12
 
13
13
  # refactorai-cli
14
14
 
@@ -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.2.19
5
+ refactorai-core>=3.2.20
File without changes
File without changes