Skip to content

Commit c18b5ec

Browse files
committed
fix: address twenty-second round of Copilot PR review feedback
- Fix PS1 temp file leak: clean up pyStderrFile in catch block so temp files don't accumulate when Python invocation throws - Document skill-agent reconciliation strategy: expanded docstring on _register_for_non_skill_agents explaining the full removal/install flow and why skill agents are handled separately via _unregister_skills + _reconcile_skills
1 parent 58e9f67 commit c18b5ec

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

scripts/powershell/common.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,7 @@ except Exception:
455455
Remove-Item $pyStderrFile -Force -ErrorAction SilentlyContinue
456456
} catch {
457457
$strategy = 'replace'
458+
if ($pyStderrFile) { Remove-Item $pyStderrFile -Force -ErrorAction SilentlyContinue }
458459
}
459460
}
460461
# Try manifest file path first, then convention path

src/specify_cli/presets.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -768,12 +768,18 @@ def _register_for_non_skill_agents(
768768
source_id: str,
769769
source_dir: Path,
770770
) -> None:
771-
"""Register commands for all agents during reconciliation.
772-
773-
Uses the non-skill registrar for command agents, then relies on
774-
_reconcile_skills() (called separately) to properly format SKILL.md
775-
files for skill-based agents. This avoids overwriting properly
776-
formatted SKILL.md content with raw command file content.
771+
"""Register commands for non-skill agents during reconciliation.
772+
773+
Skill-based agents (``/SKILL.md`` layout) are handled separately:
774+
- On removal: ``_unregister_skills()`` restores from core/extension,
775+
then ``_reconcile_skills()`` re-runs ``_register_skills()`` for the
776+
next winning preset so SKILL.md files get proper frontmatter and
777+
descriptions.
778+
- On install: ``_register_skills()`` writes formatted SKILL.md, then
779+
``_reconcile_skills()`` ensures the actual priority winner is used.
780+
781+
Writing raw command content to skill agents would produce invalid
782+
SKILL.md files (missing skill frontmatter, descriptions, etc.).
777783
"""
778784
registrar.register_commands_for_non_skill_agents(
779785
commands, source_id, source_dir, self.project_root

0 commit comments

Comments
 (0)