Separate Slack text input from Enter submission #11

Merged
jihoson merged 3 commits from fix/output-throttle into main 2026-02-17 06:04:03 +09:00
3 changed files with 17 additions and 3 deletions
Showing only changes of commit b3ce2622e3 - Show all commits

View File

@@ -82,7 +82,7 @@ python -m lazy_enter
실행 후 Slack의 허용된 채널에서: 실행 후 Slack의 허용된 채널에서:
- `/start-claude`, `/start-codex`: 기존 세션에 연결 - `/start-claude`, `/start-codex`: 기존 세션에 연결
- 일반 메시지 전송: 현재 연결된 CLI(Claude/Codex)로 입력만 전달 (엔터 미포함) - 일반 메시지 전송: 현재 연결된 CLI(Claude/Codex)로 입력만 전달 (엔터 미포함)
- `!enter` 전송: 엔터 키만 전달 (현재 프롬프트 제출) - `!`, `!e`, `!enter` 전송: 엔터 키만 전달 (현재 프롬프트 제출)
- `/stop-claude`, `/stop-codex`: 브릿지 연결 해제 (세션 유지) - `/stop-claude`, `/stop-codex`: 브릿지 연결 해제 (세션 유지)
## 테스트 및 품질 점검 ## 테스트 및 품질 점검

View File

@@ -18,7 +18,7 @@ logger = logging.getLogger(__name__)
class Bridge: class Bridge:
"""Slack ↔ CLI 프로세스 간의 중계기.""" """Slack ↔ CLI 프로세스 간의 중계기."""
ENTER_COMMAND = "!enter" ENTER_COMMANDS = {"!", "!e", "!enter"}
def __init__(self, config: Config | None = None) -> None: def __init__(self, config: Config | None = None) -> None:
self.config = config or Config() self.config = config or Config()
@@ -45,7 +45,7 @@ class Bridge:
self.slack.send_message(channel, ":warning: 연결된 세션이 없습니다.") self.slack.send_message(channel, ":warning: 연결된 세션이 없습니다.")
return return
if text.strip().lower() == self.ENTER_COMMAND: if text.strip().lower() in self.ENTER_COMMANDS:
self.pty.send_enter() self.pty.send_enter()
self._last_sent_output = "" self._last_sent_output = ""
self._last_sent_fingerprint = None self._last_sent_fingerprint = None

View File

@@ -160,6 +160,20 @@ def test_handle_message_enter_command_sends_enter_only(monkeypatch) -> None:
assert pty.enter_count == 1 assert pty.enter_count == 1
def test_handle_message_short_enter_alias_sends_enter_only(monkeypatch) -> None:
FakePtyManager.instances.clear()
bridge = _make_bridge(monkeypatch)
bridge._handle_command("start", "codex", "C1")
pty = FakePtyManager.instances[-1]
bridge._handle_message("!", "C1")
bridge._handle_message("!e", "C1")
assert pty.sent_inputs == []
assert pty.enter_count == 2
def test_split_message_preserves_all_content(monkeypatch) -> None: def test_split_message_preserves_all_content(monkeypatch) -> None:
bridge = _make_bridge(monkeypatch) bridge = _make_bridge(monkeypatch)
chunks = bridge._split_message("line1\nline2\nline3", max_length=7) chunks = bridge._split_message("line1\nline2\nline3", max_length=7)