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 🙏

© 2026 – Pkg Stats / Ryan Hefner

anypoint-cli-command-lib

v1.6.14

Published

Anypoint CLI core Library

Downloads

35,972

Readme

anypoint-cli-command-lib

This package contains the base command class for Anypoint CLI (anypoint-cli-v4). Extend this class for convenient access to common Anypoint CLI parameters, a logger, CLI output formatting, and scratch orgs. This class extends @oclif/core.

Installation

npm install anypoint-cli-command-lib

Usage

Check Your Anypoint CLI Version

Commands that extend Core can only be used with Anypoint CLI version 4.0.0 or later. To check your Anypoint CLI version:

$ anypoint-cli-v4 --version
anypoint-cli-v4-public/1.6.23 linux-x64 node-v20.x

Customizing the User-Agent Header

As of version 1.6.10, you can customize the User-Agent header sent with all HTTP requests made by the library. This is useful for identifying traffic from your custom CLI tools or applications in backend analytics.

Basic Usage

Call setUserAgent() in your CLI's bootstrap code before any commands execute:

// In your CLI's bin/run or main entry point
const { setUserAgent } = require('anypoint-cli-command-lib');

// Set your custom User-Agent
setUserAgent('MyCustomCLI/1.0.0');

// Now start your CLI
const oclif = require('@oclif/core');
oclif.run().then(require('@oclif/core/flush')).catch(require('@oclif/core/handle'));

Example: ACB (Anypoint CLI for Business)

#!/usr/bin/env node
const { setUserAgent } = require('anypoint-cli-command-lib');
const oclif = require('@oclif/core');

// Set custom User-Agent so backend services can identify ACB traffic
setUserAgent('ACB/2.0.0');

oclif.run().then(require('@oclif/core/flush')).catch(require('@oclif/core/handle'));

Dynamic User-Agent

You can read the version dynamically from your package.json:

const { setUserAgent } = require('anypoint-cli-command-lib');
const packageJson = require('./package.json');

setUserAgent(`${packageJson.name}/${packageJson.version}`);

Default Behavior

If you don't call setUserAgent(), the library uses the default:

User-Agent: Anypoint-CLI/<version>

This maintains backward compatibility with existing consumers.

Technical Details

  • The User-Agent is applied to all HTTP requests made to Anypoint Platform domains (anypoint.mulesoft.com, platform.mulesoft.com)
  • The value is set globally and persists for the lifetime of the process
  • You can call setUserAgent() multiple times; the last value wins
  • The custom User-Agent appears in backend logs and analytics, allowing platform teams to differentiate between CLI variants

Features

To learn more about the features of the Command Library see the How to develop a plug-in.

API Reference

setUserAgent(value: string): void

Sets a custom User-Agent header for all HTTP requests made by the library.

Parameters:

  • value (string) - The custom User-Agent string to use (e.g., "MyTool/1.0.0")

Example:

const { setUserAgent } = require('anypoint-cli-command-lib');
setUserAgent('CustomTool/2.5.0');

Notes:

  • Must be called before any API requests are made
  • Recommended to call in your CLI's bootstrap/entry point
  • Thread-safe: sets a module-level variable
  • No return value

Changelog

1.6.13

  • Changed: Published via OIDC trusted publishing (GitHub Actions)
  • Changed: License updated to Public Code License (PCL)
  • Added: Copyright headers to all source files

1.6.10

  • Added: setUserAgent(value: string) - Allows consumers to customize the User-Agent header
  • Fixed: Security vulnerabilities in uuid (8.3.2 -> 11.1.1) and nyc (15.1.0 -> 18.0.0)

1.6.9

  • Previous stable release

Related Docs and Repositories

License

This software is licensed under the Public Code License. See LICENSE.txt for details.

Issues

Please report any issues at: https://github.com/mulesoft-emu/anypoint-cli-core-library/issues