refactorai-cli 0.2.7__tar.gz → 0.2.8__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.7 → refactorai_cli-0.2.8}/PKG-INFO +1 -1
- {refactorai_cli-0.2.7 → refactorai_cli-0.2.8}/pyproject.toml +1 -1
- {refactorai_cli-0.2.7 → refactorai_cli-0.2.8}/refactorai_cli/__init__.py +1 -1
- refactorai_cli-0.2.8/refactorai_cli/commands/runtime_proxy_cmds.py +124 -0
- refactorai_cli-0.2.8/refactorai_cli/main.py +69 -0
- {refactorai_cli-0.2.7 → refactorai_cli-0.2.8}/refactorai_cli.egg-info/PKG-INFO +1 -1
- {refactorai_cli-0.2.7 → refactorai_cli-0.2.8}/refactorai_cli.egg-info/SOURCES.txt +1 -0
- refactorai_cli-0.2.7/refactorai_cli/main.py +0 -160
- {refactorai_cli-0.2.7 → refactorai_cli-0.2.8}/README.md +0 -0
- {refactorai_cli-0.2.7 → refactorai_cli-0.2.8}/refactorai_cli/auth.py +0 -0
- {refactorai_cli-0.2.7 → refactorai_cli-0.2.8}/refactorai_cli/client.py +0 -0
- {refactorai_cli-0.2.7 → refactorai_cli-0.2.8}/refactorai_cli/commands/__init__.py +0 -0
- {refactorai_cli-0.2.7 → refactorai_cli-0.2.8}/refactorai_cli/commands/auth_cmds.py +0 -0
- {refactorai_cli-0.2.7 → refactorai_cli-0.2.8}/refactorai_cli/commands/engine_cmds.py +0 -0
- {refactorai_cli-0.2.7 → refactorai_cli-0.2.8}/refactorai_cli/commands/model_cmds.py +0 -0
- {refactorai_cli-0.2.7 → refactorai_cli-0.2.8}/refactorai_cli/commands/rules_cmds.py +0 -0
- {refactorai_cli-0.2.7 → refactorai_cli-0.2.8}/refactorai_cli/commands/run_cmds.py +0 -0
- {refactorai_cli-0.2.7 → refactorai_cli-0.2.8}/refactorai_cli/commands/runtime_cmds.py +0 -0
- {refactorai_cli-0.2.7 → refactorai_cli-0.2.8}/refactorai_cli/commands/setup_cmds.py +0 -0
- {refactorai_cli-0.2.7 → refactorai_cli-0.2.8}/refactorai_cli/control_plane.py +0 -0
- {refactorai_cli-0.2.7 → refactorai_cli-0.2.8}/refactorai_cli/credentials.py +0 -0
- {refactorai_cli-0.2.7 → refactorai_cli-0.2.8}/refactorai_cli/local_constitution.py +0 -0
- {refactorai_cli-0.2.7 → refactorai_cli-0.2.8}/refactorai_cli/local_engine_runtime.py +0 -0
- {refactorai_cli-0.2.7 → refactorai_cli-0.2.8}/refactorai_cli/local_paths.py +0 -0
- {refactorai_cli-0.2.7 → refactorai_cli-0.2.8}/refactorai_cli/model_policy.py +0 -0
- {refactorai_cli-0.2.7 → refactorai_cli-0.2.8}/refactorai_cli/runtime_manager.py +0 -0
- {refactorai_cli-0.2.7 → refactorai_cli-0.2.8}/refactorai_cli/settings.py +0 -0
- {refactorai_cli-0.2.7 → refactorai_cli-0.2.8}/refactorai_cli/setup_flow.py +0 -0
- {refactorai_cli-0.2.7 → refactorai_cli-0.2.8}/refactorai_cli.egg-info/dependency_links.txt +0 -0
- {refactorai_cli-0.2.7 → refactorai_cli-0.2.8}/refactorai_cli.egg-info/entry_points.txt +0 -0
- {refactorai_cli-0.2.7 → refactorai_cli-0.2.8}/refactorai_cli.egg-info/requires.txt +0 -0
- {refactorai_cli-0.2.7 → refactorai_cli-0.2.8}/refactorai_cli.egg-info/top_level.txt +0 -0
- {refactorai_cli-0.2.7 → refactorai_cli-0.2.8}/setup.cfg +0 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"""Top-level run commands proxied to the downloaded proprietary runtime binary.
|
|
2
|
+
|
|
3
|
+
The public CLI package is intentionally thin; operational commands are executed
|
|
4
|
+
by the activated runtime artifact under ``~/.refactor/runtime``.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import subprocess
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
|
|
12
|
+
import typer
|
|
13
|
+
from rich.console import Console
|
|
14
|
+
|
|
15
|
+
from refactorai_cli.runtime_manager import runtime_artifact_path, runtime_status
|
|
16
|
+
|
|
17
|
+
console = Console()
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def _active_runtime_artifact() -> Path:
|
|
21
|
+
status = runtime_status()
|
|
22
|
+
version = str(status.get("active_version") or "").strip()
|
|
23
|
+
if not version:
|
|
24
|
+
console.print(
|
|
25
|
+
"[red]No active runtime found.[/red] "
|
|
26
|
+
"Run `refactor setup` or `refactor runtime update` first."
|
|
27
|
+
)
|
|
28
|
+
raise typer.Exit(code=1)
|
|
29
|
+
artifact = runtime_artifact_path(version)
|
|
30
|
+
if not artifact.is_file():
|
|
31
|
+
console.print(
|
|
32
|
+
f"[red]Active runtime artifact is missing:[/red] {artifact}\n"
|
|
33
|
+
"Run `refactor runtime update` to recover."
|
|
34
|
+
)
|
|
35
|
+
raise typer.Exit(code=1)
|
|
36
|
+
return artifact
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def _exec_runtime(command_name: str, passthrough_args: list[str]) -> None:
|
|
40
|
+
artifact = _active_runtime_artifact()
|
|
41
|
+
# Best-effort ensure executable bit for artifacts downloaded on Linux/macOS.
|
|
42
|
+
try:
|
|
43
|
+
mode = artifact.stat().st_mode
|
|
44
|
+
artifact.chmod(mode | 0o111)
|
|
45
|
+
except OSError:
|
|
46
|
+
pass
|
|
47
|
+
proc = subprocess.run([str(artifact), command_name, *passthrough_args], check=False)
|
|
48
|
+
if proc.returncode != 0:
|
|
49
|
+
raise typer.Exit(code=proc.returncode)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def init(ctx: typer.Context) -> None:
|
|
53
|
+
"""Initialize project state via proprietary runtime."""
|
|
54
|
+
_exec_runtime("init", list(ctx.args))
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def start(ctx: typer.Context) -> None:
|
|
58
|
+
"""Start runtime-managed workflow via proprietary runtime."""
|
|
59
|
+
_exec_runtime("start", list(ctx.args))
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def stop(ctx: typer.Context) -> None:
|
|
63
|
+
"""Stop runtime-managed workflow via proprietary runtime."""
|
|
64
|
+
_exec_runtime("stop", list(ctx.args))
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def shell(ctx: typer.Context) -> None:
|
|
68
|
+
"""Open runtime shell via proprietary runtime."""
|
|
69
|
+
_exec_runtime("shell", list(ctx.args))
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def review(ctx: typer.Context) -> None:
|
|
73
|
+
"""Run review via proprietary runtime."""
|
|
74
|
+
_exec_runtime("review", list(ctx.args))
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def code(ctx: typer.Context) -> None:
|
|
78
|
+
"""Run code mode via proprietary runtime."""
|
|
79
|
+
_exec_runtime("code", list(ctx.args))
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def requests(ctx: typer.Context) -> None:
|
|
83
|
+
"""Inspect/manage requests via proprietary runtime."""
|
|
84
|
+
_exec_runtime("requests", list(ctx.args))
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def apply(ctx: typer.Context) -> None:
|
|
88
|
+
"""Apply pending changes via proprietary runtime."""
|
|
89
|
+
_exec_runtime("apply", list(ctx.args))
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def revert(ctx: typer.Context) -> None:
|
|
93
|
+
"""Revert pending changes via proprietary runtime."""
|
|
94
|
+
_exec_runtime("revert", list(ctx.args))
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def status(ctx: typer.Context) -> None:
|
|
98
|
+
"""Show runtime status via proprietary runtime."""
|
|
99
|
+
_exec_runtime("status", list(ctx.args))
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def diff(ctx: typer.Context) -> None:
|
|
103
|
+
"""Show diff via proprietary runtime."""
|
|
104
|
+
_exec_runtime("diff", list(ctx.args))
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def gc(ctx: typer.Context) -> None:
|
|
108
|
+
"""Run runtime GC/cleanup."""
|
|
109
|
+
_exec_runtime("gc", list(ctx.args))
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def check(ctx: typer.Context) -> None:
|
|
113
|
+
"""Run checks via proprietary runtime."""
|
|
114
|
+
_exec_runtime("check", list(ctx.args))
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def doctor(ctx: typer.Context) -> None:
|
|
118
|
+
"""Run diagnostics via proprietary runtime."""
|
|
119
|
+
_exec_runtime("doctor", list(ctx.args))
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def config(ctx: typer.Context) -> None:
|
|
123
|
+
"""Manage config via proprietary runtime."""
|
|
124
|
+
_exec_runtime("config", list(ctx.args))
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"""`refactor` CLI entry point."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import typer
|
|
6
|
+
|
|
7
|
+
from refactorai_cli import __version__
|
|
8
|
+
from refactorai_cli.commands import auth_cmds, engine_cmds, model_cmds, runtime_cmds, runtime_proxy_cmds, setup_cmds
|
|
9
|
+
|
|
10
|
+
app = typer.Typer(
|
|
11
|
+
name="refactor",
|
|
12
|
+
help="Local-first AI code review and refactor, run from your project folder.",
|
|
13
|
+
no_args_is_help=True,
|
|
14
|
+
add_completion=False,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _version_callback(value: bool) -> None:
|
|
19
|
+
if value:
|
|
20
|
+
typer.echo(f"refactor {__version__}")
|
|
21
|
+
raise typer.Exit()
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@app.callback()
|
|
25
|
+
def main(
|
|
26
|
+
version: bool = typer.Option(
|
|
27
|
+
False,
|
|
28
|
+
"--version",
|
|
29
|
+
"-V",
|
|
30
|
+
help="Show the CLI version and exit.",
|
|
31
|
+
callback=_version_callback,
|
|
32
|
+
is_eager=True,
|
|
33
|
+
),
|
|
34
|
+
) -> None:
|
|
35
|
+
"""refactor CLI."""
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
# Auth (R7.1)
|
|
39
|
+
app.command()(auth_cmds.login)
|
|
40
|
+
app.command()(auth_cmds.whoami)
|
|
41
|
+
|
|
42
|
+
# Project / run surface (proxied to activated runtime artifact)
|
|
43
|
+
_RUNTIME_CTX = {"allow_extra_args": True, "ignore_unknown_options": True}
|
|
44
|
+
app.command(context_settings=_RUNTIME_CTX)(runtime_proxy_cmds.init)
|
|
45
|
+
app.command(context_settings=_RUNTIME_CTX)(runtime_proxy_cmds.start)
|
|
46
|
+
app.command(context_settings=_RUNTIME_CTX)(runtime_proxy_cmds.stop)
|
|
47
|
+
app.command(context_settings=_RUNTIME_CTX)(runtime_proxy_cmds.shell)
|
|
48
|
+
app.command(context_settings=_RUNTIME_CTX)(runtime_proxy_cmds.review)
|
|
49
|
+
app.command(context_settings=_RUNTIME_CTX)(runtime_proxy_cmds.code)
|
|
50
|
+
app.command(context_settings=_RUNTIME_CTX)(runtime_proxy_cmds.requests)
|
|
51
|
+
app.command(context_settings=_RUNTIME_CTX)(runtime_proxy_cmds.apply)
|
|
52
|
+
app.command(context_settings=_RUNTIME_CTX)(runtime_proxy_cmds.revert)
|
|
53
|
+
app.command(context_settings=_RUNTIME_CTX)(runtime_proxy_cmds.status)
|
|
54
|
+
app.command(context_settings=_RUNTIME_CTX)(runtime_proxy_cmds.diff)
|
|
55
|
+
app.command(context_settings=_RUNTIME_CTX)(runtime_proxy_cmds.gc)
|
|
56
|
+
app.command(context_settings=_RUNTIME_CTX)(runtime_proxy_cmds.check)
|
|
57
|
+
app.command(context_settings=_RUNTIME_CTX)(runtime_proxy_cmds.doctor)
|
|
58
|
+
app.command(context_settings=_RUNTIME_CTX)(runtime_proxy_cmds.config)
|
|
59
|
+
|
|
60
|
+
app.command()(setup_cmds.setup)
|
|
61
|
+
|
|
62
|
+
# Runtime/engine/model operations.
|
|
63
|
+
app.add_typer(runtime_cmds.app, name="runtime")
|
|
64
|
+
app.add_typer(engine_cmds.app, name="engine")
|
|
65
|
+
app.add_typer(model_cmds.app, name="model")
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
if __name__ == "__main__":
|
|
69
|
+
app()
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
"""`refactor` CLI entry point."""
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
import typer
|
|
6
|
-
|
|
7
|
-
from refactorai_cli import __version__
|
|
8
|
-
from refactorai_cli.commands import auth_cmds, engine_cmds, model_cmds, runtime_cmds, setup_cmds
|
|
9
|
-
|
|
10
|
-
app = typer.Typer(
|
|
11
|
-
name="refactor",
|
|
12
|
-
help="Local-first AI code review and refactor, run from your project folder.",
|
|
13
|
-
no_args_is_help=True,
|
|
14
|
-
add_completion=False,
|
|
15
|
-
)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def _version_callback(value: bool) -> None:
|
|
19
|
-
if value:
|
|
20
|
-
typer.echo(f"refactor {__version__}")
|
|
21
|
-
raise typer.Exit()
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
@app.callback()
|
|
25
|
-
def main(
|
|
26
|
-
version: bool = typer.Option(
|
|
27
|
-
False,
|
|
28
|
-
"--version",
|
|
29
|
-
"-V",
|
|
30
|
-
help="Show the CLI version and exit.",
|
|
31
|
-
callback=_version_callback,
|
|
32
|
-
is_eager=True,
|
|
33
|
-
),
|
|
34
|
-
) -> None:
|
|
35
|
-
"""refactor CLI."""
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
def _core_feature_unavailable(feature: str) -> None:
|
|
39
|
-
typer.echo(
|
|
40
|
-
f"{feature} is unavailable in this standalone CLI install because "
|
|
41
|
-
"core runtime modules are not installed in Python. Run `refactor setup` "
|
|
42
|
-
"to complete machine bootstrap, then retry."
|
|
43
|
-
)
|
|
44
|
-
raise typer.Exit(code=2)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
try:
|
|
48
|
-
from refactorai_cli.commands import run_cmds as _run_cmds
|
|
49
|
-
except ModuleNotFoundError:
|
|
50
|
-
_run_cmds = None
|
|
51
|
-
|
|
52
|
-
try:
|
|
53
|
-
from refactorai_cli.commands import rules_cmds as _rules_cmds
|
|
54
|
-
except ModuleNotFoundError:
|
|
55
|
-
_rules_cmds = None
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
# Auth (R7.1)
|
|
59
|
-
app.command()(auth_cmds.login)
|
|
60
|
-
app.command()(auth_cmds.whoami)
|
|
61
|
-
|
|
62
|
-
if _run_cmds is not None:
|
|
63
|
-
# Project / run surface
|
|
64
|
-
app.command()(_run_cmds.init)
|
|
65
|
-
app.command()(_run_cmds.start)
|
|
66
|
-
app.command()(_run_cmds.stop)
|
|
67
|
-
app.command()(_run_cmds.shell)
|
|
68
|
-
app.command()(_run_cmds.review)
|
|
69
|
-
app.command()(_run_cmds.code)
|
|
70
|
-
app.command()(_run_cmds.requests)
|
|
71
|
-
app.command()(_run_cmds.apply)
|
|
72
|
-
app.command()(_run_cmds.revert)
|
|
73
|
-
app.command()(_run_cmds.status)
|
|
74
|
-
app.command()(_run_cmds.diff)
|
|
75
|
-
app.command()(_run_cmds.gc)
|
|
76
|
-
app.command()(_run_cmds.check)
|
|
77
|
-
app.command()(_run_cmds.doctor)
|
|
78
|
-
app.command()(_run_cmds.config)
|
|
79
|
-
else:
|
|
80
|
-
@app.command("init")
|
|
81
|
-
def _init_stub() -> None:
|
|
82
|
-
_core_feature_unavailable("`refactor init`")
|
|
83
|
-
|
|
84
|
-
@app.command("start")
|
|
85
|
-
def _start_stub() -> None:
|
|
86
|
-
_core_feature_unavailable("`refactor start`")
|
|
87
|
-
|
|
88
|
-
@app.command("stop")
|
|
89
|
-
def _stop_stub() -> None:
|
|
90
|
-
_core_feature_unavailable("`refactor stop`")
|
|
91
|
-
|
|
92
|
-
@app.command("shell")
|
|
93
|
-
def _shell_stub() -> None:
|
|
94
|
-
_core_feature_unavailable("`refactor shell`")
|
|
95
|
-
|
|
96
|
-
@app.command("review")
|
|
97
|
-
def _review_stub() -> None:
|
|
98
|
-
_core_feature_unavailable("`refactor review`")
|
|
99
|
-
|
|
100
|
-
@app.command("code")
|
|
101
|
-
def _code_stub() -> None:
|
|
102
|
-
_core_feature_unavailable("`refactor code`")
|
|
103
|
-
|
|
104
|
-
@app.command("requests")
|
|
105
|
-
def _requests_stub() -> None:
|
|
106
|
-
_core_feature_unavailable("`refactor requests`")
|
|
107
|
-
|
|
108
|
-
@app.command("apply")
|
|
109
|
-
def _apply_stub() -> None:
|
|
110
|
-
_core_feature_unavailable("`refactor apply`")
|
|
111
|
-
|
|
112
|
-
@app.command("revert")
|
|
113
|
-
def _revert_stub() -> None:
|
|
114
|
-
_core_feature_unavailable("`refactor revert`")
|
|
115
|
-
|
|
116
|
-
@app.command("status")
|
|
117
|
-
def _status_stub() -> None:
|
|
118
|
-
_core_feature_unavailable("`refactor status`")
|
|
119
|
-
|
|
120
|
-
@app.command("diff")
|
|
121
|
-
def _diff_stub() -> None:
|
|
122
|
-
_core_feature_unavailable("`refactor diff`")
|
|
123
|
-
|
|
124
|
-
@app.command("gc")
|
|
125
|
-
def _gc_stub() -> None:
|
|
126
|
-
_core_feature_unavailable("`refactor gc`")
|
|
127
|
-
|
|
128
|
-
@app.command("check")
|
|
129
|
-
def _check_stub() -> None:
|
|
130
|
-
_core_feature_unavailable("`refactor check`")
|
|
131
|
-
|
|
132
|
-
@app.command("doctor")
|
|
133
|
-
def _doctor_stub() -> None:
|
|
134
|
-
_core_feature_unavailable("`refactor doctor`")
|
|
135
|
-
|
|
136
|
-
@app.command("config")
|
|
137
|
-
def _config_stub() -> None:
|
|
138
|
-
_core_feature_unavailable("`refactor config`")
|
|
139
|
-
|
|
140
|
-
app.command()(setup_cmds.setup)
|
|
141
|
-
|
|
142
|
-
# Runtime/engine/model operations.
|
|
143
|
-
if _rules_cmds is not None:
|
|
144
|
-
app.add_typer(_rules_cmds.app, name="rules")
|
|
145
|
-
else:
|
|
146
|
-
rules_stub_app = typer.Typer(help="Rules commands unavailable in this install.")
|
|
147
|
-
|
|
148
|
-
@rules_stub_app.callback(invoke_without_command=True)
|
|
149
|
-
def _rules_stub_callback() -> None:
|
|
150
|
-
_core_feature_unavailable("`refactor rules`")
|
|
151
|
-
|
|
152
|
-
app.add_typer(rules_stub_app, name="rules")
|
|
153
|
-
|
|
154
|
-
app.add_typer(runtime_cmds.app, name="runtime")
|
|
155
|
-
app.add_typer(engine_cmds.app, name="engine")
|
|
156
|
-
app.add_typer(model_cmds.app, name="model")
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
if __name__ == "__main__":
|
|
160
|
-
app()
|
|
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
|