@amodalai/amodal 0.3.29 → 0.3.31
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/CHANGELOG.md +26 -0
- package/dist/src/commands/dev.d.ts.map +1 -1
- package/dist/src/commands/dev.js +24 -16
- package/dist/src/commands/dev.js.map +1 -1
- package/dist/src/main.js +0 -2
- package/dist/src/main.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/src/commands/dev.ts +22 -16
- package/src/main.ts +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amodalai/amodal",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.31",
|
|
4
4
|
"description": "Amodal CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
"react": "^19.2.4",
|
|
27
27
|
"yargs": "^17.7.2",
|
|
28
28
|
"zod": "^4.3.6",
|
|
29
|
-
"@amodalai/
|
|
30
|
-
"@amodalai/
|
|
31
|
-
"@amodalai/db": "0.3.
|
|
32
|
-
"@amodalai/runtime": "0.3.
|
|
33
|
-
"@amodalai/studio": "0.3.
|
|
34
|
-
"@amodalai/runtime-app": "0.3.
|
|
29
|
+
"@amodalai/core": "0.3.31",
|
|
30
|
+
"@amodalai/types": "0.3.31",
|
|
31
|
+
"@amodalai/db": "0.3.31",
|
|
32
|
+
"@amodalai/runtime": "0.3.31",
|
|
33
|
+
"@amodalai/studio": "0.3.31",
|
|
34
|
+
"@amodalai/runtime-app": "0.3.31"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "^20.11.24",
|
package/src/commands/dev.ts
CHANGED
|
@@ -106,8 +106,9 @@ interface ManagedProcess {
|
|
|
106
106
|
* with a label. Lines are buffered per-stream to avoid interleaved output
|
|
107
107
|
* from concurrent subprocesses.
|
|
108
108
|
*/
|
|
109
|
-
function pipeWithLabel(child: ChildProcess, label: string): void {
|
|
109
|
+
function pipeWithLabel(child: ChildProcess, label: string, opts?: {quiet?: boolean}): void {
|
|
110
110
|
const prefix = `[${label}] `;
|
|
111
|
+
const quiet = opts?.quiet ?? false;
|
|
111
112
|
for (const stream of [child.stdout, child.stderr]) {
|
|
112
113
|
if (!stream) continue;
|
|
113
114
|
let buffer = '';
|
|
@@ -115,15 +116,17 @@ function pipeWithLabel(child: ChildProcess, label: string): void {
|
|
|
115
116
|
stream.on('data', (chunk: string) => {
|
|
116
117
|
buffer += chunk;
|
|
117
118
|
const lines = buffer.split('\n');
|
|
118
|
-
// Keep the last (potentially incomplete) line in the buffer
|
|
119
119
|
buffer = lines.pop() ?? '';
|
|
120
120
|
for (const line of lines) {
|
|
121
|
+
if (quiet && !line.includes('[WARN]') && !line.includes('[ERROR]') && !line.includes('Error')) continue;
|
|
121
122
|
process.stderr.write(`${prefix}${line}\n`);
|
|
122
123
|
}
|
|
123
124
|
});
|
|
124
125
|
stream.on('end', () => {
|
|
125
126
|
if (buffer.length > 0) {
|
|
126
|
-
|
|
127
|
+
if (!quiet || buffer.includes('[WARN]') || buffer.includes('[ERROR]') || buffer.includes('Error')) {
|
|
128
|
+
process.stderr.write(`${prefix}${buffer}\n`);
|
|
129
|
+
}
|
|
127
130
|
buffer = '';
|
|
128
131
|
}
|
|
129
132
|
});
|
|
@@ -202,7 +205,7 @@ function spawnStudio(opts: {
|
|
|
202
205
|
let spawnArgs: string[];
|
|
203
206
|
|
|
204
207
|
if (existsSync(prebuiltEntry)) {
|
|
205
|
-
log.
|
|
208
|
+
log.debug('studio_prebuilt', {path: prebuiltEntry});
|
|
206
209
|
spawnArgs = [prebuiltEntry];
|
|
207
210
|
} else if (existsSync(sourceEntry)) {
|
|
208
211
|
// Resolve tsx from the studio package's dependency tree
|
|
@@ -241,7 +244,7 @@ function spawnStudio(opts: {
|
|
|
241
244
|
});
|
|
242
245
|
|
|
243
246
|
const label = 'studio';
|
|
244
|
-
pipeWithLabel(child, label);
|
|
247
|
+
pipeWithLabel(child, label, {quiet: true});
|
|
245
248
|
|
|
246
249
|
child.once('exit', (code, signal) => {
|
|
247
250
|
if (code !== null && code !== 0) {
|
|
@@ -317,7 +320,7 @@ async function spawnAdminAgent(opts: {
|
|
|
317
320
|
);
|
|
318
321
|
|
|
319
322
|
const label = 'admin';
|
|
320
|
-
pipeWithLabel(child, label);
|
|
323
|
+
pipeWithLabel(child, label, {quiet: true});
|
|
321
324
|
|
|
322
325
|
child.once('exit', (code, signal) => {
|
|
323
326
|
if (code !== null && code !== 0) {
|
|
@@ -413,7 +416,7 @@ Or add it to your agent's .env file:
|
|
|
413
416
|
const migrationDb = getDb(databaseUrl);
|
|
414
417
|
await ensureSchema(migrationDb);
|
|
415
418
|
await closeDb(); // Close migration connection — runtime and Studio open their own
|
|
416
|
-
log.
|
|
419
|
+
log.debug('schema_migration_complete', {});
|
|
417
420
|
} catch (err: unknown) {
|
|
418
421
|
const msg = err instanceof Error ? err.message : String(err);
|
|
419
422
|
log.error('schema_migration_failed', {error: msg});
|
|
@@ -436,7 +439,7 @@ Or add it to your agent's .env file:
|
|
|
436
439
|
if (!options.noStudio) await assertPortFree(studioPort);
|
|
437
440
|
if (!options.noAdmin) await assertPortFree(adminPort);
|
|
438
441
|
|
|
439
|
-
log.
|
|
442
|
+
log.debug('ports_allocated', {
|
|
440
443
|
runtime: runtimePort,
|
|
441
444
|
studio: options.noStudio ? null : studioPort,
|
|
442
445
|
admin: options.noAdmin ? null : adminPort,
|
|
@@ -481,7 +484,7 @@ Or add it to your agent's .env file:
|
|
|
481
484
|
// Start the runtime server
|
|
482
485
|
// -------------------------------------------------------------------------
|
|
483
486
|
|
|
484
|
-
|
|
487
|
+
log.debug('starting_dev_server', {repoPath});
|
|
485
488
|
|
|
486
489
|
try {
|
|
487
490
|
let staticAppDir: string | undefined;
|
|
@@ -501,7 +504,7 @@ Or add it to your agent's .env file:
|
|
|
501
504
|
|
|
502
505
|
for (const dir of candidates) {
|
|
503
506
|
if (existsSync(path.join(dir, 'index.html'))) {
|
|
504
|
-
|
|
507
|
+
log.debug('serving_prebuilt_app', {path: staticAppDir});
|
|
505
508
|
staticAppDir = dir;
|
|
506
509
|
break;
|
|
507
510
|
}
|
|
@@ -521,7 +524,7 @@ Or add it to your agent's .env file:
|
|
|
521
524
|
|
|
522
525
|
await server.start();
|
|
523
526
|
|
|
524
|
-
// Print
|
|
527
|
+
// Print clean startup summary
|
|
525
528
|
process.stderr.write('\n');
|
|
526
529
|
process.stderr.write(` Runtime: http://localhost:${String(runtimePort)}\n`);
|
|
527
530
|
if (studioUrl) {
|
|
@@ -530,9 +533,6 @@ Or add it to your agent's .env file:
|
|
|
530
533
|
if (adminAgentUrl) {
|
|
531
534
|
process.stderr.write(` Admin Agent: ${adminAgentUrl}\n`);
|
|
532
535
|
}
|
|
533
|
-
// Redact credentials from the connection string before printing.
|
|
534
|
-
// Show host + db name so the operator knows which database is in use,
|
|
535
|
-
// but never print the password portion.
|
|
536
536
|
const redactedUrl = databaseUrl.replace(
|
|
537
537
|
/\/\/([^:]+):([^@]+)@/,
|
|
538
538
|
'//$1:***@',
|
|
@@ -557,7 +557,7 @@ Or add it to your agent's .env file:
|
|
|
557
557
|
|
|
558
558
|
// Kill subprocesses first
|
|
559
559
|
if (managedProcesses.length > 0) {
|
|
560
|
-
log.
|
|
560
|
+
log.debug('subprocess_shutdown', {count: managedProcesses.length});
|
|
561
561
|
await killAll(managedProcesses);
|
|
562
562
|
}
|
|
563
563
|
|
|
@@ -632,6 +632,12 @@ export const devCommand: CommandModule = {
|
|
|
632
632
|
const noStudio = (argv['no-studio'] as boolean) || process.env['AMODAL_NO_STUDIO'] === '1';
|
|
633
633
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
634
634
|
const noAdmin = (argv['no-admin'] as boolean) || process.env['AMODAL_NO_ADMIN'] === '1';
|
|
635
|
-
|
|
635
|
+
try {
|
|
636
|
+
await runDev({port, host, resume, verbose, quiet, noStudio, noAdmin});
|
|
637
|
+
} catch (err: unknown) {
|
|
638
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
639
|
+
process.stderr.write(`\n Error: ${msg}\n\n`);
|
|
640
|
+
process.exit(1);
|
|
641
|
+
}
|
|
636
642
|
},
|
|
637
643
|
};
|
package/src/main.ts
CHANGED
|
@@ -9,9 +9,6 @@ import {readFileSync} from 'node:fs';
|
|
|
9
9
|
import yargs from 'yargs';
|
|
10
10
|
import {hideBin} from 'yargs/helpers';
|
|
11
11
|
|
|
12
|
-
// Console interception is now handled by interceptConsole() in the logger,
|
|
13
|
-
// called from dev/serve commands. The old manual hack is no longer needed.
|
|
14
|
-
|
|
15
12
|
import {amodalCommands} from './commands/index.js';
|
|
16
13
|
import {loadEnvFile} from './shared/load-env.js';
|
|
17
14
|
|