Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions example/structure.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
structure:
- README.md:
skip: true
content: |
# {{@ project_name @}}
This is a template repository.
Expand Down
5 changes: 3 additions & 2 deletions struct_module/commands/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def _validate_folders_config(self, folders):
raise ValueError(f"The content of '{name}' must be a dictionary.")
if 'struct' not in content:
raise ValueError(f"Dictionary item '{name}' must contain a 'struct' key.")
if not isinstance(content['struct'], str):
if not isinstance(content['struct'], str) and not isinstance(content['struct'], list):
raise ValueError(f"The 'struct' value for '{name}' must be a string.")


Expand Down Expand Up @@ -104,7 +104,8 @@ def _validate_structure_config(self, structure):
# Check if 'prompt' key is present and its value is a string
if 'prompt' in content and not isinstance(content['prompt'], str):
raise ValueError(f"The 'prompt' value for '{name}' must be a string.")
# Check if 'prompt' key is present but no OpenAI API key is found
if 'skip' in content and not isinstance(content['skip'], bool):
raise ValueError(f"The 'skip' value for '{name}' must be a string.")
elif not isinstance(content, str):
raise ValueError(f"The content of '{name}' must be a string or dictionary.")
self.logger.info("Configuration validation passed.")
6 changes: 6 additions & 0 deletions struct_module/file_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def __init__(self, properties):
self.content_location = properties.get("file")
self.permissions = properties.get("permissions")
self.input_store = properties.get("input_store")
self.skip = properties.get("skip", False)

self.system_prompt = properties.get("system_prompt") or properties.get("global_system_prompt")
self.user_prompt = properties.get("user_prompt")
Expand Down Expand Up @@ -118,6 +119,11 @@ def apply_template_variables(self, template_vars):

def create(self, base_path, dry_run=False, backup_path=None, file_strategy='overwrite'):
file_path = os.path.join(base_path, self.name)

if self.skip:
self.logger.info(f"Skipping file creation: {file_path}")
return

if dry_run:
self.logger.info(f"[DRY RUN] Would create file: {file_path} with content: \n\n{self.content}")
return
Expand Down
Loading