From 75cf36183811a1a9208baf6d75b56c274debebca Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Thu, 2 Jul 2026 10:33:34 -0400 Subject: feat(ai-term): auto-set each project's session color on fresh launch Every project now maps to a stable Claude Code session color: an override alist wins, else a character-sum hash of the project basename picks one of the eight names. When a fresh tmux session is created (never on reattach), a poller waits for the TUI to boot and types /color itself, with the Enter deferred a beat so the slash-command menu can't swallow it. Two refusals keep the injection safe: the bypass banner must be on screen (a bare shell never gets typed into) and the prompt line must still be empty (typed-ahead input is never corrupted). --- tests/test-ai-term--show-or-create.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tests/test-ai-term--show-or-create.el') diff --git a/tests/test-ai-term--show-or-create.el b/tests/test-ai-term--show-or-create.el index 4f5f1f67..9574b8a6 100644 --- a/tests/test-ai-term--show-or-create.el +++ b/tests/test-ai-term--show-or-create.el @@ -44,7 +44,13 @@ mirroring the real entry point." (push (buffer-name b) ,calls) b))) ((symbol-function 'cj/--ai-term-send-string) - (lambda (_buf s) (push s ,strings)))) + (lambda (_buf s) (push s ,strings))) + ;; Keep the create path hermetic: no tmux subprocess for the + ;; fresh-session check, no real /color poll timer. + ((symbol-function 'cj/--ai-term-live-tmux-sessions) + (lambda () nil)) + ((symbol-function 'cj/--ai-term-schedule-color) + (lambda (_buffer _color) nil))) ,@body)))) (defun test-ai-term--cleanup (name) -- cgit v1.2.3