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

@andreafspeziale/os-cli

v1.7.0

Published

Opinionated and convenient OpenSearch CLI

Downloads

110

Readme

Installation

The Official opensearch-cli is also available

npm

npm install -g @andreafspeziale/os-cli

yarn

yarn global add @andreafspeziale/os-cli

pnpm

pnpm add -g @andreafspeziale/os-cli

docker

docker pull andreafspeziale/os-cli
docker run --rm --env-file .env andreafspeziale/os-cli

If using a local (docker) OpenSearch image like the one included in the docker-compose file be sure to set correctly the network option and OS_HOST env variable (OS_HOST=http://opensearch:9200) in the above command (docker run --rm --env-file .env --network os-cli_default andreafspeziale/os-cli)

How to use?

Quickstart

To taste the CLI very quickly using npx or after installing it you can spawn OpenSearch locally by using the docker-compose file included in the repository:

  • git clone [email protected]:andreafspeziale/os-cli.git
  • cd os-cli
  • docker compose up -d
  • export OS_CONNECTION_METHOD=local
  • npx @andreafspeziale/os-cli i l or os-cli i l

Like the docker-compose file there are also some recipes included in the repository:

  • npx @andreafspeziale/os-cli i cr -i books -f ./recipes/create-index.json or os-cli i cr -i books -f ./recipes/create-index.json
  • npx @andreafspeziale/os-cli d cr -i books -f ./recipes/create-documents.json or os-cli d cr -i books -f ./recipes/create-documents.json
  • npx @andreafspeziale/os-cli d q -i books -f ./recipes/query.json or os-cli d q -i books -f ./recipes/query.json

Configuration

For proxy mode check aws-sigv4-proxy

The CLI leverages environment variables in order to set connection and logging options just once.

| Name | Required | Default | Description | Values | |-----------------------------|-----------------------------------------------------------|----------------------------------|------------------------------------------------|-----------------------------------------------------------------| | OS_HOST | when OS_CONNECTION_METHOD is NOT local | proxy | http://localhost:(9200 | 8080) | OpenSearch connection host | - | | OS_CONNECTION_METHOD | Yes | - | How you want to connect to OpenSearch | [local, proxy, serviceAccount, credentials] | | AWS_REGION | only when OS_CONNECTION_METHOD is NOT local | proxy | - | OpenSearch AWS connection region | - | | AWS_ROLE_ARN | only when OS_CONNECTION_METHOD is serviceAccount | - | AWS role ARN for assume role connection | - | | AWS_WEB_IDENTITY_TOKEN_FILE | only when OS_CONNECTION_METHOD is serviceAccount | - | AWS web identity token file | - | | AWS_ACCESS_KEY_ID | only when OS_CONNECTION_METHOD is credentials | - | AWS access key id for canonical connection | - | | AWS_SECRET_ACCESS_KEY | only when OS_CONNECTION_METHOD is credentials | - | AWS secret access key for canonical connection | - | | LOGGER_LEVEL | No | info | Which logs will be displayed | [silent, error, warn, info, http, verbose, debug] | | LOGGER_PRETTY | No | true | Boolean to enable/disable logs formatting | true, false | | LOGGER_REDACT | No | '' | Removed specified words from logs | - |

For a docker local OpenSearch instance all you need to do is:

export OS_CONNECTION_METHOD=local

Instead for a canonical AWS connection method a receipt along with your values would be:

export OS_HOST=
export OS_CONNECTION_METHOD=credentials
export AWS_REGION=
export AWS_ACCESS_KEY_ID=
export AWS_SECRET_ACCESS_KEY=

Development

After cloning the repository:

  • cd os-cli
  • cp ./env/.env.development ./env
  • docker compose up -d
  • pnpm install

I personally prefer build in a terminal window and run the compiled version in a separate one like so:

  • pnpm build --watch
  • pnpm start:prod or node dist/os-cli.js

Stay in touch

License

os-cli MIT licensed.