fix(api): multi-project manifest lists projects even with zero indexed files
This commit is contained in:
@@ -127,14 +127,22 @@ async def build_brief_multi_project_manifest() -> str:
|
|||||||
if not projects:
|
if not projects:
|
||||||
return ""
|
return ""
|
||||||
blocks: list[str] = ["<linked_folders>"]
|
blocks: list[str] = ["<linked_folders>"]
|
||||||
|
any_entry = False
|
||||||
for p in projects:
|
for p in projects:
|
||||||
files = sorted(p.get("files", []), key=lambda f: f.get("mtimeMs", 0), reverse=True)[:5]
|
all_files = p.get("files", []) or []
|
||||||
if not files:
|
files = sorted(all_files, key=lambda f: f.get("mtimeMs", 0), reverse=True)[:5]
|
||||||
continue
|
|
||||||
blocks.append(f"project: {p.get('projectName','?')} [{p.get('projectId','?')}]")
|
blocks.append(f"project: {p.get('projectName','?')} [{p.get('projectId','?')}]")
|
||||||
blocks.append(f" path: {p.get('folderPath','?')} (scanned {p.get('lastScannedAt','?')})")
|
blocks.append(f" path: {p.get('folderPath','?')} (scanned {p.get('lastScannedAt','?')})")
|
||||||
for f in files:
|
if not all_files:
|
||||||
blocks.append(f" - /{f['relPath']} [{f.get('kind','text')}] {f.get('summary','')}")
|
blocks.append(" (no indexed files yet — folder is linked but empty or unscanned)")
|
||||||
|
else:
|
||||||
|
for f in files:
|
||||||
|
blocks.append(f" - /{f['relPath']} [{f.get('kind','text')}] {f.get('summary','')}")
|
||||||
|
if len(all_files) > 5:
|
||||||
|
blocks.append(f" … {len(all_files) - 5} more files (use read_project_folder_file by relPath)")
|
||||||
|
any_entry = True
|
||||||
|
if not any_entry:
|
||||||
|
return ""
|
||||||
blocks.append("</linked_folders>")
|
blocks.append("</linked_folders>")
|
||||||
return "\n".join(blocks)
|
return "\n".join(blocks)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user