|
| 1 | +# SSHelp |
| 2 | + |
| 3 | +SSHelp is an agent-oriented SSH toolkit for running, observing, diagnosing, and safely editing work on remote Linux hosts. It combines bounded SSH commands, persistent tmux jobs, read-only terminal observation, process/resource diagnostics, and transactional remote file editing. |
| 4 | + |
| 5 | +SSHelp is distributed as a repository-local Codex Skill under [`sshelp/`](sshelp/). |
| 6 | + |
| 7 | +## Features |
| 8 | + |
| 9 | +- Run short, non-interactive SSH commands with structured JSON results. |
| 10 | +- Keep long-running or interactive work alive in tmux. |
| 11 | +- Read terminal output incrementally by byte offset. |
| 12 | +- Observe one job in Windows Terminal or a loopback-only ttyd page. |
| 13 | +- Display several jobs in a local read-only dashboard. |
| 14 | +- Diagnose quiet jobs using trusted tmux PIDs, process trees, resources, wait channels, ports, and GPU state. |
| 15 | +- Search remote source trees before downloading files. |
| 16 | +- Checkout selected files locally, edit with normal tools, detect conflicts, and commit with per-file atomic replacement. |
| 17 | +- Bootstrap fixed prerequisites on a new Linux host after explicit authorization. |
| 18 | + |
| 19 | +## Quick Start |
| 20 | + |
| 21 | +Requirements: |
| 22 | + |
| 23 | +- Python 3.11 or newer on the local machine. |
| 24 | +- OpenSSH client with a configured host alias and public-key authentication. |
| 25 | +- A Linux SSH host. SSHelp can install its fixed remote prerequisites with explicit approval. |
| 26 | + |
| 27 | +From the cloned repository, resolve the Skill entry once, then keep your shell in the project you are actually working on: |
| 28 | + |
| 29 | +```powershell |
| 30 | +$SSHelpRepo = (Resolve-Path .).Path |
| 31 | +$SSHelp = Join-Path $SSHelpRepo "sshelp\scripts\sshelp.py" |
| 32 | +$SSHelpWindows = Join-Path $SSHelpRepo "sshelp\scripts\SSHelp.ps1" |
| 33 | +
|
| 34 | +Set-Location D:\Project |
| 35 | +python $SSHelp host test --host lab-host |
| 36 | +python $SSHelp exec --host lab-host --cwd /home/user/project -- git status --short |
| 37 | +``` |
| 38 | + |
| 39 | +For a new server, install the fixed prerequisite set only after reviewing the action: |
| 40 | + |
| 41 | +```powershell |
| 42 | +python $SSHelp host install --host lab-host --yes |
| 43 | +python $SSHelp host test --host lab-host |
| 44 | +``` |
| 45 | + |
| 46 | +Start and monitor a persistent job: |
| 47 | + |
| 48 | +```powershell |
| 49 | +python $SSHelp job start --host lab-host --cwd /home/user/project -- python3 -u train.py |
| 50 | +python $SSHelp job read --host lab-host --job-id JOB_ID --offset 0 |
| 51 | +python $SSHelp job status --host lab-host --job-id JOB_ID |
| 52 | +``` |
| 53 | + |
| 54 | +Run `python $SSHelp --help` for the complete command tree. See [`sshelp/SKILL.md`](sshelp/SKILL.md) for the Agent workflow. |
| 55 | + |
| 56 | +## Project-Local State |
| 57 | + |
| 58 | +SSHelp does not place file checkouts in the Skill repository. Local state is created under the current project: |
| 59 | + |
| 60 | +```text |
| 61 | +<project>/.sshelp/ |
| 62 | +├── checkouts/ |
| 63 | +└── runtime/ |
| 64 | +``` |
| 65 | + |
| 66 | +These paths are ignored by Git. Set `SSHELP_WORK_ROOT` to override the project state root. |
| 67 | + |
| 68 | +## Repository Layout |
| 69 | + |
| 70 | +```text |
| 71 | +sshelp/ |
| 72 | +├── README.md |
| 73 | +├── CONTRIBUTING.md |
| 74 | +├── SECURITY.md |
| 75 | +├── docs/ |
| 76 | +├── sshelp/ # Codex Skill |
| 77 | +│ ├── SKILL.md |
| 78 | +│ ├── agents/ |
| 79 | +│ ├── assets/ |
| 80 | +│ ├── references/ |
| 81 | +│ └── scripts/ |
| 82 | +└── tests/ |
| 83 | +``` |
| 84 | + |
| 85 | +The Skill remains self-contained. The root documentation is for contributors and GitHub readers. |
| 86 | + |
| 87 | +## Development |
| 88 | + |
| 89 | +SSHelp has no third-party local runtime dependency. Run the test suite with: |
| 90 | + |
| 91 | +```powershell |
| 92 | +$env:PYTHONDONTWRITEBYTECODE = "1" |
| 93 | +python -m unittest discover -s tests -v |
| 94 | +``` |
| 95 | + |
| 96 | +The test suite uses mocked SSH/SFTP for safety. Lenovo-specific integration tests used during development are not encoded as public defaults. |
| 97 | + |
| 98 | +## Security Model |
| 99 | + |
| 100 | +- Public-key or ssh-agent authentication only for automated operations. |
| 101 | +- Host-key verification remains enabled. |
| 102 | +- No private-key contents, stored passwords, arbitrary package names, SIGKILL, or recursive remote cleanup. |
| 103 | +- Web observers bind to loopback on both remote and local machines. |
| 104 | +- File commits use path validation, SHA-256 conflict detection, and same-directory atomic replacement. |
| 105 | + |
| 106 | +Read [`SECURITY.md`](SECURITY.md) before reporting a vulnerability. |
| 107 | + |
| 108 | +## Project Status |
| 109 | + |
| 110 | +The current implementation is tested on Windows clients and Linux SSH hosts. Contributions for additional platforms, distributions, diagnostics, documentation, and test coverage are welcome. |
| 111 | + |
| 112 | +## License |
| 113 | + |
| 114 | +SSHelp is licensed under the [Apache License 2.0](LICENSE). |
0 commit comments