@powerhousedao/ph-cli 6.2.3-dev.5 → 6.2.3-dev.51

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 (78) hide show
  1. package/dist/{auth-AR3VxAIk.mjs → auth-BFUq7CvE.mjs} +3 -3
  2. package/dist/{auth-AR3VxAIk.mjs.map → auth-BFUq7CvE.mjs.map} +1 -1
  3. package/dist/auth-CNhbN5UM.mjs +4 -0
  4. package/dist/build-DmqwT-PR.mjs +4 -0
  5. package/dist/build-skPHsKkL.mjs +210 -0
  6. package/dist/build-skPHsKkL.mjs.map +1 -0
  7. package/dist/{cli-connect-override-D3hh4aH_.mjs → cli-connect-override-b4kKqgOZ.mjs} +62 -27
  8. package/dist/cli-connect-override-b4kKqgOZ.mjs.map +1 -0
  9. package/dist/cli.d.mts +2 -1
  10. package/dist/cli.mjs +326 -89
  11. package/dist/cli.mjs.map +1 -1
  12. package/dist/connect-build-BLxeFrSb.mjs +218 -0
  13. package/dist/connect-build-BLxeFrSb.mjs.map +1 -0
  14. package/dist/{connect-config-BWGiW3IB.mjs → connect-config-DGfPEeP8.mjs} +19 -12
  15. package/dist/connect-config-DGfPEeP8.mjs.map +1 -0
  16. package/dist/{connect-preview-D7ypzFDc.mjs → connect-preview-CzDqR-JN.mjs} +12 -8
  17. package/dist/{connect-preview-D7ypzFDc.mjs.map → connect-preview-CzDqR-JN.mjs.map} +1 -1
  18. package/dist/{connect-studio-D6rfWCNB.mjs → connect-studio-_-O1-oef.mjs} +15 -10
  19. package/dist/{connect-studio-D6rfWCNB.mjs.map → connect-studio-_-O1-oef.mjs.map} +1 -1
  20. package/dist/connect-studio-f3K1qPWd.mjs +4 -0
  21. package/dist/{generate-all-DrT4ZxHX.mjs → generate-all-CIwP-3aa.mjs} +3 -3
  22. package/dist/{generate-all-DrT4ZxHX.mjs.map → generate-all-CIwP-3aa.mjs.map} +1 -1
  23. package/dist/{generate-app-DNNqA-H3.mjs → generate-app-BTs1u-9l.mjs} +7 -5
  24. package/dist/{generate-app-DNNqA-H3.mjs.map → generate-app-BTs1u-9l.mjs.map} +1 -1
  25. package/dist/{generate-document-model-BJXyODfm.mjs → generate-document-model-DhDQ_06X.mjs} +17 -7
  26. package/dist/{generate-document-model-BJXyODfm.mjs.map → generate-document-model-DhDQ_06X.mjs.map} +1 -1
  27. package/dist/{generate-editor-BejvaVVT.mjs → generate-editor-CW7Do69u.mjs} +7 -5
  28. package/dist/{generate-editor-BejvaVVT.mjs.map → generate-editor-CW7Do69u.mjs.map} +1 -1
  29. package/dist/generate-piece-QTt-ddt2.mjs +65 -0
  30. package/dist/generate-piece-QTt-ddt2.mjs.map +1 -0
  31. package/dist/generate-piece-action-DbxrzfKY.mjs +29 -0
  32. package/dist/generate-piece-action-DbxrzfKY.mjs.map +1 -0
  33. package/dist/generate-piece-trigger-CqVOcL9g.mjs +30 -0
  34. package/dist/generate-piece-trigger-CqVOcL9g.mjs.map +1 -0
  35. package/dist/{generate-processor-_WOx-mMe.mjs → generate-processor-DBtTkgo5.mjs} +15 -8
  36. package/dist/generate-processor-DBtTkgo5.mjs.map +1 -0
  37. package/dist/{generate-subgraph-BsHUstpl.mjs → generate-subgraph-Dm27O59o.mjs} +10 -6
  38. package/dist/generate-subgraph-Dm27O59o.mjs.map +1 -0
  39. package/dist/{init-BZP6gvYd.mjs → init-CIEMyAug.mjs} +4 -4
  40. package/dist/{init-BZP6gvYd.mjs.map → init-CIEMyAug.mjs.map} +1 -1
  41. package/dist/{inspect-DXjbQEV_.mjs → inspect-BpCB0TPo.mjs} +11 -4
  42. package/dist/inspect-BpCB0TPo.mjs.map +1 -0
  43. package/dist/install-added-dependencies-DVSbzler.mjs +33 -0
  44. package/dist/install-added-dependencies-DVSbzler.mjs.map +1 -0
  45. package/dist/{migrate-jGKfE02L.mjs → migrate-DK4HK7Dn.mjs} +4 -4
  46. package/dist/{migrate-jGKfE02L.mjs.map → migrate-DK4HK7Dn.mjs.map} +1 -1
  47. package/dist/{registry-auth-DxEWCJu2.mjs → registry-auth-Bm5AR-fB.mjs} +4 -4
  48. package/dist/{registry-auth-DxEWCJu2.mjs.map → registry-auth-Bm5AR-fB.mjs.map} +1 -1
  49. package/dist/scripts/generate-commands-docs.ts +8 -0
  50. package/dist/switchboard-KQaBlAda.mjs +131 -0
  51. package/dist/switchboard-KQaBlAda.mjs.map +1 -0
  52. package/dist/{switchboard-migrate-NQ7LHWSi.mjs → switchboard-migrate-7JQZM7-5.mjs} +5 -4
  53. package/dist/{switchboard-migrate-NQ7LHWSi.mjs.map → switchboard-migrate-7JQZM7-5.mjs.map} +1 -1
  54. package/dist/{switchboard-reset-BcQXlcVf.mjs → switchboard-reset-CX_Lzw3O.mjs} +4 -4
  55. package/dist/{switchboard-reset-BcQXlcVf.mjs.map → switchboard-reset-CX_Lzw3O.mjs.map} +1 -1
  56. package/dist/switchboard-yDRjakQT.mjs +4 -0
  57. package/dist/{utils-BzwczAW-.mjs → utils-C3c5YG6v.mjs} +3 -3
  58. package/dist/{utils-C4isxXSO.mjs → utils-CvmDmCVd.mjs} +3 -3
  59. package/dist/{utils-C4isxXSO.mjs.map → utils-CvmDmCVd.mjs.map} +1 -1
  60. package/dist/{vetra-DkF6EJMY.mjs → vetra-CPGUTtaF.mjs} +64 -16
  61. package/dist/vetra-CPGUTtaF.mjs.map +1 -0
  62. package/package.json +18 -16
  63. package/dist/auth-BNkN6kS9.mjs +0 -4
  64. package/dist/build-C-A5-ipO.mjs +0 -4
  65. package/dist/build-uQXq6_HU.mjs +0 -71
  66. package/dist/build-uQXq6_HU.mjs.map +0 -1
  67. package/dist/cli-connect-override-D3hh4aH_.mjs.map +0 -1
  68. package/dist/connect-build-WL4axo4z.mjs +0 -43
  69. package/dist/connect-build-WL4axo4z.mjs.map +0 -1
  70. package/dist/connect-config-BWGiW3IB.mjs.map +0 -1
  71. package/dist/connect-studio-BIQzyq5B.mjs +0 -5
  72. package/dist/generate-processor-_WOx-mMe.mjs.map +0 -1
  73. package/dist/generate-subgraph-BsHUstpl.mjs.map +0 -1
  74. package/dist/inspect-DXjbQEV_.mjs.map +0 -1
  75. package/dist/switchboard-CJMoMzWx.mjs +0 -75
  76. package/dist/switchboard-CJMoMzWx.mjs.map +0 -1
  77. package/dist/switchboard-iRFugh8I.mjs +0 -4
  78. package/dist/vetra-DkF6EJMY.mjs.map +0 -1
package/dist/cli.mjs CHANGED
@@ -1,29 +1,34 @@
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]="ab6e0f84-63f5-57ba-a18e-7091ccbf13c6")}catch(e){}}();
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]="0ec21c09-2ac5-5793-8141-041509a77217")}catch(e){}}();
4
+ import { n as skipInstallArgs } from "./install-added-dependencies-DVSbzler.mjs";
4
5
  import { initCliTelemetry } from "@powerhousedao/shared/clis/telemetry";
5
6
  import { assertNodeVersion } from "@powerhousedao/shared/clis/utils";
6
- import { boolean, command, flag, multioption, oneOf, option, optional, run, string, subcommands } from "cmd-ts";
7
+ import { boolean, command, extendType, flag, multioption, oneOf, option, optional, positional, run, string, subcommands } from "cmd-ts";
7
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";
8
9
  import { DEFAULT_EXPIRY_SECONDS } from "@powerhousedao/shared/clis/constants";
9
- import { Directory, File } from "cmd-ts/dist/cjs/batteries/fs.js";
10
- import path from "path";
10
+ import fs from "node:fs";
11
+ import path from "node:path";
12
+ import path$1 from "path";
13
+ import { execSync } from "node:child_process";
11
14
  import { PROCESSOR_APPS } from "@powerhousedao/shared/processors";
12
- import { execSync } from "child_process";
13
- import { execSync as execSync$1 } from "node:child_process";
15
+ import { execSync as execSync$1 } from "child_process";
14
16
  import { createInterface } from "node:readline/promises";
15
17
  import { bold, yellow } from "colorette";
16
18
  //#region src/get-version.ts
17
19
  function getVersion() {
18
- return "6.2.3-dev.5";
20
+ return "6.2.3-dev.51";
19
21
  }
20
22
  //#endregion
21
23
  //#region src/utils/constants.ts
22
24
  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.";
25
+ //#endregion
26
+ //#region src/commands/ph-cli-help.ts
27
+ const version$1 = getVersion();
23
28
  const phCliHelp = subcommands({
24
29
  name: "ph-cli",
25
30
  description: PH_CLI_DESCRIPTION,
26
- version: getVersion(),
31
+ version: version$1,
27
32
  cmds: phCliHelpCommands
28
33
  });
29
34
  //#endregion
@@ -81,7 +86,7 @@ Notes:
81
86
  handler: async (args) => {
82
87
  if (args.debug) console.log(args);
83
88
  const { generateAccessToken, parseExpiry, formatExpiry } = await import("@renown/sdk/node");
84
- const { getRenown } = await import("./auth-BNkN6kS9.mjs");
89
+ const { getRenown } = await import("./auth-CNhbN5UM.mjs");
85
90
  const renown = await getRenown();
86
91
  let expiresIn = DEFAULT_EXPIRY_SECONDS;
87
92
  if (args.expiry) expiresIn = parseExpiry(args.expiry);
@@ -101,11 +106,25 @@ Notes:
101
106
  //#region src/commands/build.ts
102
107
  const build$1 = command({
103
108
  name: "build",
109
+ description: `
110
+ Build a Powerhouse package for publishing: a browser bundle and a node bundle of its
111
+ document models, editors, subgraphs and processors, type declarations, and its stylesheet.
112
+
113
+ Pieces under pieces/ are built too, each into its own self-contained module under
114
+ dist/node/pieces/<name>, with a descriptor.json and package.json written beside it and
115
+ the piece listed in dist/powerhouse.manifest.json. A piece takes the package's version: an
116
+ entry in pieces/index.ts that declares version fails the build. A package that ships only
117
+ pieces is an ordinary package: it carries the same boilerplate, and every step above runs
118
+ for it too.
119
+
120
+ tsc runs first. If it reports type errors the build asks whether to go ahead, and stops
121
+ where it can't ask. --ignore-type-errors builds without asking; a package built that way
122
+ can load and still fail at runtime, so don't publish it.`,
104
123
  args: buildArgs,
105
124
  handler: async (args) => {
106
125
  if (args.debug) console.log(args);
107
126
  try {
108
- const { runBuild } = await import("./build-C-A5-ipO.mjs");
127
+ const { runBuild } = await import("./build-DmqwT-PR.mjs");
109
128
  await runBuild(args);
110
129
  } catch (error) {
111
130
  console.error(error);
@@ -113,13 +132,11 @@ const build$1 = command({
113
132
  }
114
133
  }
115
134
  });
116
- const connect = subcommands({
117
- name: "connect",
118
- description: `Powerhouse Connect commands. Use with \`studio\`, \`build\`, \`preview\`, or \`config\`. Defaults to \`studio\` if not specified.`,
119
- cmds: {
120
- studio: command({
121
- name: "studio",
122
- description: `The studio command starts the Connect Studio, a development environment for building
135
+ //#endregion
136
+ //#region src/commands/connect.ts
137
+ const studio = command({
138
+ name: "studio",
139
+ description: `The studio command starts the Connect Studio, a development environment for building
123
140
  and testing Powerhouse applications. It provides a visual interface for working with
124
141
  your project.
125
142
 
@@ -129,49 +146,51 @@ This command:
129
146
  3. Allows you to interact with your project components
130
147
  4. Supports various configuration options for customization
131
148
  `,
132
- args: connectStudioArgs,
133
- handler: async (args) => {
134
- if (args.debug) console.log(args);
135
- const { runConnectStudio } = await import("./connect-studio-BIQzyq5B.mjs");
136
- await runConnectStudio(args);
137
- }
138
- }),
139
- build: command({
140
- name: "build",
141
- description: `The Connect build command creates a production build with the project's local and
149
+ args: connectStudioArgs,
150
+ handler: async (args) => {
151
+ if (args.debug) console.log(args);
152
+ const { runConnectStudio } = await import("./connect-studio-f3K1qPWd.mjs");
153
+ await runConnectStudio(args);
154
+ }
155
+ });
156
+ const build = command({
157
+ name: "build",
158
+ description: `The Connect build command creates a production build with the project's local and
142
159
  external packages included.
143
160
 
144
161
  Runtime-config overrides (all combinable — last wins on collision):
145
162
  ph connect build Build with the current source config.
146
163
  ph connect build <key> <value> Build with a positional override applied (e.g. ph connect build connect.renown.url https://renown.staging).
147
164
  ph connect build --<field> <value> Build with a per-field flag override (e.g. --renown-url https://renown.staging).
148
- ph connect build --json '{"…":"…"}' Build with a bulk override.
165
+ ph connect build --json '{"app":{"workflowsEnabled":true}}'
166
+ Build with a bulk override. The payload is the connect.* block
167
+ without the "connect" wrapper; unknown keys are rejected.
149
168
 
150
169
  Build has no read mode; passing only <key> without <value> errors out (use \`ph connect config <key>\` to read).
151
170
  `,
152
- args: connectBuildArgs,
153
- handler: async (args) => {
154
- if (args.debug) console.log(args);
155
- const { runConnectBuild } = await import("./connect-build-WL4axo4z.mjs");
156
- await runConnectBuild(args);
157
- process.exit(0);
158
- }
159
- }),
160
- preview: command({
161
- name: "preview",
162
- description: `The Connect preview command previews a built Connect project.
171
+ args: connectBuildArgs,
172
+ handler: async (args) => {
173
+ if (args.debug) console.log(args);
174
+ const { runConnectBuild } = await import("./connect-build-BLxeFrSb.mjs");
175
+ await runConnectBuild(args);
176
+ process.exit(0);
177
+ }
178
+ });
179
+ const preview = command({
180
+ name: "preview",
181
+ description: `The Connect preview command previews a built Connect project.
163
182
  NOTE: You must run \`ph connect build\` first
164
183
  `,
165
- args: connectPreviewArgs,
166
- handler: async (args) => {
167
- if (args.debug) console.log(args);
168
- const { runConnectPreview } = await import("./connect-preview-D7ypzFDc.mjs");
169
- await runConnectPreview(args);
170
- }
171
- }),
172
- config: command({
173
- name: "config",
174
- description: `Read or update Connect's runtime configuration (powerhouse.config.json).
184
+ args: connectPreviewArgs,
185
+ handler: async (args) => {
186
+ if (args.debug) console.log(args);
187
+ const { runConnectPreview } = await import("./connect-preview-CzDqR-JN.mjs");
188
+ await runConnectPreview(args);
189
+ }
190
+ });
191
+ const config = command({
192
+ name: "config",
193
+ description: `Read or update Connect's runtime configuration (powerhouse.config.json).
175
194
 
176
195
  Modes (mutually exclusive — positional, --get, --json, and field flags cannot be combined):
177
196
  ph connect config List the effective connect.* block (defaults < source).
@@ -179,18 +198,28 @@ Modes (mutually exclusive — positional, --get, --json, and field flags cannot
179
198
  ph connect config --get <dotted.path> Same as positional <key> (kept for backward compat).
180
199
  ph connect config <key> <value> Set a single field and dual-write to source + dist (positional).
181
200
  ph connect config --<field> <value> Set a single field via per-field flag (e.g. --renown-url https://renown.id).
182
- ph connect config --json '{"…":"…"}' Bulk-set multiple fields and dual-write.
201
+ ph connect config --json '{"renown":{"url":"…"}}'
202
+ Bulk-set multiple fields and dual-write. The payload is the connect.*
203
+ block without the "connect" wrapper; unknown keys are rejected.
183
204
 
184
205
  Writes go to:
185
206
  - <project>/powerhouse.config.json (source — picked up by the next build)
186
207
  - <dist-dir>/powerhouse.config.json (if it exists — the currently-served SPA picks it up on refresh)
187
208
  `,
188
- args: connectConfigArgs,
189
- handler: async (args) => {
190
- const { runConnectConfig } = await import("./connect-config-BWGiW3IB.mjs");
191
- await runConnectConfig(args);
192
- }
193
- })
209
+ args: connectConfigArgs,
210
+ handler: async (args) => {
211
+ const { runConnectConfig } = await import("./connect-config-DGfPEeP8.mjs");
212
+ await runConnectConfig(args);
213
+ }
214
+ });
215
+ const connect = subcommands({
216
+ name: "connect",
217
+ description: `Powerhouse Connect commands. Use with \`studio\`, \`build\`, \`preview\`, or \`config\`. Defaults to \`studio\` if not specified.`,
218
+ cmds: {
219
+ studio,
220
+ build,
221
+ preview,
222
+ config
194
223
  }
195
224
  });
196
225
  //#endregion
@@ -204,12 +233,40 @@ const generateAllCmd = command({
204
233
  description: "Instead of generating code, write a spec for every module into specs/ (one-shot migration to documents-as-source-of-truth)"
205
234
  }) },
206
235
  handler: async (args) => {
207
- const { startGenerateAll } = await import("./generate-all-DrT4ZxHX.mjs");
236
+ const { startGenerateAll } = await import("./generate-all-CIwP-3aa.mjs");
208
237
  await startGenerateAll(args, process.cwd());
209
238
  process.exit(0);
210
239
  }
211
240
  });
212
241
  //#endregion
242
+ //#region src/utils/fs-args.ts
243
+ const ExistingPath = extendType(string, {
244
+ displayName: "path",
245
+ description: "An existing path",
246
+ from(str) {
247
+ const resolved = path.resolve(str);
248
+ if (!fs.existsSync(resolved)) return Promise.reject(/* @__PURE__ */ new Error("Path doesn't exist"));
249
+ return Promise.resolve(resolved);
250
+ }
251
+ });
252
+ /** A directory, or the directory of a given file. */
253
+ const Directory = extendType(ExistingPath, {
254
+ displayName: "dir",
255
+ description: "A path to a directory or a file within a directory",
256
+ from(resolved) {
257
+ return Promise.resolve(fs.statSync(resolved).isDirectory() ? resolved : path.dirname(resolved));
258
+ }
259
+ });
260
+ /** An existing file. */
261
+ const File = extendType(ExistingPath, {
262
+ displayName: "file",
263
+ description: "A file in the file system",
264
+ from(resolved) {
265
+ if (!fs.statSync(resolved).isFile()) return Promise.reject(/* @__PURE__ */ new Error("Provided path is not a file"));
266
+ return Promise.resolve(resolved);
267
+ }
268
+ });
269
+ //#endregion
213
270
  //#region src/utils/comma-separated.ts
214
271
  /** Splits comma-separated values so `-t "a,b"` means the same as `-t a -t b`
215
272
  * instead of yielding the single value `"a,b"`, which matches nothing. */
@@ -267,7 +324,7 @@ const generateAppCmd = command({
267
324
  ...debugArgs
268
325
  },
269
326
  handler: async (args) => {
270
- const { startGenerateApp } = await import("./generate-app-DNNqA-H3.mjs");
327
+ const { startGenerateApp } = await import("./generate-app-BTs1u-9l.mjs");
271
328
  await startGenerateApp(args, process.cwd());
272
329
  process.exit(0);
273
330
  }
@@ -303,7 +360,7 @@ const generateDocumentModelCmd = command({
303
360
  ...debugArgs
304
361
  },
305
362
  handler: async (args) => {
306
- const { startGenerateDocumentModel } = await import("./generate-document-model-BJXyODfm.mjs");
363
+ const { startGenerateDocumentModel } = await import("./generate-document-model-DhDQ_06X.mjs");
307
364
  await startGenerateDocumentModel(args, process.cwd());
308
365
  process.exit(0);
309
366
  }
@@ -350,7 +407,7 @@ const generateEditorCmd = command({
350
407
  ...debugArgs
351
408
  },
352
409
  handler: async (args) => {
353
- const { startGenerateEditor } = await import("./generate-editor-BejvaVVT.mjs");
410
+ const { startGenerateEditor } = await import("./generate-editor-CW7Do69u.mjs");
354
411
  await startGenerateEditor(args, process.cwd());
355
412
  process.exit(0);
356
413
  }
@@ -377,12 +434,150 @@ const generateMigrationFileCmd = command({
377
434
  handler: async ({ migrationFile, schemaFile }) => {
378
435
  const { generateDBSchema } = await import("@powerhousedao/codegen");
379
436
  await generateDBSchema({
380
- migrationFile: path.join(process.cwd(), migrationFile),
381
- schemaFile: schemaFile ? path.join(process.cwd(), schemaFile) : void 0
437
+ migrationFile: path$1.join(process.cwd(), migrationFile),
438
+ schemaFile: schemaFile ? path$1.join(process.cwd(), schemaFile) : void 0
382
439
  });
383
440
  process.exit(0);
384
441
  }
385
442
  });
443
+ //#endregion
444
+ //#region src/commands/generate-piece-action.ts
445
+ const generatePieceActionCmd = command({
446
+ name: "piece-action",
447
+ description: "Generate an action inside an existing piece",
448
+ args: {
449
+ namePositional: positional({
450
+ type: optional(string),
451
+ displayName: "name",
452
+ description: "The name of the action, e.g. get-record"
453
+ }),
454
+ name: option({
455
+ type: optional(string),
456
+ long: "name",
457
+ short: "n",
458
+ description: "The name of the action to generate"
459
+ }),
460
+ piece: option({
461
+ type: optional(string),
462
+ long: "piece",
463
+ short: "p",
464
+ description: "The piece directory under pieces/ to add the action to. Optional when the project ships exactly one piece."
465
+ }),
466
+ requireReactor: option({
467
+ type: optional(oneOf(["read", "write"])),
468
+ long: "require-reactor",
469
+ description: "Declare reactor access for the action: read, or write (which includes read). The action then gets context.reactor"
470
+ }),
471
+ ...skipInstallArgs,
472
+ ...debugArgs
473
+ },
474
+ handler: async (args) => {
475
+ const { startGeneratePieceAction } = await import("./generate-piece-action-DbxrzfKY.mjs");
476
+ await startGeneratePieceAction(args, process.cwd());
477
+ process.exit(0);
478
+ }
479
+ });
480
+ //#endregion
481
+ //#region src/commands/generate-piece-trigger.ts
482
+ const generatePieceTriggerCmd = command({
483
+ name: "piece-trigger",
484
+ description: "Generate a trigger inside an existing piece",
485
+ args: {
486
+ namePositional: positional({
487
+ type: optional(string),
488
+ displayName: "name",
489
+ description: "The name of the trigger, e.g. new-record"
490
+ }),
491
+ name: option({
492
+ type: optional(string),
493
+ long: "name",
494
+ short: "n",
495
+ description: "The name of the trigger to generate"
496
+ }),
497
+ piece: option({
498
+ type: optional(string),
499
+ long: "piece",
500
+ short: "p",
501
+ description: "The piece directory under pieces/ to add the trigger to. Optional when the project ships exactly one piece."
502
+ }),
503
+ strategy: option({
504
+ type: oneOf(["polling", "webhook"]),
505
+ long: "strategy",
506
+ description: "How the trigger fires: polled on a schedule, or delivered to a webhook",
507
+ defaultValue: () => "polling",
508
+ defaultValueIsSerializable: true
509
+ }),
510
+ requireReactor: option({
511
+ type: optional(oneOf(["read", "write"])),
512
+ long: "require-reactor",
513
+ description: "Declare reactor access for the trigger: read, or write (which includes read). Its hooks then get context.reactor"
514
+ }),
515
+ ...skipInstallArgs,
516
+ ...debugArgs
517
+ },
518
+ handler: async (args) => {
519
+ const { startGeneratePieceTrigger } = await import("./generate-piece-trigger-CqVOcL9g.mjs");
520
+ await startGeneratePieceTrigger(args, process.cwd());
521
+ process.exit(0);
522
+ }
523
+ });
524
+ //#endregion
525
+ //#region src/commands/generate-piece.ts
526
+ const generatePieceCmd = command({
527
+ name: "piece",
528
+ description: "Generate a piece: a connector whose actions and triggers a workflow can call",
529
+ args: {
530
+ namePositional: positional({
531
+ type: optional(string),
532
+ displayName: "name",
533
+ description: "The name of the piece to generate. Its directory is the kebab-case of this."
534
+ }),
535
+ name: option({
536
+ type: optional(string),
537
+ long: "name",
538
+ short: "n",
539
+ description: "The name of the piece to generate"
540
+ }),
541
+ id: option({
542
+ type: optional(string),
543
+ long: "id",
544
+ description: "The piece id, the pieceName a workflow step holds, e.g. @acme/piece-crm. Defaults to one derived from the package name."
545
+ }),
546
+ auth: option({
547
+ type: oneOf([
548
+ "none",
549
+ "secret",
550
+ "custom"
551
+ ]),
552
+ long: "auth",
553
+ description: "The kind of connection the piece asks for",
554
+ defaultValue: () => "custom",
555
+ defaultValueIsSerializable: true
556
+ }),
557
+ description: option({
558
+ type: optional(string),
559
+ long: "description",
560
+ description: "One line describing what the piece connects to"
561
+ }),
562
+ dir: option({
563
+ type: optional(Directory),
564
+ long: "dir",
565
+ description: "Name of the directory of an existing piece to re-register"
566
+ }),
567
+ all: flag({
568
+ long: "all",
569
+ short: "a",
570
+ description: "Re-register every piece in pieces/: refresh the pieces list and the manifest, and prune what is gone"
571
+ }),
572
+ ...skipInstallArgs,
573
+ ...debugArgs
574
+ },
575
+ handler: async (args) => {
576
+ const { startGeneratePiece } = await import("./generate-piece-QTt-ddt2.mjs");
577
+ await startGeneratePiece(args, process.cwd());
578
+ process.exit(0);
579
+ }
580
+ });
386
581
  const generateProcessorCmd = command({
387
582
  name: "processor",
388
583
  description: "Generate a processor",
@@ -443,10 +638,11 @@ const generateProcessorCmd = command({
443
638
  short: "x",
444
639
  description: "Write a powerhouse/processor spec for each existing processor into specs/processors/"
445
640
  }),
641
+ ...skipInstallArgs,
446
642
  ...debugArgs
447
643
  },
448
644
  handler: async (args) => {
449
- const { startGenerateProcessor } = await import("./generate-processor-_WOx-mMe.mjs");
645
+ const { startGenerateProcessor } = await import("./generate-processor-DBtTkgo5.mjs");
450
646
  await startGenerateProcessor(args, process.cwd());
451
647
  process.exit(0);
452
648
  }
@@ -484,10 +680,11 @@ const generateSubgraphCmd = command({
484
680
  short: "x",
485
681
  description: "Write a powerhouse/subgraph spec for each existing subgraph into specs/subgraphs/"
486
682
  }),
683
+ ...skipInstallArgs,
487
684
  ...debugArgs
488
685
  },
489
686
  handler: async (args) => {
490
- const { startGenerateSubgraph } = await import("./generate-subgraph-BsHUstpl.mjs");
687
+ const { startGenerateSubgraph } = await import("./generate-subgraph-Dm27O59o.mjs");
491
688
  await startGenerateSubgraph(args, process.cwd());
492
689
  process.exit(0);
493
690
  }
@@ -504,6 +701,9 @@ const generate = subcommands({
504
701
  app: generateAppCmd,
505
702
  processor: generateProcessorCmd,
506
703
  subgraph: generateSubgraphCmd,
704
+ piece: generatePieceCmd,
705
+ "piece-action": generatePieceActionCmd,
706
+ "piece-trigger": generatePieceTriggerCmd,
507
707
  "migration-file": generateMigrationFileCmd
508
708
  }
509
709
  });
@@ -515,7 +715,7 @@ const init = command({
515
715
  args: initArgs,
516
716
  handler: async (args) => {
517
717
  if (args.debug) console.log({ args });
518
- const { startInit } = await import("./init-BZP6gvYd.mjs");
718
+ const { startInit } = await import("./init-CIEMyAug.mjs");
519
719
  await startInit(args);
520
720
  process.exit(0);
521
721
  }
@@ -538,13 +738,34 @@ This command:
538
738
  args: inspectArgs,
539
739
  handler: async (args) => {
540
740
  if (args.debug) console.log(args);
541
- const { startInspect } = await import("./inspect-DXjbQEV_.mjs");
741
+ const { startInspect } = await import("./inspect-BpCB0TPo.mjs");
542
742
  startInspect(args);
543
743
  process.exit(0);
544
744
  }
545
745
  });
546
746
  //#endregion
547
747
  //#region src/commands/install.ts
748
+ const MANIFEST_TIMEOUT_MS = 1e4;
749
+ async function fetchExternalDependencies(registryUrl, dependency) {
750
+ const base = registryUrl.endsWith("/") ? registryUrl : `${registryUrl}/`;
751
+ const spec = dependency.version ? `${dependency.name}@${dependency.version}` : dependency.name;
752
+ try {
753
+ const response = await fetch(`${base}-/cdn/${spec}/powerhouse.manifest.json`, { signal: AbortSignal.timeout(MANIFEST_TIMEOUT_MS) });
754
+ if (!response.ok) return [];
755
+ const external = (await response.json()).externalDependencies;
756
+ return typeof external === "object" && external !== null ? Object.keys(external).sort() : [];
757
+ } catch {
758
+ return [];
759
+ }
760
+ }
761
+ async function warnAboutExternalDependencies(registryUrl, dependencies) {
762
+ const found = await Promise.all(dependencies.map((dependency) => fetchExternalDependencies(registryUrl, dependency)));
763
+ for (const [i, dependency] of dependencies.entries()) {
764
+ const external = found[i];
765
+ if (external.length === 0) continue;
766
+ console.warn(`⚠ ${dependency.name}: its subgraphs and processors need packages with native addons or WebAssembly modules (${external.join(", ")}) and only run when the package is installed locally: ph install --local ${dependency.name}\n Its pieces work either way.`);
767
+ }
768
+ }
548
769
  const install = command({
549
770
  name: "install",
550
771
  aliases: ["add", "i"],
@@ -607,7 +828,7 @@ Resolution order for the registry URL:
607
828
  if (scopeRegistryArgs.length > 0) console.log(`Installing dependencies 📦 (routing ${Array.from(scopes).join(", ")} → ${registryUrl})...`);
608
829
  else console.log("Installing dependencies 📦...");
609
830
  console.log(`> ${installCommand}`);
610
- execSync(installCommand, {
831
+ execSync$1(installCommand, {
611
832
  stdio: "inherit",
612
833
  cwd: projectPath
613
834
  });
@@ -617,7 +838,7 @@ Resolution order for the registry URL:
617
838
  throw error;
618
839
  }
619
840
  }
620
- const { updateConfigFile, updateStylesFile } = await import("./utils-BzwczAW-.mjs");
841
+ const { updateConfigFile, updateStylesFile } = await import("./utils-C3c5YG6v.mjs");
621
842
  try {
622
843
  console.log("⚙️ Updating powerhouse config file...");
623
844
  updateConfigFile(dependenciesWithVersions, projectPath, "install", args.local ? "local" : "registry", registryUrl, args.registry !== void 0);
@@ -626,6 +847,7 @@ Resolution order for the registry URL:
626
847
  console.error("❌ Failed to update config file");
627
848
  throw error;
628
849
  }
850
+ if (!args.local) await warnAboutExternalDependencies(registryUrl, dependenciesWithVersions);
629
851
  if (args.local) try {
630
852
  console.log("⚙️ Updating styles.css file...");
631
853
  updateStylesFile(dependenciesWithVersions, projectPath);
@@ -691,7 +913,7 @@ This command:
691
913
  args: loginArgs,
692
914
  handler: async (args) => {
693
915
  if (args.debug) console.log(args);
694
- const { getRenown } = await import("./auth-BNkN6kS9.mjs");
916
+ const { getRenown } = await import("./auth-CNhbN5UM.mjs");
695
917
  const renown = await getRenown(args.renownUrl);
696
918
  if (args.showDid) {
697
919
  console.log(renown.did);
@@ -760,7 +982,7 @@ This command:
760
982
  }
761
983
  });
762
984
  async function handleLogout() {
763
- const { getRenown } = await import("./auth-BNkN6kS9.mjs");
985
+ const { getRenown } = await import("./auth-CNhbN5UM.mjs");
764
986
  const renown = await getRenown();
765
987
  if (!renown.user) {
766
988
  console.log("Not currently authenticated.");
@@ -794,7 +1016,7 @@ const migrate = command({
794
1016
  description: "Run migrations",
795
1017
  handler: async (args) => {
796
1018
  if (args.debug) console.log(args);
797
- const { startMigrate } = await import("./migrate-jGKfE02L.mjs");
1019
+ const { startMigrate } = await import("./migrate-DK4HK7Dn.mjs");
798
1020
  await startMigrate(args);
799
1021
  process.exit(0);
800
1022
  }
@@ -842,7 +1064,7 @@ This command:
842
1064
  const { projectPath } = await getPowerhouseProjectInfo();
843
1065
  if (!projectPath) throw new Error("Could not find project path.");
844
1066
  const { checkNpmAuth, npmPublish, resolveRegistryUrl } = await import("@powerhousedao/shared/registry");
845
- const { mintRegistryAuthToken } = await import("./registry-auth-DxEWCJu2.mjs");
1067
+ const { mintRegistryAuthToken } = await import("./registry-auth-Bm5AR-fB.mjs");
846
1068
  const registryUrl = resolveRegistryUrl({
847
1069
  registry: args.registry,
848
1070
  projectPath
@@ -932,7 +1154,7 @@ Usage:
932
1154
  const projectPath = (await getPowerhouseProjectInfo().catch(() => null))?.projectPath ?? process.cwd();
933
1155
  const [{ resolveRegistryUrl, writeRegistryAuthToken }, { mintRegistryAuthToken }, { parseExpiry, formatExpiry }] = await Promise.all([
934
1156
  import("@powerhousedao/shared/registry"),
935
- import("./registry-auth-DxEWCJu2.mjs"),
1157
+ import("./registry-auth-Bm5AR-fB.mjs"),
936
1158
  import("@renown/sdk/node")
937
1159
  ]);
938
1160
  const registryUrl = resolveRegistryUrl({
@@ -969,7 +1191,7 @@ This command:
969
1191
  const { basePath, dbPath, migrate, migrateStatus, reset, yes } = args;
970
1192
  if (basePath) process.env.BASE_PATH = basePath;
971
1193
  if (reset) {
972
- const { resetSwitchboardDatabase } = await import("./switchboard-reset-BcQXlcVf.mjs");
1194
+ const { resetSwitchboardDatabase } = await import("./switchboard-reset-CX_Lzw3O.mjs");
973
1195
  await resetSwitchboardDatabase({
974
1196
  dbPath,
975
1197
  yes
@@ -977,14 +1199,14 @@ This command:
977
1199
  process.exit(0);
978
1200
  }
979
1201
  if (migrate || migrateStatus) {
980
- const { runSwitchboardMigrations } = await import("./switchboard-migrate-NQ7LHWSi.mjs");
1202
+ const { runSwitchboardMigrations } = await import("./switchboard-migrate-7JQZM7-5.mjs");
981
1203
  await runSwitchboardMigrations({
982
1204
  dbPath,
983
1205
  statusOnly: migrateStatus
984
1206
  });
985
1207
  process.exit(0);
986
1208
  }
987
- const { startSwitchboard } = await import("./switchboard-iRFugh8I.mjs");
1209
+ const { startSwitchboard } = await import("./switchboard-yDRjakQT.mjs");
988
1210
  const { defaultDriveUrl, renown } = await startSwitchboard(args);
989
1211
  console.log(" ➜ Switchboard:", defaultDriveUrl);
990
1212
  if (renown) console.log(" ➜ Identity:", renown.did);
@@ -1021,7 +1243,8 @@ This command:
1021
1243
  });
1022
1244
  try {
1023
1245
  console.log("Uninstalling dependencies 📦 ...");
1024
- execSync$1(await getPowerhouseProjectUninstallCommand(packageManager, args.dependencies), {
1246
+ const uninstallCommand = await getPowerhouseProjectUninstallCommand(packageManager, args.dependencies);
1247
+ execSync(uninstallCommand, {
1025
1248
  stdio: "inherit",
1026
1249
  cwd: projectPath
1027
1250
  });
@@ -1030,7 +1253,7 @@ This command:
1030
1253
  console.error("❌ Failed to uninstall dependencies");
1031
1254
  throw error;
1032
1255
  }
1033
- const { removeStylesImports, updateConfigFile } = await import("./utils-BzwczAW-.mjs");
1256
+ const { removeStylesImports, updateConfigFile } = await import("./utils-C3c5YG6v.mjs");
1034
1257
  try {
1035
1258
  console.log("⚙️ Updating powerhouse config file...");
1036
1259
  updateConfigFile(dependenciesWithVersions, projectPath, "uninstall");
@@ -1157,11 +1380,20 @@ This command:
1157
1380
  1. Starts a Vetra Switchboard with a "Vetra" drive for document storage
1158
1381
  2. Optionally connects to remote drives instead of creating a local drive
1159
1382
  3. Starts Connect Studio pointing to the Switchboard for user interaction (unless disabled)
1160
- 4. Enables real-time updates, collaboration, and code generation`,
1383
+ 4. Enables real-time updates, collaboration, and code generation
1384
+
1385
+ Default drives:
1386
+ Connect's default drives resolve to the Vetra drive (and the preview drive
1387
+ when using --watch), plus any drives configured under
1388
+ connect.drives.defaultDrives in powerhouse.config.json - de-duplicated by
1389
+ URL, so configuring project drives does not cost you the Vetra drive.
1390
+ An explicit --default-drives-url is appended to that list (de-duplicated);
1391
+ it never replaces the Vetra drive.
1392
+ `,
1161
1393
  args: vetraArgs,
1162
1394
  handler: async (args) => {
1163
1395
  if (args.debug) console.log(args);
1164
- const { startVetra } = await import("./vetra-DkF6EJMY.mjs");
1396
+ const { startVetra } = await import("./vetra-CPGUTtaF.mjs");
1165
1397
  await startVetra(args);
1166
1398
  }
1167
1399
  }),
@@ -1180,10 +1412,13 @@ This command:
1180
1412
  install,
1181
1413
  uninstall
1182
1414
  };
1415
+ //#endregion
1416
+ //#region src/commands/ph-cli.ts
1417
+ const version = getVersion();
1183
1418
  const phCli = subcommands({
1184
1419
  name: "ph-cli",
1185
1420
  description: PH_CLI_DESCRIPTION,
1186
- version: getVersion(),
1421
+ version,
1187
1422
  cmds: phCliCommands
1188
1423
  });
1189
1424
  //#endregion
@@ -1231,7 +1466,7 @@ function printDbRecoveryHint(err) {
1231
1466
  //#endregion
1232
1467
  //#region src/cli.ts
1233
1468
  let sentryClient = void 0;
1234
- const COMMANDS_WITH_SUBCOMMANDS = new Set(["connect", "vetra"]);
1469
+ const COMMANDS_WITH_SUBCOMMANDS = /* @__PURE__ */ new Set(["connect", "vetra"]);
1235
1470
  function detectPackageManager() {
1236
1471
  const ua = process.env.npm_config_user_agent;
1237
1472
  if (!ua) return void 0;
@@ -1263,12 +1498,14 @@ async function main() {
1263
1498
  "build",
1264
1499
  "preview",
1265
1500
  "config"
1266
- ].includes(args[1]) && !isHelp) await run(cli, [
1267
- "connect",
1268
- "studio",
1269
- ...restArgs
1270
- ]);
1271
- else await run(cli, args);
1501
+ ].includes(args[1]) && !isHelp) {
1502
+ const argsWithDefaultConnectSubCommand = [
1503
+ "connect",
1504
+ "studio",
1505
+ ...restArgs
1506
+ ];
1507
+ await run(cli, argsWithDefaultConnectSubCommand);
1508
+ } else await run(cli, args);
1272
1509
  }
1273
1510
  await main().catch(async (error) => {
1274
1511
  const isDebug = process.argv.slice(2).includes("--debug");
@@ -1284,4 +1521,4 @@ await main().catch(async (error) => {
1284
1521
  export {};
1285
1522
 
1286
1523
  //# sourceMappingURL=cli.mjs.map
1287
- //# debugId=ab6e0f84-63f5-57ba-a18e-7091ccbf13c6
1524
+ //# debugId=0ec21c09-2ac5-5793-8141-041509a77217