start-command 0.11.0 → 0.15.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.
Files changed (62) hide show
  1. package/CHANGELOG.md +28 -217
  2. package/bun.lock +10 -0
  3. package/eslint.config.mjs +1 -1
  4. package/package.json +13 -5
  5. package/src/bin/cli.js +414 -499
  6. package/src/lib/args-parser.js +126 -0
  7. package/src/lib/command-stream.js +258 -0
  8. package/src/lib/execution-store.js +722 -0
  9. package/src/lib/failure-handler.js +397 -0
  10. package/src/lib/isolation.js +51 -0
  11. package/src/lib/status-formatter.js +121 -0
  12. package/src/lib/version.js +143 -0
  13. package/test/args-parser.test.js +140 -0
  14. package/test/cli.test.js +11 -1
  15. package/test/docker-autoremove.test.js +11 -16
  16. package/test/execution-store.test.js +483 -0
  17. package/test/isolation-cleanup.test.js +11 -16
  18. package/test/isolation.test.js +11 -17
  19. package/test/public-exports.test.js +105 -0
  20. package/test/status-query.test.js +195 -0
  21. package/.github/workflows/release.yml +0 -334
  22. package/.husky/pre-commit +0 -1
  23. package/ARCHITECTURE.md +0 -297
  24. package/LICENSE +0 -24
  25. package/README.md +0 -339
  26. package/REQUIREMENTS.md +0 -299
  27. package/docs/PIPES.md +0 -243
  28. package/docs/USAGE.md +0 -194
  29. package/docs/case-studies/issue-15/README.md +0 -208
  30. package/docs/case-studies/issue-18/README.md +0 -343
  31. package/docs/case-studies/issue-18/issue-comments.json +0 -1
  32. package/docs/case-studies/issue-18/issue-data.json +0 -7
  33. package/docs/case-studies/issue-22/analysis.md +0 -547
  34. package/docs/case-studies/issue-22/issue-data.json +0 -12
  35. package/docs/case-studies/issue-25/README.md +0 -232
  36. package/docs/case-studies/issue-25/issue-data.json +0 -21
  37. package/docs/case-studies/issue-28/README.md +0 -405
  38. package/docs/case-studies/issue-28/issue-data.json +0 -105
  39. package/docs/case-studies/issue-28/raw-issue-data.md +0 -92
  40. package/experiments/debug-regex.js +0 -49
  41. package/experiments/isolation-design.md +0 -131
  42. package/experiments/screen-output-test.js +0 -265
  43. package/experiments/test-cli.sh +0 -42
  44. package/experiments/test-screen-attached.js +0 -126
  45. package/experiments/test-screen-logfile.js +0 -286
  46. package/experiments/test-screen-modes.js +0 -128
  47. package/experiments/test-screen-output.sh +0 -27
  48. package/experiments/test-screen-tee-debug.js +0 -237
  49. package/experiments/test-screen-tee-fallback.js +0 -230
  50. package/experiments/test-substitution.js +0 -143
  51. package/experiments/user-isolation-research.md +0 -83
  52. package/scripts/changeset-version.mjs +0 -38
  53. package/scripts/check-file-size.mjs +0 -103
  54. package/scripts/create-github-release.mjs +0 -93
  55. package/scripts/create-manual-changeset.mjs +0 -89
  56. package/scripts/format-github-release.mjs +0 -83
  57. package/scripts/format-release-notes.mjs +0 -219
  58. package/scripts/instant-version-bump.mjs +0 -121
  59. package/scripts/publish-to-npm.mjs +0 -129
  60. package/scripts/setup-npm.mjs +0 -37
  61. package/scripts/validate-changeset.mjs +0 -107
  62. package/scripts/version-and-commit.mjs +0 -237
package/CHANGELOG.md CHANGED
@@ -1,225 +1,36 @@
1
1
  # start-command
2
2
 
3
- ## 0.11.0
3
+ ## 0.15.0
4
4
 
5
5
  ### Minor Changes
6
6
 
7
- - 1240a29: Add SSH isolation support for remote command execution.
8
- - Implements SSH backend for executing commands on remote servers via SSH, similar to screen/tmux/docker isolation
9
- - Uses `--endpoint` option to specify SSH target (e.g., `--endpoint user@remote.server`)
10
- - Supports both attached (interactive) and detached (background) modes
11
- - Includes comprehensive SSH integration tests in CI with a local SSH server
7
+ - 102dbe2: Add dual storage system for command execution tracking using links notation
12
8
 
13
- ## 0.10.0
14
-
15
- ### Minor Changes
16
-
17
- - 8ea5659: Add user isolation support with --isolated-user and --keep-user options
18
-
19
- Implements user isolation that creates a new isolated user to run commands:
20
-
21
- ## --isolated-user option (create isolated user with same permissions)
22
- - Add --isolated-user, -u option to create a new isolated user automatically
23
- - New user inherits group memberships from current user (sudo, docker, wheel, etc.)
24
- - User is automatically deleted after command completes (unless --keep-user)
25
- - Works with screen and tmux isolation backends (not docker)
26
- - Optional custom username via --isolated-user=myname or -u myname
27
- - For screen/tmux: Wraps commands with sudo -n -u <user>
28
- - Requires sudo NOPASSWD configuration for useradd/userdel/sudo
29
-
30
- ## --keep-user option
31
- - Add --keep-user option to prevent user deletion after command completes
32
- - Useful when you need to inspect files created during execution
33
- - User must be manually deleted with: sudo userdel -r <username>
34
-
35
- ## Other improvements
36
- - Add comprehensive tests for user isolation
37
- - Update documentation with user isolation examples
38
- - Integrate --keep-alive and --auto-remove-docker-container from main branch
39
-
40
- Usage:
41
- - $ --isolated-user -- npm test # Auto-generated username, auto-deleted
42
- - $ --isolated-user myrunner -- npm start # Custom username
43
- - $ -u myrunner -- npm start # Short form
44
- - $ --isolated screen --isolated-user -- npm test # Combine with process isolation
45
- - $ --isolated-user --keep-user -- npm test # Keep user after completion
46
-
47
- Note: User isolation requires sudo NOPASSWD configuration.
48
-
49
- ## 0.9.0
50
-
51
- ### Minor Changes
52
-
53
- - c484149: Add --keep-alive option for isolation environments
54
- - All isolation environments (screen, tmux, docker) now automatically exit after command completion by default
55
- - New --keep-alive (-k) flag keeps the isolation environment running after command completes
56
- - Add ARCHITECTURE.md documentation describing system design
57
- - Update REQUIREMENTS.md with new option and auto-exit behavior documentation
58
-
59
- ## 0.7.6
60
-
61
- ### Patch Changes
62
-
63
- - a5fca3f: Add documentation for piping with `$` command
64
- - Created `docs/PIPES.md` with detailed guide on pipe usage
65
- - Preferred approach: `echo "hi" | $ agent` (pipe TO the $-wrapped command)
66
- - Alternative approach: `$ 'echo "hi" | agent'` (quoting)
67
- - Updated `docs/USAGE.md` with brief pipe reference
68
- - Updated `README.md` with piping examples
69
- - Updated case study for issue #28 with new recommended approach
70
-
71
- ## 0.7.5
72
-
73
- ### Patch Changes
74
-
75
- - 31a67fc: fix: Screen isolation output always captured in attached mode
76
-
77
- Changed attached mode to always use log capture instead of direct screen invocation.
78
- This ensures command output is never lost, even for quick commands that would
79
- otherwise have their output disappear when the screen session terminates rapidly.
80
-
81
- Fixes #25: Output from `$ --isolated screen -- echo "hello"` is now properly
82
- displayed instead of being lost with only "[screen is terminating]" shown.
83
-
84
- ## 0.7.4
85
-
86
- ### Patch Changes
87
-
88
- - d058c43: fix: Screen isolation output not captured for quoted commands
89
-
90
- This fixes issue #25 where commands with quoted strings (e.g., echo "hello") would not show their output when using screen isolation. The fix uses spawnSync with array arguments instead of execSync with a constructed string to avoid shell quoting issues.
91
-
92
- ## 0.7.2
93
-
94
- ### Patch Changes
95
-
96
- - fa0fb23: docs: Update documentation to Bun-first approach
97
- - Remove npm installation option from README.md
98
- - Update examples to use bun commands instead of npm
99
- - Change package.json engines from node to bun
100
- - Update REQUIREMENTS.md to remove Node.js alternative
101
-
102
- ## 0.7.1
103
-
104
- ### Patch Changes
105
-
106
- - d5a7c66: Fix all --version detection issues
107
- - Fix screen version detection by capturing stderr
108
- - Show Bun version instead of Node.js version when running with Bun
109
- - Show macOS ProductVersion instead of kernel version
110
- - Fix argument parsing to handle `$ --version --` same as `$ --version`
111
- - Update all scripts and examples to use Bun instead of Node.js
112
- - Add comprehensive tests for --version flag
113
-
114
- ## 0.7.0
115
-
116
- ### Minor Changes
117
-
118
- - 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).
119
-
120
- ## 0.6.0
121
-
122
- ### Minor Changes
123
-
124
- - 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.
125
-
126
- ## 0.5.3
127
-
128
- ### Patch Changes
129
-
130
- - 20d0c1c: Fix screen isolation not capturing output on macOS (issue #15)
131
- - Added version detection for GNU Screen to handle differences between versions
132
- - Screen >= 4.5.1 uses native `-L -Logfile` for log capture
133
- - Screen < 4.5.1 (like macOS bundled 4.0.3) uses `tee` command fallback
134
- - Added tests for version detection and -Logfile support checking
135
- - Updated case study documentation with root cause analysis
136
-
137
- ## 0.5.2
138
-
139
- ### Patch Changes
140
-
141
- - bdf77c7: Fix screen isolation environment not capturing command output in attached mode
142
-
143
- When running commands with `--isolated screen` in attached mode, the command output was not being displayed (only "screen is terminating" was shown). This was because GNU Screen requires a TTY to run in attached mode, which is not available when spawning from Node.js without a terminal.
144
-
145
- The fix implements a fallback mechanism that:
146
- - Checks if a TTY is available before spawning screen
147
- - If no TTY is available, uses detached mode with log capture to run the command and display its output
148
- - Polls for session completion and reads the captured log file
149
- - Displays the output to the user just as if it was running in attached mode
150
-
151
- This ensures that `$ --isolated screen -- echo "hello"` now correctly displays "hello" even when running from environments without a TTY (like CI/CD pipelines, scripts, or when piping output).
152
-
153
- ## 0.5.1
154
-
155
- ### Patch Changes
156
-
157
- - Test patch release
158
-
159
- ## 0.5.0
160
-
161
- ### Minor Changes
162
-
163
- - 95d8760: Unify output experience for isolation mode
164
- - Change terminology from "Backend" to "Environment" in isolation output
165
- - Add unified logging with timestamps for isolation modes (screen, tmux, docker, zellij)
166
- - Save log files for all execution modes with consistent format
167
- - Display start/end timestamps, exit code, and log file path uniformly across all modes
168
-
169
- ## 0.4.1
170
-
171
- ### Patch Changes
172
-
173
- - 73635f9: Make it bun first - update shebangs and installation docs
174
-
175
- ## 0.4.0
176
-
177
- ### Minor Changes
178
-
179
- - e8bec3c: Add process isolation support with --isolated option
180
-
181
- This release adds the ability to run commands in isolated environments:
9
+ This update implements a comprehensive execution tracking system that stores information about each called command:
182
10
 
183
11
  **New Features:**
184
- - `--isolated` / `-i` option to run commands in screen, tmux, zellij, or docker
185
- - `--attached` / `-a` and `--detached` / `-d` modes for foreground/background execution
186
- - `--session` / `-s` option for custom session names
187
- - `--image` option for Docker container image specification
188
- - Two command syntax patterns: `$ [options] -- [command]` or `$ [options] command`
189
-
190
- **Supported Backends:**
191
- - GNU Screen - classic terminal multiplexer
192
- - tmux - modern terminal multiplexer
193
- - zellij - modern terminal workspace
194
- - Docker - container isolation
195
-
196
- **Examples:**
197
-
198
- ```bash
199
- $ --isolated tmux -- npm start
200
- $ -i screen -d npm start
201
- $ --isolated docker --image node:20 -- npm install
202
- ```
203
-
204
- ## 0.3.1
205
-
206
- ### Patch Changes
207
-
208
- - 6a701da: Apply js-ai-driven-development-pipeline-template (Bun-only)
209
- - Add .changeset/ for version management
210
- - Add .husky/ for git hooks
211
- - Add eslint.config.mjs with ESLint 9 flat config
212
- - Add .prettierrc for code formatting
213
- - Add bunfig.toml for Bun configuration
214
- - Add scripts/ directory with release automation scripts
215
- - Create release.yml workflow (Bun-only, merged test.yml)
216
- - Add CHANGELOG.md
217
-
218
- ## 0.3.0
219
-
220
- ### Minor Changes
221
-
222
- - Initial release with natural language command aliases
223
- - Automatic logging of all commands
224
- - Auto-reporting on failure for NPM packages
225
- - GitHub integration for issue creation
12
+ - Dual storage system: text (.lino files) via lino-objects-codec and binary (.links) via clink
13
+ - Each execution record includes:
14
+ - UUID of the command call
15
+ - Process ID (PID) for process management
16
+ - Status (executing/executed)
17
+ - Exit code
18
+ - Log file path
19
+ - Working directory, shell, platform info
20
+ - Additional execution options and metadata
21
+ - File-based locking mechanism to ensure single-writer access
22
+ - Verification system to check consistency between text and binary databases
23
+ - Integration with clink's string aliases for readable identifiers
24
+
25
+ **Configuration:**
26
+ - `START_DISABLE_TRACKING=1` - Disable execution tracking
27
+ - `START_APP_FOLDER` - Custom folder for storing execution records
28
+ - `START_VERBOSE=1` - Show execution IDs during command execution
29
+
30
+ **Dependencies:**
31
+ - Added `lino-objects-codec` for links notation serialization
32
+ - Optional `clink` CLI tool for binary database support
33
+
34
+ **Testing:**
35
+ - 24 new unit tests for execution store operations
36
+ - CI/CD updated to install clink for integration testing on Linux and macOS
package/bun.lock CHANGED
@@ -4,6 +4,10 @@
4
4
  "workspaces": {
5
5
  "": {
6
6
  "name": "start-command",
7
+ "dependencies": {
8
+ "command-stream": "^0.8.3",
9
+ "lino-objects-codec": "^0.1.1",
10
+ },
7
11
  "devDependencies": {
8
12
  "@changesets/cli": "^2.29.7",
9
13
  "eslint": "^9.38.0",
@@ -142,6 +146,8 @@
142
146
 
143
147
  "colorette": ["colorette@2.0.20", "", {}, "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w=="],
144
148
 
149
+ "command-stream": ["command-stream@0.8.3", "", {}, "sha512-vwNf5AWLhD4awaYSIyjHEu7JrAMTu8BaJg1LIpE4HqTXFYtgzSTN/j1VnwHDTNz8sAG7zvZgtKYm9lmi4+0Z7Q=="],
150
+
145
151
  "commander": ["commander@14.0.2", "", {}, "sha512-TywoWNNRbhoD0BXs1P3ZEScW8W5iKrnbithIl0YH+uCmBd0QpPOA8yc82DS3BIE5Ma6FnBVUsJ7wVUDz4dvOWQ=="],
146
152
 
147
153
  "concat-map": ["concat-map@0.0.1", "", {}, "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="],
@@ -266,6 +272,10 @@
266
272
 
267
273
  "levn": ["levn@0.4.1", "", { "dependencies": { "prelude-ls": "^1.2.1", "type-check": "~0.4.0" } }, "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ=="],
268
274
 
275
+ "links-notation": ["links-notation@0.11.2", "", {}, "sha512-VPyELWBXpaCCiNPVeZhMbG7RuvOQR51nhqELK+s/rbSzKYhSs+tyiSOdQ7z8I7Kh3PLABF3bZETtWSFwx3vFfg=="],
276
+
277
+ "lino-objects-codec": ["lino-objects-codec@0.1.1", "", { "dependencies": { "links-notation": "^0.11.0" } }, "sha512-URX1MAhHyVga5EkpUqDTMkX1D+HYBW3spgKh6vCneQnzOMLn09XooQOuBy0apbfwlqY5qHt2fpvRdT75dBn2Qw=="],
278
+
269
279
  "lint-staged": ["lint-staged@16.2.7", "", { "dependencies": { "commander": "^14.0.2", "listr2": "^9.0.5", "micromatch": "^4.0.8", "nano-spawn": "^2.0.0", "pidtree": "^0.6.0", "string-argv": "^0.3.2", "yaml": "^2.8.1" }, "bin": { "lint-staged": "bin/lint-staged.js" } }, "sha512-lDIj4RnYmK7/kXMya+qJsmkRFkGolciXjrsZ6PC25GdTfWOAWetR0ZbsNXRAj1EHHImRSalc+whZFg56F5DVow=="],
270
280
 
271
281
  "listr2": ["listr2@9.0.5", "", { "dependencies": { "cli-truncate": "^5.0.0", "colorette": "^2.0.20", "eventemitter3": "^5.0.1", "log-update": "^6.1.0", "rfdc": "^1.4.1", "wrap-ansi": "^9.0.0" } }, "sha512-ME4Fb83LgEgwNw96RKNvKV4VTLuXfoKudAmm2lP8Kk87KaMK0/Xrx/aAkMWmT8mDb+3MlFDspfbCs7adjRxA2g=="],
package/eslint.config.mjs CHANGED
@@ -115,7 +115,7 @@ export default [
115
115
  },
116
116
  rules: {
117
117
  'require-await': 'off', // Async functions without await are common in tests
118
- 'no-unused-vars': 'warn', // Relax for experiments
118
+ 'no-unused-vars': 'off', // Disable for tests and experiments
119
119
  'no-empty': 'off', // Empty catch blocks are common in experiments
120
120
  },
121
121
  },
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "start-command",
3
- "version": "0.11.0",
3
+ "version": "0.15.0",
4
4
  "description": "Gamification of coding, execute any command with ability to auto-report issues on GitHub",
5
- "main": "index.js",
5
+ "main": "src/bin/cli.js",
6
+ "exports": {
7
+ ".": "./src/bin/cli.js",
8
+ "./execution-store": "./src/lib/execution-store.js"
9
+ },
6
10
  "bin": {
7
11
  "$": "./src/bin/cli.js"
8
12
  },
@@ -12,11 +16,11 @@
12
16
  "lint:fix": "eslint . --fix",
13
17
  "format": "prettier --write .",
14
18
  "format:check": "prettier --check .",
15
- "check:file-size": "bun scripts/check-file-size.mjs",
19
+ "check:file-size": "bun ../scripts/check-file-size.mjs",
16
20
  "check": "bun run lint && bun run format:check && bun run check:file-size",
17
- "prepare": "husky || true",
21
+ "prepare": "cd .. && husky .husky || true",
18
22
  "changeset": "changeset",
19
- "changeset:version": "bun scripts/changeset-version.mjs",
23
+ "changeset:version": "bun ../scripts/changeset-version.mjs",
20
24
  "changeset:publish": "changeset publish",
21
25
  "changeset:status": "changeset status --since=origin/main"
22
26
  },
@@ -59,5 +63,9 @@
59
63
  "prettier --write",
60
64
  "prettier --check"
61
65
  ]
66
+ },
67
+ "dependencies": {
68
+ "command-stream": "^0.8.3",
69
+ "lino-objects-codec": "^0.1.1"
62
70
  }
63
71
  }