@gw-tools/gw 0.63.0-beta.73.3 → 0.64.0-beta.75.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 +62 -118
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,7 +25,6 @@ A command-line tool for managing git worktrees, built with Deno.
|
|
|
25
25
|
- [Auto-Detection](#auto-detection)
|
|
26
26
|
- [Example Configuration](#example-configuration)
|
|
27
27
|
- [Configuration Options](#configuration-options)
|
|
28
|
-
- [Telemetry (OpenTelemetry & Dash0)](#telemetry-opentelemetry--dash0)
|
|
29
28
|
- [Commands](#commands)
|
|
30
29
|
- [checkout](#checkout)
|
|
31
30
|
- [Arguments](#arguments)
|
|
@@ -81,6 +80,10 @@ A command-line tool for managing git worktrees, built with Deno.
|
|
|
81
80
|
- [Options](#options-7)
|
|
82
81
|
- [Examples](#examples-8)
|
|
83
82
|
- [How It Works](#how-it-works-4)
|
|
83
|
+
- [protect](#protect)
|
|
84
|
+
- [Examples](#examples-protect)
|
|
85
|
+
- [unprotect](#unprotect)
|
|
86
|
+
- [Examples](#examples-unprotect)
|
|
84
87
|
- [Git Worktree Proxy Commands](#git-worktree-proxy-commands)
|
|
85
88
|
- [list (ls)](#list-ls)
|
|
86
89
|
- [remove (rm)](#remove-rm)
|
|
@@ -386,7 +389,7 @@ All fields are optional and safe to commit — no machine-specific paths or runt
|
|
|
386
389
|
- **cleanThreshold**: Number of days before worktrees are considered stale for `gw clean` (defaults to 7, set via `gw init --clean-threshold`)
|
|
387
390
|
- **autoClean**: Silently remove stale worktrees in the background when running `gw checkout` or `gw list` (defaults to false, set via `gw init --auto-clean`)
|
|
388
391
|
- **updateStrategy**: Default strategy for `gw update` command: "merge" or "rebase" (defaults to "merge", set via `gw init --update-strategy`)
|
|
389
|
-
- **
|
|
392
|
+
- **protectedBranches**: Array of branch names protected from `gw clean` and auto-clean (managed with `gw protect` / `gw unprotect`)
|
|
390
393
|
|
|
391
394
|
### Local Overrides (`config.local.json`)
|
|
392
395
|
|
|
@@ -401,118 +404,6 @@ Create `.gw/config.local.json` to override any config value for your machine onl
|
|
|
401
404
|
|
|
402
405
|
Local config is merged on top of `config.json` (shallow merge, local wins). Useful for adding personal files to `autoCopyFiles` without modifying the team config.
|
|
403
406
|
|
|
404
|
-
## Telemetry (OpenTelemetry & Dash0)
|
|
405
|
-
|
|
406
|
-
`gw` can send anonymous usage data to the maintainer's
|
|
407
|
-
[Dash0](https://www.dash0.com/) instance so aggregate usage can be observed and
|
|
408
|
-
releases correlated with error spikes. Telemetry is **opt-in and disabled by
|
|
409
|
-
default** — nothing leaves your machine until you explicitly enable it.
|
|
410
|
-
|
|
411
|
-
### Opting in and out
|
|
412
|
-
|
|
413
|
-
```bash
|
|
414
|
-
gw telemetry on # enable on this machine
|
|
415
|
-
gw telemetry off # disable on this machine
|
|
416
|
-
gw telemetry status # show current effective state
|
|
417
|
-
```
|
|
418
|
-
|
|
419
|
-
`gw telemetry on/off` writes to `.gw/config.local.json`, which is gitignored,
|
|
420
|
-
so your choice stays local and never affects other people who clone the repo.
|
|
421
|
-
|
|
422
|
-
You can also use the env var `GW_TELEMETRY=1` to enable or `GW_TELEMETRY=0` to
|
|
423
|
-
disable for a single session without touching any config file.
|
|
424
|
-
|
|
425
|
-
`gw init` writes a `"telemetry": { "enabled": false }` block into your
|
|
426
|
-
`.gw/config.json` so the option is easy to discover. Note that `enabled` in the
|
|
427
|
-
committed `config.json` has no effect — opt-in is per-machine only (use
|
|
428
|
-
`gw telemetry on` or `GW_TELEMETRY=1`).
|
|
429
|
-
|
|
430
|
-
### What gets sent
|
|
431
|
-
|
|
432
|
-
When enabled, each command emits **one span** and **one log record** via
|
|
433
|
-
OTLP/HTTP to the maintainer's Dash0 instance:
|
|
434
|
-
|
|
435
|
-
- **Span attributes:** `gw.command`, `gw.command.exit_code`,
|
|
436
|
-
`gw.command.duration_ms`, `service.version`
|
|
437
|
-
- **Log level:** `INFO` on success, `ERROR` on failure (with a redacted
|
|
438
|
-
`error.message`)
|
|
439
|
-
- **Resource attributes:** `service.name`, `service.version`,
|
|
440
|
-
`deployment.environment.name` (if configured)
|
|
441
|
-
|
|
442
|
-
**What is NOT sent:** branch names, repository paths, file names, user identity,
|
|
443
|
-
or any personally identifiable information. Error messages are client-side
|
|
444
|
-
redacted before transmission — absolute paths, git refs, long hex SHAs, and
|
|
445
|
-
`KEY=value` patterns are replaced with `<path>`, `<ref>`, `<sha>`, and
|
|
446
|
-
`KEY=<redacted>` respectively.
|
|
447
|
-
|
|
448
|
-
> **Fail-open design:** any export error is silently swallowed and never slows
|
|
449
|
-
> down or breaks a command. Nothing is ever written to stdout (so shell-eval
|
|
450
|
-
> commands like `gw cd` stay safe).
|
|
451
|
-
|
|
452
|
-
### Privacy and the threat model
|
|
453
|
-
|
|
454
|
-
The compiled `gw` binary bundles the maintainer's Dash0 ingest endpoint and a
|
|
455
|
-
scoped ingest token. This is the same approach used by Sentry DSNs, Vercel CLI
|
|
456
|
-
analytics, and Deno's own telemetry. The token is scoped to the `gw-cli`
|
|
457
|
-
dataset and subject to ingest quotas — it cannot read back data or access other
|
|
458
|
-
Dash0 resources. Anyone who disassembles the binary could extract the token, but
|
|
459
|
-
the worst-case impact is noise in a single dataset, not a data breach.
|
|
460
|
-
|
|
461
|
-
To completely opt out: `gw telemetry off` (or `GW_TELEMETRY=0`). The telemetry
|
|
462
|
-
code path is never entered when disabled.
|
|
463
|
-
|
|
464
|
-
### Routing to your own backend
|
|
465
|
-
|
|
466
|
-
Power users can override the maintainer's endpoint and route telemetry to their
|
|
467
|
-
own OTel backend instead. The precedence is: \*\*env vars > `.gw/config.local.json`
|
|
468
|
-
|
|
469
|
-
> committed `.gw/config.json` > build defaults\*\*.
|
|
470
|
-
|
|
471
|
-
```bash
|
|
472
|
-
# Route to a local Collector
|
|
473
|
-
export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4318"
|
|
474
|
-
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer <token>,Dash0-Dataset=my-dataset"
|
|
475
|
-
gw telemetry on
|
|
476
|
-
```
|
|
477
|
-
|
|
478
|
-
Or in `.gw/config.local.json` (gitignored):
|
|
479
|
-
|
|
480
|
-
```jsonc
|
|
481
|
-
{
|
|
482
|
-
"telemetry": {
|
|
483
|
-
"enabled": true,
|
|
484
|
-
"endpoint": "http://localhost:4318",
|
|
485
|
-
"headers": { "Authorization": "Bearer <token>", "Dash0-Dataset": "my-dataset" },
|
|
486
|
-
},
|
|
487
|
-
}
|
|
488
|
-
```
|
|
489
|
-
|
|
490
|
-
**Note:** `telemetry.enabled` in the committed `.gw/config.json` has no effect.
|
|
491
|
-
Opt-in is per-machine only (local config or env var). This prevents repo
|
|
492
|
-
maintainers from silently enrolling everyone who clones the repo.
|
|
493
|
-
|
|
494
|
-
### Configuration reference
|
|
495
|
-
|
|
496
|
-
| Setting | `config.local.json` key | Env override | Default |
|
|
497
|
-
| ------------- | ----------------------- | ----------------------------- | ----------------- |
|
|
498
|
-
| Enable | `telemetry.enabled` | `GW_TELEMETRY` (`1`/`0`) | `false` |
|
|
499
|
-
| Endpoint | `telemetry.endpoint` | `OTEL_EXPORTER_OTLP_ENDPOINT` | _(build default)_ |
|
|
500
|
-
| Environment | `telemetry.environment` | `OTEL_RESOURCE_ATTRIBUTES` | _(unset)_ |
|
|
501
|
-
| Service name | `telemetry.serviceName` | `OTEL_SERVICE_NAME` | `gw` |
|
|
502
|
-
| Headers | `telemetry.headers` | `OTEL_EXPORTER_OTLP_HEADERS` | _(build default)_ |
|
|
503
|
-
| Flush timeout | `telemetry.timeoutMs` | — | `1500` |
|
|
504
|
-
|
|
505
|
-
`OTEL_SDK_DISABLED=true` is honoured as a hard kill switch regardless of other
|
|
506
|
-
settings. Set `GW_TELEMETRY_DEBUG=1` to log export problems to stderr.
|
|
507
|
-
|
|
508
|
-
### Correlating deployments with errors
|
|
509
|
-
|
|
510
|
-
The release pipeline (`scripts/release-ci.sh`) sends a `deployment.success`
|
|
511
|
-
event to Dash0 after each publish, tagged with `service.version` and the git
|
|
512
|
-
commit SHA. Because runtime error signals carry the same `service.version`,
|
|
513
|
-
Dash0 can display a deployment marker on the error timeline and compare error
|
|
514
|
-
rates before and after each release.
|
|
515
|
-
|
|
516
407
|
## Commands
|
|
517
408
|
|
|
518
409
|
### checkout
|
|
@@ -1594,7 +1485,7 @@ These commands wrap native `git worktree` operations, providing consistent color
|
|
|
1594
1485
|
|
|
1595
1486
|
#### list (ls)
|
|
1596
1487
|
|
|
1597
|
-
List all worktrees in the repository.
|
|
1488
|
+
List all worktrees in the repository. Protected branches (the default branch, `main`, `master`, `gw_root`, and any branches marked with `gw protect`) are annotated with a `[protected]` tag.
|
|
1598
1489
|
|
|
1599
1490
|
```bash
|
|
1600
1491
|
gw list
|
|
@@ -1605,11 +1496,13 @@ gw ls
|
|
|
1605
1496
|
**Examples:**
|
|
1606
1497
|
|
|
1607
1498
|
```bash
|
|
1608
|
-
gw list # List all worktrees
|
|
1609
|
-
gw list --porcelain # Machine-readable output
|
|
1610
|
-
gw list -v # Verbose output
|
|
1499
|
+
gw list # List all worktrees (with [protected] annotations)
|
|
1500
|
+
gw list --porcelain # Machine-readable output (raw git proxy, no annotation)
|
|
1501
|
+
gw list -v # Verbose output (raw git proxy, no annotation)
|
|
1611
1502
|
```
|
|
1612
1503
|
|
|
1504
|
+
> **Note:** `--porcelain`, `-z`, `--verbose`, and `-v` fall back to the raw `git worktree list` proxy so machine-readable and scripting use cases are never broken.
|
|
1505
|
+
|
|
1613
1506
|
#### remove (rm)
|
|
1614
1507
|
|
|
1615
1508
|
Remove a worktree from the repository. By default, also deletes the local branch to prevent orphaned branches.
|
|
@@ -1750,6 +1643,57 @@ gw prune --stale-only # Only clean git metadata (like git worktree prune)
|
|
|
1750
1643
|
| Runs `git worktree prune` | No | No | Yes |
|
|
1751
1644
|
| Use case | Clean up finished work | Regular maintenance | Full cleanup |
|
|
1752
1645
|
|
|
1646
|
+
### protect
|
|
1647
|
+
|
|
1648
|
+
Mark a branch as protected, preventing it from being removed by `gw clean` (both interactive and auto modes) and auto-clean.
|
|
1649
|
+
|
|
1650
|
+
```bash
|
|
1651
|
+
gw protect [branch]
|
|
1652
|
+
```
|
|
1653
|
+
|
|
1654
|
+
If no branch is given, the current branch is auto-detected from the working directory.
|
|
1655
|
+
|
|
1656
|
+
The protected branch list is stored in `protectedBranches` inside `.gw/config.json` and is safe to commit to your repository.
|
|
1657
|
+
|
|
1658
|
+
> **Note:** The `defaultBranch`, `main`, `master`, and `gw_root` are always system-protected regardless of this setting. Use `gw protect` only for additional branches you want to keep around long-term (e.g. `staging`, `release/*`).
|
|
1659
|
+
|
|
1660
|
+
<a name="examples-protect"></a>
|
|
1661
|
+
|
|
1662
|
+
**Examples:**
|
|
1663
|
+
|
|
1664
|
+
```bash
|
|
1665
|
+
# Protect the current branch
|
|
1666
|
+
gw protect
|
|
1667
|
+
|
|
1668
|
+
# Protect a specific branch
|
|
1669
|
+
gw protect staging
|
|
1670
|
+
|
|
1671
|
+
# Protect a release branch
|
|
1672
|
+
gw protect release/v2
|
|
1673
|
+
```
|
|
1674
|
+
|
|
1675
|
+
### unprotect
|
|
1676
|
+
|
|
1677
|
+
Remove a branch from the `protectedBranches` list, allowing `gw clean` and auto-clean to remove it again.
|
|
1678
|
+
|
|
1679
|
+
```bash
|
|
1680
|
+
gw unprotect [branch]
|
|
1681
|
+
```
|
|
1682
|
+
|
|
1683
|
+
If no branch is given, the current branch is auto-detected from the working directory.
|
|
1684
|
+
|
|
1685
|
+
<a name="examples-unprotect"></a>
|
|
1686
|
+
|
|
1687
|
+
**Examples:**
|
|
1688
|
+
|
|
1689
|
+
```bash
|
|
1690
|
+
# Unprotect the current branch
|
|
1691
|
+
gw unprotect
|
|
1692
|
+
|
|
1693
|
+
# Unprotect a specific branch
|
|
1694
|
+
gw unprotect staging
|
|
1695
|
+
```
|
|
1696
|
+
|
|
1753
1697
|
#### lock
|
|
1754
1698
|
|
|
1755
1699
|
Lock a worktree to prevent removal.
|