Files
2025-08-16 22:15:29 -04:00

54 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
LATEST="$(ls -1d reports/phase1-* 2>/dev/null | tail -n1 || true)"
if [[ -z "$LATEST" ]]; then
echo "No reports/phase1-* directory found. Run: npm run scan:phase1" >&2
exit 1
fi
SUM_JSON="$LATEST/summary.json"
if [[ ! -f "$SUM_JSON" ]]; then
echo "summary.json not found in $LATEST" >&2
exit 1
fi
if ! command -v jq >/dev/null 2>&1; then
echo "ERROR: jq not found (needed to generate the report). Try: sudo apt-get install jq" >&2
exit 1
fi
MUI=$(jq -r '.mui_v4_imports' "$SUM_JSON")
TS_SUP=$(jq -r '.ts_suppressions' "$SUM_JSON")
ANYC=$(jq -r '.any_usages' "$SUM_JSON")
IMGC=$(jq -r '.img_without_alt_grep' "$SUM_JSON")
HOOK=$(jq -r '.hooks_usages' "$SUM_JSON")
WW=$(jq -r '.webworker_globals' "$SUM_JSON")
cat > "$LATEST/summary.md" <<MD
# Phase 1 Baseline — Summary
**Folder:** \`$LATEST\`
| Check | Count |
|---|---:|
| MUI v4 imports (\`@material-ui/*\`) | $MUI |
| TS suppressions (\`@ts-nocheck|@ts-ignore\`) | $TS_SUP |
| \`any\` usages (grep) | $ANYC |
| \`<img>\` without \`alt=\` (grep) | $IMGC |
| Hooks usage (all hits) | $HOOK |
| WebWorker globals | $WW |
## Next steps (create/attach to issues)
- **MUI v4 → v5** (codemod + manual follow-ups). See: \`mui_v4_imports.txt\`.
- **Remove suppressions** — triage each; add types or refactor. See: \`ts_suppressions.txt\`.
- **Type hygiene** — sort by \`any_usage_topfiles.txt\`; tackle high-signal files first.
- **A11y** — review \`img_no_alt.txt\` results; fix meaningful alt text or \`alt=""\`.
- **Hooks** — confirm usages inside components/hooks only; flag utilities. See: \`hooks_usage.txt\`.
- **Workers** — set proper ESLint env or refactor. See: \`webworker_globals.txt\`.
MD
echo "Wrote $LATEST/summary.md"