conduct-cli 0.9.4__tar.gz → 0.9.6__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.9.4 → conduct_cli-0.9.6}/PKG-INFO +1 -1
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/pyproject.toml +1 -1
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/src/conduct_cli/guard.py +14 -2
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/src/conduct_cli/main.py +4 -4
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/src/conduct_cli.egg-info/PKG-INFO +1 -1
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/tests/test_proxy_env.py +39 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/tests/test_switch.py +30 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/README.md +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/setup.cfg +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/setup.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/src/conduct_cli/__init__.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/src/conduct_cli/api.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/src/conduct_cli/guard_policy.md +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/src/conduct_cli/guardmcp.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/src/conduct_cli/hooks/__init__.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/src/conduct_cli/hooks/base.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/src/conduct_cli/hooks/posttooluse.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/src/conduct_cli/hooks/precompact.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/src/conduct_cli/hooks/pretooluse.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/src/conduct_cli/hooks/session_parser.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/src/conduct_cli/hooks/session_report_push.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/src/conduct_cli/hooks/session_start.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/src/conduct_cli/hooks/stop.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/src/conduct_cli/log_util.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/src/conduct_cli/mcp_server.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/src/conduct_cli/memory.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/src/conduct_cli/paxel.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/src/conduct_cli/tool_groups.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/src/conduct_cli.egg-info/SOURCES.txt +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/src/conduct_cli.egg-info/dependency_links.txt +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/src/conduct_cli.egg-info/entry_points.txt +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/src/conduct_cli.egg-info/requires.txt +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/src/conduct_cli.egg-info/top_level.txt +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/tests/test_advisory_and_hook.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/tests/test_api_client.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/tests/test_bash_operator_signature.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/tests/test_bash_scan_target.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/tests/test_blast_radius.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/tests/test_cli_matrix.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/tests/test_cmd_run.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/tests/test_command_word_matcher.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/tests/test_conductguard_mcp_stdio.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/tests/test_drain_daemon_health.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/tests/test_guard_approvals.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/tests/test_guard_policy.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/tests/test_guard_savings.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/tests/test_hook_dispatch.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/tests/test_instruction_files.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/tests/test_journal_drain.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/tests/test_log_util.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/tests/test_proxy_coverage.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/tests/test_report_tool_coverage.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/tests/test_signed_policy.py +0 -0
- {conduct_cli-0.9.4 → conduct_cli-0.9.6}/tests/test_token_lifecycle.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "conduct-cli"
|
|
7
|
-
version = "0.9.
|
|
7
|
+
version = "0.9.6"
|
|
8
8
|
description = "CLI for Conduct AI — secure, govern, install agents, manage projects, run tests"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { text = "MIT" }
|
|
@@ -1086,13 +1086,25 @@ def cmd_guard_join(args):
|
|
|
1086
1086
|
)
|
|
1087
1087
|
|
|
1088
1088
|
|
|
1089
|
+
def _read_conduct_env_var(name: str) -> str:
|
|
1090
|
+
# ponytail: fall back to ~/.conduct/env so proxy detection is truthful
|
|
1091
|
+
# right after `conduct login`, before the user sources the file.
|
|
1092
|
+
try:
|
|
1093
|
+
for line in (Path.home() / ".conduct" / "env").read_text().splitlines():
|
|
1094
|
+
if line.startswith(f"export {name}="):
|
|
1095
|
+
return line.split("=", 1)[1].strip().strip('"').strip("'")
|
|
1096
|
+
except Exception:
|
|
1097
|
+
pass
|
|
1098
|
+
return ""
|
|
1099
|
+
|
|
1100
|
+
|
|
1089
1101
|
def _is_anthropic_proxied() -> bool:
|
|
1090
|
-
url = os.environ.get("ANTHROPIC_BASE_URL", "")
|
|
1102
|
+
url = os.environ.get("ANTHROPIC_BASE_URL", "") or _read_conduct_env_var("ANTHROPIC_BASE_URL")
|
|
1091
1103
|
return "conductai.ai" in url or "conduct" in url.lower()
|
|
1092
1104
|
|
|
1093
1105
|
|
|
1094
1106
|
def _is_openai_proxied() -> bool:
|
|
1095
|
-
url = os.environ.get("OPENAI_BASE_URL", "")
|
|
1107
|
+
url = os.environ.get("OPENAI_BASE_URL", "") or _read_conduct_env_var("OPENAI_BASE_URL")
|
|
1096
1108
|
return "conductai.ai" in url or "conduct" in url.lower()
|
|
1097
1109
|
|
|
1098
1110
|
|
|
@@ -343,7 +343,7 @@ def _report_tool_coverage() -> None:
|
|
|
343
343
|
"""Detect AI tools on this machine and POST coverage to Guard API. Silent on failure."""
|
|
344
344
|
try:
|
|
345
345
|
cfg = _load_config()
|
|
346
|
-
server = cfg.get("server"
|
|
346
|
+
server = (cfg.get("server") or cfg.get("api_url") or "").rstrip("/")
|
|
347
347
|
api_key = cfg.get("agent_token", "")
|
|
348
348
|
token = cfg.get("token", "")
|
|
349
349
|
email = cfg.get("email", "")
|
|
@@ -1354,7 +1354,7 @@ def _atomic_write(path: Path, data: dict) -> None:
|
|
|
1354
1354
|
|
|
1355
1355
|
def cmd_switch(args):
|
|
1356
1356
|
cfg = _load_config()
|
|
1357
|
-
server = cfg.get("server"
|
|
1357
|
+
server = (cfg.get("server") or cfg.get("api_url") or "").rstrip("/")
|
|
1358
1358
|
api_key = cfg.get("agent_token", "")
|
|
1359
1359
|
token = cfg.get("token", "")
|
|
1360
1360
|
|
|
@@ -1798,7 +1798,7 @@ def _render_table(rows: list[dict]) -> str:
|
|
|
1798
1798
|
|
|
1799
1799
|
def _fetch_runs(cfg: dict) -> list[dict]:
|
|
1800
1800
|
"""Fetch recent runs from GET /runs."""
|
|
1801
|
-
server = cfg.get("server"
|
|
1801
|
+
server = (cfg.get("server") or cfg.get("api_url") or "").rstrip("/")
|
|
1802
1802
|
api_key = cfg.get("agent_token", "")
|
|
1803
1803
|
ws_id = cfg.get("workspace", "")
|
|
1804
1804
|
if not all([server, api_key, ws_id]):
|
|
@@ -1814,7 +1814,7 @@ def _fetch_runs(cfg: dict) -> list[dict]:
|
|
|
1814
1814
|
|
|
1815
1815
|
def _fetch_guard_activity(cfg: dict, guard_cfg: dict) -> list[dict]:
|
|
1816
1816
|
"""Fetch recent Guard events grouped by developer."""
|
|
1817
|
-
server = cfg.get("server"
|
|
1817
|
+
server = (cfg.get("server") or cfg.get("api_url") or "").rstrip("/")
|
|
1818
1818
|
api_key = cfg.get("agent_token", "")
|
|
1819
1819
|
ws_id = cfg.get("workspace", "")
|
|
1820
1820
|
if not all([server, api_key, ws_id]):
|
|
@@ -170,3 +170,42 @@ def test_windows_prefers_ps7_profile_when_no_wps5_exists(tmp_path, monkeypatch):
|
|
|
170
170
|
assert rc == ps7
|
|
171
171
|
assert ps7.exists()
|
|
172
172
|
assert not wps5.exists()
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
# ---------------------------------------------------------------------------
|
|
176
|
+
# Regression: _is_anthropic_proxied / _is_openai_proxied must fall back to
|
|
177
|
+
# ~/.conduct/env when the env var is missing from the current process.
|
|
178
|
+
# `conduct login` writes the file but does not re-source itself, so the
|
|
179
|
+
# per-tool coverage table used to report `✗ Not routed` right after login
|
|
180
|
+
# even though future shells will route correctly.
|
|
181
|
+
# ---------------------------------------------------------------------------
|
|
182
|
+
|
|
183
|
+
@pytestmark_posix
|
|
184
|
+
def test_is_anthropic_proxied_falls_back_to_env_file(tmp_path, monkeypatch):
|
|
185
|
+
_redirect_home(tmp_path, monkeypatch)
|
|
186
|
+
monkeypatch.delenv("ANTHROPIC_BASE_URL", raising=False)
|
|
187
|
+
(tmp_path / ".conduct").mkdir(exist_ok=True)
|
|
188
|
+
(tmp_path / ".conduct" / "env").write_text(
|
|
189
|
+
'export ANTHROPIC_BASE_URL="https://api.conductai.ai/proxy"\n'
|
|
190
|
+
'export ANTHROPIC_API_KEY="cond_agt_test"\n'
|
|
191
|
+
)
|
|
192
|
+
assert guard._is_anthropic_proxied() is True
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
@pytestmark_posix
|
|
196
|
+
def test_is_openai_proxied_falls_back_to_env_file(tmp_path, monkeypatch):
|
|
197
|
+
_redirect_home(tmp_path, monkeypatch)
|
|
198
|
+
monkeypatch.delenv("OPENAI_BASE_URL", raising=False)
|
|
199
|
+
(tmp_path / ".conduct").mkdir(exist_ok=True)
|
|
200
|
+
(tmp_path / ".conduct" / "env").write_text(
|
|
201
|
+
'export OPENAI_BASE_URL="https://api.conductai.ai/proxy/openai"\n'
|
|
202
|
+
)
|
|
203
|
+
assert guard._is_openai_proxied() is True
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
@pytestmark_posix
|
|
207
|
+
def test_is_anthropic_proxied_false_when_no_env_and_no_file(tmp_path, monkeypatch):
|
|
208
|
+
_redirect_home(tmp_path, monkeypatch)
|
|
209
|
+
monkeypatch.delenv("ANTHROPIC_BASE_URL", raising=False)
|
|
210
|
+
# No ~/.conduct/env written
|
|
211
|
+
assert guard._is_anthropic_proxied() is False
|
|
@@ -197,3 +197,33 @@ def test_whoami_prints_all_sections(tmp_path, capsys):
|
|
|
197
197
|
assert "sudhi@b2bsphere.com" in out
|
|
198
198
|
assert "3 rules" in out
|
|
199
199
|
assert "Booster" in out
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
# ---------------------------------------------------------------------------
|
|
203
|
+
# Regression: cmd_switch must accept `api_url` when `server` is absent.
|
|
204
|
+
# `conduct login` writes `api_url`; older cmd_switch only read `server`
|
|
205
|
+
# and falsely reported "Not logged in".
|
|
206
|
+
# ---------------------------------------------------------------------------
|
|
207
|
+
|
|
208
|
+
def test_switch_accepts_api_url_key(tmp_path, capsys):
|
|
209
|
+
"""conduct switch works when config was written by `conduct login` (api_url only)."""
|
|
210
|
+
from conduct_cli import main as m
|
|
211
|
+
|
|
212
|
+
cfg_path = tmp_path / "config.json"
|
|
213
|
+
cfg_path.write_text(json.dumps({
|
|
214
|
+
"api_url": "https://api.conductai.ai",
|
|
215
|
+
"agent_token": "cond_agt_testkey",
|
|
216
|
+
"workspace": "ef0a7e36-0000-0000-0000-000000000001",
|
|
217
|
+
}))
|
|
218
|
+
|
|
219
|
+
args = _make_args(workspace=None)
|
|
220
|
+
|
|
221
|
+
with (
|
|
222
|
+
patch.object(m, "CONFIG_PATH", cfg_path),
|
|
223
|
+
patch.object(m.api, "req", return_value=_fake_workspaces()),
|
|
224
|
+
):
|
|
225
|
+
m.cmd_switch(args)
|
|
226
|
+
|
|
227
|
+
out = capsys.readouterr().out
|
|
228
|
+
assert "Not logged in" not in out
|
|
229
|
+
assert "Engineering" in out
|
|
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
|
|
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
|
|
File without changes
|