Skip to content

Conversation

Copy link

Copilot AI commented Jun 19, 2025

This PR adds the ability to configure AI Shell to automatically start when PowerShell is launched in Windows Terminal by integrating with the user's PowerShell profile.

New Features

Interactive Installation

The install script now prompts users during installation:

  • Ask for consent to add AI Shell to their PowerShell profile
  • Allow selection of a default agent to use on startup
  • Provide clear information about what will be added to their profile

Non-Interactive Installation

New parameters for automation scenarios:

  • -AddToProfile: Automatically add AI Shell to profile without prompting
  • -DefaultAgent <name>: Specify the default agent to use (e.g., "openai", "ollama", "azure")

Safe Profile Management

  • Uses unique markers to identify AI Shell code sections in the profile
  • Preserves existing profile content during installation and removal
  • Clean removal during uninstall without affecting other profile content
  • Handles missing profile directories and creates them as needed

Usage Examples

# Interactive installation with prompts
.\install-aishell.ps1

# Automated installation with profile integration
.\install-aishell.ps1 -AddToProfile -DefaultAgent openai

# Clean uninstallation (removes profile integration)
.\install-aishell.ps1 -Uninstall

Technical Implementation

  • Windows Only: Profile integration is only supported on Windows with appropriate warnings on other platforms
  • Windows Terminal Detection: AI Shell only auto-starts when $env:WT_SESSION is present
  • Input Validation: Agent names are sanitized to prevent code injection
  • Error Handling: Comprehensive error handling with user-friendly messages
  • Help Documentation: Complete help with examples and parameter descriptions

Generated Profile Code

The script adds code like this to the user's profile:

# AI Shell Auto-Start - BEGIN (Added by AIShell installer)
# Auto-start AI Shell sidecar if in Windows Terminal
if ($env:WT_SESSION -and (Get-Command Start-AIShell -ErrorAction SilentlyContinue)) {
    try {
        Start-AIShell -Agent 'openai'
    } catch {
        Write-Warning "Failed to auto-start AI Shell: $_"
    }
}
# AI Shell Auto-Start - END (Added by AIShell installer)

Fixes #388.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 1p7vsblobprodcus324.vsblob.vsassets.io
    • Triggering command: dotnet build shell/shell.sln -c Release (dns block)
  • 1s1vsblobprodcus386.vsblob.vsassets.io
    • Triggering command: dotnet build shell/shell.sln -c Release (dns block)
  • 7tjvsblobprodcus341.vsblob.vsassets.io
    • Triggering command: dotnet build shell/shell.sln -c Release (dns block)
  • c78vsblobprodcus322.vsblob.vsassets.io
    • Triggering command: dotnet build shell/shell.sln -c Release (dns block)
  • d0svsblobprodcus381.vsblob.vsassets.io
    • Triggering command: dotnet build shell/shell.sln -c Release (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)
  • fdpvsblobprodcus345.vsblob.vsassets.io
    • Triggering command: dotnet build shell/shell.sln -c Release (dns block)
  • h6tvsblobprodcus346.vsblob.vsassets.io
    • Triggering command: dotnet build shell/shell.sln -c Release (dns block)
  • jd4vsblobprodcus366.vsblob.vsassets.io
    • Triggering command: dotnet build shell/shell.sln -c Release (dns block)
  • l49vsblobprodcus358.vsblob.vsassets.io
    • Triggering command: dotnet build shell/shell.sln -c Release (dns block)
  • m16vsblobprodcus374.vsblob.vsassets.io
    • Triggering command: dotnet build shell/shell.sln -c Release (dns block)
  • uy6vsblobprodcus34.vsblob.vsassets.io
    • Triggering command: dotnet build shell/shell.sln -c Release (dns block)
  • vb4vsblobprodcus33.vsblob.vsassets.io
    • Triggering command: dotnet build shell/shell.sln -c Release (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits June 19, 2025 22:17
Co-authored-by: StevenBucher98 <20605456+StevenBucher98@users.noreply.github.com>
Co-authored-by: StevenBucher98 <20605456+StevenBucher98@users.noreply.github.com>
Co-authored-by: StevenBucher98 <20605456+StevenBucher98@users.noreply.github.com>
Copilot AI changed the title [WIP] Add a option during the install script to have AI Shell open persistently by adding to the $PROFILE of the user Add profile integration option to AI Shell install script for persistent auto-start Jun 19, 2025
Copilot AI requested a review from StevenBucher98 June 19, 2025 22:24
@daxian-dbw daxian-dbw closed this Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a option during the install script to have AI Shell open persistently by adding to the $PROFILE of the user

3 participants