@powerhousedao/ph-cli 6.1.0 → 6.2.0-dev.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-connect-override-DHpuwyEn.mjs +274 -0
- package/dist/cli-connect-override-DHpuwyEn.mjs.map +1 -0
- package/dist/cli.mjs +59 -28
- package/dist/cli.mjs.map +1 -1
- package/dist/{connect-build-DA5QOP5h.mjs → connect-build-DDWHr6nw.mjs} +9 -6
- package/dist/connect-build-DDWHr6nw.mjs.map +1 -0
- package/dist/connect-config-DQcIDdtP.mjs +187 -0
- package/dist/connect-config-DQcIDdtP.mjs.map +1 -0
- package/dist/{connect-preview-DQnzviwA.mjs → connect-preview-D7ypzFDc.mjs} +4 -6
- package/dist/connect-preview-D7ypzFDc.mjs.map +1 -0
- package/dist/{connect-studio-DTdSFftL.mjs → connect-studio-BbxxxUZ9.mjs} +7 -7
- package/dist/connect-studio-BbxxxUZ9.mjs.map +1 -0
- package/dist/connect-studio-YDVQ49D6.mjs +5 -0
- package/dist/{generate-all-WiQQo-Nz.mjs → generate-all-DrT4ZxHX.mjs} +3 -3
- package/dist/{generate-all-WiQQo-Nz.mjs.map → generate-all-DrT4ZxHX.mjs.map} +1 -1
- package/dist/{generate-app-DdmOt6ID.mjs → generate-app-DNNqA-H3.mjs} +3 -3
- package/dist/{generate-app-DdmOt6ID.mjs.map → generate-app-DNNqA-H3.mjs.map} +1 -1
- package/dist/{generate-document-model-DQ5PVeIH.mjs → generate-document-model-BJXyODfm.mjs} +3 -3
- package/dist/{generate-document-model-DQ5PVeIH.mjs.map → generate-document-model-BJXyODfm.mjs.map} +1 -1
- package/dist/{generate-editor-DtzVAs6x.mjs → generate-editor-BejvaVVT.mjs} +3 -3
- package/dist/{generate-editor-DtzVAs6x.mjs.map → generate-editor-BejvaVVT.mjs.map} +1 -1
- package/dist/{generate-processor-FGtN6BVY.mjs → generate-processor-_WOx-mMe.mjs} +3 -3
- package/dist/{generate-processor-FGtN6BVY.mjs.map → generate-processor-_WOx-mMe.mjs.map} +1 -1
- package/dist/{generate-subgraph-BrzmW_sj.mjs → generate-subgraph-BsHUstpl.mjs} +3 -3
- package/dist/{generate-subgraph-BrzmW_sj.mjs.map → generate-subgraph-BsHUstpl.mjs.map} +1 -1
- package/dist/{init-Cu3_NRHL.mjs → init-D3toc_qO.mjs} +3 -3
- package/dist/{init-Cu3_NRHL.mjs.map → init-D3toc_qO.mjs.map} +1 -1
- package/dist/{inspect-BwuBW_zW.mjs → inspect-CKdafPbC.mjs} +4 -4
- package/dist/{inspect-BwuBW_zW.mjs.map → inspect-CKdafPbC.mjs.map} +1 -1
- package/dist/{migrate-CfgiCNQo.mjs → migrate-BJQvY88v.mjs} +3 -3
- package/dist/{migrate-CfgiCNQo.mjs.map → migrate-BJQvY88v.mjs.map} +1 -1
- package/dist/{registry-auth-CNH84uo4.mjs → registry-auth-DxEWCJu2.mjs} +3 -3
- package/dist/{registry-auth-CNH84uo4.mjs.map → registry-auth-DxEWCJu2.mjs.map} +1 -1
- package/dist/{switchboard-CERuSM8r.mjs → switchboard-CJMoMzWx.mjs} +3 -3
- package/dist/{switchboard-CERuSM8r.mjs.map → switchboard-CJMoMzWx.mjs.map} +1 -1
- package/dist/switchboard-iRFugh8I.mjs +4 -0
- package/dist/{switchboard-migrate-BumRp7rC.mjs → switchboard-migrate-NQ7LHWSi.mjs} +3 -3
- package/dist/{switchboard-migrate-BumRp7rC.mjs.map → switchboard-migrate-NQ7LHWSi.mjs.map} +1 -1
- package/dist/{switchboard-reset-1YcJEVqc.mjs → switchboard-reset-BcQXlcVf.mjs} +3 -3
- package/dist/{switchboard-reset-1YcJEVqc.mjs.map → switchboard-reset-BcQXlcVf.mjs.map} +1 -1
- package/dist/{utils-mth8NsDA.mjs → utils-BaTZlyL3.mjs} +5 -5
- package/dist/utils-BaTZlyL3.mjs.map +1 -0
- package/dist/{utils-C6581aex.mjs → utils-DPGwKNam.mjs} +3 -3
- package/dist/{vetra-BgmlqLmN.mjs → vetra-DjsGCr0t.mjs} +12 -10
- package/dist/vetra-DjsGCr0t.mjs.map +1 -0
- package/package.json +13 -11
- package/dist/assign-env-vars-W-lZmdMi.mjs +0 -18
- package/dist/assign-env-vars-W-lZmdMi.mjs.map +0 -1
- package/dist/connect-build-DA5QOP5h.mjs.map +0 -1
- package/dist/connect-preview-DQnzviwA.mjs.map +0 -1
- package/dist/connect-studio-DTdSFftL.mjs.map +0 -1
- package/dist/connect-studio-DySbZFEc.mjs +0 -5
- package/dist/switchboard-ChH1PMaE.mjs +0 -4
- package/dist/utils-mth8NsDA.mjs.map +0 -1
- package/dist/vetra-BgmlqLmN.mjs.map +0 -1
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="07c21629-f10b-55aa-b4d0-374f2dbfb053")}catch(e){}}();
|
|
3
|
+
import { deepMerge, phConnectRuntimeConfigSchema } from "@powerhousedao/shared/connect";
|
|
4
|
+
import AjvNs from "ajv";
|
|
5
|
+
import { isPlainObject, stringToPath } from "remeda";
|
|
6
|
+
//#region src/utils/connect-config-validation.ts
|
|
7
|
+
const validateConnect = new (AjvNs.default ?? AjvNs)({
|
|
8
|
+
allErrors: true,
|
|
9
|
+
strict: false
|
|
10
|
+
}).compile(phConnectRuntimeConfigSchema);
|
|
11
|
+
/**
|
|
12
|
+
* Parse the CLI-supplied value. Tries JSON first so `true`, `42`, `"a"`,
|
|
13
|
+
* `null`, `[1,2]` coerce; falls back to the raw string for unquoted text.
|
|
14
|
+
*
|
|
15
|
+
* Examples:
|
|
16
|
+
* "true" -> true (boolean)
|
|
17
|
+
* "42" -> 42 (number)
|
|
18
|
+
* '"x"' -> "x" (string, quoted)
|
|
19
|
+
* "x" -> "x" (string, bare)
|
|
20
|
+
* "[1,2]" -> [1, 2] (array)
|
|
21
|
+
*/
|
|
22
|
+
function parseCliValue(raw) {
|
|
23
|
+
try {
|
|
24
|
+
return JSON.parse(raw);
|
|
25
|
+
} catch {
|
|
26
|
+
return raw;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Strip the optional leading "connect." prefix so callers can pass either
|
|
31
|
+
* "connect.renown.url" or "renown.url" interchangeably.
|
|
32
|
+
*/
|
|
33
|
+
function normalizeKey(key) {
|
|
34
|
+
return key.startsWith("connect.") ? key.slice(8) : key;
|
|
35
|
+
}
|
|
36
|
+
function formatErrors(errors) {
|
|
37
|
+
if (!errors || errors.length === 0) return "unknown validation error";
|
|
38
|
+
return errors.map((e) => {
|
|
39
|
+
return ` ${e.instancePath || "(root)"} ${e.message ?? ""}`.trim();
|
|
40
|
+
}).join("\n");
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Validate a single `<key> <value>` pair. Returns the parsed connect-partial
|
|
44
|
+
* that, when deep-merged into the existing config, applies the change.
|
|
45
|
+
*
|
|
46
|
+
* Throws on:
|
|
47
|
+
* - Empty key
|
|
48
|
+
* - Path that doesn't exist in the schema
|
|
49
|
+
* - Value whose type doesn't match the schema at the leaf path
|
|
50
|
+
*/
|
|
51
|
+
function validateConnectKeyValue(key, rawValue) {
|
|
52
|
+
const normalized = normalizeKey(key);
|
|
53
|
+
if (!normalized) throw new Error("ph connect config: key cannot be empty. Pass a dotted path inside connect.* (e.g. connect.renown.url).");
|
|
54
|
+
const parsed = parseCliValue(rawValue);
|
|
55
|
+
const stub = stringToPath(normalized).reduceRight((acc, key) => ({ [String(key)]: acc }), parsed);
|
|
56
|
+
if (!validateConnect(stub)) throw new Error(`ph connect config: validation failed for key="${normalized}" value=${JSON.stringify(parsed)} (parsed as ${typeof parsed}):\n${formatErrors(validateConnect.errors)}`);
|
|
57
|
+
return stub;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Validate a `--json` bulk override. Returns the parsed partial.
|
|
61
|
+
*
|
|
62
|
+
* `packageRegistryUrl` is a top-level runtime field (not part of the
|
|
63
|
+
* `connect.*` schema). If present in the payload, it is extracted before
|
|
64
|
+
* validation so the connect-only blob can be checked against the schema,
|
|
65
|
+
* then re-attached on the returned object so the caller can route it.
|
|
66
|
+
*/
|
|
67
|
+
function validateConnectPatch(raw) {
|
|
68
|
+
let parsed;
|
|
69
|
+
try {
|
|
70
|
+
parsed = JSON.parse(raw);
|
|
71
|
+
} catch (e) {
|
|
72
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
73
|
+
throw new Error(`ph connect config --json: invalid JSON (${msg}). Expected a partial connect.* blob, e.g. --json '{"renown":{"url":"..."}}'.`, { cause: e });
|
|
74
|
+
}
|
|
75
|
+
if (!isPlainObject(parsed)) throw new Error(`ph connect config --json: payload must be a JSON object, got ${typeof parsed}.`);
|
|
76
|
+
const top = parsed;
|
|
77
|
+
const hasPackageRegistryUrl = Object.prototype.hasOwnProperty.call(top, "packageRegistryUrl");
|
|
78
|
+
const packageRegistryUrl = top.packageRegistryUrl;
|
|
79
|
+
const connectOnly = { ...top };
|
|
80
|
+
delete connectOnly.packageRegistryUrl;
|
|
81
|
+
if (!validateConnect(connectOnly)) throw new Error(`ph connect config --json: validation failed:\n${formatErrors(validateConnect.errors)}`);
|
|
82
|
+
return hasPackageRegistryUrl ? {
|
|
83
|
+
...connectOnly,
|
|
84
|
+
packageRegistryUrl
|
|
85
|
+
} : connectOnly;
|
|
86
|
+
}
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/utils/parse-default-drives.ts
|
|
89
|
+
/**
|
|
90
|
+
* Comma-separated URL string → array of `{url, name: null, icon: null}`
|
|
91
|
+
* entries suitable for `connect.drives.defaultDrives`. Used by ph-cli's
|
|
92
|
+
* CLI-override builders and by `ph vetra` when forwarding the local
|
|
93
|
+
* switchboard's drive URLs into the runtime config.
|
|
94
|
+
*/
|
|
95
|
+
const parseDefaultDrivesUrl = (v) => v.split(",").map((s) => s.trim()).filter(Boolean).map((url) => ({
|
|
96
|
+
url,
|
|
97
|
+
name: null,
|
|
98
|
+
icon: null
|
|
99
|
+
}));
|
|
100
|
+
//#endregion
|
|
101
|
+
//#region src/utils/cli-connect-override.ts
|
|
102
|
+
/**
|
|
103
|
+
* Parse the `--json` payload (if any). Throws on malformed JSON or on a
|
|
104
|
+
* non-object root with a clear, command-line-visible error.
|
|
105
|
+
*/
|
|
106
|
+
function parseJsonOverride(raw) {
|
|
107
|
+
if (raw === void 0 || raw === "") return {};
|
|
108
|
+
let parsed;
|
|
109
|
+
try {
|
|
110
|
+
parsed = JSON.parse(raw);
|
|
111
|
+
} catch (e) {
|
|
112
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
113
|
+
throw new Error(`--json: invalid JSON (${msg}). Expected a partial 'connect.*' blob, e.g. --json '{"renown":{"url":"..."}}'.`, { cause: e });
|
|
114
|
+
}
|
|
115
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error(`--json: payload must be a JSON object, got ${typeof parsed}.`);
|
|
116
|
+
return parsed;
|
|
117
|
+
}
|
|
118
|
+
function setIfDefined(target, key, value) {
|
|
119
|
+
if (value !== void 0) target[key] = value;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Detect whether the user literally typed `--<longName>` on the command
|
|
123
|
+
* line. Used to gate the 4 commonArgs flags through `cliConnectOverride` —
|
|
124
|
+
* those flags have cmd-ts defaults, so their parsed value is always
|
|
125
|
+
* defined, and a naive merge would silently clobber source values with the
|
|
126
|
+
* default on every build.
|
|
127
|
+
*
|
|
128
|
+
* Handles both `--flag value` and `--flag=value` forms.
|
|
129
|
+
*/
|
|
130
|
+
function wasFlagExplicitlyPassed(longName) {
|
|
131
|
+
const dashed = `--${longName}`;
|
|
132
|
+
return process.argv.some((arg) => arg === dashed || arg.startsWith(`${dashed}=`));
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Build a `connect.*` partial from the 19 field flags. Only includes paths
|
|
136
|
+
* the user explicitly set (undefined values are excluded).
|
|
137
|
+
*
|
|
138
|
+
* Single source of truth for the flag → JSON-path mapping; consumed by both
|
|
139
|
+
* `ph connect build` and `ph connect config`.
|
|
140
|
+
*/
|
|
141
|
+
function buildConnectFlagPatch(args) {
|
|
142
|
+
const out = {};
|
|
143
|
+
const app = {};
|
|
144
|
+
setIfDefined(app, "basePath", args.basePath);
|
|
145
|
+
setIfDefined(app, "logLevel", args.logLevel);
|
|
146
|
+
if (Object.keys(app).length > 0) out.app = app;
|
|
147
|
+
const renown = {};
|
|
148
|
+
setIfDefined(renown, "url", args.renownUrl);
|
|
149
|
+
setIfDefined(renown, "networkId", args.renownNetworkId);
|
|
150
|
+
setIfDefined(renown, "chainId", args.renownChainId);
|
|
151
|
+
if (Object.keys(renown).length > 0) out.renown = renown;
|
|
152
|
+
const packages = {};
|
|
153
|
+
setIfDefined(packages, "externalEnabled", args.externalPackages);
|
|
154
|
+
if (Object.keys(packages).length > 0) out.packages = packages;
|
|
155
|
+
const branding = {};
|
|
156
|
+
setIfDefined(branding, "appName", args.appName);
|
|
157
|
+
if (args.homeBackground !== void 0) branding.homeBackground = args.homeBackground === "" ? null : args.homeBackground;
|
|
158
|
+
if (Object.keys(branding).length > 0) out.branding = branding;
|
|
159
|
+
const sentry = {};
|
|
160
|
+
if (args.sentryDsn !== void 0) sentry.dsn = args.sentryDsn === "" ? null : args.sentryDsn;
|
|
161
|
+
setIfDefined(sentry, "env", args.sentryEnv);
|
|
162
|
+
setIfDefined(sentry, "tracing", args.sentryTracingEnabled);
|
|
163
|
+
if (Object.keys(sentry).length > 0) out.sentry = sentry;
|
|
164
|
+
const drives = {};
|
|
165
|
+
setIfDefined(drives, "allowAddDrive", args.allowAddDrive);
|
|
166
|
+
setIfDefined(drives, "preserveStrategy", args.drivesPreserveStrategy);
|
|
167
|
+
if (args.defaultDrivesUrl !== void 0 && args.defaultDrivesUrl !== "") drives.defaultDrives = parseDefaultDrivesUrl(args.defaultDrivesUrl);
|
|
168
|
+
const remote = {};
|
|
169
|
+
setIfDefined(remote, "enabled", args.remoteDrivesEnabled);
|
|
170
|
+
setIfDefined(remote, "allowAdd", args.remoteDrivesAllowAdd);
|
|
171
|
+
setIfDefined(remote, "allowDelete", args.remoteDrivesAllowDelete);
|
|
172
|
+
const local = {};
|
|
173
|
+
setIfDefined(local, "enabled", args.localDrivesEnabled);
|
|
174
|
+
setIfDefined(local, "allowAdd", args.localDrivesAllowAdd);
|
|
175
|
+
setIfDefined(local, "allowDelete", args.localDrivesAllowDelete);
|
|
176
|
+
const sections = {};
|
|
177
|
+
if (Object.keys(remote).length > 0) sections.remote = remote;
|
|
178
|
+
if (Object.keys(local).length > 0) sections.local = local;
|
|
179
|
+
if (Object.keys(sections).length > 0) drives.sections = sections;
|
|
180
|
+
if (Object.keys(drives).length > 0) out.drives = drives;
|
|
181
|
+
return out;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Combine `--json` and the individual flag values into the two override
|
|
185
|
+
* inputs `ph connect build` forwards to the Vite plugin:
|
|
186
|
+
*
|
|
187
|
+
* - `connectOverride`: a partial `connect.*` patch (deep-merged at the top
|
|
188
|
+
* of the runtime-config precedence ladder).
|
|
189
|
+
* - `packageRegistryUrl`: a separate top-level override; mirrors the
|
|
190
|
+
* source-config top-level field (the SPA reads it directly).
|
|
191
|
+
*
|
|
192
|
+
* `--packages-registry` and `--json` containing a top-level
|
|
193
|
+
* `packageRegistryUrl` both flow into `packageRegistryUrl`; the flag wins on
|
|
194
|
+
* collision. Returns `undefined` for whichever override was not supplied.
|
|
195
|
+
*
|
|
196
|
+
* The 4 commonArgs flags (`--base`, `--log-level`, `--default-drives-url`,
|
|
197
|
+
* `--drive-preserve-strategy`) are gated through `wasFlagExplicitlyPassed`
|
|
198
|
+
* because they carry cmd-ts defaults that would otherwise leak into the
|
|
199
|
+
* override on every build.
|
|
200
|
+
*/
|
|
201
|
+
function buildCliConnectOverride(args) {
|
|
202
|
+
const fromJson = parseJsonOverride(args.json);
|
|
203
|
+
const fromFlags = buildConnectFlagPatch({
|
|
204
|
+
renownUrl: args.renownUrl,
|
|
205
|
+
renownNetworkId: args.renownNetworkId,
|
|
206
|
+
renownChainId: args.renownChainId,
|
|
207
|
+
allowAddDrive: args.allowAddDrive,
|
|
208
|
+
externalPackages: args.externalPackages,
|
|
209
|
+
remoteDrivesEnabled: args.remoteDrivesEnabled,
|
|
210
|
+
remoteDrivesAllowAdd: args.remoteDrivesAllowAdd,
|
|
211
|
+
remoteDrivesAllowDelete: args.remoteDrivesAllowDelete,
|
|
212
|
+
localDrivesEnabled: args.localDrivesEnabled,
|
|
213
|
+
localDrivesAllowAdd: args.localDrivesAllowAdd,
|
|
214
|
+
localDrivesAllowDelete: args.localDrivesAllowDelete,
|
|
215
|
+
appName: args.appName,
|
|
216
|
+
homeBackground: args.homeBackground,
|
|
217
|
+
sentryDsn: args.sentryDsn,
|
|
218
|
+
sentryEnv: args.sentryEnv,
|
|
219
|
+
sentryTracingEnabled: args.sentryTracingEnabled,
|
|
220
|
+
basePath: wasFlagExplicitlyPassed("base") ? args.connectBasePath : void 0,
|
|
221
|
+
logLevel: wasFlagExplicitlyPassed("log-level") ? args.logLevel : void 0,
|
|
222
|
+
defaultDrivesUrl: wasFlagExplicitlyPassed("default-drives-url") ? args.defaultDrivesUrl : void 0,
|
|
223
|
+
drivesPreserveStrategy: wasFlagExplicitlyPassed("drive-preserve-strategy") ? args.drivesPreserveStrategy : void 0
|
|
224
|
+
});
|
|
225
|
+
let positionalRegistry;
|
|
226
|
+
let fromPositional = {};
|
|
227
|
+
if (args.keyPositional !== void 0 && args.valuePositional !== void 0) {
|
|
228
|
+
const normalized = normalizeKey(args.keyPositional);
|
|
229
|
+
if (!normalized) throw new Error("ph connect build: positional <key> cannot be empty. Pass a dotted path inside connect.* (e.g. connect.renown.url).");
|
|
230
|
+
if (normalized === "packageRegistryUrl") {
|
|
231
|
+
const parsed = parseCliValue(args.valuePositional);
|
|
232
|
+
if (typeof parsed !== "string") throw new Error(`ph connect build: positional packageRegistryUrl must be a string (got ${typeof parsed}).`);
|
|
233
|
+
positionalRegistry = parsed;
|
|
234
|
+
} else fromPositional = validateConnectKeyValue(normalized, args.valuePositional);
|
|
235
|
+
}
|
|
236
|
+
const jsonRegistry = typeof fromJson.packageRegistryUrl === "string" ? fromJson.packageRegistryUrl : void 0;
|
|
237
|
+
const packageRegistryUrl = positionalRegistry ?? args.packagesRegistry ?? jsonRegistry;
|
|
238
|
+
const jsonConnect = { ...fromJson };
|
|
239
|
+
delete jsonConnect.packageRegistryUrl;
|
|
240
|
+
const hasJsonConnect = Object.keys(jsonConnect).length > 0;
|
|
241
|
+
const hasFlags = Object.keys(fromFlags).length > 0;
|
|
242
|
+
const hasPositional = Object.keys(fromPositional).length > 0;
|
|
243
|
+
return {
|
|
244
|
+
connectOverride: !hasJsonConnect && !hasFlags && !hasPositional ? void 0 : deepMerge(deepMerge(jsonConnect, fromFlags), fromPositional),
|
|
245
|
+
packageRegistryUrl
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Parallel of `buildCliConnectOverride` for `ph connect studio` / `ph vetra`.
|
|
250
|
+
* Studio only exposes the 4 commonArgs flags (`--base`, `--log-level`,
|
|
251
|
+
* `--default-drives-url`, `--drive-preserve-strategy`); each is gated through
|
|
252
|
+
* `wasFlagExplicitlyPassed` so cmd-ts defaults don't leak into the override.
|
|
253
|
+
*
|
|
254
|
+
* `callerOverride` is supplied by wrappers around studio (notably `ph vetra`,
|
|
255
|
+
* which sets default drives + preserveStrategy directly) and deep-merges on
|
|
256
|
+
* top of the user-flag override, so caller choices stick even when the user
|
|
257
|
+
* didn't type the corresponding flag.
|
|
258
|
+
*/
|
|
259
|
+
function buildStudioConnectOverride(args, callerOverride) {
|
|
260
|
+
const flagOverride = buildConnectFlagPatch({
|
|
261
|
+
basePath: wasFlagExplicitlyPassed("base") ? args.connectBasePath : void 0,
|
|
262
|
+
logLevel: wasFlagExplicitlyPassed("log-level") ? args.logLevel : void 0,
|
|
263
|
+
defaultDrivesUrl: wasFlagExplicitlyPassed("default-drives-url") ? args.defaultDrivesUrl : void 0,
|
|
264
|
+
drivesPreserveStrategy: wasFlagExplicitlyPassed("drive-preserve-strategy") ? args.drivesPreserveStrategy : void 0
|
|
265
|
+
});
|
|
266
|
+
if (!(Object.keys(flagOverride).length > 0)) return callerOverride;
|
|
267
|
+
if (callerOverride === void 0) return flagOverride;
|
|
268
|
+
return deepMerge(flagOverride, callerOverride);
|
|
269
|
+
}
|
|
270
|
+
//#endregion
|
|
271
|
+
export { parseDefaultDrivesUrl as a, validateConnectKeyValue as c, wasFlagExplicitlyPassed as i, validateConnectPatch as l, buildConnectFlagPatch as n, normalizeKey as o, buildStudioConnectOverride as r, parseCliValue as s, buildCliConnectOverride as t };
|
|
272
|
+
|
|
273
|
+
//# sourceMappingURL=cli-connect-override-DHpuwyEn.mjs.map
|
|
274
|
+
//# debugId=07c21629-f10b-55aa-b4d0-374f2dbfb053
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-connect-override-DHpuwyEn.mjs","sources":["../src/utils/connect-config-validation.ts","../src/utils/parse-default-drives.ts","../src/utils/cli-connect-override.ts"],"sourcesContent":["// Ajv-backed validation for `ph connect config` writes.\n//\n// Two entry points:\n//\n// - validateConnectKeyValue(key, value)\n// For the `<key> <value>` form. Sets the value at the dotted path inside a\n// stub connect block, then validates the result against the runtime schema.\n// Catches both invalid paths (key doesn't map to a real field) and invalid\n// types (e.g. `connect.renown.chainId \"abc\"` — schema says number).\n//\n// - validateConnectPatch(patch)\n// For the `--json` form. Validates the whole patch as a partial connect.*\n// blob. Same schema, but we only check the keys actually present in the\n// patch (additional keys still fail per `additionalProperties: false`).\n//\n// Both return a typed `connect.*` partial on success or throw with a multi-\n// line, actionable message on failure.\n\nimport { phConnectRuntimeConfigSchema } from \"@powerhousedao/shared/connect\";\nimport type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport AjvNs from \"ajv\";\nimport { isPlainObject, stringToPath } from \"remeda\";\n\ntype PlainObject = Record<string, unknown>;\ntype ConnectPartial = Partial<PHConnectRuntimeConfig>;\n\n// Ajv ships as CJS — under NodeNext ESM the default lands on `.default` while\n// types still point at the class on the namespace. Normalize the constructor.\ntype AjvCtor = new (opts?: Record<string, unknown>) => {\n compile: (schema: unknown) => AjvValidate;\n};\ntype AjvError = { instancePath?: string; message?: string };\ntype AjvValidate = ((data: unknown) => boolean) & {\n errors?: AjvError[] | null;\n};\n\nconst Ajv = ((AjvNs as unknown as { default?: AjvCtor }).default ??\n (AjvNs as unknown as AjvCtor)) as AjvCtor;\n\nconst ajv = new Ajv({ allErrors: true, strict: false });\nconst validateConnect: AjvValidate = ajv.compile(phConnectRuntimeConfigSchema);\n\n/**\n * Parse the CLI-supplied value. Tries JSON first so `true`, `42`, `\"a\"`,\n * `null`, `[1,2]` coerce; falls back to the raw string for unquoted text.\n *\n * Examples:\n * \"true\" -> true (boolean)\n * \"42\" -> 42 (number)\n * '\"x\"' -> \"x\" (string, quoted)\n * \"x\" -> \"x\" (string, bare)\n * \"[1,2]\" -> [1, 2] (array)\n */\nexport function parseCliValue(raw: string): unknown {\n try {\n return JSON.parse(raw);\n } catch {\n return raw;\n }\n}\n\n/**\n * Strip the optional leading \"connect.\" prefix so callers can pass either\n * \"connect.renown.url\" or \"renown.url\" interchangeably.\n */\nexport function normalizeKey(key: string): string {\n return key.startsWith(\"connect.\") ? key.slice(\"connect.\".length) : key;\n}\n\nfunction formatErrors(errors: AjvError[] | null | undefined): string {\n if (!errors || errors.length === 0) return \"unknown validation error\";\n return errors\n .map((e) => {\n const path = e.instancePath || \"(root)\";\n return ` ${path} ${e.message ?? \"\"}`.trim();\n })\n .join(\"\\n\");\n}\n\n/**\n * Validate a single `<key> <value>` pair. Returns the parsed connect-partial\n * that, when deep-merged into the existing config, applies the change.\n *\n * Throws on:\n * - Empty key\n * - Path that doesn't exist in the schema\n * - Value whose type doesn't match the schema at the leaf path\n */\nexport function validateConnectKeyValue(\n key: string,\n rawValue: string,\n): ConnectPartial {\n const normalized = normalizeKey(key);\n if (!normalized) {\n throw new Error(\n \"ph connect config: key cannot be empty. Pass a dotted path inside connect.* (e.g. connect.renown.url).\",\n );\n }\n const parsed = parseCliValue(rawValue);\n // Build a nested-stub object from the dotted path so Ajv can validate\n // the value's shape against the schema (e.g. \"renown.url\" + parsed →\n // { renown: { url: parsed } }). Remeda's `setPath` requires the path\n // to exist; this is the sparse-creation case, so we fold the parts.\n const stub = stringToPath(normalized).reduceRight<unknown>(\n (acc, key) => ({ [String(key)]: acc }),\n parsed,\n ) as PlainObject;\n if (!validateConnect(stub)) {\n throw new Error(\n `ph connect config: validation failed for key=\"${normalized}\" value=${JSON.stringify(parsed)} (parsed as ${typeof parsed}):\\n${formatErrors(validateConnect.errors)}`,\n );\n }\n return stub;\n}\n\n/**\n * Validate a `--json` bulk override. Returns the parsed partial.\n *\n * `packageRegistryUrl` is a top-level runtime field (not part of the\n * `connect.*` schema). If present in the payload, it is extracted before\n * validation so the connect-only blob can be checked against the schema,\n * then re-attached on the returned object so the caller can route it.\n */\nexport function validateConnectPatch(raw: string): ConnectPartial & {\n packageRegistryUrl?: unknown;\n} {\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw);\n } catch (e) {\n const msg = e instanceof Error ? e.message : String(e);\n throw new Error(\n `ph connect config --json: invalid JSON (${msg}). Expected a partial connect.* blob, e.g. --json '{\"renown\":{\"url\":\"...\"}}'.`,\n { cause: e },\n );\n }\n if (!isPlainObject(parsed)) {\n throw new Error(\n `ph connect config --json: payload must be a JSON object, got ${typeof parsed}.`,\n );\n }\n // Extract `packageRegistryUrl` (top-level field, not in the connect schema)\n // before validating, so a payload like `{\"packageRegistryUrl\":\"…\"}` doesn't\n // fail the `additionalProperties: false` check on the connect schema.\n const top = parsed as PlainObject;\n const hasPackageRegistryUrl = Object.prototype.hasOwnProperty.call(\n top,\n \"packageRegistryUrl\",\n );\n const packageRegistryUrl = top.packageRegistryUrl;\n const connectOnly: PlainObject = { ...top };\n delete connectOnly.packageRegistryUrl;\n if (!validateConnect(connectOnly)) {\n throw new Error(\n `ph connect config --json: validation failed:\\n${formatErrors(validateConnect.errors)}`,\n );\n }\n return hasPackageRegistryUrl\n ? ({ ...connectOnly, packageRegistryUrl } as ConnectPartial & {\n packageRegistryUrl?: unknown;\n })\n : (connectOnly as ConnectPartial);\n}\n","/**\n * Comma-separated URL string → array of `{url, name: null, icon: null}`\n * entries suitable for `connect.drives.defaultDrives`. Used by ph-cli's\n * CLI-override builders and by `ph vetra` when forwarding the local\n * switchboard's drive URLs into the runtime config.\n */\nexport const parseDefaultDrivesUrl = (\n v: string,\n): Array<{ url: string; name: null; icon: null }> =>\n v\n .split(\",\")\n .map((s) => s.trim())\n .filter(Boolean)\n .map((url) => ({ url, name: null, icon: null }));\n","// Builds a `connectOverride` partial from CLI flags. Shared by:\n//\n// - `ph connect build` — uses `buildCliConnectOverride` to produce the\n// `cliConnectOverride` patch the Vite plugin applies at the top of the\n// precedence ladder:\n//\n// DEFAULT_CONNECT_CONFIG < env-var seeds < source connect.* < --json < individual --flag\n//\n// - `ph connect config` — uses `buildConnectFlagPatch` (the per-field\n// partial builder) to translate flag-set values into the patch that\n// gets dual-written to source + dist `powerhouse.config.json`.\n//\n// `--json` parses as a partial `connect.*` blob and merges in first; then any\n// individual --flag values merge on top, so a flag beats a conflicting --json\n// value.\n\nimport type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport { deepMerge } from \"@powerhousedao/shared/connect\";\nimport type { ConnectBuildArgs, ConnectStudioArgs } from \"../types.js\";\nimport {\n normalizeKey,\n parseCliValue,\n validateConnectKeyValue,\n} from \"./connect-config-validation.js\";\nimport { parseDefaultDrivesUrl } from \"./parse-default-drives.js\";\n\ntype PlainObject = Record<string, unknown>;\n\n/**\n * Structural input shape consumed by `buildConnectFlagPatch`. Every property\n * is strict-optional — `undefined` means \"user did not pass this flag\" and\n * the path is excluded from the patch.\n *\n * Callers with cmd-ts-typed args where some flags have built-in defaults\n * (e.g. the 4 commonArgs flags `--base` / `--log-level` /\n * `--default-drives-url` / `--drive-preserve-strategy`) must filter through\n * `wasFlagExplicitlyPassed` BEFORE building this input — otherwise default\n * values like `\"info\"` will silently clobber source `powerhouse.config.json`\n * values.\n */\nexport type ConnectFlagInput = {\n // Strict-optional flags from connectRuntimeOverrideArgs (excluding\n // `packagesRegistry`, which is a top-level runtime field — see\n // `buildCliConnectOverride`).\n json?: string | undefined;\n renownUrl?: string | undefined;\n renownNetworkId?: string | undefined;\n renownChainId?: number | undefined;\n allowAddDrive?: boolean | undefined;\n externalPackages?: boolean | undefined;\n remoteDrivesEnabled?: boolean | undefined;\n remoteDrivesAllowAdd?: boolean | undefined;\n remoteDrivesAllowDelete?: boolean | undefined;\n localDrivesEnabled?: boolean | undefined;\n localDrivesAllowAdd?: boolean | undefined;\n localDrivesAllowDelete?: boolean | undefined;\n appName?: string | undefined;\n homeBackground?: string | undefined;\n sentryDsn?: string | undefined;\n sentryEnv?: string | undefined;\n sentryTracingEnabled?: boolean | undefined;\n // commonArgs flags. Callers must apply `wasFlagExplicitlyPassed`\n // filtering (see above).\n basePath?: string | undefined;\n logLevel?: string | undefined;\n defaultDrivesUrl?: string | undefined;\n drivesPreserveStrategy?: string | undefined;\n};\n\n/**\n * Parse the `--json` payload (if any). Throws on malformed JSON or on a\n * non-object root with a clear, command-line-visible error.\n */\nfunction parseJsonOverride(raw: string | undefined): PlainObject {\n if (raw === undefined || raw === \"\") return {};\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw);\n } catch (e) {\n const msg = e instanceof Error ? e.message : String(e);\n throw new Error(\n `--json: invalid JSON (${msg}). Expected a partial 'connect.*' blob, e.g. --json '{\"renown\":{\"url\":\"...\"}}'.`,\n { cause: e },\n );\n }\n if (parsed === null || typeof parsed !== \"object\" || Array.isArray(parsed)) {\n throw new Error(\n `--json: payload must be a JSON object, got ${typeof parsed}.`,\n );\n }\n return parsed as PlainObject;\n}\n\n/**\n * Re-exported for `runConnectConfig` so the same JSON validation runs for\n * both `build --json` and `config --json`.\n */\nexport function parseConnectJsonArg(raw: string | undefined): PlainObject {\n return parseJsonOverride(raw);\n}\n\nfunction setIfDefined<V>(\n target: PlainObject,\n key: string,\n value: V | undefined,\n): void {\n if (value !== undefined) target[key] = value;\n}\n\n/**\n * Detect whether the user literally typed `--<longName>` on the command\n * line. Used to gate the 4 commonArgs flags through `cliConnectOverride` —\n * those flags have cmd-ts defaults, so their parsed value is always\n * defined, and a naive merge would silently clobber source values with the\n * default on every build.\n *\n * Handles both `--flag value` and `--flag=value` forms.\n */\nexport function wasFlagExplicitlyPassed(longName: string): boolean {\n const dashed = `--${longName}`;\n return process.argv.some(\n (arg) => arg === dashed || arg.startsWith(`${dashed}=`),\n );\n}\n\n/**\n * Build a `connect.*` partial from the 19 field flags. Only includes paths\n * the user explicitly set (undefined values are excluded).\n *\n * Single source of truth for the flag → JSON-path mapping; consumed by both\n * `ph connect build` and `ph connect config`.\n */\nexport function buildConnectFlagPatch(args: ConnectFlagInput): PlainObject {\n const out: PlainObject = {};\n\n const app: PlainObject = {};\n setIfDefined(app, \"basePath\", args.basePath);\n setIfDefined(app, \"logLevel\", args.logLevel);\n if (Object.keys(app).length > 0) out.app = app;\n\n const renown: PlainObject = {};\n setIfDefined(renown, \"url\", args.renownUrl);\n setIfDefined(renown, \"networkId\", args.renownNetworkId);\n setIfDefined(renown, \"chainId\", args.renownChainId);\n if (Object.keys(renown).length > 0) out.renown = renown;\n\n const packages: PlainObject = {};\n setIfDefined(packages, \"externalEnabled\", args.externalPackages);\n if (Object.keys(packages).length > 0) out.packages = packages;\n\n // --home-background: empty string is the explicit \"set null\" form\n // (cmd-ts can't pass `null` directly through a string option).\n const branding: PlainObject = {};\n setIfDefined(branding, \"appName\", args.appName);\n if (args.homeBackground !== undefined) {\n branding.homeBackground =\n args.homeBackground === \"\" ? null : args.homeBackground;\n }\n if (Object.keys(branding).length > 0) out.branding = branding;\n\n // --sentry-dsn: empty string is the explicit \"set null\" form (disables\n // Sentry). Same pattern as --home-background.\n const sentry: PlainObject = {};\n if (args.sentryDsn !== undefined) {\n sentry.dsn = args.sentryDsn === \"\" ? null : args.sentryDsn;\n }\n setIfDefined(sentry, \"env\", args.sentryEnv);\n setIfDefined(sentry, \"tracing\", args.sentryTracingEnabled);\n if (Object.keys(sentry).length > 0) out.sentry = sentry;\n\n const drives: PlainObject = {};\n setIfDefined(drives, \"allowAddDrive\", args.allowAddDrive);\n setIfDefined(drives, \"preserveStrategy\", args.drivesPreserveStrategy);\n if (args.defaultDrivesUrl !== undefined && args.defaultDrivesUrl !== \"\") {\n drives.defaultDrives = parseDefaultDrivesUrl(args.defaultDrivesUrl);\n }\n\n const remote: PlainObject = {};\n setIfDefined(remote, \"enabled\", args.remoteDrivesEnabled);\n setIfDefined(remote, \"allowAdd\", args.remoteDrivesAllowAdd);\n setIfDefined(remote, \"allowDelete\", args.remoteDrivesAllowDelete);\n\n const local: PlainObject = {};\n setIfDefined(local, \"enabled\", args.localDrivesEnabled);\n setIfDefined(local, \"allowAdd\", args.localDrivesAllowAdd);\n setIfDefined(local, \"allowDelete\", args.localDrivesAllowDelete);\n\n const sections: PlainObject = {};\n if (Object.keys(remote).length > 0) sections.remote = remote;\n if (Object.keys(local).length > 0) sections.local = local;\n if (Object.keys(sections).length > 0) drives.sections = sections;\n if (Object.keys(drives).length > 0) out.drives = drives;\n\n return out;\n}\n\n/**\n * Combine `--json` and the individual flag values into the two override\n * inputs `ph connect build` forwards to the Vite plugin:\n *\n * - `connectOverride`: a partial `connect.*` patch (deep-merged at the top\n * of the runtime-config precedence ladder).\n * - `packageRegistryUrl`: a separate top-level override; mirrors the\n * source-config top-level field (the SPA reads it directly).\n *\n * `--packages-registry` and `--json` containing a top-level\n * `packageRegistryUrl` both flow into `packageRegistryUrl`; the flag wins on\n * collision. Returns `undefined` for whichever override was not supplied.\n *\n * The 4 commonArgs flags (`--base`, `--log-level`, `--default-drives-url`,\n * `--drive-preserve-strategy`) are gated through `wasFlagExplicitlyPassed`\n * because they carry cmd-ts defaults that would otherwise leak into the\n * override on every build.\n */\nexport function buildCliConnectOverride(args: ConnectBuildArgs): {\n connectOverride: PHConnectRuntimeConfig | undefined;\n packageRegistryUrl: string | undefined;\n} {\n const fromJson = parseJsonOverride(args.json);\n\n const input: ConnectFlagInput = {\n renownUrl: args.renownUrl,\n renownNetworkId: args.renownNetworkId,\n renownChainId: args.renownChainId,\n allowAddDrive: args.allowAddDrive,\n externalPackages: args.externalPackages,\n remoteDrivesEnabled: args.remoteDrivesEnabled,\n remoteDrivesAllowAdd: args.remoteDrivesAllowAdd,\n remoteDrivesAllowDelete: args.remoteDrivesAllowDelete,\n localDrivesEnabled: args.localDrivesEnabled,\n localDrivesAllowAdd: args.localDrivesAllowAdd,\n localDrivesAllowDelete: args.localDrivesAllowDelete,\n appName: args.appName,\n homeBackground: args.homeBackground,\n sentryDsn: args.sentryDsn,\n sentryEnv: args.sentryEnv,\n sentryTracingEnabled: args.sentryTracingEnabled,\n // commonArgs flags — only forward when the user explicitly passed them.\n basePath: wasFlagExplicitlyPassed(\"base\")\n ? args.connectBasePath\n : undefined,\n logLevel: wasFlagExplicitlyPassed(\"log-level\") ? args.logLevel : undefined,\n defaultDrivesUrl: wasFlagExplicitlyPassed(\"default-drives-url\")\n ? args.defaultDrivesUrl\n : undefined,\n drivesPreserveStrategy: wasFlagExplicitlyPassed(\"drive-preserve-strategy\")\n ? args.drivesPreserveStrategy\n : undefined,\n };\n\n const fromFlags = buildConnectFlagPatch(input);\n\n // Positional `<key> <value>` override (only set when both are present;\n // `runConnectBuild` rejects the 1-positional case up front because build\n // has no read mode). Layered on top of --json + flags so a positional\n // override wins on collision — matches the user's literal command line.\n let positionalRegistry: string | undefined;\n let fromPositional: PlainObject = {};\n if (args.keyPositional !== undefined && args.valuePositional !== undefined) {\n const normalized = normalizeKey(args.keyPositional);\n if (!normalized) {\n throw new Error(\n \"ph connect build: positional <key> cannot be empty. Pass a dotted path inside connect.* (e.g. connect.renown.url).\",\n );\n }\n if (normalized === \"packageRegistryUrl\") {\n const parsed = parseCliValue(args.valuePositional);\n if (typeof parsed !== \"string\") {\n throw new Error(\n `ph connect build: positional packageRegistryUrl must be a string (got ${typeof parsed}).`,\n );\n }\n positionalRegistry = parsed;\n } else {\n fromPositional = validateConnectKeyValue(\n normalized,\n args.valuePositional,\n );\n }\n }\n\n // Top-level `packageRegistryUrl` can come from --json (top-level),\n // --packages-registry flag, or positional `packageRegistryUrl <value>`.\n // Precedence (highest → lowest): positional > flag > --json.\n const jsonRegistry =\n typeof fromJson.packageRegistryUrl === \"string\"\n ? (fromJson.packageRegistryUrl as string)\n : undefined;\n const packageRegistryUrl =\n positionalRegistry ?? args.packagesRegistry ?? jsonRegistry;\n // Strip the top-level field from the JSON patch before deep-merging into\n // the connect partial — it isn't a `connect.*` field.\n const jsonConnect = { ...fromJson };\n delete jsonConnect.packageRegistryUrl;\n\n const hasJsonConnect = Object.keys(jsonConnect).length > 0;\n const hasFlags = Object.keys(fromFlags).length > 0;\n const hasPositional = Object.keys(fromPositional).length > 0;\n const connectOverride =\n !hasJsonConnect && !hasFlags && !hasPositional\n ? undefined\n : deepMerge(\n deepMerge(\n jsonConnect as PHConnectRuntimeConfig,\n fromFlags as PHConnectRuntimeConfig,\n ),\n fromPositional as PHConnectRuntimeConfig,\n );\n\n return { connectOverride, packageRegistryUrl };\n}\n\n/**\n * Parallel of `buildCliConnectOverride` for `ph connect studio` / `ph vetra`.\n * Studio only exposes the 4 commonArgs flags (`--base`, `--log-level`,\n * `--default-drives-url`, `--drive-preserve-strategy`); each is gated through\n * `wasFlagExplicitlyPassed` so cmd-ts defaults don't leak into the override.\n *\n * `callerOverride` is supplied by wrappers around studio (notably `ph vetra`,\n * which sets default drives + preserveStrategy directly) and deep-merges on\n * top of the user-flag override, so caller choices stick even when the user\n * didn't type the corresponding flag.\n */\nexport function buildStudioConnectOverride(\n args: ConnectStudioArgs,\n callerOverride: PHConnectRuntimeConfig | undefined,\n): PHConnectRuntimeConfig | undefined {\n const flagOverride = buildConnectFlagPatch({\n basePath: wasFlagExplicitlyPassed(\"base\")\n ? args.connectBasePath\n : undefined,\n logLevel: wasFlagExplicitlyPassed(\"log-level\") ? args.logLevel : undefined,\n defaultDrivesUrl: wasFlagExplicitlyPassed(\"default-drives-url\")\n ? args.defaultDrivesUrl\n : undefined,\n drivesPreserveStrategy: wasFlagExplicitlyPassed(\"drive-preserve-strategy\")\n ? args.drivesPreserveStrategy\n : undefined,\n }) as PHConnectRuntimeConfig;\n\n const hasFlag = Object.keys(flagOverride).length > 0;\n if (!hasFlag) return callerOverride;\n if (callerOverride === undefined) return flagOverride;\n return deepMerge(flagOverride, callerOverride);\n}\n"],"names":[],"mappings":";;;;;;AAwCA,MAAM,kBADM,KAHE,MAA2C,WACtD,OAEiB;CAAE,WAAW;CAAM,QAAQ;CAAO,CAAC,CACd,QAAQ,6BAA6B;;;;;;;;;;;;AAa9E,SAAgB,cAAc,KAAsB;AAClD,KAAI;AACF,SAAO,KAAK,MAAM,IAAI;SAChB;AACN,SAAO;;;;;;;AAQX,SAAgB,aAAa,KAAqB;AAChD,QAAO,IAAI,WAAW,WAAW,GAAG,IAAI,MAAM,EAAkB,GAAG;;AAGrE,SAAS,aAAa,QAA+C;AACnE,KAAI,CAAC,UAAU,OAAO,WAAW,EAAG,QAAO;AAC3C,QAAO,OACJ,KAAK,MAAM;AAEV,SAAO,KADM,EAAE,gBAAgB,SACd,GAAG,EAAE,WAAW,KAAK,MAAM;GAC5C,CACD,KAAK,KAAK;;;;;;;;;;;AAYf,SAAgB,wBACd,KACA,UACgB;CAChB,MAAM,aAAa,aAAa,IAAI;AACpC,KAAI,CAAC,WACH,OAAM,IAAI,MACR,yGACD;CAEH,MAAM,SAAS,cAAc,SAA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mB;EAAoB;;;;;;;;;;;;;AAchD,SAAgB,2BACd,MACA,gBACoC;CACpC,MAAM,eAAe,sBAAsB;EACzC,UAAU,wBAAwB,OAAO,GACrC,KAAK,kBACL,KAAA;EACJ,UAAU,wBAAwB,YAAY,GAAG,KAAK,WAAW,KAAA;EACjE,kBAAkB,wBAAwB,qBAAqB,GAC3D,KAAK,mBACL,KAAA;EACJ,wBAAwB,wBAAwB,0BAA0B,GACtE,KAAK,yBACL,KAAA;EACL,CAAC;AAGF,KAAI,EADY,OAAO,KAAK,aAAa,CAAC,SAAS,GACrC,QAAO;AACrB,KAAI,mBAAmB,KAAA,EAAW,QAAO;AACzC,QAAO,UAAU,cAAc,eAAe","debug_id":"07c21629-f10b-55aa-b4d0-374f2dbfb053"}
|
package/dist/cli.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="3cb30f37-19c2-5c02-ad5c-b75e789bcc1a")}catch(e){}}();
|
|
4
4
|
import { initCliTelemetry } from "@powerhousedao/shared/clis/telemetry";
|
|
5
5
|
import { assertNodeVersion } from "@powerhousedao/shared/clis/utils";
|
|
6
6
|
import { array, boolean, command, flag, multioption, oneOf, option, optional, run, string, subcommands } from "cmd-ts";
|
|
7
|
-
import { AGENTS, accessTokenArgs, buildArgs, connectBuildArgs, connectPreviewArgs, connectStudioArgs, debugArgs, initArgs, inspectArgs, installArgs, listArgs, loginArgs, migrateArgs, phCliHelpCommands, publishArgs, registryLoginArgs, switchboardArgs, uninstallArgs, unpublishArgs, vetraArgs } from "@powerhousedao/shared/clis/args";
|
|
7
|
+
import { AGENTS, accessTokenArgs, buildArgs, connectBuildArgs, connectConfigArgs, connectPreviewArgs, connectStudioArgs, debugArgs, initArgs, inspectArgs, installArgs, listArgs, loginArgs, migrateArgs, phCliHelpCommands, publishArgs, registryLoginArgs, switchboardArgs, uninstallArgs, unpublishArgs, vetraArgs } from "@powerhousedao/shared/clis/args";
|
|
8
8
|
import { DEFAULT_EXPIRY_SECONDS } from "@powerhousedao/shared/clis/constants";
|
|
9
9
|
import { Directory, File } from "cmd-ts/dist/cjs/batteries/fs.js";
|
|
10
10
|
import path from "path";
|
|
@@ -15,7 +15,7 @@ import { createInterface } from "node:readline/promises";
|
|
|
15
15
|
import { bold, yellow } from "colorette";
|
|
16
16
|
//#region src/get-version.ts
|
|
17
17
|
function getVersion() {
|
|
18
|
-
return "6.
|
|
18
|
+
return "6.2.0-dev.0";
|
|
19
19
|
}
|
|
20
20
|
//#endregion
|
|
21
21
|
//#region src/utils/constants.ts
|
|
@@ -115,7 +115,7 @@ const build$1 = command({
|
|
|
115
115
|
});
|
|
116
116
|
const connect = subcommands({
|
|
117
117
|
name: "connect",
|
|
118
|
-
description: `Powerhouse Connect commands. Use with \`studio\`, \`build\` or \`
|
|
118
|
+
description: `Powerhouse Connect commands. Use with \`studio\`, \`build\`, \`preview\`, or \`config\`. Defaults to \`studio\` if not specified.`,
|
|
119
119
|
cmds: {
|
|
120
120
|
studio: command({
|
|
121
121
|
name: "studio",
|
|
@@ -132,19 +132,27 @@ This command:
|
|
|
132
132
|
args: connectStudioArgs,
|
|
133
133
|
handler: async (args) => {
|
|
134
134
|
if (args.debug) console.log(args);
|
|
135
|
-
const { runConnectStudio } = await import("./connect-studio-
|
|
135
|
+
const { runConnectStudio } = await import("./connect-studio-YDVQ49D6.mjs");
|
|
136
136
|
await runConnectStudio(args);
|
|
137
137
|
}
|
|
138
138
|
}),
|
|
139
139
|
build: command({
|
|
140
140
|
name: "build",
|
|
141
141
|
description: `The Connect build command creates a production build with the project's local and
|
|
142
|
-
external packages included
|
|
142
|
+
external packages included.
|
|
143
|
+
|
|
144
|
+
Runtime-config overrides (all combinable — last wins on collision):
|
|
145
|
+
ph connect build Build with the current source config.
|
|
146
|
+
ph connect build <key> <value> Build with a positional override applied (e.g. ph connect build connect.renown.url https://renown.staging).
|
|
147
|
+
ph connect build --<field> <value> Build with a per-field flag override (e.g. --renown-url https://renown.staging).
|
|
148
|
+
ph connect build --json '{"…":"…"}' Build with a bulk override.
|
|
149
|
+
|
|
150
|
+
Build has no read mode; passing only <key> without <value> errors out (use \`ph connect config <key>\` to read).
|
|
143
151
|
`,
|
|
144
152
|
args: connectBuildArgs,
|
|
145
153
|
handler: async (args) => {
|
|
146
154
|
if (args.debug) console.log(args);
|
|
147
|
-
const { runConnectBuild } = await import("./connect-build-
|
|
155
|
+
const { runConnectBuild } = await import("./connect-build-DDWHr6nw.mjs");
|
|
148
156
|
await runConnectBuild(args);
|
|
149
157
|
process.exit(0);
|
|
150
158
|
}
|
|
@@ -157,9 +165,31 @@ NOTE: You must run \`ph connect build\` first
|
|
|
157
165
|
args: connectPreviewArgs,
|
|
158
166
|
handler: async (args) => {
|
|
159
167
|
if (args.debug) console.log(args);
|
|
160
|
-
const { runConnectPreview } = await import("./connect-preview-
|
|
168
|
+
const { runConnectPreview } = await import("./connect-preview-D7ypzFDc.mjs");
|
|
161
169
|
await runConnectPreview(args);
|
|
162
170
|
}
|
|
171
|
+
}),
|
|
172
|
+
config: command({
|
|
173
|
+
name: "config",
|
|
174
|
+
description: `Read or update Connect's runtime configuration (powerhouse.config.json).
|
|
175
|
+
|
|
176
|
+
Modes (mutually exclusive — positional, --get, --json, and field flags cannot be combined):
|
|
177
|
+
ph connect config List the effective connect.* block (defaults < source).
|
|
178
|
+
ph connect config <key> Get the value at the dotted path (e.g. ph connect config connect.renown.url).
|
|
179
|
+
ph connect config --get <dotted.path> Same as positional <key> (kept for backward compat).
|
|
180
|
+
ph connect config <key> <value> Set a single field and dual-write to source + dist (positional).
|
|
181
|
+
ph connect config --<field> <value> Set a single field via per-field flag (e.g. --renown-url https://renown.id).
|
|
182
|
+
ph connect config --json '{"…":"…"}' Bulk-set multiple fields and dual-write.
|
|
183
|
+
|
|
184
|
+
Writes go to:
|
|
185
|
+
- <project>/powerhouse.config.json (source — picked up by the next build)
|
|
186
|
+
- <dist-dir>/powerhouse.config.json (if it exists — the currently-served SPA picks it up on refresh)
|
|
187
|
+
`,
|
|
188
|
+
args: connectConfigArgs,
|
|
189
|
+
handler: async (args) => {
|
|
190
|
+
const { runConnectConfig } = await import("./connect-config-DQcIDdtP.mjs");
|
|
191
|
+
await runConnectConfig(args);
|
|
192
|
+
}
|
|
163
193
|
})
|
|
164
194
|
}
|
|
165
195
|
});
|
|
@@ -174,7 +204,7 @@ const generateAllCmd = command({
|
|
|
174
204
|
description: "Instead of generating code, write a spec for every module into specs/ (one-shot migration to documents-as-source-of-truth)"
|
|
175
205
|
}) },
|
|
176
206
|
handler: async (args) => {
|
|
177
|
-
const { startGenerateAll } = await import("./generate-all-
|
|
207
|
+
const { startGenerateAll } = await import("./generate-all-DrT4ZxHX.mjs");
|
|
178
208
|
await startGenerateAll(args, process.cwd());
|
|
179
209
|
process.exit(0);
|
|
180
210
|
}
|
|
@@ -228,7 +258,7 @@ const generateAppCmd = command({
|
|
|
228
258
|
...debugArgs
|
|
229
259
|
},
|
|
230
260
|
handler: async (args) => {
|
|
231
|
-
const { startGenerateApp } = await import("./generate-app-
|
|
261
|
+
const { startGenerateApp } = await import("./generate-app-DNNqA-H3.mjs");
|
|
232
262
|
await startGenerateApp(args, process.cwd());
|
|
233
263
|
process.exit(0);
|
|
234
264
|
}
|
|
@@ -264,7 +294,7 @@ const generateDocumentModelCmd = command({
|
|
|
264
294
|
...debugArgs
|
|
265
295
|
},
|
|
266
296
|
handler: async (args) => {
|
|
267
|
-
const { startGenerateDocumentModel } = await import("./generate-document-model-
|
|
297
|
+
const { startGenerateDocumentModel } = await import("./generate-document-model-BJXyODfm.mjs");
|
|
268
298
|
await startGenerateDocumentModel(args, process.cwd());
|
|
269
299
|
process.exit(0);
|
|
270
300
|
}
|
|
@@ -311,7 +341,7 @@ const generateEditorCmd = command({
|
|
|
311
341
|
...debugArgs
|
|
312
342
|
},
|
|
313
343
|
handler: async (args) => {
|
|
314
|
-
const { startGenerateEditor } = await import("./generate-editor-
|
|
344
|
+
const { startGenerateEditor } = await import("./generate-editor-BejvaVVT.mjs");
|
|
315
345
|
await startGenerateEditor(args, process.cwd());
|
|
316
346
|
process.exit(0);
|
|
317
347
|
}
|
|
@@ -406,7 +436,7 @@ const generateProcessorCmd = command({
|
|
|
406
436
|
...debugArgs
|
|
407
437
|
},
|
|
408
438
|
handler: async (args) => {
|
|
409
|
-
const { startGenerateProcessor } = await import("./generate-processor-
|
|
439
|
+
const { startGenerateProcessor } = await import("./generate-processor-_WOx-mMe.mjs");
|
|
410
440
|
await startGenerateProcessor(args, process.cwd());
|
|
411
441
|
process.exit(0);
|
|
412
442
|
}
|
|
@@ -447,7 +477,7 @@ const generateSubgraphCmd = command({
|
|
|
447
477
|
...debugArgs
|
|
448
478
|
},
|
|
449
479
|
handler: async (args) => {
|
|
450
|
-
const { startGenerateSubgraph } = await import("./generate-subgraph-
|
|
480
|
+
const { startGenerateSubgraph } = await import("./generate-subgraph-BsHUstpl.mjs");
|
|
451
481
|
await startGenerateSubgraph(args, process.cwd());
|
|
452
482
|
process.exit(0);
|
|
453
483
|
}
|
|
@@ -475,7 +505,7 @@ const init = command({
|
|
|
475
505
|
args: initArgs,
|
|
476
506
|
handler: async (args) => {
|
|
477
507
|
if (args.debug) console.log({ args });
|
|
478
|
-
const { startInit } = await import("./init-
|
|
508
|
+
const { startInit } = await import("./init-D3toc_qO.mjs");
|
|
479
509
|
await startInit(args);
|
|
480
510
|
process.exit(0);
|
|
481
511
|
}
|
|
@@ -498,7 +528,7 @@ This command:
|
|
|
498
528
|
args: inspectArgs,
|
|
499
529
|
handler: async (args) => {
|
|
500
530
|
if (args.debug) console.log(args);
|
|
501
|
-
const { startInspect } = await import("./inspect-
|
|
531
|
+
const { startInspect } = await import("./inspect-CKdafPbC.mjs");
|
|
502
532
|
startInspect(args);
|
|
503
533
|
process.exit(0);
|
|
504
534
|
}
|
|
@@ -577,10 +607,10 @@ Resolution order for the registry URL:
|
|
|
577
607
|
throw error;
|
|
578
608
|
}
|
|
579
609
|
}
|
|
580
|
-
const { updateConfigFile, updateStylesFile } = await import("./utils-
|
|
610
|
+
const { updateConfigFile, updateStylesFile } = await import("./utils-DPGwKNam.mjs");
|
|
581
611
|
try {
|
|
582
612
|
console.log("⚙️ Updating powerhouse config file...");
|
|
583
|
-
updateConfigFile(dependenciesWithVersions, projectPath, "install", args.local ? "local" : "registry", registryUrl);
|
|
613
|
+
updateConfigFile(dependenciesWithVersions, projectPath, "install", args.local ? "local" : "registry", registryUrl, args.registry !== void 0);
|
|
584
614
|
console.log("Config file updated successfully 🎉");
|
|
585
615
|
} catch (error) {
|
|
586
616
|
console.error("❌ Failed to update config file");
|
|
@@ -755,7 +785,7 @@ const migrate = command({
|
|
|
755
785
|
description: "Run migrations",
|
|
756
786
|
handler: async (args) => {
|
|
757
787
|
if (args.debug) console.log(args);
|
|
758
|
-
const { startMigrate } = await import("./migrate-
|
|
788
|
+
const { startMigrate } = await import("./migrate-BJQvY88v.mjs");
|
|
759
789
|
await startMigrate(args);
|
|
760
790
|
process.exit(0);
|
|
761
791
|
}
|
|
@@ -803,7 +833,7 @@ This command:
|
|
|
803
833
|
const { projectPath } = await getPowerhouseProjectInfo();
|
|
804
834
|
if (!projectPath) throw new Error("Could not find project path.");
|
|
805
835
|
const { checkNpmAuth, npmPublish, resolveRegistryUrl } = await import("@powerhousedao/shared/registry");
|
|
806
|
-
const { mintRegistryAuthToken } = await import("./registry-auth-
|
|
836
|
+
const { mintRegistryAuthToken } = await import("./registry-auth-DxEWCJu2.mjs");
|
|
807
837
|
const registryUrl = resolveRegistryUrl({
|
|
808
838
|
registry: args.registry,
|
|
809
839
|
projectPath
|
|
@@ -893,7 +923,7 @@ Usage:
|
|
|
893
923
|
const projectPath = (await getPowerhouseProjectInfo().catch(() => null))?.projectPath ?? process.cwd();
|
|
894
924
|
const [{ resolveRegistryUrl, writeRegistryAuthToken }, { mintRegistryAuthToken }, { parseExpiry, formatExpiry }] = await Promise.all([
|
|
895
925
|
import("@powerhousedao/shared/registry"),
|
|
896
|
-
import("./registry-auth-
|
|
926
|
+
import("./registry-auth-DxEWCJu2.mjs"),
|
|
897
927
|
import("@renown/sdk/node")
|
|
898
928
|
]);
|
|
899
929
|
const registryUrl = resolveRegistryUrl({
|
|
@@ -930,7 +960,7 @@ This command:
|
|
|
930
960
|
const { basePath, dbPath, migrate, migrateStatus, reset, yes } = args;
|
|
931
961
|
if (basePath) process.env.BASE_PATH = basePath;
|
|
932
962
|
if (reset) {
|
|
933
|
-
const { resetSwitchboardDatabase } = await import("./switchboard-reset-
|
|
963
|
+
const { resetSwitchboardDatabase } = await import("./switchboard-reset-BcQXlcVf.mjs");
|
|
934
964
|
await resetSwitchboardDatabase({
|
|
935
965
|
dbPath,
|
|
936
966
|
yes
|
|
@@ -938,14 +968,14 @@ This command:
|
|
|
938
968
|
process.exit(0);
|
|
939
969
|
}
|
|
940
970
|
if (migrate || migrateStatus) {
|
|
941
|
-
const { runSwitchboardMigrations } = await import("./switchboard-migrate-
|
|
971
|
+
const { runSwitchboardMigrations } = await import("./switchboard-migrate-NQ7LHWSi.mjs");
|
|
942
972
|
await runSwitchboardMigrations({
|
|
943
973
|
dbPath,
|
|
944
974
|
statusOnly: migrateStatus
|
|
945
975
|
});
|
|
946
976
|
process.exit(0);
|
|
947
977
|
}
|
|
948
|
-
const { startSwitchboard } = await import("./switchboard-
|
|
978
|
+
const { startSwitchboard } = await import("./switchboard-iRFugh8I.mjs");
|
|
949
979
|
const { defaultDriveUrl, renown } = await startSwitchboard(args);
|
|
950
980
|
console.log(" ➜ Switchboard:", defaultDriveUrl);
|
|
951
981
|
if (renown) console.log(" ➜ Identity:", renown.did);
|
|
@@ -991,7 +1021,7 @@ This command:
|
|
|
991
1021
|
console.error("❌ Failed to uninstall dependencies");
|
|
992
1022
|
throw error;
|
|
993
1023
|
}
|
|
994
|
-
const { removeStylesImports, updateConfigFile } = await import("./utils-
|
|
1024
|
+
const { removeStylesImports, updateConfigFile } = await import("./utils-DPGwKNam.mjs");
|
|
995
1025
|
try {
|
|
996
1026
|
console.log("⚙️ Updating powerhouse config file...");
|
|
997
1027
|
updateConfigFile(dependenciesWithVersions, projectPath, "uninstall");
|
|
@@ -1122,7 +1152,7 @@ This command:
|
|
|
1122
1152
|
args: vetraArgs,
|
|
1123
1153
|
handler: async (args) => {
|
|
1124
1154
|
if (args.debug) console.log(args);
|
|
1125
|
-
const { startVetra } = await import("./vetra-
|
|
1155
|
+
const { startVetra } = await import("./vetra-DjsGCr0t.mjs");
|
|
1126
1156
|
await startVetra(args);
|
|
1127
1157
|
}
|
|
1128
1158
|
}),
|
|
@@ -1222,7 +1252,8 @@ async function main() {
|
|
|
1222
1252
|
if (command === "connect" && ![
|
|
1223
1253
|
"studio",
|
|
1224
1254
|
"build",
|
|
1225
|
-
"preview"
|
|
1255
|
+
"preview",
|
|
1256
|
+
"config"
|
|
1226
1257
|
].includes(args[1]) && !isHelp) await run(cli, [
|
|
1227
1258
|
"connect",
|
|
1228
1259
|
"studio",
|
|
@@ -1244,4 +1275,4 @@ await main().catch(async (error) => {
|
|
|
1244
1275
|
export {};
|
|
1245
1276
|
|
|
1246
1277
|
//# sourceMappingURL=cli.mjs.map
|
|
1247
|
-
//# debugId=
|
|
1278
|
+
//# debugId=3cb30f37-19c2-5c02-ad5c-b75e789bcc1a
|