@wix/himalaya-cli 0.1766.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 +393 -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
|
}
|
|
@@ -57168,7 +57168,7 @@ var init_pdf = __esm({
|
|
|
57168
57168
|
var defineProperty = Object.defineProperty;
|
|
57169
57169
|
var stringSlice = uncurryThis("".slice);
|
|
57170
57170
|
var replace3 = uncurryThis("".replace);
|
|
57171
|
-
var
|
|
57171
|
+
var join211 = uncurryThis([].join);
|
|
57172
57172
|
var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function() {
|
|
57173
57173
|
return defineProperty(function() {
|
|
57174
57174
|
}, "length", { value: 8 }).length !== 8;
|
|
@@ -57195,7 +57195,7 @@ var init_pdf = __esm({
|
|
|
57195
57195
|
}
|
|
57196
57196
|
var state = enforceInternalState(value2);
|
|
57197
57197
|
if (!hasOwn(state, "source")) {
|
|
57198
|
-
state.source =
|
|
57198
|
+
state.source = join211(TEMPLATE, typeof name == "string" ? name : "");
|
|
57199
57199
|
}
|
|
57200
57200
|
return value2;
|
|
57201
57201
|
};
|
|
@@ -59718,7 +59718,7 @@ var init_pdf = __esm({
|
|
|
59718
59718
|
var charAt = uncurryThis("".charAt);
|
|
59719
59719
|
var Uint8Array2 = globalThis2.Uint8Array;
|
|
59720
59720
|
var $Array = globalThis2.Array;
|
|
59721
|
-
var
|
|
59721
|
+
var join211 = uncurryThis([].join);
|
|
59722
59722
|
var INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS = !Uint8Array2 || !Uint8Array2.prototype.toBase64 || !(function() {
|
|
59723
59723
|
try {
|
|
59724
59724
|
var target = new Uint8Array2();
|
|
@@ -59764,7 +59764,7 @@ var init_pdf = __esm({
|
|
|
59764
59764
|
result[written++] = "=";
|
|
59765
59765
|
}
|
|
59766
59766
|
}
|
|
59767
|
-
return
|
|
59767
|
+
return join211(result, "");
|
|
59768
59768
|
}
|
|
59769
59769
|
});
|
|
59770
59770
|
},
|
|
@@ -59776,7 +59776,7 @@ var init_pdf = __esm({
|
|
|
59776
59776
|
var anUint8Array = __webpack_require__3(4154);
|
|
59777
59777
|
var notDetached = __webpack_require__3(5169);
|
|
59778
59778
|
var numberToString2 = uncurryThis(1.1.toString);
|
|
59779
|
-
var
|
|
59779
|
+
var join211 = uncurryThis([].join);
|
|
59780
59780
|
var $Array = Array;
|
|
59781
59781
|
var Uint8Array2 = globalThis2.Uint8Array;
|
|
59782
59782
|
var INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS = !Uint8Array2 || !Uint8Array2.prototype.toHex || !(function() {
|
|
@@ -59796,7 +59796,7 @@ var init_pdf = __esm({
|
|
|
59796
59796
|
var hex2 = numberToString2(this[i2], 16);
|
|
59797
59797
|
result[i2] = hex2.length === 1 ? "0" + hex2 : hex2;
|
|
59798
59798
|
}
|
|
59799
|
-
return
|
|
59799
|
+
return join211(result, "");
|
|
59800
59800
|
}
|
|
59801
59801
|
});
|
|
59802
59802
|
},
|
|
@@ -230858,9 +230858,9 @@ var init_commands = __esm({
|
|
|
230858
230858
|
summary: "Jobs in the state directory",
|
|
230859
230859
|
async run(inv) {
|
|
230860
230860
|
const { FileJobStore: FileJobStore2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports5));
|
|
230861
|
-
const { join:
|
|
230861
|
+
const { join: join211 } = await import("node:path");
|
|
230862
230862
|
const runner2 = await inv.ctx.runner();
|
|
230863
|
-
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();
|
|
230864
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"]);
|
|
230865
230865
|
}
|
|
230866
230866
|
},
|
|
@@ -242986,11 +242986,11 @@ __export(input_evidence_isolation_exports, {
|
|
|
242986
242986
|
});
|
|
242987
242987
|
async function installInputEvidenceIsolation(dir) {
|
|
242988
242988
|
const { lstatSync: lstatSync41, readdirSync: readdirSync64 } = await import("node:fs");
|
|
242989
|
-
const { join:
|
|
242989
|
+
const { join: join211 } = await import("node:path");
|
|
242990
242990
|
const check = (path2) => {
|
|
242991
242991
|
const stat10 = lstatSync41(path2);
|
|
242992
242992
|
if (stat10.isSymbolicLink()) throw new Error("input evidence requires a content tree without symlinks");
|
|
242993
|
-
if (stat10.isDirectory()) for (const name of readdirSync64(path2)) check(
|
|
242993
|
+
if (stat10.isDirectory()) for (const name of readdirSync64(path2)) check(join211(path2, name));
|
|
242994
242994
|
};
|
|
242995
242995
|
check(dir);
|
|
242996
242996
|
const { requireBuildConfinement: requireBuildConfinement2 } = await Promise.resolve().then(() => (init_build_lib(), build_lib_exports));
|
|
@@ -251893,7 +251893,13 @@ async function defaultGoogleHost(env, io2) {
|
|
|
251893
251893
|
const stateDir2 = jobs.gplayStateDir(env);
|
|
251894
251894
|
const choice = env.GPLAY_CREDENTIAL_STORE ?? (process.platform === "darwin" ? "keychain" : "file");
|
|
251895
251895
|
if (choice !== "keychain" && choice !== "file") throw new UsageError7(`GPLAY_CREDENTIAL_STORE must be file or keychain (got "${choice}")`);
|
|
251896
|
-
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
|
+
};
|
|
251897
251903
|
const profileDir = env.GPLAY_CONSOLE_PROFILE ?? join164(stateDir2, "console-profile");
|
|
251898
251904
|
return {
|
|
251899
251905
|
stateDir: stateDir2,
|
|
@@ -251901,7 +251907,7 @@ async function defaultGoogleHost(env, io2) {
|
|
|
251901
251907
|
connect: () => api4.connectGoogle({
|
|
251902
251908
|
clientFile: api4.defaultClientFile(env, stateDir2),
|
|
251903
251909
|
scopes: [...api4.PLAY_SCOPES],
|
|
251904
|
-
store,
|
|
251910
|
+
store: saved,
|
|
251905
251911
|
// The consent page opens in the owner's browser; with no browser, the URL goes to stderr (never to stdout).
|
|
251906
251912
|
openBrowser: async (url) => {
|
|
251907
251913
|
try {
|
|
@@ -251930,7 +251936,7 @@ async function googleOf(deps, env, io2) {
|
|
|
251930
251936
|
host,
|
|
251931
251937
|
audit: async () => audit,
|
|
251932
251938
|
async readUsers(developerId) {
|
|
251933
|
-
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 } : {} });
|
|
251934
251940
|
const clients = await googleFor(await accountFor(developerId), { readOnly: true });
|
|
251935
251941
|
return await clients.api.listUsers(developerId);
|
|
251936
251942
|
},
|
|
@@ -251939,6 +251945,7 @@ async function googleOf(deps, env, io2) {
|
|
|
251939
251945
|
const googleFor = host.googleFor ?? jobs.googleClientsFor({
|
|
251940
251946
|
stateDir: host.stateDir,
|
|
251941
251947
|
store: host.store,
|
|
251948
|
+
...env.GOOGLE_CLOUD_QUOTA_PROJECT ? { quotaProject: env.GOOGLE_CLOUD_QUOTA_PROJECT } : {},
|
|
251942
251949
|
...o2.console ? { console: { profileDir: env.GPLAY_CONSOLE_PROFILE ?? join164(host.stateDir, "console-profile"), ...env.GPLAY_CHROME ? { chromePath: env.GPLAY_CHROME } : {} } } : {}
|
|
251943
251950
|
});
|
|
251944
251951
|
return new engine.JobRunner({
|
|
@@ -253020,26 +253027,30 @@ stderr with a code.`;
|
|
|
253020
253027
|
// src/store-google-testers.ts
|
|
253021
253028
|
var store_google_testers_exports = {};
|
|
253022
253029
|
__export(store_google_testers_exports, {
|
|
253030
|
+
POOL_CONSENT_DAYS: () => POOL_CONSENT_DAYS,
|
|
253023
253031
|
POOL_DEFAULT_TRACK: () => POOL_DEFAULT_TRACK,
|
|
253024
253032
|
POOL_GROUP_ENV: () => POOL_GROUP_ENV,
|
|
253025
253033
|
STORE_GOOGLE_TESTERS_CODES: () => STORE_GOOGLE_TESTERS_CODES,
|
|
253026
253034
|
STORE_GOOGLE_TESTERS_USAGE: () => STORE_GOOGLE_TESTERS_USAGE,
|
|
253027
253035
|
runStoreGoogleTesters: () => runStoreGoogleTesters
|
|
253028
253036
|
});
|
|
253029
|
-
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";
|
|
253030
253039
|
function fail13(io2, code2, error, extra = {}) {
|
|
253031
253040
|
io2.error(JSON.stringify({ ok: false, code: code2, error: scrubSecretShapes(error).slice(0, 600), ...extra }));
|
|
253032
253041
|
return code2 === "invalid_usage" || code2 === "confirmation_required" || code2 === "pool_group_unset" ? 2 : 1;
|
|
253033
253042
|
}
|
|
253034
253043
|
function parse7(pos, flags, cwd, env) {
|
|
253035
253044
|
const op = pos[3];
|
|
253036
|
-
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");
|
|
253037
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");
|
|
253038
253049
|
const track2 = (text22(flags.track) ?? POOL_DEFAULT_TRACK).toLowerCase();
|
|
253039
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}`);
|
|
253040
|
-
const group = text22(env[POOL_GROUP_ENV]);
|
|
253041
|
-
if (!group) return { unset: true };
|
|
253042
|
-
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}")`);
|
|
253043
253054
|
let dir;
|
|
253044
253055
|
try {
|
|
253045
253056
|
dir = appDirFor("", resolve106(cwd, text22(flags.dir) ?? "."));
|
|
@@ -253052,7 +253063,7 @@ function parse7(pos, flags, cwd, env) {
|
|
|
253052
253063
|
if (!PACKAGE_RE3.test(packageName)) throw new UsageError9(`"${packageName}" is not an Android package name`);
|
|
253053
253064
|
const developer = text22(flags.developer) ?? text22(facts?.developerId);
|
|
253054
253065
|
if (developer && !DEVELOPER_RE3.test(developer)) throw new UsageError9("--developer is your Play developer account id: the number in your Play Console URL");
|
|
253055
|
-
return { op, track: track2, group, packageName, ...developer ? { developer } : {} };
|
|
253066
|
+
return { op, ...consentOp ? { consentOp } : {}, track: track2, group, packageName, ...developer ? { developer } : {} };
|
|
253056
253067
|
}
|
|
253057
253068
|
async function runStoreGoogleTesters(pos, flags, io2, deps = {}) {
|
|
253058
253069
|
const env = deps.env ?? process.env;
|
|
@@ -253070,18 +253081,78 @@ async function runStoreGoogleTesters(pos, flags, io2, deps = {}) {
|
|
|
253070
253081
|
}
|
|
253071
253082
|
const tooOld = storeNodeRefusal(deps.nodeVersion);
|
|
253072
253083
|
if (tooOld) return fail13(io2, "node_too_old", tooOld.replace("App Store submission", "Google Play from himi"));
|
|
253073
|
-
const writes = p2.op !== "pool-check";
|
|
253074
253084
|
const ask4 = deps.ask === void 0 ? process.stdin.isTTY && process.stderr.isTTY ? ttyAsk3() : void 0 : deps.ask ?? void 0;
|
|
253075
|
-
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");
|
|
253076
253085
|
const now = deps.now ?? (() => /* @__PURE__ */ new Date());
|
|
253077
253086
|
try {
|
|
253078
253087
|
const google = await googleOf({ google: deps.google, ...deps.now ? { now: deps.now } : {} }, env, io2);
|
|
253079
|
-
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()}` } });
|
|
253080
253094
|
} catch (e2) {
|
|
253081
253095
|
if (e2 instanceof UsageError9) return fail13(io2, "invalid_usage", e2.message, { usage: STORE_GOOGLE_TESTERS_USAGE });
|
|
253082
253096
|
return fail13(io2, "job_failed", e2.message ?? String(e2));
|
|
253083
253097
|
}
|
|
253084
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
|
+
}
|
|
253085
253156
|
async function readGroups(c2, developerId) {
|
|
253086
253157
|
const host = c2.google.host;
|
|
253087
253158
|
const stored = (await host.store.load())?.account;
|
|
@@ -253107,10 +253178,12 @@ async function run3(c2) {
|
|
|
253107
253178
|
const developerId = await knownDeveloper(host.stateDir, p2.developer, p2.packageName);
|
|
253108
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`);
|
|
253109
253180
|
const base2 = { packageName: p2.packageName, track: p2.track, group: p2.group, developerId };
|
|
253110
|
-
const
|
|
253111
|
-
if (
|
|
253112
|
-
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);
|
|
253113
253184
|
}
|
|
253185
|
+
const creating = read2 === void 0;
|
|
253186
|
+
const groups = read2 ?? [];
|
|
253114
253187
|
const onTrack = groups.some((g2) => same5(g2, p2.group));
|
|
253115
253188
|
if (p2.op === "pool-check") {
|
|
253116
253189
|
io2.log(JSON.stringify({ ok: true, ...base2, onTrack, groups }));
|
|
@@ -253129,25 +253202,36 @@ async function run3(c2) {
|
|
|
253129
253202
|
let job;
|
|
253130
253203
|
try {
|
|
253131
253204
|
job = await runner2.plan("gplay.closedTest.setup", { packageName: p2.packageName, track: p2.track, groups: wanted }, c2.actor);
|
|
253132
|
-
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);
|
|
253133
253206
|
if (problem) return fail13(io2, "plan_unexpected", `${problem}; nothing was approved`, { ...base2, jobId: job.id, status: job.status, changes: changesOf2(job) });
|
|
253134
253207
|
for (const line of [
|
|
253135
|
-
`${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}"` : ""}:`,
|
|
253136
253209
|
...changesOf2(job).map((l3) => ` - ${l3}`),
|
|
253137
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.",
|
|
253138
253211
|
` - Job ${job.id}, plan ${job.planHash.slice(0, 8)}.`
|
|
253139
253212
|
]) io2.error(line);
|
|
253140
|
-
|
|
253141
|
-
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
|
+
}
|
|
253142
253219
|
const latest = await readGroups(c2, developerId);
|
|
253143
|
-
|
|
253220
|
+
const moved = creating ? latest !== void 0 : !latest || latest.length !== groups.length || !latest.every((g2) => groups.some((o2) => same5(o2, g2)));
|
|
253221
|
+
if (moved) {
|
|
253144
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 });
|
|
253145
253223
|
}
|
|
253146
253224
|
job = await approveAndApply(runner2, job, c2.person, c2.actor, c2.now);
|
|
253147
253225
|
} catch (e2) {
|
|
253148
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;
|
|
253149
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}` } : {} });
|
|
253150
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
|
+
}
|
|
253151
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}` });
|
|
253152
253236
|
await rememberDeveloper(host.stateDir, p2.packageName, developerId);
|
|
253153
253237
|
const readBack4 = await readGroups(c2, developerId);
|
|
@@ -253162,13 +253246,15 @@ async function run3(c2) {
|
|
|
253162
253246
|
status: job.status,
|
|
253163
253247
|
onTrack: nowOn,
|
|
253164
253248
|
changed: true,
|
|
253249
|
+
...creating ? { createdTrack: true } : {},
|
|
253165
253250
|
groups: after,
|
|
253166
253251
|
changes: changesOf2(job),
|
|
253252
|
+
...c2.consent ? { consent: c2.consent.grantedAt } : {},
|
|
253167
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"
|
|
253168
253254
|
}));
|
|
253169
253255
|
return 0;
|
|
253170
253256
|
}
|
|
253171
|
-
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;
|
|
253172
253258
|
var init_store_google_testers = __esm({
|
|
253173
253259
|
"src/store-google-testers.ts"() {
|
|
253174
253260
|
init_define_HHP_CATALOG();
|
|
@@ -253177,8 +253263,11 @@ var init_store_google_testers = __esm({
|
|
|
253177
253263
|
init_store_google_host();
|
|
253178
253264
|
init_store_relops_google();
|
|
253179
253265
|
POOL_GROUP_ENV = "HIMI_POOL_TESTER_GROUP";
|
|
253180
|
-
POOL_DEFAULT_TRACK = "
|
|
253181
|
-
|
|
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>]";
|
|
253182
253271
|
STORE_GOOGLE_TESTERS_CODES = [
|
|
253183
253272
|
"invalid_usage",
|
|
253184
253273
|
"node_too_old",
|
|
@@ -253192,6 +253281,7 @@ var init_store_google_testers = __esm({
|
|
|
253192
253281
|
"plan_unexpected",
|
|
253193
253282
|
"groups_changed",
|
|
253194
253283
|
"consent_declined",
|
|
253284
|
+
"track_upgraded",
|
|
253195
253285
|
"job_failed"
|
|
253196
253286
|
];
|
|
253197
253287
|
text22 = (v2) => typeof v2 === "string" && v2.trim() ? v2.trim() : void 0;
|
|
@@ -253201,6 +253291,7 @@ var init_store_google_testers = __esm({
|
|
|
253201
253291
|
NOT_CLOSED = /* @__PURE__ */ new Set(["production", "internal", "beta"]);
|
|
253202
253292
|
UsageError9 = class extends Error {
|
|
253203
253293
|
};
|
|
253294
|
+
consentPath = (stateDir2, packageName) => join165(stateDir2, "himi-pool-consent", `${packageName}.json`);
|
|
253204
253295
|
same5 = (a3, b3) => a3.toLowerCase() === b3.toLowerCase();
|
|
253205
253296
|
}
|
|
253206
253297
|
});
|
|
@@ -253377,9 +253468,9 @@ var init_store_relops_pool = __esm({
|
|
|
253377
253468
|
init_define_HHP_CATALOG();
|
|
253378
253469
|
STORE_POOL_PATH = "/v1/admin/site/store-pool";
|
|
253379
253470
|
STORE_POOL_TEARDOWN_PATH = "/v1/admin/store-pool/teardown";
|
|
253380
|
-
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";
|
|
253381
253472
|
ownerCommand = (base2, pkg) => typeof pkg === "string" && pkg ? `${base2} --android-package ${pkg}` : base2;
|
|
253382
|
-
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";
|
|
253383
253474
|
STORE_RELOPS_POOL_USAGE = "himi store relops pool add|status|end --app <id> --site <msid> | himi store relops pool end --all-himi";
|
|
253384
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("; ")}.`;
|
|
253385
253476
|
text23 = (v2) => typeof v2 === "string" && v2.trim() ? v2.trim() : void 0;
|
|
@@ -255952,17 +256043,17 @@ __export(credential_profile_exports, {
|
|
|
255952
256043
|
});
|
|
255953
256044
|
import { existsSync as existsSync128, readFileSync as readFileSync152 } from "node:fs";
|
|
255954
256045
|
import { homedir as homedir18 } from "node:os";
|
|
255955
|
-
import { join as
|
|
256046
|
+
import { join as join166 } from "node:path";
|
|
255956
256047
|
function credentialsDir(home2 = homedir18()) {
|
|
255957
|
-
return
|
|
256048
|
+
return join166(home2, ".himalaya", "store-credentials");
|
|
255958
256049
|
}
|
|
255959
256050
|
function profilePath(name, home2 = homedir18()) {
|
|
255960
256051
|
if (!PROFILE_NAME2.test(name)) {
|
|
255961
256052
|
throw new Error(
|
|
255962
|
-
`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.`
|
|
255963
256054
|
);
|
|
255964
256055
|
}
|
|
255965
|
-
return
|
|
256056
|
+
return join166(credentialsDir(home2), `${name}.json`);
|
|
255966
256057
|
}
|
|
255967
256058
|
function parseProfile2(text32, label4) {
|
|
255968
256059
|
let doc;
|
|
@@ -256085,9 +256176,9 @@ function requireExplicitProfile(profileFlag, target) {
|
|
|
256085
256176
|
}
|
|
256086
256177
|
return profile;
|
|
256087
256178
|
}
|
|
256088
|
-
function readKey3(path2, profile,
|
|
256179
|
+
function readKey3(path2, profile, readFile26) {
|
|
256089
256180
|
try {
|
|
256090
|
-
return
|
|
256181
|
+
return readFile26(path2);
|
|
256091
256182
|
} catch {
|
|
256092
256183
|
throw unreadableKey(path2, profile);
|
|
256093
256184
|
}
|
|
@@ -256102,7 +256193,7 @@ function canonicalKeyPath(path2, profile, realpath3) {
|
|
|
256102
256193
|
function resolveIapCredentials(options2) {
|
|
256103
256194
|
const { target } = options2;
|
|
256104
256195
|
const home2 = options2.home ?? homedir19();
|
|
256105
|
-
const
|
|
256196
|
+
const readFile26 = options2.readFile ?? ((p2) => readFileSync153(p2, "utf8"));
|
|
256106
256197
|
const realpath3 = options2.realpath ?? realpathSync20;
|
|
256107
256198
|
const profile = requireExplicitProfile(options2.profileFlag, target);
|
|
256108
256199
|
const creds = resolveStoreCredentials({
|
|
@@ -256111,7 +256202,7 @@ function resolveIapCredentials(options2) {
|
|
|
256111
256202
|
profileFlag: profile,
|
|
256112
256203
|
env: {},
|
|
256113
256204
|
home: home2,
|
|
256114
|
-
readProfile:
|
|
256205
|
+
readProfile: readFile26,
|
|
256115
256206
|
profileExists: options2.exists ?? existsSync129
|
|
256116
256207
|
});
|
|
256117
256208
|
assertCredentialOutsideRepo(`credential profile "${profile}"`, realpath3(profilePath(profile, home2)));
|
|
@@ -256120,7 +256211,7 @@ function resolveIapCredentials(options2) {
|
|
|
256120
256211
|
throw new Error(`credential profile "${profile}" is for team "${creds.team}" but the manifest targets team "${target.teamId}".`);
|
|
256121
256212
|
}
|
|
256122
256213
|
return {
|
|
256123
|
-
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) },
|
|
256124
256215
|
team: creds.team,
|
|
256125
256216
|
profile,
|
|
256126
256217
|
fingerprint: accountFingerprint(creds.ascKeyId, creds.ascIssuerId)
|
|
@@ -256419,7 +256510,7 @@ var init_redact = __esm({
|
|
|
256419
256510
|
|
|
256420
256511
|
// src/iap-config-edit.ts
|
|
256421
256512
|
import { existsSync as existsSync130, readFileSync as readFileSync154 } from "node:fs";
|
|
256422
|
-
import { basename as basename40, join as
|
|
256513
|
+
import { basename as basename40, join as join167 } from "node:path";
|
|
256423
256514
|
import ts24 from "typescript";
|
|
256424
256515
|
function bindPurchasesAppInConfig(source2, options2) {
|
|
256425
256516
|
const fileName = options2.fileName ?? "config.ts";
|
|
@@ -256498,7 +256589,7 @@ function capabilityFinding(app2, fileName) {
|
|
|
256498
256589
|
}
|
|
256499
256590
|
function withStoreBundle(dir, options2) {
|
|
256500
256591
|
if (options2.storeBundleId) return options2;
|
|
256501
|
-
const path2 =
|
|
256592
|
+
const path2 = join167(dir, "store", "store.config.yaml");
|
|
256502
256593
|
if (!existsSync130(path2)) return options2;
|
|
256503
256594
|
const storeBundleId = parseStoreConfig(readFileSync154(path2, "utf8")).ios?.bundleId;
|
|
256504
256595
|
return storeBundleId ? { ...options2, storeBundleId } : options2;
|
|
@@ -257196,7 +257287,7 @@ var init_store_iap_connect = __esm({
|
|
|
257196
257287
|
});
|
|
257197
257288
|
|
|
257198
257289
|
// src/store-iap-screenshots.ts
|
|
257199
|
-
import { dirname as dirname74, join as
|
|
257290
|
+
import { dirname as dirname74, join as join168, relative as relative32 } from "node:path";
|
|
257200
257291
|
function purchaseScreensFor(item2) {
|
|
257201
257292
|
const screen = item2.wix && PURCHASE_SCREENS[item2.wix.entityType];
|
|
257202
257293
|
if (!screen || !item2.wix) return [];
|
|
@@ -257318,7 +257409,7 @@ async function shoot(selected, run4, outDir) {
|
|
|
257318
257409
|
const found = await renderPurchaseScreen(selected, run4);
|
|
257319
257410
|
if ("skipped" in found) return { ...selected.report, skipped: found.skipped };
|
|
257320
257411
|
const report9 = { ...selected.report, screenId: found.screenId };
|
|
257321
|
-
const path2 =
|
|
257412
|
+
const path2 = join168(outDir, `${selected.item.productId}.png`);
|
|
257322
257413
|
try {
|
|
257323
257414
|
run4.writeBytes(path2, await run4.renderer.capture(found.html, run4.contentDir));
|
|
257324
257415
|
} catch (e2) {
|
|
@@ -257336,7 +257427,7 @@ function manifestWithScreenshots(text32, shot) {
|
|
|
257336
257427
|
`;
|
|
257337
257428
|
}
|
|
257338
257429
|
async function takeReviewScreenshots(run4) {
|
|
257339
|
-
const outDir = run4.outDir ??
|
|
257430
|
+
const outDir = run4.outDir ?? join168(dirname74(run4.manifestPath), DEFAULT_OUT_DIR);
|
|
257340
257431
|
const items = unknownOnlyIds(run4);
|
|
257341
257432
|
const shot = /* @__PURE__ */ new Map();
|
|
257342
257433
|
try {
|
|
@@ -257376,7 +257467,7 @@ var init_store_iap_screenshots = __esm({
|
|
|
257376
257467
|
// src/store-iap-screenshot-render.ts
|
|
257377
257468
|
import { existsSync as existsSync131, mkdtempSync as mkdtempSync13, readFileSync as readFileSync155, rmSync as rmSync38 } from "node:fs";
|
|
257378
257469
|
import { tmpdir as tmpdir14 } from "node:os";
|
|
257379
|
-
import { join as
|
|
257470
|
+
import { join as join169 } from "node:path";
|
|
257380
257471
|
function renderProblems(render3, entityId) {
|
|
257381
257472
|
const problems = (render3.liveErrors ?? []).map((e2) => `${e2.service}: ${e2.message}`);
|
|
257382
257473
|
const ofItem = (call) => call.toLowerCase().includes(entityId.toLowerCase());
|
|
@@ -257418,7 +257509,7 @@ function createReviewScreenRenderer() {
|
|
|
257418
257509
|
async render({ contentDir: contentDir2, screenId, input, host, entityId }) {
|
|
257419
257510
|
const { buildReleaseFromContent: buildReleaseFromContent2 } = await Promise.resolve().then(() => (init_build3(), build_exports2));
|
|
257420
257511
|
const tier5Dir = await workerBundles(contentDir2);
|
|
257421
|
-
const out2 = mkdtempSync13(
|
|
257512
|
+
const out2 = mkdtempSync13(join169(tmpdir14(), "himi-iap-shot-"));
|
|
257422
257513
|
try {
|
|
257423
257514
|
const outcome = await buildReleaseFromContent2(contentDir2, out2, {
|
|
257424
257515
|
...tier5Dir ? { tier5Dir } : {},
|
|
@@ -257436,7 +257527,7 @@ function createReviewScreenRenderer() {
|
|
|
257436
257527
|
},
|
|
257437
257528
|
async capture(html, contentDir2) {
|
|
257438
257529
|
const { pngPageHtml: pngPageHtml2, stabilizePngPage: stabilizePngPage2 } = await Promise.resolve().then(() => (init_render_descriptor(), render_descriptor_exports));
|
|
257439
|
-
const tokensPath =
|
|
257530
|
+
const tokensPath = join169(contentDir2, "tokens.json");
|
|
257440
257531
|
const tokens2 = existsSync131(tokensPath) ? JSON.parse(readFileSync155(tokensPath, "utf8")) : null;
|
|
257441
257532
|
const { width, height, scale } = REVIEW_SCREENSHOT_FRAME;
|
|
257442
257533
|
const page = await (await (browser ??= launch())).newPage({ viewport: { width, height }, deviceScaleFactor: scale, colorScheme: "light" });
|
|
@@ -257524,7 +257615,7 @@ import { execFileSync as execFileSync10 } from "node:child_process";
|
|
|
257524
257615
|
import { randomUUID as randomUUID17 } from "node:crypto";
|
|
257525
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";
|
|
257526
257617
|
import { homedir as homedir20, hostname as hostname7 } from "node:os";
|
|
257527
|
-
import { dirname as dirname75, join as
|
|
257618
|
+
import { dirname as dirname75, join as join170, resolve as resolve108 } from "node:path";
|
|
257528
257619
|
function scrubDeep(value2, scrub) {
|
|
257529
257620
|
if (typeof value2 === "string") return scrub(value2);
|
|
257530
257621
|
if (Array.isArray(value2)) return value2.map((v2) => scrubDeep(v2, scrub));
|
|
@@ -258229,7 +258320,7 @@ function readLockSummary(path2) {
|
|
|
258229
258320
|
}
|
|
258230
258321
|
}
|
|
258231
258322
|
function acquireApplyLock(dir, appleAppId) {
|
|
258232
|
-
const path2 =
|
|
258323
|
+
const path2 = join170(dir, "apply.lock");
|
|
258233
258324
|
const stamp = JSON.stringify({ pid: process.pid, host: hostname7(), at: (/* @__PURE__ */ new Date()).toISOString(), token: randomUUID17() });
|
|
258234
258325
|
try {
|
|
258235
258326
|
writeFileSync57(path2, stamp, { flag: "wx", mode: 384 });
|
|
@@ -258250,7 +258341,7 @@ function acquireApplyLock(dir, appleAppId) {
|
|
|
258250
258341
|
};
|
|
258251
258342
|
}
|
|
258252
258343
|
function stateDir(appleAppId) {
|
|
258253
|
-
const dir =
|
|
258344
|
+
const dir = join170(homedir20(), ".himalaya", "store-iap", appleAppId);
|
|
258254
258345
|
mkdirSync59(dir, { recursive: true, mode: 448 });
|
|
258255
258346
|
return dir;
|
|
258256
258347
|
}
|
|
@@ -258276,7 +258367,7 @@ function defaultStoreIapDeps() {
|
|
|
258276
258367
|
writeFileAtomic,
|
|
258277
258368
|
resolveCredentials: ({ profileFlag, target }) => resolveIapCredentials({ profileFlag, target }),
|
|
258278
258369
|
createApi: (key4) => createIapApi(createAscClient2({ key: key4 })),
|
|
258279
|
-
openJournal: (appleAppId) => fileJournal(
|
|
258370
|
+
openJournal: (appleAppId) => fileJournal(join170(stateDir(appleAppId), "journal.jsonl")),
|
|
258280
258371
|
acquireLock: (appleAppId) => acquireApplyLock(stateDir(appleAppId), appleAppId),
|
|
258281
258372
|
canPrompt: () => process.stdin.isTTY === true,
|
|
258282
258373
|
wixTransport: (siteId) => ownerTransport(siteId),
|
|
@@ -258779,7 +258870,7 @@ __export(preflight_app_exports, {
|
|
|
258779
258870
|
});
|
|
258780
258871
|
import { readFileSync as readFileSync157, existsSync as existsSync132, readdirSync as readdirSync57, statSync as statSync44 } from "node:fs";
|
|
258781
258872
|
import { createHash as createHash85 } from "node:crypto";
|
|
258782
|
-
import { dirname as dirname76, join as
|
|
258873
|
+
import { dirname as dirname76, join as join171 } from "node:path";
|
|
258783
258874
|
function analyze(projectYml, storeConfig, icon, account2, adopted) {
|
|
258784
258875
|
const f2 = [];
|
|
258785
258876
|
const has = (re2, s5) => re2.test(s5);
|
|
@@ -258925,7 +259016,7 @@ function readXcconfigVars(iosDir, projectYml) {
|
|
|
258925
259016
|
for (const raw of readFileSync157(path2, "utf8").split("\n")) {
|
|
258926
259017
|
const inc = /^\s*#include\??\s+"([^"]+)"/.exec(raw);
|
|
258927
259018
|
if (inc) {
|
|
258928
|
-
read2(
|
|
259019
|
+
read2(join171(dirname76(path2), inc[1]));
|
|
258929
259020
|
continue;
|
|
258930
259021
|
}
|
|
258931
259022
|
const line = raw.replace(/\/\/.*$/, "");
|
|
@@ -258933,7 +259024,7 @@ function readXcconfigVars(iosDir, projectYml) {
|
|
|
258933
259024
|
if (kv) vars[kv[1]] = expandVars(kv[2], vars);
|
|
258934
259025
|
}
|
|
258935
259026
|
};
|
|
258936
|
-
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]));
|
|
258937
259028
|
return vars;
|
|
258938
259029
|
}
|
|
258939
259030
|
function profileAccount(app2, storeConfig, opts = {}) {
|
|
@@ -258952,12 +259043,12 @@ async function preflightApp(app2, opts = {}) {
|
|
|
258952
259043
|
const projectYml = existsSync132(iosProjectYml(app2)) ? readFileSync157(iosProjectYml(app2), "utf8") : "";
|
|
258953
259044
|
const storeConfig = existsSync132(storeConfigPath(app2)) ? readFileSync157(storeConfigPath(app2), "utf8") : "";
|
|
258954
259045
|
const adopted = appAdoptedIdentity(app2);
|
|
258955
|
-
const identity = projectYml ? analyzeStoreIdentity(projectYml, storeConfig, readXcconfigVars(
|
|
259046
|
+
const identity = projectYml ? analyzeStoreIdentity(projectYml, storeConfig, readXcconfigVars(join171(appDir(app2), "ios"), projectYml), adopted) : [];
|
|
258956
259047
|
if (!storeConfig) return [{ level: "error", message: `no apps/${app2}/store/store.config.yaml \u2014 run /setup-store-signing first.` }, ...identity];
|
|
258957
259048
|
const findings = analyze(
|
|
258958
259049
|
projectYml,
|
|
258959
259050
|
storeConfig,
|
|
258960
|
-
await appIconState(
|
|
259051
|
+
await appIconState(join171(appDir(app2), "ios")),
|
|
258961
259052
|
profileAccount(app2, storeConfig, opts),
|
|
258962
259053
|
adopted
|
|
258963
259054
|
);
|
|
@@ -258988,16 +259079,16 @@ function analyzeSubmissionRecord(appLevel, review, opts) {
|
|
|
258988
259079
|
return f2;
|
|
258989
259080
|
}
|
|
258990
259081
|
function appLevelMetadataFiles(app2, locale = "en-US") {
|
|
258991
|
-
const root =
|
|
259082
|
+
const root = join171(storeDir(app2), "metadata");
|
|
258992
259083
|
const out2 = /* @__PURE__ */ new Set();
|
|
258993
259084
|
if (existsSync132(root)) {
|
|
258994
259085
|
for (const n2 of readdirSync57(root)) if (n2.endsWith(".txt")) out2.add(n2);
|
|
258995
259086
|
}
|
|
258996
|
-
if (existsSync132(
|
|
259087
|
+
if (existsSync132(join171(root, locale, "privacy_url.txt"))) out2.add("privacy_url.txt");
|
|
258997
259088
|
return out2;
|
|
258998
259089
|
}
|
|
258999
259090
|
function reviewInfoFiles(app2) {
|
|
259000
|
-
const dir =
|
|
259091
|
+
const dir = join171(storeDir(app2), "review_information");
|
|
259001
259092
|
if (!existsSync132(dir)) return /* @__PURE__ */ new Set();
|
|
259002
259093
|
return new Set(readdirSync57(dir).filter((n2) => n2.endsWith(".txt")));
|
|
259003
259094
|
}
|
|
@@ -259108,10 +259199,10 @@ function analyzePlayListing(assets) {
|
|
|
259108
259199
|
return f2;
|
|
259109
259200
|
}
|
|
259110
259201
|
function playListingAssets(app2, locale = "en-US") {
|
|
259111
|
-
const dir =
|
|
259202
|
+
const dir = join171(storeDir(app2), "play", locale, "images");
|
|
259112
259203
|
const read2 = (names2) => {
|
|
259113
259204
|
for (const name of names2) {
|
|
259114
|
-
const p2 =
|
|
259205
|
+
const p2 = join171(dir, name);
|
|
259115
259206
|
try {
|
|
259116
259207
|
if (statSync44(p2).isFile()) return { name, bytes: readFileSync157(p2) };
|
|
259117
259208
|
} catch {
|
|
@@ -259144,26 +259235,26 @@ function analyzeListing(metaFiles, shots) {
|
|
|
259144
259235
|
return f2;
|
|
259145
259236
|
}
|
|
259146
259237
|
function metadataFilesPresent(app2, locale = "en-US") {
|
|
259147
|
-
const dir =
|
|
259238
|
+
const dir = join171(storeDir(app2), "metadata", locale);
|
|
259148
259239
|
if (!existsSync132(dir)) return /* @__PURE__ */ new Set();
|
|
259149
259240
|
return new Set(readdirSync57(dir).filter((n2) => n2.endsWith(".txt")));
|
|
259150
259241
|
}
|
|
259151
259242
|
function listScreenshots(app2, locale = "en-US") {
|
|
259152
259243
|
const out2 = [];
|
|
259153
|
-
const flat2 =
|
|
259244
|
+
const flat2 = join171(storeDir(app2), "screenshots", locale);
|
|
259154
259245
|
if (existsSync132(flat2)) {
|
|
259155
259246
|
for (const png of readdirSync57(flat2).filter((n2) => n2.endsWith(".png"))) {
|
|
259156
|
-
const sz = pngSize3(readFileSync157(
|
|
259247
|
+
const sz = pngSize3(readFileSync157(join171(flat2, png)));
|
|
259157
259248
|
if (sz) out2.push({ name: png, w: sz.w, h: sz.h });
|
|
259158
259249
|
}
|
|
259159
259250
|
}
|
|
259160
|
-
const legacy =
|
|
259251
|
+
const legacy = join171(storeDir(app2), "metadata", locale, "screenshots");
|
|
259161
259252
|
if (existsSync132(legacy)) {
|
|
259162
259253
|
for (const deviceDir of readdirSync57(legacy)) {
|
|
259163
|
-
const d2 =
|
|
259254
|
+
const d2 = join171(legacy, deviceDir);
|
|
259164
259255
|
if (!statSync44(d2).isDirectory()) continue;
|
|
259165
259256
|
for (const png of readdirSync57(d2).filter((n2) => n2.endsWith(".png"))) {
|
|
259166
|
-
const sz = pngSize3(readFileSync157(
|
|
259257
|
+
const sz = pngSize3(readFileSync157(join171(d2, png)));
|
|
259167
259258
|
if (sz) out2.push({ name: `${deviceDir}/${png}`, w: sz.w, h: sz.h });
|
|
259168
259259
|
}
|
|
259169
259260
|
}
|
|
@@ -259171,10 +259262,10 @@ function listScreenshots(app2, locale = "en-US") {
|
|
|
259171
259262
|
return out2;
|
|
259172
259263
|
}
|
|
259173
259264
|
function placeholderHashes2() {
|
|
259174
|
-
const templateIos =
|
|
259265
|
+
const templateIos = join171(appDir("_template"), "ios");
|
|
259175
259266
|
if (!existsSync132(templateIos)) return [LEGACY_PLACEHOLDER_SHA2562];
|
|
259176
259267
|
for (const target of readdirSync57(templateIos)) {
|
|
259177
|
-
const p2 =
|
|
259268
|
+
const p2 = join171(templateIos, target, "Assets.xcassets", "AppIcon.appiconset", "icon_1024.png");
|
|
259178
259269
|
try {
|
|
259179
259270
|
if (!statSync44(p2).isFile()) continue;
|
|
259180
259271
|
return [LEGACY_PLACEHOLDER_SHA2562, createHash85("sha256").update(readFileSync157(p2)).digest("hex")];
|
|
@@ -259210,7 +259301,7 @@ async function pixelIssues(bytes2) {
|
|
|
259210
259301
|
async function appIconState(iosDir) {
|
|
259211
259302
|
if (!existsSync132(iosDir)) return { exists: false, isPlaceholder: false, storeIssues: [] };
|
|
259212
259303
|
for (const target of readdirSync57(iosDir)) {
|
|
259213
|
-
const p2 =
|
|
259304
|
+
const p2 = join171(iosDir, target, "Assets.xcassets", "AppIcon.appiconset", "icon_1024.png");
|
|
259214
259305
|
try {
|
|
259215
259306
|
if (!statSync44(p2).isFile()) continue;
|
|
259216
259307
|
const bytes2 = readFileSync157(p2);
|
|
@@ -259676,12 +259767,12 @@ var init_connector_token = __esm({
|
|
|
259676
259767
|
|
|
259677
259768
|
// ../../core/functions-secrets/src/vault.ts
|
|
259678
259769
|
import { createCipheriv as createCipheriv2, createDecipheriv as createDecipheriv3, randomBytes as randomBytes23 } from "node:crypto";
|
|
259679
|
-
import { mkdir as
|
|
259770
|
+
import { mkdir as mkdir21, readFile as readFile25, rename as rename9, writeFile as writeFile17 } from "node:fs/promises";
|
|
259680
259771
|
import { dirname as dirname77 } from "node:path";
|
|
259681
259772
|
function createJsonSecretStore(filePath) {
|
|
259682
259773
|
const read2 = async () => {
|
|
259683
259774
|
try {
|
|
259684
|
-
const parsed = JSON.parse(await
|
|
259775
|
+
const parsed = JSON.parse(await readFile25(filePath, "utf8"));
|
|
259685
259776
|
if (!Array.isArray(parsed)) throw new Error("secret store must contain an array");
|
|
259686
259777
|
return parsed;
|
|
259687
259778
|
} catch (error) {
|
|
@@ -259690,9 +259781,9 @@ function createJsonSecretStore(filePath) {
|
|
|
259690
259781
|
}
|
|
259691
259782
|
};
|
|
259692
259783
|
const write3 = async (records) => {
|
|
259693
|
-
await
|
|
259784
|
+
await mkdir21(dirname77(filePath), { recursive: true });
|
|
259694
259785
|
const temporary = `${filePath}.${process.pid}.tmp`;
|
|
259695
|
-
await
|
|
259786
|
+
await writeFile17(temporary, `${JSON.stringify(records, null, 2)}
|
|
259696
259787
|
`, { mode: 384 });
|
|
259697
259788
|
await rename9(temporary, filePath);
|
|
259698
259789
|
};
|
|
@@ -260354,9 +260445,9 @@ __export(notify_exports, {
|
|
|
260354
260445
|
});
|
|
260355
260446
|
import { chmodSync as chmodSync6, mkdirSync as mkdirSync60, readFileSync as readFileSync164, writeFileSync as writeFileSync59 } from "node:fs";
|
|
260356
260447
|
import { homedir as homedir21 } from "node:os";
|
|
260357
|
-
import { dirname as dirname78, join as
|
|
260448
|
+
import { dirname as dirname78, join as join176 } from "node:path";
|
|
260358
260449
|
function defaultSessionsPath() {
|
|
260359
|
-
return process.env.HIMI_ADMIN_SESSIONS_FILE ??
|
|
260450
|
+
return process.env.HIMI_ADMIN_SESSIONS_FILE ?? join176(homedir21(), ".himalaya", "admin-sessions.json");
|
|
260360
260451
|
}
|
|
260361
260452
|
function loadSessionsFile(path2 = defaultSessionsPath()) {
|
|
260362
260453
|
try {
|
|
@@ -260758,7 +260849,7 @@ __export(auth_gate_copy_exports, {
|
|
|
260758
260849
|
});
|
|
260759
260850
|
import { createHash as createHash88 } from "node:crypto";
|
|
260760
260851
|
import { existsSync as existsSync136, readdirSync as readdirSync58, readFileSync as readFileSync165, writeFileSync as writeFileSync60 } from "node:fs";
|
|
260761
|
-
import { dirname as dirname79, join as
|
|
260852
|
+
import { dirname as dirname79, join as join177, relative as relative33, resolve as resolve111 } from "node:path";
|
|
260762
260853
|
import { fileURLToPath as fileURLToPath38 } from "node:url";
|
|
260763
260854
|
function discoverMessageSources() {
|
|
260764
260855
|
const roots2 = [
|
|
@@ -260770,7 +260861,7 @@ function discoverMessageSources() {
|
|
|
260770
260861
|
];
|
|
260771
260862
|
const out2 = [];
|
|
260772
260863
|
const visit = (rel2) => {
|
|
260773
|
-
const abs =
|
|
260864
|
+
const abs = join177(REPO_ROOT8, rel2);
|
|
260774
260865
|
if (!existsSync136(abs)) return;
|
|
260775
260866
|
for (const name of readdirSync58(abs, { withFileTypes: true })) {
|
|
260776
260867
|
const child3 = `${rel2}/${name.name}`;
|
|
@@ -260778,7 +260869,7 @@ function discoverMessageSources() {
|
|
|
260778
260869
|
if (/^(?:test|tests|Tests|androidTest|build|node_modules|\.build)$/.test(name.name)) continue;
|
|
260779
260870
|
visit(child3);
|
|
260780
260871
|
} else if (/\.(?:swift|kt)$/.test(name.name) && !GATE_SOURCES.includes(child3)) {
|
|
260781
|
-
if (MESSAGE_FILE.test(readFileSync165(
|
|
260872
|
+
if (MESSAGE_FILE.test(readFileSync165(join177(REPO_ROOT8, child3), "utf8"))) out2.push(child3);
|
|
260782
260873
|
}
|
|
260783
260874
|
}
|
|
260784
260875
|
};
|
|
@@ -260851,11 +260942,11 @@ function injectGateRows(catalog4, table = loadTable()) {
|
|
|
260851
260942
|
return { ...catalog4, messages: sorted3 };
|
|
260852
260943
|
}
|
|
260853
260944
|
function appSourceCatalogs() {
|
|
260854
|
-
const appsDir =
|
|
260855
|
-
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));
|
|
260856
260947
|
}
|
|
260857
260948
|
function nativeKeysPath(appDir3) {
|
|
260858
|
-
return
|
|
260949
|
+
return join177(appDir3, "l10n", "native-keys.json");
|
|
260859
260950
|
}
|
|
260860
260951
|
function loadNativeKeys(appDir3) {
|
|
260861
260952
|
const p2 = nativeKeysPath(appDir3);
|
|
@@ -260867,7 +260958,7 @@ function loadNativeKeys(appDir3) {
|
|
|
260867
260958
|
return raw.keys;
|
|
260868
260959
|
}
|
|
260869
260960
|
function loadAppTable(appDir3) {
|
|
260870
|
-
const p2 =
|
|
260961
|
+
const p2 = join177(appDir3, "strings", "en.json");
|
|
260871
260962
|
if (!existsSync136(p2)) return {};
|
|
260872
260963
|
const raw = JSON.parse(readFileSync165(p2, "utf8"));
|
|
260873
260964
|
const out2 = {};
|
|
@@ -261065,7 +261156,7 @@ function loadAllow(section3, path2 = ALLOW_PATH) {
|
|
|
261065
261156
|
}
|
|
261066
261157
|
return list5;
|
|
261067
261158
|
}
|
|
261068
|
-
function scanProse(files, allow = [], read2 = (rel2) => readFileSync165(
|
|
261159
|
+
function scanProse(files, allow = [], read2 = (rel2) => readFileSync165(join177(REPO_ROOT8, rel2), "utf8")) {
|
|
261069
261160
|
const hits = [];
|
|
261070
261161
|
const usedAllow = /* @__PURE__ */ new Set();
|
|
261071
261162
|
for (const file2 of files) {
|
|
@@ -261084,7 +261175,7 @@ function scanProse(files, allow = [], read2 = (rel2) => readFileSync165(join176(
|
|
|
261084
261175
|
}
|
|
261085
261176
|
function expectedOutputs(table = loadTable()) {
|
|
261086
261177
|
const out2 = [
|
|
261087
|
-
{ 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" },
|
|
261088
261179
|
{ path: SWIFT_OUT, content: renderSwift(table) },
|
|
261089
261180
|
{ path: KOTLIN_OUT, content: renderKotlin(table) }
|
|
261090
261181
|
];
|
|
@@ -261094,7 +261185,7 @@ function expectedOutputs(table = loadTable()) {
|
|
|
261094
261185
|
}
|
|
261095
261186
|
return out2;
|
|
261096
261187
|
}
|
|
261097
|
-
function scanThrownMessages(files, read2 = (rel2) => readFileSync165(
|
|
261188
|
+
function scanThrownMessages(files, read2 = (rel2) => readFileSync165(join177(REPO_ROOT8, rel2), "utf8")) {
|
|
261098
261189
|
const out2 = [];
|
|
261099
261190
|
for (const file2 of files) {
|
|
261100
261191
|
const src = read2(file2);
|
|
@@ -261115,12 +261206,12 @@ var init_auth_gate_copy = __esm({
|
|
|
261115
261206
|
init_define_HHP_CATALOG();
|
|
261116
261207
|
HERE5 = dirname79(fileURLToPath38(import.meta.url));
|
|
261117
261208
|
REPO_ROOT8 = resolve111(HERE5, "../..");
|
|
261118
|
-
TABLE_PATH =
|
|
261119
|
-
SWIFT_OUT =
|
|
261209
|
+
TABLE_PATH = join177(REPO_ROOT8, "core/runtime/l10n/auth-gate/en.json");
|
|
261210
|
+
SWIFT_OUT = join177(
|
|
261120
261211
|
REPO_ROOT8,
|
|
261121
261212
|
"core/runtime/ios/HimalayaCore/Sources/HimalayaCore/AuthGateCopyDefaults.generated.swift"
|
|
261122
261213
|
);
|
|
261123
|
-
KOTLIN_OUT =
|
|
261214
|
+
KOTLIN_OUT = join177(
|
|
261124
261215
|
REPO_ROOT8,
|
|
261125
261216
|
"core/runtime/android/io/himalaya/core/src/main/kotlin/io/himalaya/core/AuthGateCopyDefaults.generated.kt"
|
|
261126
261217
|
);
|
|
@@ -261183,14 +261274,14 @@ var init_auth_gate_copy = __esm({
|
|
|
261183
261274
|
"setRequestProperty"
|
|
261184
261275
|
]);
|
|
261185
261276
|
LOG_LEVELS = /* @__PURE__ */ new Set(["d", "i", "w", "e", "v"]);
|
|
261186
|
-
ALLOW_PATH =
|
|
261277
|
+
ALLOW_PATH = join177(HERE5, "auth-gate-copy.allow.json");
|
|
261187
261278
|
if (false) main();
|
|
261188
261279
|
MESSAGE_SITE = /NativeAuthError\.|NativeAuthException\(|BiometricException\(|\.retrieve\(|reason:|message:|\bcase\s+\.[A-Za-z]+[^:\n]*:\s*return\s+(?:m\.isEmpty\s*\?\s*)?"/;
|
|
261189
261280
|
}
|
|
261190
261281
|
});
|
|
261191
261282
|
|
|
261192
261283
|
// ../l10n/extract.ts
|
|
261193
|
-
import { resolve as resolve112, join as
|
|
261284
|
+
import { resolve as resolve112, join as join178, relative as relative34, dirname as dirname80 } from "node:path";
|
|
261194
261285
|
import { createHash as createHash89 } from "node:crypto";
|
|
261195
261286
|
import { fileURLToPath as fileURLToPath39 } from "node:url";
|
|
261196
261287
|
function keyOf3(source2) {
|
|
@@ -261576,7 +261667,7 @@ __export(base44_adopt_exports, {
|
|
|
261576
261667
|
runBase44Adopt: () => runBase44Adopt
|
|
261577
261668
|
});
|
|
261578
261669
|
import { existsSync as existsSync138, readFileSync as readFileSync167, writeFileSync as writeFileSync62 } from "node:fs";
|
|
261579
|
-
import { join as
|
|
261670
|
+
import { join as join180, resolve as resolve114 } from "node:path";
|
|
261580
261671
|
function prop(entity, key4) {
|
|
261581
261672
|
const props2 = entity.schema?.properties;
|
|
261582
261673
|
const p2 = props2 && typeof props2 === "object" ? props2[key4] : void 0;
|
|
@@ -261667,7 +261758,7 @@ function renderAdoptModule(r3, source2 = ".himi/base44-book/book.json") {
|
|
|
261667
261758
|
}
|
|
261668
261759
|
function runBase44Adopt(opts) {
|
|
261669
261760
|
const bookDir = resolve114(opts.cwd, opts.book ?? ".himi/base44-book");
|
|
261670
|
-
const bookPath =
|
|
261761
|
+
const bookPath = join180(bookDir, "book.json");
|
|
261671
261762
|
let book;
|
|
261672
261763
|
try {
|
|
261673
261764
|
book = JSON.parse(readFileSync167(bookPath, "utf8"));
|
|
@@ -261680,10 +261771,10 @@ function runBase44Adopt(opts) {
|
|
|
261680
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) });
|
|
261681
261772
|
}
|
|
261682
261773
|
const result = adoptFromBook(book, { only: opts.only, app: opts.app });
|
|
261683
|
-
const module = renderAdoptModule(result, opts.book ?
|
|
261774
|
+
const module = renderAdoptModule(result, opts.book ? join180(opts.book, "book.json") : void 0);
|
|
261684
261775
|
const issues = validateBase44Entities({ entities: result.entities, functions: result.functions }, opts.app);
|
|
261685
261776
|
if (opts.write === void 0 || opts.write === false || issues.some((i2) => i2.severity === "error")) return { result, module, issues };
|
|
261686
|
-
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);
|
|
261687
261778
|
if (existsSync138(target)) {
|
|
261688
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 });
|
|
261689
261780
|
}
|
|
@@ -261936,7 +262027,7 @@ __export(generate_exports, {
|
|
|
261936
262027
|
});
|
|
261937
262028
|
import { createHash as createHash90 } from "node:crypto";
|
|
261938
262029
|
import { existsSync as existsSync139, mkdirSync as mkdirSync62, readdirSync as readdirSync60, readFileSync as readFileSync168, writeFileSync as writeFileSync63 } from "node:fs";
|
|
261939
|
-
import { dirname as dirname82, join as
|
|
262030
|
+
import { dirname as dirname82, join as join181 } from "node:path";
|
|
261940
262031
|
function withHeader(body) {
|
|
261941
262032
|
return `${GENERATED_HEADER}${sha2568(body)}
|
|
261942
262033
|
${body}`;
|
|
@@ -262059,7 +262150,7 @@ function renderAll(sp) {
|
|
|
262059
262150
|
function writeGenerated2(dir, files, opts = {}) {
|
|
262060
262151
|
const out2 = [];
|
|
262061
262152
|
for (const f2 of files) {
|
|
262062
|
-
const abs =
|
|
262153
|
+
const abs = join181(dir, f2.path);
|
|
262063
262154
|
const next = withHeader(f2.body);
|
|
262064
262155
|
let outcome;
|
|
262065
262156
|
if (!existsSync139(abs)) outcome = "written";
|
|
@@ -262080,16 +262171,16 @@ function writeGenerated2(dir, files, opts = {}) {
|
|
|
262080
262171
|
function orphanedFiles(dir, current) {
|
|
262081
262172
|
const keep = new Set(current.map((f2) => f2.path));
|
|
262082
262173
|
const found = [];
|
|
262083
|
-
const t5 =
|
|
262174
|
+
const t5 = join181(dir, "tier5-src");
|
|
262084
262175
|
if (!existsSync139(t5)) return found;
|
|
262085
262176
|
const candidates = readdirSync60(t5).filter((d2) => d2.startsWith("b44-")).map((d2) => `tier5-src/${d2}/index.ts`);
|
|
262086
|
-
const shared =
|
|
262177
|
+
const shared = join181(t5, "_shared");
|
|
262087
262178
|
if (existsSync139(shared)) {
|
|
262088
262179
|
for (const f2 of readdirSync60(shared)) if (/^b44-.*-plan\.ts$/.test(f2)) candidates.push(`tier5-src/_shared/${f2}`);
|
|
262089
262180
|
}
|
|
262090
262181
|
for (const rel2 of candidates.sort()) {
|
|
262091
|
-
if (keep.has(rel2) || !existsSync139(
|
|
262092
|
-
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);
|
|
262093
262184
|
}
|
|
262094
262185
|
return found;
|
|
262095
262186
|
}
|
|
@@ -262130,12 +262221,12 @@ __export(base44_auth_exports, {
|
|
|
262130
262221
|
});
|
|
262131
262222
|
import { chmodSync as chmodSync7, existsSync as existsSync140, mkdirSync as mkdirSync63, readFileSync as readFileSync169, rmSync as rmSync41, writeFileSync as writeFileSync64 } from "node:fs";
|
|
262132
262223
|
import { homedir as homedir22 } from "node:os";
|
|
262133
|
-
import { dirname as dirname83, join as
|
|
262224
|
+
import { dirname as dirname83, join as join182 } from "node:path";
|
|
262134
262225
|
function base44ApiBase(env = process.env) {
|
|
262135
262226
|
return (env.BASE44_API_URL?.trim() || "https://app.base44.com").replace(/\/+$/, "");
|
|
262136
262227
|
}
|
|
262137
262228
|
function base44SessionPath(home2 = homedir22()) {
|
|
262138
|
-
return
|
|
262229
|
+
return join182(home2, ".himi", "base44", "session.json");
|
|
262139
262230
|
}
|
|
262140
262231
|
function readBase44Session(home2) {
|
|
262141
262232
|
const p2 = base44SessionPath(home2);
|
|
@@ -262259,7 +262350,7 @@ function hasBase44WriteScope(auth) {
|
|
|
262259
262350
|
return scopes.includes("apps:write");
|
|
262260
262351
|
}
|
|
262261
262352
|
function importBase44CliSession(home2 = homedir22(), env = process.env) {
|
|
262262
|
-
const src =
|
|
262353
|
+
const src = join182(home2, ".base44", "auth", "auth.json");
|
|
262263
262354
|
if (!existsSync140(src)) throw new Error(`no Base44 CLI session at ${src} \u2014 run \`npx base44 login\` first, or use \`himi base44 login\``);
|
|
262264
262355
|
const a3 = JSON.parse(readFileSync169(src, "utf8"));
|
|
262265
262356
|
if (typeof a3.accessToken !== "string" || !a3.accessToken) throw new Error(`${src} holds no access token`);
|
|
@@ -262361,9 +262452,9 @@ __export(seed_exports, {
|
|
|
262361
262452
|
writeBase44SeedRows: () => writeBase44SeedRows
|
|
262362
262453
|
});
|
|
262363
262454
|
import { existsSync as existsSync141, readFileSync as readFileSync170, writeFileSync as writeFileSync65 } from "node:fs";
|
|
262364
|
-
import { join as
|
|
262455
|
+
import { join as join183 } from "node:path";
|
|
262365
262456
|
function readBase44SeedFile(dir) {
|
|
262366
|
-
const file2 =
|
|
262457
|
+
const file2 = join183(dir, BASE44_SEED_FILE);
|
|
262367
262458
|
if (!existsSync141(file2)) return {};
|
|
262368
262459
|
let parsed;
|
|
262369
262460
|
try {
|
|
@@ -262518,7 +262609,7 @@ function placeholder2(f2, i2) {
|
|
|
262518
262609
|
}
|
|
262519
262610
|
function writeBase44SeedRows(opts) {
|
|
262520
262611
|
const { dir, app: app2, count: count3 = 8 } = opts;
|
|
262521
|
-
const path2 =
|
|
262612
|
+
const path2 = join183(dir, BASE44_SEED_FILE);
|
|
262522
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 ?? "")));
|
|
262523
262614
|
if (!owned.length) {
|
|
262524
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.` };
|
|
@@ -262882,14 +262973,14 @@ __export(functions_exports2, {
|
|
|
262882
262973
|
readFunctionSource: () => readFunctionSource
|
|
262883
262974
|
});
|
|
262884
262975
|
import { existsSync as existsSync142, lstatSync as lstatSync38 } from "node:fs";
|
|
262885
|
-
import { join as
|
|
262976
|
+
import { join as join184 } from "node:path";
|
|
262886
262977
|
function markerContent(app2) {
|
|
262887
262978
|
return `${JSON.stringify({ app: app2, by: "himi" })}
|
|
262888
262979
|
`;
|
|
262889
262980
|
}
|
|
262890
262981
|
function readFunctionSource(appDir3, name, app2) {
|
|
262891
262982
|
const rel2 = `base44/functions/${name}/`;
|
|
262892
|
-
const folder =
|
|
262983
|
+
const folder = join184(appDir3, "base44", "functions", name);
|
|
262893
262984
|
if (!existsSync142(folder) || !lstatSync38(folder).isDirectory()) throw new FunctionSourceError("function_source_missing", `no source folder at ${rel2}`);
|
|
262894
262985
|
const { entries, skipped } = collectAppSource(folder);
|
|
262895
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`);
|
|
@@ -263232,9 +263323,9 @@ __export(apply_exports2, {
|
|
|
263232
263323
|
fileLedger: () => fileLedger
|
|
263233
263324
|
});
|
|
263234
263325
|
import { existsSync as existsSync143, readFileSync as readFileSync171, writeFileSync as writeFileSync66 } from "node:fs";
|
|
263235
|
-
import { join as
|
|
263326
|
+
import { join as join185 } from "node:path";
|
|
263236
263327
|
function fileLedger(dir, appId3) {
|
|
263237
|
-
const path2 =
|
|
263328
|
+
const path2 = join185(dir, LEDGER_FILE2);
|
|
263238
263329
|
const load6 = () => {
|
|
263239
263330
|
if (!existsSync143(path2)) return {};
|
|
263240
263331
|
let v2;
|
|
@@ -263892,10 +263983,10 @@ var init_analyze = __esm({
|
|
|
263892
263983
|
|
|
263893
263984
|
// src/base44-analyze/write-artifacts.ts
|
|
263894
263985
|
import { existsSync as existsSync144, mkdirSync as mkdirSync64, readFileSync as readFileSync172, rmSync as rmSync42, writeFileSync as writeFileSync67 } from "node:fs";
|
|
263895
|
-
import { dirname as dirname84, join as
|
|
263986
|
+
import { dirname as dirname84, join as join186, resolve as resolve115, sep as sep33 } from "node:path";
|
|
263896
263987
|
function isBookFolder(dir) {
|
|
263897
263988
|
try {
|
|
263898
|
-
return JSON.parse(readFileSync172(
|
|
263989
|
+
return JSON.parse(readFileSync172(join186(dir, "book.json"), "utf8")).kind === "base44-app-book";
|
|
263899
263990
|
} catch {
|
|
263900
263991
|
return false;
|
|
263901
263992
|
}
|
|
@@ -263982,24 +264073,24 @@ function writeBase44Book(result, outDir, opts = {}) {
|
|
|
263982
264073
|
const md = renderBookMd(book);
|
|
263983
264074
|
assertNoSecrets(json9);
|
|
263984
264075
|
assertNoSecrets(md);
|
|
263985
|
-
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)));
|
|
263986
264077
|
if (owned.length) {
|
|
263987
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`);
|
|
263988
|
-
for (const d2 of ["source", "screenshots"]) rmSync42(
|
|
264079
|
+
for (const d2 of ["source", "screenshots"]) rmSync42(join186(out2, d2), { recursive: true, force: true });
|
|
263989
264080
|
}
|
|
263990
264081
|
mkdirSync64(out2, { recursive: true });
|
|
263991
|
-
writeFileSync67(
|
|
263992
|
-
writeFileSync67(
|
|
264082
|
+
writeFileSync67(join186(out2, "book.json"), json9);
|
|
264083
|
+
writeFileSync67(join186(out2, "BOOK.md"), md);
|
|
263993
264084
|
files.push("book.json", "BOOK.md");
|
|
263994
264085
|
for (const s5 of shots) {
|
|
263995
|
-
mkdirSync64(
|
|
263996
|
-
writeFileSync67(
|
|
264086
|
+
mkdirSync64(join186(out2, "screenshots"), { recursive: true });
|
|
264087
|
+
writeFileSync67(join186(out2, "screenshots", s5.filename), s5.bytes);
|
|
263997
264088
|
files.push(`screenshots/${s5.filename}`);
|
|
263998
264089
|
}
|
|
263999
|
-
const sourceRoot =
|
|
264090
|
+
const sourceRoot = join186(out2, "source");
|
|
264000
264091
|
for (const f2 of result.sourceFiles) {
|
|
264001
264092
|
if (!safeRel(f2.path)) continue;
|
|
264002
|
-
const dest =
|
|
264093
|
+
const dest = join186(sourceRoot, ...f2.path.split("/"));
|
|
264003
264094
|
if (!dest.startsWith(sourceRoot + sep33)) continue;
|
|
264004
264095
|
mkdirSync64(dirname84(dest), { recursive: true });
|
|
264005
264096
|
writeFileSync67(dest, f2.bytes);
|
|
@@ -267550,7 +267641,7 @@ __export(cli_exports, {
|
|
|
267550
267641
|
import { execFile as execFile7 } from "node:child_process";
|
|
267551
267642
|
import { mkdirSync as mkdirSync65, mkdtempSync as mkdtempSync14, rmSync as rmSync43, writeFileSync as writeFileSync68 } from "node:fs";
|
|
267552
267643
|
import { tmpdir as tmpdir15 } from "node:os";
|
|
267553
|
-
import { join as
|
|
267644
|
+
import { join as join187, resolve as resolve116 } from "node:path";
|
|
267554
267645
|
import { promisify as promisify2 } from "node:util";
|
|
267555
267646
|
function projectDownloader(apiFetch, apiBase, token, extract = systemTar) {
|
|
267556
267647
|
return async (appId3) => {
|
|
@@ -267563,11 +267654,11 @@ function projectDownloader(apiFetch, apiBase, token, extract = systemTar) {
|
|
|
267563
267654
|
}
|
|
267564
267655
|
const bytes2 = await readCapped(res, MAX_TARBALL_BYTES);
|
|
267565
267656
|
if (!bytes2) throw new Error(`project download is over the ${MAX_TARBALL_BYTES}-byte cap`);
|
|
267566
|
-
const root = mkdtempSync14(
|
|
267657
|
+
const root = mkdtempSync14(join187(tmpdir15(), "himi-base44-"));
|
|
267567
267658
|
const cleanup = () => rmSync43(root, { recursive: true, force: true });
|
|
267568
267659
|
try {
|
|
267569
|
-
const archive =
|
|
267570
|
-
const dir =
|
|
267660
|
+
const archive = join187(root, "project.tar");
|
|
267661
|
+
const dir = join187(root, "project");
|
|
267571
267662
|
writeFileSync68(archive, bytes2);
|
|
267572
267663
|
mkdirSync65(dir);
|
|
267573
267664
|
await extract(archive, dir);
|
|
@@ -268883,7 +268974,7 @@ var init_invite_plan = __esm({
|
|
|
268883
268974
|
|
|
268884
268975
|
// src/one-app/header-badges-cli.ts
|
|
268885
268976
|
import { existsSync as existsSync146, readFileSync as readFileSync173, rmSync as rmSync44, statSync as statSync47, writeFileSync as writeFileSync69 } from "node:fs";
|
|
268886
|
-
import { join as
|
|
268977
|
+
import { join as join189, resolve as resolve118 } from "node:path";
|
|
268887
268978
|
function parseArgs4(args) {
|
|
268888
268979
|
let evidenceDir;
|
|
268889
268980
|
let contentDir2;
|
|
@@ -268909,7 +269000,7 @@ function parseArgs4(args) {
|
|
|
268909
269000
|
return { evidenceDir: resolve118(evidenceDir), contentDir: resolve118(contentDir2), dryRun };
|
|
268910
269001
|
}
|
|
268911
269002
|
function contentScreens(contentDir2) {
|
|
268912
|
-
const path2 =
|
|
269003
|
+
const path2 = join189(contentDir2, "himalaya.content.json");
|
|
268913
269004
|
if (!existsSync146(path2)) throw new Error("himalaya.content.json not found: --content must be a Himi content package");
|
|
268914
269005
|
const parsed = JSON.parse(readFileSync173(path2, "utf8"));
|
|
268915
269006
|
return new Set(Object.keys(parsed.screens ?? {}));
|
|
@@ -268940,7 +269031,7 @@ function mapCoverage(evidenceDir, contentDir2, plan, bound2, dryRun) {
|
|
|
268940
269031
|
mapped++;
|
|
268941
269032
|
} else conflicts.push(`${source2.buttonId ?? source2.source}: already mapped to ${row2.target.screenId}/${row2.target.controlId ?? "?"}, not ${target.screenId}/${target.controlId}`);
|
|
268942
269033
|
}
|
|
268943
|
-
if (mapped && !dryRun) writeFileSync69(
|
|
269034
|
+
if (mapped && !dryRun) writeFileSync69(join189(resolve118(contentDir2), COVERAGE_FILE), JSON.stringify(coverage2, null, 2) + "\n");
|
|
268944
269035
|
return { mapped, kept, conflicts };
|
|
268945
269036
|
}
|
|
268946
269037
|
function report4(io2, ok5, body) {
|
|
@@ -268978,7 +269069,7 @@ async function runOneAppHeaderBadges(args, io2) {
|
|
|
268978
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."
|
|
268979
269070
|
});
|
|
268980
269071
|
}
|
|
268981
|
-
const configPath =
|
|
269072
|
+
const configPath = join189(options2.contentDir, "config.ts");
|
|
268982
269073
|
let screens;
|
|
268983
269074
|
let configText;
|
|
268984
269075
|
try {
|
|
@@ -268998,7 +269089,7 @@ async function runOneAppHeaderBadges(args, io2) {
|
|
|
268998
269089
|
if (!bindable.length) {
|
|
268999
269090
|
return report4(io2, true, { status: "nothing_to_bind", headerBadges: [], skipped, ...common2 });
|
|
269000
269091
|
}
|
|
269001
|
-
const workerSource =
|
|
269092
|
+
const workerSource = join189(options2.contentDir, "tier5-src", HEADER_BADGES_BUNDLE, "index.ts");
|
|
269002
269093
|
if (!existsSync146(workerSource)) {
|
|
269003
269094
|
return report4(io2, false, {
|
|
269004
269095
|
code: "worker_missing",
|
|
@@ -269020,7 +269111,7 @@ async function runOneAppHeaderBadges(args, io2) {
|
|
|
269020
269111
|
snippet: patch.snippet
|
|
269021
269112
|
});
|
|
269022
269113
|
}
|
|
269023
|
-
const ledgerPath =
|
|
269114
|
+
const ledgerPath = join189(resolve118(options2.contentDir), COVERAGE_FILE);
|
|
269024
269115
|
let ledgerBefore = null;
|
|
269025
269116
|
let coverage2;
|
|
269026
269117
|
try {
|
|
@@ -269073,7 +269164,7 @@ var init_header_badges_cli = __esm({
|
|
|
269073
269164
|
|
|
269074
269165
|
// src/one-app/recipes.ts
|
|
269075
269166
|
import { existsSync as existsSync147, readFileSync as readFileSync174 } from "node:fs";
|
|
269076
|
-
import { join as
|
|
269167
|
+
import { join as join190 } from "node:path";
|
|
269077
269168
|
function readRecipe(contentDir2, name, values) {
|
|
269078
269169
|
return readParts(contentDir2, name, values, "node");
|
|
269079
269170
|
}
|
|
@@ -269082,7 +269173,7 @@ function readRecipeNodes(contentDir2, name, values) {
|
|
|
269082
269173
|
}
|
|
269083
269174
|
function readParts(contentDir2, name, values, key4) {
|
|
269084
269175
|
if (!/^[a-z0-9][a-z0-9-]*$/.test(name)) throw new RecipeError(`"${name}" is not a recipe name`);
|
|
269085
|
-
const path2 =
|
|
269176
|
+
const path2 = join190(contentDir2, "recipes", `${name}.json`);
|
|
269086
269177
|
if (!existsSync147(path2)) {
|
|
269087
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.`);
|
|
269088
269179
|
}
|
|
@@ -270530,7 +270621,7 @@ __export(validate_identity_exports, {
|
|
|
270530
270621
|
import { createHash as createHash93 } from "node:crypto";
|
|
270531
270622
|
import { existsSync as existsSync148, readFileSync as readFileSync175, writeFileSync as writeFileSync70 } from "node:fs";
|
|
270532
270623
|
import ts25 from "typescript";
|
|
270533
|
-
import { join as
|
|
270624
|
+
import { join as join191, resolve as resolve119 } from "node:path";
|
|
270534
270625
|
function ricosTexts(documentJson) {
|
|
270535
270626
|
let root;
|
|
270536
270627
|
try {
|
|
@@ -270614,7 +270705,7 @@ function fixAppName(configSource, slug, displayName3) {
|
|
|
270614
270705
|
}
|
|
270615
270706
|
function sourceIdentity(evidenceDir) {
|
|
270616
270707
|
const { manifest: manifest2, raw } = verifiedEvidence(evidenceDir);
|
|
270617
|
-
const bytes2 = readFileSync175(
|
|
270708
|
+
const bytes2 = readFileSync175(join191(evidenceDir, "business-context.json"));
|
|
270618
270709
|
const hash3 = createHash93("sha256").update(bytes2).digest("hex");
|
|
270619
270710
|
if (obj12(manifest2.sha256)["business-context.json"] !== hash3) throw Error("business-context.json differs from the collected evidence.");
|
|
270620
270711
|
const name = obj12(JSON.parse(bytes2.toString("utf8"))).displayName;
|
|
@@ -270633,7 +270724,7 @@ function sourceIdentity(evidenceDir) {
|
|
|
270633
270724
|
const settings = obj12(obj12(value2).settings);
|
|
270634
270725
|
for (const key4 of ["title", "subtitle", "label", "text", "description"]) copy(settings[key4]);
|
|
270635
270726
|
}
|
|
270636
|
-
const pagesPath =
|
|
270727
|
+
const pagesPath = join191(evidenceDir, "pages-content.json");
|
|
270637
270728
|
if (existsSync148(pagesPath)) {
|
|
270638
270729
|
const pagesBytes = readFileSync175(pagesPath);
|
|
270639
270730
|
if (obj12(manifest2.sha256)["pages-content.json"] !== createHash93("sha256").update(pagesBytes).digest("hex")) throw Error("pages-content.json differs from the collected evidence.");
|
|
@@ -270679,7 +270770,7 @@ async function runOneAppIdentityValidation(args, io2) {
|
|
|
270679
270770
|
const content = resolve119(values.get("--content"));
|
|
270680
270771
|
const slug = readContentManifest(content)?.name;
|
|
270681
270772
|
if (!isValidAppId(slug)) throw Error("A technical app slug is required in himalaya.content.json.");
|
|
270682
|
-
const configPath =
|
|
270773
|
+
const configPath = join191(content, "config.ts");
|
|
270683
270774
|
let appName2;
|
|
270684
270775
|
if (existsSync148(configPath)) {
|
|
270685
270776
|
const correction = fixAppName(readFileSync175(configPath, "utf8"), slug, identity.displayName);
|
|
@@ -270742,12 +270833,12 @@ var init_validate_identity = __esm({
|
|
|
270742
270833
|
|
|
270743
270834
|
// src/one-app/invite-flow.ts
|
|
270744
270835
|
import { existsSync as existsSync149, lstatSync as lstatSync39, readFileSync as readFileSync176, readdirSync as readdirSync61 } from "node:fs";
|
|
270745
|
-
import { join as
|
|
270836
|
+
import { join as join192 } from "node:path";
|
|
270746
270837
|
import ts26 from "typescript";
|
|
270747
270838
|
function assertNoSymlink(dir, rel2) {
|
|
270748
270839
|
let current = dir;
|
|
270749
270840
|
for (const part5 of rel2.split("/")) {
|
|
270750
|
-
current =
|
|
270841
|
+
current = join192(current, part5);
|
|
270751
270842
|
if (existsSync149(current) && lstatSync39(current).isSymbolicLink()) throw new Error(`${rel2} goes through a symlink (${part5}): refusing to read or write it`);
|
|
270752
270843
|
}
|
|
270753
270844
|
}
|
|
@@ -270802,14 +270893,14 @@ function inviteNavMount(businessId) {
|
|
|
270802
270893
|
].join("\n");
|
|
270803
270894
|
}
|
|
270804
270895
|
function l10nFiles(dir) {
|
|
270805
|
-
const l10n =
|
|
270896
|
+
const l10n = join192(dir, "l10n");
|
|
270806
270897
|
return existsSync149(l10n) ? readdirSync61(l10n).filter((name) => /^[a-z]{2,3}(-[A-Za-z0-9]+)?\.json$/.test(name)) : [];
|
|
270807
270898
|
}
|
|
270808
270899
|
function translateShareLabel(dir) {
|
|
270809
|
-
const l10n =
|
|
270900
|
+
const l10n = join192(dir, "l10n"), written = [];
|
|
270810
270901
|
for (const file2 of l10nFiles(dir)) {
|
|
270811
270902
|
const locale = file2.replace(/\.json$/, ""), translation = INVITE_SHARE_TRANSLATIONS[locale];
|
|
270812
|
-
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;
|
|
270813
270904
|
if (next === void 0) continue;
|
|
270814
270905
|
writeNoFollow(dir, `l10n/${file2}`, next);
|
|
270815
270906
|
written.push(locale);
|
|
@@ -270874,8 +270965,8 @@ function provisionInviteFlow(dir, facts, dryRun = false) {
|
|
|
270874
270965
|
const navRel = navName && BUNDLE_NAME.test(navName) ? `tier5-src/${navName}/index.ts` : void 0;
|
|
270875
270966
|
const workerRel = `tier5-src/${INVITE_BUNDLE}/index.ts`;
|
|
270876
270967
|
for (const rel2 of [workerRel, "config.ts", "dev/index.ts", ...navRel ? [navRel] : []]) assertNoSymlink(dir, rel2);
|
|
270877
|
-
const navSource = navRel && existsSync149(
|
|
270878
|
-
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));
|
|
270879
270970
|
const mounted = navSource?.includes(NAV_MARKER) === true;
|
|
270880
270971
|
const nav = navRel && navSource !== void 0 ? { rel: navRel, text: mounted ? navSource : `${navSource.replace(/\s*$/, "\n")}${inviteNavMount(businessId)}` } : void 0;
|
|
270881
270972
|
const wrote = ["dev/index.ts", "config.ts", ...workerExists ? [] : [workerRel], ...nav && !mounted ? [nav.rel] : []];
|
|
@@ -270883,7 +270974,7 @@ function provisionInviteFlow(dir, facts, dryRun = false) {
|
|
|
270883
270974
|
for (const file2 of l10nFiles(dir)) assertNoSymlink(dir, `l10n/${file2}`);
|
|
270884
270975
|
if (!workerExists) writeNoFollow(dir, workerRel, inviteWorkerSource(businessId));
|
|
270885
270976
|
if (nav && !mounted) writeNoFollow(dir, nav.rel, nav.text);
|
|
270886
|
-
const config = readFileSync176(
|
|
270977
|
+
const config = readFileSync176(join192(dir, "config.ts"), "utf8");
|
|
270887
270978
|
const next = nav ? withNavCapabilities(config) : void 0;
|
|
270888
270979
|
if (next !== void 0 && next !== config) writeNoFollow(dir, "config.ts", next);
|
|
270889
270980
|
for (const locale of translateShareLabel(dir)) wrote.push(`l10n/${locale}.json`);
|
|
@@ -270922,7 +271013,7 @@ var init_invite_flow = __esm({
|
|
|
270922
271013
|
|
|
270923
271014
|
// src/one-app/provision.ts
|
|
270924
271015
|
import { existsSync as existsSync150, readdirSync as readdirSync62, readFileSync as readFileSync177, writeFileSync as writeFileSync71 } from "node:fs";
|
|
270925
|
-
import { join as
|
|
271016
|
+
import { join as join193, resolve as resolve120 } from "node:path";
|
|
270926
271017
|
import ts27 from "typescript";
|
|
270927
271018
|
function rootOnAppear2(descriptor) {
|
|
270928
271019
|
const modifiers = obj13(obj13(descriptor.payload).modifiers);
|
|
@@ -270953,7 +271044,7 @@ function nativeTabBar(configSource) {
|
|
|
270953
271044
|
${" ".repeat(indent)}"presentation": "native",${configSource.slice(at2)}` };
|
|
270954
271045
|
}
|
|
270955
271046
|
function provisionTabBar(dir, dryRun = false) {
|
|
270956
|
-
const configPath =
|
|
271047
|
+
const configPath = join193(dir, "config.ts");
|
|
270957
271048
|
const result = existsSync150(configPath) ? nativeTabBar(readFileSync177(configPath, "utf8")) : void 0;
|
|
270958
271049
|
if (!result) return { status: "absent" };
|
|
270959
271050
|
if (!result.fixed) return { status: "unchanged", presentation: result.presentation };
|
|
@@ -270961,7 +271052,7 @@ function provisionTabBar(dir, dryRun = false) {
|
|
|
270961
271052
|
return { status: "set", presentation: "native" };
|
|
270962
271053
|
}
|
|
270963
271054
|
function provisionSiteBinding(dir, binding2, dryRun = false) {
|
|
270964
|
-
const configPath =
|
|
271055
|
+
const configPath = join193(dir, "config.ts");
|
|
270965
271056
|
if (!existsSync150(configPath)) return { status: "absent", reason: "no config.ts" };
|
|
270966
271057
|
if (!binding2.metaSiteId || !GUID2.test(binding2.metaSiteId) || !binding2.siteUrl) {
|
|
270967
271058
|
return { status: "unverified", reason: "the collection has no verified source site id and URL; the auth is left as it is" };
|
|
@@ -271064,7 +271155,7 @@ function provisionChatTarget(dir, memberChat, dryRun = false) {
|
|
|
271064
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" };
|
|
271065
271156
|
if (!doors.length) return { status: "unchanged" };
|
|
271066
271157
|
if (!dryRun) {
|
|
271067
|
-
if (config.fixed) writeFileSync71(
|
|
271158
|
+
if (config.fixed) writeFileSync71(join193(dir, "config.ts"), config.fixed, "utf8");
|
|
271068
271159
|
for (const id of screens) {
|
|
271069
271160
|
const route = parseApp(readAppSources(dir).dev, readAppSources(dir).config).routes.find((r3) => r3.kind === "screen" && r3.label === id);
|
|
271070
271161
|
const descriptor = parseEntry(readAppSources(dir).dev.slice(route.lineStart, route.end), id);
|
|
@@ -271108,7 +271199,7 @@ function provisionScreenNames(dir, displayName3, dryRun = false) {
|
|
|
271108
271199
|
}
|
|
271109
271200
|
function provisionAppName(dir, displayName3, dryRun = false) {
|
|
271110
271201
|
const slug = readContentManifest(dir)?.name;
|
|
271111
|
-
const configPath =
|
|
271202
|
+
const configPath = join193(dir, "config.ts");
|
|
271112
271203
|
if (!displayName3?.trim()) return { status: "unverified", reason: "the collection has no business display name; config.ts keeps its name" };
|
|
271113
271204
|
if (typeof slug !== "string" || !existsSync150(configPath)) return { status: "unverified", reason: "no app slug in himalaya.content.json or no config.ts to rename" };
|
|
271114
271205
|
const correction = fixAppName(readFileSync177(configPath, "utf8"), slug, displayName3);
|
|
@@ -271146,17 +271237,17 @@ function applyScreenParams(dir, screenId, params, dryRun = false, remove = []) {
|
|
|
271146
271237
|
return "set";
|
|
271147
271238
|
}
|
|
271148
271239
|
function provisionInviteDrawer(dir, showsInvite, dryRun = false, flowPlanned = false) {
|
|
271149
|
-
const configPath =
|
|
271240
|
+
const configPath = join193(dir, "config.ts");
|
|
271150
271241
|
if (!existsSync150(configPath)) return { status: "absent", reason: "no config.ts to add the Invite row to" };
|
|
271151
271242
|
const result = applyInviteDrawer(readFileSync177(configPath, "utf8"), showsInvite, flowPlanned);
|
|
271152
271243
|
const translated2 = [];
|
|
271153
271244
|
if (result.rowPresent) {
|
|
271154
|
-
const l10n =
|
|
271245
|
+
const l10n = join193(dir, "l10n");
|
|
271155
271246
|
for (const file2 of existsSync150(l10n) ? readdirSync62(l10n).filter((name) => /^[a-z]{2,3}(-[A-Za-z0-9]+)?\.json$/.test(name)) : []) {
|
|
271156
|
-
const next = withInviteTranslation(readFileSync177(
|
|
271247
|
+
const next = withInviteTranslation(readFileSync177(join193(l10n, file2), "utf8"), file2.replace(/\.json$/, ""));
|
|
271157
271248
|
if (next === void 0) continue;
|
|
271158
271249
|
translated2.push(file2.replace(/\.json$/, ""));
|
|
271159
|
-
if (!dryRun) writeFileSync71(
|
|
271250
|
+
if (!dryRun) writeFileSync71(join193(l10n, file2), next, "utf8");
|
|
271160
271251
|
}
|
|
271161
271252
|
if (result.status === "set" && !dryRun) writeFileSync71(configPath, result.text, "utf8");
|
|
271162
271253
|
}
|
|
@@ -271293,7 +271384,7 @@ var init_provision = __esm({
|
|
|
271293
271384
|
|
|
271294
271385
|
// src/one-app/apply-navigation.ts
|
|
271295
271386
|
import { existsSync as existsSync151, readFileSync as readFileSync178 } from "node:fs";
|
|
271296
|
-
import { join as
|
|
271387
|
+
import { join as join194 } from "node:path";
|
|
271297
271388
|
import ts28 from "typescript";
|
|
271298
271389
|
function pagesWithoutScreen(plan, planned2) {
|
|
271299
271390
|
const have = new Map((plan.pages ?? []).map((page) => [page.layoutItemId, page]));
|
|
@@ -271392,7 +271483,7 @@ function stringOf(node3) {
|
|
|
271392
271483
|
}
|
|
271393
271484
|
function definedScreens(contentDir2) {
|
|
271394
271485
|
try {
|
|
271395
|
-
const manifest2 = JSON.parse(readFileSync178(
|
|
271486
|
+
const manifest2 = JSON.parse(readFileSync178(join194(contentDir2, "himalaya.content.json"), "utf8"));
|
|
271396
271487
|
return new Set(Object.keys(manifest2.screens ?? {}));
|
|
271397
271488
|
} catch {
|
|
271398
271489
|
return void 0;
|
|
@@ -271428,7 +271519,7 @@ async function runOneAppApplyNavigation(args, io2) {
|
|
|
271428
271519
|
return 2;
|
|
271429
271520
|
}
|
|
271430
271521
|
const contentDir2 = options2.contentDir;
|
|
271431
|
-
const tabsPath = options2.tabs ?? tabsFileOf(
|
|
271522
|
+
const tabsPath = options2.tabs ?? tabsFileOf(join194(options2.evidenceDir, "gen", "screens.json"));
|
|
271432
271523
|
let plan;
|
|
271433
271524
|
try {
|
|
271434
271525
|
plan = JSON.parse(readFileSync178(tabsPath, "utf8"));
|
|
@@ -271467,7 +271558,7 @@ async function runOneAppApplyNavigation(args, io2) {
|
|
|
271467
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."
|
|
271468
271559
|
});
|
|
271469
271560
|
}
|
|
271470
|
-
const configPath =
|
|
271561
|
+
const configPath = join194(contentDir2, "config.ts");
|
|
271471
271562
|
if (!existsSync151(configPath)) return report6(io2, false, { code: "content_invalid", error: `${configPath} not found.` });
|
|
271472
271563
|
const edit = applyNavigationToConfig(readFileSync178(configPath, "utf8"), plan);
|
|
271473
271564
|
if (edit.status === "kept") return report6(io2, false, { code: "config_unwritable", error: edit.reason, tabs: plan.tabs });
|
|
@@ -271531,7 +271622,7 @@ var init_apply_navigation = __esm({
|
|
|
271531
271622
|
|
|
271532
271623
|
// src/one-app/starter-keep-list.ts
|
|
271533
271624
|
import { existsSync as existsSync152, readFileSync as readFileSync179, writeFileSync as writeFileSync72 } from "node:fs";
|
|
271534
|
-
import { join as
|
|
271625
|
+
import { join as join195 } from "node:path";
|
|
271535
271626
|
import ts29 from "typescript";
|
|
271536
271627
|
function screensOpenedBy(node3, found = /* @__PURE__ */ new Set()) {
|
|
271537
271628
|
if (Array.isArray(node3)) {
|
|
@@ -271567,7 +271658,7 @@ function seedKeepList(facts) {
|
|
|
271567
271658
|
}
|
|
271568
271659
|
function loadStarter(dir) {
|
|
271569
271660
|
try {
|
|
271570
|
-
const dev = readFileSync179(
|
|
271661
|
+
const dev = readFileSync179(join195(dir, "dev", "index.ts"), "utf8"), config = readFileSync179(join195(dir, "config.ts"), "utf8");
|
|
271571
271662
|
const workers = listWorkers(dir);
|
|
271572
271663
|
return { sources: { dev, config, workerDirs: workers.dirs, workerFiles: workers.files }, app: parseApp(dev, config), moduleTargets: /* @__PURE__ */ new Map() };
|
|
271573
271664
|
} catch (error) {
|
|
@@ -271760,7 +271851,7 @@ function workerOpenedScreens(dir, workerSources) {
|
|
|
271760
271851
|
return runtimeTargets(starter, workerSources).map((id) => ({ id, why: MODULE_NOTE }));
|
|
271761
271852
|
}
|
|
271762
271853
|
function writeStarterKeepList(contentDir2, facts) {
|
|
271763
|
-
const path2 =
|
|
271854
|
+
const path2 = join195(contentDir2, "SPEC.md");
|
|
271764
271855
|
const created = !existsSync152(path2);
|
|
271765
271856
|
const starter = loadStarter(contentDir2);
|
|
271766
271857
|
const template = facts.template.flatMap((id) => facts.generated.includes(id) || !starter ? [id] : routeLabel(starter.app, id) ?? []);
|
|
@@ -271799,14 +271890,14 @@ var init_starter_keep_list = __esm({
|
|
|
271799
271890
|
|
|
271800
271891
|
// src/one-app/generate-cli.ts
|
|
271801
271892
|
import { existsSync as existsSync153, mkdirSync as mkdirSync66, readdirSync as readdirSync63, readFileSync as readFileSync180, rmSync as rmSync45, writeFileSync as writeFileSync73 } from "node:fs";
|
|
271802
|
-
import { dirname as dirname85, join as
|
|
271893
|
+
import { dirname as dirname85, join as join196, resolve as resolve121 } from "node:path";
|
|
271803
271894
|
function removeStaleGeneratedWorkers(contentDir2, current) {
|
|
271804
|
-
const root =
|
|
271895
|
+
const root = join196(contentDir2, "tier5-src");
|
|
271805
271896
|
if (!existsSync153(root)) return;
|
|
271806
271897
|
for (const name of readdirSync63(root)) {
|
|
271807
271898
|
if (current.has(name) || name === "_shared") continue;
|
|
271808
|
-
const index =
|
|
271809
|
-
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 });
|
|
271810
271901
|
}
|
|
271811
271902
|
}
|
|
271812
271903
|
function parseArgs5(args) {
|
|
@@ -271828,7 +271919,7 @@ function parseArgs5(args) {
|
|
|
271828
271919
|
}
|
|
271829
271920
|
}
|
|
271830
271921
|
if (!evidenceDir || !contentDir2) throw new Error("Both --evidence-dir and --content are required.");
|
|
271831
|
-
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")) };
|
|
271832
271923
|
}
|
|
271833
271924
|
function claimedHome(out2) {
|
|
271834
271925
|
try {
|
|
@@ -271878,7 +271969,7 @@ async function runOneAppGenerate(args, io2) {
|
|
|
271878
271969
|
}
|
|
271879
271970
|
const fetchedAt = (() => {
|
|
271880
271971
|
try {
|
|
271881
|
-
const m2 = JSON.parse(readFileSync180(
|
|
271972
|
+
const m2 = JSON.parse(readFileSync180(join196(options2.evidenceDir, "manifest.json"), "utf8"));
|
|
271882
271973
|
return typeof m2.source?.fetchedAt === "string" ? m2.source.fetchedAt : void 0;
|
|
271883
271974
|
} catch {
|
|
271884
271975
|
return void 0;
|
|
@@ -271888,7 +271979,7 @@ async function runOneAppGenerate(args, io2) {
|
|
|
271888
271979
|
let homeScreenId;
|
|
271889
271980
|
const previousIds = previousOutput(options2.out);
|
|
271890
271981
|
try {
|
|
271891
|
-
const manifest2 = JSON.parse(readFileSync180(
|
|
271982
|
+
const manifest2 = JSON.parse(readFileSync180(join196(options2.contentDir, "himalaya.content.json"), "utf8"));
|
|
271892
271983
|
taken2 = new Set(Object.keys(manifest2.screens ?? {}));
|
|
271893
271984
|
if (taken2.has(TEMPLATE_HOME_SCREEN) && (!previousIds.includes(TEMPLATE_HOME_SCREEN) || claimedHome(options2.out))) homeScreenId = TEMPLATE_HOME_SCREEN;
|
|
271894
271985
|
for (const id of previousIds) taken2.delete(id);
|
|
@@ -271897,7 +271988,7 @@ async function runOneAppGenerate(args, io2) {
|
|
|
271897
271988
|
}
|
|
271898
271989
|
let result;
|
|
271899
271990
|
try {
|
|
271900
|
-
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`)) });
|
|
271901
271992
|
} catch (error) {
|
|
271902
271993
|
if (error instanceof RecipeError) return report7(io2, false, { code: "recipe_unavailable", error: error.message });
|
|
271903
271994
|
throw error;
|
|
@@ -271912,9 +272003,9 @@ async function runOneAppGenerate(args, io2) {
|
|
|
271912
272003
|
if (tabs) writeFileSync73(tabsPath, JSON.stringify(tabs, null, 2) + "\n", "utf8");
|
|
271913
272004
|
else rmSync45(tabsPath, { force: true });
|
|
271914
272005
|
for (const worker of Object.values(result.workers)) {
|
|
271915
|
-
const dir =
|
|
272006
|
+
const dir = join196(options2.contentDir, "tier5-src", worker.bundle);
|
|
271916
272007
|
mkdirSync66(dir, { recursive: true });
|
|
271917
|
-
writeFileSync73(
|
|
272008
|
+
writeFileSync73(join196(dir, "index.ts"), worker.source, "utf8");
|
|
271918
272009
|
}
|
|
271919
272010
|
removeStaleGeneratedWorkers(options2.contentDir, new Set(Object.values(result.workers).map((w2) => w2.bundle)));
|
|
271920
272011
|
} catch (error) {
|
|
@@ -271956,7 +272047,7 @@ async function runOneAppGenerate(args, io2) {
|
|
|
271956
272047
|
}
|
|
271957
272048
|
let keepList;
|
|
271958
272049
|
try {
|
|
271959
|
-
const manifest2 = JSON.parse(readFileSync180(
|
|
272050
|
+
const manifest2 = JSON.parse(readFileSync180(join196(options2.evidenceDir, "manifest.json"), "utf8"));
|
|
271960
272051
|
const badgePlan = readHashedEvidenceJson(options2.evidenceDir, "header-badge-plan.json");
|
|
271961
272052
|
const generated = Object.keys(result.screens);
|
|
271962
272053
|
const routed = result.routes.flatMap((route) => route.kind === "template" && route.screenId ? [route.screenId] : []);
|
|
@@ -272483,7 +272574,7 @@ ${indent}`);
|
|
|
272483
272574
|
// src/one-app/access-cli.ts
|
|
272484
272575
|
import { createHash as createHash95 } from "node:crypto";
|
|
272485
272576
|
import { existsSync as existsSync154, readFileSync as readFileSync181, rmSync as rmSync46, statSync as statSync48, writeFileSync as writeFileSync74 } from "node:fs";
|
|
272486
|
-
import { join as
|
|
272577
|
+
import { join as join197, resolve as resolve122 } from "node:path";
|
|
272487
272578
|
function parseArgs6(args) {
|
|
272488
272579
|
let evidenceDir;
|
|
272489
272580
|
let contentDir2;
|
|
@@ -272571,7 +272662,7 @@ function report8(io2, ok5, body) {
|
|
|
272571
272662
|
function businessTitleOf(evidenceDir, given) {
|
|
272572
272663
|
if (given) return given;
|
|
272573
272664
|
try {
|
|
272574
|
-
const context = JSON.parse(readFileSync181(
|
|
272665
|
+
const context = JSON.parse(readFileSync181(join197(evidenceDir, "business-context.json"), "utf8"));
|
|
272575
272666
|
if (typeof context.displayName === "string" && context.displayName.trim()) return context.displayName.trim();
|
|
272576
272667
|
} catch {
|
|
272577
272668
|
}
|
|
@@ -272614,10 +272705,10 @@ function mapCoverage2(options2, plan, raw) {
|
|
|
272614
272705
|
return { mapped, kept, conflicts, text: mapped ? JSON.stringify(coverage2, null, 2) + "\n" : void 0 };
|
|
272615
272706
|
}
|
|
272616
272707
|
function recordedLoginPolicy(evidenceDir) {
|
|
272617
|
-
const manifest2 = JSON.parse(readFileSync181(
|
|
272708
|
+
const manifest2 = JSON.parse(readFileSync181(join197(evidenceDir, "manifest.json"), "utf8"));
|
|
272618
272709
|
const expected = manifest2.sha256?.["access-policy.json"];
|
|
272619
272710
|
if (expected === void 0) return void 0;
|
|
272620
|
-
const bytes2 = readFileSync181(
|
|
272711
|
+
const bytes2 = readFileSync181(join197(evidenceDir, "access-policy.json"));
|
|
272621
272712
|
if (createHash95("sha256").update(bytes2).digest("hex") !== expected) throw new Error("access-policy.json does not match the hash recorded in manifest.json.");
|
|
272622
272713
|
const value2 = JSON.parse(bytes2.toString("utf8")).visitorModeEnabled;
|
|
272623
272714
|
return typeof value2 === "boolean" ? value2 : void 0;
|
|
@@ -272643,7 +272734,7 @@ async function runOneAppAccess(args, io2) {
|
|
|
272643
272734
|
let unverifiedPlatforms;
|
|
272644
272735
|
let raw;
|
|
272645
272736
|
let recorded;
|
|
272646
|
-
const tablePath =
|
|
272737
|
+
const tablePath = join197(options2.contentDir, "tier5-src", "_shared", "access-gates-table.ts");
|
|
272647
272738
|
const tableBefore = existsSync154(tablePath) ? readFileSync181(tablePath, "utf8") : void 0;
|
|
272648
272739
|
const writtenGates = tableBefore === void 0 ? [] : tableGates(tableBefore);
|
|
272649
272740
|
const written = writtenGates ?? [];
|
|
@@ -272659,10 +272750,10 @@ async function runOneAppAccess(args, io2) {
|
|
|
272659
272750
|
}
|
|
272660
272751
|
const common2 = { unmapped: plan.unmapped, warnings: plan.warnings, ...unverifiedPlatforms.length ? { unverifiedPlatforms } : {} };
|
|
272661
272752
|
const decision = loginWallOf(options2, recorded);
|
|
272662
|
-
const configPath =
|
|
272663
|
-
const screensPath =
|
|
272664
|
-
const enginePath =
|
|
272665
|
-
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");
|
|
272666
272757
|
let configText;
|
|
272667
272758
|
let screensText;
|
|
272668
272759
|
try {
|
|
@@ -272792,7 +272883,7 @@ async function runOneAppAccess(args, io2) {
|
|
|
272792
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 });
|
|
272793
272884
|
}
|
|
272794
272885
|
if (!options2.dryRun) {
|
|
272795
|
-
const ledgerPath =
|
|
272886
|
+
const ledgerPath = join197(options2.contentDir, COVERAGE_FILE);
|
|
272796
272887
|
const writes = [
|
|
272797
272888
|
...hasGates ? [{ path: tablePath, before: tableBefore, after: table }] : [],
|
|
272798
272889
|
{ path: configPath, before: configText, after: nextConfig },
|
|
@@ -272887,7 +272978,7 @@ var init_access_policy = __esm({
|
|
|
272887
272978
|
|
|
272888
272979
|
// src/one-app/payment-review.ts
|
|
272889
272980
|
import { readFileSync as readFileSync182 } from "node:fs";
|
|
272890
|
-
import { join as
|
|
272981
|
+
import { join as join198, resolve as resolve123 } from "node:path";
|
|
272891
272982
|
function preservesUnverifiedFlow(flow) {
|
|
272892
272983
|
const checkout = obj15(flow.checkout);
|
|
272893
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");
|
|
@@ -272976,7 +273067,7 @@ function runPaymentReview(args, io2) {
|
|
|
272976
273067
|
const { manifest: manifest2 } = verifiedEvidence(evidenceDir);
|
|
272977
273068
|
const metaSiteId = obj15(manifest2.source).metaSiteId;
|
|
272978
273069
|
if (typeof metaSiteId !== "string") throw Error("Missing site binding");
|
|
272979
|
-
const review = JSON.parse(readFileSync182(
|
|
273070
|
+
const review = JSON.parse(readFileSync182(join198(evidenceDir, "payment-review.json"), "utf8"));
|
|
272980
273071
|
const issues = paymentReviewIssues(review, metaSiteId);
|
|
272981
273072
|
if (issues.length) return fail16("payment_decision_required", issues, 1);
|
|
272982
273073
|
const warnings = obj15(review).flows.map(obj15).filter(preservesUnverifiedFlow).map((flow) => ({
|
|
@@ -273232,7 +273323,7 @@ __export(cli_exports2, {
|
|
|
273232
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";
|
|
273233
273324
|
import { createHash as createHash96 } from "node:crypto";
|
|
273234
273325
|
import { isIP as isIP2 } from "node:net";
|
|
273235
|
-
import { dirname as dirname86, join as
|
|
273326
|
+
import { dirname as dirname86, join as join199, parse as parse11, resolve as resolve124 } from "node:path";
|
|
273236
273327
|
function nativeSiteHost(host) {
|
|
273237
273328
|
if (isIP2(host.startsWith("[") ? host.slice(1, -1) : host)) return true;
|
|
273238
273329
|
const labels = host.replace(/\.$/, "").split(".");
|
|
@@ -273319,7 +273410,7 @@ function readOptions(argv, cwd, commandIncluded) {
|
|
|
273319
273410
|
throw new OneAppError("invalid_output_path", "Pass a parent directory with --dir.");
|
|
273320
273411
|
}
|
|
273321
273412
|
const parentDir = resolve124(cwd, flags.dir ?? ".");
|
|
273322
|
-
const workspace =
|
|
273413
|
+
const workspace = join199(parentDir, name);
|
|
273323
273414
|
assertSafeParents(parentDir);
|
|
273324
273415
|
if (pathExists(workspace)) throw new OneAppError("output_exists", "The destination already exists. Choose a new --name or --dir.");
|
|
273325
273416
|
return { metaSiteId, appInstance, locale, languages, prompt: prompt2, name, parentDir, workspace, target, topTabs };
|
|
@@ -273441,7 +273532,7 @@ validate-payments checks site-bound payment evidence and explicit paid-flow deci
|
|
|
273441
273532
|
const hashes = {};
|
|
273442
273533
|
const diskWrite = deps.writeFile ?? writePrivate;
|
|
273443
273534
|
const put = (name, content) => {
|
|
273444
|
-
const path2 =
|
|
273535
|
+
const path2 = join199(evidenceDir, name);
|
|
273445
273536
|
try {
|
|
273446
273537
|
assertSafeParents(evidenceDir);
|
|
273447
273538
|
diskWrite(path2, content, false);
|
|
@@ -273457,7 +273548,7 @@ validate-payments checks site-bound payment evidence and explicit paid-flow deci
|
|
|
273457
273548
|
if (!evidenceDir) return;
|
|
273458
273549
|
try {
|
|
273459
273550
|
assertSafeParents(evidenceDir);
|
|
273460
|
-
diskWrite(
|
|
273551
|
+
diskWrite(join199(evidenceDir, "progress.jsonl"), JSON.stringify({ stage, at: now() }) + "\n", true);
|
|
273461
273552
|
} catch {
|
|
273462
273553
|
throw new OneAppError("artifact_write_failed", "Could not record migration progress. Existing files were kept.", { stage });
|
|
273463
273554
|
}
|
|
@@ -273478,7 +273569,7 @@ validate-payments checks site-bound payment evidence and explicit paid-flow deci
|
|
|
273478
273569
|
assertSafeParents(options2.parentDir);
|
|
273479
273570
|
mkdirSync67(options2.workspace, { mode: 448 });
|
|
273480
273571
|
if (realpathSync23(options2.workspace) !== options2.workspace) throw new Error("destination changed");
|
|
273481
|
-
evidenceDir =
|
|
273572
|
+
evidenceDir = join199(options2.workspace, ".himi", "one-app");
|
|
273482
273573
|
mkdirSync67(evidenceDir, { recursive: true, mode: 448 });
|
|
273483
273574
|
} catch (error) {
|
|
273484
273575
|
if (error.code === "EEXIST") {
|
|
@@ -275610,11 +275701,11 @@ var init_analyze2 = __esm({
|
|
|
275610
275701
|
|
|
275611
275702
|
// src/site-analyze/site-pages-apply.ts
|
|
275612
275703
|
import { existsSync as existsSync155, readFileSync as readFileSync184 } from "node:fs";
|
|
275613
|
-
import { join as
|
|
275704
|
+
import { join as join200 } from "node:path";
|
|
275614
275705
|
import ts31 from "typescript";
|
|
275615
275706
|
function packageScreenIds(dir) {
|
|
275616
|
-
const dev =
|
|
275617
|
-
const config =
|
|
275707
|
+
const dev = join200(dir, "dev", "index.ts");
|
|
275708
|
+
const config = join200(dir, "config.ts");
|
|
275618
275709
|
if (!existsSync155(dev) || !existsSync155(config)) return void 0;
|
|
275619
275710
|
try {
|
|
275620
275711
|
const app2 = parseApp(readFileSync184(dev, "utf8"), readFileSync184(config, "utf8"));
|
|
@@ -275666,8 +275757,8 @@ ${indent}`);
|
|
|
275666
275757
|
}
|
|
275667
275758
|
function applySitePagesToPackage(dir, site, opts = {}) {
|
|
275668
275759
|
const none = (refused2) => ({ added: [], replaced: [], removed: [], rows: [], wrote: [], refused: refused2 });
|
|
275669
|
-
const devPath =
|
|
275670
|
-
const configPath =
|
|
275760
|
+
const devPath = join200(dir, "dev", "index.ts");
|
|
275761
|
+
const configPath = join200(dir, "config.ts");
|
|
275671
275762
|
if (!existsSync155(devPath) || !existsSync155(configPath)) return none("the package has no dev/index.ts + config.ts to add website pages to");
|
|
275672
275763
|
let existing;
|
|
275673
275764
|
try {
|
|
@@ -275684,7 +275775,7 @@ function applySitePagesToPackage(dir, site, opts = {}) {
|
|
|
275684
275775
|
const probe2 = spliceWebsiteDrawer(readFileSync184(configPath, "utf8"), site);
|
|
275685
275776
|
if ("refused" in probe2) return none(probe2.refused);
|
|
275686
275777
|
if (opts.dryRun) return { added, replaced, removed, rows: probe2.rows, wrote: [] };
|
|
275687
|
-
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]));
|
|
275688
275779
|
try {
|
|
275689
275780
|
if (removed.length) removeScreens(dir, removed);
|
|
275690
275781
|
if (wanted.length) upsertScreens(dir, screens);
|
|
@@ -275692,10 +275783,10 @@ function applySitePagesToPackage(dir, site, opts = {}) {
|
|
|
275692
275783
|
if ("refused" in spliced) throw new TrimRefusal(spliced.refused);
|
|
275693
275784
|
if (spliced.source !== readFileSync184(configPath, "utf8")) writeFileAtomic(configPath, spliced.source);
|
|
275694
275785
|
} catch (e2) {
|
|
275695
|
-
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);
|
|
275696
275787
|
return none(`stopped and restored every file: ${e2.message}`);
|
|
275697
275788
|
}
|
|
275698
|
-
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));
|
|
275699
275790
|
return { added, replaced, removed, rows: probe2.rows, wrote };
|
|
275700
275791
|
}
|
|
275701
275792
|
var ANCHOR_ROWS;
|
|
@@ -275725,7 +275816,7 @@ var init_customer_build = __esm({
|
|
|
275725
275816
|
|
|
275726
275817
|
// src/site-analyze/apply.ts
|
|
275727
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";
|
|
275728
|
-
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";
|
|
275729
275820
|
import { spawnSync as spawnSync13 } from "node:child_process";
|
|
275730
275821
|
function inRepoBakeRefusal(repoRoot2, shell) {
|
|
275731
275822
|
if (isBrandable(repoRoot2, shell)) return null;
|
|
@@ -276022,12 +276113,12 @@ function sameKnownSite(previous, next) {
|
|
|
276022
276113
|
}
|
|
276023
276114
|
function buildMergedContract(options2) {
|
|
276024
276115
|
const { appDir: appDir3, packageDir, overlay } = options2;
|
|
276025
|
-
const committedPath =
|
|
276116
|
+
const committedPath = join201(appDir3, "provisioning.json");
|
|
276026
276117
|
if (!existsSync156(committedPath)) {
|
|
276027
276118
|
throw new Error(`shell has no committed provisioning.json at ${committedPath} to build a contract from`);
|
|
276028
276119
|
}
|
|
276029
276120
|
const committed = JSON.parse(readFileSync185(committedPath, "utf8"));
|
|
276030
|
-
const previousPath =
|
|
276121
|
+
const previousPath = join201(appDir3, LOCAL_CONTRACT_REL);
|
|
276031
276122
|
let evidenceOverlay = overlay;
|
|
276032
276123
|
if ((overlay.businessContact === void 0 || overlay.loyalty === void 0 || overlay.businessTimeZone === void 0) && existsSync156(previousPath)) {
|
|
276033
276124
|
try {
|
|
@@ -276065,7 +276156,7 @@ function buildMergedContract(options2) {
|
|
|
276065
276156
|
};
|
|
276066
276157
|
const stage = (fromRel, toRel) => {
|
|
276067
276158
|
const from = contained(packageDir, fromRel);
|
|
276068
|
-
const to2 = contained(
|
|
276159
|
+
const to2 = contained(join201(appDir3, STAGED), toRel.slice(STAGED.length + 1));
|
|
276069
276160
|
if (!from || !to2 || !existsSync156(from)) return void 0;
|
|
276070
276161
|
let real;
|
|
276071
276162
|
let realRoot;
|
|
@@ -276088,7 +276179,7 @@ function buildMergedContract(options2) {
|
|
|
276088
276179
|
};
|
|
276089
276180
|
const icon = stage("media/icon.png", `${STAGED}/icon.png`);
|
|
276090
276181
|
if (icon) branding.appIconPath = icon;
|
|
276091
|
-
const facesPath =
|
|
276182
|
+
const facesPath = join201(packageDir, "media/fonts/faces.json");
|
|
276092
276183
|
if (existsSync156(facesPath)) {
|
|
276093
276184
|
let faces = [];
|
|
276094
276185
|
try {
|
|
@@ -276113,9 +276204,9 @@ function buildMergedContract(options2) {
|
|
|
276113
276204
|
merged.branding = branding;
|
|
276114
276205
|
const body = `${JSON.stringify(merged, null, 2)}
|
|
276115
276206
|
`;
|
|
276116
|
-
const path2 =
|
|
276207
|
+
const path2 = join201(packageDir, "provisioning.contract.json");
|
|
276117
276208
|
writeFileSync76(path2, body);
|
|
276118
|
-
const localPath2 =
|
|
276209
|
+
const localPath2 = join201(appDir3, LOCAL_CONTRACT_REL);
|
|
276119
276210
|
mkdirSync68(dirname87(localPath2), { recursive: true });
|
|
276120
276211
|
writeFileSync76(localPath2, body);
|
|
276121
276212
|
staged.push(localPath2);
|
|
@@ -276150,7 +276241,7 @@ function catalogTypography(overlay, template) {
|
|
|
276150
276241
|
function staticFaqFor(overlay, overlayPath) {
|
|
276151
276242
|
const own6 = overlay.faq;
|
|
276152
276243
|
if (own6 !== void 0) return deriveStaticFaq(own6);
|
|
276153
|
-
const bookPath =
|
|
276244
|
+
const bookPath = join201(dirname87(resolve125(overlayPath)), "book.json");
|
|
276154
276245
|
if (!existsSync156(bookPath)) return void 0;
|
|
276155
276246
|
try {
|
|
276156
276247
|
const book = JSON.parse(readFileSync185(bookPath, "utf8"));
|
|
@@ -276167,7 +276258,7 @@ function staticGalleriesFor(overlay, overlayPath) {
|
|
|
276167
276258
|
if (overlay.galleries !== void 0) return deriveStaticGalleries(
|
|
276168
276259
|
overlay.galleries.map((gallery) => ({ role: "gallery", title: gallery.title, galleryImageUrls: gallery.photos }))
|
|
276169
276260
|
);
|
|
276170
|
-
const bookPath =
|
|
276261
|
+
const bookPath = join201(dirname87(resolve125(overlayPath)), "book.json");
|
|
276171
276262
|
if (!existsSync156(bookPath)) return void 0;
|
|
276172
276263
|
try {
|
|
276173
276264
|
const book = JSON.parse(readFileSync185(bookPath, "utf8"));
|
|
@@ -276203,15 +276294,15 @@ async function applyOverlays(input) {
|
|
|
276203
276294
|
if (repoRoot2) {
|
|
276204
276295
|
const bakeRefusal = inRepoBakeRefusal(repoRoot2, shell);
|
|
276205
276296
|
if (bakeRefusal) throw Object.assign(new Error(bakeRefusal), { exit: 2, code: APPLY_SHELL_CANNOT_BAKE });
|
|
276206
|
-
const appDir3 =
|
|
276207
|
-
assertOverlayNamesSite(
|
|
276297
|
+
const appDir3 = join201(repoRoot2, shellAppDir(shell));
|
|
276298
|
+
assertOverlayNamesSite(join201(appDir3, "provisioning.json"), overlay, `shell "${shell}"`, ` --shell ${shell}`);
|
|
276208
276299
|
const packageDir = dirname87(resolve125(input.overlayPath));
|
|
276209
276300
|
if (input.dryRun) {
|
|
276210
276301
|
return {
|
|
276211
276302
|
mode: "dry",
|
|
276212
276303
|
target: "in-repo",
|
|
276213
276304
|
wrote: [],
|
|
276214
|
-
wouldWrite: [
|
|
276305
|
+
wouldWrite: [join201(packageDir, "provisioning.contract.json"), join201(appDir3, LOCAL_CONTRACT_REL), `${appDir3} (npm run prepare:customer)`],
|
|
276215
276306
|
note: [planNote, "dry run: nothing written \u2014 without --dry-run this merges the contract and runs prepare:customer"].filter(Boolean).join(" \xB7 "),
|
|
276216
276307
|
...sitePagesOut()
|
|
276217
276308
|
};
|
|
@@ -276240,7 +276331,7 @@ async function applyOverlays(input) {
|
|
|
276240
276331
|
note: `${planNote ? `${planNote} \xB7 ` : ""}prepare:customer --contract with a merged contract (committed provisioning.json untouched)${unpairedInRepo ? ` \xB7 ${unpairedInRepo}` : ""}${mergeNote}`
|
|
276241
276332
|
};
|
|
276242
276333
|
}
|
|
276243
|
-
const pkgProv =
|
|
276334
|
+
const pkgProv = join201(cwd, "provisioning.json");
|
|
276244
276335
|
assertNotCommitted(pkgProv, input.forbiddenProvisioning);
|
|
276245
276336
|
assertOverlayNamesSite(pkgProv, overlay, "this content package", "");
|
|
276246
276337
|
if (input.dryRun) {
|
|
@@ -276253,16 +276344,16 @@ async function applyOverlays(input) {
|
|
|
276253
276344
|
wrote: [],
|
|
276254
276345
|
wouldWrite: [
|
|
276255
276346
|
pkgProv,
|
|
276256
|
-
...existsSync156(
|
|
276257
|
-
...existsSync156(
|
|
276258
|
-
...touchesPackage ? [
|
|
276259
|
-
...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")] : []
|
|
276260
276351
|
],
|
|
276261
276352
|
note: [planNote, pages2?.refused ? `website pages not added: ${pages2.refused}` : void 0, "dry run: nothing written"].filter(Boolean).join(" \xB7 "),
|
|
276262
276353
|
...sitePagesOut(screens)
|
|
276263
276354
|
};
|
|
276264
276355
|
}
|
|
276265
|
-
const contentPath =
|
|
276356
|
+
const contentPath = join201(cwd, "himalaya.content.json");
|
|
276266
276357
|
const syncViewNames = (before, after) => {
|
|
276267
276358
|
const content = readContentManifest(cwd);
|
|
276268
276359
|
if (!content) return;
|
|
@@ -276310,7 +276401,7 @@ async function applyOverlays(input) {
|
|
|
276310
276401
|
if (Array.isArray(packageGalleries) && packageGalleries.length && !overlay.installedVerticals.includes("galleries")) {
|
|
276311
276402
|
overlay.installedVerticals.push("galleries");
|
|
276312
276403
|
}
|
|
276313
|
-
const pkgTokens =
|
|
276404
|
+
const pkgTokens = join201(cwd, "tokens.json");
|
|
276314
276405
|
if (existsSync156(pkgTokens) && (tokens2.colors || tokens2.typography)) {
|
|
276315
276406
|
const cur = JSON.parse(readFileSync185(pkgTokens, "utf8"));
|
|
276316
276407
|
let tokensIn = tokens2;
|
|
@@ -276337,7 +276428,7 @@ async function applyOverlays(input) {
|
|
|
276337
276428
|
wrote.push(pkgTokens);
|
|
276338
276429
|
}
|
|
276339
276430
|
const homeAction = homeRefreshActionId(shell);
|
|
276340
|
-
const homeSrc =
|
|
276431
|
+
const homeSrc = join201(cwd, "dev/index.ts");
|
|
276341
276432
|
if (homeAction && existsSync156(homeSrc)) {
|
|
276342
276433
|
const prev = readFileSync185(homeSrc, "utf8");
|
|
276343
276434
|
const patched = patchBrandParams(prev, overlay, homeAction);
|
|
@@ -279034,14 +279125,14 @@ __export(capture_exports, {
|
|
|
279034
279125
|
variantWidth: () => variantWidth
|
|
279035
279126
|
});
|
|
279036
279127
|
import { existsSync as existsSync159, mkdirSync as mkdirSync69, rmSync as rmSync47, writeFileSync as writeFileSync78 } from "node:fs";
|
|
279037
|
-
import { join as
|
|
279128
|
+
import { join as join202 } from "node:path";
|
|
279038
279129
|
import { pathToFileURL as pathToFileURL12 } from "node:url";
|
|
279039
279130
|
function variantWidth(variant) {
|
|
279040
279131
|
return variant === "tablet" ? renderDeviceWidths().tablet : PHONE_WIDTH;
|
|
279041
279132
|
}
|
|
279042
279133
|
function frameFile(outDir, screen, variant, surface) {
|
|
279043
279134
|
mkdirSync69(outDir, { recursive: true });
|
|
279044
|
-
return
|
|
279135
|
+
return join202(outDir, `${screen}.${variant}.${surface}.png`);
|
|
279045
279136
|
}
|
|
279046
279137
|
async function captureMockup(root, screen, entry, variant, outDir, session) {
|
|
279047
279138
|
if (!entry.mockup) throw new MockupMissingError(`screen ${screen} declares no mockup in hhp.json`);
|
|
@@ -279078,7 +279169,7 @@ async function captureWebVariant(root, variant, outDir, screens) {
|
|
|
279078
279169
|
const built = await buildContentBundles2(root, { resolution: resolutionFlag2({}) });
|
|
279079
279170
|
const out2 = /* @__PURE__ */ new Map();
|
|
279080
279171
|
if (built.compileErrors.length) return compileFailureFrames(built.compileErrors, screens, variant);
|
|
279081
|
-
const scratch =
|
|
279172
|
+
const scratch = join202(outDir, `.build-${variant}`);
|
|
279082
279173
|
try {
|
|
279083
279174
|
const outcome = await buildReleaseFromContent2(root, scratch, {
|
|
279084
279175
|
...built.built.length || built.compileErrors.length ? { tier5Dir: bundleOutDir2(root) } : {},
|
|
@@ -279187,7 +279278,7 @@ var init_capture = __esm({
|
|
|
279187
279278
|
import { spawn as spawn10 } from "node:child_process";
|
|
279188
279279
|
import { copyFileSync as copyFileSync4, mkdtempSync as mkdtempSync15, readFileSync as readFileSync188, rmSync as rmSync48 } from "node:fs";
|
|
279189
279280
|
import { tmpdir as tmpdir16 } from "node:os";
|
|
279190
|
-
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";
|
|
279191
279282
|
import { fileURLToPath as fileURLToPath40 } from "node:url";
|
|
279192
279283
|
function parseVerdict(value2, captured) {
|
|
279193
279284
|
const v2 = value2;
|
|
@@ -279237,10 +279328,10 @@ async function judgeStrip(strip4, screen, variant, opts = {}) {
|
|
|
279237
279328
|
"",
|
|
279238
279329
|
`Screen \`${screen}\`, variant \`${variant}\`. Read the strip image at ./${basename42(strip4)} and judge it.`
|
|
279239
279330
|
].join("\n");
|
|
279240
|
-
const cwd = mkdtempSync15(
|
|
279331
|
+
const cwd = mkdtempSync15(join203(tmpdir16(), "himi-fidelity-judge-"));
|
|
279241
279332
|
let r3;
|
|
279242
279333
|
try {
|
|
279243
|
-
copyFileSync4(strip4,
|
|
279334
|
+
copyFileSync4(strip4, join203(cwd, basename42(strip4)));
|
|
279244
279335
|
r3 = await run4("claude", judgeArgs(schema2), { cwd, input, timeoutMs });
|
|
279245
279336
|
} catch (e2) {
|
|
279246
279337
|
return cannotTell(`the judge could not be prepared: ${e2.message}`);
|
|
@@ -279299,7 +279390,7 @@ var init_judge = __esm({
|
|
|
279299
279390
|
// src/fidelity/score.ts
|
|
279300
279391
|
import { spawn as spawn11 } from "node:child_process";
|
|
279301
279392
|
import { mkdtempSync as mkdtempSync16, rmSync as rmSync49 } from "node:fs";
|
|
279302
|
-
import { join as
|
|
279393
|
+
import { join as join204 } from "node:path";
|
|
279303
279394
|
import { tmpdir as tmpdir17 } from "node:os";
|
|
279304
279395
|
function viewportHeight(width) {
|
|
279305
279396
|
return Math.round(width * 2.165);
|
|
@@ -279321,10 +279412,10 @@ async function scorePair(aFile, bFile, opts = {}) {
|
|
|
279321
279412
|
const sizes = await Promise.all([aFile, bFile].map(async (f2) => (await magick(run4, ["identify", "-format", "%w %h", f2])).split(" ").map(Number)));
|
|
279322
279413
|
const width = Math.min(sizes[0][0], sizes[1][0]);
|
|
279323
279414
|
const height = Math.min(...sizes.map(([w2, h2]) => Math.round(h2 * width / w2)), viewportHeight(width));
|
|
279324
|
-
const dir = mkdtempSync16(
|
|
279415
|
+
const dir = mkdtempSync16(join204(tmpdir17(), "himi-fidelity-score-"));
|
|
279325
279416
|
try {
|
|
279326
279417
|
const norm3 = await Promise.all([aFile, bFile].map(async (f2, i2) => {
|
|
279327
|
-
const out2 =
|
|
279418
|
+
const out2 = join204(dir, `${i2}.png`);
|
|
279328
279419
|
const mask = opts.mask ?? { top: 0, bottom: 0 };
|
|
279329
279420
|
const draw = [
|
|
279330
279421
|
...mask.top > 0 ? ["-draw", `rectangle 0,0 ${width},${mask.top - 1}`] : [],
|
|
@@ -279400,7 +279491,7 @@ var init_evidence = __esm({
|
|
|
279400
279491
|
|
|
279401
279492
|
// src/fidelity/strip.ts
|
|
279402
279493
|
import { mkdtempSync as mkdtempSync17, rmSync as rmSync51 } from "node:fs";
|
|
279403
|
-
import { join as
|
|
279494
|
+
import { join as join205 } from "node:path";
|
|
279404
279495
|
import { tmpdir as tmpdir18 } from "node:os";
|
|
279405
279496
|
async function buildStrip(frames, out2, opts = {}) {
|
|
279406
279497
|
const run4 = opts.run ?? runProcess;
|
|
@@ -279409,7 +279500,7 @@ async function buildStrip(frames, out2, opts = {}) {
|
|
|
279409
279500
|
const { pointsize, strip: strip4 } = labelMetrics(width);
|
|
279410
279501
|
const font = resolveCaptionFont();
|
|
279411
279502
|
const fontArgs = font ? ["-font", font] : [];
|
|
279412
|
-
const dir = mkdtempSync17(
|
|
279503
|
+
const dir = mkdtempSync17(join205(tmpdir18(), "himi-fidelity-strip-"));
|
|
279413
279504
|
const magick2 = async (args) => {
|
|
279414
279505
|
const r3 = await run4("magick", args);
|
|
279415
279506
|
if (r3.code !== 0) throw new Error(`magick failed building the strip: ${r3.stderr.trim() || `exit ${r3.code}`}`);
|
|
@@ -279419,7 +279510,7 @@ async function buildStrip(frames, out2, opts = {}) {
|
|
|
279419
279510
|
for (const surface of STRIP_ORDER) {
|
|
279420
279511
|
const frame = frames.find((f2) => f2.surface === surface);
|
|
279421
279512
|
if (!frame) continue;
|
|
279422
|
-
const pane =
|
|
279513
|
+
const pane = join205(dir, `${surface}.png`);
|
|
279423
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"}`];
|
|
279424
279515
|
const label4 = `${surface.toUpperCase()}${frame.noReference ? " (no reference)" : ""}`;
|
|
279425
279516
|
await magick2([...body, "-gravity", "north", "-background", "#111", "-splice", `0x${strip4}`, ...fontArgs, "-fill", "white", "-pointsize", String(pointsize), "-annotate", "+0+4", label4, pane]);
|
|
@@ -279456,7 +279547,7 @@ __export(run_exports2, {
|
|
|
279456
279547
|
unlinkableScreens: () => unlinkableScreens
|
|
279457
279548
|
});
|
|
279458
279549
|
import { mkdirSync as mkdirSync70, writeFileSync as writeFileSync79 } from "node:fs";
|
|
279459
|
-
import { basename as basename43, join as
|
|
279550
|
+
import { basename as basename43, join as join206 } from "node:path";
|
|
279460
279551
|
function unlinkableScreens(config, screens, home2) {
|
|
279461
279552
|
const navigation = config?.navigation;
|
|
279462
279553
|
const linkables = Array.isArray(navigation?.linkableScreens) ? navigation.linkableScreens : [];
|
|
@@ -279515,8 +279606,8 @@ async function runFidelity(root, opts = {}) {
|
|
|
279515
279606
|
if (unknown.length) throw Object.assign(new Error(`unknown screen(s): ${unknown.join(", ")}`), { code: "fidelity_unknown_screen" });
|
|
279516
279607
|
const variants = opts.variants?.length ? opts.variants : VARIANTS;
|
|
279517
279608
|
const run4 = opts.run ?? runId();
|
|
279518
|
-
const dir =
|
|
279519
|
-
const framesDir =
|
|
279609
|
+
const dir = join206(opts.outRoot ?? join206(root, ".himi", "fidelity"), run4);
|
|
279610
|
+
const framesDir = join206(dir, "frames");
|
|
279520
279611
|
mkdirSync70(framesDir, { recursive: true });
|
|
279521
279612
|
const session = opts.capture?.mockup ? void 0 : new MockupSession();
|
|
279522
279613
|
const mockup = opts.capture?.mockup ?? ((r3, s5, e2, v2, o2) => captureMockup(r3, s5, e2, v2, o2, session));
|
|
@@ -279567,7 +279658,7 @@ async function runFidelity(root, opts = {}) {
|
|
|
279567
279658
|
let stripFile;
|
|
279568
279659
|
let verdict;
|
|
279569
279660
|
const judged2 = frames.filter((f2) => !f2.noReference);
|
|
279570
|
-
const stripPath2 =
|
|
279661
|
+
const stripPath2 = join206(dir, `${screen}.${variant}.strip.png`);
|
|
279571
279662
|
if (!w2?.file || judged2.filter((f2) => f2.file).length < 2) {
|
|
279572
279663
|
if (frames.some((f2) => f2.file)) stripFile = await strip4(frames, stripPath2);
|
|
279573
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");
|
|
@@ -279591,7 +279682,7 @@ async function runFidelity(root, opts = {}) {
|
|
|
279591
279682
|
await native?.restore?.();
|
|
279592
279683
|
}
|
|
279593
279684
|
const report9 = { app: basename43(root), run: run4, dir, rows, status: worst(rows) };
|
|
279594
|
-
writeFileSync79(
|
|
279685
|
+
writeFileSync79(join206(dir, "report.json"), JSON.stringify(report9, null, 2) + "\n");
|
|
279595
279686
|
return report9;
|
|
279596
279687
|
}
|
|
279597
279688
|
function prCommentBody(report9) {
|
|
@@ -279653,7 +279744,7 @@ __export(native_exports, {
|
|
|
279653
279744
|
});
|
|
279654
279745
|
import { spawn as spawn12 } from "node:child_process";
|
|
279655
279746
|
import { readFileSync as readFileSync189, writeFileSync as writeFileSync80 } from "node:fs";
|
|
279656
|
-
import { join as
|
|
279747
|
+
import { join as join207 } from "node:path";
|
|
279657
279748
|
function resumedPackages(dumpsys) {
|
|
279658
279749
|
const lines2 = dumpsys.split("\n").filter((l3) => /\b(?:topResumedActivity|mResumedActivity|ResumedActivity)\b/.test(l3));
|
|
279659
279750
|
if (!lines2.length) return void 0;
|
|
@@ -279800,7 +279891,7 @@ function nativeCapture(devices, opts) {
|
|
|
279800
279891
|
const container = await run4("xcrun", ["simctl", "get_app_container", id, iosBundle, "app"]);
|
|
279801
279892
|
let compiled = "";
|
|
279802
279893
|
if (container.code === 0) {
|
|
279803
|
-
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")]);
|
|
279804
279895
|
if (plist.code === 0) compiled = plist.stdout.toString().trim();
|
|
279805
279896
|
}
|
|
279806
279897
|
const rebuild = `HIMALAYA_API_BASE_URL_INFO=${opts.serveOrigin}`;
|
|
@@ -279871,7 +279962,7 @@ function nativeCapture(devices, opts) {
|
|
|
279871
279962
|
}
|
|
279872
279963
|
await apply2(platform, id, variant);
|
|
279873
279964
|
await open6(platform, id, `himi://app/${encodeURIComponent(picker)}`);
|
|
279874
|
-
const file2 =
|
|
279965
|
+
const file2 = join207(outDir, `${screen}.${variant}.${platform}.png`);
|
|
279875
279966
|
const pickerFrame = (await settle2(platform, id, file2)).frame;
|
|
279876
279967
|
await open6(platform, id, screenLink(opts.appId, screen, entry, opts.release));
|
|
279877
279968
|
const { unsettled } = await settle2(platform, id, file2, pickerFrame);
|
|
@@ -279974,13 +280065,13 @@ __export(serve_exports, {
|
|
|
279974
280065
|
});
|
|
279975
280066
|
import { copyFileSync as copyFileSync5, existsSync as existsSync161, mkdirSync as mkdirSync71, mkdtempSync as mkdtempSync18, rmSync as rmSync52 } from "node:fs";
|
|
279976
280067
|
import { tmpdir as tmpdir19 } from "node:os";
|
|
279977
|
-
import { join as
|
|
280068
|
+
import { join as join208 } from "node:path";
|
|
279978
280069
|
function copyFreshBundles(built, outDir, into) {
|
|
279979
280070
|
mkdirSync71(into, { recursive: true });
|
|
279980
280071
|
for (const name of built) {
|
|
279981
280072
|
for (const file2 of [`${name}.bundle.js`, `${name}.bundle.js.map`]) {
|
|
279982
|
-
const from =
|
|
279983
|
-
if (existsSync161(from)) copyFileSync5(from,
|
|
280073
|
+
const from = join208(outDir, file2);
|
|
280074
|
+
if (existsSync161(from)) copyFileSync5(from, join208(into, file2));
|
|
279984
280075
|
}
|
|
279985
280076
|
}
|
|
279986
280077
|
}
|
|
@@ -279996,7 +280087,7 @@ async function serveWorkingCopy(dir, port) {
|
|
|
279996
280087
|
const { buildContentBundles: buildContentBundles2, buildReleaseFromContent: buildReleaseFromContent2 } = await loadAuthoring();
|
|
279997
280088
|
const bundles = await buildContentBundles2(dir, {});
|
|
279998
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`);
|
|
279999
|
-
const temp = mkdtempSync18(
|
|
280090
|
+
const temp = mkdtempSync18(join208(tmpdir19(), "himi-fidelity-serve-"));
|
|
280000
280091
|
const cleanup = () => rmSync52(temp, { recursive: true, force: true });
|
|
280001
280092
|
const onSignal = () => {
|
|
280002
280093
|
cleanup();
|
|
@@ -280005,12 +280096,12 @@ async function serveWorkingCopy(dir, port) {
|
|
|
280005
280096
|
process.once("SIGINT", onSignal);
|
|
280006
280097
|
process.once("SIGTERM", onSignal);
|
|
280007
280098
|
try {
|
|
280008
|
-
const tier5Dir = bundles.built.length > 0 ?
|
|
280099
|
+
const tier5Dir = bundles.built.length > 0 ? join208(temp, ".tier5") : void 0;
|
|
280009
280100
|
if (tier5Dir) copyFreshBundles(bundles.built, bundles.outDir, tier5Dir);
|
|
280010
280101
|
const outcome = await buildReleaseFromContent2(dir, temp, { ...tier5Dir ? { tier5Dir } : {}, ...RUN_CONTENT_BUILD });
|
|
280011
280102
|
const unservable = releaseProblem(outcome);
|
|
280012
280103
|
if (unservable) throw new Error(unservable);
|
|
280013
|
-
const served = await runPackage(
|
|
280104
|
+
const served = await runPackage(join208(temp, app2), { port, host: "127.0.0.1", chrome: "app", open: false, workDir: temp });
|
|
280014
280105
|
return { origin: served.origin, close: async () => {
|
|
280015
280106
|
await served.close();
|
|
280016
280107
|
cleanup();
|
|
@@ -280064,7 +280155,7 @@ __export(fidelity_exports, {
|
|
|
280064
280155
|
});
|
|
280065
280156
|
import { execFileSync as execFileSync12 } from "node:child_process";
|
|
280066
280157
|
import { existsSync as existsSync162, realpathSync as realpathSync25 } from "node:fs";
|
|
280067
|
-
import { join as
|
|
280158
|
+
import { join as join209, relative as relative37, sep as sep35 } from "node:path";
|
|
280068
280159
|
function himalayaRepoRoot(dir) {
|
|
280069
280160
|
let top;
|
|
280070
280161
|
try {
|
|
@@ -280072,7 +280163,7 @@ function himalayaRepoRoot(dir) {
|
|
|
280072
280163
|
} catch {
|
|
280073
280164
|
return null;
|
|
280074
280165
|
}
|
|
280075
|
-
if (!existsSync162(
|
|
280166
|
+
if (!existsSync162(join209(top, "tools/judges/fidelity/JUDGE.md"))) return null;
|
|
280076
280167
|
const rel2 = relative37(realpathSync25(top), realpathSync25(dir));
|
|
280077
280168
|
return rel2.startsWith(`..${sep35}`) || rel2 === ".." ? null : top;
|
|
280078
280169
|
}
|
|
@@ -280105,7 +280196,7 @@ async function fidelityCommand(ctx) {
|
|
|
280105
280196
|
return 2;
|
|
280106
280197
|
}
|
|
280107
280198
|
const { runFidelity: runFidelity2, prCommentBody: prCommentBody2 } = await Promise.resolve().then(() => (init_run3(), run_exports2));
|
|
280108
|
-
const judgeDir =
|
|
280199
|
+
const judgeDir = join209(repo, "tools/judges/fidelity");
|
|
280109
280200
|
const deviceFlags = { ios: "ios", android: "android", iosTablet: "ios-tablet", androidTablet: "android-tablet" };
|
|
280110
280201
|
const bare = Object.values(deviceFlags).filter((f2) => flags[f2] !== void 0 && !str3(flags[f2]));
|
|
280111
280202
|
if (bare.length) {
|
|
@@ -280211,7 +280302,7 @@ async function fidelityCommand(ctx) {
|
|
|
280211
280302
|
else {
|
|
280212
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]}` : ""}`);
|
|
280213
280304
|
io2.log(`
|
|
280214
|
-
${report9.status.toUpperCase()} \u2014 report: ${
|
|
280305
|
+
${report9.status.toUpperCase()} \u2014 report: ${join209(report9.dir, "report.json")}`);
|
|
280215
280306
|
}
|
|
280216
280307
|
return report9.status === "fail" ? 1 : 0;
|
|
280217
280308
|
}
|
|
@@ -280301,8 +280392,8 @@ async function publishSizeCommand(ctx) {
|
|
|
280301
280392
|
}
|
|
280302
280393
|
const dir = contentDir2(flags);
|
|
280303
280394
|
const { existsSync: existsSync164 } = await import("node:fs");
|
|
280304
|
-
const { join:
|
|
280305
|
-
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>");
|
|
280306
280397
|
const declared = await appId3(dir);
|
|
280307
280398
|
const app2 = typeof flags.app === "string" ? flags.app : declared;
|
|
280308
280399
|
if (!isValidAppId(app2)) return fail16("invalid_usage", "declared app is not a valid publish ID; pass --app <valid-slug>", { app: app2 }, 2);
|
|
@@ -280415,7 +280506,7 @@ __export(ext_impl_exports, {
|
|
|
280415
280506
|
runExt: () => runExt
|
|
280416
280507
|
});
|
|
280417
280508
|
import { existsSync as existsSync163, mkdirSync as mkdirSync72, readFileSync as readFileSync190, writeFileSync as writeFileSync81 } from "node:fs";
|
|
280418
|
-
import { join as
|
|
280509
|
+
import { join as join210 } from "node:path";
|
|
280419
280510
|
import ts33 from "typescript";
|
|
280420
280511
|
async function runExt(ctx) {
|
|
280421
280512
|
const { pos, flags, io: io2, print } = ctx;
|
|
@@ -280446,7 +280537,7 @@ async function runExt(ctx) {
|
|
|
280446
280537
|
hint: `run \`himi capabilities ${catalogId}\` for how to use it, or pass --force to create the extension anyway`
|
|
280447
280538
|
}, 2);
|
|
280448
280539
|
}
|
|
280449
|
-
const configPath =
|
|
280540
|
+
const configPath = join210(dir, "config.ts");
|
|
280450
280541
|
if (!existsSync163(configPath)) return fail16("extensions_config_missing", `no config.ts in ${dir}; run this inside a content package (or pass --content)`);
|
|
280451
280542
|
const declared = declaredExtensions(dir);
|
|
280452
280543
|
if (declared.kind === "opaque") {
|
|
@@ -280455,7 +280546,7 @@ async function runExt(ctx) {
|
|
|
280455
280546
|
if (!declared.names.includes(name) && declared.names.length >= MAX_EXTENSIONS) {
|
|
280456
280547
|
return fail16("extension_limit", `an app may declare at most ${MAX_EXTENSIONS} extensions`, { limit: MAX_EXTENSIONS });
|
|
280457
280548
|
}
|
|
280458
|
-
const extDir =
|
|
280549
|
+
const extDir = join210(dir, EXTENSIONS_DIR, name);
|
|
280459
280550
|
if (existsSync163(extDir)) return fail16("extension_exists", `${EXTENSIONS_DIR}/${name}/ already exists`, { extension: name });
|
|
280460
280551
|
const views2 = [str3(flags.views), str3(flags.view)].filter(Boolean).flatMap((v2) => v2.split(",")).map((v2) => v2.trim()).filter(Boolean);
|
|
280461
280552
|
const badView = views2.find((v2) => !isValidViewName(v2) || CORE_TYPE_NAMES.has(v2));
|
|
@@ -280465,8 +280556,8 @@ async function runExt(ctx) {
|
|
|
280465
280556
|
const pascal2 = pascalName(name);
|
|
280466
280557
|
const files = [];
|
|
280467
280558
|
const put = (rel2, text32) => {
|
|
280468
|
-
const path2 =
|
|
280469
|
-
mkdirSync72(
|
|
280559
|
+
const path2 = join210(extDir, rel2);
|
|
280560
|
+
mkdirSync72(join210(path2, ".."), { recursive: true });
|
|
280470
280561
|
writeFileSync81(path2, text32, { flag: "wx" });
|
|
280471
280562
|
files.push(`${EXTENSIONS_DIR}/${name}/${rel2}`);
|
|
280472
280563
|
};
|
|
@@ -280523,9 +280614,9 @@ async function runExt(ctx) {
|
|
|
280523
280614
|
return 0;
|
|
280524
280615
|
}
|
|
280525
280616
|
function loadModelFor(extDir) {
|
|
280526
|
-
const parsed = parseExtensionManifest(JSON.parse(readFileSync190(
|
|
280617
|
+
const parsed = parseExtensionManifest(JSON.parse(readFileSync190(join210(extDir, EXTENSION_MANIFEST), "utf8")));
|
|
280527
280618
|
if (!parsed.ok) return { ok: false, message: parsed.problems.map((p2) => p2.message).join("; ") };
|
|
280528
|
-
const iface = parseExtensionInterface(readFileSync190(
|
|
280619
|
+
const iface = parseExtensionInterface(readFileSync190(join210(extDir, parsed.manifest.interface), "utf8"), parsed.manifest);
|
|
280529
280620
|
if (!iface.ok) return { ok: false, message: iface.problems.map((p2) => p2.message).join("; ") };
|
|
280530
280621
|
return { ok: true, model: iface.model };
|
|
280531
280622
|
}
|
|
@@ -281541,10 +281632,14 @@ var USAGE = `himi \u2014 the Himalaya authoring CLI (remote dev loop)
|
|
|
281541
281632
|
create the app in your own Play Console: shows Google's Create
|
|
281542
281633
|
app declarations with their terms links; only your typed yes
|
|
281543
281634
|
accepts them (recorded as a local approval id).
|
|
281544
|
-
himi store google testers pool-add|pool-remove|pool-check [--dir <app>] [--track
|
|
281545
|
-
put Wix's tester group (HIMI_POOL_TESTER_GROUP) on
|
|
281546
|
-
closed track
|
|
281547
|
-
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.
|
|
281548
281643
|
himi store google keygen <package> [--out <file.p12>] [--alias <name>] [--name <certificate name>]
|
|
281549
281644
|
make the upload key for an owner-signed app (no Wix site) on this
|
|
281550
281645
|
computer: keystore, its password in a 0600 .pass file, and the
|
|
@@ -281915,7 +282010,7 @@ var COMMANDS = [
|
|
|
281915
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)" },
|
|
281916
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>]" },
|
|
281917
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]" },
|
|
281918
|
-
{ 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]" },
|
|
281919
282014
|
{ name: "guide", summary: "print the Himalaya overview + headless dev loop + available topics (offline)", required: "[--json]" },
|
|
281920
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]" },
|
|
281921
282016
|
{ name: "components", summary: "print the SDUI component vocabulary + props; a name = that component (offline)", required: "[<Name>] [--json]" },
|
|
@@ -287661,7 +287756,7 @@ async function testflightCommand(ctx) {
|
|
|
287661
287756
|
// src/commands/dist.ts
|
|
287662
287757
|
init_define_HHP_CATALOG();
|
|
287663
287758
|
import { existsSync as existsSync133, readFileSync as readFileSync159 } from "node:fs";
|
|
287664
|
-
import { join as
|
|
287759
|
+
import { join as join172 } from "node:path";
|
|
287665
287760
|
init_wix_owner();
|
|
287666
287761
|
init_cli_shared();
|
|
287667
287762
|
function isCiEnvironment(env = process.env) {
|
|
@@ -287728,7 +287823,7 @@ async function distCommand(ctx) {
|
|
|
287728
287823
|
const rememberLastDist = async (jobs2) => {
|
|
287729
287824
|
try {
|
|
287730
287825
|
const dir = contentDir(flags);
|
|
287731
|
-
if (!existsSync133(
|
|
287826
|
+
if (!existsSync133(join172(dir, "himalaya.content.json"))) return;
|
|
287732
287827
|
const { lastDistFromJob: lastDistFromJob2, writeLastDist: writeLastDist2 } = await Promise.resolve().then(() => (init_capabilities(), capabilities_exports));
|
|
287733
287828
|
const own6 = await appId(dir);
|
|
287734
287829
|
for (const job of jobs2) {
|
|
@@ -288027,7 +288122,7 @@ ${label4}`);
|
|
|
288027
288122
|
}
|
|
288028
288123
|
{
|
|
288029
288124
|
const distDir = contentDir(flags);
|
|
288030
|
-
if (str3(flags["app-icon-url"]) === void 0 && existsSync133(
|
|
288125
|
+
if (str3(flags["app-icon-url"]) === void 0 && existsSync133(join172(distDir, "himalaya.content.json"))) {
|
|
288031
288126
|
const issues = await iconIssues(distDir, flags.strict === true, { requireDeclared: true, requireVerified: true });
|
|
288032
288127
|
const errors = issues.filter((i2) => i2.severity === "error");
|
|
288033
288128
|
for (const i2 of issues.filter((i3) => i3.severity === "warning")) {
|
|
@@ -289262,7 +289357,7 @@ async function upgradeCommand(ctx) {
|
|
|
289262
289357
|
init_define_HHP_CATALOG();
|
|
289263
289358
|
init_config();
|
|
289264
289359
|
import { statSync as statSync45, accessSync as accessSync5, constants as constants11 } from "node:fs";
|
|
289265
|
-
import { join as
|
|
289360
|
+
import { join as join173 } from "node:path";
|
|
289266
289361
|
init_wix_owner();
|
|
289267
289362
|
init_owner_claim();
|
|
289268
289363
|
init_self_update();
|
|
@@ -289331,7 +289426,7 @@ function executableOnPath(name, env = process.env) {
|
|
|
289331
289426
|
const suffixes = process.platform === "win32" ? (env.PATHEXT ?? ".COM;.EXE;.BAT;.CMD").split(";").filter(Boolean) : [""];
|
|
289332
289427
|
for (const dir of entries) {
|
|
289333
289428
|
for (const suffix of suffixes) {
|
|
289334
|
-
const candidate =
|
|
289429
|
+
const candidate = join173(dir, `${name}${suffix}`);
|
|
289335
289430
|
try {
|
|
289336
289431
|
if (!statSync45(candidate).isFile()) continue;
|
|
289337
289432
|
if (process.platform !== "win32") accessSync5(candidate, constants11.X_OK);
|
|
@@ -289549,7 +289644,7 @@ init_define_HHP_CATALOG();
|
|
|
289549
289644
|
init_guides();
|
|
289550
289645
|
init_cli_shared();
|
|
289551
289646
|
import { existsSync as existsSync134 } from "node:fs";
|
|
289552
|
-
import { join as
|
|
289647
|
+
import { join as join174, resolve as resolve109 } from "node:path";
|
|
289553
289648
|
async function runGuideCommand(command, pos, flags, io2, print) {
|
|
289554
289649
|
const { referenceCache: referenceCache2, referenceIdentity: referenceIdentity2 } = await Promise.resolve().then(() => (init_guides(), guides_exports));
|
|
289555
289650
|
const cache4 = referenceCache2();
|
|
@@ -289817,7 +289912,7 @@ Seed your coding agent with \`himi agent-init\`. Guides: ${idx.portalUrl}`);
|
|
|
289817
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/" } : {},
|
|
289818
289913
|
// In a git repo the refresh moves the diff identity an earlier `himi test` attested (that
|
|
289819
289914
|
// hash is shared with the repo gates and deliberately exempts nothing but its own metadata).
|
|
289820
|
-
...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" } : {},
|
|
289821
289916
|
...res.skipped.length ? { skipped: res.skipped } : {},
|
|
289822
289917
|
portalUrl: idx.portalUrl
|
|
289823
289918
|
});
|
|
@@ -289892,7 +289987,7 @@ init_define_HHP_CATALOG();
|
|
|
289892
289987
|
init_cms_schema();
|
|
289893
289988
|
init_wix_owner();
|
|
289894
289989
|
import { existsSync as existsSync135, readFileSync as readFileSync163, writeFileSync as writeFileSync58 } from "node:fs";
|
|
289895
|
-
import { join as
|
|
289990
|
+
import { join as join175 } from "node:path";
|
|
289896
289991
|
var FOREIGN_DETAIL_LIMIT = 25;
|
|
289897
289992
|
var MAX_COLLECTION_PAGES = 40;
|
|
289898
289993
|
async function listCollections(call) {
|
|
@@ -290412,7 +290507,7 @@ async function seedCms(opts) {
|
|
|
290412
290507
|
return report9;
|
|
290413
290508
|
}
|
|
290414
290509
|
function readSeedFile(dir) {
|
|
290415
|
-
const file2 =
|
|
290510
|
+
const file2 = join175(dir, "cms-seed.json");
|
|
290416
290511
|
if (!existsSync135(file2)) return {};
|
|
290417
290512
|
let parsed;
|
|
290418
290513
|
try {
|
|
@@ -290462,7 +290557,7 @@ function placeholder(type2, key4, i2) {
|
|
|
290462
290557
|
}
|
|
290463
290558
|
async function writeSeedRows(opts) {
|
|
290464
290559
|
const { app: app2, cms, dir, count: count3 = 8 } = opts;
|
|
290465
|
-
const file2 =
|
|
290560
|
+
const file2 = join175(dir, "cms-seed.json");
|
|
290466
290561
|
const owned = (cms?.collections ?? []).filter((s5) => s5.id?.startsWith(namespacePrefix(app2)));
|
|
290467
290562
|
if (!owned.length) {
|
|
290468
290563
|
return {
|
|
@@ -290836,7 +290931,7 @@ import {
|
|
|
290836
290931
|
statSync as statSync46,
|
|
290837
290932
|
writeFileSync as writeFileSync61
|
|
290838
290933
|
} from "node:fs";
|
|
290839
|
-
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";
|
|
290840
290935
|
var L10N_USAGE = "usage: himi l10n import --format oneapp <dir> (--app <slug> | --content <app dir>) [--locales en,he] [--source en] [--overwrite] [--json]";
|
|
290841
290936
|
var MESSAGES_FILE = /^messages_(.+)\.json$/;
|
|
290842
290937
|
var UnsafePath = class extends Error {
|
|
@@ -290855,8 +290950,8 @@ function readRegularFile(path2) {
|
|
|
290855
290950
|
}
|
|
290856
290951
|
}
|
|
290857
290952
|
function unsafeDestination(appDir3, tags) {
|
|
290858
|
-
const l10nDir =
|
|
290859
|
-
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`))]) {
|
|
290860
290955
|
try {
|
|
290861
290956
|
if (lstatSync37(path2).isSymbolicLink()) return `${relative35(process.cwd(), path2)} is a symbolic link`;
|
|
290862
290957
|
} catch (e2) {
|
|
@@ -290867,7 +290962,7 @@ function unsafeDestination(appDir3, tags) {
|
|
|
290867
290962
|
return void 0;
|
|
290868
290963
|
}
|
|
290869
290964
|
function writeCatalog(path2, text32) {
|
|
290870
|
-
const tmp =
|
|
290965
|
+
const tmp = join179(dirname81(path2), `.${basename41(path2)}.${process.pid}.${randomBytes24(4).toString("hex")}.tmp`);
|
|
290871
290966
|
try {
|
|
290872
290967
|
writeFileSync61(tmp, text32, { encoding: "utf8", flag: "wx" });
|
|
290873
290968
|
renameSync25(tmp, path2);
|
|
@@ -290910,7 +291005,7 @@ async function l10nCommand(ctx) {
|
|
|
290910
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);
|
|
290911
291006
|
}
|
|
290912
291007
|
const dir = resolve113("apps", slug);
|
|
290913
|
-
if (!existsSync137(
|
|
291008
|
+
if (!existsSync137(join179(dir, "config.ts")) && !existsSync137(join179(dir, "config.js")) && !existsSync137(join179(dir, "config.mjs"))) {
|
|
290914
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);
|
|
290915
291010
|
}
|
|
290916
291011
|
appDir3 = dir;
|
|
@@ -290931,7 +291026,7 @@ async function l10nCommand(ctx) {
|
|
|
290931
291026
|
}
|
|
290932
291027
|
for (const name of names2) {
|
|
290933
291028
|
const m2 = MESSAGES_FILE.exec(name);
|
|
290934
|
-
if (m2) fileByTag.set(m2[1],
|
|
291029
|
+
if (m2) fileByTag.set(m2[1], join179(messagesDir, name));
|
|
290935
291030
|
}
|
|
290936
291031
|
if (fileByTag.size === 0) {
|
|
290937
291032
|
return fail16("no_messages_found", { error: `no messages_<locale>.json files in ${dirArg}`, dir: messagesDir }, 1);
|
|
@@ -290993,13 +291088,13 @@ async function l10nCommand(ctx) {
|
|
|
290993
291088
|
try {
|
|
290994
291089
|
unsafe2 = unsafeDestination(appDir3, requested);
|
|
290995
291090
|
} catch (e2) {
|
|
290996
|
-
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);
|
|
290997
291092
|
}
|
|
290998
291093
|
if (unsafe2 !== void 0) {
|
|
290999
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);
|
|
291000
291095
|
}
|
|
291001
291096
|
for (const tag of requested) {
|
|
291002
|
-
const path2 =
|
|
291097
|
+
const path2 = join179(appDir3, "l10n", `${tag}.json`);
|
|
291003
291098
|
if (!existsSync137(path2)) continue;
|
|
291004
291099
|
try {
|
|
291005
291100
|
const parsed = JSON.parse(readRegularFile(path2).toString("utf8"));
|
|
@@ -291061,7 +291156,7 @@ async function l10nCommand(ctx) {
|
|
|
291061
291156
|
if (catalogs.en && checkoutRoot !== void 0) {
|
|
291062
291157
|
try {
|
|
291063
291158
|
const { injectAllNativeRows: injectAllNativeRows2, loadTable: loadTable2 } = await Promise.resolve().then(() => (init_auth_gate_copy(), auth_gate_copy_exports));
|
|
291064
|
-
const table = loadTable2(
|
|
291159
|
+
const table = loadTable2(join179(checkoutRoot, "core", "runtime", "l10n", "auth-gate", "en.json"));
|
|
291065
291160
|
catalogs.en = injectAllNativeRows2(catalogs.en, appDir3, table);
|
|
291066
291161
|
} catch (e2) {
|
|
291067
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\`` });
|
|
@@ -291069,14 +291164,14 @@ async function l10nCommand(ctx) {
|
|
|
291069
291164
|
}
|
|
291070
291165
|
const written = [];
|
|
291071
291166
|
try {
|
|
291072
|
-
mkdirSync61(
|
|
291167
|
+
mkdirSync61(join179(appDir3, "l10n"), { recursive: true });
|
|
291073
291168
|
const swapped = unsafeDestination(appDir3, requested);
|
|
291074
|
-
const l10nReal = realpathSync22(
|
|
291075
|
-
if (swapped !== void 0 || l10nReal !==
|
|
291076
|
-
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`);
|
|
291077
291172
|
}
|
|
291078
291173
|
for (const tag of requested) {
|
|
291079
|
-
const path2 =
|
|
291174
|
+
const path2 = join179(appDir3, "l10n", `${tag}.json`);
|
|
291080
291175
|
writeCatalog(path2, JSON.stringify(catalogs[tag], null, 2) + "\n");
|
|
291081
291176
|
written.push({ tag, path: relative35(process.cwd(), path2), count: Object.keys(catalogs[tag].messages).length });
|
|
291082
291177
|
}
|
|
@@ -291118,7 +291213,7 @@ async function l10nCommand(ctx) {
|
|
|
291118
291213
|
init_define_HHP_CATALOG();
|
|
291119
291214
|
init_cli_shared();
|
|
291120
291215
|
import { existsSync as existsSync145 } from "node:fs";
|
|
291121
|
-
import { join as
|
|
291216
|
+
import { join as join188, resolve as resolve117 } from "node:path";
|
|
291122
291217
|
async function base44Command(ctx) {
|
|
291123
291218
|
const { io: io2, pos, flags, print } = ctx;
|
|
291124
291219
|
if (pos[1] === "auth-check") {
|
|
@@ -291189,7 +291284,7 @@ async function base44Command(ctx) {
|
|
|
291189
291284
|
return 1;
|
|
291190
291285
|
};
|
|
291191
291286
|
const gen = await Promise.resolve().then(() => (init_generate(), generate_exports));
|
|
291192
|
-
const missing4 = gen.ENGINE_FILES.filter((f2) => !existsSync145(
|
|
291287
|
+
const missing4 = gen.ENGINE_FILES.filter((f2) => !existsSync145(join188(dir, f2)));
|
|
291193
291288
|
if (missing4.length) {
|
|
291194
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>`" });
|
|
291195
291290
|
}
|
|
@@ -291275,7 +291370,7 @@ async function base44Command(ctx) {
|
|
|
291275
291370
|
if (!provisioning || str3(flags.content) !== void 0 || !slug) return contentDir(flags);
|
|
291276
291371
|
if (!/^[a-z0-9][a-z0-9-]*$/.test(slug)) return void 0;
|
|
291277
291372
|
const dir = resolve117("apps", slug);
|
|
291278
|
-
return existsSync145(
|
|
291373
|
+
return existsSync145(join188(dir, "config.ts")) || existsSync145(join188(dir, "config.mjs")) ? dir : void 0;
|
|
291279
291374
|
};
|
|
291280
291375
|
if (sub === "entities" || sub === "functions") {
|
|
291281
291376
|
if (sub === "entities" && !["query", "create", "seed"].includes(pos[2] ?? "")) {
|