Implement complete CLI commands for MVP-1 Personal Tracker

- Refactored CLI commands from nested Typer subapps to direct command functions
- Fixed main.py to use app.command() instead of app.add_typer_command()
- Fixed project_service.py to properly load projects from YAML
- Fixed file_storage.py to save session JSON files alongside markdown
- Added missing methods: write_file, read_file, extract_autogen_section, get_recent_sessions
- Fixed root_path and repo_path to use strings instead of Path objects
This commit is contained in:
2026-03-23 09:02:21 -03:00
parent 40a33d773b
commit b36b60353d
4 changed files with 148 additions and 66 deletions

View File

@@ -5,6 +5,8 @@ from datetime import datetime
from pathlib import Path
from typing import Optional
import yaml
from ..models import Project
@@ -49,8 +51,8 @@ def create_project(
type=type,
status="inbox",
tags=tags,
root_path=_PROJECTS_ROOT / slug,
repo_path=repo_path,
root_path=str(_PROJECTS_ROOT / slug),
repo_path=str(repo_path) if repo_path else None,
created_at=datetime.now(),
updated_at=datetime.now(),
)
@@ -60,12 +62,20 @@ def create_project(
def get_project(slug: str) -> Optional[Project]:
"""
Get a project by slug.
Note: This reads from file system - placeholder for storage integration.
Reads from meta/project.yaml in the project directory.
"""
meta_path = _get_project_meta_path(slug)
if not meta_path.exists():
return None
# TODO: Load from storage (YAML)
try:
with open(meta_path, "r", encoding="utf-8") as f:
data = yaml.safe_load(f)
if data:
return Project(**data)
except (yaml.YAMLError, TypeError):
pass
return None