Conversation
SessionEndフックのJSON出力構造体とテストを追加。 Common JSON Fieldsのみで、hookSpecificOutput/decision/reasonは存在しない。 continueは常にtrueとする(fail-safe設計、セッション終了はブロック不可)。
SessionEndフックのJSON出力バリデーション関数とテストを追加。 JSON Schema検証のみで、セマンティック検証は不要(全フィールドOptional)。 schema.Required=nil、schema.AdditionalProperties=nilで追加フィールドを許容。
ExecuteSessionEndActionの戻り値を(*ActionOutput, error)に変更。 SessionEndOutput構造体をパースし、fail-safe設計(continue常にtrue)を実装。 checkUnsupportedFieldsSessionEnd関数を追加(decision/reason/hookSpecificOutputは非対応)。 旧方式のテストを削除し、新しいJSON対応テストを追加。
RunSessionEndHooks、executeSessionEndHooksJSON関数を追加。 SessionEndOutput返却、fail-safe設計(continue常にtrue)。 フィールドマージ: systemMessage改行連結、stopReason/suppressOutput後勝ち。 旧executeSessionEndHooks関数とrunHooksのSessionEndケースを削除。 旧テストを削除し、新しいJSON対応テスト(TestExecuteSessionEndHooksJSON)を追加。
SessionEnd専用のJSON出力ハンドリングブロックをmain.goに追加。 RunSessionEndHooks呼び出し、fail-safe設計(continue常にtrue)。 エラー時もsystemMessageにエラー情報を格納してJSON出力。 validateSessionEndOutputによる検証、常にexit 0で終了。
CLAUDE.mdにSessionEnd JSON Outputセクションを追加。 README.mdでSessionEndをJSON Output Eventsに移動、Legacy Exit Code Eventsから削除。 Common JSON Fieldsのみ使用、decision/reason/hookSpecificOutputなし。 cleanup専用フック、セッション終了をブロック不可、常にexit 0。
syou6162
added a commit
that referenced
this pull request
Feb 10, 2026
notification_jsonブランチとmainブランチ間のコンフリクトを解決し、 SessionEnd JSON出力対応(PR #63)を統合。 変更内容: - CLAUDE.md: SessionEnd JSON Outputセクションを追加 - types.go: SessionEndOutput構造体を追加 - executor.go: ExecuteSessionEndActionをJSON対応に変更 - 戻り値を(*ActionOutput, error)に変更 - checkUnsupportedFieldsSessionEnd関数を追加 - hooks.go: executeSessionEndHooksJSONとRunSessionEndHooks関数を追加 - runHooksでの呼び出しを更新 - hooks_test.go: 関数呼び出しをJSON対応版に更新 - actions_test.go: 古いSessionEndテストを削除(JSON対応版はexecutor_test.goにある) - main.go: SessionEnd JSON出力ハンドリングブロックを追加 - utils.go: validateSessionEndOutput関数を追加 これにより、Notification JSON出力とSessionEnd JSON出力の両方が コンフリクトなく共存できるようになった。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
SessionEndフックの出力形式を旧Exit Codeベースの方式からJSON出力形式に移行する。SessionEndはセッション終了時のクリーンアップ専用フックであり、Common JSON Fieldsのみのシンプルなスキーマで実装。
背景
cchookの各イベントタイプは段階的にJSON出力形式への移行を進めてきた。SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PermissionRequest, Stop, SubagentStopは既にJSON出力対応が完了しており、SessionEndは残りの未対応イベントの1つ。
SessionEndはセッション終了をブロックできないため、decision/reasonフィールドやhookSpecificOutputは存在せず、Common JSON Fields(continue, stopReason, suppressOutput, systemMessage)のみの最もシンプルなスキーマとなる。
変更内容
types.go: SessionEndOutput構造体を定義(Common JSON Fieldsのみ)utils.go: validateSessionEndOutput関数を実装(JSON Schema検証のみ、セマンティック検証は不要)executor.go: ExecuteSessionEndActionの戻り値を(*ActionOutput, error)に変更、checkUnsupportedFieldsSessionEnd追加hooks.go: RunSessionEndHooks / executeSessionEndHooksJSON関数を実装、旧executeSessionEndHooksを削除、runHooksからSessionEndケースを削除main.go: SessionEnd専用のJSON出力ハンドリングブロックを追加CLAUDE.md: SessionEnd JSON Outputセクションを追加README.md: SessionEndをJSON Output Eventsに移動、Legacy Exit Code Eventsから削除設計のポイント
関連情報