refactorai-cli 0.2.17__tar.gz → 0.2.20__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.17 → refactorai_cli-0.2.20}/PKG-INFO +1 -1
  2. {refactorai_cli-0.2.17 → refactorai_cli-0.2.20}/pyproject.toml +1 -1
  3. {refactorai_cli-0.2.17 → refactorai_cli-0.2.20}/refactorai_cli/__init__.py +1 -1
  4. {refactorai_cli-0.2.17 → refactorai_cli-0.2.20}/refactorai_cli/commands/run_cmds.py +65 -12
  5. {refactorai_cli-0.2.17 → refactorai_cli-0.2.20}/refactorai_cli.egg-info/PKG-INFO +1 -1
  6. {refactorai_cli-0.2.17 → refactorai_cli-0.2.20}/README.md +0 -0
  7. {refactorai_cli-0.2.17 → refactorai_cli-0.2.20}/refactorai_cli/auth.py +0 -0
  8. {refactorai_cli-0.2.17 → refactorai_cli-0.2.20}/refactorai_cli/client.py +0 -0
  9. {refactorai_cli-0.2.17 → refactorai_cli-0.2.20}/refactorai_cli/commands/__init__.py +0 -0
  10. {refactorai_cli-0.2.17 → refactorai_cli-0.2.20}/refactorai_cli/commands/auth_cmds.py +0 -0
  11. {refactorai_cli-0.2.17 → refactorai_cli-0.2.20}/refactorai_cli/commands/engine_cmds.py +0 -0
  12. {refactorai_cli-0.2.17 → refactorai_cli-0.2.20}/refactorai_cli/commands/model_cmds.py +0 -0
  13. {refactorai_cli-0.2.17 → refactorai_cli-0.2.20}/refactorai_cli/commands/rules_cmds.py +0 -0
  14. {refactorai_cli-0.2.17 → refactorai_cli-0.2.20}/refactorai_cli/commands/runtime_cmds.py +0 -0
  15. {refactorai_cli-0.2.17 → refactorai_cli-0.2.20}/refactorai_cli/commands/runtime_proxy_cmds.py +0 -0
  16. {refactorai_cli-0.2.17 → refactorai_cli-0.2.20}/refactorai_cli/commands/setup_cmds.py +0 -0
  17. {refactorai_cli-0.2.17 → refactorai_cli-0.2.20}/refactorai_cli/control_plane.py +0 -0
  18. {refactorai_cli-0.2.17 → refactorai_cli-0.2.20}/refactorai_cli/credentials.py +0 -0
  19. {refactorai_cli-0.2.17 → refactorai_cli-0.2.20}/refactorai_cli/local_constitution.py +0 -0
  20. {refactorai_cli-0.2.17 → refactorai_cli-0.2.20}/refactorai_cli/local_engine_runtime.py +0 -0
  21. {refactorai_cli-0.2.17 → refactorai_cli-0.2.20}/refactorai_cli/local_paths.py +0 -0
  22. {refactorai_cli-0.2.17 → refactorai_cli-0.2.20}/refactorai_cli/main.py +0 -0
  23. {refactorai_cli-0.2.17 → refactorai_cli-0.2.20}/refactorai_cli/model_policy.py +0 -0
  24. {refactorai_cli-0.2.17 → refactorai_cli-0.2.20}/refactorai_cli/runtime_manager.py +0 -0
  25. {refactorai_cli-0.2.17 → refactorai_cli-0.2.20}/refactorai_cli/settings.py +0 -0
  26. {refactorai_cli-0.2.17 → refactorai_cli-0.2.20}/refactorai_cli/setup_flow.py +0 -0
  27. {refactorai_cli-0.2.17 → refactorai_cli-0.2.20}/refactorai_cli.egg-info/SOURCES.txt +0 -0
  28. {refactorai_cli-0.2.17 → refactorai_cli-0.2.20}/refactorai_cli.egg-info/dependency_links.txt +0 -0
  29. {refactorai_cli-0.2.17 → refactorai_cli-0.2.20}/refactorai_cli.egg-info/entry_points.txt +0 -0
  30. {refactorai_cli-0.2.17 → refactorai_cli-0.2.20}/refactorai_cli.egg-info/requires.txt +0 -0
  31. {refactorai_cli-0.2.17 → refactorai_cli-0.2.20}/refactorai_cli.egg-info/top_level.txt +0 -0
  32. {refactorai_cli-0.2.17 → refactorai_cli-0.2.20}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: refactorai-cli
3
- Version: 0.2.17
3
+ Version: 0.2.20
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.17"
3
+ version = "0.2.20"
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.17"
8
+ __version__ = "0.2.20"
@@ -35,7 +35,10 @@ from refactor_core.constitution import (
35
35
  raw_secret_matches,
36
36
  raw_secret_matches_config,
37
37
  )
38
- from refactor_core.compliance_settings import resolve_compliance_selection
38
+ from refactor_core.compliance_settings import (
39
+ ComplianceSelectionError,
40
+ resolve_compliance_selection,
41
+ )
39
42
  from refactor_core.compliance.loader import CompliancePackError, resolve_compliance_packs
40
43
  from refactor_core.compliance.models import CompliancePackResolution
41
44
  from refactor_core.compliance.evidence import build_compliance_evidence_bundle, evaluate_compliance_gate
@@ -184,6 +187,25 @@ _REQUIRED_ENV_BY_PROVIDER: dict[str, list[object]] = {
184
187
  }
185
188
 
186
189
 
190
+ def _sanitize_runtime_error_message(message: object) -> str:
191
+ """Normalize provider/runtime errors to runtime-artifact-friendly guidance."""
192
+ text = str(message or "").strip()
193
+ if not text:
194
+ return "unknown"
195
+ install_hint = re.search(
196
+ r"Install with:\s*pip install ['\"]refactor-core(?:\[[^'\"]+\])?['\"]",
197
+ text,
198
+ flags=re.IGNORECASE,
199
+ )
200
+ if install_hint:
201
+ return (
202
+ "Bedrock credentials are not configured for runtime execution. "
203
+ "Set AWS_BEARER_TOKEN_BEDROCK (for example: `set -a; source .env; set +a`) "
204
+ "or run with AWS SDK credentials in an environment that includes boto3."
205
+ )
206
+ return text
207
+
208
+
187
209
  def _agent_progress_logger(
188
210
  stage: str, *, status=None, verbose_steps: bool = True
189
211
  ) -> Callable[[dict], None]:
@@ -302,16 +324,18 @@ def _agent_progress_logger(
302
324
  f"[dim]{stage}: step {event.get('step', '?')} result -> {summary}[/dim]"
303
325
  )
304
326
  elif kind == "tool_error":
327
+ error_text = _sanitize_runtime_error_message(event.get("error", "unknown"))
305
328
  console.print(
306
329
  f"[yellow]{stage}: step {event.get('step', '?')} tool `{event.get('tool', '?')}` "
307
- f"error: {event.get('error', 'unknown')}[/yellow]"
330
+ f"error: {error_text}[/yellow]"
308
331
  )
309
332
  elif kind == "invalid_response":
310
333
  console.print(f"[yellow]{stage}: step {event.get('step', '?')} returned invalid JSON tool call.[/yellow]")
311
334
  elif kind == "transport_error":
335
+ error_text = _sanitize_runtime_error_message(event.get("error", "unknown"))
312
336
  console.print(
313
337
  f"[yellow]{stage}: model transport error at step {event.get('step', '?')}: "
314
- f"{event.get('error', 'unknown')}[/yellow]"
338
+ f"{error_text}[/yellow]"
315
339
  )
316
340
  elif kind == "finish":
317
341
  _set_status(
@@ -1554,6 +1578,9 @@ def review(
1554
1578
  cli_canary_percent=compliance_canary_percent,
1555
1579
  )
1556
1580
  )
1581
+ except ComplianceSelectionError as exc:
1582
+ console.print(f"[red]review: invalid compliance selection:[/red] {exc}")
1583
+ raise typer.Exit(code=2) from exc
1557
1584
  except CompliancePackError as exc:
1558
1585
  console.print(f"[red]review: compliance pack resolution failed:[/red] {exc}")
1559
1586
  raise typer.Exit(code=1) from exc
@@ -1630,7 +1657,7 @@ def review(
1630
1657
  "Review continued; address sandbox install/toolchain incompatibilities for best results."
1631
1658
  )
1632
1659
  except Exception as exc: # provider/transport errors should not crash the CLI
1633
- console.print(f"[red]Review failed:[/red] {exc}")
1660
+ console.print(f"[red]Review failed:[/red] {_sanitize_runtime_error_message(exc)}")
1634
1661
  raise typer.Exit(code=1) from exc
1635
1662
  finally:
1636
1663
  _teardown_sandbox_context(project_root, sandbox_ctx)
@@ -1655,6 +1682,14 @@ def review(
1655
1682
  )
1656
1683
  _apply_compliance_gate_to_artifact(artifact)
1657
1684
  run_store.write_artifact(artifact, target=target, status="completed")
1685
+ if compliance_frameworks:
1686
+ summary = dict(getattr(artifact, "compliance_summary", {}) or {})
1687
+ console.print(
1688
+ "[dim]review: compliance projection "
1689
+ f"projected={int(summary.get('projected_count', 0) or 0)} "
1690
+ f"blocked={int(summary.get('blocked_count', 0) or 0)} "
1691
+ f"warned={int(summary.get('warned_count', 0) or 0)}[/dim]"
1692
+ )
1658
1693
  if compliance_frameworks:
1659
1694
  artifact.notes.append(
1660
1695
  "Compliance selection: frameworks="
@@ -1762,6 +1797,9 @@ def code(
1762
1797
  cli_canary_percent=compliance_canary_percent,
1763
1798
  )
1764
1799
  )
1800
+ except ComplianceSelectionError as exc:
1801
+ console.print(f"[red]code: invalid compliance selection:[/red] {exc}")
1802
+ raise typer.Exit(code=2) from exc
1765
1803
  except CompliancePackError as exc:
1766
1804
  console.print(f"[red]code: compliance pack resolution failed:[/red] {exc}")
1767
1805
  raise typer.Exit(code=1) from exc
@@ -1845,6 +1883,14 @@ def code(
1845
1883
  artifact=review_artifact,
1846
1884
  )
1847
1885
  _apply_compliance_gate_to_artifact(review_artifact)
1886
+ if compliance_frameworks:
1887
+ summary = dict(getattr(review_artifact, "compliance_summary", {}) or {})
1888
+ console.print(
1889
+ "[dim]review: compliance projection "
1890
+ f"projected={int(summary.get('projected_count', 0) or 0)} "
1891
+ f"blocked={int(summary.get('blocked_count', 0) or 0)} "
1892
+ f"warned={int(summary.get('warned_count', 0) or 0)}[/dim]"
1893
+ )
1848
1894
  if compliance_frameworks:
1849
1895
  review_artifact.notes.append(
1850
1896
  "Compliance selection: frameworks="
@@ -1897,7 +1943,7 @@ def code(
1897
1943
  equivalence_mode=equivalence,
1898
1944
  )
1899
1945
  except Exception as exc:
1900
- console.print(f"[red]Refactor failed:[/red] {exc}")
1946
+ console.print(f"[red]Refactor failed:[/red] {_sanitize_runtime_error_message(exc)}")
1901
1947
  raise typer.Exit(code=1) from exc
1902
1948
  finally:
1903
1949
  _teardown_sandbox_context(project_root, sandbox_ctx)
@@ -2051,13 +2097,20 @@ def compliance(
2051
2097
  """Show/export compliance packs, coverage, and rule details."""
2052
2098
  _require_auth()
2053
2099
  _project_root, _constitution, project_config = _load_project()
2054
- frameworks, level, resolution, rollout_mode, canary_percent = _resolve_compliance_context(
2055
- project_config=project_config,
2056
- cli_frameworks=compliance_framework,
2057
- cli_level=compliance_level,
2058
- cli_rollout=compliance_rollout,
2059
- cli_canary_percent=compliance_canary_percent,
2060
- )
2100
+ try:
2101
+ frameworks, level, resolution, rollout_mode, canary_percent = _resolve_compliance_context(
2102
+ project_config=project_config,
2103
+ cli_frameworks=compliance_framework,
2104
+ cli_level=compliance_level,
2105
+ cli_rollout=compliance_rollout,
2106
+ cli_canary_percent=compliance_canary_percent,
2107
+ )
2108
+ except ComplianceSelectionError as exc:
2109
+ console.print(f"[red]compliance: invalid selection:[/red] {exc}")
2110
+ raise typer.Exit(code=2) from exc
2111
+ except CompliancePackError as exc:
2112
+ console.print(f"[red]compliance: pack resolution failed:[/red] {exc}")
2113
+ raise typer.Exit(code=1) from exc
2061
2114
  mode = str(action or "show").strip().lower()
2062
2115
  if mode not in {"status", "show", "coverage", "explain", "export"}:
2063
2116
  console.print(f"[red]Unknown compliance action:[/red] {action}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: refactorai-cli
3
- Version: 0.2.17
3
+ Version: 0.2.20
4
4
  Summary: Local-first CLI for the refactor platform
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown