Skip to content

net-snix/RayWrite

Repository files navigation

RayWrite icon

RayWrite

Rewrite selected text from anywhere on macOS with one Raycast command.

Raycast Extension TypeScript License: MIT

What It Does

RayWrite is a Raycast extension for fast rewriting. Select text in any app, run Rewrite Selection, and RayWrite improves the structure, flow, coherence, and wording while preserving your meaning, tone, and formatting.

The default flow is intentionally simple:

select text -> run Raycast command -> rewritten text is pasted back

Use it when a paragraph is technically fine but reads a little clunky, scattered, or too rough around the edges.

Features

  • Rewrite selected text without opening a separate editor.
  • Paste the improved result over the current selection.
  • Copy the improved result instead, if preferred.
  • Use Raycast AI by default.
  • Optionally use an OpenAI-compatible /chat/completions endpoint.
  • Improve structure, flow, transitions, rhythm, and wording.
  • Preserve meaning, tone, line breaks, Markdown, and code fences.
  • Avoid adding new facts or turning your writing into generic AI phrasing.
  • Fail clearly when selected-text access is blocked by the active app.

Usage

  1. Select text in any macOS app.
  2. Open Raycast.
  3. Run Rewrite Selection.
  4. RayWrite replaces the selected text with the rewritten version.

Preferences

Preference Values Notes
AI Provider Raycast AI, OpenAI Compatible Raycast AI is the default.
Output Mode Paste Over Selection, Copy to Clipboard Paste is the fastest workflow.
OpenAI-Compatible Base URL URL Example: https://api.openai.com/v1 or http://127.0.0.1:8000/v1.
OpenAI-Compatible API Key secret Required only for the OpenAI-compatible provider.
OpenAI-Compatible Model model name Example: gpt-4.1-mini.

Development

npm install
npm run build
npm run lint
npm run dev

Manual Test

  1. Run npm run dev.

  2. Open TextEdit, Notes, Mail, or a browser text field.

  3. Type a rough paragraph, for example:

    this is the idea i want it clearer but dont change what i mean and maybe the order is weird
  4. Select the text.

  5. Run Rewrite Selection in Raycast.

  6. Confirm the selected text is replaced with rewritten text.

Project Layout

src/
  rewrite-selection.tsx
  lib/
    prompt.ts
    rewrite.ts
    selected-text.ts
    providers/
      raycast-ai.ts
      openai-compatible.ts

Notes

RayWrite uses Raycast's selected-text API. Some apps may block or fail selected-text access; when that happens, RayWrite shows a direct error instead of silently using clipboard contents.

Raycast Store metadata validation requires the author field to match a real Raycast Store username. Local development and GitHub usage do not require store validation.

License

MIT

About

Raycast extension for rewriting selected text with AI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors