A powerful terminal plugin for LM Studio with enhanced security, comprehensive system tools, and a unified toolset.
| Tool | Description |
|---|---|
shell_exec | Execute a shell command with sanitisation, retry, and configurable timeout |
run_process | Spawn a process with arguments (no shell interpreter) |
file_write | Write content to a file (creates directories automatically) |
read_file | Read file contents |
file_diff | Compare two files (unified diff format, pure JS LCS/Myers algorithm) |
file_checksum | Calculate SHA256 or MD5 checksum |
file_stats | Get file metadata (size, modified, permissions, type) |
list_directory | List directory contents with metadata |
create_directory | Create directories (recursive by default) |
delete_file | Delete a file or directory (auto-detects type) |
delete_directory | Delete a directory and contents |
system_info | Comprehensive system diagnostics (CPU, memory, uptime, load avg) |
list_processes | List running processes with PID, CPU%, memory, status |
kill_process | Terminate a process by PID (validated, no shell injection) |
check_network | DNS + TCP connectivity check with latency reporting |
get_network_info | Get network interface information |
get_disk_info | Get disk/volume information |
zip_create | Create a .zip archive (pure JS, no external deps) |
zip_extract | Extract a .zip archive (pure JS) |
zip_list | List contents of a .zip archive (pure JS) |
replace_text | Find and replace text within a file (regex support) |
count_text | Count occurrences of text or regex patterns in a file |
insert_text | Insert text at a specific line in a file |
delete_lines | Delete a range of lines from a file |
Total: 22 tools
Notes:
| Setting | Description | Default |
|---|---|---|
defaultShell | Default shell | powershell |
defaultTimeoutMs | Default command timeout | 30,000 ms |
maxOutputBytes | Maximum output size | 10 MB |
maxConcurrentExecutions | Max concurrent executions | 4 |
logLevel | Logging level | info |
maxRetries | Retry attempts on transient errors | 2 |
retryDelayMs | Delay between retries | 500 ms |
Config is stored at ~/.lmstudio-terminal/config.json.
The project includes 90 tests across 3 test files:
Run tests with:
Apache 2.0
A powerful terminal plugin for LM Studio with enhanced security, comprehensive system tools, and a unified toolset.
| Tool | Description |
|---|---|
shell_exec | Execute a shell command with sanitisation, retry, and configurable timeout |
run_process | Spawn a process with arguments (no shell interpreter) |
file_write | Write content to a file (creates directories automatically) |
read_file | Read file contents |
file_diff | Compare two files (unified diff format, pure JS LCS/Myers algorithm) |
file_checksum | Calculate SHA256 or MD5 checksum |
file_stats | Get file metadata (size, modified, permissions, type) |
list_directory | List directory contents with metadata |
create_directory | Create directories (recursive by default) |
delete_file | Delete a file or directory (auto-detects type) |
delete_directory | Delete a directory and contents |
system_info | Comprehensive system diagnostics (CPU, memory, uptime, load avg) |
list_processes | List running processes with PID, CPU%, memory, status |
kill_process | Terminate a process by PID (validated, no shell injection) |
check_network | DNS + TCP connectivity check with latency reporting |
get_network_info | Get network interface information |
get_disk_info | Get disk/volume information |
zip_create | Create a .zip archive (pure JS, no external deps) |
zip_extract | Extract a .zip archive (pure JS) |
zip_list | List contents of a .zip archive (pure JS) |
replace_text | Find and replace text within a file (regex support) |
count_text | Count occurrences of text or regex patterns in a file |
insert_text | Insert text at a specific line in a file |
delete_lines | Delete a range of lines from a file |
Total: 22 tools
Notes:
| Setting | Description | Default |
|---|---|---|
defaultShell | Default shell | powershell |
defaultTimeoutMs | Default command timeout | 30,000 ms |
maxOutputBytes | Maximum output size | 10 MB |
maxConcurrentExecutions | Max concurrent executions | 4 |
logLevel | Logging level | info |
maxRetries | Retry attempts on transient errors | 2 |
retryDelayMs | Delay between retries | 500 ms |
Config is stored at ~/.lmstudio-terminal/config.json.
The project includes 90 tests across 3 test files:
Run tests with:
Apache 2.0
lms ships at ~/.lmstudio/bin/lms.exe. It is not on PATH by default โ add it to your shell's PATH (git-bash: persist in ~/.bashrc; PowerShell: add to the User PATH, then reopen the window) for lms dev / npm run dev to resolve.npm run build compiles src/ โ dist/ (21 files). Run npm install first for a reproducible build... traversal and null byteszip_create validates entry names (no .., no absolute paths, no drive letters, max 65535 chars); zip_extract blocks traversal archive memberskill_process validates PID is a positive integer and uses runProcess with array args (no shell)check_network escapes single quotes in hostnamescd "C:\code for plugin LM Studio\terminal"
npm install
npm run build
# 1. Install once
npm install
# 2. Build (tsc โ dist/)
npm run build
# 3. lms dev (watch/restart dev server)
lms dev
npm test
terminal/
โโโ src/
โ โโโ index.ts # Plugin entry point
โ โโโ toolsProvider.ts # All tool definitions (22 tools)
โ โโโ platform.ts # detectPlatform, resolvePwshPath
โ โโโ shell.ts # resolveShell, buildExecInvocation, isCmdStyleCommand, isAbsolutePathCommand
โ โโโ executor.ts # Barrel re-exports from executor_impl
โ โโโ executor_impl.ts # execCommand, runProcess, execCommandStream, spawnProcess helper
โ โโโ fileUtilities.ts # Barrel re-exports from fileIO, zip, diff, checksum
โ โโโ fileIO.ts # readFile, writeFileSync, etc.
โ โโโ zip.ts # zipCreate, zipExtract, zipList, crc32
โ โโโ diff.ts # diffFiles, diffLcs, diffMyers
โ โโโ checksum.ts # fileChecksum
โ โโโ systemUtilities.ts # System info, processes, network, disks
โ โโโ securityEnhanced.ts # sanitizeFilePath, validateWritePath, sanitizeCommand
โ โโโ config.ts # TerminalConfig, loadConfig, saveConfig
โ โโโ constants.ts # EXEC_DEFAULT_TIMEOUT_MS, EXEC_MAX_TIMEOUT_MS
โ โโโ errors.ts # TerminalError, SecurityError, ValidationError, etc.
โ โโโ logger.ts # Pino-based logging
โ โโโ types.ts # Shared TypeScript types
โ โโโ runtimeResolver.ts # Runtime detection & resolution
โ โโโ tools/
โ โโโ shell_tools.ts # shell_exec, run_process
โ โโโ file_tools.ts # file_write, read_file, diff, checksum, stats, list, create/delete dir
โ โโโ system_tools.ts # system_info, list_processes, kill_process, check_network, get_network_info, get_disk_info
โ โโโ archive_tools.ts # zip_create, zip_extract, zip_list
โ โโโ text_tools.ts # replace_text, count_text, insert_text, delete_lines
โโโ package.json
โโโ tsconfig.json
โโโ manifest.json
โโโ .gitignore
lms ships at ~/.lmstudio/bin/lms.exe. It is not on PATH by default โ add it to your shell's PATH (git-bash: persist in ~/.bashrc; PowerShell: add to the User PATH, then reopen the window) for lms dev / npm run dev to resolve.npm run build compiles src/ โ dist/ (21 files). Run npm install first for a reproducible build... traversal and null byteszip_create validates entry names (no .., no absolute paths, no drive letters, max 65535 chars); zip_extract blocks traversal archive memberskill_process validates PID is a positive integer and uses runProcess with array args (no shell)check_network escapes single quotes in hostnamescd "C:\code for plugin LM Studio\terminal"
npm install
npm run build
# 1. Install once
npm install
# 2. Build (tsc โ dist/)
npm run build
# 3. lms dev (watch/restart dev server)
lms dev
npm test
terminal/
โโโ src/
โ โโโ index.ts # Plugin entry point
โ โโโ toolsProvider.ts # All tool definitions (22 tools)
โ โโโ platform.ts # detectPlatform, resolvePwshPath
โ โโโ shell.ts # resolveShell, buildExecInvocation, isCmdStyleCommand, isAbsolutePathCommand
โ โโโ executor.ts # Barrel re-exports from executor_impl
โ โโโ executor_impl.ts # execCommand, runProcess, execCommandStream, spawnProcess helper
โ โโโ fileUtilities.ts # Barrel re-exports from fileIO, zip, diff, checksum
โ โโโ fileIO.ts # readFile, writeFileSync, etc.
โ โโโ zip.ts # zipCreate, zipExtract, zipList, crc32
โ โโโ diff.ts # diffFiles, diffLcs, diffMyers
โ โโโ checksum.ts # fileChecksum
โ โโโ systemUtilities.ts # System info, processes, network, disks
โ โโโ securityEnhanced.ts # sanitizeFilePath, validateWritePath, sanitizeCommand
โ โโโ config.ts # TerminalConfig, loadConfig, saveConfig
โ โโโ constants.ts # EXEC_DEFAULT_TIMEOUT_MS, EXEC_MAX_TIMEOUT_MS
โ โโโ errors.ts # TerminalError, SecurityError, ValidationError, etc.
โ โโโ logger.ts # Pino-based logging
โ โโโ types.ts # Shared TypeScript types
โ โโโ runtimeResolver.ts # Runtime detection & resolution
โ โโโ tools/
โ โโโ shell_tools.ts # shell_exec, run_process
โ โโโ file_tools.ts # file_write, read_file, diff, checksum, stats, list, create/delete dir
โ โโโ system_tools.ts # system_info, list_processes, kill_process, check_network, get_network_info, get_disk_info
โ โโโ archive_tools.ts # zip_create, zip_extract, zip_list
โ โโโ text_tools.ts # replace_text, count_text, insert_text, delete_lines
โโโ package.json
โโโ tsconfig.json
โโโ manifest.json
โโโ .gitignore