@castari/cli 0.1.6 → 0.1.8

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 CHANGED
@@ -84,12 +84,18 @@ castari start --snapshot my-agent --volume my-data
84
84
 
85
85
  Press `Ctrl+C` to gracefully shut down.
86
86
 
87
- ### `castari generate-client-id`
87
+ ### `castari generate-secrets`
88
88
 
89
- Creates a new Castari client ID and stores it in `~/.castari/client.json`.
89
+ Generates Castari credentials (client ID and API key) and stores them in `~/.castari/client.json`.
90
90
 
91
91
  ```bash
92
- castari generate-client-id
92
+ castari generate-secrets
93
+ ```
94
+
95
+ Outputs both values so you can copy them to your `.env` file:
96
+ ```
97
+ CASTARI_CLIENT_ID=your-client-id
98
+ CASTARI_API_KEY=castari_your-api-key
93
99
  ```
94
100
 
95
101
  ## Configuration
@@ -20,6 +20,6 @@ export async function resolveClientId() {
20
20
  }
21
21
  }
22
22
  console.error(chalk.red('❌ CASTARI_CLIENT_ID is required.'));
23
- console.error(chalk.white('Run `castari generate-client-id` to create one (stored in ~/.castari/client.json), or set CASTARI_CLIENT_ID in your environment.'));
23
+ console.error(chalk.white('Run `castari generate-secrets` to create one, or set CASTARI_CLIENT_ID in your environment.'));
24
24
  throw new Error('Missing CASTARI_CLIENT_ID');
25
25
  }
@@ -0,0 +1 @@
1
+ export declare function generateSecrets(): Promise<void>;
@@ -2,7 +2,7 @@ import { randomUUID } from 'crypto';
2
2
  import inquirer from 'inquirer';
3
3
  import chalk from 'chalk';
4
4
  import { saveClientAuth } from '../utils/client-auth';
5
- export async function generateClientId() {
5
+ export async function generateSecrets() {
6
6
  const platformUrl = process.env.CASTARI_PLATFORM_URL || 'https://castari-api-12511-04c55b73-g4p2s9om.onporter.run';
7
7
  const mintOnline = async () => {
8
8
  try {
@@ -20,31 +20,32 @@ export async function generateClientId() {
20
20
  source: 'online',
21
21
  platformUrl,
22
22
  });
23
- console.log(chalk.green(`✅ Client ID minted: ${data.clientId}`));
23
+ console.log(chalk.green(`\n✅ Secrets generated!\n`));
24
+ console.log(chalk.white(`CASTARI_CLIENT_ID=${data.clientId}`));
24
25
  if (data.apiKey) {
25
- console.log(chalk.green(`✅ API Key issued`));
26
+ console.log(chalk.white(`CASTARI_API_KEY=${data.apiKey}`));
26
27
  }
27
- console.log(chalk.white(`Saved to ~/.castari/client.json`));
28
- return data.clientId;
28
+ console.log(chalk.gray(`\nSaved to ~/.castari/client.json`));
29
+ return true;
29
30
  }
30
31
  catch (err) {
31
32
  console.error(chalk.yellow(`⚠️ Failed to mint via platform: ${err?.message || err}`));
32
- return null;
33
+ return false;
33
34
  }
34
35
  };
35
- const onlineId = await mintOnline();
36
- if (onlineId)
36
+ const success = await mintOnline();
37
+ if (success)
37
38
  return;
38
39
  const { confirmOffline } = await inquirer.prompt([
39
40
  {
40
41
  type: 'confirm',
41
42
  name: 'confirmOffline',
42
- message: 'Generate an offline client ID instead?',
43
+ message: 'Generate an offline client ID instead? (no API key)',
43
44
  default: false,
44
45
  },
45
46
  ]);
46
47
  if (!confirmOffline) {
47
- console.error(chalk.red('Aborted. No client ID generated.'));
48
+ console.error(chalk.red('Aborted. No secrets generated.'));
48
49
  process.exit(1);
49
50
  }
50
51
  const offlineId = randomUUID();
@@ -52,6 +53,8 @@ export async function generateClientId() {
52
53
  clientId: offlineId,
53
54
  source: 'offline',
54
55
  });
55
- console.log(chalk.green(`✅ Offline client ID generated: ${offlineId}`));
56
- console.log(chalk.white(`Saved to ~/.castari/client.json`));
56
+ console.log(chalk.green(`\n✅ Offline client ID generated!\n`));
57
+ console.log(chalk.white(`CASTARI_CLIENT_ID=${offlineId}`));
58
+ console.log(chalk.yellow(`\nNote: No API key generated in offline mode.`));
59
+ console.log(chalk.gray(`Saved to ~/.castari/client.json`));
57
60
  }
@@ -854,9 +854,9 @@ Structure:
854
854
  ## Getting Castari Credentials
855
855
  Generate your clientId and apiKey by running:
856
856
  \`\`\`bash
857
- castari generate-client-id
857
+ castari generate-secrets
858
858
  \`\`\`
859
- Or via the Castari Platform Console if available.
859
+ This will output both values so you can copy them to your \`.env\` files.
860
860
 
861
861
  ## 1) Prepare and deploy the agent
862
862
  \`\`\`bash
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import { init } from './commands/init';
4
4
  import { deploy } from './commands/deploy';
5
5
  import { start } from './commands/start';
6
6
  import { dev } from './commands/dev';
7
- import { generateClientId } from './commands/generate-client-id';
7
+ import { generateSecrets } from './commands/generate-secrets';
8
8
  import { createRequire } from 'module';
9
9
  const require = createRequire(import.meta.url);
10
10
  const { version } = require('../package.json');
@@ -27,8 +27,8 @@ cli
27
27
  .command('dev', 'Run the agent locally for development')
28
28
  .action(dev);
29
29
  cli
30
- .command('generate-client-id', 'Generate a new Castari Client ID and save it locally')
31
- .action(generateClientId);
30
+ .command('generate-secrets', 'Generate Castari credentials (client ID and API key)')
31
+ .action(generateSecrets);
32
32
  cli.help();
33
33
  cli.version(version);
34
34
  cli.parse();
@@ -31,6 +31,6 @@ export async function getClientIdOrExit(explicit) {
31
31
  if (stored?.clientId)
32
32
  return stored.clientId;
33
33
  console.error(chalk.red('CASTARI_CLIENT_ID is required.'));
34
- console.error(chalk.white('Run `castari generate-client-id` to create one, or set CASTARI_CLIENT_ID in your environment.'));
34
+ console.error(chalk.white('Run `castari generate-secrets` to create one, or set CASTARI_CLIENT_ID in your environment.'));
35
35
  process.exit(1);
36
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@castari/cli",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "castari": "./dist/index.js"
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@anthropic-ai/claude-agent-sdk": "^0.1.44",
21
- "@castari/sdk": "^0.1.1",
21
+ "@castari/sdk": "^0.1.3",
22
22
  "adm-zip": "^0.5.16",
23
23
  "cac": "^6.7.14",
24
24
  "chalk": "^5.3.0",
@@ -1 +0,0 @@
1
- export declare function generateClientId(): Promise<void>;