refactorai-cli 0.2.9__tar.gz → 0.2.10__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.9 → refactorai_cli-0.2.10}/PKG-INFO +1 -1
- {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/pyproject.toml +1 -1
- {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/__init__.py +1 -1
- {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/commands/run_cmds.py +65 -1
- {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli.egg-info/PKG-INFO +1 -1
- {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/README.md +0 -0
- {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/auth.py +0 -0
- {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/client.py +0 -0
- {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/commands/__init__.py +0 -0
- {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/commands/auth_cmds.py +0 -0
- {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/commands/engine_cmds.py +0 -0
- {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/commands/model_cmds.py +0 -0
- {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/commands/rules_cmds.py +0 -0
- {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/commands/runtime_cmds.py +0 -0
- {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/commands/runtime_proxy_cmds.py +0 -0
- {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/commands/setup_cmds.py +0 -0
- {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/control_plane.py +0 -0
- {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/credentials.py +0 -0
- {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/local_constitution.py +0 -0
- {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/local_engine_runtime.py +0 -0
- {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/local_paths.py +0 -0
- {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/main.py +0 -0
- {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/model_policy.py +0 -0
- {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/runtime_manager.py +0 -0
- {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/settings.py +0 -0
- {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/setup_flow.py +0 -0
- {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli.egg-info/SOURCES.txt +0 -0
- {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli.egg-info/dependency_links.txt +0 -0
- {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli.egg-info/entry_points.txt +0 -0
- {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli.egg-info/requires.txt +0 -0
- {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli.egg-info/top_level.txt +0 -0
- {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/setup.cfg +0 -0
|
@@ -8,6 +8,7 @@ generation and application.
|
|
|
8
8
|
from __future__ import annotations
|
|
9
9
|
|
|
10
10
|
import os
|
|
11
|
+
import json
|
|
11
12
|
import re
|
|
12
13
|
import shlex
|
|
13
14
|
import shutil
|
|
@@ -92,10 +93,62 @@ from refactor_core.store import (
|
|
|
92
93
|
from refactor_core.testcmd import resolve_test_command
|
|
93
94
|
|
|
94
95
|
from refactorai_cli.auth import AuthError, ensure_authenticated
|
|
96
|
+
from refactorai_cli.local_engine_runtime import DEFAULT_ENGINE_PORT, read_engine_state
|
|
95
97
|
from refactorai_cli.settings import platform_url
|
|
98
|
+
from refactorai_cli.setup_flow import (
|
|
99
|
+
BACKEND_BYOK,
|
|
100
|
+
BACKEND_LOCAL_SERVER,
|
|
101
|
+
read_setup_state,
|
|
102
|
+
stage_output_path,
|
|
103
|
+
)
|
|
96
104
|
|
|
97
105
|
console = Console()
|
|
98
106
|
|
|
107
|
+
|
|
108
|
+
def _read_stage_output(stage_id: str) -> dict:
|
|
109
|
+
path = stage_output_path(stage_id)
|
|
110
|
+
if not path.is_file():
|
|
111
|
+
return {}
|
|
112
|
+
try:
|
|
113
|
+
payload = json.loads(path.read_text(encoding="utf-8"))
|
|
114
|
+
except (json.JSONDecodeError, OSError):
|
|
115
|
+
return {}
|
|
116
|
+
output = payload.get("output")
|
|
117
|
+
return output if isinstance(output, dict) else {}
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def _setup_recommended_model_id() -> str:
|
|
121
|
+
s5_output = _read_stage_output("S5")
|
|
122
|
+
model_id = str(s5_output.get("recommended_model_id") or "").strip()
|
|
123
|
+
return model_id or "qwen2.5-coder:1.5b-instruct"
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def _setup_engine_base_url() -> str:
|
|
127
|
+
state = read_engine_state()
|
|
128
|
+
try:
|
|
129
|
+
port = int(state.get("port", DEFAULT_ENGINE_PORT))
|
|
130
|
+
except (TypeError, ValueError):
|
|
131
|
+
port = DEFAULT_ENGINE_PORT
|
|
132
|
+
return f"http://127.0.0.1:{port}/v1"
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def _default_config_for_init() -> tuple[str, str]:
|
|
136
|
+
setup_state = read_setup_state()
|
|
137
|
+
backend = str(setup_state.get("execution_backend") or "").strip().lower()
|
|
138
|
+
if backend == BACKEND_LOCAL_SERVER:
|
|
139
|
+
model_id = _setup_recommended_model_id()
|
|
140
|
+
base_url = _setup_engine_base_url()
|
|
141
|
+
config_text = DEFAULT_CONFIG.replace("provider: heuristic", "provider: ollama", 1)
|
|
142
|
+
config_text = config_text.replace(
|
|
143
|
+
"model_id: heuristic-local-v1",
|
|
144
|
+
f"model_id: {model_id}\nbase_url: {base_url}",
|
|
145
|
+
1,
|
|
146
|
+
)
|
|
147
|
+
return config_text, "local_server"
|
|
148
|
+
if backend == BACKEND_BYOK:
|
|
149
|
+
return DEFAULT_CONFIG, "byok"
|
|
150
|
+
return DEFAULT_CONFIG, "default"
|
|
151
|
+
|
|
99
152
|
_SEVERITY_STYLE = {
|
|
100
153
|
"critical": "bold red",
|
|
101
154
|
"high": "red",
|
|
@@ -603,12 +656,23 @@ def init(
|
|
|
603
656
|
)
|
|
604
657
|
raise typer.Exit(code=1)
|
|
605
658
|
consti_target.write_text(DEFAULT_CONSTITUTION, encoding="utf-8")
|
|
606
|
-
|
|
659
|
+
config_text, config_profile = _default_config_for_init()
|
|
660
|
+
config_target.write_text(config_text, encoding="utf-8")
|
|
607
661
|
|
|
608
662
|
constitution = load_constitution(consti_target)
|
|
609
663
|
record = register_project(project_root, constitution_hash=constitution.content_hash)
|
|
610
664
|
console.print(f"[green]Created[/green] {consti_target}")
|
|
611
665
|
console.print(f"[green]Created[/green] {config_target}")
|
|
666
|
+
if config_profile == "local_server":
|
|
667
|
+
console.print(
|
|
668
|
+
"[green]Configured[/green] refactor.config for local server setup "
|
|
669
|
+
"(provider=ollama with setup-recommended model)."
|
|
670
|
+
)
|
|
671
|
+
elif config_profile == "byok":
|
|
672
|
+
console.print(
|
|
673
|
+
"[green]Configured[/green] refactor.config for BYOK setup "
|
|
674
|
+
"(provider=heuristic; uncomment a provider block to use your key)."
|
|
675
|
+
)
|
|
612
676
|
console.print(
|
|
613
677
|
f"[green]Registered[/green] project in central store: {project_store_dir(project_root)}"
|
|
614
678
|
)
|
|
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
|
{refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/commands/runtime_proxy_cmds.py
RENAMED
|
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
|