WorkBuddy、CodeBuddy 桌面端增强助手:签到猫猫旅行成长计划查询、多账号独立备份、点切即用;免打扰模式让 AI 无人值守跑长任务;跨账号会话迁移、异常中断自动续接;暂存/快捷提示词;毛玻璃主题与更多实用功能。
fix(discovery): 用小写关键词查询 Gitee,修复新索引仓库收录不到
luolong478c97b4fc1698
diff --git a/scripts/automation-discovery.js b/scripts/automation-discovery.jsindex 5e2aac8..846a0ad 100644--- a/scripts/automation-discovery.js+++ b/scripts/automation-discovery.js@@ -169,7 +169,9 @@ async function searchGitee(fetchImpl, marker, pageSize) {const repositories = [];for (let from = 0; repositories.length < MAX_REPOSITORIES; from += pageSize) {const url = new URL('https://so.gitee.com/v1/search/widget/' + GITEE_WIDGET);- url.searchParams.set('q', marker);+ // Gitee 建索引时会把 description 里的驼峰标记折叠分词,驼峰原词反而查不全;+ // 用小写关键词可以同时命中折叠后的新索引和保留原词的老索引。+ url.searchParams.set('q', marker.toLowerCase());url.searchParams.set('from', String(from));url.searchParams.set('size', String(pageSize));const result = await requestJson(fetchImpl, url, ['so.gitee.com']);diff --git a/test/automation-discovery.test.js b/test/automation-discovery.test.jsindex 2f50ee8..4474b57 100644--- a/test/automation-discovery.test.js+++ b/test/automation-discovery.test.js@@ -294,3 +294,29 @@ test('separate clients reuse the newest public catalog while retaining their ownconst failedRefresh=await offline.getCatalog({force:true});assert.equal(failedRefresh.tasks.length,first.tasks.length);assert.equal(failedRefresh.stale,true);});++test('Gitee search folds the marker to lowercase so case-folded index terms still match', async () => {+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'wd-discovery-gitee-lowercase-'));+ try {+ const calls = [];+ const fetchImpl = async input => {+ const url = new URL(String(input));+ calls.push(url.toString());+ if (url.hostname === 'api.github.com' && url.pathname === '/search/repositories') {+ return json({ total_count: 0, incomplete_results: false, items: [] });+ }+ if (url.hostname === 'so.gitee.com') {+ return json({ hits: { total: { value: 0, relation: 'eq' }, hits: [] } });+ }+ throw new Error('Unexpected URL: ' + url);+ };+ const discovery = createAutomationDiscovery({ dataDir: dir, fetchImpl, now: () => 1_000_000, pageSize: 10, runtime });+ assert.equal((await discovery.getCatalog()).tasks.length, 0);+ const giteeCalls = calls.filter(url => url.includes('so.gitee.com/'));+ assert.equal(giteeCalls.length, 1);+ assert.equal(new URL(giteeCalls[0]).searchParams.get('q'), MARKER.toLowerCase());+ assert.notEqual(new URL(giteeCalls[0]).searchParams.get('q'), MARKER);+ } finally {+ fs.rmSync(dir, { recursive: true, force: true });+ }+});