Skip to content

Commit d563101

Browse files
authored
refactor(deadcode): localize test and tooling helpers (#101875)
1 parent f565138 commit d563101

39 files changed

Lines changed: 47 additions & 54 deletions

scripts/github/dependency-guard.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ export function isDependencyGuardMarkerComment(comment, marker, trustedAuthors)
253253
return Boolean(login && trustedAuthors.has(login) && comment.body?.includes(marker));
254254
}
255255

256-
export function renderDependencyAwarenessComment(dependencyFiles) {
256+
function renderDependencyAwarenessComment(dependencyFiles) {
257257
const listedFiles = dependencyFiles.slice(0, maxListedFiles);
258258
const omittedCount = dependencyFiles.length - listedFiles.length;
259259
const fileLines = listedFiles.map((filename) => `- ${markdownCode(filename)}`);

scripts/github/real-behavior-proof-policy.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function createTooLargeGitHubApiBodyError(label, maxBytes) {
6666
return error;
6767
}
6868

69-
export async function withGitHubApiTimeout(label, timeoutMs, run) {
69+
async function withGitHubApiTimeout(label, timeoutMs, run) {
7070
const boundedTimeoutMs = Math.max(1, timeoutMs);
7171
const controller = new AbortController();
7272
const timeoutError = createTimeoutError(label, boundedTimeoutMs);
@@ -168,7 +168,7 @@ function isAutomationUser(user = {}, fallbackLogin = "") {
168168
return user?.type === "Bot" || /\[bot\]$/i.test(login) || login.startsWith("app/");
169169
}
170170

171-
export function isExternalPullRequest(pullRequest) {
171+
function isExternalPullRequest(pullRequest) {
172172
if (!pullRequest) {
173173
return false;
174174
}

scripts/lib/codex-app-server-protocol-source.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ function formatGeneratedTypeScript(repoRoot: string, root: string): void {
399399
}
400400
}
401401

402-
export async function rewriteTypeScriptImports(root: string): Promise<void> {
402+
async function rewriteTypeScriptImports(root: string): Promise<void> {
403403
const entries = await fs.readdir(root, { withFileTypes: true });
404404
await Promise.all(
405405
entries.map(async (entry) => {
@@ -417,7 +417,7 @@ export async function rewriteTypeScriptImports(root: string): Promise<void> {
417417
);
418418
}
419419

420-
export function normalizeGeneratedTypeScript(text: string): string {
420+
function normalizeGeneratedTypeScript(text: string): string {
421421
return text
422422
.replace(/(from\s+["'])(\.{1,2}\/[^"']+?)(\.js)?(["'])/g, "$1$2.js$4")
423423
.replace('export * as v2 from "./v2.js";', 'export * as v2 from "./v2/index.js";')

scripts/lib/gateway-bench-probes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export async function requestProbeStatus(
3737
}
3838
}
3939

40-
export function classifyProbeErrorKind(error: unknown): string {
40+
function classifyProbeErrorKind(error: unknown): string {
4141
if (typeof error === "object" && error !== null) {
4242
const code = (error as { code?: unknown }).code;
4343
if (typeof code === "string" && code.trim()) {

scripts/lib/openclaw-test-state.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,12 +336,12 @@ export async function createState(options = {}) {
336336
}
337337

338338
/** Render a dotenv-style env file for a created test state plan. */
339-
export function renderEnvFile(plan) {
339+
function renderEnvFile(plan) {
340340
return `${renderExports(plan.env)}\n`;
341341
}
342342

343343
/** Render shell commands that create and export an isolated OpenClaw test state. */
344-
export function renderShellSnippet(options = {}) {
344+
function renderShellSnippet(options = {}) {
345345
const label = normalizeLabel(options.label);
346346
const scenario = requireScenario(options.scenario);
347347
const config = scenarioConfig(scenario, options);
@@ -374,7 +374,7 @@ export function renderShellSnippet(options = {}) {
374374
}
375375

376376
/** Render a reusable shell function for creating isolated OpenClaw test state. */
377-
export function renderShellFunction() {
377+
function renderShellFunction() {
378378
return `openclaw_test_state_create() {
379379
local raw_label="\${1:-state}"
380380
local label="$raw_label"

scripts/lib/plugin-npm-release.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ function runNpmView(args: string[]): string {
654654
}
655655
}
656656

657-
export function resolveNpmLatestVersion(packageName: string): string {
657+
function resolveNpmLatestVersion(packageName: string): string {
658658
const raw = runNpmView([packageName, "dist-tags.latest", "--json"]);
659659
const parsed = JSON.parse(raw) as unknown;
660660
if (typeof parsed !== "string" || !parsed.trim()) {

scripts/lib/plugin-npm-runtime-build.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function readJsonFile(filePath) {
2222
}
2323

2424
/** Return whether a plugin package publishes through an artifact release workflow. */
25-
export function isPublishablePluginPackage(packageJson) {
25+
function isPublishablePluginPackage(packageJson) {
2626
return (
2727
packageJson.openclaw?.release?.publishToNpm === true ||
2828
packageJson.openclaw?.release?.publishToClawHub === true
@@ -121,7 +121,7 @@ export function listPluginNpmRuntimeBuildOutputs(plan) {
121121
}
122122

123123
/** Resolve package `files` entries needed for runtime build outputs and plugin metadata. */
124-
export function resolvePluginNpmRuntimePackageFiles(plan) {
124+
function resolvePluginNpmRuntimePackageFiles(plan) {
125125
const merged = new Set(
126126
Array.isArray(plan.packageJson.files)
127127
? plan.packageJson.files.filter((entry) => typeof entry === "string")
@@ -167,7 +167,7 @@ function resolveOpenClawPeerRange(packageJson, rootPackageJson) {
167167
}
168168

169169
/** Resolve package peer dependency metadata for the OpenClaw plugin API. */
170-
export function resolvePluginNpmRuntimePackagePeerMetadata(plan) {
170+
function resolvePluginNpmRuntimePackagePeerMetadata(plan) {
171171
const openclawPeerRange = resolveOpenClawPeerRange(plan.packageJson, plan.rootPackageJson);
172172
if (!openclawPeerRange) {
173173
throw new Error(

test/e2e/qa-lab/config/cli-channel-picker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ function createEvidenceWriter(options: ProducerOptions) {
244244
});
245245
}
246246

247-
export async function runCliChannelPickerProducer(options: ProducerOptions) {
247+
async function runCliChannelPickerProducer(options: ProducerOptions) {
248248
const startedAt = Date.now();
249249
const writer = createEvidenceWriter(options);
250250
const workDir = path.join(options.artifactBase, ".work");

test/e2e/qa-lab/media/hosted-media-provider-live.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ export function buildHostedMediaEvidence(params: {
795795
return createHostedMediaEvidenceWriter(params.options).build(params.result);
796796
}
797797

798-
export async function runHostedMediaProviderLiveProducer(
798+
async function runHostedMediaProviderLiveProducer(
799799
options: HostedMediaOptions,
800800
): Promise<QaEvidenceSummaryJson> {
801801
const writer = createHostedMediaEvidenceWriter(options);

test/e2e/qa-lab/plugins/plugin-lifecycle-probe-runtime.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ async function runMeasured(
492492
);
493493
}
494494

495-
export async function runPluginLifecycleMatrix() {
495+
async function runPluginLifecycleMatrix() {
496496
const pluginId = "lifecycle-claw";
497497
const packageName = "@openclaw/lifecycle-claw";
498498
const resourceDir = tempDirs.make("openclaw-plugin-lifecycle-matrix-");

0 commit comments

Comments
 (0)