@agentuity/cli 0.1.40 → 0.1.42
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 +0 -2
- package/dist/agent-detection.d.ts.map +1 -1
- package/dist/agent-detection.js +11 -3
- package/dist/agent-detection.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +9 -5
- package/dist/cli.js.map +1 -1
- package/dist/cmd/ai/index.d.ts.map +1 -1
- package/dist/cmd/ai/index.js +1 -8
- package/dist/cmd/ai/index.js.map +1 -1
- package/dist/cmd/ai/prompt/version.js +1 -1
- package/dist/cmd/ai/prompt/version.js.map +1 -1
- package/dist/cmd/auth/api.d.ts.map +1 -1
- package/dist/cmd/auth/api.js +4 -1
- package/dist/cmd/auth/api.js.map +1 -1
- package/dist/cmd/auth/org/index.d.ts.map +1 -1
- package/dist/cmd/auth/org/index.js +8 -2
- package/dist/cmd/auth/org/index.js.map +1 -1
- package/dist/cmd/auth/ssh/api.js +2 -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 +14 -13
- package/dist/cmd/build/ast.js.map +1 -1
- package/dist/cmd/build/entry-generator.d.ts.map +1 -1
- package/dist/cmd/build/entry-generator.js +19 -0
- package/dist/cmd/build/entry-generator.js.map +1 -1
- package/dist/cmd/build/patch/index.d.ts.map +1 -1
- package/dist/cmd/build/patch/index.js +3 -0
- package/dist/cmd/build/patch/index.js.map +1 -1
- package/dist/cmd/build/vite/index.d.ts +1 -0
- package/dist/cmd/build/vite/index.d.ts.map +1 -1
- package/dist/cmd/build/vite/index.js +1 -0
- package/dist/cmd/build/vite/index.js.map +1 -1
- package/dist/cmd/build/vite/public-asset-path-plugin.d.ts +34 -0
- package/dist/cmd/build/vite/public-asset-path-plugin.d.ts.map +1 -0
- package/dist/cmd/build/vite/public-asset-path-plugin.js +107 -0
- package/dist/cmd/build/vite/public-asset-path-plugin.js.map +1 -0
- package/dist/cmd/build/vite/registry-generator.d.ts.map +1 -1
- package/dist/cmd/build/vite/registry-generator.js +14 -5
- package/dist/cmd/build/vite/registry-generator.js.map +1 -1
- package/dist/cmd/build/vite/route-discovery.js +1 -1
- package/dist/cmd/build/vite/route-discovery.js.map +1 -1
- package/dist/cmd/build/vite/vite-asset-server-config.d.ts.map +1 -1
- package/dist/cmd/build/vite/vite-asset-server-config.js +11 -2
- package/dist/cmd/build/vite/vite-asset-server-config.js.map +1 -1
- package/dist/cmd/build/vite/vite-builder.d.ts.map +1 -1
- package/dist/cmd/build/vite/vite-builder.js +3 -0
- package/dist/cmd/build/vite/vite-builder.js.map +1 -1
- package/dist/cmd/canary/index.d.ts.map +1 -1
- package/dist/cmd/canary/index.js +9 -1
- package/dist/cmd/canary/index.js.map +1 -1
- package/dist/cmd/cloud/db/create.d.ts.map +1 -1
- package/dist/cmd/cloud/db/create.js +2 -2
- package/dist/cmd/cloud/db/create.js.map +1 -1
- package/dist/cmd/cloud/db/delete.d.ts.map +1 -1
- package/dist/cmd/cloud/db/delete.js +2 -2
- package/dist/cmd/cloud/db/delete.js.map +1 -1
- package/dist/cmd/cloud/deploy-fork.d.ts.map +1 -1
- package/dist/cmd/cloud/deploy-fork.js +68 -0
- package/dist/cmd/cloud/deploy-fork.js.map +1 -1
- package/dist/cmd/cloud/env/import.d.ts.map +1 -1
- package/dist/cmd/cloud/env/import.js +4 -1
- package/dist/cmd/cloud/env/import.js.map +1 -1
- package/dist/cmd/cloud/env/list.d.ts.map +1 -1
- package/dist/cmd/cloud/env/list.js +4 -1
- package/dist/cmd/cloud/env/list.js.map +1 -1
- package/dist/cmd/cloud/env/push.d.ts.map +1 -1
- package/dist/cmd/cloud/env/push.js +4 -1
- package/dist/cmd/cloud/env/push.js.map +1 -1
- package/dist/cmd/cloud/region/index.js +1 -1
- package/dist/cmd/cloud/region/index.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/build.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/build.js +22 -10
- package/dist/cmd/cloud/sandbox/snapshot/build.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/get.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/get.js +12 -2
- package/dist/cmd/cloud/sandbox/snapshot/get.js.map +1 -1
- package/dist/cmd/cloud/storage/create.d.ts.map +1 -1
- package/dist/cmd/cloud/storage/create.js +2 -2
- package/dist/cmd/cloud/storage/create.js.map +1 -1
- package/dist/cmd/cloud/storage/delete.d.ts.map +1 -1
- package/dist/cmd/cloud/storage/delete.js +2 -2
- package/dist/cmd/cloud/storage/delete.js.map +1 -1
- package/dist/cmd/cloud/stream/get.js +7 -7
- package/dist/cmd/cloud/stream/get.js.map +1 -1
- package/dist/cmd/cloud/stream/list.d.ts.map +1 -1
- package/dist/cmd/cloud/stream/list.js +9 -6
- package/dist/cmd/cloud/stream/list.js.map +1 -1
- package/dist/cmd/dev/download.d.ts.map +1 -1
- package/dist/cmd/dev/download.js +9 -2
- package/dist/cmd/dev/download.js.map +1 -1
- package/dist/cmd/dev/index.js +1 -1
- package/dist/cmd/dev/index.js.map +1 -1
- package/dist/cmd/git/account/add.d.ts.map +1 -1
- package/dist/cmd/git/account/add.js +4 -3
- package/dist/cmd/git/account/add.js.map +1 -1
- package/dist/cmd/git/link.js +2 -2
- package/dist/cmd/git/link.js.map +1 -1
- package/dist/cmd/git/list.d.ts.map +1 -1
- package/dist/cmd/git/list.js +3 -2
- package/dist/cmd/git/list.js.map +1 -1
- package/dist/cmd/project/auth/init.js +1 -1
- package/dist/cmd/project/auth/init.js.map +1 -1
- package/dist/cmd/project/auth/shared.d.ts.map +1 -1
- package/dist/cmd/project/auth/shared.js +8 -3
- package/dist/cmd/project/auth/shared.js.map +1 -1
- package/dist/cmd/project/delete.d.ts.map +1 -1
- package/dist/cmd/project/delete.js +3 -2
- package/dist/cmd/project/delete.js.map +1 -1
- package/dist/cmd/project/reconcile.d.ts.map +1 -1
- package/dist/cmd/project/reconcile.js +9 -5
- package/dist/cmd/project/reconcile.js.map +1 -1
- package/dist/cmd/project/template-flow.d.ts.map +1 -1
- package/dist/cmd/project/template-flow.js +15 -5
- package/dist/cmd/project/template-flow.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +3 -2
- package/dist/config.js.map +1 -1
- package/dist/domain.d.ts.map +1 -1
- package/dist/domain.js +4 -3
- package/dist/domain.js.map +1 -1
- package/dist/internal-logger.d.ts.map +1 -1
- package/dist/internal-logger.js +3 -2
- package/dist/internal-logger.js.map +1 -1
- package/dist/repl.d.ts.map +1 -1
- package/dist/repl.js +31 -14
- package/dist/repl.js.map +1 -1
- package/dist/schema-parser.d.ts.map +1 -1
- package/dist/schema-parser.js +4 -1
- package/dist/schema-parser.js.map +1 -1
- package/dist/sound.d.ts.map +1 -1
- package/dist/sound.js +2 -1
- package/dist/sound.js.map +1 -1
- package/dist/steps.d.ts.map +1 -1
- package/dist/steps.js +13 -6
- package/dist/steps.js.map +1 -1
- package/dist/terminal.js +2 -0
- package/dist/terminal.js.map +1 -1
- package/dist/tsc-output-parser.d.ts +3 -0
- package/dist/tsc-output-parser.d.ts.map +1 -1
- package/dist/tsc-output-parser.js +32 -9
- package/dist/tsc-output-parser.js.map +1 -1
- package/dist/tui/prompt.d.ts.map +1 -1
- package/dist/tui/prompt.js +6 -2
- package/dist/tui/prompt.js.map +1 -1
- package/dist/tui.d.ts.map +1 -1
- package/dist/tui.js +26 -15
- package/dist/tui.js.map +1 -1
- package/dist/typescript-errors.d.ts.map +1 -1
- package/dist/typescript-errors.js +5 -2
- package/dist/typescript-errors.js.map +1 -1
- package/dist/utils/date.d.ts.map +1 -1
- package/dist/utils/date.js +5 -1
- package/dist/utils/date.js.map +1 -1
- package/dist/utils/deps.d.ts.map +1 -1
- package/dist/utils/deps.js +5 -3
- package/dist/utils/deps.js.map +1 -1
- package/dist/utils/detectSubagent.js +1 -1
- package/dist/utils/detectSubagent.js.map +1 -1
- package/package.json +6 -6
- package/src/agent-detection.ts +12 -3
- package/src/cli.ts +9 -5
- package/src/cmd/ai/index.ts +1 -8
- package/src/cmd/ai/prompt/version.ts +1 -1
- package/src/cmd/auth/api.ts +4 -1
- package/src/cmd/auth/org/index.ts +8 -2
- package/src/cmd/auth/ssh/api.ts +2 -2
- package/src/cmd/build/ast.ts +14 -13
- package/src/cmd/build/entry-generator.ts +19 -0
- package/src/cmd/build/patch/index.ts +3 -0
- package/src/cmd/build/vite/index.ts +1 -0
- package/src/cmd/build/vite/public-asset-path-plugin.ts +137 -0
- package/src/cmd/build/vite/registry-generator.ts +14 -5
- package/src/cmd/build/vite/route-discovery.ts +1 -1
- package/src/cmd/build/vite/vite-asset-server-config.ts +13 -4
- package/src/cmd/build/vite/vite-builder.ts +3 -0
- package/src/cmd/canary/index.ts +9 -1
- package/src/cmd/cloud/db/create.ts +16 -17
- package/src/cmd/cloud/db/delete.ts +19 -20
- package/src/cmd/cloud/deploy-fork.ts +75 -0
- package/src/cmd/cloud/env/import.ts +6 -3
- package/src/cmd/cloud/env/list.ts +11 -9
- package/src/cmd/cloud/env/push.ts +6 -3
- package/src/cmd/cloud/region/index.ts +3 -3
- package/src/cmd/cloud/sandbox/snapshot/build.ts +42 -33
- package/src/cmd/cloud/sandbox/snapshot/get.ts +21 -15
- package/src/cmd/cloud/storage/create.ts +16 -17
- package/src/cmd/cloud/storage/delete.ts +19 -20
- package/src/cmd/cloud/stream/get.ts +7 -7
- package/src/cmd/cloud/stream/list.ts +9 -6
- package/src/cmd/dev/download.ts +10 -2
- package/src/cmd/dev/index.ts +4 -4
- package/src/cmd/git/account/add.ts +5 -4
- package/src/cmd/git/link.ts +2 -2
- package/src/cmd/git/list.ts +7 -6
- package/src/cmd/project/auth/init.ts +6 -6
- package/src/cmd/project/auth/shared.ts +8 -3
- package/src/cmd/project/delete.ts +3 -2
- package/src/cmd/project/reconcile.ts +9 -5
- package/src/cmd/project/template-flow.ts +15 -5
- package/src/config.ts +3 -2
- package/src/domain.ts +4 -3
- package/src/internal-logger.ts +3 -2
- package/src/repl.ts +27 -14
- package/src/schema-parser.ts +4 -1
- package/src/sound.ts +2 -1
- package/src/steps.ts +11 -6
- package/src/terminal.ts +2 -1
- package/src/tsc-output-parser.ts +61 -38
- package/src/tui/prompt.ts +6 -2
- package/src/tui.ts +26 -17
- package/src/typescript-errors.ts +5 -2
- package/src/utils/date.ts +5 -1
- package/src/utils/deps.ts +5 -3
- package/src/utils/detectSubagent.ts +1 -1
- package/dist/cmd/ai/cadence/index.d.ts +0 -3
- package/dist/cmd/ai/cadence/index.d.ts.map +0 -1
- package/dist/cmd/ai/cadence/index.js +0 -35
- package/dist/cmd/ai/cadence/index.js.map +0 -1
- package/dist/cmd/ai/cadence/list.d.ts +0 -3
- package/dist/cmd/ai/cadence/list.d.ts.map +0 -1
- package/dist/cmd/ai/cadence/list.js +0 -167
- package/dist/cmd/ai/cadence/list.js.map +0 -1
- package/dist/cmd/ai/cadence/pause.d.ts +0 -3
- package/dist/cmd/ai/cadence/pause.d.ts.map +0 -1
- package/dist/cmd/ai/cadence/pause.js +0 -103
- package/dist/cmd/ai/cadence/pause.js.map +0 -1
- package/dist/cmd/ai/cadence/resume.d.ts +0 -3
- package/dist/cmd/ai/cadence/resume.d.ts.map +0 -1
- package/dist/cmd/ai/cadence/resume.js +0 -106
- package/dist/cmd/ai/cadence/resume.js.map +0 -1
- package/dist/cmd/ai/cadence/status.d.ts +0 -3
- package/dist/cmd/ai/cadence/status.d.ts.map +0 -1
- package/dist/cmd/ai/cadence/status.js +0 -129
- package/dist/cmd/ai/cadence/status.js.map +0 -1
- package/dist/cmd/ai/cadence/stop.d.ts +0 -3
- package/dist/cmd/ai/cadence/stop.d.ts.map +0 -1
- package/dist/cmd/ai/cadence/stop.js +0 -107
- package/dist/cmd/ai/cadence/stop.js.map +0 -1
- package/dist/cmd/ai/cadence/util.d.ts +0 -44
- package/dist/cmd/ai/cadence/util.d.ts.map +0 -1
- package/dist/cmd/ai/cadence/util.js +0 -52
- package/dist/cmd/ai/cadence/util.js.map +0 -1
- package/src/cmd/ai/cadence/index.ts +0 -36
- package/src/cmd/ai/cadence/list.ts +0 -183
- package/src/cmd/ai/cadence/pause.ts +0 -119
- package/src/cmd/ai/cadence/resume.ts +0 -124
- package/src/cmd/ai/cadence/status.ts +0 -141
- package/src/cmd/ai/cadence/stop.ts +0 -124
- package/src/cmd/ai/cadence/util.ts +0 -86
package/src/internal-logger.ts
CHANGED
|
@@ -434,12 +434,13 @@ export function getLatestLogSession(): string | null {
|
|
|
434
434
|
const entries = readdirSync(logsDir, { withFileTypes: true });
|
|
435
435
|
const dirs = entries.filter((e) => e.isDirectory()).map((e) => e.name);
|
|
436
436
|
|
|
437
|
-
|
|
437
|
+
const firstDir = dirs[0];
|
|
438
|
+
if (!firstDir) {
|
|
438
439
|
return null;
|
|
439
440
|
}
|
|
440
441
|
|
|
441
442
|
// Return the first directory (should be the only one due to cleanup)
|
|
442
|
-
return join(logsDir,
|
|
443
|
+
return join(logsDir, firstDir);
|
|
443
444
|
} catch {
|
|
444
445
|
return null;
|
|
445
446
|
}
|
package/src/repl.ts
CHANGED
|
@@ -184,6 +184,7 @@ function parseCommandLine(line: string): ParsedCommand {
|
|
|
184
184
|
// Parse remaining tokens into args and options
|
|
185
185
|
for (let i = 1; i < tokens.length; i++) {
|
|
186
186
|
const token = tokens[i];
|
|
187
|
+
if (token === undefined) continue;
|
|
187
188
|
|
|
188
189
|
if (token.startsWith('--')) {
|
|
189
190
|
// Long option: --name=value or --flag
|
|
@@ -194,8 +195,9 @@ function parseCommandLine(line: string): ParsedCommand {
|
|
|
194
195
|
options[name.slice(0, eqIndex)] = name.slice(eqIndex + 1);
|
|
195
196
|
} else {
|
|
196
197
|
// Check if next token is a value
|
|
197
|
-
|
|
198
|
-
|
|
198
|
+
const nextToken = tokens[i + 1];
|
|
199
|
+
if (i + 1 < tokens.length && nextToken !== undefined && !nextToken.startsWith('-')) {
|
|
200
|
+
options[name] = nextToken;
|
|
199
201
|
i++;
|
|
200
202
|
} else {
|
|
201
203
|
options[name] = true;
|
|
@@ -206,8 +208,9 @@ function parseCommandLine(line: string): ParsedCommand {
|
|
|
206
208
|
const name = token.slice(1);
|
|
207
209
|
|
|
208
210
|
// Check if next token is a value
|
|
209
|
-
|
|
210
|
-
|
|
211
|
+
const nextToken = tokens[i + 1];
|
|
212
|
+
if (i + 1 < tokens.length && nextToken !== undefined && !nextToken.startsWith('-')) {
|
|
213
|
+
options[name] = nextToken;
|
|
211
214
|
i++;
|
|
212
215
|
} else {
|
|
213
216
|
options[name] = true;
|
|
@@ -603,7 +606,7 @@ function getAutocompleteMatches(
|
|
|
603
606
|
if (!buffer.trim()) return [];
|
|
604
607
|
|
|
605
608
|
const tokens = buffer.trim().split(/\s+/);
|
|
606
|
-
const firstToken = tokens[0]
|
|
609
|
+
const firstToken = tokens[0]?.toLowerCase() ?? '';
|
|
607
610
|
|
|
608
611
|
// If we're typing the first word (no trailing space), suggest commands
|
|
609
612
|
if (tokens.length === 1 && buffer === buffer.trimEnd()) {
|
|
@@ -623,7 +626,7 @@ function getAutocompleteMatches(
|
|
|
623
626
|
if (tokens.length === 2 && buffer === buffer.trimEnd() && commandMap) {
|
|
624
627
|
const cmd = commandMap.get(firstToken);
|
|
625
628
|
if (cmd?.subcommands) {
|
|
626
|
-
const subToken = tokens[1]
|
|
629
|
+
const subToken = tokens[1]?.toLowerCase() ?? '';
|
|
627
630
|
return cmd.subcommands
|
|
628
631
|
.filter((sub) => sub.name.startsWith(subToken) && sub.name !== subToken)
|
|
629
632
|
.map((sub) => sub.name);
|
|
@@ -647,8 +650,10 @@ function getAutocompleteSuggestion(
|
|
|
647
650
|
if (matches.length === 0) return '';
|
|
648
651
|
|
|
649
652
|
const selectedMatch = matches[cycleIndex % matches.length];
|
|
653
|
+
if (selectedMatch === undefined) return '';
|
|
654
|
+
|
|
650
655
|
const tokens = buffer.trim().split(/\s+/);
|
|
651
|
-
const firstToken = tokens[0]
|
|
656
|
+
const firstToken = tokens[0]?.toLowerCase() ?? '';
|
|
652
657
|
|
|
653
658
|
// Typing first word (command name)
|
|
654
659
|
if (tokens.length === 1 && buffer === buffer.trimEnd()) {
|
|
@@ -675,7 +680,7 @@ function getAutocompleteSuggestion(
|
|
|
675
680
|
// Typing subcommand name
|
|
676
681
|
if (tokens.length === 2 && buffer === buffer.trimEnd()) {
|
|
677
682
|
const cmd = commandMap.get(firstToken);
|
|
678
|
-
const subToken = tokens[1];
|
|
683
|
+
const subToken = tokens[1] ?? '';
|
|
679
684
|
const subcommand = cmd?.subcommands?.find((sub) => sub.name === selectedMatch);
|
|
680
685
|
|
|
681
686
|
let suggestion = selectedMatch.slice(subToken.length);
|
|
@@ -791,7 +796,7 @@ class ActivityIndicator {
|
|
|
791
796
|
}
|
|
792
797
|
|
|
793
798
|
private draw() {
|
|
794
|
-
const frame = this.frames[this.currentFrame];
|
|
799
|
+
const frame = this.frames[this.currentFrame] ?? this.frames[0] ?? '⠋';
|
|
795
800
|
// Clear line, draw spinner, stay on same line
|
|
796
801
|
process.stdout.write('\r\x1b[K'); // Clear line from cursor
|
|
797
802
|
process.stdout.write(`${tui.muted(frame)} ${tui.muted(this.message)}...`);
|
|
@@ -855,6 +860,7 @@ async function showCommandPicker(
|
|
|
855
860
|
// Draw commands
|
|
856
861
|
for (let i = 0; i < commands.length; i++) {
|
|
857
862
|
const cmd = commands[i];
|
|
863
|
+
if (cmd === undefined) continue;
|
|
858
864
|
const isSelected = i === selectedIndex;
|
|
859
865
|
const prefix = isSelected ? '▶ ' : ' ';
|
|
860
866
|
const style = isSelected ? '\x1b[7m' : ''; // Reverse video for selected
|
|
@@ -913,7 +919,11 @@ async function showCommandPicker(
|
|
|
913
919
|
const selected = commands[selectedIndex];
|
|
914
920
|
cleanup();
|
|
915
921
|
clearPicker();
|
|
916
|
-
|
|
922
|
+
if (selected) {
|
|
923
|
+
resolve(selected.name + (selected.argHint ? ' ' : ''));
|
|
924
|
+
} else {
|
|
925
|
+
resolve(null);
|
|
926
|
+
}
|
|
917
927
|
return;
|
|
918
928
|
}
|
|
919
929
|
|
|
@@ -957,6 +967,7 @@ function applySyntaxHighlighting(buffer: string, commands: string[]): string {
|
|
|
957
967
|
|
|
958
968
|
for (let i = 0; i < tokens.length; i++) {
|
|
959
969
|
const token = tokens[i];
|
|
970
|
+
if (token === undefined) continue;
|
|
960
971
|
|
|
961
972
|
// Skip whitespace
|
|
962
973
|
if (/^\s+$/.test(token)) {
|
|
@@ -1018,7 +1029,8 @@ async function readLine(
|
|
|
1018
1029
|
|
|
1019
1030
|
const searchHistory = (query: string, startFrom: number): number => {
|
|
1020
1031
|
for (let i = startFrom - 1; i >= 0; i--) {
|
|
1021
|
-
|
|
1032
|
+
const historyEntry = history[i];
|
|
1033
|
+
if (historyEntry !== undefined && historyEntry.toLowerCase().includes(query.toLowerCase())) {
|
|
1022
1034
|
return i;
|
|
1023
1035
|
}
|
|
1024
1036
|
}
|
|
@@ -1057,7 +1069,8 @@ async function readLine(
|
|
|
1057
1069
|
}
|
|
1058
1070
|
const linePrompt = currentLineIndex === 0 ? prompt : '... ';
|
|
1059
1071
|
process.stdout.write('\r');
|
|
1060
|
-
|
|
1072
|
+
const currentLine = lines[currentLineIndex] ?? '';
|
|
1073
|
+
process.stdout.write(linePrompt + currentLine.slice(0, cursorPos));
|
|
1061
1074
|
} else {
|
|
1062
1075
|
// Single-line mode (original behavior)
|
|
1063
1076
|
process.stdout.write('\r\x1b[K');
|
|
@@ -1282,7 +1295,7 @@ async function readLine(
|
|
|
1282
1295
|
lines.push('');
|
|
1283
1296
|
currentLineIndex++;
|
|
1284
1297
|
cursorPos = 0;
|
|
1285
|
-
buffer = lines[currentLineIndex];
|
|
1298
|
+
buffer = lines[currentLineIndex] ?? '';
|
|
1286
1299
|
process.stdout.write('\n');
|
|
1287
1300
|
process.stdout.write('... ');
|
|
1288
1301
|
return;
|
|
@@ -1293,7 +1306,7 @@ async function readLine(
|
|
|
1293
1306
|
if (searchMode) {
|
|
1294
1307
|
// Accept search result
|
|
1295
1308
|
if (searchResultIndex >= 0) {
|
|
1296
|
-
buffer = history[searchResultIndex];
|
|
1309
|
+
buffer = history[searchResultIndex] ?? '';
|
|
1297
1310
|
}
|
|
1298
1311
|
searchMode = false;
|
|
1299
1312
|
process.stdout.write('\n');
|
package/src/schema-parser.ts
CHANGED
|
@@ -373,7 +373,10 @@ export function buildValidationInput(
|
|
|
373
373
|
if (schemas.args) {
|
|
374
374
|
const parsed = parseArgsSchema(schemas.args);
|
|
375
375
|
for (let i = 0; i < parsed.names.length; i++) {
|
|
376
|
-
|
|
376
|
+
const name = parsed.names[i];
|
|
377
|
+
if (name !== undefined) {
|
|
378
|
+
result.args[name] = rawArgs[i];
|
|
379
|
+
}
|
|
377
380
|
}
|
|
378
381
|
}
|
|
379
382
|
|
package/src/sound.ts
CHANGED
|
@@ -17,7 +17,8 @@ export function playSound(): void {
|
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
const executable = command[0];
|
|
21
|
+
if (process.stdout.isTTY && executable && Bun.which(executable)) {
|
|
21
22
|
try {
|
|
22
23
|
Bun.spawn(command, {
|
|
23
24
|
stdio: ['ignore', 'ignore', 'ignore'],
|
package/src/steps.ts
CHANGED
|
@@ -177,6 +177,7 @@ function renderAllSteps(
|
|
|
177
177
|
|
|
178
178
|
for (let i = 0; i < state.length; i++) {
|
|
179
179
|
const step = state[i];
|
|
180
|
+
if (step === undefined) continue;
|
|
180
181
|
const isRunning = i === runningStepIndex;
|
|
181
182
|
const stepSpinner = isRunning && spinner ? spinner : undefined;
|
|
182
183
|
|
|
@@ -384,9 +385,10 @@ async function runStepsTUI(steps: Step[]): Promise<void> {
|
|
|
384
385
|
const forceRerender = (skipMove = false) => {
|
|
385
386
|
if (currentStepIndex < 0 || currentStepIndex >= state.length) return;
|
|
386
387
|
|
|
387
|
-
const colorKey = SPINNER_COLORS[currentFrameIndex % SPINNER_COLORS.length];
|
|
388
|
+
const colorKey = SPINNER_COLORS[currentFrameIndex % SPINNER_COLORS.length] ?? 'cyan';
|
|
388
389
|
const color = getColor(colorKey);
|
|
389
|
-
const
|
|
390
|
+
const frame = FRAMES[currentFrameIndex % FRAMES.length] ?? FRAMES[0] ?? '◐';
|
|
391
|
+
const spinner = `${color}${COLORS.bold}${frame}${COLORS.reset}`;
|
|
390
392
|
const rendered = renderAllSteps(state, currentStepIndex, spinner);
|
|
391
393
|
|
|
392
394
|
// Optionally move up, then to column 0
|
|
@@ -421,15 +423,17 @@ async function runStepsTUI(steps: Step[]): Promise<void> {
|
|
|
421
423
|
|
|
422
424
|
const step = steps[stepIndex];
|
|
423
425
|
const stepState = state[stepIndex];
|
|
426
|
+
if (step === undefined || stepState === undefined) continue;
|
|
424
427
|
stepState.status = 'running';
|
|
425
428
|
|
|
426
429
|
// Start spinner animation
|
|
427
430
|
activeInterval = setInterval(() => {
|
|
428
431
|
if (isPaused) return;
|
|
429
432
|
|
|
430
|
-
const colorKey = SPINNER_COLORS[currentFrameIndex % SPINNER_COLORS.length];
|
|
433
|
+
const colorKey = SPINNER_COLORS[currentFrameIndex % SPINNER_COLORS.length] ?? 'cyan';
|
|
431
434
|
const color = getColor(colorKey);
|
|
432
|
-
const
|
|
435
|
+
const frame = FRAMES[currentFrameIndex % FRAMES.length] ?? FRAMES[0] ?? '◐';
|
|
436
|
+
const spinner = `${color}${COLORS.bold}${frame}${COLORS.reset}`;
|
|
433
437
|
|
|
434
438
|
// Render all steps from state
|
|
435
439
|
const rendered = renderAllSteps(state, currentStepIndex, spinner);
|
|
@@ -453,9 +457,10 @@ async function runStepsTUI(steps: Step[]): Promise<void> {
|
|
|
453
457
|
stepState.progress = Math.min(100, Math.max(0, progress));
|
|
454
458
|
|
|
455
459
|
// Render all steps from state
|
|
456
|
-
const colorKey = SPINNER_COLORS[currentFrameIndex % SPINNER_COLORS.length];
|
|
460
|
+
const colorKey = SPINNER_COLORS[currentFrameIndex % SPINNER_COLORS.length] ?? 'cyan';
|
|
457
461
|
const color = getColor(colorKey);
|
|
458
|
-
const
|
|
462
|
+
const frame = FRAMES[currentFrameIndex % FRAMES.length] ?? FRAMES[0] ?? '◐';
|
|
463
|
+
const spinner = `${color}${COLORS.bold}${frame}${COLORS.reset}`;
|
|
459
464
|
const rendered = renderAllSteps(state, currentStepIndex, spinner);
|
|
460
465
|
|
|
461
466
|
// Move to start, clear, render
|
package/src/terminal.ts
CHANGED
|
@@ -99,7 +99,8 @@ async function queryTerminalBackground(): Promise<RGBColor | null> {
|
|
|
99
99
|
|
|
100
100
|
// Parse RGB values - they can be different bit depths
|
|
101
101
|
// Normalize to 8-bit (0-255) by taking the most significant bits
|
|
102
|
-
const parseColorValue = (hex: string): number => {
|
|
102
|
+
const parseColorValue = (hex: string | undefined): number => {
|
|
103
|
+
if (!hex) return 0;
|
|
103
104
|
if (hex.length === 4) {
|
|
104
105
|
// 16-bit: RRRR -> take first 2 chars
|
|
105
106
|
return parseInt(hex.slice(0, 2), 16);
|
package/src/tsc-output-parser.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// @ts-nocheck
|
|
1
3
|
/**
|
|
2
4
|
* TSC Output Parser
|
|
3
5
|
*
|
|
@@ -12,6 +14,9 @@
|
|
|
12
14
|
*
|
|
13
15
|
* Generated by PEG.js v. 0.10.0 (ts-pegjs plugin v. 0.2.7)
|
|
14
16
|
* https://pegjs.org/ https://github.com/metadevpro/ts-pegjs
|
|
17
|
+
*
|
|
18
|
+
* NOTE: This file is auto-generated. Do not edit manually.
|
|
19
|
+
* TypeScript and ESLint checks are disabled for this file.
|
|
15
20
|
*/
|
|
16
21
|
|
|
17
22
|
export interface GrammarPath {
|
|
@@ -158,8 +163,10 @@ class SyntaxError extends Error {
|
|
|
158
163
|
|
|
159
164
|
if (descriptions.length > 0) {
|
|
160
165
|
for (i = 1, j = 1; i < descriptions.length; i++) {
|
|
161
|
-
|
|
162
|
-
|
|
166
|
+
const prevDesc = descriptions[i - 1];
|
|
167
|
+
const currDesc = descriptions[i];
|
|
168
|
+
if (prevDesc !== currDesc && currDesc !== undefined) {
|
|
169
|
+
descriptions[j] = currDesc;
|
|
163
170
|
j++;
|
|
164
171
|
}
|
|
165
172
|
}
|
|
@@ -168,14 +175,14 @@ class SyntaxError extends Error {
|
|
|
168
175
|
|
|
169
176
|
switch (descriptions.length) {
|
|
170
177
|
case 1:
|
|
171
|
-
return descriptions[0];
|
|
178
|
+
return descriptions[0] ?? '';
|
|
172
179
|
case 2:
|
|
173
|
-
return descriptions[0] + ' or ' + descriptions[1];
|
|
180
|
+
return (descriptions[0] ?? '') + ' or ' + (descriptions[1] ?? '');
|
|
174
181
|
default:
|
|
175
182
|
return (
|
|
176
183
|
descriptions.slice(0, -1).join(', ') +
|
|
177
184
|
', or ' +
|
|
178
|
-
descriptions[descriptions.length - 1]
|
|
185
|
+
(descriptions[descriptions.length - 1] ?? '')
|
|
179
186
|
);
|
|
180
187
|
}
|
|
181
188
|
}
|
|
@@ -187,11 +194,11 @@ class SyntaxError extends Error {
|
|
|
187
194
|
return 'Expected ' + describeExpected(expected) + ' but ' + describeFound(found) + ' found.';
|
|
188
195
|
}
|
|
189
196
|
|
|
190
|
-
public message: string;
|
|
197
|
+
public override message: string;
|
|
191
198
|
public expected: Expectation[];
|
|
192
199
|
public found: string | null;
|
|
193
200
|
public location: IFileRange;
|
|
194
|
-
public name: string;
|
|
201
|
+
public override name: string;
|
|
195
202
|
|
|
196
203
|
constructor(
|
|
197
204
|
message: string,
|
|
@@ -342,7 +349,10 @@ function peg$parse(input: string, options?: IParseOptions): GrammarItem[] {
|
|
|
342
349
|
if (!(options.startRule in peg$startRuleFunctions)) {
|
|
343
350
|
throw new Error('Can\'t start parsing from rule "' + options.startRule + '".');
|
|
344
351
|
}
|
|
345
|
-
|
|
352
|
+
const startFn = peg$startRuleFunctions[options.startRule];
|
|
353
|
+
if (startFn) {
|
|
354
|
+
peg$startRuleFunction = startFn;
|
|
355
|
+
}
|
|
346
356
|
}
|
|
347
357
|
|
|
348
358
|
function peg$literalExpectation(text1: string, ignoreCase: boolean): ILiteralExpectation {
|
|
@@ -363,7 +373,7 @@ function peg$parse(input: string, options?: IParseOptions): GrammarItem[] {
|
|
|
363
373
|
|
|
364
374
|
function peg$computePosDetails(pos: number) {
|
|
365
375
|
let details = peg$posDetailsCache[pos];
|
|
366
|
-
let p;
|
|
376
|
+
let p: number;
|
|
367
377
|
|
|
368
378
|
if (details) {
|
|
369
379
|
return details;
|
|
@@ -373,10 +383,10 @@ function peg$parse(input: string, options?: IParseOptions): GrammarItem[] {
|
|
|
373
383
|
p--;
|
|
374
384
|
}
|
|
375
385
|
|
|
376
|
-
|
|
386
|
+
const cachedDetails = peg$posDetailsCache[p];
|
|
377
387
|
details = {
|
|
378
|
-
line:
|
|
379
|
-
column:
|
|
388
|
+
line: cachedDetails?.line ?? 1,
|
|
389
|
+
column: cachedDetails?.column ?? 1,
|
|
380
390
|
};
|
|
381
391
|
|
|
382
392
|
while (p < pos) {
|
|
@@ -440,10 +450,11 @@ function peg$parse(input: string, options?: IParseOptions): GrammarItem[] {
|
|
|
440
450
|
}
|
|
441
451
|
|
|
442
452
|
function peg$parseMain(): unknown {
|
|
443
|
-
|
|
453
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
454
|
+
let s0: any, s1: any, s2: any, s3: any;
|
|
444
455
|
|
|
445
456
|
const key = peg$currPos * 13 + 0;
|
|
446
|
-
const cached: ICached = peg$resultsCache[key];
|
|
457
|
+
const cached: ICached | undefined = peg$resultsCache[key];
|
|
447
458
|
|
|
448
459
|
if (cached) {
|
|
449
460
|
peg$currPos = cached.nextPos;
|
|
@@ -484,10 +495,11 @@ function peg$parse(input: string, options?: IParseOptions): GrammarItem[] {
|
|
|
484
495
|
}
|
|
485
496
|
|
|
486
497
|
function peg$parseItem(): unknown {
|
|
487
|
-
|
|
498
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
499
|
+
let s0: any, s1: any, s2: any, s3: any, s4: any, s5: any, s6: any, s7: any, s8: any;
|
|
488
500
|
|
|
489
501
|
const key = peg$currPos * 13 + 1;
|
|
490
|
-
const cached: ICached = peg$resultsCache[key];
|
|
502
|
+
const cached: ICached | undefined = peg$resultsCache[key];
|
|
491
503
|
|
|
492
504
|
if (cached) {
|
|
493
505
|
peg$currPos = cached.nextPos;
|
|
@@ -569,10 +581,11 @@ function peg$parse(input: string, options?: IParseOptions): GrammarItem[] {
|
|
|
569
581
|
}
|
|
570
582
|
|
|
571
583
|
function peg$parseMessage(): unknown {
|
|
572
|
-
|
|
584
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
585
|
+
let s0: any, s1: any, s2: any, s3: any;
|
|
573
586
|
|
|
574
587
|
const key = peg$currPos * 13 + 2;
|
|
575
|
-
const cached: ICached = peg$resultsCache[key];
|
|
588
|
+
const cached: ICached | undefined = peg$resultsCache[key];
|
|
576
589
|
|
|
577
590
|
if (cached) {
|
|
578
591
|
peg$currPos = cached.nextPos;
|
|
@@ -607,10 +620,11 @@ function peg$parse(input: string, options?: IParseOptions): GrammarItem[] {
|
|
|
607
620
|
}
|
|
608
621
|
|
|
609
622
|
function peg$parseMessageExtraLine(): unknown {
|
|
610
|
-
|
|
623
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
624
|
+
let s0: any, s1: any, s2: any;
|
|
611
625
|
|
|
612
626
|
const key = peg$currPos * 13 + 3;
|
|
613
|
-
const cached: ICached = peg$resultsCache[key];
|
|
627
|
+
const cached: ICached | undefined = peg$resultsCache[key];
|
|
614
628
|
|
|
615
629
|
if (cached) {
|
|
616
630
|
peg$currPos = cached.nextPos;
|
|
@@ -640,10 +654,11 @@ function peg$parse(input: string, options?: IParseOptions): GrammarItem[] {
|
|
|
640
654
|
}
|
|
641
655
|
|
|
642
656
|
function peg$parseMessageExtraLineStart(): unknown {
|
|
643
|
-
|
|
657
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
658
|
+
let s0: any, s1: any;
|
|
644
659
|
|
|
645
660
|
const key = peg$currPos * 13 + 4;
|
|
646
|
-
const cached: ICached = peg$resultsCache[key];
|
|
661
|
+
const cached: ICached | undefined = peg$resultsCache[key];
|
|
647
662
|
|
|
648
663
|
if (cached) {
|
|
649
664
|
peg$currPos = cached.nextPos;
|
|
@@ -672,10 +687,11 @@ function peg$parse(input: string, options?: IParseOptions): GrammarItem[] {
|
|
|
672
687
|
}
|
|
673
688
|
|
|
674
689
|
function peg$parseTsError(): unknown {
|
|
675
|
-
|
|
690
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
691
|
+
let s0: any, s1: any, s2: any, s3: any;
|
|
676
692
|
|
|
677
693
|
const key = peg$currPos * 13 + 5;
|
|
678
|
-
const cached: ICached = peg$resultsCache[key];
|
|
694
|
+
const cached: ICached | undefined = peg$resultsCache[key];
|
|
679
695
|
|
|
680
696
|
if (cached) {
|
|
681
697
|
peg$currPos = cached.nextPos;
|
|
@@ -719,10 +735,11 @@ function peg$parse(input: string, options?: IParseOptions): GrammarItem[] {
|
|
|
719
735
|
}
|
|
720
736
|
|
|
721
737
|
function peg$parseTsErrorType(): unknown {
|
|
722
|
-
|
|
738
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
739
|
+
let s0: any, s1: any;
|
|
723
740
|
|
|
724
741
|
const key = peg$currPos * 13 + 6;
|
|
725
|
-
const cached: ICached = peg$resultsCache[key];
|
|
742
|
+
const cached: ICached | undefined = peg$resultsCache[key];
|
|
726
743
|
|
|
727
744
|
if (cached) {
|
|
728
745
|
peg$currPos = cached.nextPos;
|
|
@@ -762,10 +779,11 @@ function peg$parse(input: string, options?: IParseOptions): GrammarItem[] {
|
|
|
762
779
|
}
|
|
763
780
|
|
|
764
781
|
function peg$parseCursor(): unknown {
|
|
765
|
-
|
|
782
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
783
|
+
let s0: any, s1: any, s2: any, s3: any, s4: any, s5: any, s6: any, s7: any, s8: any, s9: any;
|
|
766
784
|
|
|
767
785
|
const key = peg$currPos * 13 + 7;
|
|
768
|
-
const cached: ICached = peg$resultsCache[key];
|
|
786
|
+
const cached: ICached | undefined = peg$resultsCache[key];
|
|
769
787
|
|
|
770
788
|
if (cached) {
|
|
771
789
|
peg$currPos = cached.nextPos;
|
|
@@ -861,10 +879,11 @@ function peg$parse(input: string, options?: IParseOptions): GrammarItem[] {
|
|
|
861
879
|
}
|
|
862
880
|
|
|
863
881
|
function peg$parsePath(): unknown {
|
|
864
|
-
|
|
882
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
883
|
+
let s0: any, s1: any, s2: any;
|
|
865
884
|
|
|
866
885
|
const key = peg$currPos * 13 + 8;
|
|
867
|
-
const cached: ICached = peg$resultsCache[key];
|
|
886
|
+
const cached: ICached | undefined = peg$resultsCache[key];
|
|
868
887
|
|
|
869
888
|
if (cached) {
|
|
870
889
|
peg$currPos = cached.nextPos;
|
|
@@ -910,10 +929,11 @@ function peg$parse(input: string, options?: IParseOptions): GrammarItem[] {
|
|
|
910
929
|
}
|
|
911
930
|
|
|
912
931
|
function peg$parseTextLine(): unknown {
|
|
913
|
-
|
|
932
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
933
|
+
let s0: any, s1: any, s2: any, s3: any;
|
|
914
934
|
|
|
915
935
|
const key = peg$currPos * 13 + 9;
|
|
916
|
-
const cached: ICached = peg$resultsCache[key];
|
|
936
|
+
const cached: ICached | undefined = peg$resultsCache[key];
|
|
917
937
|
|
|
918
938
|
if (cached) {
|
|
919
939
|
peg$currPos = cached.nextPos;
|
|
@@ -973,10 +993,11 @@ function peg$parse(input: string, options?: IParseOptions): GrammarItem[] {
|
|
|
973
993
|
}
|
|
974
994
|
|
|
975
995
|
function peg$parseAnyCharExceptNewLine(): unknown {
|
|
976
|
-
|
|
996
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
997
|
+
let s0: any;
|
|
977
998
|
|
|
978
999
|
const key = peg$currPos * 13 + 10;
|
|
979
|
-
const cached: ICached = peg$resultsCache[key];
|
|
1000
|
+
const cached: ICached | undefined = peg$resultsCache[key];
|
|
980
1001
|
|
|
981
1002
|
if (cached) {
|
|
982
1003
|
peg$currPos = cached.nextPos;
|
|
@@ -999,10 +1020,11 @@ function peg$parse(input: string, options?: IParseOptions): GrammarItem[] {
|
|
|
999
1020
|
}
|
|
1000
1021
|
|
|
1001
1022
|
function peg$parseInteger(): unknown {
|
|
1002
|
-
|
|
1023
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1024
|
+
let s0: any, s1: any, s2: any;
|
|
1003
1025
|
|
|
1004
1026
|
const key = peg$currPos * 13 + 11;
|
|
1005
|
-
const cached: ICached = peg$resultsCache[key];
|
|
1027
|
+
const cached: ICached | undefined = peg$resultsCache[key];
|
|
1006
1028
|
|
|
1007
1029
|
if (cached) {
|
|
1008
1030
|
peg$currPos = cached.nextPos;
|
|
@@ -1048,10 +1070,11 @@ function peg$parse(input: string, options?: IParseOptions): GrammarItem[] {
|
|
|
1048
1070
|
}
|
|
1049
1071
|
|
|
1050
1072
|
function peg$parse_(): unknown {
|
|
1051
|
-
|
|
1073
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1074
|
+
let s0: any, s1: any, s2: any;
|
|
1052
1075
|
|
|
1053
1076
|
const key = peg$currPos * 13 + 12;
|
|
1054
|
-
const cached: ICached = peg$resultsCache[key];
|
|
1077
|
+
const cached: ICached | undefined = peg$resultsCache[key];
|
|
1055
1078
|
|
|
1056
1079
|
if (cached) {
|
|
1057
1080
|
peg$currPos = cached.nextPos;
|
package/src/tui/prompt.ts
CHANGED
|
@@ -347,6 +347,10 @@ export class PromptFlow {
|
|
|
347
347
|
} else if (key.name === 'return') {
|
|
348
348
|
cleanup();
|
|
349
349
|
const selected = choices[selectedIndex];
|
|
350
|
+
if (!selected) {
|
|
351
|
+
reject(new Error('No selection available'));
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
350
354
|
|
|
351
355
|
// Clear all lines (message + all choices)
|
|
352
356
|
const totalLines = choices.length + 1;
|
|
@@ -462,8 +466,8 @@ export class PromptFlow {
|
|
|
462
466
|
|
|
463
467
|
// Sort indices to get consistent order for both values and labels
|
|
464
468
|
const sortedIndices = Array.from(selected).sort((a, b) => a - b);
|
|
465
|
-
const values = sortedIndices.map((i) => choices[i]
|
|
466
|
-
const labels = sortedIndices.map((i) => choices[i]
|
|
469
|
+
const values = sortedIndices.map((i) => choices[i]?.value).filter((v) => v !== undefined);
|
|
470
|
+
const labels = sortedIndices.map((i) => choices[i]?.label).filter((l) => l !== undefined);
|
|
467
471
|
|
|
468
472
|
// Clear all lines (message + all choices)
|
|
469
473
|
const totalLines = choices.length + 1;
|
package/src/tui.ts
CHANGED
|
@@ -485,7 +485,9 @@ export function truncateToWidth(str: string, maxWidth: number, ellipsis = '...')
|
|
|
485
485
|
const targetWidth = maxWidth - ellipsis.length;
|
|
486
486
|
|
|
487
487
|
for (let i = 0; i < segments.length; i++) {
|
|
488
|
-
const
|
|
488
|
+
const seg = segments[i];
|
|
489
|
+
if (!seg) continue;
|
|
490
|
+
const segment = seg.segment;
|
|
489
491
|
const segmentWidth = Bun.stringWidth(segment);
|
|
490
492
|
|
|
491
493
|
if (currentWidth + segmentWidth > targetWidth) {
|
|
@@ -493,7 +495,7 @@ export function truncateToWidth(str: string, maxWidth: number, ellipsis = '...')
|
|
|
493
495
|
}
|
|
494
496
|
|
|
495
497
|
currentWidth += segmentWidth;
|
|
496
|
-
cutIndex =
|
|
498
|
+
cutIndex = seg.index + segment.length;
|
|
497
499
|
}
|
|
498
500
|
|
|
499
501
|
// Now reconstruct with ANSI codes preserved
|
|
@@ -1027,8 +1029,9 @@ export function wrapText(text: string, maxWidth: number): string[] {
|
|
|
1027
1029
|
// ensure each wrapped line ends with reset (only for this paragraph's lines)
|
|
1028
1030
|
if (leadingCodes && hasReset) {
|
|
1029
1031
|
for (let i = paragraphStart; i < allLines.length; i++) {
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
+
const line = allLines[i];
|
|
1033
|
+
if (line !== undefined && !endsWithReset(line)) {
|
|
1034
|
+
allLines[i] = line + getColor('reset');
|
|
1032
1035
|
}
|
|
1033
1036
|
}
|
|
1034
1037
|
}
|
|
@@ -1252,9 +1255,9 @@ export async function spinner<T>(
|
|
|
1252
1255
|
process.stderr.write(`\x1b[${linesRendered}A`);
|
|
1253
1256
|
}
|
|
1254
1257
|
|
|
1255
|
-
const colorDef = spinnerColors[frameIndex % spinnerColors.length];
|
|
1256
|
-
const color = colorDef[currentColorScheme];
|
|
1257
|
-
const frame = `${color}${bold}${frames[frameIndex % frames.length]}${reset}`;
|
|
1258
|
+
const colorDef = spinnerColors[frameIndex % spinnerColors.length] ?? spinnerColors[0];
|
|
1259
|
+
const color = colorDef?.[currentColorScheme] ?? '';
|
|
1260
|
+
const frame = `${color}${bold}${frames[frameIndex % frames.length] ?? ''}${reset}`;
|
|
1258
1261
|
|
|
1259
1262
|
// Add progress indicator or countdown timer if available
|
|
1260
1263
|
let indicator = '';
|
|
@@ -1780,7 +1783,7 @@ export async function selectOrganization(
|
|
|
1780
1783
|
}
|
|
1781
1784
|
|
|
1782
1785
|
// Auto-select if only one org (regardless of TTY mode)
|
|
1783
|
-
if (orgs.length === 1) {
|
|
1786
|
+
if (orgs.length === 1 && orgs[0]) {
|
|
1784
1787
|
return orgs[0].id;
|
|
1785
1788
|
}
|
|
1786
1789
|
|
|
@@ -1798,11 +1801,14 @@ export async function selectOrganization(
|
|
|
1798
1801
|
if (isNonInteractive) {
|
|
1799
1802
|
// In non-interactive mode with multiple orgs, auto-select first org
|
|
1800
1803
|
// This allows scripts and CI/CD to work without explicit org selection
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1804
|
+
const firstOrg = orgs[0];
|
|
1805
|
+
if (firstOrg) {
|
|
1806
|
+
warning(
|
|
1807
|
+
`Multiple organizations found. Auto-selecting first org: ${firstOrg.name}. ` +
|
|
1808
|
+
`Set AGENTUITY_CLOUD_ORG_ID or use --org-id to specify a different org.`
|
|
1809
|
+
);
|
|
1810
|
+
return firstOrg.id;
|
|
1811
|
+
}
|
|
1806
1812
|
}
|
|
1807
1813
|
|
|
1808
1814
|
// Interactive mode with no saved preference - prompt user
|
|
@@ -1888,8 +1894,9 @@ export async function showProfileList(
|
|
|
1888
1894
|
// If non-interactive, return initial or first
|
|
1889
1895
|
if (!process.stdin.isTTY) {
|
|
1890
1896
|
if (initial) return initial;
|
|
1891
|
-
|
|
1892
|
-
|
|
1897
|
+
const firstProfile = profiles[0];
|
|
1898
|
+
if (profiles.length === 1 && firstProfile) {
|
|
1899
|
+
return firstProfile.name;
|
|
1893
1900
|
}
|
|
1894
1901
|
fatal(
|
|
1895
1902
|
'Profile selection required but cannot prompt in non-interactive environment. ' +
|
|
@@ -2017,6 +2024,7 @@ function renderVerticalTable<T extends Record<string, unknown>>(
|
|
|
2017
2024
|
|
|
2018
2025
|
for (let i = 0; i < data.length; i++) {
|
|
2019
2026
|
const row = data[i];
|
|
2027
|
+
if (!row) continue;
|
|
2020
2028
|
|
|
2021
2029
|
for (const colName of columnNames) {
|
|
2022
2030
|
const value = row[colName];
|
|
@@ -2071,10 +2079,11 @@ export function table<T extends Record<string, unknown>>(
|
|
|
2071
2079
|
colAligns = columnConfigs.map((col) => col.alignment || 'left');
|
|
2072
2080
|
} else {
|
|
2073
2081
|
// Simple mode: determine column names from data or columns parameter
|
|
2082
|
+
const firstRow = data[0];
|
|
2074
2083
|
columnNames = columns
|
|
2075
2084
|
? (columns as (keyof T)[]).map((c) => String(c))
|
|
2076
|
-
: data.length > 0
|
|
2077
|
-
? Object.keys(
|
|
2085
|
+
: data.length > 0 && firstRow
|
|
2086
|
+
? Object.keys(firstRow)
|
|
2078
2087
|
: [];
|
|
2079
2088
|
colAligns = columnNames.map(() => 'left' as const);
|
|
2080
2089
|
}
|
package/src/typescript-errors.ts
CHANGED
|
@@ -129,9 +129,12 @@ async function getSourceContext(
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
const currentOriginal = lines[lineNumber - 1];
|
|
132
|
+
if (currentOriginal === undefined) {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
132
135
|
const current = expandTabs(currentOriginal);
|
|
133
|
-
const beforeRaw = lineNumber > 1 ? lines[lineNumber - 2] : null;
|
|
134
|
-
const afterRaw = lineNumber < lines.length ? lines[lineNumber] : null;
|
|
136
|
+
const beforeRaw = lineNumber > 1 ? (lines[lineNumber - 2] ?? null) : null;
|
|
137
|
+
const afterRaw = lineNumber < lines.length ? (lines[lineNumber] ?? null) : null;
|
|
135
138
|
const before = beforeRaw !== null && beforeRaw.trim() !== '' ? expandTabs(beforeRaw) : null;
|
|
136
139
|
const after = afterRaw !== null && afterRaw.trim() !== '' ? expandTabs(afterRaw) : null;
|
|
137
140
|
|