microsoft / winget-cli

WinGet is the Windows Package Manager. This project includes a CLI (Command Line Interface), PowerShell modules, and a COM (Component Object Model) API (Application Programming Interface).
https://learn.microsoft.com/windows/package-manager/
MIT License
23.08k stars 1.44k forks source link

More package information in Exported JSON file #2030

Open turpie opened 2 years ago

turpie commented 2 years ago

Description of the new feature / enhancement

It would be helpful if the "winget export" command would include a verbose option to include the full package information, rather than just the PackageIdentifier (and version if --include-versions is used).

For example for Windows Terminal the exported JSON includes only PackageIdentifier and optionally the current installed Version: "PackageIdentifier" : "Microsoft.WindowsTerminal", "Version" : "1.11.3471.0"

Winget can produce more information from other commands. e.g. "winget list" adds the Name and Source Windows Terminal Microsoft.WindowsTerminal 1.11.3471.0 winget

Searching winget list for a single package adds the Available version.

winget list --id Microsoft.WindowsTerminal
Name             Id                        Version     Available    Source
--------------------------------------------------------------------------
Windows Terminal Microsoft.WindowsTerminal 1.11.3471.0 1.12.10393.0 winget

and Winget show has a lot more information:

winget show --id Microsoft.WindowsTerminal
Found Windows Terminal [Microsoft.WindowsTerminal]
Version: 1.12.10393.0
Publisher: Microsoft
Publisher Url: https://www.microsoft.com/
Moniker: terminal
Description: The new Windows Terminal, a tabbed command line experience for Windows.
Homepage: https://docs.microsoft.com/windows/terminal/
License: MIT
License Url: https://github.com/microsoft/terminal/blob/master/LICENSE
Privacy Url: https://privacy.microsoft.com/
Installer:
  Type: msix
  Download Url: https://github.com/microsoft/terminal/releases/download/v1.12.10393.0/Microsoft.WindowsTerminal_1.12.10393.0_8wekyb3d8bbwe.msixbundle
  SHA256: 23daf0b5a5783d07322b9fee3eef98d45b8d11d4d77f9dbd75a0eb13069592f1

Why can't all of that information be included in the exported JSON file?

Proposed technical implementation details

The "winget export" should have a new flag such as --detailed or --verbose that includes all the available information for each package. For example the Windows Terminal section of the JSON file would look like:

       {
          "PackageIdentifier": "Microsoft.WindowsTerminal",
          "InstalledVersion": "1.11.3471.0",
          "AvailableVersion": "1.12.10393.0",
          "Publisher": "Microsoft",
          "PublisherUrl": "https://www.microsoft.com/",
          "Moniker": "terminal",
          "Description": "The new Windows Terminal, a tabbed command line experience for Windows.",
          "Homepage": "https://docs.microsoft.com/windows/terminal/",
          "License": "MIT",
          "LicenseUrl": "https://github.com/microsoft/terminal/blob/master/LICENSE",
          "PrivacyUrl": "https://privacy.microsoft.com/",
          "InstallerType": "msix",
          "InstallerDownloadUrl": "https://github.com/microsoft/terminal/releases/download/v1.12.10393.0/Microsoft.WindowsTerminal_1.12.10393.0_8wekyb3d8bbwe.msixbundle",
          "InstallerSHA256": "23daf0b5a5783d07322b9fee3eef98d45b8d11d4d77f9dbd75a0eb13069592f1"
        },
denelon commented 2 years ago

@turpie,

The export command is designed to produce a JSON file used by the import command. We've got features to add support for additional information for the import command. We're only exporting data we can consume to drive behavior for import today.

We're looking to add support for things like flags and scope (user vs. machine) in the schema so import could leverage those behavior driving properties.

What is the use case for exporting metadata that doesn't affect the import command?

jedieaston commented 2 years ago

I could see a use case where I would want to generate a manifest for a package without having to interact with the repository directly (via using the API if available or a git clone in the case of the community repo). Then if I wanted to reuse a manifest in my repository from the community repo it would be pretty easy to grab.

For import, providing more of the manifest would allow attempting to install the package even if it is not available in any of the repositories for some reason (although, at least in the case of the official repos, the reason is usually good).

oldshensheep commented 2 years ago

Sometimes I need to edit the exported file, but the "PackageIdentifier" is unreasonable if the source is from the msstore. Add more information like name is better for editing.

"PackageIdentifier" : "9N0866FS04W8"
kdpuvvadi commented 2 years ago

Any update on this?

turpie commented 2 years ago

What is the use case for exporting metadata that doesn't affect the import command?

I was looking to write a powershell script to manage updates and some other automation of remote computers. I was hoping to work around the current lack of Powershell integration.

Trenly commented 1 year ago

[Policy] Command-Export