@powerhousedao/ph-cli 6.0.2-staging.6 → 6.0.2-staging.7
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/README.md +2 -2
- package/dist/{assign-env-vars-B-oPplBd.mjs → assign-env-vars-W-lZmdMi.mjs} +4 -1
- package/dist/assign-env-vars-W-lZmdMi.mjs.map +1 -0
- package/dist/auth-AR3VxAIk.mjs +18 -0
- package/dist/auth-AR3VxAIk.mjs.map +1 -0
- package/dist/auth-BNkN6kS9.mjs +4 -0
- package/dist/build-CqtYNjiI.mjs +4 -0
- package/dist/build-vccTv_Jp.mjs +49 -0
- package/dist/build-vccTv_Jp.mjs.map +1 -0
- package/dist/cli.mjs +354 -67
- package/dist/cli.mjs.map +1 -1
- package/dist/{connect-build-DUiJQGfx.mjs → connect-build-B7I7HJu0.mjs} +8 -5
- package/dist/connect-build-B7I7HJu0.mjs.map +1 -0
- package/dist/{connect-preview-hSphy1QP.mjs → connect-preview-CNJkhtxL.mjs} +5 -2
- package/dist/connect-preview-CNJkhtxL.mjs.map +1 -0
- package/dist/{connect-studio-CFH0kGW1.mjs → connect-studio-DTdSFftL.mjs} +5 -2
- package/dist/connect-studio-DTdSFftL.mjs.map +1 -0
- package/dist/connect-studio-DySbZFEc.mjs +5 -0
- package/dist/generate-all-Cj8zjFhN.mjs +15 -0
- package/dist/generate-all-Cj8zjFhN.mjs.map +1 -0
- package/dist/{generate-app-hSK1SlOn.mjs → generate-app-KE0rbE-b.mjs} +9 -2
- package/dist/generate-app-KE0rbE-b.mjs.map +1 -0
- package/dist/{generate-document-model-ZowVACXL.mjs → generate-document-model-Cut44i6D.mjs} +9 -2
- package/dist/generate-document-model-Cut44i6D.mjs.map +1 -0
- package/dist/{generate-editor-C53z-03Q.mjs → generate-editor-DmSzWm3W.mjs} +9 -2
- package/dist/generate-editor-DmSzWm3W.mjs.map +1 -0
- package/dist/{generate-processor-BS4F98d6.mjs → generate-processor-BcuHtOSn.mjs} +9 -2
- package/dist/generate-processor-BcuHtOSn.mjs.map +1 -0
- package/dist/{generate-subgraph-D1cYT9GQ.mjs → generate-subgraph-sh0GWC6T.mjs} +9 -2
- package/dist/generate-subgraph-sh0GWC6T.mjs.map +1 -0
- package/dist/{init-BgEVXxOR.mjs → init-Cw_5H_Z1.mjs} +7 -3
- package/dist/init-Cw_5H_Z1.mjs.map +1 -0
- package/dist/{inspect-DRvimHBb.mjs → inspect-BwuBW_zW.mjs} +5 -2
- package/dist/inspect-BwuBW_zW.mjs.map +1 -0
- package/dist/migrate-DxITKzBR.mjs +62 -0
- package/dist/migrate-DxITKzBR.mjs.map +1 -0
- package/dist/registry-auth-CNH84uo4.mjs +25 -0
- package/dist/registry-auth-CNH84uo4.mjs.map +1 -0
- package/dist/scripts/setup.sh +3 -3
- package/dist/{switchboard-Bl2llp5U.mjs → switchboard-BsdbF-rL.mjs} +4 -1
- package/dist/switchboard-BsdbF-rL.mjs.map +1 -0
- package/dist/switchboard-GTBlxiJZ.mjs +4 -0
- package/dist/{switchboard-migrate-BiQJfIrc.mjs → switchboard-migrate-BumRp7rC.mjs} +4 -1
- package/dist/switchboard-migrate-BumRp7rC.mjs.map +1 -0
- package/dist/utils-C6581aex.mjs +4 -0
- package/dist/{utils-C6_gv4nB.mjs → utils-mth8NsDA.mjs} +6 -3
- package/dist/utils-mth8NsDA.mjs.map +1 -0
- package/dist/{vetra-D2zbrNY1.mjs → vetra-_JnFPpL5.mjs} +8 -5
- package/dist/vetra-_JnFPpL5.mjs.map +1 -0
- package/package.json +10 -14
- package/dist/assign-env-vars-B-oPplBd.mjs.map +0 -1
- package/dist/auth-mwX4ugZt.mjs +0 -15
- package/dist/auth-mwX4ugZt.mjs.map +0 -1
- package/dist/build-Fq1pNRsl.mjs +0 -33
- package/dist/build-Fq1pNRsl.mjs.map +0 -1
- package/dist/cli-CYgcGGKv.mjs +0 -140
- package/dist/cli-CYgcGGKv.mjs.map +0 -1
- package/dist/connect-build-DUiJQGfx.mjs.map +0 -1
- package/dist/connect-preview-hSphy1QP.mjs.map +0 -1
- package/dist/connect-studio-CFH0kGW1.mjs.map +0 -1
- package/dist/connect-studio-CV-T5IfA.mjs +0 -3
- package/dist/generate-all-yTycRkd3.mjs +0 -10
- package/dist/generate-all-yTycRkd3.mjs.map +0 -1
- package/dist/generate-app-hSK1SlOn.mjs.map +0 -1
- package/dist/generate-document-model-ZowVACXL.mjs.map +0 -1
- package/dist/generate-editor-C53z-03Q.mjs.map +0 -1
- package/dist/generate-processor-BS4F98d6.mjs.map +0 -1
- package/dist/generate-subgraph-D1cYT9GQ.mjs.map +0 -1
- package/dist/init-BgEVXxOR.mjs.map +0 -1
- package/dist/inspect-DRvimHBb.mjs.map +0 -1
- package/dist/logout-BpJEO2Ij.mjs +0 -230
- package/dist/logout-BpJEO2Ij.mjs.map +0 -1
- package/dist/migrate-CSaC4bDh.mjs +0 -11
- package/dist/migrate-CSaC4bDh.mjs.map +0 -1
- package/dist/switchboard-Bl2llp5U.mjs.map +0 -1
- package/dist/switchboard-DUlj8v2F.mjs +0 -2
- package/dist/switchboard-migrate-BiQJfIrc.mjs.map +0 -1
- package/dist/utils-C6_gv4nB.mjs.map +0 -1
- package/dist/vetra-D2zbrNY1.mjs.map +0 -1
package/dist/cli-CYgcGGKv.mjs
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { a as getVersion, i as accessToken, r as list, t as logout } from "./logout-BpJEO2Ij.mjs";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import { defineCli, defineCommand } from "@powerhousedao/ph-clint";
|
|
4
|
-
//#region src/code/adapter.ts
|
|
5
|
-
var ExitSignal = class extends Error {
|
|
6
|
-
constructor(code) {
|
|
7
|
-
super(`process.exit(${code}) intercepted`);
|
|
8
|
-
this.code = code;
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
function adaptCmdTs(opts) {
|
|
12
|
-
return defineCommand({
|
|
13
|
-
id: opts.id,
|
|
14
|
-
description: opts.description.trim(),
|
|
15
|
-
inputSchema: opts.inputSchema,
|
|
16
|
-
execute: async (input, ctx) => {
|
|
17
|
-
const buf = [];
|
|
18
|
-
const origLog = console.log;
|
|
19
|
-
const origErr = console.error;
|
|
20
|
-
const origExit = process.exit;
|
|
21
|
-
const origNonInteractive = process.env.PH_NONINTERACTIVE;
|
|
22
|
-
const capture = (args) => {
|
|
23
|
-
const line = args.map((a) => typeof a === "string" ? a : safeStringify(a)).join(" ");
|
|
24
|
-
buf.push(line);
|
|
25
|
-
ctx.stdout(line + "\n");
|
|
26
|
-
};
|
|
27
|
-
console.log = (...a) => capture(a);
|
|
28
|
-
console.error = (...a) => capture(a);
|
|
29
|
-
process.exit = (code = 0) => {
|
|
30
|
-
throw new ExitSignal(code);
|
|
31
|
-
};
|
|
32
|
-
process.env.PH_NONINTERACTIVE = "1";
|
|
33
|
-
try {
|
|
34
|
-
await opts.invoke(input);
|
|
35
|
-
} catch (e) {
|
|
36
|
-
if (e instanceof ExitSignal) {
|
|
37
|
-
if (e.code !== 0) buf.push(`(command exited with code ${e.code})`);
|
|
38
|
-
} else throw e;
|
|
39
|
-
} finally {
|
|
40
|
-
console.log = origLog;
|
|
41
|
-
console.error = origErr;
|
|
42
|
-
process.exit = origExit;
|
|
43
|
-
if (origNonInteractive === void 0) delete process.env.PH_NONINTERACTIVE;
|
|
44
|
-
else process.env.PH_NONINTERACTIVE = origNonInteractive;
|
|
45
|
-
}
|
|
46
|
-
return buf.join("\n");
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
function safeStringify(value) {
|
|
51
|
-
try {
|
|
52
|
-
return JSON.stringify(value);
|
|
53
|
-
} catch {
|
|
54
|
-
return String(value);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
//#endregion
|
|
58
|
-
//#region src/code/commands.ts
|
|
59
|
-
const debugSchema = { debug: z.boolean().optional() };
|
|
60
|
-
const phCliAdaptedCommands = [
|
|
61
|
-
adaptCmdTs({
|
|
62
|
-
id: "list",
|
|
63
|
-
description: "List installed Powerhouse packages from powerhouse.config.json.",
|
|
64
|
-
inputSchema: z.object({ ...debugSchema }),
|
|
65
|
-
invoke: (input) => list.handler(input)
|
|
66
|
-
}),
|
|
67
|
-
adaptCmdTs({
|
|
68
|
-
id: "logout",
|
|
69
|
-
description: "Remove the local Renown session created with `ph login`.",
|
|
70
|
-
inputSchema: z.object({}),
|
|
71
|
-
invoke: () => logout.handler({})
|
|
72
|
-
}),
|
|
73
|
-
adaptCmdTs({
|
|
74
|
-
id: "access-token",
|
|
75
|
-
description: "Generate a bearer JWT for Powerhouse APIs using the local DID. Requires `ph login` first.",
|
|
76
|
-
inputSchema: z.object({
|
|
77
|
-
expiry: z.string().optional().describe("Token expiry, e.g. \"7d\", \"24h\", \"3600s\"."),
|
|
78
|
-
audience: z.string().optional().describe("Target audience URL."),
|
|
79
|
-
...debugSchema
|
|
80
|
-
}),
|
|
81
|
-
invoke: (input) => accessToken.handler(input)
|
|
82
|
-
})
|
|
83
|
-
];
|
|
84
|
-
//#endregion
|
|
85
|
-
//#region src/code/agent.ts
|
|
86
|
-
const SYSTEM_INSTRUCTIONS = `You are ph code — a Powerhouse-flavored coding agent that runs inside the \`ph\` CLI.
|
|
87
|
-
|
|
88
|
-
You have direct access to the user's Powerhouse project via tools that wrap real \`ph\` commands.
|
|
89
|
-
Use the tools to answer questions and take action; never invent output.
|
|
90
|
-
|
|
91
|
-
Style:
|
|
92
|
-
- Be concise. Show command results, don't paraphrase them.
|
|
93
|
-
- When the user asks something that maps to a tool, call the tool first and then summarize.
|
|
94
|
-
- When in doubt about an action's blast radius, ask before running it.`;
|
|
95
|
-
async function createNimbyStyleAgent(ctx) {
|
|
96
|
-
const { createMastraHelpers } = await import("@powerhousedao/ph-clint/mastra");
|
|
97
|
-
const { Agent } = await import("@mastra/core/agent");
|
|
98
|
-
const m = createMastraHelpers(ctx);
|
|
99
|
-
const tools = await m.getTools();
|
|
100
|
-
const memory = await m.createMemory();
|
|
101
|
-
const cfg = ctx.config;
|
|
102
|
-
const modelId = cfg.model ?? "anthropic/claude-sonnet-4-5";
|
|
103
|
-
if (cfg.modelUrl && !process.env.OPENAI_API_KEY) process.env.OPENAI_API_KEY = "local";
|
|
104
|
-
const agent = new Agent({
|
|
105
|
-
id: "ph-code",
|
|
106
|
-
name: "ph code",
|
|
107
|
-
instructions: SYSTEM_INSTRUCTIONS,
|
|
108
|
-
model: cfg.modelUrl ? {
|
|
109
|
-
id: modelId,
|
|
110
|
-
url: cfg.modelUrl
|
|
111
|
-
} : modelId,
|
|
112
|
-
tools,
|
|
113
|
-
memory
|
|
114
|
-
});
|
|
115
|
-
return m.wrapAgent(agent, { maxSteps: 40 });
|
|
116
|
-
}
|
|
117
|
-
//#endregion
|
|
118
|
-
//#region src/code/cli.ts
|
|
119
|
-
const configSchema = z.object({
|
|
120
|
-
model: z.string().default("anthropic/claude-sonnet-4-5").describe("Mastra model id, e.g. \"anthropic/claude-sonnet-4-5\" or \"openai/Qwen3.6-27B-Q4_K_M.gguf\" for a local server."),
|
|
121
|
-
modelUrl: z.string().optional().describe("Optional base URL for the model provider (OpenAI-compatible). Set this to point at a local LLM, e.g. \"http://192.168.178.191:8100/v1\".")
|
|
122
|
-
});
|
|
123
|
-
const secretsSchema = z.object({ anthropicApiKey: z.string().optional().describe("Anthropic API key. Reads from ANTHROPIC_API_KEY by default.") });
|
|
124
|
-
function buildPhCodeCli() {
|
|
125
|
-
const cli = defineCli({
|
|
126
|
-
name: "ph-code",
|
|
127
|
-
version: getVersion(),
|
|
128
|
-
description: "Powerhouse coding agent. Runs your installed Powerhouse tools through a Mastra-driven REPL.",
|
|
129
|
-
configSchema,
|
|
130
|
-
secretsSchema,
|
|
131
|
-
commands: phCliAdaptedCommands,
|
|
132
|
-
interactive: { welcome: "ph code — type a prompt or /help. Ctrl-D to exit." }
|
|
133
|
-
});
|
|
134
|
-
cli.configureAgent(createNimbyStyleAgent);
|
|
135
|
-
return cli;
|
|
136
|
-
}
|
|
137
|
-
//#endregion
|
|
138
|
-
export { buildPhCodeCli };
|
|
139
|
-
|
|
140
|
-
//# sourceMappingURL=cli-CYgcGGKv.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
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;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,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,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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"connect-build-DUiJQGfx.mjs","names":[],"sources":["../src/services/connect-build.ts"],"sourcesContent":["import { getConnectBaseViteConfig } from \"@powerhousedao/builder-tools\";\nimport { getConfig } from \"@powerhousedao/shared/clis\";\nimport { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { InlineConfig } from \"vite\";\nimport { build, mergeConfig } from \"vite\";\nimport type { ConnectBuildArgs } from \"../types.js\";\nimport { assignEnvVars } from \"../utils/assign-env-vars.js\";\nimport { runBuild } from \"./build.js\";\n\nexport async function runConnectBuild(args: ConnectBuildArgs) {\n const { outDir, debug } = args;\n assignEnvVars(args);\n\n const mode = \"production\";\n const dirname = process.cwd();\n\n // Fail fast if any package marked as provider: \"local\" is missing from\n // node_modules — the Vite plugin that bundles them needs them on disk.\n assertLocalPackagesInstalled(dirname);\n\n await runBuild({\n outDir: \"dist\",\n debug,\n });\n\n const baseConfig = getConnectBaseViteConfig({\n mode,\n dirname,\n });\n\n const buildConfig: InlineConfig = {\n build: {\n outDir,\n },\n };\n\n const config = mergeConfig(baseConfig, buildConfig);\n\n await build(config);\n}\n\nfunction assertLocalPackagesInstalled(projectPath: string) {\n const config = getConfig(join(projectPath, \"powerhouse.config.json\"));\n const localPackages = (config.packages ?? []).filter(\n (p) => p.provider === \"local\",\n );\n if (localPackages.length === 0) return;\n\n const missing = localPackages.filter(\n (p) =>\n !existsSync(\n join(projectPath, \"node_modules\", p.packageName, \"package.json\"),\n ),\n );\n if (missing.length === 0) return;\n\n const names = missing.map((p) => p.packageName);\n throw new Error(\n `ph connect build requires these packages to be installed in node_modules (they are declared with provider: \"local\" in powerhouse.config.json):\\n` +\n names.map((n) => ` - ${n}`).join(\"\\n\") +\n `\\n\\nInstall them with:\\n ph install --local ${names.join(\" \")}`,\n );\n}\n"],"mappings":";;;;;;;;AAUA,eAAsB,gBAAgB,MAAwB;CAC5D,MAAM,EAAE,QAAQ,UAAU;AAC1B,eAAc,KAAK;CAEnB,MAAM,OAAO;CACb,MAAM,UAAU,QAAQ,KAAK;AAI7B,8BAA6B,QAAQ;AAErC,OAAM,SAAS;EACb,QAAQ;EACR;EACD,CAAC;AAeF,OAAM,MAFS,YAXI,yBAAyB;EAC1C;EACA;EACD,CAAC,EAEgC,EAChC,OAAO,EACL,QACD,EACF,CAEkD,CAEhC;;AAGrB,SAAS,6BAA6B,aAAqB;CAEzD,MAAM,iBADS,UAAU,KAAK,aAAa,yBAAyB,CAAC,CACvC,YAAY,EAAE,EAAE,QAC3C,MAAM,EAAE,aAAa,QACvB;AACD,KAAI,cAAc,WAAW,EAAG;CAEhC,MAAM,UAAU,cAAc,QAC3B,MACC,CAAC,WACC,KAAK,aAAa,gBAAgB,EAAE,aAAa,eAAe,CACjE,CACJ;AACD,KAAI,QAAQ,WAAW,EAAG;CAE1B,MAAM,QAAQ,QAAQ,KAAK,MAAM,EAAE,YAAY;AAC/C,OAAM,IAAI,MACR,qJACE,MAAM,KAAK,MAAM,OAAO,IAAI,CAAC,KAAK,KAAK,GACvC,gDAAgD,MAAM,KAAK,IAAI,GAClE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"connect-preview-hSphy1QP.mjs","names":[],"sources":["../src/services/connect-preview.ts"],"sourcesContent":["import { getConnectBaseViteConfig } from \"@powerhousedao/builder-tools\";\nimport type { InlineConfig } from \"vite\";\nimport { mergeConfig, preview } from \"vite\";\nimport type { ConnectPreviewArgs } from \"../types.js\";\nimport { assignEnvVars } from \"../utils/assign-env-vars.js\";\n\nexport async function runConnectPreview(args: ConnectPreviewArgs) {\n const {\n outDir,\n connectBasePath,\n port,\n host,\n open,\n cors,\n strictPort,\n printUrls,\n bindCLIShortcuts,\n } = args;\n\n assignEnvVars(args);\n\n const mode = \"production\";\n\n const dirname = process.cwd();\n\n const baseConfig = getConnectBaseViteConfig({\n mode,\n dirname,\n });\n\n const previewConfig: InlineConfig = {\n build: {\n outDir,\n },\n preview: {\n cors,\n port,\n strictPort,\n host,\n open,\n },\n };\n\n const config = mergeConfig(baseConfig, previewConfig);\n\n const server = await preview(config);\n\n if (printUrls) server.printUrls();\n if (bindCLIShortcuts) server.bindCLIShortcuts({ print: true });\n}\n"],"mappings":";;;;AAMA,eAAsB,kBAAkB,MAA0B;CAChE,MAAM,EACJ,QACA,iBACA,MACA,MACA,MACA,MACA,YACA,WACA,qBACE;AAEJ,eAAc,KAAK;CA0BnB,MAAM,SAAS,MAAM,QAFN,YAlBI,yBAAyB;EAC1C,MALW;EAMX,SAJc,QAAQ,KAAK;EAK5B,CAAC,EAEkC;EAClC,OAAO,EACL,QACD;EACD,SAAS;GACP;GACA;GACA;GACA;GACA;GACD;EACF,CAEoD,CAEjB;AAEpC,KAAI,UAAW,QAAO,WAAW;AACjC,KAAI,iBAAkB,QAAO,iBAAiB,EAAE,OAAO,MAAM,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"connect-studio-CFH0kGW1.mjs","names":[],"sources":["../src/services/connect-studio.ts"],"sourcesContent":["import { getConnectBaseViteConfig } from \"@powerhousedao/builder-tools\";\nimport type { InlineConfig, Logger } from \"vite\";\nimport { createServer, mergeConfig } from \"vite\";\nimport type { ConnectStudioArgs } from \"../types.js\";\nimport { assignEnvVars } from \"../utils/assign-env-vars.js\";\n\nexport async function runConnectStudio(\n args: ConnectStudioArgs,\n customLogger?: Logger,\n) {\n const { port, host, open, cors, strictPort, printUrls, bindCLIShortcuts } =\n args;\n assignEnvVars(args);\n const mode = \"development\";\n\n const dirname = process.cwd();\n\n const baseConfig = getConnectBaseViteConfig({\n mode,\n dirname,\n });\n\n const devServerConfig: InlineConfig = {\n server: { port, host, open, cors, strictPort },\n customLogger,\n };\n\n const config = mergeConfig(baseConfig, devServerConfig);\n\n const server = await createServer(config);\n\n await server.listen();\n\n if (printUrls) server.printUrls();\n if (bindCLIShortcuts) server.bindCLIShortcuts({ print: true });\n}\n"],"mappings":";;;;AAMA,eAAsB,iBACpB,MACA,cACA;CACA,MAAM,EAAE,MAAM,MAAM,MAAM,MAAM,YAAY,WAAW,qBACrD;AACF,eAAc,KAAK;CAiBnB,MAAM,SAAS,MAAM,aAFN,YAVI,yBAAyB;EAC1C,MALW;EAMX,SAJc,QAAQ,KAAK;EAK5B,CAAC,EAEoC;EACpC,QAAQ;GAAE;GAAM;GAAM;GAAM;GAAM;GAAY;EAC9C;EACD,CAEsD,CAEd;AAEzC,OAAM,OAAO,QAAQ;AAErB,KAAI,UAAW,QAAO,WAAW;AACjC,KAAI,iBAAkB,QAAO,iBAAiB,EAAE,OAAO,MAAM,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { generateAll } from "@powerhousedao/codegen";
|
|
2
|
-
import { buildTsMorphProject } from "@powerhousedao/codegen/utils";
|
|
3
|
-
//#region src/services/generate-all.ts
|
|
4
|
-
async function startGenerateAll(projectDir) {
|
|
5
|
-
await generateAll(buildTsMorphProject(projectDir));
|
|
6
|
-
}
|
|
7
|
-
//#endregion
|
|
8
|
-
export { startGenerateAll };
|
|
9
|
-
|
|
10
|
-
//# sourceMappingURL=generate-all-yTycRkd3.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-all-yTycRkd3.mjs","names":[],"sources":["../src/services/generate-all.ts"],"sourcesContent":["import { generateAll } from \"@powerhousedao/codegen\";\nimport { buildTsMorphProject } from \"@powerhousedao/codegen/utils\";\n\nexport async function startGenerateAll(projectDir: string) {\n const project = buildTsMorphProject(projectDir);\n await generateAll(project);\n}\n"],"mappings":";;;AAGA,eAAsB,iBAAiB,YAAoB;AAEzD,OAAM,YADU,oBAAoB,WAAW,CACrB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-app-hSK1SlOn.mjs","names":[],"sources":["../src/services/generate-app.ts"],"sourcesContent":["import { generateAllApps, generateApp } from \"@powerhousedao/codegen\";\nimport {\n buildTsMorphProject,\n getAppMetadata,\n} from \"@powerhousedao/codegen/utils\";\nimport { dirname } from \"node:path\";\nimport type { GenerateAppArgs } from \"../types.js\";\n\nexport async function startGenerateApp(\n args: GenerateAppArgs,\n projectDir: string,\n) {\n const {\n name,\n allowedDocumentTypes = [],\n disableDragAndDrop,\n dir,\n all,\n debug,\n } = args;\n if (debug) {\n console.log({ args });\n }\n const project = buildTsMorphProject(projectDir);\n if (all) {\n await generateAllApps(project);\n } else if (name) {\n await generateApp(\n {\n appName: name,\n allowedDocumentTypes,\n isDragAndDropEnabled: !disableDragAndDrop,\n },\n project,\n );\n } else if (dir) {\n const appMetadata = getAppMetadata(project, dirname(dir));\n if (!appMetadata) {\n throw new Error(`Failed to get data for app in dir \"${dir}\"`);\n }\n const {\n name: appName,\n id: appId,\n dirName: appDirName,\n allowedDocumentTypes,\n isDragAndDropEnabled,\n } = appMetadata;\n\n await generateApp(\n {\n appName,\n appId,\n appDirName,\n allowedDocumentTypes,\n isDragAndDropEnabled,\n },\n project,\n );\n } else {\n console.log(\"Please specify either `name`, `dir`, or `all`.\");\n }\n}\n"],"mappings":";;;;AAQA,eAAsB,iBACpB,MACA,YACA;CACA,MAAM,EACJ,MACA,uBAAuB,EAAE,EACzB,oBACA,KACA,KACA,UACE;AACJ,KAAI,MACF,SAAQ,IAAI,EAAE,MAAM,CAAC;CAEvB,MAAM,UAAU,oBAAoB,WAAW;AAC/C,KAAI,IACF,OAAM,gBAAgB,QAAQ;UACrB,KACT,OAAM,YACJ;EACE,SAAS;EACT;EACA,sBAAsB,CAAC;EACxB,EACD,QACD;UACQ,KAAK;EACd,MAAM,cAAc,eAAe,SAAS,QAAQ,IAAI,CAAC;AACzD,MAAI,CAAC,YACH,OAAM,IAAI,MAAM,sCAAsC,IAAI,GAAG;EAE/D,MAAM,EACJ,MAAM,SACN,IAAI,OACJ,SAAS,YACT,sBACA,yBACE;AAEJ,QAAM,YACJ;GACE;GACA;GACA;GACA;GACA;GACD,EACD,QACD;OAED,SAAQ,IAAI,iDAAiD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-document-model-ZowVACXL.mjs","names":[],"sources":["../src/services/generate-document-model.ts"],"sourcesContent":["import {\n generateAllDocumentModels,\n generateDocumentModel,\n loadDocumentModel,\n} from \"@powerhousedao/codegen\";\nimport { buildTsMorphProject } from \"@powerhousedao/codegen/utils\";\nimport { dirname, join } from \"node:path\";\nimport type { GenerateDocumentModelArgs } from \"../types.js\";\n\nexport async function startGenerateDocumentModel(\n args: GenerateDocumentModelArgs,\n projectDir: string,\n) {\n const { file, dir, all, debug } = args;\n if (debug) {\n console.log({ args });\n }\n const project = buildTsMorphProject(projectDir);\n if (all) {\n await generateAllDocumentModels(project);\n } else if (file) {\n const documentModelState = await loadDocumentModel(file);\n await generateDocumentModel(documentModelState, project);\n } else if (dir) {\n const documentModelDirName = dirname(dir);\n const documentModelFileName = `${documentModelDirName}.json`;\n const documentModelFilePath = join(dir, documentModelFileName);\n const documentModelState = await loadDocumentModel(documentModelFilePath);\n await generateDocumentModel(documentModelState, project);\n } else {\n console.log(\"Please specify either `file`, `dir`, or `all`.\");\n }\n}\n"],"mappings":";;;;AASA,eAAsB,2BACpB,MACA,YACA;CACA,MAAM,EAAE,MAAM,KAAK,KAAK,UAAU;AAClC,KAAI,MACF,SAAQ,IAAI,EAAE,MAAM,CAAC;CAEvB,MAAM,UAAU,oBAAoB,WAAW;AAC/C,KAAI,IACF,OAAM,0BAA0B,QAAQ;UAC/B,KAET,OAAM,sBADqB,MAAM,kBAAkB,KAAK,EACR,QAAQ;UAC/C,IAKT,OAAM,sBADqB,MAAM,kBADH,KAAK,KADL,GADD,QAAQ,IAAI,CACa,OACQ,CACW,EACzB,QAAQ;KAExD,SAAQ,IAAI,iDAAiD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-editor-C53z-03Q.mjs","names":[],"sources":["../src/services/generate-editor.ts"],"sourcesContent":["import { generateAllEditors, generateEditor } from \"@powerhousedao/codegen\";\nimport {\n buildTsMorphProject,\n getEditorMetadata,\n} from \"@powerhousedao/codegen/utils\";\nimport { dirname } from \"node:path\";\nimport type { GenerateEditorArgs } from \"../types.js\";\n\nexport async function startGenerateEditor(\n args: GenerateEditorArgs,\n projectDir: string,\n) {\n const { name, documentType, dir, all, debug } = args;\n if (debug) {\n console.log({ args });\n }\n const project = buildTsMorphProject(projectDir);\n if (all) {\n await generateAllEditors(project);\n } else if (name) {\n if (!documentType) {\n throw new Error(\n \"Please specify a document type for the new editor to generate.\",\n );\n }\n await generateEditor(\n { editorName: name, documentTypes: [documentType] },\n project,\n );\n } else if (dir) {\n const editorArgs = getEditorMetadata(project, dirname(dir));\n if (!editorArgs) {\n throw new Error(`Failed to get data for editor in dir \"${dir}\"`);\n }\n const {\n name: editorName,\n id: editorId,\n dirName: editorDirName,\n documentTypes,\n } = editorArgs;\n await generateEditor(\n {\n editorName,\n editorId,\n editorDirName,\n documentTypes,\n },\n project,\n );\n } else {\n console.log(\"Please specify either `name`, `dir`, or `all`.\");\n }\n}\n"],"mappings":";;;;AAQA,eAAsB,oBACpB,MACA,YACA;CACA,MAAM,EAAE,MAAM,cAAc,KAAK,KAAK,UAAU;AAChD,KAAI,MACF,SAAQ,IAAI,EAAE,MAAM,CAAC;CAEvB,MAAM,UAAU,oBAAoB,WAAW;AAC/C,KAAI,IACF,OAAM,mBAAmB,QAAQ;UACxB,MAAM;AACf,MAAI,CAAC,aACH,OAAM,IAAI,MACR,iEACD;AAEH,QAAM,eACJ;GAAE,YAAY;GAAM,eAAe,CAAC,aAAa;GAAE,EACnD,QACD;YACQ,KAAK;EACd,MAAM,aAAa,kBAAkB,SAAS,QAAQ,IAAI,CAAC;AAC3D,MAAI,CAAC,WACH,OAAM,IAAI,MAAM,yCAAyC,IAAI,GAAG;EAElE,MAAM,EACJ,MAAM,YACN,IAAI,UACJ,SAAS,eACT,kBACE;AACJ,QAAM,eACJ;GACE;GACA;GACA;GACA;GACD,EACD,QACD;OAED,SAAQ,IAAI,iDAAiD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-processor-BS4F98d6.mjs","names":[],"sources":["../src/services/generate-processor.ts"],"sourcesContent":["import {\n generateAllProcessors,\n generateProcessor,\n} from \"@powerhousedao/codegen\";\nimport {\n buildTsMorphProject,\n getProcessorMetadata,\n} from \"@powerhousedao/codegen/utils\";\nimport { dirname } from \"node:path\";\nimport type { GenerateProcessorArgs } from \"../types.js\";\n\nexport async function startGenerateProcessor(\n args: GenerateProcessorArgs,\n projectDir: string,\n) {\n const {\n name: processorName,\n type: processorType,\n apps: processorApps,\n documentTypes,\n dir,\n all,\n debug,\n } = args;\n if (debug) {\n console.log({ args });\n }\n const project = buildTsMorphProject(projectDir);\n if (all) {\n await generateAllProcessors(project);\n } else if (processorName) {\n await generateProcessor(\n {\n processorName,\n processorApps,\n processorType,\n documentTypes,\n },\n project,\n );\n } else if (dir) {\n const processorDirName = dirname(dir);\n const processorArgs = getProcessorMetadata(project, processorDirName);\n await generateProcessor(processorArgs, project);\n } else {\n console.log(\"Please specify either `name`, `dir`, or `all`.\");\n }\n}\n"],"mappings":";;;;AAWA,eAAsB,uBACpB,MACA,YACA;CACA,MAAM,EACJ,MAAM,eACN,MAAM,eACN,MAAM,eACN,eACA,KACA,KACA,UACE;AACJ,KAAI,MACF,SAAQ,IAAI,EAAE,MAAM,CAAC;CAEvB,MAAM,UAAU,oBAAoB,WAAW;AAC/C,KAAI,IACF,OAAM,sBAAsB,QAAQ;UAC3B,cACT,OAAM,kBACJ;EACE;EACA;EACA;EACA;EACD,EACD,QACD;UACQ,IAGT,OAAM,kBADgB,qBAAqB,SADlB,QAAQ,IAAI,CACgC,EAC9B,QAAQ;KAE/C,SAAQ,IAAI,iDAAiD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-subgraph-D1cYT9GQ.mjs","names":[],"sources":["../src/services/generate-subgraph.ts"],"sourcesContent":["import { generateAllSubgraphs, generateSubgraph } from \"@powerhousedao/codegen\";\nimport {\n buildTsMorphProject,\n getSubgraphMetadata,\n} from \"@powerhousedao/codegen/utils\";\nimport { dirname } from \"node:path\";\nimport type { GenerateSubgraphArgs } from \"../types.js\";\n\nexport async function startGenerateSubgraph(\n args: GenerateSubgraphArgs,\n projectDir: string,\n) {\n const { name, dir, all, debug } = args;\n if (debug) {\n console.log({ args });\n }\n const project = buildTsMorphProject(projectDir);\n if (all) {\n await generateAllSubgraphs(project);\n } else if (name) {\n await generateSubgraph(name, project);\n } else if (dir) {\n const { subgraphName } = getSubgraphMetadata(project, dirname(dir));\n if (!subgraphName) {\n throw new Error(`Failed to get data for subgraph in dir \"${dir}\"`);\n }\n await generateSubgraph(subgraphName, project);\n } else {\n console.log(\"Please specify either `name`, `dir`, or `all`.\");\n }\n}\n"],"mappings":";;;;AAQA,eAAsB,sBACpB,MACA,YACA;CACA,MAAM,EAAE,MAAM,KAAK,KAAK,UAAU;AAClC,KAAI,MACF,SAAQ,IAAI,EAAE,MAAM,CAAC;CAEvB,MAAM,UAAU,oBAAoB,WAAW;AAC/C,KAAI,IACF,OAAM,qBAAqB,QAAQ;UAC1B,KACT,OAAM,iBAAiB,MAAM,QAAQ;UAC5B,KAAK;EACd,MAAM,EAAE,iBAAiB,oBAAoB,SAAS,QAAQ,IAAI,CAAC;AACnE,MAAI,CAAC,aACH,OAAM,IAAI,MAAM,2CAA2C,IAAI,GAAG;AAEpE,QAAM,iBAAiB,cAAc,QAAQ;OAE7C,SAAQ,IAAI,iDAAiD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"init-BgEVXxOR.mjs","names":[],"sources":["../src/utils/validate-remote-drive.ts","../src/services/init.ts"],"sourcesContent":["import {\n createVetraDocument,\n getVetraDocuments,\n} from \"@powerhousedao/common/utils\";\n\n/**\n * Sets up a remote drive for initialization by validating and creating\n * a Vetra document if needed.\n * Returns true if setup succeeds, false if it should stop execution.\n */\nexport async function setupRemoteDrive(\n remoteDriveUrl: string,\n): Promise<boolean> {\n try {\n // Parse driveId from URL\n const driveId = remoteDriveUrl.split(\"/\").pop();\n\n if (!remoteDriveUrl || remoteDriveUrl.trim() === \"\") {\n console.error(\"❌ Remote drive URL is required\");\n return false;\n }\n\n // Construct GraphQL endpoint from base URL\n const url = new URL(remoteDriveUrl);\n const graphqlEndpoint = `${url.protocol}//${url.host}/graphql`;\n\n let documents = await getVetraDocuments(graphqlEndpoint, driveId!);\n\n if (documents.length === 0) {\n console.log(\n \"No vetra package document found in the provided drive, creating one...\",\n );\n try {\n await createVetraDocument(graphqlEndpoint, driveId!, \"vetra-package\");\n\n // Re-fetch documents after creation\n documents = await getVetraDocuments(graphqlEndpoint, driveId!);\n\n if (documents.length === 0) {\n console.error(\n \"❌ Failed to create vetra package document in the remote drive\",\n );\n return false;\n }\n\n console.log(\"✅ Vetra package document created successfully\");\n } catch (createError) {\n console.error(\n \"❌ Failed to create vetra package document:\",\n createError,\n );\n return false;\n }\n }\n\n if (documents.length > 1) {\n console.warn(\n \"⚠️ Multiple vetra package documents were found in the provided remote drive, this might be an error in your remote drive\",\n );\n }\n\n const hasGithubUrl = documents.some((doc) => doc.githubUrl);\n\n if (hasGithubUrl) {\n console.error(\n \"❌ The remote drive provided already has been configured with a github url, please use the checkout command instead: ph checkout --remote-drive <remote drive url>\",\n );\n return false;\n }\n\n return true;\n } catch (error) {\n console.error(\"❌ Unable to fetch remote drive info:\", error);\n return false;\n }\n}\n","import { createProject } from \"@powerhousedao/codegen\";\nimport {\n handleMutuallyExclusiveOptions,\n parsePackageManager,\n parseTag,\n} from \"@powerhousedao/shared/clis\";\nimport chalk from \"chalk\";\nimport { kebabCase } from \"change-case\";\nimport enquirer from \"enquirer\";\nimport { clean, valid } from \"semver\";\nimport type { InitArgs } from \"../types.js\";\nimport { setupRemoteDrive } from \"../utils/validate-remote-drive.js\";\n\nexport async function startInit(args: InitArgs) {\n const {\n namePositional,\n nameOption,\n packageManager,\n npm,\n pnpm,\n yarn,\n bun,\n tag,\n version,\n dev,\n staging,\n remoteDrive,\n } = args;\n\n let name = namePositional ?? nameOption;\n if (!name) {\n const { prompt } = enquirer;\n\n const result = await prompt<{ name: string }>([\n {\n type: \"input\",\n name: \"name\",\n message: \"What is the project name?\",\n required: true,\n result: (value) => kebabCase(value),\n },\n ]);\n name = result.name;\n }\n if (!name) {\n throw new Error(\"You must provide a name for your project.\");\n }\n\n if (version !== undefined && !valid(clean(version))) {\n throw new Error(`Invalid version: ${version}`);\n }\n\n handleMutuallyExclusiveOptions(\n {\n tag,\n version,\n dev,\n staging,\n },\n \"versioning strategy\",\n );\n\n handleMutuallyExclusiveOptions(\n {\n npm,\n pnpm,\n yarn,\n bun,\n packageManager,\n },\n \"package manager\",\n );\n\n const parsedPackageManager =\n parsePackageManager({\n npm,\n pnpm,\n yarn,\n bun,\n packageManager,\n }) ?? \"npm\";\n\n const parsedTag = parseTag({\n tag,\n dev,\n staging,\n });\n\n try {\n if (remoteDrive) {\n console.log(chalk.blue(\"\\n⏳ Setting up remote drive...\\n\"));\n await setupRemoteDrive(remoteDrive);\n console.log(chalk.green(\"\\n✅ Remote drive set up.\"));\n }\n\n console.log(chalk.bold(\"\\n🚀 Initializing a new project...\\n\"));\n await createProject({\n ...args,\n name,\n packageManager: parsedPackageManager,\n tag: parsedTag,\n });\n\n if (remoteDrive) {\n console.log();\n console.log(\"To link your project to GitHub:\");\n console.log();\n console.log(\" 1. Create a new repository on GitHub\");\n console.log(` 2. cd ${name}`);\n console.log(\" 3. git add . && git commit -m 'Initial commit'\");\n console.log(\" 4. git remote add origin <your-github-url>\");\n console.log(` 5. git push -u origin main`);\n console.log();\n }\n } catch (error) {\n console.error(\"\\n❌ Failed to initialize project: \\n\");\n throw error;\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAUA,eAAsB,iBACpB,gBACkB;AAClB,KAAI;EAEF,MAAM,UAAU,eAAe,MAAM,IAAI,CAAC,KAAK;AAE/C,MAAI,CAAC,kBAAkB,eAAe,MAAM,KAAK,IAAI;AACnD,WAAQ,MAAM,iCAAiC;AAC/C,UAAO;;EAIT,MAAM,MAAM,IAAI,IAAI,eAAe;EACnC,MAAM,kBAAkB,GAAG,IAAI,SAAS,IAAI,IAAI,KAAK;EAErD,IAAI,YAAY,MAAM,kBAAkB,iBAAiB,QAAS;AAElE,MAAI,UAAU,WAAW,GAAG;AAC1B,WAAQ,IACN,yEACD;AACD,OAAI;AACF,UAAM,oBAAoB,iBAAiB,SAAU,gBAAgB;AAGrE,gBAAY,MAAM,kBAAkB,iBAAiB,QAAS;AAE9D,QAAI,UAAU,WA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GAClB,GAAG;GACH;GACA,gBAAgB;GAChB,KAAK;GACN,CAAC;AAEF,MAAI,aAAa;AACf,WAAQ,KAAK;AACb,WAAQ,IAAI,kCAAkC;AAC9C,WAAQ,KAAK;AACb,WAAQ,IAAI,yCAAyC;AACrD,WAAQ,IAAI,WAAW,OAAO;AAC9B,WAAQ,IAAI,mDAAmD;AAC/D,WAAQ,IAAI,+CAA+C;AAC3D,WAAQ,IAAI,+BAA+B;AAC3C,WAAQ,KAAK;;UAER,OAAO;AACd,UAAQ,MAAM,uCAAuC;AACrD,QAAM"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inspect-DRvimHBb.mjs","names":[],"sources":["../src/services/inspect.ts"],"sourcesContent":["import type { Manifest } from \"@powerhousedao/shared/document-model\";\nimport fs from \"node:fs\";\nimport type { InspectArgs } from \"../types.js\";\nimport { getProjectInfo } from \"../utils.js\";\nexport function startInspect(args: InspectArgs) {\n if (args.debug) {\n console.log(\">>> command arguments\", args);\n }\n\n const projectInfo = getProjectInfo(args.debug);\n const { packageName } = args;\n\n if (args.debug) {\n console.log(\"\\n>>> projectInfo\", projectInfo);\n }\n\n try {\n const loadManifest = (path: string) =>\n JSON.parse(fs.readFileSync(path, \"utf-8\")) as Manifest;\n const manifest = loadManifest(\n `${process.cwd()}/node_modules/${packageName}/dist/powerhouse.manifest.json`,\n );\n\n console.log(manifest.name);\n if (manifest.documentModels) {\n console.log(\"\\nDocument Models:\");\n manifest.documentModels.forEach((model) => {\n console.log(`- ${model.name} (${model.id})`);\n });\n }\n\n if (manifest.editors) {\n console.log(\"\\nEditors:\");\n manifest.editors.forEach((editor) => {\n console.log(`- ${editor.name} (${editor.id})`);\n });\n }\n\n if (manifest.processors) {\n console.log(\"\\nProcessors:\");\n manifest.processors.forEach((processor) => {\n console.log(`- ${processor.name} (${processor.id})`);\n });\n }\n\n if (manifest.subgraphs) {\n console.log(\"\\nSubgraphs:\");\n manifest.subgraphs.forEach((subgraph) => {\n console.log(`- ${subgraph.name} (${subgraph.id})`);\n });\n }\n } catch (e) {\n if (args.debug) {\n console.error(e);\n } else {\n console.log(\"No manifest found in the package\");\n }\n }\n}\n"],"mappings":";;;AAIA,SAAgB,aAAa,MAAmB;AAC9C,KAAI,KAAK,MACP,SAAQ,IAAI,yBAAyB,KAAK;CAG5C,MAAM,cAAc,eAAe,KAAK,MAAM;CAC9C,MAAM,EAAE,gBAAgB;AAExB,KAAI,KAAK,MACP,SAAQ,IAAI,qBAAqB,YAAY;AAG/C,KAAI;EACF,MAAM,gBAAgB,SACpB,KAAK,MAAM,GAAG,aAAa,MAAM,QAAQ,CAAC;EAC5C,MAAM,WAAW,aACf,GAAG,QAAQ,KAAK,CAAC,gBAAgB,YAAY,gCAC9C;AAED,UAAQ,IAAI,SAAS,KAAK;AAC1B,MAAI,SAAS,gBAAgB;AAC3B,WAAQ,IAAI,qBAAqB;AACjC,YAAS,eAAe,SAAS,UAAU;AACzC,YAAQ,IAAI,KAAK,MAAM,KAAK,IAAI,MAAM,GAAG,GAAG;KAC5C;;AAGJ,MAAI,SAAS,SAAS;AACpB,WAAQ,IAAI,aAAa;AACzB,YAAS,QAAQ,SAAS,WAAW;AACnC,YAAQ,IAAI,KAAK,OAAO,KAAK,IAAI,OAAO,GAAG,GAAG;KAC9C;;AAGJ,MAAI,SAAS,YAAY;AACvB,WAAQ,IAAI,gBAAgB;AAC5B,YAAS,WAAW,SAAS,cAAc;AACzC,YAAQ,IAAI,KAAK,UAAU,KAAK,IAAI,UAAU,GAAG,GAAG;KACpD;;AAGJ,MAAI,SAAS,WAAW;AACtB,WAAQ,IAAI,eAAe;AAC3B,YAAS,UAAU,SAAS,aAAa;AACvC,YAAQ,IAAI,KAAK,SAAS,KAAK,IAAI,SAAS,GAAG,GAAG;KAClD;;UAEG,GAAG;AACV,MAAI,KAAK,MACP,SAAQ,MAAM,EAAE;MAEhB,SAAQ,IAAI,mCAAmC"}
|
package/dist/logout-BpJEO2Ij.mjs
DELETED
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_EXPIRY_SECONDS, accessTokenArgs, getPowerhouseProjectInfo, listArgs, loginArgs } from "@powerhousedao/shared/clis";
|
|
2
|
-
import { command } from "cmd-ts";
|
|
3
|
-
import { getConfig as getConfig$1 } from "@powerhousedao/config/node";
|
|
4
|
-
//#region src/get-version.ts
|
|
5
|
-
function getVersion() {
|
|
6
|
-
return process.env.WORKSPACE_VERSION || process.env.npm_package_version || "unknown";
|
|
7
|
-
}
|
|
8
|
-
//#endregion
|
|
9
|
-
//#region src/commands/access-token.ts
|
|
10
|
-
const accessToken = command({
|
|
11
|
-
name: "access-token",
|
|
12
|
-
description: `
|
|
13
|
-
The access-token command generates a bearer token for API authentication. This token
|
|
14
|
-
can be used to authenticate requests to Powerhouse APIs like reactor-api (Switchboard).
|
|
15
|
-
|
|
16
|
-
This command:
|
|
17
|
-
1. Uses your CLI's cryptographic identity (DID) to sign a verifiable credential
|
|
18
|
-
2. Creates a JWT bearer token with configurable expiration
|
|
19
|
-
3. Outputs the token to stdout (info to stderr) for easy piping
|
|
20
|
-
|
|
21
|
-
Prerequisites:
|
|
22
|
-
You must have a cryptographic identity. Run 'ph login' first to:
|
|
23
|
-
- Generate a keypair (stored in .ph/.keypair.json)
|
|
24
|
-
- Optionally link your Ethereum address (stored in .ph/.renown.json)
|
|
25
|
-
|
|
26
|
-
Token Details:
|
|
27
|
-
The generated token is a JWT (JSON Web Token) containing:
|
|
28
|
-
- Issuer (iss): Your CLI's DID (did:key:...)
|
|
29
|
-
- Subject (sub): Your CLI's DID
|
|
30
|
-
- Credential Subject: Chain ID, network ID, and address (if authenticated)
|
|
31
|
-
- Expiration (exp): Based on --expiry option
|
|
32
|
-
- Audience (aud): If --audience is specified
|
|
33
|
-
|
|
34
|
-
Output:
|
|
35
|
-
- Token information (DID, address, expiry) is printed to stderr
|
|
36
|
-
- The token itself is printed to stdout for easy piping/copying
|
|
37
|
-
|
|
38
|
-
This allows you to use the command in scripts:
|
|
39
|
-
TOKEN=$(ph access-token)
|
|
40
|
-
curl -H "Authorization: Bearer $TOKEN" http://localhost:4001/graphql
|
|
41
|
-
|
|
42
|
-
Usage with APIs:
|
|
43
|
-
Generate token and use with curl
|
|
44
|
-
TOKEN=$(ph access-token --expiry 1d)
|
|
45
|
-
curl -X POST http://localhost:4001/graphql \\
|
|
46
|
-
-H "Content-Type: application/json" \\
|
|
47
|
-
-H "Authorization: Bearer $TOKEN" \\
|
|
48
|
-
-d '{"query": "{ drives { id name } }"}'
|
|
49
|
-
|
|
50
|
-
Export as environment variable
|
|
51
|
-
export PH_ACCESS_TOKEN=$(ph access-token)
|
|
52
|
-
|
|
53
|
-
Notes:
|
|
54
|
-
- Tokens are self-signed using your CLI's private key
|
|
55
|
-
- No network request is made; tokens are generated locally
|
|
56
|
-
- The recipient API must trust your CLI's DID to accept the token
|
|
57
|
-
- For reactor-api, ensure AUTH_ENABLED=true to require authentication
|
|
58
|
-
`,
|
|
59
|
-
args: accessTokenArgs,
|
|
60
|
-
handler: async (args) => {
|
|
61
|
-
if (args.debug) console.log(args);
|
|
62
|
-
const { generateAccessToken, parseExpiry, formatExpiry } = await import("@renown/sdk/node");
|
|
63
|
-
const { getRenown } = await import("./auth-mwX4ugZt.mjs");
|
|
64
|
-
const renown = await getRenown();
|
|
65
|
-
let expiresIn = DEFAULT_EXPIRY_SECONDS;
|
|
66
|
-
if (args.expiry) expiresIn = parseExpiry(args.expiry);
|
|
67
|
-
const result = await generateAccessToken(renown, {
|
|
68
|
-
expiresIn,
|
|
69
|
-
aud: args.audience
|
|
70
|
-
});
|
|
71
|
-
console.error(`CLI DID: ${result.did}`);
|
|
72
|
-
console.error(`ETH Address: ${result.address}`);
|
|
73
|
-
console.error(`Token expires in: ${formatExpiry(expiresIn)}`);
|
|
74
|
-
console.error("");
|
|
75
|
-
console.log(result.token);
|
|
76
|
-
process.exit(0);
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
//#endregion
|
|
80
|
-
//#region src/commands/list.ts
|
|
81
|
-
const list = command({
|
|
82
|
-
name: "list",
|
|
83
|
-
description: `
|
|
84
|
-
The list command displays information about installed Powerhouse packages in your project.
|
|
85
|
-
It reads the powerhouse.config.json file and shows the packages that are currently installed.
|
|
86
|
-
|
|
87
|
-
This command:
|
|
88
|
-
1. Examines your project configuration
|
|
89
|
-
2. Lists all installed Powerhouse packages
|
|
90
|
-
3. Provides a clear overview of your project's dependencies
|
|
91
|
-
4. Helps you manage and track your Powerhouse components
|
|
92
|
-
`,
|
|
93
|
-
aliases: ["l"],
|
|
94
|
-
args: listArgs,
|
|
95
|
-
handler: async (args) => {
|
|
96
|
-
if (args.debug) console.log(args);
|
|
97
|
-
try {
|
|
98
|
-
const projectInfo = await getPowerhouseProjectInfo();
|
|
99
|
-
console.log("\n>>> projectInfo", projectInfo);
|
|
100
|
-
const phConfig = getConfig$1(projectInfo.projectPath + "/powerhouse.config.json");
|
|
101
|
-
if (!phConfig.packages || phConfig.packages.length === 0) {
|
|
102
|
-
console.log("No packages found in the project");
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
console.log("Installed Packages:\n");
|
|
106
|
-
phConfig.packages.forEach((pkg) => {
|
|
107
|
-
console.log(pkg.packageName);
|
|
108
|
-
});
|
|
109
|
-
} catch (e) {
|
|
110
|
-
console.log("No packages found in the project");
|
|
111
|
-
}
|
|
112
|
-
process.exit(0);
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
//#endregion
|
|
116
|
-
//#region src/commands/login.ts
|
|
117
|
-
const login = command({
|
|
118
|
-
name: "login",
|
|
119
|
-
description: `
|
|
120
|
-
The login command authenticates you with Renown using your Ethereum wallet. This enables
|
|
121
|
-
the CLI to act on behalf of your Ethereum identity for authenticated operations.
|
|
122
|
-
|
|
123
|
-
This command:
|
|
124
|
-
1. Generates or loads a cryptographic identity (DID) for the CLI
|
|
125
|
-
2. Opens your browser to the Renown authentication page
|
|
126
|
-
3. You authorize the CLI's DID to act on behalf of your Ethereum address
|
|
127
|
-
4. Stores the credentials locally in .ph/.renown.json
|
|
128
|
-
`,
|
|
129
|
-
args: loginArgs,
|
|
130
|
-
handler: async (args) => {
|
|
131
|
-
if (args.debug) console.log(args);
|
|
132
|
-
const { getRenown } = await import("./auth-mwX4ugZt.mjs");
|
|
133
|
-
const renown = await getRenown(args.renownUrl);
|
|
134
|
-
if (args.showDid) {
|
|
135
|
-
console.log(renown.did);
|
|
136
|
-
process.exit(0);
|
|
137
|
-
}
|
|
138
|
-
if (args.status) {
|
|
139
|
-
const { getAuthStatus } = await import("@renown/sdk/node");
|
|
140
|
-
const status = getAuthStatus(renown);
|
|
141
|
-
if (!status.authenticated || !status.address) {
|
|
142
|
-
console.log("Not authenticated with an Ethereum address.");
|
|
143
|
-
console.log("Run \"ph login\" to authenticate.");
|
|
144
|
-
} else {
|
|
145
|
-
console.log("Authenticated");
|
|
146
|
-
console.log(` ETH Address: ${status.address}`);
|
|
147
|
-
console.log(` User DID: ${status.userDid}`);
|
|
148
|
-
console.log(` Chain ID: ${status.chainId}`);
|
|
149
|
-
console.log(` CLI DID: ${status.cliDid}`);
|
|
150
|
-
console.log(` Authenticated at: ${status.authenticatedAt?.toLocaleString()}`);
|
|
151
|
-
console.log(` Renown URL: ${status.baseUrl}`);
|
|
152
|
-
}
|
|
153
|
-
process.exit(0);
|
|
154
|
-
}
|
|
155
|
-
if (args.logout) {
|
|
156
|
-
await handleLogout();
|
|
157
|
-
process.exit(0);
|
|
158
|
-
}
|
|
159
|
-
const { browserLogin } = await import("@renown/sdk/node");
|
|
160
|
-
console.debug("Initializing cryptographic identity...");
|
|
161
|
-
console.log(`CLI DID: ${renown.did}`);
|
|
162
|
-
try {
|
|
163
|
-
const timeoutMs = args.timeout ? args.timeout * 1e3 : void 0;
|
|
164
|
-
const result = await browserLogin(renown, {
|
|
165
|
-
renownUrl: args.renownUrl,
|
|
166
|
-
timeoutMs,
|
|
167
|
-
onLoginUrl: (url, sessionId) => {
|
|
168
|
-
console.log("Opening browser for authentication...");
|
|
169
|
-
console.log(`Session ID: ${sessionId.slice(0, 8)}...`);
|
|
170
|
-
console.log(`Login URL: ${url}`);
|
|
171
|
-
console.log();
|
|
172
|
-
console.log("Waiting for authentication in browser");
|
|
173
|
-
console.log(`(timeout in ${(timeoutMs ?? 3e5) / 1e3} seconds)`);
|
|
174
|
-
console.log();
|
|
175
|
-
console.log("Please connect your wallet and authorize this CLI to act on your behalf.");
|
|
176
|
-
console.log();
|
|
177
|
-
process.stdout.write("Waiting");
|
|
178
|
-
},
|
|
179
|
-
onPollTick: () => process.stdout.write("."),
|
|
180
|
-
onBrowserOpenFailed: (url) => {
|
|
181
|
-
console.error("Failed to open browser automatically.");
|
|
182
|
-
console.log(`Please open this URL manually: ${url}`);
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
|
-
console.log();
|
|
186
|
-
console.log();
|
|
187
|
-
console.log("Successfully authenticated!");
|
|
188
|
-
console.log(` ETH Address: ${result.user.address}`);
|
|
189
|
-
console.log(` User DID: ${result.user.did}`);
|
|
190
|
-
console.log(` CLI DID: ${result.cliDid}`);
|
|
191
|
-
console.log();
|
|
192
|
-
console.log("The CLI can now act on behalf of your Ethereum identity.");
|
|
193
|
-
} catch (error) {
|
|
194
|
-
console.log();
|
|
195
|
-
throw error;
|
|
196
|
-
}
|
|
197
|
-
process.exit(0);
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
async function handleLogout() {
|
|
201
|
-
const { getRenown } = await import("./auth-mwX4ugZt.mjs");
|
|
202
|
-
const renown = await getRenown();
|
|
203
|
-
if (!renown.user) {
|
|
204
|
-
console.log("Not currently authenticated.");
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
207
|
-
try {
|
|
208
|
-
await renown.logout();
|
|
209
|
-
console.log("Successfully logged out.");
|
|
210
|
-
} catch (error) {
|
|
211
|
-
console.error("Failed to clear credentials.");
|
|
212
|
-
console.debug(error);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
//#endregion
|
|
216
|
-
//#region src/commands/logout.ts
|
|
217
|
-
const logout = command({
|
|
218
|
-
name: "logout",
|
|
219
|
-
description: `
|
|
220
|
-
The logout command removes an existing session created with 'ph login'`,
|
|
221
|
-
args: {},
|
|
222
|
-
handler: async () => {
|
|
223
|
-
await handleLogout();
|
|
224
|
-
process.exit(0);
|
|
225
|
-
}
|
|
226
|
-
});
|
|
227
|
-
//#endregion
|
|
228
|
-
export { getVersion as a, accessToken as i, login as n, list as r, logout as t };
|
|
229
|
-
|
|
230
|
-
//# sourceMappingURL=logout-BpJEO2Ij.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logout-BpJEO2Ij.mjs","names":["getConfig"],"sources":["../src/get-version.ts","../src/commands/access-token.ts","../src/commands/list.ts","../src/commands/login.ts","../src/commands/logout.ts"],"sourcesContent":["export function getVersion() {\n return (\n process.env.WORKSPACE_VERSION ||\n process.env.npm_package_version ||\n \"unknown\"\n );\n}\n","import {\n accessTokenArgs,\n DEFAULT_EXPIRY_SECONDS,\n} from \"@powerhousedao/shared/clis\";\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 { getConfig } from \"@powerhousedao/config/node\";\nimport { getPowerhouseProjectInfo, listArgs } from \"@powerhousedao/shared/clis\";\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 projectInfo = await getPowerhouseProjectInfo();\n console.log(\"\\n>>> projectInfo\", projectInfo);\n\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\";\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":";;;;AAAA,SAAgB,aAAa;AAC3B,QACE,QAAQ,IAAI,qBACZ,QAAQ,IAAI,uBACZ;;;;ACEJ,MAAa,cAAc,Q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5
|
-
if (debug) console.log({ args });
|
|
6
|
-
await migrate(version);
|
|
7
|
-
}
|
|
8
|
-
//#endregion
|
|
9
|
-
export { startMigrate };
|
|
10
|
-
|
|
11
|
-
//# sourceMappingURL=migrate-CSaC4bDh.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"migrate-CSaC4bDh.mjs","names":[],"sources":["../src/services/migrate.ts"],"sourcesContent":["import { migrate } from \"@powerhousedao/codegen\";\nimport type { MigrateArgs } from \"../types.js\";\n\nexport async function startMigrate(args: MigrateArgs) {\n const { version, debug } = args;\n if (debug) {\n console.log({ args });\n }\n await migrate(version);\n}\n"],"mappings":";;AAGA,eAAsB,aAAa,MAAmB;CACpD,MAAM,EAAE,SAAS,UAAU;AAC3B,KAAI,MACF,SAAQ,IAAI,EAAE,MAAM,CAAC;AAEvB,OAAM,QAAQ,QAAQ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"switchboard-Bl2llp5U.mjs","names":["startSwitchboard","startSwitchboardServer"],"sources":["../src/services/switchboard.ts"],"sourcesContent":["import type {\n IdentityOptions,\n StartServerOptions,\n} from \"@powerhousedao/switchboard/server\";\nimport { startSwitchboard as startSwitchboardServer } from \"@powerhousedao/switchboard/server\";\nimport type { ILogger } from \"document-model\";\nimport path from \"node:path\";\nimport type { SwitchboardArgs } from \"../types.js\";\n\nexport const defaultSwitchboardOptions = {\n port: 4001,\n dbPath: path.join(process.cwd(), \".ph/read-model.db\"),\n drive: {\n id: \"powerhouse\",\n slug: \"powerhouse\",\n global: {\n name: \"Powerhouse\",\n icon: \"https://ipfs.io/ipfs/QmcaTDBYn8X2psGaXe7iQ6qd8q6oqHLgxvMX9yXf7f9uP7\",\n },\n local: {\n availableOffline: true,\n listeners: [],\n sharingType: \"public\",\n triggers: [],\n },\n },\n mcp: true,\n} satisfies StartServerOptions;\n\nfunction getDefaultVetraSwitchboardOptions(\n vetraDriveId: string,\n): Partial<StartServerOptions> {\n return {\n port: 4001,\n dbPath: path.join(process.cwd(), \".ph/read-model.db\"),\n drive: {\n id: vetraDriveId,\n slug: vetraDriveId,\n global: {\n name: \"Vetra\",\n icon: \"https://azure-elderly-tortoise-212.mypinata.cloud/ipfs/bafkreibf2xokjqqtomqjd2w2xxmmhvogq4262csevclxh6sbrjgmjfre5u\",\n },\n preferredEditor: \"vetra-drive-app\",\n local: {\n availableOffline: true,\n listeners: [],\n sharingType: \"public\",\n triggers: [],\n },\n },\n };\n}\n\nexport async function startSwitchboard(\n options: SwitchboardArgs & {\n strictPort?: boolean;\n processorConfig?: Map<string, unknown>;\n },\n logger?: ILogger,\n) {\n const {\n packages: packagesString,\n remoteDrives,\n useVetraDrive,\n vetraDriveId,\n useIdentity,\n keypairPath,\n requireIdentity,\n ...serverOptions\n } = options;\n\n // Choose the appropriate default configuration\n const defaultOptions = useVetraDrive\n ? getDefaultVetraSwitchboardOptions(vetraDriveId)\n : defaultSwitchboardOptions;\n\n // Build identity options if enabled\n const identity: IdentityOptions | undefined =\n useIdentity || keypairPath || requireIdentity\n ? {\n keypairPath,\n requireExisting: requireIdentity,\n }\n : undefined;\n\n const packages = packagesString?.split(\",\");\n\n // Only include the default drive if no remote drives are provided\n const finalOptions =\n remoteDrives.length > 0\n ? {\n ...defaultOptions,\n drive: undefined, // Don't create default drive when syncing with remote\n ...serverOptions,\n remoteDrives,\n identity,\n packages,\n logger,\n }\n : {\n ...defaultOptions,\n ...serverOptions,\n remoteDrives,\n identity,\n packages,\n logger,\n };\n\n const reactor = await startSwitchboardServer(finalOptions);\n\n return reactor;\n}\n"],"mappings":";;;AASA,MAAa,4BAA4B;CACvC,MAAM;CACN,QAAQ,KAAK,KAAK,QAAQ,KAAK,EAAE,oBAAoB;CACrD,OAAO;EACL,IAAI;EACJ,MAAM;EACN,QAAQ;GACN,MAAM;GACN,MAAM;GACP;EACD,OAAO;GACL,kBAAkB;GAClB,WAAW,EAAE;GACb,aAAa;GACb,UAAU,EAAE;GACb;EACF;CACD,KAAK;CACN;AAED,SAAS,kCACP,cAC6B;AAC7B,QAAO;EACL,MAAM;EACN,QAAQ,KAAK,KAAK,QAAQ,KAAK,EAAE,oBAAoB;EACrD,OAAO;GACL,IAAI;GACJ,MAAM;GACN,QAAQ;IACN,MAAM;IACN,MAAM;IACP;GACD,iBAAiB;GACjB,OAAO;IACL,kBAAkB;IAClB,WAAW,EAAE;IACb,aAAa;IACb,UAAU,EAAE;IACb;GACF;EACF;;AAGH,eAAsBA,mBACpB,SAIA,QACA;CACA,MAAM,EACJ,UAAU,gBACV,cACA,eACA,cACA,aACA,aACA,iBACA,GAAG,kBACD;CAGJ,MAAM,iBAAiB,gBACnB,kCAAkC,aAAa,GAC/C;CAGJ,MAAM,WACJ,eAAe,eAAe,kBAC1B;EACE;EACA,iBAAiB;EAClB,GACD,KAAA;CAEN,MAAM,WAAW,gBAAgB,MAAM,IAAI;AAyB3C,QAFgB,MAAMC,iBAnBpB,aAAa,SAAS,IAClB;EACE,GAAG;EACH,OAAO,KAAA;EACP,GAAG;EACH;EACA;EACA;EACA;EACD,GACD;EACE,GAAG;EACH,GAAG;EACH;EACA;EACA;EACA;EACD,CAEmD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"switchboard-migrate-BiQJfIrc.mjs","names":[],"sources":["../src/services/switchboard-migrate.ts"],"sourcesContent":["import { Kysely, PostgresDialect } from \"kysely\";\nimport { Pool } from \"pg\";\nimport {\n runMigrations,\n getMigrationStatus,\n REACTOR_SCHEMA,\n} from \"@powerhousedao/reactor\";\n\ninterface MigrationOptions {\n dbPath?: string;\n statusOnly?: boolean;\n}\n\nfunction isPostgresUrl(url: string): boolean {\n return url.startsWith(\"postgresql://\") || url.startsWith(\"postgres://\");\n}\n\nexport async function runSwitchboardMigrations(\n options: MigrationOptions,\n): Promise<void> {\n const dbPath =\n options.dbPath ??\n process.env.PH_REACTOR_DATABASE_URL ??\n process.env.DATABASE_URL;\n\n if (!dbPath || !isPostgresUrl(dbPath)) {\n console.log(\"No PostgreSQL URL configured. Skipping migrations.\");\n console.log(\"(PGlite migrations are handled automatically on startup)\");\n return;\n }\n\n console.log(`Database: ${dbPath}`);\n\n const pool = new Pool({ connectionString: dbPath });\n\n const db = new Kysely<any>({\n dialect: new PostgresDialect({ pool }),\n });\n\n try {\n if (options.statusOnly) {\n console.log(\"\\nChecking migration status...\");\n const migrations = await getMigrationStatus(db, REACTOR_SCHEMA);\n\n console.log(\"\\nMigration Status:\");\n console.log(\"=================\");\n\n for (const migration of migrations) {\n const status = migration.executedAt\n ? `[OK] Executed at ${migration.executedAt.toISOString()}`\n : \"[--] Pending\";\n console.log(`${status} - ${migration.name}`);\n }\n } else {\n console.log(\"\\nRunning migrations...\");\n const result = await runMigrations(db, REACTOR_SCHEMA);\n\n if (!result.success) {\n console.error(\"Migration failed:\", result.error?.message);\n process.exit(1);\n }\n\n if (result.migrationsExecuted.length === 0) {\n console.log(\"No migrations to run - database is up to date\");\n } else {\n console.log(\n `Successfully executed ${result.migrationsExecuted.length} migration(s):`,\n );\n for (const name of result.migrationsExecuted) {\n console.log(` - ${name}`);\n }\n }\n }\n } catch (error) {\n console.error(\n \"Error:\",\n error instanceof Error ? error.message : String(error),\n );\n process.exit(1);\n } finally {\n await db.destroy();\n }\n}\n"],"mappings":";;;;AAaA,SAAS,cAAc,KAAsB;AAC3C,QAAO,IAAI,WAAW,gBAAgB,IAAI,IAAI,WAAW,cAAc;;AAGzE,eAAsB,yBACpB,SACe;CACf,MAAM,SACJ,QAAQ,UACR,QAAQ,IAAI,2BACZ,QAAQ,IAAI;AAEd,KAAI,CAAC,UAAU,CAAC,cAAc,OAAO,EAAE;AACrC,UAAQ,IAAI,qDAAqD;AACjE,UAAQ,IAAI,2DAA2D;AACvE;;AAGF,SAAQ,IAAI,aAAa,SAAS;CAIlC,MAAM,KAAK,IAAI,OAAY,EACzB,SAAS,IAAI,gBAAgB,EAAE,MAHpB,IAAI,KAAK,EAAE,kBAAkB,QAAQ,CAAC,EAGZ,CAAC,EACvC,CAAC;AAEF,KAAI;AACF,MAAI,QAAQ,YAAY;AACtB,WAAQ,IAAI,iCAAiC;GAC7C,MAAM,aAAa,MAAM,mBAAmB,IAAI,eAAe;AAE/D,WAAQ,IAAI,sBAAsB;AAClC,WAAQ,IAAI,oBAAoB;AAEhC,QAAK,MAAM,aAAa,YAAY;IAClC,MAAM,SAAS,UAAU,aACrB,oBAAoB,UAAU,WAAW,aAAa,KACtD;AACJ,YAAQ,IAAI,GAAG,OAAO,KAAK,UAAU,OAAO;;SAEzC;AACL,WAAQ,IAAI,0BAA0B;GACtC,MAAM,SAAS,MAAM,cAAc,IAAI,eAAe;AAEtD,OAAI,CAAC,OAAO,SAAS;AACnB,YAAQ,MAAM,qBAAqB,OAAO,OAAO,QAAQ;AACzD,YAAQ,KAAK,EAAE;;AAGjB,OAAI,OAAO,mBAAmB,WAAW,EACvC,SAAQ,IAAI,gDAAgD;QACvD;AACL,YAAQ,IACN,yBAAyB,OAAO,mBAAmB,OAAO,gBAC3D;AACD,SAAK,MAAM,QAAQ,OAAO,mBACxB,SAAQ,IAAI,OAAO,OAAO;;;UAIzB,OAAO;AACd,UAAQ,MACN,UACA,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CACvD;AACD,UAAQ,KAAK,EAAE;WACP;AACR,QAAM,GAAG,SAAS"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils-C6_gv4nB.mjs","names":[],"sources":["../src/utils.ts"],"sourcesContent":["import type { PowerhouseConfig } from \"@powerhousedao/config\";\nimport crypto from \"node:crypto\";\nimport fs from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport path, { dirname } from \"node:path\";\nexport const POWERHOUSE_CONFIG_FILE = \"powerhouse.config.json\";\nexport const POWERHOUSE_GLOBAL_DIR = path.join(homedir(), \".ph\");\nexport const SUPPORTED_PACKAGE_MANAGERS = [\"npm\", \"yarn\", \"pnpm\", \"bun\"];\n\nexport const packageManagers = {\n bun: {\n globalPathRegexp: /[\\\\/].bun[\\\\/]/,\n installCommand: \"bun add {{dependency}}\",\n uninstallCommand: \"bun remove {{dependency}}\",\n workspaceOption: \"\",\n lockfile: \"bun.lock\",\n updateCommand: \"bun update {{dependency}}\",\n buildAffected: \"bun run build:affected\",\n },\n pnpm: {\n globalPathRegexp: /[\\\\/]pnpm[\\\\/]/,\n installCommand: \"pnpm add {{dependency}}\",\n uninstallCommand: \"pnpm remove {{dependency}}\",\n workspaceOption: \"--workspace-root\",\n lockfile: \"pnpm-lock.yaml\",\n updateCommand: \"pnpm update {{dependency}}\",\n buildAffected: \"pnpm run build:affected\",\n },\n yarn: {\n globalPathRegexp: /[\\\\/]yarn[\\\\/]/,\n installCommand: \"yarn add {{dependency}}\",\n uninstallCommand: \"yarn remove {{dependency}}\",\n workspaceOption: \"-W\",\n lockfile: \"yarn.lock\",\n updateCommand: \"yarn upgrade {{dependency}}\",\n buildAffected: \"yarn run build:affected\",\n },\n npm: {\n installCommand: \"npm install {{dependency}}\",\n uninstallCommand: \"npm uninstall {{dependency}}\",\n workspaceOption: \"\",\n lockfile: \"package-lock.json\",\n updateCommand: \"npm update {{dependency}} --save\",\n buildAffected: \"npm run build:affected\",\n },\n};\n\ntype PathValidation = (dir: string) => boolean;\n\nexport type PackageManager = \"npm\" | \"yarn\" | \"pnpm\" | \"bun\";\n\nexport type ProjectInfo = {\n isGlobal: boolean;\n path: string;\n packageManager: PackageManager;\n};\n\nexport function defaultPathValidation() {\n return true;\n}\n\nexport function isPowerhouseProject(dir: string) {\n const powerhouseConfigPath = path.join(dir, POWERHOUSE_CONFIG_FILE);\n\n return fs.existsSync(powerhouseConfigPath);\n}\n\nexport function findNodeProjectRoot(\n dir: string,\n pathValidation: PathValidation = defaultPathValidation,\n) {\n const packageJsonPath = path.join(dir, \"package.json\");\n\n if (fs.existsSync(packageJsonPath) && pathValidation(dir)) {\n return dir;\n }\n\n const parentDir = dirname(dir);\n\n if (parentDir === dir) {\n return null;\n }\n\n return findNodeProjectRoot(parentDir, pathValidation);\n}\n\nexport function getProjectInfo(debug?: boolean): ProjectInfo {\n const currentPath = process.cwd();\n\n if (debug) {\n console.log(\">>> currentPath\", currentPath);\n }\n\n const projectPath = findNodeProjectRoot(currentPath, isPowerhouseProject);\n\n if (!projectPath) {\n return {\n isGlobal: true,\n path: POWERHOUSE_GLOBAL_DIR,\n packageManager: getPackageManagerFromLockfile(POWERHOUSE_GLOBAL_DIR),\n };\n }\n\n return {\n isGlobal: false,\n path: projectPath,\n packageManager: getPackageManagerFromLockfile(projectPath),\n };\n}\n\n/**\n * Generates a unique drive ID based on the project path.\n * The same project path will always generate the same ID.\n * @param name - The name prefix for the drive ID (e.g., \"vetra\", \"powerhouse\")\n * @returns A unique drive ID in the format \"{name}-{hash}\"\n */\nexport function generateProjectDriveId(name: string): string {\n const projectInfo = getProjectInfo();\n const hash = crypto\n .createHash(\"sha256\")\n .update(projectInfo.path)\n .digest(\"hex\");\n const shortHash = hash.substring(0, 8);\n return `${name}-${shortHash}`;\n}\n\nexport function getPackageManagerFromLockfile(dir: string): PackageManager {\n if (fs.existsSync(path.join(dir, packageManagers.pnpm.lockfile))) {\n return \"pnpm\";\n } else if (fs.existsSync(path.join(dir, packageManagers.yarn.lockfile))) {\n return \"yarn\";\n } else if (fs.existsSync(path.join(dir, packageManagers.bun.lockfile))) {\n return \"bun\";\n }\n\n return \"npm\";\n}\n\nexport function updatePackagesArray(\n currentPackages: PowerhouseConfig[\"packages\"] = [],\n dependencies: { name: string; version: string | undefined }[],\n task: \"install\" | \"uninstall\" = \"install\",\n provider: \"registry\" | \"local\" = \"registry\",\n): PowerhouseConfig[\"packages\"] {\n const isInstall = task === \"install\";\n const mappedPackages = dependencies.map((dep) => ({\n packageName: dep.name,\n version: dep.version,\n provider,\n }));\n\n if (isInstall) {\n // Overwrite existing package if version is different\n const filteredPackages = currentPackages.filter(\n (pkg) => !dependencies.find((dep) => dep.name === pkg.packageName),\n );\n return [...filteredPackages, ...mappedPackages];\n }\n\n return currentPackages.filter(\n (pkg) => !dependencies.map((dep) => dep.name).includes(pkg.packageName),\n );\n}\n\n// Modify updateConfigFile to use the new function\nexport function updateConfigFile(\n dependencies: { name: string; version: string | undefined }[],\n projectPath: string,\n task: \"install\" | \"uninstall\" = \"install\",\n provider: \"registry\" | \"local\" = \"registry\",\n registryUrl?: string,\n) {\n const configPath = path.join(projectPath, POWERHOUSE_CONFIG_FILE);\n\n if (!fs.existsSync(configPath)) {\n throw new Error(\n `powerhouse.config.json file not found. projectPath: ${projectPath}`,\n );\n }\n\n const config = JSON.parse(\n fs.readFileSync(configPath, \"utf-8\"),\n ) as PowerhouseConfig;\n\n const updatedConfig: PowerhouseConfig = {\n ...config,\n packages: updatePackagesArray(\n config.packages,\n dependencies,\n task,\n provider,\n ),\n };\n\n if (\n task === \"install\" &&\n registryUrl &&\n !config.packageRegistryUrl &&\n dependencies.length > 0\n ) {\n updatedConfig.packageRegistryUrl = registryUrl;\n }\n\n fs.writeFileSync(configPath, JSON.stringify(updatedConfig, null, 2));\n}\n\n/**\n * Recursively searches for a specific file by traversing up the directory tree.\n * Starting from the given path, it checks each parent directory until it finds\n * the target file or reaches the root directory.\n *\n * @param startPath - The absolute path of the directory to start searching from\n * @param targetFile - The name of the file to search for (e.g., 'package.json', 'pnpm-workspace.yaml')\n * @returns The absolute path of the directory containing the target file, or null if not found\n *\n * @example\n * // Find the workspace root directory\n * const workspaceRoot = findContainerDirectory('/path/to/project/src', 'pnpm-workspace.yaml');\n *\n * // Find the nearest package.json\n * const packageDir = findContainerDirectory('/path/to/project/src/components', 'package.json');\n */\nexport const findContainerDirectory = (\n startPath: string,\n targetFile: string,\n): string | null => {\n const filePath = path.join(startPath, targetFile);\n\n if (fs.existsSync(filePath)) {\n return startPath;\n }\n\n const parentDir = path.dirname(startPath);\n\n //reached the root directory and haven't found the file\n if (parentDir === startPath) {\n return null;\n }\n\n return findContainerDirectory(parentDir, targetFile);\n};\n\n/**\n * Updates the styles.css file to include imports for newly installed packages\n * @param dependencies - Array of dependencies that were installed\n * @param projectPath - Path to the project root\n */\nexport function updateStylesFile(\n dependencies: { name: string; version: string | undefined }[],\n projectPath: string,\n) {\n const stylesPath = path.join(projectPath, \"style.css\");\n\n // Check if styles.css exists\n if (!fs.existsSync(stylesPath)) {\n console.warn(\"⚠️ Warning: style.css file not found in project root\");\n return;\n }\n\n const currentStyles = fs.readFileSync(stylesPath, \"utf-8\");\n let updatedStyles = currentStyles;\n\n for (const dep of dependencies) {\n const cssPath = `./node_modules/${dep.name}/dist/style.css`;\n const fullCssPath = path.join(projectPath, cssPath);\n const importStatement = `@import '${cssPath}';`;\n\n // Check if the CSS file exists\n if (!fs.existsSync(fullCssPath)) {\n console.warn(`⚠️ Warning: CSS file not found at ${cssPath}`);\n continue;\n }\n\n // Check if import already exists\n if (currentStyles.includes(importStatement)) {\n continue;\n }\n\n // Find the last @import statement\n const importLines = currentStyles\n .split(\"\\n\")\n .filter((line) => line.trim().startsWith(\"@import\"));\n const lastImport = importLines[importLines.length - 1];\n\n if (lastImport) {\n // Insert new import after the last existing import\n updatedStyles = currentStyles.replace(\n lastImport,\n `${lastImport}\\n${importStatement}`,\n );\n } else {\n // If no imports exist, add at the top of the file\n updatedStyles = `${importStatement}\\n${currentStyles}`;\n }\n }\n\n // Only write if changes were made\n if (updatedStyles !== currentStyles) {\n fs.writeFileSync(stylesPath, updatedStyles);\n }\n}\n\n/**\n * Removes CSS imports for uninstalled packages from styles.css\n */\nexport function removeStylesImports(\n dependencies: { name: string; version: string | undefined }[],\n projectPath: string,\n) {\n const stylesPath = path.join(projectPath, \"style.css\");\n\n // Check if styles.css exists\n if (!fs.existsSync(stylesPath)) {\n console.warn(\"⚠️ Warning: style.css file not found in project root\");\n return;\n }\n\n const currentStyles = fs.readFileSync(stylesPath, \"utf-8\");\n let updatedStyles = currentStyles;\n\n for (const dep of dependencies) {\n const cssPath = `./node_modules/${dep.name}/dist/style.css`;\n const importStatement = `@import '${cssPath}';`;\n\n // Remove the import line if it exists\n const lines = updatedStyles.split(\"\\n\");\n const filteredLines = lines.filter(\n (line) => !line.trim().includes(importStatement),\n );\n\n if (filteredLines.length !== lines.length) {\n updatedStyles = filteredLines.join(\"\\n\");\n }\n }\n\n // Only write if changes were made\n if (updatedStyles !== currentStyles) {\n fs.writeFileSync(stylesPath, updatedStyles);\n }\n}\n"],"mappings":";;;;;AAKA,MAAa,yBAAyB;AACtC,MAAa,wBAAwB,KAAK,KAAK,SAAS,EAAE,MAAM;AAGhE,MAAa,kBAAkB;CAC7B,KAAK;EACH,kBAAkB;EAClB,gBAAgB;EAChB,kBAAkB;EAClB,iBAAiB;EACjB,UAAU;EACV,eAAe;EACf,eAAe;EAChB;CACD,MAAM;EACJ,kBAAkB;EAClB,gBAAgB;EAChB,kBAAkB;EAClB,iBAAiB;EACjB,UAAU;EACV,eAAe;EACf,eAAe;EAChB;CACD,MAAM;EACJ,kBAAkB;EAClB,gBAAgB;EAChB,kBAAkB;EAClB,iBAAiB;EACjB,UAAU;EACV,eAAe;EACf,eAAe;EAChB;CACD,KAAK;EACH,gBAAgB;EAChB,kBAAkB;EAClB,iBAAiB;EACjB,UAAU;EACV,eAAe;EACf,eAAe;EAChB;CACF;AAYD,SAAgB,wBAAwB;AACtC,QAAO;;AAGT,SAAgB,oBAAoB,KAAa;CAC/C,MAAM,uBAAuB,KAAK,KAAK,KAAK,uBAAuB;AAEnE,QAAO,GAAG,WAAW,qBAAqB;;AAG5C,SAAgB,oBACd,KACA,iBAAiC,uBACjC;CACA,MAAM,kBAAkB,KAAK,KAAK,KAAK,eAAe;AAEtD,KAAI,GAAG,WAAW,gBAAgB,IAAI,eAAe,IAAI,CACvD,QAAO;CAGT,MAAM,YAAY,QAAQ,IAAI;AAE9B,KAAI,cAAc,IAChB,QAAO;AAGT,QAAO,oBAAoB,WAAW,eAAe;;AAGvD,SAAgB,eAAe,OAA8B;CAC3D,MAAM,cAAc,QAAQ,KAAK;AAEjC,KAAI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