Skip to content

refactor: abstract tmux into ProcessManager interface#144

Open
2witstudios wants to merge 2 commits intomainfrom
ppg/process-manager
Open

refactor: abstract tmux into ProcessManager interface#144
2witstudios wants to merge 2 commits intomainfrom
ppg/process-manager

Conversation

@2witstudios
Copy link
Owner

Summary

  • Introduce a ProcessManager interface (src/core/process-manager.ts) that abstracts all tmux operations behind a backend-agnostic API
  • Add TmuxBackend class to src/core/tmux.ts implementing the interface by delegating to existing functions
  • Add src/core/backend.ts factory with getBackend()/setBackend()/resetBackend() and platform detection (win32 → ConPTY, else → tmux)
  • Add experimental ConPtyBackend stub (src/core/conpty.ts) using node-pty as optional dependency
  • Migrate 25+ production files and 10+ test files from direct tmux imports to getBackend() calls
  • Add platform branching to terminal.ts — macOS (Terminal.app), Windows (wt.exe), Linux ($TERMINAL with gnome-terminal/konsole/xterm fallbacks)

Test plan

  • npm run typecheck passes (only pre-existing ws type errors remain)
  • npm test — 631/632 tests pass; the 1 failure (serveDaemonCommand) is pre-existing
  • All existing tmux-dependent tests updated to mock backend.js instead of tmux.js
  • Manual smoke test: ppg spawn, ppg status, ppg kill work as before

Introduce a ProcessManager interface that abstracts tmux operations behind
a backend-agnostic API, enabling future support for alternative process
managers (e.g. ConPTY on Windows).

- Add src/core/process-manager.ts with ProcessManager interface and types
- Add TmuxBackend class to tmux.ts implementing ProcessManager
- Add src/core/backend.ts factory with getBackend()/setBackend()/resetBackend()
- Add src/core/conpty.ts experimental ConPTY stub using node-pty
- Update all imports across 25+ production files and 10+ test files
- Add platform branching to terminal.ts (macOS/Windows/Linux)
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai
Copy link

coderabbitai bot commented Feb 27, 2026

Warning

Rate limit exceeded

@2witstudios has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 3 minutes and 13 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 7b5be50 and 244ebc1.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (112)
  • .gitignore
  • PPG CLI/PPG CLI/WebSocketManager.swift
  • PPG CLI/PPG CLITests/WebSocketManagerTests.swift
  • ios/PPGMobile/PPGMobile/App/ContentView.swift
  • ios/PPGMobile/PPGMobile/App/PPGMobileApp.swift
  • ios/PPGMobile/PPGMobile/Assets.xcassets/AppIcon.appiconset/Contents.json
  • ios/PPGMobile/PPGMobile/Assets.xcassets/Contents.json
  • ios/PPGMobile/PPGMobile/Models/AgentVariant.swift
  • ios/PPGMobile/PPGMobile/Models/DashboardModels.swift
  • ios/PPGMobile/PPGMobile/Models/Manifest.swift
  • ios/PPGMobile/PPGMobile/Models/ServerConnection.swift
  • ios/PPGMobile/PPGMobile/Models/ServerConnectionTests.swift
  • ios/PPGMobile/PPGMobile/Networking/PPGClient.swift
  • ios/PPGMobile/PPGMobile/Networking/TokenStorage.swift
  • ios/PPGMobile/PPGMobile/Networking/WebSocketManager.swift
  • ios/PPGMobile/PPGMobile/State/AppState.swift
  • ios/PPGMobile/PPGMobile/State/ManifestStore.swift
  • ios/PPGMobile/PPGMobile/Views/Dashboard/AgentRow.swift
  • ios/PPGMobile/PPGMobile/Views/Dashboard/DashboardView.swift
  • ios/PPGMobile/PPGMobile/Views/Dashboard/WorktreeCard.swift
  • ios/PPGMobile/PPGMobile/Views/Dashboard/WorktreeDetailView.swift
  • ios/PPGMobile/PPGMobile/Views/Settings/AddServerView.swift
  • ios/PPGMobile/PPGMobile/Views/Settings/QRScannerView.swift
  • ios/PPGMobile/PPGMobile/Views/Settings/SettingsView.swift
  • ios/PPGMobile/PPGMobile/Views/Spawn/SpawnView.swift
  • ios/PPGMobile/PPGMobile/Views/Terminal/TerminalInputBar.swift
  • ios/PPGMobile/PPGMobile/Views/Terminal/TerminalView.swift
  • ios/PPGMobile/PPGMobileTests/AgentVariantTests.swift
  • ios/PPGMobile/PPGMobileTests/ManifestTests.swift
  • ios/PPGMobile/PPGMobileTests/ServerConnectionTests.swift
  • ios/PPGMobile/project.yml
  • package.json
  • src/cli.ts
  • src/commands/aggregate.ts
  • src/commands/attach.ts
  • src/commands/clean.ts
  • src/commands/cron.ts
  • src/commands/init.ts
  • src/commands/kill.ts
  • src/commands/list.ts
  • src/commands/logs.ts
  • src/commands/merge.ts
  • src/commands/pr.ts
  • src/commands/reset.ts
  • src/commands/restart.ts
  • src/commands/send.ts
  • src/commands/serve.test.ts
  • src/commands/serve.ts
  • src/commands/spawn.test.ts
  • src/commands/spawn.ts
  • src/commands/status.ts
  • src/commands/swarm.ts
  • src/core/agent.test.ts
  • src/core/agent.ts
  • src/core/backend.ts
  • src/core/cleanup.test.ts
  • src/core/cleanup.ts
  • src/core/conpty.ts
  • src/core/kill.test.ts
  • src/core/kill.ts
  • src/core/lifecycle.ts
  • src/core/merge.test.ts
  • src/core/merge.ts
  • src/core/operations/kill.test.ts
  • src/core/operations/kill.ts
  • src/core/operations/merge.test.ts
  • src/core/operations/merge.ts
  • src/core/operations/restart.test.ts
  • src/core/operations/restart.ts
  • src/core/operations/spawn.test.ts
  • src/core/operations/spawn.ts
  • src/core/pr.ts
  • src/core/process-manager.ts
  • src/core/prompt.test.ts
  • src/core/prompt.ts
  • src/core/self.test.ts
  • src/core/self.ts
  • src/core/serve.test.ts
  • src/core/serve.ts
  • src/core/spawn.ts
  • src/core/terminal.ts
  • src/core/tls.ts
  • src/core/tmux.ts
  • src/lib/errors.ts
  • src/lib/paths.test.ts
  • src/lib/paths.ts
  • src/server/auth.test.ts
  • src/server/auth.ts
  • src/server/error-handler.test.ts
  • src/server/error-handler.ts
  • src/server/index.test.ts
  • src/server/index.ts
  • src/server/routes/agents.test.ts
  • src/server/routes/agents.ts
  • src/server/routes/config.test.ts
  • src/server/routes/config.ts
  • src/server/routes/spawn.test.ts
  • src/server/routes/spawn.ts
  • src/server/routes/status.test.ts
  • src/server/routes/status.ts
  • src/server/routes/worktrees.test.ts
  • src/server/routes/worktrees.ts
  • src/server/tls.test.ts
  • src/server/tls.ts
  • src/server/ws/events.ts
  • src/server/ws/handler.test.ts
  • src/server/ws/handler.ts
  • src/server/ws/terminal.test.ts
  • src/server/ws/terminal.ts
  • src/server/ws/watcher.test.ts
  • src/server/ws/watcher.ts
  • src/test-fixtures.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ppg/process-manager

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant