mirror of
https://github.com/vczh-libraries/Release.git
synced 2026-08-17 17:31:44 +08:00
Sync Copilot context files
This commit is contained in:
@@ -28,7 +28,7 @@ if ($vsdevcmd -eq $null) {
|
||||
throw "$MESSAGE_1\r\n$MESSAGE_2"
|
||||
}
|
||||
|
||||
# Execute msbuild with output to both console and log file
|
||||
# Execute MSBuild with output to both console and log file
|
||||
$msbuild_arguments = "MSBUILD `"$solutionFile`" /m:8 $rebuildControl /p:Configuration=`"$Configuration`";Platform=`"$Platform`""
|
||||
$cmd_arguments = "`"`"$vsdevcmd`" & $msbuild_arguments"
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ if ([string]::IsNullOrEmpty($Executable)) {
|
||||
|
||||
. $PSScriptRoot\copilotShared.ps1
|
||||
|
||||
# Ensure the executable name has .exe extension
|
||||
# Ensure the executable name does not have the .exe extension
|
||||
if ($Executable.EndsWith(".exe")) {
|
||||
throw "\$Executable parameter should not include the .exe extension: $Executable"
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ if ($Mode -eq "UnitTest") {
|
||||
Remove-Item -Path $logFile, $logFileUnfinished -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Ensure the executable name has .exe extension
|
||||
# Ensure the executable name does not have the .exe extension
|
||||
if ($Executable.EndsWith(".exe")) {
|
||||
throw "\$Executable parameter should not include the .exe extension: $Executable"
|
||||
}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
Push-Location $PSScriptRoot\..\..
|
||||
git add .
|
||||
git status
|
||||
git commit -am "[BOT] Backup."
|
||||
Pop-Location
|
||||
@@ -1,106 +0,0 @@
|
||||
# Prepare Copilot workspace files
|
||||
|
||||
param(
|
||||
[switch]$Backup,
|
||||
[switch]$Earliest
|
||||
)
|
||||
|
||||
if (@($Backup, $Earliest).Where({ $_ }).Count -gt 1) {
|
||||
throw "At most one switch can be true: -Backup, -Earliest."
|
||||
}
|
||||
|
||||
if ($Earliest) {
|
||||
$learningRoot = Resolve-Path -LiteralPath "$PSScriptRoot\..\Learning"
|
||||
$earliestFolder = Get-ChildItem -LiteralPath $learningRoot -Directory |
|
||||
Sort-Object -Property Name |
|
||||
Select-Object -First 1
|
||||
|
||||
if ($null -eq $earliestFolder) {
|
||||
throw "No folder is found in '$learningRoot'."
|
||||
}
|
||||
|
||||
Write-Output $earliestFolder.FullName
|
||||
exit 0
|
||||
}
|
||||
|
||||
# Create or override the markdown files with the specified content
|
||||
$filesToOverride = @{
|
||||
"Copilot_Planning.md" = "# !!!PLANNING!!!"
|
||||
"Copilot_Execution.md" = "# !!!EXECUTION!!!"
|
||||
"Copilot_Task.md" = "# !!!TASK!!!"
|
||||
}
|
||||
|
||||
# Create or override the markdown files with the specified content
|
||||
$filesToCreate = @{
|
||||
"Copilot_Scrum.md" = "# !!!SCRUM!!!"
|
||||
"Copilot_KB.md" = "# !!!KNOWLEDGE BASE!!!"
|
||||
}
|
||||
|
||||
# Backup each markdown file for learning
|
||||
$filesToBackup = @()
|
||||
foreach ($file in $filesToOverride.GetEnumerator()) {
|
||||
$filePath = "$PSScriptRoot\..\TaskLogs\$($file.Key)"
|
||||
if (Test-Path $filePath) {
|
||||
$filesToBackup += $filePath
|
||||
}
|
||||
}
|
||||
{
|
||||
$filePath = "$PSScriptRoot\..\TaskLogs\Copilot_Execution_Finding.md"
|
||||
if (Test-Path $filePath) {
|
||||
$filesToBackup += $filePath
|
||||
}
|
||||
}
|
||||
|
||||
if ($filesToBackup.Count -gt 0) {
|
||||
$timestamp = Get-Date -Format "yyyy-MM-dd-HH-mm-ss"
|
||||
$backupFolder = "$PSScriptRoot\..\Learning\$timestamp"
|
||||
|
||||
Write-Host "Creating backup folder: $backupFolder"
|
||||
New-Item -ItemType Directory -Path $backupFolder -Force | Out-Null
|
||||
|
||||
foreach ($filePath in $filesToBackup) {
|
||||
$fileName = Split-Path $filePath -Leaf
|
||||
$destinationPath = Join-Path $backupFolder $fileName
|
||||
Write-Host "Backing up $fileName to Learning folder..."
|
||||
Copy-Item -Path $filePath -Destination $destinationPath -Force
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
$filePath = "$PSScriptRoot\..\TaskLogs\Copilot_Execution_Finding.md"
|
||||
if (Test-Path $filePath) {
|
||||
Write-Host "Deleting Copilot_Execution_Finding.md..."
|
||||
Remove-Item -Path $filePath -Force
|
||||
}
|
||||
}
|
||||
|
||||
if ($Backup) {
|
||||
# Delete all files in $filesToOverride
|
||||
foreach ($file in $filesToOverride.GetEnumerator()) {
|
||||
$filePath = "$PSScriptRoot\..\TaskLogs\$($file.Key)"
|
||||
if (Test-Path $filePath) {
|
||||
Write-Host "Deleting $($file.Key)..."
|
||||
Remove-Item -Path $filePath -Force
|
||||
}
|
||||
}
|
||||
} else {
|
||||
# Create each markdown file with the specified content
|
||||
foreach ($file in $filesToOverride.GetEnumerator()) {
|
||||
$filePath = "$PSScriptRoot\..\TaskLogs\$($file.Key)"
|
||||
Write-Host "Creating/overriding $($file.Key)..."
|
||||
$file.Value | Out-File -FilePath $filePath -Encoding UTF8
|
||||
}
|
||||
|
||||
# Create files only if they don't exist
|
||||
foreach ($file in $filesToCreate.GetEnumerator()) {
|
||||
$filePath = "$PSScriptRoot\..\TaskLogs\$($file.Key)"
|
||||
if (-not (Test-Path $filePath)) {
|
||||
Write-Host "Creating $($file.Key)..."
|
||||
$file.Value | Out-File -FilePath $filePath -Encoding UTF8
|
||||
} else {
|
||||
Write-Host "Skipping $($file.Key) (already exists)..."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "Copilot preparation completed."
|
||||
@@ -1,12 +0,0 @@
|
||||
# Prepare Copilot review files
|
||||
|
||||
$taskLogsDir = "$PSScriptRoot\..\TaskLogs"
|
||||
|
||||
# Delete all Copilot_Review_Finished_*.md files
|
||||
Remove-Item -Path "$taskLogsDir\Copilot_Review_Finished_*.md" -Force -ErrorAction SilentlyContinue
|
||||
|
||||
# Rename all Copilot_Review_Writing_*.md files to Copilot_Review_Finished_*.md
|
||||
Get-ChildItem -Path "$taskLogsDir\Copilot_Review_Writing_*.md" -ErrorAction SilentlyContinue | ForEach-Object {
|
||||
$newName = $_.Name -replace '^Copilot_Review_Writing_', 'Copilot_Review_Finished_'
|
||||
Rename-Item -Path $_.FullName -NewName $newName
|
||||
}
|
||||
@@ -45,9 +45,10 @@ function GetExecutableMap($solutionFolder, $executableName) {
|
||||
function GetSpecifiedExecutable($solutionFolder, $executableName, $configuration, $platform) {
|
||||
# Define configuration to path mappings
|
||||
$configToPathMap = GetExecutableMap $solutionFolder $executableName
|
||||
$config = "$configuration|$platform"
|
||||
|
||||
# Find existing files and get their modification times with configuration info
|
||||
$path = $configToPathMap["$configuration|$platform"];
|
||||
$path = $configToPathMap[$config];
|
||||
|
||||
if (Test-Path $path) {
|
||||
$fileInfo = Get-Item $path
|
||||
@@ -57,7 +58,7 @@ function GetSpecifiedExecutable($solutionFolder, $executableName, $configuration
|
||||
LastWriteTime = $fileInfo.LastWriteTime
|
||||
}
|
||||
} else {
|
||||
throw "No $executableName for $configuration|$platform does not exist, please make sure the build was successful."
|
||||
throw "$executableName for $configuration|$platform does not exist, please make sure the build was successful."
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +111,7 @@ function GetDebugArgs($solutionFolder, $latestFile, $executable) {
|
||||
Write-Host "Warning: Could not read debug arguments from $userProjectFile"
|
||||
}
|
||||
} else {
|
||||
Write-Host "Failed to find $userProjectFile"
|
||||
Write-Host "Failed to find $userProjectFile"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user