start-command 0.5.3 → 0.7.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # start-command
2
2
 
3
+ ## 0.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 9e24fb5: Add --version flag to display comprehensive version and system information. Users can now run `$ --version` or `$ -v` to see the version of start-command, system details, and versions of isolation tools (screen, tmux, docker).
8
+
9
+ ## 0.6.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 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.
14
+
3
15
  ## 0.5.3
4
16
 
5
17
  ### 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, zellij) |
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
@@ -0,0 +1,343 @@
1
+ # Case Study: Issue #18 - Missing `--version` Option Support
2
+
3
+ ## Executive Summary
4
+
5
+ This case study documents the investigation, root cause analysis, and resolution of Issue #18, which identified the absence of a `--version` flag in the start-command CLI tool. The issue prevented users from easily determining the version of the tool and its dependencies, which is crucial for debugging and troubleshooting.
6
+
7
+ ## Timeline of Events
8
+
9
+ ### 2025-12-23 12:53:10 UTC - Issue Created
10
+
11
+ - **Reporter**: @konard
12
+ - **Issue**: [#18 - We need to ensure `start-command --version` option is supported](https://github.com/link-foundation/start/issues/18)
13
+ - **Labels**: bug, enhancement
14
+
15
+ ### Initial Discovery
16
+
17
+ The user attempted to run `$ --version` expecting version information but instead received unexpected behavior:
18
+
19
+ ```bash
20
+ $ --version
21
+ [2025-12-23 12:51:15.314] Starting: --version
22
+
23
+ zsh 5.9 (arm64-apple-darwin24.0)
24
+
25
+ [2025-12-23 12:51:15.322] Finished
26
+ Exit code: 0
27
+ ```
28
+
29
+ The command was interpreted as trying to execute `--version` as a shell command, which fell through to the default shell (`zsh`) and displayed the shell's version instead of the start-command version.
30
+
31
+ ### 2025-12-23 15:59:11 UTC - Issue Updated
32
+
33
+ The issue was updated with additional context and requirements.
34
+
35
+ ## Problem Analysis
36
+
37
+ ### Root Cause
38
+
39
+ The `start-command` CLI tool (`src/bin/cli.js`) did not have a dedicated handler for the `--version` or `-v` flags. The argument parser treated any unknown flags as potential commands, leading to:
40
+
41
+ 1. **Unexpected behavior**: `$ --version` executed `--version` as a shell command
42
+ 2. **Poor user experience**: No standard way to check the tool version
43
+ 3. **Debugging challenges**: Users couldn't easily verify which version they were running
44
+ 4. **Missing dependency information**: No visibility into isolation tool versions (screen, tmux, docker)
45
+
46
+ ### Impact Assessment
47
+
48
+ **Severity**: Medium
49
+
50
+ - **User Experience**: Users had no standard way to check version information
51
+ - **Debugging**: Troubleshooting was more difficult without version info
52
+ - **Best Practices**: Missing a fundamental CLI feature expected by users
53
+
54
+ **Affected Components**:
55
+
56
+ - `src/bin/cli.js` - Main CLI entry point
57
+ - Documentation/Help text
58
+ - CI/CD testing coverage
59
+
60
+ ## Investigation Process
61
+
62
+ ### Analysis Steps
63
+
64
+ 1. **Code Review** (`src/bin/cli.js:48-60`):
65
+ - Examined argument parsing logic
66
+ - Identified that only empty arguments triggered usage display
67
+ - No special handling for `--version` flag
68
+
69
+ 2. **Argument Parser Review** (`src/lib/args-parser.js`):
70
+ - Confirmed that wrapper options didn't include `--version`
71
+ - Parser passed unknown flags to command execution
72
+
73
+ 3. **Test Coverage Review**:
74
+ - Found no existing tests for version display
75
+ - Identified gap in CLI behavior testing
76
+
77
+ 4. **User Expectation Analysis**:
78
+ - Standard CLI tools support `--version` and `-v`
79
+ - Users expect version information for debugging
80
+ - Version info should include dependencies
81
+
82
+ ## Solution Design
83
+
84
+ ### Requirements
85
+
86
+ Based on the issue description, the solution needed to:
87
+
88
+ 1. Support both `--version` and `-v` flags
89
+ 2. Display start-command version from package.json
90
+ 3. Show OS and system information:
91
+ - OS platform
92
+ - OS release
93
+ - Node.js version
94
+ - Architecture
95
+ 4. Display versions of isolation tools:
96
+ - screen
97
+ - tmux
98
+ - docker
99
+ 5. Indicate when tools are not installed
100
+ 6. Include comprehensive CI tests
101
+
102
+ ### Implementation Strategy
103
+
104
+ 1. **Version Detection** (`src/bin/cli.js:51-55`):
105
+ - Check for `--version` or `-v` as sole argument
106
+ - Call dedicated `printVersion()` function
107
+ - Exit with code 0
108
+
109
+ 2. **Version Information Display** (`src/bin/cli.js:62-106`):
110
+ - Read version from `package.json`
111
+ - Use Node.js `os` module for system info
112
+ - Execute version commands for each tool
113
+ - Handle missing tools gracefully
114
+
115
+ 3. **Tool Version Helper** (`src/bin/cli.js:108-129`):
116
+ - Generic function to check tool versions
117
+ - Timeout protection (5 seconds)
118
+ - Error handling for missing tools
119
+ - Return first line of version output
120
+
121
+ 4. **Test Coverage** (`test/cli.test.js`):
122
+ - Test `--version` flag
123
+ - Test `-v` shorthand
124
+ - Verify correct package version
125
+ - Test basic CLI behavior
126
+ - Ensure usage text includes `--version`
127
+
128
+ ## Implementation Details
129
+
130
+ ### Code Changes
131
+
132
+ #### 1. CLI Version Handler
133
+
134
+ ```javascript
135
+ // Handle --version flag
136
+ if (args.length === 1 && (args[0] === '--version' || args[0] === '-v')) {
137
+ printVersion();
138
+ process.exit(0);
139
+ }
140
+ ```
141
+
142
+ #### 2. Version Display Function
143
+
144
+ ```javascript
145
+ function printVersion() {
146
+ // Get package version
147
+ const packageJson = require('../../package.json');
148
+ const startCommandVersion = packageJson.version;
149
+
150
+ console.log(`start-command version: ${startCommandVersion}`);
151
+ console.log('');
152
+
153
+ // Get OS information
154
+ console.log(`OS: ${process.platform}`);
155
+ console.log(`OS Release: ${os.release()}`);
156
+ console.log(`Node Version: ${process.version}`);
157
+ console.log(`Architecture: ${process.arch}`);
158
+ console.log('');
159
+
160
+ // Check for installed isolation tools
161
+ console.log('Isolation tools:');
162
+
163
+ const screenVersion = getToolVersion('screen', '--version');
164
+ if (screenVersion) {
165
+ console.log(` screen: ${screenVersion}`);
166
+ } else {
167
+ console.log(' screen: not installed');
168
+ }
169
+
170
+ // Similar for tmux and docker...
171
+ }
172
+ ```
173
+
174
+ #### 3. Tool Version Helper
175
+
176
+ ```javascript
177
+ function getToolVersion(toolName, versionFlag) {
178
+ try {
179
+ const result = execSync(`${toolName} ${versionFlag}`, {
180
+ encoding: 'utf8',
181
+ stdio: ['pipe', 'pipe', 'pipe'],
182
+ timeout: 5000,
183
+ }).trim();
184
+
185
+ const firstLine = result.split('\n')[0];
186
+ return firstLine;
187
+ } catch {
188
+ return null;
189
+ }
190
+ }
191
+ ```
192
+
193
+ #### 4. Updated Usage Text
194
+
195
+ ```javascript
196
+ console.log(' --version, -v Show version information');
197
+ ```
198
+
199
+ ### Test Implementation
200
+
201
+ Created `test/cli.test.js` with comprehensive test coverage:
202
+
203
+ - Version flag tests (both `--version` and `-v`)
204
+ - Package version verification
205
+ - Basic CLI behavior tests
206
+ - Usage text verification
207
+
208
+ ## Verification and Testing
209
+
210
+ ### Test Results
211
+
212
+ All tests passed successfully:
213
+
214
+ ```
215
+ ✓ CLI version flag
216
+ ✓ should display version with --version
217
+ ✓ should display version with -v
218
+ ✓ should show correct package version
219
+ ✓ CLI basic behavior
220
+ ✓ should show usage when no arguments provided
221
+ ✓ should show usage when no command provided after --
222
+ ```
223
+
224
+ Total: 71 tests passed across all test suites.
225
+
226
+ ### Manual Testing
227
+
228
+ ```bash
229
+ $ bun src/bin/cli.js --version
230
+ start-command version: 0.6.0
231
+
232
+ OS: linux
233
+ OS Release: 6.8.0-90-generic
234
+ Node Version: v24.3.0
235
+ Architecture: x64
236
+
237
+ Isolation tools:
238
+ screen: Screen version 4.09.01 (GNU) 20-Aug-23
239
+ tmux: tmux 3.4
240
+ docker: not installed
241
+ ```
242
+
243
+ ## Lessons Learned
244
+
245
+ ### What Went Well
246
+
247
+ 1. **Clear Requirements**: Issue description provided specific requirements
248
+ 2. **Comprehensive Solution**: Implementation exceeded basic requirements by including dependency versions
249
+ 3. **Good Test Coverage**: Tests ensure the feature won't regress
250
+ 4. **Defensive Programming**: Tool version detection handles missing tools gracefully
251
+
252
+ ### Areas for Improvement
253
+
254
+ 1. **Earlier Detection**: This fundamental feature should have been included from the start
255
+ 2. **Pre-commit Checklist**: Could have caught this during initial development
256
+ 3. **User Feedback**: Faster response to user needs
257
+
258
+ ### Best Practices Applied
259
+
260
+ 1. **Version Information Sources**: Used package.json as single source of truth
261
+ 2. **Error Handling**: Gracefully handle missing tools with timeout protection
262
+ 3. **User Experience**: Clear, well-formatted output
263
+ 4. **Testing**: Comprehensive test coverage for new feature
264
+ 5. **Documentation**: Updated usage text to include new flag
265
+
266
+ ## Recommendations
267
+
268
+ ### Immediate Actions
269
+
270
+ 1. ✅ Implement `--version` flag support
271
+ 2. ✅ Add comprehensive tests
272
+ 3. ✅ Update documentation/usage text
273
+ 4. ✅ Verify all existing tests pass
274
+
275
+ ### Future Enhancements
276
+
277
+ 1. **Version Comparison**: Add ability to check for updates
278
+ 2. **JSON Output**: Support `--version --json` for machine-readable output
279
+ 3. **Detailed Mode**: Add `--version --verbose` for more detailed information
280
+ 4. **Config Info**: Include configuration file locations and settings
281
+
282
+ ### Process Improvements
283
+
284
+ 1. **Feature Checklist**: Ensure standard CLI features are in initial release:
285
+ - `--help` / `-h`
286
+ - `--version` / `-v`
287
+ - `--verbose` / `-v` (if not conflicting)
288
+ - Exit codes documentation
289
+ 2. **User Testing**: Early beta testing to catch missing features
290
+ 3. **CLI Standards**: Follow established CLI conventions
291
+
292
+ ## Conclusion
293
+
294
+ Issue #18 highlighted the importance of implementing standard CLI features that users expect. The solution not only added the missing `--version` flag but enhanced it to provide comprehensive diagnostic information including OS details and dependency versions.
295
+
296
+ This case study demonstrates the value of:
297
+
298
+ - Clear issue reporting with examples
299
+ - Thorough root cause analysis
300
+ - Comprehensive implementation
301
+ - Strong test coverage
302
+ - Documentation of the investigation process
303
+
304
+ The implementation is now complete and ready for production use, providing users with essential version and diagnostic information for troubleshooting.
305
+
306
+ ## References
307
+
308
+ - **Issue**: [#18 - We need to ensure `start-command --version` option is supported](https://github.com/link-foundation/start/issues/18)
309
+ - **Pull Request**: [#21 - Implementation of --version flag](https://github.com/link-foundation/start/pull/21)
310
+ - **Related Files**:
311
+ - `src/bin/cli.js` - Main implementation
312
+ - `test/cli.test.js` - Test coverage
313
+ - `package.json` - Version source
314
+
315
+ ## Appendix
316
+
317
+ ### A. Example Output
318
+
319
+ ```bash
320
+ $ $ --version
321
+ start-command version: 0.6.0
322
+
323
+ OS: linux
324
+ OS Release: 6.8.0-90-generic
325
+ Node Version: v24.3.0
326
+ Architecture: x64
327
+
328
+ Isolation tools:
329
+ screen: Screen version 4.09.01 (GNU) 20-Aug-23
330
+ tmux: tmux 3.4
331
+ docker: not installed
332
+ ```
333
+
334
+ ### B. Test Coverage Summary
335
+
336
+ - **Total Tests**: 71
337
+ - **New Tests Added**: 5
338
+ - **Pass Rate**: 100%
339
+ - **Coverage Areas**:
340
+ - Version flag handling
341
+ - Package version accuracy
342
+ - CLI basic behavior
343
+ - Usage text verification
@@ -0,0 +1,7 @@
1
+ {
2
+ "author": "konard",
3
+ "body": "```\nonard@MacBook-Pro-Konstantin ~ % --version \nzsh: command not found: --version\nkonard@MacBook-Pro-Konstantin ~ % $ --version\n[2025-12-23 12:51:15.314] Starting: --version\n\nzsh 5.9 (arm64-apple-darwin24.0)\n\n[2025-12-23 12:51:15.322] Finished\nExit code: 0\nLog saved: /var/folders/cl/831lqjgd58v5mb_m74cfdfcw0000gn/T/start-command-1766494275314-ws2i7w.log\nkonard@MacBook-Pro-Konstantin ~ % $ --version --\nError: No command provided\nUsage: $ [options] [--] \u003ccommand\u003e [args...]\n $ \u003ccommand\u003e [args...]\n\nOptions:\n --isolated, -i \u003cenvironment\u003e Run in isolated environment (screen, tmux, docker, zellij)\n --attached, -a Run in attached mode (foreground)\n --detached, -d Run in detached mode (background)\n --session, -s \u003cname\u003e Session name for isolation\n --image \u003cimage\u003e Docker image (required for docker isolation)\n\nExamples:\n $ echo \"Hello World\"\n $ npm test\n $ --isolated tmux -- npm start\n $ -i screen -d npm start\n $ --isolated docker --image node:20 -- npm install\n\nFeatures:\n - Logs all output to temporary directory\n - Displays timestamps and exit codes\n - Auto-reports failures for NPM packages (when gh is available)\n - Natural language command aliases (via substitutions.lino)\n - Process isolation via screen, tmux, zellij, or docker\n\nAlias examples:\n $ install lodash npm package -\u003e npm install lodash\n $ install 4.17.21 version of lodash npm package -\u003e npm install lodash@4.17.21\n $ clone https://github.com/user/repo repository -\u003e git clone https://github.com/user/repo\n```\n\nThat should be the root source of debug information.\n\nIt should display version of start-command itself, version of OS, version of screen and docker and tmux (all if installed).\n\nAlso it should be added to CI tests, so never again we will have the problem.\n\nPlease download all logs and data related about the issue to this repository, make sure we compile that data to `./docs/case-studies/issue-{id}` folder, and use it to do deep case study analysis (also make sure to search online for additional facts and data), in which we will reconstruct timeline/sequence of events, find root causes of the problem, and propose possible solutions.",
4
+ "createdAt": "2025-12-23T12:53:10Z",
5
+ "title": "We need to ensure `start-command --version` option is supported",
6
+ "updatedAt": "2025-12-23T15:59:11Z"
7
+ }
@@ -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
- 4. **docker** - Docker containers
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`, `zellij`
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, zellij)
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "start-command",
3
- "version": "0.5.3",
3
+ "version": "0.7.0",
4
4
  "description": "Gamification of coding, execute any command with ability to auto-report issues on GitHub",
5
5
  "main": "index.js",
6
6
  "bin": {
package/src/bin/cli.js CHANGED
@@ -48,11 +48,86 @@ const config = {
48
48
  // Get all arguments passed after the command
49
49
  const args = process.argv.slice(2);
50
50
 
51
+ // Handle --version flag
52
+ if (args.length === 1 && (args[0] === '--version' || args[0] === '-v')) {
53
+ printVersion();
54
+ process.exit(0);
55
+ }
56
+
51
57
  if (args.length === 0) {
52
58
  printUsage();
53
59
  process.exit(0);
54
60
  }
55
61
 
62
+ /**
63
+ * Print version information
64
+ */
65
+ function printVersion() {
66
+ // Get package version
67
+ const packageJson = require('../../package.json');
68
+ const startCommandVersion = packageJson.version;
69
+
70
+ console.log(`start-command version: ${startCommandVersion}`);
71
+ console.log('');
72
+
73
+ // Get OS information
74
+ console.log(`OS: ${process.platform}`);
75
+ console.log(`OS Release: ${os.release()}`);
76
+ console.log(`Node Version: ${process.version}`);
77
+ console.log(`Architecture: ${process.arch}`);
78
+ console.log('');
79
+
80
+ // Check for installed isolation tools
81
+ console.log('Isolation tools:');
82
+
83
+ // Check screen
84
+ const screenVersion = getToolVersion('screen', '--version');
85
+ if (screenVersion) {
86
+ console.log(` screen: ${screenVersion}`);
87
+ } else {
88
+ console.log(' screen: not installed');
89
+ }
90
+
91
+ // Check tmux
92
+ const tmuxVersion = getToolVersion('tmux', '-V');
93
+ if (tmuxVersion) {
94
+ console.log(` tmux: ${tmuxVersion}`);
95
+ } else {
96
+ console.log(' tmux: not installed');
97
+ }
98
+
99
+ // Check docker
100
+ const dockerVersion = getToolVersion('docker', '--version');
101
+ if (dockerVersion) {
102
+ console.log(` docker: ${dockerVersion}`);
103
+ } else {
104
+ console.log(' docker: not installed');
105
+ }
106
+ }
107
+
108
+ /**
109
+ * Get version of an installed tool
110
+ * @param {string} toolName - Name of the tool
111
+ * @param {string} versionFlag - Flag to get version (e.g., '--version', '-V')
112
+ * @returns {string|null} Version string or null if not installed
113
+ */
114
+ function getToolVersion(toolName, versionFlag) {
115
+ try {
116
+ const result = execSync(`${toolName} ${versionFlag}`, {
117
+ encoding: 'utf8',
118
+ stdio: ['pipe', 'pipe', 'pipe'],
119
+ timeout: 5000,
120
+ }).trim();
121
+
122
+ // Extract version number from output
123
+ // Most tools output version in various formats, so we'll return the first line
124
+ const firstLine = result.split('\n')[0];
125
+ return firstLine;
126
+ } catch {
127
+ return null;
128
+ }
129
+ }
130
+
56
131
  /**
57
132
  * Print usage information
58
133
  */
@@ -62,7 +137,7 @@ function printUsage() {
62
137
  console.log('');
63
138
  console.log('Options:');
64
139
  console.log(
65
- ' --isolated, -i <environment> Run in isolated environment (screen, tmux, docker, zellij)'
140
+ ' --isolated, -i <environment> Run in isolated environment (screen, tmux, docker)'
66
141
  );
67
142
  console.log(' --attached, -a Run in attached mode (foreground)');
68
143
  console.log(' --detached, -d Run in detached mode (background)');
@@ -70,6 +145,7 @@ function printUsage() {
70
145
  console.log(
71
146
  ' --image <image> Docker image (required for docker isolation)'
72
147
  );
148
+ console.log(' --version, -v Show version information');
73
149
  console.log('');
74
150
  console.log('Examples:');
75
151
  console.log(' $ echo "Hello World"');
@@ -85,7 +161,7 @@ function printUsage() {
85
161
  ' - Auto-reports failures for NPM packages (when gh is available)'
86
162
  );
87
163
  console.log(' - Natural language command aliases (via substitutions.lino)');
88
- console.log(' - Process isolation via screen, tmux, zellij, or docker');
164
+ console.log(' - Process isolation via screen, tmux, or docker');
89
165
  console.log('');
90
166
  console.log('Alias examples:');
91
167
  console.log(' $ install lodash npm package -> npm install lodash');
@@ -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, zellij)
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', 'zellij'];
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, zellij
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, zellij)`
119
+ `Option ${arg} requires a backend argument (screen, tmux, docker)`
120
120
  );
121
121
  }
122
122
  }
@@ -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, zellij)
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
@@ -382,8 +382,4 @@ describe('VALID_BACKENDS', () => {
382
382
  it('should include docker', () => {
383
383
  assert.ok(VALID_BACKENDS.includes('docker'));
384
384
  });
385
-
386
- it('should include zellij', () => {
387
- assert.ok(VALID_BACKENDS.includes('zellij'));
388
- });
389
385
  });
@@ -0,0 +1,111 @@
1
+ #!/usr/bin/env bun
2
+ /**
3
+ * Unit tests for the CLI
4
+ * Tests version flag and basic CLI behavior
5
+ */
6
+
7
+ const { describe, it } = require('node:test');
8
+ const assert = require('assert');
9
+ const { spawnSync } = require('child_process');
10
+ const path = require('path');
11
+ const fs = require('fs');
12
+
13
+ // Path to the CLI script
14
+ const CLI_PATH = path.join(__dirname, '../src/bin/cli.js');
15
+
16
+ // Helper to run CLI
17
+ function runCLI(args = []) {
18
+ return spawnSync('bun', [CLI_PATH, ...args], {
19
+ encoding: 'utf8',
20
+ env: {
21
+ ...process.env,
22
+ START_DISABLE_AUTO_ISSUE: '1',
23
+ START_DISABLE_LOG_UPLOAD: '1',
24
+ },
25
+ });
26
+ }
27
+
28
+ describe('CLI version flag', () => {
29
+ it('should display version with --version', () => {
30
+ const result = runCLI(['--version']);
31
+
32
+ assert.strictEqual(result.status, 0, 'Exit code should be 0');
33
+
34
+ // Check for key elements in version output
35
+ assert.ok(
36
+ result.stdout.includes('start-command version:'),
37
+ 'Should display start-command version'
38
+ );
39
+ assert.ok(result.stdout.includes('OS:'), 'Should display OS');
40
+ assert.ok(
41
+ result.stdout.includes('OS Release:'),
42
+ 'Should display OS Release'
43
+ );
44
+ assert.ok(
45
+ result.stdout.includes('Node Version:'),
46
+ 'Should display Node Version'
47
+ );
48
+ assert.ok(
49
+ result.stdout.includes('Architecture:'),
50
+ 'Should display Architecture'
51
+ );
52
+ assert.ok(
53
+ result.stdout.includes('Isolation tools:'),
54
+ 'Should display Isolation tools section'
55
+ );
56
+ assert.ok(
57
+ result.stdout.includes('screen:'),
58
+ 'Should check for screen installation'
59
+ );
60
+ assert.ok(
61
+ result.stdout.includes('tmux:'),
62
+ 'Should check for tmux installation'
63
+ );
64
+ assert.ok(
65
+ result.stdout.includes('docker:'),
66
+ 'Should check for docker installation'
67
+ );
68
+ });
69
+
70
+ it('should display version with -v', () => {
71
+ const result = runCLI(['-v']);
72
+
73
+ assert.strictEqual(result.status, 0, 'Exit code should be 0');
74
+ assert.ok(
75
+ result.stdout.includes('start-command version:'),
76
+ 'Should display start-command version'
77
+ );
78
+ });
79
+
80
+ it('should show correct package version', () => {
81
+ const result = runCLI(['--version']);
82
+ const packageJson = JSON.parse(
83
+ fs.readFileSync(path.join(__dirname, '../package.json'), 'utf8')
84
+ );
85
+
86
+ assert.ok(
87
+ result.stdout.includes(`start-command version: ${packageJson.version}`),
88
+ `Should display version ${packageJson.version}`
89
+ );
90
+ });
91
+ });
92
+
93
+ describe('CLI basic behavior', () => {
94
+ it('should show usage when no arguments provided', () => {
95
+ const result = runCLI([]);
96
+
97
+ assert.strictEqual(result.status, 0, 'Exit code should be 0');
98
+ assert.ok(result.stdout.includes('Usage:'), 'Should display usage');
99
+ assert.ok(
100
+ result.stdout.includes('--version'),
101
+ 'Usage should mention --version flag'
102
+ );
103
+ });
104
+
105
+ it('should show usage when no command provided after --', () => {
106
+ const result = runCLI(['--']);
107
+
108
+ assert.strictEqual(result.status, 0, 'Exit code should be 0');
109
+ assert.ok(result.stdout.includes('Usage:'), 'Should display usage');
110
+ });
111
+ });
@@ -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', () => {