Skip to content

Commit 9c01189

Browse files
pRizzclaude
andcommitted
docs: add post-merge hooks and document git hooks in CLAUDE.md/AGENTS.md
Add post-merge hook to auto-sync submodule and run bun install after pulls. Document all git hooks (pre-commit, pre-push, post-merge) in CLAUDE.md and AGENTS.md. Simplify the post-pull instructions now that the hook handles submodule sync and dependency install automatically. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 6cfaebd commit 9c01189

5 files changed

Lines changed: 30 additions & 4 deletions

File tree

.githooks/post-merge

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
5+
6+
echo "post-merge: syncing submodule..."
7+
git -C "$REPO_ROOT" submodule update --init --recursive
8+
9+
echo "post-merge: installing dependencies..."
10+
bun install --cwd "$REPO_ROOT"

AGENTS.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ just run <args> # Run CLI with arguments (e.g., just run status)
3737
just dev # Start local runtime (local submodule + cached sandbox rebuild)
3838
```
3939

40+
## Git Hooks
41+
42+
This repo uses git hooks (wired via `git config core.hooksPath .githooks`, set up by `just setup`):
43+
44+
- **pre-commit** — Syncs README to npm packages, guards against unpublished submodule pins, runs cfn-lint on CloudFormation changes.
45+
- **pre-push** — Validates the opencode submodule commit is published.
46+
- **post-merge** — After every `git pull`, automatically syncs the submodule and runs `bun install`. No manual action needed.
47+
4048
## README Badge Sync
4149

4250
`README.md` (superproject) and `packages/opencode/README.md` (submodule) use distinct generated badge blocks for different audiences.
@@ -83,7 +91,7 @@ The `scripts/set-all-versions.sh` script handles version updates automatically.
8391
- Rebase pull from `main` first (for example: `git pull --rebase origin main`).
8492
- Then push to `main`.
8593
- After committing and pushing changes in the `packages/opencode/` submodule, run `just update-opencode-commit` in the superproject to update the Dockerfile's `OPENCODE_COMMIT` pin. Commit and push the resulting Dockerfile change to `main`.
86-
- After pulling the superproject, run `git submodule update --init --recursive` to sync the submodule working tree, then run `just update-opencode-commit`. If the Dockerfile changed, commit and push the update to keep the submodule pointer and Dockerfile `OPENCODE_COMMIT` pin in sync.
94+
- After pulling the superproject, the `post-merge` hook automatically syncs the submodule and runs `bun install`. Then run `just update-opencode-commit` — if the Dockerfile changed, commit and push the update.
8795
- **Resolving `OPENCODE_COMMIT` merge conflicts:** If a rebase or merge produces a conflict in the Dockerfile's `OPENCODE_COMMIT` line, do not manually pick a SHA. Instead, accept either side to clear the conflict markers, then run `just update-opencode-commit` to set the correct value from the current submodule state.
8896

8997
## Working with Git Worktrees and Submodules

CLAUDE.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ just run <args> # Run CLI with arguments (e.g., just run status)
3737
just dev # Start local runtime (local submodule + cached sandbox rebuild)
3838
```
3939

40+
## Git Hooks
41+
42+
This repo uses git hooks (wired via `git config core.hooksPath .githooks`, set up by `just setup`):
43+
44+
- **pre-commit** — Syncs README to npm packages, guards against unpublished submodule pins, runs cfn-lint on CloudFormation changes.
45+
- **pre-push** — Validates the opencode submodule commit is published.
46+
- **post-merge** — After every `git pull`, automatically syncs the submodule and runs `bun install`. No manual action needed.
47+
4048
## README Badge Sync
4149

4250
`README.md` (superproject) and `packages/opencode/README.md` (submodule) use distinct generated badge blocks for different audiences.
@@ -83,7 +91,7 @@ The `scripts/set-all-versions.sh` script handles version updates automatically.
8391
- Rebase pull from `main` first (for example: `git pull --rebase origin main`).
8492
- Then push to `main`.
8593
- After committing and pushing changes in the `packages/opencode/` submodule, run `just update-opencode-commit` in the superproject to update the Dockerfile's `OPENCODE_COMMIT` pin. Commit and push the resulting Dockerfile change to `main`.
86-
- After pulling the superproject, run `git submodule update --init --recursive` to sync the submodule working tree, then run `just update-opencode-commit`. If the Dockerfile changed, commit and push the update to keep the submodule pointer and Dockerfile `OPENCODE_COMMIT` pin in sync.
94+
- After pulling the superproject, the `post-merge` hook automatically syncs the submodule and runs `bun install`. Then run `just update-opencode-commit` — if the Dockerfile changed, commit and push the update.
8795
- **Resolving `OPENCODE_COMMIT` merge conflicts:** If a rebase or merge produces a conflict in the Dockerfile's `OPENCODE_COMMIT` line, do not manually pick a SHA. Instead, accept either side to clear the conflict markers, then run `just update-opencode-commit` to set the correct value from the current submodule state.
8896

8997
## Working with Git Worktrees and Submodules

packages/core/src/docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ COPY --chown=opencoder:opencoder packages/opencode /tmp/opencode-local
553553
# Update it by running: ./scripts/update-opencode-commit.sh
554554
RUN set -eux; \
555555
OPENCODE_COMMIT_OVERRIDE="${OPENCODE_COMMIT:-}"; \
556-
OPENCODE_COMMIT="c07c9b9e9579651831eb8295db5227b8fcef1071"; \
556+
OPENCODE_COMMIT="9fd774b0238b11b2d2eb646b2d0122da8689d274"; \
557557
if [ -n "${OPENCODE_COMMIT_OVERRIDE}" ]; then OPENCODE_COMMIT="${OPENCODE_COMMIT_OVERRIDE}"; fi; \
558558
rm -rf /tmp/opencode-repo; \
559559
if [ "${OPENCODE_SOURCE}" = "local" ]; then \

0 commit comments

Comments
 (0)