Scripts

claude-code-usage-install

Instala o Claude Code Usage Dashboard, uma ferramenta open-source que monitora seu uso de tokens do Claude Code em tempo real. Mostra métricas por sessão, projeto e custos estimados. Instalação rápida: curl -fsSL https://ocodista.com/claude-code-usage-install.sh | bash

Como usar (Bash)

  1. 1.Baixe o script para a pasta do seu projeto (mesmo diretório do package.json)
  2. 2.Torne-o executável: chmod +x {scriptPath}
  3. 3.Execute: ./{scriptPath}
1#!/bin/bash
2# Claude Code Usage - Install Script
3# https://github.com/ocodista/claude-usage
4
5set -e
6
7# Colors
8BOLD='\033[1m'
9DIM='\033[2m'
10GREEN='\033[0;32m'
11CYAN='\033[0;36m'
12RED='\033[0;31m'
13NC='\033[0m'
14
15# App info
16APP_NAME="claude-code-usage"
17REPO="ocodista/claude-usage"
18INSTALL_DIR="/usr/local/bin"
19
20clear
21echo ""
22echo -e "${BOLD}  ┌─────────────────────────────────────┐${NC}"
23echo -e "${BOLD}  │                                     │${NC}"
24echo -e "${BOLD}  │  ${CYAN}Claude Code Usage${NC}${BOLD}                  │${NC}"
25echo -e "${BOLD}  │  ${DIM}Token Dashboard for Claude Code${NC}${BOLD}    │${NC}"
26echo -e "${BOLD}  │                                     │${NC}"
27echo -e "${BOLD}  └─────────────────────────────────────┘${NC}"
28echo ""
29
30# Detect OS and architecture
31OS=$(uname -s | tr '[:upper:]' '[:lower:]')
32ARCH=$(uname -m)
33
34case "$OS" in
35  darwin) OS_NAME="macOS" ;;
36  linux) OS_NAME="Linux" ;;
37  mingw*|msys*|cygwin*) OS="windows"; OS_NAME="Windows" ;;
38  *)
39    echo -e "  ${RED}✗${NC} Unsupported OS: $OS"
40    exit 1
41    ;;
42esac
43
44case "$ARCH" in
45  x86_64|amd64) ARCH="x64"; ARCH_NAME="x64" ;;
46  arm64|aarch64) ARCH="arm64"; ARCH_NAME="ARM64" ;;
47  *)
48    echo -e "  ${RED}✗${NC} Unsupported architecture: $ARCH"
49    exit 1
50    ;;
51esac
52
53echo -e "  ${DIM}Platform${NC}      ${OS_NAME} ${ARCH_NAME}"
54
55# Get latest release version
56VERSION=$(curl -s https://api.github.com/repos/${REPO}/releases/latest | grep '"tag_name"' | sed -E 's/.*"v([^"]+)".*/\1/')
57
58if [ -z "$VERSION" ]; then
59  echo -e "  ${RED}✗${NC} Could not fetch latest version"
60  exit 1
61fi
62
63echo -e "  ${DIM}Version${NC}       v${VERSION}"
64
65# Build binary name
66if [ "$OS" = "windows" ]; then
67  BINARY="${APP_NAME}-${OS}-${ARCH}.exe"
68else
69  BINARY="${APP_NAME}-${OS}-${ARCH}"
70fi
71
72DOWNLOAD_URL="https://github.com/${REPO}/releases/download/v${VERSION}/${BINARY}"
73
74# Download with progress
75echo -e "  ${DIM}Downloading${NC}   ${BINARY}"
76curl -fsSL "$DOWNLOAD_URL" -o /tmp/${APP_NAME}
77
78# Install
79echo -e "  ${DIM}Installing${NC}    ${INSTALL_DIR}/${APP_NAME}"
80
81if [ ! -w "$INSTALL_DIR" ]; then
82  sudo mv /tmp/${APP_NAME} "${INSTALL_DIR}/${APP_NAME}"
83  sudo chmod +x "${INSTALL_DIR}/${APP_NAME}"
84else
85  mv /tmp/${APP_NAME} "${INSTALL_DIR}/${APP_NAME}"
86  chmod +x "${INSTALL_DIR}/${APP_NAME}"
87fi
88
89echo ""
90echo -e "  ${GREEN}✓ Installed successfully${NC}"
91echo ""
92echo -e "  ${BOLD}To start:${NC}     ${CYAN}${APP_NAME}${NC}"
93echo -e "  ${BOLD}To uninstall:${NC} ${DIM}curl -fsSL raw.githubusercontent.com/${REPO}/main/uninstall.sh | bash${NC}"
94echo ""
95