refactor(skills): trim loader export surface

This commit is contained in:
Vincent Koc
2026-06-17 16:24:54 +08:00
parent 4132ce155e
commit 5b1ba437ba
6 changed files with 4 additions and 33 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ function pathFor(platform: NodeJS.Platform) {
// "not logged in", even though the operator HOME has a valid hosts.yml.
// See https://github.com/openclaw/openclaw/issues/78063.
export type GhConfigDiscoveryEnv = {
type GhConfigDiscoveryEnv = {
HOME?: string;
XDG_CONFIG_HOME?: string;
GH_CONFIG_DIR?: string;
+1 -1
View File
@@ -8,7 +8,7 @@ let hasWarnedMissingBundledDir = false;
let cachedBundledContext: { dir: string; names: Set<string> } | null = null;
/** Bundled skill path context resolved from runtime defaults. */
export type BundledSkillsContext = {
type BundledSkillsContext = {
dir?: string;
names: Set<string>;
};
+1 -3
View File
@@ -10,8 +10,6 @@ import {
evaluateRuntimeEligibility,
hasBinary,
isConfigPathTruthyWithDefaults,
resolveConfigPath,
resolveRuntimePlatform,
} from "../../shared/config-eval.js";
import type { SkillEligibilityContext, SkillEntry, SkillsInstallPreferences } from "../types.js";
import { resolveSkillKey } from "./frontmatter.js";
@@ -23,7 +21,7 @@ const DEFAULT_CONFIG_VALUES: Record<string, boolean> = {
};
/** Platform helpers re-exported for skill loading callers and tests. */
export { hasBinary, resolveConfigPath, resolveRuntimePlatform };
export { hasBinary };
export function resolveSkillsInstallPreferences(config?: OpenClawConfig): SkillsInstallPreferences {
const raw = config?.skills?.install;
-1
View File
@@ -292,4 +292,3 @@ export const testing = {
publishPluginSkills,
resolvePluginSkillLinkType,
};
export { testing as __testing };
+1 -20
View File
@@ -1,9 +1,6 @@
// Skill contract types describe loaded skill metadata, sources, and prompt surfaces.
import type { SourceInfo } from "../../agents/sessions/source-info.js";
export type SourceScope = "user" | "project" | "temporary";
export type SourceOrigin = "package" | "top-level";
export interface Skill {
name: string;
description: string;
@@ -17,23 +14,7 @@ export interface Skill {
source: string;
}
export function createSyntheticSourceInfo(
path: string,
options: {
source: string;
scope?: SourceScope;
origin?: SourceOrigin;
baseDir?: string;
},
): SourceInfo {
return {
path,
source: options.source,
scope: options.scope ?? "temporary",
origin: options.origin ?? "top-level",
baseDir: options.baseDir,
};
}
export { createSyntheticSourceInfo } from "../../agents/sessions/source-info.js";
function escapeXml(str: string): string {
return str
-7
View File
@@ -31,13 +31,6 @@ export function findContainingAllowedSkillSymlinkTarget(
return null;
}
export function isPathInsideAnyAllowedSkillSymlinkTarget(
rootRealPaths: readonly string[],
candidateRealPath: string,
): boolean {
return findContainingAllowedSkillSymlinkTarget(rootRealPaths, candidateRealPath) !== null;
}
export function tryRealpath(filePath: string): string | null {
try {
return fs.realpathSync(filePath);