Skip to content

Feature: Asset Overrides in Collections #6

Description

@srbouffard

Feature: Asset Overrides in Collections

Problem

Core collections often define instructions with specific applyTo patterns (e.g., src/**/*.py). However, different teams or projects might use different directory structures (e.g., lib/**/*.py or app/**/*.py). Currently, they have to duplicate the entire asset just to change that one field, which breaks the inheritance model.

Proposed Solution

Allow the collections.yaml schema to support an overrides property for items.

Example Schema

pfe-charms:
  includes:
    - core
  items:
    - src: assets/instructions/python/code-commenting.instructions.md
      dest: .github/instructions/python-code-commenting.instructions.md
      # NEW: Override specific fields in the markdown frontmatter
      overrides:
        applyTo: "lib/**/*.py"
        priority: 100

Implementation Details

  1. Parser Update: The scripts/install_collections.sh script needs to detect the overrides block.
  2. Processing:
    • Read the source markdown file.
    • Parse the YAML frontmatter.
    • Merge the overrides into the frontmatter.
    • Write the modified content to the destination.
  3. Dependencies: This will likely require a more robust YAML/Markdown processor than simple cat or sed. We might need to rely heavily on yq's frontmatter processing capabilities or introduce a small Python helper script.

Benefits

  • Reduces duplication.
  • Allows core assets to be more generic.
  • Empowers teams to adapt rules to their specific context.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions