feat: standalone index for a linked worktree

Đang mở
#363 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
38/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go
Lĩnh vực
developer-experience

Hướng nghiên cứu

Start by reading the worktree-index-fallback proposal and the implementation of codegraph sync, codegraph init, and codegraph githooks install; the issue does not name source files or tests. Reproduce the linked-worktree setup described in the issue, including a main checkout with its MCP server holding the store open. Done means a worktree can get a safe standalone index without a full build, and hook behavior when it has no index is documented or defined.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

needs-triage

Problem

A linked worktree borrows the main checkout's index through the worktree-index fallback (v0.19). Queries in the worktree then describe the main checkout's tree, not the worktree's edits. The notice says so, but the answers are still stale. Agents now do most of their work in linked worktrees, for example worktrunk wt worktrees under a shared root. So most agent sessions query a tree that is not theirs.

#119 ("worktree support beyond detect-and-warn") closed as completed. But the worktree-index-fallback proposal still lists "a per-worktree index, automatic init in a worktree, or an index keyed by worktree HEAD" as out of scope.

Request

Give a linked worktree its own index without a full build. Two possible shapes:

  1. A command such as codegraph init --from-main that copies the main checkout's index into the worktree and syncs it to the worktree's tree.
  2. The same step done on its own, the first time codegraph runs in a linked worktree that has no index.

The copy must be safe while the main checkout's MCP server holds the store open and writes to it.

What works today, and its limit

In a linked worktree of a 466-file repository:

cp -R <main>/.codegraph .codegraph
codegraph sync    # reparsed=64 pruned=396, 1.2 s
codegraph status --json | jq .worktreeMismatch    # null

The worktree then has a standalone index. The limit is the copy: cp -R of an open store can capture a write in progress. If the sync fails, the workaround falls back to codegraph index --force.

Related

  • codegraph githooks install keeps an index current between sessions. The hooks live in the common .git/hooks, so they run in every worktree. The docs can state what sync does from a hook in a worktree that has no index of its own: skip in silence, or fail.

🤖 Generated with Claude Code

Ngôn ngữ chính
Go
Star
0
Fork
0
Merge trung bình
7 giờ 42 phút
Pull request đã merge (30 ngày)
111

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của seanb4t/codegraph-go

Tất cả issue của seanb4t/codegraph-go

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.