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

@goodit/telegram-sync-cli

v0.1.1

Published

Agent-friendly Telegram sync CLI with full API support

Readme

telegram-sync-cli

Agent-friendly Telegram Sync CLI with a local cache and full API access. Built on Bun + mtcute.

Features

  • 🧑‍💻 Multi-account management (tg accounts, --account)
  • 🔐 Authentication helpers (tg auth)
  • 🔄 Read-only daemon for real-time sync + CLI for mutations (tg daemon, tg send)
  • 🧩 Full Telegram API access via tg api
  • ⚡ Cache-first UX (stale-while-revalidate) with --fresh
  • ⏱️ Rate-limit tracking for safer API usage
  • 🔍 Full-text search (FTS5) over cached messages
  • 🗂️ Contacts, chats, and users browsing (tg contacts, tg chats, tg me, tg user)
  • 🗄️ Read-only SQL access to the cache (tg sql) with annotated schema output
  • 🧭 Config + status tooling (tg config, tg status)
  • 🤖 Agent-friendly JSON output + stable error schema
  • 🧠 Skill integration (tg skill manifest|validate|install)
  • 🧰 Modern stack: Bun runtime, TypeScript, mtcute

Documentation

Installation

# Install from npm/bun registry
bun install -g @goodit/telegram-sync-cli
# or
npm install -g @goodit/telegram-sync-cli

# Clone the repository
git clone <repo-url>
cd telegram-sync-cli

# Install dependencies
bun install

# Set up environment variables
cp .env.example .env
# Edit .env with your API credentials from https://my.telegram.org/apps

Note: the npm package does not include dist/tg. Global installs build a native binary during postinstall, so Bun must be available on the system.

Quick Start

# Login to your Telegram account (dev)
bun run src/index.ts auth login --phone +79261408252

# List your contacts
bun run src/index.ts contacts list

# Call any Telegram API method
bun run src/index.ts api account.checkUsername --username myuser
# Same commands when installed as a binary
# (see build/installation docs)
tg auth login --phone +79261408252
tg contacts list
tg api account.checkUsername --username myuser

Usage

tg <command> [options]

tg accounts list
tg contacts list --limit 50
tg chats list --limit 20
tg messages search --query "hello"
tg sql --query "SELECT * FROM users_cache LIMIT 10"
tg daemon start
tg status
tg config path

Global options: --format, --verbose, --quiet. Many commands also accept --account; cache-aware commands accept --fresh (see tg <command> --help).

Output Formats

# JSON (default)
tg contacts list

# Pretty output
tg contacts list --format pretty

# Quiet mode (exit code only)
tg contacts list --format quiet

Environment Variables

| Variable | Description | |----------|-------------| | TELEGRAM_API_ID | Your Telegram API ID | | TELEGRAM_API_HASH | Your Telegram API Hash | | TELEGRAM_SYNC_CLI_DATA_DIR | Override data directory | | MTCUTE_LOG_LEVEL | mtcute log level | | VERBOSE | Verbose logging (1) |

Development

# Type check
bun run typecheck

# Unit tests
bun run test

# E2E tests
bun run test:e2e

More in Testing and Build & distribution.