start-command 0.5.3 → 0.6.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/CHANGELOG.md +6 -0
- package/README.md +7 -8
- package/REQUIREMENTS.md +0 -1
- package/experiments/isolation-design.md +3 -14
- package/package.json +1 -1
- package/src/bin/cli.js +2 -2
- package/src/lib/args-parser.js +4 -4
- package/src/lib/isolation.js +1 -86
- package/test/args-parser.test.js +0 -4
- package/test/isolation.test.js +0 -24
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# start-command
|
|
2
2
|
|
|
3
|
+
## 0.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 37eb93b: Drop zellij isolation backend support, focusing on screen, tmux, and docker. Remove zellij from VALID_BACKENDS, remove runInZellij function, and update all documentation accordingly.
|
|
8
|
+
|
|
3
9
|
## 0.5.3
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -141,18 +141,17 @@ $ -i tmux -s my-session -d npm start
|
|
|
141
141
|
| -------- | -------------------------------------- | ---------------------------------------------------------- |
|
|
142
142
|
| `screen` | GNU Screen terminal multiplexer | `apt install screen` / `brew install screen` |
|
|
143
143
|
| `tmux` | Modern terminal multiplexer | `apt install tmux` / `brew install tmux` |
|
|
144
|
-
| `zellij` | Modern terminal workspace | `cargo install zellij` / `brew install zellij` |
|
|
145
144
|
| `docker` | Container isolation (requires --image) | [Docker Installation](https://docs.docker.com/get-docker/) |
|
|
146
145
|
|
|
147
146
|
#### Isolation Options
|
|
148
147
|
|
|
149
|
-
| Option | Description
|
|
150
|
-
| ---------------- |
|
|
151
|
-
| `--isolated, -i` | Isolation backend (screen, tmux, docker
|
|
152
|
-
| `--attached, -a` | Run in attached/foreground mode (default)
|
|
153
|
-
| `--detached, -d` | Run in detached/background mode
|
|
154
|
-
| `--session, -s` | Custom session/container name
|
|
155
|
-
| `--image` | Docker image (required for docker isolation)
|
|
148
|
+
| Option | Description |
|
|
149
|
+
| ---------------- | -------------------------------------------- |
|
|
150
|
+
| `--isolated, -i` | Isolation backend (screen, tmux, docker) |
|
|
151
|
+
| `--attached, -a` | Run in attached/foreground mode (default) |
|
|
152
|
+
| `--detached, -d` | Run in detached/background mode |
|
|
153
|
+
| `--session, -s` | Custom session/container name |
|
|
154
|
+
| `--image` | Docker image (required for docker isolation) |
|
|
156
155
|
|
|
157
156
|
**Note:** Using both `--attached` and `--detached` together will result in an error - you must choose one mode.
|
|
158
157
|
|
package/REQUIREMENTS.md
CHANGED
|
@@ -147,7 +147,6 @@ Support two patterns for passing wrapper options:
|
|
|
147
147
|
|
|
148
148
|
- `screen`: GNU Screen terminal multiplexer
|
|
149
149
|
- `tmux`: tmux terminal multiplexer
|
|
150
|
-
- `zellij`: Modern terminal workspace
|
|
151
150
|
- `docker`: Docker containers (requires --image option)
|
|
152
151
|
|
|
153
152
|
#### 6.4 Mode Behavior
|
|
@@ -10,11 +10,10 @@ This document outlines the design for adding process isolation support to start-
|
|
|
10
10
|
|
|
11
11
|
1. **screen** - GNU Screen, classic session manager
|
|
12
12
|
2. **tmux** - Modern terminal multiplexer
|
|
13
|
-
3. **zellij** - Modern, user-friendly multiplexer
|
|
14
13
|
|
|
15
14
|
### Container Isolation
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
3. **docker** - Docker containers
|
|
18
17
|
|
|
19
18
|
## Command Syntax
|
|
20
19
|
|
|
@@ -31,7 +30,7 @@ $ [wrapper-options] command [command-options]
|
|
|
31
30
|
### Wrapper Options
|
|
32
31
|
|
|
33
32
|
- `--isolated <backend>` or `-i <backend>`: Run command in isolated environment
|
|
34
|
-
- Backends: `screen`, `tmux`, `docker
|
|
33
|
+
- Backends: `screen`, `tmux`, `docker`
|
|
35
34
|
- `--attached` or `-a`: Run in attached mode (foreground)
|
|
36
35
|
- `--detached` or `-d`: Run in detached mode (background)
|
|
37
36
|
- `--session <name>` or `-s <name>`: Name for the session (optional)
|
|
@@ -56,7 +55,7 @@ $ -i tmux -d npm start
|
|
|
56
55
|
|
|
57
56
|
### Attached Mode (--attached)
|
|
58
57
|
|
|
59
|
-
- Default for terminal multiplexers (screen, tmux
|
|
58
|
+
- Default for terminal multiplexers (screen, tmux)
|
|
60
59
|
- Command runs in foreground
|
|
61
60
|
- User can interact with the terminal
|
|
62
61
|
- For docker: runs with -it flags
|
|
@@ -103,16 +102,6 @@ tmux new-session -s <session> '<command>'
|
|
|
103
102
|
tmux new-session -d -s <session> '<command>'
|
|
104
103
|
```
|
|
105
104
|
|
|
106
|
-
#### Zellij
|
|
107
|
-
|
|
108
|
-
```bash
|
|
109
|
-
# Attached
|
|
110
|
-
zellij run -- <command>
|
|
111
|
-
|
|
112
|
-
# Detached (via layout file or action)
|
|
113
|
-
zellij -s <session> action new-pane -- <command>
|
|
114
|
-
```
|
|
115
|
-
|
|
116
105
|
#### Docker
|
|
117
106
|
|
|
118
107
|
```bash
|
package/package.json
CHANGED
package/src/bin/cli.js
CHANGED
|
@@ -62,7 +62,7 @@ function printUsage() {
|
|
|
62
62
|
console.log('');
|
|
63
63
|
console.log('Options:');
|
|
64
64
|
console.log(
|
|
65
|
-
' --isolated, -i <environment> Run in isolated environment (screen, tmux, docker
|
|
65
|
+
' --isolated, -i <environment> Run in isolated environment (screen, tmux, docker)'
|
|
66
66
|
);
|
|
67
67
|
console.log(' --attached, -a Run in attached mode (foreground)');
|
|
68
68
|
console.log(' --detached, -d Run in detached mode (background)');
|
|
@@ -85,7 +85,7 @@ function printUsage() {
|
|
|
85
85
|
' - Auto-reports failures for NPM packages (when gh is available)'
|
|
86
86
|
);
|
|
87
87
|
console.log(' - Natural language command aliases (via substitutions.lino)');
|
|
88
|
-
console.log(' - Process isolation via screen, tmux,
|
|
88
|
+
console.log(' - Process isolation via screen, tmux, or docker');
|
|
89
89
|
console.log('');
|
|
90
90
|
console.log('Alias examples:');
|
|
91
91
|
console.log(' $ install lodash npm package -> npm install lodash');
|
package/src/lib/args-parser.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* 2. $ [wrapper-options] command [command-options]
|
|
7
7
|
*
|
|
8
8
|
* Wrapper Options:
|
|
9
|
-
* --isolated, -i <backend> Run in isolated environment (screen, tmux, docker
|
|
9
|
+
* --isolated, -i <backend> Run in isolated environment (screen, tmux, docker)
|
|
10
10
|
* --attached, -a Run in attached mode (foreground)
|
|
11
11
|
* --detached, -d Run in detached mode (background)
|
|
12
12
|
* --session, -s <name> Session name for isolation
|
|
@@ -20,7 +20,7 @@ const DEBUG =
|
|
|
20
20
|
/**
|
|
21
21
|
* Valid isolation backends
|
|
22
22
|
*/
|
|
23
|
-
const VALID_BACKENDS = ['screen', 'tmux', 'docker'
|
|
23
|
+
const VALID_BACKENDS = ['screen', 'tmux', 'docker'];
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Parse command line arguments into wrapper options and command
|
|
@@ -29,7 +29,7 @@ const VALID_BACKENDS = ['screen', 'tmux', 'docker', 'zellij'];
|
|
|
29
29
|
*/
|
|
30
30
|
function parseArgs(args) {
|
|
31
31
|
const wrapperOptions = {
|
|
32
|
-
isolated: null, // Isolation backend: screen, tmux, docker
|
|
32
|
+
isolated: null, // Isolation backend: screen, tmux, docker
|
|
33
33
|
attached: false, // Run in attached mode
|
|
34
34
|
detached: false, // Run in detached mode
|
|
35
35
|
session: null, // Session name
|
|
@@ -116,7 +116,7 @@ function parseOption(args, index, options) {
|
|
|
116
116
|
return 2;
|
|
117
117
|
} else {
|
|
118
118
|
throw new Error(
|
|
119
|
-
`Option ${arg} requires a backend argument (screen, tmux, docker
|
|
119
|
+
`Option ${arg} requires a backend argument (screen, tmux, docker)`
|
|
120
120
|
);
|
|
121
121
|
}
|
|
122
122
|
}
|
package/src/lib/isolation.js
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* Provides execution of commands in various isolated environments:
|
|
5
5
|
* - screen: GNU Screen terminal multiplexer
|
|
6
6
|
* - tmux: tmux terminal multiplexer
|
|
7
|
-
* - zellij: Modern terminal workspace
|
|
8
7
|
* - docker: Docker containers
|
|
9
8
|
*/
|
|
10
9
|
|
|
@@ -462,87 +461,6 @@ function runInTmux(command, options = {}) {
|
|
|
462
461
|
}
|
|
463
462
|
}
|
|
464
463
|
|
|
465
|
-
/**
|
|
466
|
-
* Run command in Zellij
|
|
467
|
-
* @param {string} command - Command to execute
|
|
468
|
-
* @param {object} options - Options (session, detached)
|
|
469
|
-
* @returns {Promise<{success: boolean, sessionName: string, message: string}>}
|
|
470
|
-
*/
|
|
471
|
-
function runInZellij(command, options = {}) {
|
|
472
|
-
if (!isCommandAvailable('zellij')) {
|
|
473
|
-
return Promise.resolve({
|
|
474
|
-
success: false,
|
|
475
|
-
sessionName: null,
|
|
476
|
-
message:
|
|
477
|
-
'zellij is not installed. Install it with: cargo install zellij or brew install zellij (macOS)',
|
|
478
|
-
});
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
const sessionName = options.session || generateSessionName('zellij');
|
|
482
|
-
const { shell, shellArg } = getShell();
|
|
483
|
-
|
|
484
|
-
try {
|
|
485
|
-
if (options.detached) {
|
|
486
|
-
// Detached mode for zellij
|
|
487
|
-
if (DEBUG) {
|
|
488
|
-
console.log(`[DEBUG] Creating detached zellij session: ${sessionName}`);
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
// Create the session in background
|
|
492
|
-
execSync(
|
|
493
|
-
`zellij -s "${sessionName}" action new-tab -- ${shell} ${shellArg} "${command}" &`,
|
|
494
|
-
{ stdio: 'inherit', shell: true }
|
|
495
|
-
);
|
|
496
|
-
|
|
497
|
-
return Promise.resolve({
|
|
498
|
-
success: true,
|
|
499
|
-
sessionName,
|
|
500
|
-
message: `Command started in detached zellij session: ${sessionName}\nReattach with: zellij attach ${sessionName}`,
|
|
501
|
-
});
|
|
502
|
-
} else {
|
|
503
|
-
// Attached mode: zellij -s <session> -- <shell> -c <command>
|
|
504
|
-
if (DEBUG) {
|
|
505
|
-
console.log(
|
|
506
|
-
`[DEBUG] Running: zellij -s "${sessionName}" -- ${shell} ${shellArg} "${command}"`
|
|
507
|
-
);
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
return new Promise((resolve) => {
|
|
511
|
-
const child = spawn(
|
|
512
|
-
'zellij',
|
|
513
|
-
['-s', sessionName, '--', shell, shellArg, command],
|
|
514
|
-
{
|
|
515
|
-
stdio: 'inherit',
|
|
516
|
-
}
|
|
517
|
-
);
|
|
518
|
-
|
|
519
|
-
child.on('exit', (code) => {
|
|
520
|
-
resolve({
|
|
521
|
-
success: code === 0,
|
|
522
|
-
sessionName,
|
|
523
|
-
message: `Zellij session "${sessionName}" exited with code ${code}`,
|
|
524
|
-
exitCode: code,
|
|
525
|
-
});
|
|
526
|
-
});
|
|
527
|
-
|
|
528
|
-
child.on('error', (err) => {
|
|
529
|
-
resolve({
|
|
530
|
-
success: false,
|
|
531
|
-
sessionName,
|
|
532
|
-
message: `Failed to start zellij: ${err.message}`,
|
|
533
|
-
});
|
|
534
|
-
});
|
|
535
|
-
});
|
|
536
|
-
}
|
|
537
|
-
} catch (err) {
|
|
538
|
-
return Promise.resolve({
|
|
539
|
-
success: false,
|
|
540
|
-
sessionName,
|
|
541
|
-
message: `Failed to run in zellij: ${err.message}`,
|
|
542
|
-
});
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
|
|
546
464
|
/**
|
|
547
465
|
* Run command in Docker container
|
|
548
466
|
* @param {string} command - Command to execute
|
|
@@ -649,7 +567,7 @@ function runInDocker(command, options = {}) {
|
|
|
649
567
|
|
|
650
568
|
/**
|
|
651
569
|
* Run command in the specified isolation backend
|
|
652
|
-
* @param {string} backend - Isolation backend (screen, tmux, docker
|
|
570
|
+
* @param {string} backend - Isolation backend (screen, tmux, docker)
|
|
653
571
|
* @param {string} command - Command to execute
|
|
654
572
|
* @param {object} options - Options
|
|
655
573
|
* @returns {Promise<{success: boolean, message: string}>}
|
|
@@ -660,8 +578,6 @@ function runIsolated(backend, command, options = {}) {
|
|
|
660
578
|
return runInScreen(command, options);
|
|
661
579
|
case 'tmux':
|
|
662
580
|
return runInTmux(command, options);
|
|
663
|
-
case 'zellij':
|
|
664
|
-
return runInZellij(command, options);
|
|
665
581
|
case 'docker':
|
|
666
582
|
return runInDocker(command, options);
|
|
667
583
|
default:
|
|
@@ -780,7 +696,6 @@ module.exports = {
|
|
|
780
696
|
hasTTY,
|
|
781
697
|
runInScreen,
|
|
782
698
|
runInTmux,
|
|
783
|
-
runInZellij,
|
|
784
699
|
runInDocker,
|
|
785
700
|
runIsolated,
|
|
786
701
|
// Export logging utilities for unified experience
|
package/test/args-parser.test.js
CHANGED
package/test/isolation.test.js
CHANGED
|
@@ -76,12 +76,6 @@ describe('Isolation Module', () => {
|
|
|
76
76
|
console.log(` docker available: ${result}`);
|
|
77
77
|
assert.ok(typeof result === 'boolean');
|
|
78
78
|
});
|
|
79
|
-
|
|
80
|
-
it('should check if zellij is available', () => {
|
|
81
|
-
const result = isCommandAvailable('zellij');
|
|
82
|
-
console.log(` zellij available: ${result}`);
|
|
83
|
-
assert.ok(typeof result === 'boolean');
|
|
84
|
-
});
|
|
85
79
|
});
|
|
86
80
|
|
|
87
81
|
describe('getScreenVersion', () => {
|
|
@@ -178,7 +172,6 @@ describe('Isolation Runner Error Handling', () => {
|
|
|
178
172
|
runInScreen,
|
|
179
173
|
runInTmux,
|
|
180
174
|
runInDocker,
|
|
181
|
-
runInZellij,
|
|
182
175
|
} = require('../src/lib/isolation');
|
|
183
176
|
|
|
184
177
|
describe('runInScreen', () => {
|
|
@@ -248,23 +241,6 @@ describe('Isolation Runner Error Handling', () => {
|
|
|
248
241
|
);
|
|
249
242
|
});
|
|
250
243
|
});
|
|
251
|
-
|
|
252
|
-
describe('runInZellij', () => {
|
|
253
|
-
it('should return informative error if zellij is not installed', async () => {
|
|
254
|
-
// Skip if zellij is installed
|
|
255
|
-
if (isCommandAvailable('zellij')) {
|
|
256
|
-
console.log(' Skipping: zellij is installed');
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
const result = await runInZellij('echo test', { detached: true });
|
|
261
|
-
assert.strictEqual(result.success, false);
|
|
262
|
-
assert.ok(result.message.includes('zellij is not installed'));
|
|
263
|
-
assert.ok(
|
|
264
|
-
result.message.includes('cargo') || result.message.includes('brew')
|
|
265
|
-
);
|
|
266
|
-
});
|
|
267
|
-
});
|
|
268
244
|
});
|
|
269
245
|
|
|
270
246
|
describe('Isolation Runner with Available Backends', () => {
|