mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 19:28:28 +00:00
refactor(agent): dedupe harness and command workflows
This commit is contained in:
@@ -10,6 +10,7 @@ import { parseFrontmatterBlock } from "../../markdown/frontmatter.js";
|
||||
import {
|
||||
getFrontmatterString,
|
||||
normalizeStringList,
|
||||
parseOpenClawManifestInstallBase,
|
||||
parseFrontmatterBool,
|
||||
resolveOpenClawManifestBlock,
|
||||
resolveOpenClawManifestInstall,
|
||||
@@ -22,30 +23,23 @@ export function parseFrontmatter(content: string): ParsedSkillFrontmatter {
|
||||
}
|
||||
|
||||
function parseInstallSpec(input: unknown): SkillInstallSpec | undefined {
|
||||
if (!input || typeof input !== "object") {
|
||||
const parsed = parseOpenClawManifestInstallBase(input, ["brew", "node", "go", "uv", "download"]);
|
||||
if (!parsed) {
|
||||
return undefined;
|
||||
}
|
||||
const raw = input as Record<string, unknown>;
|
||||
const kindRaw =
|
||||
typeof raw.kind === "string" ? raw.kind : typeof raw.type === "string" ? raw.type : "";
|
||||
const kind = kindRaw.trim().toLowerCase();
|
||||
if (kind !== "brew" && kind !== "node" && kind !== "go" && kind !== "uv" && kind !== "download") {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const { raw } = parsed;
|
||||
const spec: SkillInstallSpec = {
|
||||
kind: kind,
|
||||
kind: parsed.kind as SkillInstallSpec["kind"],
|
||||
};
|
||||
|
||||
if (typeof raw.id === "string") {
|
||||
spec.id = raw.id;
|
||||
if (parsed.id) {
|
||||
spec.id = parsed.id;
|
||||
}
|
||||
if (typeof raw.label === "string") {
|
||||
spec.label = raw.label;
|
||||
if (parsed.label) {
|
||||
spec.label = parsed.label;
|
||||
}
|
||||
const bins = normalizeStringList(raw.bins);
|
||||
if (bins.length > 0) {
|
||||
spec.bins = bins;
|
||||
if (parsed.bins) {
|
||||
spec.bins = parsed.bins;
|
||||
}
|
||||
const osList = normalizeStringList(raw.os);
|
||||
if (osList.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user