@open-mercato/cli 0.6.7 → 0.6.8-canary.319.1.5b4be4bc52
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 +77 -4
- package/build.mjs +68 -11
- package/dist/agentic/claude-code/hooks/entity-migration-check.ts +32 -88
- package/dist/agentic/codex/enforcement-rules.md +2 -16
- package/dist/agentic/cursor/hooks/entity-migration-check.mjs +19 -50
- package/dist/agentic/cursor/rules/entity-guard.mdc +9 -21
- package/dist/agentic/cursor/rules/generated-guard.mdc +3 -5
- package/dist/agentic/cursor/rules/open-mercato.mdc +3 -29
- package/dist/agentic/guides/ai-workflows.md +76 -0
- package/dist/agentic/guides/architecture.md +107 -0
- package/dist/agentic/guides/backend-ui.md +84 -0
- package/dist/agentic/guides/contracts.md +92 -0
- package/dist/agentic/guides/extensions.md +121 -0
- package/dist/agentic/guides/framework-extension-points.md +36 -0
- package/dist/agentic/guides/integrations.md +81 -0
- package/dist/agentic/guides/module-facts.json +116757 -3951
- package/dist/agentic/guides/module-system.md +12 -127
- package/dist/agentic/guides/modules/ai_assistant.md +227 -28
- package/dist/agentic/guides/modules/api_docs.md +58 -2
- package/dist/agentic/guides/modules/api_keys.md +92 -7
- package/dist/agentic/guides/modules/attachments.md +119 -14
- package/dist/agentic/guides/modules/audit_logs.md +131 -10
- package/dist/agentic/guides/modules/auth.md +276 -33
- package/dist/agentic/guides/modules/business_rules.md +149 -14
- package/dist/agentic/guides/modules/catalog.md +482 -43
- package/dist/agentic/guides/modules/channel_gmail.md +82 -3
- package/dist/agentic/guides/modules/channel_imap.md +82 -3
- package/dist/agentic/guides/modules/checkout.md +305 -27
- package/dist/agentic/guides/modules/communication_channels.md +315 -33
- package/dist/agentic/guides/modules/configs.md +104 -8
- package/dist/agentic/guides/modules/content.md +57 -2
- package/dist/agentic/guides/modules/currencies.md +152 -17
- package/dist/agentic/guides/modules/customer_accounts.md +387 -45
- package/dist/agentic/guides/modules/customers.md +746 -85
- package/dist/agentic/guides/modules/dashboards.md +155 -10
- package/dist/agentic/guides/modules/data_sync.md +149 -16
- package/dist/agentic/guides/modules/design_system.md +102 -0
- package/dist/agentic/guides/modules/dictionaries.md +107 -12
- package/dist/agentic/guides/modules/directory.md +148 -15
- package/dist/agentic/guides/modules/entities.md +145 -13
- package/dist/agentic/guides/modules/events.md +59 -2
- package/dist/agentic/guides/modules/feature_toggles.md +119 -9
- package/dist/agentic/guides/modules/gateway_stripe.md +92 -4
- package/dist/agentic/guides/modules/generators.md +45 -2
- package/dist/agentic/guides/modules/inbox_ops.md +207 -27
- package/dist/agentic/guides/modules/integrations.md +149 -16
- package/dist/agentic/guides/modules/messages.md +223 -24
- package/dist/agentic/guides/modules/notifications.md +96 -8
- package/dist/agentic/guides/modules/onboarding.md +77 -6
- package/dist/agentic/guides/modules/payment_gateways.md +168 -21
- package/dist/agentic/guides/modules/perspectives.md +77 -7
- package/dist/agentic/guides/modules/planner.md +136 -18
- package/dist/agentic/guides/modules/portal.md +93 -2
- package/dist/agentic/guides/modules/progress.md +104 -14
- package/dist/agentic/guides/modules/query_index.md +154 -15
- package/dist/agentic/guides/modules/record_locks.md +206 -21
- package/dist/agentic/guides/modules/resources.md +197 -30
- package/dist/agentic/guides/modules/sales.md +687 -84
- package/dist/agentic/guides/modules/scheduler.md +133 -14
- package/dist/agentic/guides/modules/search.md +170 -6
- package/dist/agentic/guides/modules/security.md +294 -35
- package/dist/agentic/guides/modules/shipping_carriers.md +134 -18
- package/dist/agentic/guides/modules/sso.md +151 -26
- package/dist/agentic/guides/modules/staff.md +372 -57
- package/dist/agentic/guides/modules/storage_s3.md +95 -5
- package/dist/agentic/guides/modules/sync_akeneo.md +85 -3
- package/dist/agentic/guides/modules/sync_excel.md +75 -6
- package/dist/agentic/guides/modules/system_status_overlays.md +60 -2
- package/dist/agentic/guides/modules/translations.md +104 -10
- package/dist/agentic/guides/modules/webhooks.md +203 -24
- package/dist/agentic/guides/modules/wms.md +469 -47
- package/dist/agentic/guides/modules/workflows.md +302 -43
- package/dist/agentic/guides/reference-module-facts.json +6370 -0
- package/dist/agentic/guides/reference-modules/example.md +451 -0
- package/dist/agentic/guides/spec-delivery.md +42 -0
- package/dist/agentic/guides/testing-debugging.md +80 -0
- package/dist/agentic/guides/upstream/AGENTS.md +299 -0
- package/dist/agentic/guides/upstream/BACKWARD_COMPATIBILITY.md +316 -0
- package/dist/agentic/guides/upstream/manifest.json +8 -0
- package/dist/agentic/shared/AGENTS.md.template +120 -311
- package/dist/agentic/shared/ai/agentic.config.json +2 -0
- package/dist/agentic/shared/ai/harness/README.md +50 -0
- package/dist/agentic/shared/ai/harness/RELEASE.md +57 -0
- package/dist/agentic/shared/ai/harness/cases.json +15050 -0
- package/dist/agentic/shared/ai/harness/cases.schema.json +188 -0
- package/dist/agentic/shared/ai/harness/fixtures/index.json +51 -0
- package/dist/agentic/shared/ai/harness/fixtures/seeds.json +166 -0
- package/dist/agentic/shared/ai/harness/generated-code-review-policy.md +21 -0
- package/dist/agentic/shared/ai/harness/generated-code-review-response.schema.json +96 -0
- package/dist/agentic/shared/ai/harness/generated-code-review-result.schema.json +172 -0
- package/dist/agentic/shared/ai/harness/knowledge-change.schema.json +228 -0
- package/dist/agentic/shared/ai/harness/release-matrix.json +163 -0
- package/dist/agentic/shared/ai/harness/release-result.schema.json +219 -0
- package/dist/agentic/shared/ai/harness/result.schema.json +109 -0
- package/dist/agentic/shared/ai/harness/routing-response.schema.json +22 -0
- package/dist/agentic/shared/ai/harness/target-validation-result.schema.json +73 -0
- package/dist/agentic/shared/ai/harness/validators.json +82 -0
- package/dist/agentic/shared/ai/harness/writable-ast-oracles.mjs +2121 -0
- package/dist/agentic/shared/ai/harness/writable-behavior-oracles.mjs +1096 -0
- package/dist/agentic/shared/ai/harness/writable-spec-oracles.mjs +412 -0
- package/dist/agentic/shared/ai/lessons/_template.md +16 -0
- package/dist/agentic/shared/ai/lessons.md +26 -3
- package/dist/agentic/shared/ai/review-checklist.md +36 -0
- package/dist/agentic/shared/ai/skills/om-auto-implement-spec/SKILL.md +21 -0
- package/dist/agentic/shared/ai/skills/om-auto-review-pr/SKILL.md +4 -0
- package/dist/agentic/shared/ai/skills/om-auto-upgrade-0.6.6-to-0.6.7/SKILL.md +98 -0
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/SKILL.md +21 -241
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/crud-surfaces.md +31 -0
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/frontend-and-design-system.md +53 -0
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/page-and-navigation.md +15 -0
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/quality-states.md +11 -0
- package/dist/agentic/shared/ai/skills/om-build-workflow/SKILL.md +30 -0
- package/dist/agentic/shared/ai/skills/om-build-workflow/references/activity-contracts.md +12 -0
- package/dist/agentic/shared/ai/skills/om-build-workflow/references/durability-and-progress.md +13 -0
- package/dist/agentic/shared/ai/skills/om-build-workflow/references/workflow-design.md +14 -0
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/SKILL.md +28 -0
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/references/attachments-and-overrides.md +12 -0
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/references/module-agents-and-tools.md +22 -0
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/references/orchestrator-agents.md +12 -0
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/references/surface-selector.md +19 -0
- package/dist/agentic/shared/ai/skills/om-data-model-design/SKILL.md +17 -601
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/integrity-and-concurrency.md +21 -0
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/migration-workflow.md +15 -0
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/schema-design.md +16 -0
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/sensitive-data.md +10 -0
- package/dist/agentic/shared/ai/skills/om-eject-and-customize/SKILL.md +15 -310
- package/dist/agentic/shared/ai/skills/om-eject-and-customize/references/decision-and-procedure.md +19 -0
- package/dist/agentic/shared/ai/skills/om-evolve-harness/SKILL.md +31 -0
- package/dist/agentic/shared/ai/skills/om-evolve-harness/references/case-template.md +100 -0
- package/dist/agentic/shared/ai/skills/om-evolve-harness/references/case-workflow.md +16 -0
- package/dist/agentic/shared/ai/skills/om-evolve-harness/references/knowledge-change.md +115 -0
- package/dist/agentic/shared/ai/skills/om-evolve-harness/references/owner-selection.md +17 -0
- package/dist/agentic/shared/ai/skills/om-framework-context/SKILL.md +25 -0
- package/dist/agentic/shared/ai/skills/om-framework-context/references/resolver-procedure.md +11 -0
- package/dist/agentic/shared/ai/skills/om-framework-context/references/skew-and-escalation.md +13 -0
- package/dist/agentic/shared/ai/skills/om-help/SKILL.md +15 -97
- package/dist/agentic/shared/ai/skills/om-help/references/delivery-workflows.md +18 -0
- package/dist/agentic/shared/ai/skills/om-help/references/task-families.md +20 -0
- package/dist/agentic/shared/ai/skills/om-implement-spec/SKILL.md +33 -152
- package/dist/agentic/shared/ai/skills/om-implement-spec/references/phases-and-gates.md +33 -0
- package/dist/agentic/shared/ai/skills/om-implement-spec/references/planning-and-progress.md +40 -0
- package/dist/agentic/shared/ai/skills/om-implement-spec/references/report-templates.md +27 -0
- package/dist/agentic/shared/ai/skills/om-implement-spec/references/spec-resolution.md +24 -0
- package/dist/agentic/shared/ai/skills/om-integration-builder/SKILL.md +25 -708
- package/dist/agentic/shared/ai/skills/om-integration-builder/references/package-and-activation.md +16 -0
- package/dist/agentic/shared/ai/skills/om-integration-builder/references/provider-families.md +25 -0
- package/dist/agentic/shared/ai/skills/om-integration-builder/references/security-and-reliability.md +15 -0
- package/dist/agentic/shared/ai/skills/om-integration-builder/references/sync-and-files.md +12 -0
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/SKILL.md +34 -0
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/agents/openai.yaml +4 -0
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/agentic-setup.md +11 -0
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/input-normalization.md +31 -0
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/judge-workflow.md +39 -0
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/report-template.md +43 -0
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/rules.md +11 -0
- package/dist/agentic/shared/ai/skills/om-module-scaffold/SKILL.md +20 -820
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/api-and-domain.md +32 -0
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/business-one-shot-blueprints.md +172 -0
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/data-and-migrations.md +14 -0
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/discovery-surface-catalog.md +83 -0
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/module-surfaces.md +40 -0
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/planning.md +11 -0
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/runtime-cache-and-queues.md +22 -0
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/verification.md +13 -0
- package/dist/agentic/shared/ai/skills/om-share-this-session/SKILL.md +41 -0
- package/dist/agentic/shared/ai/skills/om-share-this-session/references/agentic-setup.md +19 -0
- package/dist/agentic/shared/ai/skills/om-share-this-session/references/bundle-preparation.md +44 -0
- package/dist/agentic/shared/ai/skills/om-share-this-session/references/consent-and-review.md +39 -0
- package/dist/agentic/shared/ai/skills/om-share-this-session/references/publication.md +20 -0
- package/dist/agentic/shared/ai/skills/om-share-this-session/references/report-templates.md +57 -0
- package/dist/agentic/shared/ai/skills/om-share-this-session/references/rules.md +11 -0
- package/dist/agentic/shared/ai/skills/om-share-this-session/scripts/prepare-share-bundle.mjs +486 -0
- package/dist/agentic/shared/ai/skills/om-system-extension/SKILL.md +20 -843
- package/dist/agentic/shared/ai/skills/om-system-extension/references/extension-branches.md +42 -0
- package/dist/agentic/shared/ai/skills/om-system-extension/references/mechanism-selector.md +27 -0
- package/dist/agentic/shared/ai/skills/om-system-extension/references/read-write-roundtrip.md +13 -0
- package/dist/agentic/shared/ai/skills/om-system-extension/references/unified-overrides.md +43 -0
- package/dist/agentic/shared/ai/skills/om-system-extension/references/verification.md +11 -0
- package/dist/agentic/shared/ai/skills/om-trim-unused-modules/SKILL.md +15 -63
- package/dist/agentic/shared/ai/skills/om-trim-unused-modules/references/dependency-and-redirect.md +15 -0
- package/dist/agentic/shared/ai/skills/om-troubleshooter/SKILL.md +17 -467
- package/dist/agentic/shared/ai/skills/om-troubleshooter/references/diagnosis-map.md +29 -0
- package/dist/agentic/shared/ai/skills/om-troubleshooter/references/regression-oracles.md +14 -0
- package/dist/agentic/shared/ai/skills/tiers.json +143 -21
- package/dist/agentic/shared/ai/skills/tiers.schema.json +52 -40
- package/dist/agentic/shared/ai/specs/README.md +4 -3
- package/dist/agentic/shared/ai/specs/SPEC-000-template.md +226 -10
- package/dist/agentic/shared/ai/trackers/github.md +108 -4
- package/dist/agentic/shared/scripts/agent-harness-tool-server.mjs +224 -0
- package/dist/agentic/shared/scripts/check-lessons.mjs +178 -0
- package/dist/agentic/shared/scripts/evaluate-agent-harness.mjs +3585 -0
- package/dist/agentic/shared/scripts/execution-sandbox.mjs +329 -0
- package/dist/agentic/shared/scripts/framework-context.mjs +888 -0
- package/dist/agentic/shared/scripts/install-skills.mjs +1029 -0
- package/dist/agentic/shared/scripts/install-skills.sh +4 -694
- package/dist/agentic/shared/scripts/prepare-agent-harness-fixture.mjs +222 -0
- package/dist/agentic/shared/scripts/run-agent-harness-release.mjs +1774 -0
- package/dist/agentic/shared/scripts/validate-knowledge-change.mjs +911 -0
- package/dist/bin.js +13 -1
- package/dist/bin.js.map +2 -2
- package/dist/lib/__integration__/TC-INT-008.spec.js +88 -8
- package/dist/lib/__integration__/TC-INT-008.spec.js.map +2 -2
- package/dist/lib/agentic-init.js +13 -3
- package/dist/lib/agentic-init.js.map +2 -2
- package/dist/lib/agentic-setup.js +434 -186
- package/dist/lib/agentic-setup.js.map +2 -2
- package/dist/lib/generators/extensions/injection-widgets.js +20 -0
- package/dist/lib/generators/extensions/injection-widgets.js.map +2 -2
- package/dist/lib/generators/module-extension-facts.js +1872 -0
- package/dist/lib/generators/module-extension-facts.js.map +7 -0
- package/dist/lib/generators/module-fact-sources.js +70 -0
- package/dist/lib/generators/module-fact-sources.js.map +7 -0
- package/dist/lib/generators/module-facts-discovery.js +64 -7
- package/dist/lib/generators/module-facts-discovery.js.map +2 -2
- package/dist/lib/generators/module-facts.js +1629 -52
- package/dist/lib/generators/module-facts.js.map +3 -3
- package/dist/lib/generators/module-override-targets.js +688 -0
- package/dist/lib/generators/module-override-targets.js.map +7 -0
- package/dist/lib/generators/module-registry.js +11 -5
- package/dist/lib/generators/module-registry.js.map +2 -2
- package/dist/lib/load-env.js +24 -0
- package/dist/lib/load-env.js.map +7 -0
- package/dist/lib/resolver.js +2 -0
- package/dist/lib/resolver.js.map +2 -2
- package/dist/lib/telemetry-init.js +358 -0
- package/dist/lib/telemetry-init.js.map +7 -0
- package/dist/lib/testing/integration.js +5 -2
- package/dist/lib/testing/integration.js.map +2 -2
- package/dist/mercato.js +23 -1
- package/dist/mercato.js.map +2 -2
- package/package.json +13 -11
- package/src/bin.ts +33 -1
- package/src/lib/__integration__/TC-INT-008.spec.ts +107 -9
- package/src/lib/__tests__/agentic-init.test.ts +41 -5
- package/src/lib/__tests__/agentic-setup.ownership.test.ts +386 -0
- package/src/lib/__tests__/injection-widget-id-validation.test.ts +184 -0
- package/src/lib/__tests__/load-env.test.ts +65 -0
- package/src/lib/__tests__/telemetry-init.test.ts +298 -0
- package/src/lib/agentic-init.ts +15 -3
- package/src/lib/agentic-setup.ts +573 -222
- package/src/lib/generators/__tests__/activation-adapter-coverage.test.ts +92 -0
- package/src/lib/generators/__tests__/module-extension-activations.test.ts +762 -0
- package/src/lib/generators/__tests__/module-extension-facts.test.ts +603 -0
- package/src/lib/generators/__tests__/module-facts.bc-guard.test.ts +139 -2
- package/src/lib/generators/__tests__/module-facts.computed-di-token.test.ts +88 -0
- package/src/lib/generators/__tests__/module-facts.customers.fixture.test.ts +1 -0
- package/src/lib/generators/__tests__/module-facts.discovery.test.ts +54 -10
- package/src/lib/generators/__tests__/module-facts.extension-hosts.test.ts +108 -0
- package/src/lib/generators/__tests__/module-facts.local-reference.test.ts +391 -0
- package/src/lib/generators/__tests__/module-facts.owned-contracts.test.ts +561 -0
- package/src/lib/generators/__tests__/module-facts.search-entity-id.test.ts +151 -0
- package/src/lib/generators/__tests__/module-facts.source-links.test.ts +160 -0
- package/src/lib/generators/__tests__/module-override-targets.roundtrip.test.ts +149 -0
- package/src/lib/generators/__tests__/module-override-targets.test.ts +328 -0
- package/src/lib/generators/__tests__/module-subset.test.ts +18 -0
- package/src/lib/generators/extensions/injection-widgets.ts +51 -0
- package/src/lib/generators/module-extension-facts.ts +2433 -0
- package/src/lib/generators/module-fact-sources.ts +108 -0
- package/src/lib/generators/module-facts-discovery.ts +104 -7
- package/src/lib/generators/module-facts.ts +2387 -138
- package/src/lib/generators/module-override-targets.ts +863 -0
- package/src/lib/generators/module-registry.ts +16 -6
- package/src/lib/load-env.ts +30 -0
- package/src/lib/resolver.ts +3 -0
- package/src/lib/telemetry-init.ts +461 -0
- package/src/lib/testing/__tests__/integration.test.ts +4 -0
- package/src/lib/testing/integration.ts +5 -2
- package/src/mercato.ts +26 -1
- package/dist/agentic/guides/cache.md +0 -45
- package/dist/agentic/guides/core.md +0 -453
- package/dist/agentic/guides/events.md +0 -117
- package/dist/agentic/guides/queue.md +0 -53
- package/dist/agentic/guides/search.md +0 -115
- package/dist/agentic/guides/shared.md +0 -108
- package/dist/agentic/guides/ui.md +0 -347
- package/dist/agentic/shared/ai/skills/om-auto-continue-pr-loop/SKILL.md +0 -27
- package/dist/agentic/shared/ai/skills/om-auto-create-pr-loop/SKILL.md +0 -27
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/ui-components.md +0 -260
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/mikro-orm-cheatsheet.md +0 -146
- package/dist/agentic/shared/ai/skills/om-help/references/skills-catalog.md +0 -84
- package/dist/agentic/shared/ai/skills/om-help/references/workflow-sequences.md +0 -193
- package/dist/agentic/shared/ai/skills/om-integration-builder/STANDALONE.md +0 -34
- package/dist/agentic/shared/ai/skills/om-integration-builder/references/adapter-contracts.md +0 -762
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/naming-conventions.md +0 -50
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/navigation-patterns.md +0 -97
- package/dist/agentic/shared/ai/skills/om-system-extension/references/extension-contracts.md +0 -271
- package/dist/agentic/shared/ai/skills/om-troubleshooter/references/diagnostic-commands.md +0 -101
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
[build:cli] found
|
|
1
|
+
[build:cli] found 101 entry points
|
|
2
2
|
Copied create-app/agentic/ → dist/agentic/
|
|
3
|
-
Discovered 7 standalone guides → dist/agentic/guides/
|
|
4
3
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for ai_assistant
|
|
5
4
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for channel_gmail
|
|
6
5
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for channel_imap
|
|
7
6
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for checkout
|
|
7
|
+
[module-facts] searchConfig entityId is not statically resolvable: /home/runner/work/open-mercato/open-mercato/packages/checkout/src/modules/checkout/search.ts:11
|
|
8
|
+
[module-facts] searchConfig entityId is not statically resolvable: /home/runner/work/open-mercato/open-mercato/packages/checkout/src/modules/checkout/search.ts:30
|
|
9
|
+
[module-facts] searchConfig entityId is not statically resolvable: /home/runner/work/open-mercato/open-mercato/packages/checkout/src/modules/checkout/search.ts:56
|
|
8
10
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for content
|
|
9
11
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for api_docs
|
|
10
12
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for api_keys
|
|
@@ -20,14 +22,72 @@ Discovered 7 standalone guides → dist/agentic/guides/
|
|
|
20
22
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for customers
|
|
21
23
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for dashboards
|
|
22
24
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for data_sync
|
|
25
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for design_system
|
|
26
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for dictionaries
|
|
27
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for directory
|
|
28
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for entities
|
|
29
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for feature_toggles
|
|
30
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for inbox_ops
|
|
31
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for integrations
|
|
32
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for messages
|
|
33
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for notifications
|
|
34
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for payment_gateways
|
|
35
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for perspectives
|
|
36
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for planner
|
|
37
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for portal
|
|
38
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for progress
|
|
39
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for query_index
|
|
40
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for resources
|
|
41
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for sales
|
|
42
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for shipping_carriers
|
|
43
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for staff
|
|
44
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for sync_excel
|
|
45
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for translations
|
|
46
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for wms
|
|
47
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for workflows
|
|
48
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for record_locks
|
|
49
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for security
|
|
50
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for sso
|
|
51
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for system_status_overlays
|
|
52
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for events
|
|
53
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for gateway_stripe
|
|
54
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for onboarding
|
|
55
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for scheduler
|
|
56
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for search
|
|
57
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for generators
|
|
58
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for storage_s3
|
|
59
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for sync_akeneo
|
|
60
|
+
Generated 55 module fact-sheets → dist/agentic/guides/modules/
|
|
61
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for webhooks
|
|
62
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for ai_assistant
|
|
63
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for channel_gmail
|
|
64
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for channel_imap
|
|
65
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for checkout
|
|
66
|
+
[module-facts] searchConfig entityId is not statically resolvable: /home/runner/work/open-mercato/open-mercato/packages/checkout/src/modules/checkout/search.ts:11
|
|
67
|
+
[module-facts] searchConfig entityId is not statically resolvable: /home/runner/work/open-mercato/open-mercato/packages/checkout/src/modules/checkout/search.ts:30
|
|
68
|
+
[module-facts] searchConfig entityId is not statically resolvable: /home/runner/work/open-mercato/open-mercato/packages/checkout/src/modules/checkout/search.ts:56
|
|
69
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for content
|
|
70
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for api_docs
|
|
71
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for api_keys
|
|
72
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for attachments
|
|
73
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for audit_logs
|
|
74
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for auth
|
|
75
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for business_rules
|
|
76
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for catalog
|
|
77
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for communication_channels
|
|
78
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for configs
|
|
79
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for currencies
|
|
80
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for customer_accounts
|
|
81
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for customers
|
|
82
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for dashboards
|
|
83
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for data_sync
|
|
84
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for design_system
|
|
23
85
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for dictionaries
|
|
24
86
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for directory
|
|
25
87
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for entities
|
|
26
|
-
Generated 54 module fact-sheets → dist/agentic/guides/modules/
|
|
27
88
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for feature_toggles
|
|
28
89
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for inbox_ops
|
|
29
90
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for integrations
|
|
30
|
-
[build:cli] built successfully
|
|
31
91
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for messages
|
|
32
92
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for notifications
|
|
33
93
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for payment_gateways
|
|
@@ -57,3 +117,16 @@ Generated 54 module fact-sheets → dist/agentic/guides/modules/
|
|
|
57
117
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for storage_s3
|
|
58
118
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for sync_akeneo
|
|
59
119
|
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for webhooks
|
|
120
|
+
[module-facts] module registry unavailable (registryPath not provided); API route auth omitted for example
|
|
121
|
+
[module-facts] example unresolved-first-party-target: example:auto-default-priority:example.todo.creating (src/modules/example/subscribers/auto-default-priority.ts)
|
|
122
|
+
[module-facts] example unresolved-first-party-target: example:example-event:example.ping (src/modules/example/subscribers/example-event.ts)
|
|
123
|
+
[module-facts] example unresolved-first-party-target: example:prevent-uncomplete:example.todo.updating (src/modules/example/subscribers/prevent-uncomplete.ts)
|
|
124
|
+
[module-facts] example unresolved-first-party-target: example.injection.crud-validation@example:phase-c-handlers:example:phase-c-handlers (src/modules/example/widgets/injection-table.ts)
|
|
125
|
+
[module-facts] example unresolved-first-party-target: example.todo-limit:example.todo (src/modules/example/data/guards.ts)
|
|
126
|
+
[module-facts][reference] unresolved first-party target: example:example:auto-default-priority:example.todo.creating
|
|
127
|
+
[module-facts][reference] unresolved first-party target: example:example:example-event:example.ping
|
|
128
|
+
[module-facts][reference] unresolved first-party target: example:example:prevent-uncomplete:example.todo.updating
|
|
129
|
+
[module-facts][reference] unresolved first-party target: example:example.injection.crud-validation@example:phase-c-handlers:example:phase-c-handlers
|
|
130
|
+
[module-facts][reference] unresolved first-party target: example:example.todo-limit:example.todo
|
|
131
|
+
Generated 1 local reference projection(s) → dist/agentic/guides/reference-modules/
|
|
132
|
+
[build:cli] built successfully
|
package/build.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { chmodSync, cpSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
|
|
2
|
+
import { createHash } from 'node:crypto'
|
|
2
3
|
import { dirname, join } from 'node:path'
|
|
3
4
|
import { fileURLToPath, pathToFileURL } from 'node:url'
|
|
4
5
|
import { atomicWriteFileSync } from '../../scripts/lib/add-js-extension.mjs'
|
|
@@ -26,11 +27,26 @@ await buildPackage(packageDir, {
|
|
|
26
27
|
// Copy agentic source files from create-app so generators can read them at runtime.
|
|
27
28
|
const agenticSrc = join(packageDir, '..', 'create-app', 'agentic')
|
|
28
29
|
if (existsSync(agenticSrc)) {
|
|
30
|
+
rmSync(join(outdir, 'agentic'), { recursive: true, force: true })
|
|
29
31
|
cpSync(agenticSrc, join(outdir, 'agentic'), { recursive: true })
|
|
30
32
|
console.log('Copied create-app/agentic/ → dist/agentic/')
|
|
31
33
|
}
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
const repositoryRoot = join(packageDir, '..', '..')
|
|
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.
|
|
34
50
|
const packagesDir = join(packageDir, '..')
|
|
35
51
|
const guidesDestDir = join(outdir, 'agentic', 'guides')
|
|
36
52
|
mkdirSync(guidesDestDir, { recursive: true })
|
|
@@ -39,9 +55,10 @@ await buildPackage(packageDir, {
|
|
|
39
55
|
// retains a removed module's full guide or fact-sheet. The legacy `core.<module>.md`
|
|
40
56
|
// redirect stubs are no longer emitted (#3754); this purge also deletes any that linger
|
|
41
57
|
// in an incremental `dist/` from an older build. Mirrors packages/create-app/build.mjs;
|
|
42
|
-
//
|
|
43
|
-
// re-copied/re-discovered below.
|
|
58
|
+
// conceptual guides remain while stale single-dot package guides are removed below.
|
|
44
59
|
rmSync(join(guidesDestDir, 'modules'), { recursive: true, force: true })
|
|
60
|
+
rmSync(join(guidesDestDir, 'reference-modules'), { recursive: true, force: true })
|
|
61
|
+
rmSync(join(guidesDestDir, 'reference-module-facts.json'), { force: true })
|
|
45
62
|
for (const entry of readdirSync(guidesDestDir)) {
|
|
46
63
|
if (/^core\..+\.md$/.test(entry)) {
|
|
47
64
|
rmSync(join(guidesDestDir, entry))
|
|
@@ -50,10 +67,11 @@ await buildPackage(packageDir, {
|
|
|
50
67
|
|
|
51
68
|
let guidesFound = 0
|
|
52
69
|
for (const pkg of readdirSync(packagesDir)) {
|
|
70
|
+
// Package-level source guides remain for monorepo context, but standalone apps route
|
|
71
|
+
// through conceptual and module-level guides, so remove their stale emitted copies.
|
|
53
72
|
const guideSource = join(packagesDir, pkg, 'agentic', 'standalone-guide.md')
|
|
54
73
|
if (existsSync(guideSource)) {
|
|
55
|
-
|
|
56
|
-
guidesFound++
|
|
74
|
+
rmSync(join(guidesDestDir, `${pkg}.md`), { force: true })
|
|
57
75
|
}
|
|
58
76
|
|
|
59
77
|
const modulesDir = join(packagesDir, pkg, 'src', 'modules')
|
|
@@ -76,15 +94,24 @@ await buildPackage(packageDir, {
|
|
|
76
94
|
// the freshly built ts-morph extractor + resolver-routed discovery, so
|
|
77
95
|
// `mercato agentic:init` bundles the same guides as a create-mercato-app scaffold
|
|
78
96
|
// (packages/create-app/build.mjs). Discovery goes through the resolver, never a
|
|
79
|
-
// hardcoded packages/* path (.ai/lessons.md
|
|
80
|
-
const {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
97
|
+
// hardcoded packages/* path (.ai/lessons/standalone-scaffolding-and-generators-must-not-assume.md).
|
|
98
|
+
const {
|
|
99
|
+
assertPackageModuleFactsOnly,
|
|
100
|
+
extractAllModuleFacts,
|
|
101
|
+
extractLocalReferenceModuleFacts,
|
|
102
|
+
renderModuleFactsJson,
|
|
103
|
+
renderReferenceModuleFactsJson,
|
|
104
|
+
} = await import(pathToFileURL(join(outdir, 'lib', 'generators', 'module-facts.js')).href)
|
|
105
|
+
const { discoverLocalReferenceModuleSource, discoverPackageModuleSources } = await import(
|
|
84
106
|
pathToFileURL(join(outdir, 'lib', 'generators', 'module-facts-discovery.js')).href
|
|
85
107
|
)
|
|
86
108
|
const { createResolver } = await import(pathToFileURL(join(outdir, 'lib', 'resolver.js')).href)
|
|
87
109
|
|
|
110
|
+
// Mirrors packages/create-app/build.mjs: the disabled app-local example never enters
|
|
111
|
+
// the normal package outputs and is projected into its own reference bundle so
|
|
112
|
+
// `mercato agentic:init` bundles exactly what a create-mercato-app scaffold does.
|
|
113
|
+
const REFERENCE_MODULE_IDS = ['example']
|
|
114
|
+
|
|
88
115
|
const sources = discoverPackageModuleSources(createResolver(join(packagesDir, '..')))
|
|
89
116
|
if (sources.length > 0) {
|
|
90
117
|
const registryPath = join(packagesDir, '..', 'apps', 'mercato', '.mercato', 'generated', 'modules.runtime.generated.ts')
|
|
@@ -95,21 +122,51 @@ await buildPackage(packageDir, {
|
|
|
95
122
|
coreVersion = null
|
|
96
123
|
}
|
|
97
124
|
|
|
98
|
-
const { factsByModule, markdownByModule, warnings } = extractAllModuleFacts({
|
|
125
|
+
const { factsByModule, markdownByModule, frameworkMarkdown, warnings } = extractAllModuleFacts({
|
|
99
126
|
sources,
|
|
100
127
|
registryPath: existsSync(registryPath) ? registryPath : null,
|
|
101
128
|
coreVersion,
|
|
102
129
|
})
|
|
103
130
|
|
|
131
|
+
assertPackageModuleFactsOnly(factsByModule)
|
|
132
|
+
|
|
104
133
|
const modulesGuidesDir = join(guidesDestDir, 'modules')
|
|
105
134
|
mkdirSync(modulesGuidesDir, { recursive: true })
|
|
106
135
|
for (const [moduleId, markdown] of Object.entries(markdownByModule)) {
|
|
107
136
|
writeFileSync(join(modulesGuidesDir, `${moduleId}.md`), markdown)
|
|
108
137
|
}
|
|
109
138
|
writeFileSync(join(guidesDestDir, 'module-facts.json'), renderModuleFactsJson(factsByModule))
|
|
139
|
+
writeFileSync(join(guidesDestDir, 'framework-extension-points.md'), frameworkMarkdown)
|
|
110
140
|
|
|
111
141
|
for (const warning of warnings) console.warn(warning)
|
|
112
142
|
console.log(`Generated ${Object.keys(markdownByModule).length} module fact-sheets → dist/agentic/guides/modules/`)
|
|
143
|
+
|
|
144
|
+
const referenceBundle = {}
|
|
145
|
+
const referenceGuidesDir = join(guidesDestDir, 'reference-modules')
|
|
146
|
+
const templateRoot = join(packagesDir, 'create-app', 'template')
|
|
147
|
+
for (const moduleId of REFERENCE_MODULE_IDS) {
|
|
148
|
+
const reference = discoverLocalReferenceModuleSource({ appRoot: templateRoot, moduleId })
|
|
149
|
+
if (!reference) {
|
|
150
|
+
throw new Error(`[module-facts] reference module "${moduleId}" is missing from the create-app template`)
|
|
151
|
+
}
|
|
152
|
+
const { entry, markdown, warnings: referenceWarnings, unresolvedTargets } = extractLocalReferenceModuleFacts({
|
|
153
|
+
packageSources: sources,
|
|
154
|
+
reference,
|
|
155
|
+
registryPath: existsSync(registryPath) ? registryPath : null,
|
|
156
|
+
coreVersion,
|
|
157
|
+
})
|
|
158
|
+
referenceBundle[moduleId] = entry
|
|
159
|
+
mkdirSync(referenceGuidesDir, { recursive: true })
|
|
160
|
+
writeFileSync(join(referenceGuidesDir, `${moduleId}.md`), markdown)
|
|
161
|
+
for (const warning of referenceWarnings) console.warn(warning)
|
|
162
|
+
for (const target of unresolvedTargets) {
|
|
163
|
+
console.warn(`[module-facts][reference] unresolved first-party target: ${target}`)
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
writeFileSync(join(guidesDestDir, 'reference-module-facts.json'), renderReferenceModuleFactsJson(referenceBundle))
|
|
167
|
+
console.log(
|
|
168
|
+
`Generated ${REFERENCE_MODULE_IDS.length} local reference projection(s) → dist/agentic/guides/reference-modules/`,
|
|
169
|
+
)
|
|
113
170
|
} else {
|
|
114
171
|
console.warn('[module-facts] no package modules discovered; skipping fact-sheet generation')
|
|
115
172
|
}
|
|
@@ -1,121 +1,65 @@
|
|
|
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
|
-
|
|
1
|
+
/** Remind Claude Code to generate and review a schema diff after entity edits. */
|
|
13
2
|
import { readdirSync, statSync } from 'node:fs'
|
|
14
3
|
import { join, relative } from 'node:path'
|
|
15
4
|
|
|
16
|
-
const ENTITY_PATTERN = /^src\/modules\/([^/]+)\/entities
|
|
17
|
-
const MIGRATION_PATTERN = /^src\/modules\/([^/]+)\/migrations
|
|
5
|
+
const ENTITY_PATTERN = /^src\/modules\/([^/]+)\/data\/entities\.ts$/
|
|
6
|
+
const MIGRATION_PATTERN = /^src\/modules\/([^/]+)\/migrations\/[^/]+\.ts$/
|
|
18
7
|
|
|
19
8
|
interface PostToolUseInput {
|
|
20
|
-
tool_input?: {
|
|
21
|
-
file_path?: string
|
|
22
|
-
content?: string
|
|
23
|
-
}
|
|
24
|
-
tool_name?: string
|
|
9
|
+
tool_input?: { file_path?: string }
|
|
25
10
|
}
|
|
26
11
|
|
|
27
|
-
function
|
|
28
|
-
|
|
29
|
-
if (filePath.startsWith('/')) {
|
|
30
|
-
return relative(projectDir, filePath)
|
|
31
|
-
}
|
|
32
|
-
return filePath
|
|
12
|
+
function projectDir(): string {
|
|
13
|
+
return process.env.CLAUDE_PROJECT_DIR || process.cwd()
|
|
33
14
|
}
|
|
34
15
|
|
|
35
|
-
function
|
|
36
|
-
const
|
|
37
|
-
|
|
16
|
+
function normalizedRelative(filePath: string): string {
|
|
17
|
+
const value = filePath.startsWith('/') ? relative(projectDir(), filePath) : filePath
|
|
18
|
+
return value.replaceAll('\\', '/')
|
|
19
|
+
}
|
|
38
20
|
|
|
21
|
+
function hasFreshMigration(moduleId: string): boolean {
|
|
22
|
+
const migrationsDir = join(projectDir(), 'src', 'modules', moduleId, 'migrations')
|
|
39
23
|
try {
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
}
|
|
24
|
+
const cutoff = Date.now() - 30_000
|
|
25
|
+
return readdirSync(migrationsDir).some((file) =>
|
|
26
|
+
file.endsWith('.ts') && statSync(join(migrationsDir, file)).mtimeMs > cutoff,
|
|
27
|
+
)
|
|
51
28
|
} catch {
|
|
52
|
-
|
|
29
|
+
return false
|
|
53
30
|
}
|
|
54
|
-
|
|
55
|
-
return false
|
|
56
31
|
}
|
|
57
32
|
|
|
58
33
|
async function main(): Promise<void> {
|
|
59
34
|
let input = ''
|
|
60
|
-
for await (const chunk of process.stdin)
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (!input.trim()) {
|
|
65
|
-
process.exit(0)
|
|
66
|
-
}
|
|
35
|
+
for await (const chunk of process.stdin) input += chunk
|
|
36
|
+
if (!input.trim()) return
|
|
67
37
|
|
|
68
38
|
let data: PostToolUseInput
|
|
69
39
|
try {
|
|
70
40
|
data = JSON.parse(input)
|
|
71
41
|
} catch {
|
|
72
|
-
|
|
42
|
+
return
|
|
73
43
|
}
|
|
74
44
|
|
|
75
45
|
const filePath = data.tool_input?.file_path
|
|
76
|
-
if (!filePath)
|
|
77
|
-
|
|
78
|
-
|
|
46
|
+
if (!filePath) return
|
|
47
|
+
const rel = normalizedRelative(filePath)
|
|
48
|
+
if (MIGRATION_PATTERN.test(rel)) return
|
|
79
49
|
|
|
80
|
-
const
|
|
50
|
+
const match = rel.match(ENTITY_PATTERN)
|
|
51
|
+
if (!match || hasFreshMigration(match[1])) return
|
|
81
52
|
|
|
82
|
-
|
|
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 = {
|
|
53
|
+
process.stdout.write(JSON.stringify({
|
|
102
54
|
decision: 'block',
|
|
103
55
|
reason: [
|
|
104
|
-
`Entity
|
|
105
|
-
'',
|
|
106
|
-
`Affected module: ${moduleId}`,
|
|
107
|
-
'',
|
|
108
|
-
'A database migration is likely needed. Ask the user whether to run:',
|
|
109
|
-
' yarn db:generate',
|
|
56
|
+
`Entity contract changed: ${rel}`,
|
|
110
57
|
'',
|
|
111
|
-
'
|
|
112
|
-
'
|
|
113
|
-
'',
|
|
114
|
-
'Do NOT run migrations automatically — always confirm with the user first.',
|
|
58
|
+
'Run `yarn db:generate` as a schema-diff probe and review only the scoped migration plus module snapshot.',
|
|
59
|
+
'Run `yarn generate` when discovery changed.',
|
|
60
|
+
'Do not apply the migration with `yarn db:migrate` without explicit user approval.',
|
|
115
61
|
].join('\n'),
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
process.stdout.write(JSON.stringify(result))
|
|
62
|
+
}))
|
|
119
63
|
}
|
|
120
64
|
|
|
121
|
-
main()
|
|
65
|
+
void main()
|
|
@@ -1,20 +1,6 @@
|
|
|
1
1
|
<!-- CODEX_ENFORCEMENT_RULES_START -->
|
|
2
|
-
##
|
|
2
|
+
## Codex enforcement
|
|
3
3
|
|
|
4
|
-
|
|
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
|
|
4
|
+
Read and route through the rest of this file; its `Always`, `Never`, and Task Router sections are the authority for Codex too. They are stated once below rather than duplicated here, so this prelude costs the router no budget.
|
|
11
5
|
|
|
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
|
-
---
|
|
20
6
|
<!-- CODEX_ENFORCEMENT_RULES_END -->
|
|
@@ -1,69 +1,38 @@
|
|
|
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
|
-
|
|
1
|
+
/** Remind Cursor to generate and review a schema diff after entity edits. */
|
|
13
2
|
import { readdirSync, statSync } from 'node:fs'
|
|
14
|
-
import { join, resolve } from 'node:path'
|
|
3
|
+
import { join, relative, resolve } from 'node:path'
|
|
15
4
|
|
|
16
|
-
const ENTITY_RE = /^src\/modules\/([^/]+)\/entities
|
|
17
|
-
const MIGRATION_RE = /^src\/modules\/([^/]+)\/migrations
|
|
5
|
+
const ENTITY_RE = /^src\/modules\/([^/]+)\/data\/entities\.ts$/
|
|
6
|
+
const MIGRATION_RE = /^src\/modules\/([^/]+)\/migrations\/[^/]+\.ts$/
|
|
18
7
|
|
|
19
8
|
function hasFreshMigration(projectDir, moduleId) {
|
|
20
9
|
const migrationsDir = join(projectDir, 'src', 'modules', moduleId, 'migrations')
|
|
21
10
|
try {
|
|
22
|
-
const files = readdirSync(migrationsDir)
|
|
23
11
|
const cutoff = Date.now() - 30_000
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
if (stat.mtimeMs > cutoff) return true
|
|
28
|
-
}
|
|
12
|
+
return readdirSync(migrationsDir).some((file) =>
|
|
13
|
+
file.endsWith('.ts') && statSync(join(migrationsDir, file)).mtimeMs > cutoff,
|
|
14
|
+
)
|
|
29
15
|
} catch {
|
|
30
|
-
|
|
16
|
+
return false
|
|
31
17
|
}
|
|
32
|
-
return false
|
|
33
18
|
}
|
|
34
19
|
|
|
35
20
|
const filePath = process.argv[2]
|
|
36
21
|
if (!filePath) process.exit(0)
|
|
37
22
|
|
|
38
23
|
const projectDir = resolve('.')
|
|
39
|
-
const rel = filePath.startsWith('/') ?
|
|
40
|
-
|
|
41
|
-
// State 1: Migration file written
|
|
24
|
+
const rel = (filePath.startsWith('/') ? relative(projectDir, filePath) : filePath).replaceAll('\\', '/')
|
|
42
25
|
if (MIGRATION_RE.test(rel)) process.exit(0)
|
|
43
26
|
|
|
44
|
-
// State 2: Not an entity file
|
|
45
27
|
const match = rel.match(ENTITY_RE)
|
|
46
|
-
if (!match) process.exit(0)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
)
|
|
28
|
+
if (!match || hasFreshMigration(projectDir, match[1])) process.exit(0)
|
|
29
|
+
|
|
30
|
+
process.stderr.write([
|
|
31
|
+
`Entity contract changed: ${rel}`,
|
|
32
|
+
'',
|
|
33
|
+
'Run `yarn db:generate` as a schema-diff probe and review only the scoped migration plus module snapshot.',
|
|
34
|
+
'Run `yarn generate` when discovery changed.',
|
|
35
|
+
'Do not apply the migration with `yarn db:migrate` without explicit user approval.',
|
|
36
|
+
'',
|
|
37
|
+
].join('\n'))
|
|
69
38
|
process.exit(1)
|
|
@@ -1,29 +1,17 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Entity
|
|
2
|
+
description: Entity schema-diff guard for the canonical standalone entity file
|
|
3
3
|
globs:
|
|
4
|
-
- src/modules/*/entities
|
|
4
|
+
- src/modules/*/data/entities.ts
|
|
5
5
|
alwaysApply: false
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
# Entity
|
|
8
|
+
# Entity Schema Change
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Follow root `AGENTS.md` and `om-data-model-design`:
|
|
11
11
|
|
|
12
|
-
1.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
1. Run `yarn db:generate` as a schema-diff probe.
|
|
13
|
+
2. Review and keep only scoped migration SQL plus the touched module snapshot.
|
|
14
|
+
3. Run `yarn generate` when discovery changed.
|
|
15
|
+
4. Ask before applying with `yarn db:migrate`.
|
|
16
16
|
|
|
17
|
-
|
|
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.
|
|
17
|
+
Never edit a shipped migration or generated registry.
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Prevent
|
|
2
|
+
description: Prevent edits to generated application registries
|
|
3
3
|
globs:
|
|
4
4
|
- .mercato/generated/**
|
|
5
5
|
alwaysApply: false
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
#
|
|
8
|
+
# Generated File
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
To change generated output, edit the source modules in `src/modules/` and run `yarn generate`.
|
|
10
|
+
Do not edit this file. Change the app module source and run `yarn generate`; follow root `AGENTS.md` for the routed contract.
|
|
@@ -1,34 +1,8 @@
|
|
|
1
1
|
---
|
|
2
|
-
description:
|
|
2
|
+
description: Route every standalone app task through the root agent rules
|
|
3
3
|
alwaysApply: true
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# {{PROJECT_NAME}} —
|
|
6
|
+
# {{PROJECT_NAME}} — Cursor Entry Point
|
|
7
7
|
|
|
8
|
-
|
|
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.
|
|
8
|
+
Read `AGENTS.md`, match every applicable Task Router row, and load only the routed guides, skills, and module facts. The root file owns architecture, safety, writable paths, migrations, generation, and validation; do not duplicate or override it here.
|