cmd/: Go entrypoints. Primary binary iscmd/amdgputop-web.internal/: Backend implementation (HTTP/WebSocket server, sampler, proc scanner).internal/**/testdata/: Fixture data for unit/integration tests.web/: Preact + Vite frontend (src/,public/,vite.config.ts).docs/: Operational docs (Docker, accessibility, screenshots).- Build artifacts: frontend bundle is generated into
internal/httpserver/assets/and embedded at build time (not committed).
make: Runsgofmt,go vet,go test, frontend build, and backend build.make build: Builds the backend binaryamdgputop-web.make test: Runs Go tests (go test ./...).make race: Runs race detector (go test -race ./...).make frontend-build: Builds the frontend (npm --prefix web run build). Needs to be rebuilt before building Go app if front-end changed were made.cd web && npm run dev: Local frontend dev server (Vite).
- Go code must be
gofmt-formatted; CI enforces this. - Linting:
go vet ./...(CI/make lint). - Use standard Go naming conventions (exported
CamelCase, unexportedcamelCase). - Frontend code is TypeScript/Preact; follow existing
web/srcpatterns and keep component/file names aligned with their exported symbols.
- Tests use Go’s
testingpackage; files follow*_test.gonaming. - Fixtures live under
internal/**/testdata/. - Run all tests with
go test ./...(ormake test). - Frontend has no dedicated test runner; rely on
npm --prefix web run buildplus backend tests.
- Commit messages follow Conventional Commits:
type(scope): summary.- Examples:
fix(web): correct chart timestamps,build(deps): bump preact.
- Examples:
- PRs should include:
- A short description of behavior changes.
- Test evidence (commands run and results).
- Screenshots for UI-visible changes (
docs/screenshot.webpif updated).
- Runtime configuration is via
APP_*environment variables (seeREADME.mdandinternal/config/config.go). - For containerized runs, permissions and GPU access details are in
docs/DOCKER.md.