start-command 0.3.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/.changeset/README.md +8 -0
- package/.changeset/config.json +11 -0
- package/.changeset/isolation-support.md +30 -0
- package/.github/workflows/release.yml +292 -0
- package/.husky/pre-commit +1 -0
- package/.prettierignore +6 -0
- package/.prettierrc +10 -0
- package/CHANGELOG.md +24 -0
- package/LICENSE +24 -0
- package/README.md +249 -0
- package/REQUIREMENTS.md +229 -0
- package/bun.lock +453 -0
- package/bunfig.toml +3 -0
- package/eslint.config.mjs +122 -0
- package/experiments/debug-regex.js +49 -0
- package/experiments/isolation-design.md +142 -0
- package/experiments/test-cli.sh +42 -0
- package/experiments/test-substitution.js +143 -0
- package/package.json +63 -0
- package/scripts/changeset-version.mjs +38 -0
- package/scripts/check-file-size.mjs +103 -0
- package/scripts/create-github-release.mjs +93 -0
- package/scripts/create-manual-changeset.mjs +89 -0
- package/scripts/format-github-release.mjs +83 -0
- package/scripts/format-release-notes.mjs +219 -0
- package/scripts/instant-version-bump.mjs +121 -0
- package/scripts/publish-to-npm.mjs +129 -0
- package/scripts/setup-npm.mjs +37 -0
- package/scripts/validate-changeset.mjs +107 -0
- package/scripts/version-and-commit.mjs +237 -0
- package/src/bin/cli.js +670 -0
- package/src/lib/args-parser.js +259 -0
- package/src/lib/isolation.js +419 -0
- package/src/lib/substitution.js +323 -0
- package/src/lib/substitutions.lino +308 -0
- package/test/args-parser.test.js +389 -0
- package/test/isolation.test.js +248 -0
- package/test/substitution.test.js +236 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Changesets
|
|
2
|
+
|
|
3
|
+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
|
|
4
|
+
with multi-package repos, or single-package repos to help you version and publish your code. You can
|
|
5
|
+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
|
|
6
|
+
|
|
7
|
+
We have a quick list of common questions to get you started engaging with this project in
|
|
8
|
+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
|
|
3
|
+
"changelog": "@changesets/cli/changelog",
|
|
4
|
+
"commit": false,
|
|
5
|
+
"fixed": [],
|
|
6
|
+
"linked": [],
|
|
7
|
+
"access": "public",
|
|
8
|
+
"baseBranch": "main",
|
|
9
|
+
"updateInternalDependencies": "patch",
|
|
10
|
+
"ignore": []
|
|
11
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
'start-command': minor
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Add process isolation support with --isolated option
|
|
6
|
+
|
|
7
|
+
This release adds the ability to run commands in isolated environments:
|
|
8
|
+
|
|
9
|
+
**New Features:**
|
|
10
|
+
|
|
11
|
+
- `--isolated` / `-i` option to run commands in screen, tmux, zellij, or docker
|
|
12
|
+
- `--attached` / `-a` and `--detached` / `-d` modes for foreground/background execution
|
|
13
|
+
- `--session` / `-s` option for custom session names
|
|
14
|
+
- `--image` option for Docker container image specification
|
|
15
|
+
- Two command syntax patterns: `$ [options] -- [command]` or `$ [options] command`
|
|
16
|
+
|
|
17
|
+
**Supported Backends:**
|
|
18
|
+
|
|
19
|
+
- GNU Screen - classic terminal multiplexer
|
|
20
|
+
- tmux - modern terminal multiplexer
|
|
21
|
+
- zellij - modern terminal workspace
|
|
22
|
+
- Docker - container isolation
|
|
23
|
+
|
|
24
|
+
**Examples:**
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
$ --isolated tmux -- npm start
|
|
28
|
+
$ -i screen -d npm start
|
|
29
|
+
$ --isolated docker --image node:20 -- npm install
|
|
30
|
+
```
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
name: Checks and release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
types: [opened, synchronize, reopened]
|
|
9
|
+
# Manual release support - consolidated here to work with npm trusted publishing
|
|
10
|
+
# npm only allows ONE workflow file as trusted publisher, so all publishing
|
|
11
|
+
# must go through this workflow (release.yml)
|
|
12
|
+
workflow_dispatch:
|
|
13
|
+
inputs:
|
|
14
|
+
release_mode:
|
|
15
|
+
description: 'Manual release mode'
|
|
16
|
+
required: true
|
|
17
|
+
type: choice
|
|
18
|
+
default: 'instant'
|
|
19
|
+
options:
|
|
20
|
+
- instant
|
|
21
|
+
- changeset-pr
|
|
22
|
+
bump_type:
|
|
23
|
+
description: 'Manual release type'
|
|
24
|
+
required: true
|
|
25
|
+
type: choice
|
|
26
|
+
options:
|
|
27
|
+
- patch
|
|
28
|
+
- minor
|
|
29
|
+
- major
|
|
30
|
+
description:
|
|
31
|
+
description: 'Manual release description (optional)'
|
|
32
|
+
required: false
|
|
33
|
+
type: string
|
|
34
|
+
|
|
35
|
+
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
|
36
|
+
|
|
37
|
+
jobs:
|
|
38
|
+
# Changeset check - only runs on PRs
|
|
39
|
+
changeset-check:
|
|
40
|
+
name: Check for Changesets
|
|
41
|
+
runs-on: ubuntu-latest
|
|
42
|
+
if: github.event_name == 'pull_request'
|
|
43
|
+
steps:
|
|
44
|
+
- uses: actions/checkout@v4
|
|
45
|
+
with:
|
|
46
|
+
fetch-depth: 0
|
|
47
|
+
|
|
48
|
+
- name: Setup Bun
|
|
49
|
+
uses: oven-sh/setup-bun@v2
|
|
50
|
+
with:
|
|
51
|
+
bun-version: latest
|
|
52
|
+
|
|
53
|
+
- name: Install dependencies
|
|
54
|
+
run: bun install
|
|
55
|
+
|
|
56
|
+
- name: Check for changesets
|
|
57
|
+
run: |
|
|
58
|
+
# Skip changeset check for automated version PRs
|
|
59
|
+
if [[ "${{ github.head_ref }}" == "changeset-release/"* ]]; then
|
|
60
|
+
echo "Skipping changeset check for automated release PR"
|
|
61
|
+
exit 0
|
|
62
|
+
fi
|
|
63
|
+
|
|
64
|
+
# Run changeset validation script
|
|
65
|
+
bun scripts/validate-changeset.mjs
|
|
66
|
+
|
|
67
|
+
# Linting and formatting - runs after changeset check on PRs, immediately on main
|
|
68
|
+
lint:
|
|
69
|
+
name: Lint and Format Check
|
|
70
|
+
runs-on: ubuntu-latest
|
|
71
|
+
needs: [changeset-check]
|
|
72
|
+
if: always() && (github.event_name == 'push' || needs.changeset-check.result == 'success')
|
|
73
|
+
steps:
|
|
74
|
+
- uses: actions/checkout@v4
|
|
75
|
+
|
|
76
|
+
- name: Setup Bun
|
|
77
|
+
uses: oven-sh/setup-bun@v2
|
|
78
|
+
with:
|
|
79
|
+
bun-version: latest
|
|
80
|
+
|
|
81
|
+
- name: Install dependencies
|
|
82
|
+
run: bun install
|
|
83
|
+
|
|
84
|
+
- name: Run ESLint
|
|
85
|
+
run: bun run lint
|
|
86
|
+
|
|
87
|
+
- name: Check formatting
|
|
88
|
+
run: bun run format:check
|
|
89
|
+
|
|
90
|
+
- name: Check file size limit
|
|
91
|
+
run: bun scripts/check-file-size.mjs
|
|
92
|
+
|
|
93
|
+
# Test with Bun only - 3 OS (Ubuntu, macOS, Windows)
|
|
94
|
+
test:
|
|
95
|
+
name: Test (Bun on ${{ matrix.os }})
|
|
96
|
+
runs-on: ${{ matrix.os }}
|
|
97
|
+
needs: [changeset-check]
|
|
98
|
+
if: always() && (github.event_name == 'push' || needs.changeset-check.result == 'success')
|
|
99
|
+
strategy:
|
|
100
|
+
fail-fast: false
|
|
101
|
+
matrix:
|
|
102
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
103
|
+
steps:
|
|
104
|
+
- uses: actions/checkout@v4
|
|
105
|
+
|
|
106
|
+
- name: Setup Bun
|
|
107
|
+
uses: oven-sh/setup-bun@v2
|
|
108
|
+
with:
|
|
109
|
+
bun-version: latest
|
|
110
|
+
|
|
111
|
+
- name: Install dependencies
|
|
112
|
+
run: bun install
|
|
113
|
+
|
|
114
|
+
- name: Run tests
|
|
115
|
+
run: bun test
|
|
116
|
+
|
|
117
|
+
# Release - only runs on main after tests pass (for push events)
|
|
118
|
+
release:
|
|
119
|
+
name: Release
|
|
120
|
+
needs: [lint, test]
|
|
121
|
+
# Use always() to ensure this job runs even if changeset-check was skipped
|
|
122
|
+
# This is needed because lint/test jobs have a transitive dependency on changeset-check
|
|
123
|
+
if: always() && github.ref == 'refs/heads/main' && github.event_name == 'push' && needs.lint.result == 'success' && needs.test.result == 'success'
|
|
124
|
+
runs-on: ubuntu-latest
|
|
125
|
+
# Permissions required for npm OIDC trusted publishing
|
|
126
|
+
permissions:
|
|
127
|
+
contents: write
|
|
128
|
+
pull-requests: write
|
|
129
|
+
id-token: write
|
|
130
|
+
steps:
|
|
131
|
+
- uses: actions/checkout@v4
|
|
132
|
+
with:
|
|
133
|
+
fetch-depth: 0
|
|
134
|
+
|
|
135
|
+
- name: Setup Bun
|
|
136
|
+
uses: oven-sh/setup-bun@v2
|
|
137
|
+
with:
|
|
138
|
+
bun-version: latest
|
|
139
|
+
|
|
140
|
+
- name: Setup Node.js for npm publishing
|
|
141
|
+
uses: actions/setup-node@v4
|
|
142
|
+
with:
|
|
143
|
+
node-version: '20.x'
|
|
144
|
+
registry-url: 'https://registry.npmjs.org'
|
|
145
|
+
|
|
146
|
+
- name: Install dependencies
|
|
147
|
+
run: bun install
|
|
148
|
+
|
|
149
|
+
- name: Update npm for OIDC trusted publishing
|
|
150
|
+
run: bun scripts/setup-npm.mjs
|
|
151
|
+
|
|
152
|
+
- name: Check for changesets
|
|
153
|
+
id: check_changesets
|
|
154
|
+
run: |
|
|
155
|
+
# Count changeset files (excluding README.md and config.json)
|
|
156
|
+
CHANGESET_COUNT=$(find .changeset -name "*.md" ! -name "README.md" | wc -l)
|
|
157
|
+
echo "Found $CHANGESET_COUNT changeset file(s)"
|
|
158
|
+
echo "has_changesets=$([[ $CHANGESET_COUNT -gt 0 ]] && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT
|
|
159
|
+
|
|
160
|
+
- name: Version packages and commit to main
|
|
161
|
+
if: steps.check_changesets.outputs.has_changesets == 'true'
|
|
162
|
+
id: version
|
|
163
|
+
run: bun scripts/version-and-commit.mjs --mode changeset
|
|
164
|
+
|
|
165
|
+
- name: Publish to npm
|
|
166
|
+
# Run if version was committed OR if a previous attempt already committed (for re-runs)
|
|
167
|
+
if: steps.version.outputs.version_committed == 'true' || steps.version.outputs.already_released == 'true'
|
|
168
|
+
id: publish
|
|
169
|
+
run: bun scripts/publish-to-npm.mjs --should-pull
|
|
170
|
+
|
|
171
|
+
- name: Create GitHub Release
|
|
172
|
+
if: steps.publish.outputs.published == 'true'
|
|
173
|
+
env:
|
|
174
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
175
|
+
run: bun scripts/create-github-release.mjs --release-version "${{ steps.publish.outputs.published_version }}" --repository "${{ github.repository }}"
|
|
176
|
+
|
|
177
|
+
- name: Format GitHub release notes
|
|
178
|
+
if: steps.publish.outputs.published == 'true'
|
|
179
|
+
env:
|
|
180
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
181
|
+
run: bun scripts/format-github-release.mjs --release-version "${{ steps.publish.outputs.published_version }}" --repository "${{ github.repository }}" --commit-sha "${{ github.sha }}"
|
|
182
|
+
|
|
183
|
+
# Manual Instant Release - triggered via workflow_dispatch with instant mode
|
|
184
|
+
# This job is in release.yml because npm trusted publishing
|
|
185
|
+
# only allows one workflow file to be registered as a trusted publisher
|
|
186
|
+
instant-release:
|
|
187
|
+
name: Instant Release
|
|
188
|
+
if: github.event_name == 'workflow_dispatch' && github.event.inputs.release_mode == 'instant'
|
|
189
|
+
runs-on: ubuntu-latest
|
|
190
|
+
# Permissions required for npm OIDC trusted publishing
|
|
191
|
+
permissions:
|
|
192
|
+
contents: write
|
|
193
|
+
pull-requests: write
|
|
194
|
+
id-token: write
|
|
195
|
+
steps:
|
|
196
|
+
- uses: actions/checkout@v4
|
|
197
|
+
with:
|
|
198
|
+
fetch-depth: 0
|
|
199
|
+
|
|
200
|
+
- name: Setup Bun
|
|
201
|
+
uses: oven-sh/setup-bun@v2
|
|
202
|
+
with:
|
|
203
|
+
bun-version: latest
|
|
204
|
+
|
|
205
|
+
- name: Setup Node.js for npm publishing
|
|
206
|
+
uses: actions/setup-node@v4
|
|
207
|
+
with:
|
|
208
|
+
node-version: '20.x'
|
|
209
|
+
registry-url: 'https://registry.npmjs.org'
|
|
210
|
+
|
|
211
|
+
- name: Install dependencies
|
|
212
|
+
run: bun install
|
|
213
|
+
|
|
214
|
+
- name: Update npm for OIDC trusted publishing
|
|
215
|
+
run: bun scripts/setup-npm.mjs
|
|
216
|
+
|
|
217
|
+
- name: Version packages and commit to main
|
|
218
|
+
id: version
|
|
219
|
+
run: bun scripts/version-and-commit.mjs --mode instant --bump-type "${{ github.event.inputs.bump_type }}" --description "${{ github.event.inputs.description }}"
|
|
220
|
+
|
|
221
|
+
- name: Publish to npm
|
|
222
|
+
# Run if version was committed OR if a previous attempt already committed (for re-runs)
|
|
223
|
+
if: steps.version.outputs.version_committed == 'true' || steps.version.outputs.already_released == 'true'
|
|
224
|
+
id: publish
|
|
225
|
+
run: bun scripts/publish-to-npm.mjs
|
|
226
|
+
|
|
227
|
+
- name: Create GitHub Release
|
|
228
|
+
if: steps.publish.outputs.published == 'true'
|
|
229
|
+
env:
|
|
230
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
231
|
+
run: bun scripts/create-github-release.mjs --release-version "${{ steps.publish.outputs.published_version }}" --repository "${{ github.repository }}"
|
|
232
|
+
|
|
233
|
+
- name: Format GitHub release notes
|
|
234
|
+
if: steps.publish.outputs.published == 'true'
|
|
235
|
+
env:
|
|
236
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
237
|
+
run: bun scripts/format-github-release.mjs --release-version "${{ steps.publish.outputs.published_version }}" --repository "${{ github.repository }}" --commit-sha "${{ github.sha }}"
|
|
238
|
+
|
|
239
|
+
# Manual Changeset PR - creates a pull request with the changeset for review
|
|
240
|
+
changeset-pr:
|
|
241
|
+
name: Create Changeset PR
|
|
242
|
+
if: github.event_name == 'workflow_dispatch' && github.event.inputs.release_mode == 'changeset-pr'
|
|
243
|
+
runs-on: ubuntu-latest
|
|
244
|
+
permissions:
|
|
245
|
+
contents: write
|
|
246
|
+
pull-requests: write
|
|
247
|
+
steps:
|
|
248
|
+
- uses: actions/checkout@v4
|
|
249
|
+
with:
|
|
250
|
+
fetch-depth: 0
|
|
251
|
+
|
|
252
|
+
- name: Setup Bun
|
|
253
|
+
uses: oven-sh/setup-bun@v2
|
|
254
|
+
with:
|
|
255
|
+
bun-version: latest
|
|
256
|
+
|
|
257
|
+
- name: Install dependencies
|
|
258
|
+
run: bun install
|
|
259
|
+
|
|
260
|
+
- name: Create changeset file
|
|
261
|
+
run: bun scripts/create-manual-changeset.mjs --bump-type "${{ github.event.inputs.bump_type }}" --description "${{ github.event.inputs.description }}"
|
|
262
|
+
|
|
263
|
+
- name: Format changeset with Prettier
|
|
264
|
+
run: |
|
|
265
|
+
# Run Prettier on the changeset file to ensure it matches project style
|
|
266
|
+
bun x prettier --write ".changeset/*.md" || true
|
|
267
|
+
|
|
268
|
+
echo "Formatted changeset files"
|
|
269
|
+
|
|
270
|
+
- name: Create Pull Request
|
|
271
|
+
uses: peter-evans/create-pull-request@v7
|
|
272
|
+
with:
|
|
273
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
274
|
+
commit-message: 'chore: add changeset for manual ${{ github.event.inputs.bump_type }} release'
|
|
275
|
+
branch: changeset-manual-release-${{ github.run_id }}
|
|
276
|
+
delete-branch: true
|
|
277
|
+
title: 'chore: manual ${{ github.event.inputs.bump_type }} release'
|
|
278
|
+
body: |
|
|
279
|
+
## Manual Release Request
|
|
280
|
+
|
|
281
|
+
This PR was created by a manual workflow trigger to prepare a **${{ github.event.inputs.bump_type }}** release.
|
|
282
|
+
|
|
283
|
+
### Release Details
|
|
284
|
+
- **Type:** ${{ github.event.inputs.bump_type }}
|
|
285
|
+
- **Description:** ${{ github.event.inputs.description || 'Manual release' }}
|
|
286
|
+
- **Triggered by:** @${{ github.actor }}
|
|
287
|
+
|
|
288
|
+
### Next Steps
|
|
289
|
+
1. Review the changeset in this PR
|
|
290
|
+
2. Merge this PR to main
|
|
291
|
+
3. The automated release workflow will create a version PR
|
|
292
|
+
4. Merge the version PR to publish to npm and create a GitHub release
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npx lint-staged
|
package/.prettierignore
ADDED
package/.prettierrc
ADDED
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# start-command
|
|
2
|
+
|
|
3
|
+
## 0.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 6a701da: Apply js-ai-driven-development-pipeline-template (Bun-only)
|
|
8
|
+
- Add .changeset/ for version management
|
|
9
|
+
- Add .husky/ for git hooks
|
|
10
|
+
- Add eslint.config.mjs with ESLint 9 flat config
|
|
11
|
+
- Add .prettierrc for code formatting
|
|
12
|
+
- Add bunfig.toml for Bun configuration
|
|
13
|
+
- Add scripts/ directory with release automation scripts
|
|
14
|
+
- Create release.yml workflow (Bun-only, merged test.yml)
|
|
15
|
+
- Add CHANGELOG.md
|
|
16
|
+
|
|
17
|
+
## 0.3.0
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- Initial release with natural language command aliases
|
|
22
|
+
- Automatic logging of all commands
|
|
23
|
+
- Auto-reporting on failure for NPM packages
|
|
24
|
+
- GitHub integration for issue creation
|
package/LICENSE
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
This is free and unencumbered software released into the public domain.
|
|
2
|
+
|
|
3
|
+
Anyone is free to copy, modify, publish, use, compile, sell, or
|
|
4
|
+
distribute this software, either in source code form or as a compiled
|
|
5
|
+
binary, for any purpose, commercial or non-commercial, and by any
|
|
6
|
+
means.
|
|
7
|
+
|
|
8
|
+
In jurisdictions that recognize copyright laws, the author or authors
|
|
9
|
+
of this software dedicate any and all copyright interest in the
|
|
10
|
+
software to the public domain. We make this dedication for the benefit
|
|
11
|
+
of the public at large and to the detriment of our heirs and
|
|
12
|
+
successors. We intend this dedication to be an overt act of
|
|
13
|
+
relinquishment in perpetuity of all present and future rights to this
|
|
14
|
+
software under copyright law.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
20
|
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
21
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
|
|
24
|
+
For more information, please refer to <https://unlicense.org>
|
package/README.md
ADDED
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
# start-command (`$`)
|
|
2
|
+
|
|
3
|
+
Gamification of coding - execute any command with automatic logging and ability to auto-report issues on GitHub.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g start-command
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
The `$` command acts as a wrapper for any shell command:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
$ ls -la
|
|
17
|
+
$ cat file.txt
|
|
18
|
+
$ npm test
|
|
19
|
+
$ git status
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Natural Language Commands (Aliases)
|
|
23
|
+
|
|
24
|
+
You can also use natural language to execute common commands. The `$` command supports pattern-based substitutions defined in `substitutions.lino`:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# Install NPM packages
|
|
28
|
+
$ install lodash npm package # -> npm install lodash
|
|
29
|
+
$ install 4.17.21 version of lodash npm package # -> npm install lodash@4.17.21
|
|
30
|
+
$ install lodash npm package globally # -> npm install -g lodash
|
|
31
|
+
|
|
32
|
+
# Clone repositories
|
|
33
|
+
$ clone https://github.com/user/repo repository # -> git clone https://github.com/user/repo
|
|
34
|
+
|
|
35
|
+
# Git operations
|
|
36
|
+
$ checkout main branch # -> git checkout main
|
|
37
|
+
$ create feature-x branch # -> git checkout -b feature-x
|
|
38
|
+
|
|
39
|
+
# Common operations
|
|
40
|
+
$ list files # -> ls -la
|
|
41
|
+
$ show current directory # -> pwd
|
|
42
|
+
$ create my-project directory # -> mkdir -p my-project
|
|
43
|
+
|
|
44
|
+
# Python packages
|
|
45
|
+
$ install requests python package # -> pip install requests
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
If no pattern matches, the command is executed as-is.
|
|
49
|
+
|
|
50
|
+
## Features
|
|
51
|
+
|
|
52
|
+
### Natural Language Aliases (Links Notation)
|
|
53
|
+
|
|
54
|
+
Commands can be expressed in plain English using patterns defined in `substitutions.lino`. This file uses [Links Notation](https://github.com/link-foundation/links-notation) style patterns with variables.
|
|
55
|
+
|
|
56
|
+
Each pattern is defined as a doublet link - a pair of pattern and replacement wrapped in parentheses:
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
# Pattern definition in substitutions.lino:
|
|
60
|
+
(
|
|
61
|
+
install $packageName npm package
|
|
62
|
+
npm install $packageName
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
# Usage:
|
|
66
|
+
$ install express npm package
|
|
67
|
+
# Executes: npm install express
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Variables like `$packageName`, `$version`, `$repository` are captured and used in the substitution.
|
|
71
|
+
|
|
72
|
+
### Automatic Logging
|
|
73
|
+
|
|
74
|
+
All command output is automatically saved to your system's temporary directory with timestamps:
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
[2024-01-15 10:30:45.123] Starting: npm test
|
|
78
|
+
... command output ...
|
|
79
|
+
[2024-01-15 10:30:52.456] Finished
|
|
80
|
+
Exit code: 0
|
|
81
|
+
Log saved: /tmp/start-command-1705312245123-abc123.log
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Exit Code Display
|
|
85
|
+
|
|
86
|
+
The exit code is always prominently displayed after command completion, making it clear whether the command succeeded or failed.
|
|
87
|
+
|
|
88
|
+
### Auto-Reporting on Failure (NPM packages)
|
|
89
|
+
|
|
90
|
+
When a command fails (non-zero exit code) and it's a globally installed NPM package:
|
|
91
|
+
|
|
92
|
+
1. **Repository Detection** - Automatically detects the GitHub repository for NPM packages
|
|
93
|
+
2. **Log Upload** - Uploads the full log to GitHub (requires [gh-upload-log](https://github.com/link-foundation/gh-upload-log))
|
|
94
|
+
3. **Issue Creation** - Creates an issue in the package's repository with:
|
|
95
|
+
- Command that was executed
|
|
96
|
+
- Exit code
|
|
97
|
+
- System information
|
|
98
|
+
- Link to uploaded log
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
[2024-01-15 10:30:45.123] Starting: some-npm-tool --broken-arg
|
|
102
|
+
... error output ...
|
|
103
|
+
[2024-01-15 10:30:46.789] Finished
|
|
104
|
+
Exit code: 1
|
|
105
|
+
Log saved: /tmp/start-command-1705312246789-def456.log
|
|
106
|
+
|
|
107
|
+
Detected repository: https://github.com/owner/some-npm-tool
|
|
108
|
+
Log uploaded: https://gist.github.com/user/abc123
|
|
109
|
+
Issue created: https://github.com/owner/some-npm-tool/issues/42
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Process Isolation
|
|
113
|
+
|
|
114
|
+
Run commands in isolated environments using terminal multiplexers or containers:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# Run in tmux (attached by default)
|
|
118
|
+
$ --isolated tmux -- npm start
|
|
119
|
+
|
|
120
|
+
# Run in screen detached
|
|
121
|
+
$ --isolated screen --detached -- npm start
|
|
122
|
+
|
|
123
|
+
# Run in docker container
|
|
124
|
+
$ --isolated docker --image node:20 -- npm install
|
|
125
|
+
|
|
126
|
+
# Short form with custom session name
|
|
127
|
+
$ -i tmux -s my-session -d npm start
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
#### Supported Backends
|
|
131
|
+
|
|
132
|
+
| Backend | Description | Installation |
|
|
133
|
+
| -------- | -------------------------------------- | ---------------------------------------------------------- |
|
|
134
|
+
| `screen` | GNU Screen terminal multiplexer | `apt install screen` / `brew install screen` |
|
|
135
|
+
| `tmux` | Modern terminal multiplexer | `apt install tmux` / `brew install tmux` |
|
|
136
|
+
| `zellij` | Modern terminal workspace | `cargo install zellij` / `brew install zellij` |
|
|
137
|
+
| `docker` | Container isolation (requires --image) | [Docker Installation](https://docs.docker.com/get-docker/) |
|
|
138
|
+
|
|
139
|
+
#### Isolation Options
|
|
140
|
+
|
|
141
|
+
| Option | Description |
|
|
142
|
+
| ---------------- | ------------------------------------------------ |
|
|
143
|
+
| `--isolated, -i` | Isolation backend (screen, tmux, docker, zellij) |
|
|
144
|
+
| `--attached, -a` | Run in attached/foreground mode (default) |
|
|
145
|
+
| `--detached, -d` | Run in detached/background mode |
|
|
146
|
+
| `--session, -s` | Custom session/container name |
|
|
147
|
+
| `--image` | Docker image (required for docker isolation) |
|
|
148
|
+
|
|
149
|
+
**Note:** Using both `--attached` and `--detached` together will result in an error - you must choose one mode.
|
|
150
|
+
|
|
151
|
+
### Graceful Degradation
|
|
152
|
+
|
|
153
|
+
The tool works in any environment:
|
|
154
|
+
|
|
155
|
+
- **No `gh` CLI?** - Logs are still saved locally, auto-reporting is skipped
|
|
156
|
+
- **No `gh-upload-log`?** - Issue can still be created with local log reference
|
|
157
|
+
- **Repository not detected?** - Command runs normally with logging
|
|
158
|
+
- **No permission to create issue?** - Skipped with a clear message
|
|
159
|
+
- **Isolation backend not installed?** - Clear error message with installation instructions
|
|
160
|
+
|
|
161
|
+
## Requirements
|
|
162
|
+
|
|
163
|
+
### Required
|
|
164
|
+
|
|
165
|
+
- Node.js >= 14.0.0
|
|
166
|
+
|
|
167
|
+
### Optional (for full auto-reporting)
|
|
168
|
+
|
|
169
|
+
- [GitHub CLI (`gh`)](https://cli.github.com/) - For authentication and issue creation
|
|
170
|
+
- [gh-upload-log](https://github.com/link-foundation/gh-upload-log) - For uploading log files
|
|
171
|
+
|
|
172
|
+
To set up auto-reporting:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
# Install GitHub CLI and authenticate
|
|
176
|
+
gh auth login
|
|
177
|
+
|
|
178
|
+
# Install log uploader
|
|
179
|
+
npm install -g gh-upload-log
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## How It Works
|
|
183
|
+
|
|
184
|
+
1. **Command Execution** - Your command is passed directly to the shell (bash/powershell/sh)
|
|
185
|
+
2. **Output Capture** - Both stdout and stderr are captured while still being displayed
|
|
186
|
+
3. **Log File** - Complete output is saved with timestamps and system info
|
|
187
|
+
4. **Failure Handling** - On non-zero exit:
|
|
188
|
+
- Detects if the command is an NPM package
|
|
189
|
+
- Looks up the package's GitHub repository
|
|
190
|
+
- Uploads log (if `gh-upload-log` is available)
|
|
191
|
+
- Creates an issue (if `gh` is authenticated and has permission)
|
|
192
|
+
|
|
193
|
+
## Configuration
|
|
194
|
+
|
|
195
|
+
The following environment variables can be used to customize behavior:
|
|
196
|
+
|
|
197
|
+
| Variable | Description |
|
|
198
|
+
| ----------------------------- | -------------------------------------------------------------- |
|
|
199
|
+
| `START_DISABLE_AUTO_ISSUE` | Set to `1` or `true` to disable automatic issue creation |
|
|
200
|
+
| `START_DISABLE_LOG_UPLOAD` | Set to `1` or `true` to disable log upload |
|
|
201
|
+
| `START_LOG_DIR` | Custom directory for log files (defaults to OS temp directory) |
|
|
202
|
+
| `START_VERBOSE` | Set to `1` or `true` for verbose output |
|
|
203
|
+
| `START_DISABLE_SUBSTITUTIONS` | Set to `1` or `true` to disable pattern matching/aliases |
|
|
204
|
+
| `START_SUBSTITUTIONS_PATH` | Custom path to substitutions.lino file |
|
|
205
|
+
|
|
206
|
+
Example:
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
# Run without auto-issue creation
|
|
210
|
+
START_DISABLE_AUTO_ISSUE=1 $ npm test
|
|
211
|
+
|
|
212
|
+
# Use custom log directory
|
|
213
|
+
START_LOG_DIR=./logs $ npm test
|
|
214
|
+
|
|
215
|
+
# Disable substitutions (use raw command)
|
|
216
|
+
START_DISABLE_SUBSTITUTIONS=1 $ install lodash npm package
|
|
217
|
+
|
|
218
|
+
# Use custom substitutions file
|
|
219
|
+
START_SUBSTITUTIONS_PATH=/path/to/my-rules.lino $ install mypackage npm package
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Custom Substitutions
|
|
223
|
+
|
|
224
|
+
You can create your own substitution patterns by placing a `substitutions.lino` file in `~/.start-command/substitutions.lino`. User patterns take precedence over the default ones.
|
|
225
|
+
|
|
226
|
+
## Log File Format
|
|
227
|
+
|
|
228
|
+
Log files are saved as `start-command-{timestamp}-{random}.log` and contain:
|
|
229
|
+
|
|
230
|
+
```
|
|
231
|
+
=== Start Command Log ===
|
|
232
|
+
Timestamp: 2024-01-15 10:30:45.123
|
|
233
|
+
Command: npm test
|
|
234
|
+
Shell: /bin/bash
|
|
235
|
+
Platform: linux
|
|
236
|
+
Node Version: v18.17.0
|
|
237
|
+
Working Directory: /home/user/project
|
|
238
|
+
==================================================
|
|
239
|
+
|
|
240
|
+
... command output ...
|
|
241
|
+
|
|
242
|
+
==================================================
|
|
243
|
+
Finished: 2024-01-15 10:30:52.456
|
|
244
|
+
Exit Code: 0
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## License
|
|
248
|
+
|
|
249
|
+
MIT
|