Skip to main content

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:
Parameters:
  • file-path - Path to the file (relative or absolute)
Features:
  • Syntax highlighting for code files
  • AI-powered content analysis
  • Large file handling with pagination
  • Binary file detection
  • Encoding detection and conversion
Examples:
Output Features:
  • 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:
Parameters:
  • file-path - Target file path
  • content - Content to write (use quotes for multi-line)
Features:
  • Automatic backup creation
  • Syntax validation
  • Format detection and formatting
  • Permission checking
  • Directory creation if needed
Examples:
Safety Features:
  • Automatic backup before overwriting
  • Confirmation for important files
  • Syntax validation before writing
  • Permission verification

/edit [file]

Interactive file editing with AI assistance. Syntax:
Parameters:
  • file-path - File to edit
  • instructions - Optional editing instructions
Features:
  • AI-powered editing suggestions
  • Syntax-aware modifications
  • Undo/redo capabilities
  • Real-time validation
  • Collaborative editing mode
Examples:
Interactive Features:
  • 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:
Parameters:
  • directory-path - Directory to list (default: current directory)
Features:
  • File type detection and icons
  • Size and date information
  • Permission display
  • Git status integration
  • Project structure analysis
Examples:
Output Format:

Search Commands

/search [pattern]

Search for files by name pattern with intelligent matching. Syntax:
Parameters:
  • pattern - Search pattern (supports wildcards and regex)
Features:
  • Fuzzy matching
  • Multiple search modes
  • File type filtering
  • Size and date filtering
  • Content preview
Search Modes:
  • name - Search by filename (default)
  • content - Search file contents
  • type - Search by file type
  • modified - Search by modification date
Examples:
Advanced Patterns:

/grep [pattern]

Search file contents with powerful pattern matching. Syntax:
Parameters:
  • pattern - Search pattern (regex supported)
  • files - Files to search (optional, defaults to all files)
Features:
  • Regular expression support
  • Context lines display
  • Case-sensitive/insensitive search
  • Multiple file search
  • Syntax highlighting in results
Examples:
Output Format:

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:
Permission denied:
Large file performance:

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