Repository navigation
Closed
Labels
area:workspaceWorkspace tooling, justfile, templateseffort:smallLess than 1 hourfeatureNew feature or requestsemver:minorNew 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":"[email protected] -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
Metadata
Metadata
Assignees
Labels
area:workspaceWorkspace tooling, justfile, templateseffort:smallLess than 1 hourfeatureNew feature or requestsemver:minorNew feature, backward-compatible
Activity
gerchowl commentedon Feb 22, 2026
Design
Architecture
Single standalone module
scripts/devc_remote_uri.pywith:hex_encode()andbuild_uri()— no side effects, easy to unit testargparse— positional args:workspace_path,ssh_host,container_workspace;devcontainer_pathas optional (default:{workspace_path}/.devcontainer/devcontainer.json)json,sys,argparseURI construction
hex_encode(s)→s.encode().hex()(UTF-8){"settingType":"config","workspacePath":"<path>","devcontainerPath":"<path>"}→ hex-encodedvscode-remote://dev-container+{DC_HEX}@ssh-remote+{SSH_SPEC}/{container_workspace}loginnode) passed through as-is; full hex variant deferred to sibling sub-issue if needed (YAGNI)Error handling
argparsefor missing required args → exit 2 with usageValueErrorwith clear messageTesting
test_devc_remote_uri.py: pytest unit tests per issue spechex_encode: known input → exact hex outputbuild_uri: known inputs → exact URI (match Cursor docs examples)gerchowl commentedon Feb 22, 2026
Implementation Plan
Issue: #153
Branch: feature/153-devc-remote-uri-py
Tasks
tests/test_devc_remote_uri.py— verify:uv run pytest tests/test_devc_remote_uri.py -v -k hex_encodescripts/devc_remote_uri.py— verify:uv run pytest tests/test_devc_remote_uri.py -v -k hex_encodetests/test_devc_remote_uri.py— verify:uv run pytest tests/test_devc_remote_uri.py -v -k build_uriscripts/devc_remote_uri.py— verify:uv run pytest tests/test_devc_remote_uri.py -v -k build_uritests/test_devc_remote_uri.py— verify:uv run pytest tests/test_devc_remote_uri.py -v -k cliscripts/devc_remote_uri.py— verify:uv run pytest tests/test_devc_remote_uri.py -vtests/test_devc_remote_uri.py— verify:uv run pytest tests/test_devc_remote_uri.py -vtest(devc_remote_uri): add hex_encode unit tests
feat(devc_remote_uri): implement hex_encode
test(devc_remote_uri): add build_uri unit tests
feat(devc_remote_uri): implement build_uri
test(devc_remote_uri): add CLI tests
feat(devc_remote_uri): implement CLI with argparse
docs: add CHANGELOG entry for devc_remote_uri
gerchowl commentedon Feb 22, 2026
Autonomous Run Complete
fix: resolve merge conflicts with feature/70-remote-devc-orchestration
feat(scripts): devc_remote_uri.py — Cursor URI construction for remot…
c-vigo commentedon Jun 23, 2026
Scope resolved: VS Code only. Cursor editor support is being dropped along with
cursor-agentas part of #625 (see #629), so the Cursor-URI remote wrapper is no longer wanted. Closing — the VS Code half is tracked under #231 (de-scoped tocode-remoteonly).