Skip to content

Projects and packages

A project is a directory with brass.project, a Brass file holding one struct literal (so brass fmt and the editor work on it):

Project {
name: "app"
version: "0.1.0"
deps: [
Dep { name: "geo", git: "https://example.com/geo", tag: "v1.0.0" },
]
}
  • brass new <name> makes brass.project and src/main.brass; brass run, build, test and check with no file use src/main.brass.
  • brass add <name> <git url> <tag> records a dependency and fetches; brass fetch clones each package at its tag into a cache, follows the packages’ own brass.project files, and keeps for each package the highest version anything asks for (minimal version selection: no solver, no surprise upgrades). It writes brass.lock with the exact commits.
  • Builds never touch the network: imports find packages through the lock file, and a missing package says to run brass fetch. fetch refuses a tag that now points at a different commit than the lock recorded.
  • import geo loads the package’s src/geo.brass; import geo.shapes loads src/shapes.brass. A package’s own imports stay inside it.
  • brass.lock also records a SHA-256 checksum over all of each package’s files. fetch refuses a package whose files differ from the recorded sum for the same commit, and every build checks the cached copy against it, so a tampered cache or a rewritten tag is caught, not compiled.
  • A package is a git repository. A package index is a plain text file of name git-url lines, found through BRASS_INDEX (a file or an http(s) URL; default ~/.config/brass/index.txt): brass add <name> <tag> looks the URL up there, and brass search [word] lists entries. The index only maps names to repositories; the lock file’s commits and checksums are what make a build repeatable.