refactorai-cli 0.2.8__tar.gz → 0.2.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.
- {refactorai_cli-0.2.8 → refactorai_cli-0.2.9}/PKG-INFO +1 -1
- {refactorai_cli-0.2.8 → refactorai_cli-0.2.9}/pyproject.toml +1 -1
- {refactorai_cli-0.2.8 → refactorai_cli-0.2.9}/refactorai_cli/__init__.py +1 -1
- {refactorai_cli-0.2.8 → refactorai_cli-0.2.9}/refactorai_cli/commands/run_cmds.py +57 -12
- {refactorai_cli-0.2.8 → refactorai_cli-0.2.9}/refactorai_cli/commands/runtime_proxy_cmds.py +14 -0
- {refactorai_cli-0.2.8 → refactorai_cli-0.2.9}/refactorai_cli.egg-info/PKG-INFO +1 -1
- {refactorai_cli-0.2.8 → refactorai_cli-0.2.9}/README.md +0 -0
- {refactorai_cli-0.2.8 → refactorai_cli-0.2.9}/refactorai_cli/auth.py +0 -0
- {refactorai_cli-0.2.8 → refactorai_cli-0.2.9}/refactorai_cli/client.py +0 -0
- {refactorai_cli-0.2.8 → refactorai_cli-0.2.9}/refactorai_cli/commands/__init__.py +0 -0
- {refactorai_cli-0.2.8 → refactorai_cli-0.2.9}/refactorai_cli/commands/auth_cmds.py +0 -0
- {refactorai_cli-0.2.8 → refactorai_cli-0.2.9}/refactorai_cli/commands/engine_cmds.py +0 -0
- {refactorai_cli-0.2.8 → refactorai_cli-0.2.9}/refactorai_cli/commands/model_cmds.py +0 -0
- {refactorai_cli-0.2.8 → refactorai_cli-0.2.9}/refactorai_cli/commands/rules_cmds.py +0 -0
- {refactorai_cli-0.2.8 → refactorai_cli-0.2.9}/refactorai_cli/commands/runtime_cmds.py +0 -0
- {refactorai_cli-0.2.8 → refactorai_cli-0.2.9}/refactorai_cli/commands/setup_cmds.py +0 -0
- {refactorai_cli-0.2.8 → refactorai_cli-0.2.9}/refactorai_cli/control_plane.py +0 -0
- {refactorai_cli-0.2.8 → refactorai_cli-0.2.9}/refactorai_cli/credentials.py +0 -0
- {refactorai_cli-0.2.8 → refactorai_cli-0.2.9}/refactorai_cli/local_constitution.py +0 -0
- {refactorai_cli-0.2.8 → refactorai_cli-0.2.9}/refactorai_cli/local_engine_runtime.py +0 -0
- {refactorai_cli-0.2.8 → refactorai_cli-0.2.9}/refactorai_cli/local_paths.py +0 -0
- {refactorai_cli-0.2.8 → refactorai_cli-0.2.9}/refactorai_cli/main.py +0 -0
- {refactorai_cli-0.2.8 → refactorai_cli-0.2.9}/refactorai_cli/model_policy.py +0 -0
- {refactorai_cli-0.2.8 → refactorai_cli-0.2.9}/refactorai_cli/runtime_manager.py +0 -0
- {refactorai_cli-0.2.8 → refactorai_cli-0.2.9}/refactorai_cli/settings.py +0 -0
- {refactorai_cli-0.2.8 → refactorai_cli-0.2.9}/refactorai_cli/setup_flow.py +0 -0
- {refactorai_cli-0.2.8 → refactorai_cli-0.2.9}/refactorai_cli.egg-info/SOURCES.txt +0 -0
- {refactorai_cli-0.2.8 → refactorai_cli-0.2.9}/refactorai_cli.egg-info/dependency_links.txt +0 -0
- {refactorai_cli-0.2.8 → refactorai_cli-0.2.9}/refactorai_cli.egg-info/entry_points.txt +0 -0
- {refactorai_cli-0.2.8 → refactorai_cli-0.2.9}/refactorai_cli.egg-info/requires.txt +0 -0
- {refactorai_cli-0.2.8 → refactorai_cli-0.2.9}/refactorai_cli.egg-info/top_level.txt +0 -0
- {refactorai_cli-0.2.8 → refactorai_cli-0.2.9}/setup.cfg +0 -0
|
@@ -61,9 +61,12 @@ from refactor_core.sandbox_runtime import (
|
|
|
61
61
|
DEFAULT_IMAGE as SANDBOX_DEFAULT_IMAGE,
|
|
62
62
|
DEFAULT_SHELL as SANDBOX_DEFAULT_SHELL,
|
|
63
63
|
attach_shell as attach_sandbox_shell,
|
|
64
|
+
command_exists_in_container,
|
|
64
65
|
command_exists_in_sandbox,
|
|
66
|
+
detect_installer_in_container,
|
|
65
67
|
detect_installer_in_sandbox,
|
|
66
68
|
ensure_sandbox,
|
|
69
|
+
exec_in_container,
|
|
67
70
|
exec_in_sandbox,
|
|
68
71
|
remove_sandbox_container,
|
|
69
72
|
sandbox_name,
|
|
@@ -854,13 +857,47 @@ def _sandbox_preflight(
|
|
|
854
857
|
config_settings: dict,
|
|
855
858
|
auto_approve: bool,
|
|
856
859
|
no_install: bool,
|
|
860
|
+
runtime: str | None = None,
|
|
861
|
+
container_name: str | None = None,
|
|
862
|
+
workdir: str | None = None,
|
|
857
863
|
) -> tuple[bool, str]:
|
|
858
864
|
"""Run sandbox preflight and optionally perform approved install plan."""
|
|
865
|
+
|
|
866
|
+
has_container_ctx = bool(runtime and container_name)
|
|
867
|
+
resolved_workdir = str(workdir or "/workspace")
|
|
868
|
+
|
|
869
|
+
def _binary_exists(binary: str) -> bool:
|
|
870
|
+
if has_container_ctx:
|
|
871
|
+
return command_exists_in_container(
|
|
872
|
+
runtime=str(runtime),
|
|
873
|
+
container_name=str(container_name),
|
|
874
|
+
binary=binary,
|
|
875
|
+
workdir=resolved_workdir,
|
|
876
|
+
)
|
|
877
|
+
return command_exists_in_sandbox(project_root=project_root, binary=binary)
|
|
878
|
+
|
|
879
|
+
def _exec(command: str) -> tuple[bool, str]:
|
|
880
|
+
if has_container_ctx:
|
|
881
|
+
return exec_in_container(
|
|
882
|
+
runtime=str(runtime),
|
|
883
|
+
container_name=str(container_name),
|
|
884
|
+
command=command,
|
|
885
|
+
workdir=resolved_workdir,
|
|
886
|
+
)
|
|
887
|
+
return exec_in_sandbox(project_root=project_root, command=command)
|
|
888
|
+
|
|
889
|
+
def _detect_installer() -> str | None:
|
|
890
|
+
if has_container_ctx:
|
|
891
|
+
return detect_installer_in_container(
|
|
892
|
+
runtime=str(runtime),
|
|
893
|
+
container_name=str(container_name),
|
|
894
|
+
workdir=resolved_workdir,
|
|
895
|
+
)
|
|
896
|
+
return detect_installer_in_sandbox(project_root=project_root)
|
|
897
|
+
|
|
859
898
|
test_command = resolve_test_command(project_root, config_settings)
|
|
860
899
|
required_lsp = _required_lsp_commands(project_root)
|
|
861
|
-
missing_lsp = [
|
|
862
|
-
cmd for cmd in sorted(required_lsp) if not command_exists_in_sandbox(project_root=project_root, binary=cmd)
|
|
863
|
-
]
|
|
900
|
+
missing_lsp = [cmd for cmd in sorted(required_lsp) if not _binary_exists(cmd)]
|
|
864
901
|
missing_binary = ""
|
|
865
902
|
test_command_present = ""
|
|
866
903
|
if test_command:
|
|
@@ -877,7 +914,7 @@ def _sandbox_preflight(
|
|
|
877
914
|
)
|
|
878
915
|
return False, f"Could not parse test command: {test_command!r}"
|
|
879
916
|
test_command_present = binary
|
|
880
|
-
if not
|
|
917
|
+
if not _binary_exists(binary):
|
|
881
918
|
missing_binary = binary
|
|
882
919
|
|
|
883
920
|
if not missing_binary and not missing_lsp:
|
|
@@ -896,7 +933,7 @@ def _sandbox_preflight(
|
|
|
896
933
|
return True, "No test command configured."
|
|
897
934
|
return True, f"Preflight ok: found '{test_command_present}' and required LSP server(s) in sandbox."
|
|
898
935
|
|
|
899
|
-
installer =
|
|
936
|
+
installer = _detect_installer()
|
|
900
937
|
plan: list[str] = []
|
|
901
938
|
if missing_binary:
|
|
902
939
|
plan.extend(
|
|
@@ -1007,7 +1044,7 @@ def _sandbox_preflight(
|
|
|
1007
1044
|
"results": [],
|
|
1008
1045
|
}
|
|
1009
1046
|
for cmd in plan:
|
|
1010
|
-
ok, output =
|
|
1047
|
+
ok, output = _exec(cmd)
|
|
1011
1048
|
entry["results"].append({"command": cmd, "ok": ok, "output": (output or "")[:500]})
|
|
1012
1049
|
if not ok:
|
|
1013
1050
|
detail = output[:400] if output else "unknown error"
|
|
@@ -1027,7 +1064,7 @@ def _sandbox_preflight(
|
|
|
1027
1064
|
return False, f"Install command failed: `{cmd}` -> {detail}"
|
|
1028
1065
|
append_sandbox_install_history(project_root, entry)
|
|
1029
1066
|
|
|
1030
|
-
if missing_binary and not
|
|
1067
|
+
if missing_binary and not _binary_exists(missing_binary):
|
|
1031
1068
|
write_sandbox_preflight(
|
|
1032
1069
|
project_root,
|
|
1033
1070
|
{
|
|
@@ -1041,9 +1078,7 @@ def _sandbox_preflight(
|
|
|
1041
1078
|
},
|
|
1042
1079
|
)
|
|
1043
1080
|
return False, f"Preflight still failed after install: '{missing_binary}' not found."
|
|
1044
|
-
still_missing_lsp = [
|
|
1045
|
-
cmd for cmd in missing_lsp if not command_exists_in_sandbox(project_root=project_root, binary=cmd)
|
|
1046
|
-
]
|
|
1081
|
+
still_missing_lsp = [cmd for cmd in missing_lsp if not _binary_exists(cmd)]
|
|
1047
1082
|
if still_missing_lsp:
|
|
1048
1083
|
write_sandbox_preflight(
|
|
1049
1084
|
project_root,
|
|
@@ -1140,6 +1175,9 @@ def _ensure_sandbox_ready(
|
|
|
1140
1175
|
config_settings=settings,
|
|
1141
1176
|
auto_approve=auto_approve_install,
|
|
1142
1177
|
no_install=no_install,
|
|
1178
|
+
runtime=resolved_runtime,
|
|
1179
|
+
container_name=str(state.get("container_name", "") or ""),
|
|
1180
|
+
workdir=str(state.get("workdir") or workdir),
|
|
1143
1181
|
)
|
|
1144
1182
|
if not preflight_ok:
|
|
1145
1183
|
console.print(f"[red]{stage}: {preflight_msg}[/red]")
|
|
@@ -1149,6 +1187,7 @@ def _ensure_sandbox_ready(
|
|
|
1149
1187
|
"ephemeral": ephemeral,
|
|
1150
1188
|
"runtime": resolved_runtime,
|
|
1151
1189
|
"container_name": state.get("container_name", ""),
|
|
1190
|
+
"workdir": str(state.get("workdir") or workdir),
|
|
1152
1191
|
"stage": stage,
|
|
1153
1192
|
}
|
|
1154
1193
|
|
|
@@ -1233,6 +1272,9 @@ def start(
|
|
|
1233
1272
|
config_settings=settings,
|
|
1234
1273
|
auto_approve=yes,
|
|
1235
1274
|
no_install=no_install,
|
|
1275
|
+
runtime=resolved_runtime,
|
|
1276
|
+
container_name=str(state.get("container_name", "") or ""),
|
|
1277
|
+
workdir=str(state.get("workdir") or workdir),
|
|
1236
1278
|
)
|
|
1237
1279
|
if not preflight_ok:
|
|
1238
1280
|
console.print(f"[red]{preflight_msg}[/red]")
|
|
@@ -1497,8 +1539,11 @@ def code(
|
|
|
1497
1539
|
constitution=constitution,
|
|
1498
1540
|
provider=selected_provider,
|
|
1499
1541
|
requests=requests,
|
|
1500
|
-
config=
|
|
1501
|
-
|
|
1542
|
+
config=(
|
|
1543
|
+
dict(getattr(project_config, "settings", {}) or {})
|
|
1544
|
+
| ({"sandbox": {"enabled": True}} if sandbox_on else {})
|
|
1545
|
+
| ({"_sandbox_context": sandbox_ctx} if sandbox_ctx else {})
|
|
1546
|
+
)
|
|
1502
1547
|
or dict(getattr(constitution, "settings", {}) or {}),
|
|
1503
1548
|
progress_cb=_rr_progress_logger(status=status),
|
|
1504
1549
|
approval_cb=_rr_approval_prompt(auto_approve=auto_approve),
|
|
@@ -44,6 +44,20 @@ def _exec_runtime(command_name: str, passthrough_args: list[str]) -> None:
|
|
|
44
44
|
artifact.chmod(mode | 0o111)
|
|
45
45
|
except OSError:
|
|
46
46
|
pass
|
|
47
|
+
probe = subprocess.run(
|
|
48
|
+
[str(artifact), command_name, "--help"],
|
|
49
|
+
check=False,
|
|
50
|
+
capture_output=True,
|
|
51
|
+
text=True,
|
|
52
|
+
)
|
|
53
|
+
probe_text = f"{probe.stdout}\n{probe.stderr}".lower()
|
|
54
|
+
if "unrecognized arguments" in probe_text and command_name in probe_text:
|
|
55
|
+
console.print(
|
|
56
|
+
"[red]Active runtime artifact does not support command dispatch yet.[/red]\n"
|
|
57
|
+
"Run `refactor runtime update` (or rerun setup from S3) to install the "
|
|
58
|
+
"latest runtime binary from your server."
|
|
59
|
+
)
|
|
60
|
+
raise typer.Exit(code=2)
|
|
47
61
|
proc = subprocess.run([str(artifact), command_name, *passthrough_args], check=False)
|
|
48
62
|
if proc.returncode != 0:
|
|
49
63
|
raise typer.Exit(code=proc.returncode)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|