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.
Files changed (53) hide show
  1. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/PKG-INFO +1 -1
  2. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/pyproject.toml +1 -1
  3. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/__init__.py +1 -1
  4. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/auth_cmds.py +39 -2
  5. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/run_cmds.py +18 -14
  6. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/main.py +1 -0
  7. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli.egg-info/PKG-INFO +1 -1
  8. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/README.md +0 -0
  9. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/auth.py +0 -0
  10. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/client.py +0 -0
  11. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/cloud_rr.py +0 -0
  12. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/__init__.py +0 -0
  13. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/account_cmds.py +0 -0
  14. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/branch_cmds.py +0 -0
  15. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/cloud_cmds.py +0 -0
  16. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/engine_cmds.py +0 -0
  17. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/hook_cmds.py +0 -0
  18. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/model_cmds.py +0 -0
  19. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/policy_cmds.py +0 -0
  20. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/pre_push_cmds.py +0 -0
  21. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/request_cmds.py +0 -0
  22. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/rules_cmds.py +0 -0
  23. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/runtime_cmds.py +0 -0
  24. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/runtime_proxy_cmds.py +0 -0
  25. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/setup_cmds.py +0 -0
  26. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/toolchains_cmds.py +0 -0
  27. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/watch_cmds.py +0 -0
  28. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commands/workspace_cmds.py +0 -0
  29. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commit_queue.py +0 -0
  30. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/commit_telemetry.py +0 -0
  31. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/control_plane.py +0 -0
  32. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/credentials.py +0 -0
  33. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/dotenv_loader.py +0 -0
  34. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/git_scope.py +0 -0
  35. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/local_constitution.py +0 -0
  36. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/local_engine_runtime.py +0 -0
  37. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/local_paths.py +0 -0
  38. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/model_policy.py +0 -0
  39. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/pre_push_gate.py +0 -0
  40. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/refactor_branch_store.py +0 -0
  41. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/review_runner.py +0 -0
  42. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/runtime_manager.py +0 -0
  43. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/settings.py +0 -0
  44. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/setup_flow.py +0 -0
  45. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/watch_ledger.py +0 -0
  46. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/watch_state.py +0 -0
  47. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli/watch_supervisor.py +0 -0
  48. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli.egg-info/SOURCES.txt +0 -0
  49. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli.egg-info/dependency_links.txt +0 -0
  50. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli.egg-info/entry_points.txt +0 -0
  51. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli.egg-info/requires.txt +0 -0
  52. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/refactorai_cli.egg-info/top_level.txt +0 -0
  53. {refactorai_cli-0.7.2 → refactorai_cli-0.7.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: refactorai-cli
3
- Version: 0.7.2
3
+ Version: 0.7.3
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.7.2"
3
+ version = "0.7.3"
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.7.2"
8
+ __version__ = "0.7.3"
@@ -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.settings import mask_key, platform_url
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
- record = register_project(
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
- account_note = f" (account {account_slug})" if account_slug else ""
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] to cloud project [bold]{project_name}[/bold]"
1307
- f"{account_note}. The project id is saved in {CONFIG_FILENAME}; "
1308
- "rename the project or attach a repository anytime from the web UI."
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"[green]Registered[/green] project in central store: {resolve_store_dir(project_root)}"
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 read-only under ~/.refactor and layered above your "
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
  )
@@ -119,6 +119,7 @@ def main(
119
119
 
120
120
  # Auth (R7.1)
121
121
  app.command()(auth_cmds.login)
122
+ app.command()(auth_cmds.logout)
122
123
  app.command()(auth_cmds.whoami)
123
124
  app.add_typer(account_cmds.app, name="account")
124
125
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: refactorai-cli
3
- Version: 0.7.2
3
+ Version: 0.7.3
4
4
  Summary: Local-first CLI for the refactor platform
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
File without changes
File without changes