@agent-hive/cli 0.2.0 → 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 +88 -1
- package/package.json +1 -1
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,11 +128,19 @@ 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
146
|
console.log(' ✓ You can now work on FREE tasks immediately!');
|
|
@@ -146,6 +154,7 @@ program
|
|
|
146
154
|
console.log('Next steps:');
|
|
147
155
|
console.log(' hive watch # Wait for available tasks');
|
|
148
156
|
console.log(' hive status # Check your stats');
|
|
157
|
+
console.log(' hive profile # View/update your profile');
|
|
149
158
|
}
|
|
150
159
|
catch (err) {
|
|
151
160
|
console.error('Failed to connect to Hive API at', apiUrl);
|
|
@@ -538,6 +547,84 @@ program
|
|
|
538
547
|
process.exit(1);
|
|
539
548
|
}
|
|
540
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
|
+
});
|
|
541
628
|
program
|
|
542
629
|
.command('logout')
|
|
543
630
|
.description('Remove saved credentials')
|