@powerhousedao/ph-cli 6.3.0-dev.8 → 6.4.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/dist/{build-BpT6_e8f.mjs → build-D8_USaRh.mjs} +88 -16
  2. package/dist/build-D8_USaRh.mjs.map +1 -0
  3. package/dist/build-FVWjguYr.mjs +4 -0
  4. package/dist/{check-B4ZNJSdS.mjs → check-CVRb-CJD.mjs} +3 -3
  5. package/dist/{check-B8oqVMg7.mjs → check-EpzhIKt1.mjs} +4 -4
  6. package/dist/{check-B8oqVMg7.mjs.map → check-EpzhIKt1.mjs.map} +1 -1
  7. package/dist/{check-DLp0zlsr.mjs → check-_K6EAsag.mjs} +4 -4
  8. package/dist/{check-DLp0zlsr.mjs.map → check-_K6EAsag.mjs.map} +1 -1
  9. package/dist/{cli-connect-override-D22yFWlC.mjs → cli-connect-override-DwlViDdp.mjs} +5 -5
  10. package/dist/{cli-connect-override-D22yFWlC.mjs.map → cli-connect-override-DwlViDdp.mjs.map} +1 -1
  11. package/dist/cli.mjs +15 -31
  12. package/dist/cli.mjs.map +1 -1
  13. package/dist/{compound-DKi56SSx-CXQHhS6t.mjs → compound-n-bO0qKh-Dx7fgKWx.mjs} +658 -275
  14. package/dist/compound-n-bO0qKh-Dx7fgKWx.mjs.map +1 -0
  15. package/dist/{connect-build-BjNOlgpf.mjs → connect-build-BIkm5fcG.mjs} +6 -6
  16. package/dist/{connect-build-BjNOlgpf.mjs.map → connect-build-BIkm5fcG.mjs.map} +1 -1
  17. package/dist/{connect-config-CVU4xhti.mjs → connect-config-CH0KQqyU.mjs} +4 -4
  18. package/dist/{connect-config-CVU4xhti.mjs.map → connect-config-CH0KQqyU.mjs.map} +1 -1
  19. package/dist/{connect-preview-CdFvlANO.mjs → connect-preview-BvxXGo_W.mjs} +7 -6
  20. package/dist/connect-preview-BvxXGo_W.mjs.map +1 -0
  21. package/dist/{connect-studio-BnfhpIv8.mjs → connect-studio-C-9WE2Bg.mjs} +16 -7
  22. package/dist/connect-studio-C-9WE2Bg.mjs.map +1 -0
  23. package/dist/definitions-worker.mjs +1 -1
  24. package/dist/{dist-DXcB8fAF.mjs → dist-Dbvm_SmC.mjs} +51 -104
  25. package/dist/dist-Dbvm_SmC.mjs.map +1 -0
  26. package/dist/{explain-8OEXF2Dy.mjs → explain-DB7uoJkY.mjs} +67 -21
  27. package/dist/explain-DB7uoJkY.mjs.map +1 -0
  28. package/dist/{export-DqbcbFU5.mjs → export-DuYGBuQZ.mjs} +4 -4
  29. package/dist/{export-DqbcbFU5.mjs.map → export-DuYGBuQZ.mjs.map} +1 -1
  30. package/dist/{generate-all-0YOnlZM0.mjs → generate-all-Mj_xGZZN.mjs} +4 -4
  31. package/dist/{generate-all-0YOnlZM0.mjs.map → generate-all-Mj_xGZZN.mjs.map} +1 -1
  32. package/dist/{generate-desktop-shell-BovoRsR6.mjs → generate-desktop-shell-DD9o4Rcl.mjs} +7 -17
  33. package/dist/generate-desktop-shell-DD9o4Rcl.mjs.map +1 -0
  34. package/dist/{get-version-CvSoe9Yp.mjs → get-version-DXnnvS_S.mjs} +4 -4
  35. package/dist/{get-version-CvSoe9Yp.mjs.map → get-version-DXnnvS_S.mjs.map} +1 -1
  36. package/dist/{index-H3AYe65i.d.mts → index-V7TKBh-y.d.mts} +57 -3
  37. package/dist/index-V7TKBh-y.d.mts.map +1 -0
  38. package/dist/{init-CJB6RiIy.mjs → init-Ltg4cJzm.mjs} +9 -7
  39. package/dist/init-Ltg4cJzm.mjs.map +1 -0
  40. package/dist/{inspect-zWJnBDMJ.mjs → inspect-Bxa9y7zM.mjs} +4 -4
  41. package/dist/{inspect-zWJnBDMJ.mjs.map → inspect-Bxa9y7zM.mjs.map} +1 -1
  42. package/dist/{mcp-CDj9zBcB.mjs → mcp-DKqOFZlX.mjs} +7 -7
  43. package/dist/mcp-DKqOFZlX.mjs.map +1 -0
  44. package/dist/{migrate-DWaJjRZJ.mjs → migrate-CQpwBF1l.mjs} +8 -7
  45. package/dist/migrate-CQpwBF1l.mjs.map +1 -0
  46. package/dist/{migrate-document-models-LXMqiBzv.mjs → migrate-document-models-DpXzLDuu.mjs} +4 -4
  47. package/dist/{migrate-document-models-LXMqiBzv.mjs.map → migrate-document-models-DpXzLDuu.mjs.map} +1 -1
  48. package/dist/{migrate-subgraphs-Bm3HCsBx.mjs → migrate-subgraphs-CdfkO6l9.mjs} +54 -14
  49. package/dist/migrate-subgraphs-CdfkO6l9.mjs.map +1 -0
  50. package/dist/migrate-subgraphs-CoUuwzmR.mjs +4 -0
  51. package/dist/ph-cli-commands-Daeqh5Me.mjs +4 -0
  52. package/dist/{ph-cli-commands-N2_mv9oH.mjs → ph-cli-commands-Dq-tIYhy.mjs} +31 -183
  53. package/dist/ph-cli-commands-Dq-tIYhy.mjs.map +1 -0
  54. package/dist/run-sugar-Bnab2Z3f.mjs +4 -0
  55. package/dist/run-sugar-DsG2RRgx.mjs +89 -0
  56. package/dist/run-sugar-DsG2RRgx.mjs.map +1 -0
  57. package/dist/runners/connect.d.mts +2 -2
  58. package/dist/runners/connect.d.mts.map +1 -1
  59. package/dist/runners/connect.mjs +30 -18
  60. package/dist/runners/connect.mjs.map +1 -1
  61. package/dist/runners/switchboard.d.mts +3 -3
  62. package/dist/runners/switchboard.mjs +11 -11
  63. package/dist/runners/switchboard.mjs.map +1 -1
  64. package/dist/scripts/generate-commands-docs.ts +2 -8
  65. package/dist/service-args-D6y3L0bm.mjs +49 -0
  66. package/dist/service-args-D6y3L0bm.mjs.map +1 -0
  67. package/dist/sugar-checks-DBk5q_uJ.mjs +175 -0
  68. package/dist/sugar-checks-DBk5q_uJ.mjs.map +1 -0
  69. package/dist/{switchboard-reset-MtTB_GAI.mjs → switchboard-reset-CY6J0lWO.mjs} +4 -4
  70. package/dist/switchboard-reset-CY6J0lWO.mjs.map +1 -0
  71. package/dist/utils-BU25LHRE.mjs +4 -0
  72. package/dist/{utils-9KyRM0mf.mjs → utils-D5VlY5AZ.mjs} +4 -15
  73. package/dist/utils-D5VlY5AZ.mjs.map +1 -0
  74. package/dist/{verify-CLy3OBt0.mjs → verify-C_fL8YsF.mjs} +4 -4
  75. package/dist/{verify-CLy3OBt0.mjs.map → verify-C_fL8YsF.mjs.map} +1 -1
  76. package/dist/{vetra-host-ChTpJiBJ.mjs → vetra-host-CDfny6E8.mjs} +24 -9
  77. package/dist/vetra-host-CDfny6E8.mjs.map +1 -0
  78. package/dist/{vetra-instance-CzhYIjxL.mjs → vetra-instance-DlXAeiU7.mjs} +8 -16
  79. package/dist/{vetra-instance-CzhYIjxL.mjs.map → vetra-instance-DlXAeiU7.mjs.map} +1 -1
  80. package/dist/{vetra-launch-qi10Unax.mjs → vetra-launcher-CYX10K2m.mjs} +14 -32
  81. package/dist/vetra-launcher-CYX10K2m.mjs.map +1 -0
  82. package/dist/vetra-launcher-TDLXj0tY.mjs +4 -0
  83. package/dist/{vetra-switchboard-tzdc14KA.mjs → vetra-switchboard-Ctje6iR1.mjs} +4 -4
  84. package/dist/{vetra-switchboard-tzdc14KA.mjs.map → vetra-switchboard-Ctje6iR1.mjs.map} +1 -1
  85. package/package.json +16 -16
  86. package/dist/build-BpT6_e8f.mjs.map +0 -1
  87. package/dist/build-CH7APWeB.mjs +0 -4
  88. package/dist/classic-args-mH_DVsgC.mjs +0 -48
  89. package/dist/classic-args-mH_DVsgC.mjs.map +0 -1
  90. package/dist/classic-warnings-BR0S6lr5.mjs +0 -179
  91. package/dist/classic-warnings-BR0S6lr5.mjs.map +0 -1
  92. package/dist/compound-DKi56SSx-CXQHhS6t.mjs.map +0 -1
  93. package/dist/connect-preview-CdFvlANO.mjs.map +0 -1
  94. package/dist/connect-studio-BnfhpIv8.mjs.map +0 -1
  95. package/dist/connect-studio-D58ByAAn.mjs +0 -4
  96. package/dist/dist-DXcB8fAF.mjs.map +0 -1
  97. package/dist/explain-8OEXF2Dy.mjs.map +0 -1
  98. package/dist/generate-desktop-shell-BovoRsR6.mjs.map +0 -1
  99. package/dist/index-H3AYe65i.d.mts.map +0 -1
  100. package/dist/init-CJB6RiIy.mjs.map +0 -1
  101. package/dist/mcp-CDj9zBcB.mjs.map +0 -1
  102. package/dist/migrate-DWaJjRZJ.mjs.map +0 -1
  103. package/dist/migrate-subgraphs-Bm3HCsBx.mjs.map +0 -1
  104. package/dist/migrate-subgraphs-CYDoY5jR.mjs +0 -4
  105. package/dist/ph-cli-commands-C1w7hHUM.mjs +0 -4
  106. package/dist/ph-cli-commands-N2_mv9oH.mjs.map +0 -1
  107. package/dist/run-sugar-DpznOP1e.mjs +0 -56
  108. package/dist/run-sugar-DpznOP1e.mjs.map +0 -1
  109. package/dist/scripts/manage-environment +0 -199
  110. package/dist/scripts/setup-environment +0 -423
  111. package/dist/scripts/setup-environment.ps1 +0 -313
  112. package/dist/switchboard-reset-MtTB_GAI.mjs.map +0 -1
  113. package/dist/utils-9KyRM0mf.mjs.map +0 -1
  114. package/dist/utils-TO9lB8Xs.mjs +0 -4
  115. package/dist/vetra-CVNZ46pK.mjs +0 -352
  116. package/dist/vetra-CVNZ46pK.mjs.map +0 -1
  117. package/dist/vetra-host-ChTpJiBJ.mjs.map +0 -1
  118. package/dist/vetra-launch-qi10Unax.mjs.map +0 -1
  119. package/dist/vetra-switchboard-BrkozIm7.mjs +0 -4
@@ -1,48 +0,0 @@
1
-
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="ab05598d-fe5a-5b90-b229-ff4c040c2a15")}catch(e){}}();
3
- import { command, runSafely } from "cmd-ts";
4
- import { buildArgs, connectBuildArgs, connectStudioArgs } from "@powerhousedao/shared/clis/args";
5
- //#region src/services/classic-args.ts
6
- /**
7
- * The argument shapes of the classic `ph connect studio`, `ph connect build`
8
- * and `ph build`, produced by the SAME cmd-ts definitions those commands
9
- * parse (see `@powerhousedao/ph-run/classic-args`, which does this for the
10
- * switchboard and for `ph connect preview`). A runner starts from one of
11
- * these and overlays only the keys its host file and its invocation own, so
12
- * a service is handed every key the classic command hands it.
13
- */
14
- const classicConnectStudio = command({
15
- name: "studio",
16
- args: connectStudioArgs,
17
- handler: (args) => args
18
- });
19
- const classicConnectBuild = command({
20
- name: "build",
21
- args: connectBuildArgs,
22
- handler: (args) => args
23
- });
24
- const classicBuild = command({
25
- name: "build",
26
- args: buildArgs,
27
- handler: (args) => args
28
- });
29
- async function classicConnectStudioArgs(argv = []) {
30
- const result = await runSafely(classicConnectStudio, argv);
31
- if (result._tag === "error") throw new Error(`classic connect studio args did not parse: ${result.error.config.message}`);
32
- return result.value;
33
- }
34
- async function classicConnectBuildArgs(argv = []) {
35
- const result = await runSafely(classicConnectBuild, argv);
36
- if (result._tag === "error") throw new Error(`classic connect build args did not parse: ${result.error.config.message}`);
37
- return result.value;
38
- }
39
- async function classicBuildArgs(argv = []) {
40
- const result = await runSafely(classicBuild, argv);
41
- if (result._tag === "error") throw new Error(`classic build args did not parse: ${result.error.config.message}`);
42
- return result.value;
43
- }
44
- //#endregion
45
- export { classicBuildArgs, classicConnectBuildArgs, classicConnectStudioArgs };
46
-
47
- //# sourceMappingURL=classic-args-mH_DVsgC.mjs.map
48
- //# debugId=ab05598d-fe5a-5b90-b229-ff4c040c2a15
@@ -1 +0,0 @@
1
- {"version":3,"file":"classic-args-mH_DVsgC.mjs","sources":["../src/services/classic-args.ts"],"sourcesContent":["import {\n buildArgs,\n connectBuildArgs,\n connectStudioArgs,\n} from \"@powerhousedao/shared/clis/args\";\nimport { command, runSafely } from \"cmd-ts\";\nimport type {\n BuildArgs,\n ConnectBuildArgs,\n ConnectStudioArgs,\n} from \"../types.js\";\n\n/**\n * The argument shapes of the classic `ph connect studio`, `ph connect build`\n * and `ph build`, produced by the SAME cmd-ts definitions those commands\n * parse (see `@powerhousedao/ph-run/classic-args`, which does this for the\n * switchboard and for `ph connect preview`). A runner starts from one of\n * these and overlays only the keys its host file and its invocation own, so\n * a service is handed every key the classic command hands it.\n */\nconst classicConnectStudio = command({\n name: \"studio\",\n args: connectStudioArgs,\n handler: (args) => args,\n});\n\nconst classicConnectBuild = command({\n name: \"build\",\n args: connectBuildArgs,\n handler: (args) => args,\n});\n\nconst classicBuild = command({\n name: \"build\",\n args: buildArgs,\n handler: (args) => args,\n});\n\nexport async function classicConnectStudioArgs(\n argv: string[] = [],\n): Promise<ConnectStudioArgs> {\n const result = await runSafely(classicConnectStudio, argv);\n if (result._tag === \"error\") {\n throw new Error(\n `classic connect studio args did not parse: ${result.error.config.message}`,\n );\n }\n return result.value;\n}\n\nexport async function classicConnectBuildArgs(\n argv: string[] = [],\n): Promise<ConnectBuildArgs> {\n const result = await runSafely(classicConnectBuild, argv);\n if (result._tag === \"error\") {\n throw new Error(\n `classic connect build args did not parse: ${result.error.config.message}`,\n );\n }\n return result.value;\n}\n\nexport async function classicBuildArgs(\n argv: string[] = [],\n): Promise<BuildArgs> {\n const result = await runSafely(classicBuild, argv);\n if (result._tag === \"error\") {\n throw new Error(\n `classic build args did not parse: ${result.error.config.message}`,\n );\n }\n return result.value;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAoBA,MAAM,uBAAuB,QAAQ;CACnC,MAAM;CACN,MAAM;CACN,UAAU,SAAS;AACrB,CAAC;AAED,MAAM,sBAAsB,QAAQ;CAClC,MAAM;CACN,MAAM;CACN,UAAU,SAAS;AACrB,CAAC;AAED,MAAM,eAAe,QAAQ;CAC3B,MAAM;CACN,MAAM;CACN,UAAU,SAAS;AACrB,CAAC;AAED,eAAsB,yBACpB,OAAiB,CAAC,GACU;CAC5B,MAAM,SAAS,MAAM,UAAU,sBAAsB,IAAI;CACzD,IAAI,OAAO,SAAS,SAClB,MAAM,IAAI,MACR,8CAA8C,OAAO,MAAM,OAAO,SACpE;CAEF,OAAO,OAAO;AAChB;AAEA,eAAsB,wBACpB,OAAiB,CAAC,GACS;CAC3B,MAAM,SAAS,MAAM,UAAU,qBAAqB,IAAI;CACxD,IAAI,OAAO,SAAS,SAClB,MAAM,IAAI,MACR,6CAA6C,OAAO,MAAM,OAAO,SACnE;CAEF,OAAO,OAAO;AAChB;AAEA,eAAsB,iBACpB,OAAiB,CAAC,GACE;CACpB,MAAM,SAAS,MAAM,UAAU,cAAc,IAAI;CACjD,IAAI,OAAO,SAAS,SAClB,MAAM,IAAI,MACR,qCAAqC,OAAO,MAAM,OAAO,SAC3D;CAEF,OAAO,OAAO;AAChB","debug_id":"ab05598d-fe5a-5b90-b229-ff4c040c2a15"}
@@ -1,179 +0,0 @@
1
-
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e471107a-8d14-5b36-a64d-1676503ebd2a")}catch(e){}}();
3
- import { I as probeHostsFolder } from "./compound-DKi56SSx-CXQHhS6t.mjs";
4
- import fs from "node:fs";
5
- import path from "node:path";
6
- import { DEPRECATIONS_REMOVED_IN, deprecationWarned, markDeprecationWarned, presentConfigKeys, supersededConfigKeys, warnDeprecations } from "@powerhousedao/shared/clis/deprecations";
7
- //#region src/utils/classic-warnings.ts
8
- /**
9
- * The 6.3 warnings of a classic invocation: `ph vetra`, `ph connect`,
10
- * `ph switchboard` and the `ph reactor` alias, run the classic way. `ph run`
11
- * is not one, nor is a host name rewritten to it, so a project that runs its
12
- * hosts gets none of these.
13
- */
14
- /** The commands with a classic handling, as typed. */
15
- const CLASSIC_COMMANDS = /* @__PURE__ */ new Set([
16
- "vetra",
17
- "connect",
18
- "switchboard",
19
- "reactor"
20
- ]);
21
- /** `ph connect <subcommand>` and the verb of the connect host it became. */
22
- const CONNECT_VERBS = {
23
- studio: "dev",
24
- build: "build",
25
- preview: "serve"
26
- };
27
- /** Classic `ph switchboard` flags that became verbs of the host. */
28
- const SWITCHBOARD_VERB_FLAGS = {
29
- "--migrate": "migrate",
30
- "--migrate-status": "migrate-status",
31
- "--reset": "reset",
32
- "--dev": "dev"
33
- };
34
- /** Read by the CLI itself, before any command. */
35
- const CLI_FLAGS = /* @__PURE__ */ new Set(["--debug"]);
36
- function classicInvocation(args) {
37
- const [command, ...rest] = args;
38
- if (command === void 0 || !CLASSIC_COMMANDS.has(command)) return void 0;
39
- if (rest.some((arg) => arg === "--help" || arg === "-h")) return void 0;
40
- const flags = [...new Set(rest.filter((arg) => arg.startsWith("-") && arg !== "--").map((arg) => arg.split("=")[0]))].filter((name) => !CLI_FLAGS.has(name));
41
- if (command === "connect") {
42
- if (rest[0] === "config") return void 0;
43
- const subcommand = rest.length > 0 && Object.hasOwn(CONNECT_VERBS, rest[0]) ? rest[0] : void 0;
44
- return {
45
- typed: subcommand ? `ph connect ${subcommand}` : "ph connect",
46
- host: "connect",
47
- replacement: `ph run connect ${CONNECT_VERBS[subcommand ?? "studio"]}`,
48
- alias: false,
49
- flags
50
- };
51
- }
52
- if (command === "vetra") return {
53
- typed: "ph vetra",
54
- host: "vetra",
55
- replacement: "ph run vetra",
56
- alias: false,
57
- flags
58
- };
59
- return {
60
- typed: `ph ${command}`,
61
- host: "switchboard",
62
- replacement: "ph run switchboard",
63
- alias: command === "reactor",
64
- flags
65
- };
66
- }
67
- /** How `ph run <host>` takes a classic flag, when it does not take it as is. */
68
- function flagDeprecations(invocation, schemas) {
69
- const { typed, host, replacement } = invocation;
70
- const members = host === "vetra" ? [schemas.switchboard, schemas.connect] : [schemas[host]];
71
- const scoped = new Set(members.flatMap((schema) => Object.values(schema.memberOptions ?? {})));
72
- const accepts = (name) => host === "vetra" ? members.some((schema) => schema.memberOptions?.[name] !== void 0 || !scoped.has(name) && [...schema.options, ...schema.flags].includes(name)) : [...members[0].options, ...members[0].flags].includes(name);
73
- const deprecations = [];
74
- const unsupported = [];
75
- for (const name of invocation.flags) {
76
- const verb = host === "switchboard" ? SWITCHBOARD_VERB_FLAGS[name] : void 0;
77
- const retired = members.find((schema) => schema.retired?.[name])?.retired?.[name];
78
- if (verb !== void 0) deprecations.push({
79
- id: `classic:flag:${name}`,
80
- text: `\`${typed} ${name}\` is deprecated and stops working in ${DEPRECATIONS_REMOVED_IN}. Use \`ph run switchboard ${verb}\` instead.`
81
- });
82
- else if (accepts(name)) continue;
83
- else if (retired !== void 0) deprecations.push({
84
- id: `classic:flag:${name}`,
85
- text: `\`${typed} ${name}\` is deprecated and stops working in ${DEPRECATIONS_REMOVED_IN}: ${retired}`
86
- });
87
- else unsupported.push(name);
88
- }
89
- if (unsupported.length > 0) {
90
- const one = unsupported.length === 1;
91
- const subject = one ? `\`${typed} ${unsupported[0]}\` has no \`${replacement}\` argument and stops` : `The \`${typed}\` flags ${unsupported.join(", ")} have no \`${replacement}\` argument and stop`;
92
- deprecations.push({
93
- id: "classic:flags",
94
- text: `${subject} working in ${DEPRECATIONS_REMOVED_IN}. Set what ${one ? "it configures" : "they configure"} in the host files under hosts/ instead.`
95
- });
96
- }
97
- return deprecations;
98
- }
99
- function readProjectConfig(projectRoot) {
100
- try {
101
- return JSON.parse(fs.readFileSync(path.join(projectRoot, "powerhouse.config.json"), "utf8"));
102
- } catch {
103
- return;
104
- }
105
- }
106
- /**
107
- * What a classic invocation should be told, in order: the project without
108
- * hosts or the command with its replacement, the alias, its flags, and the
109
- * config keys only the classic commands read. `args` is the command line
110
- * after the host sugar. Empty for anything else, and for help.
111
- * `schemas` is only needed when the invocation passes flags.
112
- */
113
- function classicDeprecations(args, projectRoot, schemas) {
114
- const invocation = classicInvocation(args);
115
- if (!invocation) return [];
116
- const { typed, host, replacement, alias } = invocation;
117
- const deprecations = [];
118
- const probe = probeHostsFolder(projectRoot);
119
- if (probe.kind !== "present") deprecations.push({
120
- id: "classic:no-hosts",
121
- text: `This project has no hosts/<name>/host.js, so \`${typed}\` runs the classic way, which stops working in ${DEPRECATIONS_REMOVED_IN}. Run \`ph migrate\` to add the host files, then use \`${replacement}\`.`
122
- });
123
- else if (!probe.hosts.includes(host)) deprecations.push({
124
- id: "classic:command",
125
- text: `\`${typed}\` runs the classic way, which stops working in ${DEPRECATIONS_REMOVED_IN}. This project has no hosts/${host}/host.js: add that host file, then use \`${replacement}\`.`
126
- });
127
- else if (!alias) deprecations.push({
128
- id: "classic:command",
129
- text: `\`${typed}\` runs the classic way and does not read hosts/${host}/host.js. The classic way stops working in ${DEPRECATIONS_REMOVED_IN}: use \`${replacement}\` instead.`
130
- });
131
- if (alias) deprecations.push({
132
- id: "classic:alias",
133
- text: `\`${typed}\` is a deprecated alias and is removed in ${DEPRECATIONS_REMOVED_IN}. Use \`${replacement}\` instead.`
134
- });
135
- if (schemas && invocation.flags.length > 0) deprecations.push(...flagDeprecations(invocation, schemas));
136
- const superseded = presentConfigKeys(readProjectConfig(projectRoot), Object.keys(supersededConfigKeys));
137
- if (superseded.length > 0) {
138
- const homes = superseded.map((key) => `${key} to ${supersededConfigKeys[key]}`);
139
- deprecations.push({
140
- id: "classic:config",
141
- text: `powerhouse.config.json sets ${superseded.join(", ")}: only the classic commands read ${superseded.length === 1 ? "it" : "them"}, and ${DEPRECATIONS_REMOVED_IN} refuses ${superseded.length === 1 ? "it" : "them"}. Move ${homes.join("; ")}.`
142
- });
143
- }
144
- return deprecations;
145
- }
146
- /** Marks an invocation whose classic warnings are out: the classic commands
147
- * it spawns inherit the mark and stay silent. */
148
- const CLASSIC_WARNED = "classic";
149
- async function loadArgSchemas() {
150
- try {
151
- const [switchboard, connect] = await Promise.all([import("@powerhousedao/ph-run/runners/switchboard"), import("@powerhousedao/ph-run/runners/connect")]);
152
- return {
153
- switchboard: switchboard.argsSchema,
154
- connect: connect.argsSchema
155
- };
156
- } catch {
157
- return;
158
- }
159
- }
160
- /**
161
- * Run by the CLI before a classic command: prints its warnings to stderr,
162
- * once per invocation. Never throws and never changes the exit code: a
163
- * warning that cannot be worked out is skipped.
164
- */
165
- async function warnClassicInvocation(args, projectRoot, env = process.env, warn) {
166
- try {
167
- if (deprecationWarned(CLASSIC_WARNED, env)) return;
168
- const invocation = classicInvocation(args);
169
- if (!invocation) return;
170
- const schemas = invocation.flags.length > 0 ? await loadArgSchemas() : void 0;
171
- warnDeprecations(classicDeprecations(args, projectRoot, schemas), env, warn);
172
- markDeprecationWarned(CLASSIC_WARNED, env);
173
- } catch {}
174
- }
175
- //#endregion
176
- export { warnClassicInvocation };
177
-
178
- //# sourceMappingURL=classic-warnings-BR0S6lr5.mjs.map
179
- //# debugId=e471107a-8d14-5b36-a64d-1676503ebd2a
@@ -1 +0,0 @@
1
- {"version":3,"file":"classic-warnings-BR0S6lr5.mjs","sources":["../src/utils/classic-warnings.ts"],"sourcesContent":["import {\n probeHostsFolder,\n type RunnerArgsSchema,\n} from \"@powerhousedao/host-core\";\nimport {\n deprecationWarned,\n DEPRECATIONS_REMOVED_IN,\n markDeprecationWarned,\n presentConfigKeys,\n supersededConfigKeys,\n warnDeprecations,\n type Deprecation,\n} from \"@powerhousedao/shared/clis/deprecations\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\n/**\n * The 6.3 warnings of a classic invocation: `ph vetra`, `ph connect`,\n * `ph switchboard` and the `ph reactor` alias, run the classic way. `ph run`\n * is not one, nor is a host name rewritten to it, so a project that runs its\n * hosts gets none of these.\n */\n\n/** The commands with a classic handling, as typed. */\nexport const CLASSIC_COMMANDS: ReadonlySet<string> = new Set([\n \"vetra\",\n \"connect\",\n \"switchboard\",\n \"reactor\",\n]);\n\n/** `ph connect <subcommand>` and the verb of the connect host it became. */\nconst CONNECT_VERBS: Readonly<Record<string, string>> = {\n studio: \"dev\",\n build: \"build\",\n preview: \"serve\",\n};\n\n/** Classic `ph switchboard` flags that became verbs of the host. */\nconst SWITCHBOARD_VERB_FLAGS: Readonly<Record<string, string>> = {\n \"--migrate\": \"migrate\",\n \"--migrate-status\": \"migrate-status\",\n \"--reset\": \"reset\",\n \"--dev\": \"dev\",\n};\n\n/** Read by the CLI itself, before any command. */\nconst CLI_FLAGS = new Set([\"--debug\"]);\n\n/** The runner argument schemas the classic flags are checked against. */\nexport interface ClassicArgSchemas {\n switchboard: RunnerArgsSchema;\n connect: RunnerArgsSchema;\n}\n\ninterface ClassicInvocation {\n /** As typed: `ph connect build`, `ph reactor`. */\n typed: string;\n /** The host that replaces the command. */\n host: \"vetra\" | \"connect\" | \"switchboard\";\n /** `ph run <host> [verb]`. */\n replacement: string;\n alias: boolean;\n /** The flags passed, by name, without their values. */\n flags: string[];\n}\n\nfunction classicInvocation(\n args: readonly string[],\n): ClassicInvocation | undefined {\n const [command, ...rest] = args;\n if (command === undefined || !CLASSIC_COMMANDS.has(command)) return undefined;\n if (rest.some((arg) => arg === \"--help\" || arg === \"-h\")) return undefined;\n const flags = [\n ...new Set(\n rest\n .filter((arg) => arg.startsWith(\"-\") && arg !== \"--\")\n .map((arg) => arg.split(\"=\")[0]),\n ),\n ].filter((name) => !CLI_FLAGS.has(name));\n if (command === \"connect\") {\n // `ph connect config` reads and writes the config: a tool, not a host.\n if (rest[0] === \"config\") return undefined;\n const subcommand =\n rest.length > 0 && Object.hasOwn(CONNECT_VERBS, rest[0])\n ? rest[0]\n : undefined;\n return {\n typed: subcommand ? `ph connect ${subcommand}` : \"ph connect\",\n host: \"connect\",\n replacement: `ph run connect ${CONNECT_VERBS[subcommand ?? \"studio\"]}`,\n alias: false,\n flags,\n };\n }\n if (command === \"vetra\") {\n return {\n typed: \"ph vetra\",\n host: \"vetra\",\n replacement: \"ph run vetra\",\n alias: false,\n flags,\n };\n }\n return {\n typed: `ph ${command}`,\n host: \"switchboard\",\n replacement: \"ph run switchboard\",\n alias: command === \"reactor\",\n flags,\n };\n}\n\n/** How `ph run <host>` takes a classic flag, when it does not take it as is. */\nfunction flagDeprecations(\n invocation: ClassicInvocation,\n schemas: ClassicArgSchemas,\n): Deprecation[] {\n const { typed, host, replacement } = invocation;\n // A compound hands each member its arguments; a member option goes by its\n // member name there (`--switchboard-port`), never by its plain one.\n const members =\n host === \"vetra\" ? [schemas.switchboard, schemas.connect] : [schemas[host]];\n const scoped = new Set(\n members.flatMap((schema) => Object.values(schema.memberOptions ?? {})),\n );\n const accepts = (name: string): boolean =>\n host === \"vetra\"\n ? members.some(\n (schema) =>\n schema.memberOptions?.[name] !== undefined ||\n (!scoped.has(name) &&\n [...schema.options, ...schema.flags].includes(name)),\n )\n : [...members[0].options, ...members[0].flags].includes(name);\n const deprecations: Deprecation[] = [];\n const unsupported: string[] = [];\n for (const name of invocation.flags) {\n const verb =\n host === \"switchboard\" ? SWITCHBOARD_VERB_FLAGS[name] : undefined;\n const retired = members.find((schema) => schema.retired?.[name])?.retired?.[\n name\n ];\n if (verb !== undefined) {\n deprecations.push({\n id: `classic:flag:${name}`,\n text: `\\`${typed} ${name}\\` is deprecated and stops working in ${DEPRECATIONS_REMOVED_IN}. Use \\`ph run switchboard ${verb}\\` instead.`,\n });\n } else if (accepts(name)) {\n continue;\n } else if (retired !== undefined) {\n deprecations.push({\n id: `classic:flag:${name}`,\n text: `\\`${typed} ${name}\\` is deprecated and stops working in ${DEPRECATIONS_REMOVED_IN}: ${retired}`,\n });\n } else {\n unsupported.push(name);\n }\n }\n if (unsupported.length > 0) {\n const one = unsupported.length === 1;\n const subject = one\n ? `\\`${typed} ${unsupported[0]}\\` has no \\`${replacement}\\` argument and stops`\n : `The \\`${typed}\\` flags ${unsupported.join(\", \")} have no \\`${replacement}\\` argument and stop`;\n deprecations.push({\n id: \"classic:flags\",\n text:\n `${subject} working in ${DEPRECATIONS_REMOVED_IN}. ` +\n `Set what ${one ? \"it configures\" : \"they configure\"} in the host files under hosts/ instead.`,\n });\n }\n return deprecations;\n}\n\nfunction readProjectConfig(projectRoot: string): unknown {\n try {\n return JSON.parse(\n fs.readFileSync(path.join(projectRoot, \"powerhouse.config.json\"), \"utf8\"),\n );\n } catch {\n return undefined;\n }\n}\n\n/**\n * What a classic invocation should be told, in order: the project without\n * hosts or the command with its replacement, the alias, its flags, and the\n * config keys only the classic commands read. `args` is the command line\n * after the host sugar. Empty for anything else, and for help.\n * `schemas` is only needed when the invocation passes flags.\n */\nexport function classicDeprecations(\n args: readonly string[],\n projectRoot: string,\n schemas?: ClassicArgSchemas,\n): Deprecation[] {\n const invocation = classicInvocation(args);\n if (!invocation) return [];\n const { typed, host, replacement, alias } = invocation;\n const deprecations: Deprecation[] = [];\n const probe = probeHostsFolder(projectRoot);\n if (probe.kind !== \"present\") {\n deprecations.push({\n id: \"classic:no-hosts\",\n text:\n `This project has no hosts/<name>/host.js, so \\`${typed}\\` runs the classic way, which stops working in ${DEPRECATIONS_REMOVED_IN}. ` +\n `Run \\`ph migrate\\` to add the host files, then use \\`${replacement}\\`.`,\n });\n } else if (!probe.hosts.includes(host)) {\n deprecations.push({\n id: \"classic:command\",\n text:\n `\\`${typed}\\` runs the classic way, which stops working in ${DEPRECATIONS_REMOVED_IN}. ` +\n `This project has no hosts/${host}/host.js: add that host file, then use \\`${replacement}\\`.`,\n });\n } else if (!alias) {\n deprecations.push({\n id: \"classic:command\",\n text:\n `\\`${typed}\\` runs the classic way and does not read hosts/${host}/host.js. ` +\n `The classic way stops working in ${DEPRECATIONS_REMOVED_IN}: use \\`${replacement}\\` instead.`,\n });\n }\n if (alias) {\n deprecations.push({\n id: \"classic:alias\",\n text: `\\`${typed}\\` is a deprecated alias and is removed in ${DEPRECATIONS_REMOVED_IN}. Use \\`${replacement}\\` instead.`,\n });\n }\n if (schemas && invocation.flags.length > 0) {\n deprecations.push(...flagDeprecations(invocation, schemas));\n }\n const superseded = presentConfigKeys(\n readProjectConfig(projectRoot),\n Object.keys(supersededConfigKeys),\n );\n if (superseded.length > 0) {\n const homes = superseded.map(\n (key) => `${key} to ${supersededConfigKeys[key]}`,\n );\n deprecations.push({\n id: \"classic:config\",\n text:\n `powerhouse.config.json sets ${superseded.join(\", \")}: only the classic commands read ${superseded.length === 1 ? \"it\" : \"them\"}, and ${DEPRECATIONS_REMOVED_IN} refuses ${superseded.length === 1 ? \"it\" : \"them\"}. ` +\n `Move ${homes.join(\"; \")}.`,\n });\n }\n return deprecations;\n}\n\n/** Marks an invocation whose classic warnings are out: the classic commands\n * it spawns inherit the mark and stay silent. */\nconst CLASSIC_WARNED = \"classic\";\n\nasync function loadArgSchemas(): Promise<ClassicArgSchemas | undefined> {\n try {\n const [switchboard, connect] = await Promise.all([\n import(\"@powerhousedao/ph-run/runners/switchboard\"),\n import(\"@powerhousedao/ph-run/runners/connect\"),\n ]);\n return {\n switchboard: switchboard.argsSchema,\n connect: connect.argsSchema,\n };\n } catch {\n return undefined;\n }\n}\n\n/**\n * Run by the CLI before a classic command: prints its warnings to stderr,\n * once per invocation. Never throws and never changes the exit code: a\n * warning that cannot be worked out is skipped.\n */\nexport async function warnClassicInvocation(\n args: readonly string[],\n projectRoot: string,\n env: Record<string, string | undefined> = process.env,\n warn?: (text: string) => void,\n): Promise<void> {\n try {\n if (deprecationWarned(CLASSIC_WARNED, env)) return;\n const invocation = classicInvocation(args);\n if (!invocation) return;\n const schemas =\n invocation.flags.length > 0 ? await loadArgSchemas() : undefined;\n warnDeprecations(\n classicDeprecations(args, projectRoot, schemas),\n env,\n warn,\n );\n markDeprecationWarned(CLASSIC_WARNED, env);\n } catch {\n // A warning must not stop the command.\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAwBA,MAAa,mCAAwC,IAAI,IAAI;CAC3D;CACA;CACA;CACA;AACF,CAAC;;AAGD,MAAM,gBAAkD;CACtD,QAAQ;CACR,OAAO;CACP,SAAS;AACX;;AAGA,MAAM,yBAA2D;CAC/D,aAAa;CACb,oBAAoB;CACpB,WAAW;CACX,SAAS;AACX;;AAGA,MAAM,4BAAY,IAAI,IAAI,CAAC,SAAS,CAAC;AAoBrC,SAAS,kBACP,MAC+B;CAC/B,MAAM,CAAC,SAAS,GAAG,QAAQ;CAC3B,IAAI,YAAY,KAAA,KAAa,CAAC,iBAAiB,IAAI,OAAO,GAAG,OAAO,KAAA;CACpE,IAAI,K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