Skip to content

Commit 21fc3f0

Browse files
committed
feat(crg): add crg-grade and crg-badge justfile recipes
1 parent 36bc6fc commit 21fc3f0

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

Justfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,3 +181,21 @@ help-me:
181181
@echo " https://github.com/hyperpolymath/panic-attacker/issues/new"
182182
@echo ""
183183
@echo "Include the output of 'just doctor' in your report."
184+
185+
186+
# Print the current CRG grade (reads from READINESS.md '**Current Grade:** X' line)
187+
crg-grade:
188+
@grade=$$(grep -oP '(?<=\*\*Current Grade:\*\* )[A-FX]' READINESS.md 2>/dev/null | head -1); \
189+
[ -z "$$grade" ] && grade="X"; \
190+
echo "$$grade"
191+
192+
# Generate a shields.io badge markdown for the current CRG grade
193+
# Looks for '**Current Grade:** X' in READINESS.md; falls back to X
194+
crg-badge:
195+
@grade=$$(grep -oP '(?<=\*\*Current Grade:\*\* )[A-FX]' READINESS.md 2>/dev/null | head -1); \
196+
[ -z "$$grade" ] && grade="X"; \
197+
case "$$grade" in \
198+
A) color="brightgreen" ;; B) color="green" ;; C) color="yellow" ;; \
199+
D) color="orange" ;; E) color="red" ;; F) color="critical" ;; \
200+
*) color="lightgrey" ;; esac; \
201+
echo "[![CRG $$grade](https://img.shields.io/badge/CRG-$$grade-$$color?style=flat-square)](https://github.com/hyperpolymath/standards/tree/main/component-readiness-grades)"

0 commit comments

Comments
 (0)