mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-02-20 01:59:50 +01:00
Compare commits
6 Commits
main
...
docs/skill
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a7aabac375 | ||
|
|
d37c37fa70 | ||
|
|
1789b23cd8 | ||
|
|
e4d1325c5c | ||
|
|
456fe207ca | ||
|
|
c32c5233ca |
@@ -1,5 +1,5 @@
|
||||
# yaml-language-server: $schema=https://aka.ms/configuration-dsc-schema/0.2
|
||||
# Reference: https://github.com/microsoft/PowerToys/blob/main/doc/devdocs/readme.md#getting-started
|
||||
# Reference: https://github.com/microsoft/PowerToys/blob/main/doc/devdocs/readme.md#compiling-powertoys
|
||||
properties:
|
||||
resources:
|
||||
- resource: Microsoft.Windows.Settings/WindowsSettings
|
||||
@@ -13,11 +13,11 @@ properties:
|
||||
- resource: Microsoft.WinGet.DSC/WinGetPackage
|
||||
id: vsPackage
|
||||
directives:
|
||||
description: Install Visual Studio 2026 Enterprise (Any edition will work)
|
||||
description: Install Visual Studio 2022 Enterprise (Any edition will work)
|
||||
# Requires elevation for the set operation
|
||||
securityContext: elevated
|
||||
settings:
|
||||
id: Microsoft.VisualStudio.Enterprise
|
||||
id: Microsoft.VisualStudio.2022.Enterprise
|
||||
source: winget
|
||||
- resource: Microsoft.VisualStudio.DSC/VSComponents
|
||||
dependsOn:
|
||||
@@ -29,7 +29,7 @@ properties:
|
||||
securityContext: elevated
|
||||
settings:
|
||||
productId: Microsoft.VisualStudio.Product.Enterprise
|
||||
channelId: VisualStudio.18.Release
|
||||
channelId: VisualStudio.17.Release
|
||||
vsConfigFile: '${WinGetConfigRoot}\..\.vsconfig'
|
||||
configurationVersion: 0.2.0
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# yaml-language-server: $schema=https://aka.ms/configuration-dsc-schema/0.2
|
||||
# Reference: https://github.com/microsoft/PowerToys/blob/main/doc/devdocs/readme.md#getting-started
|
||||
# Reference: https://github.com/microsoft/PowerToys/blob/main/doc/devdocs/readme.md#compiling-powertoys
|
||||
properties:
|
||||
resources:
|
||||
- resource: Microsoft.Windows.Settings/WindowsSettings
|
||||
@@ -13,11 +13,11 @@ properties:
|
||||
- resource: Microsoft.WinGet.DSC/WinGetPackage
|
||||
id: vsPackage
|
||||
directives:
|
||||
description: Install Visual Studio 2026 Professional (Any edition will work)
|
||||
description: Install Visual Studio 2022 Professional (Any edition will work)
|
||||
# Requires elevation for the set operation
|
||||
securityContext: elevated
|
||||
settings:
|
||||
id: Microsoft.VisualStudio.Professional
|
||||
id: Microsoft.VisualStudio.2022.Professional
|
||||
source: winget
|
||||
- resource: Microsoft.VisualStudio.DSC/VSComponents
|
||||
dependsOn:
|
||||
@@ -29,7 +29,7 @@ properties:
|
||||
securityContext: elevated
|
||||
settings:
|
||||
productId: Microsoft.VisualStudio.Product.Professional
|
||||
channelId: VisualStudio.18.Release
|
||||
channelId: VisualStudio.17.Release
|
||||
vsConfigFile: '${WinGetConfigRoot}\..\.vsconfig'
|
||||
configurationVersion: 0.2.0
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# yaml-language-server: $schema=https://aka.ms/configuration-dsc-schema/0.2
|
||||
# Reference: https://github.com/microsoft/PowerToys/blob/main/doc/devdocs/readme.md#getting-started
|
||||
# Reference: https://github.com/microsoft/PowerToys/blob/main/doc/devdocs/readme.md#compiling-powertoys
|
||||
properties:
|
||||
resources:
|
||||
- resource: Microsoft.Windows.Settings/WindowsSettings
|
||||
@@ -13,11 +13,11 @@ properties:
|
||||
- resource: Microsoft.WinGet.DSC/WinGetPackage
|
||||
id: vsPackage
|
||||
directives:
|
||||
description: Install Visual Studio 2026 Community (Any edition will work)
|
||||
description: Install Visual Studio 2022 Community (Any edition will work)
|
||||
# Requires elevation for the set operation
|
||||
securityContext: elevated
|
||||
settings:
|
||||
id: Microsoft.VisualStudio.Community
|
||||
id: Microsoft.VisualStudio.2022.Community
|
||||
source: winget
|
||||
- resource: Microsoft.VisualStudio.DSC/VSComponents
|
||||
dependsOn:
|
||||
@@ -29,7 +29,7 @@ properties:
|
||||
securityContext: elevated
|
||||
settings:
|
||||
productId: Microsoft.VisualStudio.Product.Community
|
||||
channelId: VisualStudio.18.Release
|
||||
channelId: VisualStudio.17.Release
|
||||
vsConfigFile: '${WinGetConfigRoot}\..\.vsconfig'
|
||||
configurationVersion: 0.2.0
|
||||
|
||||
|
||||
7
.github/actions/spell-check/allow/code.txt
vendored
7
.github/actions/spell-check/allow/code.txt
vendored
@@ -38,7 +38,6 @@ Gbps
|
||||
gcode
|
||||
Heatshrink
|
||||
Mbits
|
||||
Kbits
|
||||
MBs
|
||||
mkv
|
||||
msix
|
||||
@@ -98,7 +97,6 @@ Yubico
|
||||
Perplexity
|
||||
Groq
|
||||
svgl
|
||||
devhome
|
||||
|
||||
# KEYS
|
||||
|
||||
@@ -324,7 +322,6 @@ REGSTR
|
||||
|
||||
# Misc Win32 APIs and PInvokes
|
||||
INVOKEIDLIST
|
||||
MEMORYSTATUSEX
|
||||
|
||||
# PowerRename metadata pattern abbreviations (used in tests and regex patterns)
|
||||
DDDD
|
||||
@@ -345,7 +342,3 @@ reportbug
|
||||
#ffmpeg
|
||||
crf
|
||||
nostdin
|
||||
|
||||
# Performance counter keys
|
||||
engtype
|
||||
Nonpaged
|
||||
|
||||
4
.github/actions/spell-check/allow/names.txt
vendored
4
.github/actions/spell-check/allow/names.txt
vendored
@@ -192,7 +192,6 @@ ycv
|
||||
yeelam
|
||||
Yuniardi
|
||||
yuyoyuppe
|
||||
zadjii
|
||||
Zeol
|
||||
Zhao
|
||||
Zhaopeng
|
||||
@@ -207,7 +206,6 @@ Bilibili
|
||||
BVID
|
||||
capturevideosample
|
||||
cmdow
|
||||
Contoso
|
||||
Controlz
|
||||
cortana
|
||||
devhints
|
||||
@@ -230,7 +228,6 @@ regedit
|
||||
roslyn
|
||||
Skia
|
||||
Spotify
|
||||
taskmgr
|
||||
tldr
|
||||
Vanara
|
||||
wangyi
|
||||
@@ -246,3 +243,4 @@ xamlstyler
|
||||
Xavalon
|
||||
Xbox
|
||||
Youdao
|
||||
zadjii
|
||||
|
||||
3
.github/actions/spell-check/excludes.txt
vendored
3
.github/actions/spell-check/excludes.txt
vendored
@@ -111,7 +111,6 @@
|
||||
^src/modules/cmdpal/ext/SamplePagesExtension/Pages/SampleMarkdownImagesPage\.cs$
|
||||
^src/modules/cmdpal/Microsoft\.CmdPal\.UI/Settings/InternalPage\.SampleData\.cs$
|
||||
^src/modules/cmdpal/Tests/Microsoft\.CmdPal\.Core\.Common\.UnitTests/.*\.TestData\.cs$
|
||||
^src/modules/cmdpal/Tests/Microsoft\.CmdPal\.Core\.Common\.UnitTests/Text/.*\.cs$
|
||||
^src/modules/colorPicker/ColorPickerUI/Shaders/GridShader\.cso$
|
||||
^src/modules/launcher/Plugins/Microsoft\.PowerToys\.Run\.Plugin\.TimeDate/Properties/
|
||||
^src/modules/MouseUtils/MouseJumpUI/MainForm\.resx$
|
||||
@@ -143,5 +142,3 @@ ignore$
|
||||
^src/modules/registrypreview/RegistryPreviewUILib/Controls/HexBox/.*$
|
||||
^src/common/CalculatorEngineCommon/exprtk\.hpp$
|
||||
src/modules/cmdpal/ext/SamplePagesExtension/Pages/SampleMarkdownImagesPage.cs
|
||||
^src/modules/powerrename/unittests/testdata/avif_test\.avif$
|
||||
^src/modules/powerrename/unittests/testdata/heif_test\.heic$
|
||||
|
||||
939
.github/actions/spell-check/expect.txt
vendored
939
.github/actions/spell-check/expect.txt
vendored
File diff suppressed because it is too large
Load Diff
220
.github/skills/issue-fix/SKILL.md
vendored
Normal file
220
.github/skills/issue-fix/SKILL.md
vendored
Normal file
@@ -0,0 +1,220 @@
|
||||
---
|
||||
name: issue-fix
|
||||
description: Automatically fix GitHub issues and create PRs. Use when asked to fix an issue, implement a feature from an issue, auto-fix an issue, apply implementation plan, create code changes for an issue, resolve a GitHub issue, or submit a PR for an issue. Creates isolated git worktree, applies AI-generated fixes, commits changes, and creates pull requests.
|
||||
license: Complete terms in LICENSE.txt
|
||||
---
|
||||
|
||||
# Issue Fix Skill
|
||||
|
||||
Automatically fix GitHub issues by creating isolated worktrees, applying AI-generated code changes, and creating pull requests - the complete issue-to-PR workflow.
|
||||
|
||||
## Skill Contents
|
||||
|
||||
This skill is **self-contained** with all required resources:
|
||||
|
||||
```
|
||||
.github/skills/issue-fix/
|
||||
├── SKILL.md # This file
|
||||
├── LICENSE.txt # MIT License
|
||||
├── scripts/
|
||||
│ ├── Start-IssueAutoFix.ps1 # Main fix script (creates worktree, applies fix)
|
||||
│ ├── Start-IssueFixParallel.ps1 # Parallel runner (single terminal)
|
||||
│ ├── Get-WorktreeStatus.ps1 # Worktree status helper
|
||||
│ ├── Submit-IssueFix.ps1 # Commit and create PR
|
||||
│ └── IssueReviewLib.ps1 # Shared helpers
|
||||
└── references/
|
||||
├── fix-issue.prompt.md # AI prompt for fixing
|
||||
├── create-commit-title.prompt.md # AI prompt for commit messages
|
||||
├── create-pr-summary.prompt.md # AI prompt for PR descriptions
|
||||
└── mcp-config.json # MCP configuration
|
||||
```
|
||||
|
||||
## Output
|
||||
|
||||
- **Worktrees**: Created at drive root level `Q:/PowerToys-xxxx/`
|
||||
- **PRs**: Created on GitHub linking to the original issue
|
||||
- **Signal file**: `Generated Files/issueFix/<issue>/.signal`
|
||||
|
||||
## Signal File
|
||||
|
||||
On completion, a `.signal` file is created for orchestrator coordination:
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "success",
|
||||
"issueNumber": 45363,
|
||||
"timestamp": "2026-02-04T10:05:23Z",
|
||||
"worktreePath": "Q:/PowerToys-ab12"
|
||||
}
|
||||
```
|
||||
|
||||
Status values: `success`, `failure`
|
||||
|
||||
## When to Use This Skill
|
||||
|
||||
- Fix a specific GitHub issue automatically
|
||||
- Implement a feature described in an issue
|
||||
- Apply an existing implementation plan
|
||||
- Create code changes and submit PR for an issue
|
||||
- Auto-fix high-confidence issues end-to-end
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- GitHub CLI (`gh`) installed and authenticated
|
||||
- Issue must be reviewed first (use `issue-review` skill)
|
||||
- PowerShell 7+ for running scripts
|
||||
- Copilot CLI or Claude CLI installed
|
||||
|
||||
## Required Variables
|
||||
|
||||
| Variable | Description | Example |
|
||||
|----------|-------------|---------|
|
||||
| `{{IssueNumber}}` | GitHub issue number to fix | `44044` |
|
||||
|
||||
## Workflow
|
||||
|
||||
### Step 1: Ensure Issue is Reviewed
|
||||
|
||||
If not already reviewed, use the `issue-review` skill first.
|
||||
|
||||
### Step 2: Run Auto-Fix
|
||||
|
||||
```powershell
|
||||
# Create worktree and apply fix
|
||||
.github/skills/issue-fix/scripts/Start-IssueAutoFix.ps1 -IssueNumber {{IssueNumber}} -CLIType copilot -Force
|
||||
```
|
||||
|
||||
This will:
|
||||
1. Create a new git worktree with branch `issue/{{IssueNumber}}`
|
||||
2. Copy the review files to the worktree
|
||||
3. Launch Copilot CLI to implement the fix
|
||||
4. Build and verify the changes
|
||||
|
||||
### Step 3: Submit PR
|
||||
|
||||
```powershell
|
||||
# Commit changes and create PR
|
||||
.github/skills/issue-fix/scripts/Submit-IssueFix.ps1 -IssueNumber {{IssueNumber}} -CLIType copilot -Force
|
||||
```
|
||||
|
||||
This will:
|
||||
1. Generate AI commit message
|
||||
2. Commit all changes
|
||||
3. Push to origin
|
||||
4. Create PR with AI-generated description
|
||||
5. Link PR to issue with "Fixes #{{IssueNumber}}"
|
||||
|
||||
### One-Step Alternative
|
||||
|
||||
To fix AND submit in one command:
|
||||
|
||||
```powershell
|
||||
.github/skills/issue-fix/scripts/Start-IssueAutoFix.ps1 -IssueNumber {{IssueNumber}} -CLIType copilot -CreatePR -Force
|
||||
```
|
||||
|
||||
## CLI Options
|
||||
|
||||
### Start-IssueAutoFix.ps1
|
||||
|
||||
| Parameter | Description | Default |
|
||||
|-----------|-------------|---------|
|
||||
| `-IssueNumber` | Issue to fix | Required |
|
||||
| `-CLIType` | AI CLI: `copilot` or `claude` | `copilot` |
|
||||
| `-Model` | Copilot model (e.g., `gpt-5.2-codex`) | (optional) |
|
||||
| `-CreatePR` | Auto-create PR after fix | `false` |
|
||||
| `-SkipWorktree` | Fix in current repo (no worktree) | `false` |
|
||||
| `-Force` | Skip confirmation prompts | `false` |
|
||||
|
||||
### Submit-IssueFix.ps1
|
||||
|
||||
| Parameter | Description | Default |
|
||||
|-----------|-------------|---------|
|
||||
| `-IssueNumber` | Issue to submit | Required |
|
||||
| `-CLIType` | AI CLI: `copilot`, `claude`, `manual` | `copilot` |
|
||||
| `-Draft` | Create as draft PR | `false` |
|
||||
| `-SkipCommit` | Skip commit (changes already committed) | `false` |
|
||||
| `-Force` | Skip confirmation prompts | `false` |
|
||||
|
||||
## Batch Processing
|
||||
|
||||
Fix multiple issues:
|
||||
|
||||
```powershell
|
||||
# Fix multiple issues (creates worktrees, applies fixes)
|
||||
.github/skills/issue-fix/scripts/Start-IssueAutoFix.ps1 -IssueNumbers 44044, 32950 -CLIType copilot -Force
|
||||
|
||||
# Submit all fixed issues as PRs
|
||||
.github/skills/issue-fix/scripts/Submit-IssueFix.ps1 -CLIType copilot -Force
|
||||
```
|
||||
|
||||
## Parallel Execution (IMPORTANT)
|
||||
|
||||
**DO NOT** spawn separate terminals for each issue. Use the dedicated scripts:
|
||||
|
||||
```powershell
|
||||
# Run fixes in parallel (single terminal)
|
||||
.github/skills/issue-fix/scripts/Start-IssueFixParallel.ps1 -IssueNumbers 28726,13336,27507,3054,37800 -CLIType copilot -ThrottleLimit 5 -Force
|
||||
|
||||
# Check worktree status
|
||||
.github/skills/issue-fix/scripts/Get-WorktreeStatus.ps1
|
||||
```
|
||||
|
||||
This allows:
|
||||
- Tracking all jobs in one place
|
||||
- Waiting for completion with proper synchronization
|
||||
- Controlling parallelism with `-ThrottleLimit`
|
||||
- Combined output visibility
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
| Problem | Solution |
|
||||
|---------|----------|
|
||||
| Worktree already exists | Use existing worktree or `git worktree remove <path>` |
|
||||
| No implementation plan | Use `issue-review` skill first |
|
||||
| Build failures | Check build logs, may need manual intervention |
|
||||
| PR already exists | Script will skip, check existing PR |
|
||||
| CLI not found | Install Copilot CLI |
|
||||
|
||||
## PR Creation Requirements (CRITICAL)
|
||||
|
||||
**NEVER create PRs with placeholder/stub code.** Every PR must have:
|
||||
|
||||
1. **Real implementation** - Actual working code that addresses the issue
|
||||
2. **Proper title** - Follow `create-commit-title.prompt.md` (Conventional Commits)
|
||||
3. **Full description** - Follow `create-pr-summary.prompt.md` based on actual diff
|
||||
|
||||
### PR Title Format (Conventional Commits)
|
||||
```
|
||||
feat(module): add feature description
|
||||
fix(module): fix bug description
|
||||
docs(module): update documentation
|
||||
```
|
||||
|
||||
### PR Description Must Include
|
||||
- Summary of changes (from actual diff)
|
||||
- `Fixes #IssueNumber` link
|
||||
- Checklist items marked appropriately
|
||||
- Validation steps performed
|
||||
|
||||
**Example of BAD PR (never do this):**
|
||||
```
|
||||
Title: fix: address issue #12345
|
||||
Body: Fixes #12345
|
||||
Code: class Fix12345 { public void Apply() { } } // EMPTY STUB!
|
||||
```
|
||||
|
||||
**Example of GOOD PR:**
|
||||
```
|
||||
Title: feat(peek): add symbolic link resolution for PDF/HTML files
|
||||
Body: ## Summary
|
||||
Adds SymlinkResolver helper to resolve symlinks...
|
||||
[Full description based on create-pr-summary.prompt.md]
|
||||
```
|
||||
|
||||
## Related Skills
|
||||
|
||||
| Skill | Purpose |
|
||||
|-------|---------|
|
||||
| `issue-review` | Review issues, generate implementation plans |
|
||||
| `pr-review` | Review the created PR |
|
||||
| `pr-fix` | Fix PR review comments |
|
||||
22
.github/skills/issue-fix/scripts/Get-WorktreeStatus.ps1
vendored
Normal file
22
.github/skills/issue-fix/scripts/Get-WorktreeStatus.ps1
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Show commit/uncommitted status for issue/* worktrees.
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
param()
|
||||
|
||||
$repoRoot = Resolve-Path (Join-Path $PSScriptRoot '..\..\..\..')
|
||||
Set-Location $repoRoot
|
||||
|
||||
git worktree list | Select-String "issue/" | ForEach-Object {
|
||||
$path = ($_ -split "\s+")[0]
|
||||
$branch = ($_ -split "\s+")[2] -replace "\[|\]",""
|
||||
$ahead = (git -C $path rev-list main..HEAD --count 2>$null)
|
||||
$uncommitted = (git -C $path status --porcelain 2>$null | Measure-Object).Count
|
||||
[pscustomobject]@{
|
||||
Branch = $branch
|
||||
CommitsAhead = $ahead
|
||||
Uncommitted = $uncommitted
|
||||
Path = $path
|
||||
}
|
||||
}
|
||||
562
.github/skills/issue-fix/scripts/Start-IssueAutoFix.ps1
vendored
Normal file
562
.github/skills/issue-fix/scripts/Start-IssueAutoFix.ps1
vendored
Normal file
@@ -0,0 +1,562 @@
|
||||
<#!
|
||||
.SYNOPSIS
|
||||
Auto-fix high-confidence issues using worktrees and AI CLI.
|
||||
|
||||
.DESCRIPTION
|
||||
Finds issues with high confidence scores from the review results, creates worktrees
|
||||
for each, copies the Generated Files, and kicks off the FixIssue agent to implement fixes.
|
||||
|
||||
.PARAMETER IssueNumber
|
||||
Specific issue number to fix. If not specified, finds high-confidence issues automatically.
|
||||
|
||||
.PARAMETER MinFeasibilityScore
|
||||
Minimum Technical Feasibility score (0-100). Default: 70.
|
||||
|
||||
.PARAMETER MinClarityScore
|
||||
Minimum Requirement Clarity score (0-100). Default: 60.
|
||||
|
||||
.PARAMETER MaxEffortDays
|
||||
Maximum effort estimate in days. Default: 2 (Small fixes).
|
||||
|
||||
.PARAMETER MaxParallel
|
||||
Maximum parallel fix jobs. Default: 5 (worktrees are resource-intensive).
|
||||
|
||||
.PARAMETER CLIType
|
||||
AI CLI to use: claude, gh-copilot, or vscode. Auto-detected if not specified.
|
||||
|
||||
.PARAMETER Model
|
||||
Copilot CLI model to use (e.g., gpt-5.2-codex).
|
||||
|
||||
.PARAMETER DryRun
|
||||
List issues without starting fixes.
|
||||
|
||||
.PARAMETER SkipWorktree
|
||||
Fix in the current repository instead of creating worktrees (useful for single issue).
|
||||
|
||||
.PARAMETER VSCodeProfile
|
||||
VS Code profile to use when opening worktrees. Default: Default.
|
||||
|
||||
.PARAMETER AutoCommit
|
||||
Automatically commit changes after successful fix.
|
||||
|
||||
.PARAMETER CreatePR
|
||||
Automatically create a pull request after successful fix.
|
||||
|
||||
.EXAMPLE
|
||||
# Fix a specific issue
|
||||
./Start-IssueAutoFix.ps1 -IssueNumber 12345
|
||||
|
||||
.EXAMPLE
|
||||
# Find and fix all high-confidence issues (dry run)
|
||||
./Start-IssueAutoFix.ps1 -DryRun
|
||||
|
||||
.EXAMPLE
|
||||
# Fix issues with very high confidence
|
||||
./Start-IssueAutoFix.ps1 -MinFeasibilityScore 80 -MinClarityScore 70 -MaxEffortDays 1
|
||||
|
||||
.EXAMPLE
|
||||
# Fix single issue in current repo (no worktree)
|
||||
./Start-IssueAutoFix.ps1 -IssueNumber 12345 -SkipWorktree
|
||||
|
||||
.NOTES
|
||||
Prerequisites:
|
||||
- Run Start-BulkIssueReview.ps1 first to generate review files
|
||||
- GitHub CLI (gh) authenticated
|
||||
- Claude Code CLI or VS Code with Copilot
|
||||
|
||||
Results:
|
||||
- Worktrees created at ../<RepoName>-<hash>/
|
||||
- Generated Files copied to each worktree
|
||||
- Fix agent invoked in each worktree
|
||||
#>
|
||||
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[int]$IssueNumber,
|
||||
|
||||
[int]$MinFeasibilityScore = 70,
|
||||
|
||||
[int]$MinClarityScore = 60,
|
||||
|
||||
[int]$MaxEffortDays = 2,
|
||||
|
||||
[int]$MaxParallel = 5,
|
||||
|
||||
[ValidateSet('claude', 'copilot', 'gh-copilot', 'vscode', 'auto')]
|
||||
[string]$CLIType = 'auto',
|
||||
|
||||
[string]$Model,
|
||||
|
||||
[switch]$DryRun,
|
||||
|
||||
[switch]$SkipWorktree,
|
||||
|
||||
[Alias('Profile')]
|
||||
[string]$VSCodeProfile = 'Default',
|
||||
|
||||
[switch]$AutoCommit,
|
||||
|
||||
[switch]$CreatePR,
|
||||
|
||||
[switch]$Force,
|
||||
|
||||
[switch]$Help
|
||||
)
|
||||
|
||||
# Load libraries
|
||||
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
. "$scriptDir/IssueReviewLib.ps1"
|
||||
|
||||
# Load worktree library from tools/build
|
||||
$repoRoot = Get-RepoRoot
|
||||
$worktreeLib = Join-Path $repoRoot 'tools/build/WorktreeLib.ps1'
|
||||
if (Test-Path $worktreeLib) {
|
||||
. $worktreeLib
|
||||
}
|
||||
|
||||
# Show help
|
||||
if ($Help) {
|
||||
Get-Help $MyInvocation.MyCommand.Path -Full
|
||||
return
|
||||
}
|
||||
|
||||
function Start-IssueFixInWorktree {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Analyze implementation plan and either take action or create worktree for fix.
|
||||
.DESCRIPTION
|
||||
First analyzes the implementation plan to determine if:
|
||||
- Issue is already resolved (close it)
|
||||
- Issue needs clarification (add comment)
|
||||
- Issue is a duplicate (close as duplicate)
|
||||
- Issue is ready to implement (create worktree and fix)
|
||||
#>
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
[int]$IssueNumber,
|
||||
[Parameter(Mandatory)]
|
||||
[string]$SourceRepoRoot,
|
||||
[string]$CLIType = 'claude',
|
||||
[string]$Model,
|
||||
[string]$VSCodeProfile = 'Default',
|
||||
[switch]$SkipWorktree,
|
||||
[switch]$DryRun
|
||||
)
|
||||
|
||||
$issueReviewPath = Get-IssueReviewPath -RepoRoot $SourceRepoRoot -IssueNumber $IssueNumber
|
||||
$overviewPath = Join-Path $issueReviewPath 'overview.md'
|
||||
$implPlanPath = Join-Path $issueReviewPath 'implementation-plan.md'
|
||||
|
||||
# Verify review files exist
|
||||
if (-not (Test-Path $overviewPath)) {
|
||||
throw "No overview.md found for issue #$IssueNumber. Run Start-BulkIssueReview.ps1 first."
|
||||
}
|
||||
if (-not (Test-Path $implPlanPath)) {
|
||||
throw "No implementation-plan.md found for issue #$IssueNumber. Run Start-BulkIssueReview.ps1 first."
|
||||
}
|
||||
|
||||
# =====================================
|
||||
# STEP 1: Analyze the implementation plan
|
||||
# =====================================
|
||||
Info "Analyzing implementation plan for issue #$IssueNumber..."
|
||||
$planStatus = Get-ImplementationPlanStatus -ImplementationPlanPath $implPlanPath
|
||||
|
||||
# =====================================
|
||||
# STEP 2: Execute the recommended action
|
||||
# =====================================
|
||||
$actionResult = Invoke-ImplementationPlanAction -IssueNumber $IssueNumber -PlanStatus $planStatus -DryRun:$DryRun
|
||||
|
||||
# If we shouldn't proceed with fix, return early
|
||||
if (-not $actionResult.ShouldProceedWithFix) {
|
||||
return @{
|
||||
IssueNumber = $IssueNumber
|
||||
WorktreePath = $null
|
||||
Success = $actionResult.Success
|
||||
ActionTaken = $actionResult.ActionTaken
|
||||
SkippedCodeFix = $true
|
||||
}
|
||||
}
|
||||
|
||||
# =====================================
|
||||
# STEP 3: Proceed with code fix
|
||||
# =====================================
|
||||
|
||||
$workingDir = $SourceRepoRoot
|
||||
|
||||
if (-not $SkipWorktree) {
|
||||
# Use the simplified New-WorktreeFromIssue.cmd which only needs issue number
|
||||
$worktreeCmd = Join-Path $SourceRepoRoot 'tools/build/New-WorktreeFromIssue.cmd'
|
||||
|
||||
Info "Creating worktree for issue #$IssueNumber..."
|
||||
|
||||
# Call the cmd script with issue number and -NoVSCode for automation
|
||||
& cmd /c $worktreeCmd $IssueNumber -NoVSCode
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Failed to create worktree for issue #$IssueNumber"
|
||||
}
|
||||
|
||||
# Find the created worktree
|
||||
$entries = Get-WorktreeEntries
|
||||
$worktreeEntry = $entries | Where-Object { $_.Branch -like "issue/$IssueNumber*" } | Select-Object -First 1
|
||||
|
||||
if (-not $worktreeEntry) {
|
||||
throw "Failed to find worktree for issue #$IssueNumber"
|
||||
}
|
||||
|
||||
$workingDir = $worktreeEntry.Path
|
||||
Info "Worktree created at: $workingDir"
|
||||
|
||||
# Copy Generated Files to worktree
|
||||
Info "Copying review files to worktree..."
|
||||
$destReviewPath = Copy-IssueReviewToWorktree -IssueNumber $IssueNumber -SourceRepoRoot $SourceRepoRoot -WorktreePath $workingDir
|
||||
Info "Review files copied to: $destReviewPath"
|
||||
|
||||
# Copy .github/skills folder to worktree (needed for MCP config)
|
||||
$sourceSkillsPath = Join-Path $SourceRepoRoot '.github/skills'
|
||||
$destSkillsPath = Join-Path $workingDir '.github/skills'
|
||||
if (Test-Path $sourceSkillsPath) {
|
||||
$destGithubPath = Join-Path $workingDir '.github'
|
||||
if (-not (Test-Path $destGithubPath)) {
|
||||
New-Item -ItemType Directory -Path $destGithubPath -Force | Out-Null
|
||||
}
|
||||
Copy-Item -Path $sourceSkillsPath -Destination $destGithubPath -Recurse -Force
|
||||
Info "Copied .github/skills to worktree"
|
||||
}
|
||||
}
|
||||
|
||||
# Build the prompt for the fix agent
|
||||
$prompt = @"
|
||||
You are the FixIssue agent. Fix GitHub issue #$IssueNumber.
|
||||
|
||||
The implementation plan is at: Generated Files/issueReview/$IssueNumber/implementation-plan.md
|
||||
The overview is at: Generated Files/issueReview/$IssueNumber/overview.md
|
||||
|
||||
Follow the implementation plan exactly. Build and verify after each change.
|
||||
"@
|
||||
|
||||
# Start the fix agent
|
||||
Info "Starting fix agent for issue #$IssueNumber in $workingDir..."
|
||||
|
||||
# MCP config for github-artifacts tools (relative to repo root)
|
||||
$mcpConfig = '@.github/skills/issue-fix/references/mcp-config.json'
|
||||
|
||||
switch ($CLIType) {
|
||||
'copilot' {
|
||||
# GitHub Copilot CLI (standalone copilot command)
|
||||
# -p: Non-interactive prompt mode (exits after completion)
|
||||
# --yolo: Enable all permissions for automated execution
|
||||
# -s: Silent mode - output only agent response
|
||||
# --additional-mcp-config: Load github-artifacts MCP for image/attachment analysis
|
||||
$copilotArgs = @(
|
||||
'--additional-mcp-config', $mcpConfig,
|
||||
'-p', $prompt,
|
||||
'--yolo',
|
||||
'-s'
|
||||
)
|
||||
if ($Model) {
|
||||
$copilotArgs += @('--model', $Model)
|
||||
}
|
||||
Info "Running: copilot $($copilotArgs -join ' ')"
|
||||
Push-Location $workingDir
|
||||
try {
|
||||
& copilot @copilotArgs
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Warn "Copilot exited with code $LASTEXITCODE"
|
||||
}
|
||||
} finally {
|
||||
Pop-Location
|
||||
}
|
||||
}
|
||||
'claude' {
|
||||
$claudeArgs = @(
|
||||
'--print',
|
||||
'--dangerously-skip-permissions',
|
||||
'--prompt', $prompt
|
||||
)
|
||||
Start-Process -FilePath 'claude' -ArgumentList $claudeArgs -WorkingDirectory $workingDir -Wait -NoNewWindow
|
||||
}
|
||||
'gh-copilot' {
|
||||
# Use GitHub Copilot CLI via gh extension
|
||||
# gh copilot suggest requires interactive mode, so we open VS Code with the prompt
|
||||
Info "GitHub Copilot CLI detected. Opening VS Code with prompt..."
|
||||
|
||||
# Create a prompt file in the worktree for easy access
|
||||
$promptFile = Join-Path $workingDir "Generated Files/issueReview/$IssueNumber/fix-prompt.md"
|
||||
$promptContent = @"
|
||||
# Fix Issue #$IssueNumber
|
||||
|
||||
## Instructions
|
||||
|
||||
$prompt
|
||||
|
||||
## Quick Start
|
||||
|
||||
1. Read the implementation plan: ``Generated Files/issueReview/$IssueNumber/implementation-plan.md``
|
||||
2. Read the overview: ``Generated Files/issueReview/$IssueNumber/overview.md``
|
||||
3. Follow the plan step by step
|
||||
4. Build and test after each change
|
||||
"@
|
||||
Set-Content -Path $promptFile -Value $promptContent -Force
|
||||
|
||||
# Open VS Code with the worktree
|
||||
code --new-window $workingDir --profile $VSCodeProfile
|
||||
Info "VS Code opened at $workingDir"
|
||||
Info "Prompt file created at: $promptFile"
|
||||
Info "Use GitHub Copilot in VS Code to implement the fix."
|
||||
}
|
||||
'vscode' {
|
||||
# Open VS Code and let user manually trigger the fix
|
||||
code --new-window $workingDir --profile $VSCodeProfile
|
||||
Info "VS Code opened at $workingDir. Use Copilot to implement the fix."
|
||||
}
|
||||
default {
|
||||
Warn "CLI type '$CLIType' not fully supported for auto-fix. Opening VS Code..."
|
||||
code --new-window $workingDir --profile $VSCodeProfile
|
||||
}
|
||||
}
|
||||
|
||||
# Check if any changes were actually made
|
||||
$hasChanges = $false
|
||||
Push-Location $workingDir
|
||||
try {
|
||||
$uncommitted = git status --porcelain 2>$null
|
||||
$commitsAhead = git rev-list main..HEAD --count 2>$null
|
||||
if ($uncommitted -or ($commitsAhead -gt 0)) {
|
||||
$hasChanges = $true
|
||||
}
|
||||
} finally {
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
return @{
|
||||
IssueNumber = $IssueNumber
|
||||
WorktreePath = $workingDir
|
||||
Success = $true
|
||||
ActionTaken = 'CodeFixAttempted'
|
||||
SkippedCodeFix = $false
|
||||
HasChanges = $hasChanges
|
||||
}
|
||||
}
|
||||
|
||||
#region Main Script
|
||||
try {
|
||||
Info "Repository root: $repoRoot"
|
||||
|
||||
# Detect or validate CLI
|
||||
if ($CLIType -eq 'auto') {
|
||||
$cli = Get-AvailableCLI
|
||||
if ($cli) {
|
||||
$CLIType = $cli.Type
|
||||
Info "Auto-detected CLI: $($cli.Name)"
|
||||
} else {
|
||||
$CLIType = 'vscode'
|
||||
Info "No CLI detected, will use VS Code"
|
||||
}
|
||||
}
|
||||
|
||||
# Find issues to fix
|
||||
$issuesToFix = @()
|
||||
|
||||
if ($IssueNumber) {
|
||||
# Single issue specified
|
||||
$reviewResult = Get-IssueReviewResult -IssueNumber $IssueNumber -RepoRoot $repoRoot
|
||||
if (-not $reviewResult.HasOverview -or -not $reviewResult.HasImplementationPlan) {
|
||||
throw "Issue #$IssueNumber does not have review files. Run Start-BulkIssueReview.ps1 first."
|
||||
}
|
||||
$issuesToFix += @{
|
||||
IssueNumber = $IssueNumber
|
||||
OverviewPath = $reviewResult.OverviewPath
|
||||
ImplementationPlanPath = $reviewResult.ImplementationPlanPath
|
||||
}
|
||||
} else {
|
||||
# Find high-confidence issues
|
||||
Info "`nSearching for high-confidence issues..."
|
||||
Info " Min Feasibility Score: $MinFeasibilityScore"
|
||||
Info " Min Clarity Score: $MinClarityScore"
|
||||
Info " Max Effort: $MaxEffortDays days"
|
||||
|
||||
$highConfidence = Get-HighConfidenceIssues `
|
||||
-RepoRoot $repoRoot `
|
||||
-MinFeasibilityScore $MinFeasibilityScore `
|
||||
-MinClarityScore $MinClarityScore `
|
||||
-MaxEffortDays $MaxEffortDays
|
||||
|
||||
if ($highConfidence.Count -eq 0) {
|
||||
Warn "No high-confidence issues found matching criteria."
|
||||
Info "Try lowering the score thresholds or increasing MaxEffortDays."
|
||||
return
|
||||
}
|
||||
|
||||
$issuesToFix = $highConfidence
|
||||
}
|
||||
|
||||
Info "`nIssues ready for auto-fix: $($issuesToFix.Count)"
|
||||
Info ("-" * 80)
|
||||
foreach ($issue in $issuesToFix) {
|
||||
$scores = ""
|
||||
if ($issue.FeasibilityScore) {
|
||||
$scores = " [Feasibility: $($issue.FeasibilityScore), Clarity: $($issue.ClarityScore), Effort: $($issue.EffortDays)d]"
|
||||
}
|
||||
Info ("#{0,-6}{1}" -f $issue.IssueNumber, $scores)
|
||||
}
|
||||
Info ("-" * 80)
|
||||
|
||||
# In DryRun mode, still analyze plans but don't take action
|
||||
if ($DryRun) {
|
||||
Info "`nAnalyzing implementation plans (dry run)..."
|
||||
foreach ($issue in $issuesToFix) {
|
||||
$implPlanPath = Join-Path (Get-IssueReviewPath -RepoRoot $repoRoot -IssueNumber $issue.IssueNumber) 'implementation-plan.md'
|
||||
if (Test-Path $implPlanPath) {
|
||||
$planStatus = Get-ImplementationPlanStatus -ImplementationPlanPath $implPlanPath
|
||||
$color = switch ($planStatus.Action) {
|
||||
'ImplementFix' { 'Green' }
|
||||
'CloseIssue' { 'Yellow' }
|
||||
'AddComment' { 'Cyan' }
|
||||
'LinkDuplicate' { 'Magenta' }
|
||||
default { 'Gray' }
|
||||
}
|
||||
Write-Host (" #{0,-6} [{1,-20}] -> {2}" -f $issue.IssueNumber, $planStatus.Status, $planStatus.Action) -ForegroundColor $color
|
||||
if ($planStatus.RelatedPR) {
|
||||
$prInfo = "PR #$($planStatus.RelatedPR)"
|
||||
if ($planStatus.ReleasedIn) {
|
||||
$prInfo += " (released in $($planStatus.ReleasedIn))"
|
||||
} elseif ($planStatus.Status -eq 'FixedButUnreleased') {
|
||||
$prInfo += " (merged, awaiting release)"
|
||||
}
|
||||
Write-Host " $prInfo" -ForegroundColor DarkGray
|
||||
}
|
||||
if ($planStatus.DuplicateOf) {
|
||||
Write-Host " Duplicate of #$($planStatus.DuplicateOf)" -ForegroundColor DarkGray
|
||||
}
|
||||
}
|
||||
}
|
||||
Warn "`nDry run mode - no actions taken."
|
||||
return
|
||||
}
|
||||
|
||||
# Confirm before proceeding (skip if -Force)
|
||||
if (-not $Force) {
|
||||
$confirm = Read-Host "`nProceed with fixing $($issuesToFix.Count) issues? (y/N)"
|
||||
if ($confirm -notmatch '^[yY]') {
|
||||
Info "Cancelled."
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
# Process issues
|
||||
$results = @{
|
||||
Succeeded = @()
|
||||
Failed = @()
|
||||
AlreadyResolved = @()
|
||||
AwaitingRelease = @()
|
||||
NeedsClarification = @()
|
||||
Duplicates = @()
|
||||
NoChanges = @()
|
||||
}
|
||||
|
||||
foreach ($issue in $issuesToFix) {
|
||||
try {
|
||||
Info "`n" + ("=" * 60)
|
||||
Info "PROCESSING ISSUE #$($issue.IssueNumber)"
|
||||
Info ("=" * 60)
|
||||
|
||||
$result = Start-IssueFixInWorktree `
|
||||
-IssueNumber $issue.IssueNumber `
|
||||
-SourceRepoRoot $repoRoot `
|
||||
-CLIType $CLIType `
|
||||
-Model $Model `
|
||||
-VSCodeProfile $VSCodeProfile `
|
||||
-SkipWorktree:$SkipWorktree `
|
||||
-DryRun:$DryRun
|
||||
|
||||
if ($result.SkippedCodeFix) {
|
||||
# Action was taken but no code fix (e.g., closed issue, added comment)
|
||||
switch -Wildcard ($result.ActionTaken) {
|
||||
'*Closing*' { $results.AlreadyResolved += $issue.IssueNumber }
|
||||
'*clarification*' { $results.NeedsClarification += $issue.IssueNumber }
|
||||
'*duplicate*' { $results.Duplicates += $issue.IssueNumber }
|
||||
'*merged*awaiting*' { $results.AwaitingRelease += $issue.IssueNumber }
|
||||
'*merged but not yet released*' { $results.AwaitingRelease += $issue.IssueNumber }
|
||||
default { $results.Succeeded += $issue.IssueNumber }
|
||||
}
|
||||
Success "✓ Issue #$($issue.IssueNumber) handled: $($result.ActionTaken)"
|
||||
}
|
||||
elseif ($result.HasChanges) {
|
||||
$results.Succeeded += $issue.IssueNumber
|
||||
Success "✓ Issue #$($issue.IssueNumber) fix completed with changes"
|
||||
}
|
||||
else {
|
||||
$results.NoChanges += $issue.IssueNumber
|
||||
Warn "⚠ Issue #$($issue.IssueNumber) fix ran but no code changes were made"
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Err "✗ Issue #$($issue.IssueNumber) failed: $($_.Exception.Message)"
|
||||
$results.Failed += $issue.IssueNumber
|
||||
}
|
||||
}
|
||||
|
||||
# Summary
|
||||
Info "`n" + ("=" * 80)
|
||||
Info "AUTO-FIX COMPLETE"
|
||||
Info ("=" * 80)
|
||||
Info "Total issues: $($issuesToFix.Count)"
|
||||
if ($results.Succeeded.Count -gt 0) {
|
||||
Success "Code fixes: $($results.Succeeded.Count)"
|
||||
}
|
||||
if ($results.AlreadyResolved.Count -gt 0) {
|
||||
Success "Already resolved: $($results.AlreadyResolved.Count) (issues closed)"
|
||||
}
|
||||
if ($results.AwaitingRelease.Count -gt 0) {
|
||||
Info "Awaiting release: $($results.AwaitingRelease.Count) (fix merged, pending release)"
|
||||
}
|
||||
if ($results.NeedsClarification.Count -gt 0) {
|
||||
Warn "Need clarification: $($results.NeedsClarification.Count) (comments added)"
|
||||
}
|
||||
if ($results.Duplicates.Count -gt 0) {
|
||||
Warn "Duplicates: $($results.Duplicates.Count) (issues closed)"
|
||||
}
|
||||
if ($results.NoChanges.Count -gt 0) {
|
||||
Warn "No changes made: $($results.NoChanges.Count)"
|
||||
}
|
||||
if ($results.Failed.Count -gt 0) {
|
||||
Err "Failed: $($results.Failed.Count)"
|
||||
Err "Failed issues: $($results.Failed -join ', ')"
|
||||
}
|
||||
Info ("=" * 80)
|
||||
|
||||
if (-not $SkipWorktree -and ($results.Succeeded.Count -gt 0 -or $results.NoChanges.Count -gt 0)) {
|
||||
Info "`nWorktrees created. Use 'git worktree list' to see all worktrees."
|
||||
Info "To clean up: Delete-Worktree.ps1 -Branch issue/<number>"
|
||||
}
|
||||
|
||||
# Write signal files for orchestrator
|
||||
$genFiles = Get-GeneratedFilesPath -RepoRoot $repoRoot
|
||||
foreach ($issueNum in $results.Succeeded) {
|
||||
$signalDir = Join-Path $genFiles "issueFix/$issueNum"
|
||||
if (-not (Test-Path $signalDir)) { New-Item -ItemType Directory -Path $signalDir -Force | Out-Null }
|
||||
@{
|
||||
status = "success"
|
||||
issueNumber = $issueNum
|
||||
timestamp = (Get-Date).ToString("o")
|
||||
worktreePath = (git worktree list --porcelain | Select-String "worktree.*issue.$issueNum" | ForEach-Object { $_.Line -replace 'worktree ', '' })
|
||||
} | ConvertTo-Json | Set-Content "$signalDir/.signal" -Force
|
||||
}
|
||||
foreach ($issueNum in $results.Failed) {
|
||||
$signalDir = Join-Path $genFiles "issueFix/$issueNum"
|
||||
if (-not (Test-Path $signalDir)) { New-Item -ItemType Directory -Path $signalDir -Force | Out-Null }
|
||||
@{
|
||||
status = "failure"
|
||||
issueNumber = $issueNum
|
||||
timestamp = (Get-Date).ToString("o")
|
||||
} | ConvertTo-Json | Set-Content "$signalDir/.signal" -Force
|
||||
}
|
||||
|
||||
return $results
|
||||
}
|
||||
catch {
|
||||
Err "Error: $($_.Exception.Message)"
|
||||
exit 1
|
||||
}
|
||||
#endregion
|
||||
73
.github/skills/issue-fix/scripts/Start-IssueFixParallel.ps1
vendored
Normal file
73
.github/skills/issue-fix/scripts/Start-IssueFixParallel.ps1
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Run issue-fix in parallel from a single terminal.
|
||||
|
||||
.PARAMETER IssueNumbers
|
||||
Issue numbers to fix.
|
||||
|
||||
.PARAMETER ThrottleLimit
|
||||
Maximum parallel tasks.
|
||||
|
||||
.PARAMETER CLIType
|
||||
AI CLI type (copilot/claude/gh-copilot/vscode/auto).
|
||||
|
||||
.PARAMETER Model
|
||||
Copilot CLI model to use (e.g., gpt-5.2-codex).
|
||||
|
||||
.PARAMETER Force
|
||||
Skip confirmation prompts in Start-IssueAutoFix.ps1.
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
[int[]]$IssueNumbers,
|
||||
|
||||
[int]$ThrottleLimit = 5,
|
||||
|
||||
[ValidateSet('claude', 'copilot', 'gh-copilot', 'vscode', 'auto')]
|
||||
[string]$CLIType = 'copilot',
|
||||
|
||||
[string]$Model,
|
||||
|
||||
[switch]$Force
|
||||
)
|
||||
|
||||
$repoRoot = Resolve-Path (Join-Path $PSScriptRoot '..\..\..\..')
|
||||
$scriptPath = Join-Path $repoRoot '.github\skills\issue-fix\scripts\Start-IssueAutoFix.ps1'
|
||||
|
||||
$results = $IssueNumbers | ForEach-Object -Parallel {
|
||||
param($issue)
|
||||
|
||||
$repoRoot = $using:repoRoot
|
||||
$scriptPath = $using:scriptPath
|
||||
$cliType = $using:CLIType
|
||||
$model = $using:Model
|
||||
$force = $using:Force
|
||||
|
||||
Set-Location $repoRoot
|
||||
|
||||
$args = @('-IssueNumber', $issue, '-CLIType', $cliType)
|
||||
if ($model) {
|
||||
$args += @('-Model', $model)
|
||||
}
|
||||
if ($force) {
|
||||
$args += '-Force'
|
||||
}
|
||||
|
||||
try {
|
||||
& $scriptPath @args | Out-Default
|
||||
[pscustomobject]@{
|
||||
IssueNumber = $issue
|
||||
ExitCode = $LASTEXITCODE
|
||||
}
|
||||
}
|
||||
catch {
|
||||
[pscustomobject]@{
|
||||
IssueNumber = $issue
|
||||
ExitCode = 1
|
||||
Error = $_.Exception.Message
|
||||
}
|
||||
}
|
||||
} -ThrottleLimit $ThrottleLimit
|
||||
|
||||
$results
|
||||
252
.github/skills/issue-to-pr-cycle/SKILL.md
vendored
Normal file
252
.github/skills/issue-to-pr-cycle/SKILL.md
vendored
Normal file
@@ -0,0 +1,252 @@
|
||||
---
|
||||
name: issue-to-pr-cycle
|
||||
description: End-to-end orchestration from issue analysis to PR creation and review. This skill is the ORCHESTRATION BRAIN that invokes other skills via CLI and performs VS Code MCP operations directly.
|
||||
license: Complete terms in LICENSE.txt
|
||||
---
|
||||
|
||||
# Issue-to-PR Full Cycle Skill
|
||||
|
||||
**ORCHESTRATION BRAIN** - coordinates other skills and performs VS Code MCP operations.
|
||||
|
||||
## Skill Contents
|
||||
|
||||
```
|
||||
.github/skills/issue-to-pr-cycle/
|
||||
├── SKILL.md # This file (orchestration brain)
|
||||
├── LICENSE.txt # MIT License
|
||||
└── scripts/
|
||||
├── Get-CycleStatus.ps1 # Check status of issues/PRs
|
||||
├── IssueReviewLib.ps1 # Shared helpers
|
||||
└── Start-FullIssueCycle.ps1 # Legacy script (phases A-C)
|
||||
```
|
||||
|
||||
**Orchestrates these skills:**
|
||||
| Skill | Purpose |
|
||||
|-------|---------|
|
||||
| `issue-review` | Analyze issues, generate implementation plans |
|
||||
| `issue-fix` | Create worktrees, apply fixes, create PRs |
|
||||
| `pr-review` | Comprehensive PR review (13 steps) |
|
||||
| `pr-fix` | Fix review comments, resolve threads |
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- GitHub CLI (`gh`) installed and authenticated
|
||||
- Copilot CLI or Claude CLI installed
|
||||
- PowerShell 7+
|
||||
- VS Code with MCP tools (for write operations)
|
||||
|
||||
## Required Variables
|
||||
|
||||
| Variable | Description | Example |
|
||||
|----------|-------------|---------|
|
||||
| `{{IssueNumbers}}` | Issue numbers to process | `45363, 45364` |
|
||||
| (or) `{{PRNumbers}}` | PR numbers for review/fix loop | `45365, 45366` |
|
||||
|
||||
## How This Skill Works
|
||||
|
||||
The orchestrator:
|
||||
1. **Invokes skills via CLI** - kicks off `copilot` CLI (not `gh copilot`) to run each skill
|
||||
2. **Runs in parallel** - use PowerShell 7 `ForEach-Object -Parallel` in SINGLE terminal
|
||||
3. **Waits for signals** - polls for `.signal` files indicating completion
|
||||
4. **Performs VS Code MCP directly** - for operations that require write access (request reviewer, resolve threads)
|
||||
|
||||
## Quality Gates (CRITICAL)
|
||||
|
||||
**Every PR must pass these quality checks before creation:**
|
||||
|
||||
1. **Real Implementation** - NO placeholder/stub code
|
||||
- Files must contain actual working code
|
||||
- Empty classes like `class FixXXX { }` are FORBIDDEN
|
||||
|
||||
2. **Proper PR Title** - Follow Conventional Commits
|
||||
- Use `.github/prompts/create-commit-title.prompt.md`
|
||||
- Format: `feat(module): description` or `fix(module): description`
|
||||
- NEVER use generic titles like "fix: address issue #12345"
|
||||
|
||||
3. **Full PR Description** - Based on actual diff
|
||||
- Use `.github/prompts/create-pr-summary.prompt.md`
|
||||
- Run `git diff main...HEAD` to analyze changes
|
||||
- Fill PR template with real information
|
||||
|
||||
4. **Build Verification** - Code must compile
|
||||
- Run `tools/build/build.cmd` in worktree
|
||||
- Exit code 0 = success
|
||||
|
||||
### Checking Worktree Quality
|
||||
|
||||
```powershell
|
||||
# Check if worktree has real implementation (not stubs)
|
||||
$files = git diff main --name-only
|
||||
foreach ($file in $files) {
|
||||
if ($file -match "src/common/fixes/Fix\d+\.cs") {
|
||||
Write-Error "STUB FILE DETECTED: $file - Need real implementation"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Signal Files
|
||||
|
||||
Each skill produces a `.signal` file when complete:
|
||||
|
||||
| Skill | Signal Location | Status Values |
|
||||
|-------|-----------------|---------------|
|
||||
| `issue-review` | `Generated Files/issueReview/<issue>/.signal` | `success`, `failure` |
|
||||
| `issue-fix` | `Generated Files/issueFix/<issue>/.signal` | `success`, `failure` |
|
||||
| `pr-review` | `Generated Files/prReview/<pr>/.signal` | `success`, `failure` |
|
||||
| `pr-fix` | `Generated Files/prFix/<pr>/.signal` | `success`, `partial`, `failure` |
|
||||
|
||||
Signal format:
|
||||
```json
|
||||
{
|
||||
"status": "success",
|
||||
"issueNumber": 45363,
|
||||
"timestamp": "2026-02-04T10:05:23Z"
|
||||
}
|
||||
```
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────────────────────┐
|
||||
│ ORCHESTRATOR (this skill, VS Code agent) │
|
||||
│ │
|
||||
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
|
||||
│ │ issue-review│ │ issue-fix │ │ pr-review │ │ pr-fix │ │
|
||||
│ │ (CLI) │ │ (CLI) │ │ (CLI) │ │ (CLI) │ │
|
||||
│ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ │
|
||||
│ │ │ │ │ │
|
||||
│ ▼ ▼ ▼ ▼ │
|
||||
│ ┌─────────────────────────────────────────────────────────────────────┐ │
|
||||
│ │ Signal Files (Generated Files/*/.signal) │ │
|
||||
│ └─────────────────────────────────────────────────────────────────────┘ │
|
||||
│ │
|
||||
│ VS Code MCP Operations (orchestrator executes directly): │
|
||||
│ - mcp_github_request_copilot_review │
|
||||
│ - gh api graphql (resolve threads) │
|
||||
│ - Post review comments │
|
||||
└─────────────────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
## Workflow
|
||||
|
||||
### Phase A: Issue Review
|
||||
|
||||
Use the orchestration script instead of inline commands:
|
||||
|
||||
```powershell
|
||||
.github/skills/issue-to-pr-cycle/scripts/Start-FullIssueCycle.ps1 -IssueNumbers 45363,45364
|
||||
```
|
||||
|
||||
### Phase B: Issue Fix
|
||||
|
||||
Use the parallel runner script:
|
||||
|
||||
```powershell
|
||||
.github/skills/issue-fix/scripts/Start-IssueFixParallel.ps1 -IssueNumbers 45363,45364 -CLIType copilot -ThrottleLimit 5 -Force
|
||||
```
|
||||
|
||||
### Phase C: PR Review
|
||||
|
||||
Use the pr-review script for each PR, or run the full cycle script to orchestrate:
|
||||
|
||||
```powershell
|
||||
.github/skills/pr-review/scripts/Start-PRReviewWorkflow.ps1 -PRNumber 45392
|
||||
```
|
||||
|
||||
### Phase D: Review/Fix Loop (VS Code Agent Orchestrated)
|
||||
|
||||
This phase requires the VS Code agent to:
|
||||
|
||||
**D1: Request Copilot review (VS Code MCP)**
|
||||
```
|
||||
mcp_github_request_copilot_review:
|
||||
owner: microsoft
|
||||
repo: PowerToys
|
||||
pullNumber: {{PRNumber}}
|
||||
```
|
||||
|
||||
**D2: Invoke pr-review skill (CLI, parallel)**
|
||||
```powershell
|
||||
gh copilot -p "Run skill pr-review for PR #{{PRNumber}}"
|
||||
# Wait for: Generated Files/prReview/{{PRNumber}}/.signal
|
||||
```
|
||||
|
||||
**D3: Check results**
|
||||
- Read `Generated Files/prReview/{{PRNumber}}/00-OVERVIEW.md`
|
||||
- Query unresolved threads via GraphQL
|
||||
|
||||
**D4: Post comments (VS Code MCP) - if medium+ severity**
|
||||
|
||||
**D5: Invoke pr-fix skill in WORKTREE (CLI)**
|
||||
```powershell
|
||||
# Find worktree for this PR's branch
|
||||
$branch = (gh pr view {{PRNumber}} --json headRefName -q .headRefName)
|
||||
$worktree = git worktree list --porcelain | Select-String "worktree.*$branch" | ...
|
||||
|
||||
# Run fix in worktree
|
||||
cd $worktreePath
|
||||
gh copilot -p "Run skill pr-fix for PR #{{PRNumber}}"
|
||||
# Wait for: Generated Files/prFix/{{PRNumber}}/.signal
|
||||
```
|
||||
|
||||
**D6: Resolve threads (VS Code MCP)**
|
||||
```powershell
|
||||
# Get thread IDs
|
||||
gh api graphql -f query='query { repository(owner:"microsoft",name:"PowerToys") {
|
||||
pullRequest(number:{{PRNumber}}) { reviewThreads(first:50) { nodes { id isResolved } } }
|
||||
} }'
|
||||
|
||||
# Resolve each (VS Code agent executes this)
|
||||
gh api graphql -f query='mutation { resolveReviewThread(input:{threadId:"{{ID}}"}) { thread { isResolved } } }'
|
||||
```
|
||||
|
||||
**D7: Loop**
|
||||
- If unresolved issues remain → go to D2
|
||||
- If all clear → done
|
||||
|
||||
## Timeout Handling
|
||||
|
||||
Default timeout: 10 minutes per skill invocation.
|
||||
|
||||
If no signal file appears within timeout:
|
||||
1. Check if the skill process is still running
|
||||
2. If hung, terminate and mark as `timeout`
|
||||
3. Log failure and continue with other items
|
||||
|
||||
## Parallel Execution (CRITICAL)
|
||||
|
||||
**DO NOT spawn separate terminals for each operation.** Use the dedicated scripts to run parallel work from a single terminal:
|
||||
|
||||
```powershell
|
||||
# Issue fixes in parallel
|
||||
.github/skills/issue-fix/scripts/Start-IssueFixParallel.ps1 -IssueNumbers 28726,13336,27507,3054,37800 -CLIType copilot -Model gpt-5.2-codex -ThrottleLimit 5 -Force
|
||||
|
||||
# PR fixes in parallel
|
||||
.github/skills/pr-fix/scripts/Start-PRFixParallel.ps1 -PRNumbers 45256,45257,45285,45286 -CLIType copilot -Model gpt-5.2-codex -ThrottleLimit 3 -Force
|
||||
```
|
||||
|
||||
## Worktree Mapping
|
||||
|
||||
The orchestrator must track which worktree belongs to which issue/PR:
|
||||
|
||||
```powershell
|
||||
# Get all worktrees
|
||||
$worktrees = git worktree list --porcelain | Select-String "worktree|branch" |
|
||||
ForEach-Object { $_.Line }
|
||||
|
||||
# Parse into mapping
|
||||
# Q:\PowerToys-ab12 → issue/44044
|
||||
# Q:\PowerToys-cd34 → issue/32950
|
||||
|
||||
# Find worktree for issue
|
||||
$issueNum = 45363
|
||||
$worktreeLine = git worktree list | Select-String "issue/$issueNum"
|
||||
$worktreePath = ($worktreeLine -split '\s+')[0]
|
||||
```
|
||||
|
||||
## When to Use This Skill
|
||||
|
||||
- Process multiple issues end-to-end
|
||||
- Automate the full issue → PR → review → fix cycle
|
||||
- Batch process high-confidence issues
|
||||
- Run continuous review/fix loops until clean
|
||||
349
.github/skills/issue-to-pr-cycle/scripts/Get-CycleStatus.ps1
vendored
Normal file
349
.github/skills/issue-to-pr-cycle/scripts/Get-CycleStatus.ps1
vendored
Normal file
@@ -0,0 +1,349 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Get the current status of issues/PRs in the issue-to-PR cycle.
|
||||
|
||||
.DESCRIPTION
|
||||
Checks the status of:
|
||||
- Issue review completion (has overview.md + implementation-plan.md)
|
||||
- Issue fix completion (has worktree + commits)
|
||||
- PR creation status (has open PR)
|
||||
- PR review status (has review files)
|
||||
- PR active comments count
|
||||
|
||||
.PARAMETER IssueNumbers
|
||||
Array of issue numbers to check status for.
|
||||
|
||||
.PARAMETER PRNumbers
|
||||
Array of PR numbers to check status for.
|
||||
|
||||
.PARAMETER CheckAll
|
||||
Check all issues with review data and all open PRs with issue/* branches.
|
||||
|
||||
.EXAMPLE
|
||||
./Get-CycleStatus.ps1 -IssueNumbers 44044, 32950
|
||||
|
||||
.EXAMPLE
|
||||
./Get-CycleStatus.ps1 -PRNumbers 45234, 45235
|
||||
|
||||
.EXAMPLE
|
||||
./Get-CycleStatus.ps1 -CheckAll
|
||||
#>
|
||||
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[int[]]$IssueNumbers = @(),
|
||||
[int[]]$PRNumbers = @(),
|
||||
[switch]$CheckAll,
|
||||
[switch]$JsonOutput
|
||||
)
|
||||
|
||||
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
. (Join-Path $scriptDir 'IssueReviewLib.ps1')
|
||||
|
||||
$repoRoot = Get-RepoRoot
|
||||
$genFiles = Get-GeneratedFilesPath -RepoRoot $repoRoot
|
||||
$worktreeLib = Join-Path $repoRoot 'tools/build/WorktreeLib.ps1'
|
||||
if (Test-Path $worktreeLib) {
|
||||
. $worktreeLib
|
||||
}
|
||||
|
||||
function Get-IssueStatus {
|
||||
param([int]$IssueNumber)
|
||||
|
||||
$status = @{
|
||||
IssueNumber = $IssueNumber
|
||||
HasReview = $false
|
||||
HasImplementationPlan = $false
|
||||
FeasibilityScore = 0
|
||||
ClarityScore = 0
|
||||
EffortDays = 0
|
||||
HasWorktree = $false
|
||||
WorktreePath = $null
|
||||
HasCommits = $false
|
||||
CommitCount = 0
|
||||
HasPR = $false
|
||||
PRNumber = 0
|
||||
PRState = $null
|
||||
PRUrl = $null
|
||||
ReviewSignalStatus = $null
|
||||
ReviewSignalTimestamp = $null
|
||||
FixSignalStatus = $null
|
||||
FixSignalTimestamp = $null
|
||||
}
|
||||
|
||||
# Check review status
|
||||
$reviewDir = Join-Path $genFiles "issueReview/$IssueNumber"
|
||||
$overviewPath = Join-Path $reviewDir 'overview.md'
|
||||
$implPlanPath = Join-Path $reviewDir 'implementation-plan.md'
|
||||
|
||||
if (Test-Path $overviewPath) {
|
||||
$status.HasReview = $true
|
||||
$overview = Get-Content $overviewPath -Raw
|
||||
|
||||
if ($overview -match 'Technical Feasibility[^\d]*(\d+)/100') {
|
||||
$status.FeasibilityScore = [int]$Matches[1]
|
||||
}
|
||||
if ($overview -match 'Requirement Clarity[^\d]*(\d+)/100') {
|
||||
$status.ClarityScore = [int]$Matches[1]
|
||||
}
|
||||
if ($overview -match 'Effort Estimate[^|]*\|\s*[\d.]+(?:-(\d+))?\s*days?') {
|
||||
$status.EffortDays = if ($Matches[1]) { [int]$Matches[1] } else { 1 }
|
||||
}
|
||||
}
|
||||
|
||||
if (Test-Path $implPlanPath) {
|
||||
$status.HasImplementationPlan = $true
|
||||
}
|
||||
|
||||
# Check review signal
|
||||
$reviewSignalPath = Join-Path $reviewDir '.signal'
|
||||
if (Test-Path $reviewSignalPath) {
|
||||
try {
|
||||
$reviewSignal = Get-Content $reviewSignalPath -Raw | ConvertFrom-Json
|
||||
$status.ReviewSignalStatus = $reviewSignal.status
|
||||
$status.ReviewSignalTimestamp = $reviewSignal.timestamp
|
||||
}
|
||||
catch {}
|
||||
}
|
||||
|
||||
# Check worktree status
|
||||
$worktrees = Get-WorktreeEntries | Where-Object { $_.Branch -like "issue/$IssueNumber*" }
|
||||
if ($worktrees) {
|
||||
$status.HasWorktree = $true
|
||||
$status.WorktreePath = $worktrees[0].Path
|
||||
|
||||
# Check for commits
|
||||
Push-Location $status.WorktreePath
|
||||
try {
|
||||
$commits = git log --oneline "main..HEAD" 2>$null
|
||||
if ($commits) {
|
||||
$status.HasCommits = $true
|
||||
$status.CommitCount = @($commits).Count
|
||||
}
|
||||
}
|
||||
finally {
|
||||
Pop-Location
|
||||
}
|
||||
}
|
||||
|
||||
# Check fix signal
|
||||
$fixSignalPath = Join-Path $genFiles "issueFix/$IssueNumber/.signal"
|
||||
if (Test-Path $fixSignalPath) {
|
||||
try {
|
||||
$fixSignal = Get-Content $fixSignalPath -Raw | ConvertFrom-Json
|
||||
$status.FixSignalStatus = $fixSignal.status
|
||||
$status.FixSignalTimestamp = $fixSignal.timestamp
|
||||
}
|
||||
catch {}
|
||||
}
|
||||
|
||||
# Check PR status
|
||||
$prs = gh pr list --head "issue/$IssueNumber" --state all --json number,url,state 2>$null | ConvertFrom-Json
|
||||
if (-not $prs -or $prs.Count -eq 0) {
|
||||
# Try searching by issue reference
|
||||
$prs = gh pr list --search "fixes #$IssueNumber OR closes #$IssueNumber" --state all --json number,url,state --limit 1 2>$null | ConvertFrom-Json
|
||||
}
|
||||
if ($prs -and $prs.Count -gt 0) {
|
||||
$status.HasPR = $true
|
||||
$status.PRNumber = $prs[0].number
|
||||
$status.PRState = $prs[0].state
|
||||
$status.PRUrl = $prs[0].url
|
||||
}
|
||||
|
||||
return $status
|
||||
}
|
||||
|
||||
function Get-PRStatus {
|
||||
param([int]$PRNumber)
|
||||
|
||||
$status = @{
|
||||
PRNumber = $PRNumber
|
||||
State = $null
|
||||
IssueNumber = 0
|
||||
Branch = $null
|
||||
HasReviewFiles = $false
|
||||
ReviewStepCount = 0
|
||||
HighSeverityCount = 0
|
||||
MediumSeverityCount = 0
|
||||
ActiveCommentCount = 0
|
||||
UnresolvedThreadCount = 0
|
||||
CopilotReviewRequested = $false
|
||||
ReviewSignalStatus = $null
|
||||
ReviewSignalTimestamp = $null
|
||||
FixSignalStatus = $null
|
||||
FixSignalTimestamp = $null
|
||||
}
|
||||
|
||||
# Get PR info
|
||||
$prInfo = gh pr view $PRNumber --json state,headRefName,number 2>$null | ConvertFrom-Json
|
||||
if (-not $prInfo) {
|
||||
return $status
|
||||
}
|
||||
|
||||
$status.State = $prInfo.state
|
||||
$status.Branch = $prInfo.headRefName
|
||||
|
||||
# Extract issue number from branch
|
||||
if ($status.Branch -match 'issue/(\d+)') {
|
||||
$status.IssueNumber = [int]$Matches[1]
|
||||
}
|
||||
|
||||
# Check review files
|
||||
$reviewDir = Join-Path $genFiles "prReview/$PRNumber"
|
||||
if (Test-Path $reviewDir) {
|
||||
$status.HasReviewFiles = $true
|
||||
$stepFiles = Get-ChildItem -Path $reviewDir -Filter "*.md" -ErrorAction SilentlyContinue |
|
||||
Where-Object { $_.Name -match '^\d{2}-' }
|
||||
$status.ReviewStepCount = $stepFiles.Count
|
||||
|
||||
# Count severity issues
|
||||
foreach ($stepFile in $stepFiles) {
|
||||
$content = Get-Content $stepFile.FullName -Raw -ErrorAction SilentlyContinue
|
||||
if ($content) {
|
||||
$status.HighSeverityCount += ([regex]::Matches($content, '\*\*Severity:\s*high\*\*', 'IgnoreCase')).Count
|
||||
$status.HighSeverityCount += ([regex]::Matches($content, '🔴\s*High', 'IgnoreCase')).Count
|
||||
$status.MediumSeverityCount += ([regex]::Matches($content, '\*\*Severity:\s*medium\*\*', 'IgnoreCase')).Count
|
||||
$status.MediumSeverityCount += ([regex]::Matches($content, '🟡\s*Medium', 'IgnoreCase')).Count
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Check review signal
|
||||
$reviewSignalPath = Join-Path $reviewDir '.signal'
|
||||
if (Test-Path $reviewSignalPath) {
|
||||
try {
|
||||
$reviewSignal = Get-Content $reviewSignalPath -Raw | ConvertFrom-Json
|
||||
$status.ReviewSignalStatus = $reviewSignal.status
|
||||
$status.ReviewSignalTimestamp = $reviewSignal.timestamp
|
||||
}
|
||||
catch {}
|
||||
}
|
||||
|
||||
# Check fix signal
|
||||
$fixSignalPath = Join-Path $genFiles "prFix/$PRNumber/.signal"
|
||||
if (Test-Path $fixSignalPath) {
|
||||
try {
|
||||
$fixSignal = Get-Content $fixSignalPath -Raw | ConvertFrom-Json
|
||||
$status.FixSignalStatus = $fixSignal.status
|
||||
$status.FixSignalTimestamp = $fixSignal.timestamp
|
||||
}
|
||||
catch {}
|
||||
}
|
||||
|
||||
# Get active comments (not in reply to another comment)
|
||||
try {
|
||||
$commentCount = gh api "repos/microsoft/PowerToys/pulls/$PRNumber/comments" --jq '[.[] | select(.in_reply_to_id == null)] | length' 2>$null
|
||||
$status.ActiveCommentCount = [int]$commentCount
|
||||
}
|
||||
catch {
|
||||
$status.ActiveCommentCount = 0
|
||||
}
|
||||
|
||||
# Get unresolved thread count
|
||||
try {
|
||||
$threads = gh api graphql -f query="query { repository(owner: `"microsoft`", name: `"PowerToys`") { pullRequest(number: $PRNumber) { reviewThreads(first: 100) { nodes { isResolved } } } } }" --jq '.data.repository.pullRequest.reviewThreads.nodes | map(select(.isResolved == false)) | length' 2>$null
|
||||
$status.UnresolvedThreadCount = [int]$threads
|
||||
}
|
||||
catch {
|
||||
$status.UnresolvedThreadCount = 0
|
||||
}
|
||||
|
||||
# Check if Copilot review was requested
|
||||
try {
|
||||
$reviewers = gh pr view $PRNumber --json reviewRequests --jq '.reviewRequests[].login' 2>$null
|
||||
if ($reviewers -contains 'copilot' -or $reviewers -contains 'github-copilot') {
|
||||
$status.CopilotReviewRequested = $true
|
||||
}
|
||||
}
|
||||
catch {}
|
||||
|
||||
return $status
|
||||
}
|
||||
|
||||
# Main execution
|
||||
$results = @{
|
||||
Issues = @()
|
||||
PRs = @()
|
||||
Timestamp = Get-Date -Format 'yyyy-MM-dd HH:mm:ss'
|
||||
}
|
||||
|
||||
# Gather issue numbers to check
|
||||
$issuesToCheck = @()
|
||||
$prsToCheck = @()
|
||||
|
||||
if ($CheckAll) {
|
||||
# Get all reviewed issues
|
||||
$reviewDir = Join-Path $genFiles 'issueReview'
|
||||
if (Test-Path $reviewDir) {
|
||||
$issuesToCheck = Get-ChildItem -Path $reviewDir -Directory |
|
||||
Where-Object { $_.Name -match '^\d+$' } |
|
||||
ForEach-Object { [int]$_.Name }
|
||||
}
|
||||
|
||||
# Get all open PRs with issue/* branches
|
||||
$openPRs = gh pr list --state open --json number,headRefName 2>$null | ConvertFrom-Json |
|
||||
Where-Object { $_.headRefName -like 'issue/*' }
|
||||
$prsToCheck = @($openPRs | ForEach-Object { $_.number })
|
||||
}
|
||||
else {
|
||||
$issuesToCheck = $IssueNumbers
|
||||
$prsToCheck = $PRNumbers
|
||||
}
|
||||
|
||||
# Get issue statuses
|
||||
foreach ($issueNum in $issuesToCheck) {
|
||||
$status = Get-IssueStatus -IssueNumber $issueNum
|
||||
$results.Issues += $status
|
||||
}
|
||||
|
||||
# Get PR statuses
|
||||
foreach ($prNum in $prsToCheck) {
|
||||
$status = Get-PRStatus -PRNumber $prNum
|
||||
$results.PRs += $status
|
||||
}
|
||||
|
||||
# Output
|
||||
if ($JsonOutput) {
|
||||
$results | ConvertTo-Json -Depth 5
|
||||
return $results
|
||||
}
|
||||
else {
|
||||
if ($results.Issues.Count -gt 0) {
|
||||
Write-Host "`n=== ISSUE STATUS ===" -ForegroundColor Cyan
|
||||
Write-Host ("-" * 100)
|
||||
Write-Host ("{0,-8} {1,-8} {2,-8} {3,-5} {4,-5} {5,-10} {6,-8} {7,-8} {8,-8} {9,-8}" -f "Issue", "Review", "Plan", "Feas", "Clar", "Worktree", "Commits", "PR", "RevSig", "FixSig")
|
||||
Write-Host ("-" * 100)
|
||||
foreach ($issue in $results.Issues | Sort-Object IssueNumber) {
|
||||
$reviewMark = if ($issue.HasReview) { "✓" } else { "-" }
|
||||
$planMark = if ($issue.HasImplementationPlan) { "✓" } else { "-" }
|
||||
$wtMark = if ($issue.HasWorktree) { "✓" } else { "-" }
|
||||
$commitMark = if ($issue.HasCommits) { $issue.CommitCount } else { "-" }
|
||||
$prMark = if ($issue.HasPR) { "#$($issue.PRNumber) ($($issue.PRState))" } else { "-" }
|
||||
$reviewSignalMark = if ($issue.ReviewSignalStatus) { $issue.ReviewSignalStatus } else { "-" }
|
||||
$fixSignalMark = if ($issue.FixSignalStatus) { $issue.FixSignalStatus } else { "-" }
|
||||
|
||||
Write-Host ("{0,-8} {1,-8} {2,-8} {3,-5} {4,-5} {5,-10} {6,-8} {7,-8} {8,-8} {9,-8}" -f
|
||||
"#$($issue.IssueNumber)", $reviewMark, $planMark, $issue.FeasibilityScore, $issue.ClarityScore, $wtMark, $commitMark, $prMark, $reviewSignalMark, $fixSignalMark)
|
||||
}
|
||||
}
|
||||
|
||||
if ($results.PRs.Count -gt 0) {
|
||||
Write-Host "`n=== PR STATUS ===" -ForegroundColor Cyan
|
||||
Write-Host ("-" * 120)
|
||||
Write-Host ("{0,-8} {1,-10} {2,-10} {3,-8} {4,-8} {5,-10} {6,-12} {7,-10} {8,-8} {9,-8}" -f "PR", "State", "Issue", "Reviews", "High", "Medium", "Comments", "Unresolved", "RevSig", "FixSig")
|
||||
Write-Host ("-" * 120)
|
||||
foreach ($pr in $results.PRs | Sort-Object PRNumber) {
|
||||
$reviewMark = if ($pr.HasReviewFiles) { "$($pr.ReviewStepCount) steps" } else { "-" }
|
||||
$issueMark = if ($pr.IssueNumber -gt 0) { "#$($pr.IssueNumber)" } else { "-" }
|
||||
$reviewSignalMark = if ($pr.ReviewSignalStatus) { $pr.ReviewSignalStatus } else { "-" }
|
||||
$fixSignalMark = if ($pr.FixSignalStatus) { $pr.FixSignalStatus } else { "-" }
|
||||
|
||||
Write-Host ("{0,-8} {1,-10} {2,-10} {3,-8} {4,-8} {5,-10} {6,-12} {7,-10} {8,-8} {9,-8}" -f
|
||||
"#$($pr.PRNumber)", $pr.State, $issueMark, $reviewMark, $pr.HighSeverityCount, $pr.MediumSeverityCount, $pr.ActiveCommentCount, $pr.UnresolvedThreadCount, $reviewSignalMark, $fixSignalMark)
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "`nTimestamp: $($results.Timestamp)" -ForegroundColor Gray
|
||||
}
|
||||
|
||||
return $results
|
||||
227
.github/skills/pr-fix/SKILL.md
vendored
Normal file
227
.github/skills/pr-fix/SKILL.md
vendored
Normal file
@@ -0,0 +1,227 @@
|
||||
---
|
||||
name: pr-fix
|
||||
description: Fix active PR review comments and resolve threads. Use when asked to fix PR comments, address review feedback, resolve review threads, implement PR fixes, or handle review iterations. Works with VS Code MCP tools to resolve GitHub threads after fixes are applied.
|
||||
license: Complete terms in LICENSE.txt
|
||||
---
|
||||
|
||||
# PR Fix Skill
|
||||
|
||||
Fix active pull request review comments and resolve threads. This skill handles the **fix** part of the PR review cycle, separate from the review itself.
|
||||
|
||||
## ⚠️ Critical Architecture
|
||||
|
||||
This skill requires **both** CLI scripts AND VS Code MCP tools:
|
||||
|
||||
| Operation | Execution Method |
|
||||
|-----------|------------------|
|
||||
| Apply code fixes | Copilot/Claude CLI via script |
|
||||
| Resolve review threads | **VS Code Agent** via `gh api graphql` |
|
||||
| Check status | Script (read-only) |
|
||||
|
||||
**WHY**: Copilot CLI's MCP is **read-only**. Only VS Code can resolve threads.
|
||||
|
||||
## Skill Contents
|
||||
|
||||
```
|
||||
.github/skills/pr-fix/
|
||||
├── SKILL.md # This file
|
||||
├── LICENSE.txt # MIT License
|
||||
├── references/
|
||||
│ ├── fix-pr-comments.prompt.md # AI prompt for fixing comments
|
||||
│ └── mcp-config.json # MCP configuration
|
||||
└── scripts/
|
||||
├── Start-PRFix.ps1 # Main fix script
|
||||
├── Start-PRFixParallel.ps1 # Parallel runner (single terminal)
|
||||
├── Resolve-PRThreads.ps1 # Resolve threads helper
|
||||
├── Get-UnresolvedThreads.ps1 # Get threads needing resolution
|
||||
└── IssueReviewLib.ps1 # Shared helpers
|
||||
```
|
||||
|
||||
## Output
|
||||
|
||||
- **Code changes**: Applied in the PR's worktree
|
||||
- **Signal file**: `Generated Files/prFix/<pr>/.signal`
|
||||
|
||||
## Signal File
|
||||
|
||||
On completion, a `.signal` file is created for orchestrator coordination:
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "success",
|
||||
"prNumber": 45365,
|
||||
"timestamp": "2026-02-04T10:05:23Z",
|
||||
"unresolvedBefore": 3,
|
||||
"unresolvedAfter": 0
|
||||
}
|
||||
```
|
||||
|
||||
Status values: `success`, `partial` (some threads remain), `failure`
|
||||
|
||||
## When to Use This Skill
|
||||
|
||||
- Fix active review comments on a PR
|
||||
- Address reviewer feedback
|
||||
- Resolve review threads after fixing
|
||||
- Run the fix portion of review/fix loop
|
||||
- Implement changes requested in PR reviews
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- GitHub CLI (`gh`) installed and authenticated
|
||||
- Copilot CLI or Claude CLI installed
|
||||
- PowerShell 7+
|
||||
- PR has active review comments to fix
|
||||
|
||||
## Required Variables
|
||||
|
||||
| Variable | Description | Example |
|
||||
|----------|-------------|---------|
|
||||
| `{{PRNumber}}` | Pull request number to fix | `45286` |
|
||||
|
||||
## Workflow
|
||||
|
||||
### Step 1: Check Unresolved Threads
|
||||
|
||||
```powershell
|
||||
# See what needs to be fixed
|
||||
.github/skills/pr-fix/scripts/Get-UnresolvedThreads.ps1 -PRNumber {{PRNumber}}
|
||||
```
|
||||
|
||||
### Step 2: Run Fix (CLI Script)
|
||||
|
||||
```powershell
|
||||
# Apply AI-generated fixes to address comments
|
||||
.github/skills/pr-fix/scripts/Start-PRFix.ps1 -PRNumber {{PRNumber}} -CLIType copilot -Force
|
||||
```
|
||||
|
||||
### Step 3: Resolve Threads (VS Code Agent)
|
||||
|
||||
After fixes are pushed, **you (the VS Code agent) must resolve threads**:
|
||||
|
||||
```powershell
|
||||
# Get unresolved thread IDs
|
||||
gh api graphql -f query='
|
||||
query {
|
||||
repository(owner: "microsoft", name: "PowerToys") {
|
||||
pullRequest(number: {{PRNumber}}) {
|
||||
reviewThreads(first: 50) {
|
||||
nodes { id isResolved path line }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
' --jq '.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false)'
|
||||
```
|
||||
|
||||
```powershell
|
||||
# Resolve each thread
|
||||
gh api graphql -f query='
|
||||
mutation {
|
||||
resolveReviewThread(input: {threadId: "{{threadId}}"}) {
|
||||
thread { isResolved }
|
||||
}
|
||||
}
|
||||
'
|
||||
```
|
||||
|
||||
### Step 4: Verify All Resolved
|
||||
|
||||
```powershell
|
||||
# Confirm no unresolved threads remain
|
||||
.github/skills/pr-fix/scripts/Get-UnresolvedThreads.ps1 -PRNumber {{PRNumber}}
|
||||
```
|
||||
|
||||
## CLI Options
|
||||
|
||||
| Parameter | Description | Default |
|
||||
|-----------|-------------|---------|
|
||||
| `-PRNumber` | PR number to fix | Required |
|
||||
| `-CLIType` | AI CLI: `copilot` or `claude` | `copilot` |
|
||||
| `-Model` | Copilot model (e.g., `gpt-5.2-codex`) | (optional) |
|
||||
| `-Force` | Skip confirmation prompts | `false` |
|
||||
| `-DryRun` | Show what would be done | `false` |
|
||||
|
||||
## Review/Fix Loop Integration
|
||||
|
||||
This skill is typically used with `pr-review` in a loop:
|
||||
|
||||
```
|
||||
┌─────────────────┐
|
||||
│ pr-review │ ← Generate review, post comments
|
||||
└────────┬────────┘
|
||||
│
|
||||
▼
|
||||
┌─────────────────┐
|
||||
│ pr-fix │ ← Fix comments, resolve threads
|
||||
└────────┬────────┘
|
||||
│
|
||||
▼
|
||||
┌─────────────────┐
|
||||
│ Check status │ ← Any threads unresolved?
|
||||
└────────┬────────┘
|
||||
│
|
||||
┌────┴────┐
|
||||
│ YES │ NO
|
||||
▼ ▼
|
||||
(loop) ✓ Done
|
||||
```
|
||||
|
||||
## VS Code Agent Operations
|
||||
|
||||
These operations **must** be done by the VS Code agent (not scripts):
|
||||
|
||||
| Operation | Method |
|
||||
|-----------|--------|
|
||||
| Resolve thread | `gh api graphql` with `resolveReviewThread` mutation |
|
||||
| Unresolve thread | `gh api graphql` with `unresolveReviewThread` mutation |
|
||||
|
||||
### Batch Resolve All Threads
|
||||
|
||||
```powershell
|
||||
# Get all unresolved thread IDs and resolve them
|
||||
$threads = gh api graphql -f query='
|
||||
query {
|
||||
repository(owner: "microsoft", name: "PowerToys") {
|
||||
pullRequest(number: {{PRNumber}}) {
|
||||
reviewThreads(first: 100) {
|
||||
nodes { id isResolved }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
' --jq '.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false) | .id'
|
||||
|
||||
foreach ($threadId in $threads) {
|
||||
gh api graphql -f query="mutation { resolveReviewThread(input: {threadId: `"$threadId`"}) { thread { isResolved } } }"
|
||||
}
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
| Problem | Solution |
|
||||
|---------|----------|
|
||||
| "Cannot resolve thread" | Use VS Code agent, not Copilot CLI |
|
||||
| Fix not applied | Check worktree is on correct branch |
|
||||
| Thread ID not found | Re-fetch threads, ID may have changed |
|
||||
| Fix pushed but thread unresolved | Must explicitly resolve via GraphQL |
|
||||
|
||||
## Batch Processing Multiple PRs (CRITICAL)
|
||||
|
||||
**DO NOT spawn separate terminals for each PR.** Use the dedicated scripts:
|
||||
|
||||
```powershell
|
||||
# Run fixes in parallel (single terminal)
|
||||
.github/skills/pr-fix/scripts/Start-PRFixParallel.ps1 -PRNumbers 45256,45257,45285,45286 -CLIType copilot -ThrottleLimit 3 -Force
|
||||
|
||||
# Resolve threads (VS Code agent)
|
||||
.github/skills/pr-fix/scripts/Resolve-PRThreads.ps1 -PRNumber 45256
|
||||
```
|
||||
|
||||
## Related Skills
|
||||
|
||||
| Skill | Purpose |
|
||||
|-------|---------|
|
||||
| `pr-review` | Review PR, generate findings, post comments |
|
||||
| `issue-fix` | Fix issues and create PRs |
|
||||
| `issue-to-pr-cycle` | Full orchestration |
|
||||
29
.github/skills/pr-fix/scripts/Resolve-PRThreads.ps1
vendored
Normal file
29
.github/skills/pr-fix/scripts/Resolve-PRThreads.ps1
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Resolve all unresolved review threads for a PR.
|
||||
|
||||
.PARAMETER PRNumber
|
||||
PR number to resolve.
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
[int]$PRNumber
|
||||
)
|
||||
|
||||
$repoRoot = Resolve-Path (Join-Path $PSScriptRoot '..\..\..\..')
|
||||
Set-Location $repoRoot
|
||||
|
||||
$threads = gh api graphql -f query="query { repository(owner:\"microsoft\",name:\"PowerToys\") { pullRequest(number:$PRNumber) { reviewThreads(first:100) { nodes { id isResolved } } } } }" --jq '.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved==false) | .id'
|
||||
|
||||
foreach ($threadId in $threads) {
|
||||
gh api graphql -f query="mutation { resolveReviewThread(input:{threadId:\"$threadId\"}) { thread { isResolved } } }" | Out-Null
|
||||
}
|
||||
|
||||
$threadsAfter = gh api graphql -f query="query { repository(owner:\"microsoft\",name:\"PowerToys\") { pullRequest(number:$PRNumber) { reviewThreads(first:100) { nodes { id isResolved } } } } }" --jq '.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved==false) | .id'
|
||||
|
||||
if ($threadsAfter) {
|
||||
Write-Warning "Unresolved threads remain for PR #$PRNumber"
|
||||
} else {
|
||||
Write-Host "All threads resolved for PR #$PRNumber"
|
||||
}
|
||||
298
.github/skills/pr-fix/scripts/Start-PRFix.ps1
vendored
Normal file
298
.github/skills/pr-fix/scripts/Start-PRFix.ps1
vendored
Normal file
@@ -0,0 +1,298 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Fix active PR review comments using AI CLI.
|
||||
|
||||
.DESCRIPTION
|
||||
Kicks off Copilot/Claude CLI to address active review comments on a PR.
|
||||
Does NOT resolve threads - that must be done by VS Code agent via GraphQL.
|
||||
|
||||
.PARAMETER PRNumber
|
||||
PR number to fix.
|
||||
|
||||
.PARAMETER CLIType
|
||||
AI CLI to use: copilot or claude. Default: copilot.
|
||||
|
||||
.PARAMETER Model
|
||||
Copilot CLI model to use (e.g., gpt-5.2-codex).
|
||||
|
||||
.PARAMETER WorktreePath
|
||||
Path to the worktree containing the PR branch. Auto-detected if not specified.
|
||||
|
||||
.PARAMETER DryRun
|
||||
Show what would be done without executing.
|
||||
|
||||
.PARAMETER Force
|
||||
Skip confirmation prompts.
|
||||
|
||||
.EXAMPLE
|
||||
./Start-PRFix.ps1 -PRNumber 45286 -CLIType copilot -Force
|
||||
|
||||
.NOTES
|
||||
After this script completes, use VS Code agent to resolve threads via GraphQL.
|
||||
#>
|
||||
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
[int]$PRNumber,
|
||||
|
||||
[ValidateSet('copilot', 'claude')]
|
||||
[string]$CLIType = 'copilot',
|
||||
|
||||
[string]$Model,
|
||||
|
||||
[string]$WorktreePath,
|
||||
|
||||
[switch]$DryRun,
|
||||
|
||||
[switch]$Force,
|
||||
|
||||
[switch]$Help
|
||||
)
|
||||
|
||||
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
. (Join-Path $scriptDir 'IssueReviewLib.ps1')
|
||||
|
||||
$repoRoot = Get-RepoRoot
|
||||
$worktreeLib = Join-Path $repoRoot 'tools/build/WorktreeLib.ps1'
|
||||
if (Test-Path $worktreeLib) {
|
||||
. $worktreeLib
|
||||
}
|
||||
|
||||
if ($Help) {
|
||||
Get-Help $MyInvocation.MyCommand.Path -Full
|
||||
return
|
||||
}
|
||||
|
||||
function Get-PRBranch {
|
||||
param([int]$PRNumber)
|
||||
|
||||
$prInfo = gh pr view $PRNumber --json headRefName 2>$null | ConvertFrom-Json
|
||||
if ($prInfo) {
|
||||
return $prInfo.headRefName
|
||||
}
|
||||
return $null
|
||||
}
|
||||
|
||||
function Find-WorktreeForPR {
|
||||
param([int]$PRNumber)
|
||||
|
||||
$branch = Get-PRBranch -PRNumber $PRNumber
|
||||
if (-not $branch) {
|
||||
return $null
|
||||
}
|
||||
|
||||
$worktrees = Get-WorktreeEntries
|
||||
$wt = $worktrees | Where-Object { $_.Branch -eq $branch } | Select-Object -First 1
|
||||
|
||||
if ($wt) {
|
||||
return $wt.Path
|
||||
}
|
||||
|
||||
# If no dedicated worktree, check if we're on that branch in main repo
|
||||
Push-Location $repoRoot
|
||||
try {
|
||||
$currentBranch = git branch --show-current 2>$null
|
||||
if ($currentBranch -eq $branch) {
|
||||
return $repoRoot
|
||||
}
|
||||
}
|
||||
finally {
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
return $null
|
||||
}
|
||||
|
||||
function Get-ActiveComments {
|
||||
param([int]$PRNumber)
|
||||
|
||||
try {
|
||||
$comments = gh api "repos/microsoft/PowerToys/pulls/$PRNumber/comments" 2>$null | ConvertFrom-Json
|
||||
# Filter to root comments (not replies)
|
||||
$rootComments = $comments | Where-Object { $null -eq $_.in_reply_to_id }
|
||||
return $rootComments
|
||||
}
|
||||
catch {
|
||||
return @()
|
||||
}
|
||||
}
|
||||
|
||||
function Get-UnresolvedThreadCount {
|
||||
param([int]$PRNumber)
|
||||
|
||||
try {
|
||||
$result = gh api graphql -f query="query { repository(owner: `"microsoft`", name: `"PowerToys`") { pullRequest(number: $PRNumber) { reviewThreads(first: 100) { nodes { isResolved } } } } }" 2>$null | ConvertFrom-Json
|
||||
$threads = $result.data.repository.pullRequest.reviewThreads.nodes
|
||||
$unresolved = $threads | Where-Object { -not $_.isResolved }
|
||||
return @($unresolved).Count
|
||||
}
|
||||
catch {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
#region Main
|
||||
try {
|
||||
Info "=" * 60
|
||||
Info "PR FIX - PR #$PRNumber"
|
||||
Info "=" * 60
|
||||
|
||||
# Get PR info
|
||||
$prInfo = gh pr view $PRNumber --json state,headRefName,url 2>$null | ConvertFrom-Json
|
||||
if (-not $prInfo) {
|
||||
throw "PR #$PRNumber not found"
|
||||
}
|
||||
|
||||
if ($prInfo.state -ne 'OPEN') {
|
||||
Warn "PR #$PRNumber is $($prInfo.state), not OPEN"
|
||||
return
|
||||
}
|
||||
|
||||
Info "PR URL: $($prInfo.url)"
|
||||
Info "Branch: $($prInfo.headRefName)"
|
||||
Info "CLI: $CLIType"
|
||||
|
||||
# Find worktree
|
||||
if (-not $WorktreePath) {
|
||||
$WorktreePath = Find-WorktreeForPR -PRNumber $PRNumber
|
||||
}
|
||||
|
||||
if (-not $WorktreePath -or -not (Test-Path $WorktreePath)) {
|
||||
Warn "No worktree found for PR #$PRNumber"
|
||||
Warn "Using main repo root. Make sure the PR branch is checked out."
|
||||
$WorktreePath = $repoRoot
|
||||
}
|
||||
|
||||
Info "Working directory: $WorktreePath"
|
||||
|
||||
# Check for active comments
|
||||
$comments = Get-ActiveComments -PRNumber $PRNumber
|
||||
$unresolvedCount = Get-UnresolvedThreadCount -PRNumber $PRNumber
|
||||
|
||||
Info ""
|
||||
Info "Active review comments: $($comments.Count)"
|
||||
Info "Unresolved threads: $unresolvedCount"
|
||||
|
||||
if ($comments.Count -eq 0 -and $unresolvedCount -eq 0) {
|
||||
Success "No active comments or unresolved threads to fix!"
|
||||
return @{ PRNumber = $PRNumber; Status = 'NothingToFix' }
|
||||
}
|
||||
|
||||
if ($DryRun) {
|
||||
Info ""
|
||||
Warn "[DRY RUN] Would run AI CLI to fix comments"
|
||||
Info "Comments to address:"
|
||||
foreach ($c in $comments | Select-Object -First 5) {
|
||||
Info " - $($c.path):$($c.line) - $($c.body.Substring(0, [Math]::Min(80, $c.body.Length)))..."
|
||||
}
|
||||
return @{ PRNumber = $PRNumber; Status = 'DryRun' }
|
||||
}
|
||||
|
||||
# Confirm
|
||||
if (-not $Force) {
|
||||
$confirm = Read-Host "Fix $($comments.Count) comments on PR #$PRNumber? (y/N)"
|
||||
if ($confirm -notmatch '^[yY]') {
|
||||
Info "Cancelled."
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
# Build prompt
|
||||
$prompt = @"
|
||||
You are fixing review comments on PR #$PRNumber.
|
||||
|
||||
Read the active review comments using GitHub tools and address each one:
|
||||
1. Fetch the PR review comments
|
||||
2. For each comment, understand what change is requested
|
||||
3. Make the code changes to address the feedback
|
||||
4. Build and verify your changes work
|
||||
|
||||
Focus on the reviewer's feedback and make targeted fixes.
|
||||
"@
|
||||
|
||||
# MCP config
|
||||
$mcpConfig = '@.github/skills/pr-fix/references/mcp-config.json'
|
||||
|
||||
Info ""
|
||||
Info "Starting AI fix..."
|
||||
|
||||
Push-Location $WorktreePath
|
||||
try {
|
||||
switch ($CLIType) {
|
||||
'copilot' {
|
||||
$copilotArgs = @('--additional-mcp-config', $mcpConfig, '-p', $prompt, '--yolo')
|
||||
if ($Model) {
|
||||
$copilotArgs += @('--model', $Model)
|
||||
}
|
||||
$output = & copilot @copilotArgs 2>&1
|
||||
# Log output
|
||||
$logPath = Join-Path $repoRoot "Generated Files/prReview/$PRNumber"
|
||||
if (-not (Test-Path $logPath)) {
|
||||
New-Item -ItemType Directory -Path $logPath -Force | Out-Null
|
||||
}
|
||||
$output | Out-File -FilePath (Join-Path $logPath "_fix.log") -Force
|
||||
}
|
||||
'claude' {
|
||||
$output = & claude --print --dangerously-skip-permissions --prompt $prompt 2>&1
|
||||
$logPath = Join-Path $repoRoot "Generated Files/prReview/$PRNumber"
|
||||
if (-not (Test-Path $logPath)) {
|
||||
New-Item -ItemType Directory -Path $logPath -Force | Out-Null
|
||||
}
|
||||
$output | Out-File -FilePath (Join-Path $logPath "_fix.log") -Force
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
# Check results
|
||||
$newUnresolvedCount = Get-UnresolvedThreadCount -PRNumber $PRNumber
|
||||
|
||||
Info ""
|
||||
Info "Fix complete."
|
||||
Info "Unresolved threads before: $unresolvedCount"
|
||||
Info "Unresolved threads after: $newUnresolvedCount"
|
||||
|
||||
if ($newUnresolvedCount -gt 0) {
|
||||
Warn ""
|
||||
Warn "⚠️ $newUnresolvedCount threads still unresolved."
|
||||
Warn "Use VS Code agent to resolve them via GraphQL:"
|
||||
Warn " gh api graphql -f query='mutation { resolveReviewThread(input: {threadId: \"THREAD_ID\"}) { thread { isResolved } } }'"
|
||||
}
|
||||
else {
|
||||
Success "✓ All threads resolved!"
|
||||
}
|
||||
|
||||
# Write signal file
|
||||
$signalDir = Join-Path $repoRoot "Generated Files/prFix/$PRNumber"
|
||||
if (-not (Test-Path $signalDir)) { New-Item -ItemType Directory -Path $signalDir -Force | Out-Null }
|
||||
@{
|
||||
status = if ($newUnresolvedCount -eq 0) { "success" } else { "partial" }
|
||||
prNumber = $PRNumber
|
||||
timestamp = (Get-Date).ToString("o")
|
||||
unresolvedBefore = $unresolvedCount
|
||||
unresolvedAfter = $newUnresolvedCount
|
||||
} | ConvertTo-Json | Set-Content "$signalDir/.signal" -Force
|
||||
|
||||
return @{
|
||||
PRNumber = $PRNumber
|
||||
Status = 'FixApplied'
|
||||
UnresolvedBefore = $unresolvedCount
|
||||
UnresolvedAfter = $newUnresolvedCount
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Err "Error: $($_.Exception.Message)"
|
||||
|
||||
# Write failure signal
|
||||
$signalDir = Join-Path $repoRoot "Generated Files/prFix/$PRNumber"
|
||||
if (-not (Test-Path $signalDir)) { New-Item -ItemType Directory -Path $signalDir -Force | Out-Null }
|
||||
@{
|
||||
status = "failure"
|
||||
prNumber = $PRNumber
|
||||
timestamp = (Get-Date).ToString("o")
|
||||
error = $_.Exception.Message
|
||||
} | ConvertTo-Json | Set-Content "$signalDir/.signal" -Force
|
||||
|
||||
86
.github/skills/pr-fix/scripts/Start-PRFixParallel.ps1
vendored
Normal file
86
.github/skills/pr-fix/scripts/Start-PRFixParallel.ps1
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Run pr-fix in parallel from a single terminal.
|
||||
|
||||
.PARAMETER PRNumbers
|
||||
PR numbers to fix.
|
||||
|
||||
.PARAMETER ThrottleLimit
|
||||
Maximum parallel tasks.
|
||||
|
||||
.PARAMETER CLIType
|
||||
AI CLI type (copilot/claude).
|
||||
|
||||
.PARAMETER Model
|
||||
Copilot CLI model to use (e.g., gpt-5.2-codex).
|
||||
|
||||
.PARAMETER Force
|
||||
Skip confirmation prompts in Start-PRFix.ps1.
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
[int[]]$PRNumbers,
|
||||
|
||||
[int]$ThrottleLimit = 3,
|
||||
|
||||
[ValidateSet('claude', 'copilot')]
|
||||
[string]$CLIType = 'copilot',
|
||||
|
||||
[string]$Model,
|
||||
|
||||
[switch]$Force
|
||||
)
|
||||
|
||||
$repoRoot = Resolve-Path (Join-Path $PSScriptRoot '..\..\..\..')
|
||||
$scriptPath = Join-Path $repoRoot '.github\skills\pr-fix\scripts\Start-PRFix.ps1'
|
||||
|
||||
$results = $PRNumbers | ForEach-Object -Parallel {
|
||||
param($pr)
|
||||
|
||||
$repoRoot = $using:repoRoot
|
||||
$scriptPath = $using:scriptPath
|
||||
$cliType = $using:CLIType
|
||||
$model = $using:Model
|
||||
$force = $using:Force
|
||||
|
||||
Set-Location $repoRoot
|
||||
|
||||
$branch = (gh pr view $pr --json headRefName -q .headRefName)
|
||||
$worktree = (git worktree list | Select-String $branch | ForEach-Object { ($_ -split '\s+')[0] })
|
||||
|
||||
if (-not $worktree) {
|
||||
return [pscustomobject]@{
|
||||
PRNumber = $pr
|
||||
ExitCode = 1
|
||||
Error = "Worktree not found for branch $branch"
|
||||
}
|
||||
}
|
||||
|
||||
Set-Location $worktree
|
||||
|
||||
$args = @('-PRNumber', $pr, '-CLIType', $cliType)
|
||||
if ($model) {
|
||||
$args += @('-Model', $model)
|
||||
}
|
||||
if ($force) {
|
||||
$args += '-Force'
|
||||
}
|
||||
|
||||
try {
|
||||
& $scriptPath @args | Out-Default
|
||||
[pscustomobject]@{
|
||||
PRNumber = $pr
|
||||
ExitCode = $LASTEXITCODE
|
||||
}
|
||||
}
|
||||
catch {
|
||||
[pscustomobject]@{
|
||||
PRNumber = $pr
|
||||
ExitCode = 1
|
||||
Error = $_.Exception.Message
|
||||
}
|
||||
}
|
||||
} -ThrottleLimit $ThrottleLimit
|
||||
|
||||
$results
|
||||
292
.github/skills/pr-review/SKILL.md
vendored
Normal file
292
.github/skills/pr-review/SKILL.md
vendored
Normal file
@@ -0,0 +1,292 @@
|
||||
---
|
||||
name: pr-review
|
||||
description: Comprehensive pull request review with multi-step analysis and comment posting. Use when asked to review a PR, analyze pull request changes, check PR for issues, post review comments, validate PR quality, run code review on a PR, or audit pull request. Generates 13 review step files covering functionality, security, performance, accessibility, and more. For FIXING PR comments, use the pr-fix skill instead.
|
||||
license: Complete terms in LICENSE.txt
|
||||
---
|
||||
|
||||
# PR Review Skill
|
||||
|
||||
Perform comprehensive pull request reviews with multi-step analysis covering functionality, security, performance, accessibility, localization, and more.
|
||||
|
||||
**Note**: This skill is for **reviewing** PRs only. To **fix** review comments, use the `pr-fix` skill.
|
||||
|
||||
## Critical Guidelines
|
||||
|
||||
### Load-on-Demand Architecture
|
||||
Step prompt files are loaded **only when that step is executed** to minimize context usage:
|
||||
- Read `references/review-pr.prompt.md` first for orchestration
|
||||
- Load each `references/0X-*.prompt.md` only when executing that step
|
||||
- Skip steps based on smart filtering (see review-pr.prompt.md)
|
||||
|
||||
### Mandatory External Reference Research
|
||||
**Each step prompt includes an `## External references (MUST research)` section.** Before completing any step, you **MUST**:
|
||||
|
||||
1. **Fetch the referenced URLs** using `fetch_webpage` or equivalent
|
||||
2. **Analyze PR changes against those authoritative sources**
|
||||
3. **Include a `## References consulted` section** in the output file listing:
|
||||
- Which guidelines were checked
|
||||
- Any violations found with specific IDs (e.g., WCAG 1.4.3, OWASP A03, CWE-79)
|
||||
|
||||
| Step | Key External References |
|
||||
|------|------------------------|
|
||||
| 04 Accessibility | WCAG 2.1, Windows Accessibility Guidelines |
|
||||
| 05 Security | OWASP Top 10, CWE Top 25, Microsoft SDL |
|
||||
| 06 Localization | .NET Localization, Microsoft Style Guide |
|
||||
| 07 Globalization | Unicode TR9 (BiDi), ICU Guidelines |
|
||||
| 09 SOLID Design | .NET Architecture Guidelines, Design Patterns |
|
||||
|
||||
**Failure to research external references is a review quality violation.**
|
||||
|
||||
## Skill Contents
|
||||
|
||||
This skill is **self-contained** with all required resources:
|
||||
|
||||
```
|
||||
.github/skills/pr-review/
|
||||
├── SKILL.md # This file
|
||||
├── LICENSE.txt # MIT License
|
||||
├── scripts/
|
||||
│ ├── Start-PRReviewWorkflow.ps1 # Main review script
|
||||
│ ├── Post-ReviewComments.ps1 # Post comments to GitHub
|
||||
│ ├── Get-GitHubPrFilePatch.ps1 # Fetch PR file diffs
|
||||
│ ├── Get-GitHubRawFile.ps1 # Download repo files
|
||||
│ ├── Get-PrIncrementalChanges.ps1 # Detect incremental changes
|
||||
│ └── Test-IncrementalReview.ps1 # Test incremental detection
|
||||
└── references/
|
||||
├── review-pr.prompt.md # Orchestration prompt (load first)
|
||||
├── 01-functionality.prompt.md # Step 01 detailed checks
|
||||
├── 02-compatibility.prompt.md # Step 02 detailed checks
|
||||
├── 03-performance.prompt.md # Step 03 detailed checks
|
||||
├── 04-accessibility.prompt.md # Step 04 detailed checks
|
||||
├── 05-security.prompt.md # Step 05 detailed checks
|
||||
├── 06-localization.prompt.md # Step 06 detailed checks
|
||||
├── 07-globalization.prompt.md # Step 07 detailed checks
|
||||
├── 08-extensibility.prompt.md # Step 08 detailed checks
|
||||
├── 09-solid-design.prompt.md # Step 09 detailed checks
|
||||
├── 10-repo-patterns.prompt.md # Step 10 detailed checks
|
||||
├── 11-docs-automation.prompt.md # Step 11 detailed checks
|
||||
├── 12-code-comments.prompt.md # Step 12 detailed checks
|
||||
└── 13-copilot-guidance.prompt.md # Step 13 (conditional)
|
||||
```
|
||||
|
||||
## Output Directory
|
||||
|
||||
All generated artifacts are placed under `Generated Files/prReview/<pr-number>/` at the repository root (gitignored).
|
||||
|
||||
```
|
||||
Generated Files/prReview/
|
||||
└── <pr-number>/
|
||||
├── 00-OVERVIEW.md # Summary with all findings
|
||||
├── 01-functionality.md # Functional correctness
|
||||
├── 02-compatibility.md # Breaking changes, versioning
|
||||
├── 03-performance.md # Performance implications
|
||||
├── 04-accessibility.md # A11y compliance
|
||||
├── 05-security.md # Security concerns
|
||||
├── 06-localization.md # L10n readiness
|
||||
├── 07-globalization.md # G11n considerations
|
||||
├── 08-extensibility.md # API/extension points
|
||||
├── 09-solid-design.md # SOLID principles
|
||||
├── 10-repo-patterns.md # PowerToys conventions
|
||||
├── 11-docs-automation.md # Documentation coverage
|
||||
├── 12-code-comments.md # Code comment quality
|
||||
├── 13-copilot-guidance.md # (if applicable)
|
||||
└── .signal # Completion signal for orchestrator
|
||||
```
|
||||
|
||||
## Signal File
|
||||
|
||||
On completion, a `.signal` file is created for orchestrator coordination:
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "success",
|
||||
"prNumber": 45365,
|
||||
"timestamp": "2026-02-04T10:05:23Z"
|
||||
}
|
||||
```
|
||||
|
||||
Status values: `success`, `failure`
|
||||
|
||||
## When to Use This Skill
|
||||
|
||||
- Review a specific pull request
|
||||
- Analyze PR changes for quality issues
|
||||
- Post review comments on a PR
|
||||
- Validate PR against PowerToys standards
|
||||
- Run comprehensive code review
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- GitHub CLI (`gh`) installed and authenticated
|
||||
- PowerShell 7+ for running scripts
|
||||
- GitHub MCP configured (for posting comments)
|
||||
|
||||
## Required Variables
|
||||
|
||||
⚠️ **For single PR review**, confirm `{{PRNumber}}` with the user. For batch modes, see "Batch Review Modes" below.
|
||||
|
||||
| Variable | Description | Example |
|
||||
|----------|-------------|---------|
|
||||
| `{{PRNumber}}` | Pull request number to review | `45234` |
|
||||
|
||||
## Workflow
|
||||
|
||||
### Single PR Review
|
||||
|
||||
Execute the review workflow for a specific PR:
|
||||
|
||||
```powershell
|
||||
# From repo root
|
||||
.github/skills/pr-review/scripts/Start-PRReviewWorkflow.ps1 -PRNumbers {{PRNumber}} -CLIType copilot -SkipAssign -SkipFix -Force
|
||||
```
|
||||
|
||||
### Batch Review Modes
|
||||
|
||||
Review multiple PRs with a single command:
|
||||
|
||||
```powershell
|
||||
# Review ALL open non-draft PRs in the repository
|
||||
.github/skills/pr-review/scripts/Start-PRReviewWorkflow.ps1 -AllOpen -SkipAssign -SkipFix -Force
|
||||
|
||||
# Review only PRs assigned to me
|
||||
.github/skills/pr-review/scripts/Start-PRReviewWorkflow.ps1 -Assigned -SkipAssign -SkipFix -Force
|
||||
|
||||
# Review ALL open PRs, skip those already reviewed
|
||||
.github/skills/pr-review/scripts/Start-PRReviewWorkflow.ps1 -AllOpen -SkipExisting -SkipAssign -SkipFix -Force
|
||||
|
||||
# Limit batch size
|
||||
.github/skills/pr-review/scripts/Start-PRReviewWorkflow.ps1 -AllOpen -Limit 50 -SkipExisting -Force
|
||||
```
|
||||
|
||||
### Background Batch Review (Recommended for Large Batches)
|
||||
|
||||
For reviewing many PRs, generate a standalone batch script and run it in background:
|
||||
|
||||
```powershell
|
||||
# Step 1: Generate the batch script
|
||||
.github/skills/pr-review/scripts/Start-PRReviewWorkflow.ps1 -AllOpen -SkipExisting -GenerateBatchScript -Force
|
||||
|
||||
# Step 2: Run in background (minimized window)
|
||||
Start-Process pwsh -ArgumentList '-File', 'Generated Files/prReview/_batch-review.ps1' -WindowStyle Minimized
|
||||
|
||||
# Or run interactively to see progress
|
||||
pwsh -File "Generated Files/prReview/_batch-review.ps1"
|
||||
```
|
||||
|
||||
The batch script:
|
||||
- Processes PRs sequentially (more reliable than parallel)
|
||||
- Skips already-reviewed PRs automatically
|
||||
- Shows progress as `[N/Total] PR #XXXXX`
|
||||
- Logs copilot output to `_copilot.log` in each PR folder
|
||||
- Reports failed PRs at the end
|
||||
|
||||
### Step 2: Review Output
|
||||
|
||||
Check the generated files at `Generated Files/prReview/{{PRNumber}}/`
|
||||
|
||||
## CLI Options
|
||||
|
||||
| Parameter | Description | Default |
|
||||
|-----------|-------------|---------|
|
||||
| `-PRNumbers` | PR number(s) to review | From worktrees |
|
||||
| `-AllOpen` | Review ALL open non-draft PRs | `false` |
|
||||
| `-Assigned` | Review PRs assigned to current user | `false` |
|
||||
| `-Limit` | Max PRs to fetch for batch modes | `100` |
|
||||
| `-SkipExisting` | Skip PRs with completed reviews | `false` |
|
||||
| `-GenerateBatchScript` | Generate standalone script for background execution | `false` |
|
||||
| `-CLIType` | AI CLI to use: `copilot` or `claude` | `copilot` |
|
||||
| `-Model` | Copilot model (e.g., `gpt-5.2-codex`) | (optional) |
|
||||
| `-MinSeverity` | Min severity to post: `high`, `medium`, `low`, `info` | `medium` |
|
||||
| `-SkipAssign` | Skip assigning Copilot as reviewer | `false` |
|
||||
| `-SkipReview` | Skip the review step | `false` |
|
||||
| `-SkipFix` | Skip fix step (recommended - use `pr-fix` skill instead) | `false` |
|
||||
| `-MaxParallel` | Maximum parallel jobs | `3` |
|
||||
| `-Force` | Skip confirmation prompts | `false` |
|
||||
|
||||
**Note**: The `-SkipFix` option is kept for backward compatibility. For fixing PR comments, use the dedicated `pr-fix` skill which provides better control over the fix/resolve loop.
|
||||
|
||||
## AI Prompt References
|
||||
|
||||
### Orchestration (load first)
|
||||
- `references/review-pr.prompt.md` - Main orchestration with PR selection, iteration management, smart filtering
|
||||
|
||||
### Step Prompts (load on-demand per step)
|
||||
Each step prompt contains:
|
||||
- Detailed checklist of concerns (15-25 items)
|
||||
- PowerToys-specific checks
|
||||
- Severity guidelines
|
||||
- Output file template
|
||||
- **External references (MUST research)** section
|
||||
|
||||
| Step | Prompt File | External References |
|
||||
|------|-------------|---------------------|
|
||||
| 01 | `01-functionality.prompt.md` | C# Guidelines, .NET API Design |
|
||||
| 02 | `02-compatibility.prompt.md` | Windows Versions, .NET Breaking Changes |
|
||||
| 03 | `03-performance.prompt.md` | .NET Performance, Async Best Practices |
|
||||
| 04 | `04-accessibility.prompt.md` | **WCAG 2.1**, Windows Accessibility |
|
||||
| 05 | `05-security.prompt.md` | **OWASP Top 10**, **CWE Top 25**, SDL |
|
||||
| 06 | `06-localization.prompt.md` | .NET Localization, MS Style Guide |
|
||||
| 07 | `07-globalization.prompt.md` | Unicode BiDi, ICU, Date/Time Formatting |
|
||||
| 08 | `08-extensibility.prompt.md` | Plugin Architecture, SemVer |
|
||||
| 09 | `09-solid-design.prompt.md` | SOLID Principles, Clean Architecture |
|
||||
| 10 | `10-repo-patterns.prompt.md` | PowerToys docs (architecture, style, logging) |
|
||||
| 11 | `11-docs-automation.prompt.md` | MS Writing Style, XML Docs |
|
||||
| 12 | `12-code-comments.prompt.md` | XML Documentation, Comment Conventions |
|
||||
| 13 | `13-copilot-guidance.prompt.md` | Agent Skills Spec, Prompt Engineering |
|
||||
|
||||
### Fix Prompt
|
||||
- `references/fix-pr-active-comments.prompt.md` - Address active review comments
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
| Problem | Solution |
|
||||
|---------|----------|
|
||||
| PR not found | Verify PR number: `gh pr view {{PRNumber}}` |
|
||||
| Review incomplete | Check `_copilot-review.log` for errors |
|
||||
| Comments not posted | Use VS Code MCP tools (Copilot CLI is read-only) |
|
||||
| Missing `## References consulted` | Re-run step with external reference research |
|
||||
| Cannot resolve comments | Use `gh api graphql` with resolveReviewThread mutation |
|
||||
|
||||
## ⚠️ VS Code Agent Operations
|
||||
|
||||
**Copilot CLI's MCP is read-only.** These operations require VS Code MCP tools:
|
||||
|
||||
| Operation | VS Code MCP Tool |
|
||||
|-----------|------------------|
|
||||
| Assign Copilot reviewer | `mcp_github_request_copilot_review` |
|
||||
| Post review comments | `mcp_github_pull_request_review_write` |
|
||||
| Add line-specific comments | `mcp_github_add_comment_to_pending_review` |
|
||||
| Resolve threads | `gh api graphql` with `resolveReviewThread` |
|
||||
|
||||
### Resolve Review Thread Example
|
||||
|
||||
```powershell
|
||||
# Get unresolved threads
|
||||
gh api graphql -f query='
|
||||
query {
|
||||
repository(owner: "microsoft", name: "PowerToys") {
|
||||
pullRequest(number: {{PRNumber}}) {
|
||||
reviewThreads(first: 50) {
|
||||
nodes { id isResolved path line }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
' --jq '.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false)'
|
||||
|
||||
# Resolve a specific thread
|
||||
gh api graphql -f query='
|
||||
mutation {
|
||||
resolveReviewThread(input: {threadId: "{{threadId}}"}) {
|
||||
thread { isResolved }
|
||||
}
|
||||
}
|
||||
'
|
||||
```
|
||||
|
||||
## Related Skills
|
||||
|
||||
| Skill | Purpose |
|
||||
|-------|---------|
|
||||
| `pr-fix` | Fix review comments after this skill identifies issues |
|
||||
| `issue-to-pr-cycle` | Full orchestration (review → fix loop) |
|
||||
807
.github/skills/pr-review/scripts/Start-PRReviewWorkflow.ps1
vendored
Normal file
807
.github/skills/pr-review/scripts/Start-PRReviewWorkflow.ps1
vendored
Normal file
@@ -0,0 +1,807 @@
|
||||
<#!
|
||||
.SYNOPSIS
|
||||
Review and fix PRs in parallel using GitHub Copilot and MCP.
|
||||
|
||||
.DESCRIPTION
|
||||
For each PR (from worktrees, specified, or fetched from repo), runs:
|
||||
1. Assigns GitHub Copilot as reviewer via GitHub MCP
|
||||
2. Runs review-pr.prompt.md to generate review and post comments
|
||||
3. Runs fix-pr-active-comments.prompt.md to fix issues
|
||||
|
||||
.PARAMETER PRNumbers
|
||||
Array of PR numbers to process. If not specified, finds PRs from issue worktrees.
|
||||
|
||||
.PARAMETER AllOpen
|
||||
Fetch and process ALL open non-draft PRs from the repository.
|
||||
|
||||
.PARAMETER Assigned
|
||||
Fetch and process PRs assigned to the current user.
|
||||
|
||||
.PARAMETER Limit
|
||||
Maximum number of PRs to fetch when using -AllOpen or -Assigned. Default: 100.
|
||||
|
||||
.PARAMETER SkipExisting
|
||||
Skip PRs that already have a completed review (00-OVERVIEW.md exists).
|
||||
|
||||
.PARAMETER SkipAssign
|
||||
Skip assigning Copilot as reviewer.
|
||||
|
||||
.PARAMETER SkipReview
|
||||
Skip the review step.
|
||||
|
||||
.PARAMETER SkipFix
|
||||
Skip the fix step.
|
||||
|
||||
.PARAMETER MinSeverity
|
||||
Minimum severity to post as PR comments: high, medium, low, info. Default: medium.
|
||||
|
||||
.PARAMETER MaxParallel
|
||||
Maximum parallel jobs. Default: 3.
|
||||
|
||||
.PARAMETER DryRun
|
||||
Show what would be done without executing.
|
||||
|
||||
.PARAMETER GenerateBatchScript
|
||||
Instead of running reviews, generate a standalone batch script that can be run
|
||||
in background. The script will be saved to Generated Files/prReview/_batch-review.ps1.
|
||||
|
||||
.PARAMETER CLIType
|
||||
AI CLI to use: copilot or claude. Default: copilot.
|
||||
|
||||
.PARAMETER Model
|
||||
Copilot CLI model to use (e.g., gpt-5.2-codex).
|
||||
|
||||
.EXAMPLE
|
||||
# Process all PRs from issue worktrees
|
||||
./Start-PRReviewWorkflow.ps1
|
||||
|
||||
.EXAMPLE
|
||||
# Process specific PRs
|
||||
./Start-PRReviewWorkflow.ps1 -PRNumbers 45234, 45235
|
||||
|
||||
.EXAMPLE
|
||||
# Review ALL open PRs in the repo
|
||||
./Start-PRReviewWorkflow.ps1 -AllOpen -SkipFix -SkipAssign
|
||||
|
||||
.EXAMPLE
|
||||
# Review PRs assigned to me, skip already reviewed
|
||||
./Start-PRReviewWorkflow.ps1 -Assigned -SkipExisting
|
||||
|
||||
.EXAMPLE
|
||||
# Generate a batch script for background execution
|
||||
./Start-PRReviewWorkflow.ps1 -AllOpen -SkipExisting -GenerateBatchScript
|
||||
|
||||
.EXAMPLE
|
||||
# Only review, don't fix
|
||||
./Start-PRReviewWorkflow.ps1 -SkipFix
|
||||
|
||||
.EXAMPLE
|
||||
# Dry run
|
||||
./Start-PRReviewWorkflow.ps1 -DryRun
|
||||
|
||||
.NOTES
|
||||
Prerequisites:
|
||||
- GitHub CLI (gh) authenticated
|
||||
- Copilot CLI installed
|
||||
- GitHub MCP configured for posting comments
|
||||
#>
|
||||
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[int[]]$PRNumbers,
|
||||
|
||||
[switch]$AllOpen,
|
||||
|
||||
[switch]$Assigned,
|
||||
|
||||
[int]$Limit = 100,
|
||||
|
||||
[switch]$SkipExisting,
|
||||
|
||||
[switch]$SkipAssign,
|
||||
|
||||
[switch]$SkipReview,
|
||||
|
||||
[switch]$SkipFix,
|
||||
|
||||
[ValidateSet('high', 'medium', 'low', 'info')]
|
||||
[string]$MinSeverity = 'medium',
|
||||
|
||||
[int]$MaxParallel = 3,
|
||||
|
||||
[switch]$DryRun,
|
||||
|
||||
[switch]$GenerateBatchScript,
|
||||
|
||||
[ValidateSet('copilot', 'claude')]
|
||||
[string]$CLIType = 'copilot',
|
||||
|
||||
[string]$Model,
|
||||
|
||||
[switch]$Force,
|
||||
|
||||
[switch]$Help
|
||||
)
|
||||
|
||||
# Load libraries
|
||||
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
. "$scriptDir/IssueReviewLib.ps1"
|
||||
|
||||
# Load worktree library
|
||||
$repoRoot = Get-RepoRoot
|
||||
$worktreeLib = Join-Path $repoRoot 'tools/build/WorktreeLib.ps1'
|
||||
if (Test-Path $worktreeLib) {
|
||||
. $worktreeLib
|
||||
}
|
||||
|
||||
if ($Help) {
|
||||
Get-Help $MyInvocation.MyCommand.Path -Full
|
||||
return
|
||||
}
|
||||
|
||||
function Get-AllOpenPRs {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Get all open non-draft PRs from the repository.
|
||||
#>
|
||||
param(
|
||||
[int]$Limit = 100
|
||||
)
|
||||
|
||||
Info "Fetching all open PRs (limit: $Limit)..."
|
||||
$prList = gh pr list --state open --json number,url,headRefName,isDraft --limit $Limit 2>$null | ConvertFrom-Json
|
||||
|
||||
if (-not $prList) {
|
||||
return @()
|
||||
}
|
||||
|
||||
# Filter out drafts
|
||||
$prs = @()
|
||||
foreach ($pr in $prList | Where-Object { -not $_.isDraft }) {
|
||||
$prs += @{
|
||||
PRNumber = $pr.number
|
||||
PRUrl = $pr.url
|
||||
Branch = $pr.headRefName
|
||||
WorktreePath = $repoRoot
|
||||
}
|
||||
}
|
||||
|
||||
Info "Found $($prs.Count) non-draft open PRs"
|
||||
return $prs
|
||||
}
|
||||
|
||||
function Get-AssignedPRs {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Get PRs assigned to the current user.
|
||||
#>
|
||||
param(
|
||||
[int]$Limit = 100
|
||||
)
|
||||
|
||||
Info "Fetching PRs assigned to @me (limit: $Limit)..."
|
||||
$prList = gh pr list --assignee @me --state open --json number,url,headRefName,isDraft --limit $Limit 2>$null | ConvertFrom-Json
|
||||
|
||||
if (-not $prList) {
|
||||
return @()
|
||||
}
|
||||
|
||||
$prs = @()
|
||||
foreach ($pr in $prList | Where-Object { -not $_.isDraft }) {
|
||||
$prs += @{
|
||||
PRNumber = $pr.number
|
||||
PRUrl = $pr.url
|
||||
Branch = $pr.headRefName
|
||||
WorktreePath = $repoRoot
|
||||
}
|
||||
}
|
||||
|
||||
Info "Found $($prs.Count) assigned PRs"
|
||||
return $prs
|
||||
}
|
||||
|
||||
function Test-ReviewExists {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Check if a PR review already exists (has 00-OVERVIEW.md).
|
||||
#>
|
||||
param(
|
||||
[int]$PRNumber
|
||||
)
|
||||
|
||||
$reviewPath = Join-Path $repoRoot "Generated Files/prReview/$PRNumber/00-OVERVIEW.md"
|
||||
return Test-Path $reviewPath
|
||||
}
|
||||
|
||||
function Get-PRsFromWorktrees {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Get PR numbers from issue worktrees by checking for open PRs on each branch.
|
||||
#>
|
||||
$worktrees = Get-WorktreeEntries | Where-Object { $_.Branch -like 'issue/*' }
|
||||
$prs = @()
|
||||
|
||||
foreach ($wt in $worktrees) {
|
||||
$prInfo = gh pr list --head $wt.Branch --json number,url --state open 2>$null | ConvertFrom-Json
|
||||
if ($prInfo -and $prInfo.Count -gt 0) {
|
||||
$prs += @{
|
||||
PRNumber = $prInfo[0].number
|
||||
PRUrl = $prInfo[0].url
|
||||
Branch = $wt.Branch
|
||||
WorktreePath = $wt.Path
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $prs
|
||||
}
|
||||
|
||||
function Invoke-AssignCopilotReviewer {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Assign GitHub Copilot as a reviewer to the PR using GitHub MCP.
|
||||
#>
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
[int]$PRNumber,
|
||||
[string]$CLIType = 'copilot',
|
||||
[string]$Model,
|
||||
[switch]$DryRun
|
||||
)
|
||||
|
||||
if ($DryRun) {
|
||||
Info " [DRY RUN] Would request Copilot review for PR #$PRNumber"
|
||||
return $true
|
||||
}
|
||||
|
||||
# Use a prompt that instructs Copilot to use GitHub MCP to assign Copilot as reviewer
|
||||
$prompt = @"
|
||||
Use the GitHub MCP to request a review from GitHub Copilot for PR #$PRNumber.
|
||||
|
||||
Steps:
|
||||
1. Use the GitHub MCP tool to add "Copilot" as a reviewer to pull request #$PRNumber in the microsoft/PowerToys repository
|
||||
2. This should add Copilot to the "Reviewers" section of the PR
|
||||
|
||||
If GitHub MCP is not available, report that and skip this step.
|
||||
"@
|
||||
|
||||
# MCP config for github-artifacts tools - use absolute path from main repo
|
||||
$mcpConfigPath = Join-Path $repoRoot '.github/skills/pr-review/references/mcp-config.json'
|
||||
$mcpConfig = "@$mcpConfigPath"
|
||||
|
||||
try {
|
||||
Info " Requesting Copilot review via GitHub MCP..."
|
||||
|
||||
switch ($CLIType) {
|
||||
'copilot' {
|
||||
$copilotArgs = @('--additional-mcp-config', $mcpConfig, '-p', $prompt, '--yolo', '-s')
|
||||
if ($Model) {
|
||||
$copilotArgs += @('--model', $Model)
|
||||
}
|
||||
& copilot @copilotArgs 2>&1 | Out-Null
|
||||
}
|
||||
'claude' {
|
||||
& claude --print --dangerously-skip-permissions --prompt $prompt 2>&1 | Out-Null
|
||||
}
|
||||
}
|
||||
|
||||
return $true
|
||||
}
|
||||
catch {
|
||||
Warn " Could not assign Copilot reviewer: $($_.Exception.Message)"
|
||||
return $false
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-PRReview {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Run review-pr.prompt.md using Copilot CLI.
|
||||
#>
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
[int]$PRNumber,
|
||||
[string]$CLIType = 'copilot',
|
||||
[string]$Model,
|
||||
[string]$MinSeverity = 'medium',
|
||||
[switch]$DryRun
|
||||
)
|
||||
|
||||
# Simple prompt - let the prompt file define all the details
|
||||
$prompt = @"
|
||||
Follow exactly what at .github/prompts/review-pr.prompt.md to do with PR #$PRNumber.
|
||||
Post findings with severity >= $MinSeverity as PR review comments via GitHub MCP.
|
||||
"@
|
||||
|
||||
if ($DryRun) {
|
||||
Info " [DRY RUN] Would run PR review for #$PRNumber"
|
||||
return @{ Success = $true; ReviewPath = "Generated Files/prReview/$PRNumber" }
|
||||
}
|
||||
|
||||
$reviewPath = Join-Path $repoRoot "Generated Files/prReview/$PRNumber"
|
||||
|
||||
# Ensure the review directory exists
|
||||
if (-not (Test-Path $reviewPath)) {
|
||||
New-Item -ItemType Directory -Path $reviewPath -Force | Out-Null
|
||||
}
|
||||
|
||||
# MCP config for github-artifacts tools - use absolute path from main repo
|
||||
$mcpConfigPath = Join-Path $repoRoot '.github/skills/pr-review/references/mcp-config.json'
|
||||
$mcpConfig = "@$mcpConfigPath"
|
||||
|
||||
Push-Location $repoRoot
|
||||
try {
|
||||
switch ($CLIType) {
|
||||
'copilot' {
|
||||
Info " Running Copilot review (this may take several minutes)..."
|
||||
$copilotArgs = @('--additional-mcp-config', $mcpConfig, '-p', $prompt, '--yolo')
|
||||
if ($Model) {
|
||||
$copilotArgs += @('--model', $Model)
|
||||
}
|
||||
$output = & copilot @copilotArgs 2>&1
|
||||
# Log output for debugging
|
||||
$logFile = Join-Path $reviewPath "_copilot-review.log"
|
||||
$output | Out-File -FilePath $logFile -Force
|
||||
}
|
||||
'claude' {
|
||||
Info " Running Claude review (this may take several minutes)..."
|
||||
$output = & claude --print --dangerously-skip-permissions --prompt $prompt 2>&1
|
||||
$logFile = Join-Path $reviewPath "_claude-review.log"
|
||||
$output | Out-File -FilePath $logFile -Force
|
||||
}
|
||||
}
|
||||
|
||||
# Check if review files were created (at minimum, check for multiple step files)
|
||||
$overviewPath = Join-Path $reviewPath '00-OVERVIEW.md'
|
||||
$stepFiles = Get-ChildItem -Path $reviewPath -Filter "*.md" -ErrorAction SilentlyContinue
|
||||
$stepCount = ($stepFiles | Where-Object { $_.Name -match '^\d{2}-' }).Count
|
||||
|
||||
if ($stepCount -ge 5) {
|
||||
return @{ Success = $true; ReviewPath = $reviewPath; StepFilesCreated = $stepCount }
|
||||
} elseif (Test-Path $overviewPath) {
|
||||
Warn " Only overview created, step files may be incomplete ($stepCount step files)"
|
||||
return @{ Success = $true; ReviewPath = $reviewPath; StepFilesCreated = $stepCount; Partial = $true }
|
||||
} else {
|
||||
return @{ Success = $false; Error = "Review files not created (found $stepCount step files)" }
|
||||
}
|
||||
}
|
||||
catch {
|
||||
return @{ Success = $false; Error = $_.Exception.Message }
|
||||
}
|
||||
finally {
|
||||
Pop-Location
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-FixPRComments {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Run fix-pr-active-comments.prompt.md to fix issues.
|
||||
#>
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
[int]$PRNumber,
|
||||
[string]$WorktreePath,
|
||||
[string]$CLIType = 'copilot',
|
||||
[string]$Model,
|
||||
[switch]$DryRun
|
||||
)
|
||||
|
||||
# Simple prompt - let the prompt file define all the details
|
||||
$prompt = "Follow .github/prompts/fix-pr-active-comments.prompt.md for PR #$PRNumber."
|
||||
|
||||
if ($DryRun) {
|
||||
Info " [DRY RUN] Would fix PR comments for #$PRNumber"
|
||||
return @{ Success = $true }
|
||||
}
|
||||
|
||||
$workDir = if ($WorktreePath -and (Test-Path $WorktreePath)) { $WorktreePath } else { $repoRoot }
|
||||
|
||||
# MCP config for github-artifacts tools - use absolute path from main repo
|
||||
# This is needed because worktrees don't have .github folder
|
||||
$mcpConfigPath = Join-Path $repoRoot '.github/skills/pr-review/references/mcp-config.json'
|
||||
$mcpConfig = "@$mcpConfigPath"
|
||||
|
||||
Push-Location $workDir
|
||||
try {
|
||||
switch ($CLIType) {
|
||||
'copilot' {
|
||||
Info " Running Copilot to fix comments..."
|
||||
$copilotArgs = @('--additional-mcp-config', $mcpConfig, '-p', $prompt, '--yolo')
|
||||
if ($Model) {
|
||||
$copilotArgs += @('--model', $Model)
|
||||
}
|
||||
$output = & copilot @copilotArgs 2>&1
|
||||
# Log output for debugging
|
||||
$logPath = Join-Path $repoRoot "Generated Files/prReview/$PRNumber"
|
||||
if (-not (Test-Path $logPath)) {
|
||||
New-Item -ItemType Directory -Path $logPath -Force | Out-Null
|
||||
}
|
||||
$logFile = Join-Path $logPath "_copilot-fix.log"
|
||||
$output | Out-File -FilePath $logFile -Force
|
||||
}
|
||||
'claude' {
|
||||
Info " Running Claude to fix comments..."
|
||||
$output = & claude --print --dangerously-skip-permissions --prompt $prompt 2>&1
|
||||
$logPath = Join-Path $repoRoot "Generated Files/prReview/$PRNumber"
|
||||
if (-not (Test-Path $logPath)) {
|
||||
New-Item -ItemType Directory -Path $logPath -Force | Out-Null
|
||||
}
|
||||
$logFile = Join-Path $logPath "_claude-fix.log"
|
||||
$output | Out-File -FilePath $logFile -Force
|
||||
}
|
||||
}
|
||||
|
||||
return @{ Success = $true }
|
||||
}
|
||||
catch {
|
||||
return @{ Success = $false; Error = $_.Exception.Message }
|
||||
}
|
||||
finally {
|
||||
Pop-Location
|
||||
}
|
||||
}
|
||||
|
||||
function Start-PRWorkflowJob {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Process a single PR through the workflow.
|
||||
#>
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
[int]$PRNumber,
|
||||
[string]$WorktreePath,
|
||||
[string]$CLIType = 'copilot',
|
||||
[string]$Model,
|
||||
[string]$MinSeverity = 'medium',
|
||||
[switch]$SkipAssign,
|
||||
[switch]$SkipReview,
|
||||
[switch]$SkipFix,
|
||||
[switch]$DryRun
|
||||
)
|
||||
|
||||
$result = @{
|
||||
PRNumber = $PRNumber
|
||||
AssignResult = $null
|
||||
ReviewResult = $null
|
||||
FixResult = $null
|
||||
Success = $true
|
||||
}
|
||||
|
||||
# Step 1: Assign Copilot as reviewer
|
||||
if (-not $SkipAssign) {
|
||||
Info " Step 1: Assigning Copilot reviewer..."
|
||||
$result.AssignResult = Invoke-AssignCopilotReviewer -PRNumber $PRNumber -CLIType $CLIType -Model $Model -DryRun:$DryRun
|
||||
if (-not $result.AssignResult) {
|
||||
Warn " Assignment step had issues (continuing...)"
|
||||
}
|
||||
} else {
|
||||
Info " Step 1: Skipped (assign)"
|
||||
}
|
||||
|
||||
# Step 2: Run PR review
|
||||
if (-not $SkipReview) {
|
||||
Info " Step 2: Running PR review..."
|
||||
$result.ReviewResult = Invoke-PRReview -PRNumber $PRNumber -CLIType $CLIType -Model $Model -MinSeverity $MinSeverity -DryRun:$DryRun
|
||||
if (-not $result.ReviewResult.Success) {
|
||||
Warn " Review step failed: $($result.ReviewResult.Error)"
|
||||
$result.Success = $false
|
||||
} else {
|
||||
$stepInfo = if ($result.ReviewResult.StepFilesCreated) { " ($($result.ReviewResult.StepFilesCreated) step files)" } else { "" }
|
||||
$partialInfo = if ($result.ReviewResult.Partial) { " [PARTIAL]" } else { "" }
|
||||
Success " Review completed: $($result.ReviewResult.ReviewPath)$stepInfo$partialInfo"
|
||||
}
|
||||
} else {
|
||||
Info " Step 2: Skipped (review)"
|
||||
}
|
||||
|
||||
# Step 3: Fix PR comments
|
||||
if (-not $SkipFix) {
|
||||
Info " Step 3: Fixing PR comments..."
|
||||
$result.FixResult = Invoke-FixPRComments -PRNumber $PRNumber -WorktreePath $WorktreePath -CLIType $CLIType -Model $Model -DryRun:$DryRun
|
||||
if (-not $result.FixResult.Success) {
|
||||
Warn " Fix step failed: $($result.FixResult.Error)"
|
||||
$result.Success = $false
|
||||
} else {
|
||||
Success " Fix step completed"
|
||||
}
|
||||
} else {
|
||||
Info " Step 3: Skipped (fix)"
|
||||
}
|
||||
|
||||
return $result
|
||||
}
|
||||
|
||||
#region Main Script
|
||||
try {
|
||||
Info "Repository root: $repoRoot"
|
||||
Info "CLI type: $CLIType"
|
||||
Info "Min severity for comments: $MinSeverity"
|
||||
Info "Max parallel: $MaxParallel"
|
||||
|
||||
# Determine PRs to process
|
||||
$prsToProcess = @()
|
||||
|
||||
if ($PRNumbers -and $PRNumbers.Count -gt 0) {
|
||||
# Use specified PR numbers
|
||||
foreach ($prNum in $PRNumbers) {
|
||||
$prInfo = gh pr view $prNum --json number,url,headRefName 2>$null | ConvertFrom-Json
|
||||
if ($prInfo) {
|
||||
# Try to find matching worktree
|
||||
$wt = Get-WorktreeEntries | Where-Object { $_.Branch -eq $prInfo.headRefName } | Select-Object -First 1
|
||||
$prsToProcess += @{
|
||||
PRNumber = $prInfo.number
|
||||
PRUrl = $prInfo.url
|
||||
Branch = $prInfo.headRefName
|
||||
WorktreePath = if ($wt) { $wt.Path } else { $repoRoot }
|
||||
}
|
||||
} else {
|
||||
Warn "PR #$prNum not found"
|
||||
}
|
||||
}
|
||||
} elseif ($AllOpen) {
|
||||
# Fetch all open PRs from repository
|
||||
$prsToProcess = Get-AllOpenPRs -Limit $Limit
|
||||
} elseif ($Assigned) {
|
||||
# Fetch PRs assigned to current user
|
||||
$prsToProcess = Get-AssignedPRs -Limit $Limit
|
||||
} else {
|
||||
# Get PRs from worktrees
|
||||
Info "`nFinding PRs from issue worktrees..."
|
||||
$prsToProcess = Get-PRsFromWorktrees
|
||||
}
|
||||
|
||||
# Filter out already reviewed PRs if requested
|
||||
if ($SkipExisting -and $prsToProcess.Count -gt 0) {
|
||||
$beforeCount = $prsToProcess.Count
|
||||
$prsToProcess = $prsToProcess | Where-Object { -not (Test-ReviewExists -PRNumber $_.PRNumber) }
|
||||
$skippedCount = $beforeCount - $prsToProcess.Count
|
||||
if ($skippedCount -gt 0) {
|
||||
Info "Skipped $skippedCount PRs with existing reviews"
|
||||
}
|
||||
}
|
||||
|
||||
if ($prsToProcess.Count -eq 0) {
|
||||
Warn "No PRs found to process."
|
||||
return
|
||||
}
|
||||
|
||||
# Display PRs
|
||||
Info "`nPRs to process:"
|
||||
Info ("-" * 80)
|
||||
foreach ($pr in $prsToProcess) {
|
||||
Info (" #{0,-6} {1}" -f $pr.PRNumber, $pr.PRUrl)
|
||||
}
|
||||
Info ("-" * 80)
|
||||
|
||||
# Generate batch script mode - creates a standalone script for background execution
|
||||
if ($GenerateBatchScript) {
|
||||
$batchPath = Join-Path $repoRoot "Generated Files/prReview/_batch-review.ps1"
|
||||
$prNumbers = $prsToProcess | ForEach-Object { $_.PRNumber }
|
||||
|
||||
$batchContent = @"
|
||||
# Auto-generated batch review script
|
||||
# Generated: $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')
|
||||
# PRs to review: $($prNumbers.Count)
|
||||
#
|
||||
# Run this script in a PowerShell terminal to review all PRs sequentially.
|
||||
# Each review takes 2-5 minutes. Total estimated time: $([math]::Ceiling($prNumbers.Count * 3)) minutes.
|
||||
#
|
||||
# Usage: pwsh -File "$batchPath"
|
||||
|
||||
`$ErrorActionPreference = 'Continue'
|
||||
`$repoRoot = '$repoRoot'
|
||||
Set-Location `$repoRoot
|
||||
|
||||
`$prNumbers = @($($prNumbers -join ', '))
|
||||
`$total = `$prNumbers.Count
|
||||
`$completed = 0
|
||||
`$failed = @()
|
||||
|
||||
Write-Host "Starting batch review of `$total PRs" -ForegroundColor Cyan
|
||||
Write-Host "Estimated time: $([math]::Ceiling($prNumbers.Count * 3)) minutes" -ForegroundColor Yellow
|
||||
Write-Host ""
|
||||
|
||||
foreach (`$pr in `$prNumbers) {
|
||||
`$completed++
|
||||
`$reviewPath = Join-Path `$repoRoot "Generated Files/prReview/`$pr"
|
||||
|
||||
# Skip if already reviewed
|
||||
if (Test-Path (Join-Path `$reviewPath "00-OVERVIEW.md")) {
|
||||
Write-Host "[`$completed/`$total] PR #`$pr - Already reviewed, skipping" -ForegroundColor DarkGray
|
||||
continue
|
||||
}
|
||||
|
||||
Write-Host "[`$completed/`$total] PR #`$pr - Starting review..." -ForegroundColor Cyan
|
||||
|
||||
try {
|
||||
# Create output directory
|
||||
if (-not (Test-Path `$reviewPath)) {
|
||||
New-Item -ItemType Directory -Path `$reviewPath -Force | Out-Null
|
||||
}
|
||||
|
||||
# Run copilot review
|
||||
`$prompt = "Follow exactly what at .github/skills/pr-review/references/review-pr.prompt.md to do with PR #`$pr. Write output to Generated Files/prReview/`$pr/. Do not post comments to GitHub."
|
||||
|
||||
& copilot -p `$prompt --yolo 2>&1 | Out-File -FilePath (Join-Path `$reviewPath "_copilot.log") -Force
|
||||
|
||||
# Check if review completed
|
||||
if (Test-Path (Join-Path `$reviewPath "00-OVERVIEW.md")) {
|
||||
Write-Host "[`$completed/`$total] PR #`$pr - Review completed" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "[`$completed/`$total] PR #`$pr - Review may be incomplete (no overview file)" -ForegroundColor Yellow
|
||||
`$failed += `$pr
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Host "[`$completed/`$total] PR #`$pr - FAILED: `$(`$_.Exception.Message)" -ForegroundColor Red
|
||||
`$failed += `$pr
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "======================================" -ForegroundColor Cyan
|
||||
Write-Host "Batch review complete!" -ForegroundColor Cyan
|
||||
Write-Host "Total: `$total | Completed: `$(`$total - `$failed.Count) | Failed: `$(`$failed.Count)" -ForegroundColor Cyan
|
||||
if (`$failed.Count -gt 0) {
|
||||
Write-Host "Failed PRs: `$(`$failed -join ', ')" -ForegroundColor Red
|
||||
}
|
||||
Write-Host "======================================" -ForegroundColor Cyan
|
||||
"@
|
||||
|
||||
$batchContent | Out-File -FilePath $batchPath -Encoding UTF8 -Force
|
||||
|
||||
Success "`nBatch script generated: $batchPath"
|
||||
Info "PRs included: $($prNumbers.Count)"
|
||||
Info ""
|
||||
Info "To run the batch review in background:"
|
||||
Info " Start-Process pwsh -ArgumentList '-File',`"$batchPath`" -WindowStyle Minimized"
|
||||
Info ""
|
||||
Info "Or run interactively to see progress:"
|
||||
Info " pwsh -File `"$batchPath`""
|
||||
|
||||
return @{
|
||||
BatchScript = $batchPath
|
||||
PRCount = $prNumbers.Count
|
||||
PRNumbers = $prNumbers
|
||||
}
|
||||
}
|
||||
|
||||
if ($DryRun) {
|
||||
Warn "`nDry run mode - no changes will be made."
|
||||
}
|
||||
|
||||
# Confirm
|
||||
if (-not $Force -and -not $DryRun) {
|
||||
$stepsDesc = @()
|
||||
if (-not $SkipAssign) { $stepsDesc += "assign Copilot" }
|
||||
if (-not $SkipReview) { $stepsDesc += "review" }
|
||||
if (-not $SkipFix) { $stepsDesc += "fix comments" }
|
||||
|
||||
$confirm = Read-Host "`nProceed with $($prsToProcess.Count) PRs ($($stepsDesc -join ', '))? (y/N)"
|
||||
if ($confirm -notmatch '^[yY]') {
|
||||
Info "Cancelled."
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
# Process PRs (using jobs for parallelization)
|
||||
$results = @{
|
||||
Success = @()
|
||||
Failed = @()
|
||||
}
|
||||
|
||||
if ($MaxParallel -gt 1 -and $prsToProcess.Count -gt 1) {
|
||||
# Parallel processing using PowerShell jobs
|
||||
Info "`nStarting parallel processing (max $MaxParallel concurrent)..."
|
||||
|
||||
$jobs = @()
|
||||
$prQueue = [System.Collections.Queue]::new($prsToProcess)
|
||||
|
||||
while ($prQueue.Count -gt 0 -or $jobs.Count -gt 0) {
|
||||
# Start new jobs up to MaxParallel
|
||||
while ($jobs.Count -lt $MaxParallel -and $prQueue.Count -gt 0) {
|
||||
$pr = $prQueue.Dequeue()
|
||||
|
||||
Info "`n" + ("=" * 60)
|
||||
Info "PROCESSING PR #$($pr.PRNumber)"
|
||||
Info ("=" * 60)
|
||||
|
||||
# For simplicity, process sequentially within each PR but PRs in parallel
|
||||
# Since copilot CLI might have issues with true parallel execution
|
||||
$jobResult = Start-PRWorkflowJob `
|
||||
-PRNumber $pr.PRNumber `
|
||||
-WorktreePath $pr.WorktreePath `
|
||||
-CLIType $CLIType `
|
||||
-Model $Model `
|
||||
-MinSeverity $MinSeverity `
|
||||
-SkipAssign:$SkipAssign `
|
||||
-SkipReview:$SkipReview `
|
||||
-SkipFix:$SkipFix `
|
||||
-DryRun:$DryRun
|
||||
|
||||
if ($jobResult.Success) {
|
||||
$results.Success += $jobResult
|
||||
Success "✓ PR #$($pr.PRNumber) workflow completed"
|
||||
} else {
|
||||
$results.Failed += $jobResult
|
||||
Err "✗ PR #$($pr.PRNumber) workflow had failures"
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
# Sequential processing
|
||||
foreach ($pr in $prsToProcess) {
|
||||
Info "`n" + ("=" * 60)
|
||||
Info "PROCESSING PR #$($pr.PRNumber)"
|
||||
Info ("=" * 60)
|
||||
|
||||
$jobResult = Start-PRWorkflowJob `
|
||||
-PRNumber $pr.PRNumber `
|
||||
-WorktreePath $pr.WorktreePath `
|
||||
-CLIType $CLIType `
|
||||
-Model $Model `
|
||||
-MinSeverity $MinSeverity `
|
||||
-SkipAssign:$SkipAssign `
|
||||
-SkipReview:$SkipReview `
|
||||
-SkipFix:$SkipFix `
|
||||
-DryRun:$DryRun
|
||||
|
||||
if ($jobResult.Success) {
|
||||
$results.Success += $jobResult
|
||||
Success "✓ PR #$($pr.PRNumber) workflow completed"
|
||||
} else {
|
||||
$results.Failed += $jobResult
|
||||
Err "✗ PR #$($pr.PRNumber) workflow had failures"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Summary
|
||||
Info "`n" + ("=" * 80)
|
||||
Info "PR REVIEW WORKFLOW COMPLETE"
|
||||
Info ("=" * 80)
|
||||
Info "Total PRs: $($prsToProcess.Count)"
|
||||
|
||||
if ($results.Success.Count -gt 0) {
|
||||
Success "Succeeded: $($results.Success.Count)"
|
||||
foreach ($r in $results.Success) {
|
||||
Success " PR #$($r.PRNumber)"
|
||||
}
|
||||
}
|
||||
|
||||
if ($results.Failed.Count -gt 0) {
|
||||
Err "Had issues: $($results.Failed.Count)"
|
||||
foreach ($r in $results.Failed) {
|
||||
Err " PR #$($r.PRNumber)"
|
||||
}
|
||||
}
|
||||
|
||||
Info "`nReview files location: Generated Files/prReview/<PR_NUMBER>/"
|
||||
Info ("=" * 80)
|
||||
|
||||
# Write signal files for orchestrator
|
||||
foreach ($r in $results.Success) {
|
||||
$signalPath = Join-Path $repoRoot "Generated Files/prReview/$($r.PRNumber)/.signal"
|
||||
@{
|
||||
status = "success"
|
||||
prNumber = $r.PRNumber
|
||||
timestamp = (Get-Date).ToString("o")
|
||||
} | ConvertTo-Json | Set-Content $signalPath -Force
|
||||
}
|
||||
foreach ($r in $results.Failed) {
|
||||
$signalPath = Join-Path $repoRoot "Generated Files/prReview/$($r.PRNumber)/.signal"
|
||||
@{
|
||||
status = "failure"
|
||||
prNumber = $r.PRNumber
|
||||
timestamp = (Get-Date).ToString("o")
|
||||
} | ConvertTo-Json | Set-Content $signalPath -Force
|
||||
}
|
||||
|
||||
return $results
|
||||
}
|
||||
catch {
|
||||
Err "Error: $($_.Exception.Message)"
|
||||
exit 1
|
||||
}
|
||||
#endregion
|
||||
@@ -18,7 +18,6 @@
|
||||
"StylesReportTool\\PowerToys.StylesReportTool.exe",
|
||||
|
||||
"CalculatorEngineCommon.dll",
|
||||
"PowerToys.Common.UI.Controls.dll",
|
||||
"PowerToys.ManagedTelemetry.dll",
|
||||
"PowerToys.ManagedCommon.dll",
|
||||
"PowerToys.ManagedCsWin32.dll",
|
||||
|
||||
@@ -13,36 +13,9 @@ Param(
|
||||
|
||||
# Root folder Path for processing
|
||||
[Parameter(Mandatory=$False,Position=4)]
|
||||
[string]$sourceLink = "https://microsoft.pkgs.visualstudio.com/ProjectReunion/_packaging/Project.Reunion.nuget.internal/nuget/v3/index.json",
|
||||
|
||||
# Use Azure Pipeline artifact as source for metapackage
|
||||
[Parameter(Mandatory=$False,Position=5)]
|
||||
[boolean]$useArtifactSource = $False,
|
||||
|
||||
# Azure DevOps organization URL
|
||||
[Parameter(Mandatory=$False,Position=6)]
|
||||
[string]$azureDevOpsOrg = "https://dev.azure.com/microsoft",
|
||||
|
||||
# Azure DevOps project name
|
||||
[Parameter(Mandatory=$False,Position=7)]
|
||||
[string]$azureDevOpsProject = "ProjectReunion",
|
||||
|
||||
# Pipeline build ID (or "latest" for latest build)
|
||||
[Parameter(Mandatory=$False,Position=8)]
|
||||
[string]$buildId = "",
|
||||
|
||||
# Artifact name containing the NuGet packages
|
||||
[Parameter(Mandatory=$False,Position=9)]
|
||||
[string]$artifactName = "WindowsAppSDK_Nuget_And_MSIX",
|
||||
|
||||
# Metapackage name to look for in artifact
|
||||
[Parameter(Mandatory=$False,Position=10)]
|
||||
[string]$metaPackageName = "Microsoft.WindowsAppSDK"
|
||||
[string]$sourceLink = "https://microsoft.pkgs.visualstudio.com/ProjectReunion/_packaging/Project.Reunion.nuget.internal/nuget/v3/index.json"
|
||||
)
|
||||
|
||||
# Script-level constants
|
||||
$script:PackageVersionRegex = '^(.+?)\.(\d+\..*)$'
|
||||
|
||||
|
||||
|
||||
function Read-FileWithEncoding {
|
||||
@@ -84,7 +57,7 @@ function Add-NuGetSourceAndMapping {
|
||||
|
||||
# Ensure packageSources exists
|
||||
if (-not $Xml.configuration.packageSources) {
|
||||
$null = $Xml.configuration.AppendChild($Xml.CreateElement("packageSources"))
|
||||
$Xml.configuration.AppendChild($Xml.CreateElement("packageSources")) | Out-Null
|
||||
}
|
||||
$sources = $Xml.configuration.packageSources
|
||||
|
||||
@@ -93,13 +66,13 @@ function Add-NuGetSourceAndMapping {
|
||||
if (-not $sourceNode) {
|
||||
$sourceNode = $Xml.CreateElement("add")
|
||||
$sourceNode.SetAttribute("key", $Key)
|
||||
$null = $sources.AppendChild($sourceNode)
|
||||
$sources.AppendChild($sourceNode) | Out-Null
|
||||
}
|
||||
$sourceNode.SetAttribute("value", $Value)
|
||||
|
||||
# Ensure packageSourceMapping exists
|
||||
if (-not $Xml.configuration.packageSourceMapping) {
|
||||
$null = $Xml.configuration.AppendChild($Xml.CreateElement("packageSourceMapping"))
|
||||
$Xml.configuration.AppendChild($Xml.CreateElement("packageSourceMapping")) | Out-Null
|
||||
}
|
||||
$mapping = $Xml.configuration.packageSourceMapping
|
||||
|
||||
@@ -107,7 +80,7 @@ function Add-NuGetSourceAndMapping {
|
||||
$invalidNodes = $mapping.SelectNodes("packageSource[not(@key) or @key='']")
|
||||
if ($invalidNodes) {
|
||||
foreach ($node in $invalidNodes) {
|
||||
$null = $mapping.RemoveChild($node)
|
||||
$mapping.RemoveChild($node) | Out-Null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,9 +91,9 @@ function Add-NuGetSourceAndMapping {
|
||||
$mappingSource.SetAttribute("key", $Key)
|
||||
# Insert at top for priority
|
||||
if ($mapping.HasChildNodes) {
|
||||
$null = $mapping.InsertBefore($mappingSource, $mapping.FirstChild)
|
||||
$mapping.InsertBefore($mappingSource, $mapping.FirstChild) | Out-Null
|
||||
} else {
|
||||
$null = $mapping.AppendChild($mappingSource)
|
||||
$mapping.AppendChild($mappingSource) | Out-Null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,273 +110,14 @@ function Add-NuGetSourceAndMapping {
|
||||
foreach ($pattern in $Patterns) {
|
||||
$pkg = $Xml.CreateElement("package")
|
||||
$pkg.SetAttribute("pattern", $pattern)
|
||||
$null = $mappingSource.AppendChild($pkg)
|
||||
$mappingSource.AppendChild($pkg) | Out-Null
|
||||
}
|
||||
}
|
||||
|
||||
function Download-ArtifactFromPipeline {
|
||||
param (
|
||||
[string]$Organization,
|
||||
[string]$Project,
|
||||
[string]$BuildId,
|
||||
[string]$ArtifactName,
|
||||
[string]$OutputDir
|
||||
)
|
||||
|
||||
Write-Host "Downloading artifact '$ArtifactName' from build $BuildId..."
|
||||
$null = New-Item -ItemType Directory -Path $OutputDir -Force
|
||||
|
||||
try {
|
||||
# Authenticate with Azure DevOps using System Access Token (if available)
|
||||
if ($env:SYSTEM_ACCESSTOKEN) {
|
||||
Write-Host "Authenticating with Azure DevOps using System Access Token..."
|
||||
$env:AZURE_DEVOPS_EXT_PAT = $env:SYSTEM_ACCESSTOKEN
|
||||
} else {
|
||||
Write-Host "No SYSTEM_ACCESSTOKEN found, assuming az CLI is already authenticated..."
|
||||
}
|
||||
|
||||
# Use az CLI to download artifact
|
||||
& az pipelines runs artifact download `
|
||||
--organization $Organization `
|
||||
--project $Project `
|
||||
--run-id $BuildId `
|
||||
--artifact-name $ArtifactName `
|
||||
--path $OutputDir
|
||||
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host "Successfully downloaded artifact to $OutputDir"
|
||||
return $true
|
||||
} else {
|
||||
Write-Warning "Failed to download artifact. Exit code: $LASTEXITCODE"
|
||||
return $false
|
||||
}
|
||||
} catch {
|
||||
Write-Warning "Error downloading artifact: $_"
|
||||
return $false
|
||||
}
|
||||
}
|
||||
|
||||
function Get-NuspecDependencies {
|
||||
param (
|
||||
[string]$NupkgPath,
|
||||
[string]$TargetFramework = ""
|
||||
)
|
||||
|
||||
$tempDir = Join-Path $env:TEMP "nuspec_parse_$(Get-Random)"
|
||||
|
||||
try {
|
||||
# Extract .nupkg (it's a zip file)
|
||||
# Workaround: Expand-Archive may not recognize .nupkg extension, so copy to .zip first
|
||||
$tempZip = Join-Path $env:TEMP "temp_$(Get-Random).zip"
|
||||
Copy-Item $NupkgPath -Destination $tempZip -Force
|
||||
Expand-Archive -Path $tempZip -DestinationPath $tempDir -Force
|
||||
Remove-Item $tempZip -Force -ErrorAction SilentlyContinue
|
||||
|
||||
# Find .nuspec file
|
||||
$nuspecFile = Get-ChildItem -Path $tempDir -Filter "*.nuspec" -Recurse | Select-Object -First 1
|
||||
|
||||
if (-not $nuspecFile) {
|
||||
Write-Warning "No .nuspec file found in $NupkgPath"
|
||||
return @{}
|
||||
}
|
||||
|
||||
[xml]$nuspec = Get-Content $nuspecFile.FullName
|
||||
|
||||
# Extract package info
|
||||
$packageId = $nuspec.package.metadata.id
|
||||
$version = $nuspec.package.metadata.version
|
||||
Write-Host "Parsing $packageId version $version"
|
||||
|
||||
# Parse dependencies
|
||||
$dependencies = @{}
|
||||
$depGroups = $nuspec.package.metadata.dependencies.group
|
||||
|
||||
if ($depGroups) {
|
||||
# Dependencies are grouped by target framework
|
||||
foreach ($group in $depGroups) {
|
||||
$fx = $group.targetFramework
|
||||
Write-Host " Target Framework: $fx"
|
||||
|
||||
foreach ($dep in $group.dependency) {
|
||||
$depId = $dep.id
|
||||
$depVer = $dep.version
|
||||
# Remove version range brackets if present (e.g., "[2.0.0]" -> "2.0.0")
|
||||
$depVer = $depVer -replace '[\[\]]', ''
|
||||
$dependencies[$depId] = $depVer
|
||||
Write-Host " - ${depId} : ${depVer}"
|
||||
}
|
||||
}
|
||||
} else {
|
||||
# No grouping, direct dependencies
|
||||
$deps = $nuspec.package.metadata.dependencies.dependency
|
||||
if ($deps) {
|
||||
foreach ($dep in $deps) {
|
||||
$depId = $dep.id
|
||||
$depVer = $dep.version
|
||||
$depVer = $depVer -replace '[\[\]]', ''
|
||||
$dependencies[$depId] = $depVer
|
||||
Write-Host " - ${depId} : ${depVer}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $dependencies
|
||||
}
|
||||
catch {
|
||||
Write-Warning "Failed to parse nuspec: $_"
|
||||
return @{}
|
||||
}
|
||||
finally {
|
||||
Remove-Item $tempDir -Recurse -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
|
||||
function Resolve-ArtifactBasedDependencies {
|
||||
param (
|
||||
[string]$ArtifactDir,
|
||||
[string]$MetaPackageName,
|
||||
[string]$SourceUrl,
|
||||
[string]$OutputDir
|
||||
)
|
||||
|
||||
Write-Host "Resolving dependencies from artifact-based metapackage..."
|
||||
$null = New-Item -ItemType Directory -Path $OutputDir -Force
|
||||
|
||||
# Find the metapackage in artifact
|
||||
$metaNupkg = Get-ChildItem -Path $ArtifactDir -Recurse -Filter "$MetaPackageName.*.nupkg" |
|
||||
Where-Object { $_.Name -notmatch "Runtime" } |
|
||||
Select-Object -First 1
|
||||
|
||||
if (-not $metaNupkg) {
|
||||
Write-Warning "Metapackage $MetaPackageName not found in artifact"
|
||||
return @{}
|
||||
}
|
||||
|
||||
# Extract version from filename
|
||||
if ($metaNupkg.Name -match "$MetaPackageName\.(.+)\.nupkg") {
|
||||
$metaVersion = $Matches[1]
|
||||
Write-Host "Found metapackage: $MetaPackageName version $metaVersion"
|
||||
} else {
|
||||
Write-Warning "Could not extract version from $($metaNupkg.Name)"
|
||||
return @{}
|
||||
}
|
||||
|
||||
# Parse dependencies from metapackage
|
||||
$dependencies = Get-NuspecDependencies -NupkgPath $metaNupkg.FullName
|
||||
|
||||
# Copy metapackage to output directory
|
||||
Copy-Item $metaNupkg.FullName -Destination $OutputDir -Force
|
||||
Write-Host "Copied metapackage to $OutputDir"
|
||||
|
||||
# Prepare package versions hashtable - initialize with metapackage version
|
||||
$packageVersions = @{ $MetaPackageName = $metaVersion }
|
||||
|
||||
# Copy Runtime package from artifact (it's not in feed) and extract its version
|
||||
$runtimeNupkg = Get-ChildItem -Path $ArtifactDir -Recurse -Filter "$MetaPackageName.Runtime.*.nupkg" | Select-Object -First 1
|
||||
if ($runtimeNupkg) {
|
||||
Copy-Item $runtimeNupkg.FullName -Destination $OutputDir -Force
|
||||
Write-Host "Copied Runtime package to $OutputDir"
|
||||
|
||||
# Extract version from Runtime package filename
|
||||
if ($runtimeNupkg.Name -match "$MetaPackageName\.Runtime\.(.+)\.nupkg") {
|
||||
$runtimeVersion = $Matches[1]
|
||||
$packageVersions["$MetaPackageName.Runtime"] = $runtimeVersion
|
||||
Write-Host "Extracted Runtime package version: $runtimeVersion"
|
||||
} else {
|
||||
Write-Warning "Could not extract version from Runtime package: $($runtimeNupkg.Name)"
|
||||
}
|
||||
}
|
||||
|
||||
# Download other dependencies from feed (excluding Runtime as it's already copied)
|
||||
# Create temp nuget.config that includes both local packages and remote feed
|
||||
# This allows NuGet to find packages already copied from artifact
|
||||
$tempConfig = Join-Path $env:TEMP "nuget_artifact_$(Get-Random).config"
|
||||
$tempConfigContent = @"
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<clear />
|
||||
<add key='LocalPackages' value='$OutputDir' />
|
||||
<add key='RemoteFeed' value='$SourceUrl' />
|
||||
</packageSources>
|
||||
</configuration>
|
||||
"@
|
||||
Set-Content -Path $tempConfig -Value $tempConfigContent
|
||||
|
||||
try {
|
||||
foreach ($depId in $dependencies.Keys) {
|
||||
# Skip Runtime as it's already copied from artifact
|
||||
if ($depId -like "*Runtime*") {
|
||||
# Don't overwrite the version we extracted from the Runtime package filename
|
||||
if (-not $packageVersions.ContainsKey($depId)) {
|
||||
$packageVersions[$depId] = $dependencies[$depId]
|
||||
}
|
||||
Write-Host "Skipping $depId (already in artifact)"
|
||||
continue
|
||||
}
|
||||
|
||||
$depVersion = $dependencies[$depId]
|
||||
Write-Host "Downloading dependency: $depId version $depVersion from feed..."
|
||||
|
||||
& nuget install $depId `
|
||||
-Version $depVersion `
|
||||
-ConfigFile $tempConfig `
|
||||
-OutputDirectory $OutputDir `
|
||||
-NonInteractive `
|
||||
-NoCache `
|
||||
| Out-Null
|
||||
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
$packageVersions[$depId] = $depVersion
|
||||
Write-Host " Successfully downloaded $depId"
|
||||
} else {
|
||||
Write-Warning " Failed to download $depId version $depVersion"
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
Remove-Item $tempConfig -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Parse all downloaded packages to get actual versions
|
||||
$directories = Get-ChildItem -Path $OutputDir -Directory
|
||||
$allLocalPackages = @()
|
||||
|
||||
# Add metapackage and runtime to the list (they are .nupkg files, not directories)
|
||||
$allLocalPackages += $MetaPackageName
|
||||
if ($packageVersions.ContainsKey("$MetaPackageName.Runtime")) {
|
||||
$allLocalPackages += "$MetaPackageName.Runtime"
|
||||
}
|
||||
|
||||
foreach ($dir in $directories) {
|
||||
if ($dir.Name -match $script:PackageVersionRegex) {
|
||||
$pkgId = $Matches[1]
|
||||
$pkgVer = $Matches[2]
|
||||
$allLocalPackages += $pkgId
|
||||
if (-not $packageVersions.ContainsKey($pkgId)) {
|
||||
$packageVersions[$pkgId] = $pkgVer
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Update nuget.config dynamically during pipeline execution
|
||||
# This modification is temporary and won't be committed back to the repo
|
||||
$nugetConfig = Join-Path $rootPath "nuget.config"
|
||||
$configData = Read-FileWithEncoding -Path $nugetConfig
|
||||
[xml]$xml = $configData.Content
|
||||
|
||||
Add-NuGetSourceAndMapping -Xml $xml -Key "localpackages" -Value $OutputDir -Patterns $allLocalPackages
|
||||
|
||||
$xml.Save($nugetConfig)
|
||||
Write-Host "Updated nuget.config with localpackages mapping (temporary, for pipeline execution only)."
|
||||
|
||||
return ,$packageVersions
|
||||
}
|
||||
|
||||
function Resolve-WinAppSdkSplitDependencies {
|
||||
Write-Host "Version $WinAppSDKVersion detected. Resolving split dependencies..."
|
||||
$installDir = Join-Path $rootPath "localpackages\output"
|
||||
$null = New-Item -ItemType Directory -Path $installDir -Force
|
||||
New-Item -ItemType Directory -Path $installDir -Force | Out-Null
|
||||
|
||||
# Create a temporary nuget.config to avoid interference from the repo's config
|
||||
$tempConfig = Join-Path $env:TEMP "nuget_$(Get-Random).config"
|
||||
@@ -417,24 +131,14 @@ function Resolve-WinAppSdkSplitDependencies {
|
||||
if ($propsContent -match '<PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="([^"]+)"') {
|
||||
$buildToolsVersion = $Matches[1]
|
||||
Write-Host "Downloading Microsoft.Windows.SDK.BuildTools version $buildToolsVersion..."
|
||||
& nuget install Microsoft.Windows.SDK.BuildTools `
|
||||
-Version $buildToolsVersion `
|
||||
-ConfigFile $tempConfig `
|
||||
-OutputDirectory $installDir `
|
||||
-NonInteractive `
|
||||
-NoCache `
|
||||
| Out-Null
|
||||
$nugetArgsBuildTools = "install Microsoft.Windows.SDK.BuildTools -Version $buildToolsVersion -ConfigFile $tempConfig -OutputDirectory $installDir -NonInteractive -NoCache"
|
||||
Invoke-Expression "nuget $nugetArgsBuildTools" | Out-Null
|
||||
}
|
||||
}
|
||||
|
||||
# Download package to inspect nuspec and keep it for the build
|
||||
& nuget install Microsoft.WindowsAppSDK `
|
||||
-Version $WinAppSDKVersion `
|
||||
-ConfigFile $tempConfig `
|
||||
-OutputDirectory $installDir `
|
||||
-NonInteractive `
|
||||
-NoCache `
|
||||
| Out-Null
|
||||
$nugetArgs = "install Microsoft.WindowsAppSDK -Version $WinAppSDKVersion -ConfigFile $tempConfig -OutputDirectory $installDir -NonInteractive -NoCache"
|
||||
Invoke-Expression "nuget $nugetArgs" | Out-Null
|
||||
|
||||
# Parse dependencies from the installed folders
|
||||
# Folder structure is typically {PackageId}.{Version}
|
||||
@@ -468,101 +172,52 @@ function Resolve-WinAppSdkSplitDependencies {
|
||||
}
|
||||
}
|
||||
|
||||
# Main logic: choose between artifact-based or feed-based approach
|
||||
if ($useArtifactSource) {
|
||||
Write-Host "=== Using Artifact-Based Source ===" -ForegroundColor Cyan
|
||||
Write-Host "Organization: $azureDevOpsOrg"
|
||||
Write-Host "Project: $azureDevOpsProject"
|
||||
Write-Host "Build ID: $buildId"
|
||||
Write-Host "Artifact: $artifactName"
|
||||
|
||||
if ([string]::IsNullOrEmpty($buildId) -or $buildId -eq 'N/A') {
|
||||
Write-Error "buildId parameter is required when using artifact source. Please provide a valid Windows App SDK Build ID."
|
||||
Write-Host "Tip: You can find the build ID from the Windows App SDK pipeline run in Azure DevOps."
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Download artifact
|
||||
$artifactDir = Join-Path $rootPath "localpackages\artifact"
|
||||
$downloadSuccess = Download-ArtifactFromPipeline `
|
||||
-Organization $azureDevOpsOrg `
|
||||
-Project $azureDevOpsProject `
|
||||
-BuildId $buildId `
|
||||
-ArtifactName $artifactName `
|
||||
-OutputDir $artifactDir
|
||||
|
||||
if (-not $downloadSuccess) {
|
||||
Write-Host "Failed to download artifact"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Resolve dependencies from artifact
|
||||
$installDir = Join-Path $rootPath "localpackages\output"
|
||||
$packageVersions = Resolve-ArtifactBasedDependencies `
|
||||
-ArtifactDir $artifactDir `
|
||||
-MetaPackageName $metaPackageName `
|
||||
-SourceUrl $sourceLink `
|
||||
-OutputDir $installDir
|
||||
|
||||
if ($packageVersions.Count -eq 0) {
|
||||
Write-Error "Failed to resolve dependencies from artifact"
|
||||
exit 1
|
||||
}
|
||||
|
||||
$WinAppSDKVersion = $packageVersions[$metaPackageName]
|
||||
Write-Host "WinAppSDK Version: $WinAppSDKVersion"
|
||||
Write-Host "##vso[task.setvariable variable=WinAppSDKVersion]$WinAppSDKVersion"
|
||||
|
||||
# Execute nuget list and capture the output
|
||||
if ($useExperimentalVersion) {
|
||||
# The nuget list for experimental versions will cost more time
|
||||
# So, we will not use -AllVersions to wast time
|
||||
# But it can only get the latest experimental version
|
||||
Write-Host "Fetching WindowsAppSDK with experimental versions"
|
||||
$nugetOutput = nuget list Microsoft.WindowsAppSDK `
|
||||
-Source $sourceLink `
|
||||
-Prerelease
|
||||
# Filter versions based on the specified version prefix
|
||||
$escapedVersionNumber = [regex]::Escape($winAppSdkVersionNumber)
|
||||
$filteredVersions = $nugetOutput | Where-Object { $_ -match "Microsoft.WindowsAppSDK $escapedVersionNumber\." }
|
||||
$latestVersions = $filteredVersions
|
||||
} else {
|
||||
Write-Host "=== Using Feed-Based Source ===" -ForegroundColor Cyan
|
||||
|
||||
# Execute nuget list and capture the output
|
||||
if ($useExperimentalVersion) {
|
||||
# The nuget list for experimental versions will cost more time
|
||||
# So, we will not use -AllVersions to wast time
|
||||
# But it can only get the latest experimental version
|
||||
Write-Host "Fetching WindowsAppSDK with experimental versions"
|
||||
$nugetOutput = nuget list Microsoft.WindowsAppSDK `
|
||||
-Source $sourceLink `
|
||||
-Prerelease
|
||||
# Filter versions based on the specified version prefix
|
||||
$escapedVersionNumber = [regex]::Escape($winAppSdkVersionNumber)
|
||||
$filteredVersions = $nugetOutput | Where-Object { $_ -match "Microsoft.WindowsAppSDK $escapedVersionNumber\." }
|
||||
$latestVersions = $filteredVersions
|
||||
} else {
|
||||
Write-Host "Fetching stable WindowsAppSDK versions for $winAppSdkVersionNumber"
|
||||
$nugetOutput = nuget list Microsoft.WindowsAppSDK `
|
||||
-Source $sourceLink `
|
||||
-AllVersions
|
||||
# Filter versions based on the specified version prefix
|
||||
$escapedVersionNumber = [regex]::Escape($winAppSdkVersionNumber)
|
||||
$filteredVersions = $nugetOutput | Where-Object { $_ -match "Microsoft.WindowsAppSDK $escapedVersionNumber\." }
|
||||
$latestVersions = $filteredVersions | Sort-Object { [version]($_ -split ' ')[1] } -Descending | Select-Object -First 1
|
||||
}
|
||||
|
||||
Write-Host "Latest versions found: $latestVersions"
|
||||
# Extract the latest version number from the output
|
||||
$latestVersion = $latestVersions -split "`n" | `
|
||||
Select-String -Pattern 'Microsoft.WindowsAppSDK\s*([0-9]+\.[0-9]+\.[0-9]+-*[a-zA-Z0-9]*)' | `
|
||||
ForEach-Object { $_.Matches[0].Groups[1].Value } | `
|
||||
Sort-Object -Descending | `
|
||||
Select-Object -First 1
|
||||
|
||||
if ($latestVersion) {
|
||||
$WinAppSDKVersion = $latestVersion
|
||||
Write-Host "Extracted version: $WinAppSDKVersion"
|
||||
Write-Host "##vso[task.setvariable variable=WinAppSDKVersion]$WinAppSDKVersion"
|
||||
} else {
|
||||
Write-Host "Failed to extract version number from nuget list output"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Resolve dependencies for 1.8+
|
||||
$packageVersions = @{ "Microsoft.WindowsAppSDK" = $WinAppSDKVersion }
|
||||
|
||||
Resolve-WinAppSdkSplitDependencies
|
||||
Write-Host "Fetching stable WindowsAppSDK versions for $winAppSdkVersionNumber"
|
||||
$nugetOutput = nuget list Microsoft.WindowsAppSDK `
|
||||
-Source $sourceLink `
|
||||
-AllVersions
|
||||
# Filter versions based on the specified version prefix
|
||||
$escapedVersionNumber = [regex]::Escape($winAppSdkVersionNumber)
|
||||
$filteredVersions = $nugetOutput | Where-Object { $_ -match "Microsoft.WindowsAppSDK $escapedVersionNumber\." }
|
||||
$latestVersions = $filteredVersions | Sort-Object { [version]($_ -split ' ')[1] } -Descending | Select-Object -First 1
|
||||
}
|
||||
|
||||
Write-Host "Latest versions found: $latestVersions"
|
||||
# Extract the latest version number from the output
|
||||
$latestVersion = $latestVersions -split "`n" | `
|
||||
Select-String -Pattern 'Microsoft.WindowsAppSDK\s*([0-9]+\.[0-9]+\.[0-9]+-*[a-zA-Z0-9]*)' | `
|
||||
ForEach-Object { $_.Matches[0].Groups[1].Value } | `
|
||||
Sort-Object -Descending | `
|
||||
Select-Object -First 1
|
||||
|
||||
if ($latestVersion) {
|
||||
$WinAppSDKVersion = $latestVersion
|
||||
Write-Host "Extracted version: $WinAppSDKVersion"
|
||||
Write-Host "##vso[task.setvariable variable=WinAppSDKVersion]$WinAppSDKVersion"
|
||||
} else {
|
||||
Write-Host "Failed to extract version number from nuget list output"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Resolve dependencies for 1.8+
|
||||
$packageVersions = @{ "Microsoft.WindowsAppSDK" = $WinAppSDKVersion }
|
||||
|
||||
Resolve-WinAppSdkSplitDependencies
|
||||
|
||||
# Update Directory.Packages.props file
|
||||
Get-ChildItem -Path $rootPath -Recurse "Directory.Packages.props" | ForEach-Object {
|
||||
$file = Read-FileWithEncoding -Path $_.FullName
|
||||
@@ -571,16 +226,9 @@ Get-ChildItem -Path $rootPath -Recurse "Directory.Packages.props" | ForEach-Obje
|
||||
|
||||
foreach ($pkgId in $packageVersions.Keys) {
|
||||
$ver = $packageVersions[$pkgId]
|
||||
|
||||
# Skip packages with empty versions to prevent corruption
|
||||
if ([string]::IsNullOrWhiteSpace($ver)) {
|
||||
Write-Warning "Skipping ${pkgId}: version is empty"
|
||||
continue
|
||||
}
|
||||
|
||||
# Escape dots in package ID for regex
|
||||
$pkgIdRegex = $pkgId -replace '\.', '\.'
|
||||
|
||||
|
||||
$newVersionString = "<PackageVersion Include=""$pkgId"" Version=""$ver"" />"
|
||||
$oldVersionString = "<PackageVersion Include=""$pkgIdRegex"" Version=""[-.0-9a-zA-Z]*"" />"
|
||||
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
# NOTE: When using artifact mode (useArtifactSource: true), the pipeline needs
|
||||
# permission to access System.AccessToken. This is automatically handled by the
|
||||
# script if SYSTEM_ACCESSTOKEN environment variable is available.
|
||||
# If you encounter authentication errors, ensure the job has oauth access enabled.
|
||||
|
||||
trigger: none
|
||||
pr: none
|
||||
schedules:
|
||||
@@ -42,23 +37,6 @@ parameters:
|
||||
- name: useExperimentalVersion
|
||||
type: boolean
|
||||
default: false
|
||||
# Artifact mode parameters (optional)
|
||||
- name: useArtifactSource
|
||||
type: boolean
|
||||
displayName: "Use Artifact Source (instead of feed)"
|
||||
default: false
|
||||
- name: buildId
|
||||
type: string
|
||||
displayName: "Windows App SDK Build ID (required only if using artifact source)"
|
||||
default: 'N/A'
|
||||
- name: azureDevOpsProject
|
||||
type: string
|
||||
displayName: "Source Project (for artifact mode, default: ProjectReunion)"
|
||||
default: 'ProjectReunion'
|
||||
- name: artifactName
|
||||
type: string
|
||||
displayName: "Artifact Name (for artifact mode, default: WindowsAppSDK_Nuget_And_MSIX)"
|
||||
default: 'WindowsAppSDK_Nuget_And_MSIX'
|
||||
|
||||
extends:
|
||||
template: templates/pipeline-ci-build.yml
|
||||
@@ -71,7 +49,3 @@ extends:
|
||||
useLatestWinAppSDK: ${{ parameters.useLatestWinAppSDK }}
|
||||
winAppSDKVersionNumber: ${{ parameters.winAppSDKVersionNumber }}
|
||||
useExperimentalVersion: ${{ parameters.useExperimentalVersion }}
|
||||
useArtifactSource: ${{ parameters.useArtifactSource }}
|
||||
buildId: ${{ parameters.buildId }}
|
||||
azureDevOpsProject: ${{ parameters.azureDevOpsProject }}
|
||||
artifactName: ${{ parameters.artifactName }}
|
||||
|
||||
@@ -74,25 +74,6 @@ parameters:
|
||||
- name: useExperimentalVersion
|
||||
type: boolean
|
||||
default: false
|
||||
# Artifact mode parameters
|
||||
- name: useArtifactSource
|
||||
type: boolean
|
||||
default: false
|
||||
- name: azureDevOpsOrg
|
||||
type: string
|
||||
default: 'https://dev.azure.com/microsoft'
|
||||
- name: azureDevOpsProject
|
||||
type: string
|
||||
default: 'ProjectReunion'
|
||||
- name: buildId
|
||||
type: string
|
||||
default: ''
|
||||
- name: artifactName
|
||||
type: string
|
||||
default: 'WindowsAppSDK_Nuget_And_MSIX'
|
||||
- name: metaPackageName
|
||||
type: string
|
||||
default: 'Microsoft.WindowsAppSDK'
|
||||
- name: csProjectsToPublish
|
||||
type: object
|
||||
default:
|
||||
@@ -245,12 +226,6 @@ jobs:
|
||||
parameters:
|
||||
versionNumber: ${{ parameters.winAppSDKVersionNumber }}
|
||||
useExperimentalVersion: ${{ parameters.useExperimentalVersion }}
|
||||
useArtifactSource: ${{ parameters.useArtifactSource }}
|
||||
azureDevOpsOrg: ${{ parameters.azureDevOpsOrg }}
|
||||
azureDevOpsProject: ${{ parameters.azureDevOpsProject }}
|
||||
buildId: ${{ parameters.buildId }}
|
||||
artifactName: ${{ parameters.artifactName }}
|
||||
metaPackageName: ${{ parameters.metaPackageName }}
|
||||
|
||||
- ${{ if eq(parameters.useLatestWinAppSDK, false)}}:
|
||||
- template: .\steps-restore-nuget.yml
|
||||
|
||||
@@ -108,6 +108,9 @@ jobs:
|
||||
sdk: true
|
||||
version: '9.0'
|
||||
|
||||
- task: VisualStudioTestPlatformInstaller@1
|
||||
displayName: Ensure VSTest Platform
|
||||
|
||||
- pwsh: |-
|
||||
& '$(build.sourcesdirectory)\.pipelines\InstallWinAppDriver.ps1'
|
||||
displayName: Download and install WinAppDriver
|
||||
@@ -149,7 +152,46 @@ jobs:
|
||||
inputs:
|
||||
displaySettings: 'optimal'
|
||||
|
||||
- script: |
|
||||
dotnet test $(Build.SourcesDirectory)\src\modules\fancyzones\FancyZones.UITests\FancyZones.UITests.csproj --no-build -c $(BuildConfiguration) -p:Platform=$(BuildPlatform)
|
||||
dotnet test $(Build.SourcesDirectory)\src\modules\fancyzones\FancyZonesEditor.UITests\FancyZonesEditor.UITests.csproj --no-build -c $(BuildConfiguration) -p:Platform=$(BuildPlatform)
|
||||
displayName: "Run UI Tests"
|
||||
- ${{ if eq(length(parameters.uiTestModules), 0) }}:
|
||||
- task: VSTest@3
|
||||
displayName: Run UI Tests
|
||||
inputs:
|
||||
platform: '$(BuildPlatform)'
|
||||
configuration: '$(BuildConfiguration)'
|
||||
testSelector: 'testAssemblies'
|
||||
searchFolder: '$(Pipeline.Workspace)\$(TestArtifactsName)'
|
||||
vsTestVersion: 'toolsInstaller'
|
||||
uiTests: true
|
||||
rerunFailedTests: true
|
||||
testRunTitle: 'UITests_${{ parameters.platform }}_${{ parameters.installMode }}'
|
||||
# Since UITests-FancyZonesEditor.dll is generated in both UITests-FancyZonesEditor and UITests-FancyZones, removed one to avoid duplicate test runs
|
||||
testAssemblyVer2: |
|
||||
**\*UITest*.dll
|
||||
!**\obj\**
|
||||
!**\ref\**
|
||||
!**\UITests-FancyZones\**\UITests-FancyZonesEditor.dll
|
||||
env:
|
||||
platform: '$(TestPlatform)'
|
||||
useInstallerForTest: ${{ ne(parameters.buildSource, 'buildNow') }}
|
||||
|
||||
- ${{ if ne(length(parameters.uiTestModules), 0) }}:
|
||||
- ${{ each module in parameters.uiTestModules }}:
|
||||
- task: VSTest@3
|
||||
displayName: Run UI Test - ${{ module }}
|
||||
inputs:
|
||||
platform: '$(BuildPlatform)'
|
||||
configuration: '$(BuildConfiguration)'
|
||||
testSelector: 'testAssemblies'
|
||||
searchFolder: '$(Pipeline.Workspace)\$(TestArtifactsName)'
|
||||
vsTestVersion: 'toolsInstaller'
|
||||
uiTests: true
|
||||
rerunFailedTests: true
|
||||
testRunTitle: 'UITests_${{ parameters.platform }}_${{ parameters.installMode }}'
|
||||
testAssemblyVer2: |
|
||||
**\*${{ module }}*.dll
|
||||
!**\obj\**
|
||||
!**\ref\**
|
||||
!**\UITests-FancyZones\**\UITests-FancyZonesEditor.dll
|
||||
env:
|
||||
platform: '$(TestPlatform)'
|
||||
useInstallerForTest: ${{ ne(parameters.buildSource, 'buildNow') }}
|
||||
|
||||
@@ -34,25 +34,6 @@ parameters:
|
||||
- name: useExperimentalVersion
|
||||
type: boolean
|
||||
default: false
|
||||
# Artifact mode parameters
|
||||
- name: useArtifactSource
|
||||
type: boolean
|
||||
default: false
|
||||
- name: azureDevOpsOrg
|
||||
type: string
|
||||
default: 'https://dev.azure.com/microsoft'
|
||||
- name: azureDevOpsProject
|
||||
type: string
|
||||
default: 'ProjectReunion'
|
||||
- name: buildId
|
||||
type: string
|
||||
default: ''
|
||||
- name: artifactName
|
||||
type: string
|
||||
default: 'WindowsAppSDK_Nuget_And_MSIX'
|
||||
- name: metaPackageName
|
||||
type: string
|
||||
default: 'Microsoft.WindowsAppSDK'
|
||||
|
||||
stages:
|
||||
- ${{ each platform in parameters.buildPlatforms }}:
|
||||
@@ -84,12 +65,6 @@ stages:
|
||||
${{ if eq(parameters.useLatestWinAppSDK, true) }}:
|
||||
winAppSDKVersionNumber: ${{ parameters.winAppSDKVersionNumber }}
|
||||
useExperimentalVersion: ${{ parameters.useExperimentalVersion }}
|
||||
useArtifactSource: ${{ parameters.useArtifactSource }}
|
||||
azureDevOpsOrg: ${{ parameters.azureDevOpsOrg }}
|
||||
azureDevOpsProject: ${{ parameters.azureDevOpsProject }}
|
||||
buildId: ${{ parameters.buildId }}
|
||||
artifactName: ${{ parameters.artifactName }}
|
||||
metaPackageName: ${{ parameters.metaPackageName }}
|
||||
timeoutInMinutes: 90
|
||||
|
||||
- stage: Build_SDK
|
||||
|
||||
@@ -5,25 +5,6 @@ parameters:
|
||||
- name: useExperimentalVersion
|
||||
type: boolean
|
||||
default: false
|
||||
# Artifact mode parameters
|
||||
- name: useArtifactSource
|
||||
type: boolean
|
||||
default: false
|
||||
- name: azureDevOpsOrg
|
||||
type: string
|
||||
default: 'https://dev.azure.com/microsoft'
|
||||
- name: azureDevOpsProject
|
||||
type: string
|
||||
default: 'ProjectReunion'
|
||||
- name: buildId
|
||||
type: string
|
||||
default: ''
|
||||
- name: artifactName
|
||||
type: string
|
||||
default: 'WindowsAppSDK_Nuget_And_MSIX'
|
||||
- name: metaPackageName
|
||||
type: string
|
||||
default: 'Microsoft.WindowsAppSDK'
|
||||
|
||||
steps:
|
||||
- task: NuGetAuthenticate@1
|
||||
@@ -31,20 +12,12 @@ steps:
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Update WinAppSDK Versions
|
||||
env:
|
||||
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
|
||||
inputs:
|
||||
filePath: '$(build.sourcesdirectory)\.pipelines\UpdateVersions.ps1'
|
||||
arguments: >
|
||||
-winAppSdkVersionNumber ${{ parameters.versionNumber }}
|
||||
-useExperimentalVersion $${{ parameters.useExperimentalVersion }}
|
||||
-rootPath "$(build.sourcesdirectory)"
|
||||
-useArtifactSource $${{ parameters.useArtifactSource }}
|
||||
-azureDevOpsOrg "${{ parameters.azureDevOpsOrg }}"
|
||||
-azureDevOpsProject "${{ parameters.azureDevOpsProject }}"
|
||||
-buildId "${{ parameters.buildId }}"
|
||||
-artifactName "${{ parameters.artifactName }}"
|
||||
-metaPackageName "${{ parameters.metaPackageName }}"
|
||||
|
||||
# - task: NuGetCommand@2
|
||||
# displayName: 'Restore NuGet packages (slnx)'
|
||||
@@ -63,4 +36,3 @@ steps:
|
||||
feedsToUse: 'config'
|
||||
nugetConfigPath: '$(build.sourcesdirectory)\nuget.config'
|
||||
workingDirectory: '$(build.sourcesdirectory)'
|
||||
arguments: '/p:NoWarn=NU1602,NU1604'
|
||||
|
||||
@@ -93,8 +93,7 @@ if ($noticeMatch.Success) {
|
||||
# Test-only packages that are allowed to be in NOTICE.md but not in the build
|
||||
# (e.g., when BuildTests=false, these packages won't appear in the NuGet list)
|
||||
$allowedExtraPackages = @(
|
||||
"- Moq",
|
||||
"- MSTest"
|
||||
"- Moq"
|
||||
)
|
||||
|
||||
if (!$noticeFile.Trim().EndsWith($returnList.Trim()))
|
||||
|
||||
@@ -64,6 +64,7 @@
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||
<BuildStlModules>false</BuildStlModules>
|
||||
<AdditionalOptions>/await %(AdditionalOptions)</AdditionalOptions>
|
||||
<!-- TODO: _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING for compatibility with VS 17.8. Check if we can remove. -->
|
||||
<PreprocessorDefinitions>_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<!-- CLR + CFG are not compatible >:{ -->
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<RepoRoot>$(MSBuildThisFileDirectory)</RepoRoot>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(RepoRoot)src\Version.props" />
|
||||
<Import Project="src\Version.props" />
|
||||
<PropertyGroup>
|
||||
<Copyright>Copyright (C) Microsoft Corporation. All rights reserved.</Copyright>
|
||||
<AssemblyCopyright>Copyright (C) Microsoft Corporation. All rights reserved.</AssemblyCopyright>
|
||||
@@ -20,23 +17,6 @@
|
||||
<NuGetAuditMode>direct</NuGetAuditMode>
|
||||
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion> <!-- Don't add source revision hash to the product version of binaries. -->
|
||||
<PlatformTarget>$(Platform)</PlatformTarget>
|
||||
|
||||
<!-- Enable Microsoft.Testing.Platform -->
|
||||
<EnableMSTestRunner>true</EnableMSTestRunner>
|
||||
<TestingPlatformShowTestsFailure>true</TestingPlatformShowTestsFailure>
|
||||
<TestingPlatformDotNetTestSupport>true</TestingPlatformDotNetTestSupport>
|
||||
<TestingPlatformCommandLineArguments>$(TestingPlatformCommandLineArguments) --report-trx</TestingPlatformCommandLineArguments>
|
||||
<!-- No arm64 agents to run the tests. -->
|
||||
<TestingPlatformDisableCustomTestTarget Condition="'$(Platform)' == 'ARM64'">true</TestingPlatformDisableCustomTestTarget>
|
||||
</PropertyGroup>
|
||||
|
||||
<!--
|
||||
UI tests are run in dedicated UI test jobs/pipelines.
|
||||
In CI, the main build uses `/t:Build;Test` across the full solution, so
|
||||
prevent UI test projects from being executed in that pass.
|
||||
-->
|
||||
<PropertyGroup Condition="'$(TF_BUILD)' != '' and $(MSBuildProjectName.Contains('UITest'))">
|
||||
<TestingPlatformDisableCustomTestTarget>true</TestingPlatformDisableCustomTestTarget>
|
||||
</PropertyGroup>
|
||||
|
||||
<!--
|
||||
@@ -81,7 +61,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<_PropertySheetDisplayName>PowerToys.Root.Props</_PropertySheetDisplayName>
|
||||
<ForceImportBeforeCppProps>$(RepoRoot)Cpp.Build.props</ForceImportBeforeCppProps>
|
||||
<ForceImportBeforeCppProps>$(MsbuildThisFileDirectory)\Cpp.Build.props</ForceImportBeforeCppProps>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
@@ -90,8 +70,8 @@
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<Compile Include="$(RepoRoot)src\codeAnalysis\GlobalSuppressions.cs" Link="GlobalSuppressions.cs" />
|
||||
<AdditionalFiles Include="$(RepoRoot)src\codeAnalysis\StyleCop.json" Link="StyleCop.json" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)\src\codeAnalysis\GlobalSuppressions.cs" Link="GlobalSuppressions.cs" />
|
||||
<AdditionalFiles Include="$(MSBuildThisFileDirectory)\src\codeAnalysis\StyleCop.json" Link="StyleCop.json" />
|
||||
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
@@ -99,15 +79,7 @@
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- In CI, we build and test with `/t:Build;Test` -->
|
||||
<!-- So, for non-test projects, we want the target to be there and it's basically doing nothing -->
|
||||
<!-- For C# test projects, Microsoft.Testing.Platform should inject Test target here: -->
|
||||
<!-- https://github.com/microsoft/testfx/blob/5ad21909704db501f58f27d4a7ec241edd761af5/src/Platform/Microsoft.Testing.Platform.MSBuild/buildMultiTargeting/Microsoft.Testing.Platform.MSBuild.targets#L270-L273 -->
|
||||
<!-- For C++ test projects, the RunVSTest SDK will do its job -->
|
||||
<Target Name="Test" />
|
||||
|
||||
<!-- Add ability to run tests via "msbuild /t:Test" using the RunVSTest SDK -->
|
||||
<!-- This is only needed for C++, as we use Microsoft.Testing.Platform for C# -->
|
||||
<!-- Add ability to run tests via "msbuild /t:Test" -->
|
||||
<!--
|
||||
Work around an MSBuild bug where Microsoft.Common.Test.targets is missing from the Arm64 installation.
|
||||
See: https://github.com/dotnet/msbuild/pull/9984
|
||||
@@ -117,11 +89,11 @@
|
||||
Once the change referenced above is fixed, the ImportGroup below can be replaced with:
|
||||
<Sdk Name="Microsoft.Build.RunVSTest" Version="1.0.319" />
|
||||
-->
|
||||
<ImportGroup Condition="'$(PROCESSOR_ARCHITECTURE)' != 'ARM64' AND ('$(Language)' == 'C++' OR '$(MSBuildProjectExtension)' == '.vcxproj')">
|
||||
<ImportGroup Condition="'$(PROCESSOR_ARCHITECTURE)' != 'ARM64'">
|
||||
<Import Project="Sdk.props" Sdk="Microsoft.Build.RunVSTest" Version="1.0.319" />
|
||||
<Import Project="Sdk.targets" Sdk="Microsoft.Build.RunVSTest" Version="1.0.319" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Condition="'$(Language)' == 'C++' OR '$(MSBuildProjectExtension)' == '.vcxproj'">
|
||||
<PropertyGroup>
|
||||
<VSTestLogger>trx</VSTestLogger>
|
||||
<!--
|
||||
RunVSTest by default uses %VSINSTALLDIR%\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe,
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
<PropertyGroup>
|
||||
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
||||
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
|
||||
<MSTestVersion>3.8.3</MSTestVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageVersion Include="AdaptiveCards.ObjectModel.WinUI3" Version="2.0.0-beta" />
|
||||
@@ -45,7 +44,7 @@
|
||||
<!-- Including Microsoft.Bcl.AsyncInterfaces to force version, since it's used by Microsoft.SemanticKernel. -->
|
||||
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="9.0.10" />
|
||||
<PackageVersion Include="Microsoft.Graphics.Win2D" Version="1.3.2" />
|
||||
<PackageVersion Include="Microsoft.Windows.CppWinRT" Version="2.0.250303.1" />
|
||||
<PackageVersion Include="Microsoft.Windows.CppWinRT" Version="2.0.240111.5" />
|
||||
<PackageVersion Include="Microsoft.Diagnostics.Tracing.TraceEvent" Version="3.1.16" />
|
||||
<PackageVersion Include="Microsoft.Extensions.AI" Version="9.9.1" />
|
||||
<PackageVersion Include="Microsoft.Extensions.AI.OpenAI" Version="9.9.1-preview.1.25474.6" />
|
||||
@@ -87,8 +86,7 @@
|
||||
<PackageVersion Include="ModernWpfUI" Version="0.9.4" />
|
||||
<!-- Moq to stay below v4.20 due to behavior change. need to be sure fixed -->
|
||||
<PackageVersion Include="Moq" Version="4.18.4" />
|
||||
<PackageVersion Include="MSTest" Version="$(MSTestVersion)" />
|
||||
<PackageVersion Include="MSTest.TestFramework" Version="$(MSTestVersion)" />
|
||||
<PackageVersion Include="MSTest" Version="3.8.3" />
|
||||
<PackageVersion Include="NJsonSchema" Version="11.4.0" />
|
||||
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageVersion Include="NLog" Version="5.2.8" />
|
||||
|
||||
@@ -1582,7 +1582,6 @@ SOFTWARE.
|
||||
- ModernWpfUI
|
||||
- Moq
|
||||
- MSTest
|
||||
- MSTest.TestFramework
|
||||
- NJsonSchema
|
||||
- NLog
|
||||
- NLog.Extensions.Logging
|
||||
@@ -1603,4 +1602,4 @@ SOFTWARE.
|
||||
- WinUIEx
|
||||
- WmiLight
|
||||
- WPF-UI
|
||||
- WyHash
|
||||
- WyHash
|
||||
@@ -4,6 +4,10 @@
|
||||
<Platform Name="x64" />
|
||||
</Configurations>
|
||||
<Folder Name="/common/">
|
||||
<Project Path="src/common/AllExperiments/AllExperiments.csproj">
|
||||
<Platform Solution="*|ARM64" Project="ARM64" />
|
||||
<Platform Solution="*|x64" Project="x64" />
|
||||
</Project>
|
||||
<Project Path="src/common/CalculatorEngineCommon/CalculatorEngineCommon.vcxproj" Id="2cf78cf7-8feb-4be1-9591-55fa25b48fc6" />
|
||||
<Project Path="src/common/Common.Search/Common.Search.csproj">
|
||||
<Platform Solution="*|ARM64" Project="ARM64" />
|
||||
@@ -13,10 +17,6 @@
|
||||
<Platform Solution="*|ARM64" Project="ARM64" />
|
||||
<Platform Solution="*|x64" Project="x64" />
|
||||
</Project>
|
||||
<Project Path="src/common/Common.UI.Controls/Common.UI.Controls.csproj">
|
||||
<Platform Solution="*|ARM64" Project="ARM64" />
|
||||
<Platform Solution="*|x64" Project="x64" />
|
||||
</Project>
|
||||
<Project Path="src/common/COMUtils/COMUtils.vcxproj" Id="7319089e-46d6-4400-bc65-e39bdf1416ee" />
|
||||
<Project Path="src/common/Display/Display.vcxproj" Id="caba8dfb-823b-4bf2-93ac-3f31984150d9" />
|
||||
<Project Path="src/common/FilePreviewCommon/FilePreviewCommon.csproj">
|
||||
@@ -219,10 +219,6 @@
|
||||
<Platform Solution="*|x64" Project="x64" />
|
||||
<Deploy />
|
||||
</Project>
|
||||
<Project Path="src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.PerformanceMonitor/Microsoft.CmdPal.Ext.PerformanceMonitor.csproj">
|
||||
<Platform Solution="*|ARM64" Project="ARM64" />
|
||||
<Platform Solution="*|x64" Project="x64" />
|
||||
</Project>
|
||||
<Project Path="src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.PowerToys/Microsoft.CmdPal.Ext.PowerToys.csproj">
|
||||
<Platform Solution="*|ARM64" Project="ARM64" />
|
||||
<Platform Solution="*|x64" Project="x64" />
|
||||
|
||||
30
README.md
30
README.md
@@ -103,38 +103,10 @@ There are <a href="https://learn.microsoft.com/windows/powertoys/install#communi
|
||||
</details>
|
||||
|
||||
## ✨ What's new
|
||||
|
||||
**Version 0.97.2 (Feb 2026)**
|
||||
**Version 0.97.1 (January 2026)**
|
||||
|
||||
This patch release fixes several important stability issues identified in v0.97.0 based on incoming reports. Check out the [v0.97.0](https://github.com/microsoft/PowerToys/releases/tag/v0.97.0) notes for the full list of changes.
|
||||
|
||||
## Advanced Paste
|
||||
- #45207 Fixed a crash in the Advanced Paste settings page caused by null values during JSON deserialization.
|
||||
|
||||
## Color Picker
|
||||
- #45367 Fixed contrast issue in Color picker UI.
|
||||
|
||||
## Command Palette
|
||||
- #45194 Fixed an issue where some Command Palette PowerToys Extension strings were not localised.
|
||||
|
||||
## Cursor Wrap
|
||||
- #45210 Fixed "Automatically activate on utility startup" setting not persisting when disabled. Thanks [@ThanhNguyxn](https://github.com/ThanhNguyxn)!
|
||||
- #45303 Added option to disable Cursor Wrapping when only a single monitor is connected. Thanks [@mikehall-ms](https://github.com/mikehall-ms)!
|
||||
|
||||
## Image Resizer
|
||||
- #45184 Fixed Image Resizer not working after upgrading PowerToys on Windows 10 by properly cleaning up legacy sparse app packages.
|
||||
|
||||
## LightSwitch
|
||||
- #45304 Fixed Light Switch startup logic to correctly apply the appropriate theme on launch.
|
||||
|
||||
## Workspaces
|
||||
- #45183 Fixed overlay positioning issue in workspace snapshot draw caused by DPI-aware coordinate mismatch.
|
||||
|
||||
## Quick Access and Measure Tool
|
||||
- #45443 Fixed crash related to `IsShownInSwitchers` property when Explorer is not running.
|
||||
|
||||
**Version 0.97.1 (January 2026)**
|
||||
|
||||
**Highlights**
|
||||
|
||||
### Advanced Paste
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
### Building PowerToys Locally
|
||||
|
||||
#### One stop script for building installer
|
||||
1. Open `Developer PowerShell for VS`.
|
||||
1. Open `Developer Powershell for VS 2022` or `Developer PowerShell for VS` for VS 2026.
|
||||
2. Run tools\build\build-installer.ps1
|
||||
> For the first-time setup, please run the installer as an administrator. This ensures that the Wix tool can move wix.target to the desired location and trust the certificate used to sign the MSIX packages.
|
||||
|
||||
@@ -109,7 +109,7 @@ dotnet tool install --global wix --version 5.0.2
|
||||
|
||||
##### From the command line
|
||||
|
||||
1. From the start menu, open a `Developer Command Prompt for VS`
|
||||
1. From the start menu, open a `Developer Command Prompt for VS 2022` or `Developer Command Prompt for VS`
|
||||
1. Ensure `nuget.exe` is in your `%path%`
|
||||
1. In the repo root, run these commands:
|
||||
|
||||
@@ -140,7 +140,7 @@ If you prefer, you can alternatively build prerequisite projects for the install
|
||||
|
||||
The resulting installer will be available in the `installer\PowerToysSetupVNext\x64\Release\` folder.
|
||||
|
||||
To build the installer from the command line, run `Developer Command Prompt for VS` in admin mode and execute the following commands. The generated installer package will be located at `\installer\PowerToysSetupVNext\{platform}\Release\MachineSetup`.
|
||||
To build the installer from the command line, run `Developer Command Prompt for VS 2022` or `Developer Command Prompt for VS` in admin mode and execute the following commands. The generated installer package will be located at `\installer\PowerToysSetupVNext\{platform}\Release\MachineSetup`.
|
||||
|
||||
```
|
||||
git clean -xfd -e *exe -- .\installer\
|
||||
|
||||
@@ -15,7 +15,7 @@ Before you can start debugging PowerToys, you need to set up your development en
|
||||
|
||||
You can build the entire solution from the command line, which is sometimes faster than building within Visual Studio:
|
||||
|
||||
1. Open `Developer Command Prompt for VS`
|
||||
1. Open `Developer Command Prompt for VS 2022` or `Developer Command Prompt for VS`
|
||||
2. Navigate to the repository root directory
|
||||
3. Run the following command(don't forget to set the correct platform):
|
||||
```pwsh
|
||||
@@ -105,7 +105,7 @@ If you encounter build errors about missing image files (e.g., `.png`, `.ico`, o
|
||||
|
||||
1. **Clean the solution in Visual Studio**: Build > Clean Solution
|
||||
|
||||
Or from the command line (`Developer Command Prompt for VS`):
|
||||
Or from the command line (Developer Command Prompt for VS 2022 or Developer Command Prompt for VS):
|
||||
```pwsh
|
||||
msbuild PowerToys.slnx /t:Clean /p:Platform=x64 /p:Configuration=Debug
|
||||
```
|
||||
|
||||
@@ -15,27 +15,9 @@ VS Code extensions Needed:
|
||||
---
|
||||
|
||||
## Building in VS Code
|
||||
### Configure Developer PowerShell for VS for more convenient development experience in VS Code
|
||||
1. Configure profile in settings, entry: `terminal.integrated.profiles.windows`
|
||||
2. Add below config as entry (choose VS 2026 or VS 2022 based on your installation):
|
||||
|
||||
**For Visual Studio 2026 (recommended):**
|
||||
```json
|
||||
"Developer PowerShell for VS": {
|
||||
// Configure based on your preference
|
||||
"path": "C:\\Program Files\\WindowsApps\\Microsoft.PowerShell_7.5.2.0_arm64__8wekyb3d8bbwe\\pwsh.exe",
|
||||
"args": [
|
||||
"-NoExit",
|
||||
"-Command",
|
||||
"& {",
|
||||
"$orig = Get-Location;",
|
||||
// Adjust path based on your edition (Community/Professional/Enterprise)
|
||||
"& 'C:\\Program Files\\Microsoft Visual Studio\\18\\Enterprise\\Common7\\Tools\\Launch-VsDevShell.ps1';",
|
||||
"Set-Location $orig",
|
||||
"}"
|
||||
]
|
||||
},
|
||||
```
|
||||
### Configure Developer Powershell for VS 2022 or Developer Powershell for VS for more convenient dev in vscode.
|
||||
1. Configure profile in in settings, entry: "terminal.integrated.profiles.windows"
|
||||
2. Add below config as entry (choose VS 2022 or VS 2026 based on your installation):
|
||||
|
||||
**For Visual Studio 2022:**
|
||||
```json
|
||||
@@ -55,6 +37,24 @@ VS Code extensions Needed:
|
||||
},
|
||||
```
|
||||
|
||||
**For Visual Studio 2026:**
|
||||
```json
|
||||
"Developer PowerShell for VS": {
|
||||
// Configure based on your preference
|
||||
"path": "C:\\Program Files\\WindowsApps\\Microsoft.PowerShell_7.5.2.0_arm64__8wekyb3d8bbwe\\pwsh.exe",
|
||||
"args": [
|
||||
"-NoExit",
|
||||
"-Command",
|
||||
"& {",
|
||||
"$orig = Get-Location;",
|
||||
// Adjust path based on your edition (Community/Professional/Enterprise)
|
||||
"& 'C:\\Program Files\\Microsoft Visual Studio\\18\\Enterprise\\Common7\\Tools\\Launch-VsDevShell.ps1';",
|
||||
"Set-Location $orig",
|
||||
"}"
|
||||
]
|
||||
},
|
||||
```
|
||||
|
||||
3. [Optional] Set your Developer PowerShell profile as the default, so that you can get a deep integration with vscode coding agent.
|
||||
|
||||
4. Now you can build with plain `msbuild` or configure tasks.json in below section.
|
||||
|
||||
@@ -12,11 +12,22 @@ A PowerToy module is a self-contained utility integrated into the PowerToys ecos
|
||||
|
||||
### Requirements
|
||||
|
||||
Follow the [Getting Started](../readme.md#getting-started) guide to set up your development environment, then [validate that you are able to build and run](debugging.md) `PowerToys.slnx`.
|
||||
- [Visual Studio 2026](https://visualstudio.microsoft.com/downloads/) and the following workloads/individual components:
|
||||
- Desktop Development with C++
|
||||
- WinUI application development
|
||||
- .NET desktop development
|
||||
- Windows 10 SDK (10.0.22621.0)
|
||||
- Windows 11 SDK (10.0.26100.3916)
|
||||
- .NET 8 SDK
|
||||
- Fork the [PowerToys repository](https://github.com/microsoft/PowerToys/tree/main) locally
|
||||
- [Validate that you are able to build and run](https://github.com/microsoft/PowerToys/blob/main/doc/devdocs/development/debugging.md) `PowerToys.slnx`.
|
||||
|
||||
Optional:
|
||||
- [WiX v5 toolset](https://github.com/microsoft/PowerToys/tree/main) for the installer
|
||||
|
||||
> [!NOTE]
|
||||
> To ensure all the correct VS Workloads are installed, use [the WinGet configuration files](https://github.com/microsoft/PowerToys/tree/e13d6a78aafbcf32a4bb5f8581d041e1d057c3f1/.config) in the project repository. (Use the one that matches your VS distribution. ie: VS Community would use `configuration.winget`)
|
||||
|
||||
### Folder structure
|
||||
|
||||
```
|
||||
|
||||
@@ -1,197 +0,0 @@
|
||||
# Telemetry Events
|
||||
|
||||
PowerToys collects limited telemetry to understand feature usage, reliability, and product quality. When adding a new telemetry event, follow the steps below to ensure the event is properly declared, documented, and available after release.
|
||||
|
||||
**⚠️ Important**: Telemetry must never include personal information, file paths, or user‑generated content.
|
||||
|
||||
## Developer Effort Overview (What to Expect)
|
||||
|
||||
Adding a telemetry event is a **multi-step process** that typically spans several areas of the codebase and documentation.
|
||||
|
||||
At a high level, developers should expect to:
|
||||
|
||||
1. Within one PR:
|
||||
1. Add a new telemetry event(s) to module
|
||||
1. Add the new event(s) DATA_AND_PRIVACY.md
|
||||
1. Reach out to @carlos-zamora or @chatasweetie so internal scripts can process new event(s)
|
||||
|
||||
### Privacy Guidelines
|
||||
|
||||
**NEVER** log:
|
||||
|
||||
- User data (text, files, emails, etc.)
|
||||
- File paths or filenames
|
||||
- Personal information
|
||||
- Sensitive system information
|
||||
- Anything that could identify a specific user
|
||||
|
||||
DO log:
|
||||
|
||||
- Feature usage (which features, how often)
|
||||
- Success/failure status
|
||||
- Timing/performance metrics
|
||||
- Error types (not error messages with user data)
|
||||
- Aggregate counts
|
||||
|
||||
### Event Naming Convention
|
||||
|
||||
Follow this pattern: `UtilityName_EventDescription`
|
||||
|
||||
Examples:
|
||||
|
||||
- `ColorPicker_Session`
|
||||
- `FancyZones_LayoutApplied`
|
||||
- `PowerRename_Rename`
|
||||
- `AdvancedPaste_FormatClicked`
|
||||
- `CmdPal_ExtensionInvoked`
|
||||
|
||||
## Adding Telemetry Events to PowerToys
|
||||
|
||||
PowerToys uses ETW (Event Tracing for Windows) for telemetry in both C++ and C# modules. The telemetry system is:
|
||||
|
||||
- Opt-in by default (disabled since v0.86)
|
||||
- Privacy-focused - never logs personal info, file paths, or user-generated content
|
||||
- Controlled by registry - HKEY_CURRENT_USER\Software\Classes\PowerToys\AllowDataDiagnostics
|
||||
|
||||
### C++ Telemetry Implementation
|
||||
|
||||
**Core Components**
|
||||
|
||||
| File | Purpose |
|
||||
| ------------- |:-------------:|
|
||||
| [ProjectTelemetry.h](../../src/common/Telemetry/ProjectTelemetry.h) | Declares the global ETW provider g_hProvider |
|
||||
| [TraceBase.h](../../src/common/Telemetry/TraceBase.h) | Base class with RegisterProvider(), UnregisterProvider(), and IsDataDiagnosticsEnabled() check |
|
||||
| [TraceLoggingDefines.h](../../src/common/Telemetry/TraceLoggingDefines.h) | Privacy tags and telemetry option group macros
|
||||
|
||||
|
||||
#### Pattern for C++ Modules
|
||||
|
||||
1. Create a `Trace` class inheriting from `telemetry::TraceBase` (src/common/Telemetry/TraceBase.h):
|
||||
|
||||
```c
|
||||
// trace.h
|
||||
#pragma once
|
||||
#include <common/Telemetry/TraceBase.h>
|
||||
|
||||
class Trace : public telemetry::TraceBase
|
||||
{
|
||||
public:
|
||||
static void MyEvent(/* parameters */);
|
||||
};
|
||||
```
|
||||
|
||||
2. Implement events using `TraceLoggingWriteWrapper`:
|
||||
|
||||
```cpp
|
||||
// trace.cpp
|
||||
#include "trace.h"
|
||||
#include <common/Telemetry/TraceBase.h>
|
||||
|
||||
TRACELOGGING_DEFINE_PROVIDER(
|
||||
g_hProvider,
|
||||
"Microsoft.PowerToys",
|
||||
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
||||
TraceLoggingOptionProjectTelemetry());
|
||||
|
||||
void Trace::MyEvent(bool enabled)
|
||||
{
|
||||
TraceLoggingWriteWrapper(
|
||||
g_hProvider,
|
||||
"ModuleName_EventName", // Event name
|
||||
TraceLoggingBoolean(enabled, "Enabled"), // Event data
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
||||
}
|
||||
```
|
||||
|
||||
**Key C++ Telemetry Macros**
|
||||
|
||||
| Macro | Purpose |
|
||||
| ------------- |:-------------:|
|
||||
| `TraceLoggingWriteWrapper` [CustomAction.cpp](../../installer/PowerToysSetupCustomActionsVNext/CustomAction.cpp) | Wraps `TraceLoggingWrite` with `IsDataDiagnosticsEnabled()` check |
|
||||
| `ProjectTelemetryPrivacyDataTag(tag)` [TraceLoggingDefines.h](../../src/common/Telemetry/TraceLoggingDefines.h) | Sets privacy classification |
|
||||
|
||||
### C# Telemetry Implementation
|
||||
|
||||
**Core Components**
|
||||
|
||||
| File | Purpose |
|
||||
| ------------- |:-------------:|
|
||||
| [PowerToysTelemetry.cs](../../src/common/ManagedTelemetry/Telemetry/PowerToysTelemetry.cs) | Singleton `Log` instance with `WriteEvent<T>()` method |
|
||||
| [EventBase.cs](../../src/common/ManagedTelemetry/Telemetry/Events/EventBase.cs) | Base class for all events (provides `EventName`, `Version`) |
|
||||
| [IEvent.cs](../../src/common/ManagedTelemetry/Telemetry/Events/IEvent.cs) | Interface requiring `PartA_PrivTags` property |
|
||||
| [TelemetryBase.cs](../../src/common/Telemetry/TelemetryBase.cs) | Inherits from `EventSource`, defines ETW constants |
|
||||
| [DataDiagnosticsSettings.cs](../../src/common/ManagedTelemetry/Telemetry/DataDiagnosticsSettings.cs) | Registry-based enable/disable check
|
||||
|
||||
#### Pattern for C# Modules
|
||||
|
||||
1. Create an event class inheriting from `EventBase` and implementing `IEvent`:
|
||||
|
||||
```csharp
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Diagnostics.Tracing;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
using Microsoft.PowerToys.Telemetry.Events;
|
||||
|
||||
namespace MyModule.Telemetry
|
||||
{
|
||||
[EventData]
|
||||
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)]
|
||||
public class MyModuleEvent : EventBase, IEvent
|
||||
{
|
||||
// Event properties (logged as telemetry data)
|
||||
public string SomeProperty { get; set; }
|
||||
public int SomeValue { get; set; }
|
||||
|
||||
// Required: Privacy tag
|
||||
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
|
||||
|
||||
// Optional: Set EventName in constructor (defaults to class name)
|
||||
public MyModuleEvent(string prop, int val)
|
||||
{
|
||||
EventName = "MyModule_EventName";
|
||||
SomeProperty = prop;
|
||||
SomeValue = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
2. Log the event:
|
||||
|
||||
```csharp
|
||||
PowerToysTelemetry.Log.WriteEvent(new MyModuleEvent("value", 42));
|
||||
```
|
||||
|
||||
**Privacy Tags (C#)**
|
||||
|
||||
| Tag | Use Case |
|
||||
| ------------- |:-------------:|
|
||||
| `PartA_PrivTags.ProductAndServiceUsage` [TelemetryBase.cs](../../src/common/Telemetry/TelemetryBase.cs) | Feature usage events
|
||||
| `PartA_PrivTags.ProductAndServicePerformance` [TelemetryBase.cs](../../src/common/Telemetry/TelemetryBase.cs) | Performance/timing events
|
||||
|
||||
### Update DATA_AND_PRIVACY.md file
|
||||
|
||||
Add your new event(s) to [DATA_AND_PRIVACY.md](../../DATA_AND_PRIVACY.md).
|
||||
|
||||
## Launch Product Version Containing the new events
|
||||
|
||||
Events do not become active until they ship in a released PowerToys version. After your PRs are merged:
|
||||
|
||||
- The event will begin firing once users install the version that includes it
|
||||
- In order for PowerToys to process these events, you must complete the next section
|
||||
|
||||
## Next Steps
|
||||
|
||||
Reach out to @carlos-zamora or @chatasweetie so internal scripts can process new event(s).
|
||||
|
||||
## Summary
|
||||
|
||||
Required steps:
|
||||
|
||||
1. In one PR:
|
||||
- Add the event(s) in code
|
||||
- Document event(s) in DATA_AND_PRIVACY.md
|
||||
1. Ship the change in a PowerToys release
|
||||
1. Reach out for next steps
|
||||
@@ -152,7 +152,7 @@ FancyZones is divided into several projects:
|
||||
## Development Environment Setup
|
||||
|
||||
### Prerequisites
|
||||
- Visual Studio 2026 (or 2022 17.4+): Required for building and debugging
|
||||
- Visual Studio 2022 or 2026: Required for building and debugging
|
||||
- Windows 10 SDK: Ensure the latest version is installed
|
||||
- PowerToys Repository: Clone from GitHub
|
||||
|
||||
@@ -183,7 +183,7 @@ FancyZones is divided into several projects:
|
||||
## Debugging
|
||||
|
||||
### Setup for Debugging
|
||||
1. In Visual Studio, set FancyZonesEditor as the startup project
|
||||
1. In Visual Studio 2022 or 2026, set FancyZonesEditor as the startup project
|
||||
2. Set breakpoints in the code where needed
|
||||
3. Click Run to start debugging
|
||||
|
||||
|
||||
@@ -2,31 +2,91 @@
|
||||
|
||||
Welcome to the PowerToys developer documentation. This documentation provides information for developers who want to contribute to PowerToys or understand how it works.
|
||||
|
||||
## Getting Started
|
||||
## Core Architecture
|
||||
|
||||
### Prerequisites
|
||||
- [Architecture Overview](core/architecture.md) - Overview of the PowerToys architecture and module interface
|
||||
- [Runner and System tray](core/runner.md) - Details about the PowerToys Runner process
|
||||
- [Settings](core/settings/readme.md) - Documentation on the settings system
|
||||
- [Installer](core/installer.md) - Information about the PowerToys installer
|
||||
- [Modules](modules/readme.md) - Documentation for individual PowerToys modules
|
||||
|
||||
1. Windows 10 April 2018 Update (version 1803) or newer
|
||||
1. [Visual Studio 2026](https://visualstudio.microsoft.com/downloads/) (recommended) or Visual Studio 2022 17.4+ with the following workloads/components:
|
||||
- Desktop Development with C++
|
||||
- WinUI application development
|
||||
- .NET desktop development
|
||||
- Windows 10 SDK (10.0.22621.0)
|
||||
- Windows 11 SDK (10.0.26100.3916)
|
||||
1. .NET 8 SDK
|
||||
1. Enable long paths in Windows (see [Enable Long Paths](https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation#enabling-long-paths-in-windows-10-version-1607-and-later) for details)
|
||||
## Common Components
|
||||
|
||||
> **Tip:** You can install Visual Studio with all required workloads automatically using the [WinGet configuration files](https://github.com/microsoft/PowerToys/tree/main/.config) in the repository:
|
||||
> ```powershell
|
||||
> winget configure .config\configuration.winget
|
||||
> ```
|
||||
> Pick the file that matches your VS edition (e.g., `configuration.vsProfessional.winget` or `configuration.vsEnterprise.winget`).
|
||||
- [Context Menu Handlers](common/context-menus.md) - How PowerToys implements and registers Explorer context menu handlers
|
||||
- [Monaco Editor](common/monaco-editor.md) - How PowerToys uses the Monaco code editor component across modules
|
||||
- [Logging and Telemetry](development/logging.md) - How to use logging and telemetry
|
||||
- [Localization](development/localization.md) - How to support multiple languages
|
||||
|
||||
### Fork, Clone, and Set Up
|
||||
## Development Guidelines
|
||||
|
||||
- [Coding Guidelines](development/guidelines.md) - Development guidelines and best practices
|
||||
- [Coding Style](development/style.md) - Code formatting and style conventions
|
||||
- [UI Testing](development/ui-tests.md) - How to write UI tests for PowerToys
|
||||
- [Debugging](development/debugging.md) - Techniques for debugging PowerToys
|
||||
|
||||
## Tools
|
||||
|
||||
- [Tools Overview](tools/readme.md) - Overview of tools in PowerToys
|
||||
- [Build Tools](tools/build-tools.md) - Tools that help building PowerToys
|
||||
- [Bug Report Tool](tools/bug-report-tool.md) - Tool for collecting logs and system information
|
||||
- [Debugging Tools](tools/debugging-tools.md) - Specialized tools for debugging
|
||||
- [Fuzzing Testing](tools/fuzzingtesting.md) - How to implement and run fuzz testing for PowerToys modules
|
||||
|
||||
## Processes
|
||||
|
||||
- [Release Process](processes/release-process.md) - How PowerToys releases are prepared and published
|
||||
- [Update Process](processes/update-process.md) - How PowerToys updates work
|
||||
- [GPO Implementation](processes/gpo.md) - Group Policy Objects implementation details
|
||||
|
||||
## Other Resources
|
||||
|
||||
- [aka.ms links](akaLinks.md) - List of short links
|
||||
- [Issue/PR commands](commands.md) - Special commands for managing issues and pull requests
|
||||
|
||||
## Fork, Clone, Branch and Create your PR
|
||||
|
||||
Once you've discussed your proposed feature/fix/etc. with a team member, and an approach or a spec has been written and approved, it's time to start development:
|
||||
|
||||
1. Fork the repo on GitHub if you haven't already
|
||||
1. Clone your fork locally
|
||||
1. Run the automated setup script (**recommended**):
|
||||
1. Create a feature branch
|
||||
1. Work on your changes
|
||||
1. Create a [Draft Pull Request (PR)](https://github.blog/2019-02-14-introducing-draft-pull-requests/)
|
||||
1. When ready, mark your PR as "ready for review".
|
||||
|
||||
## Rules
|
||||
|
||||
- **Follow the pattern of what you already see in the code.**
|
||||
- [Coding style](development/style.md).
|
||||
- Try to package new functionality/components into libraries that have nicely defined interfaces.
|
||||
- Package new functionality into classes or refactor existing functionality into a class as you extend the code.
|
||||
- When adding new classes/methods/changing existing code, add new unit tests or update the existing tests.
|
||||
|
||||
## GitHub Workflow
|
||||
|
||||
- Before starting to work on a fix/feature, make sure there is an open issue to track the work.
|
||||
- Add the `In progress` label to the issue, if not already present. Also add a `Cost-Small/Medium/Large` estimate and make sure all appropriate labels are set.
|
||||
- If you are a community contributor, you will not be able to add labels to the issue; in that case just add a comment saying that you have started work on the issue and try to give an estimate for the delivery date.
|
||||
- If the work item has a medium/large cost, using the markdown task list, list each sub item and update the list with a check mark after completing each sub item.
|
||||
- **Before opening a PR, ensure your changes build successfully locally and functionality tests pass.** This is especially important for AI-assisted (vibe coding) contributions—always verify AI-generated code works as intended. Exploratory PRs or draft PRs for discussion are exceptions.
|
||||
- When opening a PR, follow the PR template.
|
||||
- When you'd like the team to take a look (even if the work is not yet fully complete) mark the PR as 'Ready For Review' so that the team can review your work and provide comments, suggestions, and request changes. It may take several cycles, but the end result will be solid, testable, conformant code that is safe for us to merge.
|
||||
- When the PR is approved, let the owner of the PR merge it. For community contributions, the reviewer who approved the PR can also merge it.
|
||||
- Use the `Squash and merge` option to merge a PR. If you don't want to squash it because there are logically different commits, use `Rebase and merge`.
|
||||
- Close issues automatically when referenced in a PR. You can use [closing keywords](https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword) in the body of the PR to have GitHub automatically link your PR to the issue.
|
||||
|
||||
## Compiling PowerToys
|
||||
|
||||
### Prerequisites for Compiling PowerToys
|
||||
|
||||
1. Windows 10 April 2018 Update (version 1803) or newer
|
||||
1. Visual Studio Community/Professional/Enterprise 2022 17.4 or newer, or Visual Studio 2026
|
||||
1. A local clone of the PowerToys repository
|
||||
1. Enable long paths in Windows (see [Enable Long Paths](https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation#enabling-long-paths-in-windows-10-version-1607-and-later) for details)
|
||||
|
||||
### Automated Setup (Recommended)
|
||||
|
||||
Run the setup script to automatically configure your development environment:
|
||||
|
||||
```powershell
|
||||
.\tools\build\setup-dev-environment.ps1
|
||||
@@ -38,10 +98,15 @@ This script will:
|
||||
- Guide you through installing required Visual Studio components from `.vsconfig`
|
||||
- Initialize git submodules
|
||||
|
||||
Run with `-Help` to see all available options.
|
||||
Run with `-Help` to see all available options:
|
||||
|
||||
<details>
|
||||
<summary><strong>Manual setup (if you prefer not to use the script)</strong></summary>
|
||||
```powershell
|
||||
.\tools\build\setup-dev-environment.ps1 -Help
|
||||
```
|
||||
|
||||
### Manual Setup
|
||||
|
||||
If you prefer to set up manually, follow these steps:
|
||||
|
||||
#### Install Visual Studio dependencies
|
||||
|
||||
@@ -50,17 +115,15 @@ Run with `-Help` to see all available options.
|
||||
|
||||
Alternatively, import the `.vsconfig` file from the repository root using Visual Studio Installer to install all required workloads.
|
||||
|
||||
#### Initialize submodules
|
||||
#### Get Submodules to compile
|
||||
|
||||
This is a one-time step required before you can compile most parts of PowerToys.
|
||||
We have submodules that need to be initialized before you can compile most parts of PowerToys. This should be a one-time step.
|
||||
|
||||
1. Open a terminal
|
||||
1. Navigate to the folder you cloned PowerToys to.
|
||||
1. Run `git submodule update --init --recursive`
|
||||
|
||||
</details>
|
||||
|
||||
### Building
|
||||
### Compiling Source Code
|
||||
|
||||
#### Using Visual Studio
|
||||
|
||||
@@ -88,77 +151,7 @@ You can also build from the command line using the provided scripts in `tools\bu
|
||||
.\tools\build\build-installer.ps1
|
||||
```
|
||||
|
||||
### Debugging
|
||||
|
||||
See [Debugging](development/debugging.md) for detailed debugging techniques, including Visual Studio setup, attaching to child processes, and troubleshooting build errors.
|
||||
|
||||
### Creating a New PowerToy
|
||||
|
||||
See [Creating a New PowerToy](development/new-powertoy.md) for an end-to-end guide covering module architecture, settings integration, installer packaging, and testing.
|
||||
|
||||
## Development Guidelines
|
||||
|
||||
- [Coding Guidelines](development/guidelines.md) - Development guidelines and best practices
|
||||
- [Coding Style](development/style.md) - Code formatting and style conventions
|
||||
- [Logging and Telemetry](development/logging.md) - How to use logging and telemetry
|
||||
- [Localization](development/localization.md) - How to support multiple languages
|
||||
- [UI Testing](development/ui-tests.md) - How to write UI tests for PowerToys
|
||||
- [Developing with VS Code](development/dev-with-vscode.md) - Build, debug, and contribute using VS Code
|
||||
|
||||
## Rules
|
||||
|
||||
- **Follow the pattern of what you already see in the code.**
|
||||
- [Coding style](development/style.md).
|
||||
- Try to package new functionality/components into libraries that have nicely defined interfaces.
|
||||
- Package new functionality into classes or refactor existing functionality into a class as you extend the code.
|
||||
- When adding new classes/methods/changing existing code, add new unit tests or update the existing tests.
|
||||
|
||||
## GitHub Workflow
|
||||
|
||||
- Before starting to work on a fix/feature, make sure there is an open issue to track the work.
|
||||
- Add the `In progress` label to the issue, if not already present. Also add a `Cost-Small/Medium/Large` estimate and make sure all appropriate labels are set.
|
||||
- If you are a community contributor, you will not be able to add labels to the issue; in that case just add a comment saying that you have started work on the issue and try to give an estimate for the delivery date.
|
||||
- If the work item has a medium/large cost, using the markdown task list, list each sub item and update the list with a check mark after completing each sub item.
|
||||
- **Before opening a PR, ensure your changes build successfully locally and functionality tests pass.** This is especially important for AI-assisted (vibe coding) contributions—always verify AI-generated code works as intended. Exploratory PRs or draft PRs for discussion are exceptions.
|
||||
- When opening a PR, follow the PR template.
|
||||
- When you'd like the team to take a look (even if the work is not yet fully complete) mark the PR as 'Ready For Review' so that the team can review your work and provide comments, suggestions, and request changes. It may take several cycles, but the end result will be solid, testable, conformant code that is safe for us to merge.
|
||||
- When the PR is approved, let the owner of the PR merge it. For community contributions, the reviewer who approved the PR can also merge it.
|
||||
- Use the `Squash and merge` option to merge a PR. If you don't want to squash it because there are logically different commits, use `Rebase and merge`.
|
||||
- Close issues automatically when referenced in a PR. You can use [closing keywords](https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword) in the body of the PR to have GitHub automatically link your PR to the issue.
|
||||
|
||||
## Core Architecture
|
||||
|
||||
- [Architecture Overview](core/architecture.md) - Overview of the PowerToys architecture and module interface
|
||||
- [Runner and System tray](core/runner.md) - Details about the PowerToys Runner process
|
||||
- [Settings](core/settings/readme.md) - Documentation on the settings system
|
||||
- [Installer](core/installer.md) - Information about the PowerToys installer
|
||||
- [Modules](modules/readme.md) - Documentation for individual PowerToys modules
|
||||
|
||||
## Common Components
|
||||
|
||||
- [Context Menu Handlers](common/context-menus.md) - How PowerToys implements and registers Explorer context menu handlers
|
||||
- [Monaco Editor](common/monaco-editor.md) - How PowerToys uses the Monaco code editor component across modules
|
||||
|
||||
## Tools
|
||||
|
||||
- [Tools Overview](tools/readme.md) - Overview of tools in PowerToys
|
||||
- [Build Tools](tools/build-tools.md) - Tools that help building PowerToys
|
||||
- [Bug Report Tool](tools/bug-report-tool.md) - Tool for collecting logs and system information
|
||||
- [Debugging Tools](tools/debugging-tools.md) - Specialized tools for debugging
|
||||
- [Fuzzing Testing](tools/fuzzingtesting.md) - How to implement and run fuzz testing for PowerToys modules
|
||||
|
||||
## Processes
|
||||
|
||||
- [Release Process](processes/release-process.md) - How PowerToys releases are prepared and published
|
||||
- [Update Process](processes/update-process.md) - How PowerToys updates work
|
||||
- [GPO Implementation](processes/gpo.md) - Group Policy Objects implementation details
|
||||
|
||||
## Other Resources
|
||||
|
||||
- [aka.ms links](akaLinks.md) - List of short links
|
||||
- [Issue/PR commands](commands.md) - Special commands for managing issues and pull requests
|
||||
|
||||
## Building the Installer
|
||||
## Compile the installer
|
||||
|
||||
Our installer is two parts, an EXE and an MSI. The EXE (Bootstrapper) contains the MSI and handles more complex installation logic.
|
||||
- The EXE installs all prerequisites and installs PowerToys via the MSI. It has additional features such as the installation flags (see below).
|
||||
@@ -172,3 +165,8 @@ The installer can only be compiled in `Release` mode; steps 1 and 2 must be perf
|
||||
1. Compile `PowerToysSetup.slnx` Path from root: `installer\PowerToysSetup.slnx` (details listed below)
|
||||
|
||||
See [Installer](core/installer.md) for more details on building and debugging the installer.
|
||||
|
||||
## How to create new PowerToys
|
||||
|
||||
See the instructions on [how to install the PowerToys Module project template](/tools/project_template). <br />
|
||||
Specifications for the [PowerToys settings API](core/settings/readme.md).
|
||||
|
||||
BIN
doc/images/overview/CmdPal_Hero.gif
Normal file
BIN
doc/images/overview/CmdPal_Hero.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.5 MiB |
BIN
doc/images/runner/tray.png
Normal file
BIN
doc/images/runner/tray.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\packages\WixToolset.WcaUtil.5.0.2\build\WixToolset.WcaUtil.props" Condition="Exists('..\packages\WixToolset.WcaUtil.5.0.2\build\WixToolset.WcaUtil.props')" />
|
||||
<Import Project="..\packages\WixToolset.DUtil.5.0.2\build\WixToolset.DUtil.props" Condition="Exists('..\packages\WixToolset.DUtil.5.0.2\build\WixToolset.DUtil.props')" />
|
||||
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<Import Project="..\wix.props" Condition="Exists('..\wix.props')" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{B3A354B0-1E54-4B55-A962-FB5AF9330C19}</ProjectGuid>
|
||||
@@ -88,7 +88,7 @@
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>inc;..\..\src\;..\..\src\common\Telemetry;telemetry;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalOptions>/Zc:twoPhase- /Wv:18 %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalOptions>/await /Zc:twoPhase- /Wv:18 %(AdditionalOptions)</AdditionalOptions>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
@@ -165,14 +165,14 @@
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\WixToolset.DUtil.5.0.2\build\WixToolset.DUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\WixToolset.DUtil.5.0.2\build\WixToolset.DUtil.props'))" />
|
||||
<Error Condition="!Exists('..\packages\WixToolset.WcaUtil.5.0.2\build\WixToolset.WcaUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\WixToolset.WcaUtil.5.0.2\build\WixToolset.WcaUtil.props'))" />
|
||||
</Target>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.250303.1" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.240111.5" targetFramework="native" />
|
||||
<package id="WixToolset.DUtil" version="5.0.2" targetFramework="native" />
|
||||
<package id="WixToolset.WcaUtil" version="5.0.2" targetFramework="native" />
|
||||
</packages>
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<clear />
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<Import Project="$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<Target Name="GenerateResourceFiles" BeforeTargets="PrepareForBuild">
|
||||
<Exec Command="powershell -NonInteractive -executionpolicy Unrestricted $(RepoRoot)tools\build\convert-resx-to-rc.ps1 $(MSBuildThisFileDirectory) resource.base.h resource.h actionRunner.base.rc actionRunner.rc" />
|
||||
<Exec Command="powershell -NonInteractive -executionpolicy Unrestricted $(SolutionDir)tools\build\convert-resx-to-rc.ps1 $(MSBuildThisFileDirectory) resource.base.h resource.h actionRunner.base.rc actionRunner.rc" />
|
||||
</Target>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
@@ -11,10 +10,11 @@
|
||||
<RootNamespace>actionRunner</RootNamespace>
|
||||
<ProjectName>PowerToys.ActionRunner</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Label="Configuration">
|
||||
|
||||
</PropertyGroup>
|
||||
<Import Project="$(RepoRoot)deps\expected.props" />
|
||||
<Import Project="..\..\deps\expected.props" />
|
||||
<PropertyGroup>
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
@@ -59,17 +59,17 @@
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<Import Project="$(RepoRoot)deps\spdlog.props" />
|
||||
<Import Project="..\..\deps\spdlog.props" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
<Import Project="$(RepoRoot)packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('$(RepoRoot)packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
|
||||
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
<Import Project="..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
<Error Condition="!Exists('$(RepoRoot)packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(RepoRoot)packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
|
||||
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.250303.1" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.240111.5" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.231216.1" targetFramework="native" />
|
||||
</packages>
|
||||
@@ -4,9 +4,8 @@
|
||||
<Import Project=".\Common.Dotnet.PrepareGeneratedFolder.targets" />
|
||||
|
||||
<PropertyGroup>
|
||||
<CoreTargetFramework>net9.0</CoreTargetFramework>
|
||||
<WindowsSdkPackageVersion>10.0.26100.68-preview</WindowsSdkPackageVersion>
|
||||
<TargetFramework>$(CoreTargetFramework)-windows10.0.26100.0</TargetFramework>
|
||||
<TargetFramework>net9.0-windows10.0.26100.0</TargetFramework>
|
||||
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
|
||||
<SupportedOSPlatformVersion>10.0.19041.0</SupportedOSPlatformVersion>
|
||||
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
|
||||
|
||||
@@ -7,13 +7,4 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0-windows10.0.26100.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<!--
|
||||
In CI, the main build runs `/t:Build;Test` across the full solution.
|
||||
Fuzz test projects are built for OneFuzz ingestion, but should not be
|
||||
executed as regular MSTest tests in this pass.
|
||||
-->
|
||||
<PropertyGroup Condition="'$(TF_BUILD)' != ''">
|
||||
<TestingPlatformDisableCustomTestTarget>true</TestingPlatformDisableCustomTestTarget>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
||||
@@ -57,7 +57,7 @@ std::optional<fs::path> ObtainInstaller(bool& isUpToDate)
|
||||
|
||||
auto state = UpdateState::read();
|
||||
|
||||
const auto new_version_info = std::move(get_github_version_info_async()).get();
|
||||
const auto new_version_info = get_github_version_info_async().get();
|
||||
if (std::holds_alternative<version_up_to_date>(*new_version_info))
|
||||
{
|
||||
isUpToDate = true;
|
||||
@@ -76,7 +76,7 @@ std::optional<fs::path> ObtainInstaller(bool& isUpToDate)
|
||||
// Cleanup old updates before downloading the latest
|
||||
updating::cleanup_updates();
|
||||
|
||||
auto downloaded_installer = std::move(download_new_version_async(std::get<new_version_download_info>(*new_version_info))).get();
|
||||
auto downloaded_installer = download_new_version(std::get<new_version_download_info>(*new_version_info)).get();
|
||||
if (!downloaded_installer)
|
||||
{
|
||||
Logger::error("Couldn't download new installer");
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<Import Project="$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<Target Name="GenerateResourceFiles" BeforeTargets="PrepareForBuild">
|
||||
<Exec Command="powershell -NonInteractive -executionpolicy Unrestricted $(RepoRoot)tools\build\convert-resx-to-rc.ps1 $(MSBuildThisFileDirectory) resource.base.h resource.h PowerToys.Update.base.rc PowerToys.Update.rc" />
|
||||
<Exec Command="powershell -NonInteractive -executionpolicy Unrestricted $(SolutionDir)tools\build\convert-resx-to-rc.ps1 $(MSBuildThisFileDirectory) resource.base.h resource.h PowerToys.Update.base.rc PowerToys.Update.rc" />
|
||||
</Target>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
@@ -11,10 +10,11 @@
|
||||
<RootNamespace>Update</RootNamespace>
|
||||
<ProjectName>PowerToys.Update</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Label="Configuration">
|
||||
|
||||
</PropertyGroup>
|
||||
<Import Project="$(RepoRoot)deps\expected.props" />
|
||||
<Import Project="..\..\deps\expected.props" />
|
||||
<PropertyGroup>
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
@@ -65,17 +65,17 @@
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<Import Project="$(RepoRoot)deps\spdlog.props" />
|
||||
<Import Project="..\..\deps\spdlog.props" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
<Import Project="$(RepoRoot)packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('$(RepoRoot)packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
|
||||
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
<Import Project="..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
<Error Condition="!Exists('$(RepoRoot)packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(RepoRoot)packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
|
||||
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.250303.1" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.240111.5" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.231216.1" targetFramework="native" />
|
||||
</packages>
|
||||
27
src/common/AllExperiments/AllExperiments.csproj
Normal file
27
src/common/AllExperiments/AllExperiments.csproj
Normal file
@@ -0,0 +1,27 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<!-- Look at Directory.Build.props in root for common stuff as well -->
|
||||
<Import Project="..\..\Common.Dotnet.CsWinRT.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<TargetName>PowerToys.AllExperiments</TargetName>
|
||||
<MockDirectory>.\Microsoft.VariantAssignment\</MockDirectory>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ManagedTelemetry\Telemetry\ManagedTelemetry.csproj" />
|
||||
<ProjectReference Include="..\..\settings-ui\Settings.UI.Library\Settings.UI.Library.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Experimentation is live, forcing inclusion -->
|
||||
<ItemGroup Condition="'$(IsExperimentationLive)'!=''">
|
||||
<!-- Newtonsoft.Json is included and a version specified in Directory.Packages.props to avoid a vulnerability from older versions. -->
|
||||
<PackageReference Include="Newtonsoft.Json" />
|
||||
<PackageReference Include="Microsoft.VariantAssignment.Client" />
|
||||
<PackageReference Include="Microsoft.VariantAssignment.Contract" />
|
||||
<Compile Remove=".\$(MockDirectory)\Client\*.cs" />
|
||||
<Compile Remove=".\$(MockDirectory)\Contract\*.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
214
src/common/AllExperiments/Experiments.cs
Normal file
214
src/common/AllExperiments/Experiments.cs
Normal file
@@ -0,0 +1,214 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Globalization;
|
||||
using System.Text.Json;
|
||||
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Telemetry.Events;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
using Microsoft.VariantAssignment.Client;
|
||||
using Microsoft.VariantAssignment.Contract;
|
||||
using Windows.System.Profile;
|
||||
|
||||
namespace AllExperiments
|
||||
{
|
||||
// The dependencies required to build this project are only available in the official build pipeline and are internal to Microsoft.
|
||||
// However, this project is not required to build a test version of the application.
|
||||
public class Experiments
|
||||
{
|
||||
public enum ExperimentState
|
||||
{
|
||||
Enabled,
|
||||
Disabled,
|
||||
NotLoaded,
|
||||
}
|
||||
|
||||
#pragma warning disable SA1401 // Need to use LandingPageExperiment as a static property in OobeShellPage.xaml.cs
|
||||
#pragma warning disable CA2211 // Non-constant fields should not be visible
|
||||
public static ExperimentState LandingPageExperiment = ExperimentState.NotLoaded;
|
||||
#pragma warning restore CA2211
|
||||
#pragma warning restore SA1401
|
||||
|
||||
public async Task<bool> EnableLandingPageExperimentAsync()
|
||||
{
|
||||
if (Experiments.LandingPageExperiment != ExperimentState.NotLoaded)
|
||||
{
|
||||
return Experiments.LandingPageExperiment == ExperimentState.Enabled;
|
||||
}
|
||||
|
||||
Experiments varServ = new Experiments();
|
||||
await varServ.VariantAssignmentProvider_Initialize();
|
||||
var landingPageExperiment = varServ.IsExperiment;
|
||||
|
||||
Experiments.LandingPageExperiment = landingPageExperiment ? ExperimentState.Enabled : ExperimentState.Disabled;
|
||||
|
||||
return landingPageExperiment;
|
||||
}
|
||||
|
||||
private async Task VariantAssignmentProvider_Initialize()
|
||||
{
|
||||
IsExperiment = false;
|
||||
string jsonFilePath = CreateFilePath();
|
||||
|
||||
var vaSettings = new VariantAssignmentClientSettings
|
||||
{
|
||||
Endpoint = new Uri("https://default.exp-tas.com/exptas77/a7a397e7-6fbe-4f21-a4e9-3f542e4b000e-exppowertoys/api/v1/tas"),
|
||||
EnableCaching = true,
|
||||
ResponseCacheTime = TimeSpan.FromMinutes(5),
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
var vaClient = vaSettings.GetTreatmentAssignmentServiceClient();
|
||||
var vaRequest = GetVariantAssignmentRequest();
|
||||
using var variantAssignments = await vaClient.GetVariantAssignmentsAsync(vaRequest).ConfigureAwait(false);
|
||||
|
||||
if (variantAssignments.AssignedVariants.Count != 0)
|
||||
{
|
||||
var dataVersion = variantAssignments.DataVersion;
|
||||
var featureVariables = variantAssignments.GetFeatureVariables();
|
||||
var assignmentContext = variantAssignments.GetAssignmentContext();
|
||||
var featureFlagValue = featureVariables[0].GetStringValue();
|
||||
|
||||
var experimentGroup = string.Empty;
|
||||
string json = File.ReadAllText(jsonFilePath);
|
||||
var jsonDictionary = JsonSerializer.Deserialize<Dictionary<string, object>>(json);
|
||||
|
||||
if (jsonDictionary != null)
|
||||
{
|
||||
if (!jsonDictionary.TryGetValue("dataversion", out object? value))
|
||||
{
|
||||
value = dataVersion;
|
||||
jsonDictionary.Add("dataversion", value);
|
||||
}
|
||||
|
||||
if (!jsonDictionary.ContainsKey("variantassignment"))
|
||||
{
|
||||
jsonDictionary.Add("variantassignment", featureFlagValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
var jsonDataVersion = value.ToString();
|
||||
if (jsonDataVersion != null && int.Parse(jsonDataVersion, CultureInfo.InvariantCulture) < dataVersion)
|
||||
{
|
||||
jsonDictionary["dataversion"] = dataVersion;
|
||||
jsonDictionary["variantassignment"] = featureFlagValue;
|
||||
}
|
||||
}
|
||||
|
||||
experimentGroup = jsonDictionary["variantassignment"].ToString();
|
||||
|
||||
string output = JsonSerializer.Serialize(jsonDictionary);
|
||||
File.WriteAllText(jsonFilePath, output);
|
||||
}
|
||||
|
||||
if (experimentGroup == "alternate" && AssignmentUnit != string.Empty)
|
||||
{
|
||||
IsExperiment = true;
|
||||
}
|
||||
|
||||
PowerToysTelemetry.Log.WriteEvent(new OobeVariantAssignmentEvent() { AssignmentContext = assignmentContext, ClientID = AssignmentUnit });
|
||||
}
|
||||
}
|
||||
catch (HttpRequestException ex)
|
||||
{
|
||||
string json = File.ReadAllText(jsonFilePath);
|
||||
var jsonDictionary = JsonSerializer.Deserialize<Dictionary<string, object>>(json);
|
||||
|
||||
if (jsonDictionary != null)
|
||||
{
|
||||
if (jsonDictionary.TryGetValue("variantassignment", out object? value))
|
||||
{
|
||||
if (value.ToString() == "alternate" && AssignmentUnit != string.Empty)
|
||||
{
|
||||
IsExperiment = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jsonDictionary["variantassignment"] = "current";
|
||||
}
|
||||
}
|
||||
|
||||
string output = JsonSerializer.Serialize(jsonDictionary);
|
||||
File.WriteAllText(jsonFilePath, output);
|
||||
|
||||
Logger.LogError("Error getting to TAS endpoint", ex);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError("Error getting variant assignments for experiment", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsExperiment { get; set; }
|
||||
|
||||
private string? AssignmentUnit { get; set; }
|
||||
|
||||
private VariantAssignmentRequest GetVariantAssignmentRequest()
|
||||
{
|
||||
var jsonFilePath = CreateFilePath();
|
||||
try
|
||||
{
|
||||
if (!File.Exists(jsonFilePath))
|
||||
{
|
||||
AssignmentUnit = Guid.NewGuid().ToString();
|
||||
var data = new Dictionary<string, string>()
|
||||
{
|
||||
["clientid"] = AssignmentUnit,
|
||||
};
|
||||
string jsonData = JsonSerializer.Serialize(data);
|
||||
File.WriteAllText(jsonFilePath, jsonData);
|
||||
}
|
||||
else
|
||||
{
|
||||
string json = File.ReadAllText(jsonFilePath);
|
||||
var jsonDictionary = System.Text.Json.JsonSerializer.Deserialize<Dictionary<string, object>>(json);
|
||||
if (jsonDictionary != null)
|
||||
{
|
||||
AssignmentUnit = jsonDictionary["clientid"]?.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError("Error creating/getting AssignmentUnit", ex);
|
||||
}
|
||||
|
||||
var attrNames = new List<string> { "FlightRing", "c:InstallLanguage" };
|
||||
var attrData = AnalyticsInfo.GetSystemPropertiesAsync(attrNames).AsTask().GetAwaiter().GetResult();
|
||||
|
||||
var flightRing = string.Empty;
|
||||
var installLanguage = string.Empty;
|
||||
|
||||
if (attrData.ContainsKey("FlightRing"))
|
||||
{
|
||||
flightRing = attrData["FlightRing"];
|
||||
}
|
||||
|
||||
if (attrData.ContainsKey("InstallLanguage"))
|
||||
{
|
||||
installLanguage = attrData["InstallLanguage"];
|
||||
}
|
||||
|
||||
return new VariantAssignmentRequest
|
||||
{
|
||||
Parameters =
|
||||
{
|
||||
{ "installLanguage", installLanguage },
|
||||
{ "flightRing", flightRing },
|
||||
{ "clientid", AssignmentUnit },
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
private string CreateFilePath()
|
||||
{
|
||||
var exeDir = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
|
||||
var settingsPath = @"Microsoft\PowerToys\experimentation.json";
|
||||
var filePath = Path.Combine(exeDir, settingsPath);
|
||||
return filePath;
|
||||
}
|
||||
}
|
||||
}
|
||||
81
src/common/AllExperiments/Logger.cs
Normal file
81
src/common/AllExperiments/Logger.cs
Normal file
@@ -0,0 +1,81 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO.Abstractions;
|
||||
|
||||
namespace AllExperiments
|
||||
{
|
||||
public static class Logger
|
||||
{
|
||||
private static readonly IFileSystem FileSystem = new FileSystem();
|
||||
private static readonly IPath Path = FileSystem.Path;
|
||||
private static readonly IDirectory Directory = FileSystem.Directory;
|
||||
|
||||
private static readonly string ApplicationLogPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Microsoft\\PowerToys\\Settings Logs\\Experimentation");
|
||||
|
||||
static Logger()
|
||||
{
|
||||
if (!Directory.Exists(ApplicationLogPath))
|
||||
{
|
||||
Directory.CreateDirectory(ApplicationLogPath);
|
||||
}
|
||||
|
||||
// Using InvariantCulture since this is used for a log file name
|
||||
var logFilePath = Path.Combine(ApplicationLogPath, "Log_" + DateTime.Now.ToString(@"yyyy-MM-dd", CultureInfo.InvariantCulture) + ".log");
|
||||
|
||||
Trace.Listeners.Add(new TextWriterTraceListener(logFilePath));
|
||||
|
||||
Trace.AutoFlush = true;
|
||||
}
|
||||
|
||||
public static void LogInfo(string message)
|
||||
{
|
||||
Log(message, "INFO");
|
||||
}
|
||||
|
||||
public static void LogError(string message)
|
||||
{
|
||||
Log(message, "ERROR");
|
||||
#if DEBUG
|
||||
Debugger.Break();
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void LogError(string message, Exception e)
|
||||
{
|
||||
Log(
|
||||
message + Environment.NewLine +
|
||||
e?.Message + Environment.NewLine +
|
||||
"Inner exception: " + Environment.NewLine +
|
||||
e?.InnerException?.Message + Environment.NewLine +
|
||||
"Stack trace: " + Environment.NewLine +
|
||||
e?.StackTrace,
|
||||
"ERROR");
|
||||
#if DEBUG
|
||||
Debugger.Break();
|
||||
#endif
|
||||
}
|
||||
|
||||
private static void Log(string message, string type)
|
||||
{
|
||||
Trace.WriteLine(type + ": " + DateTime.Now.TimeOfDay);
|
||||
Trace.Indent();
|
||||
Trace.WriteLine(GetCallerInfo());
|
||||
Trace.WriteLine(message);
|
||||
Trace.Unindent();
|
||||
}
|
||||
|
||||
private static string GetCallerInfo()
|
||||
{
|
||||
StackTrace stackTrace = new StackTrace();
|
||||
|
||||
var methodName = stackTrace.GetFrame(3)?.GetMethod();
|
||||
var className = methodName?.DeclaringType?.Name;
|
||||
return "[Method]: " + methodName?.Name + " [Class]: " + className;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Microsoft.VariantAssignment.Contract;
|
||||
|
||||
// The goal of this class is to just mock out the Microsoft.VariantAssignment close source objects
|
||||
namespace Microsoft.VariantAssignment.Client
|
||||
{
|
||||
#pragma warning disable SA1200 // Using directives should be placed correctly
|
||||
using TreatmentAssignmentServiceClient = VariantAssignmentServiceClient<TreatmentAssignmentServiceResponse>;
|
||||
#pragma warning restore SA1200 // Using directives should be placed correctly
|
||||
|
||||
public static class VariantAssignmentClientExtensionMethods
|
||||
{
|
||||
public static IVariantAssignmentProvider GetTreatmentAssignmentServiceClient(this VariantAssignmentClientSettings settings)
|
||||
{
|
||||
return new TreatmentAssignmentServiceClient();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Microsoft.VariantAssignment.Contract;
|
||||
|
||||
// The goal of this class is to just mock out the Microsoft.VariantAssignment close source objects
|
||||
namespace Microsoft.VariantAssignment.Client
|
||||
{
|
||||
internal sealed partial class VariantAssignmentServiceClient<TServerResponse> : IVariantAssignmentProvider, IDisposable
|
||||
where TServerResponse : VariantAssignmentServiceResponse
|
||||
{
|
||||
public void Dispose()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<IVariantAssignmentResponse> GetVariantAssignmentsAsync(IVariantAssignmentRequest request, CancellationToken ct = default)
|
||||
{
|
||||
return Task.FromResult(EmptyVariantAssignmentResponse.Instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
// The goal of this class is to just mock out the Microsoft.VariantAssignment close source objects
|
||||
namespace Microsoft.VariantAssignment.Contract
|
||||
{
|
||||
public class EmptyVariantAssignmentResponse : IVariantAssignmentResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// Singleton instance of <see cref="EmptyVariantAssignmentResponse"/>.
|
||||
/// </summary>
|
||||
public static readonly IVariantAssignmentResponse Instance = new EmptyVariantAssignmentResponse();
|
||||
|
||||
public EmptyVariantAssignmentResponse()
|
||||
{
|
||||
}
|
||||
|
||||
public long DataVersion => 0;
|
||||
|
||||
public string Thumbprint => string.Empty;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IReadOnlyCollection<IAssignedVariant> AssignedVariants => Array.Empty<IAssignedVariant>();
|
||||
|
||||
/// <inheritdoc/>
|
||||
#pragma warning disable CS8603 // Possible null reference return.
|
||||
public IFeatureVariable GetFeatureVariable(IReadOnlyList<string> path) => null;
|
||||
#pragma warning restore CS8603 // Possible null reference return.
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IReadOnlyList<IFeatureVariable> GetFeatureVariables(IReadOnlyList<string> prefix) => Array.Empty<IFeatureVariable>();
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
}
|
||||
|
||||
string IVariantAssignmentResponse.GetAssignmentContext()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
IReadOnlyList<IFeatureVariable> IVariantAssignmentResponse.GetFeatureVariables()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
// The goal of this class is to just mock out the Microsoft.VariantAssignment close source objects
|
||||
namespace Microsoft.VariantAssignment.Contract
|
||||
{
|
||||
public interface IAssignedVariant
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
// The goal of this class is to just mock out the Microsoft.VariantAssignment close source objects
|
||||
namespace Microsoft.VariantAssignment.Contract
|
||||
{
|
||||
public interface IFeatureVariable
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the variable's value as a string.
|
||||
/// </summary>
|
||||
/// <returns>String value of the variable.</returns>
|
||||
string GetStringValue();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
// The goal of this class is to just mock out the Microsoft.VariantAssignment close source objects
|
||||
namespace Microsoft.VariantAssignment.Contract
|
||||
{
|
||||
public interface IVariantAssignmentProvider : IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// Computes variant assignments based on <paramref name="request"/> data.
|
||||
/// </summary>
|
||||
/// <param name="request">Variant assignment parameters.</param>
|
||||
/// <param name="ct">Propagates notification that operations should be canceled.</param>
|
||||
/// <returns>An awaitable task that returns a <see cref="IVariantAssignmentResponse"/>.</returns>
|
||||
Task<IVariantAssignmentResponse> GetVariantAssignmentsAsync(IVariantAssignmentRequest request, CancellationToken ct = default);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
// The goal of this class is to just mock out the Microsoft.VariantAssignment close source objects
|
||||
namespace Microsoft.VariantAssignment.Contract
|
||||
{
|
||||
public interface IVariantAssignmentRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets inputs used for evaluating filters, assignment units, etc.
|
||||
/// </summary>
|
||||
IReadOnlyCollection<(string Key, string Value)> Parameters { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
// The goal of this class is to just mock out the Microsoft.VariantAssignment close source objects
|
||||
namespace Microsoft.VariantAssignment.Contract
|
||||
{
|
||||
/// <summary>
|
||||
/// Snapshot of variant assignments.
|
||||
/// </summary>
|
||||
public interface IVariantAssignmentResponse : IDisposable
|
||||
{
|
||||
///// <summary>
|
||||
///// Gets the serial number of variant assignment configuration snapshot used when assigning variants.
|
||||
///// </summary>
|
||||
long DataVersion { get; }
|
||||
|
||||
///// <summary>
|
||||
///// Get a hash of the response suitable for caching.
|
||||
///// </summary>
|
||||
// string Thumbprint { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the variants assigned based on request parameters and a variant configuration snapshot.
|
||||
/// </summary>
|
||||
IReadOnlyCollection<IAssignedVariant> AssignedVariants { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets feature variables assigned by variants in this response.
|
||||
/// </summary>
|
||||
/// <param name="prefix">(Optional) Filter feature variables where <see cref="IFeatureVariable.KeySegments"/> contains the <paramref name="prefix"/>.</param>
|
||||
/// <returns>Range of matching feature variables.</returns>
|
||||
IReadOnlyList<IFeatureVariable> GetFeatureVariables(IReadOnlyList<string> prefix);
|
||||
|
||||
// this actually part of the interface but gets the job done
|
||||
IReadOnlyList<IFeatureVariable> GetFeatureVariables();
|
||||
|
||||
// this actually part of the interface but gets the job done
|
||||
string GetAssignmentContext();
|
||||
|
||||
/// <summary>
|
||||
/// Gets a single feature variable assigned by variants in this response.
|
||||
/// </summary>
|
||||
/// <param name="path">Exact feature variable path.</param>
|
||||
/// <returns>Matching feature variable or null.</returns>
|
||||
IFeatureVariable GetFeatureVariable(IReadOnlyList<string> path);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
// The goal of this class is to just mock out the Microsoft.VariantAssignment close source objects
|
||||
namespace Microsoft.VariantAssignment.Contract
|
||||
{
|
||||
internal sealed class TreatmentAssignmentServiceResponse : VariantAssignmentServiceResponse
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
// The goal of this class is to just mock out the Microsoft.VariantAssignment close source objects
|
||||
namespace Microsoft.VariantAssignment.Contract
|
||||
{
|
||||
/// <summary>
|
||||
/// Configuration for variant assignment service client.
|
||||
/// </summary>
|
||||
public class VariantAssignmentClientSettings
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the variant assignment service endpoint URL.
|
||||
/// </summary>
|
||||
[Required]
|
||||
public Uri? Endpoint { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether gets or sets a value whether client side request caching should be enabled.
|
||||
/// </summary>
|
||||
public bool EnableCaching { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum time a cached variant assignment response may be used without re-validating.
|
||||
/// </summary>
|
||||
public TimeSpan ResponseCacheTime { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Collections.Specialized;
|
||||
|
||||
// The goal of this class is to just mock out the Microsoft.VariantAssignment close source objects
|
||||
namespace Microsoft.VariantAssignment.Contract
|
||||
{
|
||||
public class VariantAssignmentRequest : IVariantAssignmentRequest
|
||||
{
|
||||
private NameValueCollection _parameters = new NameValueCollection();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets mutable <see cref="IVariantAssignmentRequest.Parameters"/>.
|
||||
/// </summary>
|
||||
public NameValueCollection Parameters { get => _parameters; set => _parameters = value; }
|
||||
|
||||
IReadOnlyCollection<(string Key, string Value)> IVariantAssignmentRequest.Parameters => (IReadOnlyCollection<(string Key, string Value)>)_parameters;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
// The goal of this class is to just mock out the Microsoft.VariantAssignment close source objects
|
||||
namespace Microsoft.VariantAssignment.Contract
|
||||
{
|
||||
/// <summary>
|
||||
/// Mutable implementation of <see cref="IVariantAssignmentResponse"/> for (de)serialization.
|
||||
/// </summary>
|
||||
internal class VariantAssignmentServiceResponse : IVariantAssignmentResponse, IDisposable
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public virtual long DataVersion { get; set; }
|
||||
|
||||
public virtual IReadOnlyCollection<IAssignedVariant> AssignedVariants { get; set; } = Array.Empty<IAssignedVariant>();
|
||||
|
||||
public IFeatureVariable GetFeatureVariable(IReadOnlyList<string> path)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IReadOnlyList<IFeatureVariable> GetFeatureVariables(IReadOnlyList<string> prefix)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
public IReadOnlyList<IFeatureVariable> GetFeatureVariables()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public string GetAssignmentContext()
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<AdditionalIncludeDirectories>$(RepoRoot)src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\..\..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
@@ -36,12 +36,12 @@
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="$(RepoRoot)packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('$(RepoRoot)packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('$(RepoRoot)packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(RepoRoot)packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<Import Project="$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
|
||||
<CppWinRTGenerateWindowsMetadata>true</CppWinRTGenerateWindowsMetadata>
|
||||
@@ -38,6 +37,7 @@
|
||||
<_NoWinAPIFamilyApp>true</_NoWinAPIFamilyApp>
|
||||
</PropertyGroup>
|
||||
<!-- END cppwinrt.build.pre.props -->
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
</ImportGroup>
|
||||
<PropertyGroup>
|
||||
<TargetName>CalculatorEngineCommon</TargetName>
|
||||
<OutDir>$(RepoRoot)$(Platform)\$(Configuration)\</OutDir>
|
||||
<OutDir>..\..\..\$(Platform)\$(Configuration)\</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
@@ -138,16 +138,16 @@
|
||||
<ResourceCompile Include="CalculatorEngineCommon.rc" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<Import Project="$(RepoRoot)deps\spdlog.props" />
|
||||
<Import Project="..\..\..\deps\spdlog.props" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
</Target>
|
||||
<!-- BEGIN common.build.post.props -->
|
||||
<!--
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.250303.1" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.240111.5" targetFramework="native" />
|
||||
</packages>
|
||||
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<!-- Look at Directory.Build.props in root for common stuff as well -->
|
||||
<Import Project="$(RepoRoot)src\Common.Dotnet.CsWinRT.props" />
|
||||
<Import Project="..\..\Common.Dotnet.CsWinRT.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="$(RepoRoot)src\Common.Dotnet.CsWinRT.props" />
|
||||
<Import Project="$(RepoRoot)src\Common.SelfContained.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Library</OutputType>
|
||||
<TargetFramework>net9.0-windows10.0.26100.0</TargetFramework>
|
||||
<RootNamespace>Microsoft.PowerToys.Common.UI.Controls</RootNamespace>
|
||||
<AssemblyName>PowerToys.Common.UI.Controls</AssemblyName>
|
||||
<UseWinUI>true</UseWinUI>
|
||||
<EnablePreviewMsixTooling>true</EnablePreviewMsixTooling>
|
||||
<GenerateLibraryLayout>true</GenerateLibraryLayout>
|
||||
<ProjectPriFileName>PowerToys.Common.UI.Controls.pri</ProjectPriFileName>
|
||||
<Nullable>enable</Nullable>
|
||||
<Platforms>x64;ARM64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.WindowsAppSDK" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.Controls.Primitives" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.Extensions" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.Converters" />
|
||||
<PackageReference Include="CommunityToolkit.Labs.WinUI.Controls.MarkdownTextBlock" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ManagedCommon\ManagedCommon.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,8 +0,0 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="ms-appx:///PowerToys.Common.UI.Controls/Controls/KeyVisual/KeyVisual.xaml" />
|
||||
<ResourceDictionary Source="ms-appx:///PowerToys.Common.UI.Controls/Controls/KeyVisual/KeyCharPresenter.xaml" />
|
||||
<ResourceDictionary Source="ms-appx:///PowerToys.Common.UI.Controls/Controls/IsEnabledTextBlock/IsEnabledTextBlock.xaml" />
|
||||
<ResourceDictionary Source="ms-appx:///PowerToys.Common.UI.Controls/Controls/ShortcutWithTextLabelControl/ShortcutWithTextLabelControl.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<!-- Look at Directory.Build.props in root for common stuff as well -->
|
||||
<Import Project="$(RepoRoot)src\Common.Dotnet.CsWinRT.props" />
|
||||
<Import Project="$(RepoRoot)src\Common.Dotnet.AotCompatibility.props" />
|
||||
<Import Project="..\..\Common.Dotnet.CsWinRT.props" />
|
||||
<Import Project="..\..\Common.Dotnet.AotCompatibility.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<UseWPF>true</UseWPF>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<ProjectGuid>{CABA8DFB-823B-4BF2-93AC-3F31984150D9}</ProjectGuid>
|
||||
@@ -25,7 +25,7 @@
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<AdditionalIncludeDirectories>$(RepoRoot)src\;..\..\common;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\..\..\;..\..\common;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
@@ -45,13 +45,13 @@
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.250303.1" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.240111.5" targetFramework="native" />
|
||||
</packages>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<!-- Look at Directory.Build.props in root for common stuff as well -->
|
||||
<Import Project="$(RepoRoot)src\Common.Dotnet.CsWinRT.props" />
|
||||
<Import Project="$(RepoRoot)src\Monaco.props" />
|
||||
<Import Project="$(RepoRoot)src\Common.Dotnet.AotCompatibility.props" />
|
||||
<Import Project="..\..\Common.Dotnet.CsWinRT.props" />
|
||||
<Import Project="..\..\Monaco.props" />
|
||||
<Import Project="..\..\Common.Dotnet.AotCompatibility.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<Description>PowerToys FilePreviewCommon</Description>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<Import Project="$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<CppWinRTOptimized>true</CppWinRTOptimized>
|
||||
<CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
|
||||
@@ -17,6 +16,7 @@
|
||||
<ApplicationType>Windows Store</ApplicationType>
|
||||
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
|
||||
@@ -116,13 +116,13 @@
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.250303.1" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.240111.5" targetFramework="native" />
|
||||
</packages>
|
||||
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<!-- Look at Directory.Build.props in root for common stuff as well -->
|
||||
<Import Project="$(RepoRoot)src\Common.Dotnet.CsWinRT.props" />
|
||||
<Import Project="..\..\Common.Dotnet.CsWinRT.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
|
||||
@@ -34,7 +34,8 @@ public sealed class FoundryLocalModelProvider : ILanguageModelProvider
|
||||
}
|
||||
|
||||
// Check if model is in catalog
|
||||
if (!EnsureModelInCatalog(modelId))
|
||||
var isInCatalog = _catalogModels?.Any(m => m.Name == modelId) ?? false;
|
||||
if (!isInCatalog)
|
||||
{
|
||||
var errorMessage = $"{modelId} is not supported in Foundry Local. Please configure supported models in Settings.";
|
||||
Logger.LogError($"[FoundryLocal] {errorMessage}");
|
||||
@@ -42,28 +43,15 @@ public sealed class FoundryLocalModelProvider : ILanguageModelProvider
|
||||
}
|
||||
|
||||
// Ensure the model is loaded before returning chat client
|
||||
var isLoaded = EnsureModelLoadedWithRefresh(modelId);
|
||||
var isLoaded = _foundryClient!.EnsureModelLoaded(modelId).GetAwaiter().GetResult();
|
||||
if (!isLoaded)
|
||||
{
|
||||
Logger.LogError($"[FoundryLocal] Failed to load model: {modelId}");
|
||||
throw new InvalidOperationException($"Failed to load the model '{modelId}'.");
|
||||
}
|
||||
|
||||
var client = _foundryClient;
|
||||
if (client == null)
|
||||
{
|
||||
const string message = "Foundry Local client could not be created. Please make sure Foundry Local is installed and running.";
|
||||
Logger.LogError($"[FoundryLocal] {message}");
|
||||
throw new InvalidOperationException(message);
|
||||
}
|
||||
|
||||
// Use ServiceUri instead of Endpoint since Endpoint already includes /v1
|
||||
var baseUri = client.GetServiceUri();
|
||||
if (baseUri == null && TryRefreshClient("Service URI was not available"))
|
||||
{
|
||||
baseUri = _foundryClient?.GetServiceUri();
|
||||
}
|
||||
|
||||
var baseUri = _foundryClient.GetServiceUri();
|
||||
if (baseUri == null)
|
||||
{
|
||||
const string message = "Foundry Local service URL is not available. Please make sure Foundry Local is installed and running.";
|
||||
@@ -136,7 +124,6 @@ public sealed class FoundryLocalModelProvider : ILanguageModelProvider
|
||||
if (_foundryClient != null && _catalogModels != null && _catalogModels.Any())
|
||||
{
|
||||
await _foundryClient.EnsureRunning().ConfigureAwait(false);
|
||||
_serviceUrl = await _foundryClient.GetServiceUrl().ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -166,75 +153,4 @@ public sealed class FoundryLocalModelProvider : ILanguageModelProvider
|
||||
Logger.LogInfo($"[FoundryLocal] Available: {available}");
|
||||
return available;
|
||||
}
|
||||
|
||||
private bool EnsureModelInCatalog(string modelId)
|
||||
{
|
||||
var isInCatalog = _catalogModels?.Any(m => m.Name == modelId) ?? false;
|
||||
if (isInCatalog)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Logger.LogWarning($"[FoundryLocal] Model not found in catalog. Refreshing client for model: {modelId}");
|
||||
if (!TryRefreshClient("Model not in catalog"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return _catalogModels?.Any(m => m.Name == modelId) ?? false;
|
||||
}
|
||||
|
||||
private bool EnsureModelLoadedWithRefresh(string modelId)
|
||||
{
|
||||
var isLoaded = false;
|
||||
|
||||
try
|
||||
{
|
||||
isLoaded = _foundryClient!.EnsureModelLoaded(modelId).GetAwaiter().GetResult();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogWarning($"[FoundryLocal] EnsureModelLoaded failed: {ex.Message}");
|
||||
}
|
||||
|
||||
if (isLoaded)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!TryRefreshClient("EnsureModelLoaded failed"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return _foundryClient!.EnsureModelLoaded(modelId).GetAwaiter().GetResult();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError($"[FoundryLocal] EnsureModelLoaded failed after refresh: {ex.Message}", ex);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private bool TryRefreshClient(string reason)
|
||||
{
|
||||
Logger.LogInfo($"[FoundryLocal] Refreshing Foundry Local client: {reason}");
|
||||
|
||||
try
|
||||
{
|
||||
_foundryClient = null;
|
||||
_catalogModels = null;
|
||||
_serviceUrl = null;
|
||||
|
||||
InitializeAsync().GetAwaiter().GetResult();
|
||||
return _foundryClient != null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError($"[FoundryLocal] Failed to refresh Foundry Local client: {ex.Message}", ex);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<!-- Look at Directory.Build.props in root for common stuff as well -->
|
||||
<Import Project="$(RepoRoot)src\Common.Dotnet.CsWinRT.props" />
|
||||
<Import Project="..\..\Common.Dotnet.CsWinRT.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<!-- Look at Directory.Build.props in root for common stuff as well -->
|
||||
<Import Project="$(RepoRoot)src\Common.Dotnet.CsWinRT.props" />
|
||||
<Import Project="$(RepoRoot)src\Common.Dotnet.AotCompatibility.props" />
|
||||
<Import Project="..\..\Common.Dotnet.CsWinRT.props" />
|
||||
<Import Project="..\..\Common.Dotnet.AotCompatibility.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<Description>PowerToys ManagedCommon</Description>
|
||||
|
||||
@@ -41,7 +41,6 @@ namespace ManagedCommon
|
||||
/// black. Calls <c>DwmExtendFrameIntoClientArea()</c> with a <c>cyTopHeight</c> of 2 to force
|
||||
/// the window's top border to be visible.<br/><br/>
|
||||
/// Is a no-op on versions other than Windows 10.
|
||||
/// WinUI issue: https://github.com/microsoft/microsoft-ui-xaml/issues/6901
|
||||
/// </summary>
|
||||
public static void ForceTopBorder1PixelInsetOnWindows10(IntPtr handle)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<!-- Look at Directory.Build.props in root for common stuff as well -->
|
||||
<Import Project="$(RepoRoot)src\Common.Dotnet.CsWinRT.props" />
|
||||
<Import Project="..\..\.\Common.Dotnet.CsWinRT.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<Description>PowerToys ManagedCsWin32</Description>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<!-- Look at Directory.Build.props in root for common stuff as well -->
|
||||
<Import Project="$(RepoRoot)src\Common.Dotnet.CsWinRT.props" />
|
||||
<Import Project="..\..\..\Common.Dotnet.CsWinRT.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<Description>PowerToys Telemetry</Description>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<!-- Look at Directory.Build.props in root for common stuff as well -->
|
||||
<Import Project="$(RepoRoot)src\Common.Dotnet.CsWinRT.props" />
|
||||
<Import Project="$(RepoRoot)src\Common.Dotnet.AotCompatibility.props" />
|
||||
<Import Project="..\..\Common.Dotnet.CsWinRT.props" />
|
||||
<Import Project="..\..\Common.Dotnet.AotCompatibility.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<Import Project="$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
@@ -10,6 +9,7 @@
|
||||
<RootNamespace>SettingsAPI</RootNamespace>
|
||||
<ProjectName>SettingsAPI</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\;..\..\;$(RepoRoot)src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\;..\..\;..\..\..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
@@ -52,17 +52,17 @@
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<Import Project="$(RepoRoot)deps\spdlog.props" />
|
||||
<Import Project="..\..\..\deps\spdlog.props" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
<Import Project="$(RepoRoot)packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('$(RepoRoot)packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
<Error Condition="!Exists('$(RepoRoot)packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(RepoRoot)packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.250303.1" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.240111.5" targetFramework="native" />
|
||||
</packages>
|
||||
@@ -1,14 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build"
|
||||
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<Import Project="$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>17.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{8f021b46-362b-485c-bfba-ccf83e820cbd}</ProjectGuid>
|
||||
<RootNamespace>EtwTrace</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
|
||||
@@ -37,15 +37,15 @@
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
<Import Project="$(RepoRoot)packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('$(RepoRoot)packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
|
||||
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
<Import Project="..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
<Error Condition="!Exists('$(RepoRoot)packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(RepoRoot)packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
|
||||
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.250303.1" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.240111.5" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.231216.1" targetFramework="native" />
|
||||
</packages>
|
||||
@@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<Import Project="$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<ProjectGuid>{98537082-0FDB-40DE-ABD8-0DC5A4269BAB}</ProjectGuid>
|
||||
@@ -9,6 +8,7 @@
|
||||
<RootNamespace>Themes</RootNamespace>
|
||||
<ProjectName>Themes</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(RepoRoot)src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\..\..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
@@ -46,13 +46,13 @@
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.250303.1" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.240111.5" targetFramework="native" />
|
||||
</packages>
|
||||
@@ -8,6 +8,7 @@ using System.Runtime.CompilerServices;
|
||||
using System.Xml.Linq;
|
||||
using ABI.Windows.Foundation;
|
||||
using Microsoft.PowerToys.UITest;
|
||||
using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using OpenQA.Selenium;
|
||||
using OpenQA.Selenium.Appium;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<!-- Look at Directory.Build.props in root for common stuff as well -->
|
||||
<Import Project="$(RepoRoot)src\Common.Dotnet.CsWinRT.props" />
|
||||
<Import Project="..\..\Common.Dotnet.CsWinRT.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Library</OutputType>
|
||||
@@ -15,8 +15,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Appium.WebDriver" />
|
||||
<!-- Test libraries/utilities should not use the metapackage. -->
|
||||
<PackageReference Include="MSTest.TestFramework" />
|
||||
<PackageReference Include="MSTest" />
|
||||
<PackageReference Include="System.IO.Abstractions" />
|
||||
<PackageReference Include="System.Text.RegularExpressions" />
|
||||
<PackageReference Include="CoenM.ImageSharp.ImageHash" />
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<Import Project="$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<ProjectGuid>{1A066C63-64B3-45F8-92FE-664E1CCE8077}</ProjectGuid>
|
||||
@@ -10,6 +9,7 @@
|
||||
<ProjectSubType>NativeUnitTestProject</ProjectSubType>
|
||||
<ProjectName>Common.Lib.UnitTests</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
@@ -58,13 +58,13 @@
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.250303.1" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.240111.5" targetFramework="native" />
|
||||
</packages>
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<ProjectGuid>{8B5CFB38-CCBA-40A8-AD7A-89C57B070884}</ProjectGuid>
|
||||
@@ -84,13 +84,13 @@
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.250303.1" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.240111.5" targetFramework="native" />
|
||||
</packages>
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace winrt::PowerToys::Interop::implementation
|
||||
}
|
||||
|
||||
// When all Shortcut keys are pressed, fire the HotkeyCallback event.
|
||||
void HotkeyManager::KeyboardEventProc(KeyboardEvent /*ev*/)
|
||||
void HotkeyManager::KeyboardEventProc(KeyboardEvent ev)
|
||||
{
|
||||
// pressedKeys always stores the latest keyboard state
|
||||
auto pressedKeysHandle = GetHotkeyHandle(pressedKeys);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user