The agent guide now sends contributors to CONTRIBUTING.md for the conventions, and that file did not exist, so the pointer was a dead end and the conventions lived only in the README, where they sat next to the feature list. The guide covers what a contributor needs in one place — the licence terms that constrain reuse, the build and the four CMake options, the nine test targets and what each one covers, the code conventions, and the point of the architecture split that decides where new code goes — plus the commit rules the agent guide states, including signed commits and no tool attribution. The READMEs and the doc index now link to it instead of duplicating the list.
177 lines
6.2 KiB
Markdown
177 lines
6.2 KiB
Markdown
# Contributing to PacManager
|
|
|
|
Thanks for your interest in the project. This document describes **how to
|
|
build, test and propose a change** to PacManager. For project context
|
|
(features, build, licence), see the [`README.en.md`](README.en.md); for the
|
|
internal architecture, the [`doc/`](doc/README.md) folder.
|
|
|
|
## Licence: read before proposing
|
|
|
|
PacManager is **proprietary, source-available, personal use only**
|
|
([`LICENSE`](LICENSE)). You may modify and improve the code for your own use;
|
|
**distributing, selling or reusing the code** — in whole or in part, modified or
|
|
not — is **forbidden**. A contribution sent through an issue or a pull request
|
|
amounts to accepting these terms for the change concerned.
|
|
|
|
## Building
|
|
|
|
Dependencies (Arch Linux):
|
|
|
|
```bash
|
|
sudo pacman -S qt6-base cmake gcc base-devel
|
|
```
|
|
|
|
Build:
|
|
|
|
```bash
|
|
cmake -B build
|
|
cmake --build build -j$(nproc)
|
|
```
|
|
|
|
A plain `cmake -B build` is enough: the Flatpak plugin is built by default. The
|
|
useful options:
|
|
|
|
| Option | Default | Effect |
|
|
| --- | --- | --- |
|
|
| `FWS_BUILD_FLATPAK_PLUGIN` | `ON` | build the Flatpak provider plugin |
|
|
| `FWS_BUILD_AUR_PLUGIN` | `ON` | build the AUR provider plugin |
|
|
| `FWS_BUILD_EXAMPLE_PLUGIN` | `OFF` | build the example provider plugin (template) |
|
|
| `FWS_BUILD_EXAMPLE_ADDON` | `OFF` | build the example addon plugin (template) |
|
|
|
|
Install (user installation, no sudo):
|
|
|
|
```bash
|
|
cmake --install build --prefix ~/.local
|
|
```
|
|
|
|
## Running the tests
|
|
|
|
Every test target is a standalone binary using `assert` — no framework, no
|
|
download. Once built:
|
|
|
|
```bash
|
|
cd build && ctest --output-on-failure
|
|
```
|
|
|
|
There are **9 tests**. Most are unit tests that never touch the system;
|
|
`flatpak-integration-test` is the only one that drives the real flatpak CLI (in
|
|
an isolated temporary installation), and `app-core-test` checks in particular
|
|
that every privileged path goes through the password gate — **without ever
|
|
replaying a request**, so it can never run pacman as root.
|
|
|
|
| Target | Covers |
|
|
| --- | --- |
|
|
| `pacman-manager-test` | parsing pacman output |
|
|
| `flatpak-manager-test` | flatpak parsing, install targets, commands |
|
|
| `flatpak-integration-test` | the real flatpak CLI, end to end |
|
|
| `aur-manager-test` | the AUR provider |
|
|
| `app-core-test` | the core: providers, password gate, lock, plugins |
|
|
| `progress-tracker-test` | reading a tool's output, progress, ANSI |
|
|
| `package-utils-test` | the shared package utilities |
|
|
| `plugin-shop-test` | the shop's JSON catalogue |
|
|
| `update-manager-test` | version detection and self-update |
|
|
|
|
[doc/tests.md](doc/tests.md) details each target and explains how to add one.
|
|
|
|
## Code conventions
|
|
|
|
- **Language**: C++20, Qt6. Follow the existing stack and conventions before
|
|
adding any dependency.
|
|
- **Formatting**: `.clang-format` (LLVM, 4 spaces, attached braces, 100
|
|
columns). Run `clang-format -i <file>` before committing.
|
|
- **Files**: `kebab-case` (e.g. `browse-page.cpp`).
|
|
- **Identifiers**: English, `camelCase` for functions and variables,
|
|
`PascalCase` for types.
|
|
- **Comments**: in **English**, "why" style. Do not comment what the code
|
|
already says; document the implementation choice, the trade-off, the edge
|
|
case.
|
|
|
|
## Architecture: where code goes
|
|
|
|
The split is structural and not negotiable:
|
|
|
|
- **All logic lives in `AppCore`** (`include/app-core.h`, `src/app-core.cpp`):
|
|
providers, worker threads, history, sudo, the pacman lock, self-update. This
|
|
layer depends on Qt Core only and **holds no widget** — which is what lets
|
|
`app-core-test` run it without a screen.
|
|
- **The interface lives in `pages/`**, one file per screen. `MainWindow`
|
|
(`src/main-window.cpp`) is only a frame: sidebar, status bar, dialogs. No
|
|
business rule.
|
|
- **The conversation always goes the same way**: the view calls a core method,
|
|
which answers "started", "I need the sudo password" or "the database is
|
|
locked"; the view then asks the user for what is needed and replays the
|
|
request. Results come back through signals.
|
|
|
|
Adding a screen = a `Page` class (see `pages/page.h`) and an entry in the
|
|
sidebar. Adding a package manager = a plugin implementing `IPackageManager` in
|
|
`plugins/` — **without touching the application** (see
|
|
[doc/plugins.md](doc/plugins.md)).
|
|
|
|
## Workflow
|
|
|
|
### Branches
|
|
|
|
`type/description`: `feat/flatpak-files`, `fix/lock-message`, `docs/tests`…
|
|
|
|
### Commits
|
|
|
|
**Conventional Commits** format:
|
|
|
|
```
|
|
<type>(<scope>): <description>
|
|
```
|
|
|
|
- Message in **English**;
|
|
- types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`,
|
|
`ci`, `chore`, `revert`;
|
|
- short imperative title; the body explains only the **why**, not the how;
|
|
- **signed commits**;
|
|
- the message never mentions **the tool or the assistant** that produced the
|
|
change, and no automatic co-author is added.
|
|
|
|
Example:
|
|
|
|
```
|
|
fix(credentials): ask for the password before a bulk removal
|
|
|
|
The cleanup page grouped its packages by provider but never handed those
|
|
providers to the credential gate, which saw an empty list, concluded
|
|
nothing was privileged and let the request through: pacman was then
|
|
driven with an empty password.
|
|
|
|
Every privileged path now goes through the same door, which the new test
|
|
walks one by one.
|
|
```
|
|
|
|
### Before calling it done
|
|
|
|
1. `cmake --build build` with no error;
|
|
2. `ctest --output-on-failure`: **all green**;
|
|
3. the app starts (`./build/PacManager`) with no console warning;
|
|
4. the relevant documentation is up to date (`doc/`, `README.md` /
|
|
`README.en.md`).
|
|
|
|
A user-visible behaviour change is verified by **running the behaviour**, not
|
|
just by reading the code: paths in `pages/` are not covered by `app-core-test`.
|
|
|
|
### Pull requests
|
|
|
|
- A PR fixing a bug references the issue (`Fixes #123`).
|
|
- Do not close or modify an issue without an explicit request from the
|
|
maintainer.
|
|
- Do not push, merge or publish without an explicit request: those remain the
|
|
maintainer's calls.
|
|
|
|
## Documentation
|
|
|
|
The [`doc/`](doc/README.md) folder is the source of the project wiki; each file
|
|
is a standalone page and its filename is that of the page. A change to the
|
|
architecture, to a plugin contract or to an interface behaviour comes with its
|
|
documentation update.
|
|
|
|
## AI agents
|
|
|
|
Agents working on this repository follow [`AGENTS.md`](AGENTS.md), which
|
|
restates these rules in a form suited to them and adds the constraints specific
|
|
to them (in particular: no tool mention in commits).
|