3.5 KiB
Repository Guidelines
Project Structure
Screenreader Common holds reader-independent Go packages shared by the Fenrir
console screen reader and the Cthulhu desktop screen reader. Each top-level
directory is one package: datetime, emoji, hardware, internalui,
phonetic, quicksettings, speechdispatcher, tones and voiceprofiles,
plus hardware/transport for synthesizer device I/O and i18n with
i18n/catalogtool for the readers' translation catalogs (see
TRANSLATIONS.md). internal/ holds
helpers that are not part of the public API. Tests sit beside the code as *_test.go.
Common owns data and behavior. Each reader keeps its own input, presentation, localization setup, device ownership and operating-system integration. Do not import anything from either reader.
New form and control work goes into internalui, so both readers can use it.
datetime and hardware/transport use cgo, and each has a non-cgo
fallback. Keep the whole module buildable with CGO_ENABLED=0.
Build, Test, and Development Commands
Use Go 1.27.2 or newer. Fenrir, Cthulhu and common share this minimum; raise it in all three together.
go build ./...: build every package.go test -race ./...: run the test suite with the race detector.go vet ./...: check common Go errors.golangci-lint run ./...: run the lint gate in.golangci.yml(the same policy as Cthulhu's). Build the linter with a Go at least as new as the project's, or it reports typecheck errors.gofmt -s -l .: list files that need formatting.
Coding Style & Naming Conventions
Follow Go conventions: gofmt -s, Effective Go, and Go Code Review Comments.
Exported names are PascalCase and unexported names are camelCase, including
functions and methods. Do not use snake_case identifiers. Package names are
short and lowercase. Initialisms keep one case (ID, URL, newHTTPClient).
Handle errors or discard them explicitly with _ = and a short reason; wrap
with %w unless a caller's classification depends on not wrapping, and say so
in a comment. Preserve license headers.
User-facing strings shared with the readers must be listed by the package's
MessageIDs() so the readers' translation tools can extract them.
Testing Guidelines
Use Go's testing package with Test... functions. Cover changed behavior and
plausible regressions in both readers. Tests here do not replace the readers'
integration tests: after changing a package, build and test Fenrir and Cthulhu
against the local sources through a Go workspace.
Release Flow
- Develop against sibling checkouts with a local
go.workin their parent directory (go work init ./screenreader-common ./cthulhu ./fenrir). Never commitgo.workorreplacepaths. - Run
go test -race ./...,go vet ./...andgolangci-lint run ./...here, and the test suites of both readers through the workspace. - After review and live acceptance in both readers, tag a new version on
master. API removals or renames need a new minor version while the module is below v1. - Update
go.modandgo.sumin both readers to the tag, and verify each withGOWORK=off go build ./...andGOWORK=off go test ./....
Commit & Pull Request Guidelines
Use short descriptive subjects. Describe the behavior change, which reader callers changed, and what was tested in each reader. AI-assisted contributions follow the Stormux policy: the contributor reviews the diff and tests the changed behavior and likely regressions before submission, and submission is left to the contributor.