Skip to content

shushenglihotmail/EntraCode

Repository files navigation

AI Coding Assistant for VS Code

A powerful AI-powered coding assistant for Visual Studio Code, integrated with Azure Foundry AI models and Microsoft Entra ID authentication.

Features

  • 🤖 AI-Powered Assistance: Leverage Azure Foundry AI models for code generation, explanation, and refactoring
  • 🔐 Secure Authentication: Microsoft Entra ID integration with support for API key authentication
  • 💬 Conversational Interface: Interactive chat panel with session management
  • 📝 In-Place Edits: Apply AI suggestions directly to your code with Keep/Discard options
  • 🖥️ Terminal Integration: Execute commands with output capture and AI-driven error resolution
  • 📊 Token Tracking: Monitor usage and costs with configurable session limits
  • 🔄 Session Management: Save and restore up to 10 conversation sessions
  • ⚙️ Highly Configurable: Extensive settings for customization and security

Requirements

  • VS Code 1.85.0 or higher
  • Azure Foundry endpoint access
  • Microsoft Entra ID application (for Entra ID authentication) or API key

Getting Started

Quick Start

See QUICKSTART.md for a 5-minute setup guide.

1. Install the Extension

Install from the VS Code Marketplace or via VSIX file.

2. Configure Settings

Open VS Code settings (Ctrl+, or Cmd+,) and search for "AI Assistant":

Model Configuration:

{
  "aiAssistant.models": [
    {
      "id": "gpt-5-chat-azure",
      "name": "gpt-5-chat",
      "provider": "azure-foundry",
      "endpoint": "https://your-endpoint.cognitiveservices.azure.com",
      "deploymentName": "gpt-5-chat",
      "apiVersion": "2024-12-01-preview",
      "description": "Production GPT-5 Chat on Azure Foundry",
      "enabled": true,
      "maxTokens": 8192,
      "temperature": 0.7
    }
  ],
  "aiAssistant.activeModelId": "gpt-5-chat-azure"
}

Authentication:

  • Uses Microsoft Entra ID (Azure AD) authentication
  • No client ID configuration needed - uses built-in Azure CLI app ID

3. Authenticate

  1. Open the AI Assistant panel: Ctrl+Shift+A (or Cmd+Shift+A on Mac)
  2. Click "Sign In" and follow the Microsoft Entra ID authentication flow
  3. Grant the requested permissions

4. Start Coding with AI

  • Ask questions in the chat panel
  • Select code and use commands like "Explain Selected Code" or "Refactor Selected Code"
  • Let AI help with file operations, testing, and debugging

Commands

  • AI Assistant: Open AI Assistant - Open the chat panel (Ctrl+Shift+A)
  • AI Assistant: Ask AI Assistant - Quick question prompt
  • AI Assistant: Explain Selected Code - Get explanation for selected code
  • AI Assistant: Generate Tests - Generate tests for selected code
  • AI Assistant: Refactor Selected Code - Get refactoring suggestions
  • AI Assistant: Clear Conversation Context - Clear current session
  • AI Assistant: Start New Session - Begin a new conversation
  • AI Assistant: Switch AI Model - Change the active AI model
  • AI Assistant: View Token Usage - See usage statistics
  • AI Assistant: Reset Authentication - Clear credentials and sign out
  • AI Assistant: Open Settings - Configure the extension

Configuration

See USER_GUIDE.md for comprehensive configuration options and setup instructions.

For architectural details, see DESIGN.md.

Architecture

This extension is built with extensibility in mind:

  • Provider Abstraction: Easy to add new AI providers (Google Gemini, OpenAI, etc.)
  • Modular Design: Clean separation of concerns
  • Security First: Workspace trust, permission confirmations, encrypted credential storage
  • TypeScriptdocs/DESIGN.md) for detailed architecture documentation and IMPLEMENTATION.md for developer setup

See DESIGN.md for detailed architecture documentation.

Token Usage & Costs

The extension tracks token usage per session and displays estimated costs. Configure limits:

{
  "aiAssistant.session.maxTokensPerSession": 100000,
  "aiAssistant.session.tokenWarningThreshold": 0.8,
  "aiAssistant.session.estimatedCostPerToken": 0.00001
}

Privacy & Security

  • Credentials stored securely in VS Code's encrypted SecretStorage
  • File operations respect workspace trust settings
  • Terminal commands require confirmation (configurable)
  • No telemetry by default (opt-in available)

Troubleshooting

Authentication Issues

  1. Run AI Assistant: Reset Authentication
  2. Verify your Entra ID application settings
  3. Check that the Client ID and Tenant ID are correct
  4. Ensure redirect URI is configured: vscode://publisher.extension-name/auth-callback

Connection Issues

  1. Verify your Azure Foundry endpoint is accessible
  2. Check network/proxy settings
  3. Ensure API key or Entra ID credentials are valid

Clear All Data

If you need to start fresh:

  1. Run AI Assistant: Clear All Extension Data
  2. Reload VS Code

Contributing

See IMPLEMENTATION.md for development setup and contribution guidelines.

License

MIT

Support

About

A VS Code Extension does AI coding with models on Azure Foundry or other platform

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors