groundcrew-cli 0.15.8 → 0.15.9
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/index.js +16 -7
- package/package.json +1 -1
- package/src/index.ts +25 -10
package/dist/index.js
CHANGED
|
@@ -467,13 +467,6 @@ function setupInlineSuggestions(rl) {
|
|
|
467
467
|
};
|
|
468
468
|
process.stdin.on("keypress", (_ch, key) => {
|
|
469
469
|
if (!key) return;
|
|
470
|
-
if (key.ctrl && key.name === "j") {
|
|
471
|
-
const line = rl.line;
|
|
472
|
-
rl.line = line + "\\";
|
|
473
|
-
rl.cursor = rl.line.length;
|
|
474
|
-
rl._line();
|
|
475
|
-
return;
|
|
476
|
-
}
|
|
477
470
|
clearGhost();
|
|
478
471
|
if (key.name !== "return" && key.name !== "tab") {
|
|
479
472
|
setImmediate(showGhost);
|
|
@@ -481,6 +474,21 @@ function setupInlineSuggestions(rl) {
|
|
|
481
474
|
});
|
|
482
475
|
}
|
|
483
476
|
async function chat(explicitSession) {
|
|
477
|
+
process.stdout.write("\x1B[>1u");
|
|
478
|
+
const originalStdinEmit = process.stdin.emit.bind(process.stdin);
|
|
479
|
+
let pendingShiftEnter = false;
|
|
480
|
+
process.stdin.emit = function(event, ...args) {
|
|
481
|
+
if (event === "data") {
|
|
482
|
+
const data = args[0];
|
|
483
|
+
const str = typeof data === "string" ? data : data.toString();
|
|
484
|
+
if (str.includes("\x1B[13;2u")) {
|
|
485
|
+
pendingShiftEnter = true;
|
|
486
|
+
const replaced = str.replace(/\x1b\[13;2u/g, "\\\r");
|
|
487
|
+
return originalStdinEmit(event, Buffer.from(replaced));
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
return originalStdinEmit(event, ...args);
|
|
491
|
+
};
|
|
484
492
|
const rl = readline.createInterface({
|
|
485
493
|
input: process.stdin,
|
|
486
494
|
output: process.stdout,
|
|
@@ -535,6 +543,7 @@ async function chat(explicitSession) {
|
|
|
535
543
|
console.log();
|
|
536
544
|
let continuationBuffer = [];
|
|
537
545
|
rl.on("close", () => {
|
|
546
|
+
process.stdout.write("\x1B[<u");
|
|
538
547
|
console.log(dim("\nBye."));
|
|
539
548
|
process.exit(0);
|
|
540
549
|
});
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -622,15 +622,6 @@ function setupInlineSuggestions(rl: readline.Interface): void {
|
|
|
622
622
|
process.stdin.on("keypress", (_ch: string, key: any) => {
|
|
623
623
|
if (!key) return;
|
|
624
624
|
|
|
625
|
-
// Ctrl+J: insert line continuation (Shift+Enter not detectable in most terminals)
|
|
626
|
-
if (key.ctrl && key.name === "j") {
|
|
627
|
-
const line = (rl as any).line as string;
|
|
628
|
-
(rl as any).line = line + "\\";
|
|
629
|
-
(rl as any).cursor = (rl as any).line.length;
|
|
630
|
-
// Simulate Enter to trigger continuation prompt
|
|
631
|
-
(rl as any)._line();
|
|
632
|
-
return;
|
|
633
|
-
}
|
|
634
625
|
|
|
635
626
|
clearGhost();
|
|
636
627
|
if (key.name !== "return" && key.name !== "tab") {
|
|
@@ -640,6 +631,29 @@ function setupInlineSuggestions(rl: readline.Interface): void {
|
|
|
640
631
|
}
|
|
641
632
|
|
|
642
633
|
async function chat(explicitSession?: string): Promise<void> {
|
|
634
|
+
// Enable Kitty keyboard protocol for Shift+Enter detection
|
|
635
|
+
// iTerm2, Kitty, WezTerm, and other modern terminals support this
|
|
636
|
+
process.stdout.write("\x1b[>1u");
|
|
637
|
+
|
|
638
|
+
// Intercept raw stdin to detect Shift+Enter (\x1b[13;2u) before readline
|
|
639
|
+
// Transform it into backslash + Enter for line continuation
|
|
640
|
+
const originalStdinEmit = process.stdin.emit.bind(process.stdin);
|
|
641
|
+
let pendingShiftEnter = false;
|
|
642
|
+
process.stdin.emit = function (event: string, ...args: any[]) {
|
|
643
|
+
if (event === "data") {
|
|
644
|
+
const data = args[0] as Buffer | string;
|
|
645
|
+
const str = typeof data === "string" ? data : data.toString();
|
|
646
|
+
if (str.includes("\x1b[13;2u")) {
|
|
647
|
+
// Shift+Enter detected — append backslash and submit for continuation
|
|
648
|
+
pendingShiftEnter = true;
|
|
649
|
+
// Replace the Kitty sequence with backslash + carriage return
|
|
650
|
+
const replaced = str.replace(/\x1b\[13;2u/g, "\\\r");
|
|
651
|
+
return originalStdinEmit(event, Buffer.from(replaced));
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
return originalStdinEmit(event, ...args);
|
|
655
|
+
} as any;
|
|
656
|
+
|
|
643
657
|
const rl = readline.createInterface({
|
|
644
658
|
input: process.stdin,
|
|
645
659
|
output: process.stdout,
|
|
@@ -700,8 +714,9 @@ async function chat(explicitSession?: string): Promise<void> {
|
|
|
700
714
|
|
|
701
715
|
let continuationBuffer: string[] = [];
|
|
702
716
|
|
|
703
|
-
// Handle Ctrl+C gracefully
|
|
717
|
+
// Handle Ctrl+C gracefully — disable Kitty protocol on exit
|
|
704
718
|
rl.on("close", () => {
|
|
719
|
+
process.stdout.write("\x1b[<u"); // disable Kitty keyboard protocol
|
|
705
720
|
console.log(dim("\nBye."));
|
|
706
721
|
process.exit(0);
|
|
707
722
|
});
|