shell-command-runner

Public

src / config.ts

import { createConfigSchematics } from "@lmstudio/sdk";

export const configSchematics = createConfigSchematics()
  .field(
    "operatingSystem",
    "select",
    {
      displayName: "Operating System",
      description: "Selects the command syntax hints for the AI.",
      options: [
        { displayName: "Windows (CMD Default)", value: "windows" },
        { displayName: "Linux / macOS", value: "linux" },
      ],
    },
    "windows"
  )
  .field(
    "homeDirectory",
    "string",
    {
      displayName: "Sandbox / Project Root",
      description: "The absolute path where commands are allowed to run.",
    },
    ""
  )
  .field(
    "executionPolicy",
    "select",
    {
      displayName: "Execution Policy",
      description: "Choose how to filter commands.",
      options: [
        { displayName: "Allow All (Block Forbidden)", value: "allow_all" },
        { displayName: "Allow Only (Strict Whitelist)", value: "allow_only" },
      ],
    },
    "allow_all"
  )
  .field(
    "allowedCommands",
    "string",
    {
      displayName: "Allowed Commands (Whitelist)",
      description: "Comma-separated list of allowed commands (e.g. 'cargo, git, dir'). Only used if Policy is 'Allow Only'.",
    },
    ""
  )
  .field(
    "forbiddenCommands",
    "string",
    {
      displayName: "Forbidden Commands (Blacklist)",
      description: "Comma-separated list of blocked commands (e.g. 'rm, format'). Applies in BOTH modes.",
    },
    ""
  )
  .field(
    "additionalSearchPaths",
    "string",
    {
      displayName: "Environment PATH Extensions",
      description: "Optional: Comma-separated list of folders to add to PATH if commands are not found.",
    },
    ""
  )
  .field(
    "defaultTimeout",
    "numeric",
    {
      displayName: "Timeout (ms)",
      description: "Max execution time.",
    },
    15000
  )
  .field(
    "allowAutoExecution", 
    "boolean",
    {
      displayName: "Allow Automatic Execution",
      description: "Check to allow commands to run without blocking.",
    },
    false
  )
  .build();