Compare commits

..

11 Commits

Author SHA1 Message Date
eb730f4ae0 Release v0.6.0
All checks were successful
Check go code / build-and-release (push) Successful in 1m4s
Release binary and debian package for cl-cli / webext-build (push) Successful in 5m46s
Release binary and debian package for cl-cli / build-and-release (push) Successful in 1m56s
2025-11-18 09:48:34 +01:00
69eafc509a Append link to gitlab to create link between open project and gitlab (#7)
All checks were successful
Check go code / build-and-release (push) Successful in 1m7s
Reviewed-on: #7
Co-authored-by: Julien Fastré <julien.fastre@champs-libres.coop>
Co-committed-by: Julien Fastré <julien.fastre@champs-libres.coop>
2025-11-18 08:45:31 +00:00
f72f03e7d4 fix link
All checks were successful
Check go code / build-and-release (push) Successful in 1m2s
2025-11-13 12:47:09 +00:00
255e7fd5f0 link to gitea personal access token page
Some checks failed
Check go code / build-and-release (push) Has been cancelled
2025-11-13 12:46:24 +00:00
58422f926e Add a link to the most recent release
All checks were successful
Check go code / build-and-release (push) Successful in 1m3s
2025-11-13 13:00:20 +01:00
986bb4e2c2 remove debug information on build-and-release workflow
All checks were successful
Check go code / build-and-release (push) Successful in 1m6s
2025-11-13 12:49:29 +01:00
606486c3fe Release v0.5.0
All checks were successful
Release binary and debian package for cl-cli / webext-build (push) Successful in 3m10s
Release binary and debian package for cl-cli / build-and-release (push) Successful in 1m51s
2025-11-13 12:47:07 +01:00
0b9099d2d3 add missing changie 2025-11-13 12:42:56 +01:00
af1b805616 Set up native messaging with debian packages (#6)
All checks were successful
Check go code / build-and-release (push) Successful in 1m2s
Reviewed-on: #6
Co-authored-by: Julien Fastré <julien.fastre@champs-libres.coop>
Co-committed-by: Julien Fastré <julien.fastre@champs-libres.coop>
2025-11-13 11:39:38 +00:00
9439f6afe1 configure changie to update version on release
All checks were successful
Check go code / build-and-release (push) Successful in 1m5s
2025-11-12 20:12:44 +01:00
0a64db6925 Add a web extension and debian package compilation (#5)
All checks were successful
Check go code / build-and-release (push) Successful in 1m9s
Reviewed-on: #5
Co-authored-by: Julien Fastré <julien.fastre@champs-libres.coop>
Co-committed-by: Julien Fastré <julien.fastre@champs-libres.coop>
2025-11-12 19:10:41 +00:00
15 changed files with 195 additions and 315 deletions

4
.changes/v0.5.0.md Normal file
View File

@@ -0,0 +1,4 @@
## v0.5.0 - 2025-11-13
### Added
* Add a web extension
* Install using package manager, with CI generating the package

3
.changes/v0.6.0.md Normal file
View File

@@ -0,0 +1,3 @@
## v0.6.0 - 2025-11-18
### Added
* Append work package link to gitlab description after creating a WP from a gitlab issue

View File

@@ -25,8 +25,14 @@ newlines:
endOfVersion: 1
envPrefix: CHANGIE_
# update the version in the cargo file, on release
# update the version in relevant files
replacements:
- path: Cargo.toml
find: '^version = ".*"'
replace: 'version = "{{.VersionNoPrefix}}"'
- path: web-extension/cl/manifest.json
find: '"version": ".*"'
replace: '"version": "{{.VersionNoPrefix}}"'
- path: web-extension/cl/package.json
find: '"version": ".*"'
replace: '"version": "{{.VersionNoPrefix}}"'

View File

@@ -80,5 +80,4 @@ jobs:
md5sum: true
sha256sum: true
body: Test release
prerelease: true
#body_path: .changes/${{ github.ref_name }}.md
body_path: .changes/${{ github.ref_name }}.md

View File

@@ -6,6 +6,11 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie).
## v0.5.0 - 2025-11-13
### Added
* Add a web extension
* Install using package manager, with CI generating the package
## v0.4.1 - 2025-10-25
### Fixed
* Fix dependencies

324
Cargo.lock generated
View File

@@ -17,6 +17,15 @@ version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
[[package]]
name = "aho-corasick"
version = "1.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"
dependencies = [
"memchr",
]
[[package]]
name = "android_system_properties"
version = "0.1.5"
@@ -111,7 +120,7 @@ dependencies = [
"miniz_oxide",
"object",
"rustc-demangle",
"windows-link 0.2.1",
"windows-link",
]
[[package]]
@@ -169,17 +178,18 @@ dependencies = [
"iana-time-zone",
"num-traits",
"serde",
"windows-link 0.2.1",
"windows-link",
]
[[package]]
name = "cl-cli"
version = "0.5.0-alpha12"
version = "0.6.0"
dependencies = [
"clap",
"gitlab",
"log",
"open",
"regex",
"reqwest",
"serde",
"serde_json",
@@ -245,16 +255,6 @@ dependencies = [
"memchr",
]
[[package]]
name = "core-foundation"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f"
dependencies = [
"core-foundation-sys",
"libc",
]
[[package]]
name = "core-foundation-sys"
version = "0.8.7"
@@ -370,22 +370,6 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
[[package]]
name = "errno"
version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
dependencies = [
"libc",
"windows-sys 0.61.2",
]
[[package]]
name = "fastrand"
version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
[[package]]
name = "find-msvc-tools"
version = "0.1.4"
@@ -398,21 +382,6 @@ version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]]
name = "foreign-types"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
dependencies = [
"foreign-types-shared",
]
[[package]]
name = "foreign-types-shared"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
[[package]]
name = "form_urlencoded"
version = "1.2.2"
@@ -706,22 +675,6 @@ dependencies = [
"webpki-roots",
]
[[package]]
name = "hyper-tls"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0"
dependencies = [
"bytes",
"http-body-util",
"hyper",
"hyper-util",
"native-tls",
"tokio",
"tokio-native-tls",
"tower-service",
]
[[package]]
name = "hyper-util"
version = "0.1.17"
@@ -741,11 +694,9 @@ dependencies = [
"percent-encoding",
"pin-project-lite",
"socket2",
"system-configuration",
"tokio",
"tower-service",
"tracing",
"windows-registry",
]
[[package]]
@@ -973,12 +924,6 @@ version = "0.2.177"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976"
[[package]]
name = "linux-raw-sys"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039"
[[package]]
name = "litemap"
version = "0.8.0"
@@ -1029,23 +974,6 @@ dependencies = [
"windows-sys 0.61.2",
]
[[package]]
name = "native-tls"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e"
dependencies = [
"libc",
"log",
"openssl",
"openssl-probe",
"openssl-sys",
"schannel",
"security-framework",
"security-framework-sys",
"tempfile",
]
[[package]]
name = "num-traits"
version = "0.2.19"
@@ -1087,50 +1015,6 @@ dependencies = [
"pathdiff",
]
[[package]]
name = "openssl"
version = "0.10.74"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24ad14dd45412269e1a30f52ad8f0664f0f4f4a89ee8fe28c3b3527021ebb654"
dependencies = [
"bitflags",
"cfg-if",
"foreign-types",
"libc",
"once_cell",
"openssl-macros",
"openssl-sys",
]
[[package]]
name = "openssl-macros"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.108",
]
[[package]]
name = "openssl-probe"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e"
[[package]]
name = "openssl-sys"
version = "0.9.110"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a9f0075ba3c21b09f8e8b2026584b1d18d49388648f2fbbf3c97ea8deced8e2"
dependencies = [
"cc",
"libc",
"pkg-config",
"vcpkg",
]
[[package]]
name = "pathdiff"
version = "0.2.3"
@@ -1155,12 +1039,6 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "pkg-config"
version = "0.3.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c"
[[package]]
name = "potential_utf"
version = "0.1.3"
@@ -1287,6 +1165,35 @@ dependencies = [
"getrandom 0.3.4",
]
[[package]]
name = "regex"
version = "1.12.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4"
dependencies = [
"aho-corasick",
"memchr",
"regex-automata",
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.8.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58"
[[package]]
name = "reqwest"
version = "0.12.24"
@@ -1305,12 +1212,10 @@ dependencies = [
"http-body-util",
"hyper",
"hyper-rustls",
"hyper-tls",
"hyper-util",
"js-sys",
"log",
"mime",
"native-tls",
"percent-encoding",
"pin-project-lite",
"quinn",
@@ -1321,7 +1226,6 @@ dependencies = [
"serde_urlencoded",
"sync_wrapper",
"tokio",
"tokio-native-tls",
"tokio-rustls",
"tower",
"tower-http",
@@ -1359,19 +1263,6 @@ version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
[[package]]
name = "rustix"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e"
dependencies = [
"bitflags",
"errno",
"libc",
"linux-raw-sys",
"windows-sys 0.61.2",
]
[[package]]
name = "rustls"
version = "0.23.34"
@@ -1419,38 +1310,6 @@ version = "1.0.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
[[package]]
name = "schannel"
version = "0.1.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "891d81b926048e76efe18581bf793546b4c0eaf8448d72be8de2bbee5fd166e1"
dependencies = [
"windows-sys 0.61.2",
]
[[package]]
name = "security-framework"
version = "2.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02"
dependencies = [
"bitflags",
"core-foundation",
"core-foundation-sys",
"libc",
"security-framework-sys",
]
[[package]]
name = "security-framework-sys"
version = "2.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc1f0cbffaac4852523ce30d8bd3c5cdc873501d96ff467ca09b6767bb8cd5c0"
dependencies = [
"core-foundation-sys",
"libc",
]
[[package]]
name = "serde"
version = "1.0.228"
@@ -1609,40 +1468,6 @@ dependencies = [
"syn 2.0.108",
]
[[package]]
name = "system-configuration"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b"
dependencies = [
"bitflags",
"core-foundation",
"system-configuration-sys",
]
[[package]]
name = "system-configuration-sys"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4"
dependencies = [
"core-foundation-sys",
"libc",
]
[[package]]
name = "tempfile"
version = "3.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16"
dependencies = [
"fastrand",
"getrandom 0.3.4",
"once_cell",
"rustix",
"windows-sys 0.61.2",
]
[[package]]
name = "thiserror"
version = "1.0.69"
@@ -1734,16 +1559,6 @@ dependencies = [
"syn 2.0.108",
]
[[package]]
name = "tokio-native-tls"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2"
dependencies = [
"native-tls",
"tokio",
]
[[package]]
name = "tokio-rustls"
version = "0.26.4"
@@ -1912,12 +1727,6 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
[[package]]
name = "vcpkg"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]]
name = "want"
version = "0.3.1"
@@ -2051,9 +1860,9 @@ checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb"
dependencies = [
"windows-implement",
"windows-interface",
"windows-link 0.2.1",
"windows-result 0.4.1",
"windows-strings 0.5.1",
"windows-link",
"windows-result",
"windows-strings",
]
[[package]]
@@ -2078,54 +1887,19 @@ dependencies = [
"syn 2.0.108",
]
[[package]]
name = "windows-link"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a"
[[package]]
name = "windows-link"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
[[package]]
name = "windows-registry"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b8a9ed28765efc97bbc954883f4e6796c33a06546ebafacbabee9696967499e"
dependencies = [
"windows-link 0.1.3",
"windows-result 0.3.4",
"windows-strings 0.4.2",
]
[[package]]
name = "windows-result"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6"
dependencies = [
"windows-link 0.1.3",
]
[[package]]
name = "windows-result"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5"
dependencies = [
"windows-link 0.2.1",
]
[[package]]
name = "windows-strings"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57"
dependencies = [
"windows-link 0.1.3",
"windows-link",
]
[[package]]
@@ -2134,7 +1908,7 @@ version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091"
dependencies = [
"windows-link 0.2.1",
"windows-link",
]
[[package]]
@@ -2161,7 +1935,7 @@ version = "0.61.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
dependencies = [
"windows-link 0.2.1",
"windows-link",
]
[[package]]
@@ -2186,7 +1960,7 @@ version = "0.53.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3"
dependencies = [
"windows-link 0.2.1",
"windows-link",
"windows_aarch64_gnullvm 0.53.1",
"windows_aarch64_msvc 0.53.1",
"windows_i686_gnu 0.53.1",

View File

@@ -1,8 +1,8 @@
[package]
name = "cl-cli"
version = "0.5.0-alpha12"
version = "0.6.0"
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
@@ -18,7 +18,7 @@ path="src/webext.rs"
[dependencies]
clap = { version = "4.1.13", features = ["derive"] }
gitlab = "0.1804.0"
reqwest = { version = "0.12.24", features = ["rustls-tls"] }
reqwest = { version = "0.12.24", default-features = false, features = ["rustls-tls", "http2", "charset"] }
serde = { version = "1.0.228", features = ["derive"] }
toml = "0.9.8"
url = "2.5.7"
@@ -27,15 +27,16 @@ simple-home-dir = "0.5.2"
log = "0.4.28"
open = "5.3.2"
serde_json = "1.0.145"
regex = "1.12.2"
[package.metadata.deb]
maintainer = "Julien Fastré <julien.fastre@champs-libres.coop>"
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"]
]

View File

@@ -6,23 +6,51 @@ 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
[Go to the most recent release](https://gitea.champs-libres.be/julienfastre/cl-cli/releases/latest)
### 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 +61,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 ([Access the page on gitea.champs-libres.be](https://gitea.champs-libres.be/user/settings/applications)):
![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
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

View File

@@ -6,9 +6,12 @@ use crate::gitlab::issue::{Issue, IssueBundle, Project};
use crate::openproject::client::Client;
use crate::openproject::user::{GetMe, User};
use crate::openproject::work::WorkPackageWriterAssignee;
use crate::planning::utils::{append_related_issues, IssueRelated};
use crate::planning::Issue2WorkActionTrait;
use crate::planning::Issue2WorkResult;
use gitlab::api::{issues, projects, AsyncQuery};
use gitlab::api::projects::issues::EditIssue;
use gitlab::api::{issues, projects, ApiError, AsyncQuery};
use gitlab::RestError;
use url::Url;
#[derive(Debug)]
@@ -71,6 +74,27 @@ impl Issue2WorkActionTrait for GitlabAction {
.create_work_package(&(&dto).into(), &args.project_id)
.await?;
let url_wp = format!(
"{}/projects/{}/work_packages/{}",
config.openproject.base_url, args.project_id, work_package.id
);
let content =
append_related_issues(&IssueRelated::OpenProjectIssue(url_wp), &issue.description);
let endpoint_put_result = EditIssue::builder()
.project(issue.project_id)
.issue(issue.iid)
.description(content)
.build();
if let Ok(endpoint_put) = endpoint_put_result {
let r: Result<Issue, ApiError<RestError>> = endpoint_put.query_async(&client).await;
if r.is_err() {
eprintln!("Error while updating the issue description: {:?}", r);
}
}
let result = Issue2WorkResult {
work_package_url: format!(
"{}/projects/{}/work_packages/{}",

View File

@@ -65,10 +65,30 @@ fn add_related_issues_section(issue: &IssueRelated) -> Vec<String> {
fn convert_issue_link_items(issue: &IssueRelated) -> String {
match issue {
IssueRelated::OpenProjectIssue(issue_url) => format!("- [{}]({})", issue_url, issue_url),
IssueRelated::OpenProjectIssue(issue_url) => {
let m = format!("- [{}]({})", issue_url, issue_url);
match extract_id(issue_url) {
Some(n) => format!("{}\n- OP#{}", m, n),
None => m,
}
}
}
}
use regex::Regex;
fn extract_id(url: &str) -> Option<u32> {
// Cette regex capture le dernier segment numérique si lURL se termine par :
// - /work_packages/<id>
// - /wp/<id>
// Et accepte n'importe quel segment avant.
let re = Regex::new(r"/(?:work_packages|wp)/(\d+)$").unwrap();
re.captures(url)
.and_then(|caps| caps.get(1))
.and_then(|m| m.as_str().parse::<u32>().ok())
}
#[cfg(test)]
mod tests {
use crate::planning::utils::{append_related_issues, IssueRelated};
@@ -80,7 +100,8 @@ mod tests {
r#"
## Related issues
- [https://example/wp/1](https://example/wp/1)"#,
- [https://example/wp/1](https://example/wp/1)
- OP#1"#,
append_related_issues(&issue, &("".to_string()))
);
}
@@ -97,7 +118,8 @@ Some content
## Related issues
- [https://example/wp/1](https://example/wp/1)"#,
- [https://example/wp/1](https://example/wp/1)
- OP#1"#,
append_related_issues(
&issue,
&"Something happens.\n\
@@ -123,7 +145,8 @@ Some content
## Related issues
- [https://example/wp/2](https://example/wp/2)
- [https://example/wp/1](https://example/wp/1)"#,
- [https://example/wp/1](https://example/wp/1)
- OP#1"#,
append_related_issues(
&issue,
&r#"Something happens.
@@ -154,6 +177,7 @@ Some content
- [https://example/wp/2](https://example/wp/2)
- [https://example/wp/1](https://example/wp/1)
- OP#1
## Other content

View File

@@ -172,10 +172,10 @@ mod tests {
fn deserializes_issue2work_variant() {
// Given: a JSON with the external tag "type" matching the enum variant name
let payload = json!({
"type": "Issue2Work",
"url": "https://example.com/issues/123",
"project": "test"
});
"type": "Issue2Work",
"url": "https://example.com/issues/123",
"project": "test"
});
// When: deserializing to InputMessage
let msg: InputMessage = serde_json::from_value(payload).expect("valid enum JSON");
@@ -192,10 +192,10 @@ mod tests {
#[test]
fn fails_on_unknown_type_tag() {
let payload = json!({
"type": "Unknown",
"url": "https://example.com/issues/123",
"project": "test"
});
"type": "Unknown",
"url": "https://example.com/issues/123",
"project": "test"
});
let err = serde_json::from_value::<InputMessage>(payload).unwrap_err();
// Basic sanity check that it's a data error mentioning the unrecognized variant
@@ -210,8 +210,8 @@ mod tests {
fn fails_when_missing_required_fields() {
// Missing "url" and "project"
let payload = json!({
"type": "Issue2Work"
});
"type": "Issue2Work"
});
let err = serde_json::from_value::<InputMessage>(payload).unwrap_err();
let msg = err.to_string();

View File

@@ -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"]
}

View File

@@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "Champs-Libres Helper",
"version": "0.4",
"version": "0.6.0",
"browser_specific_settings": {
"gecko": {
"id": "helper@champs-libres-coop",
@@ -26,4 +26,4 @@
"scripts": ["dist/background/background.js"],
"type": "module"
}
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "web-extension",
"version": "0.4.0",
"version": "0.6.0",
"description": "",
"main": "index.js",
"scripts": {
@@ -12,7 +12,7 @@
},
"keywords": [],
"author": "",
"license": "ISC",
"license": "GPL-3.0-or-later",
"type": "commonjs",
"devDependencies": {
"@types/firefox-webext-browser": "^143.0.0",