@open-mercato/cli 0.6.7-develop.6862.1.c11a64ce0a → 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/.turbo/turbo-build.log +4 -4
- package/build.mjs +7 -24
- 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/bin.js +1 -13
- package/dist/bin.js.map +2 -2
- package/dist/lib/__integration__/TC-INT-008.spec.js +8 -88
- package/dist/lib/__integration__/TC-INT-008.spec.js.map +2 -2
- package/dist/lib/agentic-init.js +3 -13
- package/dist/lib/agentic-init.js.map +2 -2
- package/dist/lib/agentic-setup.js +186 -418
- package/dist/lib/agentic-setup.js.map +2 -2
- package/dist/lib/generators/extensions/injection-widgets.js +0 -20
- package/dist/lib/generators/extensions/injection-widgets.js.map +2 -2
- package/dist/lib/generators/module-facts-discovery.js +7 -41
- package/dist/lib/generators/module-facts-discovery.js.map +2 -2
- package/dist/lib/generators/module-facts.js +45 -1387
- package/dist/lib/generators/module-facts.js.map +3 -3
- package/dist/lib/generators/module-registry.js +5 -11
- package/dist/lib/generators/module-registry.js.map +2 -2
- package/dist/lib/resolver.js +0 -2
- package/dist/lib/resolver.js.map +2 -2
- package/dist/lib/testing/integration.js +0 -5
- package/dist/lib/testing/integration.js.map +2 -2
- package/dist/mercato.js +1 -23
- package/dist/mercato.js.map +2 -2
- package/package.json +11 -13
- package/src/bin.ts +1 -33
- package/src/lib/__integration__/TC-INT-008.spec.ts +9 -107
- package/src/lib/__tests__/agentic-init.test.ts +5 -41
- package/src/lib/agentic-init.ts +3 -15
- package/src/lib/agentic-setup.ts +224 -530
- package/src/lib/generators/__tests__/module-facts.bc-guard.test.ts +2 -88
- package/src/lib/generators/__tests__/module-facts.customers.fixture.test.ts +0 -1
- package/src/lib/generators/__tests__/module-facts.discovery.test.ts +10 -54
- package/src/lib/generators/__tests__/module-subset.test.ts +0 -18
- package/src/lib/generators/extensions/injection-widgets.ts +0 -51
- package/src/lib/generators/module-facts-discovery.ts +7 -58
- package/src/lib/generators/module-facts.ts +46 -1851
- package/src/lib/generators/module-registry.ts +6 -16
- package/src/lib/resolver.ts +0 -3
- package/src/lib/testing/__tests__/integration.test.ts +0 -4
- package/src/lib/testing/integration.ts +0 -5
- package/src/mercato.ts +1 -26
- 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/dist/lib/generators/module-extension-facts.js +0 -1840
- package/dist/lib/generators/module-extension-facts.js.map +0 -7
- package/dist/lib/generators/module-fact-sources.js +0 -70
- package/dist/lib/generators/module-fact-sources.js.map +0 -7
- package/dist/lib/generators/module-override-targets.js +0 -688
- package/dist/lib/generators/module-override-targets.js.map +0 -7
- package/dist/lib/load-env.js +0 -24
- package/dist/lib/load-env.js.map +0 -7
- package/dist/lib/telemetry-init.js +0 -358
- package/dist/lib/telemetry-init.js.map +0 -7
- package/src/lib/__tests__/agentic-setup.ownership.test.ts +0 -386
- package/src/lib/__tests__/injection-widget-id-validation.test.ts +0 -184
- package/src/lib/__tests__/load-env.test.ts +0 -65
- package/src/lib/__tests__/telemetry-init.test.ts +0 -298
- package/src/lib/generators/__tests__/activation-adapter-coverage.test.ts +0 -92
- package/src/lib/generators/__tests__/module-extension-activations.test.ts +0 -762
- package/src/lib/generators/__tests__/module-extension-facts.test.ts +0 -404
- package/src/lib/generators/__tests__/module-facts.extension-hosts.test.ts +0 -108
- package/src/lib/generators/__tests__/module-facts.owned-contracts.test.ts +0 -561
- package/src/lib/generators/__tests__/module-facts.source-links.test.ts +0 -119
- package/src/lib/generators/__tests__/module-override-targets.roundtrip.test.ts +0 -149
- package/src/lib/generators/__tests__/module-override-targets.test.ts +0 -304
- package/src/lib/generators/module-extension-facts.ts +0 -2365
- package/src/lib/generators/module-fact-sources.ts +0 -108
- package/src/lib/generators/module-override-targets.ts +0 -863
- package/src/lib/load-env.ts +0 -30
- package/src/lib/telemetry-init.ts +0 -461
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
[build:cli] found
|
|
1
|
+
[build:cli] found 96 entry points
|
|
2
2
|
Copied create-app/agentic/ → dist/agentic/
|
|
3
|
+
Discovered 7 standalone guides → dist/agentic/guides/
|
|
3
4
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for ai_assistant
|
|
4
5
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for channel_gmail
|
|
5
6
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for channel_imap
|
|
@@ -19,13 +20,14 @@ Copied create-app/agentic/ → dist/agentic/
|
|
|
19
20
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for customers
|
|
20
21
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for dashboards
|
|
21
22
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for data_sync
|
|
22
|
-
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for design_system
|
|
23
23
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for dictionaries
|
|
24
24
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for directory
|
|
25
25
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for entities
|
|
26
|
+
Generated 54 module fact-sheets → dist/agentic/guides/modules/
|
|
26
27
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for feature_toggles
|
|
27
28
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for inbox_ops
|
|
28
29
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for integrations
|
|
30
|
+
[build:cli] built successfully
|
|
29
31
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for messages
|
|
30
32
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for notifications
|
|
31
33
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for payment_gateways
|
|
@@ -55,5 +57,3 @@ Copied create-app/agentic/ → dist/agentic/
|
|
|
55
57
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for storage_s3
|
|
56
58
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for sync_akeneo
|
|
57
59
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for webhooks
|
|
58
|
-
Generated 55 module fact-sheets → dist/agentic/guides/modules/
|
|
59
|
-
[build:cli] built successfully
|
package/build.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { chmodSync, cpSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
|
|
2
|
-
import { createHash } from 'node:crypto'
|
|
3
2
|
import { dirname, join } from 'node:path'
|
|
4
3
|
import { fileURLToPath, pathToFileURL } from 'node:url'
|
|
5
4
|
import { atomicWriteFileSync } from '../../scripts/lib/add-js-extension.mjs'
|
|
@@ -27,26 +26,11 @@ await buildPackage(packageDir, {
|
|
|
27
26
|
// Copy agentic source files from create-app so generators can read them at runtime.
|
|
28
27
|
const agenticSrc = join(packageDir, '..', 'create-app', 'agentic')
|
|
29
28
|
if (existsSync(agenticSrc)) {
|
|
30
|
-
rmSync(join(outdir, 'agentic'), { recursive: true, force: true })
|
|
31
29
|
cpSync(agenticSrc, join(outdir, 'agentic'), { recursive: true })
|
|
32
30
|
console.log('Copied create-app/agentic/ → dist/agentic/')
|
|
33
31
|
}
|
|
34
32
|
|
|
35
|
-
|
|
36
|
-
const upstreamDir = join(outdir, 'agentic', 'guides', 'upstream')
|
|
37
|
-
mkdirSync(upstreamDir, { recursive: true })
|
|
38
|
-
const cliVersion = JSON.parse(readFileSync(join(packageDir, 'package.json'), 'utf8')).version ?? null
|
|
39
|
-
const upstreamManifest = { version: 1, generator: `@open-mercato/cli@${cliVersion ?? 'unknown'}`, files: {} }
|
|
40
|
-
for (const file of ['AGENTS.md', 'BACKWARD_COMPATIBILITY.md']) {
|
|
41
|
-
const source = join(repositoryRoot, file)
|
|
42
|
-
const destination = join(upstreamDir, file)
|
|
43
|
-
cpSync(source, destination)
|
|
44
|
-
upstreamManifest.files[file] = createHash('sha256').update(readFileSync(source)).digest('hex')
|
|
45
|
-
}
|
|
46
|
-
writeFileSync(join(upstreamDir, 'manifest.json'), `${JSON.stringify(upstreamManifest, null, 2)}\n`)
|
|
47
|
-
|
|
48
|
-
// Discover module-specific standalone guides across sibling packages. Package-level
|
|
49
|
-
// guides are intentionally not shipped because they duplicate routed conceptual guides.
|
|
33
|
+
// Discover standalone guides across sibling packages.
|
|
50
34
|
const packagesDir = join(packageDir, '..')
|
|
51
35
|
const guidesDestDir = join(outdir, 'agentic', 'guides')
|
|
52
36
|
mkdirSync(guidesDestDir, { recursive: true })
|
|
@@ -55,7 +39,8 @@ await buildPackage(packageDir, {
|
|
|
55
39
|
// retains a removed module's full guide or fact-sheet. The legacy `core.<module>.md`
|
|
56
40
|
// redirect stubs are no longer emitted (#3754); this purge also deletes any that linger
|
|
57
41
|
// in an incremental `dist/` from an older build. Mirrors packages/create-app/build.mjs;
|
|
58
|
-
// conceptual
|
|
42
|
+
// the conceptual `module-system.md` and the single-dot package guides are
|
|
43
|
+
// re-copied/re-discovered below.
|
|
59
44
|
rmSync(join(guidesDestDir, 'modules'), { recursive: true, force: true })
|
|
60
45
|
for (const entry of readdirSync(guidesDestDir)) {
|
|
61
46
|
if (/^core\..+\.md$/.test(entry)) {
|
|
@@ -65,11 +50,10 @@ await buildPackage(packageDir, {
|
|
|
65
50
|
|
|
66
51
|
let guidesFound = 0
|
|
67
52
|
for (const pkg of readdirSync(packagesDir)) {
|
|
68
|
-
// Package-level source guides remain for monorepo context, but standalone apps route
|
|
69
|
-
// through conceptual and module-level guides, so remove their stale emitted copies.
|
|
70
53
|
const guideSource = join(packagesDir, pkg, 'agentic', 'standalone-guide.md')
|
|
71
54
|
if (existsSync(guideSource)) {
|
|
72
|
-
|
|
55
|
+
cpSync(guideSource, join(guidesDestDir, `${pkg}.md`))
|
|
56
|
+
guidesFound++
|
|
73
57
|
}
|
|
74
58
|
|
|
75
59
|
const modulesDir = join(packagesDir, pkg, 'src', 'modules')
|
|
@@ -92,7 +76,7 @@ await buildPackage(packageDir, {
|
|
|
92
76
|
// the freshly built ts-morph extractor + resolver-routed discovery, so
|
|
93
77
|
// `mercato agentic:init` bundles the same guides as a create-mercato-app scaffold
|
|
94
78
|
// (packages/create-app/build.mjs). Discovery goes through the resolver, never a
|
|
95
|
-
// hardcoded packages/* path (.ai/lessons
|
|
79
|
+
// hardcoded packages/* path (.ai/lessons.md §161-169).
|
|
96
80
|
const { extractAllModuleFacts, renderModuleFactsJson } = await import(
|
|
97
81
|
pathToFileURL(join(outdir, 'lib', 'generators', 'module-facts.js')).href
|
|
98
82
|
)
|
|
@@ -111,7 +95,7 @@ await buildPackage(packageDir, {
|
|
|
111
95
|
coreVersion = null
|
|
112
96
|
}
|
|
113
97
|
|
|
114
|
-
const { factsByModule, markdownByModule,
|
|
98
|
+
const { factsByModule, markdownByModule, warnings } = extractAllModuleFacts({
|
|
115
99
|
sources,
|
|
116
100
|
registryPath: existsSync(registryPath) ? registryPath : null,
|
|
117
101
|
coreVersion,
|
|
@@ -123,7 +107,6 @@ await buildPackage(packageDir, {
|
|
|
123
107
|
writeFileSync(join(modulesGuidesDir, `${moduleId}.md`), markdown)
|
|
124
108
|
}
|
|
125
109
|
writeFileSync(join(guidesDestDir, 'module-facts.json'), renderModuleFactsJson(factsByModule))
|
|
126
|
-
writeFileSync(join(guidesDestDir, 'framework-extension-points.md'), frameworkMarkdown)
|
|
127
110
|
|
|
128
111
|
for (const warning of warnings) console.warn(warning)
|
|
129
112
|
console.log(`Generated ${Object.keys(markdownByModule).length} module fact-sheets → dist/agentic/guides/modules/`)
|
|
@@ -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.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Cache Package — Standalone Developer Guide
|
|
2
|
+
|
|
3
|
+
`@open-mercato/cache` provides tenant-scoped caching with tag-based invalidation. MUST NOT use raw Redis, SQLite, or in-memory caching directly.
|
|
4
|
+
|
|
5
|
+
## Strategy Selection
|
|
6
|
+
|
|
7
|
+
| Strategy | When | Config |
|
|
8
|
+
|----------|------|--------|
|
|
9
|
+
| Memory | Development, single-process | Default (no config) |
|
|
10
|
+
| SQLite | Single-server production | `CACHE_STRATEGY=sqlite` |
|
|
11
|
+
| Redis | Multi-server, shared cache | `CACHE_STRATEGY=redis` |
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
Always resolve via DI:
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
const cacheService = container.resolve('cacheService')
|
|
19
|
+
|
|
20
|
+
// Set with tags for targeted invalidation
|
|
21
|
+
await cacheService.set(`${tenantId}:my_module:stats`, value, {
|
|
22
|
+
tags: [`tenant:${tenantId}`, 'my_module'],
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
// Get
|
|
26
|
+
const cached = await cacheService.get(`${tenantId}:my_module:stats`)
|
|
27
|
+
|
|
28
|
+
// Invalidate by tag (clears all entries with that tag)
|
|
29
|
+
await cacheService.invalidateTag('my_module')
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## MUST Rules
|
|
33
|
+
|
|
34
|
+
1. **MUST resolve via DI** — `container.resolve('cacheService')`, never instantiate directly
|
|
35
|
+
2. **MUST scope to tenant** — include `tenantId` in cache keys
|
|
36
|
+
3. **MUST use tag-based invalidation** for CRUD side effects
|
|
37
|
+
4. **MUST NOT cache sensitive data** without encryption
|
|
38
|
+
|
|
39
|
+
## Adding Cache to a Module
|
|
40
|
+
|
|
41
|
+
1. Resolve `cacheService` from DI in your service or route handler
|
|
42
|
+
2. Define cache keys: `${tenantId}:${module}:${identifier}`
|
|
43
|
+
3. Tag entries: `{ tags: ['tenant:123', 'my_module'] }`
|
|
44
|
+
4. Add cache invalidation to CRUD side effects (`emitCrudSideEffects` with `cacheAliases`)
|
|
45
|
+
5. Test with `CACHE_STRATEGY=memory` (default in dev)
|