Address Greptile review: trim version, remove redundant fs/promises import, use fixed .tmp suffix

This commit is contained in:
2026-04-12 14:22:00 -04:00
parent ddf36667f9
commit aed1a886a9
3 changed files with 18 additions and 4 deletions
+2 -3
View File
@@ -232,7 +232,7 @@ export function adapterRoutes() {
// Strip version suffix if the UI sends "pkg@1.2.3" instead of separating it
// e.g. "@henkey/hermes-paperclip-adapter@0.3.0" → packageName + version
let canonicalName = packageName.trim();
let explicitVersion = version;
let explicitVersion = typeof version === "string" ? version.trim() : version;
const versionSuffix = packageName.match(/@(\d+\.\d+\.\d+.*)$/);
if (versionSuffix) {
// For scoped packages: "@scope/name@1.2.3" → "@scope/name" + "1.2.3"
@@ -264,8 +264,7 @@ export function adapterRoutes() {
// Read installed version from package.json
try {
const pkgJsonPath = path.join(pluginsDir, "node_modules", canonicalName, "package.json");
const pkgContent = await import("node:fs/promises");
const pkgRaw = await pkgContent.readFile(pkgJsonPath, "utf-8");
const pkgRaw = await readFile(pkgJsonPath, "utf-8");
const pkg = JSON.parse(pkgRaw);
const v = pkg.version;
installedVersion =