@castari/cli 0.1.10 ā 0.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.
- package/bin/cast.js +2 -0
- package/dist/commands/agents.d.ts +6 -0
- package/dist/commands/agents.d.ts.map +1 -0
- package/dist/commands/agents.js +174 -0
- package/dist/commands/agents.js.map +1 -0
- package/dist/commands/apikey.d.ts +6 -0
- package/dist/commands/apikey.d.ts.map +1 -0
- package/dist/commands/apikey.js +57 -0
- package/dist/commands/apikey.js.map +1 -0
- package/dist/commands/deploy.d.ts +3 -3
- package/dist/commands/deploy.d.ts.map +1 -0
- package/dist/commands/deploy.js +24 -64
- package/dist/commands/deploy.js.map +1 -0
- package/dist/commands/invoke.d.ts +3 -0
- package/dist/commands/invoke.d.ts.map +1 -0
- package/dist/commands/invoke.js +50 -0
- package/dist/commands/invoke.js.map +1 -0
- package/dist/commands/login.d.ts +3 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +123 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/logout.d.ts +3 -0
- package/dist/commands/logout.d.ts.map +1 -0
- package/dist/commands/logout.js +16 -0
- package/dist/commands/logout.js.map +1 -0
- package/dist/commands/secrets.d.ts +6 -0
- package/dist/commands/secrets.d.ts.map +1 -0
- package/dist/commands/secrets.js +90 -0
- package/dist/commands/secrets.js.map +1 -0
- package/dist/commands/stop.d.ts +3 -0
- package/dist/commands/stop.d.ts.map +1 -0
- package/dist/commands/stop.js +25 -0
- package/dist/commands/stop.js.map +1 -0
- package/dist/commands/usage.d.ts +3 -0
- package/dist/commands/usage.d.ts.map +1 -0
- package/dist/commands/usage.js +76 -0
- package/dist/commands/usage.js.map +1 -0
- package/dist/commands/whoami.d.ts +3 -0
- package/dist/commands/whoami.d.ts.map +1 -0
- package/dist/commands/whoami.js +27 -0
- package/dist/commands/whoami.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +36 -34
- package/dist/index.js.map +1 -0
- package/dist/utils/errors.d.ts +6 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +42 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/output.d.ts +45 -0
- package/dist/utils/output.d.ts.map +1 -0
- package/dist/utils/output.js +75 -0
- package/dist/utils/output.js.map +1 -0
- package/package.json +55 -35
- package/LICENSE +0 -21
- package/README.md +0 -131
- package/dist/commands/client-id.d.ts +0 -1
- package/dist/commands/client-id.js +0 -25
- package/dist/commands/dev.d.ts +0 -1
- package/dist/commands/dev.js +0 -17
- package/dist/commands/generate-secrets.d.ts +0 -1
- package/dist/commands/generate-secrets.js +0 -60
- package/dist/commands/init.d.ts +0 -5
- package/dist/commands/init.js +0 -883
- package/dist/commands/start.d.ts +0 -5
- package/dist/commands/start.js +0 -100
- package/dist/utils/client-auth.d.ts +0 -11
- package/dist/utils/client-auth.js +0 -21
- package/dist/utils/client-id.d.ts +0 -10
- package/dist/utils/client-id.js +0 -36
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Castari
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/README.md
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
# @castari/cli
|
|
2
|
-
|
|
3
|
-
The command line interface for building and deploying Castari agents.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install -g @castari/cli
|
|
9
|
-
# or
|
|
10
|
-
bun add -g @castari/cli
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Quick Start
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
# Create a new agent project
|
|
17
|
-
castari init
|
|
18
|
-
|
|
19
|
-
# Run locally for development
|
|
20
|
-
castari dev
|
|
21
|
-
|
|
22
|
-
# Deploy to Castari Platform
|
|
23
|
-
castari deploy
|
|
24
|
-
|
|
25
|
-
# Start a cloud sandbox
|
|
26
|
-
castari start
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
## Commands
|
|
30
|
-
|
|
31
|
-
### `castari init`
|
|
32
|
-
|
|
33
|
-
Scaffolds a new Castari agent project.
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
castari init # Basic agent scaffold
|
|
37
|
-
castari init --demo # Full demo with agent + Next.js chat UI
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Creates:
|
|
41
|
-
- `package.json` - Configured with dependencies
|
|
42
|
-
- `tsconfig.json` - TypeScript configuration
|
|
43
|
-
- `src/agent.ts` - Starter agent code
|
|
44
|
-
- `.env.example` - Environment variable template
|
|
45
|
-
|
|
46
|
-
### `castari dev`
|
|
47
|
-
|
|
48
|
-
Runs the agent locally for development.
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
castari dev
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
Starts a local server at `http://localhost:3000` with hot reloading.
|
|
55
|
-
|
|
56
|
-
### `castari deploy`
|
|
57
|
-
|
|
58
|
-
Uploads your agent to the Castari Platform.
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
castari deploy
|
|
62
|
-
castari deploy --name my-custom-name
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
**Options:**
|
|
66
|
-
- `--name <name>` - Override the snapshot name (defaults to package.json name)
|
|
67
|
-
|
|
68
|
-
**Requires:** `CASTARI_CLIENT_ID` environment variable
|
|
69
|
-
|
|
70
|
-
### `castari start`
|
|
71
|
-
|
|
72
|
-
Starts a cloud sandbox and connects to your agent.
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
castari start
|
|
76
|
-
castari start --snapshot my-agent --volume my-data
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
**Options:**
|
|
80
|
-
- `--snapshot <name>` - Snapshot to use (defaults to package.json name)
|
|
81
|
-
- `--volume <name>` - Volume to mount for persistent storage
|
|
82
|
-
|
|
83
|
-
**Requires:** `CASTARI_CLIENT_ID` and `ANTHROPIC_API_KEY` environment variables
|
|
84
|
-
|
|
85
|
-
Press `Ctrl+C` to gracefully shut down.
|
|
86
|
-
|
|
87
|
-
### `castari generate-secrets`
|
|
88
|
-
|
|
89
|
-
Generates Castari credentials (client ID and API key) and stores them in `~/.castari/client.json`.
|
|
90
|
-
|
|
91
|
-
```bash
|
|
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
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
## Configuration
|
|
102
|
-
|
|
103
|
-
### Environment Variables
|
|
104
|
-
|
|
105
|
-
Create a `.env` file in your project:
|
|
106
|
-
|
|
107
|
-
```env
|
|
108
|
-
ANTHROPIC_API_KEY=sk-ant-...
|
|
109
|
-
CASTARI_CLIENT_ID=your-client-id
|
|
110
|
-
CASTARI_API_KEY=castari_your-api-key
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
### package.json
|
|
114
|
-
|
|
115
|
-
```json
|
|
116
|
-
{
|
|
117
|
-
"name": "my-agent",
|
|
118
|
-
"castari": {
|
|
119
|
-
"volume": "my-volume-name"
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
## Prerequisites
|
|
125
|
-
|
|
126
|
-
- [Bun](https://bun.sh) v1.0+
|
|
127
|
-
- [Anthropic](https://anthropic.com) API key
|
|
128
|
-
|
|
129
|
-
## License
|
|
130
|
-
|
|
131
|
-
MIT
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function resolveClientId(): Promise<string>;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { readFile } from 'fs/promises';
|
|
2
|
-
import { existsSync } from 'fs';
|
|
3
|
-
import { join } from 'path';
|
|
4
|
-
import { homedir } from 'os';
|
|
5
|
-
import chalk from 'chalk';
|
|
6
|
-
const CONFIG_PATH = join(homedir(), '.castari', 'client.json');
|
|
7
|
-
export async function resolveClientId() {
|
|
8
|
-
const envId = process.env.CASTARI_CLIENT_ID;
|
|
9
|
-
if (envId)
|
|
10
|
-
return envId.trim();
|
|
11
|
-
if (existsSync(CONFIG_PATH)) {
|
|
12
|
-
try {
|
|
13
|
-
const raw = await readFile(CONFIG_PATH, 'utf-8');
|
|
14
|
-
const data = JSON.parse(raw);
|
|
15
|
-
if (data.clientId)
|
|
16
|
-
return data.clientId.trim();
|
|
17
|
-
}
|
|
18
|
-
catch {
|
|
19
|
-
// ignore and fall through
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
console.error(chalk.red('ā CASTARI_CLIENT_ID is required.'));
|
|
23
|
-
console.error(chalk.white('Run `castari generate-secrets` to create one, or set CASTARI_CLIENT_ID in your environment.'));
|
|
24
|
-
throw new Error('Missing CASTARI_CLIENT_ID');
|
|
25
|
-
}
|
package/dist/commands/dev.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function dev(): Promise<void>;
|
package/dist/commands/dev.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { pathToFileURL } from 'url';
|
|
2
|
-
import { join } from 'path';
|
|
3
|
-
import chalk from 'chalk';
|
|
4
|
-
export async function dev() {
|
|
5
|
-
console.log(chalk.blue('š ļø Starting local development server...'));
|
|
6
|
-
try {
|
|
7
|
-
const agentPath = join(process.cwd(), 'src', 'agent.ts');
|
|
8
|
-
// Dynamic import of the agent file.
|
|
9
|
-
// Since the agent file calls `serve()`, this will start the server.
|
|
10
|
-
await import(pathToFileURL(agentPath).href);
|
|
11
|
-
}
|
|
12
|
-
catch (err) {
|
|
13
|
-
console.error(chalk.red('Failed to start local agent:'), err.message || err);
|
|
14
|
-
console.log(chalk.white('Make sure src/agent.ts exists and exports/calls serve().'));
|
|
15
|
-
process.exit(1);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function generateSecrets(): Promise<void>;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { randomUUID } from 'crypto';
|
|
2
|
-
import inquirer from 'inquirer';
|
|
3
|
-
import chalk from 'chalk';
|
|
4
|
-
import { saveClientAuth } from '../utils/client-auth';
|
|
5
|
-
export async function generateSecrets() {
|
|
6
|
-
const platformUrl = process.env.CASTARI_PLATFORM_URL || 'https://castari-api-12511-04c55b73-g4p2s9om.onporter.run';
|
|
7
|
-
const mintOnline = async () => {
|
|
8
|
-
try {
|
|
9
|
-
const res = await fetch(`${platformUrl}/client-ids`, { method: 'POST' });
|
|
10
|
-
if (!res.ok) {
|
|
11
|
-
const text = await res.text();
|
|
12
|
-
throw new Error(text || `status ${res.status}`);
|
|
13
|
-
}
|
|
14
|
-
const data = (await res.json());
|
|
15
|
-
if (!data.clientId)
|
|
16
|
-
throw new Error('No clientId returned');
|
|
17
|
-
await saveClientAuth({
|
|
18
|
-
clientId: data.clientId,
|
|
19
|
-
apiKey: data.apiKey,
|
|
20
|
-
source: 'online',
|
|
21
|
-
platformUrl,
|
|
22
|
-
});
|
|
23
|
-
console.log(chalk.green(`\nā
Secrets generated!\n`));
|
|
24
|
-
console.log(chalk.white(`CASTARI_CLIENT_ID=${data.clientId}`));
|
|
25
|
-
if (data.apiKey) {
|
|
26
|
-
console.log(chalk.white(`CASTARI_API_KEY=${data.apiKey}`));
|
|
27
|
-
}
|
|
28
|
-
console.log(chalk.gray(`\nSaved to ~/.castari/client.json`));
|
|
29
|
-
return true;
|
|
30
|
-
}
|
|
31
|
-
catch (err) {
|
|
32
|
-
console.error(chalk.yellow(`ā ļø Failed to mint via platform: ${err?.message || err}`));
|
|
33
|
-
return false;
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
const success = await mintOnline();
|
|
37
|
-
if (success)
|
|
38
|
-
return;
|
|
39
|
-
const { confirmOffline } = await inquirer.prompt([
|
|
40
|
-
{
|
|
41
|
-
type: 'confirm',
|
|
42
|
-
name: 'confirmOffline',
|
|
43
|
-
message: 'Generate an offline client ID instead? (no API key)',
|
|
44
|
-
default: false,
|
|
45
|
-
},
|
|
46
|
-
]);
|
|
47
|
-
if (!confirmOffline) {
|
|
48
|
-
console.error(chalk.red('Aborted. No secrets generated.'));
|
|
49
|
-
process.exit(1);
|
|
50
|
-
}
|
|
51
|
-
const offlineId = randomUUID();
|
|
52
|
-
await saveClientAuth({
|
|
53
|
-
clientId: offlineId,
|
|
54
|
-
source: 'offline',
|
|
55
|
-
});
|
|
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`));
|
|
60
|
-
}
|