update 0.0.6

This commit is contained in:
xiongxiao
2026-03-13 20:17:33 +08:00
committed by cnb
parent 6e31e24887
commit 711aa221a5
5 changed files with 55 additions and 3 deletions

View File

@@ -14,6 +14,7 @@ app
args: {
q: z.string().optional().describe('搜索关键词,选填;留空或不传则返回全部文件'),
projectPath: z.string().optional().describe('按项目根目录路径过滤,仅返回该项目下的文件,选填'),
filepath: z.string().optional().describe('按文件绝对路径过滤,选填'),
repo: z.string().optional().describe('按代码仓库标识过滤(如 owner/repo选填'),
title: z.string().optional().describe('按人工标注的标题字段过滤,选填'),
tags: z.array(z.string()).optional().describe('按人工标注的标签列表过滤,选填'),
@@ -27,13 +28,13 @@ app
}
})
.define(async (ctx) => {
let { q, projectPath, repo, title, tags, summary, description, link, sort, limit, getContent = false } = ctx.query as { q?: string; projectPath?: string; repo?: string; title?: string; tags?: string[]; summary?: string; description?: string; link?: string; sort?: string[]; limit?: number; getContent?: boolean };
let { q, projectPath, filepath, repo, title, tags, summary, description, link, sort, limit, getContent = false } = ctx.query as { q?: string; projectPath?: string; filepath?: string; repo?: string; title?: string; tags?: string[]; summary?: string; description?: string; link?: string; sort?: string[]; limit?: number; getContent?: boolean };
if (!q) {
sort = sort ?? ['projectPath:asc'];
limit = limit ?? 1000;
}
const projectSearch = manager.projectSearch;
const hits = await projectSearch.searchFiles(q, { projectPath, repo, title, tags, summary, description, link, sort, limit, getContent });
const hits = await projectSearch.searchFiles(q, { projectPath, filepath, repo, title, tags, summary, description, link, sort, limit, getContent });
ctx.body = { list: hits };
})
.addTo(app);