windsurf-webhooks-events
Implement Windsurf webhook signature validation and event handling. Use when setting up webhook endpoints, implementing signature verification, or handling Windsurf event notifications securely. Trigger with phrases like "windsurf webhook", "windsurf events", "windsurf webhook signature", "handle windsurf events", "windsurf notifications".
- License 许可
- MIT
- 最近更新
- 2026-05-26
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- windsurf-webhooks-events
- author
- Jeremy Longshore <jeremy@intentsolutions.io>
- license
- MIT
- version
- 1.0.0
- description
- Implement Windsurf webhook signature validation and event handling. Use when setting up webhook endpoints, implementing signature verification, or handling Windsurf event notifications securely. Trigger with phrases like "windsurf webhook", "windsurf events", "windsurf webhook signature", "handle windsurf events", "windsurf notifications".
- allowed-tools
- Read, Write, Edit, Bash(curl:*)
- compatible-with
- claude-code, codex, openclaw
03 SKILL.md 正文
Windsurf Webhooks & Events
Overview
Handle Windsurf workspace and editor events for extension development and team workflow integration. Windsurf, built on VS Code architecture, exposes extension events for workspace changes, editor actions, AI interactions (Cascade), and terminal activity.
Prerequisites
- Windsurf IDE installed with extension development support
- Node.js and VS Code extension API familiarity
- Understanding of VS Code extension model (activationEvents, commands)
- Windsurf workspace with Cascade AI enabled
Event Types
| Event | Source | Payload |
|---|---|---|
workspace.onDidOpenTextDocument |
VS Code API | Document URI, language |
workspace.onDidSaveTextDocument |
VS Code API | File path, content |
cascade.onSuggestionAccepted |
Windsurf API | Suggestion text, file, line |
cascade.onFlowCompleted |
Windsurf API | Flow ID, changes made |
terminal.onDidWriteTerminalData |
VS Code API | Terminal output text |
debug.onDidStartDebugSession |
VS Code API | Session config, type |
Instructions
Step 1: Create Windsurf Extension
import * as vscode from "vscode";
export function activate(context: vscode.ExtensionContext) {
const saveListener = vscode.workspace.onDidSaveTextDocument(
async (document) => {
console.log(`File saved: ${document.uri.fsPath}`);
await handleFileSave(document);
}
);
const editorListener = vscode.window.onDidChangeActiveTextEditor(
(editor) => {
if (editor) {
trackFileOpen(editor.document);
}
}
);
const folderListener = vscode.workspace.onDidChangeWorkspaceFolders(
(event) => {
for (const added of event.added) {
console.log(`Folder added: ${added.uri.fsPath}`);
}
}
);
context.subscriptions.push(saveListener, editorListener, folderListener);
}
Step 2: Track AI Interaction Events
async function trackCascadeEvents(context: vscode.ExtensionContext) {
const outputChannel = vscode.window.createOutputChannel("Cascade Tracker");
const completionListener = vscode.languages.registerInlineCompletionItemProvider(
{ pattern: "**" },
{
provideInlineCompletionItems(document, position) {
outputChannel.appendLine(
`Completion requested: ${document.fileName}:${position.line}`
);
return [];
},
}
);
context.subscriptions.push(completionListener);
}
Step 3: Send Events to External System
async function handleFileSave(document: vscode.TextDocument) {
const webhookUrl = vscode.workspace
.getConfiguration("windsurf-events")
.get<string>("webhookUrl");
if (!webhookUrl) return;
await fetch(webhookUrl, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
event: "file.saved",
file: document.uri.fsPath,
language: document.languageId,
lineCount: document.lineCount,
timestamp: new Date().toISOString(),
}),
});
}
function trackFileOpen(document: vscode.TextDocument) {
const diagnostics = vscode.languages.getDiagnostics(document.uri);
const errorCount = diagnostics.filter(
d => d.severity === vscode.DiagnosticSeverity.Error
).length;
console.log(`${document.fileName}: ${errorCount} errors`);
}
Step 4: Package Configuration
{
"name": "windsurf-events",
"activationEvents": ["onStartupFinished"],
"contributes": {
"configuration": {
"title": "Windsurf Events",
"properties": {
"windsurf-events.webhookUrl": {
"type": "string",
"description": "URL to send workspace events to"
}
}
}
}
}
Error Handling
| Issue | Cause | Solution |
|---|---|---|
| Extension not activating | Wrong activationEvents | Use onStartupFinished for always-on |
| Webhook delivery fails | Network issue | Queue events locally, retry on connect |
| High CPU usage | Too many listeners | Debounce frequent events (saves, edits) |
| API deprecation | VS Code API changes | Pin engine version in package.json |
Examples
Debounced Save Handler
const saveDebounce = new Map<string, NodeJS.Timeout>();
function debouncedSave(document: vscode.TextDocument, delayMs = 2000) { # 2000: 2 seconds in ms
const key = document.uri.fsPath;
clearTimeout(saveDebounce.get(key));
saveDebounce.set(key, setTimeout(() => {
handleFileSave(document);
saveDebounce.delete(key);
}, delayMs));
}
Resources
Next Steps
For multi-environment setup, see windsurf-multi-env-setup.
Output
- Configuration files or code changes applied to the project
- Validation report confirming correct implementation
- Summary of changes made and their rationale
04 同仓库更多 Skills
zustand-store-ts
Create Zustand stores with TypeScript, subscribeWithSelector middleware, and proper state/action separation. Use when building React state management, creating global stores, or implementing reactive state patterns with Zustand.
zustand-store-creator
Zustand Store Creator - Auto-activating skill for Frontend Development. Triggers on: zustand store creator, zustand store creator Part of the Frontend Development skill category.
zero-trust-config-helper
Zero Trust Config Helper - Auto-activating skill for Security Advanced. Triggers on: zero trust config helper, zero trust config helper Part of the Security Advanced skill category.
zapier-integration-helper
Zapier Integration Helper - Auto-activating skill for Business Automation. Triggers on: zapier integration helper, zapier integration helper Part of the Business Automation skill category.
zai-cli
Execute z.AI CLI providing vision, search, reader, and GitHub exploration via CLI and MCP. Use when user needs image/video analysis, OCR, UI-to-code conversion, error diagnosis, real-time web search, web page to markdown extraction, or GitHub code exploration. Trigger with phrases like "analyze this image", "search the web for", "read this page", "explore this repo", or "use zai". Requires Z_AI_API_KEY.
yt-research
Research competitor YouTube channels, niches, and trending topics for your content strategy. Use this skill whenever the user says "research channels", "analyze competitors", "find trending topics", "niche analysis", "competitive research", "what are other creators doing", "scrape YouTube channels", or wants to understand the competitive landscape for a specific tool or topic area. Use when working with yt research. Trigger with 'yt', 'research'.