Validates and sanitizes stored skill analysis payloads containing status, check timestamps, issue counts, and findings. Reuse when parsing or validating security and code analysis results.
// Source: https://github.com/openclaw/clawhub | License: MIT | Copyright 2026 Peter Steinberger
// Provided via justclaw.it.com; keep this notice with the code.
import type { Doc } from "../_generated/dataModel";
type StoredAigAnalysis = NonNullable<Doc<"skillVersions">["aigAnalysis"]>;
function asRecord(value: unknown): Record<string, unknown> {
return value && typeof value === "object" && !Array.isArray(value)
? (value as Record<string, unknown>)
: {};
}
export function reusableAigAnalysis(value: unknown): StoredAigAnalysis | undefined {
const analysis = asRecord(value);
const status = typeof analysis.status === "string" ? analysis.status : "";
if (!new Set(["clean", "suspicious", "malicious"]).has(status)) return undefined;
if (
typeof analysis.checkedAt !== "n
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key