fix(context-sync): short-circuit when root AGENT.md is unreachable
In CI's clean checkout the tree-walk for ~/dev/.context/AGENT.md
finds nothing, leaving ROOT_CONTEXT empty. The script previously
proceeded to regenerate AGENTS.md, .cursorrules,
.aider.conventions.md, and .context/system-prompt.txt as
project-only — but the committed versions are root+project, so
the drift gate added in cc401d9 fails CI on every push.
When no root context is reachable, only regenerate CLAUDE.md
(which is project-only by design — Claude Code walks up the tree
itself to find the root). The root-bearing adapters are left
untouched, eliminating the false-positive drift.
Local runs (with root context reachable) are unchanged.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -39,7 +39,17 @@ fi
|
|||||||
if [ -n "$ROOT_CONTEXT" ] && [ -f "$ROOT_CONTEXT" ]; then
|
if [ -n "$ROOT_CONTEXT" ] && [ -f "$ROOT_CONTEXT" ]; then
|
||||||
echo " Root context: $ROOT_CONTEXT"
|
echo " Root context: $ROOT_CONTEXT"
|
||||||
else
|
else
|
||||||
echo " No root AGENT.md found (project context only)"
|
# No reachable root AGENT.md — common in CI's clean checkout. The root+project
|
||||||
|
# adapters (AGENTS.md, .cursorrules, .aider.conventions.md, system-prompt.txt)
|
||||||
|
# require the root context to regenerate correctly, so we skip them entirely
|
||||||
|
# and only regenerate CLAUDE.md (which is project-only and inherits root via
|
||||||
|
# tree walk in Claude Code itself).
|
||||||
|
echo " No root AGENT.md found — regenerating CLAUDE.md only"
|
||||||
|
echo "Syncing project context from $PROJECT_FILE..."
|
||||||
|
cat "$PROJECT_FILE" > CLAUDE.md
|
||||||
|
echo " → CLAUDE.md (project-only)"
|
||||||
|
echo "Done."
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Emit root context + separator
|
# Emit root context + separator
|
||||||
|
|||||||
Reference in New Issue
Block a user