npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dria-cli

v0.0.10

Published

A command-line tool for Dria

Downloads

25

Readme

Installation

Dria CLI requires NodeJS (>= 18.0.0) & Docker to be installed on your machine, and is available on NPM. It can be installed to your system with:

npm i -g dria-cli

Usage

You can see available commands with dria help, which outputs:

dria <command>

Commands:
  dria pull [contract]          Pull a knowledge to your local machine.
  dria serve [contract]         Serve a local knowledge.
  dria clear [contract]         Clear local knowledge.
  dria fetch <txid>             Fetch an existing index on Arweave.
  dria extract <zip-path>       Extract a compressed knowledge.
  dria set-contract <contract>  Set default contract.
  dria config                   Show default configurations.
  dria list                     List all local knowledge.
  dria stop                     Stop serving knowledge.

Options:
      --help     Show help                                           [boolean]
      --version  Show version number                                 [boolean]
  -v, --verbose  Show extra information             [boolean] [default: false]

[!WARNING]

If you are using Docker with sudo only, you must use the Dria CLI with sudo as well, since it needs access to Docker in the background. Otherwise, the CLI will not be able to detect your Docker engine. See more here.

Pull Knowledge

A Dria knowledge is stored on blockchain, and we can pull that knowledge to our local machine with the pull command:

dria pull <contract>
dria pull # use configured contract

Serve Knowledge

After pulling a knowledge, you can serve the HNSW index over it with:

dria serve <contract>
dria serve # use configured contract

Stop Serving

The served HNSW index runs in the background, and you can stop it anytime with:

dria stop

Fetch Knowledge

You can download an existing HNSW index that lives in RocksDB and is zipped & uploaded to Arweave, which is much a faster option than dria pull command for an existing index.

dria fetch <txid>

Note that the argument here is not the knowledge ID (i.e. the corresponding Arweave contract txID); instead, it is the transaction ID of the bundling transaction where the RocksDB folder was zipped & uploaded to Arweave.

Extract Knowledge

The previously mentioned fetch command downloads a zip file from Arweave & extracts it. However, in some cases you might have the knowledge on another platform that is easier to access compared to downloading from Arweave, especially if internet connection is an issue. For such cases, we have the extract command which simply unzips the compressed knowledge under Dria's data directory.

dria extract <zip-path>

Configurations

You can set the default contract with set-contract command. When a contract is set by default, [contract] can be omitted such that the CLI will use the default one. To see the defaults:

# view configurations
dria config

# change contract
dria set-contract <contract>

List Knowledge

You can print out the list of contracts pulled or fetched so far, along with their last modification date, with the command:

dria list

[!NOTE]

If a knowledge has new data inserted to it, you will have to pull it again to catch up.

Remove Knowledge

To clear up some space by deleting a knowledge, use:

dria clear <contract>
dria clear # use configured contract

Setup

To setup the repository locally, first you must clone it:

git clone https://github.com/firstbatchxyz/dria-cli.git
cd dria-cli

Then, install packages with:

yarn install

You can run the CLI as if you are calling npx dria with the following command:

yarn dria

Styling

You can lint & check formatting with:

yarn lint
yarn format

License

See LICENSE.