agex 0.1.0
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.
- package/assets/assets/cursor.js +88 -0
- package/assets/cursor.js +88 -0
- package/dist/agents-2OHWEGTE.js +10 -0
- package/dist/chunk-3FGK7LUI.js +849 -0
- package/dist/chunk-KVAOIDJ4.js +419 -0
- package/dist/cli.d.ts +4 -0
- package/dist/cli.js +392 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +11 -0
- package/package.json +32 -0
package/dist/cli.js
ADDED
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
proov,
|
|
4
|
+
runAgent,
|
|
5
|
+
runReview
|
|
6
|
+
} from "./chunk-KVAOIDJ4.js";
|
|
7
|
+
import "./chunk-3FGK7LUI.js";
|
|
8
|
+
|
|
9
|
+
// src/commands/proov.ts
|
|
10
|
+
function printHelp() {
|
|
11
|
+
console.log(`
|
|
12
|
+
agex proov - Prove visual assertions with screenshots
|
|
13
|
+
|
|
14
|
+
USAGE:
|
|
15
|
+
agex proov "<assertion>" [options]
|
|
16
|
+
|
|
17
|
+
OPTIONS:
|
|
18
|
+
--agent, -a <name> Agent to use: cursor (default), claude, codex
|
|
19
|
+
--url, -u <url> URL to navigate to
|
|
20
|
+
--output, -o <dir> Output directory (default: ./proov-results)
|
|
21
|
+
--video Enable video recording (default)
|
|
22
|
+
--no-video Disable video recording
|
|
23
|
+
--screenshots Enable screenshots (default)
|
|
24
|
+
--no-screenshots Disable screenshots
|
|
25
|
+
--model, -m <model> Model to use
|
|
26
|
+
--timeout, -t <ms> Timeout in milliseconds
|
|
27
|
+
--viewport <WxH> Viewport size (default: 1920x1080)
|
|
28
|
+
--headless Run headless (default)
|
|
29
|
+
--headed Show browser window
|
|
30
|
+
--help, -h Show this help
|
|
31
|
+
|
|
32
|
+
EXAMPLES:
|
|
33
|
+
agex proov "prove the Google logo is on the homepage" --url https://google.com
|
|
34
|
+
agex proov "verify login button exists" --agent claude --url https://example.com
|
|
35
|
+
`);
|
|
36
|
+
}
|
|
37
|
+
function parseArgs(args) {
|
|
38
|
+
const options = {};
|
|
39
|
+
let assertion = "";
|
|
40
|
+
for (let i = 0; i < args.length; i++) {
|
|
41
|
+
const arg = args[i];
|
|
42
|
+
if (arg === "--agent" || arg === "-a") {
|
|
43
|
+
options.agent = args[++i];
|
|
44
|
+
} else if (arg === "--url" || arg === "-u") {
|
|
45
|
+
options.url = args[++i];
|
|
46
|
+
} else if (arg === "--output" || arg === "-o") {
|
|
47
|
+
options.outputDir = args[++i];
|
|
48
|
+
} else if (arg === "--video") {
|
|
49
|
+
options.video = true;
|
|
50
|
+
} else if (arg === "--no-video") {
|
|
51
|
+
options.video = false;
|
|
52
|
+
} else if (arg === "--model" || arg === "-m") {
|
|
53
|
+
options.model = args[++i];
|
|
54
|
+
} else if (arg === "--timeout" || arg === "-t") {
|
|
55
|
+
options.timeout = parseInt(args[++i], 10);
|
|
56
|
+
} else if (arg === "--viewport") {
|
|
57
|
+
const [width, height] = args[++i].split("x").map(Number);
|
|
58
|
+
options.viewport = { width, height };
|
|
59
|
+
} else if (arg === "--headless") {
|
|
60
|
+
options.headless = true;
|
|
61
|
+
} else if (arg === "--headed") {
|
|
62
|
+
options.headless = false;
|
|
63
|
+
} else if (arg === "--screenshots") {
|
|
64
|
+
options.screenshots = true;
|
|
65
|
+
} else if (arg === "--no-screenshots") {
|
|
66
|
+
options.screenshots = false;
|
|
67
|
+
} else if (arg === "--help" || arg === "-h") {
|
|
68
|
+
printHelp();
|
|
69
|
+
process.exit(0);
|
|
70
|
+
} else if (!arg.startsWith("-")) {
|
|
71
|
+
assertion = assertion ? `${assertion} ${arg}` : arg;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return { assertion, options };
|
|
75
|
+
}
|
|
76
|
+
async function runProov(args) {
|
|
77
|
+
const { assertion, options } = parseArgs(args);
|
|
78
|
+
if (!assertion) {
|
|
79
|
+
console.error("Error: No assertion provided");
|
|
80
|
+
printHelp();
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
console.log("========================================");
|
|
84
|
+
console.log("agex proov");
|
|
85
|
+
console.log("========================================");
|
|
86
|
+
console.log(`Agent: ${options.agent ?? "cursor"}`);
|
|
87
|
+
console.log(`Task: ${assertion}`);
|
|
88
|
+
if (options.url) {
|
|
89
|
+
console.log(`URL: ${options.url}`);
|
|
90
|
+
}
|
|
91
|
+
console.log("========================================\n");
|
|
92
|
+
const result = await proov(assertion, options);
|
|
93
|
+
console.log("\n========================================");
|
|
94
|
+
if (result.verdict === "pass") {
|
|
95
|
+
console.log("\u2705 PASS");
|
|
96
|
+
} else if (result.verdict === "fail") {
|
|
97
|
+
console.log("\u274C FAIL");
|
|
98
|
+
} else {
|
|
99
|
+
console.log("\u23ED\uFE0F SKIP");
|
|
100
|
+
}
|
|
101
|
+
console.log(`Reason: ${result.reason}`);
|
|
102
|
+
console.log(`Duration: ${result.durationMs}ms`);
|
|
103
|
+
console.log(`Output: ${result.outputDir}`);
|
|
104
|
+
console.log("========================================");
|
|
105
|
+
process.exit(result.verdict === "pass" ? 0 : 1);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// src/commands/run.ts
|
|
109
|
+
function printHelp2() {
|
|
110
|
+
console.log(`
|
|
111
|
+
agex run - Execute AI agent tasks
|
|
112
|
+
|
|
113
|
+
USAGE:
|
|
114
|
+
agex run --agent <name> "<prompt>" [options]
|
|
115
|
+
|
|
116
|
+
OPTIONS:
|
|
117
|
+
--agent, -a <name> Agent to use: cursor, claude, codex (required)
|
|
118
|
+
--model, -m <model> Model to use
|
|
119
|
+
--prompt, -p <text> Prompt (can also be positional)
|
|
120
|
+
--install Run install command before agent
|
|
121
|
+
--install-command Custom install command
|
|
122
|
+
--require-api-key Require API key
|
|
123
|
+
--no-approve-mcps Don't auto-approve MCPs
|
|
124
|
+
--no-browser Disable browser
|
|
125
|
+
--no-stream Disable streaming output
|
|
126
|
+
--mode <mode> Output mode: text, json, debug
|
|
127
|
+
--approval <policy> Approval policy
|
|
128
|
+
--timeout <ms> Timeout in milliseconds
|
|
129
|
+
--help, -h Show this help
|
|
130
|
+
|
|
131
|
+
EXAMPLES:
|
|
132
|
+
agex run --agent cursor "build a landing page"
|
|
133
|
+
agex run --agent claude "refactor this function" --mode json
|
|
134
|
+
`);
|
|
135
|
+
}
|
|
136
|
+
function parseArgs2(args) {
|
|
137
|
+
let agent;
|
|
138
|
+
let model;
|
|
139
|
+
let prompt = "";
|
|
140
|
+
let install = false;
|
|
141
|
+
let installCommand;
|
|
142
|
+
let timeoutMs;
|
|
143
|
+
let requireApiKey = false;
|
|
144
|
+
let approveMcps = true;
|
|
145
|
+
let browser = true;
|
|
146
|
+
let streamOutput = true;
|
|
147
|
+
let outputMode = "text";
|
|
148
|
+
let approvalPolicy;
|
|
149
|
+
for (let i = 0; i < args.length; i += 1) {
|
|
150
|
+
const arg = args[i];
|
|
151
|
+
if (arg === "--help" || arg === "-h") {
|
|
152
|
+
printHelp2();
|
|
153
|
+
process.exit(0);
|
|
154
|
+
} else if (arg === "--agent" || arg === "-a") {
|
|
155
|
+
agent = args[i + 1];
|
|
156
|
+
i += 1;
|
|
157
|
+
} else if (arg === "--model" || arg === "-m") {
|
|
158
|
+
model = args[i + 1];
|
|
159
|
+
i += 1;
|
|
160
|
+
} else if (arg === "--prompt" || arg === "-p") {
|
|
161
|
+
prompt = args[i + 1] ?? "";
|
|
162
|
+
i += 1;
|
|
163
|
+
} else if (arg === "--install") {
|
|
164
|
+
install = true;
|
|
165
|
+
} else if (arg === "--install-command") {
|
|
166
|
+
installCommand = args[i + 1];
|
|
167
|
+
i += 1;
|
|
168
|
+
} else if (arg === "--require-api-key") {
|
|
169
|
+
requireApiKey = true;
|
|
170
|
+
} else if (arg === "--no-approve-mcps") {
|
|
171
|
+
approveMcps = false;
|
|
172
|
+
} else if (arg === "--no-browser") {
|
|
173
|
+
browser = false;
|
|
174
|
+
} else if (arg === "--no-stream") {
|
|
175
|
+
streamOutput = false;
|
|
176
|
+
} else if (arg === "--mode") {
|
|
177
|
+
const value = args[i + 1];
|
|
178
|
+
if (value === "json" || value === "text" || value === "debug") {
|
|
179
|
+
outputMode = value;
|
|
180
|
+
}
|
|
181
|
+
i += 1;
|
|
182
|
+
} else if (arg === "--approval") {
|
|
183
|
+
approvalPolicy = args[i + 1];
|
|
184
|
+
i += 1;
|
|
185
|
+
} else if (arg === "--timeout") {
|
|
186
|
+
const value = Number(args[i + 1]);
|
|
187
|
+
if (!Number.isNaN(value)) {
|
|
188
|
+
timeoutMs = value;
|
|
189
|
+
}
|
|
190
|
+
i += 1;
|
|
191
|
+
} else {
|
|
192
|
+
prompt = prompt ? `${prompt} ${arg}` : arg;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (!agent) {
|
|
196
|
+
throw new Error("Missing --agent");
|
|
197
|
+
}
|
|
198
|
+
if (!prompt) {
|
|
199
|
+
throw new Error("Missing prompt");
|
|
200
|
+
}
|
|
201
|
+
const quietOutput = outputMode === "json";
|
|
202
|
+
if (quietOutput) {
|
|
203
|
+
streamOutput = false;
|
|
204
|
+
}
|
|
205
|
+
return {
|
|
206
|
+
agent,
|
|
207
|
+
model,
|
|
208
|
+
prompt,
|
|
209
|
+
install,
|
|
210
|
+
installCommand,
|
|
211
|
+
requireApiKey,
|
|
212
|
+
approveMcps,
|
|
213
|
+
browser,
|
|
214
|
+
streamOutput,
|
|
215
|
+
quietOutput,
|
|
216
|
+
outputMode,
|
|
217
|
+
approvalPolicy,
|
|
218
|
+
timeoutMs
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
function formatOutput(result, mode, wasStreamed) {
|
|
222
|
+
switch (mode) {
|
|
223
|
+
case "json":
|
|
224
|
+
return JSON.stringify(result.json, null, 2);
|
|
225
|
+
case "text":
|
|
226
|
+
return wasStreamed ? null : result.formattedText;
|
|
227
|
+
case "debug":
|
|
228
|
+
return `${result.text}
|
|
229
|
+
|
|
230
|
+
---AGEX_JSON---
|
|
231
|
+
${JSON.stringify(result.json, null, 2)}`;
|
|
232
|
+
default:
|
|
233
|
+
return null;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
async function runRun(args) {
|
|
237
|
+
const request = parseArgs2(args);
|
|
238
|
+
const result = await runAgent(request);
|
|
239
|
+
const output = formatOutput(result, request.outputMode, request.streamOutput ?? true);
|
|
240
|
+
if (output !== null) {
|
|
241
|
+
process.stdout.write(`${output}
|
|
242
|
+
`);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// src/commands/review.ts
|
|
247
|
+
function printHelp3() {
|
|
248
|
+
console.log(`
|
|
249
|
+
agex review - Review code changes
|
|
250
|
+
|
|
251
|
+
USAGE:
|
|
252
|
+
agex review --base <ref> --agent <name> [options]
|
|
253
|
+
|
|
254
|
+
OPTIONS:
|
|
255
|
+
--base <ref> Base branch/commit to compare against (required)
|
|
256
|
+
--agent, -a <name> Agent to use: cursor, claude, codex (required)
|
|
257
|
+
--model, -m <model> Model to use
|
|
258
|
+
--no-worktree Exclude worktree changes
|
|
259
|
+
--hypotheses <n> Number of hypotheses to generate
|
|
260
|
+
--hint <text> Additional prompt hint
|
|
261
|
+
--help, -h Show this help
|
|
262
|
+
|
|
263
|
+
EXAMPLES:
|
|
264
|
+
agex review --base main --agent cursor
|
|
265
|
+
agex review --base HEAD~3 --agent claude --hint "focus on security"
|
|
266
|
+
`);
|
|
267
|
+
}
|
|
268
|
+
function parseArgs3(args) {
|
|
269
|
+
let baseRef = "";
|
|
270
|
+
let agent;
|
|
271
|
+
let model;
|
|
272
|
+
let includeWorktree = true;
|
|
273
|
+
let hypotheses;
|
|
274
|
+
let promptHint;
|
|
275
|
+
for (let i = 0; i < args.length; i += 1) {
|
|
276
|
+
const arg = args[i];
|
|
277
|
+
if (arg === "--help" || arg === "-h") {
|
|
278
|
+
printHelp3();
|
|
279
|
+
process.exit(0);
|
|
280
|
+
} else if (arg === "--base") {
|
|
281
|
+
baseRef = args[i + 1] ?? "";
|
|
282
|
+
i += 1;
|
|
283
|
+
} else if (arg === "--agent" || arg === "-a") {
|
|
284
|
+
agent = args[i + 1];
|
|
285
|
+
i += 1;
|
|
286
|
+
} else if (arg === "--model" || arg === "-m") {
|
|
287
|
+
model = args[i + 1];
|
|
288
|
+
i += 1;
|
|
289
|
+
} else if (arg === "--no-worktree") {
|
|
290
|
+
includeWorktree = false;
|
|
291
|
+
} else if (arg === "--hypotheses") {
|
|
292
|
+
const value = Number(args[i + 1]);
|
|
293
|
+
if (!Number.isNaN(value)) {
|
|
294
|
+
hypotheses = value;
|
|
295
|
+
}
|
|
296
|
+
i += 1;
|
|
297
|
+
} else if (arg === "--hint") {
|
|
298
|
+
promptHint = args[i + 1];
|
|
299
|
+
i += 1;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
if (!baseRef) {
|
|
303
|
+
throw new Error("Missing --base");
|
|
304
|
+
}
|
|
305
|
+
if (!agent) {
|
|
306
|
+
throw new Error("Missing --agent");
|
|
307
|
+
}
|
|
308
|
+
return {
|
|
309
|
+
baseRef,
|
|
310
|
+
agent,
|
|
311
|
+
model,
|
|
312
|
+
includeWorktree,
|
|
313
|
+
hypotheses,
|
|
314
|
+
promptHint
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
async function runReview2(args) {
|
|
318
|
+
const request = parseArgs3(args);
|
|
319
|
+
const result = await runReview(request);
|
|
320
|
+
process.stdout.write(`${result.text}
|
|
321
|
+
|
|
322
|
+
---AGEX_JSON---
|
|
323
|
+
${JSON.stringify(result.json, null, 2)}
|
|
324
|
+
`);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
// src/cli.ts
|
|
328
|
+
var VERSION = "0.1.0";
|
|
329
|
+
var COMMANDS = {
|
|
330
|
+
proov: {
|
|
331
|
+
description: "Prove visual assertions with screenshots",
|
|
332
|
+
run: runProov
|
|
333
|
+
},
|
|
334
|
+
run: {
|
|
335
|
+
description: "Execute AI agent tasks",
|
|
336
|
+
run: runRun
|
|
337
|
+
},
|
|
338
|
+
review: {
|
|
339
|
+
description: "Review code changes",
|
|
340
|
+
run: runReview2
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
function printHelp4() {
|
|
344
|
+
console.log(`
|
|
345
|
+
agex - AI-powered automation toolkit
|
|
346
|
+
|
|
347
|
+
VERSION: ${VERSION}
|
|
348
|
+
|
|
349
|
+
USAGE:
|
|
350
|
+
agex <command> [options]
|
|
351
|
+
|
|
352
|
+
COMMANDS:
|
|
353
|
+
proov ${COMMANDS.proov.description}
|
|
354
|
+
run ${COMMANDS.run.description}
|
|
355
|
+
review ${COMMANDS.review.description}
|
|
356
|
+
|
|
357
|
+
EXAMPLES:
|
|
358
|
+
agex proov "prove google has a logo" --url https://google.com
|
|
359
|
+
agex run --agent cursor "build a landing page"
|
|
360
|
+
agex review --base main --agent cursor
|
|
361
|
+
|
|
362
|
+
Run 'agex <command> --help' for command-specific options.
|
|
363
|
+
`);
|
|
364
|
+
}
|
|
365
|
+
function printVersion() {
|
|
366
|
+
console.log(`agex v${VERSION}`);
|
|
367
|
+
}
|
|
368
|
+
async function main() {
|
|
369
|
+
const args = process.argv.slice(2);
|
|
370
|
+
if (args.length === 0 || args[0] === "--help" || args[0] === "-h") {
|
|
371
|
+
printHelp4();
|
|
372
|
+
process.exit(0);
|
|
373
|
+
}
|
|
374
|
+
if (args[0] === "--version" || args[0] === "-v") {
|
|
375
|
+
printVersion();
|
|
376
|
+
process.exit(0);
|
|
377
|
+
}
|
|
378
|
+
const command = args[0];
|
|
379
|
+
const commandArgs = args.slice(1);
|
|
380
|
+
if (!(command in COMMANDS)) {
|
|
381
|
+
console.error(`Unknown command: ${command}`);
|
|
382
|
+
console.error(`Run 'agex --help' for available commands.`);
|
|
383
|
+
process.exit(1);
|
|
384
|
+
}
|
|
385
|
+
try {
|
|
386
|
+
await COMMANDS[command].run(commandArgs);
|
|
387
|
+
} catch (error) {
|
|
388
|
+
console.error("Error:", error instanceof Error ? error.message : error);
|
|
389
|
+
process.exit(1);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
main();
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "agex",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"agex": "dist/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"assets"
|
|
13
|
+
],
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"execa": "^9.6.1"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/node": "^22.19.7",
|
|
19
|
+
"tsup": "^8.4.0",
|
|
20
|
+
"typescript": "^5.9.3",
|
|
21
|
+
"vitest": "^2.1.9",
|
|
22
|
+
"agex-run": "0.1.0",
|
|
23
|
+
"agex-browse": "0.1.0",
|
|
24
|
+
"agex-proov": "0.1.0",
|
|
25
|
+
"agex-review": "0.1.0"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "tsc -p tsconfig.json",
|
|
29
|
+
"bundle": "tsup && cp -r ../browse/assets ./assets",
|
|
30
|
+
"test": "vitest run"
|
|
31
|
+
}
|
|
32
|
+
}
|