agex 0.2.6 → 0.2.8

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 (49) hide show
  1. package/README.md +176 -0
  2. package/dist/cli.js +588 -19
  3. package/dist/index.js +16 -6
  4. package/package.json +9 -4
  5. package/assets/assets/assets/cursor.js +0 -192
  6. package/assets/assets/assets/effects.js +0 -1586
  7. package/assets/scripts/scripts/ab-close-disabled.sh +0 -5
  8. package/assets/scripts/scripts/ab-close.sh +0 -130
  9. package/assets/scripts/scripts/ab-fx.sh +0 -3
  10. package/assets/scripts/scripts/ab-move.sh +0 -19
  11. package/assets/scripts/scripts/ab-not-found.sh +0 -33
  12. package/assets/scripts/scripts/ab-open.sh +0 -17
  13. package/assets/scripts/scripts/ab-proof.sh +0 -126
  14. package/assets/scripts/scripts/ab-record-disabled.sh +0 -3
  15. package/assets/scripts/scripts/ab-record-start-disabled.sh +0 -2
  16. package/assets/scripts/scripts/ab-record-start.sh +0 -18
  17. package/assets/scripts/scripts/ab-record-stop-disabled.sh +0 -2
  18. package/assets/scripts/scripts/ab-record-stop.sh +0 -5
  19. package/assets/scripts/scripts/ab-record.sh +0 -43
  20. package/assets/scripts/scripts/ab-screenshot.sh +0 -9
  21. package/assets/scripts/scripts/agent-browser-wrapper.sh +0 -6
  22. package/assets/scripts/scripts/fx-annotation.sh +0 -13
  23. package/assets/scripts/scripts/fx-arrow.sh +0 -12
  24. package/assets/scripts/scripts/fx-circle.sh +0 -13
  25. package/assets/scripts/scripts/fx-clear.sh +0 -3
  26. package/assets/scripts/scripts/fx-highlight.sh +0 -32
  27. package/assets/scripts/scripts/fx-spotlight.sh +0 -13
  28. package/assets/scripts/scripts/fx-title.sh +0 -11
  29. package/assets/scripts/scripts/fx-wait.sh +0 -3
  30. package/dist/cli.d.ts +0 -6
  31. package/dist/cli.d.ts.map +0 -1
  32. package/dist/cli.js.map +0 -1
  33. package/dist/commands/browse.d.ts.map +0 -1
  34. package/dist/commands/browse.js +0 -112
  35. package/dist/commands/browse.js.map +0 -1
  36. package/dist/commands/prove-pr.d.ts.map +0 -1
  37. package/dist/commands/prove-pr.js +0 -120
  38. package/dist/commands/prove-pr.js.map +0 -1
  39. package/dist/commands/prove.d.ts.map +0 -1
  40. package/dist/commands/prove.js +0 -138
  41. package/dist/commands/prove.js.map +0 -1
  42. package/dist/commands/review.d.ts.map +0 -1
  43. package/dist/commands/review.js +0 -82
  44. package/dist/commands/review.js.map +0 -1
  45. package/dist/commands/run.d.ts.map +0 -1
  46. package/dist/commands/run.js +0 -132
  47. package/dist/commands/run.js.map +0 -1
  48. package/dist/index.d.ts.map +0 -1
  49. package/dist/index.js.map +0 -1
@@ -1,112 +0,0 @@
1
- import { defineCommand } from 'citty';
2
- import { execa } from 'execa';
3
- async function installBrowser() {
4
- console.log('[agex browse] Browser not found. Installing Chromium...');
5
- await execa('npx', ['--yes', 'playwright', 'install', 'chromium'], { stdio: 'inherit' });
6
- console.log('[agex browse] Browser installed successfully.');
7
- }
8
- async function runAgentBrowser(browserArgs) {
9
- try {
10
- const result = await execa('npx', ['--yes', 'agent-browser', ...browserArgs], {
11
- stdio: 'pipe',
12
- env: { ...process.env },
13
- });
14
- if (result.stdout)
15
- process.stdout.write(result.stdout);
16
- if (result.stderr)
17
- process.stderr.write(result.stderr);
18
- return { success: true, needsBrowserInstall: false };
19
- }
20
- catch (error) {
21
- const execaError = error;
22
- const output = `${execaError.stdout ?? ''}${execaError.stderr ?? ''}`;
23
- if (output.includes("Executable doesn't exist") || output.includes('npx playwright install')) {
24
- return { success: false, needsBrowserInstall: true };
25
- }
26
- if (execaError.stdout)
27
- process.stdout.write(execaError.stdout);
28
- if (execaError.stderr)
29
- process.stderr.write(execaError.stderr);
30
- return { success: false, needsBrowserInstall: false };
31
- }
32
- }
33
- export default defineCommand({
34
- meta: {
35
- name: 'browse',
36
- description: 'Browser automation via agent-browser',
37
- },
38
- args: {
39
- install: {
40
- type: 'boolean',
41
- description: 'Force reinstall browser',
42
- default: false,
43
- },
44
- _: {
45
- type: 'positional',
46
- description: 'agent-browser command and arguments',
47
- required: false,
48
- },
49
- },
50
- async run({ args, rawArgs }) {
51
- const browserArgs = rawArgs.filter(arg => arg !== '--install');
52
- if (browserArgs.length === 0) {
53
- console.log(`
54
- agex browse - Browser automation via agent-browser
55
-
56
- USAGE:
57
- agex browse <command> [options]
58
-
59
- COMMANDS:
60
- All agent-browser commands are supported. Common ones:
61
-
62
- open <url> Navigate to URL
63
- snapshot [-i] Get accessibility tree (use -i for interactive elements)
64
- click @e1 Click element by ref
65
- fill @e2 "text" Fill input by ref
66
- screenshot [path] Take screenshot
67
- close Close browser
68
-
69
- OPTIONS:
70
- --install Force reinstall browser
71
-
72
- EXAMPLES:
73
- agex browse open https://example.com
74
- agex browse snapshot -i
75
- agex browse click @e1
76
- agex browse fill @e2 "hello@example.com"
77
- agex browse screenshot page.png
78
- agex browse close
79
-
80
- For full documentation, run: npx agent-browser --help
81
- Or visit: https://github.com/vercel-labs/agent-browser
82
- `);
83
- return;
84
- }
85
- if (args.install) {
86
- await installBrowser();
87
- if (browserArgs.length === 0) {
88
- return;
89
- }
90
- }
91
- const firstRun = await runAgentBrowser(browserArgs);
92
- if (firstRun.success) {
93
- return;
94
- }
95
- if (firstRun.needsBrowserInstall) {
96
- await installBrowser();
97
- try {
98
- await execa('npx', ['--yes', 'agent-browser', ...browserArgs], {
99
- stdio: 'inherit',
100
- env: { ...process.env },
101
- });
102
- }
103
- catch (error) {
104
- const exitCode = error.exitCode ?? 1;
105
- process.exit(exitCode);
106
- }
107
- return;
108
- }
109
- process.exit(1);
110
- },
111
- });
112
- //# sourceMappingURL=browse.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"browse.js","sourceRoot":"","sources":["../../src/commands/browse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAE9B,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;YACjC,MAAM,cAAc,EAAE,CAAC;YAEvB,IAAI,CAAC;gBACH,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,WAAW,CAAC,EAAE;oBAC7D,KAAK,EAAE,SAAS;oBAChB,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE;iBACxB,CAAC,CAAC;YACL,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,QAAQ,GAAI,KAA+B,CAAC,QAAQ,IAAI,CAAC,CAAC;gBAChE,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACzB,CAAC;YACD,OAAO;QACT,CAAC;QAED,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;CACF,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"prove-pr.d.ts","sourceRoot":"","sources":["../../src/commands/prove-pr.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,wBAuHG"}
@@ -1,120 +0,0 @@
1
- import { defineCommand } from 'citty';
2
- import { provePr } from 'agex-prove-pr';
3
- import { AGENT_NAMES, isAgexError, viewportStringSchema, } from 'agex-core';
4
- export default defineCommand({
5
- meta: {
6
- name: 'prove-pr',
7
- description: 'Prove PR changes work with screenshots and evidence',
8
- },
9
- args: {
10
- base: {
11
- type: 'string',
12
- description: 'Base branch/commit to compare against (auto-detected if omitted)',
13
- },
14
- agent: {
15
- type: 'string',
16
- alias: 'a',
17
- description: 'Agent to use: cursor (default), claude, codex',
18
- default: 'cursor',
19
- },
20
- url: {
21
- type: 'string',
22
- alias: 'u',
23
- description: 'Dev server URL for visual testing',
24
- },
25
- output: {
26
- type: 'string',
27
- alias: 'o',
28
- description: 'Output directory',
29
- default: './prove-pr-results',
30
- },
31
- hypotheses: {
32
- type: 'string',
33
- description: 'Number of hypotheses to generate',
34
- default: '5',
35
- },
36
- model: {
37
- type: 'string',
38
- alias: 'm',
39
- description: 'Model to use',
40
- },
41
- viewport: {
42
- type: 'string',
43
- description: 'Viewport size (WxH)',
44
- default: '1920x1080',
45
- },
46
- hint: {
47
- type: 'string',
48
- description: 'Additional prompt hint for hypothesis generation',
49
- },
50
- timeout: {
51
- type: 'string',
52
- alias: 't',
53
- description: 'Timeout in milliseconds',
54
- default: '300000',
55
- },
56
- },
57
- async run({ args }) {
58
- // Validate agent
59
- if (!AGENT_NAMES.includes(args.agent)) {
60
- console.error(`Invalid agent: "${args.agent}". Must be one of: ${AGENT_NAMES.join(', ')}`);
61
- process.exit(1);
62
- }
63
- // Validate viewport
64
- const viewportResult = viewportStringSchema.safeParse(args.viewport);
65
- if (!viewportResult.success) {
66
- console.error(`Invalid viewport: "${args.viewport}". Use format "WIDTHxHEIGHT" (e.g. "1920x1080")`);
67
- process.exit(1);
68
- }
69
- // Validate hypotheses
70
- const hypothesesCount = parseInt(args.hypotheses, 10);
71
- if (isNaN(hypothesesCount) || hypothesesCount <= 0) {
72
- console.error(`Invalid hypotheses count: "${args.hypotheses}". Must be a positive integer.`);
73
- process.exit(1);
74
- }
75
- const request = {
76
- baseRef: args.base,
77
- agent: args.agent,
78
- url: args.url,
79
- outputDir: args.output,
80
- hypothesesCount,
81
- model: args.model,
82
- viewport: viewportResult.data,
83
- hint: args.hint,
84
- timeoutMs: args.timeout ? parseInt(args.timeout, 10) : undefined,
85
- };
86
- console.log('========================================');
87
- console.log('agex prove-pr');
88
- console.log('========================================');
89
- console.log(`Base: ${request.baseRef || '(auto-detect)'}`);
90
- console.log(`Agent: ${request.agent}`);
91
- console.log(`Hypotheses: ${hypothesesCount}`);
92
- if (request.url)
93
- console.log(`URL: ${request.url}`);
94
- console.log(`Output: ${request.outputDir}`);
95
- console.log('========================================\n');
96
- try {
97
- const result = await provePr(request);
98
- console.log('\n========================================');
99
- console.log('RESULTS');
100
- console.log('========================================');
101
- console.log(`✅ Passed: ${result.summary.pass}`);
102
- console.log(`❌ Failed: ${result.summary.fail}`);
103
- console.log(`⏭️ Skipped: ${result.summary.skip}`);
104
- console.log(`Duration: ${(result.durationMs / 1000).toFixed(1)}s`);
105
- console.log(`Output: ${result.outputDir}`);
106
- console.log('========================================');
107
- process.exit(result.summary.fail === 0 ? 0 : 1);
108
- }
109
- catch (err) {
110
- if (isAgexError(err)) {
111
- console.error(`Error [${err.code}]: ${err.message}`);
112
- }
113
- else {
114
- console.error(`Unexpected error: ${err instanceof Error ? err.message : String(err)}`);
115
- }
116
- process.exit(1);
117
- }
118
- },
119
- });
120
- //# sourceMappingURL=prove-pr.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prove-pr.js","sourceRoot":"","sources":["../../src/commands/prove-pr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EACL,WAAW,EACX,WAAW,EACX,oBAAoB,GACrB,MAAM,WAAW,CAAC;AAGnB,eAAe,aAAa,CAAC;IAC3B,IAAI,EAAE;QACJ,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,qDAAqD;KACnE;IACD,IAAI,EAAE;QACJ,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,kEAAkE;SAChF;QACD,KAAK,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,GAAG;YACV,WAAW,EAAE,+CAA+C;YAC5D,OAAO,EAAE,QAAQ;SAClB;QACD,GAAG,EAAE;YACH,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,GAAG;YACV,WAAW,EAAE,mCAAmC;SACjD;QACD,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,GAAG;YACV,WAAW,EAAE,kBAAkB;YAC/B,OAAO,EAAE,oBAAoB;SAC9B;QACD,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,WAAW,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AAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"prove.d.ts","sourceRoot":"","sources":["../../src/commands/prove.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,wBAwIG"}
@@ -1,138 +0,0 @@
1
- import { defineCommand } from 'citty';
2
- import { prove, proveOptionsSchema } from 'agex-prove';
3
- import { validate, viewportStringSchema, isAgexError, AGENT_NAMES, } from 'agex-core';
4
- export default defineCommand({
5
- meta: {
6
- name: 'prove',
7
- description: 'Prove visual assertions with screenshots',
8
- },
9
- args: {
10
- assertion: {
11
- type: 'positional',
12
- description: 'The assertion to prove',
13
- required: true,
14
- },
15
- agent: {
16
- type: 'string',
17
- alias: 'a',
18
- description: 'Agent to use: cursor (default), claude, codex',
19
- default: 'cursor',
20
- },
21
- url: {
22
- type: 'string',
23
- alias: 'u',
24
- description: 'URL to navigate to',
25
- },
26
- output: {
27
- type: 'string',
28
- alias: 'o',
29
- description: 'Output directory',
30
- default: './prove-results',
31
- },
32
- video: {
33
- type: 'boolean',
34
- description: 'Enable video recording',
35
- default: true,
36
- },
37
- screenshots: {
38
- type: 'boolean',
39
- description: 'Enable screenshots',
40
- default: true,
41
- },
42
- model: {
43
- type: 'string',
44
- alias: 'm',
45
- description: 'Model to use',
46
- },
47
- timeout: {
48
- type: 'string',
49
- alias: 't',
50
- description: 'Timeout in milliseconds',
51
- default: '300000',
52
- },
53
- viewport: {
54
- type: 'string',
55
- description: 'Viewport size (WxH)',
56
- default: '1920x1080',
57
- },
58
- headless: {
59
- type: 'boolean',
60
- description: 'Run headless',
61
- default: true,
62
- },
63
- browser: {
64
- type: 'string',
65
- alias: 'b',
66
- description: 'Browser mode: mcp (default) or cli (agent-browser)',
67
- default: 'mcp',
68
- },
69
- },
70
- async run({ args }) {
71
- // Validate agent name
72
- if (!AGENT_NAMES.includes(args.agent)) {
73
- console.error(`Invalid agent: "${args.agent}". Must be one of: ${AGENT_NAMES.join(', ')}`);
74
- process.exit(1);
75
- }
76
- // Validate and parse viewport
77
- const viewportResult = viewportStringSchema.safeParse(args.viewport);
78
- if (!viewportResult.success) {
79
- console.error(`Invalid viewport: "${args.viewport}". Use format "WIDTHxHEIGHT" (e.g. "1920x1080")`);
80
- process.exit(1);
81
- }
82
- const options = {
83
- agent: args.agent,
84
- url: args.url,
85
- outputDir: args.output,
86
- video: args.video,
87
- screenshots: args.screenshots,
88
- model: args.model,
89
- timeout: args.timeout ? parseInt(args.timeout, 10) : undefined,
90
- viewport: viewportResult.data,
91
- headless: args.headless,
92
- };
93
- // Validate full options
94
- const validated = validate(proveOptionsSchema, options);
95
- if (!validated.success) {
96
- console.error(`Invalid options: ${validated.error}`);
97
- process.exit(1);
98
- }
99
- console.log('========================================');
100
- console.log('agex prove');
101
- console.log('========================================');
102
- console.log(`Workspace: ${process.cwd()}`);
103
- console.log(`Agent: ${options.agent}`);
104
- console.log(`Task: ${args.assertion}`);
105
- if (options.url) {
106
- console.log(`URL: ${options.url}`);
107
- }
108
- console.log('========================================\n');
109
- try {
110
- const result = await prove(args.assertion, options);
111
- console.log('\n========================================');
112
- if (result.verdict === 'pass') {
113
- console.log('✅ PASS');
114
- }
115
- else if (result.verdict === 'fail') {
116
- console.log('❌ FAIL');
117
- }
118
- else {
119
- console.log('⏭️ SKIP');
120
- }
121
- console.log(`Reason: ${result.reason}`);
122
- console.log(`Duration: ${result.durationMs}ms`);
123
- console.log(`Output: ${result.outputDir}`);
124
- console.log('========================================');
125
- process.exit(result.verdict === 'pass' ? 0 : 1);
126
- }
127
- catch (err) {
128
- if (isAgexError(err)) {
129
- console.error(`Error [${err.code}]: ${err.message}`);
130
- }
131
- else {
132
- console.error(`Unexpected error: ${err instanceof Error ? err.message : String(err)}`);
133
- }
134
- process.exit(1);
135
- }
136
- },
137
- });
138
- //# sourceMappingURL=prove.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prove.js","sourceRoot":"","sources":["../../src/commands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,CAAC;gBACrC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YACxB,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YAC1B,CAAC;YACD,OAAO,CAAC,GAAG,CAAC,WAAW,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;YACxC,OAAO,CAAC,GAAG,CAAC,aAAa,MAAM,CAAC,UAAU,IAAI,CAAC,CAAC;YAChD,OAAO,CAAC,GAAG,CAAC,WAAW,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;YAC3C,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;YAExD,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAClD,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC;gBACrB,OAAO,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,IAAI,MAAM,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;YACvD,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,KAAK,CAAC,qBAAqB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACzF,CAAC;YACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"review.d.ts","sourceRoot":"","sources":["../../src/commands/review.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,wBA6EG"}
@@ -1,82 +0,0 @@
1
- import { defineCommand } from 'citty';
2
- import { runReview as runReviewFn } from 'agex-review';
3
- import { AGENT_NAMES, detectDefaultBranch, isAgexError } from 'agex-core';
4
- export default defineCommand({
5
- meta: {
6
- name: 'review',
7
- description: 'Review code changes',
8
- },
9
- args: {
10
- base: {
11
- type: 'string',
12
- description: 'Base branch/commit to compare against (auto-detected if omitted)',
13
- },
14
- agent: {
15
- type: 'string',
16
- alias: 'a',
17
- description: 'Agent to use: cursor, claude, codex',
18
- required: true,
19
- },
20
- model: {
21
- type: 'string',
22
- alias: 'm',
23
- description: 'Model to use',
24
- },
25
- worktree: {
26
- type: 'boolean',
27
- description: 'Include worktree changes',
28
- default: true,
29
- },
30
- hypotheses: {
31
- type: 'string',
32
- description: 'Number of hypotheses to generate',
33
- },
34
- hint: {
35
- type: 'string',
36
- description: 'Additional prompt hint',
37
- },
38
- timeout: {
39
- type: 'string',
40
- alias: 't',
41
- description: 'Timeout in milliseconds',
42
- default: '300000',
43
- },
44
- },
45
- async run({ args }) {
46
- // Validate agent
47
- if (!AGENT_NAMES.includes(args.agent)) {
48
- console.error(`Invalid agent: "${args.agent}". Must be one of: ${AGENT_NAMES.join(', ')}`);
49
- process.exit(1);
50
- }
51
- // Validate hypotheses if provided
52
- if (args.hypotheses) {
53
- const h = parseInt(args.hypotheses, 10);
54
- if (isNaN(h) || h <= 0) {
55
- console.error(`Invalid hypotheses count: "${args.hypotheses}". Must be a positive integer.`);
56
- process.exit(1);
57
- }
58
- }
59
- try {
60
- const base = args.base || detectDefaultBranch();
61
- await runReviewFn({
62
- baseRef: base,
63
- agent: args.agent,
64
- model: args.model,
65
- includeWorktree: args.worktree,
66
- hypotheses: args.hypotheses ? parseInt(args.hypotheses, 10) : undefined,
67
- promptHint: args.hint,
68
- timeoutMs: args.timeout ? parseInt(args.timeout, 10) : undefined,
69
- });
70
- }
71
- catch (err) {
72
- if (isAgexError(err)) {
73
- console.error(`Error [${err.code}]: ${err.message}`);
74
- }
75
- else {
76
- console.error(`Unexpected error: ${err instanceof Error ? err.message : String(err)}`);
77
- }
78
- process.exit(1);
79
- }
80
- },
81
- });
82
- //# sourceMappingURL=review.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"review.js","sourceRoot":"","sources":["../../src/commands/review.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAI1E,eAAe,aAAa,CAAC;IAC3B,IAAI,EAAE;QACJ,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,qBAAqB;KACnC;IACD,IAAI,EAAE;QACJ,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,kEAAkE;SAChF;QACD,KAAK,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,GAAG;YACV,WAAW,EAAE,qCAAqC;YAClD,QAAQ,EAAE,IAAI;SACf;QACD,KAAK,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,GAAG;YACV,WAAW,EAAE,cAAc;SAC5B;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,SAAS;YACf,WAAW,EAAE,0BAA0B;YACvC,OAAO,EAAE,IAAI;SACd;QACD,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,kCAAkC;SAChD;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,wBAAwB;SACtC;QACD,OAAO,EAAE;YACP,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,GAAG;YACV,WAAW,EAAE,yBAAyB;YACtC,OAAO,EAAE,QAAQ;SAClB;KACF;IACD,KAAK,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE;QAChB,iBAAiB;QACjB,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAkB,CAAC,EAAE,CAAC;YACnD,OAAO,CAAC,KAAK,CAAC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,OAAO,EAAE,CAAC,CAAC;YACvD,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,KAAK,CAAC,qBAAqB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACzF,CAAC;YACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,wBAsHG"}
@@ -1,132 +0,0 @@
1
- import { defineCommand } from 'citty';
2
- import { runAgent } from 'agex-agent';
3
- import { AGENT_NAMES, OUTPUT_MODES, APPROVAL_POLICIES, isAgexError } from 'agex-core';
4
- function formatOutput(result, mode, wasStreamed) {
5
- switch (mode) {
6
- case 'json':
7
- return JSON.stringify(result.json, null, 2);
8
- case 'text':
9
- return wasStreamed ? null : result.formattedText;
10
- case 'debug':
11
- return `${result.text}\n\n---AGEX_JSON---\n${JSON.stringify(result.json, null, 2)}`;
12
- default:
13
- return null;
14
- }
15
- }
16
- export default defineCommand({
17
- meta: {
18
- name: 'run',
19
- description: 'Execute AI agent tasks',
20
- },
21
- args: {
22
- prompt: {
23
- type: 'positional',
24
- description: 'The prompt to execute',
25
- required: true,
26
- },
27
- agent: {
28
- type: 'string',
29
- alias: 'a',
30
- description: 'Agent to use: cursor, claude, codex (auto-detected if not specified)',
31
- },
32
- model: {
33
- type: 'string',
34
- alias: 'm',
35
- description: 'Model to use',
36
- },
37
- install: {
38
- type: 'boolean',
39
- description: 'Run install command before agent',
40
- default: false,
41
- },
42
- installCommand: {
43
- type: 'string',
44
- description: 'Custom install command',
45
- },
46
- requireApiKey: {
47
- type: 'boolean',
48
- description: 'Require API key',
49
- default: false,
50
- },
51
- approveMcps: {
52
- type: 'boolean',
53
- description: 'Auto-approve MCPs',
54
- default: true,
55
- },
56
- browser: {
57
- type: 'boolean',
58
- description: 'Enable browser',
59
- default: true,
60
- },
61
- stream: {
62
- type: 'boolean',
63
- description: 'Enable streaming output',
64
- default: true,
65
- },
66
- mode: {
67
- type: 'string',
68
- description: 'Output mode: text, json, debug',
69
- default: 'text',
70
- },
71
- approval: {
72
- type: 'string',
73
- description: 'Approval policy: never, on-request, on-failure, untrusted',
74
- },
75
- timeout: {
76
- type: 'string',
77
- description: 'Timeout in milliseconds',
78
- default: '300000',
79
- },
80
- },
81
- async run({ args }) {
82
- // Validate agent if provided
83
- if (args.agent && !AGENT_NAMES.includes(args.agent)) {
84
- console.error(`Invalid agent: "${args.agent}". Must be one of: ${AGENT_NAMES.join(', ')}`);
85
- process.exit(1);
86
- }
87
- // Validate output mode
88
- if (!OUTPUT_MODES.includes(args.mode)) {
89
- console.error(`Invalid mode: "${args.mode}". Must be one of: ${OUTPUT_MODES.join(', ')}`);
90
- process.exit(1);
91
- }
92
- // Validate approval policy
93
- if (args.approval && !APPROVAL_POLICIES.includes(args.approval)) {
94
- console.error(`Invalid approval policy: "${args.approval}". Must be one of: ${APPROVAL_POLICIES.join(', ')}`);
95
- process.exit(1);
96
- }
97
- const outputMode = args.mode;
98
- const quietOutput = outputMode === 'json';
99
- const streamOutput = quietOutput ? false : args.stream;
100
- const request = {
101
- agent: args.agent,
102
- prompt: args.prompt,
103
- model: args.model,
104
- install: args.install,
105
- installCommand: args.installCommand,
106
- requireApiKey: args.requireApiKey,
107
- approveMcps: args.approveMcps,
108
- browser: args.browser,
109
- streamOutput,
110
- quietOutput,
111
- approvalPolicy: args.approval,
112
- timeoutMs: args.timeout ? parseInt(args.timeout, 10) : undefined,
113
- };
114
- try {
115
- const result = await runAgent(request);
116
- const output = formatOutput(result, outputMode, streamOutput);
117
- if (output !== null) {
118
- process.stdout.write(`${output}\n`);
119
- }
120
- }
121
- catch (err) {
122
- if (isAgexError(err)) {
123
- console.error(`Error [${err.code}]: ${err.message}`);
124
- }
125
- else {
126
- console.error(`Unexpected error: ${err instanceof Error ? err.message : String(err)}`);
127
- }
128
- process.exit(1);
129
- }
130
- },
131
- });
132
- //# sourceMappingURL=run.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAEtF,SAAS,YAAY,CACnB,MAA4C,EAC5C,IAAgB,EAChB,WAAoB;IAEpB,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,MAAM;YACT,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAC9C,KAAK,MAAM;YACT,OAAO,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC;QACnD,KAAK,OAAO;YACV,OAAO,GAAG,MAAM,CAAC,IAAI,wBAAwB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;QACtF;YACE,OAAO,IAAI,CAAC;IAChB,CAAC;AACH,CAAC;AAED,eAAe,aAAa,CAAC;IAC3B,IAAI,EAAE;QACJ,IAAI,EAAE,KAAK;QACX,WAAW,EAAE,wBAAwB;KACtC;IACD,IAAI,EAAE;QACJ,MAAM,EAAE;YACN,IAAI,EAAE,YAAY;YAClB,WAAW,EAAE,uBAAuB;YACpC,QAAQ,EAAE,IAAI;SACf;QACD,KAAK,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,GAA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AAc,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC/E,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC/D,YAAY,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC"}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAQxC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC"}