@gopherhole/cli 0.1.1 → 0.1.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/dist/index.js +19 -13
- package/package.json +1 -1
- package/src/index.ts +20 -13
package/dist/index.js
CHANGED
|
@@ -12,6 +12,12 @@ const ora_1 = __importDefault(require("ora"));
|
|
|
12
12
|
const config = new conf_1.default({ projectName: 'gopherhole' });
|
|
13
13
|
const API_URL = 'https://gopherhole.ai/api';
|
|
14
14
|
const WS_URL = 'wss://gopherhole.helixdata.workers.dev/ws';
|
|
15
|
+
// Brand colors
|
|
16
|
+
const brand = {
|
|
17
|
+
green: chalk_1.default.hex('#22c55e'), // gopher-500 - primary
|
|
18
|
+
greenBright: chalk_1.default.hex('#4ade80'), // gopher-400 - highlights
|
|
19
|
+
greenDark: chalk_1.default.hex('#16a34a'), // gopher-600 - emphasis
|
|
20
|
+
};
|
|
15
21
|
// Global verbose flag
|
|
16
22
|
let verbose = false;
|
|
17
23
|
function log(...args) {
|
|
@@ -73,7 +79,7 @@ ${chalk_1.default.bold('Example:')}
|
|
|
73
79
|
// Step 1: Auth
|
|
74
80
|
if (sessionId) {
|
|
75
81
|
const user = config.get('user');
|
|
76
|
-
console.log(
|
|
82
|
+
console.log(brand.green(`✓ Already logged in as ${user?.email}\n`));
|
|
77
83
|
}
|
|
78
84
|
else {
|
|
79
85
|
console.log(chalk_1.default.bold('Step 1: Create an account\n'));
|
|
@@ -189,7 +195,7 @@ ${chalk_1.default.bold('Example:')}
|
|
|
189
195
|
// Step 3: Show results
|
|
190
196
|
console.log(chalk_1.default.bold('\n✨ Your agent is ready!\n'));
|
|
191
197
|
console.log(chalk_1.default.bold(' Agent Details:'));
|
|
192
|
-
console.log(` Name: ${
|
|
198
|
+
console.log(` Name: ${brand.green(data.agent.name)}`);
|
|
193
199
|
console.log(` ID: ${chalk_1.default.cyan(data.agent.id)}`);
|
|
194
200
|
console.log(` API Key: ${chalk_1.default.yellow(data.apiKey)}`);
|
|
195
201
|
console.log(chalk_1.default.bold('\n Connection Info:'));
|
|
@@ -330,7 +336,7 @@ ${chalk_1.default.bold('Example:')}
|
|
|
330
336
|
config.set('sessionId', data.sessionId);
|
|
331
337
|
config.set('user', data.user);
|
|
332
338
|
config.set('tenant', data.tenant);
|
|
333
|
-
spinner.succeed(`Logged in as ${
|
|
339
|
+
spinner.succeed(`Logged in as ${brand.green(data.user.email)}`);
|
|
334
340
|
log('Session stored in:', config.path);
|
|
335
341
|
}
|
|
336
342
|
catch (err) {
|
|
@@ -372,7 +378,7 @@ ${chalk_1.default.bold('Example:')}
|
|
|
372
378
|
config.set('sessionId', data.sessionId);
|
|
373
379
|
config.set('user', data.user);
|
|
374
380
|
config.set('tenant', data.tenant);
|
|
375
|
-
spinner.succeed(`Account created! Logged in as ${
|
|
381
|
+
spinner.succeed(`Account created! Logged in as ${brand.green(data.user.email)}`);
|
|
376
382
|
console.log(chalk_1.default.gray('\nNext: gopherhole agents create'));
|
|
377
383
|
}
|
|
378
384
|
catch (err) {
|
|
@@ -385,7 +391,7 @@ program
|
|
|
385
391
|
.description('Log out of GopherHole')
|
|
386
392
|
.action(() => {
|
|
387
393
|
config.clear();
|
|
388
|
-
console.log(
|
|
394
|
+
console.log(brand.green('✓ Logged out successfully'));
|
|
389
395
|
log('Config cleared:', config.path);
|
|
390
396
|
});
|
|
391
397
|
program
|
|
@@ -450,7 +456,7 @@ agents
|
|
|
450
456
|
}
|
|
451
457
|
console.log(chalk_1.default.bold('\n🐿️ Your Agents:\n'));
|
|
452
458
|
for (const agent of data.agents) {
|
|
453
|
-
const status = agent.status === 'active' ?
|
|
459
|
+
const status = agent.status === 'active' ? brand.green('●') : chalk_1.default.red('●');
|
|
454
460
|
console.log(` ${status} ${chalk_1.default.bold(agent.name)}`);
|
|
455
461
|
console.log(` ID: ${chalk_1.default.cyan(agent.id)}`);
|
|
456
462
|
if (agent.description) {
|
|
@@ -512,7 +518,7 @@ ${chalk_1.default.bold('Examples:')}
|
|
|
512
518
|
throw new Error(err.error || 'Failed to create agent');
|
|
513
519
|
}
|
|
514
520
|
const data = await res.json();
|
|
515
|
-
spinner.succeed(`Agent created: ${
|
|
521
|
+
spinner.succeed(`Agent created: ${brand.green(data.agent.name)}`);
|
|
516
522
|
console.log(chalk_1.default.bold('\n Agent Details:'));
|
|
517
523
|
console.log(` ID: ${chalk_1.default.cyan(data.agent.id)}`);
|
|
518
524
|
console.log(` API Key: ${chalk_1.default.yellow(data.apiKey)}`);
|
|
@@ -683,7 +689,7 @@ ${chalk_1.default.bold('Example:')}
|
|
|
683
689
|
GOPHERHOLE_API_KEY=${data.apiKey}
|
|
684
690
|
GOPHERHOLE_AGENT_ID=${data.agent.id}
|
|
685
691
|
`);
|
|
686
|
-
console.log(
|
|
692
|
+
console.log(brand.green('✓ Created .env'));
|
|
687
693
|
// Write example code
|
|
688
694
|
const exampleCode = `import { GopherHole } from '@gopherhole/sdk';
|
|
689
695
|
import 'dotenv/config';
|
|
@@ -713,7 +719,7 @@ async function main() {
|
|
|
713
719
|
main().catch(console.error);
|
|
714
720
|
`;
|
|
715
721
|
fs.writeFileSync('agent.ts', exampleCode);
|
|
716
|
-
console.log(
|
|
722
|
+
console.log(brand.green('✓ Created agent.ts'));
|
|
717
723
|
// Create package.json if it doesn't exist
|
|
718
724
|
if (!fs.existsSync('package.json')) {
|
|
719
725
|
const pkg = {
|
|
@@ -734,7 +740,7 @@ main().catch(console.error);
|
|
|
734
740
|
},
|
|
735
741
|
};
|
|
736
742
|
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));
|
|
737
|
-
console.log(
|
|
743
|
+
console.log(brand.green('✓ Created package.json'));
|
|
738
744
|
}
|
|
739
745
|
console.log(chalk_1.default.bold('\n🎉 Project initialized!\n'));
|
|
740
746
|
console.log(chalk_1.default.bold('Next steps:'));
|
|
@@ -850,7 +856,7 @@ ${chalk_1.default.bold('Examples:')}
|
|
|
850
856
|
console.log(chalk_1.default.bold(`\n🔍 Found ${data.agents.length} agents:\n`));
|
|
851
857
|
for (const agent of data.agents) {
|
|
852
858
|
const stars = '★'.repeat(Math.round(agent.avgRating)) + '☆'.repeat(5 - Math.round(agent.avgRating));
|
|
853
|
-
const pricing = agent.pricing === 'free' ?
|
|
859
|
+
const pricing = agent.pricing === 'free' ? brand.green('FREE') :
|
|
854
860
|
agent.pricing === 'paid' ? chalk_1.default.blue('PAID') : chalk_1.default.gray('CONTACT');
|
|
855
861
|
console.log(` ${chalk_1.default.bold(agent.name)} ${chalk_1.default.yellow(stars)} (${agent.ratingCount})`);
|
|
856
862
|
console.log(` ${chalk_1.default.gray(agent.description || 'No description')}`);
|
|
@@ -1087,7 +1093,7 @@ program
|
|
|
1087
1093
|
const res = await fetch(`${API_URL.replace('/api', '')}/health`);
|
|
1088
1094
|
const latency = Date.now() - start;
|
|
1089
1095
|
if (res.ok) {
|
|
1090
|
-
spinner.succeed(`API: ${
|
|
1096
|
+
spinner.succeed(`API: ${brand.green('Online')} (${latency}ms)`);
|
|
1091
1097
|
}
|
|
1092
1098
|
else {
|
|
1093
1099
|
spinner.fail(`API: ${chalk_1.default.red('Degraded')}`);
|
|
@@ -1099,7 +1105,7 @@ program
|
|
|
1099
1105
|
// Check login status
|
|
1100
1106
|
const user = config.get('user');
|
|
1101
1107
|
if (user) {
|
|
1102
|
-
console.log(` Auth: ${
|
|
1108
|
+
console.log(` Auth: ${brand.green('Logged in')} as ${user.email}`);
|
|
1103
1109
|
}
|
|
1104
1110
|
else {
|
|
1105
1111
|
console.log(` Auth: ${chalk_1.default.yellow('Not logged in')}`);
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -10,6 +10,13 @@ const config = new Conf({ projectName: 'gopherhole' });
|
|
|
10
10
|
const API_URL = 'https://gopherhole.ai/api';
|
|
11
11
|
const WS_URL = 'wss://gopherhole.helixdata.workers.dev/ws';
|
|
12
12
|
|
|
13
|
+
// Brand colors
|
|
14
|
+
const brand = {
|
|
15
|
+
green: chalk.hex('#22c55e'), // gopher-500 - primary
|
|
16
|
+
greenBright: chalk.hex('#4ade80'), // gopher-400 - highlights
|
|
17
|
+
greenDark: chalk.hex('#16a34a'), // gopher-600 - emphasis
|
|
18
|
+
};
|
|
19
|
+
|
|
13
20
|
// Global verbose flag
|
|
14
21
|
let verbose = false;
|
|
15
22
|
|
|
@@ -79,7 +86,7 @@ ${chalk.bold('Example:')}
|
|
|
79
86
|
// Step 1: Auth
|
|
80
87
|
if (sessionId) {
|
|
81
88
|
const user = config.get('user') as { email: string } | undefined;
|
|
82
|
-
console.log(
|
|
89
|
+
console.log(brand.green(`✓ Already logged in as ${user?.email}\n`));
|
|
83
90
|
} else {
|
|
84
91
|
console.log(chalk.bold('Step 1: Create an account\n'));
|
|
85
92
|
|
|
@@ -209,7 +216,7 @@ ${chalk.bold('Example:')}
|
|
|
209
216
|
console.log(chalk.bold('\n✨ Your agent is ready!\n'));
|
|
210
217
|
|
|
211
218
|
console.log(chalk.bold(' Agent Details:'));
|
|
212
|
-
console.log(` Name: ${
|
|
219
|
+
console.log(` Name: ${brand.green(data.agent.name)}`);
|
|
213
220
|
console.log(` ID: ${chalk.cyan(data.agent.id)}`);
|
|
214
221
|
console.log(` API Key: ${chalk.yellow(data.apiKey)}`);
|
|
215
222
|
|
|
@@ -361,7 +368,7 @@ ${chalk.bold('Example:')}
|
|
|
361
368
|
config.set('user', data.user);
|
|
362
369
|
config.set('tenant', data.tenant);
|
|
363
370
|
|
|
364
|
-
spinner.succeed(`Logged in as ${
|
|
371
|
+
spinner.succeed(`Logged in as ${brand.green(data.user.email)}`);
|
|
365
372
|
log('Session stored in:', config.path);
|
|
366
373
|
} catch (err) {
|
|
367
374
|
spinner.fail(chalk.red((err as Error).message));
|
|
@@ -408,7 +415,7 @@ ${chalk.bold('Example:')}
|
|
|
408
415
|
config.set('user', data.user);
|
|
409
416
|
config.set('tenant', data.tenant);
|
|
410
417
|
|
|
411
|
-
spinner.succeed(`Account created! Logged in as ${
|
|
418
|
+
spinner.succeed(`Account created! Logged in as ${brand.green(data.user.email)}`);
|
|
412
419
|
console.log(chalk.gray('\nNext: gopherhole agents create'));
|
|
413
420
|
} catch (err) {
|
|
414
421
|
spinner.fail(chalk.red((err as Error).message));
|
|
@@ -421,7 +428,7 @@ program
|
|
|
421
428
|
.description('Log out of GopherHole')
|
|
422
429
|
.action(() => {
|
|
423
430
|
config.clear();
|
|
424
|
-
console.log(
|
|
431
|
+
console.log(brand.green('✓ Logged out successfully'));
|
|
425
432
|
log('Config cleared:', config.path);
|
|
426
433
|
});
|
|
427
434
|
|
|
@@ -499,7 +506,7 @@ agents
|
|
|
499
506
|
|
|
500
507
|
console.log(chalk.bold('\n🐿️ Your Agents:\n'));
|
|
501
508
|
for (const agent of data.agents) {
|
|
502
|
-
const status = agent.status === 'active' ?
|
|
509
|
+
const status = agent.status === 'active' ? brand.green('●') : chalk.red('●');
|
|
503
510
|
console.log(` ${status} ${chalk.bold(agent.name)}`);
|
|
504
511
|
console.log(` ID: ${chalk.cyan(agent.id)}`);
|
|
505
512
|
if (agent.description) {
|
|
@@ -567,7 +574,7 @@ ${chalk.bold('Examples:')}
|
|
|
567
574
|
}
|
|
568
575
|
|
|
569
576
|
const data = await res.json();
|
|
570
|
-
spinner.succeed(`Agent created: ${
|
|
577
|
+
spinner.succeed(`Agent created: ${brand.green(data.agent.name)}`);
|
|
571
578
|
|
|
572
579
|
console.log(chalk.bold('\n Agent Details:'));
|
|
573
580
|
console.log(` ID: ${chalk.cyan(data.agent.id)}`);
|
|
@@ -766,7 +773,7 @@ ${chalk.bold('Example:')}
|
|
|
766
773
|
GOPHERHOLE_API_KEY=${data.apiKey}
|
|
767
774
|
GOPHERHOLE_AGENT_ID=${data.agent.id}
|
|
768
775
|
`);
|
|
769
|
-
console.log(
|
|
776
|
+
console.log(brand.green('✓ Created .env'));
|
|
770
777
|
|
|
771
778
|
// Write example code
|
|
772
779
|
const exampleCode = `import { GopherHole } from '@gopherhole/sdk';
|
|
@@ -797,7 +804,7 @@ async function main() {
|
|
|
797
804
|
main().catch(console.error);
|
|
798
805
|
`;
|
|
799
806
|
fs.writeFileSync('agent.ts', exampleCode);
|
|
800
|
-
console.log(
|
|
807
|
+
console.log(brand.green('✓ Created agent.ts'));
|
|
801
808
|
|
|
802
809
|
// Create package.json if it doesn't exist
|
|
803
810
|
if (!fs.existsSync('package.json')) {
|
|
@@ -819,7 +826,7 @@ main().catch(console.error);
|
|
|
819
826
|
},
|
|
820
827
|
};
|
|
821
828
|
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));
|
|
822
|
-
console.log(
|
|
829
|
+
console.log(brand.green('✓ Created package.json'));
|
|
823
830
|
}
|
|
824
831
|
|
|
825
832
|
console.log(chalk.bold('\n🎉 Project initialized!\n'));
|
|
@@ -947,7 +954,7 @@ ${chalk.bold('Examples:')}
|
|
|
947
954
|
|
|
948
955
|
for (const agent of data.agents) {
|
|
949
956
|
const stars = '★'.repeat(Math.round(agent.avgRating)) + '☆'.repeat(5 - Math.round(agent.avgRating));
|
|
950
|
-
const pricing = agent.pricing === 'free' ?
|
|
957
|
+
const pricing = agent.pricing === 'free' ? brand.green('FREE') :
|
|
951
958
|
agent.pricing === 'paid' ? chalk.blue('PAID') : chalk.gray('CONTACT');
|
|
952
959
|
|
|
953
960
|
console.log(` ${chalk.bold(agent.name)} ${chalk.yellow(stars)} (${agent.ratingCount})`);
|
|
@@ -1211,7 +1218,7 @@ program
|
|
|
1211
1218
|
const latency = Date.now() - start;
|
|
1212
1219
|
|
|
1213
1220
|
if (res.ok) {
|
|
1214
|
-
spinner.succeed(`API: ${
|
|
1221
|
+
spinner.succeed(`API: ${brand.green('Online')} (${latency}ms)`);
|
|
1215
1222
|
} else {
|
|
1216
1223
|
spinner.fail(`API: ${chalk.red('Degraded')}`);
|
|
1217
1224
|
}
|
|
@@ -1222,7 +1229,7 @@ program
|
|
|
1222
1229
|
// Check login status
|
|
1223
1230
|
const user = config.get('user') as { email: string } | undefined;
|
|
1224
1231
|
if (user) {
|
|
1225
|
-
console.log(` Auth: ${
|
|
1232
|
+
console.log(` Auth: ${brand.green('Logged in')} as ${user.email}`);
|
|
1226
1233
|
} else {
|
|
1227
1234
|
console.log(` Auth: ${chalk.yellow('Not logged in')}`);
|
|
1228
1235
|
}
|