refactorai-cli 0.2.2__py3-none-any.whl → 0.2.4__py3-none-any.whl
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/__init__.py +1 -1
- refactorai_cli/local_engine_runtime.py +16 -4
- refactorai_cli/settings.py +1 -1
- refactorai_cli/setup_flow.py +17 -1
- {refactorai_cli-0.2.2.dist-info → refactorai_cli-0.2.4.dist-info}/METADATA +5 -1
- {refactorai_cli-0.2.2.dist-info → refactorai_cli-0.2.4.dist-info}/RECORD +9 -9
- {refactorai_cli-0.2.2.dist-info → refactorai_cli-0.2.4.dist-info}/WHEEL +0 -0
- {refactorai_cli-0.2.2.dist-info → refactorai_cli-0.2.4.dist-info}/entry_points.txt +0 -0
- {refactorai_cli-0.2.2.dist-info → refactorai_cli-0.2.4.dist-info}/top_level.txt +0 -0
refactorai_cli/__init__.py
CHANGED
|
@@ -14,7 +14,7 @@ from pathlib import Path
|
|
|
14
14
|
|
|
15
15
|
from refactorai_cli.local_paths import ensure_dir, refactor_home
|
|
16
16
|
|
|
17
|
-
DEFAULT_ENGINE_IMAGE = "docker.io/
|
|
17
|
+
DEFAULT_ENGINE_IMAGE = "docker.io/ollama/ollama:latest"
|
|
18
18
|
DEFAULT_ENGINE_CONTAINER = "refactor-engine"
|
|
19
19
|
DEFAULT_ENGINE_PORT = 17777
|
|
20
20
|
DEFAULT_ENGINE_PROFILE = "cpu-small"
|
|
@@ -96,10 +96,22 @@ def _running(runtime: str, name: str) -> bool:
|
|
|
96
96
|
|
|
97
97
|
|
|
98
98
|
def _health(runtime: str, name: str) -> bool:
|
|
99
|
-
|
|
99
|
+
has_binary = _run([runtime, "exec", name, "sh", "-lc", "command -v ollama >/dev/null 2>&1"])
|
|
100
|
+
if has_binary.returncode != 0:
|
|
101
|
+
return False
|
|
102
|
+
proc = _run([runtime, "exec", name, "sh", "-lc", "ollama list >/dev/null 2>&1"])
|
|
100
103
|
return proc.returncode == 0
|
|
101
104
|
|
|
102
105
|
|
|
106
|
+
def _run_args_for_image(image: str) -> list[str]:
|
|
107
|
+
normalized = str(image or "").strip().lower()
|
|
108
|
+
if "ollama/ollama" in normalized:
|
|
109
|
+
# Let the container run its default command (ollama serve), which keeps
|
|
110
|
+
# the model API available for pull/show operations.
|
|
111
|
+
return []
|
|
112
|
+
return ["sleep", "infinity"]
|
|
113
|
+
|
|
114
|
+
|
|
103
115
|
def ensure_engine_up(
|
|
104
116
|
*,
|
|
105
117
|
runtime: str,
|
|
@@ -114,6 +126,7 @@ def ensure_engine_up(
|
|
|
114
126
|
if rebuild and _exists(runtime, container_name):
|
|
115
127
|
_run([runtime, "rm", "-f", container_name])
|
|
116
128
|
if not _exists(runtime, container_name):
|
|
129
|
+
command_args = _run_args_for_image(image)
|
|
117
130
|
proc = _run(
|
|
118
131
|
[
|
|
119
132
|
runtime,
|
|
@@ -128,8 +141,7 @@ def ensure_engine_up(
|
|
|
128
141
|
"-v",
|
|
129
142
|
f"{cache_dir}:/root/.cache/ollama:Z",
|
|
130
143
|
image,
|
|
131
|
-
|
|
132
|
-
"infinity",
|
|
144
|
+
*command_args,
|
|
133
145
|
]
|
|
134
146
|
)
|
|
135
147
|
if proc.returncode != 0:
|
refactorai_cli/settings.py
CHANGED
|
@@ -4,7 +4,7 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
import os
|
|
6
6
|
|
|
7
|
-
DEFAULT_PLATFORM_URL = "
|
|
7
|
+
DEFAULT_PLATFORM_URL = "https://api.refactorai.codes"
|
|
8
8
|
ENV_API_KEY = "REFACTOR_API_KEY"
|
|
9
9
|
ENV_PLATFORM_URL = "REFACTOR_PLATFORM_URL"
|
|
10
10
|
ENV_POLICY_SIGNING_KEY = "REFACTOR_POLICY_SIGNING_KEY"
|
refactorai_cli/setup_flow.py
CHANGED
|
@@ -11,6 +11,7 @@ from typing import Callable
|
|
|
11
11
|
|
|
12
12
|
from refactorai_cli.local_engine_runtime import (
|
|
13
13
|
DEFAULT_ENGINE_CONTAINER,
|
|
14
|
+
DEFAULT_ENGINE_IMAGE,
|
|
14
15
|
engine_status,
|
|
15
16
|
ensure_engine_up,
|
|
16
17
|
pull_model,
|
|
@@ -229,7 +230,22 @@ def _stage_s5_backend_bootstrap(ask_approval: Callable[[str], bool]) -> dict:
|
|
|
229
230
|
raise SetupError(f"Local server bootstrap failed: {message}")
|
|
230
231
|
estatus = engine_status(runtime=runtime, container_name=DEFAULT_ENGINE_CONTAINER)
|
|
231
232
|
if str(estatus.get("status") or "").lower() != "ready":
|
|
232
|
-
|
|
233
|
+
# If a stale container from older installs exists (for example an image
|
|
234
|
+
# without ollama), rebuild once with the default engine image.
|
|
235
|
+
ok, message, _state = ensure_engine_up(
|
|
236
|
+
runtime=runtime,
|
|
237
|
+
image=DEFAULT_ENGINE_IMAGE,
|
|
238
|
+
container_name=DEFAULT_ENGINE_CONTAINER,
|
|
239
|
+
rebuild=True,
|
|
240
|
+
)
|
|
241
|
+
if not ok:
|
|
242
|
+
raise SetupError(f"Local server bootstrap failed: {message}")
|
|
243
|
+
estatus = engine_status(runtime=runtime, container_name=DEFAULT_ENGINE_CONTAINER)
|
|
244
|
+
if str(estatus.get("status") or "").lower() != "ready":
|
|
245
|
+
raise SetupError(
|
|
246
|
+
f"Local server is not ready (status={estatus.get('status')}). "
|
|
247
|
+
"Run `refactor engine status` and retry from S5."
|
|
248
|
+
)
|
|
233
249
|
|
|
234
250
|
policy = resolve_policy(force_refresh=False)
|
|
235
251
|
profile = detect_machine_profile()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: refactorai-cli
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
4
4
|
Summary: Local-first CLI for the refactor platform
|
|
5
5
|
Requires-Python: >=3.11
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -17,6 +17,10 @@ Public CLI package for Refactor.
|
|
|
17
17
|
- Installed command: `refactor`
|
|
18
18
|
- Python module package: `refactorai_cli`
|
|
19
19
|
|
|
20
|
+
By default, the CLI targets `https://api.refactorai.codes`.
|
|
21
|
+
Use `REFACTOR_PLATFORM_URL` only when you need to override the control-plane URL
|
|
22
|
+
(for self-hosted or local development environments).
|
|
23
|
+
|
|
20
24
|
## Local development install
|
|
21
25
|
|
|
22
26
|
From repository root:
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
refactorai_cli/__init__.py,sha256=
|
|
1
|
+
refactorai_cli/__init__.py,sha256=m7EDyFlFfTns1KC0eTQ1flQcbeSge8Ja3TBdRWB2jSQ,273
|
|
2
2
|
refactorai_cli/auth.py,sha256=fxFHybjfViaR3Vw2p9WJio0_3B6QWTNCmaKk_jpCDGU,3627
|
|
3
3
|
refactorai_cli/client.py,sha256=_MxZKf32QN4kMZvvXvYj9jcvytlp_kSQ-mJkmj1zlnA,1684
|
|
4
4
|
refactorai_cli/control_plane.py,sha256=VufIjZ3wsyjx25Qs4Vkjx2J1AbZZkiasO6NWZPRibmg,8005
|
|
5
5
|
refactorai_cli/credentials.py,sha256=EeKqli3ePdl9jQ0H_k4JZrv9zHWccF_IyfwIkusQaVI,2062
|
|
6
6
|
refactorai_cli/local_constitution.py,sha256=w8oPohDWZeNKrn8vw-5I5rOvm_Q9wrn1XLDGzcrXvs0,2139
|
|
7
|
-
refactorai_cli/local_engine_runtime.py,sha256=
|
|
7
|
+
refactorai_cli/local_engine_runtime.py,sha256=EPzFg_xwcbI0lcagE05AUCFdfEWVDAGnOzRcZWLvxRs,9425
|
|
8
8
|
refactorai_cli/local_paths.py,sha256=IMP2ud1t0NEnfwutTTGYVKMzzajbTW-CGGZMFuIIow0,1111
|
|
9
9
|
refactorai_cli/main.py,sha256=CKhT3x4rFEAEBEacCm55JD9IB7O9M33BXD32O_FH80Y,1117
|
|
10
10
|
refactorai_cli/model_policy.py,sha256=rLC_aKFq34xSMBX9X0vzV8V5ZGBdeESULp-nmpwzWjM,5241
|
|
11
11
|
refactorai_cli/runtime_manager.py,sha256=eACTqFHIxMLJef0iAFxSBu3dc8VW9-pxlLoKKZ-rKa8,8041
|
|
12
|
-
refactorai_cli/settings.py,sha256=
|
|
13
|
-
refactorai_cli/setup_flow.py,sha256=
|
|
12
|
+
refactorai_cli/settings.py,sha256=0dcMLtZuk5aIcg21VD1U41GS2CkLE_3uiZx6dUrZWIE,874
|
|
13
|
+
refactorai_cli/setup_flow.py,sha256=mz2sC9BQgXQ9RPjycb4kEj4ehmKKq0wwn7Kv6Bfcck0,15108
|
|
14
14
|
refactorai_cli/commands/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
15
15
|
refactorai_cli/commands/auth_cmds.py,sha256=Aph-7OauC8tZzVTH9E92tu-YTo9nN_o-bNTc5--XJfo,2912
|
|
16
16
|
refactorai_cli/commands/engine_cmds.py,sha256=Ky8qk86rLvKu3EzHNCupzhoYFvi3gXQK9GZxNSGk9Ss,5650
|
|
@@ -19,8 +19,8 @@ refactorai_cli/commands/rules_cmds.py,sha256=fs7Sk2Z7S-gG6rvx3lAEs-GPIm2m-GXBaZN
|
|
|
19
19
|
refactorai_cli/commands/run_cmds.py,sha256=3M3WLhxKpMQF04JiXsZNLsyS63o83al3SwrQpdclR5s,87340
|
|
20
20
|
refactorai_cli/commands/runtime_cmds.py,sha256=7-aX5-QZorhk3pdl-bsyRYMUH83ie_5iItehAIMigbA,6612
|
|
21
21
|
refactorai_cli/commands/setup_cmds.py,sha256=-0-P9_iJTsqseUWCEVHqbLeoo0eRwsz80fO7HGvwaE4,2962
|
|
22
|
-
refactorai_cli-0.2.
|
|
23
|
-
refactorai_cli-0.2.
|
|
24
|
-
refactorai_cli-0.2.
|
|
25
|
-
refactorai_cli-0.2.
|
|
26
|
-
refactorai_cli-0.2.
|
|
22
|
+
refactorai_cli-0.2.4.dist-info/METADATA,sha256=-AUS-lehJIFYnTBWaxDuT5TX4uYKIheJQMoC7UxWLng,1234
|
|
23
|
+
refactorai_cli-0.2.4.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
24
|
+
refactorai_cli-0.2.4.dist-info/entry_points.txt,sha256=PfA9Gzm9zWWSfVx_SV7a1UgUJ5k-ng5qEwAOKa8V8NI,53
|
|
25
|
+
refactorai_cli-0.2.4.dist-info/top_level.txt,sha256=YBrXzqlB5O16kjUyu-8UegpSHibQGrIrUQgiHvIrG-Q,15
|
|
26
|
+
refactorai_cli-0.2.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|