Use a logged-in LLM command-line tool from PopClip to rewrite selected text.
This extension lets you select text anywhere on macOS, click a PopClip action, and send the selection to one of these CLIs:
- Codex CLI
- Claude CLI
- Gemini CLI
- OpenCode CLI
- Ollama
It is useful when you already pay for or are logged into a CLI tool and do not want to manage separate API keys inside PopClip.
- Uses existing CLI login/session state.
- No API key field in PopClip.
- Can use local Ollama preset models when available.
- Includes a native macOS picker mode for choosing provider/preset at runtime.
- Supports modifier-key shortcuts for quick provider/preset changes without opening settings.
- Supports multiple rewrite presets:
Düzelt: minimal Turkish spelling/punctuation correction.Chat Kurumsal: clearer WhatsApp/Telegram work-message tone.Mail Kurumsal: professional client-facing email tone.Müşteri Tonu: warmer corporate client communication.Custom: your own prompt from PopClip settings.
- Replaces the selected text with the model output.
- Supports optional model override per provider.
- Install and log in to at least one supported CLI.
- Download or clone this repository.
- Double-click
LLM-CLI.popclipext. - Enable the extension in PopClip.
- Open the extension settings and choose your provider.
If macOS/PopClip warns that the extension is unsigned, inspect the source first. The extension is a plain shell script plus a JSON config.
The extension expects the CLI to be available on PATH.
Common paths are already included:
~/.npm-global/bin~/.local/bin/opt/homebrew/bin/usr/local/bin- system paths
Default provider is Ollama because it works locally and gives immediate feedback when the expected local models exist.
Default local model mapping:
Düzelt->turkce-duzeltChat Kurumsal->turkce-chat-kurumsalMail Kurumsal->turkce-mail-kurumsalMüşteri Tonu->turkce-mail-musteri-tonu
Set the Model field to override this mapping.
Default provider is Picker. It shows a small native AppKit panel near the click location each time the action runs. This is a workaround for PopClip's lack of extension-controlled submenus. Choose Ollama Local instead if you prefer one-click correction without a list.
The picker helper is source-only. On first use, the extension compiles picker-helper.swift into ~/Library/Caches/PopClipLLMCLI/. If Swift is unavailable or compilation fails, it falls back to macOS's standard centered choose from list dialog.
codex loginCodex works well for short non-interactive rewrite tasks. Choose it in the provider setting when you want a stronger cloud model.
claude
/loginThen choose Claude CLI in PopClip settings.
geminiThen complete the provider's login flow. Some Gemini CLI account tiers may not support the current CLI client.
opencode providersConfigure a provider, then choose OpenCode CLI in PopClip settings.
- Select text.
- Click the
LLM CLIPopClip action. - The selected text is replaced with the rewritten text.
Holding Shift with PopClip's paste-result behavior usually copies instead of pasting, depending on PopClip settings/version.
Hold a modifier while clicking the PopClip action to bypass the configured provider/preset:
- No modifier: configured provider/preset.
- Option: Ollama / Chat Kurumsal.
- Shift: Ollama / Mail Kurumsal.
- Control: Ollama / Müşteri Tonu.
- Command: Codex / Düzelt.
- Command + Option: Codex / Chat Kurumsal.
- Command + Shift: Codex / Mail Kurumsal.
- Command + Control: open Picker.
The action title also includes a compact shortcut reminder. Choose Help as the provider, or choose Shortcut Help inside Picker, to show a small macOS reminder dialog.
- This extension sends selected text to whichever third-party CLI/provider you choose.
- Do not use it on sensitive text unless you trust that provider and its account/data settings.
- CLIs can be slower than a local Ollama model. In testing, Codex was usable for short text, while OpenCode was slower.
- The output quality depends heavily on the provider, model, and prompt.
- Reasoning models are not automatically better for this workflow. For PopClip, the best model is usually the one that follows instructions and returns only clean final text.
See CONTEXT.md for project background, PopClip API constraints, known provider behavior, test cases, and suggested next improvements.
Test the script from Terminal:
env POPCLIP_OPTION_PROVIDER=codex POPCLIP_OPTION_PRESET=duzelt POPCLIP_OPTION_MODEL='' \
./LLM-CLI.popclipext/rewrite.zsh <<'EOF'
bu metni düzgün hale getirirmisin ama anlamı bozma
EOFCreate a distributable zip:
zip -r dist/LLM-CLI.popclipext.zip LLM-CLI.popclipextMIT