harden root-path deletion guard for rm variants

This commit is contained in:
野生派Coder~
2026-02-14 13:56:45 +08:00
parent 01b56f2398
commit eee49158d1
3 changed files with 135 additions and 9 deletions

View File

@@ -28,11 +28,11 @@ var destructivePatterns = []*regexp.Regexp{
regexp.MustCompile(`\bchown\b.+\s+/`),
regexp.MustCompile(`\bclawgo\s+uninstall\b`),
regexp.MustCompile(`\bdbt\s+drop\b`),
regexp.MustCompile(`\bgit\s+clean\b`),
}
var moderatePatterns = []*regexp.Regexp{
regexp.MustCompile(`\bgit\s+reset\s+--hard\b`),
regexp.MustCompile(`\bgit\s+clean\b`),
regexp.MustCompile(`\bdocker\s+system\s+prune\b`),
regexp.MustCompile(`\bapt(-get)?\s+install\b`),
regexp.MustCompile(`\byum\s+install\b`),