@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.
Files changed (100) hide show
  1. package/README.md +6 -5
  2. package/dist/{build-C7RBpPwa.mjs → build-B-rPwjM8.mjs} +6 -6
  3. package/dist/{build-C7RBpPwa.mjs.map → build-B-rPwjM8.mjs.map} +1 -1
  4. package/dist/build-DuwAPWMY.mjs +4 -0
  5. package/dist/{check-1Hfe0lVO.mjs → check-B7C3Vi_b.mjs} +4 -4
  6. package/dist/{check-1Hfe0lVO.mjs.map → check-B7C3Vi_b.mjs.map} +1 -1
  7. package/dist/{check-MBdw9Lbm.mjs → check-DM7UdFTK.mjs} +4 -4
  8. package/dist/{check-MBdw9Lbm.mjs.map → check-DM7UdFTK.mjs.map} +1 -1
  9. package/dist/{check-ClxYRer4.mjs → check-DeUTd514.mjs} +3 -3
  10. package/dist/{cli-connect-override-DsuuectH.mjs → cli-connect-override-Bx_g3-ZE.mjs} +4 -4
  11. package/dist/{cli-connect-override-DsuuectH.mjs.map → cli-connect-override-Bx_g3-ZE.mjs.map} +1 -1
  12. package/dist/cli.mjs +8 -8
  13. package/dist/cli.mjs.map +1 -1
  14. package/dist/{compound-Q9sZSEZF-zZWzQ7VC.mjs → compound-Q9sZSEZF-DQvtoigb.mjs} +4 -4
  15. package/dist/{compound-Q9sZSEZF-zZWzQ7VC.mjs.map → compound-Q9sZSEZF-DQvtoigb.mjs.map} +1 -1
  16. package/dist/{connect-build-DAnGPSF5.mjs → connect-build-CaTxdYcc.mjs} +5 -5
  17. package/dist/{connect-build-DAnGPSF5.mjs.map → connect-build-CaTxdYcc.mjs.map} +1 -1
  18. package/dist/{connect-config-C0QZ7zTf.mjs → connect-config-A-U83U8U.mjs} +4 -4
  19. package/dist/{connect-config-C0QZ7zTf.mjs.map → connect-config-A-U83U8U.mjs.map} +1 -1
  20. package/dist/{connect-studio-BUth3UYP.mjs → connect-studio-B2gugCJU.mjs} +4 -4
  21. package/dist/{connect-studio-BUth3UYP.mjs.map → connect-studio-B2gugCJU.mjs.map} +1 -1
  22. package/dist/definitions-worker.mjs +1 -1
  23. package/dist/dev-host-RhWeATKB.mjs +19 -0
  24. package/dist/dev-host-RhWeATKB.mjs.map +1 -0
  25. package/dist/{dist-CRR5Anp2.mjs → dist-D_UjZsgt.mjs} +4 -4
  26. package/dist/{dist-CRR5Anp2.mjs.map → dist-D_UjZsgt.mjs.map} +1 -1
  27. package/dist/{explain-BfOC7Ngv.mjs → explain-DbbHpa61.mjs} +5 -5
  28. package/dist/{explain-BfOC7Ngv.mjs.map → explain-DbbHpa61.mjs.map} +1 -1
  29. package/dist/{export-CdTqYviH.mjs → export-FduYVQEM.mjs} +4 -4
  30. package/dist/{export-CdTqYviH.mjs.map → export-FduYVQEM.mjs.map} +1 -1
  31. package/dist/{files-D6_euBBn.mjs → files-DEHg350R.mjs} +4 -4
  32. package/dist/{files-D6_euBBn.mjs.map → files-DEHg350R.mjs.map} +1 -1
  33. package/dist/{generate-all-HujZHqCG.mjs → generate-all-BE8UmbJv.mjs} +6 -21
  34. package/dist/generate-all-BE8UmbJv.mjs.map +1 -0
  35. package/dist/{generate-app-hm6CJ_4O.mjs → generate-app-C7n0j8Ak.mjs} +5 -18
  36. package/dist/generate-app-C7n0j8Ak.mjs.map +1 -0
  37. package/dist/{generate-document-model-BiD6ovXc.mjs → generate-document-model-DSYPTMZg.mjs} +9 -31
  38. package/dist/generate-document-model-DSYPTMZg.mjs.map +1 -0
  39. package/dist/{generate-editor-DBj_Pxwa.mjs → generate-editor-DKuRUeIt.mjs} +5 -18
  40. package/dist/generate-editor-DKuRUeIt.mjs.map +1 -0
  41. package/dist/{generate-processor-BVjOsfjJ.mjs → generate-processor-CwJvJDpd.mjs} +5 -18
  42. package/dist/generate-processor-CwJvJDpd.mjs.map +1 -0
  43. package/dist/{generate-subgraph-DJZCr0Tk.mjs → generate-subgraph-EQ2ZjMp9.mjs} +6 -25
  44. package/dist/generate-subgraph-EQ2ZjMp9.mjs.map +1 -0
  45. package/dist/{get-version-DAYhm6MX.mjs → get-version-7oKMD8Gt.mjs} +4 -4
  46. package/dist/{get-version-DAYhm6MX.mjs.map → get-version-7oKMD8Gt.mjs.map} +1 -1
  47. package/dist/{mcp-rtMGg307.mjs → mcp-CcZT9zT9.mjs} +8 -8
  48. package/dist/mcp-CcZT9zT9.mjs.map +1 -0
  49. package/dist/{migrate-CWCJP19Q.mjs → migrate-Ddr7YAtM.mjs} +4 -4
  50. package/dist/{migrate-CWCJP19Q.mjs.map → migrate-Ddr7YAtM.mjs.map} +1 -1
  51. package/dist/{migrate-document-models-DTxM7D7p.mjs → migrate-document-models-X_mVTljj.mjs} +4 -4
  52. package/dist/{migrate-document-models-DTxM7D7p.mjs.map → migrate-document-models-X_mVTljj.mjs.map} +1 -1
  53. package/dist/migrate-subgraphs-DEqWkLoh.mjs +4 -0
  54. package/dist/{migrate-subgraphs-_yRnF7xt.mjs → migrate-subgraphs-Ffwwm7Oy.mjs} +5 -5
  55. package/dist/{migrate-subgraphs-_yRnF7xt.mjs.map → migrate-subgraphs-Ffwwm7Oy.mjs.map} +1 -1
  56. package/dist/{ph-cli-commands-FLZClR4x.mjs → ph-cli-commands-D4Z6YSwd.mjs} +39 -104
  57. package/dist/ph-cli-commands-D4Z6YSwd.mjs.map +1 -0
  58. package/dist/ph-cli-commands-p9cO6MsE.mjs +4 -0
  59. package/dist/{run-sugar-DUiDFl_T.mjs → run-sugar-CkuGJuPg.mjs} +16 -8
  60. package/dist/run-sugar-CkuGJuPg.mjs.map +1 -0
  61. package/dist/{run-sugar-YDxw0iV9.mjs → run-sugar-Dd_Mu058.mjs} +3 -3
  62. package/dist/runners/connect.mjs +2 -2
  63. package/dist/runners/switchboard.mjs +3 -3
  64. package/dist/{sugar-checks-BFu3sfFJ.mjs → sugar-checks-CAtgUIem.mjs} +16 -15
  65. package/dist/sugar-checks-CAtgUIem.mjs.map +1 -0
  66. package/dist/{verify-Dkb6K1fc.mjs → verify-DXrs0JUp.mjs} +5 -5
  67. package/dist/{verify-Dkb6K1fc.mjs.map → verify-DXrs0JUp.mjs.map} +1 -1
  68. package/dist/{vetra-gateway-BMzq0mqX.mjs → vetra-gateway-BHuz7pvS.mjs} +5 -5
  69. package/dist/{vetra-gateway-BMzq0mqX.mjs.map → vetra-gateway-BHuz7pvS.mjs.map} +1 -1
  70. package/dist/vetra-gateway-ag33E_Ta.mjs +4 -0
  71. package/dist/{vetra-host-C37IGwBM.mjs → vetra-host-CYdbd3J3.mjs} +28 -11
  72. package/dist/vetra-host-CYdbd3J3.mjs.map +1 -0
  73. package/dist/{vetra-launcher-Dq0tWyNW.mjs → vetra-launcher-B5L3yXPo.mjs} +16 -13
  74. package/dist/vetra-launcher-B5L3yXPo.mjs.map +1 -0
  75. package/dist/vetra-launcher-BUO9e74r.mjs +4 -0
  76. package/dist/{vetra-instance-CLUzbtbh.mjs → vetra-runtime-Bk6CW-BE.mjs} +6 -24
  77. package/dist/vetra-runtime-Bk6CW-BE.mjs.map +1 -0
  78. package/dist/warn-subgraph-type-conflicts-BZ4NwLx5.mjs +131 -0
  79. package/dist/warn-subgraph-type-conflicts-BZ4NwLx5.mjs.map +1 -0
  80. package/package.json +15 -16
  81. package/dist/build-BUpe1j4m.mjs +0 -4
  82. package/dist/generate-all-HujZHqCG.mjs.map +0 -1
  83. package/dist/generate-app-hm6CJ_4O.mjs.map +0 -1
  84. package/dist/generate-document-model-BiD6ovXc.mjs.map +0 -1
  85. package/dist/generate-editor-DBj_Pxwa.mjs.map +0 -1
  86. package/dist/generate-processor-BVjOsfjJ.mjs.map +0 -1
  87. package/dist/generate-subgraph-DJZCr0Tk.mjs.map +0 -1
  88. package/dist/mcp-rtMGg307.mjs.map +0 -1
  89. package/dist/migrate-subgraphs-DcJjLMFd.mjs +0 -4
  90. package/dist/ph-cli-commands-CRwA1aVX.mjs +0 -4
  91. package/dist/ph-cli-commands-FLZClR4x.mjs.map +0 -1
  92. package/dist/run-sugar-DUiDFl_T.mjs.map +0 -1
  93. package/dist/sugar-checks-BFu3sfFJ.mjs.map +0 -1
  94. package/dist/vetra-gateway-BP6Catg4.mjs +0 -4
  95. package/dist/vetra-host-C37IGwBM.mjs.map +0 -1
  96. package/dist/vetra-instance-CLUzbtbh.mjs.map +0 -1
  97. package/dist/vetra-launcher-CJ01qmS1.mjs +0 -4
  98. package/dist/vetra-launcher-Dq0tWyNW.mjs.map +0 -1
  99. package/dist/warn-subgraph-type-conflicts-BOHBmThq.mjs +0 -19
  100. package/dist/warn-subgraph-type-conflicts-BOHBmThq.mjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"ph-cli-commands-FLZClR4x.mjs","sources":["../src/commands/access-token.ts","../src/commands/build.ts","../src/commands/connect.ts","../src/commands/generate-all.ts","../src/utils/fs-args.ts","../src/utils/comma-separated.ts","../src/commands/generate-app.ts","../src/commands/generate-connect-routes.ts","../src/commands/generate-desktop-shell.ts","../src/commands/generate-document-model.ts","../src/commands/generate-editor.ts","../src/commands/generate-hosts.ts","../src/commands/generate-migration-file.ts","../src/commands/generate-piece-action.ts","../src/commands/generate-piece-trigger.ts","../src/commands/generate-piece.ts","../src/commands/generate-processor.ts","../src/commands/generate-subgraph.ts","../src/commands/generate.ts","../src/commands/host.ts","../src/commands/init.ts","../src/commands/inspect.ts","../src/commands/install.ts","../src/commands/keyframes.ts","../src/commands/list.ts","../src/commands/login.ts","../src/commands/logout.ts","../src/commands/mcp.ts","../src/commands/migrate.ts","../src/commands/model.ts","../src/commands/publish.ts","../src/commands/registry-login.ts","../src/commands/run.ts","../src/commands/uninstall.ts","../src/commands/unpublish.ts","../src/commands/vetra.ts","../src/commands/ph-cli-commands.ts"],"sourcesContent":["import { accessTokenArgs } from \"@powerhousedao/shared/clis/args\";\nimport { DEFAULT_EXPIRY_SECONDS } from \"@powerhousedao/shared/clis/constants\";\nimport { command } from \"cmd-ts\";\n\nexport const accessToken = command({\n name: \"access-token\",\n description: `\nThe access-token command generates a bearer token for API authentication. This token\ncan be used to authenticate requests to Powerhouse APIs like reactor-api (Switchboard).\n\nThis command:\n1. Uses your CLI's cryptographic identity (DID) to sign a verifiable credential\n2. Creates a JWT bearer token with configurable expiration\n3. Outputs the token to stdout (info to stderr) for easy piping\n\nPrerequisites:\n You must have a cryptographic identity. Run 'ph login' first to:\n - Generate a keypair (stored in .ph/.keypair.json)\n - Optionally link your Ethereum address (stored in .ph/.renown.json)\n\nToken Details:\n The generated token is a JWT (JSON Web Token) containing:\n - Issuer (iss): Your CLI's DID (did:key:...)\n - Subject (sub): Your CLI's DID\n - Credential Subject: Chain ID, network ID, and address (if authenticated)\n - Expiration (exp): Based on --expiry option\n - Audience (aud): If --audience is specified\n\nOutput:\n- Token information (DID, address, expiry) is printed to stderr\n- The token itself is printed to stdout for easy piping/copying\n\nThis allows you to use the command in scripts:\n TOKEN=$(ph access-token)\n curl -H \"Authorization: Bearer $TOKEN\" http://localhost:4001/graphql\n\nUsage with APIs:\n Generate token and use with curl\n TOKEN=$(ph access-token --expiry 1d)\n curl -X POST http://localhost:4001/graphql \\\\\n -H \"Content-Type: application/json\" \\\\\n -H \"Authorization: Bearer $TOKEN\" \\\\\n -d '{\"query\": \"{ drives { id name } }\"}'\n\n Export as environment variable\n export PH_ACCESS_TOKEN=$(ph access-token)\n\nNotes:\n - Tokens are self-signed using your CLI's private key\n - No network request is made; tokens are generated locally\n - The recipient API must trust your CLI's DID to accept the token\n - For reactor-api, ensure AUTH_ENABLED=true to require authentication\n`,\n args: accessTokenArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n const { generateAccessToken, parseExpiry, formatExpiry } =\n await import(\"@renown/sdk/node\");\n const { getRenown } = await import(\"../services/auth.js\");\n const renown = await getRenown();\n\n let expiresIn = DEFAULT_EXPIRY_SECONDS;\n if (args.expiry) expiresIn = parseExpiry(args.expiry);\n\n const result = await generateAccessToken(renown, {\n expiresIn,\n aud: args.audience,\n });\n\n // Output token info to stderr, token itself to stdout for piping\n console.error(`CLI DID: ${result.did}`);\n console.error(`ETH Address: ${result.address}`);\n console.error(`Token expires in: ${formatExpiry(expiresIn)}`);\n console.error(\"\");\n\n console.log(result.token);\n process.exit(0);\n },\n});\n","import { buildArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const build = command({\n name: \"build\",\n description: `\nBuild a Powerhouse package for publishing: a browser bundle and a node bundle of its\ndocument models, scalars, editors, subgraphs and processors, type declarations, and its\nstylesheet.\n\nPieces under pieces/ are built too, each into its own self-contained module under\ndist/node/pieces/<name>, with a descriptor.json and package.json written beside it and\nthe piece listed in dist/powerhouse.manifest.json. A piece takes the package's version: an\nentry in pieces/index.ts that declares version fails the build. A package that ships only\npieces is an ordinary package: it carries the same boilerplate, and every step above runs\nfor it too.\n\ntsc runs first. If it reports type errors the build asks whether to go ahead, and stops\nwhere it can't ask. --ignore-type-errors builds without asking; a package built that way\ncan load and still fail at runtime, so don't publish it.`,\n args: buildArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n try {\n const { runBuild } = await import(\"../services/build.js\");\n await runBuild(args, { checkDefinitions: true, ownsProcess: true });\n } catch (error) {\n // The message includes its cause; --debug adds the stack and the cause again.\n console.error(\n args.debug || !(error instanceof Error) ? error : error.message,\n );\n process.exit(1);\n }\n },\n});\n","import { connectConfigArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command, subcommands } from \"cmd-ts\";\n\nexport const config = command({\n name: \"config\",\n description: `Read or update Connect's runtime configuration (powerhouse.config.json).\n\nModes (mutually exclusive — positional, --get, --json, and field flags cannot be combined):\n ph connect config List the effective connect.* block (defaults < source).\n ph connect config <key> Get the value at the dotted path (e.g. ph connect config connect.renown.url).\n ph connect config --get <dotted.path> Same as positional <key> (kept for backward compat).\n ph connect config <key> <value> Set a single field and dual-write to source + dist (positional).\n ph connect config --<field> <value> Set a single field via per-field flag (e.g. --renown-url https://renown.id).\n ph connect config --json '{\"renown\":{\"url\":\"…\"}}'\n Bulk-set multiple fields and dual-write. The payload is the connect.*\n block without the \"connect\" wrapper; unknown keys are rejected.\n\nWrites go to:\n - <project>/powerhouse.config.json (source — picked up by the next build)\n - <dist-dir>/powerhouse.config.json (if it exists — the currently-served SPA picks it up on refresh)\n`,\n args: connectConfigArgs,\n handler: async (args) => {\n const { runConnectConfig } = await import(\"../services/connect-config.js\");\n await runConnectConfig(args);\n },\n});\n\n// `ph connect`, `ph connect studio`, `ph connect build` and\n// `ph connect preview` never reach this command: they are sugar for\n// `ph run connect dev|build|serve` (utils/run-sugar.ts).\nexport const connect = subcommands({\n name: \"connect\",\n description: `Powerhouse Connect. \\`ph connect\\` runs the project's connect host: it is \\`ph run connect dev\\`, as is \\`ph connect studio\\`; \\`ph connect build\\` is \\`ph run connect build\\` and \\`ph connect preview\\` is \\`ph run connect serve\\`. \\`ph connect config\\` reads and writes Connect's runtime configuration.`,\n cmds: {\n config,\n },\n});\n","import { command, flag } from \"cmd-ts\";\n\nexport const generateAllCmd = command({\n name: \"all\",\n description: \"Re-generate all modules in the current project\",\n args: {\n extract: flag({\n long: \"extract\",\n short: \"x\",\n description:\n \"Instead of generating code, write a spec for every module into specs/ (one-shot migration to documents-as-source-of-truth)\",\n }),\n },\n handler: async (args) => {\n const { startGenerateAll } = await import(\"../services/generate-all.js\");\n await startGenerateAll(args, process.cwd());\n process.exit(0);\n },\n});\n","import { extendType, string, type Type } from \"cmd-ts\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\n// cmd-ts's `batteries/fs`, rebuilt on the root entry so bun never loads its CJS build.\n\nconst ExistingPath: Type<string, string> = extendType(string, {\n displayName: \"path\",\n description: \"An existing path\",\n from(str) {\n const resolved = path.resolve(str);\n if (!fs.existsSync(resolved)) {\n return Promise.reject(new Error(\"Path doesn't exist\"));\n }\n return Promise.resolve(resolved);\n },\n});\n\n/** A directory, or the directory of a given file. */\nexport const Directory: Type<string, string> = extendType(ExistingPath, {\n displayName: \"dir\",\n description: \"A path to a directory or a file within a directory\",\n from(resolved) {\n return Promise.resolve(\n fs.statSync(resolved).isDirectory() ? resolved : path.dirname(resolved),\n );\n },\n});\n\n/** An existing file. */\nexport const File: Type<string, string> = extendType(ExistingPath, {\n displayName: \"file\",\n description: \"A file in the file system\",\n from(resolved) {\n if (!fs.statSync(resolved).isFile()) {\n return Promise.reject(new Error(\"Provided path is not a file\"));\n }\n return Promise.resolve(resolved);\n },\n});\n\n/** A module's directory name or path, resolved by the command against the project. */\nexport const ModuleDir: Type<string, string> = extendType(string, {\n displayName: \"dir\",\n description: \"A module's directory name or path\",\n from: (dir) => Promise.resolve(dir),\n});\n","import type { Type } from \"cmd-ts\";\n\n/** Splits comma-separated values so `-t \"a,b\"` means the same as `-t a -t b`\n * instead of yielding the single value `\"a,b\"`, which matches nothing. */\nexport function splitCommaSeparated(values: string[]): string[] {\n return values\n .flatMap((value) => value.split(\",\"))\n .map((value) => value.trim())\n .filter((value) => value.length > 0);\n}\n\n/** `multioption` type accepting repeated and/or comma-separated values. */\nexport const CommaSeparatedStrings: Type<string[], string[]> = {\n from: (values) => Promise.resolve(splitCommaSeparated(values)),\n};\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport {\n boolean,\n command,\n flag,\n multioption,\n option,\n optional,\n string,\n} from \"cmd-ts\";\nimport { File, ModuleDir } from \"../utils/fs-args.js\";\nimport { CommaSeparatedStrings } from \"../utils/comma-separated.js\";\n\nexport const generateAppCmd = command({\n name: \"app\",\n description: \"Generate a drive app\",\n args: {\n name: option({\n type: optional(string),\n long: \"name\",\n short: \"n\",\n description: \"The name of the drive app to generate\",\n }),\n allowedDocumentTypes: multioption({\n type: optional(CommaSeparatedStrings),\n long: \"document-types\",\n short: \"t\",\n description:\n \"The document types allowed by the new app (repeatable or comma-separated)\",\n }),\n document: option({\n type: optional(File),\n long: \"document\",\n short: \"d\",\n description:\n \"Path to a powerhouse/app spec file (.phd or .json) to drive codegen\",\n }),\n dir: option({\n type: optional(ModuleDir),\n long: \"dir\",\n description:\n \"Name of the directory of an existing app to re-generate (my-app or editors/my-app)\",\n }),\n disableDragAndDrop: flag({\n type: boolean,\n long: \"disable-drag-and-drop\",\n description: \"Do not allow drag and drop in this drive app.\",\n defaultValue: () => false as const,\n defaultValueIsSerializable: true,\n }),\n all: flag({\n long: \"all\",\n short: \"a\",\n description: \"Re-generate all existing apps in the current project\",\n }),\n extract: flag({\n long: \"extract\",\n short: \"x\",\n description:\n \"Write a powerhouse/app spec for each existing drive app into specs/apps/\",\n }),\n ...debugArgs,\n },\n handler: async (args) => {\n const { startGenerateApp } = await import(\"../services/generate-app.js\");\n await startGenerateApp(args, process.cwd());\n process.exit(0);\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const generateConnectRoutesCmd = command({\n name: \"connect-routes\",\n description:\n \"Generate .ph/connect-routes.gen.ts, the route tree hosts/connect/routes/ type-checks against, and fail if a route the package offers imports @powerhousedao/connect\",\n args: { ...debugArgs },\n handler: async () => {\n const { syncProjectConnectRoutes } =\n await import(\"../utils/sync-connect-routes.js\");\n const { checkOfferedRoutesImports } =\n await import(\"../utils/offered-routes-imports.js\");\n await syncProjectConnectRoutes(process.cwd());\n // npm run tsc and lint run this first: they fail where `ph build` would.\n await checkOfferedRoutesImports(process.cwd());\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command, flag, option, optional, string } from \"cmd-ts\";\n\nexport const generateDesktopShellCmd = command({\n name: \"desktop-shell\",\n description:\n \"Scaffold a builder-owned desktop identity (hosts/desktop/app.json + icon). \" +\n \"`ph run desktop dev|build` then projects it into a native Tauri shell — no Rust.\",\n args: {\n name: option({\n type: optional(string),\n long: \"name\",\n short: \"n\",\n description:\n \"Product name (window title + macOS app name). Default: the project's package name.\",\n }),\n identifier: option({\n type: optional(string),\n long: \"identifier\",\n short: \"i\",\n description:\n \"Reverse-DNS app identifier, e.g. com.acme.app. Default: inc.powerhouse.desktop.<project>.\",\n }),\n force: flag({\n long: \"force\",\n short: \"f\",\n description:\n \"Overwrite an existing app.json (protects edits by default).\",\n }),\n ...debugArgs,\n },\n handler: async (args) => {\n const { startGenerateDesktopShell } =\n await import(\"../services/generate-desktop-shell.js\");\n startGenerateDesktopShell(args, process.cwd());\n process.exit(0);\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command, flag, option, optional, string } from \"cmd-ts\";\nimport { File, ModuleDir } from \"../utils/fs-args.js\";\nexport const generateDocumentModelCmd = command({\n name: \"document-model\",\n aliases: [\"doc\"],\n description: \"Generate a document model\",\n args: {\n document: option({\n type: optional(File),\n long: \"document\",\n short: \"d\",\n description:\n \"Path to a document model spec (.phd or .json) to generate from\",\n }),\n dir: option({\n type: optional(ModuleDir),\n long: \"dir\",\n description:\n \"Name of the directory of an existing document model to re-generate (my-document-model or document-models/my-document-model)\",\n }),\n all: flag({\n long: \"all\",\n short: \"a\",\n description:\n \"Re-generate all existing document models in the current project\",\n }),\n extract: flag({\n long: \"extract\",\n short: \"x\",\n description:\n \"Write a powerhouse/document-model spec for each existing document model into specs/document-models/\",\n }),\n /** @experimental Code-first scaffolding is being tested in production. */\n name: option({\n type: optional(string),\n long: \"name\",\n short: \"n\",\n description:\n \"Experimental. Create a code-first document model with this name, with its editor\",\n }),\n /** @experimental Chooses code-first authoring for the model --name creates. */\n codeFirst: flag({\n long: \"code-first\",\n description:\n \"Experimental. With --name, create the model code-first. Existing models of both styles are discovered without it; ph migrate --document-model converts a schema-first one\",\n }),\n ...debugArgs,\n },\n handler: async (args) => {\n const { startGenerateDocumentModel } =\n await import(\"../services/generate-document-model.js\");\n await startGenerateDocumentModel(args, process.cwd());\n process.exit(0);\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command, flag, option, optional, string } from \"cmd-ts\";\nimport { File, ModuleDir } from \"../utils/fs-args.js\";\n\nexport const generateEditorCmd = command({\n name: \"editor\",\n description: \"Generate a document editor\",\n args: {\n name: option({\n type: optional(string),\n long: \"name\",\n short: \"n\",\n description: \"The name of the document editor to generate\",\n }),\n documentType: option({\n type: optional(string),\n long: \"document-type\",\n short: \"t\",\n description: \"The document type for the new editor\",\n }),\n document: option({\n type: optional(File),\n long: \"document\",\n short: \"d\",\n description:\n \"Path to a powerhouse/document-editor spec file (.phd or .json) to drive codegen\",\n }),\n dir: option({\n type: optional(ModuleDir),\n long: \"dir\",\n description:\n \"Name of the directory of an existing editor to re-generate (my-editor or editors/my-editor)\",\n }),\n all: flag({\n long: \"all\",\n short: \"a\",\n description: \"Re-generate all existing editors in the current project\",\n }),\n extract: flag({\n long: \"extract\",\n short: \"x\",\n description:\n \"Write a powerhouse/document-editor spec for each existing editor into specs/editors/\",\n }),\n ...debugArgs,\n },\n handler: async (args) => {\n const { startGenerateEditor } =\n await import(\"../services/generate-editor.js\");\n await startGenerateEditor(args, process.cwd());\n process.exit(0);\n },\n});\n","import { command } from \"cmd-ts\";\n\nexport const generateHostsCmd = command({\n name: \"hosts\",\n description:\n \"Generate hosts/<name>/outputs.js + outputs.d.ts (typed $output token trees) for every host whose runner declares outputs, and refresh hosts/types.d.ts. Rerun after changing a producer's runner or declared drives: a stale outputs.js fails the load.\",\n args: {},\n handler: async () => {\n const { startGenerateHosts } =\n await import(\"../services/generate-hosts.js\");\n const ok = await startGenerateHosts(process.cwd());\n process.exit(ok ? 0 : 1);\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command, option, optional, string } from \"cmd-ts\";\nimport { skipInstallArgs } from \"../utils/install-added-dependencies.js\";\n\nexport const generateMigrationFileCmd = command({\n name: \"migration-file\",\n description: \"Generate a migration file\",\n args: {\n migrationFile: option({\n type: string,\n long: \"path\",\n short: \"p\",\n description: \"Path to the migration file\",\n }),\n schemaFile: option({\n type: optional(string),\n long: \"schema-file\",\n description: \"Path to the output file. Defaults to './schema.ts'\",\n }),\n ...skipInstallArgs,\n ...debugArgs,\n },\n handler: async (args) => {\n const { startGenerateMigrationFile } =\n await import(\"../services/generate-migration-file.js\");\n await startGenerateMigrationFile(args, process.cwd());\n process.exit(0);\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport {\n command,\n number,\n oneOf,\n option,\n optional,\n positional,\n string,\n} from \"cmd-ts\";\nimport { skipInstallArgs } from \"../utils/install-added-dependencies.js\";\n\nexport const generatePieceActionCmd = command({\n name: \"piece-action\",\n description: \"Generate an action inside an existing piece\",\n args: {\n namePositional: positional({\n type: optional(string),\n displayName: \"name\",\n description: \"The name of the action, e.g. get-record\",\n }),\n name: option({\n type: optional(string),\n long: \"name\",\n short: \"n\",\n description: \"The name of the action to generate\",\n }),\n piece: option({\n type: optional(string),\n long: \"piece\",\n short: \"p\",\n description:\n \"The piece directory under pieces/ to add the action to. Optional when the project ships exactly one piece.\",\n }),\n requireReactor: option({\n type: optional(oneOf([\"read\", \"write\"] as const)),\n long: \"require-reactor\",\n description:\n \"Declare reactor access for the action: read, or write (which includes read). The action then gets context.reactor\",\n }),\n defaultTimeoutSeconds: option({\n type: optional(number),\n long: \"default-timeout-seconds\",\n description:\n \"Write defaultTimeoutSeconds: the step timeout used when the workflow sets none\",\n }),\n defaultMaxAttempts: option({\n type: optional(number),\n long: \"default-max-attempts\",\n description:\n \"Write defaultRetry: { maxAttempts }: the attempts (1 is no retry) used when the workflow sets no retry\",\n }),\n ...skipInstallArgs,\n ...debugArgs,\n },\n handler: async (args) => {\n const { startGeneratePieceAction } =\n await import(\"../services/generate-piece-action.js\");\n await startGeneratePieceAction(args, process.cwd());\n process.exit(0);\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command, oneOf, option, optional, positional, string } from \"cmd-ts\";\nimport { skipInstallArgs } from \"../utils/install-added-dependencies.js\";\n\nexport const generatePieceTriggerCmd = command({\n name: \"piece-trigger\",\n description: \"Generate a trigger inside an existing piece\",\n args: {\n namePositional: positional({\n type: optional(string),\n displayName: \"name\",\n description: \"The name of the trigger, e.g. new-record\",\n }),\n name: option({\n type: optional(string),\n long: \"name\",\n short: \"n\",\n description: \"The name of the trigger to generate\",\n }),\n piece: option({\n type: optional(string),\n long: \"piece\",\n short: \"p\",\n description:\n \"The piece directory under pieces/ to add the trigger to. Optional when the project ships exactly one piece.\",\n }),\n strategy: option({\n type: oneOf([\"polling\", \"webhook\"] as const),\n long: \"strategy\",\n description:\n \"How the trigger fires: polled on a schedule, or delivered to a webhook\",\n defaultValue: () => \"polling\" as const,\n defaultValueIsSerializable: true,\n }),\n requireReactor: option({\n type: optional(oneOf([\"read\", \"write\"] as const)),\n long: \"require-reactor\",\n description:\n \"Declare reactor access for the trigger: read, or write (which includes read). Its hooks then get context.reactor\",\n }),\n ...skipInstallArgs,\n ...debugArgs,\n },\n handler: async (args) => {\n const { startGeneratePieceTrigger } =\n await import(\"../services/generate-piece-trigger.js\");\n await startGeneratePieceTrigger(args, process.cwd());\n process.exit(0);\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport {\n command,\n flag,\n oneOf,\n option,\n optional,\n positional,\n string,\n} from \"cmd-ts\";\nimport { ModuleDir } from \"../utils/fs-args.js\";\nimport { skipInstallArgs } from \"../utils/install-added-dependencies.js\";\n\nexport const generatePieceCmd = command({\n name: \"piece\",\n description:\n \"Generate a piece: a connector whose actions and triggers a workflow can call\",\n args: {\n namePositional: positional({\n type: optional(string),\n displayName: \"name\",\n description:\n \"The name of the piece to generate. Its directory is the kebab-case of this.\",\n }),\n name: option({\n type: optional(string),\n long: \"name\",\n short: \"n\",\n description: \"The name of the piece to generate\",\n }),\n id: option({\n type: optional(string),\n long: \"id\",\n description:\n \"The piece id, the pieceName a workflow step holds, e.g. @acme/piece-crm. Defaults to one derived from the package name.\",\n }),\n auth: option({\n type: oneOf([\"none\", \"secret\", \"custom\"] as const),\n long: \"auth\",\n description: \"The kind of connection the piece asks for\",\n defaultValue: () => \"custom\" as const,\n defaultValueIsSerializable: true,\n }),\n description: option({\n type: optional(string),\n long: \"description\",\n description: \"One line describing what the piece connects to\",\n }),\n dir: option({\n type: optional(ModuleDir),\n long: \"dir\",\n description:\n \"Name of the directory of an existing piece to re-register (my-piece or pieces/my-piece)\",\n }),\n all: flag({\n long: \"all\",\n short: \"a\",\n description:\n \"Re-register every piece in pieces/: refresh the pieces list and the manifest, and prune what is gone\",\n }),\n ...skipInstallArgs,\n ...debugArgs,\n },\n handler: async (args) => {\n const { startGeneratePiece } =\n await import(\"../services/generate-piece.js\");\n await startGeneratePiece(args, process.cwd());\n process.exit(0);\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport { PROCESSOR_APPS } from \"@powerhousedao/shared/processors\";\nimport type { Type } from \"cmd-ts\";\nimport {\n command,\n flag,\n multioption,\n oneOf,\n option,\n optional,\n string,\n} from \"cmd-ts\";\nimport { File, ModuleDir } from \"../utils/fs-args.js\";\nimport {\n CommaSeparatedStrings,\n splitCommaSeparated,\n} from \"../utils/comma-separated.js\";\nimport { skipInstallArgs } from \"../utils/install-added-dependencies.js\";\n\nconst ProcessorAppType: Type<string[], (\"connect\" | \"switchboard\")[]> = {\n from(rawProcessorApps) {\n const processorApps = splitCommaSeparated(rawProcessorApps);\n if (processorApps.length === 0) {\n throw new Error(\n `No arguments provided for processor apps. Must be \"connect\" and/or \"switchboard\"`,\n );\n }\n if (processorApps.length > 2) {\n throw new Error(\n `Too many arguments provided for processor apps. Must be \"connect\" and/or \"switchboard\"`,\n );\n }\n const allowed = new Set(PROCESSOR_APPS);\n if (\n !processorApps.every((p) => allowed.has(p as \"connect\" | \"switchboard\"))\n ) {\n throw new Error(\n `Processor apps can only be \"connect\" and/or \"switchboard\".`,\n );\n }\n return Promise.resolve(processorApps as (\"connect\" | \"switchboard\")[]);\n },\n};\nexport const generateProcessorCmd = command({\n name: \"processor\",\n description: \"Generate a processor\",\n args: {\n name: option({\n type: optional(string),\n long: \"name\",\n short: \"n\",\n description: \"The name of the processor to generate\",\n }),\n type: option({\n type: oneOf([\"analytics\", \"relationalDb\"] as const),\n long: \"type\",\n description: \"The type of processor to generate\",\n defaultValue: () => \"analytics\" as const,\n defaultValueIsSerializable: true,\n }),\n documentTypes: multioption({\n type: CommaSeparatedStrings,\n long: \"document-types\",\n short: \"t\",\n description:\n \"The document types the processor will run on (repeatable or comma-separated)\",\n defaultValue: () => [],\n defaultValueIsSerializable: true,\n }),\n apps: multioption({\n long: \"apps\",\n type: ProcessorAppType,\n description:\n \"Whether the processor will run in switchboard (nodejs), connect (browser), or both\",\n defaultValue: () => [\"switchboard\" as const, \"connect\" as const],\n defaultValueIsSerializable: true,\n }),\n document: option({\n type: optional(File),\n long: \"document\",\n short: \"d\",\n description:\n \"Path to a powerhouse/processor spec file (.phd or .json) to drive codegen\",\n }),\n dir: option({\n type: optional(ModuleDir),\n long: \"dir\",\n description:\n \"Name of the directory of an existing processor to re-generate (my-processor or processors/my-processor)\",\n }),\n all: flag({\n long: \"all\",\n short: \"a\",\n description: \"Re-generate all existing processors in the current project\",\n }),\n extract: flag({\n long: \"extract\",\n short: \"x\",\n description:\n \"Write a powerhouse/processor spec for each existing processor into specs/processors/\",\n }),\n ...skipInstallArgs,\n ...debugArgs,\n },\n handler: async (args) => {\n const { startGenerateProcessor } =\n await import(\"../services/generate-processor.js\");\n await startGenerateProcessor(args, process.cwd());\n process.exit(0);\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command, flag, option, optional, string } from \"cmd-ts\";\nimport { File, ModuleDir } from \"../utils/fs-args.js\";\nimport { skipInstallArgs } from \"../utils/install-added-dependencies.js\";\n\nexport const generateSubgraphCmd = command({\n name: \"subgraph\",\n description: \"Generate a subgraph\",\n args: {\n name: option({\n type: optional(string),\n long: \"name\",\n short: \"n\",\n description: \"The name of the subgraph to generate\",\n }),\n document: option({\n type: optional(File),\n long: \"document\",\n short: \"d\",\n description:\n \"Path to a powerhouse/subgraph spec file (.phd or .json) to drive codegen\",\n }),\n dir: option({\n type: optional(ModuleDir),\n long: \"dir\",\n description:\n \"Name of the directory of an existing subgraph to re-generate (my-subgraph or subgraphs/my-subgraph)\",\n }),\n all: flag({\n long: \"all\",\n short: \"a\",\n description: \"Re-generate all existing subgraphs in the current project\",\n }),\n extract: flag({\n long: \"extract\",\n short: \"x\",\n description:\n \"Write a powerhouse/subgraph spec for each existing subgraph into specs/subgraphs/\",\n }),\n /** @experimental */\n codeFirst: flag({\n long: \"code-first\",\n description:\n \"Experimental. With --name or --document, create a new subgraph code-first. Existing subgraphs keep their own style; ph migrate --subgraph converts one\",\n }),\n ...skipInstallArgs,\n ...debugArgs,\n },\n handler: async (args) => {\n const { startGenerateSubgraph } =\n await import(\"../services/generate-subgraph.js\");\n await startGenerateSubgraph(args, process.cwd());\n process.exit(0);\n },\n});\n","import { subcommands } from \"cmd-ts\";\nimport { generateAllCmd } from \"./generate-all.js\";\nimport { generateAppCmd } from \"./generate-app.js\";\nimport { generateConnectRoutesCmd } from \"./generate-connect-routes.js\";\nimport { generateDesktopShellCmd } from \"./generate-desktop-shell.js\";\nimport { generateDocumentModelCmd } from \"./generate-document-model.js\";\nimport { generateEditorCmd } from \"./generate-editor.js\";\nimport { generateHostsCmd } from \"./generate-hosts.js\";\nimport { generateMigrationFileCmd } from \"./generate-migration-file.js\";\nimport { generatePieceActionCmd } from \"./generate-piece-action.js\";\nimport { generatePieceTriggerCmd } from \"./generate-piece-trigger.js\";\nimport { generatePieceCmd } from \"./generate-piece.js\";\nimport { generateProcessorCmd } from \"./generate-processor.js\";\nimport { generateSubgraphCmd } from \"./generate-subgraph.js\";\n\n/** Exported for tests. */\nexport const generateCmds = {\n all: generateAllCmd,\n \"document-model\": generateDocumentModelCmd,\n editor: generateEditorCmd,\n app: generateAppCmd,\n processor: generateProcessorCmd,\n subgraph: generateSubgraphCmd,\n piece: generatePieceCmd,\n \"piece-action\": generatePieceActionCmd,\n \"piece-trigger\": generatePieceTriggerCmd,\n \"migration-file\": generateMigrationFileCmd,\n \"connect-routes\": generateConnectRoutesCmd,\n \"desktop-shell\": generateDesktopShellCmd,\n hosts: generateHostsCmd,\n} as const;\n\nexport const generate = subcommands({\n name: \"generate\",\n description: `The generate command creates code for Powerhouse modules. It helps you create new code from scratch, or to re-generate existing code in your project.`,\n cmds: generateCmds,\n});\n","import { hostCheckArgs, hostExportArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command, subcommands } from \"cmd-ts\";\n\nexport const check = command({\n name: \"check\",\n description:\n \"Check a host the way `ph run` would, without starting it: every load, \" +\n \"validation, resolution and boot issue, grouped by host file. Exits 1 \" +\n \"on any issue. `--env <file>` checks against that file alone.\",\n args: hostCheckArgs,\n handler: async (args) => {\n const { runHostCheck } = await import(\"../services/host/check.js\");\n const { output, exitCode } = await runHostCheck(args);\n console.log(output);\n // Not process.exit: on macOS a piped stdout is async and would be cut.\n process.exitCode = exitCode;\n },\n});\n\n// `export` is a reserved word.\nexport const exportCmd = command({\n name: \"export\",\n description:\n \"Print a host as declared, with every member a compound names, as JSON \" +\n \"(tokens unresolved). `--out` writes it to a file instead.\",\n args: hostExportArgs,\n handler: async (args) => {\n const { runHostExport } = await import(\"../services/host/export.js\");\n const { stdout, stderr, exitCode } = await runHostExport(args);\n if (stdout !== undefined) process.stdout.write(stdout);\n if (stderr !== undefined) process.stderr.write(stderr);\n process.exitCode = exitCode;\n },\n});\n\nexport const host = subcommands({\n name: \"host\",\n description: \"Inspect the project's hosts/: `check`, `export`.\",\n cmds: { check, export: exportCmd },\n});\n","import { initArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const init = command({\n name: \"init\",\n description: \"Initialize a new project\",\n args: initArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log({ args });\n }\n const { startInit } = await import(\"../services/init.js\");\n await startInit(args);\n process.exit(0);\n },\n});\n","import { inspectArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const inspect = command({\n name: \"inspect\",\n description: `\nThe inspect command examines and provides detailed information about a Powerhouse package.\nIt helps you understand the structure, dependencies, and configuration of packages in\nyour project.\n\nThis command:\n1. Analyzes the specified package\n2. Retrieves detailed information about its structure and configuration\n3. Displays package metadata, dependencies, and other relevant information\n4. Helps troubleshoot package-related issues`,\n aliases: [\"is\"],\n args: inspectArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n const { startInspect } = await import(\"../services/inspect.js\");\n startInspect(args);\n process.exit(0);\n },\n});\n","import { installArgs } from \"@powerhousedao/shared/clis/args\";\nimport { execSync } from \"child_process\";\nimport { command } from \"cmd-ts\";\n\nconst MANIFEST_TIMEOUT_MS = 10_000;\n\n// The external packages a registry package's manifest lists; none when unreadable.\nexport async function fetchExternalDependencies(\n registryUrl: string,\n dependency: { name: string; version?: string },\n): Promise<string[]> {\n const base = registryUrl.endsWith(\"/\") ? registryUrl : `${registryUrl}/`;\n const spec = dependency.version\n ? `${dependency.name}@${dependency.version}`\n : dependency.name;\n try {\n const response = await fetch(\n `${base}-/cdn/${spec}/powerhouse.manifest.json`,\n { signal: AbortSignal.timeout(MANIFEST_TIMEOUT_MS) },\n );\n if (!response.ok) return [];\n const manifest = (await response.json()) as {\n externalDependencies?: unknown;\n };\n const external = manifest.externalDependencies;\n return typeof external === \"object\" && external !== null\n ? Object.keys(external).sort()\n : [];\n } catch {\n return [];\n }\n}\n\nexport async function warnAboutExternalDependencies(\n registryUrl: string,\n dependencies: { name: string; version?: string }[],\n): Promise<void> {\n // Fetched together: each manifest may take the whole timeout.\n const found = await Promise.all(\n dependencies.map((dependency) =>\n fetchExternalDependencies(registryUrl, dependency),\n ),\n );\n for (const [i, dependency] of dependencies.entries()) {\n const external = found[i];\n if (external.length === 0) continue;\n console.warn(\n `⚠ ${dependency.name}: its subgraphs and processors need packages with native addons or WebAssembly modules (${external.join(\", \")}) ` +\n `and only run when the package is installed locally: ph install --local ${dependency.name}\\n` +\n ` Its pieces work either way.`,\n );\n }\n}\n\nexport const install = command({\n name: \"install\",\n aliases: [\"add\", \"i\"],\n description: `\nThe install command adds Powerhouse dependencies to your project.\n\nBy default it only registers the package in powerhouse.config.json with\nprovider \"registry\" — Connect will load it from the registry CDN at runtime.\n\nWith --local, the package is also installed into node_modules and marked\nas provider \"local\" — it will be bundled into ph connect build so the\npreview works without the registry being reachable.\n\nResolution order for the registry URL:\n --registry flag > PH_REGISTRY_URL env > powerhouse.config.json > default\n `,\n args: installArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n const { getPowerhouseProjectInfo, makeDependenciesWithVersions } =\n await import(\"@powerhousedao/shared/clis\");\n\n const {\n projectPath,\n localProjectPath,\n globalProjectPath,\n packageManager,\n isGlobal,\n } = await getPowerhouseProjectInfo(args);\n\n if (!projectPath) {\n throw new Error(`Could not find project path to install from.`);\n }\n\n const { resolveRegistryUrl } =\n await import(\"@powerhousedao/shared/registry\");\n const registryUrl = resolveRegistryUrl({\n registry: args.registry,\n projectPath,\n });\n\n if (args.debug) {\n console.log(\">>> registryUrl\", registryUrl);\n }\n\n const dependenciesWithVersions = await makeDependenciesWithVersions(\n args.dependencies,\n registryUrl,\n );\n\n if (args.debug) {\n console.log(\">>> parsedDependencies\", dependenciesWithVersions);\n console.log(\"\\n>>> projectInfo\", {\n localProjectPath,\n globalProjectPath,\n packageManager,\n isGlobal,\n });\n }\n\n if (args.local) {\n if (dependenciesWithVersions.length === 0) {\n throw new Error(\n \"--local requires at least one package name (e.g. ph install --local @scope/pkg)\",\n );\n }\n try {\n const specs = dependenciesWithVersions.map((d) =>\n d.version ? `${d.name}@${d.version}` : d.name,\n );\n\n // Route only the scopes of the packages being installed to the\n // resolved registry, leaving transitive deps from other scopes\n // (and unscoped packages) on the package manager's default. This\n // avoids requiring a project-level .npmrc when the user already\n // has packageRegistryUrl in powerhouse.config.json.\n const scopes = new Set<string>();\n for (const dep of dependenciesWithVersions) {\n if (dep.name.startsWith(\"@\")) {\n const scope = dep.name.split(\"/\")[0];\n scopes.add(scope);\n }\n }\n const scopeRegistryArgs = Array.from(scopes).map(\n (scope) => `--${scope}:registry=${registryUrl}`,\n );\n\n const minReleaseAgeArgs =\n packageManager === \"pnpm\" ? [\"--config.minimum-release-age=0\"] : [];\n\n const allowBuildArgs =\n packageManager === \"pnpm\" && args.allowBuild.length > 0\n ? [`--allow-build=${args.allowBuild.join(\",\")}`]\n : [];\n\n const { resolveCommand } = await import(\"package-manager-detector\");\n const resolved = resolveCommand(packageManager, \"add\", [\n ...specs,\n ...scopeRegistryArgs,\n ...minReleaseAgeArgs,\n ...allowBuildArgs,\n ]);\n if (!resolved) {\n throw new Error(\n `Failed to resolve install command for package manager \"${packageManager}\".`,\n );\n }\n const installCommand = `${resolved.command} ${resolved.args.join(\" \")}`;\n if (scopeRegistryArgs.length > 0) {\n console.log(\n `Installing dependencies 📦 (routing ${Array.from(scopes).join(\", \")} → ${registryUrl})...`,\n );\n } else {\n console.log(\"Installing dependencies 📦...\");\n }\n console.log(`> ${installCommand}`);\n execSync(installCommand, {\n stdio: \"inherit\",\n cwd: projectPath,\n });\n console.log(\"Dependency installed successfully 🎉\");\n } catch (error) {\n console.error(\"❌ Failed to install dependencies\");\n throw error;\n }\n }\n\n const { updateConfigFile } = await import(\"../utils.js\");\n\n try {\n console.log(\"⚙️ Updating powerhouse config file...\");\n updateConfigFile(\n dependenciesWithVersions,\n projectPath,\n \"install\",\n args.local ? \"local\" : \"registry\",\n registryUrl,\n args.registry !== undefined,\n );\n console.log(\"Config file updated successfully 🎉\");\n } catch (error) {\n console.error(\"❌ Failed to update config file\");\n throw error;\n }\n\n if (args.local) {\n // A local install puts the package in node_modules, skills included.\n const { syncPackageSkills } =\n await import(\"@powerhousedao/codegen/file-builders\");\n for (const { path, action } of await syncPackageSkills(projectPath)) {\n console.log(` ${path}: ${action}`);\n }\n }\n\n if (!args.local) {\n await warnAboutExternalDependencies(\n registryUrl,\n dependenciesWithVersions,\n );\n }\n\n process.exit(0);\n },\n});\n","import { keyframesArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const keyframes = command({\n name: \"keyframes\",\n description: `\nThe keyframes command reports on and cleans up the keyframes of a running switchboard,\nthrough its inspection-admin endpoint.\n\nPrerequisites:\n - The host serves inspection-admin (INSPECTION_ADMIN_ENABLED=true).\n - The caller is one of the host's auth admins.\n - The keep rules are in powerhouse.config.json under reactor.keyframes, or in PH_KEYFRAMES.\n\nRun preview first: it only reads. clean then removes the keyframes past each type's keep\ncount and all keyframes of deleted documents, in small paced statements beside live\ntraffic. Running it again is safe. A later read that misses a keyframe replays from the\noperation log, so a clean-up costs time on cold reads and never changes a document.\n\nThe disk only shrinks after reclaim, which rewrites the Keyframe table once the store is\nquiet. On PGlite the store answers nothing while it rewrites. On Postgres it says what to\nrun by hand.\n`,\n args: keyframesArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n const { runKeyframesCommand } = await import(\"../services/keyframes.js\");\n const exitCode = await runKeyframesCommand(args);\n process.exit(exitCode);\n },\n});\n","import { listArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const list = command({\n name: \"list\",\n description: `\nThe list command displays information about installed Powerhouse packages in your project.\nIt reads the powerhouse.config.json file and shows the packages that are currently installed.\n\nThis command:\n1. Examines your project configuration\n2. Lists all installed Powerhouse packages\n3. Provides a clear overview of your project's dependencies\n4. Helps you manage and track your Powerhouse components\n`,\n aliases: [\"l\"],\n args: listArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n try {\n const { getPowerhouseProjectInfo } =\n await import(\"@powerhousedao/shared/clis\");\n const projectInfo = await getPowerhouseProjectInfo();\n\n const { getConfig } = await import(\"@powerhousedao/config/node\");\n const phConfig = getConfig(\n projectInfo.projectPath + \"/powerhouse.config.json\",\n );\n\n if (!phConfig.packages || phConfig.packages.length === 0) {\n console.log(\"No packages found in the project\");\n return;\n }\n\n console.log(\"Installed Packages:\\n\");\n phConfig.packages.forEach((pkg) => {\n console.log(\n pkg.version ? `${pkg.packageName}@${pkg.version}` : pkg.packageName,\n );\n });\n } catch (_e) {\n console.log(\"No packages found in the project\");\n }\n process.exit(0);\n },\n});\n","import { loginArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const login = command({\n name: \"login\",\n description: `\nThe login command authenticates you with Renown using your Ethereum wallet. This enables\nthe CLI to act on behalf of your Ethereum identity for authenticated operations.\n\nThis command:\n1. Generates or loads a cryptographic identity (DID) for the CLI\n2. Opens your browser to the Renown authentication page\n3. You authorize the CLI's DID to act on behalf of your Ethereum address\n4. Stores the credentials locally in .ph/.renown.json\n `,\n args: loginArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n const { getRenown } = await import(\"../services/auth.js\");\n const renown = await getRenown(args.renownUrl);\n\n if (args.showDid) {\n console.log(renown.did);\n process.exit(0);\n }\n\n if (args.status) {\n const { getAuthStatus } = await import(\"@renown/sdk/node\");\n const status = getAuthStatus(renown);\n if (!status.authenticated || !status.address) {\n console.log(\"Not authenticated with an Ethereum address.\");\n console.log('Run \"ph login\" to authenticate.');\n } else {\n console.log(\"Authenticated\");\n console.log(` ETH Address: ${status.address}`);\n console.log(` User DID: ${status.userDid}`);\n console.log(` Chain ID: ${status.chainId}`);\n console.log(` CLI DID: ${status.cliDid}`);\n console.log(\n ` Authenticated at: ${status.authenticatedAt?.toLocaleString()}`,\n );\n console.log(` Renown URL: ${status.baseUrl}`);\n }\n process.exit(0);\n }\n\n if (args.logout) {\n await handleLogout();\n process.exit(0);\n }\n\n const { browserLogin } = await import(\"@renown/sdk/node\");\n\n console.debug(\"Initializing cryptographic identity...\");\n console.log(`CLI DID: ${renown.did}`);\n\n try {\n const timeoutMs = args.timeout ? args.timeout * 1000 : undefined;\n\n const result = await browserLogin(renown, {\n renownUrl: args.renownUrl,\n timeoutMs,\n onLoginUrl: (url, sessionId) => {\n console.log(\"Opening browser for authentication...\");\n console.log(`Session ID: ${sessionId.slice(0, 8)}...`);\n console.log(`Login URL: ${url}`);\n console.log();\n console.log(\"Waiting for authentication in browser\");\n console.log(`(timeout in ${(timeoutMs ?? 300_000) / 1000} seconds)`);\n console.log();\n console.log(\n \"Please connect your wallet and authorize this CLI to act on your behalf.\",\n );\n console.log();\n process.stdout.write(\"Waiting\");\n },\n onPollTick: () => process.stdout.write(\".\"),\n onBrowserOpenFailed: (url) => {\n console.error(\"Failed to open browser automatically.\");\n console.log(`Please open this URL manually: ${url}`);\n },\n });\n\n console.log(); // New line after dots\n console.log();\n console.log(\"Successfully authenticated!\");\n console.log(` ETH Address: ${result.user.address}`);\n console.log(` User DID: ${result.user.did}`);\n console.log(` CLI DID: ${result.cliDid}`);\n console.log();\n console.log(\"The CLI can now act on behalf of your Ethereum identity.\");\n } catch (error) {\n console.log(); // New line after dots\n throw error;\n }\n\n process.exit(0);\n },\n});\n\nexport async function handleLogout() {\n const { getRenown } = await import(\"../services/auth.js\");\n const renown = await getRenown();\n if (!renown.user) {\n console.log(\"Not currently authenticated.\");\n return;\n }\n\n try {\n await renown.logout();\n console.log(\"Successfully logged out.\");\n } catch (error) {\n console.error(\"Failed to clear credentials.\");\n console.debug(error);\n }\n}\n","import { command } from \"cmd-ts\";\nimport { handleLogout } from \"./login.js\";\n\nexport const logout = command({\n name: \"logout\",\n description: `\nThe logout command removes an existing session created with 'ph login'`,\n args: {},\n handler: async () => {\n await handleLogout();\n process.exit(0);\n },\n});\n","import { mcpArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const mcp = command({\n name: \"mcp\",\n args: mcpArgs,\n description: `\nServe the project's reactor-mcp tools to a coding agent over stdio.\n\nUse it as the MCP server command in .mcp.json, .cursor/mcp.json and\n.gemini/settings.json. Tools are listed at once, without waiting for Vetra.\nThe first tool call connects to the project's running Vetra (found through\n.ph/vetra-runtime.json), or starts one in the background and waits for it to\nbe ready: \\`ph run vetra --strictPort\\`, the project's hosts/vetra host. How\nthe start goes is reported as MCP progress notifications when the client sent a progressToken, else on\nstderr.\nStartup failures come back as tool errors carrying Vetra's output, which is\nalso written to .ph/vetra.log.\n\nBeside reactor-mcp's tools it serves restartVetra, which stops the project's\nVetra, starts it again and returns its URLs. When Vetra restarts some other\nway (stopped and started again), the next tool call connects to the new one.\n`,\n handler: async (args) => {\n if (args.debug) {\n console.error(args);\n }\n const { startMcpLauncher } = await import(\"../services/mcp.js\");\n await startMcpLauncher({\n projectDir: args.projectDir,\n startTimeoutSeconds: args.startTimeout,\n });\n },\n});\n","import { migrateArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const migrate = command({\n name: \"migrate\",\n args: migrateArgs,\n description: \"Run migrations\",\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n const models = args.documentModels || args.documentModel.length > 0;\n const subgraphs = args.subgraphs || args.subgraph.length > 0;\n if (args.strictResolvers && !subgraphs) {\n console.error(\n \"--strict-resolvers applies only with --subgraphs or --subgraph.\",\n );\n process.exit(1);\n }\n if (args.renameConflictingTypes && !models) {\n console.error(\n \"--rename-conflicting-types applies only with --document-models or --document-model.\",\n );\n process.exit(1);\n }\n if (models || subgraphs) {\n if (args.versionPositional ?? args.version ?? args.force) {\n console.error(\n \"--document-models, --document-model, --subgraphs and --subgraph convert to code-first only; they take no version and no --force.\",\n );\n process.exit(1);\n }\n let code = 0;\n if (models) {\n const { migrateDocumentModels } =\n await import(\"../services/migrate-document-models.js\");\n code |= await migrateDocumentModels({\n projectDir: process.cwd(),\n dirs: args.documentModel,\n dryRun: Boolean(args.dryRun),\n renameConflictingTypes: Boolean(args.renameConflictingTypes),\n });\n }\n if (subgraphs) {\n const { migrateSubgraphs } =\n await import(\"../services/migrate-subgraphs.js\");\n code |= await migrateSubgraphs({\n projectDir: process.cwd(),\n dirs: args.subgraph,\n dryRun: Boolean(args.dryRun),\n strictResolvers: Boolean(args.strictResolvers),\n });\n }\n process.exit(code);\n }\n const { startMigrate } = await import(\"../services/migrate.js\");\n await startMigrate(args);\n process.exit(0);\n },\n});\n","import {\n modelCheckArgs,\n modelInspectArgs,\n} from \"@powerhousedao/shared/clis/args\";\nimport { command, subcommands } from \"cmd-ts\";\n\nconst EXPERIMENTAL =\n \"Experimental: the command, its output and the JSON report can change in any release.\";\n\nconst EXIT_CODES = `Exit codes:\n 0 ok, or skipped. Skipped means the package has no document model, so\n nothing was checked. Read \"status\".\n 1 invalid. The models were read and at least one is wrong.\n 2 failed. The configuration or a module could not be read, the arguments\n are wrong, or the command could not run.`;\n\nconst OUTPUT = (name: string) => `Output:\n ph model ${name} a readable report on stdout\n ph model ${name} --json exactly one JSON report on stdout and nothing else\nLogs, including what the package's modules print while they load, go to\nstderr. When the command cannot run at all, it prints only a message on\nstderr and exits 2.`;\n\nexport const modelCheck = command({\n name: \"check\",\n description: `Check this package's document models through one set of checks:\nevery model directory in documentModelsDir, whether it stores a schema-first\n<name>.json or exports a code-first model from its index.ts. Writes nothing.\n\n\\`tsc\\` cannot run these checks: a code-first model compiles when its module is\nevaluated.\n\n--release (experimental) runs the checks \\`ph build --release\\` runs: these,\nthe release checks, and host validation, which validates every model and the\npackage's scalars entry as a host that installed the package would.\n\n--prepack (experimental) loads nothing. It reads the release approval\n\\`ph build --release\\` wrote in .ph/build/release-approval.json and exits 0\nwhen it matches this package, 1 when it does not (missing, unreadable, stale\nor refused), naming the reasons, and 2 when it cannot be checked. To stop a\nplain \\`npm publish\\` too, add it to package.json, then run\n\\`ph build --release\\` (package.json is published, so the approval covers it):\n \"scripts\": { \"prepack\": \"ph-cli model check --prepack\" }\nWith --json it prints {\"decision\": ..., \"reasons\": [...]}.\n\n${EXIT_CODES}\n\n${OUTPUT(\"check\")}\n\n${EXPERIMENTAL}`,\n args: modelCheckArgs,\n handler: async (args) => {\n if (args.debug) {\n console.error(args);\n }\n const [{ runModelCheck }, { exitWithModelCommand }] = await Promise.all([\n import(\"../services/model/check.js\"),\n import(\"../services/model/run.js\"),\n ]);\n await exitWithModelCommand(args.json, (streams) =>\n runModelCheck(args, { streams }),\n );\n },\n});\n\nexport const modelInspect = command({\n name: \"inspect\",\n description: `Describe this package's document models without checking them: for each\nmodel its digest and compatibility, and for each of its versions the source,\nscopes, scalars and operations. With <documentType>@<version>, describe that\nversion only and add its full definition to the JSON report. Writes nothing.\n\n${EXIT_CODES}\n\n${OUTPUT(\"inspect\")}\n\n${EXPERIMENTAL}`,\n args: modelInspectArgs,\n handler: async (args) => {\n if (args.debug) {\n console.error(args);\n }\n const [{ runModelInspect }, { exitWithModelCommand }] = await Promise.all([\n import(\"../services/model/inspect.js\"),\n import(\"../services/model/run.js\"),\n ]);\n await exitWithModelCommand(args.json, (streams) =>\n runModelInspect(args, { streams }),\n );\n },\n});\n\nexport const model = subcommands({\n name: \"model\",\n description:\n \"Check or inspect this package's document models (experimental): `check`, `inspect`.\",\n cmds: { check: modelCheck, inspect: modelInspect },\n});\n","import { publishArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nfunction hasTagFlag(args: string[]): boolean {\n return args.some((a) => a === \"--tag\" || a.startsWith(\"--tag=\"));\n}\n\nfunction isInteractive(): boolean {\n return Boolean(process.stdin.isTTY) && !process.env.CI;\n}\n\nasync function readPrereleaseTag(\n projectPath: string,\n packedVersion: string | undefined,\n): Promise<{\n version: string;\n tag: string;\n} | null> {\n try {\n const [{ readPackageSync }, { prerelease }] = await Promise.all([\n import(\"read-pkg\"),\n import(\"semver\"),\n ]);\n const version =\n packedVersion ?? readPackageSync({ cwd: projectPath }).version;\n if (!version) return null;\n const parts = prerelease(version);\n if (!parts || parts.length === 0) return null;\n const label = String(parts[0]);\n // semver may surface numeric-only prerelease ids (e.g. `1.0.0-0`);\n // npm requires an alphanumeric dist-tag, so skip those.\n if (!/^[a-z][a-z0-9-]*$/i.test(label)) return null;\n return { version, tag: label };\n } catch {\n return null;\n }\n}\n\nexport const publish = command({\n name: \"publish\",\n description: `\nPublish a package to the Powerhouse registry. This is a thin wrapper around npm publish\nthat automatically sets the registry URL.\n\nThis command:\n0. With a release approval from ph build --release (experimental), checks that it matches\n the package and warns when it does not. --require-approval exits 1 instead; it forwards\n only --tag, --access, --otp, --dry-run, --provenance, --json and --loglevel to npm,\n refuses npm configuration in the environment that selects another package\n (npm_config_workspace, npm_config_workspaces, npm_config_include_workspace_root),\n packs the package once, checks that tarball, and publishes that tarball with\n --ignore-scripts, so a file changed after the check is not published\n1. Resolves the registry URL (--registry flag > PH_REGISTRY_URL env > powerhouse.config.json > default)\n2. Checks authentication with the registry via npm whoami\n3. Forwards all additional arguments to npm publish\n `,\n args: publishArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n const { getPowerhouseProjectInfo } =\n await import(\"@powerhousedao/shared/clis\");\n const { projectPath } = await getPowerhouseProjectInfo();\n\n if (!projectPath) {\n throw new Error(\"Could not find project path.\");\n }\n\n const { checkApprovalBeforePublish } =\n await import(\"../services/release/verify.js\");\n if (args.requireApproval) {\n const {\n ALLOWED_NPM_ARGUMENTS,\n refusedNpmArguments,\n targetSelectingNpmEnvironment,\n } = await import(\"../services/release/npm-args.js\");\n const refused = refusedNpmArguments(args.forwardedArgs);\n if (refused.length > 0) {\n console.error(\n `✘ ph publish --require-approval publishes only the package it checked, so it forwards only these npm arguments: ${ALLOWED_NPM_ARGUMENTS}. Not allowed: ${refused.join(\" \")}`,\n );\n process.exit(1);\n }\n const selecting = targetSelectingNpmEnvironment(process.env);\n if (selecting.length > 0) {\n console.error(\n `✘ ph publish --require-approval publishes only the package it checked, but the environment sets npm configuration that selects another package: ${selecting.join(\", \")}. Unset it and publish again.`,\n );\n process.exit(1);\n }\n }\n const checked = checkApprovalBeforePublish(\n projectPath,\n args.requireApproval,\n );\n if (!checked.proceed) {\n process.exit(1);\n }\n const { packed } = checked;\n if (packed) process.once(\"exit\", packed.dispose);\n try {\n const { checkNpmAuth, npmPublish, resolveRegistryUrl } =\n await import(\"@powerhousedao/shared/registry\");\n const { mintRegistryAuthToken } =\n await import(\"../services/registry-auth.js\");\n\n const registryUrl = resolveRegistryUrl({\n registry: args.registry,\n projectPath,\n });\n\n if (args.debug) {\n console.log(\">>> registryUrl\", registryUrl);\n }\n\n // Try Renown auth first: if the user is logged in via `ph login`, mint a\n // short-lived registry-bound bearer token. Falling back to the legacy\n // `npm adduser` (htpasswd) path keeps existing flows working until the\n // grace period ends.\n let authToken: string | undefined;\n try {\n authToken = await mintRegistryAuthToken(registryUrl, 5 * 60);\n if (args.debug) {\n console.error(`>>> minted renown token for ${registryUrl} (5m TTL)`);\n }\n } catch (err) {\n if (args.debug) {\n console.error(\n `>>> renown token mint skipped: ${(err as Error).message}`,\n );\n }\n try {\n await checkNpmAuth(registryUrl);\n } catch {\n console.error(`Not authenticated with registry: ${registryUrl}`);\n console.error(\n `Run: ph login (recommended) or npm adduser --registry ${registryUrl}`,\n );\n process.exit(1);\n }\n }\n\n let forwardedArgs = args.forwardedArgs;\n\n if (!hasTagFlag(forwardedArgs)) {\n const prereleaseInfo = await readPrereleaseTag(\n projectPath,\n packed?.manifest.version,\n );\n if (prereleaseInfo) {\n const { version, tag } = prereleaseInfo;\n if (!isInteractive()) {\n console.error(\n `Detected prerelease version ${version}. npm requires an explicit dist-tag for prerelease publishes.`,\n );\n console.error(\n `Re-run with --tag <label> (e.g. --tag ${tag}) to proceed.`,\n );\n process.exit(1);\n }\n\n const enquirer = await import(\"enquirer\");\n\n let confirmed: boolean;\n try {\n const answer = await enquirer.default.prompt<{\n confirmed: boolean;\n }>({\n type: \"confirm\",\n name: \"confirmed\",\n message: `Detected prerelease version ${version}. Publish with --tag ${tag}?`,\n initial: true,\n });\n confirmed = answer.confirmed;\n } catch {\n // user aborted the prompt (Ctrl-C); treat as decline\n confirmed = false;\n }\n\n if (!confirmed) {\n console.error(\n `Aborted. To publish manually: npm publish --registry ${registryUrl} --tag <label>`,\n );\n process.exit(1);\n }\n\n forwardedArgs = [\"--tag\", tag, ...forwardedArgs];\n }\n }\n\n if (args.debug) {\n console.log(\n \">>> command\",\n `npm publish --registry ${registryUrl} ${forwardedArgs.join(\" \")}`,\n );\n }\n\n if (args.requireApproval) {\n // The approval checked this package's files as they are: a prepack,\n // prepare or prepublishOnly script would change them after that check,\n // and an .npmrc `workspace` would publish another package, which npm\n // refuses alongside --workspaces=false.\n forwardedArgs = [\n ...forwardedArgs,\n \"--ignore-scripts\",\n \"--workspaces=false\",\n ];\n console.log(\n \"Lifecycle scripts are skipped (--ignore-scripts) and workspaces are off (--workspaces=false), so npm publishes the tarball the approval matched.\",\n );\n }\n\n console.log(`Publishing to ${registryUrl}...`);\n const result = await npmPublish({\n registryUrl,\n cwd: projectPath,\n args: packed ? [packed.tarball, ...forwardedArgs] : forwardedArgs,\n authToken,\n });\n if (result.stdout) {\n console.log(result.stdout);\n }\n\n process.exit(0);\n } finally {\n packed?.dispose();\n }\n },\n});\n","import { registryLoginArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const registryLogin = command({\n name: \"registry-login\",\n description: `\nLog in to a Powerhouse registry using your Renown identity. Mints a longer-lived\nbearer token (default 30 days) bound to the registry's audience and writes the\ntoken into ~/.npmrc so raw 'npm publish' / 'npm install' work without further\nsetup.\n\nPrerequisites:\n Run 'ph login' first to establish a Renown identity.\n\nUsage:\n ph registry-login # uses powerhouse.config.json / PH_REGISTRY_URL\n ph registry-login --registry https://registry.vetra.io\n ph registry-login --expiry 7d\n `,\n args: registryLoginArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n const { getPowerhouseProjectInfo } =\n await import(\"@powerhousedao/shared/clis\");\n const projectInfo = await getPowerhouseProjectInfo().catch(() => null);\n const projectPath = projectInfo?.projectPath ?? process.cwd();\n\n const [\n { resolveRegistryUrl, writeRegistryAuthToken },\n { mintRegistryAuthToken },\n { parseExpiry, formatExpiry },\n ] = await Promise.all([\n import(\"@powerhousedao/shared/registry\"),\n import(\"../services/registry-auth.js\"),\n import(\"@renown/sdk/node\"),\n ]);\n\n const registryUrl = resolveRegistryUrl({\n registry: args.registry,\n projectPath,\n });\n\n const expiresIn = parseExpiry(args.expiry);\n\n const token = await mintRegistryAuthToken(registryUrl, expiresIn);\n const npmrcPath = await writeRegistryAuthToken(registryUrl, token);\n\n console.log(`Logged in to ${registryUrl}`);\n console.log(` Token expires in: ${formatExpiry(expiresIn)}`);\n console.log(` Wrote: ${npmrcPath}`);\n process.exit(0);\n },\n});\n","import {\n boolean,\n command,\n flag,\n option,\n optional,\n positional,\n restPositionals,\n string,\n} from \"cmd-ts\";\n\nexport const runHost = command({\n name: \"run\",\n description:\n \"Run a host from the project's hosts/ folder: `ph run <host> [verb]`. \" +\n \"The host's own host.js names the runner module; the verb defaults to `run`. \" +\n \"Arguments after the verb go to the runner, which names the ones it accepts. \" +\n \"`ph run <package>/<host>` runs a host that an installed package supplies.\",\n args: {\n host: positional({\n type: string,\n displayName: \"host\",\n description:\n \"Folder name under hosts/ (e.g. vetra, connect), or `<package>/<host>` \" +\n \"for one in an installed package's hosts/ (e.g. `@acme/tools/studio`).\",\n }),\n verb: positional({\n type: optional(string),\n displayName: \"verb\",\n description: \"Runner verb (default: run; e.g. dev, build, serve).\",\n }),\n debug: flag({\n type: optional(boolean),\n long: \"debug\",\n description: \"Print resolved host/runner/verb before dispatch.\",\n }),\n stop: flag({\n type: optional(boolean),\n long: \"stop\",\n description:\n \"Stop the project's running instance of this host instead of \" +\n \"starting one: it shuts down as on Ctrl-C, and the command returns \" +\n \"when it has.\",\n }),\n explain: option({\n type: optional(string),\n long: \"explain\",\n description:\n \"Explain a resolved aspect instead of running: `--explain drives` \" +\n \"prints the merged drive plan with provenance; `--explain outputs` \" +\n \"prints what each host produces, the output tokens it reads and \" +\n \"the start order they imply.\",\n }),\n // cli.ts moves the runner's arguments behind a `--` (forwardRunnerArgv).\n argv: restPositionals({\n type: string,\n displayName: \"runner arguments\",\n description:\n \"Arguments for the host's runner (e.g. --port 4001); they win over \" +\n \"the host file.\",\n }),\n },\n handler: async (args) => {\n if (args.explain !== undefined) {\n const { explainHost } = await import(\"../services/run/explain.js\");\n await explainHost({ host: args.host, topic: args.explain });\n return;\n }\n if (args.stop) {\n const { stopRunningHost } =\n await import(\"@powerhousedao/ph-run/start-run\");\n await stopRunningHost({ host: args.host });\n return;\n }\n const run = {\n host: args.host,\n verb: args.verb,\n debug: args.debug,\n argv: args.argv,\n };\n // hosts/vetra is what `ph dev` is sugar for (run-sugar.ts): its stack\n // keeps the runtime record `ph mcp` reads.\n if (args.host === \"vetra\") {\n const { runVetraHost } = await import(\"../services/run/vetra-host.js\");\n await runVetraHost(run);\n return;\n }\n const { startRun } = await import(\"@powerhousedao/ph-run/start-run\");\n await startRun(run);\n },\n});\n","import { AGENTS, uninstallArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\nimport { execSync } from \"node:child_process\";\n\nexport const uninstall = command({\n name: \"uninstall\",\n aliases: [\"remove\"],\n description: `\nThe uninstall command removes Powerhouse dependencies from your project. It handles the\nremoval of packages, updates configuration files, and ensures proper cleanup.\n\nThis command:\n1. Uninstalls specified Powerhouse dependencies using your package manager\n2. Updates powerhouse.config.json to remove the dependencies\n3. Supports various uninstallation options and configurations\n4. Works with ${AGENTS.join(\", \")} package managers\n`,\n args: uninstallArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n const {\n getPowerhouseProjectInfo,\n getPowerhouseProjectUninstallCommand,\n makeDependenciesWithVersions,\n } = await import(\"@powerhousedao/shared/clis\");\n\n const {\n projectPath,\n localProjectPath,\n globalProjectPath,\n packageManager,\n isGlobal,\n } = await getPowerhouseProjectInfo(args);\n\n if (!projectPath) {\n throw new Error(`Could not find project path to uninstall from`);\n }\n\n const dependenciesWithVersions = await makeDependenciesWithVersions(\n args.dependencies,\n );\n\n if (args.debug) {\n console.log(\">>> parsedDependencies\", dependenciesWithVersions);\n }\n\n if (args.debug) {\n console.log(\"\\n>>> projectInfo\", {\n localProjectPath,\n globalProjectPath,\n packageManager,\n isGlobal,\n });\n }\n\n try {\n console.log(\"Uninstalling dependencies 📦 ...\");\n const uninstallCommand = await getPowerhouseProjectUninstallCommand(\n packageManager,\n args.dependencies,\n );\n execSync(uninstallCommand, {\n stdio: \"inherit\",\n cwd: projectPath,\n });\n console.log(\"Dependency uninstalled successfully 🎉\");\n } catch (error) {\n console.error(\"❌ Failed to uninstall dependencies\");\n throw error;\n }\n\n const { removeStylesImports, updateConfigFile } =\n await import(\"../utils.js\");\n\n try {\n console.log(\"⚙️ Updating powerhouse config file...\");\n updateConfigFile(dependenciesWithVersions, projectPath, \"uninstall\");\n console.log(\"Config file updated successfully 🎉\");\n } catch (error) {\n console.error(\"❌ Failed to update config file\");\n throw error;\n }\n\n // Skills of the removed packages leave with them.\n const { syncPackageSkills } =\n await import(\"@powerhousedao/codegen/file-builders\");\n for (const { path, action } of await syncPackageSkills(projectPath)) {\n console.log(` ${path}: ${action}`);\n }\n\n try {\n console.log(\"⚙️ Updating styles.css file...\");\n removeStylesImports(dependenciesWithVersions, projectPath);\n console.log(\"Styles file updated successfully 🎉\");\n } catch (error) {\n console.error(\"❌ Failed to update styles file\");\n throw error;\n }\n\n process.exit(0);\n },\n});\n","import { unpublishArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\nimport { createInterface } from \"node:readline/promises\";\n\nexport const unpublish = command({\n name: \"unpublish\",\n description: `\nUnpublish a package from the Powerhouse registry. This is a thin wrapper around\nnpm unpublish that automatically targets the Powerhouse registry and never\nreaches npmjs.org.\n\nForms:\n ph unpublish # unpublish <name>@<version> from cwd's package.json\n ph unpublish <name> # unpublish the whole package (all versions)\n ph unpublish <name>@<version> # unpublish a single version\n\nFlags:\n --registry <url> # override registry URL\n --yes, -y # skip the confirmation prompt\n `,\n args: unpublishArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n const { getPowerhouseProjectInfo } =\n await import(\"@powerhousedao/shared/clis\");\n const { projectPath } = await getPowerhouseProjectInfo();\n\n if (!projectPath) {\n throw new Error(\"Could not find project path.\");\n }\n\n const { checkNpmAuth, npmUnpublish, resolveRegistryUrl } =\n await import(\"@powerhousedao/shared/registry\");\n\n const registryUrl = resolveRegistryUrl({\n registry: args.registry,\n projectPath,\n });\n\n const spec = await resolveSpec(args.spec, projectPath);\n if (!spec) {\n console.error(\n \"No package spec provided and could not read name/version from package.json.\",\n );\n process.exit(1);\n }\n\n if (args.debug) {\n console.log(\">>> registryUrl\", registryUrl);\n console.log(\">>> spec\", spec);\n }\n\n try {\n await checkNpmAuth(registryUrl);\n } catch {\n console.error(`Not authenticated with registry: ${registryUrl}`);\n console.error(`Run: npm adduser --registry ${registryUrl}`);\n process.exit(1);\n }\n\n if (!args.yes) {\n const confirmed = await confirm(\n `Unpublish ${spec} from ${registryUrl}? [y/N] `,\n );\n if (!confirmed) {\n console.log(\"Aborted.\");\n process.exit(0);\n }\n }\n\n if (args.debug) {\n console.log(\n \">>> command\",\n `npm unpublish ${spec} --registry ${registryUrl} --force ${args.forwardedArgs.join(\" \")}`,\n );\n }\n\n console.log(`Unpublishing ${spec} from ${registryUrl}...`);\n try {\n const result = await npmUnpublish({\n registryUrl,\n cwd: projectPath,\n spec,\n args: args.forwardedArgs,\n });\n if (result.stdout) {\n console.log(result.stdout);\n }\n process.exit(0);\n } catch (err) {\n console.error(err instanceof Error ? err.message : String(err));\n process.exit(1);\n }\n },\n});\n\nasync function resolveSpec(\n explicit: string | undefined,\n projectPath: string,\n): Promise<string | null> {\n if (explicit) return explicit;\n try {\n const { readPackageSync } = await import(\"read-pkg\");\n const pkg = readPackageSync({ cwd: projectPath });\n if (!pkg.name) return null;\n return pkg.version ? `${pkg.name}@${pkg.version}` : pkg.name;\n } catch {\n return null;\n }\n}\n\nasync function confirm(prompt: string): Promise<boolean> {\n const rl = createInterface({ input: process.stdin, output: process.stdout });\n try {\n const answer = await rl.question(prompt);\n return /^y(es)?$/i.test(answer.trim());\n } finally {\n rl.close();\n }\n}\n","import { command, optional, positional, restPositionals, string } from \"cmd-ts\";\nimport {\n VETRA_STUDIO_HOST,\n VETRA_STUDIO_PACKAGE,\n} from \"../services/vetra-gateway.js\";\n\n/**\n * `ph vetra`, the gateway to Vetra Studio. cli.ts hands every `ph vetra` but\n * its help to the gateway (services/vetra-gateway.ts), which makes it the\n * `ph run` of the studio host: this command gives the help and the docs.\n */\nexport const vetra = command({\n name: \"vetra\",\n description:\n `Open Vetra Studio: \\`ph vetra [verb]\\` is \\`ph run ${VETRA_STUDIO_HOST} [verb]\\`, ` +\n `the studio host of the ${VETRA_STUDIO_PACKAGE} package. ` +\n `A project without the package gets it first: \\`ph vetra\\` installs it as a devDependency, ` +\n \"at this ph-cli's version, with the project's package manager. \" +\n \"The runner arguments, --stop and --explain work as for `ph run`. \" +\n \"The dev mode that `ph vetra` started before 6.4 (the project's hosts/vetra) is `ph dev`.\",\n args: {\n verb: positional({\n type: optional(string),\n displayName: \"verb\",\n description: \"Verb of the studio host (default: the host's own).\",\n }),\n argv: restPositionals({\n type: string,\n displayName: \"runner arguments\",\n description:\n \"Arguments for the studio host's runner, as `ph run` takes them.\",\n }),\n },\n handler: () => {\n // Not reached: cli.ts runs `ph vetra` through the gateway.\n throw new Error(\n `\\`ph vetra\\` is \\`ph run ${VETRA_STUDIO_HOST}\\`, through the gateway in cli.ts.`,\n );\n },\n});\n","import { accessToken } from \"./access-token.js\";\nimport { build } from \"./build.js\";\nimport { connect } from \"./connect.js\";\nimport { generate } from \"./generate.js\";\nimport { host } from \"./host.js\";\nimport { init } from \"./init.js\";\nimport { inspect } from \"./inspect.js\";\nimport { install } from \"./install.js\";\nimport { keyframes } from \"./keyframes.js\";\nimport { list } from \"./list.js\";\nimport { login } from \"./login.js\";\nimport { logout } from \"./logout.js\";\nimport { mcp } from \"./mcp.js\";\nimport { migrate } from \"./migrate.js\";\nimport { model } from \"./model.js\";\nimport { publish } from \"./publish.js\";\nimport { registryLogin } from \"./registry-login.js\";\nimport { runHost } from \"./run.js\";\nimport { uninstall } from \"./uninstall.js\";\nimport { unpublish } from \"./unpublish.js\";\nimport { vetra } from \"./vetra.js\";\n\nexport const phCliCommands = {\n init,\n generate,\n connect,\n build,\n publish,\n unpublish,\n \"access-token\": accessToken,\n \"registry-login\": registryLogin,\n inspect,\n keyframes,\n list,\n mcp,\n migrate,\n model,\n login,\n logout,\n install,\n uninstall,\n run: runHost,\n host,\n vetra,\n} as const;\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAIA,MAAa,cAAc,QAAQ;CACjC,MAAM;CACN,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+Cb,MAAM;CACN,SAAS,OAAO,SAAS;EACvB,IAAI,KAAK,OACP,QAAQ,IAAI,IAAI;EAGlB,MAAM,EAAE,qBAAqB,aAAa,iBACxC,MAAM,OAAO;EACf,MAAM,EAAE,cAAc,MAAM,OAAO;EACnC,MAAM,SAAS,MAAM,UAAU;EAE/B,IAAI,YAAY;EAChB,IAAI,KAAK,QAAQ,YAAY,YAAY,KAAK,MAAM;EAEpD,MAAM,SAAS,MAAM,oBAAoB,QAAQ;GAC/C;GACA,KAAK,KAAK;EACZ,CAAC;EAGD,QAAQ,MAAM,YAAY,OAAO,KAAK;EACtC,QAAQ,MAAM,gBAAgB,OAAO,SAAS;EAC9C,QAAQ,MAAM,qBAAqB,aAAa,SAAS,GAAG;EAC5D,QAAQ,MAAM,EAAE;EAEhB,QAAQ,IAAI,OAAO,KAAK;EACxB,QAAQ,KAAK,CAAC;CAChB;AACF,CAAC;;;AC9ED,MAAa,QAAQ,QAAQ;CAC3B,MAAM;CACN,aAAa;;;;;;;;;;;;;;;CAeb,MAAM;CACN,SAAS,OAAO,SAAS;EACvB,IAAI,KAAK,OACP,QAAQ,IAAI,IAAI;EAElB,IAAI;GACF,MAAM,EAAE,aAAa,MAAM,OAAO;GAClC,MAAM,SAAS,MAAM;IAAE,kBAAkB;IAAM,aAAa;G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AC;EACH;EACA,eAAe;GAEb,MAAM,IAAI,MACR,4BAA4B,kBAAkB,mCAChD;EACF;CACF,CCIE;AACF","debug_id":"4f6285f8-39ef-5b94-8992-307f3c87d15e"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"run-sugar-DUiDFl_T.mjs","sources":["../src/utils/run-sugar.ts"],"sourcesContent":["import { probeHostsFolder, splitRunArgv } from \"@powerhousedao/host-core\";\n\nexport interface RunSugarResult {\n args: string[];\n /** Set when hosts/ exists but is empty: no host is defined, so nothing is rewritten. */\n warning?: string;\n}\n\n/** A host every scaffold has. */\nexport type SugarHost = \"vetra\" | \"connect\" | \"switchboard\";\n\n/**\n * The commands that run a host every scaffold has, and the host: `ph dev`,\n * `ph connect` and `ph switchboard` are `ph run <host>` and have no code of\n * their own. `ph dev` runs hosts/vetra, the dev mode. They are rewritten\n * whatever the project holds, so a project without the host gets the error\n * of `ph run` (sugar-checks.ts says it first, as typed).\n */\nexport const HOST_COMMANDS: Readonly<Record<string, SugarHost>> = {\n dev: \"vetra\",\n connect: \"connect\",\n switchboard: \"switchboard\",\n};\n\n/** `ph connect <subcommand>` and the verb of the connect host it stands for. */\nexport const CONNECT_VERBS: Readonly<Record<string, string>> = {\n studio: \"dev\",\n build: \"build\",\n preview: \"serve\",\n};\n\nconst isHelp = (arg: string | undefined) => arg === \"--help\" || arg === \"-h\";\n\n/**\n * `ph connect [studio|build|preview]` → `ph run connect <dev|build|serve>`.\n * Without a subcommand it is `studio`, as it always was. `ph connect config`\n * and `ph connect --help` stay the `connect` command: a tool, not a host.\n * Any other word is a verb of the host (`ph connect serve`).\n */\nfunction connectSugar(args: string[]): string[] {\n const rest = args.slice(1);\n if (rest[0] === \"config\" || isHelp(rest[0])) return args;\n if (rest.length === 0 || rest[0].startsWith(\"-\")) {\n return [\"run\", \"connect\", CONNECT_VERBS.studio, ...rest];\n }\n if (Object.hasOwn(CONNECT_VERBS, rest[0])) {\n return [\"run\", \"connect\", CONNECT_VERBS[rest[0]], ...rest.slice(1)];\n }\n return [\"run\", ...args];\n}\n\n/**\n * `ph <host-name> [verb]` sugar: when the first arg is not a registered\n * command and names a host in the project's hosts/ folder, splice in `run`.\n * Built-in commands win collisions by construction — the known-command check\n * runs first. {@link HOST_COMMANDS} are sugar in every project. `ph vetra` is\n * a command, the gateway to Vetra Studio (services/vetra-gateway.ts), and\n * never a host.\n */\nexport function applyRunSugar(\n args: string[],\n knownCommands: ReadonlySet<string>,\n projectRoot: string,\n): RunSugarResult {\n const first = args[0];\n if (!first || first.startsWith(\"-\")) {\n return { args };\n }\n if (first === \"connect\") {\n return { args: connectSugar(args) };\n }\n if (Object.hasOwn(HOST_COMMANDS, first)) {\n return { args: [\"run\", HOST_COMMANDS[first], ...args.slice(1)] };\n }\n if (knownCommands.has(first)) {\n return { args };\n }\n const probe = probeHostsFolder(projectRoot);\n if (probe.kind === \"empty\") {\n return {\n args,\n warning:\n `hosts/ exists at ${probe.dir} but contains no <name>/host.js — ` +\n \"no host is defined. Run `ph migrate` to add the host files.\",\n };\n }\n if (probe.kind === \"present\" && probe.hosts.includes(first)) {\n return { args: [\"run\", ...args] };\n }\n return { args };\n}\n\n/**\n * `ph run <host> [verb] <runner arguments>`: moves the runner's arguments\n * behind a `--`, so the `run` command takes them as they are instead of\n * refusing the ones it does not know. The verb is spelled out: after the `--`\n * nothing is read as one. Any other invocation is returned as it is.\n */\nexport function forwardRunnerArgv(args: string[]): string[] {\n if (args[0] !== \"run\") return args;\n const { host, verb, own, argv } = splitRunArgv(args.slice(1));\n if (host === undefined || argv.length === 0) return args;\n return [\"run\", host, verb ?? \"run\", ...own, \"--\", ...argv];\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAkBA,MAAa,gBAAqD;CAChE,KAAK;CACL,SAAS;CACT,aAAa;AACf;;AAGA,MAAa,gBAAkD;CAC7D,QAAQ;CACR,OAAO;CACP,SAAS;AACX;AAEA,MAAM,UAAU,QAA4B,QAAQ,YAAY,QAAQ;;;;;;;AAQxE,SA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AO;EAAC;EAAO;EAAM,QAAQ;EAAO,GAAG;EAAK;EAAM,GAAG;CAAI;AAC3D","debug_id":"afd293ed-d678-5a01-b0a9-c50b926c3bc3"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"sugar-checks-BFu3sfFJ.mjs","sources":["../src/utils/sugar-checks.ts"],"sourcesContent":["import {\n loadHost,\n probeHostsFolder,\n withoutHostsMessage,\n type RunnerArgsSchema,\n} from \"@powerhousedao/host-core\";\nimport {\n DEPRECATIONS_REMOVED_IN,\n MIGRATION_GUIDE_URL,\n} from \"@powerhousedao/shared/clis/deprecations\";\nimport { CONNECT_VERBS, HOST_COMMANDS, type SugarHost } from \"./run-sugar.js\";\n\n/**\n * What `ph dev`, `ph connect` and `ph switchboard` are refused for, before\n * they become `ph run <host>` (run-sugar.ts): a project without the host\n * file, and the flags of the commands they once were that `ph run` has no\n * argument for. `ph run` is not checked here, nor is any other host name: a\n * runner refuses the arguments it does not know itself. Nor are the flags of\n * a host on a runner of its own: they are checked against the stock runners.\n */\n\n/** `ph switchboard` flags that are verbs of the host. */\nconst SWITCHBOARD_VERB_FLAGS: Readonly<Record<string, string>> = {\n \"--migrate\": \"migrate\",\n \"--migrate-status\": \"migrate-status\",\n \"--reset\": \"reset\",\n \"--dev\": \"dev\",\n};\n\n/** Read by the CLI itself, before any command. */\nconst CLI_FLAGS = new Set([\"--debug\"]);\n\n/** The runner argument schemas the flags are checked against. */\nexport interface SugarArgSchemas {\n switchboard: RunnerArgsSchema;\n connect: RunnerArgsSchema;\n}\n\ninterface SugarInvocation {\n /** As typed: `ph connect build`. */\n typed: string;\n /** The host it runs. */\n host: SugarHost;\n /** What it is sugar for: `ph run <host> [verb]`. */\n replacement: string;\n /** The flags passed, by name, without their values. */\n flags: string[];\n}\n\nfunction sugarInvocation(args: readonly string[]): SugarInvocation | undefined {\n const [command, ...rest] = args;\n if (command === undefined || !Object.hasOwn(HOST_COMMANDS, command)) {\n return undefined;\n }\n if (rest.some((arg) => arg === \"--help\" || arg === \"-h\")) return undefined;\n const flags = [\n ...new Set(\n rest\n .filter((arg) => arg.startsWith(\"-\") && arg !== \"--\")\n .map((arg) => arg.split(\"=\")[0]),\n ),\n ].filter((name) => !CLI_FLAGS.has(name));\n // A word right after the command is the subcommand or the verb.\n const word =\n rest.length > 0 && !rest[0].startsWith(\"-\") ? rest[0] : undefined;\n if (command === \"connect\") {\n // `ph connect config` reads and writes the config: a tool, not a host.\n if (word === \"config\") return undefined;\n const verb =\n word === undefined\n ? CONNECT_VERBS.studio\n : Object.hasOwn(CONNECT_VERBS, word)\n ? CONNECT_VERBS[word]\n : word;\n return {\n typed: word ? `ph connect ${word}` : \"ph connect\",\n host: \"connect\",\n replacement: `ph run connect ${verb}`,\n flags,\n };\n }\n // `ph dev` runs hosts/vetra.\n const host = HOST_COMMANDS[command];\n return {\n typed: word ? `ph ${command} ${word}` : `ph ${command}`,\n host,\n replacement: word ? `ph run ${host} ${word}` : `ph run ${host}`,\n flags,\n };\n}\n\n/**\n * `ph reactor` was an alias of `ph switchboard`. It is gone, unless the\n * project names a host of its own that.\n */\nfunction removedAliasError(\n args: readonly string[],\n projectRoot: string,\n): string | undefined {\n if (args[0] !== \"reactor\") return undefined;\n const probe = probeHostsFolder(projectRoot);\n if (probe.kind === \"present\" && probe.hosts.includes(\"reactor\")) {\n return undefined;\n }\n return (\n `\\`ph reactor\\` was removed in ${DEPRECATIONS_REMOVED_IN}. ` +\n \"Use `ph switchboard` or `ph run switchboard` instead.\"\n );\n}\n\n/**\n * Why the command cannot run in this project: it has no hosts (the wording\n * of `ph run`, naming `ph migrate`), or it has hosts and not this one.\n * Undefined for anything else, for help, and for a project with the host.\n */\nexport function withoutHostError(\n args: readonly string[],\n projectRoot: string,\n): string | undefined {\n const invocation = sugarInvocation(args);\n if (!invocation) return undefined;\n const { typed, host } = invocation;\n const probe = probeHostsFolder(projectRoot);\n if (probe.kind !== \"present\") {\n return withoutHostsMessage(probe, `\\`${typed}\\``);\n }\n if (probe.hosts.includes(host)) return undefined;\n // `ph migrate` adds the hosts to a project that has none, and only then.\n return (\n `This project has no hosts/${host}/host.js, so \\`${typed}\\` cannot run. ` +\n `\\`ph migrate\\` adds the host files to a project without hosts only: add hosts/${host}/host.js to this one. ` +\n `See ${MIGRATION_GUIDE_URL}`\n );\n}\n\n/**\n * The flags `ph run <host>` has no argument for, as one error. A flag the\n * runner takes passes, under its member name for `ph dev`\n * (`--switchboard-port`); a flag the runner retired passes too, and the\n * runner says so. Undefined when every flag passes.\n */\nexport function removedFlagsError(\n args: readonly string[],\n schemas: SugarArgSchemas,\n): string | undefined {\n const invocation = sugarInvocation(args);\n if (!invocation) return undefined;\n const { typed, host, replacement } = invocation;\n // A compound hands each member its arguments; a member option goes by its\n // member name there (`--switchboard-port`), never by its plain one.\n const members =\n host === \"vetra\" ? [schemas.switchboard, schemas.connect] : [schemas[host]];\n const scoped = new Set(\n members.flatMap((schema) => Object.values(schema.memberOptions ?? {})),\n );\n const accepts = (name: string): boolean =>\n host === \"vetra\"\n ? // `ph run vetra` takes --restart itself (vetra-host.ts).\n name === \"--restart\" ||\n members.some(\n (schema) =>\n schema.memberOptions?.[name] !== undefined ||\n (!scoped.has(name) &&\n [...schema.options, ...schema.flags].includes(name)),\n )\n : [...members[0].options, ...members[0].flags].includes(name);\n const errors: string[] = [];\n const unsupported: string[] = [];\n for (const name of invocation.flags) {\n const verb =\n host === \"switchboard\" ? SWITCHBOARD_VERB_FLAGS[name] : undefined;\n const retired = members.some(\n (schema) => schema.retired?.[name] !== undefined,\n );\n if (verb !== undefined) {\n errors.push(\n `\\`${typed} ${name}\\` was removed in ${DEPRECATIONS_REMOVED_IN}. Use \\`ph run switchboard ${verb}\\` instead.`,\n );\n } else if (accepts(name) || retired) {\n continue;\n } else {\n unsupported.push(name);\n }\n }\n if (unsupported.length > 0) {\n const one = unsupported.length === 1;\n const subject = one\n ? `\\`${typed} ${unsupported[0]}\\` was removed in ${DEPRECATIONS_REMOVED_IN}: \\`${replacement}\\` has no such argument.`\n : `The \\`${typed}\\` flags ${unsupported.join(\", \")} were removed in ${DEPRECATIONS_REMOVED_IN}: \\`${replacement}\\` has no such arguments.`;\n errors.push(\n `${subject} Set what ${one ? \"it configures\" : \"they configure\"} in the host files under hosts/ instead. ` +\n `See ${MIGRATION_GUIDE_URL}`,\n );\n }\n return errors.length > 0 ? errors.join(\"\\n\") : undefined;\n}\n\n/** The runners the scaffold's hosts name, whose schemas the flags are\n * checked against. ph-cli's are the ph-run ones, re-exported. */\nconst STOCK_RUNNERS: Readonly<Record<string, readonly string[]>> = {\n connect: [\n \"@powerhousedao/ph-cli/runners/connect\",\n \"@powerhousedao/ph-run/runners/connect\",\n ],\n switchboard: [\n \"@powerhousedao/ph-cli/runners/switchboard\",\n \"@powerhousedao/ph-run/runners/switchboard\",\n ],\n};\nconst COMPOUND_RUNNER = \"@powerhousedao/host-core/runners/compound\";\n\nasync function runnerModuleOf(\n projectRoot: string,\n host: string,\n): Promise<{ module: string; children?: unknown } | undefined> {\n try {\n const { host: definition } = await loadHost(projectRoot, host);\n return {\n module: definition.runner.module,\n children: (definition as { children?: unknown }).children,\n };\n } catch {\n // `ph run` loads it next and says what is wrong with it.\n return undefined;\n }\n}\n\n/**\n * Whether the host runs the stock runner of its command: the connect or\n * switchboard runner, or for `ph dev` the compound over members that are\n * the project's connect and switchboard hosts, each on its stock runner.\n * Anything else has arguments of its own, which its runner checks.\n */\nexport async function runsStockRunner(\n projectRoot: string,\n host: SugarHost,\n): Promise<boolean> {\n const loaded = await runnerModuleOf(projectRoot, host);\n if (!loaded) return false;\n if (host !== \"vetra\") return STOCK_RUNNERS[host].includes(loaded.module);\n if (loaded.module !== COMPOUND_RUNNER) return false;\n const children = loaded.children;\n if (typeof children !== \"object\" || children === null) return false;\n const members = new Set<string>();\n for (const child of Object.values(children as Record<string, unknown>)) {\n const { host: member, runner } = (child ?? {}) as {\n host?: unknown;\n runner?: { module?: unknown };\n };\n if (typeof member !== \"string\" || !Object.hasOwn(STOCK_RUNNERS, member)) {\n return false;\n }\n // A member that names a runner module is not on its sibling's.\n if (runner?.module !== undefined) return false;\n members.add(member);\n }\n for (const member of members) {\n const sibling = await runnerModuleOf(projectRoot, member);\n if (!sibling || !STOCK_RUNNERS[member].includes(sibling.module)) {\n return false;\n }\n }\n return true;\n}\n\nasync function loadArgSchemas(): Promise<SugarArgSchemas | undefined> {\n try {\n const [switchboard, connect] = await Promise.all([\n import(\"@powerhousedao/ph-run/runners/switchboard\"),\n import(\"@powerhousedao/ph-run/runners/connect\"),\n ]);\n return {\n switchboard: switchboard.argsSchema,\n connect: connect.argsSchema,\n };\n } catch {\n return undefined;\n }\n}\n\n/**\n * Run by the CLI on the command line as typed, before the host sugar: the\n * error the invocation ends with, if any. `args` is untouched either way.\n */\nexport async function sugarError(\n args: readonly string[],\n projectRoot: string,\n): Promise<string | undefined> {\n const removed = removedAliasError(args, projectRoot);\n if (removed !== undefined) return removed;\n const withoutHost = withoutHostError(args, projectRoot);\n if (withoutHost !== undefined) return withoutHost;\n const invocation = sugarInvocation(args);\n if (!invocation || invocation.flags.length === 0) return undefined;\n // A runner of the project's own takes the arguments it declares.\n if (!(await runsStockRunner(projectRoot, invocation.host))) return undefined;\n // Without the schemas the runner still refuses what it does not accept.\n const schemas = await loadArgSchemas();\n return schemas ? removedFlagsError(args, schemas) : undefined;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAsBA,MAAM,yBAA2D;CAC/D,aAAa;CACb,oBAAoB;CACpB,WAAW;CACX,SAAS;AACX;;AAGA,MAAM,4BAAY,IAAI,IAAI,CAAC,SAAS,CAAC;AAmBrC,SAAS,gBAAgB,MAAsD;CAC7E,MAAM,CAAC,SAAS,GAAG,QAAQ;CAC3B,IAAI,YAAY,KAAA,KAAa,CAAC,OAAO,OAAO,eAAe,OAAO,GAChE;CAEF,IAAI,KAAK,MAAM,QAAQ,QAAQ,YAAY,QAAQ,IAAI,GAAG,OAAO,KAAA;CACjE,MAAM,QAAQ,C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E,IAAI;EACF,MAAM,CAAC,aAAa,WAAW,MAAM,QAAQ,IAAI,CAC/C,OAAO,8CACP,OAAO,wCACT,CAAC;EACD,OAAO;GACL,aAAa,YAAY;GACzB,SAAS,QAAQ;EACnB;CACF,QAAQ;EACN;CACF;AACF;;;;;AAMA,eAAsB,WACpB,MACA,aAC6B;CAC7B,MAAM,UAAU,kBAAkB,MAAM,WAAW;CACnD,IAAI,YAAY,KAAA,GAAW,OAAO;CAClC,MAAM,cAAc,iBAAiB,MAAM,WAAW;CACtD,IAAI,gBAAgB,KAAA,GAAW,OAAO;CACtC,MAAM,aAAa,gBAAgB,IAAI;CACvC,IAAI,CAAC,cAAc,WAAW,MAAM,WAAW,GAAG,OAAO,KAAA;CAEzD,IAAI,CAAE,MAAM,gBAAgB,aAAa,WAAW,IAAI,GAAI,OAAO,KAAA;CAEnE,MAAM,UAAU,MAAM,eAAe;CACrC,OAAO,UAAU,kBAAkB,MAAM,OAAO,IAAI,KAAA;AACtD","debug_id":"c79113ae-9cd3-591e-9c01-e19ed4388960"}
@@ -1,4 +0,0 @@
1
- import { c as vetraGateway } from "./vetra-gateway-BMzq0mqX.mjs";
2
- export { vetraGateway };
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]="ea1afa71-888b-553f-8e99-41106f82acfd")}catch(e){}}();
4
- //# debugId=ea1afa71-888b-553f-8e99-41106f82acfd
@@ -1 +0,0 @@
1
- {"version":3,"file":"vetra-host-C37IGwBM.mjs","sources":["../src/services/run/vetra-host.ts"],"sourcesContent":["import {\n ONE_SHOT_VERBS,\n readProjectName,\n STORE_VERBS,\n} from \"@powerhousedao/host-core\";\nimport { outputsSchema as connectOutputsSchema } from \"@powerhousedao/ph-run/runners/connect\";\nimport { outputsSchema as switchboardOutputsSchema } from \"@powerhousedao/ph-run/runners/switchboard\";\nimport { startRun, type StartRunArgs } from \"@powerhousedao/ph-run/start-run\";\nimport { yellow } from \"colorette\";\nimport { z } from \"zod\";\nimport { vetraRuntimeRefusal } from \"../../utils/vetra-instance.js\";\nimport {\n clearVetraRuntime,\n syncMcpPortNotices,\n vetraRuntimeRecord,\n writeVetraRuntime,\n type VetraRuntimeRecord,\n} from \"../../utils/vetra-runtime.js\";\n\n/**\n * `ph run vetra`: the vetra host is the generic compound runner over a\n * switchboard and a connect member, so nothing below `ph run` knows it is\n * Vetra. What makes the stack the project's Vetra is done here around\n * startRun: refuse while another Vetra holds\n * the project, publish `.ph/vetra-runtime.json` once the stack is ready,\n * clear it on exit, and correct a drifted `.mcp.json`. `--restart` is its own\n * argument, not a runner's: it stops the recorded Vetra first.\n */\nexport async function runVetraHost(args: StartRunArgs): Promise<unknown> {\n const verb = args.verb ?? \"run\";\n // `build` starts nothing; a store verb is refused for a compound.\n if (ONE_SHOT_VERBS.has(verb) || STORE_VERBS.has(verb)) {\n return startRun(args);\n }\n const projectDir = args.projectRoot ?? process.cwd();\n const projectName = readProjectName(projectDir);\n const restart = args.argv?.includes(RESTART_FLAG) ?? false;\n if (restart) {\n const { stopVetra } = await import(\"../../utils/vetra-launcher.js\");\n await stopVetra({\n projectDir,\n projectName,\n onProgress: (message) => console.log(message),\n });\n }\n const refusal = await vetraRuntimeRefusal(projectDir, projectName);\n if (refusal) throw new Error(refusal);\n\n const result = await startRun(\n restart\n ? { ...args, argv: args.argv?.filter((arg) => arg !== RESTART_FLAG) }\n : args,\n );\n publishVetraRuntime(projectDir, projectName, result);\n return result;\n}\n\n/** `ph run vetra --restart`, which `ph dev --restart` is sugar for. */\nconst RESTART_FLAG = \"--restart\";\n\nconst startedSchema = z.object({\n started: z.array(z.object({ outputs: z.unknown() })),\n});\n\nconst portOf = (url: string) => Number(new URL(url).port);\n\nfunction firstMatch<T>(\n schema: z.ZodType<T>,\n candidates: unknown[],\n): T | undefined {\n for (const candidate of candidates) {\n const match = schema.safeParse(candidate);\n if (match.success) return match.data;\n }\n return undefined;\n}\n\n/**\n * The record of a ready compound: its members are told apart by the outputs\n * their runners publish, since a host file is free to name them.\n */\nexport function vetraRecordOfRun(\n projectName: string,\n result: unknown,\n): VetraRuntimeRecord | undefined {\n const parsed = startedSchema.safeParse(result);\n const outputs = parsed.success\n ? parsed.data.started.map((member) => member.outputs)\n : [];\n const switchboard = firstMatch(switchboardOutputsSchema, outputs);\n if (!switchboard) return undefined;\n const connect = firstMatch(connectOutputsSchema, outputs);\n return vetraRuntimeRecord({\n projectName,\n switchboardPort: portOf(switchboard.origin),\n // Vite may have taken another port, and the base path is Connect's.\n connectPort: connect ? portOf(connect.origin) : 0,\n switchboardUrl: switchboard.endpoints.graphql,\n mcpUrl: switchboard.endpoints.mcp,\n connectUrl: connect?.endpoints.connect,\n });\n}\n\n/**\n * Publishes the record of the stack startRun returned and syncs the MCP\n * configs to its port. Returns what clears the record again; it also runs on\n * exit. No SIGINT/SIGTERM handler: the compound owns the exit, and its\n * process.exit reaches the exit event.\n */\nexport function publishVetraRuntime(\n projectDir: string,\n projectName: string,\n result: unknown,\n): () => void {\n const record = vetraRecordOfRun(projectName, result);\n if (!record) {\n console.warn(\n yellow(\n \"No switchboard member is running, so .ph/vetra-runtime.json is not written and `ph mcp` will not find this stack.\",\n ),\n );\n return () => {};\n }\n // Record what the stack actually bound, so a second Vetra can tell a live\n // instance from a stale file, and so an agent can see the real ports.\n writeVetraRuntime(projectDir, record);\n // A restarted Vetra may already have written its own.\n const release = () => clearVetraRuntime(projectDir, process.pid);\n process.on(\"exit\", release);\n\n for (const notice of syncMcpPortNotices(projectDir, record.switchboardPort)) {\n console.log(yellow(notice));\n }\n return release;\n}\n"],"names":["z.object","z.array","z.unknown","switchboardOutputsSchema","connectOutputsSchema"],"mappings":";;;;;;;;;;;;;;;;;;;AA4BA,eAAsB,aAAa,MAAsC;CACvE,MAAM,OAAO,KAAK,QAAQ;CAE1B,IAAI,eAAe,IAA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aAAa,UAAU,OAAO,QAAQ,MAAM,IAAI;EAChD,gBAAgB,YAAY,UAAU;EACtC,QAAQ,YAAY,UAAU;EAC9B,YAAY,SAAS,UAAU;CACjC,CAAC;AACH;;;;;;;AAQA,SAAgB,oBACd,YACA,aACA,QACY;CACZ,MAAM,SAAS,iBAAiB,aAAa,MAAM;CACnD,IAAI,CAAC,QAAQ;EACX,QAAQ,KACN,OACE,mHACF,CACF;EACA,aAAa,CAAC;CAChB;CAGA,kBAAkB,YAAY,MAAM;CAEpC,MAAM,gBAAgB,kBAAkB,YAAY,QAAQ,GAAG;CAC/D,QAAQ,GAAG,QAAQ,OAAO;CAE1B,KAAK,MAAM,UAAU,mBAAmB,YAAY,OAAO,eAAe,GACxE,QAAQ,IAAI,OAAO,MAAM,CAAC;CAE5B,OAAO;AACT","debug_id":"cdc8cf4a-abf8-5310-9051-2002b9e69965"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"vetra-instance-CLUzbtbh.mjs","sources":["../src/utils/vetra-runtime.ts","../src/utils/vetra-instance.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 Vetra it started. `ph dev` and\n * `ph run vetra` 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","import { probeVetraRuntime } from \"./vetra-runtime.js\";\n\n/**\n * One Vetra per project. `ph run vetra` records its stack in\n * `.ph/run/vetra.json` and, once ready, in `.ph/vetra-runtime.json`, which is\n * what a start asks here: whether a Vetra already holds the project.\n */\n\n/** The host folder `ph dev` runs, and the name its host file carries. */\nexport const VETRA_HOST = \"vetra\";\n\n/** Why `ph run vetra` must not start: a live Vetra holds the project. */\nexport async function vetraRuntimeRefusal(\n projectDir: string,\n projectName: string,\n): Promise<string | undefined> {\n const probe = await probeVetraRuntime(projectDir, projectName);\n if (probe.status === \"live\" || probe.status === \"starting\") {\n if (probe.record.pid === process.pid) return undefined;\n return `Vetra is already running for this project (pid ${probe.record.pid}). Stop it before starting another.`;\n }\n if (probe.status === \"foreign\") {\n return (\n `.ph/vetra-runtime.json describes a live Vetra for \"${probe.record.projectName}\", ` +\n `but this project is \"${projectName}\". Refusing to start a second instance. ` +\n `Delete .ph/vetra-runtime.json if that record is wrong.`\n );\n }\n return undefined;\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;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,GACxC,QAAQ,KACN,4FACF;CAEF,OAAO;AACT;;;;;;;;;ACnOA,MAAa,aAAa;;AAG1B,eAAsB,oBACpB,YACA,aAC6B;CAC7B,MAAM,QAAQ,MAAM,kBAAkB,YAAY,WAAW;CAC7D,IAAI,MAAM,WAAW,UAAU,MAAM,WAAW,YAAY;EAC1D,IAAI,MAAM,OAAO,QAAQ,QAAQ,KAAK,OAAO,KAAA;EAC7C,OAAO,kDAAkD,MAAM,OAAO,IAAI;CAC5E;CACA,IAAI,MAAM,WAAW,WACnB,OACE,sDAAsD,MAAM,OAAO,YAAY,0BACvD,YAAY;AAK1C","debug_id":"aadcb52a-ac65-580b-ab60-f5a4cb86ecf0"}
@@ -1,4 +0,0 @@
1
- import { o as stopVetra } from "./vetra-launcher-Dq0tWyNW.mjs";
2
- export { stopVetra };
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]="8ea1e07b-cac2-51da-ac9b-e98678c19a89")}catch(e){}}();
4
- //# debugId=8ea1e07b-cac2-51da-ac9b-e98678c19a89
@@ -1 +0,0 @@
1
- {"version":3,"file":"vetra-launcher-Dq0tWyNW.mjs","sources":["../src/utils/vetra-launcher.ts"],"sourcesContent":["import { requestStop } from \"@powerhousedao/host-core\";\nimport { resolvePhDir } from \"@powerhousedao/shared/clis/ph-dir\";\nimport { spawn } from \"node:child_process\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { stripVTControlCharacters } from \"node:util\";\nimport { VETRA_HOST } from \"./vetra-instance.js\";\nimport {\n clearVetraRuntime,\n isPortInUse,\n probeVetraRuntime,\n type VetraRuntimeRecord,\n} from \"./vetra-runtime.js\";\n\nexport type VetraCommand = {\n command: string;\n args: string[];\n /** How messages name it; `ph run vetra` when left out. */\n label?: string;\n};\n\nexport type EnsureVetraOptions = {\n projectDir: string;\n projectName: string;\n /** The port a strict-port Vetra will bind. */\n switchboardPort: number;\n command: VetraCommand;\n timeoutMs: number;\n pollMs?: number;\n /** Told what it waits on while Vetra is not ready yet, about once a second. */\n onProgress?: (message: string) => void;\n};\n\nexport class VetraStartError extends Error {}\n\nconst LOG_TAIL_LINES = 60;\nconst PORT_GRACE_MS = 10_000;\nconst STOP_TIMEOUT_MS = 15_000;\nconst PROGRESS_EVERY_MS = 1000;\n\nconst lockPath = (projectDir: string) =>\n path.join(resolvePhDir(projectDir), \"vetra-start.lock\");\n\nexport const vetraLogPath = (projectDir: string) =>\n path.join(resolvePhDir(projectDir), \"vetra.log\");\n\n// Forward slashes, so messages read the same on every platform.\nconst shownLogPath = (projectDir: string) =>\n path.relative(projectDir, vetraLogPath(projectDir)).split(path.sep).join(\"/\");\n\n/**\n * What starts a project's Vetra: `ph run vetra --strictPort`, run by the\n * ph-cli executing this code. The host's own defaultVerb picks the verb. In\n * a project without the host it fails, and its output says why.\n */\nexport function currentPhCliRunVetraCommand(): VetraCommand {\n return {\n command: process.execPath,\n args: [process.argv[1], \"run\", VETRA_HOST, \"--strictPort\"],\n label: `ph run ${VETRA_HOST}`,\n };\n}\n\nfunction isPidAlive(pid: number | undefined): boolean {\n if (!pid) return false;\n try {\n process.kill(pid, 0);\n return true;\n } catch (error) {\n return (error as NodeJS.ErrnoException).code === \"EPERM\";\n }\n}\n\nconst sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));\n\ntype LockRecord = { pid: number; vetraPid?: number };\n\nfunction readLock(projectDir: string): LockRecord | undefined {\n try {\n return JSON.parse(\n fs.readFileSync(lockPath(projectDir), \"utf8\"),\n ) as LockRecord;\n } catch {\n return undefined;\n }\n}\n\nfunction isLockHeld(lock: LockRecord | undefined): boolean {\n return !!lock && (isPidAlive(lock.pid) || isPidAlive(lock.vetraPid));\n}\n\n/** Held while the launcher or the Vetra it started is alive. */\nfunction tryAcquireLock(projectDir: string): boolean {\n const target = lockPath(projectDir);\n fs.mkdirSync(path.dirname(target), { recursive: true });\n for (let attempt = 0; attempt < 2; attempt++) {\n try {\n fs.writeFileSync(target, JSON.stringify({ pid: process.pid }), {\n flag: \"wx\",\n });\n return true;\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== \"EEXIST\") throw error;\n if (isLockHeld(readLock(projectDir))) return false;\n fs.rmSync(target, { force: true });\n }\n }\n return false;\n}\n\nfunction releaseLock(projectDir: string): void {\n if (readLock(projectDir)?.pid === process.pid) {\n fs.rmSync(lockPath(projectDir), { force: true });\n }\n}\n\nexport function readLogTail(projectDir: string): string {\n try {\n const text = fs.readFileSync(vetraLogPath(projectDir), \"utf8\");\n const lines = stripVTControlCharacters(text).trimEnd().split(\"\\n\");\n return lines.slice(-LOG_TAIL_LINES).join(\"\\n\");\n } catch {\n return \"\";\n }\n}\n\nfunction withOutput(message: string, projectDir: string): VetraStartError {\n const tail = readLogTail(projectDir);\n const where = shownLogPath(projectDir);\n return new VetraStartError(\n tail\n ? `${message}\\n\\nVetra output (last lines of ${where}):\\n${tail}`\n : message,\n );\n}\n\nfunction foreignError(record: VetraRuntimeRecord): VetraStartError {\n return new VetraStartError(\n `.ph/vetra-runtime.json describes a live Vetra for \"${record.projectName}\" (pid ${record.pid}), not this project. ` +\n `Refusing to start a second reactor. Delete .ph/vetra-runtime.json if that record is wrong.`,\n );\n}\n\nasync function waitForLive(\n options: EnsureVetraOptions,\n deadline: number,\n stillStarting: () => boolean,\n): Promise<VetraRuntimeRecord | undefined> {\n const { projectDir, projectName, pollMs = 250, onProgress } = options;\n const startedAt = Date.now();\n let reportedAt = startedAt;\n while (Date.now() < deadline) {\n const probe = await probeVetraRuntime(projectDir, projectName);\n if (probe.status === \"live\") return probe.record;\n if (probe.status === \"foreign\") throw foreignError(probe.record);\n if (probe.status !== \"starting\" && !stillStarting()) return undefined;\n if (onProgress && Date.now() - reportedAt >= PROGRESS_EVERY_MS) {\n reportedAt = Date.now();\n const seconds = Math.round((reportedAt - startedAt) / 1000);\n onProgress(`Waiting for Vetra to be ready (${seconds}s)...`);\n }\n await sleep(pollMs);\n }\n return undefined;\n}\n\n/** This project's live Vetra, or a detached `ph run vetra` started and awaited; never a second reactor. */\nexport async function ensureVetra(\n options: EnsureVetraOptions,\n): Promise<VetraRuntimeRecord> {\n const { projectDir, projectName, switchboardPort, timeoutMs } = options;\n const deadline = Date.now() + timeoutMs;\n const seconds = Math.round(timeoutMs / 1000);\n const report = options.onProgress ?? (() => {});\n\n const probe = await probeVetraRuntime(projectDir, projectName);\n if (probe.status === \"live\") return probe.record;\n if (probe.status === \"foreign\") throw foreignError(probe.record);\n if (probe.status === \"starting\") {\n report(`Vetra (pid ${probe.record.pid}) is starting; waiting for it...`);\n const record = await waitForLive(options, deadline, () => false);\n if (record) return record;\n throw withOutput(\n `Vetra (pid ${probe.record.pid}) is running but did not answer /ready within ${seconds}s.`,\n projectDir,\n );\n }\n\n while (!tryAcquireLock(projectDir)) {\n // Another launcher is starting Vetra for this project.\n report(\"Another process is starting Vetra for this project; waiting...\");\n const record = await waitForLive(options, deadline, () =>\n isLockHeld(readLock(projectDir)),\n );\n if (record) return record;\n if (Date.now() >= deadline) {\n throw withOutput(\n `Another process is starting Vetra for this project and it did not become ready within ${seconds}s.`,\n projectDir,\n );\n }\n }\n\n let keepLock = false;\n try {\n const again = await probeVetraRuntime(projectDir, projectName);\n if (again.status === \"live\") return again.record;\n if (again.status === \"foreign\") throw foreignError(again.record);\n\n if (again.status === \"starting\" || (await isPortInUse(switchboardPort))) {\n // Maybe a Vetra that bound the port but has not written its record yet.\n const grace = Date.now() + PORT_GRACE_MS;\n const record = await waitForLive(\n options,\n deadline,\n () => Date.now() < grace,\n );\n if (record) return record;\n throw new VetraStartError(\n `Port ${switchboardPort} is in use, but .ph/vetra-runtime.json names no live Vetra for this project. ` +\n `Stop whatever holds the port, or move this project's port (reactor.port in powerhouse.config.json).`,\n );\n }\n\n const logFile = vetraLogPath(projectDir);\n report(`Starting Vetra; its output goes to ${shownLogPath(projectDir)}...`);\n const logFd = fs.openSync(logFile, \"w\");\n let exit: { code: number | null; signal: string | null } | undefined;\n let spawnError: Error | undefined;\n const child = spawn(options.command.command, options.command.args, {\n cwd: projectDir,\n detached: true,\n stdio: [\"ignore\", logFd, logFd],\n windowsHide: true,\n });\n fs.closeSync(logFd);\n child.once(\"error\", (error) => (spawnError = error));\n child.once(\"exit\", (code, signal) => (exit = { code, signal }));\n child.unref();\n if (child.pid) {\n fs.writeFileSync(\n lockPath(projectDir),\n JSON.stringify({ pid: process.pid, vetraPid: child.pid }),\n );\n }\n\n const record = await waitForLive(\n options,\n deadline,\n () => !exit && !spawnError,\n );\n if (record) return record;\n\n if (spawnError) {\n throw new VetraStartError(\n `Could not run \\`${options.command.command}\\`: ${spawnError.message}`,\n );\n }\n if (exit) {\n const how =\n exit.signal !== null\n ? `was killed by ${exit.signal}`\n : `exited with code ${exit.code}`;\n throw withOutput(\n `\\`${options.command.label ?? `ph run ${VETRA_HOST}`}\\` ${how} before it was ready.`,\n projectDir,\n );\n }\n // Still booting: keep the lock on its pid so the next call waits instead of spawning.\n keepLock = true;\n throw withOutput(\n `Vetra (pid ${child.pid}) did not answer /ready on port ${switchboardPort} within ${seconds}s. ` +\n `It is still running; the next tool call waits for it again.`,\n projectDir,\n );\n } finally {\n if (!keepLock) releaseLock(projectDir);\n }\n}\n\nasync function waitForExit(\n record: VetraRuntimeRecord,\n deadline: number,\n): Promise<boolean> {\n while (Date.now() < deadline) {\n const gone =\n !isPidAlive(record.pid) && !(await isPortInUse(record.switchboardPort));\n if (gone) return true;\n await sleep(100);\n }\n return false;\n}\n\n/** Stops this project's running Vetra, if any; resolves to the record it stopped. */\nexport async function stopVetra(options: {\n projectDir: string;\n projectName: string;\n timeoutMs?: number;\n onProgress?: (message: string) => void;\n}): Promise<VetraRuntimeRecord | undefined> {\n const { projectDir, projectName, timeoutMs = STOP_TIMEOUT_MS } = options;\n const probe = await probeVetraRuntime(projectDir, projectName);\n if (probe.status === \"foreign\") throw foreignError(probe.record);\n if (probe.status !== \"live\" && probe.status !== \"starting\") return undefined;\n const { record } = probe;\n const signal = (name: NodeJS.Signals) => {\n try {\n process.kill(record.pid, name);\n } catch {\n // Already gone.\n }\n };\n options.onProgress?.(`Stopping Vetra (pid ${record.pid})...`);\n // On Windows SIGTERM is a kill: ask through the stop channel, and signal\n // only a Vetra that has none.\n if (!(await requestStop(record.pid))) signal(\"SIGTERM\");\n if (!(await waitForExit(record, Date.now() + timeoutMs))) {\n signal(\"SIGKILL\");\n if (!(await waitForExit(record, Date.now() + timeoutMs))) {\n throw new VetraStartError(\n `Vetra (pid ${record.pid}) did not stop within ${Math.round((2 * timeoutMs) / 1000)}s.`,\n );\n }\n }\n clearVetraRuntime(projectDir, record.pid);\n if (readLock(projectDir)?.vetraPid === record.pid) {\n fs.rmSync(lockPath(projectDir), { force: true });\n }\n return record;\n}\n\n/** Stops this project's Vetra and starts it again, detached, as {@link ensureVetra} does. */\nexport async function restartVetra(\n options: EnsureVetraOptions,\n): Promise<VetraRuntimeRecord> {\n const { projectDir, projectName, onProgress } = options;\n const stopped = await stopVetra({ projectDir, projectName, onProgress });\n if (stopped) onProgress?.(`Stopped Vetra (pid ${stopped.pid}).`);\n return ensureVetra(options);\n}\n"],"names":[],"mappings":";;;;;;;;;;AAiCA,IAAa,kBAAb,cAAqC,MAAM,CAAC;AAG5C,MAAM,gBAAgB;AACtB,MAAM,kBAAkB;AACxB,MAAM,oBAAoB;AAE1B,MAAM,YAAY,eAChB,KAAK,KAAK,aAAa,UAAU,GAAG,kBAAkB;AAExD,MAAa,gBAAgB,eAC3B,KAAK,KAAK,aAAa,UAAU,GAAG,WAAW;AAGjD,MAAM,gBAAgB,eACpB,KAAK,SAAS,YAAY,aAAa,UAAU,CAAC,CAAC,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG;;;;;;AAO9E,SAAgB,8BAA4C;CAC1D,OAAO;EACL,SAAS,QAAQ;EACjB,MAAM;GA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,WAAW;CACnB,MAAM,UAAU,SAAyB;EACvC,IAAI;GACF,QAAQ,KAAK,OAAO,KAAK,IAAI;EAC/B,QAAQ,CAER;CACF;CACA,QAAQ,aAAa,uBAAuB,OAAO,IAAI,KAAK;CAG5D,IAAI,CAAE,MAAM,YAAY,OAAO,GAAG,GAAI,OAAO,SAAS;CACtD,IAAI,CAAE,MAAM,YAAY,QAAQ,KAAK,IAAI,IAAI,SAAS,GAAI;EACxD,OAAO,SAAS;EAChB,IAAI,CAAE,MAAM,YAAY,QAAQ,KAAK,IAAI,IAAI,SAAS,GACpD,MAAM,IAAI,gBACR,cAAc,OAAO,IAAI,wBAAwB,KAAK,MAAO,IAAI,YAAa,GAAI,EAAE,GACtF;CAEJ;CACA,kBAAkB,YAAY,OAAO,GAAG;CACxC,IAAI,SAAS,UAAU,CAAC,EAAE,aAAa,OAAO,KAC5C,GAAG,OAAO,SAAS,UAAU,GAAG,EAAE,OAAO,KAAK,CAAC;CAEjD,OAAO;AACT;;AAGA,eAAsB,aACpB,SAC6B;CAC7B,MAAM,EAAE,YAAY,aAAa,eAAe;CAChD,MAAM,UAAU,MAAM,UAAU;EAAE;EAAY;EAAa;CAAW,CAAC;CACvE,IAAI,SAAS,aAAa,sBAAsB,QAAQ,IAAI,GAAG;CAC/D,OAAO,YAAY,OAAO;AAC5B","debug_id":"65ce43c7-1403-5a81-b34e-0e82d25546ca"}
@@ -1,19 +0,0 @@
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]="8f90996d-2865-5564-b0aa-35c99867095d")}catch(e){}}();
3
- import { lintSubgraphTypes } from "@powerhousedao/vetra/codegen";
4
- //#region src/utils/warn-subgraph-type-conflicts.ts
5
- async function warnSubgraphTypeConflicts(projectDir) {
6
- let warnings;
7
- try {
8
- warnings = await lintSubgraphTypes(projectDir);
9
- } catch (error) {
10
- console.warn("⚠ Failed to check subgraph type names:", error);
11
- return;
12
- }
13
- for (const warning of warnings) console.warn(`⚠ ${warning}`);
14
- }
15
- //#endregion
16
- export { warnSubgraphTypeConflicts as t };
17
-
18
- //# sourceMappingURL=warn-subgraph-type-conflicts-BOHBmThq.mjs.map
19
- //# debugId=8f90996d-2865-5564-b0aa-35c99867095d
@@ -1 +0,0 @@
1
- {"version":3,"file":"warn-subgraph-type-conflicts-BOHBmThq.mjs","sources":["../src/utils/warn-subgraph-type-conflicts.ts"],"sourcesContent":["import { lintSubgraphTypes } from \"@powerhousedao/vetra/codegen\";\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":";;;;AAEA,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":"8f90996d-2865-5564-b0aa-35c99867095d"}