wendkeep 0.75.2 → 0.76.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 +27 -0
- package/README.en.md +6 -0
- package/README.md +6 -0
- package/docs/en/commands/getting-started.md +3 -1
- package/docs/en/commands/maintenance-and-diagnostics.md +3 -0
- package/docs/en/commands/worktrees.md +93 -0
- package/docs/pt-BR/commands/getting-started.md +3 -1
- package/docs/pt-BR/commands/maintenance-and-diagnostics.md +2 -0
- package/docs/pt-BR/commands/worktrees.md +91 -0
- package/hooks/flow-protected-policy.mjs +1 -1
- package/package.json +2 -1
- package/packages/cli/src/index.mjs +15 -3
- package/packages/integrations/src/host-hooks.mjs +6 -0
- package/packages/vault/src/index.mjs +1 -0
- package/packages/vault/src/project-vault.mjs +25 -2
- package/packages/vault/src/worktree-metadata.mjs +274 -0
- package/src/doctor.mjs +8 -0
- package/src/init.mjs +46 -10
- package/src/sync.mjs +4 -1
- package/src/taxonomy.mjs +2 -0
- package/src/worktree.mjs +708 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,33 @@ 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.76.0] — 2026-08-21
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **Worktrees gerenciadas e seguras.** `worktree create/list/status/open` cria linked worktrees
|
|
12
|
+
idempotentes sob `.worktrees`, com branch `wk/<slug>`, validação de path/ref e abertura opcional
|
|
13
|
+
em nova janela do VS Code. O registry privado no Git common-dir compartilha identidade e Vault
|
|
14
|
+
canônico sem alterar `.wendkeep.json`, usa lock multiprocesso e registra falhas recuperáveis.
|
|
15
|
+
- **Integração operacional.** `doctor` reconcilia registry/Git, `init` e `sync` aceitam
|
|
16
|
+
`--vscode-worktree-tasks` sem sobrescrever preferências locais, e ignores/walkers excluem a raiz
|
|
17
|
+
gerenciada. Saídas humanas são bilíngues e `--json` preserva o boundary do Vault.
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- **Gate staged sem falsos positivos.** O scanner reconhece códigos públicos `WENDKEEP_*`, limita
|
|
22
|
+
a allowlist de diagnósticos às superfícies de observabilidade e mantém bloqueio de identificadores
|
|
23
|
+
opacos; fixtures do worktree manager usam exclusivamente o namespace sintético `wk-fixture-*`.
|
|
24
|
+
|
|
25
|
+
## [0.75.3] — 2026-08-20
|
|
26
|
+
|
|
27
|
+
### Fixed
|
|
28
|
+
|
|
29
|
+
- **Sync seguro no self-checkout.** O instalador agora reconhece o repositório do próprio
|
|
30
|
+
WendKeep e migra hooks Claude/Codex para `node ./bin/wendkeep.mjs` sem duplicá-los. Projetos
|
|
31
|
+
consumidores continuam usando `npx --no-install`, e executar `sync` no checkout de
|
|
32
|
+
desenvolvimento não reintroduz a autodependência publicada.
|
|
33
|
+
|
|
7
34
|
## [0.75.2] — 2026-08-20
|
|
8
35
|
|
|
9
36
|
### Fixed
|
package/README.en.md
CHANGED
|
@@ -146,6 +146,7 @@ npx wendkeep init --no-companions --no-mcp --yes # zero companions,
|
|
|
146
146
|
| `--no-companions` | Pin no companions. |
|
|
147
147
|
| `--no-mcp` | Skip **wendkeep's own** vault MCP (`wendkeep-vault`). Companion MCPs still follow `--companions`. |
|
|
148
148
|
| `--no-colors` | Skip the Obsidian color system (`.obsidian` snippet + graph groups). |
|
|
149
|
+
| `--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`. |
|
|
149
150
|
| `--yes`, `-y` | Non-interactive; accept defaults (skips the language / vault / companion prompts). |
|
|
150
151
|
| `--force` | Overwrite existing wendkeep config blocks. |
|
|
151
152
|
|
|
@@ -180,6 +181,10 @@ later stages. An invalid `.wendkeep.json` stops at `init` without falling back t
|
|
|
180
181
|
The install stays outside `sync` on purpose: a running process cannot replace itself and
|
|
181
182
|
keep going — the code in memory would still be the old one.
|
|
182
183
|
|
|
184
|
+
In WendKeep's own development checkout, do not install `wendkeep` in `devDependencies`. Use
|
|
185
|
+
`node ./bin/wendkeep.mjs sync --project . --yes`: the installer recognizes the self-checkout and
|
|
186
|
+
keeps hooks on the working tree without duplicating consumer `npx` commands.
|
|
187
|
+
|
|
183
188
|
In a **pnpm** monorepo the install command differs (`npm` in a pnpm repo fails with
|
|
184
189
|
`Cannot read properties of null (reading 'matches')`). Resolve the published version first and
|
|
185
190
|
reuse exactly the value returned:
|
|
@@ -233,6 +238,7 @@ The README is the map; the guides provide syntax, options, exit codes, examples,
|
|
|
233
238
|
| Group | Use it for | Detailed guide |
|
|
234
239
|
|---|---|---|
|
|
235
240
|
| **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) |
|
|
241
|
+
| **Managed worktrees** | `worktree create/list/status/open`, Vault binding, and recovery | [Managed worktrees](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/worktrees.md) |
|
|
236
242
|
| **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) |
|
|
237
243
|
| **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) |
|
|
238
244
|
| **Shared memory** | CORE, SHARED, status, validation, repair, and curation | [Memory](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/memory.md) |
|
package/README.md
CHANGED
|
@@ -146,6 +146,7 @@ npx wendkeep init --no-companions --no-mcp --yes # zero companions,
|
|
|
146
146
|
| `--no-companions` | Pin no companions. |
|
|
147
147
|
| `--no-mcp` | Skip **wendkeep's own** vault MCP (`wendkeep-vault`). Companion MCPs still follow `--companions`. |
|
|
148
148
|
| `--no-colors` | Skip the Obsidian color system (`.obsidian` snippet + graph groups). |
|
|
149
|
+
| `--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`. |
|
|
149
150
|
| `--yes`, `-y` | Non-interactive; accept defaults (skips the language / vault / companion prompts). |
|
|
150
151
|
| `--force` | Overwrite existing wendkeep config blocks. |
|
|
151
152
|
|
|
@@ -180,6 +181,10 @@ later stages. An invalid `.wendkeep.json` stops at `init` without falling back t
|
|
|
180
181
|
The install stays outside `sync` on purpose: a running process cannot replace itself and
|
|
181
182
|
keep going — the code in memory would still be the old one.
|
|
182
183
|
|
|
184
|
+
In WendKeep's own development checkout, do not install `wendkeep` in `devDependencies`. Use
|
|
185
|
+
`node ./bin/wendkeep.mjs sync --project . --yes`: the installer recognizes the self-checkout and
|
|
186
|
+
keeps hooks on the working tree without duplicating consumer `npx` commands.
|
|
187
|
+
|
|
183
188
|
In a **pnpm** monorepo the install command differs (`npm` in a pnpm repo fails with
|
|
184
189
|
`Cannot read properties of null (reading 'matches')`). Resolve the published version first and
|
|
185
190
|
reuse exactly the value returned:
|
|
@@ -233,6 +238,7 @@ The README is the map; the guides provide syntax, options, exit codes, examples,
|
|
|
233
238
|
| Group | Use it for | Detailed guide |
|
|
234
239
|
|---|---|---|
|
|
235
240
|
| **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) |
|
|
241
|
+
| **Managed worktrees** | `worktree create/list/status/open`, Vault binding, and recovery | [Managed worktrees](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/worktrees.md) |
|
|
236
242
|
| **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) |
|
|
237
243
|
| **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) |
|
|
238
244
|
| **Shared memory** | CORE, SHARED, status, validation, repair, and curation | [Memory](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/memory.md) |
|
|
@@ -27,7 +27,7 @@ Do not run `init --force` as a generic repair for memory or unreadable configura
|
|
|
27
27
|
```bash
|
|
28
28
|
npm install --save-dev wendkeep
|
|
29
29
|
npx wendkeep init [options]
|
|
30
|
-
npx wendkeep sync [--project <root>] [--vault <vault>] [--profile <profile>] [--yes]
|
|
30
|
+
npx wendkeep sync [--project <root>] [--vault <vault>] [--profile <profile>] [--yes] [--vscode-worktree-tasks]
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
## Options and exit codes
|
|
@@ -37,6 +37,8 @@ npx wendkeep sync [--project <root>] [--vault <vault>] [--profile <profile>] [--
|
|
|
37
37
|
- `--profile <OFF|FLOW|GUIDE|GOVERN|ASSURE>` selects the Operating Profile; new installs use
|
|
38
38
|
`GOVERN`, re-init/sync without the flag preserves the existing choice, and `OFF` is never inferred.
|
|
39
39
|
- `--no-mcp`, `--no-colors`, and `--no-companions` disable optional integrations.
|
|
40
|
+
- `--vscode-worktree-tasks` creates local VS Code tasks without overwriting `tasks.json`; `sync`
|
|
41
|
+
forwards the same flag to its `init` stage.
|
|
40
42
|
- `--companions <csv>` explicitly enables companion integrations.
|
|
41
43
|
- `--yes` accepts non-interactive defaults; `--force` refreshes managed blocks only.
|
|
42
44
|
- Exit `0` means setup/sync completed. Any other exit identifies the failed stage. `sync` stops at
|
|
@@ -37,6 +37,9 @@ npx --no-install wendkeep --help
|
|
|
37
37
|
also fails on workflow attention, repairable debt, semantic degradation, and warnings.
|
|
38
38
|
- `--scope core` checks the installation, binding, ledger, and Keep Core only. `--scope runtime`
|
|
39
39
|
checks changes, sensors, and governance only. The default `all` reports both surfaces.
|
|
40
|
+
- The `[worktrees]` section reconciles the private registry with Git and reports slugs in
|
|
41
|
+
`failed`, `missing`, or invalid-binding states. Under `--strict` this debt also fails; doctor
|
|
42
|
+
never performs the repair.
|
|
40
43
|
- `doctor` uses human-readable output with `[integrity]` and `[memory]` sections, friendly
|
|
41
44
|
categories, and a copyable next action. The `vault-health.mjs` hook remains the JSON surface for
|
|
42
45
|
automation; neither surface applies curation.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Managed worktrees
|
|
2
|
+
|
|
3
|
+
**English** · [Português](../../pt-BR/commands/worktrees.md)
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
Create isolated linked worktrees that remain bound to the same project and canonical Vault,
|
|
8
|
+
without copying private state into versioned files.
|
|
9
|
+
|
|
10
|
+
## When to use
|
|
11
|
+
|
|
12
|
+
Use it to start isolated implementation work, list managed checkouts, diagnose a partial create,
|
|
13
|
+
or open an already-ready worktree in VS Code.
|
|
14
|
+
|
|
15
|
+
## When not to use
|
|
16
|
+
|
|
17
|
+
Do not use it to remove, merge, or self-merge worktrees. Those operations remain outside this
|
|
18
|
+
capability.
|
|
19
|
+
|
|
20
|
+
## Prerequisites
|
|
21
|
+
|
|
22
|
+
- A Git repository whose project is already bound to its Vault through `.wendkeep.json`.
|
|
23
|
+
- Git on `PATH`; opening also requires the VS Code `code` command.
|
|
24
|
+
|
|
25
|
+
## Syntax
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npx --no-install wendkeep worktree create <slug> [--base <ref>] [--branch <name>] [--open vscode|none] [--json]
|
|
29
|
+
npx --no-install wendkeep worktree list [--json]
|
|
30
|
+
npx --no-install wendkeep worktree status [<slug>] [--json]
|
|
31
|
+
npx --no-install wendkeep worktree open <slug> [--editor vscode] [--json]
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
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
|
+
non-empty relative path. Git validates slugs and branches; paths escaping the root or crossing a
|
|
37
|
+
symlink/junction are rejected before mutation.
|
|
38
|
+
|
|
39
|
+
## Options and exit codes
|
|
40
|
+
|
|
41
|
+
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 and the canonical binding;
|
|
43
|
+
`.wendkeep.json` stays unchanged. `.worktrees/` is added to both the versioned ignore and the
|
|
44
|
+
repository-private exclude. JSON `list`/`status` output exposes neither Vault paths nor contents.
|
|
45
|
+
For each worktree, human output shows its slug, identity, checkout path, branch, HEAD, state, and
|
|
46
|
+
binding health.
|
|
47
|
+
|
|
48
|
+
`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 the `recovery` field.
|
|
50
|
+
`doctor` also reports this debt under `[worktrees]` without repairing it.
|
|
51
|
+
|
|
52
|
+
## VS Code and exit codes
|
|
53
|
+
|
|
54
|
+
`--open vscode` and `worktree open` validate `code --version`, then open a new window with
|
|
55
|
+
`code -n`. Use `init --vscode-worktree-tasks` or `sync --vscode-worktree-tasks` to create local
|
|
56
|
+
tasks; an existing or tracked `.vscode/tasks.json`, even when deleted in the checkout, is never
|
|
57
|
+
overwritten.
|
|
58
|
+
|
|
59
|
+
Exit `0` means success. Usage, binding, safety, Git, or editor failures return `2` with a stable
|
|
60
|
+
`WENDKEEP_WORKTREE_*` code. The command never removes or merges a worktree.
|
|
61
|
+
|
|
62
|
+
## Examples
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
npx --no-install wendkeep worktree create auth --open vscode
|
|
66
|
+
npx --no-install wendkeep worktree status auth --json
|
|
67
|
+
npx --no-install wendkeep worktree list
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Expected result
|
|
71
|
+
|
|
72
|
+
`create auth` produces `.worktrees/auth` on branch `wk/auth`; the main and linked worktrees resolve
|
|
73
|
+
the same `projectId` and Vault, while the main checkout remains clean.
|
|
74
|
+
|
|
75
|
+
## Common errors and diagnosis
|
|
76
|
+
|
|
77
|
+
- `WENDKEEP_WORKTREE_SLUG_INVALID`, `WENDKEEP_WORKTREE_BRANCH_INVALID`, or
|
|
78
|
+
`WENDKEEP_WORKTREE_ROOT_INVALID`: correct the input before retrying; no reservation is created.
|
|
79
|
+
- `WENDKEEP_WORKTREE_PATH_OUTSIDE_ROOT` or `WENDKEEP_WORKTREE_PATH_SYMLINK_ESCAPE`: use a relative
|
|
80
|
+
root contained in the main worktree, without an intermediate symlink/junction.
|
|
81
|
+
- `WENDKEEP_WORKTREE_COLLISION`: the slug, path, or branch represents different state; run `status`.
|
|
82
|
+
- `WENDKEEP_WORKTREE_GIT_FAILED` or `WENDKEEP_WORKTREE_BASE_UNRESOLVED`: repair the Git state and
|
|
83
|
+
retry the command shown in `recovery`.
|
|
84
|
+
- `WENDKEEP_WORKTREE_REGISTRY_*`, `WENDKEEP_WORKTREE_*_MISMATCH`, or `WENDKEEP_VAULT_*` errors:
|
|
85
|
+
preserve the artifacts and use `doctor` to diagnose the registry/binding.
|
|
86
|
+
- `WENDKEEP_WORKTREE_EDITOR_NOT_FOUND` or `WENDKEEP_WORKTREE_EDITOR_OPEN_FAILED`: make `code`
|
|
87
|
+
available on PATH or use `--open none`.
|
|
88
|
+
- `failed`/`missing` state: read `recovery` from `status --json` and doctor's `[worktrees]` section.
|
|
89
|
+
|
|
90
|
+
## Next steps
|
|
91
|
+
|
|
92
|
+
See [installation and first use](getting-started.md) for local VS Code tasks and
|
|
93
|
+
[maintenance and diagnostics](maintenance-and-diagnostics.md) for doctor.
|
|
@@ -27,7 +27,7 @@ Não rode `init --force` para tentar reparar memória ou uma configuração ileg
|
|
|
27
27
|
```bash
|
|
28
28
|
npm install --save-dev wendkeep
|
|
29
29
|
npx wendkeep init [opções]
|
|
30
|
-
npx wendkeep sync [--project <raiz>] [--vault <cofre>] [--profile <perfil>] [--yes]
|
|
30
|
+
npx wendkeep sync [--project <raiz>] [--vault <cofre>] [--profile <perfil>] [--yes] [--vscode-worktree-tasks]
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
## Opções e códigos de saída
|
|
@@ -37,6 +37,8 @@ npx wendkeep sync [--project <raiz>] [--vault <cofre>] [--profile <perfil>] [--y
|
|
|
37
37
|
- `--profile <OFF|FLOW|GUIDE|GOVERN|ASSURE>` seleciona o Perfil de Operação; instalação nova usa
|
|
38
38
|
`GOVERN`, re-init/sync sem a flag preserva a escolha existente e `OFF` nunca é inferido.
|
|
39
39
|
- `--no-mcp`, `--no-colors` e `--no-companions` desativam integrações opcionais.
|
|
40
|
+
- `--vscode-worktree-tasks` cria tarefas locais do VS Code sem sobrescrever `tasks.json`; `sync`
|
|
41
|
+
repassa a mesma flag ao seu estágio `init`.
|
|
40
42
|
- `--companions <csv>` habilita companions explicitamente.
|
|
41
43
|
- `--yes` aceita defaults não interativos; `--force` atualiza apenas blocos gerenciados.
|
|
42
44
|
- Exit `0` indica instalação/sincronização concluída; exit diferente de zero identifica a etapa
|
|
@@ -37,6 +37,8 @@ npx --no-install wendkeep --help
|
|
|
37
37
|
atenção de workflow, dívida reparável e memória degradada apropriadas para gate de CI/release.
|
|
38
38
|
- `--scope core` verifica somente instalação, identidade, sessão e memória; `sync` usa esse escopo
|
|
39
39
|
e não falha por change ainda em andamento. `--scope runtime` isola harness/governança.
|
|
40
|
+
- O bloco `[worktrees]` reconcilia o registry privado com o Git e aponta slugs em `failed`,
|
|
41
|
+
`missing` ou com binding inválido. Em `--strict`, essa dívida também falha; o doctor não repara.
|
|
40
42
|
- O `doctor` usa saída em formato humano, com blocos `[integridade]` e `[memória]`, categorias
|
|
41
43
|
amigáveis e uma próxima ação copiável. O hook `vault-health.mjs` continua sendo a superfície JSON
|
|
42
44
|
para automações; nenhum dos dois aplica curadoria.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Worktrees gerenciadas
|
|
2
|
+
|
|
3
|
+
**PT-BR** · [English](../../en/commands/worktrees.md)
|
|
4
|
+
|
|
5
|
+
## Objetivo
|
|
6
|
+
|
|
7
|
+
Criar linked worktrees isoladas que continuam vinculadas ao mesmo projeto e Vault canônico,
|
|
8
|
+
sem copiar estado privado para arquivos versionados.
|
|
9
|
+
|
|
10
|
+
## Quando usar
|
|
11
|
+
|
|
12
|
+
Use ao iniciar uma implementação isolada, listar checkouts gerenciados, diagnosticar uma criação
|
|
13
|
+
parcial ou abrir uma worktree já pronta no VS Code.
|
|
14
|
+
|
|
15
|
+
## Quando não usar
|
|
16
|
+
|
|
17
|
+
Não use para remover, mesclar ou fazer self-merge de worktrees. Essas operações permanecem fora
|
|
18
|
+
desta capability.
|
|
19
|
+
|
|
20
|
+
## Pré-requisitos
|
|
21
|
+
|
|
22
|
+
- Repositório Git com o projeto já vinculado ao Vault por `.wendkeep.json`.
|
|
23
|
+
- Git disponível no `PATH`; para abertura, o comando `code` do VS Code também deve existir.
|
|
24
|
+
|
|
25
|
+
## Sintaxe
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npx --no-install wendkeep worktree create <slug> [--base <ref>] [--branch <nome>] [--open vscode|none] [--json]
|
|
29
|
+
npx --no-install wendkeep worktree list [--json]
|
|
30
|
+
npx --no-install wendkeep worktree status [<slug>] [--json]
|
|
31
|
+
npx --no-install wendkeep worktree open <slug> [--editor vscode] [--json]
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
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
|
+
path relativo não vazio. Slug e branch são validados pelo Git; paths que escapam da raiz ou
|
|
37
|
+
atravessam symlink/junction são rejeitados antes da mutação.
|
|
38
|
+
|
|
39
|
+
## Opções e códigos de saída
|
|
40
|
+
|
|
41
|
+
O registry fica no Git common-dir, em `wendkeep/worktrees-v1.json`, sob lock multiprocesso. Ele
|
|
42
|
+
guarda identidade do repositório/worktree e o binding canônico; `.wendkeep.json` permanece
|
|
43
|
+
inalterado. `.worktrees/` entra no ignore versionado e no exclude privado do repositório. A saída
|
|
44
|
+
JSON de `list`/`status` não expõe path nem conteúdo do Vault. A saída humana apresenta, por
|
|
45
|
+
worktree, slug, identidade, path do checkout, branch, HEAD, estado e saúde do binding.
|
|
46
|
+
|
|
47
|
+
`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 o campo
|
|
49
|
+
`recovery`. `doctor` também lista dívida em `[worktrees]` sem repará-la.
|
|
50
|
+
|
|
51
|
+
## VS Code e códigos de saída
|
|
52
|
+
|
|
53
|
+
`--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, mesmo removido no checkout, nunca é sobrescrito.
|
|
56
|
+
|
|
57
|
+
Exit `0` indica sucesso. Erro de uso, binding, segurança, Git ou editor retorna `2` com código
|
|
58
|
+
estável `WENDKEEP_WORKTREE_*`. O comando nunca remove ou mescla uma worktree.
|
|
59
|
+
|
|
60
|
+
## Exemplos
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
npx --no-install wendkeep worktree create auth --open vscode
|
|
64
|
+
npx --no-install wendkeep worktree status auth --json
|
|
65
|
+
npx --no-install wendkeep worktree list
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Resultado esperado
|
|
69
|
+
|
|
70
|
+
`create auth` produz `.worktrees/auth` na branch `wk/auth`; main e linked worktree resolvem o
|
|
71
|
+
mesmo `projectId` e Vault, e o checkout principal permanece limpo.
|
|
72
|
+
|
|
73
|
+
## Erros comuns e diagnóstico
|
|
74
|
+
|
|
75
|
+
- `WENDKEEP_WORKTREE_SLUG_INVALID`, `WENDKEEP_WORKTREE_BRANCH_INVALID` ou
|
|
76
|
+
`WENDKEEP_WORKTREE_ROOT_INVALID`: corrija a entrada antes de repetir; nenhuma reserva é criada.
|
|
77
|
+
- `WENDKEEP_WORKTREE_PATH_OUTSIDE_ROOT` ou `WENDKEEP_WORKTREE_PATH_SYMLINK_ESCAPE`: use uma raiz
|
|
78
|
+
relativa contida no main worktree, sem symlink/junction intermediário.
|
|
79
|
+
- `WENDKEEP_WORKTREE_COLLISION`: slug, path ou branch já representa outro estado; rode `status`.
|
|
80
|
+
- `WENDKEEP_WORKTREE_GIT_FAILED` ou `WENDKEEP_WORKTREE_BASE_UNRESOLVED`: corrija o estado Git e
|
|
81
|
+
repita o comando indicado em `recovery`.
|
|
82
|
+
- Erros `WENDKEEP_WORKTREE_REGISTRY_*`, `WENDKEEP_WORKTREE_*_MISMATCH` ou
|
|
83
|
+
`WENDKEEP_VAULT_*`: preserve os artefatos e use `doctor` para diagnosticar registry/binding.
|
|
84
|
+
- `WENDKEEP_WORKTREE_EDITOR_NOT_FOUND` ou `WENDKEEP_WORKTREE_EDITOR_OPEN_FAILED`: disponibilize
|
|
85
|
+
`code` no PATH ou use `--open none`.
|
|
86
|
+
- Estado `failed`/`missing`: leia `recovery` em `status --json` e o bloco `[worktrees]` do `doctor`.
|
|
87
|
+
|
|
88
|
+
## Próximos passos
|
|
89
|
+
|
|
90
|
+
Veja [instalação e primeiro uso](getting-started.md) para tarefas locais do VS Code e
|
|
91
|
+
[manutenção e diagnóstico](maintenance-and-diagnostics.md) para o doctor.
|
|
@@ -27,7 +27,7 @@ export const FLOW_PROTECTED_SCAN_POLICY = Object.freeze({
|
|
|
27
27
|
maxDepth: 64,
|
|
28
28
|
maxEntries: 100_000,
|
|
29
29
|
excludedDirectoryNames: Object.freeze([
|
|
30
|
-
'.git', 'node_modules', '.pnpm-store', '.yarn', '.venv', 'venv',
|
|
30
|
+
'.git', '.worktrees', 'node_modules', '.pnpm-store', '.yarn', '.venv', 'venv',
|
|
31
31
|
'__pycache__', '.pytest_cache', '.mypy_cache', '.ruff_cache', '.tox', '.nox',
|
|
32
32
|
]),
|
|
33
33
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wendkeep",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.76.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,6 +41,7 @@
|
|
|
41
41
|
"node": ">=18"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
|
+
"precheck": "node --check src/worktree.mjs && node --check packages/vault/src/worktree-metadata.mjs",
|
|
44
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/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/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",
|
|
45
46
|
"test": "node --test --test-concurrency=2",
|
|
46
47
|
"test:core": "node scripts/run-scope.mjs core",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// wendkeep CLI — canonical private runtime.
|
|
2
|
-
// wendkeep init [--vault <path>] [--project <path>] [--no-mcp] [--yes] [--force]
|
|
2
|
+
// wendkeep init [--vault <path>] [--project <path>] [--no-mcp] [--yes] [--force] [--vscode-worktree-tasks]
|
|
3
3
|
// wendkeep hook <name> (invoked by the agent's settings.json; pipes stdin/stdout)
|
|
4
4
|
// wendkeep doctor [--vault <path>]
|
|
5
5
|
// wendkeep --version | --help
|
|
@@ -33,6 +33,7 @@ Usage:
|
|
|
33
33
|
(default: none — opt in explicitly). dotcontext is legacy — the native a2 loop replaces it.
|
|
34
34
|
--no-companions Skip companion plugins/MCP entirely.
|
|
35
35
|
--no-colors Skip the Obsidian color system (.obsidian snippet + graph groups).
|
|
36
|
+
--vscode-worktree-tasks Create local, Git-excluded VS Code tasks for managed worktrees.
|
|
36
37
|
--dotcontext-mcp <v> dotcontext MCP placement: auto (default; skip project entry
|
|
37
38
|
if already global), project, or none.
|
|
38
39
|
--dotcontext-hooks <v> dotcontext hooks: full (default), light (no PostToolUse), none.
|
|
@@ -46,10 +47,16 @@ Usage:
|
|
|
46
47
|
command — the three steps that repeat identically after every
|
|
47
48
|
package update. Stops at the first failing step. Install the
|
|
48
49
|
package first (npm i -D wendkeep@latest); a running process
|
|
49
|
-
cannot replace itself. · --vault P · --profile <name> · --yes
|
|
50
|
+
cannot replace itself. · --vault P · --profile <name> · --yes
|
|
51
|
+
· --vscode-worktree-tasks.
|
|
50
52
|
|
|
51
53
|
wendkeep doctor [--vault P] Health check. --scope core|runtime · --strict for CI/release.
|
|
52
54
|
wendkeep observer <sub> Local multi-project Observer: serve | register | publish | reconcile | status.
|
|
55
|
+
wendkeep worktree create <slug> [--base ref] [--branch name] [--open vscode|none] [--json]
|
|
56
|
+
wendkeep worktree list [--json]
|
|
57
|
+
wendkeep worktree status [slug] [--json]
|
|
58
|
+
wendkeep worktree open <slug> [--editor vscode] [--json]
|
|
59
|
+
Managed linked worktrees under .worktrees (branch default wk/<slug>).
|
|
53
60
|
wendkeep change <sub> Change lifecycle: new [--simple|--guide] | use | bind <slug> --session <id> | continue | list | show |
|
|
54
61
|
status | done <id> | undone <id> | diff | archive [--force] | abandon | relink | backlink.
|
|
55
62
|
archive exige verdict (rode verify --deep); abandon descarta sem ADR.
|
|
@@ -206,7 +213,7 @@ async function main(argv) {
|
|
|
206
213
|
// `sync` starts with `init` and resolves the freshly bound Vault itself. Pre-resolving
|
|
207
214
|
// here would prevent that repair step from reporting a corrupt binding as its own
|
|
208
215
|
// first-stage failure (and could never make it as far as the guarded init).
|
|
209
|
-
&& !['init', 'sync', 'hook', 'observer', '--version', '-v', '--help', '-h', 'help'].includes(cmd)) {
|
|
216
|
+
&& !['init', 'sync', 'worktree', 'hook', 'observer', '--version', '-v', '--help', '-h', 'help'].includes(cmd)) {
|
|
210
217
|
await preferProjectVault(rest);
|
|
211
218
|
}
|
|
212
219
|
switch (cmd) {
|
|
@@ -229,6 +236,11 @@ async function main(argv) {
|
|
|
229
236
|
if (rest[0] !== 'serve') process.exit(observerExitCode);
|
|
230
237
|
break;
|
|
231
238
|
}
|
|
239
|
+
case 'worktree': {
|
|
240
|
+
const { runWorktree } = await import('../../../src/worktree.mjs');
|
|
241
|
+
process.exit(runWorktree(rest));
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
232
244
|
case 'sync': {
|
|
233
245
|
const { runSync } = await import('../../../src/sync.mjs');
|
|
234
246
|
process.exit(await runSync(rest));
|
|
@@ -36,6 +36,12 @@ export function hookCommand(name) {
|
|
|
36
36
|
return `npx --no-install wendkeep hook ${name}`;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
// O checkout do próprio WendKeep não depende do pacote publicado. Seus hooks versionados
|
|
40
|
+
// executam o binário do working tree para que sync/dogfood não recrie a autodependência.
|
|
41
|
+
export function hookCommandWorkingTree(name) {
|
|
42
|
+
return `node ./bin/wendkeep.mjs hook ${name}`;
|
|
43
|
+
}
|
|
44
|
+
|
|
39
45
|
// Forma node-direta do comando de hook: 1 processo (~100-250ms) em vez dos 3 do npx (cold-start
|
|
40
46
|
// de segundos no Windows). Usada pelos hooks de ALTA FREQUÊNCIA (por prompt / por tool-call)
|
|
41
47
|
// quando o projeto tem wendkeep instalado localmente; o init decide (hookCommandFor).
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
writeFileSync,
|
|
10
10
|
} from 'node:fs';
|
|
11
11
|
import { basename, dirname, isAbsolute, join, parse, relative, resolve } from 'node:path';
|
|
12
|
+
import { resolveWorktreeVaultBinding } from './worktree-metadata.mjs';
|
|
12
13
|
|
|
13
14
|
export const PROJECT_CONFIG_FILE = '.wendkeep.json';
|
|
14
15
|
export const PROJECT_MARKER_REL = '.brain/PROJECT.json';
|
|
@@ -203,7 +204,7 @@ export function resolveProjectVault({
|
|
|
203
204
|
bindingFailure = error;
|
|
204
205
|
}
|
|
205
206
|
if (binding) {
|
|
206
|
-
|
|
207
|
+
let result = {
|
|
207
208
|
base: binding.base,
|
|
208
209
|
source: 'project-config',
|
|
209
210
|
projectRoot: binding.projectRoot,
|
|
@@ -211,7 +212,29 @@ export function resolveProjectVault({
|
|
|
211
212
|
configPath: binding.configPath,
|
|
212
213
|
config: binding.config,
|
|
213
214
|
};
|
|
214
|
-
if (validateIdentity)
|
|
215
|
+
if (validateIdentity) {
|
|
216
|
+
try {
|
|
217
|
+
validateMarker(result);
|
|
218
|
+
} catch (error) {
|
|
219
|
+
const canUsePrivateBinding = error?.code === 'WENDKEEP_VAULT_MARKER_MISSING'
|
|
220
|
+
&& !isAbsolute(binding.config.vault);
|
|
221
|
+
if (!canUsePrivateBinding) throw error;
|
|
222
|
+
const privateBinding = resolveWorktreeVaultBinding({
|
|
223
|
+
startDir: start,
|
|
224
|
+
projectId: binding.config.projectId,
|
|
225
|
+
});
|
|
226
|
+
if (!privateBinding) throw error;
|
|
227
|
+
result = {
|
|
228
|
+
...result,
|
|
229
|
+
base: privateBinding.base,
|
|
230
|
+
source: 'worktree-registry',
|
|
231
|
+
projectRoot: privateBinding.projectRoot,
|
|
232
|
+
repositoryId: privateBinding.repositoryId,
|
|
233
|
+
registryPath: privateBinding.registryPath,
|
|
234
|
+
};
|
|
235
|
+
validateMarker(result);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
215
238
|
return result;
|
|
216
239
|
}
|
|
217
240
|
|