mirror of
https://github.com/LerianStudio/ring
synced 2026-04-21 13:37:27 +00:00
feat(installer): copy skill artifact subdirectories
Extends skill installation to support 'templates/' and 'examples/' subdirectories, in addition to the existing 'references/'. The installer logic is updated to discover these new directories and copy them to the target location during both initial install and update operations. This ensures that supplementary skill artifacts are available in the installed environment, allowing features that rely on them to function correctly.
This commit is contained in:
parent
9011f82295
commit
941cdb026f
1 changed files with 37 additions and 3 deletions
|
|
@ -134,9 +134,11 @@ def _discover_codex_support_dirs(
|
|||
|
||||
skills_dir = plugin_path / "skills"
|
||||
if skills_dir.exists():
|
||||
for references_dir in skills_dir.glob("*/references"):
|
||||
if references_dir.is_dir():
|
||||
dirs.append(references_dir)
|
||||
for skill_subdir in skills_dir.glob("*/*"):
|
||||
if skill_subdir.is_dir() and skill_subdir.name in (
|
||||
"references", "templates", "examples",
|
||||
):
|
||||
dirs.append(skill_subdir)
|
||||
|
||||
support_dirs[plugin_name] = dirs
|
||||
|
||||
|
|
@ -891,6 +893,22 @@ def install(
|
|||
)
|
||||
result.add_success(source_file, target_file, backup_path)
|
||||
installed_paths.append(target_file)
|
||||
|
||||
# Copy skill artifact subdirectories (templates/, references/, examples/)
|
||||
if component_type == "skills":
|
||||
for subdir in source_file.parent.iterdir():
|
||||
if subdir.is_dir():
|
||||
target_subdir = target_file.parent / subdir.name
|
||||
try:
|
||||
if target_subdir.exists():
|
||||
safe_remove(target_subdir, missing_ok=True)
|
||||
shutil.copytree(subdir, target_subdir)
|
||||
except Exception as sub_e:
|
||||
logger.warning(
|
||||
"Failed to copy skill artifact dir %s: %s",
|
||||
subdir.name,
|
||||
sub_e,
|
||||
)
|
||||
except Exception as e:
|
||||
result.add_failure(
|
||||
source_file, target_file, f"Write error: {e}", exc_info=e
|
||||
|
|
@ -1417,6 +1435,22 @@ def update_with_diff(
|
|||
transform_func=lambda _, transformed=transformed: transformed,
|
||||
)
|
||||
result.add_success(source_file, target_file, backup_path)
|
||||
|
||||
# Copy skill artifact subdirectories (templates/, references/, examples/)
|
||||
if component_type == "skills":
|
||||
for subdir in source_file.parent.iterdir():
|
||||
if subdir.is_dir():
|
||||
target_subdir = target_file.parent / subdir.name
|
||||
try:
|
||||
if target_subdir.exists():
|
||||
safe_remove(target_subdir, missing_ok=True)
|
||||
shutil.copytree(subdir, target_subdir)
|
||||
except Exception as sub_e:
|
||||
logger.warning(
|
||||
"Failed to copy skill artifact dir %s: %s",
|
||||
subdir.name,
|
||||
sub_e,
|
||||
)
|
||||
except Exception as e:
|
||||
result.add_failure(source_file, target_file, f"Write error: {e}")
|
||||
continue
|
||||
|
|
|
|||
Loading…
Reference in a new issue