Эх сурвалжийг харах

Address code review feedback: clarify docstrings for draft template handling

Co-authored-by: ChristianLempa <28359525+ChristianLempa@users.noreply.github.com>
copilot-swe-agent[bot] 2 сар өмнө
parent
commit
b02609dfdb

+ 8 - 3
cli/core/library.py

@@ -53,17 +53,21 @@ class Library:
             return False
 
     def find_by_id(self, module_name: str, template_id: str) -> tuple[Path, str]:
-        """Find a template by its ID in this library.
+        """Find a template by its ID in this library for generation/show operations.
+
+        Note: Draft templates are intentionally excluded from this method.
+        They are visible in list/search commands (via find()) but cannot be
+        used for generation as they are work-in-progress.
 
         Args:
             module_name: The module name (e.g., 'compose', 'terraform')
             template_id: The template ID to find
 
         Returns:
-            Path to the template directory if found
+            Path to the template directory if found and not draft
 
         Raises:
-            FileNotFoundError: If the template ID is not found in this library or is marked as draft
+            TemplateNotFoundError: If the template ID is not found in this library or is marked as draft
         """
         logger.debug(f"Looking for template '{template_id}' in module '{module_name}' in library '{self.name}'")
 
@@ -75,6 +79,7 @@ class Library:
             (template_path / f).exists() for f in ("template.yaml", "template.yml")
         )
 
+        # Draft templates are not available for generation/show operations
         if not has_template or self._is_template_draft(template_path):
             raise TemplateNotFoundError(template_id, module_name)
 

+ 5 - 1
cli/core/template/template.py

@@ -919,7 +919,11 @@ class Template:
         """Get the status of the template.
 
         Returns:
-            Status string: 'published', 'draft', or 'invalid'
+            Status string: 'published' or 'draft'
+
+        Note:
+            The 'invalid' status is reserved for future use when template validation
+            is implemented without impacting list command performance.
         """
         # Check if template is marked as draft in metadata
         if self.metadata.draft: