CrewAI Lint
This is a VS Code extension that as an initial release provides that provides basic linting and validation for CrewAI YAML configuration files (agents.yaml
and tasks.yaml
).
PLEASE NOTE: This is a third-party created module and it not directly associated with or authorized by CrewAI.
I plan to expand it to cover code-first configuration, subject to feedback which is welcome via https://github.com/wsimmonds/crewai-lint/issues
Overview
CrewAI Lint helps developers working with CrewAI by providing real-time validation, error checking, and schema-based hover information for CrewAI configuration files.
Features
- Real-time Validation: Automatically validates your
agents.yaml
and tasks.yaml
files as you type
- Error Diagnostics: Provides detailed error messages for validation failures with proper line highlighting
- Schema-Aware Hover Information: Shows field descriptions and type information when hovering over YAML keys
- Auto-Detection: Automatically detects which CrewAI version you're using based on your project files - although only supporting 0.102.0 presently
Issues / Roadmap
The following are known issues/planned to be resolved. Feedback and contributions are always welcome.
- [ ] No validation of field values (i.e. checking to ensure specified agent is valid/present in crew)
- [ ] No support for anything but 0.102.0
- [ ] No support for Python validation
- [ ] No support for running as script/part of CI
- [ ] No icon!
- [ ] Need to re-visit a number of design choices and make it easier to accurately update/maintain schemas
Installation
This extension can be installed from the Visual Studio Code Marketplace.
- Open VS Code
- Go to Extensions view (Ctrl+Shift+X or Cmd+Shift+X)
- Search for "CrewAI Linter"
- Click Install
Alternatively, you can also install it using the VS Code CLI:
code --install-extension crewai-lint
Usage
Basic Usage
The extension automatically activates when you open YAML files named agents.yaml
or tasks.yaml
. No additional configuration is required.
Setting CrewAI Version
By default, the extension tries to automatically detect your CrewAI version from:
requirements.txt
pyproject.toml
poetry.lock
You can manually set the CrewAI version by:
- Opening the command palette (Ctrl+Shift+P or Cmd+Shift+P)
- Type "CrewAI: Set Version"
- Select the version you want to use from the dropdown
Hover over any field in your YAML files to see:
- Whether the field is required or optional
- Field description
- Expected type information
Field Validation
The extension validates:
- Required fields are present
- Field values have correct types
- YAML is properly formatted
Development
Prerequisites
Setup
- Clone the repository
git clone https://github.com/wsimmonds/crewai-lint.git
cd crewai-lint
- Install dependencies
pnpm install
- Open the project in VS Code
code .
Building and Running
To compile and run the extension in development mode:
pnpm compile
pnpm watch # For continuous compilation
Enjoy!
To launch the extension in a new VS Code window:
- Press F5 or select "Run and Debug" from the sidebar
- Choose "Extension" from the dropdown menu
Packaging
To build the extension into a distributable VSIX package:
pnpm run package
This will:
- Compile the extension
- Run the prepublish script
- Package all necessary files into a
.vsix
file located in the root directory
You can install the packaged extension by:
- In VS Code: File > Preferences > Extensions > ... (More Actions) > Install from VSIX
- Command line:
code --install-extension crewai-lint-0.102.0.vsix
Testing
Run tests with:
pnpm test
For development, you can use watch mode:
pnpm test:watch
Directory Structure
.
├── src/ # Source code
│ ├── extension.ts # Main extension entry point
│ ├── schemaManager.ts # Schema version management
│ ├── versionDetection.ts # CrewAI version detection
│ ├── utils/ # Utility functions
│ └── schemas/ # Schema definitions by version
├── test/ # Test setup files
└── out/ # Compiled output
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
)
- Commit your changes (
git commit -m 'Add some amazing feature'
)
- Push to the branch (
git push origin feature/amazing-feature
)
- Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- CrewAI for producing a brilliant AI Agent framework.
- João Moura for having personally explained many concepts to me.