Skip to content

Commit 5acfc89

Browse files
committed
refactor: trim internal helper exports
1 parent 5e35112 commit 5acfc89

7 files changed

Lines changed: 13 additions & 46 deletions

File tree

scripts/lib/arg-utils.mjs

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export function readFlagValue(args, name) {
2020
return undefined;
2121
}
2222

23-
export function consumeStringFlag(argv, index, flag, currentValue) {
23+
function consumeStringFlag(argv, index, flag, currentValue) {
2424
if (argv[index] !== flag) {
2525
return null;
2626
}
@@ -30,18 +30,7 @@ export function consumeStringFlag(argv, index, flag, currentValue) {
3030
};
3131
}
3232

33-
export function consumeStringListFlag(argv, index, flag) {
34-
if (argv[index] !== flag) {
35-
return null;
36-
}
37-
const value = argv[index + 1];
38-
return {
39-
nextIndex: index + 1,
40-
value: typeof value === "string" && value.length > 0 ? value : null,
41-
};
42-
}
43-
44-
export function consumeIntFlag(argv, index, flag, currentValue, options = {}) {
33+
function consumeIntFlag(argv, index, flag, currentValue, options = {}) {
4534
if (argv[index] !== flag) {
4635
return null;
4736
}
@@ -53,7 +42,7 @@ export function consumeIntFlag(argv, index, flag, currentValue, options = {}) {
5342
};
5443
}
5544

56-
export function consumeFloatFlag(argv, index, flag, currentValue, options = {}) {
45+
function consumeFloatFlag(argv, index, flag, currentValue, options = {}) {
5746
if (argv[index] !== flag) {
5847
return null;
5948
}
@@ -84,25 +73,6 @@ export function stringFlag(flag, key) {
8473
};
8574
}
8675

87-
export function stringListFlag(flag, key) {
88-
return {
89-
consume(argv, index) {
90-
const option = consumeStringListFlag(argv, index, flag);
91-
if (!option) {
92-
return null;
93-
}
94-
return {
95-
nextIndex: option.nextIndex,
96-
apply(target) {
97-
if (option.value) {
98-
target[key].push(option.value);
99-
}
100-
},
101-
};
102-
},
103-
};
104-
}
105-
10676
function createAssignedValueFlag(consumeOption) {
10777
return {
10878
consume(argv, index, args) {

src/agents/auth-profiles/state.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,7 @@ export function loadPersistedAuthProfileState(agentDir?: string): AuthProfileSta
7070
return coerceAuthProfileState(loadJsonFile(resolveAuthStatePath(agentDir)));
7171
}
7272

73-
export function buildPersistedAuthProfileState(
74-
store: AuthProfileState,
75-
): AuthProfileStateStore | null {
73+
function buildPersistedAuthProfileState(store: AuthProfileState): AuthProfileStateStore | null {
7674
const state = coerceAuthProfileState(store);
7775
if (!state.order && !state.lastGood && !state.usageStats) {
7876
return null;

src/agents/auth-profiles/usage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ function applyWhamCooldownResult(params: {
150150
};
151151
}
152152

153-
export async function probeWhamForCooldown(
153+
async function probeWhamForCooldown(
154154
store: AuthProfileStore,
155155
profileId: string,
156156
): Promise<WhamCooldownProbeResult | null> {

src/agents/cli-runner/bundle-mcp-adapter-shared.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export function isRecord(value: unknown): value is Record<string, unknown> {
44
return typeof value === "object" && value !== null && !Array.isArray(value);
55
}
66

7-
export function normalizeStringArray(value: unknown): string[] | undefined {
7+
function normalizeStringArray(value: unknown): string[] | undefined {
88
return Array.isArray(value) && value.every((entry) => typeof entry === "string")
99
? [...value]
1010
: undefined;

src/agents/cli-runner/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ function resolveCliImageRoot(params: { backend: CliBackendConfig; workspaceDir:
227227
return path.join(resolvePreferredOpenClawTmpDir(), "openclaw-cli-images");
228228
}
229229

230-
export function appendImagePathsToPrompt(prompt: string, paths: string[], prefix = ""): string {
230+
function appendImagePathsToPrompt(prompt: string, paths: string[], prefix = ""): string {
231231
if (!paths.length) {
232232
return prompt;
233233
}

src/agents/sandbox/validate-sandbox-security.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ import {
1818
import { getBlockedNetworkModeReason } from "./network-mode.js";
1919

2020
// Targeted denylist: host paths that should never be exposed inside sandbox containers.
21-
// Exported for reuse in security audit collectors.
22-
export const BLOCKED_HOST_PATHS = [
21+
const BLOCKED_HOST_PATHS = [
2322
"/etc",
2423
"/private/etc",
2524
"/proc",
@@ -92,18 +91,18 @@ function parseBindSpec(bind: string): ParsedBindSpec {
9291
* Parse the host/source path from a Docker bind mount string.
9392
* Format: `source:target[:mode]`
9493
*/
95-
export function parseBindSourcePath(bind: string): string {
94+
function parseBindSourcePath(bind: string): string {
9695
return parseBindSpec(bind).source.trim();
9796
}
9897

99-
export function parseBindTargetPath(bind: string): string {
98+
function parseBindTargetPath(bind: string): string {
10099
return parseBindSpec(bind).target.trim();
101100
}
102101

103102
/**
104103
* Normalize a POSIX path: resolve `.`, `..`, collapse `//`, strip trailing `/`.
105104
*/
106-
export function normalizeHostPath(raw: string): string {
105+
function normalizeHostPath(raw: string): string {
107106
return normalizeSandboxHostPath(raw);
108107
}
109108

@@ -135,7 +134,7 @@ export function getBlockedBindReason(bind: string): BlockedBindReason | null {
135134
return null;
136135
}
137136

138-
export function getBlockedReasonForSourcePath(
137+
function getBlockedReasonForSourcePath(
139138
sourceNormalized: string,
140139
blockedHostPaths: string[],
141140
): BlockedBindReason | null {

src/plugins/installed-plugin-index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,5 +133,5 @@ export function isInstalledPluginEnabled(
133133
rootConfig: config,
134134
enabledByDefault: record.enabledByDefault,
135135
});
136-
return state.enabled && (record.enabled || state.explicitlyEnabled === true);
136+
return state.enabled && (record.enabled || state.explicitlyEnabled);
137137
}

0 commit comments

Comments
 (0)