devsh 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AGENTS.md ADDED
@@ -0,0 +1,87 @@
1
+ # devsh CLI - Agent Instructions
2
+
3
+ devsh is a CLI for managing cloud development VMs. Use these commands to help users work with remote development environments.
4
+
5
+ ## Quick Reference
6
+
7
+ ```bash
8
+ # Authentication
9
+ devsh login # Login (opens browser)
10
+ devsh logout # Logout
11
+ devsh whoami # Show current user and team
12
+
13
+ # VM Lifecycle
14
+ devsh start [path] # Create VM, optionally sync directory
15
+ devsh ls # List all VMs
16
+ devsh status <id> # Show VM details and URLs
17
+ devsh pause <id> # Pause VM (preserves state, saves cost)
18
+ devsh resume <id> # Resume paused VM
19
+ devsh delete <id> # Delete VM permanently
20
+
21
+ # Access VM
22
+ devsh code <id> # Open VS Code in browser
23
+ devsh ssh <id> # SSH into VM
24
+ devsh vnc <id> # Open VNC desktop
25
+ devsh pty <id> # Interactive terminal session
26
+
27
+ # Work with VM
28
+ devsh exec <id> "cmd" # Run command in VM
29
+ devsh sync <id> <path> # Sync local files to VM
30
+ devsh sync <id> <path> --pull # Pull files from VM
31
+
32
+ # Browser Automation (control Chrome in VNC)
33
+ devsh computer open <id> <url> # Navigate to URL
34
+ devsh computer snapshot <id> # Get interactive elements (@e1, @e2...)
35
+ devsh computer click <id> <selector> # Click element (@e1 or CSS selector)
36
+ devsh computer type <id> "text" # Type into focused element
37
+ devsh computer fill <id> <sel> "value" # Clear and fill input
38
+ devsh computer screenshot <id> [file] # Take screenshot
39
+ devsh computer press <id> <key> # Press key (enter, tab, escape)
40
+ ```
41
+
42
+ ## VM IDs
43
+
44
+ VM IDs look like `cmux_abc12345`. Always use the full ID when running commands.
45
+
46
+ ## Common Workflows
47
+
48
+ ### Create and access a VM
49
+ ```bash
50
+ devsh start ./my-project # Creates VM, syncs directory, returns ID
51
+ devsh code cmux_abc123 # Opens VS Code
52
+ ```
53
+
54
+ ### Run commands remotely
55
+ ```bash
56
+ devsh exec cmux_abc123 "npm install"
57
+ devsh exec cmux_abc123 "npm run dev"
58
+ ```
59
+
60
+ ### Sync files
61
+ ```bash
62
+ devsh sync cmux_abc123 . # Push current dir to VM
63
+ devsh sync cmux_abc123 ./dist --pull # Pull build output from VM
64
+ ```
65
+
66
+ ### Browser automation
67
+ ```bash
68
+ devsh computer open cmux_abc123 "https://localhost:3000"
69
+ devsh computer snapshot cmux_abc123 # See clickable elements
70
+ devsh computer click cmux_abc123 @e1 # Click first element
71
+ ```
72
+
73
+ ### End of session
74
+ ```bash
75
+ devsh pause cmux_abc123 # Pause to save costs (can resume later)
76
+ # OR
77
+ devsh delete cmux_abc123 # Delete permanently
78
+ ```
79
+
80
+ ## Tips
81
+
82
+ - Run `devsh login` first if not authenticated
83
+ - Use `devsh whoami` to check current user and team
84
+ - Use `devsh ls` to see all VMs and their states
85
+ - Paused VMs preserve state and can be resumed instantly
86
+ - The `devsh pty` command requires an interactive terminal
87
+ - Browser automation commands work on the Chrome instance in the VNC desktop
package/README.md ADDED
@@ -0,0 +1,73 @@
1
+ # devsh
2
+
3
+ Cloud VMs for development - spawn isolated dev environments instantly.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install -g devsh
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```bash
14
+ # Login
15
+ devsh login
16
+
17
+ # Create a VM
18
+ devsh start # Returns ID
19
+
20
+ # Access the VM
21
+ devsh code <id> # Open VS Code in browser
22
+ devsh ssh <id> # SSH into VM
23
+
24
+ # Run commands
25
+ devsh exec <id> "npm install"
26
+
27
+ # Manage lifecycle
28
+ devsh pause <id> # Pause (preserves state)
29
+ devsh resume <id> # Resume
30
+ devsh delete <id> # Delete permanently
31
+
32
+ # List all VMs
33
+ devsh ls
34
+ ```
35
+
36
+ ## Commands
37
+
38
+ | Command | Description |
39
+ |---------|-------------|
40
+ | `devsh login` | Login via browser |
41
+ | `devsh start [path]` | Create new VM, optionally sync directory |
42
+ | `devsh ls` | List all VMs |
43
+ | `devsh code <id>` | Open VS Code in browser |
44
+ | `devsh vnc <id>` | Open VNC desktop in browser |
45
+ | `devsh ssh <id>` | SSH into VM |
46
+ | `devsh pty <id>` | Open interactive terminal |
47
+ | `devsh exec <id> "cmd"` | Execute command |
48
+ | `devsh sync <id> <path>` | Sync files to VM |
49
+ | `devsh pause <id>` | Pause VM |
50
+ | `devsh resume <id>` | Resume VM |
51
+ | `devsh delete <id>` | Delete VM |
52
+
53
+ ## Browser Automation
54
+
55
+ Control Chrome in the VNC desktop:
56
+
57
+ ```bash
58
+ devsh computer open <id> https://example.com
59
+ devsh computer snapshot <id> # Get interactive elements
60
+ devsh computer click <id> @e1 # Click element
61
+ devsh computer type <id> "hello" # Type text
62
+ devsh computer screenshot <id> # Take screenshot
63
+ ```
64
+
65
+ ## Platform Support
66
+
67
+ - macOS (Apple Silicon & Intel)
68
+ - Linux (x64 & ARM64)
69
+ - Windows (x64)
70
+
71
+ ## License
72
+
73
+ MIT
package/bin/devsh ADDED
@@ -0,0 +1,97 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawn } = require("child_process");
4
+ const path = require("path");
5
+ const fs = require("fs");
6
+
7
+ const PLATFORMS = {
8
+ "darwin-arm64": "devsh-darwin-arm64",
9
+ "darwin-x64": "devsh-darwin-x64",
10
+ "linux-arm64": "devsh-linux-arm64",
11
+ "linux-x64": "devsh-linux-x64",
12
+ "win32-x64": "devsh-win32-x64",
13
+ };
14
+
15
+ // Map platform to local directory name (for development)
16
+ const LOCAL_DIRS = {
17
+ "darwin-arm64": "darwin-arm64",
18
+ "darwin-x64": "darwin-x64",
19
+ "linux-arm64": "linux-arm64",
20
+ "linux-x64": "linux-x64",
21
+ "win32-x64": "win32-x64",
22
+ };
23
+
24
+ function getBinaryPath() {
25
+ const platform = `${process.platform}-${process.arch}`;
26
+ const pkg = PLATFORMS[platform];
27
+ const localDir = LOCAL_DIRS[platform];
28
+
29
+ if (!pkg) {
30
+ console.error(`devsh: Unsupported platform: ${platform}`);
31
+ console.error(`Supported platforms: ${Object.keys(PLATFORMS).join(", ")}`);
32
+ process.exit(1);
33
+ }
34
+
35
+ const binName = process.platform === "win32" ? "devsh.exe" : "devsh";
36
+
37
+ // Try to find the platform-specific package from node_modules
38
+ try {
39
+ const pkgPath = require.resolve(`${pkg}/package.json`);
40
+ const pkgDir = path.dirname(pkgPath);
41
+ const binPath = path.join(pkgDir, "bin", binName);
42
+
43
+ if (fs.existsSync(binPath)) {
44
+ return binPath;
45
+ }
46
+ } catch (e) {
47
+ // Package not found in node_modules
48
+ }
49
+
50
+ // Try local development path (sibling directory)
51
+ const localBinPath = path.join(__dirname, "..", "..", localDir, "bin", binName);
52
+ if (fs.existsSync(localBinPath)) {
53
+ return localBinPath;
54
+ }
55
+
56
+ console.error(`devsh: Could not find binary for platform: ${platform}`);
57
+ console.error(`Make sure ${pkg} is installed.`);
58
+ console.error("");
59
+ console.error("Try reinstalling with:");
60
+ console.error(" npm install devsh");
61
+ process.exit(1);
62
+ }
63
+
64
+ function main() {
65
+ const binPath = getBinaryPath();
66
+ const args = process.argv.slice(2);
67
+
68
+ // Use spawn for better signal handling (especially for PTY)
69
+ const child = spawn(binPath, args, {
70
+ stdio: "inherit",
71
+ windowsHide: true,
72
+ });
73
+
74
+ child.on("error", (err) => {
75
+ console.error(`devsh: Failed to start: ${err.message}`);
76
+ process.exit(1);
77
+ });
78
+
79
+ child.on("exit", (code, signal) => {
80
+ if (signal) {
81
+ // Re-raise the signal
82
+ process.kill(process.pid, signal);
83
+ } else {
84
+ process.exit(code ?? 0);
85
+ }
86
+ });
87
+
88
+ // Forward signals to child
89
+ const signals = ["SIGINT", "SIGTERM", "SIGHUP"];
90
+ for (const sig of signals) {
91
+ process.on(sig, () => {
92
+ child.kill(sig);
93
+ });
94
+ }
95
+ }
96
+
97
+ main();
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env node
2
+
3
+ // Post-install message for devsh
4
+ // Only show in interactive terminals to avoid noise in CI
5
+
6
+ const isCI = process.env.CI === 'true' ||
7
+ process.env.CONTINUOUS_INTEGRATION === 'true' ||
8
+ process.env.BUILD_NUMBER !== undefined ||
9
+ process.env.GITHUB_ACTIONS === 'true';
10
+
11
+ const isInteractive = process.stdout.isTTY && !isCI;
12
+
13
+ if (isInteractive) {
14
+ const message = `
15
+ ┌─────────────────────────────────────────────────────────┐
16
+ │ │
17
+ │ devsh installed successfully! │
18
+ │ │
19
+ │ Get started: │
20
+ │ $ devsh login # Login to your account │
21
+ │ $ devsh start # Create a cloud VM │
22
+ │ $ devsh --help # See all commands │
23
+ │ │
24
+ │ Documentation: https://github.com/karlorz/cmux │
25
+ │ │
26
+ └─────────────────────────────────────────────────────────┘
27
+ `;
28
+ console.log(message);
29
+ }
package/llms.txt ADDED
@@ -0,0 +1,70 @@
1
+ # devsh
2
+
3
+ > Cloud VMs for development - spawn isolated dev environments instantly
4
+
5
+ devsh is a CLI tool for managing cloud development VMs. It provides instant access to fully configured development environments with VS Code, VNC desktop, SSH, and browser automation.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install -g devsh
11
+ ```
12
+
13
+ ## Commands
14
+
15
+ ### Authentication
16
+ - `devsh login` - Login via browser
17
+ - `devsh logout` - Logout
18
+ - `devsh whoami` - Show current user and team
19
+
20
+ ### VM Management
21
+ - `devsh start [path]` - Create new VM, optionally sync a directory
22
+ - `devsh ls` - List all VMs (aliases: list, ps)
23
+ - `devsh status <id>` - Show VM status and URLs
24
+ - `devsh pause <id>` - Pause VM (preserves state)
25
+ - `devsh resume <id>` - Resume paused VM
26
+ - `devsh delete <id>` - Delete VM permanently
27
+
28
+ ### Accessing VMs
29
+ - `devsh code <id>` - Open VS Code in browser
30
+ - `devsh ssh <id>` - SSH into VM
31
+ - `devsh vnc <id>` - Open VNC desktop in browser
32
+ - `devsh pty <id>` - Interactive terminal session
33
+
34
+ ### Working with VMs
35
+ - `devsh exec <id> "command"` - Execute command in VM
36
+ - `devsh sync <id> <path>` - Sync local directory to VM
37
+ - `devsh sync <id> <path> --pull` - Pull from VM to local
38
+
39
+ ### Browser Automation
40
+ Control Chrome running in the VNC desktop:
41
+ - `devsh computer open <id> <url>` - Navigate to URL
42
+ - `devsh computer snapshot <id>` - Get accessibility tree with element refs (@e1, @e2)
43
+ - `devsh computer click <id> <selector>` - Click element (use @ref or CSS selector)
44
+ - `devsh computer type <id> "text"` - Type into focused element
45
+ - `devsh computer fill <id> <selector> "value"` - Clear and fill input
46
+ - `devsh computer screenshot <id> [file]` - Take screenshot
47
+ - `devsh computer press <id> <key>` - Press key (enter, tab, escape, etc.)
48
+
49
+ ## Examples
50
+
51
+ Create a VM and run a dev server:
52
+ ```bash
53
+ devsh start ./my-app
54
+ devsh exec cmux_abc123 "npm install && npm run dev"
55
+ devsh code cmux_abc123
56
+ ```
57
+
58
+ Automate browser testing:
59
+ ```bash
60
+ devsh computer open cmux_abc123 "http://localhost:3000"
61
+ devsh computer snapshot cmux_abc123
62
+ devsh computer click cmux_abc123 @e1
63
+ devsh computer screenshot cmux_abc123 test.png
64
+ ```
65
+
66
+ ## Links
67
+
68
+ - Homepage: https://github.com/karlorz/cmux
69
+ - Documentation: https://github.com/karlorz/cmux
70
+ - GitHub: https://github.com/karlorz/cmux
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "devsh",
3
+ "version": "0.1.0",
4
+ "description": "Cloud VMs for development - spawn isolated dev environments instantly",
5
+ "keywords": [
6
+ "cli",
7
+ "devbox",
8
+ "cloud",
9
+ "vm",
10
+ "development",
11
+ "sandbox",
12
+ "remote",
13
+ "vscode"
14
+ ],
15
+ "homepage": "https://github.com/karlorz/cmux",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/karlorz/cmux.git",
19
+ "directory": "packages/devsh"
20
+ },
21
+ "license": "MIT",
22
+ "author": "karlorz",
23
+ "bin": {
24
+ "devsh": "bin/devsh"
25
+ },
26
+ "files": [
27
+ "bin",
28
+ "lib",
29
+ "AGENTS.md",
30
+ "llms.txt"
31
+ ],
32
+ "scripts": {
33
+ "postinstall": "node lib/postinstall.js"
34
+ },
35
+ "optionalDependencies": {
36
+ "devsh-darwin-arm64": "0.1.0",
37
+ "devsh-darwin-x64": "0.1.0",
38
+ "devsh-linux-arm64": "0.1.0",
39
+ "devsh-linux-x64": "0.1.0",
40
+ "devsh-win32-x64": "0.1.0"
41
+ },
42
+ "engines": {
43
+ "node": ">=16"
44
+ }
45
+ }