The guides still promised nine tests, C++20 and providers under plugins/, which no longer reflects the build.
6.4 KiB
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; for the
internal architecture, the doc/ folder.
Licence: read before proposing
PacManager is proprietary, source-available, personal use only
(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):
sudo pacman -S qt6-base cmake gcc base-devel
Build:
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):
cmake --install build --prefix ~/.local
Running the tests
Every test target is a standalone binary using assert — no framework, no
download. Once built:
cd build && ctest --output-on-failure
There are 12 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-package-test |
the .fwspacm package format and its installation |
app-settings-test |
the preferences model and the journal |
language-manager-test |
the language: resolution, catalogues, coverage |
cli-command-test |
the command-line grammar |
update-manager-test |
version detection and self-update |
doc/tests.md details each target and explains how to add one.
Code conventions
- Language: C++17, Qt6. Follow the existing stack and conventions before adding any dependency.
- Formatting:
.clang-format(LLVM, 4 spaces, attached braces, 100 columns). Runclang-format -i <file>before committing. - Files:
kebab-case(e.g.browse-page.cpp). - Identifiers: English,
camelCasefor functions and variables,PascalCasefor 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(core/app-core.h,core/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 letsapp-core-testrun it without a screen. - The interface lives in
pages/, one file per screen.MainWindow(app/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/base/page.h) and an entry in the
sidebar. Adding a package manager = a plugin implementing IPackageManager in
providers/ — without touching the application (see
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
cmake --build buildwith no error;ctest --output-on-failure: all green;- the app starts (
./build/PacManager) with no console warning; - 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/ 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, which
restates these rules in a form suited to them and adds the constraints specific
to them (in particular: no tool mention in commits).