@powerhousedao/ph-cli 6.2.3-dev.4 → 6.2.3-dev.40

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 (77) 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-Di0SwHGs.mjs +166 -0
  5. package/dist/build-Di0SwHGs.mjs.map +1 -0
  6. package/dist/build-Dk9HoX9_.mjs +4 -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 +294 -89
  11. package/dist/cli.mjs.map +1 -1
  12. package/dist/connect-build-2dTdDm81.mjs +153 -0
  13. package/dist/connect-build-2dTdDm81.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-C5WTHsqu.mjs +28 -0
  32. package/dist/generate-piece-action-C5WTHsqu.mjs.map +1 -0
  33. package/dist/generate-piece-trigger-DR10CPOG.mjs +29 -0
  34. package/dist/generate-piece-trigger-DR10CPOG.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-CJMoMzWx.mjs → switchboard-CgVB4U76.mjs} +17 -5
  51. package/dist/switchboard-CgVB4U76.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-nHCI3pha.mjs +4 -0
  55. package/dist/{switchboard-reset-BcQXlcVf.mjs → switchboard-reset-CX_Lzw3O.mjs} +4 -4
  56. package/dist/{switchboard-reset-BcQXlcVf.mjs.map → switchboard-reset-CX_Lzw3O.mjs.map} +1 -1
  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-CQSUBUvg.mjs} +63 -15
  61. package/dist/vetra-CQSUBUvg.mjs.map +1 -0
  62. package/package.json +17 -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.map +0 -1
  76. package/dist/switchboard-iRFugh8I.mjs +0 -4
  77. 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]="adfc754d-b98f-5eb1-9873-7e473fff27c0")}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.4";
20
+ return "6.2.3-dev.40";
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-Dk9HoX9_.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-2dTdDm81.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,140 @@ 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
+ ...skipInstallArgs,
467
+ ...debugArgs
468
+ },
469
+ handler: async (args) => {
470
+ const { startGeneratePieceAction } = await import("./generate-piece-action-C5WTHsqu.mjs");
471
+ await startGeneratePieceAction(args, process.cwd());
472
+ process.exit(0);
473
+ }
474
+ });
475
+ //#endregion
476
+ //#region src/commands/generate-piece-trigger.ts
477
+ const generatePieceTriggerCmd = command({
478
+ name: "piece-trigger",
479
+ description: "Generate a trigger inside an existing piece",
480
+ args: {
481
+ namePositional: positional({
482
+ type: optional(string),
483
+ displayName: "name",
484
+ description: "The name of the trigger, e.g. new-record"
485
+ }),
486
+ name: option({
487
+ type: optional(string),
488
+ long: "name",
489
+ short: "n",
490
+ description: "The name of the trigger to generate"
491
+ }),
492
+ piece: option({
493
+ type: optional(string),
494
+ long: "piece",
495
+ short: "p",
496
+ description: "The piece directory under pieces/ to add the trigger to. Optional when the project ships exactly one piece."
497
+ }),
498
+ strategy: option({
499
+ type: oneOf(["polling", "webhook"]),
500
+ long: "strategy",
501
+ description: "How the trigger fires: polled on a schedule, or delivered to a webhook",
502
+ defaultValue: () => "polling",
503
+ defaultValueIsSerializable: true
504
+ }),
505
+ ...skipInstallArgs,
506
+ ...debugArgs
507
+ },
508
+ handler: async (args) => {
509
+ const { startGeneratePieceTrigger } = await import("./generate-piece-trigger-DR10CPOG.mjs");
510
+ await startGeneratePieceTrigger(args, process.cwd());
511
+ process.exit(0);
512
+ }
513
+ });
514
+ //#endregion
515
+ //#region src/commands/generate-piece.ts
516
+ const generatePieceCmd = command({
517
+ name: "piece",
518
+ description: "Generate a piece: a connector whose actions and triggers a workflow can call",
519
+ args: {
520
+ namePositional: positional({
521
+ type: optional(string),
522
+ displayName: "name",
523
+ description: "The name of the piece to generate. Its directory is the kebab-case of this."
524
+ }),
525
+ name: option({
526
+ type: optional(string),
527
+ long: "name",
528
+ short: "n",
529
+ description: "The name of the piece to generate"
530
+ }),
531
+ id: option({
532
+ type: optional(string),
533
+ long: "id",
534
+ description: "The piece id, the pieceName a workflow step holds, e.g. @acme/piece-crm. Defaults to one derived from the package name."
535
+ }),
536
+ auth: option({
537
+ type: oneOf([
538
+ "none",
539
+ "secret",
540
+ "custom"
541
+ ]),
542
+ long: "auth",
543
+ description: "The kind of connection the piece asks for",
544
+ defaultValue: () => "custom",
545
+ defaultValueIsSerializable: true
546
+ }),
547
+ description: option({
548
+ type: optional(string),
549
+ long: "description",
550
+ description: "One line describing what the piece connects to"
551
+ }),
552
+ dir: option({
553
+ type: optional(Directory),
554
+ long: "dir",
555
+ description: "Name of the directory of an existing piece to re-register"
556
+ }),
557
+ all: flag({
558
+ long: "all",
559
+ short: "a",
560
+ description: "Re-register every piece in pieces/: refresh the pieces list and the manifest, and prune what is gone"
561
+ }),
562
+ ...skipInstallArgs,
563
+ ...debugArgs
564
+ },
565
+ handler: async (args) => {
566
+ const { startGeneratePiece } = await import("./generate-piece-QTt-ddt2.mjs");
567
+ await startGeneratePiece(args, process.cwd());
568
+ process.exit(0);
569
+ }
570
+ });
386
571
  const generateProcessorCmd = command({
387
572
  name: "processor",
388
573
  description: "Generate a processor",
@@ -443,10 +628,11 @@ const generateProcessorCmd = command({
443
628
  short: "x",
444
629
  description: "Write a powerhouse/processor spec for each existing processor into specs/processors/"
445
630
  }),
631
+ ...skipInstallArgs,
446
632
  ...debugArgs
447
633
  },
448
634
  handler: async (args) => {
449
- const { startGenerateProcessor } = await import("./generate-processor-_WOx-mMe.mjs");
635
+ const { startGenerateProcessor } = await import("./generate-processor-DBtTkgo5.mjs");
450
636
  await startGenerateProcessor(args, process.cwd());
451
637
  process.exit(0);
452
638
  }
@@ -484,10 +670,11 @@ const generateSubgraphCmd = command({
484
670
  short: "x",
485
671
  description: "Write a powerhouse/subgraph spec for each existing subgraph into specs/subgraphs/"
486
672
  }),
673
+ ...skipInstallArgs,
487
674
  ...debugArgs
488
675
  },
489
676
  handler: async (args) => {
490
- const { startGenerateSubgraph } = await import("./generate-subgraph-BsHUstpl.mjs");
677
+ const { startGenerateSubgraph } = await import("./generate-subgraph-Dm27O59o.mjs");
491
678
  await startGenerateSubgraph(args, process.cwd());
492
679
  process.exit(0);
493
680
  }
@@ -504,6 +691,9 @@ const generate = subcommands({
504
691
  app: generateAppCmd,
505
692
  processor: generateProcessorCmd,
506
693
  subgraph: generateSubgraphCmd,
694
+ piece: generatePieceCmd,
695
+ "piece-action": generatePieceActionCmd,
696
+ "piece-trigger": generatePieceTriggerCmd,
507
697
  "migration-file": generateMigrationFileCmd
508
698
  }
509
699
  });
@@ -515,7 +705,7 @@ const init = command({
515
705
  args: initArgs,
516
706
  handler: async (args) => {
517
707
  if (args.debug) console.log({ args });
518
- const { startInit } = await import("./init-BZP6gvYd.mjs");
708
+ const { startInit } = await import("./init-CIEMyAug.mjs");
519
709
  await startInit(args);
520
710
  process.exit(0);
521
711
  }
@@ -538,7 +728,7 @@ This command:
538
728
  args: inspectArgs,
539
729
  handler: async (args) => {
540
730
  if (args.debug) console.log(args);
541
- const { startInspect } = await import("./inspect-DXjbQEV_.mjs");
731
+ const { startInspect } = await import("./inspect-BpCB0TPo.mjs");
542
732
  startInspect(args);
543
733
  process.exit(0);
544
734
  }
@@ -607,7 +797,7 @@ Resolution order for the registry URL:
607
797
  if (scopeRegistryArgs.length > 0) console.log(`Installing dependencies 📦 (routing ${Array.from(scopes).join(", ")} → ${registryUrl})...`);
608
798
  else console.log("Installing dependencies 📦...");
609
799
  console.log(`> ${installCommand}`);
610
- execSync(installCommand, {
800
+ execSync$1(installCommand, {
611
801
  stdio: "inherit",
612
802
  cwd: projectPath
613
803
  });
@@ -617,7 +807,7 @@ Resolution order for the registry URL:
617
807
  throw error;
618
808
  }
619
809
  }
620
- const { updateConfigFile, updateStylesFile } = await import("./utils-BzwczAW-.mjs");
810
+ const { updateConfigFile, updateStylesFile } = await import("./utils-C3c5YG6v.mjs");
621
811
  try {
622
812
  console.log("⚙️ Updating powerhouse config file...");
623
813
  updateConfigFile(dependenciesWithVersions, projectPath, "install", args.local ? "local" : "registry", registryUrl, args.registry !== void 0);
@@ -691,7 +881,7 @@ This command:
691
881
  args: loginArgs,
692
882
  handler: async (args) => {
693
883
  if (args.debug) console.log(args);
694
- const { getRenown } = await import("./auth-BNkN6kS9.mjs");
884
+ const { getRenown } = await import("./auth-CNhbN5UM.mjs");
695
885
  const renown = await getRenown(args.renownUrl);
696
886
  if (args.showDid) {
697
887
  console.log(renown.did);
@@ -760,7 +950,7 @@ This command:
760
950
  }
761
951
  });
762
952
  async function handleLogout() {
763
- const { getRenown } = await import("./auth-BNkN6kS9.mjs");
953
+ const { getRenown } = await import("./auth-CNhbN5UM.mjs");
764
954
  const renown = await getRenown();
765
955
  if (!renown.user) {
766
956
  console.log("Not currently authenticated.");
@@ -794,7 +984,7 @@ const migrate = command({
794
984
  description: "Run migrations",
795
985
  handler: async (args) => {
796
986
  if (args.debug) console.log(args);
797
- const { startMigrate } = await import("./migrate-jGKfE02L.mjs");
987
+ const { startMigrate } = await import("./migrate-DK4HK7Dn.mjs");
798
988
  await startMigrate(args);
799
989
  process.exit(0);
800
990
  }
@@ -842,7 +1032,7 @@ This command:
842
1032
  const { projectPath } = await getPowerhouseProjectInfo();
843
1033
  if (!projectPath) throw new Error("Could not find project path.");
844
1034
  const { checkNpmAuth, npmPublish, resolveRegistryUrl } = await import("@powerhousedao/shared/registry");
845
- const { mintRegistryAuthToken } = await import("./registry-auth-DxEWCJu2.mjs");
1035
+ const { mintRegistryAuthToken } = await import("./registry-auth-Bm5AR-fB.mjs");
846
1036
  const registryUrl = resolveRegistryUrl({
847
1037
  registry: args.registry,
848
1038
  projectPath
@@ -932,7 +1122,7 @@ Usage:
932
1122
  const projectPath = (await getPowerhouseProjectInfo().catch(() => null))?.projectPath ?? process.cwd();
933
1123
  const [{ resolveRegistryUrl, writeRegistryAuthToken }, { mintRegistryAuthToken }, { parseExpiry, formatExpiry }] = await Promise.all([
934
1124
  import("@powerhousedao/shared/registry"),
935
- import("./registry-auth-DxEWCJu2.mjs"),
1125
+ import("./registry-auth-Bm5AR-fB.mjs"),
936
1126
  import("@renown/sdk/node")
937
1127
  ]);
938
1128
  const registryUrl = resolveRegistryUrl({
@@ -969,7 +1159,7 @@ This command:
969
1159
  const { basePath, dbPath, migrate, migrateStatus, reset, yes } = args;
970
1160
  if (basePath) process.env.BASE_PATH = basePath;
971
1161
  if (reset) {
972
- const { resetSwitchboardDatabase } = await import("./switchboard-reset-BcQXlcVf.mjs");
1162
+ const { resetSwitchboardDatabase } = await import("./switchboard-reset-CX_Lzw3O.mjs");
973
1163
  await resetSwitchboardDatabase({
974
1164
  dbPath,
975
1165
  yes
@@ -977,14 +1167,14 @@ This command:
977
1167
  process.exit(0);
978
1168
  }
979
1169
  if (migrate || migrateStatus) {
980
- const { runSwitchboardMigrations } = await import("./switchboard-migrate-NQ7LHWSi.mjs");
1170
+ const { runSwitchboardMigrations } = await import("./switchboard-migrate-7JQZM7-5.mjs");
981
1171
  await runSwitchboardMigrations({
982
1172
  dbPath,
983
1173
  statusOnly: migrateStatus
984
1174
  });
985
1175
  process.exit(0);
986
1176
  }
987
- const { startSwitchboard } = await import("./switchboard-iRFugh8I.mjs");
1177
+ const { startSwitchboard } = await import("./switchboard-nHCI3pha.mjs");
988
1178
  const { defaultDriveUrl, renown } = await startSwitchboard(args);
989
1179
  console.log(" ➜ Switchboard:", defaultDriveUrl);
990
1180
  if (renown) console.log(" ➜ Identity:", renown.did);
@@ -1021,7 +1211,8 @@ This command:
1021
1211
  });
1022
1212
  try {
1023
1213
  console.log("Uninstalling dependencies 📦 ...");
1024
- execSync$1(await getPowerhouseProjectUninstallCommand(packageManager, args.dependencies), {
1214
+ const uninstallCommand = await getPowerhouseProjectUninstallCommand(packageManager, args.dependencies);
1215
+ execSync(uninstallCommand, {
1025
1216
  stdio: "inherit",
1026
1217
  cwd: projectPath
1027
1218
  });
@@ -1030,7 +1221,7 @@ This command:
1030
1221
  console.error("❌ Failed to uninstall dependencies");
1031
1222
  throw error;
1032
1223
  }
1033
- const { removeStylesImports, updateConfigFile } = await import("./utils-BzwczAW-.mjs");
1224
+ const { removeStylesImports, updateConfigFile } = await import("./utils-C3c5YG6v.mjs");
1034
1225
  try {
1035
1226
  console.log("⚙️ Updating powerhouse config file...");
1036
1227
  updateConfigFile(dependenciesWithVersions, projectPath, "uninstall");
@@ -1157,11 +1348,20 @@ This command:
1157
1348
  1. Starts a Vetra Switchboard with a "Vetra" drive for document storage
1158
1349
  2. Optionally connects to remote drives instead of creating a local drive
1159
1350
  3. Starts Connect Studio pointing to the Switchboard for user interaction (unless disabled)
1160
- 4. Enables real-time updates, collaboration, and code generation`,
1351
+ 4. Enables real-time updates, collaboration, and code generation
1352
+
1353
+ Default drives:
1354
+ Connect's default drives resolve to the Vetra drive (and the preview drive
1355
+ when using --watch), plus any drives configured under
1356
+ connect.drives.defaultDrives in powerhouse.config.json - de-duplicated by
1357
+ URL, so configuring project drives does not cost you the Vetra drive.
1358
+ An explicit --default-drives-url is appended to that list (de-duplicated);
1359
+ it never replaces the Vetra drive.
1360
+ `,
1161
1361
  args: vetraArgs,
1162
1362
  handler: async (args) => {
1163
1363
  if (args.debug) console.log(args);
1164
- const { startVetra } = await import("./vetra-DkF6EJMY.mjs");
1364
+ const { startVetra } = await import("./vetra-CQSUBUvg.mjs");
1165
1365
  await startVetra(args);
1166
1366
  }
1167
1367
  }),
@@ -1180,10 +1380,13 @@ This command:
1180
1380
  install,
1181
1381
  uninstall
1182
1382
  };
1383
+ //#endregion
1384
+ //#region src/commands/ph-cli.ts
1385
+ const version = getVersion();
1183
1386
  const phCli = subcommands({
1184
1387
  name: "ph-cli",
1185
1388
  description: PH_CLI_DESCRIPTION,
1186
- version: getVersion(),
1389
+ version,
1187
1390
  cmds: phCliCommands
1188
1391
  });
1189
1392
  //#endregion
@@ -1231,7 +1434,7 @@ function printDbRecoveryHint(err) {
1231
1434
  //#endregion
1232
1435
  //#region src/cli.ts
1233
1436
  let sentryClient = void 0;
1234
- const COMMANDS_WITH_SUBCOMMANDS = new Set(["connect", "vetra"]);
1437
+ const COMMANDS_WITH_SUBCOMMANDS = /* @__PURE__ */ new Set(["connect", "vetra"]);
1235
1438
  function detectPackageManager() {
1236
1439
  const ua = process.env.npm_config_user_agent;
1237
1440
  if (!ua) return void 0;
@@ -1263,12 +1466,14 @@ async function main() {
1263
1466
  "build",
1264
1467
  "preview",
1265
1468
  "config"
1266
- ].includes(args[1]) && !isHelp) await run(cli, [
1267
- "connect",
1268
- "studio",
1269
- ...restArgs
1270
- ]);
1271
- else await run(cli, args);
1469
+ ].includes(args[1]) && !isHelp) {
1470
+ const argsWithDefaultConnectSubCommand = [
1471
+ "connect",
1472
+ "studio",
1473
+ ...restArgs
1474
+ ];
1475
+ await run(cli, argsWithDefaultConnectSubCommand);
1476
+ } else await run(cli, args);
1272
1477
  }
1273
1478
  await main().catch(async (error) => {
1274
1479
  const isDebug = process.argv.slice(2).includes("--debug");
@@ -1284,4 +1489,4 @@ await main().catch(async (error) => {
1284
1489
  export {};
1285
1490
 
1286
1491
  //# sourceMappingURL=cli.mjs.map
1287
- //# debugId=ab6e0f84-63f5-57ba-a18e-7091ccbf13c6
1492
+ //# debugId=adfc754d-b98f-5eb1-9873-7e473fff27c0