Skip to content

Commit b4b505e

Browse files
committed
copilot command #766
1 parent 4af8859 commit b4b505e

File tree

19 files changed

+2173
-174
lines changed

19 files changed

+2173
-174
lines changed

.github/skills/code-simplifier/SKILL.md

Lines changed: 412 additions & 0 deletions
Large diffs are not rendered by default.

.github/skills/copilot-sdk/SKILL.md

Lines changed: 863 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,26 @@ azqr mcp --mode http --addr :8080
423423

424424
> For detailed MCP configuration, see the [Usage documentation](https://azure.github.io/azqr/docs/usage/).
425425
426+
### Copilot (AI Assistant)
427+
428+
Azure Quick Review includes an interactive AI assistant powered by GitHub Copilot for natural language interaction with azqr:
429+
430+
```bash
431+
# Start interactive AI assistant
432+
azqr copilot
433+
434+
# Use a specific model
435+
azqr copilot --model claude-sonnet-4.5
436+
437+
# Resume a previous session
438+
azqr copilot --resume <session-id>
439+
```
440+
441+
**Prerequisites:**
442+
1. [GitHub CLI](https://cli.github.com/) installed
443+
2. Authenticated: `gh auth login`
444+
3. Active GitHub Copilot subscription
445+
426446
## Filtering Recommendations and more
427447

428448
You can configure Azure Quick Review to include or exclude specific subscriptions or resource groups and also exclude services or recommendations. To do so, create a `yaml` file with the following format:

cmd/azqr/commands/copilot.go

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
4+
package commands
5+
6+
import (
7+
"github.com/Azure/azqr/internal/copilot"
8+
9+
"github.com/spf13/cobra"
10+
)
11+
12+
const defaultCopilotModel = "claude-sonnet-4.6"
13+
14+
var (
15+
copilotModel string
16+
copilotPrompt string
17+
)
18+
19+
func init() {
20+
copilotCmd.Flags().StringVar(&copilotModel, "model", defaultCopilotModel, "Copilot model to use (default: Claude Sonnet 4.6 Medium)")
21+
copilotCmd.Flags().StringVarP(&copilotPrompt, "prompt", "p", "", "Run a single prompt and print the response")
22+
copilotCmd.AddCommand(copilotModelsCmd)
23+
rootCmd.AddCommand(copilotCmd)
24+
}
25+
26+
var copilotModelsCmd = &cobra.Command{
27+
Use: "models",
28+
Short: "List available GitHub Copilot models",
29+
Args: cobra.NoArgs,
30+
RunE: func(cmd *cobra.Command, args []string) error {
31+
return copilot.ListModels()
32+
},
33+
}
34+
35+
var copilotCmd = &cobra.Command{
36+
Use: "copilot",
37+
Short: "Interactive AI assistant powered by GitHub Copilot",
38+
Long: `Start a conversational AI session powered by GitHub Copilot to interact with azqr.
39+
40+
This command connects to GitHub Copilot and enables natural language interaction
41+
with Azure Quick Review tools and capabilities.
42+
43+
Requirements:
44+
1. GitHub CLI installed (https://cli.github.com/)
45+
2. Authenticated: gh auth login
46+
3. GitHub Copilot subscription active
47+
48+
Examples:
49+
# Start interactive session
50+
azqr copilot
51+
52+
# Run a single prompt
53+
azqr copilot -p "Scan my Azure subscription for compliance issues"
54+
55+
# Use a specific model
56+
azqr copilot --model claude-sonnet-4.6`,
57+
Args: cobra.NoArgs,
58+
RunE: func(cmd *cobra.Command, args []string) error {
59+
return copilot.Run(copilotModel, copilotPrompt)
60+
},
61+
}

docs/content/en/docs/Usage/_index.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,38 @@ azqr show --file report.json --open
409409
azqr show --file report.xlsx --port 3000
410410
```
411411

412+
## Copilot (AI Assistant)
413+
414+
Azure Quick Review includes an interactive AI assistant powered by GitHub Copilot. This command starts a conversational TUI session that connects to GitHub Copilot and exposes azqr tools for natural language interaction.
415+
416+
### Prerequisites
417+
418+
1. [GitHub CLI](https://cli.github.com/) installed
419+
2. Authenticated: `gh auth login`
420+
3. Active GitHub Copilot subscription
421+
422+
### Starting the Assistant
423+
424+
```bash
425+
# Start interactive AI assistant
426+
azqr copilot
427+
428+
# Use a specific model (default: claude-sonnet-4.5)
429+
azqr copilot --model claude-sonnet-4.5
430+
431+
# Resume a previous session
432+
azqr copilot --resume <session-id>
433+
```
434+
### Available Tools
435+
436+
The assistant can invoke the following azqr tools:
437+
438+
- **scan** – Run Azure resource compliance scans
439+
- **get-recommendations-catalog** – View the azqr recommendations catalog
440+
- **get-supported-services** – List supported Azure services
441+
442+
It also has access to the [Microsoft Learn MCP server](https://learn.microsoft.com/api/mcp) for fetching official Azure documentation.
443+
412444
## MCP Server (Model Context Protocol)
413445

414446
Azure Quick Review includes a Model Context Protocol (MCP) server that enables AI assistants and tools to interact with azqr functionality. The MCP server can run in two modes:

go.mod

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ require (
1212
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups v1.2.0
1313
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor v0.11.0
1414
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/subscription/armsubscription v1.2.0
15+
github.com/charmbracelet/lipgloss v1.1.0
16+
github.com/chzyer/readline v1.5.1
17+
github.com/github/copilot-sdk/go v0.2.0
1518
github.com/gruntwork-io/terratest v0.56.0
1619
github.com/iancoleman/strcase v0.3.0
1720
github.com/mark3labs/mcp-go v0.45.0
@@ -26,14 +29,26 @@ require (
2629

2730
require (
2831
github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.2 // indirect
29-
github.com/AzureAD/microsoft-authentication-library-for-go v1.6.0 // indirect
32+
github.com/AzureAD/microsoft-authentication-library-for-go v1.7.0 // indirect
3033
github.com/agext/levenshtein v1.2.3 // indirect
3134
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
35+
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
3236
github.com/bahlo/generic-list-go v0.2.0 // indirect
3337
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
34-
github.com/buger/jsonparser v1.1.1 // indirect
38+
github.com/buger/jsonparser v1.1.2 // indirect
39+
github.com/cespare/xxhash/v2 v2.3.0 // indirect
40+
github.com/charmbracelet/colorprofile v0.4.1 // indirect
41+
github.com/charmbracelet/x/ansi v0.11.6 // indirect
42+
github.com/charmbracelet/x/cellbuf v0.0.15 // indirect
43+
github.com/charmbracelet/x/term v0.2.2 // indirect
44+
github.com/clipperhouse/displaywidth v0.9.0 // indirect
45+
github.com/clipperhouse/stringish v0.1.1 // indirect
46+
github.com/clipperhouse/uax29/v2 v2.5.0 // indirect
3547
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
48+
github.com/go-logr/logr v1.4.3 // indirect
49+
github.com/go-logr/stdr v1.2.2 // indirect
3650
github.com/golang-jwt/jwt/v5 v5.3.1 // indirect
51+
github.com/google/jsonschema-go v0.4.2 // indirect
3752
github.com/google/uuid v1.6.0 // indirect
3853
github.com/hashicorp/errwrap v1.1.0 // indirect
3954
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
@@ -46,20 +61,23 @@ require (
4661
github.com/inconshreveable/mousetrap v1.1.0 // indirect
4762
github.com/invopop/jsonschema v0.13.0 // indirect
4863
github.com/jinzhu/copier v0.4.0 // indirect
49-
github.com/klauspost/compress v1.18.4 // indirect
64+
github.com/klauspost/compress v1.18.5 // indirect
5065
github.com/kylelemons/godebug v1.1.0 // indirect
51-
github.com/mailru/easyjson v0.9.1 // indirect
66+
github.com/lucasb-eyer/go-colorful v1.3.0 // indirect
67+
github.com/mailru/easyjson v0.9.2 // indirect
5268
github.com/mattn/go-colorable v0.1.14 // indirect
5369
github.com/mattn/go-isatty v0.0.20 // indirect
70+
github.com/mattn/go-runewidth v0.0.19 // indirect
5471
github.com/mattn/go-zglob v0.0.6 // indirect
5572
github.com/mitchellh/go-homedir v1.1.0 // indirect
5673
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
5774
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
75+
github.com/muesli/termenv v0.16.0 // indirect
5876
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
5977
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
6078
github.com/richardlehane/mscfb v1.0.6 // indirect
6179
github.com/richardlehane/msoleps v1.0.6 // indirect
62-
github.com/rogpeppe/go-internal v1.14.1 // indirect
80+
github.com/rivo/uniseg v0.4.7 // indirect
6381
github.com/spf13/cast v1.10.0 // indirect
6482
github.com/spf13/pflag v1.0.10 // indirect
6583
github.com/tiendc/go-deepcopy v1.7.2 // indirect
@@ -68,15 +86,20 @@ require (
6886
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
6987
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
7088
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
89+
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
7190
github.com/xuri/efp v0.0.1 // indirect
7291
github.com/xuri/nfp v0.0.2-0.20250530014748-2ddeb826f9a9 // indirect
7392
github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
7493
github.com/zclconf/go-cty v1.18.0 // indirect
75-
golang.org/x/crypto v0.48.0 // indirect
76-
golang.org/x/mod v0.33.0 // indirect
77-
golang.org/x/net v0.51.0 // indirect
78-
golang.org/x/sync v0.19.0 // indirect
79-
golang.org/x/sys v0.41.0 // indirect
80-
golang.org/x/text v0.34.0 // indirect
81-
golang.org/x/tools v0.42.0 // indirect
94+
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
95+
go.opentelemetry.io/otel v1.42.0 // indirect
96+
go.opentelemetry.io/otel/metric v1.42.0 // indirect
97+
go.opentelemetry.io/otel/trace v1.42.0 // indirect
98+
golang.org/x/crypto v0.49.0 // indirect
99+
golang.org/x/mod v0.34.0 // indirect
100+
golang.org/x/net v0.52.0 // indirect
101+
golang.org/x/sync v0.20.0 // indirect
102+
golang.org/x/sys v0.42.0 // indirect
103+
golang.org/x/text v0.35.0 // indirect
104+
golang.org/x/tools v0.43.0 // indirect
82105
)

0 commit comments

Comments
 (0)