@powerhousedao/codegen 6.0.0-dev.252 → 6.0.0-dev.254

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.
@@ -84,8 +84,8 @@ declare function tsMorphGenerateDocumentModel(documentModelState: DocumentModelG
84
84
  //#endregion
85
85
  //#region src/file-builders/document-model/utils.d.ts
86
86
  declare function operationHasInput(operation: OperationSpecification): boolean;
87
- declare function operationHasEmptyInput(operation: OperationSpecification): any;
88
- declare function operationHasAttachment(operation: OperationSpecification): any;
87
+ declare function operationHasEmptyInput(operation: OperationSpecification): boolean | undefined;
88
+ declare function operationHasAttachment(operation: OperationSpecification): boolean | undefined;
89
89
  //#endregion
90
90
  //#region src/file-builders/editor-common.d.ts
91
91
  type MakeEditorModuleFileArgs = {
@@ -142,7 +142,47 @@ declare function getOrCreateManifestFile(manifestPath: string): Promise<Manifest
142
142
  * if the manifest file doesn't exist yet.
143
143
  */
144
144
  declare function pruneManifestSection(projectDir: string, kind: "documentModels" | "editors" | "apps" | "processors" | "subgraphs", validIds: readonly string[]): Promise<void>;
145
- declare function createOrUpdateManifest(manifestData: Partial<Manifest>, projectDir: string): Promise<Manifest>;
145
+ declare function createOrUpdateManifest(manifestData: Partial<Manifest>, projectDir: string): Promise<{
146
+ name: string;
147
+ description?: string | undefined;
148
+ category?: string | undefined;
149
+ publisher?: {
150
+ name?: string | undefined;
151
+ url?: string | undefined;
152
+ } | undefined;
153
+ documentModels?: {
154
+ id: string;
155
+ name: string;
156
+ documentTypes?: string[] | undefined;
157
+ }[] | undefined;
158
+ apps?: {
159
+ id: string;
160
+ name: string;
161
+ documentTypes?: string[] | undefined;
162
+ }[] | undefined;
163
+ editors?: {
164
+ id: string;
165
+ name: string;
166
+ documentTypes?: string[] | undefined;
167
+ }[] | undefined;
168
+ processors?: {
169
+ id: string;
170
+ name: string;
171
+ documentTypes?: string[] | undefined;
172
+ }[] | undefined;
173
+ subgraphs?: {
174
+ id: string;
175
+ name: string;
176
+ documentTypes?: string[] | undefined;
177
+ }[] | undefined;
178
+ config?: {
179
+ name: string;
180
+ type: "var" | "secret";
181
+ description?: string | undefined;
182
+ required?: boolean | undefined;
183
+ default?: boolean | undefined;
184
+ }[] | undefined;
185
+ }>;
146
186
  //#endregion
147
187
  //#region src/file-builders/processors/processor.d.ts
148
188
  declare function tsMorphGenerateProcessor(args: {
@@ -167,7 +207,7 @@ declare function makeSubgraphsIndexFile(args: {
167
207
  declare function getActionTypeName(operation: OperationSpecification): string | undefined;
168
208
  declare function getActionInputName(operation: OperationSpecification): string | undefined;
169
209
  declare function getActionType(operation: OperationSpecification): string | undefined;
170
- declare function getActionInputTypeNames(args: DocumentModelModuleFileMakerArgs$1): any;
210
+ declare function getActionInputTypeNames(args: DocumentModelModuleFileMakerArgs$1): string;
171
211
  //#endregion
172
212
  //#region src/name-builders/get-variable-names.d.ts
173
213
  declare function getEditorVariableNames({
@@ -188,11 +228,11 @@ declare function getEditorVariableNames({
188
228
  declare function getDocumentModelDirName(documentModelState: DocumentModelGlobalState$1, existingDirName?: string): string;
189
229
  declare function getLatestDocumentModelSpec({
190
230
  specifications
191
- }: DocumentModelGlobalState$1): DocumentModelGlobalState$1;
231
+ }: DocumentModelGlobalState$1): DocumentSpecification$1;
192
232
  declare function getDocumentModelSpecByVersionNumber({
193
233
  specifications
194
234
  }: DocumentModelGlobalState$1, version: number): DocumentSpecification$1;
195
- declare function getLatestDocumentModelSpecVersionNumber(documentModelState: DocumentModelGlobalState$1): any;
235
+ declare function getLatestDocumentModelSpecVersionNumber(documentModelState: DocumentModelGlobalState$1): number;
196
236
  declare function getDocumentModelVariableNames(documentModelName: string): {
197
237
  kebabCaseDocumentType: string;
198
238
  pascalCaseDocumentType: string;
@@ -290,4 +330,4 @@ type CommandHelpInfo$1 = {
290
330
  };
291
331
  //#endregion
292
332
  export { makeEditorsFile as A, writeCliDocsMarkdownFile as B, tsMorphGenerateSubgraph as C, pruneManifestSection as D, getOrCreateManifestFile as E, tsMorphGenerateDocumentModel as F, writeGeneratedDocumentModelsFiles as G, writeAiConfigFiles as H, tsMorphGenerateDocumentEditor as I, writeGeneratedProjectRootFiles as J, writeGeneratedEditorsFiles as K, getCommandHelpInfo as L, operationHasAttachment as M, operationHasEmptyInput as N, makeModulesIndexFile as O, operationHasInput as P, tsMorphGenerateApp as Q, getCommandsHelpInfo as R, makeSubgraphsIndexFile as S, createOrUpdateManifest as T, writeAllGeneratedProjectFiles as U, buildBoilerplatePackageJson as V, writeCIFiles as W, writeModuleFiles as X, writeGeneratedSubgraphsFiles as Y, writeProjectRootFiles as Z, getLatestDocumentModelSpecVersionNumber as _, DocumentModelDocumentTypeMetadata$1 as a, getActionType as b, DocumentModelVariableNames as c, HelpTopic as d, getDocumentModelDirName as f, getLatestDocumentModelSpec as g, getEditorVariableNames as h, CommonMakeEditorComponentArgs as i, makeEditorsIndexFile as j, makeEditorModuleFile as k, EditorVariableNames$1 as l, getDocumentModelVariableNames as m, CommandHelpInfo$1 as n, DocumentModelFileMakerArgs as o, getDocumentModelSpecByVersionNumber as p, writeGeneratedProcessorsFiles as q, CommonGenerateEditorArgs$1 as r, DocumentModelModuleFileMakerArgs$1 as s, CommandEntry$1 as t, GenerateDocumentModelArgs as u, getActionInputName as v, tsMorphGenerateProcessor as w, getActionTypeName as x, getActionInputTypeNames as y, makeCliDocsFromHelp as z };
293
- //# sourceMappingURL=index-CIOH-vw2.d.mts.map
333
+ //# sourceMappingURL=index-DGqqrenJ.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-CIOH-vw2.d.mts","names":[],"sources":["../src/file-builders/app.ts","../src/file-builders/boilerplate/generated-project-files.ts","../src/file-builders/boilerplate/package.json.ts","../src/file-builders/clis/generate-cli-docs.ts","../src/file-builders/document-editor.ts","../src/file-builders/document-model/document-model.ts","../src/file-builders/document-model/utils.ts","../src/file-builders/editor-common.ts","../src/file-builders/index-files.ts","../src/file-builders/manifest.ts","../src/file-builders/processors/processor.ts","../src/file-builders/subgraphs.ts","../src/name-builders/get-action-names.ts","../src/name-builders/get-variable-names.ts","../src/file-builders/types.ts"],"mappings":";;;;;;;KA4BK,eAAA,GAAkB,wBAAA;EACrB,uBAAA;EACA,oBAAA;AAAA;;iBAGoB,kBAAA,CAAA;EACpB,OAAA;EACA,SAAA;EACA,UAAA;EACA,QAAA;EACA,uBAAA;EACA;AAAA,GACC,eAAA,GAAe,OAAA;;;iBCEI,8BAAA,CAA+B,UAAA,WAAkB,OAAA;AAAA,iBA+BjD,iCAAA,CAAkC,UAAA,WAAkB,OAAA;AAAA,iBAepD,0BAAA,CAA2B,UAAA,WAAkB,OAAA;AAAA,iBAW7C,6BAAA,CAA8B,UAAA,WAAkB,OAAA;AAAA,iBAuBhD,4BAAA,CAA6B,UAAA,WAAkB,OAAA;AAAA,iBAO/C,gBAAA,CAAiB,UAAA,YAA0B,OAAA;AAAA,iBAO3C,kBAAA,CAAmB,UAAA,YAA0B,OAAA;AAAA,iBA2B7C,qBAAA,CACpB,IAAA;EACE,IAAA;EACA,GAAA;EACA,OAAA;EACA,WAAA;EACA,cAAA;AAAA,GAEF,UAAA,YAA0B,OAAA;AAAA,iBAwBN,YAAA,CAAa,UAAA,YAA0B,OAAA;AAAA,iBAuBvC,6BAAA,CACpB,UAAA,YAA0B,OAAA;;;iBCjNN,2BAAA,CAA4B,IAAA;EAChD,IAAA;EACA,GAAA;EACA,OAAA;EACA,SAAA;AAAA,IACD,OAAA;;;iBCXe,kBAAA,gBAAkC,YAAA,CAAA,CAChD,KAAA,EAAO,MAAA,GACN,eAAA;AAAA,iBAWa,mBAAA,gBAAmC,YAAA,CAAA,CACjD,OAAA,EAAS,MAAA,KAAQ,eAAA;AAAA,iBAKH,mBAAA,gBAAmC,YAAA,CAAA,CAAc,IAAA;EAC/D,cAAA;EACA,SAAA;EACA,gBAAA;EACA,OAAA,EAAS,MAAA;AAAA;AAAA,iBAiBW,wBAAA,gBACL,YAAA,CAAA,CACf,IAAA;EACA,QAAA;EAC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AoB,wBAAA;AAAA;AAAA,KAGV,0BAAA,GAA6B,0BAAA;EACvC,OAAA,EAAS,OAAA;EACT,kBAAA,EAAoB,wBAAA;EACpB,OAAA;EACA,aAAA;EACA,QAAA;EACA,aAAA,EAAe,qBAAA;EACf,kBAAA;EACA,iBAAA;EACA,cAAA;EACA,UAAA;EACA,qBAAA;EACA,oBAAA;EACA,oBAAA;EACA,uBAAA;EACA,cAAA;EACA,cAAA;EACA,iBAAA;EACA,UAAA;EACA,aAAA;EACA,UAAA;EACA,YAAA;EACA,eAAA;AAAA;AAAA,KAGU,kCAAA,GAAmC,0BAAA;EAC7C,MAAA,EAAQ,mBAAA;AAAA;AAAA,KAGE,cAAA;EACV,IAAA;EACA,OAAA;IACE,WAAA;IACA,UAAA,SAAmB,SAAA;EAAA;AAAA;AAAA,KAIX,SAAA;EACV,QAAA;EACA,KAAA;EACA,WAAA;EACA,QAAA;AAAA;AAAA,KAGU,iBAAA;EACV,IAAA;EACA,WAAA;EACA,UAAA,EAAY,SAAA;AAAA"}
1
+ {"version":3,"file":"index-DGqqrenJ.d.mts","names":[],"sources":["../src/file-builders/app.ts","../src/file-builders/boilerplate/generated-project-files.ts","../src/file-builders/boilerplate/package.json.ts","../src/file-builders/clis/generate-cli-docs.ts","../src/file-builders/document-editor.ts","../src/file-builders/document-model/document-model.ts","../src/file-builders/document-model/utils.ts","../src/file-builders/editor-common.ts","../src/file-builders/index-files.ts","../src/file-builders/manifest.ts","../src/file-builders/processors/processor.ts","../src/file-builders/subgraphs.ts","../src/name-builders/get-action-names.ts","../src/name-builders/get-variable-names.ts","../src/file-builders/types.ts"],"mappings":";;;;;;;KA4BK,eAAA,GAAkB,wBAAA;EACrB,uBAAA;EACA,oBAAA;AAAA;;iBAGoB,kBAAA,CAAA;EACpB,OAAA;EACA,SAAA;EACA,UAAA;EACA,QAAA;EACA,uBAAA;EACA;AAAA,GACC,eAAA,GAAe,OAAA;;;iBCEI,8BAAA,CAA+B,UAAA,WAAkB,OAA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EACA,cAAA;EACA,iBAAA;EACA,UAAA;EACA,aAAA;EACA,UAAA;EACA,YAAA;EACA,eAAA;AAAA;AAAA,KAGU,kCAAA,GAAmC,0BAAA;EAC7C,MAAA,EAAQ,mBAAA;AAAA;AAAA,KAGE,cAAA;EACV,IAAA;EACA,OAAA;IACE,WAAA;IACA,UAAA,SAAmB,SAAA;EAAA;AAAA;AAAA,KAIX,SAAA;EACV,QAAA;EACA,KAAA;EACA,WAAA;EACA,QAAA;AAAA;AAAA,KAGU,iBAAA;EACV,IAAA;EACA,WAAA;EACA,UAAA,EAAY,SAAA;AAAA"}
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as DocumentModelDocumentTypeMetadata, c as DocumentModelVariableNames, d as HelpTopic, i as CommonMakeEditorComponentArgs, l as EditorVariableNames, n as CommandHelpInfo, o as DocumentModelFileMakerArgs, r as CommonGenerateEditorArgs, s as DocumentModelModuleFileMakerArgs, t as CommandEntry, u as GenerateDocumentModelArgs } from "./index-CIOH-vw2.mjs";
1
+ import { a as DocumentModelDocumentTypeMetadata, c as DocumentModelVariableNames, d as HelpTopic, i as CommonMakeEditorComponentArgs, l as EditorVariableNames, n as CommandHelpInfo, o as DocumentModelFileMakerArgs, r as CommonGenerateEditorArgs, s as DocumentModelModuleFileMakerArgs, t as CommandEntry, u as GenerateDocumentModelArgs } from "./index-DGqqrenJ.mjs";
2
2
  import { a as parseConfig, i as parseArgs, n as validateDocumentModelState, r as configSpec, t as DocumentModelStateValidationResult } from "./validation-Z3z0BJlu.mjs";
3
3
  import { FEATURE_DEPENDENCIES } from "@powerhousedao/shared/clis";
4
4
  import { PackageJson } from "read-pkg";
package/dist/index.mjs CHANGED
@@ -201,7 +201,7 @@ async function generateAll(project) {
201
201
  //#endregion
202
202
  //#region src/codegen/get-version.ts
203
203
  function getCodegenVersion() {
204
- return "6.0.0-dev.252";
204
+ return "6.0.0-dev.254";
205
205
  }
206
206
  //#endregion
207
207
  //#region src/codegen/kysely.ts
@@ -252,7 +252,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
252
252
  "dir": "/home/runner/work/powerhouse/powerhouse/apps/academy",
253
253
  "manifest": {
254
254
  "name": "@powerhousedao/academy",
255
- "version": "6.0.0-dev.252",
255
+ "version": "6.0.0-dev.254",
256
256
  "homepage": "https://powerhouse.academy",
257
257
  "packageManager": "pnpm@10.9.0",
258
258
  "repository": {
@@ -319,7 +319,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
319
319
  "manifest": {
320
320
  "name": "@powerhousedao/connect",
321
321
  "productName": "Powerhouse-Connect",
322
- "version": "6.0.0-dev.252",
322
+ "version": "6.0.0-dev.254",
323
323
  "description": "Powerhouse Connect",
324
324
  "main": "dist/index.html",
325
325
  "type": "module",
@@ -431,7 +431,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
431
431
  "manifest": {
432
432
  "name": "@powerhousedao/switchboard",
433
433
  "type": "module",
434
- "version": "6.0.0-dev.252",
434
+ "version": "6.0.0-dev.254",
435
435
  "main": "dist/index.mjs",
436
436
  "exports": {
437
437
  ".": {
@@ -499,6 +499,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
499
499
  "@powerhousedao/vetra": "workspace:*",
500
500
  "@powerhousedao/reactor-api": "workspace:*",
501
501
  "@powerhousedao/reactor-attachments": "workspace:*",
502
+ "@powerhousedao/reactor-drive": "workspace:*",
502
503
  "@powerhousedao/pglite-fs": "workspace:*",
503
504
  "@pyroscope/nodejs": "^0.4.5",
504
505
  "@renown/sdk": "workspace:*",
@@ -529,7 +530,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
529
530
  "dir": "/home/runner/work/powerhouse/powerhouse/clis/ph-cli",
530
531
  "manifest": {
531
532
  "name": "@powerhousedao/ph-cli",
532
- "version": "6.0.0-dev.252",
533
+ "version": "6.0.0-dev.254",
533
534
  "description": "",
534
535
  "license": "AGPL-3.0-only",
535
536
  "type": "module",
@@ -592,7 +593,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
592
593
  "dir": "/home/runner/work/powerhouse/powerhouse/clis/ph-cmd",
593
594
  "manifest": {
594
595
  "name": "ph-cmd",
595
- "version": "6.0.0-dev.252",
596
+ "version": "6.0.0-dev.254",
596
597
  "description": "",
597
598
  "license": "AGPL-3.0-only",
598
599
  "type": "module",
@@ -637,7 +638,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
637
638
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/analytics-engine/browser",
638
639
  "manifest": {
639
640
  "name": "@powerhousedao/analytics-engine-browser",
640
- "version": "6.0.0-dev.252",
641
+ "version": "6.0.0-dev.254",
641
642
  "license": "AGPL-3.0-only",
642
643
  "repository": {
643
644
  "type": "git",
@@ -683,7 +684,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
683
684
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/analytics-engine/core",
684
685
  "manifest": {
685
686
  "name": "@powerhousedao/analytics-engine-core",
686
- "version": "6.0.0-dev.252",
687
+ "version": "6.0.0-dev.254",
687
688
  "license": "AGPL-3.0-only",
688
689
  "repository": {
689
690
  "type": "git",
@@ -717,7 +718,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
717
718
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/analytics-engine/graphql",
718
719
  "manifest": {
719
720
  "name": "@powerhousedao/analytics-engine-graphql",
720
- "version": "6.0.0-dev.252",
721
+ "version": "6.0.0-dev.254",
721
722
  "license": "AGPL-3.0-only",
722
723
  "repository": {
723
724
  "type": "git",
@@ -751,7 +752,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
751
752
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/analytics-engine/knex",
752
753
  "manifest": {
753
754
  "name": "@powerhousedao/analytics-engine-knex",
754
- "version": "6.0.0-dev.252",
755
+ "version": "6.0.0-dev.254",
755
756
  "license": "AGPL-3.0-only",
756
757
  "repository": {
757
758
  "type": "git",
@@ -789,7 +790,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
789
790
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/analytics-engine/pg",
790
791
  "manifest": {
791
792
  "name": "@powerhousedao/analytics-engine-pg",
792
- "version": "6.0.0-dev.252",
793
+ "version": "6.0.0-dev.254",
793
794
  "license": "AGPL-3.0-only",
794
795
  "repository": {
795
796
  "type": "git",
@@ -828,7 +829,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
828
829
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/builder-tools",
829
830
  "manifest": {
830
831
  "name": "@powerhousedao/builder-tools",
831
- "version": "6.0.0-dev.252",
832
+ "version": "6.0.0-dev.254",
832
833
  "type": "module",
833
834
  "license": "AGPL-3.0-only",
834
835
  "publishConfig": { "access": "public" },
@@ -871,7 +872,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
871
872
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/codegen",
872
873
  "manifest": {
873
874
  "name": "@powerhousedao/codegen",
874
- "version": "6.0.0-dev.252",
875
+ "version": "6.0.0-dev.254",
875
876
  "license": "AGPL-3.0-only",
876
877
  "private": false,
877
878
  "type": "module",
@@ -946,7 +947,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
946
947
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/common",
947
948
  "manifest": {
948
949
  "name": "@powerhousedao/common",
949
- "version": "6.0.0-dev.252",
950
+ "version": "6.0.0-dev.254",
950
951
  "license": "AGPL-3.0-only",
951
952
  "type": "module",
952
953
  "files": ["/dist"],
@@ -1001,7 +1002,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
1001
1002
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/config",
1002
1003
  "manifest": {
1003
1004
  "name": "@powerhousedao/config",
1004
- "version": "6.0.0-dev.252",
1005
+ "version": "6.0.0-dev.254",
1005
1006
  "description": "",
1006
1007
  "license": "AGPL-3.0-only",
1007
1008
  "private": false,
@@ -1038,7 +1039,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
1038
1039
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/design-system",
1039
1040
  "manifest": {
1040
1041
  "name": "@powerhousedao/design-system",
1041
- "version": "6.0.0-dev.252",
1042
+ "version": "6.0.0-dev.254",
1042
1043
  "description": "",
1043
1044
  "files": ["dist", "theme.css"],
1044
1045
  "type": "module",
@@ -1189,7 +1190,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
1189
1190
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/document-model",
1190
1191
  "manifest": {
1191
1192
  "name": "document-model",
1192
- "version": "6.0.0-dev.252",
1193
+ "version": "6.0.0-dev.254",
1193
1194
  "license": "AGPL-3.0-only",
1194
1195
  "private": false,
1195
1196
  "files": ["dist"],
@@ -1251,7 +1252,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
1251
1252
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/opentelemetry-instrumentation-reactor",
1252
1253
  "manifest": {
1253
1254
  "name": "@powerhousedao/opentelemetry-instrumentation-reactor",
1254
- "version": "6.0.0-dev.252",
1255
+ "version": "6.0.0-dev.254",
1255
1256
  "description": "OpenTelemetry instrumentation for @powerhousedao/reactor",
1256
1257
  "type": "module",
1257
1258
  "sideEffects": false,
@@ -1289,7 +1290,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
1289
1290
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/pglite-fs",
1290
1291
  "manifest": {
1291
1292
  "name": "@powerhousedao/pglite-fs",
1292
- "version": "6.0.0-dev.252",
1293
+ "version": "6.0.0-dev.254",
1293
1294
  "license": "AGPL-3.0-only",
1294
1295
  "type": "module",
1295
1296
  "repository": {
@@ -1324,7 +1325,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
1324
1325
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/powerhouse-vetra-packages",
1325
1326
  "manifest": {
1326
1327
  "name": "@powerhousedao/powerhouse-vetra-packages",
1327
- "version": "6.0.0-dev.252",
1328
+ "version": "6.0.0-dev.254",
1328
1329
  "description": "",
1329
1330
  "keywords": [],
1330
1331
  "author": "",
@@ -1415,6 +1416,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
1415
1416
  "@powerhousedao/design-system": "workspace:*",
1416
1417
  "@powerhousedao/document-engineering": "catalog:",
1417
1418
  "@powerhousedao/reactor-browser": "workspace:*",
1419
+ "@powerhousedao/reactor-drive": "workspace:*",
1418
1420
  "@powerhousedao/shared": "workspace:*",
1419
1421
  "@radix-ui/react-label": "^2.1.4",
1420
1422
  "@radix-ui/react-slot": "^1.2.0",
@@ -1446,7 +1448,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
1446
1448
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/reactor",
1447
1449
  "manifest": {
1448
1450
  "name": "@powerhousedao/reactor",
1449
- "version": "6.0.0-dev.252",
1451
+ "version": "6.0.0-dev.254",
1450
1452
  "description": "",
1451
1453
  "repository": {
1452
1454
  "url": "https://github.com/powerhouse-inc/powerhouse",
@@ -1504,7 +1506,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
1504
1506
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/reactor-api",
1505
1507
  "manifest": {
1506
1508
  "name": "@powerhousedao/reactor-api",
1507
- "version": "6.0.0-dev.252",
1509
+ "version": "6.0.0-dev.254",
1508
1510
  "description": "",
1509
1511
  "type": "module",
1510
1512
  "repository": {
@@ -1541,7 +1543,8 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
1541
1543
  "codegen": "graphql-codegen --config codegen.ts && prettier --write src/graphql/reactor/gen/*.ts && eslint --fix src/graphql/reactor/gen/*.ts --no-warn-ignored",
1542
1544
  "codegen:watch": "graphql-codegen --config codegen.ts --watch",
1543
1545
  "dev": "tsx src/dev.ts",
1544
- "capture-hub-dump": "tsx scripts/capture-hub-dump.ts"
1546
+ "capture-hub-dump": "tsx scripts/capture-hub-dump.ts",
1547
+ "convert-hub-dump": "tsx scripts/convert-hub-dump.ts"
1545
1548
  },
1546
1549
  "publishConfig": { "access": "public" },
1547
1550
  "keywords": [],
@@ -1562,6 +1565,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
1562
1565
  "@powerhousedao/pglite-fs": "workspace:*",
1563
1566
  "@powerhousedao/reactor": "workspace:*",
1564
1567
  "@powerhousedao/reactor-attachments": "workspace:*",
1568
+ "@powerhousedao/reactor-drive": "workspace:*",
1565
1569
  "@powerhousedao/reactor-mcp": "workspace:*",
1566
1570
  "@powerhousedao/shared": "workspace:*",
1567
1571
  "@renown/sdk": "workspace:*",
@@ -1622,7 +1626,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
1622
1626
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/reactor-attachments",
1623
1627
  "manifest": {
1624
1628
  "name": "@powerhousedao/reactor-attachments",
1625
- "version": "6.0.0-dev.252",
1629
+ "version": "6.0.0-dev.254",
1626
1630
  "license": "AGPL-3.0-only",
1627
1631
  "type": "module",
1628
1632
  "repository": {
@@ -1659,7 +1663,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
1659
1663
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/reactor-browser",
1660
1664
  "manifest": {
1661
1665
  "name": "@powerhousedao/reactor-browser",
1662
- "version": "6.0.0-dev.252",
1666
+ "version": "6.0.0-dev.254",
1663
1667
  "license": "AGPL-3.0-only",
1664
1668
  "type": "module",
1665
1669
  "repository": {
@@ -1708,6 +1712,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
1708
1712
  "@powerhousedao/analytics-engine-browser": "workspace:*",
1709
1713
  "@powerhousedao/analytics-engine-core": "workspace:*",
1710
1714
  "@powerhousedao/reactor": "workspace:*",
1715
+ "@powerhousedao/reactor-drive": "workspace:*",
1711
1716
  "@powerhousedao/shared": "workspace:*",
1712
1717
  "@renown/sdk": "workspace:*",
1713
1718
  "@tanstack/react-query": "^5.49.2",
@@ -1762,7 +1767,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
1762
1767
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/reactor-drive",
1763
1768
  "manifest": {
1764
1769
  "name": "@powerhousedao/reactor-drive",
1765
- "version": "6.0.0-dev.252",
1770
+ "version": "6.0.0-dev.254",
1766
1771
  "license": "AGPL-3.0-only",
1767
1772
  "type": "module",
1768
1773
  "repository": {
@@ -1781,12 +1786,15 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
1781
1786
  "tsc": "tsc",
1782
1787
  "lint": "eslint",
1783
1788
  "build": "tsdown",
1784
- "test": "vitest --run"
1789
+ "test": "vitest --run",
1790
+ "bench": "vitest bench --run"
1785
1791
  },
1786
1792
  "dependencies": {
1787
1793
  "@powerhousedao/reactor": "workspace:*",
1788
1794
  "@powerhousedao/shared": "workspace:*",
1789
1795
  "document-model": "workspace:*",
1796
+ "graphql": "catalog:",
1797
+ "graphql-tag": "catalog:",
1790
1798
  "kysely": "catalog:"
1791
1799
  },
1792
1800
  "devDependencies": {
@@ -1801,7 +1809,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
1801
1809
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/reactor-hypercore",
1802
1810
  "manifest": {
1803
1811
  "name": "@powerhousedao/reactor-hypercore",
1804
- "version": "6.0.0-dev.252",
1812
+ "version": "6.0.0-dev.254",
1805
1813
  "description": "Hypercore-backed IOperationStore for the Powerhouse Reactor",
1806
1814
  "repository": {
1807
1815
  "url": "https://github.com/powerhouse-inc/powerhouse",
@@ -1844,7 +1852,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
1844
1852
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/reactor-mcp",
1845
1853
  "manifest": {
1846
1854
  "name": "@powerhousedao/reactor-mcp",
1847
- "version": "6.0.0-dev.252",
1855
+ "version": "6.0.0-dev.254",
1848
1856
  "description": "MCP server for document model operations in the Powerhouse ecosystem. For document model creation tasks, consider using the document-model-creator agent which provides a more guided experience.",
1849
1857
  "type": "module",
1850
1858
  "repository": {
@@ -1878,6 +1886,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
1878
1886
  "@openfeature/env-var-provider": "catalog:",
1879
1887
  "@openfeature/server-sdk": "catalog:",
1880
1888
  "@powerhousedao/reactor": "workspace:*",
1889
+ "@powerhousedao/reactor-drive": "workspace:*",
1881
1890
  "@powerhousedao/shared": "workspace:*",
1882
1891
  "change-case": "catalog:",
1883
1892
  "document-model": "workspace:*",
@@ -1896,7 +1905,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
1896
1905
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/registry",
1897
1906
  "manifest": {
1898
1907
  "name": "@powerhousedao/registry",
1899
- "version": "6.0.0-dev.252",
1908
+ "version": "6.0.0-dev.254",
1900
1909
  "description": "",
1901
1910
  "type": "module",
1902
1911
  "repository": {
@@ -1941,7 +1950,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
1941
1950
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/renown",
1942
1951
  "manifest": {
1943
1952
  "name": "@renown/sdk",
1944
- "version": "6.0.0-dev.252",
1953
+ "version": "6.0.0-dev.254",
1945
1954
  "description": "",
1946
1955
  "license": "AGPL-3.0-only",
1947
1956
  "private": false,
@@ -1992,7 +2001,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
1992
2001
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/shared",
1993
2002
  "manifest": {
1994
2003
  "name": "@powerhousedao/shared",
1995
- "version": "6.0.0-dev.252",
2004
+ "version": "6.0.0-dev.254",
1996
2005
  "type": "module",
1997
2006
  "sideEffects": false,
1998
2007
  "publishConfig": { "access": "public" },
@@ -2129,7 +2138,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
2129
2138
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/vetra",
2130
2139
  "manifest": {
2131
2140
  "name": "@powerhousedao/vetra",
2132
- "version": "6.0.0-dev.252",
2141
+ "version": "6.0.0-dev.254",
2133
2142
  "license": "AGPL-3.0-only",
2134
2143
  "type": "module",
2135
2144
  "sideEffects": false,
@@ -2692,7 +2701,7 @@ async function migrate(version, projectDir = process.cwd()) {
2692
2701
  "dir": "/home/runner/work/powerhouse/powerhouse/apps/academy",
2693
2702
  "manifest": {
2694
2703
  "name": "@powerhousedao/academy",
2695
- "version": "6.0.0-dev.252",
2704
+ "version": "6.0.0-dev.254",
2696
2705
  "homepage": "https://powerhouse.academy",
2697
2706
  "packageManager": "pnpm@10.9.0",
2698
2707
  "repository": {
@@ -2759,7 +2768,7 @@ async function migrate(version, projectDir = process.cwd()) {
2759
2768
  "manifest": {
2760
2769
  "name": "@powerhousedao/connect",
2761
2770
  "productName": "Powerhouse-Connect",
2762
- "version": "6.0.0-dev.252",
2771
+ "version": "6.0.0-dev.254",
2763
2772
  "description": "Powerhouse Connect",
2764
2773
  "main": "dist/index.html",
2765
2774
  "type": "module",
@@ -2871,7 +2880,7 @@ async function migrate(version, projectDir = process.cwd()) {
2871
2880
  "manifest": {
2872
2881
  "name": "@powerhousedao/switchboard",
2873
2882
  "type": "module",
2874
- "version": "6.0.0-dev.252",
2883
+ "version": "6.0.0-dev.254",
2875
2884
  "main": "dist/index.mjs",
2876
2885
  "exports": {
2877
2886
  ".": {
@@ -2939,6 +2948,7 @@ async function migrate(version, projectDir = process.cwd()) {
2939
2948
  "@powerhousedao/vetra": "workspace:*",
2940
2949
  "@powerhousedao/reactor-api": "workspace:*",
2941
2950
  "@powerhousedao/reactor-attachments": "workspace:*",
2951
+ "@powerhousedao/reactor-drive": "workspace:*",
2942
2952
  "@powerhousedao/pglite-fs": "workspace:*",
2943
2953
  "@pyroscope/nodejs": "^0.4.5",
2944
2954
  "@renown/sdk": "workspace:*",
@@ -2969,7 +2979,7 @@ async function migrate(version, projectDir = process.cwd()) {
2969
2979
  "dir": "/home/runner/work/powerhouse/powerhouse/clis/ph-cli",
2970
2980
  "manifest": {
2971
2981
  "name": "@powerhousedao/ph-cli",
2972
- "version": "6.0.0-dev.252",
2982
+ "version": "6.0.0-dev.254",
2973
2983
  "description": "",
2974
2984
  "license": "AGPL-3.0-only",
2975
2985
  "type": "module",
@@ -3032,7 +3042,7 @@ async function migrate(version, projectDir = process.cwd()) {
3032
3042
  "dir": "/home/runner/work/powerhouse/powerhouse/clis/ph-cmd",
3033
3043
  "manifest": {
3034
3044
  "name": "ph-cmd",
3035
- "version": "6.0.0-dev.252",
3045
+ "version": "6.0.0-dev.254",
3036
3046
  "description": "",
3037
3047
  "license": "AGPL-3.0-only",
3038
3048
  "type": "module",
@@ -3077,7 +3087,7 @@ async function migrate(version, projectDir = process.cwd()) {
3077
3087
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/analytics-engine/browser",
3078
3088
  "manifest": {
3079
3089
  "name": "@powerhousedao/analytics-engine-browser",
3080
- "version": "6.0.0-dev.252",
3090
+ "version": "6.0.0-dev.254",
3081
3091
  "license": "AGPL-3.0-only",
3082
3092
  "repository": {
3083
3093
  "type": "git",
@@ -3123,7 +3133,7 @@ async function migrate(version, projectDir = process.cwd()) {
3123
3133
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/analytics-engine/core",
3124
3134
  "manifest": {
3125
3135
  "name": "@powerhousedao/analytics-engine-core",
3126
- "version": "6.0.0-dev.252",
3136
+ "version": "6.0.0-dev.254",
3127
3137
  "license": "AGPL-3.0-only",
3128
3138
  "repository": {
3129
3139
  "type": "git",
@@ -3157,7 +3167,7 @@ async function migrate(version, projectDir = process.cwd()) {
3157
3167
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/analytics-engine/graphql",
3158
3168
  "manifest": {
3159
3169
  "name": "@powerhousedao/analytics-engine-graphql",
3160
- "version": "6.0.0-dev.252",
3170
+ "version": "6.0.0-dev.254",
3161
3171
  "license": "AGPL-3.0-only",
3162
3172
  "repository": {
3163
3173
  "type": "git",
@@ -3191,7 +3201,7 @@ async function migrate(version, projectDir = process.cwd()) {
3191
3201
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/analytics-engine/knex",
3192
3202
  "manifest": {
3193
3203
  "name": "@powerhousedao/analytics-engine-knex",
3194
- "version": "6.0.0-dev.252",
3204
+ "version": "6.0.0-dev.254",
3195
3205
  "license": "AGPL-3.0-only",
3196
3206
  "repository": {
3197
3207
  "type": "git",
@@ -3229,7 +3239,7 @@ async function migrate(version, projectDir = process.cwd()) {
3229
3239
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/analytics-engine/pg",
3230
3240
  "manifest": {
3231
3241
  "name": "@powerhousedao/analytics-engine-pg",
3232
- "version": "6.0.0-dev.252",
3242
+ "version": "6.0.0-dev.254",
3233
3243
  "license": "AGPL-3.0-only",
3234
3244
  "repository": {
3235
3245
  "type": "git",
@@ -3268,7 +3278,7 @@ async function migrate(version, projectDir = process.cwd()) {
3268
3278
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/builder-tools",
3269
3279
  "manifest": {
3270
3280
  "name": "@powerhousedao/builder-tools",
3271
- "version": "6.0.0-dev.252",
3281
+ "version": "6.0.0-dev.254",
3272
3282
  "type": "module",
3273
3283
  "license": "AGPL-3.0-only",
3274
3284
  "publishConfig": { "access": "public" },
@@ -3311,7 +3321,7 @@ async function migrate(version, projectDir = process.cwd()) {
3311
3321
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/codegen",
3312
3322
  "manifest": {
3313
3323
  "name": "@powerhousedao/codegen",
3314
- "version": "6.0.0-dev.252",
3324
+ "version": "6.0.0-dev.254",
3315
3325
  "license": "AGPL-3.0-only",
3316
3326
  "private": false,
3317
3327
  "type": "module",
@@ -3386,7 +3396,7 @@ async function migrate(version, projectDir = process.cwd()) {
3386
3396
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/common",
3387
3397
  "manifest": {
3388
3398
  "name": "@powerhousedao/common",
3389
- "version": "6.0.0-dev.252",
3399
+ "version": "6.0.0-dev.254",
3390
3400
  "license": "AGPL-3.0-only",
3391
3401
  "type": "module",
3392
3402
  "files": ["/dist"],
@@ -3441,7 +3451,7 @@ async function migrate(version, projectDir = process.cwd()) {
3441
3451
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/config",
3442
3452
  "manifest": {
3443
3453
  "name": "@powerhousedao/config",
3444
- "version": "6.0.0-dev.252",
3454
+ "version": "6.0.0-dev.254",
3445
3455
  "description": "",
3446
3456
  "license": "AGPL-3.0-only",
3447
3457
  "private": false,
@@ -3478,7 +3488,7 @@ async function migrate(version, projectDir = process.cwd()) {
3478
3488
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/design-system",
3479
3489
  "manifest": {
3480
3490
  "name": "@powerhousedao/design-system",
3481
- "version": "6.0.0-dev.252",
3491
+ "version": "6.0.0-dev.254",
3482
3492
  "description": "",
3483
3493
  "files": ["dist", "theme.css"],
3484
3494
  "type": "module",
@@ -3629,7 +3639,7 @@ async function migrate(version, projectDir = process.cwd()) {
3629
3639
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/document-model",
3630
3640
  "manifest": {
3631
3641
  "name": "document-model",
3632
- "version": "6.0.0-dev.252",
3642
+ "version": "6.0.0-dev.254",
3633
3643
  "license": "AGPL-3.0-only",
3634
3644
  "private": false,
3635
3645
  "files": ["dist"],
@@ -3691,7 +3701,7 @@ async function migrate(version, projectDir = process.cwd()) {
3691
3701
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/opentelemetry-instrumentation-reactor",
3692
3702
  "manifest": {
3693
3703
  "name": "@powerhousedao/opentelemetry-instrumentation-reactor",
3694
- "version": "6.0.0-dev.252",
3704
+ "version": "6.0.0-dev.254",
3695
3705
  "description": "OpenTelemetry instrumentation for @powerhousedao/reactor",
3696
3706
  "type": "module",
3697
3707
  "sideEffects": false,
@@ -3729,7 +3739,7 @@ async function migrate(version, projectDir = process.cwd()) {
3729
3739
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/pglite-fs",
3730
3740
  "manifest": {
3731
3741
  "name": "@powerhousedao/pglite-fs",
3732
- "version": "6.0.0-dev.252",
3742
+ "version": "6.0.0-dev.254",
3733
3743
  "license": "AGPL-3.0-only",
3734
3744
  "type": "module",
3735
3745
  "repository": {
@@ -3764,7 +3774,7 @@ async function migrate(version, projectDir = process.cwd()) {
3764
3774
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/powerhouse-vetra-packages",
3765
3775
  "manifest": {
3766
3776
  "name": "@powerhousedao/powerhouse-vetra-packages",
3767
- "version": "6.0.0-dev.252",
3777
+ "version": "6.0.0-dev.254",
3768
3778
  "description": "",
3769
3779
  "keywords": [],
3770
3780
  "author": "",
@@ -3855,6 +3865,7 @@ async function migrate(version, projectDir = process.cwd()) {
3855
3865
  "@powerhousedao/design-system": "workspace:*",
3856
3866
  "@powerhousedao/document-engineering": "catalog:",
3857
3867
  "@powerhousedao/reactor-browser": "workspace:*",
3868
+ "@powerhousedao/reactor-drive": "workspace:*",
3858
3869
  "@powerhousedao/shared": "workspace:*",
3859
3870
  "@radix-ui/react-label": "^2.1.4",
3860
3871
  "@radix-ui/react-slot": "^1.2.0",
@@ -3886,7 +3897,7 @@ async function migrate(version, projectDir = process.cwd()) {
3886
3897
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/reactor",
3887
3898
  "manifest": {
3888
3899
  "name": "@powerhousedao/reactor",
3889
- "version": "6.0.0-dev.252",
3900
+ "version": "6.0.0-dev.254",
3890
3901
  "description": "",
3891
3902
  "repository": {
3892
3903
  "url": "https://github.com/powerhouse-inc/powerhouse",
@@ -3944,7 +3955,7 @@ async function migrate(version, projectDir = process.cwd()) {
3944
3955
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/reactor-api",
3945
3956
  "manifest": {
3946
3957
  "name": "@powerhousedao/reactor-api",
3947
- "version": "6.0.0-dev.252",
3958
+ "version": "6.0.0-dev.254",
3948
3959
  "description": "",
3949
3960
  "type": "module",
3950
3961
  "repository": {
@@ -3981,7 +3992,8 @@ async function migrate(version, projectDir = process.cwd()) {
3981
3992
  "codegen": "graphql-codegen --config codegen.ts && prettier --write src/graphql/reactor/gen/*.ts && eslint --fix src/graphql/reactor/gen/*.ts --no-warn-ignored",
3982
3993
  "codegen:watch": "graphql-codegen --config codegen.ts --watch",
3983
3994
  "dev": "tsx src/dev.ts",
3984
- "capture-hub-dump": "tsx scripts/capture-hub-dump.ts"
3995
+ "capture-hub-dump": "tsx scripts/capture-hub-dump.ts",
3996
+ "convert-hub-dump": "tsx scripts/convert-hub-dump.ts"
3985
3997
  },
3986
3998
  "publishConfig": { "access": "public" },
3987
3999
  "keywords": [],
@@ -4002,6 +4014,7 @@ async function migrate(version, projectDir = process.cwd()) {
4002
4014
  "@powerhousedao/pglite-fs": "workspace:*",
4003
4015
  "@powerhousedao/reactor": "workspace:*",
4004
4016
  "@powerhousedao/reactor-attachments": "workspace:*",
4017
+ "@powerhousedao/reactor-drive": "workspace:*",
4005
4018
  "@powerhousedao/reactor-mcp": "workspace:*",
4006
4019
  "@powerhousedao/shared": "workspace:*",
4007
4020
  "@renown/sdk": "workspace:*",
@@ -4062,7 +4075,7 @@ async function migrate(version, projectDir = process.cwd()) {
4062
4075
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/reactor-attachments",
4063
4076
  "manifest": {
4064
4077
  "name": "@powerhousedao/reactor-attachments",
4065
- "version": "6.0.0-dev.252",
4078
+ "version": "6.0.0-dev.254",
4066
4079
  "license": "AGPL-3.0-only",
4067
4080
  "type": "module",
4068
4081
  "repository": {
@@ -4099,7 +4112,7 @@ async function migrate(version, projectDir = process.cwd()) {
4099
4112
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/reactor-browser",
4100
4113
  "manifest": {
4101
4114
  "name": "@powerhousedao/reactor-browser",
4102
- "version": "6.0.0-dev.252",
4115
+ "version": "6.0.0-dev.254",
4103
4116
  "license": "AGPL-3.0-only",
4104
4117
  "type": "module",
4105
4118
  "repository": {
@@ -4148,6 +4161,7 @@ async function migrate(version, projectDir = process.cwd()) {
4148
4161
  "@powerhousedao/analytics-engine-browser": "workspace:*",
4149
4162
  "@powerhousedao/analytics-engine-core": "workspace:*",
4150
4163
  "@powerhousedao/reactor": "workspace:*",
4164
+ "@powerhousedao/reactor-drive": "workspace:*",
4151
4165
  "@powerhousedao/shared": "workspace:*",
4152
4166
  "@renown/sdk": "workspace:*",
4153
4167
  "@tanstack/react-query": "^5.49.2",
@@ -4202,7 +4216,7 @@ async function migrate(version, projectDir = process.cwd()) {
4202
4216
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/reactor-drive",
4203
4217
  "manifest": {
4204
4218
  "name": "@powerhousedao/reactor-drive",
4205
- "version": "6.0.0-dev.252",
4219
+ "version": "6.0.0-dev.254",
4206
4220
  "license": "AGPL-3.0-only",
4207
4221
  "type": "module",
4208
4222
  "repository": {
@@ -4221,12 +4235,15 @@ async function migrate(version, projectDir = process.cwd()) {
4221
4235
  "tsc": "tsc",
4222
4236
  "lint": "eslint",
4223
4237
  "build": "tsdown",
4224
- "test": "vitest --run"
4238
+ "test": "vitest --run",
4239
+ "bench": "vitest bench --run"
4225
4240
  },
4226
4241
  "dependencies": {
4227
4242
  "@powerhousedao/reactor": "workspace:*",
4228
4243
  "@powerhousedao/shared": "workspace:*",
4229
4244
  "document-model": "workspace:*",
4245
+ "graphql": "catalog:",
4246
+ "graphql-tag": "catalog:",
4230
4247
  "kysely": "catalog:"
4231
4248
  },
4232
4249
  "devDependencies": {
@@ -4241,7 +4258,7 @@ async function migrate(version, projectDir = process.cwd()) {
4241
4258
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/reactor-hypercore",
4242
4259
  "manifest": {
4243
4260
  "name": "@powerhousedao/reactor-hypercore",
4244
- "version": "6.0.0-dev.252",
4261
+ "version": "6.0.0-dev.254",
4245
4262
  "description": "Hypercore-backed IOperationStore for the Powerhouse Reactor",
4246
4263
  "repository": {
4247
4264
  "url": "https://github.com/powerhouse-inc/powerhouse",
@@ -4284,7 +4301,7 @@ async function migrate(version, projectDir = process.cwd()) {
4284
4301
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/reactor-mcp",
4285
4302
  "manifest": {
4286
4303
  "name": "@powerhousedao/reactor-mcp",
4287
- "version": "6.0.0-dev.252",
4304
+ "version": "6.0.0-dev.254",
4288
4305
  "description": "MCP server for document model operations in the Powerhouse ecosystem. For document model creation tasks, consider using the document-model-creator agent which provides a more guided experience.",
4289
4306
  "type": "module",
4290
4307
  "repository": {
@@ -4318,6 +4335,7 @@ async function migrate(version, projectDir = process.cwd()) {
4318
4335
  "@openfeature/env-var-provider": "catalog:",
4319
4336
  "@openfeature/server-sdk": "catalog:",
4320
4337
  "@powerhousedao/reactor": "workspace:*",
4338
+ "@powerhousedao/reactor-drive": "workspace:*",
4321
4339
  "@powerhousedao/shared": "workspace:*",
4322
4340
  "change-case": "catalog:",
4323
4341
  "document-model": "workspace:*",
@@ -4336,7 +4354,7 @@ async function migrate(version, projectDir = process.cwd()) {
4336
4354
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/registry",
4337
4355
  "manifest": {
4338
4356
  "name": "@powerhousedao/registry",
4339
- "version": "6.0.0-dev.252",
4357
+ "version": "6.0.0-dev.254",
4340
4358
  "description": "",
4341
4359
  "type": "module",
4342
4360
  "repository": {
@@ -4381,7 +4399,7 @@ async function migrate(version, projectDir = process.cwd()) {
4381
4399
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/renown",
4382
4400
  "manifest": {
4383
4401
  "name": "@renown/sdk",
4384
- "version": "6.0.0-dev.252",
4402
+ "version": "6.0.0-dev.254",
4385
4403
  "description": "",
4386
4404
  "license": "AGPL-3.0-only",
4387
4405
  "private": false,
@@ -4432,7 +4450,7 @@ async function migrate(version, projectDir = process.cwd()) {
4432
4450
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/shared",
4433
4451
  "manifest": {
4434
4452
  "name": "@powerhousedao/shared",
4435
- "version": "6.0.0-dev.252",
4453
+ "version": "6.0.0-dev.254",
4436
4454
  "type": "module",
4437
4455
  "sideEffects": false,
4438
4456
  "publishConfig": { "access": "public" },
@@ -4569,7 +4587,7 @@ async function migrate(version, projectDir = process.cwd()) {
4569
4587
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/vetra",
4570
4588
  "manifest": {
4571
4589
  "name": "@powerhousedao/vetra",
4572
- "version": "6.0.0-dev.252",
4590
+ "version": "6.0.0-dev.254",
4573
4591
  "license": "AGPL-3.0-only",
4574
4592
  "type": "module",
4575
4593
  "sideEffects": false,
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["readdirSync","join","path","fs","fs"],"sources":["../src/codegen/utils.ts","../src/codegen/features.ts","../src/codegen/generate.ts","../src/codegen/get-version.ts","../src/codegen/kysely.ts","../src/codegen/migrate.ts","../src/create-lib/checkout-project.ts","../src/create-lib/create-project.ts","../src/ts-morph-generator/core/FileGenerator.ts","../src/ts-morph-generator/core/ReducerGenerator.ts","../src/ts-morph-generator/utilities/DeclarationManager.ts","../src/ts-morph-generator/utilities/DirectoryManager.ts","../src/ts-morph-generator/utilities/ImportManager.ts","../src/ts-morph-generator/core/TSMorphCodeGenerator.ts"],"sourcesContent":["import type {\n DocumentModelDocument,\n DocumentModelGlobalState,\n} from \"@powerhousedao/shared/document-model\";\nimport { documentModelReducer } from \"@powerhousedao/shared/document-model\";\nimport { baseLoadFromFile } from \"document-model/node\";\nimport { readFile } from \"node:fs/promises\";\n\nexport function sortByKey<T extends Record<string, unknown>>(value: T): T {\n return Object.fromEntries(\n Object.entries(value).sort(([a], [b]) => a.localeCompare(b)),\n ) as T;\n}\n\nexport async function loadDocumentModel(\n path: string,\n): Promise<DocumentModelGlobalState> {\n let documentModel: DocumentModelGlobalState;\n try {\n if (!path) {\n throw new Error(\"Document model file not specified\");\n } else if (path.endsWith(\".zip\") || path.endsWith(\".phd\")) {\n const file = await baseLoadFromFile(path, documentModelReducer);\n documentModel = file.state.global;\n } else if (path.endsWith(\".json\")) {\n const data = await readFile(path, \"utf-8\");\n const parsedData = JSON.parse(data) as DocumentModelDocument;\n if (\"state\" in parsedData) {\n documentModel = parsedData.state.global;\n } else {\n documentModel = parsedData;\n }\n } else {\n throw new Error(\"File type not supported. Must be zip, phd, or json.\");\n }\n return documentModel;\n } catch (error) {\n throw (error as { code?: string }).code === \"MODULE_NOT_FOUND\"\n ? new Error(`Document model not found.`)\n : error;\n }\n}\n","import {\n ANALYTICS_ENGINE_CORE_PACKAGE,\n FEATURE_DEPENDENCIES,\n} from \"@powerhousedao/shared/clis\";\nimport { readdirSync, readFileSync, statSync } from \"fs\";\nimport { join } from \"path\";\nimport { type PackageJson, readPackage } from \"read-pkg\";\nimport { writePackage } from \"write-package\";\nimport { sortByKey } from \"./utils.js\";\n\nexport type Feature = keyof typeof FEATURE_DEPENDENCIES;\n\nfunction hasAnalyticsProcessor(processorsDir: string): boolean {\n const entries = readdirSync(processorsDir, { withFileTypes: true });\n for (const entry of entries) {\n if (!entry.isDirectory()) continue;\n const dir = join(processorsDir, entry.name);\n // processor.ts is the current shape; index.ts is the pre-migrate fallback.\n for (const filename of [\"processor.ts\", \"index.ts\"]) {\n try {\n const contents = readFileSync(join(dir, filename), \"utf-8\");\n if (contents.includes(ANALYTICS_ENGINE_CORE_PACKAGE)) return true;\n } catch {\n // file missing — try next candidate\n }\n }\n }\n return false;\n}\n\nexport function detectFeatures(projectDir: string): Feature[] {\n const features: Feature[] = [];\n const processorsDir = join(projectDir, \"processors\");\n const processorsStat = statSync(processorsDir, { throwIfNoEntry: false });\n if (processorsStat?.isDirectory() && hasAnalyticsProcessor(processorsDir)) {\n features.push(\"analyticsProcessor\");\n }\n return features;\n}\n\n// Idempotently adds the peer + dev deps required by `features` to the\n// project's package.json. Reuses the existing `document-model` pin as the\n// version anchor for new workspace peers so generated entries stay in sync\n// with whatever migrate last wrote. No-op if the entries are already present.\nexport async function syncFeatureDependencies(\n features: readonly Feature[],\n projectDir: string,\n): Promise<void> {\n if (features.length === 0) return;\n\n const packageJson = await readPackage({ cwd: projectDir, normalize: false });\n\n const pinVersion =\n packageJson.peerDependencies?.[\"document-model\"] ??\n packageJson.devDependencies?.[\"document-model\"];\n if (!pinVersion) {\n throw new Error(\n \"Cannot sync feature dependencies: project is missing `document-model` in peer/devDependencies. Run `ph migrate` first.\",\n );\n }\n\n const peerDependencies = {\n ...(packageJson.peerDependencies ?? {}),\n } as Record<string, string>;\n const devDependencies = {\n ...(packageJson.devDependencies ?? {}),\n } as Record<string, string>;\n\n const added: string[] = [];\n for (const feature of features) {\n const spec = FEATURE_DEPENDENCIES[feature];\n for (const pkg of spec.peerVersioned) {\n if (peerDependencies[pkg] === undefined) {\n peerDependencies[pkg] = pinVersion;\n added.push(pkg);\n }\n if (devDependencies[pkg] === undefined) {\n devDependencies[pkg] = pinVersion;\n }\n }\n const peerExternal = spec.peerExternal as Record<\n string,\n { peer: string; dev: string }\n >;\n for (const [pkg, versionSpec] of Object.entries(peerExternal)) {\n if (peerDependencies[pkg] === undefined) {\n peerDependencies[pkg] = versionSpec.peer;\n added.push(pkg);\n }\n if (devDependencies[pkg] === undefined) {\n devDependencies[pkg] = versionSpec.dev;\n }\n }\n }\n\n if (added.length === 0) return;\n\n const updated = {\n ...packageJson,\n peerDependencies: sortByKey(peerDependencies),\n devDependencies: sortByKey(devDependencies),\n } as PackageJson;\n await writePackage(projectDir, updated);\n console.log(`Added peer/dev dependencies: ${added.join(\", \")}`);\n}\n","import { type DocumentModelGlobalState } from \"@powerhousedao/shared/document-model\";\nimport type { ProcessorApps } from \"@powerhousedao/shared/processors\";\nimport { kebabCase } from \"change-case\";\nimport {\n pruneManifestSection,\n tsMorphGenerateApp,\n tsMorphGenerateDocumentEditor,\n tsMorphGenerateDocumentModel,\n tsMorphGenerateProcessor,\n tsMorphGenerateSubgraph,\n} from \"file-builders\";\nimport { readdirSync } from \"node:fs\";\nimport {\n filter,\n isDefined,\n isIncludedIn,\n isTruthy,\n map,\n pipe,\n prop,\n unique,\n} from \"remeda\";\nimport type { Project } from \"ts-morph\";\nimport {\n getAppMetadata,\n getEditorMetadata,\n getOrCreateDirectory,\n getProcessorMetadata,\n getSubgraphMetadata,\n loadDocumentModelInDir,\n} from \"utils\";\nimport { loadDocumentModel } from \"./utils.js\";\n\nexport async function generateDocumentModel(\n documentModelState: DocumentModelGlobalState,\n project: Project,\n) {\n await tsMorphGenerateDocumentModel(documentModelState, project);\n}\n\n/* Runs generate for each document model json file found in the project's `document-models` directory */\nexport async function generateAllDocumentModels(project: Project) {\n const { directory: documentModelsDir } = getOrCreateDirectory(\n project,\n \"document-models\",\n );\n const documentModelsDirPath = documentModelsDir.getPath();\n const projectDir = documentModelsDir.getParentOrThrow().getPath();\n const documentModelStateFiles = pipe(\n readdirSync(documentModelsDirPath, { withFileTypes: true }),\n map(loadDocumentModelInDir),\n filter(isDefined),\n );\n\n for (const documentModelState of documentModelStateFiles) {\n await generateDocumentModel(documentModelState, project);\n }\n\n await pruneManifestSection(\n projectDir,\n \"documentModels\",\n documentModelStateFiles.map((s) => s.id),\n );\n}\nexport async function generateFromFile(filePath: string, project: Project) {\n // load document model spec from file\n const documentModelState = await loadDocumentModel(filePath);\n\n // delegate to shared generation function\n await generateDocumentModel(documentModelState, project);\n}\n\ntype GenerateEditorArgs = {\n editorName: string;\n documentTypes: string[];\n editorId?: string;\n editorDirName?: string;\n};\nexport async function generateEditor(\n args: GenerateEditorArgs,\n project: Project,\n) {\n const {\n editorName,\n documentTypes,\n editorId: editorIdArg,\n editorDirName,\n } = args;\n\n if (documentTypes.length > 1) {\n throw new Error(\"Multiple document types are not supported yet\");\n }\n\n const documentModelId = documentTypes[0];\n const editorId = editorIdArg || kebabCase(editorName);\n const editorDir = editorDirName || kebabCase(editorName);\n\n await tsMorphGenerateDocumentEditor({\n project,\n editorDir,\n documentModelId,\n editorName,\n editorId,\n });\n}\n\n/* Runs generate for all editors found in the project's `editors` directory.\n * Note: we intentionally filter out editors with the document type \"powerhouse/document-drive\".\n * These are handled separately by the `generateAllApps` function.\n */\nexport async function generateAllEditors(project: Project) {\n const { directory: editorsDir } = getOrCreateDirectory(project, \"editors\");\n const projectDir = editorsDir.getParentOrThrow().getPath();\n\n /* An editor's `id`, `name`, and `documentTypes` args can be found in the `module.ts` file */\n const editorsToAdd = pipe(\n editorsDir.getDirectories(),\n map((dir) => dir.getBaseName()),\n map((dirName) => getEditorMetadata(project, dirName)),\n filter(isTruthy),\n filter(\n ({ documentTypes }) =>\n !isIncludedIn(\"powerhouse/document-drive\", documentTypes),\n ),\n );\n\n for (const editorToAdd of editorsToAdd) {\n const {\n name: editorName,\n id: editorId,\n dirName: editorDirName,\n documentTypes,\n } = editorToAdd;\n\n await generateEditor(\n {\n editorName,\n editorId,\n editorDirName,\n documentTypes,\n },\n project,\n );\n }\n\n await pruneManifestSection(\n projectDir,\n \"editors\",\n editorsToAdd.map((e) => e.id),\n );\n}\n\ntype GenerateAppArgs = {\n appName: string;\n appId?: string;\n allowedDocumentTypes?: string[];\n isDragAndDropEnabled?: boolean;\n appDirName?: string;\n};\nexport async function generateApp(args: GenerateAppArgs, project: Project) {\n const {\n appName,\n appId,\n allowedDocumentTypes,\n isDragAndDropEnabled,\n appDirName,\n } = args;\n\n await tsMorphGenerateApp({\n project,\n editorDir: appDirName || kebabCase(appName),\n editorName: appName,\n editorId: appId ?? kebabCase(appName),\n allowedDocumentModelIds: allowedDocumentTypes ?? [],\n isDragAndDropEnabled: isDragAndDropEnabled ?? true,\n });\n}\n\n/* Runs generate for all apps found in the project's `editors` directory.\n * Note: we intentionally filter out editors which do not have the document type \"powerhouse/document-drive\".\n * These are handled separately by the `generateAllEditors` function.\n */\nexport async function generateAllApps(project: Project) {\n const { directory: editorsDir } = getOrCreateDirectory(project, \"editors\");\n const projectDir = editorsDir.getParentOrThrow().getPath();\n\n /* An editor's `id`, `name`, and `documentTypes` args can be found in the `module.ts` file */\n const appsToAdd = pipe(\n editorsDir.getDirectories(),\n map((dir) => dir.getBaseName()),\n map((dirName) => getAppMetadata(project, dirName)),\n filter(isTruthy),\n );\n\n for (const appToAdd of appsToAdd) {\n const {\n name: appName,\n id: appId,\n dirName: appDirName,\n allowedDocumentTypes,\n isDragAndDropEnabled,\n } = appToAdd;\n await generateApp(\n {\n appName,\n appDirName,\n appId,\n allowedDocumentTypes,\n isDragAndDropEnabled,\n },\n project,\n );\n }\n\n await pruneManifestSection(\n projectDir,\n \"apps\",\n appsToAdd.map((a) => a.id),\n );\n}\nexport async function generateSubgraph(subgraphName: string, project: Project) {\n await tsMorphGenerateSubgraph({ subgraphName, project });\n}\n\n/* Runs generate for each directory found in the project's `subgraphs` directory */\nexport async function generateAllSubgraphs(project: Project) {\n const { directory: subgraphsDir } = getOrCreateDirectory(\n project,\n \"subgraphs\",\n );\n const projectDir = subgraphsDir.getParentOrThrow().getPath();\n /* The subgraph's name is found in the `index.ts` file */\n const subgraphNames = pipe(\n subgraphsDir.getDirectories(),\n map((dir) => dir.getBaseName()),\n map((dirName) => getSubgraphMetadata(project, dirName)),\n map(prop(\"subgraphName\")),\n filter(isDefined),\n unique(),\n );\n for (const subgraphName of subgraphNames) {\n await generateSubgraph(subgraphName, project);\n }\n\n await pruneManifestSection(\n projectDir,\n \"subgraphs\",\n subgraphNames.map((name) => kebabCase(name)),\n );\n}\n\nexport async function generateProcessor(\n args: {\n processorName: string;\n processorType: \"analytics\" | \"relationalDb\";\n processorApps: ProcessorApps;\n documentTypes: string[];\n },\n project: Project,\n) {\n return await tsMorphGenerateProcessor({\n project,\n ...args,\n });\n}\n\n/* Runs generate for each directory found in the project's `processors` directory */\nexport async function generateAllProcessors(project: Project) {\n const { directory: processorsDir } = getOrCreateDirectory(\n project,\n \"processors\",\n );\n const projectDir = processorsDir.getParentOrThrow().getPath();\n const processorsToGenerate = pipe(\n processorsDir.getDirectories(),\n map((dir) => dir.getBaseName()),\n map((dirName) => getProcessorMetadata(project, dirName)),\n );\n\n for (const processorArgs of processorsToGenerate) {\n await generateProcessor(processorArgs, project);\n }\n\n await pruneManifestSection(\n projectDir,\n \"processors\",\n processorsToGenerate.map((p) => kebabCase(p.processorName)),\n );\n}\n\n/* Runs each module type's generateAll{moduleType} function for the current project */\nexport async function generateAll(project: Project) {\n await generateAllDocumentModels(project);\n await generateAllEditors(project);\n await generateAllApps(project);\n await generateAllSubgraphs(project);\n await generateAllProcessors(project);\n}\n","declare const CODEGEN_VERSION: string | undefined;\n\nexport function getCodegenVersion(): string {\n if (typeof CODEGEN_VERSION !== \"undefined\") return CODEGEN_VERSION;\n return (\n process.env.WORKSPACE_VERSION ||\n process.env.npm_package_version ||\n \"unknown\"\n );\n}\n","import { spawn } from \"node:child_process\";\nimport { existsSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { join, resolve } from \"node:path\";\n\nfunction getKyselyPgLiteBin(): string {\n const require = createRequire(import.meta.url);\n\n const paths = require.resolve.paths(\"kysely-pglite\");\n if (paths) {\n for (const basePath of paths) {\n const pkgRoot = join(basePath, \"kysely-pglite\");\n const binPath = join(pkgRoot, \"bin/run.js\");\n\n if (existsSync(binPath)) {\n return binPath;\n }\n }\n }\n\n throw new Error(\"Could not find kysely-pglite/bin/run.js\");\n}\n\nexport interface IOptions {\n migrationFile: string;\n schemaFile?: string;\n}\n\nfunction runCommand(\n command: string,\n args: string[],\n cwd?: string,\n): Promise<void> {\n return new Promise((resolve, reject) => {\n const child = spawn(command, args, {\n cwd,\n stdio: \"inherit\",\n shell: true,\n });\n\n child.on(\"close\", (code) => {\n if (code === 0) {\n resolve();\n } else {\n reject(new Error(`Command failed with exit code ${code}`));\n }\n });\n\n child.on(\"error\", (error) => {\n reject(error);\n });\n });\n}\n\nexport async function generateDBSchema({\n migrationFile,\n schemaFile,\n}: IOptions) {\n const outFile = schemaFile ?? resolve(migrationFile, \"../schema.ts\");\n\n try {\n const kyselyBinPath = getKyselyPgLiteBin();\n // Use kysely-pglite CLI to handle TypeScript compilation and module resolution\n await runCommand(\n \"node\",\n [kyselyBinPath, migrationFile, \"--outFile\", outFile],\n process.cwd(),\n );\n\n console.log(`Schema types generated at ${outFile}`);\n } catch (error) {\n console.error(\"Error running migration:\", error);\n }\n}\n","import {\n externalDevDependencies,\n FEATURE_DEPENDENCIES,\n getPackageManagerAtPowerhouseProjectDirPath,\n getPowerhouseProjectInstallCommand,\n packageJsonExports,\n packageScripts,\n PEER_EXTERNAL_DEPENDENCIES,\n runCmd,\n VERSIONED_DEV_DEPENDENCIES,\n VERSIONED_PEER_DEPENDENCIES,\n} from \"@powerhousedao/shared/clis\";\nimport console from \"console\";\nimport { writeAllGeneratedProjectFiles } from \"file-builders\";\nimport { cpSync, mkdirSync, readdirSync, rmSync, statSync } from \"fs\";\nimport npmFetch from \"npm-registry-fetch\";\nimport { join } from \"path\";\nimport { type PackageJson, readPackage } from \"read-pkg\";\nimport {\n filter,\n fromKeys,\n isTruthy,\n keys,\n map,\n mapValues,\n merge,\n omit,\n pipe,\n prop,\n} from \"remeda\";\nimport type { Project } from \"ts-morph\";\nimport { buildTsMorphProject } from \"utils\";\nimport { writePackage } from \"write-package\";\nimport { detectFeatures } from \"./features.js\";\nimport { generateAll } from \"./generate.js\";\nimport { sortByKey } from \"./utils.js\";\n\n/* Uses the npm cli's fetch function to get the version for a specified tag */\nexport async function getFullyQualifiedWorkspacePackageVersion(\n versionOrTag: string,\n) {\n const isTag =\n versionOrTag === \"latest\" ||\n versionOrTag === \"staging\" ||\n versionOrTag === \"dev\";\n\n if (!isTag) return versionOrTag;\n const result = (await npmFetch.json(\n `${WORKSPACE_PACKAGES[0].manifest.name!}`,\n )) as { \"dist-tags\": Record<\"latest\" | \"staging\" | \"dev\", string> };\n return result[\"dist-tags\"][versionOrTag];\n}\n\nexport function fixLegacyImportPaths(\n project: Project,\n packageName: string | undefined,\n) {\n if (!packageName) {\n console.error(\"No package name found in package.json.\");\n return;\n }\n const sourceFiles = project.getSourceFiles();\n for (const sourceFile of sourceFiles) {\n const importStatements = sourceFile.getImportDeclarations();\n for (const importStatement of importStatements) {\n const namedImports = map(\n importStatement.getNamedImports(),\n (importSpecifier) => importSpecifier.getText(),\n );\n const moduleSpecifier = importStatement.getModuleSpecifier();\n const moduleSpecifierText = moduleSpecifier.getLiteralText();\n // remove usage of the old `package-name/` style paths\n if (moduleSpecifierText.includes(packageName)) {\n moduleSpecifier.setLiteralValue(\n moduleSpecifierText.replace(`${packageName}/`, \"\"),\n );\n }\n // I saw this invalid import enough that it seemed worthwhile to fix it here\n if (namedImports.includes(\"generateMock\")) {\n moduleSpecifier.setLiteralValue(\"document-model\");\n }\n // attempt to fix absolute import paths for document models like `../../../document-models/model/something/something.js`\n // these don't work anymore with the versioned document models, since the absolute file paths are different\n const match = moduleSpecifierText.match(\n /^(\\.\\.\\/)+document-models\\/([^/]+)(?!\\/v\\d+(?:\\/|$))(?:\\/.*)?$/,\n );\n\n if (match) {\n moduleSpecifier.setLiteralValue(`document-models/${match[2]}`);\n }\n }\n }\n}\n\nfunction isProtectedVersionSpec(value: unknown): value is string {\n return (\n typeof value === \"string\" &&\n (value.startsWith(\"workspace:\") || value.startsWith(\"catalog:\"))\n );\n}\n\n// Keeps user-declared `workspace:*` / `catalog:` refs intact when the caller\n// would otherwise replace them with a hard pin during migration.\nfunction preserveProtected(\n newValues: Record<string, string>,\n existingSources: ReadonlyArray<\n Partial<Record<string, string | undefined>> | undefined\n >,\n): Record<string, string> {\n const result: Record<string, string> = { ...newValues };\n for (const key of Object.keys(newValues)) {\n for (const source of existingSources) {\n const existing = source?.[key];\n if (isProtectedVersionSpec(existing)) {\n result[key] = existing;\n break;\n }\n }\n }\n return result;\n}\n\nexport async function migrate(version: string, projectDir = process.cwd()) {\n const fullyQualifiedVersion =\n await getFullyQualifiedWorkspacePackageVersion(version);\n\n const packageJson = await readPackage({\n cwd: projectDir,\n normalize: false,\n });\n const exports = packageJsonExports;\n const scripts = merge(packageJson.scripts, packageScripts);\n const workspacePackageNames = filter(\n map(WORKSPACE_PACKAGES, prop(\"manifest\", \"name\")),\n isTruthy,\n );\n\n const features = detectFeatures(projectDir);\n const featurePeerVersioned = features.flatMap(\n (f) => FEATURE_DEPENDENCIES[f].peerVersioned as readonly string[],\n );\n const featurePeerExternal = features.reduce<\n Record<string, { peer: string; dev: string }>\n >((acc, f) => ({ ...acc, ...FEATURE_DEPENDENCIES[f].peerExternal }), {});\n\n const managedPeerVersioned = [\n ...VERSIONED_PEER_DEPENDENCIES,\n ...featurePeerVersioned,\n ];\n const managedPeerNames = [\n ...managedPeerVersioned,\n ...keys(PEER_EXTERNAL_DEPENDENCIES),\n ...keys(featurePeerExternal),\n ];\n const managedDevVersioned = [\n ...VERSIONED_DEV_DEPENDENCIES,\n ...managedPeerVersioned,\n ];\n const managedDevNames = [\n ...managedDevVersioned,\n ...keys(externalDevDependencies),\n ...keys(featurePeerExternal),\n ];\n\n const peerExternals = {\n ...mapValues(PEER_EXTERNAL_DEPENDENCIES, (v) => v.peer),\n ...mapValues(featurePeerExternal, (v) => v.peer),\n };\n const peerDevPins = {\n ...mapValues(PEER_EXTERNAL_DEPENDENCIES, (v) => v.dev),\n ...mapValues(featurePeerExternal, (v) => v.dev),\n };\n\n const existingDepSources = [\n packageJson.dependencies,\n packageJson.devDependencies,\n packageJson.peerDependencies,\n ];\n\n const peerDependencies = pipe(\n packageJson.peerDependencies ?? {},\n omit(managedDevNames),\n merge(\n preserveProtected(\n {\n ...fromKeys(managedPeerVersioned, () => fullyQualifiedVersion),\n ...peerExternals,\n },\n existingDepSources,\n ),\n ),\n mapValues((value, key) =>\n isProtectedVersionSpec(value)\n ? value\n : workspacePackageNames.includes(key)\n ? fullyQualifiedVersion\n : value,\n ),\n sortByKey,\n );\n\n const devDependencies = pipe(\n merge(packageJson.dependencies ?? {}, packageJson.devDependencies ?? {}),\n omit(managedPeerNames),\n merge(\n preserveProtected(\n {\n ...fromKeys(managedDevVersioned, () => fullyQualifiedVersion),\n ...externalDevDependencies,\n ...peerDevPins,\n },\n existingDepSources,\n ),\n ),\n mapValues((value, key) =>\n isProtectedVersionSpec(value)\n ? value\n : workspacePackageNames.includes(key)\n ? fullyQualifiedVersion\n : value,\n ),\n sortByKey,\n );\n\n console.log(\"Updating package.json...\");\n const updatedPackageJson: PackageJson = {\n ...packageJson,\n type: packageJson.type ?? \"module\",\n sideEffects: packageJson.sideEffects ?? false,\n files: packageJson.files ?? [\"/dist\"],\n exports,\n scripts,\n peerDependencies,\n devDependencies,\n } as PackageJson;\n // Runtime `dependencies` block is no longer emitted — the bundled dist\n // self-contains everything except the declared peers.\n delete (updatedPackageJson as { dependencies?: unknown }).dependencies;\n await writePackage(projectDir, updatedPackageJson);\n\n console.log(\"Overwriting project root files...\");\n await writeAllGeneratedProjectFiles(projectDir);\n console.log(\"Moving unversioned document models...\");\n moveLegacyDocumentModels(projectDir);\n const project = buildTsMorphProject(projectDir);\n console.log(\"Fixing legacy import paths...\");\n fixLegacyImportPaths(project, packageJson.name);\n console.log(\"Installing dependencies...\");\n await installProjectDependencies(projectDir);\n console.log(\"Re-generating code...\");\n await generateAll(project);\n await project.save();\n}\n\nasync function installProjectDependencies(projectDir: string) {\n const agent = await getPackageManagerAtPowerhouseProjectDirPath(projectDir);\n if (!agent) {\n throw new Error(\n \"Failed to detect your package manager. Run install manually.\",\n );\n }\n const installCommand = await getPowerhouseProjectInstallCommand(agent);\n console.log(`Installing dependencies with \\`${agent}\\``);\n runCmd(installCommand, { cwd: projectDir });\n}\n\nfunction moveLegacyDocumentModels(projectDir: string) {\n const fileNamesToDelete = [\n \"actions.ts\",\n \"hooks.ts\",\n \"module.ts\",\n \"index.ts\",\n \"utils.ts\",\n \"schema.graphql\",\n ];\n const dirNamesToCopy = [\"src\", \"gen\"];\n const dirs = pipe(\n readdirSync(join(projectDir, \"document-models\"), { withFileTypes: true }),\n filter((entry) => entry.isDirectory()),\n filter(\n (dir) =>\n statSync(join(dir.parentPath, dir.name, `${dir.name}.json`), {\n throwIfNoEntry: false,\n })?.isFile() ?? false,\n ),\n map((dir) => join(dir.parentPath, dir.name)),\n );\n\n for (const dirPath of dirs) {\n for (const name of fileNamesToDelete) {\n const filePath = join(dirPath, name);\n rmSync(filePath, { force: true });\n }\n const versionDirPath = join(dirPath, \"v1\");\n const versionDirExists =\n statSync(versionDirPath, { throwIfNoEntry: false })?.isDirectory() ??\n false;\n if (!versionDirExists) {\n mkdirSync(versionDirPath);\n }\n for (const dirName of dirNamesToCopy) {\n const srcDirPath = join(dirPath, dirName);\n const srcDirExists =\n statSync(srcDirPath, { throwIfNoEntry: false })?.isDirectory() ?? false;\n if (!srcDirExists) continue;\n const destDirPath = join(versionDirPath, dirName);\n cpSync(srcDirPath, destDirPath, {\n recursive: true,\n force: false,\n errorOnExist: false,\n });\n rmSync(srcDirPath, {\n force: true,\n recursive: true,\n });\n }\n }\n}\n","import path from \"node:path\";\nimport { runCmd } from \"@powerhousedao/shared/clis\";\n/**\n * Clones a git repository and returns the path to the cloned project.\n * @param repositoryUrl - The URL of the git repository to clone\n * @returns The absolute path to the cloned project directory\n */\nexport function cloneRepository(repositoryUrl: string): string {\n try {\n console.log(\n \"\\x1b[33m\",\n `Cloning repository from ${repositoryUrl}...`,\n \"\\x1b[0m\",\n );\n runCmd(`git clone ${repositoryUrl}`);\n\n // Extract project name from repository URL\n // e.g., https://github.com/org/repo.git -> repo\n const repoName = repositoryUrl\n .split(\"/\")\n .pop()\n ?.replace(/\\.git$/, \"\");\n\n if (!repoName) {\n throw new Error(\"Could not determine project name from repository URL\");\n }\n\n const projectPath = path.join(process.cwd(), repoName);\n return projectPath;\n } catch (error) {\n console.log(error);\n throw error;\n }\n}\n\n/**\n * Installs dependencies in a project directory using the specified package manager.\n * @param projectPath - The absolute path to the project directory\n * @param packageManager - The package manager to use (npm, pnpm, yarn, bun)\n */\nexport function installDependencies(\n projectPath: string,\n packageManager: string,\n): void {\n try {\n process.chdir(projectPath);\n\n console.log(\n \"\\x1b[34m\",\n `Installing dependencies with ${packageManager}...`,\n \"\\x1b[0m\",\n );\n const extra =\n packageManager === \"pnpm\" ? \" --config.minimum-release-age=0\" : \"\";\n runCmd(`${packageManager} install --loglevel error${extra}`);\n\n console.log(\"\\x1b[32m\", \"Dependencies installed successfully!\", \"\\x1b[0m\");\n console.log();\n } catch (error) {\n console.log(error);\n throw error;\n }\n}\n","import { runCmd, writeFileEnsuringDir } from \"@powerhousedao/shared/clis\";\nimport chalk from \"chalk\";\nimport fs from \"node:fs\";\nimport path from \"path\";\nimport { gitIgnoreTemplate } from \"templates\";\nimport { runPrettier } from \"utils\";\nimport {\n writeAllGeneratedProjectFiles,\n writeProjectRootFiles,\n} from \"file-builders\";\ntype CreateProjectArgs = {\n name: string;\n packageManager: string;\n tag?: string;\n version?: string;\n remoteDrive?: string;\n skipGitInit?: boolean;\n skipInstall?: boolean;\n};\nexport async function createProject({\n name,\n packageManager,\n tag,\n version,\n remoteDrive,\n skipGitInit,\n skipInstall,\n}: CreateProjectArgs) {\n const appPath = path.join(process.cwd(), name);\n\n try {\n fs.mkdirSync(appPath);\n } catch (err) {\n if ((err as { code: string }).code === \"EEXIST\") {\n console.error(\n `⛔ The folder \"${name}\" already exists in the current directory, please give it another name.`,\n );\n } else {\n console.error(err);\n }\n process.exit(1);\n }\n\n try {\n // Create a new directory for the project\n console.log(chalk.blue(`▶️ Creating directory for project \"${name}\"...\\n`));\n const appPath = path.join(process.cwd(), name);\n process.chdir(appPath);\n console.log(chalk.green(`✅ Project directory created\\n`));\n\n await writeFileEnsuringDir(\".gitignore\", gitIgnoreTemplate);\n if (!skipGitInit) {\n // Create a .gitignore file, then initialize the git repository\n console.log(chalk.blue(`▶️ Initializing git repository...\\n`));\n runCmd(`git init`);\n console.log(chalk.green(`\\n✅ Git repository initialized\\n`));\n }\n\n // Write the boilerplate files for the project\n console.log(chalk.blue(`▶️ Creating project boilerplate files...\\n`));\n await writeProjectRootFiles({\n name,\n tag,\n version,\n remoteDrive,\n packageManager,\n });\n await writeAllGeneratedProjectFiles();\n console.log(chalk.green(`✅ Project boilerplate files created\\n`));\n\n if (!skipInstall) {\n // Install the project dependencies with the specified package manager\n console.log(\n chalk.blue(\n `▶️ Installing project dependencies with ${packageManager}...\\n`,\n ),\n );\n const extra =\n packageManager === \"pnpm\" ? \" --config.minimum-release-age=0\" : \"\";\n runCmd(`${packageManager} install${extra}`);\n console.log(chalk.green(`\\n✅ Project dependencies installed\\n`));\n }\n\n // Use the installed version of `prettier` to format the generated code\n console.log(chalk.blue(`▶️ Formatting boilerplate project files...\\n`));\n await runPrettier();\n console.log(chalk.green(`✅ Boilerplate files formatted\\n`));\n\n // Project creation complete\n console.log(chalk.bold(`🎉 Successfully created project \"${name}\" 🎉\\n`));\n } catch (error) {\n console.error(error);\n process.exit(1);\n }\n}\n","import type { DeclarationManager } from \"../utilities/DeclarationManager.js\";\nimport type { DirectoryManager } from \"../utilities/DirectoryManager.js\";\nimport type { ImportManager } from \"../utilities/ImportManager.js\";\nimport type { GenerationContext } from \"./GenerationContext.js\";\n\nexport abstract class FileGenerator {\n constructor(\n protected importManager: ImportManager,\n protected directoryManager: DirectoryManager,\n protected declarationManager: DeclarationManager,\n ) {}\n\n abstract generate(context: GenerationContext): Promise<void>;\n}\n","import { camelCase, kebabCase, pascalCase } from \"change-case\";\nimport type { OperationErrorSpecification } from \"@powerhousedao/shared/document-model\";\nimport type {\n MethodDeclaration,\n ObjectLiteralExpression,\n SourceFile,\n} from \"ts-morph\";\nimport { SyntaxKind, VariableDeclarationKind } from \"ts-morph\";\nimport { FileGenerator } from \"./FileGenerator.js\";\nimport type {\n CodegenOperation,\n GenerationContext,\n} from \"./GenerationContext.js\";\n\nexport class ReducerGenerator extends FileGenerator {\n async generate(context: GenerationContext): Promise<void> {\n // Skip if no actions to generate\n if (context.operations.length === 0) return;\n\n const filePath = this.getOutputPath(context);\n const sourceFile = await this.directoryManager.createSourceFile(\n context.project,\n filePath,\n );\n\n const packageName = context.packageName;\n // Reducer-specific import logic\n const typeImportName = `${pascalCase(context.docModel.name)}${pascalCase(context.module.name)}Operations`;\n const typeImportPath = `${packageName}/document-models/${kebabCase(context.docModel.name)}`;\n\n // Import management (shared utility)\n this.importManager.replaceImportByName(\n sourceFile,\n typeImportName,\n typeImportPath,\n true,\n );\n\n // AST logic (specific to reducers)\n this.createReducerObject(sourceFile, typeImportName, context);\n\n // Detect and import error classes used in the actual reducer code (after generation)\n this.addErrorImports(sourceFile, context);\n\n await sourceFile.save();\n }\n\n private static getDefaultReducerCode(methodName: string): string[] {\n return [\n `// TODO: Implement \"${methodName}\" reducer`,\n `throw new Error('Reducer \"${methodName}\" not yet implemented');`,\n ];\n }\n\n private addErrorImports(\n sourceFile: SourceFile,\n context: GenerationContext,\n ): void {\n // Collect all errors from all operations\n const allErrors: OperationErrorSpecification[] = [];\n\n context.operations.forEach((operation) => {\n if (Array.isArray(operation.errors)) {\n operation.errors\n .filter((error) => error.name)\n .forEach((error) => {\n // Deduplicate errors by name\n if (!allErrors.find((e) => e.name === error.name)) {\n allErrors.push(error);\n }\n });\n }\n });\n\n if (allErrors.length === 0) return;\n\n // Analyze the actual source file content to find which errors are used\n const sourceFileContent = sourceFile.getFullText();\n const usedErrors = new Set<string>();\n\n allErrors.forEach((error) => {\n // Check if error class name is mentioned anywhere in the source file\n // Look for patterns like \"new ErrorName\" or \"throw ErrorName\" or \"ErrorName(\"\n const errorPattern = new RegExp(`\\\\b${error.name}\\\\b`, \"g\");\n if (errorPattern.test(sourceFileContent)) {\n usedErrors.add(error.name!);\n }\n });\n\n // Add imports for used errors (only if they're not already imported)\n if (usedErrors.size > 0) {\n const errorImportPath = `../../gen/${kebabCase(context.module.name)}/error.js`;\n const errorClassNames = Array.from(usedErrors);\n\n // Check if imports already exist to avoid duplicates\n const existingImports = sourceFile.getImportDeclarations();\n const existingErrorImport = existingImports.find(\n (importDecl) =>\n importDecl.getModuleSpecifierValue() === errorImportPath,\n );\n\n if (existingErrorImport) {\n // Get already imported error names\n const existingNamedImports = existingErrorImport\n .getNamedImports()\n .map((namedImport) => namedImport.getName());\n\n // Only import errors that aren't already imported\n const newErrorsToImport = errorClassNames.filter(\n (errorName) => !existingNamedImports.includes(errorName),\n );\n\n if (newErrorsToImport.length > 0) {\n // Add new named imports to existing import declaration\n existingErrorImport.addNamedImports(newErrorsToImport);\n }\n } else {\n // Create new import declaration\n this.importManager.addNamedImports(\n sourceFile,\n errorClassNames,\n errorImportPath,\n );\n }\n }\n }\n\n private getOutputPath(context: GenerationContext): string {\n return this.directoryManager.getReducerPath(\n context.rootDir,\n context.docModel.name,\n context.module.name,\n );\n }\n\n private createReducerObject(\n sourceFile: SourceFile,\n typeName: string,\n context: GenerationContext,\n ): void {\n const { operations, forceUpdate } = context;\n const operationHandlersObjectName = `${camelCase(context.docModel.name)}${pascalCase(context.module.name)}Operations`;\n const legacyReducerVar = sourceFile.getVariableDeclaration(\"reducer\");\n if (legacyReducerVar) {\n this.declarationManager.renameVariable(\n sourceFile,\n \"reducer\",\n operationHandlersObjectName,\n );\n }\n let reducerVar = sourceFile.getVariableDeclaration(\n operationHandlersObjectName,\n );\n if (!reducerVar) {\n sourceFile.addVariableStatement({\n declarationKind: VariableDeclarationKind.Const,\n isExported: true,\n declarations: [\n {\n name: operationHandlersObjectName,\n type: typeName,\n initializer: \"{}\",\n },\n ],\n });\n reducerVar = sourceFile.getVariableDeclarationOrThrow(\n operationHandlersObjectName,\n );\n } else {\n // Ensure correct type\n const typeNode = reducerVar.getTypeNode();\n if (!typeNode || typeNode.getText() !== typeName) {\n reducerVar.setType(typeName);\n }\n }\n\n const initializer = reducerVar.getInitializerIfKindOrThrow(\n SyntaxKind.ObjectLiteralExpression,\n );\n\n for (const operation of operations) {\n this.addReducerMethod(initializer, operation, forceUpdate);\n }\n }\n\n private addReducerMethod(\n objectLiteral: ObjectLiteralExpression,\n operation: CodegenOperation,\n forceUpdate = false,\n ): void {\n const actionName = camelCase(operation.name ?? \"\");\n if (!actionName) return;\n\n const methodName = `${actionName}Operation`;\n\n const reducerCode = operation.reducer?.trim();\n\n const existingReducer = objectLiteral\n .getProperty(methodName)\n ?.asKind(SyntaxKind.MethodDeclaration);\n\n // if reducer already exists but forceUpdate is true, update it\n if (existingReducer) {\n if (forceUpdate && reducerCode) {\n existingReducer.setBodyText(\"\");\n this.setReducerMethodCode(existingReducer, reducerCode);\n }\n return;\n }\n\n // if reducer doesn't exist, create it and set the code with the default code if no code is provided\n const method = objectLiteral.addMethod({\n name: methodName,\n parameters: [{ name: \"state\" }, { name: \"action\" }],\n });\n this.setReducerMethodCode(method, reducerCode);\n }\n\n private setReducerMethodCode(reducer: MethodDeclaration, code?: string) {\n reducer.addStatements(\n code ? [code] : ReducerGenerator.getDefaultReducerCode(reducer.getName()),\n );\n }\n}\n","import type { SourceFile } from \"ts-morph\";\n\nexport class DeclarationManager {\n renameVariable(\n sourceFile: SourceFile,\n oldName: string,\n newName: string,\n ): void {\n const variable = sourceFile.getVariableDeclaration(oldName);\n\n if (variable) {\n variable.getNameNode().replaceWithText(newName);\n sourceFile.saveSync();\n }\n }\n}\n","import type { PHProjectDirectories } from \"@powerhousedao/codegen\";\nimport { kebabCase, pascalCase } from \"change-case\";\nimport fs from \"fs/promises\";\nimport path from \"path\";\nimport type { Project, SourceFile } from \"ts-morph\";\n\nexport class DirectoryManager {\n private directories: Required<PHProjectDirectories> = {\n documentModelDir: \"document-model\",\n editorsDir: \"editors\",\n processorsDir: \"processors\",\n subgraphsDir: \"subgraphs\",\n };\n\n constructor(directories: PHProjectDirectories = {}) {\n this.directories = {\n ...this.directories,\n ...directories,\n };\n }\n async ensureExists(dirPath: string): Promise<void> {\n try {\n await fs.mkdir(dirPath, { recursive: true });\n } catch (err) {\n console.error(`Failed to create directory: ${dirPath}`, err);\n throw err;\n }\n }\n\n // Path builders for different file types\n getReducerPath(\n rootDir: string,\n docModelName: string,\n moduleName: string,\n ): string {\n return path.join(\n rootDir,\n this.directories.documentModelDir,\n kebabCase(docModelName),\n \"src\",\n \"reducers\",\n `${kebabCase(moduleName)}.ts`,\n );\n }\n\n getActionsPath(\n rootDir: string,\n docModelName: string,\n moduleName: string,\n ): string {\n return path.join(\n rootDir,\n this.directories.documentModelDir,\n kebabCase(docModelName),\n \"src\",\n \"actions\",\n `${kebabCase(moduleName)}.ts`,\n );\n }\n\n getComponentPath(\n rootDir: string,\n docModelName: string,\n componentName: string,\n ): string {\n return path.join(\n rootDir,\n this.directories.documentModelDir,\n kebabCase(docModelName),\n \"src\",\n \"components\",\n `${pascalCase(componentName)}.tsx`,\n );\n }\n\n getTypesPath(rootDir: string, docModelName: string): string {\n return path.join(\n rootDir,\n this.directories.documentModelDir,\n kebabCase(docModelName),\n \"src\",\n \"types.ts\",\n );\n }\n\n async createSourceFile(\n project: Project,\n filePath: string,\n ): Promise<SourceFile> {\n await this.ensureExists(path.dirname(filePath));\n return (\n project.addSourceFileAtPathIfExists(filePath) ??\n project.createSourceFile(filePath, \"\", { overwrite: false })\n );\n }\n}\n","import type { ImportDeclaration, SourceFile } from \"ts-morph\";\n\nexport interface ImportSpec {\n moduleSpecifier: string;\n namedImports?: string[];\n defaultImport?: string;\n isTypeOnly?: boolean;\n}\n\nexport class ImportManager {\n addImport(sourceFile: SourceFile, spec: ImportSpec): void {\n // Check if import already exists\n const existing = sourceFile.getImportDeclaration(\n (imp) => imp.getFullText() === spec.moduleSpecifier,\n );\n if (existing) {\n this.mergeImports(existing, spec);\n } else {\n sourceFile.addImportDeclaration(spec);\n }\n }\n\n addTypeImport(sourceFile: SourceFile, typeName: string, path: string): void {\n this.addImport(sourceFile, {\n moduleSpecifier: path,\n namedImports: [typeName],\n isTypeOnly: true,\n });\n }\n\n addNamedImports(\n sourceFile: SourceFile,\n imports: string[],\n path: string,\n ): void {\n this.addImport(sourceFile, {\n moduleSpecifier: path,\n namedImports: imports,\n });\n }\n\n private mergeImports(\n existingImport: ImportDeclaration,\n newSpec: ImportSpec,\n ): void {\n // Logic to merge named imports if they don't already exist\n if (newSpec.namedImports) {\n const existingNames = existingImport\n .getNamedImports()\n .map((ni) => ni.getName());\n const newNames = newSpec.namedImports.filter(\n (name) => !existingNames.includes(name),\n );\n\n if (newNames.length > 0) {\n existingImport.addNamedImports(newNames);\n }\n }\n }\n\n replaceImportByName(\n sourceFile: SourceFile,\n name: string,\n path: string,\n isTypeOnly = false,\n ): void {\n const existing = sourceFile\n .getImportDeclarations()\n .filter((imp) =>\n imp.getNamedImports().find((ni) => ni.getName() === name),\n );\n existing.forEach((imp) => imp.remove());\n sourceFile.addImportDeclaration({\n moduleSpecifier: path,\n namedImports: [name],\n isTypeOnly,\n });\n sourceFile.saveSync();\n }\n}\n","import type {\n DocumentModelGlobalState,\n ModuleSpecification,\n} from \"@powerhousedao/shared/document-model\";\nimport fs from \"fs/promises\";\nimport { Project } from \"ts-morph\";\nimport { DeclarationManager } from \"../utilities/DeclarationManager.js\";\nimport { DirectoryManager } from \"../utilities/DirectoryManager.js\";\nimport { ImportManager } from \"../utilities/ImportManager.js\";\nimport type { FileGenerator } from \"./FileGenerator.js\";\nimport type {\n CodeGeneratorOptions,\n CodegenOperation,\n GenerationContext,\n PHProjectDirectories,\n} from \"./GenerationContext.js\";\nimport { ReducerGenerator } from \"./ReducerGenerator.js\";\n\nexport class TSMorphCodeGenerator {\n private project = new Project();\n private generators = new Map<string, FileGenerator>();\n private directories: PHProjectDirectories = {\n documentModelDir: \"document-model\",\n editorsDir: \"editors\",\n processorsDir: \"processors\",\n subgraphsDir: \"subgraphs\",\n };\n private forceUpdate = false;\n\n constructor(\n private rootDir: string,\n private docModels: DocumentModelGlobalState[],\n private packageName: string,\n options: CodeGeneratorOptions = { directories: {}, forceUpdate: false },\n ) {\n this.directories = {\n ...this.directories,\n ...options.directories,\n };\n this.packageName = packageName;\n this.forceUpdate = options.forceUpdate ?? false;\n\n this.setupGenerators();\n }\n\n private setupGenerators(): void {\n const importManager = new ImportManager();\n const directoryManager = new DirectoryManager(this.directories);\n const declarationManager = new DeclarationManager();\n // Register all generators\n this.generators.set(\n \"reducers\",\n new ReducerGenerator(importManager, directoryManager, declarationManager),\n );\n }\n\n // Generate specific file types\n async generateReducers(): Promise<void> {\n await this.generateFileType(\"reducers\");\n }\n\n // Generate everything\n async generateAll(): Promise<void> {\n for (const [type] of this.generators) {\n await this.generateFileType(type);\n }\n }\n\n private async generateFileType(type: string): Promise<void> {\n const generator = this.generators.get(type);\n if (!generator) {\n throw new Error(`No generator registered for type: ${type}`);\n }\n\n await this.setupProject();\n\n for (const docModel of this.docModels) {\n const latestSpec =\n docModel.specifications[docModel.specifications.length - 1];\n\n for (const module of latestSpec.modules) {\n const context = this.createGenerationContext(\n docModel,\n module,\n this.forceUpdate,\n );\n\n await generator.generate(context);\n }\n }\n }\n\n private async setupProject(): Promise<void> {\n // Only load files from configured directories\n const sourcePaths: string[] = [];\n\n if (this.directories.documentModelDir) {\n const dirPath = `${this.rootDir}/${this.directories.documentModelDir}`;\n await this.ensureDirectoryExists(dirPath);\n sourcePaths.push(`${dirPath}/**/*.ts`);\n }\n if (this.directories.editorsDir) {\n const dirPath = `${this.rootDir}/${this.directories.editorsDir}`;\n await this.ensureDirectoryExists(dirPath);\n sourcePaths.push(`${dirPath}/**/*.ts`);\n }\n if (this.directories.processorsDir) {\n const dirPath = `${this.rootDir}/${this.directories.processorsDir}`;\n await this.ensureDirectoryExists(dirPath);\n sourcePaths.push(`${dirPath}/**/*.ts`);\n }\n if (this.directories.subgraphsDir) {\n const dirPath = `${this.rootDir}/${this.directories.subgraphsDir}`;\n await this.ensureDirectoryExists(dirPath);\n sourcePaths.push(`${dirPath}/**/*.ts`);\n }\n\n // Exclude node_modules from all paths\n sourcePaths.push(`!${this.rootDir}/**/node_modules/**`);\n\n if (sourcePaths.length > 0) {\n this.project.addSourceFilesAtPaths(sourcePaths);\n }\n }\n\n private createGenerationContext(\n docModel: DocumentModelGlobalState,\n module: ModuleSpecification,\n forceUpdate = false,\n ): GenerationContext {\n const operations: CodegenOperation[] = module.operations.map((op) => ({\n ...op,\n hasInput: op.schema !== null,\n hasAttachment: op.schema?.includes(\": Attachment\"),\n scope: op.scope || \"global\",\n state: op.scope === \"global\" ? \"\" : op.scope,\n }));\n\n return {\n rootDir: this.rootDir,\n packageName: this.packageName,\n docModel,\n module,\n project: this.project,\n operations,\n forceUpdate,\n };\n }\n\n private async ensureDirectoryExists(dirPath: string): Promise<void> {\n try {\n await fs.mkdir(dirPath, { recursive: true });\n } catch (err) {\n console.error(`Failed to create directory: ${dirPath}`, err);\n throw err;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAQA,SAAgB,UAA6C,OAAa;AACxE,QAAO,OAAO,YACZ,OAAO,QAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,CAAC,CAC7D;;AAGH,eAAsB,kBACpB,MACmC;CACnC,IAAI;AACJ,KAAI;AACF,MAAI,CAAC,KACH,OAAM,IAAI,MAAM,oCAAoC;WAC3C,KAAK,SAAS,OAAO,IAAI,KAAK,SAAS,OAAO,CAEvD,kBADa,MAAM,iBAAiB,MAAM,qBAAqB,EAC1C,MAAM;WAClB,KAAK,SAAS,QAAQ,EAAE;GACjC,MAAM,OAAO,MAAM,SAAS,MAAM,QAAQ;GAC1C,MAAM,aAAa,KAAK,MAAM,KAAK;AACnC,OAAI,WAAW,WACb,iBAAgB,WAAW,MAAM;OAEjC,iBAAgB;QAGlB,OAAM,IAAI,MAAM,sDAAsD;AAExE,SAAO;UACA,OAAO;AACd,QAAO,MAA4B,SAAS,qCACxC,IAAI,MAAM,4BAA4B,GACtC;;;;;AC3BR,SAAS,sBAAsB,eAAgC;CAC7D,MAAM,UAAU,YAAY,eAAe,EAAE,eAAe,MAAM,CAAC;AACnE,MAAK,MAAM,SAAS,SAAS;AAC3B,MAAI,CAAC,MAAM,aAAa,CAAE;EAC1B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AI,KAAK,YAAY,eAAe;GAClC,MAAM,UAAU,GAAG,KAAK,QAAQ,GAAG,KAAK,YAAY;AACpD,SAAM,KAAK,sBAAsB,QAAQ;AACzC,eAAY,KAAK,GAAG,QAAQ,UAAU;;AAExC,MAAI,KAAK,YAAY,cAAc;GACjC,MAAM,UAAU,GAAG,KAAK,QAAQ,GAAG,KAAK,YAAY;AACpD,SAAM,KAAK,sBAAsB,QAAQ;AACzC,eAAY,KAAK,GAAG,QAAQ,UAAU;;AAIxC,cAAY,KAAK,IAAI,KAAK,QAAQ,qBAAqB;AAEvD,MAAI,YAAY,SAAS,EACvB,MAAK,QAAQ,sBAAsB,YAAY;;CAInD,wBACE,UACA,QACA,cAAc,OACK;EACnB,MAAM,aAAiC,OAAO,WAAW,KAAK,QAAQ;GACpE,GAAG;GACH,UAAU,GAAG,WAAW;GACxB,eAAe,GAAG,QAAQ,SAAS,eAAe;GAClD,OAAO,GAAG,SAAS;GACnB,OAAO,GAAG,UAAU,WAAW,KAAK,GAAG;GACxC,EAAE;AAEH,SAAO;GACL,SAAS,KAAK;GACd,aAAa,KAAK;GAClB;GACA;GACA,SAAS,KAAK;GACd;GACA;GACD;;CAGH,MAAc,sBAAsB,SAAgC;AAClE,MAAI;AACF,SAAMC,KAAG,MAAM,SAAS,EAAE,WAAW,MAAM,CAAC;WACrC,KAAK;AACZ,WAAQ,MAAM,+BAA+B,WAAW,IAAI;AAC5D,SAAM"}
1
+ {"version":3,"file":"index.mjs","names":["readdirSync","join","path","fs","fs"],"sources":["../src/codegen/utils.ts","../src/codegen/features.ts","../src/codegen/generate.ts","../src/codegen/get-version.ts","../src/codegen/kysely.ts","../src/codegen/migrate.ts","../src/create-lib/checkout-project.ts","../src/create-lib/create-project.ts","../src/ts-morph-generator/core/FileGenerator.ts","../src/ts-morph-generator/core/ReducerGenerator.ts","../src/ts-morph-generator/utilities/DeclarationManager.ts","../src/ts-morph-generator/utilities/DirectoryManager.ts","../src/ts-morph-generator/utilities/ImportManager.ts","../src/ts-morph-generator/core/TSMorphCodeGenerator.ts"],"sourcesContent":["import type {\n DocumentModelDocument,\n DocumentModelGlobalState,\n} from \"@powerhousedao/shared/document-model\";\nimport { documentModelReducer } from \"@powerhousedao/shared/document-model\";\nimport { baseLoadFromFile } from \"document-model/node\";\nimport { readFile } from \"node:fs/promises\";\n\nexport function sortByKey<T extends Record<string, unknown>>(value: T): T {\n return Object.fromEntries(\n Object.entries(value).sort(([a], [b]) => a.localeCompare(b)),\n ) as T;\n}\n\nexport async function loadDocumentModel(\n path: string,\n): Promise<DocumentModelGlobalState> {\n let documentModel: DocumentModelGlobalState;\n try {\n if (!path) {\n throw new Error(\"Document model file not specified\");\n } else if (path.endsWith(\".zip\") || path.endsWith(\".phd\")) {\n const file = await baseLoadFromFile(path, documentModelReducer);\n documentModel = file.state.global;\n } else if (path.endsWith(\".json\")) {\n const data = await readFile(path, \"utf-8\");\n const parsedData = JSON.parse(data) as DocumentModelDocument;\n if (\"state\" in parsedData) {\n documentModel = parsedData.state.global;\n } else {\n documentModel = parsedData;\n }\n } else {\n throw new Error(\"File type not supported. Must be zip, phd, or json.\");\n }\n return documentModel;\n } catch (error) {\n throw (error as { code?: string }).code === \"MODULE_NOT_FOUND\"\n ? new Error(`Document model not found.`)\n : error;\n }\n}\n","import {\n ANALYTICS_ENGINE_CORE_PACKAGE,\n FEATURE_DEPENDENCIES,\n} from \"@powerhousedao/shared/clis\";\nimport { readdirSync, readFileSync, statSync } from \"fs\";\nimport { join } from \"path\";\nimport { type PackageJson, readPackage } from \"read-pkg\";\nimport { writePackage } from \"write-package\";\nimport { sortByKey } from \"./utils.js\";\n\nexport type Feature = keyof typeof FEATURE_DEPENDENCIES;\n\nfunction hasAnalyticsProcessor(processorsDir: string): boolean {\n const entries = readdirSync(processorsDir, { withFileTypes: true });\n for (const entry of entries) {\n if (!entry.isDirectory()) continue;\n const dir = join(processorsDir, entry.name);\n // processor.ts is the current shape; index.ts is the pre-migrate fallback.\n for (const filename of [\"processor.ts\", \"index.ts\"]) {\n try {\n const contents = readFileSync(join(dir, filename), \"utf-8\");\n if (contents.includes(ANALYTICS_ENGINE_CORE_PACKAGE)) return true;\n } catch {\n // file missing — try next candidate\n }\n }\n }\n return false;\n}\n\nexport function detectFeatures(projectDir: string): Feature[] {\n const features: Feature[] = [];\n const processorsDir = join(projectDir, \"processors\");\n const processorsStat = statSync(processorsDir, { throwIfNoEntry: false });\n if (processorsStat?.isDirectory() && hasAnalyticsProcessor(processorsDir)) {\n features.push(\"analyticsProcessor\");\n }\n return features;\n}\n\n// Idempotently adds the peer + dev deps required by `features` to the\n// project's package.json. Reuses the existing `document-model` pin as the\n// version anchor for new workspace peers so generated entries stay in sync\n// with whatever migrate last wrote. No-op if the entries are already present.\nexport async function syncFeatureDependencies(\n features: readonly Feature[],\n projectDir: string,\n): Promise<void> {\n if (features.length === 0) return;\n\n const packageJson = await readPackage({ cwd: projectDir, normalize: false });\n\n const pinVersion =\n packageJson.peerDependencies?.[\"document-model\"] ??\n packageJson.devDependencies?.[\"document-model\"];\n if (!pinVersion) {\n throw new Error(\n \"Cannot sync feature dependencies: project is missing `document-model` in peer/devDependencies. Run `ph migrate` first.\",\n );\n }\n\n const peerDependencies = {\n ...(packageJson.peerDependencies ?? {}),\n } as Record<string, string>;\n const devDependencies = {\n ...(packageJson.devDependencies ?? {}),\n } as Record<string, string>;\n\n const added: string[] = [];\n for (const feature of features) {\n const spec = FEATURE_DEPENDENCIES[feature];\n for (const pkg of spec.peerVersioned) {\n if (peerDependencies[pkg] === undefined) {\n peerDependencies[pkg] = pinVersion;\n added.push(pkg);\n }\n if (devDependencies[pkg] === undefined) {\n devDependencies[pkg] = pinVersion;\n }\n }\n const peerExternal = spec.peerExternal as Record<\n string,\n { peer: string; dev: string }\n >;\n for (const [pkg, versionSpec] of Object.entries(peerExternal)) {\n if (peerDependencies[pkg] === undefined) {\n peerDependencies[pkg] = versionSpec.peer;\n added.push(pkg);\n }\n if (devDependencies[pkg] === undefined) {\n devDependencies[pkg] = versionSpec.dev;\n }\n }\n }\n\n if (added.length === 0) return;\n\n const updated = {\n ...packageJson,\n peerDependencies: sortByKey(peerDependencies),\n devDependencies: sortByKey(devDependencies),\n } as PackageJson;\n await writePackage(projectDir, updated);\n console.log(`Added peer/dev dependencies: ${added.join(\", \")}`);\n}\n","import { type DocumentModelGlobalState } from \"@powerhousedao/shared/document-model\";\nimport type { ProcessorApps } from \"@powerhousedao/shared/processors\";\nimport { kebabCase } from \"change-case\";\nimport {\n pruneManifestSection,\n tsMorphGenerateApp,\n tsMorphGenerateDocumentEditor,\n tsMorphGenerateDocumentModel,\n tsMorphGenerateProcessor,\n tsMorphGenerateSubgraph,\n} from \"file-builders\";\nimport { readdirSync } from \"node:fs\";\nimport {\n filter,\n isDefined,\n isIncludedIn,\n isTruthy,\n map,\n pipe,\n prop,\n unique,\n} from \"remeda\";\nimport type { Project } from \"ts-morph\";\nimport {\n getAppMetadata,\n getEditorMetadata,\n getOrCreateDirectory,\n getProcessorMetadata,\n getSubgraphMetadata,\n loadDocumentModelInDir,\n} from \"utils\";\nimport { loadDocumentModel } from \"./utils.js\";\n\nexport async function generateDocumentModel(\n documentModelState: DocumentModelGlobalState,\n project: Project,\n) {\n await tsMorphGenerateDocumentModel(documentModelState, project);\n}\n\n/* Runs generate for each document model json file found in the project's `document-models` directory */\nexport async function generateAllDocumentModels(project: Project) {\n const { directory: documentModelsDir } = getOrCreateDirectory(\n project,\n \"document-models\",\n );\n const documentModelsDirPath = documentModelsDir.getPath();\n const projectDir = documentModelsDir.getParentOrThrow().getPath();\n const documentModelStateFiles = pipe(\n readdirSync(documentModelsDirPath, { withFileTypes: true }),\n map(loadDocumentModelInDir),\n filter(isDefined),\n );\n\n for (const documentModelState of documentModelStateFiles) {\n await generateDocumentModel(documentModelState, project);\n }\n\n await pruneManifestSection(\n projectDir,\n \"documentModels\",\n documentModelStateFiles.map((s) => s.id),\n );\n}\nexport async function generateFromFile(filePath: string, project: Project) {\n // load document model spec from file\n const documentModelState = await loadDocumentModel(filePath);\n\n // delegate to shared generation function\n await generateDocumentModel(documentModelState, project);\n}\n\ntype GenerateEditorArgs = {\n editorName: string;\n documentTypes: string[];\n editorId?: string;\n editorDirName?: string;\n};\nexport async function generateEditor(\n args: GenerateEditorArgs,\n project: Project,\n) {\n const {\n editorName,\n documentTypes,\n editorId: editorIdArg,\n editorDirName,\n } = args;\n\n if (documentTypes.length > 1) {\n throw new Error(\"Multiple document types are not supported yet\");\n }\n\n const documentModelId = documentTypes[0];\n const editorId = editorIdArg || kebabCase(editorName);\n const editorDir = editorDirName || kebabCase(editorName);\n\n await tsMorphGenerateDocumentEditor({\n project,\n editorDir,\n documentModelId,\n editorName,\n editorId,\n });\n}\n\n/* Runs generate for all editors found in the project's `editors` directory.\n * Note: we intentionally filter out editors with the document type \"powerhouse/document-drive\".\n * These are handled separately by the `generateAllApps` function.\n */\nexport async function generateAllEditors(project: Project) {\n const { directory: editorsDir } = getOrCreateDirectory(project, \"editors\");\n const projectDir = editorsDir.getParentOrThrow().getPath();\n\n /* An editor's `id`, `name`, and `documentTypes` args can be found in the `module.ts` file */\n const editorsToAdd = pipe(\n editorsDir.getDirectories(),\n map((dir) => dir.getBaseName()),\n map((dirName) => getEditorMetadata(project, dirName)),\n filter(isTruthy),\n filter(\n ({ documentTypes }) =>\n !isIncludedIn(\"powerhouse/document-drive\", documentTypes),\n ),\n );\n\n for (const editorToAdd of editorsToAdd) {\n const {\n name: editorName,\n id: editorId,\n dirName: editorDirName,\n documentTypes,\n } = editorToAdd;\n\n await generateEditor(\n {\n editorName,\n editorId,\n editorDirName,\n documentTypes,\n },\n project,\n );\n }\n\n await pruneManifestSection(\n projectDir,\n \"editors\",\n editorsToAdd.map((e) => e.id),\n );\n}\n\ntype GenerateAppArgs = {\n appName: string;\n appId?: string;\n allowedDocumentTypes?: string[];\n isDragAndDropEnabled?: boolean;\n appDirName?: string;\n};\nexport async function generateApp(args: GenerateAppArgs, project: Project) {\n const {\n appName,\n appId,\n allowedDocumentTypes,\n isDragAndDropEnabled,\n appDirName,\n } = args;\n\n await tsMorphGenerateApp({\n project,\n editorDir: appDirName || kebabCase(appName),\n editorName: appName,\n editorId: appId ?? kebabCase(appName),\n allowedDocumentModelIds: allowedDocumentTypes ?? [],\n isDragAndDropEnabled: isDragAndDropEnabled ?? true,\n });\n}\n\n/* Runs generate for all apps found in the project's `editors` directory.\n * Note: we intentionally filter out editors which do not have the document type \"powerhouse/document-drive\".\n * These are handled separately by the `generateAllEditors` function.\n */\nexport async function generateAllApps(project: Project) {\n const { directory: editorsDir } = getOrCreateDirectory(project, \"editors\");\n const projectDir = editorsDir.getParentOrThrow().getPath();\n\n /* An editor's `id`, `name`, and `documentTypes` args can be found in the `module.ts` file */\n const appsToAdd = pipe(\n editorsDir.getDirectories(),\n map((dir) => dir.getBaseName()),\n map((dirName) => getAppMetadata(project, dirName)),\n filter(isTruthy),\n );\n\n for (const appToAdd of appsToAdd) {\n const {\n name: appName,\n id: appId,\n dirName: appDirName,\n allowedDocumentTypes,\n isDragAndDropEnabled,\n } = appToAdd;\n await generateApp(\n {\n appName,\n appDirName,\n appId,\n allowedDocumentTypes,\n isDragAndDropEnabled,\n },\n project,\n );\n }\n\n await pruneManifestSection(\n projectDir,\n \"apps\",\n appsToAdd.map((a) => a.id),\n );\n}\nexport async function generateSubgraph(subgraphName: string, project: Project) {\n await tsMorphGenerateSubgraph({ subgraphName, project });\n}\n\n/* Runs generate for each directory found in the project's `subgraphs` directory */\nexport async function generateAllSubgraphs(project: Project) {\n const { directory: subgraphsDir } = getOrCreateDirectory(\n project,\n \"subgraphs\",\n );\n const projectDir = subgraphsDir.getParentOrThrow().getPath();\n /* The subgraph's name is found in the `index.ts` file */\n const subgraphNames = pipe(\n subgraphsDir.getDirectories(),\n map((dir) => dir.getBaseName()),\n map((dirName) => getSubgraphMetadata(project, dirName)),\n map(prop(\"subgraphName\")),\n filter(isDefined),\n unique(),\n );\n for (const subgraphName of subgraphNames) {\n await generateSubgraph(subgraphName, project);\n }\n\n await pruneManifestSection(\n projectDir,\n \"subgraphs\",\n subgraphNames.map((name) => kebabCase(name)),\n );\n}\n\nexport async function generateProcessor(\n args: {\n processorName: string;\n processorType: \"analytics\" | \"relationalDb\";\n processorApps: ProcessorApps;\n documentTypes: string[];\n },\n project: Project,\n) {\n return await tsMorphGenerateProcessor({\n project,\n ...args,\n });\n}\n\n/* Runs generate for each directory found in the project's `processors` directory */\nexport async function generateAllProcessors(project: Project) {\n const { directory: processorsDir } = getOrCreateDirectory(\n project,\n \"processors\",\n );\n const projectDir = processorsDir.getParentOrThrow().getPath();\n const processorsToGenerate = pipe(\n processorsDir.getDirectories(),\n map((dir) => dir.getBaseName()),\n map((dirName) => getProcessorMetadata(project, dirName)),\n );\n\n for (const processorArgs of processorsToGenerate) {\n await generateProcessor(processorArgs, project);\n }\n\n await pruneManifestSection(\n projectDir,\n \"processors\",\n processorsToGenerate.map((p) => kebabCase(p.processorName)),\n );\n}\n\n/* Runs each module type's generateAll{moduleType} function for the current project */\nexport async function generateAll(project: Project) {\n await generateAllDocumentModels(project);\n await generateAllEditors(project);\n await generateAllApps(project);\n await generateAllSubgraphs(project);\n await generateAllProcessors(project);\n}\n","declare const CODEGEN_VERSION: string | undefined;\n\nexport function getCodegenVersion(): string {\n if (typeof CODEGEN_VERSION !== \"undefined\") return CODEGEN_VERSION;\n return (\n process.env.WORKSPACE_VERSION ||\n process.env.npm_package_version ||\n \"unknown\"\n );\n}\n","import { spawn } from \"node:child_process\";\nimport { existsSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { join, resolve } from \"node:path\";\n\nfunction getKyselyPgLiteBin(): string {\n const require = createRequire(import.meta.url);\n\n const paths = require.resolve.paths(\"kysely-pglite\");\n if (paths) {\n for (const basePath of paths) {\n const pkgRoot = join(basePath, \"kysely-pglite\");\n const binPath = join(pkgRoot, \"bin/run.js\");\n\n if (existsSync(binPath)) {\n return binPath;\n }\n }\n }\n\n throw new Error(\"Could not find kysely-pglite/bin/run.js\");\n}\n\nexport interface IOptions {\n migrationFile: string;\n schemaFile?: string;\n}\n\nfunction runCommand(\n command: string,\n args: string[],\n cwd?: string,\n): Promise<void> {\n return new Promise((resolve, reject) => {\n const child = spawn(command, args, {\n cwd,\n stdio: \"inherit\",\n shell: true,\n });\n\n child.on(\"close\", (code) => {\n if (code === 0) {\n resolve();\n } else {\n reject(new Error(`Command failed with exit code ${code}`));\n }\n });\n\n child.on(\"error\", (error) => {\n reject(error);\n });\n });\n}\n\nexport async function generateDBSchema({\n migrationFile,\n schemaFile,\n}: IOptions) {\n const outFile = schemaFile ?? resolve(migrationFile, \"../schema.ts\");\n\n try {\n const kyselyBinPath = getKyselyPgLiteBin();\n // Use kysely-pglite CLI to handle TypeScript compilation and module resolution\n await runCommand(\n \"node\",\n [kyselyBinPath, migrationFile, \"--outFile\", outFile],\n process.cwd(),\n );\n\n console.log(`Schema types generated at ${outFile}`);\n } catch (error) {\n console.error(\"Error running migration:\", error);\n }\n}\n","import {\n externalDevDependencies,\n FEATURE_DEPENDENCIES,\n getPackageManagerAtPowerhouseProjectDirPath,\n getPowerhouseProjectInstallCommand,\n packageJsonExports,\n packageScripts,\n PEER_EXTERNAL_DEPENDENCIES,\n runCmd,\n VERSIONED_DEV_DEPENDENCIES,\n VERSIONED_PEER_DEPENDENCIES,\n} from \"@powerhousedao/shared/clis\";\nimport console from \"console\";\nimport { writeAllGeneratedProjectFiles } from \"file-builders\";\nimport { cpSync, mkdirSync, readdirSync, rmSync, statSync } from \"fs\";\nimport npmFetch from \"npm-registry-fetch\";\nimport { join } from \"path\";\nimport { type PackageJson, readPackage } from \"read-pkg\";\nimport {\n filter,\n fromKeys,\n isTruthy,\n keys,\n map,\n mapValues,\n merge,\n omit,\n pipe,\n prop,\n} from \"remeda\";\nimport type { Project } from \"ts-morph\";\nimport { buildTsMorphProject } from \"utils\";\nimport { writePackage } from \"write-package\";\nimport { detectFeatures } from \"./features.js\";\nimport { generateAll } from \"./generate.js\";\nimport { sortByKey } from \"./utils.js\";\n\n/* Uses the npm cli's fetch function to get the version for a specified tag */\nexport async function getFullyQualifiedWorkspacePackageVersion(\n versionOrTag: string,\n) {\n const isTag =\n versionOrTag === \"latest\" ||\n versionOrTag === \"staging\" ||\n versionOrTag === \"dev\";\n\n if (!isTag) return versionOrTag;\n const result = (await npmFetch.json(\n `${WORKSPACE_PACKAGES[0].manifest.name!}`,\n )) as { \"dist-tags\": Record<\"latest\" | \"staging\" | \"dev\", string> };\n return result[\"dist-tags\"][versionOrTag];\n}\n\nexport function fixLegacyImportPaths(\n project: Project,\n packageName: string | undefined,\n) {\n if (!packageName) {\n console.error(\"No package name found in package.json.\");\n return;\n }\n const sourceFiles = project.getSourceFiles();\n for (const sourceFile of sourceFiles) {\n const importStatements = sourceFile.getImportDeclarations();\n for (const importStatement of importStatements) {\n const namedImports = map(\n importStatement.getNamedImports(),\n (importSpecifier) => importSpecifier.getText(),\n );\n const moduleSpecifier = importStatement.getModuleSpecifier();\n const moduleSpecifierText = moduleSpecifier.getLiteralText();\n // remove usage of the old `package-name/` style paths\n if (moduleSpecifierText.includes(packageName)) {\n moduleSpecifier.setLiteralValue(\n moduleSpecifierText.replace(`${packageName}/`, \"\"),\n );\n }\n // I saw this invalid import enough that it seemed worthwhile to fix it here\n if (namedImports.includes(\"generateMock\")) {\n moduleSpecifier.setLiteralValue(\"document-model\");\n }\n // attempt to fix absolute import paths for document models like `../../../document-models/model/something/something.js`\n // these don't work anymore with the versioned document models, since the absolute file paths are different\n const match = moduleSpecifierText.match(\n /^(\\.\\.\\/)+document-models\\/([^/]+)(?!\\/v\\d+(?:\\/|$))(?:\\/.*)?$/,\n );\n\n if (match) {\n moduleSpecifier.setLiteralValue(`document-models/${match[2]}`);\n }\n }\n }\n}\n\nfunction isProtectedVersionSpec(value: unknown): value is string {\n return (\n typeof value === \"string\" &&\n (value.startsWith(\"workspace:\") || value.startsWith(\"catalog:\"))\n );\n}\n\n// Keeps user-declared `workspace:*` / `catalog:` refs intact when the caller\n// would otherwise replace them with a hard pin during migration.\nfunction preserveProtected(\n newValues: Record<string, string>,\n existingSources: ReadonlyArray<\n Partial<Record<string, string | undefined>> | undefined\n >,\n): Record<string, string> {\n const result: Record<string, string> = { ...newValues };\n for (const key of Object.keys(newValues)) {\n for (const source of existingSources) {\n const existing = source?.[key];\n if (isProtectedVersionSpec(existing)) {\n result[key] = existing;\n break;\n }\n }\n }\n return result;\n}\n\nexport async function migrate(version: string, projectDir = process.cwd()) {\n const fullyQualifiedVersion =\n await getFullyQualifiedWorkspacePackageVersion(version);\n\n const packageJson = await readPackage({\n cwd: projectDir,\n normalize: false,\n });\n const exports = packageJsonExports;\n const scripts = merge(packageJson.scripts, packageScripts);\n const workspacePackageNames = filter(\n map(WORKSPACE_PACKAGES, prop(\"manifest\", \"name\")),\n isTruthy,\n );\n\n const features = detectFeatures(projectDir);\n const featurePeerVersioned = features.flatMap(\n (f) => FEATURE_DEPENDENCIES[f].peerVersioned as readonly string[],\n );\n const featurePeerExternal = features.reduce<\n Record<string, { peer: string; dev: string }>\n >((acc, f) => ({ ...acc, ...FEATURE_DEPENDENCIES[f].peerExternal }), {});\n\n const managedPeerVersioned = [\n ...VERSIONED_PEER_DEPENDENCIES,\n ...featurePeerVersioned,\n ];\n const managedPeerNames = [\n ...managedPeerVersioned,\n ...keys(PEER_EXTERNAL_DEPENDENCIES),\n ...keys(featurePeerExternal),\n ];\n const managedDevVersioned = [\n ...VERSIONED_DEV_DEPENDENCIES,\n ...managedPeerVersioned,\n ];\n const managedDevNames = [\n ...managedDevVersioned,\n ...keys(externalDevDependencies),\n ...keys(featurePeerExternal),\n ];\n\n const peerExternals = {\n ...mapValues(PEER_EXTERNAL_DEPENDENCIES, (v) => v.peer),\n ...mapValues(featurePeerExternal, (v) => v.peer),\n };\n const peerDevPins = {\n ...mapValues(PEER_EXTERNAL_DEPENDENCIES, (v) => v.dev),\n ...mapValues(featurePeerExternal, (v) => v.dev),\n };\n\n const existingDepSources = [\n packageJson.dependencies,\n packageJson.devDependencies,\n packageJson.peerDependencies,\n ];\n\n const peerDependencies = pipe(\n packageJson.peerDependencies ?? {},\n omit(managedDevNames),\n merge(\n preserveProtected(\n {\n ...fromKeys(managedPeerVersioned, () => fullyQualifiedVersion),\n ...peerExternals,\n },\n existingDepSources,\n ),\n ),\n mapValues((value, key) =>\n isProtectedVersionSpec(value)\n ? value\n : workspacePackageNames.includes(key)\n ? fullyQualifiedVersion\n : value,\n ),\n sortByKey,\n );\n\n const devDependencies = pipe(\n merge(packageJson.dependencies ?? {}, packageJson.devDependencies ?? {}),\n omit(managedPeerNames),\n merge(\n preserveProtected(\n {\n ...fromKeys(managedDevVersioned, () => fullyQualifiedVersion),\n ...externalDevDependencies,\n ...peerDevPins,\n },\n existingDepSources,\n ),\n ),\n mapValues((value, key) =>\n isProtectedVersionSpec(value)\n ? value\n : workspacePackageNames.includes(key)\n ? fullyQualifiedVersion\n : value,\n ),\n sortByKey,\n );\n\n console.log(\"Updating package.json...\");\n const updatedPackageJson: PackageJson = {\n ...packageJson,\n type: packageJson.type ?? \"module\",\n sideEffects: packageJson.sideEffects ?? false,\n files: packageJson.files ?? [\"/dist\"],\n exports,\n scripts,\n peerDependencies,\n devDependencies,\n } as PackageJson;\n // Runtime `dependencies` block is no longer emitted — the bundled dist\n // self-contains everything except the declared peers.\n delete (updatedPackageJson as { dependencies?: unknown }).dependencies;\n await writePackage(projectDir, updatedPackageJson);\n\n console.log(\"Overwriting project root files...\");\n await writeAllGeneratedProjectFiles(projectDir);\n console.log(\"Moving unversioned document models...\");\n moveLegacyDocumentModels(projectDir);\n const project = buildTsMorphProject(projectDir);\n console.log(\"Fixing legacy import paths...\");\n fixLegacyImportPaths(project, packageJson.name);\n console.log(\"Installing dependencies...\");\n await installProjectDependencies(projectDir);\n console.log(\"Re-generating code...\");\n await generateAll(project);\n await project.save();\n}\n\nasync function installProjectDependencies(projectDir: string) {\n const agent = await getPackageManagerAtPowerhouseProjectDirPath(projectDir);\n if (!agent) {\n throw new Error(\n \"Failed to detect your package manager. Run install manually.\",\n );\n }\n const installCommand = await getPowerhouseProjectInstallCommand(agent);\n console.log(`Installing dependencies with \\`${agent}\\``);\n runCmd(installCommand, { cwd: projectDir });\n}\n\nfunction moveLegacyDocumentModels(projectDir: string) {\n const fileNamesToDelete = [\n \"actions.ts\",\n \"hooks.ts\",\n \"module.ts\",\n \"index.ts\",\n \"utils.ts\",\n \"schema.graphql\",\n ];\n const dirNamesToCopy = [\"src\", \"gen\"];\n const dirs = pipe(\n readdirSync(join(projectDir, \"document-models\"), { withFileTypes: true }),\n filter((entry) => entry.isDirectory()),\n filter(\n (dir) =>\n statSync(join(dir.parentPath, dir.name, `${dir.name}.json`), {\n throwIfNoEntry: false,\n })?.isFile() ?? false,\n ),\n map((dir) => join(dir.parentPath, dir.name)),\n );\n\n for (const dirPath of dirs) {\n for (const name of fileNamesToDelete) {\n const filePath = join(dirPath, name);\n rmSync(filePath, { force: true });\n }\n const versionDirPath = join(dirPath, \"v1\");\n const versionDirExists =\n statSync(versionDirPath, { throwIfNoEntry: false })?.isDirectory() ??\n false;\n if (!versionDirExists) {\n mkdirSync(versionDirPath);\n }\n for (const dirName of dirNamesToCopy) {\n const srcDirPath = join(dirPath, dirName);\n const srcDirExists =\n statSync(srcDirPath, { throwIfNoEntry: false })?.isDirectory() ?? false;\n if (!srcDirExists) continue;\n const destDirPath = join(versionDirPath, dirName);\n cpSync(srcDirPath, destDirPath, {\n recursive: true,\n force: false,\n errorOnExist: false,\n });\n rmSync(srcDirPath, {\n force: true,\n recursive: true,\n });\n }\n }\n}\n","import path from \"node:path\";\nimport { runCmd } from \"@powerhousedao/shared/clis\";\n/**\n * Clones a git repository and returns the path to the cloned project.\n * @param repositoryUrl - The URL of the git repository to clone\n * @returns The absolute path to the cloned project directory\n */\nexport function cloneRepository(repositoryUrl: string): string {\n try {\n console.log(\n \"\\x1b[33m\",\n `Cloning repository from ${repositoryUrl}...`,\n \"\\x1b[0m\",\n );\n runCmd(`git clone ${repositoryUrl}`);\n\n // Extract project name from repository URL\n // e.g., https://github.com/org/repo.git -> repo\n const repoName = repositoryUrl\n .split(\"/\")\n .pop()\n ?.replace(/\\.git$/, \"\");\n\n if (!repoName) {\n throw new Error(\"Could not determine project name from repository URL\");\n }\n\n const projectPath = path.join(process.cwd(), repoName);\n return projectPath;\n } catch (error) {\n console.log(error);\n throw error;\n }\n}\n\n/**\n * Installs dependencies in a project directory using the specified package manager.\n * @param projectPath - The absolute path to the project directory\n * @param packageManager - The package manager to use (npm, pnpm, yarn, bun)\n */\nexport function installDependencies(\n projectPath: string,\n packageManager: string,\n): void {\n try {\n process.chdir(projectPath);\n\n console.log(\n \"\\x1b[34m\",\n `Installing dependencies with ${packageManager}...`,\n \"\\x1b[0m\",\n );\n const extra =\n packageManager === \"pnpm\" ? \" --config.minimum-release-age=0\" : \"\";\n runCmd(`${packageManager} install --loglevel error${extra}`);\n\n console.log(\"\\x1b[32m\", \"Dependencies installed successfully!\", \"\\x1b[0m\");\n console.log();\n } catch (error) {\n console.log(error);\n throw error;\n }\n}\n","import { runCmd, writeFileEnsuringDir } from \"@powerhousedao/shared/clis\";\nimport chalk from \"chalk\";\nimport fs from \"node:fs\";\nimport path from \"path\";\nimport { gitIgnoreTemplate } from \"templates\";\nimport { runPrettier } from \"utils\";\nimport {\n writeAllGeneratedProjectFiles,\n writeProjectRootFiles,\n} from \"file-builders\";\ntype CreateProjectArgs = {\n name: string;\n packageManager: string;\n tag?: string;\n version?: string;\n remoteDrive?: string;\n skipGitInit?: boolean;\n skipInstall?: boolean;\n};\nexport async function createProject({\n name,\n packageManager,\n tag,\n version,\n remoteDrive,\n skipGitInit,\n skipInstall,\n}: CreateProjectArgs) {\n const appPath = path.join(process.cwd(), name);\n\n try {\n fs.mkdirSync(appPath);\n } catch (err) {\n if ((err as { code: string }).code === \"EEXIST\") {\n console.error(\n `⛔ The folder \"${name}\" already exists in the current directory, please give it another name.`,\n );\n } else {\n console.error(err);\n }\n process.exit(1);\n }\n\n try {\n // Create a new directory for the project\n console.log(chalk.blue(`▶️ Creating directory for project \"${name}\"...\\n`));\n const appPath = path.join(process.cwd(), name);\n process.chdir(appPath);\n console.log(chalk.green(`✅ Project directory created\\n`));\n\n await writeFileEnsuringDir(\".gitignore\", gitIgnoreTemplate);\n if (!skipGitInit) {\n // Create a .gitignore file, then initialize the git repository\n console.log(chalk.blue(`▶️ Initializing git repository...\\n`));\n runCmd(`git init`);\n console.log(chalk.green(`\\n✅ Git repository initialized\\n`));\n }\n\n // Write the boilerplate files for the project\n console.log(chalk.blue(`▶️ Creating project boilerplate files...\\n`));\n await writeProjectRootFiles({\n name,\n tag,\n version,\n remoteDrive,\n packageManager,\n });\n await writeAllGeneratedProjectFiles();\n console.log(chalk.green(`✅ Project boilerplate files created\\n`));\n\n if (!skipInstall) {\n // Install the project dependencies with the specified package manager\n console.log(\n chalk.blue(\n `▶️ Installing project dependencies with ${packageManager}...\\n`,\n ),\n );\n const extra =\n packageManager === \"pnpm\" ? \" --config.minimum-release-age=0\" : \"\";\n runCmd(`${packageManager} install${extra}`);\n console.log(chalk.green(`\\n✅ Project dependencies installed\\n`));\n }\n\n // Use the installed version of `prettier` to format the generated code\n console.log(chalk.blue(`▶️ Formatting boilerplate project files...\\n`));\n await runPrettier();\n console.log(chalk.green(`✅ Boilerplate files formatted\\n`));\n\n // Project creation complete\n console.log(chalk.bold(`🎉 Successfully created project \"${name}\" 🎉\\n`));\n } catch (error) {\n console.error(error);\n process.exit(1);\n }\n}\n","import type { DeclarationManager } from \"../utilities/DeclarationManager.js\";\nimport type { DirectoryManager } from \"../utilities/DirectoryManager.js\";\nimport type { ImportManager } from \"../utilities/ImportManager.js\";\nimport type { GenerationContext } from \"./GenerationContext.js\";\n\nexport abstract class FileGenerator {\n constructor(\n protected importManager: ImportManager,\n protected directoryManager: DirectoryManager,\n protected declarationManager: DeclarationManager,\n ) {}\n\n abstract generate(context: GenerationContext): Promise<void>;\n}\n","import { camelCase, kebabCase, pascalCase } from \"change-case\";\nimport type { OperationErrorSpecification } from \"@powerhousedao/shared/document-model\";\nimport type {\n MethodDeclaration,\n ObjectLiteralExpression,\n SourceFile,\n} from \"ts-morph\";\nimport { SyntaxKind, VariableDeclarationKind } from \"ts-morph\";\nimport { FileGenerator } from \"./FileGenerator.js\";\nimport type {\n CodegenOperation,\n GenerationContext,\n} from \"./GenerationContext.js\";\n\nexport class ReducerGenerator extends FileGenerator {\n async generate(context: GenerationContext): Promise<void> {\n // Skip if no actions to generate\n if (context.operations.length === 0) return;\n\n const filePath = this.getOutputPath(context);\n const sourceFile = await this.directoryManager.createSourceFile(\n context.project,\n filePath,\n );\n\n const packageName = context.packageName;\n // Reducer-specific import logic\n const typeImportName = `${pascalCase(context.docModel.name)}${pascalCase(context.module.name)}Operations`;\n const typeImportPath = `${packageName}/document-models/${kebabCase(context.docModel.name)}`;\n\n // Import management (shared utility)\n this.importManager.replaceImportByName(\n sourceFile,\n typeImportName,\n typeImportPath,\n true,\n );\n\n // AST logic (specific to reducers)\n this.createReducerObject(sourceFile, typeImportName, context);\n\n // Detect and import error classes used in the actual reducer code (after generation)\n this.addErrorImports(sourceFile, context);\n\n await sourceFile.save();\n }\n\n private static getDefaultReducerCode(methodName: string): string[] {\n return [\n `// TODO: Implement \"${methodName}\" reducer`,\n `throw new Error('Reducer \"${methodName}\" not yet implemented');`,\n ];\n }\n\n private addErrorImports(\n sourceFile: SourceFile,\n context: GenerationContext,\n ): void {\n // Collect all errors from all operations\n const allErrors: OperationErrorSpecification[] = [];\n\n context.operations.forEach((operation) => {\n if (Array.isArray(operation.errors)) {\n operation.errors\n .filter((error) => error.name)\n .forEach((error) => {\n // Deduplicate errors by name\n if (!allErrors.find((e) => e.name === error.name)) {\n allErrors.push(error);\n }\n });\n }\n });\n\n if (allErrors.length === 0) return;\n\n // Analyze the actual source file content to find which errors are used\n const sourceFileContent = sourceFile.getFullText();\n const usedErrors = new Set<string>();\n\n allErrors.forEach((error) => {\n // Check if error class name is mentioned anywhere in the source file\n // Look for patterns like \"new ErrorName\" or \"throw ErrorName\" or \"ErrorName(\"\n const errorPattern = new RegExp(`\\\\b${error.name}\\\\b`, \"g\");\n if (errorPattern.test(sourceFileContent)) {\n usedErrors.add(error.name!);\n }\n });\n\n // Add imports for used errors (only if they're not already imported)\n if (usedErrors.size > 0) {\n const errorImportPath = `../../gen/${kebabCase(context.module.name)}/error.js`;\n const errorClassNames = Array.from(usedErrors);\n\n // Check if imports already exist to avoid duplicates\n const existingImports = sourceFile.getImportDeclarations();\n const existingErrorImport = existingImports.find(\n (importDecl) =>\n importDecl.getModuleSpecifierValue() === errorImportPath,\n );\n\n if (existingErrorImport) {\n // Get already imported error names\n const existingNamedImports = existingErrorImport\n .getNamedImports()\n .map((namedImport) => namedImport.getName());\n\n // Only import errors that aren't already imported\n const newErrorsToImport = errorClassNames.filter(\n (errorName) => !existingNamedImports.includes(errorName),\n );\n\n if (newErrorsToImport.length > 0) {\n // Add new named imports to existing import declaration\n existingErrorImport.addNamedImports(newErrorsToImport);\n }\n } else {\n // Create new import declaration\n this.importManager.addNamedImports(\n sourceFile,\n errorClassNames,\n errorImportPath,\n );\n }\n }\n }\n\n private getOutputPath(context: GenerationContext): string {\n return this.directoryManager.getReducerPath(\n context.rootDir,\n context.docModel.name,\n context.module.name,\n );\n }\n\n private createReducerObject(\n sourceFile: SourceFile,\n typeName: string,\n context: GenerationContext,\n ): void {\n const { operations, forceUpdate } = context;\n const operationHandlersObjectName = `${camelCase(context.docModel.name)}${pascalCase(context.module.name)}Operations`;\n const legacyReducerVar = sourceFile.getVariableDeclaration(\"reducer\");\n if (legacyReducerVar) {\n this.declarationManager.renameVariable(\n sourceFile,\n \"reducer\",\n operationHandlersObjectName,\n );\n }\n let reducerVar = sourceFile.getVariableDeclaration(\n operationHandlersObjectName,\n );\n if (!reducerVar) {\n sourceFile.addVariableStatement({\n declarationKind: VariableDeclarationKind.Const,\n isExported: true,\n declarations: [\n {\n name: operationHandlersObjectName,\n type: typeName,\n initializer: \"{}\",\n },\n ],\n });\n reducerVar = sourceFile.getVariableDeclarationOrThrow(\n operationHandlersObjectName,\n );\n } else {\n // Ensure correct type\n const typeNode = reducerVar.getTypeNode();\n if (!typeNode || typeNode.getText() !== typeName) {\n reducerVar.setType(typeName);\n }\n }\n\n const initializer = reducerVar.getInitializerIfKindOrThrow(\n SyntaxKind.ObjectLiteralExpression,\n );\n\n for (const operation of operations) {\n this.addReducerMethod(initializer, operation, forceUpdate);\n }\n }\n\n private addReducerMethod(\n objectLiteral: ObjectLiteralExpression,\n operation: CodegenOperation,\n forceUpdate = false,\n ): void {\n const actionName = camelCase(operation.name ?? \"\");\n if (!actionName) return;\n\n const methodName = `${actionName}Operation`;\n\n const reducerCode = operation.reducer?.trim();\n\n const existingReducer = objectLiteral\n .getProperty(methodName)\n ?.asKind(SyntaxKind.MethodDeclaration);\n\n // if reducer already exists but forceUpdate is true, update it\n if (existingReducer) {\n if (forceUpdate && reducerCode) {\n existingReducer.setBodyText(\"\");\n this.setReducerMethodCode(existingReducer, reducerCode);\n }\n return;\n }\n\n // if reducer doesn't exist, create it and set the code with the default code if no code is provided\n const method = objectLiteral.addMethod({\n name: methodName,\n parameters: [{ name: \"state\" }, { name: \"action\" }],\n });\n this.setReducerMethodCode(method, reducerCode);\n }\n\n private setReducerMethodCode(reducer: MethodDeclaration, code?: string) {\n reducer.addStatements(\n code ? [code] : ReducerGenerator.getDefaultReducerCode(reducer.getName()),\n );\n }\n}\n","import type { SourceFile } from \"ts-morph\";\n\nexport class DeclarationManager {\n renameVariable(\n sourceFile: SourceFile,\n oldName: string,\n newName: string,\n ): void {\n const variable = sourceFile.getVariableDeclaration(oldName);\n\n if (variable) {\n variable.getNameNode().replaceWithText(newName);\n sourceFile.saveSync();\n }\n }\n}\n","import type { PHProjectDirectories } from \"@powerhousedao/codegen\";\nimport { kebabCase, pascalCase } from \"change-case\";\nimport fs from \"fs/promises\";\nimport path from \"path\";\nimport type { Project, SourceFile } from \"ts-morph\";\n\nexport class DirectoryManager {\n private directories: Required<PHProjectDirectories> = {\n documentModelDir: \"document-model\",\n editorsDir: \"editors\",\n processorsDir: \"processors\",\n subgraphsDir: \"subgraphs\",\n };\n\n constructor(directories: PHProjectDirectories = {}) {\n this.directories = {\n ...this.directories,\n ...directories,\n };\n }\n async ensureExists(dirPath: string): Promise<void> {\n try {\n await fs.mkdir(dirPath, { recursive: true });\n } catch (err) {\n console.error(`Failed to create directory: ${dirPath}`, err);\n throw err;\n }\n }\n\n // Path builders for different file types\n getReducerPath(\n rootDir: string,\n docModelName: string,\n moduleName: string,\n ): string {\n return path.join(\n rootDir,\n this.directories.documentModelDir,\n kebabCase(docModelName),\n \"src\",\n \"reducers\",\n `${kebabCase(moduleName)}.ts`,\n );\n }\n\n getActionsPath(\n rootDir: string,\n docModelName: string,\n moduleName: string,\n ): string {\n return path.join(\n rootDir,\n this.directories.documentModelDir,\n kebabCase(docModelName),\n \"src\",\n \"actions\",\n `${kebabCase(moduleName)}.ts`,\n );\n }\n\n getComponentPath(\n rootDir: string,\n docModelName: string,\n componentName: string,\n ): string {\n return path.join(\n rootDir,\n this.directories.documentModelDir,\n kebabCase(docModelName),\n \"src\",\n \"components\",\n `${pascalCase(componentName)}.tsx`,\n );\n }\n\n getTypesPath(rootDir: string, docModelName: string): string {\n return path.join(\n rootDir,\n this.directories.documentModelDir,\n kebabCase(docModelName),\n \"src\",\n \"types.ts\",\n );\n }\n\n async createSourceFile(\n project: Project,\n filePath: string,\n ): Promise<SourceFile> {\n await this.ensureExists(path.dirname(filePath));\n return (\n project.addSourceFileAtPathIfExists(filePath) ??\n project.createSourceFile(filePath, \"\", { overwrite: false })\n );\n }\n}\n","import type { ImportDeclaration, SourceFile } from \"ts-morph\";\n\nexport interface ImportSpec {\n moduleSpecifier: string;\n namedImports?: string[];\n defaultImport?: string;\n isTypeOnly?: boolean;\n}\n\nexport class ImportManager {\n addImport(sourceFile: SourceFile, spec: ImportSpec): void {\n // Check if import already exists\n const existing = sourceFile.getImportDeclaration(\n (imp) => imp.getFullText() === spec.moduleSpecifier,\n );\n if (existing) {\n this.mergeImports(existing, spec);\n } else {\n sourceFile.addImportDeclaration(spec);\n }\n }\n\n addTypeImport(sourceFile: SourceFile, typeName: string, path: string): void {\n this.addImport(sourceFile, {\n moduleSpecifier: path,\n namedImports: [typeName],\n isTypeOnly: true,\n });\n }\n\n addNamedImports(\n sourceFile: SourceFile,\n imports: string[],\n path: string,\n ): void {\n this.addImport(sourceFile, {\n moduleSpecifier: path,\n namedImports: imports,\n });\n }\n\n private mergeImports(\n existingImport: ImportDeclaration,\n newSpec: ImportSpec,\n ): void {\n // Logic to merge named imports if they don't already exist\n if (newSpec.namedImports) {\n const existingNames = existingImport\n .getNamedImports()\n .map((ni) => ni.getName());\n const newNames = newSpec.namedImports.filter(\n (name) => !existingNames.includes(name),\n );\n\n if (newNames.length > 0) {\n existingImport.addNamedImports(newNames);\n }\n }\n }\n\n replaceImportByName(\n sourceFile: SourceFile,\n name: string,\n path: string,\n isTypeOnly = false,\n ): void {\n const existing = sourceFile\n .getImportDeclarations()\n .filter((imp) =>\n imp.getNamedImports().find((ni) => ni.getName() === name),\n );\n existing.forEach((imp) => imp.remove());\n sourceFile.addImportDeclaration({\n moduleSpecifier: path,\n namedImports: [name],\n isTypeOnly,\n });\n sourceFile.saveSync();\n }\n}\n","import type {\n DocumentModelGlobalState,\n ModuleSpecification,\n} from \"@powerhousedao/shared/document-model\";\nimport fs from \"fs/promises\";\nimport { Project } from \"ts-morph\";\nimport { DeclarationManager } from \"../utilities/DeclarationManager.js\";\nimport { DirectoryManager } from \"../utilities/DirectoryManager.js\";\nimport { ImportManager } from \"../utilities/ImportManager.js\";\nimport type { FileGenerator } from \"./FileGenerator.js\";\nimport type {\n CodeGeneratorOptions,\n CodegenOperation,\n GenerationContext,\n PHProjectDirectories,\n} from \"./GenerationContext.js\";\nimport { ReducerGenerator } from \"./ReducerGenerator.js\";\n\nexport class TSMorphCodeGenerator {\n private project = new Project();\n private generators = new Map<string, FileGenerator>();\n private directories: PHProjectDirectories = {\n documentModelDir: \"document-model\",\n editorsDir: \"editors\",\n processorsDir: \"processors\",\n subgraphsDir: \"subgraphs\",\n };\n private forceUpdate = false;\n\n constructor(\n private rootDir: string,\n private docModels: DocumentModelGlobalState[],\n private packageName: string,\n options: CodeGeneratorOptions = { directories: {}, forceUpdate: false },\n ) {\n this.directories = {\n ...this.directories,\n ...options.directories,\n };\n this.packageName = packageName;\n this.forceUpdate = options.forceUpdate ?? false;\n\n this.setupGenerators();\n }\n\n private setupGenerators(): void {\n const importManager = new ImportManager();\n const directoryManager = new DirectoryManager(this.directories);\n const declarationManager = new DeclarationManager();\n // Register all generators\n this.generators.set(\n \"reducers\",\n new ReducerGenerator(importManager, directoryManager, declarationManager),\n );\n }\n\n // Generate specific file types\n async generateReducers(): Promise<void> {\n await this.generateFileType(\"reducers\");\n }\n\n // Generate everything\n async generateAll(): Promise<void> {\n for (const [type] of this.generators) {\n await this.generateFileType(type);\n }\n }\n\n private async generateFileType(type: string): Promise<void> {\n const generator = this.generators.get(type);\n if (!generator) {\n throw new Error(`No generator registered for type: ${type}`);\n }\n\n await this.setupProject();\n\n for (const docModel of this.docModels) {\n const latestSpec =\n docModel.specifications[docModel.specifications.length - 1];\n\n for (const module of latestSpec.modules) {\n const context = this.createGenerationContext(\n docModel,\n module,\n this.forceUpdate,\n );\n\n await generator.generate(context);\n }\n }\n }\n\n private async setupProject(): Promise<void> {\n // Only load files from configured directories\n const sourcePaths: string[] = [];\n\n if (this.directories.documentModelDir) {\n const dirPath = `${this.rootDir}/${this.directories.documentModelDir}`;\n await this.ensureDirectoryExists(dirPath);\n sourcePaths.push(`${dirPath}/**/*.ts`);\n }\n if (this.directories.editorsDir) {\n const dirPath = `${this.rootDir}/${this.directories.editorsDir}`;\n await this.ensureDirectoryExists(dirPath);\n sourcePaths.push(`${dirPath}/**/*.ts`);\n }\n if (this.directories.processorsDir) {\n const dirPath = `${this.rootDir}/${this.directories.processorsDir}`;\n await this.ensureDirectoryExists(dirPath);\n sourcePaths.push(`${dirPath}/**/*.ts`);\n }\n if (this.directories.subgraphsDir) {\n const dirPath = `${this.rootDir}/${this.directories.subgraphsDir}`;\n await this.ensureDirectoryExists(dirPath);\n sourcePaths.push(`${dirPath}/**/*.ts`);\n }\n\n // Exclude node_modules from all paths\n sourcePaths.push(`!${this.rootDir}/**/node_modules/**`);\n\n if (sourcePaths.length > 0) {\n this.project.addSourceFilesAtPaths(sourcePaths);\n }\n }\n\n private createGenerationContext(\n docModel: DocumentModelGlobalState,\n module: ModuleSpecification,\n forceUpdate = false,\n ): GenerationContext {\n const operations: CodegenOperation[] = module.operations.map((op) => ({\n ...op,\n hasInput: op.schema !== null,\n hasAttachment: op.schema?.includes(\": Attachment\"),\n scope: op.scope || \"global\",\n state: op.scope === \"global\" ? \"\" : op.scope,\n }));\n\n return {\n rootDir: this.rootDir,\n packageName: this.packageName,\n docModel,\n module,\n project: this.project,\n operations,\n forceUpdate,\n };\n }\n\n private async ensureDirectoryExists(dirPath: string): Promise<void> {\n try {\n await fs.mkdir(dirPath, { recursive: true });\n } catch (err) {\n console.error(`Failed to create directory: ${dirPath}`, err);\n throw err;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAQA,SAAgB,UAA6C,OAAa;AACxE,QAAO,OAAO,YACZ,OAAO,QAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,CAAC,CAC7D;;AAGH,eAAsB,kBACpB,MACmC;CACnC,IAAI;AACJ,KAAI;AACF,MAAI,CAAC,KACH,OAAM,IAAI,MAAM,oCAAoC;WAC3C,KAAK,SAAS,OAAO,IAAI,KAAK,SAAS,OAAO,CAEvD,kBADa,MAAM,iBAAiB,MAAM,qBAAqB,EAC1C,MAAM;WAClB,KAAK,SAAS,QAAQ,EAAE;GACjC,MAAM,OAAO,MAAM,SAAS,MAAM,Q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AAK;AACZ,WAAQ,MAAM,+BAA+B,WAAW,IAAI;AAC5D,SAAM"}
@@ -1,2 +1,2 @@
1
- import { A as makeEditorsFile, B as writeCliDocsMarkdownFile, C as tsMorphGenerateSubgraph, D as pruneManifestSection, E as getOrCreateManifestFile, F as tsMorphGenerateDocumentModel, G as writeGeneratedDocumentModelsFiles, H as writeAiConfigFiles, I as tsMorphGenerateDocumentEditor, J as writeGeneratedProjectRootFiles, K as writeGeneratedEditorsFiles, L as getCommandHelpInfo, M as operationHasAttachment, N as operationHasEmptyInput, O as makeModulesIndexFile, P as operationHasInput, Q as tsMorphGenerateApp, R as getCommandsHelpInfo, S as makeSubgraphsIndexFile, T as createOrUpdateManifest, U as writeAllGeneratedProjectFiles, V as buildBoilerplatePackageJson, W as writeCIFiles, X as writeModuleFiles, Y as writeGeneratedSubgraphsFiles, Z as writeProjectRootFiles, a as DocumentModelDocumentTypeMetadata, c as DocumentModelVariableNames, d as HelpTopic, i as CommonMakeEditorComponentArgs, j as makeEditorsIndexFile, k as makeEditorModuleFile, l as EditorVariableNames, n as CommandHelpInfo, o as DocumentModelFileMakerArgs, q as writeGeneratedProcessorsFiles, r as CommonGenerateEditorArgs, s as DocumentModelModuleFileMakerArgs, t as CommandEntry, u as GenerateDocumentModelArgs, w as tsMorphGenerateProcessor, z as makeCliDocsFromHelp } from "../../index-CIOH-vw2.mjs";
1
+ import { A as makeEditorsFile, B as writeCliDocsMarkdownFile, C as tsMorphGenerateSubgraph, D as pruneManifestSection, E as getOrCreateManifestFile, F as tsMorphGenerateDocumentModel, G as writeGeneratedDocumentModelsFiles, H as writeAiConfigFiles, I as tsMorphGenerateDocumentEditor, J as writeGeneratedProjectRootFiles, K as writeGeneratedEditorsFiles, L as getCommandHelpInfo, M as operationHasAttachment, N as operationHasEmptyInput, O as makeModulesIndexFile, P as operationHasInput, Q as tsMorphGenerateApp, R as getCommandsHelpInfo, S as makeSubgraphsIndexFile, T as createOrUpdateManifest, U as writeAllGeneratedProjectFiles, V as buildBoilerplatePackageJson, W as writeCIFiles, X as writeModuleFiles, Y as writeGeneratedSubgraphsFiles, Z as writeProjectRootFiles, a as DocumentModelDocumentTypeMetadata, c as DocumentModelVariableNames, d as HelpTopic, i as CommonMakeEditorComponentArgs, j as makeEditorsIndexFile, k as makeEditorModuleFile, l as EditorVariableNames, n as CommandHelpInfo, o as DocumentModelFileMakerArgs, q as writeGeneratedProcessorsFiles, r as CommonGenerateEditorArgs, s as DocumentModelModuleFileMakerArgs, t as CommandEntry, u as GenerateDocumentModelArgs, w as tsMorphGenerateProcessor, z as makeCliDocsFromHelp } from "../../index-DGqqrenJ.mjs";
2
2
  export { CommandEntry, CommandHelpInfo, CommonGenerateEditorArgs, CommonMakeEditorComponentArgs, DocumentModelDocumentTypeMetadata, DocumentModelFileMakerArgs, DocumentModelModuleFileMakerArgs, DocumentModelVariableNames, EditorVariableNames, GenerateDocumentModelArgs, HelpTopic, buildBoilerplatePackageJson, createOrUpdateManifest, getCommandHelpInfo, getCommandsHelpInfo, getOrCreateManifestFile, makeCliDocsFromHelp, makeEditorModuleFile, makeEditorsFile, makeEditorsIndexFile, makeModulesIndexFile, makeSubgraphsIndexFile, operationHasAttachment, operationHasEmptyInput, operationHasInput, pruneManifestSection, tsMorphGenerateApp, tsMorphGenerateDocumentEditor, tsMorphGenerateDocumentModel, tsMorphGenerateProcessor, tsMorphGenerateSubgraph, writeAiConfigFiles, writeAllGeneratedProjectFiles, writeCIFiles, writeCliDocsMarkdownFile, writeGeneratedDocumentModelsFiles, writeGeneratedEditorsFiles, writeGeneratedProcessorsFiles, writeGeneratedProjectRootFiles, writeGeneratedSubgraphsFiles, writeModuleFiles, writeProjectRootFiles };
@@ -1,2 +1,2 @@
1
- import { _ as getLatestDocumentModelSpecVersionNumber, b as getActionType, f as getDocumentModelDirName, g as getLatestDocumentModelSpec, h as getEditorVariableNames, m as getDocumentModelVariableNames, p as getDocumentModelSpecByVersionNumber, v as getActionInputName, x as getActionTypeName, y as getActionInputTypeNames } from "../../index-CIOH-vw2.mjs";
1
+ import { _ as getLatestDocumentModelSpecVersionNumber, b as getActionType, f as getDocumentModelDirName, g as getLatestDocumentModelSpec, h as getEditorVariableNames, m as getDocumentModelVariableNames, p as getDocumentModelSpecByVersionNumber, v as getActionInputName, x as getActionTypeName, y as getActionInputTypeNames } from "../../index-DGqqrenJ.mjs";
2
2
  export { getActionInputName, getActionInputTypeNames, getActionType, getActionTypeName, getDocumentModelDirName, getDocumentModelSpecByVersionNumber, getDocumentModelVariableNames, getEditorVariableNames, getLatestDocumentModelSpec, getLatestDocumentModelSpecVersionNumber };
@@ -1,4 +1,4 @@
1
- import { c as DocumentModelVariableNames, o as DocumentModelFileMakerArgs, s as DocumentModelModuleFileMakerArgs$1 } from "../../index-CIOH-vw2.mjs";
1
+ import { c as DocumentModelVariableNames, o as DocumentModelFileMakerArgs, s as DocumentModelModuleFileMakerArgs$1 } from "../../index-DGqqrenJ.mjs";
2
2
  import { CommandHelpInfo, DocumentModelModuleFileMakerArgs, EditorVariableNames } from "@powerhousedao/codegen";
3
3
  import { OperationSpecification } from "@powerhousedao/shared";
4
4
 
@@ -292,7 +292,7 @@ declare const documentModelTestFileTemplate: (v: DocumentModelFileMakerArgs) =>
292
292
  //#endregion
293
293
  //#region src/templates/document-model/tests/module.test.d.ts
294
294
  declare function makeTestCaseForOperation(operation: OperationSpecification, isPhDocumentOfTypeFunctionName: string): string;
295
- declare function makeOperationImportNames(v: DocumentModelModuleFileMakerArgs$1): any[];
295
+ declare function makeOperationImportNames(v: DocumentModelModuleFileMakerArgs$1): string[];
296
296
  declare function makeOperationsImports(v: DocumentModelModuleFileMakerArgs$1): string;
297
297
  declare const documentModelOperationsModuleTestFileTemplate: (v: DocumentModelModuleFileMakerArgs$1) => string;
298
298
  //#endregion
@@ -1,4 +1,4 @@
1
- import { a as DocumentModelDocumentTypeMetadata } from "../../index-CIOH-vw2.mjs";
1
+ import { a as DocumentModelDocumentTypeMetadata } from "../../index-DGqqrenJ.mjs";
2
2
  import { a as parseConfig, i as parseArgs, n as validateDocumentModelState, r as configSpec, t as DocumentModelStateValidationResult } from "../../validation-Z3z0BJlu.mjs";
3
3
  import { Dirent } from "fs";
4
4
  import { DocumentModelGlobalState } from "@powerhousedao/shared/document-model";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerhousedao/codegen",
3
- "version": "6.0.0-dev.252",
3
+ "version": "6.0.0-dev.254",
4
4
  "license": "AGPL-3.0-only",
5
5
  "private": false,
6
6
  "type": "module",
@@ -53,8 +53,8 @@
53
53
  "write-json-file": "^7.0.0",
54
54
  "write-package": "7.2.0",
55
55
  "zod": "4.3.6",
56
- "@powerhousedao/shared": "6.0.0-dev.252",
57
- "document-model": "6.0.0-dev.252"
56
+ "@powerhousedao/shared": "6.0.0-dev.254",
57
+ "document-model": "6.0.0-dev.254"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@pnpm/find-workspace-dir": "^1000.1.5",