@imdeadpool/guardex 7.0.3 → 7.0.4
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 +5 -0
- package/package.json +1 -1
- package/templates/githooks/pre-commit +13 -8
- package/templates/githooks/pre-push +12 -0
package/README.md
CHANGED
|
@@ -373,6 +373,11 @@ npm pack --dry-run
|
|
|
373
373
|
|
|
374
374
|
## Release notes
|
|
375
375
|
|
|
376
|
+
### v7.0.4
|
|
377
|
+
|
|
378
|
+
- **Fixed: publish collision on npm.** Advanced the package metadata from `7.0.3` to `7.0.4` so `npm publish` no longer targets an already published version.
|
|
379
|
+
- **Changed: release-note sync for versioning rule.** Added this versioned entry in README in the same change as the package bump to keep publish metadata and release notes aligned.
|
|
380
|
+
|
|
376
381
|
### v7.0.3
|
|
377
382
|
|
|
378
383
|
- **Branch/worktree naming refactor.** `agent-branch-start.sh` now produces `agent/<role>/<task>-<YYYY-MM-DD>-<HH-MM>` instead of `agent/<role+account-email>/<snapshot-slug>-<task>-<cksum6>`. Codex account names (e.g. `Zeus Edix Hu`) and 6-hex checksums no longer leak into branch or worktree paths.
|
package/package.json
CHANGED
|
@@ -23,6 +23,14 @@ if [[ -n "${CODEX_THREAD_ID:-}" || -n "${OMX_SESSION_ID:-}" || "${CODEX_CI:-0}"
|
|
|
23
23
|
is_codex_session=1
|
|
24
24
|
fi
|
|
25
25
|
|
|
26
|
+
# Superset of is_codex_session that also covers Claude Code sessions so the
|
|
27
|
+
# protected-branch gate below only triggers for automated agents — humans stay
|
|
28
|
+
# free to commit directly on main/dev/master.
|
|
29
|
+
is_agent_session=$is_codex_session
|
|
30
|
+
if [[ -n "${CLAUDECODE:-}" || -n "${CLAUDE_CODE_SESSION_ID:-}" ]]; then
|
|
31
|
+
is_agent_session=1
|
|
32
|
+
fi
|
|
33
|
+
|
|
26
34
|
is_vscode_git_context=0
|
|
27
35
|
if [[ -n "${VSCODE_GIT_IPC_HANDLE:-}" || -n "${VSCODE_GIT_ASKPASS_NODE:-}" || -n "${VSCODE_IPC_HOOK_CLI:-}" ]]; then
|
|
28
36
|
is_vscode_git_context=1
|
|
@@ -124,10 +132,10 @@ MSG
|
|
|
124
132
|
fi
|
|
125
133
|
|
|
126
134
|
if [[ "$is_protected_branch" == "1" ]]; then
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
135
|
+
# Humans may commit directly on protected branches; only agent sessions
|
|
136
|
+
# (Codex / Claude Code / OMX) are blocked.
|
|
137
|
+
if [[ "$is_agent_session" != "1" ]]; then
|
|
138
|
+
exit 0
|
|
131
139
|
fi
|
|
132
140
|
|
|
133
141
|
if [[ "$is_unborn_branch" == "1" && "$is_codex_session" != "1" ]]; then
|
|
@@ -146,16 +154,13 @@ Use an agent branch first:
|
|
|
146
154
|
After finishing work:
|
|
147
155
|
bash scripts/agent-branch-finish.sh
|
|
148
156
|
|
|
149
|
-
Optional repo opt-in for VS Code protected-branch commits:
|
|
150
|
-
git config multiagent.allowVscodeProtectedBranchWrites true
|
|
151
|
-
|
|
152
157
|
Temporary bypass (not recommended):
|
|
153
158
|
ALLOW_COMMIT_ON_PROTECTED_BRANCH=1 git commit ...
|
|
154
159
|
MSG
|
|
155
160
|
exit 1
|
|
156
161
|
fi
|
|
157
162
|
|
|
158
|
-
if [[ "$
|
|
163
|
+
if [[ "$is_agent_session" == "1" && "$branch" != agent/* ]]; then
|
|
159
164
|
cat >&2 <<'MSG'
|
|
160
165
|
[agent-branch-guard] Agent commits must run on dedicated agent/* branches.
|
|
161
166
|
Start an agent branch first:
|
|
@@ -28,6 +28,13 @@ if [[ -n "${CODEX_THREAD_ID:-}" || -n "${OMX_SESSION_ID:-}" || "${CODEX_CI:-0}"
|
|
|
28
28
|
is_codex_session=1
|
|
29
29
|
fi
|
|
30
30
|
|
|
31
|
+
# Superset covering Claude Code so only agents are blocked from pushing to
|
|
32
|
+
# protected refs; humans push directly from their primary checkout.
|
|
33
|
+
is_agent_session=$is_codex_session
|
|
34
|
+
if [[ -n "${CLAUDECODE:-}" || -n "${CLAUDE_CODE_SESSION_ID:-}" ]]; then
|
|
35
|
+
is_agent_session=1
|
|
36
|
+
fi
|
|
37
|
+
|
|
31
38
|
protected_branches_raw="${GUARDEX_PROTECTED_BRANCHES:-$(git config --get multiagent.protectedBranches || true)}"
|
|
32
39
|
if [[ -z "$protected_branches_raw" ]]; then
|
|
33
40
|
protected_branches_raw="dev main master"
|
|
@@ -69,6 +76,11 @@ if [[ "${#blocked_refs[@]}" -gt 0 ]]; then
|
|
|
69
76
|
exit 1
|
|
70
77
|
fi
|
|
71
78
|
|
|
79
|
+
# Humans may push directly to protected branches; only agent sessions are blocked.
|
|
80
|
+
if [[ "$is_agent_session" != "1" ]]; then
|
|
81
|
+
exit 0
|
|
82
|
+
fi
|
|
83
|
+
|
|
72
84
|
if [[ "$is_vscode_git_context" == "1" && "$allow_vscode_protected_branch_writes" == "1" ]]; then
|
|
73
85
|
exit 0
|
|
74
86
|
fi
|