🛠️ Update various documentation, scripts, and configuration templates to enhance clarity, functionality, and maintainability across the project
This commit is contained in:
56
install/bootstrap.sh
Normal file → Executable file
56
install/bootstrap.sh
Normal file → Executable file
@@ -10,6 +10,9 @@ copilot_home="${COPILOT_HOME:-$HOME/.copilot}"
|
||||
managed_shell_env=""
|
||||
shell_rc_file=""
|
||||
vscode_settings_file=""
|
||||
vscode_mcp_file=""
|
||||
copilot_cli_mcp_file=""
|
||||
local_mcp_overrides_file=""
|
||||
|
||||
usage() {
|
||||
cat <<'EOF'
|
||||
@@ -163,6 +166,18 @@ EOF
|
||||
"$shell_block"
|
||||
}
|
||||
|
||||
ensure_local_mcp_overrides() {
|
||||
local example_file
|
||||
|
||||
local_mcp_overrides_file="$canonical_home/.local/mcp.local.jsonc"
|
||||
example_file="$canonical_home/config/mcp/local-overrides.example.jsonc"
|
||||
|
||||
ensure_parent_dir "$local_mcp_overrides_file"
|
||||
if [[ ! -f "$local_mcp_overrides_file" ]]; then
|
||||
cp -- "$example_file" "$local_mcp_overrides_file"
|
||||
fi
|
||||
}
|
||||
|
||||
merge_vscode_settings() {
|
||||
local node_bin
|
||||
vscode_settings_file="$vscode_user_dir/settings.json"
|
||||
@@ -180,6 +195,35 @@ merge_vscode_settings() {
|
||||
--set "COPILOT_RESOURCES_HOME=$canonical_home"
|
||||
}
|
||||
|
||||
merge_managed_mcp_config() {
|
||||
local node_bin
|
||||
|
||||
if ! node_bin="$(find_node_bin)"; then
|
||||
printf 'Skipping managed MCP config merge because Node.js is not available.\n' >&2
|
||||
return 0
|
||||
fi
|
||||
|
||||
vscode_mcp_file="$vscode_user_dir/mcp.json"
|
||||
copilot_cli_mcp_file="$copilot_home/mcp-config.json"
|
||||
|
||||
ensure_parent_dir "$vscode_mcp_file"
|
||||
ensure_parent_dir "$copilot_cli_mcp_file"
|
||||
|
||||
"$node_bin" "$script_dir/merge-managed-mcp-config.mjs" \
|
||||
--target "$vscode_mcp_file" \
|
||||
--template "$canonical_home/config/mcp/vscode.mcp.template.jsonc" \
|
||||
--server-key "servers" \
|
||||
--overrides "$local_mcp_overrides_file" \
|
||||
--set "COPILOT_RESOURCES_HOME=$canonical_home"
|
||||
|
||||
"$node_bin" "$script_dir/merge-managed-mcp-config.mjs" \
|
||||
--target "$copilot_cli_mcp_file" \
|
||||
--template "$canonical_home/config/mcp/copilot-cli.mcp.template.jsonc" \
|
||||
--server-key "mcpServers" \
|
||||
--overrides "$local_mcp_overrides_file" \
|
||||
--set "COPILOT_RESOURCES_HOME=$canonical_home"
|
||||
}
|
||||
|
||||
write_state() {
|
||||
mkdir -p -- "$state_dir"
|
||||
cat > "$state_dir/install-state.json" <<EOF
|
||||
@@ -189,6 +233,9 @@ write_state() {
|
||||
"copilotHome": "${copilot_home}",
|
||||
"vscodeUserDir": "${vscode_user_dir}",
|
||||
"vscodeSettingsFile": "${vscode_settings_file}",
|
||||
"vscodeMcpFile": "${vscode_mcp_file}",
|
||||
"copilotCliMcpFile": "${copilot_cli_mcp_file}",
|
||||
"mcpLocalOverridesFile": "${local_mcp_overrides_file}",
|
||||
"shellRcFile": "${shell_rc_file}",
|
||||
"managedShellEnv": "${managed_shell_env}",
|
||||
"bootstrapScript": "${script_dir}/bootstrap.sh"
|
||||
@@ -232,7 +279,9 @@ main() {
|
||||
link_path "$canonical_home/resources/prompts" "$vscode_user_dir/prompts"
|
||||
|
||||
write_managed_shell_env
|
||||
ensure_local_mcp_overrides
|
||||
merge_vscode_settings
|
||||
merge_managed_mcp_config
|
||||
|
||||
write_state
|
||||
|
||||
@@ -250,6 +299,10 @@ instructions, hooks, and prompts.
|
||||
Merged managed VS Code settings into:
|
||||
$vscode_settings_file
|
||||
|
||||
Merged managed MCP configuration into:
|
||||
$vscode_user_dir/mcp.json
|
||||
$copilot_home/mcp-config.json
|
||||
|
||||
Installed managed Copilot CLI shell environment into:
|
||||
$managed_shell_env
|
||||
|
||||
@@ -259,6 +312,9 @@ Linked shell startup file:
|
||||
Optional VS Code feature flags are available in:
|
||||
$canonical_home/config/vscode/settings.template.jsonc
|
||||
|
||||
Machine-local MCP overrides live in:
|
||||
$local_mcp_overrides_file
|
||||
|
||||
Optional Copilot CLI environment template is available in:
|
||||
$canonical_home/config/copilot-cli/env.example.sh
|
||||
EOF
|
||||
|
||||
Reference in New Issue
Block a user