create-mercato-app 0.6.7-develop.6863.1.61001cf9a8 → 0.6.7
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/README.md +0 -72
- package/agentic/claude-code/hooks/entity-migration-check.ts +88 -32
- package/agentic/codex/enforcement-rules.md +16 -2
- package/agentic/cursor/hooks/entity-migration-check.mjs +50 -19
- package/agentic/cursor/rules/entity-guard.mdc +21 -9
- package/agentic/cursor/rules/generated-guard.mdc +5 -3
- package/agentic/cursor/rules/open-mercato.mdc +29 -3
- package/agentic/guides/module-system.md +127 -12
- package/agentic/shared/AGENTS.md.template +311 -124
- package/agentic/shared/ai/agentic.config.json +0 -2
- package/agentic/shared/ai/lessons.md +3 -26
- package/agentic/shared/ai/skills/om-auto-continue-pr-loop/SKILL.md +27 -0
- package/agentic/shared/ai/skills/om-auto-create-pr-loop/SKILL.md +27 -0
- package/agentic/shared/ai/skills/om-auto-review-pr/SKILL.md +0 -4
- package/agentic/shared/ai/skills/om-backend-ui-design/SKILL.md +241 -20
- package/agentic/shared/ai/skills/om-backend-ui-design/references/ui-components.md +260 -0
- package/agentic/shared/ai/skills/om-data-model-design/SKILL.md +601 -16
- package/agentic/shared/ai/skills/om-data-model-design/references/mikro-orm-cheatsheet.md +146 -0
- package/agentic/shared/ai/skills/om-eject-and-customize/SKILL.md +310 -14
- package/agentic/shared/ai/skills/om-help/SKILL.md +97 -15
- package/agentic/shared/ai/skills/om-help/references/skills-catalog.md +84 -0
- package/agentic/shared/ai/skills/om-help/references/workflow-sequences.md +193 -0
- package/agentic/shared/ai/skills/om-implement-spec/SKILL.md +152 -33
- package/agentic/shared/ai/skills/om-integration-builder/SKILL.md +708 -24
- package/agentic/shared/ai/skills/om-integration-builder/STANDALONE.md +34 -0
- package/agentic/shared/ai/skills/om-integration-builder/references/adapter-contracts.md +762 -0
- package/agentic/shared/ai/skills/om-module-scaffold/SKILL.md +820 -20
- package/agentic/shared/ai/skills/om-module-scaffold/references/naming-conventions.md +50 -0
- package/agentic/shared/ai/skills/om-module-scaffold/references/navigation-patterns.md +97 -0
- package/agentic/shared/ai/skills/om-system-extension/SKILL.md +843 -19
- package/agentic/shared/ai/skills/om-system-extension/references/extension-contracts.md +271 -0
- package/agentic/shared/ai/skills/om-trim-unused-modules/SKILL.md +63 -15
- package/agentic/shared/ai/skills/om-troubleshooter/SKILL.md +467 -16
- package/agentic/shared/ai/skills/om-troubleshooter/references/diagnostic-commands.md +101 -0
- package/agentic/shared/ai/skills/tiers.json +21 -143
- package/agentic/shared/ai/skills/tiers.schema.json +40 -52
- package/agentic/shared/ai/specs/README.md +3 -4
- package/agentic/shared/ai/specs/SPEC-000-template.md +10 -226
- package/agentic/shared/ai/trackers/github.md +4 -108
- package/agentic/shared/scripts/install-skills.sh +694 -4
- package/dist/agentic/claude-code/hooks/entity-migration-check.ts +88 -32
- package/dist/agentic/codex/enforcement-rules.md +16 -2
- package/dist/agentic/cursor/hooks/entity-migration-check.mjs +50 -19
- package/dist/agentic/cursor/rules/entity-guard.mdc +21 -9
- package/dist/agentic/cursor/rules/generated-guard.mdc +5 -3
- package/dist/agentic/cursor/rules/open-mercato.mdc +29 -3
- package/dist/agentic/guides/cache.md +45 -0
- package/dist/agentic/guides/core.md +453 -0
- package/dist/agentic/guides/events.md +117 -0
- package/dist/agentic/guides/module-facts.json +3833 -115419
- package/dist/agentic/guides/module-system.md +127 -12
- package/dist/agentic/guides/modules/ai_assistant.md +28 -227
- package/dist/agentic/guides/modules/api_docs.md +2 -58
- package/dist/agentic/guides/modules/api_keys.md +7 -92
- package/dist/agentic/guides/modules/attachments.md +14 -119
- package/dist/agentic/guides/modules/audit_logs.md +10 -131
- package/dist/agentic/guides/modules/auth.md +33 -276
- package/dist/agentic/guides/modules/business_rules.md +14 -149
- package/dist/agentic/guides/modules/catalog.md +43 -475
- package/dist/agentic/guides/modules/channel_gmail.md +3 -82
- package/dist/agentic/guides/modules/channel_imap.md +3 -82
- package/dist/agentic/guides/modules/checkout.md +27 -299
- package/dist/agentic/guides/modules/communication_channels.md +33 -315
- package/dist/agentic/guides/modules/configs.md +8 -104
- package/dist/agentic/guides/modules/content.md +2 -57
- package/dist/agentic/guides/modules/currencies.md +17 -152
- package/dist/agentic/guides/modules/customer_accounts.md +45 -387
- package/dist/agentic/guides/modules/customers.md +85 -746
- package/dist/agentic/guides/modules/dashboards.md +10 -155
- package/dist/agentic/guides/modules/data_sync.md +16 -149
- package/dist/agentic/guides/modules/dictionaries.md +12 -107
- package/dist/agentic/guides/modules/directory.md +15 -148
- package/dist/agentic/guides/modules/entities.md +13 -145
- package/dist/agentic/guides/modules/events.md +2 -59
- package/dist/agentic/guides/modules/feature_toggles.md +9 -119
- package/dist/agentic/guides/modules/gateway_stripe.md +4 -92
- package/dist/agentic/guides/modules/generators.md +2 -45
- package/dist/agentic/guides/modules/inbox_ops.md +27 -207
- package/dist/agentic/guides/modules/integrations.md +16 -146
- package/dist/agentic/guides/modules/messages.md +24 -223
- package/dist/agentic/guides/modules/notifications.md +8 -96
- package/dist/agentic/guides/modules/onboarding.md +6 -77
- package/dist/agentic/guides/modules/payment_gateways.md +21 -164
- package/dist/agentic/guides/modules/perspectives.md +7 -77
- package/dist/agentic/guides/modules/planner.md +18 -136
- package/dist/agentic/guides/modules/portal.md +2 -93
- package/dist/agentic/guides/modules/progress.md +14 -104
- package/dist/agentic/guides/modules/query_index.md +15 -154
- package/dist/agentic/guides/modules/record_locks.md +21 -206
- package/dist/agentic/guides/modules/resources.md +30 -197
- package/dist/agentic/guides/modules/sales.md +84 -678
- package/dist/agentic/guides/modules/scheduler.md +14 -133
- package/dist/agentic/guides/modules/search.md +6 -170
- package/dist/agentic/guides/modules/security.md +35 -294
- package/dist/agentic/guides/modules/shipping_carriers.md +18 -134
- package/dist/agentic/guides/modules/sso.md +26 -151
- package/dist/agentic/guides/modules/staff.md +57 -369
- package/dist/agentic/guides/modules/storage_s3.md +5 -95
- package/dist/agentic/guides/modules/sync_akeneo.md +3 -85
- package/dist/agentic/guides/modules/sync_excel.md +6 -75
- package/dist/agentic/guides/modules/system_status_overlays.md +2 -60
- package/dist/agentic/guides/modules/translations.md +10 -104
- package/dist/agentic/guides/modules/webhooks.md +24 -203
- package/dist/agentic/guides/modules/wms.md +46 -441
- package/dist/agentic/guides/modules/workflows.md +43 -302
- package/dist/agentic/guides/queue.md +53 -0
- package/dist/agentic/guides/search.md +115 -0
- package/dist/agentic/guides/shared.md +108 -0
- package/dist/agentic/guides/ui.md +347 -0
- package/dist/agentic/shared/AGENTS.md.template +311 -124
- package/dist/agentic/shared/ai/agentic.config.json +0 -2
- package/dist/agentic/shared/ai/lessons.md +3 -26
- package/dist/agentic/shared/ai/skills/om-auto-continue-pr-loop/SKILL.md +27 -0
- package/dist/agentic/shared/ai/skills/om-auto-create-pr-loop/SKILL.md +27 -0
- package/dist/agentic/shared/ai/skills/om-auto-review-pr/SKILL.md +0 -4
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/SKILL.md +241 -20
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/ui-components.md +260 -0
- package/dist/agentic/shared/ai/skills/om-data-model-design/SKILL.md +601 -16
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/mikro-orm-cheatsheet.md +146 -0
- package/dist/agentic/shared/ai/skills/om-eject-and-customize/SKILL.md +310 -14
- package/dist/agentic/shared/ai/skills/om-help/SKILL.md +97 -15
- package/dist/agentic/shared/ai/skills/om-help/references/skills-catalog.md +84 -0
- package/dist/agentic/shared/ai/skills/om-help/references/workflow-sequences.md +193 -0
- package/dist/agentic/shared/ai/skills/om-implement-spec/SKILL.md +152 -33
- package/dist/agentic/shared/ai/skills/om-integration-builder/SKILL.md +708 -24
- package/dist/agentic/shared/ai/skills/om-integration-builder/STANDALONE.md +34 -0
- package/dist/agentic/shared/ai/skills/om-integration-builder/references/adapter-contracts.md +762 -0
- package/dist/agentic/shared/ai/skills/om-module-scaffold/SKILL.md +820 -20
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/naming-conventions.md +50 -0
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/navigation-patterns.md +97 -0
- package/dist/agentic/shared/ai/skills/om-system-extension/SKILL.md +843 -19
- package/dist/agentic/shared/ai/skills/om-system-extension/references/extension-contracts.md +271 -0
- package/dist/agentic/shared/ai/skills/om-trim-unused-modules/SKILL.md +63 -15
- package/dist/agentic/shared/ai/skills/om-troubleshooter/SKILL.md +467 -16
- package/dist/agentic/shared/ai/skills/om-troubleshooter/references/diagnostic-commands.md +101 -0
- package/dist/agentic/shared/ai/skills/tiers.json +21 -143
- package/dist/agentic/shared/ai/skills/tiers.schema.json +40 -52
- package/dist/agentic/shared/ai/specs/README.md +3 -4
- package/dist/agentic/shared/ai/specs/SPEC-000-template.md +10 -226
- package/dist/agentic/shared/ai/trackers/github.md +4 -108
- package/dist/agentic/shared/scripts/install-skills.sh +694 -4
- package/dist/index.js +183 -160
- package/package.json +7 -9
- package/template/.env.example +2 -59
- package/template/.yarnrc.yml.template +0 -9
- package/template/AGENTS.md +663 -93
- package/template/eslint.config.mjs +0 -1
- package/template/gitignore +0 -8
- package/template/jest.config.cjs +1 -2
- package/template/next.config.ts +0 -55
- package/template/package.json.template +25 -31
- package/template/scripts/dev-runtime-log-policy.mjs +0 -33
- package/template/scripts/dev-runtime.mjs +76 -142
- package/template/scripts/dev.mjs +7 -88
- package/template/scripts/install-skills.sh +19 -2
- package/template/src/app/(backend)/backend/__tests__/layout-route-registry.test.tsx +0 -1
- package/template/src/app/(backend)/backend/layout.tsx +3 -5
- package/template/src/app/(frontend)/layout.tsx +1 -1
- package/template/src/app/api/[...slug]/route.ts +0 -9
- package/template/src/app/globals.css +3 -61
- package/template/src/app/layout.tsx +18 -14
- package/template/src/app/page.tsx +1 -4
- package/template/src/components/AppProviders.tsx +1 -4
- package/template/src/components/DemoFeedbackWidget.tsx +1 -1
- package/template/src/components/__tests__/AppProviders.test.tsx +2 -11
- package/template/src/i18n/de.json +1 -21
- package/template/src/i18n/en.json +1 -21
- package/template/src/i18n/es.json +1 -21
- package/template/src/i18n/pl.json +1 -21
- package/template/src/instrumentation.ts +1 -14
- package/template/src/lib/i18n/register-dictionary-loader.ts +0 -2
- package/template/src/modules/example/__integration__/TC-UMES-003.spec.ts +3 -7
- package/template/src/modules/example/__integration__/TC-UMES-005.spec.ts +1 -7
- package/template/src/modules/example/__integration__/TC-UMES-009.spec.ts +10 -11
- package/template/src/modules/example/__integration__/todo-priority-validation.spec.ts +1 -31
- package/template/src/modules/example/acl.ts +0 -6
- package/template/src/modules/example/backend/mutation-lifecycle/page.meta.ts +9 -1
- package/template/src/modules/example/backend/page.meta.ts +10 -1
- package/template/src/modules/example/backend/payments/page.meta.ts +10 -1
- package/template/src/modules/example/backend/todos/create/page.meta.ts +11 -1
- package/template/src/modules/example/backend/todos/page.meta.ts +10 -1
- package/template/src/modules/example/backend/umes-extensions/page.meta.ts +9 -1
- package/template/src/modules/example/backend/umes-handlers/page.meta.ts +10 -1
- package/template/src/modules/example/backend/umes-integrations/page.meta.ts +10 -1
- package/template/src/modules/example/backend/umes-next-phases/page.meta.ts +11 -1
- package/template/src/modules/example/backend/umes-query-extensions/page.meta.ts +11 -1
- package/template/src/modules/example/commands/todos.ts +2 -47
- package/template/src/modules/example/i18n/pl.json +68 -68
- package/template/src/modules/example/lib/__tests__/mock-webhook-endpoint-adapter.test.ts +0 -14
- package/template/src/modules.ts +0 -17
- package/template/tsconfig.json +2 -3
- package/agentic/guides/ai-workflows.md +0 -76
- package/agentic/guides/architecture.md +0 -107
- package/agentic/guides/backend-ui.md +0 -80
- package/agentic/guides/contracts.md +0 -92
- package/agentic/guides/extensions.md +0 -121
- package/agentic/guides/integrations.md +0 -81
- package/agentic/guides/spec-delivery.md +0 -22
- package/agentic/guides/testing-debugging.md +0 -80
- package/agentic/shared/ai/harness/README.md +0 -50
- package/agentic/shared/ai/harness/RELEASE.md +0 -57
- package/agentic/shared/ai/harness/cases.json +0 -13680
- package/agentic/shared/ai/harness/cases.schema.json +0 -133
- package/agentic/shared/ai/harness/fixtures/index.json +0 -49
- package/agentic/shared/ai/harness/fixtures/seeds.json +0 -162
- package/agentic/shared/ai/harness/generated-code-review-policy.md +0 -21
- package/agentic/shared/ai/harness/generated-code-review-response.schema.json +0 -96
- package/agentic/shared/ai/harness/generated-code-review-result.schema.json +0 -172
- package/agentic/shared/ai/harness/release-matrix.json +0 -158
- package/agentic/shared/ai/harness/release-result.schema.json +0 -219
- package/agentic/shared/ai/harness/result.schema.json +0 -76
- package/agentic/shared/ai/harness/routing-response.schema.json +0 -12
- package/agentic/shared/ai/harness/target-validation-result.schema.json +0 -73
- package/agentic/shared/ai/harness/validators.json +0 -78
- package/agentic/shared/ai/harness/writable-ast-oracles.mjs +0 -2121
- package/agentic/shared/ai/harness/writable-behavior-oracles.mjs +0 -1096
- package/agentic/shared/ai/lessons/_template.md +0 -16
- package/agentic/shared/ai/review-checklist.md +0 -36
- package/agentic/shared/ai/skills/om-auto-implement-spec/SKILL.md +0 -21
- package/agentic/shared/ai/skills/om-auto-upgrade-0.6.6-to-0.6.7/SKILL.md +0 -98
- package/agentic/shared/ai/skills/om-backend-ui-design/references/crud-surfaces.md +0 -16
- package/agentic/shared/ai/skills/om-backend-ui-design/references/frontend-and-design-system.md +0 -53
- package/agentic/shared/ai/skills/om-backend-ui-design/references/page-and-navigation.md +0 -13
- package/agentic/shared/ai/skills/om-backend-ui-design/references/quality-states.md +0 -11
- package/agentic/shared/ai/skills/om-build-workflow/SKILL.md +0 -30
- package/agentic/shared/ai/skills/om-build-workflow/references/activity-contracts.md +0 -12
- package/agentic/shared/ai/skills/om-build-workflow/references/durability-and-progress.md +0 -13
- package/agentic/shared/ai/skills/om-build-workflow/references/workflow-design.md +0 -14
- package/agentic/shared/ai/skills/om-create-ai-agent/SKILL.md +0 -28
- package/agentic/shared/ai/skills/om-create-ai-agent/references/attachments-and-overrides.md +0 -12
- package/agentic/shared/ai/skills/om-create-ai-agent/references/module-agents-and-tools.md +0 -22
- package/agentic/shared/ai/skills/om-create-ai-agent/references/orchestrator-agents.md +0 -12
- package/agentic/shared/ai/skills/om-create-ai-agent/references/surface-selector.md +0 -19
- package/agentic/shared/ai/skills/om-data-model-design/references/integrity-and-concurrency.md +0 -19
- package/agentic/shared/ai/skills/om-data-model-design/references/migration-workflow.md +0 -13
- package/agentic/shared/ai/skills/om-data-model-design/references/schema-design.md +0 -14
- package/agentic/shared/ai/skills/om-data-model-design/references/sensitive-data.md +0 -10
- package/agentic/shared/ai/skills/om-eject-and-customize/references/decision-and-procedure.md +0 -17
- package/agentic/shared/ai/skills/om-evolve-harness/SKILL.md +0 -29
- package/agentic/shared/ai/skills/om-evolve-harness/references/case-template.md +0 -100
- package/agentic/shared/ai/skills/om-evolve-harness/references/case-workflow.md +0 -16
- package/agentic/shared/ai/skills/om-evolve-harness/references/owner-selection.md +0 -17
- package/agentic/shared/ai/skills/om-framework-context/SKILL.md +0 -25
- package/agentic/shared/ai/skills/om-framework-context/references/resolver-procedure.md +0 -11
- package/agentic/shared/ai/skills/om-framework-context/references/skew-and-escalation.md +0 -13
- package/agentic/shared/ai/skills/om-help/references/delivery-workflows.md +0 -18
- package/agentic/shared/ai/skills/om-help/references/task-families.md +0 -20
- package/agentic/shared/ai/skills/om-implement-spec/references/phases-and-gates.md +0 -33
- package/agentic/shared/ai/skills/om-implement-spec/references/planning-and-progress.md +0 -40
- package/agentic/shared/ai/skills/om-implement-spec/references/report-templates.md +0 -27
- package/agentic/shared/ai/skills/om-implement-spec/references/spec-resolution.md +0 -24
- package/agentic/shared/ai/skills/om-integration-builder/references/package-and-activation.md +0 -16
- package/agentic/shared/ai/skills/om-integration-builder/references/provider-families.md +0 -14
- package/agentic/shared/ai/skills/om-integration-builder/references/security-and-reliability.md +0 -15
- package/agentic/shared/ai/skills/om-integration-builder/references/sync-and-files.md +0 -12
- package/agentic/shared/ai/skills/om-judge-agent-session/SKILL.md +0 -34
- package/agentic/shared/ai/skills/om-judge-agent-session/agents/openai.yaml +0 -4
- package/agentic/shared/ai/skills/om-judge-agent-session/references/agentic-setup.md +0 -11
- package/agentic/shared/ai/skills/om-judge-agent-session/references/input-normalization.md +0 -31
- package/agentic/shared/ai/skills/om-judge-agent-session/references/judge-workflow.md +0 -39
- package/agentic/shared/ai/skills/om-judge-agent-session/references/report-template.md +0 -43
- package/agentic/shared/ai/skills/om-judge-agent-session/references/rules.md +0 -11
- package/agentic/shared/ai/skills/om-module-scaffold/references/api-and-domain.md +0 -19
- package/agentic/shared/ai/skills/om-module-scaffold/references/business-one-shot-blueprints.md +0 -172
- package/agentic/shared/ai/skills/om-module-scaffold/references/data-and-migrations.md +0 -12
- package/agentic/shared/ai/skills/om-module-scaffold/references/discovery-surface-catalog.md +0 -83
- package/agentic/shared/ai/skills/om-module-scaffold/references/module-surfaces.md +0 -21
- package/agentic/shared/ai/skills/om-module-scaffold/references/planning.md +0 -11
- package/agentic/shared/ai/skills/om-module-scaffold/references/runtime-cache-and-queues.md +0 -22
- package/agentic/shared/ai/skills/om-module-scaffold/references/verification.md +0 -13
- package/agentic/shared/ai/skills/om-share-this-session/SKILL.md +0 -41
- package/agentic/shared/ai/skills/om-share-this-session/references/agentic-setup.md +0 -19
- package/agentic/shared/ai/skills/om-share-this-session/references/bundle-preparation.md +0 -44
- package/agentic/shared/ai/skills/om-share-this-session/references/consent-and-review.md +0 -39
- package/agentic/shared/ai/skills/om-share-this-session/references/publication.md +0 -20
- package/agentic/shared/ai/skills/om-share-this-session/references/report-templates.md +0 -57
- package/agentic/shared/ai/skills/om-share-this-session/references/rules.md +0 -11
- package/agentic/shared/ai/skills/om-share-this-session/scripts/prepare-share-bundle.mjs +0 -486
- package/agentic/shared/ai/skills/om-system-extension/references/extension-branches.md +0 -18
- package/agentic/shared/ai/skills/om-system-extension/references/mechanism-selector.md +0 -27
- package/agentic/shared/ai/skills/om-system-extension/references/read-write-roundtrip.md +0 -13
- package/agentic/shared/ai/skills/om-system-extension/references/unified-overrides.md +0 -41
- package/agentic/shared/ai/skills/om-system-extension/references/verification.md +0 -11
- package/agentic/shared/ai/skills/om-trim-unused-modules/references/dependency-and-redirect.md +0 -15
- package/agentic/shared/ai/skills/om-troubleshooter/references/diagnosis-map.md +0 -16
- package/agentic/shared/ai/skills/om-troubleshooter/references/regression-oracles.md +0 -14
- package/agentic/shared/scripts/agent-harness-tool-server.mjs +0 -187
- package/agentic/shared/scripts/check-lessons.mjs +0 -178
- package/agentic/shared/scripts/evaluate-agent-harness.mjs +0 -2958
- package/agentic/shared/scripts/execution-sandbox.mjs +0 -329
- package/agentic/shared/scripts/framework-context.mjs +0 -888
- package/agentic/shared/scripts/install-skills.mjs +0 -1029
- package/agentic/shared/scripts/prepare-agent-harness-fixture.mjs +0 -222
- package/agentic/shared/scripts/run-agent-harness-release.mjs +0 -1774
- package/dist/agentic/guides/ai-workflows.md +0 -76
- package/dist/agentic/guides/architecture.md +0 -107
- package/dist/agentic/guides/backend-ui.md +0 -80
- package/dist/agentic/guides/contracts.md +0 -92
- package/dist/agentic/guides/extensions.md +0 -121
- package/dist/agentic/guides/framework-extension-points.md +0 -36
- package/dist/agentic/guides/integrations.md +0 -81
- package/dist/agentic/guides/modules/design_system.md +0 -102
- package/dist/agentic/guides/spec-delivery.md +0 -22
- package/dist/agentic/guides/testing-debugging.md +0 -80
- package/dist/agentic/guides/upstream/AGENTS.md +0 -298
- package/dist/agentic/guides/upstream/BACKWARD_COMPATIBILITY.md +0 -316
- package/dist/agentic/guides/upstream/manifest.json +0 -8
- package/dist/agentic/shared/ai/harness/README.md +0 -50
- package/dist/agentic/shared/ai/harness/RELEASE.md +0 -57
- package/dist/agentic/shared/ai/harness/cases.json +0 -13680
- package/dist/agentic/shared/ai/harness/cases.schema.json +0 -133
- package/dist/agentic/shared/ai/harness/fixtures/index.json +0 -49
- package/dist/agentic/shared/ai/harness/fixtures/seeds.json +0 -162
- package/dist/agentic/shared/ai/harness/generated-code-review-policy.md +0 -21
- package/dist/agentic/shared/ai/harness/generated-code-review-response.schema.json +0 -96
- package/dist/agentic/shared/ai/harness/generated-code-review-result.schema.json +0 -172
- package/dist/agentic/shared/ai/harness/release-matrix.json +0 -158
- package/dist/agentic/shared/ai/harness/release-result.schema.json +0 -219
- package/dist/agentic/shared/ai/harness/result.schema.json +0 -76
- package/dist/agentic/shared/ai/harness/routing-response.schema.json +0 -12
- package/dist/agentic/shared/ai/harness/target-validation-result.schema.json +0 -73
- package/dist/agentic/shared/ai/harness/validators.json +0 -78
- package/dist/agentic/shared/ai/harness/writable-ast-oracles.mjs +0 -2121
- package/dist/agentic/shared/ai/harness/writable-behavior-oracles.mjs +0 -1096
- package/dist/agentic/shared/ai/lessons/_template.md +0 -16
- package/dist/agentic/shared/ai/review-checklist.md +0 -36
- package/dist/agentic/shared/ai/skills/om-auto-implement-spec/SKILL.md +0 -21
- package/dist/agentic/shared/ai/skills/om-auto-upgrade-0.6.6-to-0.6.7/SKILL.md +0 -98
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/crud-surfaces.md +0 -16
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/frontend-and-design-system.md +0 -53
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/page-and-navigation.md +0 -13
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/quality-states.md +0 -11
- package/dist/agentic/shared/ai/skills/om-build-workflow/SKILL.md +0 -30
- package/dist/agentic/shared/ai/skills/om-build-workflow/references/activity-contracts.md +0 -12
- package/dist/agentic/shared/ai/skills/om-build-workflow/references/durability-and-progress.md +0 -13
- package/dist/agentic/shared/ai/skills/om-build-workflow/references/workflow-design.md +0 -14
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/SKILL.md +0 -28
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/references/attachments-and-overrides.md +0 -12
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/references/module-agents-and-tools.md +0 -22
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/references/orchestrator-agents.md +0 -12
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/references/surface-selector.md +0 -19
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/integrity-and-concurrency.md +0 -19
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/migration-workflow.md +0 -13
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/schema-design.md +0 -14
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/sensitive-data.md +0 -10
- package/dist/agentic/shared/ai/skills/om-eject-and-customize/references/decision-and-procedure.md +0 -17
- package/dist/agentic/shared/ai/skills/om-evolve-harness/SKILL.md +0 -29
- package/dist/agentic/shared/ai/skills/om-evolve-harness/references/case-template.md +0 -100
- package/dist/agentic/shared/ai/skills/om-evolve-harness/references/case-workflow.md +0 -16
- package/dist/agentic/shared/ai/skills/om-evolve-harness/references/owner-selection.md +0 -17
- package/dist/agentic/shared/ai/skills/om-framework-context/SKILL.md +0 -25
- package/dist/agentic/shared/ai/skills/om-framework-context/references/resolver-procedure.md +0 -11
- package/dist/agentic/shared/ai/skills/om-framework-context/references/skew-and-escalation.md +0 -13
- package/dist/agentic/shared/ai/skills/om-help/references/delivery-workflows.md +0 -18
- package/dist/agentic/shared/ai/skills/om-help/references/task-families.md +0 -20
- package/dist/agentic/shared/ai/skills/om-implement-spec/references/phases-and-gates.md +0 -33
- package/dist/agentic/shared/ai/skills/om-implement-spec/references/planning-and-progress.md +0 -40
- package/dist/agentic/shared/ai/skills/om-implement-spec/references/report-templates.md +0 -27
- package/dist/agentic/shared/ai/skills/om-implement-spec/references/spec-resolution.md +0 -24
- package/dist/agentic/shared/ai/skills/om-integration-builder/references/package-and-activation.md +0 -16
- package/dist/agentic/shared/ai/skills/om-integration-builder/references/provider-families.md +0 -14
- package/dist/agentic/shared/ai/skills/om-integration-builder/references/security-and-reliability.md +0 -15
- package/dist/agentic/shared/ai/skills/om-integration-builder/references/sync-and-files.md +0 -12
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/SKILL.md +0 -34
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/agents/openai.yaml +0 -4
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/agentic-setup.md +0 -11
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/input-normalization.md +0 -31
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/judge-workflow.md +0 -39
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/report-template.md +0 -43
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/rules.md +0 -11
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/api-and-domain.md +0 -19
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/business-one-shot-blueprints.md +0 -172
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/data-and-migrations.md +0 -12
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/discovery-surface-catalog.md +0 -83
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/module-surfaces.md +0 -21
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/planning.md +0 -11
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/runtime-cache-and-queues.md +0 -22
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/verification.md +0 -13
- package/dist/agentic/shared/ai/skills/om-share-this-session/SKILL.md +0 -41
- package/dist/agentic/shared/ai/skills/om-share-this-session/references/agentic-setup.md +0 -19
- package/dist/agentic/shared/ai/skills/om-share-this-session/references/bundle-preparation.md +0 -44
- package/dist/agentic/shared/ai/skills/om-share-this-session/references/consent-and-review.md +0 -39
- package/dist/agentic/shared/ai/skills/om-share-this-session/references/publication.md +0 -20
- package/dist/agentic/shared/ai/skills/om-share-this-session/references/report-templates.md +0 -57
- package/dist/agentic/shared/ai/skills/om-share-this-session/references/rules.md +0 -11
- package/dist/agentic/shared/ai/skills/om-share-this-session/scripts/prepare-share-bundle.mjs +0 -486
- package/dist/agentic/shared/ai/skills/om-system-extension/references/extension-branches.md +0 -18
- package/dist/agentic/shared/ai/skills/om-system-extension/references/mechanism-selector.md +0 -27
- package/dist/agentic/shared/ai/skills/om-system-extension/references/read-write-roundtrip.md +0 -13
- package/dist/agentic/shared/ai/skills/om-system-extension/references/unified-overrides.md +0 -41
- package/dist/agentic/shared/ai/skills/om-system-extension/references/verification.md +0 -11
- package/dist/agentic/shared/ai/skills/om-trim-unused-modules/references/dependency-and-redirect.md +0 -15
- package/dist/agentic/shared/ai/skills/om-troubleshooter/references/diagnosis-map.md +0 -16
- package/dist/agentic/shared/ai/skills/om-troubleshooter/references/regression-oracles.md +0 -14
- package/dist/agentic/shared/scripts/agent-harness-tool-server.mjs +0 -187
- package/dist/agentic/shared/scripts/check-lessons.mjs +0 -178
- package/dist/agentic/shared/scripts/evaluate-agent-harness.mjs +0 -2958
- package/dist/agentic/shared/scripts/execution-sandbox.mjs +0 -329
- package/dist/agentic/shared/scripts/framework-context.mjs +0 -888
- package/dist/agentic/shared/scripts/install-skills.mjs +0 -1029
- package/dist/agentic/shared/scripts/prepare-agent-harness-fixture.mjs +0 -222
- package/dist/agentic/shared/scripts/run-agent-harness-release.mjs +0 -1774
- package/template/jest.setup.ts +0 -29
- package/template/scripts/dev-memory-monitor.mjs +0 -92
- package/template/scripts/dev-memory-sampler.mjs +0 -464
- package/template/scripts/evaluate-agent-harness.mjs +0 -4
- package/template/scripts/framework-context.mjs +0 -4
- package/template/scripts/install-skills.mjs +0 -10
- package/template/scripts/prepare-agent-harness-fixture.mjs +0 -4
- package/template/scripts/run-agent-harness-release.mjs +0 -4
- package/template/src/components/__tests__/StartPageContent.test.tsx +0 -69
- package/template/src/components/__tests__/starter-chrome-ds.test.ts +0 -35
- package/template/src/i18n/ko.json +0 -970
- package/template/src/modules/example/__integration__/TC-EXAMPLE-001-todo-label-edit.spec.ts +0 -123
- package/template/src/modules/example/__integration__/TC-EXAMPLE-002-query-index-failure.spec.ts +0 -155
- package/template/src/modules/example/commands/__tests__/todos.prepare-scope.test.ts +0 -77
- package/template/src/modules/example/i18n/ko.json +0 -481
- package/template/src/modules/example_customers_sync/i18n/ko.json +0 -11
package/README.md
CHANGED
|
@@ -35,8 +35,6 @@ npx create-mercato-app <app-name> [options]
|
|
|
35
35
|
|--------|-------------|
|
|
36
36
|
| `--app <name>` | Bootstrap an official Open Mercato ready app from `open-mercato/ready-app-<name>` |
|
|
37
37
|
| `--app-url <url>` | Bootstrap a ready app from a GitHub repository URL |
|
|
38
|
-
| `--preset <id>` | Select the `classic`, `empty`, or `crm` starter without prompting |
|
|
39
|
-
| `--agents <list>` | Set up `claude-code`, `codex`, `cursor`, a comma-separated subset, `all`, or `none` without prompting |
|
|
40
38
|
| `--skip-agentic-setup` | Skip the interactive agentic setup wizard |
|
|
41
39
|
| `--init-git` | Initialize a local Git repository after scaffolding |
|
|
42
40
|
| `--no-init-git` | Do not prompt for or initialize a local Git repository |
|
|
@@ -66,12 +64,6 @@ npx create-mercato-app my-store --registry http://localhost:4873
|
|
|
66
64
|
# Create a new app without the agentic setup wizard
|
|
67
65
|
npx create-mercato-app my-store --skip-agentic-setup
|
|
68
66
|
|
|
69
|
-
# Create a classic app with every supported AI coding-tool configuration
|
|
70
|
-
npx create-mercato-app my-store --preset classic --agents all
|
|
71
|
-
|
|
72
|
-
# Set up only Claude Code and Codex
|
|
73
|
-
npx create-mercato-app my-store --agents claude-code,codex
|
|
74
|
-
|
|
75
67
|
# Create a new app and initialize a local Git repository
|
|
76
68
|
npx create-mercato-app my-store --init-git
|
|
77
69
|
```
|
|
@@ -84,72 +76,8 @@ npx create-mercato-app my-store --init-git
|
|
|
84
76
|
- `--skip-agentic-setup` skips only the interactive agentic setup wizard
|
|
85
77
|
- Imported ready apps are copied as raw source snapshots: the CLI does not rewrite dependency versions, package names, or application source files
|
|
86
78
|
- Imported ready apps skip the interactive agentic setup wizard; if you want agentic tooling later, run `yarn mercato agentic:init` inside the generated app
|
|
87
|
-
- `--agents` is only supported for bare scaffolds; use `yarn mercato agentic:init` after importing a ready app
|
|
88
79
|
- Imported ready apps must not contain `.template` files; the scaffold fails closed if template files are found
|
|
89
80
|
|
|
90
|
-
## Standalone AI Harness
|
|
91
|
-
|
|
92
|
-
A bare scaffold can install a standalone-specific AI development harness for Claude Code, Codex, Cursor, or any selected subset. It combines a compact task router, module/task guides, local skills, an integrity-pinned subset of `open-mercato/skills`, exact installed-framework context, and a reproducible evaluation catalog.
|
|
93
|
-
|
|
94
|
-
### Install or refresh skills
|
|
95
|
-
|
|
96
|
-
Agentic setup attempts installation automatically. Re-run it after cloning, after an offline setup, or when selecting another tier:
|
|
97
|
-
|
|
98
|
-
```bash
|
|
99
|
-
yarn install-skills --list
|
|
100
|
-
yarn install-skills
|
|
101
|
-
yarn install-skills --with automation # opt in to loop/issue/release-maintenance workflows
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
The default is the 13 local core skills plus the 15-skill dependency-closed daily external tier. Advanced loop engines, issue authoring, and upgrade-note maintenance stay opt-in through `--with automation` (or `--all`). `.agents/skills/` is canonical; Claude Code receives compatibility links. The installer downloads the exact pinned `open-mercato/skills` archive, copies only individually hash-attested skill directories, and never executes archive or package-runner code. It activates the selected external set as one transaction: any failure restores the complete previous set before local installation continues. It preserves unknown user-owned skills and quarantines stale or modified installer-owned content.
|
|
105
|
-
|
|
106
|
-
### Upgrade an existing generated harness
|
|
107
|
-
|
|
108
|
-
After upgrading Open Mercato, refresh generated harness assets without overwriting local context:
|
|
109
|
-
|
|
110
|
-
```bash
|
|
111
|
-
yarn mercato agentic:init --update-harness
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
The ownership-aware update replaces unchanged generated files, recreates missing owned files, and refreshes the manifest atomically. Modified or unknown files remain in place; exact generated-path conflicts get an adjacent `.incoming` candidate. Managed paths are resolved below the canonical app root and a symlinked ancestor is rejected before publication. Use `--force` only when intentionally replacing known generated targets. External skill installation is a separate retryable phase, so offline installation does not roll back the harness update.
|
|
115
|
-
|
|
116
|
-
### Resolve installed framework context
|
|
117
|
-
|
|
118
|
-
Use the escape hatch when the routed guides do not contain an exact contract. It resolves the package versions selected by the app and their source/`AGENTS.md` chain without bulk-loading dependencies:
|
|
119
|
-
|
|
120
|
-
```bash
|
|
121
|
-
yarn framework:context --module customers --query makeCrudRoute
|
|
122
|
-
yarn framework:context --package @open-mercato/ui --query CrudForm
|
|
123
|
-
yarn framework:context --root
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
Bounded snapshots are written under ignored `.ai/framework-context/`; warnings make degraded dist/type-only context explicit.
|
|
127
|
-
|
|
128
|
-
### Evaluate and maintain the harness
|
|
129
|
-
|
|
130
|
-
Use deterministic checks during development:
|
|
131
|
-
|
|
132
|
-
```bash
|
|
133
|
-
yarn harness:validate --case OMH-009
|
|
134
|
-
yarn harness:validate --family testing
|
|
135
|
-
yarn harness:validate --all
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
`harness:validate --all` is the deterministic catalog gate, not the full release suite. Authenticated `--runner codex` / `--runner claude` live routing uses host filesystem containment on macOS (`sandbox-exec`) and Linux (Bubblewrap). The model gets no shell, process, environment, discovery, browser, or network tool: both CLIs receive only an evaluator-owned, `env -i` MCP server for exact-path reads and case-allowlisted writes. The selected app is intentionally readable through that narrow tool, so use a fresh or otherwise non-sensitive generated app. macOS `sandbox-exec` can enforce network-free lanes but cannot isolate loopback from the host; native macOS and Windows must use a contained Linux VM/container with Bubblewrap for the complete release gate.
|
|
139
|
-
|
|
140
|
-
Run the full matrix once per Open Mercato release from a fresh scaffold:
|
|
141
|
-
|
|
142
|
-
```bash
|
|
143
|
-
yarn install-skills
|
|
144
|
-
yarn harness:release --runner codex --prepare-targets /absolute/empty-release-targets --acknowledge-writes
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
The target directory must be absolute, new or empty, and outside the controller app. Select one blocking primary runner with `--runner codex` or `--runner claude`; it owns all 203 routing cases and every writable/review lane, with no per-case fallback. Optionally add the different authenticated runner through `--portability-runner` for the exact 46-case representative read-only lane. Omitting it is valid and recorded as not requested; once requested, its failures are blocking. Use a fresh, sanitized controller: automatic preparation fails before copying `.env`/`.env.*` local configuration (safe example/sample/template files remain allowed), credential files, or private-key files. The complete gate requires Linux with trusted system Bubblewrap (`bwrap`) and user namespaces because its Playwright API/browser lanes need a loopback namespace isolated from the host. Preflight rejects untrusted/no-op/pass-through executables and proves isolated loopback plus a capability-free payload before target preparation, provider invocation, or writes; native macOS and Windows therefore fail closed. The command also fails closed when a required runner, browser, or test runtime is unavailable. The 203-case catalog includes 93 framework-neutral business prompts and 46 writable implementation/regression cases (22.7%). The release command runs live routing, writable trusted oracles, per-target `generate`/`typecheck`/`lint`/`build`, any declared generated test, and isolated generated-code review for every writable result. Foundation and target validation—including `yarn build`—receive a minimal environment with network access denied, and persisted diagnostics redact sensitive environment values and URL userinfo. Test-authoring coverage executes a Jest unit test plus Linux/Bubblewrap loopback-only Playwright API and browser tests through fixed controller-owned commands against a read-only target; runtime reports must attest at least one passed test and zero skipped, todo, focused, flaky, or expected-failure tests. The suite then writes a schema-valid sanitized mode-`0600` report under `.ai/harness/results/` with the selected primary and optional portability runner policy.
|
|
148
|
-
|
|
149
|
-
Use the bundled `om-evolve-harness` skill to add a real case: reproduce failure first, select one smallest knowledge owner, run any generated unit/integration tests plus target checks, require code review, and finish with the full release suite. Open Mercato framework maintainers use the monorepo-only `$om-refresh-standalone-harness --from <ref> --to <ref>` workflow for every release range and retain its sanitized maintenance report.
|
|
150
|
-
|
|
151
|
-
For normal app changes, describe the business outcome directly or use the installed spec workflow for multi-phase work. Before handoff, run `yarn generate`, the smallest affected unit/integration tests, `yarn typecheck`, `yarn lint`, and `yarn build` as appropriate; applying migrations still requires explicit approval.
|
|
152
|
-
|
|
153
81
|
## Git And GitHub
|
|
154
82
|
|
|
155
83
|
Interactive scaffolds ask whether to initialize a local Git repository after the app is created. Non-interactive scaffolds skip Git initialization unless `--init-git` is passed.
|
|
@@ -1,65 +1,121 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Claude Code PostToolUse hook: entity-migration-check
|
|
3
|
+
*
|
|
4
|
+
* Fires after Write/Edit/MultiEdit. Detects entity file modifications
|
|
5
|
+
* without an accompanying migration and blocks the agent with a reminder.
|
|
6
|
+
*
|
|
7
|
+
* Three-state logic:
|
|
8
|
+
* 1. Migration file was written → exit 0 (agent is already on it)
|
|
9
|
+
* 2. Not an entity file → exit 0 (not relevant)
|
|
10
|
+
* 3. Entity written, no fresh migration → block with migration instructions
|
|
11
|
+
*/
|
|
12
|
+
|
|
2
13
|
import { readdirSync, statSync } from 'node:fs'
|
|
3
14
|
import { join, relative } from 'node:path'
|
|
4
15
|
|
|
5
|
-
const ENTITY_PATTERN = /^src\/modules\/([^/]+)\/
|
|
6
|
-
const MIGRATION_PATTERN = /^src\/modules\/([^/]+)\/migrations
|
|
16
|
+
const ENTITY_PATTERN = /^src\/modules\/([^/]+)\/entities\/.*\.ts$/
|
|
17
|
+
const MIGRATION_PATTERN = /^src\/modules\/([^/]+)\/migrations\/.*\.ts$/
|
|
7
18
|
|
|
8
19
|
interface PostToolUseInput {
|
|
9
|
-
tool_input?: {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
20
|
+
tool_input?: {
|
|
21
|
+
file_path?: string
|
|
22
|
+
content?: string
|
|
23
|
+
}
|
|
24
|
+
tool_name?: string
|
|
14
25
|
}
|
|
15
26
|
|
|
16
|
-
function
|
|
17
|
-
const
|
|
18
|
-
|
|
27
|
+
function getRelativePath(filePath: string): string {
|
|
28
|
+
const projectDir = process.env.CLAUDE_PROJECT_DIR || process.cwd()
|
|
29
|
+
if (filePath.startsWith('/')) {
|
|
30
|
+
return relative(projectDir, filePath)
|
|
31
|
+
}
|
|
32
|
+
return filePath
|
|
19
33
|
}
|
|
20
34
|
|
|
21
35
|
function hasFreshMigration(moduleId: string): boolean {
|
|
22
|
-
const
|
|
36
|
+
const projectDir = process.env.CLAUDE_PROJECT_DIR || process.cwd()
|
|
37
|
+
const migrationsDir = join(projectDir, 'src', 'modules', moduleId, 'migrations')
|
|
38
|
+
|
|
23
39
|
try {
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
40
|
+
const files = readdirSync(migrationsDir)
|
|
41
|
+
const now = Date.now()
|
|
42
|
+
const thirtySecondsAgo = now - 30_000
|
|
43
|
+
|
|
44
|
+
for (const file of files) {
|
|
45
|
+
if (!file.endsWith('.ts')) continue
|
|
46
|
+
const stat = statSync(join(migrationsDir, file))
|
|
47
|
+
if (stat.mtimeMs > thirtySecondsAgo) {
|
|
48
|
+
return true
|
|
49
|
+
}
|
|
50
|
+
}
|
|
28
51
|
} catch {
|
|
29
|
-
|
|
52
|
+
// migrations directory doesn't exist yet — that's fine
|
|
30
53
|
}
|
|
54
|
+
|
|
55
|
+
return false
|
|
31
56
|
}
|
|
32
57
|
|
|
33
58
|
async function main(): Promise<void> {
|
|
34
59
|
let input = ''
|
|
35
|
-
for await (const chunk of process.stdin)
|
|
36
|
-
|
|
60
|
+
for await (const chunk of process.stdin) {
|
|
61
|
+
input += chunk
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (!input.trim()) {
|
|
65
|
+
process.exit(0)
|
|
66
|
+
}
|
|
37
67
|
|
|
38
68
|
let data: PostToolUseInput
|
|
39
69
|
try {
|
|
40
70
|
data = JSON.parse(input)
|
|
41
71
|
} catch {
|
|
42
|
-
|
|
72
|
+
process.exit(0)
|
|
43
73
|
}
|
|
44
74
|
|
|
45
75
|
const filePath = data.tool_input?.file_path
|
|
46
|
-
if (!filePath)
|
|
47
|
-
|
|
48
|
-
|
|
76
|
+
if (!filePath) {
|
|
77
|
+
process.exit(0)
|
|
78
|
+
}
|
|
49
79
|
|
|
50
|
-
const
|
|
51
|
-
if (!match || hasFreshMigration(match[1])) return
|
|
80
|
+
const rel = getRelativePath(filePath)
|
|
52
81
|
|
|
53
|
-
|
|
82
|
+
// State 1: Migration file was written → agent is already handling it
|
|
83
|
+
if (MIGRATION_PATTERN.test(rel)) {
|
|
84
|
+
process.exit(0)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// State 2: Not an entity file → not relevant
|
|
88
|
+
const entityMatch = rel.match(ENTITY_PATTERN)
|
|
89
|
+
if (!entityMatch) {
|
|
90
|
+
process.exit(0)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const moduleId = entityMatch[1]
|
|
94
|
+
|
|
95
|
+
// State 3: Entity written — check for fresh migration
|
|
96
|
+
if (hasFreshMigration(moduleId)) {
|
|
97
|
+
process.exit(0)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Block: entity modified without migration
|
|
101
|
+
const result = {
|
|
54
102
|
decision: 'block',
|
|
55
103
|
reason: [
|
|
56
|
-
`Entity
|
|
104
|
+
`Entity file modified: ${rel}`,
|
|
105
|
+
'',
|
|
106
|
+
`Affected module: ${moduleId}`,
|
|
107
|
+
'',
|
|
108
|
+
'A database migration is likely needed. Ask the user whether to run:',
|
|
109
|
+
' yarn db:generate',
|
|
57
110
|
'',
|
|
58
|
-
'
|
|
59
|
-
'
|
|
60
|
-
'
|
|
111
|
+
'Then regenerate registries:',
|
|
112
|
+
' yarn generate',
|
|
113
|
+
'',
|
|
114
|
+
'Do NOT run migrations automatically — always confirm with the user first.',
|
|
61
115
|
].join('\n'),
|
|
62
|
-
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
process.stdout.write(JSON.stringify(result))
|
|
63
119
|
}
|
|
64
120
|
|
|
65
|
-
|
|
121
|
+
main()
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
<!-- CODEX_ENFORCEMENT_RULES_START -->
|
|
2
|
-
##
|
|
2
|
+
## CRITICAL rules — always follow without exception
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
1. **After editing any entity file** (`src/modules/<id>/entities/*.ts`):
|
|
5
|
+
- STOP immediately before any further action
|
|
6
|
+
- Tell the user: "I modified an entity in module <id>. Should I create a migration?"
|
|
7
|
+
- If yes: run `yarn mercato db generate`
|
|
8
|
+
- Show the generated migration to the user before applying
|
|
9
|
+
- Ask for confirmation, then run `yarn mercato db migrate`
|
|
10
|
+
- Run `yarn generate` after migration is applied
|
|
5
11
|
|
|
12
|
+
2. **After editing `src/modules.ts`**: immediately run `yarn generate`
|
|
13
|
+
|
|
14
|
+
3. **Never edit `.mercato/generated/*`**: edit the source and run `yarn generate` instead
|
|
15
|
+
|
|
16
|
+
4. **Before significant features**: check `.ai/specs/` for an existing spec.
|
|
17
|
+
If none exists, ask the user whether to create one first.
|
|
18
|
+
|
|
19
|
+
---
|
|
6
20
|
<!-- CODEX_ENFORCEMENT_RULES_END -->
|
|
@@ -1,38 +1,69 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Cursor afterFileEdit hook: entity-migration-check
|
|
3
|
+
*
|
|
4
|
+
* Detects entity file modifications without an accompanying migration
|
|
5
|
+
* and exits non-zero to block the agent with a reminder.
|
|
6
|
+
*
|
|
7
|
+
* Three-state logic:
|
|
8
|
+
* 1. Migration file was written → exit 0 (agent is already on it)
|
|
9
|
+
* 2. Not an entity file → exit 0 (not relevant)
|
|
10
|
+
* 3. Entity written, no fresh migration → exit 1 with warning
|
|
11
|
+
*/
|
|
12
|
+
|
|
2
13
|
import { readdirSync, statSync } from 'node:fs'
|
|
3
|
-
import { join,
|
|
14
|
+
import { join, resolve } from 'node:path'
|
|
4
15
|
|
|
5
|
-
const ENTITY_RE = /^src\/modules\/([^/]+)\/
|
|
6
|
-
const MIGRATION_RE = /^src\/modules\/([^/]+)\/migrations
|
|
16
|
+
const ENTITY_RE = /^src\/modules\/([^/]+)\/entities\/.*\.ts$/
|
|
17
|
+
const MIGRATION_RE = /^src\/modules\/([^/]+)\/migrations\/.*\.ts$/
|
|
7
18
|
|
|
8
19
|
function hasFreshMigration(projectDir, moduleId) {
|
|
9
20
|
const migrationsDir = join(projectDir, 'src', 'modules', moduleId, 'migrations')
|
|
10
21
|
try {
|
|
22
|
+
const files = readdirSync(migrationsDir)
|
|
11
23
|
const cutoff = Date.now() - 30_000
|
|
12
|
-
|
|
13
|
-
file.endsWith('.ts')
|
|
14
|
-
|
|
24
|
+
for (const file of files) {
|
|
25
|
+
if (!file.endsWith('.ts')) continue
|
|
26
|
+
const stat = statSync(join(migrationsDir, file))
|
|
27
|
+
if (stat.mtimeMs > cutoff) return true
|
|
28
|
+
}
|
|
15
29
|
} catch {
|
|
16
|
-
|
|
30
|
+
// migrations directory doesn't exist yet
|
|
17
31
|
}
|
|
32
|
+
return false
|
|
18
33
|
}
|
|
19
34
|
|
|
20
35
|
const filePath = process.argv[2]
|
|
21
36
|
if (!filePath) process.exit(0)
|
|
22
37
|
|
|
23
38
|
const projectDir = resolve('.')
|
|
24
|
-
const rel =
|
|
39
|
+
const rel = filePath.startsWith('/') ? filePath.slice(projectDir.length + 1) : filePath
|
|
40
|
+
|
|
41
|
+
// State 1: Migration file written
|
|
25
42
|
if (MIGRATION_RE.test(rel)) process.exit(0)
|
|
26
43
|
|
|
44
|
+
// State 2: Not an entity file
|
|
27
45
|
const match = rel.match(ENTITY_RE)
|
|
28
|
-
if (!match
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
46
|
+
if (!match) process.exit(0)
|
|
47
|
+
|
|
48
|
+
const moduleId = match[1]
|
|
49
|
+
|
|
50
|
+
// State 3: Entity file without fresh migration
|
|
51
|
+
if (hasFreshMigration(projectDir, moduleId)) process.exit(0)
|
|
52
|
+
|
|
53
|
+
process.stderr.write(
|
|
54
|
+
[
|
|
55
|
+
`Entity file modified: ${rel}`,
|
|
56
|
+
'',
|
|
57
|
+
`Affected module: ${moduleId}`,
|
|
58
|
+
'',
|
|
59
|
+
'A database migration is likely needed. Ask the user whether to run:',
|
|
60
|
+
' yarn db:generate',
|
|
61
|
+
'',
|
|
62
|
+
'Then regenerate registries:',
|
|
63
|
+
' yarn generate',
|
|
64
|
+
'',
|
|
65
|
+
'Do NOT run migrations automatically — always confirm with the user first.',
|
|
66
|
+
'',
|
|
67
|
+
].join('\n'),
|
|
68
|
+
)
|
|
38
69
|
process.exit(1)
|
|
@@ -1,17 +1,29 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Entity
|
|
2
|
+
description: Entity modification guard — triggers migration workflow
|
|
3
3
|
globs:
|
|
4
|
-
- src/modules/*/
|
|
4
|
+
- src/modules/*/entities/**/*.ts
|
|
5
5
|
alwaysApply: false
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
# Entity
|
|
8
|
+
# Entity Modification — Migration Required
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
You are editing an entity file. After saving, you MUST:
|
|
11
11
|
|
|
12
|
-
1.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
1. **Create a migration** — ask the user before running:
|
|
13
|
+
```
|
|
14
|
+
yarn db:generate
|
|
15
|
+
```
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
2. **Show the migration** to the user and wait for confirmation before applying
|
|
18
|
+
|
|
19
|
+
3. **Apply the migration** (only after user confirms):
|
|
20
|
+
```
|
|
21
|
+
yarn db:migrate
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
4. **Regenerate registries**:
|
|
25
|
+
```
|
|
26
|
+
yarn generate
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Do NOT skip any step. Do NOT run migrations without user confirmation.
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Prevent
|
|
2
|
+
description: Prevent editing auto-generated files
|
|
3
3
|
globs:
|
|
4
4
|
- .mercato/generated/**
|
|
5
5
|
alwaysApply: false
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
# Generated
|
|
8
|
+
# NEVER Edit Generated Files
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
This file is auto-generated by `yarn generate`. Any manual edits will be overwritten.
|
|
11
|
+
|
|
12
|
+
To change generated output, edit the source modules in `src/modules/` and run `yarn generate`.
|
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
---
|
|
2
|
-
description:
|
|
2
|
+
description: Core Open Mercato conventions for standalone app development
|
|
3
3
|
alwaysApply: true
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# {{PROJECT_NAME}} —
|
|
6
|
+
# {{PROJECT_NAME}} — Project Rules
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
## What this project is
|
|
9
|
+
|
|
10
|
+
A standalone Open Mercato application. Build domain features ON TOP of the framework.
|
|
11
|
+
To customise a core module beyond the extension system: `yarn mercato eject <module>`.
|
|
12
|
+
Never edit node_modules/@open-mercato/* directly.
|
|
13
|
+
|
|
14
|
+
## Task routing
|
|
15
|
+
|
|
16
|
+
Read AGENTS.md before starting any task — it maps task types to the minimum files to load.
|
|
17
|
+
|
|
18
|
+
## Module system
|
|
19
|
+
|
|
20
|
+
Modules in `src/modules/<id>/`. Register with `from: '@app'` in `src/modules.ts`.
|
|
21
|
+
Run `yarn generate` after any module or entity change. Never edit `.mercato/generated/*`.
|
|
22
|
+
|
|
23
|
+
## Entity and migration rule
|
|
24
|
+
|
|
25
|
+
After editing any entity in `src/modules/<id>/entities/`:
|
|
26
|
+
1. Create migration: `yarn db:generate`
|
|
27
|
+
2. Show migration to user, confirm before applying
|
|
28
|
+
3. Apply: `yarn db:migrate`
|
|
29
|
+
4. Regenerate: `yarn generate`
|
|
30
|
+
|
|
31
|
+
## Spec-driven development
|
|
32
|
+
|
|
33
|
+
Check `.ai/specs/` before any significant feature. If no spec exists, ask the user
|
|
34
|
+
whether to create one first.
|
|
@@ -1,15 +1,130 @@
|
|
|
1
|
-
# Module System
|
|
1
|
+
# Open Mercato Module System — Conceptual Guide
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This is the **hand-written, conceptual** layer of the module guides. It explains how an Open Mercato module is structured and how to build or extend one — the timeless concepts that rarely change. It is framework-wide; it does **not** describe any single module's data.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## How the guides are layered
|
|
6
|
+
|
|
7
|
+
- **Layer 1 — this file (`.ai/guides/module-system.md`):** conceptual and framework-wide. Module anatomy, auto-discovery, naming, the mandatory mechanisms, data-integrity rules, and the generate/migration workflow.
|
|
8
|
+
- **Layer 2 — generated per-module fact-sheets (`.ai/guides/modules/<module>.md` + `.ai/guides/module-facts.json`):** the concrete **facts** for one module, extracted from its source — entity IDs, events, ACL features, API routes with per-method auth, DI service tokens, searchable entities, host extension tokens, notifications, and CLI commands. These are generated; never hand-write them here.
|
|
9
|
+
- **Package guides (`.ai/guides/core.md`, `ui.md`, `shared.md`, …):** package-specific depth (patterns, helpers, deeper APIs).
|
|
10
|
+
|
|
11
|
+
When you need a concrete fact about a specific module — which events it emits, its entity IDs, which feature gates a route — open that module's fact-sheet. Do not infer module facts from this conceptual guide.
|
|
12
|
+
|
|
13
|
+
## Module anatomy
|
|
14
|
+
|
|
15
|
+
Each module lives in `src/modules/<id>/` and is **auto-discovered**. The only registration is one entry in `src/modules.ts` (`{ id: '<id>', from: '@app' }`). Run `yarn generate` after adding or changing any auto-discovered file.
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
src/modules/<id>/
|
|
19
|
+
├── index.ts # Module metadata
|
|
20
|
+
├── data/
|
|
21
|
+
│ ├── entities.ts # MikroORM entity classes (decorators from @mikro-orm/decorators/legacy)
|
|
22
|
+
│ ├── validators.ts # Zod validation schemas
|
|
23
|
+
│ ├── extensions.ts # Cross-module entity links (export `extensions`)
|
|
24
|
+
│ └── enrichers.ts # Response enrichers (export `enrichers`)
|
|
25
|
+
├── api/
|
|
26
|
+
│ ├── <resource>/route.ts # REST handlers (auto-discovered by method) + `metadata` + `openApi`
|
|
27
|
+
│ └── interceptors.ts # API route interception hooks (export `interceptors`)
|
|
28
|
+
├── backend/ # Admin UI pages (auto-discovered) + paired `page.meta.ts`
|
|
29
|
+
├── frontend/ # Public pages (auto-discovered); customer portal under `[orgSlug]/portal/`
|
|
30
|
+
├── subscribers/ # Event handlers (export `metadata` + default handler)
|
|
31
|
+
├── workers/ # Background jobs (export `metadata` + default handler)
|
|
32
|
+
├── widgets/
|
|
33
|
+
│ ├── injection/ # UI widgets injected into other modules
|
|
34
|
+
│ ├── injection-table.ts # Widget-to-slot mappings
|
|
35
|
+
│ └── components.ts # Component replacement/wrapper definitions (export `componentOverrides`)
|
|
36
|
+
├── di.ts # Awilix DI registrations (export `register(container)`)
|
|
37
|
+
├── acl.ts # Permission features (export `features`)
|
|
38
|
+
├── setup.ts # Tenant init, role features, seed data (export `setup`)
|
|
39
|
+
├── events.ts # Typed event declarations (export `eventsConfig`)
|
|
40
|
+
├── search.ts # Search indexing configuration (export `searchConfig`)
|
|
41
|
+
├── ce.ts # Custom entities / custom field sets (export `entities`)
|
|
42
|
+
├── translations.ts # Translatable fields per entity
|
|
43
|
+
├── notifications.ts # Notification type definitions (export `notificationTypes`)
|
|
44
|
+
└── encryption.ts # Tenant data encryption maps for sensitive / GDPR fields
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Auto-discovery paths
|
|
48
|
+
|
|
49
|
+
| Path pattern | Becomes |
|
|
50
|
+
|---|---|
|
|
51
|
+
| `frontend/<path>.tsx` | `/<path>` (public page) |
|
|
52
|
+
| `frontend/[orgSlug]/portal/<path>/page.tsx` | `/{orgSlug}/portal/<path>` (customer portal page; `[orgSlug]` MUST be first) |
|
|
53
|
+
| `backend/<path>.tsx` | `/backend/<path>` (admin page) |
|
|
54
|
+
| `backend/page.tsx` | `/backend/<module>` (module root page) |
|
|
55
|
+
| `api/<method>/<path>.ts` | `/api/<path>` dispatched by HTTP method |
|
|
56
|
+
| `subscribers/*.ts` | event subscriber (export `metadata` + default handler) |
|
|
57
|
+
| `workers/*.ts` | background worker (export `metadata` + default handler) |
|
|
58
|
+
|
|
59
|
+
### Convention-file reference
|
|
60
|
+
|
|
61
|
+
| File | Export | Purpose |
|
|
62
|
+
|------|--------|---------|
|
|
63
|
+
| `index.ts` | `metadata` | Module metadata |
|
|
64
|
+
| `di.ts` | `register(container)` | DI registrations (Awilix) |
|
|
65
|
+
| `acl.ts` | `features` | Permission features (`['mod.view', 'mod.manage', …]`) |
|
|
66
|
+
| `setup.ts` | `setup` | Tenant init, default role features, seed data |
|
|
67
|
+
| `ce.ts` | `entities` | Custom entities / custom field sets |
|
|
68
|
+
| `events.ts` | `eventsConfig` | Typed event declarations (`createModuleEvents`) |
|
|
69
|
+
| `search.ts` | `searchConfig` | Search indexing config |
|
|
70
|
+
| `translations.ts` | `translatableFields` | Translatable fields per entity |
|
|
71
|
+
| `notifications.ts` | `notificationTypes` | Notification type definitions |
|
|
72
|
+
| `data/entities.ts` | — | MikroORM entity classes |
|
|
73
|
+
| `data/validators.ts` | — | Zod validation schemas |
|
|
74
|
+
| `data/extensions.ts` | `extensions` | Entity extensions (cross-module links) |
|
|
75
|
+
| `data/enrichers.ts` | `enrichers` | Response enrichers |
|
|
76
|
+
| `api/interceptors.ts` | `interceptors` | API route interception hooks |
|
|
77
|
+
| `widgets/components.ts` | `componentOverrides` | Component replacement/wrapper definitions |
|
|
78
|
+
|
|
79
|
+
## Naming conventions
|
|
80
|
+
|
|
81
|
+
- **Module IDs:** plural, snake_case (`order_items`). Special cases: `auth`, `example`.
|
|
82
|
+
- **Event IDs:** `module.entity.action` (singular entity, past-tense action, e.g. `sales.order.created`).
|
|
83
|
+
- **Entity IDs:** colon form `module:entity` (e.g. `customers:customer_person_profile`) — the canonical interop token, **not** the raw class name and **not** the dotted friendly alias some enrichers use.
|
|
84
|
+
- **DB tables:** plural, snake_case with a module prefix (`catalog_products`).
|
|
85
|
+
- **DB columns:** snake_case (`created_at`, `organization_id`). Common columns: `id`, `created_at`, `updated_at`, `deleted_at`, `is_active`, `organization_id`, `tenant_id`.
|
|
86
|
+
- **Feature IDs:** `<module>.<action>` (`my_module.view`, `my_module.manage`). FROZEN once shipped — rename by adding the new ID alongside and keeping the old as a deprecated alias.
|
|
87
|
+
- **JS/TS identifiers:** camelCase. UUID primary keys, explicit foreign keys, junction tables for M2M.
|
|
88
|
+
|
|
89
|
+
## Mandatory module mechanisms
|
|
90
|
+
|
|
91
|
+
The framework provides **one canonical primitive per concern**. Do not invent your own routing, auth, persistence, forms, caching, or cross-module calls. If a feature is not listed here, ask before rolling your own.
|
|
92
|
+
|
|
93
|
+
| Concern | Canonical mechanism |
|
|
6
94
|
|---|---|
|
|
7
|
-
| Module
|
|
8
|
-
|
|
|
9
|
-
|
|
|
10
|
-
|
|
|
11
|
-
|
|
|
12
|
-
|
|
|
13
|
-
|
|
|
14
|
-
|
|
15
|
-
|
|
95
|
+
| Module structure & auto-discovery | `src/modules/<id>/{api,backend,frontend,data,subscribers,workers,widgets}` + `index.ts` + one line in `src/modules.ts` — discovered by `yarn generate` |
|
|
96
|
+
| API routes | Files under `api/**/route.ts` exporting handlers + per-method `metadata` (`requireAuth` / `requireFeatures`) + `openApi`. NEVER a top-level `export const requireAuth` — the registry ignores it |
|
|
97
|
+
| CRUD APIs | `makeCrudRoute({ orm, list, create, update, del, indexer })` from `@open-mercato/shared/lib/crud/factory`. Always set `indexer` for query-index coverage. Custom (non-factory) write routes MUST run the mutation guard registry (`runMutationGuards`) |
|
|
98
|
+
| CRUD forms | `<CrudForm />` from `@open-mercato/ui/backend/CrudForm` + `createCrud`/`updateCrud`/`deleteCrud`. Never raw `<form>`, never raw `fetch` |
|
|
99
|
+
| Data tables | `<DataTable entityId apiPath … />` from `@open-mercato/ui/backend/DataTable`. Keep `entityId` / `extensionTableId` stable so widget injection keeps working |
|
|
100
|
+
| HTTP from the client | `apiCall` / `apiCallOrThrow` from `@open-mercato/ui/backend/utils/apiCall` — never raw `fetch` |
|
|
101
|
+
| Authorization (RBAC) | Declare features in `acl.ts`, grant in `setup.ts` `defaultRoleFeatures`, gate with `requireFeatures` in `metadata` / `page.meta.ts`. NEVER `requireRoles` (role names mutate). Treat `module.*` / `*` wildcard grants as part of the contract |
|
|
102
|
+
| Multi-tenant scoping | Every tenant-scoped entity has indexed `organization_id` + `tenant_id`; every read/write filters by them. The CRUD factory injects scope — do not bypass it. Ad-hoc queries use `withScopedPayload` |
|
|
103
|
+
| Encryption for sensitive data | Declare `encryption.ts` `defaultEncryptionMaps`; read via `findWithDecryption` / `findOneWithDecryption`. NEVER hand-roll AES/KMS, NEVER `em.find` on encrypted columns |
|
|
104
|
+
| Cache | Resolve from DI (`container.resolve('cache')`) — never `new Redis(...)`. Tag with `tenant:<id>` / `org:<id>` so invalidation stays tenant-scoped |
|
|
105
|
+
| Background workers | `workers/*.ts` exporting `metadata: { queue, id?, concurrency? }` + default handler. Never spin up custom queues |
|
|
106
|
+
| Events between modules | `events.ts` with `createModuleEvents({ moduleId, events } as const)`; subscribe in `subscribers/`. Never call another module's services directly across boundaries |
|
|
107
|
+
| Domain writes | Implement through the Command pattern so audit, undo, cache, events, and indexing stay consistent — do not mutate domain state directly in route handlers |
|
|
108
|
+
| i18n | `useT()` client-side, `resolveTranslations()` server-side; keys in `src/i18n/<locale>.json`. Never hard-code user-facing strings |
|
|
109
|
+
|
|
110
|
+
> Rule of thumb: if you reach for raw `fetch`, raw `<form>`, ad-hoc `crypto`, ad-hoc `Redis`, or a manual cross-module join, stop and check the row above — there is a canonical helper.
|
|
111
|
+
|
|
112
|
+
## Entity-update safety & data integrity
|
|
113
|
+
|
|
114
|
+
- **`withAtomicFlush`.** MikroORM can silently discard pending scalar changes when a query (`em.find`/`em.findOne`/sync helper) runs on the same `EntityManager` between a scalar mutation and `em.flush()`. Multi-phase mutations MUST use `withAtomicFlush(em, phases, { transaction: true })` from `@open-mercato/shared/lib/commands/flush`. Keep `emitCrudSideEffects` and cache invalidation **outside** the block — they fire only after the DB write commits. For entity + custom fields + side effects in one write, prefer `runCrudCommandWrite`.
|
|
115
|
+
- **Optimistic locking (default ON).** Every **new user-editable entity** MUST carry an `updated_at` column and return `updatedAt` in its list/detail responses, so the OSS optimistic lock can detect concurrent edits. `CrudForm` auto-derives the lock header from `initialValues.updatedAt` (covers update and delete). Append-only logs, junction/assignment tables, session/token rows, and parent-guarded sub-resource lines are exempt.
|
|
116
|
+
- **Encryption.** Sensitive / GDPR fields go through the encryption-maps mechanism (`encryption.ts` + `findWithDecryption`), never hand-rolled crypto. Always pass `tenantId` and `organizationId` to the decryption helpers.
|
|
117
|
+
- **Tenant isolation.** Never expose cross-tenant data; always filter by `organization_id` (and `tenant_id`). Never create direct ORM relationships between modules — reference by FK id and fetch separately.
|
|
118
|
+
|
|
119
|
+
## Generate & migration workflow
|
|
120
|
+
|
|
121
|
+
- **After editing `src/modules.ts` or any structural module file:** run `yarn generate`. Never hand-edit anything under `.mercato/generated/*`.
|
|
122
|
+
- **After editing `data/entities.ts`:** run `yarn db:generate` as a schema-diff probe. Default to the generated SQL; if it emits unrelated churn from another module's stale snapshot, keep only the SQL for your change and update that module's `migrations/.snapshot-open-mercato.json` in the same commit.
|
|
123
|
+
- **Do not run `yarn db:migrate`** unless the user explicitly asks. A PR should normally include the migration file plus snapshot, not local DB state. Never hand-edit a migration that has already shipped — add a new one.
|
|
124
|
+
- **New ACL features must be visible immediately:** add the feature to `acl.ts` **and** to `setup.ts` `defaultRoleFeatures`, then run `yarn mercato auth sync-role-acls` so existing tenants pick it up.
|
|
125
|
+
|
|
126
|
+
## Where to go next
|
|
127
|
+
|
|
128
|
+
- A specific module's surface (entities, events, routes, auth, search, CLI): its **fact-sheet** at `.ai/guides/modules/<module>.md`.
|
|
129
|
+
- Deeper package patterns: the matching **package guide** (`core.md`, `ui.md`, `shared.md`, `events.md`, `queue.md`, `cache.md`, `search.md`).
|
|
130
|
+
- Scaffolding a module end-to-end: the `om-module-scaffold` skill.
|