Carbonara VS Code Extension
A VS Code extension for CO2 assessment and web sustainability analysis, integrated with the Carbonara CLI tool.
Features
- Project Initialization: Set up Carbonara projects directly from VS Code
- CO2 Assessment: Run comprehensive sustainability questionnaires
- Website Analysis: Analyze website carbon footprints using Greenframe
- Data Management: View, export, and manage assessment data
- Status Monitoring: Real-time project status in the status bar
- Configuration Management: Easy access to project settings
Installation
Method 1: Install from VSIX (Recommended)
- Download the
carbonara-vscode-0.1.0.vsix file
- Open VS Code
- Open the Command Palette (
Cmd+Shift+P or Ctrl+Shift+P)
- Type "Extensions: Install from VSIX"
- Select the downloaded VSIX file
Method 2: Command Line Installation
code --install-extension carbonara-vscode-0.1.0.vsix
Prerequisites
The extension requires the Carbonara CLI tool to be available. It will automatically detect:
- Monorepo Structure: CLI at
packages/cli/src/index.js
- Global Installation: CLI installed globally via npm
- Local Installation: CLI in the current workspace
Usage
Getting Started
- Open a workspace in VS Code
- Click the Carbonara icon in the status bar (bottom right)
- Select "Initialize Project" to set up Carbonara in your workspace
Available Commands
Access commands via:
- Status Bar: Click the Carbonara icon
- Command Palette: Search for "Carbonara"
- Quick Pick Menu: Use
Carbonara: Show Menu
Core Commands
Initialize Project (carbonara.initProject)
- Set up Carbonara configuration and database
- Choose project type (Web, Mobile, Desktop, API, Other)
Run CO2 Assessment (carbonara.runAssessment)
- Complete interactive sustainability questionnaire
- Get CO2 impact scoring based on project characteristics
Analyze Website (carbonara.analyzeWebsite)
- Run Greenframe analysis on any URL
- Option to save results to data lake
View Data (carbonara.viewData)
- List all stored assessment data
- Export data as JSON or CSV
Show Status (carbonara.showStatus)
- Display project information and status
- Check CLI availability and database status
Open Configuration (carbonara.openConfig)
- Quick access to
.carbonara/carbonara.config.json
Status Bar Integration
The status bar shows project status:
- $(pulse) Carbonara: Project not initialized
- $(check) Carbonara: Project initialized and ready
Project Structure
After initialization, your project will contain:
your-project/
├── .carbonara/
│ ├── carbonara.config.json # Project configuration
│ ├── carbonara.db # SQLite database
│ └── ... # Other Carbonara files
└── schemas/ # JSON schema files (optional)
Configuration
The extension can be configured via VS Code settings:
{
"carbonara.server.host": "localhost",
"carbonara.server.port": 3000,
"carbonara.autoConnect": true,
"carbonara.transport": "websocket"
}
Development
Building from Source
git clone <repository>
cd plugins/vscode
npm install
npm run build
npm run package
Project Structure
src/
└── extension.ts # Main extension logic
dist/
├── extension.js # Compiled JavaScript
└── extension.js.map # Source map
Troubleshooting
CLI Not Found
If you see "Carbonara CLI not found":
- Ensure the CLI is installed:
npm install -g @carbonara/cli
- Or ensure you're in a monorepo with the CLI at
packages/cli/
- Check that Node.js is properly installed
Project Not Initialized
If commands show "No project found":
- Run Initialize Project first
- Ensure you're in a workspace folder
- Check that
.carbonara/carbonara.config.json exists
Database Errors
If you see database-related errors:
- Check that
.carbonara/carbonara.db exists in your project
- Try re-initializing the project
- Ensure proper file permissions
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
License
ISC License - see LICENSE file for details.
Links