feat: Claude Runtime Status Module + Preset Status Parity - #133
Merged
Conversation
Extract true status-string builders into claude-runtime-status.ts and add
readClaudeHookPresetStatus() for Codex/Claude adapter parity.
Changes:
- Create src/adapters/claude-runtime-status.ts with:
- CLAUDE_ADDITIONAL_CONTEXT_MAX_CHARS constant
- clampAdditionalContext() - 9000-char cap utility
- sessionStartContext() - SessionStart context string
- boundedFallbackContext() - fallback guidance string
- Refactor src/adapters/claude-runtime-hook.ts:
- Import status utilities from new module
- Re-export CLAUDE_ADDITIONAL_CONTEXT_MAX_CHARS for test compatibility
- Keep buildPayloadContext() in place (payload assembly)
- Add readClaudeHookPresetStatus() to src/adapters/claude-hook-preset.ts:
- Returns ClaudeHookPresetStatus with installedEvents, missingEvents,
unexpectedFooksEvents, disabledByLocalSettings
- Graceful error handling with valid:false + blocker on parse failure
- Refactor src/adapters/claude-status.ts:
- hookStatus() delegates to readClaudeHookPresetStatus()
- Keep manifest/adapter JSON checks as enrichment layer
- Remove ~60 lines of duplicated preset-reading logic
Zero behavior change - pure refactoring with honest module boundaries.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
minislively
added a commit
that referenced
this pull request
May 14, 2026
Extract true status-string builders into claude-runtime-status.ts and add
readClaudeHookPresetStatus() for Codex/Claude adapter parity.
Changes:
- Create src/adapters/claude-runtime-status.ts with:
- CLAUDE_ADDITIONAL_CONTEXT_MAX_CHARS constant
- clampAdditionalContext() - 9000-char cap utility
- sessionStartContext() - SessionStart context string
- boundedFallbackContext() - fallback guidance string
- Refactor src/adapters/claude-runtime-hook.ts:
- Import status utilities from new module
- Re-export CLAUDE_ADDITIONAL_CONTEXT_MAX_CHARS for test compatibility
- Keep buildPayloadContext() in place (payload assembly)
- Add readClaudeHookPresetStatus() to src/adapters/claude-hook-preset.ts:
- Returns ClaudeHookPresetStatus with installedEvents, missingEvents,
unexpectedFooksEvents, disabledByLocalSettings
- Graceful error handling with valid:false + blocker on parse failure
- Refactor src/adapters/claude-status.ts:
- hookStatus() delegates to readClaudeHookPresetStatus()
- Keep manifest/adapter JSON checks as enrichment layer
- Remove ~60 lines of duplicated preset-reading logic
Zero behavior change - pure refactoring with honest module boundaries.
Co-authored-by: minislively <minislively@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
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.
Summary
Extract true status-string builders into
claude-runtime-status.tsand addreadClaudeHookPresetStatus()to achieve structural parity with the Codex adapter.Changes
Create
src/adapters/claude-runtime-status.tsCLAUDE_ADDITIONAL_CONTEXT_MAX_CHARSconstant (moved from hook file)clampAdditionalContext()— 9000-char cap utilitysessionStartContext()— SessionStart context stringboundedFallbackContext()— fallback guidance stringRefactor
src/adapters/claude-runtime-hook.ts./claude-runtime-statusCLAUDE_ADDITIONAL_CONTEXT_MAX_CHARSfor backward-compatible test importsbuildPayloadContext()in place (payload assembly stays in hook file)Add
readClaudeHookPresetStatus()tosrc/adapters/claude-hook-preset.tsClaudeHookPresetStatuswithinstalledEvents,missingEvents,unexpectedFooksEvents,disabledByLocalSettingsvalid: false+blockeron parse failurehookCommandsForEventhelper into preset moduleRefactor
src/adapters/claude-status.tshookStatus()delegates core preset validation toreadClaudeHookPresetStatus()Principles
*-runtime-status.tsmirrors Codex: simple string builders onlyClaudeRuntimeHookDecisionand exports remain stablereadClaudeHookPresetStatus()becomes source of truthVerification
npm run buildpasses with zero TypeScript errorsnpm testpasses (209 tests, 0 failures)Test plan