Bundle hook scripts in pip package - #265
Conversation
PR #265 — Bundle hook scripts in pip package
SummaryMoves the
Verdict: Approve with suggestionsClean, well-scoped, single-commit PR. The feature is genuinely useful — users currently need to clone the repo or manually copy hook scripts. Shipping them inside the package and providing There are two issues to address before merging and a handful of minor suggestions. Issues1. MEDIUM:
|
| File | Lines | Notes |
|---|---|---|
mempalace/hooks/__init__.py |
+20 | Clean. hooks_dir() and hook_path() are the right API |
mempalace/cli.py |
+72 | cmd_hooks + argparse wiring. Well-structured |
mempalace/hooks/README.md |
+12 | Quick-setup section added at top. Good UX |
hooks/*.sh → mempalace/hooks/*.sh |
0 | Pure renames, no content change. Correct |
tests/test_hooks.py |
+75 | 8 tests. Uses subprocess for CLI tests. Solid |
pyproject.toml |
0 | Missing — needs package-data for .sh files (see issue #1) |
Created by Octocode MCP https://octocode.ai
6070a96 to
3f1a630
Compare
|
@bgauryy Thanks for the thorough review! Pushed a follow-up commit addressing items 3 and 4. Addressed:
Not addressing:
Would appreciate another look when you get a chance! |
Move hooks/ into mempalace/hooks/ so they ship with pip installs. Add `mempalace hooks path` and `mempalace hooks install` commands to help users locate and configure the hooks. Closes MemPalace#184.
…tion - Print "Add to ..." header to stderr so stdout is pure JSON (pipeable) - Tighten test_cli_hooks_path assertion to match "mempalace/hooks" not just "hooks" - Simplify install tests: parse stdout directly as JSON (no line skipping)
3f1a630 to
b843d48
Compare
|
Rebased. uv.lock looks also stale that I didn't update in this PR |
web3guru888
left a comment
There was a problem hiding this comment.
👀 Review of #265 — Bundle hook scripts in pip package
Scope: +175/−0 · 6 file(s)
mempalace/cli.py(modified: +72/−0)mempalace/hooks/README.md(renamed: +12/−0)mempalace/hooks/__init__.py(added: +20/−0)mempalace/hooks/mempal_precompact_hook.sh(renamed: +0/−0)mempalace/hooks/mempal_save_hook.sh(renamed: +0/−0)tests/test_hooks.py(added: +71/−0)
Technical Analysis
- 🪟 Windows compatibility — verify path handling works cross-platform
Strengths
- ✅ Includes test coverage
🟢 Approved — clean, well-structured PR. Good work @armujahid!
🏛️ Reviewed by MemPalace-AGI · Autonomous research system with perfect memory · Showcase: Truth Palace of Atlantis
|
Hi, thanks for the contribution. This PR has merge conflicts with Could you rebase onto If this change is no longer relevant, feel free to close the PR. (This message is part of a periodic backlog pass, sent to all open PRs that match this state.) |
|
@igorls done. |
|
Thanks for this contribution, and apologies for the slow turnaround.
If you'd rather not pick it back up, no problem at all — just say so and I'll close it out, and thanks either way for taking the time to send it. |
|
@igorls Done. I have resolved merge conflicts. You can trigger CI workflows. |
|
Thanks for rebasing so quickly. CI ran — linux 3.9/3.11/3.13, macOS, smoke, build and build-gpu are all green. Three things to fix, all small: 1.
2.
@pytest.mark.skipif(sys.platform == "win32", reason="POSIX permission bits")3.
assert Path(result.stdout.strip()) == hooks_dir()Two notes from reviewing the rest, neither of them blocking: I wanted to be sure the executable bit survived a real wheel build rather than only the source checkout, so I built the branch and read the mode bits out of the zip — all three main hooks come through On the breaking change — thank you for leading the description with it rather than burying it. One thing I'd like to think about before this lands: because hooks run in the background, a stale path in someone's Push those three and I'll take a proper look at the packaging change. |
|
@igorls Thanks for the review. All three points are already addressed in my last commit
|
Summary
hooks/moved tomempalace/hooks/— users referencing the old repo-root path must update their configpip install mempalacemempalace hooks pathandmempalace hooks installCLI subcommands for easy setupmempalace hooks installprints ready-to-paste config for Claude Code or Codex CLI (--format codex)Closes #184
Breaking change
The
hooks/directory at the repo root has been moved intomempalace/hooks/. Anyone pointing their Claude Code or Codex config at the oldhooks/path needs to either:mempalace hooks installto get a config snippet with the correct pathsTest plan
uv run mempalace hooks pathprints the hooks directoryuv run mempalace hooks installoutputs valid JSON config for Claude Codeuv run mempalace hooks install --format codexoutputs valid JSON config for Codex CLIuv run pytest tests/test_hooks.py -v— all 8 tests passuv build && unzip -l dist/*.whl | grep hooks— both.shfiles present in wheel