tui: @/ does not reliably offer the project root in the mention picker
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 68/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
調査の方向性
packages/core/src/filesystem/search.ts から始めて、ripgrep バックエンドが rg --files のエントリからディレクトリインデックスを構築する方法を調べてください。Git 以外での動作を fff バックエンドおよび #60450 の空ディレクトリに関する関連作業と比較してください。完了条件は、Git 管理外の場所に対する GET /api/fs/find?query=/ が {"path":"/","type":"directory"} を含み、既存の Git 管理下での動作が維持されることです。
索引モデルが issue の本文から書いたものです。
説明
Summary
@/ does not reliably offer the location root in the TUI mention picker. There are two independent causes:
- In larger Git repos the root is indexed, but the TUI requests only 20 search results and the root is dropped before the client can sort/display it.
- In some locations the root is never indexed at all (non-Git locations, and Git locations whose root contains no files).
In both cases there is no / entry to select, so the project directory cannot be attached to a prompt.
Environment
- opencode version: 2.2.5
- OS: Linux 6.18.60-1-lts (x86_64)
- Terminal: TUI, TERM=xterm-256color, COLORTERM=truecolor, TERM_PROGRAM unset
- Shell: /usr/bin/bash
- Install/channel: latest release (
/usr/bin/opencode) - Active plugins: none found (no plugin entries in global config; no local
.opencode/pluginor.opencode/plugins)
Reproduction
A. Large Git repo: the root is indexed but truncated by the 20-result limit
This is the reported case. The repo has files at its root, is a normal Git checkout, and @/ still has no / entry.
-
In a Git repo with enough matching directories, compare the API result at the TUI's limit with a larger limit:
opencode api --standalone GET '/api/fs/find?query=/&limit=20'No
/entry is returned; the first results are ordinary directories:{"data":[{"path":"cv/","type":"directory"},{"path":"db/","type":"directory"}, ...]}opencode api --standalone GET '/api/fs/find?query=/&limit=50'With a larger limit the root is present and sorts first:
{"data":[{"path":"/","type":"directory"},{"path":"cv/","type":"directory"}, ...]}In the repo I tested, the threshold was
limit=41: 40 returned no/, 41 returned it first. -
In the TUI, type
@/. The picker shows the same first results as thelimit=20response and has no/entry. -
Nothing changes after the file index refreshes; this is deterministic for a given repo size.
B. Root not indexed
- A Git repo whose root contains only subdirectories returns no
/even withlimit=50. - A non-Git location returns no
/at any limit, even when a file exists directly at the root.
Expected Behavior
The location root should always be available as a directory entry in the @ picker, regardless of repo size, backend, or whether the root contains files.
Actual Behavior
The root is missing from the picker in the cases above, so there is nothing to select that represents the project directory.
Additional Context
- Cause A:
packages/tui/src/component/prompt/autocomplete.tsxrequestslimit: 20.packages/core/src/filesystem/search.tspasses that limit to the fff backend aspageSize, then sorts only the returned page. fff can place/after the first 20 matches, so it is truncated before the client ever sees it; with a larger page it appears and sorts first. - Cause B: the root is not seeded explicitly in the directory index. The fff backend only includes
/incidentally when a file exists directly at the root. The ripgrep backend (non-Git, home, Windows, workspace-backed, or when fff is unavailable) builds directories only from parent components ofrg --filesentries, so/is never added. - Related: #33751 (directory suggestions require direct files; closed for inactivity) and #60293 / #60450 (empty directories in the ripgrep index). #60450 starts its walk at the root with
known=trueand only publishes provably empty child directories, so it will not add/. - Suggested fixes: seed the location root in the directory index for both backends, and request enough candidates (or paginate) so the client's sort/filter runs before the result limit is applied. A root entry should not depend on repo size.
- 主要言語
- TypeScript
- スター
- 224k
- フォーク
- 30k
- 平均マージ
- 6時間 16分
- マージ済み PR(30日)
- 507
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
anomalyco/opencode のほかの issue
-
desktop: pasted image breaks and send fails with "Failed to fetch" after the clipboard temp file is deleted対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンreproduced
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
anomalyco/opencode#62052 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
triaging
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
anomalyco/opencode#62046 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
desktop: "Open in <Editor>" menu in Review Pane opens workspace root directory instead of active file tab対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンpending close triaging
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
anomalyco/opencode#62040 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
reproduced
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
anomalyco/opencode#62024 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
anomalyco/opencode#61897 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
anomalyco/opencode の issue をすべて見る
似ている issue
-
cloudflare-cache-binding: `unstorage://` keys are rejected by the Cache API, cache never storesオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
strapi/design-system#2084 ·
メンテナーはふだん 3 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
check:passed streams:remove
難易度 1/5 1時間未満 初心者へのやさしさ 67/100
メンテナーはふだん 1 日以内に返信