Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,11 @@ or `CRQ_SKILL_DIR=/custom/path/coderabbit-queue` to install it elsewhere.
git clone https://github.com/kristofferR/coderabbit-queue.git
cd coderabbit-queue
go test ./...
go build -trimpath -ldflags "-s -w" -o ~/.local/bin/crq ./cmd/crq # ensure ~/.local/bin is on $PATH
# Build to a temp file and rename — never `go build -o` straight onto an existing
# crq: overwriting an already-executed binary in place (same inode) leaves macOS's
# cached code-signature stale, and every later run dies with "Killed: 9".
go build -trimpath -ldflags "-s -w" -o ~/.local/bin/crq.new ./cmd/crq # ensure ~/.local/bin is on $PATH
mv -f ~/.local/bin/crq.new ~/.local/bin/crq
mkdir -p "${CODEX_HOME:-$HOME/.codex}/skills"
rm -rf "${CODEX_HOME:-$HOME/.codex}/skills/coderabbit-queue"
cp -R "skills/coderabbit-queue" "${CODEX_HOME:-$HOME/.codex}/skills/coderabbit-queue"
Expand Down
19 changes: 17 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@ SKILL_DEST="${CRQ_SKILL_DIR:-${CODEX_HOME:-$HOME/.codex}/skills/$SKILL_NAME}"

say() { printf 'crq-install: %s\n' "$*"; }

# Replace the installed binary atomically: stage next to the target, then rename.
# Never write over the existing file in place — on macOS, overwriting an
# already-executed binary on the same inode leaves the kernel's cached code
# signature stale and every later run is killed with SIGKILL ("Killed: 9").
# A rename swaps in a fresh inode, and a running daemon keeps its old one.
install_binary() {
local src="$1"
local dest="$2"
local staged
staged="$(mktemp "$(dirname "$dest")/.$(basename "$dest").tmp.XXXXXX")"
cp "$src" "$staged"
chmod 0755 "$staged"
mv -f "$staged" "$dest"
}
Comment thread
kristofferR marked this conversation as resolved.

mkdir -p "$BIN_DIR"

os="$(uname -s | tr '[:upper:]' '[:lower:]')"
Expand Down Expand Up @@ -129,7 +144,7 @@ if [ -z "${CRQ_INSTALL_REF:-}" ] && [ -z "${CRQ_INSTALL_SOURCE_DIR:-}" ]; then
if download "$release_url" "$rel/crq.tgz" 2>/dev/null \
&& tar -xzf "$rel/crq.tgz" -C "$rel" 2>/dev/null \
&& [ -f "$rel/crq" ]; then
install -m 0755 "$rel/crq" "$BIN_DIR/$NAME"
install_binary "$rel/crq" "$BIN_DIR/$NAME"
say "installed to $BIN_DIR/$NAME"
install_skill
say "run 'crq help' for the agent loop contract; Codex can also use the installed skill"
Expand All @@ -147,7 +162,7 @@ ensure_source_dir

say "building crq"
( cd "$src_dir" && go build -trimpath -ldflags "-s -w" -o "$tmp/crq" ./cmd/crq )
install -m 0755 "$tmp/crq" "$BIN_DIR/$NAME"
install_binary "$tmp/crq" "$BIN_DIR/$NAME"
say "installed to $BIN_DIR/$NAME"
install_skill
say "run 'crq help' for the agent loop contract; Codex can also use the installed skill"
Expand Down