Skip to content

Commit e38141d

Browse files
committed
fix: PreCompact matcher検証警告の到達不能バグを修正
matcher値が不正(typo等)の場合、スキップ条件でcontinueされるため 検証警告が実行されないバグを修正。検証警告をスキップ条件の前に移動。 - executePreCompactHooksJSON: 検証警告とマッチャーチェックの順序を入れ替え - dryRunPreCompactHooks: 検証警告を追加(dryrun時も同じ警告を表示)
1 parent 94ea8e1 commit e38141d

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

hooks.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,11 @@ func dryRunPreCompactHooks(config *Config, input *PreCompactInput, rawJSON inter
398398

399399
executed := false
400400
for i, hook := range config.PreCompact {
401+
// Warn about invalid matcher values (early detection of configuration mistakes)
402+
if hook.Matcher != "" && hook.Matcher != "manual" && hook.Matcher != "auto" {
403+
fmt.Fprintf(os.Stderr, "Warning: PreCompact hook %d has invalid matcher value %q (expected: \"manual\", \"auto\", or empty)\n", i, hook.Matcher)
404+
}
405+
401406
// マッチャーチェック (manual/auto)
402407
if hook.Matcher != "" && hook.Matcher != input.Trigger {
403408
continue
@@ -1122,16 +1127,16 @@ func executePreCompactHooksJSON(config *Config, input *PreCompactInput, rawJSON
11221127
var systemMessageBuilder strings.Builder
11231128

11241129
for i, hook := range config.PreCompact {
1125-
// マッチャーチェック (manual/auto)
1126-
if hook.Matcher != "" && hook.Matcher != input.Trigger {
1127-
continue
1128-
}
1129-
11301130
// Warn about invalid matcher values (early detection of configuration mistakes)
11311131
if hook.Matcher != "" && hook.Matcher != "manual" && hook.Matcher != "auto" {
11321132
fmt.Fprintf(os.Stderr, "Warning: PreCompact hook %d has invalid matcher value %q (expected: \"manual\", \"auto\", or empty)\n", i, hook.Matcher)
11331133
}
11341134

1135+
// マッチャーチェック (manual/auto)
1136+
if hook.Matcher != "" && hook.Matcher != input.Trigger {
1137+
continue
1138+
}
1139+
11351140
// 条件チェック
11361141
shouldExecute := true
11371142
for _, condition := range hook.Conditions {

0 commit comments

Comments
 (0)