Submodules: nested projects mounted as secondary worktrees

-- gritzko

A submodule splits a project into smaller reusable parts or vendors a dependency; the goal is a seamless recursive experience where clone, checkout, and commit descend into subs by default. The method reuses Beagle's own machinery: a submodule is just another project in the parent's Store, checked out as a secondary worktree at the gitlink path. Git stays byte-exact — a 160000 gitlink and a root .gitmodules blob name the pin and upstream.

Recursion

Mutating verbs recur cleanly only into a sub BASED ON the pin; an ahead/diverged sub is skipped and stays "adv" (except the post commit forms below, which absorb it). Views (status, diff, log, …) recur always, where applicable.

  1. GET - clone/update:
  2. POST - commit/advance:
  3. PATCH - merge:
  4. PUT, DELETE - stage:

- explicit form recurs if a path leads into a submodule

  1. HEAD - fetch:

Store layout

A submodule is just another project shard in the parent's store, mounted as a secondary worktree that points back; there is no separate submodule store class. The parent tree's 160000 gitlink pins which commit, the root .gitmodules blob names where to fetch it.