|
6 | 6 | """ |
7 | 7 |
|
8 | 8 | from typing import Any, Dict, Optional |
9 | | -from .models import UserSettings, ProviderConfig, OutputManagementConfig, CommandTrustConfig |
| 9 | +from .models import UserSettings, ProviderConfig, OutputManagementConfig, CommandTrustConfig, UpdateConfig |
10 | 10 |
|
11 | 11 |
|
12 | 12 | def generate_yaml_with_comments(settings: UserSettings) -> str: |
@@ -179,6 +179,25 @@ def generate_yaml_with_comments(settings: UserSettings) -> str: |
179 | 179 | "# # denylist:", |
180 | 180 | "# # - my-dangerous-command", |
181 | 181 | ]) |
| 182 | + lines.append("") |
| 183 | + |
| 184 | + # Update Configuration Section |
| 185 | + lines.extend([ |
| 186 | + "# =============================================================================", |
| 187 | + "# UPDATE CONFIGURATION (optional - uses defaults if not specified)", |
| 188 | + "# =============================================================================", |
| 189 | + "# Controls automatic update checking behavior.", |
| 190 | + "# Uncomment and modify to customize:", |
| 191 | + "#", |
| 192 | + ]) |
| 193 | + |
| 194 | + if settings.update_config: |
| 195 | + lines.extend(_serialize_update_config(settings.update_config)) |
| 196 | + else: |
| 197 | + lines.extend([ |
| 198 | + "# update_config:", |
| 199 | + "# check_on_startup: true # Check for updates when Shello CLI starts", |
| 200 | + ]) |
182 | 201 |
|
183 | 202 | return "\n".join(lines) |
184 | 203 |
|
@@ -277,3 +296,11 @@ def _serialize_command_trust(config: CommandTrustConfig) -> list: |
277 | 296 | lines.append(f" - {pattern}") |
278 | 297 |
|
279 | 298 | return lines |
| 299 | + |
| 300 | + |
| 301 | +def _serialize_update_config(config: UpdateConfig) -> list: |
| 302 | + """Serialize UpdateConfig to YAML lines.""" |
| 303 | + lines = ["update_config:"] |
| 304 | + lines.append(f" check_on_startup: {str(config.check_on_startup).lower()}") |
| 305 | + |
| 306 | + return lines |
0 commit comments