Repository navigation
Closed as not planned
1 / 11 of 1 issue completedClosed as not planned
1 / 11 of 1 issue completed
Copy link
Labels
area:workspaceWorkspace tooling, justfile, templateseffort:medium1-4 hoursfeatureNew feature or requestsemver:minorNew 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
Sub-issues
Collapse Sub-issuesSub-issues
Loading 1 sub-issues
Metadata
Metadata
Assignees
Labels
area:workspaceWorkspace tooling, justfile, templateseffort:medium1-4 hoursfeatureNew feature or requestsemver:minorNew feature, backward-compatible
Activity
gerchowl commentedon Feb 22, 2026
Design
Overview
scripts/devc-remote.shis the bash orchestrator for starting a devcontainer on a remote host via SSH. It handles SSH connectivity, pre-flight checks, container state detection, and compose lifecycle. URI construction is delegated to a Python helper (sibling sub-issue).Architecture
Components
parse_args()
<ssh-host>(required)--path <remote-path>(default~/)--help→ show usage, exit 0detect_editor_cli()
cursor, fall back tocodeEDITOR_CLIcheck_ssh()
ssh -o ConnectTimeout=5 -o BatchMode=yes "$SSH_HOST" trueremote_preflight()
KEY=valuelines (one per check)remote_compose_up()
open_editor()
scripts/devc_remote_uri.py --ssh-host "$SSH_HOST" --path "$REMOTE_PATH"(interface TBD by sibling issue)"$EDITOR_CLI" --folder-uri "$URI"Logging
Reuse
init.shpatterns:log_info,log_success,log_warning,log_error(color-coded, same format). Nolog_debugunless needed.Error Handling
set -euo pipefailthroughoutPython URI Helper Interface (stub for this issue)
Until sibling issue implements
devc_remote_uri.py, the script will call a stub that:--ssh-hostand--pathTesting Strategy
BATS unit tests with mocked commands (
PATHmanipulation, stub scripts):compose psJSON for each of 6 statesVerify:
npx bats tests/bats/devc-remote.batsgerchowl commentedon Feb 22, 2026
Implementation Plan
Issue: #152
Branch: feature/152-devc-remote-sh
Tasks
scripts/devc-remote.sh— verify:grep -E "set -euo pipefail|log_info|parse_args" scripts/devc-remote.shtests/bats/devc-remote.bats— verify:npx bats tests/bats/devc-remote.bats(Task 2 tests may fail until Task 3)scripts/devc-remote.sh— verify:npx bats tests/bats/devc-remote.bats(parse_args tests pass)tests/bats/devc-remote.bats— verify: tests failscripts/devc-remote.sh— verify: detect_editor_cli tests passtests/bats/devc-remote.bats— verify: tests failscripts/devc-remote.sh— verify: check_ssh tests passtests/bats/devc-remote.bats— verify: tests failscripts/devc-remote.sh— verify: remote_preflight tests passtests/bats/devc-remote.bats— verify: tests failscripts/devc-remote.sh— verify: remote_compose_up tests passscripts/devc_remote_uri.py,tests/bats/devc-remote.bats— verify: tests failscripts/devc-remote.sh— verify:npx bats tests/bats/devc-remote.bats(all pass)feat(scripts): add devc-remote.sh skeleton with logging and stubs
test(bats): add devc-remote script structure and parse_args tests
feat(scripts): implement parse_args in devc-remote.sh
feat(scripts): implement detect_editor_cli in devc-remote.sh
feat(scripts): implement check_ssh in devc-remote.sh
feat(scripts): implement remote_preflight in devc-remote.sh
feat(scripts): implement remote_compose_up, open_editor, and Python U…
gerchowl commentedon Feb 22, 2026
Autonomous Run Complete
feat(scripts): devc-remote.sh — bash orchestrator for remote devconta…
fix: resolve merge conflicts with feature/70-remote-devc-orchestration
c-vigo commentedon Jul 8, 2026
Closing as part of an agreed backlog cleanup (with @gerchowl). The remote-devcontainer /
devc-remote/ Tailscale initiative predates the Nix + Claude-native migration (#625) and has had no activity since Feb–Mar 2026. If remote provisioning is wanted again it will be re-planned from scratch after the devkit rename (#781). Reopen/refile if revived.