File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -16,15 +16,23 @@ class TemplatedPrompt:
1616
1717 @classmethod
1818 def parse (cls , name : str , * args : str ) -> Self :
19+ """Parse arguments into a TemplatedPrompt.
20+
21+ Args:
22+ name: The name of the template.
23+ *args: Additional arguments for context, expected in 'key=value' format.
24+ """
1925 return cls (name , dict (e .split ("=" , 1 ) for e in args ))
2026
2127
2228class PromptRenderer :
29+ """Renderer for prompt templates using Jinja2"""
30+
2331 def __init__ (self , env : jinja2 .Environment ) -> None :
2432 self ._environment = env
2533
2634 @classmethod
27- def for_repo (cls , repo : git .Repo ):
35+ def for_repo (cls , repo : git .Repo ) -> Self :
2836 env = jinja2 .Environment (
2937 auto_reload = False ,
3038 autoescape = False ,
@@ -35,7 +43,7 @@ def for_repo(cls, repo: git.Repo):
3543 undefined = jinja2 .StrictUndefined ,
3644 )
3745 env .globals ["repo" ] = {
38- "file_paths" : repo .git .ls_files (),
46+ "file_paths" : repo .git .ls_files (). splitlines () ,
3947 }
4048 return cls (env )
4149
Original file line number Diff line number Diff line change 11For reference, here is the list of all currently available files in the
22repository:
33
4- {% for path in repo .file_paths %}
4+ {% for path in repo .file_paths - %}
55 * {{ path }}
66{% endfor %}
You can’t perform that action at this time.
0 commit comments