Improve project/task/sub-task workflows across backend and web
Backend: - notes.py: add parent_id filter to list_notes() - routes/notes.py: expose project_id, milestone_id, parent_id, type query params on GET /api/notes - milestones.py: add find_milestone_by_title() (cross-project search) - tools.py: list_notes project filter + updated_at; list_tasks milestone without project; tag_mode default add; fail-fast project resolution Web frontend: - TaskEditorView: add sub-tasks section (fetch, toggle, create inline); pre-fill projectId/milestoneId/parentId from URL query params on new task - ProjectView: add + button in Todo kanban column header linking to /tasks/new?projectId=X&milestoneId=Y for quick task creation Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -216,7 +216,7 @@ _CORE_TOOLS = [
|
||||
"name": "list_notes",
|
||||
"description": (
|
||||
"Browse the user's notes (not tasks). Use this when the user asks to see, list, or browse "
|
||||
"their notes — by recency, keyword, or tag. For tasks, use list_tasks instead."
|
||||
"their notes — by recency, keyword, tag, or project. For tasks, use list_tasks instead."
|
||||
),
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
@@ -230,6 +230,10 @@ _CORE_TOOLS = [
|
||||
"items": {"type": "string"},
|
||||
"description": "Filter notes that have ALL of these tags",
|
||||
},
|
||||
"project": {
|
||||
"type": "string",
|
||||
"description": "Filter notes by project name",
|
||||
},
|
||||
"sort": {
|
||||
"type": "string",
|
||||
"enum": ["updated_at", "created_at", "title"],
|
||||
@@ -904,6 +908,7 @@ async def execute_tool(user_id: int, tool_name: str, arguments: dict) -> dict:
|
||||
project_id = None
|
||||
milestone_id = None
|
||||
project_name = arguments.get("project")
|
||||
milestone_name = arguments.get("milestone")
|
||||
if project_name:
|
||||
from fabledassistant.services.projects import get_project_by_title, list_projects as _lp
|
||||
proj = await get_project_by_title(user_id, project_name)
|
||||
@@ -914,12 +919,17 @@ async def execute_tool(user_id: int, tool_name: str, arguments: dict) -> dict:
|
||||
proj = matches[0]
|
||||
if proj:
|
||||
project_id = proj.id
|
||||
milestone_name = arguments.get("milestone")
|
||||
if milestone_name:
|
||||
from fabledassistant.services.milestones import get_milestone_by_title
|
||||
ms = await get_milestone_by_title(user_id, proj.id, milestone_name)
|
||||
if ms:
|
||||
milestone_id = ms.id
|
||||
elif milestone_name:
|
||||
# No project specified — search milestone by name across all projects
|
||||
from fabledassistant.services.milestones import find_milestone_by_title
|
||||
ms = await find_milestone_by_title(user_id, milestone_name)
|
||||
if ms:
|
||||
milestone_id = ms.id
|
||||
notes, total = await list_notes(
|
||||
user_id=user_id,
|
||||
is_task=True,
|
||||
@@ -1097,11 +1107,24 @@ async def execute_tool(user_id: int, tool_name: str, arguments: dict) -> dict:
|
||||
elif tool_name == "list_notes":
|
||||
tags_raw = arguments.get("tags")
|
||||
tags = tags_raw if isinstance(tags_raw, list) else None
|
||||
project_id = None
|
||||
project_name = arguments.get("project")
|
||||
if project_name:
|
||||
from fabledassistant.services.projects import get_project_by_title as _gpbt, list_projects as _lp
|
||||
proj = await _gpbt(user_id, project_name)
|
||||
if proj is None:
|
||||
all_p = await _lp(user_id)
|
||||
matches = [p for p in all_p if project_name.lower() in p.title.lower()]
|
||||
proj = matches[0] if matches else None
|
||||
if proj is None:
|
||||
return {"success": False, "error": f"Project '{project_name}' not found."}
|
||||
project_id = proj.id
|
||||
notes, total = await list_notes(
|
||||
user_id=user_id,
|
||||
q=arguments.get("q") or arguments.get("query"),
|
||||
tags=tags,
|
||||
is_task=False,
|
||||
project_id=project_id,
|
||||
sort=arguments.get("sort", "updated_at"),
|
||||
order="desc",
|
||||
limit=int(arguments.get("limit", 10)),
|
||||
@@ -1111,6 +1134,7 @@ async def execute_tool(user_id: int, tool_name: str, arguments: dict) -> dict:
|
||||
"id": n.id,
|
||||
"title": n.title,
|
||||
"tags": n.tags or [],
|
||||
"updated_at": n.updated_at.isoformat(),
|
||||
"preview": (n.body[:200] + "...") if n.body and len(n.body) > 200 else (n.body or ""),
|
||||
}
|
||||
for n in notes
|
||||
|
||||
Reference in New Issue
Block a user