@actionbookdev/cli 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/README.md +156 -0
- package/dist/commands/get.d.ts +3 -0
- package/dist/commands/get.d.ts.map +1 -0
- package/dist/commands/get.js +68 -0
- package/dist/commands/get.js.map +1 -0
- package/dist/commands/search.d.ts +3 -0
- package/dist/commands/search.d.ts.map +1 -0
- package/dist/commands/search.js +61 -0
- package/dist/commands/search.js.map +1 -0
- package/dist/commands/sources.d.ts +3 -0
- package/dist/commands/sources.d.ts.map +1 -0
- package/dist/commands/sources.js +97 -0
- package/dist/commands/sources.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/output.d.ts +15 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.js +34 -0
- package/dist/output.js.map +1 -0
- package/package.json +56 -0
package/README.md
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# actionbook
|
|
2
|
+
|
|
3
|
+
CLI for Actionbook - Get website action manuals for AI agents.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g actionbook
|
|
9
|
+
# or
|
|
10
|
+
npx actionbook <command>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# Search for actions
|
|
17
|
+
actionbook search "airbnb search"
|
|
18
|
+
|
|
19
|
+
# Get action details
|
|
20
|
+
actionbook get "https://www.airbnb.com/search"
|
|
21
|
+
|
|
22
|
+
# List available sources
|
|
23
|
+
actionbook sources
|
|
24
|
+
|
|
25
|
+
# Search sources
|
|
26
|
+
actionbook sources search "linkedin"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Commands
|
|
30
|
+
|
|
31
|
+
### `actionbook search <query>`
|
|
32
|
+
|
|
33
|
+
Search for action manuals by keyword.
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
actionbook search "google login"
|
|
37
|
+
actionbook search "airbnb" --type vector --limit 10
|
|
38
|
+
actionbook search "login" --source-ids 1,2,3
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Options:**
|
|
42
|
+
- `-t, --type <type>` - Search type: `vector`, `fulltext`, or `hybrid` (default: `hybrid`)
|
|
43
|
+
- `-l, --limit <number>` - Maximum results 1-100 (default: `5`)
|
|
44
|
+
- `-s, --source-ids <ids>` - Filter by source IDs (comma-separated)
|
|
45
|
+
- `--min-score <score>` - Minimum similarity score 0-1
|
|
46
|
+
- `-j, --json` - Output raw JSON
|
|
47
|
+
|
|
48
|
+
**Alias:** `actionbook s`
|
|
49
|
+
|
|
50
|
+
### `actionbook get <id>`
|
|
51
|
+
|
|
52
|
+
Get complete action details by action ID.
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
actionbook get "https://www.airbnb.com/search"
|
|
56
|
+
actionbook get "airbnb.com/search" # fuzzy matching supported
|
|
57
|
+
actionbook get "releases.rs" # domain only
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Options:**
|
|
61
|
+
- `-j, --json` - Output raw JSON
|
|
62
|
+
|
|
63
|
+
**Alias:** `actionbook g`
|
|
64
|
+
|
|
65
|
+
### `actionbook sources`
|
|
66
|
+
|
|
67
|
+
List all available sources (websites).
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
actionbook sources
|
|
71
|
+
actionbook sources --limit 100
|
|
72
|
+
actionbook sources --json
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Options:**
|
|
76
|
+
- `-l, --limit <number>` - Maximum results (default: `50`)
|
|
77
|
+
- `-j, --json` - Output raw JSON
|
|
78
|
+
|
|
79
|
+
### `actionbook sources search <query>`
|
|
80
|
+
|
|
81
|
+
Search for sources by keyword.
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
actionbook sources search "airbnb"
|
|
85
|
+
actionbook sources search "e-commerce" --limit 20
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**Options:**
|
|
89
|
+
- `-l, --limit <number>` - Maximum results (default: `10`)
|
|
90
|
+
- `-j, --json` - Output raw JSON
|
|
91
|
+
|
|
92
|
+
**Alias:** `actionbook sources s`
|
|
93
|
+
|
|
94
|
+
## Authentication
|
|
95
|
+
|
|
96
|
+
Set your API key via environment variable:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
export ACTIONBOOK_API_KEY=your_api_key
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Or pass it as an option:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
actionbook --api-key your_api_key search "query"
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Output Formats
|
|
109
|
+
|
|
110
|
+
By default, the CLI outputs formatted, colorized results for human readability.
|
|
111
|
+
|
|
112
|
+
Use `--json` flag for raw JSON output, useful for piping to other tools:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
actionbook search "login" --json | jq '.results[0].action_id'
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Examples
|
|
119
|
+
|
|
120
|
+
### Typical Workflow
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# 1. Search for actions
|
|
124
|
+
actionbook search "airbnb search"
|
|
125
|
+
|
|
126
|
+
# 2. Get details for a specific action
|
|
127
|
+
actionbook get "https://www.airbnb.com/search"
|
|
128
|
+
|
|
129
|
+
# 3. Use the selectors in your automation script
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Filter by Source
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
# List sources to find IDs
|
|
136
|
+
actionbook sources
|
|
137
|
+
|
|
138
|
+
# Search within specific sources
|
|
139
|
+
actionbook search "login" --source-ids 1,2
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### JSON Output for Scripts
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
# Get action and extract selectors
|
|
146
|
+
actionbook get "booking.com" --json | jq '.elements'
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Related Packages
|
|
150
|
+
|
|
151
|
+
- [`@actionbookdev/sdk`](https://www.npmjs.com/package/@actionbookdev/sdk) - JavaScript/TypeScript SDK
|
|
152
|
+
- [`@actionbookdev/mcp`](https://www.npmjs.com/package/@actionbookdev/mcp) - MCP Server for AI agents
|
|
153
|
+
|
|
154
|
+
## License
|
|
155
|
+
|
|
156
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../src/commands/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAKnC,eAAO,MAAM,UAAU,SAiEnB,CAAA"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { Actionbook } from '@actionbookdev/sdk';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import { getApiKey, handleError, outputResult } from '../output.js';
|
|
5
|
+
export const getCommand = new Command('get')
|
|
6
|
+
.alias('g')
|
|
7
|
+
.description('Get complete action details by action ID')
|
|
8
|
+
.argument('<id>', 'Action ID (URL or domain, e.g., "https://example.com/page" or "example.com/page")')
|
|
9
|
+
.option('-j, --json', 'Output raw JSON')
|
|
10
|
+
.action(async (id, options) => {
|
|
11
|
+
try {
|
|
12
|
+
const apiKey = getApiKey(options);
|
|
13
|
+
const client = new Actionbook({ apiKey });
|
|
14
|
+
const result = await client.getActionById(id);
|
|
15
|
+
if (options.json) {
|
|
16
|
+
outputResult(result);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
// Formatted output
|
|
20
|
+
console.log(chalk.bold.cyan(`\n${result.heading || result.documentTitle}\n`));
|
|
21
|
+
console.log(chalk.bold('Metadata'));
|
|
22
|
+
console.log(chalk.dim('─'.repeat(50)));
|
|
23
|
+
console.log(`${chalk.gray('Action ID:')} ${result.action_id}`);
|
|
24
|
+
console.log(`${chalk.gray('Document:')} ${result.documentTitle}`);
|
|
25
|
+
console.log(`${chalk.gray('URL:')} ${result.documentUrl}`);
|
|
26
|
+
console.log(`${chalk.gray('Chunk Index:')} ${result.chunkIndex}`);
|
|
27
|
+
console.log(`${chalk.gray('Token Count:')} ${result.tokenCount}`);
|
|
28
|
+
console.log();
|
|
29
|
+
console.log(chalk.bold('Content'));
|
|
30
|
+
console.log(chalk.dim('─'.repeat(50)));
|
|
31
|
+
console.log(result.content);
|
|
32
|
+
console.log();
|
|
33
|
+
if (result.elements) {
|
|
34
|
+
try {
|
|
35
|
+
const elements = JSON.parse(result.elements);
|
|
36
|
+
console.log(chalk.bold('UI Elements'));
|
|
37
|
+
console.log(chalk.dim('─'.repeat(50)));
|
|
38
|
+
for (const [name, el] of Object.entries(elements)) {
|
|
39
|
+
console.log(chalk.yellow(` ${name}:`));
|
|
40
|
+
if (el.css_selector) {
|
|
41
|
+
console.log(` ${chalk.gray('CSS:')} ${el.css_selector}`);
|
|
42
|
+
}
|
|
43
|
+
if (el.xpath_selector) {
|
|
44
|
+
console.log(` ${chalk.gray('XPath:')} ${el.xpath_selector}`);
|
|
45
|
+
}
|
|
46
|
+
if (el.description) {
|
|
47
|
+
console.log(` ${chalk.gray('Description:')} ${el.description}`);
|
|
48
|
+
}
|
|
49
|
+
if (el.element_type) {
|
|
50
|
+
console.log(` ${chalk.gray('Type:')} ${el.element_type}`);
|
|
51
|
+
}
|
|
52
|
+
if (el.allow_methods?.length) {
|
|
53
|
+
console.log(` ${chalk.gray('Methods:')} ${el.allow_methods.join(', ')}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
console.log();
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
console.log(chalk.dim('(Failed to parse elements data)'));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
handleError(error);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
//# sourceMappingURL=get.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../src/commands/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,UAAU,EAAsB,MAAM,oBAAoB,CAAA;AACnE,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAEnE,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC;KACzC,KAAK,CAAC,GAAG,CAAC;KACV,WAAW,CAAC,0CAA0C,CAAC;KACvD,QAAQ,CAAC,MAAM,EAAE,mFAAmF,CAAC;KACrG,MAAM,CAAC,YAAY,EAAE,iBAAiB,CAAC;KACvC,MAAM,CAAC,KAAK,EAAE,EAAU,EAAE,OAAO,EAAE,EAAE;IACpC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,CAAA;QACjC,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC,CAAA;QAEzC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAA;QAE7C,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;YACjB,YAAY,CAAC,MAAM,CAAC,CAAA;QACtB,CAAC;aAAM,CAAC;YACN,mBAAmB;YACnB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,aAAa,IAAI,CAAC,CAAC,CAAA;YAE7E,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAA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AC,GAAG,EAAE,CAAA;gBACf,CAAC;gBAAC,MAAM,CAAC;oBACP,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC,CAAA;gBAC3D,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,WAAW,CAAC,KAAK,CAAC,CAAA;IACpB,CAAC;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/commands/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAMnC,eAAO,MAAM,aAAa,SAmDtB,CAAA"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { Actionbook } from '@actionbookdev/sdk';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import { getApiKey, handleError, outputResult } from '../output.js';
|
|
5
|
+
export const searchCommand = new Command('search')
|
|
6
|
+
.alias('s')
|
|
7
|
+
.description('Search for action manuals by keyword')
|
|
8
|
+
.argument('<query>', 'Search keyword (e.g., "airbnb search", "google login")')
|
|
9
|
+
.option('-t, --type <type>', 'Search type: vector, fulltext, or hybrid', 'hybrid')
|
|
10
|
+
.option('-l, --limit <number>', 'Maximum results (1-100)', '5')
|
|
11
|
+
.option('-s, --source-ids <ids>', 'Filter by source IDs (comma-separated)')
|
|
12
|
+
.option('--min-score <score>', 'Minimum similarity score (0-1)')
|
|
13
|
+
.option('-j, --json', 'Output raw JSON')
|
|
14
|
+
.action(async (query, options) => {
|
|
15
|
+
try {
|
|
16
|
+
const apiKey = getApiKey(options);
|
|
17
|
+
const client = new Actionbook({ apiKey });
|
|
18
|
+
const result = await client.searchActions({
|
|
19
|
+
query,
|
|
20
|
+
type: options.type,
|
|
21
|
+
limit: parseInt(options.limit, 10),
|
|
22
|
+
sourceIds: options.sourceIds,
|
|
23
|
+
minScore: options.minScore ? parseFloat(options.minScore) : undefined,
|
|
24
|
+
});
|
|
25
|
+
if (options.json) {
|
|
26
|
+
outputResult(result);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
// Formatted output
|
|
30
|
+
if (result.results.length === 0) {
|
|
31
|
+
console.log(chalk.yellow(`No actions found for "${query}"`));
|
|
32
|
+
console.log(chalk.dim('Try broader search terms or different search type'));
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
console.log(chalk.bold.cyan(`\nSearch Results for "${query}"\n`));
|
|
36
|
+
console.log(chalk.dim(`Found ${result.count} result(s)\n`));
|
|
37
|
+
result.results.forEach((action, index) => {
|
|
38
|
+
const num = index + 1;
|
|
39
|
+
console.log(chalk.bold.white(`${num}. ${action.action_id}`));
|
|
40
|
+
console.log(chalk.dim(` Score: ${(action.score ?? 0).toFixed(3)}`));
|
|
41
|
+
console.log(chalk.gray(` ${truncate(action.content, 120)}`));
|
|
42
|
+
console.log();
|
|
43
|
+
});
|
|
44
|
+
if (result.hasMore) {
|
|
45
|
+
console.log(chalk.dim('More results available. Increase --limit to see more.\n'));
|
|
46
|
+
}
|
|
47
|
+
console.log(chalk.cyan('Next step: ') + chalk.white(`actionbook get "<action_id>"`));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
handleError(error);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
function truncate(str, maxLen) {
|
|
56
|
+
const cleaned = str.replace(/\n/g, ' ').trim();
|
|
57
|
+
if (cleaned.length <= maxLen)
|
|
58
|
+
return cleaned;
|
|
59
|
+
return cleaned.substring(0, maxLen) + '...';
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/commands/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,O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AAC,GAAG,CAAC,yDAAyD,CAAC,CAAC,CAAA;gBACnF,CAAC;gBAED,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC,CAAA;YACtF,CAAC;QACH,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,WAAW,CAAC,KAAK,CAAC,CAAA;IACpB,CAAC;AACH,CAAC,CAAC,CAAA;AAEJ,SAAS,QAAQ,CAAC,GAAW,EAAE,MAAc;IAC3C,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAA;IAC9C,IAAI,OAAO,CAAC,MAAM,IAAI,MAAM;QAAE,OAAO,OAAO,CAAA;IAC5C,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,GAAG,KAAK,CAAA;AAC7C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sources.d.ts","sourceRoot":"","sources":["../../src/commands/sources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAMnC,eAAO,MAAM,cAAc,SAqBvB,CAAA"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { Actionbook } from '@actionbookdev/sdk';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import { getApiKey, handleError, outputResult } from '../output.js';
|
|
5
|
+
export const sourcesCommand = new Command('sources')
|
|
6
|
+
.description('List or search available sources (websites)')
|
|
7
|
+
.option('-l, --limit <number>', 'Maximum results', '50')
|
|
8
|
+
.option('-j, --json', 'Output raw JSON')
|
|
9
|
+
.action(async (options) => {
|
|
10
|
+
try {
|
|
11
|
+
const apiKey = getApiKey(options);
|
|
12
|
+
const client = new Actionbook({ apiKey });
|
|
13
|
+
const result = await client.listSources({
|
|
14
|
+
limit: parseInt(options.limit, 10),
|
|
15
|
+
});
|
|
16
|
+
if (options.json) {
|
|
17
|
+
outputResult(result);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
formatSourceList(result.results, result.count);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
handleError(error);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
// Add search subcommand
|
|
28
|
+
sourcesCommand
|
|
29
|
+
.command('search <query>')
|
|
30
|
+
.alias('s')
|
|
31
|
+
.description('Search for sources by keyword')
|
|
32
|
+
.option('-l, --limit <number>', 'Maximum results', '10')
|
|
33
|
+
.option('-j, --json', 'Output raw JSON')
|
|
34
|
+
.action(async (query, options) => {
|
|
35
|
+
try {
|
|
36
|
+
// Get parent command options
|
|
37
|
+
const parentOpts = sourcesCommand.opts();
|
|
38
|
+
const apiKey = getApiKey({ ...parentOpts, ...options });
|
|
39
|
+
const client = new Actionbook({ apiKey });
|
|
40
|
+
const result = await client.searchSources({
|
|
41
|
+
query,
|
|
42
|
+
limit: parseInt(options.limit, 10),
|
|
43
|
+
});
|
|
44
|
+
if (options.json) {
|
|
45
|
+
outputResult(result);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
if (result.results.length === 0) {
|
|
49
|
+
console.log(chalk.yellow(`\nNo sources found for "${query}"`));
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
console.log(chalk.bold.cyan(`\nSources matching "${query}"\n`));
|
|
53
|
+
formatSourceList(result.results, result.count);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
handleError(error);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
function formatSourceList(sources, count) {
|
|
62
|
+
if (sources.length === 0) {
|
|
63
|
+
console.log(chalk.yellow('No sources found'));
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
console.log(chalk.dim(`${count} source(s)\n`));
|
|
67
|
+
// Calculate column widths
|
|
68
|
+
const maxIdLen = Math.max(...sources.map((s) => String(s.id).length), 2);
|
|
69
|
+
const maxNameLen = Math.min(Math.max(...sources.map((s) => s.name.length), 4), 30);
|
|
70
|
+
// Header
|
|
71
|
+
console.log(chalk.bold(`${'ID'.padEnd(maxIdLen)} ${'Name'.padEnd(maxNameLen)} ${'URL'}`));
|
|
72
|
+
console.log(chalk.dim('─'.repeat(80)));
|
|
73
|
+
// Rows
|
|
74
|
+
for (const source of sources) {
|
|
75
|
+
const id = String(source.id).padEnd(maxIdLen);
|
|
76
|
+
const name = truncate(source.name, maxNameLen).padEnd(maxNameLen);
|
|
77
|
+
const url = source.baseUrl;
|
|
78
|
+
console.log(`${chalk.yellow(id)} ${chalk.white(name)} ${chalk.cyan(url)}`);
|
|
79
|
+
if (source.description) {
|
|
80
|
+
console.log(chalk.dim(`${''.padEnd(maxIdLen)} ${truncate(source.description, 70)}`));
|
|
81
|
+
}
|
|
82
|
+
if (source.tags?.length) {
|
|
83
|
+
console.log(chalk.dim(`${''.padEnd(maxIdLen)} Tags: `) +
|
|
84
|
+
source.tags.map((t) => chalk.magenta(t)).join(', '));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
console.log();
|
|
88
|
+
console.log(chalk.cyan('Tip: ') +
|
|
89
|
+
chalk.white('Use --source-ids with search to filter by source'));
|
|
90
|
+
console.log(chalk.dim('Example: actionbook search "login" --source-ids 1,2'));
|
|
91
|
+
}
|
|
92
|
+
function truncate(str, maxLen) {
|
|
93
|
+
if (str.length <= maxLen)
|
|
94
|
+
return str;
|
|
95
|
+
return str.substring(0, maxLen - 1) + '…';
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=sources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sources.js","sourceRoot":"","sources":["../../src/commands/sources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM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":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { searchCommand } from './commands/search.js';
|
|
4
|
+
import { getCommand } from './commands/get.js';
|
|
5
|
+
import { sourcesCommand } from './commands/sources.js';
|
|
6
|
+
const program = new Command();
|
|
7
|
+
program
|
|
8
|
+
.name('actionbook')
|
|
9
|
+
.description('CLI for Actionbook - Get website action manuals for AI agents')
|
|
10
|
+
.version('0.1.0')
|
|
11
|
+
.option('--api-key <key>', 'API key (or set ACTIONBOOK_API_KEY env var)');
|
|
12
|
+
program.addCommand(searchCommand);
|
|
13
|
+
program.addCommand(getCommand);
|
|
14
|
+
program.addCommand(sourcesCommand);
|
|
15
|
+
program.parse();
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAEtD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAA;AAE7B,OAAO;KACJ,IAAI,CAAC,YAAY,CAAC;KAClB,WAAW,CAAC,+DAA+D,CAAC;KAC5E,OAAO,CAAC,OAAO,CAAC;KAChB,MAAM,CAAC,iBAAiB,EAAE,6CAA6C,CAAC,CAAA;AAE3E,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,CAAA;AACjC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,CAAA;AAC9B,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,CAAA;AAElC,OAAO,CAAC,KAAK,EAAE,CAAA"}
|
package/dist/output.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get API key from options or environment
|
|
3
|
+
*/
|
|
4
|
+
export declare function getApiKey(options: {
|
|
5
|
+
apiKey?: string;
|
|
6
|
+
}): string | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Output result as JSON
|
|
9
|
+
*/
|
|
10
|
+
export declare function outputResult(data: unknown): void;
|
|
11
|
+
/**
|
|
12
|
+
* Handle and display errors
|
|
13
|
+
*/
|
|
14
|
+
export declare function handleError(error: unknown): void;
|
|
15
|
+
//# sourceMappingURL=output.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,GAAG,SAAS,CAE1E;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAEhD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAahD"}
|
package/dist/output.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { isActionbookError } from '@actionbookdev/sdk';
|
|
3
|
+
/**
|
|
4
|
+
* Get API key from options or environment
|
|
5
|
+
*/
|
|
6
|
+
export function getApiKey(options) {
|
|
7
|
+
return options.apiKey ?? process.env.ACTIONBOOK_API_KEY;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Output result as JSON
|
|
11
|
+
*/
|
|
12
|
+
export function outputResult(data) {
|
|
13
|
+
console.log(JSON.stringify(data, null, 2));
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Handle and display errors
|
|
17
|
+
*/
|
|
18
|
+
export function handleError(error) {
|
|
19
|
+
if (isActionbookError(error)) {
|
|
20
|
+
console.error(chalk.red(`\nError: ${error.code}`));
|
|
21
|
+
console.error(chalk.white(error.message));
|
|
22
|
+
if (error.suggestion) {
|
|
23
|
+
console.error(chalk.yellow(`\nSuggestion: ${error.suggestion}`));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
else if (error instanceof Error) {
|
|
27
|
+
console.error(chalk.red(`\nError: ${error.message}`));
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
console.error(chalk.red('\nUnknown error occurred'));
|
|
31
|
+
}
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAEtD;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,OAA4B;IACpD,OAAO,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAA;AACzD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,IAAa;IACxC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;AAC5C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,IAAI,iBAAiB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,YAAY,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;QAClD,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAA;QACzC,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC;YACrB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,iBAAiB,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,CAAA;QAClE,CAAC;IACH,CAAC;SAAM,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAClC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,YAAY,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;IACvD,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC,CAAA;IACtD,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@actionbookdev/cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "CLI for Actionbook - Get website action manuals for AI agents",
|
|
5
|
+
"private": false,
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"bin": {
|
|
10
|
+
"actionbook": "dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
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
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@actionbookdev/sdk": "workspace:*",
|
|
28
|
+
"commander": "^12.1.0",
|
|
29
|
+
"chalk": "^5.3.0"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@types/node": "^20.14.0",
|
|
33
|
+
"typescript": "^5.6.3",
|
|
34
|
+
"vitest": "^1.6.0",
|
|
35
|
+
"rimraf": "^5.0.5"
|
|
36
|
+
},
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=18"
|
|
39
|
+
},
|
|
40
|
+
"keywords": [
|
|
41
|
+
"actionbook",
|
|
42
|
+
"cli",
|
|
43
|
+
"ai-agent",
|
|
44
|
+
"browser-automation",
|
|
45
|
+
"web-scraping",
|
|
46
|
+
"selectors"
|
|
47
|
+
],
|
|
48
|
+
"repository": {
|
|
49
|
+
"type": "git",
|
|
50
|
+
"url": "https://github.com/actionbook/actionbook.git",
|
|
51
|
+
"directory": "packages/cli"
|
|
52
|
+
},
|
|
53
|
+
"homepage": "https://actionbook.dev",
|
|
54
|
+
"author": "Actionbook Team",
|
|
55
|
+
"license": "MIT"
|
|
56
|
+
}
|