22
331 . Add the setting to schema definitions:
44
5- - Add the item to ` globalSettingsSchema ` in ` schemas/index.ts `
6- - Add the item to ` globalSettingsRecord ` in ` schemas/index.ts `
5+ - Add the item to ` globalSettingsSchema ` in ` src/ schemas/index.ts`
6+ - Add the item to ` globalSettingsRecord ` in ` src/ schemas/index.ts`
77 - Example: ` terminalCommandDelay: z.number().optional(), `
88
992 . Add the setting to type definitions:
1010
11- - Add the item to ` exports/types.ts `
12- - Add the item to ` exports/roo-code.d.ts `
13- - Add the setting to ` shared/ExtensionMessage.ts `
14- - Add the setting to the WebviewMessage type in ` shared/WebviewMessage.ts `
11+ - Add the item to ` src/ exports/types.ts`
12+ - Add the item to ` src/ exports/roo-code.d.ts`
13+ - Add the setting to ` src/ shared/ExtensionMessage.ts`
14+ - Add the setting to the WebviewMessage type in ` src/ shared/WebviewMessage.ts`
1515 - Example: ` terminalCommandDelay?: number | undefined `
1616
17173 . Add test coverage:
18- - Add the setting to mockState in ClineProvider.test.ts
18+ - Add the setting to mockState in src/core/webview/ ** tests ** / ClineProvider.test.ts
1919 - Add test cases for setting persistence and state updates
2020 - Ensure all tests pass before submitting changes
2121
2222## For Checkbox Settings
2323
24- 1 . Add the message type to WebviewMessage.ts:
24+ 1 . Add the message type to src/shared/ WebviewMessage.ts:
2525
2626 - Add the setting name to the WebviewMessage type's type union
2727 - Example: ` | "multisearchDiffEnabled" `
2828
29- 2 . Add the setting to ExtensionStateContext.tsx:
29+ 2 . Add the setting to webview-ui/src/context/ ExtensionStateContext.tsx:
3030
3131 - Add the setting to the ExtensionStateContextType interface
3232 - Add the setter function to the interface
4040 }
4141 ```
4242
43- 3. Add the setting to ClineProvider .ts :
43+ 3. Add the setting to src / core / webview / ClineProvider .ts :
4444
4545 - Add the setting name to the GlobalStateKey type union
4646 - Add the setting to the Promise.all array in getState
5656 break
5757 ```
5858
59- 4. Add the checkbox UI to SettingsView .tsx :
59+ 4. Add the checkbox UI to webview - ui / src / components / settings / SettingsView .tsx :
6060
6161 - Import the setting and its setter from ExtensionStateContext
6262 - Add the VSCodeCheckbox component with the setting ' s state and onChange handler
7171 </VSCodeCheckbox>
7272 ` ` `
7373
74- 5. Add the setting to handleSubmit in SettingsView .tsx :
74+ 5. Add the setting to handleSubmit in webview - ui / src / components / settings / SettingsView .tsx :
7575
7676 - Add a vscode .postMessage call to send the setting ' s value when clicking Save
7777 - This step is critical for persistence - without it , the setting will not be saved when the user clicks Save
103103
104104## For Select / Dropdown Settings
105105
106- 1. Add the message type to WebviewMessage.ts:
106+ 1. Add the message type to src/shared/ WebviewMessage.ts:
107107
108108 - Add the setting name to the WebviewMessage type ' s type union
109109 - Example : ` | "preferredLanguage" `
110110
111- 2. Add the setting to ExtensionStateContext .tsx :
111+ 2. Add the setting to webview - ui / src / context / ExtensionStateContext .tsx :
112112
113113 - Add the setting to the ExtensionStateContextType interface
114114 - Add the setter function to the interface
122122 }
123123 ```
124124
125- 3. Add the setting to ClineProvider .ts :
125+ 3. Add the setting to src / core / webview / ClineProvider .ts :
126126
127127 - Add the setting name to the GlobalStateKey type union
128128 - Add the setting to the Promise.all array in getState
139139 break
140140 ```
141141
142- 4. Add the select UI to SettingsView .tsx :
142+ 4. Add the select UI to webview - ui / src / components / settings / SettingsView .tsx :
143143
144144 - Import the setting and its setter from ExtensionStateContext
145145 - Add the select element with appropriate styling to match VSCode ' s theme
164164 </select>
165165 ` ` `
166166
167- 5. Add the setting to handleSubmit in SettingsView .tsx :
167+ 5. Add the setting to handleSubmit in webview - ui / src / components / settings / SettingsView .tsx :
168168 - Add a vscode .postMessage call to send the setting ' s value when clicking Done
169169 - Example :
170170 ` ` ` typescript
@@ -191,21 +191,21 @@ To add a new configuration item to the system, the following changes are necessa
191191
1921922. ** Schema Definition **
193193
194- - Add the item to globalSettingsSchema in schemas / index .ts
195- - Add the item to globalSettingsRecord in schemas / index .ts
194+ - Add the item to globalSettingsSchema in src / schemas / index .ts
195+ - Add the item to globalSettingsRecord in src / schemas / index .ts
196196
1971973. ** Type Definitions **
198198
199- - Add the item to exports / types .ts
200- - Add the item to exports / roo - code .d .ts
201- - Add the item to shared / ExtensionMessage .ts
202- - Add the item to shared / WebviewMessage .ts
199+ - Add the item to src / exports / types .ts
200+ - Add the item to src / exports / roo - code .d .ts
201+ - Add the item to src / shared / ExtensionMessage .ts
202+ - Add the item to src / shared / WebviewMessage .ts
203203
2042044. ** UI Component **
205205
206206 - Create or update a component in webview - ui / src / components / settings /
207207 - Add appropriate slider / input controls with min / max / step values
208- - Ensure the props are passed correctly to the component in SettingsView .tsx
208+ - Ensure the props are passed correctly to the component in webview - ui / src / components / settings / SettingsView .tsx
209209 - Update the component ' s props interface to include the new settings
210210
2112115. ** Translations **
@@ -218,14 +218,14 @@ To add a new configuration item to the system, the following changes are necessa
2182186. ** State Management **
219219
220220 - Add the item to the destructuring in SettingsView .tsx
221- - Add the item to the handleSubmit function in SettingsView.tsx
222- - Add the item to getStateToPostToWebview in ClineProvider.ts
223- - Add the item to getState in ClineProvider.ts with appropriate default values
224- - Add the item to the initialization in resolveWebviewView in ClineProvider.ts
221+ - Add the item to the handleSubmit function in webview-ui/src/components/settings/ SettingsView.tsx
222+ - Add the item to getStateToPostToWebview in src/core/webview/ ClineProvider.ts
223+ - Add the item to getState in src/core/webview/ ClineProvider.ts with appropriate default values
224+ - Add the item to the initialization in resolveWebviewView in src/core/webview/ ClineProvider.ts
225225
2262267. ** Message Handling **
227227
228- - Add a case for the item in webviewMessageHandler .ts
228+ - Add a case for the item in src / core / webview / webviewMessageHandler .ts
229229
2302308. ** Implementation - Specific Logic **
231231
@@ -310,11 +310,11 @@ To add a new configuration item to the system, the following changes are necessa
310310 1. ** Complete Chain of Persistence ** :
311311
312312 - Verify that the setting is added to all required locations :
313- - globalSettingsSchema and globalSettingsRecord in schemas / index .ts
314- - Initial state in ExtensionStateContextProvider
315- - getState method in ClineProvider .ts
316- - getStateToPostToWebview method in ClineProvider .ts
317- - resolveWebviewView method in ClineProvider .ts (if feature - specific )
313+ - globalSettingsSchema and globalSettingsRecord in src / schemas / index .ts
314+ - Initial state in ExtensionStateContextProvider
315+ - getState method in src / core / webview / ClineProvider .ts
316+ - getStateToPostToWebview method in src / core / webview / ClineProvider .ts
317+ - resolveWebviewView method in src / core / webview / ClineProvider .ts (if feature - specific )
318318 - A break in any part of this chain can prevent persistence
319319
320320 2. ** Default Values Consistency ** :
@@ -324,12 +324,12 @@ To add a new configuration item to the system, the following changes are necessa
324324
325325 3. ** Message Handling ** :
326326
327- - Confirm the webviewMessageHandler .ts has a case for the setting
327+ - Confirm the src / core / webview / webviewMessageHandler .ts has a case for the setting
328328 - Verify the message type matches what's sent from the UI
329329
330330 4. ** UI Integration ** :
331331
332- - Check that the setting is included in the handleSubmit function in SettingsView.tsx
332+ - Check that the setting is included in the handleSubmit function in webview-ui/src/components/settings/ SettingsView.tsx
333333 - Ensure the UI component correctly updates the state
334334
335335 5. ** Type Definitions ** :
@@ -354,7 +354,7 @@ Settings persistence requires a complete chain of state management across multip
354354 - Example :
355355
356356 ` ` ` typescript
357- // In schemas/index.ts
357+ // In src/ schemas/index.ts
358358 export const globalSettingsSchema = z.object({
359359 // Existing settings...
360360 commandRiskLevel: z.enum(["readOnly", "reversibleChanges", "complexChanges"]).optional(),
@@ -389,12 +389,12 @@ Settings persistence requires a complete chain of state management across multip
389389
3903903. ** Message Handler (State Saving )** :
391391
392- - Must use correct message type in `webviewMessageHandler.ts`
392+ - Must use correct message type in `src/core/webview/ webviewMessageHandler.ts`
393393 - Must use `updateGlobalState` with properly typed values
394394 - Must call `postStateToWebview` after updates
395395 - Example:
396396 ```typescript
397- // In webviewMessageHandler.ts
397+ // In src/core/webview/ webviewMessageHandler.ts
398398 case " commandRiskLevel" :
399399 await updateGlobalState (
400400 " commandRiskLevel" ,
@@ -413,7 +413,7 @@ Settings persistence requires a complete chain of state management across multip
413413 - Example :
414414
415415 ` ` ` typescript
416- // In ClineProvider.ts getStateToPostToWebview
416+ // In src/core/webview/ ClineProvider.ts getStateToPostToWebview
417417 const {
418418 // Other state properties...
419419 commandRiskLevel,
0 commit comments