@powerhousedao/ph-cli 6.0.0-dev.234 → 6.0.0-dev.236
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{assign-env-vars-DZMMuzB2.mjs → assign-env-vars-W-lZmdMi.mjs} +1 -1
- package/dist/{assign-env-vars-DZMMuzB2.mjs.map → assign-env-vars-W-lZmdMi.mjs.map} +1 -1
- package/dist/{auth-Ch5B5mNU.mjs → auth-AR3VxAIk.mjs} +1 -1
- package/dist/{auth-Ch5B5mNU.mjs.map → auth-AR3VxAIk.mjs.map} +1 -1
- package/dist/auth-BNkN6kS9.mjs +2 -0
- package/dist/{build-DCXpFtjA.mjs → build-CYAQMjy1.mjs} +1 -1
- package/dist/{build-DCXpFtjA.mjs.map → build-CYAQMjy1.mjs.map} +1 -1
- package/dist/build-DzxGiqu2.mjs +2 -0
- package/dist/cli.mjs +252 -49
- package/dist/cli.mjs.map +1 -1
- package/dist/{connect-build-6yhCIKkQ.mjs → connect-build-BIvwnJ8o.mjs} +3 -3
- package/dist/{connect-build-6yhCIKkQ.mjs.map → connect-build-BIvwnJ8o.mjs.map} +1 -1
- package/dist/{connect-preview-CaEiWmqU.mjs → connect-preview-CNJkhtxL.mjs} +2 -2
- package/dist/{connect-preview-CaEiWmqU.mjs.map → connect-preview-CNJkhtxL.mjs.map} +1 -1
- package/dist/{connect-studio-BaqbrWYQ.mjs → connect-studio-DTdSFftL.mjs} +2 -2
- package/dist/{connect-studio-BaqbrWYQ.mjs.map → connect-studio-DTdSFftL.mjs.map} +1 -1
- package/dist/connect-studio-DySbZFEc.mjs +3 -0
- package/dist/{generate-all-DaXXjoms.mjs → generate-all-Cj8zjFhN.mjs} +1 -1
- package/dist/{generate-all-DaXXjoms.mjs.map → generate-all-Cj8zjFhN.mjs.map} +1 -1
- package/dist/{generate-app-GvQeAG4w.mjs → generate-app-KE0rbE-b.mjs} +1 -1
- package/dist/{generate-app-GvQeAG4w.mjs.map → generate-app-KE0rbE-b.mjs.map} +1 -1
- package/dist/{generate-document-model-Dnik0rKd.mjs → generate-document-model-Cut44i6D.mjs} +1 -1
- package/dist/{generate-document-model-Dnik0rKd.mjs.map → generate-document-model-Cut44i6D.mjs.map} +1 -1
- package/dist/{generate-editor-BNN2OmmX.mjs → generate-editor-DmSzWm3W.mjs} +1 -1
- package/dist/{generate-editor-BNN2OmmX.mjs.map → generate-editor-DmSzWm3W.mjs.map} +1 -1
- package/dist/{generate-processor-CCSW2Ed2.mjs → generate-processor-BcuHtOSn.mjs} +1 -1
- package/dist/{generate-processor-CCSW2Ed2.mjs.map → generate-processor-BcuHtOSn.mjs.map} +1 -1
- package/dist/{generate-subgraph-B-d3J6hU.mjs → generate-subgraph-sh0GWC6T.mjs} +1 -1
- package/dist/{generate-subgraph-B-d3J6hU.mjs.map → generate-subgraph-sh0GWC6T.mjs.map} +1 -1
- package/dist/{init-8FtJDKxG.mjs → init-Cw_5H_Z1.mjs} +1 -1
- package/dist/{init-8FtJDKxG.mjs.map → init-Cw_5H_Z1.mjs.map} +1 -1
- package/dist/{inspect-BwkihsT7.mjs → inspect-BwuBW_zW.mjs} +2 -2
- package/dist/{inspect-BwkihsT7.mjs.map → inspect-BwuBW_zW.mjs.map} +1 -1
- package/dist/{migrate-B-O6P7jA.mjs → migrate-DCUKk5c2.mjs} +1 -1
- package/dist/{migrate-B-O6P7jA.mjs.map → migrate-DCUKk5c2.mjs.map} +1 -1
- package/dist/{registry-auth-BX9_n8hE.mjs → registry-auth-CNH84uo4.mjs} +2 -2
- package/dist/{registry-auth-BX9_n8hE.mjs.map → registry-auth-CNH84uo4.mjs.map} +1 -1
- package/dist/{switchboard-CJMoMzWx.mjs → switchboard-BsdbF-rL.mjs} +1 -1
- package/dist/{switchboard-CJMoMzWx.mjs.map → switchboard-BsdbF-rL.mjs.map} +1 -1
- package/dist/switchboard-GTBlxiJZ.mjs +2 -0
- package/dist/{switchboard-migrate-BRgCgg7N.mjs → switchboard-migrate-BumRp7rC.mjs} +1 -1
- package/dist/{switchboard-migrate-BRgCgg7N.mjs.map → switchboard-migrate-BumRp7rC.mjs.map} +1 -1
- package/dist/{utils-DkOZWO0i.mjs → utils-C6581aex.mjs} +1 -1
- package/dist/{utils-D7x443W6.mjs → utils-mth8NsDA.mjs} +1 -1
- package/dist/{utils-D7x443W6.mjs.map → utils-mth8NsDA.mjs.map} +1 -1
- package/dist/{vetra-xk2hwf6X.mjs → vetra-_JnFPpL5.mjs} +5 -5
- package/dist/{vetra-xk2hwf6X.mjs.map → vetra-_JnFPpL5.mjs.map} +1 -1
- package/package.json +10 -14
- package/dist/auth-Dq7JjwYn.mjs +0 -2
- package/dist/build-CWcQj0YI.mjs +0 -2
- package/dist/cli-CeYM2N3E.mjs +0 -140
- package/dist/cli-CeYM2N3E.mjs.map +0 -1
- package/dist/connect-studio-Dndkp0Q_.mjs +0 -3
- package/dist/logout-Bv_I1Y4Q.mjs +0 -232
- package/dist/logout-Bv_I1Y4Q.mjs.map +0 -1
- package/dist/switchboard-iRFugh8I.mjs +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assign-env-vars-
|
|
1
|
+
{"version":3,"file":"assign-env-vars-W-lZmdMi.mjs","names":[],"sources":["../src/utils/assign-env-vars.ts"],"sourcesContent":["import type {\n ConnectBuildArgs,\n ConnectPreviewArgs,\n ConnectStudioArgs,\n} from \"../types.js\";\nimport { setConnectEnv } from \"@powerhousedao/shared/connect\";\n\nexport function assignEnvVars(\n args: ConnectBuildArgs | ConnectPreviewArgs | ConnectStudioArgs,\n) {\n const {\n connectBasePath,\n defaultDrivesUrl,\n drivesPreserveStrategy,\n disableLocalPackages,\n } = args;\n\n setConnectEnv({\n PH_CONNECT_BASE_PATH: connectBasePath,\n PH_CONNECT_DEFAULT_DRIVES_URL: defaultDrivesUrl,\n PH_CONNECT_DRIVES_PRESERVE_STRATEGY: drivesPreserveStrategy,\n PH_DISABLE_LOCAL_PACKAGE: disableLocalPackages,\n });\n}\n"],"mappings":";;AAOA,SAAgB,cACd,MACA;CACA,MAAM,EACJ,iBACA,kBACA,wBACA,yBACE;AAEJ,eAAc;EACZ,sBAAsB;EACtB,+BAA+B;EAC/B,qCAAqC;EACrC,0BAA0B;EAC3B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-
|
|
1
|
+
{"version":3,"file":"auth-AR3VxAIk.mjs","names":[],"sources":["../src/services/auth.ts"],"sourcesContent":["import { RenownBuilder, type IRenown } from \"@renown/sdk/node\";\n\n// Singleton instance of Renown\nlet renownInstance: IRenown | null = null;\n\n/**\n * Get or create the Renown instance\n * Uses PH_RENOWN_PRIVATE_KEY env var if set, otherwise generates/loads from file\n */\nexport async function getRenown(baseUrl?: string): Promise<IRenown> {\n if (!renownInstance) {\n renownInstance = await new RenownBuilder(\"ph-cli\", { baseUrl }).build();\n }\n return renownInstance;\n}\n"],"mappings":";;AAGA,IAAI,iBAAiC;;;;;AAMrC,eAAsB,UAAU,SAAoC;AAClE,KAAI,CAAC,eACH,kBAAiB,MAAM,IAAI,cAAc,UAAU,EAAE,SAAS,CAAC,CAAC,OAAO;AAEzE,QAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-
|
|
1
|
+
{"version":3,"file":"build-CYAQMjy1.mjs","names":["tsdownBuild"],"sources":["../src/services/build.ts"],"sourcesContent":["import {\n browserBuildConfig,\n nodeBuildConfig,\n} from \"@powerhousedao/shared/clis\";\nimport { execSync } from \"node:child_process\";\nimport { join } from \"node:path\";\nimport { detect, resolveCommand } from \"package-manager-detector\";\nimport { build as tsdownBuild } from \"tsdown\";\nimport type { BuildArgs } from \"../types.js\";\n\nexport async function runBuild(args: BuildArgs) {\n const { outDir } = args;\n\n await tsdownBuild({\n ...browserBuildConfig,\n outDir: join(outDir, \"browser\"),\n });\n\n await tsdownBuild({\n ...nodeBuildConfig,\n outDir: join(outDir, \"node\"),\n });\n\n const detectResult = await detect();\n const agent = detectResult?.agent ?? \"npm\";\n\n // Emit types with tsc\n const tscCommand = resolveCommand(agent, \"execute-local\", [\"tsc\"]);\n if (tscCommand === null) {\n console.error(\n \"You need to have typescript installed to use the `build` command.\",\n );\n process.exit(1);\n }\n console.log(\"\\n▶ Emitting types via tsc...\");\n try {\n execSync(`${tscCommand.command} ${tscCommand.args.join(\" \")}`, {\n stdio: \"inherit\",\n });\n console.log(\"✔ Types emitted to\", join(outDir, \"types\"));\n } catch {\n console.warn(\n \"✘ tsc reported errors above; declarations were still written. Fix the errors to keep types accurate.\",\n );\n }\n\n const executeLocalCommand = resolveCommand(agent, \"execute-local\", [\n \"tailwindcss\",\n \"-i\",\n \"./style.css\",\n \"-o\",\n \"./dist/style.css\",\n ]);\n if (executeLocalCommand === null) {\n console.error(\n \"You need to have tailwindcss installed to use the `build` command.\",\n );\n process.exit(1);\n }\n execSync(\n `${executeLocalCommand.command} ${executeLocalCommand.args.join(\" \")}`,\n );\n}\n"],"mappings":";;;;;;AAUA,eAAsB,SAAS,MAAiB;CAC9C,MAAM,EAAE,WAAW;AAEnB,OAAMA,MAAY;EAChB,GAAG;EACH,QAAQ,KAAK,QAAQ,UAAU;EAChC,CAAC;AAEF,OAAMA,MAAY;EAChB,GAAG;EACH,QAAQ,KAAK,QAAQ,OAAO;EAC7B,CAAC;CAGF,MAAM,SADe,MAAM,QAAQ,GACP,SAAS;CAGrC,MAAM,aAAa,eAAe,OAAO,iBAAiB,CAAC,MAAM,CAAC;AAClE,KAAI,eAAe,MAAM;AACvB,UAAQ,MACN,oEACD;AACD,UAAQ,KAAK,EAAE;;AAEjB,SAAQ,IAAI,gCAAgC;AAC5C,KAAI;AACF,WAAS,GAAG,WAAW,QAAQ,GAAG,WAAW,KAAK,KAAK,IAAI,IAAI,EAC7D,OAAO,WACR,CAAC;AACF,UAAQ,IAAI,sBAAsB,KAAK,QAAQ,QAAQ,CAAC;SAClD;AACN,UAAQ,KACN,uGACD;;CAGH,MAAM,sBAAsB,eAAe,OAAO,iBAAiB;EACjE;EACA;EACA;EACA;EACA;EACD,CAAC;AACF,KAAI,wBAAwB,MAAM;AAChC,UAAQ,MACN,qEACD;AACD,UAAQ,KAAK,EAAE;;AAEjB,UACE,GAAG,oBAAoB,QAAQ,GAAG,oBAAoB,KAAK,KAAK,IAAI,GACrE"}
|
package/dist/cli.mjs
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as getVersion, i as accessToken, n as login, r as list, t as logout } from "./logout-Bv_I1Y4Q.mjs";
|
|
3
2
|
import { assertNodeVersion } from "@powerhousedao/shared/clis/utils";
|
|
4
3
|
import { captureCliError, initCliTelemetry } from "@powerhousedao/shared/clis/telemetry";
|
|
5
4
|
import { array, boolean, command, flag, multioption, oneOf, option, optional, run, string, subcommands } from "cmd-ts";
|
|
6
|
-
import { AGENTS,
|
|
5
|
+
import { AGENTS, accessTokenArgs, buildArgs, connectBuildArgs, connectPreviewArgs, connectStudioArgs, debugArgs, initArgs, inspectArgs, installArgs, listArgs, loginArgs, migrateArgs, phCliHelpCommands, publishArgs, registryLoginArgs, switchboardArgs, uninstallArgs, unpublishArgs, vetraArgs } from "@powerhousedao/shared/clis/args";
|
|
6
|
+
import { DEFAULT_EXPIRY_SECONDS } from "@powerhousedao/shared/clis/constants";
|
|
7
7
|
import { Directory, File } from "cmd-ts/dist/cjs/batteries/fs.js";
|
|
8
8
|
import path from "path";
|
|
9
9
|
import { PROCESSOR_APPS } from "@powerhousedao/shared/processors";
|
|
10
10
|
import { execSync } from "child_process";
|
|
11
11
|
import { execSync as execSync$1 } from "node:child_process";
|
|
12
12
|
import { createInterface } from "node:readline/promises";
|
|
13
|
+
//#region src/get-version.ts
|
|
14
|
+
function getVersion() {
|
|
15
|
+
return "6.0.0-dev.236";
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
13
18
|
//#region src/utils/constants.ts
|
|
14
19
|
const PH_CLI_DESCRIPTION = "The Powerhouse CLI (ph-cli) is a command-line interface tool that provides essential commands for managing Powerhouse projects. The tool and it's commands are fundamental for creating, building, and running Document Models as a builder in studio mode.";
|
|
15
20
|
const phCliHelp = subcommands({
|
|
@@ -19,6 +24,77 @@ const phCliHelp = subcommands({
|
|
|
19
24
|
cmds: phCliHelpCommands
|
|
20
25
|
});
|
|
21
26
|
//#endregion
|
|
27
|
+
//#region src/commands/access-token.ts
|
|
28
|
+
const accessToken = command({
|
|
29
|
+
name: "access-token",
|
|
30
|
+
description: `
|
|
31
|
+
The access-token command generates a bearer token for API authentication. This token
|
|
32
|
+
can be used to authenticate requests to Powerhouse APIs like reactor-api (Switchboard).
|
|
33
|
+
|
|
34
|
+
This command:
|
|
35
|
+
1. Uses your CLI's cryptographic identity (DID) to sign a verifiable credential
|
|
36
|
+
2. Creates a JWT bearer token with configurable expiration
|
|
37
|
+
3. Outputs the token to stdout (info to stderr) for easy piping
|
|
38
|
+
|
|
39
|
+
Prerequisites:
|
|
40
|
+
You must have a cryptographic identity. Run 'ph login' first to:
|
|
41
|
+
- Generate a keypair (stored in .ph/.keypair.json)
|
|
42
|
+
- Optionally link your Ethereum address (stored in .ph/.renown.json)
|
|
43
|
+
|
|
44
|
+
Token Details:
|
|
45
|
+
The generated token is a JWT (JSON Web Token) containing:
|
|
46
|
+
- Issuer (iss): Your CLI's DID (did:key:...)
|
|
47
|
+
- Subject (sub): Your CLI's DID
|
|
48
|
+
- Credential Subject: Chain ID, network ID, and address (if authenticated)
|
|
49
|
+
- Expiration (exp): Based on --expiry option
|
|
50
|
+
- Audience (aud): If --audience is specified
|
|
51
|
+
|
|
52
|
+
Output:
|
|
53
|
+
- Token information (DID, address, expiry) is printed to stderr
|
|
54
|
+
- The token itself is printed to stdout for easy piping/copying
|
|
55
|
+
|
|
56
|
+
This allows you to use the command in scripts:
|
|
57
|
+
TOKEN=$(ph access-token)
|
|
58
|
+
curl -H "Authorization: Bearer $TOKEN" http://localhost:4001/graphql
|
|
59
|
+
|
|
60
|
+
Usage with APIs:
|
|
61
|
+
Generate token and use with curl
|
|
62
|
+
TOKEN=$(ph access-token --expiry 1d)
|
|
63
|
+
curl -X POST http://localhost:4001/graphql \\
|
|
64
|
+
-H "Content-Type: application/json" \\
|
|
65
|
+
-H "Authorization: Bearer $TOKEN" \\
|
|
66
|
+
-d '{"query": "{ drives { id name } }"}'
|
|
67
|
+
|
|
68
|
+
Export as environment variable
|
|
69
|
+
export PH_ACCESS_TOKEN=$(ph access-token)
|
|
70
|
+
|
|
71
|
+
Notes:
|
|
72
|
+
- Tokens are self-signed using your CLI's private key
|
|
73
|
+
- No network request is made; tokens are generated locally
|
|
74
|
+
- The recipient API must trust your CLI's DID to accept the token
|
|
75
|
+
- For reactor-api, ensure AUTH_ENABLED=true to require authentication
|
|
76
|
+
`,
|
|
77
|
+
args: accessTokenArgs,
|
|
78
|
+
handler: async (args) => {
|
|
79
|
+
if (args.debug) console.log(args);
|
|
80
|
+
const { generateAccessToken, parseExpiry, formatExpiry } = await import("@renown/sdk/node");
|
|
81
|
+
const { getRenown } = await import("./auth-BNkN6kS9.mjs");
|
|
82
|
+
const renown = await getRenown();
|
|
83
|
+
let expiresIn = DEFAULT_EXPIRY_SECONDS;
|
|
84
|
+
if (args.expiry) expiresIn = parseExpiry(args.expiry);
|
|
85
|
+
const result = await generateAccessToken(renown, {
|
|
86
|
+
expiresIn,
|
|
87
|
+
aud: args.audience
|
|
88
|
+
});
|
|
89
|
+
console.error(`CLI DID: ${result.did}`);
|
|
90
|
+
console.error(`ETH Address: ${result.address}`);
|
|
91
|
+
console.error(`Token expires in: ${formatExpiry(expiresIn)}`);
|
|
92
|
+
console.error("");
|
|
93
|
+
console.log(result.token);
|
|
94
|
+
process.exit(0);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
//#endregion
|
|
22
98
|
//#region src/commands/build.ts
|
|
23
99
|
const build$1 = command({
|
|
24
100
|
name: "build",
|
|
@@ -26,7 +102,7 @@ const build$1 = command({
|
|
|
26
102
|
handler: async (args) => {
|
|
27
103
|
if (args.debug) console.log(args);
|
|
28
104
|
try {
|
|
29
|
-
const { runBuild } = await import("./build-
|
|
105
|
+
const { runBuild } = await import("./build-DzxGiqu2.mjs");
|
|
30
106
|
await runBuild(args);
|
|
31
107
|
} catch (error) {
|
|
32
108
|
console.error(error);
|
|
@@ -34,30 +110,6 @@ const build$1 = command({
|
|
|
34
110
|
}
|
|
35
111
|
}
|
|
36
112
|
});
|
|
37
|
-
//#endregion
|
|
38
|
-
//#region src/commands/code.ts
|
|
39
|
-
const code = command({
|
|
40
|
-
name: "code",
|
|
41
|
-
description: `
|
|
42
|
-
Open the Powerhouse coding agent — a REPL backed by Mastra that has every
|
|
43
|
-
installed Powerhouse tool available as an agent tool.
|
|
44
|
-
|
|
45
|
-
Examples:
|
|
46
|
-
ph code Start the interactive REPL.
|
|
47
|
-
ph code "list my installed packs" One-shot agent prompt.
|
|
48
|
-
`,
|
|
49
|
-
args: codeArgs,
|
|
50
|
-
handler: async (args) => {
|
|
51
|
-
const { buildPhCodeCli } = await import("./cli-CeYM2N3E.mjs");
|
|
52
|
-
const cli = buildPhCodeCli();
|
|
53
|
-
const argv = [
|
|
54
|
-
"node",
|
|
55
|
-
"ph-code",
|
|
56
|
-
...args.rest.length === 0 ? ["-i"] : args.rest
|
|
57
|
-
];
|
|
58
|
-
await cli.run(argv);
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
113
|
const connect = subcommands({
|
|
62
114
|
name: "connect",
|
|
63
115
|
description: `Powerhouse Connect commands. Use with \`studio\`, \`build\` or \`preview\`. Defaults to \`studio\` if not specified.`,
|
|
@@ -77,7 +129,7 @@ This command:
|
|
|
77
129
|
args: connectStudioArgs,
|
|
78
130
|
handler: async (args) => {
|
|
79
131
|
if (args.debug) console.log(args);
|
|
80
|
-
const { runConnectStudio } = await import("./connect-studio-
|
|
132
|
+
const { runConnectStudio } = await import("./connect-studio-DySbZFEc.mjs");
|
|
81
133
|
await runConnectStudio(args);
|
|
82
134
|
}
|
|
83
135
|
}),
|
|
@@ -89,7 +141,7 @@ external packages included
|
|
|
89
141
|
args: connectBuildArgs,
|
|
90
142
|
handler: async (args) => {
|
|
91
143
|
if (args.debug) console.log(args);
|
|
92
|
-
const { runConnectBuild } = await import("./connect-build-
|
|
144
|
+
const { runConnectBuild } = await import("./connect-build-BIvwnJ8o.mjs");
|
|
93
145
|
await runConnectBuild(args);
|
|
94
146
|
process.exit(0);
|
|
95
147
|
}
|
|
@@ -102,7 +154,7 @@ NOTE: You must run \`ph connect build\` first
|
|
|
102
154
|
args: connectPreviewArgs,
|
|
103
155
|
handler: async (args) => {
|
|
104
156
|
if (args.debug) console.log(args);
|
|
105
|
-
const { runConnectPreview } = await import("./connect-preview-
|
|
157
|
+
const { runConnectPreview } = await import("./connect-preview-CNJkhtxL.mjs");
|
|
106
158
|
await runConnectPreview(args);
|
|
107
159
|
}
|
|
108
160
|
})
|
|
@@ -115,7 +167,7 @@ const generateAllCmd = command({
|
|
|
115
167
|
description: "Re-generate all modules in the current project",
|
|
116
168
|
args: {},
|
|
117
169
|
handler: async () => {
|
|
118
|
-
const { startGenerateAll } = await import("./generate-all-
|
|
170
|
+
const { startGenerateAll } = await import("./generate-all-Cj8zjFhN.mjs");
|
|
119
171
|
await startGenerateAll(process.cwd());
|
|
120
172
|
process.exit(0);
|
|
121
173
|
}
|
|
@@ -159,7 +211,7 @@ const generateAppCmd = command({
|
|
|
159
211
|
...debugArgs
|
|
160
212
|
},
|
|
161
213
|
handler: async (args) => {
|
|
162
|
-
const { startGenerateApp } = await import("./generate-app-
|
|
214
|
+
const { startGenerateApp } = await import("./generate-app-KE0rbE-b.mjs");
|
|
163
215
|
await startGenerateApp(args, process.cwd());
|
|
164
216
|
process.exit(0);
|
|
165
217
|
}
|
|
@@ -191,7 +243,7 @@ const generateDocumentModelCmd = command({
|
|
|
191
243
|
...debugArgs
|
|
192
244
|
},
|
|
193
245
|
handler: async (args) => {
|
|
194
|
-
const { startGenerateDocumentModel } = await import("./generate-document-model-
|
|
246
|
+
const { startGenerateDocumentModel } = await import("./generate-document-model-Cut44i6D.mjs");
|
|
195
247
|
await startGenerateDocumentModel(args, process.cwd());
|
|
196
248
|
process.exit(0);
|
|
197
249
|
}
|
|
@@ -228,7 +280,7 @@ const generateEditorCmd = command({
|
|
|
228
280
|
...debugArgs
|
|
229
281
|
},
|
|
230
282
|
handler: async (args) => {
|
|
231
|
-
const { startGenerateEditor } = await import("./generate-editor-
|
|
283
|
+
const { startGenerateEditor } = await import("./generate-editor-DmSzWm3W.mjs");
|
|
232
284
|
await startGenerateEditor(args, process.cwd());
|
|
233
285
|
process.exit(0);
|
|
234
286
|
}
|
|
@@ -313,7 +365,7 @@ const generateProcessorCmd = command({
|
|
|
313
365
|
...debugArgs
|
|
314
366
|
},
|
|
315
367
|
handler: async (args) => {
|
|
316
|
-
const { startGenerateProcessor } = await import("./generate-processor-
|
|
368
|
+
const { startGenerateProcessor } = await import("./generate-processor-BcuHtOSn.mjs");
|
|
317
369
|
await startGenerateProcessor(args, process.cwd());
|
|
318
370
|
process.exit(0);
|
|
319
371
|
}
|
|
@@ -344,7 +396,7 @@ const generateSubgraphCmd = command({
|
|
|
344
396
|
...debugArgs
|
|
345
397
|
},
|
|
346
398
|
handler: async (args) => {
|
|
347
|
-
const { startGenerateSubgraph } = await import("./generate-subgraph-
|
|
399
|
+
const { startGenerateSubgraph } = await import("./generate-subgraph-sh0GWC6T.mjs");
|
|
348
400
|
await startGenerateSubgraph(args, process.cwd());
|
|
349
401
|
process.exit(0);
|
|
350
402
|
}
|
|
@@ -372,7 +424,7 @@ const init = command({
|
|
|
372
424
|
args: initArgs,
|
|
373
425
|
handler: async (args) => {
|
|
374
426
|
if (args.debug) console.log({ args });
|
|
375
|
-
const { startInit } = await import("./init-
|
|
427
|
+
const { startInit } = await import("./init-Cw_5H_Z1.mjs");
|
|
376
428
|
await startInit(args);
|
|
377
429
|
process.exit(0);
|
|
378
430
|
}
|
|
@@ -395,7 +447,7 @@ This command:
|
|
|
395
447
|
args: inspectArgs,
|
|
396
448
|
handler: async (args) => {
|
|
397
449
|
if (args.debug) console.log(args);
|
|
398
|
-
const { startInspect } = await import("./inspect-
|
|
450
|
+
const { startInspect } = await import("./inspect-BwuBW_zW.mjs");
|
|
399
451
|
startInspect(args);
|
|
400
452
|
process.exit(0);
|
|
401
453
|
}
|
|
@@ -451,11 +503,13 @@ Resolution order for the registry URL:
|
|
|
451
503
|
}
|
|
452
504
|
const scopeRegistryArgs = Array.from(scopes).map((scope) => `--${scope}:registry=${registryUrl}`);
|
|
453
505
|
const minReleaseAgeArgs = packageManager === "pnpm" ? ["--config.minimum-release-age=0"] : [];
|
|
506
|
+
const allowBuildArgs = packageManager === "pnpm" && args.allowBuild.length > 0 ? [`--allow-build=${args.allowBuild.join(",")}`] : [];
|
|
454
507
|
const { resolveCommand } = await import("package-manager-detector");
|
|
455
508
|
const resolved = resolveCommand(packageManager, "add", [
|
|
456
509
|
...specs,
|
|
457
510
|
...scopeRegistryArgs,
|
|
458
|
-
...minReleaseAgeArgs
|
|
511
|
+
...minReleaseAgeArgs,
|
|
512
|
+
...allowBuildArgs
|
|
459
513
|
]);
|
|
460
514
|
if (!resolved) throw new Error(`Failed to resolve install command for package manager "${packageManager}".`);
|
|
461
515
|
const installCommand = `${resolved.command} ${resolved.args.join(" ")}`;
|
|
@@ -472,7 +526,7 @@ Resolution order for the registry URL:
|
|
|
472
526
|
throw error;
|
|
473
527
|
}
|
|
474
528
|
}
|
|
475
|
-
const { updateConfigFile, updateStylesFile } = await import("./utils-
|
|
529
|
+
const { updateConfigFile, updateStylesFile } = await import("./utils-C6581aex.mjs");
|
|
476
530
|
try {
|
|
477
531
|
console.log("⚙️ Updating powerhouse config file...");
|
|
478
532
|
updateConfigFile(dependenciesWithVersions, projectPath, "install", args.local ? "local" : "registry", registryUrl);
|
|
@@ -493,6 +547,156 @@ Resolution order for the registry URL:
|
|
|
493
547
|
}
|
|
494
548
|
});
|
|
495
549
|
//#endregion
|
|
550
|
+
//#region src/commands/list.ts
|
|
551
|
+
const list = command({
|
|
552
|
+
name: "list",
|
|
553
|
+
description: `
|
|
554
|
+
The list command displays information about installed Powerhouse packages in your project.
|
|
555
|
+
It reads the powerhouse.config.json file and shows the packages that are currently installed.
|
|
556
|
+
|
|
557
|
+
This command:
|
|
558
|
+
1. Examines your project configuration
|
|
559
|
+
2. Lists all installed Powerhouse packages
|
|
560
|
+
3. Provides a clear overview of your project's dependencies
|
|
561
|
+
4. Helps you manage and track your Powerhouse components
|
|
562
|
+
`,
|
|
563
|
+
aliases: ["l"],
|
|
564
|
+
args: listArgs,
|
|
565
|
+
handler: async (args) => {
|
|
566
|
+
if (args.debug) console.log(args);
|
|
567
|
+
try {
|
|
568
|
+
const { getPowerhouseProjectInfo } = await import("@powerhousedao/shared/clis");
|
|
569
|
+
const projectInfo = await getPowerhouseProjectInfo();
|
|
570
|
+
console.log("\n>>> projectInfo", projectInfo);
|
|
571
|
+
const { getConfig } = await import("@powerhousedao/config/node");
|
|
572
|
+
const phConfig = getConfig(projectInfo.projectPath + "/powerhouse.config.json");
|
|
573
|
+
if (!phConfig.packages || phConfig.packages.length === 0) {
|
|
574
|
+
console.log("No packages found in the project");
|
|
575
|
+
return;
|
|
576
|
+
}
|
|
577
|
+
console.log("Installed Packages:\n");
|
|
578
|
+
phConfig.packages.forEach((pkg) => {
|
|
579
|
+
console.log(pkg.packageName);
|
|
580
|
+
});
|
|
581
|
+
} catch (e) {
|
|
582
|
+
console.log("No packages found in the project");
|
|
583
|
+
}
|
|
584
|
+
process.exit(0);
|
|
585
|
+
}
|
|
586
|
+
});
|
|
587
|
+
//#endregion
|
|
588
|
+
//#region src/commands/login.ts
|
|
589
|
+
const login = command({
|
|
590
|
+
name: "login",
|
|
591
|
+
description: `
|
|
592
|
+
The login command authenticates you with Renown using your Ethereum wallet. This enables
|
|
593
|
+
the CLI to act on behalf of your Ethereum identity for authenticated operations.
|
|
594
|
+
|
|
595
|
+
This command:
|
|
596
|
+
1. Generates or loads a cryptographic identity (DID) for the CLI
|
|
597
|
+
2. Opens your browser to the Renown authentication page
|
|
598
|
+
3. You authorize the CLI's DID to act on behalf of your Ethereum address
|
|
599
|
+
4. Stores the credentials locally in .ph/.renown.json
|
|
600
|
+
`,
|
|
601
|
+
args: loginArgs,
|
|
602
|
+
handler: async (args) => {
|
|
603
|
+
if (args.debug) console.log(args);
|
|
604
|
+
const { getRenown } = await import("./auth-BNkN6kS9.mjs");
|
|
605
|
+
const renown = await getRenown(args.renownUrl);
|
|
606
|
+
if (args.showDid) {
|
|
607
|
+
console.log(renown.did);
|
|
608
|
+
process.exit(0);
|
|
609
|
+
}
|
|
610
|
+
if (args.status) {
|
|
611
|
+
const { getAuthStatus } = await import("@renown/sdk/node");
|
|
612
|
+
const status = getAuthStatus(renown);
|
|
613
|
+
if (!status.authenticated || !status.address) {
|
|
614
|
+
console.log("Not authenticated with an Ethereum address.");
|
|
615
|
+
console.log("Run \"ph login\" to authenticate.");
|
|
616
|
+
} else {
|
|
617
|
+
console.log("Authenticated");
|
|
618
|
+
console.log(` ETH Address: ${status.address}`);
|
|
619
|
+
console.log(` User DID: ${status.userDid}`);
|
|
620
|
+
console.log(` Chain ID: ${status.chainId}`);
|
|
621
|
+
console.log(` CLI DID: ${status.cliDid}`);
|
|
622
|
+
console.log(` Authenticated at: ${status.authenticatedAt?.toLocaleString()}`);
|
|
623
|
+
console.log(` Renown URL: ${status.baseUrl}`);
|
|
624
|
+
}
|
|
625
|
+
process.exit(0);
|
|
626
|
+
}
|
|
627
|
+
if (args.logout) {
|
|
628
|
+
await handleLogout();
|
|
629
|
+
process.exit(0);
|
|
630
|
+
}
|
|
631
|
+
const { browserLogin } = await import("@renown/sdk/node");
|
|
632
|
+
console.debug("Initializing cryptographic identity...");
|
|
633
|
+
console.log(`CLI DID: ${renown.did}`);
|
|
634
|
+
try {
|
|
635
|
+
const timeoutMs = args.timeout ? args.timeout * 1e3 : void 0;
|
|
636
|
+
const result = await browserLogin(renown, {
|
|
637
|
+
renownUrl: args.renownUrl,
|
|
638
|
+
timeoutMs,
|
|
639
|
+
onLoginUrl: (url, sessionId) => {
|
|
640
|
+
console.log("Opening browser for authentication...");
|
|
641
|
+
console.log(`Session ID: ${sessionId.slice(0, 8)}...`);
|
|
642
|
+
console.log(`Login URL: ${url}`);
|
|
643
|
+
console.log();
|
|
644
|
+
console.log("Waiting for authentication in browser");
|
|
645
|
+
console.log(`(timeout in ${(timeoutMs ?? 3e5) / 1e3} seconds)`);
|
|
646
|
+
console.log();
|
|
647
|
+
console.log("Please connect your wallet and authorize this CLI to act on your behalf.");
|
|
648
|
+
console.log();
|
|
649
|
+
process.stdout.write("Waiting");
|
|
650
|
+
},
|
|
651
|
+
onPollTick: () => process.stdout.write("."),
|
|
652
|
+
onBrowserOpenFailed: (url) => {
|
|
653
|
+
console.error("Failed to open browser automatically.");
|
|
654
|
+
console.log(`Please open this URL manually: ${url}`);
|
|
655
|
+
}
|
|
656
|
+
});
|
|
657
|
+
console.log();
|
|
658
|
+
console.log();
|
|
659
|
+
console.log("Successfully authenticated!");
|
|
660
|
+
console.log(` ETH Address: ${result.user.address}`);
|
|
661
|
+
console.log(` User DID: ${result.user.did}`);
|
|
662
|
+
console.log(` CLI DID: ${result.cliDid}`);
|
|
663
|
+
console.log();
|
|
664
|
+
console.log("The CLI can now act on behalf of your Ethereum identity.");
|
|
665
|
+
} catch (error) {
|
|
666
|
+
console.log();
|
|
667
|
+
throw error;
|
|
668
|
+
}
|
|
669
|
+
process.exit(0);
|
|
670
|
+
}
|
|
671
|
+
});
|
|
672
|
+
async function handleLogout() {
|
|
673
|
+
const { getRenown } = await import("./auth-BNkN6kS9.mjs");
|
|
674
|
+
const renown = await getRenown();
|
|
675
|
+
if (!renown.user) {
|
|
676
|
+
console.log("Not currently authenticated.");
|
|
677
|
+
return;
|
|
678
|
+
}
|
|
679
|
+
try {
|
|
680
|
+
await renown.logout();
|
|
681
|
+
console.log("Successfully logged out.");
|
|
682
|
+
} catch (error) {
|
|
683
|
+
console.error("Failed to clear credentials.");
|
|
684
|
+
console.debug(error);
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
//#endregion
|
|
688
|
+
//#region src/commands/logout.ts
|
|
689
|
+
const logout = command({
|
|
690
|
+
name: "logout",
|
|
691
|
+
description: `
|
|
692
|
+
The logout command removes an existing session created with 'ph login'`,
|
|
693
|
+
args: {},
|
|
694
|
+
handler: async () => {
|
|
695
|
+
await handleLogout();
|
|
696
|
+
process.exit(0);
|
|
697
|
+
}
|
|
698
|
+
});
|
|
699
|
+
//#endregion
|
|
496
700
|
//#region src/commands/migrate.ts
|
|
497
701
|
const migrate = command({
|
|
498
702
|
name: "migrate",
|
|
@@ -500,7 +704,7 @@ const migrate = command({
|
|
|
500
704
|
description: "Run migrations",
|
|
501
705
|
handler: async (args) => {
|
|
502
706
|
if (args.debug) console.log(args);
|
|
503
|
-
const { startMigrate } = await import("./migrate-
|
|
707
|
+
const { startMigrate } = await import("./migrate-DCUKk5c2.mjs");
|
|
504
708
|
await startMigrate(args);
|
|
505
709
|
process.exit(0);
|
|
506
710
|
}
|
|
@@ -548,7 +752,7 @@ This command:
|
|
|
548
752
|
const { projectPath } = await getPowerhouseProjectInfo();
|
|
549
753
|
if (!projectPath) throw new Error("Could not find project path.");
|
|
550
754
|
const { checkNpmAuth, npmPublish, resolveRegistryUrl } = await import("@powerhousedao/shared/registry");
|
|
551
|
-
const { mintRegistryAuthToken } = await import("./registry-auth-
|
|
755
|
+
const { mintRegistryAuthToken } = await import("./registry-auth-CNH84uo4.mjs");
|
|
552
756
|
const registryUrl = resolveRegistryUrl({
|
|
553
757
|
registry: args.registry,
|
|
554
758
|
projectPath
|
|
@@ -638,7 +842,7 @@ Usage:
|
|
|
638
842
|
const projectPath = (await getPowerhouseProjectInfo().catch(() => null))?.projectPath ?? process.cwd();
|
|
639
843
|
const [{ resolveRegistryUrl, writeRegistryAuthToken }, { mintRegistryAuthToken }, { parseExpiry, formatExpiry }] = await Promise.all([
|
|
640
844
|
import("@powerhousedao/shared/registry"),
|
|
641
|
-
import("./registry-auth-
|
|
845
|
+
import("./registry-auth-CNH84uo4.mjs"),
|
|
642
846
|
import("@renown/sdk/node")
|
|
643
847
|
]);
|
|
644
848
|
const registryUrl = resolveRegistryUrl({
|
|
@@ -675,14 +879,14 @@ This command:
|
|
|
675
879
|
const { basePath, dbPath, migrate, migrateStatus } = args;
|
|
676
880
|
if (basePath) process.env.BASE_PATH = basePath;
|
|
677
881
|
if (migrate || migrateStatus) {
|
|
678
|
-
const { runSwitchboardMigrations } = await import("./switchboard-migrate-
|
|
882
|
+
const { runSwitchboardMigrations } = await import("./switchboard-migrate-BumRp7rC.mjs");
|
|
679
883
|
await runSwitchboardMigrations({
|
|
680
884
|
dbPath,
|
|
681
885
|
statusOnly: migrateStatus
|
|
682
886
|
});
|
|
683
887
|
process.exit(0);
|
|
684
888
|
}
|
|
685
|
-
const { startSwitchboard } = await import("./switchboard-
|
|
889
|
+
const { startSwitchboard } = await import("./switchboard-GTBlxiJZ.mjs");
|
|
686
890
|
const { defaultDriveUrl, renown } = await startSwitchboard(args);
|
|
687
891
|
console.log(" ➜ Switchboard:", defaultDriveUrl);
|
|
688
892
|
if (renown) console.log(" ➜ Identity:", renown.did);
|
|
@@ -719,7 +923,7 @@ This command:
|
|
|
719
923
|
});
|
|
720
924
|
try {
|
|
721
925
|
console.log("Uninstalling dependencies 📦 ...");
|
|
722
|
-
execSync$1(await getPowerhouseProjectUninstallCommand(packageManager), {
|
|
926
|
+
execSync$1(await getPowerhouseProjectUninstallCommand(packageManager, args.dependencies), {
|
|
723
927
|
stdio: "inherit",
|
|
724
928
|
cwd: projectPath
|
|
725
929
|
});
|
|
@@ -728,7 +932,7 @@ This command:
|
|
|
728
932
|
console.error("❌ Failed to uninstall dependencies");
|
|
729
933
|
throw error;
|
|
730
934
|
}
|
|
731
|
-
const { removeStylesImports, updateConfigFile } = await import("./utils-
|
|
935
|
+
const { removeStylesImports, updateConfigFile } = await import("./utils-C6581aex.mjs");
|
|
732
936
|
try {
|
|
733
937
|
console.log("⚙️ Updating powerhouse config file...");
|
|
734
938
|
updateConfigFile(dependenciesWithVersions, projectPath, "uninstall");
|
|
@@ -843,7 +1047,6 @@ async function confirm(prompt) {
|
|
|
843
1047
|
//#region src/commands/ph-cli-commands.ts
|
|
844
1048
|
const phCliCommands = {
|
|
845
1049
|
init,
|
|
846
|
-
code,
|
|
847
1050
|
generate,
|
|
848
1051
|
vetra: command({
|
|
849
1052
|
name: "vetra",
|
|
@@ -860,7 +1063,7 @@ This command:
|
|
|
860
1063
|
args: vetraArgs,
|
|
861
1064
|
handler: async (args) => {
|
|
862
1065
|
if (args.debug) console.log(args);
|
|
863
|
-
const { startVetra } = await import("./vetra-
|
|
1066
|
+
const { startVetra } = await import("./vetra-_JnFPpL5.mjs");
|
|
864
1067
|
await startVetra(args);
|
|
865
1068
|
}
|
|
866
1069
|
}),
|