Skip to content

Commit 8beae0c

Browse files
author
Eric Wheeler
committed
docs: add comprehensive guide for adding new configuration items
Add a new section to settings.md that provides a complete checklist for adding new configuration items to the system. This guide covers all aspects from UI to persistence to functionality, based on implementation experience. Signed-off-by: Eric Wheeler <[email protected]>
1 parent c948b74 commit 8beae0c

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

cline_docs/settings.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,3 +178,68 @@ These steps ensure that:
178178
- The setting's value is properly synchronized between the webview and extension
179179
- The setting has a proper UI representation in the settings view
180180
- Test coverage is maintained for the new setting
181+
182+
## Adding a New Configuration Item: Summary of Required Changes
183+
184+
To add a new configuration item to the system, the following changes are necessary:
185+
186+
1. **Feature-Specific Class** (if applicable)
187+
188+
- For settings that affect specific features (e.g., Terminal, Browser, etc.)
189+
- Add a static property to store the value
190+
- Add getter/setter methods to access and modify the value
191+
192+
2. **Schema Definition**
193+
194+
- Add the item to globalSettingsSchema in schemas/index.ts
195+
- Add the item to globalSettingsRecord in schemas/index.ts
196+
197+
3. **Type Definitions**
198+
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
203+
204+
4. **UI Component**
205+
206+
- Create or update a component in webview-ui/src/components/settings/
207+
- Add appropriate slider/input controls with min/max/step values
208+
- Ensure the props are passed correctly to the component in SettingsView.tsx
209+
- Update the component's props interface to include the new settings
210+
211+
5. **Translations**
212+
213+
- Add label and description in webview-ui/src/i18n/locales/en/settings.json
214+
- Update all other languages
215+
- If any language content is changed, synchronize all other languages with that change
216+
- Translations must be performed within "translation" mode so change modes for that purpose
217+
218+
6. **State Management**
219+
220+
- 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
225+
226+
7. **Message Handling**
227+
228+
- Add a case for the item in webviewMessageHandler.ts
229+
230+
8. **Implementation-Specific Logic**
231+
232+
- Implement any feature-specific behavior triggered by the setting
233+
- Examples:
234+
- Environment variables for terminal settings
235+
- API configuration changes for provider settings
236+
- UI behavior modifications for display settings
237+
238+
9. **Testing**
239+
240+
- Add test cases for the new settings in appropriate test files
241+
- Verify settings persistence and state updates
242+
243+
10. **Avoiding Duplicates**
244+
- Be careful to avoid duplicate handlers or UI components when adding new settings
245+
- Check for existing similar settings to maintain consistent patterns

0 commit comments

Comments
 (0)