dealgo 1.1.0 → 1.2.0

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.
Files changed (2) hide show
  1. package/dist/index.js +53 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -601,5 +601,58 @@ agentsCmd
601
601
  process.exit(1);
602
602
  }
603
603
  });
604
+ // ============================================================================
605
+ // whoami - Show current API key and tenant information
606
+ // ============================================================================
607
+ program
608
+ .command('whoami')
609
+ .description('Show information about the current API key and tenant')
610
+ .option('--json', 'Output in JSON format')
611
+ .option('--profile <name>', 'Use a specific profile')
612
+ .action(async (options) => {
613
+ try {
614
+ const config = loadConfig();
615
+ const profileName = options.profile || config.defaultProfile;
616
+ const profile = config.profiles[profileName];
617
+ if (!profile) {
618
+ console.error(chalk_1.default.red(`✗ Profile '${profileName}' not found`));
619
+ process.exit(1);
620
+ }
621
+ const apiKey = getApiKey(profile);
622
+ const apiUrl = profile.apiUrl;
623
+ // Fetch tenant info
624
+ const response = await (0, node_fetch_1.default)(`${apiUrl}/api/v1/me`, {
625
+ method: 'GET',
626
+ headers: {
627
+ 'x-dealgo-key': apiKey,
628
+ },
629
+ });
630
+ if (!response.ok) {
631
+ const error = await response.json().catch(() => ({ error: 'Unknown error' }));
632
+ console.error(chalk_1.default.red('✗ Failed to get tenant info:'), error.error);
633
+ process.exit(1);
634
+ }
635
+ const data = await response.json();
636
+ if (options.json) {
637
+ console.log(JSON.stringify(data, null, 2));
638
+ return;
639
+ }
640
+ console.log(chalk_1.default.green('✓ Authenticated'));
641
+ console.log('');
642
+ console.log(chalk_1.default.bold(' Tenant:'));
643
+ console.log(` - ID: ${data.tenant.id}`);
644
+ console.log(` - Name: ${data.tenant.name}`);
645
+ console.log(` - Plan: ${data.tenant.plan}`);
646
+ console.log('');
647
+ console.log(chalk_1.default.bold(' API Key:'));
648
+ console.log(` - ID: ${data.apiKey.id}`);
649
+ console.log(` - Scopes: ${data.apiKey.scopes.join(', ')}`);
650
+ console.log(` - Created: ${new Date(data.apiKey.createdAt).toLocaleString()}`);
651
+ }
652
+ catch (error) {
653
+ console.error(chalk_1.default.red('✗ Error:'), error.message);
654
+ process.exit(1);
655
+ }
656
+ });
604
657
  // Parse CLI arguments
605
658
  program.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dealgo",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "CLI for DeAlgo - Git for AI Decisions. Manage AI decisions, verify cryptographic chains, and control API keys from the terminal.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {