Skip to content

refactor(scripts): move collection scripts from plugins to collections#728

Merged
WilliamBerryiii merged 4 commits intomainfrom
wberry/521-collection-scripts-refactor
Feb 23, 2026
Merged

refactor(scripts): move collection scripts from plugins to collections#728
WilliamBerryiii merged 4 commits intomainfrom
wberry/521-collection-scripts-refactor

Conversation

@WilliamBerryiii
Copy link
Member

Extracted 11 collection-management functions from PluginHelpers.psm1 into a dedicated CollectionHelpers.psm1 module under scripts/collections/Modules/, establishing a clear separation between collection and plugin concerns. Relocated collection validation scripts and their tests alongside the new module, updated all consumer imports, and expanded test coverage with new suites for both the extracted module and the previously untested Validate-Marketplace.ps1 script.

Description

Module Extraction and Restructuring

The core of this change split PluginHelpers.psm1 into two focused modules. Eleven collection-related functions moved to the new CollectionHelpers.psm1: Get-AllCollections, Get-ArtifactFiles, Get-ArtifactFrontmatter, Get-CollectionArtifactKey, Get-CollectionManifest, Resolve-CollectionItemMaturity, Test-ArtifactDeprecated, Test-DeprecatedPath, Test-HveCoreRepoRelativePath, Test-HveCoreRepoSpecificPath, and Update-HveCoreAllCollection. The trimmed PluginHelpers.psm1 retained only plugin-specific operations (symlink, manifest, packaging) and added a backward-compatible re-import of CollectionHelpers.psm1 so existing consumers continue to work during transition.

Script Relocation and Consumer Updates

Renamed Validate-Collections.ps1 from scripts/plugins/ to scripts/collections/ and updated its import to reference CollectionHelpers.psm1. The previously local Resolve-ItemMaturity helper was consolidated into the extracted Resolve-CollectionItemMaturity function. Four consumer scripts received import path updates:

  • Package-Extension.ps1 and Prepare-Extension.ps1 switched from PluginHelpers.psm1 to CollectionHelpers.psm1
  • Generate-Plugins.ps1 added CollectionHelpers.psm1 as a second import alongside PluginHelpers.psm1
  • Updated the lint:collections-metadata npm script path in package.json

Test Coverage Expansion

Created CollectionHelpers.Tests.ps1 (564 lines) covering all 11 extracted functions with Describe blocks for path exclusion, deprecated handling, maturity resolution, frontmatter parsing, and Update-HveCoreAllCollection workflows including DryRun safety. Relocated Validate-Collections.Tests.ps1 from scripts/tests/plugins/ to scripts/tests/collections/ and removed the superseded Resolve-ItemMaturity test block. Removed ~270 lines of tests from PluginHelpers.Tests.ps1 for functions that moved to CollectionHelpers.

Created Validate-Marketplace.Tests.ps1 (354 lines, 15 Describe blocks) covering marketplace manifest validation: format checks, required fields, version consistency, duplicate detection, and source directory verification.

Added 'collections' to coverage directories in pester.config.ps1 and introduced a defensive CollectionHelpers.psm1 re-import in Generate-Plugins.Tests.ps1 to handle PowerShell module scope invalidation from nested -Force imports. Overall test coverage improved from 82.70% to 84.12% across 1,500 tests with zero failures.

Documentation

Updated the Scripts Organization section in .github/copilot-instructions.md with the new scripts/collections/ entry. Revised scripts/README.md directory tree, scripts table, and tests table. Narrowed scripts/plugins/README.md to plugin-only content. Created scripts/collections/README.md with directory documentation, scripts table, and prerequisites.

Related Issue(s)

Related to #521

Type of Change

Select all that apply:

Code & Documentation:

  • Bug fix (non-breaking change fixing an issue)
  • New feature (non-breaking change adding functionality)
  • Breaking change (fix or feature causing existing functionality to change)
  • Documentation update

Infrastructure & Configuration:

  • GitHub Actions workflow
  • Linting configuration (markdown, PowerShell, etc.)
  • Security configuration
  • DevContainer configuration
  • Dependency update

AI Artifacts:

  • Reviewed contribution with prompt-builder agent and addressed all feedback
  • Copilot instructions (.github/instructions/*.instructions.md)
  • Copilot prompt (.github/prompts/*.prompt.md)
  • Copilot agent (.github/agents/*.agent.md)
  • Copilot skill (.github/skills/*/SKILL.md)

Note for AI Artifact Contributors:

  • Agents: Research, indexing/referencing other project (using standard VS Code GitHub Copilot/MCP tools), planning, and general implementation agents likely already exist. Review .github/agents/ before creating new ones.
  • Skills: Must include both bash and PowerShell scripts. See Skills.
  • Model Versions: Only contributions targeting the latest Anthropic and OpenAI models will be accepted. Older model versions (e.g., GPT-3.5, Claude 3) will be rejected.
  • See Agents Not Accepted and Model Version Requirements.

Other:

  • Script/automation (.ps1, .sh, .py)
  • Other (please describe):

Sample Prompts (for AI Artifact Contributions)

Testing

All 11 extracted functions have dedicated test coverage in CollectionHelpers.Tests.ps1. The new Validate-Marketplace.Tests.ps1 provides 15 Describe blocks covering format validation, required fields, version consistency, duplicate detection, and source directory verification. Existing Validate-Collections.Tests.ps1 was relocated and updated to match the new module structure. Coverage configuration in pester.config.ps1 was updated to include the scripts/collections/ directory.

Full suite: 1,500 tests, 0 failures, 84.12% code coverage (up from 82.70%).

Checklist

Required Checks

  • Documentation is updated (if applicable)
  • Files follow existing naming conventions
  • Changes are backwards compatible (if applicable)
  • Tests added for new functionality (if applicable)

AI Artifact Contributions

  • Used /prompt-analyze to review contribution
  • Addressed all feedback from prompt-builder review
  • Verified contribution follows common standards and type-specific requirements

Required Automated Checks

The following validation commands must pass before merging:

  • Markdown linting: npm run lint:md
  • Spell checking: npm run spell-check
  • Frontmatter validation: npm run lint:frontmatter
  • Skill structure validation: npm run validate:skills
  • Link validation: npm run lint:md-links
  • PowerShell analysis: npm run lint:ps
  • Plugin freshness: npm run plugin:generate

Security Considerations

  • This PR does not contain any sensitive or NDA information
  • Any new dependencies have been reviewed for security issues
  • Security-related scripts follow the principle of least privilege

Additional Notes

The backward-compatible re-import in PluginHelpers.psm1 (Import-Module CollectionHelpers) ensures existing callers continue to resolve collection functions during transition. This bridge can be removed once all downstream consumers reference CollectionHelpers.psm1 directly.

- create scripts/collections/ with CollectionHelpers.psm1 and Validate-Collections.ps1
- split PluginHelpers.psm1 into collection-specific and plugin-specific modules
- eliminate duplicate Resolve-ItemMaturity in Validate-Collections.ps1
- update consumer imports, tests, npm scripts, and documentation

🔧 - Generated by Copilot
…age tests

- create Validate-Marketplace.Tests.ps1 with 18 tests covering all validation paths
- extend CollectionHelpers.Tests.ps1 with 7 tests for deprecated, maturity, and new-item detection
- increase coverage from 82.70% to 84.12% (1500 tests, 0 failures)

🧪 - Generated by Copilot
@WilliamBerryiii WilliamBerryiii requested a review from a team as a code owner February 21, 2026 23:48
@github-actions
Copy link
Contributor

github-actions bot commented Feb 21, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None
@codecov-commenter
Copy link

codecov-commenter commented Feb 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@0a600ba). Learn more about missing BASE report.
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #728   +/-   ##
=======================================
  Coverage        ?   86.59%           
=======================================
  Files           ?       25           
  Lines           ?     4893           
  Branches        ?        0           
=======================================
  Hits            ?     4237           
  Misses          ?      656           
  Partials        ?        0           
Flag Coverage Δ
pester 86.59% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
scripts/collections/Modules/CollectionHelpers.psm1 100.00% <100.00%> (ø)
scripts/collections/Validate-Collections.ps1 91.36% <100.00%> (ø)
scripts/extension/Package-Extension.ps1 96.02% <100.00%> (ø)
scripts/extension/Prepare-Extension.ps1 94.45% <100.00%> (ø)
scripts/plugins/Generate-Plugins.ps1 96.11% <100.00%> (ø)
scripts/plugins/Modules/PluginHelpers.psm1 78.44% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
@WilliamBerryiii WilliamBerryiii merged commit 1a6d7d9 into main Feb 23, 2026
19 checks passed
WilliamBerryiii pushed a commit that referenced this pull request Feb 28, 2026
## Pre-Release 3.1.44

### ✨ Features

- add Docusaurus 3 documentation site with GitHub Pages deployment
(#680)
- add workflow permissions validation for OpenSSF Scorecard compliance
(#759)
- add DT coach return path handoff to task-researcher (#591) (#758)
- add DT subagent handoff workflow instructions (#592) (#757)
- create dt-method-06-deep.instructions.md (#602) (#748)
- create dt-method-05-deep.instructions.md (#747)
- add DT-aware task-implementor context instructions (#755)
- extract embedded PowerShell from workflows into testable scripts
(#738)
- add gitleaks binary-based secret scanning as PR gate (#734)
- add SBOM generation, attestation, and diff tooling to release pipeline
(#730)
- add dt-learning-tutor agent for DT education (#662)
- add DT image prompt generation guidance for Method 5 (#726)
- add DT-aware task-reviewer review context (#714)
- add dt-method-next routing prompt (#713)
- create dt-method-04-deep.instructions.md (#709)
- add Implementation Space exit handoff prompt for DT workflows (#708)
- add Write-CIStepSummary markdown table to Test-SHAStaleness github
output (#660)
- add dt-handoff-solution-space prompt for Solution Spac… (#707)

### 🐛 Bug Fixes

- update sidebar link color to meet WCAG AA contrast requirements (#814)
- harden even/odd versioning against regression and syntax errors (#816)
- replace even/odd versioning with SemVer -rc.N suffixes (#811)
- ensure prerelease label exists before PR creation (#806)
- replace Docusaurus favicons with Microsoft logo (#808)
- add missing subagents and shared instructions to collection manifests
(#804)
- standardize file path conventions for copilot-tracking output (#784)
- enforce project-scoped artifact isolation across DT files (#766)
- add top-level permissions to copilot-setup-steps.yml (#760)
- update broken file directives and markdown links after collection
directory reorg (#743)
- add pre-release companion pipeline with even/odd versioning (#735)
- exclude auto-generated CHANGELOG.md from spell check (#756)
- add job-level permissions to extension-publish.yml (#729)
- resolve handoff dependencies using display names (#727)
- add job-level permissions to validate-version in
extension-publish-prerelease (#731)
- replace parent-directory VS Code settings paths with per-subdirectory
enumeration (#732)

### 📚 Documentation

- add Design Thinking documentation and DT-to-RPI handoff (#789)
- add customization guides for HVE Core artifacts (#772)
- reconcile documentation against implementation (#771)
- document accepted Token-Permissions risks and add
lint:dependency-pinning (#763)
- add Design Thinking section to hve-core-all collection description
(#762)

### ♻️ Refactoring

- move collection scripts from plugins to collections (#728)
- remove duplicate git diff logic in frontmatter validator (#473)

### 🔧 Maintenance

- bump basic-ftp from 5.0.5 to 5.2.0 (#780)
- standardize script path references in SKILL.md files (#768)
- bump the github-actions group across 1 directory with 2 updates (#752)

---
*Managed automatically by pre-release workflow.*

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
WilliamBerryiii pushed a commit that referenced this pull request Feb 28, 2026
## Pre-Release 3.1.46

### ✨ Features

- add Docusaurus 3 documentation site with GitHub Pages deployment
(#680)
- add workflow permissions validation for OpenSSF Scorecard compliance
(#759)
- add DT coach return path handoff to task-researcher (#591) (#758)
- add DT subagent handoff workflow instructions (#592) (#757)
- create dt-method-06-deep.instructions.md (#602) (#748)
- create dt-method-05-deep.instructions.md (#747)
- add DT-aware task-implementor context instructions (#755)
- extract embedded PowerShell from workflows into testable scripts
(#738)
- add gitleaks binary-based secret scanning as PR gate (#734)
- add SBOM generation, attestation, and diff tooling to release pipeline
(#730)
- add dt-learning-tutor agent for DT education (#662)
- add DT image prompt generation guidance for Method 5 (#726)
- add DT-aware task-reviewer review context (#714)
- add dt-method-next routing prompt (#713)
- create dt-method-04-deep.instructions.md (#709)
- add Implementation Space exit handoff prompt for DT workflows (#708)
- add Write-CIStepSummary markdown table to Test-SHAStaleness github
output (#660)
- add dt-handoff-solution-space prompt for Solution Spac… (#707)

### 🐛 Bug Fixes

- update prerelease publish to use even/odd convention (#822)
- update sidebar link color to meet WCAG AA contrast requirements (#814)
- harden even/odd versioning against regression and syntax errors (#816)
- replace even/odd versioning with SemVer -rc.N suffixes (#811)
- ensure prerelease label exists before PR creation (#806)
- replace Docusaurus favicons with Microsoft logo (#808)
- add missing subagents and shared instructions to collection manifests
(#804)
- standardize file path conventions for copilot-tracking output (#784)
- enforce project-scoped artifact isolation across DT files (#766)
- add top-level permissions to copilot-setup-steps.yml (#760)
- update broken file directives and markdown links after collection
directory reorg (#743)
- add pre-release companion pipeline with even/odd versioning (#735)
- exclude auto-generated CHANGELOG.md from spell check (#756)
- add job-level permissions to extension-publish.yml (#729)
- resolve handoff dependencies using display names (#727)
- add job-level permissions to validate-version in
extension-publish-prerelease (#731)
- replace parent-directory VS Code settings paths with per-subdirectory
enumeration (#732)

### 📚 Documentation

- add Design Thinking documentation and DT-to-RPI handoff (#789)
- add customization guides for HVE Core artifacts (#772)
- reconcile documentation against implementation (#771)
- document accepted Token-Permissions risks and add
lint:dependency-pinning (#763)
- add Design Thinking section to hve-core-all collection description
(#762)

### ♻️ Refactoring

- move collection scripts from plugins to collections (#728)
- remove duplicate git diff logic in frontmatter validator (#473)

### 🔧 Maintenance

- pre-release 3.1.44 (#819)
- bump basic-ftp from 5.0.5 to 5.2.0 (#780)
- standardize script path references in SKILL.md files (#768)
- bump the github-actions group across 1 directory with 2 updates (#752)

---
*Managed automatically by pre-release workflow.*

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants