Skip to content

feat(hooks): surface leftover post-commit hooks (#167 follow-up) - #172

Merged
dreamlx merged 1 commit into
masterfrom
fix/167-leftover-hook-reminder
Aug 15, 2026
Merged

feat(hooks): surface leftover post-commit hooks (#167 follow-up)#172
dreamlx merged 1 commit into
masterfrom
fix/167-leftover-hook-reminder

Conversation

@dreamlx

@dreamlx dreamlx commented Aug 15, 2026

Copy link
Copy Markdown
Owner

问题(#167 直接删的遗留面)

升级到 0.37 后,装过 post-commit hook 的项目:

  • hook 文件留在 .git/hooks/post-commit,每次 commit 触发 → codeindex hooks run post-commit(子命令已删)→ 报错进 ~/.codeindex/hooks/post-commit.log|| true 吞掉
  • commit 不受影响、终端零输出——但每次 commit 白付一次 Python + codeindex 导入的启动开销(数百 ms),log 无限涨
  • hooks status 只 iterate SUPPORTED_HOOKS → 残留不可见;uninstall --all 同样跳过它
  • 提醒只在 CHANGELOG / docs(全被动)

修法

  • hooks status:检测 codeindex-managed 的残留 post-commit(RETIRED_HOOKS 常量留 future retirement 的 seam)→ warning + 精确清理命令
  • uninstall --all:残留一并清掉
  • guide 迁移注记同步(说明 silent 代价 + 两个清理入口)

Verification

  • 4 个新测试(有残留→warn;自定义 hook 无标记→静默;无残留→静默;--all 清残留)
  • 全套 1786 passed, 13 skipped
  • 实际 CLI 输出人工核对过

A post-commit hook installed by codeindex < 0.37 survives the upgrade
silently: the dead wrapper errors into ~/.codeindex/hooks/post-commit.log
(|| true swallows the exit code) while every commit still pays one
Python startup. Nothing showed it — status only iterated
SUPPORTED_HOOKS, and uninstall --all likewise skipped it.

- hooks status: flags a codeindex-managed post-commit with the exact
  cleanup command (RETIRED_HOOKS seam for future retirements)
- hooks uninstall --all: removes the leftover along with supported hooks
@dreamlx
dreamlx merged commit db30e0a into master Aug 15, 2026
8 checks passed
@dreamlx
dreamlx deleted the fix/167-leftover-hook-reminder branch August 15, 2026 14:56
dreamlx added a commit that referenced this pull request Aug 15, 2026
P1 (docs, #169 residual): active user-facing surfaces still advertising
the removed post-commit workflow — codeindex init's final output,
README_zh.md (bullet/workflow/skill-table; EN was clean),
examples/ai-integration-guide.md (whole Post-commit section + doc-only
scenario), team-workflow-guide ('Three hooks'). All removed/updated;
version-history mentions intentionally kept.

P2 (#171): _has_js_test_files walked .venv and duplicated the skip-set —
now shares _WALK_SKIP_DIRS with detect_languages (venv/.tox/.eggs
pruned), uncapped-walk rationale documented.

P2 (#172): leftover-hook read_text now catches OSError — status is
informational, must not crash on an unreadable file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant