Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a0ed0eaaf0 | |||
| 9a76ce2c1f | |||
| 106ef676e2 | |||
| 8c49339452 | |||
| 8a113a9bbe | |||
| c305d5cf49 | |||
| 2c9f33868e | |||
| d4f1a1c6a4 |
109
README.md
109
README.md
@@ -28,6 +28,14 @@ oAI is a feature-rich command-line chat application that provides an interactive
|
|||||||
- Supports code files, text, JSON, YAML, and more
|
- Supports code files, text, JSON, YAML, and more
|
||||||
- Large file handling (auto-truncates >50KB)
|
- Large file handling (auto-truncates >50KB)
|
||||||
|
|
||||||
|
- ✍️ **Write Mode** (NEW!): AI can modify files with your permission
|
||||||
|
- Create and edit files within allowed folders
|
||||||
|
- Delete files (always requires confirmation)
|
||||||
|
- Move, copy, and organize files
|
||||||
|
- Create directories
|
||||||
|
- Ignores .gitignore for write operations
|
||||||
|
- OFF by default - explicit opt-in required
|
||||||
|
|
||||||
- 🗄️ **Database Mode**: AI can query your SQLite databases
|
- 🗄️ **Database Mode**: AI can query your SQLite databases
|
||||||
- Read-only access (no data modification possible)
|
- Read-only access (no data modification possible)
|
||||||
- Schema inspection (tables, columns, indexes)
|
- Schema inspection (tables, columns, indexes)
|
||||||
@@ -39,6 +47,8 @@ oAI is a feature-rich command-line chat application that provides an interactive
|
|||||||
- 🔒 **Security Features**:
|
- 🔒 **Security Features**:
|
||||||
- Explicit folder/database approval required
|
- Explicit folder/database approval required
|
||||||
- System directory blocking
|
- System directory blocking
|
||||||
|
- Write mode OFF by default (non-persistent)
|
||||||
|
- Delete operations always require user confirmation
|
||||||
- Read-only database access
|
- Read-only database access
|
||||||
- SQL injection protection
|
- SQL injection protection
|
||||||
- Query timeout (5 seconds)
|
- Query timeout (5 seconds)
|
||||||
@@ -101,24 +111,10 @@ Download platform-specific binaries:
|
|||||||
# Extract and install
|
# Extract and install
|
||||||
unzip oai_vx.x.x_mac_arm64.zip # or `oai_vx.x.x-linux-x86_64.zip`
|
unzip oai_vx.x.x_mac_arm64.zip # or `oai_vx.x.x-linux-x86_64.zip`
|
||||||
chmod +x oai
|
chmod +x oai
|
||||||
mkdir -p ~/.local/bin
|
mkdir -p ~/.local/bin # Remember to add this to your path. Or just move to folder already in your $PATH
|
||||||
mv oai ~/.local/bin/
|
mv oai ~/.local/bin/
|
||||||
```
|
```
|
||||||
|
|
||||||
### Option 3: Build Your Own Binary
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Install build dependencies
|
|
||||||
pip install -r requirements.txt
|
|
||||||
pip install nuitka ordered-set zstandard
|
|
||||||
|
|
||||||
# Run build script
|
|
||||||
chmod +x build.sh
|
|
||||||
./build.sh
|
|
||||||
|
|
||||||
# Binary will be in dist/oai
|
|
||||||
cp dist/oai ~/.local/bin/
|
|
||||||
```
|
|
||||||
|
|
||||||
### Alternative: Shell Alias
|
### Alternative: Shell Alias
|
||||||
|
|
||||||
@@ -147,13 +143,18 @@ oai
|
|||||||
You> /model
|
You> /model
|
||||||
|
|
||||||
# Enable MCP for file access
|
# Enable MCP for file access
|
||||||
You> /mcp enable
|
You> /mcp on
|
||||||
You> /mcp add ~/Documents
|
You> /mcp add ~/Documents
|
||||||
|
|
||||||
# Ask AI to help with files
|
# Ask AI to help with files (read-only)
|
||||||
[🔧 MCP: Files] You> List all Python files in Documents
|
[🔧 MCP: Files] You> List all Python files in Documents
|
||||||
[🔧 MCP: Files] You> Read and explain main.py
|
[🔧 MCP: Files] You> Read and explain main.py
|
||||||
|
|
||||||
|
# Enable write mode to let AI modify files
|
||||||
|
You> /mcp write on
|
||||||
|
[🔧✍️ MCP: Files+Write] You> Create a new Python file with helper functions
|
||||||
|
[🔧✍️ MCP: Files+Write] You> Refactor main.py to use async/await
|
||||||
|
|
||||||
# Switch to database mode
|
# Switch to database mode
|
||||||
You> /mcp add db ~/myapp/data.db
|
You> /mcp add db ~/myapp/data.db
|
||||||
You> /mcp db 1
|
You> /mcp db 1
|
||||||
@@ -167,7 +168,7 @@ You> /mcp db 1
|
|||||||
|
|
||||||
**Setup:**
|
**Setup:**
|
||||||
```bash
|
```bash
|
||||||
/mcp enable # Start MCP server
|
/mcp on # Start MCP server
|
||||||
/mcp add ~/Projects # Grant access to folder
|
/mcp add ~/Projects # Grant access to folder
|
||||||
/mcp add ~/Documents # Add another folder
|
/mcp add ~/Documents # Add another folder
|
||||||
/mcp list # View all allowed folders
|
/mcp list # View all allowed folders
|
||||||
@@ -181,16 +182,26 @@ You> /mcp db 1
|
|||||||
"What's in my Documents folder?"
|
"What's in my Documents folder?"
|
||||||
```
|
```
|
||||||
|
|
||||||
**Available Tools:**
|
**Available Tools (Read-Only):**
|
||||||
- `read_file` - Read complete file contents
|
- `read_file` - Read complete file contents
|
||||||
- `list_directory` - List files/folders (recursive optional)
|
- `list_directory` - List files/folders (recursive optional)
|
||||||
- `search_files` - Search by name or content
|
- `search_files` - Search by name or content
|
||||||
|
|
||||||
|
**Available Tools (Write Mode - requires `/mcp write on`):**
|
||||||
|
- `write_file` - Create new files or overwrite existing ones
|
||||||
|
- `edit_file` - Find and replace text in existing files
|
||||||
|
- `delete_file` - Delete files (always requires confirmation)
|
||||||
|
- `create_directory` - Create directories
|
||||||
|
- `move_file` - Move or rename files
|
||||||
|
- `copy_file` - Copy files to new locations
|
||||||
|
|
||||||
**Features:**
|
**Features:**
|
||||||
- ✅ Automatic .gitignore filtering
|
- ✅ Automatic .gitignore filtering (read operations only)
|
||||||
- ✅ Skips virtual environments (venv, node_modules)
|
- ✅ Skips virtual environments (venv, node_modules)
|
||||||
- ✅ Handles large files (auto-truncates >50KB)
|
- ✅ Handles large files (auto-truncates >50KB)
|
||||||
- ✅ Cross-platform (macOS, Linux, Windows via WSL)
|
- ✅ Cross-platform (macOS, Linux, Windows via WSL)
|
||||||
|
- ✅ Write mode OFF by default for safety
|
||||||
|
- ✅ Delete operations require user confirmation with LLM's reason
|
||||||
|
|
||||||
### Database Mode
|
### Database Mode
|
||||||
|
|
||||||
@@ -224,13 +235,41 @@ You> /mcp db 1
|
|||||||
- ✅ WHERE, GROUP BY, HAVING, ORDER BY, LIMIT
|
- ✅ WHERE, GROUP BY, HAVING, ORDER BY, LIMIT
|
||||||
- ❌ INSERT/UPDATE/DELETE (blocked for safety)
|
- ❌ INSERT/UPDATE/DELETE (blocked for safety)
|
||||||
|
|
||||||
|
### Write Mode
|
||||||
|
|
||||||
|
**Enable Write Mode:**
|
||||||
|
```bash
|
||||||
|
/mcp write on # Enable write mode (shows warning, requires confirmation)
|
||||||
|
```
|
||||||
|
|
||||||
|
**Natural Language Usage:**
|
||||||
|
```
|
||||||
|
"Create a new Python file called utils.py with helper functions"
|
||||||
|
"Edit main.py and replace the old API endpoint with the new one"
|
||||||
|
"Delete the backup.old file" (will prompt for confirmation)
|
||||||
|
"Create a directory called tests"
|
||||||
|
"Move config.json to the config folder"
|
||||||
|
```
|
||||||
|
|
||||||
|
**Important:**
|
||||||
|
- ⚠️ Write mode is **OFF by default** and resets each session
|
||||||
|
- ⚠️ Delete operations **always** require user confirmation
|
||||||
|
- ⚠️ All operations are limited to allowed MCP folders
|
||||||
|
- ✅ Write operations ignore .gitignore (can write to any file in allowed folders)
|
||||||
|
|
||||||
|
**Disable Write Mode:**
|
||||||
|
```bash
|
||||||
|
/mcp write off # Disable write mode (back to read-only)
|
||||||
|
```
|
||||||
|
|
||||||
### Mode Management
|
### Mode Management
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
/mcp status # Show current mode, stats, folders/databases
|
/mcp status # Show current mode, write mode, stats, folders/databases
|
||||||
/mcp files # Switch to file mode
|
/mcp files # Switch to file mode
|
||||||
/mcp db <number> # Switch to database mode
|
/mcp db <number> # Switch to database mode
|
||||||
/mcp gitignore on # Enable .gitignore filtering (default)
|
/mcp gitignore on # Enable .gitignore filtering (default)
|
||||||
|
/mcp write on|off # Enable/disable write mode
|
||||||
/mcp remove 2 # Remove folder/database by number
|
/mcp remove 2 # Remove folder/database by number
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -252,9 +291,9 @@ You> /mcp db 1
|
|||||||
|
|
||||||
### MCP Commands
|
### MCP Commands
|
||||||
```
|
```
|
||||||
/mcp enable Start MCP server
|
/mcp on Start MCP server
|
||||||
/mcp disable Stop MCP server
|
/mcp off Stop MCP server
|
||||||
/mcp status Show comprehensive status
|
/mcp status Show comprehensive status (includes write mode)
|
||||||
/mcp add <folder> Add folder for file access
|
/mcp add <folder> Add folder for file access
|
||||||
/mcp add db <path> Add SQLite database
|
/mcp add db <path> Add SQLite database
|
||||||
/mcp list List all folders
|
/mcp list List all folders
|
||||||
@@ -263,6 +302,8 @@ You> /mcp db 1
|
|||||||
/mcp files Switch to file mode
|
/mcp files Switch to file mode
|
||||||
/mcp remove <num> Remove folder/database
|
/mcp remove <num> Remove folder/database
|
||||||
/mcp gitignore on Enable .gitignore filtering
|
/mcp gitignore on Enable .gitignore filtering
|
||||||
|
/mcp write on Enable write mode (create/edit/delete files)
|
||||||
|
/mcp write off Disable write mode (read-only)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Model Commands
|
### Model Commands
|
||||||
@@ -370,7 +411,11 @@ PDF (models with document support)
|
|||||||
- ✅ Database opened in `mode=ro`
|
- ✅ Database opened in `mode=ro`
|
||||||
|
|
||||||
### File System Safety
|
### File System Safety
|
||||||
- ✅ Read-only access (no write/delete)
|
- ✅ Read-only by default (write mode requires explicit opt-in)
|
||||||
|
- ✅ Write mode OFF by default each session (non-persistent)
|
||||||
|
- ✅ Delete operations always require user confirmation
|
||||||
|
- ✅ Write operations limited to allowed folders only
|
||||||
|
- ✅ System directories blocked
|
||||||
- ✅ Virtual environment exclusion
|
- ✅ Virtual environment exclusion
|
||||||
- ✅ Build artifact filtering
|
- ✅ Build artifact filtering
|
||||||
- ✅ Maximum file size (10 MB)
|
- ✅ Maximum file size (10 MB)
|
||||||
@@ -458,14 +503,19 @@ ls -la database.db
|
|||||||
|
|
||||||
## Version History
|
## Version History
|
||||||
|
|
||||||
### v2.1.0-beta (Current)
|
### v2.1.0-RC1 (Current)
|
||||||
- ✨ **NEW**: MCP (Model Context Protocol) integration
|
- ✨ **NEW**: MCP (Model Context Protocol) integration
|
||||||
- ✨ **NEW**: File system access (read, search, list)
|
- ✨ **NEW**: File system access (read, search, list)
|
||||||
|
- ✨ **NEW**: Write mode - AI can create, edit, and delete files
|
||||||
|
- 6 write tools: write_file, edit_file, delete_file, create_directory, move_file, copy_file
|
||||||
|
- OFF by default - requires explicit `/mcp write on` activation
|
||||||
|
- Delete operations always require user confirmation
|
||||||
|
- Non-persistent setting (resets each session)
|
||||||
- ✨ **NEW**: SQLite database querying (read-only)
|
- ✨ **NEW**: SQLite database querying (read-only)
|
||||||
- ✨ **NEW**: Dual mode support (Files & Database)
|
- ✨ **NEW**: Dual mode support (Files & Database)
|
||||||
- ✨ **NEW**: .gitignore filtering
|
- ✨ **NEW**: .gitignore filtering
|
||||||
- ✨ **NEW**: Binary data handling in databases
|
- ✨ **NEW**: Binary data handling in databases
|
||||||
- ✨ **NEW**: Mode indicators in prompt
|
- ✨ **NEW**: Mode indicators in prompt (shows ✍️ when write mode active)
|
||||||
- ✨ **NEW**: Comprehensive `/help mcp` guide
|
- ✨ **NEW**: Comprehensive `/help mcp` guide
|
||||||
- 🔧 Improved error handling for tool calls
|
- 🔧 Improved error handling for tool calls
|
||||||
- 🔧 Enhanced logging for MCP operations
|
- 🔧 Enhanced logging for MCP operations
|
||||||
@@ -508,6 +558,7 @@ Full license: https://opensource.org/licenses/MIT
|
|||||||
|
|
||||||
**Rune Olsen**
|
**Rune Olsen**
|
||||||
|
|
||||||
|
- Homepage: https://ai.fubar.pm/
|
||||||
- Blog: https://blog.rune.pm
|
- Blog: https://blog.rune.pm
|
||||||
- Project: https://iurl.no/oai
|
- Project: https://iurl.no/oai
|
||||||
|
|
||||||
@@ -527,3 +578,7 @@ Contributions welcome! Please:
|
|||||||
---
|
---
|
||||||
|
|
||||||
**Star ⭐ this project if you find it useful!**
|
**Star ⭐ this project if you find it useful!**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Did you really read all the way down here? WOW! You deserve a 🍾 🥂!
|
||||||
|
|||||||
Reference in New Issue
Block a user