ostruct-cli 0.8.29__py3-none-any.whl → 1.0.0__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.0.dist-info}/METADATA +230 -127
  43. ostruct_cli-1.0.0.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.0.dist-info}/LICENSE +0 -0
  48. {ostruct_cli-0.8.29.dist-info → ostruct_cli-1.0.0.dist-info}/WHEEL +0 -0
  49. {ostruct_cli-0.8.29.dist-info → ostruct_cli-1.0.0.dist-info}/entry_points.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: ostruct-cli
3
- Version: 0.8.29
3
+ Version: 1.0.0
4
4
  Summary: CLI for OpenAI Structured Output with Multi-Tool Integration
5
5
  Author: Yaniv Golan
6
6
  Author-email: yaniv@golan.name
@@ -10,55 +10,32 @@ Classifier: Programming Language :: Python :: 3.10
10
10
  Classifier: Programming Language :: Python :: 3.11
11
11
  Classifier: Programming Language :: Python :: 3.12
12
12
  Classifier: Programming Language :: Python :: 3.13
13
- Provides-Extra: dev
14
13
  Provides-Extra: docs
15
14
  Provides-Extra: examples
16
- Requires-Dist: anyio[trio] (==3.7.1) ; extra == "dev"
17
15
  Requires-Dist: asyncio-throttle (>=1.0.2,<2.0) ; extra == "examples"
18
- Requires-Dist: black (==24.8.0) ; extra == "dev"
19
- Requires-Dist: build (>=1.2.2.post1,<2.0) ; extra == "dev"
16
+ Requires-Dist: bleach (>=6.0.0,<7.0)
20
17
  Requires-Dist: cachetools (>=5.3.2,<6.0)
21
18
  Requires-Dist: chardet (>=5.0.0,<6.0)
22
19
  Requires-Dist: click (>=8.1.7,<9.0)
23
- Requires-Dist: flake8 (>=6.0,<7.0) ; extra == "dev"
24
- Requires-Dist: flake8-pyproject (>=1.2.3,<2.0) ; extra == "dev"
25
- Requires-Dist: hypothesis (>=6.0.0,<7.0) ; extra == "dev"
26
20
  Requires-Dist: ijson (>=3.2.3,<4.0)
27
21
  Requires-Dist: jinja2 (>=3.1.2,<4.0)
28
22
  Requires-Dist: jsonschema (>=4.23.0,<5.0)
29
- Requires-Dist: mypy (>=1.0,<2.0) ; extra == "dev"
30
- Requires-Dist: myst-parser (>=3.0.0,<4.0) ; extra == "docs"
23
+ Requires-Dist: myst-parser (>=4.0.1,<5.0) ; extra == "docs"
31
24
  Requires-Dist: openai (==1.81.0)
32
25
  Requires-Dist: openai-model-registry (>=0.7.0,<1.0)
33
- Requires-Dist: pre-commit (>=4.1.0,<5.0) ; extra == "dev"
34
- Requires-Dist: psutil (>=7.0.0,<8.0) ; extra == "dev"
35
26
  Requires-Dist: pydantic (>=2.6.3,<3.0)
36
- Requires-Dist: pyfakefs (>=5.7.4,<6.0) ; extra == "dev"
37
27
  Requires-Dist: pygments (>=2.15.0,<3.0)
38
- Requires-Dist: pytest (>=8.3.4,<9.0) ; extra == "dev"
39
- Requires-Dist: pytest-asyncio (>=0.25.2,<1.0) ; extra == "dev"
40
- Requires-Dist: pytest-mock (>=3.14.0,<4.0) ; extra == "dev"
41
- Requires-Dist: pytest-rerunfailures (>=12.0,<13.0) ; extra == "dev"
42
28
  Requires-Dist: python-dotenv (>=1.0.1,<2.0)
43
- Requires-Dist: python-dotenv (>=1.0.1,<2.0) ; extra == "dev"
44
29
  Requires-Dist: pyyaml (>=6.0.2,<7.0)
45
- Requires-Dist: sphinx (>=7.0.0,<8.0) ; extra == "dev"
30
+ Requires-Dist: rich (>=13.0.0,<14.0.0)
31
+ Requires-Dist: rich-click (>=1.8.9,<2.0.0)
46
32
  Requires-Dist: sphinx (>=7.0.0,<8.0) ; extra == "docs"
47
33
  Requires-Dist: sphinx-design (>=0.4.1,<1.0) ; extra == "docs"
48
- Requires-Dist: sphinx-rtd-theme (>=1.0,<2.0) ; extra == "docs"
34
+ Requires-Dist: sphinx-rtd-theme (>=2.0,<3.0) ; extra == "docs"
49
35
  Requires-Dist: tenacity (>=8.2.3,<9.0) ; extra == "examples"
50
36
  Requires-Dist: tiktoken (==0.9.0)
51
37
  Requires-Dist: tomli (>=2.0.1,<3.0) ; (python_version < "3.11") and (extra == "docs")
52
- Requires-Dist: tomli (>=2.0.1,<3.0) ; extra == "dev"
53
38
  Requires-Dist: tomli (>=2.0.1,<3.0) ; python_version < "3.11"
54
- Requires-Dist: twine (>=6.0.1,<7.0) ; extra == "dev"
55
- Requires-Dist: types-cachetools (>=5.5.0.20240820) ; extra == "dev"
56
- Requires-Dist: types-chardet (>=5.0.4.6) ; extra == "dev"
57
- Requires-Dist: types-click (>=7.1.8,<8.0) ; extra == "dev"
58
- Requires-Dist: types-jsonschema (>=4.23.0.20241208) ; extra == "dev"
59
- Requires-Dist: types-pygments (>=2.19.0.20250107) ; extra == "dev"
60
- Requires-Dist: types-pyyaml (>=6.0.12.20241230) ; extra == "dev"
61
- Requires-Dist: types-requests (>=2.32.0.20241016) ; extra == "dev"
62
39
  Requires-Dist: typing-extensions (>=4.9.0,<5.0)
63
40
  Requires-Dist: werkzeug (>=3.1.3,<4.0)
64
41
  Description-Content-Type: text/markdown
@@ -95,7 +72,7 @@ ostruct processes unstructured data (text files, code, CSVs, etc.), input variab
95
72
 
96
73
  <div align="center">
97
74
 
98
- ![How ostruct works](src/assets/ostrict-hl-diagram.png)
75
+ ![How ostruct works](src/assets/ostruct-hl-diagram.png)
99
76
 
100
77
  </div>
101
78
 
@@ -116,11 +93,11 @@ ostruct can be used for various scenarios, including:
116
93
  ### Automated Code Review with Multi-Tool Analysis
117
94
 
118
95
  ```bash
119
- # Traditional pattern matching
120
- ostruct run prompts/task.j2 schemas/code_review.json -p source "examples/security/*.py"
96
+ # Template-only analysis (fast, cost-effective)
97
+ ostruct run prompts/task.j2 schemas/code_review.json --collect source @file-list.txt
121
98
 
122
99
  # Enhanced with Code Interpreter for deeper analysis
123
- ostruct run prompts/task.j2 schemas/code_review.json -fc examples/security/ -fs documentation/
100
+ ostruct run prompts/task.j2 schemas/code_review.json --file ci:code examples/security/ --file fs:docs documentation/
124
101
  ```
125
102
 
126
103
  Analyze code for security vulnerabilities, style issues, and performance problems. The enhanced version uses Code Interpreter for execution analysis and File Search for documentation context.
@@ -130,15 +107,15 @@ Analyze code for security vulnerabilities, style issues, and performance problem
130
107
  ```bash
131
108
  # Budget-friendly static analysis (recommended for most projects)
132
109
  ostruct run prompts/static_analysis.j2 schemas/scan_result.json \
133
- -d code examples -R --sys-file prompts/system.txt
110
+ --dir code examples --pattern "*.py" --sys-file prompts/system.txt
134
111
 
135
112
  # Professional security analysis with Code Interpreter (best balance)
136
113
  ostruct run prompts/code_interpreter.j2 schemas/scan_result.json \
137
- -dc examples --sys-file prompts/system.txt
114
+ --dir ci:code examples --sys-file prompts/system.txt
138
115
 
139
116
  # Comprehensive hybrid analysis for critical applications
140
117
  ostruct run prompts/hybrid_analysis.j2 schemas/scan_result.json \
141
- -d code examples -R -dc examples --sys-file prompts/system.txt
118
+ --dir code examples --dir ci:analysis examples --sys-file prompts/system.txt
142
119
  ```
143
120
 
144
121
  **Three optimized approaches** for automated security vulnerability scanning:
@@ -154,8 +131,8 @@ Each approach finds the same core vulnerabilities but with different levels of d
154
131
  ```bash
155
132
  # Upload data for analysis and visualization
156
133
  ostruct run analysis.j2 schemas/analysis_result.json \
157
- -fc sales_data.csv -fc customer_data.json \
158
- -fs reports/ -ft config.yaml
134
+ --file ci:sales sales_data.csv --file ci:customers customer_data.json \
135
+ --dir fs:reports reports/ --file config config.yaml
159
136
  ```
160
137
 
161
138
  Perform sophisticated data analysis using Python execution, generate visualizations, and create comprehensive reports with document context.
@@ -165,11 +142,11 @@ Perform sophisticated data analysis using Python execution, generate visualizati
165
142
  ```bash
166
143
  # Traditional file comparison
167
144
  ostruct run prompts/task.j2 schemas/validation_result.json \
168
- -f dev examples/basic/dev.yaml -f prod examples/basic/prod.yaml
145
+ --file dev examples/basic/dev.yaml --file prod examples/basic/prod.yaml
169
146
 
170
147
  # Enhanced with environment context
171
148
  ostruct run prompts/task.j2 schemas/validation_result.json \
172
- -ft dev.yaml -ft prod.yaml -fs infrastructure_docs/
149
+ --file dev dev.yaml --file prod prod.yaml --dir fs:docs infrastructure_docs/
173
150
  ```
174
151
 
175
152
  Validate configuration files across environments with documentation context for better analysis and recommendations.
@@ -179,11 +156,40 @@ Oh, and also, among endless other use cases:
179
156
  ### Etymology Analysis
180
157
 
181
158
  ```bash
182
- ostruct run prompts/task.j2 schemas/etymology.json -ft examples/scientific.txt
159
+ ostruct run prompts/task.j2 schemas/etymology.json --file text examples/scientific.txt
183
160
  ```
184
161
 
185
162
  Break down words into their components, showing their origins, meanings, and hierarchical relationships. Useful for linguistics, educational tools, and understanding terminology in specialized fields.
186
163
 
164
+ ### Optional File References
165
+
166
+ ```bash
167
+ # Attach files with aliases
168
+ ostruct run template.j2 schema.json \
169
+ --dir source-code src/ \
170
+ --file config config.yaml
171
+ ```
172
+
173
+ **Two ways to access files in templates:**
174
+
175
+ ```jinja2
176
+ {# Option 1: Automatic XML appendix (optional) #}
177
+ Analyze {{ file_ref("source-code") }} and {{ file_ref("config") }}.
178
+
179
+ {# Option 2: Manual formatting (full control) #}
180
+ ## Source Code
181
+ {% for file in source-code %}
182
+ ### {{ file.name }}
183
+ ```{{ file.name.split('.')[-1] }}
184
+ {{ file.content }}
185
+ ```
186
+
187
+ {% endfor %}
188
+
189
+ ```
190
+
191
+ The optional `file_ref()` function provides clean references with automatic XML appendix generation. Alternatively, access files directly for custom formatting and placement control. Perfect for code reviews, documentation analysis, and multi-file processing workflows.
192
+
187
193
  ## Features
188
194
 
189
195
  ### Core Capabilities
@@ -201,7 +207,7 @@ Break down words into their components, showing their origins, meanings, and hie
201
207
  - **File Search**: Vector-based document search and retrieval from uploaded files
202
208
  - **Web Search**: Real-time information retrieval and current data access via OpenAI's web search tool
203
209
  - **MCP Servers**: Connect to Model Context Protocol servers for extended functionality
204
- - **Explicit File Routing**: Route different files to specific tools for optimized processing
210
+ - **Explicit Tool Targeting**: Route files to specific tools (prompt, code-interpreter, file-search) with precise control
205
211
 
206
212
  ### Advanced Features
207
213
 
@@ -209,6 +215,7 @@ Break down words into their components, showing their origins, meanings, and hie
209
215
  - **Unattended Operation**: Designed for CI/CD and automation scenarios
210
216
  - **Progress Reporting**: Real-time progress updates with clear, user-friendly messaging
211
217
  - **Model Registry**: Dynamic model management with support for latest OpenAI models
218
+ - **Optional File References**: Clean `file_ref()` function for automatic XML appendix, or direct file access for custom formatting
212
219
 
213
220
  ## Requirements
214
221
 
@@ -219,24 +226,33 @@ Break down words into their components, showing their origins, meanings, and hie
219
226
  We provide multiple installation methods to suit different user needs. Choose the one that's right for you.
220
227
 
221
228
  <details>
222
- <summary><strong>Recommended: pipx (Python Users)</strong></summary>
229
+ <summary><strong>Recommended: pipx</strong></summary>
223
230
 
224
- For users who have Python installed, `pipx` is the recommended installation method. It installs `ostruct` in an isolated environment, preventing conflicts with other Python packages.
231
+ `pipx` is the recommended installation method. It installs `ostruct` in an isolated environment, preventing conflicts with other Python packages.
225
232
 
226
- 1. **Install pipx**:
233
+ **macOS (with Homebrew):**
234
+ ```bash
235
+ brew install pipx
236
+ pipx install ostruct-cli # new users
237
+ pipx upgrade ostruct-cli # existing users
238
+ ```
227
239
 
228
- ```bash
229
- python3 -m pip install --user pipx
230
- python3 -m pipx ensurepath
231
- ```
240
+ **Linux (Ubuntu/Debian):**
232
241
 
233
- *(Restart your terminal after running `ensurepath` to update your `PATH`)*
242
+ ```bash
243
+ sudo apt install pipx
244
+ pipx install ostruct-cli # new users
245
+ pipx upgrade ostruct-cli # existing users
246
+ ```
234
247
 
235
- 2. **Install ostruct-cli**:
248
+ **Other systems:**
236
249
 
237
- ```bash
238
- pipx install ostruct-cli
239
- ```
250
+ ```bash
251
+ python3 -m pip install --user pipx
252
+ python3 -m pipx ensurepath
253
+ # Restart your terminal
254
+ pipx install ostruct-cli
255
+ ```
240
256
 
241
257
  </details>
242
258
 
@@ -279,7 +295,7 @@ docker run -it --rm \
279
295
  -v "$(pwd)":/app \
280
296
  -w /app \
281
297
  ghcr.io/yaniv-golan/ostruct:latest \
282
- run template.j2 schema.json -ft input.txt
298
+ run template.j2 schema.json --file config input.txt
283
299
  ```
284
300
 
285
301
  This command mounts the current directory into the container and runs `ostruct`.
@@ -315,12 +331,25 @@ If you plan to contribute to the project, see the [Development Setup](#developme
315
331
 
316
332
  ostruct-cli respects the following environment variables:
317
333
 
334
+ **API Configuration:**
335
+
318
336
  - `OPENAI_API_KEY`: Your OpenAI API key (required unless provided via command line)
319
337
  - `OPENAI_API_BASE`: Custom API base URL (optional)
320
338
  - `OPENAI_API_VERSION`: API version to use (optional)
321
339
  - `OPENAI_API_TYPE`: API type (e.g., "azure") (optional)
340
+
341
+ **System Configuration:**
342
+
322
343
  - `OSTRUCT_DISABLE_REGISTRY_UPDATE_CHECKS`: Set to "1", "true", or "yes" to disable automatic registry update checks
323
- - `MCP_<NAME>_URL`: Custom MCP server URLs (e.g., `MCP_STRIPE_URL=https://mcp.stripe.com`)
344
+ - `OSTRUCT_MCP_URL_<name>`: Custom MCP server URLs (e.g., `OSTRUCT_MCP_URL_stripe=https://mcp.stripe.com`)
345
+
346
+ **Template Processing Limits (Template-only files via `--file alias path`):**
347
+
348
+ - `OSTRUCT_TEMPLATE_FILE_LIMIT`: Maximum individual file size for template access (default: 65536 bytes / 64KB)
349
+ - `OSTRUCT_TEMPLATE_TOTAL_LIMIT`: Maximum total file size for all template files (default: 1048576 bytes / 1MB)
350
+ - `OSTRUCT_TEMPLATE_PREVIEW_LIMIT`: Maximum characters shown in template debugging previews (default: 4096)
351
+
352
+ > **Note**: Template limits only apply to files accessed via `--file alias path` (template-only routing). Files routed to Code Interpreter (`--file ci:`) or File Search (`--file fs:`) are not subject to these limits.
324
353
 
325
354
  **💡 Tip**: ostruct automatically loads `.env` files from the current directory. Environment variables take precedence over `.env` file values.
326
355
 
@@ -365,78 +394,101 @@ Shell completion will help you with:
365
394
 
366
395
  ## Enhanced CLI with Multi-Tool Integration
367
396
 
368
- ### Migration Notice
397
+ ### Breaking Changes in v0.9.0
369
398
 
370
- ostruct now includes powerful multi-tool integration while maintaining **full backward compatibility**. All existing commands continue to work exactly as before, but you can now take advantage of:
399
+ **⚠️ Important:** ostruct v0.9.0 introduces breaking changes to the file attachment system. The legacy file routing syntax has been completely replaced with a new explicit target/alias attachment system.
371
400
 
372
- - **Code Interpreter** for data analysis and visualization
373
- - **File Search** for document retrieval
374
- - **Web Search** for real-time information access
375
- - **MCP Servers** for extended functionality
376
- - **Explicit File Routing** for optimized processing
401
+ **New capabilities in v0.9.0:**
402
+
403
+ - **Explicit Tool Targeting**: Direct control over which tools receive files
404
+ - **Enhanced Security**: Three-tier security modes with path validation
405
+ - **Improved Multi-Tool Integration**: Better file sharing between tools
406
+ - **JSON Help Output**: Programmatic access to command help
407
+ - **Migration Guide**: Automated migration scripts for bulk updates
377
408
 
378
409
  <details>
379
- <summary><strong>New File Routing Options</strong> (Click to expand)</summary>
410
+ <summary><strong>New Attachment System (v0.9.0)</strong> (Click to expand)</summary>
380
411
 
381
- #### Basic File Routing (Explicit Tool Assignment)
412
+ #### Basic File Attachments
382
413
 
383
414
  ```bash
384
- # Template access only (config files, small data)
385
- ostruct run template.j2 schema.json -ft config.yaml
415
+ # Template access only (default - no tool upload)
416
+ ostruct run template.j2 schema.json --file config config.yaml
386
417
 
387
418
  # Code Interpreter (data analysis, code execution)
388
- ostruct run analysis.j2 schema.json -fc data.csv
419
+ ostruct run analysis.j2 schema.json --file ci:data data.csv
389
420
 
390
421
  # File Search (document retrieval)
391
- ostruct run search.j2 schema.json -fs documentation.pdf
392
-
393
- # Web Search (real-time information)
394
- ostruct run research.j2 schema.json --enable-tool web-search -V topic="latest AI developments"
422
+ ostruct run search.j2 schema.json --file fs:docs documentation.pdf
395
423
 
396
- # Multiple tools with one file
397
- ostruct run template.j2 schema.json --file-for code-interpreter shared.json --file-for file-search shared.json
424
+ # Multi-tool attachment (share between tools)
425
+ ostruct run workflow.j2 schema.json --file ci,fs:shared data.json
398
426
  ```
399
427
 
400
- #### Directory Routing
428
+ #### Directory Attachments
401
429
 
402
- ostruct provides two directory routing patterns to match different use cases:
430
+ ```bash
431
+ # Template-only directory access
432
+ ostruct run template.j2 schema.json --dir config ./config
403
433
 
404
- **Auto-Naming Pattern** (for known directory structures):
434
+ # Upload directory to Code Interpreter
435
+ ostruct run analysis.j2 schema.json --dir ci:datasets ./data
405
436
 
406
- ```bash
407
- # Variables are auto-generated from directory contents
408
- ostruct run template.j2 schema.json -dt ./config -dc ./datasets -ds ./docs
409
- # Creates variables like: config_yaml, datasets_csv, docs_pdf (based on actual files)
437
+ # Upload directory to File Search
438
+ ostruct run search.j2 schema.json --dir fs:knowledge ./docs
439
+
440
+ # Directory with file pattern filtering
441
+ ostruct run template.j2 schema.json --dir source ./src --pattern "*.py"
410
442
  ```
411
443
 
412
- **Alias Pattern** (for generic, reusable templates):
444
+ #### File Collections
413
445
 
414
446
  ```bash
415
- # Create stable variable names regardless of directory contents
416
- ostruct run template.j2 schema.json --dta app_config ./config --dca data ./datasets --dsa knowledge ./docs
417
- # Creates stable variables: app_config, data, knowledge (always these names)
447
+ # Process multiple files from list
448
+ ostruct run batch.j2 schema.json --collect files @file-list.txt
449
+
450
+ # Upload collection to Code Interpreter
451
+ ostruct run analyze.j2 schema.json --collect ci:data @datasets.txt
418
452
  ```
419
453
 
420
- **When to Use Each Pattern:**
454
+ #### Tool Targeting
421
455
 
422
- - Use **auto-naming** (`-dt`, `-dc`, `-ds`) when your template knows the specific directory structure
423
- - Use **alias syntax** (`--dta`, `--dca`, `--dsa`) when your template is generic and needs stable variable names
456
+ The new system uses explicit targets for precise control:
424
457
 
425
- **Template Example:**
458
+ - **`prompt`** (default): Template access only, no upload
459
+ - **`code-interpreter`** or **`ci`**: Upload for Python execution and analysis
460
+ - **`file-search`** or **`fs`**: Upload to vector store for document search
461
+ - **Multi-target**: `ci,fs:alias` shares file between multiple tools
426
462
 
427
- ```jinja
428
- {# Works with alias pattern - variables are predictable #}
429
- {% for file in app_config %}
430
- Configuration: {{ file.name }} = {{ file.content }}
431
- {% endfor %}
463
+ #### Development Best Practice: Always Use --dry-run
432
464
 
433
- {# Analysis data from stable variable name #}
434
- {% for file in data %}
435
- Processing: {{ file.path }}
436
- {% endfor %}
465
+ **Validate templates before execution** to catch errors early and save API costs:
466
+
467
+ ```bash
468
+ # 1. Validate everything first (catches binary file issues, template errors)
469
+ ostruct run analysis.j2 schema.json --file ci:data report.xlsx --dry-run
470
+
471
+ # 2. If validation passes, run for real
472
+ ostruct run analysis.j2 schema.json --file ci:data report.xlsx
437
473
  ```
438
474
 
439
- This design pattern makes templates reusable across different projects while maintaining full backward compatibility.
475
+ The `--dry-run` flag performs comprehensive validation including template rendering, catching issues like:
476
+
477
+ - Binary file content access errors
478
+ - Template syntax problems
479
+ - Missing template variables
480
+ - File accessibility issues
481
+
482
+ #### Security Modes
483
+
484
+ ```bash
485
+ # Strict security with explicit allowlists
486
+ ostruct run template.j2 schema.json \
487
+ --path-security strict \
488
+ --allow /safe/directory \
489
+ --allow-file /specific/file.txt \
490
+ --file data input.txt
491
+ ```
440
492
 
441
493
  #### MCP Server Integration
442
494
 
@@ -458,7 +510,7 @@ models:
458
510
  tools:
459
511
  code_interpreter:
460
512
  auto_download: true
461
- output_directory: "./output"
513
+ output_directory: "./downloads"
462
514
  download_strategy: "two_pass_sentinel" # Enable reliable file downloads
463
515
 
464
516
  mcp:
@@ -474,6 +526,44 @@ Load custom configuration:
474
526
  ostruct --config my-config.yaml run template.j2 schema.json
475
527
  ```
476
528
 
529
+ ### Model Validation
530
+
531
+ ostruct automatically validates model names against the OpenAI model registry. Only models that support structured output are available for selection, ensuring compatibility with JSON schema outputs.
532
+
533
+ ```bash
534
+ # See all available models with details
535
+ ostruct list-models
536
+
537
+ # Models are validated at command time
538
+ ostruct run template.j2 schema.json --model invalid-model
539
+ # Error: Invalid model 'invalid-model'. Available models: gpt-4o, gpt-4o-mini, o1 (and 12 more).
540
+ # Run 'ostruct list-models' to see all 15 available models.
541
+
542
+ # Shell completion works with model names
543
+ ostruct run template.j2 schema.json --model <TAB>
544
+ # Shows: gpt-4o gpt-4o-mini o1 o1-mini o3-mini ...
545
+ ```
546
+
547
+ **Model Registry Updates:**
548
+
549
+ The model list is automatically updated when you run `ostruct update-registry`. If you encounter model validation errors, try updating your registry first:
550
+
551
+ ```bash
552
+ # Update model registry
553
+ ostruct update-registry
554
+
555
+ # Check available models
556
+ ostruct list-models
557
+ ```
558
+
559
+ **Migration from Free-form Model Names:**
560
+
561
+ If you have existing scripts with hardcoded model names, they will continue to work as long as the model names are valid. Common issues and solutions:
562
+
563
+ - **Typos**: `gpt4o` → `gpt-4o`
564
+ - **Old names**: `gpt-4-turbo` → `gpt-4o`
565
+ - **Custom names**: Use `ostruct list-models` to see what's available
566
+
477
567
  ### Code Interpreter File Downloads
478
568
 
479
569
  **Important**: If you're using Code Interpreter with structured output (JSON schemas), you may need to enable the two-pass download strategy to ensure files are downloaded reliably.
@@ -482,10 +572,14 @@ ostruct --config my-config.yaml run template.j2 schema.json
482
572
 
483
573
  ```bash
484
574
  # Enable reliable file downloads for this run
485
- ostruct run template.j2 schema.json -fc data.csv --enable-feature ci-download-hack
575
+ ostruct run template.j2 schema.json --file ci:data data.csv --enable-feature ci-download-hack
486
576
 
487
577
  # Force single-pass mode (override config)
488
- ostruct run template.j2 schema.json -fc data.csv --disable-feature ci-download-hack
578
+ ostruct run template.j2 schema.json --file ci:data data.csv --disable-feature ci-download-hack
579
+
580
+ # Handle duplicate output file names
581
+ ostruct run template.j2 schema.json --file ci:data data.csv --ci-duplicate-outputs rename
582
+ ostruct run template.j2 schema.json --file ci:data data.csv --ci-duplicate-outputs skip
489
583
  ```
490
584
 
491
585
  #### Option 2: Configuration File (Recommended for persistent settings)
@@ -497,6 +591,8 @@ tools:
497
591
  download_strategy: "two_pass_sentinel" # Enables reliable file downloads
498
592
  auto_download: true
499
593
  output_directory: "./downloads"
594
+ duplicate_outputs: "rename" # Handle duplicate file names: overwrite|rename|skip
595
+ output_validation: "basic" # Validate downloaded files: basic|strict|off
500
596
  ```
501
597
 
502
598
  **Why this is needed**: OpenAI's structured output mode can prevent file download annotations from being generated. The two-pass strategy works around this by making two API calls: one to generate files (without structured output), then another to ensure schema compliance. For detailed technical information, see [docs/known-issues/2025-06-responses-ci-file-output.md](docs/known-issues/2025-06-responses-ci-file-output.md).
@@ -618,47 +714,54 @@ Provide comprehensive analysis and actionable insights.
618
714
  }
619
715
  ```
620
716
 
621
- 3. For more complex scenarios, use explicit file routing with flexible syntax options:
717
+ 3. Use the new attachment system for precise tool targeting:
622
718
 
623
719
  ```bash
624
- # Auto-naming (fastest for one-off analysis)
720
+ # Basic multi-tool analysis
625
721
  ostruct run analysis_template.j2 analysis_schema.json \
626
- -fc sales_data.csv \
627
- -fc customer_data.json \
628
- -fs market_reports.pdf \
629
- -ft config.yaml
722
+ --file ci:sales sales_data.csv \
723
+ --file ci:customers customer_data.json \
724
+ --file fs:reports market_reports.pdf \
725
+ --file config config.yaml
630
726
 
631
- # Mixed syntax with custom variable names
727
+ # Multi-tool attachment with shared data
632
728
  ostruct run analysis_template.j2 analysis_schema.json \
633
- -fc sales_data.csv \
634
- -fc customers customer_data.json \
635
- --fsa reports market_reports.pdf \
636
- --fta app_config config.yaml
729
+ --file ci,fs:shared_data data.json \
730
+ --file prompt:config settings.yaml
637
731
 
638
- # Alias syntax for reusable templates (best tab completion)
732
+ # Directory-based analysis
639
733
  ostruct run reusable_analysis.j2 analysis_schema.json \
640
- --fca sales_data sales_data.csv \
641
- --fca customer_data customer_data.json \
642
- --fsa market_reports market_reports.pdf \
643
- --fta config config.yaml
734
+ --dir ci:sales_data ./sales \
735
+ --dir fs:documentation ./docs \
736
+ --file config ./config.yaml
644
737
 
645
- # Code review with stable variable names
738
+ # Code review with multiple tool integration
646
739
  ostruct run code_review.j2 review_schema.json \
647
- --fca source_code source_code/ \
648
- --fsa documentation docs/ \
649
- --fta eslint_config .eslintrc.json
740
+ --dir ci:source ./src \
741
+ --dir fs:docs ./documentation \
742
+ --file config .eslintrc.json
650
743
  ```
651
744
 
652
- ### Example 3: Legacy Compatibility
745
+ ### Example 3: Migration from v0.8.x
653
746
 
654
- All existing commands continue to work unchanged:
747
+ Legacy commands need to be updated to the new syntax:
655
748
 
656
749
  ```bash
657
- # Traditional usage (fully supported)
658
- ostruct run extract_from_file.j2 schema.json -f text input.txt -d configs
659
- ostruct run template.j2 schema.json -p "*.py" source -V env=prod
750
+ # Legacy (v0.8.x) - NO LONGER SUPPORTED
751
+ # ostruct run extract_from_file.j2 schema.json --file text input.txt -d configs
752
+
753
+ # New (v0.9.0) - Updated syntax
754
+ ostruct run extract_from_file.j2 schema.json --file text input.txt --dir configs ./configs
755
+
756
+ # Legacy pattern matching - NO LONGER SUPPORTED
757
+ # ostruct run template.j2 schema.json --dir "*.py" source --pattern "*.py" -V env=prod
758
+
759
+ # New pattern matching with directory attachment
760
+ ostruct run template.j2 schema.json --dir source ./source --pattern "*.py" -V env=prod
660
761
  ```
661
762
 
763
+ **Migration Help:** See `MIGRATION_GUIDE.md` for automated migration scripts and detailed examples.
764
+
662
765
  <details>
663
766
  <summary><strong>System Prompt Handling</strong> (Click to expand)</summary>
664
767
 
@@ -0,0 +1,80 @@
1
+ ostruct/__init__.py,sha256=X6zo6V7ZNMv731Wi388aTVQngD1410ExGwGx4J6lpyo,187
2
+ ostruct/cli/__init__.py,sha256=njg70kPnRja8KqP_y93CIWPyeNj8EzH8AhHotn0jJAc,820
3
+ ostruct/cli/attachment_processor.py,sha256=_RcE8tdJ5ey5jsL5UBsOadKrAqBjr71nLqZsv8b2kwg,16469
4
+ ostruct/cli/attachment_template_bridge.py,sha256=iehtZ3AR1QoQP_fQxiVH_jV4z-3bCsfvRkwoMz8DEWs,35058
5
+ ostruct/cli/base_errors.py,sha256=o-877bJJA8yJWISRPy0KyL6wDu1-_avddmQIfVePuFM,5989
6
+ ostruct/cli/cache_manager.py,sha256=ej3KrRfkKKZ_lEp2JswjbJ5bW2ncsvna9NeJu81cqqs,5192
7
+ ostruct/cli/cli.py,sha256=RCHjwx2mbRx9N-L1GeMgROqskvipjpwmavVh2z_Etds,8746
8
+ ostruct/cli/click_options.py,sha256=NFcs6amLBtVLOjR6smNbGmDHwBpAXrpxQy5KCiLKPo4,34203
9
+ ostruct/cli/code_interpreter.py,sha256=M8gyPy17s5lu8TsvXMDes4wi78iwqz_yoAQ4axeuhwM,23264
10
+ ostruct/cli/commands/__init__.py,sha256=KuEoh7UF9CWis3VHZ6LAwoRcZrpG8oq9VSQRl1NjEo8,622
11
+ ostruct/cli/commands/list_models.py,sha256=yeuQpUGAmRr4uOHS7teuVHkC9dkqN0yKDOEw_n-ehi0,4662
12
+ ostruct/cli/commands/run.py,sha256=oq2ZXCQehFJnUV34nC9TEaJL8Qb2aZrHAoLu0x3TR2M,16805
13
+ ostruct/cli/commands/update_registry.py,sha256=7DQrPlCJScPVgE2HbFAM7UMap-EdYu58AQWfpI-H7Gw,2483
14
+ ostruct/cli/config.py,sha256=KxkJGxvRiiDr7oinwZVaDqtzRcYyQZ1xcoCtvykq6F4,10143
15
+ ostruct/cli/constants.py,sha256=zyUwq4fladlCsfPnBPh7rSqfSwarbCL3I5HM1dIEf6I,2467
16
+ ostruct/cli/cost_estimation.py,sha256=08hyE-kM5QYzj7y-KB3lMD_RxCMoM_Ve3-IQlSpJAo4,4483
17
+ ostruct/cli/errors.py,sha256=vqdkGx2Znze61ms6BByOYg4D3ScBEK7OFP73PeJJufo,30865
18
+ ostruct/cli/exit_codes.py,sha256=gdvB1dpu0LalEUZrofpk5K6aTQ24n5AfkAK5umludHU,365
19
+ ostruct/cli/explicit_file_processor.py,sha256=mKYQCW4bodk8Ida0sGw8m5MmbiaMCAYvoHUXzU1KDSE,19210
20
+ ostruct/cli/field_utils.py,sha256=bcRi1qQ0Ac2UCfrKSQ677_yu-VzaShm_zN7QLf98qc0,1939
21
+ ostruct/cli/file_info.py,sha256=rNQSkUDUL3qbalovRu1unTixLVDzJ0HU01eFQYlMXlM,21443
22
+ ostruct/cli/file_list.py,sha256=AmnQnXyI1djVbp_pv2VwK2VAqZQpSiTIXPbwu3_wCRQ,23431
23
+ ostruct/cli/file_search.py,sha256=6JvThbrauznfr-nX4M_VG7kRQbSLG9YOQomLR9_IqPE,17566
24
+ ostruct/cli/file_utils.py,sha256=JZprQ-1LHQzI3eBfeCIS6VmxTa2fGUZHygGC8gcwpJM,24367
25
+ ostruct/cli/help_json.py,sha256=IDArJBtPTTMM2KVt36t1PBY72totKH9tVAsRnPuEPcA,8223
26
+ ostruct/cli/json_extract.py,sha256=ZleIxat8g-JnA9VVqWgJaKxN7QzL25itQ8aP0Gb5e4Q,2650
27
+ ostruct/cli/mcp_integration.py,sha256=zC24TZScr-Vio2Zq0lPBJVmATVWoIm2pfWwnO3ztQJ8,18791
28
+ ostruct/cli/model_creation.py,sha256=HGo8Qv7eBF8Co463IR7RcbTCQcaOvd_cBGuRodRCAa4,23261
29
+ ostruct/cli/model_validation.py,sha256=j2az3q88-Ljm2cMMgZ8p_-gcp1vKQnWCknnw0y0YlAw,6675
30
+ ostruct/cli/params.py,sha256=D4j_I6vZYN-lOeqHWyAmLSxAT3u77CUXVvf6sx27Uvo,6353
31
+ ostruct/cli/path_utils.py,sha256=j44q1OoLkqMErgK-qEuhuIZ1VyzqRIvNgxR1et9PoXA,4813
32
+ ostruct/cli/plan_assembly.py,sha256=pCz2fH3MNbUVODMw43_fb-e61vgo5N0GBrZ1VlShs1M,11656
33
+ ostruct/cli/plan_printing.py,sha256=_OSrnaLKi0nLdSSHnf6exaIhJT5YPedKh_8nYgqkluI,12837
34
+ ostruct/cli/progress.py,sha256=rj9nVEco5UeZORMbzd7mFJpFGJjbH9KbBFh5oTE5Anw,3415
35
+ ostruct/cli/progress_reporting.py,sha256=cQoMsRCBlIdRIefGwpBEX744H9pfpD5TdT8sB180hfI,11665
36
+ ostruct/cli/quick_ref_help.py,sha256=_AWPcdxDj9v6DOX6yecahv7dfV38-TwB4sK5HsWmIbo,5014
37
+ ostruct/cli/registry_updates.py,sha256=ohiHdlfrocvThpR_ZjMyqulDKFjRM1hIFKOlNzpaqHg,5138
38
+ ostruct/cli/rich_config.py,sha256=DChXWG97pQRm_QZCTdOIpBhvuIfJXDlqT48vnBdnYKc,9904
39
+ ostruct/cli/runner.py,sha256=a7Zkp4Wn9x6sMmtVtGEwLQ8i8ctTvKo2w36n6WpbuLM,74672
40
+ ostruct/cli/schema_utils.py,sha256=9LnsjxEKg6RIfXQB3nS3pyDggm5n-4-thXf92897gJU,3590
41
+ ostruct/cli/schema_validation.py,sha256=ohEuxJ0KF93qphj0JSZDnrxDn0C2ZU37g-U2JY03onM,8154
42
+ ostruct/cli/security/__init__.py,sha256=Ix0AXDgxJaR0TtR-sG1353DtUF1BPujgjcaA28Cvgh4,898
43
+ ostruct/cli/security/allowed_checker.py,sha256=ceNUEDiTirClq9Kvosytlm01JWj0J37JdiRzLsw3zD8,3462
44
+ ostruct/cli/security/base.py,sha256=q9YUdHEj2eg5w8GEw5403E9OQKIjZbEiaWsvYFnCGLw,1359
45
+ ostruct/cli/security/case_manager.py,sha256=I_ZJSyntLuGx5qVzze559CI-OxsaNPSibkAN8zZ7PvE,2345
46
+ ostruct/cli/security/errors.py,sha256=8jYJFRQyEXIH3Wd2ATWORVoqbDg7qwu0TsuROpsqNfU,5254
47
+ ostruct/cli/security/normalization.py,sha256=6UoFAl8cbvOUETMauyvmYogaoVhJm9WybGcS84biwh8,5488
48
+ ostruct/cli/security/safe_joiner.py,sha256=PHowCeBAkfHfPqRwuO5Com0OemGuq3cHkdu2p9IYNT0,7107
49
+ ostruct/cli/security/security_manager.py,sha256=VQbWxOp76mm8OCpCTtkzBrBh5nb-dKWQbxdZdZdFShM,36419
50
+ ostruct/cli/security/symlink_resolver.py,sha256=wtZdJ_T_0FOy6B1P5ty1odEXQk9vr8BzlWeAFD4huJE,16744
51
+ ostruct/cli/security/types.py,sha256=38qBfUSaYB0NXyOq9DytTg4OnievLSsA4ysI88YdaFY,3545
52
+ ostruct/cli/security/windows_paths.py,sha256=qxC2H2kLwtmQ7YePYde3UrmOJcGnsLEebDLh242sUaI,13453
53
+ ostruct/cli/sentinel.py,sha256=69faYPrhVJmEpYNLsCtf1HF96aan3APqXZdIjxBNZYo,798
54
+ ostruct/cli/serialization.py,sha256=ec0UswDE2onwtZVUoZaMCsGv6zW_tSKdBng2qVo6Ucs,704
55
+ ostruct/cli/services.py,sha256=nLYUbF3DDNuilh7j9q_atUOjTAWta7bxTS3G-zkveaA,21621
56
+ ostruct/cli/template_debug.py,sha256=PEU9w10lIWPaMHbY2_uPr2HwM3154V1aIJ8mc_A5rSQ,25283
57
+ ostruct/cli/template_debug_help.py,sha256=KqKYFIbE81HxTHWT-A2naLdk8PUsTNHTXkLusleGUD4,9178
58
+ ostruct/cli/template_env.py,sha256=mxJPoA4DwbJKQIg2wLmqEsXarR1HrDiR8PhwKNKnAEQ,3535
59
+ ostruct/cli/template_extensions.py,sha256=_lomtDGMGxMfpw05v_-daJ0JbhRm_r_-uEJlPAjbpkI,2699
60
+ ostruct/cli/template_filters.py,sha256=ulo5jRo62zmkApYvDUjO5imUS5osec7eoeYwJsbuMKk,34566
61
+ ostruct/cli/template_io.py,sha256=yUWO-8rZnSdX97DTMSEX8fG9CP1ISsOhm2NZN3Fab9A,8821
62
+ ostruct/cli/template_processor.py,sha256=Y9GMCuA5lASse_AzDCgu8VdcmsAhxQn8qyG546cvBE0,30150
63
+ ostruct/cli/template_rendering.py,sha256=at8RiT9v0peJUBRwDgX1-WJ6pDDMDO0H33MwuWlkowM,15831
64
+ ostruct/cli/template_schema.py,sha256=ckH4rUZnEgfm_BHS9LnMGr8LtDxRmZ0C6UBVrSp8KTc,19604
65
+ ostruct/cli/template_utils.py,sha256=MZdXXjL-x-IXX-5Y8GWopGNBkDE2ItLdCuCl0QWFR_U,14968
66
+ ostruct/cli/template_validation.py,sha256=3wUBoZJZKt0C5TVaT0nmjH_ehyw4Gn1yEBnMDDE8qLU,14327
67
+ ostruct/cli/token_utils.py,sha256=r4KPEO3Sec18Q6mU0aClK6XGShvusgUggXEQgEPPlaA,1369
68
+ ostruct/cli/token_validation.py,sha256=DGc5yyScy0iTvvuF2DaDUgRQaIqVIcm9ZZtuVEyy_oI,10276
69
+ ostruct/cli/types.py,sha256=qQ5mc4OAK8ChVrgaJ9VSn3gS75byrOonjlsc9WdgibE,2782
70
+ ostruct/cli/unattended_operation.py,sha256=kI95SSVJC_taxORXQYrce_qLEnuKc6edwn9tMOye-qs,9383
71
+ ostruct/cli/unicode_compat.py,sha256=bDeVZdWkDv74jVt4AsBl10tRra0v7kV04SNAMyR3q0U,9508
72
+ ostruct/cli/upload_manager.py,sha256=m8BpVRJc7Ag9Ln5bAQPGMtisHSP0m7VVcXhHnqZ5CjI,16368
73
+ ostruct/cli/utils.py,sha256=DV8KAx46rl3GgXLydVhrP6A1xY7ofyir3hEKUslSfek,2149
74
+ ostruct/cli/validators.py,sha256=SRJozxcXgIdbjF0Jv5z2rSbOzeXiTYpzbZKc_WF-5HE,23882
75
+ ostruct/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
76
+ ostruct_cli-1.0.0.dist-info/LICENSE,sha256=DmGAkaYzhrdzTB9Y2Rvfzd3mJiF9ZrTOhxN8t6wrfHA,1098
77
+ ostruct_cli-1.0.0.dist-info/METADATA,sha256=X6YXB3suiMvexCSUvF0FQUpJk6iotxfF00-F3vmeXqQ,31311
78
+ ostruct_cli-1.0.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
79
+ ostruct_cli-1.0.0.dist-info/entry_points.txt,sha256=NFq9IuqHVTem0j9zKjV8C1si_zGcP1RL6Wbvt9fUDXw,48
80
+ ostruct_cli-1.0.0.dist-info/RECORD,,