{"_id":"@aynorica/tg-copilot","name":"@aynorica/tg-copilot","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@aynorica/tg-copilot","version":"0.1.0","description":"Zero-config Telegram bot exposing GitHub Copilot via long-polling — run anywhere with npx","author":{"name":"aynorica"},"type":"module","main":"dist/bin.js","bin":{"tg-copilot":"dist/bin.js"},"scripts":{"build":"tsc","postbuild":"chmod +x dist/bin.js","start":"node dist/bin.js","prepublishOnly":"npm run build"},"keywords":["telegram","copilot","bot","cli"],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/aynorica/copilot-telegram-interface.git"},"homepage":"https://github.com/aynorica/copilot-telegram-interface#readme","bugs":{"url":"https://github.com/aynorica/copilot-telegram-interface/issues"},"engines":{"node":">=20.0.0"},"dependencies":{"@github/copilot-sdk":"^0.3.0","@inquirer/prompts":"^8.4.2","dotenv":"^17.4.2","grammy":"^1.0.0"},"devDependencies":{"@types/node":"^20.0.0","typescript":"^5.0.0"},"gitHead":"52ac0bd511d43c728818152354f3e71d4a6c32f3","types":"./dist/bin.d.ts","_id":"@aynorica/tg-copilot@0.1.0","_nodeVersion":"25.6.0","_npmVersion":"11.8.0","dist":{"integrity":"sha512-+obCVdP+zm0F1+5/vqSKiRLr3J5TC9o251WcqSonHDQHqa8ewVSpc1ewwGxV81eAqYh4B3IHhRIm4mfUFNqvgQ==","shasum":"d66249a56e10c412503c49d2458efa2da2cbc473","tarball":"https://registry.npmjs.org/@aynorica/tg-copilot/-/tg-copilot-0.1.0.tgz","fileCount":48,"unpackedSize":131178,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDEacamY/N6Tn5ejF+MRxfs1RRKuMy6HtdXK62HG+ISWAIhAN/pgtC3uwsS7Nr7pwbrZGV4HEwo4KkROTTPHjEp2hC1"}]},"_npmUser":{"name":"aynorica","email":"Amirdeilamizadeh1996@gmail.com"},"directories":{},"maintainers":[{"name":"aynorica","email":"Amirdeilamizadeh1996@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/tg-copilot_0.1.0_1777320232250_0.3827527042312058"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-27T20:03:52.195Z","0.1.0":"2026-04-27T20:03:52.388Z","modified":"2026-04-27T20:03:52.612Z"},"maintainers":[{"name":"aynorica","email":"Amirdeilamizadeh1996@gmail.com"}],"description":"Zero-config Telegram bot exposing GitHub Copilot via long-polling — run anywhere with npx","homepage":"https://github.com/aynorica/copilot-telegram-interface#readme","keywords":["telegram","copilot","bot","cli"],"repository":{"type":"git","url":"git+https://github.com/aynorica/copilot-telegram-interface.git"},"author":{"name":"aynorica"},"bugs":{"url":"https://github.com/aynorica/copilot-telegram-interface/issues"},"license":"MIT","readme":"# tg-copilot\n\n> Use GitHub Copilot from Telegram — start in 30 seconds with npx.\n\n`tg-copilot` is a zero-config Node.js bot that bridges GitHub Copilot to Telegram. You talk to Copilot from your phone or any Telegram client — the bot streams responses in real-time, supports agentic tool use, vision inputs (photo messages), and session persistence. No server to manage; just run `npx` in your project directory.\n\n**What it looks like:** You open your Telegram bot, send a message like \"refactor this function to use async/await\", and watch the response appear word-by-word as Copilot generates it. Send a photo of a diagram with a caption and Copilot answers about the image. Switch models mid-conversation with a slash command. Walk away and get pinged when a long-running agent task finishes.\n\n---\n\n## Quick Start\n\n```bash\n# In any project directory:\nnpx @aynorica/tg-copilot\n```\n\nThen follow the interactive prompts for:\n\n1. **Telegram bot token** — get one from [@BotFather](https://t.me/BotFather)\n2. **Your Telegram user ID** — get it from [@userinfobot](https://t.me/userinfobot)\n3. **Working directory** — defaults to the current directory\n\nYour answers are saved to `.env` in the current directory. Subsequent `npx` runs start immediately without prompting.\n\n---\n\n## Prerequisites\n\n- **Node.js ≥ 20**\n- **GitHub Copilot CLI** installed and authenticated:\n  ```bash\n  gh extension install github/gh-copilot\n  gh auth login\n  ```\n- **A Telegram bot token** — create one via [@BotFather](https://t.me/BotFather)\n- **Your Telegram user ID** — get it from [@userinfobot](https://t.me/userinfobot)\n\n---\n\n## Configuration\n\nAll options can be set via environment variables or CLI flags. On first interactive run, the three required values are auto-saved to `.env`.\n\n| Environment Variable  | CLI Flag        | Description                              | Default            |\n|-----------------------|-----------------|------------------------------------------|--------------------|\n| `TG_BOT_TOKEN`        | `--bot-token`   | Telegram Bot API token                   | required           |\n| `TG_ALLOWED_USER_ID`  | `--allowed`     | Your numeric Telegram user ID            | required           |\n| `TG_MODEL`            | `--model`       | Default Copilot model                    | `gpt-4.1`          |\n| `TG_WORKING_DIR`      | `--cwd`         | Working directory for Copilot            | cwd at launch      |\n\n### MCP Servers\n\nAttach any HTTP MCP server with `--mcp-url` (repeatable):\n\n```bash\nnpx @aynorica/tg-copilot --mcp-url myserver=https://mcp.example.com/sse\n```\n\nEach `--mcp-url` value is `name=url`. All tools from each server are made available to Copilot.\n\n---\n\n## Slash Commands\n\n| Command               | Description                                                      |\n|-----------------------|------------------------------------------------------------------|\n| _(plain text)_        | Send a prompt to Copilot; response streams in real-time          |\n| _(photo + caption)_   | Vision prompt — the caption is used as the question              |\n| `/new`                | Discard the current session and start fresh                      |\n| `/clear`              | Clear the session and start fresh (alias for `/new`)             |\n| `/abort`              | Cancel an in-progress generation                                 |\n| `/compact`            | Summarize context into a system prompt seed, reset token usage   |\n| `/context`            | Show current token usage                                         |\n| `/model <name>`       | Switch the active Copilot model for this session                 |\n| `/models`             | List available model IDs                                         |\n| `/status`             | Show current session ID and token usage                          |\n| `/sessions`           | List all persisted sessions                                      |\n| `/switch <id>`        | Resume a specific session by ID                                  |\n| `/delete <id>`        | Delete a session from the store                                  |\n| `/agents`             | List available custom agents                                     |\n| `/agent <name>`       | Switch to a custom agent (or `/agent default` to reset)          |\n| `/review`             | Run the code review agent                                        |\n| `/plan`               | Create an implementation plan                                    |\n| `/diff`               | Review current git changes                                       |\n| `/research`           | Run a deep research investigation                                |\n\n---\n\n## Notifying Yourself from VS Code (or Any Agent)\n\nWhen `tg-copilot` starts in a project directory, it installs `.github/instructions/tg-copilot-notify.instructions.md`. This file tells GitHub Copilot agents in VS Code that they can push messages to your Telegram by running:\n\n```bash\nnpx @aynorica/tg-copilot notify \"<message>\"\n```\n\n**Use case:** \"Kick off this database migration and ping me when it's done.\" The `notify` subcommand exits in under a second — no bot server needs to be running.\n\nMessages support basic Telegram HTML:\n\n```\nnpx @aynorica/tg-copilot notify \"<b>Build complete</b> — 0 errors, 2 warnings.\"\n```\n\nSupported tags: `<b>`, `<i>`, `<code>`, `<pre>`, `<a href=\"...\">`. Messages over 4096 characters are automatically split.\n\n---\n\n## How It Works\n\n- **[grammY](https://grammy.dev/)** handles Telegram long-polling. Only your Telegram user ID can interact with the bot — all other senders are silently dropped by the AuthGuard middleware.\n- **`@github/copilot-sdk`** creates and resumes Copilot sessions with `approveAll`, enabling full agentic tool use (file reads, shell commands, etc.) without interactive confirmation prompts.\n- **Responses stream** via a 1500ms edit interval on a single Telegram message, auto-splitting into new messages at the 4096-character limit.\n- **Sessions persist** at `~/.copilot-tg/sessions.json` so your conversation history survives bot restarts.\n\n---\n\n## Session Persistence\n\nEach Telegram chat gets its own Copilot session. Sessions survive bot restarts — pick up exactly where you left off.\n\n- `/new` or `/clear` — start a fresh session\n- `/sessions` — list all stored sessions with a short summary\n- `/switch <id>` — hop to a specific session by ID\n- `/compact` — when a session grows large, compact it: Copilot summarises the history, the old session closes, and a new session opens with the summary injected into the system prompt, resetting token usage while preserving context\n\n---\n\n## License\n\nMIT © aynorica\n","readmeFilename":"README.md","_rev":"1-7d29f63d0e50d5b7df3e1ed22cd73ccc"}