project-compass 3.3.7 → 3.3.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/package.json +1 -1
- package/src/cli.js +25 -29
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -266,18 +266,33 @@ function Compass({rootPath, initialView = 'navigator'}) {
|
|
|
266
266
|
return map;
|
|
267
267
|
}, [detailedIndexed]);
|
|
268
268
|
|
|
269
|
-
const
|
|
270
|
-
runningProcessMap.current.
|
|
271
|
-
|
|
269
|
+
const handleKillTask = useCallback((taskId) => {
|
|
270
|
+
const proc = runningProcessMap.current.get(taskId);
|
|
271
|
+
if (proc) {
|
|
272
|
+
addLogToTask(taskId, kleur.yellow('! Triggering emergency kill sequence...'));
|
|
273
|
+
try {
|
|
272
274
|
if (process.platform === 'win32') {
|
|
273
275
|
execa('taskkill', ['/pid', proc.pid, '/f', '/t']);
|
|
274
|
-
} else {
|
|
276
|
+
} else if (proc.pid) {
|
|
275
277
|
process.kill(-proc.pid, 'SIGKILL');
|
|
278
|
+
} else {
|
|
279
|
+
proc.kill('SIGKILL');
|
|
276
280
|
}
|
|
277
|
-
} catch {
|
|
281
|
+
} catch (e) {
|
|
282
|
+
addLogToTask(taskId, kleur.red(`✗ Kill failed: ${e.message}`));
|
|
283
|
+
}
|
|
284
|
+
} else {
|
|
285
|
+
setTasks(prev => prev.filter(t => t.id !== taskId));
|
|
286
|
+
if (activeTaskId === taskId) setActiveTaskId(null);
|
|
287
|
+
}
|
|
288
|
+
}, [activeTaskId, addLogToTask]);
|
|
289
|
+
|
|
290
|
+
const killAllTasks = useCallback(() => {
|
|
291
|
+
runningProcessMap.current.forEach((proc, tid) => {
|
|
292
|
+
handleKillTask(tid);
|
|
278
293
|
});
|
|
279
294
|
runningProcessMap.current.clear();
|
|
280
|
-
}, []);
|
|
295
|
+
}, [handleKillTask]);
|
|
281
296
|
|
|
282
297
|
const runProjectCommand = useCallback(async (commandMeta, targetProject = selectedProject) => {
|
|
283
298
|
const project = targetProject || selectedProject;
|
|
@@ -327,27 +342,6 @@ function Compass({rootPath, initialView = 'navigator'}) {
|
|
|
327
342
|
}
|
|
328
343
|
}, [addLogToTask, selectedProject]);
|
|
329
344
|
|
|
330
|
-
const handleKillTask = useCallback((taskId) => {
|
|
331
|
-
const proc = runningProcessMap.current.get(taskId);
|
|
332
|
-
if (proc) {
|
|
333
|
-
addLogToTask(taskId, kleur.yellow('! Force killing process group...'));
|
|
334
|
-
try {
|
|
335
|
-
if (process.platform === 'win32') {
|
|
336
|
-
execa('taskkill', ['/pid', proc.pid, '/f', '/t']);
|
|
337
|
-
} else if (proc.pid) {
|
|
338
|
-
process.kill(-proc.pid, 'SIGKILL');
|
|
339
|
-
} else {
|
|
340
|
-
proc.kill('SIGKILL');
|
|
341
|
-
}
|
|
342
|
-
} catch (e) {
|
|
343
|
-
addLogToTask(taskId, kleur.red(`✗ Kill failed: ${e.message}`));
|
|
344
|
-
}
|
|
345
|
-
} else {
|
|
346
|
-
setTasks(prev => prev.filter(t => t.id !== taskId));
|
|
347
|
-
if (activeTaskId === taskId) setActiveTaskId(null);
|
|
348
|
-
}
|
|
349
|
-
}, [activeTaskId, addLogToTask]);
|
|
350
|
-
|
|
351
345
|
const exportLogs = useCallback(() => {
|
|
352
346
|
const taskToExport = tasks.find(t => t.id === activeTaskId);
|
|
353
347
|
if (!taskToExport || !taskToExport.logs.length) return;
|
|
@@ -367,6 +361,8 @@ function Compass({rootPath, initialView = 'navigator'}) {
|
|
|
367
361
|
return;
|
|
368
362
|
}
|
|
369
363
|
|
|
364
|
+
const isCtrlC = (key.ctrl && input === 'c') || input === '\u0003';
|
|
365
|
+
|
|
370
366
|
if (customMode) {
|
|
371
367
|
if (key.return) {
|
|
372
368
|
const raw = customInput.trim();
|
|
@@ -483,14 +479,14 @@ function Compass({rootPath, initialView = 'navigator'}) {
|
|
|
483
479
|
if (key.downArrow) { setActiveTaskId(prev => tasks[(tasks.findIndex(t => t.id === prev) + 1) % tasks.length]?.id); return; }
|
|
484
480
|
if (shiftCombo('k') && activeTaskId) { handleKillTask(activeTaskId); return; }
|
|
485
481
|
if (shiftCombo('r') && activeTaskId) { setRenameMode(true); setRenameInput(activeTask.name); setRenameCursor(activeTask.name.length); return; }
|
|
486
|
-
if (
|
|
482
|
+
if (isCtrlC) { handleKillTask(activeTaskId); return; }
|
|
487
483
|
}
|
|
488
484
|
if (key.return) { setMainView('navigator'); return; }
|
|
489
485
|
return;
|
|
490
486
|
}
|
|
491
487
|
|
|
492
488
|
if (running && activeTaskId && runningProcessMap.current.has(activeTaskId)) {
|
|
493
|
-
if (
|
|
489
|
+
if (isCtrlC) { handleKillTask(activeTaskId); setStdinBuffer(''); setStdinCursor(0); return; }
|
|
494
490
|
if (key.return) {
|
|
495
491
|
const proc = runningProcessMap.current.get(activeTaskId);
|
|
496
492
|
proc?.stdin?.write(stdinBuffer + '\n'); setStdinBuffer(''); setStdinCursor(0); return;
|