refactorai-cli 0.7.2__tar.gz → 0.7.3__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.7.2 → refactorai_cli-0.7.3}/PKG-INFO +1 -1
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/pyproject.toml +1 -1
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/__init__.py +1 -1
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/auth_cmds.py +39 -2
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/run_cmds.py +18 -14
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/main.py +1 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli.egg-info/PKG-INFO +1 -1
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/README.md +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/auth.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/client.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/cloud_rr.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/__init__.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/account_cmds.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/branch_cmds.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/cloud_cmds.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/engine_cmds.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/hook_cmds.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/model_cmds.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/policy_cmds.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/pre_push_cmds.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/request_cmds.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/rules_cmds.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/runtime_cmds.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/runtime_proxy_cmds.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/setup_cmds.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/toolchains_cmds.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/watch_cmds.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/workspace_cmds.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commit_queue.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commit_telemetry.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/control_plane.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/credentials.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/dotenv_loader.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/git_scope.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/local_constitution.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/local_engine_runtime.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/local_paths.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/model_policy.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/pre_push_gate.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/refactor_branch_store.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/review_runner.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/runtime_manager.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/settings.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/setup_flow.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/watch_ledger.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/watch_state.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/watch_supervisor.py +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli.egg-info/SOURCES.txt +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli.egg-info/dependency_links.txt +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli.egg-info/entry_points.txt +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli.egg-info/requires.txt +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli.egg-info/top_level.txt +0 -0
- {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/setup.cfg +0 -0
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
"""`refactor login` and `refactor whoami`."""
|
|
1
|
+
"""`refactor login`, `refactor logout`, and `refactor whoami`."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
+
import shutil
|
|
6
|
+
|
|
5
7
|
import typer
|
|
6
8
|
from rich.console import Console
|
|
7
9
|
|
|
8
10
|
from refactorai_cli.auth import AuthError, ensure_authenticated
|
|
9
11
|
from refactorai_cli.client import PlatformClient, PlatformError
|
|
10
12
|
from refactorai_cli.credentials import load_credentials, save_credentials
|
|
11
|
-
from refactorai_cli.
|
|
13
|
+
from refactorai_cli.local_paths import credentials_path, validation_cache_dir
|
|
14
|
+
from refactorai_cli.settings import env_api_key, mask_key, platform_url
|
|
12
15
|
|
|
13
16
|
console = Console()
|
|
14
17
|
|
|
@@ -86,3 +89,37 @@ def whoami() -> None:
|
|
|
86
89
|
f"[bold]key[/bold]: {mask_key(ctx.key.key)} (source: {source})\n"
|
|
87
90
|
f"[bold]quota_remaining[/bold]: {quota}{suffix}"
|
|
88
91
|
)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def logout() -> None:
|
|
95
|
+
"""Clear central credentials and cached key validation state."""
|
|
96
|
+
creds_path = credentials_path()
|
|
97
|
+
cache_dir = validation_cache_dir()
|
|
98
|
+
removed_credentials = False
|
|
99
|
+
removed_cache = False
|
|
100
|
+
|
|
101
|
+
try:
|
|
102
|
+
if creds_path.exists():
|
|
103
|
+
creds_path.unlink()
|
|
104
|
+
removed_credentials = True
|
|
105
|
+
except OSError as exc:
|
|
106
|
+
console.print(f"[red]Logout failed:[/red] Could not remove {creds_path}: {exc}")
|
|
107
|
+
raise typer.Exit(code=1) from exc
|
|
108
|
+
|
|
109
|
+
try:
|
|
110
|
+
if cache_dir.exists():
|
|
111
|
+
shutil.rmtree(cache_dir)
|
|
112
|
+
removed_cache = True
|
|
113
|
+
except OSError as exc:
|
|
114
|
+
console.print(f"[red]Logout failed:[/red] Could not remove {cache_dir}: {exc}")
|
|
115
|
+
raise typer.Exit(code=1) from exc
|
|
116
|
+
|
|
117
|
+
if removed_credentials or removed_cache:
|
|
118
|
+
console.print("[green]Logged out.[/green] Cleared saved credentials and validation cache.")
|
|
119
|
+
else:
|
|
120
|
+
console.print("[dim]No saved credentials were found.[/dim]")
|
|
121
|
+
if env_api_key():
|
|
122
|
+
console.print(
|
|
123
|
+
"[yellow]Note:[/yellow] REFACTOR_API_KEY is set in your environment; "
|
|
124
|
+
"that key still takes precedence."
|
|
125
|
+
)
|
|
@@ -1266,9 +1266,7 @@ def init(
|
|
|
1266
1266
|
config_target.write_text(config_text, encoding="utf-8")
|
|
1267
1267
|
|
|
1268
1268
|
constitution = load_constitution(consti_target)
|
|
1269
|
-
|
|
1270
|
-
project_root, constitution_hash=constitution.content_hash, project_id=project_id
|
|
1271
|
-
)
|
|
1269
|
+
register_project(project_root, constitution_hash=constitution.content_hash, project_id=project_id)
|
|
1272
1270
|
|
|
1273
1271
|
# Org-governed projects: materialize the resolved org policy + config
|
|
1274
1272
|
# guardrails at HOME level only (never in the repo). The committed
|
|
@@ -1301,11 +1299,21 @@ def init(
|
|
|
1301
1299
|
|
|
1302
1300
|
console.print(f"[green]Created[/green] {consti_target}")
|
|
1303
1301
|
console.print(f"[green]Created[/green] {config_target}")
|
|
1304
|
-
|
|
1302
|
+
account_type = str((account_ctx or {}).get("type") or "").strip().lower()
|
|
1303
|
+
account_name = str((account_ctx or {}).get("display_name") or "").strip()
|
|
1304
|
+
account_slug = str((account_ctx or {}).get("slug") or account_slug or "").strip()
|
|
1305
|
+
if account_type == "organization":
|
|
1306
|
+
account_label = "organization"
|
|
1307
|
+
elif account_type:
|
|
1308
|
+
account_label = account_type
|
|
1309
|
+
else:
|
|
1310
|
+
account_label = "account"
|
|
1311
|
+
account_parts = [part for part in (account_name, account_slug) if part]
|
|
1312
|
+
account_value = " / ".join(account_parts) if account_parts else auth_ctx.account_id
|
|
1305
1313
|
console.print(
|
|
1306
|
-
f"[green]Linked[/green]
|
|
1307
|
-
f"{
|
|
1308
|
-
"
|
|
1314
|
+
f"[green]Linked[/green] cloud project [bold]{project_name}[/bold]. "
|
|
1315
|
+
f"{account_label.title()}: [bold]{account_value}[/bold]. "
|
|
1316
|
+
f"Project id saved in {CONFIG_FILENAME}."
|
|
1309
1317
|
)
|
|
1310
1318
|
if config_profile == "local_server":
|
|
1311
1319
|
console.print(
|
|
@@ -1318,12 +1326,8 @@ def init(
|
|
|
1318
1326
|
"(mode=cloud_byok, env-key-first via provider_key; credential_ref is optional fallback)."
|
|
1319
1327
|
)
|
|
1320
1328
|
console.print(
|
|
1321
|
-
f"
|
|
1322
|
-
|
|
1323
|
-
console.print(
|
|
1324
|
-
f"Only {CONSTITUTION_FILENAME} and {CONFIG_FILENAME} are added to your repo; "
|
|
1325
|
-
"all run state stays under ~/.refactor "
|
|
1326
|
-
f"(encoded: {record['encoded']})."
|
|
1329
|
+
f"Only {CONSTITUTION_FILENAME} and {CONFIG_FILENAME} are added to your repo. "
|
|
1330
|
+
"Runtime state stays outside the repository."
|
|
1327
1331
|
)
|
|
1328
1332
|
if org_cached_meta is not None:
|
|
1329
1333
|
policy_meta = org_cached_meta.get("policy", {}) if isinstance(org_cached_meta, dict) else {}
|
|
@@ -1333,7 +1337,7 @@ def init(
|
|
|
1333
1337
|
console.print(
|
|
1334
1338
|
f"[green]Applied[/green] organization policy (v{version}) from account "
|
|
1335
1339
|
f"[bold]{org_cached_meta.get('account_slug') or account_slug}[/bold]. "
|
|
1336
|
-
f"It is cached
|
|
1340
|
+
f"It is cached locally and layered above your "
|
|
1337
1341
|
f"editable {CONSTITUTION_FILENAME} charter at run time; it is never "
|
|
1338
1342
|
"written into your repo."
|
|
1339
1343
|
)
|
|
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
|
|
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
|