code-squad-cli 1.0.1 → 1.0.8
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 +15 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
// dist/index.js
|
|
4
4
|
import * as path2 from "path";
|
|
5
5
|
import * as fs2 from "fs";
|
|
6
|
+
import * as os from "os";
|
|
7
|
+
import * as crypto from "crypto";
|
|
6
8
|
import chalk2 from "chalk";
|
|
7
9
|
|
|
8
10
|
// dist/adapters/GitAdapter.js
|
|
@@ -400,6 +402,9 @@ async function confirmDeleteLocal(threadName) {
|
|
|
400
402
|
}
|
|
401
403
|
|
|
402
404
|
// dist/index.js
|
|
405
|
+
process.on("SIGINT", () => {
|
|
406
|
+
process.exit(130);
|
|
407
|
+
});
|
|
403
408
|
var gitAdapter = new GitAdapter();
|
|
404
409
|
async function main() {
|
|
405
410
|
const args = process.argv.slice(2);
|
|
@@ -436,8 +441,13 @@ async function findGitRoot(cwd) {
|
|
|
436
441
|
}
|
|
437
442
|
return cwd;
|
|
438
443
|
}
|
|
444
|
+
function getProjectHash(workspaceRoot) {
|
|
445
|
+
return crypto.createHash("sha256").update(workspaceRoot).digest("hex").slice(0, 8);
|
|
446
|
+
}
|
|
439
447
|
function getSessionsPath(workspaceRoot) {
|
|
440
|
-
|
|
448
|
+
const projectHash = getProjectHash(workspaceRoot);
|
|
449
|
+
const projectName = path2.basename(workspaceRoot);
|
|
450
|
+
return path2.join(os.homedir(), ".code-squad", "sessions", `${projectName}-${projectHash}.json`);
|
|
441
451
|
}
|
|
442
452
|
async function loadLocalThreads(workspaceRoot) {
|
|
443
453
|
const sessionsPath = getSessionsPath(workspaceRoot);
|
|
@@ -612,7 +622,7 @@ end tell`;
|
|
|
612
622
|
async function interactiveMode(workspaceRoot) {
|
|
613
623
|
const result = await runInteraction(workspaceRoot);
|
|
614
624
|
if (result?.cdPath) {
|
|
615
|
-
await
|
|
625
|
+
await openNewTerminal(result.cdPath);
|
|
616
626
|
}
|
|
617
627
|
}
|
|
618
628
|
async function persistentInteractiveMode(workspaceRoot) {
|
|
@@ -716,6 +726,9 @@ async function runInteraction(workspaceRoot, _persistent = false) {
|
|
|
716
726
|
return null;
|
|
717
727
|
}
|
|
718
728
|
main().catch((error) => {
|
|
729
|
+
if (error.message?.includes("SIGINT") || error.message?.includes("force closed")) {
|
|
730
|
+
process.exit(130);
|
|
731
|
+
}
|
|
719
732
|
console.error(chalk2.red(`Error: ${error.message}`));
|
|
720
733
|
process.exit(1);
|
|
721
734
|
});
|