Skip to content

Commit f382a40

Browse files
cirvine-MSFTCopilot
andcommitted
Add extension filtering to install scripts
Both scripts now accept optional extension names as arguments: ./install-extensions.sh ado-build-watcher .\install-extensions.ps1 ado-pr-watcher With no arguments, all extensions are installed (existing behavior). Invalid names produce a warning with available options. Shared lib/ is always installed regardless of filter. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent da12c4f commit f382a40

3 files changed

Lines changed: 59 additions & 2 deletions

File tree

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ cd copilot-toolkit
6464
./install-extensions.sh
6565
```
6666

67+
To install only specific extensions:
68+
69+
```bash
70+
./install-extensions.sh ado-build-watcher # just the build watcher
71+
.\install-extensions.ps1 ado-pr-watcher # just the PR watcher
72+
```
73+
6774
After installing, run `/clear` in the Copilot CLI or restart it to load the new extensions.
6875

6976
### Update

install-extensions.ps1

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# install-extensions.ps1 — Install Copilot CLI extensions from this repo
22
# Works on Windows PowerShell 5.1+ and pwsh 7+
3+
#
4+
# Usage:
5+
# .\install-extensions.ps1 # Install all extensions
6+
# .\install-extensions.ps1 ado-build-watcher # Install only ado-build-watcher
7+
# .\install-extensions.ps1 ado-pr-watcher ado-build-watcher # Install specific ones
8+
9+
param(
10+
[Parameter(ValueFromRemainingArguments)]
11+
[string[]]$Only
12+
)
313

414
$ErrorActionPreference = "Stop"
515

@@ -18,7 +28,20 @@ if (-not (Test-Path $sourceDir)) {
1828
exit 1
1929
}
2030

21-
$extensions = @("ado-pr-watcher", "ado-build-watcher")
31+
$allExtensions = @("ado-pr-watcher", "ado-build-watcher")
32+
if ($Only -and $Only.Count -gt 0) {
33+
$extensions = @($Only | Where-Object { $allExtensions -contains $_ })
34+
$invalid = @($Only | Where-Object { $allExtensions -notcontains $_ })
35+
if ($invalid.Count -gt 0) {
36+
Write-Warning "Unknown extension(s): $($invalid -join ', '). Available: $($allExtensions -join ', ')"
37+
}
38+
if ($extensions.Count -eq 0) {
39+
Write-Error "No valid extensions specified."
40+
exit 1
41+
}
42+
} else {
43+
$extensions = $allExtensions
44+
}
2245
$sharedDirs = @("lib")
2346
[string[]]$installed = @()
2447

install-extensions.sh

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
#!/usr/bin/env bash
22
# install-extensions.sh — Install Copilot CLI extensions from this repo
33
# Works on macOS and Linux
4+
#
5+
# Usage:
6+
# ./install-extensions.sh # Install all extensions
7+
# ./install-extensions.sh ado-build-watcher # Install only ado-build-watcher
8+
# ./install-extensions.sh ado-pr-watcher ado-build-watcher # Install specific ones
49

510
set -euo pipefail
611

@@ -16,7 +21,29 @@ if [ ! -d "$SOURCE_DIR" ]; then
1621
exit 1
1722
fi
1823

19-
EXTENSIONS=("ado-pr-watcher" "ado-build-watcher")
24+
ALL_EXTENSIONS=("ado-pr-watcher" "ado-build-watcher")
25+
26+
if [ $# -gt 0 ]; then
27+
EXTENSIONS=()
28+
for arg in "$@"; do
29+
found=0
30+
for valid in "${ALL_EXTENSIONS[@]}"; do
31+
if [ "$arg" = "$valid" ]; then found=1; break; fi
32+
done
33+
if [ "$found" -eq 1 ]; then
34+
EXTENSIONS+=("$arg")
35+
else
36+
echo "Warning: Unknown extension '$arg'. Available: ${ALL_EXTENSIONS[*]}"
37+
fi
38+
done
39+
if [ ${#EXTENSIONS[@]} -eq 0 ]; then
40+
echo "Error: No valid extensions specified." >&2
41+
exit 1
42+
fi
43+
else
44+
EXTENSIONS=("${ALL_EXTENSIONS[@]}")
45+
fi
46+
2047
SHARED_DIRS=("lib")
2148
INSTALLED=()
2249

0 commit comments

Comments
 (0)