@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,164 @@
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.registerLinkCommands = registerLinkCommands;
40
+ const chalk_1 = __importDefault(require("chalk"));
41
+ const fs = __importStar(require("fs"));
42
+ const path = __importStar(require("path"));
43
+ const client_1 = require("../api/client");
44
+ const credentials_1 = require("../utils/credentials");
45
+ const apps_1 = require("../utils/apps");
46
+ const prompt_1 = require("../utils/prompt");
47
+ const resolve_1 = require("../utils/resolve");
48
+ const output_1 = require("../utils/output");
49
+ const context_1 = require("../utils/context");
50
+ /**
51
+ * `scalebun link` — bind this directory to an app, once.
52
+ *
53
+ * The missing noun. Nine commands hard-required `--app-id <cuid>`, so every
54
+ * 3am invocation began by finding a 25-character id in a browser. Linking
55
+ * writes `scalebun.json` at the project root and the flag disappears from
56
+ * every later command in this tree.
57
+ *
58
+ * `scalebun.json` is COMMITTED, not ignored — an app id is not a secret (it
59
+ * appears in every dashboard URL) and the whole point is that a teammate who
60
+ * clones the repo inherits the binding. The signing key next to it in
61
+ * `.scalebun/` is the secret, and that is gitignored separately.
62
+ */
63
+ function registerLinkCommands(program) {
64
+ program
65
+ .command('link')
66
+ .description('Bind this project to an app so --app-id is never needed again')
67
+ .option('--app-id <id>', 'Skip the picker and link this app')
68
+ .option('--channel <name>', 'Default channel for publish and promote', 'production')
69
+ .option('--json', 'Machine-readable output')
70
+ .action(async (opts) => {
71
+ const creds = (0, credentials_1.readCredentials)();
72
+ if (!creds) {
73
+ (0, output_1.fail)('Not signed in.', ['Run `scalebun login` first.'], output_1.ExitCode.Usage);
74
+ }
75
+ // Link the directory the user is standing in, unless an ancestor is
76
+ // already linked — re-linking a subdirectory of a linked project would
77
+ // create a second, shadowing config nobody asked for.
78
+ const existingRoot = (0, context_1.findProjectRoot)();
79
+ const root = existingRoot ?? process.cwd();
80
+ const existing = (0, context_1.readProjectConfig)(root);
81
+ let entry = null;
82
+ if (!opts.appId) {
83
+ if ((0, resolve_1.isNonInteractive)({ nonInteractive: (0, output_1.isJson)() })) {
84
+ (0, output_1.fail)('--app-id is required.', ['This shell is not interactive, so the app cannot be chosen here.'], output_1.ExitCode.Usage);
85
+ }
86
+ let entries;
87
+ try {
88
+ entries = await (0, apps_1.fetchAllApps)(new client_1.ApiClient(creds));
89
+ }
90
+ catch (err) {
91
+ (0, output_1.failFromError)('Could not list apps', err);
92
+ }
93
+ if (!entries.length) {
94
+ (0, output_1.fail)('This account has no apps yet.', ['Create one in the dashboard, then re-run.'], output_1.ExitCode.Usage);
95
+ }
96
+ if (entries.length === 1) {
97
+ entry = entries[0];
98
+ console.log(chalk_1.default.dim(`Using your only app: ${entry.app.name}`));
99
+ }
100
+ else {
101
+ entry = await (0, prompt_1.select)('Which app should this project use?', entries.map((e) => ({
102
+ label: `${e.app.name} ${chalk_1.default.dim(`${e.orgName} / ${e.projectName}`)}`,
103
+ value: e,
104
+ })));
105
+ (0, prompt_1.closePrompts)();
106
+ }
107
+ }
108
+ const appId = opts.appId ?? entry.app.id;
109
+ const appName = entry?.app.name;
110
+ const saved = (0, context_1.writeProjectConfig)(root, {
111
+ appId,
112
+ ...(appName ? { appName } : {}),
113
+ channel: opts.channel ?? existing?.channel ?? 'production',
114
+ });
115
+ const rel = path.relative(process.cwd(), path.join(root, context_1.PROJECT_FILE)) || context_1.PROJECT_FILE;
116
+ const ctx = (0, context_1.getContext)();
117
+ (0, output_1.emit)(() => {
118
+ console.log('');
119
+ console.log(`šŸ”— Linked to ${chalk_1.default.bold(appName ?? appId)}`);
120
+ console.log(` ${chalk_1.default.dim(rel)}`);
121
+ console.log(` ${chalk_1.default.dim(`channel: ${saved.channel}`)}`);
122
+ console.log('');
123
+ console.log(chalk_1.default.dim(' Commit this file — an app id is not a secret, and a teammate'));
124
+ console.log(chalk_1.default.dim(' who clones the repo inherits the binding.'));
125
+ console.log('');
126
+ // Say what this actually bought, in the terms the user cares about.
127
+ console.log(' --app-id is now optional for every command here.');
128
+ if (!ctx.isNativeProject) {
129
+ console.log(chalk_1.default.dim(' No android/ or ios/ here — run this from your app root to wire OTA too.'));
130
+ (0, output_1.printNextSteps)([{ label: 'Check the project', argv: ['doctor'] }], chalk_1.default.cyan);
131
+ }
132
+ else if (ctx.stage < 3) {
133
+ (0, output_1.printNextSteps)([
134
+ { label: 'Wire the native side', argv: ['init', ctx.platforms[0]] },
135
+ { label: 'Check what else is needed', argv: ['doctor'] },
136
+ ], chalk_1.default.cyan);
137
+ }
138
+ else {
139
+ (0, output_1.printNextSteps)([
140
+ { label: 'Ship an update', argv: ['ota', 'publish'] },
141
+ { label: 'See what is live', argv: ['ota', 'status'] },
142
+ ], chalk_1.default.cyan);
143
+ }
144
+ }, { ok: true, appId, appName: appName ?? null, channel: saved.channel, file: path.join(root, context_1.PROJECT_FILE) });
145
+ });
146
+ program
147
+ .command('unlink')
148
+ .description('Remove the app binding from this project')
149
+ .action(() => {
150
+ const root = (0, context_1.findProjectRoot)();
151
+ if (!root) {
152
+ (0, output_1.fail)('This directory is not linked.', ['Nothing to remove.'], output_1.ExitCode.Usage);
153
+ }
154
+ const file = path.join(root, context_1.PROJECT_FILE);
155
+ try {
156
+ fs.unlinkSync(file);
157
+ }
158
+ catch (err) {
159
+ (0, output_1.fail)(`Could not remove ${file}: ${err?.message ?? err}`, [], output_1.ExitCode.Usage);
160
+ }
161
+ console.log(`šŸ”— Unlinked. Removed ${chalk_1.default.dim(file)}`);
162
+ });
163
+ }
164
+ //# sourceMappingURL=link.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link.js","sourceRoot":"","sources":["../../src/commands/link.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,oDAuHC;AArJD,kDAA0B;AAC1B,uCAAyB;AACzB,2CAA6B;AAC7B,0CAA0C;AAC1C,sDAAuD;AACvD,wCAAuD;AACvD,4CAAuD;AACvD,8CA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AI,CAAC;YACH,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACtB,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,IAAA,aAAI,EAAC,oBAAoB,IAAI,KAAK,GAAG,EAAE,OAAO,IAAI,GAAG,EAAE,EAAE,EAAE,EAAE,iBAAQ,CAAC,KAAK,CAAC,CAAC;QAC/E,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,wBAAwB,eAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerLoginCommand(program: Command): void;
3
+ export interface LoginOptions {
4
+ apiUrl?: string;
5
+ token?: string;
6
+ }
7
+ /**
8
+ * The token login flow as a reusable step (`quickstart` runs it inline when no
9
+ * credentials are stored). Exits the process on failure.
10
+ */
11
+ export declare function runLogin(opts: LoginOptions): Promise<void>;
12
+ //# sourceMappingURL=login.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAiCpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAoB3D;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAkFhE"}
@@ -0,0 +1,124 @@
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
+ exports.registerLoginCommand = registerLoginCommand;
7
+ exports.runLogin = runLogin;
8
+ const credentials_1 = require("../utils/credentials");
9
+ const client_1 = require("../api/client");
10
+ const transportSecurity_1 = require("../utils/transportSecurity");
11
+ const prompt_1 = require("../utils/prompt");
12
+ const output_1 = require("../utils/output");
13
+ const chalk_1 = __importDefault(require("chalk"));
14
+ /**
15
+ * `scalebun login` — store a durable access token for this machine.
16
+ *
17
+ * ── Why token-only ──────────────────────────────────────────────────────────
18
+ *
19
+ * Login used to accept email/password, exchange them for a ~15-minute session
20
+ * JWT, and then spend that JWT minting a personal access token. All of that
21
+ * machinery existed only to end up with a PAT — the durable, scoped, revocable
22
+ * credential the rest of the CLI actually uses. Pasting the PAT directly removes
23
+ * the whole exchange, and with it: JWT-expiry surprises, a password on the wire
24
+ * (and in shell history), and the MFA dead-end where the interactive flow simply
25
+ * could not complete.
26
+ *
27
+ * The API URL is implicit — it defaults to the hosted backend
28
+ * (DEFAULT_API_URL). Override it with --api-url or SCALEBUN_API_URL only for
29
+ * self-hosted / staging / local development.
30
+ */
31
+ const TOKEN_PAGE = 'https://dash.scalebun.com/settings/access-tokens';
32
+ function registerLoginCommand(program) {
33
+ program
34
+ .command('login')
35
+ .description('Authenticate with your Scalebun backend (paste an access token)')
36
+ .option('--api-url <url>', `Backend API URL (default: ${credentials_1.DEFAULT_API_URL}; override for self-hosted/staging/local)`)
37
+ .option('--token <pat>', 'Personal access token (scalebun_pat_…) — skips the prompt')
38
+ .action((opts) => runLogin(opts));
39
+ program
40
+ .command('logout')
41
+ .description('Remove stored credentials from this machine')
42
+ .action(() => {
43
+ (0, credentials_1.clearCredentials)();
44
+ console.log('āœ… Logged out. (The token still exists server-side — revoke it in the dashboard if this machine is compromised.)');
45
+ });
46
+ }
47
+ /**
48
+ * The token login flow as a reusable step (`quickstart` runs it inline when no
49
+ * credentials are stored). Exits the process on failure.
50
+ */
51
+ async function runLogin(opts) {
52
+ const existing = (0, credentials_1.readCredentials)();
53
+ // API URL resolution: explicit flag > env > previous login > hosted default.
54
+ const apiUrl = opts.apiUrl ||
55
+ process.env.SCALEBUN_API_URL ||
56
+ existing?.apiUrl ||
57
+ credentials_1.DEFAULT_API_URL;
58
+ // Refuse a plaintext endpoint before a token is asked for or sent. The API
59
+ // client enforces the same rule; failing here keeps the token off the wire.
60
+ try {
61
+ (0, transportSecurity_1.assertSecureApiUrl)(apiUrl);
62
+ }
63
+ catch (err) {
64
+ console.error(`āŒ ${err.message}`);
65
+ process.exit(1);
66
+ }
67
+ // Token resolution: flag > env > interactive masked paste.
68
+ let token = opts.token || process.env.SCALEBUN_TOKEN;
69
+ if (!token) {
70
+ if (!(0, prompt_1.canPromptHidden)()) {
71
+ console.error('āŒ No access token provided and no interactive terminal to paste into.');
72
+ console.error(` Pass --token scalebun_pat_… or set SCALEBUN_TOKEN.`);
73
+ console.error(` Create a token at: ${TOKEN_PAGE}`);
74
+ process.exit(1);
75
+ }
76
+ console.log('');
77
+ console.log('Paste your ScaleBun access token to authenticate this machine.');
78
+ console.log(`Create one at: ${TOKEN_PAGE}`);
79
+ console.log('(Settings → Access Tokens → New token → scope: read, write)');
80
+ console.log('');
81
+ // Re-ask rather than exit. A paste that did not land — the clipboard was
82
+ // empty, or the terminal swallowed it — is the single most likely reason
83
+ // this prompt comes back blank, and the fix is to paste again, not to
84
+ // re-run the whole command. Three tries, so a non-interactive stdin that
85
+ // returns '' forever cannot spin.
86
+ for (let attempt = 1;; attempt++) {
87
+ token = (await (0, prompt_1.promptHidden)('Access token (scalebun_pat_…): ')).trim();
88
+ if (token)
89
+ break;
90
+ if (attempt >= 3) {
91
+ console.error('āŒ No token entered.');
92
+ console.error(` Create one at ${TOKEN_PAGE}, or set SCALEBUN_TOKEN.`);
93
+ process.exit(1);
94
+ }
95
+ console.log(' Nothing pasted — the token is hidden as you type, so a blank line');
96
+ console.log(' usually means the paste did not land. Try again.');
97
+ }
98
+ }
99
+ // Soft format check — warn, don't reject (the token prefix may evolve).
100
+ if (!token.startsWith('scalebun_pat_')) {
101
+ console.warn("āš ļø That doesn't look like a scalebun_pat_… token — continuing anyway.");
102
+ }
103
+ console.log(' Validating token…');
104
+ try {
105
+ const client = new client_1.ApiClient({ apiUrl, token });
106
+ const me = await client.get('/auth/me');
107
+ (0, credentials_1.writeCredentials)({ apiUrl, token, email: me.email });
108
+ console.log(`āœ… Logged in as ${me.email} (${me.role ?? 'User'})`);
109
+ console.log(' Credentials saved to ~/.scalebun/credentials.json');
110
+ // `--app-id <id>` was load-bearing here before `link` and the resolver
111
+ // existed. Suggesting a command with a placeholder in it is suggesting
112
+ // homework, not a command — and `link` is what removes the need for it.
113
+ (0, output_1.printNextSteps)([
114
+ { label: 'Bind this project', argv: ['link'] },
115
+ { label: 'Check it is OTA-ready', argv: ['doctor'] },
116
+ { label: 'Ship your first update', argv: ['ota', 'publish'] },
117
+ ], chalk_1.default.cyan);
118
+ }
119
+ catch (err) {
120
+ console.error(`āŒ Login failed: ${err.message}`);
121
+ process.exit(1);
122
+ }
123
+ }
124
+ //# sourceMappingURL=login.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login.js","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":";;;;;AAiCA,oDAoBC;AAWD,4BAkFC;AAjJD,sDAK8B;AAC9B,0CAA0C;AAC1C,kEAAgE;AAChE,4CAAgE;AAChE,4CAAiD;AACjD,kDAA0B;AAE1B;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,UAAU,GAAG,kDAAkD,CAAC;AAEtE,SAAgB,oBAAoB,CAAC,OAAgB;IACnD,OAAO;SACJ,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,iEAAiE,CAAC;SAC9E,MAAM,CACL,iBAAiB,EACjB,6BAA6B,6BAAe,2CAA2C,CACxF;SACA,MAAM,CAAC,eAAe,EAAE,2DAA2D,CAAC;SACpF,MAAM,CAAC,CAAC,IAAkB,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IAElD,OAAO;SACJ,OAAO,CAAC,Q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AO,CAAC,GAAG,CAAC,kBAAkB,EAAE,CAAC,KAAK,KAAK,EAAE,CAAC,IAAI,IAAI,MAAM,GAAG,CAAC,CAAC;QACjE,OAAO,CAAC,GAAG,CAAC,sDAAsD,CAAC,CAAC;QACpE,uEAAuE;QACvE,uEAAuE;QACvE,wEAAwE;QACxE,IAAA,uBAAc,EACZ;YACE,EAAE,KAAK,EAAE,mBAAmB,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE;YAC9C,EAAE,KAAK,EAAE,uBAAuB,EAAE,IAAI,EAAE,CAAC,QAAQ,CAAC,EAAE;YACpD,EAAE,KAAK,EAAE,wBAAwB,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE;SAC9D,EACD,eAAK,CAAC,IAAI,CACX,CAAC;IACJ,CAAC;IAAC,OAAO,GAAQ,EAAE,CAAC;QAClB,OAAO,CAAC,KAAK,CAAC,mBAAmB,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;QAChD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { Command } from 'commander';
2
+ /**
3
+ * `scalebun migrate codepush` — Sprint 10 (S10-CLI-1).
4
+ *
5
+ * Automated codemod that scans a React Native project and migrates it from
6
+ * Microsoft CodePush to Scalebun OTA:
7
+ * 1. Scans .js, .jsx, .ts, .tsx files for `react-native-code-push` imports
8
+ * 2. Replaces imports with `@scalebun/react-native/compat/codepush`
9
+ * 3. Replaces `codePush.sync()` calls with `@scalebun/react-native` OTA
10
+ * 4. Prints summary of rewritten files
11
+ */
12
+ export declare function registerMigrateCodepushCommand(migrate: Command): void;
13
+ //# sourceMappingURL=migrate-codepush.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrate-codepush.d.ts","sourceRoot":"","sources":["../../src/commands/migrate-codepush.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;;;;;;;;GASG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA8BrE"}
@@ -0,0 +1,98 @@
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.registerMigrateCodepushCommand = registerMigrateCodepushCommand;
37
+ const fs = __importStar(require("fs"));
38
+ const path = __importStar(require("path"));
39
+ /**
40
+ * `scalebun migrate codepush` — Sprint 10 (S10-CLI-1).
41
+ *
42
+ * Automated codemod that scans a React Native project and migrates it from
43
+ * Microsoft CodePush to Scalebun OTA:
44
+ * 1. Scans .js, .jsx, .ts, .tsx files for `react-native-code-push` imports
45
+ * 2. Replaces imports with `@scalebun/react-native/compat/codepush`
46
+ * 3. Replaces `codePush.sync()` calls with `@scalebun/react-native` OTA
47
+ * 4. Prints summary of rewritten files
48
+ */
49
+ function registerMigrateCodepushCommand(migrate) {
50
+ migrate
51
+ .command('codepush')
52
+ .description('Migrate a React Native project from Microsoft CodePush to Scalebun OTA')
53
+ .option('--dir <path>', 'Root directory of the React Native project', '.')
54
+ .option('--dry-run', 'Show files that would be modified without writing changes')
55
+ .action((opts) => {
56
+ const rootDir = path.resolve(opts.dir);
57
+ console.log(`šŸš€ Scanning for CodePush usages in: ${rootDir}…\n`);
58
+ const modifiedFiles = [];
59
+ scanAndMigrate(rootDir, opts.dryRun ?? false, modifiedFiles);
60
+ console.log('\n--- Migration Summary ---');
61
+ if (modifiedFiles.length === 0) {
62
+ console.log('✨ No CodePush imports found. Project is ready or already using Scalebun!');
63
+ }
64
+ else {
65
+ console.log(`āœ… Migrated ${modifiedFiles.length} file(s):`);
66
+ for (const file of modifiedFiles) {
67
+ console.log(` - ${path.relative(rootDir, file)}`);
68
+ }
69
+ if (opts.dryRun) {
70
+ console.log('\n(Dry run complete — no files were modified on disk)');
71
+ }
72
+ else {
73
+ console.log('\nšŸŽ‰ Migration complete! Run `scalebun ota publish` to ship your first Scalebun update.');
74
+ }
75
+ }
76
+ });
77
+ }
78
+ function scanAndMigrate(dir, dryRun, modified) {
79
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
80
+ for (const entry of entries) {
81
+ const fullPath = path.join(dir, entry.name);
82
+ if (entry.isDirectory() &&
83
+ !['node_modules', '.git', 'android', 'ios', 'build', 'dist', '.next'].includes(entry.name)) {
84
+ scanAndMigrate(fullPath, dryRun, modified);
85
+ }
86
+ else if (entry.isFile() && /\.(js|jsx|ts|tsx)$/.test(entry.name)) {
87
+ const content = fs.readFileSync(fullPath, 'utf-8');
88
+ if (content.includes('react-native-code-push')) {
89
+ const updated = content.replace(/['"]react-native-code-push['"]/g, "'@scalebun/react-native/compat/codepush'");
90
+ if (!dryRun) {
91
+ fs.writeFileSync(fullPath, updated, 'utf-8');
92
+ }
93
+ modified.push(fullPath);
94
+ }
95
+ }
96
+ }
97
+ }
98
+ //# sourceMappingURL=migrate-codepush.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrate-codepush.js","sourceRoot":"","sources":["../../src/commands/migrate-codepush.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,wEA8BC;AA5CD,uCAAyB;AACzB,2CAA6B;AAG7B;;;;;;;;;GASG;AACH,SAAgB,8BAA8B,CAAC,OAAgB;IAC7D,OAAO;SACJ,OAAO,CAAC,UAAU,CAAC;SACnB,WAAW,CAAC,wEAAwE,CAAC;SACrF,MAAM,CAAC,cAAc,EAAE,4CAA4C,EAAE,GAAG,CAAC;SACzE,MAAM,CAAC,WAAW,EAAE,2DAA2D,CAAC;SAChF,MAAM,CAAC,CAAC,IAAuC,EAAE,EAAE;QAClD,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACvC,OAAO,CAAC,GAAG,CAAC,uCAAuC,OAAO,KAAK,CAAC,CAAC;QAEjE,MAAM,aAAa,GAAa,EAAE,CAAC;QACnC,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,IAAI,KAAK,EAAE,aAAa,CAAC,CAAC;QAE7D,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;QAC3C,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC/B,OAAO,CAAC,GAAG,CAAC,0EAA0E,CAAC,CAAC;QAC1F,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,cAAc,aAAa,CAAC,MAAM,WAAW,CAAC,CAAC;YAC3D,KAAK,MAAM,IAAI,IAAI,aAAa,EAAE,CAAC;gBACjC,OAAO,CAAC,GAAG,CAAC,QAAQ,IA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EAAE,CAAC;oBACZ,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;gBAC/C,CAAC;gBACD,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { Command } from 'commander';
2
+ /**
3
+ * `scalebun ota bundle build` — package a standalone bundle file for upload.
4
+ *
5
+ * ── Why this is `bundle build` and not `bundle` ────────────────────────────
6
+ *
7
+ * `ota bundles` (plural) lists what is on the server; `ota bundle` (singular)
8
+ * ran Metro and hermesc and wrote a file to disk. Two commands one character
9
+ * apart doing entirely different things is a footgun: reaching for the list
10
+ * and getting a full Hermes compile is a minute of confusion at best, and at
11
+ * worst it happens in a pipeline.
12
+ *
13
+ * Moving the builder under an explicit verb makes bare `ota bundle` print the
14
+ * group's help — which disambiguates instead of guessing. `bundle` is kept as
15
+ * an alias of the group, so nothing that already worked stops working.
16
+ *
17
+ * Usage:
18
+ * npx scalebun ota bundle build --platform android
19
+ * npx scalebun ota bundle build --platform ios --output ./bundles/my-app.bundle
20
+ */
21
+ export declare function registerOtaBundleCommand(ota: Command): void;
22
+ //# sourceMappingURL=ota-bundle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ota-bundle.d.ts","sourceRoot":"","sources":["../../src/commands/ota-bundle.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAwFpC;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAuJ3D"}