@powerhousedao/ph-cli 6.2.3-dev.79 → 6.2.3-dev.80
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/{build-DUzhIPb7.mjs → build-t5pFQx0f.mjs} +37 -35
- package/dist/build-t5pFQx0f.mjs.map +1 -0
- package/dist/build-wvc_NiGr.mjs +4 -0
- package/dist/{check-DDy1o6Vr.mjs → check-ecwBLzrg.mjs} +5 -5
- package/dist/{check-DDy1o6Vr.mjs.map → check-ecwBLzrg.mjs.map} +1 -1
- package/dist/{cli-connect-override-By7u9IVR.mjs → cli-connect-override-DW7OYAGx.mjs} +4 -4
- package/dist/{cli-connect-override-By7u9IVR.mjs.map → cli-connect-override-DW7OYAGx.mjs.map} +1 -1
- package/dist/cli.mjs +4 -4
- package/dist/{compound-Cfqa5Jal-B5rkCmIj.mjs → compound-C7GuPnTP-Ba4ce2Xa.mjs} +251 -17
- package/dist/compound-C7GuPnTP-Ba4ce2Xa.mjs.map +1 -0
- package/dist/{connect-build-BBAZuqpo.mjs → connect-build-7nmQw9c5.mjs} +5 -5
- package/dist/{connect-build-BBAZuqpo.mjs.map → connect-build-7nmQw9c5.mjs.map} +1 -1
- package/dist/{connect-config-ghJlOd-x.mjs → connect-config-CfQwxG8G.mjs} +4 -4
- package/dist/{connect-config-ghJlOd-x.mjs.map → connect-config-CfQwxG8G.mjs.map} +1 -1
- package/dist/{connect-plugin-configs-BoPbxD9u.mjs → connect-plugin-configs-CXN8_KL0.mjs} +4 -4
- package/dist/{connect-plugin-configs-BoPbxD9u.mjs.map → connect-plugin-configs-CXN8_KL0.mjs.map} +1 -1
- package/dist/{connect-preview-8-qLgWKt.mjs → connect-preview-l0Car-nX.mjs} +7 -5
- package/dist/connect-preview-l0Car-nX.mjs.map +1 -0
- package/dist/{connect-studio-BaVeuul3.mjs → connect-studio-Cac3eE_U.mjs} +11 -8
- package/dist/connect-studio-Cac3eE_U.mjs.map +1 -0
- package/dist/{connect-studio-CfggUldW.mjs → connect-studio-Cf6UZvOo.mjs} +3 -3
- package/dist/{dist-Bd6sSt7Y.mjs → dist-DcARVrSg.mjs} +8 -6
- package/dist/dist-DcARVrSg.mjs.map +1 -0
- package/dist/{explain-C9zER5xn.mjs → explain-Rx7JW1OU.mjs} +5 -5
- package/dist/{explain-C9zER5xn.mjs.map → explain-Rx7JW1OU.mjs.map} +1 -1
- package/dist/{export-CrIz2spe.mjs → export-ZnJeAtLS.mjs} +4 -4
- package/dist/{export-CrIz2spe.mjs.map → export-ZnJeAtLS.mjs.map} +1 -1
- package/dist/{generate-all-DgEFOXwU.mjs → generate-all-5Om0CB4N.mjs} +4 -4
- package/dist/{generate-all-DgEFOXwU.mjs.map → generate-all-5Om0CB4N.mjs.map} +1 -1
- package/dist/{generate-desktop-shell-BXcGvbms.mjs → generate-desktop-shell-DzEzNspp.mjs} +4 -4
- package/dist/{generate-desktop-shell-BXcGvbms.mjs.map → generate-desktop-shell-DzEzNspp.mjs.map} +1 -1
- package/dist/{get-version-_coBX13A.mjs → get-version-C-oL2owF.mjs} +4 -4
- package/dist/{get-version-_coBX13A.mjs.map → get-version-C-oL2owF.mjs.map} +1 -1
- package/dist/{index-DdpGYzN0.d.mts → index-CJN_BRkc.d.mts} +5 -3
- package/dist/index-CJN_BRkc.d.mts.map +1 -0
- package/dist/{mcp-CZ02pj76.mjs → mcp-DvyBEajv.mjs} +4 -4
- package/dist/{mcp-CZ02pj76.mjs.map → mcp-DvyBEajv.mjs.map} +1 -1
- package/dist/{member-config-8Vwys-4O.mjs → member-config-0tHtiVN_.mjs} +5 -5
- package/dist/{member-config-8Vwys-4O.mjs.map → member-config-0tHtiVN_.mjs.map} +1 -1
- package/dist/{ph-cli-commands-B37zr8uN.mjs → ph-cli-commands-C8eWT5mr.mjs} +19 -18
- package/dist/ph-cli-commands-C8eWT5mr.mjs.map +1 -0
- package/dist/ph-cli-commands-DviLBBKz.mjs +4 -0
- package/dist/{run-sugar-BzGnofrW.mjs → run-sugar-CRzZsmVo.mjs} +4 -4
- package/dist/{run-sugar-BzGnofrW.mjs.map → run-sugar-CRzZsmVo.mjs.map} +1 -1
- package/dist/runners/connect.d.mts +11 -3
- package/dist/runners/connect.d.mts.map +1 -1
- package/dist/runners/connect.mjs +36 -12
- package/dist/runners/connect.mjs.map +1 -1
- package/dist/runners/switchboard.d.mts +20 -5
- package/dist/runners/switchboard.d.mts.map +1 -1
- package/dist/runners/switchboard.mjs +49 -17
- package/dist/runners/switchboard.mjs.map +1 -1
- package/dist/{schemas-Cnv5AnQT.mjs → schemas-ByfuhvAb.mjs} +4 -4
- package/dist/{schemas-Cnv5AnQT.mjs.map → schemas-ByfuhvAb.mjs.map} +1 -1
- package/dist/{start-run-BAQDM5Bu.mjs → start-run-CRVBqQ8L.mjs} +4 -4
- package/dist/{start-run-BAQDM5Bu.mjs.map → start-run-CRVBqQ8L.mjs.map} +1 -1
- package/dist/switchboard-B7mvNWcd.mjs +4 -0
- package/dist/{switchboard-BI35F5H7.mjs → switchboard-Cqs5IBNF.mjs} +19 -12
- package/dist/switchboard-Cqs5IBNF.mjs.map +1 -0
- package/dist/switchboard-proxy-CGfMtENM.mjs +37 -0
- package/dist/switchboard-proxy-CGfMtENM.mjs.map +1 -0
- package/dist/{vetra-C9fsChId.mjs → vetra-DZYtcHqV.mjs} +7 -7
- package/dist/{vetra-C9fsChId.mjs.map → vetra-DZYtcHqV.mjs.map} +1 -1
- package/package.json +14 -14
- package/dist/build-DUzhIPb7.mjs.map +0 -1
- package/dist/build-FoZl36TM.mjs +0 -4
- package/dist/compound-Cfqa5Jal-B5rkCmIj.mjs.map +0 -1
- package/dist/connect-preview-8-qLgWKt.mjs.map +0 -1
- package/dist/connect-studio-BaVeuul3.mjs.map +0 -1
- package/dist/dist-Bd6sSt7Y.mjs.map +0 -1
- package/dist/index-DdpGYzN0.d.mts.map +0 -1
- package/dist/ph-cli-commands-B37zr8uN.mjs.map +0 -1
- package/dist/ph-cli-commands-S3ArIR8q.mjs +0 -4
- package/dist/switchboard-BI35F5H7.mjs.map +0 -1
- package/dist/switchboard-DohZ1tbp.mjs +0 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
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]="
|
|
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]="8bd27820-5036-5c2f-883c-3003ca4a9a6a")}catch(e){}}();
|
|
3
3
|
import { n as OFFERED_ROUTES_MODULE, r as syncProjectConnectRoutes, t as HOST_ROUTES_DIR } from "./sync-connect-routes-t0Slg-P6.mjs";
|
|
4
4
|
import { r as noConnectImports } from "./offered-routes-imports-CalXK9dh.mjs";
|
|
5
5
|
import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
|
|
@@ -13,6 +13,38 @@ import { nodeFileTrace } from "@vercel/nft";
|
|
|
13
13
|
import { detect, resolveCommand } from "package-manager-detector";
|
|
14
14
|
import { readPackage } from "read-pkg";
|
|
15
15
|
import { build } from "tsdown";
|
|
16
|
+
//#region src/utils/offered-routes-manifest.ts
|
|
17
|
+
function withOfferedRoutes(json, offers) {
|
|
18
|
+
const manifest = JSON.parse(json);
|
|
19
|
+
if (offers ? manifest.connectRoutes === true : !("connectRoutes" in manifest)) return json;
|
|
20
|
+
if (offers) manifest.connectRoutes = true;
|
|
21
|
+
else delete manifest.connectRoutes;
|
|
22
|
+
return `${JSON.stringify(manifest, null, 2)}\n`;
|
|
23
|
+
}
|
|
24
|
+
const slashes = (path) => path.replaceAll("\\", "/");
|
|
25
|
+
/** Sets `connectRoutes` in the manifest the package's root module imports,
|
|
26
|
+
* leaving the project's file as it is. */
|
|
27
|
+
function offeredRoutesManifest(projectRoot, offers) {
|
|
28
|
+
const manifestPath = slashes(join(projectRoot, "powerhouse.manifest.json"));
|
|
29
|
+
return {
|
|
30
|
+
name: "ph-offered-routes-manifest",
|
|
31
|
+
transform(code, id) {
|
|
32
|
+
if (slashes(id) !== manifestPath) return null;
|
|
33
|
+
return {
|
|
34
|
+
code: withOfferedRoutes(code, offers),
|
|
35
|
+
map: null
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/** Sets `connectRoutes` in the dist copy of the manifest. */
|
|
41
|
+
function markOfferedRoutes(dir, offers) {
|
|
42
|
+
const manifestPath = join(dir, "powerhouse.manifest.json");
|
|
43
|
+
if (!existsSync(manifestPath)) return;
|
|
44
|
+
const json = readFileSync(manifestPath, "utf-8");
|
|
45
|
+
writeFileSync(manifestPath, withOfferedRoutes(json, offers));
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
16
48
|
//#region src/services/build.ts
|
|
17
49
|
function createTraceFiles() {
|
|
18
50
|
const cache = {};
|
|
@@ -48,36 +80,6 @@ async function assertManifestNameMatchesPackage(projectPath) {
|
|
|
48
80
|
}
|
|
49
81
|
if (manifestName !== packageName) throw new Error(`Package name mismatch — "package.json" and "powerhouse.manifest.json" must have the same "name":\n package.json "name": ${JSON.stringify(packageName)}\n powerhouse.manifest.json "name": ${JSON.stringify(manifestName)}\n\nUpdate one so they match, then run the build again.`);
|
|
50
82
|
}
|
|
51
|
-
function withOfferedRoutes(json, offers) {
|
|
52
|
-
const manifest = JSON.parse(json);
|
|
53
|
-
if (offers ? manifest.connectRoutes === true : !("connectRoutes" in manifest)) return json;
|
|
54
|
-
if (offers) manifest.connectRoutes = true;
|
|
55
|
-
else delete manifest.connectRoutes;
|
|
56
|
-
return `${JSON.stringify(manifest, null, 2)}\n`;
|
|
57
|
-
}
|
|
58
|
-
const slashes = (path) => path.replaceAll("\\", "/");
|
|
59
|
-
/** Sets `connectRoutes` in the manifest the package's root module imports,
|
|
60
|
-
* leaving the project's file as it is. */
|
|
61
|
-
function offeredRoutesManifest(projectRoot, offers) {
|
|
62
|
-
const manifestPath = slashes(join(projectRoot, "powerhouse.manifest.json"));
|
|
63
|
-
return {
|
|
64
|
-
name: "ph-offered-routes-manifest",
|
|
65
|
-
transform(code, id) {
|
|
66
|
-
if (slashes(id) !== manifestPath) return null;
|
|
67
|
-
return {
|
|
68
|
-
code: withOfferedRoutes(code, offers),
|
|
69
|
-
map: null
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
/** Sets `connectRoutes` in the dist copy of the manifest. */
|
|
75
|
-
function markOfferedRoutes(dir, offers) {
|
|
76
|
-
const manifestPath = join(dir, "powerhouse.manifest.json");
|
|
77
|
-
if (!existsSync(manifestPath)) return;
|
|
78
|
-
const json = readFileSync(manifestPath, "utf-8");
|
|
79
|
-
writeFileSync(manifestPath, withOfferedRoutes(json, offers));
|
|
80
|
-
}
|
|
81
83
|
async function runBuild(args) {
|
|
82
84
|
const { outDir } = args;
|
|
83
85
|
const projectRoot = process.cwd();
|
|
@@ -125,7 +127,7 @@ async function runBuild(args) {
|
|
|
125
127
|
plugins: [externalDepsPlugin(trace, external, {
|
|
126
128
|
root: projectRoot,
|
|
127
129
|
ignoreDirs: ["editors"],
|
|
128
|
-
forbidDirs: ["document-models"],
|
|
130
|
+
forbidDirs: ["document-models", "scalars"],
|
|
129
131
|
cache: detection
|
|
130
132
|
})]
|
|
131
133
|
}),
|
|
@@ -296,7 +298,7 @@ function readDistBrowserFiles(dir) {
|
|
|
296
298
|
return out;
|
|
297
299
|
}
|
|
298
300
|
//#endregion
|
|
299
|
-
export {
|
|
301
|
+
export { runBuild as i, assertManifestNameMatchesPackage as n, createTraceFiles as r, assertExternalDependenciesDeclared as t };
|
|
300
302
|
|
|
301
|
-
//# sourceMappingURL=build-
|
|
302
|
-
//# debugId=
|
|
303
|
+
//# sourceMappingURL=build-t5pFQx0f.mjs.map
|
|
304
|
+
//# debugId=8bd27820-5036-5c2f-883c-3003ca4a9a6a
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-t5pFQx0f.mjs","sources":["../src/utils/offered-routes-manifest.ts","../src/services/build.ts"],"sourcesContent":["import { existsSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\n// The manifest with `connectRoutes` set when the package offers routes; as it\n// is, byte for byte, when the flag is already right.\nfunction withOfferedRoutes(json: string, offers: boolean) {\n const manifest = JSON.parse(json) as { connectRoutes?: boolean };\n if (offers ? manifest.connectRoutes === true : !(\"connectRoutes\" in manifest))\n return json;\n if (offers) manifest.connectRoutes = true;\n else delete manifest.connectRoutes;\n return `${JSON.stringify(manifest, null, 2)}\\n`;\n}\n\nconst slashes = (path: string) => path.replaceAll(\"\\\\\", \"/\");\n\n/** Sets `connectRoutes` in the manifest the package's root module imports,\n * leaving the project's file as it is. */\nexport function offeredRoutesManifest(projectRoot: string, offers: boolean) {\n // Vite's ids use forward slashes on Windows too.\n const manifestPath = slashes(join(projectRoot, \"powerhouse.manifest.json\"));\n return {\n name: \"ph-offered-routes-manifest\",\n transform(code: string, id: string) {\n if (slashes(id) !== manifestPath) return null;\n return { code: withOfferedRoutes(code, offers), map: null };\n },\n };\n}\n\n/** Sets `connectRoutes` in the dist copy of the manifest. */\nexport function markOfferedRoutes(dir: string, offers: boolean) {\n const manifestPath = join(dir, \"powerhouse.manifest.json\");\n if (!existsSync(manifestPath)) return;\n const json = readFileSync(manifestPath, \"utf-8\");\n writeFileSync(manifestPath, withOfferedRoutes(json, offers));\n}\n","import {\n browserEntry,\n buildBrowserBuildConfig,\n buildNodeBuildConfig,\n findBundledSharedDeps,\n} from \"@powerhousedao/shared/build-config\";\nimport type {\n BuiltPiece,\n ExternalDependency,\n TraceFiles,\n} from \"@powerhousedao/shared/build-pieces\";\nimport {\n assertPiecesOutDir,\n buildPieces,\n expandEntryGlobs,\n createDetectionCache,\n externalDependencyVersions,\n projectPath,\n externalDepsPlugin,\n pieceListPath,\n planPieces,\n syncDistManifest,\n undeclaredExternalDependencies,\n} from \"@powerhousedao/shared/build-pieces\";\nimport {\n localPackageNames,\n packageStyleEntry,\n packageStylesheet,\n} from \"@powerhousedao/shared/clis/package-style\";\nimport {\n findSharedImports,\n EXTERNALIZABLE_SHARED_SPECIFIERS,\n} from \"@powerhousedao/shared/connect\";\nimport { execSync } from \"node:child_process\";\nimport {\n existsSync,\n mkdirSync,\n readdirSync,\n readFileSync,\n writeFileSync,\n} from \"node:fs\";\nimport { join, relative, resolve } from \"node:path\";\nimport { nodeFileTrace } from \"@vercel/nft\";\nimport { detect, resolveCommand, type Agent } from \"package-manager-detector\";\nimport { readPackage } from \"read-pkg\";\nimport { build as tsdownBuild } from \"tsdown\";\nimport type { BuildArgs } from \"../types.js\";\nimport { noConnectImports } from \"../utils/offered-routes-imports.js\";\nimport {\n markOfferedRoutes,\n offeredRoutesManifest,\n} from \"../utils/offered-routes-manifest.js\";\nimport {\n HOST_ROUTES_DIR,\n OFFERED_ROUTES_MODULE,\n syncProjectConnectRoutes,\n} from \"../utils/sync-connect-routes.js\";\n\n// nft reports paths relative to its base; from \"/\" that is every path minus its root.\n// One cache per build: the traces of a project's packages share most files.\nexport function createTraceFiles(): TraceFiles {\n const cache = {};\n return (file) => traceFile(file, cache);\n}\n\nexport const traceFiles: TraceFiles = createTraceFiles();\n\nasync function traceFile(file: string, cache: object) {\n const { fileList, reasons } = await nodeFileTrace([file], {\n base: \"/\",\n cache,\n });\n const absolute = (p: string) => resolve(\"/\", p);\n return {\n fileList: new Set([...fileList].map(absolute)),\n reasons: new Map(\n [...reasons].map(([p, reason]) => [\n absolute(p),\n { parents: new Set([...reason.parents].map(absolute)) },\n ]),\n ),\n };\n}\n\n/**\n * A Powerhouse package's `powerhouse.manifest.json` \"name\" must match its\n * `package.json` \"name\" — Connect and the registry resolve installed versions\n * by treating the manifest name as the npm package name, so a mismatch silently\n * breaks resolution. Fail the build early if they diverge. No-op when the\n * project has no manifest (nothing to compare).\n */\nexport async function assertManifestNameMatchesPackage(projectPath: string) {\n const manifestPath = join(projectPath, \"powerhouse.manifest.json\");\n if (!existsSync(manifestPath)) return;\n\n const { name: packageName } = await readPackage({ cwd: projectPath });\n\n let manifestName: unknown;\n try {\n manifestName = (\n JSON.parse(readFileSync(manifestPath, \"utf-8\")) as { name?: unknown }\n ).name;\n } catch {\n throw new Error(\n `Failed to parse \"powerhouse.manifest.json\" at ${manifestPath}. Make sure it is valid JSON.`,\n );\n }\n\n if (manifestName !== packageName) {\n throw new Error(\n `Package name mismatch — \"package.json\" and \"powerhouse.manifest.json\" must have the same \"name\":\\n` +\n ` package.json \"name\": ${JSON.stringify(packageName)}\\n` +\n ` powerhouse.manifest.json \"name\": ${JSON.stringify(manifestName)}\\n\\n` +\n `Update one so they match, then run the build again.`,\n );\n }\n}\n\nexport async function runBuild(args: BuildArgs) {\n const { outDir } = args;\n const projectRoot = process.cwd();\n\n // Fail fast if the manifest name and package.json name have drifted apart.\n await assertManifestNameMatchesPackage(projectRoot);\n\n const target = {\n projectRoot,\n outDir,\n pieces: planPieces(projectRoot, outDir),\n };\n // Before any bundler runs: an out-dir a host will never read from is worth\n // nothing built, and the failure names what the contract is.\n assertPiecesOutDir(target);\n const sharedDeps = !args.noSharedDeps;\n\n const detectResult = await detect();\n const agent = detectResult?.agent ?? \"npm\";\n\n // Project routes type-check against the tree generated from them.\n await syncProjectConnectRoutes(projectRoot);\n // Connect reads the manifest's flag to load the package's routes.\n const offersRoutes = existsSync(join(projectRoot, OFFERED_ROUTES_MODULE));\n\n // Before any bundler runs, so declining leaves nothing half built.\n const typesOk = emitTypes(agent, outDir, projectRoot);\n if (!typesOk && !args.ignoreTypeErrors) {\n await confirmBuildDespiteTypeErrors();\n }\n\n // Shared by the browser, node and piece builds: nothing is traced twice.\n const detection = createDetectionCache();\n const trace = createTraceFiles();\n const routesEntry = join(projectRoot, OFFERED_ROUTES_MODULE);\n // Everything in the browser build is code Connect can load: native fails it.\n await tsdownBuild({\n ...buildBrowserBuildConfig({\n sharedDeps,\n plugins: [\n externalDepsPlugin(trace, new Map(), {\n root: projectRoot,\n browser: true,\n cache: detection,\n }),\n offeredRoutesManifest(projectRoot, offersRoutes),\n noConnectImports(routesEntry, join(projectRoot, HOST_ROUTES_DIR)),\n ],\n }),\n // The offered routes in the package's build: a module both import is one\n // chunk, which other Connects evaluate once. Absolute: a relative entry\n // is a glob, and globs skip `.ph`.\n ...(offersRoutes\n ? { entry: [...browserEntry, { \"connect-routes\": routesEntry }] }\n : {}),\n outDir: join(outDir, \"browser\"),\n });\n\n // Advisory: a shared dep the source imports but the output no longer\n // references as a bare import was inlined despite the external set.\n if (sharedDeps) {\n const imported = findSharedImportsInSources(projectRoot, browserEntry);\n const bundled = findBundledSharedDeps(\n imported,\n readDistBrowserFiles(join(outDir, \"browser\")),\n );\n if (bundled.length > 0) {\n console.warn(\n `⚠ shared deps bundled instead of externalized: ${bundled.join(\", \")} — check your neverBundle config`,\n );\n }\n }\n\n const external = new Map<string, ExternalDependency>();\n await tsdownBuild({\n ...buildNodeBuildConfig({\n sharedDeps,\n plugins: [\n // Editors never run on a host; document models and scalars run in Connect too.\n externalDepsPlugin(trace, external, {\n root: projectRoot,\n ignoreDirs: [\"editors\"],\n forbidDirs: [\"document-models\", \"scalars\"],\n cache: detection,\n }),\n ],\n }),\n outDir: join(outDir, \"node\"),\n });\n const pkg = await readPackage({ cwd: projectRoot });\n assertExternalDependenciesDeclared(projectRoot, [...external.values()], pkg);\n\n // After the node build: it cleans <outDir>/node, where the pieces land. The\n // built list is the gate, so a `bundle:` entry is validated with no piece dir.\n let built: BuiltPiece[] = [];\n if (existsSync(pieceListPath(target))) {\n built = await buildPieces(\n target,\n {\n name: pkg.name,\n version: pkg.version,\n license: typeof pkg.license === \"string\" ? pkg.license : undefined,\n },\n { bundle: tsdownBuild, trace, cache: detection },\n );\n }\n syncDistManifest(\n target,\n built,\n externalDependencyVersions(external.values()),\n );\n markOfferedRoutes(outDir, offersRoutes);\n\n buildPackageStylesheet(agent, projectRoot, join(outDir, \"browser\"));\n\n // Last, so it is the line a finished build leaves on screen.\n if (!typesOk) console.warn(`\\n${UNSAFE_BUILD_WARNING}`);\n}\n\n// A package with a native addon or WebAssembly module stays external, so the\n// package's consumers must install it: devDependencies are skipped by every install.\nexport function assertExternalDependenciesDeclared(\n projectRoot: string,\n found: ExternalDependency[],\n pkg: Parameters<typeof undeclaredExternalDependencies>[1],\n) {\n for (const dep of found) {\n console.log(\n `${dep.name}@${dep.version} stays external, it needs ${projectPath(projectRoot, dep.file)}`,\n );\n }\n const undeclared = undeclaredExternalDependencies(found, pkg);\n if (undeclared.length === 0) return;\n const lines = undeclared.map(\n (dep) =>\n ` ${dep.name}${dep.importer ? ` (imported by ${projectPath(projectRoot, dep.importer)})` : \"\"}`,\n );\n throw new Error(\n `Packages with native addons or WebAssembly modules must be listed in package.json \"dependencies\", \"optionalDependencies\" or \"peerDependencies\":\\n` +\n `${lines.join(\"\\n\")}\\n\\n` +\n `They stay external to the build, and installs of this package skip devDependencies.`,\n );\n}\n\n// tsc's build info outlives a deleted dist; with the declarations gone, tsc\n// would call the project up to date and emit nothing.\nfunction declarationsMissing(agent: Agent, projectRoot: string): boolean {\n const showConfig = resolveCommand(agent, \"execute-local\", [\n \"tsc\",\n \"--showConfig\",\n ]);\n if (showConfig === null) return false;\n let options: {\n declaration?: boolean;\n composite?: boolean;\n declarationDir?: string;\n outDir?: string;\n };\n try {\n const output = execSync(\n `${showConfig.command} ${showConfig.args.join(\" \")}`,\n {\n cwd: projectRoot,\n encoding: \"utf8\",\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n },\n );\n options =\n (JSON.parse(output) as { compilerOptions?: typeof options })\n .compilerOptions ?? {};\n } catch {\n return false;\n }\n const dir = options.declarationDir ?? options.outDir;\n if (!dir || !(options.declaration || options.composite)) return false;\n const path = resolve(projectRoot, dir);\n return !existsSync(path) || readdirSync(path).length === 0;\n}\n\n// Runs tsc, which checks the project and writes its declarations either way.\n// Returns whether it reported no type errors.\nfunction emitTypes(agent: Agent, outDir: string, projectRoot: string): boolean {\n const force = declarationsMissing(agent, projectRoot);\n const tscCommand = resolveCommand(agent, \"execute-local\", [\n \"tsc\",\n \"--build\",\n ...(force ? [\"--force\"] : []),\n ]);\n if (tscCommand === null) {\n console.error(\n \"You need to have typescript installed to use the `build` command.\",\n );\n process.exit(1);\n }\n console.log(\"\\n▶ Type-checking and emitting types via tsc...\");\n try {\n execSync(`${tscCommand.command} ${tscCommand.args.join(\" \")}`, {\n stdio: \"inherit\",\n });\n console.log(\"✔ Types emitted to\", join(outDir, \"types\"));\n return true;\n } catch {\n return false;\n }\n}\n\n// The classes the browser build uses, and the package's tokens and rules, against\n// Connect's theme: the Connect that loads it has Tailwind's reset and Connect's classes.\nfunction buildPackageStylesheet(\n agent: Agent,\n projectRoot: string,\n browserDir: string,\n) {\n const command = resolveCommand(agent, \"execute-local\", [\n \"tailwindcss\",\n \"--input\",\n \"-\",\n \"--minify\",\n ]);\n if (command === null) {\n console.error(\n \"You need to have tailwindcss installed to use the `build` command.\",\n );\n process.exit(1);\n }\n const stylePath = join(projectRoot, \"style.css\");\n const style = existsSync(stylePath)\n ? readFileSync(stylePath, \"utf-8\")\n : undefined;\n const compiled = execSync(`${command.command} ${command.args.join(\" \")}`, {\n cwd: projectRoot,\n input: packageStyleEntry(style, {\n browserDir: sourcePath(projectRoot, browserDir),\n localPackages: localPackageNames(projectRoot),\n }),\n encoding: \"utf-8\",\n stdio: [\"pipe\", \"pipe\", \"inherit\"],\n // A package that imports large vendor CSS outgrows the 1 MB default.\n maxBuffer: 64 * 1024 * 1024,\n });\n // `ph build` with another out-dir (the switchboard runner's) leaves no dist/.\n mkdirSync(join(projectRoot, \"dist\"), { recursive: true });\n writeFileSync(\n join(projectRoot, \"dist/style.css\"),\n packageStylesheet(compiled),\n );\n}\n\n// A path for `@source`, relative to the project, with forward slashes.\nfunction sourcePath(projectRoot: string, path: string) {\n return `./${relative(projectRoot, resolve(projectRoot, path)).replaceAll(\"\\\\\", \"/\")}`;\n}\n\nfunction isInteractive(): boolean {\n return Boolean(process.stdin.isTTY) && !process.env.CI;\n}\n\nconst TYPE_ERROR_RISK =\n \"A package built with type errors can load and still fail at runtime.\";\n\nconst UNSAFE_BUILD_WARNING =\n \"⚠ Built despite type errors. \" +\n TYPE_ERROR_RISK +\n \" Fix them before you publish or deploy it.\";\n\nasync function confirmBuildDespiteTypeErrors(): Promise<void> {\n const hint =\n \"Fix them and build again. --ignore-type-errors skips this check, at the risk of shipping that failure.\";\n if (!isInteractive()) {\n console.error(\n `\\n✘ tsc reported the type errors above. ${TYPE_ERROR_RISK}\\n${hint}`,\n );\n process.exit(1);\n }\n const enquirer = await import(\"enquirer\");\n let confirmed: boolean;\n try {\n const answer = await enquirer.default.prompt<{ confirmed: boolean }>({\n type: \"confirm\",\n name: \"confirmed\",\n message: `tsc reported the type errors above. ${TYPE_ERROR_RISK} Build anyway?`,\n initial: false,\n });\n confirmed = answer.confirmed;\n } catch {\n // Ctrl-C at the prompt is a decline.\n confirmed = false;\n }\n if (!confirmed) {\n console.error(`Build cancelled. ${hint}`);\n process.exit(1);\n }\n}\n\n/**\n * Every shared specifier imported from the entry sources; the post-build\n * scan compares these against the built output.\n *\n * Scoped to the specifiers the build actually externalizes: a specifier the\n * vendor does not publish (the bare `@powerhousedao/shared` root, an\n * unvendored subpath) is deliberately bundled, so reporting it as \"bundled\n * instead of externalized\" would be a false alarm.\n */\nfunction findSharedImportsInSources(root: string, globs: string[]): string[] {\n const found = new Set<string>();\n for (const file of expandEntryGlobs(root, globs)) {\n const src = readFileSync(file, \"utf8\");\n for (const spec of findSharedImports(\n src,\n EXTERNALIZABLE_SHARED_SPECIFIERS,\n )) {\n found.add(spec);\n }\n }\n return [...found].sort();\n}\n\n/**\n * The built JS outputs of a browser build (entry files and chunks).\n */\nfunction readDistBrowserFiles(\n dir: string,\n): { path: string; content: string }[] {\n const out: { path: string; content: string }[] = [];\n if (!existsSync(dir)) return out;\n const walk = (d: string) => {\n for (const e of readdirSync(d, { withFileTypes: true })) {\n const p = join(d, e.name);\n if (e.isDirectory()) walk(p);\n else if (e.isFile() && e.name.endsWith(\".js\")) {\n out.push({ path: p, content: readFileSync(p, \"utf8\") });\n }\n }\n };\n walk(dir);\n return out;\n}\n"],"names":["tsdownBuild"],"mappings":";;;;;;;;;;;;;;;;AAKA,SAAS,kBAAkB,MAAc,QAAiB;CACxD,MAAM,WAAW,KAAK,MAAM,IAAI;CAChC,IAAI,SAAS,SAAS,kBAAkB,OAAO,EAAE,mBAAmB,WAClE,OAAO;CACT,IAAI,QAAQ,SAAS,gBAAgB;MAChC,OAAO,SAAS;CACrB,OAAO,GAAG,KAAK,UAAU,UAAU,MAAM,CAAC,EAAE;AAC9C;AAEA,MAAM,WAAW,SAAiB,KAAK,WAAW,MAAM,GAAG;;;AAI3D,SAAgB,sBAAsB,aAAqB,QAAiB;CAE1E,MAAM,eAAe,QAAQ,KAAK,aAAa,0BAA0B,CAAC;CAC1E,OAAO;EACL,MAAM;EACN,UAAU,MAAc,IAAY;GAClC,IAAI,QAAQ,EAAE,MAAM,cAAc,OAAO;GACzC,OAAO;IAAE,MAAM,kBAAkB,MAAM,MAAM;IAAG,KAAK;GAAK;EAC5D;CACF;AACF;;AAGA,SAAgB,kBAAkB,KAAa,QAAiB;CAC9D,MAAM,eAAe,KAAK,KAAK,0BAA0B;CACzD,IAAI,CAAC,WAAW,YAAY,GAAG;CAC/B,MAAM,OAAO,aAAa,cAAc,OAAO;CAC/C,cAAc,cAAc,kBAAkB,MAAM,MAAM,CAAC;AAC7D;;;ACwBA,SAAgB,mBAA+B;CAC7C,MAAM,QAAQ,CAAC;CACf,QAAQ,SAAS,UAAU,MAAM,KAAK;AACxC;AAIA,eAAe,UAAU,MAAc,OAAe;CACpD,MAA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AM,IAAI,KAAK,GAAG,EAAE,IAAI;GACxB,IAAI,EAAE,YAAY,GAAG,KAAK,CAAC;QACtB,IAAI,EAAE,OAAO,KAAK,EAAE,KAAK,SAAS,KAAK,GAC1C,IAAI,KAAK;IAAE,MAAM;IAAG,SAAS,aAAa,GAAG,MAAM;GAAE,CAAC;EAE1D;CACF;CACA,KAAK,GAAG;CACR,OAAO;AACT","debug_id":"8bd27820-5036-5c2f-883c-3003ca4a9a6a"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { i as runBuild } from "./build-t5pFQx0f.mjs";
|
|
2
|
+
export { runBuild };
|
|
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]="038f88af-54f1-5864-b8de-0247a10a30d4")}catch(e){}}();
|
|
4
|
+
//# debugId=038f88af-54f1-5864-b8de-0247a10a30d4
|
|
@@ -1,7 +1,7 @@
|
|
|
1
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]="
|
|
3
|
-
import { n as checkHost } from "./dist-
|
|
4
|
-
import { s as rememberShellNames } from "./member-config-
|
|
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]="b756b89a-4a9d-5c16-bf53-f356abf4c1cc")}catch(e){}}();
|
|
3
|
+
import { n as checkHost } from "./dist-DcARVrSg.mjs";
|
|
4
|
+
import { s as rememberShellNames } from "./member-config-0tHtiVN_.mjs";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { envNamesBeforeProjectEnv, loadProjectEnv } from "@powerhousedao/shared/clis/project-env";
|
|
7
7
|
import dotenv from "dotenv";
|
|
@@ -52,5 +52,5 @@ async function runHostCheck(args) {
|
|
|
52
52
|
//#endregion
|
|
53
53
|
export { runHostCheck };
|
|
54
54
|
|
|
55
|
-
//# sourceMappingURL=check-
|
|
56
|
-
//# debugId=
|
|
55
|
+
//# sourceMappingURL=check-ecwBLzrg.mjs.map
|
|
56
|
+
//# debugId=b756b89a-4a9d-5c16-bf53-f356abf4c1cc
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-
|
|
1
|
+
{"version":3,"file":"check-ecwBLzrg.mjs","sources":["../src/services/host/check.ts"],"sourcesContent":["import { readFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { checkHost, type HostIssue } from \"@powerhousedao/host-core\";\nimport { CALLER_CWD_ENV } from \"@powerhousedao/shared/clis/command-names\";\nimport {\n envNamesBeforeProjectEnv,\n loadProjectEnv,\n} from \"@powerhousedao/shared/clis/project-env\";\nimport dotenv from \"dotenv\";\nimport { rememberShellNames } from \"../../runners/member-config.js\";\n\nexport interface HostCheckArgs {\n host: string;\n envFile?: string;\n verb?: string;\n projectRoot?: string;\n}\n\n/** Without `envFile`: what `ph run` sees (project .env under process env). */\nasync function checkEnv(\n projectRoot: string,\n envFile: string | undefined,\n): Promise<Record<string, string | undefined>> {\n if (envFile === undefined) {\n loadProjectEnv(projectRoot);\n // A snapshot: a .env a runner's checkBoot loads later never reaches it.\n const env = { ...process.env };\n // The switchboard's checkBoot puts the .env's values under the host file.\n rememberShellNames(env, envNamesBeforeProjectEnv() ?? Object.keys(env));\n return env;\n }\n const from = process.env[CALLER_CWD_ENV] ?? process.cwd();\n try {\n return dotenv.parse(await readFile(path.resolve(from, envFile), \"utf8\"));\n } catch (error) {\n throw new Error(\n `Cannot read the env file ${envFile}: ${error instanceof Error ? error.message : String(error)}`,\n { cause: error },\n );\n }\n}\n\nexport function formatHostIssues(\n file: string,\n issues: readonly HostIssue[],\n deferred: number,\n): string {\n if (issues.length === 0) {\n const note =\n deferred > 0\n ? `\\n ${deferred} output token(s) checked declared-only`\n : \"\";\n return `${file}: ok${note}`;\n }\n const byFile = new Map<string, HostIssue[]>();\n for (const issue of issues) {\n byFile.set(issue.file, [...(byFile.get(issue.file) ?? []), issue]);\n }\n const blocks = [...byFile].map(([at, found]) => {\n const lines = found.flatMap((issue) => {\n const where = issue.path ? `${issue.path}: ` : \"\";\n const line = ` ${issue.stage} ${where}${issue.message.replaceAll(\"\\n\", \"\\n \")}`;\n return issue.hint ? [line, ` hint: ${issue.hint}`] : [line];\n });\n return [at, ...lines].join(\"\\n\");\n });\n return blocks.join(\"\\n\\n\");\n}\n\n/** `ph host check <host>`: every issue `ph run` would hit; exits 1 on any. */\nexport async function runHostCheck(\n args: HostCheckArgs,\n): Promise<{ output: string; exitCode: number }> {\n const projectRoot = args.projectRoot ?? process.cwd();\n const env = await checkEnv(projectRoot, args.envFile);\n const { issues, deferred } = await checkHost(args.host, {\n projectRoot,\n env,\n ...(args.verb !== undefined ? { verb: args.verb } : {}),\n });\n return {\n output: formatHostIssues(\n `hosts/${args.host}/host.js`,\n issues,\n deferred.length,\n ),\n exitCode: issues.length > 0 ? 1 : 0,\n };\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAmBA,eAAe,SACb,aACA,SAC6C;CAC7C,IAAI,YAAY,KAAA,GAAW;EACzB,eAAe,WAAW;EAE1B,MAAM,MAAM,EAAE,GAAG,QAAQ,IAAI;EAE7B,mBAAmB,KAAK,yBAAyB,KAAK,OAAO,KAAK,GAAG,CAAC;EACtE,OAAO;CACT;CACA,MAAM,OAAO,QAAQ,IAAI,mBAAmB,QAAQ,IAAI;CACxD,IAAI;EACF,OAAO,OAAO,MAAM,MAAM,SAAS,KAAK,QAAQ,MAAM,OAAO,GAAG,MAAM,CAAC;CACzE,SAAS,OAAO;EACd,MAAM,IAAI,MACR,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6 @@
|
|
|
1
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]="
|
|
3
|
-
import { o as mergeDefaultDrives } from "./dist-
|
|
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]="9e90198b-acf2-58dd-bc1d-71082e0cc0e1")}catch(e){}}();
|
|
3
|
+
import { o as mergeDefaultDrives } from "./dist-DcARVrSg.mjs";
|
|
4
4
|
import { deepMerge, phConnectRuntimeConfigSchema } from "@powerhousedao/shared/connect";
|
|
5
5
|
import AjvNs from "ajv";
|
|
6
6
|
import { isPlainObject, stringToPath } from "remeda";
|
|
@@ -289,5 +289,5 @@ function buildStudioConnectOverride(args, callerOverride) {
|
|
|
289
289
|
//#endregion
|
|
290
290
|
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 };
|
|
291
291
|
|
|
292
|
-
//# sourceMappingURL=cli-connect-override-
|
|
293
|
-
//# debugId=
|
|
292
|
+
//# sourceMappingURL=cli-connect-override-DW7OYAGx.mjs.map
|
|
293
|
+
//# debugId=9e90198b-acf2-58dd-bc1d-71082e0cc0e1
|
package/dist/{cli-connect-override-By7u9IVR.mjs.map → cli-connect-override-DW7OYAGx.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-connect-override-By7u9IVR.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 = {\n instancePath?: string;\n message?: string;\n params?: { additionalProperty?: string };\n};\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 const extra = e.params?.additionalProperty;\n const suffix = extra === undefined ? \"\" : ` (${JSON.stringify(extra)})`;\n return ` ${path} ${e.message ?? \"\"}${suffix}`.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 *\n * `command` prefixes error messages (e.g. \"ph connect build\").\n */\nexport function validateConnectPatch(\n raw: string,\n command = \"ph connect config\",\n): ConnectPartial & {\n packageRegistryUrl?: unknown;\n} {\n const label = `${command} --json`;\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 `${label}: 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 `${label}: payload must be a JSON object, got ${typeof parsed}.`,\n );\n }\n if (Object.prototype.hasOwnProperty.call(parsed, \"connect\")) {\n const inner = JSON.stringify((parsed as PlainObject).connect);\n throw new Error(\n `${label}: pass the connect.* block without the \"connect\" wrapper, e.g. --json '${inner}'.`,\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 `${label}: validation failed:\\n${formatErrors(validateConnect.errors)}\\nExpected a partial connect.* blob with nested keys, e.g. --json '{\"app\":{\"workflowsEnabled\":true}}'.`,\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 {\n PHConnectDefaultDrive,\n PHConnectRuntimeConfig,\n} from \"@powerhousedao/shared/clis\";\nimport { deepMerge } from \"@powerhousedao/shared/connect\";\nimport { mergeDefaultDrives } from \"@powerhousedao/host-core\";\nimport type { ConnectBuildArgs, ConnectStudioArgs } from \"../types.js\";\nimport {\n normalizeKey,\n parseCliValue,\n validateConnectKeyValue,\n validateConnectPatch,\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 renownNamespace?: string | undefined;\n renownSwitchboardUrl?: string | undefined;\n allowAddDrive?: boolean | undefined;\n externalPackages?: boolean | undefined;\n workflows?: 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// Schema-validates `--json` so unknown keys, a `connect` wrapper or wrong\n// types fail instead of being dropped from the dist config.\nfunction parseJsonOverride(raw: string | undefined): PlainObject {\n if (raw === undefined || raw === \"\") return {};\n return validateConnectPatch(raw, \"ph connect build\") as PlainObject;\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 20 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 setIfDefined(app, \"workflowsEnabled\", args.workflows);\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 setIfDefined(renown, \"namespace\", args.renownNamespace);\n setIfDefined(renown, \"switchboardUrl\", args.renownSwitchboardUrl);\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 const branding: PlainObject = {};\n setIfDefined(branding, \"appName\", args.appName);\n if (Object.keys(branding).length > 0) out.branding = branding;\n\n // --home-background: empty string is the explicit \"set null\" form\n // (cmd-ts can't pass `null` directly through a string option). The home\n // screen is the generic plugin's, so this lands in connect.home.\n if (args.homeBackground !== undefined) {\n out.home = {\n background: args.homeBackground === \"\" ? null : args.homeBackground,\n };\n }\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 renownNamespace: args.renownNamespace,\n renownSwitchboardUrl: args.renownSwitchboardUrl,\n allowAddDrive: args.allowAddDrive,\n externalPackages: args.externalPackages,\n workflows: args.workflows,\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). The flag override\n * deep-merges on top of it: caller choices apply for every flag the user\n * didn't type, and an explicitly passed flag wins for its own field —\n * except `drives.defaultDrives`, which merges additively: a flag's drives\n * are appended to the caller's list (de-duplicated by drive identity) rather\n * than replacing it, so vetra's own drives stay in Connect's default set.\n * Without a caller override (plain `ph connect studio`) only the flag can\n * carry defaultDrives, so that command's behavior is unchanged.\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 renownNamespace: args.renownNamespace,\n }) as PHConnectRuntimeConfig;\n\n // Studio commands (`ph connect studio`, `ph vetra`) always run in studio\n // mode: Connect loads the vetra package and offers builder document types.\n const studioOverride: PHConnectRuntimeConfig = { app: { studioMode: true } };\n const layers = [callerOverride, flagOverride, studioOverride].filter(\n (o): o is PHConnectRuntimeConfig =>\n o !== undefined && Object.keys(o).length > 0,\n );\n const merged = layers.reduce(\n (acc, o) => deepMerge(acc, o),\n {} as PHConnectRuntimeConfig,\n );\n\n // `deepMerge` replaces arrays, so the flag's defaultDrives would clobber\n // the caller's list; re-apply them as the de-duplicated union instead.\n // Only needed when two or more layers contribute default drives (the\n // plain-studio single-layer case is already exactly the flag's list).\n const driveGroups = layers\n .map((l) => l.drives?.defaultDrives)\n .filter(\n (d): d is PHConnectDefaultDrive[] => Array.isArray(d) && d.length > 0,\n );\n if (driveGroups.length > 1) {\n merged.drives = {\n ...merged.drives,\n defaultDrives: mergeDefaultDrives(...driveGroups),\n };\n }\n return merged;\n}\n"],"names":[],"mappings":";;;;;;;AA4CA,MAAM,kBAA+B,KAJvB,MAA2C,WACtD,OAEiB;CAAE,WAAW;CAAM,QAAQ;AAAM,CACd,CAAC,CAAC,QAAQ,4BAA4B;;;;;;;;;;;;AAa7E,SAAgB,cAAc,KAAsB;CAClD,IAAI;EACF,OAAO,KAAK,MAAM,GAAG;CACvB,QAAQ;EACN,OAAO;CACT;AACF;;;;;AAMA,SAAgB,aAAa,KAAqB;CAChD,OAAO,IAAI,WAAW,UAAU,IAAI,IAAI,MAAM,CAAiB,IAAI;AACrE;AAEA,SAAS,aAAa,QAA+C;CACnE,IAAI,CAAC,UAAU,OAAO,WAAW,GAAG,OAAO;CAC3C,OAAO,OACJ,KAAK,MAAM;EACV,MAAM,OAAO,EAAE,gBAAgB;EAC/B,M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AAK,MAAM,EAAE,QAAQ,aAAa,CAAC,CACnC,QACE,MAAoC,MAAM,QAAQ,CAAC,KAAK,EAAE,SAAS,CACtE;CACF,IAAI,YAAY,SAAS,GACvB,OAAO,SAAS;EACd,GAAG,OAAO;EACV,eAAe,mBAAmB,GAAG,WAAW;CAClD;CAEF,OAAO;AACT","debug_id":"6b51454e-8d04-537a-be76-461c55d11bf3"}
|
|
1
|
+
{"version":3,"file":"cli-connect-override-DW7OYAGx.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 = {\n instancePath?: string;\n message?: string;\n params?: { additionalProperty?: string };\n};\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 const extra = e.params?.additionalProperty;\n const suffix = extra === undefined ? \"\" : ` (${JSON.stringify(extra)})`;\n return ` ${path} ${e.message ?? \"\"}${suffix}`.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 *\n * `command` prefixes error messages (e.g. \"ph connect build\").\n */\nexport function validateConnectPatch(\n raw: string,\n command = \"ph connect config\",\n): ConnectPartial & {\n packageRegistryUrl?: unknown;\n} {\n const label = `${command} --json`;\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 `${label}: 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 `${label}: payload must be a JSON object, got ${typeof parsed}.`,\n );\n }\n if (Object.prototype.hasOwnProperty.call(parsed, \"connect\")) {\n const inner = JSON.stringify((parsed as PlainObject).connect);\n throw new Error(\n `${label}: pass the connect.* block without the \"connect\" wrapper, e.g. --json '${inner}'.`,\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 `${label}: validation failed:\\n${formatErrors(validateConnect.errors)}\\nExpected a partial connect.* blob with nested keys, e.g. --json '{\"app\":{\"workflowsEnabled\":true}}'.`,\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 {\n PHConnectDefaultDrive,\n PHConnectRuntimeConfig,\n} from \"@powerhousedao/shared/clis\";\nimport { deepMerge } from \"@powerhousedao/shared/connect\";\nimport { mergeDefaultDrives } from \"@powerhousedao/host-core\";\nimport type { ConnectBuildArgs, ConnectStudioArgs } from \"../types.js\";\nimport {\n normalizeKey,\n parseCliValue,\n validateConnectKeyValue,\n validateConnectPatch,\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 renownNamespace?: string | undefined;\n renownSwitchboardUrl?: string | undefined;\n allowAddDrive?: boolean | undefined;\n externalPackages?: boolean | undefined;\n workflows?: 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// Schema-validates `--json` so unknown keys, a `connect` wrapper or wrong\n// types fail instead of being dropped from the dist config.\nfunction parseJsonOverride(raw: string | undefined): PlainObject {\n if (raw === undefined || raw === \"\") return {};\n return validateConnectPatch(raw, \"ph connect build\") as PlainObject;\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 20 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 setIfDefined(app, \"workflowsEnabled\", args.workflows);\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 setIfDefined(renown, \"namespace\", args.renownNamespace);\n setIfDefined(renown, \"switchboardUrl\", args.renownSwitchboardUrl);\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 const branding: PlainObject = {};\n setIfDefined(branding, \"appName\", args.appName);\n if (Object.keys(branding).length > 0) out.branding = branding;\n\n // --home-background: empty string is the explicit \"set null\" form\n // (cmd-ts can't pass `null` directly through a string option). The home\n // screen is the generic plugin's, so this lands in connect.home.\n if (args.homeBackground !== undefined) {\n out.home = {\n background: args.homeBackground === \"\" ? null : args.homeBackground,\n };\n }\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 renownNamespace: args.renownNamespace,\n renownSwitchboardUrl: args.renownSwitchboardUrl,\n allowAddDrive: args.allowAddDrive,\n externalPackages: args.externalPackages,\n workflows: args.workflows,\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). The flag override\n * deep-merges on top of it: caller choices apply for every flag the user\n * didn't type, and an explicitly passed flag wins for its own field —\n * except `drives.defaultDrives`, which merges additively: a flag's drives\n * are appended to the caller's list (de-duplicated by drive identity) rather\n * than replacing it, so vetra's own drives stay in Connect's default set.\n * Without a caller override (plain `ph connect studio`) only the flag can\n * carry defaultDrives, so that command's behavior is unchanged.\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 renownNamespace: args.renownNamespace,\n }) as PHConnectRuntimeConfig;\n\n // Studio commands (`ph connect studio`, `ph vetra`) always run in studio\n // mode: Connect loads the vetra package and offers builder document types.\n const studioOverride: PHConnectRuntimeConfig = { app: { studioMode: true } };\n const layers = [callerOverride, flagOverride, studioOverride].filter(\n (o): o is PHConnectRuntimeConfig =>\n o !== undefined && Object.keys(o).length > 0,\n );\n const merged = layers.reduce(\n (acc, o) => deepMerge(acc, o),\n {} as PHConnectRuntimeConfig,\n );\n\n // `deepMerge` replaces arrays, so the flag's defaultDrives would clobber\n // the caller's list; re-apply them as the de-duplicated union instead.\n // Only needed when two or more layers contribute default drives (the\n // plain-studio single-layer case is already exactly the flag's list).\n const driveGroups = layers\n .map((l) => l.drives?.defaultDrives)\n .filter(\n (d): d is PHConnectDefaultDrive[] => Array.isArray(d) && d.length > 0,\n );\n if (driveGroups.length > 1) {\n merged.drives = {\n ...merged.drives,\n defaultDrives: mergeDefaultDrives(...driveGroups),\n };\n }\n return merged;\n}\n"],"names":[],"mappings":";;;;;;;AA4CA,MAAM,kBAA+B,KAJvB,MAA2C,WACtD,OAEiB;CAAE,WAAW;CAAM,QAAQ;AAAM,CACd,CAAC,CAAC,QA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BAAkB,wBAAwB,oBAAoB,IAC1D,KAAK,mBACL,KAAA;GACJ,wBAAwB,wBAAwB,yBAAyB,IACrE,KAAK,yBACL,KAAA;GACJ,iBAAiB,KAAK;EACxB,CAK2C;EAAG,EADG,KAAK,EAAE,YAAY,KAAK,EACd;CAAC,CAAC,CAAC,QAC3D,MACC,MAAM,KAAA,KAAa,OAAO,KAAK,CAAC,CAAC,CAAC,SAAS,CAC/C;CACA,MAAM,SAAS,OAAO,QACnB,KAAK,MAAM,UAAU,KAAK,CAAC,GAC5B,CAAC,CACH;CAMA,MAAM,cAAc,OACjB,KAAK,MAAM,EAAE,QAAQ,aAAa,CAAC,CACnC,QACE,MAAoC,MAAM,QAAQ,CAAC,KAAK,EAAE,SAAS,CACtE;CACF,IAAI,YAAY,SAAS,GACvB,OAAO,SAAS;EACd,GAAG,OAAO;EACV,eAAe,mBAAmB,GAAG,WAAW;CAClD;CAEF,OAAO;AACT","debug_id":"9e90198b-acf2-58dd-bc1d-71082e0cc0e1"}
|
package/dist/cli.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
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]="83ce31d0-0645-5039-b36b-b7427b013283")}catch(e){}}();
|
|
4
|
-
import { t as getVersion } from "./get-version-
|
|
5
|
-
import { n as phCliCommands } from "./ph-cli-commands-
|
|
4
|
+
import { t as getVersion } from "./get-version-C-oL2owF.mjs";
|
|
5
|
+
import { n as phCliCommands } from "./ph-cli-commands-C8eWT5mr.mjs";
|
|
6
6
|
import { t as isUniformRunnersEnabled } from "./feature-flags-xwqcHEWC.mjs";
|
|
7
7
|
import { initCliTelemetry } from "@powerhousedao/shared/clis/telemetry";
|
|
8
8
|
import { assertNodeVersion } from "@powerhousedao/shared/clis/utils";
|
|
@@ -92,8 +92,8 @@ async function main() {
|
|
|
92
92
|
});
|
|
93
93
|
let args = process.argv.slice(2);
|
|
94
94
|
if (isUniformRunnersEnabled()) {
|
|
95
|
-
const { applyRunSugar } = await import("./run-sugar-
|
|
96
|
-
const { phCliCommands } = await import("./ph-cli-commands-
|
|
95
|
+
const { applyRunSugar } = await import("./run-sugar-CRzZsmVo.mjs");
|
|
96
|
+
const { phCliCommands } = await import("./ph-cli-commands-DviLBBKz.mjs");
|
|
97
97
|
const sugar = applyRunSugar(args, new Set(Object.keys(phCliCommands)), process.cwd());
|
|
98
98
|
if (sugar.warning) console.warn(sugar.warning);
|
|
99
99
|
args = sugar.args;
|