Skip to content

Collection detection for nested template patterns #121

Description

@raiderrobert

Summary

When diecut extract encounters a directory like skills/ that contains multiple sibling subdirectories with similar structures, it should detect this as a "collection" and offer to generate a nested diecut.toml for that subdirectory pattern.

This would enable diecut new to scaffold a new item within an existing project — e.g., adding a new skill to a skills package without re-scaffolding the whole project.

Example

Given a source project with:

skills/
  convention-mining/       → SKILL.md, references/*.md
  iterating-skill-audit/   → SKILL.md, review-focus.md
  auditing-convention-skills/ → SKILL.md, references/*.md
  writing-skills/          → SKILL.md, craft.md, testing.md, ...
  reviewing-abstraction-boundaries/ → SKILL.md

extract would detect that all 5 subdirectories share SKILL.md (5/5 = high confidence), some share a references/ subdir (2/5 = lower confidence), and offer to:

  1. Generate a sub-template with its own diecut.toml for the common pattern
  2. Mine common content structure across the shared files (e.g., common markdown headings in SKILL.md)
  3. Produce a stub example that captures the pattern

Design considerations

  • Structural similarity (file tree shape) is cheap and answers "is this a collection?"
  • Content similarity (within common files) is more expensive and answers "what does the stub look like?"
  • Confidence thresholds should differ for these two layers
  • Interactive confirmation: show detected collections and let users confirm/adjust
  • The generated sub-template should be a full diecut.toml that works with diecut new independently

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions