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