amp-cli: add a smoketest for the binary

Just runs --version. Amp will try create a log directory in your
homedir, so we need to give it a homedir it can write to.

Additionally we remove the rec and use finalAttrs instead.
This commit is contained in:
Keegan Carruthers-Smith 2025-05-29 08:44:00 +02:00
parent a98db0d69e
commit c85d7c7db5

View file

@ -4,14 +4,15 @@
fetchzip,
ripgrep,
makeWrapper,
testers,
}:
buildNpmPackage rec {
buildNpmPackage (finalAttrs: {
pname = "amp-cli";
version = "0.0.1748404992-ga3f78f";
src = fetchzip {
url = "https://registry.npmjs.org/@sourcegraph/amp/-/amp-${version}.tgz";
url = "https://registry.npmjs.org/@sourcegraph/amp/-/amp-${finalAttrs.version}.tgz";
hash = "sha256-axd5VP7afa4ptAl/y8CEVguqoRKVRhWfRDSI0sgyXqA=";
};
@ -25,7 +26,7 @@ buildNpmPackage rec {
"version": "0.0.0",
"license": "UNLICENSED",
"dependencies": {
"@sourcegraph/amp": "${version}"
"@sourcegraph/amp": "${finalAttrs.version}"
},
"bin": {
"amp": "./bin/amp-wrapper.js"
@ -69,6 +70,10 @@ buildNpmPackage rec {
'';
passthru.updateScript = ./update.sh;
passthru.tests.version = testers.testVersion {
package = finalAttrs.finalPackage;
command = "HOME=$(mktemp -d) amp --version";
};
meta = {
description = "CLI for Amp, an agentic coding agent in research preview from Sourcegraph";
@ -81,4 +86,4 @@ buildNpmPackage rec {
];
mainProgram = "amp";
};
}
})