@powerhousedao/ph-cli 6.2.3-dev.44 → 6.2.3-dev.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs CHANGED
@@ -1,6 +1,6 @@
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]="adfc754d-b98f-5eb1-9873-7e473fff27c0")}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]="658f151e-b897-505c-bd5b-5a4d9dd1d324")}catch(e){}}();
4
4
  import { n as skipInstallArgs } from "./install-added-dependencies-DVSbzler.mjs";
5
5
  import { initCliTelemetry } from "@powerhousedao/shared/clis/telemetry";
6
6
  import { assertNodeVersion } from "@powerhousedao/shared/clis/utils";
@@ -17,7 +17,7 @@ import { createInterface } from "node:readline/promises";
17
17
  import { bold, yellow } from "colorette";
18
18
  //#region src/get-version.ts
19
19
  function getVersion() {
20
- return "6.2.3-dev.44";
20
+ return "6.2.3-dev.45";
21
21
  }
22
22
  //#endregion
23
23
  //#region src/utils/constants.ts
@@ -463,11 +463,16 @@ const generatePieceActionCmd = command({
463
463
  short: "p",
464
464
  description: "The piece directory under pieces/ to add the action to. Optional when the project ships exactly one piece."
465
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
+ }),
466
471
  ...skipInstallArgs,
467
472
  ...debugArgs
468
473
  },
469
474
  handler: async (args) => {
470
- const { startGeneratePieceAction } = await import("./generate-piece-action-C5WTHsqu.mjs");
475
+ const { startGeneratePieceAction } = await import("./generate-piece-action-DbxrzfKY.mjs");
471
476
  await startGeneratePieceAction(args, process.cwd());
472
477
  process.exit(0);
473
478
  }
@@ -502,11 +507,16 @@ const generatePieceTriggerCmd = command({
502
507
  defaultValue: () => "polling",
503
508
  defaultValueIsSerializable: true
504
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
+ }),
505
515
  ...skipInstallArgs,
506
516
  ...debugArgs
507
517
  },
508
518
  handler: async (args) => {
509
- const { startGeneratePieceTrigger } = await import("./generate-piece-trigger-DR10CPOG.mjs");
519
+ const { startGeneratePieceTrigger } = await import("./generate-piece-trigger-CqVOcL9g.mjs");
510
520
  await startGeneratePieceTrigger(args, process.cwd());
511
521
  process.exit(0);
512
522
  }
@@ -1489,4 +1499,4 @@ await main().catch(async (error) => {
1489
1499
  export {};
1490
1500
 
1491
1501
  //# sourceMappingURL=cli.mjs.map
1492
- //# debugId=adfc754d-b98f-5eb1-9873-7e473fff27c0
1502
+ //# debugId=658f151e-b897-505c-bd5b-5a4d9dd1d324
package/dist/cli.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.mjs","sources":["../src/get-version.ts","../src/utils/constants.ts","../src/commands/ph-cli-help.ts","../src/commands/access-token.ts","../src/commands/build.ts","../src/commands/connect.ts","../src/commands/generate-all.ts","../src/utils/fs-args.ts","../src/utils/comma-separated.ts","../src/commands/generate-app.ts","../src/commands/generate-document-model.ts","../src/commands/generate-editor.ts","../src/commands/generate-migration-file.ts","../src/commands/generate-piece-action.ts","../src/commands/generate-piece-trigger.ts","../src/commands/generate-piece.ts","../src/commands/generate-processor.ts","../src/commands/generate-subgraph.ts","../src/commands/generate.ts","../src/commands/init.ts","../src/commands/inspect.ts","../src/commands/install.ts","../src/commands/list.ts","../src/commands/login.ts","../src/commands/logout.ts","../src/commands/migrate.ts","../src/commands/publish.ts","../src/commands/registry-login.ts","../src/commands/switchboard.ts","../src/commands/uninstall.ts","../src/commands/unpublish.ts","../src/commands/vetra.ts","../src/commands/ph-cli-commands.ts","../src/commands/ph-cli.ts","../src/utils/db-error-hint.ts","../src/cli.ts"],"sourcesContent":["declare const CLI_VERSION: string | undefined;\ndeclare const CLI_GIT_SHA: string | undefined;\n\nexport function getVersion() {\n if (typeof CLI_VERSION !== \"undefined\") return CLI_VERSION;\n return (\n process.env.WORKSPACE_VERSION ||\n process.env.npm_package_version ||\n \"unknown\"\n );\n}\n\nexport function getGitHash() {\n if (typeof CLI_GIT_SHA !== \"undefined\") return CLI_GIT_SHA;\n return process.env.WORKSPACE_GIT_SHA || \"unknown\";\n}\n","export const PH_CLI_DESCRIPTION =\n \"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.\" as const;\n","import { phCliHelpCommands } from \"@powerhousedao/shared/clis/args\";\nimport { subcommands } from \"cmd-ts\";\nimport { getVersion } from \"../get-version.js\";\nimport { PH_CLI_DESCRIPTION } from \"../utils/constants.js\";\n\nconst version = getVersion();\nexport const phCliHelp = subcommands({\n name: \"ph-cli\",\n description: PH_CLI_DESCRIPTION,\n version,\n cmds: phCliHelpCommands,\n});\n","import { accessTokenArgs } from \"@powerhousedao/shared/clis/args\";\nimport { DEFAULT_EXPIRY_SECONDS } from \"@powerhousedao/shared/clis/constants\";\nimport { command } from \"cmd-ts\";\n\nexport const accessToken = command({\n name: \"access-token\",\n description: `\nThe access-token command generates a bearer token for API authentication. This token\ncan be used to authenticate requests to Powerhouse APIs like reactor-api (Switchboard).\n\nThis command:\n1. Uses your CLI's cryptographic identity (DID) to sign a verifiable credential\n2. Creates a JWT bearer token with configurable expiration\n3. Outputs the token to stdout (info to stderr) for easy piping\n\nPrerequisites:\n You must have a cryptographic identity. Run 'ph login' first to:\n - Generate a keypair (stored in .ph/.keypair.json)\n - Optionally link your Ethereum address (stored in .ph/.renown.json)\n\nToken Details:\n The generated token is a JWT (JSON Web Token) containing:\n - Issuer (iss): Your CLI's DID (did:key:...)\n - Subject (sub): Your CLI's DID\n - Credential Subject: Chain ID, network ID, and address (if authenticated)\n - Expiration (exp): Based on --expiry option\n - Audience (aud): If --audience is specified\n\nOutput:\n- Token information (DID, address, expiry) is printed to stderr\n- The token itself is printed to stdout for easy piping/copying\n\nThis allows you to use the command in scripts:\n TOKEN=$(ph access-token)\n curl -H \"Authorization: Bearer $TOKEN\" http://localhost:4001/graphql\n\nUsage with APIs:\n Generate token and use with curl\n TOKEN=$(ph access-token --expiry 1d)\n curl -X POST http://localhost:4001/graphql \\\\\n -H \"Content-Type: application/json\" \\\\\n -H \"Authorization: Bearer $TOKEN\" \\\\\n -d '{\"query\": \"{ drives { id name } }\"}'\n\n Export as environment variable\n export PH_ACCESS_TOKEN=$(ph access-token)\n\nNotes:\n - Tokens are self-signed using your CLI's private key\n - No network request is made; tokens are generated locally\n - The recipient API must trust your CLI's DID to accept the token\n - For reactor-api, ensure AUTH_ENABLED=true to require authentication\n`,\n args: accessTokenArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n const { generateAccessToken, parseExpiry, formatExpiry } =\n await import(\"@renown/sdk/node\");\n const { getRenown } = await import(\"../services/auth.js\");\n const renown = await getRenown();\n\n let expiresIn = DEFAULT_EXPIRY_SECONDS;\n if (args.expiry) expiresIn = parseExpiry(args.expiry);\n\n const result = await generateAccessToken(renown, {\n expiresIn,\n aud: args.audience,\n });\n\n // Output token info to stderr, token itself to stdout for piping\n console.error(`CLI DID: ${result.did}`);\n console.error(`ETH Address: ${result.address}`);\n console.error(`Token expires in: ${formatExpiry(expiresIn)}`);\n console.error(\"\");\n\n console.log(result.token);\n process.exit(0);\n },\n});\n","import { buildArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const build = command({\n name: \"build\",\n description: `\nBuild a Powerhouse package for publishing: a browser bundle and a node bundle of its\ndocument models, editors, subgraphs and processors, type declarations, and its stylesheet.\n\nPieces under pieces/ are built too, each into its own self-contained module under\ndist/node/pieces/<name>, with a descriptor.json and package.json written beside it and\nthe piece listed in dist/powerhouse.manifest.json. A piece takes the package's version: an\nentry in pieces/index.ts that declares version fails the build. A package that ships only\npieces is an ordinary package: it carries the same boilerplate, and every step above runs\nfor it too.\n\ntsc runs first. If it reports type errors the build asks whether to go ahead, and stops\nwhere it can't ask. --ignore-type-errors builds without asking; a package built that way\ncan load and still fail at runtime, so don't publish it.`,\n args: buildArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n try {\n const { runBuild } = await import(\"../services/build.js\");\n await runBuild(args);\n } catch (error) {\n console.error(error);\n process.exit(1);\n }\n },\n});\n","import {\n connectBuildArgs,\n connectConfigArgs,\n connectPreviewArgs,\n connectStudioArgs,\n} from \"@powerhousedao/shared/clis/args\";\nimport { command, subcommands } from \"cmd-ts\";\nexport const studio = command({\n name: \"studio\",\n description: `The studio command starts the Connect Studio, a development environment for building\nand testing Powerhouse applications. It provides a visual interface for working with\nyour project.\n\nThis command:\n1. Starts a local Connect Studio server\n2. Provides a web interface for development\n3. Allows you to interact with your project components\n4. Supports various configuration options for customization\n`,\n args: connectStudioArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n const { runConnectStudio } = await import(\"../services/connect-studio.js\");\n await runConnectStudio(args);\n },\n});\n\nexport const build = command({\n name: \"build\",\n description: `The Connect build command creates a production build with the project's local and\nexternal packages included.\n\nRuntime-config overrides (all combinable — last wins on collision):\n ph connect build Build with the current source config.\n ph connect build <key> <value> Build with a positional override applied (e.g. ph connect build connect.renown.url https://renown.staging).\n ph connect build --<field> <value> Build with a per-field flag override (e.g. --renown-url https://renown.staging).\n ph connect build --json '{\"app\":{\"workflowsEnabled\":true}}'\n Build with a bulk override. The payload is the connect.* block\n without the \"connect\" wrapper; unknown keys are rejected.\n\nBuild has no read mode; passing only <key> without <value> errors out (use \\`ph connect config <key>\\` to read).\n`,\n args: connectBuildArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n const { runConnectBuild } = await import(\"../services/connect-build.js\");\n await runConnectBuild(args);\n process.exit(0);\n },\n});\n\nexport const preview = command({\n name: \"preview\",\n description: `The Connect preview command previews a built Connect project.\nNOTE: You must run \\`ph connect build\\` first\n`,\n args: connectPreviewArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n const { runConnectPreview } =\n await import(\"../services/connect-preview.js\");\n await runConnectPreview(args);\n },\n});\n\nexport const config = command({\n name: \"config\",\n description: `Read or update Connect's runtime configuration (powerhouse.config.json).\n\nModes (mutually exclusive — positional, --get, --json, and field flags cannot be combined):\n ph connect config List the effective connect.* block (defaults < source).\n ph connect config <key> Get the value at the dotted path (e.g. ph connect config connect.renown.url).\n ph connect config --get <dotted.path> Same as positional <key> (kept for backward compat).\n ph connect config <key> <value> Set a single field and dual-write to source + dist (positional).\n ph connect config --<field> <value> Set a single field via per-field flag (e.g. --renown-url https://renown.id).\n ph connect config --json '{\"renown\":{\"url\":\"…\"}}'\n Bulk-set multiple fields and dual-write. The payload is the connect.*\n block without the \"connect\" wrapper; unknown keys are rejected.\n\nWrites go to:\n - <project>/powerhouse.config.json (source — picked up by the next build)\n - <dist-dir>/powerhouse.config.json (if it exists — the currently-served SPA picks it up on refresh)\n`,\n args: connectConfigArgs,\n handler: async (args) => {\n const { runConnectConfig } = await import(\"../services/connect-config.js\");\n await runConnectConfig(args);\n },\n});\n\nexport const connect = subcommands({\n name: \"connect\",\n description: `Powerhouse Connect commands. Use with \\`studio\\`, \\`build\\`, \\`preview\\`, or \\`config\\`. Defaults to \\`studio\\` if not specified.`,\n cmds: {\n studio,\n build,\n preview,\n config,\n },\n});\n","import { command, flag } from \"cmd-ts\";\n\nexport const generateAllCmd = command({\n name: \"all\",\n description: \"Re-generate all modules in the current project\",\n args: {\n extract: flag({\n long: \"extract\",\n short: \"x\",\n description:\n \"Instead of generating code, write a spec for every module into specs/ (one-shot migration to documents-as-source-of-truth)\",\n }),\n },\n handler: async (args) => {\n const { startGenerateAll } = await import(\"../services/generate-all.js\");\n await startGenerateAll(args, process.cwd());\n process.exit(0);\n },\n});\n","import { extendType, string, type Type } from \"cmd-ts\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\n// cmd-ts's `batteries/fs`, rebuilt on the root entry so bun never loads its CJS build.\n\nconst ExistingPath: Type<string, string> = extendType(string, {\n displayName: \"path\",\n description: \"An existing path\",\n from(str) {\n const resolved = path.resolve(str);\n if (!fs.existsSync(resolved)) {\n return Promise.reject(new Error(\"Path doesn't exist\"));\n }\n return Promise.resolve(resolved);\n },\n});\n\n/** A directory, or the directory of a given file. */\nexport const Directory: Type<string, string> = extendType(ExistingPath, {\n displayName: \"dir\",\n description: \"A path to a directory or a file within a directory\",\n from(resolved) {\n return Promise.resolve(\n fs.statSync(resolved).isDirectory() ? resolved : path.dirname(resolved),\n );\n },\n});\n\n/** An existing file. */\nexport const File: Type<string, string> = extendType(ExistingPath, {\n displayName: \"file\",\n description: \"A file in the file system\",\n from(resolved) {\n if (!fs.statSync(resolved).isFile()) {\n return Promise.reject(new Error(\"Provided path is not a file\"));\n }\n return Promise.resolve(resolved);\n },\n});\n","import type { Type } from \"cmd-ts\";\n\n/** Splits comma-separated values so `-t \"a,b\"` means the same as `-t a -t b`\n * instead of yielding the single value `\"a,b\"`, which matches nothing. */\nexport function splitCommaSeparated(values: string[]): string[] {\n return values\n .flatMap((value) => value.split(\",\"))\n .map((value) => value.trim())\n .filter((value) => value.length > 0);\n}\n\n/** `multioption` type accepting repeated and/or comma-separated values. */\nexport const CommaSeparatedStrings: Type<string[], string[]> = {\n from: (values) => Promise.resolve(splitCommaSeparated(values)),\n};\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport {\n boolean,\n command,\n flag,\n multioption,\n option,\n optional,\n string,\n} from \"cmd-ts\";\nimport { Directory, File } from \"../utils/fs-args.js\";\nimport { CommaSeparatedStrings } from \"../utils/comma-separated.js\";\n\nexport const generateAppCmd = command({\n name: \"app\",\n description: \"Generate a drive app\",\n args: {\n name: option({\n type: optional(string),\n long: \"name\",\n short: \"n\",\n description: \"The name of the drive app to generate\",\n }),\n allowedDocumentTypes: multioption({\n type: optional(CommaSeparatedStrings),\n long: \"document-types\",\n short: \"t\",\n description:\n \"The document types allowed by the new app (repeatable or comma-separated)\",\n }),\n document: option({\n type: optional(File),\n long: \"document\",\n short: \"d\",\n description:\n \"Path to a powerhouse/app spec file (.phd or .json) to drive codegen\",\n }),\n dir: option({\n type: optional(Directory),\n long: \"dir\",\n description: \"Name of the directory of an existing app to re-generate\",\n }),\n disableDragAndDrop: flag({\n type: boolean,\n long: \"disable-drag-and-drop\",\n description: \"Do not allow drag and drop in this drive app.\",\n defaultValue: () => false as const,\n defaultValueIsSerializable: true,\n }),\n all: flag({\n long: \"all\",\n short: \"a\",\n description: \"Re-generate all existing apps in the current project\",\n }),\n extract: flag({\n long: \"extract\",\n short: \"x\",\n description:\n \"Write a powerhouse/app spec for each existing drive app into specs/apps/\",\n }),\n ...debugArgs,\n },\n handler: async (args) => {\n const { startGenerateApp } = await import(\"../services/generate-app.js\");\n await startGenerateApp(args, process.cwd());\n process.exit(0);\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command, flag, option, optional } from \"cmd-ts\";\nimport { Directory, File } from \"../utils/fs-args.js\";\nexport const generateDocumentModelCmd = command({\n name: \"document-model\",\n aliases: [\"doc\"],\n description: \"Generate a document model\",\n args: {\n document: option({\n type: optional(File),\n long: \"document\",\n short: \"d\",\n description:\n \"Path to a document model spec (.phd or .json) to generate from\",\n }),\n dir: option({\n type: optional(Directory),\n long: \"dir\",\n description:\n \"Name of the directory of an existing document model to re-generate\",\n }),\n all: flag({\n long: \"all\",\n short: \"a\",\n description:\n \"Re-generate all existing document models in the current project\",\n }),\n extract: flag({\n long: \"extract\",\n short: \"x\",\n description:\n \"Write a powerhouse/document-model spec for each existing document model into specs/document-models/\",\n }),\n ...debugArgs,\n },\n handler: async (args) => {\n const { startGenerateDocumentModel } =\n await import(\"../services/generate-document-model.js\");\n await startGenerateDocumentModel(args, process.cwd());\n process.exit(0);\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command, flag, option, optional, string } from \"cmd-ts\";\nimport { Directory, File } from \"../utils/fs-args.js\";\n\nexport const generateEditorCmd = command({\n name: \"editor\",\n description: \"Generate a document editor\",\n args: {\n name: option({\n type: optional(string),\n long: \"name\",\n short: \"n\",\n description: \"The name of the document editor to generate\",\n }),\n documentType: option({\n type: optional(string),\n long: \"document-type\",\n short: \"t\",\n description: \"The document type for the new editor\",\n }),\n document: option({\n type: optional(File),\n long: \"document\",\n short: \"d\",\n description:\n \"Path to a powerhouse/document-editor spec file (.phd or .json) to drive codegen\",\n }),\n dir: option({\n type: optional(Directory),\n long: \"dir\",\n description: \"Name of the directory of an existing editor to re-generate\",\n }),\n all: flag({\n long: \"all\",\n short: \"a\",\n description: \"Re-generate all existing editors in the current project\",\n }),\n extract: flag({\n long: \"extract\",\n short: \"x\",\n description:\n \"Write a powerhouse/document-editor spec for each existing editor into specs/editors/\",\n }),\n ...debugArgs,\n },\n handler: async (args) => {\n const { startGenerateEditor } =\n await import(\"../services/generate-editor.js\");\n await startGenerateEditor(args, process.cwd());\n process.exit(0);\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command, option, optional, string } from \"cmd-ts\";\nimport path from \"path\";\n\nexport const generateMigrationFileCmd = command({\n name: \"migration-file\",\n description: \"Generate a migration file\",\n args: {\n migrationFile: option({\n type: string,\n long: \"path\",\n short: \"p\",\n description: \"Path to the migration file\",\n }),\n schemaFile: option({\n type: optional(string),\n long: \"schema-file\",\n description: \"Path to the output file. Defaults to './schema.ts'\",\n }),\n ...debugArgs,\n },\n handler: async ({ migrationFile, schemaFile }) => {\n const { generateDBSchema } = await import(\"@powerhousedao/codegen\");\n await generateDBSchema({\n migrationFile: path.join(process.cwd(), migrationFile),\n schemaFile: schemaFile ? path.join(process.cwd(), schemaFile) : undefined,\n });\n process.exit(0);\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command, option, optional, positional, string } from \"cmd-ts\";\nimport { skipInstallArgs } from \"../utils/install-added-dependencies.js\";\n\nexport const generatePieceActionCmd = command({\n name: \"piece-action\",\n description: \"Generate an action inside an existing piece\",\n args: {\n namePositional: positional({\n type: optional(string),\n displayName: \"name\",\n description: \"The name of the action, e.g. get-record\",\n }),\n name: option({\n type: optional(string),\n long: \"name\",\n short: \"n\",\n description: \"The name of the action to generate\",\n }),\n piece: option({\n type: optional(string),\n long: \"piece\",\n short: \"p\",\n description:\n \"The piece directory under pieces/ to add the action to. Optional when the project ships exactly one piece.\",\n }),\n ...skipInstallArgs,\n ...debugArgs,\n },\n handler: async (args) => {\n const { startGeneratePieceAction } =\n await import(\"../services/generate-piece-action.js\");\n await startGeneratePieceAction(args, process.cwd());\n process.exit(0);\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command, oneOf, option, optional, positional, string } from \"cmd-ts\";\nimport { skipInstallArgs } from \"../utils/install-added-dependencies.js\";\n\nexport const generatePieceTriggerCmd = command({\n name: \"piece-trigger\",\n description: \"Generate a trigger inside an existing piece\",\n args: {\n namePositional: positional({\n type: optional(string),\n displayName: \"name\",\n description: \"The name of the trigger, e.g. new-record\",\n }),\n name: option({\n type: optional(string),\n long: \"name\",\n short: \"n\",\n description: \"The name of the trigger to generate\",\n }),\n piece: option({\n type: optional(string),\n long: \"piece\",\n short: \"p\",\n description:\n \"The piece directory under pieces/ to add the trigger to. Optional when the project ships exactly one piece.\",\n }),\n strategy: option({\n type: oneOf([\"polling\", \"webhook\"] as const),\n long: \"strategy\",\n description:\n \"How the trigger fires: polled on a schedule, or delivered to a webhook\",\n defaultValue: () => \"polling\" as const,\n defaultValueIsSerializable: true,\n }),\n ...skipInstallArgs,\n ...debugArgs,\n },\n handler: async (args) => {\n const { startGeneratePieceTrigger } =\n await import(\"../services/generate-piece-trigger.js\");\n await startGeneratePieceTrigger(args, process.cwd());\n process.exit(0);\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport {\n command,\n flag,\n oneOf,\n option,\n optional,\n positional,\n string,\n} from \"cmd-ts\";\nimport { Directory } from \"../utils/fs-args.js\";\nimport { skipInstallArgs } from \"../utils/install-added-dependencies.js\";\n\nexport const generatePieceCmd = command({\n name: \"piece\",\n description:\n \"Generate a piece: a connector whose actions and triggers a workflow can call\",\n args: {\n namePositional: positional({\n type: optional(string),\n displayName: \"name\",\n description:\n \"The name of the piece to generate. Its directory is the kebab-case of this.\",\n }),\n name: option({\n type: optional(string),\n long: \"name\",\n short: \"n\",\n description: \"The name of the piece to generate\",\n }),\n id: option({\n type: optional(string),\n long: \"id\",\n description:\n \"The piece id, the pieceName a workflow step holds, e.g. @acme/piece-crm. Defaults to one derived from the package name.\",\n }),\n auth: option({\n type: oneOf([\"none\", \"secret\", \"custom\"] as const),\n long: \"auth\",\n description: \"The kind of connection the piece asks for\",\n defaultValue: () => \"custom\" as const,\n defaultValueIsSerializable: true,\n }),\n description: option({\n type: optional(string),\n long: \"description\",\n description: \"One line describing what the piece connects to\",\n }),\n dir: option({\n type: optional(Directory),\n long: \"dir\",\n description: \"Name of the directory of an existing piece to re-register\",\n }),\n all: flag({\n long: \"all\",\n short: \"a\",\n description:\n \"Re-register every piece in pieces/: refresh the pieces list and the manifest, and prune what is gone\",\n }),\n ...skipInstallArgs,\n ...debugArgs,\n },\n handler: async (args) => {\n const { startGeneratePiece } =\n await import(\"../services/generate-piece.js\");\n await startGeneratePiece(args, process.cwd());\n process.exit(0);\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport { PROCESSOR_APPS } from \"@powerhousedao/shared/processors\";\nimport type { Type } from \"cmd-ts\";\nimport {\n command,\n flag,\n multioption,\n oneOf,\n option,\n optional,\n string,\n} from \"cmd-ts\";\nimport { Directory, File } from \"../utils/fs-args.js\";\nimport {\n CommaSeparatedStrings,\n splitCommaSeparated,\n} from \"../utils/comma-separated.js\";\nimport { skipInstallArgs } from \"../utils/install-added-dependencies.js\";\n\nconst ProcessorAppType: Type<string[], (\"connect\" | \"switchboard\")[]> = {\n from(rawProcessorApps) {\n const processorApps = splitCommaSeparated(rawProcessorApps);\n if (processorApps.length === 0) {\n throw new Error(\n `No arguments provided for processor apps. Must be \"connect\" and/or \"switchboard\"`,\n );\n }\n if (processorApps.length > 2) {\n throw new Error(\n `Too many arguments provided for processor apps. Must be \"connect\" and/or \"switchboard\"`,\n );\n }\n const allowed = new Set(PROCESSOR_APPS);\n if (\n !processorApps.every((p) => allowed.has(p as \"connect\" | \"switchboard\"))\n ) {\n throw new Error(\n `Processor apps can only be \"connect\" and/or \"switchboard\".`,\n );\n }\n return Promise.resolve(processorApps as (\"connect\" | \"switchboard\")[]);\n },\n};\nexport const generateProcessorCmd = command({\n name: \"processor\",\n description: \"Generate a processor\",\n args: {\n name: option({\n type: optional(string),\n long: \"name\",\n short: \"n\",\n description: \"The name of the processor to generate\",\n }),\n type: option({\n type: oneOf([\"analytics\", \"relationalDb\"] as const),\n long: \"type\",\n description: \"The type of processor to generate\",\n defaultValue: () => \"analytics\" as const,\n defaultValueIsSerializable: true,\n }),\n documentTypes: multioption({\n type: CommaSeparatedStrings,\n long: \"document-types\",\n short: \"t\",\n description:\n \"The document types the processor will run on (repeatable or comma-separated)\",\n defaultValue: () => [],\n defaultValueIsSerializable: true,\n }),\n apps: multioption({\n long: \"apps\",\n type: ProcessorAppType,\n description:\n \"Whether the processor will run in switchboard (nodejs), connect (browser), or both\",\n defaultValue: () => [\"switchboard\" as const, \"connect\" as const],\n defaultValueIsSerializable: true,\n }),\n document: option({\n type: optional(File),\n long: \"document\",\n short: \"d\",\n description:\n \"Path to a powerhouse/processor spec file (.phd or .json) to drive codegen\",\n }),\n dir: option({\n type: optional(Directory),\n long: \"dir\",\n description:\n \"Name of the directory of an existing processor to re-generate\",\n }),\n all: flag({\n long: \"all\",\n short: \"a\",\n description: \"Re-generate all existing processors in the current project\",\n }),\n extract: flag({\n long: \"extract\",\n short: \"x\",\n description:\n \"Write a powerhouse/processor spec for each existing processor into specs/processors/\",\n }),\n ...skipInstallArgs,\n ...debugArgs,\n },\n handler: async (args) => {\n const { startGenerateProcessor } =\n await import(\"../services/generate-processor.js\");\n await startGenerateProcessor(args, process.cwd());\n process.exit(0);\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command, flag, option, optional, string } from \"cmd-ts\";\nimport { Directory, File } from \"../utils/fs-args.js\";\nimport { skipInstallArgs } from \"../utils/install-added-dependencies.js\";\n\nexport const generateSubgraphCmd = command({\n name: \"subgraph\",\n description: \"Generate a subgraph\",\n args: {\n name: option({\n type: optional(string),\n long: \"name\",\n short: \"n\",\n description: \"The name of the subgraph to generate\",\n }),\n document: option({\n type: optional(File),\n long: \"document\",\n short: \"d\",\n description:\n \"Path to a powerhouse/subgraph spec file (.phd or .json) to drive codegen\",\n }),\n dir: option({\n type: optional(Directory),\n long: \"dir\",\n description:\n \"Name of the directory of an existing subgraph to re-generate\",\n }),\n all: flag({\n long: \"all\",\n short: \"a\",\n description: \"Re-generate all existing subgraphs in the current project\",\n }),\n extract: flag({\n long: \"extract\",\n short: \"x\",\n description:\n \"Write a powerhouse/subgraph spec for each existing subgraph into specs/subgraphs/\",\n }),\n ...skipInstallArgs,\n ...debugArgs,\n },\n handler: async (args) => {\n const { startGenerateSubgraph } =\n await import(\"../services/generate-subgraph.js\");\n await startGenerateSubgraph(args, process.cwd());\n process.exit(0);\n },\n});\n","import { subcommands } from \"cmd-ts\";\nimport { generateAllCmd } from \"./generate-all.js\";\nimport { generateAppCmd } from \"./generate-app.js\";\nimport { generateDocumentModelCmd } from \"./generate-document-model.js\";\nimport { generateEditorCmd } from \"./generate-editor.js\";\nimport { generateMigrationFileCmd } from \"./generate-migration-file.js\";\nimport { generatePieceActionCmd } from \"./generate-piece-action.js\";\nimport { generatePieceTriggerCmd } from \"./generate-piece-trigger.js\";\nimport { generatePieceCmd } from \"./generate-piece.js\";\nimport { generateProcessorCmd } from \"./generate-processor.js\";\nimport { generateSubgraphCmd } from \"./generate-subgraph.js\";\n\nexport const generate = subcommands({\n name: \"generate\",\n description: `The generate command creates code for Powerhouse modules. It helps you create new code from scratch, or to re-generate existing code in your project.`,\n cmds: {\n all: generateAllCmd,\n \"document-model\": generateDocumentModelCmd,\n editor: generateEditorCmd,\n app: generateAppCmd,\n processor: generateProcessorCmd,\n subgraph: generateSubgraphCmd,\n piece: generatePieceCmd,\n \"piece-action\": generatePieceActionCmd,\n \"piece-trigger\": generatePieceTriggerCmd,\n \"migration-file\": generateMigrationFileCmd,\n },\n});\n","import { initArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const init = command({\n name: \"init\",\n description: \"Initialize a new project\",\n args: initArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log({ args });\n }\n const { startInit } = await import(\"../services/init.js\");\n await startInit(args);\n process.exit(0);\n },\n});\n","import { inspectArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const inspect = command({\n name: \"inspect\",\n description: `\nThe inspect command examines and provides detailed information about a Powerhouse package.\nIt helps you understand the structure, dependencies, and configuration of packages in\nyour project.\n\nThis command:\n1. Analyzes the specified package\n2. Retrieves detailed information about its structure and configuration\n3. Displays package metadata, dependencies, and other relevant information\n4. Helps troubleshoot package-related issues`,\n aliases: [\"is\"],\n args: inspectArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n const { startInspect } = await import(\"../services/inspect.js\");\n startInspect(args);\n process.exit(0);\n },\n});\n","import { installArgs } from \"@powerhousedao/shared/clis/args\";\nimport { execSync } from \"child_process\";\nimport { command } from \"cmd-ts\";\n\nexport const install = command({\n name: \"install\",\n aliases: [\"add\", \"i\"],\n description: `\nThe install command adds Powerhouse dependencies to your project.\n\nBy default it only registers the package in powerhouse.config.json with\nprovider \"registry\" — Connect will load it from the registry CDN at runtime.\n\nWith --local, the package is also installed into node_modules and marked\nas provider \"local\" — it will be bundled into ph connect build so the\npreview works without the registry being reachable.\n\nResolution order for the registry URL:\n --registry flag > PH_REGISTRY_URL env > powerhouse.config.json > default\n `,\n args: installArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n const { getPowerhouseProjectInfo, makeDependenciesWithVersions } =\n await import(\"@powerhousedao/shared/clis\");\n\n const {\n projectPath,\n localProjectPath,\n globalProjectPath,\n packageManager,\n isGlobal,\n } = await getPowerhouseProjectInfo(args);\n\n if (!projectPath) {\n throw new Error(`Could not find project path to install from.`);\n }\n\n const { resolveRegistryUrl } =\n await import(\"@powerhousedao/shared/registry\");\n const registryUrl = resolveRegistryUrl({\n registry: args.registry,\n projectPath,\n });\n\n if (args.debug) {\n console.log(\">>> registryUrl\", registryUrl);\n }\n\n const dependenciesWithVersions = await makeDependenciesWithVersions(\n args.dependencies,\n registryUrl,\n );\n\n if (args.debug) {\n console.log(\">>> parsedDependencies\", dependenciesWithVersions);\n console.log(\"\\n>>> projectInfo\", {\n localProjectPath,\n globalProjectPath,\n packageManager,\n isGlobal,\n });\n }\n\n if (args.local) {\n if (dependenciesWithVersions.length === 0) {\n throw new Error(\n \"--local requires at least one package name (e.g. ph install --local @scope/pkg)\",\n );\n }\n try {\n const specs = dependenciesWithVersions.map((d) =>\n d.version ? `${d.name}@${d.version}` : d.name,\n );\n\n // Route only the scopes of the packages being installed to the\n // resolved registry, leaving transitive deps from other scopes\n // (and unscoped packages) on the package manager's default. This\n // avoids requiring a project-level .npmrc when the user already\n // has packageRegistryUrl in powerhouse.config.json.\n const scopes = new Set<string>();\n for (const dep of dependenciesWithVersions) {\n if (dep.name.startsWith(\"@\")) {\n const scope = dep.name.split(\"/\")[0];\n scopes.add(scope);\n }\n }\n const scopeRegistryArgs = Array.from(scopes).map(\n (scope) => `--${scope}:registry=${registryUrl}`,\n );\n\n const minReleaseAgeArgs =\n packageManager === \"pnpm\" ? [\"--config.minimum-release-age=0\"] : [];\n\n const allowBuildArgs =\n packageManager === \"pnpm\" && args.allowBuild.length > 0\n ? [`--allow-build=${args.allowBuild.join(\",\")}`]\n : [];\n\n const { resolveCommand } = await import(\"package-manager-detector\");\n const resolved = resolveCommand(packageManager, \"add\", [\n ...specs,\n ...scopeRegistryArgs,\n ...minReleaseAgeArgs,\n ...allowBuildArgs,\n ]);\n if (!resolved) {\n throw new Error(\n `Failed to resolve install command for package manager \"${packageManager}\".`,\n );\n }\n const installCommand = `${resolved.command} ${resolved.args.join(\" \")}`;\n if (scopeRegistryArgs.length > 0) {\n console.log(\n `Installing dependencies 📦 (routing ${Array.from(scopes).join(\", \")} → ${registryUrl})...`,\n );\n } else {\n console.log(\"Installing dependencies 📦...\");\n }\n console.log(`> ${installCommand}`);\n execSync(installCommand, {\n stdio: \"inherit\",\n cwd: projectPath,\n });\n console.log(\"Dependency installed successfully 🎉\");\n } catch (error) {\n console.error(\"❌ Failed to install dependencies\");\n throw error;\n }\n }\n\n const { updateConfigFile, updateStylesFile } = await import(\"../utils.js\");\n\n try {\n console.log(\"⚙️ Updating powerhouse config file...\");\n updateConfigFile(\n dependenciesWithVersions,\n projectPath,\n \"install\",\n args.local ? \"local\" : \"registry\",\n registryUrl,\n args.registry !== undefined,\n );\n console.log(\"Config file updated successfully 🎉\");\n } catch (error) {\n console.error(\"❌ Failed to update config file\");\n throw error;\n }\n\n if (args.local) {\n try {\n console.log(\"⚙️ Updating styles.css file...\");\n updateStylesFile(dependenciesWithVersions, projectPath);\n console.log(\"Styles file updated successfully 🎉\");\n } catch (error) {\n console.error(\"❌ Failed to update styles file\");\n throw error;\n }\n }\n\n process.exit(0);\n },\n});\n","import { listArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const list = command({\n name: \"list\",\n description: `\nThe list command displays information about installed Powerhouse packages in your project.\nIt reads the powerhouse.config.json file and shows the packages that are currently installed.\n\nThis command:\n1. Examines your project configuration\n2. Lists all installed Powerhouse packages\n3. Provides a clear overview of your project's dependencies\n4. Helps you manage and track your Powerhouse components\n`,\n aliases: [\"l\"],\n args: listArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n try {\n const { getPowerhouseProjectInfo } =\n await import(\"@powerhousedao/shared/clis\");\n const projectInfo = await getPowerhouseProjectInfo();\n\n const { getConfig } = await import(\"@powerhousedao/config/node\");\n const phConfig = getConfig(\n projectInfo.projectPath + \"/powerhouse.config.json\",\n );\n\n if (!phConfig.packages || phConfig.packages.length === 0) {\n console.log(\"No packages found in the project\");\n return;\n }\n\n console.log(\"Installed Packages:\\n\");\n phConfig.packages.forEach((pkg) => {\n console.log(\n pkg.version ? `${pkg.packageName}@${pkg.version}` : pkg.packageName,\n );\n });\n } catch (_e) {\n console.log(\"No packages found in the project\");\n }\n process.exit(0);\n },\n});\n","import { loginArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const login = command({\n name: \"login\",\n description: `\nThe login command authenticates you with Renown using your Ethereum wallet. This enables\nthe CLI to act on behalf of your Ethereum identity for authenticated operations.\n\nThis command:\n1. Generates or loads a cryptographic identity (DID) for the CLI\n2. Opens your browser to the Renown authentication page\n3. You authorize the CLI's DID to act on behalf of your Ethereum address\n4. Stores the credentials locally in .ph/.renown.json\n `,\n args: loginArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n const { getRenown } = await import(\"../services/auth.js\");\n const renown = await getRenown(args.renownUrl);\n\n if (args.showDid) {\n console.log(renown.did);\n process.exit(0);\n }\n\n if (args.status) {\n const { getAuthStatus } = await import(\"@renown/sdk/node\");\n const status = getAuthStatus(renown);\n if (!status.authenticated || !status.address) {\n console.log(\"Not authenticated with an Ethereum address.\");\n console.log('Run \"ph login\" to authenticate.');\n } else {\n console.log(\"Authenticated\");\n console.log(` ETH Address: ${status.address}`);\n console.log(` User DID: ${status.userDid}`);\n console.log(` Chain ID: ${status.chainId}`);\n console.log(` CLI DID: ${status.cliDid}`);\n console.log(\n ` Authenticated at: ${status.authenticatedAt?.toLocaleString()}`,\n );\n console.log(` Renown URL: ${status.baseUrl}`);\n }\n process.exit(0);\n }\n\n if (args.logout) {\n await handleLogout();\n process.exit(0);\n }\n\n const { browserLogin } = await import(\"@renown/sdk/node\");\n\n console.debug(\"Initializing cryptographic identity...\");\n console.log(`CLI DID: ${renown.did}`);\n\n try {\n const timeoutMs = args.timeout ? args.timeout * 1000 : undefined;\n\n const result = await browserLogin(renown, {\n renownUrl: args.renownUrl,\n timeoutMs,\n onLoginUrl: (url, sessionId) => {\n console.log(\"Opening browser for authentication...\");\n console.log(`Session ID: ${sessionId.slice(0, 8)}...`);\n console.log(`Login URL: ${url}`);\n console.log();\n console.log(\"Waiting for authentication in browser\");\n console.log(`(timeout in ${(timeoutMs ?? 300_000) / 1000} seconds)`);\n console.log();\n console.log(\n \"Please connect your wallet and authorize this CLI to act on your behalf.\",\n );\n console.log();\n process.stdout.write(\"Waiting\");\n },\n onPollTick: () => process.stdout.write(\".\"),\n onBrowserOpenFailed: (url) => {\n console.error(\"Failed to open browser automatically.\");\n console.log(`Please open this URL manually: ${url}`);\n },\n });\n\n console.log(); // New line after dots\n console.log();\n console.log(\"Successfully authenticated!\");\n console.log(` ETH Address: ${result.user.address}`);\n console.log(` User DID: ${result.user.did}`);\n console.log(` CLI DID: ${result.cliDid}`);\n console.log();\n console.log(\"The CLI can now act on behalf of your Ethereum identity.\");\n } catch (error) {\n console.log(); // New line after dots\n throw error;\n }\n\n process.exit(0);\n },\n});\n\nexport async function handleLogout() {\n const { getRenown } = await import(\"../services/auth.js\");\n const renown = await getRenown();\n if (!renown.user) {\n console.log(\"Not currently authenticated.\");\n return;\n }\n\n try {\n await renown.logout();\n console.log(\"Successfully logged out.\");\n } catch (error) {\n console.error(\"Failed to clear credentials.\");\n console.debug(error);\n }\n}\n","import { command } from \"cmd-ts\";\nimport { handleLogout } from \"./login.js\";\n\nexport const logout = command({\n name: \"logout\",\n description: `\nThe logout command removes an existing session created with 'ph login'`,\n args: {},\n handler: async () => {\n await handleLogout();\n process.exit(0);\n },\n});\n","import { migrateArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const migrate = command({\n name: \"migrate\",\n args: migrateArgs,\n description: \"Run migrations\",\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n const { startMigrate } = await import(\"../services/migrate.js\");\n await startMigrate(args);\n process.exit(0);\n },\n});\n","import { publishArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nfunction hasTagFlag(args: string[]): boolean {\n return args.some((a) => a === \"--tag\" || a.startsWith(\"--tag=\"));\n}\n\nfunction isInteractive(): boolean {\n return Boolean(process.stdin.isTTY) && !process.env.CI;\n}\n\nasync function readPrereleaseTag(projectPath: string): Promise<{\n version: string;\n tag: string;\n} | null> {\n try {\n const [{ readPackageSync }, { prerelease }] = await Promise.all([\n import(\"read-pkg\"),\n import(\"semver\"),\n ]);\n const pkg = readPackageSync({ cwd: projectPath });\n if (!pkg.version) return null;\n const parts = prerelease(pkg.version);\n if (!parts || parts.length === 0) return null;\n const label = String(parts[0]);\n // semver may surface numeric-only prerelease ids (e.g. `1.0.0-0`);\n // npm requires an alphanumeric dist-tag, so skip those.\n if (!/^[a-z][a-z0-9-]*$/i.test(label)) return null;\n return { version: pkg.version, tag: label };\n } catch {\n return null;\n }\n}\n\nexport const publish = command({\n name: \"publish\",\n description: `\nPublish a package to the Powerhouse registry. This is a thin wrapper around npm publish\nthat automatically sets the registry URL.\n\nThis command:\n1. Resolves the registry URL (--registry flag > PH_REGISTRY_URL env > powerhouse.config.json > default)\n2. Checks authentication with the registry via npm whoami\n3. Forwards all additional arguments to npm publish\n `,\n args: publishArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n const { getPowerhouseProjectInfo } =\n await import(\"@powerhousedao/shared/clis\");\n const { projectPath } = await getPowerhouseProjectInfo();\n\n if (!projectPath) {\n throw new Error(\"Could not find project path.\");\n }\n\n const { checkNpmAuth, npmPublish, resolveRegistryUrl } =\n await import(\"@powerhousedao/shared/registry\");\n const { mintRegistryAuthToken } =\n await import(\"../services/registry-auth.js\");\n\n const registryUrl = resolveRegistryUrl({\n registry: args.registry,\n projectPath,\n });\n\n if (args.debug) {\n console.log(\">>> registryUrl\", registryUrl);\n }\n\n // Try Renown auth first: if the user is logged in via `ph login`, mint a\n // short-lived registry-bound bearer token. Falling back to the legacy\n // `npm adduser` (htpasswd) path keeps existing flows working until the\n // grace period ends.\n let authToken: string | undefined;\n try {\n authToken = await mintRegistryAuthToken(registryUrl, 5 * 60);\n if (args.debug) {\n console.error(`>>> minted renown token for ${registryUrl} (5m TTL)`);\n }\n } catch (err) {\n if (args.debug) {\n console.error(\n `>>> renown token mint skipped: ${(err as Error).message}`,\n );\n }\n try {\n await checkNpmAuth(registryUrl);\n } catch {\n console.error(`Not authenticated with registry: ${registryUrl}`);\n console.error(\n `Run: ph login (recommended) or npm adduser --registry ${registryUrl}`,\n );\n process.exit(1);\n }\n }\n\n let forwardedArgs = args.forwardedArgs;\n\n if (!hasTagFlag(forwardedArgs)) {\n const prereleaseInfo = await readPrereleaseTag(projectPath);\n if (prereleaseInfo) {\n const { version, tag } = prereleaseInfo;\n if (!isInteractive()) {\n console.error(\n `Detected prerelease version ${version}. npm requires an explicit dist-tag for prerelease publishes.`,\n );\n console.error(\n `Re-run with --tag <label> (e.g. --tag ${tag}) to proceed.`,\n );\n process.exit(1);\n }\n\n const enquirer = await import(\"enquirer\");\n\n let confirmed: boolean;\n try {\n const answer = await enquirer.default.prompt<{ confirmed: boolean }>({\n type: \"confirm\",\n name: \"confirmed\",\n message: `Detected prerelease version ${version}. Publish with --tag ${tag}?`,\n initial: true,\n });\n confirmed = answer.confirmed;\n } catch {\n // user aborted the prompt (Ctrl-C); treat as decline\n confirmed = false;\n }\n\n if (!confirmed) {\n console.error(\n `Aborted. To publish manually: npm publish --registry ${registryUrl} --tag <label>`,\n );\n process.exit(1);\n }\n\n forwardedArgs = [\"--tag\", tag, ...forwardedArgs];\n }\n }\n\n if (args.debug) {\n console.log(\n \">>> command\",\n `npm publish --registry ${registryUrl} ${forwardedArgs.join(\" \")}`,\n );\n }\n\n console.log(`Publishing to ${registryUrl}...`);\n const result = await npmPublish({\n registryUrl,\n cwd: projectPath,\n args: forwardedArgs,\n authToken,\n });\n if (result.stdout) {\n console.log(result.stdout);\n }\n\n process.exit(0);\n },\n});\n","import { registryLoginArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const registryLogin = command({\n name: \"registry-login\",\n description: `\nLog in to a Powerhouse registry using your Renown identity. Mints a longer-lived\nbearer token (default 30 days) bound to the registry's audience and writes the\ntoken into ~/.npmrc so raw 'npm publish' / 'npm install' work without further\nsetup.\n\nPrerequisites:\n Run 'ph login' first to establish a Renown identity.\n\nUsage:\n ph registry-login # uses powerhouse.config.json / PH_REGISTRY_URL\n ph registry-login --registry https://registry.vetra.io\n ph registry-login --expiry 7d\n `,\n args: registryLoginArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n const { getPowerhouseProjectInfo } =\n await import(\"@powerhousedao/shared/clis\");\n const projectInfo = await getPowerhouseProjectInfo().catch(() => null);\n const projectPath = projectInfo?.projectPath ?? process.cwd();\n\n const [\n { resolveRegistryUrl, writeRegistryAuthToken },\n { mintRegistryAuthToken },\n { parseExpiry, formatExpiry },\n ] = await Promise.all([\n import(\"@powerhousedao/shared/registry\"),\n import(\"../services/registry-auth.js\"),\n import(\"@renown/sdk/node\"),\n ]);\n\n const registryUrl = resolveRegistryUrl({\n registry: args.registry,\n projectPath,\n });\n\n const expiresIn = parseExpiry(args.expiry);\n\n const token = await mintRegistryAuthToken(registryUrl, expiresIn);\n const npmrcPath = await writeRegistryAuthToken(registryUrl, token);\n\n console.log(`Logged in to ${registryUrl}`);\n console.log(` Token expires in: ${formatExpiry(expiresIn)}`);\n console.log(` Wrote: ${npmrcPath}`);\n process.exit(0);\n },\n});\n","import { switchboardArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const switchboard = command({\n name: \"switchboard\",\n aliases: [\"reactor\"],\n description: `\nThe switchboard command starts a local Switchboard instance, which acts as the document\nprocessing engine for Powerhouse projects. It provides the infrastructure for document\nmodels, processors, and real-time updates.\n\nThis command:\n1. Starts a local switchboard server\n2. Loads document models and processors\n3. Provides an API for document operations\n4. Enables real-time document processing\n5. Can authenticate with remote services using your identity from 'ph login'`,\n args: switchboardArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n const { basePath, dbPath, migrate, migrateStatus, reset, yes } = args;\n if (basePath) {\n process.env.BASE_PATH = basePath;\n }\n\n if (reset) {\n const { resetSwitchboardDatabase } =\n await import(\"../services/switchboard-reset.js\");\n await resetSwitchboardDatabase({ dbPath, yes });\n process.exit(0);\n }\n\n if (migrate || migrateStatus) {\n const { runSwitchboardMigrations } =\n await import(\"../services/switchboard-migrate.js\");\n await runSwitchboardMigrations({\n dbPath,\n statusOnly: migrateStatus,\n });\n process.exit(0);\n }\n\n const { startSwitchboard } = await import(\"../services/switchboard.js\");\n const { defaultDriveUrl, renown } = await startSwitchboard(args);\n console.log(\" ➜ Switchboard:\", defaultDriveUrl);\n if (renown) {\n console.log(\" ➜ Identity:\", renown.did);\n }\n },\n});\n","import { AGENTS, uninstallArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\nimport { execSync } from \"node:child_process\";\n\nexport const uninstall = command({\n name: \"uninstall\",\n aliases: [\"remove\"],\n description: `\nThe uninstall command removes Powerhouse dependencies from your project. It handles the\nremoval of packages, updates configuration files, and ensures proper cleanup.\n\nThis command:\n1. Uninstalls specified Powerhouse dependencies using your package manager\n2. Updates powerhouse.config.json to remove the dependencies\n3. Supports various uninstallation options and configurations\n4. Works with ${AGENTS.join(\", \")} package managers\n`,\n args: uninstallArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n const {\n getPowerhouseProjectInfo,\n getPowerhouseProjectUninstallCommand,\n makeDependenciesWithVersions,\n } = await import(\"@powerhousedao/shared/clis\");\n\n const {\n projectPath,\n localProjectPath,\n globalProjectPath,\n packageManager,\n isGlobal,\n } = await getPowerhouseProjectInfo(args);\n\n if (!projectPath) {\n throw new Error(`Could not find project path to uninstall from`);\n }\n\n const dependenciesWithVersions = await makeDependenciesWithVersions(\n args.dependencies,\n );\n\n if (args.debug) {\n console.log(\">>> parsedDependencies\", dependenciesWithVersions);\n }\n\n if (args.debug) {\n console.log(\"\\n>>> projectInfo\", {\n localProjectPath,\n globalProjectPath,\n packageManager,\n isGlobal,\n });\n }\n\n try {\n console.log(\"Uninstalling dependencies 📦 ...\");\n const uninstallCommand = await getPowerhouseProjectUninstallCommand(\n packageManager,\n args.dependencies,\n );\n execSync(uninstallCommand, {\n stdio: \"inherit\",\n cwd: projectPath,\n });\n console.log(\"Dependency uninstalled successfully 🎉\");\n } catch (error) {\n console.error(\"❌ Failed to uninstall dependencies\");\n throw error;\n }\n\n const { removeStylesImports, updateConfigFile } =\n await import(\"../utils.js\");\n\n try {\n console.log(\"⚙️ Updating powerhouse config file...\");\n updateConfigFile(dependenciesWithVersions, projectPath, \"uninstall\");\n console.log(\"Config file updated successfully 🎉\");\n } catch (error) {\n console.error(\"❌ Failed to update config file\");\n throw error;\n }\n\n try {\n console.log(\"⚙️ Updating styles.css file...\");\n removeStylesImports(dependenciesWithVersions, projectPath);\n console.log(\"Styles file updated successfully 🎉\");\n } catch (error) {\n console.error(\"❌ Failed to update styles file\");\n throw error;\n }\n\n process.exit(0);\n },\n});\n","import { unpublishArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\nimport { createInterface } from \"node:readline/promises\";\n\nexport const unpublish = command({\n name: \"unpublish\",\n description: `\nUnpublish a package from the Powerhouse registry. This is a thin wrapper around\nnpm unpublish that automatically targets the Powerhouse registry and never\nreaches npmjs.org.\n\nForms:\n ph unpublish # unpublish <name>@<version> from cwd's package.json\n ph unpublish <name> # unpublish the whole package (all versions)\n ph unpublish <name>@<version> # unpublish a single version\n\nFlags:\n --registry <url> # override registry URL\n --yes, -y # skip the confirmation prompt\n `,\n args: unpublishArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n const { getPowerhouseProjectInfo } =\n await import(\"@powerhousedao/shared/clis\");\n const { projectPath } = await getPowerhouseProjectInfo();\n\n if (!projectPath) {\n throw new Error(\"Could not find project path.\");\n }\n\n const { checkNpmAuth, npmUnpublish, resolveRegistryUrl } =\n await import(\"@powerhousedao/shared/registry\");\n\n const registryUrl = resolveRegistryUrl({\n registry: args.registry,\n projectPath,\n });\n\n const spec = await resolveSpec(args.spec, projectPath);\n if (!spec) {\n console.error(\n \"No package spec provided and could not read name/version from package.json.\",\n );\n process.exit(1);\n }\n\n if (args.debug) {\n console.log(\">>> registryUrl\", registryUrl);\n console.log(\">>> spec\", spec);\n }\n\n try {\n await checkNpmAuth(registryUrl);\n } catch {\n console.error(`Not authenticated with registry: ${registryUrl}`);\n console.error(`Run: npm adduser --registry ${registryUrl}`);\n process.exit(1);\n }\n\n if (!args.yes) {\n const confirmed = await confirm(\n `Unpublish ${spec} from ${registryUrl}? [y/N] `,\n );\n if (!confirmed) {\n console.log(\"Aborted.\");\n process.exit(0);\n }\n }\n\n if (args.debug) {\n console.log(\n \">>> command\",\n `npm unpublish ${spec} --registry ${registryUrl} --force ${args.forwardedArgs.join(\" \")}`,\n );\n }\n\n console.log(`Unpublishing ${spec} from ${registryUrl}...`);\n try {\n const result = await npmUnpublish({\n registryUrl,\n cwd: projectPath,\n spec,\n args: args.forwardedArgs,\n });\n if (result.stdout) {\n console.log(result.stdout);\n }\n process.exit(0);\n } catch (err) {\n console.error(err instanceof Error ? err.message : String(err));\n process.exit(1);\n }\n },\n});\n\nasync function resolveSpec(\n explicit: string | undefined,\n projectPath: string,\n): Promise<string | null> {\n if (explicit) return explicit;\n try {\n const { readPackageSync } = await import(\"read-pkg\");\n const pkg = readPackageSync({ cwd: projectPath });\n if (!pkg.name) return null;\n return pkg.version ? `${pkg.name}@${pkg.version}` : pkg.name;\n } catch {\n return null;\n }\n}\n\nasync function confirm(prompt: string): Promise<boolean> {\n const rl = createInterface({ input: process.stdin, output: process.stdout });\n try {\n const answer = await rl.question(prompt);\n return /^y(es)?$/i.test(answer.trim());\n } finally {\n rl.close();\n }\n}\n","import { vetraArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const vetra = command({\n name: \"vetra\",\n description: `\nThe vetra command sets up a Vetra development environment for working with Vetra projects.\nIt starts a Vetra Switchboard and optionally Connect Studio, enabling document collaboration \nand real-time processing with a \"Vetra\" drive or connection to remote drives.\n\nThis command:\n1. Starts a Vetra Switchboard with a \"Vetra\" drive for document storage\n2. Optionally connects to remote drives instead of creating a local drive\n3. Starts Connect Studio pointing to the Switchboard for user interaction (unless disabled)\n4. Enables real-time updates, collaboration, and code generation\n\nDefault drives:\nConnect's default drives resolve to the Vetra drive (and the preview drive\nwhen using --watch), plus any drives configured under\nconnect.drives.defaultDrives in powerhouse.config.json - de-duplicated by\nURL, so configuring project drives does not cost you the Vetra drive.\nAn explicit --default-drives-url is appended to that list (de-duplicated);\nit never replaces the Vetra drive.\n`,\n args: vetraArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n const { startVetra } = await import(\"../services/vetra.js\");\n await startVetra(args);\n },\n});\n","import { accessToken } from \"./access-token.js\";\nimport { build } from \"./build.js\";\nimport { connect } from \"./connect.js\";\nimport { generate } from \"./generate.js\";\nimport { init } from \"./init.js\";\nimport { inspect } from \"./inspect.js\";\nimport { install } from \"./install.js\";\nimport { list } from \"./list.js\";\nimport { login } from \"./login.js\";\nimport { logout } from \"./logout.js\";\nimport { migrate } from \"./migrate.js\";\nimport { publish } from \"./publish.js\";\nimport { registryLogin } from \"./registry-login.js\";\nimport { switchboard } from \"./switchboard.js\";\nimport { uninstall } from \"./uninstall.js\";\nimport { unpublish } from \"./unpublish.js\";\nimport { vetra } from \"./vetra.js\";\n\nexport const phCliCommands = {\n init,\n generate,\n vetra,\n connect,\n build,\n publish,\n unpublish,\n \"access-token\": accessToken,\n \"registry-login\": registryLogin,\n inspect,\n list,\n migrate,\n switchboard,\n login,\n logout,\n install,\n uninstall,\n} as const;\n","import { subcommands } from \"cmd-ts\";\nimport { getVersion } from \"../get-version.js\";\nimport { PH_CLI_DESCRIPTION } from \"../utils/constants.js\";\nimport { phCliCommands } from \"./ph-cli-commands.js\";\n\nconst version = getVersion();\nexport const phCli = subcommands({\n name: \"ph-cli\",\n description: PH_CLI_DESCRIPTION,\n version,\n cmds: phCliCommands,\n});\n","import { yellow, bold } from \"colorette\";\n\nconst UNRECOVERABLE_DB_PATTERNS: RegExp[] = [\n /Database migration failed:/i,\n /Migration .* failed/i,\n /relation \"[^\"]+\" already exists/i,\n /column \"[^\"]+\" does not exist/i,\n /schema \"reactor\" does not exist/i,\n /Unsupported PGLite data dir/i,\n /PG_VERSION/i,\n];\n\nfunction collectMessages(err: unknown): string[] {\n const messages: string[] = [];\n let current: unknown = err;\n const seen = new Set<unknown>();\n while (current && !seen.has(current)) {\n seen.add(current);\n if (current instanceof Error) {\n messages.push(current.message);\n current = (current as Error & { cause?: unknown }).cause;\n } else {\n messages.push(\n typeof current === \"string\" ? current : JSON.stringify(current),\n );\n break;\n }\n }\n return messages;\n}\n\nexport function isUnrecoverableDbError(err: unknown): boolean {\n const messages = collectMessages(err);\n return messages.some((msg) =>\n UNRECOVERABLE_DB_PATTERNS.some((re) => re.test(msg)),\n );\n}\n\nexport function printDbRecoveryHint(err: unknown): void {\n const messages = collectMessages(err);\n const offending = messages.find((msg) =>\n UNRECOVERABLE_DB_PATTERNS.some((re) => re.test(msg)),\n );\n console.error(\"\");\n console.error(\n yellow(bold(\"Switchboard hit an unrecoverable database error.\")),\n );\n if (offending) {\n console.error(yellow(` ${offending}`));\n }\n console.error(\"\");\n console.error(\n yellow(\"If this is a local PGlite store, you can reset it with:\"),\n );\n console.error(yellow(\" ph switchboard --reset\"));\n console.error(\n yellow(\n \"This is destructive: it wipes the local .ph/reactor-storage and .ph/read-storage directories.\",\n ),\n );\n console.error(\n yellow(\n \"For Postgres-backed deployments (PH_REACTOR_DATABASE_URL / DATABASE_URL), reset the database manually instead.\",\n ),\n );\n console.error(\"\");\n}\n","#!/usr/bin/env node\nimport {\n initCliTelemetry,\n type TelemetryClient,\n} from \"@powerhousedao/shared/clis/telemetry\";\nimport { assertNodeVersion } from \"@powerhousedao/shared/clis/utils\";\nimport { run } from \"cmd-ts\";\nimport { phCliHelp } from \"./commands/ph-cli-help.js\";\nimport { phCli } from \"./commands/ph-cli.js\";\nimport { getVersion } from \"./get-version.js\";\nimport {\n isUnrecoverableDbError,\n printDbRecoveryHint,\n} from \"./utils/db-error-hint.js\";\n\nlet sentryClient: TelemetryClient | undefined = undefined;\n\n// Commands whose second positional is itself a subcommand (vs. a project\n// name / file path). Keeping this explicit avoids high-cardinality tag\n// values like `subcommand:my-package` polluting Sentry.\nconst COMMANDS_WITH_SUBCOMMANDS = new Set([\"connect\", \"vetra\"]);\n\nfunction detectPackageManager(): string | undefined {\n // npm, pnpm, yarn and bun all set npm_config_user_agent like\n // \"pnpm/8.5.0 npm/? node/v20.11.1 darwin arm64\". When the user invokes\n // `ph` directly (not via dlx/exec) it's typically unset — skip the tag\n // in that case rather than mislabel.\n const ua = process.env.npm_config_user_agent;\n if (!ua) return undefined;\n return ua.split(\" \")[0]?.split(\"/\")[0] || undefined;\n}\n\nasync function main() {\n assertNodeVersion();\n // Initializes Sentry only if user consented (opt-out by default, asked\n // once on first interactive run). Respects PH_NO_TELEMETRY/DO_NOT_TRACK.\n sentryClient = await initCliTelemetry({\n cliName: \"ph-cli\",\n release: getVersion(),\n });\n const args = process.argv.slice(2);\n const command = args[0];\n const subcommand =\n command &&\n COMMANDS_WITH_SUBCOMMANDS.has(command) &&\n args[1] &&\n !args[1].startsWith(\"-\")\n ? args[1]\n : undefined;\n sentryClient?.attachInvocationContext({\n command,\n subcommand,\n pm: detectPackageManager(),\n argv: args,\n cwd: process.cwd(),\n });\n const hasNoArgs = args.length === 0;\n const isHelp = args.some((arg) => arg === \"--help\" || arg === \"-h\");\n const isTopLevelHelp = isHelp && args.length === 1;\n const showTopLevelHelp = hasNoArgs || isTopLevelHelp;\n const cli = showTopLevelHelp ? phCliHelp : phCli;\n const restArgs = args.slice(1);\n if (\n command === \"connect\" &&\n ![\"studio\", \"build\", \"preview\", \"config\"].includes(args[1]) &&\n !isHelp\n ) {\n const argsWithDefaultConnectSubCommand = [\"connect\", \"studio\", ...restArgs];\n await run(cli, argsWithDefaultConnectSubCommand);\n } else {\n await run(cli, args);\n }\n}\n\nawait main().catch(async (error) => {\n const isDebug = process.argv.slice(2).includes(\"--debug\");\n // Report to Sentry (no-op when telemetry disabled) before exiting.\n await sentryClient?.captureCliError(error);\n if (isDebug) {\n throw error;\n }\n if (error instanceof Error) {\n console.error(error.message);\n if (isUnrecoverableDbError(error)) {\n printDbRecoveryHint(error);\n }\n process.exit(1);\n } else {\n throw error;\n }\n});\n"],"names":["version","build","path"],"mappings":";;;;;;;;;;;;;;;;;;AAGA,SAAgB,aAAa;CACa,OAAA;AAM1C;;;ACVA,MAAa,qBACX;;;ACIF,MAAMA,YAAU,WAAW;AAC3B,MAAa,YAAY,YAAY;CACnC,MAAM;CACN,aAAa;CACb,SAAA;CACA,MAAM;AACR,CAAC;;;ACPD,MAAa,cAAc,QAAQ;CACjC,MAAM;CACN,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+Cb,MAAM;CACN,SAAS,OA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G,IACnB,KAAK,KACL,KAAA;CACN,cAAc,wBAAwB;EACpC;EACA;EACA,IAAI,qBAAqB;EACzB,MAAM;EACN,KAAK,QAAQ,IAAI;CACnB,CAAC;CACD,MAAM,YAAY,KAAK,WAAW;CAClC,MAAM,SAAS,KAAK,MAAM,QAAQ,QAAQ,YAAY,QAAQ,IAAI;CAClE,MAAM,iBAAiB,UAAU,KAAK,WAAW;CAEjD,MAAM,MADmB,aAAa,iBACP,YAAY;CAC3C,MAAM,WAAW,KAAK,MAAM,CAAC;CAC7B,IACE,YAAY,aACZ,CAAC;EAAC;EAAU;EAAS;EAAW;CAAQ,CAAC,CAAC,SAAS,KAAK,EAAE,KAC1D,CAAC,QACD;EACA,MAAM,mCAAmC;GAAC;GAAW;GAAU,GAAG;EAAQ;EAC1E,MAAM,IAAI,KAAK,gCAAgC;CACjD,OACE,MAAM,IAAI,KAAK,IAAI;AAEvB;AAEA,MAAM,KAAK,CAAC,CAAC,MAAM,OAAO,UAAU;CAClC,MAAM,UAAU,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,SAAS;CAExD,MAAM,cAAc,gBAAgB,KAAK;CACzC,IAAI,SACF,MAAM;CAER,IAAI,iBAAiB,OAAO;EAC1B,QAAQ,MAAM,MAAM,OAAO;EAC3B,IAAI,uBAAuB,KAAK,GAC9B,oBAAoB,KAAK;EAE3B,QAAQ,KAAK,CAAC;CAChB,OACE,MAAM;AAEV,CAAC","debug_id":"adfc754d-b98f-5eb1-9873-7e473fff27c0"}
1
+ {"version":3,"file":"cli.mjs","sources":["../src/get-version.ts","../src/utils/constants.ts","../src/commands/ph-cli-help.ts","../src/commands/access-token.ts","../src/commands/build.ts","../src/commands/connect.ts","../src/commands/generate-all.ts","../src/utils/fs-args.ts","../src/utils/comma-separated.ts","../src/commands/generate-app.ts","../src/commands/generate-document-model.ts","../src/commands/generate-editor.ts","../src/commands/generate-migration-file.ts","../src/commands/generate-piece-action.ts","../src/commands/generate-piece-trigger.ts","../src/commands/generate-piece.ts","../src/commands/generate-processor.ts","../src/commands/generate-subgraph.ts","../src/commands/generate.ts","../src/commands/init.ts","../src/commands/inspect.ts","../src/commands/install.ts","../src/commands/list.ts","../src/commands/login.ts","../src/commands/logout.ts","../src/commands/migrate.ts","../src/commands/publish.ts","../src/commands/registry-login.ts","../src/commands/switchboard.ts","../src/commands/uninstall.ts","../src/commands/unpublish.ts","../src/commands/vetra.ts","../src/commands/ph-cli-commands.ts","../src/commands/ph-cli.ts","../src/utils/db-error-hint.ts","../src/cli.ts"],"sourcesContent":["declare const CLI_VERSION: string | undefined;\ndeclare const CLI_GIT_SHA: string | undefined;\n\nexport function getVersion() {\n if (typeof CLI_VERSION !== \"undefined\") return CLI_VERSION;\n return (\n process.env.WORKSPACE_VERSION ||\n process.env.npm_package_version ||\n \"unknown\"\n );\n}\n\nexport function getGitHash() {\n if (typeof CLI_GIT_SHA !== \"undefined\") return CLI_GIT_SHA;\n return process.env.WORKSPACE_GIT_SHA || \"unknown\";\n}\n","export const PH_CLI_DESCRIPTION =\n \"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.\" as const;\n","import { phCliHelpCommands } from \"@powerhousedao/shared/clis/args\";\nimport { subcommands } from \"cmd-ts\";\nimport { getVersion } from \"../get-version.js\";\nimport { PH_CLI_DESCRIPTION } from \"../utils/constants.js\";\n\nconst version = getVersion();\nexport const phCliHelp = subcommands({\n name: \"ph-cli\",\n description: PH_CLI_DESCRIPTION,\n version,\n cmds: phCliHelpCommands,\n});\n","import { accessTokenArgs } from \"@powerhousedao/shared/clis/args\";\nimport { DEFAULT_EXPIRY_SECONDS } from \"@powerhousedao/shared/clis/constants\";\nimport { command } from \"cmd-ts\";\n\nexport const accessToken = command({\n name: \"access-token\",\n description: `\nThe access-token command generates a bearer token for API authentication. This token\ncan be used to authenticate requests to Powerhouse APIs like reactor-api (Switchboard).\n\nThis command:\n1. Uses your CLI's cryptographic identity (DID) to sign a verifiable credential\n2. Creates a JWT bearer token with configurable expiration\n3. Outputs the token to stdout (info to stderr) for easy piping\n\nPrerequisites:\n You must have a cryptographic identity. Run 'ph login' first to:\n - Generate a keypair (stored in .ph/.keypair.json)\n - Optionally link your Ethereum address (stored in .ph/.renown.json)\n\nToken Details:\n The generated token is a JWT (JSON Web Token) containing:\n - Issuer (iss): Your CLI's DID (did:key:...)\n - Subject (sub): Your CLI's DID\n - Credential Subject: Chain ID, network ID, and address (if authenticated)\n - Expiration (exp): Based on --expiry option\n - Audience (aud): If --audience is specified\n\nOutput:\n- Token information (DID, address, expiry) is printed to stderr\n- The token itself is printed to stdout for easy piping/copying\n\nThis allows you to use the command in scripts:\n TOKEN=$(ph access-token)\n curl -H \"Authorization: Bearer $TOKEN\" http://localhost:4001/graphql\n\nUsage with APIs:\n Generate token and use with curl\n TOKEN=$(ph access-token --expiry 1d)\n curl -X POST http://localhost:4001/graphql \\\\\n -H \"Content-Type: application/json\" \\\\\n -H \"Authorization: Bearer $TOKEN\" \\\\\n -d '{\"query\": \"{ drives { id name } }\"}'\n\n Export as environment variable\n export PH_ACCESS_TOKEN=$(ph access-token)\n\nNotes:\n - Tokens are self-signed using your CLI's private key\n - No network request is made; tokens are generated locally\n - The recipient API must trust your CLI's DID to accept the token\n - For reactor-api, ensure AUTH_ENABLED=true to require authentication\n`,\n args: accessTokenArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n const { generateAccessToken, parseExpiry, formatExpiry } =\n await import(\"@renown/sdk/node\");\n const { getRenown } = await import(\"../services/auth.js\");\n const renown = await getRenown();\n\n let expiresIn = DEFAULT_EXPIRY_SECONDS;\n if (args.expiry) expiresIn = parseExpiry(args.expiry);\n\n const result = await generateAccessToken(renown, {\n expiresIn,\n aud: args.audience,\n });\n\n // Output token info to stderr, token itself to stdout for piping\n console.error(`CLI DID: ${result.did}`);\n console.error(`ETH Address: ${result.address}`);\n console.error(`Token expires in: ${formatExpiry(expiresIn)}`);\n console.error(\"\");\n\n console.log(result.token);\n process.exit(0);\n },\n});\n","import { buildArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const build = command({\n name: \"build\",\n description: `\nBuild a Powerhouse package for publishing: a browser bundle and a node bundle of its\ndocument models, editors, subgraphs and processors, type declarations, and its stylesheet.\n\nPieces under pieces/ are built too, each into its own self-contained module under\ndist/node/pieces/<name>, with a descriptor.json and package.json written beside it and\nthe piece listed in dist/powerhouse.manifest.json. A piece takes the package's version: an\nentry in pieces/index.ts that declares version fails the build. A package that ships only\npieces is an ordinary package: it carries the same boilerplate, and every step above runs\nfor it too.\n\ntsc runs first. If it reports type errors the build asks whether to go ahead, and stops\nwhere it can't ask. --ignore-type-errors builds without asking; a package built that way\ncan load and still fail at runtime, so don't publish it.`,\n args: buildArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n try {\n const { runBuild } = await import(\"../services/build.js\");\n await runBuild(args);\n } catch (error) {\n console.error(error);\n process.exit(1);\n }\n },\n});\n","import {\n connectBuildArgs,\n connectConfigArgs,\n connectPreviewArgs,\n connectStudioArgs,\n} from \"@powerhousedao/shared/clis/args\";\nimport { command, subcommands } from \"cmd-ts\";\nexport const studio = command({\n name: \"studio\",\n description: `The studio command starts the Connect Studio, a development environment for building\nand testing Powerhouse applications. It provides a visual interface for working with\nyour project.\n\nThis command:\n1. Starts a local Connect Studio server\n2. Provides a web interface for development\n3. Allows you to interact with your project components\n4. Supports various configuration options for customization\n`,\n args: connectStudioArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n const { runConnectStudio } = await import(\"../services/connect-studio.js\");\n await runConnectStudio(args);\n },\n});\n\nexport const build = command({\n name: \"build\",\n description: `The Connect build command creates a production build with the project's local and\nexternal packages included.\n\nRuntime-config overrides (all combinable — last wins on collision):\n ph connect build Build with the current source config.\n ph connect build <key> <value> Build with a positional override applied (e.g. ph connect build connect.renown.url https://renown.staging).\n ph connect build --<field> <value> Build with a per-field flag override (e.g. --renown-url https://renown.staging).\n ph connect build --json '{\"app\":{\"workflowsEnabled\":true}}'\n Build with a bulk override. The payload is the connect.* block\n without the \"connect\" wrapper; unknown keys are rejected.\n\nBuild has no read mode; passing only <key> without <value> errors out (use \\`ph connect config <key>\\` to read).\n`,\n args: connectBuildArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n const { runConnectBuild } = await import(\"../services/connect-build.js\");\n await runConnectBuild(args);\n process.exit(0);\n },\n});\n\nexport const preview = command({\n name: \"preview\",\n description: `The Connect preview command previews a built Connect project.\nNOTE: You must run \\`ph connect build\\` first\n`,\n args: connectPreviewArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n const { runConnectPreview } =\n await import(\"../services/connect-preview.js\");\n await runConnectPreview(args);\n },\n});\n\nexport const config = command({\n name: \"config\",\n description: `Read or update Connect's runtime configuration (powerhouse.config.json).\n\nModes (mutually exclusive — positional, --get, --json, and field flags cannot be combined):\n ph connect config List the effective connect.* block (defaults < source).\n ph connect config <key> Get the value at the dotted path (e.g. ph connect config connect.renown.url).\n ph connect config --get <dotted.path> Same as positional <key> (kept for backward compat).\n ph connect config <key> <value> Set a single field and dual-write to source + dist (positional).\n ph connect config --<field> <value> Set a single field via per-field flag (e.g. --renown-url https://renown.id).\n ph connect config --json '{\"renown\":{\"url\":\"…\"}}'\n Bulk-set multiple fields and dual-write. The payload is the connect.*\n block without the \"connect\" wrapper; unknown keys are rejected.\n\nWrites go to:\n - <project>/powerhouse.config.json (source — picked up by the next build)\n - <dist-dir>/powerhouse.config.json (if it exists — the currently-served SPA picks it up on refresh)\n`,\n args: connectConfigArgs,\n handler: async (args) => {\n const { runConnectConfig } = await import(\"../services/connect-config.js\");\n await runConnectConfig(args);\n },\n});\n\nexport const connect = subcommands({\n name: \"connect\",\n description: `Powerhouse Connect commands. Use with \\`studio\\`, \\`build\\`, \\`preview\\`, or \\`config\\`. Defaults to \\`studio\\` if not specified.`,\n cmds: {\n studio,\n build,\n preview,\n config,\n },\n});\n","import { command, flag } from \"cmd-ts\";\n\nexport const generateAllCmd = command({\n name: \"all\",\n description: \"Re-generate all modules in the current project\",\n args: {\n extract: flag({\n long: \"extract\",\n short: \"x\",\n description:\n \"Instead of generating code, write a spec for every module into specs/ (one-shot migration to documents-as-source-of-truth)\",\n }),\n },\n handler: async (args) => {\n const { startGenerateAll } = await import(\"../services/generate-all.js\");\n await startGenerateAll(args, process.cwd());\n process.exit(0);\n },\n});\n","import { extendType, string, type Type } from \"cmd-ts\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\n// cmd-ts's `batteries/fs`, rebuilt on the root entry so bun never loads its CJS build.\n\nconst ExistingPath: Type<string, string> = extendType(string, {\n displayName: \"path\",\n description: \"An existing path\",\n from(str) {\n const resolved = path.resolve(str);\n if (!fs.existsSync(resolved)) {\n return Promise.reject(new Error(\"Path doesn't exist\"));\n }\n return Promise.resolve(resolved);\n },\n});\n\n/** A directory, or the directory of a given file. */\nexport const Directory: Type<string, string> = extendType(ExistingPath, {\n displayName: \"dir\",\n description: \"A path to a directory or a file within a directory\",\n from(resolved) {\n return Promise.resolve(\n fs.statSync(resolved).isDirectory() ? resolved : path.dirname(resolved),\n );\n },\n});\n\n/** An existing file. */\nexport const File: Type<string, string> = extendType(ExistingPath, {\n displayName: \"file\",\n description: \"A file in the file system\",\n from(resolved) {\n if (!fs.statSync(resolved).isFile()) {\n return Promise.reject(new Error(\"Provided path is not a file\"));\n }\n return Promise.resolve(resolved);\n },\n});\n","import type { Type } from \"cmd-ts\";\n\n/** Splits comma-separated values so `-t \"a,b\"` means the same as `-t a -t b`\n * instead of yielding the single value `\"a,b\"`, which matches nothing. */\nexport function splitCommaSeparated(values: string[]): string[] {\n return values\n .flatMap((value) => value.split(\",\"))\n .map((value) => value.trim())\n .filter((value) => value.length > 0);\n}\n\n/** `multioption` type accepting repeated and/or comma-separated values. */\nexport const CommaSeparatedStrings: Type<string[], string[]> = {\n from: (values) => Promise.resolve(splitCommaSeparated(values)),\n};\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport {\n boolean,\n command,\n flag,\n multioption,\n option,\n optional,\n string,\n} from \"cmd-ts\";\nimport { Directory, File } from \"../utils/fs-args.js\";\nimport { CommaSeparatedStrings } from \"../utils/comma-separated.js\";\n\nexport const generateAppCmd = command({\n name: \"app\",\n description: \"Generate a drive app\",\n args: {\n name: option({\n type: optional(string),\n long: \"name\",\n short: \"n\",\n description: \"The name of the drive app to generate\",\n }),\n allowedDocumentTypes: multioption({\n type: optional(CommaSeparatedStrings),\n long: \"document-types\",\n short: \"t\",\n description:\n \"The document types allowed by the new app (repeatable or comma-separated)\",\n }),\n document: option({\n type: optional(File),\n long: \"document\",\n short: \"d\",\n description:\n \"Path to a powerhouse/app spec file (.phd or .json) to drive codegen\",\n }),\n dir: option({\n type: optional(Directory),\n long: \"dir\",\n description: \"Name of the directory of an existing app to re-generate\",\n }),\n disableDragAndDrop: flag({\n type: boolean,\n long: \"disable-drag-and-drop\",\n description: \"Do not allow drag and drop in this drive app.\",\n defaultValue: () => false as const,\n defaultValueIsSerializable: true,\n }),\n all: flag({\n long: \"all\",\n short: \"a\",\n description: \"Re-generate all existing apps in the current project\",\n }),\n extract: flag({\n long: \"extract\",\n short: \"x\",\n description:\n \"Write a powerhouse/app spec for each existing drive app into specs/apps/\",\n }),\n ...debugArgs,\n },\n handler: async (args) => {\n const { startGenerateApp } = await import(\"../services/generate-app.js\");\n await startGenerateApp(args, process.cwd());\n process.exit(0);\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command, flag, option, optional } from \"cmd-ts\";\nimport { Directory, File } from \"../utils/fs-args.js\";\nexport const generateDocumentModelCmd = command({\n name: \"document-model\",\n aliases: [\"doc\"],\n description: \"Generate a document model\",\n args: {\n document: option({\n type: optional(File),\n long: \"document\",\n short: \"d\",\n description:\n \"Path to a document model spec (.phd or .json) to generate from\",\n }),\n dir: option({\n type: optional(Directory),\n long: \"dir\",\n description:\n \"Name of the directory of an existing document model to re-generate\",\n }),\n all: flag({\n long: \"all\",\n short: \"a\",\n description:\n \"Re-generate all existing document models in the current project\",\n }),\n extract: flag({\n long: \"extract\",\n short: \"x\",\n description:\n \"Write a powerhouse/document-model spec for each existing document model into specs/document-models/\",\n }),\n ...debugArgs,\n },\n handler: async (args) => {\n const { startGenerateDocumentModel } =\n await import(\"../services/generate-document-model.js\");\n await startGenerateDocumentModel(args, process.cwd());\n process.exit(0);\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command, flag, option, optional, string } from \"cmd-ts\";\nimport { Directory, File } from \"../utils/fs-args.js\";\n\nexport const generateEditorCmd = command({\n name: \"editor\",\n description: \"Generate a document editor\",\n args: {\n name: option({\n type: optional(string),\n long: \"name\",\n short: \"n\",\n description: \"The name of the document editor to generate\",\n }),\n documentType: option({\n type: optional(string),\n long: \"document-type\",\n short: \"t\",\n description: \"The document type for the new editor\",\n }),\n document: option({\n type: optional(File),\n long: \"document\",\n short: \"d\",\n description:\n \"Path to a powerhouse/document-editor spec file (.phd or .json) to drive codegen\",\n }),\n dir: option({\n type: optional(Directory),\n long: \"dir\",\n description: \"Name of the directory of an existing editor to re-generate\",\n }),\n all: flag({\n long: \"all\",\n short: \"a\",\n description: \"Re-generate all existing editors in the current project\",\n }),\n extract: flag({\n long: \"extract\",\n short: \"x\",\n description:\n \"Write a powerhouse/document-editor spec for each existing editor into specs/editors/\",\n }),\n ...debugArgs,\n },\n handler: async (args) => {\n const { startGenerateEditor } =\n await import(\"../services/generate-editor.js\");\n await startGenerateEditor(args, process.cwd());\n process.exit(0);\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command, option, optional, string } from \"cmd-ts\";\nimport path from \"path\";\n\nexport const generateMigrationFileCmd = command({\n name: \"migration-file\",\n description: \"Generate a migration file\",\n args: {\n migrationFile: option({\n type: string,\n long: \"path\",\n short: \"p\",\n description: \"Path to the migration file\",\n }),\n schemaFile: option({\n type: optional(string),\n long: \"schema-file\",\n description: \"Path to the output file. Defaults to './schema.ts'\",\n }),\n ...debugArgs,\n },\n handler: async ({ migrationFile, schemaFile }) => {\n const { generateDBSchema } = await import(\"@powerhousedao/codegen\");\n await generateDBSchema({\n migrationFile: path.join(process.cwd(), migrationFile),\n schemaFile: schemaFile ? path.join(process.cwd(), schemaFile) : undefined,\n });\n process.exit(0);\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command, oneOf, option, optional, positional, string } from \"cmd-ts\";\nimport { skipInstallArgs } from \"../utils/install-added-dependencies.js\";\n\nexport const generatePieceActionCmd = command({\n name: \"piece-action\",\n description: \"Generate an action inside an existing piece\",\n args: {\n namePositional: positional({\n type: optional(string),\n displayName: \"name\",\n description: \"The name of the action, e.g. get-record\",\n }),\n name: option({\n type: optional(string),\n long: \"name\",\n short: \"n\",\n description: \"The name of the action to generate\",\n }),\n piece: option({\n type: optional(string),\n long: \"piece\",\n short: \"p\",\n description:\n \"The piece directory under pieces/ to add the action to. Optional when the project ships exactly one piece.\",\n }),\n requireReactor: option({\n type: optional(oneOf([\"read\", \"write\"] as const)),\n long: \"require-reactor\",\n description:\n \"Declare reactor access for the action: read, or write (which includes read). The action then gets context.reactor\",\n }),\n ...skipInstallArgs,\n ...debugArgs,\n },\n handler: async (args) => {\n const { startGeneratePieceAction } =\n await import(\"../services/generate-piece-action.js\");\n await startGeneratePieceAction(args, process.cwd());\n process.exit(0);\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command, oneOf, option, optional, positional, string } from \"cmd-ts\";\nimport { skipInstallArgs } from \"../utils/install-added-dependencies.js\";\n\nexport const generatePieceTriggerCmd = command({\n name: \"piece-trigger\",\n description: \"Generate a trigger inside an existing piece\",\n args: {\n namePositional: positional({\n type: optional(string),\n displayName: \"name\",\n description: \"The name of the trigger, e.g. new-record\",\n }),\n name: option({\n type: optional(string),\n long: \"name\",\n short: \"n\",\n description: \"The name of the trigger to generate\",\n }),\n piece: option({\n type: optional(string),\n long: \"piece\",\n short: \"p\",\n description:\n \"The piece directory under pieces/ to add the trigger to. Optional when the project ships exactly one piece.\",\n }),\n strategy: option({\n type: oneOf([\"polling\", \"webhook\"] as const),\n long: \"strategy\",\n description:\n \"How the trigger fires: polled on a schedule, or delivered to a webhook\",\n defaultValue: () => \"polling\" as const,\n defaultValueIsSerializable: true,\n }),\n requireReactor: option({\n type: optional(oneOf([\"read\", \"write\"] as const)),\n long: \"require-reactor\",\n description:\n \"Declare reactor access for the trigger: read, or write (which includes read). Its hooks then get context.reactor\",\n }),\n ...skipInstallArgs,\n ...debugArgs,\n },\n handler: async (args) => {\n const { startGeneratePieceTrigger } =\n await import(\"../services/generate-piece-trigger.js\");\n await startGeneratePieceTrigger(args, process.cwd());\n process.exit(0);\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport {\n command,\n flag,\n oneOf,\n option,\n optional,\n positional,\n string,\n} from \"cmd-ts\";\nimport { Directory } from \"../utils/fs-args.js\";\nimport { skipInstallArgs } from \"../utils/install-added-dependencies.js\";\n\nexport const generatePieceCmd = command({\n name: \"piece\",\n description:\n \"Generate a piece: a connector whose actions and triggers a workflow can call\",\n args: {\n namePositional: positional({\n type: optional(string),\n displayName: \"name\",\n description:\n \"The name of the piece to generate. Its directory is the kebab-case of this.\",\n }),\n name: option({\n type: optional(string),\n long: \"name\",\n short: \"n\",\n description: \"The name of the piece to generate\",\n }),\n id: option({\n type: optional(string),\n long: \"id\",\n description:\n \"The piece id, the pieceName a workflow step holds, e.g. @acme/piece-crm. Defaults to one derived from the package name.\",\n }),\n auth: option({\n type: oneOf([\"none\", \"secret\", \"custom\"] as const),\n long: \"auth\",\n description: \"The kind of connection the piece asks for\",\n defaultValue: () => \"custom\" as const,\n defaultValueIsSerializable: true,\n }),\n description: option({\n type: optional(string),\n long: \"description\",\n description: \"One line describing what the piece connects to\",\n }),\n dir: option({\n type: optional(Directory),\n long: \"dir\",\n description: \"Name of the directory of an existing piece to re-register\",\n }),\n all: flag({\n long: \"all\",\n short: \"a\",\n description:\n \"Re-register every piece in pieces/: refresh the pieces list and the manifest, and prune what is gone\",\n }),\n ...skipInstallArgs,\n ...debugArgs,\n },\n handler: async (args) => {\n const { startGeneratePiece } =\n await import(\"../services/generate-piece.js\");\n await startGeneratePiece(args, process.cwd());\n process.exit(0);\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport { PROCESSOR_APPS } from \"@powerhousedao/shared/processors\";\nimport type { Type } from \"cmd-ts\";\nimport {\n command,\n flag,\n multioption,\n oneOf,\n option,\n optional,\n string,\n} from \"cmd-ts\";\nimport { Directory, File } from \"../utils/fs-args.js\";\nimport {\n CommaSeparatedStrings,\n splitCommaSeparated,\n} from \"../utils/comma-separated.js\";\nimport { skipInstallArgs } from \"../utils/install-added-dependencies.js\";\n\nconst ProcessorAppType: Type<string[], (\"connect\" | \"switchboard\")[]> = {\n from(rawProcessorApps) {\n const processorApps = splitCommaSeparated(rawProcessorApps);\n if (processorApps.length === 0) {\n throw new Error(\n `No arguments provided for processor apps. Must be \"connect\" and/or \"switchboard\"`,\n );\n }\n if (processorApps.length > 2) {\n throw new Error(\n `Too many arguments provided for processor apps. Must be \"connect\" and/or \"switchboard\"`,\n );\n }\n const allowed = new Set(PROCESSOR_APPS);\n if (\n !processorApps.every((p) => allowed.has(p as \"connect\" | \"switchboard\"))\n ) {\n throw new Error(\n `Processor apps can only be \"connect\" and/or \"switchboard\".`,\n );\n }\n return Promise.resolve(processorApps as (\"connect\" | \"switchboard\")[]);\n },\n};\nexport const generateProcessorCmd = command({\n name: \"processor\",\n description: \"Generate a processor\",\n args: {\n name: option({\n type: optional(string),\n long: \"name\",\n short: \"n\",\n description: \"The name of the processor to generate\",\n }),\n type: option({\n type: oneOf([\"analytics\", \"relationalDb\"] as const),\n long: \"type\",\n description: \"The type of processor to generate\",\n defaultValue: () => \"analytics\" as const,\n defaultValueIsSerializable: true,\n }),\n documentTypes: multioption({\n type: CommaSeparatedStrings,\n long: \"document-types\",\n short: \"t\",\n description:\n \"The document types the processor will run on (repeatable or comma-separated)\",\n defaultValue: () => [],\n defaultValueIsSerializable: true,\n }),\n apps: multioption({\n long: \"apps\",\n type: ProcessorAppType,\n description:\n \"Whether the processor will run in switchboard (nodejs), connect (browser), or both\",\n defaultValue: () => [\"switchboard\" as const, \"connect\" as const],\n defaultValueIsSerializable: true,\n }),\n document: option({\n type: optional(File),\n long: \"document\",\n short: \"d\",\n description:\n \"Path to a powerhouse/processor spec file (.phd or .json) to drive codegen\",\n }),\n dir: option({\n type: optional(Directory),\n long: \"dir\",\n description:\n \"Name of the directory of an existing processor to re-generate\",\n }),\n all: flag({\n long: \"all\",\n short: \"a\",\n description: \"Re-generate all existing processors in the current project\",\n }),\n extract: flag({\n long: \"extract\",\n short: \"x\",\n description:\n \"Write a powerhouse/processor spec for each existing processor into specs/processors/\",\n }),\n ...skipInstallArgs,\n ...debugArgs,\n },\n handler: async (args) => {\n const { startGenerateProcessor } =\n await import(\"../services/generate-processor.js\");\n await startGenerateProcessor(args, process.cwd());\n process.exit(0);\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command, flag, option, optional, string } from \"cmd-ts\";\nimport { Directory, File } from \"../utils/fs-args.js\";\nimport { skipInstallArgs } from \"../utils/install-added-dependencies.js\";\n\nexport const generateSubgraphCmd = command({\n name: \"subgraph\",\n description: \"Generate a subgraph\",\n args: {\n name: option({\n type: optional(string),\n long: \"name\",\n short: \"n\",\n description: \"The name of the subgraph to generate\",\n }),\n document: option({\n type: optional(File),\n long: \"document\",\n short: \"d\",\n description:\n \"Path to a powerhouse/subgraph spec file (.phd or .json) to drive codegen\",\n }),\n dir: option({\n type: optional(Directory),\n long: \"dir\",\n description:\n \"Name of the directory of an existing subgraph to re-generate\",\n }),\n all: flag({\n long: \"all\",\n short: \"a\",\n description: \"Re-generate all existing subgraphs in the current project\",\n }),\n extract: flag({\n long: \"extract\",\n short: \"x\",\n description:\n \"Write a powerhouse/subgraph spec for each existing subgraph into specs/subgraphs/\",\n }),\n ...skipInstallArgs,\n ...debugArgs,\n },\n handler: async (args) => {\n const { startGenerateSubgraph } =\n await import(\"../services/generate-subgraph.js\");\n await startGenerateSubgraph(args, process.cwd());\n process.exit(0);\n },\n});\n","import { subcommands } from \"cmd-ts\";\nimport { generateAllCmd } from \"./generate-all.js\";\nimport { generateAppCmd } from \"./generate-app.js\";\nimport { generateDocumentModelCmd } from \"./generate-document-model.js\";\nimport { generateEditorCmd } from \"./generate-editor.js\";\nimport { generateMigrationFileCmd } from \"./generate-migration-file.js\";\nimport { generatePieceActionCmd } from \"./generate-piece-action.js\";\nimport { generatePieceTriggerCmd } from \"./generate-piece-trigger.js\";\nimport { generatePieceCmd } from \"./generate-piece.js\";\nimport { generateProcessorCmd } from \"./generate-processor.js\";\nimport { generateSubgraphCmd } from \"./generate-subgraph.js\";\n\nexport const generate = subcommands({\n name: \"generate\",\n description: `The generate command creates code for Powerhouse modules. It helps you create new code from scratch, or to re-generate existing code in your project.`,\n cmds: {\n all: generateAllCmd,\n \"document-model\": generateDocumentModelCmd,\n editor: generateEditorCmd,\n app: generateAppCmd,\n processor: generateProcessorCmd,\n subgraph: generateSubgraphCmd,\n piece: generatePieceCmd,\n \"piece-action\": generatePieceActionCmd,\n \"piece-trigger\": generatePieceTriggerCmd,\n \"migration-file\": generateMigrationFileCmd,\n },\n});\n","import { initArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const init = command({\n name: \"init\",\n description: \"Initialize a new project\",\n args: initArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log({ args });\n }\n const { startInit } = await import(\"../services/init.js\");\n await startInit(args);\n process.exit(0);\n },\n});\n","import { inspectArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const inspect = command({\n name: \"inspect\",\n description: `\nThe inspect command examines and provides detailed information about a Powerhouse package.\nIt helps you understand the structure, dependencies, and configuration of packages in\nyour project.\n\nThis command:\n1. Analyzes the specified package\n2. Retrieves detailed information about its structure and configuration\n3. Displays package metadata, dependencies, and other relevant information\n4. Helps troubleshoot package-related issues`,\n aliases: [\"is\"],\n args: inspectArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n const { startInspect } = await import(\"../services/inspect.js\");\n startInspect(args);\n process.exit(0);\n },\n});\n","import { installArgs } from \"@powerhousedao/shared/clis/args\";\nimport { execSync } from \"child_process\";\nimport { command } from \"cmd-ts\";\n\nexport const install = command({\n name: \"install\",\n aliases: [\"add\", \"i\"],\n description: `\nThe install command adds Powerhouse dependencies to your project.\n\nBy default it only registers the package in powerhouse.config.json with\nprovider \"registry\" — Connect will load it from the registry CDN at runtime.\n\nWith --local, the package is also installed into node_modules and marked\nas provider \"local\" — it will be bundled into ph connect build so the\npreview works without the registry being reachable.\n\nResolution order for the registry URL:\n --registry flag > PH_REGISTRY_URL env > powerhouse.config.json > default\n `,\n args: installArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n const { getPowerhouseProjectInfo, makeDependenciesWithVersions } =\n await import(\"@powerhousedao/shared/clis\");\n\n const {\n projectPath,\n localProjectPath,\n globalProjectPath,\n packageManager,\n isGlobal,\n } = await getPowerhouseProjectInfo(args);\n\n if (!projectPath) {\n throw new Error(`Could not find project path to install from.`);\n }\n\n const { resolveRegistryUrl } =\n await import(\"@powerhousedao/shared/registry\");\n const registryUrl = resolveRegistryUrl({\n registry: args.registry,\n projectPath,\n });\n\n if (args.debug) {\n console.log(\">>> registryUrl\", registryUrl);\n }\n\n const dependenciesWithVersions = await makeDependenciesWithVersions(\n args.dependencies,\n registryUrl,\n );\n\n if (args.debug) {\n console.log(\">>> parsedDependencies\", dependenciesWithVersions);\n console.log(\"\\n>>> projectInfo\", {\n localProjectPath,\n globalProjectPath,\n packageManager,\n isGlobal,\n });\n }\n\n if (args.local) {\n if (dependenciesWithVersions.length === 0) {\n throw new Error(\n \"--local requires at least one package name (e.g. ph install --local @scope/pkg)\",\n );\n }\n try {\n const specs = dependenciesWithVersions.map((d) =>\n d.version ? `${d.name}@${d.version}` : d.name,\n );\n\n // Route only the scopes of the packages being installed to the\n // resolved registry, leaving transitive deps from other scopes\n // (and unscoped packages) on the package manager's default. This\n // avoids requiring a project-level .npmrc when the user already\n // has packageRegistryUrl in powerhouse.config.json.\n const scopes = new Set<string>();\n for (const dep of dependenciesWithVersions) {\n if (dep.name.startsWith(\"@\")) {\n const scope = dep.name.split(\"/\")[0];\n scopes.add(scope);\n }\n }\n const scopeRegistryArgs = Array.from(scopes).map(\n (scope) => `--${scope}:registry=${registryUrl}`,\n );\n\n const minReleaseAgeArgs =\n packageManager === \"pnpm\" ? [\"--config.minimum-release-age=0\"] : [];\n\n const allowBuildArgs =\n packageManager === \"pnpm\" && args.allowBuild.length > 0\n ? [`--allow-build=${args.allowBuild.join(\",\")}`]\n : [];\n\n const { resolveCommand } = await import(\"package-manager-detector\");\n const resolved = resolveCommand(packageManager, \"add\", [\n ...specs,\n ...scopeRegistryArgs,\n ...minReleaseAgeArgs,\n ...allowBuildArgs,\n ]);\n if (!resolved) {\n throw new Error(\n `Failed to resolve install command for package manager \"${packageManager}\".`,\n );\n }\n const installCommand = `${resolved.command} ${resolved.args.join(\" \")}`;\n if (scopeRegistryArgs.length > 0) {\n console.log(\n `Installing dependencies 📦 (routing ${Array.from(scopes).join(\", \")} → ${registryUrl})...`,\n );\n } else {\n console.log(\"Installing dependencies 📦...\");\n }\n console.log(`> ${installCommand}`);\n execSync(installCommand, {\n stdio: \"inherit\",\n cwd: projectPath,\n });\n console.log(\"Dependency installed successfully 🎉\");\n } catch (error) {\n console.error(\"❌ Failed to install dependencies\");\n throw error;\n }\n }\n\n const { updateConfigFile, updateStylesFile } = await import(\"../utils.js\");\n\n try {\n console.log(\"⚙️ Updating powerhouse config file...\");\n updateConfigFile(\n dependenciesWithVersions,\n projectPath,\n \"install\",\n args.local ? \"local\" : \"registry\",\n registryUrl,\n args.registry !== undefined,\n );\n console.log(\"Config file updated successfully 🎉\");\n } catch (error) {\n console.error(\"❌ Failed to update config file\");\n throw error;\n }\n\n if (args.local) {\n try {\n console.log(\"⚙️ Updating styles.css file...\");\n updateStylesFile(dependenciesWithVersions, projectPath);\n console.log(\"Styles file updated successfully 🎉\");\n } catch (error) {\n console.error(\"❌ Failed to update styles file\");\n throw error;\n }\n }\n\n process.exit(0);\n },\n});\n","import { listArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const list = command({\n name: \"list\",\n description: `\nThe list command displays information about installed Powerhouse packages in your project.\nIt reads the powerhouse.config.json file and shows the packages that are currently installed.\n\nThis command:\n1. Examines your project configuration\n2. Lists all installed Powerhouse packages\n3. Provides a clear overview of your project's dependencies\n4. Helps you manage and track your Powerhouse components\n`,\n aliases: [\"l\"],\n args: listArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n try {\n const { getPowerhouseProjectInfo } =\n await import(\"@powerhousedao/shared/clis\");\n const projectInfo = await getPowerhouseProjectInfo();\n\n const { getConfig } = await import(\"@powerhousedao/config/node\");\n const phConfig = getConfig(\n projectInfo.projectPath + \"/powerhouse.config.json\",\n );\n\n if (!phConfig.packages || phConfig.packages.length === 0) {\n console.log(\"No packages found in the project\");\n return;\n }\n\n console.log(\"Installed Packages:\\n\");\n phConfig.packages.forEach((pkg) => {\n console.log(\n pkg.version ? `${pkg.packageName}@${pkg.version}` : pkg.packageName,\n );\n });\n } catch (_e) {\n console.log(\"No packages found in the project\");\n }\n process.exit(0);\n },\n});\n","import { loginArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const login = command({\n name: \"login\",\n description: `\nThe login command authenticates you with Renown using your Ethereum wallet. This enables\nthe CLI to act on behalf of your Ethereum identity for authenticated operations.\n\nThis command:\n1. Generates or loads a cryptographic identity (DID) for the CLI\n2. Opens your browser to the Renown authentication page\n3. You authorize the CLI's DID to act on behalf of your Ethereum address\n4. Stores the credentials locally in .ph/.renown.json\n `,\n args: loginArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n const { getRenown } = await import(\"../services/auth.js\");\n const renown = await getRenown(args.renownUrl);\n\n if (args.showDid) {\n console.log(renown.did);\n process.exit(0);\n }\n\n if (args.status) {\n const { getAuthStatus } = await import(\"@renown/sdk/node\");\n const status = getAuthStatus(renown);\n if (!status.authenticated || !status.address) {\n console.log(\"Not authenticated with an Ethereum address.\");\n console.log('Run \"ph login\" to authenticate.');\n } else {\n console.log(\"Authenticated\");\n console.log(` ETH Address: ${status.address}`);\n console.log(` User DID: ${status.userDid}`);\n console.log(` Chain ID: ${status.chainId}`);\n console.log(` CLI DID: ${status.cliDid}`);\n console.log(\n ` Authenticated at: ${status.authenticatedAt?.toLocaleString()}`,\n );\n console.log(` Renown URL: ${status.baseUrl}`);\n }\n process.exit(0);\n }\n\n if (args.logout) {\n await handleLogout();\n process.exit(0);\n }\n\n const { browserLogin } = await import(\"@renown/sdk/node\");\n\n console.debug(\"Initializing cryptographic identity...\");\n console.log(`CLI DID: ${renown.did}`);\n\n try {\n const timeoutMs = args.timeout ? args.timeout * 1000 : undefined;\n\n const result = await browserLogin(renown, {\n renownUrl: args.renownUrl,\n timeoutMs,\n onLoginUrl: (url, sessionId) => {\n console.log(\"Opening browser for authentication...\");\n console.log(`Session ID: ${sessionId.slice(0, 8)}...`);\n console.log(`Login URL: ${url}`);\n console.log();\n console.log(\"Waiting for authentication in browser\");\n console.log(`(timeout in ${(timeoutMs ?? 300_000) / 1000} seconds)`);\n console.log();\n console.log(\n \"Please connect your wallet and authorize this CLI to act on your behalf.\",\n );\n console.log();\n process.stdout.write(\"Waiting\");\n },\n onPollTick: () => process.stdout.write(\".\"),\n onBrowserOpenFailed: (url) => {\n console.error(\"Failed to open browser automatically.\");\n console.log(`Please open this URL manually: ${url}`);\n },\n });\n\n console.log(); // New line after dots\n console.log();\n console.log(\"Successfully authenticated!\");\n console.log(` ETH Address: ${result.user.address}`);\n console.log(` User DID: ${result.user.did}`);\n console.log(` CLI DID: ${result.cliDid}`);\n console.log();\n console.log(\"The CLI can now act on behalf of your Ethereum identity.\");\n } catch (error) {\n console.log(); // New line after dots\n throw error;\n }\n\n process.exit(0);\n },\n});\n\nexport async function handleLogout() {\n const { getRenown } = await import(\"../services/auth.js\");\n const renown = await getRenown();\n if (!renown.user) {\n console.log(\"Not currently authenticated.\");\n return;\n }\n\n try {\n await renown.logout();\n console.log(\"Successfully logged out.\");\n } catch (error) {\n console.error(\"Failed to clear credentials.\");\n console.debug(error);\n }\n}\n","import { command } from \"cmd-ts\";\nimport { handleLogout } from \"./login.js\";\n\nexport const logout = command({\n name: \"logout\",\n description: `\nThe logout command removes an existing session created with 'ph login'`,\n args: {},\n handler: async () => {\n await handleLogout();\n process.exit(0);\n },\n});\n","import { migrateArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const migrate = command({\n name: \"migrate\",\n args: migrateArgs,\n description: \"Run migrations\",\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n const { startMigrate } = await import(\"../services/migrate.js\");\n await startMigrate(args);\n process.exit(0);\n },\n});\n","import { publishArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nfunction hasTagFlag(args: string[]): boolean {\n return args.some((a) => a === \"--tag\" || a.startsWith(\"--tag=\"));\n}\n\nfunction isInteractive(): boolean {\n return Boolean(process.stdin.isTTY) && !process.env.CI;\n}\n\nasync function readPrereleaseTag(projectPath: string): Promise<{\n version: string;\n tag: string;\n} | null> {\n try {\n const [{ readPackageSync }, { prerelease }] = await Promise.all([\n import(\"read-pkg\"),\n import(\"semver\"),\n ]);\n const pkg = readPackageSync({ cwd: projectPath });\n if (!pkg.version) return null;\n const parts = prerelease(pkg.version);\n if (!parts || parts.length === 0) return null;\n const label = String(parts[0]);\n // semver may surface numeric-only prerelease ids (e.g. `1.0.0-0`);\n // npm requires an alphanumeric dist-tag, so skip those.\n if (!/^[a-z][a-z0-9-]*$/i.test(label)) return null;\n return { version: pkg.version, tag: label };\n } catch {\n return null;\n }\n}\n\nexport const publish = command({\n name: \"publish\",\n description: `\nPublish a package to the Powerhouse registry. This is a thin wrapper around npm publish\nthat automatically sets the registry URL.\n\nThis command:\n1. Resolves the registry URL (--registry flag > PH_REGISTRY_URL env > powerhouse.config.json > default)\n2. Checks authentication with the registry via npm whoami\n3. Forwards all additional arguments to npm publish\n `,\n args: publishArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n const { getPowerhouseProjectInfo } =\n await import(\"@powerhousedao/shared/clis\");\n const { projectPath } = await getPowerhouseProjectInfo();\n\n if (!projectPath) {\n throw new Error(\"Could not find project path.\");\n }\n\n const { checkNpmAuth, npmPublish, resolveRegistryUrl } =\n await import(\"@powerhousedao/shared/registry\");\n const { mintRegistryAuthToken } =\n await import(\"../services/registry-auth.js\");\n\n const registryUrl = resolveRegistryUrl({\n registry: args.registry,\n projectPath,\n });\n\n if (args.debug) {\n console.log(\">>> registryUrl\", registryUrl);\n }\n\n // Try Renown auth first: if the user is logged in via `ph login`, mint a\n // short-lived registry-bound bearer token. Falling back to the legacy\n // `npm adduser` (htpasswd) path keeps existing flows working until the\n // grace period ends.\n let authToken: string | undefined;\n try {\n authToken = await mintRegistryAuthToken(registryUrl, 5 * 60);\n if (args.debug) {\n console.error(`>>> minted renown token for ${registryUrl} (5m TTL)`);\n }\n } catch (err) {\n if (args.debug) {\n console.error(\n `>>> renown token mint skipped: ${(err as Error).message}`,\n );\n }\n try {\n await checkNpmAuth(registryUrl);\n } catch {\n console.error(`Not authenticated with registry: ${registryUrl}`);\n console.error(\n `Run: ph login (recommended) or npm adduser --registry ${registryUrl}`,\n );\n process.exit(1);\n }\n }\n\n let forwardedArgs = args.forwardedArgs;\n\n if (!hasTagFlag(forwardedArgs)) {\n const prereleaseInfo = await readPrereleaseTag(projectPath);\n if (prereleaseInfo) {\n const { version, tag } = prereleaseInfo;\n if (!isInteractive()) {\n console.error(\n `Detected prerelease version ${version}. npm requires an explicit dist-tag for prerelease publishes.`,\n );\n console.error(\n `Re-run with --tag <label> (e.g. --tag ${tag}) to proceed.`,\n );\n process.exit(1);\n }\n\n const enquirer = await import(\"enquirer\");\n\n let confirmed: boolean;\n try {\n const answer = await enquirer.default.prompt<{ confirmed: boolean }>({\n type: \"confirm\",\n name: \"confirmed\",\n message: `Detected prerelease version ${version}. Publish with --tag ${tag}?`,\n initial: true,\n });\n confirmed = answer.confirmed;\n } catch {\n // user aborted the prompt (Ctrl-C); treat as decline\n confirmed = false;\n }\n\n if (!confirmed) {\n console.error(\n `Aborted. To publish manually: npm publish --registry ${registryUrl} --tag <label>`,\n );\n process.exit(1);\n }\n\n forwardedArgs = [\"--tag\", tag, ...forwardedArgs];\n }\n }\n\n if (args.debug) {\n console.log(\n \">>> command\",\n `npm publish --registry ${registryUrl} ${forwardedArgs.join(\" \")}`,\n );\n }\n\n console.log(`Publishing to ${registryUrl}...`);\n const result = await npmPublish({\n registryUrl,\n cwd: projectPath,\n args: forwardedArgs,\n authToken,\n });\n if (result.stdout) {\n console.log(result.stdout);\n }\n\n process.exit(0);\n },\n});\n","import { registryLoginArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const registryLogin = command({\n name: \"registry-login\",\n description: `\nLog in to a Powerhouse registry using your Renown identity. Mints a longer-lived\nbearer token (default 30 days) bound to the registry's audience and writes the\ntoken into ~/.npmrc so raw 'npm publish' / 'npm install' work without further\nsetup.\n\nPrerequisites:\n Run 'ph login' first to establish a Renown identity.\n\nUsage:\n ph registry-login # uses powerhouse.config.json / PH_REGISTRY_URL\n ph registry-login --registry https://registry.vetra.io\n ph registry-login --expiry 7d\n `,\n args: registryLoginArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n const { getPowerhouseProjectInfo } =\n await import(\"@powerhousedao/shared/clis\");\n const projectInfo = await getPowerhouseProjectInfo().catch(() => null);\n const projectPath = projectInfo?.projectPath ?? process.cwd();\n\n const [\n { resolveRegistryUrl, writeRegistryAuthToken },\n { mintRegistryAuthToken },\n { parseExpiry, formatExpiry },\n ] = await Promise.all([\n import(\"@powerhousedao/shared/registry\"),\n import(\"../services/registry-auth.js\"),\n import(\"@renown/sdk/node\"),\n ]);\n\n const registryUrl = resolveRegistryUrl({\n registry: args.registry,\n projectPath,\n });\n\n const expiresIn = parseExpiry(args.expiry);\n\n const token = await mintRegistryAuthToken(registryUrl, expiresIn);\n const npmrcPath = await writeRegistryAuthToken(registryUrl, token);\n\n console.log(`Logged in to ${registryUrl}`);\n console.log(` Token expires in: ${formatExpiry(expiresIn)}`);\n console.log(` Wrote: ${npmrcPath}`);\n process.exit(0);\n },\n});\n","import { switchboardArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const switchboard = command({\n name: \"switchboard\",\n aliases: [\"reactor\"],\n description: `\nThe switchboard command starts a local Switchboard instance, which acts as the document\nprocessing engine for Powerhouse projects. It provides the infrastructure for document\nmodels, processors, and real-time updates.\n\nThis command:\n1. Starts a local switchboard server\n2. Loads document models and processors\n3. Provides an API for document operations\n4. Enables real-time document processing\n5. Can authenticate with remote services using your identity from 'ph login'`,\n args: switchboardArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n const { basePath, dbPath, migrate, migrateStatus, reset, yes } = args;\n if (basePath) {\n process.env.BASE_PATH = basePath;\n }\n\n if (reset) {\n const { resetSwitchboardDatabase } =\n await import(\"../services/switchboard-reset.js\");\n await resetSwitchboardDatabase({ dbPath, yes });\n process.exit(0);\n }\n\n if (migrate || migrateStatus) {\n const { runSwitchboardMigrations } =\n await import(\"../services/switchboard-migrate.js\");\n await runSwitchboardMigrations({\n dbPath,\n statusOnly: migrateStatus,\n });\n process.exit(0);\n }\n\n const { startSwitchboard } = await import(\"../services/switchboard.js\");\n const { defaultDriveUrl, renown } = await startSwitchboard(args);\n console.log(\" ➜ Switchboard:\", defaultDriveUrl);\n if (renown) {\n console.log(\" ➜ Identity:\", renown.did);\n }\n },\n});\n","import { AGENTS, uninstallArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\nimport { execSync } from \"node:child_process\";\n\nexport const uninstall = command({\n name: \"uninstall\",\n aliases: [\"remove\"],\n description: `\nThe uninstall command removes Powerhouse dependencies from your project. It handles the\nremoval of packages, updates configuration files, and ensures proper cleanup.\n\nThis command:\n1. Uninstalls specified Powerhouse dependencies using your package manager\n2. Updates powerhouse.config.json to remove the dependencies\n3. Supports various uninstallation options and configurations\n4. Works with ${AGENTS.join(\", \")} package managers\n`,\n args: uninstallArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n const {\n getPowerhouseProjectInfo,\n getPowerhouseProjectUninstallCommand,\n makeDependenciesWithVersions,\n } = await import(\"@powerhousedao/shared/clis\");\n\n const {\n projectPath,\n localProjectPath,\n globalProjectPath,\n packageManager,\n isGlobal,\n } = await getPowerhouseProjectInfo(args);\n\n if (!projectPath) {\n throw new Error(`Could not find project path to uninstall from`);\n }\n\n const dependenciesWithVersions = await makeDependenciesWithVersions(\n args.dependencies,\n );\n\n if (args.debug) {\n console.log(\">>> parsedDependencies\", dependenciesWithVersions);\n }\n\n if (args.debug) {\n console.log(\"\\n>>> projectInfo\", {\n localProjectPath,\n globalProjectPath,\n packageManager,\n isGlobal,\n });\n }\n\n try {\n console.log(\"Uninstalling dependencies 📦 ...\");\n const uninstallCommand = await getPowerhouseProjectUninstallCommand(\n packageManager,\n args.dependencies,\n );\n execSync(uninstallCommand, {\n stdio: \"inherit\",\n cwd: projectPath,\n });\n console.log(\"Dependency uninstalled successfully 🎉\");\n } catch (error) {\n console.error(\"❌ Failed to uninstall dependencies\");\n throw error;\n }\n\n const { removeStylesImports, updateConfigFile } =\n await import(\"../utils.js\");\n\n try {\n console.log(\"⚙️ Updating powerhouse config file...\");\n updateConfigFile(dependenciesWithVersions, projectPath, \"uninstall\");\n console.log(\"Config file updated successfully 🎉\");\n } catch (error) {\n console.error(\"❌ Failed to update config file\");\n throw error;\n }\n\n try {\n console.log(\"⚙️ Updating styles.css file...\");\n removeStylesImports(dependenciesWithVersions, projectPath);\n console.log(\"Styles file updated successfully 🎉\");\n } catch (error) {\n console.error(\"❌ Failed to update styles file\");\n throw error;\n }\n\n process.exit(0);\n },\n});\n","import { unpublishArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\nimport { createInterface } from \"node:readline/promises\";\n\nexport const unpublish = command({\n name: \"unpublish\",\n description: `\nUnpublish a package from the Powerhouse registry. This is a thin wrapper around\nnpm unpublish that automatically targets the Powerhouse registry and never\nreaches npmjs.org.\n\nForms:\n ph unpublish # unpublish <name>@<version> from cwd's package.json\n ph unpublish <name> # unpublish the whole package (all versions)\n ph unpublish <name>@<version> # unpublish a single version\n\nFlags:\n --registry <url> # override registry URL\n --yes, -y # skip the confirmation prompt\n `,\n args: unpublishArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n const { getPowerhouseProjectInfo } =\n await import(\"@powerhousedao/shared/clis\");\n const { projectPath } = await getPowerhouseProjectInfo();\n\n if (!projectPath) {\n throw new Error(\"Could not find project path.\");\n }\n\n const { checkNpmAuth, npmUnpublish, resolveRegistryUrl } =\n await import(\"@powerhousedao/shared/registry\");\n\n const registryUrl = resolveRegistryUrl({\n registry: args.registry,\n projectPath,\n });\n\n const spec = await resolveSpec(args.spec, projectPath);\n if (!spec) {\n console.error(\n \"No package spec provided and could not read name/version from package.json.\",\n );\n process.exit(1);\n }\n\n if (args.debug) {\n console.log(\">>> registryUrl\", registryUrl);\n console.log(\">>> spec\", spec);\n }\n\n try {\n await checkNpmAuth(registryUrl);\n } catch {\n console.error(`Not authenticated with registry: ${registryUrl}`);\n console.error(`Run: npm adduser --registry ${registryUrl}`);\n process.exit(1);\n }\n\n if (!args.yes) {\n const confirmed = await confirm(\n `Unpublish ${spec} from ${registryUrl}? [y/N] `,\n );\n if (!confirmed) {\n console.log(\"Aborted.\");\n process.exit(0);\n }\n }\n\n if (args.debug) {\n console.log(\n \">>> command\",\n `npm unpublish ${spec} --registry ${registryUrl} --force ${args.forwardedArgs.join(\" \")}`,\n );\n }\n\n console.log(`Unpublishing ${spec} from ${registryUrl}...`);\n try {\n const result = await npmUnpublish({\n registryUrl,\n cwd: projectPath,\n spec,\n args: args.forwardedArgs,\n });\n if (result.stdout) {\n console.log(result.stdout);\n }\n process.exit(0);\n } catch (err) {\n console.error(err instanceof Error ? err.message : String(err));\n process.exit(1);\n }\n },\n});\n\nasync function resolveSpec(\n explicit: string | undefined,\n projectPath: string,\n): Promise<string | null> {\n if (explicit) return explicit;\n try {\n const { readPackageSync } = await import(\"read-pkg\");\n const pkg = readPackageSync({ cwd: projectPath });\n if (!pkg.name) return null;\n return pkg.version ? `${pkg.name}@${pkg.version}` : pkg.name;\n } catch {\n return null;\n }\n}\n\nasync function confirm(prompt: string): Promise<boolean> {\n const rl = createInterface({ input: process.stdin, output: process.stdout });\n try {\n const answer = await rl.question(prompt);\n return /^y(es)?$/i.test(answer.trim());\n } finally {\n rl.close();\n }\n}\n","import { vetraArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const vetra = command({\n name: \"vetra\",\n description: `\nThe vetra command sets up a Vetra development environment for working with Vetra projects.\nIt starts a Vetra Switchboard and optionally Connect Studio, enabling document collaboration \nand real-time processing with a \"Vetra\" drive or connection to remote drives.\n\nThis command:\n1. Starts a Vetra Switchboard with a \"Vetra\" drive for document storage\n2. Optionally connects to remote drives instead of creating a local drive\n3. Starts Connect Studio pointing to the Switchboard for user interaction (unless disabled)\n4. Enables real-time updates, collaboration, and code generation\n\nDefault drives:\nConnect's default drives resolve to the Vetra drive (and the preview drive\nwhen using --watch), plus any drives configured under\nconnect.drives.defaultDrives in powerhouse.config.json - de-duplicated by\nURL, so configuring project drives does not cost you the Vetra drive.\nAn explicit --default-drives-url is appended to that list (de-duplicated);\nit never replaces the Vetra drive.\n`,\n args: vetraArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n const { startVetra } = await import(\"../services/vetra.js\");\n await startVetra(args);\n },\n});\n","import { accessToken } from \"./access-token.js\";\nimport { build } from \"./build.js\";\nimport { connect } from \"./connect.js\";\nimport { generate } from \"./generate.js\";\nimport { init } from \"./init.js\";\nimport { inspect } from \"./inspect.js\";\nimport { install } from \"./install.js\";\nimport { list } from \"./list.js\";\nimport { login } from \"./login.js\";\nimport { logout } from \"./logout.js\";\nimport { migrate } from \"./migrate.js\";\nimport { publish } from \"./publish.js\";\nimport { registryLogin } from \"./registry-login.js\";\nimport { switchboard } from \"./switchboard.js\";\nimport { uninstall } from \"./uninstall.js\";\nimport { unpublish } from \"./unpublish.js\";\nimport { vetra } from \"./vetra.js\";\n\nexport const phCliCommands = {\n init,\n generate,\n vetra,\n connect,\n build,\n publish,\n unpublish,\n \"access-token\": accessToken,\n \"registry-login\": registryLogin,\n inspect,\n list,\n migrate,\n switchboard,\n login,\n logout,\n install,\n uninstall,\n} as const;\n","import { subcommands } from \"cmd-ts\";\nimport { getVersion } from \"../get-version.js\";\nimport { PH_CLI_DESCRIPTION } from \"../utils/constants.js\";\nimport { phCliCommands } from \"./ph-cli-commands.js\";\n\nconst version = getVersion();\nexport const phCli = subcommands({\n name: \"ph-cli\",\n description: PH_CLI_DESCRIPTION,\n version,\n cmds: phCliCommands,\n});\n","import { yellow, bold } from \"colorette\";\n\nconst UNRECOVERABLE_DB_PATTERNS: RegExp[] = [\n /Database migration failed:/i,\n /Migration .* failed/i,\n /relation \"[^\"]+\" already exists/i,\n /column \"[^\"]+\" does not exist/i,\n /schema \"reactor\" does not exist/i,\n /Unsupported PGLite data dir/i,\n /PG_VERSION/i,\n];\n\nfunction collectMessages(err: unknown): string[] {\n const messages: string[] = [];\n let current: unknown = err;\n const seen = new Set<unknown>();\n while (current && !seen.has(current)) {\n seen.add(current);\n if (current instanceof Error) {\n messages.push(current.message);\n current = (current as Error & { cause?: unknown }).cause;\n } else {\n messages.push(\n typeof current === \"string\" ? current : JSON.stringify(current),\n );\n break;\n }\n }\n return messages;\n}\n\nexport function isUnrecoverableDbError(err: unknown): boolean {\n const messages = collectMessages(err);\n return messages.some((msg) =>\n UNRECOVERABLE_DB_PATTERNS.some((re) => re.test(msg)),\n );\n}\n\nexport function printDbRecoveryHint(err: unknown): void {\n const messages = collectMessages(err);\n const offending = messages.find((msg) =>\n UNRECOVERABLE_DB_PATTERNS.some((re) => re.test(msg)),\n );\n console.error(\"\");\n console.error(\n yellow(bold(\"Switchboard hit an unrecoverable database error.\")),\n );\n if (offending) {\n console.error(yellow(` ${offending}`));\n }\n console.error(\"\");\n console.error(\n yellow(\"If this is a local PGlite store, you can reset it with:\"),\n );\n console.error(yellow(\" ph switchboard --reset\"));\n console.error(\n yellow(\n \"This is destructive: it wipes the local .ph/reactor-storage and .ph/read-storage directories.\",\n ),\n );\n console.error(\n yellow(\n \"For Postgres-backed deployments (PH_REACTOR_DATABASE_URL / DATABASE_URL), reset the database manually instead.\",\n ),\n );\n console.error(\"\");\n}\n","#!/usr/bin/env node\nimport {\n initCliTelemetry,\n type TelemetryClient,\n} from \"@powerhousedao/shared/clis/telemetry\";\nimport { assertNodeVersion } from \"@powerhousedao/shared/clis/utils\";\nimport { run } from \"cmd-ts\";\nimport { phCliHelp } from \"./commands/ph-cli-help.js\";\nimport { phCli } from \"./commands/ph-cli.js\";\nimport { getVersion } from \"./get-version.js\";\nimport {\n isUnrecoverableDbError,\n printDbRecoveryHint,\n} from \"./utils/db-error-hint.js\";\n\nlet sentryClient: TelemetryClient | undefined = undefined;\n\n// Commands whose second positional is itself a subcommand (vs. a project\n// name / file path). Keeping this explicit avoids high-cardinality tag\n// values like `subcommand:my-package` polluting Sentry.\nconst COMMANDS_WITH_SUBCOMMANDS = new Set([\"connect\", \"vetra\"]);\n\nfunction detectPackageManager(): string | undefined {\n // npm, pnpm, yarn and bun all set npm_config_user_agent like\n // \"pnpm/8.5.0 npm/? node/v20.11.1 darwin arm64\". When the user invokes\n // `ph` directly (not via dlx/exec) it's typically unset — skip the tag\n // in that case rather than mislabel.\n const ua = process.env.npm_config_user_agent;\n if (!ua) return undefined;\n return ua.split(\" \")[0]?.split(\"/\")[0] || undefined;\n}\n\nasync function main() {\n assertNodeVersion();\n // Initializes Sentry only if user consented (opt-out by default, asked\n // once on first interactive run). Respects PH_NO_TELEMETRY/DO_NOT_TRACK.\n sentryClient = await initCliTelemetry({\n cliName: \"ph-cli\",\n release: getVersion(),\n });\n const args = process.argv.slice(2);\n const command = args[0];\n const subcommand =\n command &&\n COMMANDS_WITH_SUBCOMMANDS.has(command) &&\n args[1] &&\n !args[1].startsWith(\"-\")\n ? args[1]\n : undefined;\n sentryClient?.attachInvocationContext({\n command,\n subcommand,\n pm: detectPackageManager(),\n argv: args,\n cwd: process.cwd(),\n });\n const hasNoArgs = args.length === 0;\n const isHelp = args.some((arg) => arg === \"--help\" || arg === \"-h\");\n const isTopLevelHelp = isHelp && args.length === 1;\n const showTopLevelHelp = hasNoArgs || isTopLevelHelp;\n const cli = showTopLevelHelp ? phCliHelp : phCli;\n const restArgs = args.slice(1);\n if (\n command === \"connect\" &&\n ![\"studio\", \"build\", \"preview\", \"config\"].includes(args[1]) &&\n !isHelp\n ) {\n const argsWithDefaultConnectSubCommand = [\"connect\", \"studio\", ...restArgs];\n await run(cli, argsWithDefaultConnectSubCommand);\n } else {\n await run(cli, args);\n }\n}\n\nawait main().catch(async (error) => {\n const isDebug = process.argv.slice(2).includes(\"--debug\");\n // Report to Sentry (no-op when telemetry disabled) before exiting.\n await sentryClient?.captureCliError(error);\n if (isDebug) {\n throw error;\n }\n if (error instanceof Error) {\n console.error(error.message);\n if (isUnrecoverableDbError(error)) {\n printDbRecoveryHint(error);\n }\n process.exit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AM,CAAC,CAAC,CAAC,SAAS,SAAS;CAExD,MAAM,cAAc,gBAAgB,KAAK;CACzC,IAAI,SACF,MAAM;CAER,IAAI,iBAAiB,OAAO;EAC1B,QAAQ,MAAM,MAAM,OAAO;EAC3B,IAAI,uBAAuB,KAAK,GAC9B,oBAAoB,KAAK;EAE3B,QAAQ,KAAK,CAAC;CAChB,OACE,MAAM;AAEV,CAAC","debug_id":"658f151e-b897-505c-bd5b-5a4d9dd1d324"}
@@ -1,11 +1,11 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="5a77c310-3860-5275-b99c-231487fb6bf6")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f49d0352-90e3-5961-b001-c9dfb74af954")}catch(e){}}();
3
3
  import { t as installAddedDependencies } from "./install-added-dependencies-DVSbzler.mjs";
4
4
  import { detectFeatures, generatePieceAction, syncFeatureDependencies } from "@powerhousedao/codegen";
5
5
  import { buildTsMorphProject } from "@powerhousedao/codegen/utils";
6
6
  //#region src/services/generate-piece-action.ts
7
7
  async function startGeneratePieceAction(args, projectDir) {
8
- const { namePositional, name: nameOption, piece, debug } = args;
8
+ const { namePositional, name: nameOption, piece, requireReactor, debug } = args;
9
9
  if (debug) console.log({ args });
10
10
  const actionName = namePositional ?? nameOption;
11
11
  if (!actionName) {
@@ -15,7 +15,8 @@ async function startGeneratePieceAction(args, projectDir) {
15
15
  const project = buildTsMorphProject(projectDir);
16
16
  await generatePieceAction({
17
17
  pieceDir: piece,
18
- actionName
18
+ actionName,
19
+ requireReactor
19
20
  }, project);
20
21
  await project.save();
21
22
  const added = await syncFeatureDependencies(detectFeatures(projectDir), projectDir);
@@ -24,5 +25,5 @@ async function startGeneratePieceAction(args, projectDir) {
24
25
  //#endregion
25
26
  export { startGeneratePieceAction };
26
27
 
27
- //# sourceMappingURL=generate-piece-action-C5WTHsqu.mjs.map
28
- //# debugId=5a77c310-3860-5275-b99c-231487fb6bf6
28
+ //# sourceMappingURL=generate-piece-action-DbxrzfKY.mjs.map
29
+ //# debugId=f49d0352-90e3-5961-b001-c9dfb74af954
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-piece-action-DbxrzfKY.mjs","sources":["../src/services/generate-piece-action.ts"],"sourcesContent":["import {\n detectFeatures,\n generatePieceAction,\n syncFeatureDependencies,\n} from \"@powerhousedao/codegen\";\nimport { buildTsMorphProject } from \"@powerhousedao/codegen/utils\";\nimport type { GeneratePieceActionArgs } from \"../types.js\";\nimport { installAddedDependencies } from \"../utils/install-added-dependencies.js\";\n\nexport async function startGeneratePieceAction(\n args: GeneratePieceActionArgs,\n projectDir: string,\n) {\n const {\n namePositional,\n name: nameOption,\n piece,\n requireReactor,\n debug,\n } = args;\n if (debug) {\n console.log({ args });\n }\n const actionName = namePositional ?? nameOption;\n if (!actionName) {\n console.log(\"Please specify the name of the action to generate.\");\n return;\n }\n const project = buildTsMorphProject(projectDir);\n await generatePieceAction(\n { pieceDir: piece, actionName, requireReactor },\n project,\n );\n await project.save();\n const added = await syncFeatureDependencies(\n detectFeatures(projectDir),\n projectDir,\n );\n await installAddedDependencies(added, projectDir, args.skipInstall);\n}\n"],"names":[],"mappings":";;;;;;AASA,eAAsB,yBACpB,MACA,YACA;CACA,MAAM,EACJ,gBACA,MAAM,YACN,OACA,gBACA,UACE;CACJ,IAAI,OACF,QAAQ,IAAI,EAAE,KAAK,CAAC;CAEtB,MAAM,aAAa,kBAAkB;CACrC,IAAI,CAAC,YAAY;EACf,QAAQ,IAAI,oDAAoD;EAChE;CACF;CACA,MAAM,UAAU,oBAAoB,UAAU;CAC9C,MAAM,oBACJ;EAAE,UAAU;EAAO;EAAY;CAAe,GAC9C,OACF;CACA,MAAM,QAAQ,KAAK;CACnB,MAAM,QAAQ,MAAM,wBAClB,eAAe,UAAU,GACzB,UACF;CACA,MAAM,yBAAyB,OAAO,YAAY,KAAK,WAAW;AACpE","debug_id":"f49d0352-90e3-5961-b001-c9dfb74af954"}
@@ -1,11 +1,11 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="8425cd42-69a1-5c64-a003-d5c5ed622abd")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="94b307ac-d424-5f25-b521-b085d75090f1")}catch(e){}}();
3
3
  import { t as installAddedDependencies } from "./install-added-dependencies-DVSbzler.mjs";
4
4
  import { detectFeatures, generatePieceTrigger, syncFeatureDependencies } from "@powerhousedao/codegen";
5
5
  import { buildTsMorphProject } from "@powerhousedao/codegen/utils";
6
6
  //#region src/services/generate-piece-trigger.ts
7
7
  async function startGeneratePieceTrigger(args, projectDir) {
8
- const { namePositional, name: nameOption, piece, strategy, debug } = args;
8
+ const { namePositional, name: nameOption, piece, strategy, requireReactor, debug } = args;
9
9
  if (debug) console.log({ args });
10
10
  const triggerName = namePositional ?? nameOption;
11
11
  if (!triggerName) {
@@ -16,7 +16,8 @@ async function startGeneratePieceTrigger(args, projectDir) {
16
16
  await generatePieceTrigger({
17
17
  pieceDir: piece,
18
18
  triggerName,
19
- strategy
19
+ strategy,
20
+ requireReactor
20
21
  }, project);
21
22
  await project.save();
22
23
  const added = await syncFeatureDependencies(detectFeatures(projectDir), projectDir);
@@ -25,5 +26,5 @@ async function startGeneratePieceTrigger(args, projectDir) {
25
26
  //#endregion
26
27
  export { startGeneratePieceTrigger };
27
28
 
28
- //# sourceMappingURL=generate-piece-trigger-DR10CPOG.mjs.map
29
- //# debugId=8425cd42-69a1-5c64-a003-d5c5ed622abd
29
+ //# sourceMappingURL=generate-piece-trigger-CqVOcL9g.mjs.map
30
+ //# debugId=94b307ac-d424-5f25-b521-b085d75090f1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-piece-trigger-CqVOcL9g.mjs","sources":["../src/services/generate-piece-trigger.ts"],"sourcesContent":["import {\n detectFeatures,\n generatePieceTrigger,\n syncFeatureDependencies,\n} from \"@powerhousedao/codegen\";\nimport { buildTsMorphProject } from \"@powerhousedao/codegen/utils\";\nimport type { GeneratePieceTriggerArgs } from \"../types.js\";\nimport { installAddedDependencies } from \"../utils/install-added-dependencies.js\";\n\nexport async function startGeneratePieceTrigger(\n args: GeneratePieceTriggerArgs,\n projectDir: string,\n) {\n const {\n namePositional,\n name: nameOption,\n piece,\n strategy,\n requireReactor,\n debug,\n } = args;\n if (debug) {\n console.log({ args });\n }\n const triggerName = namePositional ?? nameOption;\n if (!triggerName) {\n console.log(\"Please specify the name of the trigger to generate.\");\n return;\n }\n const project = buildTsMorphProject(projectDir);\n await generatePieceTrigger(\n { pieceDir: piece, triggerName, strategy, requireReactor },\n project,\n );\n await project.save();\n const added = await syncFeatureDependencies(\n detectFeatures(projectDir),\n projectDir,\n );\n await installAddedDependencies(added, projectDir, args.skipInstall);\n}\n"],"names":[],"mappings":";;;;;;AASA,eAAsB,0BACpB,MACA,YACA;CACA,MAAM,EACJ,gBACA,MAAM,YACN,OACA,UACA,gBACA,UACE;CACJ,IAAI,OACF,QAAQ,IAAI,EAAE,KAAK,CAAC;CAEtB,MAAM,cAAc,kBAAkB;CACtC,IAAI,CAAC,aAAa;EAChB,QAAQ,IAAI,qDAAqD;EACjE;CACF;CACA,MAAM,UAAU,oBAAoB,UAAU;CAC9C,MAAM,qBACJ;EAAE,UAAU;EAAO;EAAa;EAAU;CAAe,GACzD,OACF;CACA,MAAM,QAAQ,KAAK;CACnB,MAAM,QAAQ,MAAM,wBAClB,eAAe,UAAU,GACzB,UACF;CACA,MAAM,yBAAyB,OAAO,YAAY,KAAK,WAAW;AACpE","debug_id":"94b307ac-d424-5f25-b521-b085d75090f1"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerhousedao/ph-cli",
3
- "version": "6.2.3-dev.44",
3
+ "version": "6.2.3-dev.45",
4
4
  "description": "",
5
5
  "license": "AGPL-3.0-only",
6
6
  "type": "module",
@@ -23,15 +23,15 @@
23
23
  "keywords": [],
24
24
  "author": "",
25
25
  "dependencies": {
26
- "@powerhousedao/builder-tools": "6.2.3-dev.44",
27
- "@powerhousedao/codegen": "6.2.3-dev.44",
28
- "@powerhousedao/common": "6.2.3-dev.44",
29
- "@powerhousedao/config": "6.2.3-dev.44",
30
- "@powerhousedao/reactor": "6.2.3-dev.44",
31
- "@powerhousedao/shared": "6.2.3-dev.44",
32
- "@powerhousedao/switchboard": "6.2.3-dev.44",
33
- "@powerhousedao/vetra": "6.2.3-dev.44",
34
- "@renown/sdk": "6.2.3-dev.44",
26
+ "@powerhousedao/builder-tools": "6.2.3-dev.45",
27
+ "@powerhousedao/codegen": "6.2.3-dev.45",
28
+ "@powerhousedao/common": "6.2.3-dev.45",
29
+ "@powerhousedao/config": "6.2.3-dev.45",
30
+ "@powerhousedao/reactor": "6.2.3-dev.45",
31
+ "@powerhousedao/shared": "6.2.3-dev.45",
32
+ "@powerhousedao/switchboard": "6.2.3-dev.45",
33
+ "@powerhousedao/vetra": "6.2.3-dev.45",
34
+ "@renown/sdk": "6.2.3-dev.45",
35
35
  "@sentry/node-core": "^10.52.0",
36
36
  "@tsdown/css": "0.23.0",
37
37
  "ajv": "^8.18.0",
@@ -39,7 +39,7 @@
39
39
  "change-case": "5.4.4",
40
40
  "cmd-ts": "0.15.0",
41
41
  "colorette": "2.0.20",
42
- "document-model": "6.2.3-dev.44",
42
+ "document-model": "6.2.3-dev.45",
43
43
  "enquirer": "2.4.1",
44
44
  "kysely": "0.28.16",
45
45
  "package-manager-detector": "1.6.0",
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate-piece-action-C5WTHsqu.mjs","sources":["../src/services/generate-piece-action.ts"],"sourcesContent":["import {\n detectFeatures,\n generatePieceAction,\n syncFeatureDependencies,\n} from \"@powerhousedao/codegen\";\nimport { buildTsMorphProject } from \"@powerhousedao/codegen/utils\";\nimport type { GeneratePieceActionArgs } from \"../types.js\";\nimport { installAddedDependencies } from \"../utils/install-added-dependencies.js\";\n\nexport async function startGeneratePieceAction(\n args: GeneratePieceActionArgs,\n projectDir: string,\n) {\n const { namePositional, name: nameOption, piece, debug } = args;\n if (debug) {\n console.log({ args });\n }\n const actionName = namePositional ?? nameOption;\n if (!actionName) {\n console.log(\"Please specify the name of the action to generate.\");\n return;\n }\n const project = buildTsMorphProject(projectDir);\n await generatePieceAction({ pieceDir: piece, actionName }, project);\n await project.save();\n const added = await syncFeatureDependencies(\n detectFeatures(projectDir),\n projectDir,\n );\n await installAddedDependencies(added, projectDir, args.skipInstall);\n}\n"],"names":[],"mappings":";;;;;;AASA,eAAsB,yBACpB,MACA,YACA;CACA,MAAM,EAAE,gBAAgB,MAAM,YAAY,OAAO,UAAU;CAC3D,IAAI,OACF,QAAQ,IAAI,EAAE,KAAK,CAAC;CAEtB,MAAM,aAAa,kBAAkB;CACrC,IAAI,CAAC,YAAY;EACf,QAAQ,IAAI,oDAAoD;EAChE;CACF;CACA,MAAM,UAAU,oBAAoB,UAAU;CAC9C,MAAM,oBAAoB;EAAE,UAAU;EAAO;CAAW,GAAG,OAAO;CAClE,MAAM,QAAQ,KAAK;CACnB,MAAM,QAAQ,MAAM,wBAClB,eAAe,UAAU,GACzB,UACF;CACA,MAAM,yBAAyB,OAAO,YAAY,KAAK,WAAW;AACpE","debug_id":"5a77c310-3860-5275-b99c-231487fb6bf6"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate-piece-trigger-DR10CPOG.mjs","sources":["../src/services/generate-piece-trigger.ts"],"sourcesContent":["import {\n detectFeatures,\n generatePieceTrigger,\n syncFeatureDependencies,\n} from \"@powerhousedao/codegen\";\nimport { buildTsMorphProject } from \"@powerhousedao/codegen/utils\";\nimport type { GeneratePieceTriggerArgs } from \"../types.js\";\nimport { installAddedDependencies } from \"../utils/install-added-dependencies.js\";\n\nexport async function startGeneratePieceTrigger(\n args: GeneratePieceTriggerArgs,\n projectDir: string,\n) {\n const { namePositional, name: nameOption, piece, strategy, debug } = args;\n if (debug) {\n console.log({ args });\n }\n const triggerName = namePositional ?? nameOption;\n if (!triggerName) {\n console.log(\"Please specify the name of the trigger to generate.\");\n return;\n }\n const project = buildTsMorphProject(projectDir);\n await generatePieceTrigger(\n { pieceDir: piece, triggerName, strategy },\n project,\n );\n await project.save();\n const added = await syncFeatureDependencies(\n detectFeatures(projectDir),\n projectDir,\n );\n await installAddedDependencies(added, projectDir, args.skipInstall);\n}\n"],"names":[],"mappings":";;;;;;AASA,eAAsB,0BACpB,MACA,YACA;CACA,MAAM,EAAE,gBAAgB,MAAM,YAAY,OAAO,UAAU,UAAU;CACrE,IAAI,OACF,QAAQ,IAAI,EAAE,KAAK,CAAC;CAEtB,MAAM,cAAc,kBAAkB;CACtC,IAAI,CAAC,aAAa;EAChB,QAAQ,IAAI,qDAAqD;EACjE;CACF;CACA,MAAM,UAAU,oBAAoB,UAAU;CAC9C,MAAM,qBACJ;EAAE,UAAU;EAAO;EAAa;CAAS,GACzC,OACF;CACA,MAAM,QAAQ,KAAK;CACnB,MAAM,QAAQ,MAAM,wBAClB,eAAe,UAAU,GACzB,UACF;CACA,MAAM,yBAAyB,OAAO,YAAY,KAAK,WAAW;AACpE","debug_id":"8425cd42-69a1-5c64-a003-d5c5ed622abd"}