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.
Files changed (32) hide show
  1. {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/PKG-INFO +1 -1
  2. {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/pyproject.toml +1 -1
  3. {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/__init__.py +1 -1
  4. {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/commands/run_cmds.py +65 -1
  5. {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli.egg-info/PKG-INFO +1 -1
  6. {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/README.md +0 -0
  7. {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/auth.py +0 -0
  8. {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/client.py +0 -0
  9. {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/commands/__init__.py +0 -0
  10. {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/commands/auth_cmds.py +0 -0
  11. {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/commands/engine_cmds.py +0 -0
  12. {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/commands/model_cmds.py +0 -0
  13. {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/commands/rules_cmds.py +0 -0
  14. {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/commands/runtime_cmds.py +0 -0
  15. {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/commands/runtime_proxy_cmds.py +0 -0
  16. {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/commands/setup_cmds.py +0 -0
  17. {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/control_plane.py +0 -0
  18. {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/credentials.py +0 -0
  19. {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/local_constitution.py +0 -0
  20. {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/local_engine_runtime.py +0 -0
  21. {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/local_paths.py +0 -0
  22. {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/main.py +0 -0
  23. {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/model_policy.py +0 -0
  24. {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/runtime_manager.py +0 -0
  25. {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/settings.py +0 -0
  26. {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli/setup_flow.py +0 -0
  27. {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli.egg-info/SOURCES.txt +0 -0
  28. {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli.egg-info/dependency_links.txt +0 -0
  29. {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli.egg-info/entry_points.txt +0 -0
  30. {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli.egg-info/requires.txt +0 -0
  31. {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/refactorai_cli.egg-info/top_level.txt +0 -0
  32. {refactorai_cli-0.2.9 → refactorai_cli-0.2.10}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: refactorai-cli
3
- Version: 0.2.9
3
+ Version: 0.2.10
4
4
  Summary: Local-first CLI for the refactor platform
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "refactorai-cli"
3
- version = "0.2.9"
3
+ version = "0.2.10"
4
4
  description = "Local-first CLI for the refactor platform"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -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.2.9"
8
+ __version__ = "0.2.10"
@@ -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
- config_target.write_text(DEFAULT_CONFIG, encoding="utf-8")
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
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: refactorai-cli
3
- Version: 0.2.9
3
+ Version: 0.2.10
4
4
  Summary: Local-first CLI for the refactor platform
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown