@powerhousedao/ph-cli 6.4.0-next.0 → 6.4.0-next.2
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/README.md +1 -1
- package/dist/build-BUpe1j4m.mjs +4 -0
- package/dist/{build-D8_USaRh.mjs → build-C7RBpPwa.mjs} +8 -8
- package/dist/{build-D8_USaRh.mjs.map → build-C7RBpPwa.mjs.map} +1 -1
- package/dist/{check-EpzhIKt1.mjs → check-1Hfe0lVO.mjs} +5 -5
- package/dist/{check-EpzhIKt1.mjs.map → check-1Hfe0lVO.mjs.map} +1 -1
- package/dist/{check-CVRb-CJD.mjs → check-ClxYRer4.mjs} +3 -3
- package/dist/{check-_K6EAsag.mjs → check-MBdw9Lbm.mjs} +4 -4
- package/dist/{check-_K6EAsag.mjs.map → check-MBdw9Lbm.mjs.map} +1 -1
- package/dist/{cli-connect-override-DwlViDdp.mjs → cli-connect-override-DsuuectH.mjs} +7 -7
- package/dist/cli-connect-override-DsuuectH.mjs.map +1 -0
- package/dist/cli.mjs +14 -8
- package/dist/cli.mjs.map +1 -1
- package/dist/{compound-n-bO0qKh-Dx7fgKWx.mjs → compound-Q9sZSEZF-zZWzQ7VC.mjs} +8 -8
- package/dist/compound-Q9sZSEZF-zZWzQ7VC.mjs.map +1 -0
- package/dist/{connect-build-BIkm5fcG.mjs → connect-build-DAnGPSF5.mjs} +6 -6
- package/dist/{connect-build-BIkm5fcG.mjs.map → connect-build-DAnGPSF5.mjs.map} +1 -1
- package/dist/{connect-config-CH0KQqyU.mjs → connect-config-C0QZ7zTf.mjs} +4 -4
- package/dist/{connect-config-CH0KQqyU.mjs.map → connect-config-C0QZ7zTf.mjs.map} +1 -1
- package/dist/{connect-studio-C-9WE2Bg.mjs → connect-studio-BUth3UYP.mjs} +4 -4
- package/dist/{connect-studio-C-9WE2Bg.mjs.map → connect-studio-BUth3UYP.mjs.map} +1 -1
- package/dist/definitions-worker.mjs +1 -1
- package/dist/{dist-Dbvm_SmC.mjs → dist-CRR5Anp2.mjs} +5 -5
- package/dist/dist-CRR5Anp2.mjs.map +1 -0
- package/dist/{explain-DB7uoJkY.mjs → explain-BfOC7Ngv.mjs} +5 -5
- package/dist/{explain-DB7uoJkY.mjs.map → explain-BfOC7Ngv.mjs.map} +1 -1
- package/dist/{export-DuYGBuQZ.mjs → export-CdTqYviH.mjs} +5 -5
- package/dist/{export-DuYGBuQZ.mjs.map → export-CdTqYviH.mjs.map} +1 -1
- package/dist/{generate-all-Mj_xGZZN.mjs → generate-all-HujZHqCG.mjs} +4 -4
- package/dist/{generate-all-Mj_xGZZN.mjs.map → generate-all-HujZHqCG.mjs.map} +1 -1
- package/dist/{generate-desktop-shell-DD9o4Rcl.mjs → generate-desktop-shell-CTrfzM9P.mjs} +4 -4
- package/dist/{generate-desktop-shell-DD9o4Rcl.mjs.map → generate-desktop-shell-CTrfzM9P.mjs.map} +1 -1
- package/dist/{get-version-DXnnvS_S.mjs → get-version-DAYhm6MX.mjs} +4 -4
- package/dist/{get-version-DXnnvS_S.mjs.map → get-version-DAYhm6MX.mjs.map} +1 -1
- package/dist/{index-V7TKBh-y.d.mts → index-Bs1PfL3W.d.mts} +18 -5
- package/dist/index-Bs1PfL3W.d.mts.map +1 -0
- package/dist/{init-Ltg4cJzm.mjs → init-IQ0VS0JK.mjs} +4 -4
- package/dist/{init-Ltg4cJzm.mjs.map → init-IQ0VS0JK.mjs.map} +1 -1
- package/dist/{mcp-DKqOFZlX.mjs → mcp-rtMGg307.mjs} +6 -6
- package/dist/{mcp-DKqOFZlX.mjs.map → mcp-rtMGg307.mjs.map} +1 -1
- package/dist/{migrate-CQpwBF1l.mjs → migrate-CWCJP19Q.mjs} +5 -5
- package/dist/{migrate-CQpwBF1l.mjs.map → migrate-CWCJP19Q.mjs.map} +1 -1
- package/dist/{migrate-document-models-DpXzLDuu.mjs → migrate-document-models-DTxM7D7p.mjs} +4 -4
- package/dist/{migrate-document-models-DpXzLDuu.mjs.map → migrate-document-models-DTxM7D7p.mjs.map} +1 -1
- package/dist/migrate-subgraphs-DcJjLMFd.mjs +4 -0
- package/dist/{migrate-subgraphs-CdfkO6l9.mjs → migrate-subgraphs-_yRnF7xt.mjs} +6 -6
- package/dist/{migrate-subgraphs-CdfkO6l9.mjs.map → migrate-subgraphs-_yRnF7xt.mjs.map} +1 -1
- package/dist/ph-cli-commands-CRwA1aVX.mjs +4 -0
- package/dist/{ph-cli-commands-Dq-tIYhy.mjs → ph-cli-commands-FLZClR4x.mjs} +39 -19
- package/dist/ph-cli-commands-FLZClR4x.mjs.map +1 -0
- package/dist/{run-sugar-DsG2RRgx.mjs → run-sugar-DUiDFl_T.mjs} +22 -15
- package/dist/run-sugar-DUiDFl_T.mjs.map +1 -0
- package/dist/{run-sugar-Bnab2Z3f.mjs → run-sugar-YDxw0iV9.mjs} +3 -3
- package/dist/runners/connect.d.mts +1 -1
- package/dist/runners/connect.mjs +4 -4
- package/dist/runners/connect.mjs.map +1 -1
- package/dist/runners/switchboard.d.mts +1 -1
- package/dist/runners/switchboard.mjs +4 -4
- package/dist/scripts/generate-commands-docs.ts +2 -0
- package/dist/{sugar-checks-DBk5q_uJ.mjs → sugar-checks-BFu3sfFJ.mjs} +11 -11
- package/dist/sugar-checks-BFu3sfFJ.mjs.map +1 -0
- package/dist/{switchboard-reset-CY6J0lWO.mjs → switchboard-reset-BP7KwUc_.mjs} +4 -4
- package/dist/{switchboard-reset-CY6J0lWO.mjs.map → switchboard-reset-BP7KwUc_.mjs.map} +1 -1
- package/dist/{verify-C_fL8YsF.mjs → verify-Dkb6K1fc.mjs} +4 -4
- package/dist/{verify-C_fL8YsF.mjs.map → verify-Dkb6K1fc.mjs.map} +1 -1
- package/dist/vetra-gateway-BMzq0mqX.mjs +173 -0
- package/dist/vetra-gateway-BMzq0mqX.mjs.map +1 -0
- package/dist/vetra-gateway-BP6Catg4.mjs +4 -0
- package/dist/{vetra-host-CDfny6E8.mjs → vetra-host-C37IGwBM.mjs} +7 -7
- package/dist/vetra-host-C37IGwBM.mjs.map +1 -0
- package/dist/{vetra-instance-DlXAeiU7.mjs → vetra-instance-CLUzbtbh.mjs} +6 -6
- package/dist/vetra-instance-CLUzbtbh.mjs.map +1 -0
- package/dist/vetra-launcher-CJ01qmS1.mjs +4 -0
- package/dist/{vetra-launcher-CYX10K2m.mjs → vetra-launcher-Dq0tWyNW.mjs} +5 -5
- package/dist/{vetra-launcher-CYX10K2m.mjs.map → vetra-launcher-Dq0tWyNW.mjs.map} +1 -1
- package/package.json +16 -16
- package/dist/build-FVWjguYr.mjs +0 -4
- package/dist/cli-connect-override-DwlViDdp.mjs.map +0 -1
- package/dist/compound-n-bO0qKh-Dx7fgKWx.mjs.map +0 -1
- package/dist/dist-Dbvm_SmC.mjs.map +0 -1
- package/dist/index-V7TKBh-y.d.mts.map +0 -1
- package/dist/migrate-subgraphs-CoUuwzmR.mjs +0 -4
- package/dist/ph-cli-commands-Daeqh5Me.mjs +0 -4
- package/dist/ph-cli-commands-Dq-tIYhy.mjs.map +0 -1
- package/dist/run-sugar-DsG2RRgx.mjs.map +0 -1
- package/dist/sugar-checks-DBk5q_uJ.mjs.map +0 -1
- package/dist/vetra-host-CDfny6E8.mjs.map +0 -1
- package/dist/vetra-instance-DlXAeiU7.mjs.map +0 -1
- package/dist/vetra-launcher-TDLXj0tY.mjs +0 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"explain-DB7uoJkY.mjs","sources":["../src/services/run/explain.ts"],"sourcesContent":["import {\n applyChildWrapper,\n collectTokenSites,\n compoundOutputSource,\n CONNECT_RUNNER,\n declaredHostSchemas,\n describeToken,\n drivesSchema,\n envSitesOf,\n explainDrivePlan,\n findDeadConnectConfig,\n formatPath,\n hostFileLabel,\n isBuiltinEnvName,\n isToken,\n loadHost,\n loadProducers,\n memberForRef,\n memberProcessOf,\n mergeDrivePlan,\n moduleRootOf,\n outputRefsOf,\n outputSitesOf,\n planCompound,\n planForeground,\n probeRun,\n processResolveEnv,\n producerOutputsSchemas,\n readProjectName,\n renderTokens,\n resolveHostOutputs,\n resolvePluginContributions,\n resolveRunnerModule,\n RunnerError,\n runnerOutputsSchema,\n runRecordKey,\n runRecordOutputSource,\n validateDeclaredHost,\n validateHost,\n type ChildWrapper,\n type DriveDeclaration,\n type HostDefinition,\n type OutputSource,\n type PluginEntryData,\n type ReactorHostInput,\n type RunnerModule,\n} from \"@powerhousedao/host-core\";\n\n/**\n * `ph run <host> --explain <topic>`: print instead of running, after the\n * same declared validation `ph run` does first (so a printed explain is a\n * host that loads). `drives`: the merged drive plan with provenance\n * (browser-only plugins listed as unresolvable). `outputs`: the resolution\n * plan — consumed outputs and their producers, `$env` names, where\n * `${package}` points, the compound start order the tokens imply, which\n * producers are running and, for a\n * running producer, the value each token resolves to now. A `$map` in\n * `reactor.drives` is shown as the token and, when its producer runs, as the\n * drives it renders.\n */\n\ninterface ExplainOptions {\n host: string;\n topic: string;\n}\n\nconst TOPICS = [\"drives\", \"outputs\"];\n\n/** A reactor host as explained: a standalone host, or a compound member\n * with its wrapper applied (declared form). */\ninterface ReactorView {\n name: string;\n runner: HostDefinition[\"runner\"];\n config?: Record<string, unknown>;\n reactor?: ReactorHostInput[\"reactor\"];\n}\n\ninterface MemberView {\n key: string;\n wrapper: ChildWrapper;\n host: ReactorView;\n runner: RunnerModule;\n specifier: string;\n file: string;\n /** Where its plugin specifiers resolve from: its package, else the\n * project. Also what `${package}` is in it. */\n moduleRoot: string;\n /** The package that supplies its host. */\n packageName?: string;\n /** Where the effective `config` lives (a wrapper `config` is a full\n * statement in the compound's file). */\n configWhere: string;\n}\n\ninterface LoadedView {\n host: HostDefinition;\n runner: RunnerModule;\n specifier: string;\n file: string;\n /** Where its plugin specifiers resolve from, and `${package}`. */\n moduleRoot: string;\n /** The package that supplies the host. */\n packageName?: string;\n /** Set for a compound. */\n members?: MemberView[];\n /** Where tokens resolve NOW (for printing values): a standalone host's\n * producers' live run records; a compound's own live record (its members'\n * outputs), or none when it is not running. */\n source?: OutputSource;\n}\n\nasync function loadView(\n projectRoot: string,\n name: string,\n): Promise<LoadedView> {\n // As `ph run` finds it: a package's host resolves its modules there, and\n // its compound's bare members look there first.\n const loaded = await loadHost(projectRoot, name);\n const scope = loaded.package;\n const moduleRoot = moduleRootOf(projectRoot, loaded);\n const specifier = loaded.host.runner.module;\n const runner = await resolveRunnerModule(moduleRoot, specifier);\n const file = hostFileLabel(loaded.name, scope);\n if (runner.kind !== \"compound\") {\n const producers = await loadProducers(\n projectRoot,\n outputRefsOf(loaded.host),\n scope,\n );\n validateDeclaredHost(runner, specifier, loaded.host, file, {\n outputsSchemaOf: producerOutputsSchemas(producers),\n });\n // The same lookup `ph run` resolves through.\n const source = runRecordOutputSource(projectRoot, {\n consumer: name,\n producers,\n projectName: readProjectName(projectRoot),\n });\n return {\n host: loaded.host,\n runner,\n specifier,\n file,\n moduleRoot,\n ...(scope ? { packageName: scope.name } : {}),\n source,\n };\n }\n validateDeclaredHost(runner, specifier, loaded.host, file);\n validateHost(runner, specifier, loaded.host, file, { tokens: \"allow\" });\n // The compound runner's schema owns `config`; `children` is shared.\n const children = declaredHostSchemas.childrenSchema.parse(\n loaded.host.children,\n );\n const members: MemberView[] = [];\n for (const [key, wrapper] of Object.entries(children)) {\n const member = await loadHost(projectRoot, wrapper.host, { scope });\n const host: ReactorView = applyChildWrapper(member.host, wrapper);\n const memberSpecifier = host.runner.module;\n const memberRoot = moduleRootOf(projectRoot, member);\n const memberFile = hostFileLabel(member.name, member.package);\n members.push({\n key,\n wrapper,\n host,\n runner: await resolveRunnerModule(memberRoot, memberSpecifier),\n specifier: memberSpecifier,\n file: memberFile,\n moduleRoot: memberRoot,\n ...(member.package ? { packageName: member.package.name } : {}),\n configWhere:\n wrapper.config !== undefined\n ? `${file} (children.${key}.config)`\n : memberFile,\n });\n }\n const refs = members.map((m) => ({ key: m.key, host: m.wrapper.host }));\n for (const m of members) {\n validateDeclaredHost(m.runner, m.specifier, m.host, m.file, {\n outputsSchemaOf: (ref) => {\n const target = memberForRef(ref, refs);\n if (\"error\" in target) return { error: target.error };\n const producer = members.find((p) => p.key === target.key);\n return producer\n ? runnerOutputsSchema(\n producer.runner,\n producer.specifier,\n `member \"${producer.key}\"`,\n )\n : { error: `names member \"${target.key}\", which is not declared.` };\n },\n });\n }\n // Members read each other's live outputs: shown only while this\n // compound runs (its record carries every member's outputs).\n const probe = probeRun(\n projectRoot,\n runRecordKey(loaded.host.name, scope?.name),\n readProjectName(projectRoot),\n );\n const live = new Map<string, unknown>();\n if (probe.status === \"live\") {\n for (const [key, member] of Object.entries(probe.record.members ?? {})) {\n live.set(key, member.outputs);\n }\n }\n const source =\n probe.status === \"live\"\n ? compoundOutputSource(refs, live, loaded.host.name)\n : undefined;\n return {\n host: loaded.host,\n runner,\n specifier,\n file,\n moduleRoot,\n ...(scope ? { packageName: scope.name } : {}),\n members,\n source,\n };\n}\n\n/** A token's value from running producers, or undefined (producer not\n * running, or the token reads the environment: `$env` values may be\n * secrets, so explain never prints them). */\nfunction currentValue(token: unknown, source?: OutputSource): unknown {\n if (!source) return undefined;\n if (collectTokenSites(token).some((site) => site.key === \"$env\")) {\n return undefined;\n }\n try {\n return resolveHostOutputs(token, { outputs: source });\n } catch {\n return undefined;\n }\n}\n\nexport async function explainHost(options: ExplainOptions): Promise<void> {\n if (!TOPICS.includes(options.topic)) {\n throw new Error(\n `Unknown --explain topic \"${options.topic}\" (supported: ${TOPICS.join(\", \")}).`,\n );\n }\n const projectRoot = process.cwd();\n const view = await loadView(projectRoot, options.host);\n if (options.topic === \"outputs\") {\n explainOutputs(options.host, view);\n return;\n }\n\n if (view.members) {\n // One plan per member, with the wrapper's full-statement semantics.\n const verb = view.host.runner.defaultVerb ?? \"run\";\n for (const m of view.members) {\n await explainDrives(\n { projectRoot, moduleRoot: m.moduleRoot },\n `${options.host} › ${m.key} (${m.wrapper.host})`,\n m.host,\n verb,\n m.file,\n m.configWhere,\n view.source,\n );\n }\n return;\n }\n await explainDrives(\n { projectRoot, moduleRoot: view.moduleRoot },\n options.host,\n view.host,\n \"run\",\n view.file,\n view.file,\n view.source,\n );\n}\n\n/* ------------------------------------------------------------------ drives */\n\nasync function explainDrives(\n /** Drive ids are the project's; plugin specifiers resolve from\n * `moduleRoot` (a package's host: the package). */\n roots: { projectRoot: string; moduleRoot: string },\n label: string,\n host: ReactorView,\n verb: string,\n where: string,\n configWhere: string,\n source?: OutputSource,\n): Promise<void> {\n const { projectRoot } = roots;\n const entries: PluginEntryData[] = host.runner.plugins ?? [];\n const contributions =\n entries.length > 0\n ? await resolvePluginContributions(roots.moduleRoot, verb, entries, where)\n : { drives: [], unresolved: [] };\n const contributed = contributions.drives.map(({ declaration, source }) => {\n const parsed = drivesSchema.safeParse([declaration]);\n if (!parsed.success) {\n throw new Error(\n `${where}: plugin \"${source}\" contributes an invalid drive declaration.`,\n );\n }\n return { declaration: parsed.data[0], source };\n });\n // Declared drives may carry output tokens (a remote url): shown as\n // «$output …», resolved only at `ph run`. The whole list may be a token\n // (`$map` over a producer's drives): rendered from the running producer\n // when there is one, otherwise named and left out of the plan.\n const rawDrives: unknown = host.reactor?.drives ?? [];\n let listed: unknown = rawDrives;\n let listNote: string | undefined;\n if (isToken(rawDrives)) {\n const value = currentValue(rawDrives, source);\n listed = Array.isArray(value) ? value : [];\n listNote = ` reactor.drives ← «${describeToken(rawDrives)}»${\n Array.isArray(value)\n ? \" (rendered from the running producer's outputs)\"\n : \" (rendered at ph run from the producer's live outputs; its producer is not running now, so the plan below leaves them out)\"\n }`;\n }\n const parsed = drivesSchema.safeParse(renderTokens(listed));\n if (!parsed.success && listNote === undefined) {\n // a literal list: declared validation already ran; keep its error\n throw parsed.error;\n }\n const declared: DriveDeclaration[] = parsed.success ? parsed.data : [];\n console.log(`[${label}]`);\n if (listNote) console.log(listNote);\n if (!parsed.success) {\n console.log(\n ` the rendered drives fail the drive schema (ph run rejects them): ${parsed.error.issues\n .map((i) => `${i.path.map(String).join(\".\") || \"<root>\"}: ${i.message}`)\n .join(\"; \")}`,\n );\n }\n console.log(\n explainDrivePlan(mergeDrivePlan(projectRoot, declared, contributed)),\n );\n for (const module of contributions.unresolved) {\n const entry = entries\n .map((e) => (typeof e === \"string\" ? { module: e } : e))\n .find((e) => e.module === module);\n const drive: unknown =\n entry && \"config\" in entry ? entry.config?.drive : undefined;\n const attached =\n typeof drive === \"string\"\n ? ` attaches ${drive}`\n : isToken(drive)\n ? ` attaches «${describeToken(drive)}»`\n : \"\";\n console.log(\n ` (browser plugin ${module}: not resolvable from the project tree)${attached}`,\n );\n }\n // The same dead-config warnings the connect runner prints at boot,\n // naming the file the config lives in.\n if (host.runner.module === CONNECT_RUNNER) {\n for (const warning of findDeadConnectConfig(\n host.config,\n host.runner.plugins,\n verb,\n configWhere,\n )) {\n console.warn(warning.message);\n }\n }\n}\n\n/* ----------------------------------------------------------------- outputs */\n\nfunction outputKeys(runner: RunnerModule): string {\n const schema = runner.outputsSchema;\n if (typeof schema !== \"object\" || schema === null) return \"(no outputs)\";\n const shape =\n \"shape\" in schema && typeof schema.shape === \"object\" && schema.shape\n ? Object.keys(schema.shape)\n : [];\n return shape.length ? shape.join(\", \") : \"(declared)\";\n}\n\nfunction printConsumes(\n host: unknown,\n indent: string,\n producerNote: (folder: string, member?: string) => string,\n source?: OutputSource,\n): void {\n const outputs = outputSitesOf(host);\n const env = envSitesOf(host);\n if (outputs.length === 0 && env.length === 0) {\n console.log(`${indent}consumes: nothing (no $output or $env tokens)`);\n return;\n }\n const valueLine = (token: unknown) => {\n const value = currentValue(token, source);\n if (value !== undefined) {\n console.log(`${indent} = ${JSON.stringify(value)}`);\n }\n };\n for (const site of outputs) {\n const token = { $output: { ...site.ref, path: site.outputPath } };\n console.log(\n `${indent}${site.path} ← ${describeToken(token)}${producerNote(site.ref.host, site.ref.member)}`,\n );\n valueLine(token);\n }\n // Composite tokens (`$concat`, `$map`) outside any template: the value\n // the field gets, once its producers run.\n for (const site of collectTokenSites(host)) {\n const nested =\n site.scopes.length > 0 ||\n site.position === \"concat\" ||\n site.position === \"over\";\n if (nested || (site.key !== \"$concat\" && site.key !== \"$map\")) continue;\n console.log(\n `${indent}${formatPath(site.path)} ← ${describeToken(site.token)}`,\n );\n valueLine(site.token);\n }\n const { env: processEnv } = processResolveEnv(process.cwd());\n for (const site of env) {\n const builtin = isBuiltinEnvName(site.name);\n const state =\n builtin || processEnv?.[site.name] !== undefined\n ? \"set\"\n : site.optional\n ? \"unset: the property is omitted\"\n : \"UNSET: ph run fails\";\n console.log(\n `${indent}${site.path} ← $env ${site.name}${site.optional ? \" (optional)\" : \"\"} [${state}]`,\n );\n }\n}\n\n/** Where `${package}` points, for a host that names it (as `\"${package}\"`\n * sugar or `{ $env: \"package\" }`): a path, never a secret. */\nfunction printPackageRoot(\n host: unknown,\n indent: string,\n view: { moduleRoot: string; packageName?: string },\n): void {\n const named =\n JSON.stringify(host).includes(\"${package}\") ||\n envSitesOf(host).some((site) => site.name === \"package\");\n if (!named) return;\n const whose = view.packageName\n ? `the root of ${view.packageName}, which supplies the host`\n : \"the project root: a project host\";\n console.log(`${indent}\\${package} = ${view.moduleRoot} (${whose})`);\n}\n\nfunction explainOutputs(name: string, view: LoadedView): void {\n if (!view.members) {\n const source = view.source;\n console.log(`[${name}] ${view.specifier}`);\n console.log(` produces: ${outputKeys(view.runner)}`);\n printPackageRoot(view.host, \" \", view);\n printConsumes(\n view.host,\n \" \",\n (folder, member) => {\n const ref =\n member === undefined ? { host: folder } : { host: folder, member };\n return source?.lookup(ref).status === \"available\"\n ? ` (host \"${folder}\": running)`\n : ` (host \"${folder}\": not running; start it first: ph run ${folder})`;\n },\n source,\n );\n return;\n }\n\n const members = view.members;\n const refs = members.map((x) => ({ key: x.key, host: x.wrapper.host }));\n const config: unknown = view.host.config;\n const startOrder =\n typeof config === \"object\" &&\n config !== null &&\n \"startOrder\" in config &&\n Array.isArray(config.startOrder)\n ? config.startOrder.filter((k): k is string => typeof k === \"string\")\n : undefined;\n const plan = planCompound(\n members.map((m) => ({\n key: m.key,\n host: m.wrapper.host,\n refs: outputSitesOf(m.host).map(({ ref, path }) => ({ ref, path })),\n })),\n startOrder,\n );\n // The member that owns the terminal starts last, as `ph run` starts it;\n // a compound that breaks its rules fails here as it would there.\n const planned = planForeground(\n members.map((m) => ({\n key: m.key,\n specifier: m.specifier,\n member: m.wrapper,\n runner: m.runner,\n })),\n plan,\n startOrder ? { startOrder } : {},\n );\n const broken = planned.issues.at(0);\n if (broken) {\n throw new RunnerError(`hosts/${name}: ${broken.message}`, broken.hint);\n }\n const processes = new Map(\n members.map((m) => [\n m.key,\n memberProcessOf(m.wrapper, {\n foreground: m.key === planned.foreground,\n besideForeground: planned.foreground !== undefined,\n oneShot: false,\n }),\n ]),\n );\n // Where each member runs, once that is not the compound's process alone.\n const showWhere =\n planned.foreground !== undefined || [...processes.values()].includes(\"own\");\n const whereOf = (key: string) => {\n if (!showWhere) return \"\";\n if (key === planned.foreground) {\n return \" [in front: owns the terminal; its end ends the stack]\";\n }\n return processes.get(key) === \"own\"\n ? \" [own process]\"\n : \" [in the compound's process]\";\n };\n console.log(\n `[${name}] start order (${plan.source === \"tokens\" ? \"from the output tokens\" : \"config.startOrder, checked against the tokens\"}):`,\n );\n planned.order.forEach((key, index) => {\n const m = members.find((x) => x.key === key);\n const needs = plan.edges\n .filter((e) => e.consumer === key)\n .map((e) => e.producer);\n console.log(\n ` ${index + 1}. ${key} (${m?.wrapper.host ?? \"?\"})${needs.length ? ` after ${needs.join(\", \")}` : \"\"}${whereOf(key)}`,\n );\n });\n console.log(\" Ctrl-C stops members in reverse order (consumers first).\");\n for (const key of planned.order) {\n const m = members.find((x) => x.key === key);\n if (!m) continue;\n console.log(`[${name} › ${key} (${m.wrapper.host})] ${m.specifier}`);\n console.log(` produces: ${outputKeys(m.runner)}`);\n printPackageRoot(m.host, \" \", m);\n printConsumes(\n m.host,\n \" \",\n (folder, member) => {\n const ref =\n member === undefined ? { host: folder } : { host: folder, member };\n const target = memberForRef(ref, refs);\n return \"key\" in target\n ? ` (member \"${target.key}\", live outputs)`\n : \"\";\n },\n view.source,\n );\n }\n const own = { ...view.host, children: undefined };\n if (outputSitesOf(own).length > 0 || envSitesOf(own).length > 0) {\n console.log(`[${name}] the compound's own fields:`);\n printConsumes(own, \" \", () => \"\");\n }\n}\n"],"names":[],"mappings":";;;;;AAkEA,MAAM,SAAS,CAAC,UAAU,SAAS;AA6CnC,eAAe,SACb,aACA,MACqB;CAGrB,MAAM,SAAS,MAAM,SAAS,aAAa,IAAI;CAC/C,MAAM,QAAQ,OAAO;CACrB,MAAM,aAAa,aAAa,aAAa,MAAM;CACnD,MAAM,YAAY,OAAO,KAAK,OAAO;CACrC,MAAM,SAAS,MAAM,oBAAoB,YAAY,SAAS;CAC9D,MAAM,OAAO,cAAc,OAAO,MAAM,KAAK;CAC7C,IAAI,OAAO,SAAS,YAAY;EAC9B,MAAM,YAAY,MAAM,cACtB,aACA,aAAa,OAAO,IAAI,GACxB,KACF;EACA,qBAAqB,QAAQ,WAAW,OAAO,MAAM,MAAM,EACzD,iBAAiB,uBAAuB,SAAS,EACnD,CAAC;EAED,MAAM,SAAS,sBAAsB,aAAa;GAChD,UAAU;GACV;GACA,aAAa,gBAAgB,WAAW;EAC1C,CAAC;EACD,OAAO;GACL,MAAM,OAAO;GACb;GACA;GACA;GACA;GACA,GAAI,QAAQ,EAAE,aAAa,MAAM,KAAK,IAAI,CAAC;GAC3C;EACF;CACF;CACA,qBAAqB,QAAQ,WAAW,OAAO,MAAM,IAAI;CACzD,aAAa,QAAQ,WAAW,OAAO,MAAM,MAAM,EAAE,QAAQ,QAAQ,CAAC;CAEtE,MAAM,WAAW,oBAAoB,eAAe,MAClD,OAAO,KAAK,QACd;CACA,MAAM,UAAwB,CAAC;CAC/B,KAAK,MAAM,CAAC,KAAK,YAAY,OAAO,QAAQ,QAAQ,GAAG;EACrD,MAAM,SAAS,MAAM,SAAS,aAAa,QAAQ,MAAM,EAAE,MAAM,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AAC,CAAC,SAAS,GAAG;EAC/D,QAAQ,IAAI,IAAI,KAAK,6BAA6B;EAClD,cAAc,KAAK,YAAY,EAAE;CACnC;AACF","debug_id":"ca9939cd-6efd-5cd1-9067-410013531fb7"}
|
|
1
|
+
{"version":3,"file":"explain-BfOC7Ngv.mjs","sources":["../src/services/run/explain.ts"],"sourcesContent":["import {\n applyChildWrapper,\n collectTokenSites,\n compoundOutputSource,\n CONNECT_RUNNER,\n declaredHostSchemas,\n describeToken,\n drivesSchema,\n envSitesOf,\n explainDrivePlan,\n findDeadConnectConfig,\n formatPath,\n hostFileLabel,\n isBuiltinEnvName,\n isToken,\n loadHost,\n loadProducers,\n memberForRef,\n memberProcessOf,\n mergeDrivePlan,\n moduleRootOf,\n outputRefsOf,\n outputSitesOf,\n planCompound,\n planForeground,\n probeRun,\n processResolveEnv,\n producerOutputsSchemas,\n readProjectName,\n renderTokens,\n resolveHostOutputs,\n resolvePluginContributions,\n resolveRunnerModule,\n RunnerError,\n runnerOutputsSchema,\n runRecordKey,\n runRecordOutputSource,\n validateDeclaredHost,\n validateHost,\n type ChildWrapper,\n type DriveDeclaration,\n type HostDefinition,\n type OutputSource,\n type PluginEntryData,\n type ReactorHostInput,\n type RunnerModule,\n} from \"@powerhousedao/host-core\";\n\n/**\n * `ph run <host> --explain <topic>`: print instead of running, after the\n * same declared validation `ph run` does first (so a printed explain is a\n * host that loads). `drives`: the merged drive plan with provenance\n * (browser-only plugins listed as unresolvable). `outputs`: the resolution\n * plan — consumed outputs and their producers, `$env` names, where\n * `${package}` points, the compound start order the tokens imply, which\n * producers are running and, for a\n * running producer, the value each token resolves to now. A `$map` in\n * `reactor.drives` is shown as the token and, when its producer runs, as the\n * drives it renders.\n */\n\ninterface ExplainOptions {\n host: string;\n topic: string;\n}\n\nconst TOPICS = [\"drives\", \"outputs\"];\n\n/** A reactor host as explained: a standalone host, or a compound member\n * with its wrapper applied (declared form). */\ninterface ReactorView {\n name: string;\n runner: HostDefinition[\"runner\"];\n config?: Record<string, unknown>;\n reactor?: ReactorHostInput[\"reactor\"];\n}\n\ninterface MemberView {\n key: string;\n wrapper: ChildWrapper;\n host: ReactorView;\n runner: RunnerModule;\n specifier: string;\n file: string;\n /** Where its plugin specifiers resolve from: its package, else the\n * project. Also what `${package}` is in it. */\n moduleRoot: string;\n /** The package that supplies its host. */\n packageName?: string;\n /** Where the effective `config` lives (a wrapper `config` is a full\n * statement in the compound's file). */\n configWhere: string;\n}\n\ninterface LoadedView {\n host: HostDefinition;\n runner: RunnerModule;\n specifier: string;\n file: string;\n /** Where its plugin specifiers resolve from, and `${package}`. */\n moduleRoot: string;\n /** The package that supplies the host. */\n packageName?: string;\n /** Set for a compound. */\n members?: MemberView[];\n /** Where tokens resolve NOW (for printing values): a standalone host's\n * producers' live run records; a compound's own live record (its members'\n * outputs), or none when it is not running. */\n source?: OutputSource;\n}\n\nasync function loadView(\n projectRoot: string,\n name: string,\n): Promise<LoadedView> {\n // As `ph run` finds it: a package's host resolves its modules there, and\n // its compound's bare members look there first.\n const loaded = await loadHost(projectRoot, name);\n const scope = loaded.package;\n const moduleRoot = moduleRootOf(projectRoot, loaded);\n const specifier = loaded.host.runner.module;\n const runner = await resolveRunnerModule(moduleRoot, specifier);\n const file = hostFileLabel(loaded.name, scope);\n if (runner.kind !== \"compound\") {\n const producers = await loadProducers(\n projectRoot,\n outputRefsOf(loaded.host),\n scope,\n );\n validateDeclaredHost(runner, specifier, loaded.host, file, {\n outputsSchemaOf: producerOutputsSchemas(producers),\n });\n // The same lookup `ph run` resolves through.\n const source = runRecordOutputSource(projectRoot, {\n consumer: name,\n producers,\n projectName: readProjectName(projectRoot),\n });\n return {\n host: loaded.host,\n runner,\n specifier,\n file,\n moduleRoot,\n ...(scope ? { packageName: scope.name } : {}),\n source,\n };\n }\n validateDeclaredHost(runner, specifier, loaded.host, file);\n validateHost(runner, specifier, loaded.host, file, { tokens: \"allow\" });\n // The compound runner's schema owns `config`; `children` is shared.\n const children = declaredHostSchemas.childrenSchema.parse(\n loaded.host.children,\n );\n const members: MemberView[] = [];\n for (const [key, wrapper] of Object.entries(children)) {\n const member = await loadHost(projectRoot, wrapper.host, { scope });\n const host: ReactorView = applyChildWrapper(member.host, wrapper);\n const memberSpecifier = host.runner.module;\n const memberRoot = moduleRootOf(projectRoot, member);\n const memberFile = hostFileLabel(member.name, member.package);\n members.push({\n key,\n wrapper,\n host,\n runner: await resolveRunnerModule(memberRoot, memberSpecifier),\n specifier: memberSpecifier,\n file: memberFile,\n moduleRoot: memberRoot,\n ...(member.package ? { packageName: member.package.name } : {}),\n configWhere:\n wrapper.config !== undefined\n ? `${file} (children.${key}.config)`\n : memberFile,\n });\n }\n const refs = members.map((m) => ({ key: m.key, host: m.wrapper.host }));\n for (const m of members) {\n validateDeclaredHost(m.runner, m.specifier, m.host, m.file, {\n outputsSchemaOf: (ref) => {\n const target = memberForRef(ref, refs);\n if (\"error\" in target) return { error: target.error };\n const producer = members.find((p) => p.key === target.key);\n return producer\n ? runnerOutputsSchema(\n producer.runner,\n producer.specifier,\n `member \"${producer.key}\"`,\n )\n : { error: `names member \"${target.key}\", which is not declared.` };\n },\n });\n }\n // Members read each other's live outputs: shown only while this\n // compound runs (its record carries every member's outputs).\n const probe = probeRun(\n projectRoot,\n runRecordKey(loaded.host.name, scope?.name),\n readProjectName(projectRoot),\n );\n const live = new Map<string, unknown>();\n if (probe.status === \"live\") {\n for (const [key, member] of Object.entries(probe.record.members ?? {})) {\n live.set(key, member.outputs);\n }\n }\n const source =\n probe.status === \"live\"\n ? compoundOutputSource(refs, live, loaded.host.name)\n : undefined;\n return {\n host: loaded.host,\n runner,\n specifier,\n file,\n moduleRoot,\n ...(scope ? { packageName: scope.name } : {}),\n members,\n source,\n };\n}\n\n/** A token's value from running producers, or undefined (producer not\n * running, or the token reads the environment: `$env` values may be\n * secrets, so explain never prints them). */\nfunction currentValue(token: unknown, source?: OutputSource): unknown {\n if (!source) return undefined;\n if (collectTokenSites(token).some((site) => site.key === \"$env\")) {\n return undefined;\n }\n try {\n return resolveHostOutputs(token, { outputs: source });\n } catch {\n return undefined;\n }\n}\n\nexport async function explainHost(options: ExplainOptions): Promise<void> {\n if (!TOPICS.includes(options.topic)) {\n throw new Error(\n `Unknown --explain topic \"${options.topic}\" (supported: ${TOPICS.join(\", \")}).`,\n );\n }\n const projectRoot = process.cwd();\n const view = await loadView(projectRoot, options.host);\n if (options.topic === \"outputs\") {\n explainOutputs(options.host, view);\n return;\n }\n\n if (view.members) {\n // One plan per member, with the wrapper's full-statement semantics.\n const verb = view.host.runner.defaultVerb ?? \"run\";\n for (const m of view.members) {\n await explainDrives(\n { projectRoot, moduleRoot: m.moduleRoot },\n `${options.host} › ${m.key} (${m.wrapper.host})`,\n m.host,\n verb,\n m.file,\n m.configWhere,\n view.source,\n );\n }\n return;\n }\n await explainDrives(\n { projectRoot, moduleRoot: view.moduleRoot },\n options.host,\n view.host,\n \"run\",\n view.file,\n view.file,\n view.source,\n );\n}\n\n/* ------------------------------------------------------------------ drives */\n\nasync function explainDrives(\n /** Drive ids are the project's; plugin specifiers resolve from\n * `moduleRoot` (a package's host: the package). */\n roots: { projectRoot: string; moduleRoot: string },\n label: string,\n host: ReactorView,\n verb: string,\n where: string,\n configWhere: string,\n source?: OutputSource,\n): Promise<void> {\n const { projectRoot } = roots;\n const entries: PluginEntryData[] = host.runner.plugins ?? [];\n const contributions =\n entries.length > 0\n ? await resolvePluginContributions(roots.moduleRoot, verb, entries, where)\n : { drives: [], unresolved: [] };\n const contributed = contributions.drives.map(({ declaration, source }) => {\n const parsed = drivesSchema.safeParse([declaration]);\n if (!parsed.success) {\n throw new Error(\n `${where}: plugin \"${source}\" contributes an invalid drive declaration.`,\n );\n }\n return { declaration: parsed.data[0], source };\n });\n // Declared drives may carry output tokens (a remote url): shown as\n // «$output …», resolved only at `ph run`. The whole list may be a token\n // (`$map` over a producer's drives): rendered from the running producer\n // when there is one, otherwise named and left out of the plan.\n const rawDrives: unknown = host.reactor?.drives ?? [];\n let listed: unknown = rawDrives;\n let listNote: string | undefined;\n if (isToken(rawDrives)) {\n const value = currentValue(rawDrives, source);\n listed = Array.isArray(value) ? value : [];\n listNote = ` reactor.drives ← «${describeToken(rawDrives)}»${\n Array.isArray(value)\n ? \" (rendered from the running producer's outputs)\"\n : \" (rendered at ph run from the producer's live outputs; its producer is not running now, so the plan below leaves them out)\"\n }`;\n }\n const parsed = drivesSchema.safeParse(renderTokens(listed));\n if (!parsed.success && listNote === undefined) {\n // a literal list: declared validation already ran; keep its error\n throw parsed.error;\n }\n const declared: DriveDeclaration[] = parsed.success ? parsed.data : [];\n console.log(`[${label}]`);\n if (listNote) console.log(listNote);\n if (!parsed.success) {\n console.log(\n ` the rendered drives fail the drive schema (ph run rejects them): ${parsed.error.issues\n .map((i) => `${i.path.map(String).join(\".\") || \"<root>\"}: ${i.message}`)\n .join(\"; \")}`,\n );\n }\n console.log(\n explainDrivePlan(mergeDrivePlan(projectRoot, declared, contributed)),\n );\n for (const module of contributions.unresolved) {\n const entry = entries\n .map((e) => (typeof e === \"string\" ? { module: e } : e))\n .find((e) => e.module === module);\n const drive: unknown =\n entry && \"config\" in entry ? entry.config?.drive : undefined;\n const attached =\n typeof drive === \"string\"\n ? ` attaches ${drive}`\n : isToken(drive)\n ? ` attaches «${describeToken(drive)}»`\n : \"\";\n console.log(\n ` (browser plugin ${module}: not resolvable from the project tree)${attached}`,\n );\n }\n // The same dead-config warnings the connect runner prints at boot,\n // naming the file the config lives in.\n if (host.runner.module === CONNECT_RUNNER) {\n for (const warning of findDeadConnectConfig(\n host.config,\n host.runner.plugins,\n verb,\n configWhere,\n )) {\n console.warn(warning.message);\n }\n }\n}\n\n/* ----------------------------------------------------------------- outputs */\n\nfunction outputKeys(runner: RunnerModule): string {\n const schema = runner.outputsSchema;\n if (typeof schema !== \"object\" || schema === null) return \"(no outputs)\";\n const shape =\n \"shape\" in schema && typeof schema.shape === \"object\" && schema.shape\n ? Object.keys(schema.shape)\n : [];\n return shape.length ? shape.join(\", \") : \"(declared)\";\n}\n\nfunction printConsumes(\n host: unknown,\n indent: string,\n producerNote: (folder: string, member?: string) => string,\n source?: OutputSource,\n): void {\n const outputs = outputSitesOf(host);\n const env = envSitesOf(host);\n if (outputs.length === 0 && env.length === 0) {\n console.log(`${indent}consumes: nothing (no $output or $env tokens)`);\n return;\n }\n const valueLine = (token: unknown) => {\n const value = currentValue(token, source);\n if (value !== undefined) {\n console.log(`${indent} = ${JSON.stringify(value)}`);\n }\n };\n for (const site of outputs) {\n const token = { $output: { ...site.ref, path: site.outputPath } };\n console.log(\n `${indent}${site.path} ← ${describeToken(token)}${producerNote(site.ref.host, site.ref.member)}`,\n );\n valueLine(token);\n }\n // Composite tokens (`$concat`, `$map`) outside any template: the value\n // the field gets, once its producers run.\n for (const site of collectTokenSites(host)) {\n const nested =\n site.scopes.length > 0 ||\n site.position === \"concat\" ||\n site.position === \"over\";\n if (nested || (site.key !== \"$concat\" && site.key !== \"$map\")) continue;\n console.log(\n `${indent}${formatPath(site.path)} ← ${describeToken(site.token)}`,\n );\n valueLine(site.token);\n }\n const { env: processEnv } = processResolveEnv(process.cwd());\n for (const site of env) {\n const builtin = isBuiltinEnvName(site.name);\n const state =\n builtin || processEnv?.[site.name] !== undefined\n ? \"set\"\n : site.optional\n ? \"unset: the property is omitted\"\n : \"UNSET: ph run fails\";\n console.log(\n `${indent}${site.path} ← $env ${site.name}${site.optional ? \" (optional)\" : \"\"} [${state}]`,\n );\n }\n}\n\n/** Where `${package}` points, for a host that names it (as `\"${package}\"`\n * sugar or `{ $env: \"package\" }`): a path, never a secret. */\nfunction printPackageRoot(\n host: unknown,\n indent: string,\n view: { moduleRoot: string; packageName?: string },\n): void {\n const named =\n JSON.stringify(host).includes(\"${package}\") ||\n envSitesOf(host).some((site) => site.name === \"package\");\n if (!named) return;\n const whose = view.packageName\n ? `the root of ${view.packageName}, which supplies the host`\n : \"the project root: a project host\";\n console.log(`${indent}\\${package} = ${view.moduleRoot} (${whose})`);\n}\n\nfunction explainOutputs(name: string, view: LoadedView): void {\n if (!view.members) {\n const source = view.source;\n console.log(`[${name}] ${view.specifier}`);\n console.log(` produces: ${outputKeys(view.runner)}`);\n printPackageRoot(view.host, \" \", view);\n printConsumes(\n view.host,\n \" \",\n (folder, member) => {\n const ref =\n member === undefined ? { host: folder } : { host: folder, member };\n return source?.lookup(ref).status === \"available\"\n ? ` (host \"${folder}\": running)`\n : ` (host \"${folder}\": not running; start it first: ph run ${folder})`;\n },\n source,\n );\n return;\n }\n\n const members = view.members;\n const refs = members.map((x) => ({ key: x.key, host: x.wrapper.host }));\n const config: unknown = view.host.config;\n const startOrder =\n typeof config === \"object\" &&\n config !== null &&\n \"startOrder\" in config &&\n Array.isArray(config.startOrder)\n ? config.startOrder.filter((k): k is string => typeof k === \"string\")\n : undefined;\n const plan = planCompound(\n members.map((m) => ({\n key: m.key,\n host: m.wrapper.host,\n refs: outputSitesOf(m.host).map(({ ref, path }) => ({ ref, path })),\n })),\n startOrder,\n );\n // The member that owns the terminal starts last, as `ph run` starts it;\n // a compound that breaks its rules fails here as it would there.\n const planned = planForeground(\n members.map((m) => ({\n key: m.key,\n specifier: m.specifier,\n member: m.wrapper,\n runner: m.runner,\n })),\n plan,\n startOrder ? { startOrder } : {},\n );\n const broken = planned.issues.at(0);\n if (broken) {\n throw new RunnerError(`hosts/${name}: ${broken.message}`, broken.hint);\n }\n const processes = new Map(\n members.map((m) => [\n m.key,\n memberProcessOf(m.wrapper, {\n foreground: m.key === planned.foreground,\n besideForeground: planned.foreground !== undefined,\n oneShot: false,\n }),\n ]),\n );\n // Where each member runs, once that is not the compound's process alone.\n const showWhere =\n planned.foreground !== undefined || [...processes.values()].includes(\"own\");\n const whereOf = (key: string) => {\n if (!showWhere) return \"\";\n if (key === planned.foreground) {\n return \" [in front: owns the terminal; its end ends the stack]\";\n }\n return processes.get(key) === \"own\"\n ? \" [own process]\"\n : \" [in the compound's process]\";\n };\n console.log(\n `[${name}] start order (${plan.source === \"tokens\" ? \"from the output tokens\" : \"config.startOrder, checked against the tokens\"}):`,\n );\n planned.order.forEach((key, index) => {\n const m = members.find((x) => x.key === key);\n const needs = plan.edges\n .filter((e) => e.consumer === key)\n .map((e) => e.producer);\n console.log(\n ` ${index + 1}. ${key} (${m?.wrapper.host ?? \"?\"})${needs.length ? ` after ${needs.join(\", \")}` : \"\"}${whereOf(key)}`,\n );\n });\n console.log(\" Ctrl-C stops members in reverse order (consumers first).\");\n for (const key of planned.order) {\n const m = members.find((x) => x.key === key);\n if (!m) continue;\n console.log(`[${name} › ${key} (${m.wrapper.host})] ${m.specifier}`);\n console.log(` produces: ${outputKeys(m.runner)}`);\n printPackageRoot(m.host, \" \", m);\n printConsumes(\n m.host,\n \" \",\n (folder, member) => {\n const ref =\n member === undefined ? { host: folder } : { host: folder, member };\n const target = memberForRef(ref, refs);\n return \"key\" in target\n ? ` (member \"${target.key}\", live outputs)`\n : \"\";\n },\n view.source,\n );\n }\n const own = { ...view.host, children: undefined };\n if (outputSitesOf(own).length > 0 || envSitesOf(own).length > 0) {\n console.log(`[${name}] the compound's own fields:`);\n printConsumes(own, \" \", () => \"\");\n }\n}\n"],"names":[],"mappings":";;;;;AAkEA,MAAM,SAAS,CAAC,UAAU,SAAS;AA6CnC,eAAe,SACb,aACA,MACqB;CAGrB,MAAM,SAAS,MAAM,SAAS,aAAa,IAAI;CAC/C,MAAM,QAAQ,OAAO;CACrB,MAAM,aAAa,aAAa,aAAa,MAAM;CACnD,MAAM,YAAY,OAAO,KAAK,OAAO;CACrC,MAAM,SAAS,MAAM,oBAAoB,YAAY,SAAS;CAC9D,MAAM,OAAO,cAAc,OAAO,MAAM,KAAK;CAC7C,IAAI,OAAO,SAAS,YAAY;EAC9B,MAAM,YAAY,MAAM,cACtB,aACA,aAAa,OAAO,IAAI,GACxB,KACF;EACA,qBAAqB,QAAQ,WAAW,OAAO,MAAM,MAAM,EACzD,iBAAiB,uBAAuB,SAAS,EACnD,CAAC;EAED,MAAM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AG;EACR,QAAQ,IAAI,IAAI,KAAK,KAAK,IAAI,IAAI,EAAE,QAAQ,KAAK,KAAK,EAAE,WAAW;EACnE,QAAQ,IAAI,eAAe,WAAW,EAAE,MAAM,GAAG;EACjD,iBAAiB,EAAE,MAAM,MAAM,CAAC;EAChC,cACE,EAAE,MACF,OACC,QAAQ,WAAW;GAGlB,MAAM,SAAS,aADb,WAAW,KAAA,IAAY,EAAE,MAAM,OAAO,IAAI;IAAE,MAAM;IAAQ;GAAO,GAClC,IAAI;GACrC,OAAO,SAAS,SACZ,cAAc,OAAO,IAAI,oBACzB;EACN,GACA,KAAK,MACP;CACF;CACA,MAAM,MAAM;EAAE,GAAG,KAAK;EAAM,UAAU,KAAA;CAAU;CAChD,IAAI,cAAc,GAAG,CAAC,CAAC,SAAS,KAAK,WAAW,GAAG,CAAC,CAAC,SAAS,GAAG;EAC/D,QAAQ,IAAI,IAAI,KAAK,6BAA6B;EAClD,cAAc,KAAK,YAAY,EAAE;CACnC;AACF","debug_id":"ba63167e-fb8a-54d0-81d7-24e5847c235a"}
|
|
@@ -1,9 +1,9 @@
|
|
|
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 { r as exportHost } 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]="30f3d446-404d-5430-8733-6d33c9272fe1")}catch(e){}}();
|
|
3
|
+
import { r as exportHost } from "./dist-CRR5Anp2.mjs";
|
|
4
4
|
import path from "node:path";
|
|
5
|
-
import { writeFile } from "node:fs/promises";
|
|
6
5
|
import { CALLER_CWD_ENV } from "@powerhousedao/shared/clis/command-names";
|
|
6
|
+
import { writeFile } from "node:fs/promises";
|
|
7
7
|
//#region src/services/host/export.ts
|
|
8
8
|
function message(error) {
|
|
9
9
|
return error instanceof Error ? error.message : String(error);
|
|
@@ -38,5 +38,5 @@ async function runHostExport(args) {
|
|
|
38
38
|
//#endregion
|
|
39
39
|
export { runHostExport };
|
|
40
40
|
|
|
41
|
-
//# sourceMappingURL=export-
|
|
42
|
-
//# debugId=
|
|
41
|
+
//# sourceMappingURL=export-CdTqYviH.mjs.map
|
|
42
|
+
//# debugId=30f3d446-404d-5430-8733-6d33c9272fe1
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export-
|
|
1
|
+
{"version":3,"file":"export-CdTqYviH.mjs","sources":["../src/services/host/export.ts"],"sourcesContent":["import { writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { exportHost, type HostExport } from \"@powerhousedao/host-core\";\nimport { CALLER_CWD_ENV } from \"@powerhousedao/shared/clis/command-names\";\n\nexport interface HostExportArgs {\n host: string;\n out?: string;\n projectRoot?: string;\n}\n\nexport interface HostExportResult {\n stdout?: string;\n stderr?: string;\n exitCode: number;\n}\n\nfunction message(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n\n/** `ph host export <host>`: the declared host and its members as JSON. */\nexport async function runHostExport(\n args: HostExportArgs,\n): Promise<HostExportResult> {\n let exported: HostExport;\n try {\n exported = await exportHost(args.projectRoot ?? process.cwd(), args.host);\n } catch (error) {\n return { stderr: `${message(error)}\\n`, exitCode: 1 };\n }\n const json = `${JSON.stringify(exported, null, 2)}\\n`;\n if (args.out === undefined) return { stdout: json, exitCode: 0 };\n try {\n const from = process.env[CALLER_CWD_ENV] ?? process.cwd();\n await writeFile(path.resolve(from, args.out), json);\n } catch (error) {\n return {\n stderr: `Cannot write ${args.out}: ${message(error)}\\n`,\n exitCode: 1,\n };\n }\n return { exitCode: 0 };\n}\n"],"names":[],"mappings":";;;;;;;AAiBA,SAAS,QAAQ,OAAwB;CACvC,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAC9D;;AAGA,eAAsB,cACpB,MAC2B;CAC3B,IAAI;CACJ,IAAI;EACF,WAAW,MAAM,WAAW,KAAK,eAAe,QAAQ,IAAI,GAAG,KAAK,IAAI;CAC1E,SAAS,OAAO;EACd,OAAO;GAAE,QAAQ,GAAG,QAAQ,KAAK,EAAE;GAAK,UAAU;EAAE;CACtD;CACA,MAAM,OAAO,GAAG,KAAK,UAAU,UAAU,MAAM,CAAC,EAAE;CAClD,IAAI,KAAK,QAAQ,KAAA,GAAW,OAAO;EAAE,QAAQ;EAAM,UAAU;CAAE;CAC/D,IAAI;EACF,MAAM,OAAO,QAAQ,IAAI,mBAAmB,QAAQ,IAAI;EACxD,MAAM,UAAU,KAAK,QAAQ,MAAM,KAAK,GAAG,GAAG,IAAI;CACpD,SAAS,OAAO;EACd,OAAO;GACL,QAAQ,gBAAgB,KAAK,IAAI,IAAI,QAAQ,KAAK,EAAE;GACpD,UAAU;EACZ;CACF;CACA,OAAO,EAAE,UAAU,EAAE;AACvB","debug_id":"30f3d446-404d-5430-8733-6d33c9272fe1"}
|
|
@@ -1,6 +1,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 { U as probeHostsFolder } from "./compound-
|
|
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]="0a9b6b9f-d496-5e3a-a096-34442cfb6a1f")}catch(e){}}();
|
|
3
|
+
import { U as probeHostsFolder } from "./compound-Q9sZSEZF-zZWzQ7VC.mjs";
|
|
4
4
|
import { t as warnSubgraphTypeConflicts } from "./warn-subgraph-type-conflicts-BOHBmThq.mjs";
|
|
5
5
|
import { t as startGenerateHosts } from "./generate-hosts-BFmPIW2X.mjs";
|
|
6
6
|
import { modelGeneration } from "@powerhousedao/codegen";
|
|
@@ -31,5 +31,5 @@ async function startGenerateAll(args, projectDir) {
|
|
|
31
31
|
//#endregion
|
|
32
32
|
export { startGenerateAll };
|
|
33
33
|
|
|
34
|
-
//# sourceMappingURL=generate-all-
|
|
35
|
-
//# debugId=
|
|
34
|
+
//# sourceMappingURL=generate-all-HujZHqCG.mjs.map
|
|
35
|
+
//# debugId=0a9b6b9f-d496-5e3a-a096-34442cfb6a1f
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-all-
|
|
1
|
+
{"version":3,"file":"generate-all-HujZHqCG.mjs","sources":["../src/services/generate-all.ts"],"sourcesContent":["import { modelGeneration } from \"@powerhousedao/codegen\";\nimport { buildTsMorphProject } from \"@powerhousedao/codegen/utils\";\nimport { extractAllDocuments, saveSpec } from \"@powerhousedao/vetra/codegen\";\nimport { probeHostsFolder } from \"@powerhousedao/host-core\";\nimport { warnSubgraphTypeConflicts } from \"../utils/warn-subgraph-type-conflicts.js\";\nimport { startGenerateHosts } from \"./generate-hosts.js\";\n\nexport async function startGenerateAll(\n args: { extract?: boolean },\n projectDir: string,\n) {\n const project = buildTsMorphProject(projectDir);\n if (args.extract) {\n const all = extractAllDocuments(project);\n for (const doc of [\n ...all.documentModels,\n ...all.editors,\n ...all.processors,\n ...all.subgraphs,\n ...all.apps,\n ]) {\n const path = await saveSpec(doc, projectDir);\n console.log(`Wrote ${path}`);\n }\n return;\n }\n await modelGeneration.generateAll(project);\n await project.save();\n await warnSubgraphTypeConflicts(projectDir);\n if (\n probeHostsFolder(projectDir).kind === \"present\" &&\n !(await startGenerateHosts(projectDir))\n ) {\n process.exitCode = 1;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;AAOA,eAAsB,iBACpB,MACA,YACA;CACA,MAAM,UAAU,oBAAoB,UAAU;CAC9C,IAAI,KAAK,SAAS;EAChB,MAAM,MAAM,oBAAoB,OAAO;EACvC,KAAK,MAAM,OAAO;GAChB,GAAG,IAAI;GACP,GAAG,IAAI;GACP,GAAG,IAAI;GACP,GAAG,IAAI;GACP,GAAG,IAAI;EACT,GAAG;GACD,MAAM,OAAO,MAAM,SAAS,KAAK,UAAU;GAC3C,QAAQ,IAAI,SAAS,MAAM;EAC7B;EACA;CACF;CACA,MAAM,gBAAgB,YAAY,OAAO;CACzC,MAAM,QAAQ,KAAK;CACnB,MAAM,0BAA0B,UAAU;CAC1C,IACE,iBAAiB,UAAU,CAAC,CAAC,SAAS,aACtC,CAAE,MAAM,mBAAmB,UAAU,GAErC,QAAQ,WAAW;AAEvB","debug_id":"0a9b6b9f-d496-5e3a-a096-34442cfb6a1f"}
|
|
@@ -1,13 +1,13 @@
|
|
|
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]="3b53d91f-05bb-5275-9ac7-d043fb42c9c8")}catch(e){}}();
|
|
3
3
|
import { g as union, i as boolean, m as string, p as strictObject, r as array, u as number } from "./schemas-DzgKfQIx.mjs";
|
|
4
4
|
import "node:module";
|
|
5
5
|
import fs from "node:fs";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import "node:child_process";
|
|
8
|
-
import { mapBackgroundImages, validateBackground } from "@powerhousedao/shared/connect";
|
|
9
8
|
import "node:url";
|
|
10
9
|
import { isPassthroughImageRef } from "@powerhousedao/shared/connect/image-ref";
|
|
10
|
+
import { mapBackgroundImages, validateBackground } from "@powerhousedao/shared/connect";
|
|
11
11
|
import { deflateSync } from "node:zlib";
|
|
12
12
|
//#region ../../packages/desktop/dist/shell-5tuLD8zw.mjs
|
|
13
13
|
/**
|
|
@@ -358,5 +358,5 @@ function startGenerateDesktopShell(args, cwd) {
|
|
|
358
358
|
//#endregion
|
|
359
359
|
export { startGenerateDesktopShell };
|
|
360
360
|
|
|
361
|
-
//# sourceMappingURL=generate-desktop-shell-
|
|
362
|
-
//# debugId=
|
|
361
|
+
//# sourceMappingURL=generate-desktop-shell-CTrfzM9P.mjs.map
|
|
362
|
+
//# debugId=3b53d91f-05bb-5275-9ac7-d043fb42c9c8
|