Initial commit: Flutter 无书应用项目
This commit is contained in:
35
.trae/skills/planning-with-files/.github/hooks/scripts/error-occurred.ps1
vendored
Normal file
35
.trae/skills/planning-with-files/.github/hooks/scripts/error-occurred.ps1
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
# planning-with-files: Error hook for GitHub Copilot (Windows PowerShell)
|
||||
# Logs errors to task_plan.md when the agent encounters an error.
|
||||
|
||||
$planFile = "task_plan.md"
|
||||
|
||||
if (-not (Test-Path $planFile)) {
|
||||
Write-Output '{}'
|
||||
exit 0
|
||||
}
|
||||
|
||||
# Read stdin
|
||||
$input = [Console]::In.ReadToEnd()
|
||||
|
||||
try {
|
||||
$data = $input | ConvertFrom-Json
|
||||
$errorMsg = ""
|
||||
if ($data.error -is [PSCustomObject]) {
|
||||
$errorMsg = $data.error.message
|
||||
} elseif ($data.error) {
|
||||
$errorMsg = [string]$data.error
|
||||
}
|
||||
|
||||
if ($errorMsg) {
|
||||
$truncated = $errorMsg.Substring(0, [Math]::Min(200, $errorMsg.Length))
|
||||
$context = "[planning-with-files] Error detected: $truncated. Log this error in task_plan.md under Errors Encountered with the attempt number and resolution."
|
||||
$escaped = $context | ConvertTo-Json
|
||||
Write-Output "{`"hookSpecificOutput`":{`"hookEventName`":`"ErrorOccurred`",`"additionalContext`":$escaped}}"
|
||||
} else {
|
||||
Write-Output '{}'
|
||||
}
|
||||
} catch {
|
||||
Write-Output '{}'
|
||||
}
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user