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

@platformatic/semaforo-cli

v1.0.0

Published

Semaforo CLI for Feature Flag management

Downloads

3

Readme

Semaforo CLI

Basic cli to manage user Semaforo Feature Flags.

Pre-requisites

  • Node v18.11.0 (uses the nodejs's util.parseArgs)
  • Auth0 account with a "M2M" client application configured.

Install and Setup

Install it globally with npm:

npm install -g @platformatic/semaforo-cli

Or clone this repo and from packages/cli link it globally:

pnpm link --global

In both cases, you need a .env file in the current directory with the Auth0 configuration.

Create a file named .env, specifying the values for the auth0 client (login in auth0 and navigate to the application to get the values)

AUTH0_CLIENT_ID=xxxyyyzzz
AUTH0_CLIENT_SECRET=zzzyyyxxx
AUTH0_DOMAIN=xxx.us.auth0.com

This cli class auth0 with a JWT token which is cached in node_modules/.cache/semaforo (if the cli is used in a folder with a package.json) or ~/.cache/semaforo (otherwise).

Usage

View

➜ semaforo view -u "github|999999"       
----------------------------------------
{
  "user_id": "github|999999",
  "name": "Marco",
  "email": "[email protected]",
  "nickname": "marcopiraccini"
}
Current flags: []
----------------------------------------

Set

➜ semaforo set -u "github|999999" -f ff1    
----------------------------------------
{
  "user_id": "github|999999",
  "name": "Marco",
  "email": "[email protected]",
  "nickname": "marcopiraccini"
}
Current flags: []
----------------------------------------
Flag ff1 set
----------------------------------------
{
  "user_id": "github|999999",
  "name": "Marco",
  "email": "[email protected]",
  "nickname": "marcopiraccini"
}
Current flags: [ 'ff1' ]
----------------------------------------

Unset

➜ semaforo unset -u "github|999999" -f ff1
----------------------------------------
{
  "user_id": "github|999999",
  "name": "Marco",
  "email": "[email protected]",
  "nickname": "marcopiraccini"
}
Current flags: [ 'ff1' ]
----------------------------------------
Flag ff1 unset
----------------------------------------
{
  "user_id": "github|999999",
  "name": "Marco",
  "email": "[email protected]",
  "nickname": "marcopiraccini"
}
Current flags: []
----------------------------------------

Clean

➜ semaforo clean -u "github|999999"           
Flags cleaned for user github|999999
----------------------------------------
{
  "user_id": "github|999999",
  "name": "Marco",
  "email": "[email protected]",
  "nickname": "marcopiraccini"
}
Current flags: []
----------------------------------------

List

➜ semaforo list                         
┌──────────────────┬──────────────────────────┬──────────────────────────────────┬─────────────────────────────┬───────┐
│          user_id │                     name │                            email │                    nickname │ flags │
├──────────────────┼──────────────────────────┼──────────────────────────────────┼─────────────────────────────┼───────┤
│  github|xxxxxxx  │      [email protected][email protected] │ xxxxxxxxxxxxxxxxxxxxxxxxxxx │       │
│    github|yyyyyy │                    Marco │        [email protected] │              marcopiraccini │   ff1 │

Set/unset All

These can be used to set/unset a flag for all users:

➜ semaforo setAll -f ff1
➜ semaforo unsetAll -f ff1

Both do a call for each user, so the whole process can take a while (depending on the number of users), the progress is shown in the console.