Mission: Solana
An intelligent, all-in-one Visual Studio Code extension for Solana smart contract development
Mission: Solana streamlines the entire Solana development lifecycle with advanced language support, automated workflows, and integrated AI-powered contract generation via Mission Squad.
✨ Features
🤖 AI Contract Generator
- Interactive Sidebar Interface: Generate complete Solana programs from natural language descriptions
- Streaming Generation: Real-time code generation with live preview
- Mission Squad Powered: Enterprise-grade AI specialized in Solana/Anchor development
- Quick Generation: Command palette shortcut for instant contract generation
- Save to Project: Direct integration with your workspace for seamless file creation
Mission: Solana provides a comprehensive sidebar with four specialized views:
- Quick Actions: One-click access to build, test, and deploy commands
- AI Contract Generator: Interactive AI-powered contract generation interface
- Configuration: Manage cluster settings, wallet configuration, and AI API keys
- Project Setup: Project directory selection, dependency management, and project creation wizard
🔄 Automated Build System
- Smart Build Detection: Automatically verifies build success by parsing output
- Artifact Parsing: Extracts program ID, binary path, and deployment cost
- Integrated Terminal: All operations visible in VS Code integrated terminal
- State Management: Tracks build and test status across sessions
🛠️ Solana Language Server
- Anchor-Aware Autocompletion: Intelligent code completion by parsing generated IDLs
- Context-Sensitive Suggestions: Understands
ctx.accounts.* patterns and provides relevant account completions
- Automatic IDL Indexing: Silently builds your project to generate and parse IDL files for enhanced IntelliSense
💬 AI Development Assistant
- Code Q&A: Ask questions about Solana development and get contextual answers
- Security Auditing: Analyze code for Solana-specific vulnerabilities
- Advanced Settings: Configure custom API endpoints and agent models
- Workspace Context: AI understands your project structure and active code
🛡️ Advanced Quality Assurance
- Dual-Linter System:
clippy for Rust best practices and common pitfalls
sec3 X-Ray for Solana-specific vulnerability detection
- On-Save Analysis: Automatic linting when you save Rust files
- Inline Diagnostics: Security issues and warnings displayed directly in your code
📦 Installation
Prerequisites
- Visual Studio Code 1.85.0 or higher
- Node.js 20.x or higher
- Rust and Cargo (for Solana development)
- Anchor CLI (for Anchor projects)
- Solana CLI (for deployment)
sec3 X-Ray (optional, for enhanced security analysis)
Install from VS Code Marketplace
- Open VS Code
- Go to Extensions (
Ctrl+Shift+X or Cmd+Shift+X)
- Search for "Mission: Solana"
- Click Install
Install from Source
- Clone this repository
- Run
npm install in the root directory
- Run
npm install in both client/ and server/ directories
- Run
npm run compile to build the extension
- Press F5 in VS Code to launch the extension in debug mode
🚀 Quick Start
- Click the Solana icon in the Activity Bar (left sidebar)
- You'll see four views: Quick Actions, AI Contract Generator, Configuration, and Project Setup
In the Project Setup view:
- Click "Select Existing Project" to choose your Solana project directory
- Or click "Create New Project" to start a new project with templates
- The extension will verify system dependencies (Rust, Solana CLI, Anchor)
In the Configuration view:
- Set Cluster: Choose your target network (Devnet, Testnet, Mainnet, Localhost)
- Configure Wallet: Browse, create, or import a Solana wallet keypair
- Configure AI: Set your Mission Squad API key for AI features
3. Generate Smart Contracts with AI
In the AI Contract Generator view:
- Enter a description of your smart contract
- Example: "Create a token staking program with reward distribution"
- Click "Generate Contract"
- Watch as the AI generates complete, production-ready code
- Click "Save to File" to add it to your project
Quick Generation from Command Palette:
- Run
Solana: Generate Contract (Quick)
- Enter your description and the AI Contract Generator will open
4. Build, Test, Deploy
In the Quick Actions view:
- Click Build Program to compile your Solana program
- The extension automatically detects success/failure
- Program ID and artifacts are extracted automatically
- Click Run Tests to execute your test suite
- Click Deploy Program to deploy to your configured cluster
- Includes safety checks for mainnet deployments
- Click Open Project in Terminal for manual commands
- Click View Build Artifacts to explore compiled binaries
5. Use AI Assistance
Ask AI Questions:
Command Palette → Solana: Ask AI
Example: "How do I create a PDA in Anchor?"
Audit Code for Security:
- Select code in your editor
- Run
Solana: Audit Code
- View security analysis in a new document
Configure Advanced AI Settings:
- In Configuration view, click "Advanced Settings" (appears after API key is configured)
- Customize API endpoint and agent model name
- Save settings for enterprise or custom deployments
📖 Usage Guide
Quick Actions View
Provides instant access to essential development commands:
- Build Program: Compiles using
anchor build with automated success detection
- Run Tests: Executes
anchor test with terminal output
- Deploy Program: Deploys to configured cluster with safety checks
- Open Project in Terminal: Opens terminal in project directory
- View Build Artifacts: Opens the
target/deploy directory
AI Contract Generator View
Interactive interface for AI-powered contract generation:
- Contract Description: Multi-line text area for detailed requirements
- Example Prompts: Built-in examples to guide your descriptions
- Streaming Generation: Real-time code generation with live updates
- Copy/Save: Export generated code to clipboard or file
- Configuration Status: Shows if Mission Squad API is configured
Configuration View
Centralized settings management with three sections:
Cluster Configuration:
- Current cluster display (Devnet/Testnet/Mainnet/Localhost/Custom)
- Change cluster with dropdown selection
- Custom RPC URL support
Wallet Configuration:
- Current wallet display with public key preview
- Browse for existing wallet files
- Create new wallet with automatic keypair generation
- Import wallet from mnemonic or private key
- Devnet airdrop support for new wallets
Mission Squad AI:
- API status indicator (configured/not configured)
- Configure API key via secure input
- Advanced settings for custom endpoints and models
Project Setup View
Project and dependency management:
Project Directory:
- Status indicator (configured/not set)
- Select existing Anchor project
- Create new project with template wizard:
- Basic Anchor Program
- Anchor Program with Tests
- Anchor Program with Frontend
- Multiple Programs Workspace
- Native Solana Program
System Dependencies:
- Rust & Cargo detection and installation
- Solana CLI detection and installation
- Anchor Framework detection and installation
- Node.js detection
- One-click installation helpers
Language Server Features
The Solana Language Server provides intelligent autocompletion for Anchor programs:
// Type 'ctx.accounts.' and get suggestions for all accounts in the instruction
pub fn initialize(ctx: Context<Initialize>) -> Result<()> {
ctx.accounts. // <-- Autocomplete shows: user, system_program, etc.
Ok(())
}
The server automatically:
- Detects
Anchor.toml in your workspace
- Runs
anchor build in the background on initialization
- Parses the generated IDL from
target/idl/
- Indexes all instructions and accounts for completion
AI Contract Generation
Best Practices for Prompts:
- Be specific about functionality requirements
- Mention account types and data structures needed
- Specify security requirements (e.g., "with signer verification")
- Include business logic details (e.g., "linear vesting over 30 days")
Example Prompts:
✅ Good: "Create a token staking program where users can stake SPL tokens
and earn rewards over time. Include functions for staking, unstaking,
and claiming rewards. Add admin functions to set reward rates."
❌ Too vague: "Make a staking program"
Generated Code Includes:
- Complete Anchor program structure
- Comprehensive error handling with custom error types
- Detailed comments explaining logic
- Security best practices (signer checks, ownership validation)
- Proper account validation and constraints
- Appropriate data types and account structures
Linting and Diagnostics
The extension automatically runs linters when you save Rust files:
Clippy (Rust best practices):
- Detects unused variables, unnecessary allocations, etc.
- Configurable via
clippy.toml in your project
sec3 X-Ray (Solana security):
- Detects Solana-specific vulnerabilities
- Runs if
x-ray is installed on your system
- Gracefully skips if not available
Diagnostics appear inline in your code with severity levels:
- 🔴 Error: Critical issues that must be fixed
- 🟡 Warning: Potential issues or improvements
- 🔵 Info: Suggestions and best practices
⚙️ Configuration
Workspace Settings
Per-project settings stored in VS Code workspace state:
solana.clusterUrl: RPC URL for the current cluster
solana.walletPath: Path to wallet keypair file
solana.programId: Last built program ID
solana.lastBuildSucceeded: Build status flag
solana.lastTestSucceeded: Test status flag
solana.projectDirectory: Configured project directory path
Global Settings
User-level settings stored in VS Code global state:
VS Code Settings
Configure in settings.json:
{
"solana.clusterUrl": "https://api.devnet.solana.com",
"solana.walletPath": "/path/to/your/wallet.json",
"solana.missionSquadApiUrl": "https://agents.missionsquad.ai/v1/chat/completions",
"solana.missionSquadAgentName": "mission-solana"
}
🏗️ Architecture
Mission: Solana uses a client-server architecture with integrated AI:
┌─────────────────────────────────────┐
│ VS Code Extension (Client) │
│ - Sidebar Views (4 TreeViews) │
│ - AI Contract Generator (Webview) │
│ - Commands (Build/Test/Deploy) │
│ - AI Provider (Mission Squad) │
└──────────────┬──────────────────────┘
│ LSP Protocol
┌──────────────▼──────────────────────┐
│ Language Server (Node.js) │
│ - IDL Parser & Indexer │
│ - Completion Provider │
│ - Clippy Analyzer │
│ - X-Ray Analyzer │
└─────────────────────────────────────┘
Client (/client):
- Extension activation and lifecycle management
- Sidebar views: Quick Actions, AI Contract Generator, Configuration, Project Setup
- Command implementations (build, test, deploy)
- Webview UI for AI Contract Generator
- Advanced AI Settings panel
- Mission Squad AI integration
Server (/server):
- Language Server Protocol implementation
- Anchor IDL parsing and indexing
- Code completion for Anchor contexts
- Dual-linter integration (Clippy + X-Ray)
🧪 Development
Build from Source
# Install dependencies
npm install
cd client && npm install && cd ..
cd server && npm install && cd ..
# Compile TypeScript and copy webview assets
npm run compile
# Watch mode (for development)
npm run watch
# Run linter
npm run lint
# Run tests
npm test
Debug the Extension
- Open the project in VS Code
- Press
F5 to launch Extension Development Host
- Set breakpoints in TypeScript files
- Test features in the development instance
Directory Structure
mission-solana/
├── .vscode/ # VS Code debug configuration
├── client/ # Extension client
│ └── src/
│ ├── ai/ # AI integration (Mission Squad)
│ ├── commands/ # Command implementations
│ ├── test/ # Extension tests
│ ├── ui/ # Sidebar views & webviews
│ │ ├── AdvancedAISettingsPanel.ts
│ │ ├── ConfigurationView.ts
│ │ ├── ContractGeneratorWebviewProvider.ts
│ │ ├── ContractGeneratorView.ts
│ │ ├── ProjectExplorerView.ts
│ │ ├── ProjectSetupView.ts
│ │ └── views/ # Webview HTML/CSS/JS
│ ├── utils/ # Utilities (wallet, project, shell)
│ └── extension.ts # Entry point
├── server/ # Language server
│ └── src/
│ ├── analyzer/ # Linter integrations
│ ├── completion/ # Autocompletion
│ └── server.ts # LSP server
├── package.json # Extension manifest
└── README.md # This file
🎨 Key Components
Webview Provider
- ContractGeneratorWebviewProvider: Sidebar-embedded webview for AI contract generation
- Static assets (JS/CSS) copied to
client/out/ui/views/ during build
- Two-way messaging between webview and extension for real-time interaction
TreeView Providers
- ProjectExplorerViewProvider: Quick Actions tree
- ConfigurationViewProvider: Settings management tree
- ProjectSetupViewProvider: Project and dependency tree
Command System
- Build Command: Automated build with output parsing for success detection
- Test Command: Test execution with terminal integration
- Deploy Command: Cluster-aware deployment with safety checks
- AI Commands: Generate, ask, and audit with Mission Squad integration
🤝 Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes with tests
- Run
npm run lint to ensure code quality
- Run
npm run compile to verify build
- Submit a pull request
📄 License
MIT License - see LICENSE file for details
🙏 Acknowledgments
- Mission Squad: For providing AI agent infrastructure and contract generation capabilities
- Anchor Framework: For the excellent Solana development framework
- sec3: For X-Ray static analysis tool
- Solana Foundation: For the Solana blockchain platform
🔗 Links
📝 Recent Updates (v0.3.3)
Refactoring & Improvements
- Fixed AI Contract Generator: Resolved webview provider issue causing "No data provider registered" error
- Improved Icon System: Replaced generic status icons with semantic action-specific icons
- Removed Legacy Components: Eliminated duplicate Lifecycle Panel and Contract Generator Panel
- Advanced AI Settings: New panel for configuring custom API endpoints and agent models
- Automated Build Verification: Replaced manual confirmation with automated output parsing
- Inline Contract Generation: Quick command palette access to AI contract generation
Breaking Changes
- Removed
solana.showLifecyclePanel command (functionality integrated into sidebar)
- Removed
solana.showContractGenerator command (use sidebar AI Contract Generator view)
Mission: Solana - Build secure Solana programs faster with AI-powered development tools.