@agentuity/cli 0.0.41 → 0.0.43
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/bin/cli.ts +7 -5
- package/dist/banner.d.ts.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cmd/auth/index.d.ts.map +1 -1
- package/dist/cmd/auth/login.d.ts.map +1 -1
- package/dist/cmd/auth/whoami.d.ts +2 -0
- package/dist/cmd/auth/whoami.d.ts.map +1 -0
- package/dist/cmd/bundle/ast.d.ts +2 -0
- package/dist/cmd/bundle/ast.d.ts.map +1 -1
- package/dist/cmd/bundle/index.d.ts +1 -1
- package/dist/cmd/bundle/index.d.ts.map +1 -1
- package/dist/cmd/bundle/plugin.d.ts.map +1 -1
- package/dist/cmd/cloud/deploy.d.ts +2 -0
- package/dist/cmd/cloud/deploy.d.ts.map +1 -0
- package/dist/cmd/cloud/index.d.ts +2 -0
- package/dist/cmd/cloud/index.d.ts.map +1 -0
- package/dist/cmd/dev/index.d.ts.map +1 -1
- package/dist/cmd/env/delete.d.ts +2 -0
- package/dist/cmd/env/delete.d.ts.map +1 -0
- package/dist/cmd/env/get.d.ts +2 -0
- package/dist/cmd/env/get.d.ts.map +1 -0
- package/dist/cmd/env/import.d.ts +2 -0
- package/dist/cmd/env/import.d.ts.map +1 -0
- package/dist/cmd/env/index.d.ts +2 -0
- package/dist/cmd/env/index.d.ts.map +1 -0
- package/dist/cmd/env/list.d.ts +2 -0
- package/dist/cmd/env/list.d.ts.map +1 -0
- package/dist/cmd/env/pull.d.ts +2 -0
- package/dist/cmd/env/pull.d.ts.map +1 -0
- package/dist/cmd/env/push.d.ts +2 -0
- package/dist/cmd/env/push.d.ts.map +1 -0
- package/dist/cmd/env/set.d.ts +2 -0
- package/dist/cmd/env/set.d.ts.map +1 -0
- package/dist/cmd/project/delete.d.ts.map +1 -1
- package/dist/cmd/project/download.d.ts +1 -1
- package/dist/cmd/project/download.d.ts.map +1 -1
- package/dist/cmd/project/list.d.ts.map +1 -1
- package/dist/cmd/project/show.d.ts.map +1 -1
- package/dist/cmd/project/template-flow.d.ts +1 -1
- package/dist/cmd/project/template-flow.d.ts.map +1 -1
- package/dist/cmd/secret/delete.d.ts +2 -0
- package/dist/cmd/secret/delete.d.ts.map +1 -0
- package/dist/cmd/secret/get.d.ts +2 -0
- package/dist/cmd/secret/get.d.ts.map +1 -0
- package/dist/cmd/secret/import.d.ts +2 -0
- package/dist/cmd/secret/import.d.ts.map +1 -0
- package/dist/cmd/secret/index.d.ts +2 -0
- package/dist/cmd/secret/index.d.ts.map +1 -0
- package/dist/cmd/secret/list.d.ts +2 -0
- package/dist/cmd/secret/list.d.ts.map +1 -0
- package/dist/cmd/secret/pull.d.ts +2 -0
- package/dist/cmd/secret/pull.d.ts.map +1 -0
- package/dist/cmd/secret/push.d.ts +2 -0
- package/dist/cmd/secret/push.d.ts.map +1 -0
- package/dist/cmd/secret/set.d.ts +2 -0
- package/dist/cmd/secret/set.d.ts.map +1 -0
- package/dist/cmd/version/index.d.ts.map +1 -1
- package/dist/config.d.ts +4 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/env-util.d.ts +67 -0
- package/dist/env-util.d.ts.map +1 -0
- package/dist/env-util.test.d.ts +2 -0
- package/dist/env-util.test.d.ts.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/schema-parser.d.ts.map +1 -1
- package/dist/steps.d.ts.map +1 -1
- package/dist/tui.d.ts +1 -1
- package/dist/tui.d.ts.map +1 -1
- package/dist/types.d.ts +35 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/banner.ts +7 -2
- package/src/cli.ts +46 -5
- package/src/cmd/auth/index.ts +2 -1
- package/src/cmd/auth/login.ts +2 -4
- package/src/cmd/auth/whoami.ts +69 -0
- package/src/cmd/bundle/ast.ts +169 -4
- package/src/cmd/bundle/index.ts +2 -2
- package/src/cmd/bundle/plugin.ts +42 -1
- package/src/cmd/cloud/deploy.ts +129 -0
- package/src/cmd/cloud/index.ts +8 -0
- package/src/cmd/dev/index.ts +93 -9
- package/src/cmd/env/delete.ts +62 -0
- package/src/cmd/env/get.ts +66 -0
- package/src/cmd/env/import.ts +117 -0
- package/src/cmd/env/index.ts +22 -0
- package/src/cmd/env/list.ts +69 -0
- package/src/cmd/env/pull.ts +93 -0
- package/src/cmd/env/push.ts +55 -0
- package/src/cmd/env/set.ts +86 -0
- package/src/cmd/project/create.ts +1 -1
- package/src/cmd/project/delete.ts +43 -2
- package/src/cmd/project/download.ts +1 -1
- package/src/cmd/project/list.ts +33 -2
- package/src/cmd/project/show.ts +35 -3
- package/src/cmd/project/template-flow.ts +53 -12
- package/src/cmd/secret/delete.ts +55 -0
- package/src/cmd/secret/get.ts +67 -0
- package/src/cmd/secret/import.ts +79 -0
- package/src/cmd/secret/index.ts +22 -0
- package/src/cmd/secret/list.ts +69 -0
- package/src/cmd/secret/pull.ts +91 -0
- package/src/cmd/secret/push.ts +55 -0
- package/src/cmd/secret/set.ts +60 -0
- package/src/cmd/version/index.ts +2 -1
- package/src/config.ts +60 -7
- package/src/env-util.test.ts +194 -0
- package/src/env-util.ts +290 -0
- package/src/index.ts +5 -1
- package/src/schema-parser.ts +2 -3
- package/src/steps.ts +79 -4
- package/src/tui.ts +92 -56
- package/src/types.ts +30 -1
- package/dist/logger.d.ts +0 -24
- package/dist/logger.d.ts.map +0 -1
- package/src/logger.ts +0 -235
package/src/tui.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import enquirer from 'enquirer';
|
|
8
8
|
import type { OrganizationList } from '@agentuity/server';
|
|
9
9
|
import type { ColorScheme } from './terminal';
|
|
10
|
+
import { stringWidth } from 'bun';
|
|
10
11
|
|
|
11
12
|
// Icons
|
|
12
13
|
const ICONS = {
|
|
@@ -18,46 +19,67 @@ const ICONS = {
|
|
|
18
19
|
bullet: '•',
|
|
19
20
|
} as const;
|
|
20
21
|
|
|
22
|
+
function shouldUseColors(): boolean {
|
|
23
|
+
return !process.env.NO_COLOR && process.env.TERM !== 'dumb' && !!process.stdout.isTTY;
|
|
24
|
+
}
|
|
25
|
+
|
|
21
26
|
// Color definitions (light/dark adaptive) using Bun.color
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
light: Bun.color('#008B8B', 'ansi') || '\x1b[36m', // dark cyan
|
|
37
|
-
dark: Bun.color('#55FFFF', 'ansi') || '\x1b[96m', // bright cyan
|
|
38
|
-
},
|
|
39
|
-
muted: {
|
|
40
|
-
light: Bun.color('#808080', 'ansi') || '\x1b[90m', // gray
|
|
41
|
-
dark: Bun.color('#888888', 'ansi') || '\x1b[90m', // darker gray
|
|
42
|
-
},
|
|
43
|
-
bold: {
|
|
44
|
-
light: '\x1b[1m',
|
|
45
|
-
dark: '\x1b[1m',
|
|
46
|
-
},
|
|
47
|
-
link: {
|
|
48
|
-
light: '\x1b[34;4m', // blue underline (need ANSI for underline)
|
|
49
|
-
dark: '\x1b[94;4m', // bright blue underline
|
|
50
|
-
},
|
|
51
|
-
reset: '\x1b[0m',
|
|
52
|
-
} as const;
|
|
27
|
+
function getColors() {
|
|
28
|
+
const USE_COLORS = shouldUseColors();
|
|
29
|
+
if (!USE_COLORS) {
|
|
30
|
+
return {
|
|
31
|
+
success: { light: '', dark: '' },
|
|
32
|
+
error: { light: '', dark: '' },
|
|
33
|
+
warning: { light: '', dark: '' },
|
|
34
|
+
info: { light: '', dark: '' },
|
|
35
|
+
muted: { light: '', dark: '' },
|
|
36
|
+
bold: { light: '', dark: '' },
|
|
37
|
+
link: { light: '', dark: '' },
|
|
38
|
+
reset: '',
|
|
39
|
+
} as const;
|
|
40
|
+
}
|
|
53
41
|
|
|
54
|
-
|
|
42
|
+
return {
|
|
43
|
+
success: {
|
|
44
|
+
light: Bun.color('#008000', 'ansi') || '\x1b[32m', // green
|
|
45
|
+
dark: Bun.color('#00FF00', 'ansi') || '\x1b[92m', // bright green
|
|
46
|
+
},
|
|
47
|
+
error: {
|
|
48
|
+
light: Bun.color('#CC0000', 'ansi') || '\x1b[31m', // red
|
|
49
|
+
dark: Bun.color('#FF5555', 'ansi') || '\x1b[91m', // bright red
|
|
50
|
+
},
|
|
51
|
+
warning: {
|
|
52
|
+
light: Bun.color('#B58900', 'ansi') || '\x1b[33m', // yellow
|
|
53
|
+
dark: Bun.color('#FFFF55', 'ansi') || '\x1b[93m', // bright yellow
|
|
54
|
+
},
|
|
55
|
+
info: {
|
|
56
|
+
light: Bun.color('#008B8B', 'ansi') || '\x1b[36m', // dark cyan
|
|
57
|
+
dark: Bun.color('#55FFFF', 'ansi') || '\x1b[96m', // bright cyan
|
|
58
|
+
},
|
|
59
|
+
muted: {
|
|
60
|
+
light: Bun.color('#808080', 'ansi') || '\x1b[90m', // gray
|
|
61
|
+
dark: Bun.color('#888888', 'ansi') || '\x1b[90m', // darker gray
|
|
62
|
+
},
|
|
63
|
+
bold: {
|
|
64
|
+
light: '\x1b[1m',
|
|
65
|
+
dark: '\x1b[1m',
|
|
66
|
+
},
|
|
67
|
+
link: {
|
|
68
|
+
light: '\x1b[34;4m', // blue underline (need ANSI for underline)
|
|
69
|
+
dark: '\x1b[94;4m', // bright blue underline
|
|
70
|
+
},
|
|
71
|
+
reset: '\x1b[0m',
|
|
72
|
+
} as const;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
let currentColorScheme: ColorScheme = process.env.CI ? 'light' : 'dark';
|
|
55
76
|
|
|
56
77
|
export function setColorScheme(scheme: ColorScheme): void {
|
|
57
78
|
currentColorScheme = scheme;
|
|
58
79
|
}
|
|
59
80
|
|
|
60
|
-
function getColor(colorKey: keyof typeof
|
|
81
|
+
function getColor(colorKey: keyof ReturnType<typeof getColors>): string {
|
|
82
|
+
const COLORS = getColors();
|
|
61
83
|
const color = COLORS[colorKey];
|
|
62
84
|
if (typeof color === 'string') {
|
|
63
85
|
return color;
|
|
@@ -70,7 +92,7 @@ function getColor(colorKey: keyof typeof COLORS): string {
|
|
|
70
92
|
*/
|
|
71
93
|
export function success(message: string): void {
|
|
72
94
|
const color = getColor('success');
|
|
73
|
-
const reset =
|
|
95
|
+
const reset = getColor('reset');
|
|
74
96
|
console.log(`${color}${ICONS.success} ${message}${reset}`);
|
|
75
97
|
}
|
|
76
98
|
|
|
@@ -79,7 +101,7 @@ export function success(message: string): void {
|
|
|
79
101
|
*/
|
|
80
102
|
export function error(message: string): void {
|
|
81
103
|
const color = getColor('error');
|
|
82
|
-
const reset =
|
|
104
|
+
const reset = getColor('reset');
|
|
83
105
|
console.error(`${color}${ICONS.error} ${message}${reset}`);
|
|
84
106
|
}
|
|
85
107
|
|
|
@@ -88,7 +110,7 @@ export function error(message: string): void {
|
|
|
88
110
|
*/
|
|
89
111
|
export function fatal(message: string): never {
|
|
90
112
|
const color = getColor('error');
|
|
91
|
-
const reset =
|
|
113
|
+
const reset = getColor('reset');
|
|
92
114
|
console.error(`${color}${ICONS.error} ${message}${reset}`);
|
|
93
115
|
process.exit(1);
|
|
94
116
|
}
|
|
@@ -98,7 +120,7 @@ export function fatal(message: string): never {
|
|
|
98
120
|
*/
|
|
99
121
|
export function warning(message: string, asError = false): void {
|
|
100
122
|
const color = asError ? getColor('error') : getColor('warning');
|
|
101
|
-
const reset =
|
|
123
|
+
const reset = getColor('reset');
|
|
102
124
|
console.log(`${color}${ICONS.warning} ${message}${reset}`);
|
|
103
125
|
}
|
|
104
126
|
|
|
@@ -107,7 +129,7 @@ export function warning(message: string, asError = false): void {
|
|
|
107
129
|
*/
|
|
108
130
|
export function info(message: string): void {
|
|
109
131
|
const color = getColor('info');
|
|
110
|
-
const reset =
|
|
132
|
+
const reset = getColor('reset');
|
|
111
133
|
console.log(`${color}${ICONS.info} ${message}${reset}`);
|
|
112
134
|
}
|
|
113
135
|
|
|
@@ -116,7 +138,7 @@ export function info(message: string): void {
|
|
|
116
138
|
*/
|
|
117
139
|
export function muted(text: string): string {
|
|
118
140
|
const color = getColor('muted');
|
|
119
|
-
const reset =
|
|
141
|
+
const reset = getColor('reset');
|
|
120
142
|
return `${color}${text}${reset}`;
|
|
121
143
|
}
|
|
122
144
|
|
|
@@ -125,20 +147,20 @@ export function muted(text: string): string {
|
|
|
125
147
|
*/
|
|
126
148
|
export function bold(text: string): string {
|
|
127
149
|
const color = getColor('bold');
|
|
128
|
-
const reset =
|
|
150
|
+
const reset = getColor('reset');
|
|
129
151
|
return `${color}${text}${reset}`;
|
|
130
152
|
}
|
|
131
153
|
|
|
132
154
|
/**
|
|
133
155
|
* Format text as a link (blue and underlined)
|
|
134
156
|
*/
|
|
135
|
-
export function link(url: string): string {
|
|
157
|
+
export function link(url: string, title?: string): string {
|
|
136
158
|
const color = getColor('link');
|
|
137
|
-
const reset =
|
|
159
|
+
const reset = getColor('reset');
|
|
138
160
|
|
|
139
161
|
// Check if terminal supports hyperlinks (OSC 8)
|
|
140
162
|
if (supportsHyperlinks()) {
|
|
141
|
-
return `\x1b]8;;${url}\x07${color}${url}${reset}\x1b]8;;\x07`;
|
|
163
|
+
return `\x1b]8;;${url}\x07${color}${title ?? url}${reset}\x1b]8;;\x07`;
|
|
142
164
|
}
|
|
143
165
|
|
|
144
166
|
return `${color}${url}${reset}`;
|
|
@@ -251,7 +273,7 @@ export function banner(title: string, body: string, options?: BannerOptions): vo
|
|
|
251
273
|
// Colors
|
|
252
274
|
const borderColor = getColor('muted');
|
|
253
275
|
const titleColor = getColor('info');
|
|
254
|
-
const reset =
|
|
276
|
+
const reset = getColor('reset');
|
|
255
277
|
|
|
256
278
|
// Build banner
|
|
257
279
|
const lines: string[] = [];
|
|
@@ -451,24 +473,32 @@ export function showSignupBenefits(): void {
|
|
|
451
473
|
* Display a message when unauthenticated to let the user know certain capabilities are disabled
|
|
452
474
|
*/
|
|
453
475
|
export function showLoggedOutMessage(): void {
|
|
454
|
-
const
|
|
476
|
+
const YELLOW = Bun.color('yellow', 'ansi-16m');
|
|
455
477
|
const TEXT =
|
|
456
478
|
currentColorScheme === 'dark' ? Bun.color('white', 'ansi') : Bun.color('black', 'ansi');
|
|
457
479
|
const RESET = '\x1b[0m';
|
|
458
480
|
|
|
481
|
+
const signupTitle = 'Sign up / Login';
|
|
482
|
+
const showInline = supportsHyperlinks();
|
|
483
|
+
const signupURL = 'https://app.agentuity.com/sign-up';
|
|
484
|
+
const signupLink = showInline
|
|
485
|
+
? link(signupURL, signupTitle)
|
|
486
|
+
: ' '.repeat(stringWidth(signupTitle));
|
|
487
|
+
const showNewLine = showInline ? '' : `║ ${RESET}${link(signupURL)}${YELLOW} ║`;
|
|
488
|
+
|
|
459
489
|
const lines = [
|
|
460
490
|
'╔══════════════════════════════════════════════╗',
|
|
461
491
|
`║ ⨺ Unauthenticated (local mode) ║`,
|
|
462
492
|
'║ ║',
|
|
463
|
-
`║ ${TEXT}Certain capabilities such as the AI services${
|
|
464
|
-
`║ ${TEXT}and devmode remote are unavailable when${
|
|
465
|
-
`║ ${TEXT}unauthenticated.${
|
|
493
|
+
`║ ${TEXT}Certain capabilities such as the AI services${YELLOW} ║`,
|
|
494
|
+
`║ ${TEXT}and devmode remote are unavailable when${YELLOW} ║`,
|
|
495
|
+
`║ ${TEXT}unauthenticated.${YELLOW} ${signupLink}${YELLOW} ║`,
|
|
496
|
+
showNewLine,
|
|
466
497
|
'╚══════════════════════════════════════════════╝',
|
|
467
498
|
];
|
|
468
499
|
|
|
469
500
|
console.log('');
|
|
470
|
-
lines.forEach((line) => console.log(
|
|
471
|
-
console.log('');
|
|
501
|
+
lines.filter(Boolean).forEach((line) => console.log(YELLOW + line + RESET));
|
|
472
502
|
}
|
|
473
503
|
|
|
474
504
|
/**
|
|
@@ -560,7 +590,7 @@ function stripAnsiCodes(str: string): string {
|
|
|
560
590
|
* Check if a string ends with ANSI reset code
|
|
561
591
|
*/
|
|
562
592
|
function endsWithReset(str: string): boolean {
|
|
563
|
-
return str.endsWith('\x1b[0m') || str.endsWith(
|
|
593
|
+
return str.endsWith('\x1b[0m') || str.endsWith(getColor('reset'));
|
|
564
594
|
}
|
|
565
595
|
|
|
566
596
|
/**
|
|
@@ -625,7 +655,7 @@ function wrapText(text: string, maxWidth: number): string[] {
|
|
|
625
655
|
if (leadingCodes && hasReset) {
|
|
626
656
|
for (let i = paragraphStart; i < allLines.length; i++) {
|
|
627
657
|
if (!endsWithReset(allLines[i])) {
|
|
628
|
-
allLines[i] +=
|
|
658
|
+
allLines[i] += getColor('reset');
|
|
629
659
|
}
|
|
630
660
|
}
|
|
631
661
|
}
|
|
@@ -702,7 +732,7 @@ export async function spinner<T>(
|
|
|
702
732
|
}
|
|
703
733
|
|
|
704
734
|
const message = options.message;
|
|
705
|
-
const reset =
|
|
735
|
+
const reset = getColor('reset');
|
|
706
736
|
|
|
707
737
|
// If no TTY, just execute the callback without animation
|
|
708
738
|
if (!process.stdout.isTTY) {
|
|
@@ -714,8 +744,6 @@ export async function spinner<T>(
|
|
|
714
744
|
? await options.callback()
|
|
715
745
|
: await options.callback;
|
|
716
746
|
|
|
717
|
-
const successColor = getColor('success');
|
|
718
|
-
console.log(`${successColor}${ICONS.success} ${message}${reset}`);
|
|
719
747
|
return result;
|
|
720
748
|
} catch (err) {
|
|
721
749
|
const errorColor = getColor('error');
|
|
@@ -886,7 +914,7 @@ export async function runCommand(options: CommandRunnerOptions): Promise<number>
|
|
|
886
914
|
? '\x1b[1m' + (Bun.color('#00008B', 'ansi') || '\x1b[34m')
|
|
887
915
|
: Bun.color('#FFFFFF', 'ansi') || '\x1b[97m'; // bold dark blue / white
|
|
888
916
|
const mutedColor = Bun.color('#808080', 'ansi') || '\x1b[90m';
|
|
889
|
-
const reset =
|
|
917
|
+
const reset = getColor('reset');
|
|
890
918
|
|
|
891
919
|
// Get terminal width
|
|
892
920
|
const termWidth = process.stdout.columns || 80;
|
|
@@ -1061,9 +1089,17 @@ export async function selectOrganization(
|
|
|
1061
1089
|
orgs: OrganizationList,
|
|
1062
1090
|
initial?: string
|
|
1063
1091
|
): Promise<string> {
|
|
1092
|
+
if (orgs.length === 0) {
|
|
1093
|
+
fatal(
|
|
1094
|
+
'You do not belong to any organizations.\n' +
|
|
1095
|
+
'Please contact support or create an organization at https://agentuity.com'
|
|
1096
|
+
);
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1064
1099
|
if (orgs.length === 1) {
|
|
1065
1100
|
return orgs[0].id;
|
|
1066
1101
|
}
|
|
1102
|
+
|
|
1067
1103
|
const response = await enquirer.prompt<{ action: string }>({
|
|
1068
1104
|
type: 'select',
|
|
1069
1105
|
name: 'action',
|
package/src/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Logger } from '
|
|
1
|
+
import type { Logger } from '@agentuity/core';
|
|
2
2
|
import type * as z from 'zod';
|
|
3
3
|
import { z as zod } from 'zod';
|
|
4
4
|
|
|
@@ -320,3 +320,32 @@ export const ProjectSchema = zod.object({
|
|
|
320
320
|
projectId: zod.string().describe('the project id'),
|
|
321
321
|
orgId: zod.string().describe('the organization id'),
|
|
322
322
|
});
|
|
323
|
+
|
|
324
|
+
export const BuildMetadataSchema = zod.object({
|
|
325
|
+
routes: zod.array(
|
|
326
|
+
zod.object({
|
|
327
|
+
id: zod.string().describe('the unique calculated id for the route'),
|
|
328
|
+
filename: zod.string().describe('the relative path for the file'),
|
|
329
|
+
path: zod.string().describe('the route path'),
|
|
330
|
+
method: zod.enum(['get', 'post', 'put', 'delete', 'patch']).describe('the HTTP method'),
|
|
331
|
+
version: zod.string().describe('the SHA256 content of the file'),
|
|
332
|
+
type: zod.enum(['api', 'sms', 'email', 'cron', 'websocket', 'sse', 'stream']),
|
|
333
|
+
config: zod
|
|
334
|
+
.record(zod.string(), zod.unknown())
|
|
335
|
+
.optional()
|
|
336
|
+
.describe('type specific configuration'),
|
|
337
|
+
})
|
|
338
|
+
),
|
|
339
|
+
agents: zod.array(
|
|
340
|
+
zod.object({
|
|
341
|
+
id: zod.string().describe('the unique calculated id for the route'),
|
|
342
|
+
filename: zod.string().describe('the relative path for the file'),
|
|
343
|
+
name: zod.string().describe('the name of the agent'),
|
|
344
|
+
version: zod.string().describe('the SHA256 content of the file'),
|
|
345
|
+
identifier: zod.string().describe('the folder for the agent'),
|
|
346
|
+
description: zod.string().optional().describe('the agent description'),
|
|
347
|
+
})
|
|
348
|
+
),
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
export type BuildMetadata = zod.infer<typeof BuildMetadataSchema>;
|
package/dist/logger.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { LogLevel } from './types';
|
|
2
|
-
import type { ColorScheme } from './terminal';
|
|
3
|
-
export declare class Logger {
|
|
4
|
-
private level;
|
|
5
|
-
private showTimestamp;
|
|
6
|
-
private colorScheme;
|
|
7
|
-
private colors;
|
|
8
|
-
private showPrefix;
|
|
9
|
-
constructor(level?: LogLevel, showTimestamp?: boolean, colorScheme?: ColorScheme);
|
|
10
|
-
setLevel(level: LogLevel): void;
|
|
11
|
-
setTimestamp(enabled: boolean): void;
|
|
12
|
-
setColorScheme(scheme: ColorScheme): void;
|
|
13
|
-
setShowPrefix(show: boolean): void;
|
|
14
|
-
private shouldLog;
|
|
15
|
-
private log;
|
|
16
|
-
debug(message: string, ...args: unknown[]): void;
|
|
17
|
-
trace(message: string, ...args: unknown[]): void;
|
|
18
|
-
info(message: string, ...args: unknown[]): void;
|
|
19
|
-
warn(message: string, ...args: unknown[]): void;
|
|
20
|
-
error(message: string, ...args: unknown[]): void;
|
|
21
|
-
fatal(message: string, ...args: unknown[]): never;
|
|
22
|
-
}
|
|
23
|
-
export declare const logger: Logger;
|
|
24
|
-
//# sourceMappingURL=logger.d.ts.map
|
package/dist/logger.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AA8G9C,qBAAa,MAAM;IAClB,OAAO,CAAC,KAAK,CAAW;IACxB,OAAO,CAAC,aAAa,CAAU;IAC/B,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,MAAM,CAA8B;IAC5C,OAAO,CAAC,UAAU,CAAQ;gBAGzB,KAAK,GAAE,QAAiB,EACxB,aAAa,GAAE,OAAe,EAC9B,WAAW,GAAE,WAAoB;IAQlC,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI;IAI/B,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAIpC,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;IAKzC,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAIlC,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,GAAG;IA0DX,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAIhD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAIhD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAI/C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAI/C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAIhD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,KAAK;CAIjD;AAED,eAAO,MAAM,MAAM,QAAqB,CAAC"}
|
package/src/logger.ts
DELETED
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
import type { LogLevel } from './types';
|
|
2
|
-
import type { ColorScheme } from './terminal';
|
|
3
|
-
|
|
4
|
-
const LOG_LEVELS: Record<LogLevel, number> = {
|
|
5
|
-
debug: 0,
|
|
6
|
-
trace: 1,
|
|
7
|
-
info: 2,
|
|
8
|
-
warn: 3,
|
|
9
|
-
error: 4,
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const BOLD = '\x1b[1m';
|
|
13
|
-
const RESET = '\x1b[0m';
|
|
14
|
-
|
|
15
|
-
// Helper to convert hex color to ANSI 24-bit color code
|
|
16
|
-
function hexToAnsi(hex: string): string {
|
|
17
|
-
const r = parseInt(hex.slice(1, 3), 16);
|
|
18
|
-
const g = parseInt(hex.slice(3, 5), 16);
|
|
19
|
-
const b = parseInt(hex.slice(5, 7), 16);
|
|
20
|
-
return `\x1b[38;2;${r};${g};${b}m`;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function shouldUseColors(): boolean {
|
|
24
|
-
// Check for NO_COLOR environment variable (any non-empty value disables colors)
|
|
25
|
-
if (process.env.NO_COLOR) {
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// Check for TERM=dumb
|
|
30
|
-
if (process.env.TERM === 'dumb') {
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Check if stdout is a TTY
|
|
35
|
-
if (!process.stdout.isTTY) {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return true;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const USE_COLORS = shouldUseColors();
|
|
43
|
-
|
|
44
|
-
interface LogColors {
|
|
45
|
-
level: string;
|
|
46
|
-
message: string;
|
|
47
|
-
timestamp: string;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function getLogColors(scheme: ColorScheme): Record<LogLevel, LogColors> {
|
|
51
|
-
if (scheme === 'light') {
|
|
52
|
-
// Darker, high-contrast colors for light backgrounds
|
|
53
|
-
return {
|
|
54
|
-
trace: {
|
|
55
|
-
level: hexToAnsi('#008B8B') + BOLD, // Dark cyan
|
|
56
|
-
message: hexToAnsi('#4B4B4B'), // Dark gray
|
|
57
|
-
timestamp: hexToAnsi('#808080'), // Gray
|
|
58
|
-
},
|
|
59
|
-
debug: {
|
|
60
|
-
level: hexToAnsi('#0000CD') + BOLD, // Medium blue
|
|
61
|
-
message: hexToAnsi('#006400'), // Dark green
|
|
62
|
-
timestamp: hexToAnsi('#808080'),
|
|
63
|
-
},
|
|
64
|
-
info: {
|
|
65
|
-
level: hexToAnsi('#FF8C00') + BOLD, // Dark orange
|
|
66
|
-
message: hexToAnsi('#0066CC') + BOLD, // Strong blue
|
|
67
|
-
timestamp: hexToAnsi('#808080'),
|
|
68
|
-
},
|
|
69
|
-
warn: {
|
|
70
|
-
level: hexToAnsi('#9400D3') + BOLD, // Dark violet
|
|
71
|
-
message: hexToAnsi('#8B008B'), // Dark magenta
|
|
72
|
-
timestamp: hexToAnsi('#808080'),
|
|
73
|
-
},
|
|
74
|
-
error: {
|
|
75
|
-
level: hexToAnsi('#DC143C') + BOLD, // Crimson
|
|
76
|
-
message: hexToAnsi('#8B0000') + BOLD, // Dark red
|
|
77
|
-
timestamp: hexToAnsi('#808080'),
|
|
78
|
-
},
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// Dark mode colors (brighter for dark backgrounds)
|
|
83
|
-
return {
|
|
84
|
-
trace: {
|
|
85
|
-
level: (Bun.color('cyan', 'ansi') ?? '') + BOLD,
|
|
86
|
-
message: Bun.color('gray', 'ansi') ?? '',
|
|
87
|
-
timestamp: hexToAnsi('#666666'),
|
|
88
|
-
},
|
|
89
|
-
debug: {
|
|
90
|
-
level: (Bun.color('blue', 'ansi') ?? '') + BOLD,
|
|
91
|
-
message: Bun.color('green', 'ansi') ?? '',
|
|
92
|
-
timestamp: hexToAnsi('#666666'),
|
|
93
|
-
},
|
|
94
|
-
info: {
|
|
95
|
-
level: (Bun.color('yellow', 'ansi') ?? '') + BOLD,
|
|
96
|
-
message: (Bun.color('white', 'ansi') ?? '') + BOLD,
|
|
97
|
-
timestamp: hexToAnsi('#666666'),
|
|
98
|
-
},
|
|
99
|
-
warn: {
|
|
100
|
-
level: (Bun.color('magenta', 'ansi') ?? '') + BOLD,
|
|
101
|
-
message: Bun.color('magenta', 'ansi') ?? '',
|
|
102
|
-
timestamp: hexToAnsi('#666666'),
|
|
103
|
-
},
|
|
104
|
-
error: {
|
|
105
|
-
level: (Bun.color('red', 'ansi') ?? '') + BOLD,
|
|
106
|
-
message: Bun.color('red', 'ansi') ?? '',
|
|
107
|
-
timestamp: hexToAnsi('#666666'),
|
|
108
|
-
},
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export class Logger {
|
|
113
|
-
private level: LogLevel;
|
|
114
|
-
private showTimestamp: boolean;
|
|
115
|
-
private colorScheme: ColorScheme;
|
|
116
|
-
private colors: Record<LogLevel, LogColors>;
|
|
117
|
-
private showPrefix = true;
|
|
118
|
-
|
|
119
|
-
constructor(
|
|
120
|
-
level: LogLevel = 'info',
|
|
121
|
-
showTimestamp: boolean = false,
|
|
122
|
-
colorScheme: ColorScheme = 'dark'
|
|
123
|
-
) {
|
|
124
|
-
this.level = level;
|
|
125
|
-
this.showTimestamp = showTimestamp;
|
|
126
|
-
this.colorScheme = colorScheme;
|
|
127
|
-
this.colors = getLogColors(this.colorScheme);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
setLevel(level: LogLevel): void {
|
|
131
|
-
this.level = level;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
setTimestamp(enabled: boolean): void {
|
|
135
|
-
this.showTimestamp = enabled;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
setColorScheme(scheme: ColorScheme): void {
|
|
139
|
-
this.colorScheme = scheme;
|
|
140
|
-
this.colors = getLogColors(this.colorScheme);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
setShowPrefix(show: boolean): void {
|
|
144
|
-
this.showPrefix = show;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
private shouldLog(level: LogLevel): boolean {
|
|
148
|
-
return LOG_LEVELS[level] >= LOG_LEVELS[this.level];
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
private log(level: LogLevel, message: string, ...args: unknown[]): void {
|
|
152
|
-
if (!this.shouldLog(level) || !message) {
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
const colors = this.colors[level];
|
|
157
|
-
const levelText = `[${level.toUpperCase()}]`;
|
|
158
|
-
|
|
159
|
-
let output = '';
|
|
160
|
-
|
|
161
|
-
if (USE_COLORS) {
|
|
162
|
-
if (this.showPrefix) {
|
|
163
|
-
if (this.showTimestamp) {
|
|
164
|
-
const timestamp = new Date().toISOString();
|
|
165
|
-
output = `${colors.timestamp}[${timestamp}]${RESET} ${colors.level}${levelText}${RESET} ${colors.message}${message}${RESET}`;
|
|
166
|
-
} else {
|
|
167
|
-
output = `${colors.level}${levelText}${RESET} ${colors.message}${message}${RESET}`;
|
|
168
|
-
}
|
|
169
|
-
} else {
|
|
170
|
-
// No prefix - just the message with color
|
|
171
|
-
output = `${colors.message}${message}${RESET}`;
|
|
172
|
-
}
|
|
173
|
-
} else {
|
|
174
|
-
// No colors - plain text output
|
|
175
|
-
if (this.showPrefix) {
|
|
176
|
-
if (this.showTimestamp) {
|
|
177
|
-
const timestamp = new Date().toISOString();
|
|
178
|
-
output = `[${timestamp}] ${levelText} ${message}`;
|
|
179
|
-
} else {
|
|
180
|
-
output = `${levelText} ${message}`;
|
|
181
|
-
}
|
|
182
|
-
} else {
|
|
183
|
-
// No prefix, no colors - just message
|
|
184
|
-
output = message;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
if (level === 'error') {
|
|
189
|
-
if (args.length > 0) {
|
|
190
|
-
console.error(output, ...args);
|
|
191
|
-
} else {
|
|
192
|
-
console.error(output);
|
|
193
|
-
}
|
|
194
|
-
} else if (level === 'warn') {
|
|
195
|
-
if (args.length > 0) {
|
|
196
|
-
console.warn(output, ...args);
|
|
197
|
-
} else {
|
|
198
|
-
console.warn(output);
|
|
199
|
-
}
|
|
200
|
-
} else {
|
|
201
|
-
if (args.length > 0) {
|
|
202
|
-
console.log(output, ...args);
|
|
203
|
-
} else {
|
|
204
|
-
console.log(output);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
debug(message: string, ...args: unknown[]): void {
|
|
210
|
-
this.log('debug', message, ...args);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
trace(message: string, ...args: unknown[]): void {
|
|
214
|
-
this.log('trace', message, ...args);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
info(message: string, ...args: unknown[]): void {
|
|
218
|
-
this.log('info', message, ...args);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
warn(message: string, ...args: unknown[]): void {
|
|
222
|
-
this.log('warn', message, ...args);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
error(message: string, ...args: unknown[]): void {
|
|
226
|
-
this.log('error', message, ...args);
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
fatal(message: string, ...args: unknown[]): never {
|
|
230
|
-
this.log('error', message, ...args);
|
|
231
|
-
process.exit(1);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
export const logger = new Logger('info');
|