@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,559 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.findStaticHostConstruction = findStaticHostConstruction;
40
+ exports.registerDoctorCommand = registerDoctorCommand;
41
+ exports.runDoctor = runDoctor;
42
+ const fs = __importStar(require("fs"));
43
+ const crypto = __importStar(require("crypto"));
44
+ const path = __importStar(require("path"));
45
+ const chalk_1 = __importDefault(require("chalk"));
46
+ const output_1 = require("../utils/output");
47
+ const credentials_1 = require("../utils/credentials");
48
+ const client_1 = require("../api/client");
49
+ const bundle_1 = require("../utils/bundle");
50
+ const findings = [];
51
+ function report(level, title, detail) {
52
+ findings.push({ level, title, detail });
53
+ // Under --json the findings array IS the output; printing icons alongside it
54
+ // would corrupt the document a pipeline is trying to parse.
55
+ if ((0, output_1.isJson)())
56
+ return;
57
+ const icon = level === 'ok' ? '✅' : level === 'warn' ? '⚠️ ' : '❌';
58
+ console.log(`${icon} ${title}`);
59
+ if (detail)
60
+ console.log(` ${detail.split('\n').join('\n ')}`);
61
+ }
62
+ /** Find the first file matching `names` under `dir`, skipping heavy folders. */
63
+ function findFile(dir, names, maxDepth = 6) {
64
+ if (maxDepth < 0 || !fs.existsSync(dir))
65
+ return null;
66
+ let entries;
67
+ try {
68
+ entries = fs.readdirSync(dir, { withFileTypes: true });
69
+ }
70
+ catch {
71
+ return null;
72
+ }
73
+ for (const e of entries) {
74
+ if (e.isFile() && names.includes(e.name))
75
+ return path.join(dir, e.name);
76
+ }
77
+ for (const e of entries) {
78
+ if (!e.isDirectory())
79
+ continue;
80
+ if (['node_modules', 'Pods', 'build', '.git', '.gradle'].includes(e.name))
81
+ continue;
82
+ const hit = findFile(path.join(dir, e.name), names, maxDepth - 1);
83
+ if (hit)
84
+ return hit;
85
+ }
86
+ return null;
87
+ }
88
+ /**
89
+ * iOS app sources that build the React host with a STATIC bundle URL.
90
+ *
91
+ * RCTHost DOES re-resolve on reload — `_reloadWithShouldRestartSurfaces` calls
92
+ * `_bundleURLProvider()` again — but only through the provider it was handed.
93
+ * `initWithBundleURL:` wraps a constant in a block returning that same constant
94
+ * forever (RCTRootViewFactory.mm), so a host built that way can never see a
95
+ * bundle that did not exist at launch.
96
+ *
97
+ * The symptom is precise and very confusing: the update downloads, verifies,
98
+ * applies, `restartApp()` runs, every OTA metric reports success — and the app
99
+ * comes back on the OLD bundle, while a cold start loads it correctly.
100
+ *
101
+ * Matched on whole-file text, not per line, because these initialisers are
102
+ * routinely wrapped across lines. Only the STATIC forms match:
103
+ * `initWithBundleURLBlock:` / `initWithBundleURLProvider:` / `bundleURLProvider:`
104
+ * are the dynamic ones, and the trailing colon keeps them out.
105
+ */
106
+ function findStaticHostConstruction(iosDir) {
107
+ const hits = [];
108
+ const patterns = [
109
+ /\[\s*\[\s*(?:RCTHost|RCTRootViewFactory|RCTRootViewFactoryConfiguration)\s+alloc\s*\]\s*initWithBundleURL:/g,
110
+ /\b(?:RCTHost|RCTRootViewFactory|RCTRootViewFactoryConfiguration)\s*\(\s*bundleURL\s*:/g,
111
+ ];
112
+ const walk = (dir, depth) => {
113
+ if (depth < 0)
114
+ return;
115
+ let entries;
116
+ try {
117
+ entries = fs.readdirSync(dir, { withFileTypes: true });
118
+ }
119
+ catch {
120
+ return;
121
+ }
122
+ for (const e of entries) {
123
+ const full = path.join(dir, e.name);
124
+ if (e.isDirectory()) {
125
+ // Pods is RN's own source — it legitimately contains both initialisers,
126
+ // and reporting React Native to the user as their bug helps nobody.
127
+ if (['Pods', 'build', 'DerivedData', '.git'].includes(e.name))
128
+ continue;
129
+ if (/\.(xcodeproj|xcworkspace|framework|xcframework)$/.test(e.name))
130
+ continue;
131
+ walk(full, depth - 1);
132
+ continue;
133
+ }
134
+ if (!/\.(swift|m|mm)$/.test(e.name))
135
+ continue;
136
+ let src;
137
+ try {
138
+ src = fs.readFileSync(full, 'utf8');
139
+ }
140
+ catch {
141
+ continue;
142
+ }
143
+ for (const re of patterns) {
144
+ re.lastIndex = 0;
145
+ let m;
146
+ while ((m = re.exec(src)) !== null) {
147
+ const line = src.slice(0, m.index).split('\n').length;
148
+ hits.push({
149
+ file: full,
150
+ line,
151
+ text: (src.split('\n')[line - 1] ?? '').trim(),
152
+ });
153
+ }
154
+ }
155
+ }
156
+ };
157
+ walk(iosDir, 5);
158
+ return hits;
159
+ }
160
+ /**
161
+ * The public half of the local signing key, as the hex the SDK wants.
162
+ *
163
+ * ed25519 SPKI is a fixed 12-byte header followed by the 32-byte key, so the
164
+ * raw value is the tail. Returns null rather than throwing: a key file that
165
+ * cannot be parsed is worth reporting as "pin your key" with a placeholder,
166
+ * not as a crashed doctor.
167
+ */
168
+ function derivePublicKeyHex(privateKeyPath) {
169
+ try {
170
+ const priv = crypto.createPrivateKey(fs.readFileSync(privateKeyPath));
171
+ const der = crypto.createPublicKey(priv).export({ type: 'spki', format: 'der' });
172
+ return Buffer.from(der.subarray(der.length - 32)).toString('hex');
173
+ }
174
+ catch {
175
+ return null;
176
+ }
177
+ }
178
+ /**
179
+ * Does this project pin a signing key anywhere the SDK would read?
180
+ *
181
+ * Deliberately a text search across config and source rather than an attempt to
182
+ * resolve the app's real init call: the key can legitimately arrive from
183
+ * app.json, an Expo config plugin, a native constant or a JS literal, and a
184
+ * check that only understood one of those would report a false alarm for every
185
+ * app that chose another. A mention is enough to stop nagging; the warning's
186
+ * job is to catch the app that has never heard of the setting.
187
+ */
188
+ function pinsSigningKey(cwd) {
189
+ const needle = /publicSigningKeys?\s*[:=]/;
190
+ const roots = ['app.json', 'app.config.js', 'app.config.ts', 'scalebun.json', 'src', 'app'];
191
+ const seen = (dir, depth) => {
192
+ if (depth < 0)
193
+ return false;
194
+ let entries;
195
+ try {
196
+ entries = fs.readdirSync(dir, { withFileTypes: true });
197
+ }
198
+ catch {
199
+ return false;
200
+ }
201
+ for (const e of entries) {
202
+ const full = path.join(dir, e.name);
203
+ if (e.isFile() && /\.(ts|tsx|js|jsx|json|kt|java|swift|m|mm)$/.test(e.name)) {
204
+ try {
205
+ if (needle.test(fs.readFileSync(full, 'utf8')))
206
+ return true;
207
+ }
208
+ catch {
209
+ /* unreadable file proves nothing */
210
+ }
211
+ }
212
+ else if (e.isDirectory() && !['node_modules', 'Pods', 'build', '.git'].includes(e.name)) {
213
+ if (seen(full, depth - 1))
214
+ return true;
215
+ }
216
+ }
217
+ return false;
218
+ };
219
+ for (const r of roots) {
220
+ const full = path.join(cwd, r);
221
+ if (!fs.existsSync(full))
222
+ continue;
223
+ if (fs.statSync(full).isDirectory()) {
224
+ if (seen(full, 4))
225
+ return true;
226
+ }
227
+ else {
228
+ try {
229
+ if (needle.test(fs.readFileSync(full, 'utf8')))
230
+ return true;
231
+ }
232
+ catch {
233
+ /* ignore */
234
+ }
235
+ }
236
+ }
237
+ // Native config counts too — that is in fact the RIGHT place for it.
238
+ for (const nat of ['android/app/src/main', 'ios']) {
239
+ const full = path.join(cwd, nat);
240
+ if (fs.existsSync(full) && seen(full, 5))
241
+ return true;
242
+ }
243
+ return false;
244
+ }
245
+ function parseMinor(version) {
246
+ if (!version)
247
+ return null;
248
+ const m = /^(\d+)\.(\d+)/.exec(version);
249
+ return m ? [Number(m[1]), Number(m[2])] : null;
250
+ }
251
+ function registerDoctorCommand(program) {
252
+ program
253
+ .command('doctor')
254
+ .description('Check that this project is correctly set up for OTA updates')
255
+ .option('--json', 'Machine-readable findings; exit 3 when a check blocks')
256
+ .action(() => runDoctor());
257
+ }
258
+ /**
259
+ * All doctor checks as a reusable step (`quickstart` runs it inline).
260
+ * Same contract as the command: exits the process on a blocking failure.
261
+ */
262
+ async function runDoctor() {
263
+ findings.length = 0; // reusable across calls in one process
264
+ {
265
+ const cwd = process.cwd();
266
+ // Guarded: a banner on stdout ahead of the JSON body makes the whole
267
+ // document unparseable, which is the usual way --json ships broken.
268
+ if (!(0, output_1.isJson)())
269
+ console.log('\nScalebun doctor\n');
270
+ // ── 1. Credentials ─────────────────────────────────────────────────────
271
+ const creds = (0, credentials_1.readCredentials)();
272
+ if (!creds) {
273
+ report('fail', 'Not logged in', 'Run `scalebun login`, or set SCALEBUN_TOKEN + SCALEBUN_API_URL in CI.');
274
+ }
275
+ else {
276
+ const source = process.env.SCALEBUN_TOKEN || process.env.SCALEBUN_API_TOKEN
277
+ ? 'environment variables'
278
+ : '~/.scalebun/credentials.json';
279
+ if (creds.token.startsWith('scalebun_pat_')) {
280
+ report('ok', `Credentials found (${source}, durable access token)`);
281
+ }
282
+ else {
283
+ report('warn', `Credentials found (${source}) but the token is a session JWT`, 'Session tokens expire in ~15 minutes. Run `scalebun login` again — it now mints\n' +
284
+ 'a durable access token automatically.');
285
+ }
286
+ try {
287
+ const me = await new client_1.ApiClient(creds).get('/auth/me');
288
+ report('ok', `Token valid — authenticated as ${me.email}`);
289
+ }
290
+ catch (err) {
291
+ report('fail', 'Stored token no longer works', err.message);
292
+ }
293
+ }
294
+ // ── 2. Project shape ───────────────────────────────────────────────────
295
+ const rnVersion = (0, bundle_1.detectProjectRnVersion)(cwd);
296
+ const expo = (0, bundle_1.isExpoProject)(cwd);
297
+ if (!rnVersion) {
298
+ report('fail', 'React Native not found in node_modules', 'Run this from your app root, after installing dependencies.');
299
+ }
300
+ else {
301
+ report('ok', `React Native ${rnVersion} (${expo ? 'Expo' : 'bare'} project)`);
302
+ }
303
+ const hermesc = (0, bundle_1.resolveHermesc)(cwd);
304
+ if (hermesc) {
305
+ report('ok', `hermesc found — \`--hermes\` publishes will compile bytecode`, hermesc);
306
+ }
307
+ else if (rnVersion) {
308
+ // Name every place that was searched. The old message named only the
309
+ // prebuilt path, which on RN 0.87 does not exist at all — so it read as
310
+ // "your install is broken" when the binary had simply moved into the
311
+ // hermes-engine pod and `pod install` had not been run.
312
+ report('warn', 'hermesc not found — searched every known location', (0, bundle_1.hermescCandidates)(cwd)
313
+ .map((c) => ` · ${c}`)
314
+ .join('\n') +
315
+ '\n\nOn RN 0.87+ hermesc ships in the hermes-engine pod: run `pod install`\n' +
316
+ 'in ios/, or set HERMES_CLI_PATH to your binary.\n' +
317
+ 'Without it, publishes fall back to plain JS: they work, but cold start is\n' +
318
+ '~20-30% slower, Hermes-bytecode runtime gating cannot protect these bundles,\n' +
319
+ 'and delta patching breaks (plain JS cannot diff against a bytecode base).');
320
+ }
321
+ // ── 3. Android wiring ──────────────────────────────────────────────────
322
+ const gradleProps = path.join(cwd, 'android', 'gradle.properties');
323
+ const mainApp = findFile(path.join(cwd, 'android', 'app', 'src', 'main'), [
324
+ 'MainApplication.kt',
325
+ 'MainApplication.java',
326
+ ]);
327
+ const minor = parseMinor(rnVersion);
328
+ if (!fs.existsSync(path.join(cwd, 'android'))) {
329
+ report('warn', 'No android/ directory — skipping Android checks');
330
+ }
331
+ else {
332
+ const newArch = fs.existsSync(gradleProps) &&
333
+ /newArchEnabled\s*=\s*true/.test(fs.readFileSync(gradleProps, 'utf-8'));
334
+ // The dead zone: bridgeless ignored getJSBundleFile() until RN 0.76.1.
335
+ // An update installs, reports INSTALLED, and the app keeps running the
336
+ // APK asset — the exact failure that killed CodePush on modern RN.
337
+ if (newArch && minor && (minor[1] === 74 || minor[1] === 75) && minor[0] === 0) {
338
+ report('fail', `New Architecture is ON with React Native ${rnVersion} — OTA updates CANNOT LOAD`, 'Bridgeless did not honour getJSBundleFile() until RN 0.76.1. Updates will\n' +
339
+ 'install and silently never run (the SDK detects this and disables itself).\n' +
340
+ 'Fix: upgrade to RN >= 0.76.1, or set newArchEnabled=false.');
341
+ }
342
+ else if (newArch && rnVersion?.startsWith('0.76.0')) {
343
+ report('fail', 'React Native 0.76.0 exactly — one patch release short of the bridgeless fix', 'Upgrade to 0.76.1 or later.');
344
+ }
345
+ if (!mainApp) {
346
+ report('warn', 'MainApplication.kt/.java not found — cannot verify Android wiring');
347
+ }
348
+ else {
349
+ const src = fs.readFileSync(mainApp, 'utf-8');
350
+ const wired = src.includes('ScaleBunOtaModule.getJSBundleFile');
351
+ const rel = path.relative(cwd, mainApp);
352
+ if (!wired) {
353
+ report('fail', `Android bundle resolution is NOT wired (${rel})`, 'Without it, updates download and install but the app keeps running the bundle\n' +
354
+ 'baked into the APK — every metric reports success and nothing changes.\n' +
355
+ (minor && (minor[0] > 0 || minor[1] >= 82)
356
+ ? 'RN >= 0.82 (ReactNativeHost was removed) — pass the path to the host:\n' +
357
+ ' override val reactHost: ReactHost by lazy {\n' +
358
+ ' getDefaultReactHost(context = applicationContext,\n' +
359
+ ' packageList = PackageList(this).packages,\n' +
360
+ ' jsBundleFilePath = ScaleBunOtaModule.getJSBundleFile(applicationContext))\n' +
361
+ ' }'
362
+ : 'Add inside your ReactNativeHost:\n' +
363
+ ' override fun getJSBundleFile(): String? =\n' +
364
+ ' ScaleBunOtaModule.getJSBundleFile(this@MainApplication) ?: super.getJSBundleFile()'));
365
+ }
366
+ else if (minor &&
367
+ (minor[0] > 0 || minor[1] >= 82) &&
368
+ !src.includes('jsBundleFilePath')) {
369
+ report('fail', `RN ${rnVersion} uses the removed ReactNativeHost override (${rel})`, 'RN 0.82 deleted ReactNativeHost — the getJSBundleFile() override no longer\n' +
370
+ 'compiles or runs. Pass jsBundleFilePath to getDefaultReactHost(...) instead.');
371
+ }
372
+ else {
373
+ report('ok', `Android bundle resolution wired (${rel})`);
374
+ }
375
+ }
376
+ }
377
+ // ── 4. iOS wiring ──────────────────────────────────────────────────────
378
+ if (!fs.existsSync(path.join(cwd, 'ios'))) {
379
+ report('warn', 'No ios/ directory — skipping iOS checks');
380
+ }
381
+ else {
382
+ const appDelegate = findFile(path.join(cwd, 'ios'), [
383
+ 'AppDelegate.swift',
384
+ 'AppDelegate.mm',
385
+ 'AppDelegate.m',
386
+ ]);
387
+ if (!appDelegate) {
388
+ report('warn', 'AppDelegate not found — cannot verify iOS wiring');
389
+ }
390
+ else {
391
+ const src = fs.readFileSync(appDelegate, 'utf-8');
392
+ const rel = path.relative(cwd, appDelegate);
393
+ if (src.includes('ScaleBunOtaModule.getBundleURL') || src.includes('getBundleURL()')) {
394
+ report('ok', `iOS bundle resolution wired (${rel})`);
395
+ }
396
+ else {
397
+ report('fail', `iOS bundle resolution is NOT wired (${rel})`, 'Override bundleURL to resolve the OTA slot:\n' +
398
+ ' override func bundleURL() -> URL? {\n' +
399
+ ' #if DEBUG\n' +
400
+ ' RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")\n' +
401
+ ' #else\n' +
402
+ ' ScaleBunOtaModule.getBundleURL()\n' +
403
+ ' #endif\n' +
404
+ ' }');
405
+ }
406
+ }
407
+ // A wired bundleURL is necessary but NOT sufficient: it only runs again
408
+ // if the host asks again. This is the "update installs, restart does
409
+ // nothing, cold start works" report, and it is invisible from JS —
410
+ // download, verify, apply and restart all succeed.
411
+ const staticHost = findStaticHostConstruction(path.join(cwd, 'ios'));
412
+ if (staticHost.length) {
413
+ report('fail', 'React host is built with a STATIC bundle URL — restarts will not load an update', staticHost
414
+ .map((h) => ` · ${path.relative(cwd, h.file)}:${h.line} ${h.text}`)
415
+ .join('\n') +
416
+ '\n\ninitWithBundleURL: captures the URL once and wraps it in a block that returns\n' +
417
+ 'that same URL forever, so the host can never see a bundle installed later.\n' +
418
+ 'The update downloads, verifies, applies and reports success, restartApp()\n' +
419
+ 'runs — and the app comes back on the OLD bundle. A cold start loads it fine,\n' +
420
+ 'which is what makes this so hard to place.\n\n' +
421
+ 'Fix: hand the host a provider that is CALLED on every reload.\n' +
422
+ ' ObjC: [[RCTHost alloc] initWithBundleURLProvider:^{ return [self bundleURL]; }\n' +
423
+ ' Swift: RCTHost(bundleURLProvider: { self.bundleURL() }, ...)\n\n' +
424
+ 'Or drop the custom host entirely — RCTAppDelegate / RCTReactNativeFactory\n' +
425
+ 'already build one from a block that calls your bundleURL override each time.');
426
+ }
427
+ }
428
+ // ── 5. Signing ─────────────────────────────────────────────────────────
429
+ const keyPath = path.join(cwd, '.scalebun', 'ota-signing-key.pem');
430
+ if (fs.existsSync(keyPath)) {
431
+ // "Publishes are signed" was true and misleading. Signing has two
432
+ // halves and this only ever checked the first: the CLI signs, the
433
+ // server stores and serves the signature — and the device accepts the
434
+ // bundle on SHA-256 alone unless the app pins the public key. An
435
+ // unpinned app gets integrity (the bytes arrived intact) and no
436
+ // authenticity (they came from you), which is the difference between a
437
+ // corrupted download and a substituted one.
438
+ //
439
+ // Reported here because this is the only place that can see both the
440
+ // key and the app source, and because a green tick claiming a security
441
+ // property the device never enforces is worse than no check at all.
442
+ // The trusted key under SB-OTA-RSA-SHA256-V1 lives in a NATIVE asset, not
443
+ // in JS config. `publicSigningKey` in init is the ed25519-era shape and is
444
+ // ignored by the RSA runtime, so checking for it reported a security
445
+ // property that no longer exists. What matters now is whether the app
446
+ // actually ships android/app/src/main/assets/scalebun_ota_keys.json —
447
+ // because an EMPTY key registry is exactly what leaves native staging
448
+ // unenforced, and it fails silently.
449
+ const assetPath = path.join(cwd, 'android', 'app', 'src', 'main', 'assets', 'scalebun_ota_keys.json');
450
+ const strayResRaw = path.join(cwd, 'android', 'app', 'src', 'main', 'res', 'raw', 'scalebun_ota_keys.json');
451
+ if (fs.existsSync(assetPath)) {
452
+ let embeddedKeyIds = [];
453
+ let embeddedProject = '';
454
+ let parseError = '';
455
+ try {
456
+ const parsed = JSON.parse(fs.readFileSync(assetPath, 'utf8'));
457
+ embeddedProject = String(parsed.projectId ?? '');
458
+ embeddedKeyIds = Array.isArray(parsed.keys)
459
+ ? parsed.keys.map((k) => String(k.keyId ?? '')).filter(Boolean)
460
+ : [];
461
+ }
462
+ catch (e) {
463
+ parseError = e?.message ?? 'unparseable';
464
+ }
465
+ if (parseError) {
466
+ report('fail', 'scalebun_ota_keys.json is present but not valid JSON', 'The native registry cannot parse it, so it loads NO trusted keys, which leaves\n' +
467
+ 'signature enforcement off entirely. Parser said: ' + parseError);
468
+ }
469
+ else if (embeddedKeyIds.length === 0) {
470
+ report('fail', 'scalebun_ota_keys.json contains no keys', 'An empty registry is treated as "no trusted keys", which leaves native staging\n' +
471
+ 'UNENFORCED. Re-embed the public half of your signing key.');
472
+ }
473
+ else {
474
+ report('ok', 'Trusted key embedded natively (' + embeddedKeyIds.join(', ') + ') — the device enforces signatures');
475
+ if (!embeddedProject) {
476
+ report('warn', 'Embedded key file has no projectId', 'The verifier binds each release to a project id; without one that check\n' +
477
+ 'cannot run and cross-project replay is not detected.');
478
+ }
479
+ // A single trusted key makes rotation a store release.
480
+ //
481
+ // Trust only ever changes at store speed: the anchor is compiled in, so
482
+ // a key the binary does not already carry cannot be added over the air.
483
+ // With one key there is no second key to switch TO — rotating, or
484
+ // recovering from a leak, means shipping a native build and waiting for
485
+ // adoption, signing with the old key the whole time. Carry an unused
486
+ // standby and rotation becomes a one-line change instead.
487
+ //
488
+ // TlsPinning enforces exactly this for certificate pins (MIN_PINS = 2,
489
+ // 'that a routine key rotation will detonate'). Signing keys have the
490
+ // identical failure mode.
491
+ if (embeddedKeyIds.length < 2) {
492
+ report('warn', 'Only one signing key is trusted — rotation will need a store release', 'The anchor is compiled into the binary, so a new key cannot be delivered over' +
493
+ '\nthe air. Embed a second, UNUSED standby key now: to rotate later you simply' +
494
+ '\nstart signing with it, because devices already trust it. Keep the standby' +
495
+ '\nprivate key offline and do not register it until you need it.');
496
+ }
497
+ }
498
+ }
499
+ else if (fs.existsSync(strayResRaw)) {
500
+ report('fail', 'Trusted key is in res/raw/ — the SDK reads assets/ and will never find it', 'ScaleBunOtaKeyRegistry loads the file with context.assets.open(), so a copy in\n' +
501
+ 'res/raw is invisible to it: the registry stays empty and signature enforcement\n' +
502
+ 'is silently OFF. Move it:\n' +
503
+ ' android/app/src/main/res/raw/scalebun_ota_keys.json\n' +
504
+ ' -> android/app/src/main/assets/scalebun_ota_keys.json');
505
+ }
506
+ else {
507
+ report('warn', 'No trusted key embedded — the device cannot verify who signed an update', 'Bundles may be signed, but nothing on the device checks the signature, so a\n' +
508
+ 'substituted bundle is indistinguishable from yours. Embed the PUBLIC key at\n' +
509
+ ' android/app/src/main/assets/scalebun_ota_keys.json');
510
+ }
511
+ const gitignore = path.join(cwd, '.gitignore');
512
+ const ignored = fs.existsSync(gitignore) && /(^|\n)\s*\.scalebun\/?\s*(\n|$)/.test(fs.readFileSync(gitignore, 'utf-8'));
513
+ if (!ignored) {
514
+ report('fail', '.scalebun/ is NOT in .gitignore — the private signing key can be committed', 'Anyone with this key can sign bundles your users will trust.\n' +
515
+ 'Fix: echo ".scalebun/" >> .gitignore (and rotate the key if it was ever pushed)');
516
+ }
517
+ }
518
+ else {
519
+ report('warn', 'No signing key — bundles ship on SHA-256 integrity alone', 'Integrity proves bytes arrived intact; only a signature proves they came from you.\n' +
520
+ 'Set up: scalebun ota generate-key-pair --app-id <id> --name "release key"');
521
+ }
522
+ // ── Summary ────────────────────────────────────────────────────────────
523
+ const fails = findings.filter((f) => f.level === 'fail').length;
524
+ const warns = findings.filter((f) => f.level === 'warn').length;
525
+ // Machine mode: the findings ARE the output, and a blocking failure is a
526
+ // deliberate gate (exit 3) rather than a usage error (exit 1). That is
527
+ // the distinction a CI job needs — "your project is not OTA-ready" and
528
+ // "you typed the command wrong" want opposite responses.
529
+ if ((0, output_1.isJson)()) {
530
+ (0, output_1.emit)(() => { }, {
531
+ ok: fails === 0,
532
+ blocking: fails,
533
+ warnings: warns,
534
+ findings,
535
+ });
536
+ if (fails > 0)
537
+ process.exit(output_1.ExitCode.Gate);
538
+ return;
539
+ }
540
+ console.log('');
541
+ if (fails > 0) {
542
+ console.log(`${fails} blocking issue(s), ${warns} warning(s). Fix the ❌ items before shipping OTA.`);
543
+ process.exit(output_1.ExitCode.Gate);
544
+ }
545
+ console.log(warns > 0
546
+ ? `No blocking issues (${warns} warning(s)). You can ship OTA updates.`
547
+ : 'All checks passed. You can ship OTA updates.');
548
+ // "You can ship OTA updates" and then no way to. The signing-key warning
549
+ // is the one worth acting on before the first release, so offer it when
550
+ // that is what the warning was about.
551
+ (0, output_1.printNextSteps)([
552
+ { label: 'Ship an update', argv: ['ota', 'publish'] },
553
+ ...(findings.some((f) => f.title.startsWith('No signing key'))
554
+ ? [{ label: 'Sign your bundles', argv: ['ota', 'generate-key-pair'] }]
555
+ : []),
556
+ ], chalk_1.default.cyan);
557
+ }
558
+ }
559
+ //# sourceMappingURL=doctor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoFA,gEAmDC;AAmFD,sDAMC;AAMD,8BA6XC;AAnmBD,uCAAyB;AACzB,+CAAiC;AACjC,2CAA6B;AAE7B,kDAA0B;AAC1B,4CAAyE;AACzE,sDAAuD;AACvD,0CAA0C;AAC1C,4CAKyB;AAoBzB,MAAM,QAAQ,GAAc,EAAE,CAAC;AAE/B,SAAS,MAAM,CAAC,KAAY,EAAE,KAAa,EAAE,MAAe;IAC1D,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;IACxC,6EAA6E;IAC7E,4DAA4D;IAC5D,IAAI,IAAA,eAAM,GAAE;QAAE,OAAO;IACrB,MAAM,IAAI,GAAG,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC;IACnE,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,IAAI,KAAK,EAAE,CAAC,CAAC;IAChC,IAAI,MAAM;QAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;AACxE,CAAC;AAED,gFAAgF;AAChF,SAAS,QAAQ,CAAC,GAAW,EAAE,KAAe,EAAE,QAAQ,GAAG,CAAC;IAC1D,IAAI,QAAQ,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,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AAQ,EAAE,KAAK;gBACf,QAAQ;aACT,CACF,CAAC;YACF,IAAI,KAAK,GAAG,CAAC;gBAAE,OAAO,CAAC,IAAI,CAAC,iBAAQ,CAAC,IAAI,CAAC,CAAC;YAC3C,OAAO;QACT,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;YACd,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,uBAAuB,KAAK,mDAAmD,CAAC,CAAC;YACrG,OAAO,CAAC,IAAI,CAAC,iBAAQ,CAAC,IAAI,CAAC,CAAC;QAC9B,CAAC;QACD,OAAO,CAAC,GAAG,CACT,KAAK,GAAG,CAAC;YACP,CAAC,CAAC,uBAAuB,KAAK,yCAAyC;YACvE,CAAC,CAAC,8CAA8C,CACnD,CAAC;QACF,yEAAyE;QACzE,wEAAwE;QACxE,sCAAsC;QACtC,IAAA,uBAAc,EACZ;YACE,EAAE,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE;YACrD,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC;gBAC5D,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,mBAAmB,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,mBAAmB,CAAC,EAAE,CAAC;gBACtE,CAAC,CAAC,EAAE,CAAC;SACR,EACD,eAAK,CAAC,IAAI,CACX,CAAC;IACN,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerLaunchCommand(program: Command): void;
3
+ //# sourceMappingURL=launch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"launch.d.ts","sourceRoot":"","sources":["../../src/commands/launch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAe5D"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerLaunchCommand = registerLaunchCommand;
4
+ const child_process_1 = require("child_process");
5
+ function registerLaunchCommand(program) {
6
+ program
7
+ .command('launch')
8
+ .alias('window')
9
+ .description('Open Scalebun CLI in a standalone external terminal window')
10
+ .action(() => {
11
+ console.log('🚀 Opening Scalebun CLI in an external terminal window…');
12
+ if (process.platform === 'win32') {
13
+ (0, child_process_1.exec)('start powershell.exe -NoExit -Command "scalebun"');
14
+ }
15
+ else if (process.platform === 'darwin') {
16
+ (0, child_process_1.exec)('osascript -e \'tell application "Terminal" to do script "scalebun"\'');
17
+ }
18
+ else {
19
+ (0, child_process_1.exec)('x-terminal-emulator -e scalebun');
20
+ }
21
+ });
22
+ }
23
+ //# sourceMappingURL=launch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"launch.js","sourceRoot":"","sources":["../../src/commands/launch.ts"],"names":[],"mappings":";;AAGA,sDAeC;AAjBD,iDAAqC;AAErC,SAAgB,qBAAqB,CAAC,OAAgB;IACpD,OAAO;SACJ,OAAO,CAAC,QAAQ,CAAC;SACjB,KAAK,CAAC,QAAQ,CAAC;SACf,WAAW,CAAC,4DAA4D,CAAC;SACzE,MAAM,CAAC,GAAG,EAAE;QACX,OAAO,CAAC,GAAG,CAAC,yDAAyD,CAAC,CAAC;QACvE,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;YACjC,IAAA,oBAAI,EAAC,kDAAkD,CAAC,CAAC;QAC3D,CAAC;aAAM,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;YACzC,IAAA,oBAAI,EAAC,sEAAsE,CAAC,CAAC;QAC/E,CAAC;aAAM,CAAC;YACN,IAAA,oBAAI,EAAC,iCAAiC,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { Command } from 'commander';
2
+ /**
3
+ * `scalebun link` — bind this directory to an app, once.
4
+ *
5
+ * The missing noun. Nine commands hard-required `--app-id <cuid>`, so every
6
+ * 3am invocation began by finding a 25-character id in a browser. Linking
7
+ * writes `scalebun.json` at the project root and the flag disappears from
8
+ * every later command in this tree.
9
+ *
10
+ * `scalebun.json` is COMMITTED, not ignored — an app id is not a secret (it
11
+ * appears in every dashboard URL) and the whole point is that a teammate who
12
+ * clones the repo inherits the binding. The signing key next to it in
13
+ * `.scalebun/` is the secret, and that is gitignored separately.
14
+ */
15
+ export declare function registerLinkCommands(program: Command): void;
16
+ //# sourceMappingURL=link.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../src/commands/link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkBpC;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAuH3D"}