24 lines
679 B
PowerShell
24 lines
679 B
PowerShell
# session-init.ps1 — 会话启动时检测 composer_mode,非 agent 模式设置跳过标志
|
||
#
|
||
# sessionStart input 包含 composer_mode 字段("agent" / "ask" / "edit" / "debug" 等)
|
||
# 通过 env 输出的环境变量会传递给同会话内所有后续 hook
|
||
|
||
$input = [Console]::In.ReadToEnd()
|
||
|
||
try {
|
||
$data = $input | ConvertFrom-Json
|
||
$mode = $data.composer_mode
|
||
} catch {
|
||
$mode = $null
|
||
}
|
||
|
||
Remove-Item ".cursor\changelog\.changelog-ack" -ErrorAction SilentlyContinue
|
||
|
||
if ($mode -and $mode -ne "agent") {
|
||
$json = '{"env":{"CURSOR_SKIP_CHANGELOG":"1","CURSOR_COMPOSER_MODE":"' + $mode + '"}}'
|
||
Write-Output $json
|
||
} else {
|
||
Write-Output '{}'
|
||
}
|
||
exit 0
|