mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-13 00:19:03 +02:00
fix(preamble): probe AGENTS.md for skill routing; team-init resolves GSTACK_ROOT (#2500)
The HAS_ROUTING preamble probe only checked CLAUDE.md, so repos that route skills via AGENTS.md (the cross-harness convention for Codex, Cursor, and generic agent hosts) reported HAS_ROUTING: no and got nagged to create CLAUDE.md. The probe now iterates CLAUDE.md and AGENTS.md. gstack-team-init's required-mode enforcement (the CLAUDE.md verification snippet and the generated .claude/hooks/check-gstack.sh) hardcoded ~/.claude/skills/gstack, false-blocking installs living at any other host's global root or the migrated ~/.gstack/repos/gstack location. Both sites now resolve the install root: GSTACK_ROOT env first, then every registered host's globalRoot, then the migrated repo path. Install instructions keep pointing at the canonical Claude location. test/routing-probe.test.ts pins both: rendered-preamble assertions plus a live execution of the extracted probe block (AGENTS.md-only repo => yes), and a drift test that requires every hosts-registry globalRoot to appear in team-init's probe list. Re-derived from PR #2500 onto current code (the PR's 52-file regen was discarded and regenerated here). Contributed by @gamerey43. Fixes #2500 Co-authored-by: gamerey43 <gamerey43@users.noreply.github.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
gamerey43
Claude Fable 5
parent
436adb72d3
commit
95b66b56ca
+17
-3
@@ -70,7 +70,11 @@ else
|
||||
**Before doing ANY work, verify gstack is installed:**
|
||||
|
||||
```bash
|
||||
test -d ~/.claude/skills/gstack/bin && echo "GSTACK_OK" || echo "GSTACK_MISSING"
|
||||
_GS=""
|
||||
for _D in "${GSTACK_ROOT:-}" "$HOME/.claude/skills/gstack" "$HOME/.codex/skills/gstack" "$HOME/.factory/skills/gstack" "$HOME/.kiro/skills/gstack" "$HOME/.config/opencode/skills/gstack" "$HOME/.slate/skills/gstack" "$HOME/.cursor/skills/gstack" "$HOME/.openclaw/skills/gstack" "$HOME/.hermes/skills/gstack" "$HOME/.gbrain/skills/gstack" "$HOME/.gstack/repos/gstack"; do
|
||||
[ -z "$_GS" ] && [ -n "$_D" ] && [ -d "$_D/bin" ] && _GS="$_D"
|
||||
done
|
||||
[ -n "$_GS" ] && echo "GSTACK_OK: $_GS" || echo "GSTACK_MISSING"
|
||||
```
|
||||
|
||||
If GSTACK_MISSING: STOP. Do not proceed. Tell the user:
|
||||
@@ -87,7 +91,8 @@ Do not skip skills, ignore gstack errors, or work around missing gstack.
|
||||
|
||||
Using gstack skills: After install, skills like /qa, /ship, /review, /investigate,
|
||||
and /browse are available. Use /browse for all web browsing.
|
||||
Use ~/.claude/skills/gstack/... for gstack file paths (the global path).'
|
||||
Use the resolved install path above for gstack file paths
|
||||
(default: ~/.claude/skills/gstack).'
|
||||
fi
|
||||
|
||||
# Check if CLAUDE.md already has a gstack section
|
||||
@@ -114,8 +119,17 @@ if [ "$MODE" = "required" ]; then
|
||||
cat > "$HOOKS_DIR/check-gstack.sh" << 'HOOK_EOF'
|
||||
#!/bin/bash
|
||||
# Block skill usage when gstack is not installed globally.
|
||||
#
|
||||
# Resolve the install root the way gstack skill preambles do: the GSTACK_ROOT
|
||||
# env var first, then every host's global install location, then the migrated
|
||||
# repo location. Block only when NONE exist (#2500 — hardcoding
|
||||
# ~/.claude/skills/gstack false-blocked Codex-host and migrated-repo installs).
|
||||
_GSTACK_ROOT=""
|
||||
for _D in "${GSTACK_ROOT:-}" "$HOME/.claude/skills/gstack" "$HOME/.codex/skills/gstack" "$HOME/.factory/skills/gstack" "$HOME/.kiro/skills/gstack" "$HOME/.config/opencode/skills/gstack" "$HOME/.slate/skills/gstack" "$HOME/.cursor/skills/gstack" "$HOME/.openclaw/skills/gstack" "$HOME/.hermes/skills/gstack" "$HOME/.gbrain/skills/gstack" "$HOME/.gstack/repos/gstack"; do
|
||||
[ -z "$_GSTACK_ROOT" ] && [ -n "$_D" ] && [ -d "$_D/bin" ] && _GSTACK_ROOT="$_D"
|
||||
done
|
||||
|
||||
if [ ! -d "$HOME/.claude/skills/gstack/bin" ]; then
|
||||
if [ -z "$_GSTACK_ROOT" ]; then
|
||||
cat >&2 <<'MSG'
|
||||
BLOCKED: gstack is not installed globally.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user