4beginner.md

FOR New Plugin creators at LMS Hub

Useful Rules

If you start creating your own Plugin

It begins with

lms create

Then you see a scaffold menu 1/4; Select the one option; Enter name of your project; The lms will create an empty structure of plugin.

Created with LM Studio scaffold: node-typescript

Welcome to your new project! This scaffold is a starting point for building an AI-enabled Node.js project with LM Studio SDK. To interact with LM Studio, you should start the LM Studio local server with the command:

lms server start

OR just run the LM Studio. It works as server for CLI (like lms)

Getting Started. Project Structure After Creation

├── package.json          # Dependencies and scripts  
├── tsconfig.json         # TypeScript settings  
├── src/                  # Source code (TypeScript)  
│   ├── dev.js            # For development  
│   └── production.js     # For production  
├── dist/                 # Compiled JS (after build)  
├── .lmstudio/            # Special files for plugin  
│   └── dev.js / production.js  
└── README.md             # Plugin description  

Development

The source code resides in the src/ directory. For development purposes, you can run the project using:

npm start

Building for Production

Install LM Studio SDK globally

npm install -g @lmstudio/sdk

To prepare your project for production, compile the TypeScript code to JavaScript using:

npm run build

This will compile the TypeScript code in the src/ directory to JavaScript in the dist/ directory.

This code isn't required for the plugin to work within LM Studio. All that runs in it is the dev.js or production.js file. The rest is unnecessary for the plugin to work; it's simply waste when TS is converted to JS.

Development mode (.lmstudio/dev.js)

npm start # auto reload on changes

Production mode (.lmstudio/production.js)

lms get -i # requires manual reload through interface

When you compile a plugin yourself and install it using

lms dev --install -y

The file generated is .lmstudio/dev.js Without -i (--install) it is just compiled but not run into LM Studio. And if you installed the plugin from the website using

lms get username/plugin-name

it is compiled into a file named .lmstudio/production.js They work the same way. You can even just edit it and reload the plugin without running commands. That is, changing other people's plugins on the fly in your Lm Studio. You can copy/rename from dev.js to production.js it will work without install.

Push your Plugin to LMS Hub

Login first, and push then. This will upload your files to the site for others to see.

lms login
lms whoami
lms push

For normal loading, the project must have a correct manifest file.

Best Practices for Beginners

What to Do Before Publishing

  • Check code via npm run build
  • Verify README clarity
  • Format rules: The README file name is always in capital letters.
  • Ensure no secrets in code (APY keys)
  • Upload repo to Git (even if just git init)
  • Test on separate LM Studio instance
  • You can't link pictures from anywhere. Here accepted only HuggingFace as hosting. Even pics from your plugin files are NOT accepted. Markdown table do not require ```markdown mark. The table is drawn without it.