Files
fenrir/AGENTS.md
T

4.2 KiB

Repository Guidelines

CRITICAL: Init-System Independence

Fenrir must never depend on a specific Linux init system or service manager. This applies to the reader, helper processes, process supervision, installation, packaging, and required tests. Do not require systemd, systemd-run, systemctl, or a systemd user manager. Use init-independent Linux interfaces and detect the capabilities actually available. Fenrir must work on non-systemd distributions, including Artix.

Project Structure & Module Organization

Fenrir is a Linux console screen reader with an X11 terminal mode. This checkout is on the Go migration's testing branch; confirm the intended branch before contributing. cmd/fenrir/ contains the executable entry point. internal/ contains packages for input, screen review, speech, sound, configuration, and remote control. Go tests live beside their packages as *_test.go.

config/ holds TOML settings, keyboard layouts, punctuation profiles, and sound assets. internal/i18n/locale/ holds translations. docs/ contains manuals; tools/ contains maintenance utilities. src/fenrirscreenreader/ retains Python sources, while tests/ includes Python unit, integration, and native fixtures.

Reader-independent Go code shared with Cthulhu lives in git.stormux.org/storm/screenreader-common; check it before duplicating pure data or behavior. The emoji catalog is shared there. Keep Fenrir's picker form, console/X11 input, clipboard action, and translations here. For shared changes, test the common package, tag a version, and update the pinned module in go.mod; keep local go.work or replace paths out of commits. New shared labels also require go run ./tools/translations update and check.

Build, Test, and Development Commands

Use Linux, Go 1.27.2 or newer, a C compiler, and pkg-config, with development libraries for libevdev, X11, libvterm, and ALSA. See README.md for runtime dependencies.

  • go build -o fenrir ./cmd/fenrir: build the executable beside its resources.
  • ./fenrir --config config/settings/settings.toml --check-config: validate settings without opening devices.
  • ./fenrir -x: run in an X11 terminal with DISPLAY and WINDOWID available.
  • go test ./...: run the Go test suite.
  • go test ./internal/reader: run a focused package's tests.
  • go vet ./...: check common Go errors.
  • golangci-lint run ./...: run the lint gate in .golangci.yml (the same policy as Cthulhu and common). Build the linter with a Go at least as new as the project's, or it reports typecheck errors.
  • go run ./tools/translations check: validate extracted messages and catalogs; requires GNU gettext.

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. Initialisms keep one case (ID, URL). Handle errors or discard them explicitly with _ = and a short reason. Preserve existing license headers. Keep changes focused and use existing configuration and presentation APIs.

Keep interface messages translatable through internal/i18n; exclude screen contents and protocol identifiers. After message changes, run go run ./tools/translations update, review catalog changes, then run check. Run shellcheck on edited shell scripts.

Testing Guidelines

Use Go's testing package with Test... functions in *_test.go. Cover changed behavior and plausible regressions; no numeric coverage threshold is documented. Follow each native fixture's prerequisites. Automated checks do not establish audible speech or physical keyboard behavior: verify affected console or X11 workflows, including navigation and settings persistence. Preserve the active reader.

Commit & Pull Request Guidelines

History uses short descriptive subjects, without a consistent prefix convention. Keep commits scoped. Describe the problem, resulting behavior, linked issues when applicable, commands run, and pending live checks. Follow the README's AI-assisted contribution policy: contributors must review the diff and test intended behavior and likely regressions before submission. Leave submission to the contributor after review.