/** * Shared logic for the skill_manage agent tool (create / edit / patch / delete / write_file / remove_file). */ import type { Skill } from './types.js'; import type { SkillsConfig } from './types.js'; export declare const SKILL_MANAGE_ALLOWED_SUBDIRS: Set; export declare const SKILL_MANAGE_NAME_RE: RegExp; export declare const DEFAULT_MAX_SKILL_MD_CHARS = 100000; export declare const DEFAULT_MAX_SUPPORT_FILE_BYTES = 1048576; export type AgentWritePolicy = 'global' | 'workspace' | 'both'; export declare function effectiveAgentWritePolicy(cfg?: SkillsConfig): AgentWritePolicy; export declare function maxSkillMdChars(_cfg?: SkillsConfig): number; export declare function maxSupportFileBytes(cfg?: SkillsConfig): number; export declare function validateSkillNameSegment(name: string, label: string): string | null; export declare function validateSkillMdContent(content: string, expectedName: string, maxChars: number): { ok: true; } | { ok: false; error: string; }; /** Whether `filePath` is equal to `dir` or strictly inside it (resolved). */ export declare function isPathInsideDir(dir: string, filePath: string): boolean; export declare function resolveGlobalSkillsRoot(): string; export declare function resolveWorkspaceSkillsRoot(workspace: string): string; export declare function canWriteToPath(skillBaseDir: string, workspace: string, policy: AgentWritePolicy): boolean; export declare function mutatableSkillOrNull(skill: Skill | undefined, workspace: string, policy: AgentWritePolicy): Skill | null; export declare function validateSupportingRelativePath(filePath: string): string | null; export declare function atomicWriteUtf8(filePath: string, content: string): Promise; /** Scan skill dir; returns error message if critical findings (caller rolls back). */ export declare function scanSkillDirOrError(skillDir: string, skillName: string): Promise; export declare function resolveCreateSkillDir(name: string, category: string | undefined, writeTarget: 'global' | 'workspace', workspace: string, policy: AgentWritePolicy): { ok: true; dir: string; } | { ok: false; error: string; }; export declare function ensureCategorySegment(category: string | undefined): string | null; export declare function applyPatchToContent(content: string, oldString: string, newString: string, replaceAll: boolean): { ok: true; next: string; replacements: number; } | { ok: false; error: string; };