Skip to content

Commit fd02ae0

Browse files
Add manager maintenance automation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 5941bc1 commit fd02ae0

7 files changed

Lines changed: 625 additions & 3 deletions

File tree

cli-arguments.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
| `--automation get-version` | Reads the local automation service build number through the background API | 2026.1+ |
2323
| `--automation get-updates` | Reads the currently available updates through the local automation service and returns structured JSON | 2026.1+ |
2424
| `--automation list-managers` | Lists package managers, readiness, executable metadata, and automation-relevant capability flags | 2026.1+ |
25+
| `--automation get-manager-maintenance --manager name` | Returns manager-specific maintenance metadata, supported maintenance actions, executable-path candidates, and convenience state for manager-only settings such as bundled/system toggles and vcpkg triplets | 2026.1+ |
26+
| `--automation reload-manager --manager name` | Re-initializes one manager and returns the refreshed maintenance payload | 2026.1+ |
27+
| `--automation set-manager-executable --manager name --path path` | Sets a custom executable override for one manager when secure settings allow custom manager paths, then reloads that manager | 2026.1+ |
28+
| `--automation clear-manager-executable --manager name` | Clears a custom executable override for one manager and reloads that manager | 2026.1+ |
29+
| `--automation run-manager-action --manager name --action action [--confirm]` | Runs an explicit manager-maintenance action. Current actions are `repair-winget`, `install-scoop`, `uninstall-scoop`, and `cleanup-scoop`; system-changing actions require `--confirm` | 2026.1+ |
2530
| `--automation list-sources [--manager name]` | Lists known and configured sources, optionally filtered to a single manager | 2026.1+ |
2631
| `--automation add-source --manager name --source-name name [--source-url url]` | Adds a known or custom source through the automation service | 2026.1+ |
2732
| `--automation remove-source --manager name --source-name name [--source-url url]` | Removes a source through the automation service | 2026.1+ |
@@ -85,7 +90,7 @@
8590

8691
- `dotnet src\UniGetUI.Avalonia\bin\Release\net10.0\UniGetUI.Avalonia.dll --headless` starts the local automation daemon without opening any window or requiring a graphical desktop session.
8792
- `dotnet src\UniGetUI.Cli\bin\Release\net10.0\UniGetUI.Cli.dll <command>` is the cross-platform CLI wrapper for the automation service. It automatically prepends `--automation`, so `UniGetUI.Cli status` and `UniGetUI.Cli search-packages --manager ".NET Tool" --query dotnetsay` work directly.
88-
- Current agent-oriented command coverage includes status/version, manager/source inspection, settings inspection and mutation, desktop-shortcut state management, app/history/manager log inspection, local backup creation and GitHub cloud-backup/auth flows, current bundle inspection/import/export/add/remove/install flows, package search/details/version listing, ignored-update management, and package install/update/uninstall flows.
93+
- Current agent-oriented command coverage includes status/version, manager/source inspection plus manager-maintenance and executable-path control, settings inspection and mutation, desktop-shortcut state management, app/history/manager log inspection, local backup creation and GitHub cloud-backup/auth flows, current bundle inspection/import/export/add/remove/install flows, package search/details/version listing, ignored-update management, and package install/update/uninstall flows.
8994

9095
<br><br>
9196
# `unigetui://` deep link

src/UniGetUI.Interface.BackgroundApi/AutomationCliCommandRunner.cs

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,40 @@ TextWriter error
4949
managers = await client.ListManagersAsync(),
5050
}
5151
),
52+
"get-manager-maintenance" => await WriteJsonAsync(
53+
output,
54+
new
55+
{
56+
status = "success",
57+
maintenance = await client.GetManagerMaintenanceAsync(
58+
GetRequiredArgument(
59+
args,
60+
"--manager",
61+
"The get-manager-maintenance automation command requires --manager."
62+
)
63+
),
64+
}
65+
),
66+
"reload-manager" => await WriteJsonAsync(
67+
output,
68+
await client.ReloadManagerAsync(BuildManagerMaintenanceRequest(args))
69+
),
70+
"set-manager-executable" => await WriteJsonAsync(
71+
output,
72+
await client.SetManagerExecutablePathAsync(
73+
BuildManagerMaintenanceRequest(args, requirePath: true)
74+
)
75+
),
76+
"clear-manager-executable" => await WriteJsonAsync(
77+
output,
78+
await client.ClearManagerExecutablePathAsync(BuildManagerMaintenanceRequest(args))
79+
),
80+
"run-manager-action" => await WriteJsonAsync(
81+
output,
82+
await client.RunManagerActionAsync(
83+
BuildManagerMaintenanceRequest(args, requireAction: true)
84+
)
85+
),
5286
"list-sources" => await WriteJsonAsync(
5387
output,
5488
new
@@ -427,6 +461,29 @@ private static AutomationSourceRequest BuildSourceRequest(IReadOnlyList<string>
427461
};
428462
}
429463

464+
private static AutomationManagerMaintenanceRequest BuildManagerMaintenanceRequest(
465+
IReadOnlyList<string> args,
466+
bool requireAction = false,
467+
bool requirePath = false
468+
)
469+
{
470+
return new AutomationManagerMaintenanceRequest
471+
{
472+
ManagerName = GetRequiredArgument(
473+
args,
474+
"--manager",
475+
"This automation command requires --manager."
476+
),
477+
Action = requireAction
478+
? GetRequiredArgument(args, "--action", "This automation command requires --action.")
479+
: GetOptionalArgument(args, "--action"),
480+
Path = requirePath
481+
? GetRequiredArgument(args, "--path", "This automation command requires --path.")
482+
: GetOptionalArgument(args, "--path"),
483+
Confirm = args.Contains("--confirm"),
484+
};
485+
}
486+
430487
private static AutomationDesktopShortcutRequest BuildDesktopShortcutRequest(
431488
IReadOnlyList<string> args,
432489
bool requireStatus

0 commit comments

Comments
 (0)