mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-10-28 07:03:20 +08:00
40 lines
1.3 KiB
Bash
Executable File
40 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# clean.sh — Remove ALL build artifacts, caches, and generated files.
|
|
#
|
|
# Usage: scripts/clean.sh
|
|
#
|
|
# Ensures every subsequent build starts from scratch — no cached .o files,
|
|
# no stale node_modules, no leftover dist folders. This is the first step
|
|
# in both scripts/test.sh and scripts/build.sh.
|
|
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
|
|
# shellcheck source=path-safety.sh
|
|
source "$ROOT/scripts/path-safety.sh"
|
|
|
|
# Containerized legs build in their own directory (BUILD_DIR env) so a
|
|
# container clean never deletes the host's native build/c mid-build.
|
|
BUILD_DIR="${BUILD_DIR:-build/c}"
|
|
|
|
echo "=== Cleaning build artifacts ($BUILD_DIR) ==="
|
|
|
|
# C build artifacts
|
|
cbm_remove_build_dir "$ROOT" "$BUILD_DIR"
|
|
|
|
# Frontend build artifacts
|
|
rm -rf "$ROOT/graph-ui/dist"
|
|
rm -rf "$ROOT/graph-ui/node_modules"
|
|
|
|
# Root-level node artifacts (if any)
|
|
rm -rf "$ROOT/node_modules"
|
|
|
|
# Leftover test fixture dirs (C test suite sometimes creates these in CWD)
|
|
find "$ROOT" -maxdepth 1 -type d \( -name 'cbm_*' -o -name 'cli-*' \) -exec rm -rf {} + 2>/dev/null || true
|
|
|
|
# Leftover test fixture dirs in /tmp
|
|
find /tmp -maxdepth 1 -type d \( -name 'cbm_*' -o -name 'cli-*' \) -user "$(id -u)" -exec rm -rf {} + 2>/dev/null || true
|
|
|
|
echo "=== Clean complete ==="
|