@imdeadpool/guardex 8.2.0 → 8.4.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.
Files changed (35) hide show
  1. package/README.md +68 -10
  2. package/bin/multiagent-safety.js +18 -1
  3. package/package.json +1 -1
  4. package/skills/gitguardex/SKILL.md +26 -2
  5. package/src/agents/message.js +764 -0
  6. package/src/agents/sessions.js +23 -1
  7. package/src/cli/args.js +64 -8
  8. package/src/cli/commands/agents.js +18 -0
  9. package/src/cli/commands/branch.js +94 -2
  10. package/src/cli/commands/finish.js +44 -2
  11. package/src/cli/commands/mcp.js +4 -3
  12. package/src/cli/shared/sandbox.js +5 -53
  13. package/src/cli/shared-locks.js +4 -0
  14. package/src/doctor/index.js +26 -26
  15. package/src/finish/index.js +10 -2
  16. package/src/finish/post-branch-finish-cleanup.js +324 -0
  17. package/src/finish/review-gate.js +47 -6
  18. package/src/git/index.js +9 -4
  19. package/src/mcp/collect.js +52 -3
  20. package/src/mcp/server.js +54 -2
  21. package/src/pr-checks.js +20 -5
  22. package/src/pr.js +122 -1
  23. package/src/scaffold/index.js +13 -0
  24. package/templates/AGENTS.multiagent-safety.md +37 -9
  25. package/templates/AGENTS.multiagent-safety.min.md +10 -4
  26. package/templates/codex/skills/gitguardex/SKILL.md +26 -2
  27. package/templates/githooks/pre-commit +40 -5
  28. package/templates/githooks/pre-push +72 -25
  29. package/templates/scripts/agent-branch-finish.sh +300 -21
  30. package/templates/scripts/agent-branch-start.sh +22 -2
  31. package/templates/scripts/agent-file-locks.py +170 -3
  32. package/templates/scripts/agent-preflight.sh +30 -0
  33. package/templates/scripts/agent-reconcile-openspec-tasks.js +105 -0
  34. package/templates/scripts/agent-worktree-prune.sh +406 -31
  35. package/templates/scripts/guardex-env.sh +291 -0
package/README.md CHANGED
@@ -20,6 +20,8 @@
20
20
  <p align="center">
21
21
  <a href="#install">Install</a> ·
22
22
  <a href="#the-problem">Why</a> ·
23
+ <a href="#what-gitguardex-can-do">Capabilities</a> ·
24
+ <a href="#see-every-lane-in-vs-code">VS Code view</a> ·
23
25
  <a href="#daily-workflow">Workflow</a> ·
24
26
  <a href="#code-assist-review-gate">Code assist</a> ·
25
27
  <a href="#essential-commands">Commands</a>
@@ -56,19 +58,58 @@ Linux; use WSL on Windows.
56
58
  Parallel agents can edit the same files, overwrite tests, or commit directly to
57
59
  `main`. More agents can create more conflicts instead of more progress.
58
60
 
59
- ### Solution
61
+ ### What GitGuardex can do
60
62
 
61
- ![Agent branch/worktree start protocol](https://raw.githubusercontent.com/recodeee/gitguardex/main/docs/images/workflow-branch-start.svg)
63
+ <p align="center">
64
+ <img alt="GitGuardex capability map: isolated lanes, evidence-driven shipping, and safe cleanup" src="https://raw.githubusercontent.com/opencue/gitguardex/main/docs/images/capabilities-dark.svg" width="900">
65
+ </p>
62
66
 
63
- GitGuardex gives every task an isolated lane:
67
+ | Isolate and coordinate | Ship with evidence | Recover without loss |
68
+ | --- | --- | --- |
69
+ | One `agent/*` branch and worktree per task. | Preflight, CI, and optional AI review block risky merges. | Dirty, locked, blocked, and uncertain lanes are preserved. |
70
+ | Shared file claims prevent silent overwrites. | The recorded base keeps unattended finishes on the correct target. | Successful lanes are merged, then their temporary branch and worktree are removed. |
71
+ | Protected branches stay behind a PR boundary. | Billing-aware fallbacks waive only explicitly named checks. | Cleanup fails closed instead of deleting work it cannot prove safe. |
64
72
 
65
- | Guard | Result |
66
- | --- | --- |
67
- | Separate `agent/*` branch + worktree | Agents do not share a working directory. |
68
- | Explicit file locks | Other lanes cannot overwrite claimed files. |
69
- | Protected `main` / `dev` / `master` | Agent changes must go through a PR. |
70
- | Preflight + CI + optional AI review | Broken or risky changes stop before merge. |
71
- | Finish + cleanup | The PR merges and the temporary lane is removed. |
73
+ <details>
74
+ <summary><strong>Implementation evidence and shipped hardening</strong></summary>
75
+
76
+ - **Correct base targeting** — persist and validate each lane's base so an
77
+ unattended finish cannot use another checkout's target. ([#745](https://github.com/opencue/gitguardex/pull/745), [#750](https://github.com/opencue/gitguardex/pull/750), [#751](https://github.com/opencue/gitguardex/pull/751))
78
+ - **Billing-aware CI fallback** — waive only named checks that GitHub could not
79
+ start because of billing, while keeping repository preflight mandatory.
80
+ ([#743](https://github.com/opencue/gitguardex/pull/743))
81
+ - **OpenSpec progress reconciliation** — merge conflicting `tasks.md` progress
82
+ deterministically and validate it before continuing. ([#753](https://github.com/opencue/gitguardex/pull/753))
83
+ - **Reusable successful preflight** — reuse proof only while the source HEAD,
84
+ base commit, command, and script stay unchanged; billing-waiver preflights
85
+ are never cached. ([#757](https://github.com/opencue/gitguardex/pull/757))
86
+ - **Fail-closed cleanup** — preserve dirty, locked, open-PR, blocked, or
87
+ uncertain lanes; close idle clean worktrees without deleting their branches.
88
+ ([#741](https://github.com/opencue/gitguardex/pull/741), [#744](https://github.com/opencue/gitguardex/pull/744), [#746](https://github.com/opencue/gitguardex/pull/746), [#752](https://github.com/opencue/gitguardex/pull/752))
89
+ - **Workspace hygiene** — safely remove successful detached lanes, avoid stale
90
+ VS Code worktree providers, and keep `gx branch finish --help` free of
91
+ repository side effects. ([#742](https://github.com/opencue/gitguardex/pull/742), [#747](https://github.com/opencue/gitguardex/pull/747), [#748](https://github.com/opencue/gitguardex/pull/748), [#754](https://github.com/opencue/gitguardex/pull/754))
92
+
93
+ </details>
94
+
95
+ ### See every lane in VS Code
96
+
97
+ Create an explicit multi-root workspace when you want every managed worktree to
98
+ appear as its own Source Control repository:
99
+
100
+ ```bash
101
+ gx setup --vscode-worktree-view
102
+ code ../<repo>-branches.code-workspace
103
+ ```
104
+
105
+ <p align="center">
106
+ <img alt="VS Code Explorer showing separate Codex and Claude worktree groups" src="https://raw.githubusercontent.com/opencue/gitguardex/main/docs/images/vscode-worktrees-overview.png" width="668">
107
+ </p>
108
+
109
+ The generated workspace enables Git subfolder discovery, worktree detection,
110
+ and an empty repository-scan exclusion list. This is opt-in: GitGuardex does not
111
+ rewrite your repository's `.gitignore` or loosen the default single-repository
112
+ workspace. Disable future generation with `--no-vscode-worktree-view`.
72
113
 
73
114
  ---
74
115
 
@@ -146,6 +187,8 @@ the PR as a readable severity, location, and finding table.
146
187
  | `gx branch finish --via-pr --wait-for-merge --cleanup` | Ship safely through a PR. |
147
188
  | `gx branch finish --fast` | Squash-merge a locally verified small change without local preflight or AI review. |
148
189
  | `gx agents status` | Show active agent lanes. |
190
+ | `gx agents send --session <id> --message <text>` | Deliver safely to an idle agent or queue for its next turn. |
191
+ | `gx agents inbox [--ack <message-id>]` | Read or acknowledge the authenticated standalone message queue. |
149
192
  | `gx cleanup` | Prune merged or stale worktrees. |
150
193
 
151
194
  Need the terminal cockpit? Run `gx cockpit`; see the
@@ -190,6 +233,21 @@ finds the last published GitHub release, and writes one grouped GitHub release b
190
233
  <details>
191
234
  <summary><strong>v8.x</strong></summary>
192
235
 
236
+ ### v8.4.0
237
+ - Added authenticated agent messaging that delivers live when safe and queues
238
+ durably when Nodeterm or tmux delivery is unavailable.
239
+ - Added worktree-shared CLI and MCP inbox operations for reading and
240
+ acknowledging queued agent messages.
241
+ - Improved stale Codex worktree recovery and VS Code visibility for managed
242
+ worktrees.
243
+
244
+ ### v8.3.0
245
+ - Added adaptive direct-main agent work and branch-targeted `gx sync`.
246
+ - Made worktree cleanup safer by preserving active or locked lanes while pruning
247
+ only eligible merged or opted-in clean lanes.
248
+ - Persisted and validated explicit finish bases, recognized SHA-256 null object
249
+ IDs, and prevented stale VS Code worktree providers.
250
+
193
251
  ### v8.2.0
194
252
  - Reduced agent preflight and finish token overhead.
195
253
  - Preserved dirty worktrees during stale-worktree cleanup and exposed
@@ -1,5 +1,22 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  const { runFromBin } = require('../src/cli/main');
4
+ const {
5
+ cleanupFinishedDetachedWorktree,
6
+ hasLiveProcessInWorktree,
7
+ prepareBranchFinishCleanup,
8
+ scheduleFinishedDetachedWorktreeCleanup
9
+ } = require('../src/finish/post-branch-finish-cleanup');
4
10
 
5
- runFromBin();
11
+ const finishCleanup = prepareBranchFinishCleanup(process.argv.slice(2), process.cwd());
12
+
13
+ void runFromBin().then(() => {
14
+ if (!process.exitCode && finishCleanup) {
15
+ process.chdir(finishCleanup.repoRoot);
16
+ if (hasLiveProcessInWorktree(finishCleanup.worktreePath)) {
17
+ scheduleFinishedDetachedWorktreeCleanup(finishCleanup);
18
+ } else {
19
+ cleanupFinishedDetachedWorktree(finishCleanup);
20
+ }
21
+ }
22
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imdeadpool/guardex",
3
- "version": "8.2.0",
3
+ "version": "8.4.0",
4
4
  "description": "Guardian T-Rex for your multi-agent repo. Isolated worktrees, file locks, and PR-only merges stop parallel Codex & Claude agents from overwriting each other's work. Auto-wires Oh My Codex, Oh My Claude, OpenSpec, and Caveman.",
5
5
  "license": "MIT",
6
6
  "preferGlobal": true,
@@ -10,6 +10,30 @@ Use when a GitGuardex-managed repository needs safe edits or multi-agent coordin
10
10
  Bootstrap: `gx setup`
11
11
  Ops: `gx branch start "<task>" "<agent>"`, `gx locks claim --branch "<agent-branch>" <file...>`, `gx branch finish --branch "<agent-branch>" --base <base> --via-pr --wait-for-merge --cleanup`, `gx finish --all`, `gx cleanup`
12
12
 
13
+ ## Choose the lane before editing
14
+
15
+ Worktree policy is strict `always` unless the repo opts into `adaptive` with
16
+ `GUARDEX_WORKTREE_MODE=adaptive` in `.env` or
17
+ `git config --local multiagent.worktreeMode adaptive`.
18
+
19
+ 1. Run `gx status`. In adaptive mode, also inspect `list_agents` (or
20
+ `gx mcp list-agents --no-prs`), the current dirty paths, and `who_owns` for
21
+ every intended file.
22
+ 2. Stay on the current checkout only for bounded, single-agent work with no
23
+ competing writer, claimed target, or dirty-path overlap.
24
+ 3. Pivot to a new isolated lane when the task is substantial/long-lived,
25
+ another writer is active in the repo, a target is owned or dirty elsewhere,
26
+ or the scope expands. Use
27
+ `gx branch start --new --no-transfer "<bounded task>" "<agent>"`.
28
+ 4. Re-run the radar before expanding scope. Never overwrite another lane's
29
+ changes. If direct work already has edits when a pivot becomes necessary,
30
+ transfer only those known edits deliberately; do not absorb unrelated files.
31
+
32
+ Direct adaptive work supports file edits, `git add`/ordinary commit/push, and
33
+ bounded test/lint/build commands. Custom executors, scripts, or history rewrites
34
+ pivot to an isolated lane. Isolated work uses claims and the gated
35
+ `gx branch finish` flow below.
36
+
13
37
  ## Keep the default workflow lean
14
38
 
15
39
  - Default to direct T1 work in code and tests. Do not create OpenSpec artifacts from task wording alone.
@@ -24,11 +48,11 @@ Before parallel work, inspect the field with the MCP `list_agents` tool or the C
24
48
  gx mcp list-agents --no-prs
25
49
  ```
26
50
 
27
- For every file a writer may touch, check ownership, create an isolated lane, then claim it:
51
+ For every file a parallel writer may touch, check ownership, create an isolated lane, then claim it:
28
52
 
29
53
  ```sh
30
54
  gx mcp who-owns path/to/file.ts
31
- gx branch start "<bounded task>" "<agent>"
55
+ gx branch start --new --no-transfer "<bounded task>" "<agent>"
32
56
  gx locks claim --branch "<agent-branch>" path/to/file.ts
33
57
  ```
34
58