@agentuity/cli 0.0.72 → 0.0.74
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 +19 -5
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +13 -9
- package/dist/auth.js.map +1 -1
- package/dist/banner.js +1 -1
- package/dist/banner.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +79 -21
- package/dist/cli.js.map +1 -1
- package/dist/cmd/ai/prompt/api.d.ts.map +1 -1
- package/dist/cmd/ai/prompt/api.js +5 -4
- package/dist/cmd/ai/prompt/api.js.map +1 -1
- package/dist/cmd/auth/api.d.ts +2 -2
- package/dist/cmd/auth/api.d.ts.map +1 -1
- package/dist/cmd/auth/api.js +15 -14
- package/dist/cmd/auth/api.js.map +1 -1
- package/dist/cmd/auth/login.d.ts.map +1 -1
- package/dist/cmd/auth/login.js +37 -16
- package/dist/cmd/auth/login.js.map +1 -1
- package/dist/cmd/auth/ssh/api.d.ts.map +1 -1
- package/dist/cmd/auth/ssh/api.js +3 -2
- package/dist/cmd/auth/ssh/api.js.map +1 -1
- package/dist/cmd/build/ast.d.ts.map +1 -1
- package/dist/cmd/build/ast.js +76 -14
- package/dist/cmd/build/ast.js.map +1 -1
- package/dist/cmd/build/bundler.d.ts +3 -1
- package/dist/cmd/build/bundler.d.ts.map +1 -1
- package/dist/cmd/build/bundler.js +21 -9
- package/dist/cmd/build/bundler.js.map +1 -1
- package/dist/cmd/build/format-schema.d.ts +6 -0
- package/dist/cmd/build/format-schema.d.ts.map +1 -0
- package/dist/cmd/build/format-schema.js +60 -0
- package/dist/cmd/build/format-schema.js.map +1 -0
- package/dist/cmd/build/index.d.ts.map +1 -1
- package/dist/cmd/build/index.js +13 -0
- package/dist/cmd/build/index.js.map +1 -1
- package/dist/cmd/build/plugin.d.ts.map +1 -1
- package/dist/cmd/build/plugin.js +123 -32
- package/dist/cmd/build/plugin.js.map +1 -1
- package/dist/cmd/build/route-discovery.d.ts +50 -0
- package/dist/cmd/build/route-discovery.d.ts.map +1 -0
- package/dist/cmd/build/route-discovery.js +143 -0
- package/dist/cmd/build/route-discovery.js.map +1 -0
- package/dist/cmd/build/route-registry.d.ts.map +1 -1
- package/dist/cmd/build/route-registry.js +25 -10
- package/dist/cmd/build/route-registry.js.map +1 -1
- package/dist/cmd/cloud/deploy.d.ts.map +1 -1
- package/dist/cmd/cloud/deploy.js +8 -6
- 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 +34 -10
- package/dist/cmd/cloud/deployment/show.js.map +1 -1
- package/dist/cmd/dev/agents.d.ts.map +1 -1
- package/dist/cmd/dev/agents.js +2 -2
- package/dist/cmd/dev/agents.js.map +1 -1
- package/dist/cmd/dev/index.d.ts.map +1 -1
- package/dist/cmd/dev/index.js +21 -0
- package/dist/cmd/dev/index.js.map +1 -1
- package/dist/cmd/dev/sync.d.ts.map +1 -1
- package/dist/cmd/dev/sync.js +2 -2
- package/dist/cmd/dev/sync.js.map +1 -1
- package/dist/cmd/project/download.d.ts.map +1 -1
- package/dist/cmd/project/download.js +16 -2
- package/dist/cmd/project/download.js.map +1 -1
- package/dist/cmd/project/list.d.ts.map +1 -1
- package/dist/cmd/project/list.js +2 -10
- package/dist/cmd/project/list.js.map +1 -1
- package/dist/cmd/project/show.d.ts.map +1 -1
- package/dist/cmd/project/show.js +8 -7
- package/dist/cmd/project/show.js.map +1 -1
- package/dist/cmd/project/template-flow.d.ts.map +1 -1
- package/dist/cmd/project/template-flow.js +14 -2
- package/dist/cmd/project/template-flow.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +9 -0
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/steps.d.ts +20 -30
- package/dist/steps.d.ts.map +1 -1
- package/dist/steps.js +339 -184
- package/dist/steps.js.map +1 -1
- package/dist/tui/box.d.ts.map +1 -1
- package/dist/tui/box.js +8 -4
- package/dist/tui/box.js.map +1 -1
- package/dist/tui/prompt.d.ts.map +1 -1
- package/dist/tui/prompt.js +7 -2
- package/dist/tui/prompt.js.map +1 -1
- package/dist/tui.d.ts +20 -1
- package/dist/tui.d.ts.map +1 -1
- package/dist/tui.js +90 -18
- package/dist/tui.js.map +1 -1
- package/dist/types.d.ts +10 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/auth.ts +13 -10
- package/src/banner.ts +1 -1
- package/src/cli.ts +89 -27
- package/src/cmd/ai/prompt/api.ts +5 -4
- package/src/cmd/auth/api.ts +20 -22
- package/src/cmd/auth/login.ts +36 -17
- package/src/cmd/auth/ssh/api.ts +5 -9
- package/src/cmd/build/ast.ts +88 -14
- package/src/cmd/build/bundler.ts +32 -11
- package/src/cmd/build/format-schema.ts +66 -0
- package/src/cmd/build/index.ts +14 -0
- package/src/cmd/build/plugin.ts +146 -36
- package/src/cmd/build/route-discovery.ts +197 -0
- package/src/cmd/build/route-registry.ts +26 -10
- package/src/cmd/cloud/deploy.ts +19 -6
- package/src/cmd/cloud/deployment/show.ts +42 -10
- package/src/cmd/dev/agents.ts +2 -10
- package/src/cmd/dev/index.ts +25 -0
- package/src/cmd/dev/sync.ts +2 -12
- package/src/cmd/project/download.ts +16 -2
- package/src/cmd/project/list.ts +2 -9
- package/src/cmd/project/show.ts +8 -6
- package/src/cmd/project/template-flow.ts +21 -2
- package/src/config.ts +10 -0
- package/src/index.ts +2 -2
- package/src/steps.ts +397 -229
- package/src/tui/box.ts +8 -4
- package/src/tui/prompt.ts +7 -4
- package/src/tui.ts +125 -20
package/src/tui/box.ts
CHANGED
|
@@ -12,13 +12,17 @@ function getTerminalWidth(): number {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* Get string width (accounting for ANSI codes)
|
|
15
|
+
* Get string width (accounting for ANSI codes and OSC 8 hyperlinks)
|
|
16
16
|
*/
|
|
17
17
|
function stringWidth(str: string): number {
|
|
18
|
-
// Remove ANSI escape codes
|
|
18
|
+
// Remove ANSI escape codes (colors, etc.)
|
|
19
19
|
// eslint-disable-next-line no-control-regex
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
let cleaned = str.replace(/\x1b\[[0-9;]*m/g, '');
|
|
21
|
+
// Remove OSC 8 hyperlink sequences
|
|
22
|
+
// eslint-disable-next-line no-control-regex
|
|
23
|
+
cleaned = cleaned.replace(/\u001b\]8;;[^\u0007]*\u0007/g, '');
|
|
24
|
+
// Use Bun.stringWidth for proper Unicode width calculation
|
|
25
|
+
return Bun.stringWidth(cleaned);
|
|
22
26
|
}
|
|
23
27
|
|
|
24
28
|
/**
|
package/src/tui/prompt.ts
CHANGED
|
@@ -92,15 +92,16 @@ export class PromptFlow {
|
|
|
92
92
|
const rl = readline.createInterface({
|
|
93
93
|
input: process.stdin,
|
|
94
94
|
output: process.stdout,
|
|
95
|
+
prompt: `${colors.secondary(symbols.bar)} `, // custom prompt instead of default ">"
|
|
95
96
|
});
|
|
96
97
|
|
|
97
98
|
let hasError = false;
|
|
98
99
|
|
|
99
100
|
const showPrompt = () => {
|
|
100
101
|
// Show prompt with active symbol
|
|
101
|
-
process.stdout.write(
|
|
102
|
-
|
|
103
|
-
);
|
|
102
|
+
process.stdout.write(`${colors.active(symbols.active)} ${message}\n`);
|
|
103
|
+
// Use readline's prompt for the input line
|
|
104
|
+
rl.prompt();
|
|
104
105
|
};
|
|
105
106
|
|
|
106
107
|
showPrompt();
|
|
@@ -123,8 +124,10 @@ export class PromptFlow {
|
|
|
123
124
|
|
|
124
125
|
// Redraw prompt with error
|
|
125
126
|
process.stdout.write(
|
|
126
|
-
`${colors.error(symbols.error)} ${message}\n${colors.secondary(symbols.bar)} ${colors.error(errorMsg)}\n
|
|
127
|
+
`${colors.error(symbols.error)} ${message}\n${colors.secondary(symbols.bar)} ${colors.error(errorMsg)}\n`
|
|
127
128
|
);
|
|
129
|
+
// Use readline's prompt for the input line
|
|
130
|
+
rl.prompt();
|
|
128
131
|
hasError = true;
|
|
129
132
|
return;
|
|
130
133
|
}
|
package/src/tui.ts
CHANGED
|
@@ -700,7 +700,7 @@ export function showLoggedOutMessage(): void {
|
|
|
700
700
|
|
|
701
701
|
const signupTitle = 'Sign up / Login';
|
|
702
702
|
const showInline = supportsHyperlinks();
|
|
703
|
-
const signupURL = 'https://app.agentuity.com/sign-up';
|
|
703
|
+
const signupURL = 'https://app-v1.agentuity.com/sign-up';
|
|
704
704
|
const signupLink = showInline
|
|
705
705
|
? link(signupURL, signupTitle)
|
|
706
706
|
: ' '.repeat(stringWidth(signupTitle));
|
|
@@ -927,13 +927,34 @@ export interface LoggerSpinnerOptions<T> {
|
|
|
927
927
|
maxLines?: number;
|
|
928
928
|
}
|
|
929
929
|
|
|
930
|
+
/**
|
|
931
|
+
* Spinner options (with countdown timer)
|
|
932
|
+
*/
|
|
933
|
+
export interface CountdownSpinnerOptions<T> {
|
|
934
|
+
type: 'countdown';
|
|
935
|
+
message: string;
|
|
936
|
+
timeoutMs: number;
|
|
937
|
+
callback: () => Promise<T>;
|
|
938
|
+
/**
|
|
939
|
+
* If true, clear the spinner output on success (no icon, no message)
|
|
940
|
+
* Defaults to false
|
|
941
|
+
*/
|
|
942
|
+
clearOnSuccess?: boolean;
|
|
943
|
+
/**
|
|
944
|
+
* Optional callback to handle Enter key press
|
|
945
|
+
* Can be used to open a URL in the browser
|
|
946
|
+
*/
|
|
947
|
+
onEnterPress?: () => void;
|
|
948
|
+
}
|
|
949
|
+
|
|
930
950
|
/**
|
|
931
951
|
* Spinner options (discriminated union)
|
|
932
952
|
*/
|
|
933
953
|
export type SpinnerOptions<T> =
|
|
934
954
|
| SimpleSpinnerOptions<T>
|
|
935
955
|
| ProgressSpinnerOptions<T>
|
|
936
|
-
| LoggerSpinnerOptions<T
|
|
956
|
+
| LoggerSpinnerOptions<T>
|
|
957
|
+
| CountdownSpinnerOptions<T>;
|
|
937
958
|
|
|
938
959
|
/**
|
|
939
960
|
* Run a callback with an animated spinner (simple overload)
|
|
@@ -993,9 +1014,11 @@ export async function spinner<T>(
|
|
|
993
1014
|
// In non-TTY mode, just write logs directly to stdout
|
|
994
1015
|
process.stdout.write(logMessage + '\n');
|
|
995
1016
|
})
|
|
996
|
-
:
|
|
1017
|
+
: options.type === 'countdown'
|
|
997
1018
|
? await options.callback()
|
|
998
|
-
:
|
|
1019
|
+
: typeof options.callback === 'function'
|
|
1020
|
+
? await options.callback()
|
|
1021
|
+
: await options.callback;
|
|
999
1022
|
|
|
1000
1023
|
// If clearOnSuccess is true, don't show success message
|
|
1001
1024
|
// Also skip success message in JSON mode
|
|
@@ -1025,6 +1048,7 @@ export async function spinner<T>(
|
|
|
1025
1048
|
|
|
1026
1049
|
let frameIndex = 0;
|
|
1027
1050
|
let currentProgress: number | undefined;
|
|
1051
|
+
let remainingTime: number | undefined;
|
|
1028
1052
|
const logLines: string[] = [];
|
|
1029
1053
|
const maxLines = options.type === 'logger' ? (options.maxLines ?? 3) : 0;
|
|
1030
1054
|
const mutedColor = getColor('muted');
|
|
@@ -1045,14 +1069,19 @@ export async function spinner<T>(
|
|
|
1045
1069
|
const color = colorDef[currentColorScheme];
|
|
1046
1070
|
const frame = `${color}${bold}${frames[frameIndex % frames.length]}${reset}`;
|
|
1047
1071
|
|
|
1048
|
-
// Add progress indicator if available
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1072
|
+
// Add progress indicator or countdown timer if available
|
|
1073
|
+
let indicator = '';
|
|
1074
|
+
if (currentProgress !== undefined) {
|
|
1075
|
+
indicator = ` ${cyanColor}${Math.floor(currentProgress)}%${reset}`;
|
|
1076
|
+
} else if (remainingTime !== undefined) {
|
|
1077
|
+
const minutes = Math.floor(remainingTime / 60);
|
|
1078
|
+
const seconds = Math.floor(remainingTime % 60);
|
|
1079
|
+
const timeStr = minutes > 0 ? `${minutes}m ${seconds}s` : `${seconds}s`;
|
|
1080
|
+
indicator = ` ${mutedColor}(${timeStr} remaining)${reset}`;
|
|
1081
|
+
}
|
|
1053
1082
|
|
|
1054
1083
|
// Render spinner line
|
|
1055
|
-
process.stderr.write(`\r\x1b[K${frame} ${message}${
|
|
1084
|
+
process.stderr.write(`\r\x1b[K${frame} ${message}${indicator}\n`);
|
|
1056
1085
|
|
|
1057
1086
|
// Render log lines if in logger mode
|
|
1058
1087
|
if (options.type === 'logger') {
|
|
@@ -1089,16 +1118,88 @@ export async function spinner<T>(
|
|
|
1089
1118
|
logLines.push(logMessage);
|
|
1090
1119
|
};
|
|
1091
1120
|
|
|
1121
|
+
// Countdown interval tracking
|
|
1122
|
+
let countdownInterval: NodeJS.Timeout | undefined;
|
|
1123
|
+
let keypressListener: ((chunk: Buffer) => void) | undefined;
|
|
1124
|
+
|
|
1125
|
+
// Helper to clean up all resources
|
|
1126
|
+
const cleanup = () => {
|
|
1127
|
+
if (countdownInterval) {
|
|
1128
|
+
clearInterval(countdownInterval);
|
|
1129
|
+
}
|
|
1130
|
+
if (keypressListener) {
|
|
1131
|
+
process.stdin.off('data', keypressListener);
|
|
1132
|
+
if (process.stdin.isTTY) {
|
|
1133
|
+
process.stdin.setRawMode(false);
|
|
1134
|
+
process.stdin.pause();
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
process.off('SIGINT', cleanupAndExit);
|
|
1138
|
+
};
|
|
1139
|
+
|
|
1140
|
+
// Set up SIGINT handler for clean exit
|
|
1141
|
+
const cleanupAndExit = () => {
|
|
1142
|
+
cleanup();
|
|
1143
|
+
|
|
1144
|
+
// Stop animation
|
|
1145
|
+
clearInterval(interval);
|
|
1146
|
+
|
|
1147
|
+
// Move cursor to start of output, clear all lines
|
|
1148
|
+
if (linesRendered > 0) {
|
|
1149
|
+
process.stderr.write(`\x1b[${linesRendered}A`);
|
|
1150
|
+
}
|
|
1151
|
+
process.stderr.write('\x1b[J'); // Clear from cursor to end of screen
|
|
1152
|
+
process.stderr.write('\x1B[?25h'); // Show cursor
|
|
1153
|
+
|
|
1154
|
+
process.exit(130); // Standard exit code for SIGINT
|
|
1155
|
+
};
|
|
1156
|
+
|
|
1157
|
+
process.on('SIGINT', cleanupAndExit);
|
|
1158
|
+
|
|
1092
1159
|
try {
|
|
1160
|
+
// For countdown, set up timer tracking and optional keyboard listener
|
|
1161
|
+
if (options.type === 'countdown') {
|
|
1162
|
+
const startTime = Date.now();
|
|
1163
|
+
remainingTime = options.timeoutMs / 1000;
|
|
1164
|
+
countdownInterval = setInterval(() => {
|
|
1165
|
+
const elapsed = Date.now() - startTime;
|
|
1166
|
+
remainingTime = Math.max(0, (options.timeoutMs - elapsed) / 1000);
|
|
1167
|
+
}, 100);
|
|
1168
|
+
|
|
1169
|
+
// Set up Enter key listener if callback provided
|
|
1170
|
+
if (options.onEnterPress && process.stdin.isTTY) {
|
|
1171
|
+
process.stdin.setRawMode(true);
|
|
1172
|
+
process.stdin.resume();
|
|
1173
|
+
|
|
1174
|
+
keypressListener = (chunk: Buffer) => {
|
|
1175
|
+
const key = chunk.toString();
|
|
1176
|
+
// Check for Enter key (both \r and \n)
|
|
1177
|
+
if (key === '\r' || key === '\n') {
|
|
1178
|
+
options.onEnterPress!();
|
|
1179
|
+
}
|
|
1180
|
+
// Check for Ctrl+C - let it propagate as SIGINT
|
|
1181
|
+
if (key === '\x03') {
|
|
1182
|
+
process.kill(process.pid, 'SIGINT');
|
|
1183
|
+
}
|
|
1184
|
+
};
|
|
1185
|
+
|
|
1186
|
+
process.stdin.on('data', keypressListener);
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1093
1190
|
// Execute callback
|
|
1094
1191
|
const result =
|
|
1095
|
-
options.type === '
|
|
1096
|
-
? await options.callback(
|
|
1097
|
-
: options.type === '
|
|
1098
|
-
? await options.callback(
|
|
1099
|
-
:
|
|
1100
|
-
? await options.callback()
|
|
1101
|
-
:
|
|
1192
|
+
options.type === 'countdown'
|
|
1193
|
+
? await options.callback()
|
|
1194
|
+
: options.type === 'progress'
|
|
1195
|
+
? await options.callback(progressCallback)
|
|
1196
|
+
: options.type === 'logger'
|
|
1197
|
+
? await options.callback(logCallback)
|
|
1198
|
+
: typeof options.callback === 'function'
|
|
1199
|
+
? await options.callback()
|
|
1200
|
+
: await options.callback;
|
|
1201
|
+
|
|
1202
|
+
cleanup();
|
|
1102
1203
|
|
|
1103
1204
|
// Stop animation first
|
|
1104
1205
|
clearInterval(interval);
|
|
@@ -1119,6 +1220,8 @@ export async function spinner<T>(
|
|
|
1119
1220
|
|
|
1120
1221
|
return result;
|
|
1121
1222
|
} catch (err) {
|
|
1223
|
+
cleanup();
|
|
1224
|
+
|
|
1122
1225
|
// Stop animation first
|
|
1123
1226
|
clearInterval(interval);
|
|
1124
1227
|
|
|
@@ -1438,10 +1541,12 @@ export async function selectOrganization(
|
|
|
1438
1541
|
}
|
|
1439
1542
|
}
|
|
1440
1543
|
|
|
1544
|
+
// Auto-select if only one org (regardless of TTY mode)
|
|
1545
|
+
if (orgs.length === 1) {
|
|
1546
|
+
return orgs[0].id;
|
|
1547
|
+
}
|
|
1548
|
+
|
|
1441
1549
|
if (!process.stdin.isTTY) {
|
|
1442
|
-
if (orgs.length === 1) {
|
|
1443
|
-
return orgs[0].id;
|
|
1444
|
-
}
|
|
1445
1550
|
if (initial) {
|
|
1446
1551
|
return initial;
|
|
1447
1552
|
}
|