704b8e577a
CI / check (push) Has been cancelled
Upstream and the bundled OpenCode plugin invoke the tool as `ocr`, but the Go build names the binary after its cmd/ directory (`opencodereview`), so the CLI was missing from PATH under the name everything expects.
64 lines
1.5 KiB
Nix
64 lines
1.5 KiB
Nix
{
|
|
lib,
|
|
buildGoModule,
|
|
fetchFromGitHub,
|
|
callPackage,
|
|
}:
|
|
|
|
buildGoModule rec {
|
|
pname = "open-code-review";
|
|
version = "1.12.9";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "alibaba";
|
|
repo = "open-code-review";
|
|
rev = "v${version}";
|
|
hash = "sha256-g/l4Ezv1YJYjRNI2DU5WgkaPvYp+/SC3yL+HEl/8kFI=";
|
|
};
|
|
|
|
vendorHash = "sha256-f5Ty22wicf1J8+RKnHYcEO7flWn9gkWQODlfunn23EA=";
|
|
|
|
env.CGO_ENABLED = 0;
|
|
|
|
subPackages = [ "cmd/opencodereview" ];
|
|
|
|
doCheck = false;
|
|
|
|
# Upstream (and the bundled OpenCode plugin) invokes the CLI as `ocr`, but the
|
|
# Go build names the binary after its cmd/ directory.
|
|
postInstall = ''
|
|
ln -s $out/bin/opencodereview $out/bin/ocr
|
|
'';
|
|
|
|
ldflags = [
|
|
"-s"
|
|
"-w"
|
|
"-X main.Version=v${version}"
|
|
"-X main.GitCommit=v${version}"
|
|
"-X main.BuildDate=1970-01-01T00:00:00Z"
|
|
];
|
|
|
|
passthru = {
|
|
category = "Code Review";
|
|
# OpenCode plugin built from the same source revision as the CLI.
|
|
opencode-plugin = callPackage ./opencode-plugin.nix {
|
|
inherit src version;
|
|
};
|
|
updateScript = [
|
|
"nix-update"
|
|
"--flake"
|
|
".#open-code-review"
|
|
];
|
|
};
|
|
|
|
meta = with lib; {
|
|
description = "AI-powered code review CLI combining deterministic pipelines with an LLM agent";
|
|
homepage = "https://github.com/alibaba/open-code-review";
|
|
changelog = "https://github.com/alibaba/open-code-review/releases/tag/v${version}";
|
|
license = licenses.asl20;
|
|
sourceProvenance = with sourceTypes; [ fromSource ];
|
|
mainProgram = "opencodereview";
|
|
platforms = platforms.all;
|
|
};
|
|
}
|