@scalebun/cli 0.1.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 (58) hide show
  1. package/bin/scalebun.js +2 -0
  2. package/lib/api/client.d.ts +21 -0
  3. package/lib/api/client.d.ts.map +1 -0
  4. package/lib/api/client.js +151 -0
  5. package/lib/api/client.js.map +1 -0
  6. package/lib/commands/ci-init.d.ts +9 -0
  7. package/lib/commands/ci-init.d.ts.map +1 -0
  8. package/lib/commands/ci-init.js +100 -0
  9. package/lib/commands/ci-init.js.map +1 -0
  10. package/lib/commands/launch.d.ts +3 -0
  11. package/lib/commands/launch.d.ts.map +1 -0
  12. package/lib/commands/launch.js +23 -0
  13. package/lib/commands/launch.js.map +1 -0
  14. package/lib/commands/login.d.ts +10 -0
  15. package/lib/commands/login.d.ts.map +1 -0
  16. package/lib/commands/login.js +110 -0
  17. package/lib/commands/login.js.map +1 -0
  18. package/lib/commands/migrate-codepush.d.ts +13 -0
  19. package/lib/commands/migrate-codepush.d.ts.map +1 -0
  20. package/lib/commands/migrate-codepush.js +98 -0
  21. package/lib/commands/migrate-codepush.js.map +1 -0
  22. package/lib/commands/ota-bundle.d.ts +9 -0
  23. package/lib/commands/ota-bundle.d.ts.map +1 -0
  24. package/lib/commands/ota-bundle.js +87 -0
  25. package/lib/commands/ota-bundle.js.map +1 -0
  26. package/lib/commands/ota-channels.d.ts +3 -0
  27. package/lib/commands/ota-channels.d.ts.map +1 -0
  28. package/lib/commands/ota-channels.js +39 -0
  29. package/lib/commands/ota-channels.js.map +1 -0
  30. package/lib/commands/ota-delete-bundle.d.ts +3 -0
  31. package/lib/commands/ota-delete-bundle.d.ts.map +1 -0
  32. package/lib/commands/ota-delete-bundle.js +31 -0
  33. package/lib/commands/ota-delete-bundle.js.map +1 -0
  34. package/lib/commands/ota-publish.d.ts +16 -0
  35. package/lib/commands/ota-publish.d.ts.map +1 -0
  36. package/lib/commands/ota-publish.js +223 -0
  37. package/lib/commands/ota-publish.js.map +1 -0
  38. package/lib/index.d.ts +2 -0
  39. package/lib/index.d.ts.map +1 -0
  40. package/lib/index.js +39 -0
  41. package/lib/index.js.map +1 -0
  42. package/lib/utils/bundle.d.ts +37 -0
  43. package/lib/utils/bundle.d.ts.map +1 -0
  44. package/lib/utils/bundle.js +94 -0
  45. package/lib/utils/bundle.js.map +1 -0
  46. package/lib/utils/credentials.d.ts +15 -0
  47. package/lib/utils/credentials.d.ts.map +1 -0
  48. package/lib/utils/credentials.js +83 -0
  49. package/lib/utils/credentials.js.map +1 -0
  50. package/lib/utils/hash.d.ts +3 -0
  51. package/lib/utils/hash.d.ts.map +1 -0
  52. package/lib/utils/hash.js +44 -0
  53. package/lib/utils/hash.js.map +1 -0
  54. package/lib/utils/ui.d.ts +4 -0
  55. package/lib/utils/ui.d.ts.map +1 -0
  56. package/lib/utils/ui.js +51 -0
  57. package/lib/utils/ui.js.map +1 -0
  58. package/package.json +33 -0
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ require('../lib/index.js');
@@ -0,0 +1,21 @@
1
+ import type { Credentials } from '../utils/credentials';
2
+ /**
3
+ * Minimal HTTP client for the Scalebun backend API.
4
+ * Uses PAT-based auth (Authorization: Bearer <token>).
5
+ * No external deps — pure Node stdlib.
6
+ */
7
+ export declare class ApiClient {
8
+ private readonly apiUrl;
9
+ private readonly token;
10
+ constructor(creds: Credentials);
11
+ /** GET request — returns parsed JSON. */
12
+ get<T = unknown>(path: string): Promise<T>;
13
+ /** POST request — sends JSON body, returns parsed JSON. */
14
+ post<T = unknown>(path: string, body?: unknown): Promise<T>;
15
+ /** DELETE request — returns parsed JSON. */
16
+ delete<T = unknown>(path: string): Promise<T>;
17
+ /** Upload raw bytes via PUT to an arbitrary URL (presigned S3/R2). */
18
+ putBytes(url: string, data: Buffer, contentType: string): Promise<void>;
19
+ private request;
20
+ }
21
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD;;;;GAIG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;gBAEnB,KAAK,EAAE,WAAW;IAM9B,yCAAyC;IACnC,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAIhD,2DAA2D;IACrD,IAAI,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAIjE,4CAA4C;IACtC,MAAM,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAInD,sEAAsE;IAChE,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YA6C/D,OAAO;CA0DtB"}
@@ -0,0 +1,151 @@
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.ApiClient = void 0;
37
+ const https = __importStar(require("https"));
38
+ const http = __importStar(require("http"));
39
+ /**
40
+ * Minimal HTTP client for the Scalebun backend API.
41
+ * Uses PAT-based auth (Authorization: Bearer <token>).
42
+ * No external deps — pure Node stdlib.
43
+ */
44
+ class ApiClient {
45
+ constructor(creds) {
46
+ // Strip trailing slash
47
+ this.apiUrl = creds.apiUrl.replace(/\/+$/, '');
48
+ this.token = creds.token;
49
+ }
50
+ /** GET request — returns parsed JSON. */
51
+ async get(path) {
52
+ return this.request('GET', path);
53
+ }
54
+ /** POST request — sends JSON body, returns parsed JSON. */
55
+ async post(path, body) {
56
+ return this.request('POST', path, body);
57
+ }
58
+ /** DELETE request — returns parsed JSON. */
59
+ async delete(path) {
60
+ return this.request('DELETE', path);
61
+ }
62
+ /** Upload raw bytes via PUT to an arbitrary URL (presigned S3/R2). */
63
+ async putBytes(url, data, contentType) {
64
+ return new Promise((resolve, reject) => {
65
+ const parsed = new URL(url);
66
+ const transport = parsed.protocol === 'https:' ? https : http;
67
+ const req = transport.request({
68
+ hostname: parsed.hostname,
69
+ port: parsed.port || undefined,
70
+ path: parsed.pathname + parsed.search,
71
+ method: 'PUT',
72
+ headers: {
73
+ 'Content-Type': contentType,
74
+ 'Content-Length': data.length,
75
+ },
76
+ timeout: 600000, // 10 minutes
77
+ }, (res) => {
78
+ const chunks = [];
79
+ res.on('data', (c) => chunks.push(c));
80
+ res.on('end', () => {
81
+ if (res.statusCode && res.statusCode >= 200 && res.statusCode < 300) {
82
+ resolve();
83
+ }
84
+ else {
85
+ const body = Buffer.concat(chunks).toString('utf-8');
86
+ reject(new Error(`Upload failed (HTTP ${res.statusCode}): ${body.slice(0, 500)}`));
87
+ }
88
+ });
89
+ });
90
+ req.on('error', reject);
91
+ req.on('timeout', () => {
92
+ req.destroy();
93
+ reject(new Error('Upload timed out after 10 minutes'));
94
+ });
95
+ req.write(data);
96
+ req.end();
97
+ });
98
+ }
99
+ async request(method, path, body) {
100
+ return new Promise((resolve, reject) => {
101
+ const fullUrl = `${this.apiUrl}${path}`;
102
+ const parsed = new URL(fullUrl);
103
+ const transport = parsed.protocol === 'https:' ? https : http;
104
+ const headers = {
105
+ Authorization: `Bearer ${this.token}`,
106
+ Accept: 'application/json',
107
+ };
108
+ let payload;
109
+ if (body !== undefined) {
110
+ payload = JSON.stringify(body);
111
+ headers['Content-Type'] = 'application/json';
112
+ headers['Content-Length'] = String(Buffer.byteLength(payload));
113
+ }
114
+ const req = transport.request({
115
+ hostname: parsed.hostname,
116
+ port: parsed.port || undefined,
117
+ path: parsed.pathname + parsed.search,
118
+ method,
119
+ headers,
120
+ timeout: 30000,
121
+ }, (res) => {
122
+ const chunks = [];
123
+ res.on('data', (c) => chunks.push(c));
124
+ res.on('end', () => {
125
+ const raw = Buffer.concat(chunks).toString('utf-8');
126
+ if (res.statusCode && res.statusCode >= 200 && res.statusCode < 300) {
127
+ try {
128
+ resolve(JSON.parse(raw));
129
+ }
130
+ catch {
131
+ resolve(raw);
132
+ }
133
+ }
134
+ else {
135
+ reject(new Error(`API error (HTTP ${res.statusCode}): ${raw.slice(0, 500)}`));
136
+ }
137
+ });
138
+ });
139
+ req.on('error', reject);
140
+ req.on('timeout', () => {
141
+ req.destroy();
142
+ reject(new Error('Request timed out'));
143
+ });
144
+ if (payload)
145
+ req.write(payload);
146
+ req.end();
147
+ });
148
+ }
149
+ }
150
+ exports.ApiClient = ApiClient;
151
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA+B;AAC/B,2CAA6B;AAG7B;;;;GAIG;AACH,MAAa,SAAS;IAIpB,YAAY,KAAkB;QAC5B,uBAAuB;QACvB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IAC3B,CAAC;IAED,yCAAyC;IACzC,KAAK,CAAC,GAAG,CAAc,IAAY;QACjC,OAAO,IAAI,CAAC,OAAO,CAAI,KAAK,EAAE,IAAI,CAAC,CAAC;IACtC,CAAC;IAED,2DAA2D;IAC3D,KAAK,CAAC,IAAI,CAAc,IAAY,EAAE,IAAc;QAClD,OAAO,IAAI,CAAC,OAAO,CAAI,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAC7C,CAAC;IAED,4CAA4C;IAC5C,KAAK,CAAC,MAAM,CAAc,IAAY;QACpC,OAAO,IAAI,CAAC,OAAO,CAAI,QAAQ,EAAE,IAAI,CAAC,CAAC;IACzC,CAAC;IAED,sEAAsE;IACtE,KAAK,CAAC,QAAQ,CAAC,GAAW,EAAE,IAAY,EAAE,WAAmB;QAC3D,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;YAC5B,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;YAE9D,MAAM,GAAG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0,0 +1,9 @@
1
+ import { Command } from 'commander';
2
+ /**
3
+ * `scalebun ci init` — Sprint 12 (S12-CLI-1).
4
+ *
5
+ * Generates copy-paste CI/CD workflows for GitHub Actions, Bitrise, or CircleCI:
6
+ * npx scalebun ci init --provider github
7
+ */
8
+ export declare function registerCiInitCommand(program: Command): void;
9
+ //# sourceMappingURL=ci-init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ci-init.d.ts","sourceRoot":"","sources":["../../src/commands/ci-init.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkCpC;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA0B5D"}
@@ -0,0 +1,100 @@
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.registerCiInitCommand = registerCiInitCommand;
37
+ const fs = __importStar(require("fs"));
38
+ const path = __importStar(require("path"));
39
+ const GITHUB_ACTIONS_WORKFLOW = `name: Scalebun OTA Publish
40
+
41
+ on:
42
+ push:
43
+ branches: [ main, production ]
44
+
45
+ jobs:
46
+ publish-ota:
47
+ runs-on: ubuntu-latest
48
+ steps:
49
+ - uses: actions/checkout@v4
50
+
51
+ - name: Setup Node.js
52
+ uses: actions/setup-node@v4
53
+ with:
54
+ node-version: 20
55
+
56
+ - name: Install dependencies
57
+ run: npm ci
58
+
59
+ - name: Publish OTA Update to Scalebun
60
+ env:
61
+ SCALEBUN_TOKEN: \${{ secrets.SCALEBUN_TOKEN }}
62
+ run: |
63
+ npx scalebun ota publish \\
64
+ --app-id \${{ secrets.SCALEBUN_APP_ID }} \\
65
+ --channel production \\
66
+ --platform android \\
67
+ --hermes \\
68
+ --sourcemap
69
+ `;
70
+ /**
71
+ * `scalebun ci init` — Sprint 12 (S12-CLI-1).
72
+ *
73
+ * Generates copy-paste CI/CD workflows for GitHub Actions, Bitrise, or CircleCI:
74
+ * npx scalebun ci init --provider github
75
+ */
76
+ function registerCiInitCommand(program) {
77
+ const ci = program.command('ci').description('CI/CD integration setup');
78
+ ci.command('init')
79
+ .description('Generate CI/CD pipeline configs for OTA publishing')
80
+ .option('--provider <name>', 'CI provider: github | bitrise | circleci', 'github')
81
+ .action((opts) => {
82
+ const provider = opts.provider.toLowerCase();
83
+ if (provider === 'github') {
84
+ const targetDir = path.join(process.cwd(), '.github', 'workflows');
85
+ const targetPath = path.join(targetDir, 'scalebun-ota.yml');
86
+ fs.mkdirSync(targetDir, { recursive: true });
87
+ fs.writeFileSync(targetPath, GITHUB_ACTIONS_WORKFLOW, 'utf-8');
88
+ console.log(`✅ GitHub Actions workflow generated: ${path.relative(process.cwd(), targetPath)}`);
89
+ console.log('\nNext steps:');
90
+ console.log(' 1. Add SCALEBUN_TOKEN and SCALEBUN_APP_ID to your repository secrets.');
91
+ console.log(' 2. Git push to trigger your first automated OTA release!\n');
92
+ }
93
+ else {
94
+ console.log(`ℹ️ Generating ${provider} CI config template:`);
95
+ console.log('\nCommand to add to your CI script:');
96
+ console.log(' npx scalebun ota publish --app-id $SCALEBUN_APP_ID --channel production --hermes --sourcemap\n');
97
+ }
98
+ });
99
+ }
100
+ //# sourceMappingURL=ci-init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ci-init.js","sourceRoot":"","sources":["../../src/commands/ci-init.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,sDA0BC;AApED,uCAAyB;AACzB,2CAA6B;AAG7B,MAAM,uBAAuB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8B/B,CAAC;AAEF;;;;;GAKG;AACH,SAAgB,qBAAqB,CAAC,OAAgB;IACpD,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC;IAExE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,oDAAoD,CAAC;SACjE,MAAM,CAAC,mBAAmB,EAAE,0CAA0C,EAAE,QAAQ,CAAC;SACjF,MAAM,CAAC,CAAC,IAA0B,EAAE,EAAE;QACrC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;QAE7C,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;YAC1B,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;YACnE,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;YAE5D,EAAE,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAC7C,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,uBAAuB,EAAE,OAAO,CAAC,CAAC;YAE/D,OAAO,CAAC,GAAG,CAAC,wCAAwC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC;YAChG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;YAC7B,OAAO,CAAC,GAAG,CAAC,yEAAyE,CAAC,CAAC;YACvF,OAAO,CAAC,GAAG,CAAC,8DAA8D,CAAC,CAAC;QAC9E,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,kBAAkB,QAAQ,sBAAsB,CAAC,CAAC;YAC9D,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;YACnD,OAAO,CAAC,GAAG,CAAC,kGAAkG,CAAC,CAAC;QAClH,CAAC;IACH,CAAC,CAAC,CAAC;AACP,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,10 @@
1
+ import { Command } from 'commander';
2
+ /**
3
+ * `scalebun login` — authenticate via Personal Access Token (PAT).
4
+ *
5
+ * 1. Prompt for backend URL and PAT
6
+ * 2. Validate by calling GET /auth/me
7
+ * 3. Store in ~/.scalebun/credentials.json
8
+ */
9
+ export declare function registerLoginCommand(program: Command): void;
10
+ //# 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;AAKpC;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAuE3D"}
@@ -0,0 +1,110 @@
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.registerLoginCommand = registerLoginCommand;
37
+ const readline = __importStar(require("readline"));
38
+ const credentials_1 = require("../utils/credentials");
39
+ const client_1 = require("../api/client");
40
+ /**
41
+ * `scalebun login` — authenticate via Personal Access Token (PAT).
42
+ *
43
+ * 1. Prompt for backend URL and PAT
44
+ * 2. Validate by calling GET /auth/me
45
+ * 3. Store in ~/.scalebun/credentials.json
46
+ */
47
+ function registerLoginCommand(program) {
48
+ program
49
+ .command('login')
50
+ .description('Authenticate with your Scalebun backend using a PAT')
51
+ .option('--api-url <url>', 'Backend API URL (e.g. https://api.scalebun.com/api/v1)')
52
+ .option('--token <pat>', 'Personal access token (scalebun_pat_…)')
53
+ .action(async (opts) => {
54
+ const rl = readline.createInterface({
55
+ input: process.stdin,
56
+ output: process.stdout,
57
+ });
58
+ const ask = (q) => new Promise((resolve) => rl.question(q, resolve));
59
+ try {
60
+ const existing = (0, credentials_1.readCredentials)();
61
+ const apiUrl = opts.apiUrl ||
62
+ (await ask(`API URL${existing?.apiUrl ? ` [${existing.apiUrl}]` : ''}: `)) ||
63
+ existing?.apiUrl;
64
+ if (!apiUrl) {
65
+ console.error('❌ API URL is required');
66
+ process.exit(1);
67
+ }
68
+ let token = opts.token;
69
+ if (!token) {
70
+ const input = await ask('Email or Token (scalebun_pat_…): ');
71
+ if (!input) {
72
+ console.error('❌ Email or Token is required');
73
+ process.exit(1);
74
+ }
75
+ if (input.includes('@')) {
76
+ const password = await ask('Password: ');
77
+ if (!password) {
78
+ console.error('❌ Password is required');
79
+ process.exit(1);
80
+ }
81
+ console.log(' Logging in with credentials…');
82
+ const unauthClient = new client_1.ApiClient({ apiUrl, token: '' });
83
+ const loginRes = await unauthClient.post('/auth/login', {
84
+ email: input,
85
+ password,
86
+ });
87
+ token = loginRes.accessToken;
88
+ }
89
+ else {
90
+ token = input;
91
+ }
92
+ }
93
+ // Validate the token
94
+ console.log(' Validating token…');
95
+ const client = new client_1.ApiClient({ apiUrl, token });
96
+ const me = await client.get('/auth/me');
97
+ (0, credentials_1.writeCredentials)({ apiUrl, token });
98
+ console.log(`✅ Logged in as ${me.email} (${me.role ?? 'User'})`);
99
+ console.log(` Credentials saved to ~/.scalebun/credentials.json`);
100
+ }
101
+ catch (err) {
102
+ console.error(`❌ Login failed: ${err.message}`);
103
+ process.exit(1);
104
+ }
105
+ finally {
106
+ rl.close();
107
+ }
108
+ });
109
+ }
110
+ //# sourceMappingURL=login.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login.js","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,oDAuEC;AAlFD,mDAAqC;AACrC,sDAAyE;AACzE,0CAA0C;AAE1C;;;;;;GAMG;AACH,SAAgB,oBAAoB,CAAC,OAAgB;IACnD,OAAO;SACJ,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,qDAAqD,CAAC;SAClE,MAAM,CAAC,iBAAiB,EAAE,wDAAwD,CAAC;SACnF,MAAM,CAAC,eAAe,EAAE,wCAAwC,CAAC;SACjE,MAAM,CAAC,KAAK,EAAE,IAAyC,EAAE,EAAE;QAC1D,MAAM,EAAE,GAAG,QAAQ,CAAC,eAAe,CAAC;YAClC,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC,CAAC;QAEH,MAAM,GAAG,GAAG,CAAC,CAAS,EAAmB,EAAE,CACzC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;QAEpD,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,IAAA,6BAAe,GAAE,CAAC;YAEnC,MAAM,MAAM,GACV,IAAI,CAAC,MAAM;gBACX,CAAC,MAAM,GAAG,CACR,UAAU,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,CAC9D,CAAC;gBACF,QAAQ,EAAE,MAAM,CAAC;YAEnB,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,OAAO,CAAC,KAAK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AE,GAAG,MAAM,MAAM,CAAC,GAAG,CAAkC,UAAU,CAAC,CAAC;YAEzE,IAAA,8BAAgB,EAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;YACpC,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,CAAC,KAAK,KAAK,EAAE,CAAC,IAAI,IAAI,MAAM,GAAG,CAAC,CAAC;YACjE,OAAO,CAAC,GAAG,CAAC,sDAAsD,CAAC,CAAC;QACtE,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,OAAO,CAAC,KAAK,CAAC,mBAAmB,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;YAChD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;gBAAS,CAAC;YACT,EAAE,CAAC,KAAK,EAAE,CAAC;QACb,CAAC;IACH,CAAC,CAAC,CAAC;AACP,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,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;YACtD,CAAC;YACD,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;gBAChB,OAAO,CAAC,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,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { Command } from 'commander';
2
+ /**
3
+ * `scalebun ota bundle` — package a standalone bundle file for Dashboard upload.
4
+ *
5
+ * Usage:
6
+ * npx scalebun ota bundle --platform android --output ./my-app.bundle
7
+ */
8
+ export declare function registerOtaBundleCommand(ota: Command): void;
9
+ //# 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":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAqD3D"}