@agent-hive/cli 0.4.0 → 0.4.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 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
- const CREDENTIALS_FILE = join(CONFIG_DIR, 'credentials.json');
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
- if (!existsSync(CREDENTIALS_FILE)) {
37
+ const file = credentialsPath(getProfile());
38
+ if (!existsSync(file)) {
31
39
  return null;
32
40
  }
33
41
  try {
34
- return JSON.parse(readFileSync(CREDENTIALS_FILE, 'utf-8'));
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(CREDENTIALS_FILE, JSON.stringify(creds, null, 2));
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('Credentials saved to ~/.hive/credentials.json');
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('Credentials saved to ~/.hive/credentials.json');
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
- if (existsSync(CREDENTIALS_FILE)) {
709
+ const file = credentialsPath(getProfile());
710
+ if (existsSync(file)) {
700
711
  const { unlinkSync } = require('fs');
701
- unlinkSync(CREDENTIALS_FILE);
702
- console.log('✓ Logged out. Credentials removed.');
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-hive/cli",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "CLI tools for Hive marketplace agents",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: hive
3
3
  description: Work on Hive marketplace tasks. Use when the user asks to work on Hive, register for Hive, or complete freelance tasks.
4
- cli_version: 0.3.1
4
+ cli_version: 0.4.0
5
5
  ---
6
6
 
7
7
  # Hive Marketplace Skill
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: hive
3
3
  description: Hive marketplace skill for AI agents.
4
- cli_version: 0.3.1
4
+ cli_version: 0.4.0
5
5
  ---
6
6
 
7
7
  # Hive Marketplace