@powerhousedao/ph-cli 6.0.0-dev.227 → 6.0.0-dev.229

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/{auth-DFjfbgA-.mjs → auth-Ch5B5mNU.mjs} +1 -1
  2. package/dist/{auth-DFjfbgA-.mjs.map → auth-Ch5B5mNU.mjs.map} +1 -1
  3. package/dist/auth-Dq7JjwYn.mjs +2 -0
  4. package/dist/build-CWcQj0YI.mjs +2 -0
  5. package/dist/{build-DIv8xMX2.mjs → build-DCXpFtjA.mjs} +2 -2
  6. package/dist/{build-DIv8xMX2.mjs.map → build-DCXpFtjA.mjs.map} +1 -1
  7. package/dist/{cli-CFWMyGVU.mjs → cli-DXcScG24.mjs} +2 -2
  8. package/dist/{cli-CFWMyGVU.mjs.map → cli-DXcScG24.mjs.map} +1 -1
  9. package/dist/cli.mjs +39 -42
  10. package/dist/cli.mjs.map +1 -1
  11. package/dist/{connect-build-BXuIuTCu.mjs → connect-build-6yhCIKkQ.mjs} +3 -3
  12. package/dist/{connect-build-BXuIuTCu.mjs.map → connect-build-6yhCIKkQ.mjs.map} +1 -1
  13. package/dist/{init-BgKiiFju.mjs → init-8FtJDKxG.mjs} +4 -3
  14. package/dist/init-8FtJDKxG.mjs.map +1 -0
  15. package/dist/{inspect-czss6pZb.mjs → inspect-BwkihsT7.mjs} +2 -2
  16. package/dist/{inspect-czss6pZb.mjs.map → inspect-BwkihsT7.mjs.map} +1 -1
  17. package/dist/{logout-DcpByE5i.mjs → logout-DlNBdA8_.mjs} +10 -8
  18. package/dist/logout-DlNBdA8_.mjs.map +1 -0
  19. package/dist/{migrate-CF93gbLw.mjs → migrate-B-O6P7jA.mjs} +2 -2
  20. package/dist/{migrate-CF93gbLw.mjs.map → migrate-B-O6P7jA.mjs.map} +1 -1
  21. package/dist/registry-auth-BX9_n8hE.mjs +22 -0
  22. package/dist/registry-auth-BX9_n8hE.mjs.map +1 -0
  23. package/dist/scripts/setup.sh +2 -2
  24. package/dist/{switchboard-DGbd-EPx.mjs → switchboard-CJMoMzWx.mjs} +1 -1
  25. package/dist/{switchboard-DGbd-EPx.mjs.map → switchboard-CJMoMzWx.mjs.map} +1 -1
  26. package/dist/switchboard-iRFugh8I.mjs +2 -0
  27. package/dist/{switchboard-migrate-81jhmuWu.mjs → switchboard-migrate-BRgCgg7N.mjs} +1 -1
  28. package/dist/{switchboard-migrate-81jhmuWu.mjs.map → switchboard-migrate-BRgCgg7N.mjs.map} +1 -1
  29. package/dist/{utils-C6_gv4nB.mjs → utils-D7x443W6.mjs} +3 -3
  30. package/dist/{utils-C6_gv4nB.mjs.map → utils-D7x443W6.mjs.map} +1 -1
  31. package/dist/utils-DkOZWO0i.mjs +2 -0
  32. package/dist/{vetra--a0x272X.mjs → vetra-xk2hwf6X.mjs} +3 -3
  33. package/dist/{vetra--a0x272X.mjs.map → vetra-xk2hwf6X.mjs.map} +1 -1
  34. package/package.json +10 -10
  35. package/dist/auth-BtzNlVSv.mjs +0 -2
  36. package/dist/init-BgKiiFju.mjs.map +0 -1
  37. package/dist/logout-DcpByE5i.mjs.map +0 -1
  38. package/dist/switchboard-2B5VC_cr.mjs +0 -2
@@ -12,4 +12,4 @@ async function getRenown(baseUrl) {
12
12
  //#endregion
13
13
  export { getRenown as t };
14
14
 
15
- //# sourceMappingURL=auth-DFjfbgA-.mjs.map
15
+ //# sourceMappingURL=auth-Ch5B5mNU.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth-DFjfbgA-.mjs","names":[],"sources":["../src/services/auth.ts"],"sourcesContent":["import { RenownBuilder, type IRenown } from \"@renown/sdk/node\";\n\n// Singleton instance of Renown\nlet renownInstance: IRenown | null = null;\n\n/**\n * Get or create the Renown instance\n * Uses PH_RENOWN_PRIVATE_KEY env var if set, otherwise generates/loads from file\n */\nexport async function getRenown(baseUrl?: string): Promise<IRenown> {\n if (!renownInstance) {\n renownInstance = await new RenownBuilder(\"ph-cli\", { baseUrl }).build();\n }\n return renownInstance;\n}\n"],"mappings":";;AAGA,IAAI,iBAAiC;;;;;AAMrC,eAAsB,UAAU,SAAoC;AAClE,KAAI,CAAC,eACH,kBAAiB,MAAM,IAAI,cAAc,UAAU,EAAE,SAAS,CAAC,CAAC,OAAO;AAEzE,QAAO"}
1
+ {"version":3,"file":"auth-Ch5B5mNU.mjs","names":[],"sources":["../src/services/auth.ts"],"sourcesContent":["import { RenownBuilder, type IRenown } from \"@renown/sdk/node\";\n\n// Singleton instance of Renown\nlet renownInstance: IRenown | null = null;\n\n/**\n * Get or create the Renown instance\n * Uses PH_RENOWN_PRIVATE_KEY env var if set, otherwise generates/loads from file\n */\nexport async function getRenown(baseUrl?: string): Promise<IRenown> {\n if (!renownInstance) {\n renownInstance = await new RenownBuilder(\"ph-cli\", { baseUrl }).build();\n }\n return renownInstance;\n}\n"],"mappings":";;AAGA,IAAI,iBAAiC;;;;;AAMrC,eAAsB,UAAU,SAAoC;AAClE,KAAI,CAAC,eACH,kBAAiB,MAAM,IAAI,cAAc,UAAU,EAAE,SAAS,CAAC,CAAC,OAAO;AAEzE,QAAO"}
@@ -0,0 +1,2 @@
1
+ import { t as getRenown } from "./auth-Ch5B5mNU.mjs";
2
+ export { getRenown };
@@ -0,0 +1,2 @@
1
+ import { t as runBuild } from "./build-DCXpFtjA.mjs";
2
+ export { runBuild };
@@ -1,5 +1,5 @@
1
- import { browserBuildConfig, nodeBuildConfig } from "@powerhousedao/shared/clis";
2
1
  import { execSync } from "node:child_process";
2
+ import { browserBuildConfig, nodeBuildConfig } from "@powerhousedao/shared/clis";
3
3
  import { join } from "node:path";
4
4
  import { detect, resolveCommand } from "package-manager-detector";
5
5
  import { build } from "tsdown";
@@ -43,4 +43,4 @@ async function runBuild(args) {
43
43
  //#endregion
44
44
  export { runBuild as t };
45
45
 
46
- //# sourceMappingURL=build-DIv8xMX2.mjs.map
46
+ //# sourceMappingURL=build-DCXpFtjA.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"build-DIv8xMX2.mjs","names":["tsdownBuild"],"sources":["../src/services/build.ts"],"sourcesContent":["import {\n browserBuildConfig,\n nodeBuildConfig,\n} from \"@powerhousedao/shared/clis\";\nimport { execSync } from \"node:child_process\";\nimport { join } from \"node:path\";\nimport { detect, resolveCommand } from \"package-manager-detector\";\nimport { build as tsdownBuild } from \"tsdown\";\nimport type { BuildArgs } from \"../types.js\";\n\nexport async function runBuild(args: BuildArgs) {\n const { outDir } = args;\n\n await tsdownBuild({\n ...browserBuildConfig,\n outDir: join(outDir, \"browser\"),\n });\n\n await tsdownBuild({\n ...nodeBuildConfig,\n outDir: join(outDir, \"node\"),\n });\n\n const detectResult = await detect();\n const agent = detectResult?.agent ?? \"npm\";\n\n // Emit types with tsc\n const tscCommand = resolveCommand(agent, \"execute-local\", [\"tsc\"]);\n if (tscCommand === null) {\n console.error(\n \"You need to have typescript installed to use the `build` command.\",\n );\n process.exit(1);\n }\n console.log(\"\\n▶ Emitting types via tsc...\");\n try {\n execSync(`${tscCommand.command} ${tscCommand.args.join(\" \")}`, {\n stdio: \"inherit\",\n });\n console.log(\"✔ Types emitted to\", join(outDir, \"types\"));\n } catch {\n console.warn(\n \"✘ tsc reported errors above; declarations were still written. Fix the errors to keep types accurate.\",\n );\n }\n\n const executeLocalCommand = resolveCommand(agent, \"execute-local\", [\n \"tailwindcss\",\n \"-i\",\n \"./style.css\",\n \"-o\",\n \"./dist/style.css\",\n ]);\n if (executeLocalCommand === null) {\n console.error(\n \"You need to have tailwindcss installed to use the `build` command.\",\n );\n process.exit(1);\n }\n execSync(\n `${executeLocalCommand.command} ${executeLocalCommand.args.join(\" \")}`,\n );\n}\n"],"mappings":";;;;;;AAUA,eAAsB,SAAS,MAAiB;CAC9C,MAAM,EAAE,WAAW;AAEnB,OAAMA,MAAY;EAChB,GAAG;EACH,QAAQ,KAAK,QAAQ,UAAU;EAChC,CAAC;AAEF,OAAMA,MAAY;EAChB,GAAG;EACH,QAAQ,KAAK,QAAQ,OAAO;EAC7B,CAAC;CAGF,MAAM,SADe,MAAM,QAAQ,GACP,SAAS;CAGrC,MAAM,aAAa,eAAe,OAAO,iBAAiB,CAAC,MAAM,CAAC;AAClE,KAAI,eAAe,MAAM;AACvB,UAAQ,MACN,oEACD;AACD,UAAQ,KAAK,EAAE;;AAEjB,SAAQ,IAAI,gCAAgC;AAC5C,KAAI;AACF,WAAS,GAAG,WAAW,QAAQ,GAAG,WAAW,KAAK,KAAK,IAAI,IAAI,EAC7D,OAAO,WACR,CAAC;AACF,UAAQ,IAAI,sBAAsB,KAAK,QAAQ,QAAQ,CAAC;SAClD;AACN,UAAQ,KACN,uGACD;;CAGH,MAAM,sBAAsB,eAAe,OAAO,iBAAiB;EACjE;EACA;EACA;EACA;EACA;EACD,CAAC;AACF,KAAI,wBAAwB,MAAM;AAChC,UAAQ,MACN,qEACD;AACD,UAAQ,KAAK,EAAE;;AAEjB,UACE,GAAG,oBAAoB,QAAQ,GAAG,oBAAoB,KAAK,KAAK,IAAI,GACrE"}
1
+ {"version":3,"file":"build-DCXpFtjA.mjs","names":["tsdownBuild"],"sources":["../src/services/build.ts"],"sourcesContent":["import {\n browserBuildConfig,\n nodeBuildConfig,\n} from \"@powerhousedao/shared/clis\";\nimport { execSync } from \"node:child_process\";\nimport { join } from \"node:path\";\nimport { detect, resolveCommand } from \"package-manager-detector\";\nimport { build as tsdownBuild } from \"tsdown\";\nimport type { BuildArgs } from \"../types.js\";\n\nexport async function runBuild(args: BuildArgs) {\n const { outDir } = args;\n\n await tsdownBuild({\n ...browserBuildConfig,\n outDir: join(outDir, \"browser\"),\n });\n\n await tsdownBuild({\n ...nodeBuildConfig,\n outDir: join(outDir, \"node\"),\n });\n\n const detectResult = await detect();\n const agent = detectResult?.agent ?? \"npm\";\n\n // Emit types with tsc\n const tscCommand = resolveCommand(agent, \"execute-local\", [\"tsc\"]);\n if (tscCommand === null) {\n console.error(\n \"You need to have typescript installed to use the `build` command.\",\n );\n process.exit(1);\n }\n console.log(\"\\n▶ Emitting types via tsc...\");\n try {\n execSync(`${tscCommand.command} ${tscCommand.args.join(\" \")}`, {\n stdio: \"inherit\",\n });\n console.log(\"✔ Types emitted to\", join(outDir, \"types\"));\n } catch {\n console.warn(\n \"✘ tsc reported errors above; declarations were still written. Fix the errors to keep types accurate.\",\n );\n }\n\n const executeLocalCommand = resolveCommand(agent, \"execute-local\", [\n \"tailwindcss\",\n \"-i\",\n \"./style.css\",\n \"-o\",\n \"./dist/style.css\",\n ]);\n if (executeLocalCommand === null) {\n console.error(\n \"You need to have tailwindcss installed to use the `build` command.\",\n );\n process.exit(1);\n }\n execSync(\n `${executeLocalCommand.command} ${executeLocalCommand.args.join(\" \")}`,\n );\n}\n"],"mappings":";;;;;;AAUA,eAAsB,SAAS,MAAiB;CAC9C,MAAM,EAAE,WAAW;AAEnB,OAAMA,MAAY;EAChB,GAAG;EACH,QAAQ,KAAK,QAAQ,UAAU;EAChC,CAAC;AAEF,OAAMA,MAAY;EAChB,GAAG;EACH,QAAQ,KAAK,QAAQ,OAAO;EAC7B,CAAC;CAGF,MAAM,SADe,MAAM,QAAQ,GACP,SAAS;CAGrC,MAAM,aAAa,eAAe,OAAO,iBAAiB,CAAC,MAAM,CAAC;AAClE,KAAI,eAAe,MAAM;AACvB,UAAQ,MACN,oEACD;AACD,UAAQ,KAAK,EAAE;;AAEjB,SAAQ,IAAI,gCAAgC;AAC5C,KAAI;AACF,WAAS,GAAG,WAAW,QAAQ,GAAG,WAAW,KAAK,KAAK,IAAI,IAAI,EAC7D,OAAO,WACR,CAAC;AACF,UAAQ,IAAI,sBAAsB,KAAK,QAAQ,QAAQ,CAAC;SAClD;AACN,UAAQ,KACN,uGACD;;CAGH,MAAM,sBAAsB,eAAe,OAAO,iBAAiB;EACjE;EACA;EACA;EACA;EACA;EACD,CAAC;AACF,KAAI,wBAAwB,MAAM;AAChC,UAAQ,MACN,qEACD;AACD,UAAQ,KAAK,EAAE;;AAEjB,UACE,GAAG,oBAAoB,QAAQ,GAAG,oBAAoB,KAAK,KAAK,IAAI,GACrE"}
@@ -1,4 +1,4 @@
1
- import { a as getVersion, i as accessToken, r as list, t as logout } from "./logout-DcpByE5i.mjs";
1
+ import { a as getVersion, i as accessToken, r as list, t as logout } from "./logout-DlNBdA8_.mjs";
2
2
  import { z } from "zod";
3
3
  import { defineCli, defineCommand } from "@powerhousedao/ph-clint";
4
4
  //#region src/code/adapter.ts
@@ -137,4 +137,4 @@ function buildPhCodeCli() {
137
137
  //#endregion
138
138
  export { buildPhCodeCli };
139
139
 
140
- //# sourceMappingURL=cli-CFWMyGVU.mjs.map
140
+ //# sourceMappingURL=cli-DXcScG24.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli-CFWMyGVU.mjs","names":["listCmd","logoutCmd","accessTokenCmd"],"sources":["../src/code/adapter.ts","../src/code/commands.ts","../src/code/agent.ts","../src/code/cli.ts"],"sourcesContent":["import type { z } from \"zod\";\nimport { defineCommand } from \"@powerhousedao/ph-clint\";\nimport type { Command } from \"@powerhousedao/ph-clint\";\n\nclass ExitSignal extends Error {\n constructor(public code: number) {\n super(`process.exit(${code}) intercepted`);\n }\n}\n\nexport interface AdaptOptions<TSchema extends z.ZodType> {\n id: string;\n description: string;\n inputSchema: TSchema;\n invoke: (input: z.output<TSchema>) => Promise<void>;\n}\n\nexport function adaptCmdTs<TSchema extends z.ZodType>(\n opts: AdaptOptions<TSchema>,\n): Command<TSchema> {\n return defineCommand({\n id: opts.id,\n description: opts.description.trim(),\n inputSchema: opts.inputSchema,\n execute: async (input, ctx) => {\n const buf: string[] = [];\n const origLog = console.log;\n const origErr = console.error;\n // eslint-disable-next-line @typescript-eslint/unbound-method -- intercepting process.exit on purpose\n const origExit = process.exit;\n const origNonInteractive = process.env.PH_NONINTERACTIVE;\n\n const capture = (args: unknown[]) => {\n const line = args\n .map((a) => (typeof a === \"string\" ? a : safeStringify(a)))\n .join(\" \");\n buf.push(line);\n ctx.stdout(line + \"\\n\");\n };\n\n console.log = (...a: unknown[]) => capture(a);\n console.error = (...a: unknown[]) => capture(a);\n // Intercept process.exit so the agent REPL doesn't die.\n (process as unknown as { exit: (code?: number) => never }).exit = (\n code = 0,\n ) => {\n throw new ExitSignal(code);\n };\n process.env.PH_NONINTERACTIVE = \"1\";\n\n try {\n await opts.invoke(input);\n } catch (e) {\n if (e instanceof ExitSignal) {\n if (e.code !== 0) {\n buf.push(`(command exited with code ${e.code})`);\n }\n } else {\n throw e;\n }\n } finally {\n console.log = origLog;\n console.error = origErr;\n (process as unknown as { exit: typeof origExit }).exit = origExit;\n if (origNonInteractive === undefined) {\n delete process.env.PH_NONINTERACTIVE;\n } else {\n process.env.PH_NONINTERACTIVE = origNonInteractive;\n }\n }\n\n return buf.join(\"\\n\");\n },\n });\n}\n\nfunction safeStringify(value: unknown): string {\n try {\n return JSON.stringify(value);\n } catch {\n return String(value);\n }\n}\n","import { z } from \"zod\";\nimport { adaptCmdTs } from \"./adapter.js\";\nimport { list as listCmd } from \"../commands/list.js\";\nimport { logout as logoutCmd } from \"../commands/logout.js\";\nimport { accessToken as accessTokenCmd } from \"../commands/access-token.js\";\n\nconst debugSchema = { debug: z.boolean().optional() };\n\nexport const listAdapted = adaptCmdTs({\n id: \"list\",\n description:\n \"List installed Powerhouse packages from powerhouse.config.json.\",\n inputSchema: z.object({ ...debugSchema }),\n invoke: (input) => listCmd.handler(input as never),\n});\n\nexport const logoutAdapted = adaptCmdTs({\n id: \"logout\",\n description: \"Remove the local Renown session created with `ph login`.\",\n inputSchema: z.object({}),\n invoke: () => logoutCmd.handler({} as never),\n});\n\nexport const accessTokenAdapted = adaptCmdTs({\n id: \"access-token\",\n description:\n \"Generate a bearer JWT for Powerhouse APIs using the local DID. \" +\n \"Requires `ph login` first.\",\n inputSchema: z.object({\n expiry: z\n .string()\n .optional()\n .describe('Token expiry, e.g. \"7d\", \"24h\", \"3600s\".'),\n audience: z.string().optional().describe(\"Target audience URL.\"),\n ...debugSchema,\n }),\n invoke: (input) => accessTokenCmd.handler(input as never),\n});\n\nexport const phCliAdaptedCommands = [\n listAdapted,\n logoutAdapted,\n accessTokenAdapted,\n];\n","import type { AgentSetupContext, AgentProvider } from \"@powerhousedao/ph-clint\";\n\nconst SYSTEM_INSTRUCTIONS = `You are ph code — a Powerhouse-flavored coding agent that runs inside the \\`ph\\` CLI.\n\nYou have direct access to the user's Powerhouse project via tools that wrap real \\`ph\\` commands.\nUse the tools to answer questions and take action; never invent output.\n\nStyle:\n- Be concise. Show command results, don't paraphrase them.\n- When the user asks something that maps to a tool, call the tool first and then summarize.\n- When in doubt about an action's blast radius, ask before running it.`;\n\nexport async function createNimbyStyleAgent(\n ctx: AgentSetupContext,\n): Promise<AgentProvider> {\n const { createMastraHelpers } =\n await import(\"@powerhousedao/ph-clint/mastra\");\n const { Agent } = await import(\"@mastra/core/agent\");\n\n const m = createMastraHelpers(ctx);\n const tools = await m.getTools();\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- ph-clint's Memory return type is `any`\n const memory = await m.createMemory();\n\n const cfg = ctx.config as { model?: string; modelUrl?: string };\n const modelId = cfg.model ?? \"anthropic/claude-sonnet-4-5\";\n // For local OpenAI-compatible endpoints the API key is unused but Mastra/\n // the AI-SDK still requires the env var to be set. Keep the user's value\n // if they set one, otherwise drop in a placeholder so the call goes through.\n if (cfg.modelUrl && !process.env.OPENAI_API_KEY) {\n process.env.OPENAI_API_KEY = \"local\";\n }\n // Cast through `unknown`: Mastra's MastraModelConfig types don't yet model\n // the `{ id, url }` form, but the runtime accepts it (see rupert-mastra).\n const model = (cfg.modelUrl\n ? { id: modelId, url: cfg.modelUrl }\n : modelId) as unknown as string;\n\n const agent = new Agent({\n id: \"ph-code\",\n name: \"ph code\",\n instructions: SYSTEM_INSTRUCTIONS,\n model,\n tools,\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- forwarded from ph-clint's Memory helper\n memory,\n });\n\n return m.wrapAgent(agent, { maxSteps: 40 });\n}\n","import { z } from \"zod\";\nimport { defineCli } from \"@powerhousedao/ph-clint\";\nimport { phCliAdaptedCommands } from \"./commands.js\";\nimport { createNimbyStyleAgent } from \"./agent.js\";\nimport { getVersion } from \"../get-version.js\";\n\nconst configSchema = z.object({\n model: z\n .string()\n .default(\"anthropic/claude-sonnet-4-5\")\n .describe(\n 'Mastra model id, e.g. \"anthropic/claude-sonnet-4-5\" or ' +\n '\"openai/Qwen3.6-27B-Q4_K_M.gguf\" for a local server.',\n ),\n modelUrl: z\n .string()\n .optional()\n .describe(\n \"Optional base URL for the model provider (OpenAI-compatible). \" +\n 'Set this to point at a local LLM, e.g. \"http://192.168.178.191:8100/v1\".',\n ),\n});\n\nconst secretsSchema = z.object({\n anthropicApiKey: z\n .string()\n .optional()\n .describe(\"Anthropic API key. Reads from ANTHROPIC_API_KEY by default.\"),\n});\n\nexport function buildPhCodeCli() {\n const cli = defineCli({\n name: \"ph-code\",\n version: getVersion(),\n description:\n \"Powerhouse coding agent. Runs your installed Powerhouse tools through a Mastra-driven REPL.\",\n configSchema,\n secretsSchema,\n commands: phCliAdaptedCommands,\n interactive: {\n welcome: \"ph code — type a prompt or /help. Ctrl-D to exit.\",\n },\n });\n cli.configureAgent(createNimbyStyleAgent);\n return cli;\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"cli-DXcScG24.mjs","names":["listCmd","logoutCmd","accessTokenCmd"],"sources":["../src/code/adapter.ts","../src/code/commands.ts","../src/code/agent.ts","../src/code/cli.ts"],"sourcesContent":["import type { z } from \"zod\";\nimport { defineCommand } from \"@powerhousedao/ph-clint\";\nimport type { Command } from \"@powerhousedao/ph-clint\";\n\nclass ExitSignal extends Error {\n constructor(public code: number) {\n super(`process.exit(${code}) intercepted`);\n }\n}\n\nexport interface AdaptOptions<TSchema extends z.ZodType> {\n id: string;\n description: string;\n inputSchema: TSchema;\n invoke: (input: z.output<TSchema>) => Promise<void>;\n}\n\nexport function adaptCmdTs<TSchema extends z.ZodType>(\n opts: AdaptOptions<TSchema>,\n): Command<TSchema> {\n return defineCommand({\n id: opts.id,\n description: opts.description.trim(),\n inputSchema: opts.inputSchema,\n execute: async (input, ctx) => {\n const buf: string[] = [];\n const origLog = console.log;\n const origErr = console.error;\n // eslint-disable-next-line @typescript-eslint/unbound-method -- intercepting process.exit on purpose\n const origExit = process.exit;\n const origNonInteractive = process.env.PH_NONINTERACTIVE;\n\n const capture = (args: unknown[]) => {\n const line = args\n .map((a) => (typeof a === \"string\" ? a : safeStringify(a)))\n .join(\" \");\n buf.push(line);\n ctx.stdout(line + \"\\n\");\n };\n\n console.log = (...a: unknown[]) => capture(a);\n console.error = (...a: unknown[]) => capture(a);\n // Intercept process.exit so the agent REPL doesn't die.\n (process as unknown as { exit: (code?: number) => never }).exit = (\n code = 0,\n ) => {\n throw new ExitSignal(code);\n };\n process.env.PH_NONINTERACTIVE = \"1\";\n\n try {\n await opts.invoke(input);\n } catch (e) {\n if (e instanceof ExitSignal) {\n if (e.code !== 0) {\n buf.push(`(command exited with code ${e.code})`);\n }\n } else {\n throw e;\n }\n } finally {\n console.log = origLog;\n console.error = origErr;\n (process as unknown as { exit: typeof origExit }).exit = origExit;\n if (origNonInteractive === undefined) {\n delete process.env.PH_NONINTERACTIVE;\n } else {\n process.env.PH_NONINTERACTIVE = origNonInteractive;\n }\n }\n\n return buf.join(\"\\n\");\n },\n });\n}\n\nfunction safeStringify(value: unknown): string {\n try {\n return JSON.stringify(value);\n } catch {\n return String(value);\n }\n}\n","import { z } from \"zod\";\nimport { adaptCmdTs } from \"./adapter.js\";\nimport { list as listCmd } from \"../commands/list.js\";\nimport { logout as logoutCmd } from \"../commands/logout.js\";\nimport { accessToken as accessTokenCmd } from \"../commands/access-token.js\";\n\nconst debugSchema = { debug: z.boolean().optional() };\n\nexport const listAdapted = adaptCmdTs({\n id: \"list\",\n description:\n \"List installed Powerhouse packages from powerhouse.config.json.\",\n inputSchema: z.object({ ...debugSchema }),\n invoke: (input) => listCmd.handler(input as never),\n});\n\nexport const logoutAdapted = adaptCmdTs({\n id: \"logout\",\n description: \"Remove the local Renown session created with `ph login`.\",\n inputSchema: z.object({}),\n invoke: () => logoutCmd.handler({} as never),\n});\n\nexport const accessTokenAdapted = adaptCmdTs({\n id: \"access-token\",\n description:\n \"Generate a bearer JWT for Powerhouse APIs using the local DID. \" +\n \"Requires `ph login` first.\",\n inputSchema: z.object({\n expiry: z\n .string()\n .optional()\n .describe('Token expiry, e.g. \"7d\", \"24h\", \"3600s\".'),\n audience: z.string().optional().describe(\"Target audience URL.\"),\n ...debugSchema,\n }),\n invoke: (input) => accessTokenCmd.handler(input as never),\n});\n\nexport const phCliAdaptedCommands = [\n listAdapted,\n logoutAdapted,\n accessTokenAdapted,\n];\n","import type { AgentSetupContext, AgentProvider } from \"@powerhousedao/ph-clint\";\n\nconst SYSTEM_INSTRUCTIONS = `You are ph code — a Powerhouse-flavored coding agent that runs inside the \\`ph\\` CLI.\n\nYou have direct access to the user's Powerhouse project via tools that wrap real \\`ph\\` commands.\nUse the tools to answer questions and take action; never invent output.\n\nStyle:\n- Be concise. Show command results, don't paraphrase them.\n- When the user asks something that maps to a tool, call the tool first and then summarize.\n- When in doubt about an action's blast radius, ask before running it.`;\n\nexport async function createNimbyStyleAgent(\n ctx: AgentSetupContext,\n): Promise<AgentProvider> {\n const { createMastraHelpers } =\n await import(\"@powerhousedao/ph-clint/mastra\");\n const { Agent } = await import(\"@mastra/core/agent\");\n\n const m = createMastraHelpers(ctx);\n const tools = await m.getTools();\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- ph-clint's Memory return type is `any`\n const memory = await m.createMemory();\n\n const cfg = ctx.config as { model?: string; modelUrl?: string };\n const modelId = cfg.model ?? \"anthropic/claude-sonnet-4-5\";\n // For local OpenAI-compatible endpoints the API key is unused but Mastra/\n // the AI-SDK still requires the env var to be set. Keep the user's value\n // if they set one, otherwise drop in a placeholder so the call goes through.\n if (cfg.modelUrl && !process.env.OPENAI_API_KEY) {\n process.env.OPENAI_API_KEY = \"local\";\n }\n // Cast through `unknown`: Mastra's MastraModelConfig types don't yet model\n // the `{ id, url }` form, but the runtime accepts it (see rupert-mastra).\n const model = (cfg.modelUrl\n ? { id: modelId, url: cfg.modelUrl }\n : modelId) as unknown as string;\n\n const agent = new Agent({\n id: \"ph-code\",\n name: \"ph code\",\n instructions: SYSTEM_INSTRUCTIONS,\n model,\n tools,\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- forwarded from ph-clint's Memory helper\n memory,\n });\n\n return m.wrapAgent(agent, { maxSteps: 40 });\n}\n","import { z } from \"zod\";\nimport { defineCli } from \"@powerhousedao/ph-clint\";\nimport { phCliAdaptedCommands } from \"./commands.js\";\nimport { createNimbyStyleAgent } from \"./agent.js\";\nimport { getVersion } from \"../get-version.js\";\n\nconst configSchema = z.object({\n model: z\n .string()\n .default(\"anthropic/claude-sonnet-4-5\")\n .describe(\n 'Mastra model id, e.g. \"anthropic/claude-sonnet-4-5\" or ' +\n '\"openai/Qwen3.6-27B-Q4_K_M.gguf\" for a local server.',\n ),\n modelUrl: z\n .string()\n .optional()\n .describe(\n \"Optional base URL for the model provider (OpenAI-compatible). \" +\n 'Set this to point at a local LLM, e.g. \"http://192.168.178.191:8100/v1\".',\n ),\n});\n\nconst secretsSchema = z.object({\n anthropicApiKey: z\n .string()\n .optional()\n .describe(\"Anthropic API key. Reads from ANTHROPIC_API_KEY by default.\"),\n});\n\nexport function buildPhCodeCli() {\n const cli = defineCli({\n name: \"ph-code\",\n version: getVersion(),\n description:\n \"Powerhouse coding agent. Runs your installed Powerhouse tools through a Mastra-driven REPL.\",\n configSchema,\n secretsSchema,\n commands: phCliAdaptedCommands,\n interactive: {\n welcome: \"ph code — type a prompt or /help. Ctrl-D to exit.\",\n },\n });\n cli.configureAgent(createNimbyStyleAgent);\n return cli;\n}\n"],"mappings":";;;;AAIA,IAAM,aAAN,cAAyB,MAAM;CAC7B,YAAY,MAAqB;AAC/B,QAAM,gBAAgB,KAAK,eAAe;AADzB,OAAA,OAAA;;;AAYrB,SAAgB,WACd,MACkB;AAClB,QAAO,cAAc;EACnB,IAAI,KAAK;EACT,aAAa,KAAK,YAAY,MAAM;EACpC,aAAa,KAAK;EAClB,SAAS,OAAO,OAAO,QAAQ;GAC7B,MAAM,MAAgB,EAAE;GACxB,MAAM,UAAU,QAAQ;GACxB,MAAM,UAAU,QAAQ;GAExB,MAAM,WAAW,QAAQ;GACzB,MAAM,qBAAqB,QAAQ,IAAI;GAEvC,MAAM,WAAW,SAAoB;IACnC,MAAM,OAAO,KACV,KAAK,MAAO,OAAO,MAAM,WAAW,IAAI,cAAc,EAAE,CAAE,CAC1D,KAAK,IAAI;AACZ,QAAI,KAAK,KAAK;AACd,QAAI,OAAO,OAAO,KAAK;;AAGzB,WAAQ,OAAO,GAAG,MAAiB,QAAQ,EAAE;AAC7C,WAAQ,SAAS,GAAG,MAAiB,QAAQ,EAAE;AAE9C,WAA0D,QACzD,OAAO,MACJ;AACH,UAAM,IAAI,WAAW,KAAK;;AAE5B,WAAQ,IAAI,oBAAoB;AAEhC,OAAI;AACF,UAAM,KAAK,OAAO,MAAM;YACjB,GAAG;AACV,QAAI,aAAa;SACX,EAAE,SAAS,EACb,KAAI,KAAK,6BAA6B,EAAE,KAAK,GAAG;UAGlD,OAAM;aAEA;AACR,YAAQ,MAAM;AACd,YAAQ,QAAQ;AACf,YAAiD,OAAO;AACzD,QAAI,uBAAuB,KAAA,EACzB,QAAO,QAAQ,IAAI;QAEnB,SAAQ,IAAI,oBAAoB;;AAIpC,UAAO,IAAI,KAAK,KAAK;;EAExB,CAAC;;AAGJ,SAAS,cAAc,OAAwB;AAC7C,KAAI;AACF,SAAO,KAAK,UAAU,MAAM;SACtB;AACN,SAAO,OAAO,MAAM;;;;;AC1ExB,MAAM,cAAc,EAAE,OAAO,EAAE,SAAS,CAAC,UAAU,EAAE;AAiCrD,MAAa,uBAAuB;CA/BT,WAAW;EACpC,IAAI;EACJ,aACE;EACF,aAAa,EAAE,OAAO,EAAE,GAAG,aAAa,CAAC;EACzC,SAAS,UAAUA,KAAQ,QAAQ,MAAe;EACnD,CAAC;CAE2B,WAAW;EACtC,IAAI;EACJ,aAAa;EACb,aAAa,EAAE,OAAO,EAAE,CAAC;EACzB,cAAcC,OAAU,QAAQ,EAAE,CAAU;EAC7C,CAAC;CAEgC,WAAW;EAC3C,IAAI;EACJ,aACE;EAEF,aAAa,EAAE,OAAO;GACpB,QAAQ,EACL,QAAQ,CACR,UAAU,CACV,SAAS,iDAA2C;GACvD,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,uBAAuB;GAChE,GAAG;GACJ,CAAC;EACF,SAAS,UAAUC,YAAe,QAAQ,MAAe;EAC1D,CAAC;CAMD;;;ACzCD,MAAM,sBAAsB;;;;;;;;;AAU5B,eAAsB,sBACpB,KACwB;CACxB,MAAM,EAAE,wBACN,MAAM,OAAO;CACf,MAAM,EAAE,UAAU,MAAM,OAAO;CAE/B,MAAM,IAAI,oBAAoB,IAAI;CAClC,MAAM,QAAQ,MAAM,EAAE,UAAU;CAEhC,MAAM,SAAS,MAAM,EAAE,cAAc;CAErC,MAAM,MAAM,IAAI;CAChB,MAAM,UAAU,IAAI,SAAS;AAI7B,KAAI,IAAI,YAAY,CAAC,QAAQ,IAAI,eAC/B,SAAQ,IAAI,iBAAiB;CAQ/B,MAAM,QAAQ,IAAI,MAAM;EACtB,IAAI;EACJ,MAAM;EACN,cAAc;EACd,OARa,IAAI,WACf;GAAE,IAAI;GAAS,KAAK,IAAI;GAAU,GAClC;EAOF;EAEA;EACD,CAAC;AAEF,QAAO,EAAE,UAAU,OAAO,EAAE,UAAU,IAAI,CAAC;;;;AC1C7C,MAAM,eAAe,EAAE,OAAO;CAC5B,OAAO,EACJ,QAAQ,CACR,QAAQ,8BAA8B,CACtC,SACC,kHAED;CACH,UAAU,EACP,QAAQ,CACR,UAAU,CACV,SACC,2IAED;CACJ,CAAC;AAEF,MAAM,gBAAgB,EAAE,OAAO,EAC7B,iBAAiB,EACd,QAAQ,CACR,UAAU,CACV,SAAS,8DAA8D,EAC3E,CAAC;AAEF,SAAgB,iBAAiB;CAC/B,MAAM,MAAM,UAAU;EACpB,MAAM;EACN,SAAS,YAAY;EACrB,aACE;EACF;EACA;EACA,UAAU;EACV,aAAa,EACX,SAAS,qDACV;EACF,CAAC;AACF,KAAI,eAAe,sBAAsB;AACzC,QAAO"}
package/dist/cli.mjs CHANGED
@@ -1,20 +1,14 @@
1
1
  #!/usr/bin/env node
2
- import { a as getVersion, i as accessToken, n as login, r as list, t as logout } from "./logout-DcpByE5i.mjs";
3
- import { t as runBuild } from "./build-DIv8xMX2.mjs";
4
- import { a as updateStylesFile, i as updateConfigFile, r as removeStylesImports } from "./utils-C6_gv4nB.mjs";
5
- import { t as getRenown } from "./auth-DFjfbgA-.mjs";
6
- import { assertNodeVersion, buildArgs, captureCliError, codeArgs, connectBuildArgs, connectPreviewArgs, connectStudioArgs, debugArgs, getPowerhouseProjectInfo, getPowerhouseProjectUninstallCommand, initArgs, initCliTelemetry, inspectArgs, installArgs, makeDependenciesWithVersions, migrateArgs, phCliHelpCommands, publishArgs, registryLoginArgs, switchboardArgs, uninstallArgs, unpublishArgs, vetraArgs } from "@powerhousedao/shared/clis";
2
+ import { a as getVersion, i as accessToken, n as login, r as list, t as logout } from "./logout-DlNBdA8_.mjs";
3
+ import { assertNodeVersion } from "@powerhousedao/shared/clis/utils";
4
+ import { captureCliError, initCliTelemetry } from "@powerhousedao/shared/clis/telemetry";
7
5
  import { array, boolean, command, flag, multioption, oneOf, option, optional, run, string, subcommands } from "cmd-ts";
8
- import { AGENTS, resolveCommand } from "package-manager-detector";
6
+ import { AGENTS, buildArgs, codeArgs, connectBuildArgs, connectPreviewArgs, connectStudioArgs, debugArgs, initArgs, inspectArgs, installArgs, migrateArgs, phCliHelpCommands, publishArgs, registryLoginArgs, switchboardArgs, uninstallArgs, unpublishArgs, vetraArgs } from "@powerhousedao/shared/clis/args";
9
7
  import { Directory, File } from "cmd-ts/dist/cjs/batteries/fs.js";
10
- import { generateDBSchema } from "@powerhousedao/codegen";
11
8
  import path from "path";
12
9
  import { PROCESSOR_APPS } from "@powerhousedao/shared/processors";
13
- import { checkNpmAuth, npmPublish, npmUnpublish, resolveRegistryUrl, writeRegistryAuthToken } from "@powerhousedao/shared/registry";
14
10
  import { execSync } from "child_process";
15
- import { readPackageSync } from "read-pkg";
16
- import { prerelease } from "semver";
17
- import { generateAccessToken } from "@renown/sdk/node";
11
+ import { execSync as execSync$1 } from "node:child_process";
18
12
  import { createInterface } from "node:readline/promises";
19
13
  //#region src/utils/constants.ts
20
14
  const PH_CLI_DESCRIPTION = "The Powerhouse CLI (ph-cli) is a command-line interface tool that provides essential commands for managing Powerhouse projects. The tool and it's commands are fundamental for creating, building, and running Document Models as a builder in studio mode.";
@@ -32,6 +26,7 @@ const build$1 = command({
32
26
  handler: async (args) => {
33
27
  if (args.debug) console.log(args);
34
28
  try {
29
+ const { runBuild } = await import("./build-CWcQj0YI.mjs");
35
30
  await runBuild(args);
36
31
  } catch (error) {
37
32
  console.error(error);
@@ -53,7 +48,7 @@ Examples:
53
48
  `,
54
49
  args: codeArgs,
55
50
  handler: async (args) => {
56
- const { buildPhCodeCli } = await import("./cli-CFWMyGVU.mjs");
51
+ const { buildPhCodeCli } = await import("./cli-DXcScG24.mjs");
57
52
  const cli = buildPhCodeCli();
58
53
  const argv = [
59
54
  "node",
@@ -94,7 +89,7 @@ external packages included
94
89
  args: connectBuildArgs,
95
90
  handler: async (args) => {
96
91
  if (args.debug) console.log(args);
97
- const { runConnectBuild } = await import("./connect-build-BXuIuTCu.mjs");
92
+ const { runConnectBuild } = await import("./connect-build-6yhCIKkQ.mjs");
98
93
  await runConnectBuild(args);
99
94
  process.exit(0);
100
95
  }
@@ -258,6 +253,7 @@ const generateMigrationFileCmd = command({
258
253
  ...debugArgs
259
254
  },
260
255
  handler: async ({ migrationFile, schemaFile }) => {
256
+ const { generateDBSchema } = await import("@powerhousedao/codegen");
261
257
  await generateDBSchema({
262
258
  migrationFile: path.join(process.cwd(), migrationFile),
263
259
  schemaFile: schemaFile ? path.join(process.cwd(), schemaFile) : void 0
@@ -376,7 +372,7 @@ const init = command({
376
372
  args: initArgs,
377
373
  handler: async (args) => {
378
374
  if (args.debug) console.log({ args });
379
- const { startInit } = await import("./init-BgKiiFju.mjs");
375
+ const { startInit } = await import("./init-8FtJDKxG.mjs");
380
376
  await startInit(args);
381
377
  process.exit(0);
382
378
  }
@@ -399,7 +395,7 @@ This command:
399
395
  args: inspectArgs,
400
396
  handler: async (args) => {
401
397
  if (args.debug) console.log(args);
402
- const { startInspect } = await import("./inspect-czss6pZb.mjs");
398
+ const { startInspect } = await import("./inspect-BwkihsT7.mjs");
403
399
  startInspect(args);
404
400
  process.exit(0);
405
401
  }
@@ -425,8 +421,10 @@ Resolution order for the registry URL:
425
421
  args: installArgs,
426
422
  handler: async (args) => {
427
423
  if (args.debug) console.log(args);
424
+ const { getPowerhouseProjectInfo, makeDependenciesWithVersions } = await import("@powerhousedao/shared/clis");
428
425
  const { projectPath, localProjectPath, globalProjectPath, packageManager, isGlobal } = await getPowerhouseProjectInfo(args);
429
426
  if (!projectPath) throw new Error(`Could not find project path to install from.`);
427
+ const { resolveRegistryUrl } = await import("@powerhousedao/shared/registry");
430
428
  const registryUrl = resolveRegistryUrl({
431
429
  registry: args.registry,
432
430
  projectPath
@@ -452,6 +450,7 @@ Resolution order for the registry URL:
452
450
  scopes.add(scope);
453
451
  }
454
452
  const scopeRegistryArgs = Array.from(scopes).map((scope) => `--${scope}:registry=${registryUrl}`);
453
+ const { resolveCommand } = await import("package-manager-detector");
455
454
  const resolved = resolveCommand(packageManager, "add", [...specs, ...scopeRegistryArgs]);
456
455
  if (!resolved) throw new Error(`Failed to resolve install command for package manager "${packageManager}".`);
457
456
  const installCommand = `${resolved.command} ${resolved.args.join(" ")}`;
@@ -468,6 +467,7 @@ Resolution order for the registry URL:
468
467
  throw error;
469
468
  }
470
469
  }
470
+ const { updateConfigFile, updateStylesFile } = await import("./utils-DkOZWO0i.mjs");
471
471
  try {
472
472
  console.log("⚙️ Updating powerhouse config file...");
473
473
  updateConfigFile(dependenciesWithVersions, projectPath, "install", args.local ? "local" : "registry", registryUrl);
@@ -495,29 +495,12 @@ const migrate = command({
495
495
  description: "Run migrations",
496
496
  handler: async (args) => {
497
497
  if (args.debug) console.log(args);
498
- const { startMigrate } = await import("./migrate-CF93gbLw.mjs");
498
+ const { startMigrate } = await import("./migrate-B-O6P7jA.mjs");
499
499
  await startMigrate(args);
500
500
  process.exit(0);
501
501
  }
502
502
  });
503
503
  //#endregion
504
- //#region src/services/registry-auth.ts
505
- /**
506
- * Mint a Renown bearer token bound to the given registry URL via the JWT
507
- * `aud` claim. Throws if the user is not authenticated (`ph login` first).
508
- *
509
- * The audience binding is what lets the registry distinguish a token minted
510
- * for it from one minted for a different service or registry.
511
- */
512
- async function mintRegistryAuthToken(registryUrl, expiresInSeconds) {
513
- const renown = await getRenown();
514
- if (!renown.user) throw new Error("Not authenticated with Renown. Run 'ph login' first.");
515
- return (await generateAccessToken(renown, {
516
- expiresIn: expiresInSeconds,
517
- aud: registryUrl
518
- })).token;
519
- }
520
- //#endregion
521
504
  //#region src/commands/publish.ts
522
505
  function hasTagFlag(args) {
523
506
  return args.some((a) => a === "--tag" || a.startsWith("--tag="));
@@ -525,8 +508,9 @@ function hasTagFlag(args) {
525
508
  function isInteractive() {
526
509
  return Boolean(process.stdin.isTTY) && !process.env.CI;
527
510
  }
528
- function readPrereleaseTag(projectPath) {
511
+ async function readPrereleaseTag(projectPath) {
529
512
  try {
513
+ const [{ readPackageSync }, { prerelease }] = await Promise.all([import("read-pkg"), import("semver")]);
530
514
  const pkg = readPackageSync({ cwd: projectPath });
531
515
  if (!pkg.version) return null;
532
516
  const parts = prerelease(pkg.version);
@@ -555,8 +539,11 @@ This command:
555
539
  args: publishArgs,
556
540
  handler: async (args) => {
557
541
  if (args.debug) console.log(args);
542
+ const { getPowerhouseProjectInfo } = await import("@powerhousedao/shared/clis");
558
543
  const { projectPath } = await getPowerhouseProjectInfo();
559
544
  if (!projectPath) throw new Error("Could not find project path.");
545
+ const { checkNpmAuth, npmPublish, resolveRegistryUrl } = await import("@powerhousedao/shared/registry");
546
+ const { mintRegistryAuthToken } = await import("./registry-auth-BX9_n8hE.mjs");
560
547
  const registryUrl = resolveRegistryUrl({
561
548
  registry: args.registry,
562
549
  projectPath
@@ -578,7 +565,7 @@ This command:
578
565
  }
579
566
  let forwardedArgs = args.forwardedArgs;
580
567
  if (!hasTagFlag(forwardedArgs)) {
581
- const prereleaseInfo = readPrereleaseTag(projectPath);
568
+ const prereleaseInfo = await readPrereleaseTag(projectPath);
582
569
  if (prereleaseInfo) {
583
570
  const { version, tag } = prereleaseInfo;
584
571
  if (!isInteractive()) {
@@ -642,12 +629,17 @@ Usage:
642
629
  args: registryLoginArgs,
643
630
  handler: async (args) => {
644
631
  if (args.debug) console.log(args);
632
+ const { getPowerhouseProjectInfo } = await import("@powerhousedao/shared/clis");
645
633
  const projectPath = (await getPowerhouseProjectInfo().catch(() => null))?.projectPath ?? process.cwd();
634
+ const [{ resolveRegistryUrl, writeRegistryAuthToken }, { mintRegistryAuthToken }, { parseExpiry, formatExpiry }] = await Promise.all([
635
+ import("@powerhousedao/shared/registry"),
636
+ import("./registry-auth-BX9_n8hE.mjs"),
637
+ import("@renown/sdk/node")
638
+ ]);
646
639
  const registryUrl = resolveRegistryUrl({
647
640
  registry: args.registry,
648
641
  projectPath
649
642
  });
650
- const { parseExpiry, formatExpiry } = await import("@renown/sdk/node");
651
643
  const expiresIn = parseExpiry(args.expiry);
652
644
  const npmrcPath = await writeRegistryAuthToken(registryUrl, await mintRegistryAuthToken(registryUrl, expiresIn));
653
645
  console.log(`Logged in to ${registryUrl}`);
@@ -678,14 +670,14 @@ This command:
678
670
  const { basePath, dbPath, migrate, migrateStatus } = args;
679
671
  if (basePath) process.env.BASE_PATH = basePath;
680
672
  if (migrate || migrateStatus) {
681
- const { runSwitchboardMigrations } = await import("./switchboard-migrate-81jhmuWu.mjs");
673
+ const { runSwitchboardMigrations } = await import("./switchboard-migrate-BRgCgg7N.mjs");
682
674
  await runSwitchboardMigrations({
683
675
  dbPath,
684
676
  statusOnly: migrateStatus
685
677
  });
686
678
  process.exit(0);
687
679
  }
688
- const { startSwitchboard } = await import("./switchboard-2B5VC_cr.mjs");
680
+ const { startSwitchboard } = await import("./switchboard-iRFugh8I.mjs");
689
681
  const { defaultDriveUrl, renown } = await startSwitchboard(args);
690
682
  console.log(" ➜ Switchboard:", defaultDriveUrl);
691
683
  if (renown) console.log(" ➜ Identity:", renown.did);
@@ -709,6 +701,7 @@ This command:
709
701
  args: uninstallArgs,
710
702
  handler: async (args) => {
711
703
  if (args.debug) console.log(args);
704
+ const { getPowerhouseProjectInfo, getPowerhouseProjectUninstallCommand, makeDependenciesWithVersions } = await import("@powerhousedao/shared/clis");
712
705
  const { projectPath, localProjectPath, globalProjectPath, packageManager, isGlobal } = await getPowerhouseProjectInfo(args);
713
706
  if (!projectPath) throw new Error(`Could not find project path to uninstall from`);
714
707
  const dependenciesWithVersions = await makeDependenciesWithVersions(args.dependencies);
@@ -721,7 +714,7 @@ This command:
721
714
  });
722
715
  try {
723
716
  console.log("Uninstalling dependencies 📦 ...");
724
- execSync(await getPowerhouseProjectUninstallCommand(packageManager), {
717
+ execSync$1(await getPowerhouseProjectUninstallCommand(packageManager), {
725
718
  stdio: "inherit",
726
719
  cwd: projectPath
727
720
  });
@@ -730,6 +723,7 @@ This command:
730
723
  console.error("❌ Failed to uninstall dependencies");
731
724
  throw error;
732
725
  }
726
+ const { removeStylesImports, updateConfigFile } = await import("./utils-DkOZWO0i.mjs");
733
727
  try {
734
728
  console.log("⚙️ Updating powerhouse config file...");
735
729
  updateConfigFile(dependenciesWithVersions, projectPath, "uninstall");
@@ -770,13 +764,15 @@ Flags:
770
764
  args: unpublishArgs,
771
765
  handler: async (args) => {
772
766
  if (args.debug) console.log(args);
767
+ const { getPowerhouseProjectInfo } = await import("@powerhousedao/shared/clis");
773
768
  const { projectPath } = await getPowerhouseProjectInfo();
774
769
  if (!projectPath) throw new Error("Could not find project path.");
770
+ const { checkNpmAuth, npmUnpublish, resolveRegistryUrl } = await import("@powerhousedao/shared/registry");
775
771
  const registryUrl = resolveRegistryUrl({
776
772
  registry: args.registry,
777
773
  projectPath
778
774
  });
779
- const spec = resolveSpec(args.spec, projectPath);
775
+ const spec = await resolveSpec(args.spec, projectPath);
780
776
  if (!spec) {
781
777
  console.error("No package spec provided and could not read name/version from package.json.");
782
778
  process.exit(1);
@@ -815,9 +811,10 @@ Flags:
815
811
  }
816
812
  }
817
813
  });
818
- function resolveSpec(explicit, projectPath) {
814
+ async function resolveSpec(explicit, projectPath) {
819
815
  if (explicit) return explicit;
820
816
  try {
817
+ const { readPackageSync } = await import("read-pkg");
821
818
  const pkg = readPackageSync({ cwd: projectPath });
822
819
  if (!pkg.name) return null;
823
820
  return pkg.version ? `${pkg.name}@${pkg.version}` : pkg.name;
@@ -858,7 +855,7 @@ This command:
858
855
  args: vetraArgs,
859
856
  handler: async (args) => {
860
857
  if (args.debug) console.log(args);
861
- const { startVetra } = await import("./vetra--a0x272X.mjs");
858
+ const { startVetra } = await import("./vetra-xk2hwf6X.mjs");
862
859
  await startVetra(args);
863
860
  }
864
861
  }),