Initial commit: Flutter 无书应用项目
This commit is contained in:
33
.trae/skills/planning-with-files/.github/hooks/scripts/pre-tool-use.ps1
vendored
Normal file
33
.trae/skills/planning-with-files/.github/hooks/scripts/pre-tool-use.ps1
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
# planning-with-files: Pre-tool-use hook for GitHub Copilot (PowerShell)
|
||||
# Reads the first 30 lines of task_plan.md to keep goals in context.
|
||||
# Always allows tool execution — this hook never blocks tools.
|
||||
# Always exits 0 — outputs JSON to stdout.
|
||||
|
||||
# Read stdin (required — Copilot pipes JSON to stdin)
|
||||
$OutputEncoding = [System.Text.UTF8Encoding]::new($false)
|
||||
[Console]::OutputEncoding = [System.Text.UTF8Encoding]::new($false)
|
||||
$InputData = [Console]::In.ReadToEnd()
|
||||
|
||||
$PlanFile = "task_plan.md"
|
||||
|
||||
if (-not (Test-Path $PlanFile)) {
|
||||
Write-Output '{}'
|
||||
exit 0
|
||||
}
|
||||
|
||||
$Context = (Get-Content $PlanFile -TotalCount 30 -Encoding UTF8 -ErrorAction SilentlyContinue) -join "`n"
|
||||
|
||||
if (-not $Context) {
|
||||
Write-Output '{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"allow"}}'
|
||||
exit 0
|
||||
}
|
||||
|
||||
$output = @{
|
||||
hookSpecificOutput = @{
|
||||
hookEventName = "PreToolUse"
|
||||
permissionDecision = "allow"
|
||||
additionalContext = $Context
|
||||
}
|
||||
}
|
||||
$output | ConvertTo-Json -Depth 3 -Compress
|
||||
exit 0
|
||||
Reference in New Issue
Block a user