@actionbookdev/cli 0.1.2 → 0.2.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/README.md +73 -0
- package/dist/commands/act.d.ts +3 -0
- package/dist/commands/act.d.ts.map +1 -0
- package/dist/commands/act.js +46 -0
- package/dist/commands/act.js.map +1 -0
- package/dist/commands/browser.d.ts +3 -0
- package/dist/commands/browser.d.ts.map +1 -0
- package/dist/commands/browser.js +45 -0
- package/dist/commands/browser.js.map +1 -0
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/utils/process.d.ts +23 -0
- package/dist/utils/process.d.ts.map +1 -0
- package/dist/utils/process.js +179 -0
- package/dist/utils/process.js.map +1 -0
- package/package.json +14 -12
- package/LICENSE +0 -201
package/README.md
CHANGED
|
@@ -22,6 +22,10 @@ actionbook sources
|
|
|
22
22
|
|
|
23
23
|
# Search sources
|
|
24
24
|
actionbook sources search "linkedin"
|
|
25
|
+
|
|
26
|
+
# Browser automation (requires agent-browser)
|
|
27
|
+
actionbook browser open example.com
|
|
28
|
+
actionbook browser snapshot -i
|
|
25
29
|
```
|
|
26
30
|
|
|
27
31
|
## Commands
|
|
@@ -89,6 +93,61 @@ actionbook sources search "e-commerce" --limit 20
|
|
|
89
93
|
|
|
90
94
|
**Alias:** `actionbook sources s`
|
|
91
95
|
|
|
96
|
+
### `actionbook browser [command]`
|
|
97
|
+
|
|
98
|
+
Execute browser automation commands. This command forwards all arguments to `agent-browser` CLI.
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
# Open a website
|
|
102
|
+
actionbook browser open example.com
|
|
103
|
+
|
|
104
|
+
# Take interactive snapshot
|
|
105
|
+
actionbook browser snapshot -i
|
|
106
|
+
|
|
107
|
+
# Click element by reference
|
|
108
|
+
actionbook browser click @e1
|
|
109
|
+
|
|
110
|
+
# Fill input field
|
|
111
|
+
actionbook browser fill @e3 "test@example.com"
|
|
112
|
+
|
|
113
|
+
# Check current session
|
|
114
|
+
actionbook browser session
|
|
115
|
+
|
|
116
|
+
# Close browser
|
|
117
|
+
actionbook browser close
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
**Setup:**
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# npm (recommended)
|
|
124
|
+
# Download Chromium
|
|
125
|
+
actionbook browser install
|
|
126
|
+
|
|
127
|
+
# Linux users - include system dependencies
|
|
128
|
+
actionbook browser install --with-deps
|
|
129
|
+
# or manually: npx playwright install-deps chromium
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**Common Commands:**
|
|
133
|
+
- `open <url>` - Navigate to URL
|
|
134
|
+
- `snapshot -i` - Get interactive elements with references
|
|
135
|
+
- `click <selector>` - Click element (or @ref)
|
|
136
|
+
- `fill <selector> <text>` - Fill input field
|
|
137
|
+
- `type <selector> <text>` - Type into element
|
|
138
|
+
- `wait <selector|ms>` - Wait for element or time
|
|
139
|
+
- `screenshot [path]` - Take screenshot
|
|
140
|
+
- `close` - Close browser
|
|
141
|
+
|
|
142
|
+
**For full command list:**
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
actionbook browser --help
|
|
146
|
+
actionbook browser # Shows full agent-browser help
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**Learn more:** [agent-browser on GitHub](https://github.com/vercel-labs/agent-browser)
|
|
150
|
+
|
|
92
151
|
## Authentication
|
|
93
152
|
|
|
94
153
|
Set your API key via environment variable:
|
|
@@ -144,6 +203,20 @@ actionbook search "login" --source-ids 1,2
|
|
|
144
203
|
actionbook get "booking.com" --json | jq '.elements'
|
|
145
204
|
```
|
|
146
205
|
|
|
206
|
+
### Browser Automation Workflow
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
# 1. Get action details with verified selectors
|
|
210
|
+
actionbook get "github.com/login"
|
|
211
|
+
|
|
212
|
+
# 2. Use browser command to automate
|
|
213
|
+
actionbook browser open "https://github.com/login"
|
|
214
|
+
actionbook browser snapshot -i
|
|
215
|
+
actionbook browser fill @e1 "username"
|
|
216
|
+
actionbook browser fill @e2 "password"
|
|
217
|
+
actionbook browser click @e3
|
|
218
|
+
```
|
|
219
|
+
|
|
147
220
|
## Related Packages
|
|
148
221
|
|
|
149
222
|
- [`@actionbookdev/sdk`](https://www.npmjs.com/package/@actionbookdev/sdk) - JavaScript/TypeScript SDK
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"act.d.ts","sourceRoot":"","sources":["../../src/commands/act.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAQnC,eAAO,MAAM,UAAU,SAiDnB,CAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { checkCommandExists, spawnCommand, showAgentBrowserInstallation, } from '../utils/process.js';
|
|
4
|
+
export const actCommand = new Command('act')
|
|
5
|
+
.description('Execute agent-browser commands (browser automation)')
|
|
6
|
+
.allowUnknownOption(true) // Critical: allow any args through
|
|
7
|
+
.allowExcessArguments(true)
|
|
8
|
+
.helpOption('-h, --help', 'Display help for actionbook act')
|
|
9
|
+
.addHelpText('after', `
|
|
10
|
+
Examples:
|
|
11
|
+
$ actionbook act open example.com
|
|
12
|
+
$ actionbook act snapshot -i
|
|
13
|
+
$ actionbook act click @e1
|
|
14
|
+
$ actionbook act fill @e3 "test@example.com"
|
|
15
|
+
|
|
16
|
+
For detailed agent-browser commands:
|
|
17
|
+
$ agent-browser --help
|
|
18
|
+
|
|
19
|
+
Learn more: ${chalk.cyan('https://github.com/vercel-labs/agent-browser')}
|
|
20
|
+
`)
|
|
21
|
+
.action(async (_options, command) => {
|
|
22
|
+
// Get all arguments passed after 'act'
|
|
23
|
+
const args = command.args;
|
|
24
|
+
// If no args and user didn't ask for help, show agent-browser help
|
|
25
|
+
if (args.length === 0) {
|
|
26
|
+
console.log(chalk.dim('Powered by agent-browser\n'));
|
|
27
|
+
console.log(chalk.yellow('No arguments provided. Showing agent-browser help:\n'));
|
|
28
|
+
if (!checkCommandExists('agent-browser')) {
|
|
29
|
+
showAgentBrowserInstallation();
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
const exitCode = await spawnCommand('agent-browser', ['--help']);
|
|
33
|
+
process.exit(exitCode);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
// Check if agent-browser is installed
|
|
37
|
+
if (!checkCommandExists('agent-browser')) {
|
|
38
|
+
showAgentBrowserInstallation();
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
// Execute agent-browser with all args
|
|
42
|
+
console.log(chalk.dim('Powered by agent-browser\n'));
|
|
43
|
+
const exitCode = await spawnCommand('agent-browser', args);
|
|
44
|
+
process.exit(exitCode);
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=act.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"act.js","sourceRoot":"","sources":["../../src/commands/act.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,4BAA4B,GAC7B,MAAM,qBAAqB,CAAA;AAE5B,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC;KACzC,WAAW,CAAC,qDAAqD,CAAC;KAClE,kBAAkB,CAAC,IAAI,CAAC,CAAC,mCAAmC;KAC5D,oBAAoB,CAAC,IAAI,CAAC;KAC1B,UAAU,CAAC,YAAY,EAAE,iCAAiC,CAAC;KAC3D,WAAW,CACV,OAAO,EACP;;;;;;;;;;cAUU,KAAK,CAAC,IAAI,CAAC,8CAA8C,CAAC;GACrE,CACA;KACA,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;IAClC,uCAAuC;IACvC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|
+
import chalk from 'chalk';
|
|
3
|
+
import { spawnAgentBrowser, installAgentBrowser } from '../utils/process.js';
|
|
4
|
+
export const browserCommand = new Command('browser')
|
|
5
|
+
.description('Execute actionbook browser commands (browser automation)')
|
|
6
|
+
.allowUnknownOption(true) // Critical: allow any args through
|
|
7
|
+
.allowExcessArguments(true)
|
|
8
|
+
.helpOption('-h, --help', 'Display help for actionbook browser')
|
|
9
|
+
.addHelpText('after', `
|
|
10
|
+
Examples:
|
|
11
|
+
$ actionbook browser open example.com
|
|
12
|
+
$ actionbook browser snapshot -i
|
|
13
|
+
$ actionbook browser click @e1
|
|
14
|
+
$ actionbook browser fill @e3 "test@example.com"
|
|
15
|
+
|
|
16
|
+
Setup:
|
|
17
|
+
$ actionbook browser install # Download Chromium browser
|
|
18
|
+
$ actionbook browser install --with-deps # Linux: include system dependencies
|
|
19
|
+
|
|
20
|
+
For detailed commands:
|
|
21
|
+
$ actionbook browser
|
|
22
|
+
|
|
23
|
+
Learn more: ${chalk.cyan('https://github.com/vercel-labs/agent-browser')}
|
|
24
|
+
`)
|
|
25
|
+
.action(async (_options, command) => {
|
|
26
|
+
// Get all arguments passed after 'browser'
|
|
27
|
+
const args = command.args;
|
|
28
|
+
// If no args and user didn't ask for help, show agent-browser help
|
|
29
|
+
if (args.length === 0) {
|
|
30
|
+
console.log(chalk.yellow('No arguments provided. Showing agent-browser help:\n'));
|
|
31
|
+
const exitCode = await spawnAgentBrowser(['--help']);
|
|
32
|
+
process.exit(exitCode);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
// Special handling for 'install' command - auto-install agent-browser if needed
|
|
36
|
+
if (args[0] === 'install') {
|
|
37
|
+
const exitCode = await installAgentBrowser(args.slice(1));
|
|
38
|
+
process.exit(exitCode);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
// Execute agent-browser with all args
|
|
42
|
+
const exitCode = await spawnAgentBrowser(args);
|
|
43
|
+
process.exit(exitCode);
|
|
44
|
+
});
|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QAAQ,CAAC,CAAA;QACtB,OAAM;IACR,CAAC;IAED,sCAAsC;IACtC,MAAM,QAAQ,GAAG,MAAM,iBAAiB,CAAC,IAAI,CAAC,CAAA;IAC9C,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;AACxB,CAAC,CAAC,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from 'commander';
|
|
3
|
+
import { readFileSync } from 'node:fs';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { dirname, join } from 'node:path';
|
|
3
6
|
import { searchCommand } from './commands/search.js';
|
|
4
7
|
import { getCommand } from './commands/get.js';
|
|
5
8
|
import { sourcesCommand } from './commands/sources.js';
|
|
9
|
+
import { browserCommand } from './commands/browser.js';
|
|
10
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
11
|
+
const pkg = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf-8'));
|
|
6
12
|
const program = new Command();
|
|
7
13
|
program
|
|
8
14
|
.name('actionbook')
|
|
9
15
|
.description('CLI for Actionbook - Get website action manuals for AI agents')
|
|
10
|
-
.version(
|
|
16
|
+
.version(pkg.version)
|
|
11
17
|
.option('--api-key <key>', 'API key (or set ACTIONBOOK_API_KEY env var)');
|
|
12
18
|
program.addCommand(searchCommand);
|
|
13
19
|
program.addCommand(getCommand);
|
|
14
20
|
program.addCommand(sourcesCommand);
|
|
21
|
+
program.addCommand(browserCommand);
|
|
15
22
|
program.parse();
|
|
16
23
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EA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C,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,CAAA;AAC9B,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,CAAA;AAClC,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,CAAA;AAElC,OAAO,CAAC,KAAK,EAAE,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spawn a command with arguments, inheriting stdio
|
|
3
|
+
* Returns the exit code
|
|
4
|
+
* If command is not found (ENOENT), shows installation instructions
|
|
5
|
+
* @param suppressInstallInstructions - If true, don't show installation instructions on ENOENT
|
|
6
|
+
*/
|
|
7
|
+
export declare function spawnCommand(command: string, args: string[], suppressInstallInstructions?: boolean): Promise<number>;
|
|
8
|
+
/**
|
|
9
|
+
* Spawn agent-browser command using npx from CLI package directory
|
|
10
|
+
* This ensures agent-browser is executed from the CLI's node_modules
|
|
11
|
+
* Replaces "agent-browser" with "actionbook browser" in output
|
|
12
|
+
*/
|
|
13
|
+
export declare function spawnAgentBrowser(args: string[]): Promise<number>;
|
|
14
|
+
/**
|
|
15
|
+
* Show installation instructions for agent-browser
|
|
16
|
+
*/
|
|
17
|
+
export declare function showAgentBrowserInstallation(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Install Chromium browser binaries for agent-browser
|
|
20
|
+
* @param installArgs - Additional arguments like ['--with-deps'] for Linux
|
|
21
|
+
*/
|
|
22
|
+
export declare function installAgentBrowser(installArgs?: string[]): Promise<number>;
|
|
23
|
+
//# sourceMappingURL=process.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../src/utils/process.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,wBAAsB,YAAY,CAChC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,2BAA2B,UAAQ,GAClC,OAAO,CAAC,MAAM,CAAC,CA+BjB;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAgDvE;AAED;;GAEG;AACH,wBAAgB,4BAA4B,IAAI,IAAI,CAYnD;AAoBD;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,WAAW,GAAE,MAAM,EAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAsDrF"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname, join } from 'node:path';
|
|
4
|
+
import { readFileSync } from 'node:fs';
|
|
5
|
+
import chalk from 'chalk';
|
|
6
|
+
/**
|
|
7
|
+
* Spawn a command with arguments, inheriting stdio
|
|
8
|
+
* Returns the exit code
|
|
9
|
+
* If command is not found (ENOENT), shows installation instructions
|
|
10
|
+
* @param suppressInstallInstructions - If true, don't show installation instructions on ENOENT
|
|
11
|
+
*/
|
|
12
|
+
export async function spawnCommand(command, args, suppressInstallInstructions = false) {
|
|
13
|
+
return new Promise((resolve) => {
|
|
14
|
+
const child = spawn(command, args, {
|
|
15
|
+
stdio: 'inherit',
|
|
16
|
+
shell: false,
|
|
17
|
+
env: process.env,
|
|
18
|
+
});
|
|
19
|
+
child.on('close', (code, signal) => {
|
|
20
|
+
if (signal) {
|
|
21
|
+
// Process was killed by signal (e.g., SIGINT from Ctrl+C)
|
|
22
|
+
// Convert signal to exit code: 128 + signal number
|
|
23
|
+
resolve(128 + (signal === 'SIGINT' ? 2 : 15));
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
resolve(code ?? 1);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
child.on('error', (error) => {
|
|
30
|
+
// Command not found - show installation instructions
|
|
31
|
+
if (error.code === 'ENOENT') {
|
|
32
|
+
if (!suppressInstallInstructions) {
|
|
33
|
+
showAgentBrowserInstallation();
|
|
34
|
+
}
|
|
35
|
+
resolve(127); // Standard exit code for command not found
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
console.error(chalk.red(`Failed to execute ${command}: ${error.message}`));
|
|
39
|
+
resolve(1);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Spawn agent-browser command using npx from CLI package directory
|
|
46
|
+
* This ensures agent-browser is executed from the CLI's node_modules
|
|
47
|
+
* Replaces "agent-browser" with "actionbook browser" in output
|
|
48
|
+
*/
|
|
49
|
+
export async function spawnAgentBrowser(args) {
|
|
50
|
+
return new Promise((resolve) => {
|
|
51
|
+
// Get CLI package root directory (dist/utils/process.js -> ../..)
|
|
52
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
53
|
+
const cliPackageRoot = join(__dirname, '..', '..');
|
|
54
|
+
const child = spawn('npx', ['agent-browser', ...args], {
|
|
55
|
+
stdio: ['inherit', 'pipe', 'pipe'], // Inherit stdin, pipe stdout/stderr for transformation
|
|
56
|
+
shell: false,
|
|
57
|
+
env: process.env,
|
|
58
|
+
cwd: cliPackageRoot, // Execute in CLI package directory
|
|
59
|
+
});
|
|
60
|
+
// Transform and output stdout
|
|
61
|
+
if (child.stdout) {
|
|
62
|
+
child.stdout.on('data', (data) => {
|
|
63
|
+
const output = data.toString().replace(/agent-browser/g, 'actionbook browser');
|
|
64
|
+
process.stdout.write(output);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
// Transform and output stderr
|
|
68
|
+
if (child.stderr) {
|
|
69
|
+
child.stderr.on('data', (data) => {
|
|
70
|
+
const output = data.toString().replace(/agent-browser/g, 'actionbook browser');
|
|
71
|
+
process.stderr.write(output);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
child.on('close', (code, signal) => {
|
|
75
|
+
if (signal) {
|
|
76
|
+
resolve(128 + (signal === 'SIGINT' ? 2 : 15));
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
resolve(code ?? 1);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
child.on('error', (error) => {
|
|
83
|
+
if (error.code === 'ENOENT') {
|
|
84
|
+
console.error(chalk.red('\nnpx command not found.'));
|
|
85
|
+
console.error(chalk.white('Please ensure npm 5.2+ is installed.\n'));
|
|
86
|
+
resolve(127);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
console.error(chalk.red(`Failed to execute agent-browser: ${error.message}`));
|
|
90
|
+
resolve(1);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Show installation instructions for agent-browser
|
|
97
|
+
*/
|
|
98
|
+
export function showAgentBrowserInstallation() {
|
|
99
|
+
console.error(chalk.red('\nagent-browser is not installed or not in PATH.\n'));
|
|
100
|
+
console.error(chalk.white('agent-browser is a fast browser automation CLI for AI agents.'));
|
|
101
|
+
console.error(chalk.white('To install it, run:\n'));
|
|
102
|
+
console.error(chalk.cyan(' npm install -g agent-browser\n'));
|
|
103
|
+
console.error(chalk.white('Learn more: ') + chalk.cyan('https://github.com/vercel-labs/agent-browser\n'));
|
|
104
|
+
console.error(chalk.white('After installation, verify with:\n'));
|
|
105
|
+
console.error(chalk.cyan(' agent-browser --help\n'));
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Get playwright-core version from agent-browser's package.json
|
|
109
|
+
* Returns version string like "1.57.0" (without ^ or ~ prefix)
|
|
110
|
+
*/
|
|
111
|
+
function getAgentBrowserPlaywrightVersion(cliPackageRoot) {
|
|
112
|
+
try {
|
|
113
|
+
const agentBrowserPkgPath = join(cliPackageRoot, 'node_modules', 'agent-browser', 'package.json');
|
|
114
|
+
const pkgContent = readFileSync(agentBrowserPkgPath, 'utf-8');
|
|
115
|
+
const pkg = JSON.parse(pkgContent);
|
|
116
|
+
const playwrightCoreVersion = pkg.dependencies?.['playwright-core'] || '';
|
|
117
|
+
// Remove ^ ~ or other semver prefixes
|
|
118
|
+
return playwrightCoreVersion.replace(/^[\^~]/, '');
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
console.warn(chalk.yellow('Warning: Could not read agent-browser version, using latest playwright'));
|
|
122
|
+
return 'latest';
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Install Chromium browser binaries for agent-browser
|
|
127
|
+
* @param installArgs - Additional arguments like ['--with-deps'] for Linux
|
|
128
|
+
*/
|
|
129
|
+
export async function installAgentBrowser(installArgs = []) {
|
|
130
|
+
console.log(chalk.cyan('Setting up browser automation...\n'));
|
|
131
|
+
console.log(chalk.yellow('Downloading Chromium browser binaries...\n'));
|
|
132
|
+
// Get CLI package root directory to run npx from there
|
|
133
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
134
|
+
const cliPackageRoot = join(__dirname, '..', '..');
|
|
135
|
+
// Dynamically get playwright version from agent-browser to ensure binary compatibility
|
|
136
|
+
const playwrightVersion = getAgentBrowserPlaywrightVersion(cliPackageRoot);
|
|
137
|
+
const playwrightArgs = [`playwright@${playwrightVersion}`, 'install', 'chromium'];
|
|
138
|
+
// Add --with-deps if requested (Linux only)
|
|
139
|
+
if (installArgs.includes('--with-deps')) {
|
|
140
|
+
playwrightArgs.push('--with-deps');
|
|
141
|
+
}
|
|
142
|
+
const exitCode = await new Promise((resolve) => {
|
|
143
|
+
const child = spawn('npx', playwrightArgs, {
|
|
144
|
+
stdio: 'inherit',
|
|
145
|
+
shell: false,
|
|
146
|
+
env: process.env,
|
|
147
|
+
cwd: cliPackageRoot,
|
|
148
|
+
});
|
|
149
|
+
child.on('close', (code, signal) => {
|
|
150
|
+
if (signal) {
|
|
151
|
+
resolve(128 + (signal === 'SIGINT' ? 2 : 15));
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
resolve(code ?? 1);
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
child.on('error', (error) => {
|
|
158
|
+
if (error.code === 'ENOENT') {
|
|
159
|
+
console.error(chalk.red('\nnpx command not found.'));
|
|
160
|
+
console.error(chalk.white('Please ensure npm 5.2+ is installed.\n'));
|
|
161
|
+
resolve(127);
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
console.error(chalk.red(`Failed to install Chromium: ${error.message}`));
|
|
165
|
+
resolve(1);
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
if (exitCode === 0) {
|
|
170
|
+
console.log(chalk.green('\n✓ Browser automation setup complete!\n'));
|
|
171
|
+
console.log(chalk.white('You can now use: ') + chalk.cyan('actionbook browser <command>\n'));
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
console.error(chalk.red('\nBrowser setup encountered an error.'));
|
|
175
|
+
console.error(chalk.white('Please check the output above for details.\n'));
|
|
176
|
+
}
|
|
177
|
+
return exitCode;
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=process.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process.js","sourceRoot":"","sources":["../../src/utils/process.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,OAAe,EACf,IAAc,EACd,2BAA2B,GAAG,KAAK;IAEnC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE;YACjC,KAAK,EAAE,SAAS;YAChB,KAAK,EAAE,KAAK;YACZ,GAAG,EAAE,OAAO,CAAC,GAAG;SACjB,CAAC,CAAA;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CAAC,CAAA;YACZ,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,IAAI,QAAQ,KAAK,CAAC,EAAE,CAAC;QACnB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC,CAAA;QACpE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,mBAAmB,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC,CAAA;IAC9F,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC,CAAA;QACjE,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAC,CAAA;IAC5E,CAAC;IAED,OAAO,QAAQ,CAAA;AACjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@actionbookdev/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "CLI for Actionbook - Get website action manuals for AI agents",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -15,10 +15,19 @@
|
|
|
15
15
|
"publishConfig": {
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc -p tsconfig.build.json",
|
|
20
|
+
"dev": "tsc -p tsconfig.build.json --watch",
|
|
21
|
+
"test": "vitest run",
|
|
22
|
+
"lint": "eslint . --ext .ts",
|
|
23
|
+
"clean": "rimraf dist",
|
|
24
|
+
"prepublishOnly": "npm run build"
|
|
25
|
+
},
|
|
18
26
|
"dependencies": {
|
|
19
|
-
"
|
|
27
|
+
"@actionbookdev/sdk": "workspace:*",
|
|
28
|
+
"agent-browser": "^0.8.3",
|
|
20
29
|
"chalk": "^5.3.0",
|
|
21
|
-
"
|
|
30
|
+
"commander": "^12.1.0"
|
|
22
31
|
},
|
|
23
32
|
"devDependencies": {
|
|
24
33
|
"@types/node": "^20.14.0",
|
|
@@ -44,12 +53,5 @@
|
|
|
44
53
|
},
|
|
45
54
|
"homepage": "https://actionbook.dev",
|
|
46
55
|
"author": "Actionbook Team",
|
|
47
|
-
"license": "Apache-2.0"
|
|
48
|
-
|
|
49
|
-
"build": "tsc -p tsconfig.build.json",
|
|
50
|
-
"dev": "tsc -p tsconfig.build.json --watch",
|
|
51
|
-
"test": "vitest run",
|
|
52
|
-
"lint": "eslint . --ext .ts",
|
|
53
|
-
"clean": "rimraf dist"
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
+
"license": "Apache-2.0"
|
|
57
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|
|
177
|
-
|
|
178
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
-
|
|
180
|
-
To apply the Apache License to your work, attach the following
|
|
181
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
-
replaced with your own identifying information. (Don't include
|
|
183
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
-
comment syntax for the file format. We also recommend that a
|
|
185
|
-
file or class name and description of purpose be included on the
|
|
186
|
-
same "printed page" as the copyright notice for easier
|
|
187
|
-
identification within third-party archives.
|
|
188
|
-
|
|
189
|
-
Copyright 2025 Cue Labs, Inc.
|
|
190
|
-
|
|
191
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
-
you may not use this file except in compliance with the License.
|
|
193
|
-
You may obtain a copy of the License at
|
|
194
|
-
|
|
195
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
-
|
|
197
|
-
Unless required by applicable law or agreed to in writing, software
|
|
198
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
-
See the License for the specific language governing permissions and
|
|
201
|
-
limitations under the License.
|