Skip to content

Commit ec27aba

Browse files
committed
feat(release): add winget manifests
1 parent 72ebf52 commit ec27aba

10 files changed

Lines changed: 224 additions & 2 deletions

File tree

‎.mise.toml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@ run = "mise run install && bun scripts/render-homebrew-formula.ts"
2121

2222
[tasks.render-chocolatey-package]
2323
run = "mise run install && bun scripts/render-chocolatey-package.ts"
24+
25+
[tasks.render-winget-manifest]
26+
run = "mise run install && bun scripts/render-winget-manifest.ts"

‎README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Skillet installs, discovers, and updates `SKILL.md`-based skills across supporte
1111
| Binary release | Download from GitHub Releases | Planned |
1212
| Homebrew | `brew install skillet` | Configured |
1313
| Chocolatey | `choco install skillet` | Configured |
14-
| winget | `winget install skillet` | Planned |
14+
| winget | `winget install skillet` | Configured |
1515
| npm / npx | `npx skillet ...` | Planned |
1616
| Docker | `docker run ... skillet ...` | Planned |
1717
| Local dev | `mise run dev -- --help` | Available |
@@ -143,3 +143,4 @@ Distribution docs:
143143

144144
- Homebrew: `docs/distribution/homebrew.md`
145145
- Chocolatey: `docs/distribution/chocolatey.md`
146+
- winget: `docs/distribution/winget.md`

‎docs/distribution/winget.md‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# winget Distribution
2+
3+
Skillet ships a winget manifest set for Windows installs.
4+
5+
## Release Flow
6+
7+
1. Build Windows artifact and checksums.
8+
2. Render `packaging/winget/<version>/` from `SHA256SUMS`.
9+
3. Validate manifests with `winget validate`.
10+
4. Submit manifests to [`microsoft/winget-pkgs`](https://github.com/microsoft/winget-pkgs).
11+
12+
## Commands
13+
14+
```bash
15+
mise run build -- --targets=windows-x64
16+
bun scripts/write-checksums.ts
17+
mise run render-winget-manifest -- --version <version>
18+
```
19+
20+
Validation and install checks (Windows):
21+
22+
```powershell
23+
winget validate packaging/winget/<version>/echohello-dev.skillet.yaml
24+
winget install echohello-dev.skillet
25+
```

‎package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"test": "vitest run",
1212
"build": "bun scripts/build-release.ts",
1313
"render:homebrew": "bun scripts/render-homebrew-formula.ts",
14-
"render:choco": "bun scripts/render-chocolatey-package.ts"
14+
"render:choco": "bun scripts/render-chocolatey-package.ts",
15+
"render:winget": "bun scripts/render-winget-manifest.ts"
1516
},
1617
"dependencies": {
1718
"cac": "^6.7.14",
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
PackageIdentifier: echohello-dev.skillet
2+
PackageVersion: 0.0.0
3+
Installers:
4+
- Architecture: x64
5+
InstallerType: exe
6+
InstallerUrl: https://github.com/echohello-dev/skillet/releases/download/v0.0.0/skillet-windows-x64.exe
7+
InstallerSha256: 51CDDEFDE243F0F27E501CA420D5E1D1B9CAD548DC9884EA4052D2915AFEF179
8+
AppsAndFeaturesEntries:
9+
- DisplayName: skillet
10+
Commands:
11+
- skillet
12+
ManifestType: installer
13+
ManifestVersion: 1.6.0
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
PackageIdentifier: echohello-dev.skillet
2+
PackageVersion: 0.0.0
3+
PackageLocale: en-US
4+
Publisher: echohello-dev
5+
PublisherUrl: https://github.com/echohello-dev
6+
PublisherSupportUrl: https://github.com/echohello-dev/skillet/issues
7+
Author: echohello-dev
8+
PackageName: skillet
9+
PackageUrl: https://github.com/echohello-dev/skillet
10+
License: MIT
11+
ShortDescription: Portable CLI for managing agent skills.
12+
Moniker: skillet
13+
Tags:
14+
- cli
15+
- skills
16+
ManifestType: defaultLocale
17+
ManifestVersion: 1.6.0
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
PackageIdentifier: echohello-dev.skillet
2+
PackageVersion: 0.0.0
3+
DefaultLocale: en-US
4+
ManifestType: version
5+
ManifestVersion: 1.6.0

‎scripts/render-winget-manifest.ts‎

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import fs from "node:fs";
2+
import path from "node:path";
3+
import { parseSha256Sums } from "../src/distribution/checksums";
4+
import { renderWingetManifestFiles } from "../src/distribution/winget";
5+
6+
function main(): void {
7+
const args = process.argv.slice(2);
8+
const version = readArg(args, "--version") ?? readVersionFromPackageJson();
9+
const checksumsPath = path.resolve(readArg(args, "--checksums") ?? "dist/SHA256SUMS");
10+
const outputDir = path.resolve(readArg(args, "--output-dir") ?? `packaging/winget/${version}`);
11+
const releaseUrlBase =
12+
readArg(args, "--release-url-base") ??
13+
`https://github.com/echohello-dev/skillet/releases/download/v${version}`;
14+
15+
if (!fs.existsSync(checksumsPath)) {
16+
throw new Error(`Checksums file not found: ${checksumsPath}`);
17+
}
18+
19+
const checksums = parseSha256Sums(fs.readFileSync(checksumsPath, "utf8"));
20+
const files = renderWingetManifestFiles({ version, releaseUrlBase, checksumsByArtifact: checksums });
21+
22+
fs.mkdirSync(outputDir, { recursive: true });
23+
fs.writeFileSync(path.join(outputDir, "echohello-dev.skillet.yaml"), files.versionManifest);
24+
fs.writeFileSync(path.join(outputDir, "echohello-dev.skillet.installer.yaml"), files.installerManifest);
25+
fs.writeFileSync(path.join(outputDir, "echohello-dev.skillet.locale.en-US.yaml"), files.localeManifest);
26+
console.log(`Wrote winget manifests to ${outputDir}`);
27+
}
28+
29+
function readArg(args: string[], name: string): string | undefined {
30+
for (let i = 0; i < args.length; i += 1) {
31+
const token = args[i];
32+
if (token === name) {
33+
const next = args[i + 1];
34+
if (!next || next.startsWith("--")) {
35+
throw new Error(`Missing value for ${name}`);
36+
}
37+
return next;
38+
}
39+
40+
const prefix = `${name}=`;
41+
if (token.startsWith(prefix)) {
42+
const value = token.slice(prefix.length);
43+
if (value.length === 0) {
44+
throw new Error(`Missing value for ${name}`);
45+
}
46+
return value;
47+
}
48+
}
49+
50+
return undefined;
51+
}
52+
53+
function readVersionFromPackageJson(): string {
54+
const packageJsonPath = path.resolve("package.json");
55+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8")) as { version?: string };
56+
if (!packageJson.version || packageJson.version.length === 0) {
57+
throw new Error("package.json version is missing");
58+
}
59+
60+
return packageJson.version;
61+
}
62+
63+
main();

‎src/distribution/winget.ts‎

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
const WINDOWS_X64_ARTIFACT = "skillet-windows-x64.exe";
2+
const PACKAGE_IDENTIFIER = "echohello-dev.skillet";
3+
4+
export type WingetManifestOptions = {
5+
version: string;
6+
releaseUrlBase: string;
7+
checksumsByArtifact: Map<string, string>;
8+
};
9+
10+
export type WingetManifestFiles = {
11+
versionManifest: string;
12+
installerManifest: string;
13+
localeManifest: string;
14+
};
15+
16+
export function renderWingetManifestFiles(options: WingetManifestOptions): WingetManifestFiles {
17+
const releaseUrlBase = options.releaseUrlBase.replace(/\/+$/, "");
18+
const installerUrl = `${releaseUrlBase}/${WINDOWS_X64_ARTIFACT}`;
19+
const installerSha256 = requireChecksum(options.checksumsByArtifact, WINDOWS_X64_ARTIFACT).toUpperCase();
20+
21+
return {
22+
versionManifest: `PackageIdentifier: ${PACKAGE_IDENTIFIER}
23+
PackageVersion: ${options.version}
24+
DefaultLocale: en-US
25+
ManifestType: version
26+
ManifestVersion: 1.6.0
27+
`,
28+
installerManifest: `PackageIdentifier: ${PACKAGE_IDENTIFIER}
29+
PackageVersion: ${options.version}
30+
Installers:
31+
- Architecture: x64
32+
InstallerType: exe
33+
InstallerUrl: ${installerUrl}
34+
InstallerSha256: ${installerSha256}
35+
AppsAndFeaturesEntries:
36+
- DisplayName: skillet
37+
Commands:
38+
- skillet
39+
ManifestType: installer
40+
ManifestVersion: 1.6.0
41+
`,
42+
localeManifest: `PackageIdentifier: ${PACKAGE_IDENTIFIER}
43+
PackageVersion: ${options.version}
44+
PackageLocale: en-US
45+
Publisher: echohello-dev
46+
PublisherUrl: https://github.com/echohello-dev
47+
PublisherSupportUrl: https://github.com/echohello-dev/skillet/issues
48+
Author: echohello-dev
49+
PackageName: skillet
50+
PackageUrl: https://github.com/echohello-dev/skillet
51+
License: MIT
52+
ShortDescription: Portable CLI for managing agent skills.
53+
Moniker: skillet
54+
Tags:
55+
- cli
56+
- skills
57+
ManifestType: defaultLocale
58+
ManifestVersion: 1.6.0
59+
`,
60+
};
61+
}
62+
63+
function requireChecksum(checksumsByArtifact: Map<string, string>, artifactName: string): string {
64+
const checksum = checksumsByArtifact.get(artifactName);
65+
if (!checksum) {
66+
throw new Error(`Missing checksum for artifact: ${artifactName}`);
67+
}
68+
69+
return checksum;
70+
}

‎tests/distribution/winget.test.ts‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { describe, expect, it } from "vitest";
2+
import { renderWingetManifestFiles } from "../../src/distribution/winget";
3+
4+
describe("renderWingetManifestFiles", () => {
5+
it("renders winget manifest trio with checksum and installer URL", () => {
6+
const files = renderWingetManifestFiles({
7+
version: "1.2.3",
8+
releaseUrlBase: "https://github.com/echohello-dev/skillet/releases/download/v1.2.3",
9+
checksumsByArtifact: new Map([
10+
["skillet-windows-x64.exe", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"],
11+
]),
12+
});
13+
14+
expect(files.versionManifest).toContain("PackageIdentifier: echohello-dev.skillet");
15+
expect(files.versionManifest).toContain("PackageVersion: 1.2.3");
16+
expect(files.installerManifest).toContain(
17+
"InstallerUrl: https://github.com/echohello-dev/skillet/releases/download/v1.2.3/skillet-windows-x64.exe",
18+
);
19+
expect(files.installerManifest).toContain(
20+
"InstallerSha256: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
21+
);
22+
expect(files.localeManifest).toContain("PackageName: skillet");
23+
});
24+
});

0 commit comments

Comments
 (0)