@wix/himalaya-cli 0.1639.0 → 0.1640.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/bin/himi +1 -1
- package/dist/cli.mjs +744 -581
- package/guides/getting-started.md +5 -2
- package/guides/headless-loop.md +15 -5
- package/guides/himi-json-output.md +6 -0
- package/guides/himi-skill.md +15 -3
- package/guides/himi-test.md +3 -2
- package/guides/mobile-ux.md +12 -0
- package/guides/skill.md +2 -2
- package/guides/wix-site-to-himi-app.md +3 -1
- package/package.json +3 -3
package/dist/cli.mjs
CHANGED
|
@@ -25368,9 +25368,12 @@ function authoringUnavailableFields(err, context) {
|
|
|
25368
25368
|
};
|
|
25369
25369
|
}
|
|
25370
25370
|
return {
|
|
25371
|
-
error: `${what}. Off-repo this almost always means an out-of-date CLI, NOT a platform limitation \u2014 upgrade: \`npm i -g @wix/himalaya-cli@latest\`. If you meant to run in-repo, run from a monorepo checkout.`,
|
|
25371
|
+
error: `${what}. Off-repo this almost always means an out-of-date CLI, NOT a platform limitation \u2014 upgrade: \`npm i -g @wix/himalaya-cli@latest --allow-scripts=esbuild,sharp --include=optional\`. If you meant to run in-repo, run from a monorepo checkout.`,
|
|
25372
25372
|
...base,
|
|
25373
|
-
|
|
25373
|
+
// Spelled out rather than imported: this module is loaded on the failure path of a broken
|
|
25374
|
+
// install and stays dependency-free. playwright-install.test.ts pins CLI_INSTALL_COMMAND and
|
|
25375
|
+
// authoring-unavailable.test.ts pins this, to the same string.
|
|
25376
|
+
upgrade: "npm i -g @wix/himalaya-cli@latest --allow-scripts=esbuild,sharp --include=optional"
|
|
25374
25377
|
};
|
|
25375
25378
|
}
|
|
25376
25379
|
var AuthoringUnavailable;
|
|
@@ -29940,6 +29943,7 @@ function resolveIdiom(tokens2, ctx = {}) {
|
|
|
29940
29943
|
var IDIOM_CONTEXTS, UNSAFE_KEYS;
|
|
29941
29944
|
var init_idiom = __esm({
|
|
29942
29945
|
"../../core/ts/src/idiom.ts"() {
|
|
29946
|
+
"use strict";
|
|
29943
29947
|
init_define_HHP_CATALOG();
|
|
29944
29948
|
IDIOM_CONTEXTS = {
|
|
29945
29949
|
ios: { native: ["ios"] },
|
|
@@ -148657,8 +148661,8 @@ function materializeForPreview(appDir3, slug, displayName3) {
|
|
|
148657
148661
|
}
|
|
148658
148662
|
async function appId(dir) {
|
|
148659
148663
|
try {
|
|
148660
|
-
const { readFileSync:
|
|
148661
|
-
const m2 = JSON.parse(
|
|
148664
|
+
const { readFileSync: readFileSync150 } = await import("node:fs");
|
|
148665
|
+
const m2 = JSON.parse(readFileSync150(join34(dir, "himalaya.content.json"), "utf8"));
|
|
148662
148666
|
if (m2.name) return m2.name;
|
|
148663
148667
|
} catch {
|
|
148664
148668
|
}
|
|
@@ -148770,7 +148774,8 @@ function uxHandoverNote(uxEvidence, ctx) {
|
|
|
148770
148774
|
return `published with no mobile-UX drive this gate accepts for ${ctx.releaseId} (${uxEvidence.state}). The preview link below is the owner-private handover \u2014 record the drive with \`himi ux record --content ${ctx.contentArg} \u2026\` and publish again before a customer reviews it.`;
|
|
148771
148775
|
}
|
|
148772
148776
|
function uxHandoverOverride(uxEvidence, ctx) {
|
|
148773
|
-
if (!uxEvidence
|
|
148777
|
+
if (!uxEvidence) return {};
|
|
148778
|
+
if (uxEvidence.state === "recorded") return uxEvidence.notDriven?.length ? { uxNotDriven: uxEvidence.notDriven } : {};
|
|
148774
148779
|
return { uxEvidence, uxEvidenceNote: uxHandoverNote(uxEvidence, ctx) };
|
|
148775
148780
|
}
|
|
148776
148781
|
async function loadAuthoring() {
|
|
@@ -149051,7 +149056,7 @@ async function doctorVersionReport(running, fetchImpl = fetch, sdk = resolvedSdk
|
|
|
149051
149056
|
...publishedAt ? { publishedAt } : {},
|
|
149052
149057
|
...ageDays === void 0 ? {} : { ageDays: Math.round(ageDays * 10) / 10 },
|
|
149053
149058
|
status: latest ? cliOutdated ? "outdated" : "current" : "unknown",
|
|
149054
|
-
...cliOutdated ? { hint:
|
|
149059
|
+
...cliOutdated ? { hint: `Upgrade: ${CLI_INSTALL_COMMAND}` } : {}
|
|
149055
149060
|
},
|
|
149056
149061
|
sdk: {
|
|
149057
149062
|
...sdk.version ? { resolved: sdk.version, source: sdk.source } : {},
|
|
@@ -149118,7 +149123,7 @@ function globalPrefixWritable() {
|
|
|
149118
149123
|
}
|
|
149119
149124
|
function npmInstallArgs(registry2, version5) {
|
|
149120
149125
|
const pinned = `${normalizeRegistry(registry2) ?? registry2}/`;
|
|
149121
|
-
return ["i", "-g", `${CLI_PACKAGE}@${version5}`, `--registry=${pinned}`, `--@wix:registry=${pinned}
|
|
149126
|
+
return ["i", "-g", `${CLI_PACKAGE}@${version5}`, `--registry=${pinned}`, `--@wix:registry=${pinned}`, "--allow-scripts=esbuild,sharp", "--include=optional"];
|
|
149122
149127
|
}
|
|
149123
149128
|
function createUpdateRunner(spawn11 = spawnSync6) {
|
|
149124
149129
|
return {
|
|
@@ -149268,7 +149273,7 @@ function upgradeEnvelope(outcome) {
|
|
|
149268
149273
|
...outcome.latest ? { latest: outcome.latest } : {},
|
|
149269
149274
|
...outcome.ageDays === void 0 ? {} : { ageDays: outcome.ageDays },
|
|
149270
149275
|
action: outcome.action,
|
|
149271
|
-
command:
|
|
149276
|
+
command: CLI_INSTALL_COMMAND,
|
|
149272
149277
|
...outcome.detail ? { detail: outcome.detail } : {}
|
|
149273
149278
|
};
|
|
149274
149279
|
}
|
|
@@ -149352,7 +149357,7 @@ async function maybeSelfUpdate(argv, io2, opts = {}) {
|
|
|
149352
149357
|
const base = { running, latest, ageDays: Math.round(ageDays * 10) / 10, command };
|
|
149353
149358
|
const stale = formatStaleLine(running, latest, ageDays);
|
|
149354
149359
|
if (action === "warn") {
|
|
149355
|
-
io2.error(`${stale} \u2014
|
|
149360
|
+
io2.error(`${stale} \u2014 ${CLI_INSTALL_COMMAND}`);
|
|
149356
149361
|
return { ...base, action: "warned", detail: "global prefix is not writable" };
|
|
149357
149362
|
}
|
|
149358
149363
|
const runner2 = opts.runner ?? defaultUpdateRunner;
|
|
@@ -149417,11 +149422,13 @@ async function maybeSelfUpdate(argv, io2, opts = {}) {
|
|
|
149417
149422
|
releaseLock2();
|
|
149418
149423
|
}
|
|
149419
149424
|
}
|
|
149420
|
-
var PUBLIC_NPM_REGISTRY, WIX_NPM_MIRROR, CLI_PACKAGE_PATH, TRUSTED_REGISTRIES, SCOPED_REGISTRY_TIMEOUT_MS, npmScopedWixRegistry, CLI_PACKAGE, UNPUBLISHED_CLI_VERSION, UPDATE_MAX_AGE_DAYS, UPDATE_CHECK_INTERVAL_MS, UPDATE_FOREGROUND_BUDGET_MS, UPDATE_EXPLICIT_BUDGET_MS, UPDATE_BACKGROUND_BUDGET_MS, UPDATE_RETRY_AFTER_FAILURE_MS, UPDATE_SNOOZE_MS, UPDATE_REEXEC_ENV, INSTALLABLE_SPEC, defaultUpdateRunner, UPDATE_LOCK_REPORT_AFTER_MS, UPDATE_REFRESH_COMMAND;
|
|
149425
|
+
var SELF_UPDATE_INSTALL_COMMAND, CLI_INSTALL_COMMAND, PUBLIC_NPM_REGISTRY, WIX_NPM_MIRROR, CLI_PACKAGE_PATH, TRUSTED_REGISTRIES, SCOPED_REGISTRY_TIMEOUT_MS, npmScopedWixRegistry, CLI_PACKAGE, UNPUBLISHED_CLI_VERSION, UPDATE_MAX_AGE_DAYS, UPDATE_CHECK_INTERVAL_MS, UPDATE_FOREGROUND_BUDGET_MS, UPDATE_EXPLICIT_BUDGET_MS, UPDATE_BACKGROUND_BUDGET_MS, UPDATE_RETRY_AFTER_FAILURE_MS, UPDATE_SNOOZE_MS, UPDATE_REEXEC_ENV, INSTALLABLE_SPEC, defaultUpdateRunner, UPDATE_LOCK_REPORT_AFTER_MS, UPDATE_REFRESH_COMMAND;
|
|
149421
149426
|
var init_self_update = __esm({
|
|
149422
149427
|
"src/self-update.ts"() {
|
|
149423
149428
|
init_define_HHP_CATALOG();
|
|
149424
149429
|
init_cli_shared();
|
|
149430
|
+
SELF_UPDATE_INSTALL_COMMAND = "npm i -g @wix/himalaya-cli@latest --allow-scripts=esbuild,sharp --include=optional";
|
|
149431
|
+
CLI_INSTALL_COMMAND = SELF_UPDATE_INSTALL_COMMAND;
|
|
149425
149432
|
PUBLIC_NPM_REGISTRY = "https://registry.npmjs.org";
|
|
149426
149433
|
WIX_NPM_MIRROR = "https://npm.dev.wixpress.com";
|
|
149427
149434
|
CLI_PACKAGE_PATH = "@wix%2fhimalaya-cli";
|
|
@@ -162428,22 +162435,100 @@ var init_home_screen_id = __esm({
|
|
|
162428
162435
|
// src/playwright-install.ts
|
|
162429
162436
|
var playwright_install_exports = {};
|
|
162430
162437
|
__export(playwright_install_exports, {
|
|
162438
|
+
CLI_INSTALL_COMMAND: () => CLI_INSTALL_COMMAND2,
|
|
162439
|
+
NO_PLAYWRIGHT_STEPS: () => NO_PLAYWRIGHT_STEPS,
|
|
162440
|
+
browserReadiness: () => browserReadiness,
|
|
162441
|
+
browserUnavailableRefusal: () => browserUnavailableRefusal,
|
|
162442
|
+
installChromium: () => installChromium,
|
|
162443
|
+
noPlaywrightRemedy: () => noPlaywrightRemedy,
|
|
162431
162444
|
playwrightInstallCommand: () => playwrightInstallCommand
|
|
162432
162445
|
});
|
|
162446
|
+
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
162447
|
+
import { existsSync as existsSync52, readFileSync as readFileSync61 } from "node:fs";
|
|
162433
162448
|
import { createRequire as createRequire5 } from "node:module";
|
|
162434
162449
|
import { dirname as dirname33, join as join48 } from "node:path";
|
|
162450
|
+
function noPlaywrightRemedy(platform = process.platform) {
|
|
162451
|
+
return NO_PLAYWRIGHT_STEPS.join(platform === "win32" ? "\n" : " && ");
|
|
162452
|
+
}
|
|
162453
|
+
function playwrightCliPath(resolve98) {
|
|
162454
|
+
try {
|
|
162455
|
+
return join48(dirname33(resolve98("playwright/package.json")), "cli.js");
|
|
162456
|
+
} catch {
|
|
162457
|
+
return void 0;
|
|
162458
|
+
}
|
|
162459
|
+
}
|
|
162435
162460
|
function playwrightInstallCommand(resolve98 = createRequire5(import.meta.url).resolve, platform = process.platform) {
|
|
162461
|
+
const cli = playwrightCliPath(resolve98);
|
|
162462
|
+
if (!cli) return noPlaywrightRemedy(platform);
|
|
162463
|
+
if (platform === "win32") return `node "${cli}" install chromium`;
|
|
162464
|
+
return `node '${cli.replace(/'/g, "'\\''")}' install chromium`;
|
|
162465
|
+
}
|
|
162466
|
+
function browserReadiness(deps = {}) {
|
|
162467
|
+
const require2 = createRequire5(import.meta.url);
|
|
162468
|
+
const resolve98 = deps.resolve ?? require2.resolve;
|
|
162469
|
+
const platform = deps.platform ?? process.platform;
|
|
162470
|
+
const exists = deps.exists ?? existsSync52;
|
|
162471
|
+
const readVersion = deps.readVersion ?? ((path2) => {
|
|
162472
|
+
try {
|
|
162473
|
+
return JSON.parse(readFileSync61(path2, "utf8")).version;
|
|
162474
|
+
} catch {
|
|
162475
|
+
return void 0;
|
|
162476
|
+
}
|
|
162477
|
+
});
|
|
162478
|
+
const chromiumPath = deps.chromiumPath ?? (() => require2("playwright").chromium.executablePath());
|
|
162479
|
+
let pkg;
|
|
162480
|
+
try {
|
|
162481
|
+
pkg = resolve98("playwright/package.json");
|
|
162482
|
+
} catch {
|
|
162483
|
+
return { ready: false, playwright: { installed: false }, chromium: { installed: false }, code: "browser_unavailable", fix: noPlaywrightRemedy(platform), fixSteps: [...NO_PLAYWRIGHT_STEPS] };
|
|
162484
|
+
}
|
|
162485
|
+
const version5 = readVersion(pkg);
|
|
162486
|
+
const playwright = { installed: true, ...version5 ? { version: version5 } : {} };
|
|
162487
|
+
let executablePath;
|
|
162436
162488
|
try {
|
|
162437
|
-
|
|
162438
|
-
if (platform === "win32") return `node "${cli}" install chromium`;
|
|
162439
|
-
return `node '${cli.replace(/'/g, "'\\''")}' install chromium`;
|
|
162489
|
+
executablePath = chromiumPath();
|
|
162440
162490
|
} catch {
|
|
162441
|
-
|
|
162491
|
+
executablePath = void 0;
|
|
162442
162492
|
}
|
|
162493
|
+
if (executablePath && exists(executablePath)) {
|
|
162494
|
+
return { ready: true, playwright, chromium: { installed: true, executablePath } };
|
|
162495
|
+
}
|
|
162496
|
+
return {
|
|
162497
|
+
ready: false,
|
|
162498
|
+
playwright,
|
|
162499
|
+
chromium: { installed: false, ...executablePath ? { executablePath } : {} },
|
|
162500
|
+
code: "browser_unavailable",
|
|
162501
|
+
fix: playwrightInstallCommand(resolve98, platform),
|
|
162502
|
+
fixSteps: [playwrightInstallCommand(resolve98, platform)]
|
|
162503
|
+
};
|
|
162504
|
+
}
|
|
162505
|
+
function installChromium(deps = {}) {
|
|
162506
|
+
const cli = playwrightCliPath(deps.resolve ?? createRequire5(import.meta.url).resolve);
|
|
162507
|
+
if (!cli) return { ok: false, fix: noPlaywrightRemedy(deps.platform), detail: "this CLI has no Playwright, so there is nothing to download a browser for \u2014 reinstall the CLI first" };
|
|
162508
|
+
const result = (deps.spawn ?? spawnSync7)(process.execPath, [cli, "install", "chromium"], { stdio: ["ignore", 2, 2] });
|
|
162509
|
+
if (result.error) return { ok: false, detail: result.error.message };
|
|
162510
|
+
return result.status === 0 ? { ok: true } : { ok: false, detail: `playwright install chromium exited ${result.status}` };
|
|
162511
|
+
}
|
|
162512
|
+
function browserUnavailableRefusal(browser, door) {
|
|
162513
|
+
const fix = browser.fix ?? playwrightInstallCommand();
|
|
162514
|
+
const fixSteps = browser.fixSteps ?? [fix];
|
|
162515
|
+
const missing3 = browser.playwright.installed ? "Chromium is not installed for the CLI's Playwright" : "Playwright is not installed with this CLI";
|
|
162516
|
+
return {
|
|
162517
|
+
ok: false,
|
|
162518
|
+
code: "browser_unavailable",
|
|
162519
|
+
error: `${door} needs Playwright and its Chromium, and ${missing3}. Run ${fixSteps.map((step) => `\`${step}\``).join(", then ")} once (the browser is ~170MB), then re-run.`,
|
|
162520
|
+
fix,
|
|
162521
|
+
fixSteps,
|
|
162522
|
+
hint: "`himi doctor` reports the browser state. To run without the browser on purpose \u2014 no crawl, no screenshots, no theme, static HTML only \u2014 re-run with --no-browser.",
|
|
162523
|
+
browser
|
|
162524
|
+
};
|
|
162443
162525
|
}
|
|
162526
|
+
var CLI_INSTALL_COMMAND2, NO_PLAYWRIGHT_STEPS;
|
|
162444
162527
|
var init_playwright_install = __esm({
|
|
162445
162528
|
"src/playwright-install.ts"() {
|
|
162446
162529
|
init_define_HHP_CATALOG();
|
|
162530
|
+
CLI_INSTALL_COMMAND2 = "npm i -g @wix/himalaya-cli@latest --allow-scripts=esbuild,sharp --include=optional";
|
|
162531
|
+
NO_PLAYWRIGHT_STEPS = [CLI_INSTALL_COMMAND2, "himi doctor --install-browser"];
|
|
162447
162532
|
}
|
|
162448
162533
|
});
|
|
162449
162534
|
|
|
@@ -162502,7 +162587,7 @@ __export(milestones_exports, {
|
|
|
162502
162587
|
});
|
|
162503
162588
|
import { createHash as createHash28, randomUUID as randomUUID10 } from "node:crypto";
|
|
162504
162589
|
import { spawn as spawn4 } from "node:child_process";
|
|
162505
|
-
import { closeSync as closeSync5, existsSync as
|
|
162590
|
+
import { closeSync as closeSync5, existsSync as existsSync53, lstatSync as lstatSync21, readFileSync as readFileSync62, statSync as statSync18 } from "node:fs";
|
|
162506
162591
|
import { createServer as createServer3 } from "node:net";
|
|
162507
162592
|
import { basename as basename17, dirname as dirname34, isAbsolute as isAbsolute5, join as join49, relative as relative12, resolve as resolve47, sep as sep17 } from "node:path";
|
|
162508
162593
|
function homeShotPath(dir, home) {
|
|
@@ -162615,7 +162700,7 @@ function autoPictureGate(dir) {
|
|
|
162615
162700
|
}
|
|
162616
162701
|
async function homePictureAtValidate(dir, opts) {
|
|
162617
162702
|
if (!opts.ok) return { skipped: "validate found errors, so the picture was left as it is" };
|
|
162618
|
-
if (!
|
|
162703
|
+
if (!existsSync53(join49(dir, "himalaya.content.json"))) return { skipped: "not a content package" };
|
|
162619
162704
|
const env = opts.env ?? process.env;
|
|
162620
162705
|
if (ciSet(env)) return { skipped: "the CI environment variable is set" };
|
|
162621
162706
|
if (env.NODE_TEST_CONTEXT) return { skipped: "running under `node --test`" };
|
|
@@ -162685,7 +162770,7 @@ function stillBuilding(dir, image, now) {
|
|
|
162685
162770
|
}
|
|
162686
162771
|
}
|
|
162687
162772
|
function firstLookBeforeOwnPostcard(dir, image, now) {
|
|
162688
|
-
if (!image || !
|
|
162773
|
+
if (!image || !existsSync53(image) || initDivergence(dir).state !== "diverged") return void 0;
|
|
162689
162774
|
return journal(dir, "first-look", withHomeCaveat(yourFirstLookMessage(dir), homeCaveat(dir, image)), { image, ...now ? { now } : {} });
|
|
162690
162775
|
}
|
|
162691
162776
|
function afterRenderPng(dir, input) {
|
|
@@ -162750,13 +162835,13 @@ function testChangeNote(headline2, change) {
|
|
|
162750
162835
|
}
|
|
162751
162836
|
function afterTestRun(dir, input) {
|
|
162752
162837
|
const firstLook = firstLookBeforeOwnPostcard(dir, input.homeShot, input.now);
|
|
162753
|
-
const shot = input.homeShot &&
|
|
162838
|
+
const shot = input.homeShot && existsSync53(input.homeShot) ? input.homeShot : void 0;
|
|
162754
162839
|
const caveat = shot ? homeCaveat(dir, shot) : void 0;
|
|
162755
162840
|
const counts = testPostcardMessage(input);
|
|
162756
162841
|
const headline2 = caveat ? `${counts} But ${caveat}.` : counts;
|
|
162757
162842
|
const postcard = journal(dir, "test", headline2, {
|
|
162758
162843
|
ref: input.runId,
|
|
162759
|
-
...input.homeShot &&
|
|
162844
|
+
...input.homeShot && existsSync53(input.homeShot) ? { image: input.homeShot } : {},
|
|
162760
162845
|
...input.now ? { now: input.now } : {},
|
|
162761
162846
|
unlessUnchanged: true,
|
|
162762
162847
|
changeNote: (change) => testChangeNote(headline2, change)
|
|
@@ -162799,7 +162884,7 @@ function draftPictureGap(input) {
|
|
|
162799
162884
|
if (!input.home) return { reason: "the app's dev/index.ts names no literal homeScreenId, so there is no home screen to picture" };
|
|
162800
162885
|
if (!input.homeShot) return { reason: "the homeScreenId does not name a file under .himi/shots" };
|
|
162801
162886
|
const render2 = `himi render ${shellQuote(input.home)} --png${contentArg(input.content)}`;
|
|
162802
|
-
if (!
|
|
162887
|
+
if (!existsSync53(input.homeShot)) return { reason: "there is no home shot yet", render: render2 };
|
|
162803
162888
|
if (input.sourceChangedAtMs === void 0) return { reason: "the source's last change could not be read, so the home shot cannot be shown to be current", render: render2 };
|
|
162804
162889
|
if (!shotIsCurrent(input.homeShot, input.sourceChangedAtMs)) return { reason: "the home shot is older than the last source edit, so it is not a picture of this draft", render: render2 };
|
|
162805
162890
|
return null;
|
|
@@ -162848,7 +162933,7 @@ function lastDraft(dir) {
|
|
|
162848
162933
|
try {
|
|
162849
162934
|
const file2 = join49(dir, LAST_DRAFT_FILE);
|
|
162850
162935
|
if (!lstatSync21(file2).isFile()) return null;
|
|
162851
|
-
const r3 = JSON.parse(
|
|
162936
|
+
const r3 = JSON.parse(readFileSync62(file2, "utf8"));
|
|
162852
162937
|
const m2 = r3.manifest;
|
|
162853
162938
|
if (r3.v !== 1 || typeof r3.releaseId !== "string" || !m2 || typeof m2.screens !== "object" || !m2.screens || typeof m2.bundles !== "object" || !m2.bundles) return null;
|
|
162854
162939
|
return { releaseId: r3.releaseId, manifest: m2 };
|
|
@@ -162877,7 +162962,7 @@ function draftChangeNote(dir, input) {
|
|
|
162877
162962
|
if (!previous) return void 0;
|
|
162878
162963
|
const shaOf = (i2) => i2 && typeof i2 === "object" && typeof i2.sha256 === "string" ? i2.sha256 : void 0;
|
|
162879
162964
|
const had = Array.isArray(previous.images) ? previous.images.map(shaOf).find(Boolean) : void 0;
|
|
162880
|
-
const has = input.picture &&
|
|
162965
|
+
const has = input.picture && existsSync53(input.picture) ? sha256Of2(input.picture) : void 0;
|
|
162881
162966
|
if (had && has) parts.push(had === has ? "the home screen looks the same" : "the home screen changed");
|
|
162882
162967
|
else if (has) parts.push("a home picture this time");
|
|
162883
162968
|
else return void 0;
|
|
@@ -162910,7 +162995,7 @@ function readInitSource(dir) {
|
|
|
162910
162995
|
const file2 = join49(dir, INIT_SOURCE_FILE);
|
|
162911
162996
|
try {
|
|
162912
162997
|
if (!lstatSync21(file2).isFile()) return null;
|
|
162913
|
-
const r3 = JSON.parse(
|
|
162998
|
+
const r3 = JSON.parse(readFileSync62(file2, "utf8"));
|
|
162914
162999
|
if (r3.v !== 1 || typeof r3.fingerprint !== "string" || !/^[0-9a-f]{64}$/.test(r3.fingerprint) || typeof r3.newestMs !== "number") return null;
|
|
162915
163000
|
return {
|
|
162916
163001
|
v: 1,
|
|
@@ -162943,7 +163028,7 @@ function homeShotForPostcard(dir, opts = {}) {
|
|
|
162943
163028
|
const shot = homeShotPath(dir, home);
|
|
162944
163029
|
if (!shot) return { skipped: "the homeScreenId does not name a file under .himi/shots" };
|
|
162945
163030
|
const render2 = `\`himi render ${shellQuote(home)} --png\``;
|
|
162946
|
-
if (!
|
|
163031
|
+
if (!existsSync53(shot)) return { skipped: `no home shot yet \u2014 ${render2} makes one, and the next postcard carries it` };
|
|
162947
163032
|
let changed;
|
|
162948
163033
|
try {
|
|
162949
163034
|
changed = newestSourceChangeMs(dir);
|
|
@@ -162998,7 +163083,7 @@ function readInitWatch(dir) {
|
|
|
162998
163083
|
const file2 = join49(dir, INIT_WATCH_FILE);
|
|
162999
163084
|
try {
|
|
163000
163085
|
if (!lstatSync21(file2).isFile()) return null;
|
|
163001
|
-
const r3 = JSON.parse(
|
|
163086
|
+
const r3 = JSON.parse(readFileSync62(file2, "utf8"));
|
|
163002
163087
|
if (r3.v !== 1 || typeof r3.pid !== "number" || !Number.isInteger(r3.pid) || r3.pid < 1) return null;
|
|
163003
163088
|
if (typeof r3.url !== "string" || !/^http:\/\/127\.0\.0\.1:\d+\//.test(r3.url) || typeof r3.board !== "string" || typeof r3.log !== "string" || typeof r3.startedAt !== "string") return null;
|
|
163004
163089
|
if (r3.root !== runRootId(dir)) return null;
|
|
@@ -163023,14 +163108,14 @@ function liveWatchRunning(dir, isAlive = pidAlive, now) {
|
|
|
163023
163108
|
}
|
|
163024
163109
|
function watchReminder(dir, opts = {}) {
|
|
163025
163110
|
try {
|
|
163026
|
-
if (!
|
|
163111
|
+
if (!existsSync53(join49(dir, "himalaya.content.json"))) return void 0;
|
|
163027
163112
|
const nowDate = opts.now ?? /* @__PURE__ */ new Date();
|
|
163028
163113
|
const live3 = liveWatch(dir, opts.isAlive, nowDate);
|
|
163029
163114
|
const now = nowDate.getTime();
|
|
163030
163115
|
const file2 = join49(dir, REMINDERS_FILE);
|
|
163031
163116
|
let last = Number.NaN;
|
|
163032
163117
|
try {
|
|
163033
|
-
if (lstatSync21(file2).isFile()) last = Date.parse(JSON.parse(
|
|
163118
|
+
if (lstatSync21(file2).isFile()) last = Date.parse(JSON.parse(readFileSync62(file2, "utf8")).watch ?? "");
|
|
163034
163119
|
} catch {
|
|
163035
163120
|
}
|
|
163036
163121
|
if (Number.isFinite(last) && now - last >= 0 && now - last < WATCH_REMINDER_EVERY_MS) return void 0;
|
|
@@ -163192,7 +163277,7 @@ var init_milestones = __esm({
|
|
|
163192
163277
|
INIT_SOURCE_FILE = join49(".himi", "init-source.json");
|
|
163193
163278
|
STARTING_POINT_REF = "starting-point";
|
|
163194
163279
|
TEMPLATE_NAME2 = /^[A-Za-z0-9._-]{1,64}$/;
|
|
163195
|
-
sha256Of2 = (file2) => createHash28("sha256").update(
|
|
163280
|
+
sha256Of2 = (file2) => createHash28("sha256").update(readFileSync62(file2)).digest("hex");
|
|
163196
163281
|
WATCH_REMINDER_EVERY_MS = 10 * 60 * 1e3;
|
|
163197
163282
|
REMINDERS_FILE = join49(".himi", "reminders.json");
|
|
163198
163283
|
pidAlive = (pid) => {
|
|
@@ -163487,7 +163572,7 @@ var init_car = __esm({
|
|
|
163487
163572
|
});
|
|
163488
163573
|
|
|
163489
163574
|
// src/surface-lint.ts
|
|
163490
|
-
import { existsSync as
|
|
163575
|
+
import { existsSync as existsSync55, readFileSync as readFileSync63 } from "node:fs";
|
|
163491
163576
|
import { join as join51 } from "node:path";
|
|
163492
163577
|
function surfaceIssues(dir, surfaceNav, strict) {
|
|
163493
163578
|
const issues = [];
|
|
@@ -163496,10 +163581,10 @@ function surfaceIssues(dir, surfaceNav, strict) {
|
|
|
163496
163581
|
let platforms = {};
|
|
163497
163582
|
let envelopeUnreadable = false;
|
|
163498
163583
|
const p2 = join51(dir, "platforms.json");
|
|
163499
|
-
if (
|
|
163584
|
+
if (existsSync55(p2)) {
|
|
163500
163585
|
let raw;
|
|
163501
163586
|
try {
|
|
163502
|
-
raw = JSON.parse(
|
|
163587
|
+
raw = JSON.parse(readFileSync63(p2, "utf8"));
|
|
163503
163588
|
} catch (e2) {
|
|
163504
163589
|
error(`platforms.json: unparsable JSON \u2014 ${e2.message}`);
|
|
163505
163590
|
envelopeUnreadable = true;
|
|
@@ -163529,8 +163614,8 @@ function surfaceIssues(dir, surfaceNav, strict) {
|
|
|
163529
163614
|
}
|
|
163530
163615
|
if (envelopeUnreadable) return issues;
|
|
163531
163616
|
const configTs = join51(dir, "config.ts");
|
|
163532
|
-
if (
|
|
163533
|
-
const declared = parseCarConfig(
|
|
163617
|
+
if (existsSync55(configTs)) {
|
|
163618
|
+
const declared = parseCarConfig(readFileSync63(configTs, "utf8")).category;
|
|
163534
163619
|
const inEnvelope = platforms.androidauto === true;
|
|
163535
163620
|
if (inEnvelope && !declared) {
|
|
163536
163621
|
error(
|
|
@@ -163554,7 +163639,7 @@ function surfaceIssues(dir, surfaceNav, strict) {
|
|
|
163554
163639
|
}
|
|
163555
163640
|
function readLocalPlatforms(dir) {
|
|
163556
163641
|
try {
|
|
163557
|
-
const raw = JSON.parse(
|
|
163642
|
+
const raw = JSON.parse(readFileSync63(join51(dir, "platforms.json"), "utf8"));
|
|
163558
163643
|
return Object.fromEntries(
|
|
163559
163644
|
Object.entries(raw).filter(([k2, v2]) => VALID_PLATFORM_KEYS2.has(k2) && typeof v2 === "boolean")
|
|
163560
163645
|
);
|
|
@@ -163812,14 +163897,14 @@ var init_brand_color_math = __esm({
|
|
|
163812
163897
|
});
|
|
163813
163898
|
|
|
163814
163899
|
// src/token-lint.ts
|
|
163815
|
-
import { existsSync as
|
|
163900
|
+
import { existsSync as existsSync56, readFileSync as readFileSync64 } from "node:fs";
|
|
163816
163901
|
import { join as join52 } from "node:path";
|
|
163817
163902
|
import ts9 from "typescript";
|
|
163818
163903
|
function configuredTokensPath(dir) {
|
|
163819
163904
|
for (const name of ["config.ts", "config.js", "himi.config.ts"]) {
|
|
163820
163905
|
const f2 = join52(dir, name);
|
|
163821
|
-
if (!
|
|
163822
|
-
const src =
|
|
163906
|
+
if (!existsSync56(f2)) continue;
|
|
163907
|
+
const src = readFileSync64(f2, "utf8");
|
|
163823
163908
|
const app = defineAppLiteral(ts9.createSourceFile(f2, src, ts9.ScriptTarget.Latest, true));
|
|
163824
163909
|
if (!app) return { computed: true };
|
|
163825
163910
|
const field = lookup3(app, "designTokensPath");
|
|
@@ -163884,7 +163969,7 @@ function tokenNumericIssues(tokens2, tokensPath = "tokens.json") {
|
|
|
163884
163969
|
function tokenNumericIssuesFor(dir) {
|
|
163885
163970
|
const tokensPath = configuredTokensPath(dir).path ?? "tokens.json";
|
|
163886
163971
|
try {
|
|
163887
|
-
return tokenNumericIssues(JSON.parse(
|
|
163972
|
+
return tokenNumericIssues(JSON.parse(readFileSync64(join52(dir, tokensPath), "utf8")), tokensPath);
|
|
163888
163973
|
} catch {
|
|
163889
163974
|
return [];
|
|
163890
163975
|
}
|
|
@@ -163901,7 +163986,7 @@ function tokenColorIssues(dir, tokensPathOverride) {
|
|
|
163901
163986
|
}
|
|
163902
163987
|
const tokensPath = configured.path ?? "tokens.json";
|
|
163903
163988
|
const p2 = join52(dir, tokensPath);
|
|
163904
|
-
if (!
|
|
163989
|
+
if (!existsSync56(p2)) {
|
|
163905
163990
|
if (tokensPath !== "tokens.json") {
|
|
163906
163991
|
warn3(`config designTokensPath points at ${tokensPath}, which does not exist -- colour tokens were not checked`);
|
|
163907
163992
|
}
|
|
@@ -163909,7 +163994,7 @@ function tokenColorIssues(dir, tokensPathOverride) {
|
|
|
163909
163994
|
}
|
|
163910
163995
|
let raw;
|
|
163911
163996
|
try {
|
|
163912
|
-
raw = JSON.parse(
|
|
163997
|
+
raw = JSON.parse(readFileSync64(p2, "utf8"));
|
|
163913
163998
|
} catch (e2) {
|
|
163914
163999
|
error(`${tokensPath}: unparsable JSON \u2014 ${e2.message}`);
|
|
163915
164000
|
return issues;
|
|
@@ -164281,11 +164366,11 @@ __export(fonts_exports, {
|
|
|
164281
164366
|
listReport: () => listReport,
|
|
164282
164367
|
resolveFamilyName: () => resolveFamilyName
|
|
164283
164368
|
});
|
|
164284
|
-
import { existsSync as
|
|
164369
|
+
import { existsSync as existsSync57, readFileSync as readFileSync65 } from "node:fs";
|
|
164285
164370
|
import { join as join53 } from "node:path";
|
|
164286
164371
|
function readJson6(path2, fallback) {
|
|
164287
164372
|
try {
|
|
164288
|
-
return JSON.parse(
|
|
164373
|
+
return JSON.parse(readFileSync65(path2, "utf8"));
|
|
164289
164374
|
} catch {
|
|
164290
164375
|
return fallback;
|
|
164291
164376
|
}
|
|
@@ -164315,7 +164400,7 @@ function listReport(opts = {}) {
|
|
|
164315
164400
|
}
|
|
164316
164401
|
async function fontFindings(appDir3, opts = {}) {
|
|
164317
164402
|
const tokensPath = join53(appDir3, configuredTokensPath(appDir3).path ?? "tokens.json");
|
|
164318
|
-
if (!
|
|
164403
|
+
if (!existsSync57(tokensPath)) return null;
|
|
164319
164404
|
const catalog4 = loadCatalog2();
|
|
164320
164405
|
const tokens2 = readJson6(tokensPath, {});
|
|
164321
164406
|
const policy = readJson6(join53(appDir3, "fonts.json"), {});
|
|
@@ -164471,7 +164556,7 @@ __export(template_sweep_exports, {
|
|
|
164471
164556
|
sweepCopy: () => sweepCopy,
|
|
164472
164557
|
sweepPairs: () => sweepPairs
|
|
164473
164558
|
});
|
|
164474
|
-
import { readFileSync as
|
|
164559
|
+
import { readFileSync as readFileSync67, writeFileSync as writeFileSync24 } from "node:fs";
|
|
164475
164560
|
import { join as join55 } from "node:path";
|
|
164476
164561
|
import ts10 from "typescript";
|
|
164477
164562
|
function isCopy(node3, file2) {
|
|
@@ -164522,7 +164607,7 @@ function sweepCopy(dir, pairs2, dryRun) {
|
|
|
164522
164607
|
const next = /* @__PURE__ */ new Map();
|
|
164523
164608
|
const replaced = pairs2.map(([from, to2]) => ({ from, to: to2, files: {} }));
|
|
164524
164609
|
for (const f2 of files) {
|
|
164525
|
-
const text15 =
|
|
164610
|
+
const text15 = readFileSync67(join55(dir, f2), "utf8");
|
|
164526
164611
|
if (!pairs2.some(([from]) => text15.includes(from) || text15.includes(JSON.stringify(from).slice(1, -1)))) continue;
|
|
164527
164612
|
if (/^l10n\/[^/]+\.json$/.test(f2)) {
|
|
164528
164613
|
const catalog4 = JSON.parse(text15);
|
|
@@ -164579,8 +164664,8 @@ ${out2}`;
|
|
|
164579
164664
|
if (errors.length) throw new TrimRefusal(`the sweep would break ${f2} \u2014 nothing written: ${errors[0]}`);
|
|
164580
164665
|
next.set(f2, out2);
|
|
164581
164666
|
}
|
|
164582
|
-
const devBefore =
|
|
164583
|
-
const configBefore =
|
|
164667
|
+
const devBefore = readFileSync67(join55(dir, "dev", "index.ts"), "utf8");
|
|
164668
|
+
const configBefore = readFileSync67(join55(dir, "config.ts"), "utf8");
|
|
164584
164669
|
if (parses(devBefore, configBefore)) {
|
|
164585
164670
|
try {
|
|
164586
164671
|
parseApp(next.get("dev/index.ts") ?? devBefore, next.get("config.ts") ?? configBefore);
|
|
@@ -164590,7 +164675,7 @@ ${out2}`;
|
|
|
164590
164675
|
}
|
|
164591
164676
|
if (!dryRun) for (const [f2, t2] of next) writeFileSync24(join55(dir, f2), t2);
|
|
164592
164677
|
const g2 = new RegExp(PLACEHOLDER.source, `${PLACEHOLDER.flags.replace("g", "")}g`);
|
|
164593
|
-
const placeholdersLeft = all.reduce((n2, f2) => n2 + [...(next.get(f2) ??
|
|
164678
|
+
const placeholdersLeft = all.reduce((n2, f2) => n2 + [...(next.get(f2) ?? readFileSync67(join55(dir, f2), "utf8")).matchAll(g2)].length, 0);
|
|
164594
164679
|
return {
|
|
164595
164680
|
ok: true,
|
|
164596
164681
|
dryRun,
|
|
@@ -164607,7 +164692,7 @@ function sweepPairs(set2, mapFile) {
|
|
|
164607
164692
|
pairs2.push([s2.slice(0, at2), s2.slice(at2 + 2)]);
|
|
164608
164693
|
}
|
|
164609
164694
|
if (mapFile) {
|
|
164610
|
-
const map2 = JSON.parse(
|
|
164695
|
+
const map2 = JSON.parse(readFileSync67(mapFile, "utf8"));
|
|
164611
164696
|
for (const [k2, v2] of Object.entries(map2)) {
|
|
164612
164697
|
if (typeof v2 !== "string") throw new TrimRefusal(`--map ${mapFile}: "${k2}" must map to a string`);
|
|
164613
164698
|
pairs2.push([k2, v2]);
|
|
@@ -164960,7 +165045,7 @@ __export(template_recommend_exports, {
|
|
|
164960
165045
|
recommendTemplates: () => recommendTemplates,
|
|
164961
165046
|
verticalsFromBook: () => verticalsFromBook
|
|
164962
165047
|
});
|
|
164963
|
-
import { existsSync as
|
|
165048
|
+
import { existsSync as existsSync59, readFileSync as readFileSync68 } from "node:fs";
|
|
164964
165049
|
import { join as join56 } from "node:path";
|
|
164965
165050
|
function probeStatus(p2) {
|
|
164966
165051
|
const ran = [p2?.owner?.status, p2?.visitor?.status].filter((s2) => typeof s2 === "string" && s2 !== "skipped");
|
|
@@ -164981,23 +165066,23 @@ function probeFindings(probes) {
|
|
|
164981
165066
|
return `no installed vertical with content \u2014 the vertical probes ran and found ${parts.join("; ")}`;
|
|
164982
165067
|
}
|
|
164983
165068
|
function readBookSignal(path2) {
|
|
164984
|
-
const dir =
|
|
165069
|
+
const dir = existsSync59(join56(path2, "book.json")) || existsSync59(join56(path2, "provisioning.overlay.json")) ? path2 : join56(path2, ".himi", "business-book");
|
|
164985
165070
|
const overlayPath = join56(dir, "provisioning.overlay.json");
|
|
164986
165071
|
const bookPath = join56(dir, "book.json");
|
|
164987
|
-
if (!
|
|
165072
|
+
if (!existsSync59(overlayPath) && !existsSync59(bookPath)) {
|
|
164988
165073
|
throw new BookRefusal("book_not_found", `no book.json / provisioning.overlay.json under ${path2} \u2014 run \`himi site analyze --url <site> --out <dir>\` first and pass that dir, or pass --verticals / --text`);
|
|
164989
165074
|
}
|
|
164990
165075
|
const lacked = [];
|
|
164991
165076
|
const verticalsFrom = [];
|
|
164992
165077
|
let verticals = [];
|
|
164993
|
-
if (
|
|
165078
|
+
if (existsSync59(overlayPath)) {
|
|
164994
165079
|
const v2 = readJson7(overlayPath)?.installedVerticals;
|
|
164995
165080
|
if (Array.isArray(v2) && v2.length) {
|
|
164996
165081
|
verticals = v2.filter((x2) => typeof x2 === "string");
|
|
164997
165082
|
if (verticals.length) verticalsFrom.push("overlay");
|
|
164998
165083
|
}
|
|
164999
165084
|
}
|
|
165000
|
-
const book =
|
|
165085
|
+
const book = existsSync59(bookPath) ? readJson7(bookPath) ?? {} : void 0;
|
|
165001
165086
|
if (!verticals.length && book && Array.isArray(book.probes)) {
|
|
165002
165087
|
verticals = installedFromProbes(book.probes);
|
|
165003
165088
|
if (verticals.length) verticalsFrom.push("probes");
|
|
@@ -165130,7 +165215,7 @@ var init_template_recommend = __esm({
|
|
|
165130
165215
|
IS_404 = /^\s*404\b|\bpage not found\b/i;
|
|
165131
165216
|
readJson7 = (path2) => {
|
|
165132
165217
|
try {
|
|
165133
|
-
return JSON.parse(
|
|
165218
|
+
return JSON.parse(readFileSync68(path2, "utf8"));
|
|
165134
165219
|
} catch (e2) {
|
|
165135
165220
|
throw new BookRefusal("book_unreadable", `${path2} is not readable JSON (${e2.message}) \u2014 re-run \`himi site analyze\` to rewrite it`);
|
|
165136
165221
|
}
|
|
@@ -165702,7 +165787,7 @@ var init_glyphs = __esm({
|
|
|
165702
165787
|
});
|
|
165703
165788
|
|
|
165704
165789
|
// ../app-icons/plan.ts
|
|
165705
|
-
import { existsSync as
|
|
165790
|
+
import { existsSync as existsSync60, readFileSync as readFileSync69, readdirSync as readdirSync32 } from "node:fs";
|
|
165706
165791
|
import { createHash as createHash29 } from "node:crypto";
|
|
165707
165792
|
import { dirname as dirname35, join as join57, resolve as resolve49 } from "node:path";
|
|
165708
165793
|
function stripComments(src) {
|
|
@@ -165838,10 +165923,10 @@ function resolveTokensPath(app, configTs) {
|
|
|
165838
165923
|
}
|
|
165839
165924
|
function resolveToken(app, token, tokensPathOverride) {
|
|
165840
165925
|
const tokensPath = tokensPathOverride ?? join57(appDir(app), "tokens.json");
|
|
165841
|
-
if (!
|
|
165926
|
+
if (!existsSync60(tokensPath)) {
|
|
165842
165927
|
throw new Error(`app-icons: ${app} has no tokens.json at ${tokensPath} (needed to resolve "${token}").`);
|
|
165843
165928
|
}
|
|
165844
|
-
const tokens2 = JSON.parse(
|
|
165929
|
+
const tokens2 = JSON.parse(readFileSync69(tokensPath, "utf8"));
|
|
165845
165930
|
const value2 = tokens2.colors?.[token];
|
|
165846
165931
|
if (value2 === void 0) {
|
|
165847
165932
|
throw new Error(`app-icons: ${app} references icon colour token "${token}" but tokens.json has no such color.`);
|
|
@@ -165883,7 +165968,7 @@ function iconSpec(app, configTs, id, tokensPathOverride) {
|
|
|
165883
165968
|
const tokens2 = tokensPathOverride ?? resolveTokensPath(app, configTs).path;
|
|
165884
165969
|
if (cfg.source) {
|
|
165885
165970
|
const abs = resolve49(appDir(app), cfg.source);
|
|
165886
|
-
if (!
|
|
165971
|
+
if (!existsSync60(abs)) {
|
|
165887
165972
|
throw new Error(`app-icons: ${app} declares icon.source "${cfg.source}" but ${abs} does not exist.`);
|
|
165888
165973
|
}
|
|
165889
165974
|
return {
|
|
@@ -165923,9 +166008,9 @@ function iosAssetCatalog2(app) {
|
|
|
165923
166008
|
return assetCatalogIn(join57(appDir(app), "ios"));
|
|
165924
166009
|
}
|
|
165925
166010
|
function assetCatalogIn(platformDir) {
|
|
165926
|
-
if (!
|
|
166011
|
+
if (!existsSync60(platformDir)) return void 0;
|
|
165927
166012
|
const children = readdirSync32(platformDir).filter((c2) => !c2.startsWith("build")).sort();
|
|
165928
|
-
const catalogs = children.map((c2) => join57(platformDir, c2, "Assets.xcassets")).filter(
|
|
166013
|
+
const catalogs = children.map((c2) => join57(platformDir, c2, "Assets.xcassets")).filter(existsSync60);
|
|
165929
166014
|
if (catalogs.length === 1) return catalogs[0];
|
|
165930
166015
|
if (catalogs.length > 1) return void 0;
|
|
165931
166016
|
const targets = [];
|
|
@@ -165948,15 +166033,15 @@ function androidResDir2(manifestPath) {
|
|
|
165948
166033
|
}
|
|
165949
166034
|
function androidManifestPath(app) {
|
|
165950
166035
|
const androidDir = join57(appDir(app), "android");
|
|
165951
|
-
if (!
|
|
166036
|
+
if (!existsSync60(androidDir)) return void 0;
|
|
165952
166037
|
const preferred = join57(androidDir, `${app}-app`, "src", "main", "AndroidManifest.xml");
|
|
165953
|
-
if (
|
|
165954
|
-
const candidates = readdirSync32(androidDir, { withFileTypes: true }).filter((d2) => d2.isDirectory() && d2.name.endsWith("-app")).map((d2) => join57(androidDir, d2.name, "src", "main", "AndroidManifest.xml")).filter(
|
|
166038
|
+
if (existsSync60(preferred)) return preferred;
|
|
166039
|
+
const candidates = readdirSync32(androidDir, { withFileTypes: true }).filter((d2) => d2.isDirectory() && d2.name.endsWith("-app")).map((d2) => join57(androidDir, d2.name, "src", "main", "AndroidManifest.xml")).filter(existsSync60);
|
|
165955
166040
|
return candidates.length === 1 ? candidates[0] : void 0;
|
|
165956
166041
|
}
|
|
165957
166042
|
function androidOptedIn2(manifestPath) {
|
|
165958
|
-
if (!manifestPath || !
|
|
165959
|
-
return
|
|
166043
|
+
if (!manifestPath || !existsSync60(manifestPath)) return false;
|
|
166044
|
+
return readFileSync69(manifestPath, "utf8").includes("@mipmap/ic_launcher");
|
|
165960
166045
|
}
|
|
165961
166046
|
function templateIconSha256() {
|
|
165962
166047
|
const cat = iosAssetCatalog2("_template");
|
|
@@ -165968,7 +166053,7 @@ function placeholderHashes() {
|
|
|
165968
166053
|
}
|
|
165969
166054
|
function fileSha256(path2) {
|
|
165970
166055
|
try {
|
|
165971
|
-
return createHash29("sha256").update(
|
|
166056
|
+
return createHash29("sha256").update(readFileSync69(path2)).digest("hex");
|
|
165972
166057
|
} catch {
|
|
165973
166058
|
return null;
|
|
165974
166059
|
}
|
|
@@ -165980,7 +166065,7 @@ function generationAllowed(app, configTs, opts = {}) {
|
|
|
165980
166065
|
}
|
|
165981
166066
|
const iosCat = iosAssetCatalog2(app);
|
|
165982
166067
|
const iosIcon = iosCat ? join57(iosCat, "AppIcon.appiconset", "icon_1024.png") : void 0;
|
|
165983
|
-
if (!iosIcon || !
|
|
166068
|
+
if (!iosIcon || !existsSync60(iosIcon)) return { allowed: true, reason: "no icon yet" };
|
|
165984
166069
|
const hash3 = fileSha256(iosIcon);
|
|
165985
166070
|
const placeholders = opts.placeholderHashes ?? placeholderHashes();
|
|
165986
166071
|
if (app === "_template") return { allowed: true, reason: "the template itself" };
|
|
@@ -166005,7 +166090,7 @@ var init_plan2 = __esm({
|
|
|
166005
166090
|
});
|
|
166006
166091
|
|
|
166007
166092
|
// ../native-config/icon.ts
|
|
166008
|
-
import { existsSync as
|
|
166093
|
+
import { existsSync as existsSync61, readFileSync as readFileSync70 } from "node:fs";
|
|
166009
166094
|
import { join as join58 } from "node:path";
|
|
166010
166095
|
function androidAdaptiveIconXml() {
|
|
166011
166096
|
return [
|
|
@@ -166034,7 +166119,7 @@ function androidIconArtifacts(app, configTs) {
|
|
|
166034
166119
|
if (!generationAllowed(app, configTs).allowed) return [];
|
|
166035
166120
|
const res = androidResDir2(manifest2);
|
|
166036
166121
|
const foreground = join58(res, "mipmap-mdpi", "ic_launcher_foreground.png");
|
|
166037
|
-
if (!
|
|
166122
|
+
if (!existsSync61(foreground)) {
|
|
166038
166123
|
throw new Error(
|
|
166039
166124
|
`native-config icon: ${app} opts into @mipmap/ic_launcher but has no mipmap-*/ic_launcher_foreground.png. Run \`npm run app-icons -- ${app}\` first \u2014 the XML emitted here points at those rasters.`
|
|
166040
166125
|
);
|
|
@@ -169351,7 +169436,7 @@ var init_release_auth = __esm({
|
|
|
169351
169436
|
});
|
|
169352
169437
|
|
|
169353
169438
|
// ../store-release/gen-privacy.ts
|
|
169354
|
-
import { existsSync as
|
|
169439
|
+
import { existsSync as existsSync62, readFileSync as readFileSync71 } from "node:fs";
|
|
169355
169440
|
import { join as join59 } from "node:path";
|
|
169356
169441
|
function normalizeCapability(id) {
|
|
169357
169442
|
return id.trim().replace(/_/g, "-");
|
|
@@ -169520,7 +169605,7 @@ function renderPrivacyManifest(plan) {
|
|
|
169520
169605
|
return lines.join("\n") + "\n";
|
|
169521
169606
|
}
|
|
169522
169607
|
function appPrivacyPlan(app) {
|
|
169523
|
-
const read = (p2) =>
|
|
169608
|
+
const read = (p2) => existsSync62(p2) ? readFileSync71(p2, "utf8") : void 0;
|
|
169524
169609
|
const configTs = read(appConfigTs(app)) ?? "";
|
|
169525
169610
|
const distText = read(join59(appDir(app), "distribution.json"));
|
|
169526
169611
|
const coreVersion = binaryCoreVersion(distText, configTs);
|
|
@@ -169588,12 +169673,12 @@ var init_localweb = __esm({
|
|
|
169588
169673
|
});
|
|
169589
169674
|
|
|
169590
169675
|
// ../native-config/capability-registrations.ts
|
|
169591
|
-
import { existsSync as
|
|
169676
|
+
import { existsSync as existsSync63, readdirSync as readdirSync33, readFileSync as readFileSync72, statSync as statSync19 } from "node:fs";
|
|
169592
169677
|
import { dirname as dirname36, join as join60, resolve as resolve50 } from "node:path";
|
|
169593
169678
|
import { fileURLToPath as fileURLToPath28 } from "node:url";
|
|
169594
169679
|
function registrarClasses(path2, re2) {
|
|
169595
169680
|
const out2 = /* @__PURE__ */ new Map();
|
|
169596
|
-
for (const m2 of
|
|
169681
|
+
for (const m2 of readFileSync72(path2, "utf8").matchAll(re2)) out2.set(m2[1], m2[2]);
|
|
169597
169682
|
return out2;
|
|
169598
169683
|
}
|
|
169599
169684
|
function iosRegistrarClasses() {
|
|
@@ -169632,7 +169717,7 @@ function renderKotlinRegistrations(ids, appIdExpr = "APP_NAME", classes = androi
|
|
|
169632
169717
|
];
|
|
169633
169718
|
}
|
|
169634
169719
|
function filesWithRegisterMarkers(root, ext) {
|
|
169635
|
-
if (!
|
|
169720
|
+
if (!existsSync63(root)) return [];
|
|
169636
169721
|
const out2 = [];
|
|
169637
169722
|
const stack = [[root, 0, ext === ".kt" ? "project" : "main"]];
|
|
169638
169723
|
while (stack.length) {
|
|
@@ -169654,7 +169739,7 @@ function filesWithRegisterMarkers(root, ext) {
|
|
|
169654
169739
|
stack.push([path2, depth + 1, "main"]);
|
|
169655
169740
|
}
|
|
169656
169741
|
} else if (where === "main" && entry.isFile() && entry.name.endsWith(ext) && statSync19(path2).size <= 1 << 20) {
|
|
169657
|
-
if (
|
|
169742
|
+
if (readFileSync72(path2, "utf8").includes(`>>> ${LABEL_CAPABILITIES_REGISTER} `)) out2.push(path2);
|
|
169658
169743
|
}
|
|
169659
169744
|
}
|
|
169660
169745
|
}
|
|
@@ -169752,7 +169837,7 @@ __export(version_exports, {
|
|
|
169752
169837
|
stampTargetVersion: () => stampTargetVersion,
|
|
169753
169838
|
stampVersionKeys: () => stampVersionKeys
|
|
169754
169839
|
});
|
|
169755
|
-
import { readFileSync as
|
|
169840
|
+
import { readFileSync as readFileSync73, writeFileSync as writeFileSync25 } from "node:fs";
|
|
169756
169841
|
function readIosVersion(projectYml) {
|
|
169757
169842
|
const marketing = matchScalar(projectYml, "CFBundleShortVersionString");
|
|
169758
169843
|
const build3 = matchScalar(projectYml, "CFBundleVersion");
|
|
@@ -169902,8 +169987,8 @@ function setAndroidVersion(gradle, v2) {
|
|
|
169902
169987
|
function bumpVersion(app, opts) {
|
|
169903
169988
|
const iosPath = iosProjectYml(app);
|
|
169904
169989
|
const gradlePath = androidGradle(app);
|
|
169905
|
-
const iosYml =
|
|
169906
|
-
const gradle =
|
|
169990
|
+
const iosYml = readFileSync73(iosPath, "utf8");
|
|
169991
|
+
const gradle = readFileSync73(gradlePath, "utf8");
|
|
169907
169992
|
const current = readIosVersion(iosYml);
|
|
169908
169993
|
const next = {
|
|
169909
169994
|
marketing: opts.marketing ?? current.marketing,
|
|
@@ -170247,7 +170332,7 @@ __export(gen_native_config_exports, {
|
|
|
170247
170332
|
xmlAttr: () => xmlAttr2,
|
|
170248
170333
|
yamlScalar: () => yamlScalar
|
|
170249
170334
|
});
|
|
170250
|
-
import { existsSync as
|
|
170335
|
+
import { existsSync as existsSync64, mkdirSync as mkdirSync29, readFileSync as readFileSync74, readdirSync as readdirSync34, rmSync as rmSync18, statSync as statSync20, writeFileSync as writeFileSync26 } from "node:fs";
|
|
170251
170336
|
import { dirname as dirname37, join as join61 } from "node:path";
|
|
170252
170337
|
import { fileURLToPath as fileURLToPath29 } from "node:url";
|
|
170253
170338
|
function withoutComments(src) {
|
|
@@ -170356,8 +170441,8 @@ function buildSet(capabilities, envelope = []) {
|
|
|
170356
170441
|
}
|
|
170357
170442
|
function loadOverrides(app) {
|
|
170358
170443
|
const p2 = join61(appDir(app), "native-config.overrides.json");
|
|
170359
|
-
if (!
|
|
170360
|
-
return JSON.parse(
|
|
170444
|
+
if (!existsSync64(p2)) return {};
|
|
170445
|
+
return JSON.parse(readFileSync74(p2, "utf8"));
|
|
170361
170446
|
}
|
|
170362
170447
|
function needsQuote(s2) {
|
|
170363
170448
|
if (s2 === "") return true;
|
|
@@ -170583,7 +170668,7 @@ function genCoreModuleInstallers(check) {
|
|
|
170583
170668
|
}
|
|
170584
170669
|
function swiftFilesWithModuleMarkers(app) {
|
|
170585
170670
|
const root = join61(appDir(app), "ios");
|
|
170586
|
-
if (!
|
|
170671
|
+
if (!existsSync64(root)) return [];
|
|
170587
170672
|
const out2 = [];
|
|
170588
170673
|
const stack = [root];
|
|
170589
170674
|
while (stack.length) {
|
|
@@ -170594,7 +170679,7 @@ function swiftFilesWithModuleMarkers(app) {
|
|
|
170594
170679
|
if (entry.isDirectory()) {
|
|
170595
170680
|
if (!entry.name.endsWith(".xcodeproj")) stack.push(path2);
|
|
170596
170681
|
} else if (entry.isFile() && entry.name.endsWith(".swift")) {
|
|
170597
|
-
const text15 =
|
|
170682
|
+
const text15 = readFileSync74(path2, "utf8");
|
|
170598
170683
|
if (hasMarkers(text15, "slash", LABEL_MODULES_SWIFT_IMPORT) || hasMarkers(text15, "slash", LABEL_MODULES_SWIFT_INSTALL)) out2.push(path2);
|
|
170599
170684
|
}
|
|
170600
170685
|
}
|
|
@@ -170605,7 +170690,7 @@ function kotlinFilesWithModuleInstall(app) {
|
|
|
170605
170690
|
return kotlinBootSourcesUnder(join61(appDir(app), "android"));
|
|
170606
170691
|
}
|
|
170607
170692
|
function kotlinBootSourcesUnder(root) {
|
|
170608
|
-
if (!
|
|
170693
|
+
if (!existsSync64(root)) return [];
|
|
170609
170694
|
const out2 = [];
|
|
170610
170695
|
const stack = [[root, 0, "project"]];
|
|
170611
170696
|
while (stack.length) {
|
|
@@ -170623,7 +170708,7 @@ function kotlinBootSourcesUnder(root) {
|
|
|
170623
170708
|
} else {
|
|
170624
170709
|
stack.push([path2, depth + 1, "main"]);
|
|
170625
170710
|
}
|
|
170626
|
-
} else if (where === "main" && entry.isFile() && entry.name.endsWith("Application.kt") && statSync20(path2).size <= BOOT_SOURCE_MAX_BYTES &&
|
|
170711
|
+
} else if (where === "main" && entry.isFile() && entry.name.endsWith("Application.kt") && statSync20(path2).size <= BOOT_SOURCE_MAX_BYTES && readFileSync74(path2, "utf8").includes("installLinkedModules")) {
|
|
170627
170712
|
out2.push(path2);
|
|
170628
170713
|
}
|
|
170629
170714
|
}
|
|
@@ -170642,7 +170727,7 @@ function duplicateModuleInstalls(...texts) {
|
|
|
170642
170727
|
});
|
|
170643
170728
|
}
|
|
170644
170729
|
function assertSingleModuleInstall(app, paths2) {
|
|
170645
|
-
const dup = duplicateModuleInstalls(...paths2.map((p2) =>
|
|
170730
|
+
const dup = duplicateModuleInstalls(...paths2.map((p2) => readFileSync74(p2, "utf8")));
|
|
170646
170731
|
if (dup.length) {
|
|
170647
170732
|
throw new Error(
|
|
170648
170733
|
`native-config: ${app}: ${dup.join(", ")} is called more than once across ${paths2.join(", ")} \u2014 a merge duplicated the module install; keep one call`
|
|
@@ -170676,7 +170761,7 @@ function endText(kind, label3, indent) {
|
|
|
170676
170761
|
}
|
|
170677
170762
|
function hostAppliesDeferredWidgetActions(app) {
|
|
170678
170763
|
const root = join61(appDir(app), "ios");
|
|
170679
|
-
if (!
|
|
170764
|
+
if (!existsSync64(root)) return false;
|
|
170680
170765
|
const stack = [root];
|
|
170681
170766
|
while (stack.length) {
|
|
170682
170767
|
const dir = stack.pop();
|
|
@@ -170687,7 +170772,7 @@ function hostAppliesDeferredWidgetActions(app) {
|
|
|
170687
170772
|
if (entry.name.endsWith(".xcodeproj") || entry.name === "build") continue;
|
|
170688
170773
|
stack.push(path2);
|
|
170689
170774
|
} else if (entry.name.endsWith(".swift")) {
|
|
170690
|
-
if (
|
|
170775
|
+
if (readFileSync74(path2, "utf8").includes("WidgetActionRelay.drain(")) return true;
|
|
170691
170776
|
}
|
|
170692
170777
|
}
|
|
170693
170778
|
}
|
|
@@ -170734,16 +170819,16 @@ function androidAppGradle(app) {
|
|
|
170734
170819
|
function androidManifestPath2(app) {
|
|
170735
170820
|
const androidDir = join61(appDir(app), "android");
|
|
170736
170821
|
const preferred = join61(androidDir, `${app}-app`, "src", "main", "AndroidManifest.xml");
|
|
170737
|
-
if (
|
|
170738
|
-
const candidates =
|
|
170822
|
+
if (existsSync64(preferred)) return preferred;
|
|
170823
|
+
const candidates = existsSync64(androidDir) ? readdirSync34(androidDir, { withFileTypes: true }).filter((d2) => d2.isDirectory() && d2.name.endsWith("-app")).map((d2) => join61(androidDir, d2.name, "src", "main", "AndroidManifest.xml")).filter(existsSync64) : [];
|
|
170739
170824
|
return candidates.length === 1 ? candidates[0] : preferred;
|
|
170740
170825
|
}
|
|
170741
170826
|
function automotiveAppDescPath(app) {
|
|
170742
170827
|
return join61(dirname37(androidManifestPath2(app)), "res", "xml", "automotive_app_desc.xml");
|
|
170743
170828
|
}
|
|
170744
170829
|
function applyToFile(path2, kind, label3, render2, check) {
|
|
170745
|
-
if (!
|
|
170746
|
-
const before =
|
|
170830
|
+
if (!existsSync64(path2)) return { path: path2, outcome: "skipped" };
|
|
170831
|
+
const before = readFileSync74(path2, "utf8");
|
|
170747
170832
|
assertSingleMarkerPair(before, kind, label3, path2);
|
|
170748
170833
|
if (!hasMarkers(before, kind, label3)) return { path: path2, outcome: "skipped" };
|
|
170749
170834
|
const after = injectBlock(before, kind, label3, render2, path2);
|
|
@@ -170754,8 +170839,8 @@ function applyToFile(path2, kind, label3, render2, check) {
|
|
|
170754
170839
|
}
|
|
170755
170840
|
function assertModuleFlagsMarkers(paths2) {
|
|
170756
170841
|
for (const path2 of paths2) {
|
|
170757
|
-
if (!
|
|
170758
|
-
const text15 =
|
|
170842
|
+
if (!existsSync64(path2)) continue;
|
|
170843
|
+
const text15 = readFileSync74(path2, "utf8");
|
|
170759
170844
|
if (hasMarkers(text15, "yaml", LABEL_MODULES_IOS_LINK) && !hasMarkers(text15, "yaml", LABEL_MODULES_IOS_FLAGS)) {
|
|
170760
170845
|
throw new Error(`${path2} links modules (${LABEL_MODULES_IOS_LINK}) but has no ${LABEL_MODULES_IOS_FLAGS} block under its project-level settings:, so no module would install. Add the markers (see apps/_template).`);
|
|
170761
170846
|
}
|
|
@@ -170766,7 +170851,7 @@ function applyModuleFlags(path2, products, check) {
|
|
|
170766
170851
|
return applyToFile(path2, "yaml", LABEL_MODULES_IOS_FLAGS, (i2) => renderModulesIosFlags(products, i2), check);
|
|
170767
170852
|
}
|
|
170768
170853
|
function applyWholeFile(path2, content, check) {
|
|
170769
|
-
const current =
|
|
170854
|
+
const current = existsSync64(path2) ? readFileSync74(path2, "utf8") : null;
|
|
170770
170855
|
if (current === content) return { path: path2, outcome: "unchanged" };
|
|
170771
170856
|
if (check) return { path: path2, outcome: "drift" };
|
|
170772
170857
|
mkdirSync29(dirname37(path2), { recursive: true });
|
|
@@ -170774,7 +170859,7 @@ function applyWholeFile(path2, content, check) {
|
|
|
170774
170859
|
return { path: path2, outcome: "written" };
|
|
170775
170860
|
}
|
|
170776
170861
|
function removeWholeFile(path2, check) {
|
|
170777
|
-
if (!
|
|
170862
|
+
if (!existsSync64(path2)) return { path: path2, outcome: "skipped" };
|
|
170778
170863
|
if (check) return { path: path2, outcome: "drift" };
|
|
170779
170864
|
rmSync18(path2);
|
|
170780
170865
|
return { path: path2, outcome: "removed" };
|
|
@@ -170802,17 +170887,17 @@ function genStoreAdopt(paths2, adopted, check) {
|
|
|
170802
170887
|
const out2 = [];
|
|
170803
170888
|
if (!adopted) {
|
|
170804
170889
|
const r3 = paths2.releaseManifest;
|
|
170805
|
-
const ours =
|
|
170890
|
+
const ours = existsSync64(r3) && readFileSync74(r3, "utf8").split("\n").slice(0, 3).includes(RELEASE_MANIFEST_HEADER);
|
|
170806
170891
|
out2.push(ours ? removeWholeFile(r3, check) : { path: r3, outcome: "skipped" });
|
|
170807
170892
|
out2.push(applyToFile(paths2.gradle, "slash", LABEL_STORE_ADOPT_GRADLE, (i2) => renderAdoptGradle(void 0, i2), check));
|
|
170808
170893
|
return out2;
|
|
170809
170894
|
}
|
|
170810
|
-
if (
|
|
170811
|
-
const expected = buildStoreSpec(
|
|
170812
|
-
if (!
|
|
170895
|
+
if (existsSync64(paths2.iosYml)) {
|
|
170896
|
+
const expected = buildStoreSpec(readFileSync74(paths2.iosYml, "utf8"), { adopted });
|
|
170897
|
+
if (!existsSync64(paths2.storeSpec)) {
|
|
170813
170898
|
out2.push(check ? { path: paths2.storeSpec, outcome: "skipped" } : applyWholeFile(paths2.storeSpec, expected, false));
|
|
170814
170899
|
} else {
|
|
170815
|
-
const current =
|
|
170900
|
+
const current = readFileSync74(paths2.storeSpec, "utf8");
|
|
170816
170901
|
if (STORE_SPEC_LABELS.some((label3) => !hasMarkers(current, "yaml", label3))) {
|
|
170817
170902
|
out2.push(check ? { path: paths2.storeSpec, outcome: "drift" } : applyWholeFile(paths2.storeSpec, expected, false));
|
|
170818
170903
|
} else {
|
|
@@ -170823,12 +170908,12 @@ function genStoreAdopt(paths2, adopted, check) {
|
|
|
170823
170908
|
}
|
|
170824
170909
|
}
|
|
170825
170910
|
}
|
|
170826
|
-
if (
|
|
170827
|
-
const activity = launcherActivityName(
|
|
170911
|
+
if (existsSync64(paths2.manifest)) {
|
|
170912
|
+
const activity = launcherActivityName(readFileSync74(paths2.manifest, "utf8"));
|
|
170828
170913
|
out2.push(applyWholeFile(paths2.releaseManifest, renderReleaseManifest(adopted, activity), check));
|
|
170829
170914
|
}
|
|
170830
|
-
if (
|
|
170831
|
-
if (!hasMarkers(
|
|
170915
|
+
if (existsSync64(paths2.gradle)) {
|
|
170916
|
+
if (!hasMarkers(readFileSync74(paths2.gradle, "utf8"), "slash", LABEL_STORE_ADOPT_GRADLE)) {
|
|
170832
170917
|
throw new Error(
|
|
170833
170918
|
`store.adopt: ${paths2.gradle} has no ${LABEL_STORE_ADOPT_GRADLE} markers, so the release build would keep the dev applicationId. Add \`// >>> ${LABEL_STORE_ADOPT_GRADLE} >>>\` / \`// <<< ${LABEL_STORE_ADOPT_GRADLE} <<<\` at the top level of the file (after the android { } block).`
|
|
170834
170919
|
);
|
|
@@ -170868,27 +170953,27 @@ function genCapabilityRegistrations(root, declared, check) {
|
|
|
170868
170953
|
}
|
|
170869
170954
|
function buildSetOfAppDir(root) {
|
|
170870
170955
|
const configPath = join61(root, "config.ts");
|
|
170871
|
-
const configTs =
|
|
170956
|
+
const configTs = existsSync64(configPath) ? readFileSync74(configPath, "utf8") : "";
|
|
170872
170957
|
return buildSet(parseStringArray(configTs, "capabilities"), parseStringArray(configTs, "capabilityEnvelope"));
|
|
170873
170958
|
}
|
|
170874
170959
|
function appSourceRoot(projectYmlPath, platform) {
|
|
170875
|
-
if (!
|
|
170876
|
-
const project = load3(
|
|
170960
|
+
if (!existsSync64(projectYmlPath)) return void 0;
|
|
170961
|
+
const project = load3(readFileSync74(projectYmlPath, "utf8"));
|
|
170877
170962
|
const main4 = Object.values(project.targets ?? {}).find((t2) => t2.type === "application" && t2.platform === platform);
|
|
170878
170963
|
const iosDir = dirname37(projectYmlPath);
|
|
170879
|
-
const root = main4?.sources?.map((s2) => typeof s2 === "string" ? s2 : s2.path).find((p2) => p2 &&
|
|
170964
|
+
const root = main4?.sources?.map((s2) => typeof s2 === "string" ? s2 : s2.path).find((p2) => p2 && existsSync64(join61(iosDir, p2, "Info.plist")));
|
|
170880
170965
|
return root ? join61(iosDir, root) : void 0;
|
|
170881
170966
|
}
|
|
170882
170967
|
function coreExtensionSourceRoots(projectYmlPath) {
|
|
170883
|
-
if (!
|
|
170884
|
-
const project = load3(
|
|
170968
|
+
if (!existsSync64(projectYmlPath)) return [];
|
|
170969
|
+
const project = load3(readFileSync74(projectYmlPath, "utf8"));
|
|
170885
170970
|
const dir = dirname37(projectYmlPath);
|
|
170886
170971
|
const roots2 = [];
|
|
170887
170972
|
for (const t2 of Object.values(project.targets ?? {})) {
|
|
170888
170973
|
if (t2.type !== "app-extension" || !(t2.dependencies ?? []).some((d2) => /^HimalayaCore/.test(d2.product ?? d2.package ?? ""))) continue;
|
|
170889
170974
|
const paths2 = (t2.sources ?? []).map((s2) => typeof s2 === "string" ? s2 : s2.path).filter((p2) => !!p2);
|
|
170890
170975
|
const infoDir = t2.info?.path ? dirname37(t2.info.path) : void 0;
|
|
170891
|
-
const root = paths2.find((p2) => p2 === infoDir) ?? paths2.find((p2) =>
|
|
170976
|
+
const root = paths2.find((p2) => p2 === infoDir) ?? paths2.find((p2) => existsSync64(join61(dir, p2)) && statSync20(join61(dir, p2)).isDirectory());
|
|
170892
170977
|
if (!root) throw new Error(`${projectYmlPath}: app extension linking HimalayaCore has no source directory to bundle its privacy manifest from`);
|
|
170893
170978
|
roots2.push(join61(dir, root));
|
|
170894
170979
|
}
|
|
@@ -170897,7 +170982,7 @@ function coreExtensionSourceRoots(projectYmlPath) {
|
|
|
170897
170982
|
function shippedManifestPlan(app, options) {
|
|
170898
170983
|
if (options.release) {
|
|
170899
170984
|
const shellConfig = appConfigTs(app);
|
|
170900
|
-
const shellHasAuth = !
|
|
170985
|
+
const shellHasAuth = !existsSync64(shellConfig) || /^\s*auth\s*:/m.test(readFileSync74(shellConfig, "utf8"));
|
|
170901
170986
|
return releasePrivacyPlan({ linked: options.ids, capabilities: options.release.capabilities, appConfig: options.release.appConfig, binaryCore: options.binaryCore, coreVersion: options.coreVersion, shellHasAuth });
|
|
170902
170987
|
}
|
|
170903
170988
|
if (options.dist) return privacyPlanFor(options.ids.map(normalizeCapability), options.binaryCore, options.sentry, options.coreVersion);
|
|
@@ -170909,7 +170994,7 @@ function genNativeConfig(app, opts = {}) {
|
|
|
170909
170994
|
assertSingleModuleInstall(app, kotlinFilesWithModuleInstall(app));
|
|
170910
170995
|
assertModuleFlagsMarkers([iosProjectYml(app), macosProjectYml(app)]);
|
|
170911
170996
|
const configPath = appConfigTs(app);
|
|
170912
|
-
const configTs =
|
|
170997
|
+
const configTs = existsSync64(configPath) ? readFileSync74(configPath, "utf8") : "";
|
|
170913
170998
|
const capabilities = parseStringArray(configTs, "capabilities");
|
|
170914
170999
|
const envelope = parseStringArray(configTs, "capabilityEnvelope");
|
|
170915
171000
|
const ownIds = buildSet(capabilities, envelope);
|
|
@@ -170919,7 +171004,7 @@ function genNativeConfig(app, opts = {}) {
|
|
|
170919
171004
|
const ids = dist ? dist.build : ownIds;
|
|
170920
171005
|
const healthLinked = ids.includes("health");
|
|
170921
171006
|
const distJsonPath = join61(appDir(app), "distribution.json");
|
|
170922
|
-
const distJsonText =
|
|
171007
|
+
const distJsonText = existsSync64(distJsonPath) ? readFileSync74(distJsonPath, "utf8") : void 0;
|
|
170923
171008
|
const optIns = distributionOptIns(distJsonText);
|
|
170924
171009
|
const binaryCore = isBinaryCore(configTs, distJsonText);
|
|
170925
171010
|
const modules = modulesFor(ids, optIns);
|
|
@@ -170935,7 +171020,7 @@ function genNativeConfig(app, opts = {}) {
|
|
|
170935
171020
|
if (!v2) throw new Error(`${app}: a binary-core app that links native modules (${modules.gradle.join(", ")}) needs distribution.json coreVersion`);
|
|
170936
171021
|
return v2;
|
|
170937
171022
|
},
|
|
170938
|
-
corePackage: () =>
|
|
171023
|
+
corePackage: () => existsSync64(iosProjectYml(app)) ? binaryCorePackage(readFileSync74(iosProjectYml(app), "utf8")) : void 0
|
|
170939
171024
|
} : void 0
|
|
170940
171025
|
);
|
|
170941
171026
|
if (binaryCore) {
|
|
@@ -170954,9 +171039,9 @@ function genNativeConfig(app, opts = {}) {
|
|
|
170954
171039
|
const iosBundleId = watchConfig.iosBundleId ?? parseIosBundleId(configTs);
|
|
170955
171040
|
const watch2 = watchInfoPlan(watchConfig, iosBundleId);
|
|
170956
171041
|
const watchYml = watchosProjectYml(app);
|
|
170957
|
-
const watchYmlText =
|
|
171042
|
+
const watchYmlText = existsSync64(watchYml) ? readFileSync74(watchYml, "utf8") : "";
|
|
170958
171043
|
const watchSettings = watchSettingsPlan(watchMode(watchConfig.mode), iosBundleId, watchTargetBundleId(watchYmlText));
|
|
170959
|
-
const watchName =
|
|
171044
|
+
const watchName = existsSync64(watchYml) ? watchProjectName(readFileSync74(watchYml, "utf8")) : void 0;
|
|
170960
171045
|
const watchEmbedFor = (lines) => (indent) => {
|
|
170961
171046
|
const mode = watchMode(watchConfig.mode);
|
|
170962
171047
|
if (mode === "standalone") return [];
|
|
@@ -170970,7 +171055,7 @@ function genNativeConfig(app, opts = {}) {
|
|
|
170970
171055
|
const carBlock = applyToFile(carManifestPath, "xml", LABEL_CAR, (i2) => renderCarManifestXml(carCategory, i2), check);
|
|
170971
171056
|
assertCarBlockLanded(app, carCategory, carManifestPath, carBlock.outcome, LABEL_CAR);
|
|
170972
171057
|
const iosYml = iosProjectYml(app);
|
|
170973
|
-
const project =
|
|
171058
|
+
const project = existsSync64(iosYml) ? readFileSync74(iosYml, "utf8") : "";
|
|
170974
171059
|
const targetManaged = hasMarkers(project, "yaml", LABEL_LIVE_TARGET);
|
|
170975
171060
|
const embedManaged = hasMarkers(project, "yaml", LABEL_LIVE_EMBED);
|
|
170976
171061
|
if (targetManaged !== embedManaged) throw new Error(`${app}: Live Activity target and embedding markers must be installed together`);
|
|
@@ -171054,7 +171139,7 @@ function genNativeConfig(app, opts = {}) {
|
|
|
171054
171139
|
];
|
|
171055
171140
|
if (dist) {
|
|
171056
171141
|
const manifestPath = androidManifestPath2(app);
|
|
171057
|
-
const marked = (path2, kind, label3) => !
|
|
171142
|
+
const marked = (path2, kind, label3) => !existsSync64(path2) || hasMarkers(readFileSync74(path2, "utf8"), kind, label3);
|
|
171058
171143
|
if (!marked(iosYml, "yaml", LABEL_IOS_INFO)) throw new Error(`${app}: dist capabilities need the ${LABEL_IOS_INFO} markers in ${iosYml}`);
|
|
171059
171144
|
if (!marked(manifestPath, "xml", LABEL_ANDROID_SERVICES)) {
|
|
171060
171145
|
throw new Error(`${app}: dist capabilities need the ${LABEL_ANDROID_SERVICES} markers inside <application> in ${manifestPath}`);
|
|
@@ -171065,7 +171150,7 @@ function genNativeConfig(app, opts = {}) {
|
|
|
171065
171150
|
const addsGradle = added.gradle.some((p2) => !ownModules.gradle.includes(p2));
|
|
171066
171151
|
if (addsSpm || addsGradle) {
|
|
171067
171152
|
const requireMarkers = (path2, kind, label3) => {
|
|
171068
|
-
if (!
|
|
171153
|
+
if (!existsSync64(path2) || !hasMarkers(readFileSync74(path2, "utf8"), kind, label3)) {
|
|
171069
171154
|
throw new Error(`${app}: dist added ${dist.added.join(", ")} but ${path2} has no ${label3} markers \u2014 the module would stay unlinked and every verb would answer module_not_linked`);
|
|
171070
171155
|
}
|
|
171071
171156
|
};
|
|
@@ -171080,7 +171165,7 @@ function genNativeConfig(app, opts = {}) {
|
|
|
171080
171165
|
}
|
|
171081
171166
|
}
|
|
171082
171167
|
for (const swift of swiftFilesWithModuleMarkers(app)) {
|
|
171083
|
-
const text15 =
|
|
171168
|
+
const text15 = readFileSync74(swift, "utf8");
|
|
171084
171169
|
if (!hasMarkers(text15, "slash", LABEL_MODULES_SWIFT_IMPORT) || !hasMarkers(text15, "slash", LABEL_MODULES_SWIFT_INSTALL)) {
|
|
171085
171170
|
throw new Error(`${app}: ${swift} must carry both ${LABEL_MODULES_SWIFT_IMPORT} and ${LABEL_MODULES_SWIFT_INSTALL} markers`);
|
|
171086
171171
|
}
|
|
@@ -171090,9 +171175,9 @@ function genNativeConfig(app, opts = {}) {
|
|
|
171090
171175
|
files.push(...genCapabilityRegistrations(appDir(app), ids, check));
|
|
171091
171176
|
const rce = declaresRichContentEditor(configTs);
|
|
171092
171177
|
for (const yml of [iosYml, macosProjectYml(app)]) {
|
|
171093
|
-
const text15 =
|
|
171178
|
+
const text15 = existsSync64(yml) ? readFileSync74(yml, "utf8") : "";
|
|
171094
171179
|
const r3 = applyToFile(yml, "yaml", LABEL_LOCALWEB, renderLocalWebYaml(resourcesDirOf(text15), rce), check);
|
|
171095
|
-
if (
|
|
171180
|
+
if (existsSync64(yml)) assertLocalWebBlockLanded(app, rce, yml, r3.outcome);
|
|
171096
171181
|
files.push(r3);
|
|
171097
171182
|
}
|
|
171098
171183
|
if (targetManaged) {
|
|
@@ -171104,7 +171189,7 @@ function genNativeConfig(app, opts = {}) {
|
|
|
171104
171189
|
const entitlements = join61(dirname37(iosYml), LIVE_ENTITLEMENTS_PATH);
|
|
171105
171190
|
files.push(plan.entitlements ? applyWholeFile(entitlements, plan.entitlements, check) : removeWholeFile(entitlements, check));
|
|
171106
171191
|
}
|
|
171107
|
-
const iosSplashManaged =
|
|
171192
|
+
const iosSplashManaged = existsSync64(iosYml) && hasMarkers(readFileSync74(iosYml, "utf8"), "yaml", LABEL_IOS_SPLASH);
|
|
171108
171193
|
const manifest2 = androidManifestPath2(app);
|
|
171109
171194
|
const splash = splashPlan(app, configTs, manifest2, iosSplashManaged);
|
|
171110
171195
|
for (const artifact of splash.artifacts) files.push(applyWholeFile(artifact.path, artifact.content, check));
|
|
@@ -171220,7 +171305,7 @@ __export(capabilities_exports, {
|
|
|
171220
171305
|
shellSupport: () => shellSupport,
|
|
171221
171306
|
writeLastDist: () => writeLastDist
|
|
171222
171307
|
});
|
|
171223
|
-
import { existsSync as
|
|
171308
|
+
import { existsSync as existsSync65, lstatSync as lstatSync22, readFileSync as readFileSync75 } from "node:fs";
|
|
171224
171309
|
import { join as join62 } from "node:path";
|
|
171225
171310
|
function declareHintFor(id) {
|
|
171226
171311
|
return catalogKey(id) === "app_services" ? "each calling screen's `logicBundle.declaredCapabilities` (the runtime gate) \u2014 an app need not list app_services in config.ts `capabilities`, which only a shell that hosts app services must (an HHP app declares it there, since HHP copies that list onto every screen)" : DECLARE_HINT;
|
|
@@ -171302,9 +171387,9 @@ function allCapabilities(sdkRef = []) {
|
|
|
171302
171387
|
function contentShell(dir, flag) {
|
|
171303
171388
|
if (flag) return flag;
|
|
171304
171389
|
const path2 = join62(dir, "himalaya.content.json");
|
|
171305
|
-
if (!
|
|
171390
|
+
if (!existsSync65(path2)) return null;
|
|
171306
171391
|
try {
|
|
171307
|
-
const shell = JSON.parse(
|
|
171392
|
+
const shell = JSON.parse(readFileSync75(path2, "utf8")).shell;
|
|
171308
171393
|
return typeof shell === "string" && shell ? shell : null;
|
|
171309
171394
|
} catch {
|
|
171310
171395
|
return null;
|
|
@@ -171327,7 +171412,7 @@ function readLastDist(dir) {
|
|
|
171327
171412
|
return null;
|
|
171328
171413
|
}
|
|
171329
171414
|
try {
|
|
171330
|
-
const v2 = JSON.parse(
|
|
171415
|
+
const v2 = JSON.parse(readFileSync75(path2, "utf8"));
|
|
171331
171416
|
if (typeof v2.app !== "string" || typeof v2.jobId !== "string" || typeof v2.shell !== "string" || !Array.isArray(v2.capabilities)) return null;
|
|
171332
171417
|
return { app: v2.app, jobId: v2.jobId, shell: v2.shell, capabilities: v2.capabilities.filter((x2) => typeof x2 === "string") };
|
|
171333
171418
|
} catch {
|
|
@@ -171650,8 +171735,8 @@ function envelopeSubsetIssues(app, envelope) {
|
|
|
171650
171735
|
function capabilityConfigFindings(sourceDir, builtDir) {
|
|
171651
171736
|
const out2 = [];
|
|
171652
171737
|
const configPath = join62(sourceDir, "config.ts");
|
|
171653
|
-
if (
|
|
171654
|
-
const configSrc =
|
|
171738
|
+
if (existsSync65(configPath)) {
|
|
171739
|
+
const configSrc = readFileSync75(configPath, "utf8");
|
|
171655
171740
|
const declared = parseStringArray(configSrc, "capabilities");
|
|
171656
171741
|
for (const id of new Set(declared)) {
|
|
171657
171742
|
if (isKnownCapability(id)) continue;
|
|
@@ -172328,7 +172413,7 @@ __export(base44_types_exports, {
|
|
|
172328
172413
|
renderBase44Types: () => renderBase44Types,
|
|
172329
172414
|
writeBase44Types: () => writeBase44Types
|
|
172330
172415
|
});
|
|
172331
|
-
import { existsSync as
|
|
172416
|
+
import { existsSync as existsSync66, mkdirSync as mkdirSync30, readFileSync as readFileSync76, writeFileSync as writeFileSync27 } from "node:fs";
|
|
172332
172417
|
import { dirname as dirname38, join as join63 } from "node:path";
|
|
172333
172418
|
function logicalName(spec) {
|
|
172334
172419
|
return (isAdoptedEntity(spec) ? spec.base44Name : spec.name) ?? "";
|
|
@@ -172408,7 +172493,7 @@ async function writeBase44Types(dir, app) {
|
|
|
172408
172493
|
if (!list2?.length) throw new Base44TypesError("no_base44_entities", "config.ts declares no base44.entities \u2014 nothing to type. Declare them (or run `himi base44 adopt`) first.");
|
|
172409
172494
|
const text15 = renderBase44Types(list2, app);
|
|
172410
172495
|
const path2 = join63(dir, BASE44_TYPES_PATH);
|
|
172411
|
-
const changed = !
|
|
172496
|
+
const changed = !existsSync66(path2) || readFileSync76(path2, "utf8") !== text15;
|
|
172412
172497
|
if (changed) {
|
|
172413
172498
|
mkdirSync30(dirname38(path2), { recursive: true });
|
|
172414
172499
|
writeFileSync27(path2, text15);
|
|
@@ -172417,14 +172502,14 @@ async function writeBase44Types(dir, app) {
|
|
|
172417
172502
|
}
|
|
172418
172503
|
async function base44TypesIssues(dir, app, strict) {
|
|
172419
172504
|
const path2 = join63(dir, BASE44_TYPES_PATH);
|
|
172420
|
-
if (!
|
|
172505
|
+
if (!existsSync66(path2)) return [];
|
|
172421
172506
|
let list2;
|
|
172422
172507
|
try {
|
|
172423
172508
|
list2 = await declaredEntities(dir);
|
|
172424
172509
|
} catch {
|
|
172425
172510
|
return [];
|
|
172426
172511
|
}
|
|
172427
|
-
if (
|
|
172512
|
+
if (readFileSync76(path2, "utf8") === renderBase44Types(list2 ?? [], app)) return [];
|
|
172428
172513
|
if (!list2?.length) {
|
|
172429
172514
|
return [{
|
|
172430
172515
|
screen: null,
|
|
@@ -172562,13 +172647,13 @@ __export(eject_exports, {
|
|
|
172562
172647
|
EJECTABLE: () => EJECTABLE,
|
|
172563
172648
|
ejectModule: () => ejectModule
|
|
172564
172649
|
});
|
|
172565
|
-
import { existsSync as
|
|
172650
|
+
import { existsSync as existsSync68, mkdirSync as mkdirSync31, readFileSync as readFileSync78, writeFileSync as writeFileSync28 } from "node:fs";
|
|
172566
172651
|
import { dirname as dirname39, join as join65, relative as relative13, resolve as resolve52, sep as sep18 } from "node:path";
|
|
172567
172652
|
function locate(repoRootOrCwd, mod) {
|
|
172568
172653
|
const inRepo = resolve52(repoRootOrCwd, `stdlib/flows/${mod}/src/index.ts`);
|
|
172569
|
-
if (
|
|
172654
|
+
if (existsSync68(inRepo)) return { path: inRepo, form: "source" };
|
|
172570
172655
|
const dist = resolve52(repoRootOrCwd, `node_modules/@wix/himalaya/dist/${mod}.mjs`);
|
|
172571
|
-
if (
|
|
172656
|
+
if (existsSync68(dist)) return { path: dist, form: "bundle" };
|
|
172572
172657
|
return null;
|
|
172573
172658
|
}
|
|
172574
172659
|
function specifiersFor(mod) {
|
|
@@ -172606,15 +172691,15 @@ function ejectModule(opts) {
|
|
|
172606
172691
|
// gate still applies. Ejecting buys layout and flow, never the floor.
|
|
172607
172692
|
|
|
172608
172693
|
`;
|
|
172609
|
-
const normalized =
|
|
172694
|
+
const normalized = readFileSync78(found.path, "utf8").replace(
|
|
172610
172695
|
/(["'])@himalaya\/([a-z0-9-]+(?:\/[a-z0-9-]+)?)\1/g,
|
|
172611
172696
|
(_m, q3, sub) => `${q3}@wix/himalaya/${sub}${q3}`
|
|
172612
172697
|
);
|
|
172613
172698
|
writeFileSync28(target, banner + normalized);
|
|
172614
172699
|
const rewired = [];
|
|
172615
172700
|
for (const f2 of files) {
|
|
172616
|
-
if (!
|
|
172617
|
-
const before =
|
|
172701
|
+
if (!existsSync68(f2)) continue;
|
|
172702
|
+
const before = readFileSync78(f2, "utf8");
|
|
172618
172703
|
let after = before;
|
|
172619
172704
|
let rel = relative13(dirname39(f2), target).split(sep18).join("/").replace(/\.tsx?$/, ".js");
|
|
172620
172705
|
if (!rel.startsWith(".")) rel = `./${rel}`;
|
|
@@ -172797,11 +172882,11 @@ __export(icon_exports, {
|
|
|
172797
172882
|
writePreparedIcon: () => writePreparedIcon
|
|
172798
172883
|
});
|
|
172799
172884
|
import { createHash as createHash31 } from "node:crypto";
|
|
172800
|
-
import { accessSync as accessSync3, constants as constants4, existsSync as
|
|
172885
|
+
import { accessSync as accessSync3, constants as constants4, existsSync as existsSync69, mkdirSync as mkdirSync32, readFileSync as readFileSync79, statSync as statSync21, writeFileSync as writeFileSync29 } from "node:fs";
|
|
172801
172886
|
import { basename as basename19, dirname as dirname40, join as join66, resolve as resolve53, sep as sep19 } from "node:path";
|
|
172802
172887
|
function readManifest(dir) {
|
|
172803
172888
|
try {
|
|
172804
|
-
return JSON.parse(
|
|
172889
|
+
return JSON.parse(readFileSync79(join66(dir, MANIFEST), "utf8"));
|
|
172805
172890
|
} catch {
|
|
172806
172891
|
return null;
|
|
172807
172892
|
}
|
|
@@ -172828,7 +172913,7 @@ function templateIconMatch(png) {
|
|
|
172828
172913
|
const candidate = join66(templateSourceDir(template), DEFAULT_CONTENT_ICON);
|
|
172829
172914
|
try {
|
|
172830
172915
|
if (statSync21(candidate).size !== png.length) continue;
|
|
172831
|
-
if (
|
|
172916
|
+
if (readFileSync79(candidate).equals(png)) return template;
|
|
172832
172917
|
} catch {
|
|
172833
172918
|
}
|
|
172834
172919
|
}
|
|
@@ -172836,10 +172921,10 @@ function templateIconMatch(png) {
|
|
|
172836
172921
|
}
|
|
172837
172922
|
function playState(dir) {
|
|
172838
172923
|
const p2 = join66(resolve53(dir), PLAY_LISTING_ICON);
|
|
172839
|
-
if (!
|
|
172924
|
+
if (!existsSync69(p2)) return null;
|
|
172840
172925
|
try {
|
|
172841
172926
|
if (!statSync21(p2).isFile()) return { path: p2, issues: ["is a directory, not a PNG file"] };
|
|
172842
|
-
return { path: p2, issues: playListingIconIssues(
|
|
172927
|
+
return { path: p2, issues: playListingIconIssues(readFileSync79(p2)) };
|
|
172843
172928
|
} catch (err) {
|
|
172844
172929
|
return { path: p2, issues: [`could not be read (${err.message.split("\n")[0]})`] };
|
|
172845
172930
|
}
|
|
@@ -172862,7 +172947,7 @@ async function iconStatus(dir) {
|
|
|
172862
172947
|
verdict: "missing",
|
|
172863
172948
|
policyChecklist: POLICY_CHECKLIST
|
|
172864
172949
|
};
|
|
172865
|
-
if (!path2 || !
|
|
172950
|
+
if (!path2 || !existsSync69(path2)) return base;
|
|
172866
172951
|
let png;
|
|
172867
172952
|
try {
|
|
172868
172953
|
if (!statSync21(path2).isFile()) {
|
|
@@ -172872,7 +172957,7 @@ async function iconStatus(dir) {
|
|
|
172872
172957
|
verdict: "blocked"
|
|
172873
172958
|
};
|
|
172874
172959
|
}
|
|
172875
|
-
png =
|
|
172960
|
+
png = readFileSync79(path2);
|
|
172876
172961
|
} catch (err) {
|
|
172877
172962
|
return {
|
|
172878
172963
|
...base,
|
|
@@ -172942,7 +173027,7 @@ function summarize3(status) {
|
|
|
172942
173027
|
}
|
|
172943
173028
|
function backdropFromTokens(dir, fallback = "#1F2933") {
|
|
172944
173029
|
try {
|
|
172945
|
-
const tokens2 = JSON.parse(
|
|
173030
|
+
const tokens2 = JSON.parse(readFileSync79(join66(dir, "tokens.json"), "utf8"));
|
|
172946
173031
|
const accent = tokens2.colors?.accentPrimary;
|
|
172947
173032
|
const hex2 = typeof accent === "string" ? accent : accent?.light;
|
|
172948
173033
|
return typeof hex2 === "string" && HEX_COLOR2.test(hex2) ? hex2 : fallback;
|
|
@@ -172952,8 +173037,8 @@ function backdropFromTokens(dir, fallback = "#1F2933") {
|
|
|
172952
173037
|
}
|
|
172953
173038
|
async function installIcon(dir, sourcePath, opts = {}) {
|
|
172954
173039
|
const src = resolve53(sourcePath);
|
|
172955
|
-
if (!
|
|
172956
|
-
const input =
|
|
173040
|
+
if (!existsSync69(src)) throw new Error(`himi icon: no such file: ${src}`);
|
|
173041
|
+
const input = readFileSync79(src);
|
|
172957
173042
|
let normalized = false;
|
|
172958
173043
|
let out2 = input;
|
|
172959
173044
|
if (await pixelToolchainAvailable()) {
|
|
@@ -172989,7 +173074,7 @@ function writePreparedIcon(dir, master, play) {
|
|
|
172989
173074
|
...manifest2 && manifest2.icon !== name ? [join66(dir, MANIFEST)] : []
|
|
172990
173075
|
];
|
|
172991
173076
|
for (const path2 of targets) {
|
|
172992
|
-
if (
|
|
173077
|
+
if (existsSync69(path2)) {
|
|
172993
173078
|
if (!statSync21(path2).isFile()) throw new Error(`himi icon: destination is not a regular file: ${path2}`);
|
|
172994
173079
|
accessSync3(path2, constants4.W_OK);
|
|
172995
173080
|
} else accessSync3(dirname40(path2), constants4.W_OK);
|
|
@@ -173019,16 +173104,16 @@ function declareIcon(dir, name) {
|
|
|
173019
173104
|
}
|
|
173020
173105
|
function siteBookIcon(bookDir) {
|
|
173021
173106
|
const p2 = join66(resolve53(bookDir), SITE_BOOK_ICON_REL);
|
|
173022
|
-
return
|
|
173107
|
+
return existsSync69(p2) ? p2 : null;
|
|
173023
173108
|
}
|
|
173024
173109
|
function siteLogoAbsence(bookDir) {
|
|
173025
173110
|
const bookJson = join66(resolve53(bookDir), "book.json");
|
|
173026
|
-
if (!
|
|
173111
|
+
if (!existsSync69(bookJson)) {
|
|
173027
173112
|
return { reason: "no-book", hint: `no business book at ${bookDir} \u2014 run \`himi site analyze --out <dir>\` first, or pass --book <dir>` };
|
|
173028
173113
|
}
|
|
173029
173114
|
let logoUrl;
|
|
173030
173115
|
try {
|
|
173031
|
-
const book = JSON.parse(
|
|
173116
|
+
const book = JSON.parse(readFileSync79(bookJson, "utf8"));
|
|
173032
173117
|
logoUrl = book.identity?.logoUrl;
|
|
173033
173118
|
} catch {
|
|
173034
173119
|
return {
|
|
@@ -173200,7 +173285,7 @@ __export(crawl_layers_exports, {
|
|
|
173200
173285
|
renderMocksFrom: () => renderMocksFrom,
|
|
173201
173286
|
tabRootScreens: () => tabRootScreens
|
|
173202
173287
|
});
|
|
173203
|
-
import { readFileSync as
|
|
173288
|
+
import { readFileSync as readFileSync80 } from "node:fs";
|
|
173204
173289
|
import { join as join68 } from "node:path";
|
|
173205
173290
|
async function loadContentConfigQuietly(dir) {
|
|
173206
173291
|
try {
|
|
@@ -173237,7 +173322,7 @@ async function base44CrawlData(dir, app) {
|
|
|
173237
173322
|
}
|
|
173238
173323
|
const sample = {};
|
|
173239
173324
|
try {
|
|
173240
|
-
const book = JSON.parse(
|
|
173325
|
+
const book = JSON.parse(readFileSync80(join68(dir, ".himi", "base44-book", "book.json"), "utf8"));
|
|
173241
173326
|
const bookApp = typeof book.input?.appId === "string" ? book.input.appId : typeof book.identity?.appId === "string" ? book.identity.appId : void 0;
|
|
173242
173327
|
const configApp = typeof base44?.appId === "string" ? base44.appId : void 0;
|
|
173243
173328
|
if (bookApp && configApp && bookApp !== configApp) throw new Error("book is for another Base44 app");
|
|
@@ -173310,7 +173395,7 @@ var init_crawl_layers = __esm({
|
|
|
173310
173395
|
});
|
|
173311
173396
|
|
|
173312
173397
|
// src/wix-writes.ts
|
|
173313
|
-
import { existsSync as
|
|
173398
|
+
import { existsSync as existsSync71, readFileSync as readFileSync81 } from "node:fs";
|
|
173314
173399
|
import { join as join69 } from "node:path";
|
|
173315
173400
|
function isProvenRead(method, path2) {
|
|
173316
173401
|
if (/[#\x00-\x1F\x7F]/.test(path2)) return false;
|
|
@@ -173430,10 +173515,10 @@ function parseDataAccess(text15, from) {
|
|
|
173430
173515
|
function readDataAccess(dir) {
|
|
173431
173516
|
for (const name of ["SPEC.md", "MOBILE-UX.md"]) {
|
|
173432
173517
|
const p2 = join69(dir, name);
|
|
173433
|
-
if (!
|
|
173518
|
+
if (!existsSync71(p2)) continue;
|
|
173434
173519
|
let text15;
|
|
173435
173520
|
try {
|
|
173436
|
-
text15 =
|
|
173521
|
+
text15 = readFileSync81(p2, "utf8");
|
|
173437
173522
|
} catch {
|
|
173438
173523
|
continue;
|
|
173439
173524
|
}
|
|
@@ -173550,11 +173635,11 @@ __export(test_exports, {
|
|
|
173550
173635
|
scopeDescriptors: () => scopeDescriptors,
|
|
173551
173636
|
writeRecordedMocks: () => writeRecordedMocks
|
|
173552
173637
|
});
|
|
173553
|
-
import { existsSync as
|
|
173638
|
+
import { existsSync as existsSync72, mkdirSync as mkdirSync33, readFileSync as readFileSync82, writeFileSync as writeFileSync30 } from "node:fs";
|
|
173554
173639
|
import { join as join70, resolve as resolve54 } from "node:path";
|
|
173555
173640
|
function readTestConfig(dir, capturedBytes) {
|
|
173556
173641
|
const p2 = resolve54(dir, TEST_CONFIG_FILE);
|
|
173557
|
-
const bytes2 = capturedBytes === void 0 ?
|
|
173642
|
+
const bytes2 = capturedBytes === void 0 ? existsSync72(p2) ? readFileSync82(p2, "utf8") : null : capturedBytes;
|
|
173558
173643
|
if (bytes2 === null) return {};
|
|
173559
173644
|
let parsed;
|
|
173560
173645
|
try {
|
|
@@ -173625,7 +173710,7 @@ function readTestConfig(dir, capturedBytes) {
|
|
|
173625
173710
|
function readNetRules(path2) {
|
|
173626
173711
|
let parsed;
|
|
173627
173712
|
try {
|
|
173628
|
-
parsed = JSON.parse(
|
|
173713
|
+
parsed = JSON.parse(readFileSync82(path2, "utf8"));
|
|
173629
173714
|
} catch (e2) {
|
|
173630
173715
|
throw new Error(`--net ${path2} could not be read as JSON \u2014 ${e2.message}`);
|
|
173631
173716
|
}
|
|
@@ -173646,7 +173731,7 @@ function readNetRules(path2) {
|
|
|
173646
173731
|
function defaultNetRules(dir) {
|
|
173647
173732
|
for (const rel of ["dev/net-mocks.json", "tests/net-mocks.json"]) {
|
|
173648
173733
|
const p2 = resolve54(dir, rel);
|
|
173649
|
-
if (
|
|
173734
|
+
if (existsSync72(p2)) {
|
|
173650
173735
|
const rules = readNetRules(p2);
|
|
173651
173736
|
if (rules.length) return { rules, from: rel };
|
|
173652
173737
|
}
|
|
@@ -173662,7 +173747,7 @@ function readCannedResponses() {
|
|
|
173662
173747
|
];
|
|
173663
173748
|
for (const url of candidates) {
|
|
173664
173749
|
try {
|
|
173665
|
-
const parsed = JSON.parse(
|
|
173750
|
+
const parsed = JSON.parse(readFileSync82(url, "utf8"));
|
|
173666
173751
|
const byKey = {};
|
|
173667
173752
|
for (const [k2, v2] of Object.entries(parsed)) {
|
|
173668
173753
|
if (!k2.startsWith("//")) byKey[k2] = v2;
|
|
@@ -174437,7 +174522,7 @@ import {
|
|
|
174437
174522
|
lstatSync as lstatSync23,
|
|
174438
174523
|
mkdirSync as mkdirSync34,
|
|
174439
174524
|
mkdtempSync as mkdtempSync3,
|
|
174440
|
-
readFileSync as
|
|
174525
|
+
readFileSync as readFileSync83,
|
|
174441
174526
|
readlinkSync,
|
|
174442
174527
|
rmSync as rmSync20,
|
|
174443
174528
|
writeFileSync as writeFileSync31
|
|
@@ -174577,7 +174662,7 @@ function validationDiffHash(cwd = process.cwd()) {
|
|
|
174577
174662
|
`${Buffer.byteLength(path2)}:${path2}`,
|
|
174578
174663
|
"file",
|
|
174579
174664
|
worktreeMode,
|
|
174580
|
-
diffHash(
|
|
174665
|
+
diffHash(readFileSync83(absolute)),
|
|
174581
174666
|
stagedState2,
|
|
174582
174667
|
""
|
|
174583
174668
|
].join("\0");
|
|
@@ -174781,12 +174866,12 @@ var init_release_payload_hash = __esm({
|
|
|
174781
174866
|
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
174782
174867
|
import { createHash as createHash35, randomBytes as randomBytes2 } from "node:crypto";
|
|
174783
174868
|
import {
|
|
174784
|
-
existsSync as
|
|
174869
|
+
existsSync as existsSync73,
|
|
174785
174870
|
lstatSync as lstatSync24,
|
|
174786
174871
|
mkdirSync as mkdirSync35,
|
|
174787
174872
|
realpathSync as realpathSync9,
|
|
174788
174873
|
readlinkSync as readlinkSync2,
|
|
174789
|
-
readFileSync as
|
|
174874
|
+
readFileSync as readFileSync84,
|
|
174790
174875
|
readdirSync as readdirSync35,
|
|
174791
174876
|
unlinkSync as unlinkSync4,
|
|
174792
174877
|
writeFileSync as writeFileSync32
|
|
@@ -174800,7 +174885,7 @@ function attestationVersionOf(value2) {
|
|
|
174800
174885
|
function classifyRetainedRun(dir, name) {
|
|
174801
174886
|
let value2;
|
|
174802
174887
|
try {
|
|
174803
|
-
value2 = JSON.parse(
|
|
174888
|
+
value2 = JSON.parse(readFileSync84(join73(dir, name), "utf8"));
|
|
174804
174889
|
} catch {
|
|
174805
174890
|
return { kind: "unreadable" };
|
|
174806
174891
|
}
|
|
@@ -174870,7 +174955,7 @@ function currentGitUntrackedHash(contentDir2) {
|
|
|
174870
174955
|
if (!stats) continue;
|
|
174871
174956
|
const kind = stats.isSymbolicLink() ? "link" : stats.isDirectory() ? "dir" : stats.isFile() ? "file" : null;
|
|
174872
174957
|
if (!kind) continue;
|
|
174873
|
-
const payload = kind === "link" ? Buffer.from(readlinkSync2(full)) : kind === "file" ?
|
|
174958
|
+
const payload = kind === "link" ? Buffer.from(readlinkSync2(full)) : kind === "file" ? readFileSync84(full) : Buffer.alloc(0);
|
|
174874
174959
|
const pathBytes = Buffer.from(path2);
|
|
174875
174960
|
hash3.update(`${kind} ${pathBytes.length} ${payload.length}
|
|
174876
174961
|
`).update(pathBytes).update(payload);
|
|
@@ -174887,7 +174972,7 @@ function sourceTreeHash(root) {
|
|
|
174887
174972
|
if (dir === root && entry.isFile() && AGENT_TOOLING_ROOT_FILES.includes(entry.name)) continue;
|
|
174888
174973
|
if (MCP_HOST_CONFIG_FILES.includes(local.split(/[\\/]/).join("/"))) continue;
|
|
174889
174974
|
if (entry.isDirectory()) visit(path2);
|
|
174890
|
-
else if (entry.isFile()) hash3.update(local).update("\0").update(
|
|
174975
|
+
else if (entry.isFile()) hash3.update(local).update("\0").update(readFileSync84(path2)).update("\0");
|
|
174891
174976
|
else if (entry.isSymbolicLink()) hash3.update(local).update("\0link\0").update(readlinkSync2(path2)).update("\0");
|
|
174892
174977
|
}
|
|
174893
174978
|
};
|
|
@@ -174903,7 +174988,7 @@ function isAttestationV2(value2) {
|
|
|
174903
174988
|
}
|
|
174904
174989
|
function readLatestAttestation(contentDir2) {
|
|
174905
174990
|
try {
|
|
174906
|
-
const parsed = JSON.parse(
|
|
174991
|
+
const parsed = JSON.parse(readFileSync84(join73(resolve58(contentDir2), ".himi", "attestations", "latest.json"), "utf8"));
|
|
174907
174992
|
return isAttestationV2(parsed) ? parsed : null;
|
|
174908
174993
|
} catch {
|
|
174909
174994
|
return null;
|
|
@@ -174911,7 +174996,7 @@ function readLatestAttestation(contentDir2) {
|
|
|
174911
174996
|
}
|
|
174912
174997
|
function readRetainedAttestations(contentDir2) {
|
|
174913
174998
|
const dir = join73(resolve58(contentDir2), ".himi", "attestations");
|
|
174914
|
-
if (!
|
|
174999
|
+
if (!existsSync73(dir)) return { runs: [], errors: [] };
|
|
174915
175000
|
try {
|
|
174916
175001
|
const names2 = readdirSync35(dir).filter((name) => name.endsWith(".json") && name !== "latest.json");
|
|
174917
175002
|
const parsedRuns = [];
|
|
@@ -174928,7 +175013,7 @@ function readRetainedAttestations(contentDir2) {
|
|
|
174928
175013
|
} else errors.push(`attestation history contains malformed retained run ${name}`);
|
|
174929
175014
|
}
|
|
174930
175015
|
const latest = readLatestAttestation(contentDir2);
|
|
174931
|
-
if (
|
|
175016
|
+
if (existsSync73(join73(dir, "latest.json")) && !latest) errors.push("attestation history has no valid latest.json");
|
|
174932
175017
|
else if (names2.length > 0 && !latest) errors.push("attestation history has no latest.json");
|
|
174933
175018
|
const byHash = new Map(parsedRuns.map((run2) => [run2.selfHash, run2]));
|
|
174934
175019
|
if (byHash.size !== parsedRuns.length) errors.push("attestation history contains duplicate self hashes");
|
|
@@ -174936,8 +175021,8 @@ function readRetainedAttestations(contentDir2) {
|
|
|
174936
175021
|
if (selfHashFor(run2) !== run2.selfHash) errors.push(`selfHash does not match retained run ${run2.runId}`);
|
|
174937
175022
|
for (const expected of Object.values(run2.screenshots)) {
|
|
174938
175023
|
const path2 = screenshotArtifactPath(contentDir2, expected);
|
|
174939
|
-
if (!
|
|
174940
|
-
else if (sha2565(
|
|
175024
|
+
if (!existsSync73(path2)) errors.push(`missing screenshot for retained run ${run2.runId}: ${basename21(path2)}`);
|
|
175025
|
+
else if (sha2565(readFileSync84(path2)) !== expected) errors.push(`screenshot hash does not match retained run ${run2.runId}: ${basename21(path2)}`);
|
|
174941
175026
|
}
|
|
174942
175027
|
}
|
|
174943
175028
|
const runs = [];
|
|
@@ -175007,15 +175092,15 @@ function writeAttestation(input, opts = {}) {
|
|
|
175007
175092
|
const descriptorHashes = Object.fromEntries(
|
|
175008
175093
|
Object.entries(input.descriptors).sort(([a2], [b2]) => a2.localeCompare(b2)).map(([screen, bytes2]) => [screen, sha2565(bytes2)])
|
|
175009
175094
|
);
|
|
175010
|
-
const screenshotEntries = Object.entries(input.screenshots ?? {}).sort(([a2], [b2]) => a2.localeCompare(b2)).filter(([, path2]) =>
|
|
175011
|
-
const bytes2 =
|
|
175095
|
+
const screenshotEntries = Object.entries(input.screenshots ?? {}).sort(([a2], [b2]) => a2.localeCompare(b2)).filter(([, path2]) => existsSync73(path2)).map(([screen, path2]) => {
|
|
175096
|
+
const bytes2 = readFileSync84(path2);
|
|
175012
175097
|
return { screen, bytes: bytes2, hash: sha2565(bytes2) };
|
|
175013
175098
|
});
|
|
175014
175099
|
const screenshots = Object.fromEntries(screenshotEntries.map(({ screen, hash: hash3 }) => [screen, hash3]));
|
|
175015
175100
|
for (const { bytes: bytes2, hash: hash3 } of screenshotEntries) {
|
|
175016
175101
|
const artifact = screenshotArtifactPath(contentDir2, hash3);
|
|
175017
175102
|
mkdirSync35(join73(dir, "artifacts"), { recursive: true });
|
|
175018
|
-
if (!
|
|
175103
|
+
if (!existsSync73(artifact)) writeFileSync32(artifact, bytes2);
|
|
175019
175104
|
}
|
|
175020
175105
|
const unsigned = {
|
|
175021
175106
|
attestation: 2,
|
|
@@ -175060,7 +175145,7 @@ function writeAttestation(input, opts = {}) {
|
|
|
175060
175145
|
retainedRuns.flatMap((run2) => Object.values(run2.screenshots))
|
|
175061
175146
|
);
|
|
175062
175147
|
const artifactDir = join73(dir, "artifacts");
|
|
175063
|
-
if (
|
|
175148
|
+
if (existsSync73(artifactDir)) {
|
|
175064
175149
|
for (const name of readdirSync35(artifactDir).filter((candidate) => candidate.endsWith(".png"))) {
|
|
175065
175150
|
if (!retainedScreenshotHashes.has(name.slice(0, -4))) unlinkSync4(join73(artifactDir, name));
|
|
175066
175151
|
}
|
|
@@ -175136,11 +175221,11 @@ function verifyAttestation(attestation, contentDir2, descriptors, expectedApp, r
|
|
|
175136
175221
|
}
|
|
175137
175222
|
for (const [screen, expected] of Object.entries(attestation.screenshots)) {
|
|
175138
175223
|
const path2 = screenshotArtifactPath(contentDir2, expected);
|
|
175139
|
-
if (!
|
|
175224
|
+
if (!existsSync73(path2)) {
|
|
175140
175225
|
errors.push(`missing screenshot for ${screen}: ${basename21(path2)}`);
|
|
175141
175226
|
continue;
|
|
175142
175227
|
}
|
|
175143
|
-
if (sha2565(
|
|
175228
|
+
if (sha2565(readFileSync84(path2)) !== expected) errors.push(`screenshot hash does not match for ${screen}: ${basename21(path2)}`);
|
|
175144
175229
|
}
|
|
175145
175230
|
return { ok: errors.length === 0, errors };
|
|
175146
175231
|
}
|
|
@@ -175161,7 +175246,7 @@ var init_attestation = __esm({
|
|
|
175161
175246
|
});
|
|
175162
175247
|
|
|
175163
175248
|
// src/ux-evidence.ts
|
|
175164
|
-
import { existsSync as
|
|
175249
|
+
import { existsSync as existsSync74, mkdirSync as mkdirSync36, readFileSync as readFileSync85, writeFileSync as writeFileSync33 } from "node:fs";
|
|
175165
175250
|
import { dirname as dirname44, isAbsolute as isAbsolute7, join as join74, relative as relative15, resolve as resolve59 } from "node:path";
|
|
175166
175251
|
function isNativePlatform(value2) {
|
|
175167
175252
|
return typeof value2 === "string" && NATIVE_PLATFORMS.includes(value2);
|
|
@@ -175171,7 +175256,7 @@ function isNativeAuditStatus(value2) {
|
|
|
175171
175256
|
}
|
|
175172
175257
|
function readText(path2) {
|
|
175173
175258
|
try {
|
|
175174
|
-
return
|
|
175259
|
+
return existsSync74(path2) ? readFileSync85(path2, "utf8") : null;
|
|
175175
175260
|
} catch {
|
|
175176
175261
|
return null;
|
|
175177
175262
|
}
|
|
@@ -175273,7 +175358,7 @@ function uxEvidenceForRelease(content, release2) {
|
|
|
175273
175358
|
inheritedScreens: [],
|
|
175274
175359
|
malformed: []
|
|
175275
175360
|
};
|
|
175276
|
-
if (!
|
|
175361
|
+
if (!existsSync74(path2)) return { ...base, state: "absent" };
|
|
175277
175362
|
const parsed = parseEvidence(path2);
|
|
175278
175363
|
if (parsed.error) return { ...base, state: "unreadable", error: parsed.error };
|
|
175279
175364
|
if (!parsed.evidence) return { ...base, state: "absent" };
|
|
@@ -175309,7 +175394,12 @@ function uxEvidenceForRelease(content, release2) {
|
|
|
175309
175394
|
if (forRelease.length > 0) {
|
|
175310
175395
|
const platforms = forRelease.map(([platform]) => platform);
|
|
175311
175396
|
const failedPlatforms = forRelease.filter(([, entry]) => entry.status === "failed").map(([platform]) => platform);
|
|
175312
|
-
|
|
175397
|
+
const notDriven = NATIVE_PLATFORMS.flatMap((platform) => {
|
|
175398
|
+
const entry = forRelease.find(([key3]) => key3 === platform)?.[1];
|
|
175399
|
+
if (!entry) return [{ platform, status: "missing" }];
|
|
175400
|
+
return entry.status === "unavailable" ? [{ platform, status: "not-run", reason: entry.reason?.trim() ?? "" }] : [];
|
|
175401
|
+
});
|
|
175402
|
+
return failedPlatforms.length > 0 ? { ...base, state: "failed", platforms, failedPlatforms, malformed, notDriven } : { ...base, state: "recorded", platforms, malformed, notDriven };
|
|
175313
175403
|
}
|
|
175314
175404
|
const sameCommit = recorded.filter(([, entry]) => sameReleaseCommit(entry.releaseId, releaseId));
|
|
175315
175405
|
if (sameCommit.length > 0) {
|
|
@@ -175345,14 +175435,14 @@ var mobile_ux_lint_exports = {};
|
|
|
175345
175435
|
__export(mobile_ux_lint_exports, {
|
|
175346
175436
|
mobileUxIssues: () => mobileUxIssues
|
|
175347
175437
|
});
|
|
175348
|
-
import { existsSync as
|
|
175438
|
+
import { existsSync as existsSync75, readFileSync as readFileSync86 } from "node:fs";
|
|
175349
175439
|
import { join as join75 } from "node:path";
|
|
175350
175440
|
function mobileUxIssues(dir, strict) {
|
|
175351
175441
|
const file2 = join75(dir, "MOBILE-UX.md");
|
|
175352
|
-
if (!
|
|
175442
|
+
if (!existsSync75(file2)) return [];
|
|
175353
175443
|
let text15;
|
|
175354
175444
|
try {
|
|
175355
|
-
text15 =
|
|
175445
|
+
text15 = readFileSync86(file2, "utf8");
|
|
175356
175446
|
} catch {
|
|
175357
175447
|
return [];
|
|
175358
175448
|
}
|
|
@@ -177050,7 +177140,7 @@ __export(functions_exports, {
|
|
|
177050
177140
|
resolveFunctionsTarget: () => resolveFunctionsTarget,
|
|
177051
177141
|
runRemoteFunctionOperation: () => runRemoteFunctionOperation
|
|
177052
177142
|
});
|
|
177053
|
-
import { readFileSync as
|
|
177143
|
+
import { readFileSync as readFileSync89, existsSync as existsSync78 } from "node:fs";
|
|
177054
177144
|
import { join as join78, resolve as resolve60 } from "node:path";
|
|
177055
177145
|
function resolveFunctionsTarget(input) {
|
|
177056
177146
|
const explicitUrl = input.functionsUrl?.trim();
|
|
@@ -177070,9 +177160,9 @@ async function loadFunctionsApp(dir) {
|
|
|
177070
177160
|
}
|
|
177071
177161
|
const sources = {};
|
|
177072
177162
|
for (const definition of config.functions.functions) {
|
|
177073
|
-
const source = [".ts", ".js", ".mts", ".mjs"].map((extension) => join78(loaded2.dir, "functions", `${definition.name}${extension}`)).find(
|
|
177163
|
+
const source = [".ts", ".js", ".mts", ".mjs"].map((extension) => join78(loaded2.dir, "functions", `${definition.name}${extension}`)).find(existsSync78);
|
|
177074
177164
|
if (!source) throw new Error(`missing source for function ${definition.name}; expected functions/${definition.name}.ts`);
|
|
177075
|
-
sources[definition.name] =
|
|
177165
|
+
sources[definition.name] = readFileSync89(source, "utf8");
|
|
177076
177166
|
}
|
|
177077
177167
|
const data = config.cms || config.data ? mergeDataResources(config) : void 0;
|
|
177078
177168
|
const dataErrors = validateDataResources(data, loaded2.name).filter((issue3) => issue3.severity === "error");
|
|
@@ -177262,7 +177352,7 @@ var init_cli_bridge = __esm({
|
|
|
177262
177352
|
});
|
|
177263
177353
|
|
|
177264
177354
|
// src/mcp/file-tools.ts
|
|
177265
|
-
import { closeSync as closeSync6, constants as constants5, lstatSync as lstatSync25, mkdirSync as mkdirSync37, openSync as openSync5, readdirSync as readdirSync36, readFileSync as
|
|
177355
|
+
import { closeSync as closeSync6, constants as constants5, lstatSync as lstatSync25, mkdirSync as mkdirSync37, openSync as openSync5, readdirSync as readdirSync36, readFileSync as readFileSync91, realpathSync as realpathSync10, renameSync as renameSync13, rmSync as rmSync21, statSync as statSync22, writeSync, existsSync as existsSync79 } from "node:fs";
|
|
177266
177356
|
import { randomBytes as randomBytes3 } from "node:crypto";
|
|
177267
177357
|
import { dirname as dirname45, isAbsolute as isAbsolute8, join as join79, relative as relative16, resolve as resolve61, sep as sep20 } from "node:path";
|
|
177268
177358
|
import * as z2 from "zod";
|
|
@@ -177272,7 +177362,7 @@ function within(root, p2) {
|
|
|
177272
177362
|
function realish(p2) {
|
|
177273
177363
|
let cur = p2;
|
|
177274
177364
|
const tail = [];
|
|
177275
|
-
while (!
|
|
177365
|
+
while (!existsSync79(cur)) {
|
|
177276
177366
|
const up = dirname45(cur);
|
|
177277
177367
|
if (up === cur) break;
|
|
177278
177368
|
tail.unshift(cur.slice(up.length + (up.endsWith(sep20) ? 0 : 1)));
|
|
@@ -177295,7 +177385,7 @@ function symlinkComponent(base, abs) {
|
|
|
177295
177385
|
function workspaceRefusal(root, target) {
|
|
177296
177386
|
const r3 = resolve61(root);
|
|
177297
177387
|
const t2 = resolve61(r3, target);
|
|
177298
|
-
if (!
|
|
177388
|
+
if (!existsSync79(r3)) return `the workspace folder ${r3} does not exist`;
|
|
177299
177389
|
if (!within(r3, t2) || !within(realpathSync10(r3), realish(t2))) return `"${target}" is outside the workspace folder ${r3}`;
|
|
177300
177390
|
const link = symlinkComponent(r3, t2);
|
|
177301
177391
|
if (link) return `"${link}" is a symlink \u2014 paths must stay in real folders inside the workspace`;
|
|
@@ -177304,13 +177394,13 @@ function workspaceRefusal(root, target) {
|
|
|
177304
177394
|
async function confinedAppDir(args, deps) {
|
|
177305
177395
|
const root = resolve61(await deps.defaultDir());
|
|
177306
177396
|
const dir = typeof args.dir === "string" && args.dir ? resolve61(root, args.dir) : root;
|
|
177307
|
-
if (!
|
|
177397
|
+
if (!existsSync79(root)) return refuse5("no_workspace", `the workspace folder ${root} does not exist`);
|
|
177308
177398
|
if (!within(root, dir) || !within(realpathSync10(root), realish(dir))) return refuse5("outside_workspace", `"${String(args.dir)}" is outside the workspace folder`);
|
|
177309
177399
|
const link = symlinkComponent(root, dir);
|
|
177310
177400
|
if (link) return refuse5("outside_workspace", `"${link}" is a symlink \u2014 the app folder must be a real folder in the workspace`);
|
|
177311
177401
|
const rel = relative16(root, dir);
|
|
177312
177402
|
if (rel && (isDeniedSourcePath(`${rel}/x`) || isDeniedSourcePath(`${rel.toLowerCase()}/x`))) return refuse5("denied", `"${rel}" is a folder this tool does not touch`);
|
|
177313
|
-
if (!
|
|
177403
|
+
if (!existsSync79(join79(dir, CONTENT_MARKER))) {
|
|
177314
177404
|
return refuse5("not_an_app", `"${rel || "."}" is not an app folder (no ${CONTENT_MARKER}) \u2014 see himi_list_apps, or create one with himi_init`);
|
|
177315
177405
|
}
|
|
177316
177406
|
return dir;
|
|
@@ -177318,7 +177408,7 @@ async function confinedAppDir(args, deps) {
|
|
|
177318
177408
|
function onDiskSpelling(abs) {
|
|
177319
177409
|
let cur = abs;
|
|
177320
177410
|
const tail = [];
|
|
177321
|
-
while (!
|
|
177411
|
+
while (!existsSync79(cur)) {
|
|
177322
177412
|
const up = dirname45(cur);
|
|
177323
177413
|
if (up === cur) break;
|
|
177324
177414
|
tail.unshift(cur.slice(up.length + (up.endsWith(sep20) ? 0 : 1)));
|
|
@@ -177342,7 +177432,7 @@ function confinedPath(appDir3, rel) {
|
|
|
177342
177432
|
const abs = resolve61(appDir3, rel);
|
|
177343
177433
|
if (!within(appDir3, abs) || abs === appDir3) return { error: `"${rel}" is outside the app folder` };
|
|
177344
177434
|
const real = realish(abs);
|
|
177345
|
-
const base =
|
|
177435
|
+
const base = existsSync79(appDir3) ? realpathSync10(appDir3) : realish(appDir3);
|
|
177346
177436
|
if (!within(base, real) || real === base) return { error: `"${rel}" is outside the app folder` };
|
|
177347
177437
|
const link = symlinkComponent(appDir3, abs);
|
|
177348
177438
|
if (link) return { error: `"${link}" is a symlink, which this tool does not follow` };
|
|
@@ -177399,11 +177489,11 @@ function fileTools() {
|
|
|
177399
177489
|
inputSchema: z2.object({}),
|
|
177400
177490
|
handler: async (_a3, d2) => {
|
|
177401
177491
|
const root = resolve61(await d2.defaultDir());
|
|
177402
|
-
if (!
|
|
177492
|
+
if (!existsSync79(root)) return ok({ ok: true, workspace: root, apps: [] });
|
|
177403
177493
|
const apps = [];
|
|
177404
|
-
if (
|
|
177494
|
+
if (existsSync79(join79(root, CONTENT_MARKER))) apps.push(".");
|
|
177405
177495
|
for (const e2 of readdirSync36(root, { withFileTypes: true })) {
|
|
177406
|
-
if (e2.isDirectory() && !e2.name.startsWith(".") &&
|
|
177496
|
+
if (e2.isDirectory() && !e2.name.startsWith(".") && existsSync79(join79(root, e2.name, CONTENT_MARKER))) apps.push(e2.name);
|
|
177407
177497
|
}
|
|
177408
177498
|
return ok({ ok: true, workspace: root, apps: apps.sort() });
|
|
177409
177499
|
}
|
|
@@ -177417,7 +177507,7 @@ function fileTools() {
|
|
|
177417
177507
|
handler: async (a2, d2) => {
|
|
177418
177508
|
const app = await confinedAppDir(a2, d2);
|
|
177419
177509
|
if (typeof app !== "string") return app;
|
|
177420
|
-
if (!
|
|
177510
|
+
if (!existsSync79(app) || !statSync22(app).isDirectory()) return refuse5("no_app", `no folder at ${app}`);
|
|
177421
177511
|
return ok({ ok: true, dir: app, ...listFiles(app) });
|
|
177422
177512
|
}
|
|
177423
177513
|
},
|
|
@@ -177432,10 +177522,10 @@ function fileTools() {
|
|
|
177432
177522
|
if (typeof app !== "string") return app;
|
|
177433
177523
|
const p2 = confinedPath(app, a2.path);
|
|
177434
177524
|
if (typeof p2 !== "string") return refuse5("bad_path", p2.error);
|
|
177435
|
-
if (!
|
|
177525
|
+
if (!existsSync79(p2) || !lstatSync25(p2).isFile()) return refuse5("not_found", `no file "${String(a2.path)}"`);
|
|
177436
177526
|
const size = statSync22(p2).size;
|
|
177437
177527
|
if (size > MAX_FILE_BYTES) return refuse5("too_large", `"${String(a2.path)}" is ${size} bytes \u2014 over the ${MAX_FILE_BYTES}-byte read limit`);
|
|
177438
|
-
return ok({ ok: true, path: a2.path, bytes: size, content:
|
|
177528
|
+
return ok({ ok: true, path: a2.path, bytes: size, content: readFileSync91(p2, "utf8") });
|
|
177439
177529
|
}
|
|
177440
177530
|
},
|
|
177441
177531
|
{
|
|
@@ -177459,7 +177549,7 @@ function fileTools() {
|
|
|
177459
177549
|
if (typeof p2 !== "string") refused2.push({ path: f2.path, error: p2.error });
|
|
177460
177550
|
else if (typeof f2.content !== "string") refused2.push({ path: f2.path, error: "content must be text" });
|
|
177461
177551
|
else if (Buffer.byteLength(f2.content) > MAX_FILE_BYTES) refused2.push({ path: f2.path, error: `over the ${MAX_FILE_BYTES}-byte limit` });
|
|
177462
|
-
else if (
|
|
177552
|
+
else if (existsSync79(p2) && !lstatSync25(p2).isFile()) refused2.push({ path: f2.path, error: "not a regular file" });
|
|
177463
177553
|
else if (planned2.some((q3) => q3.abs === p2)) refused2.push({ path: f2.path, error: "the same file twice in one call" });
|
|
177464
177554
|
else planned2.push({ abs: p2, rel: String(f2.path), content: f2.content });
|
|
177465
177555
|
}
|
|
@@ -177492,7 +177582,7 @@ function fileTools() {
|
|
|
177492
177582
|
for (const rel of paths2) {
|
|
177493
177583
|
const p2 = confinedPath(app, rel);
|
|
177494
177584
|
if (typeof p2 !== "string") refused2.push({ path: rel, error: p2.error });
|
|
177495
|
-
else if (!
|
|
177585
|
+
else if (!existsSync79(p2)) refused2.push({ path: rel, error: "no such file" });
|
|
177496
177586
|
else if (!lstatSync25(p2).isFile()) refused2.push({ path: rel, error: "not a regular file" });
|
|
177497
177587
|
else if (!planned2.includes(p2)) {
|
|
177498
177588
|
planned2.push(p2);
|
|
@@ -178186,7 +178276,7 @@ __export(server_exports, {
|
|
|
178186
178276
|
protectStdout: () => protectStdout,
|
|
178187
178277
|
startMcpServer: () => startMcpServer
|
|
178188
178278
|
});
|
|
178189
|
-
import { mkdirSync as mkdirSync38, readFileSync as
|
|
178279
|
+
import { mkdirSync as mkdirSync38, readFileSync as readFileSync92 } from "node:fs";
|
|
178190
178280
|
import { fileURLToPath as fileURLToPath32 } from "node:url";
|
|
178191
178281
|
import { McpServer } from "@modelcontextprotocol/server";
|
|
178192
178282
|
import { serveStdio, StdioServerTransport } from "@modelcontextprotocol/server/stdio";
|
|
@@ -178246,7 +178336,7 @@ async function startMcpServer(opts) {
|
|
|
178246
178336
|
status: (dir) => previewStatus(dir, previewDeps),
|
|
178247
178337
|
stop: (dir) => stopPreview(dir, previewDeps)
|
|
178248
178338
|
},
|
|
178249
|
-
readFile: (p2) =>
|
|
178339
|
+
readFile: (p2) => readFileSync92(p2),
|
|
178250
178340
|
login: createLoginSession({ ...defaultLoginDeps, selfCommand: previewDeps.selfCommand, ...opts.login }),
|
|
178251
178341
|
...opts.workspace ? { workspaceBoundary: opts.workspace } : {}
|
|
178252
178342
|
};
|
|
@@ -178305,14 +178395,14 @@ var init_open_url = __esm({
|
|
|
178305
178395
|
});
|
|
178306
178396
|
|
|
178307
178397
|
// src/ux-audit.ts
|
|
178308
|
-
import { existsSync as
|
|
178398
|
+
import { existsSync as existsSync82, readFileSync as readFileSync93, readdirSync as readdirSync37 } from "node:fs";
|
|
178309
178399
|
import { join as join83, relative as relative18, resolve as resolve66 } from "node:path";
|
|
178310
178400
|
function issue2(issues, strict, code, message2, path2) {
|
|
178311
178401
|
issues.push({ code, message: message2, ...path2 ? { path: path2 } : {}, severity: strict ? "error" : "warning" });
|
|
178312
178402
|
}
|
|
178313
178403
|
function readText2(path2) {
|
|
178314
178404
|
try {
|
|
178315
|
-
return
|
|
178405
|
+
return existsSync82(path2) ? readFileSync93(path2, "utf8") : null;
|
|
178316
178406
|
} catch {
|
|
178317
178407
|
return null;
|
|
178318
178408
|
}
|
|
@@ -178358,16 +178448,41 @@ function auditUx(content, strict = false) {
|
|
|
178358
178448
|
if (parsed.error) {
|
|
178359
178449
|
issues.push({ code: "invalid-native-evidence", message: `${UX_EVIDENCE_PATH} ${parsed.error}.`, path: UX_EVIDENCE_PATH, severity: "error" });
|
|
178360
178450
|
}
|
|
178451
|
+
const nativeAudit = {};
|
|
178452
|
+
const disclosedGaps = [];
|
|
178361
178453
|
for (const platform of ["ios", "android"]) {
|
|
178362
178454
|
const record3 = parsed.evidence?.platforms[platform];
|
|
178363
178455
|
if (!record3) {
|
|
178364
|
-
|
|
178456
|
+
nativeAudit[platform] = { status: "missing" };
|
|
178457
|
+
issue2(
|
|
178458
|
+
issues,
|
|
178459
|
+
strict,
|
|
178460
|
+
`missing-${platform}-audit`,
|
|
178461
|
+
`No ${platform} native audit is recorded. After driving the installed app, run \`himi ux record --content . --platform ${platform} --status passed|failed --checks back,keyboard,\u2026\`. No ${platform === "ios" ? "iOS device or simulator" : "Android device or emulator"}? Record that it was NOT run, with the reason: \`himi ux record --content . --platform ${platform} --status unavailable --reason "<why it could not be driven>"\` \u2014 this report then shows it as a disclosed gap, never as a pass.`,
|
|
178462
|
+
UX_EVIDENCE_PATH
|
|
178463
|
+
);
|
|
178365
178464
|
continue;
|
|
178366
178465
|
}
|
|
178367
178466
|
if (!["passed", "failed", "unavailable"].includes(record3.status)) {
|
|
178467
|
+
nativeAudit[platform] = { status: "invalid" };
|
|
178368
178468
|
issues.push({ code: `invalid-${platform}-status`, message: `${platform} audit has an invalid status.`, path: UX_EVIDENCE_PATH, severity: "error" });
|
|
178469
|
+
} else if (record3.status === "unavailable") {
|
|
178470
|
+
const reason = typeof record3.reason === "string" ? record3.reason.trim() : "";
|
|
178471
|
+
nativeAudit[platform] = { status: "not-run", reason };
|
|
178472
|
+
if (reason) {
|
|
178473
|
+
disclosedGaps.push({ platform, status: "not-run", reason });
|
|
178474
|
+
issues.push({
|
|
178475
|
+
code: `${platform}-audit-not-run`,
|
|
178476
|
+
message: `${platform} native audit was NOT run (${reason}). This is a disclosed gap, not a pass: nothing was driven on ${platform}, so say so wherever the app is handed over, and record a real drive when a device is available.`,
|
|
178477
|
+
path: UX_EVIDENCE_PATH,
|
|
178478
|
+
severity: "warning"
|
|
178479
|
+
});
|
|
178480
|
+
}
|
|
178369
178481
|
} else if (record3.status === "failed") {
|
|
178482
|
+
nativeAudit[platform] = { status: "failed" };
|
|
178370
178483
|
issues.push({ code: `${platform}-audit-failed`, message: `${platform} native audit is recorded as failed; fix it or record a justified unavailable platform.`, path: UX_EVIDENCE_PATH, severity: "error" });
|
|
178484
|
+
} else {
|
|
178485
|
+
nativeAudit[platform] = { status: "passed" };
|
|
178371
178486
|
}
|
|
178372
178487
|
const malformedChecks = record3.checks !== void 0 && !Array.isArray(record3.checks);
|
|
178373
178488
|
if (malformedChecks || record3.status !== "unavailable" && (record3.checks ?? []).length === 0) {
|
|
@@ -178377,6 +178492,13 @@ function auditUx(content, strict = false) {
|
|
|
178377
178492
|
if (record3.status === "unavailable" && !record3.reason?.trim()) {
|
|
178378
178493
|
issues.push({ code: `missing-${platform}-reason`, message: `${platform} is unavailable but has no reason.`, path: UX_EVIDENCE_PATH, severity: "error" });
|
|
178379
178494
|
}
|
|
178495
|
+
const shapeError = new RegExp(`^(?:missing-${platform}-(?:checks|reason)|invalid-${platform}-status)$`);
|
|
178496
|
+
if (issues.some((item) => item.severity === "error" && shapeError.test(item.code))) {
|
|
178497
|
+
nativeAudit[platform] = { status: "invalid" };
|
|
178498
|
+
const at2 = disclosedGaps.findIndex((gap) => gap.platform === platform);
|
|
178499
|
+
if (at2 !== -1) disclosedGaps.splice(at2, 1);
|
|
178500
|
+
for (let i2 = issues.length - 1; i2 >= 0; i2--) if (issues[i2].code === `${platform}-audit-not-run`) issues.splice(i2, 1);
|
|
178501
|
+
}
|
|
178380
178502
|
}
|
|
178381
178503
|
const source = walkSource(dir);
|
|
178382
178504
|
const placeholder3 = /\breplace with\b|\bYOUR_[A-Z0-9_]+\b/i;
|
|
@@ -178412,11 +178534,11 @@ function auditUx(content, strict = false) {
|
|
|
178412
178534
|
}
|
|
178413
178535
|
if (usesAppNetwork(source)) {
|
|
178414
178536
|
const mocksPath = join83(dir, "dev", "net-mocks.json");
|
|
178415
|
-
if (!
|
|
178537
|
+
if (!existsSync82(mocksPath)) {
|
|
178416
178538
|
issue2(issues, strict, "missing-app-mocks", "This package uses a Wix/network client but has no app-specific dev/net-mocks.json. `himi test --record` writes one from the live responses it sees; then add fixtures for dynamic, entitlement, or recovery flows.", "dev/net-mocks.json");
|
|
178417
178539
|
} else {
|
|
178418
178540
|
try {
|
|
178419
|
-
const parsed2 = JSON.parse(
|
|
178541
|
+
const parsed2 = JSON.parse(readFileSync93(mocksPath, "utf8"));
|
|
178420
178542
|
const errors2 = Array.isArray(parsed2?.rules) ? wixMockRuleErrors(parsed2.rules) : ['missing top-level "rules" array'];
|
|
178421
178543
|
if (errors2.length) issue2(issues, strict, "invalid-app-mocks", `dev/net-mocks.json cannot serve the flows it claims to mock: ${errors2.join("; ")}`, "dev/net-mocks.json");
|
|
178422
178544
|
} catch (error) {
|
|
@@ -178426,7 +178548,7 @@ function auditUx(content, strict = false) {
|
|
|
178426
178548
|
}
|
|
178427
178549
|
const errors = issues.filter((item) => item.severity === "error");
|
|
178428
178550
|
const warnings = issues.filter((item) => item.severity === "warning");
|
|
178429
|
-
return { ok: errors.length === 0, strict, content: dir, evidencePath: UX_EVIDENCE_PATH, errors, warnings, counts: { errors: errors.length, warnings: warnings.length } };
|
|
178551
|
+
return { ok: errors.length === 0, strict, content: dir, evidencePath: UX_EVIDENCE_PATH, errors, warnings, counts: { errors: errors.length, warnings: warnings.length }, nativeAudit, disclosedGaps };
|
|
178430
178552
|
}
|
|
178431
178553
|
var SOURCE_EXTENSIONS, IGNORED_DIRECTORIES;
|
|
178432
178554
|
var init_ux_audit = __esm({
|
|
@@ -178552,8 +178674,8 @@ __export(native_decode_exports, {
|
|
|
178552
178674
|
runAndroidNativeDecode: () => runAndroidNativeDecode,
|
|
178553
178675
|
runNativeDecode: () => runNativeDecode
|
|
178554
178676
|
});
|
|
178555
|
-
import { execFileSync as execFileSync6, spawnSync as
|
|
178556
|
-
import { existsSync as
|
|
178677
|
+
import { execFileSync as execFileSync6, spawnSync as spawnSync9 } from "node:child_process";
|
|
178678
|
+
import { existsSync as existsSync83, mkdirSync as mkdirSync41, mkdtempSync as mkdtempSync5, readFileSync as readFileSync94, rmSync as rmSync23, writeFileSync as writeFileSync36 } from "node:fs";
|
|
178557
178679
|
import { homedir as homedir10, tmpdir as tmpdir6 } from "node:os";
|
|
178558
178680
|
import { join as join85 } from "node:path";
|
|
178559
178681
|
import { fileURLToPath as fileURLToPath33 } from "node:url";
|
|
@@ -178565,19 +178687,19 @@ function nativeDecodeAndroidHarnessDir() {
|
|
|
178565
178687
|
}
|
|
178566
178688
|
function nativeOracleShipped() {
|
|
178567
178689
|
return {
|
|
178568
|
-
ios:
|
|
178569
|
-
android:
|
|
178690
|
+
ios: existsSync83(join85(nativeDecodePackageDir(), "Package.swift")),
|
|
178691
|
+
android: existsSync83(join85(nativeDecodeAndroidHarnessDir(), "gradlew"))
|
|
178570
178692
|
};
|
|
178571
178693
|
}
|
|
178572
178694
|
function detectNativeDecode(options = {}) {
|
|
178573
178695
|
const hostPlatform = options.hostPlatform ?? process.platform;
|
|
178574
178696
|
const packageDir = options.packageDir ?? nativeDecodePackageDir();
|
|
178575
|
-
const swiftAvailable = options.swiftAvailable ??
|
|
178697
|
+
const swiftAvailable = options.swiftAvailable ?? spawnSync9("swift", ["--version"], { stdio: "ignore" }).status === 0;
|
|
178576
178698
|
if (hostPlatform !== "darwin") {
|
|
178577
178699
|
return { platform: "ios", available: false, reason: `the iOS decoder oracle requires macOS (darwin); this host is ${hostPlatform}` };
|
|
178578
178700
|
}
|
|
178579
178701
|
if (!swiftAvailable) return { platform: "ios", available: false, reason: "swift is not on PATH" };
|
|
178580
|
-
const packageAvailable = options.packageAvailable ??
|
|
178702
|
+
const packageAvailable = options.packageAvailable ?? existsSync83(join85(packageDir, "Package.swift"));
|
|
178581
178703
|
if (!packageAvailable) {
|
|
178582
178704
|
return {
|
|
178583
178705
|
platform: "ios",
|
|
@@ -178589,7 +178711,7 @@ function detectNativeDecode(options = {}) {
|
|
|
178589
178711
|
}
|
|
178590
178712
|
function localPropertiesSdk(harnessDir) {
|
|
178591
178713
|
try {
|
|
178592
|
-
const match =
|
|
178714
|
+
const match = readFileSync94(join85(harnessDir, "local.properties"), "utf8").match(/^sdk\.dir\s*=\s*(.+)$/m);
|
|
178593
178715
|
return match?.[1]?.trim().replace(/\\([ :\\])/g, "$1") ?? null;
|
|
178594
178716
|
} catch {
|
|
178595
178717
|
return null;
|
|
@@ -178603,7 +178725,7 @@ function defaultAndroidSdkDir(hostPlatform, home) {
|
|
|
178603
178725
|
function detectAndroidNativeDecode(options = {}) {
|
|
178604
178726
|
const harnessDir = options.harnessDir ?? nativeDecodeAndroidHarnessDir();
|
|
178605
178727
|
const gradlew = join85(harnessDir, "gradlew");
|
|
178606
|
-
const gradlewAvailable = options.gradlewAvailable ??
|
|
178728
|
+
const gradlewAvailable = options.gradlewAvailable ?? existsSync83(gradlew);
|
|
178607
178729
|
if (!gradlewAvailable) {
|
|
178608
178730
|
return {
|
|
178609
178731
|
platform: "android",
|
|
@@ -178611,7 +178733,7 @@ function detectAndroidNativeDecode(options = {}) {
|
|
|
178611
178733
|
reason: "the in-repo Android Gradle harness is unavailable (off-repo installs do not ship the decoder oracle)"
|
|
178612
178734
|
};
|
|
178613
178735
|
}
|
|
178614
|
-
const exists = typeof options.sdkAvailable === "function" ? options.sdkAvailable : typeof options.sdkAvailable === "boolean" ? /* @__PURE__ */ ((answer) => () => answer)(options.sdkAvailable) :
|
|
178736
|
+
const exists = typeof options.sdkAvailable === "function" ? options.sdkAvailable : typeof options.sdkAvailable === "boolean" ? /* @__PURE__ */ ((answer) => () => answer)(options.sdkAvailable) : existsSync83;
|
|
178615
178737
|
const defaultDir = defaultAndroidSdkDir(options.hostPlatform ?? process.platform, options.homeDir ?? homedir10());
|
|
178616
178738
|
const candidates = [
|
|
178617
178739
|
options.androidHome ?? process.env.ANDROID_HOME,
|
|
@@ -178774,7 +178896,7 @@ function runAndroidNativeDecode(options) {
|
|
|
178774
178896
|
encoding: "utf8",
|
|
178775
178897
|
...options.sdkDir ? { env: { ...process.env, ANDROID_HOME: options.sdkDir, ANDROID_SDK_ROOT: options.sdkDir } } : {}
|
|
178776
178898
|
});
|
|
178777
|
-
const stdout =
|
|
178899
|
+
const stdout = readFileSync94(outputPath, "utf8");
|
|
178778
178900
|
return {
|
|
178779
178901
|
platform: "android",
|
|
178780
178902
|
...parseNativeDecodeRun(stdout, options.descriptors.map((descriptor) => descriptor.screenId), "android", tokensPath !== void 0),
|
|
@@ -178874,7 +178996,7 @@ __export(browser_authoring_exports, {
|
|
|
178874
178996
|
});
|
|
178875
178997
|
import { createServer as createServer4 } from "node:http";
|
|
178876
178998
|
import { createHash as createHash38, randomBytes as randomBytes4 } from "node:crypto";
|
|
178877
|
-
import { existsSync as
|
|
178999
|
+
import { existsSync as existsSync84, readdirSync as readdirSync38, readFileSync as readFileSync95, realpathSync as realpathSync11, statSync as statSync23 } from "node:fs";
|
|
178878
179000
|
import { join as join86, posix as posix3, relative as relative19, sep as sep21 } from "node:path";
|
|
178879
179001
|
function humanMs(ms2) {
|
|
178880
179002
|
return ms2 < 1e3 ? `${ms2}ms` : `${Math.round(ms2 / 1e3)}s`;
|
|
@@ -178893,11 +179015,11 @@ function collectWorkerSources(tier5SrcDir, bundleName) {
|
|
|
178893
179015
|
if (statSync23(childAbs).isDirectory()) {
|
|
178894
179016
|
walk2(childAbs, childRel);
|
|
178895
179017
|
} else if (/\.(ts|tsx|js|mjs|json)$/.test(name)) {
|
|
178896
|
-
files[childRel] =
|
|
179018
|
+
files[childRel] = readFileSync95(childAbs, "utf8");
|
|
178897
179019
|
}
|
|
178898
179020
|
}
|
|
178899
179021
|
};
|
|
178900
|
-
if (!
|
|
179022
|
+
if (!existsSync84(root)) return null;
|
|
178901
179023
|
walk2(root, `/tier5-src/${bundleName}`);
|
|
178902
179024
|
const entry = [`/tier5-src/${bundleName}/index.ts`, `/tier5-src/${bundleName}/index.js`].find((p2) => p2 in files);
|
|
178903
179025
|
if (!entry) return null;
|
|
@@ -178924,10 +179046,10 @@ function collectRelativeSiblings(files, tier5SrcDir) {
|
|
|
178924
179046
|
join86(onDisk, "index.js")
|
|
178925
179047
|
];
|
|
178926
179048
|
for (const abs of candidates) {
|
|
178927
|
-
if (!
|
|
179049
|
+
if (!existsSync84(abs) || statSync23(abs).isDirectory()) continue;
|
|
178928
179050
|
const key3 = `/tier5-src/${relative19(tier5SrcDir, abs).split(sep21).join(posix3.sep)}`;
|
|
178929
179051
|
if (key3 in files) break;
|
|
178930
|
-
files[key3] =
|
|
179052
|
+
files[key3] = readFileSync95(abs, "utf8");
|
|
178931
179053
|
queue.push(key3);
|
|
178932
179054
|
break;
|
|
178933
179055
|
}
|
|
@@ -178962,7 +179084,7 @@ function collectSdkModules(files, resolveSubpath) {
|
|
|
178962
179084
|
function sdkSubpathReader(resolve98) {
|
|
178963
179085
|
return (sub) => {
|
|
178964
179086
|
try {
|
|
178965
|
-
return
|
|
179087
|
+
return readFileSync95(resolve98(`@wix/himalaya/${sub}`), "utf8");
|
|
178966
179088
|
} catch {
|
|
178967
179089
|
return null;
|
|
178968
179090
|
}
|
|
@@ -179704,7 +179826,7 @@ __export(coverage_exports, {
|
|
|
179704
179826
|
verifyNativeProof: () => verifyNativeProof
|
|
179705
179827
|
});
|
|
179706
179828
|
import { createHash as createHash39 } from "node:crypto";
|
|
179707
|
-
import { existsSync as
|
|
179829
|
+
import { existsSync as existsSync85, readFileSync as readFileSync96, writeFileSync as writeFileSync37 } from "node:fs";
|
|
179708
179830
|
import { isAbsolute as isAbsolute9, join as join87, resolve as resolve67 } from "node:path";
|
|
179709
179831
|
function sectionVisibilityProof(record3, contentDir2) {
|
|
179710
179832
|
const proof = obj4(record3.sectionVisibility);
|
|
@@ -179712,20 +179834,20 @@ function sectionVisibilityProof(record3, contentDir2) {
|
|
|
179712
179834
|
const path2 = report7.path;
|
|
179713
179835
|
if (proof.kind !== "automated" || typeof proof.command !== "string" || !proof.command.trim() || proof.hiddenMemberReads !== 0 || !Object.entries(SECTION_VISIBILITY_STATES).every(([key3, value2]) => states[key3] === value2) || typeof path2 !== "string" || !path2.trim() || isAbsolute9(path2) || path2.split(/[\\/]/).includes("..") || typeof report7.sha256 !== "string" || !/^[a-f0-9]{64}$/.test(report7.sha256)) return false;
|
|
179714
179836
|
try {
|
|
179715
|
-
return sha(
|
|
179837
|
+
return sha(readFileSync96(join87(resolve67(contentDir2), path2))) === report7.sha256;
|
|
179716
179838
|
} catch {
|
|
179717
179839
|
return false;
|
|
179718
179840
|
}
|
|
179719
179841
|
}
|
|
179720
179842
|
function verifiedEvidence(evidenceDir) {
|
|
179721
|
-
const manifest2 = obj4(JSON.parse(
|
|
179843
|
+
const manifest2 = obj4(JSON.parse(readFileSync96(join87(evidenceDir, "manifest.json"), "utf8")));
|
|
179722
179844
|
if (manifest2.workflow !== "one-app-to-himi-app" || manifest2.stage !== "collected") throw Error("One App evidence is not collected.");
|
|
179723
179845
|
const hashes = obj4(manifest2.sha256);
|
|
179724
179846
|
const read = (name, required3) => {
|
|
179725
179847
|
const expected = hashes[name];
|
|
179726
179848
|
if (expected === void 0 && !required3) return void 0;
|
|
179727
179849
|
if (typeof expected !== "string" || !/^[a-f0-9]{64}$/i.test(expected)) throw Error(`Missing or invalid hash for ${name}.`);
|
|
179728
|
-
const bytes2 =
|
|
179850
|
+
const bytes2 = readFileSync96(join87(evidenceDir, name));
|
|
179729
179851
|
if (sha(bytes2) !== expected) throw Error(`${name} differs from manifest.json.`);
|
|
179730
179852
|
return obj4(JSON.parse(bytes2.toString("utf8")));
|
|
179731
179853
|
};
|
|
@@ -179876,10 +179998,10 @@ function deriveRequirements(evidenceDir) {
|
|
|
179876
179998
|
function verifyNativeProof(contentDir2, releaseHash, requirementIds) {
|
|
179877
179999
|
const root = resolve67(contentDir2);
|
|
179878
180000
|
const path2 = join87(root, NATIVE_PROOF_FILE);
|
|
179879
|
-
if (!
|
|
180001
|
+
if (!existsSync85(path2)) return { ok: false, issues: [`${NATIVE_PROOF_FILE} is absent.`] };
|
|
179880
180002
|
let proof;
|
|
179881
180003
|
try {
|
|
179882
|
-
proof = obj4(JSON.parse(
|
|
180004
|
+
proof = obj4(JSON.parse(readFileSync96(path2, "utf8")));
|
|
179883
180005
|
} catch {
|
|
179884
180006
|
return { ok: false, issues: [`${NATIVE_PROOF_FILE} is not readable JSON.`] };
|
|
179885
180007
|
}
|
|
@@ -179898,7 +180020,7 @@ function verifyNativeProof(contentDir2, releaseHash, requirementIds) {
|
|
|
179898
180020
|
continue;
|
|
179899
180021
|
}
|
|
179900
180022
|
const artifact = record3.artifact;
|
|
179901
|
-
if (typeof artifact !== "string" || !artifact.trim() || isAbsolute9(artifact) || artifact.split(/[\\/]/).includes("..") || !
|
|
180023
|
+
if (typeof artifact !== "string" || !artifact.trim() || isAbsolute9(artifact) || artifact.split(/[\\/]/).includes("..") || !existsSync85(join87(root, artifact))) {
|
|
179902
180024
|
issues.push(`Native walkthrough check ${id} needs a reviewable artifact file.`);
|
|
179903
180025
|
}
|
|
179904
180026
|
}
|
|
@@ -179907,8 +180029,8 @@ function verifyNativeProof(contentDir2, releaseHash, requirementIds) {
|
|
|
179907
180029
|
function syncCoverage(evidenceDir, contentDir2, write2 = true) {
|
|
179908
180030
|
const current = deriveRequirements(evidenceDir);
|
|
179909
180031
|
const path2 = join87(resolve67(contentDir2), COVERAGE_FILE);
|
|
179910
|
-
const existed =
|
|
179911
|
-
const old = existed ? obj4(JSON.parse(
|
|
180032
|
+
const existed = existsSync85(path2);
|
|
180033
|
+
const old = existed ? obj4(JSON.parse(readFileSync96(path2, "utf8"))) : {};
|
|
179912
180034
|
const hashesChanged = existed && JSON.stringify(old.sourceHashes) !== JSON.stringify(current.sourceHashes);
|
|
179913
180035
|
const prior = Array.isArray(old.requirements) ? old.requirements : [];
|
|
179914
180036
|
const byId2 = new Map(prior.map((row2) => [row2.id, row2]));
|
|
@@ -179976,12 +180098,12 @@ function verifyCoverage(evidenceDir, contentDir2, releaseHash, builtScreenIds) {
|
|
|
179976
180098
|
if (result.removed.length) issues.push({ message: `${result.removed.length} saved requirements no longer match source evidence.` });
|
|
179977
180099
|
if (result.changed.length) issues.push({ message: `${result.changed.length} saved source descriptions were edited.` });
|
|
179978
180100
|
if (result.hashesChanged) issues.push({ message: "Saved source hashes differ from the collected evidence." });
|
|
179979
|
-
const saved = result.existed ? obj4(JSON.parse(
|
|
180101
|
+
const saved = result.existed ? obj4(JSON.parse(readFileSync96(join87(resolve67(contentDir2), COVERAGE_FILE), "utf8"))) : {};
|
|
179980
180102
|
const rows = Array.isArray(saved.requirements) ? saved.requirements.map(obj4) : [];
|
|
179981
180103
|
const memberSectionIds = new Set(result.coverage.requirements.filter((row2) => row2.sectionVisibility?.authentication === "signed-in-only").map((row2) => row2.id));
|
|
179982
180104
|
const unresolvedSectionIds = new Set(result.coverage.requirements.filter((row2) => row2.sectionVisibility?.authentication === "unresolved").map((row2) => row2.id));
|
|
179983
180105
|
const contentManifest = join87(resolve67(contentDir2), "himalaya.content.json");
|
|
179984
|
-
const declaredScreens2 =
|
|
180106
|
+
const declaredScreens2 = existsSync85(contentManifest) ? obj4(obj4(JSON.parse(readFileSync96(contentManifest, "utf8"))).screens) : void 0;
|
|
179985
180107
|
const availableScreens = builtScreenIds ? new Set(builtScreenIds) : declaredScreens2 && Object.keys(declaredScreens2).length ? new Set(Object.keys(declaredScreens2)) : void 0;
|
|
179986
180108
|
for (const row2 of rows) {
|
|
179987
180109
|
const id = typeof row2.id === "string" ? row2.id : void 0;
|
|
@@ -180022,11 +180144,11 @@ function verifyCoverage(evidenceDir, contentDir2, releaseHash, builtScreenIds) {
|
|
|
180022
180144
|
const path2 = check.evidence;
|
|
180023
180145
|
if (typeof path2 !== "string" || !path2.trim() || isAbsolute9(path2) || path2.split(/[\\/]/).includes("..")) {
|
|
180024
180146
|
issues.push({ id, message: `Check ${required3} needs a safe relative evidence path.` });
|
|
180025
|
-
} else if (!
|
|
180147
|
+
} else if (!existsSync85(join87(resolve67(contentDir2), path2))) {
|
|
180026
180148
|
issues.push({ id, message: `Check ${required3} evidence file is absent: ${path2}.` });
|
|
180027
180149
|
} else {
|
|
180028
180150
|
try {
|
|
180029
|
-
const proof = obj4(JSON.parse(
|
|
180151
|
+
const proof = obj4(JSON.parse(readFileSync96(join87(resolve67(contentDir2), path2), "utf8")));
|
|
180030
180152
|
const records = Array.isArray(proof.checks) ? proof.checks.map(obj4) : [];
|
|
180031
180153
|
const record3 = records.filter((item) => item.requirementId === id && item.check === required3 && item.releaseHash === check.releaseHash && (kind === "design" || obj4(item.target).screenId === target.screenId) && (kind !== "interaction" && kind !== "top-bar" || obj4(item.target).controlId === target.controlId)).at(-1);
|
|
180032
180154
|
if (!record3 || record3.status !== "passed") {
|
|
@@ -180036,14 +180158,14 @@ function verifyCoverage(evidenceDir, contentDir2, releaseHash, builtScreenIds) {
|
|
|
180036
180158
|
issues.push({ id, message: "Member-only section visibility needs deterministic automated transition assertions, zero hidden member reads and a hashed test report." });
|
|
180037
180159
|
}
|
|
180038
180160
|
const artifact = record3.artifact;
|
|
180039
|
-
if (typeof artifact !== "string" || !artifact.trim() || isAbsolute9(artifact) || artifact.split(/[\\/]/).includes("..") || !
|
|
180161
|
+
if (typeof artifact !== "string" || !artifact.trim() || isAbsolute9(artifact) || artifact.split(/[\\/]/).includes("..") || !existsSync85(join87(resolve67(contentDir2), artifact))) {
|
|
180040
180162
|
issues.push({ id, message: `Check ${required3} needs a reviewable artifact file.` });
|
|
180041
180163
|
}
|
|
180042
180164
|
if (kind === "native-widget") {
|
|
180043
180165
|
const baseline = obj4(record3.sourceBaseline);
|
|
180044
180166
|
const context = obj4(record3.targetContext);
|
|
180045
180167
|
const sourceArtifact = baseline.artifact;
|
|
180046
|
-
if (baseline.kind !== "native-device" || typeof sourceArtifact !== "string" || !sourceArtifact.trim() || isAbsolute9(sourceArtifact) || sourceArtifact.split(/[\\/]/).includes("..") || !
|
|
180168
|
+
if (baseline.kind !== "native-device" || typeof sourceArtifact !== "string" || !sourceArtifact.trim() || isAbsolute9(sourceArtifact) || sourceArtifact.split(/[\\/]/).includes("..") || !existsSync85(join87(resolve67(contentDir2), sourceArtifact))) {
|
|
180047
180169
|
issues.push({ id, message: "Native widget behavior needs a source-device baseline artifact; editor-only observations are unverified." });
|
|
180048
180170
|
}
|
|
180049
180171
|
if (!["siteId", "identityContext"].every((key3) => typeof baseline[key3] === "string" && String(baseline[key3]).trim() && baseline[key3] === context[key3]) || typeof sourceSiteId !== "string" || baseline.siteId !== sourceSiteId) {
|
|
@@ -180269,7 +180391,7 @@ __export(validate_topbar_exports, {
|
|
|
180269
180391
|
runOneAppTopBarValidation: () => runOneAppTopBarValidation
|
|
180270
180392
|
});
|
|
180271
180393
|
import { createHash as createHash40 } from "node:crypto";
|
|
180272
|
-
import { existsSync as
|
|
180394
|
+
import { existsSync as existsSync86, readFileSync as readFileSync97, statSync as statSync24 } from "node:fs";
|
|
180273
180395
|
import { resolve as resolve68, join as join88 } from "node:path";
|
|
180274
180396
|
import ts12 from "typescript";
|
|
180275
180397
|
function enrichedControls(raw, views) {
|
|
@@ -180327,7 +180449,7 @@ function object10(value2) {
|
|
|
180327
180449
|
return value2 !== null && typeof value2 === "object" && !Array.isArray(value2) ? value2 : void 0;
|
|
180328
180450
|
}
|
|
180329
180451
|
function readJson8(path2) {
|
|
180330
|
-
return object10(JSON.parse(
|
|
180452
|
+
return object10(JSON.parse(readFileSync97(path2, "utf8"))) ?? {};
|
|
180331
180453
|
}
|
|
180332
180454
|
function parseArgs(args) {
|
|
180333
180455
|
let evidenceDir;
|
|
@@ -180566,7 +180688,7 @@ function parseActions(topBar, source) {
|
|
|
180566
180688
|
return { actions, items };
|
|
180567
180689
|
}
|
|
180568
180690
|
function appLevelBundleUrl(configPath) {
|
|
180569
|
-
const source = ts12.createSourceFile(configPath,
|
|
180691
|
+
const source = ts12.createSourceFile(configPath, readFileSync97(configPath, "utf8"), ts12.ScriptTarget.Latest, true, ts12.ScriptKind.TS);
|
|
180570
180692
|
if (source.parseDiagnostics.length) return void 0;
|
|
180571
180693
|
const exportAssignment = source.statements.find(ts12.isExportAssignment);
|
|
180572
180694
|
if (!exportAssignment) return void 0;
|
|
@@ -180591,7 +180713,7 @@ function appLevelBundleUrl(configPath) {
|
|
|
180591
180713
|
return stringValue2(property(worker, "url"));
|
|
180592
180714
|
}
|
|
180593
180715
|
function configActions(configPath) {
|
|
180594
|
-
const source = ts12.createSourceFile(configPath,
|
|
180716
|
+
const source = ts12.createSourceFile(configPath, readFileSync97(configPath, "utf8"), ts12.ScriptTarget.Latest, true, ts12.ScriptKind.TS);
|
|
180595
180717
|
if (source.parseDiagnostics.length) return { actions: [], error: "config.ts could not be parsed." };
|
|
180596
180718
|
const exportAssignment = source.statements.find(ts12.isExportAssignment);
|
|
180597
180719
|
if (!exportAssignment) return { actions: [], error: "config.ts has no default app export." };
|
|
@@ -180634,8 +180756,8 @@ function configActions(configPath) {
|
|
|
180634
180756
|
}
|
|
180635
180757
|
function screenActions2(contentDir2) {
|
|
180636
180758
|
const path2 = join88(contentDir2, "dev", "index.ts");
|
|
180637
|
-
if (!
|
|
180638
|
-
const source = ts12.createSourceFile(path2,
|
|
180759
|
+
if (!existsSync86(path2)) return /* @__PURE__ */ new Map();
|
|
180760
|
+
const source = ts12.createSourceFile(path2, readFileSync97(path2, "utf8"), ts12.ScriptTarget.Latest, true, ts12.ScriptKind.TS);
|
|
180639
180761
|
if (source.parseDiagnostics.length) throw Error("dev/index.ts could not be parsed.");
|
|
180640
180762
|
const declaration = source.statements.filter(ts12.isVariableStatement).flatMap((statement) => [...statement.declarationList.declarations]).find((item) => ts12.isIdentifier(item.name) && item.name.text === "SCREENS");
|
|
180641
180763
|
const initializer = declaration?.initializer && unwrap2(declaration.initializer);
|
|
@@ -180669,10 +180791,10 @@ function screenActions2(contentDir2) {
|
|
|
180669
180791
|
}
|
|
180670
180792
|
function readHashedEvidenceJson(evidenceDir, name) {
|
|
180671
180793
|
const path2 = join88(evidenceDir, name);
|
|
180672
|
-
if (!
|
|
180794
|
+
if (!existsSync86(path2)) return void 0;
|
|
180673
180795
|
const expected = object10(readJson8(join88(evidenceDir, "manifest.json")).sha256)?.[name];
|
|
180674
180796
|
if (typeof expected !== "string" || !/^[a-f0-9]{64}$/i.test(expected)) throw new Error(`manifest.json records no hash for ${name}; recollect the source.`);
|
|
180675
|
-
const bytes2 =
|
|
180797
|
+
const bytes2 = readFileSync97(path2);
|
|
180676
180798
|
if (createHash40("sha256").update(bytes2).digest("hex") !== expected) throw new Error(`${name} does not match the hash recorded in manifest.json; recollect the source.`);
|
|
180677
180799
|
return JSON.parse(bytes2.toString("utf8"));
|
|
180678
180800
|
}
|
|
@@ -180685,7 +180807,7 @@ function readVerifiedEvidence(evidenceDir) {
|
|
|
180685
180807
|
throw new Error(`Platform top-bar behavior is unverified: ${unavailable.map((warning) => warning.platform).join(", ")} runtime context unavailable.`);
|
|
180686
180808
|
}
|
|
180687
180809
|
const rawPath = join88(evidenceDir, "raw-structure.json");
|
|
180688
|
-
const rawBytes =
|
|
180810
|
+
const rawBytes = readFileSync97(rawPath);
|
|
180689
180811
|
const expectedHash = object10(manifest2.sha256)?.["raw-structure.json"];
|
|
180690
180812
|
if (typeof expectedHash !== "string" || !/^[a-f0-9]{64}$/i.test(expectedHash)) {
|
|
180691
180813
|
throw new Error("manifest.json is missing a valid raw-structure.json hash.");
|
|
@@ -180700,7 +180822,7 @@ function readVerifiedEvidence(evidenceDir) {
|
|
|
180700
180822
|
const hash3 = object10(manifest2.sha256)?.[name];
|
|
180701
180823
|
if (hash3 === void 0) continue;
|
|
180702
180824
|
if (typeof hash3 !== "string" || !/^[a-f0-9]{64}$/i.test(hash3)) throw new Error(`Invalid ${name} hash.`);
|
|
180703
|
-
const bytes2 =
|
|
180825
|
+
const bytes2 = readFileSync97(join88(evidenceDir, name));
|
|
180704
180826
|
if (createHash40("sha256").update(bytes2).digest("hex") !== hash3) throw new Error(`${name} does not match manifest.json.`);
|
|
180705
180827
|
views[platform] = JSON.parse(bytes2.toString("utf8"));
|
|
180706
180828
|
}
|
|
@@ -180758,7 +180880,7 @@ function validate3(evidenceDir, contentDir2) {
|
|
|
180758
180880
|
const badgeTargets = /* @__PURE__ */ new Map();
|
|
180759
180881
|
const badgeDefinitions = new Map([...sourceBadges.values()].flat().map((button) => [button.requirementId, button]));
|
|
180760
180882
|
const coveragePath = join88(contentDir2, "ONE-APP-COVERAGE.json");
|
|
180761
|
-
if (
|
|
180883
|
+
if (existsSync86(coveragePath)) {
|
|
180762
180884
|
try {
|
|
180763
180885
|
const coverage = readJson8(coveragePath);
|
|
180764
180886
|
for (const row2 of Array.isArray(coverage.requirements) ? coverage.requirements : []) {
|
|
@@ -180910,7 +181032,7 @@ __export(app_services_exports, {
|
|
|
180910
181032
|
definedServices: () => definedServices
|
|
180911
181033
|
});
|
|
180912
181034
|
import ts13 from "typescript";
|
|
180913
|
-
import { existsSync as
|
|
181035
|
+
import { existsSync as existsSync87, readFileSync as readFileSync98 } from "node:fs";
|
|
180914
181036
|
import { join as join89 } from "node:path";
|
|
180915
181037
|
function definedServices(source, fileName = "worker.ts") {
|
|
180916
181038
|
const file2 = ts13.createSourceFile(fileName, source, ts13.ScriptTarget.Latest, true, ts13.ScriptKind.TS);
|
|
@@ -180929,13 +181051,13 @@ function definedServices(source, fileName = "worker.ts") {
|
|
|
180929
181051
|
function appLevelServices(contentDir2) {
|
|
180930
181052
|
try {
|
|
180931
181053
|
const config = join89(contentDir2, "config.ts");
|
|
180932
|
-
if (!
|
|
181054
|
+
if (!existsSync87(config)) return /* @__PURE__ */ new Set();
|
|
180933
181055
|
const url = appLevelBundleUrl(config);
|
|
180934
181056
|
if (!url) return /* @__PURE__ */ new Set();
|
|
180935
181057
|
const bundle = new URL(url, "http://localhost").pathname.split("/").filter(Boolean).pop();
|
|
180936
181058
|
if (!bundle || !/^[A-Za-z0-9._-]+$/.test(bundle)) return /* @__PURE__ */ new Set();
|
|
180937
181059
|
const entry = join89(contentDir2, "tier5-src", bundle.replace(/\.bundle\.js$/, ""), "index.ts");
|
|
180938
|
-
return
|
|
181060
|
+
return existsSync87(entry) ? new Set(definedServices(readFileSync98(entry, "utf8"), entry)) : /* @__PURE__ */ new Set();
|
|
180939
181061
|
} catch {
|
|
180940
181062
|
return /* @__PURE__ */ new Set();
|
|
180941
181063
|
}
|
|
@@ -180957,7 +181079,7 @@ __export(coverage_exports2, {
|
|
|
180957
181079
|
suppressedNativeKeys: () => suppressedNativeKeys,
|
|
180958
181080
|
trendAndStore: () => trendAndStore
|
|
180959
181081
|
});
|
|
180960
|
-
import { existsSync as
|
|
181082
|
+
import { existsSync as existsSync88, mkdirSync as mkdirSync42, readFileSync as readFileSync99, writeFileSync as writeFileSync38 } from "node:fs";
|
|
180961
181083
|
import { dirname as dirname49, join as join90 } from "node:path";
|
|
180962
181084
|
function suppressedNativeKeys(oracle) {
|
|
180963
181085
|
return [...oracle.ios ? [] : ["native-decode|ios"], ...oracle.android ? [] : ["native-decode|android"]];
|
|
@@ -181141,8 +181263,8 @@ function trendAndStore(dir, entries, suppressed) {
|
|
|
181141
181263
|
const p2 = join90(dir, LEDGER_FILE);
|
|
181142
181264
|
let previous = null;
|
|
181143
181265
|
try {
|
|
181144
|
-
if (
|
|
181145
|
-
const parsed = JSON.parse(
|
|
181266
|
+
if (existsSync88(p2)) {
|
|
181267
|
+
const parsed = JSON.parse(readFileSync99(p2, "utf8"));
|
|
181146
181268
|
if (Array.isArray(parsed.keys)) previous = parsed.keys.filter((k2) => typeof k2 === "string");
|
|
181147
181269
|
}
|
|
181148
181270
|
} catch {
|
|
@@ -181184,8 +181306,8 @@ function diffAndStoreObservations(dir, current) {
|
|
|
181184
181306
|
const p2 = join90(dir, OBS_FILE);
|
|
181185
181307
|
let previous = null;
|
|
181186
181308
|
try {
|
|
181187
|
-
if (
|
|
181188
|
-
const parsed = JSON.parse(
|
|
181309
|
+
if (existsSync88(p2)) {
|
|
181310
|
+
const parsed = JSON.parse(readFileSync99(p2, "utf8"));
|
|
181189
181311
|
if (parsed.screens && typeof parsed.screens === "object" && !Array.isArray(parsed.screens) && Object.values(parsed.screens).every(
|
|
181190
181312
|
(v2) => Array.isArray(v2) && v2.every((l2) => typeof l2 === "string")
|
|
181191
181313
|
)) {
|
|
@@ -181242,7 +181364,7 @@ var init_coverage2 = __esm({
|
|
|
181242
181364
|
});
|
|
181243
181365
|
|
|
181244
181366
|
// src/commands/render.ts
|
|
181245
|
-
import { readFileSync as
|
|
181367
|
+
import { readFileSync as readFileSync101 } from "node:fs";
|
|
181246
181368
|
import { join as join92, resolve as resolve69 } from "node:path";
|
|
181247
181369
|
function renderDeviceWidths() {
|
|
181248
181370
|
return {
|
|
@@ -181360,7 +181482,7 @@ async function renderCommand(ctx) {
|
|
|
181360
181482
|
return 2;
|
|
181361
181483
|
}
|
|
181362
181484
|
try {
|
|
181363
|
-
const raw = stateArg.trim().startsWith("{") ? stateArg :
|
|
181485
|
+
const raw = stateArg.trim().startsWith("{") ? stateArg : readFileSync101(stateArg.replace(/^@/, ""), "utf8");
|
|
181364
181486
|
injectedState = JSON.parse(raw);
|
|
181365
181487
|
} catch (e2) {
|
|
181366
181488
|
io2.error(JSON.stringify({ error: `--state must be inline JSON or a path to a .json file \u2014 ${e2.message}` }));
|
|
@@ -181375,7 +181497,7 @@ async function renderCommand(ctx) {
|
|
|
181375
181497
|
return 2;
|
|
181376
181498
|
}
|
|
181377
181499
|
try {
|
|
181378
|
-
const raw = inputArg.trim().startsWith("{") ? inputArg :
|
|
181500
|
+
const raw = inputArg.trim().startsWith("{") ? inputArg : readFileSync101(inputArg.replace(/^@/, ""), "utf8");
|
|
181379
181501
|
const parsed = JSON.parse(raw);
|
|
181380
181502
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error("must be a JSON object");
|
|
181381
181503
|
injectedInput = parsed;
|
|
@@ -181588,11 +181710,11 @@ __export(design_kits_exports, {
|
|
|
181588
181710
|
kitsDir: () => kitsDir,
|
|
181589
181711
|
listKits: () => listKits2
|
|
181590
181712
|
});
|
|
181591
|
-
import { existsSync as
|
|
181713
|
+
import { existsSync as existsSync90, readFileSync as readFileSync102, readdirSync as readdirSync39 } from "node:fs";
|
|
181592
181714
|
import { join as join93, basename as basename23 } from "node:path";
|
|
181593
181715
|
import { fileURLToPath as fileURLToPath34 } from "node:url";
|
|
181594
181716
|
function kitsDir() {
|
|
181595
|
-
return KIT_DIR_CANDIDATES.find((p2) =>
|
|
181717
|
+
return KIT_DIR_CANDIDATES.find((p2) => existsSync90(p2));
|
|
181596
181718
|
}
|
|
181597
181719
|
function listKits2() {
|
|
181598
181720
|
const dir = kitsDir();
|
|
@@ -181616,7 +181738,7 @@ In a published @wix/himalaya-cli this is a packaging bug \u2014 the kits should
|
|
|
181616
181738
|
if (!kits.includes(name)) {
|
|
181617
181739
|
return { ok: false, kit: name, kits, problems: [`no design kit named "${name}". Available: ${kits.join(", ")}`] };
|
|
181618
181740
|
}
|
|
181619
|
-
const raw =
|
|
181741
|
+
const raw = readFileSync102(join93(dir, `${name}.json`), "utf8");
|
|
181620
181742
|
let parsed;
|
|
181621
181743
|
try {
|
|
181622
181744
|
parsed = JSON.parse(raw);
|
|
@@ -184080,7 +184202,7 @@ __export(icon_exports2, {
|
|
|
184080
184202
|
boundedIconRendition: () => boundedIconRendition,
|
|
184081
184203
|
installOneAppIcon: () => installOneAppIcon
|
|
184082
184204
|
});
|
|
184083
|
-
import { existsSync as
|
|
184205
|
+
import { existsSync as existsSync91, mkdtempSync as mkdtempSync6, readFileSync as readFileSync103, rmSync as rmSync26, writeFileSync as writeFileSync40 } from "node:fs";
|
|
184084
184206
|
import { tmpdir as tmpdir7 } from "node:os";
|
|
184085
184207
|
import { join as join95 } from "node:path";
|
|
184086
184208
|
function boundedIconRendition(sourceUrl) {
|
|
@@ -184097,7 +184219,7 @@ function boundedIconRendition(sourceUrl) {
|
|
|
184097
184219
|
return `https://static.wixstatic.com/media/${media[1]}/v1/fit/w_1024,h_1024,q_90/mark.${extension}`;
|
|
184098
184220
|
}
|
|
184099
184221
|
async function installOneAppIcon(contentDir2, evidenceDir, fetchAsset = pinnedFetch2) {
|
|
184100
|
-
if (!
|
|
184222
|
+
if (!existsSync91(join95(contentDir2, "himalaya.content.json"))) {
|
|
184101
184223
|
throw new Error("Scaffold the content package before importing its source icon; collection evidence is read-only.");
|
|
184102
184224
|
}
|
|
184103
184225
|
const { raw } = verifiedEvidence(evidenceDir);
|
|
@@ -184130,13 +184252,13 @@ async function installOneAppIcon(contentDir2, evidenceDir, fetchAsset = pinnedFe
|
|
|
184130
184252
|
try {
|
|
184131
184253
|
const file2 = join95(scratch, "source-image");
|
|
184132
184254
|
writeFileSync40(file2, bytes2);
|
|
184133
|
-
writeFileSync40(join95(scratch, "himalaya.content.json"),
|
|
184255
|
+
writeFileSync40(join95(scratch, "himalaya.content.json"), readFileSync103(join95(contentDir2, "himalaya.content.json")));
|
|
184134
184256
|
const staged = await installIcon(scratch, file2, { derivePlay: true, background: backdropFromTokens(contentDir2) });
|
|
184135
184257
|
if (blocksRelease(staged.status, { requireVerified: true })) {
|
|
184136
184258
|
const details = [...staged.status.byteIssues, ...staged.status.pixelFindings.map((finding2) => finding2.message)];
|
|
184137
184259
|
throw new OneAppError("source_icon_unusable", `${summarize3(staged.status)}: ${details.join("; ")}. Existing icons were left unchanged.`);
|
|
184138
184260
|
}
|
|
184139
|
-
const wrote = writePreparedIcon(contentDir2,
|
|
184261
|
+
const wrote = writePreparedIcon(contentDir2, readFileSync103(staged.status.path), readFileSync103(join95(scratch, PLAY_LISTING_ICON)));
|
|
184140
184262
|
return { wrote, normalized: staged.normalized, playDerived: staged.playDerived, status: await iconStatus(contentDir2), sourceUrl };
|
|
184141
184263
|
} finally {
|
|
184142
184264
|
rmSync26(scratch, { recursive: true, force: true });
|
|
@@ -184162,11 +184284,11 @@ __export(assets_exports, {
|
|
|
184162
184284
|
removeAssetPayload: () => removeAssetPayload,
|
|
184163
184285
|
verifyReport: () => verifyReport
|
|
184164
184286
|
});
|
|
184165
|
-
import { readFileSync as
|
|
184287
|
+
import { readFileSync as readFileSync104 } from "node:fs";
|
|
184166
184288
|
import { basename as basename24 } from "node:path";
|
|
184167
184289
|
function declaredAssets(dir) {
|
|
184168
184290
|
return collectAssets(dir).map((a2) => {
|
|
184169
|
-
const bytes2 =
|
|
184291
|
+
const bytes2 = readFileSync104(a2.path);
|
|
184170
184292
|
return {
|
|
184171
184293
|
name: a2.name,
|
|
184172
184294
|
sha256: assetSha256(bytes2),
|
|
@@ -184243,7 +184365,7 @@ function verifyReport(dir, app, manifest2) {
|
|
|
184243
184365
|
};
|
|
184244
184366
|
}
|
|
184245
184367
|
function addAssetPayload(manifest2, filePath, opts) {
|
|
184246
|
-
const bytes2 =
|
|
184368
|
+
const bytes2 = readFileSync104(filePath);
|
|
184247
184369
|
const name = opts.name ?? basename24(filePath);
|
|
184248
184370
|
const sha2567 = assetSha256(bytes2);
|
|
184249
184371
|
const record3 = {
|
|
@@ -184314,7 +184436,7 @@ __export(validate_design_exports, {
|
|
|
184314
184436
|
validateDesign: () => validateDesign
|
|
184315
184437
|
});
|
|
184316
184438
|
import { randomBytes as randomBytes5 } from "node:crypto";
|
|
184317
|
-
import { closeSync as closeSync7, constants as constants6, existsSync as
|
|
184439
|
+
import { closeSync as closeSync7, constants as constants6, existsSync as existsSync93, lstatSync as lstatSync26, openSync as openSync6, readFileSync as readFileSync105, realpathSync as realpathSync12, renameSync as renameSync14, unlinkSync as unlinkSync5, writeFileSync as writeFileSync41 } from "node:fs";
|
|
184318
184440
|
import { dirname as dirname50, isAbsolute as isAbsolute10, join as join97, relative as relative20, resolve as resolve71, sep as sep22, win32 } from "node:path";
|
|
184319
184441
|
import ts14 from "typescript";
|
|
184320
184442
|
function readColorToken(tokens2, name) {
|
|
@@ -184423,10 +184545,10 @@ function compare3(field, tokens2) {
|
|
|
184423
184545
|
}
|
|
184424
184546
|
function waivers(contentDir2, sourceHashes) {
|
|
184425
184547
|
const path2 = join97(contentDir2, "ONE-APP-COVERAGE.json");
|
|
184426
|
-
if (!
|
|
184548
|
+
if (!existsSync93(path2)) return /* @__PURE__ */ new Map();
|
|
184427
184549
|
let parsed;
|
|
184428
184550
|
try {
|
|
184429
|
-
parsed = obj5(JSON.parse(
|
|
184551
|
+
parsed = obj5(JSON.parse(readFileSync105(path2, "utf8")));
|
|
184430
184552
|
} catch {
|
|
184431
184553
|
return /* @__PURE__ */ new Map();
|
|
184432
184554
|
}
|
|
@@ -184503,8 +184625,8 @@ function activeIdiomNames(contentDir2, tokens2) {
|
|
|
184503
184625
|
if (!overlays || Object.keys(overlays).length === 0) return /* @__PURE__ */ new Set();
|
|
184504
184626
|
for (const name of ["config.ts", "config.js", "himi.config.ts"]) {
|
|
184505
184627
|
const file2 = join97(contentDir2, name);
|
|
184506
|
-
if (!
|
|
184507
|
-
const source = ts14.createSourceFile(file2,
|
|
184628
|
+
if (!existsSync93(file2)) continue;
|
|
184629
|
+
const source = ts14.createSourceFile(file2, readFileSync105(file2, "utf8"), ts14.ScriptTarget.Latest, true);
|
|
184508
184630
|
const app = defineAppLiteral(source);
|
|
184509
184631
|
if (!app) throw new Error("The app config cannot be inspected for active idiom overlays.");
|
|
184510
184632
|
const field = lookup3(app, "idiom");
|
|
@@ -184572,7 +184694,7 @@ function writeFixedTokens(contentDir2, location, path2, tokens2) {
|
|
|
184572
184694
|
if (writableTokensPath(contentDir2, location) !== path2) throw new Error("Token path changed while applying --fix.");
|
|
184573
184695
|
renameSync14(temp, path2);
|
|
184574
184696
|
} finally {
|
|
184575
|
-
if (
|
|
184697
|
+
if (existsSync93(temp)) unlinkSync5(temp);
|
|
184576
184698
|
}
|
|
184577
184699
|
}
|
|
184578
184700
|
function validateDesign(evidenceDir, contentDir2, options = {}) {
|
|
@@ -184638,7 +184760,7 @@ function validateDesign(evidenceDir, contentDir2, options = {}) {
|
|
|
184638
184760
|
}
|
|
184639
184761
|
let tokens2;
|
|
184640
184762
|
try {
|
|
184641
|
-
tokens2 = obj5(JSON.parse(
|
|
184763
|
+
tokens2 = obj5(JSON.parse(readFileSync105(tokensPath, "utf8"))) ?? {};
|
|
184642
184764
|
} catch (error) {
|
|
184643
184765
|
return {
|
|
184644
184766
|
ok: false,
|
|
@@ -184774,7 +184896,7 @@ function writeEvidenceFile(contentDir2, name, contents) {
|
|
|
184774
184896
|
if (safeEvidencePath(contentDir2, name) !== path2) throw new Error("Design evidence path changed while recording.");
|
|
184775
184897
|
renameSync14(temp, path2);
|
|
184776
184898
|
} finally {
|
|
184777
|
-
if (
|
|
184899
|
+
if (existsSync93(temp)) unlinkSync5(temp);
|
|
184778
184900
|
}
|
|
184779
184901
|
}
|
|
184780
184902
|
function record2(contentDir2, report7, releaseHash) {
|
|
@@ -187910,7 +188032,7 @@ __export(run_exports, {
|
|
|
187910
188032
|
runPackage: () => runPackage,
|
|
187911
188033
|
withoutProdServe: () => withoutProdServe
|
|
187912
188034
|
});
|
|
187913
|
-
import { cpSync as cpSync2, existsSync as
|
|
188035
|
+
import { cpSync as cpSync2, existsSync as existsSync96, mkdirSync as mkdirSync44, mkdtempSync as mkdtempSync8, readFileSync as readFileSync107, rmSync as rmSync28, statSync as statSync27 } from "node:fs";
|
|
187914
188036
|
import { networkInterfaces as osNetworkInterfaces, tmpdir as tmpdir9 } from "node:os";
|
|
187915
188037
|
import { dirname as dirname51, join as join100 } from "node:path";
|
|
187916
188038
|
import { fileURLToPath as fileURLToPath35 } from "node:url";
|
|
@@ -187942,9 +188064,9 @@ async function fetchBytes(url) {
|
|
|
187942
188064
|
}
|
|
187943
188065
|
async function resolvePackage(source, workDir) {
|
|
187944
188066
|
const isUrl2 = /^https?:\/\//i.test(source);
|
|
187945
|
-
if (!isUrl2 &&
|
|
188067
|
+
if (!isUrl2 && existsSync96(source) && statSync27(source).isDirectory()) {
|
|
187946
188068
|
const appDirManifest = join100(source, "release-manifest.json");
|
|
187947
|
-
if (
|
|
188069
|
+
if (existsSync96(appDirManifest)) {
|
|
187948
188070
|
const opened2 = openPackageDir(source);
|
|
187949
188071
|
if (!opened2.validation.ok) {
|
|
187950
188072
|
throw new Error(`package is not valid:
|
|
@@ -187972,7 +188094,7 @@ async function resolvePackage(source, workDir) {
|
|
|
187972
188094
|
}
|
|
187973
188095
|
throw new Error(`${source} is a directory but has no release-manifest.json \u2014 is it a package?`);
|
|
187974
188096
|
}
|
|
187975
|
-
const bytes2 = isUrl2 ? await fetchBytes(source) :
|
|
188097
|
+
const bytes2 = isUrl2 ? await fetchBytes(source) : readFileSync107(source);
|
|
187976
188098
|
const root = workDir ?? mkdtempSync8(join100(tmpdir9(), "himi-run-"));
|
|
187977
188099
|
const { app, appDir: appDir3 } = unpackTo(bytes2, root);
|
|
187978
188100
|
const opened = openPackageDir(appDir3);
|
|
@@ -188002,8 +188124,8 @@ async function loadPreviewAssets() {
|
|
|
188002
188124
|
// in-repo checkout
|
|
188003
188125
|
];
|
|
188004
188126
|
for (const path2 of candidates) {
|
|
188005
|
-
if (!
|
|
188006
|
-
const blob =
|
|
188127
|
+
if (!existsSync96(path2)) continue;
|
|
188128
|
+
const blob = readFileSync107(path2);
|
|
188007
188129
|
return mod.assemblePreviewAssetsFromBlob(new Uint8Array(blob.buffer, blob.byteOffset, blob.byteLength));
|
|
188008
188130
|
}
|
|
188009
188131
|
return /* @__PURE__ */ new Map();
|
|
@@ -188143,8 +188265,8 @@ __export(run_browser_exports, {
|
|
|
188143
188265
|
runInBrowser: () => runInBrowser
|
|
188144
188266
|
});
|
|
188145
188267
|
import { createServer as createServer6 } from "node:http";
|
|
188146
|
-
import { existsSync as
|
|
188147
|
-
import { spawnSync as
|
|
188268
|
+
import { existsSync as existsSync97, readFileSync as readFileSync108 } from "node:fs";
|
|
188269
|
+
import { spawnSync as spawnSync10 } from "node:child_process";
|
|
188148
188270
|
import { dirname as dirname52, resolve as resolve75 } from "node:path";
|
|
188149
188271
|
import { fileURLToPath as fileURLToPath36 } from "node:url";
|
|
188150
188272
|
function stagedDir() {
|
|
@@ -188152,12 +188274,12 @@ function stagedDir() {
|
|
|
188152
188274
|
}
|
|
188153
188275
|
function browserPlaneDir(where) {
|
|
188154
188276
|
if (where.out) return resolve75(where.out);
|
|
188155
|
-
if (!
|
|
188277
|
+
if (!existsSync97(resolve75(where.repo, ...STAGE_SCRIPT))) return resolve75(where.here, "browser-plane");
|
|
188156
188278
|
return resolve75(where.repo, "packages", "serve", "dist", "browser-plane");
|
|
188157
188279
|
}
|
|
188158
188280
|
function stagedDeferred() {
|
|
188159
188281
|
try {
|
|
188160
|
-
const { files, deferred } = JSON.parse(
|
|
188282
|
+
const { files, deferred } = JSON.parse(readFileSync108(resolve75(stagedDir(), "assets.json"), "utf8"));
|
|
188161
188283
|
if (!Array.isArray(deferred)) return null;
|
|
188162
188284
|
return files.map((f2) => f2.name).filter((n2) => DEFERRED.test(n2));
|
|
188163
188285
|
} catch {
|
|
@@ -188169,16 +188291,16 @@ function isServed(name) {
|
|
|
188169
188291
|
}
|
|
188170
188292
|
function missingStaged() {
|
|
188171
188293
|
const deferred = stagedDeferred();
|
|
188172
|
-
const missing3 = [...SERVED, ...deferred ?? []].filter((f2) => !
|
|
188294
|
+
const missing3 = [...SERVED, ...deferred ?? []].filter((f2) => !existsSync97(resolve75(stagedDir(), f2)));
|
|
188173
188295
|
if (!deferred) missing3.push("assets.json");
|
|
188174
188296
|
return missing3.sort();
|
|
188175
188297
|
}
|
|
188176
188298
|
function ensureBrowserPlaneStaged() {
|
|
188177
188299
|
if (missingStaged().length === 0) return { ok: true, detail: "already staged" };
|
|
188178
|
-
if (!
|
|
188300
|
+
if (!existsSync97(resolve75(REPO5, ...STAGE_SCRIPT))) {
|
|
188179
188301
|
return { ok: false, detail: `this install has no browser plane (missing ${missingStaged().join(", ")}); reinstall @wix/himalaya-cli, or run \`himi run\` without --browser` };
|
|
188180
188302
|
}
|
|
188181
|
-
const r3 =
|
|
188303
|
+
const r3 = spawnSync10(process.execPath, [resolve75(REPO5, "core/serve/scripts/stage-browser-plane.mjs")], {
|
|
188182
188304
|
cwd: REPO5,
|
|
188183
188305
|
encoding: "utf8"
|
|
188184
188306
|
});
|
|
@@ -188264,7 +188386,7 @@ async function runInBrowser(releaseRoot, app, header, opts = {}) {
|
|
|
188264
188386
|
}
|
|
188265
188387
|
const name = path2 === "/" || path2 === "/index.html" ? "host.html" : path2.slice(1);
|
|
188266
188388
|
if (isServed(name)) {
|
|
188267
|
-
if (!
|
|
188389
|
+
if (!existsSync97(resolve75(stagedDir(), name))) {
|
|
188268
188390
|
const restaged = ensureBrowserPlaneStaged();
|
|
188269
188391
|
if (!restaged.ok) {
|
|
188270
188392
|
res.writeHead(503, { "content-type": "application/json" });
|
|
@@ -188274,7 +188396,7 @@ async function runInBrowser(releaseRoot, app, header, opts = {}) {
|
|
|
188274
188396
|
}
|
|
188275
188397
|
let bytes2;
|
|
188276
188398
|
try {
|
|
188277
|
-
bytes2 =
|
|
188399
|
+
bytes2 = readFileSync108(resolve75(stagedDir(), name));
|
|
188278
188400
|
} catch (e2) {
|
|
188279
188401
|
res.writeHead(503, { "content-type": "application/json" });
|
|
188280
188402
|
res.end(JSON.stringify({ error: "browser_plane_unstaged", file: name, detail: String(e2) }));
|
|
@@ -188330,14 +188452,14 @@ var hhp_preview_exports = {};
|
|
|
188330
188452
|
__export(hhp_preview_exports, {
|
|
188331
188453
|
hhpPreviewResponse: () => hhpPreviewResponse
|
|
188332
188454
|
});
|
|
188333
|
-
import { existsSync as
|
|
188455
|
+
import { existsSync as existsSync98, readFileSync as readFileSync109 } from "node:fs";
|
|
188334
188456
|
import { join as join101 } from "node:path";
|
|
188335
188457
|
function hhpPreviewResponse(root, request) {
|
|
188336
|
-
if (new URL(request.url).pathname !== "/__himi/hhp-preview" || !
|
|
188458
|
+
if (new URL(request.url).pathname !== "/__himi/hhp-preview" || !existsSync98(join101(root, "hhp.json"))) return null;
|
|
188337
188459
|
if (request.method !== "GET") return new Response(null, { status: 405 });
|
|
188338
188460
|
try {
|
|
188339
188461
|
const file2 = localPath(root, ".himi/hhp-preview.json");
|
|
188340
|
-
const authored2 =
|
|
188462
|
+
const authored2 = existsSync98(file2) ? JSON.parse(readFileSync109(file2, "utf8")) : {};
|
|
188341
188463
|
if (authored2.mockCapabilities && (!Array.isArray(authored2.mockCapabilities) || authored2.mockCapabilities.some((v2) => typeof v2 !== "string"))) throw new Error("mockCapabilities must be a string array.");
|
|
188342
188464
|
const fixtures = authored2.fixtures ?? {};
|
|
188343
188465
|
if (typeof fixtures !== "object" || Array.isArray(fixtures) || fixtures === null) throw new Error("fixtures must be an object.");
|
|
@@ -188470,7 +188592,7 @@ __export(apple_keys_exports, {
|
|
|
188470
188592
|
runAppleKeys: () => runAppleKeys
|
|
188471
188593
|
});
|
|
188472
188594
|
import { createPublicKey as createPublicKey2 } from "node:crypto";
|
|
188473
|
-
import { readFileSync as
|
|
188595
|
+
import { readFileSync as readFileSync114, realpathSync as realpathSync13, statSync as statSync28 } from "node:fs";
|
|
188474
188596
|
function readKey(flags, kind) {
|
|
188475
188597
|
const names2 = kind === "asc" ? ["asc-key-file", "asc-key-id", "asc-issuer-id"] : ["iap-key", "iap-key-id", "iap-issuer-id"];
|
|
188476
188598
|
if (names2.every((name) => flags[name] === void 0)) return void 0;
|
|
@@ -188480,7 +188602,7 @@ function readKey(flags, kind) {
|
|
|
188480
188602
|
const path2 = realpathSync13(file2);
|
|
188481
188603
|
assertCredentialOutsideRepo(names2[0], path2);
|
|
188482
188604
|
if (statSync28(path2).size > 16384) throw new Error("oversized");
|
|
188483
|
-
const key3 = { keyId, issuerId, key:
|
|
188605
|
+
const key3 = { keyId, issuerId, key: readFileSync114(path2, "utf8") };
|
|
188484
188606
|
if (!isAppStoreConnectKey(key3)) throw new Error("invalid key");
|
|
188485
188607
|
return key3;
|
|
188486
188608
|
} catch {
|
|
@@ -188842,7 +188964,7 @@ var init_wix_payments_contract = __esm({
|
|
|
188842
188964
|
});
|
|
188843
188965
|
|
|
188844
188966
|
// ../store-release/register-bundle.ts
|
|
188845
|
-
import { readFileSync as
|
|
188967
|
+
import { readFileSync as readFileSync115 } from "node:fs";
|
|
188846
188968
|
import { createPrivateKey as createPrivateKey4, sign as sign2 } from "node:crypto";
|
|
188847
188969
|
function b64url3(b2) {
|
|
188848
188970
|
return Buffer.from(b2).toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
@@ -188860,7 +188982,7 @@ function bundleIdBody(identifier, name, platform = "IOS") {
|
|
|
188860
188982
|
async function registerBundleId(opts) {
|
|
188861
188983
|
const env = requireEnv(["ASC_KEY_ID", "ASC_ISSUER_ID", "ASC_KEY_PATH"]);
|
|
188862
188984
|
assertCredentialOutsideRepo("ASC_KEY_PATH", env.ASC_KEY_PATH);
|
|
188863
|
-
const jwt = ascJwt(env.ASC_KEY_ID, env.ASC_ISSUER_ID,
|
|
188985
|
+
const jwt = ascJwt(env.ASC_KEY_ID, env.ASC_ISSUER_ID, readFileSync115(env.ASC_KEY_PATH, "utf8"), Math.floor(Date.now() / 1e3));
|
|
188864
188986
|
const res = await fetch(`${ASC_API}/v1/bundleIds`, {
|
|
188865
188987
|
method: "POST",
|
|
188866
188988
|
headers: { Authorization: `Bearer ${jwt}`, "Content-Type": "application/json" },
|
|
@@ -188890,7 +189012,7 @@ async function main() {
|
|
|
188890
189012
|
}
|
|
188891
189013
|
const ni2 = rest.indexOf("--name");
|
|
188892
189014
|
const name = ni2 >= 0 ? rest[ni2 + 1] : cfg.app ?? app;
|
|
188893
|
-
const yml =
|
|
189015
|
+
const yml = readFileSync115(iosProjectYml(app), "utf8");
|
|
188894
189016
|
for (const { id, label: label3 } of [{ id: identifier, label: name }, ...embeddedBundles(yml).map((b2) => ({
|
|
188895
189017
|
id: embeddedBundleId(identifier, b2),
|
|
188896
189018
|
label: `${name} ${embeddedAppIdLabel(b2)}`
|
|
@@ -191145,7 +191267,7 @@ __export(credential_profile_exports, {
|
|
|
191145
191267
|
profilePath: () => profilePath,
|
|
191146
191268
|
resolveStoreCredentials: () => resolveStoreCredentials
|
|
191147
191269
|
});
|
|
191148
|
-
import { existsSync as
|
|
191270
|
+
import { existsSync as existsSync100, readFileSync as readFileSync116 } from "node:fs";
|
|
191149
191271
|
import { homedir as homedir11 } from "node:os";
|
|
191150
191272
|
import { join as join104 } from "node:path";
|
|
191151
191273
|
function credentialsDir(home = homedir11()) {
|
|
@@ -191188,8 +191310,8 @@ function resolveStoreCredentials(opts) {
|
|
|
191188
191310
|
const { app, cfg } = opts;
|
|
191189
191311
|
const env = opts.env ?? process.env;
|
|
191190
191312
|
const home = opts.home ?? homedir11();
|
|
191191
|
-
const read = opts.readProfile ?? ((p2) =>
|
|
191192
|
-
const exists = opts.profileExists ??
|
|
191313
|
+
const read = opts.readProfile ?? ((p2) => readFileSync116(p2, "utf8"));
|
|
191314
|
+
const exists = opts.profileExists ?? existsSync100;
|
|
191193
191315
|
const ios = cfg.ios ?? {};
|
|
191194
191316
|
const adopted = "adopted" in opts ? opts.adopted : appAdoptedIdentity(app);
|
|
191195
191317
|
const flagName = opts.profileFlag?.trim();
|
|
@@ -191260,7 +191382,7 @@ var init_credential_profile = __esm({
|
|
|
191260
191382
|
|
|
191261
191383
|
// ../store-release/iap-credentials.ts
|
|
191262
191384
|
import { createHash as createHash46 } from "node:crypto";
|
|
191263
|
-
import { existsSync as
|
|
191385
|
+
import { existsSync as existsSync101, readFileSync as readFileSync117, realpathSync as realpathSync14 } from "node:fs";
|
|
191264
191386
|
import { homedir as homedir12 } from "node:os";
|
|
191265
191387
|
function accountFingerprint(keyId, issuerId) {
|
|
191266
191388
|
return `sha256:${createHash46("sha256").update(`${issuerId}:${keyId}`).digest("hex").slice(0, 16)}`;
|
|
@@ -191297,7 +191419,7 @@ function canonicalKeyPath(path2, profile, realpath) {
|
|
|
191297
191419
|
function resolveIapCredentials(options) {
|
|
191298
191420
|
const { target } = options;
|
|
191299
191421
|
const home = options.home ?? homedir12();
|
|
191300
|
-
const readFile3 = options.readFile ?? ((p2) =>
|
|
191422
|
+
const readFile3 = options.readFile ?? ((p2) => readFileSync117(p2, "utf8"));
|
|
191301
191423
|
const realpath = options.realpath ?? realpathSync14;
|
|
191302
191424
|
const profile = requireExplicitProfile(options.profileFlag, target);
|
|
191303
191425
|
const creds = resolveStoreCredentials({
|
|
@@ -191307,7 +191429,7 @@ function resolveIapCredentials(options) {
|
|
|
191307
191429
|
env: {},
|
|
191308
191430
|
home,
|
|
191309
191431
|
readProfile: readFile3,
|
|
191310
|
-
profileExists: options.exists ??
|
|
191432
|
+
profileExists: options.exists ?? existsSync101
|
|
191311
191433
|
});
|
|
191312
191434
|
assertCredentialOutsideRepo(`credential profile "${profile}"`, realpath(profilePath(profile, home)));
|
|
191313
191435
|
assertCredentialOutsideRepo(`credential profile "${profile}" ascKeyPath`, canonicalKeyPath(creds.ascKeyPath, profile, realpath));
|
|
@@ -191613,7 +191735,7 @@ var init_redact = __esm({
|
|
|
191613
191735
|
});
|
|
191614
191736
|
|
|
191615
191737
|
// src/iap-config-edit.ts
|
|
191616
|
-
import { existsSync as
|
|
191738
|
+
import { existsSync as existsSync102, readFileSync as readFileSync118 } from "node:fs";
|
|
191617
191739
|
import { basename as basename27, join as join105 } from "node:path";
|
|
191618
191740
|
import ts15 from "typescript";
|
|
191619
191741
|
function bindPurchasesAppInConfig(source, options) {
|
|
@@ -191694,15 +191816,15 @@ function capabilityFinding(app, fileName) {
|
|
|
191694
191816
|
function withStoreBundle(dir, options) {
|
|
191695
191817
|
if (options.storeBundleId) return options;
|
|
191696
191818
|
const path2 = join105(dir, "store", "store.config.yaml");
|
|
191697
|
-
if (!
|
|
191698
|
-
const storeBundleId = parseStoreConfig(
|
|
191819
|
+
if (!existsSync102(path2)) return options;
|
|
191820
|
+
const storeBundleId = parseStoreConfig(readFileSync118(path2, "utf8")).ios?.bundleId;
|
|
191699
191821
|
return storeBundleId ? { ...options, storeBundleId } : options;
|
|
191700
191822
|
}
|
|
191701
191823
|
function previewIapConfigEdit(dir, options) {
|
|
191702
191824
|
const path2 = configEntry(dir);
|
|
191703
191825
|
if (!path2) return void 0;
|
|
191704
191826
|
if (isSymlink2(path2)) return { path: path2, changed: false, applied: [], conflicts: [], instructions: [`${basename27(path2)} is a symlink, so it would not be edited: add the purchases app in the file it points to.`] };
|
|
191705
|
-
const { changed, applied, conflicts, instructions } = bindPurchasesAppInConfig(
|
|
191827
|
+
const { changed, applied, conflicts, instructions } = bindPurchasesAppInConfig(readFileSync118(path2, "utf8"), { ...withStoreBundle(dir, options), fileName: basename27(path2) });
|
|
191706
191828
|
return { path: path2, changed, applied, conflicts, instructions };
|
|
191707
191829
|
}
|
|
191708
191830
|
async function applyIapConfigEdit(dir, options, validate5) {
|
|
@@ -191711,7 +191833,7 @@ async function applyIapConfigEdit(dir, options, validate5) {
|
|
|
191711
191833
|
const fileName = basename27(path2);
|
|
191712
191834
|
const refuse7 = (why) => ({ path: path2, changed: false, applied: [], conflicts: [], instructions: [why] });
|
|
191713
191835
|
if (isSymlink2(path2)) return refuse7(`${fileName} is a symlink, so it was not edited: add the purchases app in the file it points to.`);
|
|
191714
|
-
const original =
|
|
191836
|
+
const original = readFileSync118(path2, "utf8");
|
|
191715
191837
|
const edit = bindPurchasesAppInConfig(original, { ...withStoreBundle(dir, options), fileName });
|
|
191716
191838
|
const { applied, conflicts, instructions } = edit;
|
|
191717
191839
|
if (!edit.changed) return { path: path2, changed: false, applied, conflicts, instructions };
|
|
@@ -192570,7 +192692,7 @@ var init_store_iap_screenshots = __esm({
|
|
|
192570
192692
|
});
|
|
192571
192693
|
|
|
192572
192694
|
// src/store-iap-screenshot-render.ts
|
|
192573
|
-
import { existsSync as
|
|
192695
|
+
import { existsSync as existsSync103, mkdtempSync as mkdtempSync10, readFileSync as readFileSync119, rmSync as rmSync30 } from "node:fs";
|
|
192574
192696
|
import { tmpdir as tmpdir11 } from "node:os";
|
|
192575
192697
|
import { join as join107 } from "node:path";
|
|
192576
192698
|
function renderProblems(render2, entityId) {
|
|
@@ -192633,7 +192755,7 @@ function createReviewScreenRenderer() {
|
|
|
192633
192755
|
async capture(html, contentDir2) {
|
|
192634
192756
|
const { pngPageHtml: pngPageHtml2, stabilizePngPage: stabilizePngPage2 } = await Promise.resolve().then(() => (init_render_descriptor(), render_descriptor_exports));
|
|
192635
192757
|
const tokensPath = join107(contentDir2, "tokens.json");
|
|
192636
|
-
const tokens2 =
|
|
192758
|
+
const tokens2 = existsSync103(tokensPath) ? JSON.parse(readFileSync119(tokensPath, "utf8")) : null;
|
|
192637
192759
|
const { width, height, scale } = REVIEW_SCREENSHOT_FRAME;
|
|
192638
192760
|
const page = await (await (browser ??= launch())).newPage({ viewport: { width, height }, deviceScaleFactor: scale, colorScheme: "light" });
|
|
192639
192761
|
try {
|
|
@@ -192718,7 +192840,7 @@ __export(store_iap_exports, {
|
|
|
192718
192840
|
});
|
|
192719
192841
|
import { execFileSync as execFileSync8 } from "node:child_process";
|
|
192720
192842
|
import { randomUUID as randomUUID11 } from "node:crypto";
|
|
192721
|
-
import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync45, readFileSync as
|
|
192843
|
+
import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync45, readFileSync as readFileSync120, realpathSync as realpathSync15, renameSync as renameSync16, rmSync as rmSync31, writeFileSync as writeFileSync42 } from "node:fs";
|
|
192722
192844
|
import { homedir as homedir13, hostname as hostname2 } from "node:os";
|
|
192723
192845
|
import { dirname as dirname54, join as join108, resolve as resolve77 } from "node:path";
|
|
192724
192846
|
function scrubDeep(value2, scrub) {
|
|
@@ -193418,7 +193540,7 @@ function fileJournal(path2) {
|
|
|
193418
193540
|
}
|
|
193419
193541
|
function readLockSummary(path2) {
|
|
193420
193542
|
try {
|
|
193421
|
-
const { pid, host, at: at2 } = JSON.parse(
|
|
193543
|
+
const { pid, host, at: at2 } = JSON.parse(readFileSync120(path2, "utf8"));
|
|
193422
193544
|
return `pid ${pid} on ${host} since ${at2}`;
|
|
193423
193545
|
} catch {
|
|
193424
193546
|
return "unreadable lock";
|
|
@@ -193438,7 +193560,7 @@ function acquireApplyLock(dir, appleAppId) {
|
|
|
193438
193560
|
return () => {
|
|
193439
193561
|
let current = "";
|
|
193440
193562
|
try {
|
|
193441
|
-
current =
|
|
193563
|
+
current = readFileSync120(path2, "utf8");
|
|
193442
193564
|
} catch {
|
|
193443
193565
|
return;
|
|
193444
193566
|
}
|
|
@@ -193462,8 +193584,8 @@ async function confirmOnTerminal(question) {
|
|
|
193462
193584
|
}
|
|
193463
193585
|
function defaultStoreIapDeps() {
|
|
193464
193586
|
return {
|
|
193465
|
-
readFile: (path2) =>
|
|
193466
|
-
readBytes: (path2) =>
|
|
193587
|
+
readFile: (path2) => readFileSync120(path2, "utf8"),
|
|
193588
|
+
readBytes: (path2) => readFileSync120(path2),
|
|
193467
193589
|
readBuildIapBinding: (path2) => JSON.parse(execFileSync8("plutil", ["-convert", "json", "-o", "-", resolve77(path2)], { encoding: "utf8" })),
|
|
193468
193590
|
visitorTransport: async (clientId, siteId) => {
|
|
193469
193591
|
const [{ mintVisitorToken: mintVisitorToken2 }, { visitorTransportFrom: visitorTransportFrom2 }] = await Promise.all([Promise.resolve().then(() => (init_visitor_auth(), visitor_auth_exports)), Promise.resolve().then(() => (init_rest(), rest_exports))]);
|
|
@@ -193973,7 +194095,7 @@ __export(preflight_app_exports, {
|
|
|
193973
194095
|
profileAccount: () => profileAccount,
|
|
193974
194096
|
readXcconfigVars: () => readXcconfigVars
|
|
193975
194097
|
});
|
|
193976
|
-
import { readFileSync as
|
|
194098
|
+
import { readFileSync as readFileSync121, existsSync as existsSync104, readdirSync as readdirSync43, statSync as statSync29 } from "node:fs";
|
|
193977
194099
|
import { createHash as createHash48 } from "node:crypto";
|
|
193978
194100
|
import { dirname as dirname55, join as join109 } from "node:path";
|
|
193979
194101
|
function analyze(projectYml, storeConfig, icon, account, adopted) {
|
|
@@ -194116,9 +194238,9 @@ function readXcconfigVars(iosDir, projectYml) {
|
|
|
194116
194238
|
const vars = {};
|
|
194117
194239
|
const seen = /* @__PURE__ */ new Set();
|
|
194118
194240
|
const read = (path2) => {
|
|
194119
|
-
if (seen.has(path2) || !
|
|
194241
|
+
if (seen.has(path2) || !existsSync104(path2)) return;
|
|
194120
194242
|
seen.add(path2);
|
|
194121
|
-
for (const raw of
|
|
194243
|
+
for (const raw of readFileSync121(path2, "utf8").split("\n")) {
|
|
194122
194244
|
const inc = /^\s*#include\??\s+"([^"]+)"/.exec(raw);
|
|
194123
194245
|
if (inc) {
|
|
194124
194246
|
read(join109(dirname55(path2), inc[1]));
|
|
@@ -194145,8 +194267,8 @@ function profileAccount(app, storeConfig, opts = {}) {
|
|
|
194145
194267
|
}
|
|
194146
194268
|
}
|
|
194147
194269
|
async function preflightApp(app, opts = {}) {
|
|
194148
|
-
const projectYml =
|
|
194149
|
-
const storeConfig =
|
|
194270
|
+
const projectYml = existsSync104(iosProjectYml(app)) ? readFileSync121(iosProjectYml(app), "utf8") : "";
|
|
194271
|
+
const storeConfig = existsSync104(storeConfigPath(app)) ? readFileSync121(storeConfigPath(app), "utf8") : "";
|
|
194150
194272
|
const adopted = appAdoptedIdentity(app);
|
|
194151
194273
|
const identity = projectYml ? analyzeStoreIdentity(projectYml, storeConfig, readXcconfigVars(join109(appDir(app), "ios"), projectYml), adopted) : [];
|
|
194152
194274
|
if (!storeConfig) return [{ level: "error", message: `no apps/${app}/store/store.config.yaml \u2014 run /setup-store-signing first.` }, ...identity];
|
|
@@ -194186,15 +194308,15 @@ function analyzeSubmissionRecord(appLevel, review, opts) {
|
|
|
194186
194308
|
function appLevelMetadataFiles(app, locale = "en-US") {
|
|
194187
194309
|
const root = join109(storeDir(app), "metadata");
|
|
194188
194310
|
const out2 = /* @__PURE__ */ new Set();
|
|
194189
|
-
if (
|
|
194311
|
+
if (existsSync104(root)) {
|
|
194190
194312
|
for (const n2 of readdirSync43(root)) if (n2.endsWith(".txt")) out2.add(n2);
|
|
194191
194313
|
}
|
|
194192
|
-
if (
|
|
194314
|
+
if (existsSync104(join109(root, locale, "privacy_url.txt"))) out2.add("privacy_url.txt");
|
|
194193
194315
|
return out2;
|
|
194194
194316
|
}
|
|
194195
194317
|
function reviewInfoFiles(app) {
|
|
194196
194318
|
const dir = join109(storeDir(app), "review_information");
|
|
194197
|
-
if (!
|
|
194319
|
+
if (!existsSync104(dir)) return /* @__PURE__ */ new Set();
|
|
194198
194320
|
return new Set(readdirSync43(dir).filter((n2) => n2.endsWith(".txt")));
|
|
194199
194321
|
}
|
|
194200
194322
|
function isValidAppStoreSize(w2, h2) {
|
|
@@ -194309,7 +194431,7 @@ function playListingAssets(app, locale = "en-US") {
|
|
|
194309
194431
|
for (const name of names2) {
|
|
194310
194432
|
const p2 = join109(dir, name);
|
|
194311
194433
|
try {
|
|
194312
|
-
if (statSync29(p2).isFile()) return { name, bytes:
|
|
194434
|
+
if (statSync29(p2).isFile()) return { name, bytes: readFileSync121(p2) };
|
|
194313
194435
|
} catch {
|
|
194314
194436
|
}
|
|
194315
194437
|
}
|
|
@@ -194341,25 +194463,25 @@ function analyzeListing(metaFiles, shots) {
|
|
|
194341
194463
|
}
|
|
194342
194464
|
function metadataFilesPresent(app, locale = "en-US") {
|
|
194343
194465
|
const dir = join109(storeDir(app), "metadata", locale);
|
|
194344
|
-
if (!
|
|
194466
|
+
if (!existsSync104(dir)) return /* @__PURE__ */ new Set();
|
|
194345
194467
|
return new Set(readdirSync43(dir).filter((n2) => n2.endsWith(".txt")));
|
|
194346
194468
|
}
|
|
194347
194469
|
function listScreenshots(app, locale = "en-US") {
|
|
194348
194470
|
const out2 = [];
|
|
194349
194471
|
const flat = join109(storeDir(app), "screenshots", locale);
|
|
194350
|
-
if (
|
|
194472
|
+
if (existsSync104(flat)) {
|
|
194351
194473
|
for (const png of readdirSync43(flat).filter((n2) => n2.endsWith(".png"))) {
|
|
194352
|
-
const sz = pngSize2(
|
|
194474
|
+
const sz = pngSize2(readFileSync121(join109(flat, png)));
|
|
194353
194475
|
if (sz) out2.push({ name: png, w: sz.w, h: sz.h });
|
|
194354
194476
|
}
|
|
194355
194477
|
}
|
|
194356
194478
|
const legacy = join109(storeDir(app), "metadata", locale, "screenshots");
|
|
194357
|
-
if (
|
|
194479
|
+
if (existsSync104(legacy)) {
|
|
194358
194480
|
for (const deviceDir of readdirSync43(legacy)) {
|
|
194359
194481
|
const d2 = join109(legacy, deviceDir);
|
|
194360
194482
|
if (!statSync29(d2).isDirectory()) continue;
|
|
194361
194483
|
for (const png of readdirSync43(d2).filter((n2) => n2.endsWith(".png"))) {
|
|
194362
|
-
const sz = pngSize2(
|
|
194484
|
+
const sz = pngSize2(readFileSync121(join109(d2, png)));
|
|
194363
194485
|
if (sz) out2.push({ name: `${deviceDir}/${png}`, w: sz.w, h: sz.h });
|
|
194364
194486
|
}
|
|
194365
194487
|
}
|
|
@@ -194368,12 +194490,12 @@ function listScreenshots(app, locale = "en-US") {
|
|
|
194368
194490
|
}
|
|
194369
194491
|
function placeholderHashes2() {
|
|
194370
194492
|
const templateIos = join109(appDir("_template"), "ios");
|
|
194371
|
-
if (!
|
|
194493
|
+
if (!existsSync104(templateIos)) return [LEGACY_PLACEHOLDER_SHA2562];
|
|
194372
194494
|
for (const target of readdirSync43(templateIos)) {
|
|
194373
194495
|
const p2 = join109(templateIos, target, "Assets.xcassets", "AppIcon.appiconset", "icon_1024.png");
|
|
194374
194496
|
try {
|
|
194375
194497
|
if (!statSync29(p2).isFile()) continue;
|
|
194376
|
-
return [LEGACY_PLACEHOLDER_SHA2562, createHash48("sha256").update(
|
|
194498
|
+
return [LEGACY_PLACEHOLDER_SHA2562, createHash48("sha256").update(readFileSync121(p2)).digest("hex")];
|
|
194377
194499
|
} catch {
|
|
194378
194500
|
}
|
|
194379
194501
|
}
|
|
@@ -194404,12 +194526,12 @@ async function pixelIssues(bytes2) {
|
|
|
194404
194526
|
}
|
|
194405
194527
|
}
|
|
194406
194528
|
async function appIconState(iosDir) {
|
|
194407
|
-
if (!
|
|
194529
|
+
if (!existsSync104(iosDir)) return { exists: false, isPlaceholder: false, storeIssues: [] };
|
|
194408
194530
|
for (const target of readdirSync43(iosDir)) {
|
|
194409
194531
|
const p2 = join109(iosDir, target, "Assets.xcassets", "AppIcon.appiconset", "icon_1024.png");
|
|
194410
194532
|
try {
|
|
194411
194533
|
if (!statSync29(p2).isFile()) continue;
|
|
194412
|
-
const bytes2 =
|
|
194534
|
+
const bytes2 = readFileSync121(p2);
|
|
194413
194535
|
const hash3 = createHash48("sha256").update(bytes2).digest("hex");
|
|
194414
194536
|
const pixels = await pixelIssues(bytes2);
|
|
194415
194537
|
return {
|
|
@@ -194482,7 +194604,7 @@ __export(asc_status_exports, {
|
|
|
194482
194604
|
ascStatus: () => ascStatus,
|
|
194483
194605
|
buildVerdict: () => buildVerdict
|
|
194484
194606
|
});
|
|
194485
|
-
import { readFileSync as
|
|
194607
|
+
import { readFileSync as readFileSync122 } from "node:fs";
|
|
194486
194608
|
function buildVerdict(builds) {
|
|
194487
194609
|
if (!builds.length) {
|
|
194488
194610
|
return "NO builds registered \u2014 if you uploaded recently and it's been >15 min, the binary was REJECTED IN PROCESSING (reason is email-only; run validate-binary.ts / scan-purpose-strings.ts to reproduce it).";
|
|
@@ -194496,7 +194618,7 @@ function buildVerdict(builds) {
|
|
|
194496
194618
|
function client(creds) {
|
|
194497
194619
|
const env = creds ?? requireEnv(["ASC_KEY_ID", "ASC_ISSUER_ID", "ASC_KEY_PATH"]);
|
|
194498
194620
|
assertCredentialOutsideRepo("ASC_KEY_PATH", env.ASC_KEY_PATH);
|
|
194499
|
-
const jwt = ascJwt(env.ASC_KEY_ID, env.ASC_ISSUER_ID,
|
|
194621
|
+
const jwt = ascJwt(env.ASC_KEY_ID, env.ASC_ISSUER_ID, readFileSync122(env.ASC_KEY_PATH, "utf8"), Math.floor(Date.now() / 1e3));
|
|
194500
194622
|
return async (path2) => {
|
|
194501
194623
|
const r3 = await fetch(`${ASC}${path2}`, { headers: { Authorization: `Bearer ${jwt}` } });
|
|
194502
194624
|
return { status: r3.status, json: await r3.json().catch(() => ({})) };
|
|
@@ -194985,7 +195107,7 @@ __export(secrets_exports, {
|
|
|
194985
195107
|
runRemoteSecretsCommand: () => runRemoteSecretsCommand,
|
|
194986
195108
|
runSecretsCommand: () => runSecretsCommand
|
|
194987
195109
|
});
|
|
194988
|
-
import { readFileSync as
|
|
195110
|
+
import { readFileSync as readFileSync125 } from "node:fs";
|
|
194989
195111
|
function environment(value2) {
|
|
194990
195112
|
if (value2 === "preview" || value2 === "production") return value2;
|
|
194991
195113
|
throw new Error("--environment must be preview or production");
|
|
@@ -195016,7 +195138,7 @@ async function runSecretsCommand(operation, flags, io2, options = {}) {
|
|
|
195016
195138
|
io2.log(JSON.stringify(await vault.list({ app, environment: env })));
|
|
195017
195139
|
return 0;
|
|
195018
195140
|
}
|
|
195019
|
-
const value2 = options.readValue ? options.readValue() :
|
|
195141
|
+
const value2 = options.readValue ? options.readValue() : readFileSync125(0, "utf8").replace(/\r?\n$/, "");
|
|
195020
195142
|
if (operation === "set") await vault.set({ app, environment: env, name, value: value2 });
|
|
195021
195143
|
else if (operation === "rotate") await vault.rotate({ app, environment: env, name, value: value2 });
|
|
195022
195144
|
else throw new Error(`unknown secrets operation ${operation}`);
|
|
@@ -195045,7 +195167,7 @@ async function runRemoteSecretsCommand(operation, flags, io2, options) {
|
|
|
195045
195167
|
}
|
|
195046
195168
|
let body;
|
|
195047
195169
|
if (operation !== "list") {
|
|
195048
|
-
const value2 = options.readValue ? options.readValue() :
|
|
195170
|
+
const value2 = options.readValue ? options.readValue() : readFileSync125(0, "utf8").replace(/\r?\n$/, "");
|
|
195049
195171
|
body = JSON.stringify({ value: value2 });
|
|
195050
195172
|
}
|
|
195051
195173
|
const response = await (options.fetchImpl ?? fetch)(url, { method: operation === "list" ? "GET" : operation === "set" ? "PUT" : "POST", headers: headers2, body });
|
|
@@ -195546,7 +195668,7 @@ __export(notify_exports, {
|
|
|
195546
195668
|
runNotify: () => runNotify,
|
|
195547
195669
|
saveAdminSession: () => saveAdminSession
|
|
195548
195670
|
});
|
|
195549
|
-
import { chmodSync as chmodSync3, mkdirSync as mkdirSync46, readFileSync as
|
|
195671
|
+
import { chmodSync as chmodSync3, mkdirSync as mkdirSync46, readFileSync as readFileSync128, writeFileSync as writeFileSync44 } from "node:fs";
|
|
195550
195672
|
import { homedir as homedir14 } from "node:os";
|
|
195551
195673
|
import { dirname as dirname57, join as join114 } from "node:path";
|
|
195552
195674
|
function defaultSessionsPath() {
|
|
@@ -195554,7 +195676,7 @@ function defaultSessionsPath() {
|
|
|
195554
195676
|
}
|
|
195555
195677
|
function loadSessionsFile(path2 = defaultSessionsPath()) {
|
|
195556
195678
|
try {
|
|
195557
|
-
return JSON.parse(
|
|
195679
|
+
return JSON.parse(readFileSync128(path2, "utf8"));
|
|
195558
195680
|
} catch {
|
|
195559
195681
|
return {};
|
|
195560
195682
|
}
|
|
@@ -195859,7 +195981,7 @@ __export(auth_gate_copy_exports, {
|
|
|
195859
195981
|
scanThrownMessages: () => scanThrownMessages
|
|
195860
195982
|
});
|
|
195861
195983
|
import { createHash as createHash51 } from "node:crypto";
|
|
195862
|
-
import { existsSync as
|
|
195984
|
+
import { existsSync as existsSync108, readdirSync as readdirSync44, readFileSync as readFileSync129, writeFileSync as writeFileSync45 } from "node:fs";
|
|
195863
195985
|
import { dirname as dirname58, join as join115, relative as relative23, resolve as resolve80 } from "node:path";
|
|
195864
195986
|
import { fileURLToPath as fileURLToPath37 } from "node:url";
|
|
195865
195987
|
function discoverMessageSources() {
|
|
@@ -195873,14 +195995,14 @@ function discoverMessageSources() {
|
|
|
195873
195995
|
const out2 = [];
|
|
195874
195996
|
const visit = (rel) => {
|
|
195875
195997
|
const abs = join115(REPO_ROOT8, rel);
|
|
195876
|
-
if (!
|
|
195998
|
+
if (!existsSync108(abs)) return;
|
|
195877
195999
|
for (const name of readdirSync44(abs, { withFileTypes: true })) {
|
|
195878
196000
|
const child = `${rel}/${name.name}`;
|
|
195879
196001
|
if (name.isDirectory()) {
|
|
195880
196002
|
if (/^(?:test|tests|Tests|androidTest|build|node_modules|\.build)$/.test(name.name)) continue;
|
|
195881
196003
|
visit(child);
|
|
195882
196004
|
} else if (/\.(?:swift|kt)$/.test(name.name) && !GATE_SOURCES.includes(child)) {
|
|
195883
|
-
if (MESSAGE_FILE.test(
|
|
196005
|
+
if (MESSAGE_FILE.test(readFileSync129(join115(REPO_ROOT8, child), "utf8"))) out2.push(child);
|
|
195884
196006
|
}
|
|
195885
196007
|
}
|
|
195886
196008
|
};
|
|
@@ -195888,7 +196010,7 @@ function discoverMessageSources() {
|
|
|
195888
196010
|
return out2.sort();
|
|
195889
196011
|
}
|
|
195890
196012
|
function loadTable(path2 = TABLE_PATH) {
|
|
195891
|
-
const raw = JSON.parse(
|
|
196013
|
+
const raw = JSON.parse(readFileSync129(path2, "utf8"));
|
|
195892
196014
|
const out2 = {};
|
|
195893
196015
|
for (const [k2, v2] of Object.entries(raw)) {
|
|
195894
196016
|
if (k2.startsWith("_")) continue;
|
|
@@ -195954,15 +196076,15 @@ function injectGateRows(catalog4, table = loadTable()) {
|
|
|
195954
196076
|
}
|
|
195955
196077
|
function appSourceCatalogs() {
|
|
195956
196078
|
const appsDir = join115(REPO_ROOT8, "apps");
|
|
195957
|
-
return readdirSync44(appsDir).sort().map((app) => join115(appsDir, app, "l10n", "en.json")).filter((p2) =>
|
|
196079
|
+
return readdirSync44(appsDir).sort().map((app) => join115(appsDir, app, "l10n", "en.json")).filter((p2) => existsSync108(p2));
|
|
195958
196080
|
}
|
|
195959
196081
|
function nativeKeysPath(appDir3) {
|
|
195960
196082
|
return join115(appDir3, "l10n", "native-keys.json");
|
|
195961
196083
|
}
|
|
195962
196084
|
function loadNativeKeys(appDir3) {
|
|
195963
196085
|
const p2 = nativeKeysPath(appDir3);
|
|
195964
|
-
if (!
|
|
195965
|
-
const raw = JSON.parse(
|
|
196086
|
+
if (!existsSync108(p2)) return void 0;
|
|
196087
|
+
const raw = JSON.parse(readFileSync129(p2, "utf8"));
|
|
195966
196088
|
if (!Array.isArray(raw.keys) || raw.keys.some((k2) => typeof k2 !== "string")) {
|
|
195967
196089
|
throw new Error(`${p2}: expected { "keys": string[] }`);
|
|
195968
196090
|
}
|
|
@@ -195970,8 +196092,8 @@ function loadNativeKeys(appDir3) {
|
|
|
195970
196092
|
}
|
|
195971
196093
|
function loadAppTable(appDir3) {
|
|
195972
196094
|
const p2 = join115(appDir3, "strings", "en.json");
|
|
195973
|
-
if (!
|
|
195974
|
-
const raw = JSON.parse(
|
|
196095
|
+
if (!existsSync108(p2)) return {};
|
|
196096
|
+
const raw = JSON.parse(readFileSync129(p2, "utf8"));
|
|
195975
196097
|
const out2 = {};
|
|
195976
196098
|
for (const [k2, v2] of Object.entries(raw)) if (!k2.startsWith("_") && typeof v2 === "string") out2[k2] = v2;
|
|
195977
196099
|
return out2;
|
|
@@ -196160,14 +196282,14 @@ function looksLikeCopy(text15) {
|
|
|
196160
196282
|
return /^[A-Z][a-z]/.test(t2);
|
|
196161
196283
|
}
|
|
196162
196284
|
function loadAllow(section3, path2 = ALLOW_PATH) {
|
|
196163
|
-
const raw = JSON.parse(
|
|
196285
|
+
const raw = JSON.parse(readFileSync129(path2, "utf8"));
|
|
196164
196286
|
const list2 = raw[section3] ?? [];
|
|
196165
196287
|
for (const e2 of list2) {
|
|
196166
196288
|
if (!e2.file || !e2.text || !e2.reason) throw new Error(`allowlist entry missing file/text/reason: ${JSON.stringify(e2)}`);
|
|
196167
196289
|
}
|
|
196168
196290
|
return list2;
|
|
196169
196291
|
}
|
|
196170
|
-
function scanProse(files, allow = [], read = (rel) =>
|
|
196292
|
+
function scanProse(files, allow = [], read = (rel) => readFileSync129(join115(REPO_ROOT8, rel), "utf8")) {
|
|
196171
196293
|
const hits = [];
|
|
196172
196294
|
const usedAllow = /* @__PURE__ */ new Set();
|
|
196173
196295
|
for (const file2 of files) {
|
|
@@ -196191,12 +196313,12 @@ function expectedOutputs(table = loadTable()) {
|
|
|
196191
196313
|
{ path: KOTLIN_OUT, content: renderKotlin(table) }
|
|
196192
196314
|
];
|
|
196193
196315
|
for (const p2 of appSourceCatalogs()) {
|
|
196194
|
-
const committed = JSON.parse(
|
|
196316
|
+
const committed = JSON.parse(readFileSync129(p2, "utf8"));
|
|
196195
196317
|
out2.push({ path: p2, content: serializeCatalog(injectAllNativeRows(committed, dirname58(dirname58(p2)), table)) });
|
|
196196
196318
|
}
|
|
196197
196319
|
return out2;
|
|
196198
196320
|
}
|
|
196199
|
-
function scanThrownMessages(files, read = (rel) =>
|
|
196321
|
+
function scanThrownMessages(files, read = (rel) => readFileSync129(join115(REPO_ROOT8, rel), "utf8")) {
|
|
196200
196322
|
const out2 = [];
|
|
196201
196323
|
for (const file2 of files) {
|
|
196202
196324
|
const src = read(file2);
|
|
@@ -196677,7 +196799,7 @@ __export(base44_adopt_exports, {
|
|
|
196677
196799
|
renderAdoptModule: () => renderAdoptModule,
|
|
196678
196800
|
runBase44Adopt: () => runBase44Adopt
|
|
196679
196801
|
});
|
|
196680
|
-
import { existsSync as
|
|
196802
|
+
import { existsSync as existsSync110, readFileSync as readFileSync131, writeFileSync as writeFileSync47 } from "node:fs";
|
|
196681
196803
|
import { join as join118, resolve as resolve83 } from "node:path";
|
|
196682
196804
|
function prop(entity, key3) {
|
|
196683
196805
|
const props2 = entity.schema?.properties;
|
|
@@ -196772,7 +196894,7 @@ function runBase44Adopt(opts) {
|
|
|
196772
196894
|
const bookPath = join118(bookDir, "book.json");
|
|
196773
196895
|
let book;
|
|
196774
196896
|
try {
|
|
196775
|
-
book = JSON.parse(
|
|
196897
|
+
book = JSON.parse(readFileSync131(bookPath, "utf8"));
|
|
196776
196898
|
if (!book || typeof book !== "object" || !Array.isArray(book.entities)) throw new Error("not a Base44 app book (no entities[])");
|
|
196777
196899
|
} catch (e2) {
|
|
196778
196900
|
throw new AdoptError("book_unreadable", `could not read ${bookPath}: ${e2.message}. Run \`himi base44 analyze --app-id <id>\` first.`);
|
|
@@ -196786,7 +196908,7 @@ function runBase44Adopt(opts) {
|
|
|
196786
196908
|
const issues = validateBase44Entities({ entities: result.entities, functions: result.functions }, opts.app);
|
|
196787
196909
|
if (opts.write === void 0 || opts.write === false || issues.some((i2) => i2.severity === "error")) return { result, module, issues };
|
|
196788
196910
|
const target = typeof opts.write === "string" ? resolve83(opts.cwd, opts.write) : join118(opts.cwd, ADOPT_MODULE_FILENAME);
|
|
196789
|
-
if (
|
|
196911
|
+
if (existsSync110(target)) {
|
|
196790
196912
|
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 });
|
|
196791
196913
|
}
|
|
196792
196914
|
writeFileSync47(target, module);
|
|
@@ -197037,7 +197159,7 @@ __export(generate_exports, {
|
|
|
197037
197159
|
writeGenerated: () => writeGenerated
|
|
197038
197160
|
});
|
|
197039
197161
|
import { createHash as createHash53 } from "node:crypto";
|
|
197040
|
-
import { existsSync as
|
|
197162
|
+
import { existsSync as existsSync111, mkdirSync as mkdirSync48, readdirSync as readdirSync46, readFileSync as readFileSync132, writeFileSync as writeFileSync48 } from "node:fs";
|
|
197041
197163
|
import { dirname as dirname61, join as join119 } from "node:path";
|
|
197042
197164
|
function withHeader(body) {
|
|
197043
197165
|
return `${GENERATED_HEADER}${sha2566(body)}
|
|
@@ -197164,9 +197286,9 @@ function writeGenerated(dir, files, opts = {}) {
|
|
|
197164
197286
|
const abs = join119(dir, f2.path);
|
|
197165
197287
|
const next = withHeader(f2.body);
|
|
197166
197288
|
let outcome;
|
|
197167
|
-
if (!
|
|
197289
|
+
if (!existsSync111(abs)) outcome = "written";
|
|
197168
197290
|
else {
|
|
197169
|
-
const cur =
|
|
197291
|
+
const cur = readFileSync132(abs, "utf8");
|
|
197170
197292
|
if (cur === next) outcome = "unchanged";
|
|
197171
197293
|
else if (isEdited(cur) && !opts.force) outcome = "skipped-edited";
|
|
197172
197294
|
else outcome = "written";
|
|
@@ -197183,15 +197305,15 @@ function orphanedFiles(dir, current) {
|
|
|
197183
197305
|
const keep = new Set(current.map((f2) => f2.path));
|
|
197184
197306
|
const found = [];
|
|
197185
197307
|
const t5 = join119(dir, "tier5-src");
|
|
197186
|
-
if (!
|
|
197308
|
+
if (!existsSync111(t5)) return found;
|
|
197187
197309
|
const candidates = readdirSync46(t5).filter((d2) => d2.startsWith("b44-")).map((d2) => `tier5-src/${d2}/index.ts`);
|
|
197188
197310
|
const shared = join119(t5, "_shared");
|
|
197189
|
-
if (
|
|
197311
|
+
if (existsSync111(shared)) {
|
|
197190
197312
|
for (const f2 of readdirSync46(shared)) if (/^b44-.*-plan\.ts$/.test(f2)) candidates.push(`tier5-src/_shared/${f2}`);
|
|
197191
197313
|
}
|
|
197192
197314
|
for (const rel of candidates.sort()) {
|
|
197193
|
-
if (keep.has(rel) || !
|
|
197194
|
-
if (
|
|
197315
|
+
if (keep.has(rel) || !existsSync111(join119(dir, rel))) continue;
|
|
197316
|
+
if (readFileSync132(join119(dir, rel), "utf8").startsWith(GENERATED_HEADER)) found.push(rel);
|
|
197195
197317
|
}
|
|
197196
197318
|
return found;
|
|
197197
197319
|
}
|
|
@@ -197230,7 +197352,7 @@ __export(base44_auth_exports, {
|
|
|
197230
197352
|
usableBase44Auth: () => usableBase44Auth,
|
|
197231
197353
|
writeBase44Session: () => writeBase44Session
|
|
197232
197354
|
});
|
|
197233
|
-
import { chmodSync as chmodSync4, existsSync as
|
|
197355
|
+
import { chmodSync as chmodSync4, existsSync as existsSync112, mkdirSync as mkdirSync49, readFileSync as readFileSync133, rmSync as rmSync33, writeFileSync as writeFileSync49 } from "node:fs";
|
|
197234
197356
|
import { homedir as homedir15 } from "node:os";
|
|
197235
197357
|
import { dirname as dirname62, join as join120 } from "node:path";
|
|
197236
197358
|
function base44ApiBase(env = process.env) {
|
|
@@ -197241,9 +197363,9 @@ function base44SessionPath(home = homedir15()) {
|
|
|
197241
197363
|
}
|
|
197242
197364
|
function readBase44Session(home) {
|
|
197243
197365
|
const p2 = base44SessionPath(home);
|
|
197244
|
-
if (!
|
|
197366
|
+
if (!existsSync112(p2)) return void 0;
|
|
197245
197367
|
try {
|
|
197246
|
-
const s2 = JSON.parse(
|
|
197368
|
+
const s2 = JSON.parse(readFileSync133(p2, "utf8"));
|
|
197247
197369
|
return typeof s2.accessToken === "string" && s2.accessToken ? s2 : void 0;
|
|
197248
197370
|
} catch {
|
|
197249
197371
|
return void 0;
|
|
@@ -197259,7 +197381,7 @@ function writeBase44Session(session, home) {
|
|
|
197259
197381
|
}
|
|
197260
197382
|
function deleteBase44Session(home) {
|
|
197261
197383
|
const p2 = base44SessionPath(home);
|
|
197262
|
-
if (!
|
|
197384
|
+
if (!existsSync112(p2)) return false;
|
|
197263
197385
|
rmSync33(p2, { force: true });
|
|
197264
197386
|
return true;
|
|
197265
197387
|
}
|
|
@@ -197362,8 +197484,8 @@ function hasBase44WriteScope(auth) {
|
|
|
197362
197484
|
}
|
|
197363
197485
|
function importBase44CliSession(home = homedir15(), env = process.env) {
|
|
197364
197486
|
const src = join120(home, ".base44", "auth", "auth.json");
|
|
197365
|
-
if (!
|
|
197366
|
-
const a2 = JSON.parse(
|
|
197487
|
+
if (!existsSync112(src)) throw new Error(`no Base44 CLI session at ${src} \u2014 run \`npx base44 login\` first, or use \`himi base44 login\``);
|
|
197488
|
+
const a2 = JSON.parse(readFileSync133(src, "utf8"));
|
|
197367
197489
|
if (typeof a2.accessToken !== "string" || !a2.accessToken) throw new Error(`${src} holds no access token`);
|
|
197368
197490
|
const session = {
|
|
197369
197491
|
accessToken: a2.accessToken,
|
|
@@ -197462,14 +197584,14 @@ __export(seed_exports, {
|
|
|
197462
197584
|
seedBase44Entities: () => seedBase44Entities,
|
|
197463
197585
|
writeBase44SeedRows: () => writeBase44SeedRows
|
|
197464
197586
|
});
|
|
197465
|
-
import { existsSync as
|
|
197587
|
+
import { existsSync as existsSync113, readFileSync as readFileSync134, writeFileSync as writeFileSync50 } from "node:fs";
|
|
197466
197588
|
import { join as join121 } from "node:path";
|
|
197467
197589
|
function readBase44SeedFile(dir) {
|
|
197468
197590
|
const file2 = join121(dir, BASE44_SEED_FILE);
|
|
197469
|
-
if (!
|
|
197591
|
+
if (!existsSync113(file2)) return {};
|
|
197470
197592
|
let parsed;
|
|
197471
197593
|
try {
|
|
197472
|
-
parsed = JSON.parse(
|
|
197594
|
+
parsed = JSON.parse(readFileSync134(file2, "utf8"));
|
|
197473
197595
|
} catch (e2) {
|
|
197474
197596
|
throw new SeedFileError(`${BASE44_SEED_FILE} is not valid JSON (${e2.message}). Fix or delete it.`);
|
|
197475
197597
|
}
|
|
@@ -197626,10 +197748,10 @@ function writeBase44SeedRows(opts) {
|
|
|
197626
197748
|
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(app)}<Name>). Adopted entities are never seeded.` };
|
|
197627
197749
|
}
|
|
197628
197750
|
let existing = {};
|
|
197629
|
-
if (
|
|
197751
|
+
if (existsSync113(path2)) {
|
|
197630
197752
|
let parsed;
|
|
197631
197753
|
try {
|
|
197632
|
-
parsed = JSON.parse(
|
|
197754
|
+
parsed = JSON.parse(readFileSync134(path2, "utf8"));
|
|
197633
197755
|
} catch (e2) {
|
|
197634
197756
|
throw new SeedFileError(`${BASE44_SEED_FILE} is not valid JSON (${e2.message}). Refusing to regenerate, because overwriting it would discard the rows already in it.`);
|
|
197635
197757
|
}
|
|
@@ -197983,7 +198105,7 @@ __export(functions_exports2, {
|
|
|
197983
198105
|
markerContent: () => markerContent,
|
|
197984
198106
|
readFunctionSource: () => readFunctionSource
|
|
197985
198107
|
});
|
|
197986
|
-
import { existsSync as
|
|
198108
|
+
import { existsSync as existsSync114, lstatSync as lstatSync28 } from "node:fs";
|
|
197987
198109
|
import { join as join122 } from "node:path";
|
|
197988
198110
|
function markerContent(app) {
|
|
197989
198111
|
return `${JSON.stringify({ app, by: "himi" })}
|
|
@@ -197992,7 +198114,7 @@ function markerContent(app) {
|
|
|
197992
198114
|
function readFunctionSource(appDir3, name, app) {
|
|
197993
198115
|
const rel = `base44/functions/${name}/`;
|
|
197994
198116
|
const folder = join122(appDir3, "base44", "functions", name);
|
|
197995
|
-
if (!
|
|
198117
|
+
if (!existsSync114(folder) || !lstatSync28(folder).isDirectory()) throw new FunctionSourceError("function_source_missing", `no source folder at ${rel}`);
|
|
197996
198118
|
const { entries, skipped } = collectAppSource(folder);
|
|
197997
198119
|
if (skipped.length) throw new FunctionSourceError("function_source_unsafe", `${rel} holds paths himi will not upload (symlinks or denied names): ${skipped.join(", ")} \u2014 remove them`);
|
|
197998
198120
|
const secrets = secretFindings(entries);
|
|
@@ -198333,15 +198455,15 @@ __export(apply_exports, {
|
|
|
198333
198455
|
createBase44Entities: () => createBase44Entities,
|
|
198334
198456
|
fileLedger: () => fileLedger
|
|
198335
198457
|
});
|
|
198336
|
-
import { existsSync as
|
|
198458
|
+
import { existsSync as existsSync115, readFileSync as readFileSync135, writeFileSync as writeFileSync51 } from "node:fs";
|
|
198337
198459
|
import { join as join123 } from "node:path";
|
|
198338
198460
|
function fileLedger(dir, appId2) {
|
|
198339
198461
|
const path2 = join123(dir, LEDGER_FILE2);
|
|
198340
198462
|
const load4 = () => {
|
|
198341
|
-
if (!
|
|
198463
|
+
if (!existsSync115(path2)) return {};
|
|
198342
198464
|
let v2;
|
|
198343
198465
|
try {
|
|
198344
|
-
v2 = JSON.parse(
|
|
198466
|
+
v2 = JSON.parse(readFileSync135(path2, "utf8"));
|
|
198345
198467
|
} catch (e2) {
|
|
198346
198468
|
throw new LedgerError(`${LEDGER_FILE2} is not valid JSON (${e2.message}) \u2014 fix it (a merge conflict?) rather than let himi rewrite it`);
|
|
198347
198469
|
}
|
|
@@ -198993,11 +199115,11 @@ var init_analyze = __esm({
|
|
|
198993
199115
|
});
|
|
198994
199116
|
|
|
198995
199117
|
// src/base44-analyze/write-artifacts.ts
|
|
198996
|
-
import { existsSync as
|
|
199118
|
+
import { existsSync as existsSync116, mkdirSync as mkdirSync50, readFileSync as readFileSync136, rmSync as rmSync34, writeFileSync as writeFileSync52 } from "node:fs";
|
|
198997
199119
|
import { dirname as dirname63, join as join124, resolve as resolve84, sep as sep23 } from "node:path";
|
|
198998
199120
|
function isBookFolder(dir) {
|
|
198999
199121
|
try {
|
|
199000
|
-
return JSON.parse(
|
|
199122
|
+
return JSON.parse(readFileSync136(join124(dir, "book.json"), "utf8")).kind === "base44-app-book";
|
|
199001
199123
|
} catch {
|
|
199002
199124
|
return false;
|
|
199003
199125
|
}
|
|
@@ -199084,7 +199206,7 @@ function writeBase44Book(result, outDir, opts = {}) {
|
|
|
199084
199206
|
const md = renderBookMd(book);
|
|
199085
199207
|
assertNoSecrets(json9);
|
|
199086
199208
|
assertNoSecrets(md);
|
|
199087
|
-
const owned = ["book.json", "BOOK.md", "source", "screenshots"].filter((n2) =>
|
|
199209
|
+
const owned = ["book.json", "BOOK.md", "source", "screenshots"].filter((n2) => existsSync116(join124(out2, n2)));
|
|
199088
199210
|
if (owned.length) {
|
|
199089
199211
|
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`);
|
|
199090
199212
|
for (const d2 of ["source", "screenshots"]) rmSync34(join124(out2, d2), { recursive: true, force: true });
|
|
@@ -203967,7 +204089,7 @@ var init_invite_plan = __esm({
|
|
|
203967
204089
|
});
|
|
203968
204090
|
|
|
203969
204091
|
// src/one-app/header-badges-cli.ts
|
|
203970
|
-
import { existsSync as
|
|
204092
|
+
import { existsSync as existsSync118, readFileSync as readFileSync137, rmSync as rmSync36, statSync as statSync32, writeFileSync as writeFileSync54 } from "node:fs";
|
|
203971
204093
|
import { join as join127, resolve as resolve87 } from "node:path";
|
|
203972
204094
|
function parseArgs3(args) {
|
|
203973
204095
|
let evidenceDir;
|
|
@@ -203995,8 +204117,8 @@ function parseArgs3(args) {
|
|
|
203995
204117
|
}
|
|
203996
204118
|
function contentScreens(contentDir2) {
|
|
203997
204119
|
const path2 = join127(contentDir2, "himalaya.content.json");
|
|
203998
|
-
if (!
|
|
203999
|
-
const parsed = JSON.parse(
|
|
204120
|
+
if (!existsSync118(path2)) throw new Error("himalaya.content.json not found: --content must be a Himi content package");
|
|
204121
|
+
const parsed = JSON.parse(readFileSync137(path2, "utf8"));
|
|
204000
204122
|
return new Set(Object.keys(parsed.screens ?? {}));
|
|
204001
204123
|
}
|
|
204002
204124
|
function mapCoverage(evidenceDir, contentDir2, plan, bound2, dryRun) {
|
|
@@ -204065,7 +204187,7 @@ async function runOneAppHeaderBadges(args, io2) {
|
|
|
204065
204187
|
let configText;
|
|
204066
204188
|
try {
|
|
204067
204189
|
if (!statSync32(configPath).isFile()) throw new Error("config.ts is not a file.");
|
|
204068
|
-
configText =
|
|
204190
|
+
configText = readFileSync137(configPath, "utf8");
|
|
204069
204191
|
screens = contentScreens(options.contentDir);
|
|
204070
204192
|
} catch (error) {
|
|
204071
204193
|
return report3(io2, false, { code: "config_uninspectable", error: error instanceof Error ? error.message : String(error), ...common2 });
|
|
@@ -204081,7 +204203,7 @@ async function runOneAppHeaderBadges(args, io2) {
|
|
|
204081
204203
|
return report3(io2, true, { status: "nothing_to_bind", headerBadges: [], skipped, ...common2 });
|
|
204082
204204
|
}
|
|
204083
204205
|
const workerSource = join127(options.contentDir, "tier5-src", HEADER_BADGES_BUNDLE, "index.ts");
|
|
204084
|
-
if (!
|
|
204206
|
+
if (!existsSync118(workerSource)) {
|
|
204085
204207
|
return report3(io2, false, {
|
|
204086
204208
|
code: "worker_missing",
|
|
204087
204209
|
headerBadges: bindable,
|
|
@@ -204106,7 +204228,7 @@ async function runOneAppHeaderBadges(args, io2) {
|
|
|
204106
204228
|
let ledgerBefore = null;
|
|
204107
204229
|
let coverage;
|
|
204108
204230
|
try {
|
|
204109
|
-
ledgerBefore =
|
|
204231
|
+
ledgerBefore = existsSync118(ledgerPath) ? readFileSync137(ledgerPath) : null;
|
|
204110
204232
|
coverage = mapCoverage(options.evidenceDir, options.contentDir, plan, bindable, options.dryRun);
|
|
204111
204233
|
} catch (error) {
|
|
204112
204234
|
return report3(io2, false, { code: "evidence_invalid", error: error instanceof Error ? error.message : String(error), headerBadges: bindable });
|
|
@@ -204153,7 +204275,7 @@ var init_header_badges_cli = __esm({
|
|
|
204153
204275
|
});
|
|
204154
204276
|
|
|
204155
204277
|
// src/one-app/recipes.ts
|
|
204156
|
-
import { existsSync as
|
|
204278
|
+
import { existsSync as existsSync119, readFileSync as readFileSync138 } from "node:fs";
|
|
204157
204279
|
import { join as join128 } from "node:path";
|
|
204158
204280
|
function readRecipe(contentDir2, name, values) {
|
|
204159
204281
|
return readParts(contentDir2, name, values, "node");
|
|
@@ -204164,12 +204286,12 @@ function readRecipeNodes(contentDir2, name, values) {
|
|
|
204164
204286
|
function readParts(contentDir2, name, values, key3) {
|
|
204165
204287
|
if (!/^[a-z0-9][a-z0-9-]*$/.test(name)) throw new RecipeError(`"${name}" is not a recipe name`);
|
|
204166
204288
|
const path2 = join128(contentDir2, "recipes", `${name}.json`);
|
|
204167
|
-
if (!
|
|
204289
|
+
if (!existsSync119(path2)) {
|
|
204168
204290
|
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.`);
|
|
204169
204291
|
}
|
|
204170
204292
|
let file2;
|
|
204171
204293
|
try {
|
|
204172
|
-
file2 = JSON.parse(
|
|
204294
|
+
file2 = JSON.parse(readFileSync138(path2, "utf8"));
|
|
204173
204295
|
} catch {
|
|
204174
204296
|
throw new RecipeError(`recipes/${name}.json is not valid JSON`);
|
|
204175
204297
|
}
|
|
@@ -204725,7 +204847,7 @@ __export(validate_identity_exports, {
|
|
|
204725
204847
|
runOneAppIdentityValidation: () => runOneAppIdentityValidation
|
|
204726
204848
|
});
|
|
204727
204849
|
import { createHash as createHash56 } from "node:crypto";
|
|
204728
|
-
import { existsSync as
|
|
204850
|
+
import { existsSync as existsSync120, readFileSync as readFileSync139, writeFileSync as writeFileSync55 } from "node:fs";
|
|
204729
204851
|
import ts16 from "typescript";
|
|
204730
204852
|
import { join as join129, resolve as resolve88 } from "node:path";
|
|
204731
204853
|
function ricosTexts(documentJson) {
|
|
@@ -204811,7 +204933,7 @@ function fixAppName(configSource, slug, displayName3) {
|
|
|
204811
204933
|
}
|
|
204812
204934
|
function sourceIdentity(evidenceDir) {
|
|
204813
204935
|
const { manifest: manifest2, raw } = verifiedEvidence(evidenceDir);
|
|
204814
|
-
const bytes2 =
|
|
204936
|
+
const bytes2 = readFileSync139(join129(evidenceDir, "business-context.json"));
|
|
204815
204937
|
const hash3 = createHash56("sha256").update(bytes2).digest("hex");
|
|
204816
204938
|
if (obj7(manifest2.sha256)["business-context.json"] !== hash3) throw Error("business-context.json differs from the collected evidence.");
|
|
204817
204939
|
const name = obj7(JSON.parse(bytes2.toString("utf8"))).displayName;
|
|
@@ -204831,8 +204953,8 @@ function sourceIdentity(evidenceDir) {
|
|
|
204831
204953
|
for (const key3 of ["title", "subtitle", "label", "text", "description"]) copy(settings[key3]);
|
|
204832
204954
|
}
|
|
204833
204955
|
const pagesPath = join129(evidenceDir, "pages-content.json");
|
|
204834
|
-
if (
|
|
204835
|
-
const pagesBytes =
|
|
204956
|
+
if (existsSync120(pagesPath)) {
|
|
204957
|
+
const pagesBytes = readFileSync139(pagesPath);
|
|
204836
204958
|
if (obj7(manifest2.sha256)["pages-content.json"] !== createHash56("sha256").update(pagesBytes).digest("hex")) throw Error("pages-content.json differs from the collected evidence.");
|
|
204837
204959
|
for (const document2 of obj7(JSON.parse(pagesBytes.toString("utf8"))).documents ?? []) authoredText.push(...ricosTexts(obj7(obj7(document2).page).documentJson));
|
|
204838
204960
|
}
|
|
@@ -204878,8 +205000,8 @@ async function runOneAppIdentityValidation(args, io2) {
|
|
|
204878
205000
|
if (!isValidAppId(slug)) throw Error("A technical app slug is required in himalaya.content.json.");
|
|
204879
205001
|
const configPath = join129(content, "config.ts");
|
|
204880
205002
|
let appName2;
|
|
204881
|
-
if (
|
|
204882
|
-
const correction = fixAppName(
|
|
205003
|
+
if (existsSync120(configPath)) {
|
|
205004
|
+
const correction = fixAppName(readFileSync139(configPath, "utf8"), slug, identity.displayName);
|
|
204883
205005
|
if (correction) {
|
|
204884
205006
|
if (fix) {
|
|
204885
205007
|
writeFileSync55(configPath, correction.fixed, "utf8");
|
|
@@ -204938,7 +205060,7 @@ var init_validate_identity = __esm({
|
|
|
204938
205060
|
});
|
|
204939
205061
|
|
|
204940
205062
|
// src/one-app/provision.ts
|
|
204941
|
-
import { existsSync as
|
|
205063
|
+
import { existsSync as existsSync121, readFileSync as readFileSync140, writeFileSync as writeFileSync56 } from "node:fs";
|
|
204942
205064
|
import { join as join130, resolve as resolve89 } from "node:path";
|
|
204943
205065
|
import ts17 from "typescript";
|
|
204944
205066
|
function rootOnAppear2(descriptor) {
|
|
@@ -204971,7 +205093,7 @@ ${" ".repeat(indent)}"presentation": "native",${configSource.slice(at2)}` };
|
|
|
204971
205093
|
}
|
|
204972
205094
|
function provisionTabBar(dir, dryRun = false) {
|
|
204973
205095
|
const configPath = join130(dir, "config.ts");
|
|
204974
|
-
const result =
|
|
205096
|
+
const result = existsSync121(configPath) ? nativeTabBar(readFileSync140(configPath, "utf8")) : void 0;
|
|
204975
205097
|
if (!result) return { status: "absent" };
|
|
204976
205098
|
if (!result.fixed) return { status: "unchanged", presentation: result.presentation };
|
|
204977
205099
|
if (!dryRun) writeFileSync56(configPath, result.fixed, "utf8");
|
|
@@ -204979,11 +205101,11 @@ function provisionTabBar(dir, dryRun = false) {
|
|
|
204979
205101
|
}
|
|
204980
205102
|
function provisionSiteBinding(dir, binding2, dryRun = false) {
|
|
204981
205103
|
const configPath = join130(dir, "config.ts");
|
|
204982
|
-
if (!
|
|
205104
|
+
if (!existsSync121(configPath)) return { status: "absent", reason: "no config.ts" };
|
|
204983
205105
|
if (!binding2.metaSiteId || !GUID2.test(binding2.metaSiteId) || !binding2.siteUrl) {
|
|
204984
205106
|
return { status: "unverified", reason: "the collection has no verified source site id and URL; the auth is left as it is" };
|
|
204985
205107
|
}
|
|
204986
|
-
const source =
|
|
205108
|
+
const source = readFileSync140(configPath, "utf8");
|
|
204987
205109
|
const file2 = ts17.createSourceFile("config.ts", source, ts17.ScriptTarget.Latest, true, ts17.ScriptKind.TS);
|
|
204988
205110
|
let argument;
|
|
204989
205111
|
const visit = (node3) => {
|
|
@@ -205127,8 +205249,8 @@ function provisionAppName(dir, displayName3, dryRun = false) {
|
|
|
205127
205249
|
const slug = readContentManifest(dir)?.name;
|
|
205128
205250
|
const configPath = join130(dir, "config.ts");
|
|
205129
205251
|
if (!displayName3?.trim()) return { status: "unverified", reason: "the collection has no business display name; config.ts keeps its name" };
|
|
205130
|
-
if (typeof slug !== "string" || !
|
|
205131
|
-
const correction = fixAppName(
|
|
205252
|
+
if (typeof slug !== "string" || !existsSync121(configPath)) return { status: "unverified", reason: "no app slug in himalaya.content.json or no config.ts to rename" };
|
|
205253
|
+
const correction = fixAppName(readFileSync140(configPath, "utf8"), slug, displayName3);
|
|
205132
205254
|
if (!correction) return { status: "unchanged" };
|
|
205133
205255
|
if (!dryRun) writeFileSync56(configPath, correction.fixed, "utf8");
|
|
205134
205256
|
return { status: "set", from: correction.current, to: displayName3.trim() };
|
|
@@ -205283,7 +205405,7 @@ var init_provision = __esm({
|
|
|
205283
205405
|
});
|
|
205284
205406
|
|
|
205285
205407
|
// src/one-app/generate-cli.ts
|
|
205286
|
-
import { mkdirSync as mkdirSync52, readFileSync as
|
|
205408
|
+
import { mkdirSync as mkdirSync52, readFileSync as readFileSync141, writeFileSync as writeFileSync57 } from "node:fs";
|
|
205287
205409
|
import { dirname as dirname64, join as join131, resolve as resolve90 } from "node:path";
|
|
205288
205410
|
function parseArgs4(args) {
|
|
205289
205411
|
let evidenceDir, contentDir2, out2;
|
|
@@ -205309,7 +205431,7 @@ function parseArgs4(args) {
|
|
|
205309
205431
|
function previousOutput(out2) {
|
|
205310
205432
|
const keys = (path2) => {
|
|
205311
205433
|
try {
|
|
205312
|
-
const value2 = JSON.parse(
|
|
205434
|
+
const value2 = JSON.parse(readFileSync141(path2, "utf8"));
|
|
205313
205435
|
return Array.isArray(value2) ? value2.filter((v2) => typeof v2 === "string") : value2 && typeof value2 === "object" ? Object.keys(value2) : [];
|
|
205314
205436
|
} catch {
|
|
205315
205437
|
return [];
|
|
@@ -205344,7 +205466,7 @@ async function runOneAppGenerate(args, io2) {
|
|
|
205344
205466
|
}
|
|
205345
205467
|
const fetchedAt = (() => {
|
|
205346
205468
|
try {
|
|
205347
|
-
const m2 = JSON.parse(
|
|
205469
|
+
const m2 = JSON.parse(readFileSync141(join131(options.evidenceDir, "manifest.json"), "utf8"));
|
|
205348
205470
|
return typeof m2.source?.fetchedAt === "string" ? m2.source.fetchedAt : void 0;
|
|
205349
205471
|
} catch {
|
|
205350
205472
|
return void 0;
|
|
@@ -205353,7 +205475,7 @@ async function runOneAppGenerate(args, io2) {
|
|
|
205353
205475
|
let taken;
|
|
205354
205476
|
const previousIds = previousOutput(options.out);
|
|
205355
205477
|
try {
|
|
205356
|
-
const manifest2 = JSON.parse(
|
|
205478
|
+
const manifest2 = JSON.parse(readFileSync141(join131(options.contentDir, "himalaya.content.json"), "utf8"));
|
|
205357
205479
|
taken = new Set(Object.keys(manifest2.screens ?? {}));
|
|
205358
205480
|
for (const id of previousIds) taken.delete(id);
|
|
205359
205481
|
} catch {
|
|
@@ -205866,7 +205988,7 @@ ${indent}`);
|
|
|
205866
205988
|
|
|
205867
205989
|
// src/one-app/access-cli.ts
|
|
205868
205990
|
import { createHash as createHash58 } from "node:crypto";
|
|
205869
|
-
import { existsSync as
|
|
205991
|
+
import { existsSync as existsSync123, readFileSync as readFileSync142, rmSync as rmSync37, statSync as statSync33, writeFileSync as writeFileSync58 } from "node:fs";
|
|
205870
205992
|
import { join as join132, resolve as resolve91 } from "node:path";
|
|
205871
205993
|
function parseArgs5(args) {
|
|
205872
205994
|
let evidenceDir;
|
|
@@ -205938,7 +206060,7 @@ function parseArgs5(args) {
|
|
|
205938
206060
|
if (!evidenceDir || !contentDir2) throw new Error("Both --evidence-dir and --content are required.");
|
|
205939
206061
|
if (dryRun && check) throw new Error("--dry-run and --check are different modes: pass one.");
|
|
205940
206062
|
if (screensFile) {
|
|
205941
|
-
const parsed = JSON.parse(
|
|
206063
|
+
const parsed = JSON.parse(readFileSync142(resolve91(screensFile), "utf8"));
|
|
205942
206064
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error("--screens-file must hold a JSON object of layoutItemId: screenId.");
|
|
205943
206065
|
for (const [key3, item] of Object.entries(parsed)) {
|
|
205944
206066
|
if (typeof item !== "string" || !item) throw new Error(`--screens-file: ${key3} must map to a screen id.`);
|
|
@@ -205955,7 +206077,7 @@ function report6(io2, ok3, body) {
|
|
|
205955
206077
|
function businessTitleOf(evidenceDir, given) {
|
|
205956
206078
|
if (given) return given;
|
|
205957
206079
|
try {
|
|
205958
|
-
const context = JSON.parse(
|
|
206080
|
+
const context = JSON.parse(readFileSync142(join132(evidenceDir, "business-context.json"), "utf8"));
|
|
205959
206081
|
if (typeof context.displayName === "string" && context.displayName.trim()) return context.displayName.trim();
|
|
205960
206082
|
} catch {
|
|
205961
206083
|
}
|
|
@@ -205998,10 +206120,10 @@ function mapCoverage2(options, plan, raw) {
|
|
|
205998
206120
|
return { mapped, kept, conflicts, text: mapped ? JSON.stringify(coverage, null, 2) + "\n" : void 0 };
|
|
205999
206121
|
}
|
|
206000
206122
|
function recordedLoginPolicy(evidenceDir) {
|
|
206001
|
-
const manifest2 = JSON.parse(
|
|
206123
|
+
const manifest2 = JSON.parse(readFileSync142(join132(evidenceDir, "manifest.json"), "utf8"));
|
|
206002
206124
|
const expected = manifest2.sha256?.["access-policy.json"];
|
|
206003
206125
|
if (expected === void 0) return void 0;
|
|
206004
|
-
const bytes2 =
|
|
206126
|
+
const bytes2 = readFileSync142(join132(evidenceDir, "access-policy.json"));
|
|
206005
206127
|
if (createHash58("sha256").update(bytes2).digest("hex") !== expected) throw new Error("access-policy.json does not match the hash recorded in manifest.json.");
|
|
206006
206128
|
const value2 = JSON.parse(bytes2.toString("utf8")).visitorModeEnabled;
|
|
206007
206129
|
return typeof value2 === "boolean" ? value2 : void 0;
|
|
@@ -206027,7 +206149,7 @@ async function runOneAppAccess(args, io2) {
|
|
|
206027
206149
|
let raw;
|
|
206028
206150
|
let recorded;
|
|
206029
206151
|
const tablePath = join132(options.contentDir, "tier5-src", "_shared", "access-gates-table.ts");
|
|
206030
|
-
const tableBefore =
|
|
206152
|
+
const tableBefore = existsSync123(tablePath) ? readFileSync142(tablePath, "utf8") : void 0;
|
|
206031
206153
|
const writtenGates = tableBefore === void 0 ? [] : tableGates(tableBefore);
|
|
206032
206154
|
const written = writtenGates ?? [];
|
|
206033
206155
|
try {
|
|
@@ -206047,8 +206169,8 @@ async function runOneAppAccess(args, io2) {
|
|
|
206047
206169
|
let screensText;
|
|
206048
206170
|
try {
|
|
206049
206171
|
for (const path2 of [configPath, screensPath]) if (!statSync33(path2).isFile()) throw new Error(`${path2} is not a file.`);
|
|
206050
|
-
configText =
|
|
206051
|
-
screensText =
|
|
206172
|
+
configText = readFileSync142(configPath, "utf8");
|
|
206173
|
+
screensText = readFileSync142(screensPath, "utf8");
|
|
206052
206174
|
} catch (error) {
|
|
206053
206175
|
return report6(io2, false, { code: "app_uninspectable", error: `${errorText(error)} --content must be a Himi content package with config.ts and dev/index.ts.`, ...common2 });
|
|
206054
206176
|
}
|
|
@@ -206081,7 +206203,7 @@ async function runOneAppAccess(args, io2) {
|
|
|
206081
206203
|
error: `A locked page is mapped to another screen than the app carries: ${moved.map((m2) => `${m2.layoutItemId} was ${m2.from}, now ${m2.to}`).join("; ")}. The old screen is still wrapped in its lock: restore its original payload (the screen inside the lock's open case) and remove its gate by hand, or keep the earlier mapping.`
|
|
206082
206204
|
});
|
|
206083
206205
|
}
|
|
206084
|
-
if (hasGates && (!
|
|
206206
|
+
if (hasGates && (!existsSync123(enginePath) || !existsSync123(workerPath))) {
|
|
206085
206207
|
return report6(io2, false, {
|
|
206086
206208
|
code: "access_engine_missing",
|
|
206087
206209
|
gates: plan.gates,
|
|
@@ -206177,7 +206299,7 @@ async function runOneAppAccess(args, io2) {
|
|
|
206177
206299
|
...hasGates ? [{ path: tablePath, before: tableBefore, after: table }] : [],
|
|
206178
206300
|
{ path: configPath, before: configText, after: nextConfig },
|
|
206179
206301
|
...screensEdit?.status === "written" ? [{ path: screensPath, before: screensText, after: screensEdit.text }] : [],
|
|
206180
|
-
...coverage.text ? [{ path: ledgerPath, before:
|
|
206302
|
+
...coverage.text ? [{ path: ledgerPath, before: existsSync123(ledgerPath) ? readFileSync142(ledgerPath, "utf8") : void 0, after: coverage.text }] : []
|
|
206181
206303
|
].filter((write2) => write2.before !== write2.after);
|
|
206182
206304
|
const done = [];
|
|
206183
206305
|
try {
|
|
@@ -206190,7 +206312,7 @@ async function runOneAppAccess(args, io2) {
|
|
|
206190
206312
|
for (const write2 of done.reverse()) {
|
|
206191
206313
|
try {
|
|
206192
206314
|
if (write2.before === void 0) rmSync37(write2.path, { force: true });
|
|
206193
|
-
else if (!
|
|
206315
|
+
else if (!existsSync123(write2.path) || readFileSync142(write2.path, "utf8") !== write2.before) writeFileSync58(write2.path, write2.before, "utf8");
|
|
206194
206316
|
} catch {
|
|
206195
206317
|
failed3.push(write2.path);
|
|
206196
206318
|
}
|
|
@@ -206266,7 +206388,7 @@ var init_access_policy = __esm({
|
|
|
206266
206388
|
});
|
|
206267
206389
|
|
|
206268
206390
|
// src/one-app/payment-review.ts
|
|
206269
|
-
import { readFileSync as
|
|
206391
|
+
import { readFileSync as readFileSync143 } from "node:fs";
|
|
206270
206392
|
import { join as join133, resolve as resolve92 } from "node:path";
|
|
206271
206393
|
function preservesUnverifiedFlow(flow) {
|
|
206272
206394
|
const checkout = obj10(flow.checkout);
|
|
@@ -206348,7 +206470,7 @@ function runPaymentReview(args, io2) {
|
|
|
206348
206470
|
const { manifest: manifest2 } = verifiedEvidence(evidenceDir);
|
|
206349
206471
|
const metaSiteId = obj10(manifest2.source).metaSiteId;
|
|
206350
206472
|
if (typeof metaSiteId !== "string") throw Error("Missing site binding");
|
|
206351
|
-
const review = JSON.parse(
|
|
206473
|
+
const review = JSON.parse(readFileSync143(join133(evidenceDir, "payment-review.json"), "utf8"));
|
|
206352
206474
|
const issues = paymentReviewIssues(review, metaSiteId);
|
|
206353
206475
|
if (issues.length) return fail7("payment_decision_required", issues, 1);
|
|
206354
206476
|
const warnings = obj10(review).flows.map(obj10).filter(preservesUnverifiedFlow).map((flow) => ({
|
|
@@ -206536,7 +206658,7 @@ __export(cli_exports2, {
|
|
|
206536
206658
|
ONE_APP_WORKFLOW: () => ONE_APP_WORKFLOW,
|
|
206537
206659
|
runOneAppCommand: () => runOneAppCommand
|
|
206538
206660
|
});
|
|
206539
|
-
import { closeSync as closeSync9, constants as constants9, lstatSync as lstatSync29, mkdirSync as mkdirSync53, openSync as openSync8, readFileSync as
|
|
206661
|
+
import { closeSync as closeSync9, constants as constants9, lstatSync as lstatSync29, mkdirSync as mkdirSync53, openSync as openSync8, readFileSync as readFileSync144, realpathSync as realpathSync17, writeFileSync as writeFileSync59 } from "node:fs";
|
|
206540
206662
|
import { createHash as createHash59 } from "node:crypto";
|
|
206541
206663
|
import { isIP as isIP2 } from "node:net";
|
|
206542
206664
|
import { dirname as dirname65, join as join134, parse as parse4, resolve as resolve93 } from "node:path";
|
|
@@ -206609,7 +206731,7 @@ function readOptions(argv, cwd, commandIncluded) {
|
|
|
206609
206731
|
const file2 = resolve93(cwd, flags["prompt-file"]);
|
|
206610
206732
|
const stat2 = lstatSync29(file2);
|
|
206611
206733
|
if (!stat2.isFile() || stat2.size > MAX_PROMPT_BYTES) throw new Error("invalid prompt file");
|
|
206612
|
-
prompt =
|
|
206734
|
+
prompt = readFileSync144(file2, "utf8");
|
|
206613
206735
|
} catch {
|
|
206614
206736
|
throw new OneAppError("invalid_prompt", "Use a readable text file of at most 64 KiB for --prompt-file.");
|
|
206615
206737
|
}
|
|
@@ -208948,9 +209070,9 @@ var init_customer_build = __esm({
|
|
|
208948
209070
|
});
|
|
208949
209071
|
|
|
208950
209072
|
// src/site-analyze/apply.ts
|
|
208951
|
-
import { existsSync as
|
|
209073
|
+
import { existsSync as existsSync124, readFileSync as readFileSync145, writeFileSync as writeFileSync60, copyFileSync as copyFileSync2, mkdirSync as mkdirSync54, realpathSync as realpathSync18, statSync as statSync34 } from "node:fs";
|
|
208952
209074
|
import { dirname as dirname66, isAbsolute as isAbsolute11, join as join135, resolve as resolve94, sep as sep24 } from "node:path";
|
|
208953
|
-
import { spawnSync as
|
|
209075
|
+
import { spawnSync as spawnSync11 } from "node:child_process";
|
|
208954
209076
|
function unpairedRedirectNote(overlay) {
|
|
208955
209077
|
if (!overlay.wix?.clientId || overlay.wix.redirectUri) return void 0;
|
|
208956
209078
|
return `no OAuth redirect paired with client ${overlay.wix.clientId} \u2014 the app (and prepare:customer) will refuse to start until one is set. Register it with \`himi site client ensure --site ${overlay.siteId?.trim() || "<msid>"} --redirect-uri <uri> --yes\`, then re-run analyze with \`--redirect-uri <uri>\` (or export HIMI_BRANDED_LITE_WIX_REDIRECT_URI)`;
|
|
@@ -208964,7 +209086,7 @@ function committedShellProvisioning(path2) {
|
|
|
208964
209086
|
function findRepoRoot(cwd) {
|
|
208965
209087
|
let dir = cwd;
|
|
208966
209088
|
for (let i2 = 0; i2 < 8; i2++) {
|
|
208967
|
-
if (SHELL_NAMES.some((name) =>
|
|
209089
|
+
if (SHELL_NAMES.some((name) => existsSync124(join135(dir, shellAppDir(name), "package.json")))) return dir;
|
|
208968
209090
|
const next = dirname66(dir);
|
|
208969
209091
|
if (next === dir) break;
|
|
208970
209092
|
dir = next;
|
|
@@ -209080,15 +209202,15 @@ function sameKnownSite(previous, next) {
|
|
|
209080
209202
|
function buildMergedContract(options) {
|
|
209081
209203
|
const { appDir: appDir3, packageDir, overlay } = options;
|
|
209082
209204
|
const committedPath = join135(appDir3, "provisioning.json");
|
|
209083
|
-
if (!
|
|
209205
|
+
if (!existsSync124(committedPath)) {
|
|
209084
209206
|
throw new Error(`shell has no committed provisioning.json at ${committedPath} to build a contract from`);
|
|
209085
209207
|
}
|
|
209086
|
-
const committed = JSON.parse(
|
|
209208
|
+
const committed = JSON.parse(readFileSync145(committedPath, "utf8"));
|
|
209087
209209
|
const previousPath = join135(appDir3, LOCAL_CONTRACT_REL);
|
|
209088
209210
|
let evidenceOverlay = overlay;
|
|
209089
|
-
if ((overlay.businessContact === void 0 || overlay.loyalty === void 0 || overlay.businessTimeZone === void 0) &&
|
|
209211
|
+
if ((overlay.businessContact === void 0 || overlay.loyalty === void 0 || overlay.businessTimeZone === void 0) && existsSync124(previousPath)) {
|
|
209090
209212
|
try {
|
|
209091
|
-
const previous = JSON.parse(
|
|
209213
|
+
const previous = JSON.parse(readFileSync145(previousPath, "utf8"));
|
|
209092
209214
|
if (previous && typeof previous === "object" && !Array.isArray(previous) && sameKnownSite(previous, overlay)) {
|
|
209093
209215
|
evidenceOverlay = {
|
|
209094
209216
|
...overlay,
|
|
@@ -209112,7 +209234,7 @@ function buildMergedContract(options) {
|
|
|
209112
209234
|
const stage = (fromRel, toRel) => {
|
|
209113
209235
|
const from = contained(packageDir, fromRel);
|
|
209114
209236
|
const to2 = contained(join135(appDir3, STAGED), toRel.slice(STAGED.length + 1));
|
|
209115
|
-
if (!from || !to2 || !
|
|
209237
|
+
if (!from || !to2 || !existsSync124(from)) return void 0;
|
|
209116
209238
|
let real;
|
|
209117
209239
|
let realRoot;
|
|
209118
209240
|
try {
|
|
@@ -209135,10 +209257,10 @@ function buildMergedContract(options) {
|
|
|
209135
209257
|
const icon = stage("media/icon.png", `${STAGED}/icon.png`);
|
|
209136
209258
|
if (icon) branding.appIconPath = icon;
|
|
209137
209259
|
const facesPath = join135(packageDir, "media/fonts/faces.json");
|
|
209138
|
-
if (
|
|
209260
|
+
if (existsSync124(facesPath)) {
|
|
209139
209261
|
let faces = [];
|
|
209140
209262
|
try {
|
|
209141
|
-
const parsed = JSON.parse(
|
|
209263
|
+
const parsed = JSON.parse(readFileSync145(facesPath, "utf8"));
|
|
209142
209264
|
faces = Array.isArray(parsed) ? parsed : [];
|
|
209143
209265
|
} catch {
|
|
209144
209266
|
faces = [];
|
|
@@ -209197,9 +209319,9 @@ function staticFaqFor(overlay, overlayPath) {
|
|
|
209197
209319
|
const own6 = overlay.faq;
|
|
209198
209320
|
if (own6 !== void 0) return deriveStaticFaq(own6);
|
|
209199
209321
|
const bookPath = join135(dirname66(resolve94(overlayPath)), "book.json");
|
|
209200
|
-
if (!
|
|
209322
|
+
if (!existsSync124(bookPath)) return void 0;
|
|
209201
209323
|
try {
|
|
209202
|
-
const book = JSON.parse(
|
|
209324
|
+
const book = JSON.parse(readFileSync145(bookPath, "utf8"));
|
|
209203
209325
|
const copy = book?.copy;
|
|
209204
209326
|
if (!copy || typeof copy !== "object" || copy.unavailable) return void 0;
|
|
209205
209327
|
const pairs2 = deriveStaticFaq(copy.faq);
|
|
@@ -209214,9 +209336,9 @@ function staticGalleriesFor(overlay, overlayPath) {
|
|
|
209214
209336
|
overlay.galleries.map((gallery) => ({ role: "gallery", title: gallery.title, galleryImageUrls: gallery.photos }))
|
|
209215
209337
|
);
|
|
209216
209338
|
const bookPath = join135(dirname66(resolve94(overlayPath)), "book.json");
|
|
209217
|
-
if (!
|
|
209339
|
+
if (!existsSync124(bookPath)) return void 0;
|
|
209218
209340
|
try {
|
|
209219
|
-
const book = JSON.parse(
|
|
209341
|
+
const book = JSON.parse(readFileSync145(bookPath, "utf8"));
|
|
209220
209342
|
if (!book.look || book.look.unavailable || !Array.isArray(book.look.pages)) return void 0;
|
|
209221
209343
|
const galleries = deriveStaticGalleries(book.look.pages);
|
|
209222
209344
|
return galleries.length || book.look.complete === true ? galleries : void 0;
|
|
@@ -209228,8 +209350,8 @@ async function applyOverlays(input) {
|
|
|
209228
209350
|
const cwd = resolve94(input.cwd);
|
|
209229
209351
|
const shell = input.shell ?? DEFAULT_BRANDABLE_SHELL;
|
|
209230
209352
|
assertKnownShell(shell);
|
|
209231
|
-
const overlay = JSON.parse(
|
|
209232
|
-
const tokens2 = JSON.parse(
|
|
209353
|
+
const overlay = JSON.parse(readFileSync145(input.overlayPath, "utf8"));
|
|
209354
|
+
const tokens2 = JSON.parse(readFileSync145(input.tokensPath, "utf8"));
|
|
209233
209355
|
const faq = staticFaqFor(overlay, input.overlayPath);
|
|
209234
209356
|
if (faq !== void 0) overlay.faq = faq;
|
|
209235
209357
|
const galleries = staticGalleriesFor(overlay, input.overlayPath);
|
|
@@ -209248,7 +209370,7 @@ async function applyOverlays(input) {
|
|
|
209248
209370
|
}
|
|
209249
209371
|
const appDir3 = join135(repoRoot2, shellAppDir(shell));
|
|
209250
209372
|
const committedPath = join135(appDir3, "provisioning.json");
|
|
209251
|
-
const committedSite =
|
|
209373
|
+
const committedSite = existsSync124(committedPath) ? JSON.parse(readFileSync145(committedPath, "utf8")).site : void 0;
|
|
209252
209374
|
if (committedSite !== void 0 && overlay.site === void 0) {
|
|
209253
209375
|
throw new Error(
|
|
209254
209376
|
`shell "${shell}" is a site shell: its contract names the customer's website (a \`site\` block), and this overlay has none. Re-run \`himi site analyze --url <site> --shell ${shell}\` to derive the site's page map (edit \`site.pages\` in provisioning.overlay.json if needed), then --apply.`
|
|
@@ -209257,7 +209379,7 @@ async function applyOverlays(input) {
|
|
|
209257
209379
|
const packageDir = dirname66(resolve94(input.overlayPath));
|
|
209258
209380
|
const { path: contract, staged } = buildMergedContract({ appDir: appDir3, packageDir, overlay });
|
|
209259
209381
|
wrote.push(...staged);
|
|
209260
|
-
const r3 =
|
|
209382
|
+
const r3 = spawnSync11("npm", ["run", "prepare:customer", "--", "--contract", contract], {
|
|
209261
209383
|
cwd: appDir3,
|
|
209262
209384
|
encoding: "utf8"
|
|
209263
209385
|
});
|
|
@@ -209289,8 +209411,8 @@ async function applyOverlays(input) {
|
|
|
209289
209411
|
};
|
|
209290
209412
|
let packageFaq = faq;
|
|
209291
209413
|
let packageGalleries = galleries;
|
|
209292
|
-
if (
|
|
209293
|
-
const cur = JSON.parse(
|
|
209414
|
+
if (existsSync124(pkgProv)) {
|
|
209415
|
+
const cur = JSON.parse(readFileSync145(pkgProv, "utf8"));
|
|
209294
209416
|
if (galleries === void 0 && !sameKnownSite(cur, overlay)) overlay.galleries = [];
|
|
209295
209417
|
const merged = deepMerge4(cur, overlay);
|
|
209296
209418
|
if (overlay.businessContact !== void 0) merged.businessContact = overlay.businessContact;
|
|
@@ -209313,8 +209435,8 @@ async function applyOverlays(input) {
|
|
|
209313
209435
|
overlay.installedVerticals.push("galleries");
|
|
209314
209436
|
}
|
|
209315
209437
|
const pkgTokens = join135(cwd, "tokens.json");
|
|
209316
|
-
if (
|
|
209317
|
-
const cur = JSON.parse(
|
|
209438
|
+
if (existsSync124(pkgTokens) && (tokens2.colors || tokens2.typography)) {
|
|
209439
|
+
const cur = JSON.parse(readFileSync145(pkgTokens, "utf8"));
|
|
209318
209440
|
let tokensIn = tokens2;
|
|
209319
209441
|
if (tokens2.typography) {
|
|
209320
209442
|
const fonts = catalogTypography(tokens2.typography, cur.typography);
|
|
@@ -209340,8 +209462,8 @@ async function applyOverlays(input) {
|
|
|
209340
209462
|
}
|
|
209341
209463
|
const homeAction = homeRefreshActionId(shell);
|
|
209342
209464
|
const homeSrc = join135(cwd, "dev/index.ts");
|
|
209343
|
-
if (homeAction &&
|
|
209344
|
-
const prev =
|
|
209465
|
+
if (homeAction && existsSync124(homeSrc)) {
|
|
209466
|
+
const prev = readFileSync145(homeSrc, "utf8");
|
|
209345
209467
|
const patched = patchBrandParams(prev, overlay, homeAction);
|
|
209346
209468
|
let next = patched.src;
|
|
209347
209469
|
if (!patched.foreign && faq?.length && prev.includes('"tier5.himiBrandedFaq.load"') && !prev.includes('"staticFaq"')) {
|
|
@@ -209376,13 +209498,13 @@ async function applyOverlays(input) {
|
|
|
209376
209498
|
notes.push(`${patched.unparsed} onAppear params block(s) in ${homeSrc} could not be read \u2014 any brand values inside them were not applied`);
|
|
209377
209499
|
}
|
|
209378
209500
|
}
|
|
209379
|
-
if (!input.iconPath || !
|
|
209501
|
+
if (!input.iconPath || !existsSync124(input.iconPath)) {
|
|
209380
209502
|
const book = input.iconPath ? dirname66(dirname66(resolve94(input.iconPath))) : void 0;
|
|
209381
209503
|
notes.push(
|
|
209382
209504
|
book ? `no icon installed \u2014 ${siteLogoAbsence(book).hint}` : "no icon installed and no business book to say why \u2014 `himi icon generate` draws one from the accent, or `himi icon set <file.png>` installs the customer's own mark"
|
|
209383
209505
|
);
|
|
209384
209506
|
}
|
|
209385
|
-
if (input.iconPath &&
|
|
209507
|
+
if (input.iconPath && existsSync124(input.iconPath)) {
|
|
209386
209508
|
try {
|
|
209387
209509
|
const installed = await installIcon(cwd, input.iconPath, { derivePlay: true });
|
|
209388
209510
|
wrote.push(...installed.wrote);
|
|
@@ -210344,7 +210466,7 @@ __export(cli_exports3, {
|
|
|
210344
210466
|
runSiteAnalyze: () => runSiteAnalyze,
|
|
210345
210467
|
runSiteFunctionCli: () => runSiteFunctionCli
|
|
210346
210468
|
});
|
|
210347
|
-
import { existsSync as
|
|
210469
|
+
import { existsSync as existsSync125, readFileSync as readFileSync146 } from "node:fs";
|
|
210348
210470
|
import { resolve as resolve95 } from "node:path";
|
|
210349
210471
|
function applyNeedsClient(shell) {
|
|
210350
210472
|
if (shell === void 0 || !SHELL_NAMES.includes(shell)) return true;
|
|
@@ -210391,7 +210513,7 @@ async function runSiteAnalyze(opts) {
|
|
|
210391
210513
|
msid = opts.siteFlag?.trim() || void 0;
|
|
210392
210514
|
}
|
|
210393
210515
|
const mobileAppAuth = await mobileAppAuthFor(ownerAuth);
|
|
210394
|
-
const pw = await createPlaywrightBrowser();
|
|
210516
|
+
const pw = opts.noBrowser ? { unavailable: "browser_skipped: --no-browser", port: void 0, screenshots: [] } : await createPlaywrightBrowser();
|
|
210395
210517
|
const ports = {
|
|
210396
210518
|
fetch: fetchImpl,
|
|
210397
210519
|
siteFetch,
|
|
@@ -210412,9 +210534,9 @@ async function runSiteAnalyze(opts) {
|
|
|
210412
210534
|
if (book?.skipped) result.warnings = [...result.warnings ?? [], book.skipped];
|
|
210413
210535
|
const derived = deriveSiteShell({ siteUrl: result.book.input.siteUrl, look: result.book.look, kind, routes });
|
|
210414
210536
|
const prevOverlayPath = resolve95(outDir, "provisioning.overlay.json");
|
|
210415
|
-
const prevSite =
|
|
210537
|
+
const prevSite = existsSync125(prevOverlayPath) ? (() => {
|
|
210416
210538
|
try {
|
|
210417
|
-
return JSON.parse(
|
|
210539
|
+
return JSON.parse(readFileSync146(prevOverlayPath, "utf8")).site;
|
|
210418
210540
|
} catch {
|
|
210419
210541
|
return void 0;
|
|
210420
210542
|
}
|
|
@@ -210433,7 +210555,7 @@ async function runSiteAnalyze(opts) {
|
|
|
210433
210555
|
}
|
|
210434
210556
|
const previousOverlay = resolve95(outDir, "provisioning.overlay.json");
|
|
210435
210557
|
carryOverGoals(
|
|
210436
|
-
|
|
210558
|
+
existsSync125(previousOverlay) ? readFileSync146(previousOverlay, "utf8") : void 0,
|
|
210437
210559
|
result.provisioningOverlay
|
|
210438
210560
|
);
|
|
210439
210561
|
const ownerCall = ownerAuth ? ownerTransportFrom(fetchImpl, ownerAuth) : void 0;
|
|
@@ -210491,7 +210613,7 @@ async function runSiteFunctionCli(opts) {
|
|
|
210491
210613
|
let source;
|
|
210492
210614
|
if (opts.sourcePath) {
|
|
210493
210615
|
const p2 = resolve95(opts.cwd ?? process.cwd(), opts.sourcePath);
|
|
210494
|
-
source =
|
|
210616
|
+
source = readFileSync146(p2, "utf8");
|
|
210495
210617
|
}
|
|
210496
210618
|
let body;
|
|
210497
210619
|
if (opts.bodyRaw != null) {
|
|
@@ -210519,9 +210641,9 @@ async function runSiteFunctionCli(opts) {
|
|
|
210519
210641
|
});
|
|
210520
210642
|
}
|
|
210521
210643
|
function base44BookRoutes(bookPath, siteUrl) {
|
|
210522
|
-
if (!
|
|
210644
|
+
if (!existsSync125(bookPath)) return void 0;
|
|
210523
210645
|
try {
|
|
210524
|
-
const book = JSON.parse(
|
|
210646
|
+
const book = JSON.parse(readFileSync146(bookPath, "utf8"));
|
|
210525
210647
|
if (book.kind !== "base44-app-book" || !Array.isArray(book.routes)) return void 0;
|
|
210526
210648
|
const host = (u2) => {
|
|
210527
210649
|
try {
|
|
@@ -210689,7 +210811,7 @@ __export(site_create_exports, {
|
|
|
210689
210811
|
runSiteList: () => runSiteList,
|
|
210690
210812
|
writeProvisioningBinding: () => writeProvisioningBinding
|
|
210691
210813
|
});
|
|
210692
|
-
import { existsSync as
|
|
210814
|
+
import { existsSync as existsSync126, readFileSync as readFileSync147, writeFileSync as writeFileSync61 } from "node:fs";
|
|
210693
210815
|
import { resolve as resolvePath2 } from "node:path";
|
|
210694
210816
|
function oauthClientName(projectName) {
|
|
210695
210817
|
return `${projectName} client`;
|
|
@@ -210838,7 +210960,7 @@ async function runSiteCreate(opts) {
|
|
|
210838
210960
|
if (!wantOauthApp) return { ...base, nextSteps: nextSteps(metaSiteId) };
|
|
210839
210961
|
return { ...base, clientId, redirectUri, nextSteps: nextSteps(metaSiteId, clientId) };
|
|
210840
210962
|
}
|
|
210841
|
-
function writeProvisioningBinding(target, binding2, fs2 = { existsSync:
|
|
210963
|
+
function writeProvisioningBinding(target, binding2, fs2 = { existsSync: existsSync126, readFileSync: readFileSync147, writeFileSync: writeFileSync61 }) {
|
|
210842
210964
|
const msid = binding2.siteId;
|
|
210843
210965
|
const path2 = resolvePath2(target);
|
|
210844
210966
|
const committed = committedShellProvisioning(path2);
|
|
@@ -211624,7 +211746,7 @@ __export(capture_exports, {
|
|
|
211624
211746
|
nativeNotConfigured: () => nativeNotConfigured,
|
|
211625
211747
|
variantWidth: () => variantWidth
|
|
211626
211748
|
});
|
|
211627
|
-
import { existsSync as
|
|
211749
|
+
import { existsSync as existsSync127, mkdirSync as mkdirSync55, rmSync as rmSync38, writeFileSync as writeFileSync62 } from "node:fs";
|
|
211628
211750
|
import { join as join136 } from "node:path";
|
|
211629
211751
|
import { pathToFileURL as pathToFileURL10 } from "node:url";
|
|
211630
211752
|
function variantWidth(variant) {
|
|
@@ -211637,7 +211759,7 @@ function frameFile(outDir, screen, variant, surface) {
|
|
|
211637
211759
|
async function captureMockup(root, screen, entry, variant, outDir, session) {
|
|
211638
211760
|
if (!entry.mockup) throw new MockupMissingError(`screen ${screen} declares no mockup in hhp.json`);
|
|
211639
211761
|
const file2 = localPath(root, entry.mockup);
|
|
211640
|
-
if (!
|
|
211762
|
+
if (!existsSync127(file2)) throw new MockupMissingError(`screen ${screen}: mockup ${entry.mockup} does not exist`);
|
|
211641
211763
|
const own6 = session ?? new MockupSession();
|
|
211642
211764
|
try {
|
|
211643
211765
|
const png = await own6.shoot(file2, variant);
|
|
@@ -211776,7 +211898,7 @@ var init_capture = __esm({
|
|
|
211776
211898
|
|
|
211777
211899
|
// src/fidelity/judge.ts
|
|
211778
211900
|
import { spawn as spawn7 } from "node:child_process";
|
|
211779
|
-
import { copyFileSync as copyFileSync3, mkdtempSync as mkdtempSync12, readFileSync as
|
|
211901
|
+
import { copyFileSync as copyFileSync3, mkdtempSync as mkdtempSync12, readFileSync as readFileSync148, rmSync as rmSync39 } from "node:fs";
|
|
211780
211902
|
import { tmpdir as tmpdir13 } from "node:os";
|
|
211781
211903
|
import { basename as basename29, dirname as dirname67, join as join137, resolve as resolve96 } from "node:path";
|
|
211782
211904
|
import { fileURLToPath as fileURLToPath39 } from "node:url";
|
|
@@ -211818,8 +211940,8 @@ async function judgeStrip(strip3, screen, variant, opts = {}) {
|
|
|
211818
211940
|
const judgeDir = opts.judgeDir ?? SOURCE_JUDGE_DIR;
|
|
211819
211941
|
let prompt, schema2;
|
|
211820
211942
|
try {
|
|
211821
|
-
prompt =
|
|
211822
|
-
schema2 =
|
|
211943
|
+
prompt = readFileSync148(resolve96(judgeDir, "JUDGE.md"), "utf8");
|
|
211944
|
+
schema2 = readFileSync148(resolve96(judgeDir, "verdict.schema.json"), "utf8");
|
|
211823
211945
|
} catch (e2) {
|
|
211824
211946
|
return cannotTell(`the judge prompt could not be read from ${judgeDir}: ${e2.message}`);
|
|
211825
211947
|
}
|
|
@@ -211956,8 +212078,8 @@ var init_score = __esm({
|
|
|
211956
212078
|
});
|
|
211957
212079
|
|
|
211958
212080
|
// ../visual-proof/evidence.mjs
|
|
211959
|
-
import { existsSync as
|
|
211960
|
-
function resolveCaptionFont({ exists =
|
|
212081
|
+
import { existsSync as existsSync128, rmSync as rmSync41 } from "node:fs";
|
|
212082
|
+
function resolveCaptionFont({ exists = existsSync128, env = process.env } = {}) {
|
|
211961
212083
|
if (env?.VISUAL_PROOF_FONT) return env.VISUAL_PROOF_FONT;
|
|
211962
212084
|
return CAPTION_FONT_CANDIDATES.find((p2) => exists(p2)) ?? null;
|
|
211963
212085
|
}
|
|
@@ -212218,7 +212340,7 @@ __export(native_exports, {
|
|
|
212218
212340
|
screenLink: () => screenLink
|
|
212219
212341
|
});
|
|
212220
212342
|
import { spawn as spawn9 } from "node:child_process";
|
|
212221
|
-
import { readFileSync as
|
|
212343
|
+
import { readFileSync as readFileSync149, writeFileSync as writeFileSync64 } from "node:fs";
|
|
212222
212344
|
import { join as join141 } from "node:path";
|
|
212223
212345
|
function resumedPackages(dumpsys) {
|
|
212224
212346
|
const lines = dumpsys.split("\n").filter((l2) => /\b(?:topResumedActivity|mResumedActivity|ResumedActivity)\b/.test(l2));
|
|
@@ -212240,7 +212362,7 @@ function screenLink(appId2, screen, entry, release2) {
|
|
|
212240
212362
|
}
|
|
212241
212363
|
function nativeCapture(devices, opts) {
|
|
212242
212364
|
const run2 = opts.run ?? defaultRunner3;
|
|
212243
|
-
const read = opts.readFile ?? ((p2) =>
|
|
212365
|
+
const read = opts.readFile ?? ((p2) => readFileSync149(p2));
|
|
212244
212366
|
const sleep = opts.sleep ?? ((ms2) => new Promise((r3) => setTimeout(r3, ms2)));
|
|
212245
212367
|
const settleMs = opts.settleMs ?? 1e3;
|
|
212246
212368
|
const maxWaitMs = opts.maxWaitMs ?? 3e4;
|
|
@@ -212471,7 +212593,7 @@ __export(serve_exports, {
|
|
|
212471
212593
|
releaseProblem: () => releaseProblem,
|
|
212472
212594
|
serveWorkingCopy: () => serveWorkingCopy
|
|
212473
212595
|
});
|
|
212474
|
-
import { copyFileSync as copyFileSync4, existsSync as
|
|
212596
|
+
import { copyFileSync as copyFileSync4, existsSync as existsSync129, mkdirSync as mkdirSync57, mkdtempSync as mkdtempSync15, rmSync as rmSync43 } from "node:fs";
|
|
212475
212597
|
import { tmpdir as tmpdir16 } from "node:os";
|
|
212476
212598
|
import { join as join142 } from "node:path";
|
|
212477
212599
|
function copyFreshBundles(built, outDir, into) {
|
|
@@ -212479,7 +212601,7 @@ function copyFreshBundles(built, outDir, into) {
|
|
|
212479
212601
|
for (const name of built) {
|
|
212480
212602
|
for (const file2 of [`${name}.bundle.js`, `${name}.bundle.js.map`]) {
|
|
212481
212603
|
const from = join142(outDir, file2);
|
|
212482
|
-
if (
|
|
212604
|
+
if (existsSync129(from)) copyFileSync4(from, join142(into, file2));
|
|
212483
212605
|
}
|
|
212484
212606
|
}
|
|
212485
212607
|
}
|
|
@@ -212562,7 +212684,7 @@ __export(fidelity_exports, {
|
|
|
212562
212684
|
himalayaRepoRoot: () => himalayaRepoRoot
|
|
212563
212685
|
});
|
|
212564
212686
|
import { execFileSync as execFileSync10 } from "node:child_process";
|
|
212565
|
-
import { existsSync as
|
|
212687
|
+
import { existsSync as existsSync130, realpathSync as realpathSync19 } from "node:fs";
|
|
212566
212688
|
import { join as join143, relative as relative26, sep as sep25 } from "node:path";
|
|
212567
212689
|
function himalayaRepoRoot(dir) {
|
|
212568
212690
|
let top;
|
|
@@ -212571,7 +212693,7 @@ function himalayaRepoRoot(dir) {
|
|
|
212571
212693
|
} catch {
|
|
212572
212694
|
return null;
|
|
212573
212695
|
}
|
|
212574
|
-
if (!
|
|
212696
|
+
if (!existsSync130(join143(top, "tools/judges/fidelity/JUDGE.md"))) return null;
|
|
212575
212697
|
const rel = relative26(realpathSync19(top), realpathSync19(dir));
|
|
212576
212698
|
return rel.startsWith(`..${sep25}`) || rel === ".." ? null : top;
|
|
212577
212699
|
}
|
|
@@ -212581,7 +212703,7 @@ function fidelityEnvelope(report7) {
|
|
|
212581
212703
|
async function fidelityCommand(ctx) {
|
|
212582
212704
|
const { io: io2, flags, print } = ctx;
|
|
212583
212705
|
const dir = contentDir(flags);
|
|
212584
|
-
if (!
|
|
212706
|
+
if (!existsSync130(dir)) {
|
|
212585
212707
|
io2.error(failure2("fidelity_bad_flag", `content dir ${dir} does not exist`));
|
|
212586
212708
|
return 2;
|
|
212587
212709
|
}
|
|
@@ -212793,9 +212915,9 @@ async function publishSizeCommand(ctx) {
|
|
|
212793
212915
|
return fail7("build_failed", "publish-size requires the contained authoring runtime; host-realm overrides are unavailable");
|
|
212794
212916
|
}
|
|
212795
212917
|
const dir = contentDir2(flags);
|
|
212796
|
-
const { existsSync:
|
|
212918
|
+
const { existsSync: existsSync131 } = await import("node:fs");
|
|
212797
212919
|
const { join: join144 } = await import("node:path");
|
|
212798
|
-
if (!
|
|
212920
|
+
if (!existsSync131(join144(dir, "dev", "index.ts"))) return fail7("build_failed", "expected a content package with dev/index.ts; pass --content <dir>");
|
|
212799
212921
|
const declared = await appId2(dir);
|
|
212800
212922
|
const app = typeof flags.app === "string" ? flags.app : declared;
|
|
212801
212923
|
if (!isValidAppId(app)) return fail7("invalid_usage", "declared app is not a valid publish ID; pass --app <valid-slug>", { app }, 2);
|
|
@@ -212976,6 +213098,7 @@ var BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
|
|
|
212976
213098
|
"no-native",
|
|
212977
213099
|
"from-base44-cli",
|
|
212978
213100
|
"no-browser",
|
|
213101
|
+
"install-browser",
|
|
212979
213102
|
"refresh-wix",
|
|
212980
213103
|
"empty-app-ok",
|
|
212981
213104
|
"aab",
|
|
@@ -213180,7 +213303,10 @@ var USAGE = `himi \u2014 the Himalaya authoring CLI (remote dev loop)
|
|
|
213180
213303
|
record what a real device drive produced. --checks is REQUIRED for
|
|
213181
213304
|
passed|failed (the checks you actually drove) and stays EMPTY for
|
|
213182
213305
|
unavailable, where nothing was driven; --reason is REQUIRED for
|
|
213183
|
-
unavailable and is the evidence in its place.
|
|
213306
|
+
unavailable and is the evidence in its place. No device or simulator?
|
|
213307
|
+
--status unavailable --reason "<why>" is the honest record: audit
|
|
213308
|
+
--strict and push --draft accept it and report the platform as
|
|
213309
|
+
NOT driven (a disclosed gap), never as a pass.
|
|
213184
213310
|
himi l10n import --format oneapp <dir> (--app <slug> | --content <app dir>)
|
|
213185
213311
|
[--locales en,he] [--source en] [--overwrite] [--json]
|
|
213186
213312
|
convert OneApp messages_<locale>.json files into
|
|
@@ -213795,7 +213921,10 @@ var USAGE = `himi \u2014 the Himalaya authoring CLI (remote dev loop)
|
|
|
213795
213921
|
redirect looks right and is not a candidate.
|
|
213796
213922
|
himi site analyze --read-only --site <msid> [--client-id <id>] [--url <https://\u2026>] [--json]
|
|
213797
213923
|
himi site analyze --url <https://\u2026> [--client-id <id>] [--site <msid>] [--out <dir>] [--apply]
|
|
213798
|
-
[--shell ${SHELL_ENUM}]
|
|
213924
|
+
[--shell ${SHELL_ENUM}] [--no-browser]
|
|
213925
|
+
refuses up front (code:"browser_unavailable", exit 2, with
|
|
213926
|
+
the fix) when Playwright/Chromium is missing; --no-browser
|
|
213927
|
+
runs static-HTML-only on purpose.
|
|
213799
213928
|
collect a Wix business book (APIs + Playwright look) and
|
|
213800
213929
|
optionally bake identity/verticals/palette/homeLayout into
|
|
213801
213930
|
a brandable shell's content package. --url alone is the
|
|
@@ -213866,13 +213995,16 @@ var USAGE = `himi \u2014 the Himalaya authoring CLI (remote dev loop)
|
|
|
213866
213995
|
[--android-package <package> --android-sha256 <fingerprint>]
|
|
213867
213996
|
check the public tenant association files for native
|
|
213868
213997
|
Google sign-in; print the required entries. READ-ONLY.
|
|
213869
|
-
himi doctor [--target <t>] [--dpx] [--json]
|
|
213998
|
+
himi doctor [--target <t>] [--dpx] [--install-browser] [--json]
|
|
213870
213999
|
off-VPN preflight: probe the PUBLIC data plane
|
|
213871
214000
|
(www.wixapis.com), the internal serve/control plane
|
|
213872
214001
|
for the target, and report auth state (dpx session +
|
|
213873
214002
|
stored control token). --dpx also runs a live
|
|
213874
214003
|
supported "dpx auth status". --json for agents; an
|
|
213875
214004
|
unreachable internal plane carries code:"needs_vpn".
|
|
214005
|
+
Also says whether Playwright + Chromium are installed
|
|
214006
|
+
(code:"browser_unavailable" + the exact fix when not);
|
|
214007
|
+
--install-browser downloads the CLI's own Chromium.
|
|
213876
214008
|
himi upgrade [--json] install the newest published CLI and say what moved.
|
|
213877
214009
|
himi also does this ITSELF when the running build is
|
|
213878
214010
|
over a week old \u2014 unattended it updates and re-runs
|
|
@@ -213909,7 +214041,7 @@ var COMMANDS = [
|
|
|
213909
214041
|
{ name: "eject", summary: "take ownership of a shared flow module (auth|checkout|screens): copies its source into tier5-src/_ejected/ and repoints this package's imports at the copy. The ladder's escape hatch \u2014 for when the factory options cannot express what you need. AFTER EJECTING, CENTRAL FIXES NO LONGER REACH THIS APP, including future corrections to the fail-closed entitlement and confirm-the-session rules. The floor is unaffected: credentials still go only through the native auth actions and money only through the cashier rail.", required: "<auth|checkout|screens> [--content <dir>]" },
|
|
213910
214042
|
{ name: "validate", summary: 'lint the content package (no push): fixed-contract TypeScript checking for tier5-src workers + schema/proto + token refs + component allowlist + $service bindings + strict-enum foot-guns + capability decls + worker boot dry-run + build/compile failures + copied tier5-src/_shared files that differ from this CLI\'s (a `stale-shared` warning, never promoted by --strict; `// himi:forked` in a file skips it). Type issues are advisory warnings normally; --strict promotes them and hygiene warnings to errors. Exit 1 on any error. Off-repo, the CLI supplies its compiler and SDK declarations. A PASSING validate after a source change also refreshes the home picture: exactly `himi render <homeScreenId> --png --mocks --device iphone` (offline, never --live; with recorded data \u2014 dev/net-mocks.json or cms seed rows \u2014 the picture shows it, and without, its postcard calls it an offline preview), run as a child it kills after 30 seconds, writing .himi/shots/<home>.png \u2014 whose own postcard logic then journals "First look at your app" or, after ten minutes of postcard silence, "Still building" \u2014 reported as `homePicture: {image}` (with `postcard` when one was journaled) or `{skipped: <reason>}`, never a failed validate. Skipped for a validate with errors, a home shot already current, CI or a test runner, and code nobody asked to run: a --remote template still unchanged since init.', required: "[--content <dir>] [--strict]" },
|
|
213911
214043
|
{ name: "test", summary: "DERIVED behavioral crawl \u2014 no test files to write. Boots each screen's real worker, replays its onAppear, then dispatches every action site the descriptor already declares (each from a fresh boot) and checks a narrow set of unambiguous invariants: no uncaught throw, never stuck on `loading`, no `$service:` token or NaN/undefined/[object Object] reaching visible text, no binding aimed at state the worker never defines, no nav param silently dropped, no dead nav target. Catches what validate/render cannot \u2014 a WRONG REDUCER passes both with ok:true. Runs the worker in a DEVICE-PARITY sandbox (no setTimeout/setInterval, as on JSC/WebView) so a bundle that would die on device fails here. Crawls on HERMETIC DATA by default \u2014 zero network: the app's own dev/net-mocks.json first (--net <file> overrides), then the config's CMS `seed:` rows, then a canned fixture of frozen real vertical responses shipped with the CLI (exercises code paths, not API-contract truth) \u2014 so the success/mapping path runs, not just the failure UI. Two boot-only HOSTILE passes (every list empty; every request 500) then check the failure/empty day \u2014 corpus-proven, so their findings are errors. NAV EDGES are followed too: every himi.open site ($item params resolved against row 0 of its list, $service against worker state) and worker _nav directive is harvested, and each baked target is booted WITH the params the source sends \u2014 detail screens finally run their content arm; edge findings are errors tagged edge:<source>. --native runs both real native decoders over the exact baked JSON bytes; --native ios or --native android selects one. It is explicit, runs only from a Himalaya SOURCE CHECKOUT (the decoder oracles are that tree's own HimalayaCore Swift package and Gradle harness, which a published install does not ship), and needs the selected local toolchain. From a source checkout, default runs name missing native verdicts in the coverage ledger; elsewhere the ledger stays silent about them rather than offering a remedy you cannot run. --offline strips all data layers (the old reject-all axis); --no-hostile skips the hostile passes. --record (EXPLICIT, never automatic) refreshes dev/net-mocks.json from live reads first: it boots each screen (load + root onAppear ONLY \u2014 nothing the app's own launch would not fire; the tap/action crawl never sees the live transport, and only proven reads \u2014 GET, or read-shaped POST (/query, /search, /list*, \u2026) \u2014 ever reach the wire), freezes the round-trips, then crawls hermetically on the fresh fixture; record against a QA site, not production. --input-evidence --json adds versioned actual typed-input probes and journey receipts bound to the tested release/config/run; these are observations, not required-behavior acceptance or benign-warning waivers. Nodes it cannot judge headless are named, never silently passed. Exit 1 on any error. The CLI carries the authoring runtime off-repo; no per-app SDK install is required. --browser runs the whole loop (build \u2192 extract \u2192 validate \u2192 render \u2192 test) in YOUR browser instead of here, so the source never reaches a pod: it opens one screen's worker + descriptor in a tab, blocks on a loopback callback, and prints the report it posts back. One screen per tab \u2014 name it. --no-open prints the URL rather than launching a browser (SSH); --timeout <ms> bounds the wait, which matters because the page has no execution deadline of its own and an infinite loop in the worker hangs the tab.", required: "[<screenId>\u2026] [--content <dir>] [--net <file>] [--budget <ms>] [--deep [n]] [--record] [--native [ios|android]] [--no-shots] [--offline] [--no-hostile] [--all-screens] [--browser] [--no-open] [--timeout <ms>] [--input-evidence] [--json]" },
|
|
213912
|
-
{ name: "ux", summary: "audit or record mobile UX evidence. `audit` checks the public-safe contract, seeded blank acceptance rows, placeholder source copy, app-specific mocks, and iOS/Android audit records. It warns while existing templates migrate; `--strict` promotes missing evidence. `record` stores checks performed on an installed iOS/Android build: `--checks` is required for passed|failed and empty for unavailable, which drove nothing and needs a `--reason` instead. `record` also STAMPS the release it audited (it resolves the id from a build, the same one a push would publish), because an unforced `himi push` of a release with screens refuses when no drive is recorded for THAT release, or when the one that is recorded says `failed` \u2014 the artifact stopped being advice nobody reads (#2955). `unavailable` still satisfies it; only `failed` refuses.", required: "audit [--content <dir>] [--strict] [--json] | record --content <dir> --platform ios|android --status passed|failed|unavailable [--checks back,keyboard,...] [--reason <text>]" },
|
|
214044
|
+
{ name: "ux", summary: "audit or record mobile UX evidence. `audit` checks the public-safe contract, seeded blank acceptance rows, placeholder source copy, app-specific mocks, and iOS/Android audit records. It warns while existing templates migrate; `--strict` promotes missing evidence. `record` stores checks performed on an installed iOS/Android build: `--checks` is required for passed|failed and empty for unavailable, which drove nothing and needs a `--reason` instead. `record` also STAMPS the release it audited (it resolves the id from a build, the same one a push would publish), because an unforced `himi push` of a release with screens refuses when no drive is recorded for THAT release, or when the one that is recorded says `failed` \u2014 the artifact stopped being advice nobody reads (#2955). `unavailable` still satisfies it; only `failed` refuses. An `unavailable` record is the honest close for an agent with no device: `audit` (strict or not) lists it under `disclosedGaps` with a `<platform>-audit-not-run` warning, and `push` names it in `uxNotDriven` \u2014 a disclosed gap, never a pass (#5607).", required: "audit [--content <dir>] [--strict] [--json] | record --content <dir> --platform ios|android --status passed|failed|unavailable [--checks back,keyboard,...] [--reason <text>]" },
|
|
213913
214045
|
{ name: "progress", summary: 'the build JOURNAL an agent keeps for the owner while it works. `himi progress "<what changed>" --step <1-8|name> --image <png>` appends one postcard to .himi/progress.jsonl \u2014 the step is one of the customer journey\'s eight (discover, classify, plan, implement, brand, validate, review, download) \u2014 and COPIES each image, content-addressed, into .himi/history/, because .himi/shots/ is overwritten by every render and cleared by every full `himi test`, so a path into it would later show a different picture than the one the owner was sent. --image repeats. With NO --image, the home screen\'s current shot is attached automatically, only when it is no older than the last source change and not the picture the latest journaled postcard already shows \u2014 and never a shot that landed on loading placeholders, an empty or an error state (.himi/shot-states.json): then the newest home picture of the current source that shows content goes on instead (its .himi/history copy, `imageNote` saying so), or none \u2014 except on the HANDOVER card (`--step review`), where a repeat is the point and it attaches anyway; that card\'s output also names the making-of (`makingOf`, .himi/making-of.html, rebuilt when missing or older than the journal so it ends on this card) and its `next` says to hand it to the owner beside the preview link; `imageAttached` in the output says whether the postcard carries a picture (with `imageNote` saying why not, or which picture went on instead), and `--no-image` sends a text-only postcard. --notify also raises a best-effort desktop notification for an owner who stepped away. A bare `himi progress` prints the journal with the current step and elapsed time \u2014 also how an agent recovers its place after its context was compacted. APPROVALS: `--approve <gate> "<what>"` records one the customer just gave (gates: site-create, connect, private-data, draft, promote, push-signing, qa-build) in .himi/approvals.jsonl, and `--done <gate>` / `--drop <gate>` closes it \u2014 an approval is owed until then, and the chat that held it does not survive a new session. `--brief` prints plain text for a session start: the current step, the last postcard, every open approval, and whether this app\'s agent files are stale \u2014 the SessionStart hook `himi agent-init` installs runs exactly this. The CLI also journals milestones by itself \u2014 the first PNG render of the home screen (for an app a current `himi init` started: once as the template\'s "Starting point" while the source is what init wrote, then once as "First look at your app" after it diverges, Markdown edits not counting; once per app otherwise), a `himi test` crawl whose outcome changed since the last one (its counts or its home picture; an identical re-run writes none, and a repeat names what changed: "The home screen changed since the last crawl." or the changed counts, was \u2192 now), every draft push (with the home picture only when that shot is newer than the last source edit \u2014 otherwise the postcard says why and names `himi render <home> --png`), and ONE rule for a long silence: a successful home `render --png` more than ten minutes after the newest postcard of any kind, with a picture the latest postcard does not show, journals "Still building: here\'s the home screen now." with it (never twice within the window). When a crawl\'s or a draft\'s home picture is the first of an app whose source diverged, "First look at your app" is journaled first, from that shot, once. All are marked `"by": "himi"`; they never move the journey step, carry no link or credential, and step aside (folded out of every reader) when the agent journals the same step or picture within five minutes. Local only: nothing is sent anywhere.', required: '["<message>" [--step <1-8|name>] [--image <png>]\u2026 [--no-image] [--notify]] [--content <dir>] | --approve|--done|--drop <gate> ["<note>"] | --brief' },
|
|
213914
214046
|
{ name: "studio", summary: "open the BUILD BOARD \u2014 one local page the owner can leave open while an agent builds their app, which fills itself in: every screen as it renders (NEW/CHANGED badges, and each earlier version kept for a filmstrip), the journey stepper and the latest postcard from `himi progress`, the validate/test/UX/draft checks as they run, the site next to the app's home screen with its palette, and the navigation the test crawl followed. Writes .himi/studio/index.html and opens it; the page re-reads its state every two seconds, so nothing needs to be served. OPT-IN BY EXISTENCE: until this command (or `himi init`, which makes the board for every app it creates, without opening a browser) has run, no other command touches .himi/studio/ \u2014 after it, render/test/validate/push/icon/site/ux/progress each refresh the board as they finish (best-effort; never fails a command). Every image is a content-addressed copy in .himi/history/, never a live path into .himi/shots/. Local only, no secrets: it never reads a preview token, handover code or control token. --no-open prints the path instead (SSH, CI). `himi studio reel` writes the MAKING-OF: one self-contained HTML file (every image inlined, nothing fetched) with a flipbook of the home screen version by version, captioned by the postcard in effect at the time, the final screens, and every postcard \u2014 sized to stay attachable, thinning frames first. Defaults to .himi/making-of.html (never archived by push), which every successful `himi push --draft` also rebuilds and names as `reel` in its output; --out to put it elsewhere. The output names that file as the one to hand the owner (`handover: {file, hint}` in JSON; two plain lines at a terminal) \u2014 beside the preview link, never instead of it.", required: "[--content <dir>] [--no-open] | reel [--out <file>] [--no-open]" },
|
|
213915
214047
|
{ name: "render", summary: "headless-render a screen with the web renderer: render-tree + diagnostics, optional --png [<file>] (bare: .himi/shots/<id>.png, what the build board shows), --scheme dark, --tree. Local by default (content dir). Pass --remote --app --release to hit GET /v1/preview/\u2026/render on the serve plane after a push. Boots the worker so $service bindings resolve; --static raw bindings; --live real Wix fetches; --mocks (the DEFAULT whenever the app has recorded data; --no-mocks for the offline initial state) runs load() against the app's own recorded data (dev/net-mocks.json from `himi test --record`, then the config's cms seed rows, and the Base44 layer `himi test` uses \u2014 base44.entities seed rows and the analyze book's sample rows \u2014 hermetic, never a request; with neither it paints the initial state, and `mocks: {used: false}` says why), which is what the automatic pictures use, so they show the app's content instead of its offline placeholders; --state injects worker state; --input supplies pre-boot navigation params; --width/--device for PNG viewport; --rtl for dir=rtl + $env:isRTL.", required: "<screenId> [--content <dir>] [--scheme dark] [--png [<file>]] [--tree] [--static] [--live] [--mocks | --no-mocks] [--state <json|file>] [--input <json|file>] [--width <px> | --device <name>] [--platform ios|android] [--rtl] [--remote --app --release]" },
|
|
@@ -213924,9 +214056,9 @@ var COMMANDS = [
|
|
|
213924
214056
|
{ name: "connector", summary: "personal access tokens for the hosted MCP connector (Wix Native App Builder), for an AI tool that cannot sign in with OAuth (e.g. Base44's builder): `token create` opens a Wix sign-in page and prints a long-lived token once, to paste into the tool as `Authorization: Bearer <token>`; `token list` / `token revoke <id>` manage them with the `himi login --browser` token. The token can only build and publish DRAFTS.", required: "token create [--name <n>] [--days <1-90>] [--no-open] | token list | token revoke <id> [--target <t>]" },
|
|
213925
214057
|
{ name: "notify", summary: "Hosted --all-members requires --yes for a live send; --dry-run checks ownership/readiness and counts approved recipients without sending. `setup` optionally configures Branded/Ping from local customer key files; `status --refresh` reads live backend readiness. Setup may be deferred while building. These use serve-control and require owner plus Wix account authentication. `send`, `tokens`, `doctor`: send a REAL push notification to registered devices (RFC 0036 WS5) \u2014 APNs .p8 over HTTP/2 for iOS, FCM v1 for Android. `send` targets one device (--token / --device <registry id>) or fans out to the whole app (--all), reporting a per-device result; a token the provider says is uninstalled (APNs 410 Unregistered / FCM UNREGISTERED) is auto-disabled, while a merely wrong one (BadDeviceToken \u2014 usually a sandbox/production mismatch) is recorded and left enabled. `tokens` lists the registry. `doctor` reports which credentials resolve and which sender each platform picks. Talks to the admin-server via --admin-url/HIMALAYA_ADMIN_URL, authenticated with --admin-session/HIMALAYA_ADMIN_SESSION. `send --provider ping` is the hosted alternative: the serve plane sends to one site member (--member-email) or all approved members (--all-members) through Ping as Himalaya, with owner login instead of provider keys, and reports acceptance, never delivery. NOT `himi push`, which publishes a release.", required: "setup|status [--content <dir>] [--target <t>] [--refresh] [--yes] [--no-push-setup] | send --provider ping [--content <dir>] [--app <a>] [--site <msid>] (--member-email <email> | --all-members (--dry-run | --yes)) --title <s> [--body <s>] --link <url> [--request-id <uuid>] [--dry-run] [--json] | send|tokens|doctor [--app <a>] [--token <t> | --device <id> | --all] [--title <s>] [--body <s>] [--link <url>] [--platform ios|android] [--badge <n>] [--channel <id>] [--silent] [--dry-run] [--json]" },
|
|
213926
214058
|
{ name: "signing", summary: "READ-ONLY App Store Connect inventory for customer BYO TestFlight readiness. `inspect` lists whether the bundle id, distribution certificate, IOS_APP_STORE profile, and ASC app record exist for --bundle-id / --team-id using a local ASC .p8 (flags or ASC_KEY_* env). Never uploads or mutates Apple resources. Optional --cert-file/--profile-file classify on-disk material.", required: "inspect --bundle-id <id> --team-id <id> --asc-key-file <path> --asc-key-id <id> --asc-issuer-id <id> [--cert-file <p12> --cert-password <pw> --profile-file <mobileprovision>] [--json]" },
|
|
213927
|
-
{ name: "site", summary: "PROVISION a Wix project, then analyze or extend it. `create` is the one door that makes a site instead of adopting one: POST /funnel/projects/v1/create (a WIX site, a HEADLESS backend, a BRANDED_APP, or a VIBE site), and for headless it also mints the OAuth app whose id IS the `WIX_CLIENT_ID` \u2014 with --redirect-uri already registered, because an unregistered redirect makes native signInDirect fail at redirect-session. `--verticals` REQUIRES `--template` and reports only what Wix confirmed: measured, installing onto a project created from the BLANK template returns 200 while the vertical's API answers 428 forever, because there is no site for it to attach to (the install asks for CREATE_SITE). A real template ships its verticals installed and populated, and installing further ones onto it then works. It MUTATES your Wix account and needs --yes; without it you get the payload and nothing is sent. `list` is the read-only site inventory (with each site's premium flag, which is what explains an installed-but-428 vertical). Auth is the account-scoped `wix token` (no --site), falling back to WIX_API_KEY + WIX_ACCOUNT_ID. `client` is the same OAuth step for a site that ALREADY exists \u2014 the one himi adopts rather than makes \u2014 so a clientId no longer means a manual trip to the dashboard: `client ensure` reconciles rather than mints, because a site can already carry a client with NO registered redirect and shipping that one fails signInDirect at runtime; it reuses a client that carries --redirect-uri, PATCHes one that matches --name but lacks it (unioning, so another app's redirect survives), and creates only when there is nothing to reuse (--new forces a fresh one). --name IS the idempotency key. `client` auth is SITE-scoped (`wix token --site <msid>`) because minting is owner-of-that-site, and --yes gates every mutation: a site that already has a usable client resolves WITHOUT it, but --write-provisioning needs --yes even then because it rewrites a manifest on disk (the dry run's planned.provisioning names the file). That query endpoint IGNORES paging (measured: query.paging, cursorPaging and a top-level paging all return the full set at offset 0), so when pagingMetadata reports more clients than came back, `ensure` REFUSES EVERY outcome \u2014 create, patch AND reuse. Reuse is refused too because pickClient breaks ties on the OLDEST createdDate, so an omitted older same-named MOBILE client with the same redirect would win a later complete read and the resolved clientId would MOVE between runs \u2014 and it gets written into provisioning.json; convergence is what makes a stray duplicate untidy rather than harmful. --name cannot narrow the query (no filter is sent; the name is applied to the rows after they arrive), so the recovery is the dashboard; --new skips the query entirely. A `patched` result is verified against what Wix STORED \u2014 the redirect list is read off the PATCH response, and re-read via GET when the response omits it, because falling back to the list himi just sent would make the guard pass vacuously on exactly the silent no-op it exists to catch. `client list` is the read-only inventory of a site's clients: act on its `shippable` column rather than `hasRedirect`, because shippable ALSO requires a MOBILE applicationType and `ensure` refuses a WEB client \u2014 a WEB one carrying your redirect looks right and is not a candidate \u2014 and it sets truncated:true rather than presenting a partial inventory as the whole one. `analyze --read-only` returns API-only generation context as JSON (identity, access probes, CMS permissions and selected redacted Velo source); it needs no browser and never uploads or applies anything. A URL is optional there: `--url` lets it read the published page's Velo code-app ids (credential-free, pinned transport) so the backend source is found on sites where the owner code-app probe 404s. `analyze` reads a site into a business-book folder (REST + Playwright, GET-only); `--url` alone is the visitor-only pass over the published pages, and `--client-id` adds the vertical probes and the app binding `--apply` requires; `site function` list/get/put/publish/invokes that site's Velo HTTP functions and is not `himi functions` (serve-plane jobs). `--apply` bakes into a brandable shell (a site shell needs no `--client-id`: it is visitor-only and binds no client); `--shell` takes the same names `himi dist --shell` does and defaults to branded-lite, and a shell that ships no prepare:customer is refused by name rather than half-built. `--shell brandy` (the site shell, RFC 0062) also derives the site's page map from its published pages and header menu \u2014 Home first, up to four tabs for the pages a visitor returns to, the rest in the drawer \u2014 into the overlay's `site` block, so it can be edited before `--apply`; only a site shell ever receives that block. It never overwrites any shell's committed apps/<shell>/provisioning.json. `member-app set|clear|show <msid>` is the site's member app in Spaces (#4091): the himi app the site's members open in Spaces Lite instead of Branded Lite. `set --app <id>` takes the site's own app or one your account owns (an owned app not yet tied to the site is linked first; another account's app is refused, 403); `clear` returns the site to Branded Lite; `show` prints the pick plus the COMPUTED verdict \u2014 the picked release's requirements judged against the Spaces host manifest (checkHostCompatibility, `--platform` to judge one phone platform) \u2014 and `reason` when it falls back to Branded Lite. Auth is your `himi login` control token plus the account `wix token`, which the plane uses to verify you own the site.", required: "create <name> [--type wix|headless|branded-app|vibe] [--template <guid>] [--verticals stores,bookings,\u2026] [--folder <guid>] [--redirect-uri <uri>] [--no-oauth-app] [--write-provisioning [path]] [--site-url <url>] [--json] --yes | list | client ensure|list --site <msid> [--name <name>] [--redirect-uri <uri>] [--new] [--write-provisioning [path]] [--site-url <url>] [--json] --yes | analyze --read-only [--site <msid>] [--client-id <id>] [--url <https>] [--json] | analyze --url <https> [--client-id <id>] [--site <msid>] [--out <dir>] [--redirect-uri <uri>] [--apply] [--shell " + SHELL_ENUM + "] | function list|get|put|publish|invoke [--site <msid>] [--url <https>] [--method GET|POST|PUT|DELETE] [--source <file>] [--body <json>] [--publish] [--invoke] | member-app set|clear|show <msid> [--app <id>] [--platform ios|android]" },
|
|
214059
|
+
{ name: "site", summary: "PROVISION a Wix project, then analyze or extend it. `create` is the one door that makes a site instead of adopting one: POST /funnel/projects/v1/create (a WIX site, a HEADLESS backend, a BRANDED_APP, or a VIBE site), and for headless it also mints the OAuth app whose id IS the `WIX_CLIENT_ID` \u2014 with --redirect-uri already registered, because an unregistered redirect makes native signInDirect fail at redirect-session. `--verticals` REQUIRES `--template` and reports only what Wix confirmed: measured, installing onto a project created from the BLANK template returns 200 while the vertical's API answers 428 forever, because there is no site for it to attach to (the install asks for CREATE_SITE). A real template ships its verticals installed and populated, and installing further ones onto it then works. It MUTATES your Wix account and needs --yes; without it you get the payload and nothing is sent. `list` is the read-only site inventory (with each site's premium flag, which is what explains an installed-but-428 vertical). Auth is the account-scoped `wix token` (no --site), falling back to WIX_API_KEY + WIX_ACCOUNT_ID. `client` is the same OAuth step for a site that ALREADY exists \u2014 the one himi adopts rather than makes \u2014 so a clientId no longer means a manual trip to the dashboard: `client ensure` reconciles rather than mints, because a site can already carry a client with NO registered redirect and shipping that one fails signInDirect at runtime; it reuses a client that carries --redirect-uri, PATCHes one that matches --name but lacks it (unioning, so another app's redirect survives), and creates only when there is nothing to reuse (--new forces a fresh one). --name IS the idempotency key. `client` auth is SITE-scoped (`wix token --site <msid>`) because minting is owner-of-that-site, and --yes gates every mutation: a site that already has a usable client resolves WITHOUT it, but --write-provisioning needs --yes even then because it rewrites a manifest on disk (the dry run's planned.provisioning names the file). That query endpoint IGNORES paging (measured: query.paging, cursorPaging and a top-level paging all return the full set at offset 0), so when pagingMetadata reports more clients than came back, `ensure` REFUSES EVERY outcome \u2014 create, patch AND reuse. Reuse is refused too because pickClient breaks ties on the OLDEST createdDate, so an omitted older same-named MOBILE client with the same redirect would win a later complete read and the resolved clientId would MOVE between runs \u2014 and it gets written into provisioning.json; convergence is what makes a stray duplicate untidy rather than harmful. --name cannot narrow the query (no filter is sent; the name is applied to the rows after they arrive), so the recovery is the dashboard; --new skips the query entirely. A `patched` result is verified against what Wix STORED \u2014 the redirect list is read off the PATCH response, and re-read via GET when the response omits it, because falling back to the list himi just sent would make the guard pass vacuously on exactly the silent no-op it exists to catch. `client list` is the read-only inventory of a site's clients: act on its `shippable` column rather than `hasRedirect`, because shippable ALSO requires a MOBILE applicationType and `ensure` refuses a WEB client \u2014 a WEB one carrying your redirect looks right and is not a candidate \u2014 and it sets truncated:true rather than presenting a partial inventory as the whole one. `analyze --read-only` returns API-only generation context as JSON (identity, access probes, CMS permissions and selected redacted Velo source); it needs no browser and never uploads or applies anything. A URL is optional there: `--url` lets it read the published page's Velo code-app ids (credential-free, pinned transport) so the backend source is found on sites where the owner code-app probe 404s. `analyze` reads a site into a business-book folder (REST + Playwright, GET-only); `--url` alone is the visitor-only pass over the published pages, and `--client-id` adds the vertical probes and the app binding `--apply` requires; with no Playwright/Chromium it refuses before any work (code \"browser_unavailable\", the install command in `fix`) unless `--no-browser` asks for the static-HTML-only pass; `site function` list/get/put/publish/invokes that site's Velo HTTP functions and is not `himi functions` (serve-plane jobs). `--apply` bakes into a brandable shell (a site shell needs no `--client-id`: it is visitor-only and binds no client); `--shell` takes the same names `himi dist --shell` does and defaults to branded-lite, and a shell that ships no prepare:customer is refused by name rather than half-built. `--shell brandy` (the site shell, RFC 0062) also derives the site's page map from its published pages and header menu \u2014 Home first, up to four tabs for the pages a visitor returns to, the rest in the drawer \u2014 into the overlay's `site` block, so it can be edited before `--apply`; only a site shell ever receives that block. It never overwrites any shell's committed apps/<shell>/provisioning.json. `member-app set|clear|show <msid>` is the site's member app in Spaces (#4091): the himi app the site's members open in Spaces Lite instead of Branded Lite. `set --app <id>` takes the site's own app or one your account owns (an owned app not yet tied to the site is linked first; another account's app is refused, 403); `clear` returns the site to Branded Lite; `show` prints the pick plus the COMPUTED verdict \u2014 the picked release's requirements judged against the Spaces host manifest (checkHostCompatibility, `--platform` to judge one phone platform) \u2014 and `reason` when it falls back to Branded Lite. Auth is your `himi login` control token plus the account `wix token`, which the plane uses to verify you own the site.", required: "create <name> [--type wix|headless|branded-app|vibe] [--template <guid>] [--verticals stores,bookings,\u2026] [--folder <guid>] [--redirect-uri <uri>] [--no-oauth-app] [--write-provisioning [path]] [--site-url <url>] [--json] --yes | list | client ensure|list --site <msid> [--name <name>] [--redirect-uri <uri>] [--new] [--write-provisioning [path]] [--site-url <url>] [--json] --yes | analyze --read-only [--site <msid>] [--client-id <id>] [--url <https>] [--json] | analyze --url <https> [--client-id <id>] [--site <msid>] [--out <dir>] [--redirect-uri <uri>] [--apply] [--no-browser] [--shell " + SHELL_ENUM + "] | function list|get|put|publish|invoke [--site <msid>] [--url <https>] [--method GET|POST|PUT|DELETE] [--source <file>] [--body <json>] [--publish] [--invoke] | member-app set|clear|show <msid> [--app <id>] [--platform ios|android]" },
|
|
213928
214060
|
{ name: "base44", summary: "read a BASE44 app into an app book (book.json + BOOK.md) for the agent building a Himi app from it \u2014 the Base44 counterpart of `site analyze`, READ-ONLY. `analyze --url <published app>` is the VISITOR pass: the app id, name, favicon and colours from the published SPA, its router paths, and screenshots + look tokens from the Playwright crawl. `analyze --app-id <id>` adds the OWNER pass and needs a session: the project source under <out>/source/ (the read half of `base44 eject` \u2014 GET api/apps/<id>/eject \u2014 through the same deny-list and secret scan `himi push` uses, widened by the book's token shapes; `eject` itself is never run because it CREATES a copy of the app), every entity's JSON schema, required fields and RLS rules with up to --sample redacted rows (default 5, 0 = off), backend functions, agents, connectors (names and scopes only, never tokens), secret NAMES (never values), auth visibility + providers, and the route \u2192 component \u2192 entities map from the source router. Every chapter it could not read is listed in `gaps` rather than failing the run. `login` runs Base44's device sign-in and stores the session in ~/.himi/base44/session.json (never the repo; --from-base44-cli imports `npx base44 login`'s session instead); BASE44_ACCESS_TOKEN in the environment wins, for CI. `whoami` prints who is signed in (never the token); `logout` removes the stored session. `auth-check --url <tenant> --ios-app-id <PREFIX.bundle.id>` and/or `--android-package <package> --android-sha256 <fingerprint>` checks public native-login associations and prints missing entries; it never reads an owner token. --json prints the book itself. himi docs base44-app-context. `adopt` turns the book into a reviewable base44-entities.ts of ADOPTED entity + function declarations for config.ts (never edits config.ts, never overwrites); `entities query` is READ-ONLY and reports, per declared entity, ownership, row count and schema drift against the live app, plus foreign entities. `entities create` provisions the app's OWNED Himi<App>* entities: Base44's schema write is a destructive full-set sync, so the single PUT carries every entity in a freshly read eject snapshot (foreign ones verbatim) and the run refuses BEFORE sending when one would be dropped, the snapshot is unreadable or empty, or it moved since the plan; removing an owned field/entity needs --allow-destructive, rewriting owned RLS needs --apply-permissions. `entities seed` bulk-inserts seed rows into empty owned entities only (--ai writes base44-seed.json offline). `functions deploy` ships owned functions one PUT each, never the bulk sync or DELETE, and refuses a name deployed by someone else. All three print a plan and write only with --yes, which needs a `login --write` (apps:write) session. `types` writes tier5-src/_shared/base44-entities.ts \u2014 a row type and a typed `entities<Row>()` handle per declared entity, byte-stable \u2014 and `himi validate` reports base44-types-stale when that file falls behind the block (nothing when it is absent). himi docs base44-entities. `screens` (base44-starter packages) writes one generated list + detail screen per declared entity over the template's shared engine, with write controls gated by the entity's rls; an unchanged config reports every file `unchanged`, a hand-edited generated file is `skipped-edited` unless --force; never calls Base44. himi docs base44-app-to-himi-app", required: "analyze (--url <https://\u2026> | --app-id <id>) [--out .himi/base44-book] [--sample <n>] [--json] | adopt [--book .himi/base44-book] [--entities A,B] [--write [path]] [--json] | entities query [--content <dir>] [--all] [--json] | entities create [--app <a>] [--yes] [--allow-destructive] [--apply-permissions] [--empty-app-ok] | entities seed [--app <a>] [--yes] [--only A,B] [--ai] | functions deploy [--app <a>] [--yes] [--only a,b] | types [--content <dir>] [--json] | screens [--content <dir>] [--force] [--dry-run] [--json] | login [--write] [--from-base44-cli] | whoami | logout | auth-check --url <https://tenant> [--ios-app-id <PREFIX.bundle.id>] [--android-package <package> --android-sha256 <fingerprint>]" },
|
|
213929
|
-
{ name: "doctor", summary: 'off-VPN preflight in one shot: probe the PUBLIC data plane (www.wixapis.com \u2014 reachable off-VPN), the INTERNAL serve/control plane for the selected target (VPN-gated), and report auth state (dpx session on disk + stored control token). --dpx additionally runs a live, EADDRINUSE-safe `dpx whoami`. Machine-readable with --json (an unreachable internal plane carries a stable code:"needs_vpn" so an agent branches on the code, not the prose); human-readable otherwise. Never loads the authoring runtime \u2014 works off-repo.', required: "[--target <t>] [--dpx] [--json] [--data-url <url>] [--timeout <ms>]" },
|
|
214061
|
+
{ name: "doctor", summary: 'off-VPN preflight in one shot: probe the PUBLIC data plane (www.wixapis.com \u2014 reachable off-VPN), the INTERNAL serve/control plane for the selected target (VPN-gated), and report auth state (dpx session on disk + stored control token). --dpx additionally runs a live, EADDRINUSE-safe `dpx whoami`. Machine-readable with --json (an unreachable internal plane carries a stable code:"needs_vpn" so an agent branches on the code, not the prose); human-readable otherwise. Also reports whether Playwright and its Chromium are installed (code:"browser_unavailable" + the exact `fix` command when not \u2014 `himi site analyze`, `render --png` and the screenshot paths need them); --install-browser downloads the Chromium the CLI\'s own Playwright launches, then re-checks. Never loads the authoring runtime \u2014 works off-repo.', required: "[--target <t>] [--dpx] [--install-browser] [--json] [--data-url <url>] [--timeout <ms>]" },
|
|
213930
214062
|
{ name: "upgrade", summary: "install the newest published CLI (`npm i -g @wix/himalaya-cli@latest`) and report what moved. This is the explicit door: himi also updates itself when the running build is more than a week old \u2014 unattended it just does it and re-runs your command, at a terminal it asks first \u2014 and `HIMI_NO_UPDATE_CHECK=1` turns that off, leaving this command as the way to catch up. Reports `unchanged` rather than claiming success when npm exits 0 without moving the version, which is what a registry mirror serving its own pinned copy looks like.", required: "[--json]" },
|
|
213931
214063
|
{ name: "push", summary: "lint + build + publish a release (default --draft: servable via ?release= but NOT live). REFUSES to publish on any error unless --force; --strict promotes warnings. Prints preview + agent-context links. A successful draft push also rebuilds the making-of (.himi/making-of.html, local and offline) and names it as `reel` \u2014 the file to hand the owner beside the preview link. Its postcard carries the home shot only when that shot is newer than the last source edit; a repeat draft's postcard adds what changed since the last one (\"Since the last draft: the home screen changed.\", from the release manifests' screen hashes, remembered in .himi/last-draft.json); otherwise the postcard says why and names `himi render <home> --png`, and the envelope's `postcardPicture: {skipped, render}` leads next[] with that render (the push never renders it itself). The published slug is NAMESPACED per owner \u2014 `<ownerPrefix>.<name>`, composed offline from the control token's ownerPrefix claim, so the CLI and the server derive the identical string and himalaya.content.json is NOT rewritten (a legacy token with no ownerPrefix publishes the declared name unchanged). An app claimed BEFORE namespacing is stored under its FLAT slug, so the claim route answers `alreadyYours` naming that slug and the push adopts it \u2014 reported as `adoptedSlug`, since it is the one case where the published `app` differs from what the declared name composes to. `--no-claim` skips the route that knows this, so a pre-namespacing app pushed with it still fails 403. --visibility public|unlisted decides whether /v1/apps + the Himi Player picker LIST the app (also declarable as `visibility` in himalaya.content.json; omitted, a brand-new app defaults to unlisted \u2014 share by link \u2014 and an existing setting is kept). --account-id names which account owns the app when your Wix session resolves to several (the auto-claim of a brand-new slug cannot guess \u2014 without it a multi-account caller is told to name one). An unforced push of a release that carries SCREENS also refuses when `.himi/ux-audit.json` holds no mobile-UX drive recorded against that release id, or holds one that FAILED (#2955) \u2014 a published draft IS the owner-private preview a customer is handed; `himi ux record` clears it and `--force` overrides it, which the success envelope then says out loud. `--only <selector>` publishes ONLY the named items as a release derived from the app's live release (or `--from-release <id>`), running the identical build + lint gate and simply publishing less; it requires an explicit `--draft` or `--live` because a partial publish has no safe default, never claims a slug, and carries neither attestation nor a source archive (both named in the output). Selectors are comma-separated in ONE `--only`: `changed` (every item whose bytes differ from the base), `screen:<id|glob>`, `bundle:<name>`, `tokens`, `app-config` \u2014 a selected screen drags its logic bundle and a selected bundle drags the screens that reference it, or the bytes land under a key nothing reads. The plane REFUSES (409 binary_capability_gap) a release declaring a PERMISSION-BEARING capability (iOS usage string or entitlement, Android permission \u2014 camera, location, push, \u2026) that the app's last successful `himi dist` was not built with: an OTA push cannot add an OS permission, and on iOS asking for one whose purpose string is missing kills the app. Run `himi dist` first, or pass `--allow-binary-gap` when every installed binary already carries it \u2014 recorded on the release as `allowedBinaryGap`. A gap in a permission-free capability (share, clipboard, \u2026) stays the `needsBinary` advice.", required: "[--content <dir>] [--draft] [--live] [--force] [--strict] [--label] [--notes] [--visibility public|unlisted] [--allow-binary-gap] [--no-claim] [--account-id <id>] [--only <selector>] [--from-release <id>] [--accept-regressions] [--accept-partial] [--app <slug>] (--control-token)" },
|
|
213932
214064
|
{ name: "pack", summary: 'write the app as a PORTABLE .himi package \u2014 one self-contained file holding every screen, Tier-5 bundle, token, asset and the app-config. Packages are live by default: they boot bundled content offline, then Himi Player follows its baked-in production ring. `--snapshot` makes a frozen reproducible artifact. Package-supplied origins are never trusted. --format dir writes the same tree unpacked, for static hosting. --release-dir packs a release that is already built on disk (needs --app) instead of rebuilding from source. `--dev` ALSO packs the app\'s own source archive into the container (`source.zip`, header `contents: "dev"`), so the package can be handed to someone who then keeps building \u2014 collected through the same deny-list and secret scan `himi push` uses, and refused if a credential is found. A dev package IS the codebase: it is never the default, it is always labelled in the output, the web host will not open one, and it is archive-only (`--dev --format dir` is refused, because a reader that predates the source entry drops it before hashing a directory and would call the package tampered). Restore one with `himi import`.', required: "[--content <dir>] [--out <file|dir>] [--format zip|dir] [--name <title>] [--snapshot] [--dev] [--strict] [--force] | --release-dir <dir> --app <a>" },
|
|
@@ -214015,7 +214147,7 @@ async function hhpCommand(ctx) {
|
|
|
214015
214147
|
init_define_HHP_CATALOG();
|
|
214016
214148
|
init_scaffold();
|
|
214017
214149
|
init_store();
|
|
214018
|
-
import { existsSync as
|
|
214150
|
+
import { existsSync as existsSync54 } from "node:fs";
|
|
214019
214151
|
import { join as join50, resolve as resolve48 } from "node:path";
|
|
214020
214152
|
init_self_update();
|
|
214021
214153
|
init_cli_shared();
|
|
@@ -214043,7 +214175,7 @@ var NoBase44SlotError = class extends Error {
|
|
|
214043
214175
|
};
|
|
214044
214176
|
async function initFromRemoteTemplate(name, parentDir, template, c2, opts = {}) {
|
|
214045
214177
|
const dir = resolve48(parentDir, name);
|
|
214046
|
-
if (
|
|
214178
|
+
if (existsSync54(join50(dir, "himalaya.content.json"))) {
|
|
214047
214179
|
throw new Error(`content package already exists at ${dir}`);
|
|
214048
214180
|
}
|
|
214049
214181
|
const r3 = await c2.fetchTemplateSource(TEMPLATE_APP_PREFIX + template);
|
|
@@ -214119,7 +214251,7 @@ async function initCommand(ctx) {
|
|
|
214119
214251
|
const owed = openApprovals2(readApprovals2(dir).events).length;
|
|
214120
214252
|
next.push(`carried the planning journal into the app (${carried.join(", ")}${owed ? `; ${owed} approval${owed === 1 ? "" : "s"} still owed` : ""}) \u2014 \`himi progress --brief\` there shows it`);
|
|
214121
214253
|
}
|
|
214122
|
-
const planInParent = ["SPEC.md", "MOBILE-UX.md"].filter((f2) =>
|
|
214254
|
+
const planInParent = ["SPEC.md", "MOBILE-UX.md"].filter((f2) => existsSync54(join50(parentDir, f2)));
|
|
214123
214255
|
if (planInParent.length) {
|
|
214124
214256
|
next.push(`${planInParent.join(" and ")} in ${parentDir} ${planInParent.length > 1 ? "are" : "is"} not the app's \u2014 if that is the approved plan, move it over the template's boilerplate in ${dir}`);
|
|
214125
214257
|
}
|
|
@@ -214195,7 +214327,7 @@ init_scaffold();
|
|
|
214195
214327
|
init_store();
|
|
214196
214328
|
init_wix_placeholders();
|
|
214197
214329
|
init_lint_report();
|
|
214198
|
-
import { mkdtempSync as mkdtempSync2, readFileSync as
|
|
214330
|
+
import { mkdtempSync as mkdtempSync2, readFileSync as readFileSync77, existsSync as existsSync67, rmSync as rmSync19 } from "node:fs";
|
|
214199
214331
|
import { createHash as createHash30 } from "node:crypto";
|
|
214200
214332
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
214201
214333
|
import { join as join64, resolve as resolve51, basename as basename18 } from "node:path";
|
|
@@ -214282,10 +214414,10 @@ async function fontIssues(dir, strict, opts = {}) {
|
|
|
214282
214414
|
|
|
214283
214415
|
// src/stores-api-lint.ts
|
|
214284
214416
|
init_define_HHP_CATALOG();
|
|
214285
|
-
import { existsSync as
|
|
214417
|
+
import { existsSync as existsSync58, readdirSync as readdirSync31, readFileSync as readFileSync66 } from "node:fs";
|
|
214286
214418
|
import { join as join54 } from "node:path";
|
|
214287
214419
|
function storesV1Issues(contentDir2, strict) {
|
|
214288
|
-
const roots2 = [join54(contentDir2, "tier5-src"), join54(contentDir2, "dev")].filter(
|
|
214420
|
+
const roots2 = [join54(contentDir2, "tier5-src"), join54(contentDir2, "dev")].filter(existsSync58);
|
|
214289
214421
|
const files = [];
|
|
214290
214422
|
const visit = (dir) => {
|
|
214291
214423
|
for (const entry of readdirSync31(dir, { withFileTypes: true })) {
|
|
@@ -214295,7 +214427,7 @@ function storesV1Issues(contentDir2, strict) {
|
|
|
214295
214427
|
}
|
|
214296
214428
|
};
|
|
214297
214429
|
roots2.forEach(visit);
|
|
214298
|
-
return files.flatMap((file2) => /\/stores\/v1(?:\/|["'`])/.test(
|
|
214430
|
+
return files.flatMap((file2) => /\/stores\/v1(?:\/|["'`])/.test(readFileSync66(file2, "utf8")) ? [{
|
|
214299
214431
|
screen: null,
|
|
214300
214432
|
pass: "wix-stores-api",
|
|
214301
214433
|
severity: strict ? "error" : "warning",
|
|
@@ -214308,7 +214440,7 @@ init_cli_shared();
|
|
|
214308
214440
|
function embeddedTemplateCatalog() {
|
|
214309
214441
|
return availableTemplates().map((name) => {
|
|
214310
214442
|
const path2 = join64(templateSourceDir(name), TEMPLATE_META_FILE);
|
|
214311
|
-
const meta = JSON.parse(
|
|
214443
|
+
const meta = JSON.parse(readFileSync77(path2, "utf8"));
|
|
214312
214444
|
if (!meta || typeof meta.title !== "string" || typeof meta.description !== "string" || !Array.isArray(meta.tags)) {
|
|
214313
214445
|
throw new Error(`${path2} must be { title: string, description: string, tags: string[], category?: string }`);
|
|
214314
214446
|
}
|
|
@@ -214431,7 +214563,7 @@ async function templateCommand(ctx) {
|
|
|
214431
214563
|
if (!from) return refuse7("invalid_usage", `${flag} ${id} needs --from <file> holding the screen: a ScreenDescriptor JSON object, { "${id}": <ScreenDescriptor> }, or the entry --show prints`);
|
|
214432
214564
|
let text15;
|
|
214433
214565
|
try {
|
|
214434
|
-
text15 =
|
|
214566
|
+
text15 = readFileSync77(from, "utf8");
|
|
214435
214567
|
} catch (e2) {
|
|
214436
214568
|
return refuse7("invalid_input", `${from} is not readable (${e2.message}) \u2014 nothing written`);
|
|
214437
214569
|
}
|
|
@@ -214448,7 +214580,7 @@ async function templateCommand(ctx) {
|
|
|
214448
214580
|
if (!from) return refuse7("invalid_usage", '--upsert needs --from <file> holding { "<screenId>": <ScreenDescriptor>, \u2026 }');
|
|
214449
214581
|
let screens;
|
|
214450
214582
|
try {
|
|
214451
|
-
screens = JSON.parse(
|
|
214583
|
+
screens = JSON.parse(readFileSync77(from, "utf8"));
|
|
214452
214584
|
} catch (e2) {
|
|
214453
214585
|
return refuse7("invalid_input", `--upsert: ${from} is not readable JSON (${e2.message}) \u2014 nothing written`);
|
|
214454
214586
|
}
|
|
@@ -214626,7 +214758,7 @@ async function templateCommand(ctx) {
|
|
|
214626
214758
|
const result = { ...outcome.result, ...fromSpec };
|
|
214627
214759
|
const adoptDir = contentDir(flags);
|
|
214628
214760
|
const kept = flags["dry-run"] !== true && (outcome.code === 0 || outcome.result.forcedKeep === true);
|
|
214629
|
-
if (kept &&
|
|
214761
|
+
if (kept && existsSync67(join64(adoptDir, adoptBits.ADOPT_FILE))) {
|
|
214630
214762
|
try {
|
|
214631
214763
|
const inv = adoptBits.inspectApp(adoptDir);
|
|
214632
214764
|
adoptBits.writeInventory(adoptDir, inv, { companions: "if-missing" });
|
|
@@ -214656,7 +214788,7 @@ async function templateCommand(ctx) {
|
|
|
214656
214788
|
ensureTemplatesFor(appDir3, sourceDir);
|
|
214657
214789
|
let meta;
|
|
214658
214790
|
try {
|
|
214659
|
-
meta = JSON.parse(
|
|
214791
|
+
meta = JSON.parse(readFileSync77(join64(sourceDir, TEMPLATE_META_FILE), "utf8"));
|
|
214660
214792
|
} catch {
|
|
214661
214793
|
io2.error(JSON.stringify({ error: `no ${TEMPLATE_META_FILE} in ${sourceDir} \u2014 a template must declare { title, description, tags } to be published`, hint: `add ${TEMPLATE_META_FILE} next to himalaya.content.json (or pass --source-dir <dir>)` }));
|
|
214662
214794
|
return 2;
|
|
@@ -214666,7 +214798,7 @@ async function templateCommand(ctx) {
|
|
|
214666
214798
|
return 2;
|
|
214667
214799
|
}
|
|
214668
214800
|
try {
|
|
214669
|
-
const appearance = extractTemplateAppearance(JSON.parse(
|
|
214801
|
+
const appearance = extractTemplateAppearance(JSON.parse(readFileSync77(join64(sourceDir, "tokens.json"), "utf8")));
|
|
214670
214802
|
meta = { ...appearance, ...meta };
|
|
214671
214803
|
} catch {
|
|
214672
214804
|
}
|
|
@@ -214689,7 +214821,7 @@ async function templateCommand(ctx) {
|
|
|
214689
214821
|
const iconPath = str3(flags.icon) ? resolve51(str3(flags.icon)) : templateIconPath(name);
|
|
214690
214822
|
if (!iconPath) return void 0;
|
|
214691
214823
|
try {
|
|
214692
|
-
const bytes2 =
|
|
214824
|
+
const bytes2 = readFileSync77(iconPath);
|
|
214693
214825
|
return { bytes: bytes2, hash: createHash30("sha256").update(bytes2).digest("hex") };
|
|
214694
214826
|
} catch {
|
|
214695
214827
|
return void 0;
|
|
@@ -215014,7 +215146,7 @@ async function ejectCommand(ctx) {
|
|
|
215014
215146
|
init_define_HHP_CATALOG();
|
|
215015
215147
|
init_wix_placeholders();
|
|
215016
215148
|
init_lint_report();
|
|
215017
|
-
import { readFileSync as
|
|
215149
|
+
import { readFileSync as readFileSync87, existsSync as existsSync76 } from "node:fs";
|
|
215018
215150
|
import { join as join76 } from "node:path";
|
|
215019
215151
|
init_surface_lint();
|
|
215020
215152
|
init_token_lint();
|
|
@@ -215022,11 +215154,11 @@ init_token_lint();
|
|
|
215022
215154
|
// src/icon-lint.ts
|
|
215023
215155
|
init_define_HHP_CATALOG();
|
|
215024
215156
|
init_icon2();
|
|
215025
|
-
import { existsSync as
|
|
215157
|
+
import { existsSync as existsSync70 } from "node:fs";
|
|
215026
215158
|
import { join as join67 } from "node:path";
|
|
215027
215159
|
async function iconIssues(dir, strict, opts = {}) {
|
|
215028
|
-
if (!
|
|
215029
|
-
const migration =
|
|
215160
|
+
if (!existsSync70(join67(dir, "himalaya.content.json"))) return [];
|
|
215161
|
+
const migration = existsSync70(join67(dir, ".himi/one-app/manifest.json")) || existsSync70(join67(dir, "ONE-APP-COVERAGE.json"));
|
|
215030
215162
|
const requireDeclared = opts.requireDeclared || strict && opts.migrationCompletion && migration;
|
|
215031
215163
|
const requireVerified = opts.requireVerified || strict && opts.migrationCompletion && migration;
|
|
215032
215164
|
const remedy = migration ? "`himi icon from-one-app` or `himi icon set <existing-mark>`; preserve the source mark, do not generate a replacement." : "`himi icon set <file.png>`, `himi icon from-site`, or `himi icon generate`.";
|
|
@@ -215093,7 +215225,7 @@ async function nativeConfigAdvisories(app, configSource) {
|
|
|
215093
215225
|
const { iosProjectYml: iosProjectYml2 } = await Promise.resolve().then(() => (init_paths(), paths_exports));
|
|
215094
215226
|
const { androidOptedIn: androidOptedIn3, LABEL_IOS_SPLASH: LABEL_IOS_SPLASH2 } = await Promise.resolve().then(() => (init_splash(), splash_exports));
|
|
215095
215227
|
const iosYmlPath = iosProjectYml2(app);
|
|
215096
|
-
const iosYml =
|
|
215228
|
+
const iosYml = existsSync76(iosYmlPath) ? readFileSync87(iosYmlPath, "utf8") : "";
|
|
215097
215229
|
let optedIn = iosYml.includes(LABEL_IOS_SPLASH2);
|
|
215098
215230
|
if (!optedIn) {
|
|
215099
215231
|
const { androidManifestPath: androidManifestPath3 } = await Promise.resolve().then(() => (init_gen_native_config(), gen_native_config_exports));
|
|
@@ -215107,7 +215239,7 @@ async function nativeConfigAdvisories(app, configSource) {
|
|
|
215107
215239
|
}
|
|
215108
215240
|
function readConfigSource(dir) {
|
|
215109
215241
|
try {
|
|
215110
|
-
return
|
|
215242
|
+
return readFileSync87(join76(dir, "config.ts"), "utf8");
|
|
215111
215243
|
} catch {
|
|
215112
215244
|
return null;
|
|
215113
215245
|
}
|
|
@@ -215180,12 +215312,12 @@ async function validateCommand(ctx) {
|
|
|
215180
215312
|
|
|
215181
215313
|
// src/commands/functions.ts
|
|
215182
215314
|
init_define_HHP_CATALOG();
|
|
215183
|
-
import { readFileSync as
|
|
215315
|
+
import { readFileSync as readFileSync90 } from "node:fs";
|
|
215184
215316
|
|
|
215185
215317
|
// src/dpx.ts
|
|
215186
215318
|
init_define_HHP_CATALOG();
|
|
215187
|
-
import { spawnSync as
|
|
215188
|
-
import { existsSync as
|
|
215319
|
+
import { spawnSync as spawnSync8 } from "node:child_process";
|
|
215320
|
+
import { existsSync as existsSync77, readFileSync as readFileSync88 } from "node:fs";
|
|
215189
215321
|
import { homedir as homedir9 } from "node:os";
|
|
215190
215322
|
import { join as join77 } from "node:path";
|
|
215191
215323
|
var BO_COOKIE = "WixBoAuthentication_1_19_0";
|
|
@@ -215213,7 +215345,7 @@ function dpxSessionTokenPath() {
|
|
|
215213
215345
|
var DPX_SESSION_PORT = 5151;
|
|
215214
215346
|
function dpxSessionPresent(path2 = dpxSessionTokenPath()) {
|
|
215215
215347
|
try {
|
|
215216
|
-
return
|
|
215348
|
+
return existsSync77(path2) && readFileSync88(path2, "utf8").trim().length > 0;
|
|
215217
215349
|
} catch {
|
|
215218
215350
|
return false;
|
|
215219
215351
|
}
|
|
@@ -215229,7 +215361,7 @@ function parseDpxAuthStatusIdentity(stdout) {
|
|
|
215229
215361
|
return stdout.split("\n").map((l2) => l2.trim()).find(Boolean) || void 0;
|
|
215230
215362
|
}
|
|
215231
215363
|
var defaultRunner2 = (cmd, args) => {
|
|
215232
|
-
const r3 =
|
|
215364
|
+
const r3 = spawnSync8(cmd, args, { encoding: "utf8" });
|
|
215233
215365
|
return { status: r3.status, stdout: r3.stdout ?? "", stderr: r3.stderr ?? "", error: r3.error };
|
|
215234
215366
|
};
|
|
215235
215367
|
function dpxAuthStatus(opts = {}) {
|
|
@@ -215277,7 +215409,7 @@ async function functionsCommand(ctx) {
|
|
|
215277
215409
|
const path2 = dpxSessionTokenPath();
|
|
215278
215410
|
let raw;
|
|
215279
215411
|
try {
|
|
215280
|
-
raw =
|
|
215412
|
+
raw = readFileSync90(path2, "utf8");
|
|
215281
215413
|
} catch {
|
|
215282
215414
|
throw new Error(`no DPX BO session at ${path2}; run dpx auth login, write dpx auth token to that path, then himi login --dpx --target bo`);
|
|
215283
215415
|
}
|
|
@@ -215450,13 +215582,13 @@ async function mcpCommand(ctx) {
|
|
|
215450
215582
|
// src/commands/studio.ts
|
|
215451
215583
|
init_define_HHP_CATALOG();
|
|
215452
215584
|
init_cli_shared();
|
|
215453
|
-
import { mkdirSync as mkdirSync40, writeFileSync as writeFileSync35, existsSync as
|
|
215585
|
+
import { mkdirSync as mkdirSync40, writeFileSync as writeFileSync35, existsSync as existsSync80 } from "node:fs";
|
|
215454
215586
|
import { join as join81, resolve as resolve65, basename as basename22, dirname as dirname48 } from "node:path";
|
|
215455
215587
|
async function studioCommand(ctx) {
|
|
215456
215588
|
const { io: io2, pos, flags, print } = ctx;
|
|
215457
215589
|
const { openStudio: openStudio2 } = await Promise.resolve().then(() => (init_studio(), studio_exports));
|
|
215458
215590
|
const dir = contentDir(flags);
|
|
215459
|
-
if (!
|
|
215591
|
+
if (!existsSync80(join81(dir, "himalaya.content.json"))) {
|
|
215460
215592
|
io2.error(JSON.stringify({ ok: false, error: "not_a_content_package", dir, hint: "run from the app directory (or pass --content <dir>) \u2014 the board reads that package's .himi/" }));
|
|
215461
215593
|
return 2;
|
|
215462
215594
|
}
|
|
@@ -215517,7 +215649,7 @@ ${handover.hint[0].toUpperCase()}${handover.hint.slice(1)}.`);
|
|
|
215517
215649
|
// src/commands/progress.ts
|
|
215518
215650
|
init_define_HHP_CATALOG();
|
|
215519
215651
|
init_cli_shared();
|
|
215520
|
-
import { existsSync as
|
|
215652
|
+
import { existsSync as existsSync81 } from "node:fs";
|
|
215521
215653
|
import { join as join82 } from "node:path";
|
|
215522
215654
|
async function progressCommand2(ctx) {
|
|
215523
215655
|
const { io: io2, pos, flags, print } = ctx;
|
|
@@ -215541,7 +215673,7 @@ async function progressCommand2(ctx) {
|
|
|
215541
215673
|
} = await Promise.resolve().then(() => (init_progress(), progress_exports));
|
|
215542
215674
|
const dir = contentDir(flags);
|
|
215543
215675
|
const journal2 = journalPath2(dir);
|
|
215544
|
-
const isContentPackage =
|
|
215676
|
+
const isContentPackage = existsSync81(join82(dir, "himalaya.content.json"));
|
|
215545
215677
|
const hint = isContentPackage ? {} : { hint: "no himalaya.content.json here \u2014 run from the app directory (or pass --content <dir>) so the build board finds this journal" };
|
|
215546
215678
|
const message2 = pos.slice(1).join(" ").trim();
|
|
215547
215679
|
const approvalFlags = ["approve", "done", "drop"].filter((f2) => flags[f2] !== void 0);
|
|
@@ -215717,6 +215849,13 @@ async function uxCommand(ctx) {
|
|
|
215717
215849
|
...drifting.length ? {
|
|
215718
215850
|
releaseIdWarning: `this record will not reliably match the release \`himi push\` builds: ${describeNondeterministicWorkers(drifting)} ${drifting.length === 1 ? "builds" : "build"} a different initial state depending on when ${drifting.length === 1 ? "it is" : "they are"} built, and that state is hashed into the release. First ${NONDETERMINISTIC_FIX}; then record again, immediately before the push.`
|
|
215719
215851
|
} : {},
|
|
215852
|
+
// #5607 — an `unavailable` record is the complete answer for an agent with no device, and
|
|
215853
|
+
// it is NOT a drive. Say both, in the envelope the agent reads right after recording, so the
|
|
215854
|
+
// record is carried forward as a disclosed gap rather than remembered as coverage.
|
|
215855
|
+
...status === "unavailable" ? {
|
|
215856
|
+
disclosedGap: { platform, status: "not-run", reason: str3(flags.reason)?.trim() ?? "" },
|
|
215857
|
+
note: `Recorded ${platform} as NOT run (${str3(flags.reason)?.trim() ?? ""}). This is a disclosed gap, not a pass: \`himi ux audit --strict\` and \`himi push --draft\` accept it, and both report ${platform} as not driven. Tell the owner which platform nobody drove.`
|
|
215858
|
+
} : {},
|
|
215720
215859
|
evidence
|
|
215721
215860
|
});
|
|
215722
215861
|
return 0;
|
|
@@ -215733,7 +215872,7 @@ init_himi_report();
|
|
|
215733
215872
|
init_attestation();
|
|
215734
215873
|
init_wix_placeholders();
|
|
215735
215874
|
init_lint_report();
|
|
215736
|
-
import { existsSync as
|
|
215875
|
+
import { existsSync as existsSync89, readFileSync as readFileSync100, rmSync as rmSync24 } from "node:fs";
|
|
215737
215876
|
import { createHash as createHash41 } from "node:crypto";
|
|
215738
215877
|
import { join as join91 } from "node:path";
|
|
215739
215878
|
init_crawl_layers();
|
|
@@ -215762,7 +215901,7 @@ async function testCommand(ctx) {
|
|
|
215762
215901
|
print({ ok: false, code: "test_input_evidence_requires_json", error: "--input-evidence requires --json" });
|
|
215763
215902
|
return 2;
|
|
215764
215903
|
}
|
|
215765
|
-
if (captureInputEvidence && (flags.browser === true ||
|
|
215904
|
+
if (captureInputEvidence && (flags.browser === true || existsSync89(join91(dir, "functions")))) {
|
|
215766
215905
|
print({ ok: false, code: "test_input_evidence_unsupported_mode", error: "--input-evidence needs the local app worker crawl, not --browser or a functions package" });
|
|
215767
215906
|
return 2;
|
|
215768
215907
|
}
|
|
@@ -215779,7 +215918,7 @@ async function testCommand(ctx) {
|
|
|
215779
215918
|
return 1;
|
|
215780
215919
|
}
|
|
215781
215920
|
}
|
|
215782
|
-
if (
|
|
215921
|
+
if (existsSync89(join91(dir, "functions"))) {
|
|
215783
215922
|
const { invokeLocalFunction: invokeLocalFunction2, loadFunctionsApp: loadFunctionsApp2 } = await Promise.resolve().then(() => (init_functions(), functions_exports));
|
|
215784
215923
|
const loaded2 = await loadFunctionsApp2(dir);
|
|
215785
215924
|
const results = [];
|
|
@@ -215800,7 +215939,7 @@ async function testCommand(ctx) {
|
|
|
215800
215939
|
try {
|
|
215801
215940
|
if (captureInputEvidence) {
|
|
215802
215941
|
const path2 = join91(dir, "himi-test.json");
|
|
215803
|
-
capturedConfig =
|
|
215942
|
+
capturedConfig = existsSync89(path2) ? readFileSync100(path2) : null;
|
|
215804
215943
|
}
|
|
215805
215944
|
config = readTestConfig2(dir, capturedConfig == null ? capturedConfig : capturedConfig.toString("utf8"));
|
|
215806
215945
|
} catch (e2) {
|
|
@@ -216510,7 +216649,7 @@ async function iconsCommand(ctx) {
|
|
|
216510
216649
|
// src/commands/pull.ts
|
|
216511
216650
|
init_define_HHP_CATALOG();
|
|
216512
216651
|
init_cli_shared();
|
|
216513
|
-
import { existsSync as
|
|
216652
|
+
import { existsSync as existsSync92, readdirSync as readdirSync40, statSync as statSync25 } from "node:fs";
|
|
216514
216653
|
import { join as join96, resolve as resolve70 } from "node:path";
|
|
216515
216654
|
async function pullCommand(ctx) {
|
|
216516
216655
|
const { io: io2, pos, flags, print, client: client2 } = ctx;
|
|
@@ -216528,7 +216667,7 @@ async function pullCommand(ctx) {
|
|
|
216528
216667
|
io2.error(JSON.stringify(linked));
|
|
216529
216668
|
return 1;
|
|
216530
216669
|
}
|
|
216531
|
-
if (
|
|
216670
|
+
if (existsSync92(dest)) {
|
|
216532
216671
|
if (!statSync25(dest).isDirectory()) {
|
|
216533
216672
|
io2.error(JSON.stringify({
|
|
216534
216673
|
error: `${dest} exists and is not a directory`,
|
|
@@ -216541,7 +216680,7 @@ async function pullCommand(ctx) {
|
|
|
216541
216680
|
io2.error(JSON.stringify({ error: `${dest} already exists and is not empty`, hint: "pass --force to write into it anyway (merging, and naming what it keeps), --replace to restore exactly what was archived, or --out/--name to land somewhere else" }));
|
|
216542
216681
|
return 1;
|
|
216543
216682
|
}
|
|
216544
|
-
if (replace && occupied && !
|
|
216683
|
+
if (replace && occupied && !existsSync92(join96(dest, "himalaya.content.json"))) {
|
|
216545
216684
|
io2.error(JSON.stringify({
|
|
216546
216685
|
error: `${dest} is not a content package \u2014 refusing to --replace it`,
|
|
216547
216686
|
hint: "--replace only clears a directory that holds himalaya.content.json. Check --out/--name, or pass --force to merge into it instead."
|
|
@@ -216629,7 +216768,7 @@ init_attestation();
|
|
|
216629
216768
|
init_preview_surfaces();
|
|
216630
216769
|
init_lint_report();
|
|
216631
216770
|
import { createHash as createHash42 } from "node:crypto";
|
|
216632
|
-
import { existsSync as
|
|
216771
|
+
import { existsSync as existsSync94 } from "node:fs";
|
|
216633
216772
|
import { join as join98, relative as relative21 } from "node:path";
|
|
216634
216773
|
init_owner_claim();
|
|
216635
216774
|
init_surface_lint();
|
|
@@ -216652,8 +216791,8 @@ function pushAuthHint(status, token, target, hasOwnerIssuer = true) {
|
|
|
216652
216791
|
}
|
|
216653
216792
|
async function contentVisibility(dir) {
|
|
216654
216793
|
try {
|
|
216655
|
-
const { readFileSync:
|
|
216656
|
-
const m2 = JSON.parse(
|
|
216794
|
+
const { readFileSync: readFileSync150 } = await import("node:fs");
|
|
216795
|
+
const m2 = JSON.parse(readFileSync150(join98(dir, "himalaya.content.json"), "utf8"));
|
|
216657
216796
|
if (m2.visibility === "public" || m2.visibility === "unlisted") return m2.visibility;
|
|
216658
216797
|
} catch {
|
|
216659
216798
|
}
|
|
@@ -216815,7 +216954,7 @@ async function pushCommand(ctx) {
|
|
|
216815
216954
|
const payload = await loadReleaseFromDir(declared, out2);
|
|
216816
216955
|
const oneAppEvidence = join98(dir, ".himi", "one-app");
|
|
216817
216956
|
const oneAppCoverage = join98(dir, "ONE-APP-COVERAGE.json");
|
|
216818
|
-
const oneAppMarked =
|
|
216957
|
+
const oneAppMarked = existsSync94(join98(oneAppEvidence, "manifest.json")) || existsSync94(oneAppCoverage);
|
|
216819
216958
|
let oneAppCoverageCount = 0;
|
|
216820
216959
|
let oneAppCoverageReady = false;
|
|
216821
216960
|
let oneAppNativeProof;
|
|
@@ -217504,12 +217643,12 @@ async function packCommand(ctx) {
|
|
|
217504
217643
|
// src/commands/import.ts
|
|
217505
217644
|
init_define_HHP_CATALOG();
|
|
217506
217645
|
init_cli_shared();
|
|
217507
|
-
import { existsSync as
|
|
217646
|
+
import { existsSync as existsSync95, readdirSync as readdirSync41, statSync as statSync26 } from "node:fs";
|
|
217508
217647
|
import { resolve as resolve73 } from "node:path";
|
|
217509
217648
|
function restoreDestinationIssue(dest, force) {
|
|
217510
217649
|
const link = symlinkDestinationIssue(dest);
|
|
217511
217650
|
if (link) return link;
|
|
217512
|
-
if (!
|
|
217651
|
+
if (!existsSync95(dest)) return null;
|
|
217513
217652
|
if (!statSync26(dest).isDirectory()) {
|
|
217514
217653
|
return { error: `${dest} exists and is not a directory`, hint: "pass --out/--name to land somewhere else, or remove the file" };
|
|
217515
217654
|
}
|
|
@@ -217634,7 +217773,7 @@ async function importCommand(ctx) {
|
|
|
217634
217773
|
// src/commands/share.ts
|
|
217635
217774
|
init_define_HHP_CATALOG();
|
|
217636
217775
|
init_app_link();
|
|
217637
|
-
import { readFileSync as
|
|
217776
|
+
import { readFileSync as readFileSync106 } from "node:fs";
|
|
217638
217777
|
import { resolve as resolve74 } from "node:path";
|
|
217639
217778
|
|
|
217640
217779
|
// ../../core/admin-web/src/utils/qr-terminal.ts
|
|
@@ -217700,7 +217839,7 @@ async function shareCommand(ctx) {
|
|
|
217700
217839
|
}));
|
|
217701
217840
|
return 1;
|
|
217702
217841
|
}
|
|
217703
|
-
const archive =
|
|
217842
|
+
const archive = readFileSync106(resolve74(file2));
|
|
217704
217843
|
const result = await client2().createPackageShare({
|
|
217705
217844
|
app: opened.header.app,
|
|
217706
217845
|
releaseId: opened.header.releaseId,
|
|
@@ -217728,7 +217867,7 @@ async function shareCommand(ctx) {
|
|
|
217728
217867
|
|
|
217729
217868
|
// src/commands/run.ts
|
|
217730
217869
|
init_define_HHP_CATALOG();
|
|
217731
|
-
import { mkdtempSync as mkdtempSync9, readFileSync as
|
|
217870
|
+
import { mkdtempSync as mkdtempSync9, readFileSync as readFileSync110, rmSync as rmSync29, renameSync as renameSync15, cpSync as cpSync3 } from "node:fs";
|
|
217732
217871
|
import { tmpdir as tmpdir10 } from "node:os";
|
|
217733
217872
|
import { join as join102 } from "node:path";
|
|
217734
217873
|
init_cli_shared();
|
|
@@ -217912,7 +218051,7 @@ async function runPackageCommand(ctx) {
|
|
|
217912
218051
|
if (watchKit && bus) {
|
|
217913
218052
|
const { buildContentBundles: buildContentBundles2, buildReleaseFromContent: buildReleaseFromContent2, bundleOutDir: bundleOutDir2 } = await loadAuthoring();
|
|
217914
218053
|
const live3 = join102(running.releaseRoot, running.app);
|
|
217915
|
-
const manifestOf = (tree) => JSON.parse(
|
|
218054
|
+
const manifestOf = (tree) => JSON.parse(readFileSync110(join102(tree, "release-manifest.json"), "utf8"));
|
|
217916
218055
|
let current = manifestOf(live3);
|
|
217917
218056
|
const failed3 = async (message2) => {
|
|
217918
218057
|
if (stopping) return;
|
|
@@ -218153,7 +218292,7 @@ init_define_HHP_CATALOG();
|
|
|
218153
218292
|
init_preview_surfaces();
|
|
218154
218293
|
init_surface_lint();
|
|
218155
218294
|
init_cli_shared();
|
|
218156
|
-
import { readFileSync as
|
|
218295
|
+
import { readFileSync as readFileSync111, readdirSync as readdirSync42 } from "node:fs";
|
|
218157
218296
|
import { join as join103 } from "node:path";
|
|
218158
218297
|
var PRODUCED_HINTS = {
|
|
218159
218298
|
"not-measured": "widget production was not measured \u2014 `--measure-widgets` evaluates this package's built bundles (it RUNS their code), or ask a running app: GET /v1/widgets. `himi validate --strict` fails a package whose declared widget does not produce.",
|
|
@@ -218186,7 +218325,7 @@ async function producedWidgetFamilies(dir) {
|
|
|
218186
218325
|
let js2;
|
|
218187
218326
|
for (const candidate of [`${name}.bundle.js`, `${name}.js`, name]) {
|
|
218188
218327
|
try {
|
|
218189
|
-
js2 =
|
|
218328
|
+
js2 = readFileSync111(join103(outDir, candidate), "utf8");
|
|
218190
218329
|
break;
|
|
218191
218330
|
} catch {
|
|
218192
218331
|
}
|
|
@@ -218717,7 +218856,7 @@ async function promoteCommand2(ctx) {
|
|
|
218717
218856
|
init_define_HHP_CATALOG();
|
|
218718
218857
|
init_lint_report();
|
|
218719
218858
|
init_cli_shared();
|
|
218720
|
-
import { readFileSync as
|
|
218859
|
+
import { readFileSync as readFileSync112, existsSync as existsSync99 } from "node:fs";
|
|
218721
218860
|
import { createHash as createHash43 } from "node:crypto";
|
|
218722
218861
|
var PATCH_HELP = `himi patch \u2014 change ONE item of a published app, from a raw file, on a machine
|
|
218723
218862
|
that does not have the content package.
|
|
@@ -218796,7 +218935,7 @@ async function patchCommand(ctx) {
|
|
|
218796
218935
|
io2.error(JSON.stringify({ error: `patch ${kind} needs --file`, usage: PATCH_USAGE }));
|
|
218797
218936
|
return 2;
|
|
218798
218937
|
}
|
|
218799
|
-
if (!
|
|
218938
|
+
if (!existsSync99(file2)) {
|
|
218800
218939
|
io2.error(JSON.stringify({ error: `no such file: ${file2}` }));
|
|
218801
218940
|
return 2;
|
|
218802
218941
|
}
|
|
@@ -218852,7 +218991,7 @@ async function patchCommand(ctx) {
|
|
|
218852
218991
|
lintNote: "`himi patch` sends a raw file. Nothing here built or linted your app \u2014 `himi push --only <selector>` is the same edit with the full lint gate in front of it."
|
|
218853
218992
|
};
|
|
218854
218993
|
if (kind === "tokens" || kind === "app-config") {
|
|
218855
|
-
const body =
|
|
218994
|
+
const body = readFileSync112(file2, "utf8");
|
|
218856
218995
|
const patch2 = kind === "tokens" ? { tokens: body } : { appConfig: body };
|
|
218857
218996
|
return runReleasePatch({
|
|
218858
218997
|
...common2,
|
|
@@ -218867,7 +219006,7 @@ async function patchCommand(ctx) {
|
|
|
218867
219006
|
io2.error(JSON.stringify({ error: "patch screen needs a <screenId>", usage: PATCH_USAGE }));
|
|
218868
219007
|
return 2;
|
|
218869
219008
|
}
|
|
218870
|
-
const descriptor =
|
|
219009
|
+
const descriptor = readFileSync112(file2, "utf8");
|
|
218871
219010
|
let parsed;
|
|
218872
219011
|
try {
|
|
218873
219012
|
parsed = JSON.parse(descriptor);
|
|
@@ -218924,7 +219063,7 @@ async function patchCommand(ctx) {
|
|
|
218924
219063
|
extra: { kind, screen: id, file: { path: file2, bytes: Buffer.byteLength(descriptor, "utf8") } }
|
|
218925
219064
|
});
|
|
218926
219065
|
}
|
|
218927
|
-
const bytes2 =
|
|
219066
|
+
const bytes2 = readFileSync112(file2);
|
|
218928
219067
|
const sha3 = createHash43("sha256").update(bytes2).digest("hex");
|
|
218929
219068
|
const forScreens = (str3(flags["for-screen"]) ?? "").split(",").map((s2) => s2.trim()).filter(Boolean);
|
|
218930
219069
|
if (flags["no-rebind"] !== void 0 && flags["no-rebind"] !== true) {
|
|
@@ -219011,7 +219150,7 @@ async function patchCommand(ctx) {
|
|
|
219011
219150
|
// src/commands/flags.ts
|
|
219012
219151
|
init_define_HHP_CATALOG();
|
|
219013
219152
|
init_cli_shared();
|
|
219014
|
-
import { readFileSync as
|
|
219153
|
+
import { readFileSync as readFileSync113 } from "node:fs";
|
|
219015
219154
|
var GIT_FLAG_STORE_NOTE = "the plane accepted the write but is not serving it. Operational flags live in the app's git-committed flags.json (RFC 0013), so a control plane with no checkout \u2014 a hosted pod \u2014 writes to a filesystem that is not read back and is lost on restart. Commit the change to the app's flags.json, or point this command at a control plane that has the repo.";
|
|
219016
219155
|
function servesAll(served, asked) {
|
|
219017
219156
|
const stable = (v2) => JSON.stringify(v2, (_k, x2) => x2 && typeof x2 === "object" && !Array.isArray(x2) ? Object.fromEntries(Object.entries(x2).sort(([a2], [b2]) => a2.localeCompare(b2))) : x2);
|
|
@@ -219074,7 +219213,7 @@ async function flagsCommand(ctx) {
|
|
|
219074
219213
|
}
|
|
219075
219214
|
let def;
|
|
219076
219215
|
try {
|
|
219077
|
-
const parsed = JSON.parse(arg.startsWith("@") ?
|
|
219216
|
+
const parsed = JSON.parse(arg.startsWith("@") ? readFileSync113(arg.slice(1), "utf8") : arg);
|
|
219078
219217
|
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
219079
219218
|
io2.error(JSON.stringify({ error: "invalid_definition", problems: [`--definition must be a JSON object, got ${Array.isArray(parsed) ? "an array" : parsed === null ? "null" : typeof parsed}`] }));
|
|
219080
219219
|
return 2;
|
|
@@ -219366,7 +219505,7 @@ async function testflightCommand(ctx) {
|
|
|
219366
219505
|
|
|
219367
219506
|
// src/commands/dist.ts
|
|
219368
219507
|
init_define_HHP_CATALOG();
|
|
219369
|
-
import { existsSync as
|
|
219508
|
+
import { existsSync as existsSync105, readFileSync as readFileSync123 } from "node:fs";
|
|
219370
219509
|
import { join as join110 } from "node:path";
|
|
219371
219510
|
init_wix_owner();
|
|
219372
219511
|
init_cli_shared();
|
|
@@ -219406,7 +219545,7 @@ async function distCommand(ctx) {
|
|
|
219406
219545
|
const rememberLastDist = async (jobs2) => {
|
|
219407
219546
|
try {
|
|
219408
219547
|
const dir = contentDir(flags);
|
|
219409
|
-
if (!
|
|
219548
|
+
if (!existsSync105(join110(dir, "himalaya.content.json"))) return;
|
|
219410
219549
|
const { lastDistFromJob: lastDistFromJob2, writeLastDist: writeLastDist2 } = await Promise.resolve().then(() => (init_capabilities(), capabilities_exports));
|
|
219411
219550
|
const own6 = await appId(dir);
|
|
219412
219551
|
for (const job of jobs2) {
|
|
@@ -219684,7 +219823,7 @@ ${label3}`);
|
|
|
219684
219823
|
}
|
|
219685
219824
|
{
|
|
219686
219825
|
const distDir = contentDir(flags);
|
|
219687
|
-
if (str3(flags["app-icon-url"]) === void 0 &&
|
|
219826
|
+
if (str3(flags["app-icon-url"]) === void 0 && existsSync105(join110(distDir, "himalaya.content.json"))) {
|
|
219688
219827
|
const issues = await iconIssues(distDir, flags.strict === true, { requireDeclared: true, requireVerified: true });
|
|
219689
219828
|
const errors = issues.filter((i2) => i2.severity === "error");
|
|
219690
219829
|
for (const i2 of issues.filter((i3) => i3.severity === "warning")) {
|
|
@@ -219705,7 +219844,7 @@ ${label3}`);
|
|
|
219705
219844
|
const googleServicesPath = str3(flags["google-services"]);
|
|
219706
219845
|
if (googleServicesPath) {
|
|
219707
219846
|
try {
|
|
219708
|
-
googleServicesJson =
|
|
219847
|
+
googleServicesJson = readFileSync123(googleServicesPath, "utf8");
|
|
219709
219848
|
} catch {
|
|
219710
219849
|
print({
|
|
219711
219850
|
ok: false,
|
|
@@ -219896,7 +220035,7 @@ ${label3}`);
|
|
|
219896
220035
|
// src/commands/login.ts
|
|
219897
220036
|
init_define_HHP_CATALOG();
|
|
219898
220037
|
init_config();
|
|
219899
|
-
import { readFileSync as
|
|
220038
|
+
import { readFileSync as readFileSync124 } from "node:fs";
|
|
219900
220039
|
init_browser_login();
|
|
219901
220040
|
init_wix_owner();
|
|
219902
220041
|
init_owner_claim();
|
|
@@ -220106,7 +220245,7 @@ async function loginCommand(ctx) {
|
|
|
220106
220245
|
if (flags["wix-token-stdin"]) {
|
|
220107
220246
|
let piped = "";
|
|
220108
220247
|
try {
|
|
220109
|
-
piped = (ctx.deps.readStdin ?? (() =>
|
|
220248
|
+
piped = (ctx.deps.readStdin ?? (() => readFileSync124(0, "utf8")))().trim();
|
|
220110
220249
|
} catch {
|
|
220111
220250
|
}
|
|
220112
220251
|
if (!piped) {
|
|
@@ -220266,7 +220405,7 @@ async function loginCommand(ctx) {
|
|
|
220266
220405
|
const dpxPath = dpxSessionTokenPath();
|
|
220267
220406
|
let dpx;
|
|
220268
220407
|
try {
|
|
220269
|
-
dpx =
|
|
220408
|
+
dpx = readFileSync124(dpxPath, "utf8").trim();
|
|
220270
220409
|
} catch {
|
|
220271
220410
|
io2.error(JSON.stringify({ error: `no dpx session at ${dpxPath} \u2014 run \`dpx auth login\` then \`dpx auth token > ${dpxPath}\` (dpx 2.x keeps its own state in ~/.dpx/auth.json and does NOT write the legacy session file), or omit --dpx` }));
|
|
220272
220411
|
return 1;
|
|
@@ -220741,7 +220880,7 @@ function loginModeMark(m2) {
|
|
|
220741
220880
|
return /NOT checked/.test(m2.detail) ? "unchecked" : "yes";
|
|
220742
220881
|
}
|
|
220743
220882
|
function buildDoctorReport(input) {
|
|
220744
|
-
const { target, version: version5, data, serve, auth, loginModes, dpxStatus, versions } = input;
|
|
220883
|
+
const { target, version: version5, data, serve, auth, loginModes, dpxStatus, versions, browser } = input;
|
|
220745
220884
|
const serveCode = serve.reachable ? void 0 : target === "local" ? "no_local_serve" : "needs_vpn";
|
|
220746
220885
|
const sdkSkew = versions?.sdk.status === "outdated" && versions?.sdk.source !== "bundled";
|
|
220747
220886
|
const versionSkew = versions?.cli.status === "outdated" || sdkSkew;
|
|
@@ -220770,6 +220909,7 @@ function buildDoctorReport(input) {
|
|
|
220770
220909
|
} : {}
|
|
220771
220910
|
},
|
|
220772
220911
|
...versions ? { versions } : {},
|
|
220912
|
+
...browser ? { browser } : {},
|
|
220773
220913
|
...versionSkew ? { hint: "version skew detected \u2014 upgrade before diagnosing authoring or template failures" } : !serve.reachable ? { hint: serveUnreachableHint(target) } : !data.reachable ? { hint: "Data plane unreachable \u2014 check basic connectivity." } : hostRefused ? { hint: auth.controlTokenHint ?? "refusing to send a Wix credential to this control host" } : staleToken ? { hint: auth.controlTokenHint ?? STALE_TOKEN_HINT } : {}
|
|
220774
220914
|
};
|
|
220775
220915
|
}
|
|
@@ -220800,6 +220940,9 @@ async function doctorCommand(ctx) {
|
|
|
220800
220940
|
probeReachable(serveUrl, { timeoutMs }),
|
|
220801
220941
|
flags["skip-version-check"] === true ? Promise.resolve(void 0) : doctorVersionReport(cliVersion())
|
|
220802
220942
|
]);
|
|
220943
|
+
const { browserReadiness: browserReadiness2, installChromium: installChromium2 } = await Promise.resolve().then(() => (init_playwright_install(), playwright_install_exports));
|
|
220944
|
+
const browserInstall = flags["install-browser"] === true ? installChromium2() : void 0;
|
|
220945
|
+
const browser = browserReadiness2();
|
|
220803
220946
|
const dpxPath = dpxSessionTokenPath();
|
|
220804
220947
|
const tokenHealth = inspectControlToken(resolved2?.controlToken);
|
|
220805
220948
|
let controlHostRefused = false;
|
|
@@ -220837,7 +220980,9 @@ async function doctorCommand(ctx) {
|
|
|
220837
220980
|
// advertisable for the target this report is about.
|
|
220838
220981
|
hasOwnerIssuer: (resolved2?.ownerIssue ?? "") !== ""
|
|
220839
220982
|
});
|
|
220840
|
-
const report7 = buildDoctorReport({ target, version: cliVersion(), data, serve, auth, loginModes, dpxStatus, versions });
|
|
220983
|
+
const report7 = buildDoctorReport({ target, version: cliVersion(), data, serve, auth, loginModes, dpxStatus, versions, browser });
|
|
220984
|
+
if (browserInstall) report7.browserInstall = browserInstall;
|
|
220985
|
+
const exit = browserInstall && !browser.ready ? 1 : 0;
|
|
220841
220986
|
const { referenceCache: doctorReferenceCache } = await Promise.resolve().then(() => (init_guides(), guides_exports));
|
|
220842
220987
|
report7.kit = doctorReferenceCache().status();
|
|
220843
220988
|
if (targetError) report7.targetError = targetError;
|
|
@@ -220846,7 +220991,7 @@ async function doctorCommand(ctx) {
|
|
|
220846
220991
|
if (agentContext) report7.agentContext = agentContext;
|
|
220847
220992
|
if (flags.json === true) {
|
|
220848
220993
|
print(report7);
|
|
220849
|
-
return
|
|
220994
|
+
return exit;
|
|
220850
220995
|
}
|
|
220851
220996
|
const mark = (r3) => r3.reachable ? `reachable${r3.status ? ` [${r3.status}]` : ""}` : `UNREACHABLE${r3.error ? ` (${r3.error})` : ""}`;
|
|
220852
220997
|
io2.log(`himi doctor \u2014 target "${target}" (himi v${cliVersion()})
|
|
@@ -220873,6 +221018,12 @@ async function doctorCommand(ctx) {
|
|
|
220873
221018
|
} else {
|
|
220874
221019
|
io2.log(" versions skipped (--skip-version-check)");
|
|
220875
221020
|
}
|
|
221021
|
+
io2.log(` browser playwright ${browser.playwright.installed ? browser.playwright.version ?? "installed" : "MISSING"} chromium: ${browser.chromium.installed ? "installed" : "MISSING"}`);
|
|
221022
|
+
if (browserInstall && !browserInstall.ok) io2.log(` --install-browser failed: ${browserInstall.detail ?? "unknown error"}`);
|
|
221023
|
+
if (!browser.ready) {
|
|
221024
|
+
io2.log(" needed by `himi site analyze`, `render --png` and the screenshot paths \u2014 run:");
|
|
221025
|
+
for (const step of browser.fixSteps ?? [browser.fix]) io2.log(` ${step}`);
|
|
221026
|
+
}
|
|
220876
221027
|
io2.log(` authoring kit ${JSON.stringify(doctorReferenceCache().status())}`);
|
|
220877
221028
|
if (agentContext) {
|
|
220878
221029
|
io2.log(` agent files ${agentContext.status === "current" ? `current (himi v${agentContext.written})` : agentContext.status === "absent" ? "none \u2014 `himi agent-init` adds them" : agentContext.status === "damaged" ? `DAMAGED \u2014 ${agentContext.fix}` : agentContext.status === "incomplete" ? `INCOMPLETE \u2014 missing ${(agentContext.missing ?? []).join(", ")}; ${agentContext.fix}` : `written by himi v${agentContext.written} \u2014 run \`himi agent-init\` to refresh`}`);
|
|
@@ -220881,14 +221032,14 @@ async function doctorCommand(ctx) {
|
|
|
220881
221032
|
`
|
|
220882
221033
|
${report7.ok ? "OK \u2014 data + serve plane reachable." : typeof report7.hint === "string" && report7.hint ? report7.hint : serve.reachable ? "Data plane unreachable \u2014 check basic connectivity." : serveUnreachableHint(target)}`
|
|
220883
221034
|
);
|
|
220884
|
-
return
|
|
221035
|
+
return exit;
|
|
220885
221036
|
}
|
|
220886
221037
|
|
|
220887
221038
|
// src/commands/guide.ts
|
|
220888
221039
|
init_define_HHP_CATALOG();
|
|
220889
221040
|
init_guides();
|
|
220890
221041
|
init_cli_shared();
|
|
220891
|
-
import { existsSync as
|
|
221042
|
+
import { existsSync as existsSync106 } from "node:fs";
|
|
220892
221043
|
import { join as join112, resolve as resolve78 } from "node:path";
|
|
220893
221044
|
async function runGuideCommand(command, pos, flags, io2, print) {
|
|
220894
221045
|
const { referenceCache: referenceCache2, referenceIdentity: referenceIdentity2 } = await Promise.resolve().then(() => (init_guides(), guides_exports));
|
|
@@ -221150,7 +221301,7 @@ Seed your coding agent with \`himi agent-init\`. Guides: ${idx.portalUrl}`);
|
|
|
221150
221301
|
...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/" } : {},
|
|
221151
221302
|
// In a git repo the refresh moves the diff identity an earlier `himi test` attested (that
|
|
221152
221303
|
// hash is shared with the repo gates and deliberately exempts nothing but its own metadata).
|
|
221153
|
-
...
|
|
221304
|
+
...existsSync106(join112(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" } : {},
|
|
221154
221305
|
...res.skipped.length ? { skipped: res.skipped } : {},
|
|
221155
221306
|
portalUrl: idx.portalUrl
|
|
221156
221307
|
});
|
|
@@ -221180,7 +221331,7 @@ async function guideCommand(ctx) {
|
|
|
221180
221331
|
|
|
221181
221332
|
// src/commands/secrets.ts
|
|
221182
221333
|
init_define_HHP_CATALOG();
|
|
221183
|
-
import { readFileSync as
|
|
221334
|
+
import { readFileSync as readFileSync126 } from "node:fs";
|
|
221184
221335
|
init_cli_shared();
|
|
221185
221336
|
async function secretsCommand(ctx) {
|
|
221186
221337
|
const { io: io2, pos, flags } = ctx;
|
|
@@ -221201,7 +221352,7 @@ async function secretsCommand(ctx) {
|
|
|
221201
221352
|
const path2 = dpxSessionTokenPath();
|
|
221202
221353
|
let raw;
|
|
221203
221354
|
try {
|
|
221204
|
-
raw =
|
|
221355
|
+
raw = readFileSync126(path2, "utf8");
|
|
221205
221356
|
} catch {
|
|
221206
221357
|
io2.error(JSON.stringify({ error: `no DPX BO session at ${path2}` }));
|
|
221207
221358
|
return 1;
|
|
@@ -221224,7 +221375,7 @@ init_schema2();
|
|
|
221224
221375
|
init_define_HHP_CATALOG();
|
|
221225
221376
|
init_cms_schema();
|
|
221226
221377
|
init_wix_owner();
|
|
221227
|
-
import { existsSync as
|
|
221378
|
+
import { existsSync as existsSync107, readFileSync as readFileSync127, writeFileSync as writeFileSync43 } from "node:fs";
|
|
221228
221379
|
import { join as join113 } from "node:path";
|
|
221229
221380
|
var FOREIGN_DETAIL_LIMIT = 25;
|
|
221230
221381
|
var MAX_COLLECTION_PAGES = 40;
|
|
@@ -221746,10 +221897,10 @@ async function seedCms(opts) {
|
|
|
221746
221897
|
}
|
|
221747
221898
|
function readSeedFile(dir) {
|
|
221748
221899
|
const file2 = join113(dir, "cms-seed.json");
|
|
221749
|
-
if (!
|
|
221900
|
+
if (!existsSync107(file2)) return {};
|
|
221750
221901
|
let parsed;
|
|
221751
221902
|
try {
|
|
221752
|
-
parsed = JSON.parse(
|
|
221903
|
+
parsed = JSON.parse(readFileSync127(file2, "utf8"));
|
|
221753
221904
|
} catch (e2) {
|
|
221754
221905
|
throw new Error(`cms-seed.json is not valid JSON (${e2.message}). Fix or delete it.`);
|
|
221755
221906
|
}
|
|
@@ -221808,10 +221959,10 @@ async function writeSeedRows(opts) {
|
|
|
221808
221959
|
};
|
|
221809
221960
|
}
|
|
221810
221961
|
let existing = {};
|
|
221811
|
-
if (
|
|
221962
|
+
if (existsSync107(file2)) {
|
|
221812
221963
|
let parsed;
|
|
221813
221964
|
try {
|
|
221814
|
-
parsed = JSON.parse(
|
|
221965
|
+
parsed = JSON.parse(readFileSync127(file2, "utf8"));
|
|
221815
221966
|
} catch (e2) {
|
|
221816
221967
|
throw new Error(
|
|
221817
221968
|
`cms-seed.json is not valid JSON (${e2.message}). Refusing to regenerate, because overwriting it would discard the rows already in it. Fix the JSON, or delete the file if you want a fresh set.`
|
|
@@ -222135,12 +222286,12 @@ import { randomBytes as randomBytes9 } from "node:crypto";
|
|
|
222135
222286
|
import {
|
|
222136
222287
|
closeSync as closeSync8,
|
|
222137
222288
|
constants as constants8,
|
|
222138
|
-
existsSync as
|
|
222289
|
+
existsSync as existsSync109,
|
|
222139
222290
|
fstatSync as fstatSync2,
|
|
222140
222291
|
lstatSync as lstatSync27,
|
|
222141
222292
|
mkdirSync as mkdirSync47,
|
|
222142
222293
|
openSync as openSync7,
|
|
222143
|
-
readFileSync as
|
|
222294
|
+
readFileSync as readFileSync130,
|
|
222144
222295
|
readdirSync as readdirSync45,
|
|
222145
222296
|
realpathSync as realpathSync16,
|
|
222146
222297
|
renameSync as renameSync17,
|
|
@@ -222161,7 +222312,7 @@ function readRegularFile(path2) {
|
|
|
222161
222312
|
const fd = openSync7(path2, constants8.O_RDONLY | (constants8.O_NOFOLLOW ?? 0));
|
|
222162
222313
|
try {
|
|
222163
222314
|
if (!fstatSync2(fd).isFile()) throw new Error(`${path2} is not a regular file`);
|
|
222164
|
-
return
|
|
222315
|
+
return readFileSync130(fd);
|
|
222165
222316
|
} finally {
|
|
222166
222317
|
closeSync8(fd);
|
|
222167
222318
|
}
|
|
@@ -222222,7 +222373,7 @@ async function l10nCommand(ctx) {
|
|
|
222222
222373
|
return fail7("app_not_found", { error: `--app ${slug}: an app slug, not a path`, hint: "pass --content <app dir> to target a directory" }, 2);
|
|
222223
222374
|
}
|
|
222224
222375
|
const dir = resolve82("apps", slug);
|
|
222225
|
-
if (!
|
|
222376
|
+
if (!existsSync109(join117(dir, "config.ts")) && !existsSync109(join117(dir, "config.js")) && !existsSync109(join117(dir, "config.mjs"))) {
|
|
222226
222377
|
return fail7("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);
|
|
222227
222378
|
}
|
|
222228
222379
|
appDir3 = dir;
|
|
@@ -222231,7 +222382,7 @@ async function l10nCommand(ctx) {
|
|
|
222231
222382
|
return fail7("invalid_usage", { error: "name the app: --app <slug> (in a checkout) or --content <app dir>" }, 2);
|
|
222232
222383
|
}
|
|
222233
222384
|
const messagesDir = resolve82(dirArg);
|
|
222234
|
-
if (!
|
|
222385
|
+
if (!existsSync109(messagesDir) || !statSync31(messagesDir).isDirectory()) {
|
|
222235
222386
|
return fail7("messages_dir_not_found", { error: `${dirArg} is not a directory`, dir: messagesDir }, 1);
|
|
222236
222387
|
}
|
|
222237
222388
|
const fileByTag = /* @__PURE__ */ new Map();
|
|
@@ -222312,7 +222463,7 @@ async function l10nCommand(ctx) {
|
|
|
222312
222463
|
}
|
|
222313
222464
|
for (const tag of requested) {
|
|
222314
222465
|
const path2 = join117(appDir3, "l10n", `${tag}.json`);
|
|
222315
|
-
if (!
|
|
222466
|
+
if (!existsSync109(path2)) continue;
|
|
222316
222467
|
try {
|
|
222317
222468
|
const parsed = JSON.parse(readRegularFile(path2).toString("utf8"));
|
|
222318
222469
|
if (!parsed || typeof parsed !== "object" || !parsed.messages || typeof parsed.messages !== "object") throw new Error("no messages object");
|
|
@@ -222428,7 +222579,7 @@ async function l10nCommand(ctx) {
|
|
|
222428
222579
|
// src/commands/base44.ts
|
|
222429
222580
|
init_define_HHP_CATALOG();
|
|
222430
222581
|
init_cli_shared();
|
|
222431
|
-
import { existsSync as
|
|
222582
|
+
import { existsSync as existsSync117 } from "node:fs";
|
|
222432
222583
|
import { join as join126, resolve as resolve86 } from "node:path";
|
|
222433
222584
|
async function base44Command(ctx) {
|
|
222434
222585
|
const { io: io2, pos, flags, print } = ctx;
|
|
@@ -222500,7 +222651,7 @@ async function base44Command(ctx) {
|
|
|
222500
222651
|
return 1;
|
|
222501
222652
|
};
|
|
222502
222653
|
const gen = await Promise.resolve().then(() => (init_generate(), generate_exports));
|
|
222503
|
-
const missing3 = gen.ENGINE_FILES.filter((f2) => !
|
|
222654
|
+
const missing3 = gen.ENGINE_FILES.filter((f2) => !existsSync117(join126(dir, f2)));
|
|
222504
222655
|
if (missing3.length) {
|
|
222505
222656
|
return fail7("content_dir_not_base44_starter", `${dir} is not a base44-starter content package: the generated screens import a shared engine it does not have (${missing3.join(", ")})`, { missing: missing3, hint: "scaffold one with `himi init <name> --template base44-starter --base44-app-id <id>`" });
|
|
222506
222657
|
}
|
|
@@ -222586,7 +222737,7 @@ async function base44Command(ctx) {
|
|
|
222586
222737
|
if (!provisioning || str3(flags.content) !== void 0 || !slug) return contentDir(flags);
|
|
222587
222738
|
if (!/^[a-z0-9][a-z0-9-]*$/.test(slug)) return void 0;
|
|
222588
222739
|
const dir = resolve86("apps", slug);
|
|
222589
|
-
return
|
|
222740
|
+
return existsSync117(join126(dir, "config.ts")) || existsSync117(join126(dir, "config.mjs")) ? dir : void 0;
|
|
222590
222741
|
};
|
|
222591
222742
|
if (sub === "entities" || sub === "functions") {
|
|
222592
222743
|
if (sub === "entities" && !["query", "create", "seed"].includes(pos[2] ?? "")) {
|
|
@@ -222937,7 +223088,7 @@ async function siteCommand(ctx) {
|
|
|
222937
223088
|
print({ ok: true, context });
|
|
222938
223089
|
return 0;
|
|
222939
223090
|
}
|
|
222940
|
-
const analyzeUsage = "himi site analyze --url https://\u2026 [--client-id <headless-oauth-client-id>] [--site <msid>] [--out .himi/business-book] [--redirect-uri <uri>] [--shell " + SHELL_ENUM + "] [--apply]";
|
|
223091
|
+
const analyzeUsage = "himi site analyze --url https://\u2026 [--client-id <headless-oauth-client-id>] [--site <msid>] [--out .himi/business-book] [--redirect-uri <uri>] [--shell " + SHELL_ENUM + "] [--apply] [--no-browser]";
|
|
222941
223092
|
if (!siteUrl) {
|
|
222942
223093
|
io2.error(JSON.stringify({ error: "himi site analyze needs --url", usage: analyzeUsage }));
|
|
222943
223094
|
return 2;
|
|
@@ -222952,6 +223103,17 @@ async function siteCommand(ctx) {
|
|
|
222952
223103
|
}));
|
|
222953
223104
|
return 2;
|
|
222954
223105
|
}
|
|
223106
|
+
if (flags["no-browser"] !== true) {
|
|
223107
|
+
const { siteUrlRefusal: siteUrlRefusal2 } = await Promise.resolve().then(() => (init_net_guard(), net_guard_exports));
|
|
223108
|
+
if (!siteUrlRefusal2(siteUrl)) {
|
|
223109
|
+
const { browserReadiness: browserReadiness2, browserUnavailableRefusal: browserUnavailableRefusal2 } = await Promise.resolve().then(() => (init_playwright_install(), playwright_install_exports));
|
|
223110
|
+
const browser = browserReadiness2();
|
|
223111
|
+
if (!browser.ready) {
|
|
223112
|
+
io2.error(JSON.stringify(browserUnavailableRefusal2(browser, "himi site analyze")));
|
|
223113
|
+
return 2;
|
|
223114
|
+
}
|
|
223115
|
+
}
|
|
223116
|
+
}
|
|
222955
223117
|
try {
|
|
222956
223118
|
const { runSiteAnalyze: runSiteAnalyze2 } = await Promise.resolve().then(() => (init_cli3(), cli_exports3));
|
|
222957
223119
|
const r3 = await runSiteAnalyze2({
|
|
@@ -222969,7 +223131,8 @@ async function siteCommand(ctx) {
|
|
|
222969
223131
|
// `oauth-app/v1`), and the shell refuses to reuse its own default once a customer
|
|
222970
223132
|
// client is in play — so it is passed in by whoever registered it.
|
|
222971
223133
|
redirectUri: redirectFlag,
|
|
222972
|
-
cwd: str3(flags.content) ?? process.cwd()
|
|
223134
|
+
cwd: str3(flags.content) ?? process.cwd(),
|
|
223135
|
+
noBrowser: flags["no-browser"] === true
|
|
222973
223136
|
});
|
|
222974
223137
|
print(r3);
|
|
222975
223138
|
return 0;
|