Skip to content

Studio: pattern-set modal — course-repo source, 'Add referenced', commit set to protocol folder (library → colocation) #150

Description

@mbreiser

Context

The library-first workflow (now the lead flow in docs/protocol-pattern-workflow.md) saves patterns to the shared patterns/ library, then builds a protocol referencing them by name. That runs fine on any bench (the library is repo-global), but the protocol is not a self-contained pair: Promote-to-shared copies only the colocated <name>_patterns/ folder, and the repo-side pattern checks (W badges on repo-opened protocols) key off colocation.

Today's workaround (documented in the guide): per pattern, in the Pattern Designer — LOAD ▾ → Open from Repo… → 📚 Shared pattern library → open it → ⇪ SAVE TO REPO… → "A protocol's pattern folder". Clunky for N patterns.

Proposal

A one-click "Collect patterns into this protocol's folder…" action in the Arena Studio (File ▾, Edit view, next to Promote):

  1. Resolve every pattern: name referenced by the current (saved) protocol.
  2. For each name found in patterns/ (and not already in <name>_patterns/): fetch bytes, direct-commit a copy into protocols/<bench-id>/<name>_patterns/.
  3. Skip + report names already colocated; list unresolved names loudly (typo or not yet made).
  4. Same-name-different-content in the destination → hash-compare guard like Promote (refuse, never overwrite silently).

Building blocks all exist: GH.reqGetContents/runBytes/directCommit (path allowlist already covers both areas), RunnerLib-style pattern-name extraction, the Promote flow's hash guard, and registerRepoPatternPreviews to refresh W badges afterwards.

Notes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions