Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
Local Addressing of Repositories by Name
Open lorenz opened 1 year ago crate=radicle type=feature

Most repositories carry a xyz.radicle.project payload which has a name key.

{
  "payload": {
    "xyz.radicle.project": {
      "defaultBranch": "master",
      "description": "Radicle Heartwood Protocol & Stack",
      "name": "heartwood"
    }
  }
}

These names are also printed by rad seed (only for seeded repositories obviously…).

I would like to propose that for user input that take a RID, e.g. CLI arguments such as rad inspect --identity <RID> or rad cob log --repo <RID> we allow passing names in addition to RIDs.

These names would then be matched against the set of names of seeded repositories, and if the match is unique, the RID of the seeded repository would be used.

The benefit is that many projects have names that are much shorter and much easier to memorize compared to RIDs.

There is precedent in https://app.radicle.xyz/nodes/radicle.liw.fi/rad:zwTxygwuz5LDGBq255RA2CbNGrz8/tree/src/bin/cibtoolcmd/event.rs#L119

liw commented 1 year ago

rad ls also show repository names.

fintohaps commented 1 year ago

In either of those routes, we have to iterate and resolve the project and its name, and we could have to go over all of them to collect the list. I wonder if it might be better to keep something like an address book for repositories?

fintohaps commented 1 year ago

Maybe that’s a pre-optimisation. So I’d propose that we introduce a trait that has a method for returning a BTreeSet<RepoId> given an infix string – similar to the AliasStore. This can be implented using Storage initially.

fintohaps commented 1 year ago

Just want to make a note that there was a patch to add this to unseed – I think we should archive it in favour of doing this as a more general solution.

This is the patch:

  • rad patch show 76d850d32a4473d4b6c7d0fc869505c75487046d
  • radicle.xyz
rudolfs commented 1 year ago

+1, I’ve copied or typed in the repo name using rad cli regularly just to see an error message.