diff --git a/.changes/unreleased/Added-20251112-201311.yaml b/.changes/unreleased/Added-20251112-201311.yaml new file mode 100644 index 0000000..372c687 --- /dev/null +++ b/.changes/unreleased/Added-20251112-201311.yaml @@ -0,0 +1,3 @@ +kind: Added +body: Add a web extension +time: 2025-11-12T20:13:11.961655215+01:00 diff --git a/Cargo.lock b/Cargo.lock index 98947b0..df7c9aa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -174,7 +174,7 @@ dependencies = [ [[package]] name = "cl-cli" -version = "0.5.0-alpha15" +version = "0.5.0-alpha16" dependencies = [ "clap", "gitlab", diff --git a/Cargo.toml b/Cargo.toml index a9d5676..f23e1a1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "cl-cli" -version = "0.5.0-alpha15" +version = "0.5.0-alpha16" edition = "2021" -license = "GPLv3" +license = "GPL-3.0-or-later" description = "Some helpers scripts for Champs-Libres" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -30,12 +30,12 @@ serde_json = "1.0.145" [package.metadata.deb] maintainer = "Julien Fastré " -copyright = "AGPLv3" extended-description = """Helpers for Champs-Libres""" depends = "$auto" section = "utility" priority = "optional" assets = [ ["target/release/cl-cli", "usr/bin/cl", "755"], - ["target/release/webext", "usr/bin/", "755"], + ["target/release/webext", "usr/bin/cl-webext", "755"], + ["web-extension/_native-messaging/cl_cli.json", "/usr/lib/mozilla/native-messaging-hosts/", "644"] ] diff --git a/README.md b/README.md index 6003ae8..786a952 100644 --- a/README.md +++ b/README.md @@ -6,23 +6,49 @@ Currently: - convert a gitlab issue to a work package -## Install & configure +## Install -### Install +There are two components to install: -Download the most recent binaries at https://gitea.champs-libres.be/julienfastre/cl-cli/releases +- a firefox add-ons; +- some binaries on the host machine -Once downloaded, install it: +### Install firefox add-on -``` -# this will install the command globally with the name "cl-cli" -sudo install cl-cli /usr/local/bin/cl-cli +Using firefox, download the `.xpi` file from the [release page](https://gitea.champs-libres.be/julienfastre/cl-cli/releases) of the `julienfastre/cl-cli` repository. -# this will install the command globally with the name "cl" -sudo install cl-cli /usr/local/bin/cl +### Install cl-cli binaries + +#### Using package manager + +A debian package is published and stored on gitea. + + + +```bash +# download the gpg key +sudo curl https://gitea.champs-libres.be/api/packages/julienfastre/debian/repository.key -o /etc/apt/keyrings/gitea-julienfastre.asc + +# add the package repository. You must adapt the $distribution (see below) +echo "deb [signed-by=/etc/apt/keyrings/gitea-julienfastre.asc] https://gitea.champs-libres.be/api/packages/julienfastre/debian $distribution main" | sudo tee -a /etc/apt/sources.list.d/gitea.list + +# update +sudo apt update + +# install +sudo apt install cl-cli ``` -### Configure +Available distributions: + +- Ubuntu 24..04: noble +- Ubuntu 25.04: plucky +- Ubuntu: 25.10: questing + +**Note:** The package is very simple, there are very few dependencies, and there isn't any difference between them for now. + + +## Configure Copy the file [config.toml.dist](./config.toml.dist) as a template, and save it at the path `$HOME/.config/cl-cli/config.toml`: @@ -33,14 +59,19 @@ cp config.toml $HOME/.config/cl-cli/config.toml editor $HOME/.config/cl-cli/config.toml ``` -Then, fill it with the required configuration options (gitlab and openproject token). +Then, fill it with the required configuration options: + +- gitea personal access token: + + ![configuration screenshort](./docs/configuration/gitea_screenshot_configure_pat.png) +- Gitlab: [Create an access token](https://gitlab.com/-/user_settings/personal_access_tokens?name=cl-cli&scopes=api,read_user) With the "api" and "read_user" scopes +- [Openproject](https://champs-libres.openproject.com/my/access_tokens) -## Usage +## Usage as CLI ### Convert a gitlab issue into a work package - ```bash cl-cli planning i2work https://gitlab.com/Chill-Projet/chill-bundles/-/issues/240 chill ``` diff --git a/docs/configuration/gitea_screenshot_configure_pat.png b/docs/configuration/gitea_screenshot_configure_pat.png new file mode 100644 index 0000000..28fa6d4 Binary files /dev/null and b/docs/configuration/gitea_screenshot_configure_pat.png differ diff --git a/web-extension/_native-messaging/cl_cli.json b/web-extension/_native-messaging/cl_cli.json new file mode 100644 index 0000000..6ff0047 --- /dev/null +++ b/web-extension/_native-messaging/cl_cli.json @@ -0,0 +1,7 @@ +{ + "name": "cl_cli", + "description": "Call cl-cli from browser", + "path": "/usr/bin/cl-webext", + "type": "stdio", + "allowed_extensions": ["helper@champs-libres-coop"] +} diff --git a/web-extension/cl/package.json b/web-extension/cl/package.json index 2c64e3e..5b8f8ce 100644 --- a/web-extension/cl/package.json +++ b/web-extension/cl/package.json @@ -12,7 +12,7 @@ }, "keywords": [], "author": "", - "license": "ISC", + "license": "GPL-3.0-or-later", "type": "commonjs", "devDependencies": { "@types/firefox-webext-browser": "^143.0.0",