start-command 0.6.0 → 0.7.1
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 +18 -0
- package/REQUIREMENTS.md +3 -2
- package/docs/case-studies/issue-18/README.md +343 -0
- package/docs/case-studies/issue-18/issue-comments.json +1 -0
- package/docs/case-studies/issue-18/issue-data.json +7 -0
- package/docs/case-studies/issue-22/analysis.md +332 -0
- package/docs/case-studies/issue-22/issue-data.json +12 -0
- package/experiments/test-screen-attached.js +2 -2
- package/experiments/test-screen-logfile.js +1 -1
- package/experiments/test-screen-modes.js +1 -1
- package/package.json +5 -5
- package/src/bin/cli.js +121 -7
- package/test/cli.test.js +114 -0
- package/test/version.test.js +264 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# start-command
|
|
2
2
|
|
|
3
|
+
## 0.7.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d5a7c66: Fix all --version detection issues
|
|
8
|
+
- Fix screen version detection by capturing stderr
|
|
9
|
+
- Show Bun version instead of Node.js version when running with Bun
|
|
10
|
+
- Show macOS ProductVersion instead of kernel version
|
|
11
|
+
- Fix argument parsing to handle `$ --version --` same as `$ --version`
|
|
12
|
+
- Update all scripts and examples to use Bun instead of Node.js
|
|
13
|
+
- Add comprehensive tests for --version flag
|
|
14
|
+
|
|
15
|
+
## 0.7.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- 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).
|
|
20
|
+
|
|
3
21
|
## 0.6.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
package/REQUIREMENTS.md
CHANGED
|
@@ -76,7 +76,7 @@ The `$` command is a CLI tool that wraps any shell command and provides automati
|
|
|
76
76
|
- Command that was executed
|
|
77
77
|
- Exit code
|
|
78
78
|
- Link to uploaded log
|
|
79
|
-
- System information (OS, Node version)
|
|
79
|
+
- System information (OS, Bun/Node.js version)
|
|
80
80
|
- Timestamp
|
|
81
81
|
- Print the created issue URL to console
|
|
82
82
|
|
|
@@ -209,7 +209,8 @@ Repository not detected - automatic issue creation skipped
|
|
|
209
209
|
|
|
210
210
|
### Required
|
|
211
211
|
|
|
212
|
-
-
|
|
212
|
+
- **Bun >= 1.0.0** (primary runtime)
|
|
213
|
+
- Alternatively: Node.js >= 20.0.0 (for compatibility)
|
|
213
214
|
- `child_process` (built-in)
|
|
214
215
|
- `os` (built-in)
|
|
215
216
|
- `fs` (built-in)
|
|
@@ -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 @@
|
|
|
1
|
+
[]
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
# Case Study: Issue #22 - Version Detection Issues
|
|
2
|
+
|
|
3
|
+
## Issue Overview
|
|
4
|
+
|
|
5
|
+
**Issue ID:** #22
|
|
6
|
+
**Title:** --version issues
|
|
7
|
+
**Reported By:** konard
|
|
8
|
+
**Created:** 2025-12-23T17:55:53Z
|
|
9
|
+
**Status:** Open
|
|
10
|
+
|
|
11
|
+
## Problem Summary
|
|
12
|
+
|
|
13
|
+
The `$ --version` command exhibited multiple issues when run on macOS:
|
|
14
|
+
|
|
15
|
+
1. **Screen version not detected** - Despite screen being installed, it showed "not installed"
|
|
16
|
+
2. **Wrong runtime displayed** - Showed Node.js version instead of Bun version
|
|
17
|
+
3. **Incorrect OS version format** - Showed OS Release (kernel version) instead of macOS version
|
|
18
|
+
4. **Argument parsing issue** - `$ --version --` resulted in "No command provided" error
|
|
19
|
+
|
|
20
|
+
## Timeline of Events
|
|
21
|
+
|
|
22
|
+
### User Environment
|
|
23
|
+
|
|
24
|
+
- **System:** macOS 15.7.2 (ProductVersion)
|
|
25
|
+
- **Kernel:** 24.6.0 (OS Release)
|
|
26
|
+
- **Bun Version:** 1.2.20
|
|
27
|
+
- **Node.js Emulation:** v24.3.0 (provided by Bun)
|
|
28
|
+
- **Architecture:** arm64
|
|
29
|
+
- **Package:** start-command@0.7.0
|
|
30
|
+
|
|
31
|
+
### Observed Behavior
|
|
32
|
+
|
|
33
|
+
#### Command 1: `$ --version --`
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
Error: No command provided
|
|
37
|
+
Usage: $ [options] [--] <command> [args...]
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Expected:** Should display version information (same as `$ --version`)
|
|
41
|
+
**Actual:** Treated `--` as command separator and found no command after it
|
|
42
|
+
|
|
43
|
+
#### Command 2: `$ --version`
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
start-command version: 0.7.0
|
|
47
|
+
|
|
48
|
+
OS: darwin
|
|
49
|
+
OS Release: 24.6.0
|
|
50
|
+
Node Version: v24.3.0
|
|
51
|
+
Architecture: arm64
|
|
52
|
+
|
|
53
|
+
Isolation tools:
|
|
54
|
+
screen: not installed
|
|
55
|
+
tmux: not installed
|
|
56
|
+
docker: Docker version 28.5.1, build e180ab8
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Issues Identified:**
|
|
60
|
+
|
|
61
|
+
1. Screen shown as "not installed" despite being present
|
|
62
|
+
2. "Node Version: v24.3.0" when using Bun
|
|
63
|
+
3. "OS Release: 24.6.0" (kernel) instead of "15.7.2" (macOS version)
|
|
64
|
+
|
|
65
|
+
#### Verification Commands
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
screen -v
|
|
69
|
+
# Output: Screen version 4.00.03 (FAU) 23-Oct-06
|
|
70
|
+
|
|
71
|
+
sw_vers
|
|
72
|
+
# Output:
|
|
73
|
+
# ProductName: macOS
|
|
74
|
+
# ProductVersion: 15.7.2
|
|
75
|
+
# BuildVersion: 24G325
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Root Cause Analysis
|
|
79
|
+
|
|
80
|
+
### Issue 1: Screen Version Not Detected
|
|
81
|
+
|
|
82
|
+
**Location:** `src/bin/cli.js:84`
|
|
83
|
+
|
|
84
|
+
**Root Cause:**
|
|
85
|
+
|
|
86
|
+
- Screen outputs version to stderr, not stdout
|
|
87
|
+
- Current implementation uses `execSync()` with default stdio configuration
|
|
88
|
+
- On some systems/versions, screen sends output to stderr
|
|
89
|
+
|
|
90
|
+
**Code Analysis:**
|
|
91
|
+
|
|
92
|
+
```javascript
|
|
93
|
+
const screenVersion = getToolVersion('screen', '--version');
|
|
94
|
+
|
|
95
|
+
function getToolVersion(toolName, versionFlag) {
|
|
96
|
+
try {
|
|
97
|
+
const result = execSync(`${toolName} ${versionFlag}`, {
|
|
98
|
+
encoding: 'utf8',
|
|
99
|
+
stdio: ['pipe', 'pipe', 'pipe'], // stderr is piped but not captured
|
|
100
|
+
timeout: 5000,
|
|
101
|
+
}).trim();
|
|
102
|
+
// ...
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
The `execSync()` call captures stdout but the function doesn't merge stderr into the result. On macOS, screen may output to stderr.
|
|
106
|
+
|
|
107
|
+
### Issue 2: Node.js Version Instead of Bun Version
|
|
108
|
+
|
|
109
|
+
**Location:** `src/bin/cli.js:76`
|
|
110
|
+
|
|
111
|
+
**Root Cause:**
|
|
112
|
+
|
|
113
|
+
- Code uses `process.version` which returns Node.js compatibility version in Bun
|
|
114
|
+
- Bun emulates Node.js v24.3.0 for compatibility
|
|
115
|
+
- Should use `process.versions.bun` or `Bun.version` instead
|
|
116
|
+
|
|
117
|
+
**Code Analysis:**
|
|
118
|
+
|
|
119
|
+
```javascript
|
|
120
|
+
console.log(`Node Version: ${process.version}`);
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**Research Findings:**
|
|
124
|
+
|
|
125
|
+
- `process.version` in Bun → Returns emulated Node.js version (v24.3.0)
|
|
126
|
+
- `process.versions.bun` → Returns actual Bun version (1.2.20)
|
|
127
|
+
- `Bun.version` → Bun-specific API for version
|
|
128
|
+
|
|
129
|
+
**Sources:**
|
|
130
|
+
|
|
131
|
+
- [Bun — Detect the Version at Runtime](https://futurestud.io/tutorials/bun-detect-the-version-at-runtime)
|
|
132
|
+
- [Get the current Bun version - Bun](https://bun.com/docs/guides/util/version)
|
|
133
|
+
|
|
134
|
+
### Issue 3: Incorrect macOS Version Format
|
|
135
|
+
|
|
136
|
+
**Location:** `src/bin/cli.js:75`
|
|
137
|
+
|
|
138
|
+
**Root Cause:**
|
|
139
|
+
|
|
140
|
+
- Code uses `os.release()` which returns kernel version (24.6.0)
|
|
141
|
+
- Should use `sw_vers -productVersion` for user-facing macOS version (15.7.2)
|
|
142
|
+
|
|
143
|
+
**Code Analysis:**
|
|
144
|
+
|
|
145
|
+
```javascript
|
|
146
|
+
console.log(`OS Release: ${os.release()}`);
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**Kernel vs Product Version:**
|
|
150
|
+
|
|
151
|
+
- `os.release()` → 24.6.0 (Darwin kernel version)
|
|
152
|
+
- `sw_vers -productVersion` → 15.7.2 (macOS product version)
|
|
153
|
+
|
|
154
|
+
**Research Findings:**
|
|
155
|
+
The macOS `sw_vers` command provides user-facing version information:
|
|
156
|
+
|
|
157
|
+
- `sw_vers -productVersion` returns the macOS version (e.g., "15.7.2", "26.0")
|
|
158
|
+
- This is what users recognize as their macOS version
|
|
159
|
+
|
|
160
|
+
**Sources:**
|
|
161
|
+
|
|
162
|
+
- [sw_vers Man Page - macOS - SS64.com](https://ss64.com/mac/sw_vers.html)
|
|
163
|
+
- [Check macOS Latest Version · For Tahoe · 2025](https://mac.install.guide/macos/check-version)
|
|
164
|
+
|
|
165
|
+
### Issue 4: Argument Parsing for `--version --`
|
|
166
|
+
|
|
167
|
+
**Location:** `src/bin/cli.js:52-55`
|
|
168
|
+
|
|
169
|
+
**Root Cause:**
|
|
170
|
+
|
|
171
|
+
- Version check happens before argument parsing
|
|
172
|
+
- Only checks for exact match: `args.length === 1 && (args[0] === '--version' || args[0] === '-v')`
|
|
173
|
+
- When `--version --` is passed, args = `['--version', '--']`, length is 2, fails the check
|
|
174
|
+
- Falls through to argument parser which treats `--` as separator
|
|
175
|
+
|
|
176
|
+
**Code Analysis:**
|
|
177
|
+
|
|
178
|
+
```javascript
|
|
179
|
+
if (args.length === 1 && (args[0] === '--version' || args[0] === '-v')) {
|
|
180
|
+
printVersion();
|
|
181
|
+
process.exit(0);
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
**Expected Behavior:**
|
|
186
|
+
|
|
187
|
+
- `$ --version` → Show version ✓
|
|
188
|
+
- `$ --version --` → Show version (should ignore trailing `--`)
|
|
189
|
+
- `$ --` → "No command provided" error ✓
|
|
190
|
+
- `$` → Show usage ✓
|
|
191
|
+
|
|
192
|
+
## Proposed Solutions
|
|
193
|
+
|
|
194
|
+
### Solution 1: Fix Screen Detection
|
|
195
|
+
|
|
196
|
+
Capture both stdout and stderr when detecting tool versions:
|
|
197
|
+
|
|
198
|
+
```javascript
|
|
199
|
+
function getToolVersion(toolName, versionFlag) {
|
|
200
|
+
try {
|
|
201
|
+
const result = execSync(`${toolName} ${versionFlag} 2>&1`, {
|
|
202
|
+
encoding: 'utf8',
|
|
203
|
+
timeout: 5000,
|
|
204
|
+
}).trim();
|
|
205
|
+
const firstLine = result.split('\n')[0];
|
|
206
|
+
return firstLine;
|
|
207
|
+
} catch {
|
|
208
|
+
return null;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Solution 2: Use Bun Version
|
|
214
|
+
|
|
215
|
+
Detect runtime and show appropriate version:
|
|
216
|
+
|
|
217
|
+
```javascript
|
|
218
|
+
// Detect if running in Bun
|
|
219
|
+
const runtime = typeof Bun !== 'undefined' ? 'Bun' : 'Node.js';
|
|
220
|
+
const runtimeVersion =
|
|
221
|
+
typeof Bun !== 'undefined' ? Bun.version : process.version;
|
|
222
|
+
|
|
223
|
+
console.log(`${runtime} Version: ${runtimeVersion}`);
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Solution 3: Fix macOS Version Detection
|
|
227
|
+
|
|
228
|
+
Use `sw_vers -productVersion` on macOS:
|
|
229
|
+
|
|
230
|
+
```javascript
|
|
231
|
+
function getOSVersion() {
|
|
232
|
+
if (process.platform === 'darwin') {
|
|
233
|
+
try {
|
|
234
|
+
return execSync('sw_vers -productVersion', { encoding: 'utf8' }).trim();
|
|
235
|
+
} catch {
|
|
236
|
+
return os.release();
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return os.release();
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
console.log(`OS: ${process.platform}`);
|
|
243
|
+
console.log(`OS Version: ${getOSVersion()}`);
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Solution 4: Fix Argument Parsing
|
|
247
|
+
|
|
248
|
+
Check for `--version` flag regardless of other arguments:
|
|
249
|
+
|
|
250
|
+
```javascript
|
|
251
|
+
// Check if --version is present (ignore trailing --)
|
|
252
|
+
const hasVersionFlag = args.includes('--version') || args.includes('-v');
|
|
253
|
+
const isOnlyVersionWithSeparator =
|
|
254
|
+
args.length === 2 &&
|
|
255
|
+
(args[0] === '--version' || args[0] === '-v') &&
|
|
256
|
+
args[1] === '--';
|
|
257
|
+
|
|
258
|
+
if ((args.length === 1 && hasVersionFlag) || isOnlyVersionWithSeparator) {
|
|
259
|
+
printVersion();
|
|
260
|
+
process.exit(0);
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
## Implementation Plan
|
|
265
|
+
|
|
266
|
+
1. **Fix argument parsing** - Handle `--version --` case
|
|
267
|
+
2. **Fix screen detection** - Capture stderr in version detection
|
|
268
|
+
3. **Replace Node with Bun** - Detect runtime and show correct version
|
|
269
|
+
4. **Fix OS version** - Use `sw_vers` on macOS
|
|
270
|
+
5. **Update REQUIREMENTS.md** - Remove npm references, emphasize Bun-first
|
|
271
|
+
6. **Add comprehensive tests** - Cover all version scenarios
|
|
272
|
+
7. **Ensure CI runs tests** - Validate quality
|
|
273
|
+
|
|
274
|
+
## Testing Strategy
|
|
275
|
+
|
|
276
|
+
### Test Cases Required
|
|
277
|
+
|
|
278
|
+
1. **Argument Parsing Tests:**
|
|
279
|
+
- `$ --version` → Shows version
|
|
280
|
+
- `$ -v` → Shows version
|
|
281
|
+
- `$ --version --` → Shows version
|
|
282
|
+
- `$ --` → Error: No command provided
|
|
283
|
+
- `$` → Shows usage
|
|
284
|
+
|
|
285
|
+
2. **Screen Detection Tests:**
|
|
286
|
+
- When screen installed → Shows version
|
|
287
|
+
- When screen not installed → Shows "not installed"
|
|
288
|
+
|
|
289
|
+
3. **Runtime Detection Tests:**
|
|
290
|
+
- Running with Bun → Shows "Bun Version: X.X.X"
|
|
291
|
+
- Running with Node → Shows "Node.js Version: vX.X.X"
|
|
292
|
+
|
|
293
|
+
4. **OS Version Tests:**
|
|
294
|
+
- On macOS → Shows ProductVersion (15.7.2 format)
|
|
295
|
+
- On Linux → Shows kernel version
|
|
296
|
+
- On Windows → Shows kernel version
|
|
297
|
+
|
|
298
|
+
## Documentation Updates
|
|
299
|
+
|
|
300
|
+
### REQUIREMENTS.md Changes Needed
|
|
301
|
+
|
|
302
|
+
1. Replace all "npm install" references with "bun install"
|
|
303
|
+
2. Update "Node.js >= 14.0.0" to "Bun >= 1.0.0"
|
|
304
|
+
3. Update system information to show "Bun Version" instead of "Node Version"
|
|
305
|
+
4. Emphasize Bun-first approach
|
|
306
|
+
|
|
307
|
+
## Additional Notes
|
|
308
|
+
|
|
309
|
+
- The project uses `#!/usr/bin/env bun` shebang correctly
|
|
310
|
+
- Package scripts still use `node --test` which should be changed to `bun test`
|
|
311
|
+
- All references to npm in documentation should be updated to bun
|
|
312
|
+
- Consider removing npm-specific features if they don't work with bun
|
|
313
|
+
|
|
314
|
+
## Files to Modify
|
|
315
|
+
|
|
316
|
+
1. `src/bin/cli.js` - Fix all version detection issues
|
|
317
|
+
2. `src/lib/args-parser.js` - No changes needed (issue is in cli.js)
|
|
318
|
+
3. `REQUIREMENTS.md` - Update to Bun-first approach
|
|
319
|
+
4. `package.json` - Update test script to use bun
|
|
320
|
+
5. `test/cli.test.js` - Add version detection tests
|
|
321
|
+
6. New: `test/version.test.js` - Comprehensive version tests
|
|
322
|
+
|
|
323
|
+
## Success Criteria
|
|
324
|
+
|
|
325
|
+
- ✅ `$ --version --` works same as `$ --version`
|
|
326
|
+
- ✅ Screen version detected correctly when installed
|
|
327
|
+
- ✅ Shows "Bun Version" instead of "Node Version"
|
|
328
|
+
- ✅ macOS shows ProductVersion not kernel version
|
|
329
|
+
- ✅ All tests pass locally
|
|
330
|
+
- ✅ CI tests pass
|
|
331
|
+
- ✅ REQUIREMENTS.md updated
|
|
332
|
+
- ✅ No npm references in documentation
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"author": {
|
|
3
|
+
"id": "MDQ6VXNlcjE0MzE5MDQ=",
|
|
4
|
+
"is_bot": false,
|
|
5
|
+
"login": "konard",
|
|
6
|
+
"name": "Konstantin Diachenko"
|
|
7
|
+
},
|
|
8
|
+
"body": "```\nkonard@MacBook-Pro-Konstantin ~ % bun install -g start-command \nbun add v1.2.20 (6ad208bc)\n\ninstalled start-command@0.7.0 with binaries:\n - $\n\n1 package installed [2.40s]\nkonard@MacBook-Pro-Konstantin ~ % $ --version -- \nError: No command provided\nUsage: $ [options] [--] <command> [args...]\n $ <command> [args...]\n\nOptions:\n --isolated, -i <environment> Run in isolated environment (screen, tmux, docker)\n --attached, -a Run in attached mode (foreground)\n --detached, -d Run in detached mode (background)\n --session, -s <name> Session name for isolation\n --image <image> Docker image (required for docker isolation)\n --version, -v Show version information\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, or docker\n\nAlias examples:\n $ install lodash npm package -> npm install lodash\n $ install 4.17.21 version of lodash npm package -> npm install lodash@4.17.21\n $ clone https://github.com/user/repo repository -> git clone https://github.com/user/repo\nkonard@MacBook-Pro-Konstantin ~ % $ --version \nstart-command version: 0.7.0\n\nOS: darwin\nOS Release: 24.6.0\nNode Version: v24.3.0\nArchitecture: arm64\n\nIsolation tools:\n screen: not installed\n tmux: not installed\n docker: Docker version 28.5.1, build e180ab8\nkonard@MacBook-Pro-Konstantin ~ % screen -v\nScreen version 4.00.03 (FAU) 23-Oct-06\nkonard@MacBook-Pro-Konstantin ~ % docker -v\nDocker version 28.5.1, build e180ab8\nkonard@MacBook-Pro-Konstantin ~ % sw_vers\nProductName:\t\tmacOS\nProductVersion:\t\t15.7.2\nBuildVersion:\t\t24G325\nkonard@MacBook-Pro-Konstantin ~ % \n```\n\nThe problems are:\n\n- `screen` tool version was not detected.\n- We use Bun, not Node.js (double check that, and also remove suggestions to install it using npm in the docs. Our tool should be Bun first and Bun only. For all scripts and shebangs we should use bun, not node. So in `--version` there should be bun version, not `node.js` version.\n- OS version detection was wrong.\n- `$ --version --` should work the same as `$ --version`, only `$ --` or `$` should result in `No command provided`.\n\nMake sure we have tests for all these (and these tests should be executed in CI, so we guarantee the quality). Also [REQUIREMENTS.md](https://github.com/link-foundation/start/blob/main/REQUIREMENTS.md) should be updated as needed.\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.",
|
|
9
|
+
"comments": [],
|
|
10
|
+
"createdAt": "2025-12-23T17:55:53Z",
|
|
11
|
+
"title": "--version issues"
|
|
12
|
+
}
|
package/package.json
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "start-command",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
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": {
|
|
7
7
|
"$": "./src/bin/cli.js"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"test": "
|
|
10
|
+
"test": "bun test test/",
|
|
11
11
|
"lint": "eslint .",
|
|
12
12
|
"lint:fix": "eslint . --fix",
|
|
13
13
|
"format": "prettier --write .",
|
|
14
14
|
"format:check": "prettier --check .",
|
|
15
|
-
"check:file-size": "
|
|
16
|
-
"check": "
|
|
15
|
+
"check:file-size": "bun scripts/check-file-size.mjs",
|
|
16
|
+
"check": "bun run lint && bun run format:check && bun run check:file-size",
|
|
17
17
|
"prepare": "husky || true",
|
|
18
18
|
"changeset": "changeset",
|
|
19
|
-
"changeset:version": "
|
|
19
|
+
"changeset:version": "bun scripts/changeset-version.mjs",
|
|
20
20
|
"changeset:publish": "changeset publish",
|
|
21
21
|
"changeset:status": "changeset status --since=origin/main"
|
|
22
22
|
},
|
package/src/bin/cli.js
CHANGED
|
@@ -48,11 +48,114 @@ 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
|
+
// Support: $ --version, $ -v, $ --version --
|
|
53
|
+
// The trailing -- should be ignored for version check
|
|
54
|
+
const hasVersionFlag =
|
|
55
|
+
args.length >= 1 && (args[0] === '--version' || args[0] === '-v');
|
|
56
|
+
const isVersionOnly =
|
|
57
|
+
args.length === 1 || (args.length === 2 && args[1] === '--');
|
|
58
|
+
|
|
59
|
+
if (hasVersionFlag && isVersionOnly) {
|
|
60
|
+
printVersion();
|
|
61
|
+
process.exit(0);
|
|
62
|
+
}
|
|
63
|
+
|
|
51
64
|
if (args.length === 0) {
|
|
52
65
|
printUsage();
|
|
53
66
|
process.exit(0);
|
|
54
67
|
}
|
|
55
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Print version information
|
|
71
|
+
*/
|
|
72
|
+
function printVersion() {
|
|
73
|
+
// Get package version
|
|
74
|
+
const packageJson = require('../../package.json');
|
|
75
|
+
const startCommandVersion = packageJson.version;
|
|
76
|
+
|
|
77
|
+
console.log(`start-command version: ${startCommandVersion}`);
|
|
78
|
+
console.log('');
|
|
79
|
+
|
|
80
|
+
// Get runtime information (Bun or Node.js)
|
|
81
|
+
const runtime = typeof Bun !== 'undefined' ? 'Bun' : 'Node.js';
|
|
82
|
+
const runtimeVersion =
|
|
83
|
+
typeof Bun !== 'undefined' ? Bun.version : process.version;
|
|
84
|
+
|
|
85
|
+
// Get OS information
|
|
86
|
+
console.log(`OS: ${process.platform}`);
|
|
87
|
+
|
|
88
|
+
// Get OS version (use sw_vers on macOS for user-friendly version)
|
|
89
|
+
let osVersion = os.release();
|
|
90
|
+
if (process.platform === 'darwin') {
|
|
91
|
+
try {
|
|
92
|
+
osVersion = execSync('sw_vers -productVersion', {
|
|
93
|
+
encoding: 'utf8',
|
|
94
|
+
timeout: 5000,
|
|
95
|
+
}).trim();
|
|
96
|
+
} catch {
|
|
97
|
+
// Fallback to kernel version if sw_vers fails
|
|
98
|
+
osVersion = os.release();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
console.log(`OS Version: ${osVersion}`);
|
|
103
|
+
console.log(`${runtime} Version: ${runtimeVersion}`);
|
|
104
|
+
console.log(`Architecture: ${process.arch}`);
|
|
105
|
+
console.log('');
|
|
106
|
+
|
|
107
|
+
// Check for installed isolation tools
|
|
108
|
+
console.log('Isolation tools:');
|
|
109
|
+
|
|
110
|
+
// Check screen
|
|
111
|
+
const screenVersion = getToolVersion('screen', '--version');
|
|
112
|
+
if (screenVersion) {
|
|
113
|
+
console.log(` screen: ${screenVersion}`);
|
|
114
|
+
} else {
|
|
115
|
+
console.log(' screen: not installed');
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Check tmux
|
|
119
|
+
const tmuxVersion = getToolVersion('tmux', '-V');
|
|
120
|
+
if (tmuxVersion) {
|
|
121
|
+
console.log(` tmux: ${tmuxVersion}`);
|
|
122
|
+
} else {
|
|
123
|
+
console.log(' tmux: not installed');
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Check docker
|
|
127
|
+
const dockerVersion = getToolVersion('docker', '--version');
|
|
128
|
+
if (dockerVersion) {
|
|
129
|
+
console.log(` docker: ${dockerVersion}`);
|
|
130
|
+
} else {
|
|
131
|
+
console.log(' docker: not installed');
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Get version of an installed tool
|
|
137
|
+
* @param {string} toolName - Name of the tool
|
|
138
|
+
* @param {string} versionFlag - Flag to get version (e.g., '--version', '-V')
|
|
139
|
+
* @returns {string|null} Version string or null if not installed
|
|
140
|
+
*/
|
|
141
|
+
function getToolVersion(toolName, versionFlag) {
|
|
142
|
+
try {
|
|
143
|
+
// Redirect stderr to stdout (2>&1) to capture version info from stderr
|
|
144
|
+
// Some tools like screen output version to stderr instead of stdout
|
|
145
|
+
const result = execSync(`${toolName} ${versionFlag} 2>&1`, {
|
|
146
|
+
encoding: 'utf8',
|
|
147
|
+
timeout: 5000,
|
|
148
|
+
}).trim();
|
|
149
|
+
|
|
150
|
+
// Extract version number from output
|
|
151
|
+
// Most tools output version in various formats, so we'll return the first line
|
|
152
|
+
const firstLine = result.split('\n')[0];
|
|
153
|
+
return firstLine;
|
|
154
|
+
} catch {
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
56
159
|
/**
|
|
57
160
|
* Print usage information
|
|
58
161
|
*/
|
|
@@ -70,13 +173,14 @@ function printUsage() {
|
|
|
70
173
|
console.log(
|
|
71
174
|
' --image <image> Docker image (required for docker isolation)'
|
|
72
175
|
);
|
|
176
|
+
console.log(' --version, -v Show version information');
|
|
73
177
|
console.log('');
|
|
74
178
|
console.log('Examples:');
|
|
75
179
|
console.log(' $ echo "Hello World"');
|
|
76
|
-
console.log(' $
|
|
77
|
-
console.log(' $ --isolated tmux --
|
|
78
|
-
console.log(' $ -i screen -d
|
|
79
|
-
console.log(' $ --isolated docker --image
|
|
180
|
+
console.log(' $ bun test');
|
|
181
|
+
console.log(' $ --isolated tmux -- bun start');
|
|
182
|
+
console.log(' $ -i screen -d bun start');
|
|
183
|
+
console.log(' $ --isolated docker --image oven/bun:latest -- bun install');
|
|
80
184
|
console.log('');
|
|
81
185
|
console.log('Features:');
|
|
82
186
|
console.log(' - Logs all output to temporary directory');
|
|
@@ -237,6 +341,11 @@ function runDirect(cmd) {
|
|
|
237
341
|
let logContent = '';
|
|
238
342
|
const startTime = getTimestamp();
|
|
239
343
|
|
|
344
|
+
// Get runtime information
|
|
345
|
+
const runtime = typeof Bun !== 'undefined' ? 'Bun' : 'Node.js';
|
|
346
|
+
const runtimeVersion =
|
|
347
|
+
typeof Bun !== 'undefined' ? Bun.version : process.version;
|
|
348
|
+
|
|
240
349
|
// Log header
|
|
241
350
|
logContent += `=== Start Command Log ===\n`;
|
|
242
351
|
logContent += `Timestamp: ${startTime}\n`;
|
|
@@ -249,7 +358,7 @@ function runDirect(cmd) {
|
|
|
249
358
|
}
|
|
250
359
|
logContent += `Shell: ${shell}\n`;
|
|
251
360
|
logContent += `Platform: ${process.platform}\n`;
|
|
252
|
-
logContent +=
|
|
361
|
+
logContent += `${runtime} Version: ${runtimeVersion}\n`;
|
|
253
362
|
logContent += `Working Directory: ${process.cwd()}\n`;
|
|
254
363
|
logContent += `${'='.repeat(50)}\n\n`;
|
|
255
364
|
|
|
@@ -398,7 +507,7 @@ function handleFailure(cmdName, fullCommand, exitCode, logPath) {
|
|
|
398
507
|
}
|
|
399
508
|
} else {
|
|
400
509
|
console.log('gh-upload-log not installed - log upload skipped');
|
|
401
|
-
console.log('Install with:
|
|
510
|
+
console.log('Install with: bun install -g gh-upload-log');
|
|
402
511
|
}
|
|
403
512
|
|
|
404
513
|
// Check if we can create issues in this repository
|
|
@@ -669,6 +778,11 @@ function createIssue(repoInfo, fullCommand, exitCode, logUrl) {
|
|
|
669
778
|
try {
|
|
670
779
|
const title = `Command failed with exit code ${exitCode}: ${fullCommand.substring(0, 50)}${fullCommand.length > 50 ? '...' : ''}`;
|
|
671
780
|
|
|
781
|
+
// Get runtime information
|
|
782
|
+
const runtime = typeof Bun !== 'undefined' ? 'Bun' : 'Node.js';
|
|
783
|
+
const runtimeVersion =
|
|
784
|
+
typeof Bun !== 'undefined' ? Bun.version : process.version;
|
|
785
|
+
|
|
672
786
|
let body = `## Command Execution Failure Report\n\n`;
|
|
673
787
|
body += `**Command:** \`${fullCommand}\`\n\n`;
|
|
674
788
|
body += `**Exit Code:** ${exitCode}\n\n`;
|
|
@@ -676,7 +790,7 @@ function createIssue(repoInfo, fullCommand, exitCode, logUrl) {
|
|
|
676
790
|
body += `### System Information\n\n`;
|
|
677
791
|
body += `- **Platform:** ${process.platform}\n`;
|
|
678
792
|
body += `- **OS Release:** ${os.release()}\n`;
|
|
679
|
-
body += `-
|
|
793
|
+
body += `- **${runtime} Version:** ${runtimeVersion}\n`;
|
|
680
794
|
body += `- **Architecture:** ${process.arch}\n\n`;
|
|
681
795
|
|
|
682
796
|
if (logUrl) {
|
package/test/cli.test.js
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
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 Version:'),
|
|
42
|
+
'Should display OS Version'
|
|
43
|
+
);
|
|
44
|
+
// Check for either Bun or Node.js version depending on runtime
|
|
45
|
+
const hasBunVersion = result.stdout.includes('Bun Version:');
|
|
46
|
+
const hasNodeVersion = result.stdout.includes('Node.js Version:');
|
|
47
|
+
assert.ok(
|
|
48
|
+
hasBunVersion || hasNodeVersion,
|
|
49
|
+
'Should display Bun Version or Node.js Version'
|
|
50
|
+
);
|
|
51
|
+
assert.ok(
|
|
52
|
+
result.stdout.includes('Architecture:'),
|
|
53
|
+
'Should display Architecture'
|
|
54
|
+
);
|
|
55
|
+
assert.ok(
|
|
56
|
+
result.stdout.includes('Isolation tools:'),
|
|
57
|
+
'Should display Isolation tools section'
|
|
58
|
+
);
|
|
59
|
+
assert.ok(
|
|
60
|
+
result.stdout.includes('screen:'),
|
|
61
|
+
'Should check for screen installation'
|
|
62
|
+
);
|
|
63
|
+
assert.ok(
|
|
64
|
+
result.stdout.includes('tmux:'),
|
|
65
|
+
'Should check for tmux installation'
|
|
66
|
+
);
|
|
67
|
+
assert.ok(
|
|
68
|
+
result.stdout.includes('docker:'),
|
|
69
|
+
'Should check for docker installation'
|
|
70
|
+
);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('should display version with -v', () => {
|
|
74
|
+
const result = runCLI(['-v']);
|
|
75
|
+
|
|
76
|
+
assert.strictEqual(result.status, 0, 'Exit code should be 0');
|
|
77
|
+
assert.ok(
|
|
78
|
+
result.stdout.includes('start-command version:'),
|
|
79
|
+
'Should display start-command version'
|
|
80
|
+
);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it('should show correct package version', () => {
|
|
84
|
+
const result = runCLI(['--version']);
|
|
85
|
+
const packageJson = JSON.parse(
|
|
86
|
+
fs.readFileSync(path.join(__dirname, '../package.json'), 'utf8')
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
assert.ok(
|
|
90
|
+
result.stdout.includes(`start-command version: ${packageJson.version}`),
|
|
91
|
+
`Should display version ${packageJson.version}`
|
|
92
|
+
);
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
describe('CLI basic behavior', () => {
|
|
97
|
+
it('should show usage when no arguments provided', () => {
|
|
98
|
+
const result = runCLI([]);
|
|
99
|
+
|
|
100
|
+
assert.strictEqual(result.status, 0, 'Exit code should be 0');
|
|
101
|
+
assert.ok(result.stdout.includes('Usage:'), 'Should display usage');
|
|
102
|
+
assert.ok(
|
|
103
|
+
result.stdout.includes('--version'),
|
|
104
|
+
'Usage should mention --version flag'
|
|
105
|
+
);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it('should show usage when no command provided after --', () => {
|
|
109
|
+
const result = runCLI(['--']);
|
|
110
|
+
|
|
111
|
+
assert.strictEqual(result.status, 0, 'Exit code should be 0');
|
|
112
|
+
assert.ok(result.stdout.includes('Usage:'), 'Should display usage');
|
|
113
|
+
});
|
|
114
|
+
});
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
/**
|
|
3
|
+
* Tests for --version flag behavior
|
|
4
|
+
* Tests for issue #22: --version issues
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { describe, it } = require('node:test');
|
|
8
|
+
const assert = require('node:assert');
|
|
9
|
+
const { execSync, spawnSync } = require('child_process');
|
|
10
|
+
const path = require('path');
|
|
11
|
+
const os = require('os');
|
|
12
|
+
|
|
13
|
+
// Path to the CLI
|
|
14
|
+
const cliPath = path.resolve(__dirname, '../src/bin/cli.js');
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Helper to run the CLI command
|
|
18
|
+
*/
|
|
19
|
+
function runCli(args) {
|
|
20
|
+
try {
|
|
21
|
+
// Use '--' separator to ensure args are passed to the script, not consumed by bun
|
|
22
|
+
// This is important for testing edge cases like passing '--' as an argument
|
|
23
|
+
const result = spawnSync('bun', [cliPath, '--', ...args], {
|
|
24
|
+
encoding: 'utf8',
|
|
25
|
+
timeout: 5000,
|
|
26
|
+
env: {
|
|
27
|
+
...process.env,
|
|
28
|
+
START_DISABLE_AUTO_ISSUE: '1',
|
|
29
|
+
START_DISABLE_LOG_UPLOAD: '1',
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
return {
|
|
33
|
+
stdout: result.stdout || '',
|
|
34
|
+
stderr: result.stderr || '',
|
|
35
|
+
exitCode: result.status,
|
|
36
|
+
error: result.error,
|
|
37
|
+
};
|
|
38
|
+
} catch (error) {
|
|
39
|
+
return {
|
|
40
|
+
stdout: '',
|
|
41
|
+
stderr: error.message,
|
|
42
|
+
exitCode: 1,
|
|
43
|
+
error,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
describe('Version Flag Tests', () => {
|
|
49
|
+
describe('Basic version flag', () => {
|
|
50
|
+
it('should show version with --version', () => {
|
|
51
|
+
const result = runCli(['--version']);
|
|
52
|
+
assert.strictEqual(result.exitCode, 0, 'Exit code should be 0');
|
|
53
|
+
assert.match(
|
|
54
|
+
result.stdout,
|
|
55
|
+
/start-command version:/,
|
|
56
|
+
'Should show start-command version'
|
|
57
|
+
);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('should show version with -v', () => {
|
|
61
|
+
const result = runCli(['-v']);
|
|
62
|
+
assert.strictEqual(result.exitCode, 0, 'Exit code should be 0');
|
|
63
|
+
assert.match(
|
|
64
|
+
result.stdout,
|
|
65
|
+
/start-command version:/,
|
|
66
|
+
'Should show start-command version'
|
|
67
|
+
);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('should show version with --version -- (trailing separator)', () => {
|
|
71
|
+
const result = runCli(['--version', '--']);
|
|
72
|
+
assert.strictEqual(result.exitCode, 0, 'Exit code should be 0');
|
|
73
|
+
assert.match(
|
|
74
|
+
result.stdout,
|
|
75
|
+
/start-command version:/,
|
|
76
|
+
'Should show start-command version with trailing --'
|
|
77
|
+
);
|
|
78
|
+
assert.doesNotMatch(
|
|
79
|
+
result.stderr,
|
|
80
|
+
/No command provided/,
|
|
81
|
+
'Should not show "No command provided" error'
|
|
82
|
+
);
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
describe('Runtime detection', () => {
|
|
87
|
+
it('should show Bun version when running with Bun', () => {
|
|
88
|
+
const result = runCli(['--version']);
|
|
89
|
+
assert.strictEqual(result.exitCode, 0, 'Exit code should be 0');
|
|
90
|
+
|
|
91
|
+
// When running with Bun, should show "Bun Version"
|
|
92
|
+
if (typeof Bun !== 'undefined') {
|
|
93
|
+
assert.match(
|
|
94
|
+
result.stdout,
|
|
95
|
+
/Bun Version:/,
|
|
96
|
+
'Should show "Bun Version:" when running with Bun'
|
|
97
|
+
);
|
|
98
|
+
assert.doesNotMatch(
|
|
99
|
+
result.stdout,
|
|
100
|
+
/Node\.js Version:/,
|
|
101
|
+
'Should not show "Node.js Version:" when running with Bun'
|
|
102
|
+
);
|
|
103
|
+
} else {
|
|
104
|
+
// When running with Node.js, should show "Node.js Version"
|
|
105
|
+
assert.match(
|
|
106
|
+
result.stdout,
|
|
107
|
+
/Node\.js Version:/,
|
|
108
|
+
'Should show "Node.js Version:" when running with Node.js'
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
describe('OS version detection', () => {
|
|
115
|
+
it('should show OS information', () => {
|
|
116
|
+
const result = runCli(['--version']);
|
|
117
|
+
assert.strictEqual(result.exitCode, 0, 'Exit code should be 0');
|
|
118
|
+
assert.match(result.stdout, /OS:/, 'Should show OS');
|
|
119
|
+
assert.match(result.stdout, /OS Version:/, 'Should show OS Version');
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it('should show macOS ProductVersion on darwin', () => {
|
|
123
|
+
const result = runCli(['--version']);
|
|
124
|
+
assert.strictEqual(result.exitCode, 0, 'Exit code should be 0');
|
|
125
|
+
|
|
126
|
+
if (process.platform === 'darwin') {
|
|
127
|
+
// Get the actual macOS version using sw_vers
|
|
128
|
+
const macOSVersion = execSync('sw_vers -productVersion', {
|
|
129
|
+
encoding: 'utf8',
|
|
130
|
+
}).trim();
|
|
131
|
+
|
|
132
|
+
// Version output should contain the ProductVersion, not the kernel version
|
|
133
|
+
assert.match(
|
|
134
|
+
result.stdout,
|
|
135
|
+
new RegExp(`OS Version: ${macOSVersion.replace('.', '\\.')}`),
|
|
136
|
+
`Should show macOS ProductVersion (${macOSVersion}), not kernel version`
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
// Should NOT show kernel version (which starts with 2x on modern macOS)
|
|
140
|
+
const kernelVersion = os.release();
|
|
141
|
+
if (kernelVersion.startsWith('2')) {
|
|
142
|
+
assert.doesNotMatch(
|
|
143
|
+
result.stdout,
|
|
144
|
+
new RegExp(`OS Version: ${kernelVersion.replace('.', '\\.')}`),
|
|
145
|
+
`Should not show kernel version (${kernelVersion})`
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
describe('Tool version detection', () => {
|
|
153
|
+
it('should detect screen version if installed', () => {
|
|
154
|
+
const result = runCli(['--version']);
|
|
155
|
+
assert.strictEqual(result.exitCode, 0, 'Exit code should be 0');
|
|
156
|
+
|
|
157
|
+
// Check if screen is actually installed
|
|
158
|
+
try {
|
|
159
|
+
const screenVersion = execSync('screen --version 2>&1', {
|
|
160
|
+
encoding: 'utf8',
|
|
161
|
+
timeout: 5000,
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
if (screenVersion) {
|
|
165
|
+
// If screen is installed, it should not show "not installed"
|
|
166
|
+
assert.doesNotMatch(
|
|
167
|
+
result.stdout,
|
|
168
|
+
/screen: not installed/,
|
|
169
|
+
'Should not show "screen: not installed" when screen is available'
|
|
170
|
+
);
|
|
171
|
+
assert.match(
|
|
172
|
+
result.stdout,
|
|
173
|
+
/screen:/,
|
|
174
|
+
'Should show screen version info'
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
} catch {
|
|
178
|
+
// Screen is not installed, should show "not installed"
|
|
179
|
+
assert.match(
|
|
180
|
+
result.stdout,
|
|
181
|
+
/screen: not installed/,
|
|
182
|
+
'Should show "screen: not installed" when screen is unavailable'
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
it('should detect tmux version if installed', () => {
|
|
188
|
+
const result = runCli(['--version']);
|
|
189
|
+
assert.strictEqual(result.exitCode, 0, 'Exit code should be 0');
|
|
190
|
+
|
|
191
|
+
// Check if tmux is actually installed
|
|
192
|
+
try {
|
|
193
|
+
const tmuxVersion = execSync('tmux -V 2>&1', {
|
|
194
|
+
encoding: 'utf8',
|
|
195
|
+
timeout: 5000,
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
if (tmuxVersion) {
|
|
199
|
+
// If tmux is installed, it should not show "not installed"
|
|
200
|
+
assert.doesNotMatch(
|
|
201
|
+
result.stdout,
|
|
202
|
+
/tmux: not installed/,
|
|
203
|
+
'Should not show "tmux: not installed" when tmux is available'
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
} catch {
|
|
207
|
+
// tmux is not installed, should show "not installed"
|
|
208
|
+
assert.match(
|
|
209
|
+
result.stdout,
|
|
210
|
+
/tmux: not installed/,
|
|
211
|
+
'Should show "tmux: not installed" when tmux is unavailable'
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
it('should detect docker version if installed', () => {
|
|
217
|
+
const result = runCli(['--version']);
|
|
218
|
+
assert.strictEqual(result.exitCode, 0, 'Exit code should be 0');
|
|
219
|
+
|
|
220
|
+
// Check if docker is actually installed
|
|
221
|
+
try {
|
|
222
|
+
const dockerVersion = execSync('docker --version 2>&1', {
|
|
223
|
+
encoding: 'utf8',
|
|
224
|
+
timeout: 5000,
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
if (dockerVersion) {
|
|
228
|
+
// If docker is installed, it should not show "not installed"
|
|
229
|
+
assert.doesNotMatch(
|
|
230
|
+
result.stdout,
|
|
231
|
+
/docker: not installed/,
|
|
232
|
+
'Should not show "docker: not installed" when docker is available'
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
} catch {
|
|
236
|
+
// docker is not installed, should show "not installed"
|
|
237
|
+
assert.match(
|
|
238
|
+
result.stdout,
|
|
239
|
+
/docker: not installed/,
|
|
240
|
+
'Should show "docker: not installed" when docker is unavailable'
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
describe('Error cases', () => {
|
|
247
|
+
it('should error with "No command provided" for $ --', () => {
|
|
248
|
+
const result = runCli(['--']);
|
|
249
|
+
assert.strictEqual(result.exitCode, 1, 'Exit code should be 1');
|
|
250
|
+
const output = result.stdout + result.stderr;
|
|
251
|
+
assert.match(
|
|
252
|
+
output,
|
|
253
|
+
/No command provided/,
|
|
254
|
+
'Should show "No command provided" error for --'
|
|
255
|
+
);
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
it('should error with "No command provided" for no args', () => {
|
|
259
|
+
const result = runCli([]);
|
|
260
|
+
assert.strictEqual(result.exitCode, 0, 'Should show usage and exit 0');
|
|
261
|
+
assert.match(result.stdout, /Usage:/, 'Should show usage message');
|
|
262
|
+
});
|
|
263
|
+
});
|
|
264
|
+
});
|