Summary
Validate-MarkdownFrontmatter.ps1 hardcodes its output path to logs/frontmatter-validation-results.json (line ~796). Adding an -OutputPath parameter with the current path as default enables callers to redirect results without modifying the script, improving reusability and testability.
Current Behavior
The result file path is hardcoded. All invocations write to the same location regardless of context.
Expected Behavior
The script accepts an -OutputPath parameter (defaulting to logs/frontmatter-validation-results.json) that controls where the JSON result file is written.
Root Cause
The script was written for a single CI context and never parameterized the output destination.
Files Requiring Changes
| File |
Change |
scripts/linting/Validate-MarkdownFrontmatter.ps1 |
Add -OutputPath parameter; replace hardcoded path with parameter reference |
npm script in package.json |
No change needed (default path matches current behavior) |
| Corresponding Pester test file |
Add tests for custom -OutputPath |
Fix Guidance
- Add
-OutputPath to the param() block with default value "logs/frontmatter-validation-results.json".
- Replace all hardcoded references to the output path with
$OutputPath.
- Update comment-based help to document the new parameter.
- Add Pester tests verifying: (a) default path works as before, (b) custom path writes to specified location.
- Run
npm run lint:ps and npm run test:ps.
RPI Framework Starter Prompts
Phase 1: Research
Select Task Researcher from the agent picker at the bottom of the GitHub Copilot Chat prompt pane, then send the following prompt:
Research adding an -OutputPath parameter to Validate-MarkdownFrontmatter.ps1. Investigate: (1) Read the script and find all hardcoded references to the output file path (exact line numbers). (2) Identify the existing param() block structure and parameter conventions used. (3) Check how the npm script invokes this PS1 — does it pass any path arguments? (4) Review existing Pester tests for output file assertions. (5) Check other scripts that already have -OutputPath parameters for the established pattern. (6) Review codecov.yml patch coverage requirements.
Phase 2: Plan
Select Task Planner from the agent picker at the bottom of the GitHub Copilot Chat prompt pane, then send the following prompt:
Plan adding an -OutputPath parameter to Validate-MarkdownFrontmatter.ps1 using the research document. The plan should cover: (1) Adding the parameter with default value "logs/frontmatter-validation-results.json". (2) Replacing hardcoded path references with $OutputPath. (3) Updating comment-based help. (4) Adding Pester tests for both default and custom path scenarios. (5) Validation: npm run test:ps, npm run lint:ps.
Phase 3: Implement
Select Task Implementor from the agent picker at the bottom of the GitHub Copilot Chat prompt pane, then send the following prompt:
Implement adding an -OutputPath parameter to Validate-MarkdownFrontmatter.ps1 following the plan. Steps: (1) Add -OutputPath parameter with default value to param() block. (2) Replace hardcoded paths with $OutputPath. (3) Update comment-based help. (4) Add Pester tests for default and custom output paths. (5) Run npm run lint:ps and npm run test:ps. (6) Run npm run lint:frontmatter and verify logs/frontmatter-validation-results.json is still created with default invocation.
Phase 4: Review
Select Task Reviewer from the agent picker at the bottom of the GitHub Copilot Chat prompt pane, then send the following prompt:
Review adding -OutputPath parameter to Validate-MarkdownFrontmatter.ps1. Verify: (1) Parameter added with correct default value. (2) All hardcoded path references replaced. (3) Comment-based help updated. (4) Pester tests cover default and custom path scenarios. (5) No behavioral change when invoked without the parameter. (6) npm run lint:ps clean. (7) npm run test:ps passing. (8) PSScriptAnalyzer rules satisfied.
References
scripts/linting/Validate-MarkdownFrontmatter.ps1 — target script (line ~796)
- Existing parameterized scripts as pattern references
Summary
Validate-MarkdownFrontmatter.ps1hardcodes its output path tologs/frontmatter-validation-results.json(line ~796). Adding an-OutputPathparameter with the current path as default enables callers to redirect results without modifying the script, improving reusability and testability.Current Behavior
The result file path is hardcoded. All invocations write to the same location regardless of context.
Expected Behavior
The script accepts an
-OutputPathparameter (defaulting tologs/frontmatter-validation-results.json) that controls where the JSON result file is written.Root Cause
The script was written for a single CI context and never parameterized the output destination.
Files Requiring Changes
scripts/linting/Validate-MarkdownFrontmatter.ps1-OutputPathparameter; replace hardcoded path with parameter referencepackage.json-OutputPathFix Guidance
-OutputPathto theparam()block with default value"logs/frontmatter-validation-results.json".$OutputPath.npm run lint:psandnpm run test:ps.RPI Framework Starter Prompts
Phase 1: Research
Select Task Researcher from the agent picker at the bottom of the GitHub Copilot Chat prompt pane, then send the following prompt:
Phase 2: Plan
Select Task Planner from the agent picker at the bottom of the GitHub Copilot Chat prompt pane, then send the following prompt:
Phase 3: Implement
Select Task Implementor from the agent picker at the bottom of the GitHub Copilot Chat prompt pane, then send the following prompt:
Phase 4: Review
Select Task Reviewer from the agent picker at the bottom of the GitHub Copilot Chat prompt pane, then send the following prompt:
References
scripts/linting/Validate-MarkdownFrontmatter.ps1— target script (line ~796)