@powerhousedao/codegen 6.2.0-rc.2 → 6.2.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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.2.0-rc.2";
204
+ return "6.2.0-rc.3";
205
205
  }
206
206
  //#endregion
207
207
  //#region src/codegen/kysely.ts
@@ -253,7 +253,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
253
253
  "dir": "/home/runner/work/powerhouse/powerhouse/apps/academy",
254
254
  "manifest": {
255
255
  "name": "@powerhousedao/academy",
256
- "version": "6.2.0-rc.2",
256
+ "version": "6.2.0-rc.3",
257
257
  "homepage": "https://powerhouse.academy",
258
258
  "packageManager": "pnpm@10.9.0",
259
259
  "repository": {
@@ -323,7 +323,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
323
323
  "manifest": {
324
324
  "name": "@powerhousedao/connect",
325
325
  "productName": "Powerhouse-Connect",
326
- "version": "6.2.0-rc.2",
326
+ "version": "6.2.0-rc.3",
327
327
  "description": "Powerhouse Connect",
328
328
  "main": "dist/index.html",
329
329
  "type": "module",
@@ -444,7 +444,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
444
444
  "manifest": {
445
445
  "name": "@powerhousedao/switchboard",
446
446
  "type": "module",
447
- "version": "6.2.0-rc.2",
447
+ "version": "6.2.0-rc.3",
448
448
  "main": "dist/index.mjs",
449
449
  "exports": {
450
450
  ".": {
@@ -544,7 +544,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
544
544
  "dir": "/home/runner/work/powerhouse/powerhouse/clis/ph-cli",
545
545
  "manifest": {
546
546
  "name": "@powerhousedao/ph-cli",
547
- "version": "6.2.0-rc.2",
547
+ "version": "6.2.0-rc.3",
548
548
  "description": "",
549
549
  "license": "AGPL-3.0-only",
550
550
  "type": "module",
@@ -612,7 +612,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
612
612
  "dir": "/home/runner/work/powerhouse/powerhouse/clis/ph-cmd",
613
613
  "manifest": {
614
614
  "name": "ph-cmd",
615
- "version": "6.2.0-rc.2",
615
+ "version": "6.2.0-rc.3",
616
616
  "description": "Powerhouse CLI — create Vetra projects, generate document models and editors, run local dev environments, and publish packages.",
617
617
  "license": "AGPL-3.0-only",
618
618
  "type": "module",
@@ -670,7 +670,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
670
670
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/analytics-engine/browser",
671
671
  "manifest": {
672
672
  "name": "@powerhousedao/analytics-engine-browser",
673
- "version": "6.2.0-rc.2",
673
+ "version": "6.2.0-rc.3",
674
674
  "license": "AGPL-3.0-only",
675
675
  "repository": {
676
676
  "type": "git",
@@ -730,7 +730,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
730
730
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/analytics-engine/core",
731
731
  "manifest": {
732
732
  "name": "@powerhousedao/analytics-engine-core",
733
- "version": "6.2.0-rc.2",
733
+ "version": "6.2.0-rc.3",
734
734
  "license": "AGPL-3.0-only",
735
735
  "repository": {
736
736
  "type": "git",
@@ -777,7 +777,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
777
777
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/analytics-engine/graphql",
778
778
  "manifest": {
779
779
  "name": "@powerhousedao/analytics-engine-graphql",
780
- "version": "6.2.0-rc.2",
780
+ "version": "6.2.0-rc.3",
781
781
  "license": "AGPL-3.0-only",
782
782
  "repository": {
783
783
  "type": "git",
@@ -811,7 +811,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
811
811
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/analytics-engine/knex",
812
812
  "manifest": {
813
813
  "name": "@powerhousedao/analytics-engine-knex",
814
- "version": "6.2.0-rc.2",
814
+ "version": "6.2.0-rc.3",
815
815
  "license": "AGPL-3.0-only",
816
816
  "repository": {
817
817
  "type": "git",
@@ -849,7 +849,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
849
849
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/analytics-engine/pg",
850
850
  "manifest": {
851
851
  "name": "@powerhousedao/analytics-engine-pg",
852
- "version": "6.2.0-rc.2",
852
+ "version": "6.2.0-rc.3",
853
853
  "license": "AGPL-3.0-only",
854
854
  "repository": {
855
855
  "type": "git",
@@ -888,7 +888,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
888
888
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/builder-tools",
889
889
  "manifest": {
890
890
  "name": "@powerhousedao/builder-tools",
891
- "version": "6.2.0-rc.2",
891
+ "version": "6.2.0-rc.3",
892
892
  "type": "module",
893
893
  "license": "AGPL-3.0-only",
894
894
  "publishConfig": { "access": "public" },
@@ -918,7 +918,8 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
918
918
  "document-model": "workspace:*",
919
919
  "magic-string": "^0.30.21",
920
920
  "vite": "catalog:",
921
- "vite-plugin-html": "catalog:"
921
+ "vite-plugin-html": "catalog:",
922
+ "vite-plugin-pwa": "catalog:"
922
923
  },
923
924
  "devDependencies": {
924
925
  "@sentry/vite-plugin": "^4.3.0",
@@ -956,7 +957,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
956
957
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/codegen",
957
958
  "manifest": {
958
959
  "name": "@powerhousedao/codegen",
959
- "version": "6.2.0-rc.2",
960
+ "version": "6.2.0-rc.3",
960
961
  "license": "AGPL-3.0-only",
961
962
  "private": false,
962
963
  "type": "module",
@@ -1046,7 +1047,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
1046
1047
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/common",
1047
1048
  "manifest": {
1048
1049
  "name": "@powerhousedao/common",
1049
- "version": "6.2.0-rc.2",
1050
+ "version": "6.2.0-rc.3",
1050
1051
  "license": "AGPL-3.0-only",
1051
1052
  "type": "module",
1052
1053
  "files": ["/dist"],
@@ -1113,7 +1114,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
1113
1114
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/config",
1114
1115
  "manifest": {
1115
1116
  "name": "@powerhousedao/config",
1116
- "version": "6.2.0-rc.2",
1117
+ "version": "6.2.0-rc.3",
1117
1118
  "description": "",
1118
1119
  "license": "AGPL-3.0-only",
1119
1120
  "private": false,
@@ -1150,7 +1151,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
1150
1151
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/design-system",
1151
1152
  "manifest": {
1152
1153
  "name": "@powerhousedao/design-system",
1153
- "version": "6.2.0-rc.2",
1154
+ "version": "6.2.0-rc.3",
1154
1155
  "description": "Powerhouse document-engineering design system — GraphQL scalar UI components for building consistent Powerhouse editors.",
1155
1156
  "files": ["dist", "theme.css"],
1156
1157
  "type": "module",
@@ -1320,7 +1321,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
1320
1321
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/document-model",
1321
1322
  "manifest": {
1322
1323
  "name": "document-model",
1323
- "version": "6.2.0-rc.2",
1324
+ "version": "6.2.0-rc.3",
1324
1325
  "license": "AGPL-3.0-only",
1325
1326
  "private": false,
1326
1327
  "files": ["dist"],
@@ -1395,7 +1396,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
1395
1396
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/opentelemetry-instrumentation-reactor",
1396
1397
  "manifest": {
1397
1398
  "name": "@powerhousedao/opentelemetry-instrumentation-reactor",
1398
- "version": "6.2.0-rc.2",
1399
+ "version": "6.2.0-rc.3",
1399
1400
  "description": "OpenTelemetry instrumentation for @powerhousedao/reactor",
1400
1401
  "type": "module",
1401
1402
  "sideEffects": false,
@@ -1433,7 +1434,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
1433
1434
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/pglite-fs",
1434
1435
  "manifest": {
1435
1436
  "name": "@powerhousedao/pglite-fs",
1436
- "version": "6.2.0-rc.2",
1437
+ "version": "6.2.0-rc.3",
1437
1438
  "license": "AGPL-3.0-only",
1438
1439
  "type": "module",
1439
1440
  "repository": {
@@ -1468,7 +1469,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
1468
1469
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/powerhouse-vetra-packages",
1469
1470
  "manifest": {
1470
1471
  "name": "@powerhousedao/powerhouse-vetra-packages",
1471
- "version": "6.2.0-rc.2",
1472
+ "version": "6.2.0-rc.3",
1472
1473
  "description": "",
1473
1474
  "keywords": [],
1474
1475
  "author": "",
@@ -1591,7 +1592,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
1591
1592
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/reactor",
1592
1593
  "manifest": {
1593
1594
  "name": "@powerhousedao/reactor",
1594
- "version": "6.2.0-rc.2",
1595
+ "version": "6.2.0-rc.3",
1595
1596
  "description": "Core Powerhouse reactor — stores documents, resolves conflicts, and reprocesses operation histories. Supports local, cloud, and decentralized storage backends.",
1596
1597
  "repository": {
1597
1598
  "url": "https://github.com/powerhouse-inc/powerhouse",
@@ -1663,7 +1664,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
1663
1664
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/reactor-api",
1664
1665
  "manifest": {
1665
1666
  "name": "@powerhousedao/reactor-api",
1666
- "version": "6.2.0-rc.2",
1667
+ "version": "6.2.0-rc.3",
1667
1668
  "description": "GraphQL API layer for the Powerhouse reactor — auto-generated subgraphs per document model plus the core reactor subgraph for drive and document management.",
1668
1669
  "type": "module",
1669
1670
  "repository": {
@@ -1810,7 +1811,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
1810
1811
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/reactor-attachments",
1811
1812
  "manifest": {
1812
1813
  "name": "@powerhousedao/reactor-attachments",
1813
- "version": "6.2.0-rc.2",
1814
+ "version": "6.2.0-rc.3",
1814
1815
  "license": "AGPL-3.0-only",
1815
1816
  "type": "module",
1816
1817
  "repository": {
@@ -1869,7 +1870,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
1869
1870
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/reactor-browser",
1870
1871
  "manifest": {
1871
1872
  "name": "@powerhousedao/reactor-browser",
1872
- "version": "6.2.0-rc.2",
1873
+ "version": "6.2.0-rc.3",
1873
1874
  "license": "AGPL-3.0-only",
1874
1875
  "type": "module",
1875
1876
  "repository": {
@@ -1993,7 +1994,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
1993
1994
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/reactor-drive",
1994
1995
  "manifest": {
1995
1996
  "name": "@powerhousedao/reactor-drive",
1996
- "version": "6.2.0-rc.2",
1997
+ "version": "6.2.0-rc.3",
1997
1998
  "license": "AGPL-3.0-only",
1998
1999
  "type": "module",
1999
2000
  "repository": {
@@ -2048,7 +2049,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
2048
2049
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/reactor-hypercore",
2049
2050
  "manifest": {
2050
2051
  "name": "@powerhousedao/reactor-hypercore",
2051
- "version": "6.2.0-rc.2",
2052
+ "version": "6.2.0-rc.3",
2052
2053
  "description": "Hypercore-backed IOperationStore for the Powerhouse Reactor",
2053
2054
  "repository": {
2054
2055
  "url": "https://github.com/powerhouse-inc/powerhouse",
@@ -2091,7 +2092,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
2091
2092
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/reactor-mcp",
2092
2093
  "manifest": {
2093
2094
  "name": "@powerhousedao/reactor-mcp",
2094
- "version": "6.2.0-rc.2",
2095
+ "version": "6.2.0-rc.3",
2095
2096
  "description": "MCP server for the Powerhouse reactor — exposes document model operations and drive management to AI coding assistants via the Model Context Protocol.",
2096
2097
  "type": "module",
2097
2098
  "repository": {
@@ -2158,7 +2159,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
2158
2159
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/registry",
2159
2160
  "manifest": {
2160
2161
  "name": "@powerhousedao/registry",
2161
- "version": "6.2.0-rc.2",
2162
+ "version": "6.2.0-rc.3",
2162
2163
  "description": "Powerhouse package registry — resolves and manages document model package dependencies within the Powerhouse ecosystem.",
2163
2164
  "type": "module",
2164
2165
  "repository": {
@@ -2214,7 +2215,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
2214
2215
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/renown",
2215
2216
  "manifest": {
2216
2217
  "name": "@renown/sdk",
2217
- "version": "6.2.0-rc.2",
2218
+ "version": "6.2.0-rc.3",
2218
2219
  "description": "Renown SDK — wallet-based authentication and user identity management for Powerhouse React applications.",
2219
2220
  "license": "AGPL-3.0-only",
2220
2221
  "private": false,
@@ -2282,7 +2283,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
2282
2283
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/shared",
2283
2284
  "manifest": {
2284
2285
  "name": "@powerhousedao/shared",
2285
- "version": "6.2.0-rc.2",
2286
+ "version": "6.2.0-rc.3",
2286
2287
  "type": "module",
2287
2288
  "sideEffects": false,
2288
2289
  "publishConfig": { "access": "public" },
@@ -2445,7 +2446,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
2445
2446
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/vetra",
2446
2447
  "manifest": {
2447
2448
  "name": "@powerhousedao/vetra",
2448
- "version": "6.2.0-rc.2",
2449
+ "version": "6.2.0-rc.3",
2449
2450
  "license": "AGPL-3.0-only",
2450
2451
  "type": "module",
2451
2452
  "sideEffects": false,
@@ -2990,7 +2991,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
2990
2991
  "dir": "/home/runner/work/powerhouse/powerhouse/apps/academy",
2991
2992
  "manifest": {
2992
2993
  "name": "@powerhousedao/academy",
2993
- "version": "6.2.0-rc.2",
2994
+ "version": "6.2.0-rc.3",
2994
2995
  "homepage": "https://powerhouse.academy",
2995
2996
  "packageManager": "pnpm@10.9.0",
2996
2997
  "repository": {
@@ -3060,7 +3061,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
3060
3061
  "manifest": {
3061
3062
  "name": "@powerhousedao/connect",
3062
3063
  "productName": "Powerhouse-Connect",
3063
- "version": "6.2.0-rc.2",
3064
+ "version": "6.2.0-rc.3",
3064
3065
  "description": "Powerhouse Connect",
3065
3066
  "main": "dist/index.html",
3066
3067
  "type": "module",
@@ -3181,7 +3182,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
3181
3182
  "manifest": {
3182
3183
  "name": "@powerhousedao/switchboard",
3183
3184
  "type": "module",
3184
- "version": "6.2.0-rc.2",
3185
+ "version": "6.2.0-rc.3",
3185
3186
  "main": "dist/index.mjs",
3186
3187
  "exports": {
3187
3188
  ".": {
@@ -3281,7 +3282,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
3281
3282
  "dir": "/home/runner/work/powerhouse/powerhouse/clis/ph-cli",
3282
3283
  "manifest": {
3283
3284
  "name": "@powerhousedao/ph-cli",
3284
- "version": "6.2.0-rc.2",
3285
+ "version": "6.2.0-rc.3",
3285
3286
  "description": "",
3286
3287
  "license": "AGPL-3.0-only",
3287
3288
  "type": "module",
@@ -3349,7 +3350,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
3349
3350
  "dir": "/home/runner/work/powerhouse/powerhouse/clis/ph-cmd",
3350
3351
  "manifest": {
3351
3352
  "name": "ph-cmd",
3352
- "version": "6.2.0-rc.2",
3353
+ "version": "6.2.0-rc.3",
3353
3354
  "description": "Powerhouse CLI — create Vetra projects, generate document models and editors, run local dev environments, and publish packages.",
3354
3355
  "license": "AGPL-3.0-only",
3355
3356
  "type": "module",
@@ -3407,7 +3408,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
3407
3408
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/analytics-engine/browser",
3408
3409
  "manifest": {
3409
3410
  "name": "@powerhousedao/analytics-engine-browser",
3410
- "version": "6.2.0-rc.2",
3411
+ "version": "6.2.0-rc.3",
3411
3412
  "license": "AGPL-3.0-only",
3412
3413
  "repository": {
3413
3414
  "type": "git",
@@ -3467,7 +3468,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
3467
3468
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/analytics-engine/core",
3468
3469
  "manifest": {
3469
3470
  "name": "@powerhousedao/analytics-engine-core",
3470
- "version": "6.2.0-rc.2",
3471
+ "version": "6.2.0-rc.3",
3471
3472
  "license": "AGPL-3.0-only",
3472
3473
  "repository": {
3473
3474
  "type": "git",
@@ -3514,7 +3515,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
3514
3515
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/analytics-engine/graphql",
3515
3516
  "manifest": {
3516
3517
  "name": "@powerhousedao/analytics-engine-graphql",
3517
- "version": "6.2.0-rc.2",
3518
+ "version": "6.2.0-rc.3",
3518
3519
  "license": "AGPL-3.0-only",
3519
3520
  "repository": {
3520
3521
  "type": "git",
@@ -3548,7 +3549,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
3548
3549
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/analytics-engine/knex",
3549
3550
  "manifest": {
3550
3551
  "name": "@powerhousedao/analytics-engine-knex",
3551
- "version": "6.2.0-rc.2",
3552
+ "version": "6.2.0-rc.3",
3552
3553
  "license": "AGPL-3.0-only",
3553
3554
  "repository": {
3554
3555
  "type": "git",
@@ -3586,7 +3587,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
3586
3587
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/analytics-engine/pg",
3587
3588
  "manifest": {
3588
3589
  "name": "@powerhousedao/analytics-engine-pg",
3589
- "version": "6.2.0-rc.2",
3590
+ "version": "6.2.0-rc.3",
3590
3591
  "license": "AGPL-3.0-only",
3591
3592
  "repository": {
3592
3593
  "type": "git",
@@ -3625,7 +3626,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
3625
3626
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/builder-tools",
3626
3627
  "manifest": {
3627
3628
  "name": "@powerhousedao/builder-tools",
3628
- "version": "6.2.0-rc.2",
3629
+ "version": "6.2.0-rc.3",
3629
3630
  "type": "module",
3630
3631
  "license": "AGPL-3.0-only",
3631
3632
  "publishConfig": { "access": "public" },
@@ -3655,7 +3656,8 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
3655
3656
  "document-model": "workspace:*",
3656
3657
  "magic-string": "^0.30.21",
3657
3658
  "vite": "catalog:",
3658
- "vite-plugin-html": "catalog:"
3659
+ "vite-plugin-html": "catalog:",
3660
+ "vite-plugin-pwa": "catalog:"
3659
3661
  },
3660
3662
  "devDependencies": {
3661
3663
  "@sentry/vite-plugin": "^4.3.0",
@@ -3693,7 +3695,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
3693
3695
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/codegen",
3694
3696
  "manifest": {
3695
3697
  "name": "@powerhousedao/codegen",
3696
- "version": "6.2.0-rc.2",
3698
+ "version": "6.2.0-rc.3",
3697
3699
  "license": "AGPL-3.0-only",
3698
3700
  "private": false,
3699
3701
  "type": "module",
@@ -3783,7 +3785,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
3783
3785
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/common",
3784
3786
  "manifest": {
3785
3787
  "name": "@powerhousedao/common",
3786
- "version": "6.2.0-rc.2",
3788
+ "version": "6.2.0-rc.3",
3787
3789
  "license": "AGPL-3.0-only",
3788
3790
  "type": "module",
3789
3791
  "files": ["/dist"],
@@ -3850,7 +3852,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
3850
3852
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/config",
3851
3853
  "manifest": {
3852
3854
  "name": "@powerhousedao/config",
3853
- "version": "6.2.0-rc.2",
3855
+ "version": "6.2.0-rc.3",
3854
3856
  "description": "",
3855
3857
  "license": "AGPL-3.0-only",
3856
3858
  "private": false,
@@ -3887,7 +3889,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
3887
3889
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/design-system",
3888
3890
  "manifest": {
3889
3891
  "name": "@powerhousedao/design-system",
3890
- "version": "6.2.0-rc.2",
3892
+ "version": "6.2.0-rc.3",
3891
3893
  "description": "Powerhouse document-engineering design system — GraphQL scalar UI components for building consistent Powerhouse editors.",
3892
3894
  "files": ["dist", "theme.css"],
3893
3895
  "type": "module",
@@ -4057,7 +4059,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
4057
4059
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/document-model",
4058
4060
  "manifest": {
4059
4061
  "name": "document-model",
4060
- "version": "6.2.0-rc.2",
4062
+ "version": "6.2.0-rc.3",
4061
4063
  "license": "AGPL-3.0-only",
4062
4064
  "private": false,
4063
4065
  "files": ["dist"],
@@ -4132,7 +4134,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
4132
4134
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/opentelemetry-instrumentation-reactor",
4133
4135
  "manifest": {
4134
4136
  "name": "@powerhousedao/opentelemetry-instrumentation-reactor",
4135
- "version": "6.2.0-rc.2",
4137
+ "version": "6.2.0-rc.3",
4136
4138
  "description": "OpenTelemetry instrumentation for @powerhousedao/reactor",
4137
4139
  "type": "module",
4138
4140
  "sideEffects": false,
@@ -4170,7 +4172,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
4170
4172
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/pglite-fs",
4171
4173
  "manifest": {
4172
4174
  "name": "@powerhousedao/pglite-fs",
4173
- "version": "6.2.0-rc.2",
4175
+ "version": "6.2.0-rc.3",
4174
4176
  "license": "AGPL-3.0-only",
4175
4177
  "type": "module",
4176
4178
  "repository": {
@@ -4205,7 +4207,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
4205
4207
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/powerhouse-vetra-packages",
4206
4208
  "manifest": {
4207
4209
  "name": "@powerhousedao/powerhouse-vetra-packages",
4208
- "version": "6.2.0-rc.2",
4210
+ "version": "6.2.0-rc.3",
4209
4211
  "description": "",
4210
4212
  "keywords": [],
4211
4213
  "author": "",
@@ -4328,7 +4330,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
4328
4330
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/reactor",
4329
4331
  "manifest": {
4330
4332
  "name": "@powerhousedao/reactor",
4331
- "version": "6.2.0-rc.2",
4333
+ "version": "6.2.0-rc.3",
4332
4334
  "description": "Core Powerhouse reactor — stores documents, resolves conflicts, and reprocesses operation histories. Supports local, cloud, and decentralized storage backends.",
4333
4335
  "repository": {
4334
4336
  "url": "https://github.com/powerhouse-inc/powerhouse",
@@ -4400,7 +4402,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
4400
4402
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/reactor-api",
4401
4403
  "manifest": {
4402
4404
  "name": "@powerhousedao/reactor-api",
4403
- "version": "6.2.0-rc.2",
4405
+ "version": "6.2.0-rc.3",
4404
4406
  "description": "GraphQL API layer for the Powerhouse reactor — auto-generated subgraphs per document model plus the core reactor subgraph for drive and document management.",
4405
4407
  "type": "module",
4406
4408
  "repository": {
@@ -4547,7 +4549,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
4547
4549
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/reactor-attachments",
4548
4550
  "manifest": {
4549
4551
  "name": "@powerhousedao/reactor-attachments",
4550
- "version": "6.2.0-rc.2",
4552
+ "version": "6.2.0-rc.3",
4551
4553
  "license": "AGPL-3.0-only",
4552
4554
  "type": "module",
4553
4555
  "repository": {
@@ -4606,7 +4608,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
4606
4608
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/reactor-browser",
4607
4609
  "manifest": {
4608
4610
  "name": "@powerhousedao/reactor-browser",
4609
- "version": "6.2.0-rc.2",
4611
+ "version": "6.2.0-rc.3",
4610
4612
  "license": "AGPL-3.0-only",
4611
4613
  "type": "module",
4612
4614
  "repository": {
@@ -4730,7 +4732,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
4730
4732
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/reactor-drive",
4731
4733
  "manifest": {
4732
4734
  "name": "@powerhousedao/reactor-drive",
4733
- "version": "6.2.0-rc.2",
4735
+ "version": "6.2.0-rc.3",
4734
4736
  "license": "AGPL-3.0-only",
4735
4737
  "type": "module",
4736
4738
  "repository": {
@@ -4785,7 +4787,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
4785
4787
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/reactor-hypercore",
4786
4788
  "manifest": {
4787
4789
  "name": "@powerhousedao/reactor-hypercore",
4788
- "version": "6.2.0-rc.2",
4790
+ "version": "6.2.0-rc.3",
4789
4791
  "description": "Hypercore-backed IOperationStore for the Powerhouse Reactor",
4790
4792
  "repository": {
4791
4793
  "url": "https://github.com/powerhouse-inc/powerhouse",
@@ -4828,7 +4830,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
4828
4830
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/reactor-mcp",
4829
4831
  "manifest": {
4830
4832
  "name": "@powerhousedao/reactor-mcp",
4831
- "version": "6.2.0-rc.2",
4833
+ "version": "6.2.0-rc.3",
4832
4834
  "description": "MCP server for the Powerhouse reactor — exposes document model operations and drive management to AI coding assistants via the Model Context Protocol.",
4833
4835
  "type": "module",
4834
4836
  "repository": {
@@ -4895,7 +4897,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
4895
4897
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/registry",
4896
4898
  "manifest": {
4897
4899
  "name": "@powerhousedao/registry",
4898
- "version": "6.2.0-rc.2",
4900
+ "version": "6.2.0-rc.3",
4899
4901
  "description": "Powerhouse package registry — resolves and manages document model package dependencies within the Powerhouse ecosystem.",
4900
4902
  "type": "module",
4901
4903
  "repository": {
@@ -4951,7 +4953,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
4951
4953
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/renown",
4952
4954
  "manifest": {
4953
4955
  "name": "@renown/sdk",
4954
- "version": "6.2.0-rc.2",
4956
+ "version": "6.2.0-rc.3",
4955
4957
  "description": "Renown SDK — wallet-based authentication and user identity management for Powerhouse React applications.",
4956
4958
  "license": "AGPL-3.0-only",
4957
4959
  "private": false,
@@ -5019,7 +5021,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
5019
5021
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/shared",
5020
5022
  "manifest": {
5021
5023
  "name": "@powerhousedao/shared",
5022
- "version": "6.2.0-rc.2",
5024
+ "version": "6.2.0-rc.3",
5023
5025
  "type": "module",
5024
5026
  "sideEffects": false,
5025
5027
  "publishConfig": { "access": "public" },
@@ -5182,7 +5184,7 @@ async function getFullyQualifiedWorkspacePackageVersion(versionOrTag) {
5182
5184
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/vetra",
5183
5185
  "manifest": {
5184
5186
  "name": "@powerhousedao/vetra",
5185
- "version": "6.2.0-rc.2",
5187
+ "version": "6.2.0-rc.3",
5186
5188
  "license": "AGPL-3.0-only",
5187
5189
  "type": "module",
5188
5190
  "sideEffects": false,
@@ -5771,7 +5773,7 @@ async function migrate(version, projectDir = process.cwd()) {
5771
5773
  "dir": "/home/runner/work/powerhouse/powerhouse/apps/academy",
5772
5774
  "manifest": {
5773
5775
  "name": "@powerhousedao/academy",
5774
- "version": "6.2.0-rc.2",
5776
+ "version": "6.2.0-rc.3",
5775
5777
  "homepage": "https://powerhouse.academy",
5776
5778
  "packageManager": "pnpm@10.9.0",
5777
5779
  "repository": {
@@ -5841,7 +5843,7 @@ async function migrate(version, projectDir = process.cwd()) {
5841
5843
  "manifest": {
5842
5844
  "name": "@powerhousedao/connect",
5843
5845
  "productName": "Powerhouse-Connect",
5844
- "version": "6.2.0-rc.2",
5846
+ "version": "6.2.0-rc.3",
5845
5847
  "description": "Powerhouse Connect",
5846
5848
  "main": "dist/index.html",
5847
5849
  "type": "module",
@@ -5962,7 +5964,7 @@ async function migrate(version, projectDir = process.cwd()) {
5962
5964
  "manifest": {
5963
5965
  "name": "@powerhousedao/switchboard",
5964
5966
  "type": "module",
5965
- "version": "6.2.0-rc.2",
5967
+ "version": "6.2.0-rc.3",
5966
5968
  "main": "dist/index.mjs",
5967
5969
  "exports": {
5968
5970
  ".": {
@@ -6062,7 +6064,7 @@ async function migrate(version, projectDir = process.cwd()) {
6062
6064
  "dir": "/home/runner/work/powerhouse/powerhouse/clis/ph-cli",
6063
6065
  "manifest": {
6064
6066
  "name": "@powerhousedao/ph-cli",
6065
- "version": "6.2.0-rc.2",
6067
+ "version": "6.2.0-rc.3",
6066
6068
  "description": "",
6067
6069
  "license": "AGPL-3.0-only",
6068
6070
  "type": "module",
@@ -6130,7 +6132,7 @@ async function migrate(version, projectDir = process.cwd()) {
6130
6132
  "dir": "/home/runner/work/powerhouse/powerhouse/clis/ph-cmd",
6131
6133
  "manifest": {
6132
6134
  "name": "ph-cmd",
6133
- "version": "6.2.0-rc.2",
6135
+ "version": "6.2.0-rc.3",
6134
6136
  "description": "Powerhouse CLI — create Vetra projects, generate document models and editors, run local dev environments, and publish packages.",
6135
6137
  "license": "AGPL-3.0-only",
6136
6138
  "type": "module",
@@ -6188,7 +6190,7 @@ async function migrate(version, projectDir = process.cwd()) {
6188
6190
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/analytics-engine/browser",
6189
6191
  "manifest": {
6190
6192
  "name": "@powerhousedao/analytics-engine-browser",
6191
- "version": "6.2.0-rc.2",
6193
+ "version": "6.2.0-rc.3",
6192
6194
  "license": "AGPL-3.0-only",
6193
6195
  "repository": {
6194
6196
  "type": "git",
@@ -6248,7 +6250,7 @@ async function migrate(version, projectDir = process.cwd()) {
6248
6250
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/analytics-engine/core",
6249
6251
  "manifest": {
6250
6252
  "name": "@powerhousedao/analytics-engine-core",
6251
- "version": "6.2.0-rc.2",
6253
+ "version": "6.2.0-rc.3",
6252
6254
  "license": "AGPL-3.0-only",
6253
6255
  "repository": {
6254
6256
  "type": "git",
@@ -6295,7 +6297,7 @@ async function migrate(version, projectDir = process.cwd()) {
6295
6297
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/analytics-engine/graphql",
6296
6298
  "manifest": {
6297
6299
  "name": "@powerhousedao/analytics-engine-graphql",
6298
- "version": "6.2.0-rc.2",
6300
+ "version": "6.2.0-rc.3",
6299
6301
  "license": "AGPL-3.0-only",
6300
6302
  "repository": {
6301
6303
  "type": "git",
@@ -6329,7 +6331,7 @@ async function migrate(version, projectDir = process.cwd()) {
6329
6331
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/analytics-engine/knex",
6330
6332
  "manifest": {
6331
6333
  "name": "@powerhousedao/analytics-engine-knex",
6332
- "version": "6.2.0-rc.2",
6334
+ "version": "6.2.0-rc.3",
6333
6335
  "license": "AGPL-3.0-only",
6334
6336
  "repository": {
6335
6337
  "type": "git",
@@ -6367,7 +6369,7 @@ async function migrate(version, projectDir = process.cwd()) {
6367
6369
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/analytics-engine/pg",
6368
6370
  "manifest": {
6369
6371
  "name": "@powerhousedao/analytics-engine-pg",
6370
- "version": "6.2.0-rc.2",
6372
+ "version": "6.2.0-rc.3",
6371
6373
  "license": "AGPL-3.0-only",
6372
6374
  "repository": {
6373
6375
  "type": "git",
@@ -6406,7 +6408,7 @@ async function migrate(version, projectDir = process.cwd()) {
6406
6408
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/builder-tools",
6407
6409
  "manifest": {
6408
6410
  "name": "@powerhousedao/builder-tools",
6409
- "version": "6.2.0-rc.2",
6411
+ "version": "6.2.0-rc.3",
6410
6412
  "type": "module",
6411
6413
  "license": "AGPL-3.0-only",
6412
6414
  "publishConfig": { "access": "public" },
@@ -6436,7 +6438,8 @@ async function migrate(version, projectDir = process.cwd()) {
6436
6438
  "document-model": "workspace:*",
6437
6439
  "magic-string": "^0.30.21",
6438
6440
  "vite": "catalog:",
6439
- "vite-plugin-html": "catalog:"
6441
+ "vite-plugin-html": "catalog:",
6442
+ "vite-plugin-pwa": "catalog:"
6440
6443
  },
6441
6444
  "devDependencies": {
6442
6445
  "@sentry/vite-plugin": "^4.3.0",
@@ -6474,7 +6477,7 @@ async function migrate(version, projectDir = process.cwd()) {
6474
6477
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/codegen",
6475
6478
  "manifest": {
6476
6479
  "name": "@powerhousedao/codegen",
6477
- "version": "6.2.0-rc.2",
6480
+ "version": "6.2.0-rc.3",
6478
6481
  "license": "AGPL-3.0-only",
6479
6482
  "private": false,
6480
6483
  "type": "module",
@@ -6564,7 +6567,7 @@ async function migrate(version, projectDir = process.cwd()) {
6564
6567
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/common",
6565
6568
  "manifest": {
6566
6569
  "name": "@powerhousedao/common",
6567
- "version": "6.2.0-rc.2",
6570
+ "version": "6.2.0-rc.3",
6568
6571
  "license": "AGPL-3.0-only",
6569
6572
  "type": "module",
6570
6573
  "files": ["/dist"],
@@ -6631,7 +6634,7 @@ async function migrate(version, projectDir = process.cwd()) {
6631
6634
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/config",
6632
6635
  "manifest": {
6633
6636
  "name": "@powerhousedao/config",
6634
- "version": "6.2.0-rc.2",
6637
+ "version": "6.2.0-rc.3",
6635
6638
  "description": "",
6636
6639
  "license": "AGPL-3.0-only",
6637
6640
  "private": false,
@@ -6668,7 +6671,7 @@ async function migrate(version, projectDir = process.cwd()) {
6668
6671
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/design-system",
6669
6672
  "manifest": {
6670
6673
  "name": "@powerhousedao/design-system",
6671
- "version": "6.2.0-rc.2",
6674
+ "version": "6.2.0-rc.3",
6672
6675
  "description": "Powerhouse document-engineering design system — GraphQL scalar UI components for building consistent Powerhouse editors.",
6673
6676
  "files": ["dist", "theme.css"],
6674
6677
  "type": "module",
@@ -6838,7 +6841,7 @@ async function migrate(version, projectDir = process.cwd()) {
6838
6841
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/document-model",
6839
6842
  "manifest": {
6840
6843
  "name": "document-model",
6841
- "version": "6.2.0-rc.2",
6844
+ "version": "6.2.0-rc.3",
6842
6845
  "license": "AGPL-3.0-only",
6843
6846
  "private": false,
6844
6847
  "files": ["dist"],
@@ -6913,7 +6916,7 @@ async function migrate(version, projectDir = process.cwd()) {
6913
6916
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/opentelemetry-instrumentation-reactor",
6914
6917
  "manifest": {
6915
6918
  "name": "@powerhousedao/opentelemetry-instrumentation-reactor",
6916
- "version": "6.2.0-rc.2",
6919
+ "version": "6.2.0-rc.3",
6917
6920
  "description": "OpenTelemetry instrumentation for @powerhousedao/reactor",
6918
6921
  "type": "module",
6919
6922
  "sideEffects": false,
@@ -6951,7 +6954,7 @@ async function migrate(version, projectDir = process.cwd()) {
6951
6954
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/pglite-fs",
6952
6955
  "manifest": {
6953
6956
  "name": "@powerhousedao/pglite-fs",
6954
- "version": "6.2.0-rc.2",
6957
+ "version": "6.2.0-rc.3",
6955
6958
  "license": "AGPL-3.0-only",
6956
6959
  "type": "module",
6957
6960
  "repository": {
@@ -6986,7 +6989,7 @@ async function migrate(version, projectDir = process.cwd()) {
6986
6989
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/powerhouse-vetra-packages",
6987
6990
  "manifest": {
6988
6991
  "name": "@powerhousedao/powerhouse-vetra-packages",
6989
- "version": "6.2.0-rc.2",
6992
+ "version": "6.2.0-rc.3",
6990
6993
  "description": "",
6991
6994
  "keywords": [],
6992
6995
  "author": "",
@@ -7109,7 +7112,7 @@ async function migrate(version, projectDir = process.cwd()) {
7109
7112
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/reactor",
7110
7113
  "manifest": {
7111
7114
  "name": "@powerhousedao/reactor",
7112
- "version": "6.2.0-rc.2",
7115
+ "version": "6.2.0-rc.3",
7113
7116
  "description": "Core Powerhouse reactor — stores documents, resolves conflicts, and reprocesses operation histories. Supports local, cloud, and decentralized storage backends.",
7114
7117
  "repository": {
7115
7118
  "url": "https://github.com/powerhouse-inc/powerhouse",
@@ -7181,7 +7184,7 @@ async function migrate(version, projectDir = process.cwd()) {
7181
7184
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/reactor-api",
7182
7185
  "manifest": {
7183
7186
  "name": "@powerhousedao/reactor-api",
7184
- "version": "6.2.0-rc.2",
7187
+ "version": "6.2.0-rc.3",
7185
7188
  "description": "GraphQL API layer for the Powerhouse reactor — auto-generated subgraphs per document model plus the core reactor subgraph for drive and document management.",
7186
7189
  "type": "module",
7187
7190
  "repository": {
@@ -7328,7 +7331,7 @@ async function migrate(version, projectDir = process.cwd()) {
7328
7331
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/reactor-attachments",
7329
7332
  "manifest": {
7330
7333
  "name": "@powerhousedao/reactor-attachments",
7331
- "version": "6.2.0-rc.2",
7334
+ "version": "6.2.0-rc.3",
7332
7335
  "license": "AGPL-3.0-only",
7333
7336
  "type": "module",
7334
7337
  "repository": {
@@ -7387,7 +7390,7 @@ async function migrate(version, projectDir = process.cwd()) {
7387
7390
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/reactor-browser",
7388
7391
  "manifest": {
7389
7392
  "name": "@powerhousedao/reactor-browser",
7390
- "version": "6.2.0-rc.2",
7393
+ "version": "6.2.0-rc.3",
7391
7394
  "license": "AGPL-3.0-only",
7392
7395
  "type": "module",
7393
7396
  "repository": {
@@ -7511,7 +7514,7 @@ async function migrate(version, projectDir = process.cwd()) {
7511
7514
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/reactor-drive",
7512
7515
  "manifest": {
7513
7516
  "name": "@powerhousedao/reactor-drive",
7514
- "version": "6.2.0-rc.2",
7517
+ "version": "6.2.0-rc.3",
7515
7518
  "license": "AGPL-3.0-only",
7516
7519
  "type": "module",
7517
7520
  "repository": {
@@ -7566,7 +7569,7 @@ async function migrate(version, projectDir = process.cwd()) {
7566
7569
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/reactor-hypercore",
7567
7570
  "manifest": {
7568
7571
  "name": "@powerhousedao/reactor-hypercore",
7569
- "version": "6.2.0-rc.2",
7572
+ "version": "6.2.0-rc.3",
7570
7573
  "description": "Hypercore-backed IOperationStore for the Powerhouse Reactor",
7571
7574
  "repository": {
7572
7575
  "url": "https://github.com/powerhouse-inc/powerhouse",
@@ -7609,7 +7612,7 @@ async function migrate(version, projectDir = process.cwd()) {
7609
7612
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/reactor-mcp",
7610
7613
  "manifest": {
7611
7614
  "name": "@powerhousedao/reactor-mcp",
7612
- "version": "6.2.0-rc.2",
7615
+ "version": "6.2.0-rc.3",
7613
7616
  "description": "MCP server for the Powerhouse reactor — exposes document model operations and drive management to AI coding assistants via the Model Context Protocol.",
7614
7617
  "type": "module",
7615
7618
  "repository": {
@@ -7676,7 +7679,7 @@ async function migrate(version, projectDir = process.cwd()) {
7676
7679
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/registry",
7677
7680
  "manifest": {
7678
7681
  "name": "@powerhousedao/registry",
7679
- "version": "6.2.0-rc.2",
7682
+ "version": "6.2.0-rc.3",
7680
7683
  "description": "Powerhouse package registry — resolves and manages document model package dependencies within the Powerhouse ecosystem.",
7681
7684
  "type": "module",
7682
7685
  "repository": {
@@ -7732,7 +7735,7 @@ async function migrate(version, projectDir = process.cwd()) {
7732
7735
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/renown",
7733
7736
  "manifest": {
7734
7737
  "name": "@renown/sdk",
7735
- "version": "6.2.0-rc.2",
7738
+ "version": "6.2.0-rc.3",
7736
7739
  "description": "Renown SDK — wallet-based authentication and user identity management for Powerhouse React applications.",
7737
7740
  "license": "AGPL-3.0-only",
7738
7741
  "private": false,
@@ -7800,7 +7803,7 @@ async function migrate(version, projectDir = process.cwd()) {
7800
7803
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/shared",
7801
7804
  "manifest": {
7802
7805
  "name": "@powerhousedao/shared",
7803
- "version": "6.2.0-rc.2",
7806
+ "version": "6.2.0-rc.3",
7804
7807
  "type": "module",
7805
7808
  "sideEffects": false,
7806
7809
  "publishConfig": { "access": "public" },
@@ -7963,7 +7966,7 @@ async function migrate(version, projectDir = process.cwd()) {
7963
7966
  "dir": "/home/runner/work/powerhouse/powerhouse/packages/vetra",
7964
7967
  "manifest": {
7965
7968
  "name": "@powerhousedao/vetra",
7966
- "version": "6.2.0-rc.2",
7969
+ "version": "6.2.0-rc.3",
7967
7970
  "license": "AGPL-3.0-only",
7968
7971
  "type": "module",
7969
7972
  "sideEffects": false,
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["readdirSync","join","path","fs","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 LEGACY_LINT_FORMAT_DEPENDENCIES,\n LEGACY_LINT_FORMAT_FILES,\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// Anchor dist-tag resolution to ph-cli. Releases publish in topological order\n// (releaseGraph), so ph-cli — a top-level consumer — is published *after* its\n// workspace dependencies, and a dist-tag only moves once that package is\n// published. Resolving the tag against ph-cli therefore yields a version whose\n// entire workspace dependency closure is already on the registry. Anchoring to\n// an arbitrary `WORKSPACE_PACKAGES[0]` (e.g. codegen) instead races during the\n// publish window: codegen@dev.N can be tagged before ph-cli@dev.N exists, so\n// pinning every workspace dep to that version makes `pnpm i` fail with\n// ERR_PNPM_NO_MATCHING_VERSION. This matches the anchor the ph-cli migrate\n// command already uses (clis/ph-cli/src/services/migrate.ts).\nconst VERSION_ANCHOR_PACKAGE = \"@powerhousedao/ph-cli\";\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 anchorPackageName =\n WORKSPACE_PACKAGES.find(\n (pkg) => pkg.manifest.name === VERSION_ANCHOR_PACKAGE,\n )?.manifest.name ?? WORKSPACE_PACKAGES[0].manifest.name!;\n const result = (await npmFetch.json(anchorPackageName)) as {\n \"dist-tags\": Record<\"latest\" | \"staging\" | \"dev\", string>;\n };\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, ...LEGACY_LINT_FORMAT_DEPENDENCIES]),\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, ...LEGACY_LINT_FORMAT_DEPENDENCIES]),\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(\"Removing legacy lint/format config files...\");\n removeLegacyLintFormatFiles(projectDir);\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\nfunction removeLegacyLintFormatFiles(projectDir: string) {\n for (const name of LEGACY_LINT_FORMAT_FILES) {\n rmSync(join(projectDir, name), { force: true });\n }\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 { runOxfmt } from \"utils\";\nimport {\n applyProjectCustomizations,\n writeAllGeneratedProjectFiles,\n writeProjectRootFiles,\n} from \"file-builders\";\n\n// Install recipes for `--clone`. Only managers with a cache-miss-fails\n// offline mode are listed; yarn needs an opt-in offline mirror and bun has\n// no real offline mode (https://github.com/oven-sh/bun/issues/7956).\ntype CloneRecipe = { lockfile: string; install: string };\nconst CLONE_RECIPES: Record<string, CloneRecipe | undefined> = {\n pnpm: {\n lockfile: \"pnpm-lock.yaml\",\n install: \"pnpm install --frozen-lockfile --offline\",\n },\n npm: {\n lockfile: \"package-lock.json\",\n install: \"npm ci --offline\",\n },\n};\n\ntype CreateProjectArgs = {\n name: string;\n packageManager: string;\n tag?: string;\n version?: string;\n remoteDrive?: string;\n skipGitInit?: boolean;\n skipInstall?: boolean;\n /**\n * Path to an existing scaffolded project to clone instead of generating +\n * resolving deps from scratch. The clone's source + pnpm-lock.yaml are\n * copied (node_modules is not — it's rebuilt from the lockfile via the warm\n * pnpm store with `pnpm install --frozen-lockfile --offline`). Requires\n * packageManager === \"pnpm\".\n */\n clone?: string;\n};\nexport async function createProject({\n name,\n packageManager,\n tag,\n version,\n remoteDrive,\n skipGitInit,\n skipInstall,\n clone,\n}: CreateProjectArgs) {\n const appPath = path.join(process.cwd(), name);\n\n if (fs.existsSync(appPath)) {\n throw new Error(\n `⛔ The folder \"${name}\" already exists in the current directory, please give it another name.`,\n );\n }\n\n if (clone) {\n await createProjectFromClone({\n name,\n appPath,\n clone,\n packageManager,\n skipGitInit,\n skipInstall,\n remoteDrive,\n });\n return;\n }\n\n // Create a new directory for the project\n console.log(chalk.blue(`▶️ Creating directory for project \"${name}\"...\\n`));\n fs.mkdirSync(appPath);\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 `oxfmt` to format the generated code\n console.log(chalk.blue(`▶️ Formatting boilerplate project files...\\n`));\n await runOxfmt();\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}\n\n/**\n * Fast path for `ph init --clone <path>`: copy an already-scaffolded project's\n * source + lockfile (NOT node_modules), re-apply the per-project\n * customizations, then rebuild node_modules with\n * `pnpm install --frozen-lockfile --offline`. pnpm materializes the tree from\n * the warm store via clone/hardlink — far faster and ~0 extra disk vs a fresh\n * resolve+install, and the lockfile guarantees an identical dependency set.\n * Requires the cloned project's packages to be present in the local pnpm\n * store (which is the case in an image where the source was scaffolded at\n * build).\n */\nasync function createProjectFromClone(args: {\n name: string;\n appPath: string;\n clone: string;\n packageManager: string;\n skipGitInit?: boolean;\n skipInstall?: boolean;\n remoteDrive?: string;\n}) {\n const {\n name,\n appPath,\n clone,\n packageManager,\n skipGitInit,\n skipInstall,\n remoteDrive,\n } = args;\n // --clone needs a package manager with a hard-offline install mode that\n // refuses to hit the network on a cache miss. pnpm and npm qualify; yarn\n // and bun do not (bun has no offline flag at all — cache misses silently\n // re-fetch).\n const recipe = CLONE_RECIPES[packageManager];\n if (!recipe) {\n throw new Error(\n `⛔ --clone is only compatible with --pnpm or --npm (got \"${packageManager}\").`,\n );\n }\n const clonePath = path.resolve(process.cwd(), clone);\n if (!fs.existsSync(clonePath) || !fs.statSync(clonePath).isDirectory()) {\n throw new Error(\n `⛔ Clone source \"${clone}\" not found (resolved to \"${clonePath}\"). Pass a path to an existing scaffolded project.`,\n );\n }\n if (!fs.existsSync(path.join(clonePath, recipe.lockfile))) {\n throw new Error(\n `⛔ Clone source \"${clone}\" has no ${recipe.lockfile}. --clone with --${packageManager} requires a committed lockfile.`,\n );\n }\n\n // Copy source + lockfile only; node_modules is rebuilt from the store below,\n // and the source's .git is irrelevant (we re-init fresh).\n console.log(chalk.blue(`▶️ Cloning project from \"${clone}\"...\\n`));\n fs.cpSync(clonePath, appPath, {\n recursive: true,\n filter: (src) => {\n const base = path.basename(src);\n // Skip deps (rebuilt from the lockfile), git history (re-init'd), and\n // build artifacts (regenerated) so the new project starts clean.\n return (\n base !== \"node_modules\" &&\n base !== \".git\" &&\n base !== \"dist\" &&\n !base.endsWith(\".tsbuildinfo\")\n );\n },\n });\n console.log(chalk.green(`✅ Project files cloned\\n`));\n\n if (!skipGitInit) {\n console.log(chalk.blue(`▶️ Initializing git repository...\\n`));\n runCmd(`git init`, { cwd: appPath });\n console.log(chalk.green(`\\n✅ Git repository initialized\\n`));\n }\n\n console.log(chalk.blue(`▶️ Applying project customizations...\\n`));\n await applyProjectCustomizations({ name, projectDir: appPath, remoteDrive });\n console.log(chalk.green(`✅ Project customizations applied\\n`));\n\n if (!skipInstall) {\n // Rebuild node_modules from the lockfile, offline, via the warm cache.\n console.log(\n chalk.blue(`▶️ Installing dependencies from lockfile (offline)...\\n`),\n );\n runCmd(recipe.install, { cwd: appPath });\n console.log(chalk.green(`\\n✅ Dependencies installed from lockfile\\n`));\n }\n\n console.log(\n chalk.bold(`🎉 Successfully cloned project \"${name}\" from \"${clone}\" 🎉\\n`),\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 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,MAA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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,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","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 LEGACY_LINT_FORMAT_DEPENDENCIES,\n LEGACY_LINT_FORMAT_FILES,\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// Anchor dist-tag resolution to ph-cli. Releases publish in topological order\n// (releaseGraph), so ph-cli — a top-level consumer — is published *after* its\n// workspace dependencies, and a dist-tag only moves once that package is\n// published. Resolving the tag against ph-cli therefore yields a version whose\n// entire workspace dependency closure is already on the registry. Anchoring to\n// an arbitrary `WORKSPACE_PACKAGES[0]` (e.g. codegen) instead races during the\n// publish window: codegen@dev.N can be tagged before ph-cli@dev.N exists, so\n// pinning every workspace dep to that version makes `pnpm i` fail with\n// ERR_PNPM_NO_MATCHING_VERSION. This matches the anchor the ph-cli migrate\n// command already uses (clis/ph-cli/src/services/migrate.ts).\nconst VERSION_ANCHOR_PACKAGE = \"@powerhousedao/ph-cli\";\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 anchorPackageName =\n WORKSPACE_PACKAGES.find(\n (pkg) => pkg.manifest.name === VERSION_ANCHOR_PACKAGE,\n )?.manifest.name ?? WORKSPACE_PACKAGES[0].manifest.name!;\n const result = (await npmFetch.json(anchorPackageName)) as {\n \"dist-tags\": Record<\"latest\" | \"staging\" | \"dev\", string>;\n };\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, ...LEGACY_LINT_FORMAT_DEPENDENCIES]),\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, ...LEGACY_LINT_FORMAT_DEPENDENCIES]),\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(\"Removing legacy lint/format config files...\");\n removeLegacyLintFormatFiles(projectDir);\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\nfunction removeLegacyLintFormatFiles(projectDir: string) {\n for (const name of LEGACY_LINT_FORMAT_FILES) {\n rmSync(join(projectDir, name), { force: true });\n }\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 { runOxfmt } from \"utils\";\nimport {\n applyProjectCustomizations,\n writeAllGeneratedProjectFiles,\n writeProjectRootFiles,\n} from \"file-builders\";\n\n// Install recipes for `--clone`. Only managers with a cache-miss-fails\n// offline mode are listed; yarn needs an opt-in offline mirror and bun has\n// no real offline mode (https://github.com/oven-sh/bun/issues/7956).\ntype CloneRecipe = { lockfile: string; install: string };\nconst CLONE_RECIPES: Record<string, CloneRecipe | undefined> = {\n pnpm: {\n lockfile: \"pnpm-lock.yaml\",\n install: \"pnpm install --frozen-lockfile --offline\",\n },\n npm: {\n lockfile: \"package-lock.json\",\n install: \"npm ci --offline\",\n },\n};\n\ntype CreateProjectArgs = {\n name: string;\n packageManager: string;\n tag?: string;\n version?: string;\n remoteDrive?: string;\n skipGitInit?: boolean;\n skipInstall?: boolean;\n /**\n * Path to an existing scaffolded project to clone instead of generating +\n * resolving deps from scratch. The clone's source + pnpm-lock.yaml are\n * copied (node_modules is not — it's rebuilt from the lockfile via the warm\n * pnpm store with `pnpm install --frozen-lockfile --offline`). Requires\n * packageManager === \"pnpm\".\n */\n clone?: string;\n};\nexport async function createProject({\n name,\n packageManager,\n tag,\n version,\n remoteDrive,\n skipGitInit,\n skipInstall,\n clone,\n}: CreateProjectArgs) {\n const appPath = path.join(process.cwd(), name);\n\n if (fs.existsSync(appPath)) {\n throw new Error(\n `⛔ The folder \"${name}\" already exists in the current directory, please give it another name.`,\n );\n }\n\n if (clone) {\n await createProjectFromClone({\n name,\n appPath,\n clone,\n packageManager,\n skipGitInit,\n skipInstall,\n remoteDrive,\n });\n return;\n }\n\n // Create a new directory for the project\n console.log(chalk.blue(`▶️ Creating directory for project \"${name}\"...\\n`));\n fs.mkdirSync(appPath);\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 `oxfmt` to format the generated code\n console.log(chalk.blue(`▶️ Formatting boilerplate project files...\\n`));\n await runOxfmt();\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}\n\n/**\n * Fast path for `ph init --clone <path>`: copy an already-scaffolded project's\n * source + lockfile (NOT node_modules), re-apply the per-project\n * customizations, then rebuild node_modules with\n * `pnpm install --frozen-lockfile --offline`. pnpm materializes the tree from\n * the warm store via clone/hardlink — far faster and ~0 extra disk vs a fresh\n * resolve+install, and the lockfile guarantees an identical dependency set.\n * Requires the cloned project's packages to be present in the local pnpm\n * store (which is the case in an image where the source was scaffolded at\n * build).\n */\nasync function createProjectFromClone(args: {\n name: string;\n appPath: string;\n clone: string;\n packageManager: string;\n skipGitInit?: boolean;\n skipInstall?: boolean;\n remoteDrive?: string;\n}) {\n const {\n name,\n appPath,\n clone,\n packageManager,\n skipGitInit,\n skipInstall,\n remoteDrive,\n } = args;\n // --clone needs a package manager with a hard-offline install mode that\n // refuses to hit the network on a cache miss. pnpm and npm qualify; yarn\n // and bun do not (bun has no offline flag at all — cache misses silently\n // re-fetch).\n const recipe = CLONE_RECIPES[packageManager];\n if (!recipe) {\n throw new Error(\n `⛔ --clone is only compatible with --pnpm or --npm (got \"${packageManager}\").`,\n );\n }\n const clonePath = path.resolve(process.cwd(), clone);\n if (!fs.existsSync(clonePath) || !fs.statSync(clonePath).isDirectory()) {\n throw new Error(\n `⛔ Clone source \"${clone}\" not found (resolved to \"${clonePath}\"). Pass a path to an existing scaffolded project.`,\n );\n }\n if (!fs.existsSync(path.join(clonePath, recipe.lockfile))) {\n throw new Error(\n `⛔ Clone source \"${clone}\" has no ${recipe.lockfile}. --clone with --${packageManager} requires a committed lockfile.`,\n );\n }\n\n // Copy source + lockfile only; node_modules is rebuilt from the store below,\n // and the source's .git is irrelevant (we re-init fresh).\n console.log(chalk.blue(`▶️ Cloning project from \"${clone}\"...\\n`));\n fs.cpSync(clonePath, appPath, {\n recursive: true,\n filter: (src) => {\n const base = path.basename(src);\n // Skip deps (rebuilt from the lockfile), git history (re-init'd), and\n // build artifacts (regenerated) so the new project starts clean.\n return (\n base !== \"node_modules\" &&\n base !== \".git\" &&\n base !== \"dist\" &&\n !base.endsWith(\".tsbuildinfo\")\n );\n },\n });\n console.log(chalk.green(`✅ Project files cloned\\n`));\n\n if (!skipGitInit) {\n console.log(chalk.blue(`▶️ Initializing git repository...\\n`));\n runCmd(`git init`, { cwd: appPath });\n console.log(chalk.green(`\\n✅ Git repository initialized\\n`));\n }\n\n console.log(chalk.blue(`▶️ Applying project customizations...\\n`));\n await applyProjectCustomizations({ name, projectDir: appPath, remoteDrive });\n console.log(chalk.green(`✅ Project customizations applied\\n`));\n\n if (!skipInstall) {\n // Rebuild node_modules from the lockfile, offline, via the warm cache.\n console.log(\n chalk.blue(`▶️ Installing dependencies from lockfile (offline)...\\n`),\n );\n runCmd(recipe.install, { cwd: appPath });\n console.log(chalk.green(`\\n✅ Dependencies installed from lockfile\\n`));\n }\n\n console.log(\n chalk.bold(`🎉 Successfully cloned project \"${name}\" from \"${clone}\" 🎉\\n`),\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 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,CA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 -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerhousedao/codegen",
3
- "version": "6.2.0-rc.2",
3
+ "version": "6.2.0-rc.3",
4
4
  "license": "AGPL-3.0-only",
5
5
  "private": false,
6
6
  "type": "module",
@@ -54,8 +54,8 @@
54
54
  "write-json-file": "^7.0.0",
55
55
  "write-package": "7.2.0",
56
56
  "zod": "4.3.6",
57
- "@powerhousedao/shared": "6.2.0-rc.2",
58
- "document-model": "6.2.0-rc.2"
57
+ "@powerhousedao/shared": "6.2.0-rc.3",
58
+ "document-model": "6.2.0-rc.3"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@pnpm/find-workspace-dir": "^1000.1.5",