conduct-cli 0.9.6__tar.gz → 0.9.7__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 (54) hide show
  1. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/PKG-INFO +1 -1
  2. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/pyproject.toml +1 -1
  3. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/src/conduct_cli/main.py +22 -1
  4. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/src/conduct_cli.egg-info/PKG-INFO +1 -1
  5. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/tests/test_switch.py +61 -0
  6. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/README.md +0 -0
  7. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/setup.cfg +0 -0
  8. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/setup.py +0 -0
  9. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/src/conduct_cli/__init__.py +0 -0
  10. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/src/conduct_cli/api.py +0 -0
  11. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/src/conduct_cli/guard.py +0 -0
  12. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/src/conduct_cli/guard_policy.md +0 -0
  13. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/src/conduct_cli/guardmcp.py +0 -0
  14. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/src/conduct_cli/hooks/__init__.py +0 -0
  15. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/src/conduct_cli/hooks/base.py +0 -0
  16. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/src/conduct_cli/hooks/posttooluse.py +0 -0
  17. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/src/conduct_cli/hooks/precompact.py +0 -0
  18. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/src/conduct_cli/hooks/pretooluse.py +0 -0
  19. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/src/conduct_cli/hooks/session_parser.py +0 -0
  20. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/src/conduct_cli/hooks/session_report_push.py +0 -0
  21. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/src/conduct_cli/hooks/session_start.py +0 -0
  22. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/src/conduct_cli/hooks/stop.py +0 -0
  23. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/src/conduct_cli/log_util.py +0 -0
  24. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/src/conduct_cli/mcp_server.py +0 -0
  25. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/src/conduct_cli/memory.py +0 -0
  26. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/src/conduct_cli/paxel.py +0 -0
  27. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/src/conduct_cli/tool_groups.py +0 -0
  28. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/src/conduct_cli.egg-info/SOURCES.txt +0 -0
  29. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/src/conduct_cli.egg-info/dependency_links.txt +0 -0
  30. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/src/conduct_cli.egg-info/entry_points.txt +0 -0
  31. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/src/conduct_cli.egg-info/requires.txt +0 -0
  32. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/src/conduct_cli.egg-info/top_level.txt +0 -0
  33. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/tests/test_advisory_and_hook.py +0 -0
  34. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/tests/test_api_client.py +0 -0
  35. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/tests/test_bash_operator_signature.py +0 -0
  36. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/tests/test_bash_scan_target.py +0 -0
  37. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/tests/test_blast_radius.py +0 -0
  38. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/tests/test_cli_matrix.py +0 -0
  39. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/tests/test_cmd_run.py +0 -0
  40. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/tests/test_command_word_matcher.py +0 -0
  41. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/tests/test_conductguard_mcp_stdio.py +0 -0
  42. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/tests/test_drain_daemon_health.py +0 -0
  43. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/tests/test_guard_approvals.py +0 -0
  44. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/tests/test_guard_policy.py +0 -0
  45. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/tests/test_guard_savings.py +0 -0
  46. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/tests/test_hook_dispatch.py +0 -0
  47. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/tests/test_instruction_files.py +0 -0
  48. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/tests/test_journal_drain.py +0 -0
  49. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/tests/test_log_util.py +0 -0
  50. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/tests/test_proxy_coverage.py +0 -0
  51. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/tests/test_proxy_env.py +0 -0
  52. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/tests/test_report_tool_coverage.py +0 -0
  53. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/tests/test_signed_policy.py +0 -0
  54. {conduct_cli-0.9.6 → conduct_cli-0.9.7}/tests/test_token_lifecycle.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: conduct-cli
3
- Version: 0.9.6
3
+ Version: 0.9.7
4
4
  Summary: CLI for Conduct AI — secure, govern, 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.9.6"
7
+ version = "0.9.7"
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" }
@@ -576,7 +576,19 @@ def cmd_login(args):
576
576
  cfg.pop("api_key", None)
577
577
  _atomic_write(CONFIG_PATH, cfg)
578
578
 
579
- print(f"{GREEN}✓ Logged in{RESET} — workspace {GRAY}{result['workspace_id']}{RESET}")
579
+ # Fetch workspaces so we can display the current one by name and nudge
580
+ # the user if their account has more than one (cross-surface switch drift).
581
+ try:
582
+ _hdrs = {"Authorization": f"Bearer {result['agent_token']}", "Content-Type": "application/json"}
583
+ _workspaces = api.req("GET", f"{api_url}/projects", _hdrs) or []
584
+ except Exception:
585
+ _workspaces = []
586
+ _current = next((w for w in _workspaces if str(w.get("id")) == str(result["workspace_id"])), None)
587
+ _name = (_current or {}).get("name") or ""
588
+ if _name:
589
+ print(f"{GREEN}✓ Logged in{RESET} — workspace {BOLD}{_name}{RESET} {GRAY}({str(result['workspace_id'])[:8]}…){RESET}")
590
+ else:
591
+ print(f"{GREEN}✓ Logged in{RESET} — workspace {GRAY}{result['workspace_id']}{RESET}")
580
592
 
581
593
  # Auto-sync: register hooks + pull policy
582
594
  try:
@@ -588,6 +600,15 @@ def cmd_login(args):
588
600
  except Exception:
589
601
  pass
590
602
 
603
+ # Nudge if the account has multiple workspaces — the web UI and CLI hold
604
+ # workspace context independently, so users routinely forget which one
605
+ # the CLI is now targeting.
606
+ if len(_workspaces) > 1:
607
+ _others = [w.get("name","") for w in _workspaces if str(w.get("id")) != str(result["workspace_id"])]
608
+ _preview = ", ".join(o for o in _others[:3] if o)
609
+ print(f"\n {GRAY}You have {len(_workspaces)} workspaces. This CLI now targets:{RESET} {BOLD}{_name or result['workspace_id']}{RESET}")
610
+ print(f" {GRAY}Switch with:{RESET} {CYAN}conduct switch \"<name>\"{RESET} {GRAY}(others: {_preview}){RESET}")
611
+
591
612
 
592
613
  def cmd_agents(args):
593
614
  server, workspace_id, token = _require_auth(args)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: conduct-cli
3
- Version: 0.9.6
3
+ Version: 0.9.7
4
4
  Summary: CLI for Conduct AI — secure, govern, install agents, manage projects, run tests
5
5
  Author-email: Conduct AI <hello@conductai.ai>
6
6
  License: MIT
@@ -227,3 +227,64 @@ def test_switch_accepts_api_url_key(tmp_path, capsys):
227
227
  out = capsys.readouterr().out
228
228
  assert "Not logged in" not in out
229
229
  assert "Engineering" in out
230
+
231
+
232
+ # ---------------------------------------------------------------------------
233
+ # Regression: `conduct login` prints workspace name (not just UUID) and a
234
+ # switch-hint when the account has more than one workspace. Cross-surface
235
+ # workspace drift (web-UI-switched, CLI still on old) was invisible before.
236
+ # ---------------------------------------------------------------------------
237
+
238
+ def test_login_shows_name_and_nudges_when_multiple_workspaces(tmp_path, capsys):
239
+ from conduct_cli import main as m
240
+
241
+ cfg_path = tmp_path / "config.json"
242
+ cfg_path.write_text(json.dumps({}))
243
+ args = _make_args(server=None, token=None)
244
+
245
+ fake_result = {
246
+ "agent_token": "cond_agt_testkey",
247
+ "workspace_id": "ef0a7e36-0000-0000-0000-000000000001",
248
+ }
249
+
250
+ with (
251
+ patch.object(m, "CONFIG_PATH", cfg_path),
252
+ patch.object(m, "_web_login_flow", return_value=fake_result),
253
+ patch.object(m.api, "req", return_value=_fake_workspaces()),
254
+ patch("conduct_cli.guard.cmd_guard_sync", return_value=None),
255
+ ):
256
+ m.cmd_login(args)
257
+
258
+ out = capsys.readouterr().out
259
+ # Current workspace displayed by name (not just UUID)
260
+ assert "Engineering" in out
261
+ # Nudge appears because account has >1 workspace
262
+ assert "conduct switch" in out
263
+ # Other workspace names surfaced in the preview
264
+ assert "Marketing" in out or "Eng Backup" in out
265
+
266
+
267
+ def test_login_omits_nudge_when_single_workspace(tmp_path, capsys):
268
+ from conduct_cli import main as m
269
+
270
+ cfg_path = tmp_path / "config.json"
271
+ cfg_path.write_text(json.dumps({}))
272
+ args = _make_args(server=None, token=None)
273
+
274
+ fake_result = {
275
+ "agent_token": "cond_agt_testkey",
276
+ "workspace_id": "ef0a7e36-0000-0000-0000-000000000001",
277
+ }
278
+ single_ws = [{"id": "ef0a7e36-0000-0000-0000-000000000001", "name": "Only", "owner_id": "u1", "workflow_count": 0}]
279
+
280
+ with (
281
+ patch.object(m, "CONFIG_PATH", cfg_path),
282
+ patch.object(m, "_web_login_flow", return_value=fake_result),
283
+ patch.object(m.api, "req", return_value=single_ws),
284
+ patch("conduct_cli.guard.cmd_guard_sync", return_value=None),
285
+ ):
286
+ m.cmd_login(args)
287
+
288
+ out = capsys.readouterr().out
289
+ assert "Only" in out
290
+ assert "conduct switch" not in out
File without changes
File without changes
File without changes