@open-mercato/cli 0.6.6 → 0.6.7-canary.316.1.e6c38e0bef
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 +3 -3
- package/AGENTS.md +6 -3
- package/build.mjs +15 -0
- package/dist/agentic/claude-code/hooks/entity-migration-check.ts +32 -88
- package/dist/agentic/codex/enforcement-rules.md +6 -15
- 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 +70 -0
- package/dist/agentic/guides/contracts.md +92 -0
- package/dist/agentic/guides/extensions.md +98 -0
- package/dist/agentic/guides/integrations.md +81 -0
- package/dist/agentic/guides/module-facts.json +216 -79
- package/dist/agentic/guides/module-system.md +12 -127
- package/dist/agentic/guides/modules/ai_assistant.md +2 -2
- package/dist/agentic/guides/modules/api_docs.md +1 -1
- package/dist/agentic/guides/modules/api_keys.md +1 -1
- package/dist/agentic/guides/modules/attachments.md +2 -2
- package/dist/agentic/guides/modules/audit_logs.md +2 -2
- package/dist/agentic/guides/modules/auth.md +1 -1
- package/dist/agentic/guides/modules/business_rules.md +1 -1
- package/dist/agentic/guides/modules/catalog.md +5 -5
- package/dist/agentic/guides/modules/channel_gmail.md +1 -1
- package/dist/agentic/guides/modules/channel_imap.md +1 -1
- package/dist/agentic/guides/modules/checkout.md +1 -1
- package/dist/agentic/guides/modules/communication_channels.md +1 -1
- package/dist/agentic/guides/modules/configs.md +1 -1
- package/dist/agentic/guides/modules/content.md +1 -1
- package/dist/agentic/guides/modules/currencies.md +1 -1
- package/dist/agentic/guides/modules/customer_accounts.md +1 -1
- package/dist/agentic/guides/modules/customers.md +2 -2
- package/dist/agentic/guides/modules/dashboards.md +1 -1
- package/dist/agentic/guides/modules/data_sync.md +1 -1
- package/dist/agentic/guides/modules/dictionaries.md +1 -1
- package/dist/agentic/guides/modules/directory.md +1 -1
- package/dist/agentic/guides/modules/entities.md +2 -2
- package/dist/agentic/guides/modules/events.md +1 -1
- package/dist/agentic/guides/modules/feature_toggles.md +1 -1
- package/dist/agentic/guides/modules/gateway_stripe.md +1 -1
- package/dist/agentic/guides/modules/generators.md +1 -1
- package/dist/agentic/guides/modules/inbox_ops.md +1 -1
- package/dist/agentic/guides/modules/integrations.md +1 -1
- package/dist/agentic/guides/modules/messages.md +1 -1
- package/dist/agentic/guides/modules/notifications.md +1 -1
- package/dist/agentic/guides/modules/onboarding.md +1 -1
- package/dist/agentic/guides/modules/payment_gateways.md +3 -1
- package/dist/agentic/guides/modules/perspectives.md +1 -1
- package/dist/agentic/guides/modules/planner.md +1 -1
- package/dist/agentic/guides/modules/portal.md +1 -1
- package/dist/agentic/guides/modules/progress.md +1 -1
- package/dist/agentic/guides/modules/query_index.md +2 -2
- package/dist/agentic/guides/modules/record_locks.md +1 -1
- package/dist/agentic/guides/modules/resources.md +1 -1
- package/dist/agentic/guides/modules/sales.md +17 -17
- package/dist/agentic/guides/modules/scheduler.md +1 -1
- package/dist/agentic/guides/modules/search.md +1 -1
- package/dist/agentic/guides/modules/security.md +1 -1
- package/dist/agentic/guides/modules/shipping_carriers.md +1 -1
- package/dist/agentic/guides/modules/sso.md +1 -1
- package/dist/agentic/guides/modules/staff.md +2 -2
- package/dist/agentic/guides/modules/storage_s3.md +1 -1
- package/dist/agentic/guides/modules/sync_akeneo.md +1 -1
- package/dist/agentic/guides/modules/sync_excel.md +1 -1
- package/dist/agentic/guides/modules/system_status_overlays.md +1 -1
- package/dist/agentic/guides/modules/translations.md +1 -1
- package/dist/agentic/guides/modules/webhooks.md +2 -2
- package/dist/agentic/guides/modules/workflows.md +1 -1
- package/dist/agentic/guides/testing-debugging.md +62 -0
- package/dist/agentic/guides/upstream/AGENTS.md +297 -0
- package/dist/agentic/guides/upstream/BACKWARD_COMPATIBILITY.md +303 -0
- package/dist/agentic/guides/upstream/manifest.json +8 -0
- package/dist/agentic/shared/AGENTS.md.template +129 -296
- package/dist/agentic/shared/ai/harness/README.md +42 -0
- package/dist/agentic/shared/ai/harness/RELEASE.md +53 -0
- package/dist/agentic/shared/ai/harness/cases.json +12608 -0
- package/dist/agentic/shared/ai/harness/cases.schema.json +115 -0
- package/dist/agentic/shared/ai/harness/fixtures/index.json +43 -0
- package/dist/agentic/shared/ai/harness/fixtures/seeds.json +150 -0
- package/dist/agentic/shared/ai/harness/generated-code-review-policy.md +20 -0
- package/dist/agentic/shared/ai/harness/generated-code-review-response.schema.json +43 -0
- package/dist/agentic/shared/ai/harness/generated-code-review-result.schema.json +109 -0
- package/dist/agentic/shared/ai/harness/release-matrix.json +119 -0
- package/dist/agentic/shared/ai/harness/release-result.schema.json +219 -0
- package/dist/agentic/shared/ai/harness/result.schema.json +74 -0
- package/dist/agentic/shared/ai/harness/routing-response.schema.json +12 -0
- package/dist/agentic/shared/ai/harness/target-validation-result.schema.json +73 -0
- package/dist/agentic/shared/ai/harness/validators.json +68 -0
- package/dist/agentic/shared/ai/harness/writable-ast-oracles.mjs +1120 -0
- package/dist/agentic/shared/ai/harness/writable-behavior-oracles.mjs +811 -0
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/SKILL.md +17 -241
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/crud-surfaces.md +12 -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 +12 -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 +25 -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 +12 -0
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/SKILL.md +27 -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 +15 -601
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/integrity-and-concurrency.md +13 -0
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/migration-workflow.md +13 -0
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/schema-design.md +14 -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 +14 -310
- package/dist/agentic/shared/ai/skills/om-eject-and-customize/references/decision-and-procedure.md +17 -0
- package/dist/agentic/shared/ai/skills/om-evolve-harness/SKILL.md +28 -0
- package/dist/agentic/shared/ai/skills/om-evolve-harness/references/case-template.md +84 -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/owner-selection.md +17 -0
- package/dist/agentic/shared/ai/skills/om-framework-context/SKILL.md +24 -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 +17 -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 +14 -156
- package/dist/agentic/shared/ai/skills/om-implement-spec/references/phases-and-gates.md +12 -0
- package/dist/agentic/shared/ai/skills/om-integration-builder/SKILL.md +18 -710
- package/dist/agentic/shared/ai/skills/om-integration-builder/references/package-and-activation.md +14 -0
- package/dist/agentic/shared/ai/skills/om-integration-builder/references/provider-families.md +14 -0
- package/dist/agentic/shared/ai/skills/om-integration-builder/references/security-and-reliability.md +14 -0
- package/dist/agentic/shared/ai/skills/om-integration-builder/references/sync-and-files.md +12 -0
- package/dist/agentic/shared/ai/skills/om-module-scaffold/SKILL.md +19 -821
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/api-and-domain.md +18 -0
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/business-one-shot-blueprints.md +104 -0
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/data-and-migrations.md +12 -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 +20 -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/verification.md +13 -0
- package/dist/agentic/shared/ai/skills/om-system-extension/SKILL.md +16 -846
- package/dist/agentic/shared/ai/skills/om-system-extension/references/extension-branches.md +18 -0
- package/dist/agentic/shared/ai/skills/om-system-extension/references/mechanism-selector.md +23 -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 +38 -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 +15 -467
- package/dist/agentic/shared/ai/skills/om-troubleshooter/references/diagnosis-map.md +16 -0
- package/dist/agentic/shared/ai/skills/om-troubleshooter/references/regression-oracles.md +14 -0
- package/dist/agentic/shared/ai/skills/tiers.json +137 -20
- package/dist/agentic/shared/ai/skills/tiers.schema.json +61 -34
- package/dist/agentic/shared/scripts/agent-harness-tool-server.mjs +174 -0
- package/dist/agentic/shared/scripts/evaluate-agent-harness.mjs +2371 -0
- package/dist/agentic/shared/scripts/execution-sandbox.mjs +314 -0
- package/dist/agentic/shared/scripts/framework-context.mjs +869 -0
- package/dist/agentic/shared/scripts/install-skills.mjs +925 -0
- package/dist/agentic/shared/scripts/install-skills.sh +4 -487
- package/dist/agentic/shared/scripts/prepare-agent-harness-fixture.mjs +221 -0
- package/dist/agentic/shared/scripts/run-agent-harness-release.mjs +1751 -0
- package/dist/lib/__integration__/TC-INT-008.spec.js +94 -18
- package/dist/lib/__integration__/TC-INT-008.spec.js.map +2 -2
- package/dist/lib/agentic-init.js +9 -3
- package/dist/lib/agentic-init.js.map +2 -2
- package/dist/lib/agentic-setup.js +427 -187
- package/dist/lib/agentic-setup.js.map +2 -2
- package/dist/lib/db/commands.js +1 -1
- package/dist/lib/db/commands.js.map +1 -1
- package/dist/lib/eject.js +17 -2
- package/dist/lib/eject.js.map +2 -2
- package/dist/lib/generate-watch-events.js +106 -0
- package/dist/lib/generate-watch-events.js.map +7 -0
- package/dist/lib/generators/ast/imports.js +1 -1
- package/dist/lib/generators/ast/imports.js.map +1 -1
- package/dist/lib/generators/entity-ids.js +21 -14
- package/dist/lib/generators/entity-ids.js.map +2 -2
- package/dist/lib/generators/extensions/injection-widgets.js +1 -1
- package/dist/lib/generators/extensions/injection-widgets.js.map +1 -1
- package/dist/lib/generators/index.js +7 -1
- package/dist/lib/generators/index.js.map +2 -2
- package/dist/lib/generators/module-facts-discovery.js +39 -7
- package/dist/lib/generators/module-facts-discovery.js.map +2 -2
- package/dist/lib/generators/module-facts.js +66 -18
- package/dist/lib/generators/module-facts.js.map +2 -2
- package/dist/lib/generators/module-registry.js +257 -273
- package/dist/lib/generators/module-registry.js.map +3 -3
- package/dist/lib/generators/openapi.js +114 -12
- package/dist/lib/generators/openapi.js.map +2 -2
- package/dist/lib/in-process-generate-watcher.js +13 -2
- package/dist/lib/in-process-generate-watcher.js.map +2 -2
- package/dist/lib/module-install.js +2 -6
- package/dist/lib/module-install.js.map +2 -2
- package/dist/lib/modules-config.js +1 -1
- package/dist/lib/modules-config.js.map +1 -1
- package/dist/lib/post-generate-invalidation.js +49 -0
- package/dist/lib/post-generate-invalidation.js.map +7 -0
- package/dist/lib/resolver.js +3 -1
- package/dist/lib/resolver.js.map +2 -2
- package/dist/mercato.js +89 -52
- package/dist/mercato.js.map +2 -2
- package/package.json +11 -9
- package/src/__tests__/mercato.test.ts +118 -39
- package/src/lib/__integration__/TC-INT-008.spec.ts +116 -22
- package/src/lib/__tests__/agentic-init.test.ts +25 -5
- package/src/lib/__tests__/agentic-setup.ownership.test.ts +315 -0
- package/src/lib/__tests__/eject.test.ts +85 -0
- package/src/lib/__tests__/generate-watch-events.test.ts +112 -0
- package/src/lib/__tests__/generate-watch-structure.test.ts +20 -0
- package/src/lib/__tests__/in-process-generate-watcher.test.ts +193 -2
- package/src/lib/__tests__/post-generate-invalidation.test.ts +81 -0
- package/src/lib/agentic-init.ts +10 -3
- package/src/lib/agentic-setup.ts +539 -226
- package/src/lib/db/commands.ts +1 -1
- package/src/lib/eject.ts +24 -2
- package/src/lib/generate-watch-events.ts +125 -0
- package/src/lib/generators/__tests__/entity-ids.test.ts +98 -1
- package/src/lib/generators/__tests__/generators.test.ts +5 -0
- package/src/lib/generators/__tests__/module-facts.bc-guard.test.ts +6 -0
- package/src/lib/generators/__tests__/module-facts.customers.fixture.test.ts +1 -0
- package/src/lib/generators/__tests__/module-facts.discovery.test.ts +38 -10
- package/src/lib/generators/__tests__/module-facts.extension-hosts.test.ts +108 -0
- package/src/lib/generators/__tests__/openapi.test.ts +174 -0
- package/src/lib/generators/__tests__/output-snapshots.test.ts +37 -1
- package/src/lib/generators/__tests__/route-collision-guard.test.ts +123 -0
- package/src/lib/generators/__tests__/structural-contracts.test.ts +1 -1
- package/src/lib/generators/ast/imports.ts +1 -1
- package/src/lib/generators/entity-ids.ts +34 -14
- package/src/lib/generators/extensions/injection-widgets.ts +1 -1
- package/src/lib/generators/index.ts +7 -1
- package/src/lib/generators/module-facts-discovery.ts +54 -7
- package/src/lib/generators/module-facts.ts +85 -21
- package/src/lib/generators/module-registry.ts +337 -299
- package/src/lib/generators/openapi.ts +167 -14
- package/src/lib/in-process-generate-watcher.ts +35 -6
- package/src/lib/module-install.ts +2 -6
- package/src/lib/modules-config.ts +1 -1
- package/src/lib/post-generate-invalidation.ts +62 -0
- package/src/lib/resolver.ts +4 -1
- package/src/mercato.ts +96 -56
- 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
|
@@ -1,315 +1,148 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
**MANDATORY CONTEXT LOADING** — see the "BEFORE writing ANY code" Critical Rule below.
|
|
4
|
-
Before writing code, find your task below and `Read` the listed files.
|
|
5
|
-
Do NOT load the entire src/ tree — Open Mercato apps can have many modules.
|
|
6
|
-
|
|
7
|
-
## What This Project Is
|
|
8
|
-
|
|
9
|
-
A standalone Open Mercato application built ON TOP of the framework.
|
|
10
|
-
The framework lives in `node_modules/@open-mercato/*`. Never edit `node_modules` directly.
|
|
11
|
-
Install official packages with `yarn mercato module add @open-mercato/<package>`.
|
|
12
|
-
To customise a built-in module beyond extensions, eject with `yarn mercato eject <module>`.
|
|
13
|
-
|
|
14
|
-
## Task → Context Map
|
|
15
|
-
|
|
16
|
-
Match your task below, then **STOP and Read the listed file(s)** before writing
|
|
17
|
-
any code. A task may match multiple rows — load all of them. If you skip this
|
|
18
|
-
step, you WILL produce incorrect imports and miss required patterns.
|
|
19
|
-
|
|
20
|
-
### Module Development
|
|
21
|
-
|
|
22
|
-
| Task | Load |
|
|
23
|
-
|---|---|
|
|
24
|
-
| Understand the module system (anatomy, auto-discovery, naming, mandatory mechanisms, data integrity, migrations) | `.ai/guides/module-system.md` |
|
|
25
|
-
| Scaffold a new module from scratch | `.ai/skills/om-module-scaffold/SKILL.md` |
|
|
26
|
-
| Design entities and relationships | `.ai/skills/om-data-model-design/SKILL.md` |
|
|
27
|
-
| Build backend UI (forms, tables, pages) | `.ai/skills/om-backend-ui-design/SKILL.md` |
|
|
28
|
-
| Build an integration provider | `.ai/skills/om-integration-builder/SKILL.md` |
|
|
29
|
-
|
|
30
|
-
### Extending Core Modules (UMES)
|
|
31
|
-
|
|
32
|
-
| Task | Load |
|
|
33
|
-
|---|---|
|
|
34
|
-
| Extend a core module (add fields, columns, menus, interceptors, enrichers) | `.ai/skills/om-system-extension/SKILL.md` |
|
|
35
|
-
| Eject and customize a core module | `.ai/skills/om-eject-and-customize/SKILL.md` |
|
|
36
|
-
| Add a response enricher to another module's API | `.ai/guides/core.md` → Response Enrichers |
|
|
37
|
-
| Add an API interceptor (before/after hooks) | `.ai/guides/core.md` → API Interceptors |
|
|
38
|
-
| Inject widgets into forms/tables/menus | `.ai/guides/core.md` → Widget Injection |
|
|
39
|
-
| Replace or wrap a UI component | `.ai/guides/core.md` → Component Replacement |
|
|
40
|
-
|
|
41
|
-
### Framework Feature Usage
|
|
42
|
-
|
|
43
|
-
| Task | Load |
|
|
44
|
-
|---|---|
|
|
45
|
-
| Add/modify an entity, create migration | `.ai/skills/om-data-model-design/SKILL.md`, `.ai/guides/core.md` → Module Files, then `yarn db:generate` |
|
|
46
|
-
| Add a REST API endpoint | `.ai/guides/core.md` → API Routes |
|
|
47
|
-
| Add a backend page | `.ai/guides/ui.md` → CrudForm / DataTable |
|
|
48
|
-
| Configure sidebar navigation, page groups, settings pages | `.ai/skills/om-module-scaffold/references/navigation-patterns.md` |
|
|
49
|
-
| Add event subscribers or emit events | `.ai/guides/events.md` |
|
|
50
|
-
| Add real-time browser updates (SSE) | `.ai/guides/events.md` → DOM Event Bridge |
|
|
51
|
-
| Add search to a module | `.ai/guides/search.md` |
|
|
52
|
-
| Add caching | `.ai/guides/cache.md` |
|
|
53
|
-
| Add background workers | `.ai/guides/queue.md` |
|
|
54
|
-
| Use i18n (translations) | `.ai/guides/shared.md` → i18n |
|
|
55
|
-
| Use encrypted queries (read sensitive columns that already have an encryption map; for authoring a NEW sensitive column see the row below first) | `.ai/guides/shared.md` → Encryption |
|
|
56
|
-
| **Encrypt sensitive / GDPR-relevant fields** ("we need this column encrypted", "store this securely", "this is PII", "GDPR", "encryption at rest", addresses, contact info, free-text notes about people, integration credentials, secrets) — declare them in the framework's encryption-maps mechanism, never hand-rolled AES/KMS | `.ai/skills/om-data-model-design/SKILL.md` → Sensitive Data and Encryption Maps, then `.ai/skills/om-module-scaffold/SKILL.md` → Encryption maps. Reference: <https://docs.open-mercato.dev/user-guide/encryption> |
|
|
57
|
-
| Use apiCall / UI components | `.ai/guides/ui.md` |
|
|
58
|
-
| Add permissions (RBAC) | `.ai/guides/core.md` → Access Control |
|
|
59
|
-
| Add notifications | `.ai/guides/core.md` → Notifications |
|
|
60
|
-
| Add custom fields | `.ai/guides/core.md` → Custom Fields |
|
|
61
|
-
|
|
62
|
-
### Module-Specific Guides
|
|
63
|
-
|
|
64
|
-
These per-module fact-sheets are **generated from source** and bundled for the modules enabled in this app. The list below is regenerated on scaffold from your enabled module set — do not edit between the markers.
|
|
1
|
+
# {{PROJECT_NAME}} — Standalone App Agent Rules
|
|
65
2
|
|
|
66
|
-
|
|
67
|
-
<!-- om:module-guides:end -->
|
|
3
|
+
Extend this app. Route first; load every match; never probe unmatched context.
|
|
68
4
|
|
|
69
|
-
|
|
5
|
+
## Always
|
|
70
6
|
|
|
71
|
-
|
|
7
|
+
- Route all axes; missing context: `yarn mercato agentic:init --update-harness`.
|
|
8
|
+
- App code: `src/modules/<id>/`; framework context only for a named version gap.
|
|
9
|
+
- Derive trusted `tenantId` + `organizationId` and fail closed. Only an installed contract may use system scope (`organizationId: null`).
|
|
10
|
+
- Use commands, `makeCrudRoute`, `CrudForm`/`DataTable`, DI, events, and UMES on canonical paths.
|
|
11
|
+
- Put entities in `src/modules/<id>/data/entities.ts`; API routes need per-method `metadata` + `openApi`.
|
|
12
|
+
- Editable records expose `updated_at`/`updatedAt`; custom update/delete clients send the version and surface 409s.
|
|
13
|
+
- Run `yarn db:generate`, review scoped SQL/snapshot, and ask before applying it.
|
|
14
|
+
- Run `yarn generate` after discovery files, `src/modules.ts`, routes, pages, events, widgets, agents, tools, or workflows change.
|
|
15
|
+
- Existing route/schema/ID/export/path/function/props-signature/event-payload/CLI changes MUST read `BACKWARD_COMPATIBILITY.md`.
|
|
16
|
+
- Localize strings; use shared UI/tokens and complete loading, empty, error, conflict, keyboard, and accessibility states.
|
|
72
17
|
|
|
73
|
-
|
|
18
|
+
## Ask First
|
|
74
19
|
|
|
75
|
-
|
|
76
|
-
|---|---|
|
|
77
|
-
| Debug / fix errors | `.ai/skills/om-troubleshooter/SKILL.md` |
|
|
78
|
-
| Review code changes | `om-code-review` (external — `yarn install-skills`) |
|
|
79
|
-
| Write a spec | `om-spec-writing` (external — `yarn install-skills`), `.ai/specs/SPEC-000-template.md` |
|
|
80
|
-
| Implement a spec (or selected phases) | `.ai/skills/om-implement-spec/SKILL.md` |
|
|
81
|
-
| Create / run integration tests | `om-integration-tests` (external — `yarn install-skills`) |
|
|
82
|
-
| Prepare / reuse a local test environment (shared descriptor for QA + integration tests) | `om-prepare-test-env` (external — invoked by `om-integration-tests` when no environment is running) |
|
|
83
|
-
| Configure or re-configure the agent PR pipeline (`.ai/agentic.config.json`, tracker, labels, QA gate) | `om-setup-agent-pipeline` (external) |
|
|
84
|
-
| Sync installed pipeline artifacts after `yarn install-skills` refreshed the collection | `om-apply-upgrade-notes` (external) |
|
|
85
|
-
| Upgrade framework from 0.4.10 to 0.5.0 | `.ai/skills/om-auto-upgrade-0.4.10-to-0.5.0/SKILL.md` |
|
|
20
|
+
- Ask before scope/architecture/public-contract/dependency/ejection/canonical-primitive changes; migrations/resets/DB targets; live credentials/providers; or weaker security, concurrency, retries, idempotency, audit, or undo.
|
|
86
21
|
|
|
87
|
-
|
|
22
|
+
## Never
|
|
88
23
|
|
|
89
|
-
|
|
24
|
+
- Never leak tenants, trust payload scope, or treat missing scope as unrestricted.
|
|
25
|
+
- Never edit `node_modules`, `.mercato/generated/**`, generated facts, or shipped migrations.
|
|
26
|
+
- Never use cross-module ORM relations; use IDs/snapshots, events, enrichers, extensions, or optional DI.
|
|
27
|
+
- Never use raw admin `fetch`/`<form>`, ad hoc crypto/cache/queues, role-name guards, or direct mutations when helpers exist.
|
|
28
|
+
- Never hard-code user strings/status colors; expose secrets/transcripts; or guess answerable contracts.
|
|
90
29
|
|
|
91
|
-
|
|
92
|
-
|---|---|
|
|
93
|
-
| Delegate an arbitrary task end-to-end as a PR | `om-auto-create-pr` (external) |
|
|
94
|
-
| Resume an in-progress agent PR | `om-auto-continue-pr` (external) |
|
|
95
|
-
| Run a long multi-step spec implementation with resumable checkpoints | `om-auto-create-pr-loop` (external) |
|
|
96
|
-
| Resume a checkpointed PR started by `om-auto-create-pr-loop` | `om-auto-continue-pr-loop` (external) |
|
|
97
|
-
| Automated code review on a PR (with optional autofix) | `om-auto-review-pr` (external) |
|
|
98
|
-
| Fix a GitHub issue by number and open a PR | `om-auto-fix-issue` (external — drives the chain `om-verify-in-repo` → `om-root-cause` → `om-fix` → `om-open-pr` → `om-auto-review-pr`, all installed alongside it) |
|
|
99
|
-
| Propose disabling unused built-in modules after the user adds a new module (classic-mode slimdown) | `.ai/skills/om-trim-unused-modules/SKILL.md` |
|
|
30
|
+
## Validation Commands
|
|
100
31
|
|
|
101
|
-
|
|
32
|
+
Choose the smallest relevant set, then expand for broad changes:
|
|
102
33
|
|
|
103
|
-
|
|
34
|
+
```bash
|
|
35
|
+
yarn generate
|
|
36
|
+
yarn typecheck
|
|
37
|
+
yarn lint
|
|
38
|
+
yarn test
|
|
39
|
+
yarn build
|
|
40
|
+
yarn test:integration:ephemeral
|
|
41
|
+
```
|
|
104
42
|
|
|
105
|
-
|
|
43
|
+
Report failures; never apply migrations for validation
|
|
106
44
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
│ ├── validators.ts # Zod validation schemas
|
|
113
|
-
│ ├── extensions.ts # Cross-module entity links
|
|
114
|
-
│ └── enrichers.ts # Response enrichers
|
|
115
|
-
├── api/
|
|
116
|
-
│ ├── <resource>/route.ts # REST handlers (auto-discovered by method)
|
|
117
|
-
│ └── interceptors.ts # API route interception hooks
|
|
118
|
-
├── backend/ # Admin UI pages (auto-discovered)
|
|
119
|
-
│ └── page.tsx # → /backend/<module>
|
|
120
|
-
├── frontend/ # Public pages (auto-discovered)
|
|
121
|
-
├── subscribers/ # Event handlers (export metadata + default handler)
|
|
122
|
-
├── workers/ # Background jobs (export metadata + default handler)
|
|
123
|
-
├── widgets/
|
|
124
|
-
│ ├── injection/ # UI widgets injected into other modules
|
|
125
|
-
│ ├── injection-table.ts # Widget-to-slot mappings
|
|
126
|
-
│ └── components.ts # Component replacement/wrapper definitions
|
|
127
|
-
├── di.ts # Awilix DI registrations
|
|
128
|
-
├── acl.ts # Permission features
|
|
129
|
-
├── setup.ts # Tenant init, role features, seed data
|
|
130
|
-
├── events.ts # Typed event declarations
|
|
131
|
-
├── search.ts # Search indexing configuration
|
|
132
|
-
├── ce.ts # Custom entities / custom field sets
|
|
133
|
-
├── translations.ts # Translatable fields per entity
|
|
134
|
-
├── notifications.ts # Notification type definitions
|
|
135
|
-
├── notifications.client.ts # Client-side notification renderers
|
|
136
|
-
└── encryption.ts # Tenant data encryption maps (defaultEncryptionMaps) for sensitive / GDPR fields
|
|
137
|
-
```
|
|
45
|
+
## Three-Axis Context Assembler
|
|
46
|
+
|
|
47
|
+
Combine matches: notification/editable custom field = `module-data` + `backend-ui` + `umes`; lifecycle reaction = `module-data` + `umes` (UMES owns it); convergence bug adds `debugging`; registry drift adds `module-data` + `architecture` + `debugging`. Add `testing` only when explicit and `framework-context` only for an unresolved contract.
|
|
48
|
+
|
|
49
|
+
Business verticals MUST load `om-module-scaffold` + their exact blueprint.
|
|
138
50
|
|
|
139
|
-
|
|
51
|
+
`testing` requires requested tests/coverage/proof, not routine validation; external integration/E2E/browser/live-app uses `om-integration-tests`. `debugging` = failure/security/drift. Specs/delivery phases = `spec-pr` + integration coverage. Capability-only = `architecture`; implementation mechanics add `module-data` + contracts. Spec-only decomposition reads root + `om-spec-writing` + config; implementation owns domain guides. Custom fields/entities = `umes` + `module-data` + `om-data-model-design`; editable adds `backend-ui`. Never infer work from specs/PRs.
|
|
140
52
|
|
|
141
|
-
|
|
53
|
+
App-owned durable process state, activities, or user tasks select `module-data` + `ai-workflow`; add `umes` for installed-module interception/reaction.
|
|
142
54
|
|
|
143
|
-
|
|
55
|
+
Unified-override audits select only `umes`; add `architecture` or `framework-context` only for unresolved ownership or installed keys.
|
|
144
56
|
|
|
145
|
-
|
|
57
|
+
App-owned page/form/table-only = `backend-ui`; installed host changes add `umes`. Do not load contracts or `module-scaffold` unless changing data/API/command/ACL/setup.
|
|
58
|
+
|
|
59
|
+
`backend-ui`: UI skill `references/quality-states.md`; public/portal/responsive/a11y adds `references/frontend-and-design-system.md`. Payload text is not UI.
|
|
60
|
+
|
|
61
|
+
### Axis 1 — Area/Ownership
|
|
62
|
+
|
|
63
|
+
| Route | Match | Context |
|
|
146
64
|
|---|---|---|
|
|
147
|
-
|
|
|
148
|
-
|
|
|
149
|
-
|
|
|
150
|
-
|
|
|
151
|
-
|
|
|
152
|
-
|
|
|
153
|
-
|
|
|
154
|
-
| **Authorization (RBAC)** | Declare features in `<module>/acl.ts`, grant them in `<module>/setup.ts` `defaultRoleFeatures`, gate pages and routes with `requireFeatures` in `metadata` / `page.meta.ts`. NEVER use `requireRoles` (role names mutate). Run `yarn mercato auth sync-role-acls` after adding new features | `.ai/guides/core.md` → Access Control; <https://docs.open-mercato.dev/framework/rbac/overview> |
|
|
155
|
-
| **Multi-tenant scoping (default for every entity)** | Every tenant-scoped entity MUST include indexed `organization_id` and `tenant_id` columns and every read/write MUST filter by them. The CRUD factory injects scope automatically — do NOT bypass it. For ad-hoc queries use `withScopedPayload` from `@open-mercato/shared/lib/api/scoped` | `.ai/skills/om-data-model-design/SKILL.md`; <https://docs.open-mercato.dev/architecture/system-overview> |
|
|
156
|
-
| **Encryption maps for sensitive data** | Declare a module-level `<module>/encryption.ts` exporting `defaultEncryptionMaps: ModuleEncryptionMap[]` from `@open-mercato/shared/modules/encryption`. Read encrypted columns via `findWithDecryption` / `findOneWithDecryption` from `@open-mercato/shared/lib/encryption/find`. NEVER hand-roll AES/KMS, NEVER use `em.find` on encrypted columns | `.ai/skills/om-data-model-design/SKILL.md` → Sensitive Data and Encryption Maps; <https://docs.open-mercato.dev/user-guide/encryption> |
|
|
157
|
-
| **Cache** | Resolve the cache from DI (`container.resolve('cache')`) — never `new Redis(...)` or raw SQLite. Tag with `tenant:<id>` / `org:<id>` and the entity-type tag so invalidation stays tenant-scoped | `.ai/guides/cache.md`; <https://docs.open-mercato.dev/user-guide/cache-management> |
|
|
158
|
-
| **Entity update safety** | Multi-phase scalar + relation mutations use `withAtomicFlush(em, phases, { transaction: true })` from `@open-mercato/shared/lib/commands/flush` — never interleave `em.find`/`em.findOne` between a scalar mutation and `em.flush()`. Keep `emitCrudSideEffects` + cache invalidation OUTSIDE it (they fire after commit) | See **Entity Update Safety** section below |
|
|
159
|
-
| **Background workers** | `src/modules/<id>/workers/*.ts` exporting `metadata: { queue, id?, concurrency? }` + default handler. Never spin up custom queues | `.ai/guides/queue.md`; <https://docs.open-mercato.dev/framework/events/queue-workers> |
|
|
160
|
-
| **Events between modules** | `<module>/events.ts` with `createModuleEvents({ moduleId, events } as const)`. Subscribers in `subscribers/*.ts`. Never call other modules' services directly across module boundaries | `.ai/guides/events.md`; <https://docs.open-mercato.dev/framework/events/overview> |
|
|
161
|
-
| **i18n (every user-facing string)** | `useT()` client-side from `@open-mercato/shared/lib/i18n/context`, `resolveTranslations()` server-side from `@open-mercato/shared/lib/i18n/server`; keys in `src/i18n/<locale>.json`. Never hard-code labels in components | `.ai/guides/shared.md` → i18n |
|
|
162
|
-
|
|
163
|
-
> Rule of thumb: if you find yourself reaching for raw `fetch`, raw `<form>`, ad-hoc `crypto`, ad-hoc `Redis`, or a manual `m2m` join across modules, stop and check the row above — there is a canonical helper.
|
|
164
|
-
|
|
165
|
-
## Entity Update Safety
|
|
166
|
-
|
|
167
|
-
MikroORM v7 can silently discard pending scalar changes when a query (`em.find`, `em.findOne`, sync helper) runs on the same `EntityManager` between a scalar mutation and `em.flush()`. For any command in `{{PROJECT_NAME}}` that mutates entities across multiple phases:
|
|
168
|
-
|
|
169
|
-
- MUST use `withAtomicFlush(em, phases, { transaction: true })` from `@open-mercato/shared/lib/commands/flush`.
|
|
170
|
-
- NEVER interleave `em.find`/`em.findOne`/sync helpers between a scalar mutation and `em.flush()` on the same `EntityManager` without `withAtomicFlush` — the UPDATE is dropped.
|
|
171
|
-
- Keep `emitCrudSideEffects` (and `emitCrudUndoSideEffects`) AND cache invalidation OUTSIDE the `withAtomicFlush` block — they fire only AFTER the DB write commits.
|
|
172
|
-
|
|
173
|
-
```typescript
|
|
174
|
-
import { withAtomicFlush } from '@open-mercato/shared/lib/commands/flush'
|
|
175
|
-
|
|
176
|
-
await withAtomicFlush(em, [
|
|
177
|
-
() => { record.name = 'New Name'; record.status = 'active' },
|
|
178
|
-
() => syncEntityTags(em, record, tags),
|
|
179
|
-
], { transaction: true, label: '<module>.<command>' })
|
|
180
|
-
|
|
181
|
-
// Side effects + cache invalidation AFTER the atomic flush (post-commit)
|
|
182
|
-
await emitCrudSideEffects({ /* ... */ })
|
|
183
|
-
```
|
|
65
|
+
| `architecture` | Capability/ownership choice, explicit boundary investigation, upgrade, override, or registry failure; routine discovery stays in its area | `.ai/guides/architecture.md` + named facts |
|
|
66
|
+
| `module-data` | App-owned domain/data/API | `src/modules/<id>/` + `.ai/guides/contracts.md`; add architecture only when ownership or mechanism is unresolved |
|
|
67
|
+
| `umes` | Extend/replace installed behavior | `.ai/guides/extensions.md` + target facts |
|
|
68
|
+
| `backend-ui` | Custom admin/public/portal/form/table/menu/i18n/component | `.ai/guides/backend-ui.md` + host facts; host-provided integration credentials/health UI alone does not match |
|
|
69
|
+
| `integration` | External email/shipping/payment/sync/webhook/storage/file/import/export provider | `.ai/guides/integrations.md`; excludes installed-sender use, workflow `CALL_API`, downloads, and AI storage |
|
|
70
|
+
| `ai-workflow` | Agent/tool/MCP/OpenCode/Code Mode/orchestrator/durable workflow | `.ai/guides/ai-workflows.md` + facts; schedules/reminders/queues/workers/retries/progress alone are `module-data` |
|
|
71
|
+
| `debugging` | Bug/security/drift/runtime inconsistency | `.ai/guides/testing-debugging.md` + affected areas |
|
|
184
72
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
-
|
|
225
|
-
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
-
|
|
232
|
-
|
|
233
|
-
-
|
|
234
|
-
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
-
|
|
240
|
-
|
|
241
|
-
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
-
|
|
245
|
-
|
|
246
|
-
##
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
// CRUD forms
|
|
257
|
-
import { CrudForm, type CrudField, type CrudFormGroup } from '@open-mercato/ui/backend/CrudForm'
|
|
258
|
-
import { createCrud, updateCrud, deleteCrud } from '@open-mercato/ui/backend/utils/crud'
|
|
259
|
-
import { createCrudFormError } from '@open-mercato/ui/backend/utils/serverErrors'
|
|
260
|
-
|
|
261
|
-
// UI components (MUST use — never raw <button>)
|
|
262
|
-
import { Button } from '@open-mercato/ui/primitives/button'
|
|
263
|
-
import { IconButton } from '@open-mercato/ui/primitives/icon-button'
|
|
264
|
-
import { LoadingMessage, ErrorMessage } from '@open-mercato/ui/backend/detail'
|
|
265
|
-
import { FormHeader, FormFooter } from '@open-mercato/ui/backend/forms'
|
|
266
|
-
import { flash } from '@open-mercato/ui/backend/FlashMessages'
|
|
267
|
-
|
|
268
|
-
// Encrypted queries (MUST use instead of em.find)
|
|
269
|
-
import { findWithDecryption } from '@open-mercato/shared/lib/encryption/find'
|
|
270
|
-
|
|
271
|
-
// Events
|
|
272
|
-
import { createModuleEvents } from '@open-mercato/shared/modules/events'
|
|
273
|
-
|
|
274
|
-
// Widget injection
|
|
275
|
-
import { InjectionPosition } from '@open-mercato/shared/modules/widgets/injection-position'
|
|
276
|
-
|
|
277
|
-
// Types
|
|
278
|
-
import type { ModuleSetupConfig } from '@open-mercato/shared/modules/setup'
|
|
279
|
-
import type { ResponseEnricher } from '@open-mercato/shared/lib/crud/response-enricher'
|
|
280
|
-
import type { ApiInterceptor } from '@open-mercato/shared/lib/crud/api-interceptor'
|
|
281
|
-
```
|
|
73
|
+
App: `src/modules/<id>/`; installed: UMES. Reusable providers are published dependencies, never `packages/*`.
|
|
74
|
+
|
|
75
|
+
### Axis 2 — Work Units
|
|
76
|
+
|
|
77
|
+
Match every work-unit row.
|
|
78
|
+
|
|
79
|
+
| Route | Work unit | Skill/context |
|
|
80
|
+
|---|---|---|
|
|
81
|
+
| `architecture` | Explain/choose module, UMES, package, eject | architecture; use `om-help` for an unresolved choice or a comparative decision framework across these mechanisms |
|
|
82
|
+
| `module-data` | Business outcome or vertical slice | `om-module-scaffold` + `.ai/skills/om-module-scaffold/references/business-one-shot-blueprints.md`; its route key resolves ownership and units |
|
|
83
|
+
| `spec-pr` | Spec or plan in safe working stages | Axis 3 skill; deployable phases |
|
|
84
|
+
| `architecture` | Upgrade audit or disable built-in | troubleshooter + framework context, or trim skill + exact `src/modules.ts` and `package.json` |
|
|
85
|
+
| `architecture` + `integration` + `framework-context` | Provider superseded by installed capability | integration builder + exact framework context |
|
|
86
|
+
| `module-data` | Entity/link/validator/migration/encryption/lock/transaction | `om-data-model-design` + contracts |
|
|
87
|
+
| `module-data` | CRUD/API/command/OpenAPI/ACL/setup/mutation | `om-module-scaffold` + contracts |
|
|
88
|
+
| `backend-ui` | Form/table/page/middleware/nav/i18n/UI states | `om-backend-ui-design` + backend UI |
|
|
89
|
+
| `module-data` | Search/analytics/event/notification/message/worker/progress/cache/CLI | scaffold + contracts |
|
|
90
|
+
| `umes` | Fields/enrichers/injection/interceptors/guards/subscribers/DOM/widgets/toggles/overrides | `om-system-extension` + extensions; choices load `mechanism-selector` + `extension-branches` |
|
|
91
|
+
| `integration` | Provider/credentials/health/webhook/files/client/reconciliation/package | `om-integration-builder` + integrations |
|
|
92
|
+
| `ai-workflow` | Agent/tool/MCP/OpenCode/Code Mode/orchestrator/attachment/override | `om-create-ai-agent` + AI/workflows; MCP/OpenCode loads `surface-selector` + `ai_assistant` facts |
|
|
93
|
+
| `ai-workflow` | Workflow/activity/user task/idempotency/output/progress | `om-build-workflow` + AI/workflows |
|
|
94
|
+
| `testing` | Write/run tests or explicit coverage | testing/debugging; external `om-integration-tests` for integration/E2E |
|
|
95
|
+
| `debugging` | Reproduce/root-cause/minimal fix/regression oracle | `om-troubleshooter` + testing/debugging + affected units |
|
|
96
|
+
| `framework-context` | Exact installed contract still unknown | bounded `om-framework-context`, last |
|
|
97
|
+
| `debugging` + `testing` | Add/fix recurring harness case/test | `om-evolve-harness` |
|
|
98
|
+
|
|
99
|
+
“Installed contract(s)” alone does not select `framework-context`. Exact response/error identity does; otherwise use guides/facts and invoke its skill only for one named unresolved version detail.
|
|
100
|
+
|
|
101
|
+
### Axis 3 — SDLC and Delivery
|
|
102
|
+
|
|
103
|
+
Select delivery independently from pinned `open-mercato/skills` (`yarn install-skills`).
|
|
104
|
+
Read external skills at `.agents/skills/<id>/SKILL.md`; MUST apply a matching `.ai/skills/<id>/SKILL.md` standalone override too.
|
|
105
|
+
|
|
106
|
+
| Route ID | Delivery need | Skill |
|
|
107
|
+
|---|---|---|
|
|
108
|
+
| `spec-pr` | Write/revise spec | `om-spec-writing` (OMH-005) + exact `.ai/agentic.config.json` for its specs-directory setting |
|
|
109
|
+
| `spec-pr` | Implement approved phases locally | `om-implement-spec` (OMH-006) |
|
|
110
|
+
| `spec-pr` | Ship complete approved spec | `om-auto-implement-spec` |
|
|
111
|
+
| `spec-pr` | One-shot ready PR | `om-auto-create-pr`; resume `om-auto-continue-pr` |
|
|
112
|
+
| `spec-pr` | Tracker issue to tested PR | `om-auto-fix-issue` |
|
|
113
|
+
| `spec-pr` | Review PR | `om-auto-review-pr` first; it invokes `om-code-review` |
|
|
114
|
+
| `testing` | Integration/E2E/UI QA | `om-integration-tests` / `om-auto-qa-pr`; optionally prepare env |
|
|
115
|
+
| — | No PR/spec workflow requested | Do not load delivery skills |
|
|
116
|
+
|
|
117
|
+
If a skill is absent, run `yarn install-skills` once; never invent a substitute.
|
|
118
|
+
|
|
119
|
+
### Token-Efficient Assembly Policy
|
|
120
|
+
|
|
121
|
+
- Load each matched guide once, then only needed references and facts.
|
|
122
|
+
- For specs, list names and open one task match; skip README/template otherwise.
|
|
123
|
+
- Inspect app call sites before bounded `framework-context`.
|
|
124
|
+
- Additive page/form/table/conflict UI skips it.
|
|
125
|
+
- Never bulk-read guide, skill, fact, or source trees.
|
|
126
|
+
|
|
127
|
+
## Module-Specific Facts
|
|
128
|
+
|
|
129
|
+
Host facts: customer/contact/deal/pipeline→customers; product/price/stock/inventory→catalog; currency/money→currencies; cart/checkout/shopper→checkout; portal→customer_accounts; quote/order/sales assistant→sales; notification→notifications; webhook/callback→webhooks; schedule/reminder→scheduler; progress→progress; search convergence→search. staff/employee≠optional staff; audit/record-who≠audit_logs unless extended. App primitives skip api_docs/search/query_index/events unless changed.
|
|
130
|
+
|
|
131
|
+
<!-- om:module-guides:start -->
|
|
132
|
+
<!-- om:module-guides:end -->
|
|
133
|
+
|
|
134
|
+
## Working Sequence
|
|
135
|
+
|
|
136
|
+
1. For `spec-pr`, list `.ai/specs` one level deep and open one non-template match. Do not list specs for plan-only work.
|
|
137
|
+
2. Route the request and load only the matched guides/skills and relevant module facts.
|
|
138
|
+
3. Inspect current app call sites; invoke `om-framework-context` only for missing exact-version details.
|
|
139
|
+
4. Implement the smallest complete vertical slice through real call sites.
|
|
140
|
+
5. Run `yarn generate` when discovery changed, then the smallest validation gate and affected integration paths.
|
|
141
|
+
|
|
142
|
+
## Context Precedence
|
|
282
143
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
| `yarn dev:verbose` | Start dev runtime with full raw passthrough logs |
|
|
289
|
-
| `yarn generate` | Regenerate `.mercato/generated/` |
|
|
290
|
-
| `yarn mercato configs cache structural --all-tenants` | Manually purge structural navigation/sidebar cache entries |
|
|
291
|
-
| `yarn mercato module add <package>` | Install and enable an official module package |
|
|
292
|
-
| `yarn db:generate` | Probe/create migration SQL for entity changes |
|
|
293
|
-
| `yarn db:migrate` | Apply pending migrations after user confirmation |
|
|
294
|
-
| `yarn initialize` | Bootstrap DB + first admin account |
|
|
295
|
-
| `yarn build` | Build for production |
|
|
296
|
-
| `yarn mercato eject <module>` | Copy a core module into `src/modules/` |
|
|
297
|
-
| `yarn test:integration:ephemeral` | Run Playwright integration tests against a fresh ephemeral app + DB (reuses a healthy running env) — always prefer this over plain `yarn test:integration` |
|
|
298
|
-
| `yarn test:integration:ephemeral:start` | Start the ephemeral app only (manual QA or iterative test loops; admin@acme.com / secret) — the `om-prepare-test-env` skill wraps this and shares the env via `.ai/qa/test-env.json` |
|
|
299
|
-
| `yarn mercato test:integration <filter>` | Run small filtered test batches against the running ephemeral env (fast iteration) |
|
|
300
|
-
| `npx playwright show-report .ai/qa/test-results/html` | Open the HTML integration test report |
|
|
301
|
-
|
|
302
|
-
## Architecture Rules
|
|
303
|
-
|
|
304
|
-
- NO direct ORM relationships between modules — use foreign key IDs
|
|
305
|
-
- Always filter by `organization_id` for tenant-scoped entities
|
|
306
|
-
- Validate all inputs with Zod; derive types via `z.infer`
|
|
307
|
-
- Use DI (Awilix) for services; avoid `new`-ing directly
|
|
308
|
-
- No `any` types — use Zod schemas with `z.infer`, narrow with runtime checks
|
|
309
|
-
- Every dialog: `Cmd/Ctrl+Enter` submit, `Escape` cancel
|
|
310
|
-
- Keep `pageSize` at or below 100
|
|
311
|
-
- Every API route MUST export `openApi`
|
|
312
|
-
|
|
313
|
-
## Stack
|
|
314
|
-
|
|
315
|
-
Next.js App Router, TypeScript, MikroORM, Awilix DI, Zod
|
|
144
|
+
1. This file governs standalone safety, writes, and validation.
|
|
145
|
+
2. `.ai/guides/upstream/BACKWARD_COMPATIBILITY.md` governs stable public IDs.
|
|
146
|
+
3. The nearest installed package/module `AGENTS.md` governs version-specific contracts.
|
|
147
|
+
4. Generated facts govern installed module surfaces.
|
|
148
|
+
5. After version/skew checks, stop on conflicts; never guess.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Agent harness evaluations
|
|
2
|
+
|
|
3
|
+
`cases.json` is the 184-case standalone-app contract. Run `yarn harness:validate --all` for the deterministic gate. Live routing uses a fresh read-only process per case:
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
yarn harness:validate --runner codex --all
|
|
7
|
+
yarn harness:validate --runner claude --case OMH-009
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
A blocking release selects one primary runner for every live lane. The optional portability runner must be different and receives only the exact 39-case representative read-only set:
|
|
11
|
+
|
|
12
|
+
```text
|
|
13
|
+
yarn harness:release --runner codex --prepare-targets /absolute/empty-release-targets --acknowledge-writes
|
|
14
|
+
yarn harness:release --runner codex --portability-runner claude --prepare-targets /absolute/empty-release-targets --acknowledge-writes
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The primary runner owns all 184 routing cases, all 39 writable cases, and all generated-code reviews. No per-case fallback or mixed primary ownership is allowed. Omitting `--portability-runner` is valid and the sanitized report records `portabilityRunner: null`; explicitly requesting an unavailable or failing secondary runner fails that extended run.
|
|
18
|
+
|
|
19
|
+
Writable evaluation is intentionally opt-in. The expanded catalog has a 39-case writable release target, but only cases registered in `release-matrix.json` and backed by controller-owned fixtures and oracles are executable. Copy or create a fresh standalone app for one registered case, then seed only that case and mark the target disposable:
|
|
20
|
+
|
|
21
|
+
```text
|
|
22
|
+
yarn harness:fixture --case OMH-009 --target /absolute/disposable/app --acknowledge-writes
|
|
23
|
+
yarn harness:validate --runner codex --case OMH-009 --writable-root /absolute/disposable/app --acknowledge-writes
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The preparer refuses the controller app, non-standalone targets, reused targets, and existing fixture files. The evaluator rejects writes outside each case's `allowedWrites`. Every writable case is checked by the fixed controller-owned TypeScript AST oracle, so imports, comments, and token stuffing cannot satisfy an implementation contract. Integration/workflow and seeded regression cases also run isolated mocked behavior probes; the after phase runs the target's fixed `yarn typecheck` gate. The target can never supply or replace executable oracle code. Regression oracles must fail before the change and pass afterward. Fixture preparation is not run evidence. Generated results live under ignored `.ai/harness/results/`; they contain hashes and sanitized summaries, never raw transcripts or environment values.
|
|
27
|
+
|
|
28
|
+
The three generated-test cases use direct controller-resolved Jest/Playwright CLIs, never target package scripts. The target and dependencies stay read-only; Jest has no network, Playwright has loopback only, and the browser lane exposes only the exact installed headless-shell runtime. JSON reporters must attest at least one passed test and zero skipped, todo, focused, flaky, or expected-failure tests before review evidence can be created.
|
|
29
|
+
|
|
30
|
+
Generated-code review is a separate post-oracle lane, never a nested second-model call. The individual command is opt-in while developing one case; the once-per-release suite requires it for every writable case:
|
|
31
|
+
|
|
32
|
+
```text
|
|
33
|
+
yarn harness:validate --runner codex --review-writable-result /absolute/controller/.ai/harness/results/<writable-result>.json --writable-root /absolute/disposable/app
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The source must be a passing one-shot implementation result from the current harness and its final whole-target fingerprint must still match. The controller copies changed regular text files as line-numbered inert snapshots, plus its pinned installed `om-code-review` skill and bounded trusted evidence, into a temporary read-only bundle. Target package scripts, dependencies, Git data, tracker state, original source files, and the target's absolute path are not copied or supplied to the reviewer; trace-verified out-of-bundle, environment, or process inspection and any bundle or target mutation fail closed. A separate sanitized artifact records source-result, target, policy, and installed-skill hashes plus the strict verdict, findings, and report. This supplemental review uses prior controller oracle evidence and does not claim the full repository validation gate or CI passed.
|
|
37
|
+
|
|
38
|
+
## Live-run security boundary
|
|
39
|
+
|
|
40
|
+
The trusted runner receives an explicit allowlist of runtime/authentication variables rather than the evaluator's complete environment. The model receives no general shell, process, environment, discovery, browser, or network tool. Codex and Claude are both restricted to one evaluator-owned MCP server launched through `env -i`; it exposes only exact-path `read` and, for writable cases, allowlisted atomic `write`. The server rejects absolute/traversal paths, symlink escapes, credentials, dependencies, Git state, build output, and harness internals. Every response-derived string is also recursively redacted before validation or persistence.
|
|
41
|
+
|
|
42
|
+
The controller places routing and generated-code review inside a host filesystem sandbox: macOS uses `/usr/bin/sandbox-exec`; Linux uses Bubblewrap with user namespaces; native Windows is unsupported for live/review lanes. Only the trusted runner binary receives provider transport and isolated authentication state. Prompt-directed tools cannot open sockets or read runner state: the sole MCP subprocess has an empty environment, is rooted at the app or inert review bundle, and implements no process or network operation. The mandatory outer sandbox remains the filesystem authority; the narrow MCP contract is the model-tool authority. Tool-event traces are still mandatory release evidence: missing traces, out-of-root reads, `.env*`, `.git/**`, `.ai/harness/**`, and case-forbidden or arbitrary app-root reads fail closed. `actualContext` contains only traced MCP reads; `declaredContext` separately measures the model-reported selection. Writable runs additionally fingerprint normally ignored/protected roots before and after execution so writes under `.git`, `node_modules`, build output, or harness results cannot evade the allowlist check.
|