workshell 0.4.0 β†’ 0.5.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 (3) hide show
  1. package/README.md +75 -38
  2. package/dist/index.js +1566 -52
  3. package/package.json +3 -1
package/README.md CHANGED
@@ -22,7 +22,7 @@
22
22
  ```bash
23
23
  $ npm i -g workshell # aliases to `wk`
24
24
  $ wk --help
25
- wk v0.0.6 - Open branches in ephemeral subshells
25
+ wk v0.5.0 - Open branches in ephemeral subshells
26
26
 
27
27
  Usage: wk <command> [options]
28
28
  # ...
@@ -40,7 +40,7 @@ Here's how it works (key points in **bold**).
40
40
 
41
41
  - You open a Git branch with `wk open <branch>` or create a new one with `wk new <branch>`.
42
42
  - An ephemeral worktree is created for this branch (in `~/.workshell/worktrees`) and **opened in a fresh subshell**.
43
- - You are now in an fresh checkout of your repo that is isolated on disk. Make changes with your agent/editor of choice and commit them.
43
+ - You are now in a fresh checkout of your repo that is isolated on disk. Make changes with your agent/editor of choice and commit them.
44
44
  - You close the subshell with `wk close`. **The associated worktree is auto-pruned**.
45
45
  - Your changes still exist on the associated branch, as Git commits/branches are shared among all worktrees. The worktree is destroyedβ€”but your commits aren't.
46
46
 
@@ -66,9 +66,9 @@ Here's how it works (key points in **bold**).
66
66
 
67
67
  This approach has some nice properties.
68
68
 
69
- - πŸ–₯️ **Tab-local workspaces** β€” Normally a `git checkout`/`git switch` changes your active branch for all terminals. With workshells, you can functionality open branches *in the current tab only*.
70
- - 🌳 **Full isolation** β€” Each workshell is isolated on disk, so the changes you make don't interfere anything else you're doing.
71
- - πŸ“¦ **Instant setup** β€” Untracked files (`.env.*`, etc) are automatically copied using [copy-on-write](https://notes.billmill.org/blog/2024/03/How_I_use_git_worktrees.html). For JS projects, the package manager is auto-detected and `npm/yarn/pnpm/bun install` runs automatically.
69
+ - πŸ–₯️ **Tab-local workspaces** β€” Normally a `git checkout`/`git switch` changes your active branch for all terminals. With workshells, you can open branches *in the current tab only*.
70
+ - 🌳 **Full isolation** β€” Each workshell is isolated on disk, so the changes you make don't interfere with anything else you're doing.
71
+ - πŸ“¦ **Instant setup** β€” Common config files are automatically copied using [copy-on-write](https://notes.billmill.org/blog/2024/03/How_I_use_git_worktrees.html), and your package manager is auto-detected so `npm`/`yarn`/`pnpm`/`bun` install runs automatically.
72
72
  - πŸ™…β€β™‚οΈ **Never stash again** β€” You can `wk open` a branch even with uncommitted changes. When you exit the subshell, things will be exactly the same as they were. β˜•οΈ
73
73
  - πŸͺΎ **Consistent with branch semantics** β€” As with regular `git switch`, `wk close` won't let you close the subshell if you have unstaged/uncommitted changes. This is a feature, not a bug! Regular worktrees make it easy to lose your work in a forgotten corner of your file system.
74
74
  - πŸ€– **Agent-ready** β€” Spin up parallel workshells so multiple agents can work simultaneously without conflicts.
@@ -182,7 +182,7 @@ Usage: wk <command> [options]
182
182
 
183
183
  Commands:
184
184
  new [branch] Create a branch and open it [--from <branch>]
185
- open <branch> Open a branch in a workshell
185
+ open <ref> Open a branch or PR in a workshell
186
186
  close Exit current workshell
187
187
  ls List orphaned worktrees
188
188
  status Show current branch
@@ -213,7 +213,7 @@ $ wk ls
213
213
  <br />
214
214
 
215
215
 
216
- ### Open a branch in a workshell
216
+ ### Open a branch or PR in a workshell
217
217
 
218
218
  You can open any existing Git branch in a workshell.
219
219
 
@@ -224,6 +224,19 @@ $ wk open feat-1
224
224
  Type 'wk close' to return.
225
225
  ```
226
226
 
227
+ You can also open GitHub pull requests directly. `wk open` accepts anything that `gh pr view` understands β€” PR numbers, URLs, or branch names. The PR branch is automatically fetched if it doesn't exist locally. Requires [GitHub CLI](https://cli.github.com/) (`gh`).
228
+
229
+ ```sh
230
+ # by PR number
231
+ $ wk open 42
232
+
233
+ # by GitHub URL
234
+ $ wk open https://github.com/org/repo/pull/42
235
+
236
+ # by branch name (tries local branch first, then GitHub PR)
237
+ $ wk open feature/auth
238
+ ```
239
+
227
240
  <br />
228
241
 
229
242
  ### Show current branch status
@@ -271,7 +284,7 @@ If the branch hasn't been pushed to a remote, you'll be prompted to auto-merge:
271
284
  - `n` β€” skip (branch is kept, merge manually later)
272
285
  - `never` β€” permanently disable auto-merge prompt
273
286
 
274
- That command will fail if you have unstaged/uncommited changes. Use the `--force`/`-f` flag to force close the workshell; **this will discard uncommitted changes**.
287
+ That command will fail if you have unstaged/uncommitted changes. Use the `--force`/`-f` flag to force close the workshell; **this will discard uncommitted changes**.
275
288
 
276
289
  ```sh
277
290
  $ wk close --force
@@ -313,40 +326,62 @@ Choice (1/2): 1
313
326
 
314
327
  ## Automatic file copying
315
328
 
316
- When you create a workshell, `wk` automatically copies all gitignored files from your repo root to the new worktree using **copy-on-write**. This means:
329
+ When you create a workshell, `wk` automatically copies common config files from your repo to the new worktree using **copy-on-write**. This includes env files, package manager config, version manager config (`asdf`, `mise`, `nvm`), and editor overrides.
317
330
 
318
- - `.env`, `.venv`, etc. are instantly available
319
- - Copy-on-write is near-instant and uses zero extra disk space (until files are modified)
331
+ <details>
332
+ <summary>Default copy patterns (click to expand)</summary>
320
333
 
321
- This works automatically on macOS (APFS) and Linux (Btrfs/XFS). On other filesystems, files are copied normally.
334
+ ```
335
+ .env*
336
+ .npmrc*
337
+ .yarnrc*
338
+ .pnpmfile.*
339
+ .pnpmrc*
340
+ .tool-versions
341
+ .node-version
342
+ .nvmrc
343
+ .ruby-version
344
+ .python-version
345
+ .mise*.toml
346
+ .dir-locals.el
347
+ .editorconfig.local
348
+ ```
322
349
 
323
- ### JS package manager detection
350
+ </details>
324
351
 
325
- For JavaScript projects, `wk` auto-detects your package manager from lockfiles:
352
+ Copy-on-write is near-instant and uses zero extra disk space (until files are modified). This works automatically on macOS (APFS) and Linux (Btrfs/XFS). On other filesystems, files are copied normally.
326
353
 
327
- | Lockfile | Package Manager |
328
- |----------|-----------------|
329
- | `pnpm-lock.yaml` | pnpm |
330
- | `yarn.lock` | yarn |
331
- | `bun.lockb` / `bun.lock` | bun |
332
- | `package-lock.json` | npm |
354
+ You can override which gitignored files get copied with the `copy` option in `workshell.toml`:
333
355
 
334
- When detected, `node_modules` is skipped during copying and `<pm> install` runs automatically. This is faster than copying large `node_modules` directories.
356
+ ```toml
357
+ # override default patterns (default: .env*, .npmrc*, .nvmrc, .tool-versions, etc.)
358
+ copy = [".env*", ".secret*", "data/fixtures/**"]
359
+ ```
335
360
 
336
- ### Python package manager detection
361
+ Patterns without `/` match at any depth (e.g. `.env*` matches both `.env` and `packages/api/.env.local`). Patterns with `/` are anchored to the repo root. Full glob syntax is supported (`*`, `**`, `?`, `[abc]`, etc.).
337
362
 
338
- For Python projects, `wk` auto-detects your package manager from lockfiles:
363
+ ### Package manager detection
339
364
 
340
- | Lockfile | Package Manager | Install Command |
341
- |----------|-----------------|-----------------|
342
- | `uv.lock` | uv | `uv sync` |
343
- | `poetry.lock` | poetry | `poetry install` |
344
- | `Pipfile.lock` | pipenv | `pipenv install` |
345
- | `pdm.lock` | pdm | `pdm install` |
365
+ `wk` auto-detects your package manager and runs install automatically:
346
366
 
347
- When detected, `.venv` and `venv` are skipped during copying and the install command runs automatically. Mixed JS+Python projects are supported: both ecosystems are detected and their installs run in sequence.
367
+ | Lockfile | Command |
368
+ |----------|---------|
369
+ | `pnpm-lock.yaml` | `pnpm install` |
370
+ | `yarn.lock` | `yarn install` |
371
+ | `bun.lockb` / `bun.lock` | `bun install` |
372
+ | `package-lock.json` | `npm install` |
373
+ | `uv.lock` | `uv sync` |
374
+ | `poetry.lock` | `poetry install` |
375
+ | `Pipfile.lock` | `pipenv install` |
376
+ | `pdm.lock` | `pdm install` |
348
377
 
349
- To disable auto-detection, add a custom `setup` script in `workshell.toml`.
378
+ Detection requires the binary to be installed. If the install command fails, a warning is printed and setup continues. Mixed JS+Python projects are supported.
379
+
380
+ Setting a `setup` script in `workshell.toml` disables automatic package manager detection. Include the install command in your setup script if you want both:
381
+
382
+ ```toml
383
+ setup = "pnpm install && nvm use"
384
+ ```
350
385
 
351
386
  <br />
352
387
 
@@ -366,12 +401,14 @@ You can optionally configure `wk` with a `workshell.toml` file.
366
401
  ### Options
367
402
 
368
403
  ```toml
369
- # Optional: setup script executed in subshell after initialization
370
- # Variable substitutions:
371
- # `{{ branch }}` β€” The name of the opened branch, e.g. `feature/auth`
372
- # `{{ repo_path }}` β€” The absolute path to main repo, e.g. `/path/to/repo`
373
- # `{{ worktree_path }}` β€” The absolute path to worktree, e.g. `~/.workshell/worktrees/.../repo@feat`
404
+ # optional: override which gitignored files get copied (default: .env*, .npmrc*, .nvmrc, etc.)
405
+ copy = [".env*", ".secret*"]
406
+
407
+ # optional: setup script executed in subshell after initialization
408
+ # disables automatic package manager detection (see above)
409
+ # variable substitutions:
410
+ # `{{ branch }}` β€” name of opened branch, e.g. `feature/auth`
411
+ # `{{ repo_path }}` β€” absolute path to main repo, e.g. `/path/to/repo`
412
+ # `{{ worktree_path }}` β€” absolute path to worktree, e.g. `~/.workshell/worktrees/.../repo@feat`
374
413
  setup = "nvm use"
375
414
  ```
376
-
377
- Note: Setting `setup` disables automatic package manager detection. If you want both, include the install command in your setup script.