Skip to content

Commit 416725c

Browse files
Drop CLI wrapper and stabilize manager ids
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 35e42c5 commit 416725c

47 files changed

Lines changed: 214 additions & 225 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/cli-headless-e2e.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,6 @@ jobs:
9898
}
9999
dotnet @args
100100
101-
- name: Build CLI
102-
working-directory: src
103-
shell: pwsh
104-
run: dotnet build UniGetUI.Cli/UniGetUI.Cli.csproj --no-restore --configuration ${{ env.CONFIGURATION }} --verbosity minimal
105-
106101
- name: Upgrade pip tooling
107102
shell: pwsh
108103
run: python -m pip install --upgrade pip setuptools wheel

docs/CLI.md

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ This file documents the **public command-line surface** exposed by UniGetUI in t
1010
```powershell
1111
unigetui status
1212
unigetui app status
13-
unigetui package search --manager ".NET Tool" --query dotnetsay
14-
unigetui package install --manager ".NET Tool" --id dotnetsay --version 2.1.4 --scope Global
13+
unigetui package search --manager dotnet-tool --query dotnetsay
14+
unigetui package install --manager dotnet-tool --id dotnetsay --version 2.1.4 --scope Global
1515
unigetui operation wait --id 123 --timeout 300
1616
```
1717

@@ -51,6 +51,7 @@ Related environment variables:
5151
- `--source` maps to `--package-source`
5252
- Boolean options use explicit values such as `--enabled true` or `--wait false`.
5353
- `--detach` is shorthand for asynchronous package operations (`--wait false`).
54+
- `--manager` uses stable manager ids, not GUI labels. Current ids: `apt`, `cargo`, `chocolatey`, `dnf`, `dotnet-tool`, `flatpak`, `homebrew`, `npm`, `pacman`, `pip`, `pwsh`, `scoop`, `snap`, `vcpkg`, `winget`, and `winps`.
5455

5556
## Command reference
5657

@@ -67,7 +68,7 @@ Related environment variables:
6768
| --- | --- | --- | --- |
6869
| `app status` | None | None | Returns app/session state such as headless mode, page, and supported UI actions. |
6970
| `app show` | None | None | Shows and focuses the window when a GUI session exists. |
70-
| `app navigate` | `--page <page>` | `--manager <name>`, `--help-attachment <path>` | Valid pages include `discover`, `updates`, `installed`, `bundles`, `settings`, `managers`, `own-log`, `manager-log`, `operation-history`, `help`, `release-notes`, and `about`. |
71+
| `app navigate` | `--page <page>` | `--manager <id>`, `--help-attachment <path>` | Valid pages include `discover`, `updates`, `installed`, `bundles`, `settings`, `managers`, `own-log`, `manager-log`, `operation-history`, `help`, `release-notes`, and `about`. |
7172
| `app quit` | None | None | Gracefully shuts down the selected session, including headless daemons. |
7273

7374
### Operations
@@ -88,23 +89,23 @@ Related environment variables:
8889
| Command | Required options | Optional options | Notes |
8990
| --- | --- | --- | --- |
9091
| `manager list` | None | None | Lists managers and their automation-relevant capability flags. |
91-
| `manager maintenance` | `--manager <name>` | None | Returns maintenance metadata for one manager. |
92-
| `manager reload` | `--manager <name>` | None | Reloads one manager. |
93-
| `manager set-executable` | `--manager <name>`, `--path <path>` | None | Sets a custom executable override, then reloads the manager. |
94-
| `manager clear-executable` | `--manager <name>` | None | Clears the custom executable override, then reloads the manager. |
95-
| `manager action` | `--manager <name>`, `--action <action>` | `--confirm` | Runs a manager-specific maintenance action. |
96-
| `manager enable` | `--manager <name>` | None | Enables the manager. |
97-
| `manager disable` | `--manager <name>` | None | Disables the manager. |
98-
| `manager notifications enable` | `--manager <name>` | None | Enables update notifications for the manager. |
99-
| `manager notifications disable` | `--manager <name>` | None | Disables update notifications for the manager. |
92+
| `manager maintenance` | `--manager <id>` | None | Returns maintenance metadata for one manager. |
93+
| `manager reload` | `--manager <id>` | None | Reloads one manager. |
94+
| `manager set-executable` | `--manager <id>`, `--path <path>` | None | Sets a custom executable override, then reloads the manager. |
95+
| `manager clear-executable` | `--manager <id>` | None | Clears the custom executable override, then reloads the manager. |
96+
| `manager action` | `--manager <id>`, `--action <action>` | `--confirm` | Runs a manager-specific maintenance action. |
97+
| `manager enable` | `--manager <id>` | None | Enables the manager. |
98+
| `manager disable` | `--manager <id>` | None | Disables the manager. |
99+
| `manager notifications enable` | `--manager <id>` | None | Enables update notifications for the manager. |
100+
| `manager notifications disable` | `--manager <id>` | None | Disables update notifications for the manager. |
100101

101102
### Sources
102103

103104
| Command | Required options | Optional options | Notes |
104105
| --- | --- | --- | --- |
105-
| `source list` | None | `--manager <name>` | Lists sources, optionally filtered to one manager. |
106-
| `source add` | `--manager <name>`, `--name <source-name>` | `--url <source-url>` | Adds a source. |
107-
| `source remove` | `--manager <name>`, `--name <source-name>` | `--url <source-url>` | Removes a source. |
106+
| `source list` | None | `--manager <id>` | Lists sources, optionally filtered to one manager. |
107+
| `source add` | `--manager <id>`, `--name <source-name>` | `--url <source-url>` | Adds a source. |
108+
| `source remove` | `--manager <id>`, `--name <source-name>` | `--url <source-url>` | Removes a source. |
108109

109110
### Settings
110111

@@ -139,7 +140,7 @@ Available keys live in:
139140
| --- | --- | --- | --- |
140141
| `log app` | None | `--level <n>` | Returns structured application log entries. |
141142
| `log operations` | None | None | Returns persisted operation history. |
142-
| `log manager` | None | `--manager <name>`, `--verbose` | Returns manager task logs. |
143+
| `log manager` | None | `--manager <id>`, `--verbose` | Returns manager task logs. |
143144

144145
### Backups
145146

@@ -163,31 +164,31 @@ Available keys live in:
163164
| `bundle reset` | None | None | Clears the current in-memory bundle. |
164165
| `bundle import` | None | `--path <path>`, `--content <text>`, `--format <ubundle\|json\|yaml\|xml>`, `--append` | Imports bundle content from a file or raw content. |
165166
| `bundle export` | None | `--path <path>` | Exports the current bundle, optionally to disk. |
166-
| `bundle add` | `--id <package-id>` | `--manager <name>`, `--source <source>`, `--version <version>`, `--scope <scope>`, `--pre-release`, `--selection <search\|installed\|updates\|auto>` | Resolves a package and adds it to the bundle. |
167-
| `bundle remove` | `--id <package-id>` | `--manager <name>`, `--source <source>`, `--version <version>`, `--scope <scope>`, `--pre-release`, `--selection <mode>` | Removes matching package entries from the bundle. |
167+
| `bundle add` | `--id <package-id>` | `--manager <id>`, `--source <source>`, `--version <version>`, `--scope <scope>`, `--pre-release`, `--selection <search\|installed\|updates\|auto>` | Resolves a package and adds it to the bundle. |
168+
| `bundle remove` | `--id <package-id>` | `--manager <id>`, `--source <source>`, `--version <version>`, `--scope <scope>`, `--pre-release`, `--selection <mode>` | Removes matching package entries from the bundle. |
168169
| `bundle install` | None | `--include-installed true\|false`, `--elevated true\|false`, `--interactive true\|false`, `--skip-hash true\|false` | Installs the bundle through UniGetUI’s shared operation pipeline. |
169170

170171
### Packages
171172

172173
| Command | Required options | Optional options | Notes |
173174
| --- | --- | --- | --- |
174-
| `package search` | `--query <text>` | `--manager <name>`, `--max-results <n>` | Searches packages. |
175-
| `package details` | `--id <package-id>` | `--manager <name>`, `--source <source>` | Returns the package details payload. |
176-
| `package versions` | `--id <package-id>` | `--manager <name>`, `--source <source>` | Returns installable versions when supported by the manager. |
177-
| `package installed` | None | `--manager <name>` | Lists installed packages. |
178-
| `package updates` | None | `--manager <name>` | Lists available updates. |
179-
| `package install` | `--id <package-id>` | `--manager <name>`, `--source <source>`, `--version <version>`, `--scope <scope>`, `--pre-release`, `--elevated true\|false`, `--interactive true\|false`, `--skip-hash true\|false`, `--architecture <value>`, `--location <path>`, `--wait true\|false`, `--detach` | Installs a package. Async mode returns an operation id immediately. |
180-
| `package download` | `--id <package-id>` | `--manager <name>`, `--source <source>`, `--version <version>`, `--scope <scope>`, `--wait true\|false`, `--detach`, `--output <path>` | Downloads a package artifact. |
175+
| `package search` | `--query <text>` | `--manager <id>`, `--max-results <n>` | Searches packages. |
176+
| `package details` | `--id <package-id>` | `--manager <id>`, `--source <source>` | Returns the package details payload. |
177+
| `package versions` | `--id <package-id>` | `--manager <id>`, `--source <source>` | Returns installable versions when supported by the manager. |
178+
| `package installed` | None | `--manager <id>` | Lists installed packages. |
179+
| `package updates` | None | `--manager <id>` | Lists available updates. |
180+
| `package install` | `--id <package-id>` | `--manager <id>`, `--source <source>`, `--version <version>`, `--scope <scope>`, `--pre-release`, `--elevated true\|false`, `--interactive true\|false`, `--skip-hash true\|false`, `--architecture <value>`, `--location <path>`, `--wait true\|false`, `--detach` | Installs a package. Async mode returns an operation id immediately. |
181+
| `package download` | `--id <package-id>` | `--manager <id>`, `--source <source>`, `--version <version>`, `--scope <scope>`, `--wait true\|false`, `--detach`, `--output <path>` | Downloads a package artifact. |
181182
| `package reinstall` | `--id <package-id>` | Same options as `package install` | Re-runs installation for an installed package. |
182183
| `package repair` | `--id <package-id>` | Same options as `package install`, plus `--remove-data true\|false` | Uninstalls then reinstalls the package. |
183184
| `package update` | `--id <package-id>` | Same options as `package install` | Updates one package. |
184-
| `package uninstall` | `--id <package-id>` | `--manager <name>`, `--source <source>`, `--scope <scope>`, `--remove-data true\|false`, `--elevated true\|false`, `--interactive true\|false`, `--wait true\|false`, `--detach` | Uninstalls a package. |
185+
| `package uninstall` | `--id <package-id>` | `--manager <id>`, `--source <source>`, `--scope <scope>`, `--remove-data true\|false`, `--elevated true\|false`, `--interactive true\|false`, `--wait true\|false`, `--detach` | Uninstalls a package. |
185186
| `package show` | `--id <package-id>`, `--source <source>` | None | Opens the package details UI flow. |
186187
| `package ignored list` | None | None | Lists ignored-update rules tracked by UniGetUI. |
187-
| `package ignored add` | `--id <package-id>` | `--manager <name>`, `--version <version>`, `--source <source>` | Adds an ignored-update rule. |
188-
| `package ignored remove` | `--id <package-id>` | `--manager <name>`, `--version <version>`, `--source <source>` | Removes an ignored-update rule. |
188+
| `package ignored add` | `--id <package-id>` | `--manager <id>`, `--version <version>`, `--source <source>` | Adds an ignored-update rule. |
189+
| `package ignored remove` | `--id <package-id>` | `--manager <id>`, `--version <version>`, `--source <source>` | Removes an ignored-update rule. |
189190
| `package update-all` | None | None | Queues updates for all currently upgradable packages. |
190-
| `package update-manager` | `--manager <name>` | None | Queues updates for all upgradable packages handled by one manager. |
191+
| `package update-manager` | `--manager <id>` | None | Queues updates for all upgradable packages handled by one manager. |
191192

192193
## Headless behavior
193194

docs/IPC.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ All request bodies use **camelCase** JSON.
147147

148148
| Field | Type | Meaning |
149149
| --- | --- | --- |
150-
| `managerName` | string | Required manager name |
150+
| `managerName` | string | Required stable manager id |
151151
| `action` | string | Manager action name for `/action` |
152152
| `path` | string | Custom executable path for `/executable/set` |
153153
| `confirm` | boolean | Confirmation flag for destructive actions |
@@ -185,7 +185,7 @@ All request bodies use **camelCase** JSON.
185185
| Field | Type | Meaning |
186186
| --- | --- | --- |
187187
| `packageId` | string | Package identifier |
188-
| `managerName` | string | Manager display name |
188+
| `managerName` | string | Stable manager id |
189189
| `packageSource` | string | Source/feed name |
190190
| `version` | string | Requested version |
191191
| `scope` | string | Requested scope |
@@ -210,7 +210,7 @@ These keys are used by package-related endpoints such as install, update, uninst
210210
| Query key | Meaning |
211211
| --- | --- |
212212
| `packageId` | Package identifier |
213-
| `manager` | Manager display name |
213+
| `manager` | Stable manager id |
214214
| `packageSource` | Source/feed name |
215215
| `version` | Requested version |
216216
| `scope` | Install scope |

src/UniGetUI.Avalonia.slnx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,6 @@
225225
<Platform Solution="*|x64" Project="x64" />
226226
</Project>
227227
</Folder>
228-
<Project Path="UniGetUI.Cli/UniGetUI.Cli.csproj">
229-
<Platform Solution="*|arm64" Project="arm64" />
230-
<Platform Solution="*|x64" Project="x64" />
231-
</Project>
232228
<Folder Name="/UniGetUI.PackageEngine.Tests/">
233229
<Project Path="UniGetUI.PackageEngine.Tests/UniGetUI.PackageEngine.Tests.csproj">
234230
<Platform Solution="*|arm64" Project="arm64" />

src/UniGetUI.Avalonia/Infrastructure/AvaloniaBootstrapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ private static IpcCommandResult QuitApp()
306306
}
307307

308308
return PEInterface.Managers.FirstOrDefault(manager =>
309-
manager.Name.Equals(managerName, StringComparison.OrdinalIgnoreCase))
309+
manager.Id.Equals(managerName, StringComparison.OrdinalIgnoreCase))
310310
?? throw new InvalidOperationException(
311311
$"Unknown manager \"{managerName}\"."
312312
);

src/UniGetUI.Avalonia/Infrastructure/AvaloniaPackageOperationHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static async Task UpdateAllAsync()
4242
public static async Task UpdateAllForManagerAsync(string managerName)
4343
{
4444
foreach (var pkg in UpgradablePackagesLoader.Instance.Packages
45-
.Where(p => p.Manager.Name == managerName || p.Manager.DisplayName == managerName)
45+
.Where(p => p.Manager.Id == managerName)
4646
.ToList())
4747
{
4848
if (pkg.Tag is PackageTag.BeingProcessed or PackageTag.OnQueue) continue;

src/UniGetUI.Avalonia/Views/SoftwarePages/PackageBundlesPage.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ public static IPackage DeserializePackage(SerializablePackage raw)
466466
IPackageManager? manager = null;
467467
foreach (var m in PEInterface.Managers)
468468
{
469-
if (m.Name == raw.ManagerName || m.DisplayName == raw.ManagerName)
469+
if (m.Id == raw.ManagerName || m.Name == raw.ManagerName || m.DisplayName == raw.ManagerName)
470470
{ manager = m; break; }
471471
}
472472

src/UniGetUI.Cli/Program.cs

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/UniGetUI.Cli/UniGetUI.Cli.csproj

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/UniGetUI.Interface.IpcApi/IpcBundleApi.cs

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ private static async Task<IpcBundlePackageInfo> ToBundlePackageInfoAsync(IPackag
354354
: serialized.InstallationOptions.InstallationScope,
355355
PreRelease = serialized.InstallationOptions.PreRelease,
356356
Source = imported.Source.AsString_DisplayName,
357-
Manager = imported.Manager.Name,
357+
Manager = IpcManagerSettingsApi.GetPublicManagerId(imported.Manager),
358358
IsCompatible = true,
359359
IsInstalled = imported.Tag == PackageTag.AlreadyInstalled,
360360
IsUpgradable = imported.Tag == PackageTag.IsUpgradable || imported.IsUpgradable,
@@ -371,7 +371,7 @@ private static async Task<IpcBundlePackageInfo> ToBundlePackageInfoAsync(IPackag
371371
Version = serialized.Version,
372372
DisplayVersion = invalid.VersionString,
373373
Source = invalid.SourceAsString,
374-
Manager = invalid.Manager.Name,
374+
Manager = IpcManagerSettingsApi.GetPublicManagerId(invalid.Manager),
375375
IsCompatible = false,
376376
IsInstalled = false,
377377
IsUpgradable = false,
@@ -385,7 +385,7 @@ private static async Task<IpcBundlePackageInfo> ToBundlePackageInfoAsync(IPackag
385385
Version = package.VersionString,
386386
DisplayVersion = package.VersionString,
387387
Source = package.Source.AsString_DisplayName,
388-
Manager = package.Manager.Name,
388+
Manager = IpcManagerSettingsApi.GetPublicManagerId(package.Manager),
389389
IsCompatible = !package.Source.IsVirtualManager,
390390
IsInstalled = package.Tag == PackageTag.AlreadyInstalled,
391391
IsUpgradable = package.Tag == PackageTag.IsUpgradable || package.IsUpgradable,
@@ -430,11 +430,7 @@ IpcBundlePackageRequest request
430430
return false;
431431
}
432432

433-
if (
434-
!string.IsNullOrWhiteSpace(request.ManagerName)
435-
&& !package.Manager.Name.Equals(request.ManagerName, StringComparison.OrdinalIgnoreCase)
436-
&& !package.Manager.DisplayName.Equals(request.ManagerName, StringComparison.OrdinalIgnoreCase)
437-
)
433+
if (!IpcManagerSettingsApi.MatchesManagerId(package.Manager, request.ManagerName))
438434
{
439435
return false;
440436
}
@@ -703,17 +699,7 @@ BundleFormatType format
703699

704700
private static IPackage DeserializePackage(SerializablePackage raw)
705701
{
706-
IPackageManager? manager = null;
707-
foreach (var candidate in PEInterface.Managers)
708-
{
709-
if (
710-
candidate.Name == raw.ManagerName || candidate.DisplayName == raw.ManagerName
711-
)
712-
{
713-
manager = candidate;
714-
break;
715-
}
716-
}
702+
IPackageManager? manager = IpcManagerSettingsApi.ResolveImportedManager(raw.ManagerName);
717703

718704
IManagerSource? source;
719705
if (manager?.Capabilities.SupportsCustomSources == true)

0 commit comments

Comments
 (0)