Docs/VS Code Extension
VS Code 1.85+

VS Code Extension

Real-time PII detection, policy syntax highlighting, and AI governance tools directly in Visual Studio Code.

Features

Real-time PII Detection

Automatically detect SSN, credit cards, emails, phone numbers, IP addresses, and more as you type.

Syntax Highlighting

Full syntax highlighting for .tork.yaml policy files with keyword recognition.

Policy Templates

8 built-in policy templates for common governance scenarios. Just type 'tork-' and Tab.

Evaluate Selection

Select text and evaluate it against your policies with Cmd+Shift+T.

Code Snippets

Quick snippets for policy rules, agent configs, and threshold definitions.

Status Bar Integration

See connection status and quick access to Tork commands in the status bar.

Installation

Install from VS Code Marketplace or from a .vsix file.

Option 1: VS Code Marketplace (Recommended)

Search for "Tork AI Governance" in VS Code Extensions, or run:

bash
# Install from VS Code Marketplace
code --install-extension torknetwork.tork-governance

Option 2: Manual Installation

Download the .vsix file from GitHub Releases and install:

bash
# Install from .vsix file
code --install-extension tork-governance-0.1.0.vsix

Configuration

Configure the extension in your VS Code settings.

jsonsettings.json
// settings.json
{
  // Tork API Configuration
  "tork.apiKey": "tork_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "tork.apiUrl": "https://api.tork.network",

  // PII Detection Settings
  "tork.enablePiiDetection": true,
  "tork.piiSeverity": "warning",
  "tork.piiPatterns": [
    "email",
    "ssn",
    "phone",
    "creditCard",
    "ipAddress",
    "dateOfBirth",
    "passport",
    "driverLicense"
  ],

  // Scanning Behavior
  "tork.autoScanOnSave": true,
  "tork.excludePatterns": [
    "**/node_modules/**",
    "**/dist/**",
    "**/.git/**"
  ]
}

Configuration Options

tork.apiKeystringYour Tork API key
tork.apiUrlstringAPI endpoint (default: api.tork.network)
tork.enablePiiDetectionbooleanEnable/disable PII detection
tork.piiSeverityenumhint | information | warning | error
tork.piiPatternsarrayPII patterns to detect
tork.autoScanOnSavebooleanScan files on save
tork.excludePatternsarrayGlob patterns to exclude

PII Detection

Automatic detection of personally identifiable information.

The extension scans all open files for PII patterns and shows warnings in the Problems panel. Detected PII is highlighted with a yellow background.

Supported PII Patterns

emailjohn@example.com
ssn123-45-6789
phone(555) 123-4567
creditCard4111-1111-1111-1111
ipAddress192.168.1.1
dateOfBirth01/15/1990
passportAB1234567
driverLicenseD1234567890

PII detection runs locally in your editor. No data is sent to external servers unless you explicitly use the Evaluate command.

Policy Syntax Highlighting

Full syntax highlighting for .tork.yaml and .tork.yml files.

yamlexample.tork.yaml
# example.tork.yaml
version: "1.0"
name: content-moderation
description: Block harmful content and redact PII

rules:
  - name: block-pii
    action: block
    condition: pii_detected
    threshold: 0.8

  - name: warn-jailbreak
    action: warn
    condition: jailbreak_attempt

  - name: escalate-high-risk
    action: escalate
    condition: risk_score > 0.9

thresholds:
  risk_score: 75
  confidence: 0.9

agents:
  - id: content-analyzer
    permissions:
      - read
      - analyze
    rate_limit: 100

Highlighted Keywords

versionnamerulesactionblockwarnallowescalateredactthresholdsagents

Commands & Keyboard Shortcuts

Available commands in the Command Palette (Cmd+Shift+P).

Tork: Evaluate Selected TextCmd+Shift+TEvaluate selection against policies
Tork: Insert Policy TemplateCmd+Shift+P TInsert a policy template
Tork: Scan File for PII-Manually scan current file
Tork: Redact PII in Selection-Replace PII with placeholders
Tork: Configure API Key-Set your Tork API key
Tork: Validate Policy File-Validate .tork.yaml syntax

Policy Templates & Snippets

Quickly insert policy templates with code snippets.

text
# Type "tork-" and press Tab to insert templates

tork-policy      # Basic policy template
tork-pii         # PII protection policy
tork-content     # Content moderation policy
tork-rate        # Rate limiting policy
tork-tool        # Tool governance policy
tork-hitl        # Human-in-the-loop policy
tork-compliance  # Compliance logging policy
tork-jailbreak   # Jailbreak prevention policy

Available Templates

tork-policyBasic policy structure
tork-piiPII protection rules
tork-contentContent moderation
tork-rateRate limiting rules
tork-toolTool governance
tork-hitlHuman-in-the-loop
tork-complianceCompliance logging
tork-jailbreakJailbreak prevention

Troubleshooting

PII detection not working

Check that tork.enablePiiDetection is true in settings. Open Developer Tools (Help > Toggle Developer Tools) to see [Tork] logs.

Extension not activating

The extension activates on startup. Reload VS Code window (Cmd+Shift+P > Reload Window) if needed.

API key not recognized

Ensure your API key is set in settings.json or via the 'Tork: Configure API Key' command.

Syntax highlighting not showing

Make sure your file has a .tork.yaml or .tork.yml extension.

Next Steps

Learn more about Tork policies and integrate governance into your CI/CD pipeline.

Documentation

Learn to integrate TORK

Upgrade Plan

Current: free

Support

Get help from our team