New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

opencode-fast-apply

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

opencode-fast-apply

OpenCode plugin for Fast Apply - High-performance code editing with OpenAI-compatible APIs (LM Studio, Ollama)

latest
Source
npmnpm
Version
2.2.3
Version published
Maintainers
1
Created
Source

opencode-fast-apply

OpenCode plugin for Fast Apply - High-performance code editing with OpenAI-compatible APIs.

Features

  • Partial file editing - Only send relevant sections (50-500 lines), not entire files
  • Smart context matching - Automatically finds and replaces code sections
  • Token efficient - Save 80-98% tokens compared to full-file edits
  • Lazy edit markers - Use // ... existing code ... for unchanged sections
  • Multi-backend support - LM Studio, Ollama, OpenAI, any OpenAI-compatible endpoint
  • Robust XML handling - Safely handles special characters and XML tags in code

Installation

npm install -g opencode-fast-apply

Configure your API endpoint:

# LM Studio (default)
export FAST_APPLY_URL="http://localhost:1234"
export FAST_APPLY_MODEL="fastapply-1.5b"
export FAST_APPLY_API_KEY="optional-api-key"

# Ollama
export FAST_APPLY_URL="http://localhost:11434"
export FAST_APPLY_MODEL="codellama:7b"

# OpenAI
export FAST_APPLY_URL="https://api.openai.com"
export FAST_APPLY_MODEL="gpt-4"
export FAST_APPLY_API_KEY="sk-your-key"

Add to OpenCode config (~/.config/opencode/opencode.json):

{
  "plugin": ["opencode-fast-apply"]
}

Restart OpenCode. The fast_apply_edit tool is now available.

Usage

// 1. Read relevant section (not entire file)
const content = await read("src/app.ts", { offset: 100, limit: 50 })

// 2. Edit with partial context
fast_apply_edit({
  target_filepath: "src/app.ts",
  original_code: content,  // Just 50 lines!
  code_edit: `// ... existing code ...
function updated() {
  return "modified";
}
// ... existing code ...`
})

Key points:

  • Provide 50-500 lines of context around the area you want to change
  • Include 2-5 lines before/after the target section
  • Tool automatically finds and replaces that section in the full file
  • No need to send entire file (saves tokens and improves speed)

Configuration

VariableDefaultDescription
FAST_APPLY_API_KEYoptional-api-keyAPI key (optional for local)
FAST_APPLY_URLhttp://localhost:1234API endpoint
FAST_APPLY_MODELfastapply-1.5bModel name

How It Works

  • AI reads relevant file section (50-500 lines)
  • AI provides original_code (partial context) and code_edit
  • Tool sends to Fast Apply API for merging
  • Tool finds where original_code appears in full file
  • Tool replaces that section with merged code
  • Tool writes full file back and shows diff

Token Savings

File SizeBefore (Full)After (Partial)Savings
100 lines2,500 tokens500 tokens-80%
500 lines12,500 tokens1,000 tokens-92%
1000 lines25,000 tokens1,500 tokens-94%
5000 lines125,000 tokens2,000 tokens-98%

Troubleshooting

"Cannot locate original_code in file"

  • File was modified since you read it - re-read and try again
  • Whitespace differs - tool tries normalized matching automatically
  • Wrong section provided - verify you extracted the correct lines

API connection issues

curl -X POST http://localhost:1234/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model":"fastapply-1.5b","messages":[{"role":"user","content":"test"}]}'

License

MIT

Keywords

opencode

FAQs

Package last updated on 08 Jan 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts