chore: rename project to clawdbot

This commit is contained in:
Peter Steinberger
2026-01-04 14:32:47 +00:00
parent d48dc71fa4
commit 246adaa119
841 changed files with 4590 additions and 4328 deletions

View File

@@ -8,7 +8,7 @@ import {
type Skill,
} from "@mariozechner/pi-coding-agent";
import type { ClawdisConfig, SkillConfig } from "../config/config.js";
import type { ClawdbotConfig, SkillConfig } from "../config/config.js";
import { CONFIG_DIR, resolveUserPath } from "../utils.js";
export type SkillInstallSpec = {
@@ -21,7 +21,7 @@ export type SkillInstallSpec = {
module?: string;
};
export type ClawdisSkillMetadata = {
export type ClawdbotSkillMetadata = {
always?: boolean;
skillKey?: string;
primaryEnv?: string;
@@ -47,7 +47,7 @@ type ParsedSkillFrontmatter = Record<string, string>;
export type SkillEntry = {
skill: Skill;
frontmatter: ParsedSkillFrontmatter;
clawdis?: ClawdisSkillMetadata;
clawdbot?: ClawdbotSkillMetadata;
};
export type SkillSnapshot = {
@@ -57,7 +57,7 @@ export type SkillSnapshot = {
};
function resolveBundledSkillsDir(): string | undefined {
const override = process.env.CLAWDIS_BUNDLED_SKILLS_DIR?.trim();
const override = process.env.CLAWDBOT_BUNDLED_SKILLS_DIR?.trim();
if (override) return override;
// bun --compile: ship a sibling `skills/` next to the executable.
@@ -173,7 +173,7 @@ const DEFAULT_CONFIG_VALUES: Record<string, boolean> = {
};
export function resolveSkillsInstallPreferences(
config?: ClawdisConfig,
config?: ClawdbotConfig,
): SkillsInstallPreferences {
const raw = config?.skills?.install;
const preferBrew = raw?.preferBrew ?? true;
@@ -195,7 +195,7 @@ export function resolveRuntimePlatform(): string {
}
export function resolveConfigPath(
config: ClawdisConfig | undefined,
config: ClawdbotConfig | undefined,
pathStr: string,
) {
const parts = pathStr.split(".").filter(Boolean);
@@ -208,7 +208,7 @@ export function resolveConfigPath(
}
export function isConfigPathTruthy(
config: ClawdisConfig | undefined,
config: ClawdbotConfig | undefined,
pathStr: string,
): boolean {
const value = resolveConfigPath(config, pathStr);
@@ -219,7 +219,7 @@ export function isConfigPathTruthy(
}
export function resolveSkillConfig(
config: ClawdisConfig | undefined,
config: ClawdbotConfig | undefined,
skillKey: string,
): SkillConfig | undefined {
const skills = config?.skills?.entries;
@@ -237,7 +237,7 @@ function normalizeAllowlist(input: unknown): string[] | undefined {
}
function isBundledSkill(entry: SkillEntry): boolean {
return entry.skill.source === "clawdis-bundled";
return entry.skill.source === "clawdbot-bundled";
}
export function isBundledSkillAllowed(
@@ -265,44 +265,44 @@ export function hasBinary(bin: string): boolean {
return false;
}
function resolveClawdisMetadata(
function resolveClawdbotMetadata(
frontmatter: ParsedSkillFrontmatter,
): ClawdisSkillMetadata | undefined {
): ClawdbotSkillMetadata | undefined {
const raw = getFrontmatterValue(frontmatter, "metadata");
if (!raw) return undefined;
try {
const parsed = JSON.parse(raw) as { clawdis?: unknown };
const parsed = JSON.parse(raw) as { clawdbot?: unknown };
if (!parsed || typeof parsed !== "object") return undefined;
const clawdis = (parsed as { clawdis?: unknown }).clawdis;
if (!clawdis || typeof clawdis !== "object") return undefined;
const clawdisObj = clawdis as Record<string, unknown>;
const clawdbot = (parsed as { clawdbot?: unknown }).clawdbot;
if (!clawdbot || typeof clawdbot !== "object") return undefined;
const clawdbotObj = clawdbot as Record<string, unknown>;
const requiresRaw =
typeof clawdisObj.requires === "object" && clawdisObj.requires !== null
? (clawdisObj.requires as Record<string, unknown>)
typeof clawdbotObj.requires === "object" && clawdbotObj.requires !== null
? (clawdbotObj.requires as Record<string, unknown>)
: undefined;
const installRaw = Array.isArray(clawdisObj.install)
? (clawdisObj.install as unknown[])
const installRaw = Array.isArray(clawdbotObj.install)
? (clawdbotObj.install as unknown[])
: [];
const install = installRaw
.map((entry) => parseInstallSpec(entry))
.filter((entry): entry is SkillInstallSpec => Boolean(entry));
const osRaw = normalizeStringList(clawdisObj.os);
const osRaw = normalizeStringList(clawdbotObj.os);
return {
always:
typeof clawdisObj.always === "boolean" ? clawdisObj.always : undefined,
typeof clawdbotObj.always === "boolean" ? clawdbotObj.always : undefined,
emoji:
typeof clawdisObj.emoji === "string" ? clawdisObj.emoji : undefined,
typeof clawdbotObj.emoji === "string" ? clawdbotObj.emoji : undefined,
homepage:
typeof clawdisObj.homepage === "string"
? clawdisObj.homepage
typeof clawdbotObj.homepage === "string"
? clawdbotObj.homepage
: undefined,
skillKey:
typeof clawdisObj.skillKey === "string"
? clawdisObj.skillKey
typeof clawdbotObj.skillKey === "string"
? clawdbotObj.skillKey
: undefined,
primaryEnv:
typeof clawdisObj.primaryEnv === "string"
? clawdisObj.primaryEnv
typeof clawdbotObj.primaryEnv === "string"
? clawdbotObj.primaryEnv
: undefined,
os: osRaw.length > 0 ? osRaw : undefined,
requires: requiresRaw
@@ -321,53 +321,53 @@ function resolveClawdisMetadata(
}
function resolveSkillKey(skill: Skill, entry?: SkillEntry): string {
return entry?.clawdis?.skillKey ?? skill.name;
return entry?.clawdbot?.skillKey ?? skill.name;
}
function shouldIncludeSkill(params: {
entry: SkillEntry;
config?: ClawdisConfig;
config?: ClawdbotConfig;
}): boolean {
const { entry, config } = params;
const skillKey = resolveSkillKey(entry.skill, entry);
const skillConfig = resolveSkillConfig(config, skillKey);
const allowBundled = normalizeAllowlist(config?.skills?.allowBundled);
const osList = entry.clawdis?.os ?? [];
const osList = entry.clawdbot?.os ?? [];
if (skillConfig?.enabled === false) return false;
if (!isBundledSkillAllowed(entry, allowBundled)) return false;
if (osList.length > 0 && !osList.includes(resolveRuntimePlatform())) {
return false;
}
if (entry.clawdis?.always === true) {
if (entry.clawdbot?.always === true) {
return true;
}
const requiredBins = entry.clawdis?.requires?.bins ?? [];
const requiredBins = entry.clawdbot?.requires?.bins ?? [];
if (requiredBins.length > 0) {
for (const bin of requiredBins) {
if (!hasBinary(bin)) return false;
}
}
const requiredAnyBins = entry.clawdis?.requires?.anyBins ?? [];
const requiredAnyBins = entry.clawdbot?.requires?.anyBins ?? [];
if (requiredAnyBins.length > 0) {
const anyFound = requiredAnyBins.some((bin) => hasBinary(bin));
if (!anyFound) return false;
}
const requiredEnv = entry.clawdis?.requires?.env ?? [];
const requiredEnv = entry.clawdbot?.requires?.env ?? [];
if (requiredEnv.length > 0) {
for (const envName of requiredEnv) {
if (process.env[envName]) continue;
if (skillConfig?.env?.[envName]) continue;
if (skillConfig?.apiKey && entry.clawdis?.primaryEnv === envName) {
if (skillConfig?.apiKey && entry.clawdbot?.primaryEnv === envName) {
continue;
}
return false;
}
}
const requiredConfig = entry.clawdis?.requires?.config ?? [];
const requiredConfig = entry.clawdbot?.requires?.config ?? [];
if (requiredConfig.length > 0) {
for (const configPath of requiredConfig) {
if (!isConfigPathTruthy(config, configPath)) return false;
@@ -379,14 +379,14 @@ function shouldIncludeSkill(params: {
function filterSkillEntries(
entries: SkillEntry[],
config?: ClawdisConfig,
config?: ClawdbotConfig,
): SkillEntry[] {
return entries.filter((entry) => shouldIncludeSkill({ entry, config }));
}
export function applySkillEnvOverrides(params: {
skills: SkillEntry[];
config?: ClawdisConfig;
config?: ClawdbotConfig;
}) {
const { skills, config } = params;
const updates: Array<{ key: string; prev: string | undefined }> = [];
@@ -404,7 +404,7 @@ export function applySkillEnvOverrides(params: {
}
}
const primaryEnv = entry.clawdis?.primaryEnv;
const primaryEnv = entry.clawdbot?.primaryEnv;
if (primaryEnv && skillConfig.apiKey && !process.env[primaryEnv]) {
updates.push({ key: primaryEnv, prev: process.env[primaryEnv] });
process.env[primaryEnv] = skillConfig.apiKey;
@@ -421,7 +421,7 @@ export function applySkillEnvOverrides(params: {
export function applySkillEnvOverridesFromSnapshot(params: {
snapshot?: SkillSnapshot;
config?: ClawdisConfig;
config?: ClawdbotConfig;
}) {
const { snapshot, config } = params;
if (!snapshot) return () => {};
@@ -463,7 +463,7 @@ export function applySkillEnvOverridesFromSnapshot(params: {
function loadSkillEntries(
workspaceDir: string,
opts?: {
config?: ClawdisConfig;
config?: ClawdbotConfig;
managedSkillsDir?: string;
bundledSkillsDir?: string;
},
@@ -494,23 +494,23 @@ function loadSkillEntries(
const bundledSkills = bundledSkillsDir
? loadSkills({
dir: bundledSkillsDir,
source: "clawdis-bundled",
source: "clawdbot-bundled",
})
: [];
const extraSkills = extraDirs.flatMap((dir) => {
const resolved = resolveUserPath(dir);
return loadSkills({
dir: resolved,
source: "clawdis-extra",
source: "clawdbot-extra",
});
});
const managedSkills = loadSkills({
dir: managedSkillsDir,
source: "clawdis-managed",
source: "clawdbot-managed",
});
const workspaceSkills = loadSkills({
dir: workspaceSkillsDir,
source: "clawdis-workspace",
source: "clawdbot-workspace",
});
const merged = new Map<string, Skill>();
@@ -532,7 +532,7 @@ function loadSkillEntries(
return {
skill,
frontmatter,
clawdis: resolveClawdisMetadata(frontmatter),
clawdbot: resolveClawdbotMetadata(frontmatter),
};
},
);
@@ -542,7 +542,7 @@ function loadSkillEntries(
export function buildWorkspaceSkillSnapshot(
workspaceDir: string,
opts?: {
config?: ClawdisConfig;
config?: ClawdbotConfig;
managedSkillsDir?: string;
bundledSkillsDir?: string;
entries?: SkillEntry[];
@@ -555,7 +555,7 @@ export function buildWorkspaceSkillSnapshot(
prompt: formatSkillsForPrompt(resolvedSkills),
skills: eligible.map((entry) => ({
name: entry.skill.name,
primaryEnv: entry.clawdis?.primaryEnv,
primaryEnv: entry.clawdbot?.primaryEnv,
})),
resolvedSkills,
};
@@ -564,7 +564,7 @@ export function buildWorkspaceSkillSnapshot(
export function buildWorkspaceSkillsPrompt(
workspaceDir: string,
opts?: {
config?: ClawdisConfig;
config?: ClawdbotConfig;
managedSkillsDir?: string;
bundledSkillsDir?: string;
entries?: SkillEntry[];
@@ -578,7 +578,7 @@ export function buildWorkspaceSkillsPrompt(
export function loadWorkspaceSkillEntries(
workspaceDir: string,
opts?: {
config?: ClawdisConfig;
config?: ClawdbotConfig;
managedSkillsDir?: string;
bundledSkillsDir?: string;
},
@@ -588,12 +588,12 @@ export function loadWorkspaceSkillEntries(
export function filterWorkspaceSkillEntries(
entries: SkillEntry[],
config?: ClawdisConfig,
config?: ClawdbotConfig,
): SkillEntry[] {
return filterSkillEntries(entries, config);
}
export function resolveBundledAllowlist(
config?: ClawdisConfig,
config?: ClawdbotConfig,
): string[] | undefined {
return normalizeAllowlist(config?.skills?.allowBundled);
}