-
Notifications
You must be signed in to change notification settings - Fork 795
revert(skills): --skills-dir supports multi-path append instead of override #1606
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -280,14 +280,14 @@ def kimi( | |
| ), | ||
| ] = None, | ||
| local_skills_dir: Annotated[ | ||
| list[Path] | None, | ||
| Path | None, | ||
| typer.Option( | ||
| "--skills-dir", | ||
| exists=True, | ||
| file_okay=False, | ||
| dir_okay=True, | ||
| readable=True, | ||
| help="Additional skills directories (repeatable). Appended to default discovery.", | ||
| help="Path to the skills directory. Overrides discovery.", | ||
| ), | ||
|
Comment on lines
287
to
291
|
||
| ] = None, | ||
| # Loop control | ||
|
|
@@ -475,9 +475,9 @@ def _emit_fatal_error(message: str) -> None: | |
| except json.JSONDecodeError as e: | ||
| raise typer.BadParameter(f"Invalid JSON: {e}", param_hint="--mcp-config") from e | ||
|
|
||
| extra_skills_dirs: list[KaosPath] | None = None | ||
| if local_skills_dir: | ||
| extra_skills_dirs = [KaosPath.unsafe_from_local_path(p) for p in local_skills_dir] | ||
| skills_dir: KaosPath | None = None | ||
| if local_skills_dir is not None: | ||
| skills_dir = KaosPath.unsafe_from_local_path(local_skills_dir) | ||
|
|
||
| work_dir = KaosPath.unsafe_from_local_path(local_work_dir) if local_work_dir else KaosPath.cwd() | ||
|
|
||
|
|
@@ -552,7 +552,7 @@ async def _run(session_id: str | None) -> tuple[Session, int]: | |
| yolo=yolo or (ui == "print"), # print mode implies yolo | ||
| agent_file=agent_file, | ||
| mcp_configs=mcp_configs, | ||
| extra_skills_dirs=extra_skills_dirs, | ||
| skills_dir=skills_dir, | ||
| max_steps_per_turn=max_steps_per_turn, | ||
| max_retries_per_step=max_retries_per_step, | ||
| max_ralph_iterations=max_ralph_iterations, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ | |
|
|
||
| from __future__ import annotations | ||
|
|
||
| from collections.abc import Callable, Iterable, Iterator, Sequence | ||
| from collections.abc import Callable, Iterable, Iterator | ||
| from pathlib import Path | ||
| from typing import Literal | ||
|
|
||
|
|
@@ -85,29 +85,27 @@ async def find_project_skills_dir(work_dir: KaosPath) -> KaosPath | None: | |
| async def resolve_skills_roots( | ||
| work_dir: KaosPath, | ||
| *, | ||
| extra_skills_dirs: Sequence[KaosPath] | None = None, | ||
| skills_dir_override: KaosPath | None = None, | ||
| ) -> list[KaosPath]: | ||
| """ | ||
| Resolve layered skill roots in priority order. | ||
|
|
||
| Built-in skills load first when supported by the active KAOS backend, | ||
| followed by user/project discovery, then any extra directories supplied | ||
| via ``--skills-dir``, and finally plugin directories. Extra directories | ||
| are **appended** to the default discovery chain — they never replace | ||
| user or project skills. | ||
| Built-in skills load first when supported by the active KAOS backend. When an | ||
| override is provided, user/project discovery is skipped. | ||
| """ | ||
|
Comment on lines
91
to
95
|
||
| from kimi_cli.plugin.manager import get_plugins_dir | ||
|
|
||
| roots: list[KaosPath] = [] | ||
| if _supports_builtin_skills(): | ||
| roots.append(KaosPath.unsafe_from_local_path(get_builtin_skills_dir())) | ||
| if user_dir := await find_user_skills_dir(): | ||
| roots.append(user_dir) | ||
| if project_dir := await find_project_skills_dir(work_dir): | ||
| roots.append(project_dir) | ||
| if extra_skills_dirs: | ||
| roots.extend(extra_skills_dirs) | ||
| # Plugins are always discoverable | ||
| if skills_dir_override is not None: | ||
| roots.append(skills_dir_override) | ||
| else: | ||
| if user_dir := await find_user_skills_dir(): | ||
| roots.append(user_dir) | ||
| if project_dir := await find_project_skills_dir(work_dir): | ||
| roots.append(project_dir) | ||
| # Plugins are always discoverable, even when --skills-dir is set | ||
| plugins_path = get_plugins_dir() | ||
| if plugins_path.is_dir(): | ||
| roots.append(KaosPath.unsafe_from_local_path(plugins_path)) | ||
|
|
@@ -131,7 +129,7 @@ async def discover_skills_from_roots(skills_dirs: Iterable[KaosPath]) -> list[Sk | |
| skills_by_name: dict[str, Skill] = {} | ||
| for skills_dir in skills_dirs: | ||
| for skill in await discover_skills(skills_dir): | ||
| skills_by_name.setdefault(normalize_skill_name(skill.name), skill) | ||
| skills_by_name[normalize_skill_name(skill.name)] = skill | ||
| return sorted(skills_by_name.values(), key=lambda s: s.name) | ||
|
|
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The help text says "Overrides discovery", but
resolve_skills_roots()still includes built-in skills (when supported) and always appends the plugins directory even when an override is provided. Consider clarifying the option help (e.g., overrides user/project discovery only) to avoid confusing users.