templates

package
v0.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package templates holds the starting structures a new project can be created from: a directory skeleton plus the AGENTS.md that explains it.

The files are go:embed'ed rather than fetched, because `cmd/bdrive` is one binary serving the CLI, the daemon and the hub — so the hub that seeds a project at creation and the client that seeds one with `bdrive init --template` read the identical set, with no gallery and no drift.

The AGENTS.md is the deliverable. Directories are the easy half and the half that decays; what makes a structure stick is the instruction file telling an agent where a new note goes, when something is archived, and what a good filename looks like.

One hard rule for the content: BearDrive syncs paths, not directories (internal/syncer/walk.go only journals regular files), so an empty directory never reaches a teammate. Every directory in a template holds at least one real file — asserted in the tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Names

func Names() []string

Names lists the valid template names, for error messages.

Types

type File

type File struct {
	Path    string `json:"path"`
	Content string `json:"-"`
}

File is one file of a template: a slash-separated path relative to the project root, and its literal content.

type Template

type Template struct {
	Name  string `json:"name"`  // the flag/API value, e.g. "docs"
	Title string `json:"title"` // what a menu shows, e.g. "Docs + decision records"
	Blurb string `json:"blurb"` // the one-line shape, e.g. "docs/, decisions/"
	Files []File `json:"-"`
}

Template is one starting structure.

func Get

func Get(name string) (Template, error)

Get returns the named template. An unknown name errors, naming the set.

func List

func List() []Template

List returns every shipped template, recommended first.

func (Template) Dirs

func (t Template) Dirs() []string

Dirs lists every directory a template's paths imply, for the every-directory-holds-a-file check.

func (Template) WriteTo

func (t Template) WriteTo(dir string) ([]string, error)

WriteTo writes the template into dir and returns the paths it wrote. A path that already exists is never overwritten and is left out of the result — which is what makes seeding twice a no-op rather than a divergence.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL