Add system dependencies support for tools

Tools can now declare system-level package dependencies (apt, brew, pacman, dnf)
that get checked and optionally installed when the tool is installed or run.

Features:
- SystemDependency dataclass with short form (string) and long form (dict)
- New system_deps.py module with platform detection and installation
- `cmdforge system-deps <tool>` command to check/install system packages
- `cmdforge check` now shows both CmdForge and system dependencies
- `cmdforge registry install` prompts for system dep installation
- GUI: System Dependencies section in Tool Builder with add/edit dialog
- Runner warns about missing system deps before execution
- Integration with project install (manifest and lock-based)

Also includes:
- Quote paths in wrapper scripts for spaces support
- Tests for value type preservation in code steps
- Unskip invalid tool name test

Co-Authored-By: Claude Opus 4.5 <[email protected]>
This commit is contained in:
rob
2026-01-28 16:31:37 -04:00
co-authored by Claude Opus 4.5
parent 8eff55ed1e
commit 071ade0ffb
15 changed files with 1399 additions and 62 deletions
+43
View File
@@ -6,6 +6,49 @@ All notable changes to CmdForge will be documented in this file.
### Added
#### System Dependencies
- **System package dependencies for tools**: Tools can now declare system-level package dependencies (apt, brew, pacman, dnf)
- `system_dependencies` field in tool config.yaml
- Short form: just package name (e.g., `ffmpeg`)
- Long form: detailed spec with description, binaries to check, and per-manager package names
- Automatic platform detection (Linux/macOS/Windows)
- Package manager detection (apt, brew, pacman, dnf)
- **New dataclass**: `SystemDependency` in tool.py
- `name` - Package identifier
- `description` - Why this dependency is needed
- `binaries` - List of executables to check (defaults to [name])
- `packages` - Package names per manager (defaults to name for all)
- Round-trip serialization preserves short/long form
- **New module**: `src/cmdforge/system_deps.py`
- `detect_os()` - Returns 'linux', 'darwin', or 'windows'
- `detect_package_manager()` - Returns 'apt', 'brew', 'pacman', 'dnf', or None
- `check_system_dep()` - Check if dependency is satisfied (any binary found)
- `install_system_dep()` - Install via system package manager
- `prompt_install_missing()` - Interactive prompt for installing missing packages
- **New CLI command**: `cmdforge system-deps <tool> [install]`
- `cmdforge system-deps <tool>` - Show system dependency status
- `cmdforge system-deps <tool> install` - Install missing system packages
- `--yes` flag for non-interactive installation
- **Enhanced CLI commands**:
- `cmdforge check <tool>` - Now shows both CmdForge and system dependencies
- `cmdforge registry install` - Prompts to install system deps after tool install
- `--yes` flag to auto-install without prompting
- `--no-system-deps` flag to skip system dependency handling
- `cmdforge install` (project) - Handles system deps for manifest and lock-based installs
- **GUI support**:
- Tool Builder: New "System Dependencies" section
- Add/Edit/Remove system dependency dialog
- Shows name and description in list
- **Runtime integration**:
- Runner warns about missing system dependencies before execution
- Uses qualified tool refs (owner/name) for registry-installed tools
#### Tool Settings Files
- **Configurable tool settings**: Tools can now ship with default settings that users can customize
- `defaults.yaml` - Default settings published with the tool (immutable)