mirror of
https://github.com/gnekt/My-Brain-Is-Full-Crew.git
synced 2026-09-08 14:56:20 +00:00
- Add tests/regression/run.sh that builds dist/claude-code and compares against snapshot, excluding runtime-only artifacts (.mbifc-manifest, .mcp.json, .claude-plugin/plugin.json) - Fix adapters/lib.sh agent_body: preserve '---' section dividers in body (awk now only skips '---' while still inside frontmatter, fm < 2) - Fix adapters/claude-code/adapter.sh: change 'read' capability to expand to only 'Read', appending 'Glob, Grep' at end of tools list to match snapshot ordering - Update snapshot to reflect intentional refactor changes: hook JSON schema (.args.* instead of .tool_input.*), wrapper scripts, settings.json with wrapper paths, and consistent tool ordering for postman/sorter Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
60 lines
2.2 KiB
Bash
Executable File
60 lines
2.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# =============================================================================
|
|
# tests/regression/run.sh — Diff dist/claude-code against the pre-refactor snapshot
|
|
# =============================================================================
|
|
set -eo pipefail
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
REPO_DIR="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
SNAPSHOT_DIR="$SCRIPT_DIR/snapshot"
|
|
|
|
[[ -d "$SNAPSHOT_DIR" ]] || { echo "no snapshot at $SNAPSHOT_DIR — run take-snapshot.sh before refactoring"; exit 1; }
|
|
|
|
# Build claude-code
|
|
bash "$REPO_DIR/scripts/build.sh" --framework claude-code
|
|
|
|
DIST_DIR="$REPO_DIR/dist/claude-code"
|
|
[[ -d "$DIST_DIR" ]] || { echo "build did not produce $DIST_DIR"; exit 1; }
|
|
|
|
# Files that exist only at install-time or are generated outside the adapter pipeline.
|
|
# These are excluded from both sides of the comparison.
|
|
EXCLUDE_PATTERNS=(
|
|
"./.claude/.mbifc-manifest" # runtime install manifest, not a build artifact
|
|
"./.mcp.json" # generated by adapter but snapshot was taken without MCP
|
|
"./.claude-plugin/plugin.json" # adapter-only artifact, not present in old install
|
|
)
|
|
|
|
# Build a grep exclusion pattern
|
|
GREP_EXCLUDE=""
|
|
for p in "${EXCLUDE_PATTERNS[@]}"; do
|
|
escaped="${p//./\\.}" # escape dots for grep
|
|
escaped="${escaped//\//\\\/}" # escape slashes
|
|
if [[ -z "$GREP_EXCLUDE" ]]; then
|
|
GREP_EXCLUDE="^${escaped}$"
|
|
else
|
|
GREP_EXCLUDE="${GREP_EXCLUDE}|^${escaped}$"
|
|
fi
|
|
done
|
|
|
|
# Compare structure first (excluding known non-comparable files)
|
|
echo "── File list comparison ──"
|
|
(cd "$SNAPSHOT_DIR" && find . -type f | sort | grep -vE "$GREP_EXCLUDE") > /tmp/snap.list
|
|
(cd "$DIST_DIR" && find . -type f | sort | grep -vE "$GREP_EXCLUDE") > /tmp/dist.list
|
|
if ! diff -u /tmp/snap.list /tmp/dist.list; then
|
|
echo "FAIL: file lists differ"
|
|
exit 1
|
|
fi
|
|
echo "File lists match."
|
|
|
|
# Compare each file
|
|
echo "── Per-file comparison ──"
|
|
FAILED=0
|
|
while IFS= read -r f; do
|
|
if ! diff -q "$SNAPSHOT_DIR/$f" "$DIST_DIR/$f" >/dev/null 2>&1; then
|
|
echo "DIFF: $f"
|
|
diff "$SNAPSHOT_DIR/$f" "$DIST_DIR/$f" | head -20
|
|
FAILED=$((FAILED + 1))
|
|
fi
|
|
done < /tmp/snap.list
|
|
|
|
[[ $FAILED -eq 0 ]] && echo "PASS: dist matches snapshot" || { echo "FAIL: $FAILED files differ"; exit 1; }
|