AkurAI Build
Menu

Public repository / fe9611075d08d4b881b528d06a3e3ad5045ec657

AkurAI-PassVault / scripts/lint-sibling-deps.sh

Latest change a695077fe727a9e8fe3947fefcff06bf02f3baf2 - OLI-188: roll out lint-config CI job and sibling-dep lint by Ólafur Búi Ólafsson

#!/bin/sh
# Fails when a Cargo.toml path dependency escapes the repo into a sibling that .akurai.yml never checks out.
set -eu
root="$(pwd -P)"
yml="${1:-.akurai.yml}"
status=0
missing="$(find . -name Cargo.toml -not -path '*/target/*' -not -path '*/node_modules/*' | while read -r manifest; do
  dir="$(dirname "$manifest")"
  sed -nE 's/.*path[[:space:]]*=[[:space:]]*"([^"]+)".*/\1/p' "$manifest" | while read -r rel; do
    target="$(realpath -m "$dir/$rel")"
    case "$target" in "$root"|"$root"/*) continue ;; esac
    rest="${target#"$(dirname "$root")"/}"
    echo "${rest%%/*}"
  done
done | sort -u)"
for sibling in $missing; do
  grep -qF "../$sibling" "$yml" 2>/dev/null || { echo "lint-sibling-deps: path dependency on sibling '$sibling' but $yml never checks out ../$sibling" >&2; status=1; }
done
exit "$status"