@powerhousedao/ph-cli 6.0.0-dev.230 → 6.0.0-dev.231

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.
@@ -1,4 +1,4 @@
1
- import { a as getVersion, i as accessToken, r as list, t as logout } from "./logout-BtGDgA5w.mjs";
1
+ import { a as getVersion, i as accessToken, r as list, t as logout } from "./logout-XEyvdASS.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-CqlxYVzz.mjs.map
140
+ //# sourceMappingURL=cli-CVcTOWqn.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli-CqlxYVzz.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,qBAA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TOWqn.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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I,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,5 +1,5 @@
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-BtGDgA5w.mjs";
2
+ import { a as getVersion, i as accessToken, n as login, r as list, t as logout } from "./logout-XEyvdASS.mjs";
3
3
  import { assertNodeVersion } from "@powerhousedao/shared/clis/utils";
4
4
  import { captureCliError, initCliTelemetry } from "@powerhousedao/shared/clis/telemetry";
5
5
  import { array, boolean, command, flag, multioption, oneOf, option, optional, run, string, subcommands } from "cmd-ts";
@@ -48,7 +48,7 @@ Examples:
48
48
  `,
49
49
  args: codeArgs,
50
50
  handler: async (args) => {
51
- const { buildPhCodeCli } = await import("./cli-CqlxYVzz.mjs");
51
+ const { buildPhCodeCli } = await import("./cli-CVcTOWqn.mjs");
52
52
  const cli = buildPhCodeCli();
53
53
  const argv = [
54
54
  "node",
@@ -3,7 +3,7 @@ import { accessTokenArgs, listArgs, loginArgs } from "@powerhousedao/shared/clis
3
3
  import { DEFAULT_EXPIRY_SECONDS } from "@powerhousedao/shared/clis/constants";
4
4
  //#region src/get-version.ts
5
5
  function getVersion() {
6
- return "6.0.0-dev.230";
6
+ return "6.0.0-dev.231";
7
7
  }
8
8
  //#endregion
9
9
  //#region src/commands/access-token.ts
@@ -229,4 +229,4 @@ The logout command removes an existing session created with 'ph login'`,
229
229
  //#endregion
230
230
  export { getVersion as a, accessToken as i, login as n, list as r, logout as t };
231
231
 
232
- //# sourceMappingURL=logout-BtGDgA5w.mjs.map
232
+ //# sourceMappingURL=logout-XEyvdASS.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"logout-BtGDgA5w.mjs","names":[],"sources":["../src/get-version.ts","../src/commands/access-token.ts","../src/commands/list.ts","../src/commands/login.ts","../src/commands/logout.ts"],"sourcesContent":["declare const CLI_VERSION: string | undefined;\ndeclare const CLI_GIT_SHA: string | undefined;\n\nexport function getVersion() {\n if (typeof CLI_VERSION !== \"undefined\") return CLI_VERSION;\n return (\n process.env.WORKSPACE_VERSION ||\n process.env.npm_package_version ||\n \"unknown\"\n );\n}\n\nexport function getGitHash() {\n if (typeof CLI_GIT_SHA !== \"undefined\") return CLI_GIT_SHA;\n return process.env.WORKSPACE_GIT_SHA || \"unknown\";\n}\n","import { accessTokenArgs } from \"@powerhousedao/shared/clis/args\";\nimport { DEFAULT_EXPIRY_SECONDS } from \"@powerhousedao/shared/clis/constants\";\nimport { command } from \"cmd-ts\";\n\nexport const accessToken = command({\n name: \"access-token\",\n description: `\nThe access-token command generates a bearer token for API authentication. This token\ncan be used to authenticate requests to Powerhouse APIs like reactor-api (Switchboard).\n\nThis command:\n1. Uses your CLI's cryptographic identity (DID) to sign a verifiable credential\n2. Creates a JWT bearer token with configurable expiration\n3. Outputs the token to stdout (info to stderr) for easy piping\n\nPrerequisites:\n You must have a cryptographic identity. Run 'ph login' first to:\n - Generate a keypair (stored in .ph/.keypair.json)\n - Optionally link your Ethereum address (stored in .ph/.renown.json)\n\nToken Details:\n The generated token is a JWT (JSON Web Token) containing:\n - Issuer (iss): Your CLI's DID (did:key:...)\n - Subject (sub): Your CLI's DID\n - Credential Subject: Chain ID, network ID, and address (if authenticated)\n - Expiration (exp): Based on --expiry option\n - Audience (aud): If --audience is specified\n\nOutput:\n- Token information (DID, address, expiry) is printed to stderr\n- The token itself is printed to stdout for easy piping/copying\n\nThis allows you to use the command in scripts:\n TOKEN=$(ph access-token)\n curl -H \"Authorization: Bearer $TOKEN\" http://localhost:4001/graphql\n\nUsage with APIs:\n Generate token and use with curl\n TOKEN=$(ph access-token --expiry 1d)\n curl -X POST http://localhost:4001/graphql \\\\\n -H \"Content-Type: application/json\" \\\\\n -H \"Authorization: Bearer $TOKEN\" \\\\\n -d '{\"query\": \"{ drives { id name } }\"}'\n\n Export as environment variable\n export PH_ACCESS_TOKEN=$(ph access-token)\n\nNotes:\n - Tokens are self-signed using your CLI's private key\n - No network request is made; tokens are generated locally\n - The recipient API must trust your CLI's DID to accept the token\n - For reactor-api, ensure AUTH_ENABLED=true to require authentication\n`,\n args: accessTokenArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n const { generateAccessToken, parseExpiry, formatExpiry } =\n await import(\"@renown/sdk/node\");\n const { getRenown } = await import(\"../services/auth.js\");\n const renown = await getRenown();\n\n let expiresIn = DEFAULT_EXPIRY_SECONDS;\n if (args.expiry) expiresIn = parseExpiry(args.expiry);\n\n const result = await generateAccessToken(renown, {\n expiresIn,\n aud: args.audience,\n });\n\n // Output token info to stderr, token itself to stdout for piping\n console.error(`CLI DID: ${result.did}`);\n console.error(`ETH Address: ${result.address}`);\n console.error(`Token expires in: ${formatExpiry(expiresIn)}`);\n console.error(\"\");\n\n console.log(result.token);\n process.exit(0);\n },\n});\n","import { listArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const list = command({\n name: \"list\",\n description: `\nThe list command displays information about installed Powerhouse packages in your project.\nIt reads the powerhouse.config.json file and shows the packages that are currently installed.\n\nThis command:\n1. Examines your project configuration\n2. Lists all installed Powerhouse packages\n3. Provides a clear overview of your project's dependencies\n4. Helps you manage and track your Powerhouse components\n`,\n aliases: [\"l\"],\n args: listArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n try {\n const { getPowerhouseProjectInfo } =\n await import(\"@powerhousedao/shared/clis\");\n const projectInfo = await getPowerhouseProjectInfo();\n console.log(\"\\n>>> projectInfo\", projectInfo);\n\n const { getConfig } = await import(\"@powerhousedao/config/node\");\n const phConfig = getConfig(\n projectInfo.projectPath + \"/powerhouse.config.json\",\n );\n\n if (!phConfig.packages || phConfig.packages.length === 0) {\n console.log(\"No packages found in the project\");\n return;\n }\n\n console.log(\"Installed Packages:\\n\");\n phConfig.packages.forEach((pkg) => {\n console.log(pkg.packageName);\n });\n } catch (e) {\n console.log(\"No packages found in the project\");\n }\n process.exit(0);\n },\n});\n","import { loginArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const login = command({\n name: \"login\",\n description: `\nThe login command authenticates you with Renown using your Ethereum wallet. This enables\nthe CLI to act on behalf of your Ethereum identity for authenticated operations.\n\nThis command:\n1. Generates or loads a cryptographic identity (DID) for the CLI\n2. Opens your browser to the Renown authentication page\n3. You authorize the CLI's DID to act on behalf of your Ethereum address\n4. Stores the credentials locally in .ph/.renown.json\n `,\n args: loginArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n const { getRenown } = await import(\"../services/auth.js\");\n const renown = await getRenown(args.renownUrl);\n\n if (args.showDid) {\n console.log(renown.did);\n process.exit(0);\n }\n\n if (args.status) {\n const { getAuthStatus } = await import(\"@renown/sdk/node\");\n const status = getAuthStatus(renown);\n if (!status.authenticated || !status.address) {\n console.log(\"Not authenticated with an Ethereum address.\");\n console.log('Run \"ph login\" to authenticate.');\n } else {\n console.log(\"Authenticated\");\n console.log(` ETH Address: ${status.address}`);\n console.log(` User DID: ${status.userDid}`);\n console.log(` Chain ID: ${status.chainId}`);\n console.log(` CLI DID: ${status.cliDid}`);\n console.log(\n ` Authenticated at: ${status.authenticatedAt?.toLocaleString()}`,\n );\n console.log(` Renown URL: ${status.baseUrl}`);\n }\n process.exit(0);\n }\n\n if (args.logout) {\n await handleLogout();\n process.exit(0);\n }\n\n const { browserLogin } = await import(\"@renown/sdk/node\");\n\n console.debug(\"Initializing cryptographic identity...\");\n console.log(`CLI DID: ${renown.did}`);\n\n try {\n const timeoutMs = args.timeout ? args.timeout * 1000 : undefined;\n\n const result = await browserLogin(renown, {\n renownUrl: args.renownUrl,\n timeoutMs,\n onLoginUrl: (url, sessionId) => {\n console.log(\"Opening browser for authentication...\");\n console.log(`Session ID: ${sessionId.slice(0, 8)}...`);\n console.log(`Login URL: ${url}`);\n console.log();\n console.log(\"Waiting for authentication in browser\");\n console.log(`(timeout in ${(timeoutMs ?? 300_000) / 1000} seconds)`);\n console.log();\n console.log(\n \"Please connect your wallet and authorize this CLI to act on your behalf.\",\n );\n console.log();\n process.stdout.write(\"Waiting\");\n },\n onPollTick: () => process.stdout.write(\".\"),\n onBrowserOpenFailed: (url) => {\n console.error(\"Failed to open browser automatically.\");\n console.log(`Please open this URL manually: ${url}`);\n },\n });\n\n console.log(); // New line after dots\n console.log();\n console.log(\"Successfully authenticated!\");\n console.log(` ETH Address: ${result.user.address}`);\n console.log(` User DID: ${result.user.did}`);\n console.log(` CLI DID: ${result.cliDid}`);\n console.log();\n console.log(\"The CLI can now act on behalf of your Ethereum identity.\");\n } catch (error) {\n console.log(); // New line after dots\n throw error;\n }\n\n process.exit(0);\n },\n});\n\nexport async function handleLogout() {\n const { getRenown } = await import(\"../services/auth.js\");\n const renown = await getRenown();\n if (!renown.user) {\n console.log(\"Not currently authenticated.\");\n return;\n }\n\n try {\n await renown.logout();\n console.log(\"Successfully logged out.\");\n } catch (error) {\n console.error(\"Failed to clear credentials.\");\n console.debug(error);\n }\n}\n","import { command } from \"cmd-ts\";\nimport { handleLogout } from \"./login.js\";\n\nexport const logout = command({\n name: \"logout\",\n description: `\nThe logout command removes an existing session created with 'ph login'`,\n args: {},\n handler: async () => {\n await handleLogout();\n process.exit(0);\n },\n});\n"],"mappings":";;;;AAGA,SAAgB,aAAa;AACa,QAAA;;;;ACA1C,MAAa,cAAc,QAAQ;CACjC,MAAM;CACN,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+Cb,MAAM;CACN,SAAS,OAAO,SAAS;AACvB,MAAI,KAAK,MACP,SAAQ,IAAI,KAAK;EAGnB,MAAM,EAAE,qBAAqB,aAAa,iBACxC,MAAM,OAAO;EACf,MAAM,EAAE,cAAc,MAAM,OAAO;EACnC,MAAM,SAAS,MAAM,WAAW;EAEhC,IAAI,YAAY;AAChB,MAAI,KAAK,OAAQ,aAAY,YAAY,KAAK,OAAO;EAErD,MAAM,SAAS,MAAM,oBAAoB,QAAQ;GAC/C;GACA,KAAK,KAAK;GACX,CAAC;AAGF,UAAQ,MAAM,YAAY,OAAO,MAAM;AACvC,UAAQ,MAAM,gBAAgB,OAAO,UAAU;AAC/C,UAAQ,MAAM,qBAAqB,aAAa,UAAU,GAAG;AAC7D,UAAQ,MAAM,GAAG;AAEjB,UAAQ,IAAI,OAAO,MAAM;AACzB,UAAQ,KAAK,EAAE;;CAElB,CAAC;;;AC9EF,MAAa,OAAO,QAAQ;CAC1B,MAAM;CACN,aAAa;;;;;;;;;;CAUb,SAAS,CAAC,IAAI;CACd,MAAM;CACN,SAAS,OAAO,SAAS;AACvB,MAAI,KAAK,MACP,SAAQ,IAAI,KAAK;AAGnB,MAAI;GACF,MAAM,EAAE,6BACN,MAAM,OAAO;GACf,MAAM,cAAc,MAAM,0BAA0B;AACpD,WAAQ,IAAI,qBAAqB,YAAY;GAE7C,MAAM,EAAE,cAAc,MAAM,OAAO;GACnC,MAAM,WAAW,UACf,YAAY,cAAc,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MAAM;;;;;ACjHxB,MAAa,SAAS,QAAQ;CAC5B,MAAM;CACN,aAAa;;CAEb,MAAM,EAAE;CACR,SAAS,YAAY;AACnB,QAAM,cAAc;AACpB,UAAQ,KAAK,EAAE;;CAElB,CAAC"}
1
+ {"version":3,"file":"logout-XEyvdASS.mjs","names":[],"sources":["../src/get-version.ts","../src/commands/access-token.ts","../src/commands/list.ts","../src/commands/login.ts","../src/commands/logout.ts"],"sourcesContent":["declare const CLI_VERSION: string | undefined;\ndeclare const CLI_GIT_SHA: string | undefined;\n\nexport function getVersion() {\n if (typeof CLI_VERSION !== \"undefined\") return CLI_VERSION;\n return (\n process.env.WORKSPACE_VERSION ||\n process.env.npm_package_version ||\n \"unknown\"\n );\n}\n\nexport function getGitHash() {\n if (typeof CLI_GIT_SHA !== \"undefined\") return CLI_GIT_SHA;\n return process.env.WORKSPACE_GIT_SHA || \"unknown\";\n}\n","import { accessTokenArgs } from \"@powerhousedao/shared/clis/args\";\nimport { DEFAULT_EXPIRY_SECONDS } from \"@powerhousedao/shared/clis/constants\";\nimport { command } from \"cmd-ts\";\n\nexport const accessToken = command({\n name: \"access-token\",\n description: `\nThe access-token command generates a bearer token for API authentication. This token\ncan be used to authenticate requests to Powerhouse APIs like reactor-api (Switchboard).\n\nThis command:\n1. Uses your CLI's cryptographic identity (DID) to sign a verifiable credential\n2. Creates a JWT bearer token with configurable expiration\n3. Outputs the token to stdout (info to stderr) for easy piping\n\nPrerequisites:\n You must have a cryptographic identity. Run 'ph login' first to:\n - Generate a keypair (stored in .ph/.keypair.json)\n - Optionally link your Ethereum address (stored in .ph/.renown.json)\n\nToken Details:\n The generated token is a JWT (JSON Web Token) containing:\n - Issuer (iss): Your CLI's DID (did:key:...)\n - Subject (sub): Your CLI's DID\n - Credential Subject: Chain ID, network ID, and address (if authenticated)\n - Expiration (exp): Based on --expiry option\n - Audience (aud): If --audience is specified\n\nOutput:\n- Token information (DID, address, expiry) is printed to stderr\n- The token itself is printed to stdout for easy piping/copying\n\nThis allows you to use the command in scripts:\n TOKEN=$(ph access-token)\n curl -H \"Authorization: Bearer $TOKEN\" http://localhost:4001/graphql\n\nUsage with APIs:\n Generate token and use with curl\n TOKEN=$(ph access-token --expiry 1d)\n curl -X POST http://localhost:4001/graphql \\\\\n -H \"Content-Type: application/json\" \\\\\n -H \"Authorization: Bearer $TOKEN\" \\\\\n -d '{\"query\": \"{ drives { id name } }\"}'\n\n Export as environment variable\n export PH_ACCESS_TOKEN=$(ph access-token)\n\nNotes:\n - Tokens are self-signed using your CLI's private key\n - No network request is made; tokens are generated locally\n - The recipient API must trust your CLI's DID to accept the token\n - For reactor-api, ensure AUTH_ENABLED=true to require authentication\n`,\n args: accessTokenArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n const { generateAccessToken, parseExpiry, formatExpiry } =\n await import(\"@renown/sdk/node\");\n const { getRenown } = await import(\"../services/auth.js\");\n const renown = await getRenown();\n\n let expiresIn = DEFAULT_EXPIRY_SECONDS;\n if (args.expiry) expiresIn = parseExpiry(args.expiry);\n\n const result = await generateAccessToken(renown, {\n expiresIn,\n aud: args.audience,\n });\n\n // Output token info to stderr, token itself to stdout for piping\n console.error(`CLI DID: ${result.did}`);\n console.error(`ETH Address: ${result.address}`);\n console.error(`Token expires in: ${formatExpiry(expiresIn)}`);\n console.error(\"\");\n\n console.log(result.token);\n process.exit(0);\n },\n});\n","import { listArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const list = command({\n name: \"list\",\n description: `\nThe list command displays information about installed Powerhouse packages in your project.\nIt reads the powerhouse.config.json file and shows the packages that are currently installed.\n\nThis command:\n1. Examines your project configuration\n2. Lists all installed Powerhouse packages\n3. Provides a clear overview of your project's dependencies\n4. Helps you manage and track your Powerhouse components\n`,\n aliases: [\"l\"],\n args: listArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n try {\n const { getPowerhouseProjectInfo } =\n await import(\"@powerhousedao/shared/clis\");\n const projectInfo = await getPowerhouseProjectInfo();\n console.log(\"\\n>>> projectInfo\", projectInfo);\n\n const { getConfig } = await import(\"@powerhousedao/config/node\");\n const phConfig = getConfig(\n projectInfo.projectPath + \"/powerhouse.config.json\",\n );\n\n if (!phConfig.packages || phConfig.packages.length === 0) {\n console.log(\"No packages found in the project\");\n return;\n }\n\n console.log(\"Installed Packages:\\n\");\n phConfig.packages.forEach((pkg) => {\n console.log(pkg.packageName);\n });\n } catch (e) {\n console.log(\"No packages found in the project\");\n }\n process.exit(0);\n },\n});\n","import { loginArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const login = command({\n name: \"login\",\n description: `\nThe login command authenticates you with Renown using your Ethereum wallet. This enables\nthe CLI to act on behalf of your Ethereum identity for authenticated operations.\n\nThis command:\n1. Generates or loads a cryptographic identity (DID) for the CLI\n2. Opens your browser to the Renown authentication page\n3. You authorize the CLI's DID to act on behalf of your Ethereum address\n4. Stores the credentials locally in .ph/.renown.json\n `,\n args: loginArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n const { getRenown } = await import(\"../services/auth.js\");\n const renown = await getRenown(args.renownUrl);\n\n if (args.showDid) {\n console.log(renown.did);\n process.exit(0);\n }\n\n if (args.status) {\n const { getAuthStatus } = await import(\"@renown/sdk/node\");\n const status = getAuthStatus(renown);\n if (!status.authenticated || !status.address) {\n console.log(\"Not authenticated with an Ethereum address.\");\n console.log('Run \"ph login\" to authenticate.');\n } else {\n console.log(\"Authenticated\");\n console.log(` ETH Address: ${status.address}`);\n console.log(` User DID: ${status.userDid}`);\n console.log(` Chain ID: ${status.chainId}`);\n console.log(` CLI DID: ${status.cliDid}`);\n console.log(\n ` Authenticated at: ${status.authenticatedAt?.toLocaleString()}`,\n );\n console.log(` Renown URL: ${status.baseUrl}`);\n }\n process.exit(0);\n }\n\n if (args.logout) {\n await handleLogout();\n process.exit(0);\n }\n\n const { browserLogin } = await import(\"@renown/sdk/node\");\n\n console.debug(\"Initializing cryptographic identity...\");\n console.log(`CLI DID: ${renown.did}`);\n\n try {\n const timeoutMs = args.timeout ? args.timeout * 1000 : undefined;\n\n const result = await browserLogin(renown, {\n renownUrl: args.renownUrl,\n timeoutMs,\n onLoginUrl: (url, sessionId) => {\n console.log(\"Opening browser for authentication...\");\n console.log(`Session ID: ${sessionId.slice(0, 8)}...`);\n console.log(`Login URL: ${url}`);\n console.log();\n console.log(\"Waiting for authentication in browser\");\n console.log(`(timeout in ${(timeoutMs ?? 300_000) / 1000} seconds)`);\n console.log();\n console.log(\n \"Please connect your wallet and authorize this CLI to act on your behalf.\",\n );\n console.log();\n process.stdout.write(\"Waiting\");\n },\n onPollTick: () => process.stdout.write(\".\"),\n onBrowserOpenFailed: (url) => {\n console.error(\"Failed to open browser automatically.\");\n console.log(`Please open this URL manually: ${url}`);\n },\n });\n\n console.log(); // New line after dots\n console.log();\n console.log(\"Successfully authenticated!\");\n console.log(` ETH Address: ${result.user.address}`);\n console.log(` User DID: ${result.user.did}`);\n console.log(` CLI DID: ${result.cliDid}`);\n console.log();\n console.log(\"The CLI can now act on behalf of your Ethereum identity.\");\n } catch (error) {\n console.log(); // New line after dots\n throw error;\n }\n\n process.exit(0);\n },\n});\n\nexport async function handleLogout() {\n const { getRenown } = await import(\"../services/auth.js\");\n const renown = await getRenown();\n if (!renown.user) {\n console.log(\"Not currently authenticated.\");\n return;\n }\n\n try {\n await renown.logout();\n console.log(\"Successfully logged out.\");\n } catch (error) {\n console.error(\"Failed to clear credentials.\");\n console.debug(error);\n }\n}\n","import { command } from \"cmd-ts\";\nimport { handleLogout } from \"./login.js\";\n\nexport const logout = command({\n name: \"logout\",\n description: `\nThe logout command removes an existing session created with 'ph login'`,\n args: {},\n handler: async () => {\n await handleLogout();\n process.exit(0);\n },\n});\n"],"mappings":";;;;AAGA,SAAgB,aAAa;AACa,QAAA;;;;ACA1C,MAAa,cAAc,QAAQ;CACjC,MAAM;CACN,aAAa;;;;;;;;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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.230",
47
- "@powerhousedao/codegen": "6.0.0-dev.230",
48
- "@powerhousedao/common": "6.0.0-dev.230",
49
- "@powerhousedao/config": "6.0.0-dev.230",
50
- "@powerhousedao/reactor": "6.0.0-dev.230",
51
- "@powerhousedao/shared": "6.0.0-dev.230",
52
- "document-model": "6.0.0-dev.230",
53
- "@powerhousedao/switchboard": "6.0.0-dev.230",
54
- "@renown/sdk": "6.0.0-dev.230"
46
+ "@powerhousedao/codegen": "6.0.0-dev.231",
47
+ "@powerhousedao/builder-tools": "6.0.0-dev.231",
48
+ "@powerhousedao/common": "6.0.0-dev.231",
49
+ "@powerhousedao/config": "6.0.0-dev.231",
50
+ "@powerhousedao/reactor": "6.0.0-dev.231",
51
+ "@renown/sdk": "6.0.0-dev.231",
52
+ "@powerhousedao/switchboard": "6.0.0-dev.231",
53
+ "document-model": "6.0.0-dev.231",
54
+ "@powerhousedao/shared": "6.0.0-dev.231"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@types/node": "25.2.3",