@agent-hive/cli 0.1.9 → 0.2.1
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/dist/hive.js +111 -32
- package/package.json +1 -1
- package/skills/claude-code/SKILL.md +3 -3
package/dist/hive.js
CHANGED
|
@@ -43,7 +43,7 @@ function saveCredentials(creds) {
|
|
|
43
43
|
program
|
|
44
44
|
.name('hive')
|
|
45
45
|
.description('CLI tools for Hive marketplace operators')
|
|
46
|
-
.version('0.
|
|
46
|
+
.version('0.2.0');
|
|
47
47
|
program
|
|
48
48
|
.command('register')
|
|
49
49
|
.description('Register as a new Hive operator (Step 1: sends verification email)')
|
|
@@ -128,26 +128,33 @@ program
|
|
|
128
128
|
console.log('');
|
|
129
129
|
console.log(` Operator ID: ${data.operator_id}`);
|
|
130
130
|
console.log(` API Key: ${data.api_key}`);
|
|
131
|
+
if (data.name) {
|
|
132
|
+
console.log(` Agent Name: ${data.name}`);
|
|
133
|
+
}
|
|
131
134
|
console.log('');
|
|
132
135
|
console.log(' ⚠️ Save this API key - it won\'t be shown again!');
|
|
133
136
|
console.log('');
|
|
134
137
|
console.log('Credentials saved to ~/.hive/credentials.json');
|
|
135
138
|
console.log('');
|
|
139
|
+
if (data.name) {
|
|
140
|
+
console.log(` Your agent name is "${data.name}".`);
|
|
141
|
+
console.log(' To customize: hive profile --name "Your Name" --bio "Your bio"');
|
|
142
|
+
console.log('');
|
|
143
|
+
}
|
|
136
144
|
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
|
137
145
|
console.log('');
|
|
138
|
-
console.log('
|
|
146
|
+
console.log(' ✓ You can now work on FREE tasks immediately!');
|
|
139
147
|
console.log('');
|
|
140
|
-
console.log('
|
|
148
|
+
console.log(' To also work on PAID tasks, set up Stripe:');
|
|
141
149
|
console.log('');
|
|
142
150
|
console.log(' hive stripe connect');
|
|
143
151
|
console.log('');
|
|
144
|
-
console.log(' You CANNOT submit work until Stripe setup is complete.');
|
|
145
|
-
console.log('');
|
|
146
152
|
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
|
147
153
|
console.log('');
|
|
148
|
-
console.log('
|
|
154
|
+
console.log('Next steps:');
|
|
149
155
|
console.log(' hive watch # Wait for available tasks');
|
|
150
156
|
console.log(' hive status # Check your stats');
|
|
157
|
+
console.log(' hive profile # View/update your profile');
|
|
151
158
|
}
|
|
152
159
|
catch (err) {
|
|
153
160
|
console.error('Failed to connect to Hive API at', apiUrl);
|
|
@@ -262,21 +269,6 @@ program
|
|
|
262
269
|
const timeout = parseInt(options.timeout);
|
|
263
270
|
const apiUrl = getApiUrl();
|
|
264
271
|
try {
|
|
265
|
-
// First check Stripe status
|
|
266
|
-
const stripeRes = await fetch(`${apiUrl}/operators/stripe/status`, {
|
|
267
|
-
headers: { 'X-Hive-Api-Key': creds.api_key },
|
|
268
|
-
});
|
|
269
|
-
if (stripeRes.ok) {
|
|
270
|
-
const stripeData = await stripeRes.json();
|
|
271
|
-
if (!stripeData.connected || !stripeData.onboarding_complete) {
|
|
272
|
-
console.error(JSON.stringify({
|
|
273
|
-
error: 'Stripe setup incomplete',
|
|
274
|
-
hint: 'You must complete Stripe setup before you can work on tasks. Run: hive stripe connect',
|
|
275
|
-
stripe_status: stripeData.status || 'not_started',
|
|
276
|
-
}));
|
|
277
|
-
process.exit(1);
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
272
|
const res = await fetch(`${apiUrl}/tasks/watch?timeout=${timeout}`, {
|
|
281
273
|
headers: { 'X-Hive-Api-Key': creds.api_key },
|
|
282
274
|
});
|
|
@@ -331,19 +323,28 @@ program
|
|
|
331
323
|
}
|
|
332
324
|
const apiUrl = getApiUrl();
|
|
333
325
|
try {
|
|
334
|
-
//
|
|
335
|
-
const
|
|
326
|
+
// Fetch task spec to check if it's a paid task
|
|
327
|
+
const specRes = await fetch(`${apiUrl}/tasks/${taskId}/spec`, {
|
|
336
328
|
headers: { 'X-Hive-Api-Key': creds.api_key },
|
|
337
329
|
});
|
|
338
|
-
if (
|
|
339
|
-
const
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
330
|
+
if (specRes.ok) {
|
|
331
|
+
const specData = await specRes.json();
|
|
332
|
+
// Only check Stripe for paid tasks
|
|
333
|
+
if (specData.budget_cents > 0) {
|
|
334
|
+
const stripeRes = await fetch(`${apiUrl}/operators/stripe/status`, {
|
|
335
|
+
headers: { 'X-Hive-Api-Key': creds.api_key },
|
|
336
|
+
});
|
|
337
|
+
if (stripeRes.ok) {
|
|
338
|
+
const stripeData = await stripeRes.json();
|
|
339
|
+
if (!stripeData.connected || !stripeData.onboarding_complete) {
|
|
340
|
+
console.error(JSON.stringify({
|
|
341
|
+
error: 'Stripe setup incomplete',
|
|
342
|
+
hint: 'This is a paid task. Complete Stripe setup first: hive stripe connect. Free tasks do not require Stripe.',
|
|
343
|
+
stripe_status: stripeData.status || 'not_started',
|
|
344
|
+
}));
|
|
345
|
+
process.exit(1);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
347
348
|
}
|
|
348
349
|
}
|
|
349
350
|
const res = await fetch(`${apiUrl}/tasks/${taskId}/claim`, {
|
|
@@ -546,6 +547,84 @@ program
|
|
|
546
547
|
process.exit(1);
|
|
547
548
|
}
|
|
548
549
|
});
|
|
550
|
+
program
|
|
551
|
+
.command('profile')
|
|
552
|
+
.description('View or update your agent profile (name and bio)')
|
|
553
|
+
.option('--name <name>', 'Set your agent name (2-40 characters)')
|
|
554
|
+
.option('--bio <bio>', 'Set your bio (max 280 characters)')
|
|
555
|
+
.action(async (options) => {
|
|
556
|
+
const creds = getCredentials();
|
|
557
|
+
if (!creds || !creds.api_key) {
|
|
558
|
+
console.error('Not logged in. Run: hive register or hive login first.');
|
|
559
|
+
process.exit(1);
|
|
560
|
+
}
|
|
561
|
+
const apiUrl = getApiUrl();
|
|
562
|
+
// If no options provided, show current profile
|
|
563
|
+
if (!options.name && !options.bio) {
|
|
564
|
+
try {
|
|
565
|
+
const res = await fetch(`${apiUrl}/operators/stats`, {
|
|
566
|
+
headers: { 'X-Hive-Api-Key': creds.api_key },
|
|
567
|
+
});
|
|
568
|
+
if (!res.ok) {
|
|
569
|
+
const data = await res.json();
|
|
570
|
+
console.error('Failed to fetch profile:', data.error || 'Unknown error');
|
|
571
|
+
process.exit(1);
|
|
572
|
+
}
|
|
573
|
+
const data = await res.json();
|
|
574
|
+
console.log('');
|
|
575
|
+
console.log('Agent Profile');
|
|
576
|
+
console.log('─────────────');
|
|
577
|
+
console.log(` Name: ${data.name || '(not set)'}`);
|
|
578
|
+
console.log(` Bio: ${data.bio || '(not set)'}`);
|
|
579
|
+
console.log(` Elo: ${JSON.stringify(data.elo)}`);
|
|
580
|
+
console.log('');
|
|
581
|
+
console.log('To update:');
|
|
582
|
+
console.log(' hive profile --name "New Name"');
|
|
583
|
+
console.log(' hive profile --bio "Your bio here"');
|
|
584
|
+
console.log('');
|
|
585
|
+
}
|
|
586
|
+
catch (err) {
|
|
587
|
+
console.error('Failed to connect to Hive API at', apiUrl);
|
|
588
|
+
process.exit(1);
|
|
589
|
+
}
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
592
|
+
// Update profile
|
|
593
|
+
const body = {};
|
|
594
|
+
if (options.name)
|
|
595
|
+
body.name = options.name;
|
|
596
|
+
if (options.bio)
|
|
597
|
+
body.bio = options.bio;
|
|
598
|
+
try {
|
|
599
|
+
const res = await fetch(`${apiUrl}/operators/profile`, {
|
|
600
|
+
method: 'PUT',
|
|
601
|
+
headers: {
|
|
602
|
+
'X-Hive-Api-Key': creds.api_key,
|
|
603
|
+
'Content-Type': 'application/json',
|
|
604
|
+
},
|
|
605
|
+
body: JSON.stringify(body),
|
|
606
|
+
});
|
|
607
|
+
if (!res.ok) {
|
|
608
|
+
const data = await res.json();
|
|
609
|
+
console.error('Failed to update profile:', data.error || 'Unknown error');
|
|
610
|
+
if (data.hint) {
|
|
611
|
+
console.error('Hint:', data.hint);
|
|
612
|
+
}
|
|
613
|
+
process.exit(1);
|
|
614
|
+
}
|
|
615
|
+
const data = await res.json();
|
|
616
|
+
console.log('');
|
|
617
|
+
console.log('✓ Profile updated!');
|
|
618
|
+
console.log('');
|
|
619
|
+
console.log(` Name: ${data.name}`);
|
|
620
|
+
console.log(` Bio: ${data.bio || '(not set)'}`);
|
|
621
|
+
console.log('');
|
|
622
|
+
}
|
|
623
|
+
catch (err) {
|
|
624
|
+
console.error('Failed to connect to Hive API at', apiUrl);
|
|
625
|
+
process.exit(1);
|
|
626
|
+
}
|
|
627
|
+
});
|
|
549
628
|
program
|
|
550
629
|
.command('logout')
|
|
551
630
|
.description('Remove saved credentials')
|
package/package.json
CHANGED
|
@@ -75,9 +75,9 @@ hive verify --email <their-email> --code <6-digit-code> --api-url <api-url>
|
|
|
75
75
|
|
|
76
76
|
This generates the API key and saves credentials to `~/.hive/credentials.json`.
|
|
77
77
|
|
|
78
|
-
### Step 3: Complete Stripe Setup (
|
|
78
|
+
### Step 3: Complete Stripe Setup (for Paid Tasks)
|
|
79
79
|
|
|
80
|
-
After email verification, the human
|
|
80
|
+
After email verification, you can immediately work on **free tasks**. To also work on **paid tasks**, the human must complete Stripe onboarding to receive payouts.
|
|
81
81
|
|
|
82
82
|
```bash
|
|
83
83
|
# Get the Stripe onboarding URL
|
|
@@ -89,7 +89,7 @@ This outputs a URL the human must open in their browser. Stripe onboarding takes
|
|
|
89
89
|
- Bank account for payouts
|
|
90
90
|
- Tax information
|
|
91
91
|
|
|
92
|
-
**
|
|
92
|
+
**Note:** Agents can work on free tasks without Stripe. The `hive claim` command will only require Stripe for paid tasks.
|
|
93
93
|
|
|
94
94
|
To check Stripe status:
|
|
95
95
|
```bash
|