ostruct-cli 0.8.29__py3-none-any.whl → 1.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. ostruct/cli/__init__.py +3 -15
  2. ostruct/cli/attachment_processor.py +455 -0
  3. ostruct/cli/attachment_template_bridge.py +973 -0
  4. ostruct/cli/cli.py +157 -33
  5. ostruct/cli/click_options.py +775 -692
  6. ostruct/cli/code_interpreter.py +195 -12
  7. ostruct/cli/commands/__init__.py +0 -3
  8. ostruct/cli/commands/run.py +289 -62
  9. ostruct/cli/config.py +23 -22
  10. ostruct/cli/constants.py +89 -0
  11. ostruct/cli/errors.py +175 -5
  12. ostruct/cli/explicit_file_processor.py +0 -15
  13. ostruct/cli/file_info.py +97 -15
  14. ostruct/cli/file_list.py +43 -1
  15. ostruct/cli/file_search.py +68 -2
  16. ostruct/cli/help_json.py +235 -0
  17. ostruct/cli/mcp_integration.py +13 -16
  18. ostruct/cli/params.py +217 -0
  19. ostruct/cli/plan_assembly.py +335 -0
  20. ostruct/cli/plan_printing.py +385 -0
  21. ostruct/cli/progress_reporting.py +8 -56
  22. ostruct/cli/quick_ref_help.py +128 -0
  23. ostruct/cli/rich_config.py +299 -0
  24. ostruct/cli/runner.py +397 -190
  25. ostruct/cli/security/__init__.py +2 -0
  26. ostruct/cli/security/allowed_checker.py +41 -0
  27. ostruct/cli/security/normalization.py +13 -9
  28. ostruct/cli/security/security_manager.py +558 -17
  29. ostruct/cli/security/types.py +15 -0
  30. ostruct/cli/template_debug.py +283 -261
  31. ostruct/cli/template_debug_help.py +233 -142
  32. ostruct/cli/template_env.py +46 -5
  33. ostruct/cli/template_filters.py +415 -8
  34. ostruct/cli/template_processor.py +240 -619
  35. ostruct/cli/template_rendering.py +49 -73
  36. ostruct/cli/template_validation.py +2 -1
  37. ostruct/cli/token_validation.py +35 -15
  38. ostruct/cli/types.py +15 -19
  39. ostruct/cli/unicode_compat.py +283 -0
  40. ostruct/cli/upload_manager.py +448 -0
  41. ostruct/cli/validators.py +255 -54
  42. {ostruct_cli-0.8.29.dist-info → ostruct_cli-1.0.1.dist-info}/METADATA +231 -128
  43. ostruct_cli-1.0.1.dist-info/RECORD +80 -0
  44. ostruct/cli/commands/quick_ref.py +0 -54
  45. ostruct/cli/template_optimizer.py +0 -478
  46. ostruct_cli-0.8.29.dist-info/RECORD +0 -71
  47. {ostruct_cli-0.8.29.dist-info → ostruct_cli-1.0.1.dist-info}/LICENSE +0 -0
  48. {ostruct_cli-0.8.29.dist-info → ostruct_cli-1.0.1.dist-info}/WHEEL +0 -0
  49. {ostruct_cli-0.8.29.dist-info → ostruct_cli-1.0.1.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,299 @@
1
+ """Rich-Click configuration for ostruct CLI.
2
+
3
+ This module configures rich-click to provide enhanced CLI help output with:
4
+ - Modern, clean visual styling
5
+ - Organized option groups with proper borders
6
+ - Professional color scheme suitable for enterprise use
7
+ - Structured layout optimized for readability
8
+
9
+ The configuration is designed to be easily extensible for future theme support.
10
+ """
11
+
12
+ from typing import List
13
+
14
+ import rich_click as click
15
+
16
+ # ============================================================================
17
+ # RICH-CLICK CORE CONFIGURATION
18
+ # ============================================================================
19
+
20
+ # Enable rich markup and features
21
+ click.rich_click.USE_RICH_MARKUP = (
22
+ True # Enable [bold], [cyan], etc. in docstrings
23
+ )
24
+ click.rich_click.USE_MARKDOWN = True # Enable markdown parsing in help text
25
+ click.rich_click.SHOW_ARGUMENTS = True # Show arguments in help output
26
+ click.rich_click.GROUP_ARGUMENTS_OPTIONS = (
27
+ True # Group args and options separately
28
+ )
29
+ click.rich_click.SHOW_METAVARS_COLUMN = (
30
+ False # Don't show separate metavar column
31
+ )
32
+ click.rich_click.APPEND_METAVARS_HELP = True # Append metavars to help text
33
+
34
+ # ============================================================================
35
+ # MODERN THEME STYLING - APPLIED IMMEDIATELY
36
+ # ============================================================================
37
+ # Based on our rich-click test - Modern/Vibrant theme with professional polish
38
+
39
+ # Text styling
40
+ click.rich_click.STYLE_HELPTEXT = "" # Normal brightness (not dim)
41
+ click.rich_click.STYLE_HELPTEXT_FIRST_LINE = "bold" # Bold first line of help
42
+ click.rich_click.STYLE_HEADER_TEXT = "bold" # Bold section headers
43
+
44
+ # UI element styling
45
+ click.rich_click.STYLE_OPTION = "bright_blue" # Bright blue option names
46
+ click.rich_click.STYLE_ARGUMENT = "bright_blue" # Bright blue argument names
47
+ click.rich_click.STYLE_COMMAND = "bold blue" # Bold blue command names
48
+ click.rich_click.STYLE_SWITCH = "bold green" # Bold green boolean switches
49
+ click.rich_click.STYLE_METAVAR = "cyan" # Cyan type hints
50
+ click.rich_click.STYLE_USAGE = "bold yellow" # Bold yellow usage line
51
+
52
+ # Status and annotation styling
53
+ click.rich_click.STYLE_REQUIRED_SHORT = (
54
+ "bold red" # Bold red asterisk for required
55
+ )
56
+ click.rich_click.STYLE_OPTION_DEFAULT = (
57
+ "dim cyan" # Dim cyan for default values
58
+ )
59
+ click.rich_click.STYLE_DEPRECATED = "dim red" # Dim red for deprecated options
60
+
61
+ # Panel and border styling
62
+ click.rich_click.STYLE_OPTIONS_PANEL_BORDER = (
63
+ "blue" # Blue borders around option groups
64
+ )
65
+ click.rich_click.STYLE_COMMANDS_PANEL_BORDER = (
66
+ "blue" # Blue borders around command groups
67
+ )
68
+ click.rich_click.STYLE_ERRORS_PANEL_BORDER = (
69
+ "red" # Red borders for error panels
70
+ )
71
+ click.rich_click.STYLE_ERRORS_SUGGESTION = "dim" # Dim suggestions in errors
72
+
73
+ # Table styling for clean, professional look
74
+ click.rich_click.STYLE_OPTIONS_TABLE_SHOW_LINES = (
75
+ False # Clean look without table lines
76
+ )
77
+ click.rich_click.STYLE_OPTIONS_TABLE_PADDING = (0, 1) # Minimal padding
78
+ click.rich_click.STYLE_OPTIONS_TABLE_BOX = "" # No box borders around tables
79
+
80
+ # Width and layout settings
81
+ click.rich_click.MAX_WIDTH = 100 # Popular choice for readability
82
+ click.rich_click.WIDTH = None # Use terminal width
83
+
84
+ # ============================================================================
85
+ # OPTION GROUPS CONFIGURATION
86
+ # ============================================================================
87
+ # Comprehensive option groups covering all ostruct CLI options
88
+
89
+ click.rich_click.OPTION_GROUPS = {
90
+ "ostruct run": [
91
+ {"name": "Template Data Options", "options": ["--var", "--json-var"]},
92
+ {
93
+ "name": "Model Configuration Options",
94
+ "options": [
95
+ "--model",
96
+ "--temperature",
97
+ "--max-output-tokens",
98
+ "--top-p",
99
+ "--frequency-penalty",
100
+ "--presence-penalty",
101
+ "--reasoning-effort",
102
+ ],
103
+ },
104
+ {
105
+ "name": "File Attachment Options",
106
+ "options": [
107
+ "--file",
108
+ "--dir",
109
+ "--collect",
110
+ "--recursive",
111
+ "--pattern",
112
+ ],
113
+ },
114
+ {
115
+ "name": "Tool Integration Options",
116
+ "options": ["--enable-tool", "--disable-tool"],
117
+ },
118
+ {
119
+ "name": "MCP Server Configuration",
120
+ "options": [
121
+ "--mcp-server",
122
+ "--mcp-require-approval",
123
+ "--mcp-headers",
124
+ ],
125
+ },
126
+ {
127
+ "name": "Code Interpreter Configuration",
128
+ "options": [
129
+ "--ci-cleanup",
130
+ "--ci-duplicate-outputs",
131
+ "--ci-download-dir",
132
+ ],
133
+ },
134
+ {
135
+ "name": "File Search Configuration",
136
+ "options": [
137
+ "--fs-timeout",
138
+ "--fs-retries",
139
+ "--fs-cleanup",
140
+ "--fs-store-name",
141
+ ],
142
+ },
143
+ {
144
+ "name": "Web Search Configuration",
145
+ "options": [
146
+ "--ws-country",
147
+ "--ws-city",
148
+ "--ws-region",
149
+ "--ws-context-size",
150
+ ],
151
+ },
152
+ {
153
+ "name": "System Prompt Options",
154
+ "options": [
155
+ "--sys-prompt",
156
+ "--sys-prompt-file",
157
+ "--sys-prompt-script",
158
+ "--sys-prompt-template",
159
+ "--sys-prompt-script-args",
160
+ ],
161
+ },
162
+ {
163
+ "name": "Output and Execution Options",
164
+ "options": [
165
+ "--output",
166
+ "--dry-run",
167
+ "--dry-run-json",
168
+ "--run-summary-json",
169
+ ],
170
+ },
171
+ {
172
+ "name": "Configuration and API Options",
173
+ "options": [
174
+ "--config",
175
+ "--api-key",
176
+ "--base-url",
177
+ "--organization",
178
+ "--project",
179
+ "--timeout",
180
+ ],
181
+ },
182
+ {
183
+ "name": "Security and Path Control Options",
184
+ "options": [
185
+ "--path-security",
186
+ "--allow-paths",
187
+ "--disallow-paths",
188
+ ],
189
+ },
190
+ {
191
+ "name": "Debug and Progress Options",
192
+ "options": [
193
+ "--template-debug",
194
+ "--show-template",
195
+ "--verbose",
196
+ "--debug",
197
+ "--progress",
198
+ ],
199
+ },
200
+ {
201
+ "name": "Experimental Features",
202
+ "options": [
203
+ "--enable-feature",
204
+ "--disable-feature",
205
+ ],
206
+ },
207
+ ]
208
+ }
209
+
210
+ # ============================================================================
211
+ # THEME EXTENSIBILITY (Future Enhancement)
212
+ # ============================================================================
213
+ # This structure makes it easy to add theme switching in the future
214
+
215
+
216
+ def apply_modern_theme() -> None:
217
+ """Apply modern, clean theme with vibrant but professional colors."""
218
+ # Text styling
219
+ click.rich_click.STYLE_HELPTEXT = "" # Normal brightness (not dim)
220
+ click.rich_click.STYLE_HELPTEXT_FIRST_LINE = (
221
+ "bold" # Bold first line of help
222
+ )
223
+ click.rich_click.STYLE_HEADER_TEXT = "bold" # Bold section headers
224
+
225
+ # UI element styling
226
+ click.rich_click.STYLE_OPTION = "bright_blue" # Bright blue option names
227
+ click.rich_click.STYLE_ARGUMENT = (
228
+ "bright_blue" # Bright blue argument names
229
+ )
230
+ click.rich_click.STYLE_COMMAND = "bold blue" # Bold blue command names
231
+ click.rich_click.STYLE_SWITCH = "bold green" # Bold green boolean switches
232
+ click.rich_click.STYLE_METAVAR = "cyan" # Cyan type hints
233
+ click.rich_click.STYLE_USAGE = "bold yellow" # Bold yellow usage line
234
+
235
+ # Status and annotation styling
236
+ click.rich_click.STYLE_REQUIRED_SHORT = (
237
+ "bold red" # Bold red asterisk for required
238
+ )
239
+ click.rich_click.STYLE_OPTION_DEFAULT = (
240
+ "dim cyan" # Dim cyan for default values
241
+ )
242
+ click.rich_click.STYLE_DEPRECATED = (
243
+ "dim red" # Dim red for deprecated options
244
+ )
245
+
246
+ # Panel and border styling
247
+ click.rich_click.STYLE_OPTIONS_PANEL_BORDER = (
248
+ "blue" # Blue borders around option groups
249
+ )
250
+ click.rich_click.STYLE_COMMANDS_PANEL_BORDER = (
251
+ "blue" # Blue borders around command groups
252
+ )
253
+ click.rich_click.STYLE_ERRORS_PANEL_BORDER = (
254
+ "red" # Red borders for error panels
255
+ )
256
+ click.rich_click.STYLE_ERRORS_SUGGESTION = (
257
+ "dim" # Dim suggestions in errors
258
+ )
259
+
260
+ # Table styling for clean, professional look
261
+ click.rich_click.STYLE_OPTIONS_TABLE_SHOW_LINES = (
262
+ False # Clean look without table lines
263
+ )
264
+ click.rich_click.STYLE_OPTIONS_TABLE_PADDING = (0, 1) # Minimal padding
265
+ click.rich_click.STYLE_OPTIONS_TABLE_BOX = (
266
+ "" # No box borders around tables
267
+ )
268
+
269
+ # Width and layout settings
270
+ click.rich_click.MAX_WIDTH = 100 # Popular choice for readability
271
+ click.rich_click.WIDTH = None # Use terminal width
272
+
273
+
274
+ def get_available_themes() -> List[str]:
275
+ """Get list of available themes for future theme switching support."""
276
+ return ["modern"] # Currently only modern theme, easily extensible
277
+
278
+
279
+ def apply_theme(theme_name: str) -> bool:
280
+ """Apply a specific theme by name.
281
+
282
+ Args:
283
+ theme_name: Name of theme to apply
284
+
285
+ Returns:
286
+ True if theme was applied successfully, False if theme not found
287
+ """
288
+ if theme_name == "modern":
289
+ apply_modern_theme()
290
+ return True
291
+ return False
292
+
293
+
294
+ # Export public API for potential future use
295
+ __all__ = [
296
+ "apply_modern_theme",
297
+ "apply_theme",
298
+ "get_available_themes",
299
+ ]