类 SkillFileSystemHelper

java.lang.Object
io.agentscope.core.skill.util.SkillFileSystemHelper

@Deprecated(since="2.0.0") public final class SkillFileSystemHelper extends Object
已过时。
since 2.0.0. The skill package is removed; manage markdown skill catalogs in application code.
Utility class for file system operations related to skills.

This class provides reusable operations for loading, listing, saving, and deleting skills on the file system. It is designed to be shared by multiple repositories such as file system and Git based repositories.

  • 方法详细资料

    • loadSkill

      public static AgentSkill loadSkill(Path baseDir, String skillName, String source)
      已过时。
      Loads a skill by name from the given base directory.
      参数:
      baseDir - The base directory containing skill folders
      skillName - The skill name to load
      source - The source identifier for the created skill
      返回:
      The loaded AgentSkill
      抛出:
      IllegalArgumentException - if the skill cannot be found or is invalid
    • loadSkillFromDirectory

      public static AgentSkill loadSkillFromDirectory(Path skillDir, String source)
      已过时。
      Loads a skill from a specific directory, eagerly reading every non-hidden file in the skill tree into memory. Equivalent to loadSkillFromDirectory(skillDir, source, true).
    • loadSkillFromDirectory

      public static AgentSkill loadSkillFromDirectory(Path skillDir, String source, boolean includeResources)
      已过时。
      Loads a skill from a specific directory.

      The returned skill always carries an absolute originDir matching skillDir, so callers (prompt provider, load tool) can address files on disk without a second copy.

      参数:
      skillDir - The directory containing SKILL.md
      source - The source identifier for the created skill
      includeResources - when true, all non-hidden files under skillDir are pre-loaded into the skill's in-memory resource map (legacy behavior). When false, only SKILL.md is read; callers fall back to disk through originDir on demand.
      返回:
      The loaded AgentSkill (with originDir populated)
      抛出:
      IllegalArgumentException - if SKILL.md is missing or invalid
    • getAllSkillNames

      public static List<String> getAllSkillNames(Path baseDir)
      已过时。
      Retrieves all skill names by parsing SKILL.md metadata in each skill folder.
      参数:
      baseDir - The base directory containing skill folders
      返回:
      A list of skill names sorted alphabetically
    • getAllSkills

      public static List<AgentSkill> getAllSkills(Path baseDir, String source)
      已过时。
      Retrieves all skills from the base directory with resources pre-loaded into memory. Equivalent to getAllSkills(baseDir, source, true).
    • getAllSkills

      public static List<AgentSkill> getAllSkills(Path baseDir, String source, boolean includeResources)
      已过时。
      Retrieves all skills from the base directory.
      参数:
      baseDir - The base directory containing skill folders
      source - The source identifier for created skills
      includeResources - when false, each skill's resource map is left empty and callers must rely on the skill's originDir for disk-side reads
      返回:
      A list of skills
    • saveSkills

      public static boolean saveSkills(Path baseDir, List<AgentSkill> skills, boolean force)
      已过时。
      Saves skills to the base directory.
      参数:
      baseDir - The base directory to save skills
      skills - The skills to save
      force - Whether to overwrite existing skills
      返回:
      true if all skills were saved, false otherwise
    • deleteSkill

      public static boolean deleteSkill(Path baseDir, String skillName)
      已过时。
      Deletes a skill by name based on SKILL.md metadata.
      参数:
      baseDir - The base directory containing skill folders
      skillName - The skill name to delete
      返回:
      true if deleted, false if not found
    • skillExists

      public static boolean skillExists(Path baseDir, String skillName)
      已过时。
      Checks whether a skill exists by scanning SKILL.md metadata.
      参数:
      baseDir - The base directory containing skill folders
      skillName - The skill name to check
      返回:
      true if a matching skill exists
    • validateAndResolvePath

      public static Path validateAndResolvePath(Path baseDir, String skillName)
      已过时。
      Validates that a resolved path is within the base directory.
      参数:
      baseDir - The base directory to constrain resolution
      skillName - The skill name to resolve
      返回:
      The validated absolute path
      抛出:
      IllegalArgumentException - if the path escapes the base directory
    • hasSkillFile

      public static boolean hasSkillFile(Path dir)
      已过时。
      Checks if a directory contains a SKILL.md file.
      参数:
      dir - The directory to check
      返回:
      true if SKILL.md exists in the directory
    • deleteDirectory

      public static void deleteDirectory(Path directory) throws IOException
      已过时。
      Recursively deletes a directory and all its contents.
      参数:
      directory - The directory to delete
      抛出:
      IOException - if deletion fails
    • registerTempDirectoryCleanup

      public static Thread registerTempDirectoryCleanup(Path directory)
      已过时。
      Registers a shutdown hook to delete the given directory on JVM exit.
      参数:
      directory - The directory to delete at shutdown