microsoft/hve-core

Public

mirrored fromhttps://github.com/microsoft/hve-coreAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
hve-core-v2.1.0

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

scripts/README.md

134lines · modecode

1---
2title: Scripts
3description: PowerShell scripts for linting, validation, and security automation
4author: HVE Core Team
5ms.date: 2025-11-05
6ms.topic: reference
7keywords:
8 - powershell
9 - scripts
10 - automation
11 - linting
12 - security
13estimated_reading_time: 5
14---
15
16This directory contains PowerShell scripts for automating linting, validation, and security checks in the `hve-core` repository.
17
18## Directory Structure
19
20```text
21scripts/
22├── dev-tools/ Development utilities (PR reference generation)
23├── extension/ VS Code extension packaging utilities
24├── lib/ Shared utility modules
25├── linting/ PowerShell linting and validation scripts
26├── security/ Security scanning and SHA pinning scripts
27└── tests/ Pester test organization
28```
29
30## Dev Tools
31
32Development utilities for working with hve-core.
33
34| Script | Purpose |
35|----------------------------|-------------------------------------------|
36| `Generate-PrReference.ps1` | Generate PR reference XML for reviews |
37| `pr-ref-gen.sh` | Shell wrapper for PR reference generation |
38
39## Extension
40
41VS Code extension packaging utilities.
42
43| Script | Purpose |
44|-------------------------|------------------------------------------|
45| `Package-Extension.ps1` | Package the VS Code extension |
46| `Prepare-Extension.ps1` | Prepare extension contents for packaging |
47
48## Library
49
50Shared utility modules used across scripts.
51
52| Script | Purpose |
53|----------------------------|--------------------------------------|
54| `Get-VerifiedDownload.ps1` | Download files with SHA verification |
55
56## Linting Scripts
57
58The `linting/` directory contains scripts for validating code quality and documentation:
59
60* **PSScriptAnalyzer**: Static analysis for PowerShell files
61* **Markdown Frontmatter**: Validate YAML frontmatter in markdown files
62* **Link Language Check**: Detect en-us language paths in URLs
63* **Markdown Link Check**: Validate markdown links
64* **Shared Module**: Common helper functions for GitHub Actions integration
65
66See [linting/README.md](linting/README.md) for detailed documentation.
67
68## Security Scripts
69
70The `security/` directory contains scripts for security scanning and dependency management:
71
72* **Dependency Pinning**: Validate SHA pinning compliance
73* **SHA Staleness**: Check for outdated SHA pins
74* **SHA Updates**: Automate updating GitHub Actions SHA pins
75
76## Tests
77
78Pester test organization matching the scripts structure.
79
80| Directory | Tests For |
81|--------------|-------------------------------|
82| `dev-tools/` | PR reference generation tests |
83| `extension/` | Extension packaging tests |
84| `lib/` | Library utility tests |
85| `linting/` | Linting script tests |
86| `security/` | Security validation tests |
87
88Run all tests:
89
90```bash
91npm run test
92```
93
94## Usage
95
96All scripts are designed to run both locally and in GitHub Actions workflows. They support common parameters like `-Verbose` and `-Debug` for troubleshooting.
97
98**Local Testing**:
99
100```powershell
101# Test PSScriptAnalyzer on changed files
102./scripts/linting/Invoke-PSScriptAnalyzer.ps1 -ChangedFilesOnly -Verbose
103
104# Validate markdown frontmatter
105./scripts/linting/Validate-MarkdownFrontmatter.ps1 -Verbose
106
107# Check for language paths in URLs
108./scripts/linting/Invoke-LinkLanguageCheck.ps1 -Verbose
109```
110
111**GitHub Actions Integration**:
112
113All scripts automatically detect GitHub Actions environment and provide appropriate output formatting (annotations, summaries, artifacts).
114
115## Contributing
116
117When adding new scripts:
118
1191. Follow PowerShell best practices (PSScriptAnalyzer compliant)
1202. Support `-Verbose` and `-Debug` parameters
1213. Add GitHub Actions integration using `LintingHelpers` module functions
1224. Include inline help with `.SYNOPSIS`, `.DESCRIPTION`, `.PARAMETER`, and `.EXAMPLE`
1235. Document in relevant README files
1246. Test locally before creating PR
125
126## Related Documentation
127
128* [Linting Scripts Documentation](linting/README.md)
129* [GitHub Workflows Documentation](../.github/workflows/README.md)
130* [Contributing Guidelines](../CONTRIBUTING.md)
131
132---
133
134🤖 Crafted with precision by ✨Copilot following brilliant human instruction, then carefully refined by our team of discerning human reviewers.