@powerhousedao/ph-cli 6.0.0-dev.216 → 6.0.0-dev.218
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/{assign-env-vars-B-oPplBd.mjs → assign-env-vars-DZMMuzB2.mjs} +1 -1
- package/dist/{assign-env-vars-B-oPplBd.mjs.map → assign-env-vars-DZMMuzB2.mjs.map} +1 -1
- package/dist/auth-BtzNlVSv.mjs +2 -0
- package/dist/{auth-mwX4ugZt.mjs → auth-DFjfbgA-.mjs} +2 -2
- package/dist/{auth-mwX4ugZt.mjs.map → auth-DFjfbgA-.mjs.map} +1 -1
- package/dist/{cli-CYgcGGKv.mjs → cli-CFWMyGVU.mjs} +2 -2
- package/dist/{cli-CYgcGGKv.mjs.map → cli-CFWMyGVU.mjs.map} +1 -1
- package/dist/cli.mjs +88 -25
- package/dist/cli.mjs.map +1 -1
- package/dist/{connect-build-DtObXb22.mjs → connect-build-BXuIuTCu.mjs} +2 -2
- package/dist/{connect-build-DtObXb22.mjs.map → connect-build-BXuIuTCu.mjs.map} +1 -1
- package/dist/{connect-preview-hSphy1QP.mjs → connect-preview-CaEiWmqU.mjs} +2 -2
- package/dist/{connect-preview-hSphy1QP.mjs.map → connect-preview-CaEiWmqU.mjs.map} +1 -1
- package/dist/{connect-studio-CFH0kGW1.mjs → connect-studio-BaqbrWYQ.mjs} +2 -2
- package/dist/{connect-studio-CFH0kGW1.mjs.map → connect-studio-BaqbrWYQ.mjs.map} +1 -1
- package/dist/connect-studio-Dndkp0Q_.mjs +3 -0
- package/dist/{generate-all-D1ZKif6q.mjs → generate-all-DaXXjoms.mjs} +1 -1
- package/dist/{generate-all-D1ZKif6q.mjs.map → generate-all-DaXXjoms.mjs.map} +1 -1
- package/dist/{generate-app-C7KsN9dQ.mjs → generate-app-GvQeAG4w.mjs} +1 -1
- package/dist/{generate-app-C7KsN9dQ.mjs.map → generate-app-GvQeAG4w.mjs.map} +1 -1
- package/dist/{generate-document-model-Diqe4YWy.mjs → generate-document-model-Dnik0rKd.mjs} +1 -1
- package/dist/{generate-document-model-Diqe4YWy.mjs.map → generate-document-model-Dnik0rKd.mjs.map} +1 -1
- package/dist/{generate-editor-BbGF3SM-.mjs → generate-editor-BNN2OmmX.mjs} +1 -1
- package/dist/{generate-editor-BbGF3SM-.mjs.map → generate-editor-BNN2OmmX.mjs.map} +1 -1
- package/dist/{generate-processor-DRruy9GE.mjs → generate-processor-CCSW2Ed2.mjs} +1 -1
- package/dist/{generate-processor-DRruy9GE.mjs.map → generate-processor-CCSW2Ed2.mjs.map} +1 -1
- package/dist/{generate-subgraph-CfM-ICht.mjs → generate-subgraph-B-d3J6hU.mjs} +1 -1
- package/dist/{generate-subgraph-CfM-ICht.mjs.map → generate-subgraph-B-d3J6hU.mjs.map} +1 -1
- package/dist/{init-BgEVXxOR.mjs → init-BgKiiFju.mjs} +1 -1
- package/dist/{init-BgEVXxOR.mjs.map → init-BgKiiFju.mjs.map} +1 -1
- package/dist/{inspect-DRvimHBb.mjs → inspect-czss6pZb.mjs} +1 -1
- package/dist/{inspect-DRvimHBb.mjs.map → inspect-czss6pZb.mjs.map} +1 -1
- package/dist/{logout-BpJEO2Ij.mjs → logout-DcpByE5i.mjs} +4 -4
- package/dist/{logout-BpJEO2Ij.mjs.map → logout-DcpByE5i.mjs.map} +1 -1
- package/dist/{migrate-CSaC4bDh.mjs → migrate-DLEG7ehb.mjs} +1 -1
- package/dist/{migrate-CSaC4bDh.mjs.map → migrate-DLEG7ehb.mjs.map} +1 -1
- package/dist/switchboard-2B5VC_cr.mjs +2 -0
- package/dist/{switchboard-Bl2llp5U.mjs → switchboard-DGbd-EPx.mjs} +1 -1
- package/dist/{switchboard-Bl2llp5U.mjs.map → switchboard-DGbd-EPx.mjs.map} +1 -1
- package/dist/{switchboard-migrate-BiQJfIrc.mjs → switchboard-migrate-81jhmuWu.mjs} +1 -1
- package/dist/{switchboard-migrate-BiQJfIrc.mjs.map → switchboard-migrate-81jhmuWu.mjs.map} +1 -1
- package/dist/{vetra-D2zbrNY1.mjs → vetra--a0x272X.mjs} +4 -4
- package/dist/{vetra-D2zbrNY1.mjs.map → vetra--a0x272X.mjs.map} +1 -1
- package/package.json +10 -10
- package/dist/connect-studio-CV-T5IfA.mjs +0 -3
- package/dist/switchboard-DUlj8v2F.mjs +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assign-env-vars-
|
|
1
|
+
{"version":3,"file":"assign-env-vars-DZMMuzB2.mjs","names":[],"sources":["../src/utils/assign-env-vars.ts"],"sourcesContent":["import type {\n ConnectBuildArgs,\n ConnectPreviewArgs,\n ConnectStudioArgs,\n} from \"../types.js\";\nimport { setConnectEnv } from \"@powerhousedao/shared/connect\";\n\nexport function assignEnvVars(\n args: ConnectBuildArgs | ConnectPreviewArgs | ConnectStudioArgs,\n) {\n const {\n connectBasePath,\n defaultDrivesUrl,\n drivesPreserveStrategy,\n disableLocalPackages,\n } = args;\n\n setConnectEnv({\n PH_CONNECT_BASE_PATH: connectBasePath,\n PH_CONNECT_DEFAULT_DRIVES_URL: defaultDrivesUrl,\n PH_CONNECT_DRIVES_PRESERVE_STRATEGY: drivesPreserveStrategy,\n PH_DISABLE_LOCAL_PACKAGE: disableLocalPackages,\n });\n}\n"],"mappings":";;AAOA,SAAgB,cACd,MACA;CACA,MAAM,EACJ,iBACA,kBACA,wBACA,yBACE;AAEJ,eAAc;EACZ,sBAAsB;EACtB,+BAA+B;EAC/B,qCAAqC;EACrC,0BAA0B;EAC3B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-
|
|
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,4 +1,4 @@
|
|
|
1
|
-
import { a as getVersion, i as accessToken, r as list, t as logout } from "./logout-
|
|
1
|
+
import { a as getVersion, i as accessToken, r as list, t as logout } from "./logout-DcpByE5i.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-
|
|
140
|
+
//# sourceMappingURL=cli-CFWMyGVU.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-CYgcGGKv.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;AA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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"}
|
|
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":";;;;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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,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,18 +1,20 @@
|
|
|
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-
|
|
2
|
+
import { a as getVersion, i as accessToken, n as login, r as list, t as logout } from "./logout-DcpByE5i.mjs";
|
|
3
3
|
import { t as runBuild } from "./build-DIv8xMX2.mjs";
|
|
4
4
|
import { a as updateStylesFile, i as updateConfigFile, r as removeStylesImports } from "./utils-C6_gv4nB.mjs";
|
|
5
|
-
import {
|
|
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";
|
|
6
7
|
import { array, boolean, command, flag, multioption, oneOf, option, optional, run, string, subcommands } from "cmd-ts";
|
|
7
8
|
import { AGENTS, resolveCommand } from "package-manager-detector";
|
|
8
9
|
import { Directory, File } from "cmd-ts/dist/cjs/batteries/fs.js";
|
|
9
10
|
import { generateDBSchema } from "@powerhousedao/codegen";
|
|
10
11
|
import path from "path";
|
|
11
12
|
import { PROCESSOR_APPS } from "@powerhousedao/shared/processors";
|
|
12
|
-
import { checkNpmAuth, npmPublish, npmUnpublish, resolveRegistryUrl } from "@powerhousedao/shared/registry";
|
|
13
|
+
import { checkNpmAuth, npmPublish, npmUnpublish, resolveRegistryUrl, writeRegistryAuthToken } from "@powerhousedao/shared/registry";
|
|
13
14
|
import { execSync } from "child_process";
|
|
14
15
|
import { readPackageSync } from "read-pkg";
|
|
15
16
|
import { prerelease } from "semver";
|
|
17
|
+
import { generateAccessToken } from "@renown/sdk/node";
|
|
16
18
|
import { createInterface } from "node:readline/promises";
|
|
17
19
|
//#region src/utils/constants.ts
|
|
18
20
|
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.";
|
|
@@ -51,7 +53,7 @@ Examples:
|
|
|
51
53
|
`,
|
|
52
54
|
args: codeArgs,
|
|
53
55
|
handler: async (args) => {
|
|
54
|
-
const { buildPhCodeCli } = await import("./cli-
|
|
56
|
+
const { buildPhCodeCli } = await import("./cli-CFWMyGVU.mjs");
|
|
55
57
|
const cli = buildPhCodeCli();
|
|
56
58
|
const argv = [
|
|
57
59
|
"node",
|
|
@@ -80,7 +82,7 @@ This command:
|
|
|
80
82
|
args: connectStudioArgs,
|
|
81
83
|
handler: async (args) => {
|
|
82
84
|
if (args.debug) console.log(args);
|
|
83
|
-
const { runConnectStudio } = await import("./connect-studio-
|
|
85
|
+
const { runConnectStudio } = await import("./connect-studio-Dndkp0Q_.mjs");
|
|
84
86
|
await runConnectStudio(args);
|
|
85
87
|
}
|
|
86
88
|
}),
|
|
@@ -92,7 +94,7 @@ external packages included
|
|
|
92
94
|
args: connectBuildArgs,
|
|
93
95
|
handler: async (args) => {
|
|
94
96
|
if (args.debug) console.log(args);
|
|
95
|
-
const { runConnectBuild } = await import("./connect-build-
|
|
97
|
+
const { runConnectBuild } = await import("./connect-build-BXuIuTCu.mjs");
|
|
96
98
|
await runConnectBuild(args);
|
|
97
99
|
process.exit(0);
|
|
98
100
|
}
|
|
@@ -105,7 +107,7 @@ NOTE: You must run \`ph connect build\` first
|
|
|
105
107
|
args: connectPreviewArgs,
|
|
106
108
|
handler: async (args) => {
|
|
107
109
|
if (args.debug) console.log(args);
|
|
108
|
-
const { runConnectPreview } = await import("./connect-preview-
|
|
110
|
+
const { runConnectPreview } = await import("./connect-preview-CaEiWmqU.mjs");
|
|
109
111
|
await runConnectPreview(args);
|
|
110
112
|
}
|
|
111
113
|
})
|
|
@@ -118,7 +120,7 @@ const generateAllCmd = command({
|
|
|
118
120
|
description: "Re-generate all modules in the current project",
|
|
119
121
|
args: {},
|
|
120
122
|
handler: async () => {
|
|
121
|
-
const { startGenerateAll } = await import("./generate-all-
|
|
123
|
+
const { startGenerateAll } = await import("./generate-all-DaXXjoms.mjs");
|
|
122
124
|
await startGenerateAll(process.cwd());
|
|
123
125
|
process.exit(0);
|
|
124
126
|
}
|
|
@@ -162,7 +164,7 @@ const generateAppCmd = command({
|
|
|
162
164
|
...debugArgs
|
|
163
165
|
},
|
|
164
166
|
handler: async (args) => {
|
|
165
|
-
const { startGenerateApp } = await import("./generate-app-
|
|
167
|
+
const { startGenerateApp } = await import("./generate-app-GvQeAG4w.mjs");
|
|
166
168
|
await startGenerateApp(args, process.cwd());
|
|
167
169
|
process.exit(0);
|
|
168
170
|
}
|
|
@@ -194,7 +196,7 @@ const generateDocumentModelCmd = command({
|
|
|
194
196
|
...debugArgs
|
|
195
197
|
},
|
|
196
198
|
handler: async (args) => {
|
|
197
|
-
const { startGenerateDocumentModel } = await import("./generate-document-model-
|
|
199
|
+
const { startGenerateDocumentModel } = await import("./generate-document-model-Dnik0rKd.mjs");
|
|
198
200
|
await startGenerateDocumentModel(args, process.cwd());
|
|
199
201
|
process.exit(0);
|
|
200
202
|
}
|
|
@@ -231,7 +233,7 @@ const generateEditorCmd = command({
|
|
|
231
233
|
...debugArgs
|
|
232
234
|
},
|
|
233
235
|
handler: async (args) => {
|
|
234
|
-
const { startGenerateEditor } = await import("./generate-editor-
|
|
236
|
+
const { startGenerateEditor } = await import("./generate-editor-BNN2OmmX.mjs");
|
|
235
237
|
await startGenerateEditor(args, process.cwd());
|
|
236
238
|
process.exit(0);
|
|
237
239
|
}
|
|
@@ -315,7 +317,7 @@ const generateProcessorCmd = command({
|
|
|
315
317
|
...debugArgs
|
|
316
318
|
},
|
|
317
319
|
handler: async (args) => {
|
|
318
|
-
const { startGenerateProcessor } = await import("./generate-processor-
|
|
320
|
+
const { startGenerateProcessor } = await import("./generate-processor-CCSW2Ed2.mjs");
|
|
319
321
|
await startGenerateProcessor(args, process.cwd());
|
|
320
322
|
process.exit(0);
|
|
321
323
|
}
|
|
@@ -346,7 +348,7 @@ const generateSubgraphCmd = command({
|
|
|
346
348
|
...debugArgs
|
|
347
349
|
},
|
|
348
350
|
handler: async (args) => {
|
|
349
|
-
const { startGenerateSubgraph } = await import("./generate-subgraph-
|
|
351
|
+
const { startGenerateSubgraph } = await import("./generate-subgraph-B-d3J6hU.mjs");
|
|
350
352
|
await startGenerateSubgraph(args, process.cwd());
|
|
351
353
|
process.exit(0);
|
|
352
354
|
}
|
|
@@ -374,7 +376,7 @@ const init = command({
|
|
|
374
376
|
args: initArgs,
|
|
375
377
|
handler: async (args) => {
|
|
376
378
|
if (args.debug) console.log({ args });
|
|
377
|
-
const { startInit } = await import("./init-
|
|
379
|
+
const { startInit } = await import("./init-BgKiiFju.mjs");
|
|
378
380
|
await startInit(args);
|
|
379
381
|
process.exit(0);
|
|
380
382
|
}
|
|
@@ -397,7 +399,7 @@ This command:
|
|
|
397
399
|
args: inspectArgs,
|
|
398
400
|
handler: async (args) => {
|
|
399
401
|
if (args.debug) console.log(args);
|
|
400
|
-
const { startInspect } = await import("./inspect-
|
|
402
|
+
const { startInspect } = await import("./inspect-czss6pZb.mjs");
|
|
401
403
|
startInspect(args);
|
|
402
404
|
process.exit(0);
|
|
403
405
|
}
|
|
@@ -493,12 +495,29 @@ const migrate$1 = command({
|
|
|
493
495
|
description: "Run migrations",
|
|
494
496
|
handler: async (args) => {
|
|
495
497
|
if (args.debug) console.log(args);
|
|
496
|
-
const { startMigrate } = await import("./migrate-
|
|
498
|
+
const { startMigrate } = await import("./migrate-DLEG7ehb.mjs");
|
|
497
499
|
await startMigrate(args);
|
|
498
500
|
process.exit(0);
|
|
499
501
|
}
|
|
500
502
|
});
|
|
501
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
|
|
502
521
|
//#region src/commands/publish.ts
|
|
503
522
|
function hasTagFlag(args) {
|
|
504
523
|
return args.some((a) => a === "--tag" || a.startsWith("--tag="));
|
|
@@ -543,12 +562,19 @@ This command:
|
|
|
543
562
|
projectPath
|
|
544
563
|
});
|
|
545
564
|
if (args.debug) console.log(">>> registryUrl", registryUrl);
|
|
565
|
+
let authToken;
|
|
546
566
|
try {
|
|
547
|
-
await
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
console.error(
|
|
551
|
-
|
|
567
|
+
authToken = await mintRegistryAuthToken(registryUrl, 300);
|
|
568
|
+
if (args.debug) console.error(`>>> minted renown token for ${registryUrl} (5m TTL)`);
|
|
569
|
+
} catch (err) {
|
|
570
|
+
if (args.debug) console.error(`>>> renown token mint skipped: ${err.message}`);
|
|
571
|
+
try {
|
|
572
|
+
await checkNpmAuth(registryUrl);
|
|
573
|
+
} catch {
|
|
574
|
+
console.error(`Not authenticated with registry: ${registryUrl}`);
|
|
575
|
+
console.error(`Run: ph login (recommended) or npm adduser --registry ${registryUrl}`);
|
|
576
|
+
process.exit(1);
|
|
577
|
+
}
|
|
552
578
|
}
|
|
553
579
|
let forwardedArgs = args.forwardedArgs;
|
|
554
580
|
if (!hasTagFlag(forwardedArgs)) {
|
|
@@ -588,13 +614,49 @@ This command:
|
|
|
588
614
|
const result = await npmPublish({
|
|
589
615
|
registryUrl,
|
|
590
616
|
cwd: projectPath,
|
|
591
|
-
args: forwardedArgs
|
|
617
|
+
args: forwardedArgs,
|
|
618
|
+
authToken
|
|
592
619
|
});
|
|
593
620
|
if (result.stdout) console.log(result.stdout);
|
|
594
621
|
process.exit(0);
|
|
595
622
|
}
|
|
596
623
|
});
|
|
597
624
|
//#endregion
|
|
625
|
+
//#region src/commands/registry-login.ts
|
|
626
|
+
const registryLogin = command({
|
|
627
|
+
name: "registry-login",
|
|
628
|
+
description: `
|
|
629
|
+
Log in to a Powerhouse registry using your Renown identity. Mints a longer-lived
|
|
630
|
+
bearer token (default 30 days) bound to the registry's audience and writes the
|
|
631
|
+
token into ~/.npmrc so raw 'npm publish' / 'npm install' work without further
|
|
632
|
+
setup.
|
|
633
|
+
|
|
634
|
+
Prerequisites:
|
|
635
|
+
Run 'ph login' first to establish a Renown identity.
|
|
636
|
+
|
|
637
|
+
Usage:
|
|
638
|
+
ph registry-login # uses powerhouse.config.json / PH_REGISTRY_URL
|
|
639
|
+
ph registry-login --registry https://registry.dev.vetra.io
|
|
640
|
+
ph registry-login --expiry 7d
|
|
641
|
+
`,
|
|
642
|
+
args: registryLoginArgs,
|
|
643
|
+
handler: async (args) => {
|
|
644
|
+
if (args.debug) console.log(args);
|
|
645
|
+
const projectPath = (await getPowerhouseProjectInfo().catch(() => null))?.projectPath ?? process.cwd();
|
|
646
|
+
const registryUrl = resolveRegistryUrl({
|
|
647
|
+
registry: args.registry,
|
|
648
|
+
projectPath
|
|
649
|
+
});
|
|
650
|
+
const { parseExpiry, formatExpiry } = await import("@renown/sdk/node");
|
|
651
|
+
const expiresIn = parseExpiry(args.expiry);
|
|
652
|
+
const npmrcPath = await writeRegistryAuthToken(registryUrl, await mintRegistryAuthToken(registryUrl, expiresIn));
|
|
653
|
+
console.log(`Logged in to ${registryUrl}`);
|
|
654
|
+
console.log(` Token expires in: ${formatExpiry(expiresIn)}`);
|
|
655
|
+
console.log(` Wrote: ${npmrcPath}`);
|
|
656
|
+
process.exit(0);
|
|
657
|
+
}
|
|
658
|
+
});
|
|
659
|
+
//#endregion
|
|
598
660
|
//#region src/commands/switchboard.ts
|
|
599
661
|
const switchboard = command({
|
|
600
662
|
name: "switchboard",
|
|
@@ -616,14 +678,14 @@ This command:
|
|
|
616
678
|
const { basePath, dbPath, migrate, migrateStatus } = args;
|
|
617
679
|
if (basePath) process.env.BASE_PATH = basePath;
|
|
618
680
|
if (migrate || migrateStatus) {
|
|
619
|
-
const { runSwitchboardMigrations } = await import("./switchboard-migrate-
|
|
681
|
+
const { runSwitchboardMigrations } = await import("./switchboard-migrate-81jhmuWu.mjs");
|
|
620
682
|
await runSwitchboardMigrations({
|
|
621
683
|
dbPath,
|
|
622
684
|
statusOnly: migrateStatus
|
|
623
685
|
});
|
|
624
686
|
process.exit(0);
|
|
625
687
|
}
|
|
626
|
-
const { startSwitchboard } = await import("./switchboard-
|
|
688
|
+
const { startSwitchboard } = await import("./switchboard-2B5VC_cr.mjs");
|
|
627
689
|
const { defaultDriveUrl, renown } = await startSwitchboard(args);
|
|
628
690
|
console.log(" ➜ Switchboard:", defaultDriveUrl);
|
|
629
691
|
if (renown) console.log(" ➜ Identity:", renown.did);
|
|
@@ -796,7 +858,7 @@ This command:
|
|
|
796
858
|
args: vetraArgs,
|
|
797
859
|
handler: async (args) => {
|
|
798
860
|
if (args.debug) console.log(args);
|
|
799
|
-
const { startVetra } = await import("./vetra
|
|
861
|
+
const { startVetra } = await import("./vetra--a0x272X.mjs");
|
|
800
862
|
await startVetra(args);
|
|
801
863
|
}
|
|
802
864
|
}),
|
|
@@ -805,6 +867,7 @@ This command:
|
|
|
805
867
|
publish,
|
|
806
868
|
unpublish,
|
|
807
869
|
"access-token": accessToken,
|
|
870
|
+
"registry-login": registryLogin,
|
|
808
871
|
inspect,
|
|
809
872
|
list,
|
|
810
873
|
migrate: migrate$1,
|