code-squad-cli 1.2.11 → 1.2.13
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/flip/index.js +15 -94
- package/dist/flip/watcher/FileWatcher.js +10 -1
- package/dist/index.js +37 -100
- package/package.json +1 -1
package/dist/flip/index.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { Server, findFreePort } from './server/Server.js';
|
|
2
2
|
import open from 'open';
|
|
3
3
|
import path from 'path';
|
|
4
|
-
import fs from 'fs';
|
|
5
|
-
import os from 'os';
|
|
6
4
|
import { execSync } from 'child_process';
|
|
7
|
-
import { confirm } from '@inquirer/prompts';
|
|
8
5
|
import { copyToClipboard } from './output/clipboard.js';
|
|
9
6
|
const DEFAULT_PORT = 51234;
|
|
10
7
|
function formatTime() {
|
|
@@ -130,7 +127,7 @@ function printUsage() {
|
|
|
130
127
|
console.error('Commands:');
|
|
131
128
|
console.error(' serve [path] Start server in daemon mode (keeps running)');
|
|
132
129
|
console.error(' open Open browser to existing server');
|
|
133
|
-
console.error(' setup Setup
|
|
130
|
+
console.error(' setup Setup Alt+; hotkey in shell config');
|
|
134
131
|
console.error(' (no command) Start server + open browser (one-shot mode)');
|
|
135
132
|
console.error('');
|
|
136
133
|
console.error('Options:');
|
|
@@ -138,10 +135,6 @@ function printUsage() {
|
|
|
138
135
|
console.error(' --session <uuid> Session ID for paste-back tracking');
|
|
139
136
|
}
|
|
140
137
|
async function setupHotkey() {
|
|
141
|
-
const configDir = path.join(os.homedir(), '.config', 'flip');
|
|
142
|
-
const applescriptPath = path.join(configDir, 'flip.applescript');
|
|
143
|
-
const shPath = path.join(configDir, 'flip.sh');
|
|
144
|
-
// Get node path
|
|
145
138
|
let nodePath;
|
|
146
139
|
try {
|
|
147
140
|
nodePath = execSync('which node', { encoding: 'utf-8' }).trim();
|
|
@@ -149,99 +142,27 @@ async function setupHotkey() {
|
|
|
149
142
|
catch {
|
|
150
143
|
nodePath = '/usr/local/bin/node';
|
|
151
144
|
}
|
|
152
|
-
// Get csq path - after bundling, all code is in dist/index.js
|
|
153
|
-
// so import.meta.url points directly to the entry point
|
|
154
145
|
const csqPath = new URL(import.meta.url).pathname;
|
|
155
|
-
|
|
156
|
-
fs.mkdirSync(configDir, { recursive: true });
|
|
157
|
-
// Write AppleScript
|
|
158
|
-
const applescriptContent = `#!/usr/bin/osascript
|
|
159
|
-
|
|
160
|
-
-- flip hotkey script
|
|
161
|
-
-- Generated by: csq flip setup
|
|
162
|
-
|
|
163
|
-
tell application "iTerm2"
|
|
164
|
-
tell current session of current window
|
|
165
|
-
set originalSessionId to id
|
|
166
|
-
set sessionUUID to do shell script "uuidgen"
|
|
167
|
-
set currentPath to variable named "path"
|
|
168
|
-
do shell script "echo '" & originalSessionId & "' > /tmp/flip-view-session-" & sessionUUID
|
|
169
|
-
do shell script "nohup ${nodePath} ${csqPath} flip --session " & sessionUUID & " " & quoted form of currentPath & " > /tmp/flip.log 2>&1 &"
|
|
170
|
-
end tell
|
|
171
|
-
end tell
|
|
172
|
-
|
|
173
|
-
return ""`;
|
|
174
|
-
fs.writeFileSync(applescriptPath, applescriptContent);
|
|
175
|
-
fs.chmodSync(applescriptPath, '755');
|
|
176
|
-
// Write shell wrapper
|
|
177
|
-
const shContent = `#!/bin/bash
|
|
178
|
-
osascript ${applescriptPath} > /dev/null 2>&1
|
|
179
|
-
`;
|
|
180
|
-
fs.writeFileSync(shPath, shContent);
|
|
181
|
-
fs.chmodSync(shPath, '755');
|
|
146
|
+
const command = `${nodePath} ${csqPath} flip`;
|
|
182
147
|
console.log('');
|
|
183
148
|
console.log('┌─────────────────────────────────────────────────┐');
|
|
184
|
-
console.log('│ Flip Hotkey Setup
|
|
149
|
+
console.log('│ Flip Hotkey Setup (iTerm2) │');
|
|
185
150
|
console.log('└─────────────────────────────────────────────────┘');
|
|
186
151
|
console.log('');
|
|
187
|
-
console.log('
|
|
188
|
-
console.log(
|
|
152
|
+
console.log('1. iTerm2 → Settings → Keys → Key Bindings');
|
|
153
|
+
console.log('2. + 클릭');
|
|
154
|
+
console.log('3. Keyboard Shortcut: ⌘⇧F (Cmd+Shift+F)');
|
|
155
|
+
console.log('4. Action: "Run Coprocess"');
|
|
156
|
+
console.log('5. Command (아래 자동 복사됨):');
|
|
189
157
|
console.log('');
|
|
190
|
-
|
|
191
|
-
const openSettings = await confirm({
|
|
192
|
-
message: 'Open iTerm2 Settings? (Keys → Key Bindings)',
|
|
193
|
-
default: true,
|
|
194
|
-
});
|
|
195
|
-
if (openSettings) {
|
|
196
|
-
try {
|
|
197
|
-
execSync(`osascript -e 'tell application "iTerm2" to activate' -e 'tell application "System Events" to keystroke "," using command down'`);
|
|
198
|
-
console.log('');
|
|
199
|
-
console.log(' → iTerm2 Settings opened. Navigate to: Keys → Key Bindings');
|
|
200
|
-
}
|
|
201
|
-
catch {
|
|
202
|
-
console.log(' → Could not open settings automatically. Open manually: iTerm2 → Settings → Keys → Key Bindings');
|
|
203
|
-
}
|
|
204
|
-
}
|
|
158
|
+
console.log(` ${command}`);
|
|
205
159
|
console.log('');
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
console.log('');
|
|
213
|
-
console.log('Run `csq flip setup` again when ready.');
|
|
214
|
-
return;
|
|
160
|
+
try {
|
|
161
|
+
await copyToClipboard(command);
|
|
162
|
+
console.log(' (Copied to clipboard!)');
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
// Ignore clipboard errors
|
|
215
166
|
}
|
|
216
|
-
console.log('');
|
|
217
|
-
console.log('┌─────────────────────────────────────────────────┐');
|
|
218
|
-
console.log('│ Configure the Key Binding: │');
|
|
219
|
-
console.log('├─────────────────────────────────────────────────┤');
|
|
220
|
-
console.log('│ 1. Keyboard Shortcut: Press your hotkey │');
|
|
221
|
-
console.log('│ (e.g., ⌘⇧F) │');
|
|
222
|
-
console.log('│ │');
|
|
223
|
-
console.log('│ 2. Action: Select "Run Coprocess" │');
|
|
224
|
-
console.log('│ │');
|
|
225
|
-
console.log('│ 3. Command: Paste the path (copied below) │');
|
|
226
|
-
console.log('└─────────────────────────────────────────────────┘');
|
|
227
|
-
console.log('');
|
|
228
|
-
// Copy path to clipboard
|
|
229
|
-
await copyToClipboard(shPath);
|
|
230
|
-
console.log(`✓ Copied to clipboard: ${shPath}`);
|
|
231
|
-
console.log('');
|
|
232
|
-
await confirm({
|
|
233
|
-
message: 'Done configuring? (Paste the path and click OK)',
|
|
234
|
-
default: true,
|
|
235
|
-
});
|
|
236
|
-
console.log('');
|
|
237
|
-
console.log('┌─────────────────────────────────────────────────┐');
|
|
238
|
-
console.log('│ Setup Complete! │');
|
|
239
|
-
console.log('├─────────────────────────────────────────────────┤');
|
|
240
|
-
console.log('│ Usage: │');
|
|
241
|
-
console.log('│ 1. Focus on any terminal panel │');
|
|
242
|
-
console.log('│ 2. Press your hotkey → browser opens │');
|
|
243
|
-
console.log('│ 3. Select files, add comments │');
|
|
244
|
-
console.log('│ 4. Submit → text appears in terminal │');
|
|
245
|
-
console.log('└─────────────────────────────────────────────────┘');
|
|
246
167
|
console.log('');
|
|
247
168
|
}
|
|
@@ -38,7 +38,16 @@ export class FileWatcher {
|
|
|
38
38
|
.on('change', (filePath) => this.handleFileEvent(filePath, 'change'))
|
|
39
39
|
.on('addDir', (filePath) => this.handleDirEvent(filePath, 'addDir'))
|
|
40
40
|
.on('unlinkDir', (filePath) => this.handleDirEvent(filePath, 'unlinkDir'))
|
|
41
|
-
.on('error', (error) =>
|
|
41
|
+
.on('error', (error) => {
|
|
42
|
+
const code = error.code;
|
|
43
|
+
if (code === 'ENFILE' || code === 'EMFILE') {
|
|
44
|
+
console.error('File descriptor limit reached. Disabling file watcher.');
|
|
45
|
+
this.stop();
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
console.error('Watcher error:', error);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
42
51
|
}
|
|
43
52
|
async stop() {
|
|
44
53
|
if (this.filesDebounceTimer) {
|
package/dist/index.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
// dist/index.js
|
|
4
4
|
import * as path12 from "path";
|
|
5
|
-
import * as
|
|
6
|
-
import * as
|
|
5
|
+
import * as fs10 from "fs";
|
|
6
|
+
import * as os4 from "os";
|
|
7
7
|
import * as crypto from "crypto";
|
|
8
8
|
import chalk2 from "chalk";
|
|
9
9
|
|
|
@@ -411,7 +411,7 @@ async function confirmDeleteLocal(threadName) {
|
|
|
411
411
|
}
|
|
412
412
|
|
|
413
413
|
// dist/index.js
|
|
414
|
-
import { confirm as
|
|
414
|
+
import { confirm as confirm2 } from "@inquirer/prompts";
|
|
415
415
|
|
|
416
416
|
// dist/flip/server/Server.js
|
|
417
417
|
import express2 from "express";
|
|
@@ -1184,7 +1184,15 @@ var FileWatcher = class {
|
|
|
1184
1184
|
pollInterval: 50
|
|
1185
1185
|
}
|
|
1186
1186
|
});
|
|
1187
|
-
this.watcher.on("add", (filePath) => this.handleFileEvent(filePath, "add")).on("unlink", (filePath) => this.handleFileEvent(filePath, "unlink")).on("change", (filePath) => this.handleFileEvent(filePath, "change")).on("addDir", (filePath) => this.handleDirEvent(filePath, "addDir")).on("unlinkDir", (filePath) => this.handleDirEvent(filePath, "unlinkDir")).on("error", (error) =>
|
|
1187
|
+
this.watcher.on("add", (filePath) => this.handleFileEvent(filePath, "add")).on("unlink", (filePath) => this.handleFileEvent(filePath, "unlink")).on("change", (filePath) => this.handleFileEvent(filePath, "change")).on("addDir", (filePath) => this.handleDirEvent(filePath, "addDir")).on("unlinkDir", (filePath) => this.handleDirEvent(filePath, "unlinkDir")).on("error", (error) => {
|
|
1188
|
+
const code = error.code;
|
|
1189
|
+
if (code === "ENFILE" || code === "EMFILE") {
|
|
1190
|
+
console.error("File descriptor limit reached. Disabling file watcher.");
|
|
1191
|
+
this.stop();
|
|
1192
|
+
} else {
|
|
1193
|
+
console.error("Watcher error:", error);
|
|
1194
|
+
}
|
|
1195
|
+
});
|
|
1188
1196
|
}
|
|
1189
1197
|
async stop() {
|
|
1190
1198
|
if (this.filesDebounceTimer) {
|
|
@@ -1372,10 +1380,7 @@ async function findFreePort(preferred, maxPort = 65535) {
|
|
|
1372
1380
|
// dist/flip/index.js
|
|
1373
1381
|
import open from "open";
|
|
1374
1382
|
import path9 from "path";
|
|
1375
|
-
import fs8 from "fs";
|
|
1376
|
-
import os3 from "os";
|
|
1377
1383
|
import { execSync as execSync2 } from "child_process";
|
|
1378
|
-
import { confirm as confirm2 } from "@inquirer/prompts";
|
|
1379
1384
|
var DEFAULT_PORT = 51234;
|
|
1380
1385
|
function formatTime() {
|
|
1381
1386
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -1487,7 +1492,7 @@ function printUsage() {
|
|
|
1487
1492
|
console.error("Commands:");
|
|
1488
1493
|
console.error(" serve [path] Start server in daemon mode (keeps running)");
|
|
1489
1494
|
console.error(" open Open browser to existing server");
|
|
1490
|
-
console.error(" setup Setup
|
|
1495
|
+
console.error(" setup Setup Alt+; hotkey in shell config");
|
|
1491
1496
|
console.error(" (no command) Start server + open browser (one-shot mode)");
|
|
1492
1497
|
console.error("");
|
|
1493
1498
|
console.error("Options:");
|
|
@@ -1495,9 +1500,6 @@ function printUsage() {
|
|
|
1495
1500
|
console.error(" --session <uuid> Session ID for paste-back tracking");
|
|
1496
1501
|
}
|
|
1497
1502
|
async function setupHotkey() {
|
|
1498
|
-
const configDir = path9.join(os3.homedir(), ".config", "flip");
|
|
1499
|
-
const applescriptPath = path9.join(configDir, "flip.applescript");
|
|
1500
|
-
const shPath = path9.join(configDir, "flip.sh");
|
|
1501
1503
|
let nodePath;
|
|
1502
1504
|
try {
|
|
1503
1505
|
nodePath = execSync2("which node", { encoding: "utf-8" }).trim();
|
|
@@ -1505,101 +1507,36 @@ async function setupHotkey() {
|
|
|
1505
1507
|
nodePath = "/usr/local/bin/node";
|
|
1506
1508
|
}
|
|
1507
1509
|
const csqPath = new URL(import.meta.url).pathname;
|
|
1508
|
-
|
|
1509
|
-
const applescriptContent = `#!/usr/bin/osascript
|
|
1510
|
-
|
|
1511
|
-
-- flip hotkey script
|
|
1512
|
-
-- Generated by: csq flip setup
|
|
1513
|
-
|
|
1514
|
-
tell application "iTerm2"
|
|
1515
|
-
tell current session of current window
|
|
1516
|
-
set originalSessionId to id
|
|
1517
|
-
set sessionUUID to do shell script "uuidgen"
|
|
1518
|
-
set currentPath to variable named "path"
|
|
1519
|
-
do shell script "echo '" & originalSessionId & "' > /tmp/flip-view-session-" & sessionUUID
|
|
1520
|
-
do shell script "nohup ${nodePath} ${csqPath} flip --session " & sessionUUID & " " & quoted form of currentPath & " > /tmp/flip.log 2>&1 &"
|
|
1521
|
-
end tell
|
|
1522
|
-
end tell
|
|
1523
|
-
|
|
1524
|
-
return ""`;
|
|
1525
|
-
fs8.writeFileSync(applescriptPath, applescriptContent);
|
|
1526
|
-
fs8.chmodSync(applescriptPath, "755");
|
|
1527
|
-
const shContent = `#!/bin/bash
|
|
1528
|
-
osascript ${applescriptPath} > /dev/null 2>&1
|
|
1529
|
-
`;
|
|
1530
|
-
fs8.writeFileSync(shPath, shContent);
|
|
1531
|
-
fs8.chmodSync(shPath, "755");
|
|
1510
|
+
const command = `${nodePath} ${csqPath} flip`;
|
|
1532
1511
|
console.log("");
|
|
1533
1512
|
console.log("\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510");
|
|
1534
|
-
console.log("\u2502 Flip Hotkey Setup
|
|
1513
|
+
console.log("\u2502 Flip Hotkey Setup (iTerm2) \u2502");
|
|
1535
1514
|
console.log("\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518");
|
|
1536
1515
|
console.log("");
|
|
1537
|
-
console.log("\
|
|
1538
|
-
console.log(
|
|
1516
|
+
console.log("1. iTerm2 \u2192 Settings \u2192 Keys \u2192 Key Bindings");
|
|
1517
|
+
console.log("2. + \uD074\uB9AD");
|
|
1518
|
+
console.log("3. Keyboard Shortcut: \u2318\u21E7F (Cmd+Shift+F)");
|
|
1519
|
+
console.log('4. Action: "Run Coprocess"');
|
|
1520
|
+
console.log("5. Command (\uC544\uB798 \uC790\uB3D9 \uBCF5\uC0AC\uB428):");
|
|
1539
1521
|
console.log("");
|
|
1540
|
-
|
|
1541
|
-
message: "Open iTerm2 Settings? (Keys \u2192 Key Bindings)",
|
|
1542
|
-
default: true
|
|
1543
|
-
});
|
|
1544
|
-
if (openSettings) {
|
|
1545
|
-
try {
|
|
1546
|
-
execSync2(`osascript -e 'tell application "iTerm2" to activate' -e 'tell application "System Events" to keystroke "," using command down'`);
|
|
1547
|
-
console.log("");
|
|
1548
|
-
console.log(" \u2192 iTerm2 Settings opened. Navigate to: Keys \u2192 Key Bindings");
|
|
1549
|
-
} catch {
|
|
1550
|
-
console.log(" \u2192 Could not open settings automatically. Open manually: iTerm2 \u2192 Settings \u2192 Keys \u2192 Key Bindings");
|
|
1551
|
-
}
|
|
1552
|
-
}
|
|
1522
|
+
console.log(` ${command}`);
|
|
1553
1523
|
console.log("");
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
}
|
|
1558
|
-
if (!ready) {
|
|
1559
|
-
console.log("");
|
|
1560
|
-
console.log("Run `csq flip setup` again when ready.");
|
|
1561
|
-
return;
|
|
1524
|
+
try {
|
|
1525
|
+
await copyToClipboard(command);
|
|
1526
|
+
console.log(" (Copied to clipboard!)");
|
|
1527
|
+
} catch {
|
|
1562
1528
|
}
|
|
1563
1529
|
console.log("");
|
|
1564
|
-
console.log("\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510");
|
|
1565
|
-
console.log("\u2502 Configure the Key Binding: \u2502");
|
|
1566
|
-
console.log("\u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524");
|
|
1567
|
-
console.log("\u2502 1. Keyboard Shortcut: Press your hotkey \u2502");
|
|
1568
|
-
console.log("\u2502 (e.g., \u2318\u21E7F) \u2502");
|
|
1569
|
-
console.log("\u2502 \u2502");
|
|
1570
|
-
console.log('\u2502 2. Action: Select "Run Coprocess" \u2502');
|
|
1571
|
-
console.log("\u2502 \u2502");
|
|
1572
|
-
console.log("\u2502 3. Command: Paste the path (copied below) \u2502");
|
|
1573
|
-
console.log("\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518");
|
|
1574
|
-
console.log("");
|
|
1575
|
-
await copyToClipboard(shPath);
|
|
1576
|
-
console.log(`\u2713 Copied to clipboard: ${shPath}`);
|
|
1577
|
-
console.log("");
|
|
1578
|
-
await confirm2({
|
|
1579
|
-
message: "Done configuring? (Paste the path and click OK)",
|
|
1580
|
-
default: true
|
|
1581
|
-
});
|
|
1582
|
-
console.log("");
|
|
1583
|
-
console.log("\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510");
|
|
1584
|
-
console.log("\u2502 Setup Complete! \u2502");
|
|
1585
|
-
console.log("\u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524");
|
|
1586
|
-
console.log("\u2502 Usage: \u2502");
|
|
1587
|
-
console.log("\u2502 1. Focus on any terminal panel \u2502");
|
|
1588
|
-
console.log("\u2502 2. Press your hotkey \u2192 browser opens \u2502");
|
|
1589
|
-
console.log("\u2502 3. Select files, add comments \u2502");
|
|
1590
|
-
console.log("\u2502 4. Submit \u2192 text appears in terminal \u2502");
|
|
1591
|
-
console.log("\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518");
|
|
1592
|
-
console.log("");
|
|
1593
1530
|
}
|
|
1594
1531
|
|
|
1595
1532
|
// dist/config.js
|
|
1596
|
-
import * as
|
|
1597
|
-
import * as
|
|
1533
|
+
import * as fs8 from "fs";
|
|
1534
|
+
import * as os3 from "os";
|
|
1598
1535
|
import * as path10 from "path";
|
|
1599
|
-
var GLOBAL_CONFIG_PATH = path10.join(
|
|
1536
|
+
var GLOBAL_CONFIG_PATH = path10.join(os3.homedir(), ".code-squad", "config.json");
|
|
1600
1537
|
async function loadGlobalConfig() {
|
|
1601
1538
|
try {
|
|
1602
|
-
const content = await
|
|
1539
|
+
const content = await fs8.promises.readFile(GLOBAL_CONFIG_PATH, "utf-8");
|
|
1603
1540
|
return JSON.parse(content);
|
|
1604
1541
|
} catch (error) {
|
|
1605
1542
|
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
|
|
@@ -1630,7 +1567,7 @@ function getWorktreeCopyPatterns(config) {
|
|
|
1630
1567
|
}
|
|
1631
1568
|
|
|
1632
1569
|
// dist/fileUtils.js
|
|
1633
|
-
import * as
|
|
1570
|
+
import * as fs9 from "fs";
|
|
1634
1571
|
import * as path11 from "path";
|
|
1635
1572
|
import fg from "fast-glob";
|
|
1636
1573
|
async function copyFilesWithPatterns(sourceRoot, destRoot, patterns) {
|
|
@@ -1667,8 +1604,8 @@ async function copySingleFile(absolutePath, sourceRoot, destRoot) {
|
|
|
1667
1604
|
const relativePath = path11.relative(sourceRoot, absolutePath);
|
|
1668
1605
|
const destPath = path11.join(destRoot, relativePath);
|
|
1669
1606
|
const destDir = path11.dirname(destPath);
|
|
1670
|
-
await
|
|
1671
|
-
await
|
|
1607
|
+
await fs9.promises.mkdir(destDir, { recursive: true });
|
|
1608
|
+
await fs9.promises.copyFile(absolutePath, destPath);
|
|
1672
1609
|
}
|
|
1673
1610
|
|
|
1674
1611
|
// dist/index.js
|
|
@@ -1724,12 +1661,12 @@ function getProjectHash(workspaceRoot) {
|
|
|
1724
1661
|
function getSessionsPath(workspaceRoot) {
|
|
1725
1662
|
const projectHash = getProjectHash(workspaceRoot);
|
|
1726
1663
|
const projectName = path12.basename(workspaceRoot);
|
|
1727
|
-
return path12.join(
|
|
1664
|
+
return path12.join(os4.homedir(), ".code-squad", "sessions", `${projectName}-${projectHash}.json`);
|
|
1728
1665
|
}
|
|
1729
1666
|
async function loadLocalThreads(workspaceRoot) {
|
|
1730
1667
|
const sessionsPath = getSessionsPath(workspaceRoot);
|
|
1731
1668
|
try {
|
|
1732
|
-
const content = await
|
|
1669
|
+
const content = await fs10.promises.readFile(sessionsPath, "utf-8");
|
|
1733
1670
|
const data = JSON.parse(content);
|
|
1734
1671
|
return data.localThreads || [];
|
|
1735
1672
|
} catch {
|
|
@@ -1739,8 +1676,8 @@ async function loadLocalThreads(workspaceRoot) {
|
|
|
1739
1676
|
async function saveLocalThreads(workspaceRoot, threads) {
|
|
1740
1677
|
const sessionsPath = getSessionsPath(workspaceRoot);
|
|
1741
1678
|
const dir = path12.dirname(sessionsPath);
|
|
1742
|
-
await
|
|
1743
|
-
await
|
|
1679
|
+
await fs10.promises.mkdir(dir, { recursive: true });
|
|
1680
|
+
await fs10.promises.writeFile(sessionsPath, JSON.stringify({ localThreads: threads }, null, 2));
|
|
1744
1681
|
}
|
|
1745
1682
|
async function addLocalThread(workspaceRoot, name) {
|
|
1746
1683
|
const threads = await loadLocalThreads(workspaceRoot);
|
|
@@ -1870,7 +1807,7 @@ async function quitWorktreeCommand() {
|
|
|
1870
1807
|
}
|
|
1871
1808
|
const isDirty = await gitAdapter.hasDirtyState(cwd);
|
|
1872
1809
|
if (isDirty) {
|
|
1873
|
-
const confirmed = await
|
|
1810
|
+
const confirmed = await confirm2({
|
|
1874
1811
|
message: "Uncommitted changes detected. Delete anyway?",
|
|
1875
1812
|
default: false
|
|
1876
1813
|
});
|