mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 13:10:43 +00:00
refactor: trim helper exports
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
||||
import { join, posix, resolve } from "node:path";
|
||||
|
||||
export const EXTENSION_PACKAGE_BOUNDARY_BASE_CONFIG =
|
||||
"extensions/tsconfig.package-boundary.base.json" as const;
|
||||
|
||||
export const EXTENSION_PACKAGE_BOUNDARY_INCLUDE = ["./*.ts", "./src/**/*.ts"] as const;
|
||||
export const EXTENSION_PACKAGE_BOUNDARY_EXCLUDE = [
|
||||
"./**/*.test.ts",
|
||||
@@ -104,7 +101,7 @@ export const EXTENSION_PACKAGE_BOUNDARY_XAI_PATHS = {
|
||||
"@openclaw/speech-core/runtime-api.js": ["./.boundary-stubs/speech-core-runtime-api.d.ts"],
|
||||
} as const;
|
||||
|
||||
export type ExtensionPackageBoundaryTsConfigJson = {
|
||||
type ExtensionPackageBoundaryTsConfigJson = {
|
||||
extends?: unknown;
|
||||
compilerOptions?: {
|
||||
rootDir?: unknown;
|
||||
@@ -114,7 +111,7 @@ export type ExtensionPackageBoundaryTsConfigJson = {
|
||||
exclude?: unknown;
|
||||
};
|
||||
|
||||
export type ExtensionPackageBoundaryPackageJson = {
|
||||
type ExtensionPackageBoundaryPackageJson = {
|
||||
devDependencies?: Record<string, string>;
|
||||
};
|
||||
|
||||
@@ -123,21 +120,18 @@ function readJsonFile<T>(filePath: string): T {
|
||||
return JSON.parse(readFileSync(filePath, "utf8")) as T;
|
||||
}
|
||||
|
||||
export function collectBundledExtensionIds(rootDir = resolve(".")): string[] {
|
||||
function collectBundledExtensionIds(rootDir = resolve(".")): string[] {
|
||||
return readdirSync(join(rootDir, "extensions"), { withFileTypes: true })
|
||||
.filter((entry) => entry.isDirectory())
|
||||
.map((entry) => entry.name)
|
||||
.toSorted();
|
||||
}
|
||||
|
||||
export function resolveExtensionTsconfigPath(extensionId: string, rootDir = resolve(".")): string {
|
||||
function resolveExtensionTsconfigPath(extensionId: string, rootDir = resolve(".")): string {
|
||||
return join(rootDir, "extensions", extensionId, "tsconfig.json");
|
||||
}
|
||||
|
||||
export function resolveExtensionPackageJsonPath(
|
||||
extensionId: string,
|
||||
rootDir = resolve("."),
|
||||
): string {
|
||||
function resolveExtensionPackageJsonPath(extensionId: string, rootDir = resolve(".")): string {
|
||||
return join(rootDir, "extensions", extensionId, "package.json");
|
||||
}
|
||||
|
||||
@@ -178,29 +172,3 @@ export function collectOptInExtensionPackageBoundaries(rootDir = resolve(".")):
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export function renderExtensionPackageBoundaryTsconfig(params?: {
|
||||
paths?: Record<string, readonly string[]>;
|
||||
}): {
|
||||
extends: "../tsconfig.package-boundary.base.json";
|
||||
compilerOptions: { rootDir: "."; paths?: Record<string, readonly string[]> };
|
||||
include: typeof EXTENSION_PACKAGE_BOUNDARY_INCLUDE;
|
||||
exclude: typeof EXTENSION_PACKAGE_BOUNDARY_EXCLUDE;
|
||||
} {
|
||||
return {
|
||||
extends: "../tsconfig.package-boundary.base.json",
|
||||
compilerOptions: {
|
||||
rootDir: ".",
|
||||
...(params?.paths
|
||||
? {
|
||||
paths: {
|
||||
...EXTENSION_PACKAGE_BOUNDARY_BASE_PATHS,
|
||||
...params.paths,
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
},
|
||||
include: EXTENSION_PACKAGE_BOUNDARY_INCLUDE,
|
||||
exclude: EXTENSION_PACKAGE_BOUNDARY_EXCLUDE,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -7,30 +7,17 @@ import {
|
||||
collectChangedExtensionIdsFromPaths,
|
||||
collectPublishablePluginPackageErrors,
|
||||
parsePluginReleaseArgs,
|
||||
parsePluginReleaseSelection,
|
||||
parsePluginReleaseSelectionMode,
|
||||
resolvePublishablePluginVersion,
|
||||
resolveGitCommitSha,
|
||||
resolveChangedPublishablePluginPackages,
|
||||
resolveSelectedPublishablePluginPackages,
|
||||
type GitRangeSelection,
|
||||
type ParsedPluginReleaseArgs,
|
||||
type PluginReleaseSelectionMode,
|
||||
} from "./plugin-npm-release.ts";
|
||||
|
||||
export {
|
||||
collectChangedExtensionIdsFromPaths,
|
||||
parsePluginReleaseArgs,
|
||||
parsePluginReleaseSelection,
|
||||
parsePluginReleaseSelectionMode,
|
||||
resolveChangedPublishablePluginPackages,
|
||||
resolveSelectedPublishablePluginPackages,
|
||||
type GitRangeSelection,
|
||||
type ParsedPluginReleaseArgs,
|
||||
type PluginReleaseSelectionMode,
|
||||
};
|
||||
export { parsePluginReleaseArgs };
|
||||
|
||||
export type PluginPackageJson = {
|
||||
type PluginPackageJson = {
|
||||
name?: string;
|
||||
version?: string;
|
||||
private?: boolean;
|
||||
@@ -63,17 +50,17 @@ export type PublishablePluginPackage = {
|
||||
publishTag: "latest" | "beta";
|
||||
};
|
||||
|
||||
export type PluginReleasePlanItem = PublishablePluginPackage & {
|
||||
type PluginReleasePlanItem = PublishablePluginPackage & {
|
||||
alreadyPublished: boolean;
|
||||
};
|
||||
|
||||
export type PluginReleasePlan = {
|
||||
type PluginReleasePlan = {
|
||||
all: PluginReleasePlanItem[];
|
||||
candidates: PluginReleasePlanItem[];
|
||||
skippedPublished: PluginReleasePlanItem[];
|
||||
};
|
||||
|
||||
export type ClawHubPublishablePluginPackageFilters = {
|
||||
type ClawHubPublishablePluginPackageFilters = {
|
||||
extensionIds?: readonly string[];
|
||||
packageNames?: readonly string[];
|
||||
};
|
||||
|
||||
@@ -383,7 +383,6 @@ function collectGatewayCpuObservations(params) {
|
||||
}
|
||||
|
||||
export {
|
||||
collectCommandAliasRecords,
|
||||
collectQaBaselineRegressionObservations,
|
||||
collectGatewayCpuObservations,
|
||||
collectMetricObservations,
|
||||
|
||||
@@ -7,8 +7,6 @@ import {
|
||||
} from "../../shared/string-coerce.js";
|
||||
import { extractSimpleExplicitGroupId } from "./group-id-simple.js";
|
||||
|
||||
export { extractSimpleExplicitGroupId };
|
||||
|
||||
export function extractExplicitGroupId(raw: string | undefined | null): string | undefined {
|
||||
const trimmed = normalizeOptionalString(raw) ?? "";
|
||||
if (!trimmed) {
|
||||
|
||||
@@ -22,7 +22,6 @@ import { note } from "../terminal/note.js";
|
||||
import { isRecord } from "../utils.js";
|
||||
import type { DoctorPrompter } from "./doctor-prompter.js";
|
||||
import { buildProviderAuthRecoveryHint } from "./provider-auth-guidance.js";
|
||||
export { maybeRepairLegacyOAuthProfileIds } from "./doctor-auth-legacy-oauth.js";
|
||||
|
||||
const CODEX_PROVIDER_ID = "openai-codex";
|
||||
const CODEX_OAUTH_WARNING_TITLE = "Codex OAuth";
|
||||
@@ -169,7 +168,7 @@ export function formatOAuthRefreshFailureDoctorLine(params: {
|
||||
return `- ${params.profileId}: OAuth refresh failed — Try again; if this persists, run \`${command}\`.`;
|
||||
}
|
||||
|
||||
export async function resolveAuthIssueHint(
|
||||
async function resolveAuthIssueHint(
|
||||
issue: AuthIssue,
|
||||
cfg: OpenClawConfig,
|
||||
store: ReturnType<typeof ensureAuthProfileStore>,
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { PairingChannel } from "../pairing/pairing-store.types.js";
|
||||
import { normalizeOptionalString } from "../shared/string-coerce.js";
|
||||
import { note } from "../terminal/note.js";
|
||||
|
||||
export function resolveConfiguredCommandOwners(cfg: OpenClawConfig): string[] {
|
||||
function resolveConfiguredCommandOwners(cfg: OpenClawConfig): string[] {
|
||||
const owners = cfg.commands?.ownerAllowFrom;
|
||||
if (!Array.isArray(owners)) {
|
||||
return [];
|
||||
|
||||
@@ -152,7 +152,7 @@ export function normalizeLegacyDeliveryInput(params: {
|
||||
};
|
||||
}
|
||||
|
||||
export function stripLegacyDeliveryFields(payload: Record<string, unknown>) {
|
||||
function stripLegacyDeliveryFields(payload: Record<string, unknown>) {
|
||||
if ("deliver" in payload) {
|
||||
delete payload.deliver;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ import { probeGateway } from "../gateway/probe.js";
|
||||
import {
|
||||
detectBrowserOpenSupport,
|
||||
openUrl,
|
||||
openUrlInBackground,
|
||||
resolveBrowserOpenCommand,
|
||||
} from "../infra/browser-open.js";
|
||||
import { detectBinary } from "../infra/detect-binary.js";
|
||||
@@ -28,7 +27,7 @@ import type { NodeManagerChoice, OnboardMode, ResetScope } from "./onboard-types
|
||||
export { randomToken } from "./random-token.js";
|
||||
|
||||
export { detectBinary };
|
||||
export { detectBrowserOpenSupport, openUrl, openUrlInBackground, resolveBrowserOpenCommand };
|
||||
export { detectBrowserOpenSupport, openUrl, resolveBrowserOpenCommand };
|
||||
export { resolveControlUiLinks };
|
||||
|
||||
export function guardCancel<T>(value: T | symbol, runtime: RuntimeEnv): T {
|
||||
|
||||
@@ -24,7 +24,7 @@ function matchesProviderAuthChoice(
|
||||
return normalizeProviderIdForAuth(choice.providerId, aliases) === normalized;
|
||||
}
|
||||
|
||||
export function resolveProviderAuthLoginCommand(params: {
|
||||
function resolveProviderAuthLoginCommand(params: {
|
||||
provider: string;
|
||||
config?: OpenClawConfig;
|
||||
workspaceDir?: string;
|
||||
|
||||
Reference in New Issue
Block a user