Applying review recommendations

This commit is contained in:
Manfred Riem
2026-03-13 09:36:26 -05:00
parent 7259652c9e
commit f7fbda53d2
2 changed files with 30 additions and 5 deletions

View File

@@ -324,6 +324,7 @@ class CommandRegistrar:
raise ValueError(f"Unsupported format: {agent_config['format']}")
dest_file = commands_dir / f"{cmd_name}{agent_config['extension']}"
dest_file.parent.mkdir(parents=True, exist_ok=True)
dest_file.write_text(output, encoding="utf-8")
if agent_name == "copilot":
@@ -333,6 +334,7 @@ class CommandRegistrar:
for alias in cmd_info.get("aliases", []):
alias_file = commands_dir / f"{alias}{agent_config['extension']}"
alias_file.parent.mkdir(parents=True, exist_ok=True)
alias_file.write_text(output, encoding="utf-8")
if agent_name == "copilot":
self.write_copilot_prompt(project_root, alias)

View File

@@ -364,7 +364,7 @@ class PresetManager:
Scans the preset's templates for type "command", reads each command
file, and writes it to every detected agent directory using the
CommandRegistrar from the extensions module.
CommandRegistrar from the agents module.
Args:
manifest: Preset manifest
@@ -424,7 +424,7 @@ class PresetManager:
Reads ``.specify/init-options.json`` to determine whether skills
are enabled and which agent was selected, then delegates to
``_get_skills_dir()`` for the concrete path.
the module-level ``_get_skills_dir()`` helper for the concrete path.
Returns:
The skills directory ``Path``, or ``None`` if skills were not
@@ -473,15 +473,33 @@ class PresetManager:
if not command_templates:
return []
# Filter out extension command overrides if the extension isn't installed,
# matching the same logic used by _register_commands().
extensions_dir = self.project_root / ".specify" / "extensions"
filtered = []
for cmd in command_templates:
parts = cmd["name"].split(".")
if len(parts) >= 3 and parts[0] == "speckit":
ext_id = parts[1]
if not (extensions_dir / ext_id).is_dir():
continue
filtered.append(cmd)
if not filtered:
return []
skills_dir = self._get_skills_dir()
if not skills_dir:
return []
from . import SKILL_DESCRIPTIONS
from . import SKILL_DESCRIPTIONS, load_init_options
opts = load_init_options(self.project_root)
selected_ai = opts.get("ai", "")
written: List[str] = []
for cmd_tmpl in command_templates:
for cmd_tmpl in filtered:
cmd_name = cmd_tmpl["name"]
cmd_file_rel = cmd_tmpl["file"]
source_file = preset_dir / cmd_file_rel
@@ -492,6 +510,11 @@ class PresetManager:
short_name = cmd_name
if short_name.startswith("speckit."):
short_name = short_name[len("speckit."):]
# Kimi CLI discovers skills by directory name and invokes them as
# /skill:<name> — use dot separator to match packaging convention.
if selected_ai == "kimi":
skill_name = f"speckit.{short_name}"
else:
skill_name = f"speckit-{short_name}"
# Only overwrite if the skill already exists (i.e. --ai-skills was used)