Files
dev/scripts/check-codex-path-deps.sh
T
zeekay 436ee5ff4d Remove code-rs/, rebrand all references to hanzo-dev/
- Delete entire code-rs/ directory (1796 files) — just-every/code fork
  is no longer needed; hanzo-dev/ is the canonical Rust workspace
- Update all build scripts, CI workflows, docs, and configs to
  reference hanzo-dev/ instead of code-rs/
- Update binary name references: code → dev throughout
- Fix hanzo-cli/index.js, hanzo.sh, README.md, dev-cli READMEs
- Include pre-existing TUI improvements (theme, colors, greeting,
  card styles, chatwidget refactor) and build-fast.sh enhancements
  (symlink install, smarter crate prefix detection)
- codex-rs/ (read-only upstream mirror) is untouched
2026-02-10 16:14:50 -08:00

63 lines
2.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
# Prefer git to locate the repository root when available, but gracefully fall
# back to the script directory so source tarballs without .git still work.
ROOT_DIR="$(cd -- "${SCRIPT_DIR}/.." >/dev/null 2>&1 && pwd)"
if command -v git >/dev/null 2>&1; then
if git -C "$ROOT_DIR" rev-parse --is-inside-work-tree >/dev/null 2>&1; then
ROOT_DIR="$(git -C "$ROOT_DIR" rev-parse --show-toplevel)"
fi
fi
HANZO_DEV_DIR="$ROOT_DIR/hanzo-dev"
FORBIDDEN_DIR="$ROOT_DIR/codex-rs"
if [[ ! -d "$HANZO_DEV_DIR" || ! -d "$FORBIDDEN_DIR" ]]; then
echo "ERROR: Expected both hanzo-dev/ and codex-rs/ to exist next to this script." >&2
exit 1
fi
violations=0
echo "Scanning Cargo manifests under hanzo-dev/ for forbidden ../codex-rs references…"
while IFS= read -r -d '' cargo_file; do
matches=$(grep -nE '\.\./codex-rs|codex-[^\"]*\s*=\s*\{[^}]*path' "$cargo_file" || true)
if [[ -z "$matches" ]]; then
continue
fi
while IFS= read -r line; do
[[ -z "$line" ]] && continue
echo "❌ $cargo_file:$line" >&2
violations=1
done <<<"$matches"
done < <(find "$HANZO_DEV_DIR" -name Cargo.toml -print0)
if command -v jq >/dev/null 2>&1; then
echo "Running cargo metadata guard…"
metadata=$(cd "$HANZO_DEV_DIR" && cargo metadata --format-version 1 --all-features 2>/dev/null)
if [[ -n "$metadata" ]]; then
offenders=$(jq -r \
--arg forbidden "$FORBIDDEN_DIR" \
'[.packages[]
| select(.manifest_path | startswith($forbidden))
| .manifest_path] | .[]' <<<"$metadata" || true)
if [[ -n "$offenders" ]]; then
echo "❌ cargo metadata found forbidden manifests:" >&2
echo "$offenders" >&2
violations=1
fi
fi
else
echo "(jq not found; skipping cargo metadata check)"
fi
if [[ $violations -ne 0 ]]; then
echo "" >&2
echo "ERROR: Forbidden ../codex-rs path dependencies detected. Remove them before proceeding." >&2
exit 1
fi
echo "✅ No forbidden ../codex-rs dependencies detected in hanzo-dev/."