Create internal/zellij package for terminal multiplexer abstraction #68
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR extracts all zellij terminal multiplexer code from
internal/claude/runner.gointo a dedicatedinternal/zellij/package. The new package provides clean abstractions for session, tab, and pane management with proper typing and error handling.Key changes:
internal/zellij/zellij.gowith a type-safeClientstruct and comprehensive APIinternal/claude/runner.goto use the new zellij packageNew Package API
The
internal/zellijpackage provides:Session Management
ListSessions()- List all zellij sessionsSessionExists()- Check if a session existsCreateSession()- Create a new session (detached)EnsureSession()- Create session if it doesn't existTab Management
CreateTab()- Create a new tab with name and working directorySwitchToTab()- Switch to a tab by nameQueryTabNames()- List all tab names in a sessionTabExists()- Check if a tab existsCloseTab()- Close the current tabPane Input Control
WriteASCII()- Write ASCII codes (Ctrl+C, Enter, etc.)WriteChars()- Write text to the paneSendCtrlC()- Convenience method for interruptSendEnter()- Convenience method for enter keyExecuteCommand()- Write command and send EnterHigh-Level Operations
TerminateProcess()- Send Ctrl+C twice with delay for reliable terminationClearAndExecute()- Clear line and run a commandTerminateAndCloseTab()- Terminate process and close tabBenefits
exec.Commandcalls scattered throughout the codebaseIssues Resolved
Test Plan
go test ./internal/zellij/...go test ./...go build -o co .🤖 Generated with Claude Code