@imdeadpool/guardex 5.0.11 → 5.0.12
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/README.md +50 -9
- package/bin/multiagent-safety.js +27 -0
- package/package.json +4 -4
- package/templates/AGENTS.multiagent-safety.md +1 -1
- package/templates/codex/skills/guardex/SKILL.md +48 -0
- package/templates/codex/skills/guardex-merge-skills-to-dev/SKILL.md +58 -0
- package/templates/github/pull.yml.example +6 -0
- package/templates/github/workflows/cr.yml +21 -0
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# GuardeX — Guardian T-Rex for your repo
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@imdeadpool/guardex)
|
|
4
|
-
[](https://github.com/recodeee/guardex/actions/workflows/ci.yml)
|
|
5
|
+
[](https://securityscorecards.dev/viewer/?uri=github.com/recodeee/guardex)
|
|
6
6
|
|
|
7
7
|
GuardeX is a safety layer for parallel Codex/agent work in git repos.
|
|
8
8
|
|
|
@@ -17,7 +17,7 @@ Progress became **de-progressive**: more activity, less real forward movement.
|
|
|
17
17
|
|
|
18
18
|
GuardeX exists to stop that loop.
|
|
19
19
|
|
|
20
|
-

|
|
21
21
|
|
|
22
22
|
```mermaid
|
|
23
23
|
flowchart LR
|
|
@@ -81,23 +81,23 @@ gx finish --all
|
|
|
81
81
|
|
|
82
82
|
### Setup status
|
|
83
83
|
|
|
84
|
-

|
|
85
85
|
|
|
86
86
|
### Service logs/status
|
|
87
87
|
|
|
88
|
-

|
|
89
89
|
|
|
90
90
|
### Branch/worktree start protocol
|
|
91
91
|
|
|
92
|
-

|
|
93
93
|
|
|
94
94
|
### Lock + delete guard protocol
|
|
95
95
|
|
|
96
|
-

|
|
97
97
|
|
|
98
98
|
### Real VS Code Source Control layout (exact screenshot)
|
|
99
99
|
|
|
100
|
-

|
|
101
101
|
|
|
102
102
|
## Copy-paste: common commands
|
|
103
103
|
|
|
@@ -141,7 +141,7 @@ gx cleanup --watch --interval 60
|
|
|
141
141
|
|
|
142
142
|
# scan/report
|
|
143
143
|
gx scan
|
|
144
|
-
gx report scorecard --repo github.com/
|
|
144
|
+
gx report scorecard --repo github.com/recodeee/guardex
|
|
145
145
|
```
|
|
146
146
|
|
|
147
147
|
### Continuous Codex PR monitor (local codex-auth session)
|
|
@@ -241,6 +241,40 @@ gh --version
|
|
|
241
241
|
gh auth status
|
|
242
242
|
```
|
|
243
243
|
|
|
244
|
+
## Optional GitHub Apps: fork sync + PR review
|
|
245
|
+
|
|
246
|
+
### Pull app (Probot fork sync)
|
|
247
|
+
|
|
248
|
+
GuardeX setup now installs a starter file at `.github/pull.yml.example`.
|
|
249
|
+
|
|
250
|
+
To enable fork auto-sync:
|
|
251
|
+
|
|
252
|
+
```sh
|
|
253
|
+
cp .github/pull.yml.example .github/pull.yml
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
Then edit `.github/pull.yml`:
|
|
257
|
+
|
|
258
|
+
- set `rules[].base` to your fork branch (`main`, `master`, or `dev`)
|
|
259
|
+
- set `rules[].upstream` to `<upstream-owner>:<branch>`
|
|
260
|
+
|
|
261
|
+
Install the app: <https://github.com/apps/pull>
|
|
262
|
+
Validate config: `https://pull.git.ci/check/<owner>/<repo>`
|
|
263
|
+
|
|
264
|
+
### CR-GPT code review app
|
|
265
|
+
|
|
266
|
+
Install app: <https://github.com/apps/cr-gpt>
|
|
267
|
+
|
|
268
|
+
`gx setup` also installs `.github/workflows/cr.yml` (GitHub Actions review workflow).
|
|
269
|
+
|
|
270
|
+
Then in your repo:
|
|
271
|
+
|
|
272
|
+
1. `Settings -> Secrets and variables -> Actions`
|
|
273
|
+
2. open `Variables`
|
|
274
|
+
3. add `OPENAI_API_KEY`
|
|
275
|
+
|
|
276
|
+
After that, the app reviews new and updated pull requests automatically.
|
|
277
|
+
|
|
244
278
|
## Companion dependency: `codex-auth` account switcher
|
|
245
279
|
|
|
246
280
|
For multi-identity Codex workflows, GuardeX pairs with
|
|
@@ -276,6 +310,8 @@ scripts/openspec/init-plan-workspace.sh
|
|
|
276
310
|
.githooks/pre-push
|
|
277
311
|
.codex/skills/guardex/SKILL.md
|
|
278
312
|
.claude/commands/guardex.md
|
|
313
|
+
.github/pull.yml.example
|
|
314
|
+
.github/workflows/cr.yml
|
|
279
315
|
.omx/state/agent-file-locks.json
|
|
280
316
|
```
|
|
281
317
|
|
|
@@ -328,6 +364,11 @@ npm pack --dry-run
|
|
|
328
364
|
|
|
329
365
|
## Release notes
|
|
330
366
|
|
|
367
|
+
### v5.0.12
|
|
368
|
+
|
|
369
|
+
- Bumped package version from `5.0.11` to `5.0.12` for the next npm publish.
|
|
370
|
+
- Updated repository metadata and README links to the renamed GitHub repository (`recodeee/guardex`).
|
|
371
|
+
|
|
331
372
|
### v5.0.11
|
|
332
373
|
|
|
333
374
|
- Updated the managed AGENTS contract wording to use `GX` naming and added an explicit OMX completion policy requiring commit + push + PR creation/update at task completion.
|
package/bin/multiagent-safety.js
CHANGED
|
@@ -50,7 +50,10 @@ const TEMPLATE_FILES = [
|
|
|
50
50
|
'githooks/pre-commit',
|
|
51
51
|
'githooks/pre-push',
|
|
52
52
|
'codex/skills/guardex/SKILL.md',
|
|
53
|
+
'codex/skills/guardex-merge-skills-to-dev/SKILL.md',
|
|
53
54
|
'claude/commands/guardex.md',
|
|
55
|
+
'github/pull.yml.example',
|
|
56
|
+
'github/workflows/cr.yml',
|
|
54
57
|
];
|
|
55
58
|
|
|
56
59
|
const EXECUTABLE_RELATIVE_PATHS = new Set([
|
|
@@ -97,6 +100,7 @@ const MANAGED_GITIGNORE_PATHS = [
|
|
|
97
100
|
'.githooks/pre-push',
|
|
98
101
|
'oh-my-codex/',
|
|
99
102
|
'.codex/skills/guardex/SKILL.md',
|
|
103
|
+
'.codex/skills/guardex-merge-skills-to-dev/SKILL.md',
|
|
100
104
|
'.claude/commands/guardex.md',
|
|
101
105
|
LOCK_FILE_RELATIVE,
|
|
102
106
|
];
|
|
@@ -230,6 +234,25 @@ const AI_SETUP_PROMPT = `Use this exact checklist to setup GuardeX (Guardian T-R
|
|
|
230
234
|
|
|
231
235
|
11) Optional (GitHub remote cleanup): enable:
|
|
232
236
|
Settings -> General -> Pull Requests -> Automatically delete head branches
|
|
237
|
+
|
|
238
|
+
12) Optional (fork sync with Pull app):
|
|
239
|
+
cp .github/pull.yml.example .github/pull.yml
|
|
240
|
+
# then edit .github/pull.yml:
|
|
241
|
+
# - set rules[].base to your fork branch (main/master/dev)
|
|
242
|
+
# - set rules[].upstream to upstream-owner:branch
|
|
243
|
+
# install app: https://github.com/apps/pull
|
|
244
|
+
# validate config: https://pull.git.ci/check/<owner>/<repo>
|
|
245
|
+
|
|
246
|
+
13) Optional (PR review bot with cr-gpt GitHub App):
|
|
247
|
+
- install app: https://github.com/apps/cr-gpt
|
|
248
|
+
- in GitHub repo Settings -> Secrets and variables -> Actions -> Variables:
|
|
249
|
+
add OPENAI_API_KEY (your API key)
|
|
250
|
+
- the app reviews new/updated pull requests automatically
|
|
251
|
+
|
|
252
|
+
14) Optional: test PR review action workflow
|
|
253
|
+
- gx setup installs .github/workflows/cr.yml
|
|
254
|
+
- open or update a PR
|
|
255
|
+
- check Actions -> "Code Review" run logs + PR timeline comments
|
|
233
256
|
`;
|
|
234
257
|
|
|
235
258
|
const AI_SETUP_COMMANDS = `npm i -g @imdeadpool/guardex
|
|
@@ -249,6 +272,7 @@ openspec update
|
|
|
249
272
|
gx protect add release staging
|
|
250
273
|
gx sync --check
|
|
251
274
|
gx sync
|
|
275
|
+
cp .github/pull.yml.example .github/pull.yml
|
|
252
276
|
`;
|
|
253
277
|
|
|
254
278
|
const SCORECARD_RISK_BY_CHECK = {
|
|
@@ -452,6 +476,9 @@ function toDestinationPath(relativeTemplatePath) {
|
|
|
452
476
|
if (relativeTemplatePath.startsWith('claude/')) {
|
|
453
477
|
return `.${relativeTemplatePath}`;
|
|
454
478
|
}
|
|
479
|
+
if (relativeTemplatePath.startsWith('github/')) {
|
|
480
|
+
return `.${relativeTemplatePath}`;
|
|
481
|
+
}
|
|
455
482
|
throw new Error(`Unsupported template path: ${relativeTemplatePath}`);
|
|
456
483
|
}
|
|
457
484
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imdeadpool/guardex",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.12",
|
|
4
4
|
"description": "GuardeX: the Guardian T-Rex for your repo, with hardened multi-agent git guardrails.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"preferGlobal": true,
|
|
@@ -54,12 +54,12 @@
|
|
|
54
54
|
"author": "recodeecom",
|
|
55
55
|
"repository": {
|
|
56
56
|
"type": "git",
|
|
57
|
-
"url": "git+https://github.com/
|
|
57
|
+
"url": "git+https://github.com/recodeee/guardex.git"
|
|
58
58
|
},
|
|
59
59
|
"bugs": {
|
|
60
|
-
"url": "https://github.com/
|
|
60
|
+
"url": "https://github.com/recodeee/guardex/issues"
|
|
61
61
|
},
|
|
62
|
-
"homepage": "https://github.com/
|
|
62
|
+
"homepage": "https://github.com/recodeee/guardex#readme",
|
|
63
63
|
"funding": "https://github.com/sponsors/recodeecom",
|
|
64
64
|
"publishConfig": {
|
|
65
65
|
"access": "public"
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
- If codex-agent auto-finish cannot complete, immediately run `scripts/agent-branch-finish.sh --branch "<agent-branch>" --via-pr --wait-for-merge` and keep the branch open until checks/review pass.
|
|
20
20
|
- If merge/rebase conflicts block auto-finish, run a conflict-resolution review pass in that sandbox branch, then rerun `agent-branch-finish.sh --via-pr` until merged.
|
|
21
21
|
- Completion is not valid until these are true: commit exists on the agent branch, branch is pushed to `origin`, and PR/merge status is produced by `agent-branch-finish.sh` or `codex-agent`.
|
|
22
|
-
- For every new task, if an assigned agent sub-branch/worktree is already open, continue in that sub-branch; otherwise create a fresh one from the current local base snapshot with `scripts/agent-branch-start.sh`.
|
|
22
|
+
- For every new task, including follow-up work in the same chat/session, if an assigned agent sub-branch/worktree is already open, continue in that sub-branch; otherwise create a fresh one from the current local base snapshot with `scripts/agent-branch-start.sh`.
|
|
23
23
|
- Never implement directly on the local/base branch checkout; keep it unchanged and perform all edits in the agent sub-branch/worktree.
|
|
24
24
|
- If the change publishes or bumps a version, the same change must also update release notes/changelog entries.
|
|
25
25
|
|
|
@@ -38,4 +38,52 @@ gx scan
|
|
|
38
38
|
- For one-command Codex sandbox startup, use `bash scripts/codex-agent.sh "<task>" "<agent-name>"`.
|
|
39
39
|
- `scripts/codex-agent.sh` auto-syncs the sandbox branch against base before each task and auto-finishes merge/PR flow after Codex exits.
|
|
40
40
|
- Auto-finish keeps the branch/worktree by default; remove merged branches explicitly with `gx cleanup` (or `gx cleanup --branch "<agent-branch>"`).
|
|
41
|
+
- For skill-file-only merges into the local base branch (`dev` by default), use `$guardex-merge-skills-to-dev`.
|
|
41
42
|
- Do not bypass protected branch safeguards unless explicitly required.
|
|
43
|
+
|
|
44
|
+
## Bulk merge runbook (changed agent branches)
|
|
45
|
+
|
|
46
|
+
Use this when a repo has many `agent/*` branches/worktrees with pending changes and you need them merged into the base branch quickly.
|
|
47
|
+
|
|
48
|
+
1. Confirm base and guardrails are healthy:
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
git status --short --branch
|
|
52
|
+
git pull --ff-only origin "$(git config --get multiagent.baseBranch || echo dev)"
|
|
53
|
+
gx scan
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
2. Run bulk finish first:
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
gx finish --all
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
3. If a branch fails with `already used by worktree` or stale rebase hints, clear the stale state in that worktree, then retry targeted finish:
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
git -C "<worktree>" rebase --abort || true
|
|
66
|
+
gx finish --branch "<agent-branch>" --base "$(git config --get multiagent.baseBranch || echo dev)" --no-wait-for-merge --cleanup
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
4. If `gh pr merge` exits non-zero due local branch deletion but PR is already merged, treat it as merged and verify with:
|
|
70
|
+
|
|
71
|
+
```sh
|
|
72
|
+
gh pr view "<pr-number>" --json state,mergedAt,url
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
5. If a branch is still ahead of base with no open PR, create and merge a follow-up PR manually:
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
gh pr create --base "<base-branch>" --head "<agent-branch>" --title "Auto-finish: <agent-branch>" --body "Follow-up merge for pending branch commits."
|
|
79
|
+
gh pr merge "<pr-number>" --squash --delete-branch
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
6. Final verification:
|
|
83
|
+
|
|
84
|
+
```sh
|
|
85
|
+
gh pr list --state open --search "head:agent/ base:<base-branch>"
|
|
86
|
+
git pull --ff-only origin "<base-branch>"
|
|
87
|
+
gx cleanup
|
|
88
|
+
gx scan
|
|
89
|
+
```
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: guardex-merge-skills-to-dev
|
|
3
|
+
description: "Use when you need to merge SKILL.md updates from agent branches/worktrees into the local base branch (default: dev) with the multiagent-safety flow."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# GuardeX Merge Skills to dev
|
|
7
|
+
|
|
8
|
+
Use this skill when you only want to promote Codex skill file updates into the base branch (normally `dev`) without editing the visible base checkout directly.
|
|
9
|
+
|
|
10
|
+
## What this merges
|
|
11
|
+
|
|
12
|
+
- `.codex/skills/**/SKILL.md`
|
|
13
|
+
- `templates/codex/skills/**/SKILL.md`
|
|
14
|
+
|
|
15
|
+
## Merge runbook (safe path)
|
|
16
|
+
|
|
17
|
+
1. Resolve the base branch:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
BASE_BRANCH="$(git config --get multiagent.baseBranch || echo dev)"
|
|
21
|
+
echo "$BASE_BRANCH"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
2. Start a dedicated integration sandbox from base:
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
bash scripts/agent-branch-start.sh "merge-skill-files-to-${BASE_BRANCH}" "skill-merge" "$BASE_BRANCH"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
3. Enter the sandbox worktree printed by the command above.
|
|
31
|
+
|
|
32
|
+
4. Pull only skill files from each source agent branch:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
SOURCE_BRANCH="<agent-branch>"
|
|
36
|
+
git checkout "$SOURCE_BRANCH" -- ':(glob).codex/skills/**/SKILL.md' ':(glob)templates/codex/skills/**/SKILL.md'
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
5. Verify scope before commit:
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
git status --short
|
|
43
|
+
git diff --name-only
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
6. Commit and merge back to base using guardex finish flow:
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
git add .codex/skills templates/codex/skills
|
|
50
|
+
git commit -m "Merge skill file updates into ${BASE_BRANCH}"
|
|
51
|
+
bash scripts/agent-branch-finish.sh --branch "$(git rev-parse --abbrev-ref HEAD)" --base "$BASE_BRANCH" --via-pr --wait-for-merge --cleanup
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Notes
|
|
55
|
+
|
|
56
|
+
- If a source branch has non-skill changes, this runbook keeps them out of the merge.
|
|
57
|
+
- If merge conflicts occur, resolve only within the skill files, then rerun `agent-branch-finish.sh`.
|
|
58
|
+
- Do not commit directly on `dev`/`main`; always merge through an agent branch/worktree.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: Code Review
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types: [opened, reopened, synchronize]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
pull-requests: write
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
review:
|
|
13
|
+
if: ${{ secrets.OPENAI_API_KEY != '' }}
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: anc95/ChatGPT-CodeReview@main
|
|
17
|
+
env:
|
|
18
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
19
|
+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
|
20
|
+
OPENAI_API_ENDPOINT: https://api.openai.com/v1
|
|
21
|
+
MODEL: gpt-4o-mini
|