wendkeep 0.76.9 → 0.77.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.
- package/CHANGELOG.md +16 -0
- package/README.en.md +2 -2
- package/README.md +2 -2
- package/docs/en/commands/worktrees.md +80 -32
- package/docs/pt-BR/commands/worktrees.md +80 -31
- package/package.json +2 -2
- package/packages/cli/src/index.mjs +1 -1
- package/src/worktree-cleanup.mjs +712 -0
- package/src/worktree.mjs +130 -19
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,22 @@ All notable changes to **wendkeep** are documented here. Format based on
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/); this project follows
|
|
5
5
|
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [0.77.0] — 2026-08-22
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **Fechamento comprovado de worktrees.** `worktree finish <slug> --pr <ref>` valida no GitHub que o
|
|
12
|
+
PR foi merged, cruza branch e merge commit com a base local, executa preflight de checkout,
|
|
13
|
+
sessões, delivery, outbox e handoff, e fecha somente o active context da worktree alvo.
|
|
14
|
+
- **Cleanup auditável e retomável.** Reservas sob lock, remoção do ref local por CAS e receipts JSONL
|
|
15
|
+
append-only tornam o fechamento idempotente e retomável depois de crash; `doctor` diagnostica
|
|
16
|
+
estado interrompido, failed ou receipt inconsistente com recovery objetivo.
|
|
17
|
+
- **Comandos destrutivos explícitos.** `worktree cleanup --merged` e `worktree prune` são dry-run por
|
|
18
|
+
padrão e exigem `--apply`; `worktree remove --reason` preserva branch não merged. Exclusão remota
|
|
19
|
+
continua proibida sem `--delete-remote` e falha fechado quando a branch diverge.
|
|
20
|
+
- **Paridade operacional.** README e guia de worktrees PT-BR/EN documentam flags, blockers,
|
|
21
|
+
PowerShell/POSIX e recovery; a task local do VS Code oferece `WendKeep: Finish merged worktree`.
|
|
22
|
+
|
|
7
23
|
## [0.76.9] — 2026-08-22
|
|
8
24
|
|
|
9
25
|
### Fixed
|
package/README.en.md
CHANGED
|
@@ -147,7 +147,7 @@ npx wendkeep init --no-companions --no-mcp --yes # zero companions,
|
|
|
147
147
|
| `--no-companions` | Pin no companions. |
|
|
148
148
|
| `--no-mcp` | Skip **wendkeep's own** vault MCP (`wendkeep-vault`). Companion MCPs still follow `--companions`. |
|
|
149
149
|
| `--no-colors` | Skip the Obsidian color system (`.obsidian` snippet + graph groups). |
|
|
150
|
-
| `--vscode-worktree-tasks` | Create a local, Git-excluded `.vscode/tasks.json` for creating/listing/opening worktrees; never overwrites an existing file. Also accepted by `sync`. |
|
|
150
|
+
| `--vscode-worktree-tasks` | Create a local, Git-excluded `.vscode/tasks.json` for creating/listing/opening/finishing worktrees; never overwrites an existing file. Also accepted by `sync`. |
|
|
151
151
|
| `--yes`, `-y` | Non-interactive; accept defaults (skips the language / vault / companion prompts). |
|
|
152
152
|
| `--force` | Overwrite existing wendkeep config blocks. |
|
|
153
153
|
|
|
@@ -239,7 +239,7 @@ The README is the map; the guides provide syntax, options, exit codes, examples,
|
|
|
239
239
|
| Group | Use it for | Detailed guide |
|
|
240
240
|
|---|---|---|
|
|
241
241
|
| **Installation and updates** | `init`, `sync`, companions, and the first project↔vault binding | [Installation and first use](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/getting-started.md) |
|
|
242
|
-
| **Managed worktrees** | `worktree create/list/status/open`,
|
|
242
|
+
| **Managed worktrees** | `worktree create/list/status/open/finish/cleanup/remove/prune`, merge proof, preflight, and receipts | [Managed worktrees](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/worktrees.md) |
|
|
243
243
|
| **Active context** | `active_contexts` by `repository_id`/`worktree_id`/`work_session_id`, causal transition, quarantine, and explicit recovery | [Active context](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/context.md) |
|
|
244
244
|
| **Operating profiles** | `profile`, `flow`, always-on Keep Core, and Wend Runtime governance | [Operating profiles](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/operating-profiles.md) |
|
|
245
245
|
| **Changes and verification** | `change`, specs, sensors, TDD, evidence, and archive | [Changes and verification](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/changes-and-verification.md) |
|
package/README.md
CHANGED
|
@@ -147,7 +147,7 @@ npx wendkeep init --no-companions --no-mcp --yes # zero companions,
|
|
|
147
147
|
| `--no-companions` | Pin no companions. |
|
|
148
148
|
| `--no-mcp` | Skip **wendkeep's own** vault MCP (`wendkeep-vault`). Companion MCPs still follow `--companions`. |
|
|
149
149
|
| `--no-colors` | Skip the Obsidian color system (`.obsidian` snippet + graph groups). |
|
|
150
|
-
| `--vscode-worktree-tasks` | Create a local, Git-excluded `.vscode/tasks.json` for creating/listing/opening worktrees; never overwrites an existing file. Also accepted by `sync`. |
|
|
150
|
+
| `--vscode-worktree-tasks` | Create a local, Git-excluded `.vscode/tasks.json` for creating/listing/opening/finishing worktrees; never overwrites an existing file. Also accepted by `sync`. |
|
|
151
151
|
| `--yes`, `-y` | Non-interactive; accept defaults (skips the language / vault / companion prompts). |
|
|
152
152
|
| `--force` | Overwrite existing wendkeep config blocks. |
|
|
153
153
|
|
|
@@ -239,7 +239,7 @@ The README is the map; the guides provide syntax, options, exit codes, examples,
|
|
|
239
239
|
| Group | Use it for | Detailed guide |
|
|
240
240
|
|---|---|---|
|
|
241
241
|
| **Installation and updates** | `init`, `sync`, companions, and the first project↔vault binding | [Installation and first use](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/getting-started.md) |
|
|
242
|
-
| **Managed worktrees** | `worktree create/list/status/open`,
|
|
242
|
+
| **Managed worktrees** | `worktree create/list/status/open/finish/cleanup/remove/prune`, merge proof, preflight, and receipts | [Managed worktrees](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/worktrees.md) |
|
|
243
243
|
| **Active context** | `active_contexts` by `repository_id`/`worktree_id`/`work_session_id`, causal transition, quarantine, and explicit recovery | [Active context](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/context.md) |
|
|
244
244
|
| **Operating profiles** | `profile`, `flow`, always-on Keep Core, and Wend Runtime governance | [Operating profiles](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/operating-profiles.md) |
|
|
245
245
|
| **Changes and verification** | `change`, specs, sensors, TDD, evidence, and archive | [Changes and verification](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/changes-and-verification.md) |
|
|
@@ -4,23 +4,24 @@
|
|
|
4
4
|
|
|
5
5
|
## Purpose
|
|
6
6
|
|
|
7
|
-
Create isolated linked worktrees that remain bound to the same project and canonical
|
|
8
|
-
without copying private state into versioned files.
|
|
7
|
+
Create and finish isolated linked worktrees that remain bound to the same project and canonical
|
|
8
|
+
Vault, without copying private state into versioned files or discarding local work.
|
|
9
9
|
|
|
10
10
|
## When to use
|
|
11
11
|
|
|
12
|
-
Use it to start isolated implementation work, list managed checkouts, diagnose a partial
|
|
13
|
-
|
|
12
|
+
Use it to start isolated implementation work, list managed checkouts, diagnose a partial operation,
|
|
13
|
+
open a worktree in VS Code, or clean it up after a provably merged PR.
|
|
14
14
|
|
|
15
15
|
## When not to use
|
|
16
16
|
|
|
17
|
-
Do not use it to
|
|
18
|
-
|
|
17
|
+
Do not use it to merge the PR, discard a dirty/untracked checkout, or delete a remote branch without
|
|
18
|
+
explicit authorization. `finish` consumes an existing merge; it does not self-merge.
|
|
19
19
|
|
|
20
20
|
## Prerequisites
|
|
21
21
|
|
|
22
22
|
- A Git repository whose project is already bound to its Vault through `.wendkeep.json`.
|
|
23
|
-
- Git on `PATH`;
|
|
23
|
+
- Git on `PATH`; `finish` also requires authenticated `gh` access to query GitHub.
|
|
24
|
+
- Opening also requires the VS Code `code` command.
|
|
24
25
|
|
|
25
26
|
## Syntax
|
|
26
27
|
|
|
@@ -29,48 +30,88 @@ npx --no-install wendkeep worktree create <slug> [--base <ref>] [--branch <name>
|
|
|
29
30
|
npx --no-install wendkeep worktree list [--json]
|
|
30
31
|
npx --no-install wendkeep worktree status [<slug>] [--json]
|
|
31
32
|
npx --no-install wendkeep worktree open <slug> [--editor vscode] [--json]
|
|
33
|
+
npx --no-install wendkeep worktree finish <slug> [--pr <number|url>] [--delete-remote] [--open-main] [--json]
|
|
34
|
+
npx --no-install wendkeep worktree cleanup --merged [--dry-run|--apply] [--json]
|
|
35
|
+
npx --no-install wendkeep worktree remove <slug> --reason <text> [--json]
|
|
36
|
+
npx --no-install wendkeep worktree prune [--dry-run|--apply] [--json]
|
|
32
37
|
```
|
|
33
38
|
|
|
34
39
|
All commands accept `--project <root>`. By default, create uses `.worktrees/<slug>`, the detected
|
|
35
|
-
base, and branch `wk/<slug>`. When configured, `worktrees.root` must be a
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
base, and branch `wk/<slug>`. When configured, `worktrees.root` must be a non-empty relative path.
|
|
41
|
+
Git validates slugs and branches; paths escaping the root or crossing a symlink/junction are rejected
|
|
42
|
+
before mutation.
|
|
43
|
+
|
|
44
|
+
## Safe finish
|
|
45
|
+
|
|
46
|
+
When `origin` exists, `finish` runs `git fetch --prune`, queries the PR through the GitHub adapter,
|
|
47
|
+
and requires `MERGED`, a matching branch, and a merge commit reachable from the local base. The
|
|
48
|
+
number/URL is associated with the registry. Before removal, preflight fails closed on dirty or
|
|
49
|
+
untracked files, an active session, active delivery, memory outbox, or pending handoff.
|
|
50
|
+
|
|
51
|
+
After reserving under lock, the command removes the linked worktree, closes only its active
|
|
52
|
+
contexts, prunes, deletes the local ref with CAS, and appends a JSONL receipt in the Git common-dir.
|
|
53
|
+
This accepts merge commits, squash, and rebase without `git branch -D`. Re-running the same proof is
|
|
54
|
+
idempotent; when the directory vanished between steps, the interrupted reservation resumes.
|
|
55
|
+
`doctor` reports interrupted/failed cleanup with an objective recovery command.
|
|
56
|
+
|
|
57
|
+
`--delete-remote` is the only authorization to delete the remote branch. The branch must remain at
|
|
58
|
+
the proven head; divergence or an unavailable network blocks the operation. An already-absent branch
|
|
59
|
+
is idempotent success. `--open-main` opens the main worktree only after completion.
|
|
60
|
+
|
|
61
|
+
## Cleanup, remove, and prune
|
|
62
|
+
|
|
63
|
+
`cleanup --merged` and `prune` are dry-run by default. `--dry-run` makes that intent explicit; only
|
|
64
|
+
`--apply` permits mutation. Plans are slug-sorted and do not change Git, registry, contexts, or
|
|
65
|
+
receipts. `cleanup --merged` acts only on entries with an associated PR whose merge is revalidated.
|
|
66
|
+
`remove --reason` is the auditable escape hatch for explicit abandonment: it waives merge proof but
|
|
67
|
+
keeps every preflight and preserves both local and remote branches.
|
|
38
68
|
|
|
39
69
|
## Options and exit codes
|
|
40
70
|
|
|
41
71
|
The registry lives in the Git common-dir at `wendkeep/worktrees-v1.json`, protected by a
|
|
42
|
-
multi-process lock. It stores repository/worktree identity
|
|
43
|
-
`.wendkeep.json` stays unchanged.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
72
|
+
multi-process lock. It stores repository/worktree identity, canonical binding, PR, and transient
|
|
73
|
+
cleanup state; `.wendkeep.json` stays unchanged. Receipts live at
|
|
74
|
+
`wendkeep/worktree-cleanup-receipts-v1.jsonl`. `.worktrees/` is added to both the versioned ignore
|
|
75
|
+
and the repository-private exclude. JSON `list`/`status` output exposes neither Vault paths nor
|
|
76
|
+
contents.
|
|
47
77
|
|
|
48
78
|
`create` is idempotent when slug, path, and branch already match. Collisions fail closed. Failures
|
|
49
|
-
after reservation remain `failed`; run `worktree status <slug>` and follow
|
|
50
|
-
|
|
79
|
+
after reservation remain `failed`; run `worktree status <slug>` and follow `recovery`. `doctor`
|
|
80
|
+
also reports create or cleanup debt under `[worktrees]` without repairing it.
|
|
51
81
|
|
|
52
|
-
## VS Code
|
|
82
|
+
## VS Code
|
|
53
83
|
|
|
54
|
-
`--open vscode` and `worktree open` validate `code --version`, then open a new window with
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
overwritten.
|
|
84
|
+
`--open vscode` and `worktree open` validate `code --version`, then open a new window with `code -n`.
|
|
85
|
+
Use `init --vscode-worktree-tasks` or `sync --vscode-worktree-tasks` to create local tasks, including
|
|
86
|
+
**WendKeep: Finish merged worktree**; an existing or tracked `.vscode/tasks.json`, even when deleted
|
|
87
|
+
in the checkout, is never overwritten.
|
|
58
88
|
|
|
59
|
-
Exit `0` means success. Usage, binding, safety, Git, or editor failures return `2` with a
|
|
60
|
-
`WENDKEEP_WORKTREE_*` code.
|
|
89
|
+
Exit `0` means success. Usage, binding, safety, proof, Git, or editor failures return `2` with a
|
|
90
|
+
stable `WENDKEEP_WORKTREE_*` code. No command merges or uses force to discard a checkout.
|
|
61
91
|
|
|
62
92
|
## Examples
|
|
63
93
|
|
|
64
|
-
|
|
94
|
+
PowerShell:
|
|
95
|
+
|
|
96
|
+
```powershell
|
|
65
97
|
npx --no-install wendkeep worktree create auth --open vscode
|
|
66
|
-
npx --no-install wendkeep worktree
|
|
67
|
-
npx --no-install wendkeep worktree
|
|
98
|
+
npx --no-install wendkeep worktree finish auth --pr 72 --open-main
|
|
99
|
+
npx --no-install wendkeep worktree cleanup --merged --dry-run --json
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
POSIX:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
npx --no-install wendkeep worktree cleanup --merged --apply
|
|
106
|
+
npx --no-install wendkeep worktree remove spike --reason "PR cancelled"
|
|
107
|
+
npx --no-install wendkeep worktree prune --dry-run
|
|
68
108
|
```
|
|
69
109
|
|
|
70
110
|
## Expected result
|
|
71
111
|
|
|
72
|
-
`create auth` produces `.worktrees/auth` on branch `wk/auth
|
|
73
|
-
the
|
|
112
|
+
`create auth` produces `.worktrees/auth` on branch `wk/auth`. After a proven merge, `finish` removes
|
|
113
|
+
the checkout and local ref, closes only its active context, and preserves the Vault, sessions,
|
|
114
|
+
evidence, and receipt.
|
|
74
115
|
|
|
75
116
|
## Common errors and diagnosis
|
|
76
117
|
|
|
@@ -79,13 +120,20 @@ the same `projectId` and Vault, while the main checkout remains clean.
|
|
|
79
120
|
- `WENDKEEP_WORKTREE_PATH_OUTSIDE_ROOT` or `WENDKEEP_WORKTREE_PATH_SYMLINK_ESCAPE`: use a relative
|
|
80
121
|
root contained in the main worktree, without an intermediate symlink/junction.
|
|
81
122
|
- `WENDKEEP_WORKTREE_COLLISION`: the slug, path, or branch represents different state; run `status`.
|
|
82
|
-
- `
|
|
83
|
-
|
|
123
|
+
- `WENDKEEP_WORKTREE_PR_INVALID`, `WENDKEEP_WORKTREE_PR_NOT_MERGED`,
|
|
124
|
+
`WENDKEEP_WORKTREE_PR_MISMATCH`, or `WENDKEEP_WORKTREE_PR_MERGE_UNREACHABLE`: correct/associate
|
|
125
|
+
the PR, update the local base, and retry without manually removing the worktree.
|
|
126
|
+
- `WENDKEEP_WORKTREE_DIRTY`, `WENDKEEP_WORKTREE_ACTIVE_SESSION`,
|
|
127
|
+
`WENDKEEP_WORKTREE_ACTIVE_DELIVERY`, `WENDKEEP_WORKTREE_OUTBOX_PENDING`, or
|
|
128
|
+
`WENDKEEP_WORKTREE_HANDOFF_PENDING`: complete the recovery named by the blocker.
|
|
129
|
+
- `WENDKEEP_WORKTREE_CLEANUP_BUSY`: another operation owns the reservation; if the directory is
|
|
130
|
+
already gone, retry the same command/proof to resume. Use `doctor` for failed/incomplete state.
|
|
131
|
+
- `WENDKEEP_WORKTREE_REMOTE_UNAVAILABLE` or `WENDKEEP_WORKTREE_REMOTE_DIVERGED`: the local branch is
|
|
132
|
+
preserved; recover the network or review the divergence before authorizing again.
|
|
84
133
|
- `WENDKEEP_WORKTREE_REGISTRY_*`, `WENDKEEP_WORKTREE_*_MISMATCH`, or `WENDKEEP_VAULT_*` errors:
|
|
85
134
|
preserve the artifacts and use `doctor` to diagnose the registry/binding.
|
|
86
135
|
- `WENDKEEP_WORKTREE_EDITOR_NOT_FOUND` or `WENDKEEP_WORKTREE_EDITOR_OPEN_FAILED`: make `code`
|
|
87
136
|
available on PATH or use `--open none`.
|
|
88
|
-
- `failed`/`missing` state: read `recovery` from `status --json` and doctor's `[worktrees]` section.
|
|
89
137
|
|
|
90
138
|
## Next steps
|
|
91
139
|
|
|
@@ -4,23 +4,24 @@
|
|
|
4
4
|
|
|
5
5
|
## Objetivo
|
|
6
6
|
|
|
7
|
-
Criar linked worktrees isoladas que continuam vinculadas ao mesmo projeto e Vault
|
|
8
|
-
sem copiar estado privado para arquivos versionados.
|
|
7
|
+
Criar e encerrar linked worktrees isoladas que continuam vinculadas ao mesmo projeto e Vault
|
|
8
|
+
canônico, sem copiar estado privado para arquivos versionados nem descartar trabalho local.
|
|
9
9
|
|
|
10
10
|
## Quando usar
|
|
11
11
|
|
|
12
|
-
Use ao iniciar uma implementação isolada, listar checkouts gerenciados, diagnosticar uma
|
|
13
|
-
parcial
|
|
12
|
+
Use ao iniciar uma implementação isolada, listar checkouts gerenciados, diagnosticar uma operação
|
|
13
|
+
parcial, abrir uma worktree no VS Code ou limpá-la depois de um PR comprovadamente merged.
|
|
14
14
|
|
|
15
15
|
## Quando não usar
|
|
16
16
|
|
|
17
|
-
Não use para
|
|
18
|
-
|
|
17
|
+
Não use para fazer merge do PR, descartar checkout dirty/untracked nem remover branch remota sem
|
|
18
|
+
autorização explícita. `finish` consome um merge já concluído; não faz self-merge.
|
|
19
19
|
|
|
20
20
|
## Pré-requisitos
|
|
21
21
|
|
|
22
22
|
- Repositório Git com o projeto já vinculado ao Vault por `.wendkeep.json`.
|
|
23
|
-
- Git disponível no `PATH`;
|
|
23
|
+
- Git disponível no `PATH`; `finish` também requer `gh` autenticado para consultar o GitHub.
|
|
24
|
+
- Para abertura, o comando `code` do VS Code deve existir.
|
|
24
25
|
|
|
25
26
|
## Sintaxe
|
|
26
27
|
|
|
@@ -29,46 +30,87 @@ npx --no-install wendkeep worktree create <slug> [--base <ref>] [--branch <nome>
|
|
|
29
30
|
npx --no-install wendkeep worktree list [--json]
|
|
30
31
|
npx --no-install wendkeep worktree status [<slug>] [--json]
|
|
31
32
|
npx --no-install wendkeep worktree open <slug> [--editor vscode] [--json]
|
|
33
|
+
npx --no-install wendkeep worktree finish <slug> [--pr <número|url>] [--delete-remote] [--open-main] [--json]
|
|
34
|
+
npx --no-install wendkeep worktree cleanup --merged [--dry-run|--apply] [--json]
|
|
35
|
+
npx --no-install wendkeep worktree remove <slug> --reason <texto> [--json]
|
|
36
|
+
npx --no-install wendkeep worktree prune [--dry-run|--apply] [--json]
|
|
32
37
|
```
|
|
33
38
|
|
|
34
39
|
Todas aceitam `--project <raiz>`. O padrão cria `.worktrees/<slug>` a partir da base detectada e
|
|
35
|
-
usa a branch `wk/<slug>`. `worktrees.root`, quando configurado, deve ser um
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
usa a branch `wk/<slug>`. `worktrees.root`, quando configurado, deve ser um path relativo não vazio.
|
|
41
|
+
Slug e branch são validados pelo Git; paths que escapam da raiz ou atravessam symlink/junction são
|
|
42
|
+
rejeitados antes da mutação.
|
|
43
|
+
|
|
44
|
+
## Fechamento seguro
|
|
45
|
+
|
|
46
|
+
`finish` executa `git fetch --prune` quando existe `origin`, consulta o PR por adapter GitHub e
|
|
47
|
+
exige estado `MERGED`, branch coerente e merge commit alcançável pela base local. O número/URL fica
|
|
48
|
+
associado ao registry. Antes da remoção, o preflight falha fechado diante de checkout dirty ou
|
|
49
|
+
untracked, sessão ativa, delivery ativa, memory outbox ou handoff pendente.
|
|
50
|
+
|
|
51
|
+
Depois da reserva sob lock, o comando remove a linked worktree, fecha somente seus active contexts,
|
|
52
|
+
faz prune, apaga o ref local por CAS e grava receipt JSONL append-only no Git common-dir. Isso aceita
|
|
53
|
+
merge commit, squash e rebase sem usar `git branch -D`. Reexecução com a mesma prova é idempotente;
|
|
54
|
+
se a pasta sumiu entre etapas, a reserva interrompida é retomada. `doctor` mostra cleanup
|
|
55
|
+
interrompido/failed e uma recuperação objetiva.
|
|
56
|
+
|
|
57
|
+
`--delete-remote` é a única autorização para excluir a branch remota. A branch deve continuar no
|
|
58
|
+
head comprovado; divergência ou rede indisponível bloqueia. Branch já ausente é sucesso idempotente.
|
|
59
|
+
`--open-main` abre a worktree principal somente depois da conclusão.
|
|
60
|
+
|
|
61
|
+
## Cleanup, remove e prune
|
|
62
|
+
|
|
63
|
+
`cleanup --merged` e `prune` são dry-run por padrão. `--dry-run` apenas torna essa intenção
|
|
64
|
+
explícita; somente `--apply` permite mutação. O plano é ordenado por slug e não altera Git,
|
|
65
|
+
registry, contexts ou receipts. `cleanup --merged` atua apenas em entries com PR associado e merge
|
|
66
|
+
revalidado. `remove --reason` é a saída auditável para abandono explícito: dispensa prova de merge,
|
|
67
|
+
mas mantém todo o preflight e preserva as branches local e remota.
|
|
38
68
|
|
|
39
69
|
## Opções e códigos de saída
|
|
40
70
|
|
|
41
71
|
O registry fica no Git common-dir, em `wendkeep/worktrees-v1.json`, sob lock multiprocesso. Ele
|
|
42
|
-
guarda identidade do repositório/worktree e
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
72
|
+
guarda identidade do repositório/worktree, binding canônico, PR e estado transitório de cleanup;
|
|
73
|
+
`.wendkeep.json` permanece inalterado. Receipts ficam em
|
|
74
|
+
`wendkeep/worktree-cleanup-receipts-v1.jsonl`. `.worktrees/` entra no ignore versionado e no exclude
|
|
75
|
+
privado. A saída JSON de `list`/`status` não expõe path nem conteúdo do Vault.
|
|
46
76
|
|
|
47
77
|
`create` é idempotente quando slug, path e branch já correspondem. Colisões falham fechadas.
|
|
48
|
-
Falhas depois da reserva ficam como `failed`; rode `worktree status <slug>` e siga
|
|
49
|
-
`
|
|
78
|
+
Falhas depois da reserva ficam como `failed`; rode `worktree status <slug>` e siga `recovery`.
|
|
79
|
+
`doctor` também lista dívida de criação ou cleanup em `[worktrees]` sem repará-la.
|
|
50
80
|
|
|
51
|
-
## VS Code
|
|
81
|
+
## VS Code
|
|
52
82
|
|
|
53
83
|
`--open vscode` e `worktree open` validam `code --version` e abrem uma janela nova com `code -n`.
|
|
54
|
-
Use `init --vscode-worktree-tasks` ou `sync --vscode-worktree-tasks` para criar tarefas locais
|
|
55
|
-
um `.vscode/tasks.json` existente ou rastreado,
|
|
84
|
+
Use `init --vscode-worktree-tasks` ou `sync --vscode-worktree-tasks` para criar tarefas locais,
|
|
85
|
+
incluindo **WendKeep: Finish merged worktree**; um `.vscode/tasks.json` existente ou rastreado,
|
|
86
|
+
mesmo removido no checkout, nunca é sobrescrito.
|
|
56
87
|
|
|
57
|
-
Exit `0` indica sucesso. Erro de uso, binding, segurança, Git ou editor retorna `2` com código
|
|
58
|
-
estável `WENDKEEP_WORKTREE_*`.
|
|
88
|
+
Exit `0` indica sucesso. Erro de uso, binding, segurança, prova, Git ou editor retorna `2` com código
|
|
89
|
+
estável `WENDKEEP_WORKTREE_*`. Nenhum comando faz merge ou usa force para descartar checkout.
|
|
59
90
|
|
|
60
91
|
## Exemplos
|
|
61
92
|
|
|
62
|
-
|
|
93
|
+
PowerShell:
|
|
94
|
+
|
|
95
|
+
```powershell
|
|
63
96
|
npx --no-install wendkeep worktree create auth --open vscode
|
|
64
|
-
npx --no-install wendkeep worktree
|
|
65
|
-
npx --no-install wendkeep worktree
|
|
97
|
+
npx --no-install wendkeep worktree finish auth --pr 72 --open-main
|
|
98
|
+
npx --no-install wendkeep worktree cleanup --merged --dry-run --json
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
POSIX:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
npx --no-install wendkeep worktree cleanup --merged --apply
|
|
105
|
+
npx --no-install wendkeep worktree remove spike --reason "PR cancelado"
|
|
106
|
+
npx --no-install wendkeep worktree prune --dry-run
|
|
66
107
|
```
|
|
67
108
|
|
|
68
109
|
## Resultado esperado
|
|
69
110
|
|
|
70
|
-
`create auth` produz `.worktrees/auth` na branch `wk/auth
|
|
71
|
-
|
|
111
|
+
`create auth` produz `.worktrees/auth` na branch `wk/auth`. Depois do merge comprovado, `finish`
|
|
112
|
+
remove o checkout e o ref local, fecha apenas seu active context e preserva Vault, sessões,
|
|
113
|
+
evidências e receipt.
|
|
72
114
|
|
|
73
115
|
## Erros comuns e diagnóstico
|
|
74
116
|
|
|
@@ -77,13 +119,20 @@ mesmo `projectId` e Vault, e o checkout principal permanece limpo.
|
|
|
77
119
|
- `WENDKEEP_WORKTREE_PATH_OUTSIDE_ROOT` ou `WENDKEEP_WORKTREE_PATH_SYMLINK_ESCAPE`: use uma raiz
|
|
78
120
|
relativa contida no main worktree, sem symlink/junction intermediário.
|
|
79
121
|
- `WENDKEEP_WORKTREE_COLLISION`: slug, path ou branch já representa outro estado; rode `status`.
|
|
80
|
-
- `
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
122
|
+
- `WENDKEEP_WORKTREE_PR_INVALID`, `WENDKEEP_WORKTREE_PR_NOT_MERGED`,
|
|
123
|
+
`WENDKEEP_WORKTREE_PR_MISMATCH` ou `WENDKEEP_WORKTREE_PR_MERGE_UNREACHABLE`: corrija/associe o PR,
|
|
124
|
+
atualize a base local e repita sem remover a worktree manualmente.
|
|
125
|
+
- `WENDKEEP_WORKTREE_DIRTY`, `WENDKEEP_WORKTREE_ACTIVE_SESSION`,
|
|
126
|
+
`WENDKEEP_WORKTREE_ACTIVE_DELIVERY`, `WENDKEEP_WORKTREE_OUTBOX_PENDING` ou
|
|
127
|
+
`WENDKEEP_WORKTREE_HANDOFF_PENDING`: conclua a recuperação indicada pelo blocker.
|
|
128
|
+
- `WENDKEEP_WORKTREE_CLEANUP_BUSY`: outra operação ainda possui a reserva; se a pasta já sumiu,
|
|
129
|
+
repita o mesmo comando/prova para retomar. Use `doctor` para reservations failed/incompletas.
|
|
130
|
+
- `WENDKEEP_WORKTREE_REMOTE_UNAVAILABLE` ou `WENDKEEP_WORKTREE_REMOTE_DIVERGED`: a branch local é
|
|
131
|
+
preservada; recupere rede ou revise a divergência antes de autorizar novamente.
|
|
132
|
+
- Erros `WENDKEEP_WORKTREE_REGISTRY_*`, `WENDKEEP_WORKTREE_*_MISMATCH` ou `WENDKEEP_VAULT_*`:
|
|
133
|
+
preserve os artefatos e use `doctor` para diagnosticar registry/binding.
|
|
84
134
|
- `WENDKEEP_WORKTREE_EDITOR_NOT_FOUND` ou `WENDKEEP_WORKTREE_EDITOR_OPEN_FAILED`: disponibilize
|
|
85
135
|
`code` no PATH ou use `--open none`.
|
|
86
|
-
- Estado `failed`/`missing`: leia `recovery` em `status --json` e o bloco `[worktrees]` do `doctor`.
|
|
87
136
|
|
|
88
137
|
## Próximos passos
|
|
89
138
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wendkeep",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.77.0",
|
|
4
4
|
"description": "Vault-first persistent memory for AI coding agents, with an optional profile-aware governance runtime: OFF, FLOW, GUIDE, GOVERN, or ASSURE. Local-first and agent-agnostic (Claude Code, Codex, Cursor…).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"workspaces": [
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"node": ">=18"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
|
-
"precheck": "node --check src/worktree.mjs && node --check src/context.mjs && node --check src/active-context-health.mjs && node --check src/active-context-runtime.mjs && node --check hooks/active-context-store.mjs && node --check hooks/change-core.mjs && node --check hooks/brain-inject.mjs && node --check hooks/change-context.mjs && node --check packages/vault/src/worktree-metadata.mjs",
|
|
44
|
+
"precheck": "node --check src/worktree.mjs && node --check src/worktree-cleanup.mjs && node --check src/context.mjs && node --check src/active-context-health.mjs && node --check src/active-context-runtime.mjs && node --check hooks/active-context-store.mjs && node --check hooks/change-core.mjs && node --check hooks/brain-inject.mjs && node --check hooks/change-context.mjs && node --check packages/vault/src/worktree-metadata.mjs",
|
|
45
45
|
"check": "node --check scripts/release.mjs && node --check scripts/release-plan.mjs && node --check scripts/release-provenance.mjs && node --check scripts/run-scope.mjs && node --check src/release-provenance.mjs && node --check bin/wendkeep.mjs && node --check packages/cli/src/index.mjs && node --check src/init.mjs && node --check src/doctor.mjs && node --check src/active-context-health.mjs && node --check src/project-vault.mjs && node --check src/observer-auth.mjs && node --check src/observer-privacy.mjs && node --check src/observer-snapshot.mjs && node --check src/observer-store.mjs && node --check src/observer-memory.mjs && node --check src/observer-memory-publish.mjs && node --check src/observer-sql-store.mjs && node --check src/observer-sql-migrate.mjs && node --check src/observer-sql-publish.mjs && node --check src/observer-transcript-store.mjs && node --check src/observer-server.mjs && node --check src/observer.mjs && node --check src/observer-publish.mjs && node --check src/operating-profile.mjs && node --check src/profile.mjs && node --check src/flow.mjs && node --check src/work-kind.mjs && node --check src/delivery.mjs && node --check web/observer/app.mjs && node --check hooks/observer-publish.mjs && node --check hooks/evidence-context.mjs && node --check hooks/active-context-handoff-evidence.mjs && node --check hooks/evidence-recall.mjs && node --check hooks/memory-scope.mjs && node --check hooks/operating-profile-runtime.mjs && node --check hooks/operating-profile-task-store.mjs && node --check hooks/flow-core.mjs && node --check hooks/flow-protected-policy.mjs && node --check hooks/git-snapshot.mjs && node --check hooks/vault-path-safety.mjs && node --check hooks/vault-runtime-store.mjs && node --check packages/harness/src/index.mjs && node --check packages/harness/src/flow-store.mjs && node --check packages/harness/src/operating-profile.mjs && node --check packages/harness/src/sensors-core.mjs && node --check packages/integrations/src/host-hooks.mjs && node --check packages/integrations/src/hook-envelope.mjs && node --check packages/integrations/src/prompt-content.mjs && node --check packages/integrations/src/transcript-usage.mjs && node --check packages/integrations/src/transcripts.mjs && node --check packages/integrations/src/session-identity.mjs && node --check packages/integrations/src/index.mjs && node --check packages/mcp/src/config.mjs && node --check packages/mcp/src/index.mjs && node --check packages/vault/src/index.mjs && node --check packages/vault/src/project-vault.mjs && node --check packages/vault/src/vault-path-safety.mjs && node --check packages/vault/src/locale.mjs && node --check packages/vault/src/memory-schema.mjs && node --check packages/vault/src/memory-mode.mjs && node --check packages/vault/src/memory-scope.mjs && node --check packages/vault/src/memory-candidate-policy.mjs && node --check packages/vault/src/evidence-recall.mjs && node --check packages/vault/src/memory-handoff.mjs && node --check packages/vault/src/memory-store.mjs && node --check packages/vault/src/validate-core.mjs && node --check packages/vault/src/validate-memory.mjs",
|
|
46
46
|
"test": "node --test --test-concurrency=2",
|
|
47
47
|
"test:core": "node scripts/run-scope.mjs core",
|