launchset 0.0.1 → 1.2.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 (47) hide show
  1. package/README.md +98 -4
  2. package/dist/appstore-bVSJnUv2.js +143 -0
  3. package/dist/cli.js +6889 -0
  4. package/dist/errors-CHdD4g_K.js +58 -0
  5. package/dist/gitlab-child-girdQprO.js +6071 -0
  6. package/dist/http-dQt8kfON.js +127 -0
  7. package/dist/index.d.ts +854 -0
  8. package/dist/index.js +29 -0
  9. package/dist/init-Cv748KKZ.js +8222 -0
  10. package/dist/launchset.schema.json +1473 -0
  11. package/dist/play-D7nv0n-W.js +123 -0
  12. package/dist/prompts-S8h8cgml.js +52 -0
  13. package/dist/schema-CKljQNeI.js +1202 -0
  14. package/dist/store-BCwWrhhY.js +73 -0
  15. package/package.json +85 -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 +222 -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/ios.yml +33 -0
  35. package/templates/gitlab/targets/web.yml +13 -0
  36. package/templates/launchset-readme.md +23 -0
  37. package/templates/workflows/launchset-check.yml +33 -0
  38. package/templates/workflows/launchset-preview.yml +157 -0
  39. package/templates/workflows/launchset-release.yml +181 -0
  40. package/templates/workflows/snippets/android.yml +41 -0
  41. package/templates/workflows/snippets/custom-example.yml +12 -0
  42. package/templates/workflows/snippets/custom-npm.yml +19 -0
  43. package/templates/workflows/snippets/custom.yml +9 -0
  44. package/templates/workflows/snippets/docker-login.yml +9 -0
  45. package/templates/workflows/snippets/docker.yml +17 -0
  46. package/templates/workflows/snippets/ios.yml +46 -0
  47. package/templates/workflows/snippets/web.yml +20 -0
@@ -0,0 +1,127 @@
1
+ import { t as EXPECTED_ERROR } from "./errors-CHdD4g_K.js";
2
+ // src/verify/redact.ts
3
+ /** Masking of credentials in text that goes into messages and logs. */
4
+ const URL_USERINFO = /\b([a-z][a-z0-9+.-]*:\/\/)[^\s/?#@]*@/gi;
5
+ /** Replace the `user:password@` part of every URL in `text` with `***@`. */
6
+ function redactUrls(text) {
7
+ return text.replace(URL_USERINFO, "$1***@");
8
+ }
9
+ // src/verify/types.ts
10
+ /**
11
+ * Verify contract (spec 7.3, 7.4, 7.5). `verify` checks whether this run's build is
12
+ * already published, as a safety net before uploading. It never guesses: a check that
13
+ * can't give a clear answer throws `VerifyError`, and is never treated as "not published".
14
+ */
15
+ /**
16
+ * A check failed (auth, network, unexpected response, store ahead, bad config). The
17
+ * message never carries URL credentials: `user:password@` is masked.
18
+ */
19
+ var VerifyError = class extends Error {
20
+ name = "VerifyError";
21
+ [EXPECTED_ERROR] = true;
22
+ constructor(message, options) {
23
+ super(redactUrls(message), options);
24
+ }
25
+ };
26
+ // src/verify/http.ts
27
+ /** Small helpers shared by the verify clients: fetch with clear errors, secrets decoding. */
28
+ /**
29
+ * `fetch` that turns network failures into a `VerifyError` naming the API and URL.
30
+ * HTTP error statuses are returned as-is: each client decides what they mean.
31
+ */
32
+ async function send(ctx, api, url, init = {}) {
33
+ const fetchFn = ctx.fetch ?? globalThis.fetch;
34
+ const method = init.method ?? "GET";
35
+ try {
36
+ return await fetchFn(url, init);
37
+ } catch (error) {
38
+ throw new VerifyError(`${api}: ${method} ${url} failed before a response arrived (${describeError(error)}). Check the network connection and that the host is reachable from this runner.`, { cause: error });
39
+ }
40
+ }
41
+ /** A `Basic …` Authorization header value. */
42
+ function basicAuth(user, pass) {
43
+ return `Basic ${Buffer.from(`${user}:${pass}`).toString("base64")}`;
44
+ }
45
+ /** Error text including the `cause` chain (undici puts the useful part in `cause`). */
46
+ function describeError(error) {
47
+ const parts = [];
48
+ let current = error;
49
+ for (let depth = 0; current && depth < 4; depth++) if (current instanceof Error) {
50
+ const code = current.code;
51
+ parts.push(typeof code === "string" ? `${current.message} [${code}]` : current.message);
52
+ current = current.cause;
53
+ } else {
54
+ parts.push(String(current));
55
+ break;
56
+ }
57
+ return parts.join(": ") || "unknown error";
58
+ }
59
+ /**
60
+ * A short description of an error response body for messages: the `error_description`,
61
+ * `error.message`, `errors[].detail` etc. of common JSON error shapes, else the text,
62
+ * truncated.
63
+ */
64
+ async function errorDetail(response) {
65
+ let text;
66
+ try {
67
+ text = await response.text();
68
+ } catch {
69
+ return "";
70
+ }
71
+ text = text.trim();
72
+ if (!text) return "";
73
+ try {
74
+ const detail = jsonErrorDetail(JSON.parse(text));
75
+ if (detail) return truncate(detail);
76
+ } catch {}
77
+ return truncate(text.replace(/\s+/g, " "));
78
+ }
79
+ function jsonErrorDetail(json) {
80
+ const str = (value) => typeof value === "string" && value ? value : void 0;
81
+ if (typeof json.error === "string") return [json.error, str(json.error_description)].filter(Boolean).join(": ");
82
+ if (json.error && typeof json.error === "object") {
83
+ const e = json.error;
84
+ const message = [str(e.status), str(e.message)].filter(Boolean).join(": ");
85
+ if (message) return message;
86
+ }
87
+ if (Array.isArray(json.errors)) {
88
+ const messages = json.errors.map((e) => [str(e.code), str(e.detail) ?? str(e.message) ?? str(e.title)].filter(Boolean).join(": ")).filter(Boolean);
89
+ if (messages.length > 0) return messages.join("; ");
90
+ }
91
+ return str(json.message);
92
+ }
93
+ function truncate(text, max = 300) {
94
+ return text.length > max ? `${text.slice(0, max)}…` : text;
95
+ }
96
+ /** ` (detail)` or empty, for appending to a message. */
97
+ function paren(detail) {
98
+ return detail ? ` (${detail})` : "";
99
+ }
100
+ /** Parse a JSON body, or throw a `VerifyError` naming the API and URL. */
101
+ async function readJson(response, api, url) {
102
+ const text = await response.text();
103
+ try {
104
+ return JSON.parse(text);
105
+ } catch {
106
+ throw new VerifyError(`${api}: ${url} answered ${response.status} with a body that isn't valid JSON. The API may be down or a proxy may be in the way; try again later.`);
107
+ }
108
+ }
109
+ const BASE64 = /^[A-Za-z0-9+/_-]+={0,2}$/;
110
+ /**
111
+ * Decode a secret that may be given raw or base64-encoded. `looksRaw` decides whether
112
+ * the value is already in its raw form. Returns `undefined` when it's neither.
113
+ * Never puts the secret into an error message.
114
+ */
115
+ function decodeSecret(value, looksRaw) {
116
+ const trimmed = value.trim();
117
+ if (looksRaw(trimmed)) return trimmed;
118
+ const compact = trimmed.replace(/\s+/g, "");
119
+ if (!BASE64.test(compact)) return void 0;
120
+ const decoded = Buffer.from(compact, "base64").toString("utf8").trim();
121
+ return looksRaw(decoded) ? decoded : void 0;
122
+ }
123
+ /** Names of the variables in `names` that are unset or empty. */
124
+ function missingEnv(env, names) {
125
+ return names.filter((name) => !env[name]?.trim());
126
+ }
127
+ export { paren as a, VerifyError as c, missingEnv as i, redactUrls as l, decodeSecret as n, readJson as o, errorDetail as r, send as s, basicAuth as t };