包含: - furniture-3d-system:Next.js 16 全栈应用(资产中心、产品管理、3D装配动画) - autocad-plugin:AutoCAD 家具导出插件源码 - 资产中心改造:编辑弹窗化、删除功能、Toast反馈、自定义Select组件 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
82 lines
2.2 KiB
PowerShell
82 lines
2.2 KiB
PowerShell
param(
|
|
[Parameter(Mandatory = $true)]
|
|
[string]$RunPath,
|
|
[Parameter(Mandatory = $true)]
|
|
[string]$RoleId,
|
|
[Parameter(Mandatory = $true)]
|
|
[ValidateSet("pending", "in_progress", "done", "blocked", "rejected")]
|
|
[string]$Status,
|
|
[string]$Note
|
|
)
|
|
|
|
Set-StrictMode -Version Latest
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
if (-not (Test-Path -LiteralPath $RunPath)) {
|
|
throw "Run path not found: $RunPath"
|
|
}
|
|
|
|
$manifestPath = Join-Path $RunPath "manifest.json"
|
|
if (-not (Test-Path -LiteralPath $manifestPath)) {
|
|
throw "manifest.json not found: $manifestPath"
|
|
}
|
|
|
|
$manifestRaw = Get-Content -LiteralPath $manifestPath -Raw
|
|
$manifest = $manifestRaw | ConvertFrom-Json
|
|
$role = $manifest.roles | Where-Object { $_.id -eq $RoleId } | Select-Object -First 1
|
|
if (-not $role) {
|
|
throw "Role not found: $RoleId"
|
|
}
|
|
|
|
$reportPath = Join-Path $RunPath (($role.reportPath -replace "/", "\"))
|
|
if (-not (Test-Path -LiteralPath $reportPath)) {
|
|
throw "Role report not found: $reportPath"
|
|
}
|
|
|
|
$reportLines = Get-Content -LiteralPath $reportPath
|
|
$now = (Get-Date).ToString("s")
|
|
$statusLineIndex = -1
|
|
$updatedLineIndex = -1
|
|
|
|
for ($index = 0; $index -lt $reportLines.Count; $index++) {
|
|
if ($reportLines[$index] -like "- Status:*") {
|
|
$statusLineIndex = $index
|
|
}
|
|
if ($reportLines[$index] -like "- Updated At:*") {
|
|
$updatedLineIndex = $index
|
|
}
|
|
}
|
|
|
|
if ($statusLineIndex -ge 0) {
|
|
$reportLines[$statusLineIndex] = "- Status: $Status"
|
|
} else {
|
|
$reportLines = @("- Status: $Status") + $reportLines
|
|
}
|
|
|
|
if ($updatedLineIndex -ge 0) {
|
|
$reportLines[$updatedLineIndex] = "- Updated At: $now"
|
|
} else {
|
|
$reportLines = @("- Updated At: $now") + $reportLines
|
|
}
|
|
|
|
if (-not [string]::IsNullOrWhiteSpace($Note)) {
|
|
$reportLines += ""
|
|
$reportLines += "## Progress Log ($now)"
|
|
$reportLines += ""
|
|
$reportLines += "- $Note"
|
|
}
|
|
|
|
Set-Content -LiteralPath $reportPath -Value $reportLines -Encoding UTF8
|
|
|
|
foreach ($manifestRole in $manifest.roles) {
|
|
if ($manifestRole.id -eq $RoleId) {
|
|
$manifestRole.status = $Status
|
|
}
|
|
}
|
|
$manifest.updatedAt = $now
|
|
|
|
$manifest | ConvertTo-Json -Depth 8 | Set-Content -LiteralPath $manifestPath -Encoding UTF8
|
|
|
|
Write-Host "Role status updated: $RoleId -> $Status"
|
|
Write-Host "Report file: $reportPath"
|