refactorai-cli 0.5.8__tar.gz → 0.5.9__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 (50) hide show
  1. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/PKG-INFO +1 -1
  2. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/pyproject.toml +1 -1
  3. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/__init__.py +1 -1
  4. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/cloud_rr.py +47 -2
  5. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli.egg-info/PKG-INFO +1 -1
  6. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/README.md +0 -0
  7. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/auth.py +0 -0
  8. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/client.py +0 -0
  9. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/commands/__init__.py +0 -0
  10. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/commands/account_cmds.py +0 -0
  11. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/commands/auth_cmds.py +0 -0
  12. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/commands/branch_cmds.py +0 -0
  13. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/commands/cloud_cmds.py +0 -0
  14. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/commands/engine_cmds.py +0 -0
  15. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/commands/hook_cmds.py +0 -0
  16. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/commands/model_cmds.py +0 -0
  17. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/commands/pre_push_cmds.py +0 -0
  18. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/commands/request_cmds.py +0 -0
  19. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/commands/rules_cmds.py +0 -0
  20. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/commands/run_cmds.py +0 -0
  21. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/commands/runtime_cmds.py +0 -0
  22. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/commands/runtime_proxy_cmds.py +0 -0
  23. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/commands/setup_cmds.py +0 -0
  24. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/commands/toolchains_cmds.py +0 -0
  25. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/commands/watch_cmds.py +0 -0
  26. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/commit_queue.py +0 -0
  27. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/commit_telemetry.py +0 -0
  28. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/control_plane.py +0 -0
  29. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/credentials.py +0 -0
  30. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/dotenv_loader.py +0 -0
  31. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/git_scope.py +0 -0
  32. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/local_constitution.py +0 -0
  33. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/local_engine_runtime.py +0 -0
  34. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/local_paths.py +0 -0
  35. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/main.py +0 -0
  36. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/model_policy.py +0 -0
  37. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/pre_push_gate.py +0 -0
  38. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/refactor_branch_store.py +0 -0
  39. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/review_runner.py +0 -0
  40. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/runtime_manager.py +0 -0
  41. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/settings.py +0 -0
  42. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/setup_flow.py +0 -0
  43. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/watch_state.py +0 -0
  44. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli/watch_supervisor.py +0 -0
  45. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli.egg-info/SOURCES.txt +0 -0
  46. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli.egg-info/dependency_links.txt +0 -0
  47. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli.egg-info/entry_points.txt +0 -0
  48. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli.egg-info/requires.txt +0 -0
  49. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/refactorai_cli.egg-info/top_level.txt +0 -0
  50. {refactorai_cli-0.5.8 → refactorai_cli-0.5.9}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: refactorai-cli
3
- Version: 0.5.8
3
+ Version: 0.5.9
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.5.8"
3
+ version = "0.5.9"
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.5.8"
8
+ __version__ = "0.5.9"
@@ -49,6 +49,7 @@ from refactor_core.refactor_requests import (
49
49
  DENIED,
50
50
  FAILED,
51
51
  IN_PROGRESS,
52
+ RefactorAttempt,
52
53
  pending_requests,
53
54
  rr_test_dir,
54
55
  save_request,
@@ -1025,8 +1026,16 @@ def run_cloud_refactor_requests(
1025
1026
  diff_text = str(action.get("diff_text", "") or "")
1026
1027
  attempt = int(action.get("attempt", 1) or 1)
1027
1028
  attempts_by_id[current_rr_id] = attempt
1029
+ _PENDING_ATTEMPT[current_rr_id] = RefactorAttempt(
1030
+ proposal_n=attempt,
1031
+ diff_text=diff_text,
1032
+ )
1028
1033
  ok, why = validate_diff(project_root, diff_text)
1029
1034
  if not ok:
1035
+ pending = _PENDING_ATTEMPT.pop(current_rr_id, None)
1036
+ if pending is not None:
1037
+ pending.detail = f"invalid diff: {why}"
1038
+ _persist_attempt(project_root, rr, pending, attempt)
1030
1039
  _emit(progress_cb, phase="rr", event="proposal_invalid", attempt=attempt, reason=why)
1031
1040
  action = session.step(
1032
1041
  _step_payload(token, current_rr_id, "verify_result", by_id, project_root,
@@ -1044,6 +1053,14 @@ def run_cloud_refactor_requests(
1044
1053
  "risk": action.get("risk", "medium"),
1045
1054
  "diff_text": diff_text,
1046
1055
  }))
1056
+ pending = _PENDING_ATTEMPT.get(current_rr_id)
1057
+ if pending is not None:
1058
+ pending.approved = approved
1059
+ if not approved:
1060
+ pending = _PENDING_ATTEMPT.pop(current_rr_id, None)
1061
+ if pending is not None:
1062
+ pending.detail = "denied by developer"
1063
+ _persist_attempt(project_root, rr, pending, attempt)
1047
1064
  _emit(progress_cb, phase="rr", event="approval_decision", rr_id=current_rr_id, approved=approved)
1048
1065
  _PENDING_DIFF[current_rr_id] = diff_text
1049
1066
  action = session.step(
@@ -1058,18 +1075,32 @@ def run_cloud_refactor_requests(
1058
1075
  if verdict == "":
1059
1076
  # Server approved: client applies + verifies, then posts result.
1060
1077
  current_rr_id = action.get("rr_id", "") or current_rr_id
1078
+ rr = by_id.get(current_rr_id)
1061
1079
  diff_text = _PENDING_DIFF.get(current_rr_id, "")
1080
+ attempt_n = attempts_by_id.get(current_rr_id, 1)
1081
+ pending = _PENDING_ATTEMPT.pop(current_rr_id, None)
1082
+ if pending is None:
1083
+ pending = RefactorAttempt(
1084
+ proposal_n=attempt_n,
1085
+ diff_text=diff_text,
1086
+ approved=True,
1087
+ )
1062
1088
  passed, detail, files = _apply_and_verify(
1063
1089
  project_root, run_store.run_dir, diff_text, test_command, env=toolchain_env
1064
1090
  )
1091
+ pending.applied = True
1065
1092
  if passed:
1093
+ pending.test_passed = True
1066
1094
  _emit(progress_cb, phase="rr", event="rr_applied", rr_id=current_rr_id, files=files)
1067
1095
  else:
1096
+ pending.reverted = True
1097
+ pending.detail = f"verification failed: {detail}"
1068
1098
  _emit(progress_cb, phase="rr", event="rr_reverted", rr_id=current_rr_id,
1069
- attempt=attempts_by_id.get(current_rr_id, 1), detail=detail)
1099
+ attempt=attempt_n, detail=detail)
1100
+ _persist_attempt(project_root, rr, pending, attempt_n)
1070
1101
  action = session.step(
1071
1102
  _step_payload(token, current_rr_id, "verify_result", by_id, project_root,
1072
- attempt=attempts_by_id.get(current_rr_id, 1),
1103
+ attempt=attempt_n,
1073
1104
  verify_passed=passed, verify_detail=detail)
1074
1105
  )
1075
1106
  token = action.get("session_token", token)
@@ -1110,6 +1141,20 @@ def run_cloud_refactor_requests(
1110
1141
 
1111
1142
  # Diffs approved but not yet applied, keyed by rr_id (client-local, per run).
1112
1143
  _PENDING_DIFF: dict[str, str] = {}
1144
+ # Attempt snapshots keyed by rr_id; persisted when each proposal reaches a
1145
+ # terminal sub-outcome so telemetry can carry attempts[].diff_text.
1146
+ _PENDING_ATTEMPT: dict[str, RefactorAttempt] = {}
1147
+
1148
+
1149
+ def _persist_attempt(project_root: Path, rr, attempt: RefactorAttempt | None, attempt_n: int) -> None:
1150
+ if rr is None or attempt is None:
1151
+ return
1152
+ rr.attempts.append(attempt)
1153
+ rr.attempt_count = max(
1154
+ int(getattr(rr, "attempt_count", 0) or 0),
1155
+ int(attempt_n or getattr(attempt, "proposal_n", 0) or 0),
1156
+ )
1157
+ save_request(project_root, rr)
1113
1158
 
1114
1159
 
1115
1160
  def _step_payload(token, rr_id, step, by_id, project_root, *, attempt: int = 0, **kw) -> dict:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: refactorai-cli
3
- Version: 0.5.8
3
+ Version: 0.5.9
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