Capability 001: Configuration¶
Status: Accepted
Context¶
repo generates a repository from one file, .repo.yaml, which the developer
owns and edits (mission statement;
target picture, sections Configuration and Commands).
This capability defines that file, the commands that write its template, and
how repo update reads and checks it.
What repo update generates from it is not part of this capability.
References¶
Details¶
Fields of .repo.yaml:
| Field | Level | Required | Content |
|---|---|---|---|
name |
repository | yes | Human-readable name |
description |
repository | yes | One sentence |
repository |
repository | yes | Path of the repository at its host, e.g. gitlab.com/<group>/<project> |
repoType |
repository | yes | single or mono |
ci |
repository | yes | gitlab or github |
assistants |
repository | no | Any of claude, copilot; empty or absent: none |
documentation |
repository | no | lean or extended (capability 010); absent: lean |
requirements |
repository | no | repo or external (capability 010); absent: repo |
tracker |
repository | no | Issue list URL for requirements: external (capability 010); absent: derived |
artifacts |
repository | yes | List of artifacts |
name |
artifact | yes | Slug: executable, archive, image, tag prefix, and, in mono, directory |
title |
artifact | yes | Human-readable name |
description |
artifact | yes | One sentence |
language |
artifact | yes | cpp, go, java, typescript, kicad |
type |
artifact | yes | library, service, tool, frontend-react, firmware-stm32, electronics |
modules |
artifact | no | Modules to generate; absent: the profile's defaults |
registry |
artifact | no | Container registry; absent: derived from repository and ci |
port |
artifact | no | Host port of a service or frontend in the generated Compose files; absent: 8080 plus the artifact's position, counted from 0 |
meta |
repository | — | Written by repo update only: generatorVersion, and the modules per artifact |
Values derived from repository:
| Value | single |
mono |
|---|---|---|
| Go module path | <repository> |
<repository>/<name> |
| Java package | Reversed host, then the path segments of the Go module path | Same |
| Container registry | Registry of the ci host for the Go module path without its last segment |
Same |
Supported combinations of language and type:
| Language | Types |
|---|---|
cpp |
library, service, tool, firmware-stm32 |
go |
library, service, tool |
java |
library, service |
typescript |
frontend-react |
kicad |
electronics |
Functional Requirements¶
repo initwrites a.repo.yamltemplate withrepoType: singleand one artifact into the current directory.repo init-monowrites a.repo.yamltemplate withrepoType: monoand two artifacts into the current directory.repo addappends one artifact to theartifactslist of amono.repo.yaml.- Every template contains each field of its level with an empty or example value and a comment
naming the permitted values.
repo addkeeps the existing content and comments of the file. - The first line of a template points editors to the schema of
.repo.yamlin the generator's docs site, as a comment the YAML language server reads. repo updatereads.repo.yamlfrom the current directory and validates it before it writes anything. Validation reports every violation found, not only the first.- Validation rules:
- Every required field is present and not empty.
- Every enumerated field has a permitted value;
languageandtypeform a supported combination. single: exactly one artifact;mono: at least one.- An artifact name is a slug: lowercase letters, digits, and single hyphens, starting with a letter and not ending with a hyphen. Artifact names are unique.
repositoryconsists of a host and at least two path segments, without scheme or.git.
- After successful generation,
repo updaterewrites themetablock, withmeta.generatorVersionset to its own version, and changes nothing else in.repo.yaml. repo versionprints the generator version.- No command accepts options or arguments.
Non-Functional Requirements¶
- A developer who knows the target picture fills in a template without other documentation; the comments suffice.
Technical Requirements¶
None.
Error Handling¶
- A violation is reported as
.repo.yaml:<line>: <field>: <problem>, one per line, on standard error; the command exits non-zero and writes nothing. repo initandrepo init-monorefuse an existing.repo.yamland leave it untouched.repo addrefuses a missing.repo.yamland asingleone.repo updatewithout.repo.yamlin the current directory names the file and suggestsrepo initorrepo init-mono; inside an artifact directory of a mono-repository it also suggests running from the repository root.- A
.repo.yamlor.mono-repo.yamlof the previous format (top-level keycontent:) is refused with a message that the format changed withrepo2.0.0 and that the old version remains available asv1.5.0. - A command given an option or argument fails with its usage text.
Out of Scope¶
- What
repo updategenerates, the modules, andrepo check - Deriving values from the Git remote or the directory name when writing a template
- Migrating a configuration of the previous format
Acceptance Criteria¶
- Empty directory,
repo init:.repo.yamlexists withrepoType: singleand one artifact. - Empty directory,
repo init-mono:.repo.yamlexists withrepoType: monoand two artifacts. - Existing
.repo.yaml,repo initandrepo init-mono: refused; the file is unchanged. mono.repo.yamlwith comments,repo add: three artifacts; the comments and the first two artifacts are unchanged.single.repo.yaml,repo add: refused; the file is unchanged.- Unfilled template from
repo init,repo update: every empty required field is reported with its line; nothing is written. singlewith two artifacts,monowithout artifacts: each reported.language: java,type: tool: reported as an unsupported combination.- Two artifacts with the same name, names
Bridge,my_bridge,../x,bridge-: each reported. repository: https://gitlab.com/<group>/<project>.git,repository: <project>: each reported.- Valid
.repo.yaml,repo update:meta.generatorVersionequals the version thatrepo versionprints; the file outsidemetais byte-identical. - Previous format with
content:: refused with the hint tov1.5.0. repo update --dry-run,repo init --name x: each fails with the usage text.monowithrepository: gitlab.com/<group>/<project>and a Go artifactbridge: Go module pathgitlab.com/<group>/<project>/bridge.- Empty directory,
repo initandrepo init-mono: the first line of.repo.yamlis# yaml-language-server: $schema=followed by the URL ofrepo-config.schema.jsonin the docs site.
Decisions¶
- Templates carry no derived values. The previous
repo initderived the CI system, artifact name, and module path from the Git remote. A template with comments is simpler and shows every field; the developer fills in a handful of values once. repo updatewrites only themetablock into.repo.yaml. It never reformats the developer's file, so comments survive;repo addis the only other command that edits it.- Validation reports all violations at once. A filled-in template typically has several gaps; one run per gap would be tedious.
repo updateruns from the repository root only. One.repo.yamldescribes the whole repository, so there is no per-artifact entry point.- An artifact's directory in a mono-repository is its name. The name is a slug anyway, like
the project slug of a single repository; a separate
pathwould only allow the two to differ. Consequence: artifacts cannot be grouped in subdirectories, and renaming an artifact moves its directory. - One
repositoryfield instead of a module path per artifact. Go module path, Java package, and registry default all follow from where the repository lives, so the developer states it once. Consequence: a Go module path that differs from the repository path, such as a vanity import path, is not possible.