@imdeadpool/guardex 8.4.14 → 8.4.16
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/CONTRIBUTING.md +2 -33
- package/README.md +9 -534
- package/SECURITY.md +1 -1
- package/package.json +6 -39
- package/scripts/prepublish-bump-version.js +11 -1
- package/src/agents/start.js +1 -1
- package/src/cli/commands/branch.js +7 -7
- package/src/cli/commands/claude.js +6 -13
- package/src/cli/commands/pr.js +2 -2
- package/src/cli/commands/release.js +7 -1
- package/src/cli/commands/review.js +2 -2
- package/src/cli/commands/worktree-copy-ignored.js +1 -1
- package/src/cli/commands/worktree-estimate.js +2 -2
- package/src/cli/commands/worktree-hooks.js +1 -1
- package/src/cli/commands/worktree-navigation.js +3 -3
- package/src/cli/shared-locks.js +1 -1
- package/src/context.js +8 -1
- package/src/finish/index.js +1 -1
- package/src/finish/post-branch-finish-cleanup.js +2 -2
- package/src/finish/review-gate.js +3 -3
- package/src/finish/review-receipt.js +5 -5
- package/src/{github-api.js → github/api.js} +2 -2
- package/src/mcp/collect.js +2 -2
- package/src/pr-review.js +2 -1178
- package/src/pr-value.js +2 -111
- package/src/provider-binary.js +2 -122
- package/src/{pr.js → pull-request/index.js} +5 -5
- package/src/{pr-lens-publish.js → pull-request/lens-publish.js} +2 -2
- package/src/{pr-lens.js → pull-request/lens.js} +2 -2
- package/src/{pr-respond.js → pull-request/respond.js} +8 -8
- package/src/pull-request/value.js +111 -0
- package/src/{review-fix.js → review/fix.js} +2 -2
- package/src/review/provider-binary.js +122 -0
- package/src/review/pull-request.js +1178 -0
- package/src/{worktree-copy-ignored.js → worktree/copy-ignored.js} +3 -3
- package/src/{worktree-hook-worker.js → worktree/hook-worker.js} +1 -1
- package/src/{worktree-hooks.js → worktree/hooks.js} +5 -5
- package/src/{worktree-navigation.js → worktree/navigation.js} +2 -2
- package/src/{worktree-picker.js → worktree/picker.js} +1 -1
- package/src/{worktree-quota.js → worktree/quota.js} +1 -1
- package/src/{worktree-start.js → worktree/start.js} +4 -4
- package/src/{worktree-tasks.js → worktree/tasks.js} +6 -6
- /package/src/{shared-git-state.js → git/shared-state.js} +0 -0
- /package/src/{pr-checks.js → pull-request/checks.js} +0 -0
- /package/src/{review-diff-context.js → review/diff-context.js} +0 -0
- /package/src/{review-diff.js → review/diff.js} +0 -0
package/CONTRIBUTING.md
CHANGED
|
@@ -1,35 +1,4 @@
|
|
|
1
1
|
# Contributing
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## Development setup
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm ci
|
|
9
|
-
npm test
|
|
10
|
-
node --check bin/multiagent-safety.js
|
|
11
|
-
npm pack --dry-run
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
## Pull request checklist
|
|
15
|
-
|
|
16
|
-
- Keep changes small and focused
|
|
17
|
-
- Add or update tests for behavior changes
|
|
18
|
-
- Keep README and CLI help text aligned
|
|
19
|
-
- Ensure `npm test` passes locally
|
|
20
|
-
|
|
21
|
-
## Release hygiene
|
|
22
|
-
|
|
23
|
-
- Every push to `main` queues the npm release workflow. It runs verification and
|
|
24
|
-
the dependency audit before releasing the current commit; superseded runs
|
|
25
|
-
skip publishing.
|
|
26
|
-
- By default the workflow releases the next free patch after npm `latest`. For
|
|
27
|
-
a deliberate minor or major release, raise `package.json` and its lockfile and
|
|
28
|
-
add the version to the `README.md` release notes in the same PR.
|
|
29
|
-
- The npm Trusted Publisher is `opencue/gitguardex`, workflow `release.yml`,
|
|
30
|
-
environment `npm`, with `npm publish` allowed. No npm token is needed.
|
|
31
|
-
- The workflow publishes with provenance and attaches the published tarball,
|
|
32
|
-
SHA-256 checksum, and Sigstore bundle to the GitHub release. Rerun a failed
|
|
33
|
-
release on the same commit before the next merge to recover without publishing
|
|
34
|
-
a second version. A manually published stable tag matching the package version
|
|
35
|
-
on `main` still uses the same workflow.
|
|
3
|
+
See the [GitGuardex contribution guide](https://github.com/opencue/gitguardex/blob/main/CONTRIBUTING.md)
|
|
4
|
+
for the repository layout, development checks, and release process.
|
package/README.md
CHANGED
|
@@ -1,542 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
<img alt="GitGuardex logo" src="./logo.png" width="240">
|
|
3
|
-
</p>
|
|
1
|
+
# GitGuardex
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
<p align="center">
|
|
8
|
-
<strong>Safe parallel work for Codex, Claude, and humans.</strong><br>
|
|
9
|
-
One task → one worktree → one PR → one clean merge.
|
|
10
|
-
</p>
|
|
11
|
-
|
|
12
|
-
<p align="center">
|
|
13
|
-
<a href="https://www.npmjs.com/package/@imdeadpool/guardex"><img alt="npm version" src="https://img.shields.io/npm/v/%40imdeadpool%2Fguardex?label=npm&style=flat-square&color=cb3837&logo=npm&logoColor=white"></a>
|
|
14
|
-
<a href="https://github.com/recodeee/gitguardex/actions/workflows/ci.yml"><img alt="CI status" src="https://img.shields.io/github/actions/workflow/status/recodeee/gitguardex/ci.yml?branch=main&label=CI&style=flat-square"></a>
|
|
15
|
-
<a href="https://scorecard.dev/viewer/?uri=github.com/recodeee/gitguardex"><img alt="OpenSSF Scorecard" src="https://img.shields.io/ossf-scorecard/github.com/recodeee/gitguardex?label=OpenSSF%20Scorecard&style=flat-square"></a>
|
|
16
|
-
<a href="https://github.com/recodeee/gitguardex/stargazers"><img alt="GitHub stars" src="https://img.shields.io/github/stars/recodeee/gitguardex?label=stars&style=flat-square&color=d4ac0d"></a>
|
|
17
|
-
<a href="./LICENSE"><img alt="license" src="https://img.shields.io/npm/l/%40imdeadpool%2Fguardex?label=license&style=flat-square&color=97ca00"></a>
|
|
18
|
-
</p>
|
|
19
|
-
|
|
20
|
-
<p align="center">
|
|
21
|
-
<a href="#install">Install</a> ·
|
|
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> ·
|
|
25
|
-
<a href="#daily-workflow">Workflow</a> ·
|
|
26
|
-
<a href="#code-assist-review-gate">Code assist</a> ·
|
|
27
|
-
<a href="#essential-commands">Commands</a>
|
|
28
|
-
</p>
|
|
29
|
-
|
|
30
|
-
---
|
|
31
|
-
|
|
32
|
-
## Install
|
|
33
|
-
|
|
34
|
-
<p align="center">
|
|
35
|
-
<img alt="Install GitGuardex" src="https://raw.githubusercontent.com/recodeee/gitguardex/main/docs/images/install-hero.svg" width="680">
|
|
36
|
-
</p>
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
npm i -g @imdeadpool/guardex
|
|
40
|
-
cd /path/to/your-repo
|
|
41
|
-
gx setup
|
|
42
|
-
gx onboard # optional 2-minute tour
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
Requires **Node.js 18+**, Git, and GitHub CLI (`gh`). Recommended on macOS or
|
|
46
|
-
Linux; use WSL on Windows.
|
|
47
|
-
|
|
48
|
-
### Adaptive local build queue
|
|
49
|
-
|
|
50
|
-
The npm install hook detects total RAM and reports the baseline. On Linux with
|
|
51
|
-
Python 3, Codex and Claude can share one foreground heavy-job queue across
|
|
52
|
-
worktrees:
|
|
3
|
+
GitGuardex coordinates isolated agent worktrees, file ownership, verification
|
|
4
|
+
and PR-only merges.
|
|
53
5
|
|
|
54
6
|
```sh
|
|
55
|
-
|
|
56
|
-
gx
|
|
57
|
-
gx run-heavy -- npm test
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
GitGuardex finish preflight uses the same queue. The ceiling is one job per
|
|
61
|
-
8 GiB of effective RAM (at least one, at most four); available RAM and active
|
|
62
|
-
slots are rechecked before every admission, so zero jobs may start under
|
|
63
|
-
pressure. On systemd systems with a user manager, jobs run in their own
|
|
64
|
-
worker scopes under the caller's user app or session slice, with a soft
|
|
65
|
-
`MemoryHigh` limit. It does not change earlyoom or systemd-oomd settings. Commands that do
|
|
66
|
-
not use GitGuardex are not queued, and background daemons are not supported.
|
|
67
|
-
|
|
68
|
-
Waiting defaults to 120 seconds (`GUARDEX_HEAVY_WAIT_SECONDS`); on expiry the
|
|
69
|
-
command is not run and GitGuardex returns 75. Set `GUARDEX_HEAVY_SCOPE=0` to
|
|
70
|
-
skip just the scope, or `GUARDEX_HEAVY_QUEUE=0` to run without the queue.
|
|
71
|
-
macOS and Linux without Python run commands directly. Ignoring npm install
|
|
72
|
-
scripts skips only the install report; the runtime still detects RAM.
|
|
73
|
-
|
|
74
|
-
> [!WARNING]
|
|
75
|
-
> GitGuardex is an independent project. It is not affiliated with OpenAI,
|
|
76
|
-
> Anthropic, or Codex.
|
|
77
|
-
|
|
78
|
-
---
|
|
79
|
-
|
|
80
|
-
## The problem
|
|
81
|
-
|
|
82
|
-

|
|
83
|
-
|
|
84
|
-
Parallel agents can edit the same files, overwrite tests, or commit directly to
|
|
85
|
-
`main`. More agents can create more conflicts instead of more progress.
|
|
86
|
-
|
|
87
|
-
### What GitGuardex can do
|
|
88
|
-
|
|
89
|
-
<p align="center">
|
|
90
|
-
<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">
|
|
91
|
-
</p>
|
|
92
|
-
|
|
93
|
-
| Isolate and coordinate | Ship with evidence | Recover without loss |
|
|
94
|
-
| --- | --- | --- |
|
|
95
|
-
| One `agent/*` branch and worktree per task. | Preflight, CI, and optional AI review block risky merges. | Dirty, locked, blocked, and uncertain lanes are preserved. |
|
|
96
|
-
| 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. |
|
|
97
|
-
| 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. |
|
|
98
|
-
|
|
99
|
-
<details>
|
|
100
|
-
<summary><strong>Implementation evidence and shipped hardening</strong></summary>
|
|
101
|
-
|
|
102
|
-
- **Correct base targeting** — persist and validate each lane's base so an
|
|
103
|
-
unattended finish cannot use another checkout's target. When
|
|
104
|
-
`branch.<b>.guardexBase` is absent (e.g., a worktree created with raw
|
|
105
|
-
`git worktree add`), the finish and stop hooks infer the base from git
|
|
106
|
-
history: the oldest reflog "Created from <name>" entry wins; if absent,
|
|
107
|
-
ancestry distance (commits ahead of each candidate's merge-base) selects the
|
|
108
|
-
closest; ties prefer `multiagent.baseBranch`, then protected branches, then
|
|
109
|
-
lexical order; and the result is persisted as `branch.<b>.guardexBase` for
|
|
110
|
-
every subsequent gate. ([#745](https://github.com/opencue/gitguardex/pull/745), [#750](https://github.com/opencue/gitguardex/pull/750), [#751](https://github.com/opencue/gitguardex/pull/751))
|
|
111
|
-
- **Billing-aware CI fallback** — waive only named checks that GitHub could not
|
|
112
|
-
start because of billing, while keeping repository preflight mandatory.
|
|
113
|
-
([#743](https://github.com/opencue/gitguardex/pull/743))
|
|
114
|
-
- **OpenSpec progress reconciliation** — merge conflicting `tasks.md` progress
|
|
115
|
-
deterministically and validate it before continuing. ([#753](https://github.com/opencue/gitguardex/pull/753))
|
|
116
|
-
- **Reusable successful preflight** — reuse proof only while the source HEAD,
|
|
117
|
-
base commit, command, and script stay unchanged; billing-waiver preflights
|
|
118
|
-
are never cached. ([#757](https://github.com/opencue/gitguardex/pull/757))
|
|
119
|
-
- **Fail-closed cleanup** — preserve dirty, locked, open-PR, blocked, or
|
|
120
|
-
uncertain lanes; close idle clean worktrees without deleting their branches.
|
|
121
|
-
([#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))
|
|
122
|
-
- **Workspace hygiene** — safely remove successful detached lanes, avoid stale
|
|
123
|
-
VS Code worktree providers, and keep `gx branch finish --help` free of
|
|
124
|
-
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))
|
|
125
|
-
|
|
126
|
-
</details>
|
|
127
|
-
|
|
128
|
-
### See every lane in VS Code
|
|
129
|
-
|
|
130
|
-
Create an explicit multi-root workspace when you want every managed worktree to
|
|
131
|
-
appear as its own Source Control repository:
|
|
132
|
-
|
|
133
|
-
```bash
|
|
134
|
-
gx setup --vscode-worktree-view
|
|
135
|
-
code ../<repo>-branches.code-workspace
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
<p align="center">
|
|
139
|
-
<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">
|
|
140
|
-
</p>
|
|
141
|
-
|
|
142
|
-
The generated workspace enables Git subfolder discovery, worktree detection,
|
|
143
|
-
and an empty repository-scan exclusion list. This is opt-in: GitGuardex does not
|
|
144
|
-
rewrite your repository's `.gitignore` or loosen the default single-repository
|
|
145
|
-
workspace. Disable future generation with `--no-vscode-worktree-view`.
|
|
146
|
-
|
|
147
|
-
---
|
|
148
|
-
|
|
149
|
-
## Daily workflow
|
|
150
|
-
|
|
151
|
-
```bash
|
|
152
|
-
# 1. Start an isolated lane
|
|
153
|
-
gx branch start "fix-auth" "codex"
|
|
154
|
-
|
|
155
|
-
# 2. Inside the printed worktree, claim what you will edit
|
|
156
|
-
gx locks claim --branch "$(git branch --show-current)" src/auth.ts test/auth.test.ts
|
|
157
|
-
|
|
158
|
-
# 3. Implement and verify
|
|
159
|
-
npm test
|
|
160
|
-
|
|
161
|
-
# 4. Commit, open a PR, merge, and clean up
|
|
162
|
-
gx branch finish --via-pr --wait-for-merge --cleanup
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
### Agent token usage
|
|
166
|
-
|
|
167
|
-
`gx usage` delegates to [ccusage](https://github.com/ccusage/ccusage), reading the
|
|
168
|
-
token usage already recorded by supported coding-agent CLIs. Install ccusage
|
|
169
|
-
once with `npm install -g ccusage`; GX never silently downloads it.
|
|
170
|
-
|
|
171
|
-
```bash
|
|
172
|
-
gx usage # daily totals across detected agents
|
|
173
|
-
gx usage codex session --json --offline # Codex sessions, machine-readable
|
|
174
|
-
gx usage claude daily --since 20260921 # Claude Code date filter
|
|
175
|
-
gx usage codex session --help # ccusage's report-specific options
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
Reports cover ccusage's configured local log roots, **not just the current GX
|
|
179
|
-
repository**. `CODEX_HOME` and other ccusage environment/config settings pass
|
|
180
|
-
through unchanged. Use `GUARDEX_CCUSAGE_BIN` to select an executable or JS entry
|
|
181
|
-
point. GX preserves the backend output and exit status, without recounting
|
|
182
|
-
tokens or treating missing ccusage as a successful empty report.
|
|
183
|
-
|
|
184
|
-
Costs are API-equivalent estimates, not invoices or subscription balances.
|
|
185
|
-
Pricing may require network access; `--offline` uses ccusage's offline pricing.
|
|
186
|
-
Missing logs cannot be measured, and Codex log support is experimental.
|
|
187
|
-
For A/B comparisons, use separate sessions with the same tasks/model and check
|
|
188
|
-
task success before comparing input, output, cached tokens and elapsed time.
|
|
189
|
-
This command reports usage; it does not itself run an A/B experiment.
|
|
190
|
-
|
|
191
|
-
### One-call agent context
|
|
192
|
-
|
|
193
|
-
`gx context` exposes the existing MCP context collector as compact JSON, scoped
|
|
194
|
-
to the current repository. Read the current lane, peer agents, and ownership of
|
|
195
|
-
multiple files without separate per-file calls:
|
|
196
|
-
|
|
197
|
-
```bash
|
|
198
|
-
gx context src/auth.ts test/auth.test.ts
|
|
199
|
-
gx context --target /path/to/worktree --max-bytes 20000 --json
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
PR lookup is opt-in with `--include-prs`. The default limit is 20,000 UTF-8 bytes
|
|
203
|
-
of JSON, excluding the trailing newline; this is a byte budget, not a token
|
|
204
|
-
count. Up to 200 file paths are accepted. Use `--` before dash-prefixed filenames.
|
|
205
|
-
Only optional peer summaries may be omitted, with `complete: false` and an
|
|
206
|
-
omission count. Required safety data, including ownership conflicts, is never
|
|
207
|
-
truncated: an insufficient budget fails. Raise `--max-bytes` (up to 1 MiB) or
|
|
208
|
-
split the file batch. This read-only snapshot does not claim files or grant edit
|
|
209
|
-
permission; existing locks, approvals and merge gates still apply.
|
|
210
|
-
|
|
211
|
-
Run `node scripts/benchmark-context-cli.js` for a repeated local comparison of
|
|
212
|
-
separate MCP requests, the already-available batched MCP call, and this CLI.
|
|
213
|
-
It checks equivalent safety facts and reports timings and output bytes, not
|
|
214
|
-
provider-token counts or universal performance savings.
|
|
215
|
-
|
|
216
|
-
For a small change that you already verified locally, use the explicit fast
|
|
217
|
-
profile:
|
|
218
|
-
|
|
219
|
-
```bash
|
|
220
|
-
gx branch finish --fast
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
`--fast` still opens a PR and uses squash merge, but skips the local preflight,
|
|
224
|
-
AI review, and review autofix. Repository branch protection and required CI
|
|
225
|
-
checks still control whether GitHub accepts the merge. Do not use fast mode for
|
|
226
|
-
security-sensitive, migration, dependency, or broad refactor changes.
|
|
227
|
-
|
|
228
|
-
<p align="center">
|
|
229
|
-
<img alt="Guarded VS Code Source Control example" src="https://raw.githubusercontent.com/recodeee/gitguardex/main/docs/images/workflow-source-control-grouped.png" width="760">
|
|
230
|
-
</p>
|
|
231
|
-
|
|
232
|
-
---
|
|
233
|
-
|
|
234
|
-
## Worktree provisioning
|
|
235
|
-
|
|
236
|
-
Opt into isolated dependency copies in `.guardex.json` (JSONC is supported):
|
|
237
|
-
|
|
238
|
-
```json
|
|
239
|
-
{
|
|
240
|
-
"provision": {
|
|
241
|
-
"files": { "copy": ["node_modules", ".env"], "symlink": [] },
|
|
242
|
-
"postCreate": ["npm run build"]
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
New `gx branch start` worktrees apply this configuration. `copy` supports files
|
|
248
|
-
and directories, attempts native copy-on-write, and falls back to regular copying.
|
|
249
|
-
Unlike shared symlinks, modifying a copied dependency does not modify the source.
|
|
250
|
-
Existing targets are left untouched. Internal symlinks are relocated inside the
|
|
251
|
-
copy; dangling links, links outside the selected directory, and special files
|
|
252
|
-
fail the directory copy without installing a partial target. An explicit copy
|
|
253
|
-
never falls back to a shared symlink. Without an explicit copy policy, legacy
|
|
254
|
-
dependency sharing remains available; choose copies for writable dependencies.
|
|
255
|
-
|
|
256
|
-
**Migration:** `postCreate` now skips commands until their exact ordered list has
|
|
257
|
-
been approved locally for that repository. In a human terminal, run:
|
|
258
|
-
|
|
259
|
-
```bash
|
|
260
|
-
gx worktree approve-hooks --target /path/to/source-repo
|
|
261
|
-
gx worktree provision --source /path/to/source-repo --target /path/to/agent-worktree
|
|
262
|
-
# Revoke approval without running hooks:
|
|
263
|
-
gx worktree approve-hooks --target /path/to/source-repo --revoke
|
|
7
|
+
npm install -g @imdeadpool/guardex
|
|
8
|
+
gx --help
|
|
264
9
|
```
|
|
265
10
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
arbitrary shell code, including subsequently changed scripts: approval is not a
|
|
270
|
-
sandbox or a review of those scripts. `GUARDEX_PROVISION_HOOKS=0` disables even
|
|
271
|
-
approved hooks. `provision --with-defaults` also applies legacy dependency links
|
|
272
|
-
where they do not overlap an explicit copy policy (used by branch creation).
|
|
273
|
-
|
|
274
|
-
`gx agents status` prints its header before Git probes and then each completed
|
|
275
|
-
session row on a terminal. Redirected text and `--json` retain their prior format.
|
|
276
|
-
This is progressive display, not a claim that Git collection is faster.
|
|
277
|
-
|
|
278
|
-
These adaptations were inspired by [Worktrunk](https://github.com/max-sixty/worktrunk),
|
|
279
|
-
not implemented by adding a second worktree manager. Reproduce the local copy
|
|
280
|
-
comparison with `node scripts/benchmark-provision.js`; it reports repeated-run
|
|
281
|
-
timings and allocation accounting, not universal performance or storage savings.
|
|
282
|
-
|
|
283
|
-
### Native worktree navigation
|
|
284
|
-
|
|
285
|
-
```bash
|
|
286
|
-
eval "$(gx shell-init bash)" # zsh supported too; fish: gx shell-init fish | source
|
|
287
|
-
gx switch agent/bot/my-task # registered branch, worktree path, or "-" for previous
|
|
288
|
-
gx switch pr:123 --create # GitHub PR (requires gh); creation uses GX safety gates
|
|
289
|
-
gx switch # terminal picker with diff-stat and PR preview
|
|
290
|
-
gx switch agent/bot/my-task --json
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
Without shell integration, `gx switch` prints the destination; it cannot change
|
|
294
|
-
the parent shell's directory. `--print` is path-only and `--json` is structured
|
|
295
|
-
output. Navigation does not change the primary checkout. `--create` provisions
|
|
296
|
-
a GX agent lane from an existing branch or PR head, retaining quotas and claims,
|
|
297
|
-
not a second worktree manager. PR URLs must match this repository; fork PR heads
|
|
298
|
-
are fetched through the origin repository's numbered PR ref and verified by SHA.
|
|
299
|
-
|
|
300
|
-
### Approved lifecycle hooks
|
|
301
|
-
|
|
302
|
-
Alongside the existing `provision.postCreate`, configure named lifecycle events:
|
|
303
|
-
|
|
304
|
-
```json
|
|
305
|
-
{
|
|
306
|
-
"hooks": {
|
|
307
|
-
"pre-start": ["npm ci", { "build": "npm run build", "lint": "npm run lint" }],
|
|
308
|
-
"pre-merge": "npm test",
|
|
309
|
-
"post-start": "echo Ready"
|
|
310
|
-
},
|
|
311
|
-
"hookTimeoutMs": 600000
|
|
312
|
-
}
|
|
313
|
-
```
|
|
314
|
-
|
|
315
|
-
An array is an ordered pipeline; commands in a named object run concurrently,
|
|
316
|
-
and the next stage waits for all of them to succeed. Pre hooks block; post hooks
|
|
317
|
-
run in the background with per-run output and status files.
|
|
318
|
-
|
|
319
|
-
```bash
|
|
320
|
-
gx worktree hook approve pre-start --source /path/to/repo
|
|
321
|
-
gx worktree hook approve pre-merge --source /path/to/repo
|
|
322
|
-
gx worktree hook approve post-start --source /path/to/repo
|
|
323
|
-
gx worktree hook pre-start --source /path/to/repo --worktree /path/to/lane --dry-run
|
|
324
|
-
gx worktree hook logs --source /path/to/repo --json
|
|
325
|
-
gx worktree hook approve pre-start --source /path/to/repo --revoke
|
|
326
|
-
```
|
|
327
|
-
|
|
328
|
-
Consent is interactive and local, bound to the repository, event, exact ordered
|
|
329
|
-
commands and timeout. Changes require approval again. These approvals are separate
|
|
330
|
-
from legacy `postCreate`; `--yes` cannot approve shell execution. State lives under
|
|
331
|
-
the Guardex user's `.config/gitguardex/lifecycle-hooks/`, outside the repository.
|
|
332
|
-
Approved commands are arbitrary shell code, not sandboxed; invoked scripts can
|
|
333
|
-
change independently of the approved command text.
|
|
334
|
-
|
|
335
|
-
Events are `pre-*` and `post-*` for `start`, `switch`, `commit`, `merge`,
|
|
336
|
-
and `remove`. Start hooks run after provisioning but before readiness, then
|
|
337
|
-
after successful initialization; reduced provisioning modes skip them. Switch
|
|
338
|
-
hooks surround destination selection, before the shell consumes its path.
|
|
339
|
-
Commit hooks surround GX finish's auto-commit (not unrelated manual Git commits).
|
|
340
|
-
Merge hooks supplement, never replace, existing PR/merge gates: a pre-merge hook
|
|
341
|
-
that changes the source revision or leaves changes aborts the merge.
|
|
342
|
-
Removal hooks apply to guarded prune and deferred finish cleanup, not internal
|
|
343
|
-
temporary integration/probe trees. A failed pre-remove preserves the worktree;
|
|
344
|
-
post-remove runs from the surviving repository, with `GUARDEX_WORKTREE` retaining
|
|
345
|
-
the removed path. Hooks also receive `GUARDEX_REPO_ROOT`, `GUARDEX_BRANCH` and
|
|
346
|
-
`GUARDEX_HOOK_EVENT`. `GUARDEX_PROVISION_HOOKS=0` disables hooks explicitly.
|
|
347
|
-
|
|
348
|
-
### Explicit ignored-file copy
|
|
349
|
-
|
|
350
|
-
```bash
|
|
351
|
-
gx worktree copy-ignored --source /path/to/repo --target /path/to/lane --dry-run --json
|
|
352
|
-
gx worktree copy-ignored --source /path/to/repo --target /path/to/lane
|
|
353
|
-
```
|
|
354
|
-
|
|
355
|
-
Only ignored files are eligible. Optional source `.worktreeinclude` narrows the
|
|
356
|
-
selection using Git's ignore-pattern syntax, for example `node_modules/**`
|
|
357
|
-
followed by `!node_modules/private/`. Existing or tracked target files are never
|
|
358
|
-
overwritten, and symlink escapes and nested repositories are rejected. This
|
|
359
|
-
explicit command does not broaden the normal branch-start copy policy.
|
|
360
|
-
GX runtime/ownership directories are excluded, including aliases pointing into
|
|
361
|
-
them. Foreign file claims and malformed lock registries block copying. Shared
|
|
362
|
-
remote-lock mode currently refuses this command rather than bypassing remote
|
|
363
|
-
ownership or fetching state during a read-only dry-run.
|
|
364
|
-
See [third-party attribution](THIRD-PARTY-NOTICES.md).
|
|
365
|
-
|
|
366
|
-
## Code-assist review gate
|
|
367
|
-
|
|
368
|
-
Add `--gate-review` to review the PR before merge. Add `--gate-autofix` to let
|
|
369
|
-
the agent repair blocking findings and run the review again.
|
|
370
|
-
|
|
371
|
-
```bash
|
|
372
|
-
gx branch finish --via-pr --wait-for-merge --cleanup \
|
|
373
|
-
--gate-review --gate-autofix
|
|
374
|
-
```
|
|
375
|
-
|
|
376
|
-
High and critical findings block the merge. The review is posted directly on
|
|
377
|
-
the PR as a readable severity, location, and finding table.
|
|
378
|
-
If the PR diff exceeds the review size limit, the merge gate stops before
|
|
379
|
-
launching the reviewer. Split the PR into smaller changes and rerun the gate.
|
|
380
|
-
A standalone `gx pr-review` can still produce an advisory report marked partial.
|
|
381
|
-
Both `gx pr-review` and the finish gate use Codex first. If the Codex CLI cannot
|
|
382
|
-
launch, they try Claude. Timeouts, failed or invalid reviews, and findings do not
|
|
383
|
-
trigger a switch. Use `--provider` or `--review-provider` to pin one provider.
|
|
384
|
-
|
|
385
|
-
After a clean review, normal gated finishes run the repository preflight while
|
|
386
|
-
GitHub CI runs. The final publish still requires both and checks the exact head
|
|
387
|
-
and base. After an interruption, rerun the same finish command: an unchanged
|
|
388
|
-
review policy and revision can reuse a recent Codex verdict if it is still the
|
|
389
|
-
latest, unchanged review on GitHub. A mandatory trusted-base CI fallback
|
|
390
|
-
preflight is never replaced by the regular preflight receipt.
|
|
391
|
-
|
|
392
|
-
Set `GUARDEX_REVIEW_COMPACT_DIFF=1` to try a smaller review prompt for large npm
|
|
393
|
-
lockfile patches. Only unchanged generated context is compacted; changed lines
|
|
394
|
-
and their coordinates are kept. The original diff is still used for coverage,
|
|
395
|
-
anchors and Abide. This opt-in does not apply to PR Lens.
|
|
396
|
-
|
|
397
|
-
For a repository that intentionally disables its GitHub Actions workflows,
|
|
398
|
-
enable the local CI fallback from that checkout:
|
|
399
|
-
|
|
400
|
-
```bash
|
|
401
|
-
git config --local multiagent.ciFallbackWhenDisabled true
|
|
402
|
-
```
|
|
403
|
-
|
|
404
|
-
After the normal CI registration grace period, the gate accepts zero check
|
|
405
|
-
runs only if GitHub confirms a nonempty workflow list with every workflow
|
|
406
|
-
manually disabled and reports the reviewed PR as mergeable. A clean review
|
|
407
|
-
and a successful target-aware preflight from the trusted base are still
|
|
408
|
-
required. Missing or unverified workflow state, pending or failed checks,
|
|
409
|
-
and GitHub branch protection are not bypassed.
|
|
410
|
-
|
|
411
|
-
<p align="center">
|
|
412
|
-
<a href="https://github.com/projects-kssk/Wireless_KFB_Project/pull/165">
|
|
413
|
-
<img alt="GitGuardex code-assist blocking a PR with review findings" src="https://raw.githubusercontent.com/recodeee/gitguardex/main/docs/images/code-assist-review-gate.png" width="920">
|
|
414
|
-
</a>
|
|
415
|
-
</p>
|
|
416
|
-
|
|
417
|
-
<p align="center">
|
|
418
|
-
<sub>
|
|
419
|
-
Real example: <a href="https://github.com/projects-kssk/Wireless_KFB_Project/pull/165">Wireless_KFB_Project PR #165</a>
|
|
420
|
-
· <a href="https://raw.githubusercontent.com/recodeee/gitguardex/main/docs/images/code-assist-review-gate.png">open the full-size screenshot</a>
|
|
421
|
-
</sub>
|
|
422
|
-
</p>
|
|
423
|
-
|
|
424
|
-
---
|
|
425
|
-
|
|
426
|
-
## Essential commands
|
|
427
|
-
|
|
428
|
-
| Command | Purpose |
|
|
429
|
-
| --- | --- |
|
|
430
|
-
| `gx` / `gx status` | Show repo safety and the next action. |
|
|
431
|
-
| `gx setup` | Install or refresh Guardex in a repo. |
|
|
432
|
-
| `gx doctor` | Repair Guardex drift. |
|
|
433
|
-
| `gx branch start "task" "agent"` | Create an isolated task lane. |
|
|
434
|
-
| `gx locks claim --branch <branch> <files...>` | Claim files before editing. |
|
|
435
|
-
| `gx branch finish --via-pr --wait-for-merge --cleanup` | Ship safely through a PR. |
|
|
436
|
-
| `gx branch finish --fast` | Squash-merge a locally verified small change without local preflight or AI review. |
|
|
437
|
-
| `gx agents status` | Show active agent lanes. |
|
|
438
|
-
| `gx agents send --session <id> --message <text>` | Deliver safely to an idle agent or queue for its next turn. |
|
|
439
|
-
| `gx agents inbox [--ack <message-id>]` | Read or acknowledge the authenticated standalone message queue. |
|
|
440
|
-
| `gx cleanup` | Prune merged or stale worktrees. |
|
|
441
|
-
|
|
442
|
-
Need the terminal cockpit? Run `gx cockpit`; see the
|
|
443
|
-
[cockpit guide](./docs/agents-cockpit.md). Run `gx --help` for every command.
|
|
444
|
-
|
|
445
|
-
---
|
|
446
|
-
|
|
447
|
-
<details>
|
|
448
|
-
<summary><strong>Advanced setup and maintainer notes</strong></summary>
|
|
449
|
-
|
|
450
|
-
### AGENTS.md safety block
|
|
451
|
-
|
|
452
|
-
GitGuardex preserves your instructions. It only manages content between:
|
|
453
|
-
|
|
454
|
-
```text
|
|
455
|
-
<!-- multiagent-safety:START -->
|
|
456
|
-
<!-- multiagent-safety:END -->
|
|
457
|
-
```
|
|
458
|
-
|
|
459
|
-
### Agent skills
|
|
460
|
-
|
|
461
|
-
```bash
|
|
462
|
-
npx skills add recodee/gitguardex
|
|
463
|
-
npx skills add recodee/ # browse the namespace
|
|
464
|
-
```
|
|
465
|
-
|
|
466
|
-
`gx setup` does not auto-run `npx skills add ...`. If the picker does not show a separate `guardex` skill, that is expected; use the `gitguardex` skill.
|
|
467
|
-
|
|
468
|
-
### Package releases
|
|
469
|
-
|
|
470
|
-
```bash
|
|
471
|
-
gx release # create/update the current GitHub release from README notes
|
|
472
|
-
```
|
|
473
|
-
|
|
474
|
-
`gx release` is the maintainer path for package releases. It reads `README.md`,
|
|
475
|
-
finds the last published GitHub release, and writes one grouped GitHub release body.
|
|
476
|
-
|
|
477
|
-
</details>
|
|
11
|
+
See the [project README](https://github.com/opencue/gitguardex#readme) for setup
|
|
12
|
+
and workflows, and the [repository](https://github.com/opencue/gitguardex)
|
|
13
|
+
for source and contributing information.
|
|
478
14
|
|
|
479
15
|
## Release notes
|
|
480
16
|
|
|
481
|
-
|
|
482
|
-
<summary><strong>v8.x</strong></summary>
|
|
483
|
-
|
|
484
|
-
### v8.4.0
|
|
485
|
-
- Added authenticated agent messaging that delivers live when safe and queues
|
|
486
|
-
durably when Nodeterm or tmux delivery is unavailable.
|
|
487
|
-
- Added worktree-shared CLI and MCP inbox operations for reading and
|
|
488
|
-
acknowledging queued agent messages.
|
|
489
|
-
- Improved stale Codex worktree recovery and VS Code visibility for managed
|
|
490
|
-
worktrees.
|
|
491
|
-
|
|
492
|
-
### v8.3.0
|
|
493
|
-
- Added adaptive direct-main agent work and branch-targeted `gx sync`.
|
|
494
|
-
- Made worktree cleanup safer by preserving active or locked lanes while pruning
|
|
495
|
-
only eligible merged or opted-in clean lanes.
|
|
496
|
-
- Persisted and validated explicit finish bases, recognized SHA-256 null object
|
|
497
|
-
IDs, and prevented stale VS Code worktree providers.
|
|
498
|
-
|
|
499
|
-
### v8.2.0
|
|
500
|
-
- Reduced agent preflight and finish token overhead.
|
|
501
|
-
- Preserved dirty worktrees during stale-worktree cleanup and exposed
|
|
502
|
-
command-specific cleanup help.
|
|
503
|
-
- Added the owning tmux pane and worktree to file-lock conflict output.
|
|
504
|
-
|
|
505
|
-
### v8.1.1
|
|
506
|
-
- Prevented `gx doctor` from pruning dirty detached or managed worktrees during
|
|
507
|
-
stale-worktree repair.
|
|
508
|
-
|
|
509
|
-
### v8.1.0
|
|
510
|
-
- Added shared Git lock state so independent clones coordinate file ownership.
|
|
511
|
-
- Aligned npm repository metadata with `opencue/gitguardex` for trusted OIDC
|
|
512
|
-
publishing.
|
|
513
|
-
|
|
514
|
-
### v8.0.0
|
|
515
|
-
- Added `gx branch finish --fast` for small tasks that should use the PR +
|
|
516
|
-
squash-merge path without repeating local preflight or opt-in AI review.
|
|
517
|
-
- Removed the legacy `cr.yml` AI-review workflow; repository policy and explicit
|
|
518
|
-
Guardex review gates now control merge readiness.
|
|
519
|
-
|
|
520
|
-
</details>
|
|
521
|
-
|
|
522
|
-
<details>
|
|
523
|
-
<summary><strong>v7.x</strong></summary>
|
|
524
|
-
|
|
525
|
-
### v7.1.1
|
|
526
|
-
- Bumped `@imdeadpool/guardex` from `7.1.0` to `7.1.1` so the current
|
|
527
|
-
`main` payload can publish under a fresh npm version after `7.1.0` reached
|
|
528
|
-
the registry.
|
|
529
|
-
- Direct maintainer `npm publish` now checks npm during `prepublishOnly` and
|
|
530
|
-
bumps package release metadata to the next unpublished patch version when the
|
|
531
|
-
committed version is already published. GitHub Actions release publishes keep
|
|
532
|
-
the committed metadata so packed and signed assets stay aligned.
|
|
533
|
-
|
|
534
|
-
</details>
|
|
535
|
-
|
|
536
|
-
---
|
|
537
|
-
|
|
538
|
-
<p align="center">
|
|
539
|
-
<a href="https://github.com/recodeee/gitguardex/issues">Issues</a> ·
|
|
540
|
-
<a href="./CONTRIBUTING.md">Contributing</a> ·
|
|
541
|
-
<a href="./SECURITY.md">Security</a>
|
|
542
|
-
</p>
|
|
17
|
+
See the [GitHub releases](https://github.com/opencue/gitguardex/releases).
|
package/SECURITY.md
CHANGED
|
@@ -8,7 +8,7 @@ Only the latest published GitGuardex CLI build is supported for security fixes.
|
|
|
8
8
|
|
|
9
9
|
Please report security issues privately by opening a GitHub security advisory:
|
|
10
10
|
|
|
11
|
-
- https://github.com/
|
|
11
|
+
- https://github.com/opencue/gitguardex/security/advisories/new
|
|
12
12
|
|
|
13
13
|
If advisories are unavailable, open a private report via GitHub issue contact details and avoid posting exploit details publicly.
|
|
14
14
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imdeadpool/guardex",
|
|
3
|
-
"version": "8.4.
|
|
3
|
+
"version": "8.4.16",
|
|
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,39 +10,6 @@
|
|
|
10
10
|
"gx": "bin/multiagent-safety.js",
|
|
11
11
|
"multiagent-safety": "bin/multiagent-safety.js"
|
|
12
12
|
},
|
|
13
|
-
"scripts": {
|
|
14
|
-
"test": "node --test test/*.test.js",
|
|
15
|
-
"test:coverage": "node scripts/run-coverage-gate.js",
|
|
16
|
-
"lint": "biome lint bin src scripts test",
|
|
17
|
-
"format": "biome format --write bin src scripts test",
|
|
18
|
-
"format:check": "biome format bin src scripts test",
|
|
19
|
-
"format:check:changed": "node scripts/check-changed-format.js",
|
|
20
|
-
"package:check": "node --check bin/multiagent-safety.js && bash scripts/check-script-symlinks.sh && npm pack --dry-run",
|
|
21
|
-
"verify": "npm run format:check:changed && npm run lint && npm test && npm run package:check",
|
|
22
|
-
"prepublishOnly": "node scripts/prepublish-bump-version.js",
|
|
23
|
-
"postinstall": "node -e \"require('./src/heavy').installReport()\"",
|
|
24
|
-
"agent:codex": "bash ./scripts/codex-agent.sh",
|
|
25
|
-
"agent:branch:start": "bash ./scripts/agent-branch-start.sh",
|
|
26
|
-
"agent:branch:finish": "bash ./scripts/agent-branch-finish.sh",
|
|
27
|
-
"agent:branch:merge": "bash ./scripts/agent-branch-merge.sh",
|
|
28
|
-
"agent:cleanup": "gx cleanup",
|
|
29
|
-
"agent:hooks:install": "bash ./scripts/install-agent-git-hooks.sh",
|
|
30
|
-
"guardex:install-global": "bash ./scripts/install-global-hooks.sh",
|
|
31
|
-
"agent:locks:claim": "python3 ./scripts/agent-file-locks.py claim",
|
|
32
|
-
"agent:locks:allow-delete": "python3 ./scripts/agent-file-locks.py allow-delete",
|
|
33
|
-
"agent:locks:release": "python3 ./scripts/agent-file-locks.py release",
|
|
34
|
-
"agent:locks:status": "python3 ./scripts/agent-file-locks.py status",
|
|
35
|
-
"agent:plan:init": "bash ./scripts/openspec/init-plan-workspace.sh",
|
|
36
|
-
"agent:protect:list": "gx protect list",
|
|
37
|
-
"agent:branch:sync": "gx sync",
|
|
38
|
-
"agent:branch:sync:check": "gx sync --check",
|
|
39
|
-
"agent:safety:setup": "gx setup",
|
|
40
|
-
"agent:safety:scan": "gx status --strict",
|
|
41
|
-
"agent:safety:fix": "gx setup --repair",
|
|
42
|
-
"agent:safety:doctor": "gx doctor",
|
|
43
|
-
"agent:review:watch": "bash ./scripts/review-bot-watch.sh",
|
|
44
|
-
"agent:finish": "gx finish --all"
|
|
45
|
-
},
|
|
46
13
|
"engines": {
|
|
47
14
|
"node": ">=18"
|
|
48
15
|
},
|
|
@@ -90,13 +57,13 @@
|
|
|
90
57
|
"publishConfig": {
|
|
91
58
|
"access": "public"
|
|
92
59
|
},
|
|
93
|
-
"devDependencies": {
|
|
94
|
-
"@biomejs/biome": "1.9.4",
|
|
95
|
-
"fast-check": "3.23.2"
|
|
96
|
-
},
|
|
97
60
|
"dependencies": {
|
|
98
61
|
"jsonc-parser": "3.3.1",
|
|
99
62
|
"semver": "7.7.4"
|
|
100
63
|
},
|
|
101
|
-
"
|
|
64
|
+
"scripts": {
|
|
65
|
+
"prepublishOnly": "node scripts/prepublish-bump-version.js",
|
|
66
|
+
"postinstall": "node -e \"require('./src/heavy').installReport()\""
|
|
67
|
+
},
|
|
68
|
+
"gitHead": "43fb1dc08dedd0753077cc987321abe0aba4d8f6"
|
|
102
69
|
}
|