mirror of
https://github.com/eigent-ai/eigent.git
synced 2026-05-02 13:40:15 +00:00
Feat skills (#1221)
Some checks are pending
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
CodeQL Advanced / Analyze (python) (push) Waiting to run
Pre-commit / pre-commit (push) Waiting to run
Test / Run Python Tests (push) Waiting to run
Some checks are pending
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
CodeQL Advanced / Analyze (python) (push) Waiting to run
Pre-commit / pre-commit (push) Waiting to run
Test / Run Python Tests (push) Waiting to run
Co-authored-by: Pakchoioioi <happy.regina.bai@gmail.com> Co-authored-by: Douglas Lai <115660088+Douglasymlai@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: Douglas <douglas.ym.lai@gmail.com> Co-authored-by: Wendong-Fan <133094783+Wendong-Fan@users.noreply.github.com> Co-authored-by: Wendong-Fan <w3ndong.fan@gmail.com>
This commit is contained in:
parent
d6142b5607
commit
a23c30db13
84 changed files with 4411 additions and 159 deletions
|
|
@ -13,9 +13,15 @@
|
|||
# ========= Copyright 2025-2026 @ Eigent.ai All Rights Reserved. =========
|
||||
"""File system utilities."""
|
||||
|
||||
import logging
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
|
||||
from app.component.environment import env
|
||||
from app.model.chat import Chat
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def get_working_directory(options: Chat, task_lock=None) -> str:
|
||||
"""
|
||||
|
|
@ -36,3 +42,36 @@ def get_working_directory(options: Chat, task_lock=None) -> str:
|
|||
return str(task_lock.new_folder_path)
|
||||
else:
|
||||
return env("file_save_path", options.file_save_path())
|
||||
|
||||
|
||||
def sync_eigent_skills_to_project(working_directory: str) -> None:
|
||||
"""
|
||||
Copy skills from ~/.eigent/skills into the project's .eigent/skills
|
||||
so the agent can load and execute them from the project working directory.
|
||||
"""
|
||||
src = Path.home() / ".eigent" / "skills"
|
||||
dst = Path(working_directory) / ".eigent" / "skills"
|
||||
if not src.is_dir():
|
||||
return
|
||||
try:
|
||||
dst.mkdir(parents=True, exist_ok=True)
|
||||
for skill_dir in src.iterdir():
|
||||
if skill_dir.is_dir():
|
||||
dest_skill = dst / skill_dir.name
|
||||
if dest_skill.exists():
|
||||
shutil.rmtree(dest_skill)
|
||||
shutil.copytree(skill_dir, dest_skill)
|
||||
logger.debug(
|
||||
"Synced eigent skills to project",
|
||||
extra={
|
||||
"working_directory": working_directory,
|
||||
"destination": str(dst),
|
||||
},
|
||||
)
|
||||
except OSError as e:
|
||||
logger.warning(
|
||||
"Failed to sync ~/.eigent/skills to project %s: %s",
|
||||
working_directory,
|
||||
e,
|
||||
exc_info=True,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue