code-squad-cli 1.2.20 → 1.2.22
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 +12 -1
- package/dist/index.js +59 -12
- package/package.json +1 -1
package/dist/flip/index.js
CHANGED
|
@@ -8,8 +8,14 @@ import { execSync } from 'child_process';
|
|
|
8
8
|
import { copyToClipboard } from './output/clipboard.js';
|
|
9
9
|
const DEFAULT_PORT = 51234;
|
|
10
10
|
const MAX_PORT = 51240;
|
|
11
|
+
// Quiet mode: no logs in coprocess mode to avoid iTerm error indicators
|
|
12
|
+
let quietMode = false;
|
|
11
13
|
// Use stderr for info messages (stdout goes to terminal input in coprocess mode)
|
|
12
|
-
const log = (...args) =>
|
|
14
|
+
const log = (...args) => {
|
|
15
|
+
if (!quietMode) {
|
|
16
|
+
console.error(...args);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
13
19
|
function formatTime() {
|
|
14
20
|
const now = new Date();
|
|
15
21
|
const hours = String(now.getHours()).padStart(2, '0');
|
|
@@ -63,6 +69,11 @@ async function registerSession(port, sessionId, cwd) {
|
|
|
63
69
|
});
|
|
64
70
|
}
|
|
65
71
|
export async function runFlip(args) {
|
|
72
|
+
// Enable quiet mode when running as coprocess (stdin is not a TTY)
|
|
73
|
+
// This prevents iTerm from showing error indicators for info messages
|
|
74
|
+
if (!process.stdin.isTTY) {
|
|
75
|
+
quietMode = true;
|
|
76
|
+
}
|
|
66
77
|
// Parse --session flag from anywhere in args
|
|
67
78
|
let sessionId;
|
|
68
79
|
const sessionIdx = args.indexOf('--session');
|
package/dist/index.js
CHANGED
|
@@ -1746,7 +1746,12 @@ import http2 from "http";
|
|
|
1746
1746
|
import { execSync as execSync2 } from "child_process";
|
|
1747
1747
|
var DEFAULT_PORT = 51234;
|
|
1748
1748
|
var MAX_PORT = 51240;
|
|
1749
|
-
var
|
|
1749
|
+
var quietMode = false;
|
|
1750
|
+
var log3 = (...args) => {
|
|
1751
|
+
if (!quietMode) {
|
|
1752
|
+
console.error(...args);
|
|
1753
|
+
}
|
|
1754
|
+
};
|
|
1750
1755
|
function formatTime() {
|
|
1751
1756
|
const now = /* @__PURE__ */ new Date();
|
|
1752
1757
|
const hours = String(now.getHours()).padStart(2, "0");
|
|
@@ -1792,6 +1797,9 @@ async function registerSession(port, sessionId, cwd) {
|
|
|
1792
1797
|
});
|
|
1793
1798
|
}
|
|
1794
1799
|
async function runFlip(args) {
|
|
1800
|
+
if (!process.stdin.isTTY) {
|
|
1801
|
+
quietMode = true;
|
|
1802
|
+
}
|
|
1795
1803
|
let sessionId;
|
|
1796
1804
|
const sessionIdx = args.indexOf("--session");
|
|
1797
1805
|
if (sessionIdx !== -1 && args[sessionIdx + 1]) {
|
|
@@ -2253,7 +2261,11 @@ async function createWorktreeCommand(workspaceRoot, args) {
|
|
|
2253
2261
|
if (split) {
|
|
2254
2262
|
await openNewTerminal(worktreePath);
|
|
2255
2263
|
} else if (process.platform === "darwin") {
|
|
2256
|
-
await cdInCurrentTerminal(worktreePath);
|
|
2264
|
+
const success = await cdInCurrentTerminal(worktreePath);
|
|
2265
|
+
if (!success) {
|
|
2266
|
+
console.log(chalk2.dim("\nNote: Auto-cd may require shell function setup."));
|
|
2267
|
+
console.log(chalk2.dim('Run: eval "$(csq --init)"'));
|
|
2268
|
+
}
|
|
2257
2269
|
} else {
|
|
2258
2270
|
console.log(worktreePath);
|
|
2259
2271
|
}
|
|
@@ -2315,6 +2327,45 @@ async function copyWorktreeFiles(sourceRoot, destRoot) {
|
|
|
2315
2327
|
async function cdInCurrentTerminal(targetPath) {
|
|
2316
2328
|
const { exec: exec2 } = await import("child_process");
|
|
2317
2329
|
const escapedPath = targetPath.replace(/'/g, "'\\''");
|
|
2330
|
+
const termProgram = process.env.TERM_PROGRAM;
|
|
2331
|
+
if (termProgram === "vscode" || termProgram?.includes("cursor")) {
|
|
2332
|
+
console.log(targetPath);
|
|
2333
|
+
return true;
|
|
2334
|
+
}
|
|
2335
|
+
if (termProgram === "iTerm.app") {
|
|
2336
|
+
const script = `
|
|
2337
|
+
tell application "iTerm"
|
|
2338
|
+
tell current session of current window
|
|
2339
|
+
write text "cd '${escapedPath}'"
|
|
2340
|
+
end tell
|
|
2341
|
+
end tell`;
|
|
2342
|
+
return new Promise((resolve2) => {
|
|
2343
|
+
exec2(`osascript -e '${script}'`, (error, stdout, stderr) => {
|
|
2344
|
+
if (error) {
|
|
2345
|
+
console.log(targetPath);
|
|
2346
|
+
resolve2(true);
|
|
2347
|
+
return;
|
|
2348
|
+
}
|
|
2349
|
+
resolve2(true);
|
|
2350
|
+
});
|
|
2351
|
+
});
|
|
2352
|
+
}
|
|
2353
|
+
if (termProgram === "Apple_Terminal") {
|
|
2354
|
+
const terminalScript = `
|
|
2355
|
+
tell application "Terminal"
|
|
2356
|
+
do script "cd '${escapedPath}'" in front window
|
|
2357
|
+
end tell`;
|
|
2358
|
+
return new Promise((resolve2) => {
|
|
2359
|
+
exec2(`osascript -e '${terminalScript}'`, (error, stdout, stderr) => {
|
|
2360
|
+
if (error) {
|
|
2361
|
+
console.log(targetPath);
|
|
2362
|
+
resolve2(true);
|
|
2363
|
+
return;
|
|
2364
|
+
}
|
|
2365
|
+
resolve2(true);
|
|
2366
|
+
});
|
|
2367
|
+
});
|
|
2368
|
+
}
|
|
2318
2369
|
const hasIterm = await new Promise((resolve2) => {
|
|
2319
2370
|
exec2('mdfind "kMDItemCFBundleIdentifier == com.googlecode.iterm2"', (error, stdout) => {
|
|
2320
2371
|
resolve2(!error && stdout.trim().length > 0);
|
|
@@ -2329,19 +2380,15 @@ tell application "iTerm2"
|
|
|
2329
2380
|
end tell`;
|
|
2330
2381
|
return new Promise((resolve2) => {
|
|
2331
2382
|
exec2(`osascript -e '${script}'`, (error) => {
|
|
2332
|
-
|
|
2383
|
+
if (error) {
|
|
2384
|
+
console.log(targetPath);
|
|
2385
|
+
}
|
|
2386
|
+
resolve2(true);
|
|
2333
2387
|
});
|
|
2334
2388
|
});
|
|
2335
2389
|
}
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
do script "cd '${escapedPath}'" in front window
|
|
2339
|
-
end tell`;
|
|
2340
|
-
return new Promise((resolve2) => {
|
|
2341
|
-
exec2(`osascript -e '${terminalScript}'`, (error) => {
|
|
2342
|
-
resolve2(!error);
|
|
2343
|
-
});
|
|
2344
|
-
});
|
|
2390
|
+
console.log(targetPath);
|
|
2391
|
+
return true;
|
|
2345
2392
|
}
|
|
2346
2393
|
async function openNewTerminal(targetPath) {
|
|
2347
2394
|
const { exec: exec2 } = await import("child_process");
|