Core-Concepts-Libraries.md 2.9 KB

Libraries

Libraries are sources of templates. A library can be a Git repository or a local directory, and Boilerplates searches them in priority order.

Default Library

By default, Boilerplates points to the official template library:

Name: default
URL: https://github.com/christianlempa/boilerplates-library.git
Branch: main
Directory: .

Supported Library Types

  • git
  • static

Git Library Example

libraries:
  - name: default
    type: git
    url: https://github.com/christianlempa/boilerplates-library.git
    branch: main
    directory: .

Static Library Example

libraries:
  - name: local
    type: static
    path: ~/my-templates

Local Storage

Git libraries are stored under the active config directory's libraries/ folder.

Global-config default:

~/.config/boilerplates/libraries/

If the CLI is using a local ./config.yaml, the library checkout location becomes ./libraries/.

The configured directory is applied inside that checkout. For the official library the directory is ..

Configuration Location

By default, Boilerplates uses:

~/.config/boilerplates/config.yaml

If a local ./config.yaml exists in your current working directory, the CLI uses that file instead.

Discovery Rules

Boilerplates discovers templates by module directory, for example:

compose/
terraform/
ansible/

A directory is treated as a template only when it contains template.json.

Legacy template.yaml and template.yml directories are ignored during discovery.

Common Commands

List configured libraries:

boilerplates repo list

Sync Git libraries:

boilerplates repo update

Add a custom Git library:

boilerplates repo add my-templates \
  --library-type git \
  --url https://github.com/user/templates \
  --directory . \
  --branch main

Add a static library:

boilerplates repo add local \
  --library-type static \
  --path ~/my-templates

Remove a library:

boilerplates repo remove my-templates

Priority and Qualified IDs

Libraries are checked in config order. The first matching template wins when you use a simple ID.

Example:

libraries:
  - name: local
    type: static
    path: ~/my-templates
  - name: default
    type: git
    url: https://github.com/christianlempa/boilerplates-library.git
    branch: main
    directory: .

Simple ID:

boilerplates compose generate nginx

Qualified ID:

boilerplates compose generate nginx.local
boilerplates compose generate nginx.default

Draft Templates

Templates with metadata.draft: true are excluded from normal listings and lookup.

Config File

Example:

libraries:
  - name: default
    type: git
    url: https://github.com/christianlempa/boilerplates-library.git
    branch: main
    directory: .
  - name: local
    type: static
    path: /Users/me/my-templates