`init` says "Already initialized" after a first index that didn't finish

未关闭 适合新手
#3,228 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
70/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript
领域
cli

调研方向

从 src/bin/codegraph.ts 中的 runInit(约第 757-765 行)开始,那里已初始化分支会打印普通消息。阅读 codegraph status 如何结合 isRebuildInProgress 使用 getIndexState()(src/index.ts:2174,status 位于 src/bin/codegraph.ts:1313-1320)。完成的标准是:在没有重建运行时,状态为 indexing、failed 或 partial 时,init 打印对应的索引未完成警告;状态为 complete 时仍打印普通消息。

由索引模型根据 Issue 内容生成。

描述

Follow-up to the last point in #3223.

What happens

If the first index stops partway (in #3223 it threw at "Resolving refs"), running codegraph init again prints:

Already initialized in <project-root>
Use "codegraph index" to re-index or "codegraph sync" to update

Nothing says the index is incomplete, so it reads like a working setup that just needs updating.

Where (main f72c9d2e)

  • runInit (src/bin/codegraph.ts:757-765) only checks isInitialized(projectPath) before printing that message.
  • The project already records whether the last run finished. getIndexState() (src/index.ts:2174) returns indexing (marked before any writes at src/index.ts:703, so a run that dies midway leaves it behind), failed, partial or complete.
  • codegraph status already uses it (src/bin/codegraph.ts:1313-1320), with isRebuildInProgress to tell a run in another process from one that never finished.

Suggestion

In the already-initialized branch of runInit, read the index state the same way status does. When it is indexing with no rebuild running, failed, or partial, print the matching status warning ("The last index run never finished … Re-run codegraph index.") instead of the plain "Already initialized".

I worked this out by reading main. I haven't reproduced a failed first index locally.

主要语言
C
星标
73.2k
派生
4.7k
平均合并
3 小时 57 分钟
30 天内合并 PR
485

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

colbymchenry/codegraph 的其他 Issue

查看 colbymchenry/codegraph 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。