@output.ai/cli 0.5.3 → 0.5.4
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,6 +1,7 @@
|
|
|
1
1
|
import { Command, Flags } from '@oclif/core';
|
|
2
2
|
import fs from 'node:fs/promises';
|
|
3
3
|
import path from 'node:path';
|
|
4
|
+
import logUpdate from 'log-update';
|
|
4
5
|
import { validateDockerEnvironment, startDockerCompose, stopDockerCompose, getServiceStatus, DockerComposeConfigNotFoundError, getDefaultDockerComposePath, SERVICE_HEALTH, SERVICE_STATE } from '#services/docker.js';
|
|
5
6
|
import { getErrorMessage } from '#utils/error_utils.js';
|
|
6
7
|
import { getDevSuccessMessage } from '#services/messages.js';
|
|
@@ -109,7 +110,6 @@ export default class Dev extends Command {
|
|
|
109
110
|
}
|
|
110
111
|
}
|
|
111
112
|
async pollServiceStatus(dockerComposePath) {
|
|
112
|
-
const state = { lastLineCount: 0 };
|
|
113
113
|
const outputServiceStatus = async () => {
|
|
114
114
|
try {
|
|
115
115
|
const services = await getServiceStatus(dockerComposePath);
|
|
@@ -122,11 +122,7 @@ export default class Dev extends Command {
|
|
|
122
122
|
'',
|
|
123
123
|
`${ANSI.DIM}Press Ctrl+C to stop services${ANSI.RESET}`
|
|
124
124
|
];
|
|
125
|
-
|
|
126
|
-
process.stdout.write(`\x1b[${state.lastLineCount}A\x1b[J`);
|
|
127
|
-
}
|
|
128
|
-
process.stdout.write(lines.join('\n') + '\n');
|
|
129
|
-
state.lastLineCount = lines.length;
|
|
125
|
+
logUpdate(lines.join('\n'));
|
|
130
126
|
}
|
|
131
127
|
catch {
|
|
132
128
|
// silent retry on next poll
|
package/dist/services/docker.js
CHANGED
|
@@ -2,6 +2,7 @@ import { execFileSync, execSync, spawn } from 'node:child_process';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
4
|
import { ux } from '@oclif/core';
|
|
5
|
+
import logUpdate from 'log-update';
|
|
5
6
|
const DEFAULT_COMPOSE_PATH = '../assets/docker/docker-compose-dev.yml';
|
|
6
7
|
export const SERVICE_HEALTH = {
|
|
7
8
|
HEALTHY: 'healthy',
|
|
@@ -108,16 +109,16 @@ export async function waitForServicesHealthy(dockerComposePath, timeoutMs = 1200
|
|
|
108
109
|
const services = await getServiceStatus(dockerComposePath);
|
|
109
110
|
const allHealthy = services.every(s => s.health === SERVICE_HEALTH.HEALTHY || s.health === SERVICE_HEALTH.NONE);
|
|
110
111
|
if (services.length > 0) {
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
ux.stdout('⏳ Waiting for services to become healthy...\n');
|
|
114
|
-
ux.stdout(formatServiceStatus(services) + '\n');
|
|
112
|
+
const statusLines = formatServiceStatus(services);
|
|
113
|
+
logUpdate(`⏳ Waiting for services to become healthy...\n${statusLines}`);
|
|
115
114
|
}
|
|
116
115
|
if (allHealthy && services.length > 0) {
|
|
116
|
+
logUpdate.done();
|
|
117
117
|
return;
|
|
118
118
|
}
|
|
119
119
|
await new Promise(resolve => setTimeout(resolve, pollIntervalMs));
|
|
120
120
|
}
|
|
121
|
+
logUpdate.done();
|
|
121
122
|
throw new Error('Timeout waiting for services to become healthy');
|
|
122
123
|
}
|
|
123
124
|
export async function startDockerCompose(dockerComposePath, enableWatch = false) {
|
|
@@ -6,6 +6,11 @@ vi.mock('node:child_process', () => ({
|
|
|
6
6
|
execFileSync: vi.fn(),
|
|
7
7
|
spawn: vi.fn()
|
|
8
8
|
}));
|
|
9
|
+
vi.mock('log-update', () => {
|
|
10
|
+
const fn = vi.fn();
|
|
11
|
+
fn.done = vi.fn();
|
|
12
|
+
return { default: fn };
|
|
13
|
+
});
|
|
9
14
|
describe('docker service', () => {
|
|
10
15
|
beforeEach(() => {
|
|
11
16
|
vi.clearAllMocks();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@output.ai/cli",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"description": "CLI for Output.ai workflow generation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"handlebars": "4.7.8",
|
|
36
36
|
"json-schema-library": "10.3.0",
|
|
37
37
|
"ky": "1.12.0",
|
|
38
|
+
"log-update": "7.0.2",
|
|
38
39
|
"validator": "13.15.22"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|