{ lib
, buildNpmPackage
, fetchurl
, nodejs_18
}:

buildNpmPackage {
  pname = "claude-cli";
  version = "0.2.65";
  
  src = fetchurl {
    url = "https://registry.npmjs.org/@anthropic-ai/claude-code/-/claude-code-0.2.65.tgz";
    sha256 = "0wwaqq7k9p5aw4vqhfpdgf3da09x64q55wibqaprk6kjvn130i92";
  };
  
  npmDepsHash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; # Will be updated after first build
  
  nodejs = nodejs_18;
  
  # Don't run npm audit or other network operations during build
  npmConfigHook = ''
    npm config set audit false
    npm config set fund false
  '';
  
  meta = with lib; {
    description = "Terminal-based AI coding assistant from Anthropic (npm distribution)";
    homepage = "https://www.anthropic.com/claude-code";
    license = licenses.unfree;
    maintainers = [ ];
    platforms = platforms.all;
    mainProgram = "claude";
  };
}