@wix/himalaya-cli 0.1765.0 → 0.1767.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/dist/cli.mjs +394 -298
- package/guides/himi-json-output.md +6 -5
- package/guides/store-submission.md +13 -4
- package/guides/wix-login-integration.md +15 -0
- package/package.json +2 -2
package/dist/cli.mjs
CHANGED
|
@@ -15250,10 +15250,10 @@ function confinedHost(ts34, contentDir2, options2) {
|
|
|
15250
15250
|
const libDir = resolve12(ts34.getDefaultLibFilePath(options2), "..");
|
|
15251
15251
|
const allows = confinementMatcher(contentDir2, [libDir]);
|
|
15252
15252
|
const getSourceFile = host.getSourceFile.bind(host);
|
|
15253
|
-
const
|
|
15253
|
+
const readFile26 = host.readFile.bind(host);
|
|
15254
15254
|
const fileExists = host.fileExists.bind(host);
|
|
15255
15255
|
host.getSourceFile = (fileName, ...rest) => allows(fileName) ? getSourceFile(fileName, ...rest) : void 0;
|
|
15256
|
-
host.readFile = (fileName) => allows(fileName) ?
|
|
15256
|
+
host.readFile = (fileName) => allows(fileName) ? readFile26(fileName) : void 0;
|
|
15257
15257
|
host.fileExists = (fileName) => allows(fileName) && fileExists(fileName);
|
|
15258
15258
|
const directoryExists = host.directoryExists?.bind(host);
|
|
15259
15259
|
if (directoryExists) host.directoryExists = (dir) => allows(dir) && directoryExists(dir);
|
|
@@ -23348,9 +23348,9 @@ function findSkipDerive(bundleJs) {
|
|
|
23348
23348
|
let im;
|
|
23349
23349
|
while (im = inRe.exec(body)) inputs.add(im[1]);
|
|
23350
23350
|
let outputs = [];
|
|
23351
|
-
const
|
|
23352
|
-
if (
|
|
23353
|
-
const objOpen = body.indexOf("{",
|
|
23351
|
+
const rm11 = /return\s*\{/.exec(body);
|
|
23352
|
+
if (rm11) {
|
|
23353
|
+
const objOpen = body.indexOf("{", rm11.index + rm11[0].length - 1);
|
|
23354
23354
|
const objClose = matchBraceSafe(body, objOpen);
|
|
23355
23355
|
if (objClose > objOpen) outputs = objectShape(body.slice(objOpen + 1, objClose)).keys;
|
|
23356
23356
|
}
|
|
@@ -41879,6 +41879,7 @@ function shouldRevealError(args) {
|
|
|
41879
41879
|
var EMAIL_RE, URL_HOST_RE, INTEGER_RE, NUMBER_RE, AUTHORED_PATTERN_LIMIT, authoredPatterns;
|
|
41880
41880
|
var init_validation = __esm({
|
|
41881
41881
|
"../../core/ts/src/validation.ts"() {
|
|
41882
|
+
"use strict";
|
|
41882
41883
|
init_define_HHP_CATALOG();
|
|
41883
41884
|
EMAIL_RE = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}$/;
|
|
41884
41885
|
URL_HOST_RE = /^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(:[0-9]+)?$/;
|
|
@@ -57167,7 +57168,7 @@ var init_pdf = __esm({
|
|
|
57167
57168
|
var defineProperty = Object.defineProperty;
|
|
57168
57169
|
var stringSlice = uncurryThis("".slice);
|
|
57169
57170
|
var replace3 = uncurryThis("".replace);
|
|
57170
|
-
var
|
|
57171
|
+
var join211 = uncurryThis([].join);
|
|
57171
57172
|
var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function() {
|
|
57172
57173
|
return defineProperty(function() {
|
|
57173
57174
|
}, "length", { value: 8 }).length !== 8;
|
|
@@ -57194,7 +57195,7 @@ var init_pdf = __esm({
|
|
|
57194
57195
|
}
|
|
57195
57196
|
var state = enforceInternalState(value2);
|
|
57196
57197
|
if (!hasOwn(state, "source")) {
|
|
57197
|
-
state.source =
|
|
57198
|
+
state.source = join211(TEMPLATE, typeof name == "string" ? name : "");
|
|
57198
57199
|
}
|
|
57199
57200
|
return value2;
|
|
57200
57201
|
};
|
|
@@ -59717,7 +59718,7 @@ var init_pdf = __esm({
|
|
|
59717
59718
|
var charAt = uncurryThis("".charAt);
|
|
59718
59719
|
var Uint8Array2 = globalThis2.Uint8Array;
|
|
59719
59720
|
var $Array = globalThis2.Array;
|
|
59720
|
-
var
|
|
59721
|
+
var join211 = uncurryThis([].join);
|
|
59721
59722
|
var INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS = !Uint8Array2 || !Uint8Array2.prototype.toBase64 || !(function() {
|
|
59722
59723
|
try {
|
|
59723
59724
|
var target = new Uint8Array2();
|
|
@@ -59763,7 +59764,7 @@ var init_pdf = __esm({
|
|
|
59763
59764
|
result[written++] = "=";
|
|
59764
59765
|
}
|
|
59765
59766
|
}
|
|
59766
|
-
return
|
|
59767
|
+
return join211(result, "");
|
|
59767
59768
|
}
|
|
59768
59769
|
});
|
|
59769
59770
|
},
|
|
@@ -59775,7 +59776,7 @@ var init_pdf = __esm({
|
|
|
59775
59776
|
var anUint8Array = __webpack_require__3(4154);
|
|
59776
59777
|
var notDetached = __webpack_require__3(5169);
|
|
59777
59778
|
var numberToString2 = uncurryThis(1.1.toString);
|
|
59778
|
-
var
|
|
59779
|
+
var join211 = uncurryThis([].join);
|
|
59779
59780
|
var $Array = Array;
|
|
59780
59781
|
var Uint8Array2 = globalThis2.Uint8Array;
|
|
59781
59782
|
var INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS = !Uint8Array2 || !Uint8Array2.prototype.toHex || !(function() {
|
|
@@ -59795,7 +59796,7 @@ var init_pdf = __esm({
|
|
|
59795
59796
|
var hex2 = numberToString2(this[i2], 16);
|
|
59796
59797
|
result[i2] = hex2.length === 1 ? "0" + hex2 : hex2;
|
|
59797
59798
|
}
|
|
59798
|
-
return
|
|
59799
|
+
return join211(result, "");
|
|
59799
59800
|
}
|
|
59800
59801
|
});
|
|
59801
59802
|
},
|
|
@@ -230857,9 +230858,9 @@ var init_commands = __esm({
|
|
|
230857
230858
|
summary: "Jobs in the state directory",
|
|
230858
230859
|
async run(inv) {
|
|
230859
230860
|
const { FileJobStore: FileJobStore2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports5));
|
|
230860
|
-
const { join:
|
|
230861
|
+
const { join: join211 } = await import("node:path");
|
|
230861
230862
|
const runner2 = await inv.ctx.runner();
|
|
230862
|
-
const jobs = runner2.list ? await runner2.list() : await new FileJobStore2(
|
|
230863
|
+
const jobs = runner2.list ? await runner2.list() : await new FileJobStore2(join211(inv.ctx.stateDir, "jobs")).list();
|
|
230863
230864
|
inv.print(jobs.map((j2) => ({ id: j2.id, action: j2.action, status: j2.status, actor: j2.actor, issuerId: accountKey(j2.account), created: j2.history[0]?.at })), ["id", "action", "status", "actor", "issuerId", "created"]);
|
|
230864
230865
|
}
|
|
230865
230866
|
},
|
|
@@ -242985,11 +242986,11 @@ __export(input_evidence_isolation_exports, {
|
|
|
242985
242986
|
});
|
|
242986
242987
|
async function installInputEvidenceIsolation(dir) {
|
|
242987
242988
|
const { lstatSync: lstatSync41, readdirSync: readdirSync64 } = await import("node:fs");
|
|
242988
|
-
const { join:
|
|
242989
|
+
const { join: join211 } = await import("node:path");
|
|
242989
242990
|
const check = (path2) => {
|
|
242990
242991
|
const stat10 = lstatSync41(path2);
|
|
242991
242992
|
if (stat10.isSymbolicLink()) throw new Error("input evidence requires a content tree without symlinks");
|
|
242992
|
-
if (stat10.isDirectory()) for (const name of readdirSync64(path2)) check(
|
|
242993
|
+
if (stat10.isDirectory()) for (const name of readdirSync64(path2)) check(join211(path2, name));
|
|
242993
242994
|
};
|
|
242994
242995
|
check(dir);
|
|
242995
242996
|
const { requireBuildConfinement: requireBuildConfinement2 } = await Promise.resolve().then(() => (init_build_lib(), build_lib_exports));
|
|
@@ -251892,7 +251893,13 @@ async function defaultGoogleHost(env, io2) {
|
|
|
251892
251893
|
const stateDir2 = jobs.gplayStateDir(env);
|
|
251893
251894
|
const choice = env.GPLAY_CREDENTIAL_STORE ?? (process.platform === "darwin" ? "keychain" : "file");
|
|
251894
251895
|
if (choice !== "keychain" && choice !== "file") throw new UsageError7(`GPLAY_CREDENTIAL_STORE must be file or keychain (got "${choice}")`);
|
|
251895
|
-
const
|
|
251896
|
+
const saved = choice === "keychain" ? new api4.KeychainCredentialStore() : new api4.FileCredentialStore(join164(stateDir2, "credentials.json"));
|
|
251897
|
+
const store = {
|
|
251898
|
+
id: saved.id,
|
|
251899
|
+
load: async () => await saved.load() ?? await api4.loadApplicationDefaultCredentials({ env }),
|
|
251900
|
+
save: (u2) => saved.save(u2),
|
|
251901
|
+
clear: () => saved.clear()
|
|
251902
|
+
};
|
|
251896
251903
|
const profileDir = env.GPLAY_CONSOLE_PROFILE ?? join164(stateDir2, "console-profile");
|
|
251897
251904
|
return {
|
|
251898
251905
|
stateDir: stateDir2,
|
|
@@ -251900,7 +251907,7 @@ async function defaultGoogleHost(env, io2) {
|
|
|
251900
251907
|
connect: () => api4.connectGoogle({
|
|
251901
251908
|
clientFile: api4.defaultClientFile(env, stateDir2),
|
|
251902
251909
|
scopes: [...api4.PLAY_SCOPES],
|
|
251903
|
-
store,
|
|
251910
|
+
store: saved,
|
|
251904
251911
|
// The consent page opens in the owner's browser; with no browser, the URL goes to stderr (never to stdout).
|
|
251905
251912
|
openBrowser: async (url) => {
|
|
251906
251913
|
try {
|
|
@@ -251929,7 +251936,7 @@ async function googleOf(deps, env, io2) {
|
|
|
251929
251936
|
host,
|
|
251930
251937
|
audit: async () => audit,
|
|
251931
251938
|
async readUsers(developerId) {
|
|
251932
|
-
const googleFor = host.googleFor ?? jobs.googleClientsFor({ stateDir: host.stateDir, store: host.store });
|
|
251939
|
+
const googleFor = host.googleFor ?? jobs.googleClientsFor({ stateDir: host.stateDir, store: host.store, ...env.GOOGLE_CLOUD_QUOTA_PROJECT ? { quotaProject: env.GOOGLE_CLOUD_QUOTA_PROJECT } : {} });
|
|
251933
251940
|
const clients = await googleFor(await accountFor(developerId), { readOnly: true });
|
|
251934
251941
|
return await clients.api.listUsers(developerId);
|
|
251935
251942
|
},
|
|
@@ -251938,6 +251945,7 @@ async function googleOf(deps, env, io2) {
|
|
|
251938
251945
|
const googleFor = host.googleFor ?? jobs.googleClientsFor({
|
|
251939
251946
|
stateDir: host.stateDir,
|
|
251940
251947
|
store: host.store,
|
|
251948
|
+
...env.GOOGLE_CLOUD_QUOTA_PROJECT ? { quotaProject: env.GOOGLE_CLOUD_QUOTA_PROJECT } : {},
|
|
251941
251949
|
...o2.console ? { console: { profileDir: env.GPLAY_CONSOLE_PROFILE ?? join164(host.stateDir, "console-profile"), ...env.GPLAY_CHROME ? { chromePath: env.GPLAY_CHROME } : {} } } : {}
|
|
251942
251950
|
});
|
|
251943
251951
|
return new engine.JobRunner({
|
|
@@ -253019,26 +253027,30 @@ stderr with a code.`;
|
|
|
253019
253027
|
// src/store-google-testers.ts
|
|
253020
253028
|
var store_google_testers_exports = {};
|
|
253021
253029
|
__export(store_google_testers_exports, {
|
|
253030
|
+
POOL_CONSENT_DAYS: () => POOL_CONSENT_DAYS,
|
|
253022
253031
|
POOL_DEFAULT_TRACK: () => POOL_DEFAULT_TRACK,
|
|
253023
253032
|
POOL_GROUP_ENV: () => POOL_GROUP_ENV,
|
|
253024
253033
|
STORE_GOOGLE_TESTERS_CODES: () => STORE_GOOGLE_TESTERS_CODES,
|
|
253025
253034
|
STORE_GOOGLE_TESTERS_USAGE: () => STORE_GOOGLE_TESTERS_USAGE,
|
|
253026
253035
|
runStoreGoogleTesters: () => runStoreGoogleTesters
|
|
253027
253036
|
});
|
|
253028
|
-
import {
|
|
253037
|
+
import { mkdir as mkdir20, readFile as readFile24, rm as rm10, writeFile as writeFile16 } from "node:fs/promises";
|
|
253038
|
+
import { join as join165, resolve as resolve106 } from "node:path";
|
|
253029
253039
|
function fail13(io2, code2, error, extra = {}) {
|
|
253030
253040
|
io2.error(JSON.stringify({ ok: false, code: code2, error: scrubSecretShapes(error).slice(0, 600), ...extra }));
|
|
253031
253041
|
return code2 === "invalid_usage" || code2 === "confirmation_required" || code2 === "pool_group_unset" ? 2 : 1;
|
|
253032
253042
|
}
|
|
253033
253043
|
function parse7(pos, flags, cwd, env) {
|
|
253034
253044
|
const op = pos[3];
|
|
253035
|
-
if (op !== "pool-add" && op !== "pool-remove" && op !== "pool-check") throw new UsageError9(`store google testers needs an op: pool-add | pool-remove | pool-check`);
|
|
253045
|
+
if (op !== "pool-add" && op !== "pool-remove" && op !== "pool-check" && op !== "consent") throw new UsageError9(`store google testers needs an op: pool-add | pool-remove | pool-check | consent grant|revoke|status`);
|
|
253046
|
+
const consentOp = op === "consent" ? pos[4] : void 0;
|
|
253047
|
+
if (op === "consent" && consentOp !== "grant" && consentOp !== "revoke" && consentOp !== "status") throw new UsageError9("store google testers consent needs grant | revoke | status");
|
|
253036
253048
|
if (flags.yes !== void 0) throw new UsageError9("there is no --yes here: this changes your own app's testers, so it takes your typed yes at a terminal");
|
|
253037
253049
|
const track2 = (text22(flags.track) ?? POOL_DEFAULT_TRACK).toLowerCase();
|
|
253038
253050
|
if (NOT_CLOSED.has(track2)) throw new UsageError9(`--track ${track2} is not a closed testing track; the pool uses the closed track ${POOL_DEFAULT_TRACK}`);
|
|
253039
|
-
const group = text22(env[POOL_GROUP_ENV]);
|
|
253040
|
-
if (!group) return { unset: true };
|
|
253041
|
-
if (!GROUP_RE.test(group)) throw new UsageError9(`${POOL_GROUP_ENV} must be the pool's Google Group address (got "${group}")`);
|
|
253051
|
+
const group = text22(env[POOL_GROUP_ENV]) ?? "";
|
|
253052
|
+
if (!group && !(op === "consent" && consentOp !== "grant")) return { unset: true };
|
|
253053
|
+
if (group && !GROUP_RE.test(group)) throw new UsageError9(`${POOL_GROUP_ENV} must be the pool's Google Group address (got "${group}")`);
|
|
253042
253054
|
let dir;
|
|
253043
253055
|
try {
|
|
253044
253056
|
dir = appDirFor("", resolve106(cwd, text22(flags.dir) ?? "."));
|
|
@@ -253051,7 +253063,7 @@ function parse7(pos, flags, cwd, env) {
|
|
|
253051
253063
|
if (!PACKAGE_RE3.test(packageName)) throw new UsageError9(`"${packageName}" is not an Android package name`);
|
|
253052
253064
|
const developer = text22(flags.developer) ?? text22(facts?.developerId);
|
|
253053
253065
|
if (developer && !DEVELOPER_RE3.test(developer)) throw new UsageError9("--developer is your Play developer account id: the number in your Play Console URL");
|
|
253054
|
-
return { op, track: track2, group, packageName, ...developer ? { developer } : {} };
|
|
253066
|
+
return { op, ...consentOp ? { consentOp } : {}, track: track2, group, packageName, ...developer ? { developer } : {} };
|
|
253055
253067
|
}
|
|
253056
253068
|
async function runStoreGoogleTesters(pos, flags, io2, deps = {}) {
|
|
253057
253069
|
const env = deps.env ?? process.env;
|
|
@@ -253069,18 +253081,78 @@ async function runStoreGoogleTesters(pos, flags, io2, deps = {}) {
|
|
|
253069
253081
|
}
|
|
253070
253082
|
const tooOld = storeNodeRefusal(deps.nodeVersion);
|
|
253071
253083
|
if (tooOld) return fail13(io2, "node_too_old", tooOld.replace("App Store submission", "Google Play from himi"));
|
|
253072
|
-
const writes = p2.op !== "pool-check";
|
|
253073
253084
|
const ask4 = deps.ask === void 0 ? process.stdin.isTTY && process.stderr.isTTY ? ttyAsk3() : void 0 : deps.ask ?? void 0;
|
|
253074
|
-
if (writes && !ask4) return fail13(io2, "confirmation_required", "this changes your own app's testers on Google Play, so it needs your typed yes at a terminal; run it in your own terminal");
|
|
253075
253085
|
const now = deps.now ?? (() => /* @__PURE__ */ new Date());
|
|
253076
253086
|
try {
|
|
253077
253087
|
const google = await googleOf({ google: deps.google, ...deps.now ? { now: deps.now } : {} }, env, io2);
|
|
253078
|
-
return await
|
|
253088
|
+
if (p2.op === "consent") return await consentCommand(p2, io2, ask4, google.host.stateDir, now);
|
|
253089
|
+
const consent = p2.op === "pool-check" ? void 0 : await validConsent(google.host.stateDir, p2, now);
|
|
253090
|
+
if (p2.op !== "pool-check" && !ask4 && !consent) {
|
|
253091
|
+
return fail13(io2, "confirmation_required", "this changes your own app's testers on Google Play, so it needs your typed yes at a terminal, or your recorded consent: run it in your own terminal, or once run himi store google testers consent grant there (90 days)");
|
|
253092
|
+
}
|
|
253093
|
+
return await run3({ p: p2, io: io2, ask: ask4, consent, google, now, person: google.host.person ?? localPerson(), actor: { actor: `user:${osUser2()}` } });
|
|
253079
253094
|
} catch (e2) {
|
|
253080
253095
|
if (e2 instanceof UsageError9) return fail13(io2, "invalid_usage", e2.message, { usage: STORE_GOOGLE_TESTERS_USAGE });
|
|
253081
253096
|
return fail13(io2, "job_failed", e2.message ?? String(e2));
|
|
253082
253097
|
}
|
|
253083
253098
|
}
|
|
253099
|
+
async function readConsent2(stateDir2, packageName) {
|
|
253100
|
+
try {
|
|
253101
|
+
const c2 = JSON.parse(await readFile24(consentPath(stateDir2, packageName), "utf8"));
|
|
253102
|
+
return c2 && typeof c2.grantedAt === "string" && typeof c2.expiresAt === "string" && typeof c2.group === "string" ? c2 : void 0;
|
|
253103
|
+
} catch {
|
|
253104
|
+
return void 0;
|
|
253105
|
+
}
|
|
253106
|
+
}
|
|
253107
|
+
async function validConsent(stateDir2, p2, now) {
|
|
253108
|
+
const c2 = await readConsent2(stateDir2, p2.packageName);
|
|
253109
|
+
if (!c2 || c2.packageName !== p2.packageName || p2.group && c2.group.toLowerCase() !== p2.group.toLowerCase()) return void 0;
|
|
253110
|
+
if ((c2.track ?? POOL_DEFAULT_TRACK).toLowerCase() !== p2.track.toLowerCase()) return void 0;
|
|
253111
|
+
if (p2.developer && c2.developerId && p2.developer !== c2.developerId) return void 0;
|
|
253112
|
+
const expires = Date.parse(c2.expiresAt);
|
|
253113
|
+
return Number.isFinite(expires) && expires > now().getTime() ? c2 : void 0;
|
|
253114
|
+
}
|
|
253115
|
+
async function consentCommand(p2, io2, ask4, stateDir2, now) {
|
|
253116
|
+
const base2 = { packageName: p2.packageName, group: p2.group, track: p2.track };
|
|
253117
|
+
if (p2.consentOp === "status") {
|
|
253118
|
+
const c2 = await readConsent2(stateDir2, p2.packageName);
|
|
253119
|
+
const valid3 = await validConsent(stateDir2, p2, now);
|
|
253120
|
+
io2.log(JSON.stringify({ ok: true, ...base2, consent: c2 ?? null, valid: !!valid3, ...c2 && !valid3 ? { why: Date.parse(c2.expiresAt) <= now().getTime() ? "expired" : "does not match this package, pool group and track" } : {} }));
|
|
253121
|
+
return 0;
|
|
253122
|
+
}
|
|
253123
|
+
if (p2.consentOp === "revoke") {
|
|
253124
|
+
const had = !!await readConsent2(stateDir2, p2.packageName);
|
|
253125
|
+
await rm10(consentPath(stateDir2, p2.packageName), { force: true });
|
|
253126
|
+
io2.log(JSON.stringify({ ok: true, ...base2, revoked: had }));
|
|
253127
|
+
return 0;
|
|
253128
|
+
}
|
|
253129
|
+
if (!ask4) return fail13(io2, "confirmation_required", "recording your consent needs your typed yes at a terminal; run himi store google testers consent grant in your own terminal", base2);
|
|
253130
|
+
const developerId = await knownDeveloper(stateDir2, p2.developer, p2.packageName);
|
|
253131
|
+
const at2 = now();
|
|
253132
|
+
const record5 = {
|
|
253133
|
+
packageName: p2.packageName,
|
|
253134
|
+
...developerId ? { developerId } : {},
|
|
253135
|
+
group: p2.group,
|
|
253136
|
+
track: p2.track,
|
|
253137
|
+
grantedAt: at2.toISOString(),
|
|
253138
|
+
expiresAt: new Date(at2.getTime() + POOL_CONSENT_DAYS * DAY_MS6).toISOString(),
|
|
253139
|
+
osUser: osUser2()
|
|
253140
|
+
};
|
|
253141
|
+
for (const line of [
|
|
253142
|
+
`This records your consent, for ${POOL_CONSENT_DAYS} days (until ${record5.expiresAt.slice(0, 10)}), for himi to add or remove Wix's closed-test pool group ${p2.group}`,
|
|
253143
|
+
`on the testers of ${p2.packageName}${developerId ? ` (developer account ${developerId})` : ""} without asking you each time. Every change is still planned, checked and logged as a job.`,
|
|
253144
|
+
`Withdraw it any time: himi store google testers consent revoke`
|
|
253145
|
+
]) io2.error(line);
|
|
253146
|
+
if ((await ask4(`Type "yes" to agree:`)).trim().toLowerCase() !== "yes") return fail13(io2, "consent_declined", "not confirmed; no consent was recorded", base2);
|
|
253147
|
+
await mkdir20(join165(stateDir2, "himi-pool-consent"), { recursive: true, mode: 448 });
|
|
253148
|
+
await writeFile16(consentPath(stateDir2, p2.packageName), JSON.stringify(record5, null, 2) + "\n", { mode: 384 });
|
|
253149
|
+
io2.log(JSON.stringify({ ok: true, ...base2, consent: record5 }));
|
|
253150
|
+
return 0;
|
|
253151
|
+
}
|
|
253152
|
+
function upgradedRefusal(io2, p2, message5, extra) {
|
|
253153
|
+
if (!UPGRADED_RE.test(message5)) return void 0;
|
|
253154
|
+
return fail13(io2, "track_upgraded", `Google Play refuses Google Groups on the track "${p2.track}" through the API: Play Console upgraded it to its new open/closed testing. Use the pool's own custom closed track instead, which pool-add creates: himi store google testers pool-add --track ${POOL_DEFAULT_TRACK} (the default). Nothing was changed on "${p2.track}".`, extra);
|
|
253155
|
+
}
|
|
253084
253156
|
async function readGroups(c2, developerId) {
|
|
253085
253157
|
const host = c2.google.host;
|
|
253086
253158
|
const stored = (await host.store.load())?.account;
|
|
@@ -253106,10 +253178,12 @@ async function run3(c2) {
|
|
|
253106
253178
|
const developerId = await knownDeveloper(host.stateDir, p2.developer, p2.packageName);
|
|
253107
253179
|
if (!developerId) return fail13(io2, "developer_unknown", `this computer does not know your Play developer account: set developerId in ${GOOGLE_FACTS_FILE} or pass --developer <id> (the number in your Play Console URL); nothing was read or changed`);
|
|
253108
253180
|
const base2 = { packageName: p2.packageName, track: p2.track, group: p2.group, developerId };
|
|
253109
|
-
const
|
|
253110
|
-
if (
|
|
253111
|
-
return fail13(io2, "track_missing", `${p2.packageName} has no closed testing track "${p2.track}":
|
|
253181
|
+
const read2 = await readGroups(c2, developerId);
|
|
253182
|
+
if (read2 === void 0 && p2.op !== "pool-add") {
|
|
253183
|
+
return fail13(io2, "track_missing", `${p2.packageName} has no closed testing track "${p2.track}": pool-add creates it; nothing was changed`, base2);
|
|
253112
253184
|
}
|
|
253185
|
+
const creating = read2 === void 0;
|
|
253186
|
+
const groups = read2 ?? [];
|
|
253113
253187
|
const onTrack = groups.some((g2) => same5(g2, p2.group));
|
|
253114
253188
|
if (p2.op === "pool-check") {
|
|
253115
253189
|
io2.log(JSON.stringify({ ok: true, ...base2, onTrack, groups }));
|
|
@@ -253128,25 +253202,36 @@ async function run3(c2) {
|
|
|
253128
253202
|
let job;
|
|
253129
253203
|
try {
|
|
253130
253204
|
job = await runner2.plan("gplay.closedTest.setup", { packageName: p2.packageName, track: p2.track, groups: wanted }, c2.actor);
|
|
253131
|
-
const problem = planProblem(job, [`tracks/${p2.track}`, `testers/${p2.track}`], /^Google's closed-test rule/) ?? (job.plan.changes.some((ch2) => ch2.resource === `tracks/${p2.track}` && ch2.op !== "noop") ? `the plan also changes the track ${p2.track} itself` : void 0) ?? (JSON.stringify(job.plan.facts?.groups ?? null) !== JSON.stringify([...groups].sort()) ? `the track's groups changed since they were read (${job.plan.facts?.groups?.join(", ") ?? "unknown"})` : void 0);
|
|
253205
|
+
const problem = planProblem(job, [`tracks/${p2.track}`, `testers/${p2.track}`], /^Google's closed-test rule/) ?? (job.plan.changes.some((ch2) => ch2.resource === `tracks/${p2.track}` && ch2.op !== (creating ? "create" : "noop")) ? creating ? `the plan does not create the missing track ${p2.track}` : `the plan also changes the track ${p2.track} itself` : void 0) ?? (JSON.stringify(job.plan.facts?.groups ?? null) !== JSON.stringify([...groups].sort()) ? `the track's groups changed since they were read (${job.plan.facts?.groups?.join(", ") ?? "unknown"})` : void 0);
|
|
253132
253206
|
if (problem) return fail13(io2, "plan_unexpected", `${problem}; nothing was approved`, { ...base2, jobId: job.id, status: job.status, changes: changesOf2(job) });
|
|
253133
253207
|
for (const line of [
|
|
253134
|
-
`${adding ? "This adds" : "This removes"} Wix's closed-test pool group ${p2.group} ${adding ? "to" : "from"} the testers of closed track "${p2.track}" on ${p2.packageName} (developer account ${developerId}):`,
|
|
253208
|
+
`${adding ? "This adds" : "This removes"} Wix's closed-test pool group ${p2.group} ${adding ? "to" : "from"} the testers of closed track "${p2.track}" on ${p2.packageName} (developer account ${developerId})${creating ? `, creating the custom closed track "${p2.track}"` : ""}:`,
|
|
253135
253209
|
...changesOf2(job).map((l3) => ` - ${l3}`),
|
|
253136
253210
|
adding ? " - Every other group stays. The pool's phones can opt in to the closed test after this." : " - Every other group stays. The pool's phones lose access to the closed test.",
|
|
253137
253211
|
` - Job ${job.id}, plan ${job.planHash.slice(0, 8)}.`
|
|
253138
253212
|
]) io2.error(line);
|
|
253139
|
-
|
|
253140
|
-
if (!
|
|
253213
|
+
if (c2.consent) io2.error(`consent: ${c2.consent.grantedAt} (recorded by ${c2.consent.osUser}, until ${c2.consent.expiresAt}); applying without a prompt`);
|
|
253214
|
+
else if (!c2.ask) return fail13(io2, "confirmation_required", "no terminal and no recorded consent: run himi store google testers consent grant in your own terminal", { ...base2, jobId: job.id });
|
|
253215
|
+
else {
|
|
253216
|
+
const agreed = (await c2.ask(`Type "yes" to agree:`)).trim().toLowerCase() === "yes";
|
|
253217
|
+
if (!agreed) return fail13(io2, "consent_declined", "not confirmed; nothing was approved or changed", { ...base2, jobId: job.id });
|
|
253218
|
+
}
|
|
253141
253219
|
const latest = await readGroups(c2, developerId);
|
|
253142
|
-
|
|
253220
|
+
const moved = creating ? latest !== void 0 : !latest || latest.length !== groups.length || !latest.every((g2) => groups.some((o2) => same5(o2, g2)));
|
|
253221
|
+
if (moved) {
|
|
253143
253222
|
return fail13(io2, "groups_changed", `the track's groups changed while you were deciding (now: ${latest?.join(", ") || "none"}); nothing was approved or written. Run the command again.`, { ...base2, jobId: job.id });
|
|
253144
253223
|
}
|
|
253145
253224
|
job = await approveAndApply(runner2, job, c2.person, c2.actor, c2.now);
|
|
253146
253225
|
} catch (e2) {
|
|
253147
253226
|
const failed3 = e2 instanceof JobFailure ? e2.job : e2.job;
|
|
253227
|
+
const upgraded = upgradedRefusal(io2, p2, `${e2.message ?? ""} ${failed3?.error ?? ""}`, { ...base2, ...failed3 ? { jobId: failed3.id, status: failed3.status } : {} });
|
|
253228
|
+
if (upgraded !== void 0) return upgraded;
|
|
253148
253229
|
return fail13(io2, "job_failed", e2.message ?? String(e2), { ...base2, ...failed3 ? { jobId: failed3.id, status: failed3.status, next: `gplay-node jobs show ${failed3.id}` } : {} });
|
|
253149
253230
|
}
|
|
253231
|
+
if (job.status !== "verified") {
|
|
253232
|
+
const upgraded = upgradedRefusal(io2, p2, String(job.error ?? ""), { ...base2, jobId: job.id, status: job.status });
|
|
253233
|
+
if (upgraded !== void 0) return upgraded;
|
|
253234
|
+
}
|
|
253150
253235
|
if (job.status !== "verified") return fail13(io2, "job_failed", `job ${job.id} is ${job.status}: ${job.error ?? "not read back"}`, { ...base2, jobId: job.id, status: job.status, next: `gplay-node jobs show ${job.id}` });
|
|
253151
253236
|
await rememberDeveloper(host.stateDir, p2.packageName, developerId);
|
|
253152
253237
|
const readBack4 = await readGroups(c2, developerId);
|
|
@@ -253161,13 +253246,15 @@ async function run3(c2) {
|
|
|
253161
253246
|
status: job.status,
|
|
253162
253247
|
onTrack: nowOn,
|
|
253163
253248
|
changed: true,
|
|
253249
|
+
...creating ? { createdTrack: true } : {},
|
|
253164
253250
|
groups: after,
|
|
253165
253251
|
changes: changesOf2(job),
|
|
253252
|
+
...c2.consent ? { consent: c2.consent.grantedAt } : {},
|
|
253166
253253
|
next: adding ? "tell Wix RelOps the group is on; after the test, run: himi store google testers pool-remove" : "the pool's group is off the track"
|
|
253167
253254
|
}));
|
|
253168
253255
|
return 0;
|
|
253169
253256
|
}
|
|
253170
|
-
var POOL_GROUP_ENV, POOL_DEFAULT_TRACK, STORE_GOOGLE_TESTERS_USAGE, STORE_GOOGLE_TESTERS_CODES, text22, GROUP_RE, DEVELOPER_RE3, PACKAGE_RE3, NOT_CLOSED, UsageError9, same5;
|
|
253257
|
+
var POOL_GROUP_ENV, POOL_DEFAULT_TRACK, POOL_CONSENT_DAYS, DAY_MS6, UPGRADED_RE, STORE_GOOGLE_TESTERS_USAGE, STORE_GOOGLE_TESTERS_CODES, text22, GROUP_RE, DEVELOPER_RE3, PACKAGE_RE3, NOT_CLOSED, UsageError9, consentPath, same5;
|
|
253171
253258
|
var init_store_google_testers = __esm({
|
|
253172
253259
|
"src/store-google-testers.ts"() {
|
|
253173
253260
|
init_define_HHP_CATALOG();
|
|
@@ -253176,8 +253263,11 @@ var init_store_google_testers = __esm({
|
|
|
253176
253263
|
init_store_google_host();
|
|
253177
253264
|
init_store_relops_google();
|
|
253178
253265
|
POOL_GROUP_ENV = "HIMI_POOL_TESTER_GROUP";
|
|
253179
|
-
POOL_DEFAULT_TRACK = "
|
|
253180
|
-
|
|
253266
|
+
POOL_DEFAULT_TRACK = "himi-pool";
|
|
253267
|
+
POOL_CONSENT_DAYS = 90;
|
|
253268
|
+
DAY_MS6 = 24 * 60 * 60 * 1e3;
|
|
253269
|
+
UPGRADED_RE = /upgraded to use open or closed testing/i;
|
|
253270
|
+
STORE_GOOGLE_TESTERS_USAGE = "himi store google testers pool-add|pool-remove|pool-check|consent grant|consent revoke|consent status [--dir <app>] [--track himi-pool] [--android-package <package>] [--developer <id>]";
|
|
253181
253271
|
STORE_GOOGLE_TESTERS_CODES = [
|
|
253182
253272
|
"invalid_usage",
|
|
253183
253273
|
"node_too_old",
|
|
@@ -253191,6 +253281,7 @@ var init_store_google_testers = __esm({
|
|
|
253191
253281
|
"plan_unexpected",
|
|
253192
253282
|
"groups_changed",
|
|
253193
253283
|
"consent_declined",
|
|
253284
|
+
"track_upgraded",
|
|
253194
253285
|
"job_failed"
|
|
253195
253286
|
];
|
|
253196
253287
|
text22 = (v2) => typeof v2 === "string" && v2.trim() ? v2.trim() : void 0;
|
|
@@ -253200,6 +253291,7 @@ var init_store_google_testers = __esm({
|
|
|
253200
253291
|
NOT_CLOSED = /* @__PURE__ */ new Set(["production", "internal", "beta"]);
|
|
253201
253292
|
UsageError9 = class extends Error {
|
|
253202
253293
|
};
|
|
253294
|
+
consentPath = (stateDir2, packageName) => join165(stateDir2, "himi-pool-consent", `${packageName}.json`);
|
|
253203
253295
|
same5 = (a3, b3) => a3.toLowerCase() === b3.toLowerCase();
|
|
253204
253296
|
}
|
|
253205
253297
|
});
|
|
@@ -253376,9 +253468,9 @@ var init_store_relops_pool = __esm({
|
|
|
253376
253468
|
init_define_HHP_CATALOG();
|
|
253377
253469
|
STORE_POOL_PATH = "/v1/admin/site/store-pool";
|
|
253378
253470
|
STORE_POOL_TEARDOWN_PATH = "/v1/admin/store-pool/teardown";
|
|
253379
|
-
OWNER_POOL_ADD = "himi store google testers pool-add --dir <app> --track
|
|
253471
|
+
OWNER_POOL_ADD = "himi store google testers pool-add --dir <app> --track himi-pool";
|
|
253380
253472
|
ownerCommand = (base2, pkg) => typeof pkg === "string" && pkg ? `${base2} --android-package ${pkg}` : base2;
|
|
253381
|
-
OWNER_POOL_REMOVE = "himi store google testers pool-remove --dir <app> --track
|
|
253473
|
+
OWNER_POOL_REMOVE = "himi store google testers pool-remove --dir <app> --track himi-pool";
|
|
253382
253474
|
STORE_RELOPS_POOL_USAGE = "himi store relops pool add|status|end --app <id> --site <msid> | himi store relops pool end --all-himi";
|
|
253383
253475
|
readinessLine = (r3) => !r3 ? void 0 : r3.done ? "Closed test: done (14 days, 12 or more installed, production access eligible)." : `Closed test: not done: ${r3.reasons.join("; ")}.`;
|
|
253384
253476
|
text23 = (v2) => typeof v2 === "string" && v2.trim() ? v2.trim() : void 0;
|
|
@@ -255951,17 +256043,17 @@ __export(credential_profile_exports, {
|
|
|
255951
256043
|
});
|
|
255952
256044
|
import { existsSync as existsSync128, readFileSync as readFileSync152 } from "node:fs";
|
|
255953
256045
|
import { homedir as homedir18 } from "node:os";
|
|
255954
|
-
import { join as
|
|
256046
|
+
import { join as join166 } from "node:path";
|
|
255955
256047
|
function credentialsDir(home2 = homedir18()) {
|
|
255956
|
-
return
|
|
256048
|
+
return join166(home2, ".himalaya", "store-credentials");
|
|
255957
256049
|
}
|
|
255958
256050
|
function profilePath(name, home2 = homedir18()) {
|
|
255959
256051
|
if (!PROFILE_NAME2.test(name)) {
|
|
255960
256052
|
throw new Error(
|
|
255961
|
-
`credential profile ${JSON.stringify(name)} is not a profile name \u2014 use letters, digits, ".", "_" or "-" starting with a letter or digit. It names ${
|
|
256053
|
+
`credential profile ${JSON.stringify(name)} is not a profile name \u2014 use letters, digits, ".", "_" or "-" starting with a letter or digit. It names ${join166(credentialsDir(home2), "<name>.json")}; it is never a path.`
|
|
255962
256054
|
);
|
|
255963
256055
|
}
|
|
255964
|
-
return
|
|
256056
|
+
return join166(credentialsDir(home2), `${name}.json`);
|
|
255965
256057
|
}
|
|
255966
256058
|
function parseProfile2(text32, label4) {
|
|
255967
256059
|
let doc;
|
|
@@ -256084,9 +256176,9 @@ function requireExplicitProfile(profileFlag, target) {
|
|
|
256084
256176
|
}
|
|
256085
256177
|
return profile;
|
|
256086
256178
|
}
|
|
256087
|
-
function readKey3(path2, profile,
|
|
256179
|
+
function readKey3(path2, profile, readFile26) {
|
|
256088
256180
|
try {
|
|
256089
|
-
return
|
|
256181
|
+
return readFile26(path2);
|
|
256090
256182
|
} catch {
|
|
256091
256183
|
throw unreadableKey(path2, profile);
|
|
256092
256184
|
}
|
|
@@ -256101,7 +256193,7 @@ function canonicalKeyPath(path2, profile, realpath3) {
|
|
|
256101
256193
|
function resolveIapCredentials(options2) {
|
|
256102
256194
|
const { target } = options2;
|
|
256103
256195
|
const home2 = options2.home ?? homedir19();
|
|
256104
|
-
const
|
|
256196
|
+
const readFile26 = options2.readFile ?? ((p2) => readFileSync153(p2, "utf8"));
|
|
256105
256197
|
const realpath3 = options2.realpath ?? realpathSync20;
|
|
256106
256198
|
const profile = requireExplicitProfile(options2.profileFlag, target);
|
|
256107
256199
|
const creds = resolveStoreCredentials({
|
|
@@ -256110,7 +256202,7 @@ function resolveIapCredentials(options2) {
|
|
|
256110
256202
|
profileFlag: profile,
|
|
256111
256203
|
env: {},
|
|
256112
256204
|
home: home2,
|
|
256113
|
-
readProfile:
|
|
256205
|
+
readProfile: readFile26,
|
|
256114
256206
|
profileExists: options2.exists ?? existsSync129
|
|
256115
256207
|
});
|
|
256116
256208
|
assertCredentialOutsideRepo(`credential profile "${profile}"`, realpath3(profilePath(profile, home2)));
|
|
@@ -256119,7 +256211,7 @@ function resolveIapCredentials(options2) {
|
|
|
256119
256211
|
throw new Error(`credential profile "${profile}" is for team "${creds.team}" but the manifest targets team "${target.teamId}".`);
|
|
256120
256212
|
}
|
|
256121
256213
|
return {
|
|
256122
|
-
key: { keyId: creds.ascKeyId, issuerId: creds.ascIssuerId, privateKeyPem: readKey3(creds.ascKeyPath, profile,
|
|
256214
|
+
key: { keyId: creds.ascKeyId, issuerId: creds.ascIssuerId, privateKeyPem: readKey3(creds.ascKeyPath, profile, readFile26) },
|
|
256123
256215
|
team: creds.team,
|
|
256124
256216
|
profile,
|
|
256125
256217
|
fingerprint: accountFingerprint(creds.ascKeyId, creds.ascIssuerId)
|
|
@@ -256418,7 +256510,7 @@ var init_redact = __esm({
|
|
|
256418
256510
|
|
|
256419
256511
|
// src/iap-config-edit.ts
|
|
256420
256512
|
import { existsSync as existsSync130, readFileSync as readFileSync154 } from "node:fs";
|
|
256421
|
-
import { basename as basename40, join as
|
|
256513
|
+
import { basename as basename40, join as join167 } from "node:path";
|
|
256422
256514
|
import ts24 from "typescript";
|
|
256423
256515
|
function bindPurchasesAppInConfig(source2, options2) {
|
|
256424
256516
|
const fileName = options2.fileName ?? "config.ts";
|
|
@@ -256497,7 +256589,7 @@ function capabilityFinding(app2, fileName) {
|
|
|
256497
256589
|
}
|
|
256498
256590
|
function withStoreBundle(dir, options2) {
|
|
256499
256591
|
if (options2.storeBundleId) return options2;
|
|
256500
|
-
const path2 =
|
|
256592
|
+
const path2 = join167(dir, "store", "store.config.yaml");
|
|
256501
256593
|
if (!existsSync130(path2)) return options2;
|
|
256502
256594
|
const storeBundleId = parseStoreConfig(readFileSync154(path2, "utf8")).ios?.bundleId;
|
|
256503
256595
|
return storeBundleId ? { ...options2, storeBundleId } : options2;
|
|
@@ -257195,7 +257287,7 @@ var init_store_iap_connect = __esm({
|
|
|
257195
257287
|
});
|
|
257196
257288
|
|
|
257197
257289
|
// src/store-iap-screenshots.ts
|
|
257198
|
-
import { dirname as dirname74, join as
|
|
257290
|
+
import { dirname as dirname74, join as join168, relative as relative32 } from "node:path";
|
|
257199
257291
|
function purchaseScreensFor(item2) {
|
|
257200
257292
|
const screen = item2.wix && PURCHASE_SCREENS[item2.wix.entityType];
|
|
257201
257293
|
if (!screen || !item2.wix) return [];
|
|
@@ -257317,7 +257409,7 @@ async function shoot(selected, run4, outDir) {
|
|
|
257317
257409
|
const found = await renderPurchaseScreen(selected, run4);
|
|
257318
257410
|
if ("skipped" in found) return { ...selected.report, skipped: found.skipped };
|
|
257319
257411
|
const report9 = { ...selected.report, screenId: found.screenId };
|
|
257320
|
-
const path2 =
|
|
257412
|
+
const path2 = join168(outDir, `${selected.item.productId}.png`);
|
|
257321
257413
|
try {
|
|
257322
257414
|
run4.writeBytes(path2, await run4.renderer.capture(found.html, run4.contentDir));
|
|
257323
257415
|
} catch (e2) {
|
|
@@ -257335,7 +257427,7 @@ function manifestWithScreenshots(text32, shot) {
|
|
|
257335
257427
|
`;
|
|
257336
257428
|
}
|
|
257337
257429
|
async function takeReviewScreenshots(run4) {
|
|
257338
|
-
const outDir = run4.outDir ??
|
|
257430
|
+
const outDir = run4.outDir ?? join168(dirname74(run4.manifestPath), DEFAULT_OUT_DIR);
|
|
257339
257431
|
const items = unknownOnlyIds(run4);
|
|
257340
257432
|
const shot = /* @__PURE__ */ new Map();
|
|
257341
257433
|
try {
|
|
@@ -257375,7 +257467,7 @@ var init_store_iap_screenshots = __esm({
|
|
|
257375
257467
|
// src/store-iap-screenshot-render.ts
|
|
257376
257468
|
import { existsSync as existsSync131, mkdtempSync as mkdtempSync13, readFileSync as readFileSync155, rmSync as rmSync38 } from "node:fs";
|
|
257377
257469
|
import { tmpdir as tmpdir14 } from "node:os";
|
|
257378
|
-
import { join as
|
|
257470
|
+
import { join as join169 } from "node:path";
|
|
257379
257471
|
function renderProblems(render3, entityId) {
|
|
257380
257472
|
const problems = (render3.liveErrors ?? []).map((e2) => `${e2.service}: ${e2.message}`);
|
|
257381
257473
|
const ofItem = (call) => call.toLowerCase().includes(entityId.toLowerCase());
|
|
@@ -257417,7 +257509,7 @@ function createReviewScreenRenderer() {
|
|
|
257417
257509
|
async render({ contentDir: contentDir2, screenId, input, host, entityId }) {
|
|
257418
257510
|
const { buildReleaseFromContent: buildReleaseFromContent2 } = await Promise.resolve().then(() => (init_build3(), build_exports2));
|
|
257419
257511
|
const tier5Dir = await workerBundles(contentDir2);
|
|
257420
|
-
const out2 = mkdtempSync13(
|
|
257512
|
+
const out2 = mkdtempSync13(join169(tmpdir14(), "himi-iap-shot-"));
|
|
257421
257513
|
try {
|
|
257422
257514
|
const outcome = await buildReleaseFromContent2(contentDir2, out2, {
|
|
257423
257515
|
...tier5Dir ? { tier5Dir } : {},
|
|
@@ -257435,7 +257527,7 @@ function createReviewScreenRenderer() {
|
|
|
257435
257527
|
},
|
|
257436
257528
|
async capture(html, contentDir2) {
|
|
257437
257529
|
const { pngPageHtml: pngPageHtml2, stabilizePngPage: stabilizePngPage2 } = await Promise.resolve().then(() => (init_render_descriptor(), render_descriptor_exports));
|
|
257438
|
-
const tokensPath =
|
|
257530
|
+
const tokensPath = join169(contentDir2, "tokens.json");
|
|
257439
257531
|
const tokens2 = existsSync131(tokensPath) ? JSON.parse(readFileSync155(tokensPath, "utf8")) : null;
|
|
257440
257532
|
const { width, height, scale } = REVIEW_SCREENSHOT_FRAME;
|
|
257441
257533
|
const page = await (await (browser ??= launch())).newPage({ viewport: { width, height }, deviceScaleFactor: scale, colorScheme: "light" });
|
|
@@ -257523,7 +257615,7 @@ import { execFileSync as execFileSync10 } from "node:child_process";
|
|
|
257523
257615
|
import { randomUUID as randomUUID17 } from "node:crypto";
|
|
257524
257616
|
import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync59, readFileSync as readFileSync156, realpathSync as realpathSync21, renameSync as renameSync24, rmSync as rmSync39, writeFileSync as writeFileSync57 } from "node:fs";
|
|
257525
257617
|
import { homedir as homedir20, hostname as hostname7 } from "node:os";
|
|
257526
|
-
import { dirname as dirname75, join as
|
|
257618
|
+
import { dirname as dirname75, join as join170, resolve as resolve108 } from "node:path";
|
|
257527
257619
|
function scrubDeep(value2, scrub) {
|
|
257528
257620
|
if (typeof value2 === "string") return scrub(value2);
|
|
257529
257621
|
if (Array.isArray(value2)) return value2.map((v2) => scrubDeep(v2, scrub));
|
|
@@ -258228,7 +258320,7 @@ function readLockSummary(path2) {
|
|
|
258228
258320
|
}
|
|
258229
258321
|
}
|
|
258230
258322
|
function acquireApplyLock(dir, appleAppId) {
|
|
258231
|
-
const path2 =
|
|
258323
|
+
const path2 = join170(dir, "apply.lock");
|
|
258232
258324
|
const stamp = JSON.stringify({ pid: process.pid, host: hostname7(), at: (/* @__PURE__ */ new Date()).toISOString(), token: randomUUID17() });
|
|
258233
258325
|
try {
|
|
258234
258326
|
writeFileSync57(path2, stamp, { flag: "wx", mode: 384 });
|
|
@@ -258249,7 +258341,7 @@ function acquireApplyLock(dir, appleAppId) {
|
|
|
258249
258341
|
};
|
|
258250
258342
|
}
|
|
258251
258343
|
function stateDir(appleAppId) {
|
|
258252
|
-
const dir =
|
|
258344
|
+
const dir = join170(homedir20(), ".himalaya", "store-iap", appleAppId);
|
|
258253
258345
|
mkdirSync59(dir, { recursive: true, mode: 448 });
|
|
258254
258346
|
return dir;
|
|
258255
258347
|
}
|
|
@@ -258275,7 +258367,7 @@ function defaultStoreIapDeps() {
|
|
|
258275
258367
|
writeFileAtomic,
|
|
258276
258368
|
resolveCredentials: ({ profileFlag, target }) => resolveIapCredentials({ profileFlag, target }),
|
|
258277
258369
|
createApi: (key4) => createIapApi(createAscClient2({ key: key4 })),
|
|
258278
|
-
openJournal: (appleAppId) => fileJournal(
|
|
258370
|
+
openJournal: (appleAppId) => fileJournal(join170(stateDir(appleAppId), "journal.jsonl")),
|
|
258279
258371
|
acquireLock: (appleAppId) => acquireApplyLock(stateDir(appleAppId), appleAppId),
|
|
258280
258372
|
canPrompt: () => process.stdin.isTTY === true,
|
|
258281
258373
|
wixTransport: (siteId) => ownerTransport(siteId),
|
|
@@ -258778,7 +258870,7 @@ __export(preflight_app_exports, {
|
|
|
258778
258870
|
});
|
|
258779
258871
|
import { readFileSync as readFileSync157, existsSync as existsSync132, readdirSync as readdirSync57, statSync as statSync44 } from "node:fs";
|
|
258780
258872
|
import { createHash as createHash85 } from "node:crypto";
|
|
258781
|
-
import { dirname as dirname76, join as
|
|
258873
|
+
import { dirname as dirname76, join as join171 } from "node:path";
|
|
258782
258874
|
function analyze(projectYml, storeConfig, icon, account2, adopted) {
|
|
258783
258875
|
const f2 = [];
|
|
258784
258876
|
const has = (re2, s5) => re2.test(s5);
|
|
@@ -258924,7 +259016,7 @@ function readXcconfigVars(iosDir, projectYml) {
|
|
|
258924
259016
|
for (const raw of readFileSync157(path2, "utf8").split("\n")) {
|
|
258925
259017
|
const inc = /^\s*#include\??\s+"([^"]+)"/.exec(raw);
|
|
258926
259018
|
if (inc) {
|
|
258927
|
-
read2(
|
|
259019
|
+
read2(join171(dirname76(path2), inc[1]));
|
|
258928
259020
|
continue;
|
|
258929
259021
|
}
|
|
258930
259022
|
const line = raw.replace(/\/\/.*$/, "");
|
|
@@ -258932,7 +259024,7 @@ function readXcconfigVars(iosDir, projectYml) {
|
|
|
258932
259024
|
if (kv) vars[kv[1]] = expandVars(kv[2], vars);
|
|
258933
259025
|
}
|
|
258934
259026
|
};
|
|
258935
|
-
for (const m2 of projectYml.matchAll(/^\s*Release:\s*["']?([^"'\s]+\.xcconfig)["']?\s*$/gm)) read2(
|
|
259027
|
+
for (const m2 of projectYml.matchAll(/^\s*Release:\s*["']?([^"'\s]+\.xcconfig)["']?\s*$/gm)) read2(join171(iosDir, m2[1]));
|
|
258936
259028
|
return vars;
|
|
258937
259029
|
}
|
|
258938
259030
|
function profileAccount(app2, storeConfig, opts = {}) {
|
|
@@ -258951,12 +259043,12 @@ async function preflightApp(app2, opts = {}) {
|
|
|
258951
259043
|
const projectYml = existsSync132(iosProjectYml(app2)) ? readFileSync157(iosProjectYml(app2), "utf8") : "";
|
|
258952
259044
|
const storeConfig = existsSync132(storeConfigPath(app2)) ? readFileSync157(storeConfigPath(app2), "utf8") : "";
|
|
258953
259045
|
const adopted = appAdoptedIdentity(app2);
|
|
258954
|
-
const identity = projectYml ? analyzeStoreIdentity(projectYml, storeConfig, readXcconfigVars(
|
|
259046
|
+
const identity = projectYml ? analyzeStoreIdentity(projectYml, storeConfig, readXcconfigVars(join171(appDir(app2), "ios"), projectYml), adopted) : [];
|
|
258955
259047
|
if (!storeConfig) return [{ level: "error", message: `no apps/${app2}/store/store.config.yaml \u2014 run /setup-store-signing first.` }, ...identity];
|
|
258956
259048
|
const findings = analyze(
|
|
258957
259049
|
projectYml,
|
|
258958
259050
|
storeConfig,
|
|
258959
|
-
await appIconState(
|
|
259051
|
+
await appIconState(join171(appDir(app2), "ios")),
|
|
258960
259052
|
profileAccount(app2, storeConfig, opts),
|
|
258961
259053
|
adopted
|
|
258962
259054
|
);
|
|
@@ -258987,16 +259079,16 @@ function analyzeSubmissionRecord(appLevel, review, opts) {
|
|
|
258987
259079
|
return f2;
|
|
258988
259080
|
}
|
|
258989
259081
|
function appLevelMetadataFiles(app2, locale = "en-US") {
|
|
258990
|
-
const root =
|
|
259082
|
+
const root = join171(storeDir(app2), "metadata");
|
|
258991
259083
|
const out2 = /* @__PURE__ */ new Set();
|
|
258992
259084
|
if (existsSync132(root)) {
|
|
258993
259085
|
for (const n2 of readdirSync57(root)) if (n2.endsWith(".txt")) out2.add(n2);
|
|
258994
259086
|
}
|
|
258995
|
-
if (existsSync132(
|
|
259087
|
+
if (existsSync132(join171(root, locale, "privacy_url.txt"))) out2.add("privacy_url.txt");
|
|
258996
259088
|
return out2;
|
|
258997
259089
|
}
|
|
258998
259090
|
function reviewInfoFiles(app2) {
|
|
258999
|
-
const dir =
|
|
259091
|
+
const dir = join171(storeDir(app2), "review_information");
|
|
259000
259092
|
if (!existsSync132(dir)) return /* @__PURE__ */ new Set();
|
|
259001
259093
|
return new Set(readdirSync57(dir).filter((n2) => n2.endsWith(".txt")));
|
|
259002
259094
|
}
|
|
@@ -259107,10 +259199,10 @@ function analyzePlayListing(assets) {
|
|
|
259107
259199
|
return f2;
|
|
259108
259200
|
}
|
|
259109
259201
|
function playListingAssets(app2, locale = "en-US") {
|
|
259110
|
-
const dir =
|
|
259202
|
+
const dir = join171(storeDir(app2), "play", locale, "images");
|
|
259111
259203
|
const read2 = (names2) => {
|
|
259112
259204
|
for (const name of names2) {
|
|
259113
|
-
const p2 =
|
|
259205
|
+
const p2 = join171(dir, name);
|
|
259114
259206
|
try {
|
|
259115
259207
|
if (statSync44(p2).isFile()) return { name, bytes: readFileSync157(p2) };
|
|
259116
259208
|
} catch {
|
|
@@ -259143,26 +259235,26 @@ function analyzeListing(metaFiles, shots) {
|
|
|
259143
259235
|
return f2;
|
|
259144
259236
|
}
|
|
259145
259237
|
function metadataFilesPresent(app2, locale = "en-US") {
|
|
259146
|
-
const dir =
|
|
259238
|
+
const dir = join171(storeDir(app2), "metadata", locale);
|
|
259147
259239
|
if (!existsSync132(dir)) return /* @__PURE__ */ new Set();
|
|
259148
259240
|
return new Set(readdirSync57(dir).filter((n2) => n2.endsWith(".txt")));
|
|
259149
259241
|
}
|
|
259150
259242
|
function listScreenshots(app2, locale = "en-US") {
|
|
259151
259243
|
const out2 = [];
|
|
259152
|
-
const flat2 =
|
|
259244
|
+
const flat2 = join171(storeDir(app2), "screenshots", locale);
|
|
259153
259245
|
if (existsSync132(flat2)) {
|
|
259154
259246
|
for (const png of readdirSync57(flat2).filter((n2) => n2.endsWith(".png"))) {
|
|
259155
|
-
const sz = pngSize3(readFileSync157(
|
|
259247
|
+
const sz = pngSize3(readFileSync157(join171(flat2, png)));
|
|
259156
259248
|
if (sz) out2.push({ name: png, w: sz.w, h: sz.h });
|
|
259157
259249
|
}
|
|
259158
259250
|
}
|
|
259159
|
-
const legacy =
|
|
259251
|
+
const legacy = join171(storeDir(app2), "metadata", locale, "screenshots");
|
|
259160
259252
|
if (existsSync132(legacy)) {
|
|
259161
259253
|
for (const deviceDir of readdirSync57(legacy)) {
|
|
259162
|
-
const d2 =
|
|
259254
|
+
const d2 = join171(legacy, deviceDir);
|
|
259163
259255
|
if (!statSync44(d2).isDirectory()) continue;
|
|
259164
259256
|
for (const png of readdirSync57(d2).filter((n2) => n2.endsWith(".png"))) {
|
|
259165
|
-
const sz = pngSize3(readFileSync157(
|
|
259257
|
+
const sz = pngSize3(readFileSync157(join171(d2, png)));
|
|
259166
259258
|
if (sz) out2.push({ name: `${deviceDir}/${png}`, w: sz.w, h: sz.h });
|
|
259167
259259
|
}
|
|
259168
259260
|
}
|
|
@@ -259170,10 +259262,10 @@ function listScreenshots(app2, locale = "en-US") {
|
|
|
259170
259262
|
return out2;
|
|
259171
259263
|
}
|
|
259172
259264
|
function placeholderHashes2() {
|
|
259173
|
-
const templateIos =
|
|
259265
|
+
const templateIos = join171(appDir("_template"), "ios");
|
|
259174
259266
|
if (!existsSync132(templateIos)) return [LEGACY_PLACEHOLDER_SHA2562];
|
|
259175
259267
|
for (const target of readdirSync57(templateIos)) {
|
|
259176
|
-
const p2 =
|
|
259268
|
+
const p2 = join171(templateIos, target, "Assets.xcassets", "AppIcon.appiconset", "icon_1024.png");
|
|
259177
259269
|
try {
|
|
259178
259270
|
if (!statSync44(p2).isFile()) continue;
|
|
259179
259271
|
return [LEGACY_PLACEHOLDER_SHA2562, createHash85("sha256").update(readFileSync157(p2)).digest("hex")];
|
|
@@ -259209,7 +259301,7 @@ async function pixelIssues(bytes2) {
|
|
|
259209
259301
|
async function appIconState(iosDir) {
|
|
259210
259302
|
if (!existsSync132(iosDir)) return { exists: false, isPlaceholder: false, storeIssues: [] };
|
|
259211
259303
|
for (const target of readdirSync57(iosDir)) {
|
|
259212
|
-
const p2 =
|
|
259304
|
+
const p2 = join171(iosDir, target, "Assets.xcassets", "AppIcon.appiconset", "icon_1024.png");
|
|
259213
259305
|
try {
|
|
259214
259306
|
if (!statSync44(p2).isFile()) continue;
|
|
259215
259307
|
const bytes2 = readFileSync157(p2);
|
|
@@ -259675,12 +259767,12 @@ var init_connector_token = __esm({
|
|
|
259675
259767
|
|
|
259676
259768
|
// ../../core/functions-secrets/src/vault.ts
|
|
259677
259769
|
import { createCipheriv as createCipheriv2, createDecipheriv as createDecipheriv3, randomBytes as randomBytes23 } from "node:crypto";
|
|
259678
|
-
import { mkdir as
|
|
259770
|
+
import { mkdir as mkdir21, readFile as readFile25, rename as rename9, writeFile as writeFile17 } from "node:fs/promises";
|
|
259679
259771
|
import { dirname as dirname77 } from "node:path";
|
|
259680
259772
|
function createJsonSecretStore(filePath) {
|
|
259681
259773
|
const read2 = async () => {
|
|
259682
259774
|
try {
|
|
259683
|
-
const parsed = JSON.parse(await
|
|
259775
|
+
const parsed = JSON.parse(await readFile25(filePath, "utf8"));
|
|
259684
259776
|
if (!Array.isArray(parsed)) throw new Error("secret store must contain an array");
|
|
259685
259777
|
return parsed;
|
|
259686
259778
|
} catch (error) {
|
|
@@ -259689,9 +259781,9 @@ function createJsonSecretStore(filePath) {
|
|
|
259689
259781
|
}
|
|
259690
259782
|
};
|
|
259691
259783
|
const write3 = async (records) => {
|
|
259692
|
-
await
|
|
259784
|
+
await mkdir21(dirname77(filePath), { recursive: true });
|
|
259693
259785
|
const temporary = `${filePath}.${process.pid}.tmp`;
|
|
259694
|
-
await
|
|
259786
|
+
await writeFile17(temporary, `${JSON.stringify(records, null, 2)}
|
|
259695
259787
|
`, { mode: 384 });
|
|
259696
259788
|
await rename9(temporary, filePath);
|
|
259697
259789
|
};
|
|
@@ -260353,9 +260445,9 @@ __export(notify_exports, {
|
|
|
260353
260445
|
});
|
|
260354
260446
|
import { chmodSync as chmodSync6, mkdirSync as mkdirSync60, readFileSync as readFileSync164, writeFileSync as writeFileSync59 } from "node:fs";
|
|
260355
260447
|
import { homedir as homedir21 } from "node:os";
|
|
260356
|
-
import { dirname as dirname78, join as
|
|
260448
|
+
import { dirname as dirname78, join as join176 } from "node:path";
|
|
260357
260449
|
function defaultSessionsPath() {
|
|
260358
|
-
return process.env.HIMI_ADMIN_SESSIONS_FILE ??
|
|
260450
|
+
return process.env.HIMI_ADMIN_SESSIONS_FILE ?? join176(homedir21(), ".himalaya", "admin-sessions.json");
|
|
260359
260451
|
}
|
|
260360
260452
|
function loadSessionsFile(path2 = defaultSessionsPath()) {
|
|
260361
260453
|
try {
|
|
@@ -260757,7 +260849,7 @@ __export(auth_gate_copy_exports, {
|
|
|
260757
260849
|
});
|
|
260758
260850
|
import { createHash as createHash88 } from "node:crypto";
|
|
260759
260851
|
import { existsSync as existsSync136, readdirSync as readdirSync58, readFileSync as readFileSync165, writeFileSync as writeFileSync60 } from "node:fs";
|
|
260760
|
-
import { dirname as dirname79, join as
|
|
260852
|
+
import { dirname as dirname79, join as join177, relative as relative33, resolve as resolve111 } from "node:path";
|
|
260761
260853
|
import { fileURLToPath as fileURLToPath38 } from "node:url";
|
|
260762
260854
|
function discoverMessageSources() {
|
|
260763
260855
|
const roots2 = [
|
|
@@ -260769,7 +260861,7 @@ function discoverMessageSources() {
|
|
|
260769
260861
|
];
|
|
260770
260862
|
const out2 = [];
|
|
260771
260863
|
const visit = (rel2) => {
|
|
260772
|
-
const abs =
|
|
260864
|
+
const abs = join177(REPO_ROOT8, rel2);
|
|
260773
260865
|
if (!existsSync136(abs)) return;
|
|
260774
260866
|
for (const name of readdirSync58(abs, { withFileTypes: true })) {
|
|
260775
260867
|
const child3 = `${rel2}/${name.name}`;
|
|
@@ -260777,7 +260869,7 @@ function discoverMessageSources() {
|
|
|
260777
260869
|
if (/^(?:test|tests|Tests|androidTest|build|node_modules|\.build)$/.test(name.name)) continue;
|
|
260778
260870
|
visit(child3);
|
|
260779
260871
|
} else if (/\.(?:swift|kt)$/.test(name.name) && !GATE_SOURCES.includes(child3)) {
|
|
260780
|
-
if (MESSAGE_FILE.test(readFileSync165(
|
|
260872
|
+
if (MESSAGE_FILE.test(readFileSync165(join177(REPO_ROOT8, child3), "utf8"))) out2.push(child3);
|
|
260781
260873
|
}
|
|
260782
260874
|
}
|
|
260783
260875
|
};
|
|
@@ -260850,11 +260942,11 @@ function injectGateRows(catalog4, table = loadTable()) {
|
|
|
260850
260942
|
return { ...catalog4, messages: sorted3 };
|
|
260851
260943
|
}
|
|
260852
260944
|
function appSourceCatalogs() {
|
|
260853
|
-
const appsDir =
|
|
260854
|
-
return readdirSync58(appsDir).sort().map((app2) =>
|
|
260945
|
+
const appsDir = join177(REPO_ROOT8, "apps");
|
|
260946
|
+
return readdirSync58(appsDir).sort().map((app2) => join177(appsDir, app2, "l10n", "en.json")).filter((p2) => existsSync136(p2));
|
|
260855
260947
|
}
|
|
260856
260948
|
function nativeKeysPath(appDir3) {
|
|
260857
|
-
return
|
|
260949
|
+
return join177(appDir3, "l10n", "native-keys.json");
|
|
260858
260950
|
}
|
|
260859
260951
|
function loadNativeKeys(appDir3) {
|
|
260860
260952
|
const p2 = nativeKeysPath(appDir3);
|
|
@@ -260866,7 +260958,7 @@ function loadNativeKeys(appDir3) {
|
|
|
260866
260958
|
return raw.keys;
|
|
260867
260959
|
}
|
|
260868
260960
|
function loadAppTable(appDir3) {
|
|
260869
|
-
const p2 =
|
|
260961
|
+
const p2 = join177(appDir3, "strings", "en.json");
|
|
260870
260962
|
if (!existsSync136(p2)) return {};
|
|
260871
260963
|
const raw = JSON.parse(readFileSync165(p2, "utf8"));
|
|
260872
260964
|
const out2 = {};
|
|
@@ -261064,7 +261156,7 @@ function loadAllow(section3, path2 = ALLOW_PATH) {
|
|
|
261064
261156
|
}
|
|
261065
261157
|
return list5;
|
|
261066
261158
|
}
|
|
261067
|
-
function scanProse(files, allow = [], read2 = (rel2) => readFileSync165(
|
|
261159
|
+
function scanProse(files, allow = [], read2 = (rel2) => readFileSync165(join177(REPO_ROOT8, rel2), "utf8")) {
|
|
261068
261160
|
const hits = [];
|
|
261069
261161
|
const usedAllow = /* @__PURE__ */ new Set();
|
|
261070
261162
|
for (const file2 of files) {
|
|
@@ -261083,7 +261175,7 @@ function scanProse(files, allow = [], read2 = (rel2) => readFileSync165(join176(
|
|
|
261083
261175
|
}
|
|
261084
261176
|
function expectedOutputs(table = loadTable()) {
|
|
261085
261177
|
const out2 = [
|
|
261086
|
-
{ path:
|
|
261178
|
+
{ path: join177(REPO_ROOT8, "stdlib/flows/auth/src/copy.generated.ts"), content: "// Generated by tools/l10n/auth-gate-copy.ts. Do not edit.\nexport default " + JSON.stringify(table, null, 2) + " as const;\n" },
|
|
261087
261179
|
{ path: SWIFT_OUT, content: renderSwift(table) },
|
|
261088
261180
|
{ path: KOTLIN_OUT, content: renderKotlin(table) }
|
|
261089
261181
|
];
|
|
@@ -261093,7 +261185,7 @@ function expectedOutputs(table = loadTable()) {
|
|
|
261093
261185
|
}
|
|
261094
261186
|
return out2;
|
|
261095
261187
|
}
|
|
261096
|
-
function scanThrownMessages(files, read2 = (rel2) => readFileSync165(
|
|
261188
|
+
function scanThrownMessages(files, read2 = (rel2) => readFileSync165(join177(REPO_ROOT8, rel2), "utf8")) {
|
|
261097
261189
|
const out2 = [];
|
|
261098
261190
|
for (const file2 of files) {
|
|
261099
261191
|
const src = read2(file2);
|
|
@@ -261114,12 +261206,12 @@ var init_auth_gate_copy = __esm({
|
|
|
261114
261206
|
init_define_HHP_CATALOG();
|
|
261115
261207
|
HERE5 = dirname79(fileURLToPath38(import.meta.url));
|
|
261116
261208
|
REPO_ROOT8 = resolve111(HERE5, "../..");
|
|
261117
|
-
TABLE_PATH =
|
|
261118
|
-
SWIFT_OUT =
|
|
261209
|
+
TABLE_PATH = join177(REPO_ROOT8, "core/runtime/l10n/auth-gate/en.json");
|
|
261210
|
+
SWIFT_OUT = join177(
|
|
261119
261211
|
REPO_ROOT8,
|
|
261120
261212
|
"core/runtime/ios/HimalayaCore/Sources/HimalayaCore/AuthGateCopyDefaults.generated.swift"
|
|
261121
261213
|
);
|
|
261122
|
-
KOTLIN_OUT =
|
|
261214
|
+
KOTLIN_OUT = join177(
|
|
261123
261215
|
REPO_ROOT8,
|
|
261124
261216
|
"core/runtime/android/io/himalaya/core/src/main/kotlin/io/himalaya/core/AuthGateCopyDefaults.generated.kt"
|
|
261125
261217
|
);
|
|
@@ -261182,14 +261274,14 @@ var init_auth_gate_copy = __esm({
|
|
|
261182
261274
|
"setRequestProperty"
|
|
261183
261275
|
]);
|
|
261184
261276
|
LOG_LEVELS = /* @__PURE__ */ new Set(["d", "i", "w", "e", "v"]);
|
|
261185
|
-
ALLOW_PATH =
|
|
261277
|
+
ALLOW_PATH = join177(HERE5, "auth-gate-copy.allow.json");
|
|
261186
261278
|
if (false) main();
|
|
261187
261279
|
MESSAGE_SITE = /NativeAuthError\.|NativeAuthException\(|BiometricException\(|\.retrieve\(|reason:|message:|\bcase\s+\.[A-Za-z]+[^:\n]*:\s*return\s+(?:m\.isEmpty\s*\?\s*)?"/;
|
|
261188
261280
|
}
|
|
261189
261281
|
});
|
|
261190
261282
|
|
|
261191
261283
|
// ../l10n/extract.ts
|
|
261192
|
-
import { resolve as resolve112, join as
|
|
261284
|
+
import { resolve as resolve112, join as join178, relative as relative34, dirname as dirname80 } from "node:path";
|
|
261193
261285
|
import { createHash as createHash89 } from "node:crypto";
|
|
261194
261286
|
import { fileURLToPath as fileURLToPath39 } from "node:url";
|
|
261195
261287
|
function keyOf3(source2) {
|
|
@@ -261575,7 +261667,7 @@ __export(base44_adopt_exports, {
|
|
|
261575
261667
|
runBase44Adopt: () => runBase44Adopt
|
|
261576
261668
|
});
|
|
261577
261669
|
import { existsSync as existsSync138, readFileSync as readFileSync167, writeFileSync as writeFileSync62 } from "node:fs";
|
|
261578
|
-
import { join as
|
|
261670
|
+
import { join as join180, resolve as resolve114 } from "node:path";
|
|
261579
261671
|
function prop(entity, key4) {
|
|
261580
261672
|
const props2 = entity.schema?.properties;
|
|
261581
261673
|
const p2 = props2 && typeof props2 === "object" ? props2[key4] : void 0;
|
|
@@ -261666,7 +261758,7 @@ function renderAdoptModule(r3, source2 = ".himi/base44-book/book.json") {
|
|
|
261666
261758
|
}
|
|
261667
261759
|
function runBase44Adopt(opts) {
|
|
261668
261760
|
const bookDir = resolve114(opts.cwd, opts.book ?? ".himi/base44-book");
|
|
261669
|
-
const bookPath =
|
|
261761
|
+
const bookPath = join180(bookDir, "book.json");
|
|
261670
261762
|
let book;
|
|
261671
261763
|
try {
|
|
261672
261764
|
book = JSON.parse(readFileSync167(bookPath, "utf8"));
|
|
@@ -261679,10 +261771,10 @@ function runBase44Adopt(opts) {
|
|
|
261679
261771
|
throw new AdoptError("unknown_entity", `--entities names ${unknown.map((n2) => `"${n2}"`).join(", ")}, which the book does not have`, 2, { known: book.entities.map((e2) => e2.name) });
|
|
261680
261772
|
}
|
|
261681
261773
|
const result = adoptFromBook(book, { only: opts.only, app: opts.app });
|
|
261682
|
-
const module = renderAdoptModule(result, opts.book ?
|
|
261774
|
+
const module = renderAdoptModule(result, opts.book ? join180(opts.book, "book.json") : void 0);
|
|
261683
261775
|
const issues = validateBase44Entities({ entities: result.entities, functions: result.functions }, opts.app);
|
|
261684
261776
|
if (opts.write === void 0 || opts.write === false || issues.some((i2) => i2.severity === "error")) return { result, module, issues };
|
|
261685
|
-
const target = typeof opts.write === "string" ? resolve114(opts.cwd, opts.write) :
|
|
261777
|
+
const target = typeof opts.write === "string" ? resolve114(opts.cwd, opts.write) : join180(opts.cwd, ADOPT_MODULE_FILENAME);
|
|
261686
261778
|
if (existsSync138(target)) {
|
|
261687
261779
|
throw new AdoptError("adopt_target_exists", `${target} already exists \u2014 adopt never overwrites. Delete or rename it, or pass --write <other path>.`, 1, { path: target });
|
|
261688
261780
|
}
|
|
@@ -261935,7 +262027,7 @@ __export(generate_exports, {
|
|
|
261935
262027
|
});
|
|
261936
262028
|
import { createHash as createHash90 } from "node:crypto";
|
|
261937
262029
|
import { existsSync as existsSync139, mkdirSync as mkdirSync62, readdirSync as readdirSync60, readFileSync as readFileSync168, writeFileSync as writeFileSync63 } from "node:fs";
|
|
261938
|
-
import { dirname as dirname82, join as
|
|
262030
|
+
import { dirname as dirname82, join as join181 } from "node:path";
|
|
261939
262031
|
function withHeader(body) {
|
|
261940
262032
|
return `${GENERATED_HEADER}${sha2568(body)}
|
|
261941
262033
|
${body}`;
|
|
@@ -262058,7 +262150,7 @@ function renderAll(sp) {
|
|
|
262058
262150
|
function writeGenerated2(dir, files, opts = {}) {
|
|
262059
262151
|
const out2 = [];
|
|
262060
262152
|
for (const f2 of files) {
|
|
262061
|
-
const abs =
|
|
262153
|
+
const abs = join181(dir, f2.path);
|
|
262062
262154
|
const next = withHeader(f2.body);
|
|
262063
262155
|
let outcome;
|
|
262064
262156
|
if (!existsSync139(abs)) outcome = "written";
|
|
@@ -262079,16 +262171,16 @@ function writeGenerated2(dir, files, opts = {}) {
|
|
|
262079
262171
|
function orphanedFiles(dir, current) {
|
|
262080
262172
|
const keep = new Set(current.map((f2) => f2.path));
|
|
262081
262173
|
const found = [];
|
|
262082
|
-
const t5 =
|
|
262174
|
+
const t5 = join181(dir, "tier5-src");
|
|
262083
262175
|
if (!existsSync139(t5)) return found;
|
|
262084
262176
|
const candidates = readdirSync60(t5).filter((d2) => d2.startsWith("b44-")).map((d2) => `tier5-src/${d2}/index.ts`);
|
|
262085
|
-
const shared =
|
|
262177
|
+
const shared = join181(t5, "_shared");
|
|
262086
262178
|
if (existsSync139(shared)) {
|
|
262087
262179
|
for (const f2 of readdirSync60(shared)) if (/^b44-.*-plan\.ts$/.test(f2)) candidates.push(`tier5-src/_shared/${f2}`);
|
|
262088
262180
|
}
|
|
262089
262181
|
for (const rel2 of candidates.sort()) {
|
|
262090
|
-
if (keep.has(rel2) || !existsSync139(
|
|
262091
|
-
if (readFileSync168(
|
|
262182
|
+
if (keep.has(rel2) || !existsSync139(join181(dir, rel2))) continue;
|
|
262183
|
+
if (readFileSync168(join181(dir, rel2), "utf8").startsWith(GENERATED_HEADER)) found.push(rel2);
|
|
262092
262184
|
}
|
|
262093
262185
|
return found;
|
|
262094
262186
|
}
|
|
@@ -262129,12 +262221,12 @@ __export(base44_auth_exports, {
|
|
|
262129
262221
|
});
|
|
262130
262222
|
import { chmodSync as chmodSync7, existsSync as existsSync140, mkdirSync as mkdirSync63, readFileSync as readFileSync169, rmSync as rmSync41, writeFileSync as writeFileSync64 } from "node:fs";
|
|
262131
262223
|
import { homedir as homedir22 } from "node:os";
|
|
262132
|
-
import { dirname as dirname83, join as
|
|
262224
|
+
import { dirname as dirname83, join as join182 } from "node:path";
|
|
262133
262225
|
function base44ApiBase(env = process.env) {
|
|
262134
262226
|
return (env.BASE44_API_URL?.trim() || "https://app.base44.com").replace(/\/+$/, "");
|
|
262135
262227
|
}
|
|
262136
262228
|
function base44SessionPath(home2 = homedir22()) {
|
|
262137
|
-
return
|
|
262229
|
+
return join182(home2, ".himi", "base44", "session.json");
|
|
262138
262230
|
}
|
|
262139
262231
|
function readBase44Session(home2) {
|
|
262140
262232
|
const p2 = base44SessionPath(home2);
|
|
@@ -262258,7 +262350,7 @@ function hasBase44WriteScope(auth) {
|
|
|
262258
262350
|
return scopes.includes("apps:write");
|
|
262259
262351
|
}
|
|
262260
262352
|
function importBase44CliSession(home2 = homedir22(), env = process.env) {
|
|
262261
|
-
const src =
|
|
262353
|
+
const src = join182(home2, ".base44", "auth", "auth.json");
|
|
262262
262354
|
if (!existsSync140(src)) throw new Error(`no Base44 CLI session at ${src} \u2014 run \`npx base44 login\` first, or use \`himi base44 login\``);
|
|
262263
262355
|
const a3 = JSON.parse(readFileSync169(src, "utf8"));
|
|
262264
262356
|
if (typeof a3.accessToken !== "string" || !a3.accessToken) throw new Error(`${src} holds no access token`);
|
|
@@ -262360,9 +262452,9 @@ __export(seed_exports, {
|
|
|
262360
262452
|
writeBase44SeedRows: () => writeBase44SeedRows
|
|
262361
262453
|
});
|
|
262362
262454
|
import { existsSync as existsSync141, readFileSync as readFileSync170, writeFileSync as writeFileSync65 } from "node:fs";
|
|
262363
|
-
import { join as
|
|
262455
|
+
import { join as join183 } from "node:path";
|
|
262364
262456
|
function readBase44SeedFile(dir) {
|
|
262365
|
-
const file2 =
|
|
262457
|
+
const file2 = join183(dir, BASE44_SEED_FILE);
|
|
262366
262458
|
if (!existsSync141(file2)) return {};
|
|
262367
262459
|
let parsed;
|
|
262368
262460
|
try {
|
|
@@ -262517,7 +262609,7 @@ function placeholder2(f2, i2) {
|
|
|
262517
262609
|
}
|
|
262518
262610
|
function writeBase44SeedRows(opts) {
|
|
262519
262611
|
const { dir, app: app2, count: count3 = 8 } = opts;
|
|
262520
|
-
const path2 =
|
|
262612
|
+
const path2 = join183(dir, BASE44_SEED_FILE);
|
|
262521
262613
|
const owned = opts.entities.filter((s5) => !!s5 && typeof s5 === "object" && isOwnedEntity(s5) && (!opts.only || opts.only.includes(physicalEntityName(s5, app2)) || opts.only.includes(s5.name ?? "")));
|
|
262522
262614
|
if (!owned.length) {
|
|
262523
262615
|
return { ok: false, path: path2, entities: {}, agentPrompt: "", next: [], note: opts.only ? `--only ${opts.only.join(",")} matched no owned entity` : `no owned Base44 entities declared \u2014 add one with \`name\` (physically ${base44Prefix(app2)}<Name>). Adopted entities are never seeded.` };
|
|
@@ -262881,14 +262973,14 @@ __export(functions_exports2, {
|
|
|
262881
262973
|
readFunctionSource: () => readFunctionSource
|
|
262882
262974
|
});
|
|
262883
262975
|
import { existsSync as existsSync142, lstatSync as lstatSync38 } from "node:fs";
|
|
262884
|
-
import { join as
|
|
262976
|
+
import { join as join184 } from "node:path";
|
|
262885
262977
|
function markerContent(app2) {
|
|
262886
262978
|
return `${JSON.stringify({ app: app2, by: "himi" })}
|
|
262887
262979
|
`;
|
|
262888
262980
|
}
|
|
262889
262981
|
function readFunctionSource(appDir3, name, app2) {
|
|
262890
262982
|
const rel2 = `base44/functions/${name}/`;
|
|
262891
|
-
const folder =
|
|
262983
|
+
const folder = join184(appDir3, "base44", "functions", name);
|
|
262892
262984
|
if (!existsSync142(folder) || !lstatSync38(folder).isDirectory()) throw new FunctionSourceError("function_source_missing", `no source folder at ${rel2}`);
|
|
262893
262985
|
const { entries, skipped } = collectAppSource(folder);
|
|
262894
262986
|
if (skipped.length) throw new FunctionSourceError("function_source_unsafe", `${rel2} holds paths himi will not upload (symlinks or denied names): ${skipped.join(", ")} \u2014 remove them`);
|
|
@@ -263231,9 +263323,9 @@ __export(apply_exports2, {
|
|
|
263231
263323
|
fileLedger: () => fileLedger
|
|
263232
263324
|
});
|
|
263233
263325
|
import { existsSync as existsSync143, readFileSync as readFileSync171, writeFileSync as writeFileSync66 } from "node:fs";
|
|
263234
|
-
import { join as
|
|
263326
|
+
import { join as join185 } from "node:path";
|
|
263235
263327
|
function fileLedger(dir, appId3) {
|
|
263236
|
-
const path2 =
|
|
263328
|
+
const path2 = join185(dir, LEDGER_FILE2);
|
|
263237
263329
|
const load6 = () => {
|
|
263238
263330
|
if (!existsSync143(path2)) return {};
|
|
263239
263331
|
let v2;
|
|
@@ -263891,10 +263983,10 @@ var init_analyze = __esm({
|
|
|
263891
263983
|
|
|
263892
263984
|
// src/base44-analyze/write-artifacts.ts
|
|
263893
263985
|
import { existsSync as existsSync144, mkdirSync as mkdirSync64, readFileSync as readFileSync172, rmSync as rmSync42, writeFileSync as writeFileSync67 } from "node:fs";
|
|
263894
|
-
import { dirname as dirname84, join as
|
|
263986
|
+
import { dirname as dirname84, join as join186, resolve as resolve115, sep as sep33 } from "node:path";
|
|
263895
263987
|
function isBookFolder(dir) {
|
|
263896
263988
|
try {
|
|
263897
|
-
return JSON.parse(readFileSync172(
|
|
263989
|
+
return JSON.parse(readFileSync172(join186(dir, "book.json"), "utf8")).kind === "base44-app-book";
|
|
263898
263990
|
} catch {
|
|
263899
263991
|
return false;
|
|
263900
263992
|
}
|
|
@@ -263981,24 +264073,24 @@ function writeBase44Book(result, outDir, opts = {}) {
|
|
|
263981
264073
|
const md = renderBookMd(book);
|
|
263982
264074
|
assertNoSecrets(json9);
|
|
263983
264075
|
assertNoSecrets(md);
|
|
263984
|
-
const owned = ["book.json", "BOOK.md", "source", "screenshots"].filter((n2) => existsSync144(
|
|
264076
|
+
const owned = ["book.json", "BOOK.md", "source", "screenshots"].filter((n2) => existsSync144(join186(out2, n2)));
|
|
263985
264077
|
if (owned.length) {
|
|
263986
264078
|
if (!isBookFolder(out2)) throw new Error(`refusing to write the app book into ${out2}: it already has ${owned.join(", ")} that ${owned.length === 1 ? "is" : "are"} not from an app book \u2014 pick an empty --out`);
|
|
263987
|
-
for (const d2 of ["source", "screenshots"]) rmSync42(
|
|
264079
|
+
for (const d2 of ["source", "screenshots"]) rmSync42(join186(out2, d2), { recursive: true, force: true });
|
|
263988
264080
|
}
|
|
263989
264081
|
mkdirSync64(out2, { recursive: true });
|
|
263990
|
-
writeFileSync67(
|
|
263991
|
-
writeFileSync67(
|
|
264082
|
+
writeFileSync67(join186(out2, "book.json"), json9);
|
|
264083
|
+
writeFileSync67(join186(out2, "BOOK.md"), md);
|
|
263992
264084
|
files.push("book.json", "BOOK.md");
|
|
263993
264085
|
for (const s5 of shots) {
|
|
263994
|
-
mkdirSync64(
|
|
263995
|
-
writeFileSync67(
|
|
264086
|
+
mkdirSync64(join186(out2, "screenshots"), { recursive: true });
|
|
264087
|
+
writeFileSync67(join186(out2, "screenshots", s5.filename), s5.bytes);
|
|
263996
264088
|
files.push(`screenshots/${s5.filename}`);
|
|
263997
264089
|
}
|
|
263998
|
-
const sourceRoot =
|
|
264090
|
+
const sourceRoot = join186(out2, "source");
|
|
263999
264091
|
for (const f2 of result.sourceFiles) {
|
|
264000
264092
|
if (!safeRel(f2.path)) continue;
|
|
264001
|
-
const dest =
|
|
264093
|
+
const dest = join186(sourceRoot, ...f2.path.split("/"));
|
|
264002
264094
|
if (!dest.startsWith(sourceRoot + sep33)) continue;
|
|
264003
264095
|
mkdirSync64(dirname84(dest), { recursive: true });
|
|
264004
264096
|
writeFileSync67(dest, f2.bytes);
|
|
@@ -267549,7 +267641,7 @@ __export(cli_exports, {
|
|
|
267549
267641
|
import { execFile as execFile7 } from "node:child_process";
|
|
267550
267642
|
import { mkdirSync as mkdirSync65, mkdtempSync as mkdtempSync14, rmSync as rmSync43, writeFileSync as writeFileSync68 } from "node:fs";
|
|
267551
267643
|
import { tmpdir as tmpdir15 } from "node:os";
|
|
267552
|
-
import { join as
|
|
267644
|
+
import { join as join187, resolve as resolve116 } from "node:path";
|
|
267553
267645
|
import { promisify as promisify2 } from "node:util";
|
|
267554
267646
|
function projectDownloader(apiFetch, apiBase, token, extract = systemTar) {
|
|
267555
267647
|
return async (appId3) => {
|
|
@@ -267562,11 +267654,11 @@ function projectDownloader(apiFetch, apiBase, token, extract = systemTar) {
|
|
|
267562
267654
|
}
|
|
267563
267655
|
const bytes2 = await readCapped(res, MAX_TARBALL_BYTES);
|
|
267564
267656
|
if (!bytes2) throw new Error(`project download is over the ${MAX_TARBALL_BYTES}-byte cap`);
|
|
267565
|
-
const root = mkdtempSync14(
|
|
267657
|
+
const root = mkdtempSync14(join187(tmpdir15(), "himi-base44-"));
|
|
267566
267658
|
const cleanup = () => rmSync43(root, { recursive: true, force: true });
|
|
267567
267659
|
try {
|
|
267568
|
-
const archive =
|
|
267569
|
-
const dir =
|
|
267660
|
+
const archive = join187(root, "project.tar");
|
|
267661
|
+
const dir = join187(root, "project");
|
|
267570
267662
|
writeFileSync68(archive, bytes2);
|
|
267571
267663
|
mkdirSync65(dir);
|
|
267572
267664
|
await extract(archive, dir);
|
|
@@ -268882,7 +268974,7 @@ var init_invite_plan = __esm({
|
|
|
268882
268974
|
|
|
268883
268975
|
// src/one-app/header-badges-cli.ts
|
|
268884
268976
|
import { existsSync as existsSync146, readFileSync as readFileSync173, rmSync as rmSync44, statSync as statSync47, writeFileSync as writeFileSync69 } from "node:fs";
|
|
268885
|
-
import { join as
|
|
268977
|
+
import { join as join189, resolve as resolve118 } from "node:path";
|
|
268886
268978
|
function parseArgs4(args) {
|
|
268887
268979
|
let evidenceDir;
|
|
268888
268980
|
let contentDir2;
|
|
@@ -268908,7 +269000,7 @@ function parseArgs4(args) {
|
|
|
268908
269000
|
return { evidenceDir: resolve118(evidenceDir), contentDir: resolve118(contentDir2), dryRun };
|
|
268909
269001
|
}
|
|
268910
269002
|
function contentScreens(contentDir2) {
|
|
268911
|
-
const path2 =
|
|
269003
|
+
const path2 = join189(contentDir2, "himalaya.content.json");
|
|
268912
269004
|
if (!existsSync146(path2)) throw new Error("himalaya.content.json not found: --content must be a Himi content package");
|
|
268913
269005
|
const parsed = JSON.parse(readFileSync173(path2, "utf8"));
|
|
268914
269006
|
return new Set(Object.keys(parsed.screens ?? {}));
|
|
@@ -268939,7 +269031,7 @@ function mapCoverage(evidenceDir, contentDir2, plan, bound2, dryRun) {
|
|
|
268939
269031
|
mapped++;
|
|
268940
269032
|
} else conflicts.push(`${source2.buttonId ?? source2.source}: already mapped to ${row2.target.screenId}/${row2.target.controlId ?? "?"}, not ${target.screenId}/${target.controlId}`);
|
|
268941
269033
|
}
|
|
268942
|
-
if (mapped && !dryRun) writeFileSync69(
|
|
269034
|
+
if (mapped && !dryRun) writeFileSync69(join189(resolve118(contentDir2), COVERAGE_FILE), JSON.stringify(coverage2, null, 2) + "\n");
|
|
268943
269035
|
return { mapped, kept, conflicts };
|
|
268944
269036
|
}
|
|
268945
269037
|
function report4(io2, ok5, body) {
|
|
@@ -268977,7 +269069,7 @@ async function runOneAppHeaderBadges(args, io2) {
|
|
|
268977
269069
|
note: plan.unmapped.length ? "No bell, chat or cart badge was found; the unmapped badge buttons still need an authored counter or an explicit decision." : unverified.length ? `No badge was found, and the ${unverified.join(" and ")} runtime view was not collected: whether the source header has a bell, chat or cart badge is unverified. Nothing was changed.` : "The source header has no badges, so nothing was changed."
|
|
268978
269070
|
});
|
|
268979
269071
|
}
|
|
268980
|
-
const configPath =
|
|
269072
|
+
const configPath = join189(options2.contentDir, "config.ts");
|
|
268981
269073
|
let screens;
|
|
268982
269074
|
let configText;
|
|
268983
269075
|
try {
|
|
@@ -268997,7 +269089,7 @@ async function runOneAppHeaderBadges(args, io2) {
|
|
|
268997
269089
|
if (!bindable.length) {
|
|
268998
269090
|
return report4(io2, true, { status: "nothing_to_bind", headerBadges: [], skipped, ...common2 });
|
|
268999
269091
|
}
|
|
269000
|
-
const workerSource =
|
|
269092
|
+
const workerSource = join189(options2.contentDir, "tier5-src", HEADER_BADGES_BUNDLE, "index.ts");
|
|
269001
269093
|
if (!existsSync146(workerSource)) {
|
|
269002
269094
|
return report4(io2, false, {
|
|
269003
269095
|
code: "worker_missing",
|
|
@@ -269019,7 +269111,7 @@ async function runOneAppHeaderBadges(args, io2) {
|
|
|
269019
269111
|
snippet: patch.snippet
|
|
269020
269112
|
});
|
|
269021
269113
|
}
|
|
269022
|
-
const ledgerPath =
|
|
269114
|
+
const ledgerPath = join189(resolve118(options2.contentDir), COVERAGE_FILE);
|
|
269023
269115
|
let ledgerBefore = null;
|
|
269024
269116
|
let coverage2;
|
|
269025
269117
|
try {
|
|
@@ -269072,7 +269164,7 @@ var init_header_badges_cli = __esm({
|
|
|
269072
269164
|
|
|
269073
269165
|
// src/one-app/recipes.ts
|
|
269074
269166
|
import { existsSync as existsSync147, readFileSync as readFileSync174 } from "node:fs";
|
|
269075
|
-
import { join as
|
|
269167
|
+
import { join as join190 } from "node:path";
|
|
269076
269168
|
function readRecipe(contentDir2, name, values) {
|
|
269077
269169
|
return readParts(contentDir2, name, values, "node");
|
|
269078
269170
|
}
|
|
@@ -269081,7 +269173,7 @@ function readRecipeNodes(contentDir2, name, values) {
|
|
|
269081
269173
|
}
|
|
269082
269174
|
function readParts(contentDir2, name, values, key4) {
|
|
269083
269175
|
if (!/^[a-z0-9][a-z0-9-]*$/.test(name)) throw new RecipeError(`"${name}" is not a recipe name`);
|
|
269084
|
-
const path2 =
|
|
269176
|
+
const path2 = join190(contentDir2, "recipes", `${name}.json`);
|
|
269085
269177
|
if (!existsSync147(path2)) {
|
|
269086
269178
|
throw new RecipeError(`recipes/${name}.json is missing: this scaffold does not ship that recipe, so the section keeps its title and a See All link.`);
|
|
269087
269179
|
}
|
|
@@ -270529,7 +270621,7 @@ __export(validate_identity_exports, {
|
|
|
270529
270621
|
import { createHash as createHash93 } from "node:crypto";
|
|
270530
270622
|
import { existsSync as existsSync148, readFileSync as readFileSync175, writeFileSync as writeFileSync70 } from "node:fs";
|
|
270531
270623
|
import ts25 from "typescript";
|
|
270532
|
-
import { join as
|
|
270624
|
+
import { join as join191, resolve as resolve119 } from "node:path";
|
|
270533
270625
|
function ricosTexts(documentJson) {
|
|
270534
270626
|
let root;
|
|
270535
270627
|
try {
|
|
@@ -270613,7 +270705,7 @@ function fixAppName(configSource, slug, displayName3) {
|
|
|
270613
270705
|
}
|
|
270614
270706
|
function sourceIdentity(evidenceDir) {
|
|
270615
270707
|
const { manifest: manifest2, raw } = verifiedEvidence(evidenceDir);
|
|
270616
|
-
const bytes2 = readFileSync175(
|
|
270708
|
+
const bytes2 = readFileSync175(join191(evidenceDir, "business-context.json"));
|
|
270617
270709
|
const hash3 = createHash93("sha256").update(bytes2).digest("hex");
|
|
270618
270710
|
if (obj12(manifest2.sha256)["business-context.json"] !== hash3) throw Error("business-context.json differs from the collected evidence.");
|
|
270619
270711
|
const name = obj12(JSON.parse(bytes2.toString("utf8"))).displayName;
|
|
@@ -270632,7 +270724,7 @@ function sourceIdentity(evidenceDir) {
|
|
|
270632
270724
|
const settings = obj12(obj12(value2).settings);
|
|
270633
270725
|
for (const key4 of ["title", "subtitle", "label", "text", "description"]) copy(settings[key4]);
|
|
270634
270726
|
}
|
|
270635
|
-
const pagesPath =
|
|
270727
|
+
const pagesPath = join191(evidenceDir, "pages-content.json");
|
|
270636
270728
|
if (existsSync148(pagesPath)) {
|
|
270637
270729
|
const pagesBytes = readFileSync175(pagesPath);
|
|
270638
270730
|
if (obj12(manifest2.sha256)["pages-content.json"] !== createHash93("sha256").update(pagesBytes).digest("hex")) throw Error("pages-content.json differs from the collected evidence.");
|
|
@@ -270678,7 +270770,7 @@ async function runOneAppIdentityValidation(args, io2) {
|
|
|
270678
270770
|
const content = resolve119(values.get("--content"));
|
|
270679
270771
|
const slug = readContentManifest(content)?.name;
|
|
270680
270772
|
if (!isValidAppId(slug)) throw Error("A technical app slug is required in himalaya.content.json.");
|
|
270681
|
-
const configPath =
|
|
270773
|
+
const configPath = join191(content, "config.ts");
|
|
270682
270774
|
let appName2;
|
|
270683
270775
|
if (existsSync148(configPath)) {
|
|
270684
270776
|
const correction = fixAppName(readFileSync175(configPath, "utf8"), slug, identity.displayName);
|
|
@@ -270741,12 +270833,12 @@ var init_validate_identity = __esm({
|
|
|
270741
270833
|
|
|
270742
270834
|
// src/one-app/invite-flow.ts
|
|
270743
270835
|
import { existsSync as existsSync149, lstatSync as lstatSync39, readFileSync as readFileSync176, readdirSync as readdirSync61 } from "node:fs";
|
|
270744
|
-
import { join as
|
|
270836
|
+
import { join as join192 } from "node:path";
|
|
270745
270837
|
import ts26 from "typescript";
|
|
270746
270838
|
function assertNoSymlink(dir, rel2) {
|
|
270747
270839
|
let current = dir;
|
|
270748
270840
|
for (const part5 of rel2.split("/")) {
|
|
270749
|
-
current =
|
|
270841
|
+
current = join192(current, part5);
|
|
270750
270842
|
if (existsSync149(current) && lstatSync39(current).isSymbolicLink()) throw new Error(`${rel2} goes through a symlink (${part5}): refusing to read or write it`);
|
|
270751
270843
|
}
|
|
270752
270844
|
}
|
|
@@ -270801,14 +270893,14 @@ function inviteNavMount(businessId) {
|
|
|
270801
270893
|
].join("\n");
|
|
270802
270894
|
}
|
|
270803
270895
|
function l10nFiles(dir) {
|
|
270804
|
-
const l10n =
|
|
270896
|
+
const l10n = join192(dir, "l10n");
|
|
270805
270897
|
return existsSync149(l10n) ? readdirSync61(l10n).filter((name) => /^[a-z]{2,3}(-[A-Za-z0-9]+)?\.json$/.test(name)) : [];
|
|
270806
270898
|
}
|
|
270807
270899
|
function translateShareLabel(dir) {
|
|
270808
|
-
const l10n =
|
|
270900
|
+
const l10n = join192(dir, "l10n"), written = [];
|
|
270809
270901
|
for (const file2 of l10nFiles(dir)) {
|
|
270810
270902
|
const locale = file2.replace(/\.json$/, ""), translation = INVITE_SHARE_TRANSLATIONS[locale];
|
|
270811
|
-
const next = translation ? withTranslationRow(readFileSync176(
|
|
270903
|
+
const next = translation ? withTranslationRow(readFileSync176(join192(l10n, file2), "utf8"), { source: INVITE_SHARE_LABEL, key: INVITE_SHARE_KEY }, translation) : void 0;
|
|
270812
270904
|
if (next === void 0) continue;
|
|
270813
270905
|
writeNoFollow(dir, `l10n/${file2}`, next);
|
|
270814
270906
|
written.push(locale);
|
|
@@ -270873,8 +270965,8 @@ function provisionInviteFlow(dir, facts, dryRun = false) {
|
|
|
270873
270965
|
const navRel = navName && BUNDLE_NAME.test(navName) ? `tier5-src/${navName}/index.ts` : void 0;
|
|
270874
270966
|
const workerRel = `tier5-src/${INVITE_BUNDLE}/index.ts`;
|
|
270875
270967
|
for (const rel2 of [workerRel, "config.ts", "dev/index.ts", ...navRel ? [navRel] : []]) assertNoSymlink(dir, rel2);
|
|
270876
|
-
const navSource = navRel && existsSync149(
|
|
270877
|
-
const workerExists = existsSync149(
|
|
270968
|
+
const navSource = navRel && existsSync149(join192(dir, navRel)) ? readFileSync176(join192(dir, navRel), "utf8") : void 0;
|
|
270969
|
+
const workerExists = existsSync149(join192(dir, workerRel));
|
|
270878
270970
|
const mounted = navSource?.includes(NAV_MARKER) === true;
|
|
270879
270971
|
const nav = navRel && navSource !== void 0 ? { rel: navRel, text: mounted ? navSource : `${navSource.replace(/\s*$/, "\n")}${inviteNavMount(businessId)}` } : void 0;
|
|
270880
270972
|
const wrote = ["dev/index.ts", "config.ts", ...workerExists ? [] : [workerRel], ...nav && !mounted ? [nav.rel] : []];
|
|
@@ -270882,7 +270974,7 @@ function provisionInviteFlow(dir, facts, dryRun = false) {
|
|
|
270882
270974
|
for (const file2 of l10nFiles(dir)) assertNoSymlink(dir, `l10n/${file2}`);
|
|
270883
270975
|
if (!workerExists) writeNoFollow(dir, workerRel, inviteWorkerSource(businessId));
|
|
270884
270976
|
if (nav && !mounted) writeNoFollow(dir, nav.rel, nav.text);
|
|
270885
|
-
const config = readFileSync176(
|
|
270977
|
+
const config = readFileSync176(join192(dir, "config.ts"), "utf8");
|
|
270886
270978
|
const next = nav ? withNavCapabilities(config) : void 0;
|
|
270887
270979
|
if (next !== void 0 && next !== config) writeNoFollow(dir, "config.ts", next);
|
|
270888
270980
|
for (const locale of translateShareLabel(dir)) wrote.push(`l10n/${locale}.json`);
|
|
@@ -270921,7 +271013,7 @@ var init_invite_flow = __esm({
|
|
|
270921
271013
|
|
|
270922
271014
|
// src/one-app/provision.ts
|
|
270923
271015
|
import { existsSync as existsSync150, readdirSync as readdirSync62, readFileSync as readFileSync177, writeFileSync as writeFileSync71 } from "node:fs";
|
|
270924
|
-
import { join as
|
|
271016
|
+
import { join as join193, resolve as resolve120 } from "node:path";
|
|
270925
271017
|
import ts27 from "typescript";
|
|
270926
271018
|
function rootOnAppear2(descriptor) {
|
|
270927
271019
|
const modifiers = obj13(obj13(descriptor.payload).modifiers);
|
|
@@ -270952,7 +271044,7 @@ function nativeTabBar(configSource) {
|
|
|
270952
271044
|
${" ".repeat(indent)}"presentation": "native",${configSource.slice(at2)}` };
|
|
270953
271045
|
}
|
|
270954
271046
|
function provisionTabBar(dir, dryRun = false) {
|
|
270955
|
-
const configPath =
|
|
271047
|
+
const configPath = join193(dir, "config.ts");
|
|
270956
271048
|
const result = existsSync150(configPath) ? nativeTabBar(readFileSync177(configPath, "utf8")) : void 0;
|
|
270957
271049
|
if (!result) return { status: "absent" };
|
|
270958
271050
|
if (!result.fixed) return { status: "unchanged", presentation: result.presentation };
|
|
@@ -270960,7 +271052,7 @@ function provisionTabBar(dir, dryRun = false) {
|
|
|
270960
271052
|
return { status: "set", presentation: "native" };
|
|
270961
271053
|
}
|
|
270962
271054
|
function provisionSiteBinding(dir, binding2, dryRun = false) {
|
|
270963
|
-
const configPath =
|
|
271055
|
+
const configPath = join193(dir, "config.ts");
|
|
270964
271056
|
if (!existsSync150(configPath)) return { status: "absent", reason: "no config.ts" };
|
|
270965
271057
|
if (!binding2.metaSiteId || !GUID2.test(binding2.metaSiteId) || !binding2.siteUrl) {
|
|
270966
271058
|
return { status: "unverified", reason: "the collection has no verified source site id and URL; the auth is left as it is" };
|
|
@@ -271063,7 +271155,7 @@ function provisionChatTarget(dir, memberChat, dryRun = false) {
|
|
|
271063
271155
|
if (!config.sites.length && !screens.length) return { status: "absent", reason: "config.ts has no top-bar chat action yet; run `himi one-app header-badges`, then provision again" };
|
|
271064
271156
|
if (!doors.length) return { status: "unchanged" };
|
|
271065
271157
|
if (!dryRun) {
|
|
271066
|
-
if (config.fixed) writeFileSync71(
|
|
271158
|
+
if (config.fixed) writeFileSync71(join193(dir, "config.ts"), config.fixed, "utf8");
|
|
271067
271159
|
for (const id of screens) {
|
|
271068
271160
|
const route = parseApp(readAppSources(dir).dev, readAppSources(dir).config).routes.find((r3) => r3.kind === "screen" && r3.label === id);
|
|
271069
271161
|
const descriptor = parseEntry(readAppSources(dir).dev.slice(route.lineStart, route.end), id);
|
|
@@ -271107,7 +271199,7 @@ function provisionScreenNames(dir, displayName3, dryRun = false) {
|
|
|
271107
271199
|
}
|
|
271108
271200
|
function provisionAppName(dir, displayName3, dryRun = false) {
|
|
271109
271201
|
const slug = readContentManifest(dir)?.name;
|
|
271110
|
-
const configPath =
|
|
271202
|
+
const configPath = join193(dir, "config.ts");
|
|
271111
271203
|
if (!displayName3?.trim()) return { status: "unverified", reason: "the collection has no business display name; config.ts keeps its name" };
|
|
271112
271204
|
if (typeof slug !== "string" || !existsSync150(configPath)) return { status: "unverified", reason: "no app slug in himalaya.content.json or no config.ts to rename" };
|
|
271113
271205
|
const correction = fixAppName(readFileSync177(configPath, "utf8"), slug, displayName3);
|
|
@@ -271145,17 +271237,17 @@ function applyScreenParams(dir, screenId, params, dryRun = false, remove = []) {
|
|
|
271145
271237
|
return "set";
|
|
271146
271238
|
}
|
|
271147
271239
|
function provisionInviteDrawer(dir, showsInvite, dryRun = false, flowPlanned = false) {
|
|
271148
|
-
const configPath =
|
|
271240
|
+
const configPath = join193(dir, "config.ts");
|
|
271149
271241
|
if (!existsSync150(configPath)) return { status: "absent", reason: "no config.ts to add the Invite row to" };
|
|
271150
271242
|
const result = applyInviteDrawer(readFileSync177(configPath, "utf8"), showsInvite, flowPlanned);
|
|
271151
271243
|
const translated2 = [];
|
|
271152
271244
|
if (result.rowPresent) {
|
|
271153
|
-
const l10n =
|
|
271245
|
+
const l10n = join193(dir, "l10n");
|
|
271154
271246
|
for (const file2 of existsSync150(l10n) ? readdirSync62(l10n).filter((name) => /^[a-z]{2,3}(-[A-Za-z0-9]+)?\.json$/.test(name)) : []) {
|
|
271155
|
-
const next = withInviteTranslation(readFileSync177(
|
|
271247
|
+
const next = withInviteTranslation(readFileSync177(join193(l10n, file2), "utf8"), file2.replace(/\.json$/, ""));
|
|
271156
271248
|
if (next === void 0) continue;
|
|
271157
271249
|
translated2.push(file2.replace(/\.json$/, ""));
|
|
271158
|
-
if (!dryRun) writeFileSync71(
|
|
271250
|
+
if (!dryRun) writeFileSync71(join193(l10n, file2), next, "utf8");
|
|
271159
271251
|
}
|
|
271160
271252
|
if (result.status === "set" && !dryRun) writeFileSync71(configPath, result.text, "utf8");
|
|
271161
271253
|
}
|
|
@@ -271292,7 +271384,7 @@ var init_provision = __esm({
|
|
|
271292
271384
|
|
|
271293
271385
|
// src/one-app/apply-navigation.ts
|
|
271294
271386
|
import { existsSync as existsSync151, readFileSync as readFileSync178 } from "node:fs";
|
|
271295
|
-
import { join as
|
|
271387
|
+
import { join as join194 } from "node:path";
|
|
271296
271388
|
import ts28 from "typescript";
|
|
271297
271389
|
function pagesWithoutScreen(plan, planned2) {
|
|
271298
271390
|
const have = new Map((plan.pages ?? []).map((page) => [page.layoutItemId, page]));
|
|
@@ -271391,7 +271483,7 @@ function stringOf(node3) {
|
|
|
271391
271483
|
}
|
|
271392
271484
|
function definedScreens(contentDir2) {
|
|
271393
271485
|
try {
|
|
271394
|
-
const manifest2 = JSON.parse(readFileSync178(
|
|
271486
|
+
const manifest2 = JSON.parse(readFileSync178(join194(contentDir2, "himalaya.content.json"), "utf8"));
|
|
271395
271487
|
return new Set(Object.keys(manifest2.screens ?? {}));
|
|
271396
271488
|
} catch {
|
|
271397
271489
|
return void 0;
|
|
@@ -271427,7 +271519,7 @@ async function runOneAppApplyNavigation(args, io2) {
|
|
|
271427
271519
|
return 2;
|
|
271428
271520
|
}
|
|
271429
271521
|
const contentDir2 = options2.contentDir;
|
|
271430
|
-
const tabsPath = options2.tabs ?? tabsFileOf(
|
|
271522
|
+
const tabsPath = options2.tabs ?? tabsFileOf(join194(options2.evidenceDir, "gen", "screens.json"));
|
|
271431
271523
|
let plan;
|
|
271432
271524
|
try {
|
|
271433
271525
|
plan = JSON.parse(readFileSync178(tabsPath, "utf8"));
|
|
@@ -271466,7 +271558,7 @@ async function runOneAppApplyNavigation(args, io2) {
|
|
|
271466
271558
|
error: "A tab opens a screen this app does not define. Write the generated screens first (`himi template screens --upsert --from .himi/one-app/gen/screens.json`) and keep any template screen a tab opens; no tab is written for a screen that is not there."
|
|
271467
271559
|
});
|
|
271468
271560
|
}
|
|
271469
|
-
const configPath =
|
|
271561
|
+
const configPath = join194(contentDir2, "config.ts");
|
|
271470
271562
|
if (!existsSync151(configPath)) return report6(io2, false, { code: "content_invalid", error: `${configPath} not found.` });
|
|
271471
271563
|
const edit = applyNavigationToConfig(readFileSync178(configPath, "utf8"), plan);
|
|
271472
271564
|
if (edit.status === "kept") return report6(io2, false, { code: "config_unwritable", error: edit.reason, tabs: plan.tabs });
|
|
@@ -271530,7 +271622,7 @@ var init_apply_navigation = __esm({
|
|
|
271530
271622
|
|
|
271531
271623
|
// src/one-app/starter-keep-list.ts
|
|
271532
271624
|
import { existsSync as existsSync152, readFileSync as readFileSync179, writeFileSync as writeFileSync72 } from "node:fs";
|
|
271533
|
-
import { join as
|
|
271625
|
+
import { join as join195 } from "node:path";
|
|
271534
271626
|
import ts29 from "typescript";
|
|
271535
271627
|
function screensOpenedBy(node3, found = /* @__PURE__ */ new Set()) {
|
|
271536
271628
|
if (Array.isArray(node3)) {
|
|
@@ -271566,7 +271658,7 @@ function seedKeepList(facts) {
|
|
|
271566
271658
|
}
|
|
271567
271659
|
function loadStarter(dir) {
|
|
271568
271660
|
try {
|
|
271569
|
-
const dev = readFileSync179(
|
|
271661
|
+
const dev = readFileSync179(join195(dir, "dev", "index.ts"), "utf8"), config = readFileSync179(join195(dir, "config.ts"), "utf8");
|
|
271570
271662
|
const workers = listWorkers(dir);
|
|
271571
271663
|
return { sources: { dev, config, workerDirs: workers.dirs, workerFiles: workers.files }, app: parseApp(dev, config), moduleTargets: /* @__PURE__ */ new Map() };
|
|
271572
271664
|
} catch (error) {
|
|
@@ -271759,7 +271851,7 @@ function workerOpenedScreens(dir, workerSources) {
|
|
|
271759
271851
|
return runtimeTargets(starter, workerSources).map((id) => ({ id, why: MODULE_NOTE }));
|
|
271760
271852
|
}
|
|
271761
271853
|
function writeStarterKeepList(contentDir2, facts) {
|
|
271762
|
-
const path2 =
|
|
271854
|
+
const path2 = join195(contentDir2, "SPEC.md");
|
|
271763
271855
|
const created = !existsSync152(path2);
|
|
271764
271856
|
const starter = loadStarter(contentDir2);
|
|
271765
271857
|
const template = facts.template.flatMap((id) => facts.generated.includes(id) || !starter ? [id] : routeLabel(starter.app, id) ?? []);
|
|
@@ -271798,14 +271890,14 @@ var init_starter_keep_list = __esm({
|
|
|
271798
271890
|
|
|
271799
271891
|
// src/one-app/generate-cli.ts
|
|
271800
271892
|
import { existsSync as existsSync153, mkdirSync as mkdirSync66, readdirSync as readdirSync63, readFileSync as readFileSync180, rmSync as rmSync45, writeFileSync as writeFileSync73 } from "node:fs";
|
|
271801
|
-
import { dirname as dirname85, join as
|
|
271893
|
+
import { dirname as dirname85, join as join196, resolve as resolve121 } from "node:path";
|
|
271802
271894
|
function removeStaleGeneratedWorkers(contentDir2, current) {
|
|
271803
|
-
const root =
|
|
271895
|
+
const root = join196(contentDir2, "tier5-src");
|
|
271804
271896
|
if (!existsSync153(root)) return;
|
|
271805
271897
|
for (const name of readdirSync63(root)) {
|
|
271806
271898
|
if (current.has(name) || name === "_shared") continue;
|
|
271807
|
-
const index =
|
|
271808
|
-
if (existsSync153(index) && readFileSync180(index, "utf8").startsWith(GENERATED_WORKER_MARKER)) rmSync45(
|
|
271899
|
+
const index = join196(root, name, "index.ts");
|
|
271900
|
+
if (existsSync153(index) && readFileSync180(index, "utf8").startsWith(GENERATED_WORKER_MARKER)) rmSync45(join196(root, name), { recursive: true, force: true });
|
|
271809
271901
|
}
|
|
271810
271902
|
}
|
|
271811
271903
|
function parseArgs5(args) {
|
|
@@ -271827,7 +271919,7 @@ function parseArgs5(args) {
|
|
|
271827
271919
|
}
|
|
271828
271920
|
}
|
|
271829
271921
|
if (!evidenceDir || !contentDir2) throw new Error("Both --evidence-dir and --content are required.");
|
|
271830
|
-
return { evidenceDir: resolve121(evidenceDir), contentDir: resolve121(contentDir2), out: resolve121(out2 ??
|
|
271922
|
+
return { evidenceDir: resolve121(evidenceDir), contentDir: resolve121(contentDir2), out: resolve121(out2 ?? join196(evidenceDir, "gen", "screens.json")) };
|
|
271831
271923
|
}
|
|
271832
271924
|
function claimedHome(out2) {
|
|
271833
271925
|
try {
|
|
@@ -271877,7 +271969,7 @@ async function runOneAppGenerate(args, io2) {
|
|
|
271877
271969
|
}
|
|
271878
271970
|
const fetchedAt = (() => {
|
|
271879
271971
|
try {
|
|
271880
|
-
const m2 = JSON.parse(readFileSync180(
|
|
271972
|
+
const m2 = JSON.parse(readFileSync180(join196(options2.evidenceDir, "manifest.json"), "utf8"));
|
|
271881
271973
|
return typeof m2.source?.fetchedAt === "string" ? m2.source.fetchedAt : void 0;
|
|
271882
271974
|
} catch {
|
|
271883
271975
|
return void 0;
|
|
@@ -271887,7 +271979,7 @@ async function runOneAppGenerate(args, io2) {
|
|
|
271887
271979
|
let homeScreenId;
|
|
271888
271980
|
const previousIds = previousOutput(options2.out);
|
|
271889
271981
|
try {
|
|
271890
|
-
const manifest2 = JSON.parse(readFileSync180(
|
|
271982
|
+
const manifest2 = JSON.parse(readFileSync180(join196(options2.contentDir, "himalaya.content.json"), "utf8"));
|
|
271891
271983
|
taken2 = new Set(Object.keys(manifest2.screens ?? {}));
|
|
271892
271984
|
if (taken2.has(TEMPLATE_HOME_SCREEN) && (!previousIds.includes(TEMPLATE_HOME_SCREEN) || claimedHome(options2.out))) homeScreenId = TEMPLATE_HOME_SCREEN;
|
|
271893
271985
|
for (const id of previousIds) taken2.delete(id);
|
|
@@ -271896,7 +271988,7 @@ async function runOneAppGenerate(args, io2) {
|
|
|
271896
271988
|
}
|
|
271897
271989
|
let result;
|
|
271898
271990
|
try {
|
|
271899
|
-
result = generateScreens({ raw, pages: pages2, business, navigation, takenScreenIds: taken2, ...homeScreenId ? { homeScreenId } : {}, recipe: (name, values) => readRecipe(options2.contentDir, name, values), recipeNodes: (name, values) => readRecipeNodes(options2.contentDir, name, values), hasModule: (file2) => existsSync153(
|
|
271991
|
+
result = generateScreens({ raw, pages: pages2, business, navigation, takenScreenIds: taken2, ...homeScreenId ? { homeScreenId } : {}, recipe: (name, values) => readRecipe(options2.contentDir, name, values), recipeNodes: (name, values) => readRecipeNodes(options2.contentDir, name, values), hasModule: (file2) => existsSync153(join196(options2.contentDir, "tier5-src", "_shared", `${file2}.ts`)) });
|
|
271900
271992
|
} catch (error) {
|
|
271901
271993
|
if (error instanceof RecipeError) return report7(io2, false, { code: "recipe_unavailable", error: error.message });
|
|
271902
271994
|
throw error;
|
|
@@ -271911,9 +272003,9 @@ async function runOneAppGenerate(args, io2) {
|
|
|
271911
272003
|
if (tabs) writeFileSync73(tabsPath, JSON.stringify(tabs, null, 2) + "\n", "utf8");
|
|
271912
272004
|
else rmSync45(tabsPath, { force: true });
|
|
271913
272005
|
for (const worker of Object.values(result.workers)) {
|
|
271914
|
-
const dir =
|
|
272006
|
+
const dir = join196(options2.contentDir, "tier5-src", worker.bundle);
|
|
271915
272007
|
mkdirSync66(dir, { recursive: true });
|
|
271916
|
-
writeFileSync73(
|
|
272008
|
+
writeFileSync73(join196(dir, "index.ts"), worker.source, "utf8");
|
|
271917
272009
|
}
|
|
271918
272010
|
removeStaleGeneratedWorkers(options2.contentDir, new Set(Object.values(result.workers).map((w2) => w2.bundle)));
|
|
271919
272011
|
} catch (error) {
|
|
@@ -271955,7 +272047,7 @@ async function runOneAppGenerate(args, io2) {
|
|
|
271955
272047
|
}
|
|
271956
272048
|
let keepList;
|
|
271957
272049
|
try {
|
|
271958
|
-
const manifest2 = JSON.parse(readFileSync180(
|
|
272050
|
+
const manifest2 = JSON.parse(readFileSync180(join196(options2.evidenceDir, "manifest.json"), "utf8"));
|
|
271959
272051
|
const badgePlan = readHashedEvidenceJson(options2.evidenceDir, "header-badge-plan.json");
|
|
271960
272052
|
const generated = Object.keys(result.screens);
|
|
271961
272053
|
const routed = result.routes.flatMap((route) => route.kind === "template" && route.screenId ? [route.screenId] : []);
|
|
@@ -272482,7 +272574,7 @@ ${indent}`);
|
|
|
272482
272574
|
// src/one-app/access-cli.ts
|
|
272483
272575
|
import { createHash as createHash95 } from "node:crypto";
|
|
272484
272576
|
import { existsSync as existsSync154, readFileSync as readFileSync181, rmSync as rmSync46, statSync as statSync48, writeFileSync as writeFileSync74 } from "node:fs";
|
|
272485
|
-
import { join as
|
|
272577
|
+
import { join as join197, resolve as resolve122 } from "node:path";
|
|
272486
272578
|
function parseArgs6(args) {
|
|
272487
272579
|
let evidenceDir;
|
|
272488
272580
|
let contentDir2;
|
|
@@ -272570,7 +272662,7 @@ function report8(io2, ok5, body) {
|
|
|
272570
272662
|
function businessTitleOf(evidenceDir, given) {
|
|
272571
272663
|
if (given) return given;
|
|
272572
272664
|
try {
|
|
272573
|
-
const context = JSON.parse(readFileSync181(
|
|
272665
|
+
const context = JSON.parse(readFileSync181(join197(evidenceDir, "business-context.json"), "utf8"));
|
|
272574
272666
|
if (typeof context.displayName === "string" && context.displayName.trim()) return context.displayName.trim();
|
|
272575
272667
|
} catch {
|
|
272576
272668
|
}
|
|
@@ -272613,10 +272705,10 @@ function mapCoverage2(options2, plan, raw) {
|
|
|
272613
272705
|
return { mapped, kept, conflicts, text: mapped ? JSON.stringify(coverage2, null, 2) + "\n" : void 0 };
|
|
272614
272706
|
}
|
|
272615
272707
|
function recordedLoginPolicy(evidenceDir) {
|
|
272616
|
-
const manifest2 = JSON.parse(readFileSync181(
|
|
272708
|
+
const manifest2 = JSON.parse(readFileSync181(join197(evidenceDir, "manifest.json"), "utf8"));
|
|
272617
272709
|
const expected = manifest2.sha256?.["access-policy.json"];
|
|
272618
272710
|
if (expected === void 0) return void 0;
|
|
272619
|
-
const bytes2 = readFileSync181(
|
|
272711
|
+
const bytes2 = readFileSync181(join197(evidenceDir, "access-policy.json"));
|
|
272620
272712
|
if (createHash95("sha256").update(bytes2).digest("hex") !== expected) throw new Error("access-policy.json does not match the hash recorded in manifest.json.");
|
|
272621
272713
|
const value2 = JSON.parse(bytes2.toString("utf8")).visitorModeEnabled;
|
|
272622
272714
|
return typeof value2 === "boolean" ? value2 : void 0;
|
|
@@ -272642,7 +272734,7 @@ async function runOneAppAccess(args, io2) {
|
|
|
272642
272734
|
let unverifiedPlatforms;
|
|
272643
272735
|
let raw;
|
|
272644
272736
|
let recorded;
|
|
272645
|
-
const tablePath =
|
|
272737
|
+
const tablePath = join197(options2.contentDir, "tier5-src", "_shared", "access-gates-table.ts");
|
|
272646
272738
|
const tableBefore = existsSync154(tablePath) ? readFileSync181(tablePath, "utf8") : void 0;
|
|
272647
272739
|
const writtenGates = tableBefore === void 0 ? [] : tableGates(tableBefore);
|
|
272648
272740
|
const written = writtenGates ?? [];
|
|
@@ -272658,10 +272750,10 @@ async function runOneAppAccess(args, io2) {
|
|
|
272658
272750
|
}
|
|
272659
272751
|
const common2 = { unmapped: plan.unmapped, warnings: plan.warnings, ...unverifiedPlatforms.length ? { unverifiedPlatforms } : {} };
|
|
272660
272752
|
const decision = loginWallOf(options2, recorded);
|
|
272661
|
-
const configPath =
|
|
272662
|
-
const screensPath =
|
|
272663
|
-
const enginePath =
|
|
272664
|
-
const workerPath =
|
|
272753
|
+
const configPath = join197(options2.contentDir, "config.ts");
|
|
272754
|
+
const screensPath = join197(options2.contentDir, "dev", "index.ts");
|
|
272755
|
+
const enginePath = join197(options2.contentDir, "tier5-src", "_shared", "access-gates.ts");
|
|
272756
|
+
const workerPath = join197(options2.contentDir, "tier5-src", ACCESS_NAV_BUNDLE, "index.ts");
|
|
272665
272757
|
let configText;
|
|
272666
272758
|
let screensText;
|
|
272667
272759
|
try {
|
|
@@ -272791,7 +272883,7 @@ async function runOneAppAccess(args, io2) {
|
|
|
272791
272883
|
return outOfSync.length ? report8(io2, false, { code: "access_out_of_sync", outOfSync, ...summary2, error: "The app does not carry the source's locked pages and login requirement as they are now: run `himi one-app access` without --check." }) : plan.unmapped.length ? report8(io2, false, { code: "access_out_of_sync", outOfSync: [], ...summary2, error: "A locked page has no Himi screen yet, so the app does not carry it: map it with --screen and run `himi one-app access`." }) : report8(io2, true, { status: "in_sync", ...summary2 });
|
|
272792
272884
|
}
|
|
272793
272885
|
if (!options2.dryRun) {
|
|
272794
|
-
const ledgerPath =
|
|
272886
|
+
const ledgerPath = join197(options2.contentDir, COVERAGE_FILE);
|
|
272795
272887
|
const writes = [
|
|
272796
272888
|
...hasGates ? [{ path: tablePath, before: tableBefore, after: table }] : [],
|
|
272797
272889
|
{ path: configPath, before: configText, after: nextConfig },
|
|
@@ -272886,7 +272978,7 @@ var init_access_policy = __esm({
|
|
|
272886
272978
|
|
|
272887
272979
|
// src/one-app/payment-review.ts
|
|
272888
272980
|
import { readFileSync as readFileSync182 } from "node:fs";
|
|
272889
|
-
import { join as
|
|
272981
|
+
import { join as join198, resolve as resolve123 } from "node:path";
|
|
272890
272982
|
function preservesUnverifiedFlow(flow) {
|
|
272891
272983
|
const checkout = obj15(flow.checkout);
|
|
272892
272984
|
return flow.payment === "online-paid" && obj15(flow.readiness).state === "unverified" && checkout.state === "supported" && text30(checkout.evidence) && (flow.decision === void 0 || obj15(flow.decision).action === "proceed");
|
|
@@ -272975,7 +273067,7 @@ function runPaymentReview(args, io2) {
|
|
|
272975
273067
|
const { manifest: manifest2 } = verifiedEvidence(evidenceDir);
|
|
272976
273068
|
const metaSiteId = obj15(manifest2.source).metaSiteId;
|
|
272977
273069
|
if (typeof metaSiteId !== "string") throw Error("Missing site binding");
|
|
272978
|
-
const review = JSON.parse(readFileSync182(
|
|
273070
|
+
const review = JSON.parse(readFileSync182(join198(evidenceDir, "payment-review.json"), "utf8"));
|
|
272979
273071
|
const issues = paymentReviewIssues(review, metaSiteId);
|
|
272980
273072
|
if (issues.length) return fail16("payment_decision_required", issues, 1);
|
|
272981
273073
|
const warnings = obj15(review).flows.map(obj15).filter(preservesUnverifiedFlow).map((flow) => ({
|
|
@@ -273231,7 +273323,7 @@ __export(cli_exports2, {
|
|
|
273231
273323
|
import { closeSync as closeSync14, constants as constants13, lstatSync as lstatSync40, mkdirSync as mkdirSync67, openSync as openSync13, readFileSync as readFileSync183, realpathSync as realpathSync23, writeFileSync as writeFileSync75 } from "node:fs";
|
|
273232
273324
|
import { createHash as createHash96 } from "node:crypto";
|
|
273233
273325
|
import { isIP as isIP2 } from "node:net";
|
|
273234
|
-
import { dirname as dirname86, join as
|
|
273326
|
+
import { dirname as dirname86, join as join199, parse as parse11, resolve as resolve124 } from "node:path";
|
|
273235
273327
|
function nativeSiteHost(host) {
|
|
273236
273328
|
if (isIP2(host.startsWith("[") ? host.slice(1, -1) : host)) return true;
|
|
273237
273329
|
const labels = host.replace(/\.$/, "").split(".");
|
|
@@ -273318,7 +273410,7 @@ function readOptions(argv, cwd, commandIncluded) {
|
|
|
273318
273410
|
throw new OneAppError("invalid_output_path", "Pass a parent directory with --dir.");
|
|
273319
273411
|
}
|
|
273320
273412
|
const parentDir = resolve124(cwd, flags.dir ?? ".");
|
|
273321
|
-
const workspace =
|
|
273413
|
+
const workspace = join199(parentDir, name);
|
|
273322
273414
|
assertSafeParents(parentDir);
|
|
273323
273415
|
if (pathExists(workspace)) throw new OneAppError("output_exists", "The destination already exists. Choose a new --name or --dir.");
|
|
273324
273416
|
return { metaSiteId, appInstance, locale, languages, prompt: prompt2, name, parentDir, workspace, target, topTabs };
|
|
@@ -273440,7 +273532,7 @@ validate-payments checks site-bound payment evidence and explicit paid-flow deci
|
|
|
273440
273532
|
const hashes = {};
|
|
273441
273533
|
const diskWrite = deps.writeFile ?? writePrivate;
|
|
273442
273534
|
const put = (name, content) => {
|
|
273443
|
-
const path2 =
|
|
273535
|
+
const path2 = join199(evidenceDir, name);
|
|
273444
273536
|
try {
|
|
273445
273537
|
assertSafeParents(evidenceDir);
|
|
273446
273538
|
diskWrite(path2, content, false);
|
|
@@ -273456,7 +273548,7 @@ validate-payments checks site-bound payment evidence and explicit paid-flow deci
|
|
|
273456
273548
|
if (!evidenceDir) return;
|
|
273457
273549
|
try {
|
|
273458
273550
|
assertSafeParents(evidenceDir);
|
|
273459
|
-
diskWrite(
|
|
273551
|
+
diskWrite(join199(evidenceDir, "progress.jsonl"), JSON.stringify({ stage, at: now() }) + "\n", true);
|
|
273460
273552
|
} catch {
|
|
273461
273553
|
throw new OneAppError("artifact_write_failed", "Could not record migration progress. Existing files were kept.", { stage });
|
|
273462
273554
|
}
|
|
@@ -273477,7 +273569,7 @@ validate-payments checks site-bound payment evidence and explicit paid-flow deci
|
|
|
273477
273569
|
assertSafeParents(options2.parentDir);
|
|
273478
273570
|
mkdirSync67(options2.workspace, { mode: 448 });
|
|
273479
273571
|
if (realpathSync23(options2.workspace) !== options2.workspace) throw new Error("destination changed");
|
|
273480
|
-
evidenceDir =
|
|
273572
|
+
evidenceDir = join199(options2.workspace, ".himi", "one-app");
|
|
273481
273573
|
mkdirSync67(evidenceDir, { recursive: true, mode: 448 });
|
|
273482
273574
|
} catch (error) {
|
|
273483
273575
|
if (error.code === "EEXIST") {
|
|
@@ -275609,11 +275701,11 @@ var init_analyze2 = __esm({
|
|
|
275609
275701
|
|
|
275610
275702
|
// src/site-analyze/site-pages-apply.ts
|
|
275611
275703
|
import { existsSync as existsSync155, readFileSync as readFileSync184 } from "node:fs";
|
|
275612
|
-
import { join as
|
|
275704
|
+
import { join as join200 } from "node:path";
|
|
275613
275705
|
import ts31 from "typescript";
|
|
275614
275706
|
function packageScreenIds(dir) {
|
|
275615
|
-
const dev =
|
|
275616
|
-
const config =
|
|
275707
|
+
const dev = join200(dir, "dev", "index.ts");
|
|
275708
|
+
const config = join200(dir, "config.ts");
|
|
275617
275709
|
if (!existsSync155(dev) || !existsSync155(config)) return void 0;
|
|
275618
275710
|
try {
|
|
275619
275711
|
const app2 = parseApp(readFileSync184(dev, "utf8"), readFileSync184(config, "utf8"));
|
|
@@ -275665,8 +275757,8 @@ ${indent}`);
|
|
|
275665
275757
|
}
|
|
275666
275758
|
function applySitePagesToPackage(dir, site, opts = {}) {
|
|
275667
275759
|
const none = (refused2) => ({ added: [], replaced: [], removed: [], rows: [], wrote: [], refused: refused2 });
|
|
275668
|
-
const devPath =
|
|
275669
|
-
const configPath =
|
|
275760
|
+
const devPath = join200(dir, "dev", "index.ts");
|
|
275761
|
+
const configPath = join200(dir, "config.ts");
|
|
275670
275762
|
if (!existsSync155(devPath) || !existsSync155(configPath)) return none("the package has no dev/index.ts + config.ts to add website pages to");
|
|
275671
275763
|
let existing;
|
|
275672
275764
|
try {
|
|
@@ -275683,7 +275775,7 @@ function applySitePagesToPackage(dir, site, opts = {}) {
|
|
|
275683
275775
|
const probe2 = spliceWebsiteDrawer(readFileSync184(configPath, "utf8"), site);
|
|
275684
275776
|
if ("refused" in probe2) return none(probe2.refused);
|
|
275685
275777
|
if (opts.dryRun) return { added, replaced, removed, rows: probe2.rows, wrote: [] };
|
|
275686
|
-
const before = new Map(["dev/index.ts", "config.ts", "himalaya.content.json"].map((rel2) => [rel2, existsSync155(
|
|
275778
|
+
const before = new Map(["dev/index.ts", "config.ts", "himalaya.content.json"].map((rel2) => [rel2, existsSync155(join200(dir, rel2)) ? readFileSync184(join200(dir, rel2), "utf8") : void 0]));
|
|
275687
275779
|
try {
|
|
275688
275780
|
if (removed.length) removeScreens(dir, removed);
|
|
275689
275781
|
if (wanted.length) upsertScreens(dir, screens);
|
|
@@ -275691,10 +275783,10 @@ function applySitePagesToPackage(dir, site, opts = {}) {
|
|
|
275691
275783
|
if ("refused" in spliced) throw new TrimRefusal(spliced.refused);
|
|
275692
275784
|
if (spliced.source !== readFileSync184(configPath, "utf8")) writeFileAtomic(configPath, spliced.source);
|
|
275693
275785
|
} catch (e2) {
|
|
275694
|
-
for (const [rel2, text32] of before) if (text32 !== void 0 && readFileSync184(
|
|
275786
|
+
for (const [rel2, text32] of before) if (text32 !== void 0 && readFileSync184(join200(dir, rel2), "utf8") !== text32) writeFileAtomic(join200(dir, rel2), text32);
|
|
275695
275787
|
return none(`stopped and restored every file: ${e2.message}`);
|
|
275696
275788
|
}
|
|
275697
|
-
const wrote = [...before].filter(([rel2, text32]) => text32 !== void 0 && readFileSync184(
|
|
275789
|
+
const wrote = [...before].filter(([rel2, text32]) => text32 !== void 0 && readFileSync184(join200(dir, rel2), "utf8") !== text32).map(([rel2]) => join200(dir, rel2));
|
|
275698
275790
|
return { added, replaced, removed, rows: probe2.rows, wrote };
|
|
275699
275791
|
}
|
|
275700
275792
|
var ANCHOR_ROWS;
|
|
@@ -275724,7 +275816,7 @@ var init_customer_build = __esm({
|
|
|
275724
275816
|
|
|
275725
275817
|
// src/site-analyze/apply.ts
|
|
275726
275818
|
import { existsSync as existsSync156, readFileSync as readFileSync185, writeFileSync as writeFileSync76, copyFileSync as copyFileSync3, mkdirSync as mkdirSync68, realpathSync as realpathSync24, statSync as statSync49 } from "node:fs";
|
|
275727
|
-
import { dirname as dirname87, isAbsolute as isAbsolute19, join as
|
|
275819
|
+
import { dirname as dirname87, isAbsolute as isAbsolute19, join as join201, resolve as resolve125, sep as sep34 } from "node:path";
|
|
275728
275820
|
import { spawnSync as spawnSync13 } from "node:child_process";
|
|
275729
275821
|
function inRepoBakeRefusal(repoRoot2, shell) {
|
|
275730
275822
|
if (isBrandable(repoRoot2, shell)) return null;
|
|
@@ -276021,12 +276113,12 @@ function sameKnownSite(previous, next) {
|
|
|
276021
276113
|
}
|
|
276022
276114
|
function buildMergedContract(options2) {
|
|
276023
276115
|
const { appDir: appDir3, packageDir, overlay } = options2;
|
|
276024
|
-
const committedPath =
|
|
276116
|
+
const committedPath = join201(appDir3, "provisioning.json");
|
|
276025
276117
|
if (!existsSync156(committedPath)) {
|
|
276026
276118
|
throw new Error(`shell has no committed provisioning.json at ${committedPath} to build a contract from`);
|
|
276027
276119
|
}
|
|
276028
276120
|
const committed = JSON.parse(readFileSync185(committedPath, "utf8"));
|
|
276029
|
-
const previousPath =
|
|
276121
|
+
const previousPath = join201(appDir3, LOCAL_CONTRACT_REL);
|
|
276030
276122
|
let evidenceOverlay = overlay;
|
|
276031
276123
|
if ((overlay.businessContact === void 0 || overlay.loyalty === void 0 || overlay.businessTimeZone === void 0) && existsSync156(previousPath)) {
|
|
276032
276124
|
try {
|
|
@@ -276064,7 +276156,7 @@ function buildMergedContract(options2) {
|
|
|
276064
276156
|
};
|
|
276065
276157
|
const stage = (fromRel, toRel) => {
|
|
276066
276158
|
const from = contained(packageDir, fromRel);
|
|
276067
|
-
const to2 = contained(
|
|
276159
|
+
const to2 = contained(join201(appDir3, STAGED), toRel.slice(STAGED.length + 1));
|
|
276068
276160
|
if (!from || !to2 || !existsSync156(from)) return void 0;
|
|
276069
276161
|
let real;
|
|
276070
276162
|
let realRoot;
|
|
@@ -276087,7 +276179,7 @@ function buildMergedContract(options2) {
|
|
|
276087
276179
|
};
|
|
276088
276180
|
const icon = stage("media/icon.png", `${STAGED}/icon.png`);
|
|
276089
276181
|
if (icon) branding.appIconPath = icon;
|
|
276090
|
-
const facesPath =
|
|
276182
|
+
const facesPath = join201(packageDir, "media/fonts/faces.json");
|
|
276091
276183
|
if (existsSync156(facesPath)) {
|
|
276092
276184
|
let faces = [];
|
|
276093
276185
|
try {
|
|
@@ -276112,9 +276204,9 @@ function buildMergedContract(options2) {
|
|
|
276112
276204
|
merged.branding = branding;
|
|
276113
276205
|
const body = `${JSON.stringify(merged, null, 2)}
|
|
276114
276206
|
`;
|
|
276115
|
-
const path2 =
|
|
276207
|
+
const path2 = join201(packageDir, "provisioning.contract.json");
|
|
276116
276208
|
writeFileSync76(path2, body);
|
|
276117
|
-
const localPath2 =
|
|
276209
|
+
const localPath2 = join201(appDir3, LOCAL_CONTRACT_REL);
|
|
276118
276210
|
mkdirSync68(dirname87(localPath2), { recursive: true });
|
|
276119
276211
|
writeFileSync76(localPath2, body);
|
|
276120
276212
|
staged.push(localPath2);
|
|
@@ -276149,7 +276241,7 @@ function catalogTypography(overlay, template) {
|
|
|
276149
276241
|
function staticFaqFor(overlay, overlayPath) {
|
|
276150
276242
|
const own6 = overlay.faq;
|
|
276151
276243
|
if (own6 !== void 0) return deriveStaticFaq(own6);
|
|
276152
|
-
const bookPath =
|
|
276244
|
+
const bookPath = join201(dirname87(resolve125(overlayPath)), "book.json");
|
|
276153
276245
|
if (!existsSync156(bookPath)) return void 0;
|
|
276154
276246
|
try {
|
|
276155
276247
|
const book = JSON.parse(readFileSync185(bookPath, "utf8"));
|
|
@@ -276166,7 +276258,7 @@ function staticGalleriesFor(overlay, overlayPath) {
|
|
|
276166
276258
|
if (overlay.galleries !== void 0) return deriveStaticGalleries(
|
|
276167
276259
|
overlay.galleries.map((gallery) => ({ role: "gallery", title: gallery.title, galleryImageUrls: gallery.photos }))
|
|
276168
276260
|
);
|
|
276169
|
-
const bookPath =
|
|
276261
|
+
const bookPath = join201(dirname87(resolve125(overlayPath)), "book.json");
|
|
276170
276262
|
if (!existsSync156(bookPath)) return void 0;
|
|
276171
276263
|
try {
|
|
276172
276264
|
const book = JSON.parse(readFileSync185(bookPath, "utf8"));
|
|
@@ -276202,15 +276294,15 @@ async function applyOverlays(input) {
|
|
|
276202
276294
|
if (repoRoot2) {
|
|
276203
276295
|
const bakeRefusal = inRepoBakeRefusal(repoRoot2, shell);
|
|
276204
276296
|
if (bakeRefusal) throw Object.assign(new Error(bakeRefusal), { exit: 2, code: APPLY_SHELL_CANNOT_BAKE });
|
|
276205
|
-
const appDir3 =
|
|
276206
|
-
assertOverlayNamesSite(
|
|
276297
|
+
const appDir3 = join201(repoRoot2, shellAppDir(shell));
|
|
276298
|
+
assertOverlayNamesSite(join201(appDir3, "provisioning.json"), overlay, `shell "${shell}"`, ` --shell ${shell}`);
|
|
276207
276299
|
const packageDir = dirname87(resolve125(input.overlayPath));
|
|
276208
276300
|
if (input.dryRun) {
|
|
276209
276301
|
return {
|
|
276210
276302
|
mode: "dry",
|
|
276211
276303
|
target: "in-repo",
|
|
276212
276304
|
wrote: [],
|
|
276213
|
-
wouldWrite: [
|
|
276305
|
+
wouldWrite: [join201(packageDir, "provisioning.contract.json"), join201(appDir3, LOCAL_CONTRACT_REL), `${appDir3} (npm run prepare:customer)`],
|
|
276214
276306
|
note: [planNote, "dry run: nothing written \u2014 without --dry-run this merges the contract and runs prepare:customer"].filter(Boolean).join(" \xB7 "),
|
|
276215
276307
|
...sitePagesOut()
|
|
276216
276308
|
};
|
|
@@ -276239,7 +276331,7 @@ async function applyOverlays(input) {
|
|
|
276239
276331
|
note: `${planNote ? `${planNote} \xB7 ` : ""}prepare:customer --contract with a merged contract (committed provisioning.json untouched)${unpairedInRepo ? ` \xB7 ${unpairedInRepo}` : ""}${mergeNote}`
|
|
276240
276332
|
};
|
|
276241
276333
|
}
|
|
276242
|
-
const pkgProv =
|
|
276334
|
+
const pkgProv = join201(cwd, "provisioning.json");
|
|
276243
276335
|
assertNotCommitted(pkgProv, input.forbiddenProvisioning);
|
|
276244
276336
|
assertOverlayNamesSite(pkgProv, overlay, "this content package", "");
|
|
276245
276337
|
if (input.dryRun) {
|
|
@@ -276252,16 +276344,16 @@ async function applyOverlays(input) {
|
|
|
276252
276344
|
wrote: [],
|
|
276253
276345
|
wouldWrite: [
|
|
276254
276346
|
pkgProv,
|
|
276255
|
-
...existsSync156(
|
|
276256
|
-
...existsSync156(
|
|
276257
|
-
...touchesPackage ? [
|
|
276258
|
-
...input.iconPath && existsSync156(input.iconPath) ? [
|
|
276347
|
+
...existsSync156(join201(cwd, "tokens.json")) && (tokens2.colors || tokens2.typography) ? [join201(cwd, "tokens.json")] : [],
|
|
276348
|
+
...existsSync156(join201(cwd, "dev/index.ts")) ? [join201(cwd, "dev/index.ts")] : [],
|
|
276349
|
+
...touchesPackage ? [join201(cwd, "config.ts"), join201(cwd, "himalaya.content.json")] : [],
|
|
276350
|
+
...input.iconPath && existsSync156(input.iconPath) ? [join201(cwd, "icon.png")] : []
|
|
276259
276351
|
],
|
|
276260
276352
|
note: [planNote, pages2?.refused ? `website pages not added: ${pages2.refused}` : void 0, "dry run: nothing written"].filter(Boolean).join(" \xB7 "),
|
|
276261
276353
|
...sitePagesOut(screens)
|
|
276262
276354
|
};
|
|
276263
276355
|
}
|
|
276264
|
-
const contentPath =
|
|
276356
|
+
const contentPath = join201(cwd, "himalaya.content.json");
|
|
276265
276357
|
const syncViewNames = (before, after) => {
|
|
276266
276358
|
const content = readContentManifest(cwd);
|
|
276267
276359
|
if (!content) return;
|
|
@@ -276309,7 +276401,7 @@ async function applyOverlays(input) {
|
|
|
276309
276401
|
if (Array.isArray(packageGalleries) && packageGalleries.length && !overlay.installedVerticals.includes("galleries")) {
|
|
276310
276402
|
overlay.installedVerticals.push("galleries");
|
|
276311
276403
|
}
|
|
276312
|
-
const pkgTokens =
|
|
276404
|
+
const pkgTokens = join201(cwd, "tokens.json");
|
|
276313
276405
|
if (existsSync156(pkgTokens) && (tokens2.colors || tokens2.typography)) {
|
|
276314
276406
|
const cur = JSON.parse(readFileSync185(pkgTokens, "utf8"));
|
|
276315
276407
|
let tokensIn = tokens2;
|
|
@@ -276336,7 +276428,7 @@ async function applyOverlays(input) {
|
|
|
276336
276428
|
wrote.push(pkgTokens);
|
|
276337
276429
|
}
|
|
276338
276430
|
const homeAction = homeRefreshActionId(shell);
|
|
276339
|
-
const homeSrc =
|
|
276431
|
+
const homeSrc = join201(cwd, "dev/index.ts");
|
|
276340
276432
|
if (homeAction && existsSync156(homeSrc)) {
|
|
276341
276433
|
const prev = readFileSync185(homeSrc, "utf8");
|
|
276342
276434
|
const patched = patchBrandParams(prev, overlay, homeAction);
|
|
@@ -279033,14 +279125,14 @@ __export(capture_exports, {
|
|
|
279033
279125
|
variantWidth: () => variantWidth
|
|
279034
279126
|
});
|
|
279035
279127
|
import { existsSync as existsSync159, mkdirSync as mkdirSync69, rmSync as rmSync47, writeFileSync as writeFileSync78 } from "node:fs";
|
|
279036
|
-
import { join as
|
|
279128
|
+
import { join as join202 } from "node:path";
|
|
279037
279129
|
import { pathToFileURL as pathToFileURL12 } from "node:url";
|
|
279038
279130
|
function variantWidth(variant) {
|
|
279039
279131
|
return variant === "tablet" ? renderDeviceWidths().tablet : PHONE_WIDTH;
|
|
279040
279132
|
}
|
|
279041
279133
|
function frameFile(outDir, screen, variant, surface) {
|
|
279042
279134
|
mkdirSync69(outDir, { recursive: true });
|
|
279043
|
-
return
|
|
279135
|
+
return join202(outDir, `${screen}.${variant}.${surface}.png`);
|
|
279044
279136
|
}
|
|
279045
279137
|
async function captureMockup(root, screen, entry, variant, outDir, session) {
|
|
279046
279138
|
if (!entry.mockup) throw new MockupMissingError(`screen ${screen} declares no mockup in hhp.json`);
|
|
@@ -279077,7 +279169,7 @@ async function captureWebVariant(root, variant, outDir, screens) {
|
|
|
279077
279169
|
const built = await buildContentBundles2(root, { resolution: resolutionFlag2({}) });
|
|
279078
279170
|
const out2 = /* @__PURE__ */ new Map();
|
|
279079
279171
|
if (built.compileErrors.length) return compileFailureFrames(built.compileErrors, screens, variant);
|
|
279080
|
-
const scratch =
|
|
279172
|
+
const scratch = join202(outDir, `.build-${variant}`);
|
|
279081
279173
|
try {
|
|
279082
279174
|
const outcome = await buildReleaseFromContent2(root, scratch, {
|
|
279083
279175
|
...built.built.length || built.compileErrors.length ? { tier5Dir: bundleOutDir2(root) } : {},
|
|
@@ -279186,7 +279278,7 @@ var init_capture = __esm({
|
|
|
279186
279278
|
import { spawn as spawn10 } from "node:child_process";
|
|
279187
279279
|
import { copyFileSync as copyFileSync4, mkdtempSync as mkdtempSync15, readFileSync as readFileSync188, rmSync as rmSync48 } from "node:fs";
|
|
279188
279280
|
import { tmpdir as tmpdir16 } from "node:os";
|
|
279189
|
-
import { basename as basename42, dirname as dirname88, join as
|
|
279281
|
+
import { basename as basename42, dirname as dirname88, join as join203, resolve as resolve128 } from "node:path";
|
|
279190
279282
|
import { fileURLToPath as fileURLToPath40 } from "node:url";
|
|
279191
279283
|
function parseVerdict(value2, captured) {
|
|
279192
279284
|
const v2 = value2;
|
|
@@ -279236,10 +279328,10 @@ async function judgeStrip(strip4, screen, variant, opts = {}) {
|
|
|
279236
279328
|
"",
|
|
279237
279329
|
`Screen \`${screen}\`, variant \`${variant}\`. Read the strip image at ./${basename42(strip4)} and judge it.`
|
|
279238
279330
|
].join("\n");
|
|
279239
|
-
const cwd = mkdtempSync15(
|
|
279331
|
+
const cwd = mkdtempSync15(join203(tmpdir16(), "himi-fidelity-judge-"));
|
|
279240
279332
|
let r3;
|
|
279241
279333
|
try {
|
|
279242
|
-
copyFileSync4(strip4,
|
|
279334
|
+
copyFileSync4(strip4, join203(cwd, basename42(strip4)));
|
|
279243
279335
|
r3 = await run4("claude", judgeArgs(schema2), { cwd, input, timeoutMs });
|
|
279244
279336
|
} catch (e2) {
|
|
279245
279337
|
return cannotTell(`the judge could not be prepared: ${e2.message}`);
|
|
@@ -279298,7 +279390,7 @@ var init_judge = __esm({
|
|
|
279298
279390
|
// src/fidelity/score.ts
|
|
279299
279391
|
import { spawn as spawn11 } from "node:child_process";
|
|
279300
279392
|
import { mkdtempSync as mkdtempSync16, rmSync as rmSync49 } from "node:fs";
|
|
279301
|
-
import { join as
|
|
279393
|
+
import { join as join204 } from "node:path";
|
|
279302
279394
|
import { tmpdir as tmpdir17 } from "node:os";
|
|
279303
279395
|
function viewportHeight(width) {
|
|
279304
279396
|
return Math.round(width * 2.165);
|
|
@@ -279320,10 +279412,10 @@ async function scorePair(aFile, bFile, opts = {}) {
|
|
|
279320
279412
|
const sizes = await Promise.all([aFile, bFile].map(async (f2) => (await magick(run4, ["identify", "-format", "%w %h", f2])).split(" ").map(Number)));
|
|
279321
279413
|
const width = Math.min(sizes[0][0], sizes[1][0]);
|
|
279322
279414
|
const height = Math.min(...sizes.map(([w2, h2]) => Math.round(h2 * width / w2)), viewportHeight(width));
|
|
279323
|
-
const dir = mkdtempSync16(
|
|
279415
|
+
const dir = mkdtempSync16(join204(tmpdir17(), "himi-fidelity-score-"));
|
|
279324
279416
|
try {
|
|
279325
279417
|
const norm3 = await Promise.all([aFile, bFile].map(async (f2, i2) => {
|
|
279326
|
-
const out2 =
|
|
279418
|
+
const out2 = join204(dir, `${i2}.png`);
|
|
279327
279419
|
const mask = opts.mask ?? { top: 0, bottom: 0 };
|
|
279328
279420
|
const draw = [
|
|
279329
279421
|
...mask.top > 0 ? ["-draw", `rectangle 0,0 ${width},${mask.top - 1}`] : [],
|
|
@@ -279399,7 +279491,7 @@ var init_evidence = __esm({
|
|
|
279399
279491
|
|
|
279400
279492
|
// src/fidelity/strip.ts
|
|
279401
279493
|
import { mkdtempSync as mkdtempSync17, rmSync as rmSync51 } from "node:fs";
|
|
279402
|
-
import { join as
|
|
279494
|
+
import { join as join205 } from "node:path";
|
|
279403
279495
|
import { tmpdir as tmpdir18 } from "node:os";
|
|
279404
279496
|
async function buildStrip(frames, out2, opts = {}) {
|
|
279405
279497
|
const run4 = opts.run ?? runProcess;
|
|
@@ -279408,7 +279500,7 @@ async function buildStrip(frames, out2, opts = {}) {
|
|
|
279408
279500
|
const { pointsize, strip: strip4 } = labelMetrics(width);
|
|
279409
279501
|
const font = resolveCaptionFont();
|
|
279410
279502
|
const fontArgs = font ? ["-font", font] : [];
|
|
279411
|
-
const dir = mkdtempSync17(
|
|
279503
|
+
const dir = mkdtempSync17(join205(tmpdir18(), "himi-fidelity-strip-"));
|
|
279412
279504
|
const magick2 = async (args) => {
|
|
279413
279505
|
const r3 = await run4("magick", args);
|
|
279414
279506
|
if (r3.code !== 0) throw new Error(`magick failed building the strip: ${r3.stderr.trim() || `exit ${r3.code}`}`);
|
|
@@ -279418,7 +279510,7 @@ async function buildStrip(frames, out2, opts = {}) {
|
|
|
279418
279510
|
for (const surface of STRIP_ORDER) {
|
|
279419
279511
|
const frame = frames.find((f2) => f2.surface === surface);
|
|
279420
279512
|
if (!frame) continue;
|
|
279421
|
-
const pane =
|
|
279513
|
+
const pane = join205(dir, `${surface}.png`);
|
|
279422
279514
|
const body = frame.file ? [frame.file, "-alpha", "remove", "-resize", `${width}x`, "-crop", `${width}x${height}+0+0`, "+repage", "-background", "white", "-gravity", "north", "-extent", `${width}x${height}`] : ["-size", `${width}x${height}`, "xc:#d9d9d9", ...fontArgs, "-fill", "#333", "-pointsize", String(Math.round(pointsize * 0.8)), "-gravity", "center", "-annotate", "+0+0", `skipped: ${frame.skipped?.reason ?? "no capture"}`];
|
|
279423
279515
|
const label4 = `${surface.toUpperCase()}${frame.noReference ? " (no reference)" : ""}`;
|
|
279424
279516
|
await magick2([...body, "-gravity", "north", "-background", "#111", "-splice", `0x${strip4}`, ...fontArgs, "-fill", "white", "-pointsize", String(pointsize), "-annotate", "+0+4", label4, pane]);
|
|
@@ -279455,7 +279547,7 @@ __export(run_exports2, {
|
|
|
279455
279547
|
unlinkableScreens: () => unlinkableScreens
|
|
279456
279548
|
});
|
|
279457
279549
|
import { mkdirSync as mkdirSync70, writeFileSync as writeFileSync79 } from "node:fs";
|
|
279458
|
-
import { basename as basename43, join as
|
|
279550
|
+
import { basename as basename43, join as join206 } from "node:path";
|
|
279459
279551
|
function unlinkableScreens(config, screens, home2) {
|
|
279460
279552
|
const navigation = config?.navigation;
|
|
279461
279553
|
const linkables = Array.isArray(navigation?.linkableScreens) ? navigation.linkableScreens : [];
|
|
@@ -279514,8 +279606,8 @@ async function runFidelity(root, opts = {}) {
|
|
|
279514
279606
|
if (unknown.length) throw Object.assign(new Error(`unknown screen(s): ${unknown.join(", ")}`), { code: "fidelity_unknown_screen" });
|
|
279515
279607
|
const variants = opts.variants?.length ? opts.variants : VARIANTS;
|
|
279516
279608
|
const run4 = opts.run ?? runId();
|
|
279517
|
-
const dir =
|
|
279518
|
-
const framesDir =
|
|
279609
|
+
const dir = join206(opts.outRoot ?? join206(root, ".himi", "fidelity"), run4);
|
|
279610
|
+
const framesDir = join206(dir, "frames");
|
|
279519
279611
|
mkdirSync70(framesDir, { recursive: true });
|
|
279520
279612
|
const session = opts.capture?.mockup ? void 0 : new MockupSession();
|
|
279521
279613
|
const mockup = opts.capture?.mockup ?? ((r3, s5, e2, v2, o2) => captureMockup(r3, s5, e2, v2, o2, session));
|
|
@@ -279566,7 +279658,7 @@ async function runFidelity(root, opts = {}) {
|
|
|
279566
279658
|
let stripFile;
|
|
279567
279659
|
let verdict;
|
|
279568
279660
|
const judged2 = frames.filter((f2) => !f2.noReference);
|
|
279569
|
-
const stripPath2 =
|
|
279661
|
+
const stripPath2 = join206(dir, `${screen}.${variant}.strip.png`);
|
|
279570
279662
|
if (!w2?.file || judged2.filter((f2) => f2.file).length < 2) {
|
|
279571
279663
|
if (frames.some((f2) => f2.file)) stripFile = await strip4(frames, stripPath2);
|
|
279572
279664
|
verdict = skippedJudge(!w2?.file ? "no web render, and web is the reference for both design and parity" : frames.some((f2) => f2.noReference) ? `the mockup does not style ${variant}, and there is no native pane to compare with web` : "fewer than two captured panes, so there is nothing to compare");
|
|
@@ -279590,7 +279682,7 @@ async function runFidelity(root, opts = {}) {
|
|
|
279590
279682
|
await native?.restore?.();
|
|
279591
279683
|
}
|
|
279592
279684
|
const report9 = { app: basename43(root), run: run4, dir, rows, status: worst(rows) };
|
|
279593
|
-
writeFileSync79(
|
|
279685
|
+
writeFileSync79(join206(dir, "report.json"), JSON.stringify(report9, null, 2) + "\n");
|
|
279594
279686
|
return report9;
|
|
279595
279687
|
}
|
|
279596
279688
|
function prCommentBody(report9) {
|
|
@@ -279652,7 +279744,7 @@ __export(native_exports, {
|
|
|
279652
279744
|
});
|
|
279653
279745
|
import { spawn as spawn12 } from "node:child_process";
|
|
279654
279746
|
import { readFileSync as readFileSync189, writeFileSync as writeFileSync80 } from "node:fs";
|
|
279655
|
-
import { join as
|
|
279747
|
+
import { join as join207 } from "node:path";
|
|
279656
279748
|
function resumedPackages(dumpsys) {
|
|
279657
279749
|
const lines2 = dumpsys.split("\n").filter((l3) => /\b(?:topResumedActivity|mResumedActivity|ResumedActivity)\b/.test(l3));
|
|
279658
279750
|
if (!lines2.length) return void 0;
|
|
@@ -279799,7 +279891,7 @@ function nativeCapture(devices, opts) {
|
|
|
279799
279891
|
const container = await run4("xcrun", ["simctl", "get_app_container", id, iosBundle, "app"]);
|
|
279800
279892
|
let compiled = "";
|
|
279801
279893
|
if (container.code === 0) {
|
|
279802
|
-
const plist = await run4("plutil", ["-extract", "HimalayaAPIBaseURL", "raw", "-o", "-",
|
|
279894
|
+
const plist = await run4("plutil", ["-extract", "HimalayaAPIBaseURL", "raw", "-o", "-", join207(container.stdout.toString().trim(), "Info.plist")]);
|
|
279803
279895
|
if (plist.code === 0) compiled = plist.stdout.toString().trim();
|
|
279804
279896
|
}
|
|
279805
279897
|
const rebuild = `HIMALAYA_API_BASE_URL_INFO=${opts.serveOrigin}`;
|
|
@@ -279870,7 +279962,7 @@ function nativeCapture(devices, opts) {
|
|
|
279870
279962
|
}
|
|
279871
279963
|
await apply2(platform, id, variant);
|
|
279872
279964
|
await open6(platform, id, `himi://app/${encodeURIComponent(picker)}`);
|
|
279873
|
-
const file2 =
|
|
279965
|
+
const file2 = join207(outDir, `${screen}.${variant}.${platform}.png`);
|
|
279874
279966
|
const pickerFrame = (await settle2(platform, id, file2)).frame;
|
|
279875
279967
|
await open6(platform, id, screenLink(opts.appId, screen, entry, opts.release));
|
|
279876
279968
|
const { unsettled } = await settle2(platform, id, file2, pickerFrame);
|
|
@@ -279973,13 +280065,13 @@ __export(serve_exports, {
|
|
|
279973
280065
|
});
|
|
279974
280066
|
import { copyFileSync as copyFileSync5, existsSync as existsSync161, mkdirSync as mkdirSync71, mkdtempSync as mkdtempSync18, rmSync as rmSync52 } from "node:fs";
|
|
279975
280067
|
import { tmpdir as tmpdir19 } from "node:os";
|
|
279976
|
-
import { join as
|
|
280068
|
+
import { join as join208 } from "node:path";
|
|
279977
280069
|
function copyFreshBundles(built, outDir, into) {
|
|
279978
280070
|
mkdirSync71(into, { recursive: true });
|
|
279979
280071
|
for (const name of built) {
|
|
279980
280072
|
for (const file2 of [`${name}.bundle.js`, `${name}.bundle.js.map`]) {
|
|
279981
|
-
const from =
|
|
279982
|
-
if (existsSync161(from)) copyFileSync5(from,
|
|
280073
|
+
const from = join208(outDir, file2);
|
|
280074
|
+
if (existsSync161(from)) copyFileSync5(from, join208(into, file2));
|
|
279983
280075
|
}
|
|
279984
280076
|
}
|
|
279985
280077
|
}
|
|
@@ -279995,7 +280087,7 @@ async function serveWorkingCopy(dir, port) {
|
|
|
279995
280087
|
const { buildContentBundles: buildContentBundles2, buildReleaseFromContent: buildReleaseFromContent2 } = await loadAuthoring();
|
|
279996
280088
|
const bundles = await buildContentBundles2(dir, {});
|
|
279997
280089
|
if (bundles.compileErrors.length) throw new Error(`the content package's workers do not compile (${bundles.compileErrors.length} error(s)); run \`himi build\` to see them`);
|
|
279998
|
-
const temp = mkdtempSync18(
|
|
280090
|
+
const temp = mkdtempSync18(join208(tmpdir19(), "himi-fidelity-serve-"));
|
|
279999
280091
|
const cleanup = () => rmSync52(temp, { recursive: true, force: true });
|
|
280000
280092
|
const onSignal = () => {
|
|
280001
280093
|
cleanup();
|
|
@@ -280004,12 +280096,12 @@ async function serveWorkingCopy(dir, port) {
|
|
|
280004
280096
|
process.once("SIGINT", onSignal);
|
|
280005
280097
|
process.once("SIGTERM", onSignal);
|
|
280006
280098
|
try {
|
|
280007
|
-
const tier5Dir = bundles.built.length > 0 ?
|
|
280099
|
+
const tier5Dir = bundles.built.length > 0 ? join208(temp, ".tier5") : void 0;
|
|
280008
280100
|
if (tier5Dir) copyFreshBundles(bundles.built, bundles.outDir, tier5Dir);
|
|
280009
280101
|
const outcome = await buildReleaseFromContent2(dir, temp, { ...tier5Dir ? { tier5Dir } : {}, ...RUN_CONTENT_BUILD });
|
|
280010
280102
|
const unservable = releaseProblem(outcome);
|
|
280011
280103
|
if (unservable) throw new Error(unservable);
|
|
280012
|
-
const served = await runPackage(
|
|
280104
|
+
const served = await runPackage(join208(temp, app2), { port, host: "127.0.0.1", chrome: "app", open: false, workDir: temp });
|
|
280013
280105
|
return { origin: served.origin, close: async () => {
|
|
280014
280106
|
await served.close();
|
|
280015
280107
|
cleanup();
|
|
@@ -280063,7 +280155,7 @@ __export(fidelity_exports, {
|
|
|
280063
280155
|
});
|
|
280064
280156
|
import { execFileSync as execFileSync12 } from "node:child_process";
|
|
280065
280157
|
import { existsSync as existsSync162, realpathSync as realpathSync25 } from "node:fs";
|
|
280066
|
-
import { join as
|
|
280158
|
+
import { join as join209, relative as relative37, sep as sep35 } from "node:path";
|
|
280067
280159
|
function himalayaRepoRoot(dir) {
|
|
280068
280160
|
let top;
|
|
280069
280161
|
try {
|
|
@@ -280071,7 +280163,7 @@ function himalayaRepoRoot(dir) {
|
|
|
280071
280163
|
} catch {
|
|
280072
280164
|
return null;
|
|
280073
280165
|
}
|
|
280074
|
-
if (!existsSync162(
|
|
280166
|
+
if (!existsSync162(join209(top, "tools/judges/fidelity/JUDGE.md"))) return null;
|
|
280075
280167
|
const rel2 = relative37(realpathSync25(top), realpathSync25(dir));
|
|
280076
280168
|
return rel2.startsWith(`..${sep35}`) || rel2 === ".." ? null : top;
|
|
280077
280169
|
}
|
|
@@ -280104,7 +280196,7 @@ async function fidelityCommand(ctx) {
|
|
|
280104
280196
|
return 2;
|
|
280105
280197
|
}
|
|
280106
280198
|
const { runFidelity: runFidelity2, prCommentBody: prCommentBody2 } = await Promise.resolve().then(() => (init_run3(), run_exports2));
|
|
280107
|
-
const judgeDir =
|
|
280199
|
+
const judgeDir = join209(repo, "tools/judges/fidelity");
|
|
280108
280200
|
const deviceFlags = { ios: "ios", android: "android", iosTablet: "ios-tablet", androidTablet: "android-tablet" };
|
|
280109
280201
|
const bare = Object.values(deviceFlags).filter((f2) => flags[f2] !== void 0 && !str3(flags[f2]));
|
|
280110
280202
|
if (bare.length) {
|
|
@@ -280210,7 +280302,7 @@ async function fidelityCommand(ctx) {
|
|
|
280210
280302
|
else {
|
|
280211
280303
|
for (const r3 of report9.rows) io2.log(`${r3.status.padEnd(4)} ${r3.screen}/${r3.variant} design=${r3.judge.design} parity=${r3.judge.parity}${r3.reasons.length ? ` \u2014 ${r3.reasons[0]}` : ""}`);
|
|
280212
280304
|
io2.log(`
|
|
280213
|
-
${report9.status.toUpperCase()} \u2014 report: ${
|
|
280305
|
+
${report9.status.toUpperCase()} \u2014 report: ${join209(report9.dir, "report.json")}`);
|
|
280214
280306
|
}
|
|
280215
280307
|
return report9.status === "fail" ? 1 : 0;
|
|
280216
280308
|
}
|
|
@@ -280300,8 +280392,8 @@ async function publishSizeCommand(ctx) {
|
|
|
280300
280392
|
}
|
|
280301
280393
|
const dir = contentDir2(flags);
|
|
280302
280394
|
const { existsSync: existsSync164 } = await import("node:fs");
|
|
280303
|
-
const { join:
|
|
280304
|
-
if (!existsSync164(
|
|
280395
|
+
const { join: join211 } = await import("node:path");
|
|
280396
|
+
if (!existsSync164(join211(dir, "dev", "index.ts"))) return fail16("build_failed", "expected a content package with dev/index.ts; pass --content <dir>");
|
|
280305
280397
|
const declared = await appId3(dir);
|
|
280306
280398
|
const app2 = typeof flags.app === "string" ? flags.app : declared;
|
|
280307
280399
|
if (!isValidAppId(app2)) return fail16("invalid_usage", "declared app is not a valid publish ID; pass --app <valid-slug>", { app: app2 }, 2);
|
|
@@ -280414,7 +280506,7 @@ __export(ext_impl_exports, {
|
|
|
280414
280506
|
runExt: () => runExt
|
|
280415
280507
|
});
|
|
280416
280508
|
import { existsSync as existsSync163, mkdirSync as mkdirSync72, readFileSync as readFileSync190, writeFileSync as writeFileSync81 } from "node:fs";
|
|
280417
|
-
import { join as
|
|
280509
|
+
import { join as join210 } from "node:path";
|
|
280418
280510
|
import ts33 from "typescript";
|
|
280419
280511
|
async function runExt(ctx) {
|
|
280420
280512
|
const { pos, flags, io: io2, print } = ctx;
|
|
@@ -280445,7 +280537,7 @@ async function runExt(ctx) {
|
|
|
280445
280537
|
hint: `run \`himi capabilities ${catalogId}\` for how to use it, or pass --force to create the extension anyway`
|
|
280446
280538
|
}, 2);
|
|
280447
280539
|
}
|
|
280448
|
-
const configPath =
|
|
280540
|
+
const configPath = join210(dir, "config.ts");
|
|
280449
280541
|
if (!existsSync163(configPath)) return fail16("extensions_config_missing", `no config.ts in ${dir}; run this inside a content package (or pass --content)`);
|
|
280450
280542
|
const declared = declaredExtensions(dir);
|
|
280451
280543
|
if (declared.kind === "opaque") {
|
|
@@ -280454,7 +280546,7 @@ async function runExt(ctx) {
|
|
|
280454
280546
|
if (!declared.names.includes(name) && declared.names.length >= MAX_EXTENSIONS) {
|
|
280455
280547
|
return fail16("extension_limit", `an app may declare at most ${MAX_EXTENSIONS} extensions`, { limit: MAX_EXTENSIONS });
|
|
280456
280548
|
}
|
|
280457
|
-
const extDir =
|
|
280549
|
+
const extDir = join210(dir, EXTENSIONS_DIR, name);
|
|
280458
280550
|
if (existsSync163(extDir)) return fail16("extension_exists", `${EXTENSIONS_DIR}/${name}/ already exists`, { extension: name });
|
|
280459
280551
|
const views2 = [str3(flags.views), str3(flags.view)].filter(Boolean).flatMap((v2) => v2.split(",")).map((v2) => v2.trim()).filter(Boolean);
|
|
280460
280552
|
const badView = views2.find((v2) => !isValidViewName(v2) || CORE_TYPE_NAMES.has(v2));
|
|
@@ -280464,8 +280556,8 @@ async function runExt(ctx) {
|
|
|
280464
280556
|
const pascal2 = pascalName(name);
|
|
280465
280557
|
const files = [];
|
|
280466
280558
|
const put = (rel2, text32) => {
|
|
280467
|
-
const path2 =
|
|
280468
|
-
mkdirSync72(
|
|
280559
|
+
const path2 = join210(extDir, rel2);
|
|
280560
|
+
mkdirSync72(join210(path2, ".."), { recursive: true });
|
|
280469
280561
|
writeFileSync81(path2, text32, { flag: "wx" });
|
|
280470
280562
|
files.push(`${EXTENSIONS_DIR}/${name}/${rel2}`);
|
|
280471
280563
|
};
|
|
@@ -280522,9 +280614,9 @@ async function runExt(ctx) {
|
|
|
280522
280614
|
return 0;
|
|
280523
280615
|
}
|
|
280524
280616
|
function loadModelFor(extDir) {
|
|
280525
|
-
const parsed = parseExtensionManifest(JSON.parse(readFileSync190(
|
|
280617
|
+
const parsed = parseExtensionManifest(JSON.parse(readFileSync190(join210(extDir, EXTENSION_MANIFEST), "utf8")));
|
|
280526
280618
|
if (!parsed.ok) return { ok: false, message: parsed.problems.map((p2) => p2.message).join("; ") };
|
|
280527
|
-
const iface = parseExtensionInterface(readFileSync190(
|
|
280619
|
+
const iface = parseExtensionInterface(readFileSync190(join210(extDir, parsed.manifest.interface), "utf8"), parsed.manifest);
|
|
280528
280620
|
if (!iface.ok) return { ok: false, message: iface.problems.map((p2) => p2.message).join("; ") };
|
|
280529
280621
|
return { ok: true, model: iface.model };
|
|
280530
280622
|
}
|
|
@@ -281540,10 +281632,14 @@ var USAGE = `himi \u2014 the Himalaya authoring CLI (remote dev loop)
|
|
|
281540
281632
|
create the app in your own Play Console: shows Google's Create
|
|
281541
281633
|
app declarations with their terms links; only your typed yes
|
|
281542
281634
|
accepts them (recorded as a local approval id).
|
|
281543
|
-
himi store google testers pool-add|pool-remove|pool-check [--dir <app>] [--track
|
|
281544
|
-
put Wix's tester group (HIMI_POOL_TESTER_GROUP) on
|
|
281545
|
-
closed track
|
|
281546
|
-
after your typed yes
|
|
281635
|
+
himi store google testers pool-add|pool-remove|pool-check [--dir <app>] [--track himi-pool]
|
|
281636
|
+
put Wix's tester group (HIMI_POOL_TESTER_GROUP) on the
|
|
281637
|
+
custom closed track himi-pool (pool-add creates it), or take
|
|
281638
|
+
it off (your other groups stay), after your typed yes or your
|
|
281639
|
+
recorded consent; pool-check only reads.
|
|
281640
|
+
himi store google testers consent grant|revoke|status [--dir <app>] [--android-package <p>] [--developer <id>]
|
|
281641
|
+
grant records your typed yes for 90 days so pool-add and
|
|
281642
|
+
pool-remove run unattended; revoke deletes it; status shows it.
|
|
281547
281643
|
himi store google keygen <package> [--out <file.p12>] [--alias <name>] [--name <certificate name>]
|
|
281548
281644
|
make the upload key for an owner-signed app (no Wix site) on this
|
|
281549
281645
|
computer: keystore, its password in a 0600 .pass file, and the
|
|
@@ -281914,7 +282010,7 @@ var COMMANDS = [
|
|
|
281914
282010
|
{ name: "visibility", summary: "read (no value) or set whether the public registry (/v1/apps + the Himi Player picker) LISTS the app. `public` lists it for everyone; `unlisted` hides it from listings while direct reads by app id \u2014 deep links, previews \u2014 keep working. App from --app or the content dir. Setting it needs no republish.", required: "[public|unlisted] [--app <a>] [--content <dir>] (--control-token)" },
|
|
281915
282011
|
{ name: "dist", summary: "build an INSTALLABLE QA binary (signed IPA / APK) on the Wix Job Service Mac pool and return an install link \u2014 the serve plane brokers the job, the pool builds it. WAITS for the build by default (~4 min) and prints the install link; `--no-wait` returns a jobId immediately instead. Omitting `--release` builds whatever is LIVE for the app. A named draft is refused unless `--allow-draft` makes that exceptional build explicit. `status <jobId>` / `watch <jobId>` / `list --app <a>` / `cancel <jobId>` inspect and stop builds (`watch` reports up front whether the job mints its own signing identity or borrows one, so a doomed iOS build is cancellable in seconds rather than after the archive). Off-repo, name a target \u2014 `--target wix` for a self-serve Wix login or `--target bo` for the internal employee path (the in-repo default is a local dev plane that isn't reachable off-repo); self-serve callers may build their OWN apps under a tighter budget (2 in flight / 5 per 24h), while a manage-only owner-role credential is refused. `--shell` picks the native host to sign into (branded-lite | owner-lite | brandy | base44 | game | player | demo-app) and defaults to the content package's himalaya.content.json `shell` (templates carry the one they were written for), else branded-lite. The per-app shells ADD the release's declared capabilities to the binary, while Himi Player and demo-app refuse a release declaring one they lack; `--plan` previews it without building; `brandy` builds a site-shell app (the customer's own website as native-framed tabs) on the branded-lite binary under Brandy's bundle ids, so an installed Brandy app updates in place \u2014 it needs a release that serves its own site block (`release_site_missing` otherwise); `game` is the Godot game shell, the only one that serves `godot`. `--signing` defaults to `wix-managed` \u2014 the Wix Apple account mints a per-app signing identity for the build, so the caller provisions no Apple credentials of their own; `--signing byo --site <id>` reuses an existing customer ad-hoc profile and certificate for iOS; requires an owned site and a completed personal signing binding. `--android-signing` is the Android counterpart and a SEPARATE axis (a keystore, not an Apple account): `qa-keystore` (default \u2014 the repo's committed QA key, identical on every pool machine, so a build installs over the previous one), `wix-keystore` (the Wix key the pool machine carries; the build FAILS naming the paths searched if it carries none, rather than quietly signing with something else), or `debug` (the old per-machine key \u2014 QA must uninstall any previous build first). `--aab` builds an Android App Bundle (.aab) for the owner to upload to Google Play AND an APK from the same build \u2014 a download link for the .aab, an install link and QR for the APK; Android only; the bundle is signed with the Wix production key (`wix-keystore`, the upload key Branded apps use) \u2014 any other `--android-signing` is refused \u2014 and the APK with the committed QA key; a self-serve caller gets one only as the store build of its own Containers app (it must own the app's site, and `--aab` sends your Wix login); any other self-serve `--aab` gets 403 android_format_not_allowed. `--app-name <name> --app-icon-url <url>` (together; the icon a `https://static.wixstatic.com/media/<file>` URL) give the binary a name and icon in place of the release's, and a Containers app's store build (`--aab`, or its TestFlight build) needs both. NOT the normal way to ship: screens, Tier-5 bundles, tokens and app-config all go over the air with `himi push` in seconds \u2014 a binary trip is only needed for a NATIVE delta (a new SDUI component, a new declared capability/entitlement, a new bundle id, or a minBinaryVersion floor bump). Refuses to build an app whose launcher icon is missing, a placeholder, or one a store would reject \u2014 the one thing a binary carries that no later OTA push can fix; `--force` builds anyway. Also refuses a release whose member login (WixConsumerAuthProvider) names no siteId, or not in lower case, when Wix says its site requires a member CAPTCHA \u2014 such a binary ships without the CAPTCHA key and every member sign-in fails; whatever it cannot read (the release, the site's setting) only warns and builds; `--skip-captcha-check` builds anyway", required: "[--app <a>] [--platform ios,android] [--release <id>] [--allow-draft] [--target <t>] [--shell branded-lite|owner-lite|brandy|base44|game|player|demo-app] [--signing wix-managed|byo] [--site <id>] [--android-signing qa-keystore|wix-keystore|debug] [--aab] [--min-version-code <n>] [--app-name <name> --app-icon-url <url>] [--borrow-ios-id <bundleId>] [--no-wait] [--force] [--skip-captcha-check] [--plan] | status <jobId> [--target <t>] | watch <jobId> [--target <t>] [--interval <ms>] | list --app <a> [--target <t>] | cancel <jobId> [--target <t>]" },
|
|
281916
282012
|
{ name: "testflight", summary: 'build, sign and upload an app to TestFlight (internal testers \u2014 no Beta App Review), then WAIT until App Store Connect finishes processing it. Sugar for `store upload --track testflight`. Prompts first: a build number is consumed permanently on a real Apple account and cannot be reused \u2014 `--yes` for CI, `--dry-run` to see the plan without touching anything. The wait is the real check, not a nicety: fastlane prints "Successfully uploaded" for a binary App Store Connect then rejects in processing, and a rejected binary leaves NO build record at all (the reason is emailed). Public App Store review is deliberately NOT automatable here \u2014 `--track appstore` is refused; use /submit-ios-app when you mean to go public', required: "<app> [--track testflight|internal] [--profile <name>] [--yes] [--dry-run] [--skip-build] [--no-wait] [--json]" },
|
|
281917
|
-
{ name: "store", summary: "`app set --app <id> --site <msid> --android-package himi.<name>` gives an app YOUR account owns (one made with `himi init`) the Google Play store app of a Wix site your account also owns, so `himi dist --aab` makes its Wix-signed (WixOne) Play bundle: the app is LINKED to the site, never converted into a site app, so your `himi login` token keeps working for push and the rest. One site per app and one app per site; the package name is permanent once a build locks it. `app show --app <id> --site <msid>` runs the store build's checks without building (saved package name, the site's Premium plan). Both send your `himi login` control token plus the account `wix token`, which the plane uses to verify your account owns the app and the site (`himi docs qa-builds`). `apple-keys setup|status` onboards the owner\u2019s ASC and In-App Purchase keys independently of push and signing profiles. `connect` and `submission status|plan|apply|rejection|reply` submit an app to the App Store from YOUR computer under YOUR Apple account, off-repo (Node 24+): `connect` opens a sign-in page on 127.0.0.1 where you type your Apple ID password and 2FA code (no flag takes them) and creates an Admin API key saved in this computer's keychain, shared with Wix for App Store builds when the app's store/app-store.json names its site; `submission plan` plans the next ordered batch and `apply` applies it only after you type the plan hash's first 8 characters (or click Approve on a local page). The same steps are the store_* tools of `himi mcp` (`himi docs store-submission`). `--platform android` takes `connect` and `submission status|plan|apply|rejection|reply` to Google Play instead: `connect` signs you in to Google in your browser (the OAuth client file from GPLAY_OAUTH_CLIENT_FILE or gplay-node's state dir, else a gcloud sign-in), the facts come from the app's store/google-play.json (category, contactEmail, privacyPolicyUrl, targetAudience, contentRatingCategory, packageName), a site-linked himi.<name> app is Wix-signed (`himi dist --aab`) and any other owner-signed (`--android-signing owner --google-services <file>`, then `google keygen <package>` makes the upload key once and `google resign <in.aab> --keystore <file.p12> --storepass-file <file>` signs the bundle, both on this computer), `apply` takes one `--job`, and `submission approve-reply --platform android --issue <id> --kind appeal|resubmit --text <reply>` records your typed yes on one exact policy reply (no --yes), the only way `reply` or store_reply can plan it. `record show|refresh|sync|pull` reads the app's store record on this computer (~/.himi/store, or HIMI_STORE_HOME / --record-dir): what each store showed when last read, what was last sent and what is drafted, with ages and drift; `refresh --platform android [--part status|tracks|listing|app-content|account|policy|all]` reads Google again into it; `sync` exchanges it with the copy Wix keeps for the app and `pull` only fetches it, for a new computer, with your himi login: the site's owner writes it, and so does the Wix person helping with the app while the owner lets Wix submit it (`wix-submit start`), while a `--read-only` consent only lets them pull; after a job verifies, the record is pushed on its own (a failure is a warning; HIMI_STORE_RECORD_SYNC=off turns it off). `handoff` uploads the app's asc-node records (allowlisted ids, statuses and outcomes; never keys, cookies or passwords) so Wix can take the submission over, `--out`/`--dry-run` keep it local. `wix-submit start [--platform ios|android] [--read-only] [--yes]` lets Wix submit the app for you: after your yes it records your consent for 90 days (read and submit; on Android also Wix-signed builds and Play Console work; `--read-only` is read alone), sends the handoff, and on Android adds the Wix person helping with your app to YOUR Google Play account for 90 days, showing their name and email first, after a typed yes at a terminal (`--yes` answers the consent only; with no one named yet, Wix contacts you and you run start again); `wix-submit stop` withdraws the consent and removes everyone Wix added to your Google Play account for the app (non-zero while anyone may remain); `wix-submit status` shows the consent (scopes, recorded, expires), who is helping and whether they are on your Play account. All are site-owner only (`himi store wix-submit --help`). `google create-app --name <n>` creates the app in your own Play Console after you read Google's Create app declarations and type yes. The App Store Connect group behind `testflight`. `preflight <app>` checks readiness offline (icon, entitlements, encryption flag, version, store.config ids, listing + review record); `upload <app>` is what `testflight` runs; `status <app>` reads live build + processing state. `--profile` selects WHICH App Store Connect account: an app built for a Wix customer ships under the CUSTOMER's Apple team (Apple guideline 4.2.6 forbids an app-generation service submitting on a client's behalf), declared per-app as ios.credentialProfile in store.config.yaml and resolved from ~/.himalaya/store-credentials/<name>.json \u2014 the .p8 itself never enters the repo. `iap draft|plan|apply|status|connect|screenshots|check|mappings` registers an app owner's digital products as in-app purchases (non-consumables, or consumable price tiers): draft reads the Wix catalog and writes the manifest, plan and status only read, apply is the one App Store mutation boundary, connect readies the Wix site to sell them (purchases app, In-App Purchase key, appleIAP provider, product mappings; --preview-tag routes only its Serve calls to a deploy preview), legacy screenshots --profile renders each product's purchase screen from the app (--content) as a bound iPhone shows it to a signed-in member and names the 1290\xD72796 PNG as the item's App Review screenshot, and none of them builds, signs or needs a checkout (`himi docs iap-products`) IAP provisioning defaults to Catalog; managed apply generates screenshots on the server with no local .p8 or profile fallback; --managed is optional and --profile selects legacy mode; --catalog-route or HIMI_IAP_CATALOG_ROUTE has no default.", required: "app set --app <id> --site <msid> --android-package himi.<name> | app show --app <id> --site <msid> | connect [--dir <app>] [--app <id> --site <msid>] [--no-key] [--profile <name>] | submission status|plan|rejection [--dir <app>] [--apple-id <id>] [--profile <name>] | submission apply (--batch <id> | --job <id>) --plan-hash <hash> | submission reply --text <reply> [--attach <file>]\u2026 [--thread <id>] [--dir <app>] | connect --platform android | submission status|plan|rejection --platform android [--dir <app>] [--issue <id>] | submission apply --platform android --job <id> --plan-hash <hash> | submission reply|approve-reply --platform android --issue <id> --kind appeal|resubmit --text <reply> [--dir <app>] | record show [--dir <app>] [--platform android|ios] [--part <part>] [--record-dir <dir>] | record refresh [--dir <app>] [--platform android] [--part <part>] | record sync|pull [--dir <app>] [--app <id> --site <msid>] [--record-dir <dir>] | handoff [--dir <app>] [--app <id> --site <msid>] [--apple-app-id <id>] [--out <file> | --dry-run] | wix-submit start [--dir <app>] [--app <id> --site <msid>] [--platform ios|android] [--read-only] [--yes] [--developer <id>] [--android-package himi.<name>] | wix-submit stop [--dir <app>] [--app <id> --site <msid>] [--platform ios|android] [--yes] [--developer <id>] | wix-submit status [--dir <app>] [--app <id> --site <msid>] [--platform ios|android] [--developer <id>] | google create-app --name <app name> [--app <id> --site <msid>] [--developer <id>] [--android-package himi.<name>] | google testers pool-add|pool-remove|pool-check [--dir <app>] [--track
|
|
282013
|
+
{ name: "store", summary: "`app set --app <id> --site <msid> --android-package himi.<name>` gives an app YOUR account owns (one made with `himi init`) the Google Play store app of a Wix site your account also owns, so `himi dist --aab` makes its Wix-signed (WixOne) Play bundle: the app is LINKED to the site, never converted into a site app, so your `himi login` token keeps working for push and the rest. One site per app and one app per site; the package name is permanent once a build locks it. `app show --app <id> --site <msid>` runs the store build's checks without building (saved package name, the site's Premium plan). Both send your `himi login` control token plus the account `wix token`, which the plane uses to verify your account owns the app and the site (`himi docs qa-builds`). `apple-keys setup|status` onboards the owner\u2019s ASC and In-App Purchase keys independently of push and signing profiles. `connect` and `submission status|plan|apply|rejection|reply` submit an app to the App Store from YOUR computer under YOUR Apple account, off-repo (Node 24+): `connect` opens a sign-in page on 127.0.0.1 where you type your Apple ID password and 2FA code (no flag takes them) and creates an Admin API key saved in this computer's keychain, shared with Wix for App Store builds when the app's store/app-store.json names its site; `submission plan` plans the next ordered batch and `apply` applies it only after you type the plan hash's first 8 characters (or click Approve on a local page). The same steps are the store_* tools of `himi mcp` (`himi docs store-submission`). `--platform android` takes `connect` and `submission status|plan|apply|rejection|reply` to Google Play instead: `connect` signs you in to Google in your browser (the OAuth client file from GPLAY_OAUTH_CLIENT_FILE or gplay-node's state dir, else a gcloud sign-in), the facts come from the app's store/google-play.json (category, contactEmail, privacyPolicyUrl, targetAudience, contentRatingCategory, packageName), a site-linked himi.<name> app is Wix-signed (`himi dist --aab`) and any other owner-signed (`--android-signing owner --google-services <file>`, then `google keygen <package>` makes the upload key once and `google resign <in.aab> --keystore <file.p12> --storepass-file <file>` signs the bundle, both on this computer), `apply` takes one `--job`, and `submission approve-reply --platform android --issue <id> --kind appeal|resubmit --text <reply>` records your typed yes on one exact policy reply (no --yes), the only way `reply` or store_reply can plan it. `record show|refresh|sync|pull` reads the app's store record on this computer (~/.himi/store, or HIMI_STORE_HOME / --record-dir): what each store showed when last read, what was last sent and what is drafted, with ages and drift; `refresh --platform android [--part status|tracks|listing|app-content|account|policy|all]` reads Google again into it; `sync` exchanges it with the copy Wix keeps for the app and `pull` only fetches it, for a new computer, with your himi login: the site's owner writes it, and so does the Wix person helping with the app while the owner lets Wix submit it (`wix-submit start`), while a `--read-only` consent only lets them pull; after a job verifies, the record is pushed on its own (a failure is a warning; HIMI_STORE_RECORD_SYNC=off turns it off). `handoff` uploads the app's asc-node records (allowlisted ids, statuses and outcomes; never keys, cookies or passwords) so Wix can take the submission over, `--out`/`--dry-run` keep it local. `wix-submit start [--platform ios|android] [--read-only] [--yes]` lets Wix submit the app for you: after your yes it records your consent for 90 days (read and submit; on Android also Wix-signed builds and Play Console work; `--read-only` is read alone), sends the handoff, and on Android adds the Wix person helping with your app to YOUR Google Play account for 90 days, showing their name and email first, after a typed yes at a terminal (`--yes` answers the consent only; with no one named yet, Wix contacts you and you run start again); `wix-submit stop` withdraws the consent and removes everyone Wix added to your Google Play account for the app (non-zero while anyone may remain); `wix-submit status` shows the consent (scopes, recorded, expires), who is helping and whether they are on your Play account. All are site-owner only (`himi store wix-submit --help`). `google create-app --name <n>` creates the app in your own Play Console after you read Google's Create app declarations and type yes. The App Store Connect group behind `testflight`. `preflight <app>` checks readiness offline (icon, entitlements, encryption flag, version, store.config ids, listing + review record); `upload <app>` is what `testflight` runs; `status <app>` reads live build + processing state. `--profile` selects WHICH App Store Connect account: an app built for a Wix customer ships under the CUSTOMER's Apple team (Apple guideline 4.2.6 forbids an app-generation service submitting on a client's behalf), declared per-app as ios.credentialProfile in store.config.yaml and resolved from ~/.himalaya/store-credentials/<name>.json \u2014 the .p8 itself never enters the repo. `iap draft|plan|apply|status|connect|screenshots|check|mappings` registers an app owner's digital products as in-app purchases (non-consumables, or consumable price tiers): draft reads the Wix catalog and writes the manifest, plan and status only read, apply is the one App Store mutation boundary, connect readies the Wix site to sell them (purchases app, In-App Purchase key, appleIAP provider, product mappings; --preview-tag routes only its Serve calls to a deploy preview), legacy screenshots --profile renders each product's purchase screen from the app (--content) as a bound iPhone shows it to a signed-in member and names the 1290\xD72796 PNG as the item's App Review screenshot, and none of them builds, signs or needs a checkout (`himi docs iap-products`) IAP provisioning defaults to Catalog; managed apply generates screenshots on the server with no local .p8 or profile fallback; --managed is optional and --profile selects legacy mode; --catalog-route or HIMI_IAP_CATALOG_ROUTE has no default.", required: "app set --app <id> --site <msid> --android-package himi.<name> | app show --app <id> --site <msid> | connect [--dir <app>] [--app <id> --site <msid>] [--no-key] [--profile <name>] | submission status|plan|rejection [--dir <app>] [--apple-id <id>] [--profile <name>] | submission apply (--batch <id> | --job <id>) --plan-hash <hash> | submission reply --text <reply> [--attach <file>]\u2026 [--thread <id>] [--dir <app>] | connect --platform android | submission status|plan|rejection --platform android [--dir <app>] [--issue <id>] | submission apply --platform android --job <id> --plan-hash <hash> | submission reply|approve-reply --platform android --issue <id> --kind appeal|resubmit --text <reply> [--dir <app>] | record show [--dir <app>] [--platform android|ios] [--part <part>] [--record-dir <dir>] | record refresh [--dir <app>] [--platform android] [--part <part>] | record sync|pull [--dir <app>] [--app <id> --site <msid>] [--record-dir <dir>] | handoff [--dir <app>] [--app <id> --site <msid>] [--apple-app-id <id>] [--out <file> | --dry-run] | wix-submit start [--dir <app>] [--app <id> --site <msid>] [--platform ios|android] [--read-only] [--yes] [--developer <id>] [--android-package himi.<name>] | wix-submit stop [--dir <app>] [--app <id> --site <msid>] [--platform ios|android] [--yes] [--developer <id>] | wix-submit status [--dir <app>] [--app <id> --site <msid>] [--platform ios|android] [--developer <id>] | google create-app --name <app name> [--app <id> --site <msid>] [--developer <id>] [--android-package himi.<name>] | google testers pool-add|pool-remove|pool-check [--dir <app>] [--track himi-pool] | google testers consent grant|revoke|status [--dir <app>] | google keygen <package> [--out <file.p12>] [--alias <name>] [--name <certificate name>] | google resign <in.aab> --keystore <file.p12> (--storepass-file <file> | --storepass-env <NAME>) [--alias <name>] [--out <file.aab>] | apple-keys setup|status --app <slug> --site <metaSiteId> --bundle-id <id> [--asc-key-file <p8> --asc-key-id <id> --asc-issuer-id <issuer>] [--iap-key <p8> --iap-key-id <id> --iap-issuer-id <issuer>] [--yes|--dry-run] [--json] | preflight <app> [--profile <n>] | upload <app> [--track <t>] [--profile <n>] [--yes] [--dry-run] | status <app> [--profile <n>] | iap draft --site <msid> " + IAP_CREDENTIAL_OPTIONS + " --apple-app <id> --bundle <id> --base-territory <t> --out <f> [--territories <a,b>] [--locale <l>] [--mode per-item|tiers] [--merge <f>] [--report <f>] [--json] | iap plan --manifest <f> " + IAP_CREDENTIAL_OPTIONS + " --out <f> [--json] | iap apply --plan <f> " + IAP_CREDENTIAL_OPTIONS + " --out <f> [--yes] [--limit <n>] [--no-submit] [--json] | iap status --manifest <f> " + IAP_CREDENTIAL_OPTIONS + " [--out <f>] [--json] | iap connect --manifest <f> [--profile <n>] [--catalog-route <prefix>] [--iap-key <AuthKey.p8> --iap-key-id <id>] [--content <dir>] [--preview-tag dp-<tag>] [--dry-run] [--yes] [--out <f>] [--json] | iap screenshots --manifest <f> --content <dir> --profile <n> [--out-dir <d>] [--only <id,\u2026>] [--force] [--dry-run] [--json] | iap check --manifest <f> --catalog-route <prefix> [--purchases-app <id>] [--content <dir>] [--plist <file>] [--visitor-client <id>] [--json] | iap mappings --site <msid> --purchases-app <id> --catalog-route <prefix> [--product <id> --active true|false --yes] [--json]" },
|
|
281918
282014
|
{ name: "guide", summary: "print the Himalaya overview + headless dev loop + available topics (offline)", required: "[--json]" },
|
|
281919
282015
|
{ name: "docs", summary: "print bundled/verified cached guides offline; status reports kit identity; refresh downloads compatible reference content independently of CLI without changing app source", required: "[<topic>|catalog [kind]|status|refresh] [--pin <version|digest>] [--unpin] [--no-network] [--json]" },
|
|
281920
282016
|
{ name: "components", summary: "print the SDUI component vocabulary + props; a name = that component (offline)", required: "[<Name>] [--json]" },
|
|
@@ -287660,7 +287756,7 @@ async function testflightCommand(ctx) {
|
|
|
287660
287756
|
// src/commands/dist.ts
|
|
287661
287757
|
init_define_HHP_CATALOG();
|
|
287662
287758
|
import { existsSync as existsSync133, readFileSync as readFileSync159 } from "node:fs";
|
|
287663
|
-
import { join as
|
|
287759
|
+
import { join as join172 } from "node:path";
|
|
287664
287760
|
init_wix_owner();
|
|
287665
287761
|
init_cli_shared();
|
|
287666
287762
|
function isCiEnvironment(env = process.env) {
|
|
@@ -287727,7 +287823,7 @@ async function distCommand(ctx) {
|
|
|
287727
287823
|
const rememberLastDist = async (jobs2) => {
|
|
287728
287824
|
try {
|
|
287729
287825
|
const dir = contentDir(flags);
|
|
287730
|
-
if (!existsSync133(
|
|
287826
|
+
if (!existsSync133(join172(dir, "himalaya.content.json"))) return;
|
|
287731
287827
|
const { lastDistFromJob: lastDistFromJob2, writeLastDist: writeLastDist2 } = await Promise.resolve().then(() => (init_capabilities(), capabilities_exports));
|
|
287732
287828
|
const own6 = await appId(dir);
|
|
287733
287829
|
for (const job of jobs2) {
|
|
@@ -288026,7 +288122,7 @@ ${label4}`);
|
|
|
288026
288122
|
}
|
|
288027
288123
|
{
|
|
288028
288124
|
const distDir = contentDir(flags);
|
|
288029
|
-
if (str3(flags["app-icon-url"]) === void 0 && existsSync133(
|
|
288125
|
+
if (str3(flags["app-icon-url"]) === void 0 && existsSync133(join172(distDir, "himalaya.content.json"))) {
|
|
288030
288126
|
const issues = await iconIssues(distDir, flags.strict === true, { requireDeclared: true, requireVerified: true });
|
|
288031
288127
|
const errors = issues.filter((i2) => i2.severity === "error");
|
|
288032
288128
|
for (const i2 of issues.filter((i3) => i3.severity === "warning")) {
|
|
@@ -289261,7 +289357,7 @@ async function upgradeCommand(ctx) {
|
|
|
289261
289357
|
init_define_HHP_CATALOG();
|
|
289262
289358
|
init_config();
|
|
289263
289359
|
import { statSync as statSync45, accessSync as accessSync5, constants as constants11 } from "node:fs";
|
|
289264
|
-
import { join as
|
|
289360
|
+
import { join as join173 } from "node:path";
|
|
289265
289361
|
init_wix_owner();
|
|
289266
289362
|
init_owner_claim();
|
|
289267
289363
|
init_self_update();
|
|
@@ -289330,7 +289426,7 @@ function executableOnPath(name, env = process.env) {
|
|
|
289330
289426
|
const suffixes = process.platform === "win32" ? (env.PATHEXT ?? ".COM;.EXE;.BAT;.CMD").split(";").filter(Boolean) : [""];
|
|
289331
289427
|
for (const dir of entries) {
|
|
289332
289428
|
for (const suffix of suffixes) {
|
|
289333
|
-
const candidate =
|
|
289429
|
+
const candidate = join173(dir, `${name}${suffix}`);
|
|
289334
289430
|
try {
|
|
289335
289431
|
if (!statSync45(candidate).isFile()) continue;
|
|
289336
289432
|
if (process.platform !== "win32") accessSync5(candidate, constants11.X_OK);
|
|
@@ -289548,7 +289644,7 @@ init_define_HHP_CATALOG();
|
|
|
289548
289644
|
init_guides();
|
|
289549
289645
|
init_cli_shared();
|
|
289550
289646
|
import { existsSync as existsSync134 } from "node:fs";
|
|
289551
|
-
import { join as
|
|
289647
|
+
import { join as join174, resolve as resolve109 } from "node:path";
|
|
289552
289648
|
async function runGuideCommand(command, pos, flags, io2, print) {
|
|
289553
289649
|
const { referenceCache: referenceCache2, referenceIdentity: referenceIdentity2 } = await Promise.resolve().then(() => (init_guides(), guides_exports));
|
|
289554
289650
|
const cache4 = referenceCache2();
|
|
@@ -289816,7 +289912,7 @@ Seed your coding agent with \`himi agent-init\`. Guides: ${idx.portalUrl}`);
|
|
|
289816
289912
|
...res.removed.length ? { removed: res.removed, note: "older copies at the app root, moved to .himi/legacy-agent-files/ (a backup, in case one became app code) \u2014 the current ones live in .agents/skills/himalaya/" } : {},
|
|
289817
289913
|
// In a git repo the refresh moves the diff identity an earlier `himi test` attested (that
|
|
289818
289914
|
// hash is shared with the repo gates and deliberately exempts nothing but its own metadata).
|
|
289819
|
-
...existsSync134(
|
|
289915
|
+
...existsSync134(join174(dir, ".himi", "attestations", "latest.json")) ? { next: "if `himi push` then refuses the attestation as stale, re-run `himi test` \u2014 in a git checkout this refresh changed the tree it covered" } : {},
|
|
289820
289916
|
...res.skipped.length ? { skipped: res.skipped } : {},
|
|
289821
289917
|
portalUrl: idx.portalUrl
|
|
289822
289918
|
});
|
|
@@ -289891,7 +289987,7 @@ init_define_HHP_CATALOG();
|
|
|
289891
289987
|
init_cms_schema();
|
|
289892
289988
|
init_wix_owner();
|
|
289893
289989
|
import { existsSync as existsSync135, readFileSync as readFileSync163, writeFileSync as writeFileSync58 } from "node:fs";
|
|
289894
|
-
import { join as
|
|
289990
|
+
import { join as join175 } from "node:path";
|
|
289895
289991
|
var FOREIGN_DETAIL_LIMIT = 25;
|
|
289896
289992
|
var MAX_COLLECTION_PAGES = 40;
|
|
289897
289993
|
async function listCollections(call) {
|
|
@@ -290411,7 +290507,7 @@ async function seedCms(opts) {
|
|
|
290411
290507
|
return report9;
|
|
290412
290508
|
}
|
|
290413
290509
|
function readSeedFile(dir) {
|
|
290414
|
-
const file2 =
|
|
290510
|
+
const file2 = join175(dir, "cms-seed.json");
|
|
290415
290511
|
if (!existsSync135(file2)) return {};
|
|
290416
290512
|
let parsed;
|
|
290417
290513
|
try {
|
|
@@ -290461,7 +290557,7 @@ function placeholder(type2, key4, i2) {
|
|
|
290461
290557
|
}
|
|
290462
290558
|
async function writeSeedRows(opts) {
|
|
290463
290559
|
const { app: app2, cms, dir, count: count3 = 8 } = opts;
|
|
290464
|
-
const file2 =
|
|
290560
|
+
const file2 = join175(dir, "cms-seed.json");
|
|
290465
290561
|
const owned = (cms?.collections ?? []).filter((s5) => s5.id?.startsWith(namespacePrefix(app2)));
|
|
290466
290562
|
if (!owned.length) {
|
|
290467
290563
|
return {
|
|
@@ -290835,7 +290931,7 @@ import {
|
|
|
290835
290931
|
statSync as statSync46,
|
|
290836
290932
|
writeFileSync as writeFileSync61
|
|
290837
290933
|
} from "node:fs";
|
|
290838
|
-
import { basename as basename41, dirname as dirname81, join as
|
|
290934
|
+
import { basename as basename41, dirname as dirname81, join as join179, relative as relative35, resolve as resolve113 } from "node:path";
|
|
290839
290935
|
var L10N_USAGE = "usage: himi l10n import --format oneapp <dir> (--app <slug> | --content <app dir>) [--locales en,he] [--source en] [--overwrite] [--json]";
|
|
290840
290936
|
var MESSAGES_FILE = /^messages_(.+)\.json$/;
|
|
290841
290937
|
var UnsafePath = class extends Error {
|
|
@@ -290854,8 +290950,8 @@ function readRegularFile(path2) {
|
|
|
290854
290950
|
}
|
|
290855
290951
|
}
|
|
290856
290952
|
function unsafeDestination(appDir3, tags) {
|
|
290857
|
-
const l10nDir =
|
|
290858
|
-
for (const path2 of [l10nDir, ...tags.map((t2) =>
|
|
290953
|
+
const l10nDir = join179(appDir3, "l10n");
|
|
290954
|
+
for (const path2 of [l10nDir, ...tags.map((t2) => join179(l10nDir, `${t2}.json`))]) {
|
|
290859
290955
|
try {
|
|
290860
290956
|
if (lstatSync37(path2).isSymbolicLink()) return `${relative35(process.cwd(), path2)} is a symbolic link`;
|
|
290861
290957
|
} catch (e2) {
|
|
@@ -290866,7 +290962,7 @@ function unsafeDestination(appDir3, tags) {
|
|
|
290866
290962
|
return void 0;
|
|
290867
290963
|
}
|
|
290868
290964
|
function writeCatalog(path2, text32) {
|
|
290869
|
-
const tmp =
|
|
290965
|
+
const tmp = join179(dirname81(path2), `.${basename41(path2)}.${process.pid}.${randomBytes24(4).toString("hex")}.tmp`);
|
|
290870
290966
|
try {
|
|
290871
290967
|
writeFileSync61(tmp, text32, { encoding: "utf8", flag: "wx" });
|
|
290872
290968
|
renameSync25(tmp, path2);
|
|
@@ -290909,7 +291005,7 @@ async function l10nCommand(ctx) {
|
|
|
290909
291005
|
return fail16("app_not_found", { error: `--app ${slug}: an app slug, not a path`, hint: "pass --content <app dir> to target a directory" }, 2);
|
|
290910
291006
|
}
|
|
290911
291007
|
const dir = resolve113("apps", slug);
|
|
290912
|
-
if (!existsSync137(
|
|
291008
|
+
if (!existsSync137(join179(dir, "config.ts")) && !existsSync137(join179(dir, "config.js")) && !existsSync137(join179(dir, "config.mjs"))) {
|
|
290913
291009
|
return fail16("app_not_found", { error: `--app ${slug}: no apps/${slug}/config.ts under ${process.cwd()}`, hint: "run from the repo root, or pass --content <app dir>" }, 2);
|
|
290914
291010
|
}
|
|
290915
291011
|
appDir3 = dir;
|
|
@@ -290930,7 +291026,7 @@ async function l10nCommand(ctx) {
|
|
|
290930
291026
|
}
|
|
290931
291027
|
for (const name of names2) {
|
|
290932
291028
|
const m2 = MESSAGES_FILE.exec(name);
|
|
290933
|
-
if (m2) fileByTag.set(m2[1],
|
|
291029
|
+
if (m2) fileByTag.set(m2[1], join179(messagesDir, name));
|
|
290934
291030
|
}
|
|
290935
291031
|
if (fileByTag.size === 0) {
|
|
290936
291032
|
return fail16("no_messages_found", { error: `no messages_<locale>.json files in ${dirArg}`, dir: messagesDir }, 1);
|
|
@@ -290992,13 +291088,13 @@ async function l10nCommand(ctx) {
|
|
|
290992
291088
|
try {
|
|
290993
291089
|
unsafe2 = unsafeDestination(appDir3, requested);
|
|
290994
291090
|
} catch (e2) {
|
|
290995
|
-
return fail16("catalog_write_failed", { error: `cannot inspect ${relative35(process.cwd(),
|
|
291091
|
+
return fail16("catalog_write_failed", { error: `cannot inspect ${relative35(process.cwd(), join179(appDir3, "l10n"))}: ${e2.message}`, written: [] }, 1);
|
|
290996
291092
|
}
|
|
290997
291093
|
if (unsafe2 !== void 0) {
|
|
290998
291094
|
return fail16("unsafe_path", { error: `${unsafe2} \u2014 the import does not read or write through links`, hint: "replace the link with a real directory/file inside the app, then re-run" }, 1);
|
|
290999
291095
|
}
|
|
291000
291096
|
for (const tag of requested) {
|
|
291001
|
-
const path2 =
|
|
291097
|
+
const path2 = join179(appDir3, "l10n", `${tag}.json`);
|
|
291002
291098
|
if (!existsSync137(path2)) continue;
|
|
291003
291099
|
try {
|
|
291004
291100
|
const parsed = JSON.parse(readRegularFile(path2).toString("utf8"));
|
|
@@ -291060,7 +291156,7 @@ async function l10nCommand(ctx) {
|
|
|
291060
291156
|
if (catalogs.en && checkoutRoot !== void 0) {
|
|
291061
291157
|
try {
|
|
291062
291158
|
const { injectAllNativeRows: injectAllNativeRows2, loadTable: loadTable2 } = await Promise.resolve().then(() => (init_auth_gate_copy(), auth_gate_copy_exports));
|
|
291063
|
-
const table = loadTable2(
|
|
291159
|
+
const table = loadTable2(join179(checkoutRoot, "core", "runtime", "l10n", "auth-gate", "en.json"));
|
|
291064
291160
|
catalogs.en = injectAllNativeRows2(catalogs.en, appDir3, table);
|
|
291065
291161
|
} catch (e2) {
|
|
291066
291162
|
warnings.push({ warning: "native_rows_not_injected", error: `could not add the native login-gate rows to en.json (${e2.message}) \u2014 run \`npm run l10n:auth-gate\`` });
|
|
@@ -291068,14 +291164,14 @@ async function l10nCommand(ctx) {
|
|
|
291068
291164
|
}
|
|
291069
291165
|
const written = [];
|
|
291070
291166
|
try {
|
|
291071
|
-
mkdirSync61(
|
|
291167
|
+
mkdirSync61(join179(appDir3, "l10n"), { recursive: true });
|
|
291072
291168
|
const swapped = unsafeDestination(appDir3, requested);
|
|
291073
|
-
const l10nReal = realpathSync22(
|
|
291074
|
-
if (swapped !== void 0 || l10nReal !==
|
|
291075
|
-
throw new UnsafePath(swapped ?? `${
|
|
291169
|
+
const l10nReal = realpathSync22(join179(appDir3, "l10n"));
|
|
291170
|
+
if (swapped !== void 0 || l10nReal !== join179(realpathSync22(appDir3), "l10n")) {
|
|
291171
|
+
throw new UnsafePath(swapped ?? `${join179(appDir3, "l10n")} resolves outside the app`);
|
|
291076
291172
|
}
|
|
291077
291173
|
for (const tag of requested) {
|
|
291078
|
-
const path2 =
|
|
291174
|
+
const path2 = join179(appDir3, "l10n", `${tag}.json`);
|
|
291079
291175
|
writeCatalog(path2, JSON.stringify(catalogs[tag], null, 2) + "\n");
|
|
291080
291176
|
written.push({ tag, path: relative35(process.cwd(), path2), count: Object.keys(catalogs[tag].messages).length });
|
|
291081
291177
|
}
|
|
@@ -291117,7 +291213,7 @@ async function l10nCommand(ctx) {
|
|
|
291117
291213
|
init_define_HHP_CATALOG();
|
|
291118
291214
|
init_cli_shared();
|
|
291119
291215
|
import { existsSync as existsSync145 } from "node:fs";
|
|
291120
|
-
import { join as
|
|
291216
|
+
import { join as join188, resolve as resolve117 } from "node:path";
|
|
291121
291217
|
async function base44Command(ctx) {
|
|
291122
291218
|
const { io: io2, pos, flags, print } = ctx;
|
|
291123
291219
|
if (pos[1] === "auth-check") {
|
|
@@ -291188,7 +291284,7 @@ async function base44Command(ctx) {
|
|
|
291188
291284
|
return 1;
|
|
291189
291285
|
};
|
|
291190
291286
|
const gen = await Promise.resolve().then(() => (init_generate(), generate_exports));
|
|
291191
|
-
const missing4 = gen.ENGINE_FILES.filter((f2) => !existsSync145(
|
|
291287
|
+
const missing4 = gen.ENGINE_FILES.filter((f2) => !existsSync145(join188(dir, f2)));
|
|
291192
291288
|
if (missing4.length) {
|
|
291193
291289
|
return fail16("content_dir_not_base44_starter", `${dir} is not a base44-starter content package: the generated screens import a shared engine it does not have (${missing4.join(", ")})`, { missing: missing4, hint: "scaffold one with `himi init <name> --template base44-starter --base44-app-id <id>`" });
|
|
291194
291290
|
}
|
|
@@ -291274,7 +291370,7 @@ async function base44Command(ctx) {
|
|
|
291274
291370
|
if (!provisioning || str3(flags.content) !== void 0 || !slug) return contentDir(flags);
|
|
291275
291371
|
if (!/^[a-z0-9][a-z0-9-]*$/.test(slug)) return void 0;
|
|
291276
291372
|
const dir = resolve117("apps", slug);
|
|
291277
|
-
return existsSync145(
|
|
291373
|
+
return existsSync145(join188(dir, "config.ts")) || existsSync145(join188(dir, "config.mjs")) ? dir : void 0;
|
|
291278
291374
|
};
|
|
291279
291375
|
if (sub === "entities" || sub === "functions") {
|
|
291280
291376
|
if (sub === "entities" && !["query", "create", "seed"].includes(pos[2] ?? "")) {
|