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

@cloud-cli/cli

v1.9.0

Published

CLI for the Cloud CLI project

Downloads

240

Readme

Cloudy CLI

What is cloudy?

Cloudy is a both an HTTP server and a CLI tool, used to run commands on a remote machine using plugins.

So what?

Well, not any commands... You write a script that exports a few functions in an object and Cloudy takes care of exposing it as an API.

Here's an example:

export default {
  greeting: {
    sayHi() {
      return 'Hello!';
    }
  }
}

And here's what the CLI can do:

cy greeting.sayHi
> Hello!

Concepts

You install the CLI locally, point it to a server and run remote commands.

On the server side, you run the same CLI, but as an HTTP API.

Getting Started

You need a machine with Node.js installed. Then you can install the Cloudy CLI and create a server.

1. Set up the server

Tip: create an alias for Cloudy CLI. Add this to ~/.profile: alias cy="npx @cloud-cli/cli"

# generate a random key
head -c 5000 /dev/urandom | sha512sum
echo '[paste-the-generated-key-here]' > key

Next, let's create a configuration file called cloudy.conf.mjs on the server:

// import your plugins
import foo from 'foo-plugin';
import { init } from '@cloud-cli/cli';

function initialize() {
  // anything you need to run when the command server starts
}

// export commands from plugins
export default { foo, [init]: initialize };

// optional, change remote port and host
export const apiPort = 1234;
export const apiHost = '0.0.0.0';

And then we start the Cloudy server:

npx @cloud-cli/cli --serve

2. Set up the local CLI

On your local machine, create a configuration file again:

// cloudy.conf.mjs
export default {};

// same port as the config on the server
export const apiPort = 1234;
export const remoteHost = 'your-server.com';
export const key = '[paste-the-generated-key-here]';

And that's it!

Now you can run npx @cloud-cli/cli --help to get a list of commands available.

How it works

  • A call to cy foo.bar --option value on localhost is converted to a POST request to your-server.com/foo.bar with a JSON body { "option": "value" }.

  • The server runs your command and sometimes returns an output

  • The same commands can be executed with cy inside the server and in your local machine.

  • And if you need to un the same but from a browser, the entire CLI is also an API