@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.
- package/dist/src/codegen/__tests__/config.d.ts +0 -1
- package/dist/src/codegen/__tests__/config.d.ts.map +1 -1
- package/dist/src/codegen/__tests__/config.js +0 -1
- package/dist/src/codegen/__tests__/config.js.map +1 -1
- package/dist/src/codegen/__tests__/fixtures/typecheck.js +1 -1
- package/dist/src/codegen/__tests__/fixtures/typecheck.js.map +1 -1
- package/dist/src/codegen/__tests__/generate-doc-model.test.js +162 -212
- package/dist/src/codegen/__tests__/generate-doc-model.test.js.map +1 -1
- package/dist/src/codegen/__tests__/generate-drive-editor.test.js +70 -49
- package/dist/src/codegen/__tests__/generate-drive-editor.test.js.map +1 -1
- package/dist/src/codegen/__tests__/generate-editor.test.js +27 -27
- package/dist/src/codegen/__tests__/generate-editor.test.js.map +1 -1
- package/dist/src/codegen/__tests__/generate-manifest.test.js +17 -16
- package/dist/src/codegen/__tests__/generate-manifest.test.js.map +1 -1
- package/dist/src/codegen/__tests__/generate-processor.test.d.ts +2 -0
- package/dist/src/codegen/__tests__/generate-processor.test.d.ts.map +1 -0
- package/dist/src/codegen/__tests__/generate-processor.test.js +295 -0
- package/dist/src/codegen/__tests__/generate-processor.test.js.map +1 -0
- package/dist/src/codegen/__tests__/generate-subgraph.test.d.ts +2 -0
- package/dist/src/codegen/__tests__/generate-subgraph.test.d.ts.map +1 -0
- package/dist/src/codegen/__tests__/generate-subgraph.test.js +197 -0
- package/dist/src/codegen/__tests__/generate-subgraph.test.js.map +1 -0
- package/dist/src/codegen/__tests__/global-setup.d.ts +1 -1
- package/dist/src/codegen/__tests__/global-setup.d.ts.map +1 -1
- package/dist/src/codegen/__tests__/global-setup.js +3 -15
- package/dist/src/codegen/__tests__/global-setup.js.map +1 -1
- package/dist/src/codegen/__tests__/ts-morph-generator.test.js +4 -4
- package/dist/src/codegen/__tests__/ts-morph-generator.test.js.map +1 -1
- package/dist/src/codegen/__tests__/utils.d.ts +2 -2
- package/dist/src/codegen/__tests__/utils.d.ts.map +1 -1
- package/dist/src/codegen/__tests__/utils.js +11 -12
- package/dist/src/codegen/__tests__/utils.js.map +1 -1
- package/dist/src/codegen/generate.d.ts +25 -19
- package/dist/src/codegen/generate.d.ts.map +1 -1
- package/dist/src/codegen/generate.js +68 -113
- package/dist/src/codegen/generate.js.map +1 -1
- package/dist/src/codegen/graphql.d.ts +1 -1
- package/dist/src/codegen/graphql.d.ts.map +1 -1
- package/dist/src/codegen/graphql.js +15 -9
- package/dist/src/codegen/graphql.js.map +1 -1
- package/dist/src/codegen/index.d.ts +0 -1
- package/dist/src/codegen/index.d.ts.map +1 -1
- package/dist/src/codegen/index.js +0 -1
- package/dist/src/codegen/index.js.map +1 -1
- package/dist/src/codegen/utils.d.ts +2 -2
- package/dist/src/codegen/utils.d.ts.map +1 -1
- package/dist/src/codegen/utils.js +3 -2
- package/dist/src/codegen/utils.js.map +1 -1
- package/dist/src/create-lib/create-project.d.ts.map +1 -1
- package/dist/src/create-lib/create-project.js +15 -2
- package/dist/src/create-lib/create-project.js.map +1 -1
- package/dist/src/file-builders/boilerplate/build-package-json.test.js +4 -1
- package/dist/src/file-builders/boilerplate/build-package-json.test.js.map +1 -1
- package/dist/src/file-builders/boilerplate/ci-templates.test.d.ts +2 -0
- package/dist/src/file-builders/boilerplate/ci-templates.test.d.ts.map +1 -0
- package/dist/src/file-builders/boilerplate/ci-templates.test.js +114 -0
- package/dist/src/file-builders/boilerplate/ci-templates.test.js.map +1 -0
- package/dist/src/file-builders/boilerplate/package.json.js +1 -1
- package/dist/src/file-builders/boilerplate/package.json.js.map +1 -1
- package/dist/src/file-builders/clis/generate-cli-docs.d.ts +17 -0
- package/dist/src/file-builders/clis/generate-cli-docs.d.ts.map +1 -0
- package/dist/src/file-builders/clis/generate-cli-docs.js +36 -0
- package/dist/src/file-builders/clis/generate-cli-docs.js.map +1 -0
- package/dist/src/file-builders/document-editor.d.ts +1 -1
- package/dist/src/file-builders/document-editor.d.ts.map +1 -1
- package/dist/src/file-builders/document-editor.js +9 -7
- package/dist/src/file-builders/document-editor.js.map +1 -1
- package/dist/src/file-builders/document-model/document-model.d.ts +1 -1
- package/dist/src/file-builders/document-model/document-model.d.ts.map +1 -1
- package/dist/src/file-builders/document-model/document-model.js +67 -65
- package/dist/src/file-builders/document-model/document-model.js.map +1 -1
- package/dist/src/file-builders/document-model/gen-dir.d.ts +1 -1
- package/dist/src/file-builders/document-model/gen-dir.d.ts.map +1 -1
- package/dist/src/file-builders/document-model/gen-dir.js +67 -58
- package/dist/src/file-builders/document-model/gen-dir.js.map +1 -1
- package/dist/src/file-builders/document-model/migrate-legacy.d.ts +19 -0
- package/dist/src/file-builders/document-model/migrate-legacy.d.ts.map +1 -0
- package/dist/src/file-builders/document-model/migrate-legacy.js +104 -0
- package/dist/src/file-builders/document-model/migrate-legacy.js.map +1 -0
- package/dist/src/file-builders/document-model/root-dir.d.ts +1 -1
- package/dist/src/file-builders/document-model/root-dir.d.ts.map +1 -1
- package/dist/src/file-builders/document-model/root-dir.js +17 -17
- package/dist/src/file-builders/document-model/root-dir.js.map +1 -1
- package/dist/src/file-builders/document-model/src-dir.d.ts +1 -1
- package/dist/src/file-builders/document-model/src-dir.d.ts.map +1 -1
- package/dist/src/file-builders/document-model/src-dir.js +78 -19
- package/dist/src/file-builders/document-model/src-dir.js.map +1 -1
- package/dist/src/file-builders/document-model/tests-dir.d.ts +1 -1
- package/dist/src/file-builders/document-model/tests-dir.d.ts.map +1 -1
- package/dist/src/file-builders/document-model/tests-dir.js +11 -11
- package/dist/src/file-builders/document-model/tests-dir.js.map +1 -1
- package/dist/src/file-builders/document-model/upgrades-dir.d.ts +6 -4
- package/dist/src/file-builders/document-model/upgrades-dir.d.ts.map +1 -1
- package/dist/src/file-builders/document-model/upgrades-dir.js +19 -27
- package/dist/src/file-builders/document-model/upgrades-dir.js.map +1 -1
- package/dist/src/file-builders/drive-editor.d.ts +1 -1
- package/dist/src/file-builders/drive-editor.d.ts.map +1 -1
- package/dist/src/file-builders/drive-editor.js +37 -35
- package/dist/src/file-builders/drive-editor.js.map +1 -1
- package/dist/src/file-builders/editor-common.d.ts.map +1 -1
- package/dist/src/file-builders/editor-common.js +0 -1
- package/dist/src/file-builders/editor-common.js.map +1 -1
- package/dist/src/file-builders/index.d.ts +2 -0
- package/dist/src/file-builders/index.d.ts.map +1 -1
- package/dist/src/file-builders/index.js +2 -0
- package/dist/src/file-builders/index.js.map +1 -1
- package/dist/src/file-builders/module-files.d.ts +11 -5
- package/dist/src/file-builders/module-files.d.ts.map +1 -1
- package/dist/src/file-builders/module-files.js +37 -28
- package/dist/src/file-builders/module-files.js.map +1 -1
- package/dist/src/file-builders/processors/analytics.d.ts +3 -0
- package/dist/src/file-builders/processors/analytics.d.ts.map +1 -0
- package/dist/src/file-builders/processors/analytics.js +35 -0
- package/dist/src/file-builders/processors/analytics.js.map +1 -0
- package/dist/src/file-builders/processors/processor.d.ts +9 -0
- package/dist/src/file-builders/processors/processor.d.ts.map +1 -0
- package/dist/src/file-builders/processors/processor.js +142 -0
- package/dist/src/file-builders/processors/processor.js.map +1 -0
- package/dist/src/file-builders/processors/relational-db.d.ts +3 -0
- package/dist/src/file-builders/processors/relational-db.d.ts.map +1 -0
- package/dist/src/file-builders/processors/relational-db.js +53 -0
- package/dist/src/file-builders/processors/relational-db.js.map +1 -0
- package/dist/src/file-builders/processors/types.d.ts +13 -0
- package/dist/src/file-builders/processors/types.d.ts.map +1 -0
- package/dist/src/file-builders/processors/types.js +2 -0
- package/dist/src/file-builders/processors/types.js.map +1 -0
- package/dist/src/file-builders/subgraph.d.ts +10 -0
- package/dist/src/file-builders/subgraph.d.ts.map +1 -0
- package/dist/src/file-builders/subgraph.js +121 -0
- package/dist/src/file-builders/subgraph.js.map +1 -0
- package/dist/src/file-builders/subgraphs.d.ts +1 -1
- package/dist/src/file-builders/subgraphs.d.ts.map +1 -1
- package/dist/src/file-builders/subgraphs.js +2 -2
- package/dist/src/file-builders/subgraphs.js.map +1 -1
- package/dist/src/file-builders/types.d.ts +20 -1
- package/dist/src/file-builders/types.d.ts.map +1 -1
- package/dist/src/name-builders/get-variable-names.d.ts +5 -4
- package/dist/src/name-builders/get-variable-names.d.ts.map +1 -1
- package/dist/src/name-builders/get-variable-names.js +6 -4
- package/dist/src/name-builders/get-variable-names.js.map +1 -1
- package/dist/src/templates/boilerplate/AGENTS.md.d.ts.map +1 -1
- package/dist/src/templates/boilerplate/AGENTS.md.js +138 -9
- package/dist/src/templates/boilerplate/AGENTS.md.js.map +1 -1
- package/dist/src/templates/boilerplate/CLAUDE.md.d.ts +1 -1
- package/dist/src/templates/boilerplate/CLAUDE.md.d.ts.map +1 -1
- package/dist/src/templates/boilerplate/CLAUDE.md.js +1 -407
- package/dist/src/templates/boilerplate/CLAUDE.md.js.map +1 -1
- package/dist/src/templates/boilerplate/docker/Dockerfile.d.ts +2 -0
- package/dist/src/templates/boilerplate/docker/Dockerfile.d.ts.map +1 -0
- package/dist/src/templates/boilerplate/docker/Dockerfile.js +144 -0
- package/dist/src/templates/boilerplate/docker/Dockerfile.js.map +1 -0
- package/dist/src/templates/boilerplate/docker/connect-entrypoint.sh.d.ts +2 -0
- package/dist/src/templates/boilerplate/docker/connect-entrypoint.sh.d.ts.map +1 -0
- package/dist/src/templates/boilerplate/docker/connect-entrypoint.sh.js +18 -0
- package/dist/src/templates/boilerplate/docker/connect-entrypoint.sh.js.map +1 -0
- package/dist/src/templates/boilerplate/docker/nginx.conf.d.ts +2 -0
- package/dist/src/templates/boilerplate/docker/nginx.conf.d.ts.map +1 -0
- package/dist/src/templates/boilerplate/docker/nginx.conf.js +79 -0
- package/dist/src/templates/boilerplate/docker/nginx.conf.js.map +1 -0
- package/dist/src/templates/boilerplate/docker/switchboard-entrypoint.sh.d.ts +2 -0
- package/dist/src/templates/boilerplate/docker/switchboard-entrypoint.sh.d.ts.map +1 -0
- package/dist/src/templates/boilerplate/docker/switchboard-entrypoint.sh.js +19 -0
- package/dist/src/templates/boilerplate/docker/switchboard-entrypoint.sh.js.map +1 -0
- package/dist/src/templates/boilerplate/document-models/document-models.js +1 -1
- package/dist/src/templates/boilerplate/document-models/upgrade-manifests.d.ts +2 -0
- package/dist/src/templates/boilerplate/document-models/upgrade-manifests.d.ts.map +1 -0
- package/dist/src/templates/boilerplate/document-models/upgrade-manifests.js +7 -0
- package/dist/src/templates/boilerplate/document-models/upgrade-manifests.js.map +1 -0
- package/dist/src/templates/boilerplate/editors/editors.js +1 -1
- package/dist/src/templates/boilerplate/github/sync-and-publish.yml.d.ts +2 -0
- package/dist/src/templates/boilerplate/github/sync-and-publish.yml.d.ts.map +1 -0
- package/dist/src/templates/boilerplate/github/sync-and-publish.yml.js +376 -0
- package/dist/src/templates/boilerplate/github/sync-and-publish.yml.js.map +1 -0
- package/dist/src/templates/boilerplate/index.d.ts.map +1 -1
- package/dist/src/templates/boilerplate/index.html.d.ts.map +1 -1
- package/dist/src/templates/boilerplate/index.html.js +2 -7
- package/dist/src/templates/boilerplate/index.html.js.map +1 -1
- package/dist/src/templates/boilerplate/index.js +4 -1
- package/dist/src/templates/boilerplate/index.js.map +1 -1
- package/dist/src/templates/boilerplate/main.tsx.d.ts +2 -0
- package/dist/src/templates/boilerplate/main.tsx.d.ts.map +1 -0
- package/dist/src/templates/boilerplate/main.tsx.js +8 -0
- package/dist/src/templates/boilerplate/main.tsx.js.map +1 -0
- package/dist/src/templates/boilerplate/package.json.d.ts.map +1 -1
- package/dist/src/templates/boilerplate/package.json.js +14 -5
- package/dist/src/templates/boilerplate/package.json.js.map +1 -1
- package/dist/src/templates/boilerplate/powerhouse.config.json.js +2 -2
- package/dist/src/templates/boilerplate/powerhouse.config.json.js.map +1 -1
- package/dist/src/templates/boilerplate/style.css.d.ts.map +1 -1
- package/dist/src/templates/boilerplate/style.css.js +1 -0
- package/dist/src/templates/boilerplate/style.css.js.map +1 -1
- package/dist/src/templates/boilerplate/tsconfig.json.d.ts.map +1 -1
- package/dist/src/templates/boilerplate/tsconfig.json.js +0 -1
- package/dist/src/templates/boilerplate/tsconfig.json.js.map +1 -1
- package/dist/src/templates/cli-docs/docs-from-cli-help.d.ts +8 -0
- package/dist/src/templates/cli-docs/docs-from-cli-help.d.ts.map +1 -0
- package/dist/src/templates/cli-docs/docs-from-cli-help.js +86 -0
- package/dist/src/templates/cli-docs/docs-from-cli-help.js.map +1 -0
- package/dist/src/templates/document-editor/editor.js +1 -1
- package/dist/src/templates/document-editor/module.js +1 -1
- package/dist/src/templates/document-model/actions.d.ts.map +1 -1
- package/dist/src/templates/document-model/actions.js +11 -11
- package/dist/src/templates/document-model/actions.js.map +1 -1
- package/dist/src/templates/document-model/gen/actions.js +5 -5
- package/dist/src/templates/document-model/gen/controller.d.ts +3 -0
- package/dist/src/templates/document-model/gen/controller.d.ts.map +1 -0
- package/dist/src/templates/document-model/gen/controller.js +12 -0
- package/dist/src/templates/document-model/gen/controller.js.map +1 -0
- package/dist/src/templates/document-model/gen/creators.d.ts.map +1 -1
- package/dist/src/templates/document-model/gen/creators.js +11 -8
- package/dist/src/templates/document-model/gen/creators.js.map +1 -1
- package/dist/src/templates/document-model/gen/document-schema.js +1 -1
- package/dist/src/templates/document-model/gen/index.d.ts.map +1 -1
- package/dist/src/templates/document-model/gen/index.js +3 -2
- package/dist/src/templates/document-model/gen/index.js.map +1 -1
- package/dist/src/templates/document-model/gen/modules/creators.js +1 -1
- package/dist/src/templates/document-model/gen/modules/error.d.ts.map +1 -1
- package/dist/src/templates/document-model/gen/modules/error.js +8 -2
- package/dist/src/templates/document-model/gen/modules/error.js.map +1 -1
- package/dist/src/templates/document-model/gen/ph-factories.js +5 -5
- package/dist/src/templates/document-model/gen/ph-factories.js.map +1 -1
- package/dist/src/templates/document-model/gen/reducer.d.ts.map +1 -1
- package/dist/src/templates/document-model/gen/reducer.js +6 -7
- package/dist/src/templates/document-model/gen/reducer.js.map +1 -1
- package/dist/src/templates/document-model/gen/utils.d.ts.map +1 -1
- package/dist/src/templates/document-model/gen/utils.js +4 -17
- package/dist/src/templates/document-model/gen/utils.js.map +1 -1
- package/dist/src/templates/document-model/module.d.ts +1 -2
- package/dist/src/templates/document-model/module.d.ts.map +1 -1
- package/dist/src/templates/document-model/module.js +9 -12
- package/dist/src/templates/document-model/module.js.map +1 -1
- package/dist/src/templates/document-model/tests/document-model.test.d.ts.map +1 -0
- package/dist/src/templates/document-model/tests/document-model.test.js.map +1 -0
- package/dist/src/templates/document-model/tests/module.test.d.ts.map +1 -0
- package/dist/src/templates/document-model/{src/tests → tests}/module.test.js +1 -1
- package/dist/src/templates/document-model/tests/module.test.js.map +1 -0
- package/dist/src/templates/document-model/upgrades/upgrade-manifest.d.ts +5 -0
- package/dist/src/templates/document-model/upgrades/upgrade-manifest.d.ts.map +1 -0
- package/dist/src/templates/document-model/upgrades/upgrade-manifest.js +13 -0
- package/dist/src/templates/document-model/upgrades/upgrade-manifest.js.map +1 -0
- package/dist/src/templates/document-model/upgrades/upgrade-transition.js +1 -1
- package/dist/src/templates/document-model/utils.js +2 -2
- package/dist/src/templates/document-model/utils.js.map +1 -1
- package/dist/src/templates/drive-editor/components/DriveExplorer.js +1 -1
- package/dist/src/templates/drive-editor/components/FolderTree.js +1 -1
- package/dist/src/templates/drive-editor/editor.d.ts.map +1 -1
- package/dist/src/templates/drive-editor/editor.js +4 -2
- package/dist/src/templates/drive-editor/editor.js.map +1 -1
- package/dist/src/templates/index.d.ts +20 -3
- package/dist/src/templates/index.d.ts.map +1 -1
- package/dist/src/templates/index.js +20 -3
- package/dist/src/templates/index.js.map +1 -1
- package/dist/src/templates/processors/analytics/factory.d.ts +6 -0
- package/dist/src/templates/processors/analytics/factory.d.ts.map +1 -0
- package/dist/src/templates/processors/analytics/factory.js +26 -0
- package/dist/src/templates/processors/analytics/factory.js.map +1 -0
- package/dist/src/templates/processors/analytics/index.d.ts +4 -0
- package/dist/src/templates/processors/analytics/index.d.ts.map +1 -0
- package/dist/src/templates/processors/analytics/index.js +34 -0
- package/dist/src/templates/processors/analytics/index.js.map +1 -0
- package/dist/src/templates/processors/factory.d.ts +2 -0
- package/dist/src/templates/processors/factory.d.ts.map +1 -0
- package/dist/src/templates/processors/factory.js +60 -0
- package/dist/src/templates/processors/factory.js.map +1 -0
- package/dist/src/templates/processors/index.d.ts +2 -0
- package/dist/src/templates/processors/index.d.ts.map +1 -0
- package/dist/src/templates/processors/index.js +10 -0
- package/dist/src/templates/processors/index.js.map +1 -0
- package/dist/src/templates/processors/relational-db/factory.d.ts +6 -0
- package/dist/src/templates/processors/relational-db/factory.d.ts.map +1 -0
- package/dist/src/templates/processors/relational-db/factory.js +40 -0
- package/dist/src/templates/processors/relational-db/factory.js.map +1 -0
- package/dist/src/templates/processors/relational-db/index.d.ts +4 -0
- package/dist/src/templates/processors/relational-db/index.d.ts.map +1 -0
- package/dist/src/templates/processors/relational-db/index.js +28 -0
- package/dist/src/templates/processors/relational-db/index.js.map +1 -0
- package/dist/src/templates/processors/relational-db/migrations.d.ts +2 -0
- package/dist/src/templates/processors/relational-db/migrations.d.ts.map +1 -0
- package/dist/src/{codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/migrations.esm.t → templates/processors/relational-db/migrations.js} +5 -5
- package/dist/src/templates/processors/relational-db/migrations.js.map +1 -0
- package/dist/src/templates/processors/relational-db/schema.d.ts +2 -0
- package/dist/src/templates/processors/relational-db/schema.d.ts.map +1 -0
- package/dist/src/templates/processors/relational-db/schema.js +12 -0
- package/dist/src/templates/processors/relational-db/schema.js.map +1 -0
- package/dist/src/templates/processors/utils.d.ts +2 -0
- package/dist/src/templates/processors/utils.d.ts.map +1 -0
- package/dist/src/templates/processors/utils.js +6 -0
- package/dist/src/templates/processors/utils.js.map +1 -0
- package/dist/src/templates/subgraphs/custom-resolvers.d.ts +5 -0
- package/dist/src/templates/subgraphs/custom-resolvers.d.ts.map +1 -0
- package/dist/src/templates/subgraphs/custom-resolvers.js +20 -0
- package/dist/src/templates/subgraphs/custom-resolvers.js.map +1 -0
- package/dist/src/templates/subgraphs/custom-schema.d.ts +5 -0
- package/dist/src/templates/subgraphs/custom-schema.d.ts.map +1 -0
- package/dist/src/templates/subgraphs/custom-schema.js +20 -0
- package/dist/src/templates/subgraphs/custom-schema.js.map +1 -0
- package/dist/src/templates/subgraphs/document-model-resolvers.d.ts +15 -0
- package/dist/src/templates/subgraphs/document-model-resolvers.d.ts.map +1 -0
- package/dist/src/{codegen/.hygen/templates/powerhouse/generate-document-model-subgraph/resolvers.esm.t → templates/subgraphs/document-model-resolvers.js} +55 -47
- package/dist/src/templates/subgraphs/document-model-resolvers.js.map +1 -0
- package/dist/src/templates/subgraphs/document-model-schema.d.ts +12 -0
- package/dist/src/templates/subgraphs/document-model-schema.d.ts.map +1 -0
- package/dist/src/templates/subgraphs/document-model-schema.js +54 -0
- package/dist/src/templates/subgraphs/document-model-schema.js.map +1 -0
- package/dist/src/templates/subgraphs/index-file.d.ts +5 -0
- package/dist/src/templates/subgraphs/index-file.d.ts.map +1 -0
- package/dist/src/{codegen/.hygen/templates/powerhouse/generate-subgraph/index.esm.t → templates/subgraphs/index-file.js} +7 -7
- package/dist/src/templates/subgraphs/index-file.js.map +1 -0
- package/dist/src/templates/subgraphs/index.d.ts +7 -0
- package/dist/src/templates/subgraphs/index.d.ts.map +1 -0
- package/dist/src/templates/subgraphs/index.js +7 -0
- package/dist/src/templates/subgraphs/index.js.map +1 -0
- package/dist/src/templates/subgraphs/lib-file.d.ts +2 -0
- package/dist/src/templates/subgraphs/lib-file.d.ts.map +1 -0
- package/dist/src/templates/subgraphs/lib-file.js +8 -0
- package/dist/src/templates/subgraphs/lib-file.js.map +1 -0
- package/dist/src/ts-morph-generator/__tests__/ReducerGenerator.test.js +4 -4
- package/dist/src/ts-morph-generator/core/GenerationContext.d.ts +1 -1
- package/dist/src/ts-morph-generator/core/GenerationContext.d.ts.map +1 -1
- package/dist/src/ts-morph-generator/core/ReducerGenerator.js +3 -3
- package/dist/src/ts-morph-generator/core/TSMorphCodeGenerator.d.ts +1 -1
- package/dist/src/ts-morph-generator/core/TSMorphCodeGenerator.d.ts.map +1 -1
- package/dist/src/ts-morph-generator/utilities/DirectoryManager.d.ts +1 -1
- package/dist/src/ts-morph-generator/utilities/DirectoryManager.d.ts.map +1 -1
- package/dist/src/ts-morph-generator/utilities/DirectoryManager.js +5 -5
- package/dist/src/ts-morph-generator/utilities/DirectoryManager.js.map +1 -1
- package/dist/src/utils/cli.d.ts +0 -6
- package/dist/src/utils/cli.d.ts.map +1 -1
- package/dist/src/utils/cli.js +0 -18
- package/dist/src/utils/cli.js.map +1 -1
- package/dist/src/utils/constants.d.ts +0 -2
- package/dist/src/utils/constants.d.ts.map +1 -1
- package/dist/src/utils/constants.js +0 -18
- package/dist/src/utils/constants.js.map +1 -1
- package/dist/src/utils/document-type-metadata.d.ts.map +1 -1
- package/dist/src/utils/document-type-metadata.js +5 -2
- package/dist/src/utils/document-type-metadata.js.map +1 -1
- package/dist/src/utils/format-with-prettier.d.ts +1 -1
- package/dist/src/utils/format-with-prettier.d.ts.map +1 -1
- package/dist/src/utils/format-with-prettier.js +5 -11
- package/dist/src/utils/format-with-prettier.js.map +1 -1
- package/dist/src/utils/graphql-type-prefixes.d.ts +10 -0
- package/dist/src/utils/graphql-type-prefixes.d.ts.map +1 -0
- package/dist/src/utils/graphql-type-prefixes.js +51 -0
- package/dist/src/utils/graphql-type-prefixes.js.map +1 -0
- package/dist/src/utils/index.d.ts +2 -3
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/index.js +2 -3
- package/dist/src/utils/index.js.map +1 -1
- package/dist/src/utils/source-files.d.ts +8 -1
- package/dist/src/utils/source-files.d.ts.map +1 -1
- package/dist/src/utils/source-files.js +19 -2
- package/dist/src/utils/source-files.js.map +1 -1
- package/dist/src/utils/syntax-getters.d.ts +2 -1
- package/dist/src/utils/syntax-getters.d.ts.map +1 -1
- package/dist/src/utils/syntax-getters.js +12 -0
- package/dist/src/utils/syntax-getters.js.map +1 -1
- package/dist/src/utils/ts-morph-project.d.ts +14 -5
- package/dist/src/utils/ts-morph-project.d.ts.map +1 -1
- package/dist/src/utils/ts-morph-project.js +12 -12
- package/dist/src/utils/ts-morph-project.js.map +1 -1
- package/dist/src/utils/validation.d.ts +1 -1
- package/dist/src/utils/validation.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/vitest.config.d.ts.map +1 -1
- package/dist/vitest.config.js +4 -0
- package/dist/vitest.config.js.map +1 -1
- package/package.json +32 -43
- package/dist/src/codegen/.hygen/package.json +0 -6
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-custom-subgraph/index.js +0 -10
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-custom-subgraph/resolvers.esm.t +0 -17
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-custom-subgraph/schema.esm.t +0 -16
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/actions.esm.t +0 -16
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/creators.esm.t +0 -9
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/customUtils.esm.t +0 -5
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/document-schema.esm.t +0 -56
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/document-type.esm.t +0 -6
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/documentModel.esm.t +0 -7
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/documentModelTest.esm.t +0 -121
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/hooks.esm.t +0 -49
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/index.esm.t +0 -23
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/index.js +0 -127
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/module.esm.t +0 -22
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/ph-factories.esm.t +0 -93
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/reducer.esm.t +0 -46
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/root-utils.esm.t +0 -11
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/rootActions.esm.t +0 -13
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/rootIndex.esm.t +0 -14
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/schema.esm.t +0 -6
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/src-index.esm.t +0 -5
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/types.esm.t +0 -31
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/utils.esm.t +0 -77
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/actions.esm.t +0 -22
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/creators.esm.t +0 -37
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/customTest.esm.t +0 -44
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/error.esm.t +0 -36
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/index.js +0 -71
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/operations.esm.t +0 -17
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-subgraph/index.js +0 -118
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-subgraph/schema.esm.t +0 -44
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/CreateDocument.esm.t +0 -58
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/DriveContents.esm.t +0 -23
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/DriveExplorer.esm.t +0 -32
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/EmptyState.esm.t +0 -19
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/Files.esm.t +0 -29
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/FolderTree.esm.t +0 -108
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/Folders.esm.t +0 -28
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/NavigationBreadcrumbs.esm.t +0 -14
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/config.esm.t +0 -11
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/editor.esm.t +0 -18
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/index.js +0 -25
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/module.esm.t +0 -15
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/editor.esm.t +0 -80
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/index.js +0 -90
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/module.esm.t +0 -16
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-import-script/index.esm.t +0 -59
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-import-script/index.js +0 -9
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-import-script/utils.esm.t +0 -100
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/factory.esm.t +0 -22
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/index.esm.t +0 -62
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/index.js +0 -12
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/index.root.esm.t +0 -10
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/index.root.inject.esm.t +0 -12
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/lib.esm.t +0 -34
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/lib.inject_call.esm.t +0 -7
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/lib.inject_export.esm.t +0 -7
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/lib.inject_import.esm.t +0 -7
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/factory.esm.t +0 -40
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/index.esm.t +0 -47
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/index.js +0 -12
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/index.root.esm.t +0 -10
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/index.root.inject.esm.t +0 -12
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/lib.esm.t +0 -34
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/lib.inject_call.esm.t +0 -7
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/lib.inject_export.esm.t +0 -9
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/lib.inject_import.esm.t +0 -7
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/schema.esm.t +0 -13
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-subgraph/index.js +0 -10
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-subgraph/lib.esm.t +0 -9
- package/dist/src/codegen/__tests__/generate-versioned-document-model.test.d.ts +0 -2
- package/dist/src/codegen/__tests__/generate-versioned-document-model.test.d.ts.map +0 -1
- package/dist/src/codegen/__tests__/generate-versioned-document-model.test.js +0 -159
- package/dist/src/codegen/__tests__/generate-versioned-document-model.test.js.map +0 -1
- package/dist/src/codegen/hygen.d.ts +0 -47
- package/dist/src/codegen/hygen.d.ts.map +0 -1
- package/dist/src/codegen/hygen.js +0 -230
- package/dist/src/codegen/hygen.js.map +0 -1
- package/dist/src/file-builders/boilerplate/package-json-versions.test.d.ts +0 -2
- package/dist/src/file-builders/boilerplate/package-json-versions.test.d.ts.map +0 -1
- package/dist/src/file-builders/boilerplate/package-json-versions.test.js +0 -34
- package/dist/src/file-builders/boilerplate/package-json-versions.test.js.map +0 -1
- package/dist/src/templates/boilerplate/processors/index.d.ts +0 -2
- package/dist/src/templates/boilerplate/processors/index.d.ts.map +0 -1
- package/dist/src/templates/boilerplate/processors/index.js +0 -2
- package/dist/src/templates/boilerplate/processors/index.js.map +0 -1
- package/dist/src/templates/document-model/src/tests/document-model.test.d.ts.map +0 -1
- package/dist/src/templates/document-model/src/tests/document-model.test.js.map +0 -1
- package/dist/src/templates/document-model/src/tests/module.test.d.ts.map +0 -1
- package/dist/src/templates/document-model/src/tests/module.test.js.map +0 -1
- package/dist/src/utils/dependencies.d.ts +0 -12
- package/dist/src/utils/dependencies.d.ts.map +0 -1
- package/dist/src/utils/dependencies.js +0 -34
- package/dist/src/utils/dependencies.js.map +0 -1
- package/dist/src/utils/spawn-async.d.ts +0 -5
- package/dist/src/utils/spawn-async.d.ts.map +0 -1
- package/dist/src/utils/spawn-async.js +0 -29
- package/dist/src/utils/spawn-async.js.map +0 -1
- /package/dist/src/templates/document-model/{src/tests → tests}/document-model.test.d.ts +0 -0
- /package/dist/src/templates/document-model/{src/tests → tests}/document-model.test.js +0 -0
- /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
|
-
|
|
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
|
-
-
|
|
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
|
|
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
|
-
- \`
|
|
226
|
-
- \`
|
|
227
|
-
- \`
|
|
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
|
|
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
|
|
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":"
|
|
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
|
-
|
|
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,
|
|
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
|