@gopherhole/cli 0.1.3 ā 0.1.4
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 +1 -1
- package/dist/index.js +122 -4
- package/package.json +1 -1
- package/src/index.ts +133 -4
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -69,7 +69,7 @@ ${chalk_1.default.bold('Examples:')}
|
|
|
69
69
|
$ gopherhole agents list
|
|
70
70
|
|
|
71
71
|
${chalk_1.default.bold('Documentation:')}
|
|
72
|
-
https://gopherhole.ai
|
|
72
|
+
https://docs.gopherhole.ai
|
|
73
73
|
`)
|
|
74
74
|
.version('0.1.0')
|
|
75
75
|
.option('-v, --verbose', 'Enable verbose output for debugging')
|
|
@@ -320,7 +320,7 @@ ${chalk_1.default.bold('Example:')}
|
|
|
320
320
|
}
|
|
321
321
|
console.log(chalk_1.default.bold('\nš Next steps:\n'));
|
|
322
322
|
console.log(` ⢠Dashboard: ${chalk_1.default.cyan('https://gopherhole.ai/dashboard')}`);
|
|
323
|
-
console.log(` ⢠Docs: ${chalk_1.default.cyan('https://gopherhole.ai
|
|
323
|
+
console.log(` ⢠Docs: ${chalk_1.default.cyan('https://docs.gopherhole.ai')}`);
|
|
324
324
|
console.log(` ⢠Find agents: ${chalk_1.default.cyan('gopherhole discover search')}`);
|
|
325
325
|
console.log(` ⢠List yours: ${chalk_1.default.cyan('gopherhole agents list')}`);
|
|
326
326
|
console.log('');
|
|
@@ -553,7 +553,7 @@ ${chalk_1.default.bold('Examples:')}
|
|
|
553
553
|
console.log(chalk_1.default.bold('\n Quick test:'));
|
|
554
554
|
console.log(chalk_1.default.white(` curl -H "Authorization: Bearer ${data.apiKey}" \\
|
|
555
555
|
https://gopherhole.ai/a2a -d '{"jsonrpc":"2.0","method":"agent/info","id":1}'`));
|
|
556
|
-
console.log(chalk_1.default.gray('\n Full docs: https://gopherhole.ai
|
|
556
|
+
console.log(chalk_1.default.gray('\n Full docs: https://docs.gopherhole.ai'));
|
|
557
557
|
console.log('');
|
|
558
558
|
}
|
|
559
559
|
catch (err) {
|
|
@@ -609,6 +609,124 @@ ${chalk_1.default.bold('Example:')}
|
|
|
609
609
|
process.exit(1);
|
|
610
610
|
}
|
|
611
611
|
});
|
|
612
|
+
agents
|
|
613
|
+
.command('regenerate-key <agentId>')
|
|
614
|
+
.description(`Regenerate API key for an agent
|
|
615
|
+
|
|
616
|
+
${chalk_1.default.bold('Example:')}
|
|
617
|
+
$ gopherhole agents regenerate-key agent-abc123
|
|
618
|
+
|
|
619
|
+
${chalk_1.default.yellow('ā ļø Warning:')} This will invalidate the current key.
|
|
620
|
+
All connected agents using this key will stop working.
|
|
621
|
+
`)
|
|
622
|
+
.option('-f, --force', 'Skip confirmation')
|
|
623
|
+
.option('--json', 'Output as JSON')
|
|
624
|
+
.action(async (agentId, options) => {
|
|
625
|
+
const sessionId = config.get('sessionId');
|
|
626
|
+
if (!sessionId) {
|
|
627
|
+
console.log(chalk_1.default.yellow('Not logged in.'));
|
|
628
|
+
console.log(chalk_1.default.gray('Run: gopherhole login'));
|
|
629
|
+
process.exit(1);
|
|
630
|
+
}
|
|
631
|
+
if (!options.force) {
|
|
632
|
+
const { confirm } = await inquirer_1.default.prompt([
|
|
633
|
+
{
|
|
634
|
+
type: 'confirm',
|
|
635
|
+
name: 'confirm',
|
|
636
|
+
message: `Regenerate API key for ${chalk_1.default.cyan(agentId)}? This will invalidate the current key.`,
|
|
637
|
+
default: false,
|
|
638
|
+
},
|
|
639
|
+
]);
|
|
640
|
+
if (!confirm) {
|
|
641
|
+
console.log('Cancelled.');
|
|
642
|
+
return;
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
const spinner = (0, ora_1.default)('Regenerating API key...').start();
|
|
646
|
+
log('POST /agents/' + agentId + '/regenerate-key');
|
|
647
|
+
try {
|
|
648
|
+
const res = await fetch(`${API_URL}/agents/${agentId}/regenerate-key`, {
|
|
649
|
+
method: 'POST',
|
|
650
|
+
headers: {
|
|
651
|
+
'Content-Type': 'application/json',
|
|
652
|
+
'X-Session-ID': sessionId,
|
|
653
|
+
},
|
|
654
|
+
body: JSON.stringify({}),
|
|
655
|
+
});
|
|
656
|
+
if (!res.ok) {
|
|
657
|
+
const err = await res.json();
|
|
658
|
+
logError('regenerate-key', err);
|
|
659
|
+
throw new Error(err.error || 'Failed to regenerate key');
|
|
660
|
+
}
|
|
661
|
+
const data = await res.json();
|
|
662
|
+
spinner.succeed('API key regenerated');
|
|
663
|
+
if (options.json) {
|
|
664
|
+
console.log(JSON.stringify({ apiKey: data.apiKey }, null, 2));
|
|
665
|
+
}
|
|
666
|
+
else {
|
|
667
|
+
console.log('');
|
|
668
|
+
console.log(chalk_1.default.bold('New API Key:'));
|
|
669
|
+
console.log(chalk_1.default.green(data.apiKey));
|
|
670
|
+
console.log('');
|
|
671
|
+
console.log(chalk_1.default.yellow('ā ļø Copy this key now ā it won\'t be shown again!'));
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
catch (err) {
|
|
675
|
+
spinner.fail(chalk_1.default.red(err.message));
|
|
676
|
+
process.exit(1);
|
|
677
|
+
}
|
|
678
|
+
});
|
|
679
|
+
agents
|
|
680
|
+
.command('sync-card <agentId>')
|
|
681
|
+
.description(`Sync agent card from its /.well-known/agent.json URL
|
|
682
|
+
|
|
683
|
+
${chalk_1.default.bold('What it does:')}
|
|
684
|
+
Fetches the agent card from the agent's URL and updates
|
|
685
|
+
the GopherHole registry. Use after updating your agent's
|
|
686
|
+
skills, description, or capabilities.
|
|
687
|
+
|
|
688
|
+
${chalk_1.default.bold('Examples:')}
|
|
689
|
+
$ gopherhole agents sync-card agent-abc123
|
|
690
|
+
$ gopherhole agents sync-card my-agent
|
|
691
|
+
`)
|
|
692
|
+
.action(async (agentId) => {
|
|
693
|
+
const sessionId = config.get('sessionId');
|
|
694
|
+
if (!sessionId) {
|
|
695
|
+
console.log(chalk_1.default.yellow('Not logged in.'));
|
|
696
|
+
console.log(chalk_1.default.gray('Run: gopherhole login'));
|
|
697
|
+
process.exit(1);
|
|
698
|
+
}
|
|
699
|
+
const spinner = (0, ora_1.default)('Syncing agent card...').start();
|
|
700
|
+
log('POST /agents/' + agentId + '/sync-card');
|
|
701
|
+
try {
|
|
702
|
+
const res = await fetch(`${API_URL}/agents/${agentId}/sync-card`, {
|
|
703
|
+
method: 'POST',
|
|
704
|
+
headers: { 'X-Session-ID': sessionId },
|
|
705
|
+
});
|
|
706
|
+
if (!res.ok) {
|
|
707
|
+
const err = await res.json();
|
|
708
|
+
logError('sync-card', err);
|
|
709
|
+
throw new Error(err.error || 'Failed to sync card');
|
|
710
|
+
}
|
|
711
|
+
const data = await res.json();
|
|
712
|
+
spinner.succeed('Agent card synced!');
|
|
713
|
+
if (data.card) {
|
|
714
|
+
console.log(chalk_1.default.bold('\n Updated card:'));
|
|
715
|
+
console.log(` Name: ${brand.green(data.card.name)}`);
|
|
716
|
+
if (data.card.description) {
|
|
717
|
+
console.log(` Description: ${chalk_1.default.gray(data.card.description.slice(0, 60))}${data.card.description.length > 60 ? '...' : ''}`);
|
|
718
|
+
}
|
|
719
|
+
if (data.card.skills?.length) {
|
|
720
|
+
console.log(` Skills: ${data.card.skills.length} (${data.card.skills.map((s) => s.name).join(', ')})`);
|
|
721
|
+
}
|
|
722
|
+
console.log('');
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
catch (err) {
|
|
726
|
+
spinner.fail(chalk_1.default.red(err.message));
|
|
727
|
+
process.exit(1);
|
|
728
|
+
}
|
|
729
|
+
});
|
|
612
730
|
// ========== INIT COMMAND ==========
|
|
613
731
|
program
|
|
614
732
|
.command('init')
|
|
@@ -773,7 +891,7 @@ main().catch(console.error);
|
|
|
773
891
|
console.log(chalk_1.default.cyan(' npm start'));
|
|
774
892
|
console.log('');
|
|
775
893
|
console.log(chalk_1.default.gray(`Dashboard: https://gopherhole.ai/dashboard`));
|
|
776
|
-
console.log(chalk_1.default.gray(`Docs: https://gopherhole.ai
|
|
894
|
+
console.log(chalk_1.default.gray(`Docs: https://docs.gopherhole.ai`));
|
|
777
895
|
console.log('');
|
|
778
896
|
});
|
|
779
897
|
// ========== SEND COMMAND ==========
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -76,7 +76,7 @@ ${chalk.bold('Examples:')}
|
|
|
76
76
|
$ gopherhole agents list
|
|
77
77
|
|
|
78
78
|
${chalk.bold('Documentation:')}
|
|
79
|
-
https://gopherhole.ai
|
|
79
|
+
https://docs.gopherhole.ai
|
|
80
80
|
`)
|
|
81
81
|
.version('0.1.0')
|
|
82
82
|
.option('-v, --verbose', 'Enable verbose output for debugging')
|
|
@@ -349,7 +349,7 @@ ${chalk.bold('Example:')}
|
|
|
349
349
|
|
|
350
350
|
console.log(chalk.bold('\nš Next steps:\n'));
|
|
351
351
|
console.log(` ⢠Dashboard: ${chalk.cyan('https://gopherhole.ai/dashboard')}`);
|
|
352
|
-
console.log(` ⢠Docs: ${chalk.cyan('https://gopherhole.ai
|
|
352
|
+
console.log(` ⢠Docs: ${chalk.cyan('https://docs.gopherhole.ai')}`);
|
|
353
353
|
console.log(` ⢠Find agents: ${chalk.cyan('gopherhole discover search')}`);
|
|
354
354
|
console.log(` ⢠List yours: ${chalk.cyan('gopherhole agents list')}`);
|
|
355
355
|
console.log('');
|
|
@@ -618,7 +618,7 @@ ${chalk.bold('Examples:')}
|
|
|
618
618
|
console.log(chalk.white(` curl -H "Authorization: Bearer ${data.apiKey}" \\
|
|
619
619
|
https://gopherhole.ai/a2a -d '{"jsonrpc":"2.0","method":"agent/info","id":1}'`));
|
|
620
620
|
|
|
621
|
-
console.log(chalk.gray('\n Full docs: https://gopherhole.ai
|
|
621
|
+
console.log(chalk.gray('\n Full docs: https://docs.gopherhole.ai'));
|
|
622
622
|
console.log('');
|
|
623
623
|
} catch (err) {
|
|
624
624
|
spinner.fail(chalk.red((err as Error).message));
|
|
@@ -680,6 +680,135 @@ ${chalk.bold('Example:')}
|
|
|
680
680
|
}
|
|
681
681
|
});
|
|
682
682
|
|
|
683
|
+
agents
|
|
684
|
+
.command('regenerate-key <agentId>')
|
|
685
|
+
.description(`Regenerate API key for an agent
|
|
686
|
+
|
|
687
|
+
${chalk.bold('Example:')}
|
|
688
|
+
$ gopherhole agents regenerate-key agent-abc123
|
|
689
|
+
|
|
690
|
+
${chalk.yellow('ā ļø Warning:')} This will invalidate the current key.
|
|
691
|
+
All connected agents using this key will stop working.
|
|
692
|
+
`)
|
|
693
|
+
.option('-f, --force', 'Skip confirmation')
|
|
694
|
+
.option('--json', 'Output as JSON')
|
|
695
|
+
.action(async (agentId, options) => {
|
|
696
|
+
const sessionId = config.get('sessionId') as string;
|
|
697
|
+
if (!sessionId) {
|
|
698
|
+
console.log(chalk.yellow('Not logged in.'));
|
|
699
|
+
console.log(chalk.gray('Run: gopherhole login'));
|
|
700
|
+
process.exit(1);
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
if (!options.force) {
|
|
704
|
+
const { confirm } = await inquirer.prompt([
|
|
705
|
+
{
|
|
706
|
+
type: 'confirm',
|
|
707
|
+
name: 'confirm',
|
|
708
|
+
message: `Regenerate API key for ${chalk.cyan(agentId)}? This will invalidate the current key.`,
|
|
709
|
+
default: false,
|
|
710
|
+
},
|
|
711
|
+
]);
|
|
712
|
+
|
|
713
|
+
if (!confirm) {
|
|
714
|
+
console.log('Cancelled.');
|
|
715
|
+
return;
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
const spinner = ora('Regenerating API key...').start();
|
|
720
|
+
log('POST /agents/' + agentId + '/regenerate-key');
|
|
721
|
+
|
|
722
|
+
try {
|
|
723
|
+
const res = await fetch(`${API_URL}/agents/${agentId}/regenerate-key`, {
|
|
724
|
+
method: 'POST',
|
|
725
|
+
headers: {
|
|
726
|
+
'Content-Type': 'application/json',
|
|
727
|
+
'X-Session-ID': sessionId,
|
|
728
|
+
},
|
|
729
|
+
body: JSON.stringify({}),
|
|
730
|
+
});
|
|
731
|
+
|
|
732
|
+
if (!res.ok) {
|
|
733
|
+
const err = await res.json();
|
|
734
|
+
logError('regenerate-key', err);
|
|
735
|
+
throw new Error(err.error || 'Failed to regenerate key');
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
const data = await res.json();
|
|
739
|
+
spinner.succeed('API key regenerated');
|
|
740
|
+
|
|
741
|
+
if (options.json) {
|
|
742
|
+
console.log(JSON.stringify({ apiKey: data.apiKey }, null, 2));
|
|
743
|
+
} else {
|
|
744
|
+
console.log('');
|
|
745
|
+
console.log(chalk.bold('New API Key:'));
|
|
746
|
+
console.log(chalk.green(data.apiKey));
|
|
747
|
+
console.log('');
|
|
748
|
+
console.log(chalk.yellow('ā ļø Copy this key now ā it won\'t be shown again!'));
|
|
749
|
+
}
|
|
750
|
+
} catch (err) {
|
|
751
|
+
spinner.fail(chalk.red((err as Error).message));
|
|
752
|
+
process.exit(1);
|
|
753
|
+
}
|
|
754
|
+
});
|
|
755
|
+
|
|
756
|
+
agents
|
|
757
|
+
.command('sync-card <agentId>')
|
|
758
|
+
.description(`Sync agent card from its /.well-known/agent.json URL
|
|
759
|
+
|
|
760
|
+
${chalk.bold('What it does:')}
|
|
761
|
+
Fetches the agent card from the agent's URL and updates
|
|
762
|
+
the GopherHole registry. Use after updating your agent's
|
|
763
|
+
skills, description, or capabilities.
|
|
764
|
+
|
|
765
|
+
${chalk.bold('Examples:')}
|
|
766
|
+
$ gopherhole agents sync-card agent-abc123
|
|
767
|
+
$ gopherhole agents sync-card my-agent
|
|
768
|
+
`)
|
|
769
|
+
.action(async (agentId) => {
|
|
770
|
+
const sessionId = config.get('sessionId') as string;
|
|
771
|
+
if (!sessionId) {
|
|
772
|
+
console.log(chalk.yellow('Not logged in.'));
|
|
773
|
+
console.log(chalk.gray('Run: gopherhole login'));
|
|
774
|
+
process.exit(1);
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
const spinner = ora('Syncing agent card...').start();
|
|
778
|
+
log('POST /agents/' + agentId + '/sync-card');
|
|
779
|
+
|
|
780
|
+
try {
|
|
781
|
+
const res = await fetch(`${API_URL}/agents/${agentId}/sync-card`, {
|
|
782
|
+
method: 'POST',
|
|
783
|
+
headers: { 'X-Session-ID': sessionId },
|
|
784
|
+
});
|
|
785
|
+
|
|
786
|
+
if (!res.ok) {
|
|
787
|
+
const err = await res.json();
|
|
788
|
+
logError('sync-card', err);
|
|
789
|
+
throw new Error(err.error || 'Failed to sync card');
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
const data = await res.json();
|
|
793
|
+
spinner.succeed('Agent card synced!');
|
|
794
|
+
|
|
795
|
+
if (data.card) {
|
|
796
|
+
console.log(chalk.bold('\n Updated card:'));
|
|
797
|
+
console.log(` Name: ${brand.green(data.card.name)}`);
|
|
798
|
+
if (data.card.description) {
|
|
799
|
+
console.log(` Description: ${chalk.gray(data.card.description.slice(0, 60))}${data.card.description.length > 60 ? '...' : ''}`);
|
|
800
|
+
}
|
|
801
|
+
if (data.card.skills?.length) {
|
|
802
|
+
console.log(` Skills: ${data.card.skills.length} (${data.card.skills.map((s: any) => s.name).join(', ')})`);
|
|
803
|
+
}
|
|
804
|
+
console.log('');
|
|
805
|
+
}
|
|
806
|
+
} catch (err) {
|
|
807
|
+
spinner.fail(chalk.red((err as Error).message));
|
|
808
|
+
process.exit(1);
|
|
809
|
+
}
|
|
810
|
+
});
|
|
811
|
+
|
|
683
812
|
// ========== INIT COMMAND ==========
|
|
684
813
|
|
|
685
814
|
program
|
|
@@ -864,7 +993,7 @@ main().catch(console.error);
|
|
|
864
993
|
console.log(chalk.cyan(' npm start'));
|
|
865
994
|
console.log('');
|
|
866
995
|
console.log(chalk.gray(`Dashboard: https://gopherhole.ai/dashboard`));
|
|
867
|
-
console.log(chalk.gray(`Docs: https://gopherhole.ai
|
|
996
|
+
console.log(chalk.gray(`Docs: https://docs.gopherhole.ai`));
|
|
868
997
|
console.log('');
|
|
869
998
|
});
|
|
870
999
|
|