launchset 0.0.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +99 -4
  2. package/dist/appstore-bVSJnUv2.js +143 -0
  3. package/dist/cli.js +7038 -0
  4. package/dist/errors-CHdD4g_K.js +58 -0
  5. package/dist/gitlab-child-HpkyOlFm.js +6223 -0
  6. package/dist/http-dQt8kfON.js +127 -0
  7. package/dist/index.d.ts +867 -0
  8. package/dist/index.js +29 -0
  9. package/dist/init-CSnEh2wt.js +9064 -0
  10. package/dist/launchset.schema.json +1512 -0
  11. package/dist/play-D7nv0n-W.js +123 -0
  12. package/dist/prompts-S8h8cgml.js +52 -0
  13. package/dist/schema-WH9ljSlL.js +1236 -0
  14. package/dist/store-BCwWrhhY.js +73 -0
  15. package/package.json +86 -5
  16. package/skills/launchset/AGENTS-snippet.md +24 -0
  17. package/skills/launchset/SKILL.md +205 -0
  18. package/skills/launchset-adopt/SKILL.md +235 -0
  19. package/templates/gitlab/child/build.yml +17 -0
  20. package/templates/gitlab/child/cli.yml +14 -0
  21. package/templates/gitlab/child/comment.yml +14 -0
  22. package/templates/gitlab/child/finalize.yml +14 -0
  23. package/templates/gitlab/child/header.yml +4 -0
  24. package/templates/gitlab/child/include.yml +6 -0
  25. package/templates/gitlab/child/nothing.yml +11 -0
  26. package/templates/gitlab/gitlab-ci.yml +23 -0
  27. package/templates/gitlab/launchset-preview.yml +62 -0
  28. package/templates/gitlab/launchset-targets.yml +44 -0
  29. package/templates/gitlab/launchset.yml +133 -0
  30. package/templates/gitlab/targets/android.yml +25 -0
  31. package/templates/gitlab/targets/custom-npm.yml +15 -0
  32. package/templates/gitlab/targets/custom.yml +23 -0
  33. package/templates/gitlab/targets/docker.yml +23 -0
  34. package/templates/gitlab/targets/flutter-android.yml +32 -0
  35. package/templates/gitlab/targets/flutter-ios.yml +42 -0
  36. package/templates/gitlab/targets/ios.yml +33 -0
  37. package/templates/gitlab/targets/web.yml +13 -0
  38. package/templates/launchset-readme.md +23 -0
  39. package/templates/workflows/launchset-check.yml +33 -0
  40. package/templates/workflows/launchset-preview.yml +157 -0
  41. package/templates/workflows/launchset-release.yml +181 -0
  42. package/templates/workflows/snippets/android.yml +41 -0
  43. package/templates/workflows/snippets/custom-example.yml +12 -0
  44. package/templates/workflows/snippets/custom-npm.yml +19 -0
  45. package/templates/workflows/snippets/custom.yml +9 -0
  46. package/templates/workflows/snippets/docker-login.yml +9 -0
  47. package/templates/workflows/snippets/docker.yml +17 -0
  48. package/templates/workflows/snippets/flutter-android.yml +51 -0
  49. package/templates/workflows/snippets/flutter-ios.yml +50 -0
  50. package/templates/workflows/snippets/ios.yml +46 -0
  51. package/templates/workflows/snippets/web.yml +20 -0
package/README.md CHANGED
@@ -1,7 +1,102 @@
1
- # launchset
1
+ <p align="center"><img src="https://demonsters.github.io/launchset/logo.svg" alt="" width="120"></p>
2
2
 
3
- Changesets-style releases for repos where **one version** drives **many targets**: Docker images, Android, iOS and web apps, built from one repo and released together.
3
+ <h1 align="center">launchset</h1>
4
4
 
5
- This is a placeholder. The package will be published here soon, under the MIT license.
5
+ <p align="center"><strong>Changesets is for packages. launchset is for apps: one version, every platform, build numbers handled.</strong></p>
6
6
 
7
- Documentation: https://demonsters.github.io/launchset/
7
+ <p align="center"><a href="https://demonsters.github.io/launchset/">Documentation</a> · <a href="https://demonsters.github.io/launchset/getting-started/">Getting started</a> · <a href="https://demonsters.github.io/launchset/concepts/">How it works</a> · <a href="https://demonsters.github.io/launchset/reference/cli/">CLI reference</a></p>
8
+
9
+ You have one repo that ships an API image, a web app and an Android and iOS app, and they all carry the same version. launchset gives that repo a Changesets-style release flow. Every PR adds a changeset, launchset keeps a release PR open, and merging it releases every target at the same version, each with a fresh build number.
10
+
11
+ launchset builds nothing itself. It decides what to release, writes the version and build number into each target's files, and records what shipped as git tags and a GitHub Release. Your own steps do the building and uploading: `docker build`, Gradle, fastlane, Xcode, `npm publish`.
12
+
13
+ It runs on GitHub Actions and on GitLab CI (GitLab.com and self-managed 18.2+).
14
+
15
+ ## Is it for you?
16
+
17
+ **Use launchset when:**
18
+
19
+ - one repo ships several things that share one version: Docker images, a web app, native or cross-platform mobile apps;
20
+ - you want store builds with a version and a unique, always increasing build number, without committing build numbers;
21
+ - you want a changelog and a release PR instead of tagging by hand.
22
+
23
+ **Look elsewhere when:**
24
+
25
+ - you publish npm packages that each have their own version. That's what [Changesets](https://github.com/changesets/changesets) is for. launchset can [run alongside it](https://demonsters.github.io/launchset/guides/with-changesets/) when a repo has both;
26
+ - each app in the repo has its own version and release schedule;
27
+ - you want one tool that also builds, signs and uploads. launchset hands that to your own steps (see [store pipelines](https://demonsters.github.io/launchset/store-pipelines/) for fastlane and Gradle recipes).
28
+
29
+ ## How it works
30
+
31
+ 1. **Every PR adds a changeset**, a small markdown file in `.launchset/` that says how big the change is and what goes in the changelog. `npx launchset add` writes it, and a PR check tells you when one is missing.
32
+ 2. **launchset keeps a release PR open**, `Release v1.5.0`. It holds the version bump, the version written into each target's files and the new changelog section. It's rebuilt on every push, so it never has conflicts.
33
+ 3. **Merging it is the release.** The workflow runs one job per target. Each job writes the version and a fresh build number into its checkout, runs your build and upload steps, and records a marker tag.
34
+ 4. **Once every target has shipped**, launchset tags `v1.5.0` and publishes the GitHub Release. If a job fails, re-run it: targets that already shipped are skipped.
35
+
36
+ There's more: [preview builds](https://demonsters.github.io/launchset/guides/previews/) from a PR label (TestFlight, Play internal track, Docker), [hotfixes](https://demonsters.github.io/launchset/guides/hotfixes/) from `release/1.4.x`, [manual targets](https://demonsters.github.io/launchset/guides/manual-targets/) for apps you ship when you decide, and Dependabot and Renovate PRs that pass the check without a changeset.
37
+
38
+ ## Get started
39
+
40
+ You need Node 24 or newer.
41
+
42
+ ```sh
43
+ npx launchset init --detect # see what init would do, without writing anything
44
+ npx launchset init # set up the repo: the config and the workflows
45
+ npx launchset add # add a changeset to a PR
46
+ npx launchset status # pending changes and the next version
47
+ ```
48
+
49
+ `init` finds your current version and build numbers, your Dockerfiles and native projects, and release tooling that would conflict. It never lowers a version without asking. On GitHub, releases run with a GitHub App you create once per org; see [GitHub App setup](https://demonsters.github.io/launchset/github-app/). The workflows use the action [`demonsters/launchset-action@v1`](https://github.com/demonsters/launchset-action).
50
+
51
+ Start with [Getting started](https://demonsters.github.io/launchset/getting-started/), or [Moving an existing repo](https://demonsters.github.io/launchset/guides/migrating/) if the repo already has a release process.
52
+
53
+ ## Targets
54
+
55
+ | Target | What launchset writes |
56
+ | --- | --- |
57
+ | [Docker](https://demonsters.github.io/launchset/targets/docker/) | image tags and OCI labels for your build-push step |
58
+ | [Web](https://demonsters.github.io/launchset/targets/web/) | nothing by default (the root `package.json` holds the version), or the version in extra JSON, YAML or text files |
59
+ | [Android](https://demonsters.github.io/launchset/targets/android/) | `versionName` and `versionCode` (`build.gradle`, `build.gradle.kts` or `gradle.properties`) |
60
+ | [iOS](https://demonsters.github.io/launchset/targets/ios/) | marketing version and build number (Xcode project, `Info.plist` files or an `.xcconfig`) |
61
+ | [React Native](https://demonsters.github.io/launchset/targets/react-native/), [Capacitor](https://demonsters.github.io/launchset/targets/capacitor/), [Expo](https://demonsters.github.io/launchset/targets/expo/) (experimental) | the same Android and iOS targets, pointed at their files |
62
+ | [Flutter](https://demonsters.github.io/launchset/targets/flutter/) (experimental) | the same Android and iOS targets: `version` in `pubspec.yaml`, with the build number after the `+` in CI |
63
+ | [Custom](https://demonsters.github.io/launchset/targets/custom/) | anything else: an npm package, a CLI, a file of your choice |
64
+
65
+ ## Agent skills
66
+
67
+ launchset ships two skills for AI coding agents:
68
+
69
+ - [`launchset`](https://github.com/demonsters/launchset/blob/main/skills/launchset/SKILL.md), for agents working in a repo that uses launchset. `launchset init` installs it into `.claude/skills/launchset/`.
70
+ - [`launchset-adopt`](https://github.com/demonsters/launchset/blob/main/skills/launchset-adopt/SKILL.md), for agents moving an existing repo onto launchset. Install it at user level; see [the adoption skill](https://demonsters.github.io/launchset/guides/migrating/#the-adoption-skill).
71
+
72
+ ## Development
73
+
74
+ Node 24 and pnpm.
75
+
76
+ ```sh
77
+ pnpm install
78
+ pnpm build # CLI (dist/), JSON Schema, action bundle (action/dist/)
79
+ pnpm test # vitest
80
+ pnpm typecheck
81
+ pnpm lint # biome; `pnpm format` fixes
82
+ pnpm --filter docs dev # docs with live reload
83
+ pnpm --filter docs build # docs production build
84
+ ```
85
+
86
+ The docs (Astro Starlight, in [`docs/`](https://github.com/demonsters/launchset/tree/main/docs)) generate their configuration reference, CLI reference, action inputs and outputs and the GitHub App permissions from the code. They're published to GitHub Pages on every push to `main`.
87
+
88
+ ```
89
+ src/ core logic, config schema, platform stampers, git, GitHub and GitLab, verify, CLI, init
90
+ action/ the GitHub Action (action.yml, source; the bundle is built into action/dist/)
91
+ templates/ workflow and pipeline templates used by init
92
+ skills/ agent skills
93
+ docs/ the documentation site
94
+ test/ tests and fixtures
95
+ design/ the spec and the design decisions
96
+ ```
97
+
98
+ The design is in [`design/SPEC.md`](https://github.com/demonsters/launchset/blob/main/design/SPEC.md) and [`design/DECISIONS.md`](https://github.com/demonsters/launchset/blob/main/design/DECISIONS.md).
99
+
100
+ ## License
101
+
102
+ [MIT](https://github.com/demonsters/launchset/blob/main/LICENSE). Built and used at [De Monsters](https://demonsters.nl).
@@ -0,0 +1,143 @@
1
+ import { a as paren, c as VerifyError, i as missingEnv, n as decodeSecret, o as readJson, r as errorDetail, s as send } from "./http-dQt8kfON.js";
2
+ import { i as requireBuildNumber, n as decideStore, r as parseBuildVersion, t as compareBuildVersions } from "./store-BCwWrhhY.js";
3
+ import { SignJWT, importPKCS8 } from "jose";
4
+ // src/verify/appstore.ts
5
+ /**
6
+ * App Store Connect check (spec 7.3): list every build of the app (following
7
+ * pagination), take the max build `version`, compared numerically (it's a string, and
8
+ * the API's sort order isn't numeric). Auth: ES256 JWT from an App Store Connect API key.
9
+ *
10
+ * Only iOS builds count. One app record can also hold tvOS, visionOS and macOS (incl.
11
+ * Mac Catalyst) builds, with their own build numbers. Each build's preReleaseVersion
12
+ * carries the `platform`; the filtering happens here, on the client, rather than with
13
+ * `filter[preReleaseVersion.platform]`, so a filter the API silently ignored could never
14
+ * let other platforms through. A build whose platform is unknown still counts (counting
15
+ * too much can only cause a false "store is ahead", never a duplicate upload).
16
+ */
17
+ const ASC_ENV = {
18
+ keyId: "LAUNCHSET_ASC_KEY_ID",
19
+ issuerId: "LAUNCHSET_ASC_ISSUER_ID",
20
+ privateKey: "LAUNCHSET_ASC_PRIVATE_KEY"
21
+ };
22
+ const ASC_API = "https://api.appstoreconnect.apple.com/v1";
23
+ const ASC_AUDIENCE = "appstoreconnect-v1";
24
+ /** Apple rejects tokens that live longer than 20 minutes. */
25
+ const TOKEN_LIFETIME_SECONDS = 900;
26
+ /** Safety stop for pagination (200 builds per page). */
27
+ const MAX_PAGES = 500;
28
+ const API = "App Store Connect";
29
+ /** `platform` of an iOS preReleaseVersion. */
30
+ const IOS = "IOS";
31
+ /** Normalize the private key: raw PEM, PEM with literal `\n`, base64 PEM, or base64 DER body. */
32
+ function normalizeP8(value) {
33
+ const isPem = (text) => text.includes("-----BEGIN");
34
+ const unescaped = value.includes("\\n") && !value.includes("\n") ? value.replace(/\\n/g, "\n") : value;
35
+ const pem = decodeSecret(unescaped, isPem);
36
+ if (pem) return pem;
37
+ const body = unescaped.replace(/\s+/g, "");
38
+ if (/^[A-Za-z0-9+/]+={0,2}$/.test(body) && body.length > 40) return `-----BEGIN PRIVATE KEY-----\n${(body.match(/.{1,64}/g) ?? []).join("\n")}\n-----END PRIVATE KEY-----`;
39
+ }
40
+ /** Sign an App Store Connect API token from the `LAUNCHSET_ASC_*` variables. */
41
+ async function createAscToken(ctx) {
42
+ const missing = missingEnv(ctx.env, Object.values(ASC_ENV));
43
+ if (missing.length > 0) throw new VerifyError(`App Store Connect verification needs the environment variable${missing.length > 1 ? "s" : ""} ${missing.join(", ")} (from an App Store Connect API key: key ID, issuer ID and the .p8 private key, raw or base64-encoded). Set ${missing.length > 1 ? "them" : "it"} from repository secrets in the verify step.`);
44
+ const pem = normalizeP8(ctx.env[ASC_ENV.privateKey] ?? "");
45
+ let key;
46
+ let reason = "not PEM or base64";
47
+ if (pem) try {
48
+ key = await importPKCS8(pem, "ES256");
49
+ } catch (error) {
50
+ reason = error.message;
51
+ }
52
+ if (!key) throw new VerifyError(`${ASC_ENV.privateKey} isn't a valid PKCS#8 EC private key (${reason}). Use the contents of the AuthKey_XXXX.p8 file downloaded from App Store Connect (Users and Access → Integrations).`);
53
+ const now = Math.floor((ctx.now?.() ?? /* @__PURE__ */ new Date()).getTime() / 1e3);
54
+ return new SignJWT({}).setProtectedHeader({
55
+ alg: "ES256",
56
+ kid: ctx.env[ASC_ENV.keyId]?.trim() ?? "",
57
+ typ: "JWT"
58
+ }).setIssuer(ctx.env[ASC_ENV.issuerId]?.trim() ?? "").setAudience(ASC_AUDIENCE).setIssuedAt(now).setExpirationTime(now + TOKEN_LIFETIME_SECONDS).sign(key);
59
+ }
60
+ /** First page of the builds list. */
61
+ function ascBuildsUrl(appId) {
62
+ const params = new URLSearchParams({
63
+ "filter[app]": appId,
64
+ "fields[builds]": "version,preReleaseVersion",
65
+ include: "preReleaseVersion",
66
+ "fields[preReleaseVersions]": "version,platform",
67
+ limit: "200"
68
+ });
69
+ return `${ASC_API}/builds?${params.toString()}`;
70
+ }
71
+ function ascHint(status) {
72
+ if (status === 401) return ` Check ${ASC_ENV.keyId}, ${ASC_ENV.issuerId} and ${ASC_ENV.privateKey}: they must belong to the same, non-revoked API key.`;
73
+ if (status === 403) return " The API key needs access to the app (role App Manager, Developer or Admin).";
74
+ if (status === 404) return " Check store.appId (the numeric Apple ID of the app).";
75
+ return "";
76
+ }
77
+ /** App Store Connect check for one app (spec 7.3). */
78
+ async function verifyAppStore(check, ctx) {
79
+ const store = `App Store Connect (app ${check.appId})`;
80
+ const ours = requireBuildNumber(check, store);
81
+ const headers = {
82
+ authorization: `Bearer ${await createAscToken(ctx)}`,
83
+ accept: "application/json"
84
+ };
85
+ const numbers = [];
86
+ let exact = false;
87
+ let sameNumberVersion;
88
+ let ignored = 0;
89
+ let otherPlatforms = 0;
90
+ const marketing = parseBuildVersion(check.version);
91
+ const seen = /* @__PURE__ */ new Set();
92
+ let url = ascBuildsUrl(check.appId);
93
+ while (url) {
94
+ if (seen.has(url) || seen.size >= MAX_PAGES) throw new VerifyError(`${API}: listing builds didn't finish after ${seen.size} pages (pagination loops or never ends). Try again later.`);
95
+ seen.add(url);
96
+ const response = await send(ctx, API, url, { headers });
97
+ if (!response.ok) throw new VerifyError(`${API}: listing builds (GET ${url}) failed with HTTP ${response.status}${paren(await errorDetail(response))}.${ascHint(response.status)}`);
98
+ const page = await readJson(response, API, url);
99
+ const versions = /* @__PURE__ */ new Map();
100
+ for (const item of page.included ?? []) {
101
+ if (item.type !== "preReleaseVersions") continue;
102
+ const { version, platform } = item.attributes ?? {};
103
+ versions.set(item.id, {
104
+ ...typeof version === "string" ? { version } : {},
105
+ ...typeof platform === "string" ? { platform } : {}
106
+ });
107
+ }
108
+ for (const build of page.data ?? []) {
109
+ const relation = build.relationships?.preReleaseVersion?.data;
110
+ const preRelease = relation ? versions.get(relation.id) : void 0;
111
+ if (preRelease?.platform && preRelease.platform !== IOS) {
112
+ otherPlatforms++;
113
+ continue;
114
+ }
115
+ const raw = build.attributes?.version;
116
+ const parsed = typeof raw === "string" ? parseBuildVersion(raw) : void 0;
117
+ if (typeof raw !== "string" || !parsed) {
118
+ ignored++;
119
+ continue;
120
+ }
121
+ numbers.push(raw);
122
+ if (compareBuildVersions(parsed, [ours]) !== 0) continue;
123
+ const buildMarketing = preRelease?.version;
124
+ const parsedMarketing = buildMarketing ? parseBuildVersion(buildMarketing) : void 0;
125
+ if (buildMarketing === check.version || marketing && parsedMarketing && compareBuildVersions(marketing, parsedMarketing) === 0) exact = true;
126
+ else sameNumberVersion = buildMarketing ?? "an unknown version";
127
+ }
128
+ url = typeof page.links?.next === "string" && page.links.next ? page.links.next : void 0;
129
+ if (url && !url.startsWith(`https://api.appstoreconnect.apple.com/v1/`)) throw new VerifyError(`${API}: the builds list points its next page at ${url}, outside ${ASC_API}. Try again later.`);
130
+ }
131
+ const notes = [];
132
+ if (!exact && sameNumberVersion) notes.push(`build ${ours} exists for version ${sameNumberVersion}, not ${check.version}`);
133
+ if (ignored > 0) notes.push(`ignored ${ignored} build(s) without a numeric version`);
134
+ if (otherPlatforms > 0) notes.push(`ignored ${otherPlatforms} non-iOS build(s)`);
135
+ return decideStore(check, ours, {
136
+ store,
137
+ unit: "build",
138
+ numbers,
139
+ exact,
140
+ notes
141
+ });
142
+ }
143
+ export { verifyAppStore };