code-squad-cli 1.2.11 → 1.2.12
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 +29 -91
- package/dist/flip/watcher/FileWatcher.js +10 -1
- package/dist/index.js +50 -97
- 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,7 @@ function printUsage() {
|
|
|
138
135
|
console.error(' --session <uuid> Session ID for paste-back tracking');
|
|
139
136
|
}
|
|
140
137
|
async function setupHotkey() {
|
|
141
|
-
|
|
142
|
-
const applescriptPath = path.join(configDir, 'flip.applescript');
|
|
143
|
-
const shPath = path.join(configDir, 'flip.sh');
|
|
144
|
-
// Get node path
|
|
138
|
+
// Get node and csq paths for iTerm2 setup
|
|
145
139
|
let nodePath;
|
|
146
140
|
try {
|
|
147
141
|
nodePath = execSync('which node', { encoding: 'utf-8' }).trim();
|
|
@@ -149,99 +143,43 @@ async function setupHotkey() {
|
|
|
149
143
|
catch {
|
|
150
144
|
nodePath = '/usr/local/bin/node';
|
|
151
145
|
}
|
|
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
146
|
const csqPath = new URL(import.meta.url).pathname;
|
|
155
|
-
// Create config directory
|
|
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');
|
|
182
147
|
console.log('');
|
|
183
148
|
console.log('┌─────────────────────────────────────────────────┐');
|
|
184
|
-
console.log('│ Flip Hotkey Setup
|
|
149
|
+
console.log('│ Flip Hotkey Setup │');
|
|
185
150
|
console.log('└─────────────────────────────────────────────────┘');
|
|
186
151
|
console.log('');
|
|
187
|
-
console.log('
|
|
188
|
-
console.log(` ${shPath}`);
|
|
152
|
+
console.log('Choose one of the following options:');
|
|
189
153
|
console.log('');
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
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
|
-
}
|
|
154
|
+
console.log('─────────────────────────────────────────────────');
|
|
155
|
+
console.log('Option 1: Zsh keybinding (Alt+;)');
|
|
156
|
+
console.log('─────────────────────────────────────────────────');
|
|
157
|
+
console.log('Add to ~/.zshrc:');
|
|
205
158
|
console.log('');
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
});
|
|
211
|
-
if (!ready) {
|
|
212
|
-
console.log('');
|
|
213
|
-
console.log('Run `csq flip setup` again when ready.');
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
159
|
+
console.log(' # Flip hotkey (Alt+;)');
|
|
160
|
+
console.log(' csq-flip-widget() { (csq flip &); zle reset-prompt; }');
|
|
161
|
+
console.log(' zle -N csq-flip-widget');
|
|
162
|
+
console.log(" bindkey '\\e;' csq-flip-widget");
|
|
216
163
|
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('└─────────────────────────────────────────────────┘');
|
|
164
|
+
console.log('Then run: source ~/.zshrc');
|
|
227
165
|
console.log('');
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
console.log(
|
|
166
|
+
console.log('─────────────────────────────────────────────────');
|
|
167
|
+
console.log('Option 2: iTerm2 hotkey (any key combo)');
|
|
168
|
+
console.log('─────────────────────────────────────────────────');
|
|
169
|
+
console.log('1. iTerm2 → Settings → Keys → Key Bindings');
|
|
170
|
+
console.log('2. Click + to add new binding');
|
|
171
|
+
console.log('3. Set your hotkey (e.g., ⌘⇧F)');
|
|
172
|
+
console.log('4. Action: "Run Coprocess"');
|
|
173
|
+
console.log('5. Command:');
|
|
231
174
|
console.log('');
|
|
232
|
-
|
|
233
|
-
message: 'Done configuring? (Paste the path and click OK)',
|
|
234
|
-
default: true,
|
|
235
|
-
});
|
|
175
|
+
console.log(` ${nodePath} ${csqPath} flip`);
|
|
236
176
|
console.log('');
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
console.log('│ 4. Submit → text appears in terminal │');
|
|
245
|
-
console.log('└─────────────────────────────────────────────────┘');
|
|
177
|
+
try {
|
|
178
|
+
await copyToClipboard(`${nodePath} ${csqPath} flip`);
|
|
179
|
+
console.log(' (Copied to clipboard!)');
|
|
180
|
+
}
|
|
181
|
+
catch {
|
|
182
|
+
// Ignore clipboard errors
|
|
183
|
+
}
|
|
246
184
|
console.log('');
|
|
247
185
|
}
|
|
@@ -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,52 @@ async function setupHotkey() {
|
|
|
1505
1507
|
nodePath = "/usr/local/bin/node";
|
|
1506
1508
|
}
|
|
1507
1509
|
const csqPath = new URL(import.meta.url).pathname;
|
|
1508
|
-
fs8.mkdirSync(configDir, { recursive: true });
|
|
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");
|
|
1532
1510
|
console.log("");
|
|
1533
1511
|
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
|
|
1512
|
+
console.log("\u2502 Flip Hotkey Setup \u2502");
|
|
1535
1513
|
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
1514
|
console.log("");
|
|
1537
|
-
console.log("
|
|
1538
|
-
console.log(` ${shPath}`);
|
|
1515
|
+
console.log("Choose one of the following options:");
|
|
1539
1516
|
console.log("");
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
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
|
-
}
|
|
1517
|
+
console.log("\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");
|
|
1518
|
+
console.log("Option 1: Zsh keybinding (Alt+;)");
|
|
1519
|
+
console.log("\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");
|
|
1520
|
+
console.log("Add to ~/.zshrc:");
|
|
1553
1521
|
console.log("");
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
if (!ready) {
|
|
1559
|
-
console.log("");
|
|
1560
|
-
console.log("Run `csq flip setup` again when ready.");
|
|
1561
|
-
return;
|
|
1562
|
-
}
|
|
1522
|
+
console.log(" # Flip hotkey (Alt+;)");
|
|
1523
|
+
console.log(" csq-flip-widget() { (csq flip &); zle reset-prompt; }");
|
|
1524
|
+
console.log(" zle -N csq-flip-widget");
|
|
1525
|
+
console.log(" bindkey '\\e;' csq-flip-widget");
|
|
1563
1526
|
console.log("");
|
|
1564
|
-
console.log("
|
|
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");
|
|
1527
|
+
console.log("Then run: source ~/.zshrc");
|
|
1574
1528
|
console.log("");
|
|
1575
|
-
|
|
1576
|
-
console.log(
|
|
1529
|
+
console.log("\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");
|
|
1530
|
+
console.log("Option 2: iTerm2 hotkey (any key combo)");
|
|
1531
|
+
console.log("\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");
|
|
1532
|
+
console.log("1. iTerm2 \u2192 Settings \u2192 Keys \u2192 Key Bindings");
|
|
1533
|
+
console.log("2. Click + to add new binding");
|
|
1534
|
+
console.log("3. Set your hotkey (e.g., \u2318\u21E7F)");
|
|
1535
|
+
console.log('4. Action: "Run Coprocess"');
|
|
1536
|
+
console.log("5. Command:");
|
|
1577
1537
|
console.log("");
|
|
1578
|
-
|
|
1579
|
-
message: "Done configuring? (Paste the path and click OK)",
|
|
1580
|
-
default: true
|
|
1581
|
-
});
|
|
1538
|
+
console.log(` ${nodePath} ${csqPath} flip`);
|
|
1582
1539
|
console.log("");
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
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");
|
|
1540
|
+
try {
|
|
1541
|
+
await copyToClipboard(`${nodePath} ${csqPath} flip`);
|
|
1542
|
+
console.log(" (Copied to clipboard!)");
|
|
1543
|
+
} catch {
|
|
1544
|
+
}
|
|
1592
1545
|
console.log("");
|
|
1593
1546
|
}
|
|
1594
1547
|
|
|
1595
1548
|
// dist/config.js
|
|
1596
|
-
import * as
|
|
1597
|
-
import * as
|
|
1549
|
+
import * as fs8 from "fs";
|
|
1550
|
+
import * as os3 from "os";
|
|
1598
1551
|
import * as path10 from "path";
|
|
1599
|
-
var GLOBAL_CONFIG_PATH = path10.join(
|
|
1552
|
+
var GLOBAL_CONFIG_PATH = path10.join(os3.homedir(), ".code-squad", "config.json");
|
|
1600
1553
|
async function loadGlobalConfig() {
|
|
1601
1554
|
try {
|
|
1602
|
-
const content = await
|
|
1555
|
+
const content = await fs8.promises.readFile(GLOBAL_CONFIG_PATH, "utf-8");
|
|
1603
1556
|
return JSON.parse(content);
|
|
1604
1557
|
} catch (error) {
|
|
1605
1558
|
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
|
|
@@ -1630,7 +1583,7 @@ function getWorktreeCopyPatterns(config) {
|
|
|
1630
1583
|
}
|
|
1631
1584
|
|
|
1632
1585
|
// dist/fileUtils.js
|
|
1633
|
-
import * as
|
|
1586
|
+
import * as fs9 from "fs";
|
|
1634
1587
|
import * as path11 from "path";
|
|
1635
1588
|
import fg from "fast-glob";
|
|
1636
1589
|
async function copyFilesWithPatterns(sourceRoot, destRoot, patterns) {
|
|
@@ -1667,8 +1620,8 @@ async function copySingleFile(absolutePath, sourceRoot, destRoot) {
|
|
|
1667
1620
|
const relativePath = path11.relative(sourceRoot, absolutePath);
|
|
1668
1621
|
const destPath = path11.join(destRoot, relativePath);
|
|
1669
1622
|
const destDir = path11.dirname(destPath);
|
|
1670
|
-
await
|
|
1671
|
-
await
|
|
1623
|
+
await fs9.promises.mkdir(destDir, { recursive: true });
|
|
1624
|
+
await fs9.promises.copyFile(absolutePath, destPath);
|
|
1672
1625
|
}
|
|
1673
1626
|
|
|
1674
1627
|
// dist/index.js
|
|
@@ -1724,12 +1677,12 @@ function getProjectHash(workspaceRoot) {
|
|
|
1724
1677
|
function getSessionsPath(workspaceRoot) {
|
|
1725
1678
|
const projectHash = getProjectHash(workspaceRoot);
|
|
1726
1679
|
const projectName = path12.basename(workspaceRoot);
|
|
1727
|
-
return path12.join(
|
|
1680
|
+
return path12.join(os4.homedir(), ".code-squad", "sessions", `${projectName}-${projectHash}.json`);
|
|
1728
1681
|
}
|
|
1729
1682
|
async function loadLocalThreads(workspaceRoot) {
|
|
1730
1683
|
const sessionsPath = getSessionsPath(workspaceRoot);
|
|
1731
1684
|
try {
|
|
1732
|
-
const content = await
|
|
1685
|
+
const content = await fs10.promises.readFile(sessionsPath, "utf-8");
|
|
1733
1686
|
const data = JSON.parse(content);
|
|
1734
1687
|
return data.localThreads || [];
|
|
1735
1688
|
} catch {
|
|
@@ -1739,8 +1692,8 @@ async function loadLocalThreads(workspaceRoot) {
|
|
|
1739
1692
|
async function saveLocalThreads(workspaceRoot, threads) {
|
|
1740
1693
|
const sessionsPath = getSessionsPath(workspaceRoot);
|
|
1741
1694
|
const dir = path12.dirname(sessionsPath);
|
|
1742
|
-
await
|
|
1743
|
-
await
|
|
1695
|
+
await fs10.promises.mkdir(dir, { recursive: true });
|
|
1696
|
+
await fs10.promises.writeFile(sessionsPath, JSON.stringify({ localThreads: threads }, null, 2));
|
|
1744
1697
|
}
|
|
1745
1698
|
async function addLocalThread(workspaceRoot, name) {
|
|
1746
1699
|
const threads = await loadLocalThreads(workspaceRoot);
|
|
@@ -1870,7 +1823,7 @@ async function quitWorktreeCommand() {
|
|
|
1870
1823
|
}
|
|
1871
1824
|
const isDirty = await gitAdapter.hasDirtyState(cwd);
|
|
1872
1825
|
if (isDirty) {
|
|
1873
|
-
const confirmed = await
|
|
1826
|
+
const confirmed = await confirm2({
|
|
1874
1827
|
message: "Uncommitted changes detected. Delete anyway?",
|
|
1875
1828
|
default: false
|
|
1876
1829
|
});
|