diff options
| author | Paul Buetow <paul@buetow.org> | 2025-10-12 10:10:10 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-10-12 10:10:10 +0300 |
| commit | 0d00f16ccf74048f11a7db26f0f08003047d3a21 (patch) | |
| tree | a098919b87f8c0ce20d73abebbc2ae858f62e7d6 | |
| parent | dba07073652cb1bbad58d2e82329d07eefe3c12d (diff) | |
fix
| -rw-r--r-- | AGENTS.md | 43 | ||||
| -rw-r--r-- | go.mod | 2 |
2 files changed, 20 insertions, 25 deletions
@@ -1,28 +1,23 @@ # Repository Guidelines -## Code structur - -- Minimal entrace point, in ./cmd/yoga/main.go, all other code goes to the ./internal directory. +## Project Structure & Module Organization +- Entry point lives in `cmd/yoga/main.go`; keep it minimal and wire dependencies from here. +- Domain logic sits under `internal/` (for example `internal/app` for TUI flow, `internal/fsutil` for filesystem helpers, `internal/meta` for metadata caching). Add new packages under `internal/` and expose functionality via small, testable functions. +- Tests accompany the code they verify (for example `internal/fsutil/*.go` with matching `_test.go` files). Keep any binaries or assets in dedicated folders and avoid checking large media into git. + +## Build, Test, and Development Commands +- `mage build` — compile the TUI (`go build ./cmd/yoga`). +- `mage install` — install the binary into your Go bin path. +- `mage test` — run `go test ./...` quickly during development. +- `mage coverage` — enforce ≥85% coverage; run before pushing. +- Format Go files with `gofumpt ./...` or rely on your editor’s integration prior to commits. ## Coding Style & Naming Conventions - -- Avoid duplication of code when the functions are larger than 5 lines. -- If possible, construct individual methods so that they can be unit tested. But only if it doesn't add too much boilerplate to the code base. -- Aim for at least 85% unit test coverage of all source code. The command to check the coverage is "mage coverage" -- Ensure that all unit tests pass before commiting any changes. -- Always run the gofumpt code reformatter on all go files modified. -- There should be no source code file larger than 1000 lines. If so, split it up into multiple. -- There should be no function larger then 50 lines. If so, refactor or split up into multiple smaller functions. -- Code (when added): follow language idioms -- Any type with more than 3 methods should be in it's own source code file, whereas the filename contains the name of the type. - -## Incrementing version - -- Never draft a changelog entry -- Whenever incrementing the version, update the version number in the project, commit to git, tag the version and push to git. -- When a major feature was introduced, increment ?.X.? -- When only minor changes were done or only bugs were fixed, increment the version as ?.?.X - -## Documentation - -- Document in the README all options and basic behaviour and also how to use the Magefile. +- Follow Go idioms: exported names are PascalCase, unexported names camelCase; keep functions <50 lines and split shared logic once it exceeds 5 lines. +- Group types so that any type with >3 methods goes into its own file named after the type. +- Run `gofumpt` on every modified Go file; no files should exceed 1000 lines. Prefer short, single-purpose packages rather than sprawling utilities. + +## Testing Guidelines +- Use Go’s standard `testing` package; name files `*_test.go` and test functions `TestThingDoesWhat`. Table-driven tests help keep coverage high without duplication. +- Mock external effects (filesystem, VLC launching) via interfaces in `internal` so behaviour remains deterministic. +- Always run `mage test` and `mage coverage` locally; investigate any coverage dips before merging. @@ -1,4 +1,4 @@ -module yoga +module codeberg/snonux/yoga go 1.24.7 |
