conduct-cli 0.2.0__tar.gz → 0.4.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.
@@ -0,0 +1,260 @@
1
+ Metadata-Version: 2.4
2
+ Name: conduct-cli
3
+ Version: 0.4.3
4
+ Summary: CLI for Conduct AI — install agents, manage projects, run tests
5
+ Author-email: Conduct AI <hello@conductai.ai>
6
+ License: MIT
7
+ Project-URL: Homepage, https://conductai.ai
8
+ Project-URL: Repository, https://github.com/sseshachala/conductai
9
+ Project-URL: Bug Tracker, https://github.com/sseshachala/conductai/issues
10
+ Keywords: ai,agents,automation,devops,cli
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
21
+ Requires-Python: >=3.9
22
+ Description-Content-Type: text/markdown
23
+ Requires-Dist: pyyaml>=6.0
24
+
25
+ # conduct-cli
26
+
27
+ Official CLI for [Conduct AI](https://conductai.ai) — install AI agents, manage projects, run end-to-end tests, and enforce team AI policies with ConductGuard.
28
+
29
+ ## Install
30
+
31
+ ```bash
32
+ pip install conduct-cli
33
+ ```
34
+
35
+ ## Quick start
36
+
37
+ ```bash
38
+ # Authenticate (one-time)
39
+ conduct login \
40
+ --server https://api.conductai.ai \
41
+ --api-key cond_live_xxx \
42
+ --workspace <workspace-id>
43
+
44
+ # Browse available agents
45
+ conduct playbooks
46
+
47
+ # Create a project and install all agents in one shot
48
+ conduct install-all --project DevOps --repo owner/repo
49
+
50
+ # List installed agents
51
+ conduct agents
52
+
53
+ # Run a test trigger on any agent
54
+ conduct test "PR Reviewer"
55
+ conduct test --all
56
+ ```
57
+
58
+ ## Commands
59
+
60
+ | Command | Description |
61
+ |---------|-------------|
62
+ | `conduct login` | Save connection config to `~/.conduct/config.json` |
63
+ | `conduct projects` | List all projects |
64
+ | `conduct create project <name>` | Create a project |
65
+ | `conduct delete project <name>` | Delete a project and all its agents |
66
+ | `conduct reset project <name>` | Delete all agents in a project (clean slate) |
67
+ | `conduct playbooks` | Browse available playbooks |
68
+ | `conduct playbooks <slug>` | Show required inputs for a playbook |
69
+ | `conduct install <slug>` | Install one agent from a playbook |
70
+ | `conduct install-all` | Install all 12 playbooks into a project |
71
+ | `conduct agents` | List all installed agents |
72
+ | `conduct test <name>` | Fire test trigger on an agent and stream results |
73
+ | `conduct test --all` | Test every playbook-based agent |
74
+
75
+ ## Authentication
76
+
77
+ Generate an API key from **Settings → API Keys** in the Conduct AI dashboard. Keys start with `cond_live_` and are stored as SHA-256 hashes — the plaintext is shown only once.
78
+
79
+ ```bash
80
+ conduct login --server https://api.conductai.ai --api-key cond_live_xxx --workspace <id>
81
+ ```
82
+
83
+ ## Install all agents
84
+
85
+ ```bash
86
+ # Installs all 12 playbooks into a project, pointed at your GitHub repo
87
+ conduct install-all --project DevOps --repo myorg/myrepo
88
+ ```
89
+
90
+ If the project doesn't exist it's created automatically. Use `--input key=value` to override any playbook input.
91
+
92
+ ## Test agents
93
+
94
+ ```bash
95
+ # Test a single agent (fires synthetic test payload, streams run events)
96
+ conduct test "Autopilot Quick"
97
+
98
+ # Test all playbook-based agents in sequence
99
+ conduct test --all
100
+ ```
101
+
102
+ Exit code is `0` if all pass, `1` if any fail — works in CI.
103
+
104
+ ---
105
+
106
+ ## ConductGuard
107
+
108
+ ConductGuard is AI tool fleet management — your security team sets policies once and they're enforced automatically across every developer's Claude Code, Cursor, and Windsurf session.
109
+
110
+ ### How it works
111
+
112
+ ```
113
+ Manager installs Guard (conductai.ai/settings/modules)
114
+ └─ generates an invite code
115
+
116
+ Developer runs: conduct guard join <invite-code>
117
+ ├─ downloads team policy to ~/.conductguard/policy.json
118
+ ├─ writes PreToolUse hook → ~/.claude/settings.json
119
+ └─ registers conductguard-mcp → ~/.claude/settings.json (mcpServers)
120
+
121
+ Every Claude Code tool call:
122
+ ├─ PreToolUse hook fires (hook.py) → checks policy → block / warn / audit
123
+ └─ Event posted async to ConductGuard API → visible in Activity feed
124
+ ```
125
+
126
+ ### Developer setup
127
+
128
+ ```bash
129
+ # Get the invite code from your manager (Settings → Modules → ConductGuard)
130
+ conduct guard join <invite-code>
131
+
132
+ # Enter your email when prompted — you'll be connected immediately
133
+ ```
134
+
135
+ That's it. Policy enforcement is active from the next tool call.
136
+
137
+ ### Guard commands
138
+
139
+ | Command | Description |
140
+ |---------|-------------|
141
+ | `conduct guard join <code>` | Join a team, download policy, register hook + MCP |
142
+ | `conduct guard sync` | Pull latest policy from server (run after security team updates rules) |
143
+ | `conduct guard status` | Show today's spend, session count, and violations |
144
+ | `conduct guard audit [--since 7d]` | Print recent guard events in a table |
145
+
146
+ ### How the PreToolUse hook works
147
+
148
+ When you run `conduct guard join`, the CLI writes a Python script to `~/.conductguard/hook.py` and registers it as a `PreToolUse` hook in `~/.claude/settings.json`:
149
+
150
+ ```json
151
+ {
152
+ "hooks": {
153
+ "PreToolUse": [
154
+ {
155
+ "matcher": ".*",
156
+ "hooks": [{ "type": "command", "command": "python3 ~/.conductguard/hook.py" }]
157
+ }
158
+ ]
159
+ }
160
+ }
161
+ ```
162
+
163
+ Before every tool call, Claude Code runs the hook. The hook:
164
+
165
+ 1. Reads `tool_name` and `tool_input` from stdin (JSON)
166
+ 2. Loads `~/.conductguard/policy.json` (the team ruleset)
167
+ 3. Matches the call against each rule (`match_tool`, `match_pattern`, `match_path_pattern`)
168
+ 4. Takes the rule's action:
169
+ - `block` — prints the policy message, exits with code `2` (Claude Code aborts the tool call)
170
+ - `warn` — prints the message, exits `0` (tool call proceeds, developer is notified)
171
+ - `audit` — posts an event silently, exits `0`
172
+ 5. Posts an audit event to `POST /guard/events` asynchronously (fire-and-forget, never slows the tool call)
173
+
174
+ ### How conductguard-mcp works
175
+
176
+ `conduct guard join` also registers an MCP server entry in `~/.claude/settings.json`:
177
+
178
+ ```json
179
+ {
180
+ "mcpServers": {
181
+ "conductguard": {
182
+ "command": "conductguard-mcp",
183
+ "args": ["--team", "<team-id>", "--token", "<member-token>"]
184
+ }
185
+ }
186
+ }
187
+ ```
188
+
189
+ Claude Code starts `conductguard-mcp` as a subprocess on launch and keeps it running. It communicates via JSON-RPC 2.0 over stdin/stdout (MCP stdio transport).
190
+
191
+ The MCP server exposes three tools that Claude can call proactively:
192
+
193
+ | Tool | Description |
194
+ |------|-------------|
195
+ | `guard_status` | Returns team name, your email, number of active rules, and policy version |
196
+ | `guard_check` | Checks whether a specific tool + input would be blocked before Claude acts |
197
+ | `guard_sync` | Fetches the latest policy from the ConductGuard API and saves it locally |
198
+
199
+ **`guard_check` example** — Claude can self-check before a sensitive action:
200
+
201
+ ```
202
+ guard_check(tool_name="bash", tool_input={"command": "rm -rf /tmp/build"})
203
+ → ALLOWED — no policy rule matches 'bash'.
204
+
205
+ guard_check(tool_name="bash", tool_input={"command": "curl http://internal-api/secrets"})
206
+ → BLOCKED — External network calls to internal endpoints are not permitted. [rule: no-internal-curl]
207
+ ```
208
+
209
+ **`guard_sync` example** — after your security team pushes new rules:
210
+
211
+ ```
212
+ guard_sync()
213
+ → Policy synced — 12 rule(s) active (version: 2026-05-31T14:22:00Z).
214
+ ```
215
+
216
+ ### Policy file format
217
+
218
+ Policy is stored at `~/.conductguard/policy.json` and synced from the server:
219
+
220
+ ```json
221
+ {
222
+ "team_id": "uuid",
223
+ "version": "2026-05-31T14:22:00Z",
224
+ "rules": [
225
+ {
226
+ "rule_id": "no-rm-rf",
227
+ "match_tool": "bash",
228
+ "match_pattern": "rm\\s+-rf",
229
+ "match_path_pattern": null,
230
+ "action": "block",
231
+ "message": "Recursive deletes are not permitted. Use trash or targeted rm."
232
+ },
233
+ {
234
+ "rule_id": "audit-prod-writes",
235
+ "match_tool": "edit,write",
236
+ "match_path_pattern": "/prod/",
237
+ "match_pattern": null,
238
+ "action": "warn",
239
+ "message": "Writing to prod directory — make sure this is intentional."
240
+ }
241
+ ]
242
+ }
243
+ ```
244
+
245
+ ### Keeping policy up to date
246
+
247
+ Policy is written to disk at `join` time. Run `conduct guard sync` after your security team updates rules in the ConductGuard dashboard. The sync command also re-registers the MCP entry in any newly detected AI tool configs.
248
+
249
+ ```bash
250
+ # Add to a daily cron or run manually after policy changes
251
+ conduct guard sync
252
+ ```
253
+
254
+ ---
255
+
256
+ ## Links
257
+
258
+ - Dashboard: [conductai.ai](https://conductai.ai)
259
+ - Docs: [conductai.ai/docs](https://conductai.ai/docs)
260
+ - Issues: [github.com/sseshachala/conductai/issues](https://github.com/sseshachala/conductai/issues)
@@ -0,0 +1,236 @@
1
+ # conduct-cli
2
+
3
+ Official CLI for [Conduct AI](https://conductai.ai) — install AI agents, manage projects, run end-to-end tests, and enforce team AI policies with ConductGuard.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pip install conduct-cli
9
+ ```
10
+
11
+ ## Quick start
12
+
13
+ ```bash
14
+ # Authenticate (one-time)
15
+ conduct login \
16
+ --server https://api.conductai.ai \
17
+ --api-key cond_live_xxx \
18
+ --workspace <workspace-id>
19
+
20
+ # Browse available agents
21
+ conduct playbooks
22
+
23
+ # Create a project and install all agents in one shot
24
+ conduct install-all --project DevOps --repo owner/repo
25
+
26
+ # List installed agents
27
+ conduct agents
28
+
29
+ # Run a test trigger on any agent
30
+ conduct test "PR Reviewer"
31
+ conduct test --all
32
+ ```
33
+
34
+ ## Commands
35
+
36
+ | Command | Description |
37
+ |---------|-------------|
38
+ | `conduct login` | Save connection config to `~/.conduct/config.json` |
39
+ | `conduct projects` | List all projects |
40
+ | `conduct create project <name>` | Create a project |
41
+ | `conduct delete project <name>` | Delete a project and all its agents |
42
+ | `conduct reset project <name>` | Delete all agents in a project (clean slate) |
43
+ | `conduct playbooks` | Browse available playbooks |
44
+ | `conduct playbooks <slug>` | Show required inputs for a playbook |
45
+ | `conduct install <slug>` | Install one agent from a playbook |
46
+ | `conduct install-all` | Install all 12 playbooks into a project |
47
+ | `conduct agents` | List all installed agents |
48
+ | `conduct test <name>` | Fire test trigger on an agent and stream results |
49
+ | `conduct test --all` | Test every playbook-based agent |
50
+
51
+ ## Authentication
52
+
53
+ Generate an API key from **Settings → API Keys** in the Conduct AI dashboard. Keys start with `cond_live_` and are stored as SHA-256 hashes — the plaintext is shown only once.
54
+
55
+ ```bash
56
+ conduct login --server https://api.conductai.ai --api-key cond_live_xxx --workspace <id>
57
+ ```
58
+
59
+ ## Install all agents
60
+
61
+ ```bash
62
+ # Installs all 12 playbooks into a project, pointed at your GitHub repo
63
+ conduct install-all --project DevOps --repo myorg/myrepo
64
+ ```
65
+
66
+ If the project doesn't exist it's created automatically. Use `--input key=value` to override any playbook input.
67
+
68
+ ## Test agents
69
+
70
+ ```bash
71
+ # Test a single agent (fires synthetic test payload, streams run events)
72
+ conduct test "Autopilot Quick"
73
+
74
+ # Test all playbook-based agents in sequence
75
+ conduct test --all
76
+ ```
77
+
78
+ Exit code is `0` if all pass, `1` if any fail — works in CI.
79
+
80
+ ---
81
+
82
+ ## ConductGuard
83
+
84
+ ConductGuard is AI tool fleet management — your security team sets policies once and they're enforced automatically across every developer's Claude Code, Cursor, and Windsurf session.
85
+
86
+ ### How it works
87
+
88
+ ```
89
+ Manager installs Guard (conductai.ai/settings/modules)
90
+ └─ generates an invite code
91
+
92
+ Developer runs: conduct guard join <invite-code>
93
+ ├─ downloads team policy to ~/.conductguard/policy.json
94
+ ├─ writes PreToolUse hook → ~/.claude/settings.json
95
+ └─ registers conductguard-mcp → ~/.claude/settings.json (mcpServers)
96
+
97
+ Every Claude Code tool call:
98
+ ├─ PreToolUse hook fires (hook.py) → checks policy → block / warn / audit
99
+ └─ Event posted async to ConductGuard API → visible in Activity feed
100
+ ```
101
+
102
+ ### Developer setup
103
+
104
+ ```bash
105
+ # Get the invite code from your manager (Settings → Modules → ConductGuard)
106
+ conduct guard join <invite-code>
107
+
108
+ # Enter your email when prompted — you'll be connected immediately
109
+ ```
110
+
111
+ That's it. Policy enforcement is active from the next tool call.
112
+
113
+ ### Guard commands
114
+
115
+ | Command | Description |
116
+ |---------|-------------|
117
+ | `conduct guard join <code>` | Join a team, download policy, register hook + MCP |
118
+ | `conduct guard sync` | Pull latest policy from server (run after security team updates rules) |
119
+ | `conduct guard status` | Show today's spend, session count, and violations |
120
+ | `conduct guard audit [--since 7d]` | Print recent guard events in a table |
121
+
122
+ ### How the PreToolUse hook works
123
+
124
+ When you run `conduct guard join`, the CLI writes a Python script to `~/.conductguard/hook.py` and registers it as a `PreToolUse` hook in `~/.claude/settings.json`:
125
+
126
+ ```json
127
+ {
128
+ "hooks": {
129
+ "PreToolUse": [
130
+ {
131
+ "matcher": ".*",
132
+ "hooks": [{ "type": "command", "command": "python3 ~/.conductguard/hook.py" }]
133
+ }
134
+ ]
135
+ }
136
+ }
137
+ ```
138
+
139
+ Before every tool call, Claude Code runs the hook. The hook:
140
+
141
+ 1. Reads `tool_name` and `tool_input` from stdin (JSON)
142
+ 2. Loads `~/.conductguard/policy.json` (the team ruleset)
143
+ 3. Matches the call against each rule (`match_tool`, `match_pattern`, `match_path_pattern`)
144
+ 4. Takes the rule's action:
145
+ - `block` — prints the policy message, exits with code `2` (Claude Code aborts the tool call)
146
+ - `warn` — prints the message, exits `0` (tool call proceeds, developer is notified)
147
+ - `audit` — posts an event silently, exits `0`
148
+ 5. Posts an audit event to `POST /guard/events` asynchronously (fire-and-forget, never slows the tool call)
149
+
150
+ ### How conductguard-mcp works
151
+
152
+ `conduct guard join` also registers an MCP server entry in `~/.claude/settings.json`:
153
+
154
+ ```json
155
+ {
156
+ "mcpServers": {
157
+ "conductguard": {
158
+ "command": "conductguard-mcp",
159
+ "args": ["--team", "<team-id>", "--token", "<member-token>"]
160
+ }
161
+ }
162
+ }
163
+ ```
164
+
165
+ Claude Code starts `conductguard-mcp` as a subprocess on launch and keeps it running. It communicates via JSON-RPC 2.0 over stdin/stdout (MCP stdio transport).
166
+
167
+ The MCP server exposes three tools that Claude can call proactively:
168
+
169
+ | Tool | Description |
170
+ |------|-------------|
171
+ | `guard_status` | Returns team name, your email, number of active rules, and policy version |
172
+ | `guard_check` | Checks whether a specific tool + input would be blocked before Claude acts |
173
+ | `guard_sync` | Fetches the latest policy from the ConductGuard API and saves it locally |
174
+
175
+ **`guard_check` example** — Claude can self-check before a sensitive action:
176
+
177
+ ```
178
+ guard_check(tool_name="bash", tool_input={"command": "rm -rf /tmp/build"})
179
+ → ALLOWED — no policy rule matches 'bash'.
180
+
181
+ guard_check(tool_name="bash", tool_input={"command": "curl http://internal-api/secrets"})
182
+ → BLOCKED — External network calls to internal endpoints are not permitted. [rule: no-internal-curl]
183
+ ```
184
+
185
+ **`guard_sync` example** — after your security team pushes new rules:
186
+
187
+ ```
188
+ guard_sync()
189
+ → Policy synced — 12 rule(s) active (version: 2026-05-31T14:22:00Z).
190
+ ```
191
+
192
+ ### Policy file format
193
+
194
+ Policy is stored at `~/.conductguard/policy.json` and synced from the server:
195
+
196
+ ```json
197
+ {
198
+ "team_id": "uuid",
199
+ "version": "2026-05-31T14:22:00Z",
200
+ "rules": [
201
+ {
202
+ "rule_id": "no-rm-rf",
203
+ "match_tool": "bash",
204
+ "match_pattern": "rm\\s+-rf",
205
+ "match_path_pattern": null,
206
+ "action": "block",
207
+ "message": "Recursive deletes are not permitted. Use trash or targeted rm."
208
+ },
209
+ {
210
+ "rule_id": "audit-prod-writes",
211
+ "match_tool": "edit,write",
212
+ "match_path_pattern": "/prod/",
213
+ "match_pattern": null,
214
+ "action": "warn",
215
+ "message": "Writing to prod directory — make sure this is intentional."
216
+ }
217
+ ]
218
+ }
219
+ ```
220
+
221
+ ### Keeping policy up to date
222
+
223
+ Policy is written to disk at `join` time. Run `conduct guard sync` after your security team updates rules in the ConductGuard dashboard. The sync command also re-registers the MCP entry in any newly detected AI tool configs.
224
+
225
+ ```bash
226
+ # Add to a daily cron or run manually after policy changes
227
+ conduct guard sync
228
+ ```
229
+
230
+ ---
231
+
232
+ ## Links
233
+
234
+ - Dashboard: [conductai.ai](https://conductai.ai)
235
+ - Docs: [conductai.ai/docs](https://conductai.ai/docs)
236
+ - Issues: [github.com/sseshachala/conductai/issues](https://github.com/sseshachala/conductai/issues)
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "conduct-cli"
7
- version = "0.2.0"
7
+ version = "0.4.3"
8
8
  description = "CLI for Conduct AI — install agents, manage projects, run tests"
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
@@ -31,7 +31,8 @@ Repository = "https://github.com/sseshachala/conductai"
31
31
  "Bug Tracker" = "https://github.com/sseshachala/conductai/issues"
32
32
 
33
33
  [project.scripts]
34
- conduct = "conduct_cli.main:main"
34
+ conduct = "conduct_cli.main:main"
35
+ conductguard-mcp = "conduct_cli.guardmcp:main"
35
36
 
36
37
  [tool.setuptools.packages.find]
37
38
  where = ["src"]