refrakt write

Generates Markdown content files using AI. Supports Anthropic, Google Gemini, and Ollama as providers. The generated content uses refrakt.md runes — the AI is given the full rune reference as context.

Basic usage

refrakt write "Create a FAQ page about deployment"

Without an output flag, content is streamed to stdout.

Single file output

refrakt write -o docs/faq.md "Create a FAQ page about deployment"

Writes the generated content to the specified file.

Multi-file output

refrakt write -d content/ "Set up a docs site with index, guides, and blog"

When using -d, the AI generates multiple files with --- FILE: path --- markers. Each file is written to the specified directory. If the AI doesn't produce file markers, the output falls back to a single index.md.

Choosing a provider

refrakt write -p anthropic "Write a getting-started guide"
refrakt write -p gemini "Write a changelog page"
refrakt write -p ollama -m llama3.2 "Write a FAQ page"

Provider auto-detection

If you don't specify a provider, the CLI detects one from environment variables:

PriorityEnv VariableProvider
1ANTHROPIC_API_KEYAnthropic
2GOOGLE_API_KEYGemini Flash
3OLLAMA_HOSTOllama
4(none)Ollama at localhost:11434

Options

FlagShortDescription
--output <path>-oWrite output to a single file
--output-dir <dir>-dGenerate multiple files into a directory
--provider <name>-pProvider: anthropic, gemini, ollama
--model <name>-mModel name (default: per-provider)
note

--output and --output-dir are mutually exclusive. Use -o for a single page, -d when you want the AI to generate a multi-page structure.