Skip to content

Commit 309753a

Browse files
CopilotJoannaaKL
andcommitted
Add compare-scopes command with tests
- Created compare_scopes.go with compare-scopes command - Fetches token scopes from GitHub API using pkg/scopes/fetcher - Compares with required scopes from inventory - Reports missing and extra scopes - Supports text and json output formats - Added comprehensive unit tests - Created script/compare-scopes wrapper script Co-authored-by: JoannaaKL <67866556+JoannaaKL@users.noreply.github.com>
1 parent 717eb50 commit 309753a

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

script/compare-scopes

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
#
3+
# Compare PAT token scopes with required scopes for enabled tools.
4+
#
5+
# Usage:
6+
# script/compare-scopes [--toolsets=...] [--token=...] [--output=text|json]
7+
#
8+
# The token can be provided via GITHUB_PERSONAL_ACCESS_TOKEN environment variable
9+
# or via the --token flag.
10+
#
11+
# Examples:
12+
# export GITHUB_PERSONAL_ACCESS_TOKEN=ghp_...
13+
# script/compare-scopes
14+
#
15+
# script/compare-scopes --toolsets=all --output=json
16+
# script/compare-scopes --token=ghp_... --toolsets=repos,issues
17+
#
18+
19+
set -e
20+
21+
cd "$(dirname "$0")/.."
22+
23+
# Build the server if it doesn't exist or is outdated
24+
if [ ! -f github-mcp-server ] || [ cmd/github-mcp-server/compare_scopes.go -nt github-mcp-server ]; then
25+
echo "Building github-mcp-server..." >&2
26+
go build -o github-mcp-server ./cmd/github-mcp-server
27+
fi
28+
29+
exec ./github-mcp-server compare-scopes "$@"

0 commit comments

Comments
 (0)