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:
|
||||
return ""
|
||||
blocks: list[str] = ["<linked_folders>"]
|
||||
any_entry = False
|
||||
for p in projects:
|
||||
files = sorted(p.get("files", []), key=lambda f: f.get("mtimeMs", 0), reverse=True)[:5]
|
||||
if not files:
|
||||
continue
|
||||
all_files = p.get("files", []) or []
|
||||
files = sorted(all_files, key=lambda f: f.get("mtimeMs", 0), reverse=True)[:5]
|
||||
blocks.append(f"project: {p.get('projectName','?')} [{p.get('projectId','?')}]")
|
||||
blocks.append(f" path: {p.get('folderPath','?')} (scanned {p.get('lastScannedAt','?')})")
|
||||
for f in files:
|
||||
blocks.append(f" - /{f['relPath']} [{f.get('kind','text')}] {f.get('summary','')}")
|
||||
if not all_files:
|
||||
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>")
|
||||
return "\n".join(blocks)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user