🐛 fix(scripts): repair windows script parsing

fix powershell here-strings and help alias conflicts\nadd windows script lint test and run it in CI
This commit is contained in:
csh
2026-01-22 17:30:15 +08:00
parent 26a35e0ccf
commit 5a2925f846
8 changed files with 83 additions and 24 deletions
@@ -0,0 +1,44 @@
#!/usr/bin/env bats
# Windows script lint tests (PowerShell/Batch)
setup() {
export PLAYBOOK_ROOT="$(cd "$BATS_TEST_DIRNAME/../.." && pwd)"
}
@test "sync_standards.ps1 - here-string terminator not piped" {
run grep -nE "^[[:space:]]*['\\\"]@\\s*\\|" "$PLAYBOOK_ROOT/scripts/sync_standards.ps1"
[ "$status" -ne 0 ]
}
@test "sync_standards.ps1 - Help alias does not shadow parameter name" {
run grep -niE "Alias\\([^)]*['\"]help['\"]" "$PLAYBOOK_ROOT/scripts/sync_standards.ps1"
[ "$status" -ne 0 ]
}
@test "install_codex_skills.ps1 - Help alias does not shadow parameter name" {
run grep -niE "Alias\\([^)]*['\"]help['\"]" "$PLAYBOOK_ROOT/scripts/install_codex_skills.ps1"
[ "$status" -ne 0 ]
}
@test "sync_templates.ps1 - Help alias does not shadow parameter name" {
run grep -niE "Alias\\([^)]*['\"]help['\"]" "$PLAYBOOK_ROOT/scripts/sync_templates.ps1"
[ "$status" -ne 0 ]
}
@test "vendor_playbook.ps1 - Help alias does not shadow parameter name" {
run grep -niE "Alias\\([^)]*['\"]help['\"]" "$PLAYBOOK_ROOT/scripts/vendor_playbook.ps1"
[ "$status" -ne 0 ]
}
@test "sync_standards.bat - show_help label follows parse_args" {
local file="$PLAYBOOK_ROOT/scripts/sync_standards.bat"
local show_line
local parse_line
show_line=$(grep -n "^:show_help" "$file" | head -n 1 | cut -d: -f1)
parse_line=$(grep -n "^:parse_args" "$file" | head -n 1 | cut -d: -f1)
[ -n "$show_line" ]
[ -n "$parse_line" ]
[ "$show_line" -gt "$parse_line" ]
}