Skip to content

Commit f9ebb8d

Browse files
committed
chore(deadcode): remove unused plugin version validator
1 parent 783d5c1 commit f9ebb8d

3 files changed

Lines changed: 11 additions & 15 deletions

File tree

scripts/lib/bundled-extension-manifest.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
// Bundled Extension Manifest script supports OpenClaw repository automation.
2-
import { validateMinHostVersion } from "../../src/plugins/min-host-version.ts";
2+
import {
3+
MIN_HOST_VERSION_FORMAT,
4+
parseMinHostVersionRequirement,
5+
} from "../../src/plugins/min-host-version.ts";
36
import { isRecord } from "../../src/utils.js";
47

58
export type ExtensionPackageJson = {
@@ -35,7 +38,11 @@ export function collectBundledExtensionManifestErrors(extensions: BundledExtensi
3538
`bundled extension '${extension.id}' manifest invalid | openclaw.install.npmSpec must be a non-empty string`,
3639
);
3740
}
38-
const minHostVersionError = validateMinHostVersion(install?.minHostVersion);
41+
const minHostVersionError =
42+
install?.minHostVersion === undefined ||
43+
parseMinHostVersionRequirement(install.minHostVersion)
44+
? null
45+
: MIN_HOST_VERSION_FORMAT;
3946
if (minHostVersionError) {
4047
errors.push(`bundled extension '${extension.id}' manifest invalid | ${minHostVersionError}`);
4148
}

src/plugins/min-host-version.test.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
checkMinHostVersion,
55
MIN_HOST_VERSION_FORMAT,
66
parseMinHostVersionRequirement,
7-
validateMinHostVersion,
87
} from "./min-host-version.js";
98

109
const MIN_HOST_REQUIREMENT = {
@@ -40,8 +39,7 @@ function expectHostCheckResult(params: {
4039
).toEqual(params.expected);
4140
}
4241

43-
function expectInvalidMinHostVersion(minHostVersion: string | number) {
44-
expect(validateMinHostVersion(minHostVersion)).toBe(MIN_HOST_VERSION_FORMAT);
42+
function expectInvalidHostCheck(minHostVersion: string | number) {
4543
expectHostCheckResult({
4644
currentVersion: "2026.3.22",
4745
minHostVersion,
@@ -55,7 +53,6 @@ function expectInvalidMinHostVersion(minHostVersion: string | number) {
5553

5654
describe("min-host-version", () => {
5755
it("accepts empty metadata", () => {
58-
expect(validateMinHostVersion(undefined)).toBeNull();
5956
expect(parseMinHostVersionRequirement(undefined)).toBeNull();
6057
expectValidHostCheck("2026.3.22");
6158
});
@@ -92,7 +89,7 @@ describe("min-host-version", () => {
9289
it.each(["2026.3.22", 123, ">=2026.3.22 garbage"] as const)(
9390
"rejects invalid floor syntax and host checks: %p",
9491
(minHostVersion) => {
95-
expectInvalidMinHostVersion(minHostVersion);
92+
expectInvalidHostCheck(minHostVersion);
9693
},
9794
);
9895

src/plugins/min-host-version.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,6 @@ export function parseMinHostVersionRequirement(
5656
};
5757
}
5858

59-
/** Validates a plugin minHostVersion manifest field for schema/reporting callers. */
60-
export function validateMinHostVersion(raw: unknown): string | null {
61-
if (raw === undefined) {
62-
return null;
63-
}
64-
return parseMinHostVersionRequirement(raw) ? null : MIN_HOST_VERSION_FORMAT;
65-
}
66-
6759
/** Checks whether the current host satisfies a plugin minHostVersion requirement. */
6860
export function checkMinHostVersion(params: {
6961
currentVersion: string | undefined;

0 commit comments

Comments
 (0)