@powerhousedao/ph-cli 6.0.0-dev.223 → 6.0.0-dev.225

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
@@ -489,13 +489,13 @@ Resolution order for the registry URL:
489
489
  });
490
490
  //#endregion
491
491
  //#region src/commands/migrate.ts
492
- const migrate$1 = command({
492
+ const migrate = command({
493
493
  name: "migrate",
494
494
  args: migrateArgs,
495
495
  description: "Run migrations",
496
496
  handler: async (args) => {
497
497
  if (args.debug) console.log(args);
498
- const { startMigrate } = await import("./migrate-DLEG7ehb.mjs");
498
+ const { startMigrate } = await import("./migrate-CF93gbLw.mjs");
499
499
  await startMigrate(args);
500
500
  process.exit(0);
501
501
  }
@@ -870,7 +870,7 @@ This command:
870
870
  "registry-login": registryLogin,
871
871
  inspect,
872
872
  list,
873
- migrate: migrate$1,
873
+ migrate,
874
874
  switchboard,
875
875
  login,
876
876
  logout,
package/dist/cli.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.mjs","names":["version","build","migrate"],"sources":["../src/utils/constants.ts","../src/commands/ph-cli-help.ts","../src/commands/build.ts","../src/commands/code.ts","../src/commands/connect.ts","../src/commands/generate-all.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-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/migrate.ts","../src/services/registry-auth.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/cli.ts"],"sourcesContent":["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\";\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 { buildArgs } from \"@powerhousedao/shared/clis\";\nimport { command } from \"cmd-ts\";\nimport { runBuild } from \"../services/build.js\";\n\nexport const build = command({\n name: \"build\",\n args: buildArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n try {\n await runBuild(args);\n } catch (error) {\n console.error(error);\n process.exit(1);\n }\n },\n});\n","import { codeArgs } from \"@powerhousedao/shared/clis\";\nimport { command } from \"cmd-ts\";\n\nexport const code = command({\n name: \"code\",\n description: `\nOpen the Powerhouse coding agent — a REPL backed by Mastra that has every\ninstalled Powerhouse tool available as an agent tool.\n\nExamples:\n ph code Start the interactive REPL.\n ph code \"list my installed packs\" One-shot agent prompt.\n`,\n args: codeArgs,\n handler: async (args) => {\n const { buildPhCodeCli } = await import(\"../code/cli.js\");\n const cli = buildPhCodeCli();\n // ph-clint's cli.run consumes a full argv array (it slices off the first\n // two entries internally). Reconstruct that shape from the forwarded rest.\n // No args → drop into the interactive REPL by default.\n const forwarded = args.rest.length === 0 ? [\"-i\"] : args.rest;\n const argv = [\"node\", \"ph-code\", ...forwarded];\n await cli.run(argv);\n },\n});\n","import {\n connectBuildArgs,\n connectPreviewArgs,\n connectStudioArgs,\n} from \"@powerhousedao/shared/clis\";\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`,\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 connect = subcommands({\n name: \"connect\",\n description: `Powerhouse Connect commands. Use with \\`studio\\`, \\`build\\` or \\`preview\\`. Defaults to \\`studio\\` if not specified.`,\n cmds: {\n studio,\n build,\n preview,\n },\n});\n","import { command } from \"cmd-ts\";\n\nexport const generateAllCmd = command({\n name: \"all\",\n description: \"Re-generate all modules in the current project\",\n args: {},\n handler: async () => {\n const { startGenerateAll } = await import(\"../services/generate-all.js\");\n await startGenerateAll(process.cwd());\n process.exit(0);\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis\";\nimport {\n array,\n boolean,\n command,\n flag,\n multioption,\n option,\n optional,\n string,\n} from \"cmd-ts\";\nimport { Directory } from \"cmd-ts/dist/cjs/batteries/fs.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(array(string)),\n long: \"document-types\",\n short: \"t\",\n description: \"The document types allowed by the new app\",\n }),\n dir: option({\n type: optional(Directory),\n long: \"dir\",\n short: \"d\",\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 ...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\";\nimport { command, flag, option, optional } from \"cmd-ts\";\nimport { Directory, File } from \"cmd-ts/dist/cjs/batteries/fs.js\";\nexport const generateDocumentModelCmd = command({\n name: \"document-model\",\n aliases: [\"doc\"],\n description: \"Generate a document model\",\n args: {\n file: option({\n type: optional(File),\n long: \"file\",\n short: \"f\",\n description: \"Path to the file to generate the document model from\",\n }),\n dir: option({\n type: optional(Directory),\n long: \"dir\",\n short: \"d\",\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 ...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\";\nimport { command, flag, option, optional, string } from \"cmd-ts\";\nimport { Directory } from \"cmd-ts/dist/cjs/batteries/fs.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 dir: option({\n type: optional(Directory),\n long: \"dir\",\n short: \"d\",\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 ...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 { generateDBSchema } from \"@powerhousedao/codegen\";\nimport { debugArgs } from \"@powerhousedao/shared/clis\";\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 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\";\nimport { PROCESSOR_APPS } from \"@powerhousedao/shared/processors\";\nimport type { Type } from \"cmd-ts\";\nimport {\n array,\n command,\n flag,\n multioption,\n oneOf,\n option,\n optional,\n string,\n} from \"cmd-ts\";\nimport { Directory } from \"cmd-ts/dist/cjs/batteries/fs.js\";\n\nconst ProcessorAppType: Type<string[], (\"connect\" | \"switchboard\")[]> = {\n from(processorApps) {\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: array(string),\n long: \"document-types\",\n short: \"t\",\n description: \"The document types the processor will run on\",\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 dir: option({\n type: optional(Directory),\n long: \"dir\",\n short: \"d\",\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 ...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\";\nimport { command, flag, option, optional, string } from \"cmd-ts\";\nimport { Directory } from \"cmd-ts/dist/cjs/batteries/fs.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 dir: option({\n type: optional(Directory),\n long: \"dir\",\n short: \"d\",\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 ...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 { 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 \"migration-file\": generateMigrationFileCmd,\n },\n});\n","import { initArgs } from \"@powerhousedao/shared/clis\";\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\";\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 {\n getPowerhouseProjectInfo,\n installArgs,\n makeDependenciesWithVersions,\n} from \"@powerhousedao/shared/clis\";\nimport { resolveRegistryUrl } from \"@powerhousedao/shared/registry\";\nimport { execSync } from \"child_process\";\nimport { command } from \"cmd-ts\";\nimport { resolveCommand } from \"package-manager-detector\";\nimport { updateConfigFile, updateStylesFile } from \"../utils.js\";\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 {\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 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 resolved = resolveCommand(packageManager, \"add\", [\n ...specs,\n ...scopeRegistryArgs,\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 try {\n console.log(\"⚙️ Updating powerhouse config file...\");\n updateConfigFile(\n dependenciesWithVersions,\n projectPath,\n \"install\",\n args.local ? \"local\" : \"registry\",\n registryUrl,\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 { migrateArgs } from \"@powerhousedao/shared/clis\";\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 { generateAccessToken } from \"@renown/sdk/node\";\nimport { getRenown } from \"./auth.js\";\n\n/**\n * Mint a Renown bearer token bound to the given registry URL via the JWT\n * `aud` claim. Throws if the user is not authenticated (`ph login` first).\n *\n * The audience binding is what lets the registry distinguish a token minted\n * for it from one minted for a different service or registry.\n */\nexport async function mintRegistryAuthToken(\n registryUrl: string,\n expiresInSeconds: number,\n): Promise<string> {\n const renown = await getRenown();\n if (!renown.user) {\n throw new Error(\"Not authenticated with Renown. Run 'ph login' first.\");\n }\n const result = await generateAccessToken(renown, {\n expiresIn: expiresInSeconds,\n aud: registryUrl,\n });\n return result.token;\n}\n","import {\n getPowerhouseProjectInfo,\n publishArgs,\n} from \"@powerhousedao/shared/clis\";\nimport {\n checkNpmAuth,\n npmPublish,\n resolveRegistryUrl,\n} from \"@powerhousedao/shared/registry\";\nimport { command } from \"cmd-ts\";\nimport { readPackageSync } from \"read-pkg\";\nimport { prerelease } from \"semver\";\nimport { mintRegistryAuthToken } from \"../services/registry-auth.js\";\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\nfunction readPrereleaseTag(projectPath: string): {\n version: string;\n tag: string;\n} | null {\n try {\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 { projectPath } = await getPowerhouseProjectInfo();\n\n if (!projectPath) {\n throw new Error(\"Could not find project path.\");\n }\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 = 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 let confirmed = false;\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 {\n getPowerhouseProjectInfo,\n registryLoginArgs,\n} from \"@powerhousedao/shared/clis\";\nimport {\n resolveRegistryUrl,\n writeRegistryAuthToken,\n} from \"@powerhousedao/shared/registry\";\nimport { command } from \"cmd-ts\";\nimport { mintRegistryAuthToken } from \"../services/registry-auth.js\";\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.dev.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 projectInfo = await getPowerhouseProjectInfo().catch(() => null);\n const projectPath = projectInfo?.projectPath ?? process.cwd();\n\n const registryUrl = resolveRegistryUrl({\n registry: args.registry,\n projectPath,\n });\n\n const { parseExpiry, formatExpiry } = await import(\"@renown/sdk/node\");\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\";\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 } = args;\n if (basePath) {\n process.env.BASE_PATH = basePath;\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 {\n getPowerhouseProjectInfo,\n getPowerhouseProjectUninstallCommand,\n makeDependenciesWithVersions,\n uninstallArgs,\n} from \"@powerhousedao/shared/clis\";\nimport { execSync } from \"child_process\";\nimport { command } from \"cmd-ts\";\nimport { AGENTS } from \"package-manager-detector\";\nimport { removeStylesImports, updateConfigFile } from \"../utils.js\";\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 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 =\n await getPowerhouseProjectUninstallCommand(packageManager);\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 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 {\n getPowerhouseProjectInfo,\n unpublishArgs,\n} from \"@powerhousedao/shared/clis\";\nimport {\n checkNpmAuth,\n npmUnpublish,\n resolveRegistryUrl,\n} from \"@powerhousedao/shared/registry\";\nimport { command } from \"cmd-ts\";\nimport { createInterface } from \"node:readline/promises\";\nimport { readPackageSync } from \"read-pkg\";\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 { projectPath } = await getPowerhouseProjectInfo();\n\n if (!projectPath) {\n throw new Error(\"Could not find project path.\");\n }\n\n const registryUrl = resolveRegistryUrl({\n registry: args.registry,\n projectPath,\n });\n\n const spec = 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\nfunction resolveSpec(\n explicit: string | undefined,\n projectPath: string,\n): string | null {\n if (explicit) return explicit;\n try {\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\";\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 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 { code } from \"./code.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 code,\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","#!/usr/bin/env node\nimport {\n assertNodeVersion,\n captureCliError,\n initCliTelemetry,\n} from \"@powerhousedao/shared/clis\";\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\";\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 await initCliTelemetry({ cliName: \"ph-cli\", release: getVersion() });\n const args = process.argv.slice(2);\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 [command, ...restArgs] = args;\n if (\n command === \"connect\" &&\n ![\"studio\", \"build\", \"preview\"].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 captureCliError(error);\n if (isDebug) {\n throw error;\n }\n if (error instanceof Error) {\n console.error(error.message);\n process.exit(1);\n } else {\n throw error;\n }\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,MAAa,qBACX;ACKF,MAAa,YAAY,YAAY;CACnC,MAAM;CACN,aAAa;CACb,SAJc,YAAY;CAK1B,MAAM;CACP,CAAC;;;ACPF,MAAaC,UAAQ,QAAQ;CAC3B,MAAM;CACN,MAAM;CACN,SAAS,OAAO,SAAS;AACvB,MAAI,KAAK,MACP,SAAQ,IAAI,KAAK;AAEnB,MAAI;AACF,SAAM,SAAS,KAAK;WACb,OAAO;AACd,WAAQ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,YAAY,aACZ,CAAC;EAAC;EAAU;EAAS;EAAU,CAAC,SAAS,KAAK,GAAG,IACjD,CAAC,OAGD,OAAM,IAAI,KAD+B;EAAC;EAAW;EAAU,GAAG;EAAS,CAC3B;KAEhD,OAAM,IAAI,KAAK,KAAK;;AAIxB,MAAM,MAAM,CAAC,MAAM,OAAO,UAAU;CAClC,MAAM,UAAU,QAAQ,KAAK,MAAM,EAAE,CAAC,SAAS,UAAU;AAEzD,OAAM,gBAAgB,MAAM;AAC5B,KAAI,QACF,OAAM;AAER,KAAI,iBAAiB,OAAO;AAC1B,UAAQ,MAAM,MAAM,QAAQ;AAC5B,UAAQ,KAAK,EAAE;OAEf,OAAM;EAER"}
1
+ {"version":3,"file":"cli.mjs","names":["version","build"],"sources":["../src/utils/constants.ts","../src/commands/ph-cli-help.ts","../src/commands/build.ts","../src/commands/code.ts","../src/commands/connect.ts","../src/commands/generate-all.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-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/migrate.ts","../src/services/registry-auth.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/cli.ts"],"sourcesContent":["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\";\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 { buildArgs } from \"@powerhousedao/shared/clis\";\nimport { command } from \"cmd-ts\";\nimport { runBuild } from \"../services/build.js\";\n\nexport const build = command({\n name: \"build\",\n args: buildArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n try {\n await runBuild(args);\n } catch (error) {\n console.error(error);\n process.exit(1);\n }\n },\n});\n","import { codeArgs } from \"@powerhousedao/shared/clis\";\nimport { command } from \"cmd-ts\";\n\nexport const code = command({\n name: \"code\",\n description: `\nOpen the Powerhouse coding agent — a REPL backed by Mastra that has every\ninstalled Powerhouse tool available as an agent tool.\n\nExamples:\n ph code Start the interactive REPL.\n ph code \"list my installed packs\" One-shot agent prompt.\n`,\n args: codeArgs,\n handler: async (args) => {\n const { buildPhCodeCli } = await import(\"../code/cli.js\");\n const cli = buildPhCodeCli();\n // ph-clint's cli.run consumes a full argv array (it slices off the first\n // two entries internally). Reconstruct that shape from the forwarded rest.\n // No args → drop into the interactive REPL by default.\n const forwarded = args.rest.length === 0 ? [\"-i\"] : args.rest;\n const argv = [\"node\", \"ph-code\", ...forwarded];\n await cli.run(argv);\n },\n});\n","import {\n connectBuildArgs,\n connectPreviewArgs,\n connectStudioArgs,\n} from \"@powerhousedao/shared/clis\";\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`,\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 connect = subcommands({\n name: \"connect\",\n description: `Powerhouse Connect commands. Use with \\`studio\\`, \\`build\\` or \\`preview\\`. Defaults to \\`studio\\` if not specified.`,\n cmds: {\n studio,\n build,\n preview,\n },\n});\n","import { command } from \"cmd-ts\";\n\nexport const generateAllCmd = command({\n name: \"all\",\n description: \"Re-generate all modules in the current project\",\n args: {},\n handler: async () => {\n const { startGenerateAll } = await import(\"../services/generate-all.js\");\n await startGenerateAll(process.cwd());\n process.exit(0);\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis\";\nimport {\n array,\n boolean,\n command,\n flag,\n multioption,\n option,\n optional,\n string,\n} from \"cmd-ts\";\nimport { Directory } from \"cmd-ts/dist/cjs/batteries/fs.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(array(string)),\n long: \"document-types\",\n short: \"t\",\n description: \"The document types allowed by the new app\",\n }),\n dir: option({\n type: optional(Directory),\n long: \"dir\",\n short: \"d\",\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 ...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\";\nimport { command, flag, option, optional } from \"cmd-ts\";\nimport { Directory, File } from \"cmd-ts/dist/cjs/batteries/fs.js\";\nexport const generateDocumentModelCmd = command({\n name: \"document-model\",\n aliases: [\"doc\"],\n description: \"Generate a document model\",\n args: {\n file: option({\n type: optional(File),\n long: \"file\",\n short: \"f\",\n description: \"Path to the file to generate the document model from\",\n }),\n dir: option({\n type: optional(Directory),\n long: \"dir\",\n short: \"d\",\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 ...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\";\nimport { command, flag, option, optional, string } from \"cmd-ts\";\nimport { Directory } from \"cmd-ts/dist/cjs/batteries/fs.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 dir: option({\n type: optional(Directory),\n long: \"dir\",\n short: \"d\",\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 ...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 { generateDBSchema } from \"@powerhousedao/codegen\";\nimport { debugArgs } from \"@powerhousedao/shared/clis\";\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 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\";\nimport { PROCESSOR_APPS } from \"@powerhousedao/shared/processors\";\nimport type { Type } from \"cmd-ts\";\nimport {\n array,\n command,\n flag,\n multioption,\n oneOf,\n option,\n optional,\n string,\n} from \"cmd-ts\";\nimport { Directory } from \"cmd-ts/dist/cjs/batteries/fs.js\";\n\nconst ProcessorAppType: Type<string[], (\"connect\" | \"switchboard\")[]> = {\n from(processorApps) {\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: array(string),\n long: \"document-types\",\n short: \"t\",\n description: \"The document types the processor will run on\",\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 dir: option({\n type: optional(Directory),\n long: \"dir\",\n short: \"d\",\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 ...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\";\nimport { command, flag, option, optional, string } from \"cmd-ts\";\nimport { Directory } from \"cmd-ts/dist/cjs/batteries/fs.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 dir: option({\n type: optional(Directory),\n long: \"dir\",\n short: \"d\",\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 ...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 { 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 \"migration-file\": generateMigrationFileCmd,\n },\n});\n","import { initArgs } from \"@powerhousedao/shared/clis\";\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\";\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 {\n getPowerhouseProjectInfo,\n installArgs,\n makeDependenciesWithVersions,\n} from \"@powerhousedao/shared/clis\";\nimport { resolveRegistryUrl } from \"@powerhousedao/shared/registry\";\nimport { execSync } from \"child_process\";\nimport { command } from \"cmd-ts\";\nimport { resolveCommand } from \"package-manager-detector\";\nimport { updateConfigFile, updateStylesFile } from \"../utils.js\";\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 {\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 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 resolved = resolveCommand(packageManager, \"add\", [\n ...specs,\n ...scopeRegistryArgs,\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 try {\n console.log(\"⚙️ Updating powerhouse config file...\");\n updateConfigFile(\n dependenciesWithVersions,\n projectPath,\n \"install\",\n args.local ? \"local\" : \"registry\",\n registryUrl,\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 { migrateArgs } from \"@powerhousedao/shared/clis\";\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 { generateAccessToken } from \"@renown/sdk/node\";\nimport { getRenown } from \"./auth.js\";\n\n/**\n * Mint a Renown bearer token bound to the given registry URL via the JWT\n * `aud` claim. Throws if the user is not authenticated (`ph login` first).\n *\n * The audience binding is what lets the registry distinguish a token minted\n * for it from one minted for a different service or registry.\n */\nexport async function mintRegistryAuthToken(\n registryUrl: string,\n expiresInSeconds: number,\n): Promise<string> {\n const renown = await getRenown();\n if (!renown.user) {\n throw new Error(\"Not authenticated with Renown. Run 'ph login' first.\");\n }\n const result = await generateAccessToken(renown, {\n expiresIn: expiresInSeconds,\n aud: registryUrl,\n });\n return result.token;\n}\n","import {\n getPowerhouseProjectInfo,\n publishArgs,\n} from \"@powerhousedao/shared/clis\";\nimport {\n checkNpmAuth,\n npmPublish,\n resolveRegistryUrl,\n} from \"@powerhousedao/shared/registry\";\nimport { command } from \"cmd-ts\";\nimport { readPackageSync } from \"read-pkg\";\nimport { prerelease } from \"semver\";\nimport { mintRegistryAuthToken } from \"../services/registry-auth.js\";\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\nfunction readPrereleaseTag(projectPath: string): {\n version: string;\n tag: string;\n} | null {\n try {\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 { projectPath } = await getPowerhouseProjectInfo();\n\n if (!projectPath) {\n throw new Error(\"Could not find project path.\");\n }\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 = 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 let confirmed = false;\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 {\n getPowerhouseProjectInfo,\n registryLoginArgs,\n} from \"@powerhousedao/shared/clis\";\nimport {\n resolveRegistryUrl,\n writeRegistryAuthToken,\n} from \"@powerhousedao/shared/registry\";\nimport { command } from \"cmd-ts\";\nimport { mintRegistryAuthToken } from \"../services/registry-auth.js\";\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.dev.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 projectInfo = await getPowerhouseProjectInfo().catch(() => null);\n const projectPath = projectInfo?.projectPath ?? process.cwd();\n\n const registryUrl = resolveRegistryUrl({\n registry: args.registry,\n projectPath,\n });\n\n const { parseExpiry, formatExpiry } = await import(\"@renown/sdk/node\");\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\";\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 } = args;\n if (basePath) {\n process.env.BASE_PATH = basePath;\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 {\n getPowerhouseProjectInfo,\n getPowerhouseProjectUninstallCommand,\n makeDependenciesWithVersions,\n uninstallArgs,\n} from \"@powerhousedao/shared/clis\";\nimport { execSync } from \"child_process\";\nimport { command } from \"cmd-ts\";\nimport { AGENTS } from \"package-manager-detector\";\nimport { removeStylesImports, updateConfigFile } from \"../utils.js\";\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 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 =\n await getPowerhouseProjectUninstallCommand(packageManager);\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 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 {\n getPowerhouseProjectInfo,\n unpublishArgs,\n} from \"@powerhousedao/shared/clis\";\nimport {\n checkNpmAuth,\n npmUnpublish,\n resolveRegistryUrl,\n} from \"@powerhousedao/shared/registry\";\nimport { command } from \"cmd-ts\";\nimport { createInterface } from \"node:readline/promises\";\nimport { readPackageSync } from \"read-pkg\";\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 { projectPath } = await getPowerhouseProjectInfo();\n\n if (!projectPath) {\n throw new Error(\"Could not find project path.\");\n }\n\n const registryUrl = resolveRegistryUrl({\n registry: args.registry,\n projectPath,\n });\n\n const spec = 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\nfunction resolveSpec(\n explicit: string | undefined,\n projectPath: string,\n): string | null {\n if (explicit) return explicit;\n try {\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\";\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 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 { code } from \"./code.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 code,\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","#!/usr/bin/env node\nimport {\n assertNodeVersion,\n captureCliError,\n initCliTelemetry,\n} from \"@powerhousedao/shared/clis\";\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\";\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 await initCliTelemetry({ cliName: \"ph-cli\", release: getVersion() });\n const args = process.argv.slice(2);\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 [command, ...restArgs] = args;\n if (\n command === \"connect\" &&\n ![\"studio\", \"build\", \"preview\"].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 captureCliError(error);\n if (isDebug) {\n throw error;\n }\n if (error instanceof Error) {\n console.error(error.message);\n process.exit(1);\n } else {\n throw error;\n }\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,MAAa,qBACX;ACKF,MAAa,YAAY,YAAY;CACnC,MAAM;CACN,aAAa;CACb,SAJc,YAAY;CAK1B,MAAM;CACP,CAAC;;;ACPF,MAAaC,UAAQ,QAAQ;CAC3B,MAAM;CACN,MAAM;CACN,SAAS,OAAO,SAAS;AACvB,MAAI,KAAK,MACP,SAAQ,IAAI,KAAK;AAEnB,MAAI;AACF,SAAM,SAAS,KAAK;WACb,OAAO;AACd,WAAQ,MAAM,MAAM;AACpB,WAAQ,KAAK,EAAE;;;CAGpB,CAAC;;;ACfF,MAAa,OAAO,QAAQ;CAC1B,MAAM;CACN,aAAa;;;;;;;;CAQb,MAAM;CACN,SAAS,OAAO,SAAS;EACvB,MAAM,EAAE,mBAAmB,MAAM,OAAO;EACxC,MAAM,MAAM,gBAAg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AClC,MAAM,UAAU,QAAQ,KAAK,MAAM,EAAE,CAAC,SAAS,UAAU;AAEzD,OAAM,gBAAgB,MAAM;AAC5B,KAAI,QACF,OAAM;AAER,KAAI,iBAAiB,OAAO;AAC1B,UAAQ,MAAM,MAAM,QAAQ;AAC5B,UAAQ,KAAK,EAAE;OAEf,OAAM;EAER"}
@@ -0,0 +1,59 @@
1
+ import { fetchPackageVersionFromNpmRegistry } from "@powerhousedao/shared/clis";
2
+ import { execSync } from "node:child_process";
3
+ import { dirname, join } from "node:path";
4
+ import { detect, resolveCommand } from "package-manager-detector";
5
+ import { readFileSync } from "node:fs";
6
+ import { fileURLToPath } from "node:url";
7
+ //#region src/services/migrate.ts
8
+ function getBundledPhCliVersion() {
9
+ let dir = dirname(fileURLToPath(import.meta.url));
10
+ for (let i = 0; i < 5; i++) {
11
+ try {
12
+ const pkg = JSON.parse(readFileSync(join(dir, "package.json"), "utf8"));
13
+ if (pkg.name === "@powerhousedao/ph-cli") return pkg.version;
14
+ } catch {}
15
+ dir = dirname(dir);
16
+ }
17
+ }
18
+ async function startMigrate({ versionPositional, version, force, debug }) {
19
+ const requested = versionPositional ?? version;
20
+ if (debug) console.log(`[migrate] requested version: ${requested}`);
21
+ let targetVersion;
22
+ try {
23
+ targetVersion = await fetchPackageVersionFromNpmRegistry(`@powerhousedao/ph-cli@${requested}`);
24
+ } catch (error) {
25
+ const reason = error instanceof Error ? error.message : String(error);
26
+ if (!force) throw new Error(`Failed to resolve "${requested}" from the npm registry: ${reason}\nRe-run with --force to migrate using the installed version.`);
27
+ if (debug) console.log(`[migrate] failed to resolve target version, --force is set, falling back to bundled codegen: ${reason}`);
28
+ }
29
+ const bundledVersion = getBundledPhCliVersion();
30
+ if (debug) {
31
+ console.log(`[migrate] resolved target version: ${targetVersion ?? "(unknown)"}`);
32
+ console.log(`[migrate] current ph-cli version: ${bundledVersion ?? "(unknown)"}`);
33
+ }
34
+ if (!targetVersion || force || targetVersion === bundledVersion) {
35
+ if (debug) console.log(`[migrate] running migrate from bundled codegen`);
36
+ const { migrate } = await import("@powerhousedao/codegen");
37
+ await migrate(targetVersion ?? requested);
38
+ return;
39
+ }
40
+ const agent = (await detect())?.agent ?? "npm";
41
+ const resolved = resolveCommand(agent, "execute", [
42
+ `@powerhousedao/ph-cli@${targetVersion}`,
43
+ "migrate",
44
+ "--version",
45
+ targetVersion,
46
+ ...debug ? ["--debug"] : []
47
+ ]);
48
+ if (!resolved) throw new Error(`Failed to resolve execute command for package manager "${agent}".`);
49
+ const command = `${resolved.command} ${resolved.args.join(" ")}`;
50
+ if (debug) {
51
+ console.log(`[migrate] detected package manager: ${agent}`);
52
+ console.log(`[migrate] re-executing: ${command}`);
53
+ }
54
+ execSync(command, { stdio: "inherit" });
55
+ }
56
+ //#endregion
57
+ export { startMigrate };
58
+
59
+ //# sourceMappingURL=migrate-CF93gbLw.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrate-CF93gbLw.mjs","names":[],"sources":["../src/services/migrate.ts"],"sourcesContent":["import { fetchPackageVersionFromNpmRegistry } from \"@powerhousedao/shared/clis\";\nimport { execSync } from \"node:child_process\";\nimport { readFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { detect, resolveCommand } from \"package-manager-detector\";\nimport type { MigrateArgs } from \"../types.js\";\n\nfunction getBundledPhCliVersion(): string | undefined {\n let dir = dirname(fileURLToPath(import.meta.url));\n for (let i = 0; i < 5; i++) {\n try {\n const pkg = JSON.parse(\n readFileSync(join(dir, \"package.json\"), \"utf8\"),\n ) as { name?: string; version?: string };\n if (pkg.name === \"@powerhousedao/ph-cli\") return pkg.version;\n } catch {\n // keep walking\n }\n dir = dirname(dir);\n }\n}\n\nexport async function startMigrate({\n versionPositional,\n version,\n force,\n debug,\n}: MigrateArgs) {\n const requested = versionPositional ?? version;\n if (debug) console.log(`[migrate] requested version: ${requested}`);\n\n let targetVersion: string | undefined;\n try {\n targetVersion = await fetchPackageVersionFromNpmRegistry(\n `@powerhousedao/ph-cli@${requested}`,\n );\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n if (!force) {\n throw new Error(\n `Failed to resolve \"${requested}\" from the npm registry: ${reason}\\nRe-run with --force to migrate using the installed version.`,\n );\n }\n if (debug) {\n console.log(\n `[migrate] failed to resolve target version, --force is set, falling back to bundled codegen: ${reason}`,\n );\n }\n }\n\n const bundledVersion = getBundledPhCliVersion();\n if (debug) {\n console.log(\n `[migrate] resolved target version: ${targetVersion ?? \"(unknown)\"}`,\n );\n console.log(\n `[migrate] current ph-cli version: ${bundledVersion ?? \"(unknown)\"}`,\n );\n }\n\n if (!targetVersion || force || targetVersion === bundledVersion) {\n if (debug) console.log(`[migrate] running migrate from bundled codegen`);\n const { migrate } = await import(\"@powerhousedao/codegen\");\n await migrate(targetVersion ?? requested);\n return;\n }\n\n const agent = (await detect())?.agent ?? \"npm\";\n const resolved = resolveCommand(agent, \"execute\", [\n `@powerhousedao/ph-cli@${targetVersion}`,\n \"migrate\",\n \"--version\",\n targetVersion,\n ...(debug ? [\"--debug\"] : []),\n ]);\n if (!resolved) {\n throw new Error(\n `Failed to resolve execute command for package manager \"${agent}\".`,\n );\n }\n\n const command = `${resolved.command} ${resolved.args.join(\" \")}`;\n if (debug) {\n console.log(`[migrate] detected package manager: ${agent}`);\n console.log(`[migrate] re-executing: ${command}`);\n }\n execSync(command, { stdio: \"inherit\" });\n}\n"],"mappings":";;;;;;;AAQA,SAAS,yBAA6C;CACpD,IAAI,MAAM,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;AACjD,MAAK,IAAI,IAAI,GAAG,IAAI,GAAG,KAAK;AAC1B,MAAI;GACF,MAAM,MAAM,KAAK,MACf,aAAa,KAAK,KAAK,eAAe,EAAE,OAAO,CAChD;AACD,OAAI,IAAI,SAAS,wBAAyB,QAAO,IAAI;UAC/C;AAGR,QAAM,QAAQ,IAAI;;;AAItB,eAAsB,aAAa,EACjC,mBACA,SACA,OACA,SACc;CACd,MAAM,YAAY,qBAAqB;AACvC,KAAI,MAAO,SAAQ,IAAI,gCAAgC,YAAY;CAEnE,IAAI;AACJ,KAAI;AACF,kBAAgB,MAAM,mCACpB,yBAAyB,YAC1B;UACM,OAAO;EACd,MAAM,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;AACrE,MAAI,CAAC,MACH,OAAM,IAAI,MACR,sBAAsB,UAAU,2BAA2B,OAAO,+DACnE;AAEH,MAAI,MACF,SAAQ,IACN,gGAAgG,SACjG;;CAIL,MAAM,iBAAiB,wBAAwB;AAC/C,KAAI,OAAO;AACT,UAAQ,IACN,sCAAsC,iBAAiB,cACxD;AACD,UAAQ,IACN,qCAAqC,kBAAkB,cACxD;;AAGH,KAAI,CAAC,iBAAiB,SAAS,kBAAkB,gBAAgB;AAC/D,MAAI,MAAO,SAAQ,IAAI,iDAAiD;EACxE,MAAM,EAAE,YAAY,MAAM,OAAO;AACjC,QAAM,QAAQ,iBAAiB,UAAU;AACzC;;CAGF,MAAM,SAAS,MAAM,QAAQ,GAAG,SAAS;CACzC,MAAM,WAAW,eAAe,OAAO,WAAW;EAChD,yBAAyB;EACzB;EACA;EACA;EACA,GAAI,QAAQ,CAAC,UAAU,GAAG,EAAE;EAC7B,CAAC;AACF,KAAI,CAAC,SACH,OAAM,IAAI,MACR,0DAA0D,MAAM,IACjE;CAGH,MAAM,UAAU,GAAG,SAAS,QAAQ,GAAG,SAAS,KAAK,KAAK,IAAI;AAC9D,KAAI,OAAO;AACT,UAAQ,IAAI,uCAAuC,QAAQ;AAC3D,UAAQ,IAAI,2BAA2B,UAAU;;AAEnD,UAAS,SAAS,EAAE,OAAO,WAAW,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerhousedao/ph-cli",
3
- "version": "6.0.0-dev.223",
3
+ "version": "6.0.0-dev.225",
4
4
  "description": "",
5
5
  "license": "AGPL-3.0-only",
6
6
  "type": "module",
@@ -43,15 +43,15 @@
43
43
  "vite": "8.0.8",
44
44
  "write-package": "7.2.0",
45
45
  "zod": "4.3.6",
46
- "@powerhousedao/builder-tools": "6.0.0-dev.223",
47
- "@powerhousedao/codegen": "6.0.0-dev.223",
48
- "@powerhousedao/config": "6.0.0-dev.223",
49
- "@powerhousedao/common": "6.0.0-dev.223",
50
- "@powerhousedao/reactor": "6.0.0-dev.223",
51
- "@powerhousedao/shared": "6.0.0-dev.223",
52
- "@powerhousedao/switchboard": "6.0.0-dev.223",
53
- "document-model": "6.0.0-dev.223",
54
- "@renown/sdk": "6.0.0-dev.223"
46
+ "@powerhousedao/builder-tools": "6.0.0-dev.225",
47
+ "@powerhousedao/common": "6.0.0-dev.225",
48
+ "@powerhousedao/config": "6.0.0-dev.225",
49
+ "@powerhousedao/codegen": "6.0.0-dev.225",
50
+ "@powerhousedao/reactor": "6.0.0-dev.225",
51
+ "@powerhousedao/shared": "6.0.0-dev.225",
52
+ "@powerhousedao/switchboard": "6.0.0-dev.225",
53
+ "document-model": "6.0.0-dev.225",
54
+ "@renown/sdk": "6.0.0-dev.225"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@types/node": "25.2.3",
@@ -1,11 +0,0 @@
1
- import { migrate } from "@powerhousedao/codegen";
2
- //#region src/services/migrate.ts
3
- async function startMigrate(args) {
4
- const { version, debug } = args;
5
- if (debug) console.log({ args });
6
- await migrate(version);
7
- }
8
- //#endregion
9
- export { startMigrate };
10
-
11
- //# sourceMappingURL=migrate-DLEG7ehb.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"migrate-DLEG7ehb.mjs","names":[],"sources":["../src/services/migrate.ts"],"sourcesContent":["import { migrate } from \"@powerhousedao/codegen\";\nimport type { MigrateArgs } from \"../types.js\";\n\nexport async function startMigrate(args: MigrateArgs) {\n const { version, debug } = args;\n if (debug) {\n console.log({ args });\n }\n await migrate(version);\n}\n"],"mappings":";;AAGA,eAAsB,aAAa,MAAmB;CACpD,MAAM,EAAE,SAAS,UAAU;AAC3B,KAAI,MACF,SAAQ,IAAI,EAAE,MAAM,CAAC;AAEvB,OAAM,QAAQ,QAAQ"}