groundcrew-cli 0.15.13 → 0.15.15
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 +28 -2
- package/package.json +1 -1
- package/src/index.ts +40 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
// src/index.ts
|
|
4
4
|
import fs from "fs/promises";
|
|
5
5
|
import { existsSync } from "fs";
|
|
@@ -562,6 +562,20 @@ async function chat(explicitSession) {
|
|
|
562
562
|
if (str === "\n") {
|
|
563
563
|
return originalStdinEmit(event, Buffer.from("\\\r"));
|
|
564
564
|
}
|
|
565
|
+
if ((str === "\x7F" || str === "\b") && continuationBuffer.length > 0) {
|
|
566
|
+
const currentLine = rl.line;
|
|
567
|
+
const cursor = rl.cursor;
|
|
568
|
+
if (cursor === 0 && currentLine.length === 0) {
|
|
569
|
+
const prevLine = continuationBuffer.pop();
|
|
570
|
+
rl.line = prevLine;
|
|
571
|
+
rl.cursor = prevLine.length;
|
|
572
|
+
const isCont = continuationBuffer.length > 0;
|
|
573
|
+
const prefix = isCont ? `${dim(`[${current.id}]`)} ${dim("...")} ` : `${dim(`[${current.id}]`)} ${bold(">")} `;
|
|
574
|
+
rl.setPrompt(prefix);
|
|
575
|
+
rl._refreshLine();
|
|
576
|
+
return false;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
565
579
|
}
|
|
566
580
|
return originalStdinEmit(event, ...args);
|
|
567
581
|
};
|
|
@@ -603,7 +617,7 @@ async function chat(explicitSession) {
|
|
|
603
617
|
const W = 56;
|
|
604
618
|
const sess = ` Session ${current.id} ${projectName}`;
|
|
605
619
|
const hint = " Type tasks to queue. / for commands.";
|
|
606
|
-
const hint2 = " Shift+Enter = newline.
|
|
620
|
+
const hint2 = " Shift+Enter = newline. Ctrl+C = clear input.";
|
|
607
621
|
const pad = (s, w) => s + " ".repeat(Math.max(0, w - s.length));
|
|
608
622
|
console.log();
|
|
609
623
|
console.log(dim(" \u256D" + "\u2500".repeat(W) + "\u256E"));
|
|
@@ -620,6 +634,18 @@ async function chat(explicitSession) {
|
|
|
620
634
|
console.log(dim(" \u2570" + "\u2500".repeat(W) + "\u256F"));
|
|
621
635
|
console.log();
|
|
622
636
|
let continuationBuffer = [];
|
|
637
|
+
rl.on("SIGINT", () => {
|
|
638
|
+
const line = rl.line;
|
|
639
|
+
if (line || continuationBuffer.length > 0) {
|
|
640
|
+
continuationBuffer = [];
|
|
641
|
+
process.stdout.write("\n");
|
|
642
|
+
prompt();
|
|
643
|
+
} else {
|
|
644
|
+
process.stdout.write("\x1B[?2004l\x1B[<u");
|
|
645
|
+
console.log(dim("\nBye."));
|
|
646
|
+
process.exit(0);
|
|
647
|
+
}
|
|
648
|
+
});
|
|
623
649
|
rl.on("close", () => {
|
|
624
650
|
process.stdout.write("\x1B[?2004l\x1B[<u");
|
|
625
651
|
console.log(dim("\nBye."));
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -761,6 +761,27 @@ async function chat(explicitSession?: string): Promise<void> {
|
|
|
761
761
|
if (str === "\n") {
|
|
762
762
|
return originalStdinEmit(event, Buffer.from("\\\r"));
|
|
763
763
|
}
|
|
764
|
+
|
|
765
|
+
// --- Backspace at start of continuation → rejoin previous line ---
|
|
766
|
+
// \x7f = DEL (backspace on most terminals), \b = BS (some terminals)
|
|
767
|
+
if ((str === "\x7f" || str === "\b") && continuationBuffer.length > 0) {
|
|
768
|
+
const currentLine = (rl as any).line as string;
|
|
769
|
+
const cursor = (rl as any).cursor as number;
|
|
770
|
+
if (cursor === 0 && currentLine.length === 0) {
|
|
771
|
+
const prevLine = continuationBuffer.pop()!;
|
|
772
|
+
// Inject the previous line's text back into readline
|
|
773
|
+
(rl as any).line = prevLine;
|
|
774
|
+
(rl as any).cursor = prevLine.length;
|
|
775
|
+
// Update the prompt (may no longer be continuation)
|
|
776
|
+
const isCont = continuationBuffer.length > 0;
|
|
777
|
+
const prefix = isCont
|
|
778
|
+
? `${dim(`[${current!.id}]`)} ${dim("...")} `
|
|
779
|
+
: `${dim(`[${current!.id}]`)} ${bold(">")} `;
|
|
780
|
+
rl.setPrompt(prefix);
|
|
781
|
+
(rl as any)._refreshLine();
|
|
782
|
+
return false;
|
|
783
|
+
}
|
|
784
|
+
}
|
|
764
785
|
}
|
|
765
786
|
return originalStdinEmit(event, ...args);
|
|
766
787
|
} as any;
|
|
@@ -808,7 +829,7 @@ async function chat(explicitSession?: string): Promise<void> {
|
|
|
808
829
|
const W = 56;
|
|
809
830
|
const sess = ` Session ${current.id} ${projectName}`;
|
|
810
831
|
const hint = " Type tasks to queue. / for commands.";
|
|
811
|
-
const hint2 = " Shift+Enter = newline.
|
|
832
|
+
const hint2 = " Shift+Enter = newline. Ctrl+C = clear input.";
|
|
812
833
|
const pad = (s: string, w: number) => s + " ".repeat(Math.max(0, w - s.length));
|
|
813
834
|
console.log();
|
|
814
835
|
console.log(dim(" \u256d" + "\u2500".repeat(W) + "\u256e"));
|
|
@@ -827,7 +848,24 @@ async function chat(explicitSession?: string): Promise<void> {
|
|
|
827
848
|
|
|
828
849
|
let continuationBuffer: string[] = [];
|
|
829
850
|
|
|
830
|
-
//
|
|
851
|
+
// Ctrl+C: clear current input (like Claude Code / Copilot CLI)
|
|
852
|
+
// If line has text → clear it and re-prompt
|
|
853
|
+
// If line is empty → exit
|
|
854
|
+
rl.on("SIGINT", () => {
|
|
855
|
+
const line = (rl as any).line as string;
|
|
856
|
+
if (line || continuationBuffer.length > 0) {
|
|
857
|
+
continuationBuffer = [];
|
|
858
|
+
// Clear the current line visually and re-prompt
|
|
859
|
+
process.stdout.write("\n");
|
|
860
|
+
prompt();
|
|
861
|
+
} else {
|
|
862
|
+
process.stdout.write("\x1b[?2004l\x1b[<u");
|
|
863
|
+
console.log(dim("\nBye."));
|
|
864
|
+
process.exit(0);
|
|
865
|
+
}
|
|
866
|
+
});
|
|
867
|
+
|
|
868
|
+
// Handle stream close (pipe EOF, etc.)
|
|
831
869
|
rl.on("close", () => {
|
|
832
870
|
process.stdout.write("\x1b[?2004l\x1b[<u"); // disable bracketed paste + Kitty
|
|
833
871
|
console.log(dim("\nBye."));
|