@scalebun/cli 1.10.2 → 1.12.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.
- package/lib/commands/ci-init.d.ts.map +1 -1
- package/lib/commands/ci-init.js +80 -2
- package/lib/commands/ci-init.js.map +1 -1
- package/lib/commands/doctor.d.ts.map +1 -1
- package/lib/commands/doctor.js +148 -3
- package/lib/commands/doctor.js.map +1 -1
- package/lib/commands/link.d.ts +16 -0
- package/lib/commands/link.d.ts.map +1 -0
- package/lib/commands/link.js +164 -0
- package/lib/commands/link.js.map +1 -0
- package/lib/commands/login.d.ts.map +1 -1
- package/lib/commands/login.js +29 -7
- package/lib/commands/login.js.map +1 -1
- package/lib/commands/ota-bundle.d.ts +15 -2
- package/lib/commands/ota-bundle.d.ts.map +1 -1
- package/lib/commands/ota-bundle.js +142 -12
- package/lib/commands/ota-bundle.js.map +1 -1
- package/lib/commands/ota-channels.d.ts.map +1 -1
- package/lib/commands/ota-channels.js +213 -21
- package/lib/commands/ota-channels.js.map +1 -1
- package/lib/commands/ota-delete-bundle.d.ts.map +1 -1
- package/lib/commands/ota-delete-bundle.js +15 -4
- package/lib/commands/ota-delete-bundle.js.map +1 -1
- package/lib/commands/ota-inspect.d.ts +3 -0
- package/lib/commands/ota-inspect.d.ts.map +1 -0
- package/lib/commands/ota-inspect.js +258 -0
- package/lib/commands/ota-inspect.js.map +1 -0
- package/lib/commands/ota-keys.d.ts +25 -0
- package/lib/commands/ota-keys.d.ts.map +1 -1
- package/lib/commands/ota-keys.js +329 -27
- package/lib/commands/ota-keys.js.map +1 -1
- package/lib/commands/ota-promote.d.ts +3 -0
- package/lib/commands/ota-promote.d.ts.map +1 -0
- package/lib/commands/ota-promote.js +194 -0
- package/lib/commands/ota-promote.js.map +1 -0
- package/lib/commands/ota-publish.d.ts.map +1 -1
- package/lib/commands/ota-publish.js +108 -38
- package/lib/commands/ota-publish.js.map +1 -1
- package/lib/commands/ota-rollout.d.ts.map +1 -1
- package/lib/commands/ota-rollout.js +212 -171
- package/lib/commands/ota-rollout.js.map +1 -1
- package/lib/commands/quickstart.d.ts.map +1 -1
- package/lib/commands/quickstart.js +110 -8
- package/lib/commands/quickstart.js.map +1 -1
- package/lib/commands/shell.d.ts +28 -0
- package/lib/commands/shell.d.ts.map +1 -0
- package/lib/commands/shell.js +512 -0
- package/lib/commands/shell.js.map +1 -0
- package/lib/index.js +140 -4
- package/lib/index.js.map +1 -1
- package/lib/ui/menu.d.ts +109 -0
- package/lib/ui/menu.d.ts.map +1 -0
- package/lib/ui/menu.js +314 -0
- package/lib/ui/menu.js.map +1 -0
- package/lib/utils/bundle.d.ts.map +1 -1
- package/lib/utils/bundle.js +7 -1
- package/lib/utils/bundle.js.map +1 -1
- package/lib/utils/context.d.ts +88 -0
- package/lib/utils/context.d.ts.map +1 -0
- package/lib/utils/context.js +247 -0
- package/lib/utils/context.js.map +1 -0
- package/lib/utils/credentials.d.ts +16 -0
- package/lib/utils/credentials.d.ts.map +1 -1
- package/lib/utils/credentials.js +14 -3
- package/lib/utils/credentials.js.map +1 -1
- package/lib/utils/guide.d.ts +63 -0
- package/lib/utils/guide.d.ts.map +1 -0
- package/lib/utils/guide.js +189 -0
- package/lib/utils/guide.js.map +1 -0
- package/lib/utils/output.d.ts +96 -0
- package/lib/utils/output.d.ts.map +1 -0
- package/lib/utils/output.js +135 -0
- package/lib/utils/output.js.map +1 -0
- package/lib/utils/prompt.d.ts +109 -6
- package/lib/utils/prompt.d.ts.map +1 -1
- package/lib/utils/prompt.js +222 -20
- package/lib/utils/prompt.js.map +1 -1
- package/lib/utils/provenance.d.ts +30 -0
- package/lib/utils/provenance.d.ts.map +1 -0
- package/lib/utils/provenance.js +157 -0
- package/lib/utils/provenance.js.map +1 -0
- package/lib/utils/resolve.d.ts +81 -0
- package/lib/utils/resolve.d.ts.map +1 -0
- package/lib/utils/resolve.js +139 -0
- package/lib/utils/resolve.js.map +1 -0
- package/lib/utils/sdkBin.d.ts +18 -0
- package/lib/utils/sdkBin.d.ts.map +1 -0
- package/lib/utils/sdkBin.js +76 -0
- package/lib/utils/sdkBin.js.map +1 -0
- package/lib/utils/ui.d.ts +10 -1
- package/lib/utils/ui.d.ts.map +1 -1
- package/lib/utils/ui.js +18 -57
- package/lib/utils/ui.js.map +1 -1
- package/lib/utils/validate.d.ts +62 -0
- package/lib/utils/validate.d.ts.map +1 -0
- package/lib/utils/validate.js +189 -0
- package/lib/utils/validate.js.map +1 -0
- package/package.json +3 -2
package/lib/utils/bundle.js
CHANGED
|
@@ -288,7 +288,13 @@ function buildBundle(opts) {
|
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
290
|
else {
|
|
291
|
-
|
|
291
|
+
// Reached only when the caller explicitly opted out — every command
|
|
292
|
+
// defaults to bytecode. The old text ("Use --hermes for bytecode
|
|
293
|
+
// compilation") described a default that no longer exists and read as
|
|
294
|
+
// though plain JS were normal.
|
|
295
|
+
console.log(' ℹ️ Shipping plain JS — Hermes was disabled for this build.');
|
|
296
|
+
console.log(' Cold start is ~20-30% slower, and delta patches against a');
|
|
297
|
+
console.log(' previous bytecode release collapse to a full download.');
|
|
292
298
|
}
|
|
293
299
|
// Read the format back off the artifact rather than trusting the flag. When
|
|
294
300
|
// hermesc fails we fall back to plain JS, and recording `hermes: true` anyway
|
package/lib/utils/bundle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.js","sourceRoot":"","sources":["../../src/utils/bundle.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyFA,8DAoBC;AAeD,wCAkBC;AAGD,wDASC;AAmBD,sCAeC;AAED,
|
|
1
|
+
{"version":3,"file":"bundle.js","sourceRoot":"","sources":["../../src/utils/bundle.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyFA,8DAoBC;AAeD,wCAkBC;AAGD,wDASC;AAmBD,sCAeC;AAED,kCA2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,CAAC,CAAC;IACF,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACf,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project identity and onboarding stage — the one module the resolver, the
|
|
3
|
+
* splash and the shell all read.
|
|
4
|
+
*
|
|
5
|
+
* ── The problem this solves ─────────────────────────────────────────────────
|
|
6
|
+
*
|
|
7
|
+
* The CLI had no noun for "the project you are working on". Nine commands
|
|
8
|
+
* hard-required `--app-id <uuid>`, there was no config file, no
|
|
9
|
+
* `SCALEBUN_APP_ID`, and one credentials file with no notion of which app it
|
|
10
|
+
* belonged to. Every command therefore started by pasting a 25-character id
|
|
11
|
+
* copied out of a browser.
|
|
12
|
+
*
|
|
13
|
+
* ── Derive, never store ─────────────────────────────────────────────────────
|
|
14
|
+
*
|
|
15
|
+
* The onboarding stage below is DERIVED from facts on disk, not recorded as
|
|
16
|
+
* progress flags. A stored "user finished quickstart" bit lies the moment
|
|
17
|
+
* reality moves: a new machine loses it, a deleted key contradicts it, and an
|
|
18
|
+
* experienced developer opening a brand-new repo gets told they are an expert
|
|
19
|
+
* exactly when they need the wiring steps. Deriving costs a few `existsSync`
|
|
20
|
+
* calls, is always true, and is naturally per-project — which is the right
|
|
21
|
+
* granularity, because expertise does not transfer between checkouts.
|
|
22
|
+
*
|
|
23
|
+
* Everything here is SYNCHRONOUS and LOCAL. The splash renders on every bare
|
|
24
|
+
* invocation, so a network call in this path would tax every single run.
|
|
25
|
+
*/
|
|
26
|
+
/** Written by `scalebun link`. Lives at the project root, beside package.json. */
|
|
27
|
+
export declare const PROJECT_FILE = "scalebun.json";
|
|
28
|
+
export interface ProjectConfig {
|
|
29
|
+
/** The app every command in this directory defaults to. */
|
|
30
|
+
appId?: string;
|
|
31
|
+
/** Human label, cached so the prompt can say "WZB Pay" not a cuid. */
|
|
32
|
+
appName?: string;
|
|
33
|
+
/** Channel default for publish/promote. */
|
|
34
|
+
channel?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Last known release count for this app. A CACHE, not a progress flag: it is
|
|
37
|
+
* refreshed by any command that happens to fetch releases and self-corrects
|
|
38
|
+
* on the next one. Absent simply means "not seen yet".
|
|
39
|
+
*/
|
|
40
|
+
releaseCount?: number;
|
|
41
|
+
}
|
|
42
|
+
export type Stage = 0 | 1 | 2 | 3 | 4;
|
|
43
|
+
export interface Context {
|
|
44
|
+
/** 0 fresh · 1 signed in · 2 bound · 3 wired · 4 operating */
|
|
45
|
+
stage: Stage;
|
|
46
|
+
loggedIn: boolean;
|
|
47
|
+
email?: string;
|
|
48
|
+
/** Resolved app id, from flag > env > scalebun.json. Not from the network. */
|
|
49
|
+
appId?: string;
|
|
50
|
+
appName?: string;
|
|
51
|
+
channel?: string;
|
|
52
|
+
/** Directory holding scalebun.json, or null when this is not a linked project. */
|
|
53
|
+
projectRoot: string | null;
|
|
54
|
+
/** True when an android/ or ios/ directory exists here. */
|
|
55
|
+
isNativeProject: boolean;
|
|
56
|
+
platforms: Array<'android' | 'ios'>;
|
|
57
|
+
/** Per-platform OTA wiring, from the same greps `doctor` performs. */
|
|
58
|
+
wired: {
|
|
59
|
+
android: boolean | null;
|
|
60
|
+
ios: boolean | null;
|
|
61
|
+
};
|
|
62
|
+
/** True when a signing key exists locally. */
|
|
63
|
+
hasSigningKey: boolean;
|
|
64
|
+
releaseCount: number | null;
|
|
65
|
+
}
|
|
66
|
+
/** Walk up from `cwd` looking for scalebun.json. Stops at the filesystem root. */
|
|
67
|
+
export declare function findProjectRoot(cwd?: string): string | null;
|
|
68
|
+
/** Read scalebun.json from `root`, or null when absent/corrupt. */
|
|
69
|
+
export declare function readProjectConfig(root: string | null): ProjectConfig | null;
|
|
70
|
+
/** Write scalebun.json, merging over whatever is already there. */
|
|
71
|
+
export declare function writeProjectConfig(root: string, patch: ProjectConfig): ProjectConfig;
|
|
72
|
+
/**
|
|
73
|
+
* Record the release count seen by a command that already fetched releases.
|
|
74
|
+
* Best-effort: a read-only checkout must not fail a command over a cache write.
|
|
75
|
+
*/
|
|
76
|
+
export declare function cacheReleaseCount(count: number, cwd?: string): void;
|
|
77
|
+
/**
|
|
78
|
+
* Build the context for the current directory.
|
|
79
|
+
*
|
|
80
|
+
* @param opts.appId an explicit `--app-id` flag, which always wins.
|
|
81
|
+
*/
|
|
82
|
+
export declare function getContext(opts?: {
|
|
83
|
+
appId?: string;
|
|
84
|
+
cwd?: string;
|
|
85
|
+
}): Context;
|
|
86
|
+
/** One-line label for the shell prompt and the splash: "WZB Pay/production". */
|
|
87
|
+
export declare function contextLabel(ctx: Context): string | null;
|
|
88
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/utils/context.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,kFAAkF;AAClF,eAAO,MAAM,YAAY,kBAAkB,CAAC;AAE5C,MAAM,WAAW,aAAa;IAC5B,2DAA2D;IAC3D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,MAAM,KAAK,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEtC,MAAM,WAAW,OAAO;IACtB,8DAA8D;IAC9D,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8EAA8E;IAC9E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kFAAkF;IAClF,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,2DAA2D;IAC3D,eAAe,EAAE,OAAO,CAAC;IACzB,SAAS,EAAE,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,CAAC;IACpC,sEAAsE;IACtE,KAAK,EAAE;QAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;QAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAAA;KAAE,CAAC;IACxD,8CAA8C;IAC9C,aAAa,EAAE,OAAO,CAAC;IACvB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,kFAAkF;AAClF,wBAAgB,eAAe,CAAC,GAAG,GAAE,MAAsB,GAAG,MAAM,GAAG,IAAI,CAU1E;AAED,mEAAmE;AACnE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,aAAa,GAAG,IAAI,CAY3E;AAED,mEAAmE;AACnE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,GAAG,aAAa,CAQpF;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,GAAE,MAAsB,GAAG,IAAI,CAQlF;AA6DD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CA2C/E;AAED,gFAAgF;AAChF,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAIxD"}
|
|
@@ -0,0 +1,247 @@
|
|
|
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.PROJECT_FILE = void 0;
|
|
37
|
+
exports.findProjectRoot = findProjectRoot;
|
|
38
|
+
exports.readProjectConfig = readProjectConfig;
|
|
39
|
+
exports.writeProjectConfig = writeProjectConfig;
|
|
40
|
+
exports.cacheReleaseCount = cacheReleaseCount;
|
|
41
|
+
exports.getContext = getContext;
|
|
42
|
+
exports.contextLabel = contextLabel;
|
|
43
|
+
const fs = __importStar(require("fs"));
|
|
44
|
+
const path = __importStar(require("path"));
|
|
45
|
+
const credentials_1 = require("./credentials");
|
|
46
|
+
/**
|
|
47
|
+
* Project identity and onboarding stage — the one module the resolver, the
|
|
48
|
+
* splash and the shell all read.
|
|
49
|
+
*
|
|
50
|
+
* ── The problem this solves ─────────────────────────────────────────────────
|
|
51
|
+
*
|
|
52
|
+
* The CLI had no noun for "the project you are working on". Nine commands
|
|
53
|
+
* hard-required `--app-id <uuid>`, there was no config file, no
|
|
54
|
+
* `SCALEBUN_APP_ID`, and one credentials file with no notion of which app it
|
|
55
|
+
* belonged to. Every command therefore started by pasting a 25-character id
|
|
56
|
+
* copied out of a browser.
|
|
57
|
+
*
|
|
58
|
+
* ── Derive, never store ─────────────────────────────────────────────────────
|
|
59
|
+
*
|
|
60
|
+
* The onboarding stage below is DERIVED from facts on disk, not recorded as
|
|
61
|
+
* progress flags. A stored "user finished quickstart" bit lies the moment
|
|
62
|
+
* reality moves: a new machine loses it, a deleted key contradicts it, and an
|
|
63
|
+
* experienced developer opening a brand-new repo gets told they are an expert
|
|
64
|
+
* exactly when they need the wiring steps. Deriving costs a few `existsSync`
|
|
65
|
+
* calls, is always true, and is naturally per-project — which is the right
|
|
66
|
+
* granularity, because expertise does not transfer between checkouts.
|
|
67
|
+
*
|
|
68
|
+
* Everything here is SYNCHRONOUS and LOCAL. The splash renders on every bare
|
|
69
|
+
* invocation, so a network call in this path would tax every single run.
|
|
70
|
+
*/
|
|
71
|
+
/** Written by `scalebun link`. Lives at the project root, beside package.json. */
|
|
72
|
+
exports.PROJECT_FILE = 'scalebun.json';
|
|
73
|
+
/** Walk up from `cwd` looking for scalebun.json. Stops at the filesystem root. */
|
|
74
|
+
function findProjectRoot(cwd = process.cwd()) {
|
|
75
|
+
let dir = path.resolve(cwd);
|
|
76
|
+
// Bounded by the root check below; a symlink loop cannot spin here because
|
|
77
|
+
// path.dirname always shortens or returns the same string at the root.
|
|
78
|
+
for (;;) {
|
|
79
|
+
if (fs.existsSync(path.join(dir, exports.PROJECT_FILE)))
|
|
80
|
+
return dir;
|
|
81
|
+
const parent = path.dirname(dir);
|
|
82
|
+
if (parent === dir)
|
|
83
|
+
return null;
|
|
84
|
+
dir = parent;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/** Read scalebun.json from `root`, or null when absent/corrupt. */
|
|
88
|
+
function readProjectConfig(root) {
|
|
89
|
+
if (!root)
|
|
90
|
+
return null;
|
|
91
|
+
try {
|
|
92
|
+
const raw = fs.readFileSync(path.join(root, exports.PROJECT_FILE), 'utf8');
|
|
93
|
+
const parsed = JSON.parse(raw);
|
|
94
|
+
// A hand-edited file that is valid JSON but not an object must not crash
|
|
95
|
+
// every command in the directory.
|
|
96
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed))
|
|
97
|
+
return null;
|
|
98
|
+
return parsed;
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/** Write scalebun.json, merging over whatever is already there. */
|
|
105
|
+
function writeProjectConfig(root, patch) {
|
|
106
|
+
const existing = readProjectConfig(root) ?? {};
|
|
107
|
+
const merged = { ...existing, ...patch };
|
|
108
|
+
fs.writeFileSync(path.join(root, exports.PROJECT_FILE), JSON.stringify(merged, null, 2) + '\n');
|
|
109
|
+
return merged;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Record the release count seen by a command that already fetched releases.
|
|
113
|
+
* Best-effort: a read-only checkout must not fail a command over a cache write.
|
|
114
|
+
*/
|
|
115
|
+
function cacheReleaseCount(count, cwd = process.cwd()) {
|
|
116
|
+
const root = findProjectRoot(cwd);
|
|
117
|
+
if (!root)
|
|
118
|
+
return;
|
|
119
|
+
try {
|
|
120
|
+
writeProjectConfig(root, { releaseCount: count });
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
/* cache only */
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/** Does this native source file already resolve the OTA slot? */
|
|
127
|
+
function greppedWired(file, needle) {
|
|
128
|
+
try {
|
|
129
|
+
return fs.readFileSync(file, 'utf8').includes(needle);
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Android wiring: MainApplication must call ScaleBunOtaModule.getJSBundleFile.
|
|
137
|
+
* Returns null when there is no android/ directory to judge.
|
|
138
|
+
*/
|
|
139
|
+
function androidWired(cwd) {
|
|
140
|
+
const dir = path.join(cwd, 'android');
|
|
141
|
+
if (!fs.existsSync(dir))
|
|
142
|
+
return null;
|
|
143
|
+
const candidates = [
|
|
144
|
+
'app/src/main/java',
|
|
145
|
+
'app/src/main/kotlin',
|
|
146
|
+
].map((p) => path.join(dir, p));
|
|
147
|
+
for (const base of candidates) {
|
|
148
|
+
if (!fs.existsSync(base))
|
|
149
|
+
continue;
|
|
150
|
+
const found = findFile(base, /MainApplication\.(kt|java)$/);
|
|
151
|
+
if (found)
|
|
152
|
+
return greppedWired(found, 'ScaleBunOtaModule.getJSBundleFile');
|
|
153
|
+
}
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
/** iOS wiring: AppDelegate must resolve the slot via getBundleURL. */
|
|
157
|
+
function iosWired(cwd) {
|
|
158
|
+
const dir = path.join(cwd, 'ios');
|
|
159
|
+
if (!fs.existsSync(dir))
|
|
160
|
+
return null;
|
|
161
|
+
const found = findFile(dir, /AppDelegate\.(swift|mm|m)$/, 3);
|
|
162
|
+
return found ? greppedWired(found, 'ScaleBunOtaModule.getBundleURL') : false;
|
|
163
|
+
}
|
|
164
|
+
/** Shallow recursive find, depth-bounded so a huge ios/Pods tree cannot stall the splash. */
|
|
165
|
+
function findFile(dir, re, depth = 6) {
|
|
166
|
+
if (depth < 0)
|
|
167
|
+
return null;
|
|
168
|
+
let entries;
|
|
169
|
+
try {
|
|
170
|
+
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
171
|
+
}
|
|
172
|
+
catch {
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
for (const e of entries) {
|
|
176
|
+
const full = path.join(dir, e.name);
|
|
177
|
+
if (e.isFile() && re.test(e.name))
|
|
178
|
+
return full;
|
|
179
|
+
}
|
|
180
|
+
for (const e of entries) {
|
|
181
|
+
// Pods and build output contain thousands of files and never the app's own
|
|
182
|
+
// AppDelegate — skipping them is what keeps this under a few milliseconds.
|
|
183
|
+
if (!e.isDirectory() || e.name === 'Pods' || e.name === 'build' || e.name === 'node_modules')
|
|
184
|
+
continue;
|
|
185
|
+
const hit = findFile(path.join(dir, e.name), re, depth - 1);
|
|
186
|
+
if (hit)
|
|
187
|
+
return hit;
|
|
188
|
+
}
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Build the context for the current directory.
|
|
193
|
+
*
|
|
194
|
+
* @param opts.appId an explicit `--app-id` flag, which always wins.
|
|
195
|
+
*/
|
|
196
|
+
function getContext(opts = {}) {
|
|
197
|
+
const cwd = opts.cwd ?? process.cwd();
|
|
198
|
+
const creds = (0, credentials_1.readCredentials)();
|
|
199
|
+
const projectRoot = findProjectRoot(cwd);
|
|
200
|
+
const project = readProjectConfig(projectRoot);
|
|
201
|
+
// Resolution order — explicit beats ambient beats stored.
|
|
202
|
+
const appId = opts.appId || process.env.SCALEBUN_APP_ID || project?.appId;
|
|
203
|
+
const platforms = [];
|
|
204
|
+
if (fs.existsSync(path.join(cwd, 'android')))
|
|
205
|
+
platforms.push('android');
|
|
206
|
+
if (fs.existsSync(path.join(cwd, 'ios')))
|
|
207
|
+
platforms.push('ios');
|
|
208
|
+
const wired = { android: androidWired(cwd), ios: iosWired(cwd) };
|
|
209
|
+
const hasSigningKey = fs.existsSync(path.join(cwd, '.scalebun', 'ota-signing-key.pem'));
|
|
210
|
+
const releaseCount = typeof project?.releaseCount === 'number' ? project.releaseCount : null;
|
|
211
|
+
// A project counts as wired when every platform it actually has is wired.
|
|
212
|
+
// An app with only android/ is fully wired once android is — demanding an
|
|
213
|
+
// ios/ directory it does not have would strand it at stage 2 forever.
|
|
214
|
+
const relevant = platforms.map((p) => wired[p]).filter((v) => v !== null);
|
|
215
|
+
const fullyWired = relevant.length > 0 && relevant.every(Boolean);
|
|
216
|
+
let stage = 0;
|
|
217
|
+
if (creds)
|
|
218
|
+
stage = 1;
|
|
219
|
+
if (creds && appId)
|
|
220
|
+
stage = 2;
|
|
221
|
+
if (creds && appId && fullyWired)
|
|
222
|
+
stage = 3;
|
|
223
|
+
if (creds && appId && fullyWired && (releaseCount ?? 0) > 0)
|
|
224
|
+
stage = 4;
|
|
225
|
+
return {
|
|
226
|
+
stage,
|
|
227
|
+
loggedIn: !!creds,
|
|
228
|
+
email: creds?.email,
|
|
229
|
+
appId,
|
|
230
|
+
appName: project?.appName,
|
|
231
|
+
channel: project?.channel,
|
|
232
|
+
projectRoot,
|
|
233
|
+
isNativeProject: platforms.length > 0,
|
|
234
|
+
platforms,
|
|
235
|
+
wired,
|
|
236
|
+
hasSigningKey,
|
|
237
|
+
releaseCount,
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
/** One-line label for the shell prompt and the splash: "WZB Pay/production". */
|
|
241
|
+
function contextLabel(ctx) {
|
|
242
|
+
if (!ctx.appId)
|
|
243
|
+
return null;
|
|
244
|
+
const name = ctx.appName ?? ctx.appId;
|
|
245
|
+
return ctx.channel ? `${name}/${ctx.channel}` : name;
|
|
246
|
+
}
|
|
247
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/utils/context.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwEA,0CAUC;AAGD,8CAYC;AAGD,gDAQC;AAMD,8CAQC;AAkED,gCA2CC;AAGD,oCAIC;AA9OD,uCAAyB;AACzB,2CAA6B;AAC7B,+CAAgD;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;GA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AO,EAAE,OAAO,EAAE,OAAO;QACzB,WAAW;QACX,eAAe,EAAE,SAAS,CAAC,MAAM,GAAG,CAAC;QACrC,SAAS;QACT,KAAK;QACL,aAAa;QACb,YAAY;KACb,CAAC;AACJ,CAAC;AAED,gFAAgF;AAChF,SAAgB,YAAY,CAAC,GAAY;IACvC,IAAI,CAAC,GAAG,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IAC5B,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC;IACtC,OAAO,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACvD,CAAC"}
|
|
@@ -34,6 +34,22 @@ export declare function readCredentials(): Credentials | null;
|
|
|
34
34
|
* world-readable file.
|
|
35
35
|
*/
|
|
36
36
|
export declare function writeCredentials(creds: Credentials): void;
|
|
37
|
+
/**
|
|
38
|
+
* Windows-only ACL tightening: drop inherited ACEs and grant the current user
|
|
39
|
+
* alone full control. On POSIX the file mode already did this and this is a
|
|
40
|
+
* no-op.
|
|
41
|
+
*
|
|
42
|
+
* Exported because the credentials file is not the only secret this CLI writes:
|
|
43
|
+
* `ota generate-key-pair` puts an ed25519 PRIVATE SIGNING KEY on disk, and for
|
|
44
|
+
* a while that file got only the POSIX `mode: 0o600` — which Node silently
|
|
45
|
+
* drops on Windows — while the (less valuable) access token got this full
|
|
46
|
+
* treatment. Every secret the CLI writes must go through here.
|
|
47
|
+
*
|
|
48
|
+
* @param file absolute path of the just-written secret file
|
|
49
|
+
* @param whatItHolds short description used in the failure warning, e.g.
|
|
50
|
+
* "an access token" / "your OTA signing private key"
|
|
51
|
+
*/
|
|
52
|
+
export declare function restrictToCurrentUser(file: string, whatItHolds: string): void;
|
|
37
53
|
/** Delete stored credentials. */
|
|
38
54
|
export declare function clearCredentials(): void;
|
|
39
55
|
//# sourceMappingURL=credentials.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../src/utils/credentials.ts"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,eAAO,MAAM,eAAe,oCAAoC,CAAC;AAEjE,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd;wDACoD;IACpD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,IAAI,WAAW,GAAG,IAAI,CAiBpD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAUzD;
|
|
1
|
+
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../src/utils/credentials.ts"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,eAAO,MAAM,eAAe,oCAAoC,CAAC;AAEjE,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd;wDACoD;IACpD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,IAAI,WAAW,GAAG,IAAI,CAiBpD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAUzD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAuB7E;AAED,iCAAiC;AACjC,wBAAgB,gBAAgB,IAAI,IAAI,CAIvC"}
|
package/lib/utils/credentials.js
CHANGED
|
@@ -36,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.DEFAULT_API_URL = void 0;
|
|
37
37
|
exports.readCredentials = readCredentials;
|
|
38
38
|
exports.writeCredentials = writeCredentials;
|
|
39
|
+
exports.restrictToCurrentUser = restrictToCurrentUser;
|
|
39
40
|
exports.clearCredentials = clearCredentials;
|
|
40
41
|
const fs = __importStar(require("fs"));
|
|
41
42
|
const path = __importStar(require("path"));
|
|
@@ -95,14 +96,24 @@ function writeCredentials(creds) {
|
|
|
95
96
|
fs.mkdirSync(CREDENTIALS_DIR, { recursive: true, mode: 0o700 });
|
|
96
97
|
}
|
|
97
98
|
fs.writeFileSync(CREDENTIALS_FILE, JSON.stringify(creds, null, 2) + '\n', { mode: 0o600 });
|
|
98
|
-
restrictToCurrentUser(CREDENTIALS_FILE);
|
|
99
|
+
restrictToCurrentUser(CREDENTIALS_FILE, 'an access token');
|
|
99
100
|
}
|
|
100
101
|
/**
|
|
101
102
|
* Windows-only ACL tightening: drop inherited ACEs and grant the current user
|
|
102
103
|
* alone full control. On POSIX the file mode already did this and this is a
|
|
103
104
|
* no-op.
|
|
105
|
+
*
|
|
106
|
+
* Exported because the credentials file is not the only secret this CLI writes:
|
|
107
|
+
* `ota generate-key-pair` puts an ed25519 PRIVATE SIGNING KEY on disk, and for
|
|
108
|
+
* a while that file got only the POSIX `mode: 0o600` — which Node silently
|
|
109
|
+
* drops on Windows — while the (less valuable) access token got this full
|
|
110
|
+
* treatment. Every secret the CLI writes must go through here.
|
|
111
|
+
*
|
|
112
|
+
* @param file absolute path of the just-written secret file
|
|
113
|
+
* @param whatItHolds short description used in the failure warning, e.g.
|
|
114
|
+
* "an access token" / "your OTA signing private key"
|
|
104
115
|
*/
|
|
105
|
-
function restrictToCurrentUser(file) {
|
|
116
|
+
function restrictToCurrentUser(file, whatItHolds) {
|
|
106
117
|
if (process.platform !== 'win32')
|
|
107
118
|
return;
|
|
108
119
|
const user = process.env.USERNAME
|
|
@@ -118,7 +129,7 @@ function restrictToCurrentUser(file) {
|
|
|
118
129
|
}
|
|
119
130
|
catch {
|
|
120
131
|
console.warn(`⚠️ Could not restrict permissions on ${file}.\n` +
|
|
121
|
-
|
|
132
|
+
` It contains ${whatItHolds} in plaintext and may be readable by other\n` +
|
|
122
133
|
' accounts on this machine. Fix it with:\n' +
|
|
123
134
|
` icacls "${file}" /inheritance:r /grant:r "%USERNAME%:F"`);
|
|
124
135
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.js","sourceRoot":"","sources":["../../src/utils/credentials.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,0CAiBC;AAcD,4CAUC;
|
|
1
|
+
{"version":3,"file":"credentials.js","sourceRoot":"","sources":["../../src/utils/credentials.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,0CAiBC;AAcD,4CAUC;AAiBD,sDAuBC;AAGD,4CAIC;AAxHD,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AACzB,4DAA8C;AAE9C,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,CAAC,CAAC;AAC7D,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,kBAAkB,CAAC,CAAC;AAExE;;;;;GAKG;AACU,QAAA,eAAe,GAAG,iCAAiC,CAAC;AAUjE;;;;;;;GAOG;AACH,SAAgB,eAAe;IAC7B,2DAA2D;IAC3D,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;IAC5C,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,uBAAe,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;IACtF,CAAC;IAED,qCAAqC;IACrC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC;QAAE,OAAO,IAAI,CAAC;IAClD,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,gB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AC,IAAI,CAAC;IACT,IAAI,CAAC,IAAI;QAAE,OAAO;IAClB,IAAI,CAAC;QACH,yEAAyE;QACzE,0EAA0E;QAC1E,kCAAkC;QAClC,YAAY,CAAC,YAAY,CACvB,QAAQ,EACR,CAAC,IAAI,EAAE,gBAAgB,EAAE,UAAU,EAAE,GAAG,IAAI,IAAI,CAAC,EACjD,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAM,EAAE,CACrC,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,CAAC,IAAI,CACV,yCAAyC,IAAI,KAAK;YAChD,kBAAkB,WAAW,8CAA8C;YAC3E,6CAA6C;YAC7C,cAAc,IAAI,0CAA0C,CAC/D,CAAC;IACJ,CAAC;AACH,CAAC;AAED,iCAAiC;AACjC,SAAgB,gBAAgB;IAC9B,IAAI,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACpC,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC;IAClC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Context } from './context';
|
|
2
|
+
/**
|
|
3
|
+
* The command surface — one definition, three consumers.
|
|
4
|
+
*
|
|
5
|
+
* ── The problem ─────────────────────────────────────────────────────────────
|
|
6
|
+
*
|
|
7
|
+
* The old splash printed all 31 commands to everyone, every time. A first-time
|
|
8
|
+
* user could not tell which of thirty lines mattered, and `quickstart` — the
|
|
9
|
+
* one command that matters most — was line 14 of a wall of cyan.
|
|
10
|
+
*
|
|
11
|
+
* ── The fix ─────────────────────────────────────────────────────────────────
|
|
12
|
+
*
|
|
13
|
+
* Meet people where they are. Stage 0 shows ONE command; the grouped surface
|
|
14
|
+
* appears from stage 2, once a project is linked and the commands have
|
|
15
|
+
* something to act on. `scalebun help --all` always prints everything, so
|
|
16
|
+
* nobody is ever trapped in a tutorial.
|
|
17
|
+
*
|
|
18
|
+
* The stage is DERIVED (see context.ts) — never stored. A veteran opening a
|
|
19
|
+
* fresh repo is at stage 2 there, which is correct: they need the wiring steps
|
|
20
|
+
* in that checkout regardless of how many releases they have shipped elsewhere.
|
|
21
|
+
*
|
|
22
|
+
* ── Why GROUPS is data ──────────────────────────────────────────────────────
|
|
23
|
+
*
|
|
24
|
+
* The printed splash, `help --all`, and the interactive menu all describe the
|
|
25
|
+
* same commands. Written three times they drift — the menu offers a command
|
|
26
|
+
* the splash never mentions, or the splash advertises one the menu cannot
|
|
27
|
+
* reach, and nobody notices because each surface looks internally consistent.
|
|
28
|
+
* `argv` is the runnable form, so a menu entry cannot describe a command it is
|
|
29
|
+
* unable to launch.
|
|
30
|
+
*/
|
|
31
|
+
export interface CommandEntry {
|
|
32
|
+
/** Argv to run, e.g. ['ota', 'publish'] — the runnable truth. */
|
|
33
|
+
argv: string[];
|
|
34
|
+
desc: string;
|
|
35
|
+
}
|
|
36
|
+
export interface CommandGroup {
|
|
37
|
+
title: string;
|
|
38
|
+
/** One line for the group menu: what this group is for. */
|
|
39
|
+
summary: string;
|
|
40
|
+
commands: CommandEntry[];
|
|
41
|
+
}
|
|
42
|
+
export declare const GROUPS: CommandGroup[];
|
|
43
|
+
/** How a command is written in prose and on the splash. */
|
|
44
|
+
export declare function commandLabel(entry: CommandEntry): string;
|
|
45
|
+
/**
|
|
46
|
+
* The stage hint as ONE line, for the interactive menu.
|
|
47
|
+
*
|
|
48
|
+
* The printed splash can afford a four-line NEXT block; a menu frame competing
|
|
49
|
+
* with the logo, the status box and five groups cannot. Losing it entirely
|
|
50
|
+
* would be worse — the ladder is what stops a newcomer from picking a command
|
|
51
|
+
* that cannot work yet — so it compresses rather than disappears.
|
|
52
|
+
*/
|
|
53
|
+
export declare function nextStepHint(ctx: Context): string | null;
|
|
54
|
+
/** The one thing to do next, given the stage. */
|
|
55
|
+
export declare function renderNextStep(ctx: Context): void;
|
|
56
|
+
/** Every command, grouped by task. Printed at stage 2+ and by `help --all`. */
|
|
57
|
+
export declare function renderAllCommands(): void;
|
|
58
|
+
/** The stage-appropriate body of the splash. */
|
|
59
|
+
export declare function renderGuide(ctx: Context): void;
|
|
60
|
+
/** Context line for the splash and the session header. */
|
|
61
|
+
export declare function contextLineText(ctx: Context): string | null;
|
|
62
|
+
export declare function renderContextLine(ctx: Context): void;
|
|
63
|
+
//# sourceMappingURL=guide.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guide.d.ts","sourceRoot":"","sources":["../../src/utils/guide.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAgB,MAAM,WAAW,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,MAAM,WAAW,YAAY;IAC3B,iEAAiE;IACjE,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,YAAY,EAAE,CAAC;CAC1B;AAED,eAAO,MAAM,MAAM,EAAE,YAAY,EAwDhC,CAAC;AAEF,2DAA2D;AAC3D,wBAAgB,YAAY,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAExD;AAKD;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAkBxD;AAED,iDAAiD;AACjD,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CA4CjD;AAED,+EAA+E;AAC/E,wBAAgB,iBAAiB,IAAI,IAAI,CASxC;AAED,gDAAgD;AAChD,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAiB9C;AAED,0DAA0D;AAC1D,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAO3D;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAGpD"}
|