Repository navigation
Conversation
Remove card styling (background, border, padding) and palette abstraction. Add collapsible Project/Global sections with collapse-by-default behavior, bold 'Rules' header, and arrow toggle indicators matching MCP/LSP sections.
Filesystem-based IPC for TUI sidebar to know which rules are active. Provides atomic writes with per-session serialization and fire-and-forget API.
- Validate sessionId against /^[A-Za-z0-9_-]+$/ to prevent path traversal - Add proper type guard for ActiveRulesState with full type checks - Reject invalid sessionIds early with debug logging
- Change readAndFormatRules() return from string to FilterResult object - Add matchedPaths array tracking which rule files were included - Update runtime.ts to call writeActiveRulesState before early return - Re-export FilterResult from utils.ts - Update all test call sites to destructure new return type - Add tests verifying matchedPaths behavior
…fect - Test that matching rules populate matchedRulePaths in state file - Test that no-match case writes empty matchedPaths array - Test that missing sessionID skips state write - Use _setStateDirForTesting for test isolation
Use readdirSync to assert state directory has no .json files instead of only checking readActiveRulesState for a specific key.
- Add isActive (boolean | null) to SidebarRuleEntry for UI state display - Add hasEvaluationState to LoadSidebarRulesResult - Update loadSidebarRules() with optional sessionId parameter to read state - Extend TuiPluginApi type shim with TuiEventBus interface and event property - Add comprehensive tests for isActive behavior with/without state file
- Subscribe to message.updated and session.status events via TuiEventBus - Debounce 150ms before re-reading rules on events - Verify sessionId/projectDir match before committing async results - Separate initial-load effect (resets UI state) from refresh effect - Add hasEvaluationState prop to RuleSection for header count format - Green bullet for isActive === true, grey for false/null - Header count shows (active/total) when hasEvaluationState, else (total) - Unsubscribe from events on cleanup via onCleanup
Check event payload for sessionId property at receipt time. If the event has a sessionId that doesn't match the current session, skip it immediately rather than waiting for the post-load staleness check.
- Add monotonic requestId counter to detect out-of-order async completions
- Call setStatus('loaded') in loadRulesRefresh to recover from error state
- Clear debounceTimer on session/directory change to prevent stale events
- Guard loadRulesRefresh() to skip when status is 'loading', preventing refresh from invalidating an in-flight initial load - Update bullet green color from 'green' to '#02a25a' for better visibility
OpenCode SDK events nest sessionID inside properties object with capital D (event.properties.sessionID), not event.sessionId. Also improves vendored TuiEventBus type to match real event structure.
…h, and state persistence - Add TUI sidebar to Features list - Add active-rules-state.ts to Project Structure and Key Module Responsibilities - Update rule-filter.ts description to mention FilterResult return type - Replace inaccurate [P]/[G] prefix claim with collapsible section groups - Document active/inactive indicators, sort-to-top, and event-driven refresh - Add State Persistence step to How It Works flow
frap129
marked this pull request as ready for review
March 31, 2026 19:08
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.
Add a "Rules" section to the TUI sidebar listing discovered rules by scope, indicating which are currently active, and what the matching criteria are. Ordered between LSP and Todo
