Commit Graph

2674 Commits

Author SHA1 Message Date
Lorenz Leutgeb 6fb1ebec45 cli/clean: Use clap 2025-10-01 14:12:22 +02:00
Lorenz Leutgeb 753b7aef93 cli/path: Use clap 2025-10-01 13:04:28 +02:00
Fintan Halpenny 4787b53b1e CHANGELOG: Radicle 1.5.0 2025-09-30 19:13:31 +02:00
Fintan Halpenny 8bc578bfa8 build/release: missed updating the symlink 2025-09-30 19:10:54 +02:00
Lorenz Leutgeb 01f9f3fcd4 cli/unseed: Use clap 2025-09-30 15:13:09 +02:00
Lorenz Leutgeb 80bc95269b
cli/stats: Use clap 2025-09-29 16:44:18 +02:00
Lorenz Leutgeb f1c7c98607
cli/issue: Move definition of "about" to args 2025-09-28 19:47:50 +02:00
Christopher Fredén c7bff28452 cli/issue: Use clap
A rewrite of the argument parsing portions of the `rad issue` subcommand
using `clap` instead of `lexopt`.

From a user's perspective, the look-and-feel of `rad issue` does not
change much. Although, the most prominent change is to rely on
`clap`'a default error template which looks a bit different from what we
use usually (`error: ...` vs. `✗ Error: ...`).

Leaving the above restriction aside, subcommand mis-usage is
reported more verbosely.

Also configure `clap` to use colored output for errors and help pages.
In help output, headers are colored with `Magenta` to match the overall
CLI styling.

Specify a type that captures the different actions that can be take
when using the `comment` command: `Comment`, `Reply`, and `Edit`.
Move the functions that run the corresponding actions into a `comment`
module.

To preserve the "default command" behaviour being `rad issue list`,
e.g., `rad issue --solved` behaving like `rad issue list --solved`,
introduce a new type `EmptyArgs`to also parse arguments without a
subcommand. In case no subcommand was parsed, construct `Command::List`
with from `EmptyArgs`.

Co-authored-by: Matthias Beyer <mail@beyermatthias.de>
Co-authored-by: Lorenz Leutgeb <lorenz.leutgeb@radicle.xyz>
Co-authored-by: Erik Kundt <erik@zirkular.io>
Co-authored-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2025-09-28 18:02:55 +02:00
Lorenz Leutgeb 675a0f81d9
cli: Depend on clap 2025-09-28 18:02:55 +02:00
Lorenz Leutgeb 5a958b5ebd
cli/test: Output of `rad --help`
With migration subcommands to `clap` planned one-by-one,
prepare this to catch regressions.
2025-09-28 18:02:19 +02:00
Lorenz Leutgeb 22720e718b node: Make location of secret key configurable
With this change, the location of the secret SSH key can be configured
through `${RAD_HOME}/config.json` so that the node key does not have to
be placed under `${RAD_HOME}/keys` anymore.

Further, there is now an option to override `config.json` directly when
executing `radicle-node` via the command line argument
`--secret`.

The primary motivation is more flexible deployments, for example
leveraging external secret management solutions, like
<https://systemd.io/CREDENTIALS/>.

The secret key is fingerprinted by taking the fingerprint of the public
key corresponding to the secret key. This allows to detect when the
secret key changes.
2025-09-26 13:03:57 +01:00
Lorenz Leutgeb 5887edf93b
crypto/ssh/keystore: Explicit paths
The implementation of `Keystore` requires a particular layout and naming
of keys. This is a rather strong limitation. Lift it and allow
specifying an arbitrary path for the secret and public key.

As it is possible to derive the public key from the secret key, make
the public key in `Keystore` optional. Also allow constructing
`MemorySigner` can now be initialized without a public key, by
deriving it.
2025-09-26 13:21:38 +02:00
Lorenz Leutgeb 9e1d6b1feb radicle: Detect current repository using `jj`
When using Jujutsu and a non-colocated Git repository, the detection
using `git2` directly fails (just as `git` in a shell would fail)
because there is no `.git` directory found by traversing up the
filesystem hierarchy.

Add an invocation of `jj git root` as a fallback.
2025-09-26 12:03:01 +01:00
Lorenz Leutgeb abc963f2f2 radicle-cli/tests: Add `rad_jj_patch` 2025-09-26 12:03:01 +01:00
Lorenz Leutgeb 731688d3f2 flake: Install Jujutsu for testing 2025-09-26 12:03:01 +01:00
Lorenz Leutgeb fd5043d572 radicle-cli-test: Prepare testing with `jj`
Most of this is taken from Jujutsu's own testing setup, see:
98d884827e/cli/tests/common/test_environment.rs (L106-L150)

Not all features are preserved, but this is good enough.
2025-09-26 12:03:01 +01:00
Lorenz Leutgeb 53522288c1 radicle-cli/tests: `fn program_reports_version`
Introduce this `fn` to check whether a program is available.
2025-09-26 12:03:01 +01:00
Lorenz Leutgeb fafb3493dc
cli: Detect key mismatch
When run with a secret and public key that do not cryptographically
match, `fn radicle_cli::terminal::io::signer` would prompt the user
for a password to unlock the secret key, and then carry on with a
mismatching key pair.

Fix this by verifying that the keys match in `MemorySigner::load`
and only swallow errors initializing the signer in cases where
prompting for a password makes sense. It does not make sense in the
case of mismatched keys.
2025-09-26 00:33:59 +02:00
Fintan Halpenny ed8b086045 node: Log Panics
Register a panic handler that logs a backtrace via the `backtrace`
crate, instead of setting `RUST_BACKTRACE`.

Co-authored-by: Lorenz Leutgeb <lorenz.leutgeb@radicle.xy>
2025-09-24 10:51:34 +01:00
Defelo 0441b048f9
cli: Don't add newlines for empty descriptions in editor 2025-09-23 19:52:54 +02:00
Defelo ae01a42434
radicle: Allow to clear issue descriptions and comments
Previously it was possible to create an issue with an empty description
(i.e. an empty "root" comment), and also to change it later to a
non-empty string, however it was not possible to clear it again.
2025-09-23 19:52:54 +02:00
Defelo ec22c94321
cli/issue: Show previous title in `rad issue edit` editor 2025-09-23 19:52:53 +02:00
Defelo 9f62a82b0b
radicle: Fix `cob::common::Title::new`
The title should be trimmed before checking whether it is empty.
Also added a few tests.
2025-09-23 19:52:52 +02:00
Sebastian Martinez 5fea9ac05c node: Add `--log-logger structured` and `--log-format json`
Optionally depend on crate `structured-logger`. Allow enabling it via
`--log-logger structured`. For future compatibility, provide
`--log-format` which currently only supports JSON.

Co-authored-by: Lorenz Leutgeb <lorenz.leutgeb@radicle.xyz>
2025-09-23 16:33:50 +02:00
Lorenz Leutgeb e563117397 node: Refactor logging initialization
Logging initialization was infallible previously, i.e., a logger would
always have to be chosen, falling back to our own logger
implementation in case of failure with setting up journald submission.

This lead to complexity like attempting to log errors from parsing
arguments, as there is a circular dependency.

Change this to make logging initialization fallible. If it fails, exit
non-zero instead of falling back to another logger. This makes the
initialization code slightly simpler.

At the same time, make choosing the logger possible via the command
line and deprecate `--log`.

Note that we still default to journald if detected.
2025-09-23 16:33:50 +02:00
Yorgos Saslis 9793b4e7b6 systemd: Require Linux for journal module
The dependency `systemd-journal-logger` does not build on macOS, and
there are no tests for other Unixes. Also, systemd is most common on
Linux.

To avoid compilation errors on non-Linux platforms, only depend on the
crate when building on Linux.

Co-authored-by: Lorenz Leutgeb <lorenz.leutgeb@radicle.xyz>
2025-09-19 15:39:53 +02:00
Defelo e70850cb36 remote-helper: Add patch.branch option 2025-09-19 07:57:44 +01:00
Fintan Halpenny 6a43e83dd6 Release 1.3.1
Update the CHANGELOG for the 1.3.1 release detailing the fixing of panics
2025-09-18 10:25:57 +02:00
Lorenz Leutgeb 7b00bf2e3a cli/patch/review: Obsoletion Warning
As discussed in:
<https://radicle.zulipchat.com/#narrow/channel/369873-Support/topic/new.20to.20reviewing.20patches/with/533862639>
2025-09-17 13:32:50 +01:00
Lorenz Leutgeb 8dd17e2a60 cli/warning: Add `fn obsolete`
A helper to print obsoletion warnings to stderr.
2025-09-17 13:32:46 +01:00
Lorenz Leutgeb 7d1db6a013
cli/diff: Deprecation Warning
This command is just a small wrapper around `git diff` not worth
maintaining.
2025-09-17 10:35:15 +02:00
Lorenz Leutgeb 8558cc2233
cli/self: `--nid` deprecation warning to stderr
Printing the warning to standard output breaks scripts.

Instead, print to standard error.
2025-09-17 10:31:53 +02:00
Lorenz Leutgeb 3fb04623a4
cli/warning: Add `fn deprecate`
A helper to print deprecation warnings to stderr.
2025-09-17 10:31:25 +02:00
Lorenz Leutgeb 2635562c92
cli/node/status: Add `--only nid` 2025-09-17 10:31:21 +02:00
Fintan Halpenny 8afd55ff6f build: update release files location
The destination of the release files was moved, so this patch updates that
location.
2025-09-16 21:25:57 +02:00
Erik Kundt d2e10fdef6 cli/tests/commands: Clean up test `rad_patch`
This removes the `rad issue` test examples from being used in the
`fn rad_patch` test example execution. Removing it here is fine, since
it is being executed on its own anyways.
2025-09-16 19:40:35 +02:00
Sebastian Martinez 19210faab8 protocol/service: Change `Routing table updated..` from info to debug 2025-09-16 13:38:26 +01:00
Lorenz Leutgeb 86472fdccb
remote-helper/fetch: Improve error handling 2025-09-16 11:51:08 +02:00
Lorenz Leutgeb f542df1833
radicle: Use `git fetch-pack` for "local fetch" 2025-09-16 11:51:08 +02:00
Lorenz Leutgeb 20663a4e39
remote-helper: Use `git send-pack` for "internal push" 2025-09-16 11:44:56 +02:00
Lorenz Leutgeb f9ff484c9e cli: Make `rad patch show` prettier
The output of this command is confusing. It is not clear which of the
hashes printed is that of the revision and which one is the respective
head commit.

Further, the hash is omitted on the initial revision, adding confusion.

Further, the terminology of "revised" vs. "updated" is confusing.

This rewrites `timeline.rs` to drop the distinction between various
revisions (in wording, the small icon is still different) and cleans up
the output.

Attention is paid to alignment of the output. Now all verbs of updates
("accepted", "rejected", "reviewed", "merged") are aligned, and authors
("… by …") are also aligned.

The rewrite itself is not for better code quality or readability.
Note that all the code in this file only accessed via one `fn` by one
callsite in the implementation of `rad patch`.
2025-09-16 11:37:13 +02:00
Lorenz Leutgeb 43246fe6c8 remote-helper: Parse base revision early
Translation of the string passed as the value for push-option base
happens delayed.

Change this by parsing as soon as the value is written.

This also decreases the dependency fingerprint on `radicle-cli`.
2025-09-15 16:28:02 +01:00
Lorenz Leutgeb ef27961866
remote-helper: List `HEAD`
Report the default branch correctly via the symbolic reference `HEAD`.
2025-09-15 17:10:29 +02:00
Erik Kundt 101fbff809 ci: Deny `cargo doc` warnings
A job should fail whenever `rust doc` emits warnings.
2025-09-15 12:23:11 +02:00
Fintan Halpenny 14fcf50677 docs: fix doc string linking 2025-09-15 10:34:42 +01:00
Lorenz Leutgeb ee9e6de5f3 remote-helper: Do not assume remote name
Avoid ending up with an upstream to a potentially non-existent remote
when pushing to an anonymous remote.
2025-09-15 10:21:09 +01:00
Lorenz Leutgeb 6b9ff4f99e cli/init: Allow `--setup-signing` with bare repos
The `--setup-signing` flag is a no-op when combined with `--existing`
and errors on bare repositories.

Make it effective in combination with `--existing` and also rewrite it
to support bare repositories, gracefully falling back to just avoid
writing to `.gitsigners`.
2025-09-15 10:21:09 +01:00
Lorenz Leutgeb fd93240b9d cli/git: Remove dead code `fn view_diff` 2025-09-15 10:21:09 +01:00
Lorenz Leutgeb 86ea33b0ca cli/clone: Add flag `--bare` 2025-09-15 10:21:09 +01:00
Lorenz Leutgeb 766e281d39 radicle: Allow creating bare clones 2025-09-15 10:21:09 +01:00