conduct-cli 0.5.2__tar.gz → 0.5.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.
- {conduct_cli-0.5.2 → conduct_cli-0.5.3}/PKG-INFO +1 -1
- {conduct_cli-0.5.2 → conduct_cli-0.5.3}/pyproject.toml +1 -1
- {conduct_cli-0.5.2 → conduct_cli-0.5.3}/src/conduct_cli/guard.py +39 -1
- {conduct_cli-0.5.2 → conduct_cli-0.5.3}/src/conduct_cli.egg-info/PKG-INFO +1 -1
- {conduct_cli-0.5.2 → conduct_cli-0.5.3}/README.md +0 -0
- {conduct_cli-0.5.2 → conduct_cli-0.5.3}/setup.cfg +0 -0
- {conduct_cli-0.5.2 → conduct_cli-0.5.3}/setup.py +0 -0
- {conduct_cli-0.5.2 → conduct_cli-0.5.3}/src/conduct_cli/__init__.py +0 -0
- {conduct_cli-0.5.2 → conduct_cli-0.5.3}/src/conduct_cli/api.py +0 -0
- {conduct_cli-0.5.2 → conduct_cli-0.5.3}/src/conduct_cli/guardmcp.py +0 -0
- {conduct_cli-0.5.2 → conduct_cli-0.5.3}/src/conduct_cli/hook_precompact_template.py +0 -0
- {conduct_cli-0.5.2 → conduct_cli-0.5.3}/src/conduct_cli/hook_session_start_template.py +0 -0
- {conduct_cli-0.5.2 → conduct_cli-0.5.3}/src/conduct_cli/hook_stop_template.py +0 -0
- {conduct_cli-0.5.2 → conduct_cli-0.5.3}/src/conduct_cli/hook_template.py +0 -0
- {conduct_cli-0.5.2 → conduct_cli-0.5.3}/src/conduct_cli/main.py +0 -0
- {conduct_cli-0.5.2 → conduct_cli-0.5.3}/src/conduct_cli/mcp_server.py +0 -0
- {conduct_cli-0.5.2 → conduct_cli-0.5.3}/src/conduct_cli/memory.py +0 -0
- {conduct_cli-0.5.2 → conduct_cli-0.5.3}/src/conduct_cli/paxel.py +0 -0
- {conduct_cli-0.5.2 → conduct_cli-0.5.3}/src/conduct_cli.egg-info/SOURCES.txt +0 -0
- {conduct_cli-0.5.2 → conduct_cli-0.5.3}/src/conduct_cli.egg-info/dependency_links.txt +0 -0
- {conduct_cli-0.5.2 → conduct_cli-0.5.3}/src/conduct_cli.egg-info/entry_points.txt +0 -0
- {conduct_cli-0.5.2 → conduct_cli-0.5.3}/src/conduct_cli.egg-info/requires.txt +0 -0
- {conduct_cli-0.5.2 → conduct_cli-0.5.3}/src/conduct_cli.egg-info/top_level.txt +0 -0
- {conduct_cli-0.5.2 → conduct_cli-0.5.3}/tests/test_guard_policy.py +0 -0
- {conduct_cli-0.5.2 → conduct_cli-0.5.3}/tests/test_guard_savings.py +0 -0
- {conduct_cli-0.5.2 → conduct_cli-0.5.3}/tests/test_hook_syntax.py +0 -0
- {conduct_cli-0.5.2 → conduct_cli-0.5.3}/tests/test_switch.py +0 -0
|
@@ -733,6 +733,9 @@ def cmd_guard_sync(args):
|
|
|
733
733
|
rule_count = len(policy.get("rules", []))
|
|
734
734
|
print(f" {GREEN}Policy refreshed:{RESET} {rule_count} rule(s)")
|
|
735
735
|
|
|
736
|
+
if getattr(args, "cursor", False):
|
|
737
|
+
_write_cursorrules(policy)
|
|
738
|
+
|
|
736
739
|
# Re-check Security Loop install status
|
|
737
740
|
try:
|
|
738
741
|
sec = _req("GET", f"{base_url}/secure/installed?workspace_id={workspace_id}", api_key=api_key)
|
|
@@ -785,6 +788,40 @@ def cmd_guard_sync(args):
|
|
|
785
788
|
print(f"\n {CYAN}{mcp_url}{RESET}\n")
|
|
786
789
|
|
|
787
790
|
|
|
791
|
+
def _write_cursorrules(policy: dict) -> None:
|
|
792
|
+
"""Write active Guard policies into .cursorrules in the current directory."""
|
|
793
|
+
rules = policy.get("rules", [])
|
|
794
|
+
enabled = [r for r in rules if r.get("enabled", True)]
|
|
795
|
+
lines = [
|
|
796
|
+
"# .cursorrules — generated by Conduct AI Guard",
|
|
797
|
+
"# Run `conduct guard sync --cursor` to refresh.",
|
|
798
|
+
"# Do not edit manually — changes will be overwritten.",
|
|
799
|
+
"",
|
|
800
|
+
"## Conduct Guard Policies",
|
|
801
|
+
f"# {len(enabled)} active rule(s) enforced by ConductGuard.",
|
|
802
|
+
"",
|
|
803
|
+
]
|
|
804
|
+
for r in enabled:
|
|
805
|
+
action = r.get("action", "warn").upper()
|
|
806
|
+
rule_id = r.get("rule_id", "")
|
|
807
|
+
desc = r.get("description") or r.get("message") or ""
|
|
808
|
+
lines.append(f"# [{action}] {rule_id}" + (f" — {desc}" if desc else ""))
|
|
809
|
+
pattern = r.get("pattern")
|
|
810
|
+
if pattern:
|
|
811
|
+
lines.append(f"# pattern: {pattern}")
|
|
812
|
+
lines += [
|
|
813
|
+
"",
|
|
814
|
+
"## General",
|
|
815
|
+
"# Never include secrets, API keys, or credentials in prompts.",
|
|
816
|
+
"# PII (emails, SSNs, phone numbers) is redacted by Conduct before reaching any model.",
|
|
817
|
+
"# Conduct AI governance is active — all tool calls are audited.",
|
|
818
|
+
"# Independent of Cursor's ownership — policies enforced by your team, not the IDE vendor.",
|
|
819
|
+
]
|
|
820
|
+
out = Path(".cursorrules")
|
|
821
|
+
out.write_text("\n".join(lines) + "\n")
|
|
822
|
+
print(f" {GREEN}.cursorrules written:{RESET} {len(enabled)} rule(s) → {out.resolve()}")
|
|
823
|
+
|
|
824
|
+
|
|
788
825
|
def _ensure_booster(root: Path) -> None:
|
|
789
826
|
"""Auto-init and background-index booster if installed but not yet set up."""
|
|
790
827
|
import shutil
|
|
@@ -1159,7 +1196,8 @@ def register_guard_parser(sub):
|
|
|
1159
1196
|
guard_sub = guard_p.add_subparsers(dest="guard_command")
|
|
1160
1197
|
|
|
1161
1198
|
# conduct guard sync
|
|
1162
|
-
guard_sub.add_parser("sync", help="Refresh policy and re-scan for AI tools")
|
|
1199
|
+
sync_p = guard_sub.add_parser("sync", help="Refresh policy and re-scan for AI tools")
|
|
1200
|
+
sync_p.add_argument("--cursor", action="store_true", help="Write active Guard policies to .cursorrules")
|
|
1163
1201
|
|
|
1164
1202
|
# conduct guard status
|
|
1165
1203
|
guard_sub.add_parser("status", help="Show today's spend and violations")
|
|
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
|