About this project
craft (anacraft) is a command-line tool written in Rust that sets up Google Analytics 4 for a domain and reads the resulting metrics back as a terminal dashboard. Its visual language is Minecraft-themed: ore-textured bars, seven live panels, a realtime event feed and achievement toasts, with selectable palettes including osaka-jade (default), catppuccin, github, tokyo-night and catppuccin-latte. The command is craft; anacraft is installed alongside as an alias.
Install and basic use
- An install script is served from anacraft.dev and places the binary in /usr/local/bin when writable, otherwise ~/.local/bin, without sudo; INSTALL_DIR selects another location. Source builds use cargo install --git, and prebuilt binaries are published in the project's GitHub Releases.
- Running anacraft with no command opens the dashboard (dash is the default). With no saved property it works on synthetic data, so it can be tried before signing in.
- Quick start path: craft configure for a new domain, or craft login plus craft props and craft use to attach an existing property.
- One-shot reports print and exit: overview, pages, portals (traffic sources), realms (countries), live and demo, with --days and --theme options.
- Two global flags: --property selects a property other than the saved default; --theme overrides the palette for a single run.
Output formats for scripting
overview accepts --format json (a single labelled object with units, previous period, percentage change, daily user series and achievements) or --format slack (a Block Kit payload). Both print only the payload, so a weekly digest can be a single cron line piping into a webhook. Neither format requires a subscription.
Dashboard
Seven panels can each be toggled with keys 1 to 7 (or letter shortcuts), and the remaining panels reflow to fill the terminal: EVENTS, RIGHT NOW (live players and event feed), COUNTRIES (world map plot), TOP PAGES, VITALS (users, sessions, views, conversions, bounce rate, average session), TOP COUNTRIES and DAILY USERS. Other controls include tab to cycle properties, shift-D to forget the on-screen property locally, t to cycle and save a palette, r to force a refetch, help overlay and quit.
Alerts
craft watch compares the most recent complete day with the mean of preceding days and reports deviations past per-metric thresholds derived from the site's own history. It flags drops, spikes and "silence" (a count falling to zero against a non-zero baseline, as with a removed tag). Defaults differ per metric (for example 30 percent for users and sessions, 40 percent for conversions, 20 percent for bounce rate), thresholds and baseline length can be tuned per property in config, and a baseline under a configurable minimum never fires a count alert. Alerts carry the metric value, movement, baseline and a sparkline, and name a dominant channel only when it accounts for a large share of the move. State is kept in ~/.anacraft/watch.json keyed by day so the same day alerts once; exit codes are 0 for nothing fired, 2 for an alert and 1 for an error. Delivery options include --every for repeated checking and --webhook for POSTing; craft slack --install walks through Slack's own install screen and saves the incoming-webhook URL, using the narrowest scope that posts to the chosen channel.
MCP server for assistants
craft mcp exposes the reports over the Model Context Protocol, so Claude Desktop, Claude Code or other MCP clients can answer questions about a site. craft mcp --install writes (and --uninstall removes) a server entry in a client configuration; Claude Code uses claude mcp add. Tools include site_status, live_visitors, list_pages, list_events, list_referrers, list_traffic_sources, list_countries, list_properties, search_pages, search_events and configure_site. configure_site is described as the single writer, creating a property and web stream for an untracked domain and returning the tag; login and property selection remain human-only commands. Responses are structured JSON labelled with property id and covered date window, and identical reports are cached for about a minute to limit API quota use.
Configuration and credentials
Properties and their settings live in ~/.config/anacraft/config.toml (XDG_CONFIG_HOME is honoured), while the OAuth refresh token is deliberately kept out of that directory in ~/.anacraft/token.json. Multiple properties accumulate in the config and are cycled with tab, with the last one viewed on quit becoming active. Resolution order is --property, then ANACRAFT_PROPERTY_ID, then the saved active property. Other environment variables include ANACRAFT_WEBHOOK and, for using a personal Google Cloud OAuth client instead of the built-in one, ANACRAFT_OAUTH_CLIENT_ID and ANACRAFT_OAUTH_CLIENT_SECRET.
Requirements and project notes
A GA4 property, a truecolor terminal and, for source builds, Rust 1.74 or newer are listed as requirements. The repository is licensed under Apache License 2.0 and includes contribution guidance; cargo run -- dash --demo gives a working dashboard with no Google account, and a Claude Code skill is shipped under .claude/skills/anacraft/.
Commercial context
Several capabilities are tied to paid plans (referred to as Anacrafter and tiers above it, starting at 2.99 per month on the project's pricing page): craft configure, delivering watch alerts to Slack, and the MCP server. Demo modes for the dashboard, watch and the MCP server run without an account or subscription, and the JSON and Slack report formats for overview are stated to need no subscription. Where a plan or login is missing, the MCP server still starts and its tools report what is needed rather than exiting.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.