-
Notifications
You must be signed in to change notification settings - Fork 125
Description
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
-OutputPathto theparam()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: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:
Research adding an
-OutputPathparameter toValidate-MarkdownFrontmatter.ps1. Investigate: (1) Read the script and find all hardcoded references to the output file path (exact line numbers). (2) Identify the existingparam()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-OutputPathparameters for the established pattern. (6) Reviewcodecov.ymlpatch 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
-OutputPathparameter toValidate-MarkdownFrontmatter.ps1using 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
-OutputPathparameter toValidate-MarkdownFrontmatter.ps1following the plan. Steps: (1) Add-OutputPathparameter with default value toparam()block. (2) Replace hardcoded paths with$OutputPath. (3) Update comment-based help. (4) Add Pester tests for default and custom output paths. (5) Runnpm run lint:psandnpm run test:ps. (6) Runnpm run lint:frontmatterand verifylogs/frontmatter-validation-results.jsonis 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
-OutputPathparameter toValidate-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:psclean. (7)npm run test:pspassing. (8) PSScriptAnalyzer rules satisfied.
References
scripts/linting/Validate-MarkdownFrontmatter.ps1— target script (line ~796)- Existing parameterized scripts as pattern references