files

Public

Forked from levpro/files

LM Studio Файловые инструменты Плагин Плагин LM Studio, который обеспечивает комплексные операции файловой системы в качестве инструментов ИИ для LLM.

66 Downloads

README

LM Studio File Tools Plugin

A LM Studio plugin that provides comprehensive file system operations as AI tools for LLMs.

Overview

This plugin enables large language models in LM Studio to perform file and directory operations through a set of safe, controlled tools. It bridges the gap between AI assistants and the file system while maintaining security through path traversal protection.

Features

  • 11 File System Tools - Full CRUD operations plus advanced features
  • Path Traversal Protection - All operations are restricted to the working directory
  • Large File Protection - Files over 50KB are blocked to prevent memory issues
  • Recursive Operations - Support for copying, deleting, and permission changes on directories
  • Cross-Platform - Works on Windows with proper path normalization

Available Tools

ToolDescription
Read FileReads text file content (max 50KB)
List DirectoryLists files and subdirectories
Create DirectoryCreates a new directory (with parents)
Create FileCreates a new file with optional content
Write FileOverwrites entire file content
Edit File LinesEdits specific line range (replace or insert mode)
Delete FilePermanently deletes a file
Delete DirectoryDeletes directory and all contents
CopyCopies file or directory (recursive)
MoveMoves or renames file/directory
Change PermissionsChanges file/directory mode (recursive option)

Installation

# Install dependencies
npm install

Development Mode

During development, use the LM Studio CLI to run the plugin in development mode:

npm run dev
# or directly:
lms dev

This command runs lms dev which:

  • Compiles TypeScript to JavaScript
  • Starts the plugin in LM Studio's development mode
  • Enables hot-reloading for quick iteration
  • Allows testing the plugin directly within LM Studio

Publishing to LM Studio Hub

When ready to share your plugin, push it to the LM Studio Hub:

npm run push
# or directly:
lms push

This command runs lms push which:

  • Builds the plugin for production
  • Publishes the plugin to the LM Studio registry
  • Makes it available for other users to install

Note: Before pushing, ensure your manifest.json has correct owner and name values configured.

Requirements

  • Node.js
  • LM Studio
  • npm or yarn

Configuration

The plugin uses LM Studio's working directory as the root for all file operations. This ensures AI assistants can only access files within the designated workspace.

Security Features

  • Working Directory Restriction: All paths are resolved relative to the configured working directory
  • Path Traversal Blocking: Attempts to access files outside the working directory are denied
  • File Size Limit: Files larger than 50KB cannot be read to prevent memory issues

Project Structure

├── src/
│   ├── index.ts       # Plugin entry point
│   ├── config.ts      # Plugin configuration
│   └── toolsProvider.ts # File system tools implementation
├── manifest.json      # Plugin manifest
├── package.json       # NPM package configuration
└── tsconfig.json     # TypeScript configuration

License

MIT

Author

Egor Levin