Add cmdforge remove command for project dependencies

- `cmdforge remove <tool>` removes a dependency from cmdforge.yaml
- Matches by exact name or short name (e.g., both "eli5" and "official/eli5" work)
- Returns exit code 1 if dependency not found
- Complements `cmdforge add` for full manifest management

Co-Authored-By: Claude Opus 4.5 <[email protected]>
This commit is contained in:
rob
2026-01-26 23:45:54 -04:00
co-authored by Claude Opus 4.5
parent df29b28167
commit 93797a450a
3 changed files with 64 additions and 1 deletions
+25
View File
@@ -141,6 +141,31 @@ class Manifest:
self.dependencies.append(Dependency(name=name, version=version))
def remove_dependency(self, name: str) -> bool:
"""Remove a dependency by name.
Args:
name: Tool name (can be qualified like 'official/tool' or just 'tool')
Returns:
True if dependency was removed, False if not found
"""
# Try exact match first
for i, dep in enumerate(self.dependencies):
if dep.name == name:
self.dependencies.pop(i)
return True
# Try matching just the tool name part (without owner)
short_name = name.split("/")[-1] if "/" in name else name
for i, dep in enumerate(self.dependencies):
dep_short = dep.name.split("/")[-1] if "/" in dep.name else dep.name
if dep_short == short_name:
self.dependencies.pop(i)
return True
return False
def find_manifest(start_dir: Optional[Path] = None) -> Optional[Path]:
"""