coder - A CLI tool for interacting with coderai API
Connects to OpenAI-compatible API and executes tools automatically.
"""
importos
importsys
importjson
importargparse
importsubprocess
frompathlibimportPath
fromtypingimportOptional,Dict,Any,List,Callable
fromdataclassesimportdataclass,field
importrequests
# Default system prompt for normal models
DEFAULT_SYSTEM_PROMPT="""You are Coder, an AI coding assistant. You help users write, read, and modify code files. You have access to tools for file operations.
## CRITICAL: Response Format
1. ALWAYS maintain proper spacing between words and after punctuation.
2. Use complete sentences with normal spacing.
3. When showing code, use proper code blocks with language identifiers.
## Available Tools
You can invoke tools by outputting JSON inside <tool> tags: