Commit Graph

2490 Commits

Author SHA1 Message Date
Johannes Kühlewindt 895ca5d025 cli: rad node connect using only NodeId
Allow the `rad node connect` command to use only a `NodeId` when connecting.

The `NodeId` is used to connect to known addresses, and will stop at the first
address that is connected to.
2025-07-03 12:13:49 +01:00
Fintan Halpenny 76e00a34ea cli: change link direction symbols
The symbols used for [inbound] and [outbound] are part of the [Supplementary
Multilingual Plane](smp) (or Plane 1). This set of symbols are not as well
supported by font sets, as discovered by many reports of the characters missing.

There are two other arrow characters: [south east] and [north east] that serve
the same style and are part of the [Basic Multilingual Plane](bmp) (or Plane 0).
This set of characters is more widely supported.

[inbound]: https://www.compart.com/en/unicode/U+1F866
[outbound]: https://www.compart.com/en/unicode/U+1F865
[smp]: https://en.wikipedia.org/wiki/Plane_(Unicode)#Supplementary_Multilingual_Plane
[bmp]: https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_Multilingual_Plane
[north east]: https://www.compart.com/en/unicode/U+2197
[south east]: https://www.compart.com/en/unicode/U+2198
2025-07-02 11:10:09 +01:00
Lorenz Leutgeb 84427a56b5 radicle-term: Use crossterm instead of termion 2025-06-27 15:39:29 +02:00
Lorenz Leutgeb ee8ffcc799 radicle-term: Inline `termion::get_tty` for Unix 2025-06-27 15:39:29 +02:00
Lorenz Leutgeb ec47566cb0 radicle-term: Remove custom pager
I learned that there is an implementation of a pager in
`crates/radicle-term/src/pager.rs`. It does not make sense to me to
maintain a pager in `heartwood`, this is too far from the core of what
we are trying to achieve and adds unnecessary maintenance burden. We can
allow ourselves to defer to the paging done by `git` or just call the
user's `$PAGER`. Even though falling back to unpaged output might not be
the nicest thing, I still prefer that over maintaining the pager.

It also was frustrating to me that the pager does not support things
like search (like `less` does).

This also significantly decreases our dependence on `termion`.

The pager was originally implemented by cloudhead in

  40f4383bbc

and integrated into `rad diff` in

  6dd52c94fb

This commit restores the behaviour introduced in

  84a95848b0

(before there was a custom pager implementation).
2025-06-27 15:35:19 +02:00
Sebastian Martinez 570bfc3bbd debian: add missing env variables to debian build
During the build of heartwood there are a few environment variables in
particular `GIT_HEAD` and `RADICLE_VERSION` that are added during build
to be part of the final binary.

This wasn't the case so far with the debian packages, this patch exports
the needed vars for `override_dh_auto_build` so commands like `rad
--version` display the values.
2025-06-25 13:46:44 +02:00
Lorenz Leutgeb deb823f3b3 flake: Fix path to crates
This is a fix after my oversight of adjusting the path alongside
5bc2dc677b.
2025-06-24 23:04:23 +02:00
Lorenz Leutgeb e39653afcf build: Rewrite tagging script 2025-06-24 13:54:21 +02:00
Fintan Halpenny 6f34124d43 radicle: improve config errors
Improve the granularity of config errors mentioning the path location where the
configuration is expected to be loading from or saving to.
2025-06-24 13:51:55 +02:00
Sebastian Martinez 6686f86c67 radicle: fix small typo 2025-06-24 13:50:37 +02:00
Fintan Halpenny d8d00666d3 chore: remove radicle-tools
The `radicle-tools` binaries were specialised binaries for early development of
the `heartwood` set of crates. Choose to remove the crate so that it no longer
needs to build as part of our workspace.
2025-06-24 13:48:46 +02:00
Fintan Halpenny 42285e71cf chore: remove radicle-crdt
The `radicle-crdt` crate is no longer used by any of the other crates. Choose to
remove the crate so that it no longer needs to build and test as part of our
workspace.
2025-06-24 13:48:46 +02:00
Lorenz Leutgeb 78ba263d0a radicle-cli/issue: Improve comment templating
Writing a comment, only the most recent comment replied to is shown.
Editing a comment, current contents are not prepared. Manual copy required.

To improve:
 - Chase all replies to the root and quote them. Gracefully handle if
   this proces fails, i.e. a comment in the chain cannot be resolved.
 - If editing, copy the current contents.
2025-06-19 13:12:46 +02:00
Lorenz Leutgeb af35e6f4d0 radicle-cli: Warn when using old names of nodes 2025-06-18 16:21:21 +02:00
Lorenz Leutgeb 727e4e72c7 radicle-cli/debug: Use `BTreeMap` for consistent ordering
A `HashMap` does not guarantee a consistent iteration order. It is
desirable that all environment variables are printed in a consistent
order.

Use a `BTreeMap` which guarantees a consistent iteration order.
2025-06-18 15:55:54 +02:00
Lorenz Leutgeb 1df8cf102f radicle/bootstrap: Add rosa.radicle.xyz 2025-06-18 15:10:55 +02:00
Lorenz Leutgeb a354686bbc chore: Remove `seed.radicle.xyz`
The team node is not really special, remove occurrences.
2025-06-18 14:45:54 +02:00
Jakob Kirsch e30e66e009
radicle: add .external_template(false) to all other libgit2 calls
This complements 9d4aa59a12.
2025-06-14 00:28:06 +02:00
Fintan Halpenny ab62dce683 radicle: refactor Canonical
Changes for the `Canonical` type:
- Reorder arguments so that `delegates` and `threshold` are grouped
  after `refname`
- Add `Canonical::is_empty` to detect when `Canonical` was constructed
  with no tips
- Consume `Canonical` when calling `Canonical::quorum` to indicate
  that it should be the final step
2025-06-12 13:35:47 +02:00
Fintan Halpenny b2bcd561cf radicle: store threshold in Canonical
The Canonical type is generally constructed with the threshold, needed
for the quorum computation, in scope. To make it easier to use and
encapsulate its functionality, it now holds the threshold as an
additional field.
2025-06-12 13:19:48 +02:00
Fintan Halpenny b614167bd9 meta: relax radicle-git dependencies
Relax the set of radicle-git depedencies to allow for patches. In
particular, the dependencies introduced some small improvements with
`0.*.1` updates.
2025-06-12 13:01:38 +02:00
Lars Wirzenius 6e9517a186 fix Debian package building after crates have moved into a sub-dir
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-06-10 07:40:59 +03:00
Lorenz Leutgeb 5bc2dc677b repo: Move workspace crates into `crates` subdirectory
This keeps the top level of the repo cleaner, e.g.
<https://github.com/radicle-dev/heartwood> scrolls less and
<https://app.radicle.xyz/nodes/rosa.radicle.xyz/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5/>
might show more files at the top level.

This way we also don't have to explicitly name all crates in
`Cargo.toml`.
2025-06-09 15:09:21 +02:00
Lorenz Leutgeb 6259a70327 cargo: Use `workspace.package` table
This removes redundancy from the manifest of many of our crates.

See: <https://doc.rust-lang.org/cargo/reference/workspaces.html#the-package-table>
2025-06-09 14:25:31 +02:00
Lorenz Leutgeb eea6a9bc70 cargo: Clean up dependencies
All dependencies that are dependencies of multiple crates within the
workspace were pulled up to the root `Cargo.toml`. Dependencies that are
dependencies of just one crate within the workspace remain in the
`*/Cargo.toml` of that particular crate.

Generally, this helps us keep an overview of dependencies:
 - If multiple crates depend on a crate, we will see the reference to
   the workspce.
 - Otherwise, we will see a line that specifies the version.

It is up to the maintainers to recognize when a dependency becomes a
dependency of multiple crates in the workspace, at which point it should
be moved to the workspace.

The tool `cargo-autoinherit` can be used to automatically pull *ALL*
dependencies to the workspace. I used this, and in a separate, manual
step, filtered out those dependencies that are dependencies of a single
crate only, moving those back manually.

At the same time, I also unified depending on sibling crates in the
workspace. This is now also done via workspace dependencies.

See:
 - https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#inheriting-a-dependency-from-a-workspace
 - https://github.com/mainmatter/cargo-autoinherit
2025-06-09 13:58:52 +02:00
Lorenz Leutgeb d50df68b74 chore: Remove dependency `once_cell`
Rust 1.80 introduced `std::sync::LazyLock` which achieves the same, so
cut down on dependencies a bit.

See: <https://doc.rust-lang.org/1.80.0/std/sync/struct.LazyLock.html>
2025-06-09 12:06:30 +02:00
Lorenz Leutgeb 3bc0db68f4 doc: Add `CHANGELOG.md`
Inspired by other projects, such as Jujutusu, add a `CHANGELOG.md` file
to be updated alongside the actual changes in the heartwood repository.

The file is pre-filled with some release hightlights of earlier releases
from the Radicle home page. The format for the upcoming release is
prepared with the same structure that Jujutsu uses, which is based on
the suggestions at <https://keepachangelog.com>.

See also: https://radicle.zulipchat.com/#narrow/channel/369277-heartwood/topic/Changelog.20in.20tree/with/522524869
2025-06-05 10:59:36 +02:00
Lorenz Leutgeb 0fd8c8be4d github: Add README.md
This file will be rendered if the repository is accessed via the GitHub
website. It contains the most imporant information from `/README.md`
and some additional information regarding the status of the repository
on GitHub.

Thanks for the pointer, Yorgos!

See also:
 - https://radicle.zulipchat.com/#narrow/channel/369277-heartwood/topic/github.20repo/with/522296878
 - https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-readmes

Co-authored-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2025-06-05 09:26:26 +02:00
Lorenz Leutgeb bac719da21 bootstrap: Migrate radicle.garden → radicle.xyz 2025-06-04 17:13:02 +02:00
Jakob Kirsch 9d4aa59a12 radicle: add .external_template(false) to libgit2 call
Without this, rad clone fails with:
Error: checkout: git: failed to initialize repository with template 'hooks/README.sample': Permission denied; class=Os (2)
2025-06-04 12:15:59 +02:00
Sebastian Martinez a8ab718b98 chore(debian/changelog): update package version to match upstream 2025-06-03 17:55:02 +02:00
Sebastian Martinez 7380e2118b chore(debian/control): add sebastinez to Uploaders 2025-06-03 17:54:55 +02:00
Léon Zach eceb7f29c8 cob: Simplify the ChangeGraph implementation
Signed-off-by: Léon Zach <leon.zach@posteo.de>
2025-06-03 16:23:32 +02:00
Lorenz Leutgeb 4cd0782f2e radicle-schemars: Add crate for utility binary
Extracting JSON Schemas from the Radicle crate can be done via
`radicle-cli` for `radicle::profile::Config` by executing:

    rad config schema

However, for other JSON Schema metadata, this is not possible.

To allow other tools to extract JSON schemas as part of their build
process, introduce a new crate that only depends on `radicle`,
`schemars`, and `serde`, with a tiny binary that will reproduce various
schemas.
2025-06-03 15:10:30 +02:00
Lorenz Leutgeb fcd1acd1dd radicle/schemars: Annotate Commands and results
JSON Schema extraction via `schemars` is provided for configurations.
There are other interfaces that use JSON for (de-)serialization, such as
the communication with `radicle-node` via the control socket.

To ease implementation of tools that want to communicate via the control
socket, we add the respective `schemars` annotations.
2025-06-03 15:10:30 +02:00
Lorenz Leutgeb 05368e84fa cargo: Make schemars a workspace dependency
The `schemars` crate is a dependency of multiple workspace crates in the
same version. Its version number is repeated multiple times in the
respective `*/Cargo.toml` files. This requires more maintenance effort
and risks versions drifting.

As long as all crates depend on the same version, it makes more sense to
have `schemars` as a workspace dependency.

See: <https://doc.rust-lang.org/cargo/reference/workspaces.html#the-dependencies-table>
2025-06-03 15:10:30 +02:00
tippfehlr 9dae540c87 systemd: Provide user service for radicle-node
This file should usually be packaged to `/usr/lib/systemd/user`.
Otherwise, copy it to `/etc/systemd/user`.
2025-06-02 19:47:27 +02:00
Fintan Halpenny 6f25d73d3d build: remove quotes from rust-version
The script would include the quotes and so running `build/build` would
result in:

    $ build/build
    Running build..
    ✓ Radicle key already in ssh-agent
    Building Radicle 1.2.0..
    Creating archive of repository at e9cf91… in build/heartwood-e9cf91….tar.gz..
    Building image (radicle-build-1.2.0)..
    [1/2] STEP 1/17: FROM rust:"1.85"-alpine3.20 AS builder
    Error: creating build container: parsing reference "rust:\"1.85\"-alpine3.20": invalid reference format

Co-authored-by: Lorenz Leutgeb <lorenz.leutgeb@radicle.xyz>
2025-06-02 12:28:08 +02:00
Fintan Halpenny e9cf91e1bc cob: bump major version
The addition of the `Namespace` parameter in the traits requires a
major version bump for `radicle-cob`
2025-06-02 11:31:48 +02:00
Fintan Halpenny e6ef767f36 radicle: remove job cob
The Job COB is defined as separate crate: [radicle-job]. So this change removes
its definition and use from the `heartwood` repository.

[radicle-job]: https://app.radicle.xyz/nodes/seed.radicle.garden/rad:z2UcCU1LgMshWvXj6hXSDDrwB8q8M
2025-06-02 10:59:55 +02:00
Fintan Halpenny f4c8ff7a64 chore: prepare crates release
This prepares the crate versions for a new release. The version bumps were
determined by the `cargo-semver-checks` tool.

However, there were some issues with the `radicle-fetch` crate – where when
attempting to check it, it was unable to compile due to the previous version
expecting the kind of `Doc` with a generic parameter. I believe this is due to
the version for `radicle` being specified as simply `0`. This prompted changing
the version specifications to use `major.minor` for all the internal crates.
This, for example, would mean that `radicle-fetch` that relies on `0.15` can use
`>=0.15.0,<0.16.0` – allowing any patch versions but must require a minor
version bump.
2025-05-30 12:58:18 +02:00
Fintan Halpenny caf9e241a6 cli: fix outputs
- `format!` was missing for the `"No seeds found"` message, so the `{rid}` was not being formatted.
- Missing a space between the seed and the timing.
2025-05-30 12:46:48 +02:00
Fintan Halpenny ae1165fa58 build: do not assume `rad` remote
Do not assume the `rad` remote being present, in case other use other naming
remote schemes. Instead, build the remote using the `rad .` and `rad self --nid`
commands.
2025-05-30 12:27:21 +02:00
Fintan Halpenny edcfcae78c build: fix ssh symlinking
The symlinking process of `build/upload` was not working, due to the command
consuming stdin, and ignoring the subsequent targets platforms. Use `-n` to
prevent this, allowing every target binary to be uploaded correctly.

The output is also improved for better feedback during the upload process.
2025-05-30 12:27:13 +02:00
Fintan Halpenny 40e9b7ba3a build: update cargo-zigbuild version to 0.20 2025-05-30 11:17:39 +02:00
Fintan Halpenny 7dcfe45781 build: Dockerfile uses Rust version from `rust-toolchain.toml`
Instead of hardcoding the version of the Rust alpine file, introduce an `ARG` in
the `Dockerfile`. In `build/build`, we determine the version by inspecting
`rust-toolchain.toml`, and pass this value in. This ensures that the binaries
are built using the same toolchain that we develop with.
2025-05-30 11:17:39 +02:00
Fintan Halpenny 924b93283c cli: change announcement message
We ensure that the message of total synced seeds changes when we go over the
replication factor target. This can happen if the node is still waiting to
announce to a preferred seed, and other results are still being returned.
2025-05-30 09:46:53 +02:00
Fintan Halpenny d1ba665ebf radicle: introduce sync::announce tests
Test various cases for the `Announcer` to help ensure correct behaviour.
2025-05-30 09:43:12 +02:00
Fintan Halpenny aa7dcd92db radicle: use a struct to help announce success counts
It is easy to mix up the order of a tuple, so a struct is introduced instead to
ensure that the correct counts are used.
2025-05-30 09:42:08 +02:00
Fintan Halpenny 5a0c14cf61 radicle: ensure preferred seeds are announced to
Ensure that the preferred seeds that are not in the synced set are announced to.
2025-05-30 09:40:50 +02:00