kroki 1.0.0 → 1.0.2
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 +23 -71
- package/bin/kroki.js +38 -37
- package/package.json +4 -5
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Kroki CLI
|
|
2
2
|
|
|
3
|
-
> **Browser Automation & AI Agent Bridge for Google Chrome
|
|
4
|
-
> Control live browser tabs, run deterministic workflows, and extract web data from your terminal or
|
|
3
|
+
> **Browser Automation & AI Agent Bridge for Google Chrome**
|
|
4
|
+
> Control live browser tabs, run deterministic workflows, and extract web data from your terminal or AI Coding Agents (Antigravity, Cursor, Claude Code, Windsurf).
|
|
5
5
|
|
|
6
6
|
[](https://www.npmjs.com/package/kroki)
|
|
7
7
|
[](https://opensource.org/licenses/MIT)
|
|
@@ -11,78 +11,40 @@
|
|
|
11
11
|
|
|
12
12
|
## ⚡ Quick Start
|
|
13
13
|
|
|
14
|
-
No installation required
|
|
14
|
+
No installation required — run directly with `npx`:
|
|
15
15
|
|
|
16
16
|
### 1. Pair with your browser profile
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
1. Open [https://kroki.ai/#/devices](https://kroki.ai/#/devices) *(Ultra plan required)*.
|
|
18
|
+
2. Click **"Скопировать код для AI"** next to your active browser profile.
|
|
19
|
+
3. Pair:
|
|
20
20
|
```bash
|
|
21
21
|
npx kroki pair <YOUR_PAIRING_CODE>
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
Connecting to profile [Dolphin WB-Bot]...
|
|
26
|
-
✔ Successfully paired with "Dolphin WB-Bot".
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
### 2. Send an AI task to the live browser
|
|
30
|
-
|
|
24
|
+
### 2. Control browser or run workflows
|
|
31
25
|
```bash
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
Kroki's built-in Planner & Navigator subagent will navigate to the page, interact with elements, extract the requested information, and stream the result back to your terminal.
|
|
26
|
+
# Autonomous browser task (Planner + Navigator)
|
|
27
|
+
npx kroki "open github.com/trending and list the top 3 repositories"
|
|
36
28
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
```bash
|
|
29
|
+
# Run a saved deterministic workflow
|
|
40
30
|
npx kroki run "Export Leads" '{"query": "CTO", "limit": 20}'
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
---
|
|
44
|
-
|
|
45
|
-
## 📦 Global Installation (Optional)
|
|
46
|
-
|
|
47
|
-
If you prefer using `kroki` without typing `npx` every time:
|
|
48
31
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
Now you can just run:
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
kroki pair <CODE>
|
|
57
|
-
kroki "scrape the current page"
|
|
58
|
-
kroki run "My Workflow"
|
|
32
|
+
# Check status or disconnect
|
|
33
|
+
npx kroki status
|
|
34
|
+
npx kroki clear
|
|
59
35
|
```
|
|
60
36
|
|
|
61
37
|
---
|
|
62
38
|
|
|
63
39
|
## 🤖 Using with AI Agents (Antigravity, Claude Code, Cursor)
|
|
64
40
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
### In Antigravity CLI
|
|
68
|
-
|
|
69
|
-
Whenever you mention **kroki** in the chat, the agent automatically knows how to use this CLI:
|
|
70
|
-
|
|
71
|
-
> **You:** `kroki pair kroki_eyJh...`
|
|
72
|
-
> **Agent:** Pairs with the specified profile and confirms readiness.
|
|
73
|
-
>
|
|
74
|
-
> **You:** `kroki найди на Avito Mac mini M4 и выпиши самые дешевые цены`
|
|
75
|
-
> **Agent:** Executes `kroki "<task>"`, waits for Kroki in the browser to finish, and summarizes the findings.
|
|
76
|
-
|
|
77
|
-
### In Cursor / Claude Code
|
|
78
|
-
|
|
79
|
-
Add the following to your agent prompt or rule file (`.cursorrules` or `CLAUDE.md`):
|
|
41
|
+
Add the following to your project's agent instructions (`.cursorrules`, `CLAUDE.md`, or system prompt):
|
|
80
42
|
|
|
81
43
|
```markdown
|
|
82
|
-
When
|
|
83
|
-
1.
|
|
84
|
-
2. Pair
|
|
85
|
-
3.
|
|
44
|
+
When asked to automate the browser or run Kroki workflows:
|
|
45
|
+
1. Check pairing: `npx kroki status`. If not paired, ask user for pairing code from https://kroki.ai/#/devices.
|
|
46
|
+
2. Pair: `npx kroki pair <CODE>`.
|
|
47
|
+
3. Execute: `npx kroki "<task>"` or `npx kroki run "<workflow>" '[vars]'`.
|
|
86
48
|
```
|
|
87
49
|
|
|
88
50
|
---
|
|
@@ -91,24 +53,14 @@ When the user requests live browser interaction or running Kroki workflows:
|
|
|
91
53
|
|
|
92
54
|
| Command | Description |
|
|
93
55
|
| :--- | :--- |
|
|
94
|
-
| `npx kroki pair <
|
|
95
|
-
| `npx kroki "<
|
|
96
|
-
| `npx kroki run "<
|
|
97
|
-
| `npx kroki status` | View
|
|
56
|
+
| `npx kroki pair <CODE>` | Pair with active browser profile |
|
|
57
|
+
| `npx kroki "<task>"` | Execute browser task via autonomous Planner & Navigator |
|
|
58
|
+
| `npx kroki run "<name>" [json]` | Execute a saved Kroki deterministic workflow |
|
|
59
|
+
| `npx kroki status` | View active paired profile and device info |
|
|
98
60
|
| `npx kroki clear` | Clear active pairing session |
|
|
99
|
-
| `npx kroki help` | Show usage options and help |
|
|
100
|
-
|
|
101
|
-
---
|
|
102
|
-
|
|
103
|
-
## 🔒 Security Architecture
|
|
104
|
-
|
|
105
|
-
- **Zero Global Credentials**: Pairing codes are session-bound and scoped strictly to your selected browser window (`targetDeviceId`).
|
|
106
|
-
- **Confirmation Gate**: The extension prompts you for confirmation on your computer when a connection attempt is made.
|
|
107
|
-
- **Ultra Plan Scoped**: Cloud control channels require an active Ultra entitlement.
|
|
108
|
-
- **Pure Native Node.js**: Zero third-party npm dependencies. Clean, audited, and lightweight.
|
|
109
61
|
|
|
110
62
|
---
|
|
111
63
|
|
|
112
64
|
## 📄 License
|
|
113
65
|
|
|
114
|
-
MIT © [Kroki Team](https://kroki.
|
|
66
|
+
MIT © [Kroki Team](https://kroki.ai)
|
package/bin/kroki.js
CHANGED
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* Kroki CLI — Control Kroki browser automation from terminal & AI agents.
|
|
5
5
|
* Zero external dependencies. Uses native Node.js 18+ WebSocket & Fetch.
|
|
6
6
|
*
|
|
7
|
-
* https://kroki.
|
|
7
|
+
* https://kroki.ai
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { existsSync, readFileSync, writeFileSync, unlinkSync, mkdirSync } from 'node:fs';
|
|
11
|
-
import {
|
|
11
|
+
import { join } from 'node:path';
|
|
12
12
|
import { homedir } from 'node:os';
|
|
13
13
|
|
|
14
14
|
const CONFIG_DIR = join(homedir(), '.kroki');
|
|
@@ -36,7 +36,7 @@ function decodePairingCode(code) {
|
|
|
36
36
|
return parsed;
|
|
37
37
|
} catch {
|
|
38
38
|
throw new Error(
|
|
39
|
-
'Invalid Kroki pairing code.\nPlease
|
|
39
|
+
'Invalid Kroki pairing code.\nPlease get a valid code from your Kroki Devices panel: https://kroki.ai/#/devices',
|
|
40
40
|
);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -191,9 +191,17 @@ class RealtimeConnection {
|
|
|
191
191
|
|
|
192
192
|
async function pairCommand(code) {
|
|
193
193
|
if (!code) {
|
|
194
|
-
console.
|
|
195
|
-
|
|
196
|
-
|
|
194
|
+
console.log(`
|
|
195
|
+
\x1b[1mKroki Pairing\x1b[0m
|
|
196
|
+
Requires an active \x1b[33mUltra\x1b[0m plan.
|
|
197
|
+
|
|
198
|
+
1. Log in at \x1b[36mhttps://kroki.ai/#/devices\x1b[0m
|
|
199
|
+
2. Find your active browser profile
|
|
200
|
+
3. Click \x1b[32m"Скопировать код для AI"\x1b[0m
|
|
201
|
+
4. Run:
|
|
202
|
+
\x1b[33mnpx kroki pair <YOUR_CODE>\x1b[0m
|
|
203
|
+
`);
|
|
204
|
+
process.exit(0);
|
|
197
205
|
}
|
|
198
206
|
|
|
199
207
|
const payload = decodePairingCode(code);
|
|
@@ -220,8 +228,8 @@ async function taskCommand(taskText) {
|
|
|
220
228
|
const session = getActiveSession();
|
|
221
229
|
if (!session) {
|
|
222
230
|
console.error('\x1b[31mError: Not paired.\x1b[0m');
|
|
223
|
-
console.error('
|
|
224
|
-
console.error('
|
|
231
|
+
console.error('Pair first with code from https://kroki.ai/#/devices (Ultra plan required):');
|
|
232
|
+
console.error(' \x1b[33mnpx kroki pair <YOUR_CODE>\x1b[0m\n');
|
|
225
233
|
process.exit(1);
|
|
226
234
|
}
|
|
227
235
|
|
|
@@ -262,7 +270,8 @@ async function workflowCommand(nameOrId, varsJson) {
|
|
|
262
270
|
const session = getActiveSession();
|
|
263
271
|
if (!session) {
|
|
264
272
|
console.error('\x1b[31mError: Not paired.\x1b[0m');
|
|
265
|
-
console.error('Pair first with
|
|
273
|
+
console.error('Pair first with code from https://kroki.ai/#/devices (Ultra plan required):');
|
|
274
|
+
console.error(' \x1b[33mnpx kroki pair <YOUR_CODE>\x1b[0m\n');
|
|
266
275
|
process.exit(1);
|
|
267
276
|
}
|
|
268
277
|
|
|
@@ -309,36 +318,28 @@ async function workflowCommand(nameOrId, varsJson) {
|
|
|
309
318
|
function statusCommand() {
|
|
310
319
|
const session = getActiveSession();
|
|
311
320
|
if (!session) {
|
|
312
|
-
console.log('
|
|
313
|
-
console.log('
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
console.log(`Profile: ${session.deviceName || session.deviceId}`);
|
|
317
|
-
console.log(`Device ID: ${session.deviceId}`);
|
|
318
|
-
console.log(`Platform: ${session.platform || 'unknown'}`);
|
|
319
|
-
console.log(`Paired At: ${new Date(session.pairedAt).toLocaleString()}`);
|
|
321
|
+
console.log('No active paired profile.');
|
|
322
|
+
console.log('To pair, get a code from https://kroki.ai/#/devices and run:');
|
|
323
|
+
console.log(' npx kroki pair <CODE>');
|
|
324
|
+
return;
|
|
320
325
|
}
|
|
326
|
+
console.log(`\x1b[32m✔ Paired\x1b[0m with "${session.deviceName || session.deviceId}" (${session.platform || 'browser'})`);
|
|
327
|
+
console.log(` Device ID: ${session.deviceId}`);
|
|
321
328
|
}
|
|
322
329
|
|
|
323
330
|
function helpCommand() {
|
|
324
331
|
console.log(`
|
|
325
|
-
\x1b[1mKroki CLI\x1b[0m —
|
|
332
|
+
\x1b[1mKroki CLI\x1b[0m — Browser Automation & AI Agent Bridge for Google Chrome
|
|
326
333
|
|
|
327
334
|
\x1b[1mUsage:\x1b[0m
|
|
328
|
-
npx kroki pair <
|
|
329
|
-
npx kroki "<
|
|
330
|
-
npx kroki run "<
|
|
331
|
-
npx kroki status
|
|
332
|
-
npx kroki clear
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
npx kroki pair kroki_eyJh...
|
|
337
|
-
npx kroki "find top 5 mechanical keyboards on Amazon and return prices"
|
|
338
|
-
npx kroki run "Export Leads" '{"limit": 50}'
|
|
339
|
-
|
|
340
|
-
\x1b[1mDocs & Dashboard:\x1b[0m
|
|
341
|
-
https://kroki.one/devices
|
|
335
|
+
npx kroki pair <CODE> Pair with a browser profile (from https://kroki.ai/#/devices)
|
|
336
|
+
npx kroki "<task>" Send an AI task to the live browser
|
|
337
|
+
npx kroki run "<workflow>" [json] Execute a saved workflow
|
|
338
|
+
npx kroki status View paired profile and status
|
|
339
|
+
npx kroki clear Disconnect active pairing session
|
|
340
|
+
|
|
341
|
+
\x1b[1mDashboard:\x1b[0m
|
|
342
|
+
https://kroki.ai/#/devices
|
|
342
343
|
`);
|
|
343
344
|
}
|
|
344
345
|
|
|
@@ -356,6 +357,10 @@ switch (first) {
|
|
|
356
357
|
});
|
|
357
358
|
break;
|
|
358
359
|
|
|
360
|
+
case 'status':
|
|
361
|
+
statusCommand();
|
|
362
|
+
break;
|
|
363
|
+
|
|
359
364
|
case 'run':
|
|
360
365
|
case 'workflow':
|
|
361
366
|
workflowCommand(rawArgs[1], rawArgs[2]).catch(e => {
|
|
@@ -364,10 +369,6 @@ switch (first) {
|
|
|
364
369
|
});
|
|
365
370
|
break;
|
|
366
371
|
|
|
367
|
-
case 'status':
|
|
368
|
-
statusCommand();
|
|
369
|
-
break;
|
|
370
|
-
|
|
371
372
|
case 'clear':
|
|
372
373
|
case 'disconnect':
|
|
373
374
|
clearActiveSession();
|
|
@@ -381,10 +382,10 @@ switch (first) {
|
|
|
381
382
|
break;
|
|
382
383
|
|
|
383
384
|
default:
|
|
384
|
-
// If user ran `npx kroki "do something..."` directly
|
|
385
385
|
taskCommand(rawArgs.join(' ')).catch(e => {
|
|
386
386
|
console.error(`\x1b[31mError:\x1b[0m ${e.message}`);
|
|
387
387
|
process.exit(1);
|
|
388
388
|
});
|
|
389
389
|
break;
|
|
390
390
|
}
|
|
391
|
+
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kroki",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Kroki Browser Automation CLI — Control Chrome
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "Kroki Browser Automation CLI — Control Chrome from terminal and AI agents",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kroki",
|
|
7
7
|
"browser-automation",
|
|
8
8
|
"ai-agent",
|
|
9
9
|
"antigravity",
|
|
10
|
-
"dolphin-anty",
|
|
11
10
|
"chrome",
|
|
12
11
|
"mcp",
|
|
13
12
|
"cli"
|
|
@@ -16,7 +15,7 @@
|
|
|
16
15
|
"license": "MIT",
|
|
17
16
|
"type": "module",
|
|
18
17
|
"bin": {
|
|
19
|
-
"kroki": "
|
|
18
|
+
"kroki": "bin/kroki.js"
|
|
20
19
|
},
|
|
21
20
|
"files": [
|
|
22
21
|
"bin",
|
|
@@ -33,5 +32,5 @@
|
|
|
33
32
|
"bugs": {
|
|
34
33
|
"url": "https://github.com/one-focus/kroki-cli/issues"
|
|
35
34
|
},
|
|
36
|
-
"homepage": "https://kroki.
|
|
35
|
+
"homepage": "https://kroki.ai"
|
|
37
36
|
}
|