@powerhousedao/ph-cli 6.4.0-next.2 → 6.4.0-next.3
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 +6 -5
- package/dist/{build-C7RBpPwa.mjs → build-B-rPwjM8.mjs} +6 -6
- package/dist/{build-C7RBpPwa.mjs.map → build-B-rPwjM8.mjs.map} +1 -1
- package/dist/build-DuwAPWMY.mjs +4 -0
- package/dist/{check-1Hfe0lVO.mjs → check-B7C3Vi_b.mjs} +4 -4
- package/dist/{check-1Hfe0lVO.mjs.map → check-B7C3Vi_b.mjs.map} +1 -1
- package/dist/{check-MBdw9Lbm.mjs → check-DM7UdFTK.mjs} +4 -4
- package/dist/{check-MBdw9Lbm.mjs.map → check-DM7UdFTK.mjs.map} +1 -1
- package/dist/{check-ClxYRer4.mjs → check-DeUTd514.mjs} +3 -3
- package/dist/{cli-connect-override-DsuuectH.mjs → cli-connect-override-Bx_g3-ZE.mjs} +4 -4
- package/dist/{cli-connect-override-DsuuectH.mjs.map → cli-connect-override-Bx_g3-ZE.mjs.map} +1 -1
- package/dist/cli.mjs +8 -8
- package/dist/cli.mjs.map +1 -1
- package/dist/{compound-Q9sZSEZF-zZWzQ7VC.mjs → compound-Q9sZSEZF-DQvtoigb.mjs} +4 -4
- package/dist/{compound-Q9sZSEZF-zZWzQ7VC.mjs.map → compound-Q9sZSEZF-DQvtoigb.mjs.map} +1 -1
- package/dist/{connect-build-DAnGPSF5.mjs → connect-build-CaTxdYcc.mjs} +5 -5
- package/dist/{connect-build-DAnGPSF5.mjs.map → connect-build-CaTxdYcc.mjs.map} +1 -1
- package/dist/{connect-config-C0QZ7zTf.mjs → connect-config-A-U83U8U.mjs} +4 -4
- package/dist/{connect-config-C0QZ7zTf.mjs.map → connect-config-A-U83U8U.mjs.map} +1 -1
- package/dist/{connect-studio-BUth3UYP.mjs → connect-studio-B2gugCJU.mjs} +4 -4
- package/dist/{connect-studio-BUth3UYP.mjs.map → connect-studio-B2gugCJU.mjs.map} +1 -1
- package/dist/definitions-worker.mjs +1 -1
- package/dist/dev-host-RhWeATKB.mjs +19 -0
- package/dist/dev-host-RhWeATKB.mjs.map +1 -0
- package/dist/{dist-CRR5Anp2.mjs → dist-D_UjZsgt.mjs} +4 -4
- package/dist/{dist-CRR5Anp2.mjs.map → dist-D_UjZsgt.mjs.map} +1 -1
- package/dist/{explain-BfOC7Ngv.mjs → explain-DbbHpa61.mjs} +5 -5
- package/dist/{explain-BfOC7Ngv.mjs.map → explain-DbbHpa61.mjs.map} +1 -1
- package/dist/{export-CdTqYviH.mjs → export-FduYVQEM.mjs} +4 -4
- package/dist/{export-CdTqYviH.mjs.map → export-FduYVQEM.mjs.map} +1 -1
- package/dist/{files-D6_euBBn.mjs → files-DEHg350R.mjs} +4 -4
- package/dist/{files-D6_euBBn.mjs.map → files-DEHg350R.mjs.map} +1 -1
- package/dist/{generate-all-HujZHqCG.mjs → generate-all-BE8UmbJv.mjs} +6 -21
- package/dist/generate-all-BE8UmbJv.mjs.map +1 -0
- package/dist/{generate-app-hm6CJ_4O.mjs → generate-app-C7n0j8Ak.mjs} +5 -18
- package/dist/generate-app-C7n0j8Ak.mjs.map +1 -0
- package/dist/{generate-document-model-BiD6ovXc.mjs → generate-document-model-DSYPTMZg.mjs} +9 -31
- package/dist/generate-document-model-DSYPTMZg.mjs.map +1 -0
- package/dist/{generate-editor-DBj_Pxwa.mjs → generate-editor-DKuRUeIt.mjs} +5 -18
- package/dist/generate-editor-DKuRUeIt.mjs.map +1 -0
- package/dist/{generate-processor-BVjOsfjJ.mjs → generate-processor-CwJvJDpd.mjs} +5 -18
- package/dist/generate-processor-CwJvJDpd.mjs.map +1 -0
- package/dist/{generate-subgraph-DJZCr0Tk.mjs → generate-subgraph-EQ2ZjMp9.mjs} +6 -25
- package/dist/generate-subgraph-EQ2ZjMp9.mjs.map +1 -0
- package/dist/{get-version-DAYhm6MX.mjs → get-version-7oKMD8Gt.mjs} +4 -4
- package/dist/{get-version-DAYhm6MX.mjs.map → get-version-7oKMD8Gt.mjs.map} +1 -1
- package/dist/{mcp-rtMGg307.mjs → mcp-CcZT9zT9.mjs} +8 -8
- package/dist/mcp-CcZT9zT9.mjs.map +1 -0
- package/dist/{migrate-CWCJP19Q.mjs → migrate-Ddr7YAtM.mjs} +4 -4
- package/dist/{migrate-CWCJP19Q.mjs.map → migrate-Ddr7YAtM.mjs.map} +1 -1
- package/dist/{migrate-document-models-DTxM7D7p.mjs → migrate-document-models-X_mVTljj.mjs} +4 -4
- package/dist/{migrate-document-models-DTxM7D7p.mjs.map → migrate-document-models-X_mVTljj.mjs.map} +1 -1
- package/dist/migrate-subgraphs-DEqWkLoh.mjs +4 -0
- package/dist/{migrate-subgraphs-_yRnF7xt.mjs → migrate-subgraphs-Ffwwm7Oy.mjs} +5 -5
- package/dist/{migrate-subgraphs-_yRnF7xt.mjs.map → migrate-subgraphs-Ffwwm7Oy.mjs.map} +1 -1
- package/dist/{ph-cli-commands-FLZClR4x.mjs → ph-cli-commands-D4Z6YSwd.mjs} +39 -104
- package/dist/ph-cli-commands-D4Z6YSwd.mjs.map +1 -0
- package/dist/ph-cli-commands-p9cO6MsE.mjs +4 -0
- package/dist/{run-sugar-DUiDFl_T.mjs → run-sugar-CkuGJuPg.mjs} +16 -8
- package/dist/run-sugar-CkuGJuPg.mjs.map +1 -0
- package/dist/{run-sugar-YDxw0iV9.mjs → run-sugar-Dd_Mu058.mjs} +3 -3
- package/dist/runners/connect.mjs +2 -2
- package/dist/runners/switchboard.mjs +3 -3
- package/dist/{sugar-checks-BFu3sfFJ.mjs → sugar-checks-CAtgUIem.mjs} +16 -15
- package/dist/sugar-checks-CAtgUIem.mjs.map +1 -0
- package/dist/{verify-Dkb6K1fc.mjs → verify-DXrs0JUp.mjs} +5 -5
- package/dist/{verify-Dkb6K1fc.mjs.map → verify-DXrs0JUp.mjs.map} +1 -1
- package/dist/{vetra-gateway-BMzq0mqX.mjs → vetra-gateway-BHuz7pvS.mjs} +5 -5
- package/dist/{vetra-gateway-BMzq0mqX.mjs.map → vetra-gateway-BHuz7pvS.mjs.map} +1 -1
- package/dist/vetra-gateway-ag33E_Ta.mjs +4 -0
- package/dist/{vetra-host-C37IGwBM.mjs → vetra-host-CYdbd3J3.mjs} +28 -11
- package/dist/vetra-host-CYdbd3J3.mjs.map +1 -0
- package/dist/{vetra-launcher-Dq0tWyNW.mjs → vetra-launcher-B5L3yXPo.mjs} +16 -13
- package/dist/vetra-launcher-B5L3yXPo.mjs.map +1 -0
- package/dist/vetra-launcher-BUO9e74r.mjs +4 -0
- package/dist/{vetra-instance-CLUzbtbh.mjs → vetra-runtime-Bk6CW-BE.mjs} +6 -24
- package/dist/vetra-runtime-Bk6CW-BE.mjs.map +1 -0
- package/dist/warn-subgraph-type-conflicts-BZ4NwLx5.mjs +131 -0
- package/dist/warn-subgraph-type-conflicts-BZ4NwLx5.mjs.map +1 -0
- package/package.json +15 -16
- package/dist/build-BUpe1j4m.mjs +0 -4
- package/dist/generate-all-HujZHqCG.mjs.map +0 -1
- package/dist/generate-app-hm6CJ_4O.mjs.map +0 -1
- package/dist/generate-document-model-BiD6ovXc.mjs.map +0 -1
- package/dist/generate-editor-DBj_Pxwa.mjs.map +0 -1
- package/dist/generate-processor-BVjOsfjJ.mjs.map +0 -1
- package/dist/generate-subgraph-DJZCr0Tk.mjs.map +0 -1
- package/dist/mcp-rtMGg307.mjs.map +0 -1
- package/dist/migrate-subgraphs-DcJjLMFd.mjs +0 -4
- package/dist/ph-cli-commands-CRwA1aVX.mjs +0 -4
- package/dist/ph-cli-commands-FLZClR4x.mjs.map +0 -1
- package/dist/run-sugar-DUiDFl_T.mjs.map +0 -1
- package/dist/sugar-checks-BFu3sfFJ.mjs.map +0 -1
- package/dist/vetra-gateway-BP6Catg4.mjs +0 -4
- package/dist/vetra-host-C37IGwBM.mjs.map +0 -1
- package/dist/vetra-instance-CLUzbtbh.mjs.map +0 -1
- package/dist/vetra-launcher-CJ01qmS1.mjs +0 -4
- package/dist/vetra-launcher-Dq0tWyNW.mjs.map +0 -1
- package/dist/warn-subgraph-type-conflicts-BOHBmThq.mjs +0 -19
- package/dist/warn-subgraph-type-conflicts-BOHBmThq.mjs.map +0 -1
|
@@ -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]="fc15a2c7-5c9c-5739-b1e2-0bad2ebaa456")}catch(e){}}();
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import net from "node:net";
|
|
@@ -20,8 +20,8 @@ function writeVetraRuntime(projectDir, record) {
|
|
|
20
20
|
fs.writeFileSync(target, `${JSON.stringify(record, null, 2)}\n`);
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
* The record this process publishes for the
|
|
24
|
-
* `ph run
|
|
23
|
+
* The record this process publishes for the dev stack it started. `ph dev`
|
|
24
|
+
* and `ph run dev` both build it here, so the two write the same fields. The
|
|
25
25
|
* Switchboard's URLs follow from its port unless the caller knows them.
|
|
26
26
|
*/
|
|
27
27
|
function vetraRuntimeRecord(input) {
|
|
@@ -169,25 +169,7 @@ function syncMcpPortNotices(projectDir, port) {
|
|
|
169
169
|
return notices;
|
|
170
170
|
}
|
|
171
171
|
//#endregion
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* One Vetra per project. `ph run vetra` records its stack in
|
|
175
|
-
* `.ph/run/vetra.json` and, once ready, in `.ph/vetra-runtime.json`, which is
|
|
176
|
-
* what a start asks here: whether a Vetra already holds the project.
|
|
177
|
-
*/
|
|
178
|
-
/** The host folder `ph dev` runs, and the name its host file carries. */
|
|
179
|
-
const VETRA_HOST = "vetra";
|
|
180
|
-
/** Why `ph run vetra` must not start: a live Vetra holds the project. */
|
|
181
|
-
async function vetraRuntimeRefusal(projectDir, projectName) {
|
|
182
|
-
const probe = await probeVetraRuntime(projectDir, projectName);
|
|
183
|
-
if (probe.status === "live" || probe.status === "starting") {
|
|
184
|
-
if (probe.record.pid === process.pid) return void 0;
|
|
185
|
-
return `Vetra is already running for this project (pid ${probe.record.pid}). Stop it before starting another.`;
|
|
186
|
-
}
|
|
187
|
-
if (probe.status === "foreign") return `.ph/vetra-runtime.json describes a live Vetra for "${probe.record.projectName}", but this project is "${projectName}". Refusing to start a second instance. Delete .ph/vetra-runtime.json if that record is wrong.`;
|
|
188
|
-
}
|
|
189
|
-
//#endregion
|
|
190
|
-
export { probeVetraRuntime as a, vetraRuntimeRecord as c, isPortInUse as i, writeVetraRuntime as l, vetraRuntimeRefusal as n, readVetraRuntime as o, clearVetraRuntime as r, syncMcpPortNotices as s, VETRA_HOST as t };
|
|
172
|
+
export { syncMcpPortNotices as a, readVetraRuntime as i, isPortInUse as n, vetraRuntimeRecord as o, probeVetraRuntime as r, writeVetraRuntime as s, clearVetraRuntime as t };
|
|
191
173
|
|
|
192
|
-
//# sourceMappingURL=vetra-
|
|
193
|
-
//# debugId=
|
|
174
|
+
//# sourceMappingURL=vetra-runtime-Bk6CW-BE.mjs.map
|
|
175
|
+
//# debugId=fc15a2c7-5c9c-5739-b1e2-0bad2ebaa456
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vetra-runtime-Bk6CW-BE.mjs","sources":["../src/utils/vetra-runtime.ts"],"sourcesContent":["import { resolvePhDir } from \"@powerhousedao/shared/clis/ph-dir\";\nimport fs from \"node:fs\";\nimport net from \"node:net\";\nimport path from \"node:path\";\n\nexport type VetraRuntimeRecord = {\n pid: number;\n projectName: string;\n switchboardPort: number;\n connectPort: number;\n /** The Switchboard's GraphQL endpoint; absent in records from before it was written. */\n switchboardUrl?: string;\n mcpUrl: string;\n /** Vetra Studio; absent with --disable-connect. */\n connectUrl?: string;\n startedAt: string;\n};\n\nexport type VetraProbe =\n | { status: \"none\" }\n | { status: \"stale\" }\n | { status: \"starting\"; record: VetraRuntimeRecord }\n | { status: \"live\"; record: VetraRuntimeRecord }\n | { status: \"foreign\"; record: VetraRuntimeRecord };\n\nconst READY_TIMEOUT_MS = 2000;\n\n// Under the project's .ph tree — relocated with it by PH_USER_DATA_DIR.\nconst recordPath = (projectDir: string) =>\n path.join(resolvePhDir(projectDir), \"vetra-runtime.json\");\n\nexport function readVetraRuntime(\n projectDir: string,\n): VetraRuntimeRecord | undefined {\n try {\n return JSON.parse(\n fs.readFileSync(recordPath(projectDir), \"utf8\"),\n ) as VetraRuntimeRecord;\n } catch {\n // Missing or corrupt: either way there is no usable record.\n return undefined;\n }\n}\n\nexport function writeVetraRuntime(\n projectDir: string,\n record: VetraRuntimeRecord,\n): void {\n const target = recordPath(projectDir);\n fs.mkdirSync(path.dirname(target), { recursive: true });\n fs.writeFileSync(target, `${JSON.stringify(record, null, 2)}\\n`);\n}\n\n/**\n * The record this process publishes for the dev stack it started. `ph dev`\n * and `ph run dev` both build it here, so the two write the same fields. The\n * Switchboard's URLs follow from its port unless the caller knows them.\n */\nexport function vetraRuntimeRecord(input: {\n projectName: string;\n switchboardPort: number;\n connectPort: number;\n switchboardUrl?: string;\n mcpUrl?: string;\n /** Left out when no Vetra Studio runs. */\n connectUrl?: string;\n}): VetraRuntimeRecord {\n const { switchboardPort, connectUrl } = input;\n return {\n pid: process.pid,\n projectName: input.projectName,\n switchboardPort,\n connectPort: input.connectPort,\n switchboardUrl:\n input.switchboardUrl ?? `http://localhost:${switchboardPort}/graphql`,\n mcpUrl: input.mcpUrl ?? `http://localhost:${switchboardPort}/mcp`,\n ...(connectUrl ? { connectUrl } : {}),\n startedAt: new Date().toISOString(),\n };\n}\n\n/** Deletes the record; with `pid`, only the record of that process. */\nexport function clearVetraRuntime(projectDir: string, pid?: number): void {\n if (pid !== undefined && readVetraRuntime(projectDir)?.pid !== pid) return;\n try {\n fs.rmSync(recordPath(projectDir));\n } catch {\n // Already gone.\n }\n}\n\nfunction isPidAlive(pid: number): boolean {\n try {\n process.kill(pid, 0);\n return true;\n } catch (error) {\n // EPERM means the process exists but belongs to another user.\n return (error as NodeJS.ErrnoException).code === \"EPERM\";\n }\n}\n\nexport function isPortInUse(port: number): Promise<boolean> {\n return new Promise((resolve) => {\n const socket = net.connect({ port, host: \"localhost\" });\n socket.once(\"connect\", () => {\n socket.destroy();\n resolve(true);\n });\n socket.once(\"error\", () => resolve(false));\n });\n}\n\nasync function isReady(port: number): Promise<boolean> {\n try {\n const response = await fetch(`http://localhost:${port}/ready`, {\n signal: AbortSignal.timeout(READY_TIMEOUT_MS),\n });\n return response.ok;\n } catch {\n return false;\n }\n}\n\n/**\n * Decide whether the recorded instance is actually serving this project.\n *\n * All three checks are load-bearing. A pid can be reused by an unrelated\n * process, so a live pid proves nothing on its own. Another project's\n * switchboard would answer `/ready` on its own port, so a healthy `/ready`\n * proves nothing either. And the recorded `projectName` is what separates\n * \"my instance\" from \"someone else's instance that happens to hold this\n * port\" — which is precisely the confusion that let an agent write document\n * models into a different project's drive.\n *\n * A stale record is deleted so the next start is unblocked. A foreign one is\n * left alone: it describes something that is alive.\n */\nexport async function probeVetraRuntime(\n projectDir: string,\n projectName: string,\n): Promise<VetraProbe> {\n const record = readVetraRuntime(projectDir);\n if (!record) return { status: \"none\" };\n\n const alive = isPidAlive(record.pid);\n const ready = alive && (await isReady(record.switchboardPort));\n // The record lands once the port is bound; `/ready` turns 200 later.\n const starting =\n alive && !ready && (await isPortInUse(record.switchboardPort));\n if (!ready && !starting) {\n clearVetraRuntime(projectDir);\n return { status: \"stale\" };\n }\n\n if (record.projectName !== projectName) {\n return { status: \"foreign\", record };\n }\n return ready ? { status: \"live\", record } : { status: \"starting\", record };\n}\n\nconst MCP_FILES = [\n \".mcp.json\",\n path.join(\".cursor\", \"mcp.json\"),\n path.join(\".gemini\", \"settings.json\"),\n];\n\ntype McpConfig = { mcpServers?: Record<string, { url?: string }> };\ntype UrlMcpConfig = [string, McpConfig, { url?: string }];\n\n/** Each MCP config whose `reactor-mcp` entry still points at a URL. */\nfunction urlMcpConfigs(projectDir: string): UrlMcpConfig[] {\n const found: UrlMcpConfig[] = [];\n for (const rel of MCP_FILES) {\n const target = path.join(projectDir, rel);\n if (!fs.existsSync(target)) continue;\n let parsed: McpConfig;\n try {\n parsed = JSON.parse(fs.readFileSync(target, \"utf8\")) as McpConfig;\n } catch {\n // Hand-broken JSON is the author's to fix; don't clobber it.\n continue;\n }\n const server = parsed.mcpServers?.[\"reactor-mcp\"];\n if (server?.url) found.push([rel, parsed, server]);\n }\n return found;\n}\n\n/** The MCP configs `ph migrate` would move to the `ph mcp` launcher. */\nexport function legacyMcpConfigs(projectDir: string): string[] {\n return urlMcpConfigs(projectDir).map(([rel]) => rel);\n}\n\n/**\n * Point every URL-style `reactor-mcp` entry at `port`, returning the files\n * changed. Stdio entries (`ph mcp`) carry no port and are left alone; this\n * keeps projects that have not run `ph migrate` working.\n */\nexport function syncMcpPort(projectDir: string, port: number): string[] {\n const changed: string[] = [];\n const wanted = `http://localhost:${port}/mcp`;\n for (const [rel, parsed, server] of urlMcpConfigs(projectDir)) {\n if (server.url === wanted) continue;\n server.url = wanted;\n fs.writeFileSync(\n path.join(projectDir, rel),\n `${JSON.stringify(parsed, null, 2)}\\n`,\n );\n changed.push(rel);\n }\n return changed;\n}\n\n/**\n * {@link syncMcpPort} for a Vetra that just bound `port`, returning what to\n * tell the user. An MCP client resolved `.mcp.json` before this process\n * started and cannot re-read it, so a drifted literal means the agent is\n * pointed at the wrong port — possibly another project's reactor. Correct the\n * file and say so plainly; we cannot fix the already-open client ourselves.\n */\nexport function syncMcpPortNotices(projectDir: string, port: number): string[] {\n const notices: string[] = [];\n const driftedMcpFiles = syncMcpPort(projectDir, port);\n if (driftedMcpFiles.length > 0) {\n notices.push(\n `Updated ${driftedMcpFiles.join(\" and \")} to port ${port}. ` +\n `Reconnect your MCP client (/mcp) to pick it up. ` +\n `This edit is local — do not commit it.`,\n );\n }\n if (legacyMcpConfigs(projectDir).length > 0) {\n notices.push(\n \"reactor-mcp still points at a URL; run `ph migrate` to switch it to the `ph mcp` launcher.\",\n );\n }\n return notices;\n}\n"],"names":[],"mappings":";;;;;;;AAyBA,MAAM,mBAAmB;AAGzB,MAAM,cAAc,eAClB,KAAK,KAAK,aAAa,UAAU,GAAG,oBAAoB;AAE1D,SAAgB,iBACd,YACgC;CAChC,IAAI;EACF,OAAO,KAAK,MACV,GAAG,aAAa,WAAW,UAAU,GAAG,MAAM,CAChD;CACF,QAAQ;EAEN;CACF;AACF;AAEA,SAAgB,kBACd,YACA,QACM;CACN,MAAM,SAAS,WAAW,UAAU;CACpC,GAAG,UAAU,KAAK,QAAQ,MAAM,GAAG,EAAE,WAAW,KAAK,CAAC;CACtD,GAAG,cAAc,QAAQ,GAAG,KAAK,UAAU,QAAQ,MAAM,CAAC,EAAE,GAAG;AACjE;;;;;;AAOA,SAAgB,mBAAmB,OAQZ;CACrB,MAAM,EAAE,iBAAiB,eAAe;CACxC,OAAO;EACL,KAAK,QAAQ;EACb,aAAa,MAAM;EACnB;EACA,aAAa,MAAM;EACnB,gBACE,MAAM,kBAAkB,oBAAoB,gBAAgB;EAC9D,QAAQ,MAAM,UAAU,oBAAoB,gBAAgB;EAC5D,GAAI,aAAa,EAAE,WAAW,IAAI,CAAC;EACnC,4BAAW,IAAI,KAAK,EAAA,CAAE,YAAY;CACpC;AACF;;AAGA,SAAgB,kBAAkB,YAAoB,KAAoB;CACxE,IAAI,QAAQ,KAAA,KAAa,iBAAiB,UAAU,CAAC,EAAE,QAAQ,KAAK;CACpE,IAAI;EACF,GAAG,OAAO,WAAW,UAAU,CAAC;CAClC,QAAQ,C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typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="38188802-b52d-52b5-bc14-ea3ab113aee3")}catch(e){}}();
|
|
3
|
+
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { Kind, parse } from "graphql";
|
|
6
|
+
import { loadDocumentModelInDir, subgraphDirStyle } from "@powerhousedao/codegen/utils";
|
|
7
|
+
import { findPackageSubgraphConflicts } from "@powerhousedao/reactor-api/subgraph-types";
|
|
8
|
+
import { kebabCase } from "change-case";
|
|
9
|
+
//#region src/utils/subgraph-type-lint.ts
|
|
10
|
+
const GQL_TEMPLATE = /\bgql\s*`([^`]*)`/g;
|
|
11
|
+
const SUBGRAPH_NAME = /\bname\s*=\s*["'`]([^"'`]+)["'`]/;
|
|
12
|
+
const CODE_FIRST_NAME = /\bstatic\s+(?:override\s+)?(?:readonly\s+)?subgraphName(?:\s*:\s*string)?\s*=\s*["'`]([^"'`$]+)["'`]/;
|
|
13
|
+
const SUBGRAPH_EXPORT = /from\s+["']\.\/([^/"']+)\/index\.js["']/g;
|
|
14
|
+
function directories(path) {
|
|
15
|
+
try {
|
|
16
|
+
return readdirSync(path, { withFileTypes: true }).filter((entry) => entry.isDirectory());
|
|
17
|
+
} catch {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function read(path) {
|
|
22
|
+
try {
|
|
23
|
+
return readFileSync(path, "utf-8");
|
|
24
|
+
} catch {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function readSchema(path) {
|
|
29
|
+
const source = read(path);
|
|
30
|
+
if (source === void 0) return void 0;
|
|
31
|
+
const blocks = Array.from(source.matchAll(GQL_TEMPLATE), ([, sdl]) => sdl);
|
|
32
|
+
if (blocks.length === 0 || blocks.some((sdl) => sdl.includes("${"))) return;
|
|
33
|
+
try {
|
|
34
|
+
return parse(blocks.join("\n"));
|
|
35
|
+
} catch {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/** Subgraph directories in the order `subgraphs/index.ts` registers them. */
|
|
40
|
+
function subgraphDirs(subgraphsDir) {
|
|
41
|
+
const exported = Array.from((read(join(subgraphsDir, "index.ts")) ?? "").matchAll(SUBGRAPH_EXPORT), ([, dir]) => dir);
|
|
42
|
+
const position = (dir) => {
|
|
43
|
+
const index = exported.indexOf(dir);
|
|
44
|
+
return index === -1 ? exported.length : index;
|
|
45
|
+
};
|
|
46
|
+
return directories(subgraphsDir).map((entry) => entry.name).sort((a, b) => position(a) - position(b));
|
|
47
|
+
}
|
|
48
|
+
function describeRefusal({ name, reason, subgraphOnly }) {
|
|
49
|
+
const detail = reason.split("\n")[0].replace(/\.$/, "");
|
|
50
|
+
return subgraphOnly ? `The subgraph of document model "${name}" is refused by the server: ${detail}.` : `Document model "${name}" is refused by the server: ${detail}.`;
|
|
51
|
+
}
|
|
52
|
+
function describe(name, conflict) {
|
|
53
|
+
if (conflict.nameHeldBy === "package") return `Subgraph "${name}" is defined more than once, so the server serves only the last. Rename the others.`;
|
|
54
|
+
if (conflict.nameHeldBy) return `Subgraph "${name}" has the name of a ${conflict.nameHeldBy} subgraph, so the server refuses it. Rename the subgraph.`;
|
|
55
|
+
return `Subgraph "${name}" defines ${conflict.claims.map(({ claim, owner }) => `${claim} (owned by "${owner}")`).join(", ")}, so the supergraph leaves it out. Rename them in its schema.ts.`;
|
|
56
|
+
}
|
|
57
|
+
function loadModels(projectDir) {
|
|
58
|
+
return directories(join(projectDir, "document-models")).map(loadDocumentModelInDir).filter((model) => model !== void 0);
|
|
59
|
+
}
|
|
60
|
+
/** Why the server would refuse a new subgraph scaffolded as `name`, if it
|
|
61
|
+
* would; an existing one is left to {@link lintSubgraphTypes}. */
|
|
62
|
+
async function findSubgraphNameConflict(projectDir, name) {
|
|
63
|
+
const subgraphName = kebabCase(name);
|
|
64
|
+
if (existsSync(join(projectDir, "subgraphs", subgraphName, "index.ts"))) return;
|
|
65
|
+
const { conflicts } = await findPackageSubgraphConflicts([{
|
|
66
|
+
name: subgraphName,
|
|
67
|
+
typeDefs: {
|
|
68
|
+
kind: Kind.DOCUMENT,
|
|
69
|
+
definitions: []
|
|
70
|
+
}
|
|
71
|
+
}], loadModels(projectDir));
|
|
72
|
+
const holder = conflicts.get(subgraphName)?.nameHeldBy;
|
|
73
|
+
if (!holder || holder === "package") return void 0;
|
|
74
|
+
return `Subgraph name "${subgraphName}" is taken by a ${holder} subgraph, so the server would refuse this one. Choose another name, such as "${subgraphName}-api".`;
|
|
75
|
+
}
|
|
76
|
+
function codeFirstName(dir) {
|
|
77
|
+
const files = ["index.ts", ...readdirSync(dir, {
|
|
78
|
+
recursive: true,
|
|
79
|
+
encoding: "utf8"
|
|
80
|
+
}).filter((file) => file.endsWith(".ts") && file !== "index.ts").sort()];
|
|
81
|
+
for (const file of files) {
|
|
82
|
+
const name = CODE_FIRST_NAME.exec(read(join(dir, file)) ?? "")?.[1];
|
|
83
|
+
if (name !== void 0) return name;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/** A warning per model or subgraph the server would refuse or leave out. */
|
|
87
|
+
async function lintSubgraphTypes(projectDir) {
|
|
88
|
+
const models = loadModels(projectDir);
|
|
89
|
+
const subgraphsDir = join(projectDir, "subgraphs");
|
|
90
|
+
const subgraphs = [];
|
|
91
|
+
for (const dir of subgraphDirs(subgraphsDir)) {
|
|
92
|
+
if (subgraphDirStyle(subgraphsDir, dir) === "code-first") {
|
|
93
|
+
const name = codeFirstName(join(subgraphsDir, dir));
|
|
94
|
+
if (name !== void 0) subgraphs.push({
|
|
95
|
+
name,
|
|
96
|
+
typeDefs: {
|
|
97
|
+
kind: Kind.DOCUMENT,
|
|
98
|
+
definitions: []
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
const typeDefs = readSchema(join(subgraphsDir, dir, "schema.ts"));
|
|
104
|
+
if (!typeDefs) continue;
|
|
105
|
+
const index = read(join(subgraphsDir, dir, "index.ts")) ?? "";
|
|
106
|
+
subgraphs.push({
|
|
107
|
+
name: SUBGRAPH_NAME.exec(index)?.[1] ?? dir,
|
|
108
|
+
typeDefs
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
if (subgraphs.length === 0 && models.length === 0) return [];
|
|
112
|
+
const { conflicts, refusedModels } = await findPackageSubgraphConflicts(subgraphs, models);
|
|
113
|
+
return [...refusedModels.map(describeRefusal), ...Array.from(conflicts, ([name, conflict]) => describe(name, conflict))];
|
|
114
|
+
}
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region src/utils/warn-subgraph-type-conflicts.ts
|
|
117
|
+
async function warnSubgraphTypeConflicts(projectDir) {
|
|
118
|
+
let warnings;
|
|
119
|
+
try {
|
|
120
|
+
warnings = await lintSubgraphTypes(projectDir);
|
|
121
|
+
} catch (error) {
|
|
122
|
+
console.warn("⚠ Failed to check subgraph type names:", error);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
for (const warning of warnings) console.warn(`⚠ ${warning}`);
|
|
126
|
+
}
|
|
127
|
+
//#endregion
|
|
128
|
+
export { findSubgraphNameConflict as n, warnSubgraphTypeConflicts as t };
|
|
129
|
+
|
|
130
|
+
//# sourceMappingURL=warn-subgraph-type-conflicts-BZ4NwLx5.mjs.map
|
|
131
|
+
//# debugId=38188802-b52d-52b5-bc14-ea3ab113aee3
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"warn-subgraph-type-conflicts-BZ4NwLx5.mjs","sources":["../src/utils/subgraph-type-lint.ts","../src/utils/warn-subgraph-type-conflicts.ts"],"sourcesContent":["import {\n loadDocumentModelInDir,\n subgraphDirStyle,\n} from \"@powerhousedao/codegen/utils\";\nimport {\n findPackageSubgraphConflicts,\n type PackageSubgraph,\n type PackageSubgraphConflicts,\n type RefusedDocumentModel,\n} from \"@powerhousedao/reactor-api/subgraph-types\";\nimport { kebabCase } from \"change-case\";\nimport { type DocumentNode, Kind, parse } from \"graphql\";\nimport { type Dirent, existsSync, readdirSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\n// Templates with substitutions are skipped: their SDL is only known at runtime.\nconst GQL_TEMPLATE = /\\bgql\\s*`([^`]*)`/g;\nconst SUBGRAPH_NAME = /\\bname\\s*=\\s*[\"'`]([^\"'`]+)[\"'`]/;\nconst CODE_FIRST_NAME =\n /\\bstatic\\s+(?:override\\s+)?(?:readonly\\s+)?subgraphName(?:\\s*:\\s*string)?\\s*=\\s*[\"'`]([^\"'`$]+)[\"'`]/;\nconst SUBGRAPH_EXPORT = /from\\s+[\"']\\.\\/([^/\"']+)\\/index\\.js[\"']/g;\n\nfunction directories(path: string): Dirent[] {\n try {\n return readdirSync(path, { withFileTypes: true }).filter((entry) =>\n entry.isDirectory(),\n );\n } catch {\n return [];\n }\n}\n\nfunction read(path: string): string | undefined {\n try {\n return readFileSync(path, \"utf-8\");\n } catch {\n return undefined;\n }\n}\n\nfunction readSchema(path: string): DocumentNode | undefined {\n const source = read(path);\n if (source === undefined) return undefined;\n const blocks = Array.from(source.matchAll(GQL_TEMPLATE), ([, sdl]) => sdl);\n if (blocks.length === 0 || blocks.some((sdl) => sdl.includes(\"${\"))) {\n return undefined;\n }\n try {\n return parse(blocks.join(\"\\n\"));\n } catch {\n // Invalid SDL fails where the subgraph loads, and is reported there.\n return undefined;\n }\n}\n\n/** Subgraph directories in the order `subgraphs/index.ts` registers them. */\nfunction subgraphDirs(subgraphsDir: string): string[] {\n const exported = Array.from(\n (read(join(subgraphsDir, \"index.ts\")) ?? \"\").matchAll(SUBGRAPH_EXPORT),\n ([, dir]) => dir,\n );\n const position = (dir: string) => {\n const index = exported.indexOf(dir);\n return index === -1 ? exported.length : index;\n };\n return directories(subgraphsDir)\n .map((entry) => entry.name)\n .sort((a, b) => position(a) - position(b));\n}\n\nfunction describeRefusal({\n name,\n reason,\n subgraphOnly,\n}: RefusedDocumentModel): string {\n const detail = reason.split(\"\\n\")[0].replace(/\\.$/, \"\");\n return subgraphOnly\n ? `The subgraph of document model \"${name}\" is refused by the server: ${detail}.`\n : `Document model \"${name}\" is refused by the server: ${detail}.`;\n}\n\nfunction describe(name: string, conflict: PackageSubgraphConflicts): string {\n if (conflict.nameHeldBy === \"package\") {\n return `Subgraph \"${name}\" is defined more than once, so the server serves only the last. Rename the others.`;\n }\n if (conflict.nameHeldBy) {\n return `Subgraph \"${name}\" has the name of a ${conflict.nameHeldBy} subgraph, so the server refuses it. Rename the subgraph.`;\n }\n const claims = conflict.claims\n .map(({ claim, owner }) => `${claim} (owned by \"${owner}\")`)\n .join(\", \");\n return `Subgraph \"${name}\" defines ${claims}, so the supergraph leaves it out. Rename them in its schema.ts.`;\n}\n\nfunction loadModels(projectDir: string) {\n return directories(join(projectDir, \"document-models\"))\n .map(loadDocumentModelInDir)\n .filter((model) => model !== undefined);\n}\n\n/** Why the server would refuse a new subgraph scaffolded as `name`, if it\n * would; an existing one is left to {@link lintSubgraphTypes}. */\nexport async function findSubgraphNameConflict(\n projectDir: string,\n name: string,\n): Promise<string | undefined> {\n const subgraphName = kebabCase(name);\n if (existsSync(join(projectDir, \"subgraphs\", subgraphName, \"index.ts\"))) {\n return undefined;\n }\n const { conflicts } = await findPackageSubgraphConflicts(\n [\n {\n name: subgraphName,\n typeDefs: { kind: Kind.DOCUMENT, definitions: [] },\n },\n ],\n loadModels(projectDir),\n );\n const holder = conflicts.get(subgraphName)?.nameHeldBy;\n if (!holder || holder === \"package\") return undefined;\n return `Subgraph name \"${subgraphName}\" is taken by a ${holder} subgraph, so the server would refuse this one. Choose another name, such as \"${subgraphName}-api\".`;\n}\n\nfunction codeFirstName(dir: string): string | undefined {\n const files = [\n \"index.ts\",\n ...readdirSync(dir, { recursive: true, encoding: \"utf8\" })\n .filter((file) => file.endsWith(\".ts\") && file !== \"index.ts\")\n .sort(),\n ];\n for (const file of files) {\n const name = CODE_FIRST_NAME.exec(read(join(dir, file)) ?? \"\")?.[1];\n if (name !== undefined) return name;\n }\n return undefined;\n}\n\n/** A warning per model or subgraph the server would refuse or leave out. */\nexport async function lintSubgraphTypes(projectDir: string): Promise<string[]> {\n const models = loadModels(projectDir);\n const subgraphsDir = join(projectDir, \"subgraphs\");\n const subgraphs: PackageSubgraph[] = [];\n for (const dir of subgraphDirs(subgraphsDir)) {\n if (subgraphDirStyle(subgraphsDir, dir) === \"code-first\") {\n // Its schema is `ph` descriptors, which `ph model check` reads; this\n // lint checks only its name, in index.ts or a module of its directory.\n const name = codeFirstName(join(subgraphsDir, dir));\n if (name !== undefined) {\n subgraphs.push({\n name,\n typeDefs: { kind: Kind.DOCUMENT, definitions: [] },\n });\n }\n continue;\n }\n const typeDefs = readSchema(join(subgraphsDir, dir, \"schema.ts\"));\n if (!typeDefs) continue;\n const index = read(join(subgraphsDir, dir, \"index.ts\")) ?? \"\";\n subgraphs.push({ name: SUBGRAPH_NAME.exec(index)?.[1] ?? dir, typeDefs });\n }\n if (subgraphs.length === 0 && models.length === 0) return [];\n\n const { conflicts, refusedModels } = await findPackageSubgraphConflicts(\n subgraphs,\n models,\n );\n return [\n ...refusedModels.map(describeRefusal),\n ...Array.from(conflicts, ([name, conflict]) => describe(name, conflict)),\n ];\n}\n","import { lintSubgraphTypes } from \"./subgraph-type-lint.js\";\n\nexport async function warnSubgraphTypeConflicts(\n projectDir: string,\n): Promise<void> {\n let warnings: string[];\n try {\n warnings = await lintSubgraphTypes(projectDir);\n } catch (error) {\n console.warn(\"⚠ Failed to check subgraph type names:\", error);\n return;\n }\n for (const warning of warnings) console.warn(`⚠ ${warning}`);\n}\n"],"names":[],"mappings":";;;;;;;;;AAgBA,MAAM,eAAe;AACrB,MAAM,gBAAgB;AACtB,MAAM,kBACJ;AACF,MAAM,kBAAkB;AAExB,SAAS,YAAY,MAAwB;CAC3C,IAAI;EACF,OAAO,YAA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B,CAAC;CACtC,KAAK,MAAM,OAAO,aAAa,YAAY,GAAG;EAC5C,IAAI,iBAAiB,cAAc,GAAG,MAAM,cAAc;GAGxD,MAAM,OAAO,cAAc,KAAK,cAAc,GAAG,CAAC;GAClD,IAAI,SAAS,KAAA,GACX,UAAU,KAAK;IACb;IACA,UAAU;KAAE,MAAM,KAAK;KAAU,aAAa,CAAC;IAAE;GACnD,CAAC;GAEH;EACF;EACA,MAAM,WAAW,WAAW,KAAK,cAAc,KAAK,WAAW,CAAC;EAChE,IAAI,CAAC,UAAU;EACf,MAAM,QAAQ,KAAK,KAAK,cAAc,KAAK,UAAU,CAAC,KAAK;EAC3D,UAAU,KAAK;GAAE,MAAM,cAAc,KAAK,KAAK,CAAC,GAAG,MAAM;GAAK;EAAS,CAAC;CAC1E;CACA,IAAI,UAAU,WAAW,KAAK,OAAO,WAAW,GAAG,OAAO,CAAC;CAE3D,MAAM,EAAE,WAAW,kBAAkB,MAAM,6BACzC,WACA,MACF;CACA,OAAO,CACL,GAAG,cAAc,IAAI,eAAe,GACpC,GAAG,MAAM,KAAK,YAAY,CAAC,MAAM,cAAc,SAAS,MAAM,QAAQ,CAAC,CACzE;AACF;;;ACzKA,eAAsB,0BACpB,YACe;CACf,IAAI;CACJ,IAAI;EACF,WAAW,MAAM,kBAAkB,UAAU;CAC/C,SAAS,OAAO;EACd,QAAQ,KAAK,0CAA0C,KAAK;EAC5D;CACF;CACA,KAAK,MAAM,WAAW,UAAU,QAAQ,KAAK,KAAK,SAAS;AAC7D","debug_id":"38188802-b52d-52b5-bc14-ea3ab113aee3"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerhousedao/ph-cli",
|
|
3
|
-
"version": "6.4.0-next.
|
|
3
|
+
"version": "6.4.0-next.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"type": "module",
|
|
@@ -40,18 +40,17 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@modelcontextprotocol/sdk": "1.29.0",
|
|
42
42
|
"@originjs/vite-plugin-commonjs": "^1.0.3",
|
|
43
|
-
"@powerhousedao/builder-tools": "6.4.0-next.
|
|
44
|
-
"@powerhousedao/codegen": "6.4.0-next.
|
|
45
|
-
"@powerhousedao/common": "6.4.0-next.
|
|
46
|
-
"@powerhousedao/config": "6.4.0-next.
|
|
47
|
-
"@powerhousedao/ph-run": "6.4.0-next.
|
|
48
|
-
"@powerhousedao/reactor": "6.4.0-next.
|
|
49
|
-
"@powerhousedao/reactor-api": "6.4.0-next.
|
|
50
|
-
"@powerhousedao/reactor-mcp": "6.4.0-next.
|
|
51
|
-
"@powerhousedao/shared": "6.4.0-next.
|
|
52
|
-
"@powerhousedao/switchboard": "6.4.0-next.
|
|
53
|
-
"@
|
|
54
|
-
"@renown/sdk": "6.4.0-next.2",
|
|
43
|
+
"@powerhousedao/builder-tools": "6.4.0-next.3",
|
|
44
|
+
"@powerhousedao/codegen": "6.4.0-next.3",
|
|
45
|
+
"@powerhousedao/common": "6.4.0-next.3",
|
|
46
|
+
"@powerhousedao/config": "6.4.0-next.3",
|
|
47
|
+
"@powerhousedao/ph-run": "6.4.0-next.3",
|
|
48
|
+
"@powerhousedao/reactor": "6.4.0-next.3",
|
|
49
|
+
"@powerhousedao/reactor-api": "6.4.0-next.3",
|
|
50
|
+
"@powerhousedao/reactor-mcp": "6.4.0-next.3",
|
|
51
|
+
"@powerhousedao/shared": "6.4.0-next.3",
|
|
52
|
+
"@powerhousedao/switchboard": "6.4.0-next.3",
|
|
53
|
+
"@renown/sdk": "6.4.0-next.3",
|
|
55
54
|
"@sentry/node-core": "^10.52.0",
|
|
56
55
|
"@tsdown/css": "0.23.0",
|
|
57
56
|
"@vercel/nft": "^1.11.0",
|
|
@@ -60,7 +59,7 @@
|
|
|
60
59
|
"change-case": "5.4.4",
|
|
61
60
|
"cmd-ts": "0.15.0",
|
|
62
61
|
"colorette": "2.0.20",
|
|
63
|
-
"document-model": "6.4.0-next.
|
|
62
|
+
"document-model": "6.4.0-next.3",
|
|
64
63
|
"dotenv": "16.4.7",
|
|
65
64
|
"enquirer": "2.4.1",
|
|
66
65
|
"graphql": "^16",
|
|
@@ -82,8 +81,8 @@
|
|
|
82
81
|
"copyfiles": "2.4.1",
|
|
83
82
|
"write-package": "7.2.0",
|
|
84
83
|
"zod": "^4.5.4",
|
|
85
|
-
"@powerhousedao/desktop": "6.4.0-next.
|
|
86
|
-
"@powerhousedao/host-core": "6.4.0-next.
|
|
84
|
+
"@powerhousedao/desktop": "6.4.0-next.3",
|
|
85
|
+
"@powerhousedao/host-core": "6.4.0-next.3"
|
|
87
86
|
},
|
|
88
87
|
"scripts": {
|
|
89
88
|
"tsc": "tsc",
|
package/dist/build-BUpe1j4m.mjs
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { t as runBuild } from "./build-C7RBpPwa.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]="2bff0b1d-ca4d-5885-8372-7997d4bb268f")}catch(e){}}();
|
|
4
|
-
//# debugId=2bff0b1d-ca4d-5885-8372-7997d4bb268f
|
|
@@ -1 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-app-hm6CJ_4O.mjs","sources":["../src/services/generate-app.ts"],"sourcesContent":["import { generateAllApps, generateApp } from \"@powerhousedao/codegen\";\nimport {\n buildTsMorphProject,\n getAppMetadata,\n getEditorMetadata,\n} from \"@powerhousedao/codegen/utils\";\nimport {\n extractAppDocuments,\n generateAppFromDocument,\n getDocument,\n saveSpec,\n} from \"@powerhousedao/vetra/codegen\";\nimport type { AppModuleDocument } from \"@powerhousedao/vetra/document-models/app-module\";\nimport { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { GenerateAppArgs } from \"../types.js\";\nimport { resolveModuleDirName } from \"../utils/module-dir.js\";\n\nconst MODULE_FILE_EXPECTATION =\n \"an EditorModule with string literals for config.id, config.name and documentTypes\";\n\nexport async function startGenerateApp(\n args: GenerateAppArgs,\n projectDir: string,\n) {\n const {\n name,\n allowedDocumentTypes = [],\n disableDragAndDrop,\n document,\n dir,\n all,\n extract,\n debug,\n } = args;\n if (debug) {\n console.log({ args });\n }\n const project = buildTsMorphProject(projectDir);\n if (extract) {\n const docs = extractAppDocuments(project);\n if (docs.length === 0) {\n console.log(\"No drive apps found in editors/.\");\n }\n for (const doc of docs) {\n const path = await saveSpec(doc, projectDir);\n console.log(`Wrote ${path}`);\n }\n return;\n }\n if (all) {\n const { apps, unreadableDirs } = await generateAllApps(project);\n await project.save();\n if (apps.length === 0 && unreadableDirs.length === 0) {\n console.log(\"No drive apps found in editors/.\");\n }\n for (const app of apps) {\n console.log(`Regenerated app \"${app.name}\" in editors/${app.dirName}`);\n }\n for (const dirName of unreadableDirs) {\n console.warn(\n `Skipped editors/${dirName}: expected its module.ts to export ${MODULE_FILE_EXPECTATION}. Kept the manifest's apps.`,\n );\n }\n return;\n } else if (document) {\n const doc = (await getDocument(document)) as AppModuleDocument;\n await generateAppFromDocument(doc, project);\n } else if (name) {\n await generateApp(\n {\n appName: name,\n allowedDocumentTypes,\n isDragAndDropEnabled: !disableDragAndDrop,\n },\n project,\n );\n } else if (dir) {\n const appMetadata = getAppMetadata(\n project,\n resolveAppDirName(project, projectDir, dir),\n );\n if (!appMetadata) {\n throw new Error(`Failed to get data for app in dir \"${dir}\"`);\n }\n const {\n name: appName,\n id: appId,\n dirName: appDirName,\n allowedDocumentTypes,\n isDragAndDropEnabled,\n } = appMetadata;\n\n await generateApp(\n {\n appName,\n appId,\n appDirName,\n allowedDocumentTypes,\n isDragAndDropEnabled,\n },\n project,\n );\n await project.save();\n console.log(`Regenerated app \"${appName}\" in editors/${appDirName}`);\n return;\n } else {\n console.log(\n \"Please specify one of `name`, `document`, `dir`, `all`, or `extract`.\",\n );\n return;\n }\n await project.save();\n}\n\n/** The app directory that `--dir` names, checked to hold a drive app's module.ts */\nfunction resolveAppDirName(\n project: ReturnType<typeof buildTsMorphProject>,\n projectDir: string,\n dir: string,\n) {\n const dirName = resolveModuleDirName(projectDir, \"editors\", dir, \"my-app\");\n if (!existsSync(join(projectDir, \"editors\", dirName, \"module.ts\"))) {\n throw new Error(`editors/${dirName} has no module.ts.`);\n }\n const editorMetadata = getEditorMetadata(project, dirName);\n if (!editorMetadata) {\n throw new Error(\n `Could not read editors/${dirName}/module.ts: expected ${MODULE_FILE_EXPECTATION}.`,\n );\n }\n if (!editorMetadata.documentTypes.includes(\"powerhouse/document-drive\")) {\n throw new Error(\n `editors/${dirName} is a document editor, not a drive app: its documentTypes don't include \"powerhouse/document-drive\". Use \\`ph-cli generate editor --dir ${dirName}\\` instead.`,\n );\n }\n return dirName;\n}\n"],"names":[],"mappings":";;;;;;;;;AAkBA,MAAM,0BACJ;AAEF,eAAsB,iBACpB,MACA,YACA;CACA,MAAM,EACJ,MACA,uBAAuB,CAAC,GACxB,oBACA,UACA,KACA,KACA,SACA,UACE;CACJ,IAAI,OACF,QAAQ,IAAI,EAAE,KAAK,CAAC;CAEtB,MAAM,UAAU,oBAAoB,UAAU;CAC9C,IAAI,SAAS;EACX,MAAM,OAAO,oBAAoB,OAAO;EACxC,IAAI,KAAK,WAAW,GAClB,QAAQ,IAAI,kCAAkC;EAEhD,KAAK,MAAM,OAAO,MAAM;GACtB,MAAM,OAAO,MAAM,SAAS,KAAK,UAAU;GAC3C,QAAQ,IAAI,SAAS,MAAM;EAC7B;EACA;CACF;CACA,IAAI,KAAK;EACP,MAAM,EAAE,MAAM,mBAAmB,MAAM,gBAAgB,OAAO;EAC9D,MAAM,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,QAAQ,0IAA0I,QAAQ,YACvK;CAEF,OAAO;AACT","debug_id":"598034cf-aa42-5189-8607-4625d64996ff"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-document-model-BiD6ovXc.mjs","sources":["../src/services/definitions/code-first-scaffold.ts","../src/services/generate-document-model.ts"],"sourcesContent":["import type { ModelGeneration } from \"@powerhousedao/codegen\";\nimport { capitalCase, kebabCase } from \"change-case\";\nimport { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { readPackage } from \"read-pkg\";\nimport type { Project } from \"ts-morph\";\n\nexport async function scaffoldCodeFirstDocumentModel(\n generation: ModelGeneration,\n name: string,\n projectDir: string,\n project: Project,\n) {\n const modelName = name.trim();\n if (modelName === \"\") {\n throw new Error(\"--name needs a document model name.\");\n }\n const namespace = await documentTypeNamespace(projectDir);\n const documentType = `${namespace}/${kebabCase(modelName)}`;\n const editorName = `${capitalCase(modelName)} Editor`;\n const editorDirName = kebabCase(editorName);\n if (existsSync(join(projectDir, \"editors\", editorDirName))) {\n throw new Error(\n `editors/${editorDirName} already exists. Choose another --name, or move that editor first.`,\n );\n }\n\n const result = await generation.scaffoldDocumentModel(\n {\n name: modelName,\n documentType,\n author: { name: namespace, website: null },\n },\n project,\n );\n for (const path of result.written) {\n console.log(`Wrote ${path}`);\n }\n\n await generation.generateEditor(\n {\n editorName,\n documentTypes: [documentType],\n editorId: editorDirName,\n editorDirName,\n },\n project,\n );\n await project.save();\n console.log(`Generated editor \"${editorName}\" in editors/${editorDirName}`);\n}\n\nasync function documentTypeNamespace(projectDir: string) {\n const { name } = await readPackage({ cwd: projectDir, normalize: false });\n if (!name) {\n throw new Error(\n \"--name puts the document type under the package name. Add a name to package.json.\",\n );\n }\n return name.replace(/^@/, \"\").replaceAll(\"/\", \"-\");\n}\n","import { loadDocumentModel, modelGeneration } from \"@powerhousedao/codegen\";\nimport {\n buildTsMorphProject,\n documentModelsDirOf,\n} from \"@powerhousedao/codegen/utils\";\nimport {\n extractDocumentModelDocuments,\n getDocument,\n saveSpec,\n} from \"@powerhousedao/vetra/codegen\";\nimport { handleMutuallyExclusiveOptions } from \"@powerhousedao/shared/clis\";\nimport type { DocumentModelDocument } from \"@powerhousedao/shared/document-model\";\nimport { existsSync } from \"node:fs\";\nimport { join, relative } from \"node:path\";\nimport type { GenerateDocumentModelArgs } from \"../types.js\";\nimport { resolveModuleDirName } from \"../utils/module-dir.js\";\nimport { warnSubgraphTypeConflicts } from \"../utils/warn-subgraph-type-conflicts.js\";\nimport { scaffoldCodeFirstDocumentModel } from \"./definitions/code-first-scaffold.js\";\n\n/** The configured documentModelsDir, package-relative, for messages and paths. */\nfunction modelsDirOf(projectDir: string) {\n return relative(projectDir, documentModelsDirOf(projectDir).path).replaceAll(\n \"\\\\\",\n \"/\",\n );\n}\n\nexport async function startGenerateDocumentModel(\n args: GenerateDocumentModelArgs,\n projectDir: string,\n) {\n const { document, dir, all, extract, name, codeFirst, debug } = args;\n if (debug) {\n console.log({ args });\n }\n if (name !== undefined && !codeFirst) {\n throw new Error(\n \"--name creates a code-first document model. Pass --code-first.\",\n );\n }\n if (codeFirst && name === undefined) {\n throw new Error(\n \"--code-first only chooses how --name creates a model. Existing models of both styles are discovered without it; drop --code-first. To convert a schema-first model, run ph migrate --document-model <dir>.\",\n );\n }\n const project = buildTsMorphProject(projectDir);\n if (name !== undefined) {\n handleMutuallyExclusiveOptions(\n {\n \"--name\": name,\n \"--document\": document,\n \"--dir\": dir,\n \"--all\": all || undefined,\n \"--extract\": extract || undefined,\n },\n \"generation mode\",\n );\n await scaffoldCodeFirstDocumentModel(\n modelGeneration,\n name,\n projectDir,\n project,\n );\n return;\n }\n if (extract) {\n const docs = extractDocumentModelDocuments(project);\n for (const doc of docs) {\n const path = await saveSpec(doc, projectDir);\n console.log(`Wrote ${path}`);\n }\n return;\n }\n if (all) {\n const { documentModels, unreadableDirs, codeFirstDocumentModels } =\n await modelGeneration.generateAllDocumentModels(project);\n await project.save();\n if (\n documentModels.length === 0 &&\n unreadableDirs.length === 0 &&\n codeFirstDocumentModels.length === 0\n ) {\n console.log(`No document models found in ${modelsDirOf(projectDir)}/.`);\n }\n for (const { name } of documentModels) {\n console.log(`Regenerated document model \"${name}\"`);\n }\n for (const { name } of codeFirstDocumentModels) {\n console.log(`Updated the exports of code-first document model \"${name}\"`);\n }\n for (const dirName of unreadableDirs) {\n console.warn(\n `Skipped ${modelsDirOf(projectDir)}/${dirName}: it has no readable ${dirName}.json, and no index.ts in it exports a code-first model. Kept the manifest's document models.`,\n );\n }\n await warnSubgraphTypeConflicts(projectDir);\n return;\n } else if (document) {\n if (document.endsWith(\".phd\")) {\n const doc = (await getDocument(document)) as DocumentModelDocument;\n await modelGeneration.generateDocumentModel(doc.state.global, project);\n } else {\n const state = await loadDocumentModel(document);\n await modelGeneration.generateDocumentModel(state, project);\n }\n } else if (dir) {\n const modelsDir = modelsDirOf(projectDir);\n const dirName = resolveModuleDirName(\n projectDir,\n modelsDir,\n dir,\n \"my-document-model\",\n );\n const specPath = join(projectDir, modelsDir, dirName, `${dirName}.json`);\n if (!existsSync(specPath)) {\n throw new Error(`${modelsDir}/${dirName} has no ${dirName}.json.`);\n }\n const state = await loadDocumentModel(specPath);\n await modelGeneration.generateDocumentModel(state, project);\n await project.save();\n console.log(\n `Regenerated document model \"${state.name}\" in ${modelsDir}/${dirName}`,\n );\n await warnSubgraphTypeConflicts(projectDir);\n return;\n } else {\n console.log(\n \"Please specify one of `document`, `dir`, `all`, or `extract`.\",\n );\n return;\n }\n await project.save();\n await warnSubgraphTypeConflicts(projectDir);\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAOA,eAAsB,+BACpB,YACA,MACA,YACA,SACA;CACA,MAAM,YAAY,KAAK,KAAK;CAC5B,IAAI,cAAc,IAChB,MAAM,IAAI,MAAM,qCAAqC;CAEvD,MAAM,YAAY,MAAM,sBAAsB,UAAU;CACxD,MAAM,eAAe,GAAG,UAAU,GAAG,UAAU,SAAS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I,MAAM,GAAG,UAAU,GAAG,QAAQ,UAAU,QAAQ,OAAO;EAEnE,MAAM,QAAQ,MAAM,kBAAkB,QAAQ;EAC9C,MAAM,gBAAgB,sBAAsB,OAAO,OAAO;EAC1D,MAAM,QAAQ,KAAK;EACnB,QAAQ,IACN,+BAA+B,MAAM,KAAK,OAAO,UAAU,GAAG,SAChE;EACA,MAAM,0BAA0B,UAAU;EAC1C;CACF,OAAO;EACL,QAAQ,IACN,+DACF;EACA;CACF;CACA,MAAM,QAAQ,KAAK;CACnB,MAAM,0BAA0B,UAAU;AAC5C","debug_id":"d143ac9a-759c-5a5d-98d0-f6df3d4b1bfe"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-editor-DBj_Pxwa.mjs","sources":["../src/services/generate-editor.ts"],"sourcesContent":["import { modelGeneration } from \"@powerhousedao/codegen\";\nimport {\n buildTsMorphProject,\n getEditorMetadata,\n} from \"@powerhousedao/codegen/utils\";\nimport {\n extractEditorDocuments,\n generateEditorFromDocument,\n getDocument,\n saveSpec,\n} from \"@powerhousedao/vetra/codegen\";\nimport type { DocumentEditorDocument } from \"@powerhousedao/vetra/document-models/document-editor\";\nimport { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { GenerateEditorArgs } from \"../types.js\";\nimport { resolveModuleDirName } from \"../utils/module-dir.js\";\n\nconst MODULE_FILE_EXPECTATION =\n \"an EditorModule with string literals for config.id, config.name and documentTypes\";\n\nexport async function startGenerateEditor(\n args: GenerateEditorArgs,\n projectDir: string,\n) {\n const { name, documentType, document, dir, all, extract, debug } = args;\n if (debug) {\n console.log({ args });\n }\n const project = buildTsMorphProject(projectDir);\n if (extract) {\n const docs = extractEditorDocuments(project);\n if (docs.length === 0) {\n console.log(\"No document editors found in editors/.\");\n }\n for (const doc of docs) {\n const path = await saveSpec(doc, projectDir);\n console.log(`Wrote ${path}`);\n }\n return;\n }\n const report: string[] = [];\n if (all) {\n const { editors, unreadableDirs } =\n await modelGeneration.generateAllEditors(project);\n if (editors.length === 0 && unreadableDirs.length === 0) {\n report.push(\"No document editors found in editors/.\");\n }\n for (const editor of editors) {\n report.push(\n `Regenerated editor \"${editor.name}\" in editors/${editor.dirName}`,\n );\n }\n for (const dirName of unreadableDirs) {\n console.warn(\n `Skipped editors/${dirName}: expected its module.ts to export ${MODULE_FILE_EXPECTATION}. Kept the manifest's editors.`,\n );\n }\n } else if (document) {\n const doc = (await getDocument(document)) as DocumentEditorDocument;\n await generateEditorFromDocument(doc, project);\n } else if (name) {\n if (!documentType) {\n throw new Error(\n \"Please specify a document type for the new editor to generate.\",\n );\n }\n await modelGeneration.generateEditor(\n { editorName: name, documentTypes: [documentType] },\n project,\n );\n } else if (dir) {\n const dirName = resolveModuleDirName(\n projectDir,\n \"editors\",\n dir,\n \"my-editor\",\n );\n if (!existsSync(join(projectDir, \"editors\", dirName, \"module.ts\"))) {\n throw new Error(`editors/${dirName} has no module.ts.`);\n }\n const editorArgs = getEditorMetadata(project, dirName);\n if (!editorArgs) {\n throw new Error(\n `Could not read editors/${dirName}/module.ts: expected ${MODULE_FILE_EXPECTATION}.`,\n );\n }\n if (editorArgs.documentTypes.includes(\"powerhouse/document-drive\")) {\n throw new Error(\n `editors/${dirName} is a drive app, not a document editor. Use \\`ph-cli generate app --dir ${dirName}\\` instead.`,\n );\n }\n const {\n name: editorName,\n id: editorId,\n dirName: editorDirName,\n documentTypes,\n } = editorArgs;\n await modelGeneration.generateEditor(\n {\n editorName,\n editorId,\n editorDirName,\n documentTypes,\n },\n project,\n );\n report.push(\n `Regenerated editor \"${editorName}\" in editors/${editorDirName}`,\n );\n } else {\n console.log(\n \"Please specify one of `name`, `document`, `dir`, `all`, or `extract`.\",\n );\n return;\n }\n await project.save();\n for (const line of report) {\n console.log(line);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;AAiBA,MAAM,0BACJ;AAEF,eAAsB,oBACpB,MACA,YACA;CACA,MAAM,EAAE,MAAM,cAAc,UAAU,KAA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2B,GAC/D,MAAM,IAAI,MACR,WAAW,QAAQ,0EAA0E,QAAQ,YACvG;EAEF,MAAM,EACJ,MAAM,YACN,IAAI,UACJ,SAAS,eACT,kBACE;EACJ,MAAM,gBAAgB,eACpB;GACE;GACA;GACA;GACA;EACF,GACA,OACF;EACA,OAAO,KACL,uBAAuB,WAAW,eAAe,eACnD;CACF,OAAO;EACL,QAAQ,IACN,uEACF;EACA;CACF;CACA,MAAM,QAAQ,KAAK;CACnB,KAAK,MAAM,QAAQ,QACjB,QAAQ,IAAI,IAAI;AAEpB","debug_id":"0204e193-cfc3-57bd-8acf-bc46414176a5"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-processor-BVjOsfjJ.mjs","sources":["../src/services/generate-processor.ts"],"sourcesContent":["import {\n detectFeatures,\n generateAllProcessors,\n generateProcessor,\n syncFeatureDependencies,\n} from \"@powerhousedao/codegen\";\nimport {\n buildTsMorphProject,\n getProcessorMetadata,\n} from \"@powerhousedao/codegen/utils\";\nimport {\n extractProcessorDocuments,\n generateProcessorFromDocument,\n getDocument,\n saveSpec,\n} from \"@powerhousedao/vetra/codegen\";\nimport type { ProcessorModuleDocument } from \"@powerhousedao/vetra/document-models/processor-module\";\nimport { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { GenerateProcessorArgs } from \"../types.js\";\nimport { installAddedDependencies } from \"../utils/install-added-dependencies.js\";\nimport { resolveModuleDirName } from \"../utils/module-dir.js\";\n\nexport async function startGenerateProcessor(\n args: GenerateProcessorArgs,\n projectDir: string,\n) {\n const {\n name: processorName,\n type: processorType,\n apps: processorApps,\n documentTypes,\n document,\n dir,\n all,\n extract,\n debug,\n } = args;\n if (debug) {\n console.log({ args });\n }\n const project = buildTsMorphProject(projectDir);\n if (extract) {\n const docs = extractProcessorDocuments(project);\n if (docs.length === 0) {\n console.log(\"No processors found in processors/.\");\n }\n for (const doc of docs) {\n const path = await saveSpec(doc, projectDir);\n console.log(`Wrote ${path}`);\n }\n return;\n }\n const report: string[] = [];\n if (all) {\n const processors = await generateAllProcessors(project);\n if (processors.length === 0) {\n report.push(\"No processors found in processors/.\");\n }\n for (const { processorName } of processors) {\n report.push(`Regenerated processor in processors/${processorName}`);\n }\n } else if (document) {\n const doc = (await getDocument(document)) as ProcessorModuleDocument;\n await generateProcessorFromDocument(doc, project);\n } else if (processorName) {\n await generateProcessor(\n {\n processorName,\n processorApps,\n processorType,\n documentTypes,\n },\n project,\n );\n } else if (dir) {\n const processorDirName = resolveModuleDirName(\n projectDir,\n \"processors\",\n dir,\n \"my-processor\",\n );\n const processorDir = join(projectDir, \"processors\", processorDirName);\n if (\n ![\"processor.ts\", \"index.ts\"].some((file) =>\n existsSync(join(processorDir, file)),\n )\n ) {\n throw new Error(\n `processors/${processorDirName} has no processor.ts or index.ts.`,\n );\n }\n const processorArgs = getProcessorMetadata(project, processorDirName);\n await generateProcessor(processorArgs, project);\n report.push(`Regenerated processor in processors/${processorDirName}`);\n } else {\n console.log(\n \"Please specify one of `name`, `document`, `dir`, `all`, or `extract`.\",\n );\n return;\n }\n await project.save();\n for (const line of report) {\n console.log(line);\n }\n const added = await syncFeatureDependencies(\n detectFeatures(projectDir),\n projectDir,\n );\n await installAddedDependencies(added, projectDir, args.skipInstall);\n}\n"],"names":["installAddedDependencies"],"mappings":";;;;;;;;;;AAuBA,eAAsB,uBACpB,MACA,YACA;CACA,MAAM,EACJ,MAAM,eACN,MAAM,eACN,MAAM,eACN,eACA,UACA,KACA,KACA,SACA,UACE;CACJ,IAAI,OACF,QAAQ,IAAI,EAAE,KAAK,CAAC;CAEtB,MAAM,UAAU,oBAAoB,UAAU;CAC9C,IAAI,SAAS;EACX,MAAM,OAAO,0BAA0B,OAAO;EAC9C,IAAI,KAAK,WAAW,GAClB,QAAQ,IAAI,qCAAqC;EAEnD,KAAK,MAAM,OAAO,MAAM;GACtB,MAAM,OAAO,MAAM,SAAS,KAAK,UAAU;GAC3C,QAAQ,IAAI,SAAS,MAAM;EAC7B;EACA;CACF;CACA,MAAM,SAAmB,CAAC;CAC1B,IAAI,KAAK;EACP,MAAM,aAAa,MAAM,sBAAsB,OAAO;EACtD,IAAI,WAAW,WAAW,GACxB,OAAO,KAAK,qCAAqC;EAEnD,KAAK,MAAM,EAAE,mBAAmB,YAC9B,OAAO,KAAK,uCAAuC,eAAe;CAEtE,OAAO,IAAI,UAAU;EACnB,MAAM,MAAO,MAAM,YAAY,QAAQ;EACvC,MAAM,8BAA8B,KAAK,OAAO;CAClD,OAAO,IAAI,eACT,MAAM,kBACJ;EACE;EACA;EACA;EACA;CACF,GACA,OACF;MACK,IAAI,KAAK;EACd,MAAM,mBAAmB,qBACvB,YACA,cACA,KACA,cACF;EACA,MAAM,eAAe,KAAK,YAAY,cAAc,gBAAgB;EACpE,IACE,CAAC,CAAC,gBAAgB,UAAU,CAAC,CAAC,MAAM,SAClC,WAAW,KAAK,cAAc,IAAI,CAAC,CACrC,GAEA,MAAM,IAAI,MACR,cAAc,iBAAiB,kCACjC;EAEF,MAAM,gBAAgB,qBAAqB,SAAS,gBAAgB;EACpE,MAAM,kBAAkB,eAAe,OAAO;EAC9C,OAAO,KAAK,uCAAuC,kBAAkB;CACvE,OAAO;EACL,QAAQ,IACN,uEACF;EACA;CACF;CACA,MAAM,QAAQ,KAAK;CACnB,KAAK,MAAM,QAAQ,QACjB,QAAQ,IAAI,IAAI;CAElB,MAAM,QAAQ,MAAM,wBAClB,eAAe,UAAU,GACzB,UACF;CACA,MAAMA,2BAAyB,OAAO,YAAY,KAAK,WAAW;AACpE","debug_id":"72eea5cc-adda-5917-886a-b16a3f13873c"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-subgraph-DJZCr0Tk.mjs","sources":["../src/services/generate-subgraph.ts"],"sourcesContent":["import {\n detectFeatures,\n generateAllSubgraphs,\n generateSubgraph,\n generateSubgraphDir,\n syncFeatureDependencies,\n} from \"@powerhousedao/codegen\";\nimport {\n buildTsMorphProject,\n subgraphDirStyle,\n type SubgraphStyle,\n} from \"@powerhousedao/codegen/utils\";\nimport {\n extractSubgraphDocuments,\n findSubgraphNameConflict,\n generateSubgraphFromDocument,\n getDocument,\n saveSpec,\n} from \"@powerhousedao/vetra/codegen\";\nimport type { SubgraphModuleDocument } from \"@powerhousedao/vetra/document-models/subgraph-module\";\nimport { kebabCase } from \"change-case\";\nimport { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { GenerateSubgraphArgs } from \"../types.js\";\nimport { installAddedDependencies } from \"../utils/install-added-dependencies.js\";\nimport { resolveModuleDirName } from \"../utils/module-dir.js\";\nimport { warnSubgraphTypeConflicts } from \"../utils/warn-subgraph-type-conflicts.js\";\n\nconst INDEX_FILE_EXPECTATION = {\n \"schema-first\": \"a class extending BaseSubgraph with a string literal `name`\",\n \"code-first\":\n \"a class extending Subgraph with a string literal `static subgraphName`\",\n} satisfies Record<SubgraphStyle, string>;\n\nasync function assertSubgraphNameFree(projectDir: string, name: string) {\n const conflict = await findSubgraphNameConflict(projectDir, name);\n if (conflict) throw new Error(conflict);\n}\n\n/** The notice for `--code-first` on an existing schema-first subgraph, which\n * is then left unchanged. */\nfunction codeFirstOnSchemaFirst(\n args: GenerateSubgraphArgs,\n projectDir: string,\n name: string,\n): string | undefined {\n if (!args.codeFirst) return undefined;\n const subgraphsDir = join(projectDir, \"subgraphs\");\n const dirName = kebabCase(name);\n if (\n !existsSync(join(subgraphsDir, dirName, \"index.ts\")) ||\n subgraphDirStyle(subgraphsDir, dirName) !== \"schema-first\"\n )\n return undefined;\n return `subgraphs/${dirName} is schema-first; --code-first only applies to new subgraphs. To convert it, run ph migrate --subgraph ${dirName}.`;\n}\n\nexport async function startGenerateSubgraph(\n args: GenerateSubgraphArgs,\n projectDir: string,\n) {\n const { name, document, dir, all, extract, debug } = args;\n if (debug) {\n console.log({ args });\n }\n const project = buildTsMorphProject(projectDir);\n if (extract) {\n const docs = extractSubgraphDocuments(project);\n if (docs.length === 0) {\n console.log(\"No subgraphs found in subgraphs/.\");\n }\n for (const doc of docs) {\n const path = await saveSpec(doc, projectDir);\n console.log(`Wrote ${path}`);\n }\n return;\n }\n const report: string[] = [];\n if (all) {\n const { subgraphNames, unreadableDirs } =\n await generateAllSubgraphs(project);\n if (subgraphNames.length === 0 && unreadableDirs.length === 0) {\n report.push(\"No subgraphs found in subgraphs/.\");\n }\n for (const subgraphName of subgraphNames) {\n report.push(`Regenerated subgraph \"${subgraphName}\"`);\n }\n for (const dirName of unreadableDirs) {\n console.warn(\n `Skipped subgraphs/${dirName}: expected its index.ts to export ${INDEX_FILE_EXPECTATION[subgraphDirStyle(join(projectDir, \"subgraphs\"), dirName)]}. Kept the manifest's subgraphs.`,\n );\n }\n } else if (document) {\n const doc = (await getDocument(document)) as SubgraphModuleDocument;\n const notice = codeFirstOnSchemaFirst(\n args,\n projectDir,\n doc.state.global.name,\n );\n if (notice) {\n console.log(notice);\n return;\n }\n await assertSubgraphNameFree(projectDir, doc.state.global.name);\n await generateSubgraphFromDocument(doc, project, {\n codeFirst: args.codeFirst,\n });\n } else if (name) {\n const notice = codeFirstOnSchemaFirst(args, projectDir, name);\n if (notice) {\n console.log(notice);\n return;\n }\n await assertSubgraphNameFree(projectDir, name);\n await generateSubgraph(name, project, { codeFirst: args.codeFirst });\n } else if (dir) {\n const dirName = resolveModuleDirName(\n projectDir,\n \"subgraphs\",\n dir,\n \"my-subgraph\",\n );\n if (!existsSync(join(projectDir, \"subgraphs\", dirName, \"index.ts\"))) {\n throw new Error(`subgraphs/${dirName} has no index.ts.`);\n }\n const { subgraphName, style } = await generateSubgraphDir(dirName, project);\n if (!subgraphName) {\n throw new Error(\n `Could not read subgraphs/${dirName}/index.ts: expected ${INDEX_FILE_EXPECTATION[style]}.`,\n );\n }\n report.push(`Regenerated subgraph \"${subgraphName}\"`);\n } else {\n console.log(\n \"Please specify one of `name`, `document`, `dir`, `all`, or `extract`.\",\n );\n return;\n }\n await project.save();\n for (const line of report) {\n console.log(line);\n }\n await warnSubgraphTypeConflicts(projectDir);\n const added = await syncFeatureDependencies(\n detectFeatures(projectDir),\n projectDir,\n );\n await installAddedDependencies(added, projectDir, args.skipInstall);\n}\n"],"names":["installAddedDependencies"],"mappings":";;;;;;;;;;;;AA4BA,MAAM,yBAAyB;CAC7B,gBAAgB;CAChB,cACE;AACJ;AAEA,eAAe,uBAAuB,YAAoB,MAAc;CACtE,MAAM,WAAW,MAAM,yBAAyB,YAAY,IAAI;CAChE,IAAI,UAAU,MAAM,IAAI,MAAM,QAAQ;AACxC;;;AAIA,SAAS,uBACP,MACA,YACA,MACoB;CACpB,IAAI,CAAC,KAAK,WAAW,OAAO,KAAA;CAC5B,MAAM,eAAe,KAAK,YAAY,WAAW;CACjD,MAAM,UAAU,UAAU,IAAI;CAC9B,IACE,CAAC,WAAW,KAAK,cAAc,SAAS,UAAU,CAAC,KACnD,iBAAiB,cAAc,OAAO,MAAM,gBAE5C,OAAO,KAAA;CACT,OAAO,aAAa,QAAQ,yGAAyG,QAAQ;AAC/I;AAEA,eAAsB,sBACpB,MACA,YACA;CACA,MAAM,EAAE,MAAM,UAAU,KAAK,KAAK,SAAS,UAAU;CACrD,IAAI,OACF,QAAQ,IAAI,EAAE,KAAK,CAAC;CAEtB,MAAM,UAAU,oBAAoB,UAAU;CAC9C,IAAI,SAAS;EACX,MAAM,OAAO,yBAAyB,OAAO;EAC7C,IAAI,KAAK,WAAW,GAClB,QAAQ,IAAI,mCAAmC;EAEjD,KAAK,MAAM,OAAO,MAAM;GACtB,MAAM,OAAO,MAAM,SAAS,KAAK,UAAU;GAC3C,QAAQ,IAAI,SAAS,MAAM;EAC7B;EACA;CACF;CACA,MAAM,SAAmB,CAAC;CAC1B,IAAI,KAAK;EACP,MAAM,EAAE,eAAe,mBACrB,MAAM,qBAAqB,OAAO;EACpC,IAAI,cAAc,WAAW,KAAK,eAAe,WAAW,GAC1D,OAAO,KAAK,mCAAmC;EAEjD,KAAK,MAAM,gBAAgB,eACzB,O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,2BAAyB,OAAO,YAAY,KAAK,WAAW;AACpE","debug_id":"57f37708-e436-5415-9747-38ee27ce7f15"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-rtMGg307.mjs","sources":["../src/services/mcp.ts"],"sourcesContent":["import { Client } from \"@modelcontextprotocol/sdk/client/index.js\";\nimport {\n StreamableHTTPClientTransport,\n StreamableHTTPError,\n} from \"@modelcontextprotocol/sdk/client/streamableHttp.js\";\nimport { InMemoryTransport } from \"@modelcontextprotocol/sdk/inMemory.js\";\nimport { Server } from \"@modelcontextprotocol/sdk/server/index.js\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport {\n CallToolRequestSchema,\n CallToolResultSchema,\n ListResourcesRequestSchema,\n ListResourceTemplatesRequestSchema,\n ListToolsRequestSchema,\n McpError,\n ReadResourceRequestSchema,\n type CallToolRequest,\n type CallToolResult,\n type Tool,\n} from \"@modelcontextprotocol/sdk/types.js\";\nimport type { IReactorClient } from \"@powerhousedao/reactor\";\nimport { createServer } from \"@powerhousedao/reactor-mcp\";\nimport { resolveSwitchboardPortDefault } from \"@powerhousedao/shared/clis/args\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { getVersion } from \"../get-version.js\";\nimport {\n ensureVetra,\n restartVetra,\n currentPhCliRunVetraCommand,\n VetraStartError,\n type EnsureVetraOptions,\n type VetraCommand,\n} from \"../utils/vetra-launcher.js\";\nimport {\n readVetraRuntime,\n type VetraRuntimeRecord,\n} from \"../utils/vetra-runtime.js\";\n\nconst CALL_TIMEOUT_MS = 10 * 60_000;\nconst CONFIG_FILE = \"powerhouse.config.json\";\n\nexport type McpLauncherOptions = {\n projectDir?: string;\n startTimeoutSeconds: number;\n /** Test seam: what starts Vetra; defaults to {@link currentPhCliRunVetraCommand}. */\n vetraCommand?: VetraCommand;\n};\n\n/** The nearest directory at or above `start` holding powerhouse.config.json. */\nexport function findProjectDir(start: string): string | undefined {\n let dir = path.resolve(start);\n for (;;) {\n if (fs.existsSync(path.join(dir, CONFIG_FILE))) return dir;\n const parent = path.dirname(dir);\n if (parent === dir) return undefined;\n dir = parent;\n }\n}\n\n// The tool list never touches the reactor, so a client that throws on use is enough.\nconst reactorlessClient = new Proxy({} as IReactorClient, {\n get(_target, property) {\n if (property === \"then\") return undefined;\n return () => {\n throw new Error(\"reactor-mcp's local tool list has no reactor\");\n };\n },\n});\n\n/** reactor-mcp's own server, in-process, for the tool list and resources. */\nasync function connectLocalReactorMcp(): Promise<Client> {\n const server = await createServer({ client: reactorlessClient });\n const [clientSide, serverSide] = InMemoryTransport.createLinkedPair();\n await server.connect(serverSide);\n const client = new Client({ name: \"ph-mcp\", version: getVersion() });\n await client.connect(clientSide);\n return client;\n}\n\nfunction toolError(message: string): CallToolResult {\n return { isError: true, content: [{ type: \"text\", text: message }] };\n}\n\n/** The call never reached a live session: Vetra is down, or restarted since. */\nfunction isStaleConnection(error: unknown): boolean {\n if (error instanceof StreamableHTTPError) {\n return error.code === 404 || error.code === 400;\n }\n for (let e = error; e instanceof Error; e = e.cause) {\n if ((e as NodeJS.ErrnoException).code === \"ECONNREFUSED\") return true;\n }\n return false;\n}\n\nexport const RESTART_VETRA_TOOL = \"restartVetra\";\n\nconst restartVetraTool: Tool = {\n name: RESTART_VETRA_TOOL,\n description:\n \"Restart this project's Vetra (its Switchboard and Studio) and wait until it is ready. \" +\n \"Use it after a change Vetra reads only at startup, such as the reactor or packages settings \" +\n \"in powerhouse.config.json; Studio restarts by itself for connect.* changes. \" +\n \"Returns the new Connect, Switchboard and MCP URLs.\",\n inputSchema: { type: \"object\", properties: {} },\n outputSchema: {\n type: \"object\",\n properties: {\n pid: { type: \"number\" },\n connectUrl: { type: \"string\" },\n switchboardUrl: { type: \"string\" },\n mcpUrl: { type: \"string\" },\n },\n required: [\"pid\", \"mcpUrl\"],\n },\n};\n\nfunction vetraUrls(record: VetraRuntimeRecord) {\n return {\n pid: record.pid,\n ...(record.connectUrl ? { connectUrl: record.connectUrl } : {}),\n switchboardUrl:\n record.switchboardUrl ??\n `http://localhost:${record.switchboardPort}/graphql`,\n mcpUrl: record.mcpUrl || `http://localhost:${record.switchboardPort}/mcp`,\n };\n}\n\nfunction projectName(projectDir: string): string | undefined {\n try {\n const pkg = JSON.parse(\n fs.readFileSync(path.join(projectDir, \"package.json\"), \"utf8\"),\n ) as { name?: string };\n return pkg.name;\n } catch {\n return undefined;\n }\n}\n\n/** Connects to the project's Vetra `/mcp`, starting Vetra when it is down. */\ntype Progress = (message: string) => void;\n\nclass Upstream {\n #client: Promise<Client> | undefined;\n /** The Vetra the client talks to; another pid in the record means it restarted. */\n #pid: number | undefined;\n /** The calls waiting on the connection, told how Vetra's start goes. */\n #waiting = new Set<Progress>();\n\n constructor(\n private readonly projectDir: string | undefined,\n private readonly options: McpLauncherOptions,\n ) {}\n\n get(onProgress?: Progress): Promise<Client> {\n if (this.#client && this.#pid !== undefined && this.projectDir) {\n const pid = readVetraRuntime(this.projectDir)?.pid;\n if (pid !== this.#pid) this.reset();\n }\n this.#client ??= this.#connect(ensureVetra).catch((error: unknown) => {\n this.#client = undefined;\n throw error;\n });\n return this.#waitWith(this.#client, onProgress);\n }\n\n async #waitWith<T>(task: Promise<T>, onProgress?: Progress): Promise<T> {\n if (onProgress) this.#waiting.add(onProgress);\n try {\n return await task;\n } finally {\n if (onProgress) this.#waiting.delete(onProgress);\n }\n }\n\n #report = (message: string) => {\n for (const progress of this.#waiting) progress(message);\n };\n\n reset(): void {\n const stale = this.#client;\n this.#client = undefined;\n this.#pid = undefined;\n void stale?.then((client) => client.close()).catch(() => {});\n }\n\n /** Restarts Vetra and connects to the new one; resolves to its record. */\n async restart(onProgress?: Progress): Promise<VetraRuntimeRecord> {\n this.reset();\n let record: VetraRuntimeRecord | undefined;\n const connected = this.#connect(async (options) => {\n record = await restartVetra(options);\n return record;\n });\n this.#client = connected.catch((error: unknown) => {\n this.#client = undefined;\n throw error;\n });\n await this.#waitWith(this.#client, onProgress);\n return record!;\n }\n\n async #connect(\n start: (options: EnsureVetraOptions) => Promise<VetraRuntimeRecord>,\n ): Promise<Client> {\n const { projectDir } = this;\n if (!projectDir) {\n throw new VetraStartError(\n `No Powerhouse project (${CONFIG_FILE}) at or above ${process.cwd()}. Run \\`ph mcp\\` inside the project, or pass --project-dir.`,\n );\n }\n const name = projectName(projectDir);\n if (!name) {\n throw new VetraStartError(`${projectDir} has no package.json name.`);\n }\n console.error(`[ph mcp] connecting to Vetra for ${name}...`);\n const record = await start({\n projectDir,\n projectName: name,\n switchboardPort: resolveSwitchboardPortDefault(),\n command: this.options.vetraCommand ?? currentPhCliRunVetraCommand(),\n timeoutMs: this.options.startTimeoutSeconds * 1000,\n onProgress: this.#report,\n });\n const { mcpUrl } = vetraUrls(record);\n const client = new Client({ name: \"ph-mcp\", version: getVersion() });\n await client.connect(new StreamableHTTPClientTransport(new URL(mcpUrl)));\n this.#pid = record.pid;\n console.error(`[ph mcp] forwarding tool calls to ${mcpUrl}`);\n return client;\n }\n}\n\nasync function forwardToolCall(\n upstream: Upstream,\n params: CallToolRequest[\"params\"],\n signal: AbortSignal,\n onProgress: Progress,\n): Promise<CallToolResult> {\n for (let attempt = 0; ; attempt++) {\n const client = await upstream.get(onProgress);\n try {\n return await client.request(\n { method: \"tools/call\", params },\n CallToolResultSchema,\n { signal, timeout: CALL_TIMEOUT_MS },\n );\n } catch (error) {\n // It never arrived: Vetra went away or restarted, so find or start it again.\n if (attempt > 0 || !isStaleConnection(error)) throw error;\n upstream.reset();\n }\n }\n}\n\n/** `ph mcp`: tools listed by in-process reactor-mcp, calls forwarded to Vetra (started on first call). */\nexport async function startMcpLauncher(options: McpLauncherOptions) {\n // stdout carries JSON-RPC only.\n console.log = console.error;\n console.info = console.error;\n\n const projectDir = findProjectDir(\n options.projectDir ?? process.env.PH_CALLER_CWD ?? process.cwd(),\n );\n // Port resolution and `ph run vetra` both read the project from the cwd.\n if (projectDir) process.chdir(projectDir);\n\n const local = await connectLocalReactorMcp();\n const upstream = new Upstream(projectDir, options);\n const server = new Server(\n local.getServerVersion() ?? { name: \"reactor-mcp-server\", version: \"\" },\n {\n capabilities: { tools: {}, resources: {} },\n instructions: local.getInstructions(),\n },\n );\n\n server.setRequestHandler(ListToolsRequestSchema, async (request) => {\n const listed = await local.listTools(request.params);\n return { ...listed, tools: [...listed.tools, restartVetraTool] };\n });\n server.setRequestHandler(ListResourcesRequestSchema, (request) =>\n local.listResources(request.params),\n );\n server.setRequestHandler(ListResourceTemplatesRequestSchema, (request) =>\n local.listResourceTemplates(request.params),\n );\n server.setRequestHandler(ReadResourceRequestSchema, (request) =>\n local.readResource(request.params),\n );\n server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {\n // How Vetra's start goes: progress notifications when the client asked, else stderr.\n const token = request.params._meta?.progressToken;\n let progress = 0;\n const onProgress: Progress = (message) => {\n if (token === undefined) {\n console.error(`[ph mcp] ${message}`);\n return;\n }\n void extra\n .sendNotification({\n method: \"notifications/progress\",\n params: { progressToken: token, progress: ++progress, message },\n })\n .catch(() => {});\n };\n try {\n if (request.params.name === RESTART_VETRA_TOOL) {\n const urls = vetraUrls(await upstream.restart(onProgress));\n return {\n content: [{ type: \"text\", text: JSON.stringify(urls) }],\n structuredContent: urls,\n };\n }\n return await forwardToolCall(\n upstream,\n request.params,\n extra.signal,\n onProgress,\n );\n } catch (error) {\n // Protocol errors from reactor-mcp reach the agent as they would over HTTP.\n if (error instanceof McpError) throw error;\n const message = error instanceof Error ? error.message : String(error);\n return toolError(\n error instanceof VetraStartError\n ? message\n : `reactor-mcp request failed: ${message}`,\n );\n }\n });\n\n const transport = new StdioServerTransport();\n transport.onclose = () => process.exit(0);\n process.stdin.once(\"end\", () => process.exit(0));\n await server.connect(transport);\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAuCA,MAAM,kBAAkB;AACxB,MAAM,cAAc;;AAUpB,SAAgB,eAAe,OAAmC;CAChE,IAAI,MAAM,KAAK,QAAQ,KAA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AAE;KAAU;IAAQ;GAChE,CAAC,CAAC,CACD,YAAY,CAAC,CAAC;EACnB;EACA,IAAI;GACF,IAAI,QAAQ,OAAO,SAAA,gBAA6B;IAC9C,MAAM,OAAO,UAAU,MAAM,SAAS,QAAQ,UAAU,CAAC;IACzD,OAAO;KACL,SAAS,CAAC;MAAE,MAAM;MAAQ,MAAM,KAAK,UAAU,IAAI;KAAE,CAAC;KACtD,mBAAmB;IACrB;GACF;GACA,OAAO,MAAM,gBACX,UACA,QAAQ,QACR,MAAM,QACN,UACF;EACF,SAAS,OAAO;GAEd,IAAI,iBAAiB,UAAU,MAAM;GACrC,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;GACrE,OAAO,UACL,iBAAiB,kBACb,UACA,+BAA+B,SACrC;EACF;CACF,CAAC;CAED,MAAM,YAAY,IAAI,qBAAqB;CAC3C,UAAU,gBAAgB,QAAQ,KAAK,CAAC;CACxC,QAAQ,MAAM,KAAK,aAAa,QAAQ,KAAK,CAAC,CAAC;CAC/C,MAAM,OAAO,QAAQ,SAAS;AAChC","debug_id":"5b7c1d09-4ebb-59d8-a6ae-ec4a37dc37b6"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { t as migrateSubgraphs } from "./migrate-subgraphs-_yRnF7xt.mjs";
|
|
2
|
-
export { migrateSubgraphs };
|
|
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]="8cc8312e-20bc-52cf-90f2-21d2444a868d")}catch(e){}}();
|
|
4
|
-
//# debugId=8cc8312e-20bc-52cf-90f2-21d2444a868d
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { t as phCliCommands } from "./ph-cli-commands-FLZClR4x.mjs";
|
|
2
|
-
export { phCliCommands };
|
|
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]="b40cb7b2-2568-50b2-89f1-a95ea0982ebc")}catch(e){}}();
|
|
4
|
-
//# debugId=b40cb7b2-2568-50b2-89f1-a95ea0982ebc
|