-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
area:workspaceWorkspace tooling, justfile, templatesWorkspace tooling, justfile, templateseffort:smallLess than 1 hourLess than 1 hourfeatureNew feature or requestNew feature or requestsemver:minorNew feature, backward-compatibleNew feature, backward-compatible
Description
Description
Create scripts/devc_remote_uri.py — a standalone Python module/CLI that builds the Cursor/VS Code nested authority URI for remote devcontainers. Called by devc-remote.sh (sibling sub-issue).
Problem Statement
Part of #70. Opening Cursor/VS Code into a remote devcontainer requires constructing a vscode-remote:// URI with hex-encoded JSON specs. Bash is brittle for JSON serialization and hex encoding — Python handles this cleanly with stdlib only.
Proposed Solution
A Python script with:
hex_encode(s: str) -> str—s.encode().hex()build_uri(workspace_path, devcontainer_path, ssh_host, container_workspace) -> str— assemblesvscode-remote://dev-container+{dc_hex}@ssh-remote+{ssh_host}{container_workspace}- CLI interface:
devc_remote_uri.py <workspace_path> <ssh_host> <container_workspace>— readsdevcontainerPathfrom args, prints URI to stdout - No external dependencies (stdlib only:
json,sys,argparse)
URI format
vscode-remote://dev-container+{DC_HEX}@ssh-remote+{SSH_SPEC}/{container_workspace}
Where DC_HEX is the hex-encoded JSON:
{"settingType":"config","workspacePath":"/home/user/repo","devcontainerPath":"/home/user/repo/.devcontainer/devcontainer.json"}SSH spec — two variants:
- Simple (host from
~/.ssh/config):@ssh-remote+loginnode - Full (hex-encoded JSON):
@ssh-remote+{SSH_HEX}where{"hostName":"user@1.2.3.4 -p 22"}
Files
- Create:
scripts/devc_remote_uri.py - Create:
tests/test_devc_remote_uri.py
Testing Strategy
Pytest unit tests:
hex_encode(): known input → exact hex outputbuild_uri(): known inputs → exact URI matching Cursor docs examples- CLI: subprocess call with args, verify stdout
- Edge cases: special chars in paths, spaces in host names
- Error cases: missing args, empty strings
Verify: uv run pytest tests/test_devc_remote_uri.py -v
Alternatives Considered
- Pure bash hex encoding (
od -A n -t x1 | tr -d '[\n\t ]'): works but fragile across platforms - Node.js helper: rejected — Python already available in devcontainer
Impact
- New file, no changes to existing behavior
- Backward compatible
- Standalone module — can be worked in parallel with the sibling bash script sub-issue
Changelog Category
Added
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area:workspaceWorkspace tooling, justfile, templatesWorkspace tooling, justfile, templateseffort:smallLess than 1 hourLess than 1 hourfeatureNew feature or requestNew feature or requestsemver:minorNew feature, backward-compatibleNew feature, backward-compatible