Artifact e6cd49103208f102338bbf3988ba3fcf44165a136a37b2512e4d397031300905:
- File
README.md
— part of check-in
[e2a2f28861]
at
2026-04-26 07:52:11
on branch trunk
— docs site + landing + Cloudflare auto-deploy (#6)
* design: docs site + landing page + Cloudflare auto-deploy
Mirror dagnats's docs/landing infrastructure for libfossil: a single-page landing at site/index.html (forked CSS/HTML, content rewritten), a Hugo + Hextra docs site at docs/site/, gomarkdoc-generated SDK reference under docs/site/content/docs/reference/sdk/, llms.txt artifacts, and a wrangler.jsonc that lets Cloudflare's git integration auto-deploy on push to main. Existing docs/*.md files move under docs/site/content/docs/.
* design: correct landing-page path to Hugo layout override
dagnats's working landing page lives at docs/site/layouts/index.html (a Hugo home-page layout override), not at site/index.html. The top-level site/index.html in dagnats is an older draft that the build pipeline ignores. Match the working setup.
* design: align visual system + section list with live dagnats landing
The earlier description came from dagnats's stale top-level site/index.html (JetBrains Mono + Instrument Serif italic + ember/teal accents, 8 sections). The live Hugo layout that actually serves at / uses Geist Mono only, prefers-color-scheme dual-mode (warm cream / warm dark), a single ember accent, and 7 sections (Install, What it is, Why you might want it, How it fits together, Compared to neighbors, What it is not, Get going). Update the spec to match what we are actually mirroring.
* design: drop SDK regen from CF build to match dagnats exactly
Earlier draft had CF install Go + gomarkdoc and re-run docs-gen-sdk on every deploy. dagnats does not do that; it relies on the pre-commit hook to keep committed SDK pages in sync, and ships only Hugo + llms-gen + hugo --minify in the CF build. Match that: smaller, faster CF build, no Go-runtime assumption about Workers Builds, and a true 1:1 mirror.
* plan: docs site + landing + CF auto-deploy implementation steps
11 tasks covering Hugo+Hextra bootstrap, content moves, gomarkdoc SDK generation with pre-commit drift check, llms.txt artifacts, Makefile targets, landing page fork from dagnats's live Hugo home layout, wrangler.jsonc for CF Workers Static Assets, README update, and PR creation.
* docs(site): bootstrap Hugo + Hextra skeleton
* docs(site): move existing docs into Hugo content tree
* docs(site): fix links + H1s broken by docs-tree move
- Drop .md extensions on Hugo cross-doc links - Switch source-code references to absolute github.com/danmestas/libfossil URLs (relative ../ paths broke when files moved 3 dirs deeper) - Align H1 of architecture.md and migration-from-fossil.md with their frontmatter titles
* docs(site): add quickstart, examples, and SDK section stubs
* docs(site): tighten quickstart snippets + reference index
- Make the Sync example self-contained (open + sync, full main, real signatures) - Bridge from Clone to Open with a one-line prose link - Add a sentence to reference/_index.md so it does not render blank - Use the project's canonical "pure-Go, CGo-free" phrasing
* docs(site): add docs-gen-sdk Makefile target + commit generated SDK pages
* docs(site): pin gomarkdoc version + replace empty driver stubs with prose
- Add GOMARKDOC_VERSION Makefile variable so contributors don't drift on output format when a new gomarkdoc ships - Drop the two driver packages (modernc, ncruces) from gomarkdoc and hand-write _index.md pages explaining the register-on-import contract; the stubs were byte-stable but rendered as visibly broken documentation
* docs(site): add gen-llms-txt.sh + docs-gen-llms target
* docs(site): switch llms-full frontmatter strip from sed to awk
The sed range-negation pattern '/^---$/,/^---$/!p' silently re-opens a suppression range on any bare '---' in body content, eating Markdown horizontal rules and embedded YAML in fenced code blocks. The awk pattern strips the frontmatter only when it begins on line 1, leaving body content intact regardless of how many '---' lines it contains.
* hooks: pre-commit fails when SDK pages drift from code
* hooks: pre-commit re-installs gomarkdoc if it's the wrong version
The drift check's existing gate just looks for gomarkdoc on PATH. A contributor with an older gomarkdoc installed locally would have the gate pass and then run regeneration with their stale binary, producing either a silent false-negative or a confusing OUT-OF-DATE error with no version hint. Compare the installed version against GOMARKDOC_VERSION from Makefile and re-install on mismatch. Best-effort; offline contributors can still commit.
* docs(site): add docs-serve, docs-build, docs aggregate targets
* docs(site): make docs aggregate parallel-safe via explicit deps
The docs aggregate previously listed gen-sdk, gen-llms, and build as side-by-side prereqs. Make doesn't guarantee left-to-right ordering under -j, and gen-llms reads what gen-sdk writes, while build reads both. Encode the chain explicitly so 'make -j docs' is correct. Side benefit: 'make docs-build' standalone now produces a complete deployable site, matching contributor expectation.
* site(landing): fork dagnats home layout; rebrand chrome
* site(landing): rewrite §01–§07 content for libfossil
* site(landing): use .ascii class for diagram + fix §03 phrasing
* deploy: add wrangler.jsonc for CF Workers Static Assets
* docs: point README at the new docs site (user: [email protected], size: 7671) [annotate] [blame] [check-ins using]
libfossil
Pure-Go library and CLI for Fossil repositories. Drop-in compatible with Fossil's .fossil SQLite format, with no CGo and no upstream fossil binary required.
Why libfossil
- Pure Go, no CGo. Static binaries, trivial cross-compilation, works under
GOOS=wasip1 GOARCH=wasm. - Drop-in compatible. Repositories produced by upstream Fossil are readable, and vice versa — it's the same SQLite schema.
- Embeddable. Use the full
RepoAPI directly in your Go service. No subprocess calls, no temp files. - Instrumented. Sync and checkout observer interfaces make OpenTelemetry (or your own metrics) a few lines of code.
- Deterministically testable. Deterministic simulation testing (DST) with BUGGIFY fault injection.
Installation
CLI
go install github.com/danmestas/libfossil/cmd/libfossil@latest
The binary is named libfossil to avoid $PATH collisions with upstream fossil.
Library
go get github.com/danmestas/libfossil
CLI quick start
libfossil repo new my.fossil
libfossil -R my.fossil repo ci -m "first commit" hello.txt
libfossil -R my.fossil repo timeline
libfossil -R my.fossil repo ls
libfossil -R my.fossil repo annotate hello.txt
libfossil -R my.fossil repo verify
Full command list: libfossil --help. See docs/migration-from-fossil.md for a command-by-command comparison with upstream Fossil.
Library quick start
package main
import (
"log"
libfossil "github.com/danmestas/libfossil"
_ "github.com/danmestas/libfossil/db/driver/modernc"
)
func main() {
r, err := libfossil.Create("my.fossil", libfossil.CreateOpts{User: "admin"})
if err != nil {
log.Fatal(err)
}
defer r.Close()
rid, uuid, err := r.Commit(libfossil.CommitOpts{
Files: []libfossil.FileToCommit{{Name: "hello.txt", Content: []byte("hello")}},
Comment: "initial commit",
User: "admin",
})
if err != nil {
log.Fatal(err)
}
log.Printf("committed rid=%d uuid=%s", rid, uuid[:12])
entries, err := r.Timeline(libfossil.LogOpts{Limit: 10})
if err != nil {
log.Fatal(err)
}
for _, e := range entries {
log.Printf(" %s %s", e.UUID[:12], e.Comment)
}
}
Working example: examples/embed-repo-api/.
Sync
// Sync with a remote Fossil server.
result, err := r.Sync(ctx,
libfossil.NewHTTPTransport("http://host/repo"),
libfossil.SyncOpts{Push: true, Pull: true},
)
// Serve the sync protocol (e.g. for leaf agents, bridges, mirrors).
http.Handle("/", r.XferHandler())
The Transport interface is pluggable — swap HTTP for NATS, WebSocket, libp2p, or anything that delivers bytes round-trip.
Embedding the CLI
cli/ exposes Kong command structs you can mount inside your own CLI:
import (
"github.com/alecthomas/kong"
"github.com/danmestas/libfossil/cli"
_ "github.com/danmestas/libfossil/db/driver/modernc"
)
type MyCLI struct {
cli.Globals
Repo cli.RepoCmd `cmd:"" help:"Fossil repo operations"`
// Add your own commands here.
}
func main() {
var c MyCLI
ctx := kong.Parse(&c)
ctx.FatalIfErrorf(ctx.Run(&c.Globals))
}
Project layout
| Package | Purpose |
|---|---|
root (libfossil) |
Repo handle, Transport, SyncObserver, CheckoutObserver |
cli/ |
Embeddable Kong command structs for the repo subcommands |
cmd/libfossil/ |
Standalone CLI binary |
db/ |
SQLite abstraction with pluggable drivers |
db/driver/modernc |
Pure-Go SQLite driver (default) |
db/driver/ncruces |
wasm-capable SQLite driver |
observer/otel/ |
Optional OpenTelemetry observer (separate submodule) |
dst/ |
Deterministic simulation tests + BUGGIFY harness |
simio/ |
Clock, Rand, Storage interfaces for deterministic testing |
testutil/ |
Shared test helpers |
Deep dive: docs/architecture.md.
SQLite drivers
| Driver | Import | When to use |
|---|---|---|
modernc (default) |
_ "github.com/danmestas/libfossil/db/driver/modernc" |
Default for any server, CLI, or desktop use |
ncruces |
_ "github.com/danmestas/libfossil/db/driver/ncruces" |
wasm targets (GOOS=wasip1 or browser/OPFS) |
Driver selection happens via blank import at link time. See docs/extension-points.md for the registration contract.
Observers
// Built-in, zero dependencies.
libfossil.NopSyncObserver() // silent
libfossil.StdoutSyncObserver() // human-readable stderr
// Optional OpenTelemetry (separate submodule — no OTel deps in core).
import "github.com/danmestas/libfossil/observer/otel"
obs := otel.NewSyncObserver()
Both SyncObserver and CheckoutObserver are small interfaces you can implement directly. Details: docs/extension-points.md.
WASI / wasm
libfossil compiles to a generic WASI Preview 1 module via the ncruces driver:
GOOS=wasip1 GOARCH=wasm go build -o libfossil.wasm ./examples/wasm/
See examples/wasm/ for a runnable demo and current runtime caveats (the non-js ncruces driver variant has a known locking-mode quirk under wasmtime).
Testing
make test— unit tests with the defaultmoderncdrivermake test-drivers— unit tests against bothmoderncandncrucesmake test-otel— OTel submodule tests (runs withGOWORK=off)make test-all— everything, including the binary buildmake setup-hooks— install the pre-commit hook (~45s/commit)
Test strategy — unit tests, dual-driver matrix, and deterministic simulation (DST) with BUGGIFY fault injection: docs/testing.md.
Documentation
Full documentation: https://libfossil-docs.<your-cf-subdomain>.workers.dev (set the actual URL after the CF dashboard is connected).
Local preview: make docs-serve, then visit http://localhost:1313/.
Markdown sources: docs/site/content/.
| Doc | Audience |
|---|---|
| docs/architecture.md | Contributors learning the codebase |
| docs/testing.md | Contributors writing or debugging tests |
| docs/extension-points.md | Consumers adding observers or custom drivers |
| docs/migration-from-fossil.md | Users coming from upstream fossil |
| CONTRIBUTING.md | Anyone submitting a PR |
| CHANGELOG.md | Release notes |
Contributing
See CONTRIBUTING.md.
License
MIT — see LICENSE.