🛠️ Update various documentation, scripts, and configuration templates to enhance clarity, functionality, and maintainability across the project

This commit is contained in:
2026-05-04 10:56:41 +00:00
parent 1a2f1510bf
commit 31975e3088
41 changed files with 4184 additions and 133 deletions

View File

@@ -9,6 +9,9 @@ $VscodeUserDir = if ($env:VSCODE_USER_DIR) { $env:VSCODE_USER_DIR } else { Join-
$ManagedShellEnv = $null
$ProfilePath = $PROFILE.CurrentUserAllHosts
$VscodeSettingsFile = Join-Path $VscodeUserDir 'settings.json'
$VscodeMcpFile = Join-Path $VscodeUserDir 'mcp.json'
$CopilotCliMcpFile = Join-Path $CopilotHome 'mcp-config.json'
$LocalMcpOverridesFile = Join-Path $CanonicalHome '.local\mcp.local.jsonc'
function Resolve-Directory {
param([string]$Path)
@@ -127,6 +130,14 @@ function Write-ManagedPowerShellEnv {
-Body "if (Test-Path -LiteralPath $QuotedEnvPath) {`n . $QuotedEnvPath`n}"
}
function Ensure-LocalMcpOverrides {
$ExampleFile = Join-Path $CanonicalHome 'config\mcp\local-overrides.example.jsonc'
Ensure-Directory (Split-Path -Parent $LocalMcpOverridesFile)
if (-not (Test-Path -LiteralPath $LocalMcpOverridesFile)) {
Copy-Item -LiteralPath $ExampleFile -Destination $LocalMcpOverridesFile
}
}
function Merge-VscodeSettings {
$NodeExecutable = Find-NodeExecutable
if (-not $NodeExecutable) {
@@ -138,6 +149,20 @@ function Merge-VscodeSettings {
& $NodeExecutable (Join-Path $ScriptDir 'merge-vscode-settings.mjs') --target $VscodeSettingsFile --template (Join-Path $CanonicalHome 'config\vscode\settings.template.jsonc') --set "COPILOT_RESOURCES_HOME=$CanonicalHome"
}
function Merge-ManagedMcpConfig {
$NodeExecutable = Find-NodeExecutable
if (-not $NodeExecutable) {
Write-Warning 'Skipping managed MCP config merge because Node.js is not available.'
return
}
Ensure-Directory (Split-Path -Parent $VscodeMcpFile)
Ensure-Directory (Split-Path -Parent $CopilotCliMcpFile)
& $NodeExecutable (Join-Path $ScriptDir 'merge-managed-mcp-config.mjs') --target $VscodeMcpFile --template (Join-Path $CanonicalHome 'config\mcp\vscode.mcp.template.jsonc') --server-key servers --overrides $LocalMcpOverridesFile --set "COPILOT_RESOURCES_HOME=$CanonicalHome"
& $NodeExecutable (Join-Path $ScriptDir 'merge-managed-mcp-config.mjs') --target $CopilotCliMcpFile --template (Join-Path $CanonicalHome 'config\mcp\copilot-cli.mcp.template.jsonc') --server-key mcpServers --overrides $LocalMcpOverridesFile --set "COPILOT_RESOURCES_HOME=$CanonicalHome"
}
Ensure-Directory (Split-Path -Parent $CanonicalHome)
if (Test-Path -LiteralPath $CanonicalHome) {
if ((Resolve-Directory $CanonicalHome) -ne (Resolve-Directory $RepoRoot)) {
@@ -157,7 +182,9 @@ Ensure-Junction -Target (Join-Path $CanonicalHome 'resources\hooks') -Path (Join
Ensure-Junction -Target (Join-Path $CanonicalHome 'resources\prompts') -Path (Join-Path $VscodeUserDir 'prompts')
Write-ManagedPowerShellEnv
Ensure-LocalMcpOverrides
Merge-VscodeSettings
Merge-ManagedMcpConfig
Ensure-Directory $StateDir
@{
@@ -166,6 +193,9 @@ Ensure-Directory $StateDir
copilotHome = $CopilotHome
vscodeUserDir = $VscodeUserDir
vscodeSettingsFile = $VscodeSettingsFile
vscodeMcpFile = $VscodeMcpFile
copilotCliMcpFile = $CopilotCliMcpFile
mcpLocalOverridesFile = $LocalMcpOverridesFile
shellRcFile = $ProfilePath
managedShellEnv = $ManagedShellEnv
bootstrapScript = (Join-Path $ScriptDir 'bootstrap.ps1')
@@ -177,6 +207,9 @@ Write-Host "Repository root: $RepoRoot"
Write-Host "Copilot home: $CopilotHome"
Write-Host "VS Code user dir: $VscodeUserDir"
Write-Host "Merged managed VS Code settings into: $VscodeSettingsFile"
Write-Host "Merged managed MCP configuration into: $VscodeMcpFile"
Write-Host "Merged managed MCP configuration into: $CopilotCliMcpFile"
Write-Host "Installed managed Copilot CLI PowerShell environment into: $ManagedShellEnv"
Write-Host "Linked PowerShell profile: $ProfilePath"
Write-Host "Optional VS Code template: $(Join-Path $CanonicalHome 'config\vscode\settings.template.jsonc')"
Write-Host "Machine-local MCP overrides live in: $LocalMcpOverridesFile"