maritime-cli 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.
package/AGENTS.md CHANGED
@@ -88,13 +88,17 @@ Success shape:
88
88
 
89
89
  Without `--json`, `chat` prints only the reply text on stdout (clean for piping).
90
90
 
91
- ## Per-agent resources (serverless)
91
+ ## Sizing (optional)
92
92
 
93
- Each agent can override the tier defaults at create time. Omitted flags inherit
94
- the tier; values are per-agent (no server pinning).
93
+ You don't size agents. `maritime create <name>` picks an applicable size for the
94
+ framework, and the agent auto-sleeps when idle and wakes on the next `chat`.
95
+
96
+ For hand-tuning one agent (e.g. a reseller dialing resources per client), `create`
97
+ accepts optional per-agent overrides. They're hidden from `--help` but fully
98
+ supported; omitted flags inherit the tier default.
95
99
 
96
100
  ```bash
97
- maritime create my-agent --source github --repo … \
101
+ maritime create my-agent \
98
102
  --ram 2048 \ # RAM in MB
99
103
  --cpu 1.5 \ # vCPU cores (fractional OK)
100
104
  --idle 600 \ # auto-sleep 600s after the last request
@@ -137,11 +141,15 @@ A partial failure exits `1` with the failed keys listed in `failed`.
137
141
  ## Command map
138
142
 
139
143
  Auth / keys: `login`, `logout`, `whoami`, `keys {create,list,revoke}`
140
- Lifecycle: `create`, `list`, `start`, `stop`, `restart`, `sleep`, `delete`, `scale <tier>`, `deploy`
141
- Interaction: `chat`/`send`, `exec <agent> <cmd...>`
144
+ Lifecycle: `create`, `list`, `deploy`, `delete`
145
+ Interaction: `chat`/`send`
142
146
  Config: `env {set,import,list,remove,reload}`
143
- Observe: `status`, `info`, `logs`, `history`, `triggers`, `blueprint`
144
- Discovery: `templates`
147
+ Observe: `status`, `logs`
148
+
149
+ Advanced / ops (hidden from `--help`, still fully supported): `start`, `stop`,
150
+ `restart`, `sleep`, `scale <tier>`, `exec <agent> <cmd...>`, `info`, `history`,
151
+ `triggers`, `blueprint`, `templates`. You rarely need these — lifecycle is
152
+ automatic (idle-sleep + auto-wake on `chat`).
145
153
 
146
154
  Run `maritime <cmd> --help` for flags. Every command accepts the global
147
155
  `--json` and `--verbose`.
@@ -153,7 +161,7 @@ Run `maritime <cmd> --help` for flags. Every command accepts the global
153
161
  maritime status my-agent --json | jq -r '.status'
154
162
 
155
163
  # Create, then talk to it
156
- ID=$(maritime create --name researcher --template openclaw --json | jq -r '.id')
164
+ ID=$(maritime create researcher --template openclaw --json | jq -r '.id')
157
165
  maritime chat "$ID" "introduce yourself" --json | jq -r '.response'
158
166
 
159
167
  # Run a shell command inside the container
@@ -167,7 +175,7 @@ maritime logs my-agent --level error --json
167
175
 
168
176
  - `delete` refuses to run non-interactively without `--yes` (exit `4`); pass
169
177
  `--yes` deliberately.
170
- - `create` requires `--name` when non-interactive (exit `4`).
178
+ - `create` needs a name (positional `<name>`, or `--name`) when non-interactive (exit `4`).
171
179
  - Non-2xx that the backend reports inside a body (e.g. agent not running for
172
180
  `chat`) surfaces as `error.code = "agent_unavailable"`, exit `1`.
173
181
  - The API base URL can be overridden with `MARITIME_API_URL` (default
@@ -1,4 +1,4 @@
1
- import { Command } from 'commander';
1
+ import { Command, Option } from 'commander';
2
2
  import chalk from 'chalk';
3
3
  import { authGet, authPost } from '../api.js';
4
4
  import { promptForValue } from '../prompt.js';
@@ -21,25 +21,30 @@ function parseEnvPairs(pairs) {
21
21
  }
22
22
  export const createCommand = new Command('create')
23
23
  .description('Create a new agent')
24
- .option('-n, --name <name>', 'Agent name')
25
- .option('-t, --template <template>', 'Template ID')
26
- .option('--framework <framework>', 'Framework (default: custom)')
27
- .option('--tier <tier>', 'Tier (smart, extended, always_on)')
24
+ .argument('[name]', 'Agent name')
25
+ .option('-t, --template <template>', 'Template to base the agent on (see `maritime templates`)')
28
26
  .option('-e, --env <pairs...>', 'Environment variables (KEY=value)')
29
- .option('--ram <mb>', 'RAM in MB (per-agent override of the tier default)')
30
- .option('--cpu <cores>', 'vCPU cores, e.g. 0.5 or 2 (per-agent override)')
31
- .option('--idle <seconds>', 'Auto-sleep this many seconds after the last request')
32
- .option('--always-on', 'Never auto-sleep (mutually exclusive with --idle)')
33
- .option('--disk <gb>', 'Workspace SSD size in GB (per-agent override)')
34
- .option('--max-compute <minutes>', 'Hard cap: auto-sleep after N compute-minutes per billing period')
27
+ // Advanced overrides — kept fully working but off the main --help so the
28
+ // happy path stays flag-free. By default the platform picks the applicable
29
+ // size for the framework and auto-sleeps when idle; you only reach for these
30
+ // to hand-tune a specific agent (e.g. a reseller dialing RAM per client).
31
+ .addOption(new Option('-n, --name <name>', 'Agent name (alias for the positional argument)').hideHelp())
32
+ .addOption(new Option('--framework <framework>', 'Framework (default: custom)').hideHelp())
33
+ .addOption(new Option('--tier <tier>', 'Tier (smart, extended, always_on)').hideHelp())
34
+ .addOption(new Option('--ram <mb>', 'RAM in MB (per-agent override of the tier default)').hideHelp())
35
+ .addOption(new Option('--cpu <cores>', 'vCPU cores, e.g. 0.5 or 2 (per-agent override)').hideHelp())
36
+ .addOption(new Option('--idle <seconds>', 'Auto-sleep this many seconds after the last request').hideHelp())
37
+ .addOption(new Option('--always-on', 'Never auto-sleep (mutually exclusive with --idle)').hideHelp())
38
+ .addOption(new Option('--disk <gb>', 'Workspace SSD size in GB (per-agent override)').hideHelp())
39
+ .addOption(new Option('--max-compute <minutes>', 'Hard cap: auto-sleep after N compute-minutes per billing period').hideHelp())
35
40
  .addHelpText('after', `
36
41
  Examples:
37
- maritime create researcher --template openclaw --json
38
- maritime create acme-bot --ram 2048 --cpu 1.5 --idle 600 --json
39
- maritime create client-x --disk 20 --max-compute 120 --always-on --json`)
40
- .action(async (opts) => {
42
+ maritime create researcher
43
+ maritime create acme-bot --template openclaw --json
44
+ maritime create client-x -e OPENAI_API_KEY=sk-...`)
45
+ .action(async (nameArg, opts) => {
41
46
  try {
42
- let name = opts.name;
47
+ let name = nameArg || opts.name;
43
48
  let templateId = opts.template;
44
49
  const interactive = !isJsonMode() && process.stdin.isTTY;
45
50
  // Interactive mode if no name given
@@ -2,23 +2,34 @@ import { Command } from 'commander';
2
2
  import chalk from 'chalk';
3
3
  import { authGet, authPost, authDelete } from '../api.js';
4
4
  import { isJsonMode, outputJson, outputResult, handleError } from '../output.js';
5
+ const VALID_SCOPES = ['provision', 'deploy', 'secrets', 'manage'];
5
6
  export const keysCommand = new Command('keys')
6
7
  .description('Manage long-lived API keys (mk_…) for non-interactive / AI-agent access');
7
8
  keysCommand
8
9
  .command('create')
9
10
  .description('Mint a new API key. Shown once — save it as MARITIME_TOKEN.')
10
11
  .option('-n, --name <name>', 'Label for the key', 'cli-agent')
12
+ .option('-s, --scopes <scopes>', `Comma-separated scopes (${VALID_SCOPES.join(', ')}); "manage" = all`, 'provision,deploy,secrets')
11
13
  .action(async (opts) => {
12
14
  try {
13
- const created = await authPost('/api/admin/api-keys', { name: opts.name });
15
+ const scopes = String(opts.scopes)
16
+ .split(',')
17
+ .map((s) => s.trim())
18
+ .filter(Boolean);
19
+ const bad = scopes.filter((s) => !VALID_SCOPES.includes(s));
20
+ if (bad.length) {
21
+ handleError(new Error(`Unknown scope(s): ${bad.join(', ')}. Valid: ${VALID_SCOPES.join(', ')}`));
22
+ return;
23
+ }
24
+ const created = await authPost('/api/v1/keys', { name: opts.name, scopes });
14
25
  outputResult(created, () => {
15
- console.log(chalk.green('Created API key ') + chalk.bold(created.name));
26
+ console.log(chalk.green('Created API key ') + chalk.bold(created.name) + chalk.dim(` [${created.scopes.join(', ')}]`));
16
27
  console.log();
17
- console.log(' ' + chalk.bold(created.key));
28
+ console.log(' ' + chalk.bold(created.raw_key));
18
29
  console.log();
19
30
  console.log(chalk.yellow(' Save this now — it will not be shown again.'));
20
31
  console.log(chalk.dim(' Use it non-interactively with:'));
21
- console.log(chalk.dim(` export MARITIME_TOKEN=${created.key}`));
32
+ console.log(chalk.dim(` export MARITIME_TOKEN=${created.raw_key}`));
22
33
  });
23
34
  }
24
35
  catch (error) {
@@ -31,7 +42,7 @@ keysCommand
31
42
  .description('List your API keys (values are never shown again)')
32
43
  .action(async () => {
33
44
  try {
34
- const keys = await authGet('/api/admin/api-keys');
45
+ const keys = await authGet('/api/v1/keys');
35
46
  if (isJsonMode()) {
36
47
  outputJson(keys);
37
48
  return;
@@ -42,18 +53,19 @@ keysCommand
42
53
  }
43
54
  console.log('\n ' +
44
55
  chalk.dim('ID'.padEnd(14)) +
45
- chalk.dim('NAME'.padEnd(24)) +
46
- chalk.dim('PREFIX'.padEnd(14)) +
56
+ chalk.dim('NAME'.padEnd(20)) +
57
+ chalk.dim('PREFIX'.padEnd(15)) +
58
+ chalk.dim('SCOPES'.padEnd(28)) +
47
59
  chalk.dim('LAST USED'));
48
- console.log(chalk.dim(' ' + '─'.repeat(64)));
60
+ console.log(chalk.dim(' ' + '─'.repeat(86)));
49
61
  for (const k of keys) {
50
- const prefix = k.prefix || k.key_prefix || '';
51
- const last = k.lastUsedAt || k.last_used_at;
62
+ const last = k.last_used_at;
52
63
  const lastStr = last ? new Date(last).toLocaleString() : chalk.dim('never');
53
64
  console.log(' ' +
54
65
  chalk.dim(String(k.id).slice(0, 12).padEnd(14)) +
55
- chalk.bold(String(k.name).slice(0, 22).padEnd(24)) +
56
- (prefix + '…').padEnd(14) +
66
+ chalk.bold(String(k.name).slice(0, 18).padEnd(20)) +
67
+ ((k.key_prefix || '') + '…').padEnd(15) +
68
+ String((k.scopes || []).join(',')).slice(0, 26).padEnd(28) +
57
69
  lastStr);
58
70
  }
59
71
  console.log();
@@ -69,7 +81,7 @@ keysCommand
69
81
  .argument('<id>', 'API key ID (from `maritime keys list`)')
70
82
  .action(async (id) => {
71
83
  try {
72
- await authDelete(`/api/admin/api-keys/${id}`);
84
+ await authDelete(`/api/v1/keys/${id}`);
73
85
  outputResult({ ok: true, action: 'revoke', id }, () => console.log(chalk.green('Revoked key ') + chalk.bold(id)));
74
86
  }
75
87
  catch (error) {
package/dist/index.js CHANGED
@@ -43,39 +43,44 @@ program
43
43
  .version(pkg.version)
44
44
  .option('--json', 'Output raw JSON instead of formatted tables')
45
45
  .option('--verbose', 'Show detailed request/response info');
46
+ // The lean surface — what shows in `maritime --help`. Everything a human or an
47
+ // AI agent needs on the happy path: authenticate, create, deploy, talk, observe.
48
+ const HIDDEN = { hidden: true };
46
49
  // Auth
47
50
  program.addCommand(loginCommand);
48
- program.addCommand(signupCommand);
49
51
  program.addCommand(logoutCommand);
50
52
  program.addCommand(whoamiCommand);
51
53
  program.addCommand(keysCommand);
52
- // Agent management
54
+ // Agent lifecycle
53
55
  program.addCommand(createCommand);
54
- program.addCommand(listCommand);
55
56
  program.addCommand(deployCommand);
56
- program.addCommand(startCommand);
57
- program.addCommand(stopCommand);
58
- program.addCommand(restartCommand);
57
+ program.addCommand(listCommand);
59
58
  program.addCommand(deleteCommand);
60
- program.addCommand(sleepCommand);
61
- program.addCommand(scaleCommand);
62
59
  // Interaction
63
60
  program.addCommand(chatCommand);
64
- program.addCommand(execCommand);
65
61
  // Observability
66
62
  program.addCommand(logsCommand);
67
- program.addCommand(envCommand);
68
63
  program.addCommand(statusCommand);
69
- program.addCommand(infoCommand);
70
- program.addCommand(historyCommand);
71
- // Triggers & blueprints
72
- program.addCommand(triggersCommand);
73
- program.addCommand(blueprintCommand);
74
- // Discovery
75
- program.addCommand(templatesCommand);
76
- // Utilities
77
- program.addCommand(openCommand);
64
+ program.addCommand(envCommand);
65
+ // Machine manifest (for agents/scripts driving the CLI)
78
66
  program.addCommand(guideCommand);
67
+ // --- Hidden: still fully functional, just off the main --help to keep the
68
+ // surface small. Lifecycle is mostly automatic (idle-sleep + auto-wake on
69
+ // chat), so these are ops/debug + power-user/reseller tools, not the happy
70
+ // path. They still work exactly as before; `maritime <cmd> --help` shows them. ---
71
+ program.addCommand(signupCommand, HIDDEN);
72
+ program.addCommand(startCommand, HIDDEN);
73
+ program.addCommand(stopCommand, HIDDEN);
74
+ program.addCommand(restartCommand, HIDDEN);
75
+ program.addCommand(sleepCommand, HIDDEN);
76
+ program.addCommand(scaleCommand, HIDDEN);
77
+ program.addCommand(execCommand, HIDDEN);
78
+ program.addCommand(infoCommand, HIDDEN);
79
+ program.addCommand(historyCommand, HIDDEN);
80
+ program.addCommand(triggersCommand, HIDDEN);
81
+ program.addCommand(blueprintCommand, HIDDEN);
82
+ program.addCommand(templatesCommand, HIDDEN);
83
+ program.addCommand(openCommand, HIDDEN);
79
84
  // Make the programmatic contract discoverable from the first thing an agent
80
85
  // runs (`maritime --help`), and point to the one-shot machine manifest.
81
86
  program.addHelpText('after', `
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maritime-cli",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Maritime CLI - Deploy and talk to AI agents from your terminal",
5
5
  "type": "module",
6
6
  "license": "MIT",