Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ name: Build

on:
push:
branches: [main]
branches: ["*"]
pull_request:
branches: ["*"]

permissions:
contents: read
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ jobs:
args: '--bundles nsis'
- platform: ubuntu-22.04
args: ''
- platform: macos-latest
args: '--target aarch64-apple-darwin'
- platform: macos-latest
args: '--target x86_64-apple-darwin'

runs-on: ${{ matrix.platform }}

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Download from [Releases](https://github.com/branchcode/branchcode/releases).
| 5 | Custom model endpoints | ❌ |
| 6 | File tree & project management | ❌ |
| 7 | Settings & preferences | ❌ |
| 8 | SSH tunneling (remote server coding)| |
| 8 | SSH tunneling (remote server coding)| 🔨 |
| 9 | Cross-platform testing (Linux/macOS)| ⚠️ |

## Developing
Expand Down
3 changes: 3 additions & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions docs/ssh_integration/walkthrough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# SSH Remote Development Integration

This document serves as a comprehensive walkthrough and post-mortem outlining the SSH Remote Access integration architecture within BranchCode. The implementation spans native pure-Rust backend capabilities synchronized seamlessly with React functional components on the frontend.

## 1. Backend Infrastructure
Instead of relying on OS-level C/CMake build environments (like `libssh2`), we utilized pure-Rust implementations.
* **Dependencies**: `russh` v0.46, `russh-keys`, and `russh-sftp` were utilized for entirely cross-platform compilation capabilities void of native bindings.
* **Core Systems**: `ssh_client.rs` was instated. The main implementation is encapsulated within the singleton `SshManager` which governs generic SSH lifecycle tasks including configuration persistence, thread coordination, secure password and key-pair (public-key bindings using `Arc<key::KeyPair>`) based authentication semantics, and explicit resource allocations.
* **Tauri Exposures**: The backend handles all states using global Tauri contexts (`SshState` mutexes) exposing 15 remote operations.
* **Caveats Resolved**: Alignment with `russh 0.46.0` trait constraints (handling string interpolations around `CryptoVec::from(data.to_vec())` to cast raw memory buffer shells respectively) was extensively managed.

## 2. Frontend Connectivity
* **The useSsh Hook**: Actively maintains remote server states synced against the backend. It tracks instances across: `servers[]`, `connections[]`, and manages polling mechanisms to ensure UI parity on SSH drop-outs.
* **Data Typings**: TypeScript bindings (`tauri.ts`) seamlessly define shapes for `SshConnectionInfo` and `SshServerConfig` facilitating robust frontend rendering of state components.
* **GitPanel Sub-Layer**: The left `GitPanel` dock was retrofitted to house dynamic SSH components. It manages the custom "Add/Edit" authentication payload modal, handling custom credential passing efficiently (tracking both passphrase strings and active paths).

## 3. Mixed File Tree Architecture
To allow transparent integration navigating both remote and local files, a mixed directory tree was orchestrated:
* **Separation of Concerns**: We constructed `useRemoteFileTree.ts` which uniquely pipes `sftp_list_dir` payload buffers parsed natively through Tauri.
* **User Interface**: `App.tsx` conditionally isolates files logically. Local resources retain standard representations, while all remote assets are uniquely tracked under distinct headers stamped visually utilizing **Globe** icons, reinforcing navigation locality visually off-hand.

## 4. Left Sidebar Structural Revamp
To make way for extended project hierarchies:
* **The ProjectFolder Component**: We eliminated the flat mapping structure for conversations. The `ProjectFolder` allows hierarchical nesting under distinct umbrellas.
* Local workspace conversations naturally collapse under independent project folders, minimizing vertical bloat constraints.
* Remote assets scale seamlessly rendering distinct `ProjectFolder` entries marked heavily via teal accent server indicators, actively tracing heartbeat connectivity dots organically inline.

## 5. Terminal Multiplexing Architecture
Binding remote shells into our global ecosystem was natively implemented:
* **Custom Event Emisisons**: Within `App.tsx`, invoking terminal requests on any active backend node safely binds and triggers decoupled custom `spawn-ssh-terminal` window broadcasts natively tracked contextually through `TerminalPanel`.
* **State Execution**: `useTerminal.ts` was fundamentally decoupled. It now binds natively against `type: 'ssh'` conditional parameters spawning `ssh_spawn_shell` backend abstractions.
* **Socket Emulation**: Rather than relying strictly over abstract PTY shells, PTY capabilities are artificially requested via native SFTP `xterm-256color` multiplex layers rendering completely via real-time WebSocket-like `ssh:data` and `ssh:exit` Tauri event emitters.
* **Distinguishing GUI Traits**: Remote tabs are explicitly prefixed uniformly with **`SSH: [Server Name]`** keeping workflows visually discrete from native local environments.

## Future Recommendations
* **Reverse Port Forwarding**: Currently, OpenCode servers are localized. Port Forwarding logic bridging localized proxies towards standard OpenCode HTTP nodes remotely can seamlessly bridge remote agents logically.
* **Keep-Alives**: Consider instituting KeepAlive routines natively via custom Tauri background worker intervals maintaining arbitrary TTL connections passively preventing premature drop-outs natively alongside typical background SSH behavior.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"@tauri-apps/api": "^2",
"@tauri-apps/plugin-shell": "^2",
"@tauri-apps/plugin-updater": "^2",
"@tauri-apps/plugin-dialog": "^2",
"ghostty-web": "^0.4.0",
"lucide-react": "^0.546.0",
"motion": "^12.23.24",
Expand Down
5 changes: 5 additions & 0 deletions public/icons-ide/anyType.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/icons-ide/anyType_dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions public/icons-ide/c.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions public/icons-ide/c_dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions public/icons-ide/cmake.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions public/icons-ide/config.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions public/icons-ide/config_dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading