@wix/himalaya-cli 0.1785.0 → 0.1786.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +538 -135
- package/guides/himi-json-output.md +15 -1
- package/package.json +2 -2
package/dist/cli.mjs
CHANGED
|
@@ -663,13 +663,15 @@ __export(config_exports, {
|
|
|
663
663
|
defaultTargetsPath: () => defaultTargetsPath,
|
|
664
664
|
loadPendingDeviceLogin: () => loadPendingDeviceLogin,
|
|
665
665
|
loadSiteClient: () => loadSiteClient,
|
|
666
|
+
loadStoredLogin: () => loadStoredLogin,
|
|
666
667
|
loadTargetsFile: () => loadTargetsFile,
|
|
667
668
|
resolveTarget: () => resolveTarget,
|
|
668
669
|
resolveTargetName: () => resolveTargetName,
|
|
669
670
|
saveControlToken: () => saveControlToken,
|
|
670
671
|
savePendingDeviceLogin: () => savePendingDeviceLogin,
|
|
671
672
|
saveSiteClient: () => saveSiteClient,
|
|
672
|
-
swapPendingDeviceLogin: () => swapPendingDeviceLogin
|
|
673
|
+
swapPendingDeviceLogin: () => swapPendingDeviceLogin,
|
|
674
|
+
swapRefreshedLogin: () => swapRefreshedLogin
|
|
673
675
|
});
|
|
674
676
|
import { homedir } from "node:os";
|
|
675
677
|
import { join, dirname } from "node:path";
|
|
@@ -681,14 +683,29 @@ function loadTargetsFile(path2 = defaultTargetsPath()) {
|
|
|
681
683
|
return {};
|
|
682
684
|
}
|
|
683
685
|
}
|
|
684
|
-
function saveControlToken(target, token, path2 = defaultTargetsPath()) {
|
|
686
|
+
function saveControlToken(target, token, path2 = defaultTargetsPath(), refreshToken) {
|
|
685
687
|
const file2 = loadTargetsFile(path2);
|
|
686
688
|
file2.targets = file2.targets ?? {};
|
|
687
|
-
const { pendingDeviceLogin: _superseded, ...rest } = file2.targets[target] ?? {};
|
|
688
|
-
file2.targets[target] = { ...rest, controlToken: token };
|
|
689
|
+
const { pendingDeviceLogin: _superseded, refreshToken: _previous, ...rest } = file2.targets[target] ?? {};
|
|
690
|
+
file2.targets[target] = { ...rest, controlToken: token, ...refreshToken ? { refreshToken } : {} };
|
|
689
691
|
writeTargetsFilePrivate(path2, file2);
|
|
690
692
|
return path2;
|
|
691
693
|
}
|
|
694
|
+
function loadStoredLogin(target, path2 = defaultTargetsPath()) {
|
|
695
|
+
const t2 = loadTargetsFile(path2).targets?.[target];
|
|
696
|
+
return {
|
|
697
|
+
...typeof t2?.controlToken === "string" ? { controlToken: t2.controlToken } : {},
|
|
698
|
+
...typeof t2?.refreshToken === "string" ? { refreshToken: t2.refreshToken } : {}
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
function swapRefreshedLogin(target, spent, next, path2 = defaultTargetsPath()) {
|
|
702
|
+
const file2 = loadTargetsFile(path2);
|
|
703
|
+
const t2 = file2.targets?.[target];
|
|
704
|
+
if (!t2 || t2.refreshToken !== spent) return false;
|
|
705
|
+
file2.targets[target] = { ...t2, controlToken: next.controlToken, refreshToken: next.refreshToken };
|
|
706
|
+
writeTargetsFilePrivate(path2, file2);
|
|
707
|
+
return true;
|
|
708
|
+
}
|
|
692
709
|
function saveSiteClient(target, msid, client4, path2 = defaultTargetsPath()) {
|
|
693
710
|
const file2 = loadTargetsFile(path2);
|
|
694
711
|
file2.targets = file2.targets ?? {};
|
|
@@ -752,9 +769,10 @@ function writeTargetsFilePrivate(path2, file2) {
|
|
|
752
769
|
function clearControlToken(target, path2 = defaultTargetsPath()) {
|
|
753
770
|
const file2 = loadTargetsFile(path2);
|
|
754
771
|
const t2 = file2.targets?.[target];
|
|
755
|
-
if (t2?.controlToken || t2?.pendingDeviceLogin) {
|
|
772
|
+
if (t2?.controlToken || t2?.pendingDeviceLogin || t2?.refreshToken) {
|
|
756
773
|
delete t2.controlToken;
|
|
757
774
|
delete t2.pendingDeviceLogin;
|
|
775
|
+
delete t2.refreshToken;
|
|
758
776
|
writeFileSync(path2, JSON.stringify(file2, null, 2) + "\n");
|
|
759
777
|
}
|
|
760
778
|
return path2;
|
|
@@ -1740,6 +1758,39 @@ var init_compiler_options = __esm({
|
|
|
1740
1758
|
});
|
|
1741
1759
|
|
|
1742
1760
|
// src/scaffold.ts
|
|
1761
|
+
var scaffold_exports = {};
|
|
1762
|
+
__export(scaffold_exports, {
|
|
1763
|
+
BASE44_APP_ID_PLACEHOLDER: () => BASE44_APP_ID_PLACEHOLDER,
|
|
1764
|
+
BASE44_APP_ID_RE: () => BASE44_APP_ID_RE,
|
|
1765
|
+
IDENTITY_SENTINELS: () => IDENTITY_SENTINELS,
|
|
1766
|
+
TEMPLATE_META_FILE: () => TEMPLATE_META_FILE,
|
|
1767
|
+
applyBase44AppId: () => applyBase44AppId,
|
|
1768
|
+
availableTemplates: () => availableTemplates,
|
|
1769
|
+
base44TenantUrl: () => base44TenantUrl,
|
|
1770
|
+
canonicalCatalogFiles: () => canonicalCatalogFiles,
|
|
1771
|
+
defaultWorkerTsconfig: () => defaultWorkerTsconfig,
|
|
1772
|
+
ensureCheckoutTemplates: () => ensureCheckoutTemplates,
|
|
1773
|
+
ensurePackageGitignore: () => ensurePackageGitignore,
|
|
1774
|
+
ensureTemplatesFor: () => ensureTemplatesFor,
|
|
1775
|
+
extractTemplateAppearance: () => extractTemplateAppearance,
|
|
1776
|
+
finishScaffold: () => finishScaffold,
|
|
1777
|
+
isBinaryTemplateFile: () => isBinaryTemplateFile,
|
|
1778
|
+
isTemplateSourceTree: () => isTemplateSourceTree,
|
|
1779
|
+
keptPlanNote: () => keptPlanNote,
|
|
1780
|
+
materializeSource: () => materializeSource,
|
|
1781
|
+
offRepoImports: () => offRepoImports,
|
|
1782
|
+
readTemplateFiles: () => readTemplateFiles,
|
|
1783
|
+
resetCheckoutTemplatesEnsured: () => resetCheckoutTemplatesEnsured,
|
|
1784
|
+
scaffoldContentPackage: () => scaffoldContentPackage,
|
|
1785
|
+
sentineledFiles: () => sentineledFiles,
|
|
1786
|
+
sentinelizeArchive: () => sentinelizeArchive,
|
|
1787
|
+
sentinelizeIdentity: () => sentinelizeIdentity,
|
|
1788
|
+
sentinelizeScheme: () => sentinelizeScheme,
|
|
1789
|
+
substituteIdentity: () => substituteIdentity,
|
|
1790
|
+
templateIconPath: () => templateIconPath,
|
|
1791
|
+
templateSourceDir: () => templateSourceDir,
|
|
1792
|
+
templateTakesBase44AppId: () => templateTakesBase44AppId
|
|
1793
|
+
});
|
|
1743
1794
|
import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync2, existsSync, readdirSync, readFileSync as readFileSync2, statSync, lstatSync, copyFileSync } from "node:fs";
|
|
1744
1795
|
import { spawnSync } from "node:child_process";
|
|
1745
1796
|
import { resolve, join as join2, dirname as dirname2, sep as sep2 } from "node:path";
|
|
@@ -1799,6 +1850,9 @@ function ensureCheckoutTemplates(run4 = spawnSync, headOf = checkoutHead) {
|
|
|
1799
1850
|
}
|
|
1800
1851
|
templatesEnsuredAt = head3;
|
|
1801
1852
|
}
|
|
1853
|
+
function resetCheckoutTemplatesEnsured() {
|
|
1854
|
+
templatesEnsuredAt = null;
|
|
1855
|
+
}
|
|
1802
1856
|
function templateTakesBase44AppId(template) {
|
|
1803
1857
|
if (!availableTemplates().includes(template)) return void 0;
|
|
1804
1858
|
const config = join2(templateSourceDir(template), "config.ts");
|
|
@@ -9175,6 +9229,7 @@ __export(owner_prefix_exports, {
|
|
|
9175
9229
|
OWNER_PREFIX_MAX: () => OWNER_PREFIX_MAX,
|
|
9176
9230
|
composeSlug: () => composeSlug,
|
|
9177
9231
|
fallbackOwnerPrefix: () => fallbackOwnerPrefix,
|
|
9232
|
+
federatedOwnerPrefix: () => federatedOwnerPrefix,
|
|
9178
9233
|
ownerPrefixFor: () => ownerPrefixFor,
|
|
9179
9234
|
sanitizeOwnerPrefix: () => sanitizeOwnerPrefix,
|
|
9180
9235
|
splitPrefixedSlug: () => splitPrefixedSlug
|
|
@@ -9189,6 +9244,13 @@ function fallbackOwnerPrefix(accountId) {
|
|
|
9189
9244
|
const n2 = BigInt("0x" + h2.subarray(0, 8).toString("hex"));
|
|
9190
9245
|
return ("u" + n2.toString(36)).slice(0, OWNER_PREFIX_MAX);
|
|
9191
9246
|
}
|
|
9247
|
+
function federatedOwnerPrefix(tag, subject) {
|
|
9248
|
+
if (!/^[a-z]$/.test(tag)) throw new Error(`federatedOwnerPrefix: tag must be one lowercase letter, got ${JSON.stringify(tag)}`);
|
|
9249
|
+
const h2 = createHash("sha256").update(`federated:${subject}`).digest();
|
|
9250
|
+
const n2 = BigInt("0x" + h2.subarray(0, 10).toString("hex"));
|
|
9251
|
+
const width = OWNER_PREFIX_MAX - 3;
|
|
9252
|
+
return `${tag}--${n2.toString(36).padStart(width, "0").slice(0, width)}`;
|
|
9253
|
+
}
|
|
9192
9254
|
function ownerPrefixFor(account2) {
|
|
9193
9255
|
return sanitizeOwnerPrefix(account2.slug) || fallbackOwnerPrefix(account2.accountId);
|
|
9194
9256
|
}
|
|
@@ -9263,7 +9325,8 @@ async function autoClaimSlug(opts) {
|
|
|
9263
9325
|
body: JSON.stringify({
|
|
9264
9326
|
slug: app2,
|
|
9265
9327
|
...opts.displayName ? { displayName: opts.displayName } : {},
|
|
9266
|
-
...opts.accountId ? { accountId: opts.accountId } : {}
|
|
9328
|
+
...opts.accountId ? { accountId: opts.accountId } : {},
|
|
9329
|
+
...opts.base44AppId ? { base44AppId: opts.base44AppId } : {}
|
|
9267
9330
|
}),
|
|
9268
9331
|
// This POSTs a live control token, and `x-control-token` is a CUSTOM header — the fetch spec
|
|
9269
9332
|
// strips only Authorization/Cookie across an origin-crossing redirect, so with the default
|
|
@@ -9402,13 +9465,52 @@ var init_owner_claim = __esm({
|
|
|
9402
9465
|
init_define_HHP_CATALOG();
|
|
9403
9466
|
init_owner_prefix();
|
|
9404
9467
|
init_credential_hosts();
|
|
9405
|
-
HARD_CLAIM_REFUSALS = /* @__PURE__ */ new Set([
|
|
9468
|
+
HARD_CLAIM_REFUSALS = /* @__PURE__ */ new Set([
|
|
9469
|
+
"slug_reserved",
|
|
9470
|
+
"invalid_slug",
|
|
9471
|
+
"account_ambiguous",
|
|
9472
|
+
"not_your_account",
|
|
9473
|
+
"claim_limit_reached",
|
|
9474
|
+
// The Base44 binding a federated claim asked for (P1b) was refused: claiming without it would
|
|
9475
|
+
// publish an app unbound from the Base44 app it was built for, so the push stops.
|
|
9476
|
+
"base44_app_not_owned",
|
|
9477
|
+
"base44_app_taken",
|
|
9478
|
+
"base44_app_requires_base44_signin",
|
|
9479
|
+
"invalid_base44_app_id"
|
|
9480
|
+
]);
|
|
9406
9481
|
AUTO_CLAIM_TIMEOUT_MS = 15e3;
|
|
9407
9482
|
OWNER_ISSUER_HINT = "this puts the machine's own Wix credential on the wire, so the owner issuer must be an https wix.com host (or loopback for local dev). Check --owner-issue-url / HIMI_OWNER_ISSUE_URL / serve-targets.json \u2014 one of them is pointing somewhere else.";
|
|
9408
9483
|
OWNER_APPS_TIMEOUT_MS = 15e3;
|
|
9409
9484
|
}
|
|
9410
9485
|
});
|
|
9411
9486
|
|
|
9487
|
+
// ../../core/serve-control/src/identity-providers/index.ts
|
|
9488
|
+
function federatedSubject(providerId, localId) {
|
|
9489
|
+
if (!PROVIDER_ID_RE.test(providerId) || RESERVED_IDS.has(providerId)) return null;
|
|
9490
|
+
if (typeof localId !== "string" || !LOCAL_ID_RE.test(localId)) return null;
|
|
9491
|
+
return `${providerId}:${localId}`;
|
|
9492
|
+
}
|
|
9493
|
+
function parseFederatedSubject(sub) {
|
|
9494
|
+
if (typeof sub !== "string") return null;
|
|
9495
|
+
const i2 = sub.indexOf(":");
|
|
9496
|
+
if (i2 <= 0) return null;
|
|
9497
|
+
const provider = sub.slice(0, i2);
|
|
9498
|
+
const localId = sub.slice(i2 + 1);
|
|
9499
|
+
return federatedSubject(provider, localId) === sub ? { provider, localId } : null;
|
|
9500
|
+
}
|
|
9501
|
+
function isFederatedSubject(sub) {
|
|
9502
|
+
return parseFederatedSubject(sub) !== null;
|
|
9503
|
+
}
|
|
9504
|
+
var PROVIDER_ID_RE, LOCAL_ID_RE, RESERVED_IDS;
|
|
9505
|
+
var init_identity_providers = __esm({
|
|
9506
|
+
"../../core/serve-control/src/identity-providers/index.ts"() {
|
|
9507
|
+
init_define_HHP_CATALOG();
|
|
9508
|
+
PROVIDER_ID_RE = /^[a-z][a-z0-9]{1,15}$/;
|
|
9509
|
+
LOCAL_ID_RE = /^[A-Za-z0-9._@|+-]{1,128}$/;
|
|
9510
|
+
RESERVED_IDS = /* @__PURE__ */ new Set(["wix", "metasite", "operator", "anon"]);
|
|
9511
|
+
}
|
|
9512
|
+
});
|
|
9513
|
+
|
|
9412
9514
|
// src/catalog-cache.ts
|
|
9413
9515
|
var catalog_cache_exports = {};
|
|
9414
9516
|
__export(catalog_cache_exports, {
|
|
@@ -41949,7 +42051,6 @@ function shouldRevealError(args) {
|
|
|
41949
42051
|
var EMAIL_RE, URL_HOST_RE, INTEGER_RE, NUMBER_RE, AUTHORED_PATTERN_LIMIT, authoredPatterns;
|
|
41950
42052
|
var init_validation = __esm({
|
|
41951
42053
|
"../../core/ts/src/validation.ts"() {
|
|
41952
|
-
"use strict";
|
|
41953
42054
|
init_define_HHP_CATALOG();
|
|
41954
42055
|
EMAIL_RE = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}$/;
|
|
41955
42056
|
URL_HOST_RE = /^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(:[0-9]+)?$/;
|
|
@@ -159800,6 +159901,7 @@ function isLoopbackBase(base2) {
|
|
|
159800
159901
|
function credentialKind(token) {
|
|
159801
159902
|
const claims = decodeControlTokenClaims(token);
|
|
159802
159903
|
if (!claims) return null;
|
|
159904
|
+
if (isFederatedSubject(claims.sub)) return "federated";
|
|
159803
159905
|
if (claims.selfServe) return "self-serve";
|
|
159804
159906
|
return claims.sub ? "operator" : "shared";
|
|
159805
159907
|
}
|
|
@@ -160152,6 +160254,7 @@ var init_cli_shared = __esm({
|
|
|
160152
160254
|
init_splash();
|
|
160153
160255
|
init_lint_report();
|
|
160154
160256
|
init_owner_claim();
|
|
160257
|
+
init_identity_providers();
|
|
160155
160258
|
init_guides();
|
|
160156
160259
|
SHELL_ENUM = SHELL_NAMES.join("|");
|
|
160157
160260
|
caveatLead = (ni2) => ni2.severity === "category" ? "WARNING \u2014 not implemented" : "NOTE \u2014 implemented, but these props are inert";
|
|
@@ -160165,16 +160268,20 @@ var init_cli_shared = __esm({
|
|
|
160165
160268
|
KIND_LABEL = {
|
|
160166
160269
|
"self-serve": "self-serve",
|
|
160167
160270
|
shared: "shared",
|
|
160168
|
-
operator: "operator/provisioned"
|
|
160271
|
+
operator: "operator/provisioned",
|
|
160272
|
+
federated: "non-Wix (federated)"
|
|
160169
160273
|
};
|
|
160170
160274
|
KIND_TIER = {
|
|
160171
160275
|
"self-serve": "self-serve",
|
|
160172
160276
|
shared: "shared",
|
|
160173
|
-
operator: "employee"
|
|
160277
|
+
operator: "employee",
|
|
160278
|
+
/** No tier: the plane refuses `himi dist` for a federated credential in P1. */
|
|
160279
|
+
federated: void 0
|
|
160174
160280
|
};
|
|
160175
160281
|
kindLoginBack = (kind, target) => {
|
|
160176
160282
|
if (kind === "self-serve") return `himi login --browser --target ${target}`;
|
|
160177
160283
|
if (kind === "operator") return `himi login --dpx --target ${target}`;
|
|
160284
|
+
if (kind === "federated") return `himi login --device --target ${target}`;
|
|
160178
160285
|
return void 0;
|
|
160179
160286
|
};
|
|
160180
160287
|
STALE_TOKEN_HINT = "stored control token is stale \u2014 run `himi login` (or `himi login --dpx --target bo`)";
|
|
@@ -195803,7 +195910,8 @@ ${log}` : ""}`, true);
|
|
|
195803
195910
|
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
|
|
195804
195911
|
inputSchema: z4.object({
|
|
195805
195912
|
target: z4.string().optional().describe("Serve target. Default: the CLI's default."),
|
|
195806
|
-
switchAccount: z4.boolean().optional().describe("Sign in again even though a credential is stored (e.g. to use another Wix account).")
|
|
195913
|
+
switchAccount: z4.boolean().optional().describe("Sign in again even though a credential is stored (e.g. to use another Wix account)."),
|
|
195914
|
+
provider: z4.string().regex(/^[a-z][a-z0-9]{1,15}$/).optional().describe('Sign in WITHOUT a Wix account, where the plane offers it: e.g. "base44". The login renews itself, and the other tools reuse it.')
|
|
195807
195915
|
}),
|
|
195808
195916
|
handler: async (a3, d2) => {
|
|
195809
195917
|
const s5 = d2.login.status();
|
|
@@ -195815,7 +195923,7 @@ ${log}` : ""}`, true);
|
|
|
195815
195923
|
return json4({ ok: true, state: "signed_in", ...who2.json && typeof who2.json === "object" ? who2.json : {} });
|
|
195816
195924
|
}
|
|
195817
195925
|
}
|
|
195818
|
-
return loginResult(await d2.login.start(typeof a3.target === "string" && a3.target ? a3.target : void 0));
|
|
195926
|
+
return loginResult(await d2.login.start(typeof a3.target === "string" && a3.target ? a3.target : void 0, typeof a3.provider === "string" && a3.provider ? a3.provider : void 0));
|
|
195819
195927
|
}
|
|
195820
195928
|
},
|
|
195821
195929
|
{
|
|
@@ -195988,12 +196096,12 @@ function createLoginSession(deps) {
|
|
|
195988
196096
|
adopt: (target) => {
|
|
195989
196097
|
signedInTarget = target;
|
|
195990
196098
|
},
|
|
195991
|
-
start(target) {
|
|
196099
|
+
start(target, provider) {
|
|
195992
196100
|
if (current.state === "pending") return Promise.resolve(current);
|
|
195993
196101
|
const self2 = deps.selfCommand();
|
|
195994
196102
|
const env = deps.env ?? process.env;
|
|
195995
|
-
const held = heldWixToken(env) !== void 0;
|
|
195996
|
-
const args = [...self2.args, "login", held ? "--wix" : "--browser", "--skip-version-check", ...target ? ["--target", target] : []];
|
|
196103
|
+
const held = heldWixToken(env) !== void 0 && (!provider || provider === "wix");
|
|
196104
|
+
const args = [...self2.args, "login", held ? "--wix" : "--browser", ...!held && provider ? ["--provider", provider] : [], "--skip-version-check", ...target ? ["--target", target] : []];
|
|
195997
196105
|
const pending2 = { state: "pending", startedAt: deps.now(), ...held ? { via: "wix" } : {} };
|
|
195998
196106
|
current = pending2;
|
|
195999
196107
|
const out2 = [];
|
|
@@ -249080,6 +249188,262 @@ var init_publish_size = __esm({
|
|
|
249080
249188
|
}
|
|
249081
249189
|
});
|
|
249082
249190
|
|
|
249191
|
+
// src/push-errors.ts
|
|
249192
|
+
var push_errors_exports = {};
|
|
249193
|
+
__export(push_errors_exports, {
|
|
249194
|
+
PUSH_FAILURE_CODES: () => PUSH_FAILURE_CODES,
|
|
249195
|
+
base44AppIdForClaim: () => base44AppIdForClaim,
|
|
249196
|
+
base44ClaimRefusal: () => base44ClaimRefusal,
|
|
249197
|
+
federatedRefusal: () => federatedRefusal,
|
|
249198
|
+
pushFailure: () => pushFailure,
|
|
249199
|
+
uxEvidenceCode: () => uxEvidenceCode
|
|
249200
|
+
});
|
|
249201
|
+
function pushFailure(code2, fields2) {
|
|
249202
|
+
return { ...fields2, ok: false, code: code2 };
|
|
249203
|
+
}
|
|
249204
|
+
function uxEvidenceCode(state) {
|
|
249205
|
+
return UX_CODES[state];
|
|
249206
|
+
}
|
|
249207
|
+
function federatedRefusal(status2, body, token, nowSec = Math.floor(Date.now() / 1e3)) {
|
|
249208
|
+
const b3 = body && typeof body === "object" ? body : {};
|
|
249209
|
+
if (status2 === 403 && (b3.code === "insufficient_scope" || b3.error === "insufficient_scope")) {
|
|
249210
|
+
const scope3 = typeof b3.scope === "string" ? b3.scope : void 0;
|
|
249211
|
+
const hint = scope3 === "apps:live" ? "this login may publish drafts but not go live: push with --draft (the default), and promote from an account that can." : `this login does not carry the ${scope3 ? `\`${scope3}\` ` : ""}permission this action needs${typeof b3.hint === "string" ? ` (${b3.hint})` : ""}. Sign in with an account that has it.`;
|
|
249212
|
+
return { code: "insufficient_scope", hint };
|
|
249213
|
+
}
|
|
249214
|
+
if (status2 === 403 && (b3.code === "federated_not_allowed" || b3.error === "federated_not_allowed")) {
|
|
249215
|
+
return { code: "federated_not_allowed", hint: "this action is not available to accounts signed in without Wix yet: publishing a release (`himi push`) and reads are. Sign in with a Wix account (`himi login --device --provider wix`) for the rest." };
|
|
249216
|
+
}
|
|
249217
|
+
if (status2 === 413 && (b3.code === "federated_storage_full" || b3.error === "federated_storage_full")) {
|
|
249218
|
+
return { code: "federated_storage_full", hint: "this account has used its published-bytes allowance (accounts signed in without Wix have a fixed budget). Publish a smaller release, or sign in with a Wix account." };
|
|
249219
|
+
}
|
|
249220
|
+
const claims = token ? decodeControlTokenClaims(token) : null;
|
|
249221
|
+
if (!claims || !isFederatedSubject(claims.sub)) return void 0;
|
|
249222
|
+
const bare401 = b3.error === void 0 || b3.error === "unauthorized" || b3.error === "wix_identity_unverified";
|
|
249223
|
+
if (status2 === 401 && bare401 && !(typeof claims.exp === "number" && claims.exp <= nowSec)) {
|
|
249224
|
+
return { code: "federated_disabled", hint: "this serve plane does not accept sign-ins without a Wix account right now (it is switched off here). Nothing is wrong with your login; sign in with a Wix account (`himi login --device --provider wix`) or try again later." };
|
|
249225
|
+
}
|
|
249226
|
+
if (status2 === 429 && (b3.error === "claim_limit_reached" || b3.code === "claim_limit_reached")) {
|
|
249227
|
+
return { code: "federated_quota_exceeded", hint: `accounts signed in without Wix can claim at most ${typeof b3.limit === "number" ? b3.limit : "a few"} apps, and this one has reached the cap. Push to an app you already own (\`himi apps list\`).` };
|
|
249228
|
+
}
|
|
249229
|
+
if (status2 === 429 && (b3.error === "release_rate_limited" || b3.code === "release_rate_limited")) {
|
|
249230
|
+
const wait = typeof b3.retryAfterSec === "number" ? ` Retry in ${b3.retryAfterSec}s.` : "";
|
|
249231
|
+
return { code: "federated_quota_exceeded", hint: `too many releases in a short time for an account signed in without Wix.${wait}` };
|
|
249232
|
+
}
|
|
249233
|
+
return void 0;
|
|
249234
|
+
}
|
|
249235
|
+
function base44ClaimRefusal(error) {
|
|
249236
|
+
if (typeof error !== "string" || !(error in BASE44_CLAIM_CODES)) return void 0;
|
|
249237
|
+
const code2 = error;
|
|
249238
|
+
return { code: code2, hint: BASE44_CLAIM_CODES[code2] };
|
|
249239
|
+
}
|
|
249240
|
+
async function base44AppIdForClaim(dir, token) {
|
|
249241
|
+
const claims = token ? decodeControlTokenClaims(token) : null;
|
|
249242
|
+
if (typeof claims?.sub !== "string" || !claims.sub.startsWith("base44:") || !isFederatedSubject(claims.sub)) return void 0;
|
|
249243
|
+
try {
|
|
249244
|
+
const { loadAppConfigModule: loadAppConfigModule2 } = await Promise.resolve().then(() => (init_app_config_loader(), app_config_loader_exports));
|
|
249245
|
+
const { BASE44_APP_ID_PLACEHOLDER: BASE44_APP_ID_PLACEHOLDER2 } = await Promise.resolve().then(() => (init_scaffold(), scaffold_exports));
|
|
249246
|
+
const appId3 = (await loadAppConfigModule2(dir))?.base44?.appId;
|
|
249247
|
+
return typeof appId3 === "string" && appId3 && appId3 !== BASE44_APP_ID_PLACEHOLDER2 ? appId3 : void 0;
|
|
249248
|
+
} catch {
|
|
249249
|
+
return void 0;
|
|
249250
|
+
}
|
|
249251
|
+
}
|
|
249252
|
+
var PUSH_FAILURE_CODES, UX_CODES, BASE44_CLAIM_CODES;
|
|
249253
|
+
var init_push_errors = __esm({
|
|
249254
|
+
"src/push-errors.ts"() {
|
|
249255
|
+
init_define_HHP_CATALOG();
|
|
249256
|
+
init_identity_providers();
|
|
249257
|
+
init_owner_claim();
|
|
249258
|
+
PUSH_FAILURE_CODES = [
|
|
249259
|
+
"attestation_history_corrupt",
|
|
249260
|
+
"attestation_stale",
|
|
249261
|
+
"headless_run_failed",
|
|
249262
|
+
"ux_evidence_absent",
|
|
249263
|
+
"ux_evidence_unrecorded",
|
|
249264
|
+
"ux_evidence_stale",
|
|
249265
|
+
"ux_evidence_outdated",
|
|
249266
|
+
"ux_evidence_failed",
|
|
249267
|
+
"ux_evidence_inherited_screens",
|
|
249268
|
+
"ux_evidence_unreadable",
|
|
249269
|
+
"lint_errors",
|
|
249270
|
+
"control_token_expired",
|
|
249271
|
+
"app_source_contains_secrets",
|
|
249272
|
+
"app_source_too_large",
|
|
249273
|
+
"publish_body_too_large",
|
|
249274
|
+
"needs_vpn",
|
|
249275
|
+
"serve_unreachable",
|
|
249276
|
+
"no_serve_plane",
|
|
249277
|
+
"upload_http_error",
|
|
249278
|
+
"claim_failed",
|
|
249279
|
+
"invalid_flag_value",
|
|
249280
|
+
"invalid_selector",
|
|
249281
|
+
"duplicate_only",
|
|
249282
|
+
"incompatible_push_flags",
|
|
249283
|
+
"from_release_needs_a_value",
|
|
249284
|
+
"conflicting_blast_radius",
|
|
249285
|
+
"no_blast_radius",
|
|
249286
|
+
"invalid_visibility",
|
|
249287
|
+
"release_read_failed",
|
|
249288
|
+
"base_not_found",
|
|
249289
|
+
"no_live_release",
|
|
249290
|
+
"invalid_patch",
|
|
249291
|
+
"would_regress",
|
|
249292
|
+
"not_carried_by_patch",
|
|
249293
|
+
"authoring_unavailable",
|
|
249294
|
+
"push_failed",
|
|
249295
|
+
"binary_capability_gap",
|
|
249296
|
+
"native_build_required",
|
|
249297
|
+
"depth_budget_exceeded",
|
|
249298
|
+
"compressed_publish_unsupported",
|
|
249299
|
+
"one_app_readiness_failed",
|
|
249300
|
+
"placeholder_site_binding",
|
|
249301
|
+
"auth_provider_invalid",
|
|
249302
|
+
"extension_invalid",
|
|
249303
|
+
"federated_not_allowed",
|
|
249304
|
+
"federated_disabled",
|
|
249305
|
+
"federated_quota_exceeded",
|
|
249306
|
+
"insufficient_scope",
|
|
249307
|
+
"federated_storage_full",
|
|
249308
|
+
"login_expired",
|
|
249309
|
+
"base44_app_not_owned",
|
|
249310
|
+
"base44_app_taken",
|
|
249311
|
+
"base44_app_requires_base44_signin",
|
|
249312
|
+
"invalid_base44_app_id"
|
|
249313
|
+
];
|
|
249314
|
+
UX_CODES = {
|
|
249315
|
+
absent: "ux_evidence_absent",
|
|
249316
|
+
unrecorded: "ux_evidence_unrecorded",
|
|
249317
|
+
stale: "ux_evidence_stale",
|
|
249318
|
+
outdated: "ux_evidence_outdated",
|
|
249319
|
+
failed: "ux_evidence_failed",
|
|
249320
|
+
"inherited-screens": "ux_evidence_inherited_screens",
|
|
249321
|
+
unreadable: "ux_evidence_unreadable"
|
|
249322
|
+
};
|
|
249323
|
+
BASE44_CLAIM_CODES = {
|
|
249324
|
+
base44_app_not_owned: "Base44 did not list this app as yours when you signed in: sign in with Base44 again (`himi login --browser --provider base44`) as the app's owner.",
|
|
249325
|
+
base44_app_taken: "this Base44 app is already bound to another Himi app or account.",
|
|
249326
|
+
base44_app_requires_base44_signin: "binding a Base44 app needs a Base44 sign-in: `himi login --browser --provider base44`.",
|
|
249327
|
+
invalid_base44_app_id: "the Base44 app id in config.ts (`base44.appId`) is not a valid id: copy it from the app's editor URL."
|
|
249328
|
+
};
|
|
249329
|
+
}
|
|
249330
|
+
});
|
|
249331
|
+
|
|
249332
|
+
// src/login-refresh.ts
|
|
249333
|
+
var login_refresh_exports = {};
|
|
249334
|
+
__export(login_refresh_exports, {
|
|
249335
|
+
FEDERATED_REFRESH_PATH: () => FEDERATED_REFRESH_PATH,
|
|
249336
|
+
federatedTokenNeedsRefresh: () => federatedTokenNeedsRefresh,
|
|
249337
|
+
isStoredLogin: () => isStoredLogin,
|
|
249338
|
+
refreshStoredLogin: () => refreshStoredLogin
|
|
249339
|
+
});
|
|
249340
|
+
import { closeSync as closeSync13, openSync as openSync12, statSync as statSync42, unlinkSync as unlinkSync10 } from "node:fs";
|
|
249341
|
+
function federatedTokenNeedsRefresh(token, nowSec) {
|
|
249342
|
+
if (!token) return false;
|
|
249343
|
+
const c2 = decodeControlTokenClaims(token);
|
|
249344
|
+
if (!c2 || !isFederatedSubject(c2.sub)) return false;
|
|
249345
|
+
return typeof c2.exp === "number" && c2.exp <= nowSec + EARLY_SEC;
|
|
249346
|
+
}
|
|
249347
|
+
function isStoredLogin(target, token, path2) {
|
|
249348
|
+
return !!token && loadStoredLogin(target, path2 ?? defaultTargetsPath()).controlToken === token;
|
|
249349
|
+
}
|
|
249350
|
+
async function withLock2(path2, deps, fn2) {
|
|
249351
|
+
const lock = `${path2}.refresh.lock`;
|
|
249352
|
+
const sleep4 = deps.sleep ?? ((ms2) => new Promise((r3) => setTimeout(r3, ms2)));
|
|
249353
|
+
const started = Date.now();
|
|
249354
|
+
let acquired = false;
|
|
249355
|
+
for (; ; ) {
|
|
249356
|
+
try {
|
|
249357
|
+
closeSync13(openSync12(lock, "wx", 384));
|
|
249358
|
+
acquired = true;
|
|
249359
|
+
break;
|
|
249360
|
+
} catch {
|
|
249361
|
+
try {
|
|
249362
|
+
if (Date.now() - statSync42(lock).mtimeMs > LOCK_STALE_MS) {
|
|
249363
|
+
unlinkSync10(lock);
|
|
249364
|
+
continue;
|
|
249365
|
+
}
|
|
249366
|
+
} catch {
|
|
249367
|
+
continue;
|
|
249368
|
+
}
|
|
249369
|
+
if (Date.now() - started > LOCK_WAIT_MS) break;
|
|
249370
|
+
await sleep4(100);
|
|
249371
|
+
}
|
|
249372
|
+
}
|
|
249373
|
+
try {
|
|
249374
|
+
return await fn2();
|
|
249375
|
+
} finally {
|
|
249376
|
+
if (acquired) {
|
|
249377
|
+
try {
|
|
249378
|
+
unlinkSync10(lock);
|
|
249379
|
+
} catch {
|
|
249380
|
+
}
|
|
249381
|
+
}
|
|
249382
|
+
}
|
|
249383
|
+
}
|
|
249384
|
+
async function refreshStoredLogin(target, opts = {}) {
|
|
249385
|
+
const path2 = opts.path ?? defaultTargetsPath();
|
|
249386
|
+
const nowSec = opts.nowSec ?? (() => Math.floor(Date.now() / 1e3));
|
|
249387
|
+
const before = loadStoredLogin(target, path2);
|
|
249388
|
+
const claims = before.controlToken ? decodeControlTokenClaims(before.controlToken) : null;
|
|
249389
|
+
if (!before.refreshToken || !claims || !isFederatedSubject(claims.sub)) return { ok: true, refreshed: false };
|
|
249390
|
+
if (!opts.force && !federatedTokenNeedsRefresh(before.controlToken, nowSec())) return { ok: true, refreshed: false };
|
|
249391
|
+
let ownerIssue;
|
|
249392
|
+
try {
|
|
249393
|
+
ownerIssue = resolveTarget({ target }).ownerIssue;
|
|
249394
|
+
} catch {
|
|
249395
|
+
}
|
|
249396
|
+
if (!ownerIssue) return { ok: false, code: "refresh_unavailable", error: `no owner issuer for target "${target}"`, hint: `run \`himi login --target ${target}\` again` };
|
|
249397
|
+
const pinned = ownerIssuerRefusal(ownerIssue);
|
|
249398
|
+
if (pinned) return { ok: false, code: "refresh_unavailable", error: `refusing to send the refresh token to ${ownerIssue} (${pinned.error})`, hint: pinned.hint };
|
|
249399
|
+
return withLock2(path2, opts, async () => {
|
|
249400
|
+
const now = loadStoredLogin(target, path2);
|
|
249401
|
+
if (now.refreshToken !== before.refreshToken) {
|
|
249402
|
+
return now.controlToken ? { ok: true, refreshed: true } : { ok: true, refreshed: false };
|
|
249403
|
+
}
|
|
249404
|
+
const doFetch = opts.fetchImpl ?? fetch;
|
|
249405
|
+
let resp;
|
|
249406
|
+
try {
|
|
249407
|
+
resp = await doFetch(`${ownerIssue.replace(/\/$/, "")}${FEDERATED_REFRESH_PATH}`, {
|
|
249408
|
+
method: "POST",
|
|
249409
|
+
headers: { "content-type": "application/json", accept: "application/json" },
|
|
249410
|
+
body: JSON.stringify({ refresh_token: before.refreshToken }),
|
|
249411
|
+
// A credential goes out and one comes back: never follow a redirect elsewhere.
|
|
249412
|
+
redirect: "error",
|
|
249413
|
+
signal: AbortSignal.timeout(15e3)
|
|
249414
|
+
});
|
|
249415
|
+
} catch (e2) {
|
|
249416
|
+
return { ok: false, code: "refresh_unavailable", error: `could not refresh the login: ${e2.message}`, hint: "check the network and retry; the stored login is unchanged" };
|
|
249417
|
+
}
|
|
249418
|
+
const body = await resp.json().catch(() => ({}));
|
|
249419
|
+
if (resp.ok && typeof body.token === "string" && typeof body.refresh_token === "string") {
|
|
249420
|
+
const stored = swapRefreshedLogin(target, before.refreshToken, { controlToken: body.token, refreshToken: body.refresh_token }, path2);
|
|
249421
|
+
return stored ? { ok: true, refreshed: true } : { ok: true, refreshed: false };
|
|
249422
|
+
}
|
|
249423
|
+
const code2 = typeof body.code === "string" ? body.code : typeof body.error === "string" ? body.error : "";
|
|
249424
|
+
if (code2 === "federated_disabled") {
|
|
249425
|
+
return { ok: false, code: "federated_disabled", error: "the plane does not accept sign-ins without a Wix account right now", hint: "sign in with a Wix account (`himi login --device --provider wix`) or try again later" };
|
|
249426
|
+
}
|
|
249427
|
+
if (code2 === "invalid_grant" || code2 === "token_revoked") {
|
|
249428
|
+
return { ok: false, code: "login_expired", error: `the stored login can no longer be renewed (${code2})`, hint: `sign in again: \`himi login --browser --target ${target}\` (or \`himi login --device --target ${target}\`)` };
|
|
249429
|
+
}
|
|
249430
|
+
return { ok: false, code: "refresh_unavailable", error: `the plane could not refresh the login (${resp.status}${code2 ? ` ${code2}` : ""})`, hint: "retry in a moment; the stored login is unchanged" };
|
|
249431
|
+
});
|
|
249432
|
+
}
|
|
249433
|
+
var FEDERATED_REFRESH_PATH, EARLY_SEC, LOCK_STALE_MS, LOCK_WAIT_MS;
|
|
249434
|
+
var init_login_refresh = __esm({
|
|
249435
|
+
"src/login-refresh.ts"() {
|
|
249436
|
+
init_define_HHP_CATALOG();
|
|
249437
|
+
init_config();
|
|
249438
|
+
init_owner_claim();
|
|
249439
|
+
init_identity_providers();
|
|
249440
|
+
FEDERATED_REFRESH_PATH = "/v1/owner/token/refresh";
|
|
249441
|
+
EARLY_SEC = 60;
|
|
249442
|
+
LOCK_STALE_MS = 3e4;
|
|
249443
|
+
LOCK_WAIT_MS = 15e3;
|
|
249444
|
+
}
|
|
249445
|
+
});
|
|
249446
|
+
|
|
249083
249447
|
// src/ring-pins.ts
|
|
249084
249448
|
var ring_pins_exports = {};
|
|
249085
249449
|
__export(ring_pins_exports, {
|
|
@@ -251785,7 +252149,7 @@ __export(run_exports, {
|
|
|
251785
252149
|
runPackage: () => runPackage,
|
|
251786
252150
|
withoutProdServe: () => withoutProdServe
|
|
251787
252151
|
});
|
|
251788
|
-
import { cpSync as cpSync2, existsSync as existsSync123, mkdirSync as mkdirSync58, mkdtempSync as mkdtempSync11, readFileSync as readFileSync144, rmSync as rmSync35, statSync as
|
|
252152
|
+
import { cpSync as cpSync2, existsSync as existsSync123, mkdirSync as mkdirSync58, mkdtempSync as mkdtempSync11, readFileSync as readFileSync144, rmSync as rmSync35, statSync as statSync44 } from "node:fs";
|
|
251789
252153
|
import { networkInterfaces as osNetworkInterfaces, tmpdir as tmpdir12 } from "node:os";
|
|
251790
252154
|
import { dirname as dirname72, join as join158 } from "node:path";
|
|
251791
252155
|
import { fileURLToPath as fileURLToPath36 } from "node:url";
|
|
@@ -251817,7 +252181,7 @@ async function fetchBytes(url) {
|
|
|
251817
252181
|
}
|
|
251818
252182
|
async function resolvePackage(source2, workDir) {
|
|
251819
252183
|
const isUrl2 = /^https?:\/\//i.test(source2);
|
|
251820
|
-
if (!isUrl2 && existsSync123(source2) &&
|
|
252184
|
+
if (!isUrl2 && existsSync123(source2) && statSync44(source2).isDirectory()) {
|
|
251821
252185
|
const appDirManifest = join158(source2, "release-manifest.json");
|
|
251822
252186
|
if (existsSync123(appDirManifest)) {
|
|
251823
252187
|
const opened2 = openPackageDir(source2);
|
|
@@ -260215,7 +260579,7 @@ __export(preflight_app_exports, {
|
|
|
260215
260579
|
profileAccount: () => profileAccount,
|
|
260216
260580
|
readXcconfigVars: () => readXcconfigVars
|
|
260217
260581
|
});
|
|
260218
|
-
import { readFileSync as readFileSync157, existsSync as existsSync132, readdirSync as readdirSync57, statSync as
|
|
260582
|
+
import { readFileSync as readFileSync157, existsSync as existsSync132, readdirSync as readdirSync57, statSync as statSync45 } from "node:fs";
|
|
260219
260583
|
import { createHash as createHash85 } from "node:crypto";
|
|
260220
260584
|
import { dirname as dirname76, join as join171 } from "node:path";
|
|
260221
260585
|
function analyze(projectYml, storeConfig, icon, account2, adopted) {
|
|
@@ -260551,7 +260915,7 @@ function playListingAssets(app2, locale = "en-US") {
|
|
|
260551
260915
|
for (const name of names2) {
|
|
260552
260916
|
const p2 = join171(dir, name);
|
|
260553
260917
|
try {
|
|
260554
|
-
if (
|
|
260918
|
+
if (statSync45(p2).isFile()) return { name, bytes: readFileSync157(p2) };
|
|
260555
260919
|
} catch {
|
|
260556
260920
|
}
|
|
260557
260921
|
}
|
|
@@ -260599,7 +260963,7 @@ function listScreenshots(app2, locale = "en-US") {
|
|
|
260599
260963
|
if (existsSync132(legacy)) {
|
|
260600
260964
|
for (const deviceDir of readdirSync57(legacy)) {
|
|
260601
260965
|
const d2 = join171(legacy, deviceDir);
|
|
260602
|
-
if (!
|
|
260966
|
+
if (!statSync45(d2).isDirectory()) continue;
|
|
260603
260967
|
for (const png of readdirSync57(d2).filter((n2) => n2.endsWith(".png"))) {
|
|
260604
260968
|
const sz = pngSize3(readFileSync157(join171(d2, png)));
|
|
260605
260969
|
if (sz) out2.push({ name: `${deviceDir}/${png}`, w: sz.w, h: sz.h });
|
|
@@ -260614,7 +260978,7 @@ function placeholderHashes2() {
|
|
|
260614
260978
|
for (const target of readdirSync57(templateIos)) {
|
|
260615
260979
|
const p2 = join171(templateIos, target, "Assets.xcassets", "AppIcon.appiconset", "icon_1024.png");
|
|
260616
260980
|
try {
|
|
260617
|
-
if (!
|
|
260981
|
+
if (!statSync45(p2).isFile()) continue;
|
|
260618
260982
|
return [LEGACY_PLACEHOLDER_SHA2562, createHash85("sha256").update(readFileSync157(p2)).digest("hex")];
|
|
260619
260983
|
} catch {
|
|
260620
260984
|
}
|
|
@@ -260650,7 +261014,7 @@ async function appIconState(iosDir) {
|
|
|
260650
261014
|
for (const target of readdirSync57(iosDir)) {
|
|
260651
261015
|
const p2 = join171(iosDir, target, "Assets.xcassets", "AppIcon.appiconset", "icon_1024.png");
|
|
260652
261016
|
try {
|
|
260653
|
-
if (!
|
|
261017
|
+
if (!statSync45(p2).isFile()) continue;
|
|
260654
261018
|
const bytes2 = readFileSync157(p2);
|
|
260655
261019
|
const hash3 = createHash85("sha256").update(bytes2).digest("hex");
|
|
260656
261020
|
const pixels = await pixelIssues(bytes2);
|
|
@@ -270361,7 +270725,7 @@ var init_invite_plan = __esm({
|
|
|
270361
270725
|
});
|
|
270362
270726
|
|
|
270363
270727
|
// src/one-app/header-badges-cli.ts
|
|
270364
|
-
import { existsSync as existsSync146, readFileSync as readFileSync173, rmSync as rmSync44, statSync as
|
|
270728
|
+
import { existsSync as existsSync146, readFileSync as readFileSync173, rmSync as rmSync44, statSync as statSync48, writeFileSync as writeFileSync69 } from "node:fs";
|
|
270365
270729
|
import { join as join189, resolve as resolve118 } from "node:path";
|
|
270366
270730
|
function parseArgs4(args) {
|
|
270367
270731
|
let evidenceDir;
|
|
@@ -270461,7 +270825,7 @@ async function runOneAppHeaderBadges(args, io2) {
|
|
|
270461
270825
|
let screens;
|
|
270462
270826
|
let configText;
|
|
270463
270827
|
try {
|
|
270464
|
-
if (!
|
|
270828
|
+
if (!statSync48(configPath).isFile()) throw new Error("config.ts is not a file.");
|
|
270465
270829
|
configText = readFileSync173(configPath, "utf8");
|
|
270466
270830
|
screens = contentScreens(options2.contentDir);
|
|
270467
270831
|
} catch (error) {
|
|
@@ -274457,7 +274821,7 @@ ${indent}`);
|
|
|
274457
274821
|
|
|
274458
274822
|
// src/one-app/access-cli.ts
|
|
274459
274823
|
import { createHash as createHash95 } from "node:crypto";
|
|
274460
|
-
import { existsSync as existsSync154, readFileSync as readFileSync181, rmSync as rmSync46, statSync as
|
|
274824
|
+
import { existsSync as existsSync154, readFileSync as readFileSync181, rmSync as rmSync46, statSync as statSync49, writeFileSync as writeFileSync74 } from "node:fs";
|
|
274461
274825
|
import { join as join197, resolve as resolve122 } from "node:path";
|
|
274462
274826
|
function parseArgs6(args) {
|
|
274463
274827
|
let evidenceDir;
|
|
@@ -274641,7 +275005,7 @@ async function runOneAppAccess(args, io2) {
|
|
|
274641
275005
|
let configText;
|
|
274642
275006
|
let screensText;
|
|
274643
275007
|
try {
|
|
274644
|
-
for (const path2 of [configPath, screensPath]) if (!
|
|
275008
|
+
for (const path2 of [configPath, screensPath]) if (!statSync49(path2).isFile()) throw new Error(`${path2} is not a file.`);
|
|
274645
275009
|
configText = readFileSync181(configPath, "utf8");
|
|
274646
275010
|
screensText = readFileSync181(screensPath, "utf8");
|
|
274647
275011
|
} catch (error) {
|
|
@@ -275209,7 +275573,7 @@ __export(cli_exports2, {
|
|
|
275209
275573
|
ONE_APP_WORKFLOW: () => ONE_APP_WORKFLOW,
|
|
275210
275574
|
runOneAppCommand: () => runOneAppCommand
|
|
275211
275575
|
});
|
|
275212
|
-
import { closeSync as
|
|
275576
|
+
import { closeSync as closeSync15, constants as constants13, lstatSync as lstatSync40, mkdirSync as mkdirSync67, openSync as openSync14, readFileSync as readFileSync183, realpathSync as realpathSync23, writeFileSync as writeFileSync75 } from "node:fs";
|
|
275213
275577
|
import { createHash as createHash96 } from "node:crypto";
|
|
275214
275578
|
import { isIP as isIP2 } from "node:net";
|
|
275215
275579
|
import { dirname as dirname86, join as join199, parse as parse11, resolve as resolve124 } from "node:path";
|
|
@@ -275332,11 +275696,11 @@ function assertSafeParents(path2) {
|
|
|
275332
275696
|
}
|
|
275333
275697
|
}
|
|
275334
275698
|
function writePrivate(path2, contents, append) {
|
|
275335
|
-
const fd =
|
|
275699
|
+
const fd = openSync14(path2, constants13.O_WRONLY | constants13.O_CREAT | constants13.O_NOFOLLOW | (append ? constants13.O_APPEND : constants13.O_EXCL), 384);
|
|
275336
275700
|
try {
|
|
275337
275701
|
writeFileSync75(fd, contents, { encoding: "utf8" });
|
|
275338
275702
|
} finally {
|
|
275339
|
-
|
|
275703
|
+
closeSync15(fd);
|
|
275340
275704
|
}
|
|
275341
275705
|
}
|
|
275342
275706
|
async function runOneAppCommand(argv, io2, deps = {}, commandIncluded = false) {
|
|
@@ -277701,7 +278065,7 @@ var init_customer_build = __esm({
|
|
|
277701
278065
|
});
|
|
277702
278066
|
|
|
277703
278067
|
// src/site-analyze/apply.ts
|
|
277704
|
-
import { existsSync as existsSync156, readFileSync as readFileSync185, writeFileSync as writeFileSync76, copyFileSync as copyFileSync3, mkdirSync as mkdirSync68, realpathSync as realpathSync24, statSync as
|
|
278068
|
+
import { existsSync as existsSync156, readFileSync as readFileSync185, writeFileSync as writeFileSync76, copyFileSync as copyFileSync3, mkdirSync as mkdirSync68, realpathSync as realpathSync24, statSync as statSync50 } from "node:fs";
|
|
277705
278069
|
import { dirname as dirname87, isAbsolute as isAbsolute19, join as join201, resolve as resolve125, sep as sep34 } from "node:path";
|
|
277706
278070
|
import { spawnSync as spawnSync13 } from "node:child_process";
|
|
277707
278071
|
function inRepoBakeRefusal(repoRoot2, shell) {
|
|
@@ -278054,7 +278418,7 @@ function buildMergedContract(options2) {
|
|
|
278054
278418
|
}
|
|
278055
278419
|
if (!real.startsWith(realRoot + sep34)) return void 0;
|
|
278056
278420
|
try {
|
|
278057
|
-
if (!
|
|
278421
|
+
if (!statSync50(real).isFile()) return void 0;
|
|
278058
278422
|
mkdirSync68(dirname87(to2), { recursive: true });
|
|
278059
278423
|
copyFileSync3(real, to2);
|
|
278060
278424
|
} catch {
|
|
@@ -280921,81 +281285,6 @@ var init_check_report = __esm({
|
|
|
280921
281285
|
}
|
|
280922
281286
|
});
|
|
280923
281287
|
|
|
280924
|
-
// src/push-errors.ts
|
|
280925
|
-
var push_errors_exports = {};
|
|
280926
|
-
__export(push_errors_exports, {
|
|
280927
|
-
PUSH_FAILURE_CODES: () => PUSH_FAILURE_CODES,
|
|
280928
|
-
pushFailure: () => pushFailure,
|
|
280929
|
-
uxEvidenceCode: () => uxEvidenceCode
|
|
280930
|
-
});
|
|
280931
|
-
function pushFailure(code2, fields2) {
|
|
280932
|
-
return { ...fields2, ok: false, code: code2 };
|
|
280933
|
-
}
|
|
280934
|
-
function uxEvidenceCode(state) {
|
|
280935
|
-
return UX_CODES[state];
|
|
280936
|
-
}
|
|
280937
|
-
var PUSH_FAILURE_CODES, UX_CODES;
|
|
280938
|
-
var init_push_errors = __esm({
|
|
280939
|
-
"src/push-errors.ts"() {
|
|
280940
|
-
init_define_HHP_CATALOG();
|
|
280941
|
-
PUSH_FAILURE_CODES = [
|
|
280942
|
-
"attestation_history_corrupt",
|
|
280943
|
-
"attestation_stale",
|
|
280944
|
-
"headless_run_failed",
|
|
280945
|
-
"ux_evidence_absent",
|
|
280946
|
-
"ux_evidence_unrecorded",
|
|
280947
|
-
"ux_evidence_stale",
|
|
280948
|
-
"ux_evidence_outdated",
|
|
280949
|
-
"ux_evidence_failed",
|
|
280950
|
-
"ux_evidence_inherited_screens",
|
|
280951
|
-
"ux_evidence_unreadable",
|
|
280952
|
-
"lint_errors",
|
|
280953
|
-
"control_token_expired",
|
|
280954
|
-
"app_source_contains_secrets",
|
|
280955
|
-
"app_source_too_large",
|
|
280956
|
-
"publish_body_too_large",
|
|
280957
|
-
"needs_vpn",
|
|
280958
|
-
"serve_unreachable",
|
|
280959
|
-
"no_serve_plane",
|
|
280960
|
-
"upload_http_error",
|
|
280961
|
-
"claim_failed",
|
|
280962
|
-
"invalid_flag_value",
|
|
280963
|
-
"invalid_selector",
|
|
280964
|
-
"duplicate_only",
|
|
280965
|
-
"incompatible_push_flags",
|
|
280966
|
-
"from_release_needs_a_value",
|
|
280967
|
-
"conflicting_blast_radius",
|
|
280968
|
-
"no_blast_radius",
|
|
280969
|
-
"invalid_visibility",
|
|
280970
|
-
"release_read_failed",
|
|
280971
|
-
"base_not_found",
|
|
280972
|
-
"no_live_release",
|
|
280973
|
-
"invalid_patch",
|
|
280974
|
-
"would_regress",
|
|
280975
|
-
"not_carried_by_patch",
|
|
280976
|
-
"authoring_unavailable",
|
|
280977
|
-
"push_failed",
|
|
280978
|
-
"binary_capability_gap",
|
|
280979
|
-
"native_build_required",
|
|
280980
|
-
"depth_budget_exceeded",
|
|
280981
|
-
"compressed_publish_unsupported",
|
|
280982
|
-
"one_app_readiness_failed",
|
|
280983
|
-
"placeholder_site_binding",
|
|
280984
|
-
"auth_provider_invalid",
|
|
280985
|
-
"extension_invalid"
|
|
280986
|
-
];
|
|
280987
|
-
UX_CODES = {
|
|
280988
|
-
absent: "ux_evidence_absent",
|
|
280989
|
-
unrecorded: "ux_evidence_unrecorded",
|
|
280990
|
-
stale: "ux_evidence_stale",
|
|
280991
|
-
outdated: "ux_evidence_outdated",
|
|
280992
|
-
failed: "ux_evidence_failed",
|
|
280993
|
-
"inherited-screens": "ux_evidence_inherited_screens",
|
|
280994
|
-
unreadable: "ux_evidence_unreadable"
|
|
280995
|
-
};
|
|
280996
|
-
}
|
|
280997
|
-
});
|
|
280998
|
-
|
|
280999
281288
|
// src/fidelity/capture.ts
|
|
281000
281289
|
var capture_exports = {};
|
|
281001
281290
|
__export(capture_exports, {
|
|
@@ -283128,7 +283417,7 @@ var USAGE = `himi \u2014 the Himalaya authoring CLI (remote dev loop)
|
|
|
283128
283417
|
NOT in git \u2014 prefer committing to assets/ instead)
|
|
283129
283418
|
himi assets rm <name> [--live] drop an asset record; the next resolve falls back to the
|
|
283130
283419
|
baked copy (bytes survive until a retention pass)
|
|
283131
|
-
himi login [--browser|--device [--site <msid>] [--redirect-uri <uri>] [--no-wait]|--wix [--wix-token-stdin]|--dpx] [--target <t>] [--no-open]
|
|
283420
|
+
himi login [--browser|--device [--provider <id>] [--site <msid>] [--redirect-uri <uri>] [--no-wait]|--wix [--wix-token-stdin]|--dpx] [--target <t>] [--no-open]
|
|
283132
283421
|
himi login --device --resume [--timeout <s>] [--target <t>]
|
|
283133
283422
|
get + store a scoped control token for push/promote
|
|
283134
283423
|
--browser: sign in with your own Wix account in a browser
|
|
@@ -283878,7 +284167,7 @@ var COMMANDS = [
|
|
|
283878
284167
|
{ name: "data", summary: "read-only plan or explicitly provision/seed declared KV and Wix Data resources. Preview and production are separate scopes. KV administration uses the operator data plane from --data-url/HIMI_DATA_ADMIN_URL and HIMI_DATA_ADMIN_TOKEN; draft push never calls it.", required: "plan|create|seed [--site <msid>] [--environment preview|production] [--content <dir>] [--data-url <url>] [--dry-run] [--force]" },
|
|
283879
284168
|
{ name: "icons", summary: "list the valid Icon.name vocabulary (an unknown name renders a fallback glyph; validate warns on unknown names) (offline)", required: "[--json]" },
|
|
283880
284169
|
{ name: "icon", summary: "the app's LAUNCHER icon \u2014 the home-screen / store mark, which is BINARY-floor and never over-the-air (distinct from `himi icons`, the in-screen glyph vocabulary). `status`/`check` report what this app would actually ship and validate it against both stores: exact 1024x1024, no tRNS chunk, non-interlaced, and \u2014 when the optional image toolchain is installed \u2014 no transparent regions (Apple permits an alpha channel but not transparent pixels: ITMS-90717), no pre-masked corners, no letterboxed wordmark; they also print the store-policy checklist no checker can decide. `set <file.png>` installs supplied art, `from-site` installs the logo `himi site analyze` downloaded, `from-one-app` preserves the hash-verified collected app mark (requires the image toolchain), and `generate` makes a gradient tile + glyph \u2014 these commands trim, flatten onto the app's accent, write the 1024 opaque master plus the 512 Play listing icon (Play wants 32-bit WITH alpha, so it is a separate file), and DECLARE it in himalaya.content.json, without which the release bakes no icon at all", required: "[status|check] | set <file.png> | from-one-app [--evidence-dir <dir>] | from-site [--book <dir>] | generate [--glyph <g>] [--accent <hex>] | glyphs [--content <dir>] [--json]" },
|
|
283881
|
-
{ name: "login", summary: "obtain a scoped serve-control token from Wix identity and store it in ~/.himalaya/serve-targets.json (so push/promote need no hand-pasted token). Four modes: --browser (your own Wix account, no VPN/BO), --device (an agent holding NO credential, whose browser cannot reach the owner: prints a URL and a code, the owner approves from any browser signed in to Wix, and the poll stores the same token; with --site <msid> the owner also connects that site and the agent gets its Headless client id, no Wix token; --no-wait prints the URL and code and exits at once, then `--device --resume [--timeout <s>]` polls for at most that many seconds (default 50) and exits 0 signed in or 3 with code device_pending, for a caller that cannot run one command for minutes or sees output only when a command exits), --wix (HEADLESS \u2014 the owner's held Wix token piped with --wix-token-stdin or set as WIX_TOKEN, else WIX_API_KEY, else the machine's own Wix CLI credential; the mode a CI pod or agent container can satisfy \u2014 any valid Wix token is the owner), --dpx (Wix employee, reads ~/.dpx/session/token). RFC 0026 WS3.", required: "[--browser|--device [--site <msid>] [--redirect-uri <uri>] [--no-wait]|--wix [--wix-token-stdin]|--dpx] [--target <t>] [--issue-url <url>] | --device --resume [--timeout <s>] [--target <t>]" },
|
|
284170
|
+
{ name: "login", summary: "obtain a scoped serve-control token from Wix identity and store it in ~/.himalaya/serve-targets.json (so push/promote need no hand-pasted token). Four modes: --browser (your own Wix account, no VPN/BO), --device (an agent holding NO credential, whose browser cannot reach the owner: prints a URL and a code, the owner approves from any browser signed in to Wix, and the poll stores the same token; with --site <msid> the owner also connects that site and the agent gets its Headless client id, no Wix token; --provider <id> puts the sign-in choice (wix, or a non-Wix provider such as base44 when the plane offers it) in the approve link; --no-wait prints the URL and code and exits at once, then `--device --resume [--timeout <s>]` polls for at most that many seconds (default 50) and exits 0 signed in or 3 with code device_pending, for a caller that cannot run one command for minutes or sees output only when a command exits), --wix (HEADLESS \u2014 the owner's held Wix token piped with --wix-token-stdin or set as WIX_TOKEN, else WIX_API_KEY, else the machine's own Wix CLI credential; the mode a CI pod or agent container can satisfy \u2014 any valid Wix token is the owner), --dpx (Wix employee, reads ~/.dpx/session/token). RFC 0026 WS3.", required: "[--browser|--device [--provider <id>] [--site <msid>] [--redirect-uri <uri>] [--no-wait]|--wix [--wix-token-stdin]|--dpx] [--target <t>] [--issue-url <url>] | --device --resume [--timeout <s>] [--target <t>]" },
|
|
283882
284171
|
{ name: "logout", summary: "remove the stored control token for a target", required: "[--target <t>]" },
|
|
283883
284172
|
{ 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>]" },
|
|
283884
284173
|
{ 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]" },
|
|
@@ -287327,15 +287616,19 @@ async function pushCommand(ctx) {
|
|
|
287327
287616
|
let adoptedSlug;
|
|
287328
287617
|
if (flags["no-claim"] !== true && !broker) {
|
|
287329
287618
|
if (ownerIssue && pushToken && !tokenCoversApp(pushToken, app2)) {
|
|
287330
|
-
const
|
|
287619
|
+
const pushErrors = await Promise.resolve().then(() => (init_push_errors(), push_errors_exports));
|
|
287620
|
+
const base44AppId = await pushErrors.base44AppIdForClaim(dir, pushToken);
|
|
287621
|
+
const claim = await autoClaimSlug({ ownerIssue, controlToken: pushToken, app: app2, accountId: str3(flags["account-id"]), ...base44AppId ? { base44AppId } : {} });
|
|
287331
287622
|
if (claim.fatal) {
|
|
287332
|
-
|
|
287623
|
+
const fed = pushErrors.base44ClaimRefusal(claim.fatal.error) ?? pushErrors.federatedRefusal(claim.fatal.status, claim.fatal.body, pushToken);
|
|
287624
|
+
io2.error(JSON.stringify(pushFailure2(fed?.code ?? "claim_failed", {
|
|
287333
287625
|
ok: false,
|
|
287334
287626
|
app: app2,
|
|
287335
287627
|
pushed: false,
|
|
287336
287628
|
status: claim.fatal.status,
|
|
287337
287629
|
...claim.fatal.body,
|
|
287338
|
-
...
|
|
287630
|
+
...base44AppId ? { base44AppId } : {},
|
|
287631
|
+
...fed ? { hint: fed.hint } : claimHint(claim.fatal.status, claim.fatal.error)
|
|
287339
287632
|
})));
|
|
287340
287633
|
return 1;
|
|
287341
287634
|
}
|
|
@@ -287364,6 +287657,27 @@ async function pushCommand(ctx) {
|
|
|
287364
287657
|
})));
|
|
287365
287658
|
return 1;
|
|
287366
287659
|
}
|
|
287660
|
+
if (!r3.ok && r3.status === 401 && pushToken) {
|
|
287661
|
+
const { isStoredLogin: isStoredLogin2, refreshStoredLogin: refreshStoredLogin2 } = await Promise.resolve().then(() => (init_login_refresh(), login_refresh_exports));
|
|
287662
|
+
if (isStoredLogin2(pushTarget, pushToken)) {
|
|
287663
|
+
const renewed = await refreshStoredLogin2(pushTarget, { force: true });
|
|
287664
|
+
if (renewed.ok && renewed.refreshed) {
|
|
287665
|
+
try {
|
|
287666
|
+
pushToken = resolveTarget({ target: pushTarget, controlToken: str3(flags["control-token"]) }).controlToken;
|
|
287667
|
+
r3 = await client4().publishRelease(publishPayload, meta, draft);
|
|
287668
|
+
} catch (e2) {
|
|
287669
|
+
io2.error(JSON.stringify(pushFailure2("needs_vpn", {
|
|
287670
|
+
...serveUnreachableError(targetName2(), serveBase(), e2.message),
|
|
287671
|
+
version: cliVersion()
|
|
287672
|
+
})));
|
|
287673
|
+
return 1;
|
|
287674
|
+
}
|
|
287675
|
+
} else if (!renewed.ok && renewed.code !== "refresh_unavailable") {
|
|
287676
|
+
print(pushFailure2(renewed.code, { ok: false, app: app2, pushed: false, status: r3.status, error: renewed.error, hint: renewed.hint }));
|
|
287677
|
+
return 1;
|
|
287678
|
+
}
|
|
287679
|
+
}
|
|
287680
|
+
}
|
|
287367
287681
|
if (!r3.ok && r3.status === 409 && r3.json?.error === "binary_capability_gap") {
|
|
287368
287682
|
const j2 = r3.json;
|
|
287369
287683
|
print(pushFailure2("binary_capability_gap", {
|
|
@@ -287408,6 +287722,11 @@ async function pushCommand(ctx) {
|
|
|
287408
287722
|
return 1;
|
|
287409
287723
|
}
|
|
287410
287724
|
if (!r3.ok) {
|
|
287725
|
+
const fed = (await Promise.resolve().then(() => (init_push_errors(), push_errors_exports))).federatedRefusal(r3.status, r3.json, pushToken);
|
|
287726
|
+
if (fed) {
|
|
287727
|
+
print(pushFailure2(fed.code, { ok: false, app: app2, pushed: false, status: r3.status, body: r3.json ?? r3.text, hint: fed.hint }));
|
|
287728
|
+
return 1;
|
|
287729
|
+
}
|
|
287411
287730
|
const authHint = pushAuthHint(r3.status, pushToken, pushTarget, !!ownerIssue);
|
|
287412
287731
|
const hint = authHint ?? releaseIdExistsHint(r3.status, r3.json);
|
|
287413
287732
|
print(pushFailure2("upload_http_error", { ok: false, status: r3.status, body: r3.json ?? r3.text, ...hint ? { hint } : {} }));
|
|
@@ -287770,13 +288089,13 @@ async function packCommand(ctx) {
|
|
|
287770
288089
|
// src/commands/import.ts
|
|
287771
288090
|
init_define_HHP_CATALOG();
|
|
287772
288091
|
init_cli_shared();
|
|
287773
|
-
import { existsSync as existsSync121, readdirSync as readdirSync54, statSync as
|
|
288092
|
+
import { existsSync as existsSync121, readdirSync as readdirSync54, statSync as statSync43 } from "node:fs";
|
|
287774
288093
|
import { resolve as resolve99 } from "node:path";
|
|
287775
288094
|
function restoreDestinationIssue(dest, force) {
|
|
287776
288095
|
const link4 = symlinkDestinationIssue(dest);
|
|
287777
288096
|
if (link4) return link4;
|
|
287778
288097
|
if (!existsSync121(dest)) return null;
|
|
287779
|
-
if (!
|
|
288098
|
+
if (!statSync43(dest).isDirectory()) {
|
|
287780
288099
|
return { error: `${dest} exists and is not a directory`, hint: "pass --out/--name to land somewhere else, or remove the file" };
|
|
287781
288100
|
}
|
|
287782
288101
|
if (readdirSync54(dest).length > 0 && !force) {
|
|
@@ -290304,10 +290623,11 @@ init_browser_login();
|
|
|
290304
290623
|
init_wix_owner();
|
|
290305
290624
|
init_owner_claim();
|
|
290306
290625
|
init_cli_shared();
|
|
290626
|
+
init_identity_providers();
|
|
290307
290627
|
var LOGIN_HELP = `himi login \u2014 get a scoped serve-control token and store it in
|
|
290308
290628
|
~/.himalaya/serve-targets.json, so push / promote / preview need no pasted token.
|
|
290309
290629
|
|
|
290310
|
-
himi login [--browser | --device [--site <msid>] [--redirect-uri <uri>] [--no-wait] | --wix [--wix-token-stdin] | --dpx] [--target <t>] [--no-open]
|
|
290630
|
+
himi login [--browser [--provider <id>] | --device [--provider <id>] [--site <msid>] [--redirect-uri <uri>] [--no-wait] | --wix [--wix-token-stdin] | --dpx] [--target <t>] [--no-open]
|
|
290311
290631
|
himi login --device --resume [--timeout <s>] [--target <t>]
|
|
290312
290632
|
|
|
290313
290633
|
MODES \u2014 pick by who is at the keyboard
|
|
@@ -290316,6 +290636,9 @@ MODES \u2014 pick by who is at the keyboard
|
|
|
290316
290636
|
off-repo, so a bare \`himi login\` there is this mode. --no-open prints the URL,
|
|
290317
290637
|
but the sign-in still posts back to THIS machine, so the browser must run here
|
|
290318
290638
|
(otherwise use --device).
|
|
290639
|
+
--provider <id> sign in WITHOUT a Wix account where the plane offers it
|
|
290640
|
+
(base44, \u2026): the browser goes straight to that sign-in. Such a login is
|
|
290641
|
+
stored with a refresh token and renews itself when it expires.
|
|
290319
290642
|
--wix HEADLESS \u2014 the mode a server, a CI job or an agent container can satisfy. It
|
|
290320
290643
|
presents, in order: the owner's Wix token piped on stdin (--wix-token-stdin),
|
|
290321
290644
|
WIX_TOKEN, WIX_API_KEY (a Wix account API key), else the machine's EXISTING Wix
|
|
@@ -290331,6 +290654,12 @@ MODES \u2014 pick by who is at the keyboard
|
|
|
290331
290654
|
the URL on ANY device where they are signed in to wix.com and approves. This
|
|
290332
290655
|
waits (up to 10 minutes) and stores the same token --browser does. Show the
|
|
290333
290656
|
owner the URL and the code, and check they see the same code.
|
|
290657
|
+
NO WIX ACCOUNT? Where the plane offers it, the page also lets the person sign
|
|
290658
|
+
in another way (Base44, later GitHub); the token then names them as
|
|
290659
|
+
<provider>:<id> and the JSON says "credential": "federated". Such an account
|
|
290660
|
+
can push releases and read, not run \`himi dist\` or promote yet.
|
|
290661
|
+
--provider <id> put the sign-in choice in the link (wix, base44, \u2026) so the
|
|
290662
|
+
person is not asked; \`--provider wix\` skips the choice today.
|
|
290334
290663
|
--site <msid> also asks to connect that site's live data: the owner picks or
|
|
290335
290664
|
confirms the site on the approve page, and the plane finds or creates the
|
|
290336
290665
|
site's Headless OAuth client with the owner's session. You get the client id
|
|
@@ -290371,7 +290700,9 @@ function credentialSwapNotice(prevToken, nextToken, target) {
|
|
|
290371
290700
|
const prev = credentialKind(prevToken);
|
|
290372
290701
|
const next = credentialKind(nextToken);
|
|
290373
290702
|
if (!prev || !next || prev === next) return void 0;
|
|
290374
|
-
const
|
|
290703
|
+
const nextTier = KIND_TIER[next];
|
|
290704
|
+
const prevTier = KIND_TIER[prev];
|
|
290705
|
+
const tierLine = !nextTier ? "`himi dist` is not available to accounts signed in without Wix yet." : !prevTier ? `\`himi dist\` becomes available, on the ${nextTier} tier.` : `\`himi dist\` will now charge the ${nextTier} tier instead of the ${prevTier} one.`;
|
|
290375
290706
|
const back = kindLoginBack(prev, target);
|
|
290376
290707
|
const backLine = back ? ` \`${back}\` switches back.` : "";
|
|
290377
290708
|
return `replacing the ${KIND_LABEL[prev]} credential for target "${target}" with a ${KIND_LABEL[next]} one. ${tierLine}${backLine}`;
|
|
@@ -290397,6 +290728,9 @@ function deviceSiteOutcome(ctx, target, site) {
|
|
|
290397
290728
|
ctx.io.error(`Site ${site.msid}: Headless client ${site.clientId} (${site.action ?? "resolved"}), kept for \`himi site client list --site ${site.msid}\`.`);
|
|
290398
290729
|
} else if (site.action === "none") {
|
|
290399
290730
|
ctx.io.error(`The owner approved the sign-in without connecting site ${site.msid ?? ""}.`.replace(" .", "."));
|
|
290731
|
+
} else if (site.error === "site_requires_wix_account") {
|
|
290732
|
+
out2.hint = `connecting a Wix site needs a Wix account: run \`himi login --device --provider wix --site ${site.msid ?? "<msid>"} --target ${target}\` and sign in with Wix. This login itself succeeded.`;
|
|
290733
|
+
ctx.io.error(`Site ${site.msid ?? "(unknown)"} was not connected: connecting a Wix site needs a Wix account, and this sign-in is not one. The login itself succeeded.`);
|
|
290400
290734
|
} else if (site.error) {
|
|
290401
290735
|
ctx.io.error(`Site ${site.msid ?? "(unknown)"} was not connected (${site.error}). The signed-in tool still works; the owner can copy the client id from ${site.fallbackUrl ?? "the site dashboard's OAuth apps page"}.`);
|
|
290402
290736
|
}
|
|
@@ -290411,7 +290745,18 @@ var devicePoster = (base2) => (path2, body, timeoutMs = 3e4) => fetch(`${base2}$
|
|
|
290411
290745
|
signal: AbortSignal.timeout(timeoutMs)
|
|
290412
290746
|
});
|
|
290413
290747
|
var deviceResumeCommand = (target) => `himi login --device --resume --target ${target}`;
|
|
290414
|
-
|
|
290748
|
+
function deviceLinkWithProvider(link4, provider) {
|
|
290749
|
+
if (!provider) return link4;
|
|
290750
|
+
try {
|
|
290751
|
+
const u2 = new URL(link4);
|
|
290752
|
+
u2.searchParams.set("provider", provider);
|
|
290753
|
+
return u2.toString();
|
|
290754
|
+
} catch {
|
|
290755
|
+
return link4;
|
|
290756
|
+
}
|
|
290757
|
+
}
|
|
290758
|
+
var LOGIN_PROVIDER_RE = /^[a-z][a-z0-9]{1,15}$/;
|
|
290759
|
+
async function startDeviceGrant(ctx, target, base2, siteReq, provider) {
|
|
290415
290760
|
const { io: io2 } = ctx;
|
|
290416
290761
|
const clock = deviceClock(ctx);
|
|
290417
290762
|
let start2;
|
|
@@ -290436,11 +290781,13 @@ async function startDeviceGrant(ctx, target, base2, siteReq) {
|
|
|
290436
290781
|
return 1;
|
|
290437
290782
|
}
|
|
290438
290783
|
const expiresMs = Math.max(0, Number(grant.expires_in) || 0) * 1e3;
|
|
290784
|
+
const complete = provider ? deviceLinkWithProvider(grant.verification_uri_complete ?? grant.verification_uri, provider) : grant.verification_uri_complete;
|
|
290439
290785
|
return {
|
|
290440
290786
|
deviceCode: grant.device_code,
|
|
290441
290787
|
userCode: grant.user_code,
|
|
290442
290788
|
verificationUri: grant.verification_uri,
|
|
290443
|
-
...
|
|
290789
|
+
...complete ? { verificationUriComplete: complete } : {},
|
|
290790
|
+
...provider ? { provider } : {},
|
|
290444
290791
|
expiresAt: clock.now() + Math.min(expiresMs || DEVICE_MAX_WAIT_MS, DEVICE_MAX_WAIT_MS),
|
|
290445
290792
|
interval: Math.max(1, Number(grant.interval) || DEVICE_DEFAULT_INTERVAL_SEC)
|
|
290446
290793
|
};
|
|
@@ -290465,14 +290812,28 @@ function classifyDevicePoll(resp, body, interval, target) {
|
|
|
290465
290812
|
}
|
|
290466
290813
|
};
|
|
290467
290814
|
}
|
|
290815
|
+
var FEDERATED_LIMITS = "accounts signed in without Wix can claim apps, push releases and read; `himi dist`, promote, revoke and app-config are not available yet. The login renews itself for up to 30 days of use.";
|
|
290816
|
+
function deviceIdentity(token, polledSub) {
|
|
290817
|
+
const claimed = decodeControlTokenClaims(token)?.sub;
|
|
290818
|
+
const sub = polledSub ?? (typeof claimed === "string" ? claimed : void 0);
|
|
290819
|
+
const fed = sub ? parseFederatedSubject(sub) : null;
|
|
290820
|
+
const credential = fed ? "federated" : credentialKind(token) ?? void 0;
|
|
290821
|
+
return {
|
|
290822
|
+
...sub ? { sub, provider: fed ? fed.provider : "wix" } : {},
|
|
290823
|
+
...credential ? { credential } : {}
|
|
290824
|
+
};
|
|
290825
|
+
}
|
|
290468
290826
|
function storeDeviceToken(ctx, target, prevControlToken, token, body) {
|
|
290469
|
-
const
|
|
290827
|
+
const refreshToken = typeof body.refresh_token === "string" && body.refresh_token ? body.refresh_token : void 0;
|
|
290828
|
+
const storedAt = saveControlToken(target, token, void 0, refreshToken);
|
|
290470
290829
|
let exp;
|
|
290471
290830
|
try {
|
|
290472
290831
|
exp = JSON.parse(Buffer.from(token.split(".")[0], "base64url").toString("utf8")).exp;
|
|
290473
290832
|
} catch {
|
|
290474
290833
|
}
|
|
290475
290834
|
const swap = credentialSwapNotice(prevControlToken, token, target);
|
|
290835
|
+
const who2 = deviceIdentity(token, body.sub);
|
|
290836
|
+
if (who2.sub) ctx.io.error(`Signed in as ${who2.sub} (${who2.provider === "wix" ? "Wix account" : `signed in with ${who2.provider}, no Wix account`}).`);
|
|
290476
290837
|
const site = body.site && typeof body.site === "object" ? deviceSiteOutcome(ctx, target, body.site) : void 0;
|
|
290477
290838
|
ctx.print({
|
|
290478
290839
|
ok: true,
|
|
@@ -290482,6 +290843,10 @@ function storeDeviceToken(ctx, target, prevControlToken, token, body) {
|
|
|
290482
290843
|
exp,
|
|
290483
290844
|
scope: body.scope,
|
|
290484
290845
|
storedAt,
|
|
290846
|
+
...who2.credential ? { credential: who2.credential } : {},
|
|
290847
|
+
...who2.provider ? { provider: who2.provider } : {},
|
|
290848
|
+
...refreshToken ? { refreshable: true } : {},
|
|
290849
|
+
...who2.credential === "federated" ? { limits: FEDERATED_LIMITS } : {},
|
|
290485
290850
|
...site ? { site } : {},
|
|
290486
290851
|
...swap ? { notice: swap } : {},
|
|
290487
290852
|
...Array.isArray(body.scope) && body.scope.length === 0 ? { hint: "you own no apps yet \u2014 claim one with `himi apps claim <slug>`" } : {}
|
|
@@ -290490,16 +290855,16 @@ function storeDeviceToken(ctx, target, prevControlToken, token, body) {
|
|
|
290490
290855
|
}
|
|
290491
290856
|
function showDeviceCode(ctx, grant, tail) {
|
|
290492
290857
|
const link4 = grant.verificationUriComplete ?? grant.verificationUri;
|
|
290493
|
-
ctx.io.error("To sign in, the Wix account owner opens this link on any device where they are signed in to wix.com:");
|
|
290858
|
+
ctx.io.error(grant.provider && grant.provider !== "wix" ? `To sign in, the person opens this link on any device and signs in with ${grant.provider}:` : "To sign in, the Wix account owner opens this link on any device where they are signed in to wix.com:");
|
|
290494
290859
|
ctx.io.error(` ${link4}`);
|
|
290495
290860
|
ctx.io.error(`and approves code ${grant.userCode} (or opens ${grant.verificationUri} and types it). ${tail}`);
|
|
290496
290861
|
}
|
|
290497
|
-
async function deviceLogin(ctx, target, ownerIssue, prevControlToken, siteReq = {}) {
|
|
290862
|
+
async function deviceLogin(ctx, target, ownerIssue, prevControlToken, siteReq = {}, provider) {
|
|
290498
290863
|
const { io: io2 } = ctx;
|
|
290499
290864
|
const clock = deviceClock(ctx);
|
|
290500
290865
|
const base2 = ownerIssue.replace(/\/$/, "");
|
|
290501
290866
|
const post = devicePoster(base2);
|
|
290502
|
-
const grant = await startDeviceGrant(ctx, target, base2, siteReq);
|
|
290867
|
+
const grant = await startDeviceGrant(ctx, target, base2, siteReq, provider);
|
|
290503
290868
|
if (typeof grant === "number") return grant;
|
|
290504
290869
|
const deadline = grant.expiresAt;
|
|
290505
290870
|
let interval = grant.interval;
|
|
@@ -290528,10 +290893,10 @@ async function deviceLogin(ctx, target, ownerIssue, prevControlToken, siteReq =
|
|
|
290528
290893
|
return 1;
|
|
290529
290894
|
}
|
|
290530
290895
|
}
|
|
290531
|
-
async function deviceLoginStart(ctx, target, ownerIssue, siteReq) {
|
|
290896
|
+
async function deviceLoginStart(ctx, target, ownerIssue, siteReq, provider) {
|
|
290532
290897
|
const clock = deviceClock(ctx);
|
|
290533
290898
|
const base2 = ownerIssue.replace(/\/$/, "");
|
|
290534
|
-
const grant = await startDeviceGrant(ctx, target, base2, siteReq);
|
|
290899
|
+
const grant = await startDeviceGrant(ctx, target, base2, siteReq, provider);
|
|
290535
290900
|
if (typeof grant === "number") return grant;
|
|
290536
290901
|
savePendingDeviceLogin(target, {
|
|
290537
290902
|
deviceCode: grant.deviceCode,
|
|
@@ -290721,6 +291086,27 @@ async function loginCommand(ctx) {
|
|
|
290721
291086
|
io2.error(JSON.stringify({ error: "--redirect-uri is the redirect for the site's client: pass it with --site <msid>" }));
|
|
290722
291087
|
return 2;
|
|
290723
291088
|
}
|
|
291089
|
+
const providerFlag = str3(flags.provider)?.trim().toLowerCase();
|
|
291090
|
+
if (flags.provider !== void 0 && (flags.wix || flags.dpx)) {
|
|
291091
|
+
io2.error(JSON.stringify({ error: "--provider picks the sign-in for `himi login --device` or `--browser` only" }));
|
|
291092
|
+
return 2;
|
|
291093
|
+
}
|
|
291094
|
+
if (flags.provider !== void 0 && !flags.device && !flags.browser && !(!flags.wix && !flags.dpx && !issue3 && ownerIssue)) {
|
|
291095
|
+
io2.error(JSON.stringify({ error: "--provider picks the sign-in for `himi login --device` or `--browser`: pass one of them" }));
|
|
291096
|
+
return 2;
|
|
291097
|
+
}
|
|
291098
|
+
if (flags.provider !== void 0 && resume2) {
|
|
291099
|
+
io2.error(JSON.stringify({ error: "--provider goes on the start (`himi login --device --no-wait --provider <id>`); --resume polls the login that start began" }));
|
|
291100
|
+
return 2;
|
|
291101
|
+
}
|
|
291102
|
+
if (flags.provider !== void 0 && !(providerFlag && LOGIN_PROVIDER_RE.test(providerFlag))) {
|
|
291103
|
+
io2.error(JSON.stringify({ error: `--provider needs a sign-in id such as wix or base44, got ${JSON.stringify(flags.provider)}` }));
|
|
291104
|
+
return 2;
|
|
291105
|
+
}
|
|
291106
|
+
if (providerFlag && providerFlag !== "wix" && flags.site !== void 0) {
|
|
291107
|
+
io2.error(JSON.stringify({ error: `--site connects a Wix site, which needs a Wix account: drop --site, or use --provider wix`, code: "site_requires_wix_account" }));
|
|
291108
|
+
return 2;
|
|
291109
|
+
}
|
|
290724
291110
|
if (flags["wix-token-stdin"] && !flags.wix) {
|
|
290725
291111
|
io2.error(JSON.stringify({ error: "--wix-token-stdin needs --wix: `himi login --wix --wix-token-stdin`" }));
|
|
290726
291112
|
return 2;
|
|
@@ -290747,8 +291133,8 @@ async function loginCommand(ctx) {
|
|
|
290747
291133
|
...siteFlag ? { site: siteFlag.trim().toLowerCase() } : {},
|
|
290748
291134
|
...redirectFlag?.trim() ? { redirectUri: redirectFlag.trim() } : {}
|
|
290749
291135
|
};
|
|
290750
|
-
if (noWait) return deviceLoginStart(ctx, target, ownerIssue, siteReq);
|
|
290751
|
-
return deviceLogin(ctx, target, ownerIssue, prevControlToken, siteReq);
|
|
291136
|
+
if (noWait) return deviceLoginStart(ctx, target, ownerIssue, siteReq, providerFlag);
|
|
291137
|
+
return deviceLogin(ctx, target, ownerIssue, prevControlToken, siteReq, providerFlag);
|
|
290752
291138
|
}
|
|
290753
291139
|
if (flags.wix) {
|
|
290754
291140
|
if (!ownerIssue) {
|
|
@@ -290884,7 +291270,9 @@ async function loginCommand(ctx) {
|
|
|
290884
291270
|
result = await browserLogin2({
|
|
290885
291271
|
ownerIssue,
|
|
290886
291272
|
noOpen: !!flags["no-open"],
|
|
290887
|
-
log: (line) => io2.error(line)
|
|
291273
|
+
log: (line) => io2.error(line),
|
|
291274
|
+
// `--provider <id>`: the plane's cli-login sends the browser straight to that sign-in.
|
|
291275
|
+
...providerFlag ? { query: { provider: providerFlag } } : {}
|
|
290888
291276
|
});
|
|
290889
291277
|
} catch (e2) {
|
|
290890
291278
|
io2.error(JSON.stringify({
|
|
@@ -290893,7 +291281,10 @@ async function loginCommand(ctx) {
|
|
|
290893
291281
|
}));
|
|
290894
291282
|
return 1;
|
|
290895
291283
|
}
|
|
290896
|
-
const
|
|
291284
|
+
const refreshToken = typeof result.extra.refresh_token === "string" && result.extra.refresh_token ? result.extra.refresh_token : void 0;
|
|
291285
|
+
const storedAt2 = saveControlToken(target, result.token, void 0, refreshToken);
|
|
291286
|
+
const who2 = deviceIdentity(result.token, void 0);
|
|
291287
|
+
if (who2.sub) io2.error(`Signed in as ${who2.sub} (${who2.provider === "wix" ? "Wix account" : `signed in with ${who2.provider}, no Wix account`}).`);
|
|
290897
291288
|
let scope3;
|
|
290898
291289
|
let exp;
|
|
290899
291290
|
let sub;
|
|
@@ -290913,6 +291304,10 @@ async function loginCommand(ctx) {
|
|
|
290913
291304
|
exp,
|
|
290914
291305
|
scope: scope3,
|
|
290915
291306
|
storedAt: storedAt2,
|
|
291307
|
+
...who2.credential ? { credential: who2.credential } : {},
|
|
291308
|
+
...who2.provider ? { provider: who2.provider } : {},
|
|
291309
|
+
...refreshToken ? { refreshable: true } : {},
|
|
291310
|
+
...who2.credential === "federated" ? { limits: FEDERATED_LIMITS } : {},
|
|
290916
291311
|
...swap2 ? { notice: swap2 } : {},
|
|
290917
291312
|
...Array.isArray(scope3) && scope3.length === 0 ? { hint: "you own no apps yet \u2014 claim one with `himi apps claim <slug>`" } : {}
|
|
290918
291313
|
});
|
|
@@ -291303,7 +291698,7 @@ async function upgradeCommand(ctx) {
|
|
|
291303
291698
|
// src/commands/doctor.ts
|
|
291304
291699
|
init_define_HHP_CATALOG();
|
|
291305
291700
|
init_config();
|
|
291306
|
-
import { statSync as
|
|
291701
|
+
import { statSync as statSync46, accessSync as accessSync5, constants as constants11 } from "node:fs";
|
|
291307
291702
|
import { join as join173 } from "node:path";
|
|
291308
291703
|
init_wix_owner();
|
|
291309
291704
|
init_owner_claim();
|
|
@@ -291375,7 +291770,7 @@ function executableOnPath(name, env = process.env) {
|
|
|
291375
291770
|
for (const suffix of suffixes) {
|
|
291376
291771
|
const candidate = join173(dir, `${name}${suffix}`);
|
|
291377
291772
|
try {
|
|
291378
|
-
if (!
|
|
291773
|
+
if (!statSync46(candidate).isFile()) continue;
|
|
291379
291774
|
if (process.platform !== "win32") accessSync5(candidate, constants11.X_OK);
|
|
291380
291775
|
return true;
|
|
291381
291776
|
} catch {
|
|
@@ -292863,19 +293258,19 @@ init_define_HHP_CATALOG();
|
|
|
292863
293258
|
init_cli_shared();
|
|
292864
293259
|
import { randomBytes as randomBytes24 } from "node:crypto";
|
|
292865
293260
|
import {
|
|
292866
|
-
closeSync as
|
|
293261
|
+
closeSync as closeSync14,
|
|
292867
293262
|
constants as constants12,
|
|
292868
293263
|
existsSync as existsSync137,
|
|
292869
293264
|
fstatSync as fstatSync4,
|
|
292870
293265
|
lstatSync as lstatSync37,
|
|
292871
293266
|
mkdirSync as mkdirSync61,
|
|
292872
|
-
openSync as
|
|
293267
|
+
openSync as openSync13,
|
|
292873
293268
|
readFileSync as readFileSync166,
|
|
292874
293269
|
readdirSync as readdirSync59,
|
|
292875
293270
|
realpathSync as realpathSync22,
|
|
292876
293271
|
renameSync as renameSync25,
|
|
292877
293272
|
rmSync as rmSync40,
|
|
292878
|
-
statSync as
|
|
293273
|
+
statSync as statSync47,
|
|
292879
293274
|
writeFileSync as writeFileSync61
|
|
292880
293275
|
} from "node:fs";
|
|
292881
293276
|
import { basename as basename41, dirname as dirname81, join as join179, relative as relative35, resolve as resolve113 } from "node:path";
|
|
@@ -292888,12 +293283,12 @@ function readRegularFile(path2) {
|
|
|
292888
293283
|
const st2 = lstatSync37(path2);
|
|
292889
293284
|
if (st2.isSymbolicLink()) throw new UnsafePath(`${path2} is a symbolic link`);
|
|
292890
293285
|
if (!st2.isFile()) throw new Error(`${path2} is not a regular file`);
|
|
292891
|
-
const fd =
|
|
293286
|
+
const fd = openSync13(path2, constants12.O_RDONLY | (constants12.O_NOFOLLOW ?? 0));
|
|
292892
293287
|
try {
|
|
292893
293288
|
if (!fstatSync4(fd).isFile()) throw new Error(`${path2} is not a regular file`);
|
|
292894
293289
|
return readFileSync166(fd);
|
|
292895
293290
|
} finally {
|
|
292896
|
-
|
|
293291
|
+
closeSync14(fd);
|
|
292897
293292
|
}
|
|
292898
293293
|
}
|
|
292899
293294
|
function unsafeDestination(appDir3, tags) {
|
|
@@ -292961,7 +293356,7 @@ async function l10nCommand(ctx) {
|
|
|
292961
293356
|
return fail16("invalid_usage", { error: "name the app: --app <slug> (in a checkout) or --content <app dir>" }, 2);
|
|
292962
293357
|
}
|
|
292963
293358
|
const messagesDir = resolve113(dirArg);
|
|
292964
|
-
if (!existsSync137(messagesDir) || !
|
|
293359
|
+
if (!existsSync137(messagesDir) || !statSync47(messagesDir).isDirectory()) {
|
|
292965
293360
|
return fail16("messages_dir_not_found", { error: `${dirArg} is not a directory`, dir: messagesDir }, 1);
|
|
292966
293361
|
}
|
|
292967
293362
|
const fileByTag = /* @__PURE__ */ new Map();
|
|
@@ -294208,6 +294603,14 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
|
|
|
294208
294603
|
runReleasePatch,
|
|
294209
294604
|
patchBlastRadius
|
|
294210
294605
|
};
|
|
294606
|
+
if (command && command !== "login" && command !== "logout" && flags.help !== true && !str3(flags["control-token"]) && !process.env.HIMI_CONTROL_TOKEN) {
|
|
294607
|
+
try {
|
|
294608
|
+
const { refreshStoredLogin: refreshStoredLogin2 } = await Promise.resolve().then(() => (init_login_refresh(), login_refresh_exports));
|
|
294609
|
+
const renewed = await refreshStoredLogin2(targetName2());
|
|
294610
|
+
if (!renewed.ok) io2.error(JSON.stringify({ warning: "login_refresh_failed", code: renewed.code, error: renewed.error, hint: renewed.hint }));
|
|
294611
|
+
} catch {
|
|
294612
|
+
}
|
|
294613
|
+
}
|
|
294211
294614
|
try {
|
|
294212
294615
|
switch (command) {
|
|
294213
294616
|
case "captcha":
|
|
@@ -46,6 +46,10 @@ A `429` while polling is not a failure: the CLI backs off by the plane's `retryA
|
|
|
46
46
|
|
|
47
47
|
`himi login --device --no-wait` prints `{ ok: true, pending: true, via: "device", target, verificationUri, verificationUriComplete, userCode, expiresAt, interval, resume }` on stdout and exits 0 without waiting; its start failures carry the codes above. `--resume` then polls with the same backoff and codes and exits 0 with the usual success envelope, 3 with `device_pending`, or 1. With `--resume`, `device_code_expired` also means the code's lifetime passed locally, and `device_code_expired` and `device_access_denied` remove the pending login. Usage errors (`--resume` with `--no-wait`, `--site` or `--redirect-uri`; `--timeout` without `--resume` or outside 1–600 seconds) exit 2.
|
|
48
48
|
|
|
49
|
+
**Signing in without a Wix account.** Where the plane offers it, the device page also lets a person sign in another way (Base44 first). The success envelope then carries `credential: "federated"`, `provider` (e.g. `"base44"`), `sub` as `<provider>:<id>`, and `limits` (what such an account cannot do yet); a Wix sign-in carries `provider: "wix"` and its own `credential` (`self-serve`, …). `--provider <id>` adds `provider=<id>` to `verificationUriComplete` so the page can skip its choice (`--provider wix` does today); it goes on the start, never on `--resume`, and `--provider <non-wix> --site` exits 2 with `code: "site_requires_wix_account"`. When a site was requested and the sign-in was not a Wix account, the login still succeeds and `site.error` is `"site_requires_wix_account"`, with a `site.hint` naming the Wix login that connects the site.
|
|
50
|
+
|
|
51
|
+
**Renewing a login without a Wix account.** `himi login --browser --provider <id>` (and a device login, when the person signs in that way) also receives the plane's refresh token. It is stored beside the control token in `serve-targets.json` (owner-only) and never printed; the success envelope says `refreshable: true`. Before any command other than `login`/`logout`, an expired stored federated token is renewed from it (one request, rotating the refresh token); `himi mcp` tools run through the same path, so they keep reusing the login. A failed renewal is a stderr line `{ warning: "login_refresh_failed", code, error, hint }` (`code` is `login_expired`, `federated_disabled` or `refresh_unavailable`) and the command goes on with what is stored. `himi push` that gets 401 on such a login renews once and retries the publish once; `--control-token` and `HIMI_CONTROL_TOKEN` are never renewed.
|
|
52
|
+
|
|
49
53
|
### `himi login --device --site`: `site.error` codes
|
|
50
54
|
|
|
51
55
|
With `--site <msid>`, the success envelope (exit 0) carries a `site` block. On success it is
|
|
@@ -311,7 +315,17 @@ worker's bundle. These names are stable.
|
|
|
311
315
|
| `upload_http_error` | The upload returned a non-success HTTP status. `status` and the original `body` remain available; server errors never replace this CLI code. |
|
|
312
316
|
| `binary_capability_gap` | The publish was refused (409): it declares a permission-bearing capability (iOS usage string or entitlement, Android permission) the app's last successful `himi dist` was not built with. `missing` names the ids; `dists` lists each platform's last dist that lacks them (`platform`, `jobId`, `missing`). The same code comes from `himi push --only` and `himi patch`. Run `himi dist` first, or re-run with `--allow-binary-gap`. |
|
|
313
317
|
| `native_build_required` | `himi push --require-ota` and the release needs a new binary: it declares a capability that at least one of the app's live binaries — its newest successful `himi dist` per platform — does not carry. The publish was refused (409) before anything was written. Carries `nativeCompatibility: "needs_binary"`, `missing` (the ids), and `nativeFingerprints.live` (one row per live binary: `platform`, `jobId`, `fingerprint`, `missing`, and `needed`, the fingerprint a binary of that shell and core would need). Run `himi dist` and ship that binary first, or drop `--require-ota`. Without the flag the same release publishes and the success envelope says `nativeCompatibility: "needs_binary"`. When the app has no recorded dist there is nothing to compare with, so nothing is refused. |
|
|
314
|
-
| `claim_failed` | Auto-claim returned a fatal refusal. Existing server fields and `status` remain available. |
|
|
318
|
+
| `claim_failed` | Auto-claim returned a fatal refusal (including `claim_limit_reached` for a Wix credential). Existing server fields and `status` remain available. |
|
|
319
|
+
| `federated_not_allowed` | The plane refused (403) an action that accounts signed in without a Wix account cannot take yet. Such an account can claim, publish a release and read; `himi dist`, promote, revoke, app-config, projects and the other owner routes are refused. `status`, `body` and a `hint` are kept. Sign in with Wix (`himi login --device --provider wix`) for the rest. |
|
|
320
|
+
| `federated_disabled` | A credential signed in without a Wix account (its `sub` is `<provider>:<id>`) was refused 401 before it had expired: this plane has sign-in without Wix switched off. The login itself is fine. Sign in with Wix, or try again later. An expired credential keeps `control_token_expired`. |
|
|
321
|
+
| `federated_storage_full` | The plane refused (413) a publish from an account signed in without a Wix account because it has used its published-bytes allowance. `status`, `body` and a `hint` are kept. Publish a smaller release, or sign in with Wix. |
|
|
322
|
+
| `login_expired` | The stored login signed in without a Wix account was refused 401 and could not be renewed: the plane answered `invalid_grant` or `token_revoked` to its refresh token (unused for 30 days, revoked, or spent twice). Nothing is published. Sign in again (`himi login --browser` or `--device`). |
|
|
323
|
+
| `base44_app_not_owned` | The auto-claim asked to bind the app to its Base44 app (config.ts `base44.appId`, sent only for a Base44 sign-in) and Base44 did not list that app as the signer's at their last sign-in (403). Nothing is claimed or published. Sign in with Base44 again as the app's owner. `base44AppId` is in the envelope. |
|
|
324
|
+
| `base44_app_taken` | That Base44 app is already bound to another Himi app or account (409). Nothing is claimed or published. |
|
|
325
|
+
| `base44_app_requires_base44_signin` | A Base44 app id was sent with a credential that did not sign in with Base44 (403). |
|
|
326
|
+
| `invalid_base44_app_id` | The plane refused the Base44 app id's shape (400): fix `base44.appId` in config.ts. |
|
|
327
|
+
| `insufficient_scope` | The plane refused (403) because the credential is scoped (its `scopes` claim) and lacks the scope this action needs; `body.scope` names it. A login without a Wix account carries `apps:read`, `apps:publish` and `apps:live`, no `dist`. A live publish without `apps:live` is refused this way: push with `--draft`. |
|
|
328
|
+
| `federated_quota_exceeded` | A credential signed in without a Wix account hit one of its limits: the claim cap (`claim_limit_reached`, 10 apps, from the auto-claim) or the release rate (`release_rate_limited`, with `retryAfterSec` in `body`). The same 429s on a Wix credential keep `claim_failed` / `upload_http_error`. |
|
|
315
329
|
| `invalid_flag_value` | A flag violates the CLI flag grammar. |
|
|
316
330
|
| `invalid_selector` | `--only` is missing a selector or its selector syntax is invalid. |
|
|
317
331
|
| `duplicate_only` | `--only` was repeated. |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/himalaya-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1786.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "himi — the Himalaya authoring CLI. Build a Tier-5 content package on your own machine, push it to the production serve as a draft, preview it on web + Himi Player, and read worker logs back — the remote dev loop. Wraps @himalaya/serve-cli for transport.",
|
|
6
6
|
"keywords": [
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"artifactId": "himalaya-cli"
|
|
83
83
|
}
|
|
84
84
|
},
|
|
85
|
-
"falconPackageHash": "
|
|
85
|
+
"falconPackageHash": "edb7e6de2e862362bfb18c43d0f9b10d7c498a76fd21fc666ff7bbc6"
|
|
86
86
|
}
|