File Operations
NikCLI provides comprehensive file system operations for reading, writing, editing, and searching files. These commands integrate with AI capabilities for intelligent file management.Core File Commands
/read [file]
Read and display file contents with syntax highlighting and AI analysis.
Syntax:
file-path- Path to the file (relative or absolute)
- Syntax highlighting for code files
- AI-powered content analysis
- Large file handling with pagination
- Binary file detection
- Encoding detection and conversion
- Line numbers for code files
- File metadata (size, modified date, permissions)
- Content summary for large files
- Syntax errors detection
- Security issue highlighting
/write [file] [content]
Write content to a file with AI assistance and validation.
Syntax:
file-path- Target file pathcontent- Content to write (use quotes for multi-line)
- Automatic backup creation
- Syntax validation
- Format detection and formatting
- Permission checking
- Directory creation if needed
- Automatic backup before overwriting
- Confirmation for important files
- Syntax validation before writing
- Permission verification
/edit [file]
Interactive file editing with AI assistance.
Syntax:
file-path- File to editinstructions- Optional editing instructions
- AI-powered editing suggestions
- Syntax-aware modifications
- Undo/redo capabilities
- Real-time validation
- Collaborative editing mode
- Line-by-line editing mode
- AI suggestions for improvements
- Syntax error detection
- Code formatting
- Import/export management
/ls [path]
List directory contents with enhanced information.
Syntax:
directory-path- Directory to list (default: current directory)
- File type detection and icons
- Size and date information
- Permission display
- Git status integration
- Project structure analysis
Search Commands
/search [pattern]
Search for files by name pattern with intelligent matching.
Syntax:
pattern- Search pattern (supports wildcards and regex)
- Fuzzy matching
- Multiple search modes
- File type filtering
- Size and date filtering
- Content preview
name- Search by filename (default)content- Search file contentstype- Search by file typemodified- Search by modification date
/grep [pattern]
Search file contents with powerful pattern matching.
Syntax:
pattern- Search pattern (regex supported)files- Files to search (optional, defaults to all files)
- Regular expression support
- Context lines display
- Case-sensitive/insensitive search
- Multiple file search
- Syntax highlighting in results
Advanced File Operations
File Analysis
Automatic file analysis and insights:Batch Operations
Perform operations on multiple files:File Templates
Create files from templates:File System Integration
Git Integration
File operations integrate with Git status:Project Structure Analysis
Understand project organization:Workspace Context
File operations maintain workspace context:File Watching and Monitoring
Real-time File Monitoring
Monitor file changes in real-time:Change Notifications
Get notified of file system changes:Security and Permissions
File Permissions
Check and manage file permissions:Safe Operations
Protect important files:Performance Optimization
Large File Handling
Efficiently handle large files:Caching
File content caching for performance:Integration Examples
Development Workflow
Code Review Workflow
Documentation Workflow
Troubleshooting
Common Issues
File not found:Debug Commands
Best Practices
File Organization
- Use consistent naming conventions
- Organize files in logical directories
- Keep related files together
- Use descriptive file names
Content Management
- Write clear, well-documented code
- Use consistent formatting
- Include appropriate comments
- Maintain up-to-date documentation
Security
- Verify file permissions regularly
- Backup important files before editing
- Use version control for all changes
- Avoid storing sensitive data in plain text
Performance
- Use appropriate search patterns
- Cache frequently accessed files
- Monitor file system usage
- Clean up temporary files regularly