From 40a33d773be50c0f4f629ef5c8337cc7db9e2ec4 Mon Sep 17 00:00:00 2001 From: Daniel Arroyo Date: Mon, 23 Mar 2026 08:55:48 -0300 Subject: [PATCH] Implement project templates for file generation --- tracker/templates/__init__.py | 154 +++++++++++++++++++++++++++++++++- 1 file changed, 153 insertions(+), 1 deletion(-) diff --git a/tracker/templates/__init__.py b/tracker/templates/__init__.py index 8b73e0c..c781254 100644 --- a/tracker/templates/__init__.py +++ b/tracker/templates/__init__.py @@ -1 +1,153 @@ -"""Templates package.""" +"""Templates package for generating project files.""" + +from datetime import datetime +from typing import Optional + +from tracker.models import Project + + +def get_readme_template(project: Optional[Project] = None) -> str: + """Get the README.md template for a project. + + Args: + project: Optional project instance for personalization. + + Returns: + README.md template string. + """ + name = project.name if project else "Project Name" + description = project.description if project else "_No description_" + status = project.status if project else "inbox" + + return f"""# {name} + +{description} + +## Objective + +_TODO: Define objective_ + +## Status + +**Current Status:** {status} + + +Status: {status} + + +## Context + +_Current context and background_ + +## Stack / Tools + +- _Tool 1_ +- _Tool 2_ + +## Architecture + +_Brief architecture description_ + +## Technical Decisions + +_No decisions recorded yet_ + +## Risks / Blockers + +_No blockers_ + + + + +## Recent Sessions + + + + +_Last updated: {datetime.now().strftime('%Y-%m-%d')}_ +""" + + +def get_log_template() -> str: + """Get the LOG.md template. + + Returns: + LOG.md template string. + """ + return """# Log + +_Project activity log_ + +""" + + +def get_changelog_template() -> str: + """Get the CHANGELOG.md template. + + Returns: + CHANGELOG.md template string. + """ + return """# Changelog + +_Project changes_ + +""" + + +def get_tasks_template() -> str: + """Get the TASKS.md template. + + Returns: + TASKS.md template string. + """ + return """# Tasks + +## Inbox + +- + +## Next + +- + +## In Progress + +- + +## Blocked + +- + +## Waiting + +- + +## Done + +- +""" + + +def get_meta_template(project: Project) -> dict: + """Get the meta/project.yaml template data. + + Args: + project: Project instance. + + Returns: + Dictionary suitable for YAML serialization. + """ + return { + "id": project.id, + "name": project.name, + "slug": project.slug, + "description": project.description, + "type": project.type, + "status": project.status, + "tags": project.tags, + "root_path": str(project.root_path), + "repo_path": str(project.repo_path) if project.repo_path else None, + "created_at": project.created_at.isoformat(), + "updated_at": project.updated_at.isoformat(), + "last_session_at": None, + }