@powerhousedao/codegen 6.0.0-dev.11 → 6.0.0-dev.111

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (470) hide show
  1. package/dist/src/codegen/__tests__/config.d.ts +0 -1
  2. package/dist/src/codegen/__tests__/config.d.ts.map +1 -1
  3. package/dist/src/codegen/__tests__/config.js +0 -1
  4. package/dist/src/codegen/__tests__/config.js.map +1 -1
  5. package/dist/src/codegen/__tests__/fixtures/typecheck.js +1 -1
  6. package/dist/src/codegen/__tests__/fixtures/typecheck.js.map +1 -1
  7. package/dist/src/codegen/__tests__/generate-doc-model.test.js +162 -212
  8. package/dist/src/codegen/__tests__/generate-doc-model.test.js.map +1 -1
  9. package/dist/src/codegen/__tests__/generate-drive-editor.test.js +70 -49
  10. package/dist/src/codegen/__tests__/generate-drive-editor.test.js.map +1 -1
  11. package/dist/src/codegen/__tests__/generate-editor.test.js +27 -27
  12. package/dist/src/codegen/__tests__/generate-editor.test.js.map +1 -1
  13. package/dist/src/codegen/__tests__/generate-manifest.test.js +17 -16
  14. package/dist/src/codegen/__tests__/generate-manifest.test.js.map +1 -1
  15. package/dist/src/codegen/__tests__/generate-processor.test.d.ts +2 -0
  16. package/dist/src/codegen/__tests__/generate-processor.test.d.ts.map +1 -0
  17. package/dist/src/codegen/__tests__/generate-processor.test.js +295 -0
  18. package/dist/src/codegen/__tests__/generate-processor.test.js.map +1 -0
  19. package/dist/src/codegen/__tests__/generate-subgraph.test.d.ts +2 -0
  20. package/dist/src/codegen/__tests__/generate-subgraph.test.d.ts.map +1 -0
  21. package/dist/src/codegen/__tests__/generate-subgraph.test.js +197 -0
  22. package/dist/src/codegen/__tests__/generate-subgraph.test.js.map +1 -0
  23. package/dist/src/codegen/__tests__/global-setup.d.ts +1 -1
  24. package/dist/src/codegen/__tests__/global-setup.d.ts.map +1 -1
  25. package/dist/src/codegen/__tests__/global-setup.js +3 -15
  26. package/dist/src/codegen/__tests__/global-setup.js.map +1 -1
  27. package/dist/src/codegen/__tests__/ts-morph-generator.test.js +4 -4
  28. package/dist/src/codegen/__tests__/ts-morph-generator.test.js.map +1 -1
  29. package/dist/src/codegen/__tests__/utils.d.ts +2 -2
  30. package/dist/src/codegen/__tests__/utils.d.ts.map +1 -1
  31. package/dist/src/codegen/__tests__/utils.js +11 -12
  32. package/dist/src/codegen/__tests__/utils.js.map +1 -1
  33. package/dist/src/codegen/generate.d.ts +25 -19
  34. package/dist/src/codegen/generate.d.ts.map +1 -1
  35. package/dist/src/codegen/generate.js +68 -113
  36. package/dist/src/codegen/generate.js.map +1 -1
  37. package/dist/src/codegen/graphql.d.ts +1 -1
  38. package/dist/src/codegen/graphql.d.ts.map +1 -1
  39. package/dist/src/codegen/graphql.js +15 -9
  40. package/dist/src/codegen/graphql.js.map +1 -1
  41. package/dist/src/codegen/index.d.ts +0 -1
  42. package/dist/src/codegen/index.d.ts.map +1 -1
  43. package/dist/src/codegen/index.js +0 -1
  44. package/dist/src/codegen/index.js.map +1 -1
  45. package/dist/src/codegen/utils.d.ts +2 -2
  46. package/dist/src/codegen/utils.d.ts.map +1 -1
  47. package/dist/src/codegen/utils.js +3 -2
  48. package/dist/src/codegen/utils.js.map +1 -1
  49. package/dist/src/create-lib/create-project.d.ts.map +1 -1
  50. package/dist/src/create-lib/create-project.js +15 -2
  51. package/dist/src/create-lib/create-project.js.map +1 -1
  52. package/dist/src/file-builders/boilerplate/build-package-json.test.js +4 -1
  53. package/dist/src/file-builders/boilerplate/build-package-json.test.js.map +1 -1
  54. package/dist/src/file-builders/boilerplate/ci-templates.test.d.ts +2 -0
  55. package/dist/src/file-builders/boilerplate/ci-templates.test.d.ts.map +1 -0
  56. package/dist/src/file-builders/boilerplate/ci-templates.test.js +114 -0
  57. package/dist/src/file-builders/boilerplate/ci-templates.test.js.map +1 -0
  58. package/dist/src/file-builders/boilerplate/package.json.js +1 -1
  59. package/dist/src/file-builders/boilerplate/package.json.js.map +1 -1
  60. package/dist/src/file-builders/clis/generate-cli-docs.d.ts +17 -0
  61. package/dist/src/file-builders/clis/generate-cli-docs.d.ts.map +1 -0
  62. package/dist/src/file-builders/clis/generate-cli-docs.js +36 -0
  63. package/dist/src/file-builders/clis/generate-cli-docs.js.map +1 -0
  64. package/dist/src/file-builders/document-editor.d.ts +1 -1
  65. package/dist/src/file-builders/document-editor.d.ts.map +1 -1
  66. package/dist/src/file-builders/document-editor.js +9 -7
  67. package/dist/src/file-builders/document-editor.js.map +1 -1
  68. package/dist/src/file-builders/document-model/document-model.d.ts +1 -1
  69. package/dist/src/file-builders/document-model/document-model.d.ts.map +1 -1
  70. package/dist/src/file-builders/document-model/document-model.js +67 -65
  71. package/dist/src/file-builders/document-model/document-model.js.map +1 -1
  72. package/dist/src/file-builders/document-model/gen-dir.d.ts +1 -1
  73. package/dist/src/file-builders/document-model/gen-dir.d.ts.map +1 -1
  74. package/dist/src/file-builders/document-model/gen-dir.js +67 -58
  75. package/dist/src/file-builders/document-model/gen-dir.js.map +1 -1
  76. package/dist/src/file-builders/document-model/migrate-legacy.d.ts +19 -0
  77. package/dist/src/file-builders/document-model/migrate-legacy.d.ts.map +1 -0
  78. package/dist/src/file-builders/document-model/migrate-legacy.js +104 -0
  79. package/dist/src/file-builders/document-model/migrate-legacy.js.map +1 -0
  80. package/dist/src/file-builders/document-model/root-dir.d.ts +1 -1
  81. package/dist/src/file-builders/document-model/root-dir.d.ts.map +1 -1
  82. package/dist/src/file-builders/document-model/root-dir.js +17 -17
  83. package/dist/src/file-builders/document-model/root-dir.js.map +1 -1
  84. package/dist/src/file-builders/document-model/src-dir.d.ts +1 -1
  85. package/dist/src/file-builders/document-model/src-dir.d.ts.map +1 -1
  86. package/dist/src/file-builders/document-model/src-dir.js +78 -19
  87. package/dist/src/file-builders/document-model/src-dir.js.map +1 -1
  88. package/dist/src/file-builders/document-model/tests-dir.d.ts +1 -1
  89. package/dist/src/file-builders/document-model/tests-dir.d.ts.map +1 -1
  90. package/dist/src/file-builders/document-model/tests-dir.js +11 -11
  91. package/dist/src/file-builders/document-model/tests-dir.js.map +1 -1
  92. package/dist/src/file-builders/document-model/upgrades-dir.d.ts +6 -4
  93. package/dist/src/file-builders/document-model/upgrades-dir.d.ts.map +1 -1
  94. package/dist/src/file-builders/document-model/upgrades-dir.js +19 -27
  95. package/dist/src/file-builders/document-model/upgrades-dir.js.map +1 -1
  96. package/dist/src/file-builders/drive-editor.d.ts +1 -1
  97. package/dist/src/file-builders/drive-editor.d.ts.map +1 -1
  98. package/dist/src/file-builders/drive-editor.js +37 -35
  99. package/dist/src/file-builders/drive-editor.js.map +1 -1
  100. package/dist/src/file-builders/editor-common.d.ts.map +1 -1
  101. package/dist/src/file-builders/editor-common.js +0 -1
  102. package/dist/src/file-builders/editor-common.js.map +1 -1
  103. package/dist/src/file-builders/index.d.ts +2 -0
  104. package/dist/src/file-builders/index.d.ts.map +1 -1
  105. package/dist/src/file-builders/index.js +2 -0
  106. package/dist/src/file-builders/index.js.map +1 -1
  107. package/dist/src/file-builders/module-files.d.ts +11 -5
  108. package/dist/src/file-builders/module-files.d.ts.map +1 -1
  109. package/dist/src/file-builders/module-files.js +37 -28
  110. package/dist/src/file-builders/module-files.js.map +1 -1
  111. package/dist/src/file-builders/processors/analytics.d.ts +3 -0
  112. package/dist/src/file-builders/processors/analytics.d.ts.map +1 -0
  113. package/dist/src/file-builders/processors/analytics.js +35 -0
  114. package/dist/src/file-builders/processors/analytics.js.map +1 -0
  115. package/dist/src/file-builders/processors/processor.d.ts +9 -0
  116. package/dist/src/file-builders/processors/processor.d.ts.map +1 -0
  117. package/dist/src/file-builders/processors/processor.js +142 -0
  118. package/dist/src/file-builders/processors/processor.js.map +1 -0
  119. package/dist/src/file-builders/processors/relational-db.d.ts +3 -0
  120. package/dist/src/file-builders/processors/relational-db.d.ts.map +1 -0
  121. package/dist/src/file-builders/processors/relational-db.js +53 -0
  122. package/dist/src/file-builders/processors/relational-db.js.map +1 -0
  123. package/dist/src/file-builders/processors/types.d.ts +13 -0
  124. package/dist/src/file-builders/processors/types.d.ts.map +1 -0
  125. package/dist/src/file-builders/processors/types.js +2 -0
  126. package/dist/src/file-builders/processors/types.js.map +1 -0
  127. package/dist/src/file-builders/subgraph.d.ts +10 -0
  128. package/dist/src/file-builders/subgraph.d.ts.map +1 -0
  129. package/dist/src/file-builders/subgraph.js +121 -0
  130. package/dist/src/file-builders/subgraph.js.map +1 -0
  131. package/dist/src/file-builders/subgraphs.d.ts +1 -1
  132. package/dist/src/file-builders/subgraphs.d.ts.map +1 -1
  133. package/dist/src/file-builders/subgraphs.js +2 -2
  134. package/dist/src/file-builders/subgraphs.js.map +1 -1
  135. package/dist/src/file-builders/types.d.ts +20 -1
  136. package/dist/src/file-builders/types.d.ts.map +1 -1
  137. package/dist/src/name-builders/get-variable-names.d.ts +5 -4
  138. package/dist/src/name-builders/get-variable-names.d.ts.map +1 -1
  139. package/dist/src/name-builders/get-variable-names.js +6 -4
  140. package/dist/src/name-builders/get-variable-names.js.map +1 -1
  141. package/dist/src/templates/boilerplate/AGENTS.md.d.ts.map +1 -1
  142. package/dist/src/templates/boilerplate/AGENTS.md.js +138 -9
  143. package/dist/src/templates/boilerplate/AGENTS.md.js.map +1 -1
  144. package/dist/src/templates/boilerplate/CLAUDE.md.d.ts +1 -1
  145. package/dist/src/templates/boilerplate/CLAUDE.md.d.ts.map +1 -1
  146. package/dist/src/templates/boilerplate/CLAUDE.md.js +1 -407
  147. package/dist/src/templates/boilerplate/CLAUDE.md.js.map +1 -1
  148. package/dist/src/templates/boilerplate/docker/Dockerfile.d.ts +2 -0
  149. package/dist/src/templates/boilerplate/docker/Dockerfile.d.ts.map +1 -0
  150. package/dist/src/templates/boilerplate/docker/Dockerfile.js +144 -0
  151. package/dist/src/templates/boilerplate/docker/Dockerfile.js.map +1 -0
  152. package/dist/src/templates/boilerplate/docker/connect-entrypoint.sh.d.ts +2 -0
  153. package/dist/src/templates/boilerplate/docker/connect-entrypoint.sh.d.ts.map +1 -0
  154. package/dist/src/templates/boilerplate/docker/connect-entrypoint.sh.js +18 -0
  155. package/dist/src/templates/boilerplate/docker/connect-entrypoint.sh.js.map +1 -0
  156. package/dist/src/templates/boilerplate/docker/nginx.conf.d.ts +2 -0
  157. package/dist/src/templates/boilerplate/docker/nginx.conf.d.ts.map +1 -0
  158. package/dist/src/templates/boilerplate/docker/nginx.conf.js +79 -0
  159. package/dist/src/templates/boilerplate/docker/nginx.conf.js.map +1 -0
  160. package/dist/src/templates/boilerplate/docker/switchboard-entrypoint.sh.d.ts +2 -0
  161. package/dist/src/templates/boilerplate/docker/switchboard-entrypoint.sh.d.ts.map +1 -0
  162. package/dist/src/templates/boilerplate/docker/switchboard-entrypoint.sh.js +19 -0
  163. package/dist/src/templates/boilerplate/docker/switchboard-entrypoint.sh.js.map +1 -0
  164. package/dist/src/templates/boilerplate/document-models/document-models.js +1 -1
  165. package/dist/src/templates/boilerplate/document-models/upgrade-manifests.d.ts +2 -0
  166. package/dist/src/templates/boilerplate/document-models/upgrade-manifests.d.ts.map +1 -0
  167. package/dist/src/templates/boilerplate/document-models/upgrade-manifests.js +7 -0
  168. package/dist/src/templates/boilerplate/document-models/upgrade-manifests.js.map +1 -0
  169. package/dist/src/templates/boilerplate/editors/editors.js +1 -1
  170. package/dist/src/templates/boilerplate/github/sync-and-publish.yml.d.ts +2 -0
  171. package/dist/src/templates/boilerplate/github/sync-and-publish.yml.d.ts.map +1 -0
  172. package/dist/src/templates/boilerplate/github/sync-and-publish.yml.js +376 -0
  173. package/dist/src/templates/boilerplate/github/sync-and-publish.yml.js.map +1 -0
  174. package/dist/src/templates/boilerplate/index.d.ts.map +1 -1
  175. package/dist/src/templates/boilerplate/index.html.d.ts.map +1 -1
  176. package/dist/src/templates/boilerplate/index.html.js +2 -7
  177. package/dist/src/templates/boilerplate/index.html.js.map +1 -1
  178. package/dist/src/templates/boilerplate/index.js +4 -1
  179. package/dist/src/templates/boilerplate/index.js.map +1 -1
  180. package/dist/src/templates/boilerplate/main.tsx.d.ts +2 -0
  181. package/dist/src/templates/boilerplate/main.tsx.d.ts.map +1 -0
  182. package/dist/src/templates/boilerplate/main.tsx.js +8 -0
  183. package/dist/src/templates/boilerplate/main.tsx.js.map +1 -0
  184. package/dist/src/templates/boilerplate/package.json.d.ts.map +1 -1
  185. package/dist/src/templates/boilerplate/package.json.js +14 -5
  186. package/dist/src/templates/boilerplate/package.json.js.map +1 -1
  187. package/dist/src/templates/boilerplate/powerhouse.config.json.js +2 -2
  188. package/dist/src/templates/boilerplate/powerhouse.config.json.js.map +1 -1
  189. package/dist/src/templates/boilerplate/style.css.d.ts.map +1 -1
  190. package/dist/src/templates/boilerplate/style.css.js +1 -0
  191. package/dist/src/templates/boilerplate/style.css.js.map +1 -1
  192. package/dist/src/templates/boilerplate/tsconfig.json.d.ts.map +1 -1
  193. package/dist/src/templates/boilerplate/tsconfig.json.js +0 -1
  194. package/dist/src/templates/boilerplate/tsconfig.json.js.map +1 -1
  195. package/dist/src/templates/cli-docs/docs-from-cli-help.d.ts +8 -0
  196. package/dist/src/templates/cli-docs/docs-from-cli-help.d.ts.map +1 -0
  197. package/dist/src/templates/cli-docs/docs-from-cli-help.js +86 -0
  198. package/dist/src/templates/cli-docs/docs-from-cli-help.js.map +1 -0
  199. package/dist/src/templates/document-editor/editor.js +1 -1
  200. package/dist/src/templates/document-editor/module.js +1 -1
  201. package/dist/src/templates/document-model/actions.d.ts.map +1 -1
  202. package/dist/src/templates/document-model/actions.js +11 -11
  203. package/dist/src/templates/document-model/actions.js.map +1 -1
  204. package/dist/src/templates/document-model/gen/actions.js +5 -5
  205. package/dist/src/templates/document-model/gen/controller.d.ts +3 -0
  206. package/dist/src/templates/document-model/gen/controller.d.ts.map +1 -0
  207. package/dist/src/templates/document-model/gen/controller.js +12 -0
  208. package/dist/src/templates/document-model/gen/controller.js.map +1 -0
  209. package/dist/src/templates/document-model/gen/creators.d.ts.map +1 -1
  210. package/dist/src/templates/document-model/gen/creators.js +11 -8
  211. package/dist/src/templates/document-model/gen/creators.js.map +1 -1
  212. package/dist/src/templates/document-model/gen/document-schema.js +1 -1
  213. package/dist/src/templates/document-model/gen/index.d.ts.map +1 -1
  214. package/dist/src/templates/document-model/gen/index.js +3 -2
  215. package/dist/src/templates/document-model/gen/index.js.map +1 -1
  216. package/dist/src/templates/document-model/gen/modules/creators.js +1 -1
  217. package/dist/src/templates/document-model/gen/modules/error.d.ts.map +1 -1
  218. package/dist/src/templates/document-model/gen/modules/error.js +8 -2
  219. package/dist/src/templates/document-model/gen/modules/error.js.map +1 -1
  220. package/dist/src/templates/document-model/gen/ph-factories.js +5 -5
  221. package/dist/src/templates/document-model/gen/ph-factories.js.map +1 -1
  222. package/dist/src/templates/document-model/gen/reducer.d.ts.map +1 -1
  223. package/dist/src/templates/document-model/gen/reducer.js +6 -7
  224. package/dist/src/templates/document-model/gen/reducer.js.map +1 -1
  225. package/dist/src/templates/document-model/gen/utils.d.ts.map +1 -1
  226. package/dist/src/templates/document-model/gen/utils.js +4 -17
  227. package/dist/src/templates/document-model/gen/utils.js.map +1 -1
  228. package/dist/src/templates/document-model/module.d.ts +1 -2
  229. package/dist/src/templates/document-model/module.d.ts.map +1 -1
  230. package/dist/src/templates/document-model/module.js +9 -12
  231. package/dist/src/templates/document-model/module.js.map +1 -1
  232. package/dist/src/templates/document-model/tests/document-model.test.d.ts.map +1 -0
  233. package/dist/src/templates/document-model/tests/document-model.test.js.map +1 -0
  234. package/dist/src/templates/document-model/tests/module.test.d.ts.map +1 -0
  235. package/dist/src/templates/document-model/{src/tests → tests}/module.test.js +1 -1
  236. package/dist/src/templates/document-model/tests/module.test.js.map +1 -0
  237. package/dist/src/templates/document-model/upgrades/upgrade-manifest.d.ts +5 -0
  238. package/dist/src/templates/document-model/upgrades/upgrade-manifest.d.ts.map +1 -0
  239. package/dist/src/templates/document-model/upgrades/upgrade-manifest.js +13 -0
  240. package/dist/src/templates/document-model/upgrades/upgrade-manifest.js.map +1 -0
  241. package/dist/src/templates/document-model/upgrades/upgrade-transition.js +1 -1
  242. package/dist/src/templates/document-model/utils.js +2 -2
  243. package/dist/src/templates/document-model/utils.js.map +1 -1
  244. package/dist/src/templates/drive-editor/components/DriveExplorer.js +1 -1
  245. package/dist/src/templates/drive-editor/components/FolderTree.js +1 -1
  246. package/dist/src/templates/drive-editor/editor.d.ts.map +1 -1
  247. package/dist/src/templates/drive-editor/editor.js +4 -2
  248. package/dist/src/templates/drive-editor/editor.js.map +1 -1
  249. package/dist/src/templates/index.d.ts +20 -3
  250. package/dist/src/templates/index.d.ts.map +1 -1
  251. package/dist/src/templates/index.js +20 -3
  252. package/dist/src/templates/index.js.map +1 -1
  253. package/dist/src/templates/processors/analytics/factory.d.ts +6 -0
  254. package/dist/src/templates/processors/analytics/factory.d.ts.map +1 -0
  255. package/dist/src/templates/processors/analytics/factory.js +26 -0
  256. package/dist/src/templates/processors/analytics/factory.js.map +1 -0
  257. package/dist/src/templates/processors/analytics/index.d.ts +4 -0
  258. package/dist/src/templates/processors/analytics/index.d.ts.map +1 -0
  259. package/dist/src/templates/processors/analytics/index.js +34 -0
  260. package/dist/src/templates/processors/analytics/index.js.map +1 -0
  261. package/dist/src/templates/processors/factory.d.ts +2 -0
  262. package/dist/src/templates/processors/factory.d.ts.map +1 -0
  263. package/dist/src/templates/processors/factory.js +60 -0
  264. package/dist/src/templates/processors/factory.js.map +1 -0
  265. package/dist/src/templates/processors/index.d.ts +2 -0
  266. package/dist/src/templates/processors/index.d.ts.map +1 -0
  267. package/dist/src/templates/processors/index.js +10 -0
  268. package/dist/src/templates/processors/index.js.map +1 -0
  269. package/dist/src/templates/processors/relational-db/factory.d.ts +6 -0
  270. package/dist/src/templates/processors/relational-db/factory.d.ts.map +1 -0
  271. package/dist/src/templates/processors/relational-db/factory.js +40 -0
  272. package/dist/src/templates/processors/relational-db/factory.js.map +1 -0
  273. package/dist/src/templates/processors/relational-db/index.d.ts +4 -0
  274. package/dist/src/templates/processors/relational-db/index.d.ts.map +1 -0
  275. package/dist/src/templates/processors/relational-db/index.js +28 -0
  276. package/dist/src/templates/processors/relational-db/index.js.map +1 -0
  277. package/dist/src/templates/processors/relational-db/migrations.d.ts +2 -0
  278. package/dist/src/templates/processors/relational-db/migrations.d.ts.map +1 -0
  279. package/dist/src/{codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/migrations.esm.t → templates/processors/relational-db/migrations.js} +5 -5
  280. package/dist/src/templates/processors/relational-db/migrations.js.map +1 -0
  281. package/dist/src/templates/processors/relational-db/schema.d.ts +2 -0
  282. package/dist/src/templates/processors/relational-db/schema.d.ts.map +1 -0
  283. package/dist/src/templates/processors/relational-db/schema.js +12 -0
  284. package/dist/src/templates/processors/relational-db/schema.js.map +1 -0
  285. package/dist/src/templates/processors/utils.d.ts +2 -0
  286. package/dist/src/templates/processors/utils.d.ts.map +1 -0
  287. package/dist/src/templates/processors/utils.js +6 -0
  288. package/dist/src/templates/processors/utils.js.map +1 -0
  289. package/dist/src/templates/subgraphs/custom-resolvers.d.ts +5 -0
  290. package/dist/src/templates/subgraphs/custom-resolvers.d.ts.map +1 -0
  291. package/dist/src/templates/subgraphs/custom-resolvers.js +20 -0
  292. package/dist/src/templates/subgraphs/custom-resolvers.js.map +1 -0
  293. package/dist/src/templates/subgraphs/custom-schema.d.ts +5 -0
  294. package/dist/src/templates/subgraphs/custom-schema.d.ts.map +1 -0
  295. package/dist/src/templates/subgraphs/custom-schema.js +20 -0
  296. package/dist/src/templates/subgraphs/custom-schema.js.map +1 -0
  297. package/dist/src/templates/subgraphs/document-model-resolvers.d.ts +15 -0
  298. package/dist/src/templates/subgraphs/document-model-resolvers.d.ts.map +1 -0
  299. package/dist/src/{codegen/.hygen/templates/powerhouse/generate-document-model-subgraph/resolvers.esm.t → templates/subgraphs/document-model-resolvers.js} +55 -47
  300. package/dist/src/templates/subgraphs/document-model-resolvers.js.map +1 -0
  301. package/dist/src/templates/subgraphs/document-model-schema.d.ts +12 -0
  302. package/dist/src/templates/subgraphs/document-model-schema.d.ts.map +1 -0
  303. package/dist/src/templates/subgraphs/document-model-schema.js +54 -0
  304. package/dist/src/templates/subgraphs/document-model-schema.js.map +1 -0
  305. package/dist/src/templates/subgraphs/index-file.d.ts +5 -0
  306. package/dist/src/templates/subgraphs/index-file.d.ts.map +1 -0
  307. package/dist/src/{codegen/.hygen/templates/powerhouse/generate-subgraph/index.esm.t → templates/subgraphs/index-file.js} +7 -7
  308. package/dist/src/templates/subgraphs/index-file.js.map +1 -0
  309. package/dist/src/templates/subgraphs/index.d.ts +7 -0
  310. package/dist/src/templates/subgraphs/index.d.ts.map +1 -0
  311. package/dist/src/templates/subgraphs/index.js +7 -0
  312. package/dist/src/templates/subgraphs/index.js.map +1 -0
  313. package/dist/src/templates/subgraphs/lib-file.d.ts +2 -0
  314. package/dist/src/templates/subgraphs/lib-file.d.ts.map +1 -0
  315. package/dist/src/templates/subgraphs/lib-file.js +8 -0
  316. package/dist/src/templates/subgraphs/lib-file.js.map +1 -0
  317. package/dist/src/ts-morph-generator/__tests__/ReducerGenerator.test.js +4 -4
  318. package/dist/src/ts-morph-generator/core/GenerationContext.d.ts +1 -1
  319. package/dist/src/ts-morph-generator/core/GenerationContext.d.ts.map +1 -1
  320. package/dist/src/ts-morph-generator/core/ReducerGenerator.js +3 -3
  321. package/dist/src/ts-morph-generator/core/TSMorphCodeGenerator.d.ts +1 -1
  322. package/dist/src/ts-morph-generator/core/TSMorphCodeGenerator.d.ts.map +1 -1
  323. package/dist/src/ts-morph-generator/utilities/DirectoryManager.d.ts +1 -1
  324. package/dist/src/ts-morph-generator/utilities/DirectoryManager.d.ts.map +1 -1
  325. package/dist/src/ts-morph-generator/utilities/DirectoryManager.js +5 -5
  326. package/dist/src/ts-morph-generator/utilities/DirectoryManager.js.map +1 -1
  327. package/dist/src/utils/cli.d.ts +0 -6
  328. package/dist/src/utils/cli.d.ts.map +1 -1
  329. package/dist/src/utils/cli.js +0 -18
  330. package/dist/src/utils/cli.js.map +1 -1
  331. package/dist/src/utils/constants.d.ts +0 -2
  332. package/dist/src/utils/constants.d.ts.map +1 -1
  333. package/dist/src/utils/constants.js +0 -18
  334. package/dist/src/utils/constants.js.map +1 -1
  335. package/dist/src/utils/document-type-metadata.d.ts.map +1 -1
  336. package/dist/src/utils/document-type-metadata.js +5 -2
  337. package/dist/src/utils/document-type-metadata.js.map +1 -1
  338. package/dist/src/utils/format-with-prettier.d.ts +1 -1
  339. package/dist/src/utils/format-with-prettier.d.ts.map +1 -1
  340. package/dist/src/utils/format-with-prettier.js +5 -11
  341. package/dist/src/utils/format-with-prettier.js.map +1 -1
  342. package/dist/src/utils/graphql-type-prefixes.d.ts +10 -0
  343. package/dist/src/utils/graphql-type-prefixes.d.ts.map +1 -0
  344. package/dist/src/utils/graphql-type-prefixes.js +51 -0
  345. package/dist/src/utils/graphql-type-prefixes.js.map +1 -0
  346. package/dist/src/utils/index.d.ts +2 -3
  347. package/dist/src/utils/index.d.ts.map +1 -1
  348. package/dist/src/utils/index.js +2 -3
  349. package/dist/src/utils/index.js.map +1 -1
  350. package/dist/src/utils/source-files.d.ts +8 -1
  351. package/dist/src/utils/source-files.d.ts.map +1 -1
  352. package/dist/src/utils/source-files.js +19 -2
  353. package/dist/src/utils/source-files.js.map +1 -1
  354. package/dist/src/utils/syntax-getters.d.ts +2 -1
  355. package/dist/src/utils/syntax-getters.d.ts.map +1 -1
  356. package/dist/src/utils/syntax-getters.js +12 -0
  357. package/dist/src/utils/syntax-getters.js.map +1 -1
  358. package/dist/src/utils/ts-morph-project.d.ts +14 -5
  359. package/dist/src/utils/ts-morph-project.d.ts.map +1 -1
  360. package/dist/src/utils/ts-morph-project.js +12 -12
  361. package/dist/src/utils/ts-morph-project.js.map +1 -1
  362. package/dist/src/utils/validation.d.ts +1 -1
  363. package/dist/src/utils/validation.d.ts.map +1 -1
  364. package/dist/tsconfig.tsbuildinfo +1 -1
  365. package/dist/vitest.config.d.ts.map +1 -1
  366. package/dist/vitest.config.js +4 -0
  367. package/dist/vitest.config.js.map +1 -1
  368. package/package.json +32 -43
  369. package/dist/src/codegen/.hygen/package.json +0 -6
  370. package/dist/src/codegen/.hygen/templates/powerhouse/generate-custom-subgraph/index.js +0 -10
  371. package/dist/src/codegen/.hygen/templates/powerhouse/generate-custom-subgraph/resolvers.esm.t +0 -17
  372. package/dist/src/codegen/.hygen/templates/powerhouse/generate-custom-subgraph/schema.esm.t +0 -16
  373. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/actions.esm.t +0 -16
  374. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/creators.esm.t +0 -9
  375. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/customUtils.esm.t +0 -5
  376. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/document-schema.esm.t +0 -56
  377. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/document-type.esm.t +0 -6
  378. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/documentModel.esm.t +0 -7
  379. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/documentModelTest.esm.t +0 -121
  380. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/hooks.esm.t +0 -49
  381. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/index.esm.t +0 -23
  382. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/index.js +0 -127
  383. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/module.esm.t +0 -22
  384. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/ph-factories.esm.t +0 -93
  385. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/reducer.esm.t +0 -46
  386. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/root-utils.esm.t +0 -11
  387. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/rootActions.esm.t +0 -13
  388. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/rootIndex.esm.t +0 -14
  389. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/schema.esm.t +0 -6
  390. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/src-index.esm.t +0 -5
  391. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/types.esm.t +0 -31
  392. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/utils.esm.t +0 -77
  393. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/actions.esm.t +0 -22
  394. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/creators.esm.t +0 -37
  395. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/customTest.esm.t +0 -44
  396. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/error.esm.t +0 -36
  397. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/index.js +0 -71
  398. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/operations.esm.t +0 -17
  399. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-subgraph/index.js +0 -118
  400. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-subgraph/schema.esm.t +0 -44
  401. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/CreateDocument.esm.t +0 -58
  402. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/DriveContents.esm.t +0 -23
  403. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/DriveExplorer.esm.t +0 -32
  404. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/EmptyState.esm.t +0 -19
  405. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/Files.esm.t +0 -29
  406. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/FolderTree.esm.t +0 -108
  407. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/Folders.esm.t +0 -28
  408. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/NavigationBreadcrumbs.esm.t +0 -14
  409. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/config.esm.t +0 -11
  410. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/editor.esm.t +0 -18
  411. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/index.js +0 -25
  412. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/module.esm.t +0 -15
  413. package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/editor.esm.t +0 -80
  414. package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/index.js +0 -90
  415. package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/module.esm.t +0 -16
  416. package/dist/src/codegen/.hygen/templates/powerhouse/generate-import-script/index.esm.t +0 -59
  417. package/dist/src/codegen/.hygen/templates/powerhouse/generate-import-script/index.js +0 -9
  418. package/dist/src/codegen/.hygen/templates/powerhouse/generate-import-script/utils.esm.t +0 -100
  419. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/factory.esm.t +0 -22
  420. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/index.esm.t +0 -62
  421. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/index.js +0 -12
  422. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/index.root.esm.t +0 -10
  423. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/index.root.inject.esm.t +0 -12
  424. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/lib.esm.t +0 -34
  425. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/lib.inject_call.esm.t +0 -7
  426. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/lib.inject_export.esm.t +0 -7
  427. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/lib.inject_import.esm.t +0 -7
  428. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/factory.esm.t +0 -40
  429. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/index.esm.t +0 -47
  430. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/index.js +0 -12
  431. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/index.root.esm.t +0 -10
  432. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/index.root.inject.esm.t +0 -12
  433. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/lib.esm.t +0 -34
  434. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/lib.inject_call.esm.t +0 -7
  435. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/lib.inject_export.esm.t +0 -9
  436. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/lib.inject_import.esm.t +0 -7
  437. package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/schema.esm.t +0 -13
  438. package/dist/src/codegen/.hygen/templates/powerhouse/generate-subgraph/index.js +0 -10
  439. package/dist/src/codegen/.hygen/templates/powerhouse/generate-subgraph/lib.esm.t +0 -9
  440. package/dist/src/codegen/__tests__/generate-versioned-document-model.test.d.ts +0 -2
  441. package/dist/src/codegen/__tests__/generate-versioned-document-model.test.d.ts.map +0 -1
  442. package/dist/src/codegen/__tests__/generate-versioned-document-model.test.js +0 -159
  443. package/dist/src/codegen/__tests__/generate-versioned-document-model.test.js.map +0 -1
  444. package/dist/src/codegen/hygen.d.ts +0 -47
  445. package/dist/src/codegen/hygen.d.ts.map +0 -1
  446. package/dist/src/codegen/hygen.js +0 -230
  447. package/dist/src/codegen/hygen.js.map +0 -1
  448. package/dist/src/file-builders/boilerplate/package-json-versions.test.d.ts +0 -2
  449. package/dist/src/file-builders/boilerplate/package-json-versions.test.d.ts.map +0 -1
  450. package/dist/src/file-builders/boilerplate/package-json-versions.test.js +0 -34
  451. package/dist/src/file-builders/boilerplate/package-json-versions.test.js.map +0 -1
  452. package/dist/src/templates/boilerplate/processors/index.d.ts +0 -2
  453. package/dist/src/templates/boilerplate/processors/index.d.ts.map +0 -1
  454. package/dist/src/templates/boilerplate/processors/index.js +0 -2
  455. package/dist/src/templates/boilerplate/processors/index.js.map +0 -1
  456. package/dist/src/templates/document-model/src/tests/document-model.test.d.ts.map +0 -1
  457. package/dist/src/templates/document-model/src/tests/document-model.test.js.map +0 -1
  458. package/dist/src/templates/document-model/src/tests/module.test.d.ts.map +0 -1
  459. package/dist/src/templates/document-model/src/tests/module.test.js.map +0 -1
  460. package/dist/src/utils/dependencies.d.ts +0 -12
  461. package/dist/src/utils/dependencies.d.ts.map +0 -1
  462. package/dist/src/utils/dependencies.js +0 -34
  463. package/dist/src/utils/dependencies.js.map +0 -1
  464. package/dist/src/utils/spawn-async.d.ts +0 -5
  465. package/dist/src/utils/spawn-async.d.ts.map +0 -1
  466. package/dist/src/utils/spawn-async.js +0 -29
  467. package/dist/src/utils/spawn-async.js.map +0 -1
  468. /package/dist/src/templates/document-model/{src/tests → tests}/document-model.test.d.ts +0 -0
  469. /package/dist/src/templates/document-model/{src/tests → tests}/document-model.test.js +0 -0
  470. /package/dist/src/templates/document-model/{src/tests → tests}/module.test.d.ts +0 -0
@@ -12,6 +12,14 @@ This project creates document models, editors, processors and subgraphs for the
12
12
  - **Action**: A proposed change to a document (JSON object with action name and input). Dispatch using "addActions" tool.
13
13
  - **Operation**: A completed change to a document containing the action plus metadata (index, timestamp, hash, errors). Actions become operations after dispatch.
14
14
 
15
+ ## Technology Primer
16
+
17
+ - **Reactor**: The core Powerhouse engine. It is modular and storage-agnostic, loads document models at runtime, and synchronizes documents across nodes via drives.
18
+ - **Reactor Package**: A deployable bundle that extends the Reactor. It contains one or more document models, editors, processors, and subgraphs. A Vetra project generates a Reactor Package.
19
+ - **Connect**: The Powerhouse web application for document management. End users open Connect to browse drives, create documents, and interact with editors.
20
+ - **Switchboard**: The Powerhouse API service. It exposes GraphQL and MCP endpoints so external tools can read/write documents programmatically.
21
+ - **Vetra**: The local development environment for building Reactor Packages. It includes Vetra Studio (a local Connect instance) and Vetra Switchboard (a local Switchboard with reactor-mcp). Start it with \`ph vetra\`.
22
+
15
23
  ## CRITICAL: MCP Tool Usage Rules
16
24
 
17
25
  **MANDATORY**: The \`reactor-mcp\` MUST BE USED when handling documents or document-models for the Powerhouse/Vetra ecosystem.
@@ -36,6 +44,12 @@ If the \`reactor-mcp\` server is unavailable, ask the user to run \`ph vetra\` o
36
44
  - When in doubt, ask for clarification
37
45
  - Break complex models into logical modules and operations
38
46
 
47
+ #### Document Type ID Format
48
+
49
+ - **Type ID**: \`{organization}/{document-type-name}\` (e.g., \`pizza-plaza/order\`, \`acme/invoice\`)
50
+ - **File extension**: 2-4 characters with leading dot (e.g., \`.ordr\`, \`.inv\`)
51
+ - **Name**: Must match \`/[a-zA-Z][a-zA-Z0-9 ]*/\` — human-readable, capitalized (e.g., \`"Order"\`, \`"Invoice"\`)
52
+
39
53
  ### 2. Pre-Implementation Requirements
40
54
 
41
55
  **MANDATORY**: Check document model schema before making any MCP tool calls.
@@ -64,20 +78,43 @@ After doing changes to the code, or after creating a new document model or a new
64
78
 
65
79
  ## Document editor creation flow
66
80
 
67
- When the user requests to create or make changes on a document editor, follow these steps:
81
+ **CRITICAL**: Creating a document editor is a **two-phase** process. You must NEVER skip Phase 1 or try to manually create editor files from scratch. The codegen system generates the boilerplate — your job is only to implement the UI inside it.
82
+
83
+ ### Phase 1: Create the editor document via MCP (MANDATORY FIRST STEP)
84
+
85
+ **NEVER** start by writing editor code, creating component files, or looking at how to scaffold an editor manually. The **only** way to create a new editor is through the MCP tools:
86
+
87
+ 1. Check if the document editor already exists. If it does, ask the user if a new one should be created or if the existing one should be reimplemented
88
+ 2. If it's a new editor, get the document editor schema using \`mcp__reactor-mcp__getDocumentModelSchema\` with \`type: "powerhouse/document-editor"\`
89
+ 3. Create a new editor document on the \`vetra-{hash}\` drive of type \`powerhouse/document-editor\` using \`mcp__reactor-mcp__addActions\` with the \`ADD_FILE\` action
90
+ 4. Configure the editor document with the required actions (set the editor name, target document model, etc.) according to the schema
91
+
92
+ ⚠️ **The editor document MUST be confirmed/published — if it is left as draft state, the codegen will NOT run and no editor files will be generated.** Make sure the document state is not "DRAFT" after creation.
93
+
94
+ 5. Once the editor document is confirmed on the drive, the codegen automatically runs and generates boilerplate files in the \`editors/\` folder, including hooks, type definitions, and the editor component shell
95
+
96
+ ### Phase 2: Implement the editor UI
97
+
98
+ Only **after** the codegen has produced the boilerplate files, proceed with the UI implementation:
68
99
 
69
- - Check if the document editor already exists and if it does, ask the user if a new one should be created or if the existing one should be reimplemented
70
- - If it's a new editor, create a new editor document on the "vetra-{hash}" drive if available, of type \`powerhouse/document-editor\`
71
- - Check the document editor schema and comply with it
72
- - After adding the editor document to the \`vetra-{hash}\` drive, a new editor will be generated in the \`editors\` folder
100
+ - Inspect the generated files in the \`editors/\` folder do NOT create new files for the main editor component; edit the generated one
73
101
  - Inspect the hooks in \`editors/hooks\` as they should be useful
74
102
  - Read the schema of the document model that the editor is for to know how to interact with it
103
+ - Every editor **MUST** include \`<DocumentToolbar />\` imported from \`@powerhousedao/design-system/connect/index\`. Place it at the top of the editor component — do not put anything next to it.
75
104
  - Style the editor using tailwind classes or a style tag. If using a style tag, make sure to make the selectors specific to only apply to the editor component.
76
105
  - Create modular components for the UI elements and place them on separate files to make it easier to maintain and update
77
106
  - Consider using the React Components exported by \`@powerhousedao/design-system\` and \`@powerhousedao/document-engineering\`
78
107
  - Separate business logic from presentation logic
79
108
  - Use TypeScript for type safety, avoid using any and type casting
80
109
  - Always check for type and lint errors after creating or modifying the editor
110
+ - **CRITICAL**: After creating a new editor, verify that \`editors/editors.ts\` includes the new editor module. The codegen should update this file automatically, but if it doesn't, manually add the import and include the editor in the \`editors\` array. Without this registration, Connect won't find an editor for the document type. Example:
111
+
112
+ ~~~typescript
113
+ import type { EditorModule } from "document-model";
114
+ import { TodoListEditor } from "./todo-list-editor/module.js";
115
+
116
+ export const editors: EditorModule[] = [TodoListEditor];
117
+ ~~~
81
118
 
82
119
  ### Document Editor Implementation Pattern
83
120
 
@@ -90,7 +127,7 @@ The following section is valid for editors that edit a single document type.
90
127
  Using a "Todo" document model as example:
91
128
 
92
129
  ~~~typescript
93
- import { generateId } from "document-model/core";
130
+ import { generateId } from "@powerhousedao/shared/document-model";
94
131
  import { useSelectedTodoDocument } from "../hooks/useTodoDocument.js";
95
132
  import {
96
133
  addTodo,
@@ -104,6 +141,9 @@ export default function Editor() {
104
141
  dispatch(addTodo({ id: generateId(), title: values.title }));
105
142
  }
106
143
  };
144
+
145
+ // Note: The \`useSelectedTodoDocument\` hook is auto-generated. Check the \`editors/hooks\` folder for the exact hook name.
146
+ // Action creators like \`addTodo\` are exported from the document model's \`gen/creators.js\` file.
107
147
  ~~~
108
148
 
109
149
  The \`useSelectedTodoDocument\` gets generated automatically so you don't need to implement it yourself.
@@ -222,9 +262,9 @@ Errors referenced in the reducer code will be imported automatically.
222
262
  #### Error Definition Requirements
223
263
 
224
264
  1. **Add error definitions** to operations using \`ADD_OPERATION_ERROR\`:
225
- - \`code\`: Uppercase snake_case (e.g., \`"MISSING_ID"\`, \`"ENTRY_NOT_FOUND"\`)
226
- - \`name\`: PascalCase ending with "Error" (e.g., \`"MissingIdError"\`, \`"EntryNotFoundError"\`)
227
- - \`description\`: Human-readable description of the error condition
265
+ - \`errorCode\`: Uppercase snake_case (e.g., \`"MISSING_ID"\`, \`"ENTRY_NOT_FOUND"\`)
266
+ - \`errorName\`: PascalCase ending with "Error" (e.g., \`"MissingIdError"\`, \`"EntryNotFoundError"\`)
267
+ - \`errorDescription\`: Human-readable description of the error condition
228
268
 
229
269
  2. **Error names must end with "Error"** for consistency and code generation
230
270
 
@@ -264,6 +304,47 @@ throw new MissingIdError("message");
264
304
  - **InvalidInputError**: Business logic violations
265
305
  - **PermissionDeniedError**: Access control violations
266
306
 
307
+ #### Testing Reducer Errors
308
+
309
+ **CRITICAL**: When a reducer throws an error, the operation is **still added** to the document but with an \`.error\` property containing the error message as a string.
310
+
311
+ **DO NOT** use \`.toThrow()\` or \`expect(() => ...).toThrow()\` patterns when testing reducer errors.
312
+
313
+ ##### How Errors Work in Operations
314
+
315
+ 1. The reducer throws an error (e.g., \`throw new InvalidNameError("message")\`)
316
+ 2. The operation is still recorded in \`document.operations.global\` (or \`.local\`)
317
+ 3. The error message is stored in \`operation.error\` as a string
318
+ 4. **The state is NOT mutated** - it remains unchanged from before the operation
319
+
320
+ ##### Accessing the Correct Operation Index
321
+
322
+ **CRITICAL**: You must access the correct operation index. The index corresponds to how many operations were dispatched before it.
323
+
324
+ - If this is the **first** operation dispatched, access \`[0]\`
325
+ - If 3 operations were dispatched **before** the failing one, access \`[3]\`
326
+
327
+ ##### Example
328
+
329
+ ~~~typescript
330
+ it("should return error and not mutate state", () => {
331
+ const document = utils.createDocument();
332
+ const initialState = document.state.global.name;
333
+
334
+ const updatedDocument = reducer(document, setName({ name: "invalid" }));
335
+
336
+ // Access the correct operation index (0 = first operation)
337
+ expect(updatedDocument.operations.global[0].error).toBe(
338
+ "Name is not allowed",
339
+ );
340
+ // State remains unchanged
341
+ expect(updatedDocument.state.global.name).toBe(initialState);
342
+ });
343
+
344
+ // ❌ WRONG - Never use toThrow()
345
+ expect(() => reducer(document, setName({ name: "invalid" }))).toThrow();
346
+ ~~~
347
+
267
348
  ## Document Model Structure
268
349
 
269
350
  ### Core Components
@@ -306,6 +387,15 @@ throw new MissingIdError("message");
306
387
  - Use required fields \`!\` only when absolutely necessary
307
388
  - Defaults handled by operations, not schema
308
389
 
390
+ #### Mandatory vs Optional Field Rules
391
+
392
+ A user must always be able to create an **empty document** without providing any information. This drives the following rules:
393
+
394
+ - **Root type properties** can only be mandatory (\`!\`) if they have a logical default value (e.g., empty array, enum initial status)
395
+ - **Collections** should always use \`[Type!]!\` — inner \`!\` means no nulls in the array, outer \`!\` means the array itself defaults to empty
396
+ - **Child object fields** can be mandatory only if all their required properties also have logical defaults
397
+ - Use \`enum\` types for workflow statuses (e.g., \`status: OrderStatus!\` where the enum has an initial value like \`DRAFT\`)
398
+
309
399
  ### ⚠️ CRITICAL: State Type Naming Convention
310
400
 
311
401
  **MANDATORY**: The global state type name MUST follow this exact pattern:
@@ -361,12 +451,51 @@ type TodoListLocalState {
361
451
  - **Objects in arrays**: Must include \`OID!\` field for unique identification
362
452
  - Include \`OLabel\` for metadata when relevant
363
453
 
454
+ #### OID vs PHID Usage
455
+
456
+ - \`OID\` is used as **primary key** (\`id: OID!\`) and **foreign key** (\`otherObjectId: OID!\`) within a document
457
+ - \`PHID\` is **only** for referencing **external documents** (other documents in the drive), typically alongside cached properties (like a link preview — title/snippet may become stale)
458
+ - **NEVER** use the \`ID\` type — it is a common GraphQL convention but is not used in Powerhouse document models
459
+
460
+ #### Collection Sorting & Trees
461
+
462
+ - **No need for \`position\` or \`weight\` properties** — maintain order via array index; operations like \`MOVE_X\` reorder the array directly
463
+ - **Trees**: Always define as a flat list with \`parentId: OID\` (root nodes have \`parentId = null\`); do NOT use recursive/nested types
464
+
364
465
  ### Input Types
365
466
 
366
467
  - Reflect user intent with descriptive names
367
468
  - Simple, specific fields over complex nested types
368
469
  - System auto-generates \`OID\` for new objects (users don't provide manually)
369
470
 
471
+ #### Input Type Naming Convention
472
+
473
+ - Root input type **MUST** be named \`<OperationName>Input\` (PascalCase of the operation name)
474
+ - Example: operation \`SET_CATEGORY_LABEL\` → input type \`SetCategoryLabelInput\`
475
+ - **Failing to follow this convention breaks the code generator**
476
+
477
+ #### Input Types Cannot Reference State Types
478
+
479
+ - In operation input schemas, **ONLY** \`enum\` types and scalar types from the state schema can be referenced directly
480
+ - All other state types must be **mirrored** with unique input types (e.g., state type \`MenuItem\` → input type \`NewMenuItemInput\` for the ADD operation)
481
+ - State \`enum\` types **MUST NOT** be redefined in input schemas — reference them directly
482
+ - Each operation should have its **own** input types; do not share mirror types across operations
483
+
484
+ #### Empty Input Workaround
485
+
486
+ - Input types with **zero fields** are not supported by the code generator
487
+ - Workaround: add \`_: Boolean\` as a dummy optional parameter
488
+
489
+ ~~~graphql
490
+ # ❌ BAD - empty input type breaks codegen
491
+ input ClearAllInput {}
492
+
493
+ # ✅ GOOD - dummy field workaround
494
+ input ClearAllInput {
495
+ _: Boolean
496
+ }
497
+ ~~~
498
+
370
499
  ## Working with Drives
371
500
 
372
501
  **MANDATORY**: Check the document-drive schema before performing drive operations.
@@ -1 +1 @@
1
- {"version":3,"file":"AGENTS.md.js","sourceRoot":"","sources":["../../../../src/templates/boilerplate/AGENTS.md.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAEhC,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqZ/B,CAAC,GAAG,CAAC"}
1
+ {"version":3,"file":"AGENTS.md.js","sourceRoot":"","sources":["../../../../src/templates/boilerplate/AGENTS.md.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAEhC,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAshB/B,CAAC,GAAG,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare const claudeTemplate: string;
1
+ export { agentsTemplate as claudeTemplate } from "./AGENTS.md.js";
2
2
  //# sourceMappingURL=CLAUDE.md.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CLAUDE.md.d.ts","sourceRoot":"","sources":["../../../../src/templates/boilerplate/CLAUDE.md.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,QAqZtB,CAAC"}
1
+ {"version":3,"file":"CLAUDE.md.d.ts","sourceRoot":"","sources":["../../../../src/templates/boilerplate/CLAUDE.md.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,cAAc,EAAE,MAAM,gBAAgB,CAAC"}
@@ -1,408 +1,2 @@
1
- import { md } from "@tmpl/core";
2
- export const claudeTemplate = md `
3
- # Powerhouse Document Models Assistant
4
-
5
- This project creates document models, editors, processors and subgraphs for the Powerhouse ecosystem. Your role is to help users create these modules based on their needs.
6
-
7
- ## Core Concepts
8
-
9
- - **Document Model**: A template for creating documents. Defines schema and allowed operations for a document type.
10
- - **Document**: An instance of a document model containing actual data that follows the model's structure and can be modified using operations.
11
- - **Drive**: A document of type "powerhouse/document-drive" representing a collection of documents and folders. Add documents using "addActions" with "ADD_FILE" action.
12
- - **Action**: A proposed change to a document (JSON object with action name and input). Dispatch using "addActions" tool.
13
- - **Operation**: A completed change to a document containing the action plus metadata (index, timestamp, hash, errors). Actions become operations after dispatch.
14
-
15
- ## CRITICAL: MCP Tool Usage Rules
16
-
17
- **MANDATORY**: The \`reactor-mcp\` MUST BE USED when handling documents or document-models for the Powerhouse/Vetra ecosystem.
18
- If the \`reactor-mcp\` server is unavailable, ask the user to run \`ph vetra\` on a separate terminal to start the server and try to reconnect to the MCP server, DO NOT run it yourself.
19
-
20
- ### Key Requirements:
21
-
22
- - Never set document IDs manually - they're auto-generated by 'createDocument'
23
- - Minimize "addActions" calls by batching multiple actions together
24
- - Add new document model documents to "vetra-{hash}" drive unless specified otherwise
25
- - Always check document model schema before calling addActions
26
- - Use MCP tools for ALL document and document-model operations
27
-
28
- ## Document Model Creation Workflow
29
-
30
- ### 1. Planning Phase
31
-
32
- **MANDATORY**: Present your proposal to the user and ask for confirmation before implementing ANY document model.
33
-
34
- - **ALWAYS** describe the proposed document model structure (state schema, operations, modules) before creating
35
- - **NEVER** proceed with implementation without explicit user approval of your proposal
36
- - When in doubt, ask for clarification
37
- - Break complex models into logical modules and operations
38
-
39
- ### 2. Pre-Implementation Requirements
40
-
41
- **MANDATORY**: Check document model schema before making any MCP tool calls.
42
-
43
- - **ALWAYS** use \`mcp__reactor-mcp__getDocumentModelSchema\` with \`type: "powerhouse/document-model"\` first
44
- - Review input schema requirements for operations like \`ADD_MODULE\`, \`ADD_OPERATION\`, etc.
45
- - Ensure all required parameters (like \`id\` or \`scope\` fields) are included in action inputs
46
- - This prevents failed tool calls and reduces iteration
47
-
48
- ### 3. Implementation Requirements
49
-
50
- - Document model reducers must be **pure synchronous functions**
51
- - Reducers receive current state and operation, always returning the same result
52
- - Values like dates/IDs must come from operation input, not generated in reducer
53
- - Reducer code goes into SET_OPERATION_REDUCER action (no function header needed)
54
- - Reducers are wrapped with Mutative - you can mutate the state object directly
55
- - External imports go at the beginning of the actual reducer file in \`src/\`
56
- - Ensure that the reducer code of each operation in the document model schema is applied in \`document-models/<document-model-name>/src/reducers/<module-name>.ts\`
57
-
58
- ### 4. Quality assurance
59
-
60
- After doing changes to the code, or after creating a new document model or a new editor, _YOU MUST RUN_ the following commands to check for errors in your implementation:
61
-
62
- - **TypeScript Check**: Run \`npm run tsc\` to validate type safety
63
- - **ESLint Check**: Run \`npm run lint:fix\` to check for errors with ESLint
64
-
65
- ## Document editor creation flow
66
-
67
- When the user requests to create or make changes on a document editor, follow these steps:
68
-
69
- - Check if the document editor already exists and if it does, ask the user if a new one should be created or if the existing one should be reimplemented
70
- - If it's a new editor, create a new editor document on the "vetra-{hash}" drive if available, of type \`powerhouse/document-editor\`
71
- - Check the document editor schema and comply with it
72
- - After adding the editor document to the \`vetra-{hash}\` drive, a new editor will be generated in the \`editors\` folder
73
- - Inspect the hooks in \`editors/hooks\` as they should be useful
74
- - Read the schema of the document model that the editor is for to know how to interact with it
75
- - Style the editor using tailwind classes or a style tag. If using a style tag, make sure to make the selectors specific to only apply to the editor component.
76
- - Create modular components for the UI elements and place them on separate files to make it easier to maintain and update
77
- - Consider using the React Components exported by \`@powerhousedao/design-system\` and \`@powerhousedao/document-engineering\`
78
- - Separate business logic from presentation logic
79
- - Use TypeScript for type safety, avoid using any and type casting
80
- - Always check for type and lint errors after creating or modifying the editor
81
-
82
- ### Document Editor Implementation Pattern
83
-
84
- **CRITICAL**: When implementing document editors, use the modern React hooks pattern from \`@powerhousedao/reactor-browser\`.
85
-
86
- The following section is valid for editors that edit a single document type.
87
-
88
- #### Required Imports and Setup
89
-
90
- Using a "Todo" document model as example:
91
-
92
- ~~~typescript
93
- import { generateId } from "document-model/core";
94
- import { useSelectedTodoDocument } from "../hooks/useTodoDocument.js";
95
- import {
96
- addTodo,
97
- } from "../../document-models/todo/gen/creators.js";
98
-
99
- export default function Editor() {
100
- const [document, dispatch] = useSelectedTodoDocument();
101
-
102
- function handleAddTodo(values: { title: string }) {
103
- if (values.title) {
104
- dispatch(addTodo({ id: generateId(), title: values.title }));
105
- }
106
- };
107
- ~~~
108
-
109
- The \`useSelectedTodoDocument\` gets generated automatically so you don't need to implement it yourself.
110
-
111
- ## ⚠️ CRITICAL: Generated Files & Modification Rules
112
-
113
- ### Generated Files Rule
114
-
115
- **NEVER edit files in \`gen/\` folders** - they are auto-generated and will be overwritten.
116
-
117
- ### Document Model Modification Process
118
-
119
- For ANY document model changes, follow this **mandatory** two-step process:
120
-
121
- #### Step 1: Update Document Model via MCP
122
-
123
- Use \`mcp__reactor-mcp__addActions\` with operations like:
124
-
125
- - \`SET_OPERATION_SCHEMA\` - update input/output schemas
126
- - \`SET_OPERATION_REDUCER\` - update reducer code
127
- - \`SET_STATE_SCHEMA\` - update state definitions
128
-
129
- #### Step 2: Update Existing Source Files
130
-
131
- **ALSO manually update existing reducer files in \`src/\` folder** - these are NOT auto-generated.
132
- Make sure to check if the operation reducer code needs to be updated after changing the state schema.
133
-
134
- ### ⚠️ Critical Reminder
135
-
136
- **ALWAYS do BOTH steps when fixing reducer issues:**
137
-
138
- 1. ✅ Fix existing reducer files in \`src/\` manually
139
- 2. ✅ Update document model via MCP with same fixes
140
-
141
- **Forgetting step 2 means future code generations will still contain the bugs!**
142
-
143
- ## Reducer Implementation Guidelines
144
-
145
- ### ❌ Forbidden in Reducers (Non-Deterministic)
146
-
147
- - \`crypto.randomUUID()\`, \`Math.random()\`, \`Date.now()\`, \`new Date()\`
148
- - External API calls or side effects
149
- - Asynchronous functions
150
- - Any non-deterministic functions
151
-
152
- ### ❌ Forbidden Patterns
153
-
154
- ~~~typescript
155
- // NEVER use fallback values with non-deterministic functions
156
- id: action.input.id || crypto.randomUUID(); // ❌ FORBIDDEN
157
- timestamp: action.input.timestamp || new Date(); // ❌ FORBIDDEN
158
- ~~~
159
-
160
- ### ✅ Required Pattern
161
-
162
- All dynamic values must come from action input:
163
-
164
- - **IDs**: Include \`id: OID!\` in input schema, use \`action.input.id\` in reducer
165
- - **Timestamps**: Include \`timestamp: DateTime!\` in input schema
166
- - **Computed values**: Calculate before dispatching action
167
-
168
- ### Example
169
-
170
- ~~~typescript
171
- // ❌ BAD - impure reducer
172
- const newItem = {
173
- id: crypto.randomUUID(), // Non-deterministic
174
- createdAt: new Date(), // Non-deterministic
175
- };
176
-
177
- // ✅ GOOD - pure reducer
178
- const newItem = {
179
- id: action.input.id, // From action input
180
- createdAt: action.input.createdAt, // From action input
181
- };
182
- ~~~
183
-
184
- ### Handling Nullable Input Types
185
-
186
- **CRITICAL**: Be careful when handling optional input types:
187
-
188
- - Optional input types use \`InputMaybe<T>\` allowing \`null | undefined | T\`.
189
- - Optional state types use \`Maybe<T>\` = \`T | null\`.
190
- - If there is no applicable default value then use \`|| null\`.
191
-
192
- ~~~typescript
193
- // ❌ BAD - Type error with Maybe<string>
194
- amount: action.input.amount,
195
- notes: action.input.notes,
196
-
197
- // ✅ GOOD - Matches Maybe<T> = T | null
198
- amount: action.input.amount || null,
199
- notes: action.input.notes || [],
200
- ~~~
201
-
202
- Use truthy checks when conditionally assigning optional values from input to state:
203
-
204
- ~~~typescript
205
- // ❌ BAD - Type 'string | null' is not assignable to type 'string'.
206
- if (action.input.field !== undefined) entry.field = action.input.field;
207
-
208
- // ✅ GOOD - use truthy checks
209
- if (action.input.field) state.field = action.input.field;
210
-
211
- // ✅ GOOD - For booleans use explicit null/undefined checks
212
- if (action.input.field !== undefined && action.input.field !== null)
213
- state.field = action.input.field;
214
- ~~~
215
-
216
- ### Error Handling in Operations
217
-
218
- **MANDATORY**: Define specific error types for each operation to handle invalid inputs and edge cases properly.
219
- Action inputs are validated so they are guaranteed to respect the input schema.
220
- Errors referenced in the reducer code will be imported automatically.
221
-
222
- #### Error Definition Requirements
223
-
224
- 1. **Add error definitions** to operations using \`ADD_OPERATION_ERROR\`:
225
- - \`code\`: Uppercase snake_case (e.g., \`"MISSING_ID"\`, \`"ENTRY_NOT_FOUND"\`)
226
- - \`name\`: PascalCase ending with "Error" (e.g., \`"MissingIdError"\`, \`"EntryNotFoundError"\`)
227
- - \`description\`: Human-readable description of the error condition
228
-
229
- 2. **Error names must end with "Error"** for consistency and code generation
230
-
231
- 3. **Use specific error types** rather than generic validation
232
-
233
- 4. **Must use unique error names and ids**
234
-
235
- #### Error Usage in Reducers
236
-
237
- ~~~typescript
238
- // ✅ GOOD - Throw specific errors by name
239
- if (!action.input.id) {
240
- throw new MissingIdError("ID is required for operation");
241
- }
242
-
243
- if (entryIndex === -1) {
244
- throw new EntryNotFoundError(\`Entry not found\`);
245
- }
246
-
247
- // ❌ BAD - Generic Error
248
- throw new Error("Something went wrong");
249
-
250
- // ❌ BAD - Nested error access
251
- throw new errors.ModuleName.MissingIdError("message");
252
-
253
- // ❌ BAD - Do not import error classes in the reducer code,
254
- import { MissingIdError } from "../../gen/module-name/error.js";
255
-
256
- // ✅ GOOD - Simply reference the error and it will be imported automatically
257
- throw new MissingIdError("message");
258
- ~~~
259
-
260
- #### Common Error Patterns
261
-
262
- - **EntityNotFoundError**: Referenced entity doesn't exist
263
- - **DuplicateIdError**: ID already exists when creating new entries
264
- - **InvalidInputError**: Business logic violations
265
- - **PermissionDeniedError**: Access control violations
266
-
267
- ## Document Model Structure
268
-
269
- ### Core Components
270
-
271
- - **Basic Metadata**: \`id\`, \`name\`, \`extension\`, \`description\`, \`author\` (name + website)
272
- - **Specifications**: Versioned specs with \`version\`, \`changeLog\`, \`state\` (global/local with schema, initialValue, examples)
273
- - **Modules**: Operational modules containing their operations
274
-
275
- ## Available Document Model Operations (37 total)
276
-
277
- | Category | Operations | Count |
278
- | -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
279
- | **Header Management** | \`SET_MODEL_NAME\`, \`SET_MODEL_ID\`, \`SET_MODEL_EXTENSION\`, \`SET_MODEL_DESCRIPTION\`, \`SET_AUTHOR_NAME\`, \`SET_AUTHOR_WEBSITE\` | 6 |
280
- | **Versioning** | ⚠️ **DO NOT USE** - Not implemented | 0 |
281
- | **Module Management** | \`ADD_MODULE\`, \`SET_MODULE_NAME\`, \`SET_MODULE_DESCRIPTION\`, \`DELETE_MODULE\`, \`REORDER_MODULES\` | 5 |
282
- | **Operation Management** | \`ADD_OPERATION\`, \`SET_OPERATION_NAME\`, \`SET_OPERATION_SCHEMA\`, \`SET_OPERATION_DESCRIPTION\`, \`SET_OPERATION_TEMPLATE\`, \`SET_OPERATION_REDUCER\`, \`MOVE_OPERATION\`, \`DELETE_OPERATION\`, \`REORDER_MODULE_OPERATIONS\` | 9 |
283
- | **Operation Error Management** | \`ADD_OPERATION_ERROR\`, \`SET_OPERATION_ERROR_CODE\`, \`SET_OPERATION_ERROR_NAME\`, \`SET_OPERATION_ERROR_DESCRIPTION\`, \`SET_OPERATION_ERROR_TEMPLATE\`, \`DELETE_OPERATION_ERROR\`, \`REORDER_OPERATION_ERRORS\` | 7 |
284
- | **Operation Example Management** | \`ADD_OPERATION_EXAMPLE\`, \`UPDATE_OPERATION_EXAMPLE\`, \`DELETE_OPERATION_EXAMPLE\`, \`REORDER_OPERATION_EXAMPLES\` | 4 |
285
- | **State Management** | \`SET_STATE_SCHEMA\`, \`SET_INITIAL_STATE\`, \`ADD_STATE_EXAMPLE\`, \`UPDATE_STATE_EXAMPLE\`, \`DELETE_STATE_EXAMPLE\`, \`REORDER_STATE_EXAMPLES\` | 6 |
286
-
287
- ## Best Practices & Design Principles
288
-
289
- ### Scope Selection
290
-
291
- - **\`scope: "global"\`**: State shared among all users with document access
292
- - **\`scope: "local"\`**: State private to each individual user
293
-
294
- ### Operation Design
295
-
296
- - Use descriptive operation names (e.g., \`ADD_LINE_ITEM\`, \`UPDATE_RECIPIENT\`)
297
- - One operation per user intent (separate concerns)
298
- - Include comprehensive examples and error definitions
299
- - Organize related operations into logical modules
300
-
301
- ## GraphQL Schema Guidelines
302
-
303
- ### Document State Schema
304
-
305
- - **Most fields optional** to support creating empty documents
306
- - Use required fields \`!\` only when absolutely necessary
307
- - Defaults handled by operations, not schema
308
-
309
- ### ⚠️ CRITICAL: State Type Naming Convention
310
-
311
- **MANDATORY**: The global state type name MUST follow this exact pattern:
312
-
313
- ~~~graphql
314
- type <DocumentModelName>State {
315
- # your fields here
316
- }
317
- ~~~
318
-
319
- **DO NOT** append "Global" to the state type name, even when defining global state:
320
-
321
- ~~~graphql
322
- // ❌ WRONG - Do not use "GlobalState" suffix
323
- type TodoListGlobalState {
324
- todos: [Todo!]!
325
- }
326
-
327
- // ✅ CORRECT - Use only "State" suffix
328
- type TodoListState {
329
- todos: [Todo!]!
330
- }
331
-
332
- // ✅ CORRECT - Use "LocalState" suffix for Local scope
333
- type TodoListLocalState {
334
- localTodos: [Todo!]!
335
- }
336
- ~~~
337
-
338
- **Why this matters:**
339
-
340
- - The code generator expects the type to be named \`<DocumentModelName>State\`
341
- - Using \`GlobalState\` or \`LocalState\` suffix will cause TypeScript compilation errors
342
- - This applies when using \`SET_STATE_SCHEMA\` with \`scope: "global"\`
343
-
344
- **Rule**: For global state, the type should be \`<DocumentModelName>State\`. For local state (if needed), the type name should be \`<DocumentModelName>LocalState\`.
345
-
346
- ### Available Scalar Types
347
-
348
- | Standard | Custom Identity | Custom Amounts | Custom Specialized |
349
- | --------- | ---------------------- | ------------------- | ------------------ |
350
- | \`String\` | \`OID\` (Object ID) | \`Amount\` | \`EthereumAddress\` |
351
- | \`Int\` | \`PHID\` (Powerhouse ID) | \`Amount_Tokens\` | \`EmailAddress\` |
352
- | \`Float\` | \`OLabel\` | \`Amount_Money\` | \`Date\` |
353
- | \`Boolean\` | | \`Amount_Fiat\` | \`DateTime\` |
354
- | | | \`Amount_Currency\` | \`URL\` |
355
- | | | \`Amount_Crypto\` | \`Currency\` |
356
- | | | \`Amount_Percentage\` | |
357
-
358
- ### Arrays and Objects
359
-
360
- - **Arrays**: Must be mandatory \`[ObjectType!]!\`
361
- - **Objects in arrays**: Must include \`OID!\` field for unique identification
362
- - Include \`OLabel\` for metadata when relevant
363
-
364
- ### Input Types
365
-
366
- - Reflect user intent with descriptive names
367
- - Simple, specific fields over complex nested types
368
- - System auto-generates \`OID\` for new objects (users don't provide manually)
369
-
370
- ## Working with Drives
371
-
372
- **MANDATORY**: Check the document-drive schema before performing drive operations.
373
-
374
- ### Drive Types
375
-
376
- There might be two drives available with a special use case:
377
-
378
- 1. **Vetra Drive** (\`vetra-{hash}\`):
379
- - Contains **source documents**: document models and document editors
380
- - Used for development
381
- - Add document model and editor definitions here
382
-
383
- 2. **Preview Drive** (\`preview-{hash}\`, named "Vetra Preview"):
384
- - Contains **demo and preview documents** (document instances)
385
- - Used for showcasing and testing document models
386
- - Add actual document instances here
387
-
388
- ### Drive Operations
389
-
390
- When working with drives (adding/removing documents, creating folders, etc.):
391
-
392
- 1. **Always get the drive schema first**:
393
-
394
- ~~~typescript
395
- mcp__reactor -
396
- mcp__getDocumentModelSchema({ type: "powerhouse/document-drive" });
397
- ~~~
398
-
399
- 2. **Review available operations** in the schema, such as:
400
- - \`ADD_FILE\` - Add a document to the drive
401
- - \`ADD_FOLDER\` - Create a new folder
402
- - \`DELETE_NODE\` - Remove a file or folder (use this, NOT "DELETE_FILE")
403
- - \`UPDATE_NODE\` - Update node properties
404
- - \`MOVE_NODE\` - Move a node to different location
405
-
406
- 3. **Check input schemas** for each operation to ensure you're passing correct parameters
407
- `.raw;
1
+ export { agentsTemplate as claudeTemplate } from "./AGENTS.md.js";
408
2
  //# sourceMappingURL=CLAUDE.md.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CLAUDE.md.js","sourceRoot":"","sources":["../../../../src/templates/boilerplate/CLAUDE.md.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAEhC,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqZ/B,CAAC,GAAG,CAAC"}
1
+ {"version":3,"file":"CLAUDE.md.js","sourceRoot":"","sources":["../../../../src/templates/boilerplate/CLAUDE.md.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,cAAc,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const dockerfileTemplate = "# =============================================================================\n# Multi-stage Dockerfile for Powerhouse Document Model Packages\n# Produces two images: connect (frontend) and switchboard (backend)\n#\n# Build commands:\n# docker build --target connect -t <registry>/<project>/connect:<tag> .\n# docker build --target switchboard -t <registry>/<project>/switchboard:<tag> .\n# =============================================================================\n\n# -----------------------------------------------------------------------------\n# Base stage: Common setup for building\n# -----------------------------------------------------------------------------\nFROM node:24-alpine AS base\n\nWORKDIR /app\n\n# Install build dependencies\nRUN apk add --no-cache python3 make g++ git bash \\\n && ln -sf /usr/bin/python3 /usr/bin/python\n\n# Setup pnpm\nENV PNPM_HOME=\"/pnpm\"\nENV PATH=\"$PNPM_HOME:$PATH\"\nRUN corepack enable && corepack prepare pnpm@latest --activate\n\n# Configure JSR registry\nRUN pnpm config set @jsr:registry https://npm.jsr.io\n\n# Build arguments\nARG TAG=latest\nARG PH_CONNECT_BASE_PATH=\"/\"\n\n# Install ph-cmd, prisma, and prettier globally\nRUN pnpm add -g ph-cmd@$TAG prisma@5.17.0 prettier\n\n# Initialize project based on tag (dev/staging/latest)\nRUN case \"$TAG\" in \\\n *dev*) ph init project --dev --package-manager pnpm ;; \\\n *staging*) ph init project --staging --package-manager pnpm ;; \\\n *) ph init project --package-manager pnpm ;; \\\n esac\n\nWORKDIR /app/project\n\n# Copy package files for the current package\nCOPY package.json pnpm-lock.yaml ./\n\n# Install the current package (this package)\nARG PACKAGE_NAME\nRUN if [ -n \"$PACKAGE_NAME\" ]; then \\\n echo \"Installing package: $PACKAGE_NAME\"; \\\n ph install \"$PACKAGE_NAME\"; \\\n else \\\n echo \"Warning: PACKAGE_NAME not provided, using local build\"; \\\n pnpm install; \\\n fi\n\n# Regenerate Prisma client for Alpine Linux\nRUN prisma generate --schema node_modules/document-drive/dist/prisma/schema.prisma || true\n\n# -----------------------------------------------------------------------------\n# Connect build stage\n# -----------------------------------------------------------------------------\nFROM base AS connect-builder\n\nARG PH_CONNECT_BASE_PATH=\"/\"\n\n# Build connect\nRUN ph connect build --base ${PH_CONNECT_BASE_PATH}\n\n# -----------------------------------------------------------------------------\n# Connect final stage - nginx\n# -----------------------------------------------------------------------------\nFROM nginx:alpine AS connect\n\n# Install envsubst for config templating\nRUN apk add --no-cache gettext\n\n# Copy nginx config template\nCOPY docker/nginx.conf /etc/nginx/nginx.conf.template\n\n# Copy built static files from build stage\nCOPY --from=connect-builder /app/project/.ph/connect-build/dist /var/www/html/project\n\n# Environment variables for nginx config\nENV PORT=3001\nENV PH_CONNECT_BASE_PATH=\"/\"\n\n# Copy and setup entrypoint\nCOPY docker/connect-entrypoint.sh /docker-entrypoint.sh\nRUN chmod +x /docker-entrypoint.sh\n\nEXPOSE ${PORT}\n\nHEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \\\n CMD wget -q --spider http://localhost:${PORT}/health || exit 1\n\nENTRYPOINT [\"/docker-entrypoint.sh\"]\n\n# -----------------------------------------------------------------------------\n# Switchboard final stage - node runtime\n# -----------------------------------------------------------------------------\nFROM node:24-alpine AS switchboard\n\nWORKDIR /app\n\n# Install runtime dependencies\nRUN apk add --no-cache curl openssl\n\n# Setup pnpm\nENV PNPM_HOME=\"/pnpm\"\nENV PATH=\"$PNPM_HOME:$PATH\"\nRUN corepack enable && corepack prepare pnpm@latest --activate\n\n# Configure JSR registry\nRUN pnpm config set @jsr:registry https://npm.jsr.io\n\n# Install ph-cmd and prisma globally (needed at runtime)\nARG TAG=latest\nRUN pnpm add -g ph-cmd@$TAG prisma@5.17.0\n\n# Copy built project from build stage\nCOPY --from=base /app/project /app/project\n\nWORKDIR /app/project\n\n# Copy entrypoint\nCOPY docker/switchboard-entrypoint.sh /app/entrypoint.sh\nRUN chmod +x /app/entrypoint.sh\n\n# Environment variables\nENV NODE_ENV=production\nENV PORT=3000\nENV DATABASE_URL=\"\"\nENV SKIP_DB_MIGRATIONS=\"false\"\n\nEXPOSE ${PORT}\n\nHEALTHCHECK --interval=30s --timeout=3s --start-period=30s --retries=3 \\\n CMD curl -f http://localhost:${PORT}/health || exit 1\n\nENTRYPOINT [\"/app/entrypoint.sh\"]\n";
2
+ //# sourceMappingURL=Dockerfile.d.ts.map