# Verify a scaffolded Astro project has the standard dmwd-io file set.
# Required files (hard failure if any are missing):
# astro.config.mjs, tsconfig.json, biome.json, src/content/config.ts,
# Optional follow-up (never a hard failure): if pnpm is on PATH and a
# package.json exists, run `pnpm install`; if `astro` is then reachable,
# run `astro check`. Missing pnpm/astro degrades to a warning.
# Usage: verify_scaffold.sh [PROJECT_DIR]
# PROJECT_DIR defaults to "."
if [[ ! -d "$TARGET" ]]; then
echo "Usage: $0 [PROJECT_DIR]" >&2
echo "error: '$TARGET' is not a directory" >&2
warn() { printf '⚠️ %s\n' "$1"; }
error() { printf '❌ %s\n' "$1"; fail=1; }
ok() { printf '✅ %s\n' "$1"; }
echo "== required scaffold files =="
for f in "${required_files[@]}"; do
if [[ -f "$TARGET/$f" ]]; then
if [[ "${#missing[@]}" -gt 0 ]]; then
error "missing required scaffold file(s): ${missing[*]}"
echo "== optional: pnpm install + astro check =="
if command -v pnpm >/dev/null 2>&1 && [[ -f "$TARGET/package.json" ]]; then
if (cd "$TARGET" && pnpm install); then
ok "pnpm install succeeded"
if [[ -x "$TARGET/node_modules/.bin/astro" ]]; then
if (cd "$TARGET" && node_modules/.bin/astro check); then
ok "astro check reported no errors"
warn "astro check reported errors (optional step — not a hard failure)"
warn "astro CLI not found after install — skipping astro check"
warn "pnpm install failed (optional step — not a hard failure)"
warn "pnpm not on PATH or no package.json found — skipping optional install/check step"
if [[ "$fail" -eq 0 ]]; then
echo "All checks passed."
echo "One or more checks failed — see ❌ lines above."