style: biome formatting
This commit is contained in:
@@ -48,20 +48,27 @@ function buildInstallCommand(spec: SkillInstallSpec): {
|
||||
} {
|
||||
switch (spec.kind) {
|
||||
case "brew": {
|
||||
if (!spec.formula) return { argv: null, shell: null, error: "missing brew formula" };
|
||||
if (!spec.formula)
|
||||
return { argv: null, shell: null, error: "missing brew formula" };
|
||||
return { argv: ["brew", "install", spec.formula], shell: null };
|
||||
}
|
||||
case "node": {
|
||||
if (!spec.package) return { argv: null, shell: null, error: "missing node package" };
|
||||
if (!spec.package)
|
||||
return { argv: null, shell: null, error: "missing node package" };
|
||||
return { argv: ["npm", "install", "-g", spec.package], shell: null };
|
||||
}
|
||||
case "go": {
|
||||
if (!spec.module) return { argv: null, shell: null, error: "missing go module" };
|
||||
if (!spec.module)
|
||||
return { argv: null, shell: null, error: "missing go module" };
|
||||
return { argv: ["go", "install", spec.module], shell: null };
|
||||
}
|
||||
case "pnpm": {
|
||||
if (!spec.repoPath || !spec.script) {
|
||||
return { argv: null, shell: null, error: "missing pnpm repoPath/script" };
|
||||
return {
|
||||
argv: null,
|
||||
shell: null,
|
||||
error: "missing pnpm repoPath/script",
|
||||
};
|
||||
}
|
||||
const repoPath = resolveUserPath(spec.repoPath);
|
||||
const cmd = `cd ${JSON.stringify(repoPath)} && pnpm install && pnpm run ${JSON.stringify(spec.script)}`;
|
||||
@@ -69,14 +76,19 @@ function buildInstallCommand(spec: SkillInstallSpec): {
|
||||
}
|
||||
case "git": {
|
||||
if (!spec.url || !spec.destination) {
|
||||
return { argv: null, shell: null, error: "missing git url/destination" };
|
||||
return {
|
||||
argv: null,
|
||||
shell: null,
|
||||
error: "missing git url/destination",
|
||||
};
|
||||
}
|
||||
const dest = resolveUserPath(spec.destination);
|
||||
const cmd = `if [ -d ${JSON.stringify(dest)} ]; then echo "Already cloned"; else git clone ${JSON.stringify(spec.url)} ${JSON.stringify(dest)}; fi`;
|
||||
return { argv: null, shell: cmd };
|
||||
}
|
||||
case "shell": {
|
||||
if (!spec.command) return { argv: null, shell: null, error: "missing shell command" };
|
||||
if (!spec.command)
|
||||
return { argv: null, shell: null, error: "missing shell command" };
|
||||
return { argv: null, shell: spec.command };
|
||||
}
|
||||
default:
|
||||
@@ -87,7 +99,10 @@ function buildInstallCommand(spec: SkillInstallSpec): {
|
||||
export async function installSkill(
|
||||
params: SkillInstallRequest,
|
||||
): Promise<SkillInstallResult> {
|
||||
const timeoutMs = Math.min(Math.max(params.timeoutMs ?? 300_000, 1_000), 900_000);
|
||||
const timeoutMs = Math.min(
|
||||
Math.max(params.timeoutMs ?? 300_000, 1_000),
|
||||
900_000,
|
||||
);
|
||||
const workspaceDir = resolveUserPath(params.workspaceDir);
|
||||
const entries = loadWorkspaceSkillEntries(workspaceDir);
|
||||
const entry = entries.find((item) => item.skill.name === params.skillName);
|
||||
@@ -134,7 +149,10 @@ export async function installSkill(
|
||||
|
||||
const result = command.shell
|
||||
? await runShell(command.shell, timeoutMs)
|
||||
: await runCommandWithTimeout(command.argv, { timeoutMs, cwd: command.cwd });
|
||||
: await runCommandWithTimeout(command.argv, {
|
||||
timeoutMs,
|
||||
cwd: command.cwd,
|
||||
});
|
||||
|
||||
const success = result.code === 0;
|
||||
return {
|
||||
|
||||
@@ -91,7 +91,10 @@ function normalizeInstallOptions(entry: SkillEntry): SkillInstallOption[] {
|
||||
});
|
||||
}
|
||||
|
||||
function buildSkillStatus(entry: SkillEntry, config?: ClawdisConfig): SkillStatusEntry {
|
||||
function buildSkillStatus(
|
||||
entry: SkillEntry,
|
||||
config?: ClawdisConfig,
|
||||
): SkillStatusEntry {
|
||||
const skillKey = resolveSkillKey(entry);
|
||||
const skillConfig = resolveSkillConfig(config, skillKey);
|
||||
const disabled = skillConfig?.enabled === false;
|
||||
@@ -113,11 +116,13 @@ function buildSkillStatus(entry: SkillEntry, config?: ClawdisConfig): SkillStatu
|
||||
missingEnv.push(envName);
|
||||
}
|
||||
|
||||
const configChecks: SkillStatusConfigCheck[] = requiredConfig.map((pathStr) => {
|
||||
const value = resolveConfigPath(config, pathStr);
|
||||
const satisfied = isConfigPathTruthy(config, pathStr);
|
||||
return { path: pathStr, value, satisfied };
|
||||
});
|
||||
const configChecks: SkillStatusConfigCheck[] = requiredConfig.map(
|
||||
(pathStr) => {
|
||||
const value = resolveConfigPath(config, pathStr);
|
||||
const satisfied = isConfigPathTruthy(config, pathStr);
|
||||
return { path: pathStr, value, satisfied };
|
||||
},
|
||||
);
|
||||
const missingConfig = configChecks
|
||||
.filter((check) => !check.satisfied)
|
||||
.map((check) => check.path);
|
||||
|
||||
@@ -279,7 +279,6 @@ function resolveSkillKey(skill: Skill, entry?: SkillEntry): string {
|
||||
return entry?.clawdis?.skillKey ?? skill.name;
|
||||
}
|
||||
|
||||
|
||||
function shouldIncludeSkill(params: {
|
||||
entry: SkillEntry;
|
||||
config?: ClawdisConfig;
|
||||
@@ -329,7 +328,6 @@ function filterSkillEntries(
|
||||
return entries.filter((entry) => shouldIncludeSkill({ entry, config }));
|
||||
}
|
||||
|
||||
|
||||
export function applySkillEnvOverrides(params: {
|
||||
skills: SkillEntry[];
|
||||
config?: ClawdisConfig;
|
||||
|
||||
@@ -13,12 +13,6 @@ import {
|
||||
ConfigGetParamsSchema,
|
||||
type ConfigSetParams,
|
||||
ConfigSetParamsSchema,
|
||||
type SkillsInstallParams,
|
||||
SkillsInstallParamsSchema,
|
||||
type SkillsStatusParams,
|
||||
SkillsStatusParamsSchema,
|
||||
type SkillsUpdateParams,
|
||||
SkillsUpdateParamsSchema,
|
||||
type ConnectParams,
|
||||
ConnectParamsSchema,
|
||||
type CronAddParams,
|
||||
@@ -79,6 +73,12 @@ import {
|
||||
SessionsPatchParamsSchema,
|
||||
type ShutdownEvent,
|
||||
ShutdownEventSchema,
|
||||
type SkillsInstallParams,
|
||||
SkillsInstallParamsSchema,
|
||||
type SkillsStatusParams,
|
||||
SkillsStatusParamsSchema,
|
||||
type SkillsUpdateParams,
|
||||
SkillsUpdateParamsSchema,
|
||||
type Snapshot,
|
||||
SnapshotSchema,
|
||||
type StateVersion,
|
||||
|
||||
@@ -11,8 +11,8 @@ import chalk from "chalk";
|
||||
import { type WebSocket, WebSocketServer } from "ws";
|
||||
import { lookupContextTokens } from "../agents/context.js";
|
||||
import { DEFAULT_CONTEXT_TOKENS, DEFAULT_MODEL } from "../agents/defaults.js";
|
||||
import { buildWorkspaceSkillStatus } from "../agents/skills-status.js";
|
||||
import { installSkill } from "../agents/skills-install.js";
|
||||
import { buildWorkspaceSkillStatus } from "../agents/skills-status.js";
|
||||
import { DEFAULT_AGENT_WORKSPACE_DIR } from "../agents/workspace.js";
|
||||
import {
|
||||
normalizeThinkLevel,
|
||||
|
||||
Reference in New Issue
Block a user