Commit Graph

271 Commits

Author SHA1 Message Date
cloudhead befc76e030
cli: Move `init` errors up so it fails sooner 2023-09-03 17:21:39 +02:00
cloudhead f2e74fdad2
cli: Choose repo visibility on init
This allows a user to choose private or public visibility on `rad init`.
It also improves the output to tell the user what happened due to this
choice.
2023-09-03 17:21:37 +02:00
cloudhead 4fb5f6c172
cli: Simplify fatal error output
It didn't make sense to get eg. `Patch failed` when listing patches
failed. We change all fatal errors to simply "Error:", giving more
control over the individual commands.
2023-09-01 15:17:41 +02:00
cloudhead 46b0dfb11c
cli: Improve `rad init` error when not in Git repo 2023-09-01 15:17:41 +02:00
cloudhead 6c5cba3ca6
cli: Improve patch and issue outputs
* Add author to `issue show`
* Improve author display with alias
* Fix consistency issues when printing authors
2023-09-01 12:26:43 +02:00
cloudhead a46057da1f
cli: Update `rad ls` to look like other commands
We render the output of `ls` as a bordered table, like other tabular
data in the CLI.
2023-09-01 12:26:41 +02:00
cloudhead e59e196da8
cli: Show repo summary on `rad clone`
After cloning, we show a cool little summary with some repo stats.

We had to make some adjustments to the way visual width is calculated
due to a bug surfaced around emoji width calculation. Unfortunately
there isn't a perfect solution that works across terminals yet, so the
"variation selector 16" code-point is filtered out for now.
2023-09-01 12:22:50 +02:00
cloudhead 0c43b05066
cli: Improve `rad node` output 2023-09-01 12:22:50 +02:00
cloudhead df0b5da559
cli: Improve node connection error 2023-09-01 12:22:50 +02:00
cloudhead 6fcdb95f0a
cli: Improve `rad init` help output 2023-09-01 12:22:50 +02:00
cloudhead 09a284f09c
node: Make fetch timeout configurable
When a fetch is user-requested, a timeout can be supplied that is passed
down to the worker.

When a fetch is service-requested, a default timeout is used.
2023-09-01 12:13:45 +02:00
cloudhead a1df6d3748
cli: Add private repo support to `rad sync`
We can't use `node::seeds` for private repos.
2023-09-01 12:13:45 +02:00
cloudhead 47f09e6ff4
cli: Don't test Git hints in test
These hints are not stable and change with different Git versions. We
ignore them in the test output.
2023-09-01 12:13:05 +02:00
cloudhead f282e09dce
cli: Fix test speed regression
These two tests were holding everything up.
2023-08-21 11:57:32 +02:00
cloudhead 9bc636ae6e
cli: Write test for merge commits with patches 2023-08-16 16:23:32 +02:00
cloudhead 38f326948f
cli: Improvements to `inspect` command
* Add `--delegates` option
* Add `--policy` option
2023-08-16 15:00:23 +02:00
cloudhead d973fd42f2
cli: Auto-connect on sync
This adds functionality so that on `rad sync` and `rad clone`, we
connect to known seeds if necessary, before attempting to fetch.

In passing, some related changes were made:

* The `rad sync` command's arguments were reworked:
  `--replicas <count>` can be used to specify a replica count when
    fetching
* The `rad patch` command no longer has a `--fetch` option
* It's now possible to tell the node not to automatically connect to
  peers in the background
* `AddressBook` is being used underneath `Seeds` to allow for shuffled
  iteration
2023-08-11 11:45:27 +02:00
cloudhead fae518bca2
node: Improve `rad node connect` feedback
Only return once the connection is established or failed.

It's still not perfect, as several failure scenarios are not handled,
but it's an improvement.
2023-08-09 12:49:15 +02:00
Alexis Sellier 3bd5589b1a
cob: Stabilize formats
> I'm going to be making a set of breaking changes to COBs in order to
stabilize the data formats. This is hopefully a one-time change that
bundles various breaking changes.

All COBs have been reworked: issue, patch, id.

The changes included are:

* Revise the assign and tag actions to take a single list of
  assignees/tags to set, instead of an "add" and a "remove" list. This
  makes API usage simpler when editing issues, and simplifies the apply
  function
* Rename "tags" to "labels", and the tag action to label. This is
  because tag is confusing in the context of git, as it could mean a git
  tag. Using label removes that confusion.
* Use DIDs instead of PublicKeys for assignees -- this is more
  future-proof
* Modify the manifest file format in the COB tree. Mainly, remove the
  `history_type` key which is redundant, and use camelCase for keys
* Flatten the `Thread` actions into the parent action type
* Ensure that operations on redacted objects do not fail, since
  redactions could have happened concurrently
* Use a consistent naming scheme for actions, using `.` as separator
* Consolidate comment types and remove `CodeComment`, by adding an
  optional `location` field to `Comment`
* Add many placeholder actions that are not yet implemented

To preserve backwards compatibility, a `legacy` module is created with
the old `apply` function. When loading the manifest, we check whether it
is a legacy COB or a "stable" COB, and in the legacy case, use the
legacy code to materialize the state and then convert the object into
the stable type. Eventually, we'll delete the legacy code.
2023-08-07 11:05:14 +02:00
Alexis Sellier 885f4999da
remote-helper: Fix refs advertisement for patches
Some of the old patches had missing objects and that causes problems
during the ref advertisement, as the object is not found.

In this patch, we check that the object exists and also that the patch
is still open. Otherwise a remote tracking branch is created for every
single patch ref.
2023-08-06 17:29:21 +02:00
cloudhead 3898fece08
cli: `git pull` to update patches in working copy
We enable users to pull updates to a patch by calling `git pull`
on the patch branch.
2023-08-04 12:28:22 +02:00
cloudhead 2d79eecd66
cli-test: Update framework with new features
* Ability to switch between environments within the same test file
* Ability to expand env vars in `cd` command
2023-08-04 12:23:49 +02:00
Alexis Sellier 2ea9a911af
remote-helper: Handle patch update after merge
If you accidently merge updated patch code before updating the patch in
storage, you end up in this weird state where you can't update the patch
any longer. This fixes it.
2023-08-03 18:01:04 +02:00
Slack Coder 67a8ee9e86
cli: Remove rad-inspect `tree' dependency
Hard code output similar to the 'tree' command in rust to avoid having
to shell out.
2023-08-03 13:40:48 +02:00
Michail Zampetakis 0e54c4a293
cli: Fix rad-fetch readme link 2023-07-25 11:52:24 +02:00
Alexis Sellier edd70b701e
cli: Give hint on how to start node, when stopped
Also enable some tests that were disabled.
2023-07-20 10:40:24 +02:00
Alexis Sellier eb701be033
node: Make node aliases required
This is a fairly substantial change, which adds a new configuration file
to the user's `$RAD_HOME` that includes node configuration, including
the alias, and also makes node aliases required.

When running `rad auth`, the user is now prompted for an alias, which
defaults to `$USER`.

When running `rad self`, the alias is now shown.

If the user runs radicle without a config file, the defaults are loaded,
and `$USER` is used as the alias.
2023-07-11 18:08:59 +02:00
xphoniex 329ccbb304
cli: Add alias and check `rad patch` & `rad issue`
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-07-10 16:36:15 +02:00
xphoniex 37847d4c63
cli: Use `.aliases()` store for patches
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-07-10 16:36:15 +02:00
Alexis Sellier 1a1e63d998
node: Implement `sessions` command
Returns session information through the control socket.

We also update `rad node status` to display sessions.
2023-07-04 00:26:31 +02:00
Alexis Sellier f73389fc62
cli: Make `rad node connect` work like `--connect`
It was using a different syntax.
2023-07-04 00:26:31 +02:00
Alexis Sellier 0f3212a1b2
cli: `rad self` improvements
* Add `--home` flag
* Organize the information better

Now looks like this:

    DID             did🔑z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
    └╴Node ID (NID) z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
    SSH             running (823)
    ├╴Key (hash)    SHA256:UIedaL6Cxm6OUErh9GQUzzglSk7VpQlVTI1TAFB/HWA
    └╴Key (full)    ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHahWSBEpuT1ESZbynOmBNkLBSnR32Ar4woZqSV2YNH1
    Home            [..]
    ├╴Storage       [..]/storage
    ├╴Keys          [..]/keys
    └╴Node          [..]/node
2023-06-30 14:41:00 +02:00
Alexis Sellier 63ff4717dc
cli: Implement hunk-based code review
Review code with an interface similar to `git add -p`.
2023-06-22 11:15:42 +02:00
Alexis Sellier e325fa8621
cli: Turn `patch update` into a plumbing command
Remove most of the user-friendly functionality and simplify this command
so that it is only used for scripting.

`git push rad` is now the proper way of updating patches.
2023-06-21 17:02:00 +02:00
Alexis Sellier b25c2e452b
cli: Setup tracking branch on `rad patch checkout`
Just like when opening a new patch, we setup a tracking branch on patch
checkout, so that patches can be updated via a push.
2023-06-21 17:01:56 +02:00
Alexis Sellier cb576cf8c3
cli: Allow setting a different patch base on push
Using `-o patch.base=<oid>`, users can specify a different patch base,
when creating or updating a patch.
2023-06-15 10:25:32 +02:00
Alexis Sellier a6782ac2d6
cli: Add `-v` flag to `rad patch show`
With this flag, additional data such as the patch base is shown.
2023-06-13 13:17:07 +02:00
Alexis Sellier 48f44f4af5
cli: Fix ahead/behind and diff behavior
In certain cases, eg. after a rebase, or when patches are stacked, the
"ahead/behind" and/or the diff stats can be wrong.

This fixes it.
2023-06-13 13:16:00 +02:00
Alexis Sellier ec064891cd
cli: Setup tracking branch on `rad remote add` 2023-06-13 11:09:42 +02:00
Alexis Sellier e9ef0f4aa4
cli: Consolidate working copy remote setup
We consolidate the setup done by `rad checkout`, `rad clone` and `rad
remote add`, so that they all check for node aliases, and are all
capable of setting up tracking branches etc.
2023-06-13 11:09:42 +02:00
Alexis Sellier 50a97d9add
cli: Add `--scope` flag to `rad init`
Defaults to `all`.
2023-06-13 11:09:42 +02:00
Alexis Sellier 06566dac6f
cli: Add `--scope` flag for `rad clone`
This allows for a scope to be specified when cloning.

We also change the default scope when cloning to 'all' to more closely
match user expectations.
2023-06-13 11:09:42 +02:00
Alexis Sellier 0319bbb903
remote-helper: Don't allow opening an empty patch
If the commit range is empty, return an error.
2023-06-08 16:42:14 +02:00
Alexis Sellier 3d803b2498
cli: Remove `rad patch open`
Remove this command in favor of the `git push` flow.

We also remove the `rad/patches` remote configuration which wasn't
working properly with `git fetch --all`.
2023-06-07 15:57:11 +02:00
Alexis Sellier 547fdcc03b
remote-helper: Create patch drafts via `git push`
This is now possible via the `-o patch.draft` push option.
2023-06-07 15:02:05 +02:00
Slack Coder 92648f934e
cli: Patch message from all commits
Help the user when creating a patch by listing the messages of all
commits associated with the patch in almost the same format as git uses
for squashing.
2023-06-07 12:11:33 +02:00
Alexis Sellier e86e061a12
remote-helper: Patch message option when pushing
Allows for setting a patch message during a push. Eg.:

    $ git push -o patch.message="My Title" -o patch.message="My description" \
      rad HEAD:refs/patches

Works the same way as the `-m` flag of `git commit`.
2023-06-07 11:37:39 +02:00
Sebastian Martinez 6578fedfbb
cli: Add issue id to `show_issue` function
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-06-06 11:11:20 +02:00
Alexis Sellier ac60069a33
cob: Remove `description` from `Patch`
Since patches always have a "root" revision, use that revision's description
as the patch description.
2023-05-26 10:31:00 +02:00
Alexis Sellier ac06e319cd
remote-helper: Delete patch branches after merge
This cleans up the branches that were created during patch open, when a
patch is merged.
2023-05-25 10:07:02 +02:00
Alexis Sellier 4176d62e38
remote-helper: Add `no-sync` push option
This is mainly useful for scripting, when for eg. you want to push
multiple things and sync only once, at the end.
2023-05-25 10:07:02 +02:00
Alexis Sellier 8e89976937
cli: Verify merge, remove `rad merge` command
When applying a `Merge` action, we verify that the commit is in the
history of the default branch of that user.

Since this is not the case when issuing a `rad merge`, and since that
command is no longer needed with the push-based merge, we remove the
`rad merge` command completely.
2023-05-23 16:11:42 +02:00
xphoniex 95e3b9673d
cli: Show alias on `rad issue` and `rad patch`
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-05-22 15:13:28 +02:00
Alexis Sellier 90237e8e9d
cli: Fix some tests that are no longer valid 2023-05-17 16:54:30 +02:00
Alexis Sellier 94cd7658b1
cli: Merge patches on `git push`
Allows patches to have their state updated to `Merged` with a `git push`
to the default branch.

Currently, due to the limitations of the COB store, this requires a
linear search through all patches. This will eventually become a problem
when projects have thousands of patches, so we should look into
long-term solutions.
2023-05-16 21:11:57 +02:00
Alexis Sellier 8202495e24
cli: Rework `rad sync` command
By default, `rad sync` will both fetch and announce now.

To only fetch or only announce, the `--fetch` or `--announce` flags
can be used.
2023-05-15 15:34:45 +02:00
Alexis Sellier a9c0152a99
cli: Use library for updating patch
Also improves the message from a bare revision id.
2023-05-15 12:22:09 +02:00
Alexis Sellier 51dced4808
cli: Use library for opening patch
Instead of calling `rad patch open`, use `patch::create` directly.

Also outputs the patch id for the user.
2023-05-15 12:22:09 +02:00
Slack Coder ad48514ddd
cli: Fix workflow test
'git pull' in workflow/6-pulling-contributor causes a message to be
emitted for some git versions.  It asks to configure 'git pull's default
action.

Use '--ff' as a workaround as a git config file is unsupported, and no
environment variable exists for this configuration.
2023-05-14 13:50:20 +02:00
Alexis Sellier e7cc32a278
cli: Update some of the output formatting 2023-05-12 13:09:42 +02:00
Alexis Sellier dd7d86abb0
cli: Update examples to use new `fail` decorator 2023-05-12 12:54:21 +02:00
Alexis Sellier 103ee4e23d
cli: Show commit listing in `rad patch show` 2023-05-12 12:43:44 +02:00
Alexis Sellier fd1237b2db
cli: Use `git push` to open or update patches
This adds the ability to the git-remote-helper to open and update
patches via a `git push` to the magic ref `refs/patches` and
`refs/heads/patches/<patch-id>`.

The main change is that we had to move away from offering the `connect`
capability in the remote helper, to offering `push` and `fetch`
individually.

To get a feel for how this works, see the `rad-patch-via-push.md`
example.
2023-05-12 12:22:08 +02:00
Fintan Halpenny 8508eab8fa
radicle: update radicle-git-ext
This change updates to the latest radicle-git-ext, which required a
few changes within the radicle family of crates.

One set of changes is that the radicle-git-ext crate subsumes
git-commit, git-trailers, and git-ref-format -- so all those imports
go through radicle-git-ext.

The commit code requires that parent `Oid`s point to commits, which
made some tests fail. One of the reasons for these failures is that
the patch tests used fabricated `Oid`s and so the verification would
fail. This is fixed by allowing the test context code to create
`PatchRequest`s that create valid commits.
The other reason for failure was that the identity `Action` passed an
`Oid` that pointed to a blob. This is fixed by removing that code and
making a note of it in documentation.

The final major change was moving the Refspec type into git-ref-format
and removing the AsRefspecs trait. The trait was not required and
could its usage could be replaced by simpler code.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-05-08 10:36:15 +01:00
Fintan Halpenny 2ff6bf2fc4
cli: remove the 'rad' remote during `rad rm`
If the 'rad' remote is still in the git config, then some of the CLI
tooling will think the project exists -- even after running `rad rm`.

For example, in the current state, if `rad rm` is followed by `rad
init` then the operation will fail.

During `rad rm`, attempt to delete the 'rad' remote.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-05-08 10:49:18 +02:00
Fintan Halpenny c49412a73f
cli: allow rad rm to untrack without running node
Previously, `rad rm` would require the node to be running to untrack
the repository.

This is no longer necessary since the tracking db is exposed via the
`radicle` crate. Instead, use the db directly to untrack the RID
during `rad rm`, as long as the node is not already running.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-05-08 10:49:18 +02:00
Slack Coder 3e2cf83f9b
cli: List patches by last update
To help users notice changes to patches, make `rad patch` order patches
by revision timestamp instead of patch timestamp.
2023-05-08 10:32:48 +02:00
Slack Coder 6bedb1256c
cli: Make patch editable
Add `rad patch edit` to make the patch description editable.
2023-05-05 17:21:53 +02:00
Slack Coder 0bfc3f59ee
cli: Auth without ssh-agent
Avoid having ssh-agent a hard dependency of `rad-auth`.

Only add the user's key in `auth::init()` to ssh-agent if it is running,
instead of exiting with error.

For `auth::authenticate()` which is used to authenticate the user with
Radicle, assume using `RAD_PASSPHRASE` is a fallback authentication
method.  If ssh-agent is not-detected, verify the RAD_PASSPHRASE is
present and correct.  Treat neither being present as an error.

Support this by clarifying on `ssh::agent::connect()`s error which are
due to it not being present.
2023-05-03 15:52:33 +02:00
Alexis Sellier 649d59f143
cob: Include head in initial patch entry in DAG
This change ensures that we include as a parent to the initial commit
of a patch COB, the head of the branch we are proposing as a patch.

This was already happening for patch updates, but we forgot to also
include it for the initial patch revision.

This ensures that the code is always fetched alongside the patch.
2023-05-02 09:18:17 +02:00
Vincenzo Palazzo 730eaa00ca
cli: Improve `rad issue show` output
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-04-27 11:48:11 +02:00
Alexis Sellier 12a91bd0ae
cli: Create `rad patch ready` command
Allows for converting patches to and from draft mode.
2023-04-26 16:53:24 +02:00
Alexis Sellier 3b20d45d80
cli: Display patches like issues, in `rad patch`
We also make sure not to bail if one of the patches fails to load.
2023-04-26 12:29:32 +02:00
Alexis Sellier 7a08a1d459
cli: Get fetch after track working
When tracking a repository with the `--fetch` option, we run a fetch
once the tracking is done.

When tracking nodes, we don't accept the `--fetch` flag, as there may
not be a repository to fetch.
2023-04-26 09:49:37 +02:00
Alexis Sellier 3ea7541d55
cli: Replace seedling emoji with alien invader
To match the new branding, we remove seedlings and sometimes replace
them with alien invaders.
2023-04-25 12:47:36 +02:00
Alexis Sellier 7d72b16087
cli: Call `rad sync` on `git push rad`
Instead of `Node::announce_refs`, we call `rad sync` to have the
terminal block while waiting for nodes to fetch the changes.

We also change the use of `git push` in the patch command to not
trigger syncing in that case.
2023-04-25 12:46:25 +02:00
Alexis Sellier 6346931ce2
cli: Add canonical remote to `init` and `checkout`
Add a remote that points to the canonical upstream.
2023-04-24 15:42:00 +02:00
Alexis Sellier d6cebf613f
cli: Remove `rad fetch` command
The command is replaced with `rad sync --fetch`. Soon, it will be called
from the git-remote-helper, so users won't have to call it explicitly.
2023-04-24 14:19:31 +02:00
Alexis Sellier a285943166
cli: Remove `rad push` command
Users should use `git push` or `git push rad` instead.
2023-04-24 14:19:24 +02:00
Alexis Sellier 671c169244
node: Implement `rad sync` command
This command announces refs to peers and waits for them to be
in sync.

Adds a subscribe method to `Handle` so that we can get the events
from the seed to allow us to confirm that the configured seeds fetched
from us.
2023-04-24 11:39:37 +02:00
Vincenzo Palazzo 5a4d0fff3f
tests: add radicle command test for the rad remote
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-04-22 14:10:23 +02:00
Alexis Sellier 442e8a7128
cli: Cleanup patch examples a little 2023-04-22 13:59:18 +02:00
Alexis Sellier ff56843fcc
cli: Render `rad issue list` with a nice table 2023-04-22 13:59:18 +02:00
Alexis Sellier 6f17a4db67
cli: Don't show patch diff by default
It can be re-enabled with `-p`, which is what git uses usually.
2023-04-20 16:56:06 +02:00
Slack Coder 11d10b4e47
cli-test: Support '[..]'s which preserve spacing
By mapping all '[.. ]'s  with any number of spaces inside them into
'[..]'s, examples can preserve text formatting while using this glob
pattern.

The downside is failed output will show '[..]' in place of the original
version with spaces.
2023-04-20 16:52:20 +02:00
Fintan Halpenny f26adabdbf
cli: add rad fork example test
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-04-19 12:58:18 +02:00
Fintan Halpenny 3b49a7911b
cli: add rad fetch example test
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-04-19 12:58:18 +02:00
Alexis Sellier eecea67ffd
cob: Deduplicate change parents 2023-04-14 13:54:27 +02:00
Alexis Sellier 97f076e3cf
Include dependencies for certain COB actions
We ensure that for example, the given commits are fetched before the
revision or merge actions in a patch.
2023-04-14 13:22:10 +02:00
Alexis Sellier 9db63a8801
cli: Cleanup patch, checkout and clone output
Remove extra whitespace, start moving away from sprout.
2023-04-12 12:02:38 +02:00
Adam Szkoda 0f47dc9057
cli: Make `rad rm` work without a fork 2023-04-10 10:42:22 +02:00
Alexis Sellier c1face7cd8
cli: Fix and simplify `rad review`
* Properly remove review help message from review
* Remove `--no-confirm` and confirmation step

The CLI should be mostly non-interactive for day-to-day commands,
keeping the interactivity for the TUI.
2023-04-10 10:27:52 +02:00
xphoniex 414477a316
cli: Unify format of help messages
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-04-10 10:06:45 +02:00
Alexis Sellier 33461e4be1
Set patch status to `merged` automatically
When a merge is applied to a patch, we check whether the threshold
of delegates has been reached, at which point we set the patch status
to `merged`.

This requires threading the identity document oid through the "apply"
process.
2023-04-05 10:32:45 +02:00
Alexis Sellier 6b44955cd9
cli: Show timeline in `patch show` 2023-04-04 21:19:50 +02:00
Alexis Sellier b6fa4a4b2a
cli: Some improvements to `rad merge` 2023-04-03 16:06:24 +02:00
Alexis Sellier cf37950828
node: Rename control socket
The old name, `radicle.sock` didn't tell us much about the purpose
of this socket.
2023-03-31 17:29:58 +02:00
Slack Coder 0b7f169c8b
cli: Support revision id in `rad merge`
Revision IDs are globally unique.  Users will be able to use the
Revision ID in place of its patch ID.

Make `rad merge` refuse to merge an older revision unless the `--force`
option is given.
2023-03-31 17:24:55 +02:00
Alexis Sellier 6fb6cff708
term: Add border support for tables 2023-03-27 17:46:32 +02:00
Alexis Sellier 8dba01d6ae
cli: Improve patch command output
* Fix timeline ordering
* Remove spinner noise
* Add revisions to timeline
2023-03-24 13:04:52 +01:00
Vincenzo Palazzo 654a21b2b3
cli: Allow git revision parameters as COB IDs
This commit allows any git revision to be used instead
of the full SHA-1, when specifying COBs.

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-03-22 15:38:14 +01:00
Alexis Sellier db8ec5735f
cli: Use new widgets for `patch list` 2023-03-21 12:43:44 +01:00
Alexis Sellier ab74e54949
term: Implement new output widget system
We implement a new `Element` trait which allows for more complex output
to be drawn, such as vertical and horizontal stacks.

We adapt `Table` to work within this system.

We refresh the output of `rad patch show` to use these new tools.
2023-03-21 12:43:44 +01:00
Slack Coder b6c1560a0a
cli: add workflow example with two peers
Make the documentation more realistic by using two peers, a maintainer
and a contributor, for the client examples.  Define them as 'workflow'
examples, ordering them in their own directory to aid user navigation.
2023-03-20 18:27:58 +01:00
Alexis Sellier 5ccf38079c
cli: Make `patch checkout` fetch missing objects
Before this change, `rad patch checkout` would fail if the patch commits
were not in the working copy.
2023-03-18 12:24:17 +01:00
Alexis Sellier 13998dcf46
cli: Flesh out `rad self` 2023-03-15 10:25:23 +01:00
Alexis Sellier 9c77332cba
cli: Implement `tag` and `untag`
These commands are added at the top level because they will eventually
also work on patches.
2023-03-13 15:08:14 +01:00
Alexis Sellier f7aac06a8f
cli: Polish `assign` and `unassign` commands 2023-03-13 12:27:47 +01:00
Vincenzo Palazzo f8aa1daedb
cli: show the issue when it is created
Show the issue when it is created to give feedback to the user.

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-03-12 19:26:28 +01:00
Slack Coder 166f7e7cc2
cli: Minimize patch info on creation
Reduce noise when showing patch information to the user on creation by
only showing the git branch name and not the commit reference.
2023-03-11 18:38:54 +01:00
Alexis Sellier 34a2d1a9dc
cli: use canonical head for patch target
Correct assumptions made about how patching work in `rad patch`.  Make
the default Patch target a `git ref` in place of a target 'peer'.

Use the canonical head as the git reference.  This is head of the
project's master branch which project delegates have concensus on.
2023-03-11 18:38:54 +01:00
Alexis Sellier aacacf872f
cob: Use `EntryId` as the operation identifier
By introducing a small limitation: only allowing entries in the change
graph to be addressable, instead of individual operations; we
drastically simplify the CRDT implementation.

There are four advantages:

1. Op ids are just regular SHA-1s
2. There's no need for relative IDs, ops never refer to other ops within the
   same commit
3. There's no need for a nonce, since commits can't collide, and neither can op IDs
4. `OpId` can just be an alias of `EntryId`

The disadvantage of course, is that we have to be mindful of how we
create op transactions, since each transaction creates an addressable
unit. For example, we must not include multiple patch revisions in the
same transaction.
2023-03-09 17:08:56 +01:00
Alexis Sellier adbf6f5bf5
cli: Improve `patch` command
Cleanup and simplify output of patch command.
2023-03-08 20:23:49 +01:00
Alexis Sellier 1168f2ddb5
cli: Update `track` command
Allows the `track` command to be used to track nodes and repos.
2023-03-08 15:32:34 +01:00
Fintan Halpenny 3b015a9325
radicle: accept Scope as track_repo argument
The method `track_repo` only accepted the RID as the argument for
tracking.

Instead, allow passing Scope as an argument for tracking a
repository.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-03-08 11:29:34 +00:00
Fintan Halpenny ad63583bee
cli: rad node example
Tests the rad node CLI subcommand.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-03-07 15:38:41 +01:00
Alexis Sellier 85df613682
cli: Implement automatic issue announcement 2023-03-07 08:40:20 +01:00
Alexis Sellier 9000a626d7
Use commit oid for COB parent
We were using the blob oid, which was causing the commit tree to
be invalid.
2023-03-06 15:39:34 +01:00
Alexis Sellier be5c9c9258
cli: Add `--verbose` flag to `init` 2023-03-06 15:38:42 +01:00
Alexis Sellier e69be6051d
cli: Give more control over `init` announcement
Instead of always announcing the inventory, by default we don't.
Users can run `rad push` to trigger an announcement.
2023-03-06 15:38:42 +01:00
Alexis Sellier 82d858314f cli: Fix `rad rm` prompt 2023-03-04 22:28:45 +01:00
Alexis Sellier 43bd5fca00
cli: Implement `rad fetch` command 2023-03-02 17:00:27 +01:00
Alexis Sellier 2a687502c5
cli: Improve `rad inspect`
* Don't always require auth
* Fix `--refs` sub-command
2023-03-01 13:03:42 +01:00
Alexis Sellier 892f02bc43
cli: Improve `rad-auth` first authentication 2023-03-01 13:03:42 +01:00
Alexis Sellier e4b44370d3
cli: Register key on first `auth`
Registers the secret key with ssh-agent when `rad auth` is first called.
2023-03-01 13:03:42 +01:00
Alexis Sellier 06a92d52d9
cob: Use hashes for operation ids
It's fairly easy for a user to (by mistake or intentionally) create two
operations with the same OpId. This patch makes it much less likely,
and ensures that if the OpId is equal, it's because the operations
are identical.
2023-02-27 17:11:48 +01:00
Alexis Sellier 0a93fa833e
cli: Simplify & improve CLI output
Improvements to the CLI output as well as converging towards
`termion` as a backend.

The crates we were using for prompting and spinners were based on
a terminal backend called `console`, which is not really used
anywhere else. There were also limitations in terms of the output
of these crates.

Therefore, we switched to the `inquire` crate for prompting, using
the `termion` backend, which is very standard.

Additionally, we simplify the terminal output to use symbols:

! for Warning
✓ for Success
✗ for Error

... Instead of a mix of words and symbols.

We also include a modified version of the `yansi` crate which plays
well with our table formatting functions by automatically truncating
and padding output in a unicode-aware way.
2023-02-27 17:10:52 +01:00
Alexis Sellier 7e1b2b6222
crypto: Cleanup `hash` module
Remove `Digest` type and use `ssh-key` for formatting public ssh key.
2023-02-17 10:51:27 +01:00
Fintan Halpenny ef0628c48e
Exchange From for TryFrom for PathBuf and Home
The `From` implementation would allow someone to create a `Home` in an
incorrect fashion, for example the path is not canonical.

Exchange `From` for a `TryFrom` implementation.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-02-17 10:37:39 +01:00
Sebastian Martinez b04451a1bd
Use `Did` in a bunch more places
Instead of showing just public keys we need to show the fully qualified
spec for a NID which is prefixed by `did🔑` While we want to maintain
`Author` and `ActorId` for internal use.

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-02-16 18:01:42 +01:00
Fintan Halpenny 5477a3615f
radicle-cli: use Did across CLI
The CLI commands and output use PublicKey, ActorId, and NodeId for
peer identifiers.

Instead Did should be standardised for use in CLI arguments and
outputs.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-02-16 17:07:14 +01:00
Vincenzo Palazzo b9ed0bc4cb
cli: Add `rad patch checkout`
This commit allows to checkout a patch created
with `rad patch open` in a new branch
named `patch/{short_patch_id}`.

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-02-15 14:06:04 +01:00
Vincenzo Palazzo ff52ea7223
cli: Show patch id when we run `rad patch list`
This commit includes a simplification in finding the
long patch id in order to perform operations like
`patch show <id>` and `patch checkou <id>`.

Actual output

```
➜  rio git:(main) rad patch list

- YOU PROPOSED -

patch text 8c94760699e R0 f1b2740 (macros/rad_patch) ahead 1, behind 0
└─ * opened by z6MkuvfwAkZ6yD6Z5TT6YXfJjFNPMQz9fPi9BSU7gwhS9s2x (you) 12 minutes ago
└─ * patch id 8c94760699e3e2da64aa9f14f4d2cecfe7b754ad

patch text 78e0fb5ad45 R0 f1b2740 (macros/rad_patch) ahead 1, behind 0
└─ * opened by z6MkuvfwAkZ6yD6Z5TT6YXfJjFNPMQz9fPi9BSU7gwhS9s2x (you) 24 minutes ago
└─ * patch id 78e0fb5ad45481d225a6fb45f51422e468b55c94

- OTHERS PROPOSED -

Nothing to show.

```

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-02-15 14:00:55 +01:00
Fintan Halpenny e7c929898a
cli: add Identity::current to output
Add the resulting SHA of the new Identity when performing `rad id
commit`.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-02-13 18:02:23 +01:00
Fintan Halpenny 6b674a38c1
cli: rad id example
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-02-13 13:50:52 +00:00
Sebastian Martinez 881e9af219
httpd: Add `assignees` to `Issues::create`
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-02-13 13:47:15 +01:00
Alexis Sellier 3e7761740f
node: Rely on inventory announcement in `rad init` 2023-02-13 09:59:44 +01:00
Alexis Sellier 27d0c8f235
cli: Track projects we initialize 2023-02-12 16:48:46 +01:00
xphoniex bdc0ab9881
Update `radicle-git` and `radicle-surf`
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-02-10 22:14:50 +01:00
Adam Szkoda 93ba7f593c
cli: Fix a test failing on macos: rad_checkout 2023-02-10 15:01:06 +01:00
Alexis Sellier b2dbf12862
cli: Fix `rad rm` command 2023-02-10 12:56:11 +01:00
Sebastian Martinez a57b33c785
httpd: Add `api::test::patch` request method
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-02-10 12:17:03 +01:00
Slack Coder 02c07d7be1
cli: Test rad-clone is deterministic
The last commit of a newly cloned repository should remain untouched by
making `Node::project()` use a repository fixture instead of a randomly
generated one.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2023-02-09 16:49:52 +01:00
Slack Coder ac812d7834
rad: Add comment `reply-to`
Allow replying to patch and issue comments using `rad comment --reply-to` option.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2023-02-09 16:42:47 +01:00
Alexis Sellier b108342fab
cli: Test clone failure for unknown repo 2023-02-08 21:28:59 +01:00
Alexis Sellier 69ac8be8fd
node: Update local routing table on announce 2023-02-08 21:28:49 +01:00
Alexis Sellier 9177e67de6
cli: Use same project for clone test 2023-02-08 20:21:35 +01:00
Slack Coder ed9900b5ac
cli: Support patch commenting
Allow commenting on a patch as well an issue.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2023-02-07 11:16:59 +01:00
Alexis Sellier 2649e9c6fe
cli: Add `rad-clone` test 2023-02-07 10:46:12 +01:00
Slack Coder 3c202564bf
cli: split into patch::create and patch::update
Simplify codebase by splitting patch::create::run() into patch::create::run() and
patch::update::run().

Patch has the subcommands `create` and `update` but both use the same
method to do the heavy lifting.  Spitting the code allows us to detangle
the code path making it easier to follow.

Also, reduce cognitive load by minimizing the amount of variables used
and isolating them to utility functions.  For instance, `head_branch` can be passed to
these methods instead of `head_oid` and `head_branch`.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2023-02-06 13:53:31 +01:00