claude init inited
This commit is contained in:
24
.claude/hooks/session-init.ps1
Normal file
24
.claude/hooks/session-init.ps1
Normal file
@@ -0,0 +1,24 @@
|
||||
# session-init.ps1 — Claude Code SessionStart hook
|
||||
# 1. 清除上次会话的 changelog ack 标记
|
||||
# 2. 检查 .claude/.init-done sentinel,缺失时创建 .pending-init 标记文件
|
||||
# claude-init-recall 规则会检测此文件,确保首次会话确定性触发 claude-init
|
||||
|
||||
$input = [Console]::In.ReadToEnd()
|
||||
|
||||
# 清除 changelog ack 标记
|
||||
Remove-Item ".claude\changelog\.changelog-ack" -ErrorAction SilentlyContinue
|
||||
|
||||
# 检查 claude-init sentinel
|
||||
$initDone = ".claude\.init-done"
|
||||
$pendingInit = ".claude\.pending-init"
|
||||
|
||||
if (Test-Path $initDone) {
|
||||
# sentinel 存在,清理可能残留的 pending 标记
|
||||
Remove-Item $pendingInit -ErrorAction SilentlyContinue
|
||||
} else {
|
||||
# sentinel 缺失,创建 pending 标记供 claude-init-recall 规则检测
|
||||
New-Item -ItemType File -Path $pendingInit -Force | Out-Null
|
||||
}
|
||||
|
||||
Write-Output '{}'
|
||||
exit 0
|
||||
Reference in New Issue
Block a user