groundcrew-cli 0.15.7 → 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 -6
- package/package.json +1 -1
- package/src/index.ts +25 -9
package/dist/index.js
CHANGED
|
@@ -467,12 +467,6 @@ function setupInlineSuggestions(rl) {
|
|
|
467
467
|
};
|
|
468
468
|
process.stdin.on("keypress", (_ch, key) => {
|
|
469
469
|
if (!key) return;
|
|
470
|
-
if (key.name === "return" && key.shift) {
|
|
471
|
-
const line = rl.line;
|
|
472
|
-
rl.line = line + "\\";
|
|
473
|
-
rl.cursor = rl.line.length;
|
|
474
|
-
return;
|
|
475
|
-
}
|
|
476
470
|
clearGhost();
|
|
477
471
|
if (key.name !== "return" && key.name !== "tab") {
|
|
478
472
|
setImmediate(showGhost);
|
|
@@ -480,6 +474,21 @@ function setupInlineSuggestions(rl) {
|
|
|
480
474
|
});
|
|
481
475
|
}
|
|
482
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
|
+
};
|
|
483
492
|
const rl = readline.createInterface({
|
|
484
493
|
input: process.stdin,
|
|
485
494
|
output: process.stdout,
|
|
@@ -534,6 +543,7 @@ async function chat(explicitSession) {
|
|
|
534
543
|
console.log();
|
|
535
544
|
let continuationBuffer = [];
|
|
536
545
|
rl.on("close", () => {
|
|
546
|
+
process.stdout.write("\x1B[<u");
|
|
537
547
|
console.log(dim("\nBye."));
|
|
538
548
|
process.exit(0);
|
|
539
549
|
});
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -622,14 +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
|
-
// Shift+Enter: insert newline marker instead of submitting
|
|
626
|
-
if (key.name === "return" && key.shift) {
|
|
627
|
-
// Append backslash to trigger line continuation, then simulate Enter
|
|
628
|
-
const line = (rl as any).line as string;
|
|
629
|
-
(rl as any).line = line + "\\";
|
|
630
|
-
(rl as any).cursor = (rl as any).line.length;
|
|
631
|
-
return;
|
|
632
|
-
}
|
|
633
625
|
|
|
634
626
|
clearGhost();
|
|
635
627
|
if (key.name !== "return" && key.name !== "tab") {
|
|
@@ -639,6 +631,29 @@ function setupInlineSuggestions(rl: readline.Interface): void {
|
|
|
639
631
|
}
|
|
640
632
|
|
|
641
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
|
+
|
|
642
657
|
const rl = readline.createInterface({
|
|
643
658
|
input: process.stdin,
|
|
644
659
|
output: process.stdout,
|
|
@@ -699,8 +714,9 @@ async function chat(explicitSession?: string): Promise<void> {
|
|
|
699
714
|
|
|
700
715
|
let continuationBuffer: string[] = [];
|
|
701
716
|
|
|
702
|
-
// Handle Ctrl+C gracefully
|
|
717
|
+
// Handle Ctrl+C gracefully — disable Kitty protocol on exit
|
|
703
718
|
rl.on("close", () => {
|
|
719
|
+
process.stdout.write("\x1b[<u"); // disable Kitty keyboard protocol
|
|
704
720
|
console.log(dim("\nBye."));
|
|
705
721
|
process.exit(0);
|
|
706
722
|
});
|