mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-09 16:59:43 +02:00
fix: bulletproof test safety — IS_TEST_MODE guards prevent tests from killing real tmux sessions
Added IS_TEST_MODE (process.env.VITEST) guards to every method in TmuxManager and ScreenManager that touches real tmux/screen sessions. Tests can never create, kill, discover, or send input to real sessions. Removed broken E2E test suite entirely. Rewrote test/setup.ts from 459 lines to minimal cleanup. Rewrote tmux-related tests to verify test-mode safety behavior. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1382,6 +1382,22 @@ export class RalphTracker extends EventEmitter {
|
||||
* @returns True if any Ralph-related pattern is detected
|
||||
*/
|
||||
private shouldAutoEnable(data: string): boolean {
|
||||
// Cheap pre-filter: skip the full regex battery if none of the key
|
||||
// substrings that any pattern could match are present in the data.
|
||||
// This avoids 12 regex tests on every PTY chunk (the common case).
|
||||
if (
|
||||
!data.includes('<') && // <promise>, TodoWrite
|
||||
!data.includes('ralph') && !data.includes('Ralph') &&
|
||||
!data.includes('Todo') && !data.includes('todo') &&
|
||||
!data.includes('Iteration') && !data.includes('[') &&
|
||||
!data.includes('\u2610') && !data.includes('\u2612') && // ☐ ☒
|
||||
!data.includes('\u2714') && // ✔
|
||||
!data.includes('Loop') && !data.includes('complete') &&
|
||||
!data.includes('COMPLETE') && !data.includes('Done') && !data.includes('DONE')
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Ralph loop command: /ralph-loop:ralph-loop
|
||||
if (RALPH_START_PATTERN.test(data)) {
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user