@powerhousedao/ph-cli 6.2.3-staging.0 → 6.3.0-dev.1

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 (191) hide show
  1. package/README.md +21 -0
  2. package/dist/build-1BN9BD49.mjs +4 -0
  3. package/dist/build-CWm9MOFJ.mjs +3063 -0
  4. package/dist/build-CWm9MOFJ.mjs.map +1 -0
  5. package/dist/check-BZOXiSys.mjs +4 -0
  6. package/dist/check-C9kQub0h.mjs +81 -0
  7. package/dist/check-C9kQub0h.mjs.map +1 -0
  8. package/dist/check-D0b-uWwK.mjs +65 -0
  9. package/dist/check-D0b-uWwK.mjs.map +1 -0
  10. package/dist/classic-args-mH_DVsgC.mjs +48 -0
  11. package/dist/classic-args-mH_DVsgC.mjs.map +1 -0
  12. package/dist/classic-warnings-kQsFGSeA.mjs +179 -0
  13. package/dist/classic-warnings-kQsFGSeA.mjs.map +1 -0
  14. package/dist/{cli-connect-override-b4kKqgOZ.mjs → cli-connect-override-31gBnNxd.mjs} +6 -29
  15. package/dist/cli-connect-override-31gBnNxd.mjs.map +1 -0
  16. package/dist/cli.mjs +46 -1341
  17. package/dist/cli.mjs.map +1 -1
  18. package/dist/compound-CDrU3CLt-gW8JNJQK.mjs +2910 -0
  19. package/dist/compound-CDrU3CLt-gW8JNJQK.mjs.map +1 -0
  20. package/dist/connect-build-is3cmf0E.mjs +322 -0
  21. package/dist/connect-build-is3cmf0E.mjs.map +1 -0
  22. package/dist/{connect-config-_kiSMsbG.mjs → connect-config-Dj3E8CaW.mjs} +5 -5
  23. package/dist/{connect-config-_kiSMsbG.mjs.map → connect-config-Dj3E8CaW.mjs.map} +1 -1
  24. package/dist/connect-preview-CdFvlANO.mjs +49 -0
  25. package/dist/connect-preview-CdFvlANO.mjs.map +1 -0
  26. package/dist/{connect-studio-f3K1qPWd.mjs → connect-studio-BNSe_8PI.mjs} +3 -3
  27. package/dist/connect-studio-CBtduPet.mjs +94 -0
  28. package/dist/connect-studio-CBtduPet.mjs.map +1 -0
  29. package/dist/definitions-worker.d.mts +98 -0
  30. package/dist/definitions-worker.d.mts.map +1 -0
  31. package/dist/definitions-worker.mjs +28 -0
  32. package/dist/definitions-worker.mjs.map +1 -0
  33. package/dist/dist-seTzvoSw.mjs +480 -0
  34. package/dist/dist-seTzvoSw.mjs.map +1 -0
  35. package/dist/evidence-CavwC5YV.mjs +134 -0
  36. package/dist/evidence-CavwC5YV.mjs.map +1 -0
  37. package/dist/explain-DTa32gEY.mjs +230 -0
  38. package/dist/explain-DTa32gEY.mjs.map +1 -0
  39. package/dist/export-YEBE-Gvl.mjs +42 -0
  40. package/dist/export-YEBE-Gvl.mjs.map +1 -0
  41. package/dist/external-M25AgDIE.d.mts +4277 -0
  42. package/dist/external-M25AgDIE.d.mts.map +1 -0
  43. package/dist/files-D6_euBBn.mjs +457 -0
  44. package/dist/files-D6_euBBn.mjs.map +1 -0
  45. package/dist/{generate-all-CIwP-3aa.mjs → generate-all-DKuaLgz1.mjs} +10 -5
  46. package/dist/generate-all-DKuaLgz1.mjs.map +1 -0
  47. package/dist/generate-app-hm6CJ_4O.mjs +72 -0
  48. package/dist/generate-app-hm6CJ_4O.mjs.map +1 -0
  49. package/dist/generate-desktop-shell-Dh9_bhLa.mjs +372 -0
  50. package/dist/generate-desktop-shell-Dh9_bhLa.mjs.map +1 -0
  51. package/dist/generate-document-model-OQPfeHs-.mjs +118 -0
  52. package/dist/generate-document-model-OQPfeHs-.mjs.map +1 -0
  53. package/dist/generate-editor-DBj_Pxwa.mjs +64 -0
  54. package/dist/generate-editor-DBj_Pxwa.mjs.map +1 -0
  55. package/dist/generate-hosts-BFmPIW2X.mjs +18 -0
  56. package/dist/generate-hosts-BFmPIW2X.mjs.map +1 -0
  57. package/dist/generate-hosts-RWj7WPHZ.mjs +4 -0
  58. package/dist/generate-migration-file-yK8uA70U.mjs +20 -0
  59. package/dist/generate-migration-file-yK8uA70U.mjs.map +1 -0
  60. package/dist/{generate-piece-QTt-ddt2.mjs → generate-piece-5Nyr2UZj.mjs} +18 -10
  61. package/dist/generate-piece-5Nyr2UZj.mjs.map +1 -0
  62. package/dist/{generate-piece-action-C5WTHsqu.mjs → generate-piece-action-DqR8BcoO.mjs} +10 -7
  63. package/dist/generate-piece-action-DqR8BcoO.mjs.map +1 -0
  64. package/dist/{generate-piece-trigger-DR10CPOG.mjs → generate-piece-trigger-CZaDD-cc.mjs} +8 -7
  65. package/dist/generate-piece-trigger-CZaDD-cc.mjs.map +1 -0
  66. package/dist/{generate-processor-DBtTkgo5.mjs → generate-processor-BVjOsfjJ.mjs} +20 -9
  67. package/dist/generate-processor-BVjOsfjJ.mjs.map +1 -0
  68. package/dist/generate-subgraph-DJZCr0Tk.mjs +86 -0
  69. package/dist/generate-subgraph-DJZCr0Tk.mjs.map +1 -0
  70. package/dist/get-version-CrerlHgg.mjs +11 -0
  71. package/dist/get-version-CrerlHgg.mjs.map +1 -0
  72. package/dist/index-Dy3U1WqW.d.mts +192 -0
  73. package/dist/index-Dy3U1WqW.d.mts.map +1 -0
  74. package/dist/{init-CIEMyAug.mjs → init-CJB6RiIy.mjs} +23 -13
  75. package/dist/init-CJB6RiIy.mjs.map +1 -0
  76. package/dist/inspect-CulIpVsF.mjs +52 -0
  77. package/dist/inspect-CulIpVsF.mjs.map +1 -0
  78. package/dist/{inspect-BpCB0TPo.mjs → inspect-zWJnBDMJ.mjs} +4 -4
  79. package/dist/{inspect-BpCB0TPo.mjs.map → inspect-zWJnBDMJ.mjs.map} +1 -1
  80. package/dist/install-added-dependencies-DnZFR3aE.mjs +18 -0
  81. package/dist/install-added-dependencies-DnZFR3aE.mjs.map +1 -0
  82. package/dist/keyframes-bFo9iDhT.mjs +201 -0
  83. package/dist/keyframes-bFo9iDhT.mjs.map +1 -0
  84. package/dist/mcp-DJKiREkL.mjs +263 -0
  85. package/dist/mcp-DJKiREkL.mjs.map +1 -0
  86. package/dist/migrate-Bg-HBsYa.mjs +208 -0
  87. package/dist/migrate-Bg-HBsYa.mjs.map +1 -0
  88. package/dist/migrate-subgraphs-Bm3zpsO9.mjs +214 -0
  89. package/dist/migrate-subgraphs-Bm3zpsO9.mjs.map +1 -0
  90. package/dist/migrate-subgraphs-De_rX4Hv.mjs +4 -0
  91. package/dist/module-dir-1avCXsBi.mjs +17 -0
  92. package/dist/module-dir-1avCXsBi.mjs.map +1 -0
  93. package/dist/npm-args-g1Tgel4s.mjs +78 -0
  94. package/dist/npm-args-g1Tgel4s.mjs.map +1 -0
  95. package/dist/offered-routes-imports-CQInWI6y.mjs +4 -0
  96. package/dist/offered-routes-imports-CalXK9dh.mjs +96 -0
  97. package/dist/offered-routes-imports-CalXK9dh.mjs.map +1 -0
  98. package/dist/ph-cli-commands-C6cJJQlA.mjs +1787 -0
  99. package/dist/ph-cli-commands-C6cJJQlA.mjs.map +1 -0
  100. package/dist/ph-cli-commands-CCCVUIzM.mjs +4 -0
  101. package/dist/render-3M3DwFzO.mjs +4 -0
  102. package/dist/render-SVfj3m8A.mjs +77 -0
  103. package/dist/render-SVfj3m8A.mjs.map +1 -0
  104. package/dist/run--de_-WAz.mjs +112 -0
  105. package/dist/run--de_-WAz.mjs.map +1 -0
  106. package/dist/run-LRGy7zGo.mjs +4 -0
  107. package/dist/run-sugar-ByAIbE2x.mjs +56 -0
  108. package/dist/run-sugar-ByAIbE2x.mjs.map +1 -0
  109. package/dist/runners/connect.d.mts +17 -0
  110. package/dist/runners/connect.d.mts.map +1 -0
  111. package/dist/runners/connect.mjs +83 -0
  112. package/dist/runners/connect.mjs.map +1 -0
  113. package/dist/runners/switchboard.d.mts +24 -0
  114. package/dist/runners/switchboard.d.mts.map +1 -0
  115. package/dist/runners/switchboard.mjs +178 -0
  116. package/dist/runners/switchboard.mjs.map +1 -0
  117. package/dist/schemas-DzgKfQIx.mjs +6024 -0
  118. package/dist/schemas-DzgKfQIx.mjs.map +1 -0
  119. package/dist/scripts/emit-runner-schemas.ts +24 -0
  120. package/dist/scripts/generate-commands-docs.ts +19 -0
  121. package/dist/scripts/manage-environment +0 -0
  122. package/dist/scripts/setup.sh +0 -0
  123. package/dist/subgraph-gate-BJ2PWXVY.mjs +26 -0
  124. package/dist/subgraph-gate-BJ2PWXVY.mjs.map +1 -0
  125. package/dist/subgraph-gate-j9ywj6KA.mjs +4 -0
  126. package/dist/subgraphs-7OYWwP-C.mjs +134 -0
  127. package/dist/subgraphs-7OYWwP-C.mjs.map +1 -0
  128. package/dist/{switchboard-migrate-7JQZM7-5.mjs → switchboard-migrate-BqSdKJ7u.mjs} +4 -5
  129. package/dist/switchboard-migrate-BqSdKJ7u.mjs.map +1 -0
  130. package/dist/switchboard-proxy-CGfMtENM.mjs +37 -0
  131. package/dist/switchboard-proxy-CGfMtENM.mjs.map +1 -0
  132. package/dist/{switchboard-reset-Ctegiqdm.mjs → switchboard-reset-MtTB_GAI.mjs} +8 -6
  133. package/dist/switchboard-reset-MtTB_GAI.mjs.map +1 -0
  134. package/dist/sync-connect-routes-BtAsFPXN.mjs +4 -0
  135. package/dist/sync-connect-routes-t0Slg-P6.mjs +25 -0
  136. package/dist/sync-connect-routes-t0Slg-P6.mjs.map +1 -0
  137. package/dist/{utils-CvmDmCVd.mjs → utils-9KyRM0mf.mjs} +6 -34
  138. package/dist/{utils-CvmDmCVd.mjs.map → utils-9KyRM0mf.mjs.map} +1 -1
  139. package/dist/utils-TO9lB8Xs.mjs +4 -0
  140. package/dist/verify-CIWOkZZV.mjs +71 -0
  141. package/dist/verify-CIWOkZZV.mjs.map +1 -0
  142. package/dist/vetra-CmTg8Lja.mjs +351 -0
  143. package/dist/vetra-CmTg8Lja.mjs.map +1 -0
  144. package/dist/vetra-host-C0Q0oMUW.mjs +79 -0
  145. package/dist/vetra-host-C0Q0oMUW.mjs.map +1 -0
  146. package/dist/vetra-instance-B0bXPj7g.mjs +201 -0
  147. package/dist/vetra-instance-B0bXPj7g.mjs.map +1 -0
  148. package/dist/vetra-launch-T_uLKaR3.mjs +236 -0
  149. package/dist/vetra-launch-T_uLKaR3.mjs.map +1 -0
  150. package/dist/vetra-switchboard-BrkozIm7.mjs +4 -0
  151. package/dist/vetra-switchboard-tzdc14KA.mjs +230 -0
  152. package/dist/vetra-switchboard-tzdc14KA.mjs.map +1 -0
  153. package/dist/warn-subgraph-type-conflicts-BOHBmThq.mjs +19 -0
  154. package/dist/warn-subgraph-type-conflicts-BOHBmThq.mjs.map +1 -0
  155. package/package.json +40 -14
  156. package/dist/build-CTvPQFMi.mjs +0 -4
  157. package/dist/build-sO3PcZxl.mjs +0 -166
  158. package/dist/build-sO3PcZxl.mjs.map +0 -1
  159. package/dist/cli-connect-override-b4kKqgOZ.mjs.map +0 -1
  160. package/dist/connect-build-BMaR9w4G.mjs +0 -153
  161. package/dist/connect-build-BMaR9w4G.mjs.map +0 -1
  162. package/dist/connect-preview-CzDqR-JN.mjs +0 -32
  163. package/dist/connect-preview-CzDqR-JN.mjs.map +0 -1
  164. package/dist/connect-studio-_-O1-oef.mjs +0 -36
  165. package/dist/connect-studio-_-O1-oef.mjs.map +0 -1
  166. package/dist/generate-all-CIwP-3aa.mjs.map +0 -1
  167. package/dist/generate-app-BTs1u-9l.mjs +0 -50
  168. package/dist/generate-app-BTs1u-9l.mjs.map +0 -1
  169. package/dist/generate-document-model-DhDQ_06X.mjs +0 -44
  170. package/dist/generate-document-model-DhDQ_06X.mjs.map +0 -1
  171. package/dist/generate-editor-CW7Do69u.mjs +0 -50
  172. package/dist/generate-editor-CW7Do69u.mjs.map +0 -1
  173. package/dist/generate-piece-QTt-ddt2.mjs.map +0 -1
  174. package/dist/generate-piece-action-C5WTHsqu.mjs.map +0 -1
  175. package/dist/generate-piece-trigger-DR10CPOG.mjs.map +0 -1
  176. package/dist/generate-processor-DBtTkgo5.mjs.map +0 -1
  177. package/dist/generate-subgraph-Dm27O59o.mjs +0 -42
  178. package/dist/generate-subgraph-Dm27O59o.mjs.map +0 -1
  179. package/dist/init-CIEMyAug.mjs.map +0 -1
  180. package/dist/install-added-dependencies-DVSbzler.mjs +0 -33
  181. package/dist/install-added-dependencies-DVSbzler.mjs.map +0 -1
  182. package/dist/migrate-B6QBYDNX.mjs +0 -83
  183. package/dist/migrate-B6QBYDNX.mjs.map +0 -1
  184. package/dist/switchboard-CgVB4U76.mjs +0 -87
  185. package/dist/switchboard-CgVB4U76.mjs.map +0 -1
  186. package/dist/switchboard-migrate-7JQZM7-5.mjs.map +0 -1
  187. package/dist/switchboard-nHCI3pha.mjs +0 -4
  188. package/dist/switchboard-reset-Ctegiqdm.mjs.map +0 -1
  189. package/dist/utils-C3c5YG6v.mjs +0 -4
  190. package/dist/vetra-s8gWslse.mjs +0 -627
  191. package/dist/vetra-s8gWslse.mjs.map +0 -1
package/dist/cli.mjs CHANGED
@@ -1,24 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c3a1dfab-bfc7-5154-b9b2-43ce4f1fcb86")}catch(e){}}();
4
- import { n as skipInstallArgs } from "./install-added-dependencies-DVSbzler.mjs";
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]="aa38e5db-5dbe-5933-859e-76cf696ddca8")}catch(e){}}();
4
+ import { t as getVersion } from "./get-version-CrerlHgg.mjs";
5
+ import { t as phCliCommands } from "./ph-cli-commands-C6cJJQlA.mjs";
5
6
  import { initCliTelemetry } from "@powerhousedao/shared/clis/telemetry";
6
7
  import { assertNodeVersion } from "@powerhousedao/shared/clis/utils";
7
- import { boolean, command, flag, multioption, oneOf, option, optional, positional, run, string, subcommands } from "cmd-ts";
8
- import { AGENTS, accessTokenArgs, buildArgs, connectBuildArgs, connectConfigArgs, connectPreviewArgs, connectStudioArgs, debugArgs, initArgs, inspectArgs, installArgs, listArgs, loginArgs, migrateArgs, phCliHelpCommands, publishArgs, registryLoginArgs, switchboardArgs, uninstallArgs, unpublishArgs, vetraArgs } from "@powerhousedao/shared/clis/args";
9
- import { DEFAULT_EXPIRY_SECONDS } from "@powerhousedao/shared/clis/constants";
10
- import { Directory, File } from "cmd-ts/dist/cjs/batteries/fs.js";
11
- import path from "path";
12
- import { execSync } from "node:child_process";
13
- import { PROCESSOR_APPS } from "@powerhousedao/shared/processors";
14
- import { execSync as execSync$1 } from "child_process";
15
- import { createInterface } from "node:readline/promises";
8
+ import { run, runSafely, subcommands } from "cmd-ts";
9
+ import { phCliHelpCommands } from "@powerhousedao/shared/clis/args";
16
10
  import { bold, yellow } from "colorette";
17
- //#region src/get-version.ts
18
- function getVersion() {
19
- return "6.2.3-staging.0";
20
- }
21
- //#endregion
22
11
  //#region src/utils/constants.ts
23
12
  const PH_CLI_DESCRIPTION = "The Powerhouse CLI (ph-cli) is a command-line interface tool that provides essential commands for managing Powerhouse projects. The tool and it's commands are fundamental for creating, building, and running Document Models as a builder in studio mode.";
24
13
  //#endregion
@@ -31,1327 +20,6 @@ const phCliHelp = subcommands({
31
20
  cmds: phCliHelpCommands
32
21
  });
33
22
  //#endregion
34
- //#region src/commands/access-token.ts
35
- const accessToken = command({
36
- name: "access-token",
37
- description: `
38
- The access-token command generates a bearer token for API authentication. This token
39
- can be used to authenticate requests to Powerhouse APIs like reactor-api (Switchboard).
40
-
41
- This command:
42
- 1. Uses your CLI's cryptographic identity (DID) to sign a verifiable credential
43
- 2. Creates a JWT bearer token with configurable expiration
44
- 3. Outputs the token to stdout (info to stderr) for easy piping
45
-
46
- Prerequisites:
47
- You must have a cryptographic identity. Run 'ph login' first to:
48
- - Generate a keypair (stored in .ph/.keypair.json)
49
- - Optionally link your Ethereum address (stored in .ph/.renown.json)
50
-
51
- Token Details:
52
- The generated token is a JWT (JSON Web Token) containing:
53
- - Issuer (iss): Your CLI's DID (did:key:...)
54
- - Subject (sub): Your CLI's DID
55
- - Credential Subject: Chain ID, network ID, and address (if authenticated)
56
- - Expiration (exp): Based on --expiry option
57
- - Audience (aud): If --audience is specified
58
-
59
- Output:
60
- - Token information (DID, address, expiry) is printed to stderr
61
- - The token itself is printed to stdout for easy piping/copying
62
-
63
- This allows you to use the command in scripts:
64
- TOKEN=$(ph access-token)
65
- curl -H "Authorization: Bearer $TOKEN" http://localhost:4001/graphql
66
-
67
- Usage with APIs:
68
- Generate token and use with curl
69
- TOKEN=$(ph access-token --expiry 1d)
70
- curl -X POST http://localhost:4001/graphql \\
71
- -H "Content-Type: application/json" \\
72
- -H "Authorization: Bearer $TOKEN" \\
73
- -d '{"query": "{ drives { id name } }"}'
74
-
75
- Export as environment variable
76
- export PH_ACCESS_TOKEN=$(ph access-token)
77
-
78
- Notes:
79
- - Tokens are self-signed using your CLI's private key
80
- - No network request is made; tokens are generated locally
81
- - The recipient API must trust your CLI's DID to accept the token
82
- - For reactor-api, ensure AUTH_ENABLED=true to require authentication
83
- `,
84
- args: accessTokenArgs,
85
- handler: async (args) => {
86
- if (args.debug) console.log(args);
87
- const { generateAccessToken, parseExpiry, formatExpiry } = await import("@renown/sdk/node");
88
- const { getRenown } = await import("./auth-CNhbN5UM.mjs");
89
- const renown = await getRenown();
90
- let expiresIn = DEFAULT_EXPIRY_SECONDS;
91
- if (args.expiry) expiresIn = parseExpiry(args.expiry);
92
- const result = await generateAccessToken(renown, {
93
- expiresIn,
94
- aud: args.audience
95
- });
96
- console.error(`CLI DID: ${result.did}`);
97
- console.error(`ETH Address: ${result.address}`);
98
- console.error(`Token expires in: ${formatExpiry(expiresIn)}`);
99
- console.error("");
100
- console.log(result.token);
101
- process.exit(0);
102
- }
103
- });
104
- //#endregion
105
- //#region src/commands/build.ts
106
- const build$1 = command({
107
- name: "build",
108
- description: `
109
- Build a Powerhouse package for publishing: a browser bundle and a node bundle of its
110
- document models, editors, subgraphs and processors, type declarations, and its stylesheet.
111
-
112
- Pieces under pieces/ are built too, each into its own self-contained module under
113
- dist/node/pieces/<name>, with a descriptor.json and package.json written beside it and
114
- the piece listed in dist/powerhouse.manifest.json. A piece takes the package's version: an
115
- entry in pieces/index.ts that declares version fails the build. A package that ships only
116
- pieces is an ordinary package: it carries the same boilerplate, and every step above runs
117
- for it too.
118
-
119
- tsc runs first. If it reports type errors the build asks whether to go ahead, and stops
120
- where it can't ask. --ignore-type-errors builds without asking; a package built that way
121
- can load and still fail at runtime, so don't publish it.`,
122
- args: buildArgs,
123
- handler: async (args) => {
124
- if (args.debug) console.log(args);
125
- try {
126
- const { runBuild } = await import("./build-CTvPQFMi.mjs");
127
- await runBuild(args);
128
- } catch (error) {
129
- console.error(error);
130
- process.exit(1);
131
- }
132
- }
133
- });
134
- //#endregion
135
- //#region src/commands/connect.ts
136
- const studio = command({
137
- name: "studio",
138
- description: `The studio command starts the Connect Studio, a development environment for building
139
- and testing Powerhouse applications. It provides a visual interface for working with
140
- your project.
141
-
142
- This command:
143
- 1. Starts a local Connect Studio server
144
- 2. Provides a web interface for development
145
- 3. Allows you to interact with your project components
146
- 4. Supports various configuration options for customization
147
- `,
148
- args: connectStudioArgs,
149
- handler: async (args) => {
150
- if (args.debug) console.log(args);
151
- const { runConnectStudio } = await import("./connect-studio-f3K1qPWd.mjs");
152
- await runConnectStudio(args);
153
- }
154
- });
155
- const build = command({
156
- name: "build",
157
- description: `The Connect build command creates a production build with the project's local and
158
- external packages included.
159
-
160
- Runtime-config overrides (all combinable — last wins on collision):
161
- ph connect build Build with the current source config.
162
- ph connect build <key> <value> Build with a positional override applied (e.g. ph connect build connect.renown.url https://renown.staging).
163
- ph connect build --<field> <value> Build with a per-field flag override (e.g. --renown-url https://renown.staging).
164
- ph connect build --json '{"app":{"workflowsEnabled":true}}'
165
- Build with a bulk override. The payload is the connect.* block
166
- without the "connect" wrapper; unknown keys are rejected.
167
-
168
- Build has no read mode; passing only <key> without <value> errors out (use \`ph connect config <key>\` to read).
169
- `,
170
- args: connectBuildArgs,
171
- handler: async (args) => {
172
- if (args.debug) console.log(args);
173
- const { runConnectBuild } = await import("./connect-build-BMaR9w4G.mjs");
174
- await runConnectBuild(args);
175
- process.exit(0);
176
- }
177
- });
178
- const preview = command({
179
- name: "preview",
180
- description: `The Connect preview command previews a built Connect project.
181
- NOTE: You must run \`ph connect build\` first
182
- `,
183
- args: connectPreviewArgs,
184
- handler: async (args) => {
185
- if (args.debug) console.log(args);
186
- const { runConnectPreview } = await import("./connect-preview-CzDqR-JN.mjs");
187
- await runConnectPreview(args);
188
- }
189
- });
190
- const config = command({
191
- name: "config",
192
- description: `Read or update Connect's runtime configuration (powerhouse.config.json).
193
-
194
- Modes (mutually exclusive — positional, --get, --json, and field flags cannot be combined):
195
- ph connect config List the effective connect.* block (defaults < source).
196
- ph connect config <key> Get the value at the dotted path (e.g. ph connect config connect.renown.url).
197
- ph connect config --get <dotted.path> Same as positional <key> (kept for backward compat).
198
- ph connect config <key> <value> Set a single field and dual-write to source + dist (positional).
199
- ph connect config --<field> <value> Set a single field via per-field flag (e.g. --renown-url https://renown.id).
200
- ph connect config --json '{"renown":{"url":"…"}}'
201
- Bulk-set multiple fields and dual-write. The payload is the connect.*
202
- block without the "connect" wrapper; unknown keys are rejected.
203
-
204
- Writes go to:
205
- - <project>/powerhouse.config.json (source — picked up by the next build)
206
- - <dist-dir>/powerhouse.config.json (if it exists — the currently-served SPA picks it up on refresh)
207
- `,
208
- args: connectConfigArgs,
209
- handler: async (args) => {
210
- const { runConnectConfig } = await import("./connect-config-_kiSMsbG.mjs");
211
- await runConnectConfig(args);
212
- }
213
- });
214
- const connect = subcommands({
215
- name: "connect",
216
- description: `Powerhouse Connect commands. Use with \`studio\`, \`build\`, \`preview\`, or \`config\`. Defaults to \`studio\` if not specified.`,
217
- cmds: {
218
- studio,
219
- build,
220
- preview,
221
- config
222
- }
223
- });
224
- //#endregion
225
- //#region src/commands/generate-all.ts
226
- const generateAllCmd = command({
227
- name: "all",
228
- description: "Re-generate all modules in the current project",
229
- args: { extract: flag({
230
- long: "extract",
231
- short: "x",
232
- description: "Instead of generating code, write a spec for every module into specs/ (one-shot migration to documents-as-source-of-truth)"
233
- }) },
234
- handler: async (args) => {
235
- const { startGenerateAll } = await import("./generate-all-CIwP-3aa.mjs");
236
- await startGenerateAll(args, process.cwd());
237
- process.exit(0);
238
- }
239
- });
240
- //#endregion
241
- //#region src/utils/comma-separated.ts
242
- /** Splits comma-separated values so `-t "a,b"` means the same as `-t a -t b`
243
- * instead of yielding the single value `"a,b"`, which matches nothing. */
244
- function splitCommaSeparated(values) {
245
- return values.flatMap((value) => value.split(",")).map((value) => value.trim()).filter((value) => value.length > 0);
246
- }
247
- /** `multioption` type accepting repeated and/or comma-separated values. */
248
- const CommaSeparatedStrings = { from: (values) => Promise.resolve(splitCommaSeparated(values)) };
249
- //#endregion
250
- //#region src/commands/generate-app.ts
251
- const generateAppCmd = command({
252
- name: "app",
253
- description: "Generate a drive app",
254
- args: {
255
- name: option({
256
- type: optional(string),
257
- long: "name",
258
- short: "n",
259
- description: "The name of the drive app to generate"
260
- }),
261
- allowedDocumentTypes: multioption({
262
- type: optional(CommaSeparatedStrings),
263
- long: "document-types",
264
- short: "t",
265
- description: "The document types allowed by the new app (repeatable or comma-separated)"
266
- }),
267
- document: option({
268
- type: optional(File),
269
- long: "document",
270
- short: "d",
271
- description: "Path to a powerhouse/app spec file (.phd or .json) to drive codegen"
272
- }),
273
- dir: option({
274
- type: optional(Directory),
275
- long: "dir",
276
- description: "Name of the directory of an existing app to re-generate"
277
- }),
278
- disableDragAndDrop: flag({
279
- type: boolean,
280
- long: "disable-drag-and-drop",
281
- description: "Do not allow drag and drop in this drive app.",
282
- defaultValue: () => false,
283
- defaultValueIsSerializable: true
284
- }),
285
- all: flag({
286
- long: "all",
287
- short: "a",
288
- description: "Re-generate all existing apps in the current project"
289
- }),
290
- extract: flag({
291
- long: "extract",
292
- short: "x",
293
- description: "Write a powerhouse/app spec for each existing drive app into specs/apps/"
294
- }),
295
- ...debugArgs
296
- },
297
- handler: async (args) => {
298
- const { startGenerateApp } = await import("./generate-app-BTs1u-9l.mjs");
299
- await startGenerateApp(args, process.cwd());
300
- process.exit(0);
301
- }
302
- });
303
- //#endregion
304
- //#region src/commands/generate-document-model.ts
305
- const generateDocumentModelCmd = command({
306
- name: "document-model",
307
- aliases: ["doc"],
308
- description: "Generate a document model",
309
- args: {
310
- document: option({
311
- type: optional(File),
312
- long: "document",
313
- short: "d",
314
- description: "Path to a document model spec (.phd or .json) to generate from"
315
- }),
316
- dir: option({
317
- type: optional(Directory),
318
- long: "dir",
319
- description: "Name of the directory of an existing document model to re-generate"
320
- }),
321
- all: flag({
322
- long: "all",
323
- short: "a",
324
- description: "Re-generate all existing document models in the current project"
325
- }),
326
- extract: flag({
327
- long: "extract",
328
- short: "x",
329
- description: "Write a powerhouse/document-model spec for each existing document model into specs/document-models/"
330
- }),
331
- ...debugArgs
332
- },
333
- handler: async (args) => {
334
- const { startGenerateDocumentModel } = await import("./generate-document-model-DhDQ_06X.mjs");
335
- await startGenerateDocumentModel(args, process.cwd());
336
- process.exit(0);
337
- }
338
- });
339
- //#endregion
340
- //#region src/commands/generate-editor.ts
341
- const generateEditorCmd = command({
342
- name: "editor",
343
- description: "Generate a document editor",
344
- args: {
345
- name: option({
346
- type: optional(string),
347
- long: "name",
348
- short: "n",
349
- description: "The name of the document editor to generate"
350
- }),
351
- documentType: option({
352
- type: optional(string),
353
- long: "document-type",
354
- short: "t",
355
- description: "The document type for the new editor"
356
- }),
357
- document: option({
358
- type: optional(File),
359
- long: "document",
360
- short: "d",
361
- description: "Path to a powerhouse/document-editor spec file (.phd or .json) to drive codegen"
362
- }),
363
- dir: option({
364
- type: optional(Directory),
365
- long: "dir",
366
- description: "Name of the directory of an existing editor to re-generate"
367
- }),
368
- all: flag({
369
- long: "all",
370
- short: "a",
371
- description: "Re-generate all existing editors in the current project"
372
- }),
373
- extract: flag({
374
- long: "extract",
375
- short: "x",
376
- description: "Write a powerhouse/document-editor spec for each existing editor into specs/editors/"
377
- }),
378
- ...debugArgs
379
- },
380
- handler: async (args) => {
381
- const { startGenerateEditor } = await import("./generate-editor-CW7Do69u.mjs");
382
- await startGenerateEditor(args, process.cwd());
383
- process.exit(0);
384
- }
385
- });
386
- //#endregion
387
- //#region src/commands/generate-migration-file.ts
388
- const generateMigrationFileCmd = command({
389
- name: "migration-file",
390
- description: "Generate a migration file",
391
- args: {
392
- migrationFile: option({
393
- type: string,
394
- long: "path",
395
- short: "p",
396
- description: "Path to the migration file"
397
- }),
398
- schemaFile: option({
399
- type: optional(string),
400
- long: "schema-file",
401
- description: "Path to the output file. Defaults to './schema.ts'"
402
- }),
403
- ...debugArgs
404
- },
405
- handler: async ({ migrationFile, schemaFile }) => {
406
- const { generateDBSchema } = await import("@powerhousedao/codegen");
407
- await generateDBSchema({
408
- migrationFile: path.join(process.cwd(), migrationFile),
409
- schemaFile: schemaFile ? path.join(process.cwd(), schemaFile) : void 0
410
- });
411
- process.exit(0);
412
- }
413
- });
414
- //#endregion
415
- //#region src/commands/generate-piece-action.ts
416
- const generatePieceActionCmd = command({
417
- name: "piece-action",
418
- description: "Generate an action inside an existing piece",
419
- args: {
420
- namePositional: positional({
421
- type: optional(string),
422
- displayName: "name",
423
- description: "The name of the action, e.g. get-record"
424
- }),
425
- name: option({
426
- type: optional(string),
427
- long: "name",
428
- short: "n",
429
- description: "The name of the action to generate"
430
- }),
431
- piece: option({
432
- type: optional(string),
433
- long: "piece",
434
- short: "p",
435
- description: "The piece directory under pieces/ to add the action to. Optional when the project ships exactly one piece."
436
- }),
437
- ...skipInstallArgs,
438
- ...debugArgs
439
- },
440
- handler: async (args) => {
441
- const { startGeneratePieceAction } = await import("./generate-piece-action-C5WTHsqu.mjs");
442
- await startGeneratePieceAction(args, process.cwd());
443
- process.exit(0);
444
- }
445
- });
446
- //#endregion
447
- //#region src/commands/generate-piece-trigger.ts
448
- const generatePieceTriggerCmd = command({
449
- name: "piece-trigger",
450
- description: "Generate a trigger inside an existing piece",
451
- args: {
452
- namePositional: positional({
453
- type: optional(string),
454
- displayName: "name",
455
- description: "The name of the trigger, e.g. new-record"
456
- }),
457
- name: option({
458
- type: optional(string),
459
- long: "name",
460
- short: "n",
461
- description: "The name of the trigger to generate"
462
- }),
463
- piece: option({
464
- type: optional(string),
465
- long: "piece",
466
- short: "p",
467
- description: "The piece directory under pieces/ to add the trigger to. Optional when the project ships exactly one piece."
468
- }),
469
- strategy: option({
470
- type: oneOf(["polling", "webhook"]),
471
- long: "strategy",
472
- description: "How the trigger fires: polled on a schedule, or delivered to a webhook",
473
- defaultValue: () => "polling",
474
- defaultValueIsSerializable: true
475
- }),
476
- ...skipInstallArgs,
477
- ...debugArgs
478
- },
479
- handler: async (args) => {
480
- const { startGeneratePieceTrigger } = await import("./generate-piece-trigger-DR10CPOG.mjs");
481
- await startGeneratePieceTrigger(args, process.cwd());
482
- process.exit(0);
483
- }
484
- });
485
- //#endregion
486
- //#region src/commands/generate-piece.ts
487
- const generatePieceCmd = command({
488
- name: "piece",
489
- description: "Generate a piece: a connector whose actions and triggers a workflow can call",
490
- args: {
491
- namePositional: positional({
492
- type: optional(string),
493
- displayName: "name",
494
- description: "The name of the piece to generate. Its directory is the kebab-case of this."
495
- }),
496
- name: option({
497
- type: optional(string),
498
- long: "name",
499
- short: "n",
500
- description: "The name of the piece to generate"
501
- }),
502
- id: option({
503
- type: optional(string),
504
- long: "id",
505
- description: "The piece id, the pieceName a workflow step holds, e.g. @acme/piece-crm. Defaults to one derived from the package name."
506
- }),
507
- auth: option({
508
- type: oneOf([
509
- "none",
510
- "secret",
511
- "custom"
512
- ]),
513
- long: "auth",
514
- description: "The kind of connection the piece asks for",
515
- defaultValue: () => "custom",
516
- defaultValueIsSerializable: true
517
- }),
518
- description: option({
519
- type: optional(string),
520
- long: "description",
521
- description: "One line describing what the piece connects to"
522
- }),
523
- dir: option({
524
- type: optional(Directory),
525
- long: "dir",
526
- description: "Name of the directory of an existing piece to re-register"
527
- }),
528
- all: flag({
529
- long: "all",
530
- short: "a",
531
- description: "Re-register every piece in pieces/: refresh the pieces list and the manifest, and prune what is gone"
532
- }),
533
- ...skipInstallArgs,
534
- ...debugArgs
535
- },
536
- handler: async (args) => {
537
- const { startGeneratePiece } = await import("./generate-piece-QTt-ddt2.mjs");
538
- await startGeneratePiece(args, process.cwd());
539
- process.exit(0);
540
- }
541
- });
542
- const generateProcessorCmd = command({
543
- name: "processor",
544
- description: "Generate a processor",
545
- args: {
546
- name: option({
547
- type: optional(string),
548
- long: "name",
549
- short: "n",
550
- description: "The name of the processor to generate"
551
- }),
552
- type: option({
553
- type: oneOf(["analytics", "relationalDb"]),
554
- long: "type",
555
- description: "The type of processor to generate",
556
- defaultValue: () => "analytics",
557
- defaultValueIsSerializable: true
558
- }),
559
- documentTypes: multioption({
560
- type: CommaSeparatedStrings,
561
- long: "document-types",
562
- short: "t",
563
- description: "The document types the processor will run on (repeatable or comma-separated)",
564
- defaultValue: () => [],
565
- defaultValueIsSerializable: true
566
- }),
567
- apps: multioption({
568
- long: "apps",
569
- type: { from(rawProcessorApps) {
570
- const processorApps = splitCommaSeparated(rawProcessorApps);
571
- if (processorApps.length === 0) throw new Error(`No arguments provided for processor apps. Must be "connect" and/or "switchboard"`);
572
- if (processorApps.length > 2) throw new Error(`Too many arguments provided for processor apps. Must be "connect" and/or "switchboard"`);
573
- const allowed = new Set(PROCESSOR_APPS);
574
- if (!processorApps.every((p) => allowed.has(p))) throw new Error(`Processor apps can only be "connect" and/or "switchboard".`);
575
- return Promise.resolve(processorApps);
576
- } },
577
- description: "Whether the processor will run in switchboard (nodejs), connect (browser), or both",
578
- defaultValue: () => ["switchboard", "connect"],
579
- defaultValueIsSerializable: true
580
- }),
581
- document: option({
582
- type: optional(File),
583
- long: "document",
584
- short: "d",
585
- description: "Path to a powerhouse/processor spec file (.phd or .json) to drive codegen"
586
- }),
587
- dir: option({
588
- type: optional(Directory),
589
- long: "dir",
590
- description: "Name of the directory of an existing processor to re-generate"
591
- }),
592
- all: flag({
593
- long: "all",
594
- short: "a",
595
- description: "Re-generate all existing processors in the current project"
596
- }),
597
- extract: flag({
598
- long: "extract",
599
- short: "x",
600
- description: "Write a powerhouse/processor spec for each existing processor into specs/processors/"
601
- }),
602
- ...skipInstallArgs,
603
- ...debugArgs
604
- },
605
- handler: async (args) => {
606
- const { startGenerateProcessor } = await import("./generate-processor-DBtTkgo5.mjs");
607
- await startGenerateProcessor(args, process.cwd());
608
- process.exit(0);
609
- }
610
- });
611
- //#endregion
612
- //#region src/commands/generate-subgraph.ts
613
- const generateSubgraphCmd = command({
614
- name: "subgraph",
615
- description: "Generate a subgraph",
616
- args: {
617
- name: option({
618
- type: optional(string),
619
- long: "name",
620
- short: "n",
621
- description: "The name of the subgraph to generate"
622
- }),
623
- document: option({
624
- type: optional(File),
625
- long: "document",
626
- short: "d",
627
- description: "Path to a powerhouse/subgraph spec file (.phd or .json) to drive codegen"
628
- }),
629
- dir: option({
630
- type: optional(Directory),
631
- long: "dir",
632
- description: "Name of the directory of an existing subgraph to re-generate"
633
- }),
634
- all: flag({
635
- long: "all",
636
- short: "a",
637
- description: "Re-generate all existing subgraphs in the current project"
638
- }),
639
- extract: flag({
640
- long: "extract",
641
- short: "x",
642
- description: "Write a powerhouse/subgraph spec for each existing subgraph into specs/subgraphs/"
643
- }),
644
- ...skipInstallArgs,
645
- ...debugArgs
646
- },
647
- handler: async (args) => {
648
- const { startGenerateSubgraph } = await import("./generate-subgraph-Dm27O59o.mjs");
649
- await startGenerateSubgraph(args, process.cwd());
650
- process.exit(0);
651
- }
652
- });
653
- //#endregion
654
- //#region src/commands/generate.ts
655
- const generate = subcommands({
656
- name: "generate",
657
- 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.`,
658
- cmds: {
659
- all: generateAllCmd,
660
- "document-model": generateDocumentModelCmd,
661
- editor: generateEditorCmd,
662
- app: generateAppCmd,
663
- processor: generateProcessorCmd,
664
- subgraph: generateSubgraphCmd,
665
- piece: generatePieceCmd,
666
- "piece-action": generatePieceActionCmd,
667
- "piece-trigger": generatePieceTriggerCmd,
668
- "migration-file": generateMigrationFileCmd
669
- }
670
- });
671
- //#endregion
672
- //#region src/commands/init.ts
673
- const init = command({
674
- name: "init",
675
- description: "Initialize a new project",
676
- args: initArgs,
677
- handler: async (args) => {
678
- if (args.debug) console.log({ args });
679
- const { startInit } = await import("./init-CIEMyAug.mjs");
680
- await startInit(args);
681
- process.exit(0);
682
- }
683
- });
684
- //#endregion
685
- //#region src/commands/inspect.ts
686
- const inspect = command({
687
- name: "inspect",
688
- description: `
689
- The inspect command examines and provides detailed information about a Powerhouse package.
690
- It helps you understand the structure, dependencies, and configuration of packages in
691
- your project.
692
-
693
- This command:
694
- 1. Analyzes the specified package
695
- 2. Retrieves detailed information about its structure and configuration
696
- 3. Displays package metadata, dependencies, and other relevant information
697
- 4. Helps troubleshoot package-related issues`,
698
- aliases: ["is"],
699
- args: inspectArgs,
700
- handler: async (args) => {
701
- if (args.debug) console.log(args);
702
- const { startInspect } = await import("./inspect-BpCB0TPo.mjs");
703
- startInspect(args);
704
- process.exit(0);
705
- }
706
- });
707
- //#endregion
708
- //#region src/commands/install.ts
709
- const install = command({
710
- name: "install",
711
- aliases: ["add", "i"],
712
- description: `
713
- The install command adds Powerhouse dependencies to your project.
714
-
715
- By default it only registers the package in powerhouse.config.json with
716
- provider "registry" — Connect will load it from the registry CDN at runtime.
717
-
718
- With --local, the package is also installed into node_modules and marked
719
- as provider "local" — it will be bundled into ph connect build so the
720
- preview works without the registry being reachable.
721
-
722
- Resolution order for the registry URL:
723
- --registry flag > PH_REGISTRY_URL env > powerhouse.config.json > default
724
- `,
725
- args: installArgs,
726
- handler: async (args) => {
727
- if (args.debug) console.log(args);
728
- const { getPowerhouseProjectInfo, makeDependenciesWithVersions } = await import("@powerhousedao/shared/clis");
729
- const { projectPath, localProjectPath, globalProjectPath, packageManager, isGlobal } = await getPowerhouseProjectInfo(args);
730
- if (!projectPath) throw new Error(`Could not find project path to install from.`);
731
- const { resolveRegistryUrl } = await import("@powerhousedao/shared/registry");
732
- const registryUrl = resolveRegistryUrl({
733
- registry: args.registry,
734
- projectPath
735
- });
736
- if (args.debug) console.log(">>> registryUrl", registryUrl);
737
- const dependenciesWithVersions = await makeDependenciesWithVersions(args.dependencies, registryUrl);
738
- if (args.debug) {
739
- console.log(">>> parsedDependencies", dependenciesWithVersions);
740
- console.log("\n>>> projectInfo", {
741
- localProjectPath,
742
- globalProjectPath,
743
- packageManager,
744
- isGlobal
745
- });
746
- }
747
- if (args.local) {
748
- if (dependenciesWithVersions.length === 0) throw new Error("--local requires at least one package name (e.g. ph install --local @scope/pkg)");
749
- try {
750
- const specs = dependenciesWithVersions.map((d) => d.version ? `${d.name}@${d.version}` : d.name);
751
- const scopes = /* @__PURE__ */ new Set();
752
- for (const dep of dependenciesWithVersions) if (dep.name.startsWith("@")) {
753
- const scope = dep.name.split("/")[0];
754
- scopes.add(scope);
755
- }
756
- const scopeRegistryArgs = Array.from(scopes).map((scope) => `--${scope}:registry=${registryUrl}`);
757
- const minReleaseAgeArgs = packageManager === "pnpm" ? ["--config.minimum-release-age=0"] : [];
758
- const allowBuildArgs = packageManager === "pnpm" && args.allowBuild.length > 0 ? [`--allow-build=${args.allowBuild.join(",")}`] : [];
759
- const { resolveCommand } = await import("package-manager-detector");
760
- const resolved = resolveCommand(packageManager, "add", [
761
- ...specs,
762
- ...scopeRegistryArgs,
763
- ...minReleaseAgeArgs,
764
- ...allowBuildArgs
765
- ]);
766
- if (!resolved) throw new Error(`Failed to resolve install command for package manager "${packageManager}".`);
767
- const installCommand = `${resolved.command} ${resolved.args.join(" ")}`;
768
- if (scopeRegistryArgs.length > 0) console.log(`Installing dependencies 📦 (routing ${Array.from(scopes).join(", ")} → ${registryUrl})...`);
769
- else console.log("Installing dependencies 📦...");
770
- console.log(`> ${installCommand}`);
771
- execSync$1(installCommand, {
772
- stdio: "inherit",
773
- cwd: projectPath
774
- });
775
- console.log("Dependency installed successfully 🎉");
776
- } catch (error) {
777
- console.error("❌ Failed to install dependencies");
778
- throw error;
779
- }
780
- }
781
- const { updateConfigFile, updateStylesFile } = await import("./utils-C3c5YG6v.mjs");
782
- try {
783
- console.log("⚙️ Updating powerhouse config file...");
784
- updateConfigFile(dependenciesWithVersions, projectPath, "install", args.local ? "local" : "registry", registryUrl, args.registry !== void 0);
785
- console.log("Config file updated successfully 🎉");
786
- } catch (error) {
787
- console.error("❌ Failed to update config file");
788
- throw error;
789
- }
790
- if (args.local) try {
791
- console.log("⚙️ Updating styles.css file...");
792
- updateStylesFile(dependenciesWithVersions, projectPath);
793
- console.log("Styles file updated successfully 🎉");
794
- } catch (error) {
795
- console.error("❌ Failed to update styles file");
796
- throw error;
797
- }
798
- process.exit(0);
799
- }
800
- });
801
- //#endregion
802
- //#region src/commands/list.ts
803
- const list = command({
804
- name: "list",
805
- description: `
806
- The list command displays information about installed Powerhouse packages in your project.
807
- It reads the powerhouse.config.json file and shows the packages that are currently installed.
808
-
809
- This command:
810
- 1. Examines your project configuration
811
- 2. Lists all installed Powerhouse packages
812
- 3. Provides a clear overview of your project's dependencies
813
- 4. Helps you manage and track your Powerhouse components
814
- `,
815
- aliases: ["l"],
816
- args: listArgs,
817
- handler: async (args) => {
818
- if (args.debug) console.log(args);
819
- try {
820
- const { getPowerhouseProjectInfo } = await import("@powerhousedao/shared/clis");
821
- const projectInfo = await getPowerhouseProjectInfo();
822
- const { getConfig } = await import("@powerhousedao/config/node");
823
- const phConfig = getConfig(projectInfo.projectPath + "/powerhouse.config.json");
824
- if (!phConfig.packages || phConfig.packages.length === 0) {
825
- console.log("No packages found in the project");
826
- return;
827
- }
828
- console.log("Installed Packages:\n");
829
- phConfig.packages.forEach((pkg) => {
830
- console.log(pkg.version ? `${pkg.packageName}@${pkg.version}` : pkg.packageName);
831
- });
832
- } catch (_e) {
833
- console.log("No packages found in the project");
834
- }
835
- process.exit(0);
836
- }
837
- });
838
- //#endregion
839
- //#region src/commands/login.ts
840
- const login = command({
841
- name: "login",
842
- description: `
843
- The login command authenticates you with Renown using your Ethereum wallet. This enables
844
- the CLI to act on behalf of your Ethereum identity for authenticated operations.
845
-
846
- This command:
847
- 1. Generates or loads a cryptographic identity (DID) for the CLI
848
- 2. Opens your browser to the Renown authentication page
849
- 3. You authorize the CLI's DID to act on behalf of your Ethereum address
850
- 4. Stores the credentials locally in .ph/.renown.json
851
- `,
852
- args: loginArgs,
853
- handler: async (args) => {
854
- if (args.debug) console.log(args);
855
- const { getRenown } = await import("./auth-CNhbN5UM.mjs");
856
- const renown = await getRenown(args.renownUrl);
857
- if (args.showDid) {
858
- console.log(renown.did);
859
- process.exit(0);
860
- }
861
- if (args.status) {
862
- const { getAuthStatus } = await import("@renown/sdk/node");
863
- const status = getAuthStatus(renown);
864
- if (!status.authenticated || !status.address) {
865
- console.log("Not authenticated with an Ethereum address.");
866
- console.log("Run \"ph login\" to authenticate.");
867
- } else {
868
- console.log("Authenticated");
869
- console.log(` ETH Address: ${status.address}`);
870
- console.log(` User DID: ${status.userDid}`);
871
- console.log(` Chain ID: ${status.chainId}`);
872
- console.log(` CLI DID: ${status.cliDid}`);
873
- console.log(` Authenticated at: ${status.authenticatedAt?.toLocaleString()}`);
874
- console.log(` Renown URL: ${status.baseUrl}`);
875
- }
876
- process.exit(0);
877
- }
878
- if (args.logout) {
879
- await handleLogout();
880
- process.exit(0);
881
- }
882
- const { browserLogin } = await import("@renown/sdk/node");
883
- console.debug("Initializing cryptographic identity...");
884
- console.log(`CLI DID: ${renown.did}`);
885
- try {
886
- const timeoutMs = args.timeout ? args.timeout * 1e3 : void 0;
887
- const result = await browserLogin(renown, {
888
- renownUrl: args.renownUrl,
889
- timeoutMs,
890
- onLoginUrl: (url, sessionId) => {
891
- console.log("Opening browser for authentication...");
892
- console.log(`Session ID: ${sessionId.slice(0, 8)}...`);
893
- console.log(`Login URL: ${url}`);
894
- console.log();
895
- console.log("Waiting for authentication in browser");
896
- console.log(`(timeout in ${(timeoutMs ?? 3e5) / 1e3} seconds)`);
897
- console.log();
898
- console.log("Please connect your wallet and authorize this CLI to act on your behalf.");
899
- console.log();
900
- process.stdout.write("Waiting");
901
- },
902
- onPollTick: () => process.stdout.write("."),
903
- onBrowserOpenFailed: (url) => {
904
- console.error("Failed to open browser automatically.");
905
- console.log(`Please open this URL manually: ${url}`);
906
- }
907
- });
908
- console.log();
909
- console.log();
910
- console.log("Successfully authenticated!");
911
- console.log(` ETH Address: ${result.user.address}`);
912
- console.log(` User DID: ${result.user.did}`);
913
- console.log(` CLI DID: ${result.cliDid}`);
914
- console.log();
915
- console.log("The CLI can now act on behalf of your Ethereum identity.");
916
- } catch (error) {
917
- console.log();
918
- throw error;
919
- }
920
- process.exit(0);
921
- }
922
- });
923
- async function handleLogout() {
924
- const { getRenown } = await import("./auth-CNhbN5UM.mjs");
925
- const renown = await getRenown();
926
- if (!renown.user) {
927
- console.log("Not currently authenticated.");
928
- return;
929
- }
930
- try {
931
- await renown.logout();
932
- console.log("Successfully logged out.");
933
- } catch (error) {
934
- console.error("Failed to clear credentials.");
935
- console.debug(error);
936
- }
937
- }
938
- //#endregion
939
- //#region src/commands/logout.ts
940
- const logout = command({
941
- name: "logout",
942
- description: `
943
- The logout command removes an existing session created with 'ph login'`,
944
- args: {},
945
- handler: async () => {
946
- await handleLogout();
947
- process.exit(0);
948
- }
949
- });
950
- //#endregion
951
- //#region src/commands/migrate.ts
952
- const migrate = command({
953
- name: "migrate",
954
- args: migrateArgs,
955
- description: "Run migrations",
956
- handler: async (args) => {
957
- if (args.debug) console.log(args);
958
- const { startMigrate } = await import("./migrate-B6QBYDNX.mjs");
959
- await startMigrate(args);
960
- process.exit(0);
961
- }
962
- });
963
- //#endregion
964
- //#region src/commands/publish.ts
965
- function hasTagFlag(args) {
966
- return args.some((a) => a === "--tag" || a.startsWith("--tag="));
967
- }
968
- function isInteractive() {
969
- return Boolean(process.stdin.isTTY) && !process.env.CI;
970
- }
971
- async function readPrereleaseTag(projectPath) {
972
- try {
973
- const [{ readPackageSync }, { prerelease }] = await Promise.all([import("read-pkg"), import("semver")]);
974
- const pkg = readPackageSync({ cwd: projectPath });
975
- if (!pkg.version) return null;
976
- const parts = prerelease(pkg.version);
977
- if (!parts || parts.length === 0) return null;
978
- const label = String(parts[0]);
979
- if (!/^[a-z][a-z0-9-]*$/i.test(label)) return null;
980
- return {
981
- version: pkg.version,
982
- tag: label
983
- };
984
- } catch {
985
- return null;
986
- }
987
- }
988
- const publish = command({
989
- name: "publish",
990
- description: `
991
- Publish a package to the Powerhouse registry. This is a thin wrapper around npm publish
992
- that automatically sets the registry URL.
993
-
994
- This command:
995
- 1. Resolves the registry URL (--registry flag > PH_REGISTRY_URL env > powerhouse.config.json > default)
996
- 2. Checks authentication with the registry via npm whoami
997
- 3. Forwards all additional arguments to npm publish
998
- `,
999
- args: publishArgs,
1000
- handler: async (args) => {
1001
- if (args.debug) console.log(args);
1002
- const { getPowerhouseProjectInfo } = await import("@powerhousedao/shared/clis");
1003
- const { projectPath } = await getPowerhouseProjectInfo();
1004
- if (!projectPath) throw new Error("Could not find project path.");
1005
- const { checkNpmAuth, npmPublish, resolveRegistryUrl } = await import("@powerhousedao/shared/registry");
1006
- const { mintRegistryAuthToken } = await import("./registry-auth-Bm5AR-fB.mjs");
1007
- const registryUrl = resolveRegistryUrl({
1008
- registry: args.registry,
1009
- projectPath
1010
- });
1011
- if (args.debug) console.log(">>> registryUrl", registryUrl);
1012
- let authToken;
1013
- try {
1014
- authToken = await mintRegistryAuthToken(registryUrl, 300);
1015
- if (args.debug) console.error(`>>> minted renown token for ${registryUrl} (5m TTL)`);
1016
- } catch (err) {
1017
- if (args.debug) console.error(`>>> renown token mint skipped: ${err.message}`);
1018
- try {
1019
- await checkNpmAuth(registryUrl);
1020
- } catch {
1021
- console.error(`Not authenticated with registry: ${registryUrl}`);
1022
- console.error(`Run: ph login (recommended) or npm adduser --registry ${registryUrl}`);
1023
- process.exit(1);
1024
- }
1025
- }
1026
- let forwardedArgs = args.forwardedArgs;
1027
- if (!hasTagFlag(forwardedArgs)) {
1028
- const prereleaseInfo = await readPrereleaseTag(projectPath);
1029
- if (prereleaseInfo) {
1030
- const { version, tag } = prereleaseInfo;
1031
- if (!isInteractive()) {
1032
- console.error(`Detected prerelease version ${version}. npm requires an explicit dist-tag for prerelease publishes.`);
1033
- console.error(`Re-run with --tag <label> (e.g. --tag ${tag}) to proceed.`);
1034
- process.exit(1);
1035
- }
1036
- const enquirer = await import("enquirer");
1037
- let confirmed;
1038
- try {
1039
- confirmed = (await enquirer.default.prompt({
1040
- type: "confirm",
1041
- name: "confirmed",
1042
- message: `Detected prerelease version ${version}. Publish with --tag ${tag}?`,
1043
- initial: true
1044
- })).confirmed;
1045
- } catch {
1046
- confirmed = false;
1047
- }
1048
- if (!confirmed) {
1049
- console.error(`Aborted. To publish manually: npm publish --registry ${registryUrl} --tag <label>`);
1050
- process.exit(1);
1051
- }
1052
- forwardedArgs = [
1053
- "--tag",
1054
- tag,
1055
- ...forwardedArgs
1056
- ];
1057
- }
1058
- }
1059
- if (args.debug) console.log(">>> command", `npm publish --registry ${registryUrl} ${forwardedArgs.join(" ")}`);
1060
- console.log(`Publishing to ${registryUrl}...`);
1061
- const result = await npmPublish({
1062
- registryUrl,
1063
- cwd: projectPath,
1064
- args: forwardedArgs,
1065
- authToken
1066
- });
1067
- if (result.stdout) console.log(result.stdout);
1068
- process.exit(0);
1069
- }
1070
- });
1071
- //#endregion
1072
- //#region src/commands/registry-login.ts
1073
- const registryLogin = command({
1074
- name: "registry-login",
1075
- description: `
1076
- Log in to a Powerhouse registry using your Renown identity. Mints a longer-lived
1077
- bearer token (default 30 days) bound to the registry's audience and writes the
1078
- token into ~/.npmrc so raw 'npm publish' / 'npm install' work without further
1079
- setup.
1080
-
1081
- Prerequisites:
1082
- Run 'ph login' first to establish a Renown identity.
1083
-
1084
- Usage:
1085
- ph registry-login # uses powerhouse.config.json / PH_REGISTRY_URL
1086
- ph registry-login --registry https://registry.vetra.io
1087
- ph registry-login --expiry 7d
1088
- `,
1089
- args: registryLoginArgs,
1090
- handler: async (args) => {
1091
- if (args.debug) console.log(args);
1092
- const { getPowerhouseProjectInfo } = await import("@powerhousedao/shared/clis");
1093
- const projectPath = (await getPowerhouseProjectInfo().catch(() => null))?.projectPath ?? process.cwd();
1094
- const [{ resolveRegistryUrl, writeRegistryAuthToken }, { mintRegistryAuthToken }, { parseExpiry, formatExpiry }] = await Promise.all([
1095
- import("@powerhousedao/shared/registry"),
1096
- import("./registry-auth-Bm5AR-fB.mjs"),
1097
- import("@renown/sdk/node")
1098
- ]);
1099
- const registryUrl = resolveRegistryUrl({
1100
- registry: args.registry,
1101
- projectPath
1102
- });
1103
- const expiresIn = parseExpiry(args.expiry);
1104
- const npmrcPath = await writeRegistryAuthToken(registryUrl, await mintRegistryAuthToken(registryUrl, expiresIn));
1105
- console.log(`Logged in to ${registryUrl}`);
1106
- console.log(` Token expires in: ${formatExpiry(expiresIn)}`);
1107
- console.log(` Wrote: ${npmrcPath}`);
1108
- process.exit(0);
1109
- }
1110
- });
1111
- //#endregion
1112
- //#region src/commands/switchboard.ts
1113
- const switchboard = command({
1114
- name: "switchboard",
1115
- aliases: ["reactor"],
1116
- description: `
1117
- The switchboard command starts a local Switchboard instance, which acts as the document
1118
- processing engine for Powerhouse projects. It provides the infrastructure for document
1119
- models, processors, and real-time updates.
1120
-
1121
- This command:
1122
- 1. Starts a local switchboard server
1123
- 2. Loads document models and processors
1124
- 3. Provides an API for document operations
1125
- 4. Enables real-time document processing
1126
- 5. Can authenticate with remote services using your identity from 'ph login'`,
1127
- args: switchboardArgs,
1128
- handler: async (args) => {
1129
- if (args.debug) console.log(args);
1130
- const { basePath, dbPath, migrate, migrateStatus, reset, yes } = args;
1131
- if (basePath) process.env.BASE_PATH = basePath;
1132
- if (reset) {
1133
- const { resetSwitchboardDatabase } = await import("./switchboard-reset-Ctegiqdm.mjs");
1134
- await resetSwitchboardDatabase({
1135
- dbPath,
1136
- yes
1137
- });
1138
- process.exit(0);
1139
- }
1140
- if (migrate || migrateStatus) {
1141
- const { runSwitchboardMigrations } = await import("./switchboard-migrate-7JQZM7-5.mjs");
1142
- await runSwitchboardMigrations({
1143
- dbPath,
1144
- statusOnly: migrateStatus
1145
- });
1146
- process.exit(0);
1147
- }
1148
- const { startSwitchboard } = await import("./switchboard-nHCI3pha.mjs");
1149
- const { defaultDriveUrl, renown } = await startSwitchboard(args);
1150
- console.log(" ➜ Switchboard:", defaultDriveUrl);
1151
- if (renown) console.log(" ➜ Identity:", renown.did);
1152
- }
1153
- });
1154
- //#endregion
1155
- //#region src/commands/uninstall.ts
1156
- const uninstall = command({
1157
- name: "uninstall",
1158
- aliases: ["remove"],
1159
- description: `
1160
- The uninstall command removes Powerhouse dependencies from your project. It handles the
1161
- removal of packages, updates configuration files, and ensures proper cleanup.
1162
-
1163
- This command:
1164
- 1. Uninstalls specified Powerhouse dependencies using your package manager
1165
- 2. Updates powerhouse.config.json to remove the dependencies
1166
- 3. Supports various uninstallation options and configurations
1167
- 4. Works with ${AGENTS.join(", ")} package managers
1168
- `,
1169
- args: uninstallArgs,
1170
- handler: async (args) => {
1171
- if (args.debug) console.log(args);
1172
- const { getPowerhouseProjectInfo, getPowerhouseProjectUninstallCommand, makeDependenciesWithVersions } = await import("@powerhousedao/shared/clis");
1173
- const { projectPath, localProjectPath, globalProjectPath, packageManager, isGlobal } = await getPowerhouseProjectInfo(args);
1174
- if (!projectPath) throw new Error(`Could not find project path to uninstall from`);
1175
- const dependenciesWithVersions = await makeDependenciesWithVersions(args.dependencies);
1176
- if (args.debug) console.log(">>> parsedDependencies", dependenciesWithVersions);
1177
- if (args.debug) console.log("\n>>> projectInfo", {
1178
- localProjectPath,
1179
- globalProjectPath,
1180
- packageManager,
1181
- isGlobal
1182
- });
1183
- try {
1184
- console.log("Uninstalling dependencies 📦 ...");
1185
- const uninstallCommand = await getPowerhouseProjectUninstallCommand(packageManager, args.dependencies);
1186
- execSync(uninstallCommand, {
1187
- stdio: "inherit",
1188
- cwd: projectPath
1189
- });
1190
- console.log("Dependency uninstalled successfully 🎉");
1191
- } catch (error) {
1192
- console.error("❌ Failed to uninstall dependencies");
1193
- throw error;
1194
- }
1195
- const { removeStylesImports, updateConfigFile } = await import("./utils-C3c5YG6v.mjs");
1196
- try {
1197
- console.log("⚙️ Updating powerhouse config file...");
1198
- updateConfigFile(dependenciesWithVersions, projectPath, "uninstall");
1199
- console.log("Config file updated successfully 🎉");
1200
- } catch (error) {
1201
- console.error("❌ Failed to update config file");
1202
- throw error;
1203
- }
1204
- try {
1205
- console.log("⚙️ Updating styles.css file...");
1206
- removeStylesImports(dependenciesWithVersions, projectPath);
1207
- console.log("Styles file updated successfully 🎉");
1208
- } catch (error) {
1209
- console.error("❌ Failed to update styles file");
1210
- throw error;
1211
- }
1212
- process.exit(0);
1213
- }
1214
- });
1215
- //#endregion
1216
- //#region src/commands/unpublish.ts
1217
- const unpublish = command({
1218
- name: "unpublish",
1219
- description: `
1220
- Unpublish a package from the Powerhouse registry. This is a thin wrapper around
1221
- npm unpublish that automatically targets the Powerhouse registry and never
1222
- reaches npmjs.org.
1223
-
1224
- Forms:
1225
- ph unpublish # unpublish <name>@<version> from cwd's package.json
1226
- ph unpublish <name> # unpublish the whole package (all versions)
1227
- ph unpublish <name>@<version> # unpublish a single version
1228
-
1229
- Flags:
1230
- --registry <url> # override registry URL
1231
- --yes, -y # skip the confirmation prompt
1232
- `,
1233
- args: unpublishArgs,
1234
- handler: async (args) => {
1235
- if (args.debug) console.log(args);
1236
- const { getPowerhouseProjectInfo } = await import("@powerhousedao/shared/clis");
1237
- const { projectPath } = await getPowerhouseProjectInfo();
1238
- if (!projectPath) throw new Error("Could not find project path.");
1239
- const { checkNpmAuth, npmUnpublish, resolveRegistryUrl } = await import("@powerhousedao/shared/registry");
1240
- const registryUrl = resolveRegistryUrl({
1241
- registry: args.registry,
1242
- projectPath
1243
- });
1244
- const spec = await resolveSpec(args.spec, projectPath);
1245
- if (!spec) {
1246
- console.error("No package spec provided and could not read name/version from package.json.");
1247
- process.exit(1);
1248
- }
1249
- if (args.debug) {
1250
- console.log(">>> registryUrl", registryUrl);
1251
- console.log(">>> spec", spec);
1252
- }
1253
- try {
1254
- await checkNpmAuth(registryUrl);
1255
- } catch {
1256
- console.error(`Not authenticated with registry: ${registryUrl}`);
1257
- console.error(`Run: npm adduser --registry ${registryUrl}`);
1258
- process.exit(1);
1259
- }
1260
- if (!args.yes) {
1261
- if (!await confirm(`Unpublish ${spec} from ${registryUrl}? [y/N] `)) {
1262
- console.log("Aborted.");
1263
- process.exit(0);
1264
- }
1265
- }
1266
- if (args.debug) console.log(">>> command", `npm unpublish ${spec} --registry ${registryUrl} --force ${args.forwardedArgs.join(" ")}`);
1267
- console.log(`Unpublishing ${spec} from ${registryUrl}...`);
1268
- try {
1269
- const result = await npmUnpublish({
1270
- registryUrl,
1271
- cwd: projectPath,
1272
- spec,
1273
- args: args.forwardedArgs
1274
- });
1275
- if (result.stdout) console.log(result.stdout);
1276
- process.exit(0);
1277
- } catch (err) {
1278
- console.error(err instanceof Error ? err.message : String(err));
1279
- process.exit(1);
1280
- }
1281
- }
1282
- });
1283
- async function resolveSpec(explicit, projectPath) {
1284
- if (explicit) return explicit;
1285
- try {
1286
- const { readPackageSync } = await import("read-pkg");
1287
- const pkg = readPackageSync({ cwd: projectPath });
1288
- if (!pkg.name) return null;
1289
- return pkg.version ? `${pkg.name}@${pkg.version}` : pkg.name;
1290
- } catch {
1291
- return null;
1292
- }
1293
- }
1294
- async function confirm(prompt) {
1295
- const rl = createInterface({
1296
- input: process.stdin,
1297
- output: process.stdout
1298
- });
1299
- try {
1300
- const answer = await rl.question(prompt);
1301
- return /^y(es)?$/i.test(answer.trim());
1302
- } finally {
1303
- rl.close();
1304
- }
1305
- }
1306
- //#endregion
1307
- //#region src/commands/ph-cli-commands.ts
1308
- const phCliCommands = {
1309
- init,
1310
- generate,
1311
- vetra: command({
1312
- name: "vetra",
1313
- description: `
1314
- The vetra command sets up a Vetra development environment for working with Vetra projects.
1315
- It starts a Vetra Switchboard and optionally Connect Studio, enabling document collaboration
1316
- and real-time processing with a "Vetra" drive or connection to remote drives.
1317
-
1318
- This command:
1319
- 1. Starts a Vetra Switchboard with a "Vetra" drive for document storage
1320
- 2. Optionally connects to remote drives instead of creating a local drive
1321
- 3. Starts Connect Studio pointing to the Switchboard for user interaction (unless disabled)
1322
- 4. Enables real-time updates, collaboration, and code generation
1323
-
1324
- Default drives:
1325
- Connect's default drives resolve to the Vetra drive (and the preview drive
1326
- when using --watch), plus any drives configured under
1327
- connect.drives.defaultDrives in powerhouse.config.json - de-duplicated by
1328
- URL, so configuring project drives does not cost you the Vetra drive.
1329
- An explicit --default-drives-url is appended to that list (de-duplicated);
1330
- it never replaces the Vetra drive.
1331
- `,
1332
- args: vetraArgs,
1333
- handler: async (args) => {
1334
- if (args.debug) console.log(args);
1335
- const { startVetra } = await import("./vetra-s8gWslse.mjs");
1336
- await startVetra(args);
1337
- }
1338
- }),
1339
- connect,
1340
- build: build$1,
1341
- publish,
1342
- unpublish,
1343
- "access-token": accessToken,
1344
- "registry-login": registryLogin,
1345
- inspect,
1346
- list,
1347
- migrate,
1348
- switchboard,
1349
- login,
1350
- logout,
1351
- install,
1352
- uninstall
1353
- };
1354
- //#endregion
1355
23
  //#region src/commands/ph-cli.ts
1356
24
  const version = getVersion();
1357
25
  const phCli = subcommands({
@@ -1405,20 +73,56 @@ function printDbRecoveryHint(err) {
1405
73
  //#endregion
1406
74
  //#region src/cli.ts
1407
75
  let sentryClient = void 0;
1408
- const COMMANDS_WITH_SUBCOMMANDS = /* @__PURE__ */ new Set(["connect", "vetra"]);
76
+ const COMMANDS_WITH_SUBCOMMANDS = /* @__PURE__ */ new Set([
77
+ "connect",
78
+ "vetra",
79
+ "host",
80
+ "model"
81
+ ]);
1409
82
  function detectPackageManager() {
1410
83
  const ua = process.env.npm_config_user_agent;
1411
84
  if (!ua) return void 0;
1412
85
  return ua.split(" ")[0]?.split("/")[0] || void 0;
1413
86
  }
87
+ /**
88
+ * `ph model` exits 1 only for invalid models, so an argument error or a crash
89
+ * the command could not report itself, such as its lazy import failing, is 2.
90
+ */
91
+ async function runModelCli(cli, args) {
92
+ try {
93
+ const result = await runSafely(cli, args);
94
+ if (result._tag === "error") {
95
+ const { exitCode, message, into } = result.error.config;
96
+ (into === "stdout" ? console.log : console.error)(message);
97
+ process.exitCode = exitCode === 1 ? 2 : exitCode;
98
+ }
99
+ } catch (error) {
100
+ await sentryClient?.captureCliError(error);
101
+ console.error(error instanceof Error ? error.message : String(error));
102
+ process.exitCode = 2;
103
+ }
104
+ }
1414
105
  async function main() {
1415
106
  assertNodeVersion();
107
+ const { checkRetiredFlags } = await import("@powerhousedao/shared/clis/retired-flags");
108
+ checkRetiredFlags();
109
+ const { checkDeprecatedFlags } = await import("@powerhousedao/shared/clis/deprecations");
110
+ checkDeprecatedFlags();
1416
111
  sentryClient = await initCliTelemetry({
1417
112
  cliName: "ph-cli",
1418
113
  release: getVersion()
1419
114
  });
1420
- const args = process.argv.slice(2);
115
+ let args = process.argv.slice(2);
116
+ const { applyRunSugar, forwardRunnerArgv } = await import("./run-sugar-ByAIbE2x.mjs");
117
+ const { phCliCommands } = await import("./ph-cli-commands-CCCVUIzM.mjs");
118
+ const sugar = applyRunSugar(args, new Set(Object.keys(phCliCommands)), process.cwd());
119
+ if (sugar.warning) console.warn(sugar.warning);
120
+ args = forwardRunnerArgv(sugar.args);
1421
121
  const command = args[0];
122
+ if (command === "vetra" || command === "connect" || command === "switchboard" || command === "reactor") {
123
+ const { warnClassicInvocation } = await import("./classic-warnings-kQsFGSeA.mjs");
124
+ await warnClassicInvocation(args, process.cwd());
125
+ }
1422
126
  const subcommand = command && COMMANDS_WITH_SUBCOMMANDS.has(command) && args[1] && !args[1].startsWith("-") ? args[1] : void 0;
1423
127
  sentryClient?.attachInvocationContext({
1424
128
  command,
@@ -1444,7 +148,8 @@ async function main() {
1444
148
  ...restArgs
1445
149
  ];
1446
150
  await run(cli, argsWithDefaultConnectSubCommand);
1447
- } else await run(cli, args);
151
+ } else if (command === "model") await runModelCli(cli, args);
152
+ else await run(cli, args);
1448
153
  }
1449
154
  await main().catch(async (error) => {
1450
155
  const isDebug = process.argv.slice(2).includes("--debug");
@@ -1460,4 +165,4 @@ await main().catch(async (error) => {
1460
165
  export {};
1461
166
 
1462
167
  //# sourceMappingURL=cli.mjs.map
1463
- //# debugId=c3a1dfab-bfc7-5154-b9b2-43ce4f1fcb86
168
+ //# debugId=aa38e5db-5dbe-5933-859e-76cf696ddca8