Skip to content

Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.

docs: update CONTRIBUTING.md with real project checks, paths, and setup icons

IGECT6e3f9d6e58eb
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 9bc5d288..528bdff6 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -6,19 +6,30 @@
## Before writing code
-Read [GLOSSARY.md](GLOSSARY.md), [DESIGN.md](DESIGN.md), and [docs/adr/](docs/adr) for project naming and UI tokens. Comment on an issue before working on it to avoid duplicate PRs, and open a [discussion](https://github.com/OpenSelena/libreget/discussions) before starting large features or plugin changes.
+Read [GLOSSARY.md](GLOSSARY.md), [DESIGN.md](DESIGN.md), and [docs/adr/](docs/adr) for canonical naming, UI tokens, and existing architecture decisions. Comment on an open issue before starting work so two people do not solve the same thing, and open a [discussion](https://github.com/OpenSelena/libreget/discussions) before implementing large features or new plugins.
-UI translations are handled on [Weblate](https://hosted.weblate.org/engage/libreget/) in the browser without a local build.
+LibreGet does not accept changes that bypass DRM, break paywalls, or expose user credentials. UI translations are managed on [Weblate](https://hosted.weblate.org/engage/libreget/)—do not submit machine-translated locale files in feature PRs.
## Setup
-| Tool | Requirement | Notes |
+<p>
+ <a href="https://rustup.rs/"><img src="https://cdn.simpleicons.org/rust/CE422B" width="32" height="32" alt="Rust" title="Rust 1.97.0" /></a>
+ &nbsp;&nbsp;&nbsp;
+ <a href="https://nodejs.org/"><img src="https://cdn.simpleicons.org/nodedotjs/5FA04E" width="32" height="32" alt="Node.js" title="Node.js LTS (18+)" /></a>
+ &nbsp;&nbsp;&nbsp;
+ <a href="https://pnpm.io/"><img src="https://cdn.simpleicons.org/pnpm/F69220" width="32" height="32" alt="pnpm" title="pnpm 10.29.3" /></a>
+ &nbsp;&nbsp;&nbsp;
+ <a href="https://www.npmjs.com/"><img src="https://cdn.simpleicons.org/npm/CB3837" width="32" height="32" alt="npm" title="npm (bundled with Node.js)" /></a>
+</p>
+
+| Tool | Version | Notes |
|---|---|---|
-| [Rust](https://rustup.rs/) | `1.97.0` | Pinned in [rust-toolchain.toml](rust-toolchain.toml) (`rustfmt`, `clippy`) because plugin ABIs must match the host |
-| [Node.js](https://nodejs.org/) | `18+` | LTS recommended |
-| [pnpm](https://pnpm.io/) | `10.29.3` | Set via `packageManager` in [package.json](package.json) (`corepack enable` picks it up) |
+| [Rust](https://rustup.rs/) | `1.97.0` | Pinned in [rust-toolchain.toml](rust-toolchain.toml) (`rustfmt` + `clippy`) so host and plugin ABIs match |
+| [Node.js](https://nodejs.org/) | `18+` (LTS) | CI runs `lts/*` in [.github/workflows/ci.yml](.github/workflows/ci.yml) |
+| [pnpm](https://pnpm.io/) | `10.29.3` | Set via `packageManager` in [package.json](package.json); use `corepack enable` |
+| [npm](https://www.npmjs.com/) | Bundled with Node | Fallback to install `[email protected]` globally (`npm i -g [email protected]`); do not use `npm install` in the repo (`pnpm-lock.yaml` is authoritative) |
-On Linux, install the Tauri/WebKit system packages first (matching [README.md](README.md#build-from-source) and [.github/workflows/ci.yml](.github/workflows/ci.yml)):
+On Linux, install the WebKit/Tauri system libraries first (same packages CI installs in `debian:bookworm` and `ubuntu-latest`):
```bash
sudo apt-get update && sudo apt-get install -y \
@@ -27,7 +38,7 @@ sudo apt-get update && sudo apt-get install -y \
libpipewire-0.3-dev clang libclang-dev
```
-Clone and start the app:
+Clone, install dependencies, and run:
```bash
git clone https://github.com/OpenSelena/libreget.git
@@ -36,38 +47,85 @@ pnpm install
pnpm tauri dev
```
-Use `pnpm tauri dev` for full app work or `pnpm dev` when you only need the Vite frontend. Running `pnpm prepare` points `core.hooksPath` at [.githooks/](.githooks), which formats staged Rust files on commit and checks `cargo fmt` before push.
+- `pnpm tauri dev` runs the Vite dev server on `http://localhost:1420` alongside the Tauri Rust backend (`src-tauri/tauri.conf.json`).
+- `pnpm dev` runs only the SvelteKit/Vite frontend when iterating on UI or Vitest-covered modules without compiling Rust.
+- `pnpm tauri build --config '{"bundle":{"createUpdaterArtifacts":false}}'` builds a release binary locally without requiring the maintainer's `TAURI_SIGNING_PRIVATE_KEY`.
+- `pnpm prepare` configures `core.hooksPath` to [.githooks/](.githooks) (`pre-commit` auto-formats staged `.rs` files; `pre-push` checks `cargo fmt`). On Linux/macOS, ensure both hook files are executable (`chmod +x .githooks/pre-commit .githooks/pre-push`) or run `pnpm fmt:rs` manually before committing.
-## Where things live
+## Codebase layout
-- `src/` holds the Svelte 5 / SvelteKit frontend (`src/routes/`, `src/components/`, `src/lib/`).
-- `src-tauri/src/` contains Tauri host commands, the local bridge (`127.0.0.1:47720–47729`), the MCP server, plugin loading, tray, and platform code.
-- `src-tauri/libreget-core/` has shared models, path helpers, platform extractors, and download logic.
-- `src-tauri/libreget-cli/` is the standalone `libreget-cli` binary.
-- `src-tauri/libreget-plugin-sdk/` and `src-tauri/plugins/` hold the plugin SDK and embedded core plugins (`convert`, `telegram`, `courses`, `grammers-session`).
-- `browser-extension/` contains the Chrome (`chrome/`) and Firefox (`firefox/`) extensions.
-- `scripts/` contains build, version-bump, i18n, UI lint, contrast audit, accessibility audit, and smoke-test scripts.
+- `src/routes/`, `src/components/`, `src/lib/` — Svelte 5 / SvelteKit UI (`src/app.css` and `src/lib/style/` hold design tokens and stylesheets).
+- `src-tauri/src/` — Tauri v2 host, `commands/`, local bridge on `127.0.0.1:47720–47729` (`local_bridge.rs`), MCP server (`mcp.rs`), plugin host/loader, and tray. New Tauri commands must be registered in `.invoke_handler(tauri::generate_handler![...])` in [src-tauri/src/lib.rs](src-tauri/src/lib.rs) and permitted in [src-tauri/capabilities/default.json](src-tauri/capabilities/default.json).
+- `src-tauri/libreget-core/` — Core models, config/path helpers, and native platform extractors in `src-tauri/libreget-core/src/platforms/`.
+- `src-tauri/libreget-cli/` — Standalone `libreget-cli` binary.
+- `src-tauri/libreget-plugin-sdk/` & `src-tauri/plugins/` — Plugin SDK trait and embedded plugins (`convert`, `telegram`, `courses`, `grammers-session`).
+- `browser-extension/` — Chrome (`chrome/`) and Firefox (`firefox/`) extensions. Edit shared scripts/styles/pages/`_locales`/`icons` in `chrome/` and sync to `firefox/` with `pnpm extension:sync` (`manifest.json` stays per-browser).
+- `scripts/` — Automation for UI lint (`lint-ui.mjs`), Clippy baseline (`clippy-baseline.mjs`), i18n keys (`generate-i18n-keys.js`), smoke test (`smoke-test.mjs`), contrast/a11y audits (`contrast-audit.mjs`, `a11y-audit.mjs`), and version bumps (`bump-version.js`).
-## Branches
+## Branch workflow
-Open pull requests against **`dev`**, not `main`. Pushes and PRs on `dev` run GitHub Actions CI on Linux (Ubuntu and Debian Bookworm), Windows, and macOS. Maintainers merge `dev` into `main` once CI is green.
+Target **`dev`** for all pull requests. Pushes and PRs against `dev` run GitHub Actions CI across Ubuntu, Debian Bookworm, Windows, and macOS. Maintainers merge `dev` into `main` only after CI passes.
-## Checks
+## Local checks
-Run the checks for the parts you touched before pushing; CI runs the same gates:
+Run the checks for the areas you changed before pushing:
-- Frontend: `pnpm check` (`svelte-kit sync` + `svelte-check`), `pnpm test` (Vitest), `pnpm check:i18n`, and `pnpm lint:ui <target>` whenever you edit Svelte routes (`src/routes/`), UI components (`src/components/`), or CSS (`src/app.css`, `src/lib/style/`).
-- Rust: `pnpm fmt:rs` / `pnpm check:fmt`, `cargo clippy --workspace --all-targets` and `cargo test --workspace` inside `src-tauri/`, and `pnpm check:clippy-baseline` from the root. Fix any Clippy warning you introduce—never run `pnpm update:clippy-baseline` to hide your own warnings.
-- Browser extension: edit files under `browser-extension/chrome/`, then run `pnpm extension:sync` to sync shared files, `_locales`, and `icons` into `browser-extension/firefox/` (`manifest.json` stays per-browser).
+### Frontend and i18n
-## Rules that save review rounds
+```bash
+pnpm check # svelte-kit sync + svelte-check
+pnpm test # Vitest suite
+pnpm check:i18n # checks all 11 other locales stay in sync with src/lib/i18n/en.json
+```
+
+- When adding or renaming translation keys in `src/lib/i18n/en.json`, run `pnpm generate:i18n-keys` and commit the updated `src/lib/i18n/keys.ts` (CI fails `git diff --exit-code -- src/lib/i18n/keys.ts` if stale).
+- Whenever you modify Svelte routes (`src/routes/`), components (`src/components/`), or CSS (`src/app.css`, `src/lib/style/`), run targeted UI lint ([.agents/skills/ui-lint/SKILL.md](.agents/skills/ui-lint/SKILL.md)):
+
+```bash
+pnpm lint:ui /settings # single route (light + dark)
+pnpm lint:ui --shell # layout, shell components, shared button/primitive styles
+pnpm lint:ui /settings --all-themes # all 14 themes in src/app.css
+```
+
+### Rust
+
+```bash
+pnpm check:fmt # or pnpm fmt:rs to format
+pnpm check:clippy-baseline # checks against src-tauri/clippy-baseline.<platform>.json
+```
-Add new interface strings in `src/lib/i18n/en.json` only, then run `pnpm generate:i18n-keys` and commit the updated `src/lib/i18n/keys.ts`. Translations for the other 11 locales (`ru`, `el`, `pt`, `zh`, `zh-TW`, `ja`, `it`, `fr`, `es`, `fa`, `lo`) come from [Weblate](https://hosted.weblate.org/engage/libreget/), so don't commit machine translations in feature PRs.
+Inside `src-tauri/`:
-When you change documented user-facing behavior in [README.md](README.md), update [README.ja.md](README.ja.md), [README_pt_br.md](README_pt_br.md), [README.ru.md](README.ru.md), and [README_zh_CN.md](README_zh_CN.md) to match (or flag what needs translating). Keep scratch notes, temp scripts, and personal files out of git.
+```bash
+cargo clippy --workspace --all-targets
+cargo test --workspace
+```
+
+- On Windows, standalone test binaries linking Tauri/WebView without an embedded manifest hit `0xc0000139`, so run `cargo test --workspace --exclude libreget-plugin-courses` (matches CI).
+- Fix any new Clippy warning you introduce; do not run `pnpm update:clippy-baseline` to silence new warnings.
+
+### Smoke test and Flatpak metainfo
+
+```bash
+node scripts/smoke-test.mjs src-tauri/target/debug/libreget --portable
+appstreamcli validate flatpak/com.openselena.libreget.metainfo.xml
+```
+
+## Runtime environment variables
+
+| Variable | Effect |
+|---|---|
+| `LIBREGET_DATA_DIR` | Override the profile/data directory (used for test/dev isolation and `--portable` smoke runs) |
+| `LIBREGET_PORTABLE=1` | Enable portable mode alongside `LIBREGET_DATA_DIR` (enabled automatically if `portable.txt` sits beside the executable) |
+| `LIBREGET_RELAY` | Override the P2P transfer relay server address |
+| `LIBREGET_I18N_STRICT=0` | Disable strict locale validation during UI/a11y dev scripts |
+| `LIBREGET_SMOKE_EXIT_MS` | Auto-exit timeout in milliseconds for `scripts/smoke-test.mjs` |
+| `LIBREGET_SKIP_PLUGIN_DEPLOY=1` | Skip local plugin copy in `scripts/deploy-plugins-local.mjs` |
## Pull requests and AI tools
-Write commit messages and PR descriptions in English ([Conventional Commits](https://www.conventionalcommits.org/) like `feat(scope): ...`, `fix: ...`, `docs: ...` is preferred), keep each PR focused on one change, and fill out the PR template with what changed for users and how you tested it. Maintainers review and merge pull requests, and everyone taking part follows the [Code of Conduct](CODE_OF_CONDUCT.md).
+Write commit messages and PR titles in English ([Conventional Commits](https://www.conventionalcommits.org/) like `feat(scope): ...`, `fix: ...`, `docs: ...` preferred). Keep each PR focused on one change, update translated READMEs (`README.ja.md`, `README_pt_br.md`, `README.ru.md`, `README_zh_CN.md`) when changing user-facing features in [README.md](README.md), and fill out [.github/pull_request_template.md](.github/pull_request_template.md).
+
+AI coding tools are allowed if you read every line you submit, run the checks above and verify the behavior in the running app yourself, tick the AI disclosure box in the PR template, and keep diffs small. Bug and security reports must describe reproducible behavior you observed directly.
-You can use AI tools when writing code or tests, as long as you read every line you send, ran the checks and tested the change in the running app yourself, tick the AI disclosure box in the PR template, and keep the diff small. Bug reports and security reports must also come from behavior you actually reproduced, not raw guesses from reading code.
+Everyone participating in issues, pull requests, translations, and chat follows [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md).