Skip to content
OpenSmartRoute
Skillv1.0.0

windsurf-webhooks-events

Build Windsurf extensions and integrate with VS Code extension API events. Use when building custom Windsurf extensions, tracking editor events, or integrating Windsurf with external tools via extensi

by jeremylongshore(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from jeremylongshore/tons-of-skills-marketplace (plugins/saas-packs/windsurf-pack/skills/windsurf-webhooks-events/SKILL.md). Install upstream with npx skills add jeremylongshore/tons-of-skills-marketplace --skill windsurf-webhooks-events. Copyright stays with the author (MIT).

Windsurf Extension Development & Events

Overview

Windsurf is built on VS Code and supports the full VS Code Extension API. Build custom extensions to track workspace events, integrate with external tools, and extend Cascade's capabilities. This skill covers extension development specific to the Windsurf environment.

Prerequisites

  • Node.js 18+ and npm
  • VS Code Extension API familiarity
  • yo and generator-code for scaffolding
  • Windsurf IDE for testing

Instructions

Step 1: Scaffold Extension

# Install scaffolding tools
npm install -g yo generator-code

# Generate extension
yo code
# Select: New Extension (TypeScript)
# Name: my-windsurf-extension

Step 2: Track Workspace Events

// src/extension.ts
import * as vscode from "vscode";

export function activate(context: vscode.ExtensionContext) {
  console.log("Extension active in Windsurf");

  // Track file saves
  const saveListener = vscode.workspace.onDidSaveTextDocument(
    async (document) => {
      const diagnostics = vscode.languages.getDiagnostics(document.uri);
      const errors = diagnostics.filter(
        (d) => d.severity === vscode.DiagnosticSeverity.Error
      );
      if (errors.length > 0) {
        vscode.window.showWarningMessage(
          `${document.fileName}: ${errors.length} error(s) after save`
        );
      }
    }
  );

  // Track active editor changes
  const editorListener = vscode.window.onDidChangeActiveTextEditor(
    (editor) => {
      if (editor) {
        const lang = editor.document.languageId;
        const lines = editor.document.lineCount;
        console.log(`Opened: ${editor.document.fileName} (${lang}, ${lines} lines)`);
      }
    }
  );

  // Track terminal output
  const terminalListener = vscode.window.onDidWriteTerminalData((event) => {
    // Can monitor for specific patterns (errors, warnings)
    if (event.data.includes("ERROR") || event.data.includes("FAIL")) {
      vscode.window.showWarningMessage("Error detected in terminal output");
    }
  });

  context.subscriptions.push(saveListener, editorListener, terminalListener);
}

Step 3: Send Events to External System

// src/webhook.ts
import * as vscode from "vscode";

interface WorkspaceEvent {
  event: string;
  file?: string;
  language?: string;
  timestamp: string;
  metadata?: Record<string, unknown>;
}

async function sendEvent(event: WorkspaceEvent): Promise<void> {
  const webhookUrl = vscode.workspace
    .getConfiguration("windsurf-events")
    .get<string>("webhookUrl");

  if (!webhookUrl) return;

  try {
    await fetch(webhookUrl, {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify(event),
    });
  } catch (err) {
    console.warn("Webhook delivery failed:", err);
  }
}

// Debounce frequent events
const debounceMap = new Map<string, NodeJS.Timeout>();

function debouncedSend(event: WorkspaceEvent, delayMs = 2000): void {
  const key = `${event.event}:${event.file}`;
  clearTimeout(debounceMap.get(key));
  debounceMap.set(
    key,
    setTimeout(() => {
      sendEvent(event);
      debounceMap.delete(key);
    }, delayMs)
  );
}

Step 4: Extension package.json

{
  "name": "windsurf-events",
  "displayName": "Windsurf Events",
  "version": "1.0.0",
  "engines": { "vscode": "^1.85.0" },
  "activationEvents": ["onStartupFinished"],
  "main": "./dist/extension.js",
  "contributes": {
    "configuration": {
      "title": "Windsurf Events",
      "properties": {
        "windsurf-events.webhookUrl": {
          "type": "string",
          "description": "URL to send workspace events to"
        },
        "windsurf-events.trackSaves": {
          "type": "boolean",
          "default": true,
          "description": "Track file save events"
        },
        "windsurf-events.trackErrors": {
          "type": "boolean",
          "default": true,
          "description": "Track terminal error events"
        }
      }
    },
    "commands": [
      {
        "command": "windsurf-events.showStatus",
        "title": "Windsurf Events: Show Status"
      }
    ]
  }
}

Step 5: Build and Install

# Build
npm run compile
# or: npm run build

# Package as .vsix
npx vsce package

# Install in Windsurf
windsurf --install-extension windsurf-events-1.0.0.vsix

# Or publish to marketplace
npx vsce publish

Step 6: Test in Windsurf

1. Open Extension Development Host: F5 in Windsurf
2. A new Windsurf window opens with extension loaded
3. Open a file, save it, trigger events
4. Check Output panel > "Windsurf Events" channel
5. Verify webhook delivery (use https://webhook.site for testing)

Error Handling

Issue Cause Solution
Extension not activating Wrong activationEvents Use onStartupFinished for always-on
Webhook fails Network/URL issue Queue locally, retry with backoff
High CPU usage Too many listeners Debounce frequent events (saves, edits)
API incompatibility Windsurf vs VS Code version Pin engines.vscode version
vsce package fails Missing fields Add publisher, repository, license

Examples

Team Analytics Extension

// Track AI acceptance rate per developer
vscode.languages.registerInlineCompletionItemProvider(
  { pattern: "**" },
  {
    provideInlineCompletionItems(document, position) {
      // Log completion requests (don't interfere with Supercomplete)
      console.log(`Completion at ${document.fileName}:${position.line}`);
      return []; // Return empty -- let Windsurf handle completions
    }
  }
);

Quick Test Webhook

# Start a test webhook receiver
npx -y webhook-relay -p 3456
# Configure extension: windsurf-events.webhookUrl = "http://localhost:3456"

Resources

Next Steps

For multi-environment setup, see windsurf-multi-env-setup.

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/jeremylongshore-tons-of-skills-marketplace-windsurf-webh-57ab3c/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

jeremylongshore-tons-of-skills-marketplace-windsurf-webh-57ab3c.ocm.jsonjson
{
  "ocm": "1",
  "id": "jeremylongshore-tons-of-skills-marketplace-windsurf-webh-57ab3c",
  "kind": "skill",
  "name": "windsurf-webhooks-events",
  "description": "Build Windsurf extensions and integrate with VS Code extension API events. Use when building custom Windsurf extensions, tracking editor events, or integrating Windsurf with external tools via extension development. Trigger with phrases like \"windsurf extension\", \"windsurf events\", \"windsurf plugin\", \"build windsurf extension\", \"windsurf API\".",
  "publisher": "jeremylongshore",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "coding"
    ],
    "tags": [
      "skill-md",
      "saas",
      "windsurf",
      "extensions",
      "vscode-api",
      "development",
      "skills-sh"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "Build Windsurf extensions and integrate with VS Code extension API events. Use when building custom Windsurf extensions, tracking editor events, or integrating Windsurf with external tools via extension development. Trigger with phrases like \"windsurf extension\", \"windsurf events\", \"windsurf plugin\", \"build windsurf extension\", \"windsurf API\"."
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "skills.sh",
      "repository": "https://github.com/jeremylongshore/tons-of-skills-marketplace",
      "path": "plugins/saas-packs/windsurf-pack/skills/windsurf-webhooks-events/SKILL.md",
      "ref": "HEAD",
      "url": "https://github.com/jeremylongshore/tons-of-skills-marketplace/blob/HEAD/plugins/saas-packs/windsurf-pack/skills/windsurf-webhooks-events/SKILL.md",
      "key": "jeremylongshore/tons-of-skills-marketplace/plugins/saas-packs/windsurf-pack/skills/windsurf-webhooks-events/SKILL.md"
    },
    "compatibility": "Designed for Claude Code",
    "allowed_tools": [
      "Read,",
      "Write,",
      "Edit,",
      "Bash(npm:*),",
      "Bash(npx:*)"
    ],
    "license": "MIT"
  },
  "instructions": "# Windsurf Extension Development & Events\n\n## Overview\n\nWindsurf is built on VS Code and supports the full VS Code Extension API. Build custom extensions to track workspace events, integrate with external tools, and extend Cascade's capabilities. This skill covers extension development specific to the Windsurf environment.\n\n## Prerequisites\n\n- Node.js 18+ and npm\n- VS Code Extension API familiarity\n- `yo` and `generator-code` for scaffolding\n- Windsurf IDE for testing\n\n## Instructions\n\n### Step 1: Scaffold Extension\n\n```bash\n# Install scaffolding tools\nnpm install -g yo generator-code\n\n# Gener",
  "cost": {
    "context_tokens": 1542
  }
}

Fetch it by URL: GET /api/v1/registry/jeremylongshore-tons-of-skills-marketplace-windsurf-webh-57ab3c/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.