Skip to content

About

Your AI-powered digital finance assistant in the terminal.

Resources

Stars

74 stars

Watchers

0 watching

Forks

Repository files navigation

Minara CLI

Your AI-powered digital finance assistant — from the terminal.
Trade, swap, chat, and manage your portfolio without leaving the command line.

npm version License: MIT Node.js TypeScript


Features

  • AI Chat — Crypto-native AI for on-chain analysis, market research, and DeFi due diligence. Interactive REPL & single-shot queries with fast / quality / thinking modes
  • Wallet & Balance — Unified balance view, spot holdings with PnL, perps account overview, deposits, withdrawals, and credit card on-ramp via MoonPay
  • Chain-Abstracted Trading — Cross-chain swaps with automatic chain detection, perpetual futures, and limit orders. Accepts $TICKER, token name, or contract address
  • Multi-Wallet Perps — Manage multiple sub-wallets per account: create, rename, sweep, transfer USDC between wallets. All trading commands support --wallet targeting
  • AI Autopilot & Analysis — Multi-strategy AI trading per wallet with performance dashboard, strategy comparison table, and one-click config management. Plus on-demand long/short analysis with quick order
  • Market Discovery — Trending tokens & stocks, Fear & Greed Index, on-chain metrics, and search

Installation

npm install -g minara

Or run without installing:

npx minara --help

Requires Node.js >= 18

Quick Start

# Login (interactive — device code or email)
minara login

# Check your account
minara account

# Receive / deposit
minara receive

# Quick AI question
minara ask "What's the best DeFi yield right now?"

# Deep AI research
minara research "Analyze ETH outlook for next quarter"

# Swap tokens (chain auto-detected from token)
minara swap -t '$BONK' -s buy -a 100

# View trending tokens
minara discover trending

Commands

Auth & Account

Command Description
minara login Login via device code or email
minara logout Logout: revoke the session, then clear local credentials (--local clears them even if the server is unreachable)
minara account View your account info and wallet addresses
minara login                  # Interactive: device code (default) or email
minara login --device         # Device code (opens browser to verify)
minara login -e [email protected] # Email verification code

Wallet & Funds

Command Description
minara balance Combined USDC/USDT balance across spot and perps
minara assets Full overview: spot holdings + perps account
minara assets spot Spot wallet: portfolio value, cost, PnL, holdings
minara assets perps Perps account: equity, margin, positions
minara receive Deposit / receive to spot, perps, or buy with credit card
minara deposit Same as receive
minara deposit buy Buy crypto with credit card via MoonPay
minara withdraw Withdraw tokens to an external wallet
minara balance                    # Quick total: Spot + Perps available balance
minara assets                     # Full overview (spot + perps)
minara assets spot                # Spot wallet with PnL breakdown
minara assets perps               # Perps equity, margin, positions
minara receive                    # Interactive: Spot / Perps / Buy with credit card
minara receive spot               # Show spot wallet deposit addresses (EVM + Solana)
minara receive perps              # Perps: show Arbitrum deposit address, or transfer from Spot → Perps
minara deposit buy                # Buy crypto with credit card via MoonPay (opens browser)
minara withdraw -c solana -t '$SOL' -a 10 --to <address>
minara withdraw                   # Interactive mode (accepts ticker or address)

Spot Trading

Command Description
minara swap Swap tokens (chain auto-detected)
minara send Send / transfer tokens to another address
minara transfer Same as send
minara swap                        # Interactive: side → token → amount
minara swap -s buy -t '$BONK' -a 100              # Buy by ticker (chain auto-detected)
minara swap -s sell -t '$NVDAx' -a all             # Sell entire balance
minara swap --dry-run              # Simulate without executing
minara swap -s buy -t '$BONK' -a 100 --max-slippage 15   # Accept a quote with up to 15% slippage tolerance

# Send tokens
minara send -c solana -t '$SOL' -a 5 --to <address>       # Send SOL on Solana
minara send -c base -t '$USDC' -a 200 --to <address>      # Send USDC on Base
minara send -c ethereum -t '$ETH' -a 0.1 --to <addr>      # Send ETH on Ethereum
minara send                        # Interactive mode
minara transfer -c solana -t '$SOL' -a 5 --to <address>   # Same as send

send vs withdraw: send is an alias for transfer — both transfer tokens to another address. withdraw is a separate command that moves tokens from your Minara wallet to an external address (shows your current assets before prompting).

Chain abstraction: The chain is automatically detected from the token. If a token exists on multiple chains (e.g. USDC), you'll be prompted to pick one, sorted by gas cost (lowest first). Sell mode supports all to sell full balance, and caps amounts exceeding your balance.

Token input: All token fields (-t) accept a $TICKER (e.g. $BONK), a token name, or a contract address.

Perpetual Futures

Command Description
minara perps positions View all open positions with PnL
minara perps order Place an order (interactive builder)
minara perps close Close an open position at market price
minara perps cancel Cancel open orders (selectable list)
minara perps leverage Update leverage for a symbol
minara perps trades View trade history (Hyperliquid fills)
minara perps deposit Deposit USDC to perps (or use minara deposit perps)
minara perps withdraw Withdraw USDC from perps account
minara perps fund-records View fund deposit/withdrawal records
minara perps wallets List all sub-wallets with balances and autopilot info
minara perps create-wallet Create a new perps sub-wallet
minara perps rename-wallet Rename a sub-wallet
minara perps sweep Consolidate funds from sub-wallet to default
minara perps transfer Transfer USDC between sub-wallets
minara perps autopilot Manage AI autopilot strategies per wallet
minara perps ask AI long/short analysis with quick order
minara perps positions             # Positions per wallet with equity, margin, PnL
minara perps positions --wallet Bot-1  # Positions for a specific wallet only
minara perps order                 # Interactive: symbol → side → size → confirm
minara perps order --wallet Bot-1  # Place order on a specific wallet
minara perps close                 # Close a position: pick from list → market close
minara perps close --all           # Close all positions at once

Market orders: perps order -T market, perps close and the perps ask quick order are sent as immediate-or-cancel (IOC) limit orders, priced 1% beyond the mark price (or at --price if you pass one). They fill immediately or are cancelled. They never sit as a pending trigger. The old --tpsl flag is no longer accepted. After submitting, the CLI reads Hyperliquid's per-order result. It shows the filled size and average price, warns about partial fills, and exits with an error if the order was rejected (for example, no liquidity within 1%).

Order rules: prices and sizes follow Hyperliquid's tick and lot sizes:

  • a price has at most 5 significant figures and at most 6 − szDecimals decimals (whole-number prices are always allowed);
  • a size has at most szDecimals decimals;
  • a new order must be worth at least $10.

Orders that break these rules are refused before anything is sent, and an invalid --price gets the nearest valid price as a suggestion.

minara perps cancel                # Cancel an order: pick from open orders list
minara perps leverage              # Interactive: shows max leverage per asset
minara perps leverage -s ETH -l 5 --margin isolated  # Non-interactive (asks for confirmation)
minara perps trades                # Recent fills from Hyperliquid (default 7 days)
minara perps trades -d 30          # Last 30 days of trade history
minara perps deposit -a 100        # Deposit 100 USDC to perps
minara perps withdraw -a 50        # Withdraw 50 USDC from perps
minara perps wallets               # All wallets: equity, margin, PnL, strategies
minara perps create-wallet -n Bot-2  # Create a new sub-wallet
minara perps sweep                 # Move funds from a sub-wallet to default
minara perps transfer              # Transfer USDC between any two wallets
minara perps autopilot             # Strategy dashboard: enable/disable, config, perf
minara perps ask                   # AI analysis → optional quick order

Multi-wallet support: All trading commands (order, deposit, withdraw, close, cancel, leverage, trades, fund-records, ask) accept --wallet <name> to target a specific sub-wallet. If omitted, you'll be prompted to pick one interactively.

Autopilot dashboard: Each wallet can have multiple AI strategies. The dashboard shows strategy name, status, config, and a performance comparison table across all available strategies with the active one highlighted.

Close position: Select an open position from the list, and it will be closed at market price with a reduce-only order in the opposite direction — no manual price or size entry needed.

Cancel order: Open orders are fetched from Hyperliquid and shown as a selectable list with coin, side, size, and price — no need to look up order IDs.

Autopilot: When autopilot is ON for a wallet, manual order placement on that wallet is blocked to prevent conflicts with AI-managed trades. Turn off autopilot first via minara perps autopilot.

Ask AI → Quick Order: After the AI analysis, you can instantly place a market order in the recommended direction. The order is priced from the live market (not the AI's entry), its size is capped at your margin × leverage, it is disabled if the AI entry is more than 2% away from the current price, and it uses the wallet's current leverage setting (shown in the confirmation).

Limit Orders

Command Description
minara limit-order create Create a price-triggered limit order
minara limit-order list List all your limit orders
minara limit-order cancel <id> Cancel a specific order by ID
minara limit-order create          # Interactive: token, price, side, amount, expiry
minara limit-order list            # Show all orders with status
minara limit-order cancel abc123   # Cancel order by ID

AI Chat

Command Description
minara ask [message] Quick AI chat (fast mode)
minara research [message] Deep AI research (quality mode)
minara chat Enter interactive REPL (Python/Node.js-style)
minara chat [message] Send a single message and exit
minara chat --list List all your conversations
minara chat --history <chatId> View messages in a conversation
minara chat -c <chatId> Continue an existing conversation
# Quick questions (fast mode)
minara ask "What is the current BTC price?"
minara ask "Is SOL a good buy right now?"

# Deep research (quality mode)
minara research "Analyze ETH outlook for next quarter"
minara research "Compare Layer 2 rollup ecosystems"

# Full chat with all options
minara chat                                    # Enter interactive REPL mode
minara chat "What is the current BTC price?"   # Single question, streamed answer
minara chat --quality "Analyze ETH outlook"     # Quality mode (same as research)
minara chat --thinking "Analyze ETH outlook"   # Enable reasoning mode
minara chat -c <chatId>                        # Continue a specific chat in REPL
minara chat --list                             # List past conversations
minara chat --history <chatId>                 # Replay a specific conversation

ask vs research vs chat: ask is a shortcut for chat in fast mode — quick questions, real-time prices, brief answers. research is a shortcut for chat --quality — deeper analysis, longer responses, more thorough reasoning. chat gives you the full feature set including interactive REPL, conversation history, and all mode flags.

Interactive REPL mode — When launched without a message argument, the chat enters an interactive session:

Minara AI Chat session:a1b2c3d4
──────────────────────────────────────────────────
Type a message to chat. /help for commands, Ctrl+C to exit.

>>> What's the price of BTC?
Minara: Bitcoin is currently trading at $95,432...

>>> /help

  Commands:
  /new        Start a new conversation
  /continue   Continue an existing conversation
  /list       List all historical chats
  /id         Show current chat ID
  exit        Quit the chat

Market Discovery

Command Description
minara discover trending View currently trending tokens
minara discover search <keyword> Search for tokens or stocks by name
minara discover fear-greed View the crypto Fear & Greed Index
minara discover btc-metrics View Bitcoin on-chain and market metrics
minara discover trending           # Top trending tokens right now
minara discover search SOL         # Search for tokens matching "SOL"
minara discover fear-greed         # Current market sentiment index
minara discover btc-metrics        # Bitcoin hashrate, supply, dominance, etc.

Premium & Subscription

Command Description
minara premium plans View all subscription plans and credit packages
minara premium status View your current subscription status
minara premium subscribe Subscribe or change plan (upgrade / downgrade)
minara premium buy-credits Buy a one-time credit package
minara premium cancel Cancel your current subscription
minara premium plans              # Compare Free, Lite, Starter, Pro, Partner plans
minara premium status             # Check your current plan and billing info
minara premium subscribe          # Interactive: select plan → Stripe or Crypto payment
minara premium buy-credits        # Buy additional credits (one-time purchase)
minara premium cancel             # Cancel subscription (keeps access until period ends)

Output Format

By default, all commands display data using formatted tables, colored text, and human-friendly numbers (e.g. $1.23M, +3.46%). To get raw JSON output for scripting or piping, add the --json flag to any command:

minara discover trending --json    # Raw JSON array of trending tokens
minara discover btc-metrics --json # Full BTC metrics with OHLCV data
minara assets spot --json          # Raw JSON asset list

Configuration

Command Description
minara config View or update CLI settings (base URL, Touch ID, transaction confirm…)
minara config                     # Interactive settings menu

Available settings:

Setting Default Description
Base URL https://api.minara.ai API endpoint — must be https://*.minara.ai (localhost only with MINARA_DEV=1 set, for development)
Touch ID Off Biometric verification for fund operations (macOS)
Transaction Confirmation On Mandatory second confirmation before fund operations

Transaction Safety

All fund-related operations go through a multi-layer safety flow:

1. Transaction confirmation (on by default — configurable in minara config)
2. Touch ID verification   (optional — macOS only)
3. Execute

Covered operations include swaps, transfers / withdrawals, perps deposit / withdraw / order / close / sweep / transfer, leverage changes, and autopilot changes (turning a strategy ON, updating its symbols or config, creating a strategy).

The transaction confirmation shows chain, token, address, side, amount, and operation details before asking for final approval:

⚠ Transaction confirmation
  Chain    : solana
  Token    : $BONK — Bonk
  Address  : DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263
  Side     : BUY
  Amount   : 100 USD
  Action   : BUY swap · 100 USD · solana
? Are you sure you want to proceed? (y/N)

For swap, the expected output, fees, slippage and price impact are fetched and shown before this prompt, also with -y. The swap request cannot carry a minimum output, so the CLI refuses quotes whose slippage tolerance or price impact is above 10% (raise with --max-slippage / --max-price-impact). With -y it also refuses to swap when no quote can be fetched.

About -y / --yes: on swap, transfer, withdraw, deposit (Spot → Perps), limit-order create, limit-order cancel, perps order, perps close, perps cancel, perps sweep, perps transfer and perps leverage, -y skips the transaction confirmation for scripting. perps deposit, perps withdraw, the perps ask quick order and autopilot changes always show it. Touch ID, when enabled, is never skipped. If you disable transaction confirmation via minara config, every skipped prompt prints a warning.

Touch ID (macOS)

Minara CLI supports macOS Touch ID to protect all fund-related operations. When enabled, transfers, withdrawals, swaps, orders, and other financial actions require fingerprint verification before execution.

minara config                     # Select "Touch ID" to enable / disable

Protected operations: withdraw, send / transfer, swap, receive / deposit (Spot→Perps transfer), perps deposit, perps withdraw, perps order, perps close, perps cancel, perps sweep, perps transfer, perps leverage, perps autopilot (enable / update / create), limit-order create, limit-order cancel. Cancelling counts because an order may be the stop-loss or take-profit protecting a position. perps cancel warns when it is.

Note: Touch ID requires macOS with Touch ID hardware. The --yes flag does not bypass Touch ID. If Touch ID is enabled in your config but the current machine cannot use it (e.g. Linux), fund operations are cancelled instead of silently skipping the check. The same applies when ~/.minara/config.json is damaged (for example truncated): fund operations are refused until it is fixed or rewritten with minara config. Config and credential files are written atomically. While Touch ID is on, turning off Touch ID or transaction confirmation in minara config also requires Touch ID verification.

Supported Chains

Ethereum, Base, Arbitrum, Optimism, Polygon, Avalanche, Solana, BSC, Berachain, Blast, Manta, Mode, Sonic, and more.

Development

# Install dependencies
npm install

# Build
npm run build

# Watch mode
npm run dev

# Run locally
node dist/index.js --help

# Link globally for testing
npm link
minara --help

Testing

Test suite built with Vitest — 438 tests covering unit, API, command integration, and formatter layers.

npm test                # Run all tests
npm run test:watch      # Watch mode
npm run test:coverage   # With v8 coverage report

Security

  • Transaction Confirmation — Mandatory second confirmation before all fund operations, showing full token details and contract addresses (default: enabled, configurable)
  • Touch ID — Optional biometric protection for all fund operations (macOS only). A native Swift helper binary is compiled on first use and cached in ~/.minara/
  • Token Verification — Token ticker, name, and full contract address are always displayed before any transaction to prevent wrong-token mistakes. $TICKER lookups require an exact symbol match. When you have already chosen a chain (or passed --chain), only tokens on that chain are offered. If several tokens share a symbol, the picker shows each one's full contract address and market cap, lists the highest market cap first, and warns about same-chain lookalikes. Third-party token names are length-capped and stripped of control characters
  • Trusted API host only — requests (including the session token and email login codes) are only sent to https://*.minara.ai (localhost only when MINARA_DEV=1 is set); any other configured base URL is refused
  • Safe terminal output — every API response (including Hyperliquid market data) is stripped of terminal control sequences, C1 controls, bidi override characters and invisible characters (zero-width, soft hyphen, BOM, Unicode tags…) as it arrives. Chat output is cleaned the same way as it streams. Third-party metadata cannot rewrite or spoof confirmation screens
  • Native tokens per chain — the native-token placeholder 0x0…0 / 0xE…E always means the native coin of the selected chain. Lookup only offers it under that coin's symbol (for example $ETH on Base, never $POL on Base), and never on Solana
  • Recipient checks — withdraw / send addresses are validated for the chain. A Solana address must decode to a 32-byte key, and one that is not a wallet public key (off the ed25519 curve) gets a warning, because Solana addresses have no checksum
  • Re-login safety — after an expired session the CLI offers to sign in again. Only read-only requests are then retried automatically, and only when the new session provably belongs to the same account. A trade, transfer, order or account change is never re-sent: run the command again to review and confirm it with current prices
  • Credentials are stored in ~/.minara/credentials.json with 0600 file permissions (re-applied on every write)
  • The ~/.minara/ directory is kept at 0700 permissions
  • Tokens are never logged or printed to the console
  • Pinned dependencies — the package ships an npm-shrinkwrap.json, so npm i -g minara installs exactly the dependency versions that were tested
  • Release provenance — releases are published from GitHub Actions with npm provenance, so you can check which commit and workflow built a version (npm audit signatures)
  • Non-TTY environments (CI/pipes) skip interactive prompts and return errors directly

Limits of client-side protection: transaction confirmation and Touch ID run inside the CLI on your machine. A process that already runs as your user (including an AI agent with shell access) can edit ~/.minara/config.json, replace files in ~/.minara/, or modify the installed CLI, so treat these checks as protection against mistakes and misleading prompts, not against code that already controls your account on this machine. Only give agents the access they need, and prefer running them in a sandbox.

License

MIT

About

Your AI-powered digital finance assistant in the terminal.

Resources

Stars

74 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages