@imdeadpool/guardex 7.0.8 → 7.0.11
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 +363 -360
- package/SECURITY.md +1 -1
- package/bin/multiagent-safety.js +30 -31
- package/package.json +6 -4
- package/templates/AGENTS.multiagent-safety.md +8 -8
- package/templates/claude/commands/gitguardex.md +5 -0
- package/templates/codex/skills/gitguardex/SKILL.md +11 -0
- package/templates/scripts/openspec/init-change-workspace.sh +2 -2
- package/templates/scripts/openspec/init-plan-workspace.sh +2 -2
- package/templates/claude/commands/guardex.md +0 -12
- package/templates/codex/skills/guardex/SKILL.md +0 -43
package/SECURITY.md
CHANGED
package/bin/multiagent-safety.js
CHANGED
|
@@ -7,14 +7,17 @@ const cp = require('node:child_process');
|
|
|
7
7
|
const packageJsonPath = path.resolve(__dirname, '..', 'package.json');
|
|
8
8
|
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
9
9
|
|
|
10
|
-
const TOOL_NAME = '
|
|
10
|
+
const TOOL_NAME = 'gitguardex';
|
|
11
11
|
const SHORT_TOOL_NAME = 'gx';
|
|
12
12
|
const LEGACY_NAMES = ['guardex', 'multiagent-safety'];
|
|
13
13
|
const OPENSPEC_PACKAGE = '@fission-ai/openspec';
|
|
14
|
+
const OMC_PACKAGE = 'oh-my-claude-sisyphus';
|
|
15
|
+
const CAVEMEM_PACKAGE = 'cavemem';
|
|
14
16
|
const GLOBAL_TOOLCHAIN_PACKAGES = [
|
|
15
17
|
'oh-my-codex',
|
|
16
|
-
|
|
18
|
+
OMC_PACKAGE,
|
|
17
19
|
OPENSPEC_PACKAGE,
|
|
20
|
+
CAVEMEM_PACKAGE,
|
|
18
21
|
'@imdeadpool/codex-account-switcher',
|
|
19
22
|
];
|
|
20
23
|
const GH_BIN = process.env.GUARDEX_GH_BIN || 'gh';
|
|
@@ -58,9 +61,9 @@ const TEMPLATE_FILES = [
|
|
|
58
61
|
'githooks/pre-push',
|
|
59
62
|
'githooks/post-merge',
|
|
60
63
|
'githooks/post-checkout',
|
|
61
|
-
'codex/skills/
|
|
64
|
+
'codex/skills/gitguardex/SKILL.md',
|
|
62
65
|
'codex/skills/guardex-merge-skills-to-dev/SKILL.md',
|
|
63
|
-
'claude/commands/
|
|
66
|
+
'claude/commands/gitguardex.md',
|
|
64
67
|
'github/pull.yml.example',
|
|
65
68
|
'github/workflows/cr.yml',
|
|
66
69
|
];
|
|
@@ -143,9 +146,9 @@ const MANAGED_GITIGNORE_PATHS = [
|
|
|
143
146
|
'.githooks/post-merge',
|
|
144
147
|
'.githooks/post-checkout',
|
|
145
148
|
'oh-my-codex/',
|
|
146
|
-
'.codex/skills/
|
|
149
|
+
'.codex/skills/gitguardex/SKILL.md',
|
|
147
150
|
'.codex/skills/guardex-merge-skills-to-dev/SKILL.md',
|
|
148
|
-
'.claude/commands/
|
|
151
|
+
'.claude/commands/gitguardex.md',
|
|
149
152
|
LOCK_FILE_RELATIVE,
|
|
150
153
|
];
|
|
151
154
|
const OMX_SCAFFOLD_DIRECTORIES = [
|
|
@@ -196,7 +199,7 @@ const SUGGESTIBLE_COMMANDS = [
|
|
|
196
199
|
'release',
|
|
197
200
|
];
|
|
198
201
|
const CLI_COMMAND_DESCRIPTIONS = [
|
|
199
|
-
['status', 'Show
|
|
202
|
+
['status', 'Show GitGuardex CLI + service health without modifying files'],
|
|
200
203
|
['setup', 'Install, repair, and verify guardrails (flags: --repair, --install-only, --target)'],
|
|
201
204
|
['doctor', 'Repair drift + verify (auto-sandboxes on protected main)'],
|
|
202
205
|
['protect', 'Manage protected branches (list/add/remove/set/reset)'],
|
|
@@ -223,24 +226,20 @@ const AGENT_BOT_DESCRIPTIONS = [
|
|
|
223
226
|
['agents', 'Start/stop review + cleanup bots for this repo'],
|
|
224
227
|
];
|
|
225
228
|
|
|
226
|
-
const AI_SETUP_PROMPT = `
|
|
227
|
-
|
|
228
|
-
1) Install:
|
|
229
|
-
2) Bootstrap:
|
|
230
|
-
3)
|
|
231
|
-
4)
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
9) Sync: gx sync --check && gx sync (optional; rebase onto base)
|
|
241
|
-
10) Fork sync: cp .github/pull.yml.example .github/pull.yml (optional; install https://github.com/apps/pull)
|
|
242
|
-
11) PR review bot: install https://github.com/apps/cr-gpt + set OPENAI_API_KEY in Actions variables (uses .github/workflows/cr.yml)
|
|
243
|
-
12) GitHub repo: enable Settings -> PRs -> Automatically delete head branches
|
|
229
|
+
const AI_SETUP_PROMPT = `GitGuardex (gx) setup checklist for Codex/Claude in this repo.
|
|
230
|
+
|
|
231
|
+
1) Install: npm i -g @imdeadpool/guardex && gh --version
|
|
232
|
+
2) Bootstrap: gx setup
|
|
233
|
+
3) Repair: gx doctor
|
|
234
|
+
4) Task loop: bash scripts/codex-agent.sh "<task>" "<agent>"
|
|
235
|
+
or branch-start -> claim -> branch-finish
|
|
236
|
+
5) Finish: gx finish --all
|
|
237
|
+
6) Cleanup: gx cleanup
|
|
238
|
+
7) OpenSpec: /opsx:propose -> /opsx:apply -> /opsx:archive
|
|
239
|
+
8) Optional: gx protect add release staging
|
|
240
|
+
9) Optional: gx sync --check && gx sync
|
|
241
|
+
10) Review bot: install https://github.com/apps/cr-gpt + set OPENAI_API_KEY
|
|
242
|
+
11) Fork sync: cp .github/pull.yml.example .github/pull.yml
|
|
244
243
|
`;
|
|
245
244
|
|
|
246
245
|
const AI_SETUP_COMMANDS = `npm i -g @imdeadpool/guardex
|
|
@@ -251,7 +250,7 @@ bash scripts/codex-agent.sh "<task>" "<agent>"
|
|
|
251
250
|
gx finish --all
|
|
252
251
|
gx cleanup
|
|
253
252
|
gx protect add release staging
|
|
254
|
-
gx sync
|
|
253
|
+
gx sync --check && gx sync
|
|
255
254
|
`;
|
|
256
255
|
|
|
257
256
|
const SCORECARD_RISK_BY_CHECK = {
|
|
@@ -808,7 +807,7 @@ function ensureAgentsSnippet(repoRoot, dryRun, options = {}) {
|
|
|
808
807
|
if (!dryRun) {
|
|
809
808
|
fs.writeFileSync(agentsPath, next, 'utf8');
|
|
810
809
|
}
|
|
811
|
-
return { status: 'updated', file: 'AGENTS.md', note: 'refreshed
|
|
810
|
+
return { status: 'updated', file: 'AGENTS.md', note: 'refreshed gitguardex-managed block' };
|
|
812
811
|
}
|
|
813
812
|
|
|
814
813
|
if (existing.includes(AGENTS_MARKER_START)) {
|
|
@@ -839,7 +838,7 @@ function ensureManagedGitignore(repoRoot, dryRun) {
|
|
|
839
838
|
if (!dryRun) {
|
|
840
839
|
fs.writeFileSync(gitignorePath, `${managedBlock}\n`, 'utf8');
|
|
841
840
|
}
|
|
842
|
-
return { status: 'created', file: '.gitignore', note: 'added
|
|
841
|
+
return { status: 'created', file: '.gitignore', note: 'added gitguardex-managed entries' };
|
|
843
842
|
}
|
|
844
843
|
|
|
845
844
|
const existing = fs.readFileSync(gitignorePath, 'utf8');
|
|
@@ -851,14 +850,14 @@ function ensureManagedGitignore(repoRoot, dryRun) {
|
|
|
851
850
|
if (!dryRun) {
|
|
852
851
|
fs.writeFileSync(gitignorePath, next, 'utf8');
|
|
853
852
|
}
|
|
854
|
-
return { status: 'updated', file: '.gitignore', note: 'refreshed
|
|
853
|
+
return { status: 'updated', file: '.gitignore', note: 'refreshed gitguardex-managed entries' };
|
|
855
854
|
}
|
|
856
855
|
|
|
857
856
|
const separator = existing.endsWith('\n') ? '\n' : '\n\n';
|
|
858
857
|
if (!dryRun) {
|
|
859
858
|
fs.writeFileSync(gitignorePath, `${existing}${separator}${managedBlock}\n`, 'utf8');
|
|
860
859
|
}
|
|
861
|
-
return { status: 'updated', file: '.gitignore', note: 'appended
|
|
860
|
+
return { status: 'updated', file: '.gitignore', note: 'appended gitguardex-managed entries' };
|
|
862
861
|
}
|
|
863
862
|
|
|
864
863
|
function configureHooks(repoRoot, dryRun) {
|
|
@@ -4717,7 +4716,7 @@ function setup(rawArgs) {
|
|
|
4717
4716
|
`[${TOOL_NAME}] ✅ Global tools installed (${(globalInstallStatus.packages || []).join(', ')}).`,
|
|
4718
4717
|
);
|
|
4719
4718
|
} else if (globalInstallStatus.status === 'already-installed') {
|
|
4720
|
-
console.log(`[${TOOL_NAME}] ✅
|
|
4719
|
+
console.log(`[${TOOL_NAME}] ✅ Companion npm global tools already installed. Skipping.`);
|
|
4721
4720
|
} else if (globalInstallStatus.status === 'failed') {
|
|
4722
4721
|
console.log(
|
|
4723
4722
|
`[${TOOL_NAME}] ⚠️ Global install failed: ${globalInstallStatus.reason}\n` +
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imdeadpool/guardex",
|
|
3
|
-
"version": "7.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "7.0.11",
|
|
4
|
+
"description": "GitGuardex: hardened multi-agent git guardrails for parallel agent work.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"preferGlobal": true,
|
|
7
7
|
"bin": {
|
|
8
|
+
"gitguardex": "bin/multiagent-safety.js",
|
|
8
9
|
"guardex": "bin/multiagent-safety.js",
|
|
9
10
|
"gx": "bin/multiagent-safety.js",
|
|
10
11
|
"multiagent-safety": "bin/multiagent-safety.js"
|
|
@@ -43,6 +44,7 @@
|
|
|
43
44
|
"CONTRIBUTING.md"
|
|
44
45
|
],
|
|
45
46
|
"keywords": [
|
|
47
|
+
"gitguardex",
|
|
46
48
|
"guardex",
|
|
47
49
|
"multi-agent",
|
|
48
50
|
"git-hooks",
|
|
@@ -53,10 +55,10 @@
|
|
|
53
55
|
"author": "recodeecom",
|
|
54
56
|
"repository": {
|
|
55
57
|
"type": "git",
|
|
56
|
-
"url": "git+https://github.com/recodeee/
|
|
58
|
+
"url": "git+https://github.com/recodeee/gitguardex.git"
|
|
57
59
|
},
|
|
58
60
|
"bugs": {
|
|
59
|
-
"url": "https://github.com/recodeee/
|
|
61
|
+
"url": "https://github.com/recodeee/gitguardex/issues"
|
|
60
62
|
},
|
|
61
63
|
"homepage": "https://guardextutorial.com",
|
|
62
64
|
"funding": "https://github.com/sponsors/recodeecom",
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
<!-- multiagent-safety:START -->
|
|
2
2
|
## Multi-Agent Safety Contract
|
|
3
3
|
|
|
4
|
-
**Repo toggle.**
|
|
4
|
+
**Repo toggle.** `GUARDEX_ON=0|false|no|off` disables this contract. `GUARDEX_ON=1|true|yes|on` re-enables it.
|
|
5
5
|
|
|
6
|
-
**Isolation.**
|
|
6
|
+
**Isolation.** One task = one `agent/*` branch + worktree. Start `scripts/agent-branch-start.sh "<task>" "<agent>"`. Base branches stay read-only. No `git checkout` on primary worktrees; use `git worktree add`. `.githooks/post-checkout` auto-reverts primary-branch switches unless `GUARDEX_ALLOW_PRIMARY_BRANCH_SWITCH=1`.
|
|
7
7
|
|
|
8
|
-
**Ownership.**
|
|
8
|
+
**Ownership.** Claim before edits: `scripts/agent-file-locks.py claim --branch "<agent-branch>" <file...>`. Delete only claimed paths.
|
|
9
9
|
|
|
10
|
-
**Handoff
|
|
10
|
+
**Handoff.** Post a one-line note before edits. Re-read latest handoffs before replacing nearby work.
|
|
11
11
|
|
|
12
|
-
**Completion.** Finish with `scripts/agent-branch-finish.sh --branch "<agent-branch>" --via-pr --wait-for-merge --cleanup`
|
|
12
|
+
**Completion.** Finish with `scripts/agent-branch-finish.sh --branch "<agent-branch>" --via-pr --wait-for-merge --cleanup` or `gx finish --all`. Done = commit pushed, PR URL recorded, state=`MERGED`, sandbox pruned. If blocked, append `BLOCKED:` and stop.
|
|
13
13
|
|
|
14
|
-
**Parallel safety.**
|
|
14
|
+
**Parallel safety.** Never revert unrelated edits. Report conflicts.
|
|
15
15
|
|
|
16
|
-
**Reporting.**
|
|
16
|
+
**Reporting.** Completion handoff includes files changed, behavior touched, verification commands/results, and risks/follow-ups.
|
|
17
17
|
|
|
18
|
-
**OpenSpec
|
|
18
|
+
**OpenSpec.** Keep `openspec/changes/<slug>/tasks.md` current. End task scaffolds with PR merge + sandbox cleanup evidence. Run `openspec validate --specs` before archive.
|
|
19
19
|
|
|
20
20
|
**Version bumps.** If a change bumps a published version, the same PR updates release notes/changelog.
|
|
21
21
|
<!-- multiagent-safety:END -->
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: gitguardex
|
|
3
|
+
description: "Repo guardrail check and repair."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Use when repo safety may be broken.
|
|
7
|
+
|
|
8
|
+
`gx status` -> `gx doctor` -> `gx status --strict`
|
|
9
|
+
|
|
10
|
+
Bootstrap: `gx setup`
|
|
11
|
+
Ops: `bash scripts/codex-agent.sh "<task>" "<agent>"`, `gx finish --all`, `gx cleanup`
|
|
@@ -89,5 +89,5 @@ The system SHALL enforce ${CAPABILITY_SLUG} behavior as defined by this change.
|
|
|
89
89
|
SPECEOF
|
|
90
90
|
fi
|
|
91
91
|
|
|
92
|
-
echo "[
|
|
93
|
-
echo "[
|
|
92
|
+
echo "[gitguardex] OpenSpec change workspace ready: ${CHANGE_DIR}"
|
|
93
|
+
echo "[gitguardex] OpenSpec change spec scaffold: ${SPEC_DIR}/spec.md"
|
|
@@ -114,5 +114,5 @@ Role workspace for \`${role}\`.
|
|
|
114
114
|
"
|
|
115
115
|
done
|
|
116
116
|
|
|
117
|
-
echo "[
|
|
118
|
-
echo "[
|
|
117
|
+
echo "[gitguardex] OpenSpec plan workspace ready: ${PLAN_DIR}"
|
|
118
|
+
echo "[gitguardex] Roles: ${ROLES[*]}"
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# /guardex
|
|
2
|
-
|
|
3
|
-
Run a GuardeX check-and-repair for the current repo.
|
|
4
|
-
|
|
5
|
-
## Steps
|
|
6
|
-
|
|
7
|
-
1. `gx status` — if green, stop.
|
|
8
|
-
2. If degraded, `gx doctor`.
|
|
9
|
-
3. If still degraded, `gx status --strict` and summarize each finding with a fix.
|
|
10
|
-
4. Report verdict: `Repo is guarded` or `Repo is not guarded` (list blockers).
|
|
11
|
-
|
|
12
|
-
Keep output short, include the exact commands you ran.
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: guardex
|
|
3
|
-
description: "Check, repair, or bootstrap multi-agent safety guardrails in this repository."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# GuardeX (Codex skill)
|
|
7
|
-
|
|
8
|
-
Use when branch safety, lock ownership, or guardrail setup may be broken.
|
|
9
|
-
|
|
10
|
-
## Fast path
|
|
11
|
-
|
|
12
|
-
1. `gx status` — one-glance health check.
|
|
13
|
-
2. If degraded, `gx doctor` — repair + verify in one pass.
|
|
14
|
-
3. If issues remain, `gx status --strict` and address each finding.
|
|
15
|
-
|
|
16
|
-
## Bootstrap (missing guardrails)
|
|
17
|
-
|
|
18
|
-
```sh
|
|
19
|
-
gx setup # install + repair + verify
|
|
20
|
-
gx status # confirm green
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
In a monorepo with nested git repos (top-level `.git` plus `apps/*/.git`), `gx setup` auto-installs into every discovered repo. Submodules and guardex-managed worktrees are skipped. Pass `--no-recursive` to limit to the top-level only.
|
|
24
|
-
|
|
25
|
-
## Notes
|
|
26
|
-
|
|
27
|
-
- Isolation: `scripts/codex-agent.sh "<task>" "<agent>"` is the one-command sandbox start/finish loop.
|
|
28
|
-
- Completion: auto-finish keeps the branch until explicit `gx cleanup`.
|
|
29
|
-
- Never bypass protected-branch safeguards.
|
|
30
|
-
|
|
31
|
-
## Bulk finish
|
|
32
|
-
|
|
33
|
-
```sh
|
|
34
|
-
gx finish --all # commit + PR + merge all ready agent/* branches
|
|
35
|
-
gx cleanup # prune merged/stale branches and worktrees
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
If a branch fails with stale rebase/worktree state:
|
|
39
|
-
|
|
40
|
-
```sh
|
|
41
|
-
git -C "<worktree>" rebase --abort || true
|
|
42
|
-
gx finish --branch "<agent-branch>" --cleanup
|
|
43
|
-
```
|