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

btpet

v1.0.0

Published

CLI tool for Banho e Tosa Pet - Pet Shop Management System

Downloads

3

Readme

@banhoetosapet/cli

CLI tool for Banho e Tosa Pet - Pet Shop Management System

Installation

pnpm add -g @banhoetosapet/cli

Or run directly with npx:

npx @banhoetosapet/cli

Development

When developing locally:

# From the CLI directory
cd packages/cli
pnpm cli [command]

Quick Start

# Initialize a profile for development
btpet init --profile dev --dev

# Initialize a profile for production (default)
btpet init --profile prod

# Login
btpet auth login -e [email protected] -p yourpassword

# Switch between profiles
btpet auth use dev
btpet auth use prod

Debug Mode

Enable debug mode to see detailed information about API requests and responses:

# Basic debug mode - shows API logs and timing
btpet --debug auth me

# Verbose mode - shows everything including SQL queries
btpet --verbose auth me

# Environment variables (alternative)
BTPET_DEBUG=true btpet auth me
BTPET_VERBOSE=true btpet auth me

Debug information includes:

  • Application logs from the backend
  • SQL queries and their execution time
  • Request/response timing
  • Error details and stack traces

Commands

Authentication

# Login
btpet auth login -e [email protected] -p password

# Login with JSON data
btpet auth login --data '{"email":"[email protected]","password":"password"}'

# Login with specific organization (non-interactive)
btpet auth login -e [email protected] -p password --org-id org_123
btpet auth login --data '{"email":"[email protected]","password":"password","orgId":"org_123"}'

# Login with organization reference code
btpet auth login -e [email protected] -p password --ref PET-0147
btpet auth login --data '{"email":"[email protected]","password":"password","ref":"PET-0147"}'

# Login without saving to profile
btpet auth login -e [email protected] -p password --no-save

# Get token for scripts (never saves to profile)
btpet auth token -e [email protected] -p password
btpet auth token --data '{"email":"[email protected]","password":"password"}'

# Get token with organization
btpet auth token -e [email protected] -p password --org-id org_123
btpet auth token --data '{"email":"[email protected]","password":"password","orgId":"org_123"}'

# Get token with JSON output
btpet auth token -e [email protected] -p password --json
btpet auth token --data '{"email":"[email protected]","password":"password"}' --json

# List available organizations (table format)
btpet auth orgs list
btpet auth orgs list --json

# Show current organization details
btpet auth org
btpet auth org --json

# Logout
btpet auth logout
btpet auth logout --force  # Skip confirmation

# Show current user info
btpet auth me
btpet auth me --json        # JSON output
btpet auth me --all         # Show info for all profiles
btpet auth me --all --json  # All profiles in JSON

# Profile management
btpet auth profiles         # List all profiles in table format
btpet auth profiles --json  # JSON output
btpet auth use <profile>    # Switch active profile
btpet auth current          # Show current profile
btpet auth remove-profile <name> --force

# Switch organization (requires re-authentication)
btpet auth switch-org
btpet auth switch-org --id org_456  # Non-interactive

Configuration

# Initialize new profile
btpet init --profile <name>
btpet init --profile <name> --dev  # For localhost:3000
btpet init --profile <name> --url <custom-url>

# Show current configuration
btpet config show
btpet config show --json

# List all profiles
btpet config list
btpet config list --json

Multi-Tenant Support

The CLI fully supports multi-tenant authentication with master tokens:

  • Users without organizations: Receive a master token without organization context
  • Users with one organization: Automatically selected, receive organization-scoped token
  • Users with multiple organizations: Receive master token, then select organization

Login Flow

# Single organization - automatic selection
btpet auth login -e [email protected] -p password
# ✓ Login successful
# Organization: Pet Shop ABC (OWNER)

# Multiple organizations - interactive selection
btpet auth login -e [email protected] -p password
# ⚠ Multiple organizations found. Please select one:
# > Pet Shop ABC (OWNER)
#   Pet Shop XYZ (ADMIN)

# Direct organization selection (skip interactive)
btpet auth login -e [email protected] -p password --org-id org_123

Organization Management

# List user's organizations
btpet auth orgs list

# Show current organization details
btpet auth org
# Shows organization name, reference code, ID, role, etc.

# Switch between organizations (uses cached master token)
btpet auth switch-org
# > Select organization: [shows all available orgs]

# Switch directly to specific organization by ID
btpet auth switch-org --id org_456

# Switch using organization reference code (e.g., PET-0147)
btpet auth switch-org --ref PET-0147

Organization Reference Codes

Organizations now have human-readable reference codes for easier identification:

  • Format: ABC-1234 (3 letters + 4 digits with check digit)
  • Examples: STA-0005, PSD-0007, PET-0147
  • Use reference codes with --ref in commands that accept organization identifiers
# Login directly to organization using reference code
btpet auth login -e [email protected] -p password --ref STA-0005

# Get token for specific organization using reference
btpet auth token -e [email protected] -p password --ref PET-0147

# Switch organization using reference
btpet auth switch-org --ref PSD-0007

Token Types

The system uses two types of tokens:

  1. Master Token: Valid for 24h (or 30d with --remember-me), used to generate organization tokens
  2. Organization Token: Valid for 8h, contains organization context and permissions
# Get master token (for users with multiple orgs)
btpet auth token -e [email protected] -p password
# Returns: eyJ... (master token)

# Get organization-specific token
btpet auth token -e [email protected] -p password --org-id org_123
# Returns: eyJ... (organization token)

Special Cases

# Users without organizations
btpet auth switch-org
# ✗ You don't have access to any organizations.
# This user account is not associated with any organizations.

# Users with single organization
btpet auth switch-org
# Current organization: Pet Shop Demo (ADMIN)
# You only have access to one organization.

Profiles

The CLI supports multiple profiles for different environments and users:

# Initialize profiles
btpet init --profile dev --dev  # Uses http://localhost:3000
btpet init --profile prod       # Uses https://api.banhoetosa.pet
btpet init --profile custom --url https://api.custom.com

# Login to different profiles
btpet --profile dev auth login -e [email protected] -p password
btpet --profile prod auth login -e [email protected] -p password

# Use a specific profile for commands
btpet --profile production customers list

# Switch default profile
btpet auth use dev
btpet auth use prod

# List all profiles (shows in table format)
btpet auth profiles

# Remove a profile
btpet auth remove-profile old-profile --force

Environment Variables

  • BTPET_PROFILE: Set the active profile
  • BTPET_API_URL: Override the API URL
  • BTPET_TOKEN: Override the auth token

Examples

JSON Output Support

Most commands support the --json flag for machine-readable output:

# Authentication commands
btpet auth me --json
btpet auth profiles --json
btpet auth orgs list --json
btpet auth org --json

# Configuration commands
btpet config show --json
btpet config list --json

# Combined with other options
btpet auth me --all --json
btpet config show --profile prod --json

Clean JSON Output (Development)

When developing with pnpm, use the -s flag to suppress pnpm headers:

# Regular output (includes pnpm headers)
pnpm cli auth org --json

# Clean JSON output only
pnpm -s cli auth org --json

# Or use tsx directly
./node_modules/.bin/tsx src/index.ts auth org --json

Using --data for JSON Input

Many commands support the --data option to pass parameters as JSON instead of individual flags:

# Login with JSON data
btpet auth login --data '{"email":"[email protected]","password":"pass123"}'

# Complex login with multiple options
btpet auth login --data '{
  "email": "[email protected]",
  "password": "pass123",
  "orgId": "org_123",
  "rememberMe": true,
  "profile": "production"
}'

# Get token with organization reference
btpet auth token --data '{"email":"[email protected]","password":"pass123","ref":"PET-0147"}'

The --data option is particularly useful for:

  • Scripts and automation
  • Avoiding shell escaping issues
  • Passing data from other programs
  • Complex configurations

Non-Interactive Mode

The CLI is designed to be "non-interactive first" for easy scripting and automation:

Authentication for Scripts

# Get token for automation
TOKEN=$(btpet auth token -e $EMAIL -p $PASSWORD --org-id $ORG_ID)

# Use token directly
curl -H "Authorization: Bearer $TOKEN" https://api.example.com/data

# Or set environment variable
export BTPET_TOKEN=$TOKEN
btpet customers list

Skip Confirmations

# Force actions without prompts
btpet auth logout --force

Direct Organization Selection

# Login directly to specific org
btpet auth login -e [email protected] -p pass123 --org-id org_789

# Get token without saving state
btpet auth login -e [email protected] -p pass123 --org-id org_789 --no-save

JSON Output

# Get organizations in JSON
btpet auth orgs list --json

# Get token with metadata
btpet auth token -e [email protected] -p pass123 --org-id org_789 --json
# Output: {"token": "...", "organization": {"id": "...", "name": "...", "role": "..."}}

Example Script

#!/bin/bash
set -e

# Configuration
EMAIL="[email protected]"
PASSWORD="secure123"
ORG_ID="org_petshop"

# Get auth token
TOKEN=$(btpet auth token -e $EMAIL -p $PASSWORD --org-id $ORG_ID)
export BTPET_TOKEN=$TOKEN

# Use token in other scripts
curl -H "Authorization: Bearer $TOKEN" https://api.banhoetosa.pet/health

License

MIT