feat: add project_path output to ProjectSource node
ProjectSource now outputs a third value: the project's folder path,
fetched from the new /api/projects/{name} endpoint. Useful for
building paths to files relative to the project directory.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -28,6 +28,7 @@ def register_api_routes(db: ProjectDB) -> None:
|
||||
|
||||
app.add_api_route("/api/projects", _list_projects, methods=["GET"])
|
||||
app.add_api_route("/api/active-project", _get_active_project, methods=["GET"])
|
||||
app.add_api_route("/api/projects/{name}", _get_project, methods=["GET"])
|
||||
app.add_api_route("/api/projects/{name}/files", _list_files, methods=["GET"])
|
||||
app.add_api_route("/api/projects/{name}/files/{file_name}/sequences", _list_sequences, methods=["GET"])
|
||||
app.add_api_route("/api/projects/{name}/files/{file_name}/data", _get_data, methods=["GET"])
|
||||
@@ -52,6 +53,15 @@ def _get_active_project() -> dict[str, Any]:
|
||||
return {"project": config.get("current_project", "")}
|
||||
|
||||
|
||||
def _get_project(name: str) -> dict[str, Any]:
|
||||
db = _get_db()
|
||||
proj = db.get_project(name)
|
||||
if not proj:
|
||||
raise HTTPException(status_code=404, detail=f"Project '{name}' not found")
|
||||
return {"name": proj["name"], "folder_path": proj["folder_path"],
|
||||
"description": proj.get("description", "")}
|
||||
|
||||
|
||||
def _list_files(name: str) -> dict[str, Any]:
|
||||
db = _get_db()
|
||||
files = db.list_project_files(name)
|
||||
|
||||
Reference in New Issue
Block a user