-
Notifications
You must be signed in to change notification settings - Fork 1
Open
1 / 11 of 1 issue completedOpen
1 / 11 of 1 issue completed
Copy link
Labels
area:workspaceWorkspace tooling, justfile, templatesWorkspace tooling, justfile, templateseffort:medium1-4 hours1-4 hoursfeatureNew feature or requestNew feature or requestsemver:minorNew feature, backward-compatibleNew feature, backward-compatible
Description
Description
Create scripts/devc-remote.sh — the main bash script that orchestrates starting a devcontainer on a remote host via SSH. This script handles everything except URI construction (which is in the Python helper, sibling sub-issue).
Problem Statement
Part of #70. The remote devcontainer orchestration requires a bash script that handles SSH connectivity, pre-flight checks, container state detection, and compose lifecycle management. This is the core orchestration logic.
Proposed Solution
A single bash script with the following functions:
parse_args()—<ssh-host>(required),--path <remote-path>(optional, default~/),--helpdetect_editor_cli()— prefercursor, fall back tocodecheck_ssh()—ssh -o ConnectTimeout=5 -o BatchMode=yes <host> trueremote_preflight()— single SSH heredoc call batching all remote checks: runtime detection (podman > docker), compose availability, repo path exists,.devcontainer/exists, disk space, OS type. Returns structured key=value output.remote_compose_up()— container state detection (6-state matrix from [FEATURE] Remote devcontainer orchestration via just recipe #70),compose up -d, health poll (30s timeout, 5s interval, log tail on failure)open_editor()— calls Python URI helper (devc_remote_uri.py), then$EDITOR_CLI --folder-uri "$URI"- Logging follows
scripts/init.shpatterns (log_info,log_success,log_warning,log_error) set -euo pipefailthroughout
Container state matrix
| State | Action |
|---|---|
| Running, healthy | Skip compose up, open editor |
| Running, unhealthy/restarting | compose restart, health poll, open editor |
| Exited/stopped | compose up -d, health poll, open editor |
| Not found | compose up -d, health poll, open editor |
| Running, config changed | compose up -d (detects changes), open editor |
| Running, image updated | compose up -d (detects image change), open editor |
Pre-flight checks
Local:
cursororcodeCLI in PATH- SSH host reachable + auth works
Remote (single SSH session):
- Container runtime exists (podman > docker)
- Compose plugin available
- Repo path exists
.devcontainer/directory exists in repo- Disk space ≥ 2GB (warn if low)
- OS detection (warn if macOS)
Files
- Create:
scripts/devc-remote.sh - Create:
tests/bats/devc-remote.bats
Testing Strategy
BATS unit tests with mocked commands:
- Argument parsing: missing host,
--pathhandling,--help, unknown flags detect_editor_cli(): cursor found, code found, neither foundcheck_ssh(): success, connection failure, auth failure- Remote pre-flight: parse structured output for each check
- Container state matrix: mock
compose psJSON for each of 6 states - Health poll: mock healthy start, mock timeout, mock immediate exit
Verify: npx bats tests/bats/devc-remote.bats
Alternatives Considered
- Python for the full script: rejected — bash is more natural for SSH/compose orchestration
- Multiple SSH calls for pre-flight: rejected — single heredoc call avoids connection overhead
Impact
- New file, no changes to existing behavior
- Backward compatible
- Can be worked in parallel with the sibling Python URI sub-issue
Changelog Category
Added
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area:workspaceWorkspace tooling, justfile, templatesWorkspace tooling, justfile, templateseffort:medium1-4 hours1-4 hoursfeatureNew feature or requestNew feature or requestsemver:minorNew feature, backward-compatibleNew feature, backward-compatible