feat: api plugin management via CLI (#1416)

implements unraid-api `plugins list`, `plugins install`, `plugins remove` commands via a new `DependencyService` that invokes npm.

## Summary by CodeRabbit

- **New Features**
- Enhanced plugin management with install, remove, and list commands
supporting bundled plugins and restart control.
- Added plugin persistence and configuration synchronization across API
settings and interfaces.
- Introduced dependency management service for streamlined npm
operations and vendor archive rebuilding.
- **Bug Fixes**
- Improved plugin listing accuracy with warnings for configured but
missing plugins.
- **Chores**
- Refactored CLI modules and services for unified plugin management and
dependency handling.
- Updated API configuration loading and persistence for better
separation of concerns.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Pujit Mehrotra
2025-06-12 09:37:36 -04:00
committed by GitHub
parent 184b76de1c
commit 3dcbfbe489
16 changed files with 435 additions and 218 deletions

View File

@@ -228,9 +228,6 @@ for txz_file in /boot/config/plugins/dynamix.my.servers/dynamix.unraid.net-*.txz
fi
done
# Clean up any old node_modules archives (on the boot drive) that don't match our current version
/etc/rc.d/rc.unraid-api cleanup-dependencies
# Remove existing node_modules directory
echo "Cleaning up existing node_modules directory..."
if [ -d "/usr/local/unraid-api/node_modules" ]; then
@@ -245,12 +242,19 @@ if [ $? -ne 0 ]; then
exit 1
fi
# Clean up any old node_modules archives (on the boot drive) that don't match our current version
#
# Must run after package installation because it provides an update api config file,
# which determines the current API version and vendor archive to keep.
/etc/rc.d/rc.unraid-api cleanup-dependencies
if [[ -n "$TAG" && "$TAG" != "" ]]; then
printf -v sedcmd 's@^\*\*Unraid Connect\*\*@**Unraid Connect (%s)**@' "$TAG"
sed -i "${sedcmd}" "/usr/local/emhttp/plugins/dynamix.unraid.net/README.md"
fi
echo "Starting Unraid API service"
/etc/rc.d/rc.unraid-api plugins add unraid-api-plugin-connect -b --no-restart
/etc/rc.d/rc.unraid-api start
echo "Unraid API service started"