arga-cli 0.1.0__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,298 @@
1
+ Metadata-Version: 2.4
2
+ Name: arga-cli
3
+ Version: 0.1.0
4
+ Summary: Command-line interface for Arga authentication, MCP installation, and browser validation
5
+ Author: Arga Labs
6
+ Project-URL: Homepage, https://github.com/ArgaLabs/arga-cli
7
+ Project-URL: Repository, https://github.com/ArgaLabs/arga-cli
8
+ Project-URL: Issues, https://github.com/ArgaLabs/arga-cli/issues
9
+ Keywords: arga,cli,mcp,developer-tools,validation
10
+ Classifier: Environment :: Console
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Topic :: Software Development
17
+ Requires-Python: >=3.12
18
+ Description-Content-Type: text/markdown
19
+ Requires-Dist: httpx>=0.27.0
20
+
21
+ # Arga CLI
22
+
23
+ `arga` is the command-line interface for authenticating with Arga, installing MCP configuration into supported coding agents, and starting validation runs against deployed apps or pull requests.
24
+
25
+ ## What It Does
26
+
27
+ - Authenticates your machine with Arga using the device login flow.
28
+ - Stores a device-scoped API key locally so each terminal/device can be revoked independently.
29
+ - Shows the currently authenticated user and workspace.
30
+ - Installs MCP configuration into supported local agents.
31
+ - Starts URL validation runs from the terminal.
32
+ - Starts pull request validation runs from the terminal.
33
+ - Wraps `git commit` and `git push` with Arga skip-validation helpers.
34
+ - Starts and inspects Arga app scans.
35
+
36
+ ## Installation
37
+
38
+ Once published to PyPI:
39
+
40
+ ```bash
41
+ uv tool install arga-cli
42
+ ```
43
+
44
+ You can also install it with `pipx` or `pip`:
45
+
46
+ ```bash
47
+ pipx install arga-cli
48
+ pip install arga-cli
49
+ ```
50
+
51
+ After installation, the executable is:
52
+
53
+ ```bash
54
+ arga --help
55
+ ```
56
+
57
+ ## Quick Start
58
+
59
+ Authenticate:
60
+
61
+ ```bash
62
+ arga login
63
+ arga whoami
64
+ ```
65
+
66
+ Remove the saved device credential:
67
+
68
+ ```bash
69
+ arga logout
70
+ ```
71
+
72
+ Install MCP configuration for detected agents:
73
+
74
+ ```bash
75
+ arga mcp install
76
+ ```
77
+
78
+ Start a browser validation run:
79
+
80
+ ```bash
81
+ arga test url --url https://demo-app.com --prompt "test the login flow"
82
+ ```
83
+
84
+ Start a pull request validation run:
85
+
86
+ ```bash
87
+ arga validate pr --repo arga-labs/validation-server --pr 182
88
+ ```
89
+
90
+ Create a commit that skips Arga validation:
91
+
92
+ ```bash
93
+ arga commit -m "docs: update examples" --skip
94
+ arga push --skip
95
+ ```
96
+
97
+ Inspect or update automatic validation settings:
98
+
99
+ ```bash
100
+ arga validate install arga-labs/validation-server
101
+ arga validate config arga-labs/validation-server
102
+ arga validate config set arga-labs/validation-server --trigger branch --branch main --comments on
103
+ ```
104
+
105
+ Start an app scan and inspect it later:
106
+
107
+ ```bash
108
+ arga scan https://demo-app.com --budget 200
109
+ arga scan status <run_id>
110
+ arga scan report <run_id>
111
+ ```
112
+
113
+ List and inspect recent validation runs:
114
+
115
+ ```bash
116
+ arga runs list --repo arga-labs/validation-server --limit 20
117
+ arga runs status <run_id>
118
+ arga runs cancel <run_id>
119
+ ```
120
+
121
+ `arga validate url` is also available and currently behaves the same as `arga test url`:
122
+
123
+ ```bash
124
+ arga validate url --url https://demo-app.com --prompt "test checkout"
125
+ ```
126
+
127
+ ## Command Reference
128
+
129
+ ### Authentication
130
+
131
+ ```bash
132
+ arga login
133
+ arga whoami
134
+ arga logout
135
+ ```
136
+
137
+ - `arga login` opens the browser to complete Arga's device authorization flow.
138
+ - `arga whoami` verifies the saved API key and prints the GitHub login plus workspace.
139
+ - `arga logout` removes the local credential and attempts to revoke the current device on the server.
140
+
141
+ ### Validation
142
+
143
+ ```bash
144
+ arga test url --url https://demo-app.com --prompt "test login flow"
145
+ arga validate url --url https://demo-app.com --prompt "test checkout"
146
+ arga validate pr --repo arga-labs/validation-server --pr 182
147
+ arga validate install arga-labs/validation-server
148
+ arga validate config arga-labs/validation-server
149
+ arga validate config set arga-labs/validation-server --trigger branch --branch main --comments on
150
+ ```
151
+
152
+ - `arga test url` starts a one-off validation against a deployed URL.
153
+ - `arga validate url` is an equivalent URL-validation entry point under the `validate` namespace.
154
+ - `arga validate pr` starts GitHub-backed PR validation for a repository and pull request number.
155
+ - `arga validate install <repo>` installs the GitHub webhook for automatic validation on a repository.
156
+ - `arga validate config <repo>` shows the current automatic validation settings, including install state, trigger mode, selected branch, and PR comment behavior.
157
+ - `arga validate config set <repo>` updates the automatic validation settings. Any omitted options keep their current value.
158
+
159
+ For URL validation, you can optionally provide credentials:
160
+
161
+ ```bash
162
+ arga test url \
163
+ --url https://demo-app.com \
164
+ --prompt "log in and create an order" \
165
+ --email test@company.com \
166
+ --password supersecret
167
+ ```
168
+
169
+ Both `--email` and `--password` must be supplied together.
170
+
171
+ ### App Scans
172
+
173
+ ```bash
174
+ arga scan https://demo-app.com --budget 200
175
+ arga scan status <run_id>
176
+ arga scan report <run_id>
177
+ ```
178
+
179
+ - `arga scan <url>` starts an app scan, waits for the generated scan plan to be ready, and auto-approves it so execution can begin.
180
+ - `--budget` controls the red-team action budget and defaults to `200`.
181
+ - `arga scan status <run_id>` prints the current run status and anomaly count.
182
+ - `arga scan report <run_id>` prints the final JSON report once the scan has completed.
183
+
184
+ ### Validation Runs
185
+
186
+ ```bash
187
+ arga runs list --repo arga-labs/validation-server --status running --limit 20
188
+ arga runs status <run_id>
189
+ arga runs cancel <run_id>
190
+ ```
191
+
192
+ - `arga runs list` shows recent PR and branch validation runs in table form.
193
+ - `--repo` narrows the list to a single repository.
194
+ - `--status` accepts `completed`, `failed`, or `running`. The `running` filter includes non-terminal states such as `queued`.
195
+ - `arga runs status <run_id>` prints a detailed summary for a specific run.
196
+ - `arga runs cancel <run_id>` cancels the run through the validation API.
197
+
198
+ ### Git Wrappers
199
+
200
+ ```bash
201
+ arga commit -m "docs: update examples" --skip
202
+ arga push --skip
203
+ ```
204
+
205
+ - `arga commit` delegates to `git commit`.
206
+ - `arga commit --skip` appends a final `[skip arga]` paragraph to the commit message so Arga skips validation for that head commit.
207
+ - `arga push` delegates to `git push`.
208
+ - `arga push --skip` verifies the current `HEAD` commit already contains `[skip arga]` before pushing. This is safest when the commit was created with `arga commit --skip`.
209
+
210
+ ## Supported MCP Targets
211
+
212
+ `arga mcp install` writes or updates MCP configuration for supported agents when they are detected locally:
213
+
214
+ - `~/.cursor/mcp.json`
215
+ - `~/.claude/mcp.json`
216
+ - `~/.config/codex/mcp.json`
217
+
218
+ The installed server is named `arga-context` and points to:
219
+
220
+ ```text
221
+ <api-url>/mcp
222
+ ```
223
+
224
+ using an `Authorization: Bearer <api_key>` header generated from your saved CLI login.
225
+
226
+ ## MCP Installation
227
+
228
+ Install or update MCP config after you have logged in:
229
+
230
+ ```bash
231
+ arga login
232
+ arga mcp install
233
+ ```
234
+
235
+ The installer:
236
+
237
+ - Detects supported local agent config directories.
238
+ - Preserves existing `mcpServers` entries.
239
+ - Merges in the generated `arga-context` server definition.
240
+ - Returns a non-zero exit code if no supported targets are detected or if any target cannot be updated.
241
+
242
+ If you need to add the server manually, the generated config looks like:
243
+
244
+ ```json
245
+ {
246
+ "mcpServers": {
247
+ "arga-context": {
248
+ "url": "https://api.argalabs.com/mcp",
249
+ "headers": {
250
+ "Authorization": "Bearer <your-api-key>"
251
+ }
252
+ }
253
+ }
254
+ }
255
+ ```
256
+
257
+ ## Using A Custom API URL
258
+
259
+ By default, the CLI targets `https://api.argalabs.com`.
260
+
261
+ To point it at another environment, pass `--api-url` or set `ARGA_API_URL`:
262
+
263
+ ```bash
264
+ arga login --api-url http://localhost:8000
265
+ arga mcp install --api-url http://localhost:8000
266
+ arga test url --api-url http://localhost:8000 --url https://demo-app.com --prompt "test checkout"
267
+ arga validate url --api-url http://localhost:8000 --url https://demo-app.com --prompt "test checkout"
268
+ arga validate pr --api-url http://localhost:8000 --repo arga-labs/validation-server --pr 182
269
+ ```
270
+
271
+ ```bash
272
+ export ARGA_API_URL=http://localhost:8000
273
+ arga login
274
+ ```
275
+
276
+ ## Local Development
277
+
278
+ ```bash
279
+ uv sync
280
+ uv run pytest
281
+ uv run arga --help
282
+ ```
283
+
284
+ To install the current checkout as a shell command:
285
+
286
+ ```bash
287
+ uv tool install -e .
288
+ ```
289
+
290
+ ## Config Storage
291
+
292
+ The CLI stores its local auth state in:
293
+
294
+ ```bash
295
+ ~/.config/arga/config.json
296
+ ```
297
+
298
+ That file contains the saved API key plus device metadata returned during `arga login`.
@@ -0,0 +1,278 @@
1
+ # Arga CLI
2
+
3
+ `arga` is the command-line interface for authenticating with Arga, installing MCP configuration into supported coding agents, and starting validation runs against deployed apps or pull requests.
4
+
5
+ ## What It Does
6
+
7
+ - Authenticates your machine with Arga using the device login flow.
8
+ - Stores a device-scoped API key locally so each terminal/device can be revoked independently.
9
+ - Shows the currently authenticated user and workspace.
10
+ - Installs MCP configuration into supported local agents.
11
+ - Starts URL validation runs from the terminal.
12
+ - Starts pull request validation runs from the terminal.
13
+ - Wraps `git commit` and `git push` with Arga skip-validation helpers.
14
+ - Starts and inspects Arga app scans.
15
+
16
+ ## Installation
17
+
18
+ Once published to PyPI:
19
+
20
+ ```bash
21
+ uv tool install arga-cli
22
+ ```
23
+
24
+ You can also install it with `pipx` or `pip`:
25
+
26
+ ```bash
27
+ pipx install arga-cli
28
+ pip install arga-cli
29
+ ```
30
+
31
+ After installation, the executable is:
32
+
33
+ ```bash
34
+ arga --help
35
+ ```
36
+
37
+ ## Quick Start
38
+
39
+ Authenticate:
40
+
41
+ ```bash
42
+ arga login
43
+ arga whoami
44
+ ```
45
+
46
+ Remove the saved device credential:
47
+
48
+ ```bash
49
+ arga logout
50
+ ```
51
+
52
+ Install MCP configuration for detected agents:
53
+
54
+ ```bash
55
+ arga mcp install
56
+ ```
57
+
58
+ Start a browser validation run:
59
+
60
+ ```bash
61
+ arga test url --url https://demo-app.com --prompt "test the login flow"
62
+ ```
63
+
64
+ Start a pull request validation run:
65
+
66
+ ```bash
67
+ arga validate pr --repo arga-labs/validation-server --pr 182
68
+ ```
69
+
70
+ Create a commit that skips Arga validation:
71
+
72
+ ```bash
73
+ arga commit -m "docs: update examples" --skip
74
+ arga push --skip
75
+ ```
76
+
77
+ Inspect or update automatic validation settings:
78
+
79
+ ```bash
80
+ arga validate install arga-labs/validation-server
81
+ arga validate config arga-labs/validation-server
82
+ arga validate config set arga-labs/validation-server --trigger branch --branch main --comments on
83
+ ```
84
+
85
+ Start an app scan and inspect it later:
86
+
87
+ ```bash
88
+ arga scan https://demo-app.com --budget 200
89
+ arga scan status <run_id>
90
+ arga scan report <run_id>
91
+ ```
92
+
93
+ List and inspect recent validation runs:
94
+
95
+ ```bash
96
+ arga runs list --repo arga-labs/validation-server --limit 20
97
+ arga runs status <run_id>
98
+ arga runs cancel <run_id>
99
+ ```
100
+
101
+ `arga validate url` is also available and currently behaves the same as `arga test url`:
102
+
103
+ ```bash
104
+ arga validate url --url https://demo-app.com --prompt "test checkout"
105
+ ```
106
+
107
+ ## Command Reference
108
+
109
+ ### Authentication
110
+
111
+ ```bash
112
+ arga login
113
+ arga whoami
114
+ arga logout
115
+ ```
116
+
117
+ - `arga login` opens the browser to complete Arga's device authorization flow.
118
+ - `arga whoami` verifies the saved API key and prints the GitHub login plus workspace.
119
+ - `arga logout` removes the local credential and attempts to revoke the current device on the server.
120
+
121
+ ### Validation
122
+
123
+ ```bash
124
+ arga test url --url https://demo-app.com --prompt "test login flow"
125
+ arga validate url --url https://demo-app.com --prompt "test checkout"
126
+ arga validate pr --repo arga-labs/validation-server --pr 182
127
+ arga validate install arga-labs/validation-server
128
+ arga validate config arga-labs/validation-server
129
+ arga validate config set arga-labs/validation-server --trigger branch --branch main --comments on
130
+ ```
131
+
132
+ - `arga test url` starts a one-off validation against a deployed URL.
133
+ - `arga validate url` is an equivalent URL-validation entry point under the `validate` namespace.
134
+ - `arga validate pr` starts GitHub-backed PR validation for a repository and pull request number.
135
+ - `arga validate install <repo>` installs the GitHub webhook for automatic validation on a repository.
136
+ - `arga validate config <repo>` shows the current automatic validation settings, including install state, trigger mode, selected branch, and PR comment behavior.
137
+ - `arga validate config set <repo>` updates the automatic validation settings. Any omitted options keep their current value.
138
+
139
+ For URL validation, you can optionally provide credentials:
140
+
141
+ ```bash
142
+ arga test url \
143
+ --url https://demo-app.com \
144
+ --prompt "log in and create an order" \
145
+ --email test@company.com \
146
+ --password supersecret
147
+ ```
148
+
149
+ Both `--email` and `--password` must be supplied together.
150
+
151
+ ### App Scans
152
+
153
+ ```bash
154
+ arga scan https://demo-app.com --budget 200
155
+ arga scan status <run_id>
156
+ arga scan report <run_id>
157
+ ```
158
+
159
+ - `arga scan <url>` starts an app scan, waits for the generated scan plan to be ready, and auto-approves it so execution can begin.
160
+ - `--budget` controls the red-team action budget and defaults to `200`.
161
+ - `arga scan status <run_id>` prints the current run status and anomaly count.
162
+ - `arga scan report <run_id>` prints the final JSON report once the scan has completed.
163
+
164
+ ### Validation Runs
165
+
166
+ ```bash
167
+ arga runs list --repo arga-labs/validation-server --status running --limit 20
168
+ arga runs status <run_id>
169
+ arga runs cancel <run_id>
170
+ ```
171
+
172
+ - `arga runs list` shows recent PR and branch validation runs in table form.
173
+ - `--repo` narrows the list to a single repository.
174
+ - `--status` accepts `completed`, `failed`, or `running`. The `running` filter includes non-terminal states such as `queued`.
175
+ - `arga runs status <run_id>` prints a detailed summary for a specific run.
176
+ - `arga runs cancel <run_id>` cancels the run through the validation API.
177
+
178
+ ### Git Wrappers
179
+
180
+ ```bash
181
+ arga commit -m "docs: update examples" --skip
182
+ arga push --skip
183
+ ```
184
+
185
+ - `arga commit` delegates to `git commit`.
186
+ - `arga commit --skip` appends a final `[skip arga]` paragraph to the commit message so Arga skips validation for that head commit.
187
+ - `arga push` delegates to `git push`.
188
+ - `arga push --skip` verifies the current `HEAD` commit already contains `[skip arga]` before pushing. This is safest when the commit was created with `arga commit --skip`.
189
+
190
+ ## Supported MCP Targets
191
+
192
+ `arga mcp install` writes or updates MCP configuration for supported agents when they are detected locally:
193
+
194
+ - `~/.cursor/mcp.json`
195
+ - `~/.claude/mcp.json`
196
+ - `~/.config/codex/mcp.json`
197
+
198
+ The installed server is named `arga-context` and points to:
199
+
200
+ ```text
201
+ <api-url>/mcp
202
+ ```
203
+
204
+ using an `Authorization: Bearer <api_key>` header generated from your saved CLI login.
205
+
206
+ ## MCP Installation
207
+
208
+ Install or update MCP config after you have logged in:
209
+
210
+ ```bash
211
+ arga login
212
+ arga mcp install
213
+ ```
214
+
215
+ The installer:
216
+
217
+ - Detects supported local agent config directories.
218
+ - Preserves existing `mcpServers` entries.
219
+ - Merges in the generated `arga-context` server definition.
220
+ - Returns a non-zero exit code if no supported targets are detected or if any target cannot be updated.
221
+
222
+ If you need to add the server manually, the generated config looks like:
223
+
224
+ ```json
225
+ {
226
+ "mcpServers": {
227
+ "arga-context": {
228
+ "url": "https://api.argalabs.com/mcp",
229
+ "headers": {
230
+ "Authorization": "Bearer <your-api-key>"
231
+ }
232
+ }
233
+ }
234
+ }
235
+ ```
236
+
237
+ ## Using A Custom API URL
238
+
239
+ By default, the CLI targets `https://api.argalabs.com`.
240
+
241
+ To point it at another environment, pass `--api-url` or set `ARGA_API_URL`:
242
+
243
+ ```bash
244
+ arga login --api-url http://localhost:8000
245
+ arga mcp install --api-url http://localhost:8000
246
+ arga test url --api-url http://localhost:8000 --url https://demo-app.com --prompt "test checkout"
247
+ arga validate url --api-url http://localhost:8000 --url https://demo-app.com --prompt "test checkout"
248
+ arga validate pr --api-url http://localhost:8000 --repo arga-labs/validation-server --pr 182
249
+ ```
250
+
251
+ ```bash
252
+ export ARGA_API_URL=http://localhost:8000
253
+ arga login
254
+ ```
255
+
256
+ ## Local Development
257
+
258
+ ```bash
259
+ uv sync
260
+ uv run pytest
261
+ uv run arga --help
262
+ ```
263
+
264
+ To install the current checkout as a shell command:
265
+
266
+ ```bash
267
+ uv tool install -e .
268
+ ```
269
+
270
+ ## Config Storage
271
+
272
+ The CLI stores its local auth state in:
273
+
274
+ ```bash
275
+ ~/.config/arga/config.json
276
+ ```
277
+
278
+ That file contains the saved API key plus device metadata returned during `arga login`.
@@ -0,0 +1 @@
1
+ """Arga CLI package."""