forge-orkes 0.75.0 → 0.79.0
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/bin/create-forge.js +27 -0
- package/experimental/m10/README.md +4 -4
- package/experimental/m10/install.sh +10 -9
- package/experimental/m10/source/hooks/protect-primary-checkout.sh +149 -0
- package/package.json +1 -1
- package/template/.claude/hooks/README.md +121 -0
- package/template/.claude/hooks/forge-state-rollup.sh +431 -0
- package/template/.claude/hooks/protect-primary-checkout.sh +149 -0
- package/template/.claude/hooks/tests/README.md +20 -0
- package/template/.claude/hooks/tests/forge-state-rollup.test.sh +282 -0
- package/template/.claude/hooks/tests/protect-primary-checkout.test.sh +147 -0
- package/template/.claude/settings.json +20 -0
- package/template/.claude/skills/chief-of-staff/SKILL.md +16 -11
- package/template/.claude/skills/forge/SKILL.md +11 -7
- package/template/.claude/skills/initializing/SKILL.md +20 -1
- package/template/.claude/skills/reviewing/SKILL.md +17 -0
- package/template/.claude/skills/upgrading/SKILL.md +22 -2
- package/template/.forge/FORGE.md +8 -5
- package/template/.forge/bin/new-worktree.sh +61 -0
- package/template/.forge/bin/tests/new-worktree.test.sh +70 -0
- package/template/.forge/git-hooks/pre-commit +57 -0
- package/template/.forge/git-hooks/tests/pre-commit.test.sh +97 -0
- package/template/.forge/migrations/0.77.0-state-rollup-executable.md +120 -0
- package/template/.forge/migrations/0.78.0-weld-primary-checkout.md +66 -0
- package/template/.forge/templates/state/desire-path.yml +3 -0
- package/experimental/m10/source/hooks/forge-branch-guard.sh +0 -61
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Forge PreToolUse(Bash) guardrail — protect the shared main checkout's HEAD when
|
|
3
|
-
# parallel git worktrees are active.
|
|
4
|
-
#
|
|
5
|
-
# Blocks the "moved the shared HEAD under other sessions" catastrophe (canvaz, burned
|
|
6
|
-
# twice 2026-06-05): switching branches or hard-resetting in the MAIN checkout while
|
|
7
|
-
# sibling worktrees are branched off it. Orchestration-agnostic — depends only on git
|
|
8
|
-
# worktree state, so it holds whether coordination is M10, Agent Teams, or manual
|
|
9
|
-
# worktrees.
|
|
10
|
-
#
|
|
11
|
-
# Scope is deliberately narrow to avoid false positives:
|
|
12
|
-
# - fires ONLY when >1 worktree exists (single-worktree/solo work is never touched)
|
|
13
|
-
# - fires ONLY in the main checkout (linked worktrees own their own HEAD)
|
|
14
|
-
# - skips any command containing `cd` (can't reliably tell which tree it targets)
|
|
15
|
-
# - allows safe forms: file restore (`git checkout -- <path>`), branch create (`-b`)
|
|
16
|
-
#
|
|
17
|
-
# exit 0 = allow; exit 2 = deny. Override by running the command yourself outside Claude.
|
|
18
|
-
|
|
19
|
-
set -uo pipefail
|
|
20
|
-
|
|
21
|
-
PAYLOAD=$(cat)
|
|
22
|
-
CMD=$(printf '%s' "$PAYLOAD" | jq -r '.tool_input.command // empty' 2>/dev/null) || exit 0
|
|
23
|
-
[ -z "$CMD" ] && exit 0
|
|
24
|
-
|
|
25
|
-
# Only git commands are interesting; and bail on `cd` (target tree is ambiguous).
|
|
26
|
-
case "$CMD" in
|
|
27
|
-
*git*) ;;
|
|
28
|
-
*) exit 0 ;;
|
|
29
|
-
esac
|
|
30
|
-
case "$CMD" in
|
|
31
|
-
*"cd "*) exit 0 ;;
|
|
32
|
-
esac
|
|
33
|
-
|
|
34
|
-
git rev-parse --is-inside-work-tree >/dev/null 2>&1 || exit 0
|
|
35
|
-
|
|
36
|
-
# Single worktree → no shared-HEAD hazard.
|
|
37
|
-
wt_count=$(git worktree list 2>/dev/null | wc -l | tr -d ' ')
|
|
38
|
-
[ "${wt_count:-1}" -le 1 ] && exit 0
|
|
39
|
-
|
|
40
|
-
# Main checkout iff --git-dir == --git-common-dir (linked worktrees differ).
|
|
41
|
-
[ "$(git rev-parse --git-dir 2>/dev/null)" = "$(git rev-parse --git-common-dir 2>/dev/null)" ] || exit 0
|
|
42
|
-
|
|
43
|
-
deny() { echo "[forge-branch-guard] $*" >&2; exit 2; }
|
|
44
|
-
|
|
45
|
-
# Branch switch (checkout/switch to a ref), excluding file-restore (`--`) and create (`-b`).
|
|
46
|
-
switches_branch=0
|
|
47
|
-
if printf '%s' "$CMD" | grep -qE '\bgit[[:space:]]+(checkout|switch)\b'; then
|
|
48
|
-
if ! printf '%s' "$CMD" | grep -qE '([[:space:]]--([[:space:]]|$))|(\bgit[[:space:]]+(checkout|switch)[[:space:]]+-[bB]\b)'; then
|
|
49
|
-
switches_branch=1
|
|
50
|
-
fi
|
|
51
|
-
fi
|
|
52
|
-
|
|
53
|
-
# Hard/keep/merge reset rewrites HEAD + working tree.
|
|
54
|
-
hard_reset=0
|
|
55
|
-
printf '%s' "$CMD" | grep -qE '\bgit[[:space:]]+reset[[:space:]]+(--hard|--keep|--merge)\b' && hard_reset=1
|
|
56
|
-
|
|
57
|
-
if [ "$switches_branch" = "1" ] || [ "$hard_reset" = "1" ]; then
|
|
58
|
-
deny "Refusing to move the shared main HEAD — $wt_count worktrees are branched off it (the 'burned twice' failure). Switch/reset inside a worktree, or stop the other sessions first. Override: run the command yourself outside Claude."
|
|
59
|
-
fi
|
|
60
|
-
|
|
61
|
-
exit 0
|