Skip to content

Commit 4ce5398

Browse files
committed
Add SSHelp remote development skill
1 parent 7123c78 commit 4ce5398

46 files changed

Lines changed: 8092 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.{yml,yaml,json}]
15+
indent_size = 2
16+
17+
[*.ps1]
18+
end_of_line = crlf

.github/workflows/tests.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: tests
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
unittest:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
python-version: ["3.11", "3.13"]
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-python@v5
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
- name: Run tests
22+
env:
23+
PYTHONDONTWRITEBYTECODE: "1"
24+
run: python -m unittest discover -s tests -v

.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Local agent and editor state
2+
/.agents/
3+
/.codex/
4+
/.reasonix/
5+
/.local/
6+
/.sshelp/
7+
/.srd-tmp/
8+
/.vscode/
9+
/.idea/
10+
11+
# Python
12+
__pycache__/
13+
*.py[cod]
14+
.pytest_cache/
15+
.coverage
16+
htmlcov/
17+
.venv/
18+
venv/
19+
20+
# SSHelp runtime state in any example project
21+
**/.sshelp/
22+
**/.srd-tmp/
23+
24+
# OS files
25+
.DS_Store
26+
Thumbs.db
27+
Desktop.ini

CONTRIBUTING.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Contributing to SSHelp
2+
3+
Thank you for helping improve SSHelp.
4+
5+
## Before Opening A Change
6+
7+
- Search existing issues and discussions.
8+
- Keep changes focused on one behavior or documentation concern.
9+
- Do not include real hostnames, IP addresses, usernames, private paths, credentials, terminal logs, or research data.
10+
- Discuss destructive behavior, authentication changes, package installation, or new remote write operations before implementation.
11+
12+
## Development Workflow
13+
14+
1. Fork the repository and create a focused branch.
15+
2. Keep the Skill self-contained under `sshelp/`.
16+
3. Preserve the single-JSON-object CLI contract.
17+
4. Keep automated SSH authentication in `BatchMode=yes`.
18+
5. Add tests proportional to the behavior and risk.
19+
6. Run:
20+
21+
```powershell
22+
$env:PYTHONDONTWRITEBYTECODE = "1"
23+
python -m unittest discover -s tests -v
24+
```
25+
26+
## Compatibility
27+
28+
New code uses `SSHELP_*`, `sshelp-*`, and `~/.sshelp`. Compatibility with existing `SSH_RESEARCH_*`, `srd-*`, and `~/.ssh-research-debug` state must not be removed without a documented migration plan.
29+
30+
## Pull Requests
31+
32+
Describe:
33+
34+
- The user problem and intended behavior.
35+
- Security and failure-mode considerations.
36+
- Tests performed, including whether a real SSH host was used.
37+
- Any new remote files, processes, ports, packages, or cleanup behavior.
38+
39+
Do not commit generated `.sshelp`, `.srd-tmp`, `__pycache__`, dashboard runtime, SSH configuration, or key material.

README.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
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).

SECURITY.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Security Policy
2+
3+
## Reporting A Vulnerability
4+
5+
Use GitHub private vulnerability reporting when it is enabled for the repository. Do not publish credentials, private keys, host addresses, terminal output, or exploit details in a public issue.
6+
7+
Include the affected command, expected boundary, observed behavior, and a minimal reproduction that uses non-sensitive test data.
8+
9+
## Security Boundaries
10+
11+
SSHelp is designed to:
12+
13+
- Use public-key or ssh-agent authentication for automated commands.
14+
- Keep host-key verification enabled.
15+
- Avoid reading or transporting private-key contents.
16+
- Restrict task control to validated SSHelp tmux sessions.
17+
- Keep observers read-only and bound to loopback.
18+
- Reject path traversal, symlink writes, secret filenames, and remote file conflicts.
19+
- Require explicit confirmation for prerequisite installation.
20+
- Avoid SIGKILL, arbitrary PID control, and recursive remote cleanup.
21+
22+
Report any behavior that crosses these boundaries privately.
23+
24+
## Supported Versions
25+
26+
Until formal releases exist, only the latest commit on the default branch is supported.

0 commit comments

Comments
 (0)