CLI Installation
Learn how to install and set up the Spark-ID command-line interface.
Prerequisites
Before installing the CLI, ensure you have:
- Node.js version 16 or higher
- npm or pnpm package manager
- Git (optional, for development)
Check Your Environment
bash
# Check Node.js version
node --version
# Should be v16.0.0 or higher
# Check npm version
npm --version
# Should be 8.0.0 or higher
# Check pnpm version (if using pnpm)
pnpm --version
# Should be 7.0.0 or higherInstallation Methods
Method 1: Global Installation (Recommended)
Install the CLI globally to use it from anywhere:
bash
# Using npm
npm install -g @aexoo-ai/spark-id
# Using pnpm
pnpm add -g @aexoo-ai/spark-id
# Using yarn
yarn global add @aexoo-ai/spark-idVerify Installation:
bash
spark-id --version
# Should display the version number
spark-id --help
# Should display help informationMethod 2: Using npx (No Installation)
Use the CLI without installing it globally:
bash
# Generate a single ID
npx @aexoo-ai/spark-id
# Generate with prefix
npx @aexoo-ai/spark-id -p USER
# Get help
npx @aexoo-ai/spark-id --helpAdvantages:
- No global installation required
- Always uses the latest version
- No conflicts with other projects
Disadvantages:
- Slower startup time
- Requires internet connection
- Cannot use in offline scripts
Method 3: Local Installation
Install in a specific project:
bash
# Navigate to your project
cd your-project
# Install as a dependency
npm install @aexoo-ai/spark-id
# Use with npx
npx spark-id
# Or add to package.json scriptspackage.json example:
json
{
"scripts": {
"generate-user-id": "spark-id -p USER",
"generate-txn-id": "spark-id -p TXN",
"validate-id": "spark-id -v"
}
}Platform-Specific Instructions
Windows
Using npm
bash
# Open Command Prompt or PowerShell as Administrator
npm install -g @aexoo-ai/spark-id
# Verify installation
spark-id --versionUsing Chocolatey
bash
# Install Chocolatey first (if not installed)
# Then install Spark-ID
choco install spark-idUsing Scoop
bash
# Install Scoop first (if not installed)
# Then install Spark-ID
scoop install spark-idmacOS
Using npm
bash
# Install globally
npm install -g @aexoo-ai/spark-id
# Verify installation
spark-id --versionUsing Homebrew
bash
# Install Homebrew first (if not installed)
# Then install Spark-ID
brew install spark-idLinux
Using npm
bash
# Install globally
sudo npm install -g @aexoo-ai/spark-id
# Verify installation
spark-id --versionUsing Snap
bash
# Install using snap
sudo snap install spark-id
# Verify installation
spark-id --versionUsing AppImage
bash
# Download and make executable
chmod +x spark-id.AppImage
./spark-id.AppImage --versionDevelopment Installation
From Source
bash
# Clone the repository
git clone https://github.com/aexoo-ai/spark-id.git
cd spark-id
# Install dependencies
npm install
# Build the project
npm run build
# Link globally for development
npm link
# Verify installation
spark-id --versionUsing npm link
bash
# In the spark-id directory
npm link
# In your project directory
npm link @aexoo-ai/spark-idTroubleshooting
Permission Errors
Windows
bash
# Run Command Prompt as Administrator
# Then install globally
npm install -g @aexoo-ai/spark-idmacOS/Linux
bash
# Use sudo for global installation
sudo npm install -g @aexoo-ai/spark-id
# Or configure npm to use a different directory
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
npm install -g @aexoo-ai/spark-idCommand Not Found
bash
# Check if the binary is in your PATH
which spark-id
# Check npm global bin directory
npm config get prefix
# Add to PATH if needed
export PATH="$(npm config get prefix)/bin:$PATH"pnpm Workspace Issues
If you're using pnpm workspaces and the spark-id command is not found, try these solutions:
Solution 1: Use npx (Recommended)
bash
# Always works, downloads latest version
npx @aexoo-ai/spark-id -p USER -c 5Solution 2: Add to package.json scripts
json
{
"scripts": {
"spark-id": "spark-id",
"generate-user": "spark-id -p USER",
"generate-txn": "spark-id -p TXN -c 10"
}
}Then run:
bash
pnpm spark-id
pnpm generate-userSolution 3: Use direct binary path
bash
# From project root
./node_modules/.bin/spark-id -p USER
# Or with full path
node node_modules/@aexoo-ai/spark-id/dist/cli.cjs -p USERSolution 4: Install globally
bash
pnpm add -g @aexoo-ai/spark-id
spark-id -p USERVersion Conflicts
bash
# Check installed version
spark-id --version
# Update to latest version
npm update -g @aexoo-ai/spark-id
# Or reinstall
npm uninstall -g @aexoo-ai/spark-id
npm install -g @aexoo-ai/spark-idNetwork Issues
bash
# Use a different registry
npm config set registry https://registry.npmjs.org/
# Use a proxy if needed
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080Verification
Test Basic Functionality
bash
# Generate a simple ID
spark-id
# Should output: YBNDRFG8EJKMCPQXOT1UWISZA345H769
# Generate with prefix
spark-id -p USER
# Should output: USER_YBNDRFG8EJKMCPQXOT1UWISZA345H769
# Validate an ID
spark-id -v USER_YBNDRFG8EJKMCPQXOT1UWISZA345H769
# Should output: trueTest Advanced Features
bash
# Generate multiple IDs
spark-id -c 5
# Should output 5 different IDs
# Parse an ID
spark-id --parse USER_YBNDRFG8EJKMCPQXOT1UWISZA345H769
# Should output JSON with parsed components
# JSON output
spark-id -p USER -f json
# Should output JSON formatUninstallation
Remove Global Installation
bash
# Using npm
npm uninstall -g @aexoo-ai/spark-id
# Using pnpm
pnpm remove -g @aexoo-ai/spark-id
# Using yarn
yarn global remove @aexoo-ai/spark-idRemove Local Installation
bash
# Remove from project
npm uninstall @aexoo-ai/spark-id
# Or remove from package.json and run
npm installRemove Development Installation
bash
# Unlink global installation
npm unlink -g @aexoo-ai/spark-id
# Remove from project
npm unlink @aexoo-ai/spark-idRelated
- CLI Overview - Command-line interface overview
- Usage - How to use the CLI
- Options - All available options
- Getting Started - Library installation