@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
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
# UMES Extension Contracts — Type Reference
|
|
2
|
+
|
|
3
|
+
Complete TypeScript type definitions for all extension mechanisms.
|
|
4
|
+
|
|
5
|
+
## ResponseEnricher
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
interface ResponseEnricher<TRecord = any, TEnriched = any> {
|
|
9
|
+
id: string
|
|
10
|
+
targetEntity: string
|
|
11
|
+
features?: string[]
|
|
12
|
+
priority?: number // Higher = runs first. Default: 0
|
|
13
|
+
timeout?: number // Max ms before skip. Default: 2000
|
|
14
|
+
fallback?: Record<string, unknown>
|
|
15
|
+
critical?: boolean // Propagate errors? Default: false
|
|
16
|
+
disabledTenantIds?: string[]
|
|
17
|
+
cache?: {
|
|
18
|
+
strategy: 'read-through'
|
|
19
|
+
ttl: number
|
|
20
|
+
tags?: string[]
|
|
21
|
+
invalidateOn?: string[]
|
|
22
|
+
}
|
|
23
|
+
queryEngine?: {
|
|
24
|
+
enabled: boolean
|
|
25
|
+
engines?: Array<'basic' | 'hybrid'>
|
|
26
|
+
applyOn?: Array<'list' | 'detail'>
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
enrichOne(record: TRecord, context: EnricherContext): Promise<TRecord & TEnriched>
|
|
30
|
+
enrichMany?(records: TRecord[], context: EnricherContext): Promise<(TRecord & TEnriched)[]>
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface EnricherContext {
|
|
34
|
+
organizationId: string
|
|
35
|
+
tenantId: string
|
|
36
|
+
userId: string
|
|
37
|
+
em: EntityManager
|
|
38
|
+
container: AwilixContainer
|
|
39
|
+
requestedFields?: string[]
|
|
40
|
+
userFeatures?: string[]
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## ApiInterceptor
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
type ApiInterceptorMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'
|
|
48
|
+
|
|
49
|
+
type InterceptorRequest = {
|
|
50
|
+
method: ApiInterceptorMethod
|
|
51
|
+
url: string
|
|
52
|
+
body?: Record<string, unknown>
|
|
53
|
+
query?: Record<string, unknown>
|
|
54
|
+
headers: Record<string, string>
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
type InterceptorResponse = {
|
|
58
|
+
statusCode: number
|
|
59
|
+
body: Record<string, unknown>
|
|
60
|
+
headers: Record<string, string>
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
type InterceptorContext = {
|
|
64
|
+
userId: string
|
|
65
|
+
organizationId: string
|
|
66
|
+
tenantId: string
|
|
67
|
+
em: EntityManager
|
|
68
|
+
container: AwilixContainer
|
|
69
|
+
userFeatures?: string[]
|
|
70
|
+
metadata?: Record<string, unknown>
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
type InterceptorBeforeResult = {
|
|
74
|
+
ok: boolean
|
|
75
|
+
body?: Record<string, unknown>
|
|
76
|
+
query?: Record<string, unknown>
|
|
77
|
+
headers?: Record<string, string>
|
|
78
|
+
message?: string
|
|
79
|
+
statusCode?: number
|
|
80
|
+
metadata?: Record<string, unknown>
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
type InterceptorAfterResult = {
|
|
84
|
+
merge?: Record<string, unknown>
|
|
85
|
+
replace?: Record<string, unknown>
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
type ApiInterceptor = {
|
|
89
|
+
id: string
|
|
90
|
+
targetRoute: string
|
|
91
|
+
methods: ApiInterceptorMethod[]
|
|
92
|
+
priority?: number // Lower = earlier. Default: 50
|
|
93
|
+
features?: string[]
|
|
94
|
+
timeoutMs?: number // Default: 5000
|
|
95
|
+
before?: (request: InterceptorRequest, context: InterceptorContext) => Promise<InterceptorBeforeResult>
|
|
96
|
+
after?: (request: InterceptorRequest, response: InterceptorResponse, context: InterceptorContext) => Promise<InterceptorAfterResult>
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## MutationGuard
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
interface MutationGuard {
|
|
104
|
+
id: string
|
|
105
|
+
targetEntity: string | '*'
|
|
106
|
+
operations: ('create' | 'update' | 'delete')[]
|
|
107
|
+
priority?: number // Lower = earlier. Default: 50
|
|
108
|
+
features?: string[]
|
|
109
|
+
|
|
110
|
+
validate(input: MutationGuardInput): Promise<MutationGuardResult>
|
|
111
|
+
afterSuccess?(input: MutationGuardAfterInput): Promise<void>
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
interface MutationGuardInput {
|
|
115
|
+
tenantId: string
|
|
116
|
+
organizationId: string | null
|
|
117
|
+
userId: string
|
|
118
|
+
resourceKind: string
|
|
119
|
+
resourceId: string | null // null for create
|
|
120
|
+
operation: 'create' | 'update' | 'delete'
|
|
121
|
+
requestMethod: string
|
|
122
|
+
requestHeaders: Headers
|
|
123
|
+
mutationPayload?: Record<string, unknown> | null
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
interface MutationGuardResult {
|
|
127
|
+
ok: boolean
|
|
128
|
+
status?: number // Default: 422
|
|
129
|
+
message?: string
|
|
130
|
+
body?: Record<string, unknown>
|
|
131
|
+
modifiedPayload?: Record<string, unknown>
|
|
132
|
+
shouldRunAfterSuccess?: boolean
|
|
133
|
+
metadata?: Record<string, unknown>
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
interface MutationGuardAfterInput {
|
|
137
|
+
tenantId: string
|
|
138
|
+
organizationId: string | null
|
|
139
|
+
userId: string
|
|
140
|
+
resourceKind: string
|
|
141
|
+
resourceId: string
|
|
142
|
+
operation: 'create' | 'update' | 'delete'
|
|
143
|
+
requestMethod: string
|
|
144
|
+
requestHeaders: Headers
|
|
145
|
+
metadata?: Record<string, unknown> | null
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## InjectionPosition
|
|
150
|
+
|
|
151
|
+
```typescript
|
|
152
|
+
enum InjectionPosition {
|
|
153
|
+
Before = 'before',
|
|
154
|
+
After = 'after',
|
|
155
|
+
First = 'first',
|
|
156
|
+
Last = 'last',
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
type InjectionPlacement = {
|
|
160
|
+
position?: InjectionPosition
|
|
161
|
+
relativeTo?: string
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## ComponentOverride
|
|
166
|
+
|
|
167
|
+
```typescript
|
|
168
|
+
type ComponentOverride<TProps = unknown> = {
|
|
169
|
+
target: { componentId: string }
|
|
170
|
+
priority: number
|
|
171
|
+
features?: string[]
|
|
172
|
+
metadata?: { module?: string }
|
|
173
|
+
} & (
|
|
174
|
+
| { replacement: LazyExoticComponent<ComponentType<TProps>> | ComponentType<TProps>; propsSchema: ZodType<TProps> }
|
|
175
|
+
| { wrapper: (Original: ComponentType<TProps>) => ComponentType<TProps> }
|
|
176
|
+
| { propsTransform: (props: TProps) => TProps }
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
// Handle constructors
|
|
180
|
+
ComponentReplacementHandles.page(path) // → 'page:<path>'
|
|
181
|
+
ComponentReplacementHandles.dataTable(tableId) // → 'data-table:<tableId>'
|
|
182
|
+
ComponentReplacementHandles.crudForm(entityId) // → 'crud-form:<entityId>'
|
|
183
|
+
ComponentReplacementHandles.section(scope, id) // → 'section:<scope>.<id>'
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Widget Event Handlers
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
type WidgetInjectionEventHandlers<TContext = unknown, TData = unknown> = {
|
|
190
|
+
filter?: WidgetInjectionEventFilter
|
|
191
|
+
onLoad?: (context: TContext) => void | Promise<void>
|
|
192
|
+
onBeforeSave?: (data: TData, context: TContext) => WidgetBeforeSaveResult | Promise<WidgetBeforeSaveResult>
|
|
193
|
+
onSave?: (data: TData, context: TContext) => void | Promise<void>
|
|
194
|
+
onAfterSave?: (data: TData, context: TContext) => void | Promise<void>
|
|
195
|
+
onBeforeDelete?: (data: TData, context: TContext) => WidgetBeforeDeleteResult | Promise<WidgetBeforeDeleteResult>
|
|
196
|
+
onDelete?: (data: TData, context: TContext) => void | Promise<void>
|
|
197
|
+
onAfterDelete?: (data: TData, context: TContext) => void | Promise<void>
|
|
198
|
+
onFieldChange?: (fieldId: string, value: unknown, data: TData, context: TContext) => Promise<FieldChangeResult | void>
|
|
199
|
+
onBeforeNavigate?: (target: string, context: TContext) => Promise<NavigateGuardResult>
|
|
200
|
+
onVisibilityChange?: (visible: boolean, context: TContext) => Promise<void>
|
|
201
|
+
onAppEvent?: (event: AppEventPayload, context: TContext) => Promise<void>
|
|
202
|
+
transformFormData?: (data: TData, context: TContext) => Promise<TData | { data: TData; applyToForm: true }>
|
|
203
|
+
transformDisplayData?: (data: TData, context: TContext) => Promise<TData>
|
|
204
|
+
transformValidation?: (errors: Record<string, string>, data: TData, context: TContext) => Promise<Record<string, string>>
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
type FieldChangeResult = {
|
|
208
|
+
value?: unknown
|
|
209
|
+
sideEffects?: Record<string, unknown>
|
|
210
|
+
message?: { text: string; severity: 'info' | 'warning' | 'error' }
|
|
211
|
+
}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## Widget Injection Spot IDs
|
|
215
|
+
|
|
216
|
+
### CrudForm Spots
|
|
217
|
+
|
|
218
|
+
```
|
|
219
|
+
crud-form:<entityId>:fields
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Examples: `crud-form:customers.person:fields`, `crud-form:catalog.product:fields`
|
|
223
|
+
|
|
224
|
+
### DataTable Spots
|
|
225
|
+
|
|
226
|
+
```
|
|
227
|
+
data-table:<tableId>:columns
|
|
228
|
+
data-table:<tableId>:row-actions
|
|
229
|
+
data-table:<tableId>:bulk-actions
|
|
230
|
+
data-table:<tableId>:filters
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Examples: `data-table:customers.people:columns`, `data-table:sales.orders:row-actions`
|
|
234
|
+
|
|
235
|
+
### Menu Spots
|
|
236
|
+
|
|
237
|
+
```
|
|
238
|
+
menu:sidebar:main
|
|
239
|
+
menu:sidebar:settings
|
|
240
|
+
menu:sidebar:profile
|
|
241
|
+
menu:topbar:profile-dropdown
|
|
242
|
+
menu:topbar:actions
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### Detail Page Spots
|
|
246
|
+
|
|
247
|
+
```
|
|
248
|
+
<module>.<entity>:detail:tabs
|
|
249
|
+
<module>.<entity>:detail:sections
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
## Execution Pipeline Order
|
|
253
|
+
|
|
254
|
+
```
|
|
255
|
+
Request arrives
|
|
256
|
+
↓
|
|
257
|
+
1. Zod schema validation
|
|
258
|
+
2. API Interceptor before hooks
|
|
259
|
+
3. Sync before-event subscribers (*.creating)
|
|
260
|
+
4. CrudHooks.beforeCreate/Update/Delete (module-local)
|
|
261
|
+
5. Mutation Guard Registry validate
|
|
262
|
+
6. Entity mutation + ORM flush
|
|
263
|
+
7. CrudHooks.afterCreate/Update/Delete
|
|
264
|
+
8. Mutation Guard Registry afterSuccess
|
|
265
|
+
9. Sync after-event subscribers (*.created)
|
|
266
|
+
10. Async event subscribers (persistent, queued)
|
|
267
|
+
11. Response Enrichers (list/detail endpoints only)
|
|
268
|
+
12. API Interceptor after hooks
|
|
269
|
+
↓
|
|
270
|
+
Response returned
|
|
271
|
+
```
|
|
@@ -1,25 +1,73 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: om-trim-unused-modules
|
|
3
|
-
description:
|
|
3
|
+
description: Propose disabling modules in src/modules.ts that the current standalone project does not actually use. Intended to be offered after the user adds a new custom module, because a fresh create-mercato-app scaffold enables every built-in module (classic mode) and that is rarely what the project actually needs in production.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Trim
|
|
6
|
+
# Trim Unused Modules
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
A fresh `create-mercato-app` scaffold enables every built-in Open Mercato module by default (classic mode) so that the app "just works" on day one. Once the user has added a new custom module and knows what they actually want to build, many of those defaults are dead weight — they slow down `yarn dev`, pollute the navigation sidebar, pull in unnecessary dependencies, and show the user features that will confuse their end users.
|
|
9
|
+
|
|
10
|
+
Invoke this skill when:
|
|
11
|
+
|
|
12
|
+
- The user just added a new module to `src/modules.ts` via `yarn mercato module add …` or by hand-creating `src/modules/<name>/`.
|
|
13
|
+
- The user asks "which modules do I really need?" or "how do I slim down the app?"
|
|
14
|
+
- You notice during another task that `src/modules.ts` still has every built-in module enabled AND the user's business domain clearly does not need some of them (e.g. a blog-only app with `sales`, `catalog`, `currencies`, `workflows`, `integrations`, `data_sync` all active).
|
|
9
15
|
|
|
10
16
|
## Workflow
|
|
11
17
|
|
|
12
|
-
1.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
1. **Never disable modules silently.** Always confirm with the user via `AskUserQuestion` before editing `src/modules.ts`.
|
|
19
|
+
|
|
20
|
+
2. **Read the current module list.** Parse `src/modules.ts`. For each entry:
|
|
21
|
+
- Record the module `id` and its source (`@open-mercato/core`, `@open-mercato/<package>`, `@app`).
|
|
22
|
+
- Flag entries with `from: '@app'` as **user modules** — never propose disabling these.
|
|
23
|
+
- Flag entries with `from: '@open-mercato/…'` as **built-in modules** — eligible for review.
|
|
24
|
+
|
|
25
|
+
3. **Gather usage signals.** For each built-in module, check:
|
|
26
|
+
- Is the module's feature ID referenced in `src/modules/**/acl.ts` or `src/modules/**/setup.ts`?
|
|
27
|
+
- Is a type/name from the module imported anywhere in `src/**`?
|
|
28
|
+
- Does any subscriber/worker declaration in `src/modules/**` reference an event ID the module owns?
|
|
29
|
+
- Does the backend sidebar config reference routes from the module?
|
|
30
|
+
- Is the module listed as a hard dependency in any enabled integration provider's manifest?
|
|
31
|
+
Record yes/no per signal. If ALL signals return "no", mark the module as a **removal candidate**.
|
|
32
|
+
|
|
33
|
+
4. **Mark hard-required modules.** Never propose disabling modules that other parts of the framework rely on by convention. The baseline set that should stay enabled in almost every project:
|
|
34
|
+
- `auth`, `customer_accounts`, `entities`, `configs`, `organizations`, `tenants`, `users`
|
|
35
|
+
Include any module that another enabled module's `setup.ts` declares as a dependency.
|
|
36
|
+
|
|
37
|
+
5. **Present the proposal.** Use `AskUserQuestion` with a multi-select list of removal candidates. Include:
|
|
38
|
+
- The module ID and a one-line description of what it does.
|
|
39
|
+
- Which usage signals came back negative.
|
|
40
|
+
- Whether disabling it will require running DB operations (e.g. dropping its tables — NOT something this skill performs; flag it so the user knows).
|
|
41
|
+
|
|
42
|
+
6. **Apply the user's choices.** For each module the user confirms:
|
|
43
|
+
- Remove the entry from `src/modules.ts`.
|
|
44
|
+
- Do NOT delete files from `node_modules/@open-mercato/*` (packages stay installed — disabling just means the app no longer loads them).
|
|
45
|
+
- Do NOT drop the module's database tables. Data removal is a separate, destructive operation that the user must request explicitly.
|
|
46
|
+
- **If `dashboards` is one of the disabled modules, you MUST also update `src/app/(backend)/backend/page.tsx`** so it no longer renders `<DashboardScreen />`. Replace the body with a `redirect(...)` to the first backend page the user can reach — prefer the main sidebar group (e.g. `/backend/customers/people`) and fall back to `/backend/profile` if nothing else is enabled. Without this edit, `/backend` will crash at build or request time because the removed module no longer ships `DashboardScreen`. Commit this edit in the same change as the `src/modules.ts` edit.
|
|
47
|
+
|
|
48
|
+
7. **Re-run the generator.** After the edit:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
yarn generate
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
This regenerates `.mercato/generated/*` without the disabled modules and triggers the best-effort structural cache purge.
|
|
55
|
+
|
|
56
|
+
8. **Report.** Print a short summary:
|
|
57
|
+
- Which modules were disabled.
|
|
58
|
+
- Which modules were kept (and the signal that kept each).
|
|
59
|
+
- Reminder that package dependencies are still installed and module tables still exist; if the user wants to fully remove a module, they must uninstall the package and manually drop its tables.
|
|
60
|
+
|
|
61
|
+
## Constraints
|
|
62
|
+
|
|
63
|
+
- NEVER remove a `from: '@app'` entry.
|
|
64
|
+
- NEVER remove `auth`, `customer_accounts`, `entities`, `configs`, `organizations`, `tenants`, or `users`.
|
|
65
|
+
- NEVER delete files from `node_modules/` or from `src/modules/<mod>/` on behalf of the user — only edit `src/modules.ts`.
|
|
66
|
+
- NEVER drop database tables.
|
|
67
|
+
- If the user answers "no" to every removal candidate, exit quietly and note that classic mode is preserved.
|
|
18
68
|
|
|
19
|
-
##
|
|
69
|
+
## When NOT to run this skill
|
|
20
70
|
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
- Treat module metadata/source as read-only evidence and report uncertainty rather than guessing.
|
|
25
|
-
- Disabling a registry entry does not modify a framework public contract; do not load `BACKWARD_COMPATIBILITY.md` unless the requested work also changes a stable ID, route, type, signature, or other contract surface.
|
|
71
|
+
- In a monorepo development environment (`apps/mercato/src/modules.ts`) — the monorepo deliberately keeps every module enabled for framework development.
|
|
72
|
+
- On an imported ready app (`--app` or `--app-url`) — those snapshots are curated by their authors.
|
|
73
|
+
- During a `yarn dev` run — disabling modules while the server is live can cause transient errors. Ask the user to stop `yarn dev`, run the skill, then restart.
|