maritime-cli 1.5.0 → 1.5.1
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.
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
|
-
import ora from 'ora';
|
|
4
3
|
import { authGet, authPost } from '../api.js';
|
|
5
4
|
import { resolveAgent } from '../resolve.js';
|
|
6
|
-
import { isJsonMode, outputJson, handleError } from '../output.js';
|
|
5
|
+
import { isJsonMode, outputJson, handleError, makeSpinner } from '../output.js';
|
|
7
6
|
const blueprintListCmd = new Command('list')
|
|
8
7
|
.description('List your blueprints')
|
|
9
8
|
.action(async () => {
|
|
@@ -44,7 +43,7 @@ const blueprintCreateCmd = new Command('create')
|
|
|
44
43
|
.action(async (agentArg, opts) => {
|
|
45
44
|
try {
|
|
46
45
|
const agent = await resolveAgent(agentArg);
|
|
47
|
-
const spinner =
|
|
46
|
+
const spinner = await makeSpinner('Creating blueprint...');
|
|
48
47
|
const blueprint = await authPost('/api/blueprints', {
|
|
49
48
|
agentId: agent.id,
|
|
50
49
|
name: opts.name || agent.name,
|
|
@@ -68,7 +67,7 @@ const blueprintDeployCmd = new Command('deploy')
|
|
|
68
67
|
.option('--name <name>', 'Name for the new agent')
|
|
69
68
|
.action(async (slug, opts) => {
|
|
70
69
|
try {
|
|
71
|
-
const spinner =
|
|
70
|
+
const spinner = await makeSpinner('Deploying from blueprint...');
|
|
72
71
|
const body = {};
|
|
73
72
|
if (opts.name)
|
|
74
73
|
body.name = opts.name;
|
package/dist/commands/deploy.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
|
-
import ora from 'ora';
|
|
4
3
|
import { authPost, authPut } from '../api.js';
|
|
5
4
|
import { resolveAgent } from '../resolve.js';
|
|
6
5
|
import { getConfig, getLinkedAgentId, writeLink } from '../context.js';
|
|
7
|
-
import { isJsonMode, outputJson, fail, handleError, EXIT } from '../output.js';
|
|
6
|
+
import { isJsonMode, outputJson, fail, handleError, makeSpinner, EXIT } from '../output.js';
|
|
8
7
|
import { connectWs } from '../websocket.js';
|
|
9
8
|
export const deployCommand = new Command('deploy')
|
|
10
9
|
.description('Deploy this directory: reconcile the agent to maritime.json, then ship it')
|
|
@@ -59,7 +58,9 @@ Explicit sources still work: \`maritime deploy --source github --repo <url>\`.`)
|
|
|
59
58
|
body.imageName = opts.image;
|
|
60
59
|
if (opts.branch)
|
|
61
60
|
body.branch = opts.branch;
|
|
62
|
-
|
|
61
|
+
// makeSpinner (not raw ora): degrades to static lines on 0-width PTYs —
|
|
62
|
+
// raw ora write-storms there (the create/chat bug fixed in 1.5.0).
|
|
63
|
+
const spinner = isJsonMode() ? null : await makeSpinner(`Deploying ${chalk.bold(agent.name)}...`);
|
|
63
64
|
try {
|
|
64
65
|
const deployment = await authPost('/api/deploy', body);
|
|
65
66
|
if (!opts.wait) {
|
package/dist/commands/login.js
CHANGED
|
@@ -2,10 +2,10 @@ import http from 'node:http';
|
|
|
2
2
|
import crypto from 'node:crypto';
|
|
3
3
|
import { Command } from 'commander';
|
|
4
4
|
import chalk from 'chalk';
|
|
5
|
-
import ora from 'ora';
|
|
6
5
|
import open from 'open';
|
|
7
6
|
import { config } from '../config.js';
|
|
8
7
|
import { CliHttpError, getApiUrl, postJson } from '../api.js';
|
|
8
|
+
import { makeSpinner } from '../output.js';
|
|
9
9
|
import { promptForPassword, promptForValue } from '../prompt.js';
|
|
10
10
|
const APP_URL = process.env.MARITIME_APP_URL || 'https://maritime.sh';
|
|
11
11
|
const TIMEOUT_MS = 120_000;
|
|
@@ -115,7 +115,7 @@ export const loginCommand = new Command('login')
|
|
|
115
115
|
console.log(chalk.red('Error:') + ' email and password are required');
|
|
116
116
|
process.exit(1);
|
|
117
117
|
}
|
|
118
|
-
const spinner =
|
|
118
|
+
const spinner = await makeSpinner('Authenticating...');
|
|
119
119
|
try {
|
|
120
120
|
const auth = await postJson('/api/auth/cli-login', {
|
|
121
121
|
email,
|
|
@@ -152,7 +152,7 @@ export const loginCommand = new Command('login')
|
|
|
152
152
|
return;
|
|
153
153
|
}
|
|
154
154
|
// 3. Default: browser-based login.
|
|
155
|
-
const spinner =
|
|
155
|
+
const spinner = await makeSpinner('Opening browser for authentication...');
|
|
156
156
|
try {
|
|
157
157
|
const token = await browserLogin();
|
|
158
158
|
const payload = decodeJwt(token);
|
package/dist/commands/signup.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
|
-
import ora from 'ora';
|
|
4
3
|
import { config } from '../config.js';
|
|
5
4
|
import { CliHttpError, postJson } from '../api.js';
|
|
5
|
+
import { makeSpinner } from '../output.js';
|
|
6
6
|
import { promptForPassword, promptForValue } from '../prompt.js';
|
|
7
7
|
export const signupCommand = new Command('signup')
|
|
8
8
|
.description('Create a Maritime account with email and password')
|
|
@@ -17,7 +17,7 @@ export const signupCommand = new Command('signup')
|
|
|
17
17
|
console.log(chalk.red('Error:') + ' email and password are required');
|
|
18
18
|
process.exit(1);
|
|
19
19
|
}
|
|
20
|
-
const spinner =
|
|
20
|
+
const spinner = await makeSpinner('Creating account...');
|
|
21
21
|
try {
|
|
22
22
|
const auth = await postJson('/api/auth/cli-signup', {
|
|
23
23
|
email,
|
package/dist/commands/sleep.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
|
-
import ora from 'ora';
|
|
4
3
|
import { authPost } from '../api.js';
|
|
5
4
|
import { resolveAgent } from '../resolve.js';
|
|
6
|
-
import { isJsonMode, outputJson, handleError } from '../output.js';
|
|
5
|
+
import { isJsonMode, outputJson, handleError, makeSpinner } from '../output.js';
|
|
7
6
|
export const sleepCommand = new Command('sleep')
|
|
8
7
|
.description('Put an agent to sleep')
|
|
9
8
|
.argument('[agent]', 'Agent name or ID (defaults to the linked agent)')
|
|
10
9
|
.action(async (agentArg) => {
|
|
11
10
|
try {
|
|
12
11
|
const agent = await resolveAgent(agentArg);
|
|
13
|
-
const spinner =
|
|
12
|
+
const spinner = await makeSpinner(`Sleeping ${chalk.bold(agent.name)}...`);
|
|
14
13
|
const result = await authPost(`/api/agents/${agent.id}/sleep`);
|
|
15
14
|
spinner.succeed(chalk.green('Agent is now sleeping: ') + chalk.bold(agent.name));
|
|
16
15
|
if (isJsonMode()) {
|
package/dist/output.d.ts
CHANGED
|
@@ -53,6 +53,8 @@ export declare function handleError(error: unknown): never;
|
|
|
53
53
|
* corrupt machine output. Lazily loads `ora` only when actually needed.
|
|
54
54
|
*/
|
|
55
55
|
export interface Spinner {
|
|
56
|
+
/** Live status line (mirrors ora's `.text`); ignored in degraded modes. */
|
|
57
|
+
text?: string;
|
|
56
58
|
succeed(text?: string): void;
|
|
57
59
|
fail(text?: string): void;
|
|
58
60
|
stop(): void;
|
package/dist/output.js
CHANGED
|
@@ -131,6 +131,10 @@ export async function makeSpinner(text) {
|
|
|
131
131
|
// process alive after the command finishes. We never need it.
|
|
132
132
|
const spinner = ora({ text, stream: process.stderr, discardStdin: false }).start();
|
|
133
133
|
return {
|
|
134
|
+
set text(t) {
|
|
135
|
+
if (t !== undefined)
|
|
136
|
+
spinner.text = t;
|
|
137
|
+
},
|
|
134
138
|
succeed: (t) => spinner.succeed(t),
|
|
135
139
|
fail: (t) => spinner.fail(t),
|
|
136
140
|
stop: () => spinner.stop(),
|