@agentuity/cli 0.0.56 → 0.0.57
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/cli.d.ts.map +1 -1
- package/dist/cli.js +41 -2
- package/dist/cli.js.map +1 -1
- package/dist/cmd/build/ast.d.ts +4 -10
- package/dist/cmd/build/ast.d.ts.map +1 -1
- package/dist/cmd/build/ast.js +9 -10
- package/dist/cmd/build/ast.js.map +1 -1
- package/dist/cmd/build/bundler.d.ts +25 -2
- package/dist/cmd/build/bundler.d.ts.map +1 -1
- package/dist/cmd/build/bundler.js +130 -38
- package/dist/cmd/build/bundler.js.map +1 -1
- package/dist/cmd/build/plugin.js +7 -7
- package/dist/cmd/build/plugin.js.map +1 -1
- package/dist/cmd/build/workbench-templates.d.ts +4 -0
- package/dist/cmd/build/workbench-templates.d.ts.map +1 -0
- package/dist/cmd/build/workbench-templates.js +49 -0
- package/dist/cmd/build/workbench-templates.js.map +1 -0
- package/dist/cmd/cloud/deploy.d.ts.map +1 -1
- package/dist/cmd/cloud/deploy.js +11 -3
- package/dist/cmd/cloud/deploy.js.map +1 -1
- package/dist/cmd/cloud/deployment/show.d.ts.map +1 -1
- package/dist/cmd/cloud/deployment/show.js +73 -20
- package/dist/cmd/cloud/deployment/show.js.map +1 -1
- package/dist/cmd/index.d.ts.map +1 -1
- package/dist/cmd/index.js +2 -0
- package/dist/cmd/index.js.map +1 -1
- package/dist/schema-generator.d.ts +1 -1
- package/dist/schema-generator.d.ts.map +1 -1
- package/dist/schema-parser.d.ts +2 -1
- package/dist/schema-parser.d.ts.map +1 -1
- package/dist/schema-parser.js +18 -2
- package/dist/schema-parser.js.map +1 -1
- package/dist/steps.d.ts +2 -1
- package/dist/steps.d.ts.map +1 -1
- package/dist/steps.js +26 -3
- package/dist/steps.js.map +1 -1
- package/dist/types.d.ts +15 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/cli.ts +49 -2
- package/src/cmd/build/ast.ts +15 -27
- package/src/cmd/build/bundler.ts +149 -37
- package/src/cmd/build/plugin.ts +8 -8
- package/src/cmd/build/workbench-templates.ts +52 -0
- package/src/cmd/cloud/deploy.ts +11 -3
- package/src/cmd/cloud/deployment/show.ts +60 -17
- package/src/cmd/index.ts +2 -0
- package/src/schema-generator.ts +1 -1
- package/src/schema-parser.ts +19 -4
- package/src/steps.ts +27 -4
package/src/schema-parser.ts
CHANGED
|
@@ -13,9 +13,10 @@ export interface ParsedArgs {
|
|
|
13
13
|
export interface ParsedOption {
|
|
14
14
|
name: string;
|
|
15
15
|
description?: string;
|
|
16
|
-
type: 'string' | 'number' | 'boolean';
|
|
16
|
+
type: 'string' | 'number' | 'boolean' | 'array';
|
|
17
17
|
hasDefault?: boolean;
|
|
18
18
|
defaultValue?: unknown;
|
|
19
|
+
enumValues?: string[];
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
interface ZodTypeDef {
|
|
@@ -167,11 +168,21 @@ export function parseOptionsSchema(schema: ZodType): ParsedOption[] {
|
|
|
167
168
|
? (defaultInfo.defaultValue as () => unknown)()
|
|
168
169
|
: defaultInfo.defaultValue;
|
|
169
170
|
|
|
170
|
-
let type: 'string' | 'number' | 'boolean' = 'string';
|
|
171
|
+
let type: 'string' | 'number' | 'boolean' | 'array' = 'string';
|
|
172
|
+
let enumValues: string[] | undefined;
|
|
171
173
|
if (typeId === 'ZodNumber' || typeId === 'number') {
|
|
172
174
|
type = 'number';
|
|
173
175
|
} else if (typeId === 'ZodBoolean' || typeId === 'boolean') {
|
|
174
176
|
type = 'boolean';
|
|
177
|
+
} else if (typeId === 'ZodArray' || typeId === 'array') {
|
|
178
|
+
type = 'array';
|
|
179
|
+
} else if (typeId === 'ZodEnum' || typeId === 'enum') {
|
|
180
|
+
// Extract enum values from Zod 4's def.entries
|
|
181
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
182
|
+
const def = (unwrapped as any)?._def;
|
|
183
|
+
if (def?.entries && typeof def.entries === 'object') {
|
|
184
|
+
enumValues = Object.values(def.entries as Record<string, string>);
|
|
185
|
+
}
|
|
175
186
|
}
|
|
176
187
|
|
|
177
188
|
options.push({
|
|
@@ -180,6 +191,7 @@ export function parseOptionsSchema(schema: ZodType): ParsedOption[] {
|
|
|
180
191
|
description,
|
|
181
192
|
hasDefault: defaultInfo.hasDefault,
|
|
182
193
|
defaultValue,
|
|
194
|
+
enumValues,
|
|
183
195
|
});
|
|
184
196
|
}
|
|
185
197
|
|
|
@@ -203,8 +215,11 @@ export function buildValidationInput(
|
|
|
203
215
|
if (schemas.options) {
|
|
204
216
|
const parsed = parseOptionsSchema(schemas.options);
|
|
205
217
|
for (const opt of parsed) {
|
|
206
|
-
//
|
|
207
|
-
|
|
218
|
+
// Only include the option if it has a value - omitting undefined allows Zod to apply defaults
|
|
219
|
+
const value = rawOptions[opt.name];
|
|
220
|
+
if (value !== undefined) {
|
|
221
|
+
result.options[opt.name] = value;
|
|
222
|
+
}
|
|
208
223
|
}
|
|
209
224
|
}
|
|
210
225
|
|
package/src/steps.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import type { ColorScheme } from './terminal';
|
|
9
9
|
import type { LogLevel } from './types';
|
|
10
|
+
import { ValidationError } from '@agentuity/server';
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Get the appropriate exit function (Bun.exit or process.exit)
|
|
@@ -108,14 +109,18 @@ function getColor(colorKey: keyof typeof COLORS): string {
|
|
|
108
109
|
export type StepOutcome =
|
|
109
110
|
| { status: 'success' }
|
|
110
111
|
| { status: 'skipped'; reason?: string }
|
|
111
|
-
| { status: 'error'; message: string };
|
|
112
|
+
| { status: 'error'; message: string; cause?: Error };
|
|
112
113
|
|
|
113
114
|
/**
|
|
114
115
|
* Helper functions for creating step outcomes
|
|
115
116
|
*/
|
|
116
117
|
export const stepSuccess = (): StepOutcome => ({ status: 'success' });
|
|
117
118
|
export const stepSkipped = (reason?: string): StepOutcome => ({ status: 'skipped', reason });
|
|
118
|
-
export const stepError = (message: string): StepOutcome => ({
|
|
119
|
+
export const stepError = (message: string, cause?: Error): StepOutcome => ({
|
|
120
|
+
status: 'error',
|
|
121
|
+
message,
|
|
122
|
+
cause,
|
|
123
|
+
});
|
|
119
124
|
|
|
120
125
|
/**
|
|
121
126
|
* Progress callback function
|
|
@@ -260,6 +265,7 @@ async function runStepsTUI(state: StepState[]): Promise<void> {
|
|
|
260
265
|
step.outcome = {
|
|
261
266
|
status: 'error',
|
|
262
267
|
message: err instanceof Error ? err.message : String(err),
|
|
268
|
+
cause: err instanceof Error ? err : undefined,
|
|
263
269
|
};
|
|
264
270
|
}
|
|
265
271
|
|
|
@@ -276,7 +282,15 @@ async function runStepsTUI(state: StepState[]): Promise<void> {
|
|
|
276
282
|
// If error, show error message and exit
|
|
277
283
|
if (step.outcome?.status === 'error') {
|
|
278
284
|
const errorColor = getColor('red');
|
|
279
|
-
console.error(`\n${errorColor}Error: ${step.outcome.message}${COLORS.reset}
|
|
285
|
+
console.error(`\n${errorColor}Error: ${step.outcome.message}${COLORS.reset}`);
|
|
286
|
+
if (step.outcome.cause instanceof ValidationError) {
|
|
287
|
+
console.error(`${errorColor}Validation details:${COLORS.reset}`);
|
|
288
|
+
for (const issue of step.outcome.cause.issues) {
|
|
289
|
+
const path = issue.path.length > 0 ? issue.path.join('.') : '(root)';
|
|
290
|
+
console.error(` ${path}: ${issue.message}`);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
console.error('');
|
|
280
294
|
process.stdout.write('\x1B[?25h'); // Show cursor
|
|
281
295
|
process.exit(1);
|
|
282
296
|
}
|
|
@@ -312,6 +326,7 @@ async function runStepsPlain(state: StepState[]): Promise<void> {
|
|
|
312
326
|
step.outcome = {
|
|
313
327
|
status: 'error',
|
|
314
328
|
message: err instanceof Error ? err.message : String(err),
|
|
329
|
+
cause: err instanceof Error ? err : undefined,
|
|
315
330
|
};
|
|
316
331
|
}
|
|
317
332
|
|
|
@@ -326,7 +341,15 @@ async function runStepsPlain(state: StepState[]): Promise<void> {
|
|
|
326
341
|
} else if (step.outcome?.status === 'error') {
|
|
327
342
|
console.log(`${redColor}${ICONS.error}${COLORS.reset} ${step.label}`);
|
|
328
343
|
const errorColor = getColor('red');
|
|
329
|
-
console.error(`\n${errorColor}Error: ${step.outcome.message}${COLORS.reset}
|
|
344
|
+
console.error(`\n${errorColor}Error: ${step.outcome.message}${COLORS.reset}`);
|
|
345
|
+
if (step.outcome.cause instanceof ValidationError) {
|
|
346
|
+
console.error(`${errorColor}Validation details:${COLORS.reset}`);
|
|
347
|
+
for (const issue of step.outcome.cause.issues) {
|
|
348
|
+
const path = issue.path.length > 0 ? issue.path.join('.') : '(root)';
|
|
349
|
+
console.error(` ${path}: ${issue.message}`);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
console.error('');
|
|
330
353
|
process.exit(1);
|
|
331
354
|
}
|
|
332
355
|
}
|