Skip to content

Commit bae02a5

Browse files
committed
fix(kiro): hook 文件后缀改为 .kiro.hook,让 Kiro UI 能识别
1 parent 7dbee36 commit bae02a5

4 files changed

Lines changed: 25 additions & 12 deletions

File tree

hooks/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
.codesee/
99
hooks/
1010
claude-code/settings.json # Claude Code 的 hook 配置示例
11-
kiro/sync-on-stop.json # Kiro 的 hook 文件
11+
kiro/sync-on-stop.kiro.hook # Kiro 的 hook 文件(后缀就是 .kiro.hook)
1212
README.md # 本文档
1313
scripts/
1414
check-staleness.mjs # 共用检查脚本(hook 触发的就是这个)
@@ -98,7 +98,9 @@
9898

9999
### Kiro
100100

101-
直接把 `kiro/sync-on-stop.json` 拷到 `.kiro/hooks/sync-on-stop.json` 即可。Kiro 会自动加载新 hook,不用重启。
101+
直接把 `kiro/sync-on-stop.kiro.hook` 拷到 `.kiro/hooks/sync-on-stop.kiro.hook` 即可。Kiro 会自动加载新 hook,不用重启。
102+
103+
> **后缀必须是 `.kiro.hook`**——这是 Kiro IDE 识别 hook 文件的扩展名约定。普通 `.json` 文件会被忽略,UI 也看不到。
102104
103105
事件类型 `agentStop` = Claude Code 的 Stop。
104106

@@ -127,4 +129,4 @@ node .codesee/scripts/check-staleness.mjs --verbose
127129

128130
## 关掉
129131

130-
删掉对应的 `.claude/settings.json` 中的 hook 段,或删掉 `.kiro/hooks/sync-on-stop.json` 即可。脚本本身保留无副作用。
132+
删掉对应的 `.claude/settings.json` 中的 hook 段,或删掉 `.kiro/hooks/sync-on-stop.kiro.hook` 即可。脚本本身保留无副作用。

scripts/install.ps1

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
-EnableClaudeCode Merge a Stop hook into <target>/.claude/settings.json.
1515
Existing user entries are preserved; our entry is tagged
1616
with "_codesee" so reruns stay idempotent.
17-
-EnableKiro Drop a hook file into <target>/.kiro/hooks/codesee-sync-on-stop.json.
17+
-EnableKiro Drop a hook file into <target>/.kiro/hooks/codesee-sync-on-stop.kiro.hook.
1818
-AutoDetect Equivalent to -EnableClaudeCode / -EnableKiro driven by
1919
which directories exist in the target.
2020
-ForceHooks Replace our existing hook entry even if the user changed it.
2121
-UninstallHooks Remove every entry tagged with _codesee and any
22-
.kiro/hooks/codesee-*.json. Templates stay.
22+
.kiro/hooks/codesee-*.kiro.hook. Templates stay.
2323
2424
.EXAMPLE
2525
./scripts/install.ps1 D:\path\to\project
@@ -217,10 +217,15 @@ if ($UninstallHooks) {
217217
}
218218
$kiroDir = Join-Path $TargetDir '.kiro/hooks'
219219
if (Test-Path $kiroDir) {
220-
Get-ChildItem $kiroDir -Filter 'codesee-*.json' -ErrorAction SilentlyContinue | ForEach-Object {
220+
Get-ChildItem $kiroDir -Filter 'codesee-*.kiro.hook' -ErrorAction SilentlyContinue | ForEach-Object {
221221
Remove-Item $_.FullName -Force
222222
Write-Host (" - removed " + $_.FullName)
223223
}
224+
# Also clean up legacy .json named hooks from earlier install versions
225+
Get-ChildItem $kiroDir -Filter 'codesee-*.json' -ErrorAction SilentlyContinue | ForEach-Object {
226+
Remove-Item $_.FullName -Force
227+
Write-Host (" - removed " + $_.FullName + " (legacy)")
228+
}
224229
}
225230
} elseif ($wantClaudeCode -or $wantKiro) {
226231
Write-Host ''
@@ -239,9 +244,9 @@ if ($UninstallHooks) {
239244
if ($wantKiro) {
240245
$kiroDst = Join-Path $TargetDir '.kiro/hooks'
241246
New-Item -ItemType Directory -Force -Path $kiroDst | Out-Null
242-
$kiroSrc = Join-Path $Self 'hooks/kiro/sync-on-stop.json'
247+
$kiroSrc = Join-Path $Self 'hooks/kiro/sync-on-stop.kiro.hook'
243248
if (Test-Path $kiroSrc) {
244-
$kiroOut = Join-Path $kiroDst 'codesee-sync-on-stop.json'
249+
$kiroOut = Join-Path $kiroDst 'codesee-sync-on-stop.kiro.hook'
245250
Copy-Item -Force $kiroSrc $kiroOut
246251
Write-Host " - wrote $kiroOut"
247252
}

scripts/install.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,17 @@ if [[ -n "$UNINSTALL_HOOKS" ]]; then
190190
node "$merge_script" --target "$TARGET" --template "$cc_template" --remove || true
191191
fi
192192
if [[ -d "$TARGET/.kiro/hooks" ]]; then
193-
for f in "$TARGET/.kiro/hooks"/codesee-*.json; do
193+
for f in "$TARGET/.kiro/hooks"/codesee-*.kiro.hook; do
194194
[[ -f "$f" ]] || continue
195195
rm -f "$f"
196196
echo " - removed $f"
197197
done
198+
# Also clean up legacy .json named hooks from earlier install versions
199+
for f in "$TARGET/.kiro/hooks"/codesee-*.json; do
200+
[[ -f "$f" ]] || continue
201+
rm -f "$f"
202+
echo " - removed $f (legacy)"
203+
done
198204
fi
199205
elif [[ -n "$want_cc" || -n "$want_kiro" ]]; then
200206
echo ''
@@ -210,9 +216,9 @@ elif [[ -n "$want_cc" || -n "$want_kiro" ]]; then
210216
fi
211217
if [[ -n "$want_kiro" ]]; then
212218
mkdir -p "$TARGET/.kiro/hooks"
213-
if [[ -f "$SELF_DIR/hooks/kiro/sync-on-stop.json" ]]; then
214-
cp -f "$SELF_DIR/hooks/kiro/sync-on-stop.json" "$TARGET/.kiro/hooks/codesee-sync-on-stop.json"
215-
echo " - wrote $TARGET/.kiro/hooks/codesee-sync-on-stop.json"
219+
if [[ -f "$SELF_DIR/hooks/kiro/sync-on-stop.kiro.hook" ]]; then
220+
cp -f "$SELF_DIR/hooks/kiro/sync-on-stop.kiro.hook" "$TARGET/.kiro/hooks/codesee-sync-on-stop.kiro.hook"
221+
echo " - wrote $TARGET/.kiro/hooks/codesee-sync-on-stop.kiro.hook"
216222
fi
217223
fi
218224
fi

0 commit comments

Comments
 (0)