zai-org / zai-org/feedback

【功能建议】@ 文件引用搜索应遵循 .gitignore,避免被忽略的构建产物拖垮

Open
#479 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

priority: P2
Dominant language
No language data
Stars
22
Forks
1
PR merge metrics
No merged PRs in 30d

Description

提交前确认 · Pre-submission checklist
  • 已搜索现有 issue,确认非重复提交
  • 已阅读 CONTRIBUTING.md
问题类别 · Category

文件/项目操作

涉及的 Agent 框架 · Agent framework

ZCode Agent(自研)

使用场景 · Use case

在大型 Android 工程(26+ product flavor)中,输入框 @ 引用文件时搜索一直转圈、几乎无法返回结果,无法用 @ 快速引用源码。

复现数据(git ls-files 与磁盘遍历统计):

  • git 实际跟踪文件:4,402 个
  • 工作区磁盘文件(不含 .git):约 929,500 个
  • 其中被 .gitignore 忽略的目录:app/build/(构建产物)约 797,000 个、.worktrees/ 约 74,000 个,占文件总数 99% 以上
  • @ 搜索疑似全量遍历工作区(含忽略目录),导致长时间无响应、源码文件匹配不出来

对比:同一工作区,Claude Code 的 @ 文件搜索遵循 .gitignore(只索引未忽略文件),即时返回结果;ZCode 因扫描忽略目录体验差距明显。

建议方案 · Proposal
  1. @ 文件搜索默认遵循 .gitignore(及全局/工作区忽略规则),只索引未忽略文件
  2. 提供用户级/工作区级配置项(如 search.ignore),允许追加自定义忽略目录
  3. 索引结果缓存,避免每次按键全量重扫
预期价值 · Expected value

被忽略的构建产物对代码引用毫无价值,却占文件总数 99% 以上。遵循 .gitignore 后搜索范围从约 93 万降到约 4 千个文件,@ 引用可从"不可用"恢复到即时响应,同时显著降低 IO/CPU 占用。

你认为的优先级 · Your perceived priority

高 · High

版本 / 环境 · Version / environment

ZCode 0.16.5 / Windows 11 Pro (10.0.26200) x64

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue concerns the @ file-reference search and the proposed search.ignore configuration, with .gitignore and workspace/global ignore rules as inputs. No implementation files or tests are named, so first locate the @ search entry point and existing ignore handling. Done means ignored build outputs are excluded, custom ignore paths can be configured, and search responds promptly in the described large workspace.

Written by the indexing model from the issue text.

Assessment

Tech stack
git
Domain
performance, search
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.