A sophisticated Language Server Protocol (LSP) implementation that transforms natural language into executable YAML workflows using Large Language Models (LLMs). This VS Code extension enables intelligent YAML authoring, validation, and execution with LLM-powered assistance.
- Natural Language to YAML: Convert plain English descriptions into structured YAML workflows
- Intelligent Script Refinement: Iteratively improve YAML scripts based on user feedback
- Multi-Step Execution: Execute workflows with context-aware step chaining
- Schema Generation: Automatically generate JSON schemas for your YAML workflows
- Variable Interpolation: Use
${variable}syntax with.vars.yamlfiles for dynamic content - File Includes: Modular YAML composition with secure file inclusion
- Real-Time Validation: Immediate diagnostics for syntax errors, undefined variables, and structure issues
- VS Code: Version 1.75.0 or higher
- Node.js: Version 16 or higher
- OpenRouter API Key: Required for LLM features
- Get your key from https://openrouter.ai/keys
- Set as environment variable:
OPENROUTER_KEY=your-api-key-here
-
Clone and Install
git clone https://github.com/CUNYTechPrep/languageservices cd languageservices npm install -
Set API Key
# Linux/macOS export OPENROUTER_KEY="your-api-key-here" # Windows PowerShell $env:OPENROUTER_KEY="your-api-key-here" # Or add to .bashrc/.zshrc for persistence echo 'export OPENROUTER_KEY="your-api-key-here"' >> ~/.bashrc
-
Build the Project
npm run compile
-
Launch Development
- Open the project in VS Code
- Press
F5to launch the Extension Development Host - Open a
.yamlfile to activate the extension
Write your requirements in plain text and generate a structured workflow:
- Create a new file with your requirements (e.g.,
prompt.yaml) - Write something like:
Create a workout routine generator that: 1. Takes user fitness level as input 2. Generates 5 exercises with reps and sets 3. Provides form tips for each exercise - Run command: LSP: Generate Yaml Script
- View the generated YAML workflow and schema in the diff viewer
Improve your YAML scripts with AI assistance:
- Open an existing YAML file
- Run command: LSP: Refine Yaml Script
- Enter your refinement instruction (e.g., "Add error handling" or "Include validation steps")
- Review the improved workflow in the diff viewer
Execute your workflow and see results:
- Open a YAML workflow file with
stepsarray - Run command: LSP: Test Yaml Script
- View execution results for each step in the interactive test results panel
Create dynamic YAML using variables:
-
Create
.vars.yamlin your workspace root:userName: John Doe apiEndpoint: https://api.example.com timeout: 5000
-
Use variables in your YAML:
steps: - name: FetchData url: ${apiEndpoint}/users timeout: ${timeout} user: ${userName}
-
Variables are resolved automatically during validation and execution
Organize workflows into reusable modules:
-
Create a shared configuration file (
config.yaml):retries: 3 timeout: 5000 logLevel: info
-
Include it in your workflow:
config: include: config.yaml # replaces with included file steps: - name: ProcessData
lsp/
├── client/ # VS Code Extension (Language Client)
│ ├── src/
│ │ ├── extension.ts # Extension entry point & commands
│ │ ├── WebviewProvider.ts # Diff viewer for YAML comparison
│ │ ├── TestResultsWebviewProvider.ts # Test results display
│ │ └── test/ # End-to-end integration tests
│ └── media/ # CSS & JS for webviews
│
├── server/ # Language Server
│ ├── src/
│ │ ├── server.ts # LSP server & request handlers
│ │ ├── constants.ts # Configuration constants
│ │ ├── types.ts # TypeScript type definitions
│ │ ├── errorHandler.ts # Structured error handling
│ │ ├── logger.ts # Circular logging for LLM calls
│ │ ├── include.ts # File inclusion with security
│ │ ├── YamlExecutor.ts # Workflow execution engine
│ │ │
│ │ ├── expressions/ # Variable resolution
│ │ │ ├── resolve.ts # Variable interpolation
│ │ │ └── utils.ts # Expression parsing utilities
│ │ │
│ │ ├── llm/ # LLM Integration
│ │ │ ├── OpenRouterClient.ts # OpenRouter API client
│ │ │ ├── YamlWorkflowBuilder.ts # YAML generation & refinement
│ │ │ └── utils.ts # Code block parsing
│ │ │
│ │ └── test/ # Unit tests
│ │ ├── expressions.test.ts
│ │ ├── include.test.ts
│ │ └── llm-utils.test.ts
│ │
├── package.json # Extension manifest & configuration
├── tsconfig.json # TypeScript configuration
└── README.md # This file
Run the comprehensive test suite:
# Run all tests
npm test
# Run client integration tests
npm run test:client
# Run server unit tests
npm run test:server
# Watch mode for development
npm run watchContributions are welcome! Areas for improvement:
- Additional LLM Providers: Support for OpenAI, Anthropic, Ollama, etc.
- Workflow Templates: Pre-built templates for common use cases
- Timeout Handling: Add request timeout configuration
- Dynamic Model Selection: Runtime model configuration
# Install dependencies
npm install
# Compile TypeScript
npm run compile
# Watch for changes
npm run watch
# Format code
npm run format
# Lint code
npm run lint
npm run lint:fix- Built on VS Code Language Server Extension Guide
- Powered by OpenRouter for LLM integration
Made with ❤️ for AI-powered development