@gopherhole/cli 0.1.8 → 0.1.9

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 CHANGED
@@ -1119,9 +1119,26 @@ ${chalk_1.default.bold('Examples:')}
1119
1119
  for (const agent of data.agents) {
1120
1120
  const stars = '★'.repeat(Math.round(agent.avgRating)) + '☆'.repeat(5 - Math.round(agent.avgRating));
1121
1121
  const pricing = agent.pricing === 'free' ? brand.green('FREE') :
1122
- agent.pricing === 'paid' ? chalk_1.default.blue('PAID') : chalk_1.default.gray('CONTACT');
1123
- const instant = agent.autoApprove ? chalk_1.default.magenta('⚡INSTANT') : '';
1124
- console.log(` ${chalk_1.default.bold(agent.name)} ${chalk_1.default.yellow(stars)} (${agent.ratingCount}) ${instant}`);
1122
+ agent.pricing === 'paid' ? chalk_1.default.blue('PAID') :
1123
+ agent.pricing === 'freemium' ? chalk_1.default.cyan('FREEMIUM') : chalk_1.default.gray(agent.pricing?.toUpperCase() || 'FREE');
1124
+ // Access status badge
1125
+ let accessBadge = '';
1126
+ if (agent.accessStatus === 'owner') {
1127
+ accessBadge = chalk_1.default.blue('👤YOURS');
1128
+ }
1129
+ else if (agent.accessStatus === 'approved' || agent.accessStatus === 'open') {
1130
+ accessBadge = chalk_1.default.green('✓ACCESS');
1131
+ }
1132
+ else if (agent.accessStatus === 'pending') {
1133
+ accessBadge = chalk_1.default.yellow('⏳PENDING');
1134
+ }
1135
+ else if (agent.accessStatus === 'denied') {
1136
+ accessBadge = chalk_1.default.red('✗DENIED');
1137
+ }
1138
+ else if (agent.autoApprove) {
1139
+ accessBadge = chalk_1.default.magenta('⚡INSTANT');
1140
+ }
1141
+ console.log(` ${chalk_1.default.bold(agent.name)} ${chalk_1.default.yellow(stars)} (${agent.ratingCount}) ${accessBadge}`);
1125
1142
  console.log(` ${chalk_1.default.gray(agent.description || 'No description')}`);
1126
1143
  console.log(` ${chalk_1.default.cyan(agent.id)} | ${pricing} | ${agent.category || 'uncategorized'}`);
1127
1144
  console.log('');
@@ -1214,7 +1231,30 @@ ${chalk_1.default.bold('Example:')}
1214
1231
  console.log(` ${chalk_1.default.bold('Pricing:')} ${agent.pricing}`);
1215
1232
  console.log(` ${chalk_1.default.bold('Category:')} ${agent.category || 'None'}`);
1216
1233
  console.log(` ${chalk_1.default.bold('By:')} ${agent.tenantName}`);
1217
- console.log(` ${chalk_1.default.bold('Access:')} ${agent.autoApprove ? chalk_1.default.magenta('⚡ Instant (no approval needed)') : chalk_1.default.gray('Requires approval')}`);
1234
+ // Show access status
1235
+ let accessLine = '';
1236
+ if (agent.accessStatus === 'owner') {
1237
+ accessLine = chalk_1.default.blue('👤 Your agent');
1238
+ }
1239
+ else if (agent.accessStatus === 'approved') {
1240
+ accessLine = chalk_1.default.green('✓ You have access');
1241
+ }
1242
+ else if (agent.accessStatus === 'open') {
1243
+ accessLine = chalk_1.default.green('✓ Open access (instant)');
1244
+ }
1245
+ else if (agent.accessStatus === 'pending') {
1246
+ accessLine = chalk_1.default.yellow('⏳ Request pending');
1247
+ }
1248
+ else if (agent.accessStatus === 'denied') {
1249
+ accessLine = chalk_1.default.red('✗ Access denied');
1250
+ }
1251
+ else if (agent.autoApprove) {
1252
+ accessLine = chalk_1.default.magenta('⚡ Instant (no approval needed)');
1253
+ }
1254
+ else {
1255
+ accessLine = chalk_1.default.gray('Requires approval - run: gopherhole discover request ' + agentId);
1256
+ }
1257
+ console.log(` ${chalk_1.default.bold('Access:')} ${accessLine}`);
1218
1258
  if (agent.tags.length > 0) {
1219
1259
  console.log(` ${chalk_1.default.bold('Tags:')} ${agent.tags.join(', ')}`);
1220
1260
  }
@@ -1247,6 +1287,45 @@ ${chalk_1.default.bold('Example:')}
1247
1287
  process.exit(1);
1248
1288
  }
1249
1289
  });
1290
+ discover
1291
+ .command('request <agent-id>')
1292
+ .description(`Request access to an agent
1293
+
1294
+ ${chalk_1.default.bold('Example:')}
1295
+ $ gopherhole discover request agent-abc123
1296
+ $ gopherhole discover request agent-abc123 --reason "I want to integrate with my app"
1297
+ `)
1298
+ .option('-r, --reason <reason>', 'Reason for requesting access')
1299
+ .action(async (agentId, options) => {
1300
+ const sessionId = config.get('sessionId');
1301
+ if (!sessionId) {
1302
+ console.log(chalk_1.default.red('Not logged in. Run: gopherhole login'));
1303
+ process.exit(1);
1304
+ }
1305
+ const spinner = (0, ora_1.default)('Requesting access...').start();
1306
+ try {
1307
+ const res = await fetch(`${API_URL}/discover/agents/${agentId}/request-access`, {
1308
+ method: 'POST',
1309
+ headers: {
1310
+ 'Authorization': `Bearer ${sessionId}`,
1311
+ 'Content-Type': 'application/json',
1312
+ },
1313
+ body: JSON.stringify({ reason: options.reason }),
1314
+ });
1315
+ const data = await res.json();
1316
+ if (!res.ok) {
1317
+ spinner.fail(chalk_1.default.red(data.error || 'Failed to request access'));
1318
+ process.exit(1);
1319
+ }
1320
+ spinner.succeed(chalk_1.default.green('Access request sent!'));
1321
+ console.log(chalk_1.default.gray('\nThe agent owner will review your request.'));
1322
+ console.log(chalk_1.default.gray(`Check status: gopherhole discover info ${agentId}`));
1323
+ }
1324
+ catch (err) {
1325
+ spinner.fail(chalk_1.default.red(err.message));
1326
+ process.exit(1);
1327
+ }
1328
+ });
1250
1329
  discover
1251
1330
  .command('top')
1252
1331
  .description(`Show top-rated agents
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gopherhole/cli",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "GopherHole CLI - Connect AI agents to the world",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
package/src/index.ts CHANGED
@@ -1240,10 +1240,24 @@ ${chalk.bold('Examples:')}
1240
1240
  for (const agent of data.agents) {
1241
1241
  const stars = '★'.repeat(Math.round(agent.avgRating)) + '☆'.repeat(5 - Math.round(agent.avgRating));
1242
1242
  const pricing = agent.pricing === 'free' ? brand.green('FREE') :
1243
- agent.pricing === 'paid' ? chalk.blue('PAID') : chalk.gray('CONTACT');
1244
- const instant = agent.autoApprove ? chalk.magenta('⚡INSTANT') : '';
1243
+ agent.pricing === 'paid' ? chalk.blue('PAID') :
1244
+ agent.pricing === 'freemium' ? chalk.cyan('FREEMIUM') : chalk.gray(agent.pricing?.toUpperCase() || 'FREE');
1245
+
1246
+ // Access status badge
1247
+ let accessBadge = '';
1248
+ if (agent.accessStatus === 'owner') {
1249
+ accessBadge = chalk.blue('👤YOURS');
1250
+ } else if (agent.accessStatus === 'approved' || agent.accessStatus === 'open') {
1251
+ accessBadge = chalk.green('✓ACCESS');
1252
+ } else if (agent.accessStatus === 'pending') {
1253
+ accessBadge = chalk.yellow('⏳PENDING');
1254
+ } else if (agent.accessStatus === 'denied') {
1255
+ accessBadge = chalk.red('✗DENIED');
1256
+ } else if (agent.autoApprove) {
1257
+ accessBadge = chalk.magenta('⚡INSTANT');
1258
+ }
1245
1259
 
1246
- console.log(` ${chalk.bold(agent.name)} ${chalk.yellow(stars)} (${agent.ratingCount}) ${instant}`);
1260
+ console.log(` ${chalk.bold(agent.name)} ${chalk.yellow(stars)} (${agent.ratingCount}) ${accessBadge}`);
1247
1261
  console.log(` ${chalk.gray(agent.description || 'No description')}`);
1248
1262
  console.log(` ${chalk.cyan(agent.id)} | ${pricing} | ${agent.category || 'uncategorized'}`);
1249
1263
  console.log('');
@@ -1346,7 +1360,25 @@ ${chalk.bold('Example:')}
1346
1360
  console.log(` ${chalk.bold('Pricing:')} ${agent.pricing}`);
1347
1361
  console.log(` ${chalk.bold('Category:')} ${agent.category || 'None'}`);
1348
1362
  console.log(` ${chalk.bold('By:')} ${agent.tenantName}`);
1349
- console.log(` ${chalk.bold('Access:')} ${agent.autoApprove ? chalk.magenta('⚡ Instant (no approval needed)') : chalk.gray('Requires approval')}`);
1363
+
1364
+ // Show access status
1365
+ let accessLine = '';
1366
+ if (agent.accessStatus === 'owner') {
1367
+ accessLine = chalk.blue('👤 Your agent');
1368
+ } else if (agent.accessStatus === 'approved') {
1369
+ accessLine = chalk.green('✓ You have access');
1370
+ } else if (agent.accessStatus === 'open') {
1371
+ accessLine = chalk.green('✓ Open access (instant)');
1372
+ } else if (agent.accessStatus === 'pending') {
1373
+ accessLine = chalk.yellow('⏳ Request pending');
1374
+ } else if (agent.accessStatus === 'denied') {
1375
+ accessLine = chalk.red('✗ Access denied');
1376
+ } else if (agent.autoApprove) {
1377
+ accessLine = chalk.magenta('⚡ Instant (no approval needed)');
1378
+ } else {
1379
+ accessLine = chalk.gray('Requires approval - run: gopherhole discover request ' + agentId);
1380
+ }
1381
+ console.log(` ${chalk.bold('Access:')} ${accessLine}`);
1350
1382
 
1351
1383
  if (agent.tags.length > 0) {
1352
1384
  console.log(` ${chalk.bold('Tags:')} ${agent.tags.join(', ')}`);
@@ -1383,6 +1415,50 @@ ${chalk.bold('Example:')}
1383
1415
  }
1384
1416
  });
1385
1417
 
1418
+ discover
1419
+ .command('request <agent-id>')
1420
+ .description(`Request access to an agent
1421
+
1422
+ ${chalk.bold('Example:')}
1423
+ $ gopherhole discover request agent-abc123
1424
+ $ gopherhole discover request agent-abc123 --reason "I want to integrate with my app"
1425
+ `)
1426
+ .option('-r, --reason <reason>', 'Reason for requesting access')
1427
+ .action(async (agentId, options) => {
1428
+ const sessionId = config.get('sessionId') as string;
1429
+ if (!sessionId) {
1430
+ console.log(chalk.red('Not logged in. Run: gopherhole login'));
1431
+ process.exit(1);
1432
+ }
1433
+
1434
+ const spinner = ora('Requesting access...').start();
1435
+
1436
+ try {
1437
+ const res = await fetch(`${API_URL}/discover/agents/${agentId}/request-access`, {
1438
+ method: 'POST',
1439
+ headers: {
1440
+ 'Authorization': `Bearer ${sessionId}`,
1441
+ 'Content-Type': 'application/json',
1442
+ },
1443
+ body: JSON.stringify({ reason: options.reason }),
1444
+ });
1445
+
1446
+ const data = await res.json();
1447
+
1448
+ if (!res.ok) {
1449
+ spinner.fail(chalk.red(data.error || 'Failed to request access'));
1450
+ process.exit(1);
1451
+ }
1452
+
1453
+ spinner.succeed(chalk.green('Access request sent!'));
1454
+ console.log(chalk.gray('\nThe agent owner will review your request.'));
1455
+ console.log(chalk.gray(`Check status: gopherhole discover info ${agentId}`));
1456
+ } catch (err) {
1457
+ spinner.fail(chalk.red((err as Error).message));
1458
+ process.exit(1);
1459
+ }
1460
+ });
1461
+
1386
1462
  discover
1387
1463
  .command('top')
1388
1464
  .description(`Show top-rated agents