@gopherhole/cli 0.1.1 → 0.1.3
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 +48 -16
- package/package.json +1 -1
- package/src/index.ts +53 -16
package/dist/index.js
CHANGED
|
@@ -12,6 +12,35 @@ 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
|
+
};
|
|
21
|
+
// Version
|
|
22
|
+
const VERSION = '0.1.3';
|
|
23
|
+
// ASCII art banner
|
|
24
|
+
function showBanner(context) {
|
|
25
|
+
const gopher = [
|
|
26
|
+
' ▄███▄',
|
|
27
|
+
' █ ◕ ◕ █',
|
|
28
|
+
' █ ┬┬ █',
|
|
29
|
+
' ▀███▀',
|
|
30
|
+
];
|
|
31
|
+
const info = [
|
|
32
|
+
`${brand.green('GopherHole')} ${chalk_1.default.gray(`v${VERSION}`)}`,
|
|
33
|
+
`${chalk_1.default.gray('Agent Hub • gopherhole.ai')}`,
|
|
34
|
+
context ? chalk_1.default.gray(context) : '',
|
|
35
|
+
].filter(Boolean);
|
|
36
|
+
// Print side by side
|
|
37
|
+
const maxGopherWidth = Math.max(...gopher.map(l => l.length));
|
|
38
|
+
gopher.forEach((line, i) => {
|
|
39
|
+
const padded = line.padEnd(maxGopherWidth + 3);
|
|
40
|
+
console.log(brand.greenBright(padded) + (info[i] || ''));
|
|
41
|
+
});
|
|
42
|
+
console.log('');
|
|
43
|
+
}
|
|
15
44
|
// Global verbose flag
|
|
16
45
|
let verbose = false;
|
|
17
46
|
function log(...args) {
|
|
@@ -67,13 +96,14 @@ ${chalk_1.default.bold('Example:')}
|
|
|
67
96
|
$ gopherhole quickstart
|
|
68
97
|
`)
|
|
69
98
|
.action(async () => {
|
|
70
|
-
console.log(
|
|
99
|
+
console.log('');
|
|
100
|
+
showBanner();
|
|
71
101
|
console.log('This wizard will help you set up your first agent.\n');
|
|
72
102
|
let sessionId = config.get('sessionId');
|
|
73
103
|
// Step 1: Auth
|
|
74
104
|
if (sessionId) {
|
|
75
105
|
const user = config.get('user');
|
|
76
|
-
console.log(
|
|
106
|
+
console.log(brand.green(`✓ Already logged in as ${user?.email}\n`));
|
|
77
107
|
}
|
|
78
108
|
else {
|
|
79
109
|
console.log(chalk_1.default.bold('Step 1: Create an account\n'));
|
|
@@ -189,7 +219,7 @@ ${chalk_1.default.bold('Example:')}
|
|
|
189
219
|
// Step 3: Show results
|
|
190
220
|
console.log(chalk_1.default.bold('\n✨ Your agent is ready!\n'));
|
|
191
221
|
console.log(chalk_1.default.bold(' Agent Details:'));
|
|
192
|
-
console.log(` Name: ${
|
|
222
|
+
console.log(` Name: ${brand.green(data.agent.name)}`);
|
|
193
223
|
console.log(` ID: ${chalk_1.default.cyan(data.agent.id)}`);
|
|
194
224
|
console.log(` API Key: ${chalk_1.default.yellow(data.apiKey)}`);
|
|
195
225
|
console.log(chalk_1.default.bold('\n Connection Info:'));
|
|
@@ -330,7 +360,7 @@ ${chalk_1.default.bold('Example:')}
|
|
|
330
360
|
config.set('sessionId', data.sessionId);
|
|
331
361
|
config.set('user', data.user);
|
|
332
362
|
config.set('tenant', data.tenant);
|
|
333
|
-
spinner.succeed(`Logged in as ${
|
|
363
|
+
spinner.succeed(`Logged in as ${brand.green(data.user.email)}`);
|
|
334
364
|
log('Session stored in:', config.path);
|
|
335
365
|
}
|
|
336
366
|
catch (err) {
|
|
@@ -372,7 +402,7 @@ ${chalk_1.default.bold('Example:')}
|
|
|
372
402
|
config.set('sessionId', data.sessionId);
|
|
373
403
|
config.set('user', data.user);
|
|
374
404
|
config.set('tenant', data.tenant);
|
|
375
|
-
spinner.succeed(`Account created! Logged in as ${
|
|
405
|
+
spinner.succeed(`Account created! Logged in as ${brand.green(data.user.email)}`);
|
|
376
406
|
console.log(chalk_1.default.gray('\nNext: gopherhole agents create'));
|
|
377
407
|
}
|
|
378
408
|
catch (err) {
|
|
@@ -385,7 +415,7 @@ program
|
|
|
385
415
|
.description('Log out of GopherHole')
|
|
386
416
|
.action(() => {
|
|
387
417
|
config.clear();
|
|
388
|
-
console.log(
|
|
418
|
+
console.log(brand.green('✓ Logged out successfully'));
|
|
389
419
|
log('Config cleared:', config.path);
|
|
390
420
|
});
|
|
391
421
|
program
|
|
@@ -450,7 +480,7 @@ agents
|
|
|
450
480
|
}
|
|
451
481
|
console.log(chalk_1.default.bold('\n🐿️ Your Agents:\n'));
|
|
452
482
|
for (const agent of data.agents) {
|
|
453
|
-
const status = agent.status === 'active' ?
|
|
483
|
+
const status = agent.status === 'active' ? brand.green('●') : chalk_1.default.red('●');
|
|
454
484
|
console.log(` ${status} ${chalk_1.default.bold(agent.name)}`);
|
|
455
485
|
console.log(` ID: ${chalk_1.default.cyan(agent.id)}`);
|
|
456
486
|
if (agent.description) {
|
|
@@ -512,7 +542,7 @@ ${chalk_1.default.bold('Examples:')}
|
|
|
512
542
|
throw new Error(err.error || 'Failed to create agent');
|
|
513
543
|
}
|
|
514
544
|
const data = await res.json();
|
|
515
|
-
spinner.succeed(`Agent created: ${
|
|
545
|
+
spinner.succeed(`Agent created: ${brand.green(data.agent.name)}`);
|
|
516
546
|
console.log(chalk_1.default.bold('\n Agent Details:'));
|
|
517
547
|
console.log(` ID: ${chalk_1.default.cyan(data.agent.id)}`);
|
|
518
548
|
console.log(` API Key: ${chalk_1.default.yellow(data.apiKey)}`);
|
|
@@ -594,7 +624,8 @@ ${chalk_1.default.bold('Example:')}
|
|
|
594
624
|
$ gopherhole init
|
|
595
625
|
`)
|
|
596
626
|
.action(async () => {
|
|
597
|
-
console.log(
|
|
627
|
+
console.log('');
|
|
628
|
+
showBanner(process.cwd());
|
|
598
629
|
let sessionId = config.get('sessionId');
|
|
599
630
|
// Check if logged in
|
|
600
631
|
if (!sessionId) {
|
|
@@ -683,7 +714,7 @@ ${chalk_1.default.bold('Example:')}
|
|
|
683
714
|
GOPHERHOLE_API_KEY=${data.apiKey}
|
|
684
715
|
GOPHERHOLE_AGENT_ID=${data.agent.id}
|
|
685
716
|
`);
|
|
686
|
-
console.log(
|
|
717
|
+
console.log(brand.green('✓ Created .env'));
|
|
687
718
|
// Write example code
|
|
688
719
|
const exampleCode = `import { GopherHole } from '@gopherhole/sdk';
|
|
689
720
|
import 'dotenv/config';
|
|
@@ -713,7 +744,7 @@ async function main() {
|
|
|
713
744
|
main().catch(console.error);
|
|
714
745
|
`;
|
|
715
746
|
fs.writeFileSync('agent.ts', exampleCode);
|
|
716
|
-
console.log(
|
|
747
|
+
console.log(brand.green('✓ Created agent.ts'));
|
|
717
748
|
// Create package.json if it doesn't exist
|
|
718
749
|
if (!fs.existsSync('package.json')) {
|
|
719
750
|
const pkg = {
|
|
@@ -734,7 +765,7 @@ main().catch(console.error);
|
|
|
734
765
|
},
|
|
735
766
|
};
|
|
736
767
|
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));
|
|
737
|
-
console.log(
|
|
768
|
+
console.log(brand.green('✓ Created package.json'));
|
|
738
769
|
}
|
|
739
770
|
console.log(chalk_1.default.bold('\n🎉 Project initialized!\n'));
|
|
740
771
|
console.log(chalk_1.default.bold('Next steps:'));
|
|
@@ -850,7 +881,7 @@ ${chalk_1.default.bold('Examples:')}
|
|
|
850
881
|
console.log(chalk_1.default.bold(`\n🔍 Found ${data.agents.length} agents:\n`));
|
|
851
882
|
for (const agent of data.agents) {
|
|
852
883
|
const stars = '★'.repeat(Math.round(agent.avgRating)) + '☆'.repeat(5 - Math.round(agent.avgRating));
|
|
853
|
-
const pricing = agent.pricing === 'free' ?
|
|
884
|
+
const pricing = agent.pricing === 'free' ? brand.green('FREE') :
|
|
854
885
|
agent.pricing === 'paid' ? chalk_1.default.blue('PAID') : chalk_1.default.gray('CONTACT');
|
|
855
886
|
console.log(` ${chalk_1.default.bold(agent.name)} ${chalk_1.default.yellow(stars)} (${agent.ratingCount})`);
|
|
856
887
|
console.log(` ${chalk_1.default.gray(agent.description || 'No description')}`);
|
|
@@ -1079,7 +1110,8 @@ program
|
|
|
1079
1110
|
.command('status')
|
|
1080
1111
|
.description('Show GopherHole service status and your session info')
|
|
1081
1112
|
.action(async () => {
|
|
1082
|
-
console.log(
|
|
1113
|
+
console.log('');
|
|
1114
|
+
showBanner();
|
|
1083
1115
|
// Check API health
|
|
1084
1116
|
const spinner = (0, ora_1.default)('Checking API...').start();
|
|
1085
1117
|
try {
|
|
@@ -1087,7 +1119,7 @@ program
|
|
|
1087
1119
|
const res = await fetch(`${API_URL.replace('/api', '')}/health`);
|
|
1088
1120
|
const latency = Date.now() - start;
|
|
1089
1121
|
if (res.ok) {
|
|
1090
|
-
spinner.succeed(`API: ${
|
|
1122
|
+
spinner.succeed(`API: ${brand.green('Online')} (${latency}ms)`);
|
|
1091
1123
|
}
|
|
1092
1124
|
else {
|
|
1093
1125
|
spinner.fail(`API: ${chalk_1.default.red('Degraded')}`);
|
|
@@ -1099,7 +1131,7 @@ program
|
|
|
1099
1131
|
// Check login status
|
|
1100
1132
|
const user = config.get('user');
|
|
1101
1133
|
if (user) {
|
|
1102
|
-
console.log(` Auth: ${
|
|
1134
|
+
console.log(` Auth: ${brand.green('Logged in')} as ${user.email}`);
|
|
1103
1135
|
}
|
|
1104
1136
|
else {
|
|
1105
1137
|
console.log(` Auth: ${chalk_1.default.yellow('Not logged in')}`);
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -10,6 +10,40 @@ 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
|
+
|
|
20
|
+
// Version
|
|
21
|
+
const VERSION = '0.1.3';
|
|
22
|
+
|
|
23
|
+
// ASCII art banner
|
|
24
|
+
function showBanner(context?: string) {
|
|
25
|
+
const gopher = [
|
|
26
|
+
' ▄███▄',
|
|
27
|
+
' █ ◕ ◕ █',
|
|
28
|
+
' █ ┬┬ █',
|
|
29
|
+
' ▀███▀',
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
const info = [
|
|
33
|
+
`${brand.green('GopherHole')} ${chalk.gray(`v${VERSION}`)}`,
|
|
34
|
+
`${chalk.gray('Agent Hub • gopherhole.ai')}`,
|
|
35
|
+
context ? chalk.gray(context) : '',
|
|
36
|
+
].filter(Boolean);
|
|
37
|
+
|
|
38
|
+
// Print side by side
|
|
39
|
+
const maxGopherWidth = Math.max(...gopher.map(l => l.length));
|
|
40
|
+
gopher.forEach((line, i) => {
|
|
41
|
+
const padded = line.padEnd(maxGopherWidth + 3);
|
|
42
|
+
console.log(brand.greenBright(padded) + (info[i] || ''));
|
|
43
|
+
});
|
|
44
|
+
console.log('');
|
|
45
|
+
}
|
|
46
|
+
|
|
13
47
|
// Global verbose flag
|
|
14
48
|
let verbose = false;
|
|
15
49
|
|
|
@@ -71,7 +105,8 @@ ${chalk.bold('Example:')}
|
|
|
71
105
|
$ gopherhole quickstart
|
|
72
106
|
`)
|
|
73
107
|
.action(async () => {
|
|
74
|
-
console.log(
|
|
108
|
+
console.log('');
|
|
109
|
+
showBanner();
|
|
75
110
|
console.log('This wizard will help you set up your first agent.\n');
|
|
76
111
|
|
|
77
112
|
let sessionId = config.get('sessionId') as string;
|
|
@@ -79,7 +114,7 @@ ${chalk.bold('Example:')}
|
|
|
79
114
|
// Step 1: Auth
|
|
80
115
|
if (sessionId) {
|
|
81
116
|
const user = config.get('user') as { email: string } | undefined;
|
|
82
|
-
console.log(
|
|
117
|
+
console.log(brand.green(`✓ Already logged in as ${user?.email}\n`));
|
|
83
118
|
} else {
|
|
84
119
|
console.log(chalk.bold('Step 1: Create an account\n'));
|
|
85
120
|
|
|
@@ -209,7 +244,7 @@ ${chalk.bold('Example:')}
|
|
|
209
244
|
console.log(chalk.bold('\n✨ Your agent is ready!\n'));
|
|
210
245
|
|
|
211
246
|
console.log(chalk.bold(' Agent Details:'));
|
|
212
|
-
console.log(` Name: ${
|
|
247
|
+
console.log(` Name: ${brand.green(data.agent.name)}`);
|
|
213
248
|
console.log(` ID: ${chalk.cyan(data.agent.id)}`);
|
|
214
249
|
console.log(` API Key: ${chalk.yellow(data.apiKey)}`);
|
|
215
250
|
|
|
@@ -361,7 +396,7 @@ ${chalk.bold('Example:')}
|
|
|
361
396
|
config.set('user', data.user);
|
|
362
397
|
config.set('tenant', data.tenant);
|
|
363
398
|
|
|
364
|
-
spinner.succeed(`Logged in as ${
|
|
399
|
+
spinner.succeed(`Logged in as ${brand.green(data.user.email)}`);
|
|
365
400
|
log('Session stored in:', config.path);
|
|
366
401
|
} catch (err) {
|
|
367
402
|
spinner.fail(chalk.red((err as Error).message));
|
|
@@ -408,7 +443,7 @@ ${chalk.bold('Example:')}
|
|
|
408
443
|
config.set('user', data.user);
|
|
409
444
|
config.set('tenant', data.tenant);
|
|
410
445
|
|
|
411
|
-
spinner.succeed(`Account created! Logged in as ${
|
|
446
|
+
spinner.succeed(`Account created! Logged in as ${brand.green(data.user.email)}`);
|
|
412
447
|
console.log(chalk.gray('\nNext: gopherhole agents create'));
|
|
413
448
|
} catch (err) {
|
|
414
449
|
spinner.fail(chalk.red((err as Error).message));
|
|
@@ -421,7 +456,7 @@ program
|
|
|
421
456
|
.description('Log out of GopherHole')
|
|
422
457
|
.action(() => {
|
|
423
458
|
config.clear();
|
|
424
|
-
console.log(
|
|
459
|
+
console.log(brand.green('✓ Logged out successfully'));
|
|
425
460
|
log('Config cleared:', config.path);
|
|
426
461
|
});
|
|
427
462
|
|
|
@@ -499,7 +534,7 @@ agents
|
|
|
499
534
|
|
|
500
535
|
console.log(chalk.bold('\n🐿️ Your Agents:\n'));
|
|
501
536
|
for (const agent of data.agents) {
|
|
502
|
-
const status = agent.status === 'active' ?
|
|
537
|
+
const status = agent.status === 'active' ? brand.green('●') : chalk.red('●');
|
|
503
538
|
console.log(` ${status} ${chalk.bold(agent.name)}`);
|
|
504
539
|
console.log(` ID: ${chalk.cyan(agent.id)}`);
|
|
505
540
|
if (agent.description) {
|
|
@@ -567,7 +602,7 @@ ${chalk.bold('Examples:')}
|
|
|
567
602
|
}
|
|
568
603
|
|
|
569
604
|
const data = await res.json();
|
|
570
|
-
spinner.succeed(`Agent created: ${
|
|
605
|
+
spinner.succeed(`Agent created: ${brand.green(data.agent.name)}`);
|
|
571
606
|
|
|
572
607
|
console.log(chalk.bold('\n Agent Details:'));
|
|
573
608
|
console.log(` ID: ${chalk.cyan(data.agent.id)}`);
|
|
@@ -661,7 +696,8 @@ ${chalk.bold('Example:')}
|
|
|
661
696
|
$ gopherhole init
|
|
662
697
|
`)
|
|
663
698
|
.action(async () => {
|
|
664
|
-
console.log(
|
|
699
|
+
console.log('');
|
|
700
|
+
showBanner(process.cwd());
|
|
665
701
|
|
|
666
702
|
let sessionId = config.get('sessionId') as string;
|
|
667
703
|
|
|
@@ -766,7 +802,7 @@ ${chalk.bold('Example:')}
|
|
|
766
802
|
GOPHERHOLE_API_KEY=${data.apiKey}
|
|
767
803
|
GOPHERHOLE_AGENT_ID=${data.agent.id}
|
|
768
804
|
`);
|
|
769
|
-
console.log(
|
|
805
|
+
console.log(brand.green('✓ Created .env'));
|
|
770
806
|
|
|
771
807
|
// Write example code
|
|
772
808
|
const exampleCode = `import { GopherHole } from '@gopherhole/sdk';
|
|
@@ -797,7 +833,7 @@ async function main() {
|
|
|
797
833
|
main().catch(console.error);
|
|
798
834
|
`;
|
|
799
835
|
fs.writeFileSync('agent.ts', exampleCode);
|
|
800
|
-
console.log(
|
|
836
|
+
console.log(brand.green('✓ Created agent.ts'));
|
|
801
837
|
|
|
802
838
|
// Create package.json if it doesn't exist
|
|
803
839
|
if (!fs.existsSync('package.json')) {
|
|
@@ -819,7 +855,7 @@ main().catch(console.error);
|
|
|
819
855
|
},
|
|
820
856
|
};
|
|
821
857
|
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));
|
|
822
|
-
console.log(
|
|
858
|
+
console.log(brand.green('✓ Created package.json'));
|
|
823
859
|
}
|
|
824
860
|
|
|
825
861
|
console.log(chalk.bold('\n🎉 Project initialized!\n'));
|
|
@@ -947,7 +983,7 @@ ${chalk.bold('Examples:')}
|
|
|
947
983
|
|
|
948
984
|
for (const agent of data.agents) {
|
|
949
985
|
const stars = '★'.repeat(Math.round(agent.avgRating)) + '☆'.repeat(5 - Math.round(agent.avgRating));
|
|
950
|
-
const pricing = agent.pricing === 'free' ?
|
|
986
|
+
const pricing = agent.pricing === 'free' ? brand.green('FREE') :
|
|
951
987
|
agent.pricing === 'paid' ? chalk.blue('PAID') : chalk.gray('CONTACT');
|
|
952
988
|
|
|
953
989
|
console.log(` ${chalk.bold(agent.name)} ${chalk.yellow(stars)} (${agent.ratingCount})`);
|
|
@@ -1201,7 +1237,8 @@ program
|
|
|
1201
1237
|
.command('status')
|
|
1202
1238
|
.description('Show GopherHole service status and your session info')
|
|
1203
1239
|
.action(async () => {
|
|
1204
|
-
console.log(
|
|
1240
|
+
console.log('');
|
|
1241
|
+
showBanner();
|
|
1205
1242
|
|
|
1206
1243
|
// Check API health
|
|
1207
1244
|
const spinner = ora('Checking API...').start();
|
|
@@ -1211,7 +1248,7 @@ program
|
|
|
1211
1248
|
const latency = Date.now() - start;
|
|
1212
1249
|
|
|
1213
1250
|
if (res.ok) {
|
|
1214
|
-
spinner.succeed(`API: ${
|
|
1251
|
+
spinner.succeed(`API: ${brand.green('Online')} (${latency}ms)`);
|
|
1215
1252
|
} else {
|
|
1216
1253
|
spinner.fail(`API: ${chalk.red('Degraded')}`);
|
|
1217
1254
|
}
|
|
@@ -1222,7 +1259,7 @@ program
|
|
|
1222
1259
|
// Check login status
|
|
1223
1260
|
const user = config.get('user') as { email: string } | undefined;
|
|
1224
1261
|
if (user) {
|
|
1225
|
-
console.log(` Auth: ${
|
|
1262
|
+
console.log(` Auth: ${brand.green('Logged in')} as ${user.email}`);
|
|
1226
1263
|
} else {
|
|
1227
1264
|
console.log(` Auth: ${chalk.yellow('Not logged in')}`);
|
|
1228
1265
|
}
|