Consolidate shared UI, hardware transport, and translation tooling

This commit is contained in:
Storm Dragon committed 2026-11-16 20:07:56 -05:00
1 parent ed6951f4cd
commit 2c612de63b
61 files changed
+2417 -1573

No files matched your search

+74
View File
@@ -0,0 +1,74 @@
# 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
1. Develop against sibling checkouts with a local `go.work` in their parent
directory (`go work init ./screenreader-common ./cthulhu ./fenrir`). Never
commit `go.work` or `replace` paths.
2. Run `go test -race ./...`, `go vet ./...` and `golangci-lint run ./...`
here, and the test suites of both readers through the workspace.
3. 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.
4. Update `go.mod` and `go.sum` in **both** readers to the tag, and verify each
with `GOWORK=off go build ./...` and `GOWORK=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.