@scalebun-release/cli 2.5.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 (210) hide show
  1. package/bin/scalebun.js +2 -0
  2. package/lib/api/client.d.ts +52 -0
  3. package/lib/api/client.d.ts.map +1 -0
  4. package/lib/api/client.js +335 -0
  5. package/lib/api/client.js.map +1 -0
  6. package/lib/commands/ci-init.d.ts +3 -0
  7. package/lib/commands/ci-init.d.ts.map +1 -0
  8. package/lib/commands/ci-init.js +348 -0
  9. package/lib/commands/ci-init.js.map +1 -0
  10. package/lib/commands/doctor.d.ts +31 -0
  11. package/lib/commands/doctor.d.ts.map +1 -0
  12. package/lib/commands/doctor.js +559 -0
  13. package/lib/commands/doctor.js.map +1 -0
  14. package/lib/commands/launch.d.ts +3 -0
  15. package/lib/commands/launch.d.ts.map +1 -0
  16. package/lib/commands/launch.js +23 -0
  17. package/lib/commands/launch.js.map +1 -0
  18. package/lib/commands/link.d.ts +16 -0
  19. package/lib/commands/link.d.ts.map +1 -0
  20. package/lib/commands/link.js +164 -0
  21. package/lib/commands/link.js.map +1 -0
  22. package/lib/commands/login.d.ts +12 -0
  23. package/lib/commands/login.d.ts.map +1 -0
  24. package/lib/commands/login.js +124 -0
  25. package/lib/commands/login.js.map +1 -0
  26. package/lib/commands/migrate-codepush.d.ts +13 -0
  27. package/lib/commands/migrate-codepush.d.ts.map +1 -0
  28. package/lib/commands/migrate-codepush.js +98 -0
  29. package/lib/commands/migrate-codepush.js.map +1 -0
  30. package/lib/commands/ota-bundle.d.ts +22 -0
  31. package/lib/commands/ota-bundle.d.ts.map +1 -0
  32. package/lib/commands/ota-bundle.js +253 -0
  33. package/lib/commands/ota-bundle.js.map +1 -0
  34. package/lib/commands/ota-channels.d.ts +3 -0
  35. package/lib/commands/ota-channels.d.ts.map +1 -0
  36. package/lib/commands/ota-channels.js +231 -0
  37. package/lib/commands/ota-channels.js.map +1 -0
  38. package/lib/commands/ota-delete-bundle.d.ts +16 -0
  39. package/lib/commands/ota-delete-bundle.d.ts.map +1 -0
  40. package/lib/commands/ota-delete-bundle.js +96 -0
  41. package/lib/commands/ota-delete-bundle.js.map +1 -0
  42. package/lib/commands/ota-inspect.d.ts +3 -0
  43. package/lib/commands/ota-inspect.d.ts.map +1 -0
  44. package/lib/commands/ota-inspect.js +258 -0
  45. package/lib/commands/ota-inspect.js.map +1 -0
  46. package/lib/commands/ota-keys.d.ts +91 -0
  47. package/lib/commands/ota-keys.d.ts.map +1 -0
  48. package/lib/commands/ota-keys.js +765 -0
  49. package/lib/commands/ota-keys.js.map +1 -0
  50. package/lib/commands/ota-promote.d.ts +3 -0
  51. package/lib/commands/ota-promote.d.ts.map +1 -0
  52. package/lib/commands/ota-promote.js +194 -0
  53. package/lib/commands/ota-promote.js.map +1 -0
  54. package/lib/commands/ota-publish.d.ts +26 -0
  55. package/lib/commands/ota-publish.d.ts.map +1 -0
  56. package/lib/commands/ota-publish.js +892 -0
  57. package/lib/commands/ota-publish.js.map +1 -0
  58. package/lib/commands/ota-rollout.d.ts +3 -0
  59. package/lib/commands/ota-rollout.d.ts.map +1 -0
  60. package/lib/commands/ota-rollout.js +265 -0
  61. package/lib/commands/ota-rollout.js.map +1 -0
  62. package/lib/commands/ota-sign.d.ts +19 -0
  63. package/lib/commands/ota-sign.d.ts.map +1 -0
  64. package/lib/commands/ota-sign.js +245 -0
  65. package/lib/commands/ota-sign.js.map +1 -0
  66. package/lib/commands/push-apns.d.ts +3 -0
  67. package/lib/commands/push-apns.d.ts.map +1 -0
  68. package/lib/commands/push-apns.js +166 -0
  69. package/lib/commands/push-apns.js.map +1 -0
  70. package/lib/commands/quickstart.d.ts +4 -0
  71. package/lib/commands/quickstart.d.ts.map +1 -0
  72. package/lib/commands/quickstart.js +672 -0
  73. package/lib/commands/quickstart.js.map +1 -0
  74. package/lib/commands/shell.d.ts +28 -0
  75. package/lib/commands/shell.d.ts.map +1 -0
  76. package/lib/commands/shell.js +512 -0
  77. package/lib/commands/shell.js.map +1 -0
  78. package/lib/commands/tls-pins.d.ts +27 -0
  79. package/lib/commands/tls-pins.d.ts.map +1 -0
  80. package/lib/commands/tls-pins.js +209 -0
  81. package/lib/commands/tls-pins.js.map +1 -0
  82. package/lib/index.d.ts +2 -0
  83. package/lib/index.d.ts.map +1 -0
  84. package/lib/index.js +233 -0
  85. package/lib/index.js.map +1 -0
  86. package/lib/ui/banner.d.ts +23 -0
  87. package/lib/ui/banner.d.ts.map +1 -0
  88. package/lib/ui/banner.js +162 -0
  89. package/lib/ui/banner.js.map +1 -0
  90. package/lib/ui/graphics.d.ts +18 -0
  91. package/lib/ui/graphics.d.ts.map +1 -0
  92. package/lib/ui/graphics.js +134 -0
  93. package/lib/ui/graphics.js.map +1 -0
  94. package/lib/ui/mark.d.ts +4 -0
  95. package/lib/ui/mark.d.ts.map +1 -0
  96. package/lib/ui/mark.js +21 -0
  97. package/lib/ui/mark.js.map +1 -0
  98. package/lib/ui/menu.d.ts +109 -0
  99. package/lib/ui/menu.d.ts.map +1 -0
  100. package/lib/ui/menu.js +314 -0
  101. package/lib/ui/menu.js.map +1 -0
  102. package/lib/ui/sixel.d.ts +6 -0
  103. package/lib/ui/sixel.d.ts.map +1 -0
  104. package/lib/ui/sixel.js +9 -0
  105. package/lib/ui/sixel.js.map +1 -0
  106. package/lib/utils/apps.d.ts +29 -0
  107. package/lib/utils/apps.d.ts.map +1 -0
  108. package/lib/utils/apps.js +19 -0
  109. package/lib/utils/apps.js.map +1 -0
  110. package/lib/utils/browser.d.ts +9 -0
  111. package/lib/utils/browser.d.ts.map +1 -0
  112. package/lib/utils/browser.js +39 -0
  113. package/lib/utils/browser.js.map +1 -0
  114. package/lib/utils/bundle.d.ts +153 -0
  115. package/lib/utils/bundle.d.ts.map +1 -0
  116. package/lib/utils/bundle.js +459 -0
  117. package/lib/utils/bundle.js.map +1 -0
  118. package/lib/utils/bundleStore.d.ts +128 -0
  119. package/lib/utils/bundleStore.d.ts.map +1 -0
  120. package/lib/utils/bundleStore.js +250 -0
  121. package/lib/utils/bundleStore.js.map +1 -0
  122. package/lib/utils/context.d.ts +88 -0
  123. package/lib/utils/context.d.ts.map +1 -0
  124. package/lib/utils/context.js +247 -0
  125. package/lib/utils/context.js.map +1 -0
  126. package/lib/utils/credentials.d.ts +59 -0
  127. package/lib/utils/credentials.d.ts.map +1 -0
  128. package/lib/utils/credentials.js +147 -0
  129. package/lib/utils/credentials.js.map +1 -0
  130. package/lib/utils/guide.d.ts +63 -0
  131. package/lib/utils/guide.d.ts.map +1 -0
  132. package/lib/utils/guide.js +191 -0
  133. package/lib/utils/guide.js.map +1 -0
  134. package/lib/utils/hash.d.ts +3 -0
  135. package/lib/utils/hash.d.ts.map +1 -0
  136. package/lib/utils/hash.js +44 -0
  137. package/lib/utils/hash.js.map +1 -0
  138. package/lib/utils/native-id.d.ts +17 -0
  139. package/lib/utils/native-id.d.ts.map +1 -0
  140. package/lib/utils/native-id.js +105 -0
  141. package/lib/utils/native-id.js.map +1 -0
  142. package/lib/utils/output.d.ts +96 -0
  143. package/lib/utils/output.d.ts.map +1 -0
  144. package/lib/utils/output.js +135 -0
  145. package/lib/utils/output.js.map +1 -0
  146. package/lib/utils/prompt.d.ts +106 -0
  147. package/lib/utils/prompt.d.ts.map +1 -0
  148. package/lib/utils/prompt.js +457 -0
  149. package/lib/utils/prompt.js.map +1 -0
  150. package/lib/utils/provenance.d.ts +30 -0
  151. package/lib/utils/provenance.d.ts.map +1 -0
  152. package/lib/utils/provenance.js +157 -0
  153. package/lib/utils/provenance.js.map +1 -0
  154. package/lib/utils/resolve.d.ts +81 -0
  155. package/lib/utils/resolve.d.ts.map +1 -0
  156. package/lib/utils/resolve.js +139 -0
  157. package/lib/utils/resolve.js.map +1 -0
  158. package/lib/utils/sdkBin.d.ts +18 -0
  159. package/lib/utils/sdkBin.d.ts.map +1 -0
  160. package/lib/utils/sdkBin.js +76 -0
  161. package/lib/utils/sdkBin.js.map +1 -0
  162. package/lib/utils/signer.d.ts +94 -0
  163. package/lib/utils/signer.d.ts.map +1 -0
  164. package/lib/utils/signer.js +230 -0
  165. package/lib/utils/signer.js.map +1 -0
  166. package/lib/utils/signing.d.ts +102 -0
  167. package/lib/utils/signing.d.ts.map +1 -0
  168. package/lib/utils/signing.js +229 -0
  169. package/lib/utils/signing.js.map +1 -0
  170. package/lib/utils/transportSecurity.d.ts +36 -0
  171. package/lib/utils/transportSecurity.d.ts.map +1 -0
  172. package/lib/utils/transportSecurity.js +74 -0
  173. package/lib/utils/transportSecurity.js.map +1 -0
  174. package/lib/utils/trustAnchor.d.ts +109 -0
  175. package/lib/utils/trustAnchor.d.ts.map +1 -0
  176. package/lib/utils/trustAnchor.js +169 -0
  177. package/lib/utils/trustAnchor.js.map +1 -0
  178. package/lib/utils/ui.d.ts +12 -0
  179. package/lib/utils/ui.d.ts.map +1 -0
  180. package/lib/utils/ui.js +60 -0
  181. package/lib/utils/ui.js.map +1 -0
  182. package/lib/utils/validate.d.ts +62 -0
  183. package/lib/utils/validate.d.ts.map +1 -0
  184. package/lib/utils/validate.js +189 -0
  185. package/lib/utils/validate.js.map +1 -0
  186. package/lib/vendor/ota-protocol/base64.d.ts +11 -0
  187. package/lib/vendor/ota-protocol/base64.d.ts.map +1 -0
  188. package/lib/vendor/ota-protocol/base64.js +39 -0
  189. package/lib/vendor/ota-protocol/base64.js.map +1 -0
  190. package/lib/vendor/ota-protocol/codec.d.ts +26 -0
  191. package/lib/vendor/ota-protocol/codec.d.ts.map +1 -0
  192. package/lib/vendor/ota-protocol/codec.js +349 -0
  193. package/lib/vendor/ota-protocol/codec.js.map +1 -0
  194. package/lib/vendor/ota-protocol/hex.d.ts +8 -0
  195. package/lib/vendor/ota-protocol/hex.d.ts.map +1 -0
  196. package/lib/vendor/ota-protocol/hex.js +31 -0
  197. package/lib/vendor/ota-protocol/hex.js.map +1 -0
  198. package/lib/vendor/ota-protocol/index.d.ts +17 -0
  199. package/lib/vendor/ota-protocol/index.d.ts.map +1 -0
  200. package/lib/vendor/ota-protocol/index.js +41 -0
  201. package/lib/vendor/ota-protocol/index.js.map +1 -0
  202. package/lib/vendor/ota-protocol/limits.d.ts +39 -0
  203. package/lib/vendor/ota-protocol/limits.d.ts.map +1 -0
  204. package/lib/vendor/ota-protocol/limits.js +42 -0
  205. package/lib/vendor/ota-protocol/limits.js.map +1 -0
  206. package/lib/vendor/ota-protocol/types.d.ts +73 -0
  207. package/lib/vendor/ota-protocol/types.d.ts.map +1 -0
  208. package/lib/vendor/ota-protocol/types.js +24 -0
  209. package/lib/vendor/ota-protocol/types.js.map +1 -0
  210. package/package.json +37 -0
@@ -0,0 +1,209 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.registerTlsCommands = registerTlsCommands;
37
+ const tls = __importStar(require("tls"));
38
+ const crypto = __importStar(require("crypto"));
39
+ const fs = __importStar(require("fs"));
40
+ /**
41
+ * The SPKI pin: base64 of SHA-256 over the DER SubjectPublicKeyInfo.
42
+ *
43
+ * Over the PUBLIC KEY, not over the certificate. This is the whole reason
44
+ * pinning survives a certificate renewal at all — a renewed certificate for the
45
+ * same key has the same SPKI and the same pin. Hashing the certificate instead
46
+ * produces a string that looks identical in shape and matches nothing after the
47
+ * next renewal.
48
+ */
49
+ /** A multi-valued RDN yields an array; join it rather than render '[object]'. */
50
+ function flat(v) {
51
+ if (v === undefined)
52
+ return undefined;
53
+ return Array.isArray(v) ? v.join(', ') : v;
54
+ }
55
+ function spkiPin(cert) {
56
+ const der = cert.pubkey;
57
+ if (!der)
58
+ throw new Error('certificate exposed no public key');
59
+ return crypto.createHash('sha256').update(der).digest('base64');
60
+ }
61
+ function fetchChain(host, port, timeoutMs) {
62
+ return new Promise((resolve, reject) => {
63
+ const socket = tls.connect({ host, port, servername: host, rejectUnauthorized: false }, () => {
64
+ const chain = [];
65
+ const seen = new Set();
66
+ let cert = socket.getPeerCertificate(true);
67
+ let position = 0;
68
+ while (cert && Object.keys(cert).length > 0) {
69
+ const fp = cert.fingerprint256 ?? String(position);
70
+ if (seen.has(fp))
71
+ break; // the root issues itself; stop rather than loop
72
+ seen.add(fp);
73
+ const validTo = new Date(cert.valid_to);
74
+ chain.push({
75
+ position,
76
+ // CN can be string | string[] on a multi-valued RDN.
77
+ subject: flat(cert.subject?.CN) ?? JSON.stringify(cert.subject ?? {}),
78
+ issuer: flat(cert.issuer?.CN) ?? JSON.stringify(cert.issuer ?? {}),
79
+ isCa: position > 0,
80
+ isSelfSigned: cert.fingerprint256 === cert.issuerCertificate?.fingerprint256,
81
+ validTo: validTo.toISOString().slice(0, 10),
82
+ daysRemaining: Math.round((validTo.getTime() - Date.now()) / 86400000),
83
+ pin: spkiPin(cert),
84
+ });
85
+ if (!cert.issuerCertificate || cert.issuerCertificate === cert)
86
+ break;
87
+ cert = cert.issuerCertificate;
88
+ position++;
89
+ }
90
+ socket.end();
91
+ resolve(chain);
92
+ });
93
+ socket.setTimeout(timeoutMs, () => {
94
+ socket.destroy();
95
+ reject(new Error(`timed out connecting to ${host}:${port}`));
96
+ });
97
+ socket.on('error', reject);
98
+ });
99
+ }
100
+ function registerTlsCommands(program) {
101
+ const tlsCmd = program
102
+ .command('tls')
103
+ .description('Certificate pinning: generate and verify pins');
104
+ tlsCmd
105
+ .command('pins')
106
+ .argument('<host>', 'hostname, e.g. api.example.com')
107
+ .option('--port <port>', 'TLS port', '443')
108
+ .option('--json', 'machine-readable output')
109
+ .description('Show the SPKI pins for a host, and which one to pin')
110
+ .action(async (host, opts) => {
111
+ const chain = await fetchChain(host, Number(opts.port), 10000);
112
+ if (opts.json) {
113
+ console.log(JSON.stringify({ host, chain }, null, 2));
114
+ return;
115
+ }
116
+ console.log(`\nCertificate chain for ${host}\n`);
117
+ for (const c of chain) {
118
+ const role = c.position === 0 ? 'leaf' : c.isSelfSigned ? 'root' : 'intermediate';
119
+ console.log(` [${c.position}] ${role}`);
120
+ console.log(` subject : ${c.subject}`);
121
+ console.log(` issuer : ${c.issuer}`);
122
+ console.log(` expires : ${c.validTo} (${c.daysRemaining} days)`);
123
+ console.log(` pin : sha256/${c.pin}`);
124
+ console.log('');
125
+ }
126
+ const leaf = chain[0];
127
+ const intermediate = chain[1];
128
+ console.log('Which to pin\n');
129
+ if (leaf && leaf.daysRemaining < 120) {
130
+ console.log(` The leaf expires in ${leaf.daysRemaining} days, which means it is on a short\n` +
131
+ ' renewal cycle. DO NOT PIN THE LEAF: the fleet would stop working on the\n' +
132
+ ' next renewal, and the OTA lane is itself pinned, so you could not ship a\n' +
133
+ ' fix over the air.\n');
134
+ }
135
+ if (intermediate) {
136
+ console.log(' Pin the INTERMEDIATE, and at least one more as backup:\n');
137
+ console.log(` "${host}": [`);
138
+ console.log(` "sha256/${intermediate.pin}",`);
139
+ console.log(` "sha256/<BACKUP — see below>"`);
140
+ console.log(' ]\n');
141
+ }
142
+ console.log(' A BACKUP PIN IS NOT OPTIONAL. The SDK refuses to arm with fewer than two\n' +
143
+ ' pins for a host, on purpose: a single pin is a single point of failure with\n' +
144
+ ' no rotation path. The backup should be a key you control and can switch to —\n' +
145
+ " typically your CA's other intermediate, or a spare key already issued.\n");
146
+ });
147
+ tlsCmd
148
+ .command('verify')
149
+ .argument('<config>', 'path to scalebun_tls_pins.json')
150
+ .option('--port <port>', 'TLS port', '443')
151
+ .description('Check a pin configuration against the live certificate chains')
152
+ .action(async (configPath, opts) => {
153
+ const raw = JSON.parse(fs.readFileSync(configPath, 'utf8'));
154
+ const pinsByHost = raw.pins ?? {};
155
+ const hosts = Object.keys(pinsByHost);
156
+ if (hosts.length === 0) {
157
+ console.error('No hosts configured — this file pins nothing.');
158
+ process.exitCode = 1;
159
+ return;
160
+ }
161
+ let failed = false;
162
+ for (const host of hosts) {
163
+ const configured = (pinsByHost[host] ?? []).map((p) => p.replace(/^sha256\//, ''));
164
+ console.log(`\n${host}`);
165
+ if (configured.length < 2) {
166
+ console.log(` ✗ ${configured.length} pin(s) configured. The SDK refuses to arm with fewer\n` +
167
+ ' than two, so this host is currently NOT PINNED AT ALL — which is safe,\n' +
168
+ ' but not what the file says it does.');
169
+ failed = true;
170
+ continue;
171
+ }
172
+ let chain;
173
+ try {
174
+ chain = await fetchChain(host, Number(opts.port), 10000);
175
+ }
176
+ catch (err) {
177
+ console.log(` ✗ could not connect: ${err.message}`);
178
+ failed = true;
179
+ continue;
180
+ }
181
+ const live = new Set(chain.map((c) => c.pin));
182
+ const matched = configured.filter((p) => live.has(p));
183
+ if (matched.length === 0) {
184
+ console.log(' ✗ NO configured pin matches the live chain. Every connection would be\n' +
185
+ ' rejected. Do not ship this.');
186
+ failed = true;
187
+ continue;
188
+ }
189
+ console.log(` ✓ ${matched.length} of ${configured.length} pin(s) match the live chain`);
190
+ // A backup that matches the CURRENT chain is not a backup — it is a
191
+ // second copy of the thing you are already depending on.
192
+ if (matched.length === configured.length) {
193
+ console.log(' ! every configured pin matches the current chain. That is not a backup:\n' +
194
+ ' if this chain is replaced, all of them fail together. At least one pin\n' +
195
+ ' should be a key you can switch TO.');
196
+ }
197
+ const pinnedLeaf = chain[0] && configured.includes(chain[0].pin);
198
+ if (pinnedLeaf && chain[0].daysRemaining < 120) {
199
+ console.log(` ! the LEAF is pinned and expires in ${chain[0].daysRemaining} days. On renewal\n` +
200
+ ' the fleet stops working, and the OTA lane is pinned too, so no fix can\n' +
201
+ ' be shipped over the air. Pin the intermediate instead.');
202
+ }
203
+ }
204
+ console.log('');
205
+ if (failed)
206
+ process.exitCode = 1;
207
+ });
208
+ }
209
+ //# sourceMappingURL=tls-pins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tls-pins.js","sourceRoot":"","sources":["../../src/commands/tls-pins.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2GA,kDAwIC;AA1ND,yCAA2B;AAC3B,+CAAiC;AACjC,uCAAyB;AAazB;;;;;;;;GAQG;AACH,iFAAiF;AACjF,SAAS,IAAI,CAAC,CAAgC;IAC5C,IAAI,CAAC,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACtC,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7C,CAAC;AAED,SAAS,OAAO,CAAC,IAAiC;IAChD,MAAM,GAAG,GAAI,IAAY,CAAC,MAA4B,CAAC;IACvD,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;IAC/D,OAAO,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CA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,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YAEtD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACzB,OAAO,CAAC,GAAG,CACT,2EAA2E;oBACzE,iCAAiC,CACpC,CAAC;gBACF,MAAM,GAAG,IAAI,CAAC;gBACd,SAAS;YACX,CAAC;YAED,OAAO,CAAC,GAAG,CAAC,OAAO,OAAO,CAAC,MAAM,OAAO,UAAU,CAAC,MAAM,8BAA8B,CAAC,CAAC;YAEzF,oEAAoE;YACpE,yDAAyD;YACzD,IAAI,OAAO,CAAC,MAAM,KAAK,UAAU,CAAC,MAAM,EAAE,CAAC;gBACzC,OAAO,CAAC,GAAG,CACT,6EAA6E;oBAC3E,8EAA8E;oBAC9E,wCAAwC,CAC3C,CAAC;YACJ,CAAC;YAED,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACjE,IAAI,UAAU,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,aAAa,GAAG,GAAG,EAAE,CAAC;gBAC/C,OAAO,CAAC,GAAG,CACT,yCAAyC,KAAK,CAAC,CAAC,CAAC,CAAC,aAAa,qBAAqB;oBAClF,8EAA8E;oBAC9E,4DAA4D,CAC/D,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,IAAI,MAAM;YAAE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;AACP,CAAC"}
package/lib/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/lib/index.js ADDED
@@ -0,0 +1,233 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const commander_1 = require("commander");
7
+ const login_1 = require("./commands/login");
8
+ const doctor_1 = require("./commands/doctor");
9
+ const ota_publish_1 = require("./commands/ota-publish");
10
+ const ota_bundle_1 = require("./commands/ota-bundle");
11
+ const ota_sign_1 = require("./commands/ota-sign");
12
+ const push_apns_1 = require("./commands/push-apns");
13
+ const ota_channels_1 = require("./commands/ota-channels");
14
+ const ota_delete_bundle_1 = require("./commands/ota-delete-bundle");
15
+ const ota_keys_1 = require("./commands/ota-keys");
16
+ const ota_rollout_1 = require("./commands/ota-rollout");
17
+ const launch_1 = require("./commands/launch");
18
+ const migrate_codepush_1 = require("./commands/migrate-codepush");
19
+ const ci_init_1 = require("./commands/ci-init");
20
+ const quickstart_1 = require("./commands/quickstart");
21
+ const chalk_1 = __importDefault(require("chalk"));
22
+ const ui_1 = require("./utils/ui");
23
+ const banner_1 = require("./ui/banner");
24
+ const graphics_1 = require("./ui/graphics");
25
+ // Shared with quickstart's native-wiring step — one resolver, one behaviour.
26
+ const sdkBin_1 = require("./utils/sdkBin");
27
+ const link_1 = require("./commands/link");
28
+ const shell_1 = require("./commands/shell");
29
+ const ota_inspect_1 = require("./commands/ota-inspect");
30
+ const ota_promote_1 = require("./commands/ota-promote");
31
+ const tls_pins_1 = require("./commands/tls-pins");
32
+ const context_1 = require("./utils/context");
33
+ const guide_1 = require("./utils/guide");
34
+ const output_1 = require("./utils/output");
35
+ const program = new commander_1.Command();
36
+ // Kept in one place so the block-art and sixel paths show the same tagline.
37
+ const TAGLINE = 'Enterprise OTA Update & Telemetry Control Plane';
38
+ // Read the version from package.json so it can never drift from the published
39
+ // version. The compiled entry lives at lib/index.js, so ../package.json is the
40
+ // CLI manifest. (Hardcoding it left `scalebun --version` reporting 0.1.0 long
41
+ // after the package had moved on.)
42
+ const { version } = require('../package.json');
43
+ /**
44
+ * The no-arg splash: art (mark + wordmark) is gated by shouldShowArt(); the
45
+ * status line and command table are the command's actual output and always print.
46
+ *
47
+ * Sixel is opt-in this release (SCALEBUN_GRAPHICS=sixel); the default is block
48
+ * art. capabilities() probes stdin, so it runs ONLY when art will actually draw —
49
+ * never on a real command.
50
+ */
51
+ async function printSplash() {
52
+ if ((0, banner_1.shouldShowArt)()) {
53
+ // Sixel is the DEFAULT: probe whenever art draws to a real terminal, and use
54
+ // the smooth logo wherever it's supported. `SCALEBUN_GRAPHICS=off` (handled
55
+ // inside capabilities()) forces block art. The stdout.isTTY guard keeps sixel
56
+ // out of pipes/redirects and skips the stdin probe when output isn't a TTY.
57
+ const caps = process.stdout.isTTY ? await (0, graphics_1.capabilities)() : null;
58
+ if (caps?.sixel) {
59
+ process.stdout.write((0, graphics_1.lockup)(caps, [...banner_1.WORDMARK], TAGLINE, { level: chalk_1.default.level }));
60
+ }
61
+ else {
62
+ process.stdout.write((0, banner_1.banner)({ version }));
63
+ }
64
+ }
65
+ (0, ui_1.renderStatus)();
66
+ // The command list is now stage-aware: stage 0 shows one command, stage 4
67
+ // shows the full grouped surface. See utils/guide.ts for why the stage is
68
+ // derived rather than stored.
69
+ const ctx = (0, context_1.getContext)();
70
+ (0, guide_1.renderContextLine)(ctx);
71
+ (0, guide_1.renderGuide)(ctx);
72
+ }
73
+ /**
74
+ * Should a bare `scalebun` hand over to the interactive session?
75
+ *
76
+ * The splash was a dead end: it printed a list of commands and exited, so the
77
+ * promise of "you don't have to type `scalebun` every time" was only reachable
78
+ * by typing `scalebun shell` — a mode you had to already know about, since the
79
+ * splash did not mention it below stage 4.
80
+ *
81
+ * Every guard below is a way this could hang something that cannot answer a
82
+ * prompt. A pipe (`scalebun | head`), a redirect, a CI runner, and machine mode
83
+ * all take the old path: print, exit, done. `SCALEBUN_NO_SHELL=1` is the escape
84
+ * hatch for a human who wants the splash and their prompt back.
85
+ */
86
+ function shouldEnterShell() {
87
+ if (process.env.SCALEBUN_NO_SHELL === '1')
88
+ return false;
89
+ if (process.env.CI === 'true')
90
+ return false;
91
+ if ((0, output_1.isJson)())
92
+ return false;
93
+ if ((0, shell_1.inShell)())
94
+ return false;
95
+ return !!process.stdin.isTTY && !!process.stdout.isTTY;
96
+ }
97
+ /**
98
+ * What `scalebun` with no command does.
99
+ *
100
+ * On a terminal it IS the session — the menu draws its own frame (art, status,
101
+ * project, commands) and redraws it after every command, so printing a splash
102
+ * first would only be erased a frame later. Everywhere else it stays exactly
103
+ * what it was: print and exit.
104
+ */
105
+ async function runBareInvocation() {
106
+ if (shouldEnterShell()) {
107
+ await (0, shell_1.runShell)(program);
108
+ return;
109
+ }
110
+ await printSplash();
111
+ }
112
+ /**
113
+ * Honour --json / --non-interactive before commander parses.
114
+ *
115
+ * Commander does not surface root options to subcommand handlers, so the flag
116
+ * is read from argv directly — the same argv-sniff precedent `--verbose`
117
+ * already uses in utils/ui.ts.
118
+ */
119
+ function applyGlobalFlags(argv) {
120
+ if (argv.includes('--json'))
121
+ (0, output_1.setJsonMode)(true);
122
+ }
123
+ /**
124
+ * Commands that live in @scalebun/react-native's bin, not here.
125
+ *
126
+ * `init android` / `init ios` wire the host app's native files for OTA — they
127
+ * need the SDK package's codemods, so they ship with the SDK. But this CLI's
128
+ * own splash lists `scalebun init android` as step 3 of the getting-started
129
+ * flow, so when THIS binary wins the `scalebun` bin race it must forward the
130
+ * command rather than swallow it. (The SDK bin already forwards `ota …` the
131
+ * other way — this closes the loop so both binaries expose the same surface.)
132
+ */
133
+ const SDK_BIN_COMMANDS = new Set(['init']);
134
+ /**
135
+ * Handle argv that matched no registered command.
136
+ *
137
+ * This used to fall through to the root action, print the splash, and EXIT 0 —
138
+ * so `scalebun init android` (listed on our own splash) and any typo reported
139
+ * success while doing nothing. In CI that green exit is actively dangerous:
140
+ * a misspelled publish step passes the pipeline having published nothing.
141
+ */
142
+ function handleUnmatchedCommand(argv) {
143
+ const cmd = argv[0];
144
+ if (SDK_BIN_COMMANDS.has(cmd)) {
145
+ const sdkBin = (0, sdkBin_1.resolveSdkBin)();
146
+ if (sdkBin) {
147
+ process.exit((0, sdkBin_1.runSdkBin)(sdkBin, argv));
148
+ }
149
+ console.error(`"scalebun ${cmd}" wires the native app and is provided by @scalebun/react-native.`);
150
+ console.error('It could not be resolved from here. Run this from your app root (the');
151
+ console.error('folder with node_modules/@scalebun/react-native), or install the SDK:');
152
+ console.error(' npm install @scalebun/react-native');
153
+ process.exit(1);
154
+ }
155
+ console.error(`error: unknown command '${cmd}'`);
156
+ console.error("Run `scalebun --help` for the list of commands.");
157
+ process.exit(1);
158
+ }
159
+ program
160
+ .name('scalebun')
161
+ .description('Scalebun CLI — OTA bundle publishing and management')
162
+ .version(version)
163
+ // Registered so a strict parser doesn't reject them; the splash reads argv
164
+ // directly (shouldShowArt / renderStatus), so these just keep commander happy.
165
+ .option('--no-banner', 'Hide the splash art (status + commands still print)')
166
+ .option('--verbose', 'Show extra detail (e.g. the API target in the status box)')
167
+ // Machine mode. Also honoured from SCALEBUN_JSON=1 so a CI job can set it
168
+ // once for the whole pipeline instead of on every invocation. Declared here
169
+ // so `--help` documents it; each command reads it via utils/output.
170
+ .option('--json', 'Machine-readable output; implies --non-interactive')
171
+ .option('--non-interactive', 'Never prompt — fail with the flag to pass instead')
172
+ // The variadic catch-all is what routes unmatched tokens into an explicit
173
+ // handler instead of commander's permissive default (which treated them as
174
+ // excess arguments to the root action and exited 0).
175
+ .argument('[command...]')
176
+ // ROOT ONLY (subcommands keep strict parsing): forwarded commands carry
177
+ // their own flags — `init android --check` — and without this the root
178
+ // parser rejects `--check` before the forwarder ever sees it.
179
+ .allowUnknownOption()
180
+ .action(async (extra) => {
181
+ if (!extra || extra.length === 0) {
182
+ await runBareInvocation();
183
+ return;
184
+ }
185
+ handleUnmatchedCommand(extra);
186
+ });
187
+ // `registerLoginCommand` was imported and never called, so `scalebun login`
188
+ // did not exist — every other command depends on the credentials it writes,
189
+ // and the documented first step of the CLI was unreachable.
190
+ (0, login_1.registerLoginCommand)(program);
191
+ (0, quickstart_1.registerQuickstartCommand)(program);
192
+ (0, quickstart_1.registerAppsCommand)(program);
193
+ (0, doctor_1.registerDoctorCommand)(program);
194
+ (0, link_1.registerLinkCommands)(program);
195
+ (0, shell_1.registerShellCommand)(program);
196
+ const ota = program.command('ota').description('OTA update management');
197
+ (0, ota_publish_1.registerOtaPublishCommand)(ota);
198
+ (0, ota_bundle_1.registerOtaBundleCommand)(ota);
199
+ (0, ota_sign_1.registerOtaSignCommand)(ota);
200
+ (0, push_apns_1.registerPushCommand)(program);
201
+ (0, ota_channels_1.registerOtaChannelsCommand)(ota);
202
+ (0, ota_delete_bundle_1.registerOtaDeleteBundleCommand)(ota);
203
+ (0, ota_keys_1.registerOtaKeysCommand)(ota);
204
+ (0, ota_rollout_1.registerOtaRolloutCommands)(ota);
205
+ (0, ota_inspect_1.registerOtaInspectCommands)(ota);
206
+ (0, ota_promote_1.registerOtaPromoteCommand)(ota);
207
+ (0, tls_pins_1.registerTlsCommands)(program);
208
+ (0, launch_1.registerLaunchCommand)(program);
209
+ /**
210
+ * `scalebun help [--all]` — the escape hatch from the staged splash.
211
+ *
212
+ * The splash shows only what is relevant to the current stage, which is right
213
+ * for a newcomer and wrong for anyone who already knows the tool. This always
214
+ * prints the full grouped surface, at any stage.
215
+ */
216
+ program
217
+ .command('help')
218
+ .description('Show every command, grouped by task')
219
+ .option('--all', 'Print every command regardless of project stage')
220
+ .action(() => {
221
+ (0, guide_1.renderAllCommands)();
222
+ });
223
+ const migrate = program.command('migrate').description('Migration utilities from other platforms');
224
+ (0, migrate_codepush_1.registerMigrateCodepushCommand)(migrate);
225
+ (0, ci_init_1.registerCiInitCommand)(program);
226
+ applyGlobalFlags(process.argv);
227
+ if (process.argv.length <= 2) {
228
+ void runBareInvocation();
229
+ }
230
+ else {
231
+ program.parse(process.argv);
232
+ }
233
+ //# sourceMappingURL=index.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AmB,EAAC,OAAO,CAAC,CAAC;AAC7B,IAAA,8BAAqB,EAAC,OAAO,CAAC,CAAC;AAE/B;;;;;;GAMG;AACH,OAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,qCAAqC,CAAC;KAClD,MAAM,CAAC,OAAO,EAAE,iDAAiD,CAAC;KAClE,MAAM,CAAC,GAAG,EAAE;IACX,IAAA,yBAAiB,GAAE,CAAC;AACtB,CAAC,CAAC,CAAC;AAEL,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,0CAA0C,CAAC,CAAC;AACnG,IAAA,iDAA8B,EAAC,OAAO,CAAC,CAAC;AACxC,IAAA,+BAAqB,EAAC,OAAO,CAAC,CAAC;AAE/B,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAE/B,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;IAC7B,KAAK,iBAAiB,EAAE,CAAC;AAC3B,CAAC;KAAM,CAAC;IACN,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { MARK } from './mark';
2
+ export { MARK };
3
+ export declare const WORDMARK: readonly string[];
4
+ /** Real TTY width wins; COLUMNS only covers the non-TTY case (pipes, tests). */
5
+ export declare function termWidth(): number;
6
+ export interface BannerOptions {
7
+ version?: string;
8
+ tagline?: string;
9
+ /** include the rabbit (default true) */
10
+ mark?: boolean;
11
+ /** terminal width override */
12
+ width?: number;
13
+ /** colour level override (0 none · 1 basic · 2 256 · 3 truecolor) */
14
+ level?: number;
15
+ }
16
+ export declare function banner(o?: BannerOptions): string;
17
+ /**
18
+ * Gates the ART ONLY (mark + wordmark). The splash body — status line and
19
+ * command table — is the output of the no-arg command, not banner decoration,
20
+ * so it must NOT be gated by this. Keep the two concerns separate.
21
+ */
22
+ export declare function shouldShowArt(argv?: string[]): boolean;
23
+ //# sourceMappingURL=banner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"banner.d.ts","sourceRoot":"","sources":["../../src/ui/banner.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,IAAI,EAAU,MAAM,QAAQ,CAAC;AAEtC,OAAO,EAAE,IAAI,EAAE,CAAC;AAGhB,eAAO,MAAM,QAAQ,EAAE,SAAS,MAAM,EAOrC,CAAC;AA8DF,gFAAgF;AAChF,wBAAgB,SAAS,IAAI,MAAM,CAElC;AAID,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wCAAwC;IACxC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,MAAM,CAAC,CAAC,GAAE,aAAkB,GAAG,MAAM,CAwDpD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,GAAE,MAAM,EAA0B,GAAG,OAAO,CAK7E"}