conduct-cli 0.6.12__tar.gz → 0.6.15__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 (34) hide show
  1. {conduct_cli-0.6.12 → conduct_cli-0.6.15}/PKG-INFO +1 -1
  2. {conduct_cli-0.6.12 → conduct_cli-0.6.15}/pyproject.toml +1 -1
  3. {conduct_cli-0.6.12 → conduct_cli-0.6.15}/src/conduct_cli/guard.py +81 -2
  4. {conduct_cli-0.6.12 → conduct_cli-0.6.15}/src/conduct_cli.egg-info/PKG-INFO +1 -1
  5. {conduct_cli-0.6.12 → conduct_cli-0.6.15}/README.md +0 -0
  6. {conduct_cli-0.6.12 → conduct_cli-0.6.15}/setup.cfg +0 -0
  7. {conduct_cli-0.6.12 → conduct_cli-0.6.15}/setup.py +0 -0
  8. {conduct_cli-0.6.12 → conduct_cli-0.6.15}/src/conduct_cli/__init__.py +0 -0
  9. {conduct_cli-0.6.12 → conduct_cli-0.6.15}/src/conduct_cli/api.py +0 -0
  10. {conduct_cli-0.6.12 → conduct_cli-0.6.15}/src/conduct_cli/guardmcp.py +0 -0
  11. {conduct_cli-0.6.12 → conduct_cli-0.6.15}/src/conduct_cli/hook_precompact_template.py +0 -0
  12. {conduct_cli-0.6.12 → conduct_cli-0.6.15}/src/conduct_cli/hook_session_start_template.py +0 -0
  13. {conduct_cli-0.6.12 → conduct_cli-0.6.15}/src/conduct_cli/hook_stop_template.py +0 -0
  14. {conduct_cli-0.6.12 → conduct_cli-0.6.15}/src/conduct_cli/hook_template.py +0 -0
  15. {conduct_cli-0.6.12 → conduct_cli-0.6.15}/src/conduct_cli/log_util.py +0 -0
  16. {conduct_cli-0.6.12 → conduct_cli-0.6.15}/src/conduct_cli/main.py +0 -0
  17. {conduct_cli-0.6.12 → conduct_cli-0.6.15}/src/conduct_cli/mcp_server.py +0 -0
  18. {conduct_cli-0.6.12 → conduct_cli-0.6.15}/src/conduct_cli/memory.py +0 -0
  19. {conduct_cli-0.6.12 → conduct_cli-0.6.15}/src/conduct_cli/paxel.py +0 -0
  20. {conduct_cli-0.6.12 → conduct_cli-0.6.15}/src/conduct_cli.egg-info/SOURCES.txt +0 -0
  21. {conduct_cli-0.6.12 → conduct_cli-0.6.15}/src/conduct_cli.egg-info/dependency_links.txt +0 -0
  22. {conduct_cli-0.6.12 → conduct_cli-0.6.15}/src/conduct_cli.egg-info/entry_points.txt +0 -0
  23. {conduct_cli-0.6.12 → conduct_cli-0.6.15}/src/conduct_cli.egg-info/requires.txt +0 -0
  24. {conduct_cli-0.6.12 → conduct_cli-0.6.15}/src/conduct_cli.egg-info/top_level.txt +0 -0
  25. {conduct_cli-0.6.12 → conduct_cli-0.6.15}/tests/test_bash_operator_signature.py +0 -0
  26. {conduct_cli-0.6.12 → conduct_cli-0.6.15}/tests/test_command_word_matcher.py +0 -0
  27. {conduct_cli-0.6.12 → conduct_cli-0.6.15}/tests/test_guard_policy.py +0 -0
  28. {conduct_cli-0.6.12 → conduct_cli-0.6.15}/tests/test_guard_savings.py +0 -0
  29. {conduct_cli-0.6.12 → conduct_cli-0.6.15}/tests/test_hook_syntax.py +0 -0
  30. {conduct_cli-0.6.12 → conduct_cli-0.6.15}/tests/test_journal_drain.py +0 -0
  31. {conduct_cli-0.6.12 → conduct_cli-0.6.15}/tests/test_log_util.py +0 -0
  32. {conduct_cli-0.6.12 → conduct_cli-0.6.15}/tests/test_proxy_env.py +0 -0
  33. {conduct_cli-0.6.12 → conduct_cli-0.6.15}/tests/test_signed_policy.py +0 -0
  34. {conduct_cli-0.6.12 → conduct_cli-0.6.15}/tests/test_switch.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: conduct-cli
3
- Version: 0.6.12
3
+ Version: 0.6.15
4
4
  Summary: CLI for Conduct AI — install agents, manage projects, run tests
5
5
  Author-email: Conduct AI <hello@conductai.ai>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "conduct-cli"
7
- version = "0.6.12"
7
+ version = "0.6.15"
8
8
  description = "CLI for Conduct AI — install agents, manage projects, run tests"
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
@@ -305,6 +305,9 @@ _MCP_TARGETS = [
305
305
  (Path.home() / ".cursor" / "mcp.json", "Cursor"),
306
306
  (Path.home() / ".windsurf" / "mcp.json", "Windsurf"),
307
307
  (Path.home() / ".codex" / "mcp.json", "Codex"),
308
+ # Claude Desktop — only if already installed
309
+ (Path.home() / "Library" / "Application Support" / "Claude" / "claude_desktop_config.json", "Claude Desktop"),
310
+ (Path.home() / "AppData" / "Roaming" / "Claude" / "claude_desktop_config.json", "Claude Desktop"),
308
311
  ]
309
312
 
310
313
 
@@ -346,6 +349,82 @@ def _register_mcp(workspace_id: str, member_token: str, api_url: str) -> None:
346
349
  if not found_any:
347
350
  print(f" {GRAY}No AI tool configs found for MCP registration{RESET}")
348
351
 
352
+ # Claude Desktop doesn't source shell env — patch apiBaseUrl directly in config
353
+ # so all LLM calls route through the Guard proxy (PII blocking, spend limits, audit).
354
+ _patch_claude_desktop_proxy(api_url, member_token)
355
+
356
+ # Cursor global rules — write Guard policies as user rules so they apply across all projects.
357
+ _patch_cursor_global_rules()
358
+
359
+
360
+ def _patch_claude_desktop_proxy(api_url: str, member_token: str) -> None:
361
+ """Patch Claude Desktop config to route LLM calls through the Guard proxy.
362
+
363
+ Claude Desktop reads apiBaseUrl from its config JSON — it does not source
364
+ shell env vars, so ANTHROPIC_BASE_URL has no effect. We write the proxy
365
+ URL directly so PII blocking, spend limits, and audit apply to Desktop too.
366
+ """
367
+ proxy_url = f"{api_url}/proxy/anthropic"
368
+ candidates = [
369
+ Path.home() / "Library" / "Application Support" / "Claude" / "claude_desktop_config.json",
370
+ Path.home() / "AppData" / "Roaming" / "Claude" / "claude_desktop_config.json",
371
+ ]
372
+ for cfg_path in candidates:
373
+ if not cfg_path.exists():
374
+ continue
375
+ try:
376
+ cfg = json.loads(cfg_path.read_text())
377
+ except (json.JSONDecodeError, OSError):
378
+ cfg = {}
379
+ current = cfg.get("apiBaseUrl", "")
380
+ if current == proxy_url:
381
+ print(f" {GRAY}Claude Desktop proxy already set → {proxy_url}{RESET}")
382
+ continue
383
+ cfg["apiBaseUrl"] = proxy_url
384
+ cfg_path.write_text(json.dumps(cfg, indent=2))
385
+ print(f" {GREEN}Claude Desktop proxy set → {proxy_url}{RESET}")
386
+ print(f" {YELLOW}Restart Claude Desktop for proxy routing to take effect{RESET}")
387
+
388
+
389
+ def _patch_cursor_global_rules() -> None:
390
+ """Write ConductGuard policy rules into Cursor's global user rules setting.
391
+
392
+ Cursor IDE stores global rules in settings.json under cursor.rules.user —
393
+ a plain text string injected as system context for every conversation.
394
+ This is soft enforcement (prompt-level), not structural like Claude Code hooks,
395
+ but ensures Guard policies are visible to the model across all Cursor projects.
396
+ """
397
+ GUARD_RULES = (
398
+ "# ConductGuard — team AI policies (managed by conduct guard sync)\n"
399
+ "- ALWAYS call guard_check (via conductguard MCP) before running shell commands, "
400
+ "reading or writing files, accessing external APIs, or modifying code.\n"
401
+ "- NEVER write credentials, API keys, or secrets to files or output.\n"
402
+ "- NEVER send PII (emails, names, SSNs, payment data) to external endpoints.\n"
403
+ "- If guard_check returns BLOCKED: stop and explain the policy rule to the user.\n"
404
+ "- If guard_check returns WARNING: proceed but surface the warning.\n"
405
+ "- These rules are enforced by your team's ConductGuard policy. Do not bypass them."
406
+ )
407
+
408
+ candidates = [
409
+ Path.home() / "Library" / "Application Support" / "Cursor" / "User" / "settings.json",
410
+ Path.home() / ".config" / "Cursor" / "User" / "settings.json",
411
+ Path.home() / "AppData" / "Roaming" / "Cursor" / "User" / "settings.json",
412
+ ]
413
+ for settings_path in candidates:
414
+ if not settings_path.exists():
415
+ continue
416
+ try:
417
+ cfg = json.loads(settings_path.read_text())
418
+ except (json.JSONDecodeError, OSError):
419
+ cfg = {}
420
+ existing = cfg.get("cursor.rules.user", "")
421
+ if "ConductGuard" in existing:
422
+ print(f" {GRAY}Cursor global rules already contain ConductGuard policy{RESET}")
423
+ continue
424
+ cfg["cursor.rules.user"] = (existing + "\n\n" + GUARD_RULES).strip()
425
+ settings_path.write_text(json.dumps(cfg, indent=2))
426
+ print(f" {GREEN}Cursor global rules updated with ConductGuard policy{RESET}")
427
+
349
428
 
350
429
  def _install_codex_hook(hook_path: Path) -> None:
351
430
  """Register PreToolUse and PostToolUse hooks in ~/.codex/hooks.json."""
@@ -1091,7 +1170,7 @@ def cmd_guard_sync(args):
1091
1170
  CONDUCT_DIR = Path.home() / ".conduct"
1092
1171
  PROXY_ENV_FILE = CONDUCT_DIR / "env"
1093
1172
  PROXY_OVERRIDE = CONDUCT_DIR / "env-override"
1094
- DEFAULT_PROXY_URL = "https://api.conductai.ai/proxy"
1173
+ DEFAULT_PROXY_URL = "https://api.conductai.ai/proxy/anthropic"
1095
1174
  SHELL_RC_MARKER = "# Conduct Guard Proxy — managed by `conduct guard sync`"
1096
1175
  SHELL_SOURCE_LINE = "[ -f ~/.conduct/env ] && . ~/.conduct/env"
1097
1176
 
@@ -1679,7 +1758,7 @@ def register_guard_parser(sub):
1679
1758
  sync_p.add_argument("--cursor", action="store_true", help="Write active Guard policies to .cursorrules")
1680
1759
  sync_p.add_argument("--dry-run", action="store_true", help="Preview policy changes without writing anything")
1681
1760
  sync_p.add_argument("--proxy-url", default=None,
1682
- help="Override the Guard proxy URL (default: https://api.conductai.ai/proxy)")
1761
+ help="Override the Guard proxy URL (default: https://api.conductai.ai/proxy/anthropic)")
1683
1762
  sync_p.add_argument("--no-local-audit", action="store_true",
1684
1763
  help="Skip the local pre-existing API key scan")
1685
1764
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: conduct-cli
3
- Version: 0.6.12
3
+ Version: 0.6.15
4
4
  Summary: CLI for Conduct AI — install agents, manage projects, run tests
5
5
  Author-email: Conduct AI <hello@conductai.ai>
6
6
  License: MIT
File without changes
File without changes
File without changes