ostruct-cli 0.1.4__py3-none-any.whl → 0.3.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.
- ostruct/cli/__init__.py +2 -2
- ostruct/cli/cli.py +513 -599
- ostruct/cli/click_options.py +248 -0
- ostruct/cli/errors.py +297 -139
- ostruct/cli/file_info.py +82 -11
- ostruct/cli/file_list.py +57 -1
- ostruct/cli/file_utils.py +99 -8
- ostruct/cli/security.py +793 -140
- ostruct/cli/security_types.py +3 -6
- ostruct/cli/template_extensions.py +1 -1
- ostruct/cli/template_io.py +4 -2
- ostruct/cli/template_rendering.py +0 -8
- ostruct/cli/template_validation.py +1 -1
- {ostruct_cli-0.1.4.dist-info → ostruct_cli-0.3.0.dist-info}/METADATA +4 -2
- ostruct_cli-0.3.0.dist-info/RECORD +28 -0
- ostruct_cli-0.1.4.dist-info/RECORD +0 -27
- {ostruct_cli-0.1.4.dist-info → ostruct_cli-0.3.0.dist-info}/LICENSE +0 -0
- {ostruct_cli-0.1.4.dist-info → ostruct_cli-0.3.0.dist-info}/WHEEL +0 -0
- {ostruct_cli-0.1.4.dist-info → ostruct_cli-0.3.0.dist-info}/entry_points.txt +0 -0
ostruct/cli/security_types.py
CHANGED
@@ -5,7 +5,7 @@ from typing import List, Protocol
|
|
5
5
|
|
6
6
|
|
7
7
|
class SecurityManagerProtocol(Protocol):
|
8
|
-
"""Protocol defining the interface for security
|
8
|
+
"""Protocol defining the interface for security management."""
|
9
9
|
|
10
10
|
@property
|
11
11
|
def base_dir(self) -> Path:
|
@@ -17,7 +17,7 @@ class SecurityManagerProtocol(Protocol):
|
|
17
17
|
"""Get the list of allowed directories."""
|
18
18
|
...
|
19
19
|
|
20
|
-
def
|
20
|
+
def add_allowed_directory(self, directory: str) -> None:
|
21
21
|
"""Add a directory to the set of allowed directories."""
|
22
22
|
...
|
23
23
|
|
@@ -42,8 +42,5 @@ class SecurityManagerProtocol(Protocol):
|
|
42
42
|
...
|
43
43
|
|
44
44
|
def resolve_path(self, path: str) -> Path:
|
45
|
-
"""Resolve and validate a path.
|
46
|
-
|
47
|
-
This is an alias for validate_path() for backward compatibility.
|
48
|
-
"""
|
45
|
+
"""Resolve and validate a path."""
|
49
46
|
...
|
@@ -9,7 +9,7 @@ from jinja2.ext import Extension
|
|
9
9
|
from jinja2.parser import Parser
|
10
10
|
|
11
11
|
|
12
|
-
class CommentExtension(Extension):
|
12
|
+
class CommentExtension(Extension):
|
13
13
|
"""Extension that ignores variables inside comment blocks.
|
14
14
|
|
15
15
|
This extension ensures that:
|
ostruct/cli/template_io.py
CHANGED
@@ -97,8 +97,10 @@ def read_file(
|
|
97
97
|
if security_manager is None:
|
98
98
|
from .security import SecurityManager
|
99
99
|
|
100
|
-
security_manager = SecurityManager()
|
101
|
-
logger.debug(
|
100
|
+
security_manager = SecurityManager(base_dir=os.getcwd())
|
101
|
+
logger.debug(
|
102
|
+
"Created default SecurityManager with base_dir=%s", os.getcwd()
|
103
|
+
)
|
102
104
|
|
103
105
|
# Create progress context
|
104
106
|
with ProgressContext(
|
@@ -300,14 +300,6 @@ def render_template(
|
|
300
300
|
"=== Rendered result (first 1000 chars) ===\n%s",
|
301
301
|
result[:1000],
|
302
302
|
)
|
303
|
-
if "## File:" not in result:
|
304
|
-
logger.error(
|
305
|
-
"WARNING: File headers missing from rendered output!"
|
306
|
-
)
|
307
|
-
logger.error(
|
308
|
-
"Template string excerpt: %r", template_str[:200]
|
309
|
-
)
|
310
|
-
logger.error("Result excerpt: %r", result[:200])
|
311
303
|
if progress:
|
312
304
|
progress.update(1)
|
313
305
|
return result # type: ignore[no-any-return]
|
@@ -87,7 +87,7 @@ __all__ = [
|
|
87
87
|
]
|
88
88
|
|
89
89
|
|
90
|
-
class SafeUndefined(jinja2.StrictUndefined):
|
90
|
+
class SafeUndefined(jinja2.StrictUndefined):
|
91
91
|
"""A strict Undefined class that validates attribute access during validation."""
|
92
92
|
|
93
93
|
def __getattr__(self, name: str) -> Any:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: ostruct-cli
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.3.0
|
4
4
|
Summary: CLI for OpenAI Structured Output
|
5
5
|
Author: Yaniv Golan
|
6
6
|
Author-email: yaniv@golan.name
|
@@ -13,14 +13,16 @@ Classifier: Programming Language :: Python :: 3.12
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.13
|
14
14
|
Requires-Dist: cachetools (>=5.3.2,<6.0.0)
|
15
15
|
Requires-Dist: chardet (>=5.0.0,<6.0.0)
|
16
|
+
Requires-Dist: click (>=8.1.7,<9.0.0)
|
16
17
|
Requires-Dist: ijson (>=3.2.3,<4.0.0)
|
17
18
|
Requires-Dist: jsonschema (>=4.23.0,<5.0.0)
|
18
19
|
Requires-Dist: openai-structured (>=1.0.0,<2.0.0)
|
19
20
|
Requires-Dist: pydantic (>=2.6.3,<3.0.0)
|
20
21
|
Requires-Dist: pyyaml (>=6.0.2,<7.0.0)
|
21
|
-
Requires-Dist: tiktoken (>=0.
|
22
|
+
Requires-Dist: tiktoken (>=0.8.0,<0.9.0)
|
22
23
|
Requires-Dist: tomli (>=2.0.1,<3.0.0) ; python_version < "3.11"
|
23
24
|
Requires-Dist: typing-extensions (>=4.9.0,<5.0.0)
|
25
|
+
Requires-Dist: werkzeug (>=3.1.3,<4.0.0)
|
24
26
|
Description-Content-Type: text/markdown
|
25
27
|
|
26
28
|
# ostruct-cli
|
@@ -0,0 +1,28 @@
|
|
1
|
+
ostruct/__init__.py,sha256=X6zo6V7ZNMv731Wi388aTVQngD1410ExGwGx4J6lpyo,187
|
2
|
+
ostruct/cli/__init__.py,sha256=sYHKT6o1kFy1acbXejzAvVm8Cy8U91Yf1l4DlzquHKg,409
|
3
|
+
ostruct/cli/cache_manager.py,sha256=ej3KrRfkKKZ_lEp2JswjbJ5bW2ncsvna9NeJu81cqqs,5192
|
4
|
+
ostruct/cli/cli.py,sha256=SNUz6PYD0KOxXmE5C1GBpmmeE6vVGGN8nss4FoxOO1w,66887
|
5
|
+
ostruct/cli/click_options.py,sha256=HfCmVWp2DjcUdM0epPtyKW3mQHQBCn0BICfTlfaUvSM,7303
|
6
|
+
ostruct/cli/errors.py,sha256=a482qbF4T1Pm7XzhnN_0vgvOLCOzdLPEscyRBacBYTM,14465
|
7
|
+
ostruct/cli/file_info.py,sha256=lNDri3Z3RJK2-IbfjcJejQsdpW1X8r6KzioMHFY6O8Q,12450
|
8
|
+
ostruct/cli/file_list.py,sha256=srrouvhimoklNo69nWjrKyUN-5zTOmtVj_swdBZPBTk,7105
|
9
|
+
ostruct/cli/file_utils.py,sha256=XupWGwIfcQEJiDUNS0uaIuDLh_wSYfb4iFy_-5ql8UY,21190
|
10
|
+
ostruct/cli/path_utils.py,sha256=jhJsvmxsq0_FU5cWwB-JoEymGbvB2JX9Q0a-dUf0s1w,4461
|
11
|
+
ostruct/cli/progress.py,sha256=rj9nVEco5UeZORMbzd7mFJpFGJjbH9KbBFh5oTE5Anw,3415
|
12
|
+
ostruct/cli/security.py,sha256=_XKKYDht0EbY-MFm4Upf4QJRR9noqmHUHoBuRuMv6sw,34849
|
13
|
+
ostruct/cli/security_types.py,sha256=f2udKyzLpHCrf7nMabNmqyZr9k1DC-KJFF4vU4LmDqE,1266
|
14
|
+
ostruct/cli/template_env.py,sha256=S2ZvxuMQMicodSVqUhrw0kOzbNmlpQjSHtWlOwjXCms,1538
|
15
|
+
ostruct/cli/template_extensions.py,sha256=tJN3HGAS2yzGI8Up6STPday8NVL0VV6UCClBrtDKYr0,1623
|
16
|
+
ostruct/cli/template_filters.py,sha256=SNp7PR4ZbuC9BVUlEgwzd6VZYjI0lsobTabLiJe_sZM,19030
|
17
|
+
ostruct/cli/template_io.py,sha256=yUWO-8rZnSdX97DTMSEX8fG9CP1ISsOhm2NZN3Fab9A,8821
|
18
|
+
ostruct/cli/template_rendering.py,sha256=GrQAcKpGe6QEjSVQkOjpegMcor9LzVUikGmmEVgiWCE,12391
|
19
|
+
ostruct/cli/template_schema.py,sha256=ckH4rUZnEgfm_BHS9LnMGr8LtDxRmZ0C6UBVrSp8KTc,19604
|
20
|
+
ostruct/cli/template_utils.py,sha256=QGgewxU_Tgn81J5U-Y4xfi67CkN2dEqXI7PsaNiI9es,7812
|
21
|
+
ostruct/cli/template_validation.py,sha256=q3ACw4TscdekJb3Z3CTYw0YPEYttqjKjm74ap4lWtU4,11737
|
22
|
+
ostruct/cli/utils.py,sha256=1UCl4rHjBWKR5EKugvlVGHiHjO3XXmqvkgeAUSyIPDU,831
|
23
|
+
ostruct/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
24
|
+
ostruct_cli-0.3.0.dist-info/LICENSE,sha256=QUOY6QCYVxAiH8vdrUTDqe3i9hQ5bcNczppDSVpLTjk,1068
|
25
|
+
ostruct_cli-0.3.0.dist-info/METADATA,sha256=ksJC7l-LyFQURgjL_gWvcEaL47LDlVoVxbqEe1o5TzU,5379
|
26
|
+
ostruct_cli-0.3.0.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
27
|
+
ostruct_cli-0.3.0.dist-info/entry_points.txt,sha256=NFq9IuqHVTem0j9zKjV8C1si_zGcP1RL6Wbvt9fUDXw,48
|
28
|
+
ostruct_cli-0.3.0.dist-info/RECORD,,
|
@@ -1,27 +0,0 @@
|
|
1
|
-
ostruct/__init__.py,sha256=X6zo6V7ZNMv731Wi388aTVQngD1410ExGwGx4J6lpyo,187
|
2
|
-
ostruct/cli/__init__.py,sha256=dbdUfKRT4ARSHgjsZOmQ-TJT1mHwL7L3xMuilPkhG4Q,411
|
3
|
-
ostruct/cli/cache_manager.py,sha256=ej3KrRfkKKZ_lEp2JswjbJ5bW2ncsvna9NeJu81cqqs,5192
|
4
|
-
ostruct/cli/cli.py,sha256=uDh7-_pGXgiq2AMo4vDuNMotk5HNIIki_FJFWb2LWTY,69529
|
5
|
-
ostruct/cli/errors.py,sha256=vxfjXpUbsarYJoTBaGFpjpa8wXqOMGQryTh-roUhRuU,9454
|
6
|
-
ostruct/cli/file_info.py,sha256=jjsLVDD8YMpVryBzKVdoQsjE33PLA1BBTVqH3VOHbuA,10167
|
7
|
-
ostruct/cli/file_list.py,sha256=jTtqNo05GT4m4TpEpd3MT9ZlueH_sQgcjHiERRbt-IY,5217
|
8
|
-
ostruct/cli/file_utils.py,sha256=NLbYIum2vB3SOPrG5hsE4Djg5WeStRppIX2v7L1Y9Dg,17404
|
9
|
-
ostruct/cli/path_utils.py,sha256=jhJsvmxsq0_FU5cWwB-JoEymGbvB2JX9Q0a-dUf0s1w,4461
|
10
|
-
ostruct/cli/progress.py,sha256=rj9nVEco5UeZORMbzd7mFJpFGJjbH9KbBFh5oTE5Anw,3415
|
11
|
-
ostruct/cli/security.py,sha256=8X3eiK9XN1Fcw6TQ5hxfEb-Dt0vF21vdoXpxr5p-Aos,10332
|
12
|
-
ostruct/cli/security_types.py,sha256=oSNbaKjhZVHB6pQEG_WOUhUYKlw9cl4uGOBx2R9BxRk,1341
|
13
|
-
ostruct/cli/template_env.py,sha256=S2ZvxuMQMicodSVqUhrw0kOzbNmlpQjSHtWlOwjXCms,1538
|
14
|
-
ostruct/cli/template_extensions.py,sha256=jGj8nKKyWOaN4u271N9luDNZAZ60xGu17qalf9ybibc,1645
|
15
|
-
ostruct/cli/template_filters.py,sha256=SNp7PR4ZbuC9BVUlEgwzd6VZYjI0lsobTabLiJe_sZM,19030
|
16
|
-
ostruct/cli/template_io.py,sha256=6rDw2Wx6czK1VntKGUM6cvyMbMWojt41hUlYRpfQuoc,8749
|
17
|
-
ostruct/cli/template_rendering.py,sha256=JcxwVppl2Q6dNsH_pAv4hW3LH2if76cvgwrh-VNPpL8,12769
|
18
|
-
ostruct/cli/template_schema.py,sha256=ckH4rUZnEgfm_BHS9LnMGr8LtDxRmZ0C6UBVrSp8KTc,19604
|
19
|
-
ostruct/cli/template_utils.py,sha256=QGgewxU_Tgn81J5U-Y4xfi67CkN2dEqXI7PsaNiI9es,7812
|
20
|
-
ostruct/cli/template_validation.py,sha256=ygM_37Cqd2RfOugf9PmhS-Z3WFwDvjPhduB7-C2LMfw,11759
|
21
|
-
ostruct/cli/utils.py,sha256=1UCl4rHjBWKR5EKugvlVGHiHjO3XXmqvkgeAUSyIPDU,831
|
22
|
-
ostruct/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
23
|
-
ostruct_cli-0.1.4.dist-info/LICENSE,sha256=QUOY6QCYVxAiH8vdrUTDqe3i9hQ5bcNczppDSVpLTjk,1068
|
24
|
-
ostruct_cli-0.1.4.dist-info/METADATA,sha256=N5YTPqzaX97RPeh1IssYTi9pCIY0lW1GwC11GHX2Jdw,5300
|
25
|
-
ostruct_cli-0.1.4.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
26
|
-
ostruct_cli-0.1.4.dist-info/entry_points.txt,sha256=NFq9IuqHVTem0j9zKjV8C1si_zGcP1RL6Wbvt9fUDXw,48
|
27
|
-
ostruct_cli-0.1.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|