wendkeep 0.76.9 → 0.78.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 +39 -0
- package/README.en.md +3 -3
- package/README.md +3 -3
- package/docs/en/commands/changes-and-verification.md +8 -1
- package/docs/en/commands/verify.md +22 -5
- package/docs/en/commands/worktrees.md +80 -32
- package/docs/pt-BR/commands/changes-and-verification.md +8 -1
- package/docs/pt-BR/commands/verify.md +22 -6
- package/docs/pt-BR/commands/worktrees.md +80 -31
- package/hooks/change-core.mjs +2 -1
- package/hooks/harness-doctor.mjs +51 -1
- package/hooks/spec-core.mjs +26 -8
- package/package.json +2 -2
- package/packages/cli/src/index.mjs +1 -1
- package/packages/harness/src/sensors-core.mjs +57 -3
- package/packages/vault/src/evidence-envelope.mjs +73 -0
- package/packages/vault/src/index.mjs +1 -0
- package/packages/vault/src/memory-handoff.mjs +46 -5
- package/packages/vault/src/vault-path-safety.mjs +11 -0
- package/schema/wendkeep.evidence-envelope-v2.schema.json +92 -0
- package/src/change.mjs +93 -10
- package/src/evidence-envelope.mjs +288 -0
- package/src/skills-seed.mjs +11 -5
- package/src/verify.mjs +85 -22
- package/src/worktree-cleanup.mjs +712 -0
- package/src/worktree.mjs +130 -19
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,45 @@ 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.78.0] — 2026-08-22
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **Evidence Envelope v2.** `verify` liga cada prova a projeto, repositório, worktree, work session,
|
|
12
|
+
branch, base/HEAD, árvore do índice e digest determinístico de staged/unstaged/untracked por
|
|
13
|
+
SHA-256 canônico; texto normaliza CRLF/CR para LF e binários preservam bytes.
|
|
14
|
+
- **Proveniência por sensor.** Cada resultado registra comando efetivo sanitizado e hash,
|
|
15
|
+
timestamps, duração, exit code, digest da saída e tail sanitizado limitado; alteração da
|
|
16
|
+
configuração invalida o binding anterior.
|
|
17
|
+
- **Diagnóstico causal.** `change status`, doctor, handoff e Observer distinguem evidência `bound`,
|
|
18
|
+
`stale`, `context-mismatch` e `legacy-unbound`; pacote deep e verdict carregam o mesmo
|
|
19
|
+
`evidenceEnvelopeId` e `evidenceBinding` completo e não podem ser reutilizados entre worktrees.
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- **Publicação fail-closed.** Mudança de HEAD durante os sensores preserva a evidência anterior e
|
|
24
|
+
retorna `WENDKEEP_EVIDENCE_HEAD_CHANGED`. Evidência, pacote, verdict trivial e seals são gravados
|
|
25
|
+
por temporário path-safe no mesmo diretório e rename atômico.
|
|
26
|
+
- **Compatibilidade explícita.** Evidência v1 continua legível para histórico, mas sensores v1 não
|
|
27
|
+
satisfazem autoridade v2 no archive. README, schema e guias PT-BR/EN documentam formato,
|
|
28
|
+
normalização, recovery e vínculo do passe independente.
|
|
29
|
+
|
|
30
|
+
## [0.77.0] — 2026-08-22
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
|
|
34
|
+
- **Fechamento comprovado de worktrees.** `worktree finish <slug> --pr <ref>` valida no GitHub que o
|
|
35
|
+
PR foi merged, cruza branch e merge commit com a base local, executa preflight de checkout,
|
|
36
|
+
sessões, delivery, outbox e handoff, e fecha somente o active context da worktree alvo.
|
|
37
|
+
- **Cleanup auditável e retomável.** Reservas sob lock, remoção do ref local por CAS e receipts JSONL
|
|
38
|
+
append-only tornam o fechamento idempotente e retomável depois de crash; `doctor` diagnostica
|
|
39
|
+
estado interrompido, failed ou receipt inconsistente com recovery objetivo.
|
|
40
|
+
- **Comandos destrutivos explícitos.** `worktree cleanup --merged` e `worktree prune` são dry-run por
|
|
41
|
+
padrão e exigem `--apply`; `worktree remove --reason` preserva branch não merged. Exclusão remota
|
|
42
|
+
continua proibida sem `--delete-remote` e falha fechado quando a branch diverge.
|
|
43
|
+
- **Paridade operacional.** README e guia de worktrees PT-BR/EN documentam flags, blockers,
|
|
44
|
+
PowerShell/POSIX e recovery; a task local do VS Code oferece `WendKeep: Finish merged worktree`.
|
|
45
|
+
|
|
7
46
|
## [0.76.9] — 2026-08-22
|
|
8
47
|
|
|
9
48
|
### 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) |
|
|
@@ -531,7 +531,7 @@ explore → propose → apply (TDD) → verify → archive
|
|
|
531
531
|
|
|
532
532
|
- **Propose** — `wendkeep change new <slug>` scaffolds `08-Mudanças/<slug>/` (`proposta.md`, `design.md`, `tarefas.md`; `--simple` skips the design). `--guide` creates the compact GUIDE contract and omits automatic design/spec/ADR when `contract_impact:none`. It becomes the global *current* change. When the change declares `spec_impact: required`, you author the delta yourself at `specs/<capability>/spec.md` — there is no placeholder to delete. Multiple changes may remain open: `change list`/`status` and the hooks show every pending one, while commands without `--change` act on the current one alone. `change use <slug>` changes focus and `change continue <archived> <new>` creates an auditable continuation.
|
|
533
533
|
- **Apply** — implement each `tarefas.md` task. Mark machine proof with one or more `[sensor:<id>]` tags on the same task: every distinct ID enters the gate once, in declaration order. Also mark satisfied requirements with one or more `[req:<ID>]` tags.
|
|
534
|
-
- **Verify** — `wendkeep verify` runs
|
|
534
|
+
- **Verify** — `wendkeep verify` runs declared sensors and writes an **Evidence Envelope v2** to `evidencia.json`, SHA-256-bound to project/repository/worktree/session, HEAD, index tree, normalized worktree digest, tasks, effective spec, and sensor configuration. Each sensor records a sanitized command, execution window, duration, exit code, output digest, and a sanitized tail bounded to 2,000 characters. If HEAD changes during the run, no new envelope is published. `change status` reports `bound`, `stale`, `context-mismatch`, or `legacy-unbound`; v1 evidence remains readable but cannot satisfy v2 authority. The public schema is [`schema/wendkeep.evidence-envelope-v2.schema.json`](schema/wendkeep.evidence-envelope-v2.schema.json). `verify --deep` binds both package and verdict to the current `envelope_id`.
|
|
535
535
|
- **Archive** — `wendkeep change archive <slug>` **gates** on the evidence (blocks unless every declared critical sensor is green), promotes each applicable spec delta (`ADDED`/`MODIFIED`/`REMOVED`) into the living `07-Specs/<capability>.md` and moves the change to `_arquivo/`. GOVERN/ASSURE mint an ADR in `04-Decisões/`; compact GUIDE with no contract impact does not mint one automatically.
|
|
536
536
|
|
|
537
537
|
> The gate blocks unless the scaffold is filled, no task is open, evidence is fresh, and every declared requirement is covered. **`--force` waives exactly one of those — the open-task check — and is the human's call, never the agent's.** An unfilled scaffold, a red critical sensor, stale evidence, an orphan requirement or a missing verdict block regardless.
|
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) |
|
|
@@ -531,7 +531,7 @@ explore → propose → apply (TDD) → verify → archive
|
|
|
531
531
|
|
|
532
532
|
- **Propose** — `wendkeep change new <slug>` scaffolds `08-Mudanças/<slug>/` (`proposta.md`, `design.md`, `tarefas.md`; `--simple` skips the design). `--guide` creates the compact GUIDE contract and omits automatic design/spec/ADR when `contract_impact:none`. It becomes the global *current* change. When the change declares `spec_impact: required`, you author the delta yourself at `specs/<capability>/spec.md` — there is no placeholder to delete. Multiple changes may remain open: `change list`/`status` and the hooks show every pending one, while commands without `--change` act on the current one alone. `change use <slug>` changes focus and `change continue <archived> <new>` creates an auditable continuation.
|
|
533
533
|
- **Apply** — implement each `tarefas.md` task. Mark machine proof with one or more `[sensor:<id>]` tags on the same task: every distinct ID enters the gate once, in declaration order. Also mark satisfied requirements with one or more `[req:<ID>]` tags.
|
|
534
|
-
- **Verify** — `wendkeep verify` runs
|
|
534
|
+
- **Verify** — `wendkeep verify` runs declared sensors and writes an **Evidence Envelope v2** to `evidencia.json`, SHA-256-bound to project/repository/worktree/session, HEAD, index tree, normalized worktree digest, tasks, effective spec, and sensor configuration. Each sensor records a sanitized command, execution window, duration, exit code, output digest, and a sanitized tail bounded to 2,000 characters. If HEAD changes during the run, no new envelope is published. `change status` reports `bound`, `stale`, `context-mismatch`, or `legacy-unbound`; v1 evidence remains readable but cannot satisfy v2 authority. The public schema is [`schema/wendkeep.evidence-envelope-v2.schema.json`](schema/wendkeep.evidence-envelope-v2.schema.json). `verify --deep` binds both package and verdict to the current `envelope_id`.
|
|
535
535
|
- **Archive** — `wendkeep change archive <slug>` **gates** on the evidence (blocks unless every declared critical sensor is green), promotes each applicable spec delta (`ADDED`/`MODIFIED`/`REMOVED`) into the living `07-Specs/<capability>.md` and moves the change to `_arquivo/`. GOVERN/ASSURE mint an ADR in `04-Decisões/`; compact GUIDE with no contract impact does not mint one automatically.
|
|
536
536
|
|
|
537
537
|
> The gate blocks unless the scaffold is filled, no task is open, evidence is fresh, and every declared requirement is covered. **`--force` waives exactly one of those — the open-task check — and is the human's call, never the agent's.** An unfilled scaffold, a red critical sensor, stale evidence, an orphan requirement or a missing verdict block regardless.
|
|
@@ -76,7 +76,12 @@ npx wendkeep sensors add api-contracts "npm run test:contracts" --severity criti
|
|
|
76
76
|
An archived change promotes its delta into the living spec when applicable and preserves proposal,
|
|
77
77
|
tasks/proof, and design when present. GOVERN/ASSURE mint an ADR; compact GUIDE with no contract
|
|
78
78
|
impact does not mint one automatically. Archive passes only with closed tasks, green required
|
|
79
|
-
sensors, and a fresh verdict.
|
|
79
|
+
sensors, and a fresh verdict bound to the same Evidence Envelope v2. V1 evidence is reported as
|
|
80
|
+
`legacy-unbound`; `change status <slug>` also diagnoses `bound`, `stale`, and `context-mismatch`.
|
|
81
|
+
Archive compares the package/verdict `evidenceEnvelopeId` and complete `evidenceBinding` with the
|
|
82
|
+
proven checkout. On a mismatch, return to the correct worktree/session and rerun `verify`,
|
|
83
|
+
`verify --deep`, and `wk-verify`. Fields, text/binary normalization, error codes, and recovery are
|
|
84
|
+
detailed in the [verify guide](verify.md).
|
|
80
85
|
|
|
81
86
|
## Tool-scope fence
|
|
82
87
|
|
|
@@ -105,6 +110,8 @@ selection/lease; never carry authorization from another conversation.
|
|
|
105
110
|
- Sensor not executed: keep one or more `[sensor:id]` tags on the same checkbox line. Every
|
|
106
111
|
distinct ID on that line is required and runs once, in declaration order.
|
|
107
112
|
- Stale evidence: rerun `verify` and `verify --deep` after task/spec edits.
|
|
113
|
+
- Evidence from another worktree/session: return to the correct causal context; it cannot satisfy
|
|
114
|
+
the current archive even when every sensor is green.
|
|
108
115
|
- Rebase conflict: resolve the delta or use `--accept-current` only when that is the decision.
|
|
109
116
|
|
|
110
117
|
## Next steps
|
|
@@ -42,7 +42,8 @@ npx wendkeep change use <slug>
|
|
|
42
42
|
- **Exit 0:** all required sensors passed and evidence was written.
|
|
43
43
|
- **Exit 1:** the gate ran, but at least one critical sensor was red or a mutant survived.
|
|
44
44
|
- **Exit 2:** invalid usage/context, including `no change (--change or active)`, missing vault,
|
|
45
|
-
unknown change,
|
|
45
|
+
unknown change, a project outside a Git repository, invalid `wendkeep.sensors.json`, or
|
|
46
|
+
`WENDKEEP_EVIDENCE_HEAD_CHANGED`.
|
|
46
47
|
|
|
47
48
|
`verify --deep` writes `verificacao.json`; it does not replace the reviewer. The `wk-verify` skill
|
|
48
49
|
must be run by a different author and writes `verdict.json`.
|
|
@@ -72,10 +73,22 @@ npx wendkeep memory status --gate --vault .MyApp-vault
|
|
|
72
73
|
|
|
73
74
|
## Expected result
|
|
74
75
|
|
|
75
|
-
`evidencia.json`
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
`evidencia.json` follows the [public v2 schema](../../../schema/wendkeep.evidence-envelope-v2.schema.json).
|
|
77
|
+
The envelope binds `project_id`, `repository_id`, `worktree_id`, `work_session_id`, change, and
|
|
78
|
+
branch to `base_sha`, `head_sha`, `index_tree_sha`, `worktree_digest`, tasks, effective spec, and
|
|
79
|
+
sensor configuration with complete SHA-256 digests. The worktree digest covers staged, unstaged,
|
|
80
|
+
untracked, rename, and delete state; paths use `/`, text normalizes CRLF/CR to LF, and binaries keep
|
|
81
|
+
their bytes. Binary classification honors Git `binary`/`-text` attributes and known binary
|
|
82
|
+
extensions (including `.bin`); ignored files are excluded.
|
|
83
|
+
|
|
84
|
+
Each sensor records its sanitized command and hash, start/end, duration, exit code, output digest,
|
|
85
|
+
and a sanitized tail bounded to 2,000 characters. Authority artifacts publish through a path-safe
|
|
86
|
+
temporary in the same directory and an atomic rename. In deep mode, `verificacao.json` and
|
|
87
|
+
`verdict.json` carry the same `evidenceEnvelopeId` and complete `evidenceBinding`; the independent
|
|
88
|
+
reviewer must preserve both.
|
|
89
|
+
|
|
90
|
+
V1 evidence remains readable as `legacy-unbound`, never as equivalent authority. Run
|
|
91
|
+
`wendkeep change status <slug>` to inspect `bound`, `stale`, or `context-mismatch`.
|
|
79
92
|
|
|
80
93
|
## Common errors and diagnosis
|
|
81
94
|
|
|
@@ -85,6 +98,10 @@ tasks, and evidence for read-only review; the verdict covers every `[req:]` befo
|
|
|
85
98
|
- Red gate: inspect the bounded `note` field on the `evidencia.json` entry, fix the cause, and
|
|
86
99
|
rerun; never choose `archive --force` on your own.
|
|
87
100
|
- Missing/stale verdict: regenerate `--deep` and request a fresh independent pass.
|
|
101
|
+
- `WENDKEEP_EVIDENCE_HEAD_CHANGED`: HEAD moved while sensors ran; stabilize the checkout and rerun.
|
|
102
|
+
The previous evidence was not replaced.
|
|
103
|
+
- `legacy-unbound`, `stale`, or `context-mismatch`: return to the correct worktree/session, recover
|
|
104
|
+
the context when needed, and rerun `verify` plus `verify --deep`.
|
|
88
105
|
- Surviving mutants: strengthen the discriminating test; after three rounds, review manually.
|
|
89
106
|
|
|
90
107
|
## Next steps
|
|
@@ -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
|
|
|
@@ -76,7 +76,12 @@ npx wendkeep sensors add api-contracts "npm run test:contracts" --severity criti
|
|
|
76
76
|
A change arquivada move seu delta para o spec vivo quando aplicável e preserva proposta,
|
|
77
77
|
tarefas/evidência e design quando existente. GOVERN/ASSURE geram ADR; GUIDE compacta sem impacto
|
|
78
78
|
de contrato não gera ADR automático. O archive só passa com tarefas fechadas, sensores exigidos
|
|
79
|
-
verdes e verdict atual.
|
|
79
|
+
verdes e verdict atual ligado ao mesmo Evidence Envelope v2. Evidência v1 é mostrada como
|
|
80
|
+
`legacy-unbound`; `change status <slug>` também diagnostica `bound`, `stale` e `context-mismatch`.
|
|
81
|
+
O archive compara `evidenceEnvelopeId` e o `evidenceBinding` completo de package/verdict com o
|
|
82
|
+
checkout provado. Se houver divergência, volte à worktree/sessão correta e rode `verify`,
|
|
83
|
+
`verify --deep` e `wk-verify` novamente. Campos, normalização textual/binária, códigos e recovery
|
|
84
|
+
estão detalhados no [guia de verify](verify.md).
|
|
80
85
|
|
|
81
86
|
## Cerca de escopo para ferramentas
|
|
82
87
|
|
|
@@ -105,6 +110,8 @@ exige uma nova seleção/lease; não use autorização de outra conversa.
|
|
|
105
110
|
- Sensor não executado: mantenha uma ou mais tags `[sensor:id]` na mesma linha do checkbox. Todos
|
|
106
111
|
os IDs distintos dessa linha são exigidos e executados uma vez, na ordem declarada.
|
|
107
112
|
- Evidência stale: rode novamente `verify` e `verify --deep` depois de alterar tarefas/spec.
|
|
113
|
+
- Evidência de outra worktree/sessão: retorne ao contexto causal correto; ela não satisfaz o
|
|
114
|
+
archive atual mesmo que todos os sensores estejam verdes.
|
|
108
115
|
- Rebase em conflito: resolva o delta ou use `--accept-current` apenas quando isso for a decisão.
|
|
109
116
|
|
|
110
117
|
## Próximos passos
|
|
@@ -43,7 +43,8 @@ npx wendkeep change use <slug>
|
|
|
43
43
|
- **Exit 1:** o gate executou, mas ao menos um sensor crítico ficou vermelho ou um mutante
|
|
44
44
|
sobreviveu.
|
|
45
45
|
- **Exit 2:** uso/contexto inválido, como `no change (--change or active)`, vault ausente,
|
|
46
|
-
change inexistente
|
|
46
|
+
change inexistente, projeto fora de um repositório Git, `wendkeep.sensors.json` inválido ou
|
|
47
|
+
`WENDKEEP_EVIDENCE_HEAD_CHANGED`.
|
|
47
48
|
|
|
48
49
|
`verify --deep` gera `verificacao.json`; ele não substitui o verificador. A skill `wk-verify`
|
|
49
50
|
precisa ser executada por autor diferente e grava `verdict.json`.
|
|
@@ -73,11 +74,22 @@ npx wendkeep memory status --gate --vault .MeuApp-vault
|
|
|
73
74
|
|
|
74
75
|
## Resultado esperado
|
|
75
76
|
|
|
76
|
-
`evidencia.json`
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
`evidencia.json` segue o [schema público v2](../../../schema/wendkeep.evidence-envelope-v2.schema.json).
|
|
78
|
+
O envelope liga `project_id`, `repository_id`, `worktree_id`, `work_session_id`, change e branch a
|
|
79
|
+
`base_sha`, `head_sha`, `index_tree_sha`, `worktree_digest`, tarefas, spec e configuração dos
|
|
80
|
+
sensores por SHA-256 completo. O digest cobre staged, unstaged, untracked, rename e delete; paths
|
|
81
|
+
usam `/`, texto normaliza CRLF/CR para LF e binários preservam bytes. A classificação binária
|
|
82
|
+
respeita atributos Git `binary`/`-text` e extensões binárias conhecidas (incluindo `.bin`); arquivos
|
|
83
|
+
ignorados não entram.
|
|
84
|
+
|
|
85
|
+
Cada sensor registra comando sanitizado e seu hash, início/fim, duração, exit code, digest da saída
|
|
86
|
+
e tail sanitizado de até 2.000 caracteres. Os artefatos são publicados por temporário path-safe no
|
|
87
|
+
mesmo diretório e rename atômico. No deep, `verificacao.json` e `verdict.json` carregam o mesmo
|
|
88
|
+
`evidenceEnvelopeId` e `evidenceBinding` completo; o verificador independente deve preservar ambos
|
|
89
|
+
no verdict.
|
|
90
|
+
|
|
91
|
+
Evidência v1 continua legível como `legacy-unbound`, nunca como autoridade equivalente. Rode
|
|
92
|
+
`wendkeep change status <slug>` para ver `bound`, `stale` ou `context-mismatch`.
|
|
81
93
|
|
|
82
94
|
## Erros comuns e diagnóstico
|
|
83
95
|
|
|
@@ -87,6 +99,10 @@ verdict cobre cada `[req:]` antes do archive.
|
|
|
87
99
|
- Gate vermelho: consulte o campo `note` limitado da entrada em `evidencia.json`, corrija a causa
|
|
88
100
|
e repita; não use `archive --force` por conta própria.
|
|
89
101
|
- Verdict stale/ausente: regenere `--deep` e peça novo passe independente.
|
|
102
|
+
- `WENDKEEP_EVIDENCE_HEAD_CHANGED`: o HEAD mudou enquanto os sensores rodavam; estabilize o
|
|
103
|
+
checkout e repita. A evidência anterior não foi substituída.
|
|
104
|
+
- `legacy-unbound`, `stale` ou `context-mismatch`: volte à worktree/sessão correta, recupere o
|
|
105
|
+
contexto se necessário e rode `verify` + `verify --deep` novamente.
|
|
90
106
|
- Mutantes sobreviventes: fortaleça o teste discriminante; após três rodadas, revise manualmente.
|
|
91
107
|
|
|
92
108
|
## Próximos passos
|
|
@@ -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/hooks/change-core.mjs
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
resolveActiveContext,
|
|
16
16
|
setActiveContextChange,
|
|
17
17
|
} from './active-context-store.mjs';
|
|
18
|
+
import { evidenceSensors } from '../packages/vault/src/evidence-envelope.mjs';
|
|
18
19
|
|
|
19
20
|
export const ARCHIVE_DIR = '_arquivo';
|
|
20
21
|
const POINTER = '.brain/CURRENT_CHANGE.md';
|
|
@@ -442,7 +443,7 @@ export function quickGateState(vaultBase, { context } = {}) {
|
|
|
442
443
|
let redCritical = false;
|
|
443
444
|
try {
|
|
444
445
|
const ev = JSON.parse(readFileSync(join(dir, 'evidencia.json'), 'utf8'));
|
|
445
|
-
redCritical = (
|
|
446
|
+
redCritical = evidenceSensors(ev).some((e) => e.status !== 'green' && (e.severity || 'critical') !== 'warning');
|
|
446
447
|
} catch { /* sem/ilegível = não conta contra o nudge */ }
|
|
447
448
|
let evidenceStale = false;
|
|
448
449
|
try {
|