ClaudeMods
☰
JA
● 0 人がオンライン ・閲覧 0 回
スポンサー作品を投稿
GitHub リポジトリ · 投稿者 ShriD5

phone-approve

Telegram から Claude Code の権限プロンプトを承認し、応答がない場合はターミナルのプロンプトに任せます。

ShriD5@ShriD5

ShriD5/claude-mods/tree/main/phone-approve

翻訳済み

この mod について

スマートフォンから Claude Code の権限プロンプトを承認できます。Claude Code がツールを実行してよいか尋ねようとすると、リクエストが Telegram に届き、✅ Approve と ❌ Deny のボタンが表示されます。タップで決定できるので、席を離れても長いタスクを進められます。

  • スマートフォンに届くのは本物のプロンプトだけです。ルール、モード、設定のフックですでに許可または拒否されたものは Telegram に届きません。
  • メッセージには、Bash コマンド、書き込みまたは編集対象のファイル、URL、その他のツールならその入力など、何が求められているかが表示されます。
  • タイムアウトまでにスマートフォンが応答しなければ、通常のターミナルプロンプトが決定し、そのことが Telegram メッセージにも示されます。
  • 先にターミナルで回答すると、プラグインは待機をやめ、メッセージを「answered in the terminal」に編集します。
  • 待機中は、ステータスラインに 📱 waiting for phone… と表示されます。

インストール

claude --plugin-dir ./phone-approve

または、このリポジトリを marketplace に追加して /plugin からインストールします。

セットアップ

  1. @BotFather にメッセージを送り、/newbot を送信して token をコピーします。専用 bot を使ってください。 プラグインは getUpdates でボタン操作を読み取ります。bot に webhook が設定されていると Telegram が拒否し、2 つのプログラムが同じ bot をポーリングすると互いの更新を奪います。

  2. 新しい bot に任意のメッセージを送り、https://api.telegram.org/bot<token>/getUpdates を開いて message.chat.id をコピーします。これが chat id です。

  3. 両方を保存します(token は settings.json ではなく secure storage に保存します)。

    echo '{"botToken":"123456:ABC…","chatId":"987654321"}' | claude plugin configure phone-approve --values-stdin
    

オプション

| オプション | デフォルト | 内容 | | --- | --- | --- | | botToken | (none) | bot の token。機密として扱われるため secure storage に保持され、ログには記録されません。 | | chatId | (none) | リクエストの送信先です。他の chat からのタップは無視されます。 | | timeoutSeconds | 120 | ターミナルプロンプトが決定するまでスマートフォンを待つ時間です。 |

botToken と chatId を設定するまでプラグインは何もしません。

仕組み

Claude Code が質問しようとすると発生させる classic.PermissionRequest にフックします。$.http.fetch でリクエストを送信し、リクエスト固有の一回限りの nonce を含むボタン操作を getUpdates でロングポーリングします。時間内に返ってこなければ next(e) を返し、ターミナルプロンプトに決定を委ねます。

インストール

まず作者の README で marketplace とプラグイン名を確認してください。コマンドはリポジトリの構成によって変わる場合があります。

claude plugin marketplace add ShriD5/claude-mods
claude plugin install phone-approve
原文 / README

phone-approve

Approve Claude Code's permission prompts from your phone. When Claude Code is about to ask you whether it may run a tool, the request goes to Telegram with ✅ Approve and ❌ Deny buttons, and your tap decides it. Walk away from the desk and keep a long task moving.

  • Only a real prompt goes to the phone. Anything your rules, mode or settings hooks already allow or deny never reaches Telegram.
  • The message says what is asked: the Bash command, the file being written or edited, the URL, or the tool's input for anything else.
  • If the phone doesn't answer within the timeout, the normal terminal prompt decides, and the Telegram message says so.
  • If you answer in the terminal first, the plugin stops waiting and edits the message to "answered in the terminal".
  • While it waits, the status line shows 📱 waiting for phone….

Install

claude --plugin-dir ./phone-approve

or add this repo as a marketplace and install it with /plugin.

Setup

  1. Message @BotFather, send /newbot, and copy the token. Use a dedicated bot. The plugin reads button presses with getUpdates, which Telegram refuses while a bot has a webhook set, and two programs polling one bot steal each other's updates.

  2. Send your new bot any message, then open https://api.telegram.org/bot<token>/getUpdates and copy message.chat.id. That's your chat id.

  3. Save both (the token goes to secure storage, not settings.json):

    echo '{"botToken":"123456:ABC…","chatId":"987654321"}' | claude plugin configure phone-approve --values-stdin
    

Options

| Option | Default | What it does | | --- | --- | --- | | botToken | (none) | The bot's token. Marked sensitive, so it's kept in secure storage and never logged. | | chatId | (none) | Where requests go. Presses from any other chat are ignored. | | timeoutSeconds | 120 | How long to wait for the phone before the terminal prompt decides. |

The plugin does nothing until botToken and chatId are set.

How it works

It hooks classic.PermissionRequest, which Claude Code raises when it is about to ask you. It sends the request with $.http.fetch, then long-polls getUpdates for the button press carrying that request's one-time nonce. If nothing comes back in time, it returns next(e) so the terminal prompt decides.

関連作品