docs: add the contribution guide the agent guide points at
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.
This commit is contained in:
5 files changed
+364
-9
No files matched your search
@@ -0,0 +1,176 @@
|
||||
# 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).
|
||||
+177
@@ -0,0 +1,177 @@
|
||||
# Contribuer à PacManager
|
||||
|
||||
Merci de votre intérêt pour le projet. Ce document décrit **comment construire,
|
||||
tester et proposer une modification** de PacManager. Pour le contexte du projet
|
||||
(fonctionnalités, compilation, licence), voir le [`README.md`](README.md) ; pour
|
||||
l'architecture interne, le dossier [`doc/`](doc/README.md).
|
||||
|
||||
## Licence : lire avant de proposer
|
||||
|
||||
PacManager est **propriétaire, source disponible, usage personnel uniquement**
|
||||
([`LICENSE`](LICENSE)). Vous pouvez modifier et améliorer le code pour votre
|
||||
usage ; **distribuer, vendre ou réutiliser le code** — en tout ou en partie,
|
||||
modifié ou non — est **interdit**. Une contribution envoyée via issue ou pull
|
||||
request vaut acceptation de ces conditions pour la modification concernée.
|
||||
|
||||
## Construire le projet
|
||||
|
||||
Dépendances (Arch Linux) :
|
||||
|
||||
```bash
|
||||
sudo pacman -S qt6-base cmake gcc base-devel
|
||||
```
|
||||
|
||||
Compilation :
|
||||
|
||||
```bash
|
||||
cmake -B build
|
||||
cmake --build build -j$(nproc)
|
||||
```
|
||||
|
||||
Un `cmake -B build` suffit : le plugin Flatpak est construit par défaut. Les
|
||||
options utiles :
|
||||
|
||||
| Option | Défaut | Effet |
|
||||
| --- | --- | --- |
|
||||
| `FWS_BUILD_FLATPAK_PLUGIN` | `ON` | construire le plugin fournisseur Flatpak |
|
||||
| `FWS_BUILD_AUR_PLUGIN` | `ON` | construire le plugin fournisseur AUR |
|
||||
| `FWS_BUILD_EXAMPLE_PLUGIN` | `OFF` | construire le plugin fournisseur d'exemple (modèle) |
|
||||
| `FWS_BUILD_EXAMPLE_ADDON` | `OFF` | construire le plugin addon d'exemple (modèle) |
|
||||
|
||||
Installer (installation utilisateur, sans sudo) :
|
||||
|
||||
```bash
|
||||
cmake --install build --prefix ~/.local
|
||||
```
|
||||
|
||||
## Lancer les tests
|
||||
|
||||
Chaque cible de test est un binaire autonome utilisant `assert` — pas de
|
||||
framework, pas de téléchargement. Après avoir compilé :
|
||||
|
||||
```bash
|
||||
cd build && ctest --output-on-failure
|
||||
```
|
||||
|
||||
Ce sont **9 tests**. La plupart sont unitaires et ne touchent pas au système ;
|
||||
`flatpak-integration-test` est le seul à piloter le vrai CLI flatpak(dans une installation temporaire isolée), et `app-core-test` vérifie notamment que
|
||||
toute action privilégiée passe par la porte du mot de passe — **sans jamais
|
||||
rejouer une requête**, donc sans jamais exécuter pacman en root.
|
||||
|
||||
| Cible | Couvre |
|
||||
| --- | --- |
|
||||
| `pacman-manager-test` | parsing des sorties pacman |
|
||||
| `flatpak-manager-test` | parsing flatpak, cibles d'installation, commandes |
|
||||
| `flatpak-integration-test` | le CLI flatpak réel, de bout en bout |
|
||||
| `aur-manager-test` | le fournisseur AUR |
|
||||
| `app-core-test` | le core : providers, porte sudo, verrou, plugins |
|
||||
| `progress-tracker-test` | lecture de la sortie d'un outil, progression, ANSI |
|
||||
| `package-utils-test` | les utilitaires de paquets partagés |
|
||||
| `plugin-shop-test` | le catalogue JSON du magasin |
|
||||
| `update-manager-test` | la détection de version et l'auto-mise à jour |
|
||||
|
||||
[doc/tests.md](doc/tests.md) détaille chaque cible et explique comment en
|
||||
ajouter une.
|
||||
|
||||
## Conventions de code
|
||||
|
||||
- **Langage** : C++20, Qt6. Respecter la stack et les conventions déjà en place
|
||||
avant d'ajouter une dépendance.
|
||||
- **Formatage** : `.clang-format` (LLVM, 4 espaces, accolades attachées,
|
||||
100 colonnes). Lancez `clang-format -i <fichier>` avant de commiter.
|
||||
- **Fichiers** : `kebab-case` (ex. `browse-page.cpp`).
|
||||
- **Identifiants** : anglais, en `camelCase` pour les fonctions et variables,
|
||||
`PascalCase` pour les types.
|
||||
- **Commentaires** : en **anglais**, style « pourquoi ». Ne commentez pas ce que
|
||||
le code dit déjà ; documentez le choix d'implémentation, le compromis, le cas
|
||||
limite.
|
||||
|
||||
## Architecture : où poser son code
|
||||
|
||||
La coupure est structurante et ne se négocie pas :
|
||||
|
||||
- **Toute la logique vit dans `AppCore`** (`include/app-core.h`,
|
||||
`src/app-core.cpp`) : providers, threads de travail, historique, sudo, verrou
|
||||
pacman, auto-mise à jour. Cette couche ne dépend que de Qt Core et **ne
|
||||
contient aucun widget** — c'est ce qui permet à `app-core-test` de la tester
|
||||
sans écran.
|
||||
- **L'interface vit dans `pages/`**, un fichier par écran. `MainWindow`
|
||||
(`src/main-window.cpp`) n'est qu'un cadre : barre latérale, barre de statut,
|
||||
dialogues. Aucune règle métier.
|
||||
- **Le dialogue va toujours dans le même sens** : la vue appelle une méthode du
|
||||
core, qui répond « lancé », « il me faut le mot de passe sudo » ou « la base
|
||||
est verrouillée » ; la vue demande alors à l'utilisateur ce qu'il faut, puis
|
||||
rejoue la requête. Les résultats reviennent par signaux.
|
||||
|
||||
Ajouter un écran = une classe `Page` (voir `pages/page.h`) et une entrée dans la
|
||||
barre latérale. Ajouter un gestionnaire de paquets = un plugin implémentant
|
||||
`IPackageManager` dans `plugins/` — **sans toucher à l'application** (voir
|
||||
[doc/plugins.md](doc/plugins.md)).
|
||||
|
||||
## Flux de travail
|
||||
|
||||
### Branches
|
||||
|
||||
`type/description` : `feat/flatpak-files`, `fix/lock-message`, `docs/tests`…
|
||||
|
||||
### Commits
|
||||
|
||||
Format **Conventional Commits** :
|
||||
|
||||
```
|
||||
<type>(<portée>): <description>
|
||||
```
|
||||
|
||||
- Message en **anglais** ;
|
||||
- types : `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`,
|
||||
`ci`, `chore`, `revert` ;
|
||||
- titre court, à l'impératif ; le corps n'explique que le **pourquoi**, pas le
|
||||
comment ;
|
||||
- **commits signés** ;
|
||||
- le message ne mentionne **ni l'outil ni l'assistant** qui a produit le
|
||||
changement, et aucun co-auteur automatique n'est ajouté.
|
||||
|
||||
Exemple :
|
||||
|
||||
```
|
||||
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.
|
||||
```
|
||||
|
||||
### Avant de dire « terminé »
|
||||
|
||||
1. `cmake --build build` sans erreur ;
|
||||
2. `ctest --output-on-failure` : **tout vert** ;
|
||||
3. l'app se lance (`./build/PacManager`) sans avertissement en console ;
|
||||
4. la documentation concernée est à jour (`doc/`, `README.md` / `README.en.md`).
|
||||
|
||||
Un changement de comportement visible par l'utilisateur se vérifie **en
|
||||
exécutant le comportement**, pas seulement en relisant le code : les chemins de
|
||||
`pages/` ne sont pas couverts par `app-core-test`.
|
||||
|
||||
### Pull requests
|
||||
|
||||
- Une PR qui corrige un bug référence l'issue (`Fixes #123`).
|
||||
- Ne fermez ni ne modifiez une issue sans demande explicite du mainteneur.
|
||||
- Ne poussez, ne fusionnez et ne publiez pas sans demande explicite : ces
|
||||
opérations reviennent au mainteneur.
|
||||
|
||||
## Documentation
|
||||
|
||||
Le dossier [`doc/`](doc/README.md) est la source du wiki du projet ; chaque
|
||||
fichier est une page autonome et son nom de fichier est celui de la page. Un
|
||||
changement d'architecture, de contrat de plugin ou de comportement d'interface
|
||||
s'accompagne de sa mise à jour.
|
||||
|
||||
## Agents IA
|
||||
|
||||
Les agents qui travaillent sur ce dépôt suivent [`AGENTS.md`](AGENTS.md), qui
|
||||
reprend ces règles sous une forme adaptée et ajoute les contraintes qui leur
|
||||
sont propres (notamment l'absence de mention d'outil dans les commits).
|
||||
+3
-3
@@ -304,15 +304,15 @@ The plugin must be compiled with the same compiler and headers as the applicatio
|
||||
|
||||
## Development & conventions
|
||||
|
||||
This project follows the **FWS** organisation conventions, detailed in `AGENTS.md`:
|
||||
This project follows the **FWS** organisation conventions, detailed in [`CONTRIBUTING.md`](CONTRIBUTING.md) / [`CONTRIBUTING.en.md`](CONTRIBUTING.en.md):
|
||||
|
||||
- **Branches**: `type/description` (e.g. `feat/login`, `fix/typo`).
|
||||
- **Commits**: message in **English**, **Conventional Commits** format `<type>(<scope>): <description>`. Allowed types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`. Short, imperative title; the body explains only the **why**.
|
||||
- **Commits**: message in **English**, **Conventional Commits** format `<type>(<scope>): <description>`. Allowed types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`. Short, imperative title; the body explains only the **why**; commits are **signed**, with no tool mention and no automatic co-author.
|
||||
- **Naming**: `kebab-case` files; identifiers (variables, functions, classes) in **English**.
|
||||
- **Code & comments**: in **English**, "why" style (document the non-obvious — design choices, trade-offs — not the trivial).
|
||||
- **Tests**: `*.test.*` files with `describe` / `it` names in English; run tests (and typecheck / lint when present) before considering a task done. Run them with `ctest` from `build/`.
|
||||
- **Issues & bugs**: tracked through **issues** linked to the **Kanban** board; any PR fixing a bug references the issue (`Fixes #123`); do not close or modify an issue without explicit request.
|
||||
- **Sensitive files (`.gitignore`)**: never commit `.env*`, `.freebuff/`, `build/` / `dist/` / `target/` / `__pycache__/`, `node_modules/`, secrets. A `.gitignore` exists at the repo root.
|
||||
- **Sensitive files (`.gitignore`)**: never commit `.env*`, `.freebuff/`, `build/` / `dist/` / `target/` / `__pycache__/`, `node_modules/`, secrets. A `.gitignore` exists at the repo root. To build, test and propose a change, see [`CONTRIBUTING.en.md`](CONTRIBUTING.en.md).
|
||||
|
||||
## License
|
||||
|
||||
|
||||
@@ -307,15 +307,15 @@ Le plugin doit être compilé avec le même compilateur et les mêmes en-têtes
|
||||
|
||||
## Développement & conventions
|
||||
|
||||
Ce projet suit les conventions de l'organisation **FWS**, détaillées dans `AGENTS.md` :
|
||||
Ce projet suit les conventions de l'organisation **FWS**, détaillées dans [`CONTRIBUTING.md`](CONTRIBUTING.md) / [`CONTRIBUTING.en.md`](CONTRIBUTING.en.md) :
|
||||
|
||||
- **Branches** : `type/description` (ex. `feat/login`, `fix/typo`).
|
||||
- **Commits** : message en **anglais**, format **Conventional Commits** `<type>(<portée>): <description>`. Types autorisés : `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`. Titre court et impératif ; le corps n'explique que le **pourquoi**.
|
||||
- **Commits** : message en **anglais**, format **Conventional Commits** `<type>(<portée>): <description>`. Types autorisés : `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`. Titre court et impératif ; le corps n'explique que le **pourquoi** ; commit **signé**, sans mention d'outil ni co-auteur automatique.
|
||||
- **Fichiers** : `kebab-case` ; identifiants (variables, fonctions, classes) en **anglais**.
|
||||
- **Code & commentaires** : en **anglais**, style « pourquoi » (documenter le non-évident — choix d'implémentation, trade-offs —, pas le banal).
|
||||
- **Tests** : fichiers `*.test.*` avec noms `describe` / `it` en anglais ; les tests (et le typecheck / lint quand ils existent) doivent passer avant de considérer une tâche terminée. Lancez-les avec `ctest` depuis `build/`.
|
||||
- **Issues & bugs** : suivis via les **issues** liées au tableau **Kanban** ; toute PR corrigeant un bug référence l'issue (`Fixes #123`) ; ne pas fermer ni modifier une issue sans demande explicite.
|
||||
- **Fichiers sensibles (`.gitignore`)** : ne jamais committer `.env*`, `.freebuff/`, `build/` / `dist/` / `target/` / `__pycache__/`, `node_modules/`, secrets. Un `.gitignore` existe à la racine du repo.
|
||||
- **Fichiers sensibles (`.gitignore`)** : ne jamais committer `.env*`, `.freebuff/`, `build/` / `dist/` / `target/` / `__pycache__/`, `node_modules/`, secrets. Un `.gitignore` existe à la racine du dépôt. Pour construire, tester et proposer une modification, voir [`CONTRIBUTING.md`](CONTRIBUTING.md).
|
||||
|
||||
## Licence
|
||||
|
||||
|
||||
+5
-3
@@ -37,6 +37,8 @@ déboguer ou brancher un plugin.
|
||||
|
||||
## Conventions du projet
|
||||
|
||||
Elles sont dans [`AGENTS.md`](../AGENTS.md) : commits en anglais au format
|
||||
Conventional Commits, noms de fichiers en kebab-case, identifiants en anglais,
|
||||
commentaires en anglais, tests avant de considérer une tâche terminée.
|
||||
Elles sont dans [`CONTRIBUTING.md`](../CONTRIBUTING.md) (FR) et
|
||||
[`CONTRIBUTING.en.md`](../CONTRIBUTING.en.md) (EN) : build, tests, commits en
|
||||
anglais au format Conventional Commits et signés, noms de fichiers en
|
||||
kebab-case, identifiants en anglais, commentaires en anglais. Les agents IA
|
||||
suivent [`AGENTS.md`](../AGENTS.md).
|
||||
Reference in new issue
Block a user