Skip to content

Verify_scaffold

FieldValue
TypeSkill Resource
Source~/.copilot/skills/frontend/scripts/verify_scaffold.sh
DescriptionNot specified

Source Content

#!/usr/bin/env bash
# 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,
# Taskfile.yml, .npmrc
#
# 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 "."
set -uo pipefail
TARGET="${1:-.}"
if [[ ! -d "$TARGET" ]]; then
echo "Usage: $0 [PROJECT_DIR]" >&2
echo "error: '$TARGET' is not a directory" >&2
exit 2
fi
fail=0
warn() { printf '⚠️ %s\n' "$1"; }
error() { printf '❌ %s\n' "$1"; fail=1; }
ok() { printf '✅ %s\n' "$1"; }
echo "== required scaffold files =="
required_files=(
"astro.config.mjs"
"tsconfig.json"
"biome.json"
"src/content/config.ts"
"Taskfile.yml"
".npmrc"
)
missing=()
for f in "${required_files[@]}"; do
if [[ -f "$TARGET/$f" ]]; then
ok "$f present"
else
missing+=("$f")
fi
done
if [[ "${#missing[@]}" -gt 0 ]]; then
error "missing required scaffold file(s): ${missing[*]}"
fi
echo
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"
else
warn "astro check reported errors (optional step — not a hard failure)"
fi
else
warn "astro CLI not found after install — skipping astro check"
fi
else
warn "pnpm install failed (optional step — not a hard failure)"
fi
else
warn "pnpm not on PATH or no package.json found — skipping optional install/check step"
fi
echo
if [[ "$fail" -eq 0 ]]; then
echo "All checks passed."
else
echo "One or more checks failed — see ❌ lines above."
fi
exit "$fail"