@@ -8,7 +8,8 @@ import { VSCodeButton } from "@vscode/webview-ui-toolkit/react"
88import RulesToggleList from "./RulesToggleList"
99import Tooltip from "@/components/common/Tooltip"
1010import styled from "styled-components"
11- import { ClineRulesToggles , ToggleWindsurfRuleRequest } from "@shared/proto/file"
11+ import { ClineRulesToggles , RefreshedRules , ToggleWindsurfRuleRequest } from "@shared/proto/file"
12+ import { EmptyRequest } from "@shared/proto/common"
1213
1314const ClineRulesToggleModal : React . FC = ( ) => {
1415 const {
@@ -21,6 +22,7 @@ const ClineRulesToggleModal: React.FC = () => {
2122 setLocalClineRulesToggles,
2223 setLocalCursorRulesToggles,
2324 setLocalWindsurfRulesToggles,
25+ setWorkflowToggles,
2426 } = useExtensionState ( )
2527 const [ isVisible , setIsVisible ] = useState ( false )
2628 const buttonRef = useRef < HTMLDivElement > ( null )
@@ -32,7 +34,28 @@ const ClineRulesToggleModal: React.FC = () => {
3234
3335 useEffect ( ( ) => {
3436 if ( isVisible ) {
35- vscode . postMessage ( { type : "refreshClineRules" } )
37+ FileServiceClient . refreshRules ( { } as EmptyRequest )
38+ . then ( ( response : RefreshedRules ) => {
39+ // Update state with the response data using all available setters
40+ if ( response . globalClineRulesToggles ?. toggles ) {
41+ setGlobalClineRulesToggles ( response . globalClineRulesToggles . toggles )
42+ }
43+ if ( response . localClineRulesToggles ?. toggles ) {
44+ setLocalClineRulesToggles ( response . localClineRulesToggles . toggles )
45+ }
46+ if ( response . localCursorRulesToggles ?. toggles ) {
47+ setLocalCursorRulesToggles ( response . localCursorRulesToggles . toggles )
48+ }
49+ if ( response . localWindsurfRulesToggles ?. toggles ) {
50+ setLocalWindsurfRulesToggles ( response . localWindsurfRulesToggles . toggles )
51+ }
52+ if ( response . workflowToggles ?. toggles ) {
53+ setWorkflowToggles ( response . workflowToggles . toggles )
54+ }
55+ } )
56+ . catch ( ( error ) => {
57+ console . error ( "Failed to refresh rules:" , error )
58+ } )
3659 }
3760 } , [ isVisible ] )
3861
0 commit comments