Contributors
Listsome is one crate and one binary, with no runtime and no database. This page covers the layout of the code, the commands that keep it honest, and what a change needs before it’s worth a review.
How a build works
projects/*/index.md frontmatter and Markdown
|
v
project_intake splits frontmatter, parses Markdown, extracts structure
|
v
model Project, ProjectMetadata, Step, MaterialItem
|
v
render MiniJinja context built from the model
|
v
generator writes output/, images, taxonomies, feed, manifest
|
v
output/ static HTML, any host takes it from here
listsome build walks the pipeline in that order, and each stage takes its
input from the stage before it rather than from the filesystem.
Modules
| Path | Responsibility |
|---|---|
src/main.rs | Entry point, log filter setup, error exit code |
src/cli.rs | Argument parsing with clap, command dispatch |
src/commands.rs | Command implementations, the only place that wires stages together |
src/config.rs | Config loading, defaults for a new site, saving |
src/error.rs | ListsomeError and the crate’s result alias |
src/model/ | Project, ProjectMetadata, Step, MaterialItem, SiteConfig |
src/project_intake/ | Frontmatter parsing, Markdown to HTML, steps, callouts, materials tables |
src/project_intake/materials.rs | Column matching and h-product markup for bills of materials |
src/render/mod.rs | Template contexts and content enhancement |
src/generator/ | Site writing: discovery, assets, taxonomy, feed, renderer |
src/images.rs | Resizing and encoding |
src/webmention/ | Fetch, verify, storage, send, shared HTTP client |
src/server/ | Dev server, file watch, WebSocket reload |
src/templates/ | Built-in MiniJinja templates |
src/assets/ | Built-in style sheet and the lightbox script |
src/project_intake is the parser. Nothing named src/parser exists, whatever
older notes say.
Data flow
- A command loads
listsome.tomlthroughconfig::find_and_load_config. generator::discoverywalksprojects/two levels deep and reads every directory that holds anindex.md.project_intake::parse_projectsplits frontmatter, renders the body, and pulls out steps, callouts, and materials tables. A file that fails to parse build drops it rather than reports it.renderbuilds a context per project and hands it to a MiniJinja template.generator::assetscopies each project’sassets/directory and re-encodes images on the way through.generatorwrites the index pages, the category and tag pages, the Atom feed, andoutput/.webmentions/outbound.json.
Design rules
The checks enforce these rules rather than suggest them.
- No
unwrap, noexpect, nopanicoutside tests.clippy.tomlallows them in test code, andsrc/main.rsdeniesclippy::unwrap_used,clippy::expect_used, andclippy::panicat the crate root for everything else. - Errors carry their context.
ListsomeErrorattaches the path, template, or pattern that failed, and keeps the underlying error as its#[source], so a message names a file rather than a syscall and a cause stays reachable. - Pure parsing, shell commands.
project_intakeandrendertake data and return data. Filesystem and network work lives incommands.rsandgenerator/. - One HTTP abstraction.
webmention::http::HttpClienthas a real implementation and a mock, so tests never reach the network. - No silent drops. A build that skips a project or a config key says so. One exception is still open: #84, a project that fails to parse.
Commands
just is the front door.
| Command | What it does |
|---|---|
just build | Release build |
just install | Release build, then copy to ~/.cargo/bin |
just test | Test suite |
just check | Type check, no code generation |
just clippy | Lints with --all-targets and -D warnings |
just docs-lint | Vale and rumdl over docs/ and the README, then the mdBook build |
just serve-example | Release build, then serve the example site on port 8080 |
just watch | Rebuild on change |
cargo clippy without --all-targets skips test code, which is why the pre-commit
hook isn’t the gate that matters. Run just clippy before you call a change
done.
Tests
cargo test runs the unit modules inside src/ plus one integration suite:
-
tests/example_site.rsbuildsexamples/basicwith the compiled binary and snapshots the index page, one project page, and the category index. When a change shouldn’t alter output, the snapshot diff has to be additive only:git diff --unified=0 tests/snapshots | grep '^-[^-]'Empty output means the diff removed nothing.
rss.xml stays out of snapshots on purpose. Its updated field is the clock,
so a byte-exact comparison would fail on the next Tuesday.
Documentation
docs/ is an mdBook, and book/ is its build output. Three tools hold the
line, and just docs-lint runs all of them:
- mdBook builds the site that
.woodpecker/docs.ymlpublishes to Codeberg Pages. Broken internal links show up there. - Vale checks prose against the Google rules vendored in
.vale/Googleplus the project rules in.vale/styles/listsome.MinAlertLevel = suggestion, so every alert it prints is a failure. - rumdl checks Markdown structure with an 80-column prose limit. Tables and code blocks are exempt, and paragraphs aren’t.
Prose rules worth knowing before you write: no em dashes, no parentheses in prose or tables, active voice with a named actor, contractions, and no first-person plural. Vale wants most acronyms spelled out, and a spelling out needs parentheses, so this documentation avoids the acronyms instead.
Continuous integration
Woodpecker runs four pipelines from .woodpecker/:
ci.ymlchecks formatting, lints with--all-targets, runs tests, builds docs, and does a release build on pushes and pull requests.release-pr.ymlopens a release pull request whenCargo.tomlbumps.release.ymlbuilds the binary and creates the tag and release.docs.ymlbuilds the book and publishes it to Codeberg Pages.
Everything runs on rust:1.96, the same toolchain the crate requires.
Making a change
Never commit on main. Work in a sibling worktree:
git fetch origin
git worktree add ../listsome-feature-name -b feature/name origin/main
cd ../listsome-feature-name
Commit with conventional commit messages. cog verify runs in the commit-msg
hook and rejects anything it can’t parse into the changelog:
git add .
git commit -m "feat(content): price a materials table as a bill of materials"
Before you push, rebase, then run the gates:
git fetch origin main
git rebase origin/main
just clippy && just test && just docs-lint
just build && just serve-example
origin is Codeberg. fj is the forge command-line tool, and its
subcommands are search
rather than list:
fj pr search
fj issue search --state open
fj pr create "Title" --body-file body.md
Feed long bodies from a file. fj pr create --body and fj issue edit replace
the whole body, and text inside a double-quoted shell string gets its backticks
executed.
Decisions
Anything that changes architecture earns a record in docs/adr/ before the
code lands. The records follow Michael Nygard’s format, and the newest one is
the last file in the directory. A record is a snapshot of a decision, so later
work adds a new record rather than editing an old one. When a record stops
matching the code, say so in its status section: stale prose about a live
system is worse than no prose.