https://github.com/project-dalec/dalec-vscode-extension
VS Code extension providing authoring support, CodeLens actions, and BuildKit debugging for Dalec spec files
https://github.com/project-dalec/dalec-vscode-extension
Last synced: 5 months ago
JSON representation
VS Code extension providing authoring support, CodeLens actions, and BuildKit debugging for Dalec spec files
- Host: GitHub
- URL: https://github.com/project-dalec/dalec-vscode-extension
- Owner: project-dalec
- License: apache-2.0
- Created: 2025-12-16T17:51:56.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2026-01-12T01:13:30.000Z (5 months ago)
- Last Synced: 2026-01-12T05:51:18.758Z (5 months ago)
- Language: TypeScript
- Homepage:
- Size: 864 KB
- Stars: 6
- Watchers: 0
- Forks: 4
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
- Maintainers: MAINTAINERS.md
Awesome Lists containing this project
README
# Dalec VS Code Extension
VS Code extension for authoring and debugging Dalec specs.
> [!WARNING]
> **Early Development**: This extension is not production ready yet and may change significantly.
## Features
- π Auto-detects Dalec spec files (YAML with `#syntax=...` header)
- β¨ Schema-powered completions, hover, and validation via Red Hat YAML extension
- π BuildKit debugging support with `dalec-buildx` debug type
- βΆοΈ CodeLens actions for quick "Debug" and "Build" commands
- π― Queries available targets from the Dalec frontend via `docker buildx build --call targets`
- π Smart context handlingβonly prompts when specs reference build contexts
## Quick Start
1. **Install the extension** (via `.vsix` or Extension Manager)
2. **Open a Dalec spec** (any `.yml`/`.yaml` file starting with `#syntax=...`)
3. **Run your first build** using CodeLens or Command Palette
4. **View results** in the integrated terminal
## Commands
All commands are available via the Command Palette (`Cmd/Ctrl + Shift + P`):
| Command | Description |
|---------|-------------|
| `Dalec: Build Current Spec` | Builds the currently opened Dalec spec using `docker buildx build` |
| `Dalec: Debug Current Spec` | Launches a BuildKit debug session for the current spec |
| `Dalec: Rerun Last Action` | Re-executes the last build or debug action with the same parameters |
### Screenshots
**Command Palette (`Cmd/Ctrl + Shift + P`)**

**Right-click Context Menu**

### Dalec: Build Current Spec
Builds the currently opened Dalec spec using `docker buildx build`.
**Requirements**
- File must be a valid Dalec YAML spec (starts with `#syntax=...`)
- Docker with Buildx must be installed and running
**How to use**
1. Open a Dalec spec file
2. Either:
- Click the **"Dalec: Build"** CodeLens at the top of the file, or
- Open Command Palette (`Cmd/Ctrl + Shift + P`) β `Dalec: Build Current Spec`
3. Select a target when prompted (targets are queried from the Dalec frontend via `docker buildx build --call targets`)
4. Provide build context path if prompted (only when spec uses `context` sources)
**Output**
- Build runs in the integrated terminal
- Errors and logs appear in terminal output
---
### Dalec: Debug Current Spec
Launches a BuildKit debug session for the current spec.
**Requirements**
- Same as Build, plus:
- Set `DALEC_ENABLE_DEBUG=1` environment variable before launching VS Code
**How to use**
1. Open a Dalec spec file
2. Either:
- Click the **"Dalec: Debug"** CodeLens, or
- Open Command Palette β `Dalec: Build Current Spec` (with debug environment enabled)
3. Select a target and provide context if prompted
4. Debug session starts with breakpoint support
---
### Dalec: Rerun Last Action
Re-executes the previous build or debug action with the same target, spec file, and context settings.
**How to use**
1. After running a build or debug command at least once
2. Open Command Palette (`Cmd/Ctrl + Shift + P`) β `Dalec: Rerun Last Action`
3. The previous action is re-executed with the same parameters
**Note:** This is useful for quick iterationβchange your spec and immediately re-run without re-selecting the target.
## Typical Workflow
```
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β 1. Open/create a Dalec YAML spec β
β β β
β 2. Edit your spec (completions & validation) β
β β β
β 3. Run "Dalec: Build Spec" β
β β β
β 4. Fix any build errors β
β β β
β 5. Re-run build β iterate until success β
βββββββββββββββββββββββββββββββββββββββββββββββββββ
```
**Example scenarios:**
| Goal | Action |
|------|--------|
| Quick iteration on a spec | Use CodeLens "Build" button after each change |
| Debug a failing build step | Use "Debug Spec" to step through BuildKit execution |
| Test multiple targets | Run "Build Spec" and select different targets from the picker |
## Supported Files
The extension activates for YAML files that match:
```yaml
#syntax=ghcr.io/project-dalec/dalec/frontend:latest
# or
# syntax=ghcr.io/azure/dalec/frontend:latest
```
Files without this header are not recognized as Dalec specs.
## Installation
**For development:**
```bash
cd dalec-vscode-extension
npm install
npm run compile
code --extensionDevelopmentPath=$(pwd)
```
**For testing:**
1. Build with `npx vsce package`
2. Install `.vsix` via VS Code Extension Manager
## Debug Configuration
Add to `.vscode/launch.json`:
```json
{
"version": "0.2.0",
"configurations": [
{
"name": "Dalec: Buildx Debug",
"type": "dalec-buildx",
"request": "launch",
"target": "frontend",
"specFile": "${file}",
"context": "${workspaceFolder}"
}
]
}
```
## Requirements
- Docker with Buildx installed
- [Red Hat YAML extension](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml) (auto-prompted)
## Troubleshooting
| Issue | Solution |
|-------|----------|
| No CodeLens appearing | Ensure file starts with `#syntax=...` on the first line |
| Target picker is empty | Check Docker is running; extension queries targets via `docker buildx build --call targets` |
| Debug commands missing | Set `DALEC_ENABLE_DEBUG=1` and restart VS Code |
| Schema validation not working | Install the Red Hat YAML extension |
π For more about Dalec, see the [Dalec documentation](https://project-dalec.github.io/dalec/)!