75 lines
3.2 KiB
PowerShell
75 lines
3.2 KiB
PowerShell
$ErrorActionPreference = 'Stop'
|
|
|
|
param(
|
|
[switch]$Quick
|
|
)
|
|
|
|
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
$RepoRoot = Split-Path -Parent $ScriptDir
|
|
$CanonicalHome = if ($env:COPILOT_RESOURCES_HOME) { $env:COPILOT_RESOURCES_HOME } else { Join-Path $HOME '.copilot-resources' }
|
|
$CopilotHome = if ($env:COPILOT_HOME) { $env:COPILOT_HOME } else { Join-Path $HOME '.copilot' }
|
|
$VscodeUserDir = if ($env:VSCODE_USER_DIR) { $env:VSCODE_USER_DIR } else { Join-Path $env:APPDATA 'Code\User' }
|
|
|
|
function Assert-Path {
|
|
param(
|
|
[string]$Label,
|
|
[string]$Path
|
|
)
|
|
|
|
if (Test-Path -LiteralPath $Path) {
|
|
Write-Host "[ok] $Label: $Path"
|
|
} else {
|
|
throw "Missing $Label: $Path"
|
|
}
|
|
}
|
|
|
|
function Assert-Command {
|
|
param(
|
|
[string]$Label,
|
|
[string]$CommandName
|
|
)
|
|
|
|
if (Get-Command $CommandName -ErrorAction SilentlyContinue) {
|
|
Write-Host "[ok] $Label: $CommandName"
|
|
} else {
|
|
throw "Missing $Label: $CommandName"
|
|
}
|
|
}
|
|
|
|
function Assert-ReadableFile {
|
|
param(
|
|
[string]$Label,
|
|
[string]$Path
|
|
)
|
|
|
|
if ((Test-Path -LiteralPath $Path -PathType Leaf) -and (Get-Item -LiteralPath $Path).PSIsContainer -eq $false) {
|
|
Write-Host "[ok] $Label: $Path"
|
|
} else {
|
|
throw "Unreadable $Label: $Path"
|
|
}
|
|
}
|
|
|
|
Assert-Path -Label 'repo root' -Path $RepoRoot
|
|
Assert-Path -Label 'canonical home' -Path $CanonicalHome
|
|
Assert-Path -Label 'skills link' -Path (Join-Path $CopilotHome 'skills')
|
|
Assert-Path -Label 'agents link' -Path (Join-Path $CopilotHome 'agents')
|
|
Assert-Path -Label 'instructions link' -Path (Join-Path $CopilotHome 'instructions')
|
|
Assert-Path -Label 'hooks link' -Path (Join-Path $CopilotHome 'hooks')
|
|
Assert-Path -Label 'session start hook' -Path (Join-Path $CanonicalHome 'resources\hooks\session-audit.json')
|
|
Assert-Path -Label 'session start hook script' -Path (Join-Path $CanonicalHome 'resources\scripts\report-hook-event.sh')
|
|
Assert-ReadableFile -Label 'session start hook script' -Path (Join-Path $CanonicalHome 'resources\scripts\report-hook-event.sh')
|
|
Assert-Command -Label 'session start hook shell' -CommandName 'bash'
|
|
Assert-Path -Label 'prompts link' -Path (Join-Path $VscodeUserDir 'prompts')
|
|
Assert-Path -Label 'VS Code MCP config' -Path (Join-Path $VscodeUserDir 'mcp.json')
|
|
Assert-Path -Label 'Copilot CLI MCP config' -Path (Join-Path $CopilotHome 'mcp-config.json')
|
|
Assert-Path -Label 'local MCP overrides' -Path (Join-Path $CanonicalHome '.local\mcp.local.jsonc')
|
|
|
|
if (-not $Quick) {
|
|
Assert-Path -Label 'VS Code settings template' -Path (Join-Path $RepoRoot 'config\vscode\settings.template.jsonc')
|
|
Assert-Path -Label 'CLI env template' -Path (Join-Path $RepoRoot 'config\copilot-cli\env.example.ps1')
|
|
Assert-Path -Label 'VS Code MCP template' -Path (Join-Path $RepoRoot 'config\mcp\vscode.mcp.template.jsonc')
|
|
Assert-Path -Label 'Copilot CLI MCP template' -Path (Join-Path $RepoRoot 'config\mcp\copilot-cli.mcp.template.jsonc')
|
|
Assert-Path -Label 'MCP local override example' -Path (Join-Path $RepoRoot 'config\mcp\local-overrides.example.jsonc')
|
|
Assert-Path -Label 'Copilot CLI filesystem wrapper' -Path (Join-Path $RepoRoot 'install\mcp\copilot-cli-filesystem-wrapper.mjs')
|
|
}
|