@amodalai/amodal 0.1.23 → 0.1.25
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 +18 -0
- package/dist/src/commands/dev.d.ts +2 -0
- package/dist/src/commands/dev.d.ts.map +1 -1
- package/dist/src/commands/dev.js +20 -2
- package/dist/src/commands/dev.js.map +1 -1
- package/dist/src/commands/serve.d.ts +2 -0
- package/dist/src/commands/serve.d.ts.map +1 -1
- package/dist/src/commands/serve.js +19 -1
- package/dist/src/commands/serve.js.map +1 -1
- package/dist/src/main.js +2 -9
- package/dist/src/main.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/commands/dev.ts +23 -2
- package/src/commands/serve.ts +22 -1
- package/src/main.ts +2 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amodalai/amodal",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.25",
|
|
4
4
|
"description": "Amodal CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"semver": "^7.6.0",
|
|
31
31
|
"yargs": "^17.7.2",
|
|
32
32
|
"zod": "^4.3.6",
|
|
33
|
-
"@amodalai/core": "0.1.
|
|
34
|
-
"@amodalai/runtime": "0.1.
|
|
35
|
-
"@amodalai/runtime-app": "0.1.
|
|
33
|
+
"@amodalai/core": "0.1.25",
|
|
34
|
+
"@amodalai/runtime": "0.1.25",
|
|
35
|
+
"@amodalai/runtime-app": "0.1.25"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/node": "^20.11.24",
|
package/src/commands/dev.ts
CHANGED
|
@@ -9,7 +9,7 @@ import {existsSync, readFileSync} from 'node:fs';
|
|
|
9
9
|
import {createRequire} from 'node:module';
|
|
10
10
|
import path from 'node:path';
|
|
11
11
|
import {fileURLToPath} from 'node:url';
|
|
12
|
-
import {createLocalServer} from '@amodalai/runtime';
|
|
12
|
+
import {createLocalServer, initLogLevel, interceptConsole} from '@amodalai/runtime';
|
|
13
13
|
import {findRepoRoot} from '../shared/repo-discovery.js';
|
|
14
14
|
import {runConnectionPreflight, printPreflightTable} from '../shared/connection-preflight.js';
|
|
15
15
|
|
|
@@ -18,6 +18,8 @@ export interface DevOptions {
|
|
|
18
18
|
port?: number;
|
|
19
19
|
host?: string;
|
|
20
20
|
resume?: string;
|
|
21
|
+
verbose?: number;
|
|
22
|
+
quiet?: boolean;
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
const DEFAULT_PORT = 3847;
|
|
@@ -26,6 +28,9 @@ const DEFAULT_PORT = 3847;
|
|
|
26
28
|
* Starts a local development server for the repo with hot reload enabled.
|
|
27
29
|
*/
|
|
28
30
|
export async function runDev(options: DevOptions = {}): Promise<void> {
|
|
31
|
+
initLogLevel({verbosity: options.verbose ?? 0, quiet: options.quiet ?? false});
|
|
32
|
+
interceptConsole();
|
|
33
|
+
|
|
29
34
|
let repoPath: string;
|
|
30
35
|
try {
|
|
31
36
|
repoPath = findRepoRoot(options.cwd);
|
|
@@ -136,6 +141,18 @@ export const devCommand: CommandModule = {
|
|
|
136
141
|
type: 'string',
|
|
137
142
|
describe: 'Resume a previous session by ID or "latest"',
|
|
138
143
|
},
|
|
144
|
+
verbose: {
|
|
145
|
+
alias: 'v',
|
|
146
|
+
type: 'count',
|
|
147
|
+
describe: 'Increase log verbosity (-v debug, -vv trace)',
|
|
148
|
+
default: 0,
|
|
149
|
+
},
|
|
150
|
+
quiet: {
|
|
151
|
+
alias: 'q',
|
|
152
|
+
type: 'boolean',
|
|
153
|
+
describe: 'Only show errors',
|
|
154
|
+
default: false,
|
|
155
|
+
},
|
|
139
156
|
},
|
|
140
157
|
handler: async (argv) => {
|
|
141
158
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
@@ -144,6 +161,10 @@ export const devCommand: CommandModule = {
|
|
|
144
161
|
const host = argv['host'] as string | undefined;
|
|
145
162
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
146
163
|
const resume = argv['resume'] as string | undefined;
|
|
147
|
-
|
|
164
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
165
|
+
const verbose = argv['verbose'] as number;
|
|
166
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
167
|
+
const quiet = argv['quiet'] as boolean;
|
|
168
|
+
await runDev({port, host, resume, verbose, quiet});
|
|
148
169
|
},
|
|
149
170
|
};
|
package/src/commands/serve.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import type {CommandModule} from 'yargs';
|
|
8
8
|
import {loadSnapshotFromFile, snapshotToBundle} from '@amodalai/core';
|
|
9
9
|
import type {AgentBundle} from '@amodalai/core';
|
|
10
|
-
import {createLocalServer} from '@amodalai/runtime';
|
|
10
|
+
import {createLocalServer, initLogLevel, interceptConsole} from '@amodalai/runtime';
|
|
11
11
|
import {PlatformClient} from '../shared/platform-client.js';
|
|
12
12
|
|
|
13
13
|
export interface ServeOptions {
|
|
@@ -17,6 +17,8 @@ export interface ServeOptions {
|
|
|
17
17
|
env?: string;
|
|
18
18
|
port?: number;
|
|
19
19
|
host?: string;
|
|
20
|
+
verbose?: number;
|
|
21
|
+
quiet?: boolean;
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
const DEFAULT_PORT = 3847;
|
|
@@ -73,6 +75,9 @@ async function loadFromSource(options: ServeOptions): Promise<AgentBundle | null
|
|
|
73
75
|
* Returns the loaded repo, or exits with error.
|
|
74
76
|
*/
|
|
75
77
|
export async function runServe(options: ServeOptions): Promise<AgentBundle | null> {
|
|
78
|
+
initLogLevel({verbosity: options.verbose ?? 0, quiet: options.quiet ?? false});
|
|
79
|
+
interceptConsole();
|
|
80
|
+
|
|
76
81
|
const repo = await loadFromSource(options);
|
|
77
82
|
if (!repo) return null;
|
|
78
83
|
|
|
@@ -142,6 +147,18 @@ export const serveCommand: CommandModule = {
|
|
|
142
147
|
.option('host', {
|
|
143
148
|
type: 'string',
|
|
144
149
|
describe: 'Host to bind to (default: 0.0.0.0)',
|
|
150
|
+
})
|
|
151
|
+
.option('verbose', {
|
|
152
|
+
alias: 'v',
|
|
153
|
+
type: 'count',
|
|
154
|
+
describe: 'Increase log verbosity (-v debug, -vv trace)',
|
|
155
|
+
default: 0,
|
|
156
|
+
})
|
|
157
|
+
.option('quiet', {
|
|
158
|
+
alias: 'q',
|
|
159
|
+
type: 'boolean',
|
|
160
|
+
describe: 'Only show errors',
|
|
161
|
+
default: false,
|
|
145
162
|
}),
|
|
146
163
|
handler: async (argv) => {
|
|
147
164
|
const repo = await runServe({
|
|
@@ -157,6 +174,10 @@ export const serveCommand: CommandModule = {
|
|
|
157
174
|
port: argv['port'] as number | undefined,
|
|
158
175
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
159
176
|
host: argv['host'] as string | undefined,
|
|
177
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
178
|
+
verbose: argv['verbose'] as number,
|
|
179
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
180
|
+
quiet: argv['quiet'] as boolean,
|
|
160
181
|
});
|
|
161
182
|
if (!repo) {
|
|
162
183
|
process.exit(1);
|
package/src/main.ts
CHANGED
|
@@ -9,14 +9,8 @@ import {readFileSync} from 'node:fs';
|
|
|
9
9
|
import yargs from 'yargs';
|
|
10
10
|
import {hideBin} from 'yargs/helpers';
|
|
11
11
|
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
// be overwritten" stack trace on every startup. Not actionable on our side.
|
|
15
|
-
const origError = console.error; // eslint-disable-line no-console
|
|
16
|
-
console.error = (...args: unknown[]) => { // eslint-disable-line no-console
|
|
17
|
-
if (typeof args[0] === 'string' && args[0].includes('Current logger will')) return;
|
|
18
|
-
origError.apply(console, args);
|
|
19
|
-
};
|
|
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.
|
|
20
14
|
|
|
21
15
|
import {amodalCommands} from './commands/index.js';
|
|
22
16
|
import {loadEnvFile} from './shared/load-env.js';
|