Skip to content

Commit 421c78c

Browse files
committed
docs: update documentation for YAML settings and config commands
1 parent f20cda3 commit 421c78c

3 files changed

Lines changed: 399 additions & 151 deletions

File tree

CHANGELOG.md

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,56 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111

12+
#### Settings Management System
13+
- **Modular Settings Architecture**: Separated internal patterns from user-changeable settings
14+
- `patterns.py` - Internal regex patterns and templates (NOT user-changeable)
15+
- `defaults.py` - Default values for user-changeable settings
16+
- `settings/` module - Organized settings management with public API
17+
- Clean separation between code constants and user configuration
18+
19+
- **Settings Module Structure**: New `shello_cli/settings/` package
20+
- `__init__.py` - Public API exports (SettingsManager, get_settings, get_api_key, etc.)
21+
- `models.py` - Dataclasses for settings (ProviderConfig, OutputManagementConfig, CommandTrustConfig, UserSettings)
22+
- `serializers.py` - YAML generation with helpful comments and documentation
23+
- `manager.py` - SettingsManager class with load/save/merge logic
24+
25+
- **YAML Configuration Format**: User-friendly YAML with inline documentation
26+
- Replaced JSON with YAML for better readability
27+
- Inline comments explaining each setting
28+
- Section headers for organization
29+
- Examples for all optional settings
30+
- Only configured values saved (rest use defaults)
31+
32+
- **Enhanced Setup Wizard**: Generates well-documented settings file
33+
- Creates `~/.shello_cli/user-settings.yml` with all options as comments
34+
- Only saves values user explicitly configured
35+
- Shows examples for optional settings (output_management, command_trust)
36+
- Includes helpful documentation in generated file
37+
38+
- **Configuration Management Commands**: New CLI commands for settings
39+
- `shello config` - Display current configuration
40+
- `shello config --edit` - Open settings in default editor ($EDITOR)
41+
- `shello config get <key>` - Get specific setting value (supports dot notation)
42+
- `shello config set <key> <value>` - Set specific setting value (supports dot notation)
43+
- `shello config reset` - Reset settings to defaults with confirmation
44+
45+
- **Default Merging Strategy**: Smart merging of user settings with defaults
46+
- User only specifies values they want to override
47+
- Missing values automatically filled from `defaults.py`
48+
- Denylist is always additive (user patterns added to defaults for safety)
49+
- Environment variables override file settings
50+
51+
- **Settings Validation**: Graceful handling of invalid values
52+
- Validates provider values (openai, bedrock)
53+
- Validates approval_mode (user_driven, ai_driven)
54+
- Falls back to defaults on invalid values
55+
- Logs warnings for invalid configuration
56+
57+
- **File Security**: Automatic secure file permissions
58+
- Sets 0o600 (user-only read/write) on settings files
59+
- Protects API keys and credentials
60+
- Creates parent directories if needed
61+
1262
#### Multi-Provider Support
1363
- **AWS Bedrock Integration**: Full support for AWS Bedrock as an AI provider
1464
- Anthropic Claude models (3.5 Sonnet, 3 Opus, 3 Sonnet)
@@ -75,6 +125,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
75125

76126
### Changed
77127

128+
#### Settings Management Changes
129+
- **Settings File Format**: Migrated from JSON to YAML
130+
- `~/.shello_cli/user-settings.json``~/.shello_cli/user-settings.yml`
131+
- Backward compatibility maintained (old JSON files still work)
132+
- Automatic migration on first run with new version
133+
134+
- **Constants Organization**: Split `constants.py` into focused modules
135+
- `patterns.py` - Internal patterns (COMMAND_PATTERNS, CONTENT_PATTERNS, etc.)
136+
- `defaults.py` - User-changeable defaults (DEFAULT_CHAR_LIMITS, DEFAULT_STRATEGIES, etc.)
137+
- Updated all imports across codebase
138+
139+
- **Settings Manager Location**: Moved to dedicated module
140+
- `utils/settings_manager.py``settings/manager.py`
141+
- Backward compatibility via re-exports from `utils/settings_manager.py`
142+
- No breaking changes for existing code
143+
78144
#### Multi-Provider Support Changes
79145
- **Settings Manager**: Extended with provider configuration support
80146
- New `ProviderConfig` dataclass for provider-specific settings
@@ -104,6 +170,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
104170

105171
### Testing
106172

173+
#### Settings Management Tests
174+
- **Comprehensive Test Coverage**: 400+ tests for settings system
175+
- Settings loading and merging with defaults
176+
- YAML serialization with comments
177+
- Configuration validation and fallback
178+
- File permissions and security
179+
- Environment variable overrides
180+
- Dot notation for get/set commands
181+
182+
- **Property-Based Tests**: Formal correctness validation
183+
- Property 1: Settings Round-Trip (serialize → deserialize produces equivalent settings)
184+
- Property 2: Default Merging (partial settings filled with defaults)
185+
- Property 3: Denylist Immutability (user denylist always includes defaults)
186+
- Property 4: Environment Variable Fallback (env vars used when config missing)
187+
- Property 5: Singleton Identity (all get_instance() calls return same object)
188+
107189
#### Multi-Provider Support Tests
108190
- **Client Factory Tests**: 542 lines of comprehensive tests
109191
- Test creating ShelloClient for OpenAI provider
@@ -122,6 +204,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
122204

123205
### Documentation
124206

207+
#### Settings Management Documentation
208+
- **README Updates**: Configuration section rewritten
209+
- New "Configuration Management" section with CLI commands
210+
- YAML configuration examples with inline comments
211+
- Explanation of default merging strategy
212+
- Updated all JSON examples to YAML
213+
214+
- **DEVELOPMENT_SETUP.md Updates**: Comprehensive developer documentation
215+
- New CLI commands section (config --edit, get, set, reset)
216+
- YAML configuration format with examples
217+
- Updated configuration hierarchy with defaults.py
218+
- Project structure showing new settings/ module
219+
- Updated troubleshooting for YAML validation
220+
221+
- **Design Documentation**: Complete design document
222+
- Architecture overview with file responsibilities
223+
- Data flow diagrams (loading and saving)
224+
- Example generated user-settings.yml
225+
- Correctness properties with validation strategy
226+
- Error handling and testing strategy
227+
125228
#### Multi-Provider Support Documentation
126229
- **README Updates**: Comprehensive multi-provider documentation
127230
- New "AI Provider Support" section with provider overview
@@ -148,6 +251,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
148251

149252
### Technical Details
150253

254+
#### Settings Management Technical Details
255+
- **Modular Architecture**: Clean separation of concerns
256+
- Settings models (dataclasses)
257+
- Serialization logic (YAML with comments)
258+
- Management logic (load/save/merge)
259+
- Public API (convenience functions)
260+
261+
- **Type Safety**: Full type hints throughout
262+
- Dataclasses for all settings structures
263+
- Optional fields with proper defaults
264+
- Type-safe merging and validation
265+
266+
- **Backward Compatibility**: Zero breaking changes
267+
- Old JSON files still work
268+
- Existing imports continue to work via re-exports
269+
- Automatic migration path
270+
271+
- **Security First**: Secure by default
272+
- Automatic file permissions (0o600)
273+
- No credentials in error messages
274+
- Environment variable support for sensitive data
275+
151276
#### Multi-Provider Support Technical Details
152277
- **Modular Provider System**: Clean separation with client factory pattern
153278
- **Type Safety**: Union types for client interfaces, full type hints

0 commit comments

Comments
 (0)