Skip to content

feat(scripts): add orphan detection, intra-collection duplicates, companion file, and hve-core-all coverage checks to collection validator #520

@katriendg

Description

@katriendg

Summary

Add four missing validation checks to Validate-Collections.ps1 that close gaps between what the validator enforces and what collection integrity requires.

Problem

The collection validator checks manifest-inward only: it verifies declared items exist on disk, IDs are unique, paths resolve, kind-suffix conventions hold, and maturity values are valid. It does not detect:

  1. Orphaned artifacts — files on disk not listed in any collection (especially hve-core-all)
  2. Intra-collection duplicates — the same kind+path listed twice within a single manifest
  3. Missing companion .collection.md — a manifest without its paired markdown description file
  4. hve-core-all coverage gaps — items exclusive to a themed collection but absent from the canonical superset

Approach

1. Orphaned artifact detection

PluginHelpers.psm1 already exports Get-ArtifactFiles which discovers all artifacts under .github/ (excluding .github/**/hve-core/). Compare that set against the union of all collection manifest items.

Severity levels:

  • Error: Artifact on disk but absent from hve-core-all
  • Warning: Artifact only in hve-core-all but not in any themed collection

2. Intra-collection duplicate detection

Get-CollectionItemKey already builds kind|path composite keys. Track keys per manifest and flag when the same key appears twice within a single collection.

3. Companion .collection.md validation

For each .collection.yml in collections/, verify a matching .collection.md (same base name) exists. Report missing companions as warnings.

4. hve-core-all coverage enforcement

Verify every item in any themed collection also exists in hve-core-all. The existing canonical entry check only triggers when an item appears in 2+ collections; items exclusive to one themed collection are never checked.

Acceptance Criteria

  • Validator discovers all on-disk artifacts using Get-ArtifactFiles and reports artifacts absent from all collections as errors
  • Artifacts on disk but absent from hve-core-all specifically receive a clear error message
  • Artifacts under .github/**/hve-core/ remain excluded (repo-specific, not distributed)
  • Duplicate kind+path entries within a single collection manifest produce an error identifying the collection ID and duplicated item
  • Each .collection.yml without a matching .collection.md produces a warning
  • Items in themed collections but absent from hve-core-all produce errors
  • Pester tests cover all four new validation scenarios
  • CI validation (npm run plugin:validate) catches all new error types

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestinfrastructureRepository infrastructure and tooling

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions