Skip to content

Commit b1a0191

Browse files
authored
Merge pull request #80 from tikalk/fix-preset-replaces-v0.1.3
fix: implement preset 'replaces' field to remove superseded commands (v0.1.3)
2 parents a3070e8 + 542e9c4 commit b1a0191

5 files changed

Lines changed: 209 additions & 136 deletions

File tree

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@ All notable changes to the Specify CLI and templates are documented here.
77
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
88
and this project adheres to to [Semantic Versioning](https://semver.org/spec/v2.0.0/).
99

10+
## [0.1.3] - 2026-03-15
11+
12+
### Fixed
13+
14+
- **Preset `replaces` field now implemented**: Commands with `replaces` in preset.yml now properly remove the replaced command files from agent directories
15+
- Example: `adlc.spec.specify` with `replaces: "speckit.specify"` now removes `speckit.specify.md` before creating the new command
16+
- Ensures clean command namespace with only `adlc.spec.*` commands and `spec.*` aliases
17+
- **`adlc.spec.constitution`**: Added missing `replaces: "speckit.constitution"` to replace core command
18+
19+
### Added
20+
21+
- **`remove_replaced_commands()`**: New method in `CommandRegistrar` class (`agents.py`) to remove command files across all detected agent directories
22+
1023
## [0.1.1] - 2026-03-14
1124

1225
### Added

presets/agentic-sdlc/preset.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,9 @@ provides:
109109
- type: "command"
110110
name: "adlc.spec.constitution"
111111
file: "commands/adlc.spec.constitution.md"
112-
description: "Create/update project constitution (fork only)"
112+
description: "Create/update project constitution (fork enhanced)"
113113
aliases: ["spec.constitution"]
114+
replaces: "speckit.constitution"
114115

115116
tags:
116117
- "governance"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "agentic-sdlc-specify-cli"
3-
version = "0.1.1"
3+
version = "0.1.3"
44
description = "Specify CLI, part of GitHub Spec Kit. A tool to bootstrap your projects for Spec-Driven Development (SDD)."
55
requires-python = ">=3.11"
66
dependencies = [

src/specify_cli/agents.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,3 +425,50 @@ def unregister_commands(
425425
)
426426
if prompt_file.exists():
427427
prompt_file.unlink()
428+
429+
def remove_replaced_commands(
430+
self, replaced_commands: List[str], project_root: Path
431+
) -> Dict[str, List[str]]:
432+
"""Remove command files that are being replaced by a preset.
433+
434+
Scans all detected agent directories and removes command files
435+
matching the names in replaced_commands.
436+
437+
Args:
438+
replaced_commands: List of command names to remove (e.g. ["speckit.specify"])
439+
project_root: Path to project root
440+
441+
Returns:
442+
Dictionary mapping agent names to lists of removed command names
443+
"""
444+
removed = {}
445+
446+
for agent_name, agent_config in self.AGENT_CONFIGS.items():
447+
agent_dir = project_root / agent_config["dir"].split("/")[0]
448+
449+
if not agent_dir.exists():
450+
continue
451+
452+
commands_dir = project_root / agent_config["dir"]
453+
if not commands_dir.exists():
454+
continue
455+
456+
removed_for_agent = []
457+
for cmd_name in replaced_commands:
458+
cmd_file = commands_dir / f"{cmd_name}{agent_config['extension']}"
459+
if cmd_file.exists():
460+
cmd_file.unlink()
461+
removed_for_agent.append(cmd_name)
462+
463+
# Also remove Copilot prompt files
464+
if agent_name == "copilot":
465+
prompt_file = (
466+
project_root / ".github" / "prompts" / f"{cmd_name}.prompt.md"
467+
)
468+
if prompt_file.exists():
469+
prompt_file.unlink()
470+
471+
if removed_for_agent:
472+
removed[agent_name] = removed_for_agent
473+
474+
return removed

0 commit comments

Comments
 (0)