maritime-cli 0.1.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/dist/commands/deploy.d.ts +2 -0
- package/dist/commands/deploy.js +38 -0
- package/dist/commands/env.d.ts +2 -0
- package/dist/commands/env.js +37 -0
- package/dist/commands/login.d.ts +2 -0
- package/dist/commands/login.js +20 -0
- package/dist/commands/logs.d.ts +2 -0
- package/dist/commands/logs.js +41 -0
- package/dist/commands/status.d.ts +2 -0
- package/dist/commands/status.js +35 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +19 -0
- package/package.json +33 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import ora from 'ora';
|
|
4
|
+
import { readFileSync, existsSync } from 'fs';
|
|
5
|
+
export const deployCommand = new Command('deploy')
|
|
6
|
+
.description('Deploy an agent from maritime.toml')
|
|
7
|
+
.option('-c, --config <path>', 'Path to maritime.toml', './maritime.toml')
|
|
8
|
+
.option('--force', 'Force redeploy')
|
|
9
|
+
.option('--no-wait', 'Do not wait for deployment to complete')
|
|
10
|
+
.action(async (opts) => {
|
|
11
|
+
// Check for config file
|
|
12
|
+
if (!existsSync(opts.config)) {
|
|
13
|
+
console.log(chalk.red('Error:') + ` ${opts.config} not found`);
|
|
14
|
+
console.log(chalk.dim('Run `maritime init` to create one, or specify --config'));
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
const configContent = readFileSync(opts.config, 'utf-8');
|
|
18
|
+
// Simple TOML parsing for name and framework
|
|
19
|
+
const nameMatch = configContent.match(/name\s*=\s*"([^"]+)"/);
|
|
20
|
+
const frameworkMatch = configContent.match(/framework\s*=\s*"([^"]+)"/);
|
|
21
|
+
const tierMatch = configContent.match(/tier\s*=\s*"([^"]+)"/);
|
|
22
|
+
const name = nameMatch?.[1] || 'unnamed-agent';
|
|
23
|
+
const framework = frameworkMatch?.[1] || 'custom';
|
|
24
|
+
const tier = tierMatch?.[1] || 'smart';
|
|
25
|
+
const tierPrice = { smart: '$1/mo', extended: '$5/mo', always_on: '$10/mo' };
|
|
26
|
+
console.log(chalk.hex('#8B5CF6')('\n Maritime') + chalk.dim(' Deploy\n'));
|
|
27
|
+
const spinner = ora(`Deploying ${chalk.bold(name)} (${framework})...`).start();
|
|
28
|
+
// Simulate deployment steps
|
|
29
|
+
await new Promise((r) => setTimeout(r, 1000));
|
|
30
|
+
spinner.text = 'Building container...';
|
|
31
|
+
await new Promise((r) => setTimeout(r, 1500));
|
|
32
|
+
spinner.text = 'Pushing image...';
|
|
33
|
+
await new Promise((r) => setTimeout(r, 1000));
|
|
34
|
+
spinner.text = 'Starting agent...';
|
|
35
|
+
await new Promise((r) => setTimeout(r, 800));
|
|
36
|
+
spinner.succeed(chalk.green('Agent deployed at ') + chalk.bold(`maritime.sh/${name}`));
|
|
37
|
+
console.log(chalk.dim(` Tier: ${tier} (${tierPrice[tier] || '$1/mo'}) | Status: sleeping\n`));
|
|
38
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import ora from 'ora';
|
|
4
|
+
export const envCommand = new Command('env')
|
|
5
|
+
.description('Manage environment variables');
|
|
6
|
+
envCommand
|
|
7
|
+
.command('set <agent> <pair>')
|
|
8
|
+
.description('Set an environment variable (KEY=value)')
|
|
9
|
+
.action(async (agent, pair) => {
|
|
10
|
+
const [key, ...valueParts] = pair.split('=');
|
|
11
|
+
const value = valueParts.join('=');
|
|
12
|
+
if (!key || !value) {
|
|
13
|
+
console.log(chalk.red('Error:') + ' Format must be KEY=value');
|
|
14
|
+
process.exit(1);
|
|
15
|
+
}
|
|
16
|
+
const spinner = ora(`Setting ${key} for ${agent}...`).start();
|
|
17
|
+
await new Promise((r) => setTimeout(r, 800));
|
|
18
|
+
spinner.succeed(`Set ${chalk.bold(key)} for ${chalk.bold(agent)}`);
|
|
19
|
+
});
|
|
20
|
+
envCommand
|
|
21
|
+
.command('list <agent>')
|
|
22
|
+
.description('List environment variables')
|
|
23
|
+
.action(async (agent) => {
|
|
24
|
+
console.log(chalk.dim(`\nEnvironment variables for ${chalk.bold(agent)}:\n`));
|
|
25
|
+
console.log(` ${chalk.bold('OPENAI_API_KEY')} = ${chalk.dim('••••••••')}`);
|
|
26
|
+
console.log(` ${chalk.bold('WEBHOOK_URL')} = https://hooks.slack.com/...`);
|
|
27
|
+
console.log(` ${chalk.bold('MAX_TOKENS')} = 4096`);
|
|
28
|
+
console.log();
|
|
29
|
+
});
|
|
30
|
+
envCommand
|
|
31
|
+
.command('remove <agent> <key>')
|
|
32
|
+
.description('Remove an environment variable')
|
|
33
|
+
.action(async (agent, key) => {
|
|
34
|
+
const spinner = ora(`Removing ${key} from ${agent}...`).start();
|
|
35
|
+
await new Promise((r) => setTimeout(r, 600));
|
|
36
|
+
spinner.succeed(`Removed ${chalk.bold(key)} from ${chalk.bold(agent)}`);
|
|
37
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import ora from 'ora';
|
|
4
|
+
import Conf from 'conf';
|
|
5
|
+
const config = new Conf({ projectName: 'maritime' });
|
|
6
|
+
export const loginCommand = new Command('login')
|
|
7
|
+
.description('Authenticate with Maritime via GitHub')
|
|
8
|
+
.action(async () => {
|
|
9
|
+
const spinner = ora('Opening browser for authentication...').start();
|
|
10
|
+
// In production, this would open a browser for OAuth
|
|
11
|
+
await new Promise((resolve) => setTimeout(resolve, 1500));
|
|
12
|
+
spinner.succeed('Browser opened');
|
|
13
|
+
const waitSpinner = ora('Waiting for authentication...').start();
|
|
14
|
+
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
15
|
+
// Simulate successful auth
|
|
16
|
+
config.set('token', 'maritime_demo_token');
|
|
17
|
+
config.set('user', 'developer@example.com');
|
|
18
|
+
waitSpinner.succeed(chalk.green('Authenticated as ') + chalk.bold('developer@example.com'));
|
|
19
|
+
console.log(chalk.dim('\nToken saved. You can now deploy agents.'));
|
|
20
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
const levelColors = {
|
|
4
|
+
info: chalk.blue,
|
|
5
|
+
warn: chalk.yellow,
|
|
6
|
+
error: chalk.red,
|
|
7
|
+
debug: chalk.gray,
|
|
8
|
+
};
|
|
9
|
+
export const logsCommand = new Command('logs')
|
|
10
|
+
.description('Stream logs from an agent')
|
|
11
|
+
.argument('<agent>', 'Agent name')
|
|
12
|
+
.option('-f, --follow', 'Follow log output')
|
|
13
|
+
.option('-n, --lines <num>', 'Number of lines', '20')
|
|
14
|
+
.option('--level <level>', 'Filter by level')
|
|
15
|
+
.action(async (agent, opts) => {
|
|
16
|
+
console.log(chalk.dim(`Streaming logs for ${chalk.bold(agent)}...\n`));
|
|
17
|
+
const mockLogs = [
|
|
18
|
+
{ time: '14:32:01', level: 'info', msg: 'Agent started successfully' },
|
|
19
|
+
{ time: '14:32:02', level: 'info', msg: 'Received webhook invocation from /api/support' },
|
|
20
|
+
{ time: '14:32:03', level: 'debug', msg: 'Processing ticket #4521 - category: billing' },
|
|
21
|
+
{ time: '14:32:04', level: 'info', msg: 'Generated response (342 tokens)' },
|
|
22
|
+
{ time: '14:32:05', level: 'warn', msg: 'Rate limit approaching: 847/1000 invocations' },
|
|
23
|
+
{ time: '14:32:08', level: 'error', msg: 'Failed to connect to external API: timeout' },
|
|
24
|
+
{ time: '14:32:09', level: 'info', msg: 'Retrying API connection (attempt 2/3)' },
|
|
25
|
+
{ time: '14:32:10', level: 'info', msg: 'API connection restored' },
|
|
26
|
+
];
|
|
27
|
+
const filtered = opts.level
|
|
28
|
+
? mockLogs.filter((l) => l.level === opts.level)
|
|
29
|
+
: mockLogs;
|
|
30
|
+
for (const log of filtered) {
|
|
31
|
+
const colorFn = levelColors[log.level] || chalk.white;
|
|
32
|
+
const levelStr = colorFn(log.level.toUpperCase().padEnd(5));
|
|
33
|
+
console.log(`${chalk.dim(log.time)} ${levelStr} ${log.msg}`);
|
|
34
|
+
if (opts.follow) {
|
|
35
|
+
await new Promise((r) => setTimeout(r, 300));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (opts.follow) {
|
|
39
|
+
console.log(chalk.dim('\nWaiting for new logs... (Ctrl+C to exit)'));
|
|
40
|
+
}
|
|
41
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
export const statusCommand = new Command('status')
|
|
4
|
+
.description('Check agent status')
|
|
5
|
+
.argument('[agent]', 'Agent name (optional)')
|
|
6
|
+
.action(async (agent) => {
|
|
7
|
+
console.log(chalk.hex('#8B5CF6')('\n Maritime') + chalk.dim(' Status\n'));
|
|
8
|
+
const agents = [
|
|
9
|
+
{ name: 'support-bot', status: 'active', tier: 'smart', invocations: '847' },
|
|
10
|
+
{ name: 'data-pipeline', status: 'sleeping', tier: 'extended', invocations: '3,421' },
|
|
11
|
+
{ name: 'code-reviewer', status: 'sleeping', tier: 'extended', invocations: '1,205' },
|
|
12
|
+
{ name: 'slack-assistant', status: 'active', tier: 'always_on', invocations: '12,847' },
|
|
13
|
+
];
|
|
14
|
+
const filtered = agent ? agents.filter((a) => a.name === agent) : agents;
|
|
15
|
+
if (filtered.length === 0) {
|
|
16
|
+
console.log(chalk.yellow('No agents found'));
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
// Table header
|
|
20
|
+
console.log(' ' +
|
|
21
|
+
chalk.dim('NAME'.padEnd(20)) +
|
|
22
|
+
chalk.dim('STATUS'.padEnd(12)) +
|
|
23
|
+
chalk.dim('TIER'.padEnd(12)) +
|
|
24
|
+
chalk.dim('INVOCATIONS'));
|
|
25
|
+
console.log(chalk.dim(' ' + '─'.repeat(56)));
|
|
26
|
+
for (const a of filtered) {
|
|
27
|
+
const statusColor = a.status === 'active' ? chalk.green : a.status === 'error' ? chalk.red : chalk.blue;
|
|
28
|
+
console.log(' ' +
|
|
29
|
+
chalk.bold(a.name.padEnd(20)) +
|
|
30
|
+
statusColor(a.status.padEnd(12)) +
|
|
31
|
+
a.tier.padEnd(12) +
|
|
32
|
+
a.invocations);
|
|
33
|
+
}
|
|
34
|
+
console.log();
|
|
35
|
+
});
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import { loginCommand } from './commands/login.js';
|
|
5
|
+
import { deployCommand } from './commands/deploy.js';
|
|
6
|
+
import { logsCommand } from './commands/logs.js';
|
|
7
|
+
import { envCommand } from './commands/env.js';
|
|
8
|
+
import { statusCommand } from './commands/status.js';
|
|
9
|
+
const program = new Command();
|
|
10
|
+
program
|
|
11
|
+
.name('maritime')
|
|
12
|
+
.description(chalk.hex('#8B5CF6')('Maritime') + ' — Deploy AI agents for $1/month')
|
|
13
|
+
.version('0.1.0');
|
|
14
|
+
program.addCommand(loginCommand);
|
|
15
|
+
program.addCommand(deployCommand);
|
|
16
|
+
program.addCommand(logsCommand);
|
|
17
|
+
program.addCommand(envCommand);
|
|
18
|
+
program.addCommand(statusCommand);
|
|
19
|
+
program.parse();
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "maritime-cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Maritime CLI - Deploy AI agents from your terminal",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "mariagorskikh",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/mariagorskikh/maritime"
|
|
11
|
+
},
|
|
12
|
+
"keywords": ["ai", "agents", "deploy", "cli", "maritime"],
|
|
13
|
+
"bin": {
|
|
14
|
+
"maritime": "./dist/index.js"
|
|
15
|
+
},
|
|
16
|
+
"files": ["dist"],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc",
|
|
19
|
+
"dev": "tsx src/index.ts",
|
|
20
|
+
"prepublishOnly": "tsc"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"chalk": "^5.3.0",
|
|
24
|
+
"commander": "^12.0.0",
|
|
25
|
+
"conf": "^12.0.0",
|
|
26
|
+
"ora": "^8.0.0"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@types/node": "^20.0.0",
|
|
30
|
+
"tsx": "^4.0.0",
|
|
31
|
+
"typescript": "^5.0.0"
|
|
32
|
+
}
|
|
33
|
+
}
|