@imdeadpool/guardex 6.1.0 → 7.0.1
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 +63 -39
- package/bin/multiagent-safety.js +372 -296
- package/package.json +3 -5
- package/templates/AGENTS.multiagent-safety.md +9 -82
- package/templates/claude/commands/guardex.md +6 -12
- package/templates/codex/skills/guardex/SKILL.md +18 -64
- package/templates/githooks/post-merge +39 -3
- package/templates/githooks/pre-commit +27 -193
- package/templates/githooks/pre-push +0 -0
- package/templates/scripts/agent-branch-finish.sh +70 -702
- package/templates/scripts/agent-branch-start.sh +76 -877
- package/templates/scripts/agent-worktree-prune.sh +65 -353
- package/templates/scripts/codex-agent.sh +626 -238
- package/templates/scripts/install-agent-git-hooks.sh +4 -27
- package/templates/scripts/openspec/init-change-workspace.sh +4 -50
- package/templates/scripts/openspec/init-plan-workspace.sh +48 -495
- package/templates/scripts/review-bot-watch.sh +11 -11
|
@@ -1,39 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
set -euo pipefail
|
|
3
3
|
|
|
4
|
-
soft=0
|
|
5
|
-
for arg in "$@"; do
|
|
6
|
-
case "$arg" in
|
|
7
|
-
--soft) soft=1 ;;
|
|
8
|
-
esac
|
|
9
|
-
done
|
|
10
|
-
|
|
11
|
-
soft_exit() {
|
|
12
|
-
if [[ "$soft" -eq 1 ]]; then
|
|
13
|
-
exit 0
|
|
14
|
-
fi
|
|
15
|
-
exit 1
|
|
16
|
-
}
|
|
17
|
-
|
|
18
4
|
repo_root="$(git rev-parse --show-toplevel 2>/dev/null || true)"
|
|
19
5
|
if [[ -z "$repo_root" ]]; then
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
fi
|
|
23
|
-
soft_exit
|
|
6
|
+
echo "[install-agent-git-hooks] Not inside a git repository." >&2
|
|
7
|
+
exit 1
|
|
24
8
|
fi
|
|
25
9
|
|
|
26
10
|
hooks_dir="$repo_root/.githooks"
|
|
27
11
|
if [[ ! -d "$hooks_dir" ]]; then
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
fi
|
|
31
|
-
soft_exit
|
|
32
|
-
fi
|
|
33
|
-
|
|
34
|
-
current_hooks_path="$(git -C "$repo_root" config --get core.hooksPath 2>/dev/null || true)"
|
|
35
|
-
if [[ "$soft" -eq 1 && "$current_hooks_path" == ".githooks" ]]; then
|
|
36
|
-
exit 0
|
|
12
|
+
echo "[install-agent-git-hooks] Missing hooks directory: $hooks_dir" >&2
|
|
13
|
+
exit 1
|
|
37
14
|
fi
|
|
38
15
|
|
|
39
16
|
chmod +x "$hooks_dir"/* 2>/dev/null || true
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
set -euo pipefail
|
|
3
3
|
|
|
4
|
-
if [[ $# -lt 1 || $# -gt
|
|
5
|
-
echo "Usage: $0 <change-slug> [capability-slug]
|
|
6
|
-
echo "Example: $0 add-dashboard-live-usage runtime-migration
|
|
4
|
+
if [[ $# -lt 1 || $# -gt 2 ]]; then
|
|
5
|
+
echo "Usage: $0 <change-slug> [capability-slug]"
|
|
6
|
+
echo "Example: $0 add-dashboard-live-usage runtime-migration"
|
|
7
7
|
exit 1
|
|
8
8
|
fi
|
|
9
9
|
|
|
10
10
|
CHANGE_SLUG="$1"
|
|
11
11
|
CAPABILITY_SLUG="${2:-$CHANGE_SLUG}"
|
|
12
|
-
AGENT_BRANCH="${3:-agent/<your-name>/<branch-slug>}"
|
|
13
12
|
|
|
14
13
|
if [[ "$CHANGE_SLUG" =~ [^a-z0-9-] ]]; then
|
|
15
14
|
echo "Error: change slug must be kebab-case (lowercase letters, numbers, hyphens)."
|
|
@@ -25,17 +24,7 @@ CHANGE_DIR="openspec/changes/${CHANGE_SLUG}"
|
|
|
25
24
|
SPEC_DIR="${CHANGE_DIR}/specs/${CAPABILITY_SLUG}"
|
|
26
25
|
TODAY="$(date -u +%Y-%m-%d)"
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
case "$(printf '%s' "$MINIMAL_RAW" | tr '[:upper:]' '[:lower:]')" in
|
|
30
|
-
1|true|yes|on) MINIMAL=1 ;;
|
|
31
|
-
*) MINIMAL=0 ;;
|
|
32
|
-
esac
|
|
33
|
-
|
|
34
|
-
if [[ "$MINIMAL" -eq 1 ]]; then
|
|
35
|
-
mkdir -p "$CHANGE_DIR"
|
|
36
|
-
else
|
|
37
|
-
mkdir -p "$SPEC_DIR"
|
|
38
|
-
fi
|
|
27
|
+
mkdir -p "$SPEC_DIR"
|
|
39
28
|
|
|
40
29
|
if [[ ! -f "${CHANGE_DIR}/.openspec.yaml" ]]; then
|
|
41
30
|
cat > "${CHANGE_DIR}/.openspec.yaml" <<YAMLEOF
|
|
@@ -44,27 +33,6 @@ created: ${TODAY}
|
|
|
44
33
|
YAMLEOF
|
|
45
34
|
fi
|
|
46
35
|
|
|
47
|
-
if [[ "$MINIMAL" -eq 1 ]]; then
|
|
48
|
-
if [[ ! -f "${CHANGE_DIR}/notes.md" ]]; then
|
|
49
|
-
cat > "${CHANGE_DIR}/notes.md" <<NOTESEOF
|
|
50
|
-
# ${CHANGE_SLUG} (minimal / T1)
|
|
51
|
-
|
|
52
|
-
Branch: \`${AGENT_BRANCH}\`
|
|
53
|
-
|
|
54
|
-
Describe the change in a sentence or two. Commit message is the spec of record.
|
|
55
|
-
|
|
56
|
-
## Cleanup
|
|
57
|
-
|
|
58
|
-
- [ ] Run: \`bash scripts/agent-branch-finish.sh --branch ${AGENT_BRANCH} --base dev --via-pr --wait-for-merge --cleanup\`
|
|
59
|
-
- [ ] Record PR URL + \`MERGED\` state in the completion handoff.
|
|
60
|
-
- [ ] Confirm sandbox worktree is gone (\`git worktree list\`, \`git branch -a\`).
|
|
61
|
-
NOTESEOF
|
|
62
|
-
fi
|
|
63
|
-
echo "[guardex] OpenSpec change workspace (minimal) ready: ${CHANGE_DIR}"
|
|
64
|
-
echo "[guardex] Notes-only scaffold: ${CHANGE_DIR}/notes.md"
|
|
65
|
-
exit 0
|
|
66
|
-
fi
|
|
67
|
-
|
|
68
36
|
if [[ ! -f "${CHANGE_DIR}/proposal.md" ]]; then
|
|
69
37
|
cat > "${CHANGE_DIR}/proposal.md" <<PROPOSALEOF
|
|
70
38
|
## Why
|
|
@@ -83,14 +51,6 @@ fi
|
|
|
83
51
|
|
|
84
52
|
if [[ ! -f "${CHANGE_DIR}/tasks.md" ]]; then
|
|
85
53
|
cat > "${CHANGE_DIR}/tasks.md" <<TASKSEOF
|
|
86
|
-
## Definition of Done
|
|
87
|
-
|
|
88
|
-
This change is complete only when **all** of the following are true:
|
|
89
|
-
|
|
90
|
-
- Every checkbox below is checked.
|
|
91
|
-
- The agent branch reaches \`MERGED\` state on \`origin\` and the PR URL + state are recorded in the completion handoff.
|
|
92
|
-
- If any step blocks (test failure, conflict, ambiguous result), append a \`BLOCKED:\` line under section 4 explaining the blocker and **STOP**. Do not tick remaining cleanup boxes; do not silently skip the cleanup pipeline.
|
|
93
|
-
|
|
94
54
|
## 1. Specification
|
|
95
55
|
|
|
96
56
|
- [ ] 1.1 Finalize proposal scope and acceptance criteria for \`${CHANGE_SLUG}\`.
|
|
@@ -106,12 +66,6 @@ This change is complete only when **all** of the following are true:
|
|
|
106
66
|
- [ ] 3.1 Run targeted project verification commands.
|
|
107
67
|
- [ ] 3.2 Run \`openspec validate ${CHANGE_SLUG} --type change --strict\`.
|
|
108
68
|
- [ ] 3.3 Run \`openspec validate --specs\`.
|
|
109
|
-
|
|
110
|
-
## 4. Cleanup (mandatory; run before claiming completion)
|
|
111
|
-
|
|
112
|
-
- [ ] 4.1 Run the cleanup pipeline: \`bash scripts/agent-branch-finish.sh --branch ${AGENT_BRANCH} --base dev --via-pr --wait-for-merge --cleanup\`. This handles commit -> push -> PR create -> merge wait -> worktree prune in one invocation.
|
|
113
|
-
- [ ] 4.2 Record the PR URL and final merge state (\`MERGED\`) in the completion handoff.
|
|
114
|
-
- [ ] 4.3 Confirm the sandbox worktree is gone (\`git worktree list\` no longer shows the agent path; \`git branch -a\` shows no surviving local/remote refs for the branch).
|
|
115
69
|
TASKSEOF
|
|
116
70
|
fi
|
|
117
71
|
|