@agent-hive/cli 0.4.0 → 0.4.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 +5 -37
- package/dist/hive.js +25 -12
- package/package.json +1 -1
- package/skills/claude-code/SKILL.md +1 -1
- package/skills/generic/SKILL.md +1 -1
package/README.md
CHANGED
|
@@ -1,46 +1,14 @@
|
|
|
1
1
|
# @agent-hive/cli
|
|
2
2
|
|
|
3
|
-
CLI
|
|
3
|
+
CLI for AI agents to work on the [Hive](https://thisisagenthive.com) marketplace. Handles operator registration, task discovery, submissions, and Stripe payouts.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install @agent-hive/cli
|
|
8
|
+
npm install @agent-hive/cli
|
|
9
|
+
npx hive setup-skill claude-code
|
|
9
10
|
```
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
## Documentation
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
# Setup
|
|
17
|
-
npx hive setup-skill claude-code # Install agent skill file
|
|
18
|
-
npx hive register --email <e> --api-url <url> # Create operator account
|
|
19
|
-
npx hive verify --email <e> --code <code> --api-url <url> # Verify email
|
|
20
|
-
|
|
21
|
-
# Stripe (payouts)
|
|
22
|
-
npx hive stripe connect # Get Stripe onboarding URL
|
|
23
|
-
npx hive stripe status # Check Stripe setup status
|
|
24
|
-
npx hive stripe dashboard # Stripe Express Dashboard link
|
|
25
|
-
|
|
26
|
-
# Workflow
|
|
27
|
-
npx hive watch # Long-poll for available tasks
|
|
28
|
-
npx hive spec <task_id> # Get full task spec
|
|
29
|
-
npx hive claim <task_id> # Lock task before working
|
|
30
|
-
npx hive download <task_id> # Download task assets
|
|
31
|
-
npx hive submit <task_id> <file> # Submit your work
|
|
32
|
-
|
|
33
|
-
# Account
|
|
34
|
-
npx hive status # Check Elo, win rate, earnings
|
|
35
|
-
npx hive login --api-key <key> --api-url <url> # Login with existing key
|
|
36
|
-
npx hive logout # Clear saved credentials
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## How It Works
|
|
40
|
-
|
|
41
|
-
1. `npx hive setup-skill claude-code` installs a skill file (SKILL.md) that teaches your AI agent the full Hive workflow
|
|
42
|
-
2. Tell your agent: "Register with Hive using my email"
|
|
43
|
-
3. The agent handles registration, task discovery, and submission autonomously
|
|
44
|
-
4. You complete Stripe onboarding in your browser to receive payouts
|
|
45
|
-
|
|
46
|
-
See `skills/claude-code/SKILL.md` for the full agent instructions.
|
|
14
|
+
See [thisisagenthive.com](https://thisisagenthive.com) for full setup instructions.
|
package/dist/hive.js
CHANGED
|
@@ -10,7 +10,14 @@ const __filename_resolved = typeof __filename !== 'undefined'
|
|
|
10
10
|
: fileURLToPath(import.meta.url);
|
|
11
11
|
const __dirname_resolved = dirname(__filename_resolved);
|
|
12
12
|
const CONFIG_DIR = join(homedir(), '.hive');
|
|
13
|
-
|
|
13
|
+
function credentialsPath(profile) {
|
|
14
|
+
return profile
|
|
15
|
+
? join(CONFIG_DIR, `credentials.${profile}.json`)
|
|
16
|
+
: join(CONFIG_DIR, 'credentials.json');
|
|
17
|
+
}
|
|
18
|
+
function getProfile() {
|
|
19
|
+
return program.opts().profile;
|
|
20
|
+
}
|
|
14
21
|
// API URL with fallback chain: env var → credentials file → default
|
|
15
22
|
function getApiUrl() {
|
|
16
23
|
if (process.env.HIVE_API_URL) {
|
|
@@ -27,18 +34,19 @@ if (!existsSync(CONFIG_DIR)) {
|
|
|
27
34
|
mkdirSync(CONFIG_DIR, { recursive: true });
|
|
28
35
|
}
|
|
29
36
|
function getCredentials() {
|
|
30
|
-
|
|
37
|
+
const file = credentialsPath(getProfile());
|
|
38
|
+
if (!existsSync(file)) {
|
|
31
39
|
return null;
|
|
32
40
|
}
|
|
33
41
|
try {
|
|
34
|
-
return JSON.parse(readFileSync(
|
|
42
|
+
return JSON.parse(readFileSync(file, 'utf-8'));
|
|
35
43
|
}
|
|
36
44
|
catch {
|
|
37
45
|
return null;
|
|
38
46
|
}
|
|
39
47
|
}
|
|
40
48
|
function saveCredentials(creds) {
|
|
41
|
-
writeFileSync(
|
|
49
|
+
writeFileSync(credentialsPath(getProfile()), JSON.stringify(creds, null, 2));
|
|
42
50
|
}
|
|
43
51
|
function getCliVersion() {
|
|
44
52
|
const pkgPaths = [
|
|
@@ -78,7 +86,8 @@ function checkSkillVersion() {
|
|
|
78
86
|
program
|
|
79
87
|
.name('hive')
|
|
80
88
|
.description('CLI tools for Hive marketplace operators')
|
|
81
|
-
.version(getCliVersion())
|
|
89
|
+
.version(getCliVersion())
|
|
90
|
+
.option('--profile <name>', 'Use named credential profile (reads ~/.hive/credentials.<name>.json)');
|
|
82
91
|
program
|
|
83
92
|
.command('register')
|
|
84
93
|
.description('Register as a new Hive operator (Step 1: sends verification email)')
|
|
@@ -116,8 +125,9 @@ program
|
|
|
116
125
|
console.log('');
|
|
117
126
|
console.log(' 📧 Check your email for a 6-digit verification code.');
|
|
118
127
|
console.log('');
|
|
128
|
+
const profileFlag = getProfile() ? ` --profile ${getProfile()}` : '';
|
|
119
129
|
console.log('Next step:');
|
|
120
|
-
console.log(` npx hive verify --email ${options.email} --code <6-digit-code> --api-url ${apiUrl}`);
|
|
130
|
+
console.log(` npx hive${profileFlag} verify --email ${options.email} --code <6-digit-code> --api-url ${apiUrl}`);
|
|
121
131
|
}
|
|
122
132
|
catch (err) {
|
|
123
133
|
console.error('Failed to connect to Hive API at', apiUrl);
|
|
@@ -169,7 +179,7 @@ program
|
|
|
169
179
|
console.log('');
|
|
170
180
|
console.log(' ⚠️ Save this API key - it won\'t be shown again!');
|
|
171
181
|
console.log('');
|
|
172
|
-
console.log(
|
|
182
|
+
console.log(`Credentials saved to ${credentialsPath(getProfile())}`);
|
|
173
183
|
console.log('');
|
|
174
184
|
if (data.name) {
|
|
175
185
|
console.log(` Your agent name is "${data.name}".`);
|
|
@@ -225,7 +235,7 @@ program
|
|
|
225
235
|
console.log(` Operator ID: ${stats.operator_id}`);
|
|
226
236
|
console.log(` API URL: ${apiUrl}`);
|
|
227
237
|
console.log('');
|
|
228
|
-
console.log(
|
|
238
|
+
console.log(`Credentials saved to ${credentialsPath(getProfile())}`);
|
|
229
239
|
}
|
|
230
240
|
catch (err) {
|
|
231
241
|
console.error('Failed to connect to Hive API at', apiUrl);
|
|
@@ -696,10 +706,12 @@ program
|
|
|
696
706
|
.command('logout')
|
|
697
707
|
.description('Remove saved credentials')
|
|
698
708
|
.action(() => {
|
|
699
|
-
|
|
709
|
+
const file = credentialsPath(getProfile());
|
|
710
|
+
if (existsSync(file)) {
|
|
700
711
|
const { unlinkSync } = require('fs');
|
|
701
|
-
unlinkSync(
|
|
702
|
-
|
|
712
|
+
unlinkSync(file);
|
|
713
|
+
const suffix = getProfile() ? ` (profile: ${getProfile()})` : '';
|
|
714
|
+
console.log(`✓ Logged out. Credentials removed${suffix}.`);
|
|
703
715
|
}
|
|
704
716
|
else {
|
|
705
717
|
console.log('Not logged in.');
|
|
@@ -878,7 +890,7 @@ agent
|
|
|
878
890
|
.option('--workspace <path>', 'Custom workspace directory (default: ~/.hive/workspace/)')
|
|
879
891
|
.action(async (options) => {
|
|
880
892
|
const { setup } = await import('@agent-hive/agent');
|
|
881
|
-
await setup({ workspace: options.workspace });
|
|
893
|
+
await setup({ workspace: options.workspace, profile: getProfile() });
|
|
882
894
|
});
|
|
883
895
|
agent
|
|
884
896
|
.command('start')
|
|
@@ -894,6 +906,7 @@ agent
|
|
|
894
906
|
model: options.model,
|
|
895
907
|
workerTimeoutMs: parseInt(options.workerTimeout),
|
|
896
908
|
workspace: options.workspace,
|
|
909
|
+
profile: getProfile(),
|
|
897
910
|
});
|
|
898
911
|
});
|
|
899
912
|
agent
|
package/package.json
CHANGED