Skip to content

Commit b5abe15

Browse files
committed
docs: update CLAUDE.md with SSH sessions, testing, and release process
1 parent 1d1d8d8 commit b5abe15

1 file changed

Lines changed: 42 additions & 4 deletions

File tree

CLAUDE.md

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ src/CodeShellManager/
5555
├── MainWindow.xaml / .cs # Main UI (toolbar, sidebar, terminal grid)
5656
├── Models/
5757
│ ├── AppState.cs # AppSettings + AppState (JSON root)
58-
│ ├── ShellSession.cs # Session data model
58+
│ ├── ShellSession.cs # Session data model (incl. SSH fields + BuildSshArgs)
5959
│ ├── SessionGroup.cs # Group model
6060
│ └── AlertEvent.cs # Alert types: InputRequired, ToolApproval
6161
├── Services/
@@ -81,6 +81,10 @@ src/CodeShellManager/
8181
├── terminal.html # xterm.js host page
8282
├── xterm.js / xterm.css
8383
└── xterm-addon-fit.js
84+
85+
tests/
86+
├── CodeShellManager.Tests/ # xunit unit tests (model logic, headless)
87+
└── CodeShellManager.UITests/ # FlaUI UI tests (requires live desktop)
8488
```
8589

8690
## Color / Theme
@@ -91,16 +95,28 @@ src/CodeShellManager/
9195
- Accent blue: `#89b4fa`, Green: `#a6e3a1`, Alert pink: `#f38ba8`
9296
- Hover: `#45475a`, Selected: `#585b70`
9397

94-
**Session accent colors**`ColorService.GetHexColor(folderPath)` uses FNV-1a hash to deterministically assign one of 12 colors. Used as sidebar stripe + terminal toolbar top border.
98+
**Session accent colors**`ColorService.GetHexColor(key)` uses FNV-1a hash to deterministically assign one of 12 colors. For local sessions the key is `WorkingFolder`; for SSH sessions it is `user@host`. Used as sidebar stripe + terminal toolbar top border.
9599

96100
## Session Lifecycle
97101

98-
1. User clicks **+ New Session**`NewSessionDialog` modal
99-
2. `SessionManager.CreateSession()` creates `ShellSession` model
102+
1. User clicks **+ New Session**`NewSessionDialog` modal (Local or Remote SSH)
103+
2. `SessionManager.CreateSession()` creates `ShellSession` model; caller copies SSH fields if remote
100104
3. `LaunchSessionAsync()` creates: `SessionViewModel``WebView2``TerminalBridge``PseudoTerminal`
101105
4. `OutputIndexer` indexes all output to SQLite; `AlertDetector` watches for prompts
102106
5. On close: `Dispose()` chain cleans up PTY, bridge, indexer, detector
103107

108+
## SSH Remote Sessions
109+
110+
Remote sessions use the system `ssh` client as the PTY command — no extra library.
111+
112+
- `ShellSession.IsRemote` flag distinguishes remote from local sessions
113+
- SSH config fields on `ShellSession`: `SshUser`, `SshHost`, `SshPort` (default 22), `SshRemoteFolder`
114+
- `ShellSession.BuildSshArgs()` (internal) produces: `-t [–p PORT] user@host "cd 'folder' && shell"`
115+
- `LaunchSessionAsync()` branches on `IsRemote`: uses `ssh` + `BuildSshArgs()`, skips Claude auto-resume
116+
- `PseudoTerminal.BuildCmdLine` passes `ssh` through directly (same as `cmd`/`pwsh`) — not wrapped in PowerShell
117+
- `SessionViewModel.RefreshGitInfoAsync()` early-returns for remote sessions (no local working folder)
118+
- SSH fields serialize to `state.json` automatically — sessions restore and relaunch on next startup
119+
104120
## Alert / Waiting State
105121

106122
`AlertDetector` fires `AlertRaised(AlertEvent)` after 1.5s idle when it detects:
@@ -141,6 +157,28 @@ Persisted in `state.json`. Key settings:
141157
| `Escape` (in search) | Close search panel |
142158
| `Enter` (in search) | Execute search |
143159

160+
## Testing
161+
162+
| Project | Type | Command |
163+
|---|---|---|
164+
| `tests/CodeShellManager.Tests/` | Unit tests (xunit) | `dotnet test tests/CodeShellManager.Tests/` |
165+
| `tests/CodeShellManager.UITests/` | FlaUI UI tests | `dotnet test tests/CodeShellManager.UITests/` |
166+
167+
Unit tests cover model logic (`ShellSession`, etc.) and run headless. UI tests require the app running on a live Windows desktop.
168+
169+
`ShellSession.BuildSshArgs()` is `internal` — accessible from tests via `[assembly: InternalsVisibleTo("CodeShellManager.Tests")]` in `AssemblyInfo.cs`.
170+
171+
## Releases
172+
173+
CI/CD is in `.github/workflows/build.yml`. Releases are triggered by pushing a `v*.*.*` tag:
174+
175+
```bash
176+
git tag v1.2.3 -m "v1.2.3 - description"
177+
git push origin v1.2.3
178+
```
179+
180+
The tag value overrides the csproj `<Version>` at publish time (`-p:Version=` flag). **Do not rely on the csproj version number** — bump it for local build clarity only. CI produces a signed exe, MSI installer, and portable ZIP, then creates a GitHub Release automatically.
181+
144182
## Known Conventions
145183

146184
- All WPF color literals use Catppuccin Mocha hex values — do not introduce system colors

0 commit comments

Comments
 (0)