Skip to content

Add first-class git source groups for multi-repo docs configs #153

Description

@KayleeWilliams

Problem

Remote acquisition is first-class in Leadtype, but the config is collection-first: every collection carries repository, ref, and cacheDir, even when several collections come from the same repository.

The real public-docs configs show the resulting friction:

  • c15t docs and changelog are separate collections from one Git repository;
  • a shared object reduces repetition, but acquisition and content mapping are still conceptually mixed;
  • production configs need custom code to normalize repository URLs and refs;
  • sourceConfig ownership is declared at collection level even when it is a source-level policy;
  • agents must infer that collections sharing (repository, ref) are cloned only once.

Leadtype already deduplicates acquisition internally. The API should expose the same mental model.

Proposal

Add an additive source-group helper that declares acquisition once and content collections beneath it. Exact naming should align with the canonical config work in #151; a possible shape is:

export default defineLeadtypeConfig({
  sources: {
    c15t: gitSource({
      repository: "https://github.com/c15t/c15t.git",
      ref: "main",
      cacheDir: ".leadtype/c15t",
      collections: {
        docs: {
          dir: "docs",
          routePrefix: "/docs",
          inheritConfig: true,
        },
        changelog: {
          dir: "changelog",
          routePrefix: "/changelog",
        },
      },
    }),
  },
});

The source should own:

  • repository URL and revision;
  • authentication/environment conventions;
  • cache/sync policy;
  • default config inheritance policy;
  • one acquisition lifecycle shared by its child collections.

Each collection should own:

  • content directory and include/exclude rules;
  • public route prefix/mounts;
  • navigation and schema overrides;
  • collection-specific inheritance exceptions.

Compatibility and behavior

  • Keep the existing flat collections map working and normalize both forms into the same source graph.
  • Preserve current clone deduplication and offline behavior.
  • Detect contradictory acquisition settings for collections that point at the same source.
  • Make revision pinning visible: allow branch/tag/SHA, but surface an actionable warning for mutable production refs.
  • Report source and collection IDs consistently in human and JSON output.
  • A failed source acquisition should name every dependent collection.

Acceptance criteria

  • One remote repository with multiple collections declares acquisition fields once.
  • Existing flat collection configs remain supported.
  • Both syntaxes resolve to the same internal source/collection graph.
  • Sync performs one clone/fetch per resolved source and reports dependent collections.
  • Source-level defaults can be overridden safely per collection.
  • Conflicting settings fail before acquisition with an actionable message.
  • Documentation includes local, single-remote, and multi-repo examples.
  • The c15t public-docs config can adopt the helper with a meaningful reduction in boilerplate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpriority: mediumMedium — valuable, not blocking

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions