Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
c8f4848
Unblock the next Guardex npm publish after 7.0.15 was already taken (…
NagyVikt Apr 21, 2026
9f5a6b2
Bump next from 15.2.6 to 15.5.15 in /frontend (#229)
dependabot[bot] Apr 21, 2026
1dd69f4
Bump qs and express in /frontend (#228)
dependabot[bot] Apr 21, 2026
20f9312
Auto-finish: gx doctor repairs (#241)
NagyVikt Apr 21, 2026
887d8d3
Clarify how GitGuardex updates AGENTS contract docs (#242)
NagyVikt Apr 21, 2026
4122584
Make doctor failures visually obvious in terminal output (#243)
NagyVikt Apr 21, 2026
0a4ec3e
Clarify how Guardex sandboxes get cleaned up (#244)
NagyVikt Apr 21, 2026
75aae91
Keep npm release verification green when the version is already live …
NagyVikt Apr 21, 2026
495c867
Bring the README docs in line with current Guardex behavior (#246)
NagyVikt Apr 21, 2026
b9d1b4c
new
Imdeadpool1 Apr 21, 2026
af45a92
new
Imdeadpool1 Apr 21, 2026
f3c5707
Bump path-to-regexp from 0.1.12 to 0.1.13 in /frontend (#240)
dependabot[bot] Apr 21, 2026
18c4ac1
Align downstream OpenSpec scaffolds with recodee bootstrap (#247)
NagyVikt Apr 21, 2026
a151351
Expose live Guardex sandbox sessions inside VS Code Source Control (#…
NagyVikt Apr 21, 2026
4c74aad
Enhance README with sidebar options and install section (#249)
NagyVikt Apr 21, 2026
ef319df
new
Imdeadpool1 Apr 21, 2026
e563bab
Clarify README problem and About copy surfaces (#250)
NagyVikt Apr 21, 2026
b4869ca
Restore Active Agents view registration in VS Code (#251)
NagyVikt Apr 21, 2026
3b008f5
Protect README About copy with regression coverage (#252)
NagyVikt Apr 21, 2026
837b88b
Make Active Agents visible in SCM by default (#253)
NagyVikt Apr 21, 2026
8283e48
new img
Imdeadpool1 Apr 21, 2026
313fd5c
Update README.md (#254)
NagyVikt Apr 21, 2026
89cbfac
Update README.md (#255)
NagyVikt Apr 21, 2026
4652247
Update README.md (#256)
NagyVikt Apr 21, 2026
b90c382
Align package metadata with the canonical Guardian T-Rex pitch (#257)
NagyVikt Apr 21, 2026
8cd94e1
Update README.md (#258)
NagyVikt Apr 21, 2026
ef51383
Update README.md (#259)
NagyVikt Apr 21, 2026
1a858d8
Auto-finish: gx doctor repairs (#260)
NagyVikt Apr 21, 2026
569c307
Show live Guardex worktree activity in the VS Code SCM view (#261)
NagyVikt Apr 21, 2026
4eb0be1
Align the published package name with the GitGuardex brand (#262)
NagyVikt Apr 21, 2026
d43ed59
Restore post-rename parity so branding CI stays green (#263)
NagyVikt Apr 21, 2026
02aa293
Match the active-agents view to repo-scoped SCM grouping (#264)
NagyVikt Apr 21, 2026
ae8bb76
Make quota-hit agent takeovers copy-pasteable (#265)
NagyVikt Apr 21, 2026
aca7f8a
Restore the published npm package identity users already install (#266)
NagyVikt Apr 21, 2026
dcc7154
Move installed guard workflows to CLI-owned shims (#267)
NagyVikt Apr 21, 2026
17de4f4
Ship the CLI-owned install surface on a fresh npm version (#268)
NagyVikt Apr 21, 2026
4126192
Keep small Guardex tasks on caveman-only routing by default (#269)
NagyVikt Apr 21, 2026
38df0d7
Make working VS Code agent lanes visible at a glance (#270)
NagyVikt Apr 22, 2026
7c5bd06
Stop repo-local workflow shims from defining Guardex command surface …
NagyVikt Apr 22, 2026
db38432
Record merged zero-copy closeout evidence (#272)
NagyVikt Apr 22, 2026
2f6d564
Allow targeted managed-file force rewrites during setup and doctor (#…
NagyVikt Apr 22, 2026
343b8a8
Unblock the next Guardex npm publish (#274)
NagyVikt Apr 22, 2026
babcf07
Auto-finish: gx doctor repairs (#275)
NagyVikt Apr 22, 2026
4ded9dd
Auto-finish: gx doctor repairs (#276)
NagyVikt Apr 22, 2026
8a49fba
Keep gx doctor from treating manual conflict cleanup as repo failure …
NagyVikt Apr 22, 2026
9f1a129
Record the merged doctor fix as complete in its OpenSpec task log (#278)
NagyVikt Apr 22, 2026
c695b57
Make extracted Guardex CLI seams executable and publishable
Imdeadpool1 Apr 22, 2026
d5b3ed5
Keep the thin Guardex entrypoint executable
Imdeadpool1 Apr 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 20 additions & 74 deletions .githooks/post-checkout
Original file line number Diff line number Diff line change
@@ -1,81 +1,27 @@
#!/usr/bin/env bash
set -euo pipefail

# post-checkout <prev_head> <new_head> <branch_checkout_flag>
branch_checkout="${3:-0}"
[[ "$branch_checkout" == "1" ]] || exit 0

if [[ "${GUARDEX_ALLOW_PRIMARY_BRANCH_SWITCH:-0}" == "1" ]]; then
exit 0
fi

repo_root="$(git rev-parse --show-toplevel 2>/dev/null || true)"
if [[ -z "$repo_root" ]]; then
exit 0
fi
guardex_env_helper="${repo_root}/scripts/guardex-env.sh"
if [[ -f "$guardex_env_helper" ]]; then
# shellcheck source=/dev/null
source "$guardex_env_helper"
fi
if declare -F guardex_repo_is_enabled >/dev/null 2>&1 && ! guardex_repo_is_enabled "$repo_root"; then
exit 0
if [[ -n "${GUARDEX_CLI_ENTRY:-}" ]]; then
node_bin="${GUARDEX_NODE_BIN:-node}"
exec "$node_bin" "$GUARDEX_CLI_ENTRY" 'hook' 'run' 'post-checkout' "$@"
fi

# Skip in secondary worktrees — only the primary checkout is guarded.
git_dir_abs="$(cd "$(git rev-parse --git-dir)" && pwd -P)"
common_dir_abs="$(cd "$(git rev-parse --git-common-dir)" && pwd -P)"
if [[ "$git_dir_abs" != "$common_dir_abs" ]]; then
exit 0
fi

new_branch="$(git rev-parse --abbrev-ref HEAD 2>/dev/null || true)"
# Parse the latest reflog entry; post-checkout writes "checkout: moving from <prev> to <new>".
prev_branch="$(git reflog -1 HEAD 2>/dev/null | sed -n 's/.*checkout: moving from \([^ ]*\) to .*/\1/p' || true)"

[[ -n "$prev_branch" && -n "$new_branch" && "$prev_branch" != "$new_branch" ]] || exit 0

protected_raw="${GUARDEX_PROTECTED_BRANCHES:-$(git config --get multiagent.protectedBranches || true)}"
[[ -n "$protected_raw" ]] || protected_raw="dev main master"
protected_raw="${protected_raw//,/ }"

is_protected() {
local branch="$1"
for p in $protected_raw; do
[[ "$branch" == "$p" ]] && return 0
done
return 1
resolve_guardex_cli() {
if [[ -n "${GUARDEX_CLI_BIN:-}" ]]; then
printf '%s' "$GUARDEX_CLI_BIN"
return 0
fi
if command -v gx >/dev/null 2>&1; then
printf '%s' "gx"
return 0
fi
if command -v gitguardex >/dev/null 2>&1; then
printf '%s' "gitguardex"
return 0
fi
echo "[gitguardex-shim] Missing gx CLI in PATH." >&2
exit 1
}

# Only guard when moving AWAY from a protected primary branch.
is_protected "$prev_branch" || exit 0

is_agent=0
if [[ -n "${CLAUDECODE:-}" \
|| -n "${CLAUDE_CODE_SESSION_ID:-}" \
|| -n "${CODEX_THREAD_ID:-}" \
|| -n "${OMX_SESSION_ID:-}" \
|| "${CODEX_CI:-0}" == "1" ]]; then
is_agent=1
fi

echo "" >&2
echo "[agent-primary-branch-guard] Primary checkout switched branches." >&2
echo "[agent-primary-branch-guard] from: $prev_branch (protected)" >&2
echo "[agent-primary-branch-guard] to: $new_branch" >&2
echo "[agent-primary-branch-guard] The primary working tree must stay on its base/protected branch." >&2
echo "[agent-primary-branch-guard] Use 'git worktree add' (or scripts/agent-branch-start.sh) for feature work." >&2

if [[ "$is_agent" == "1" ]]; then
echo "[agent-primary-branch-guard] Agent session detected — reverting to '$prev_branch'." >&2
echo "[agent-primary-branch-guard] Bypass with GUARDEX_ALLOW_PRIMARY_BRANCH_SWITCH=1 if truly intentional." >&2
if git diff --quiet && git diff --cached --quiet; then
GUARDEX_ALLOW_PRIMARY_BRANCH_SWITCH=1 git checkout "$prev_branch" >/dev/null 2>&1 || true
echo "[agent-primary-branch-guard] Reverted to '$prev_branch'." >&2
else
echo "[agent-primary-branch-guard] Working tree dirty — auto-revert skipped." >&2
echo "[agent-primary-branch-guard] Fix manually: git stash && git checkout $prev_branch" >&2
fi
else
echo "[agent-primary-branch-guard] Bypass with GUARDEX_ALLOW_PRIMARY_BRANCH_SWITCH=1 if intentional." >&2
fi
cli_bin="$(resolve_guardex_cli)"
exec "$cli_bin" 'hook' 'run' 'post-checkout' "$@"
72 changes: 24 additions & 48 deletions .githooks/post-merge
Original file line number Diff line number Diff line change
@@ -1,51 +1,27 @@
#!/usr/bin/env bash
set -euo pipefail

if [[ "${GUARDEX_DISABLE_POST_MERGE_CLEANUP:-0}" == "1" ]]; then
exit 0
fi

repo_root="$(git rev-parse --show-toplevel 2>/dev/null || true)"
if [[ -z "$repo_root" ]]; then
exit 0
fi
guardex_env_helper="${repo_root}/scripts/guardex-env.sh"
if [[ -f "$guardex_env_helper" ]]; then
# shellcheck source=/dev/null
source "$guardex_env_helper"
fi
if declare -F guardex_repo_is_enabled >/dev/null 2>&1 && ! guardex_repo_is_enabled "$repo_root"; then
exit 0
fi

branch="$(git -C "$repo_root" rev-parse --abbrev-ref HEAD 2>/dev/null || true)"
if [[ -z "$branch" || "$branch" == "HEAD" ]]; then
exit 0
fi

base_branch="${GUARDEX_BASE_BRANCH:-$(git -C "$repo_root" config --get multiagent.baseBranch || true)}"
if [[ -z "$base_branch" ]]; then
base_branch="dev"
fi

if [[ "$branch" != "$base_branch" ]]; then
exit 0
fi

cli_path="$repo_root/bin/multiagent-safety.js"
if [[ ! -f "$cli_path" ]]; then
exit 0
fi

node_bin="${GUARDEX_NODE_BIN:-node}"
if ! command -v "$node_bin" >/dev/null 2>&1; then
exit 0
fi

"$node_bin" "$cli_path" cleanup \
--target "$repo_root" \
--base "$base_branch" \
--include-pr-merged \
--keep-clean-worktrees >/dev/null 2>&1 || true

exit 0
if [[ -n "${GUARDEX_CLI_ENTRY:-}" ]]; then
node_bin="${GUARDEX_NODE_BIN:-node}"
exec "$node_bin" "$GUARDEX_CLI_ENTRY" 'hook' 'run' 'post-merge' "$@"
fi

resolve_guardex_cli() {
if [[ -n "${GUARDEX_CLI_BIN:-}" ]]; then
printf '%s' "$GUARDEX_CLI_BIN"
return 0
fi
if command -v gx >/dev/null 2>&1; then
printf '%s' "gx"
return 0
fi
if command -v gitguardex >/dev/null 2>&1; then
printf '%s' "gitguardex"
return 0
fi
echo "[gitguardex-shim] Missing gx CLI in PATH." >&2
exit 1
}

cli_bin="$(resolve_guardex_cli)"
exec "$cli_bin" 'hook' 'run' 'post-merge' "$@"
Loading