@gw-tools/gw 0.58.4 → 0.59.0-beta.64.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/README.md +89 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -33,6 +33,12 @@ A command-line tool for managing git worktrees, built with Deno.
|
|
|
33
33
|
- [Staged Files](#staged-files)
|
|
34
34
|
- [Auto-Copy Configuration](#auto-copy-configuration)
|
|
35
35
|
- [Hooks](#hooks)
|
|
36
|
+
- [Machine-Readable Progress](#machine-readable-progress)
|
|
37
|
+
- [Flag](#flag)
|
|
38
|
+
- [Schema](#schema)
|
|
39
|
+
- [Examples](#examples-progress)
|
|
40
|
+
- [Inspect with jq](#inspect-with-jq)
|
|
41
|
+
- [VS Code Extension](#vs-code-extension-progress)
|
|
36
42
|
- [cd](#cd)
|
|
37
43
|
- [Arguments](#arguments-1)
|
|
38
44
|
- [Examples](#examples-1)
|
|
@@ -618,6 +624,89 @@ gw checkout feat/new-feature
|
|
|
618
624
|
# 3. Runs pnpm install in the new worktree
|
|
619
625
|
```
|
|
620
626
|
|
|
627
|
+
### Machine-Readable Progress
|
|
628
|
+
|
|
629
|
+
When running `gw checkout` from a tooling integration (VS Code, CI scripts), you can stream structured progress events to stderr by passing `--progress=json`. Stdout is unaffected (remains clean for piping).
|
|
630
|
+
|
|
631
|
+
#### Flag
|
|
632
|
+
|
|
633
|
+
```
|
|
634
|
+
--progress=json Emit NDJSON progress events to stderr.
|
|
635
|
+
Intended for tooling integrations (VS Code, CI).
|
|
636
|
+
```
|
|
637
|
+
|
|
638
|
+
This is a **global flag** — it can be placed anywhere in the command:
|
|
639
|
+
|
|
640
|
+
```bash
|
|
641
|
+
gw checkout feat/my-branch --progress=json
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
#### Schema
|
|
645
|
+
|
|
646
|
+
Every event is a JSON object followed by a newline (`\n`). Schema version is always `1`.
|
|
647
|
+
|
|
648
|
+
```typescript
|
|
649
|
+
interface ProgressEvent {
|
|
650
|
+
version: 1; // always 1
|
|
651
|
+
stage: ProgressStage;
|
|
652
|
+
status: 'start' | 'end' | 'error';
|
|
653
|
+
hook?: number; // 1-based index (hook stages only)
|
|
654
|
+
of?: number; // total hook count (hook stages only)
|
|
655
|
+
command?: string; // expanded hook command (hook stages only)
|
|
656
|
+
durationMs?: number; // elapsed ms (end events only — absent on start)
|
|
657
|
+
message?: string; // error detail (error events only)
|
|
658
|
+
exitCode?: number; // process exit code (error events only)
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
type ProgressStage =
|
|
662
|
+
| 'pre-checkout-hooks'
|
|
663
|
+
| 'create-worktree'
|
|
664
|
+
| 'copy-files'
|
|
665
|
+
| 'copy-staged-files'
|
|
666
|
+
| 'post-checkout-hooks';
|
|
667
|
+
```
|
|
668
|
+
|
|
669
|
+
Note: `durationMs` is **absent** on `start` events (sparse JSON, not `null`). This keeps jq consumers clean.
|
|
670
|
+
|
|
671
|
+
#### Examples
|
|
672
|
+
|
|
673
|
+
```jsonc
|
|
674
|
+
// Stage boundaries:
|
|
675
|
+
{"version":1,"stage":"create-worktree","status":"start"}
|
|
676
|
+
{"version":1,"stage":"create-worktree","status":"end","durationMs":1842}
|
|
677
|
+
|
|
678
|
+
// Per-hook events:
|
|
679
|
+
{"version":1,"stage":"post-checkout-hooks","status":"start","hook":1,"of":1,"command":"pnpm install"}
|
|
680
|
+
{"version":1,"stage":"post-checkout-hooks","status":"end","hook":1,"of":1,"durationMs":47210}
|
|
681
|
+
|
|
682
|
+
// Error events (emitted before non-zero exit):
|
|
683
|
+
{"version":1,"stage":"create-worktree","status":"error","message":"git worktree add failed with exit code 128","exitCode":128}
|
|
684
|
+
{"version":1,"stage":"post-checkout-hooks","status":"error","hook":1,"of":1,"message":"Hook failed with exit code 1","exitCode":1}
|
|
685
|
+
```
|
|
686
|
+
|
|
687
|
+
#### Inspect with jq
|
|
688
|
+
|
|
689
|
+
```bash
|
|
690
|
+
# Print all events (redirect stderr to stdout, suppress stdout)
|
|
691
|
+
gw checkout feat/my-branch --progress=json 2>&1 1>/dev/null | jq .
|
|
692
|
+
|
|
693
|
+
# Watch only stage names
|
|
694
|
+
gw checkout feat/my-branch --progress=json 2>&1 1>/dev/null | jq -r '"\(.status) \(.stage)"'
|
|
695
|
+
|
|
696
|
+
# Filter for errors
|
|
697
|
+
gw checkout feat/my-branch --progress=json 2>&1 1>/dev/null | jq 'select(.status == "error")'
|
|
698
|
+
```
|
|
699
|
+
|
|
700
|
+
#### VS Code Extension
|
|
701
|
+
|
|
702
|
+
The VS Code extension (`vscode-gw`) uses `--progress=json` automatically to update the progress notification subtitle during `gw checkout`. You will see labels like:
|
|
703
|
+
|
|
704
|
+
- `Creating worktree` — while git runs
|
|
705
|
+
- `Running post-checkout hook 1/1 — pnpm install` — while hooks execute
|
|
706
|
+
- `Copying config files` — while auto-copy files are copied
|
|
707
|
+
|
|
708
|
+
---
|
|
709
|
+
|
|
621
710
|
### cd
|
|
622
711
|
|
|
623
712
|
Navigate directly to a worktree by name or partial match. The command uses smart matching to find worktrees, searching both branch names and worktree paths.
|