Skip to content

Commit 000eb7e

Browse files
committed
fix: review comments
1 parent ca46095 commit 000eb7e

File tree

3 files changed

+70
-155
lines changed

3 files changed

+70
-155
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313

1414
- **Agent Skills Installation**: New `--ai-skills` CLI option to install Prompt.MD templates as agent skills following [agentskills.io specification](https://agentskills.io/specification)
1515
- Skills are installed to agent-specific directories (e.g., `.claude/skills/`, `.gemini/skills/`, `.github/skills/`)
16-
- Codex uses `.agents/skills/` per [OpenAI Codex docs](https://developers.openai.com/codex/skills)
16+
- Codex uses `.agents/skills/` following Codex agent directory conventions
1717
- Default fallback directory is `.agents/skills/` for agents without a specific mapping
1818
- Requires `--ai` flag to be specified
1919
- Converts all 9 spec-kit command templates (specify, plan, tasks, implement, analyze, clarify, constitution, checklist, taskstoissues) to properly formatted SKILL.md files

src/specify_cli/__init__.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -987,7 +987,7 @@ def ensure_constitution_from_template(project_path: Path, tracker: StepTracker |
987987
# Agent-specific skill directory overrides for agents whose skills directory
988988
# doesn't follow the standard <agent_folder>/skills/ pattern
989989
AGENT_SKILLS_DIR_OVERRIDES = {
990-
"codex": ".agents/skills", # per https://developers.openai.com/codex/skills
990+
"codex": ".agents/skills", # Codex agent layout override
991991
}
992992

993993
# Default skills directory for agents not in AGENT_CONFIG
@@ -1041,15 +1041,25 @@ def install_ai_skills(project_path: Path, selected_ai: str, tracker: StepTracker
10411041
Returns:
10421042
``True`` if at least one skill was installed, ``False`` otherwise.
10431043
"""
1044-
# Locate the bundled templates directory
1045-
script_dir = Path(__file__).parent.parent.parent # up from src/specify_cli/
1046-
templates_dir = script_dir / "templates" / "commands"
1044+
# Locate command templates in the agent's extracted commands directory.
1045+
# download_and_extract_template() already placed the .md files here.
1046+
agent_config = AGENT_CONFIG.get(selected_ai, {})
1047+
agent_folder = agent_config.get("folder", "")
1048+
if agent_folder:
1049+
templates_dir = project_path / agent_folder.rstrip("/") / "commands"
1050+
else:
1051+
templates_dir = project_path / "commands"
1052+
1053+
if not templates_dir.exists():
1054+
# Fallback: try the repo-relative path (for running from source checkout)
1055+
script_dir = Path(__file__).parent.parent.parent # up from src/specify_cli/
1056+
templates_dir = script_dir / "templates" / "commands"
10471057

10481058
if not templates_dir.exists():
10491059
if tracker:
1050-
tracker.error("ai-skills", "templates/commands not found")
1060+
tracker.error("ai-skills", "command templates not found")
10511061
else:
1052-
console.print("[yellow]Warning: templates/commands directory not found, skipping skills installation[/yellow]")
1062+
console.print("[yellow]Warning: command templates not found, skipping skills installation[/yellow]")
10531063
return False
10541064

10551065
command_files = sorted(templates_dir.glob("*.md"))

0 commit comments

Comments
 (0)