@open-mercato/cli 0.8.1-develop.7296.1.2111d779db → 0.9.0

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.
Files changed (217) hide show
  1. package/.turbo/turbo-build.log +8 -2
  2. package/AGENTS.md +2 -0
  3. package/dist/agentic/guides/module-facts.json +7612 -848
  4. package/dist/agentic/guides/module-facts.v2.json +7612 -848
  5. package/dist/agentic/guides/modules/agent_orchestrator/active-extension-bindings.md +1 -1
  6. package/dist/agentic/guides/modules/agent_orchestrator/index.md +1 -1
  7. package/dist/agentic/guides/modules/ai_assistant/encryption.md +13 -0
  8. package/dist/agentic/guides/modules/ai_assistant/exact-override-targets.md +3 -0
  9. package/dist/agentic/guides/modules/ai_assistant/index.md +4 -3
  10. package/dist/agentic/guides/modules/api_docs/index.md +1 -1
  11. package/dist/agentic/guides/modules/api_keys/domain-commands.md +12 -0
  12. package/dist/agentic/guides/modules/api_keys/index.md +3 -2
  13. package/dist/agentic/guides/modules/attachments/index.md +1 -1
  14. package/dist/agentic/guides/modules/audit_logs/index.md +1 -1
  15. package/dist/agentic/guides/modules/auth/index.md +1 -1
  16. package/dist/agentic/guides/modules/availability/acl-features.md +13 -0
  17. package/dist/agentic/guides/modules/availability/backend-pages.md +14 -0
  18. package/dist/agentic/guides/modules/availability/di-registrations-rich.md +11 -0
  19. package/dist/agentic/guides/modules/availability/domain-commands.md +13 -0
  20. package/dist/agentic/guides/modules/availability/entities.md +11 -0
  21. package/dist/agentic/guides/modules/availability/events.md +13 -0
  22. package/dist/agentic/guides/modules/availability/exact-override-targets.md +19 -0
  23. package/dist/agentic/guides/modules/availability/host-extension-points.md +10 -0
  24. package/dist/agentic/guides/modules/availability/index.md +22 -0
  25. package/dist/agentic/guides/modules/availability/owned-contract-module-metadata.md +11 -0
  26. package/dist/agentic/guides/modules/availability/setup.md +11 -0
  27. package/dist/agentic/guides/modules/availability/umes-hosts.md +14 -0
  28. package/dist/agentic/guides/modules/business_rules/index.md +1 -1
  29. package/dist/agentic/guides/modules/catalog/active-extension-bindings.md +1 -1
  30. package/dist/agentic/guides/modules/catalog/di-registrations-rich.md +1 -0
  31. package/dist/agentic/guides/modules/catalog/exact-override-targets.md +3 -0
  32. package/dist/agentic/guides/modules/catalog/index.md +1 -1
  33. package/dist/agentic/guides/modules/catalog/workers.md +2 -0
  34. package/dist/agentic/guides/modules/channel_apns/index.md +1 -1
  35. package/dist/agentic/guides/modules/channel_discord/index.md +1 -1
  36. package/dist/agentic/guides/modules/channel_expo/index.md +1 -1
  37. package/dist/agentic/guides/modules/channel_fcm/index.md +1 -1
  38. package/dist/agentic/guides/modules/channel_gmail/index.md +1 -1
  39. package/dist/agentic/guides/modules/channel_imap/index.md +1 -1
  40. package/dist/agentic/guides/modules/channel_resend/index.md +1 -1
  41. package/dist/agentic/guides/modules/channel_ses/index.md +1 -1
  42. package/dist/agentic/guides/modules/checkout/index.md +1 -1
  43. package/dist/agentic/guides/modules/communication_channels/acl-features.md +2 -1
  44. package/dist/agentic/guides/modules/communication_channels/contribution-resolutions.md +1 -0
  45. package/dist/agentic/guides/modules/communication_channels/di-registrations-rich.md +11 -10
  46. package/dist/agentic/guides/modules/communication_channels/domain-commands.md +1 -0
  47. package/dist/agentic/guides/modules/communication_channels/events.md +2 -1
  48. package/dist/agentic/guides/modules/communication_channels/exact-override-targets.md +12 -10
  49. package/dist/agentic/guides/modules/communication_channels/incoming-installed-contributions.md +1 -0
  50. package/dist/agentic/guides/modules/communication_channels/index.md +2 -2
  51. package/dist/agentic/guides/modules/communication_channels/umes-contributions.md +1 -0
  52. package/dist/agentic/guides/modules/communication_channels/umes-hosts.md +1 -0
  53. package/dist/agentic/guides/modules/configs/index.md +1 -1
  54. package/dist/agentic/guides/modules/content/index.md +1 -1
  55. package/dist/agentic/guides/modules/currencies/index.md +1 -1
  56. package/dist/agentic/guides/modules/customer_accounts/index.md +1 -1
  57. package/dist/agentic/guides/modules/customer_groups/acl-features.md +16 -0
  58. package/dist/agentic/guides/modules/customer_groups/active-extension-bindings.md +13 -0
  59. package/dist/agentic/guides/modules/customer_groups/backend-pages.md +14 -0
  60. package/dist/agentic/guides/modules/customer_groups/cli-commands.md +11 -0
  61. package/dist/agentic/guides/modules/customer_groups/contribution-resolutions.md +13 -0
  62. package/dist/agentic/guides/modules/customer_groups/di-registrations-rich.md +13 -0
  63. package/dist/agentic/guides/modules/customer_groups/di-service-tokens.md +11 -0
  64. package/dist/agentic/guides/modules/customer_groups/domain-commands.md +11 -0
  65. package/dist/agentic/guides/modules/customer_groups/entities.md +13 -0
  66. package/dist/agentic/guides/modules/customer_groups/events.md +17 -0
  67. package/dist/agentic/guides/modules/customer_groups/exact-override-targets.md +27 -0
  68. package/dist/agentic/guides/modules/customer_groups/index.md +26 -0
  69. package/dist/agentic/guides/modules/customer_groups/owned-contract-module-metadata.md +11 -0
  70. package/dist/agentic/guides/modules/customer_groups/setup.md +11 -0
  71. package/dist/agentic/guides/modules/customer_groups/umes-contributions.md +13 -0
  72. package/dist/agentic/guides/modules/customer_groups/umes-hosts.md +21 -0
  73. package/dist/agentic/guides/modules/customers/acl-features.md +2 -1
  74. package/dist/agentic/guides/modules/customers/active-extension-bindings.md +8 -7
  75. package/dist/agentic/guides/modules/customers/contribution-resolutions.md +1 -0
  76. package/dist/agentic/guides/modules/customers/domain-commands.md +1 -0
  77. package/dist/agentic/guides/modules/customers/entities.md +1 -0
  78. package/dist/agentic/guides/modules/customers/events.md +2 -1
  79. package/dist/agentic/guides/modules/customers/exact-override-targets.md +2 -0
  80. package/dist/agentic/guides/modules/customers/index.md +3 -3
  81. package/dist/agentic/guides/modules/customers/umes-contributions.md +1 -0
  82. package/dist/agentic/guides/modules/customers/umes-hosts.md +3 -0
  83. package/dist/agentic/guides/modules/dashboards/index.md +1 -1
  84. package/dist/agentic/guides/modules/data_sync/index.md +1 -1
  85. package/dist/agentic/guides/modules/design_system/index.md +1 -1
  86. package/dist/agentic/guides/modules/devices/index.md +1 -1
  87. package/dist/agentic/guides/modules/dictionaries/index.md +1 -1
  88. package/dist/agentic/guides/modules/directory/active-extension-bindings.md +1 -1
  89. package/dist/agentic/guides/modules/directory/index.md +1 -1
  90. package/dist/agentic/guides/modules/documents/index.md +1 -1
  91. package/dist/agentic/guides/modules/entities/active-extension-bindings.md +1 -1
  92. package/dist/agentic/guides/modules/entities/index.md +1 -1
  93. package/dist/agentic/guides/modules/eudr/index.md +1 -1
  94. package/dist/agentic/guides/modules/events/index.md +1 -1
  95. package/dist/agentic/guides/modules/feature_toggles/index.md +1 -1
  96. package/dist/agentic/guides/modules/forms/acl-features.md +16 -0
  97. package/dist/agentic/guides/modules/forms/active-extension-bindings.md +14 -0
  98. package/dist/agentic/guides/modules/forms/backend-pages.md +17 -0
  99. package/dist/agentic/guides/modules/forms/contribution-resolutions.md +21 -0
  100. package/dist/agentic/guides/modules/forms/di-registrations-rich.md +27 -0
  101. package/dist/agentic/guides/modules/forms/di-service-tokens.md +19 -0
  102. package/dist/agentic/guides/modules/forms/domain-commands.md +30 -0
  103. package/dist/agentic/guides/modules/forms/encryption.md +11 -0
  104. package/dist/agentic/guides/modules/forms/entities.md +21 -0
  105. package/dist/agentic/guides/modules/forms/events.md +28 -0
  106. package/dist/agentic/guides/modules/forms/exact-override-targets.md +59 -0
  107. package/dist/agentic/guides/modules/forms/frontend-pages.md +16 -0
  108. package/dist/agentic/guides/modules/forms/index.md +28 -0
  109. package/dist/agentic/guides/modules/forms/owned-contract-module-metadata.md +11 -0
  110. package/dist/agentic/guides/modules/forms/setup.md +11 -0
  111. package/dist/agentic/guides/modules/forms/umes-contributions.md +21 -0
  112. package/dist/agentic/guides/modules/forms/umes-hosts.md +43 -0
  113. package/dist/agentic/guides/modules/forms/workers.md +12 -0
  114. package/dist/agentic/guides/modules/gateway_stripe/index.md +1 -1
  115. package/dist/agentic/guides/modules/generators/index.md +1 -1
  116. package/dist/agentic/guides/modules/inbox_ops/active-extension-bindings.md +1 -1
  117. package/dist/agentic/guides/modules/inbox_ops/index.md +1 -1
  118. package/dist/agentic/guides/modules/integrations/di-registrations-rich.md +8 -8
  119. package/dist/agentic/guides/modules/integrations/di-service-tokens.md +4 -4
  120. package/dist/agentic/guides/modules/integrations/exact-override-targets.md +8 -8
  121. package/dist/agentic/guides/modules/integrations/index.md +1 -1
  122. package/dist/agentic/guides/modules/messages/index.md +1 -1
  123. package/dist/agentic/guides/modules/notifications/index.md +1 -1
  124. package/dist/agentic/guides/modules/onboarding/index.md +1 -1
  125. package/dist/agentic/guides/modules/payment_gateways/index.md +1 -1
  126. package/dist/agentic/guides/modules/perspectives/index.md +1 -1
  127. package/dist/agentic/guides/modules/phone_calls/index.md +1 -1
  128. package/dist/agentic/guides/modules/planner/active-extension-bindings.md +1 -1
  129. package/dist/agentic/guides/modules/planner/index.md +1 -1
  130. package/dist/agentic/guides/modules/portal/index.md +1 -1
  131. package/dist/agentic/guides/modules/progress/index.md +1 -1
  132. package/dist/agentic/guides/modules/push_notifications/index.md +1 -1
  133. package/dist/agentic/guides/modules/query_index/index.md +1 -1
  134. package/dist/agentic/guides/modules/record_locks/index.md +1 -1
  135. package/dist/agentic/guides/modules/resources/active-extension-bindings.md +1 -1
  136. package/dist/agentic/guides/modules/resources/index.md +1 -1
  137. package/dist/agentic/guides/modules/sales/active-extension-bindings.md +1 -1
  138. package/dist/agentic/guides/modules/sales/exact-override-targets.md +4 -4
  139. package/dist/agentic/guides/modules/sales/index.md +1 -1
  140. package/dist/agentic/guides/modules/sales/setup.md +1 -1
  141. package/dist/agentic/guides/modules/scheduler/index.md +1 -1
  142. package/dist/agentic/guides/modules/search/index.md +1 -1
  143. package/dist/agentic/guides/modules/security/index.md +1 -1
  144. package/dist/agentic/guides/modules/seeds/index.md +1 -1
  145. package/dist/agentic/guides/modules/shipping_carriers/index.md +1 -1
  146. package/dist/agentic/guides/modules/sso/index.md +1 -1
  147. package/dist/agentic/guides/modules/staff/active-extension-bindings.md +1 -1
  148. package/dist/agentic/guides/modules/staff/index.md +1 -1
  149. package/dist/agentic/guides/modules/storage_s3/index.md +1 -1
  150. package/dist/agentic/guides/modules/sync_akeneo/index.md +1 -1
  151. package/dist/agentic/guides/modules/sync_excel/active-extension-bindings.md +11 -0
  152. package/dist/agentic/guides/modules/sync_excel/index.md +3 -2
  153. package/dist/agentic/guides/modules/system_status_overlays/index.md +1 -1
  154. package/dist/agentic/guides/modules/telemetry/index.md +1 -1
  155. package/dist/agentic/guides/modules/tillio/index.md +1 -1
  156. package/dist/agentic/guides/modules/translations/index.md +1 -1
  157. package/dist/agentic/guides/modules/warranty_claims/index.md +1 -1
  158. package/dist/agentic/guides/modules/webhooks/index.md +1 -1
  159. package/dist/agentic/guides/modules/wms/active-extension-bindings.md +1 -1
  160. package/dist/agentic/guides/modules/wms/contribution-resolutions.md +3 -0
  161. package/dist/agentic/guides/modules/wms/di-registrations-rich.md +8 -8
  162. package/dist/agentic/guides/modules/wms/exact-override-targets.md +11 -8
  163. package/dist/agentic/guides/modules/wms/index.md +3 -3
  164. package/dist/agentic/guides/modules/wms/umes-contributions.md +3 -0
  165. package/dist/agentic/guides/modules/workflows/active-extension-bindings.md +3 -3
  166. package/dist/agentic/guides/modules/workflows/index.md +1 -1
  167. package/dist/agentic/guides/reference-module-facts.json +1 -1
  168. package/dist/agentic/guides/upstream/BACKWARD_COMPATIBILITY.md +73 -1
  169. package/dist/agentic/guides/upstream/manifest.json +2 -2
  170. package/dist/agentic/shared/ai/skills/om-auto-upgrade-0.8.0-to-0.9.0/SKILL.md +112 -0
  171. package/dist/agentic/shared/ai/skills/om-data-model-design/references/sensitive-data.md +1 -1
  172. package/dist/agentic/shared/ai/skills/tiers.json +2 -1
  173. package/dist/bin.js +2 -2
  174. package/dist/bin.js.map +2 -2
  175. package/dist/lib/db/commands.js +84 -5
  176. package/dist/lib/db/commands.js.map +2 -2
  177. package/dist/lib/db/encryption-backfill-check.js +112 -0
  178. package/dist/lib/db/encryption-backfill-check.js.map +7 -0
  179. package/dist/lib/db/migration-reindex.js +2 -1
  180. package/dist/lib/db/migration-reindex.js.map +2 -2
  181. package/dist/lib/events-single-delivery.js.map +2 -2
  182. package/dist/lib/flush-before-exit.js +19 -0
  183. package/dist/lib/flush-before-exit.js.map +7 -0
  184. package/dist/lib/generate-watch-structure.js +113 -19
  185. package/dist/lib/generate-watch-structure.js.map +3 -3
  186. package/dist/lib/generators/module-registry.js +4 -2
  187. package/dist/lib/generators/module-registry.js.map +2 -2
  188. package/dist/lib/generators/web-research-adapters.js +32 -11
  189. package/dist/lib/generators/web-research-adapters.js.map +2 -2
  190. package/dist/lib/telemetry-init.js +69 -11
  191. package/dist/lib/telemetry-init.js.map +3 -3
  192. package/dist/lib/testing/integration.js +29 -2
  193. package/dist/lib/testing/integration.js.map +2 -2
  194. package/package.json +8 -8
  195. package/src/bin.ts +4 -4
  196. package/src/lib/__tests__/flush-before-exit.test.ts +32 -0
  197. package/src/lib/__tests__/generate-watch-structure.test.ts +261 -3
  198. package/src/lib/__tests__/telemetry-init.test.ts +89 -0
  199. package/src/lib/db/__tests__/commands.test.ts +43 -0
  200. package/src/lib/db/__tests__/dynamic-import-specifier.test.ts +36 -0
  201. package/src/lib/db/__tests__/encryption-backfill-check.test.ts +146 -0
  202. package/src/lib/db/__tests__/migration-reindex.test.ts +48 -3
  203. package/src/lib/db/commands.ts +113 -10
  204. package/src/lib/db/encryption-backfill-check.ts +163 -0
  205. package/src/lib/db/migration-reindex.ts +2 -1
  206. package/src/lib/events-single-delivery.ts +5 -2
  207. package/src/lib/flush-before-exit.ts +39 -0
  208. package/src/lib/generate-watch-structure.ts +134 -19
  209. package/src/lib/generators/__tests__/module-facts.customers.fixture.test.ts +14 -3
  210. package/src/lib/generators/__tests__/module-package-sources.test.ts +2 -2
  211. package/src/lib/generators/__tests__/registry-variant-parity.test.ts +16 -0
  212. package/src/lib/generators/__tests__/web-research-adapters.test.ts +141 -0
  213. package/src/lib/generators/module-registry.ts +2 -0
  214. package/src/lib/generators/web-research-adapters.ts +41 -20
  215. package/src/lib/telemetry-init.ts +68 -11
  216. package/src/lib/testing/__tests__/integration.test.ts +26 -0
  217. package/src/lib/testing/integration.ts +32 -2
@@ -4,6 +4,7 @@ import path from "node:path";
4
4
  import {
5
5
  MODULE_CODE_EXTENSIONS,
6
6
  SCAN_CONFIGS,
7
+ resolveStandaloneSourceMirrorBase,
7
8
  scanModuleDir,
8
9
  stripModuleCodeExtension
9
10
  } from "./generators/scanner.js";
@@ -60,6 +61,12 @@ const ROUTE_SHAPE_SCAN_CONFIGS = [
60
61
  function checksum(value) {
61
62
  return crypto.createHash("md5").update(value).digest("hex");
62
63
  }
64
+ function moduleRootIdentity(roots) {
65
+ return JSON.stringify([
66
+ roots.pkgBase.replace(/\\/g, "/"),
67
+ roots.appBase.replace(/\\/g, "/")
68
+ ]);
69
+ }
63
70
  function fileRecord(filePath, base, mode) {
64
71
  if (!fs.existsSync(filePath)) return null;
65
72
  let stat;
@@ -79,6 +86,10 @@ function fileRecord(filePath, base, mode) {
79
86
  return `file:${rel}:unreadable`;
80
87
  }
81
88
  }
89
+ function addFileRecord(records, prefix, filePath, base, mode) {
90
+ const record = fileRecord(filePath, base, mode);
91
+ if (record) records.push(`${prefix}:${record}`);
92
+ }
82
93
  function resolveCodeFile(base, relativePath) {
83
94
  const stripped = stripModuleCodeExtension(relativePath);
84
95
  const candidates = MODULE_CODE_EXTENSIONS.map((extension) => `${stripped}${extension}`);
@@ -88,6 +99,11 @@ function resolveCodeFile(base, relativePath) {
88
99
  }
89
100
  return null;
90
101
  }
102
+ function resolveRuntimeCounterpart(pkgBase, sourceBase, sourceFile) {
103
+ if (sourceBase === pkgBase) return null;
104
+ const relativePath = path.relative(sourceBase, sourceFile).replace(/\\/g, "/");
105
+ return resolveCodeFile(pkgBase, relativePath);
106
+ }
91
107
  function hasInlinePageMetadata(filePath) {
92
108
  try {
93
109
  const source = fs.readFileSync(filePath, "utf8");
@@ -97,43 +113,118 @@ function hasInlinePageMetadata(filePath) {
97
113
  }
98
114
  }
99
115
  function addConventionRecords(records, roots) {
116
+ const packageSourceBase = resolveStandaloneSourceMirrorBase(roots.pkgBase) ?? roots.pkgBase;
100
117
  for (const base of [roots.pkgBase, roots.appBase]) {
101
118
  records.push(`module-root:${base}:${fs.existsSync(base) ? "present" : "missing"}`);
102
- for (const relativePath of STRUCTURAL_CONVENTION_FILES) {
103
- const filePath = resolveCodeFile(base, relativePath);
104
- if (!filePath) {
105
- records.push(`missing:${base}:${relativePath}`);
106
- continue;
119
+ }
120
+ if (packageSourceBase !== roots.pkgBase) {
121
+ records.push(
122
+ `module-root:${packageSourceBase}:${fs.existsSync(packageSourceBase) ? "present" : "missing"}`
123
+ );
124
+ }
125
+ for (const relativePath of STRUCTURAL_CONVENTION_FILES) {
126
+ const appFile = resolveCodeFile(roots.appBase, relativePath);
127
+ if (appFile) {
128
+ addFileRecord(records, "convention:app", appFile, roots.appBase, "content");
129
+ continue;
130
+ }
131
+ const sourceFile = resolveCodeFile(packageSourceBase, relativePath);
132
+ if (!sourceFile) {
133
+ const runtimeFile2 = packageSourceBase === roots.pkgBase ? null : resolveCodeFile(roots.pkgBase, relativePath);
134
+ if (runtimeFile2) {
135
+ addFileRecord(records, "convention:package-runtime", runtimeFile2, roots.pkgBase, "content");
136
+ } else {
137
+ records.push(`convention:missing:${relativePath}`);
107
138
  }
108
- const record = fileRecord(filePath, base, "content");
109
- if (record) records.push(record);
139
+ continue;
140
+ }
141
+ const packagePrefix = packageSourceBase === roots.pkgBase ? "package" : "package-source";
142
+ addFileRecord(records, `convention:${packagePrefix}`, sourceFile, packageSourceBase, "content");
143
+ const runtimeFile = resolveRuntimeCounterpart(roots.pkgBase, packageSourceBase, sourceFile);
144
+ if (runtimeFile) {
145
+ addFileRecord(records, "convention:package-runtime", runtimeFile, roots.pkgBase, "content");
146
+ } else if (packageSourceBase !== roots.pkgBase) {
147
+ records.push(`convention:package-runtime:missing:${relativePath}`);
110
148
  }
111
149
  }
112
150
  }
113
151
  function addScannedRecords(records, roots) {
152
+ const packageSourceBase = resolveStandaloneSourceMirrorBase(roots.pkgBase) ?? roots.pkgBase;
114
153
  for (const config of CONTENT_SENSITIVE_SCAN_CONFIGS) {
115
154
  for (const scanned of scanModuleDir(roots, config)) {
116
- const base = scanned.fromApp ? roots.appBase : roots.pkgBase;
155
+ const base = scanned.fromApp ? roots.appBase : packageSourceBase;
117
156
  const filePath = path.join(base, ...config.folder.split("/"), ...scanned.relPath.split("/"));
118
- const record = fileRecord(filePath, base, "content");
119
- if (record) records.push(`${config.folder}:${record}`);
157
+ let sourceOrigin = "app";
158
+ if (!scanned.fromApp) {
159
+ sourceOrigin = packageSourceBase === roots.pkgBase ? "package" : "package-source";
160
+ }
161
+ addFileRecord(records, `${config.folder}:${sourceOrigin}`, filePath, base, "content");
162
+ if (!scanned.fromApp && packageSourceBase !== roots.pkgBase) {
163
+ const runtimeFile = resolveRuntimeCounterpart(roots.pkgBase, packageSourceBase, filePath);
164
+ if (runtimeFile) {
165
+ addFileRecord(
166
+ records,
167
+ `${config.folder}:package-runtime`,
168
+ runtimeFile,
169
+ roots.pkgBase,
170
+ "content"
171
+ );
172
+ } else {
173
+ records.push(`${config.folder}:package-runtime:missing:${scanned.relPath}`);
174
+ }
175
+ }
120
176
  }
121
177
  }
122
178
  for (const config of ROUTE_SHAPE_SCAN_CONFIGS) {
123
179
  for (const scanned of scanModuleDir(roots, config)) {
124
- const base = scanned.fromApp ? roots.appBase : roots.pkgBase;
180
+ const base = scanned.fromApp ? roots.appBase : packageSourceBase;
125
181
  const folderPath = path.join(base, ...config.folder.split("/"));
126
182
  const filePath = path.join(folderPath, ...scanned.relPath.split("/"));
127
- const pageRecord = fileRecord(filePath, base, hasInlinePageMetadata(filePath) ? "content" : "shape");
128
- if (pageRecord) records.push(`${config.folder}:${pageRecord}`);
129
- const dir = path.dirname(filePath);
183
+ let sourceOrigin = "app";
184
+ if (!scanned.fromApp) {
185
+ sourceOrigin = packageSourceBase === roots.pkgBase ? "package" : "package-source";
186
+ }
187
+ addFileRecord(
188
+ records,
189
+ `${config.folder}:${sourceOrigin}`,
190
+ filePath,
191
+ base,
192
+ hasInlinePageMetadata(filePath) ? "content" : "shape"
193
+ );
194
+ let runtimeFile = null;
195
+ if (!scanned.fromApp && packageSourceBase !== roots.pkgBase) {
196
+ runtimeFile = resolveRuntimeCounterpart(roots.pkgBase, packageSourceBase, filePath);
197
+ if (runtimeFile) {
198
+ addFileRecord(
199
+ records,
200
+ `${config.folder}:package-runtime`,
201
+ runtimeFile,
202
+ roots.pkgBase,
203
+ hasInlinePageMetadata(runtimeFile) ? "content" : "shape"
204
+ );
205
+ } else {
206
+ records.push(`${config.folder}:package-runtime:missing:${scanned.relPath}`);
207
+ }
208
+ }
130
209
  const stem = stripModuleCodeExtension(path.basename(filePath));
131
210
  const metaCandidates = stem === "page" ? ["page.meta", "meta"] : [`${stem}.meta`, "meta"];
132
211
  for (const candidate of metaCandidates) {
133
- const metaPath = resolveCodeFile(dir, candidate);
212
+ const metaPath = resolveCodeFile(path.dirname(filePath), candidate);
134
213
  if (!metaPath) continue;
135
- const record = fileRecord(metaPath, base, "content");
136
- if (record) records.push(`${config.folder}:meta:${record}`);
214
+ addFileRecord(records, `${config.folder}:meta:${sourceOrigin}`, metaPath, base, "content");
215
+ }
216
+ if (runtimeFile) {
217
+ for (const candidate of metaCandidates) {
218
+ const runtimeMetaPath = resolveCodeFile(path.dirname(runtimeFile), candidate);
219
+ if (!runtimeMetaPath) continue;
220
+ addFileRecord(
221
+ records,
222
+ `${config.folder}:meta:package-runtime`,
223
+ runtimeMetaPath,
224
+ roots.pkgBase,
225
+ "content"
226
+ );
227
+ }
137
228
  }
138
229
  }
139
230
  }
@@ -143,8 +234,11 @@ function calculateGenerateWatchStructureChecksum(options) {
143
234
  const modulesRecord = fileRecord(options.modulesFile, path.dirname(options.modulesFile), "content");
144
235
  records.push(modulesRecord ?? `missing:${options.modulesFile}`);
145
236
  for (const roots of options.moduleRoots) {
146
- addConventionRecords(records, roots);
147
- addScannedRecords(records, roots);
237
+ const moduleRecords = [];
238
+ addConventionRecords(moduleRecords, roots);
239
+ addScannedRecords(moduleRecords, roots);
240
+ const rootIdentity = moduleRootIdentity(roots);
241
+ records.push(...moduleRecords.map((record) => `${rootIdentity}:${record}`));
148
242
  }
149
243
  return checksum(records.sort((a, b) => a.localeCompare(b)).join("\n"));
150
244
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/lib/generate-watch-structure.ts"],
4
- "sourcesContent": ["import crypto from 'node:crypto'\nimport fs from 'node:fs'\nimport path from 'node:path'\nimport {\n MODULE_CODE_EXTENSIONS,\n SCAN_CONFIGS,\n scanModuleDir,\n stripModuleCodeExtension,\n type ModuleRoots,\n} from './generators/scanner'\n\nconst STRUCTURAL_CONVENTION_FILES = [\n 'index.ts',\n 'cli.ts',\n 'di.ts',\n 'acl.ts',\n 'setup.ts',\n 'runtime.ts',\n 'encryption.ts',\n 'ce.ts',\n 'search.ts',\n 'events.ts',\n 'notifications.ts',\n 'notifications.client.ts',\n 'notifications.handlers.ts',\n 'translations.ts',\n 'generators.ts',\n 'ai-tools.ts',\n 'ai-agents.ts',\n 'analytics.ts',\n 'workflows.ts',\n 'inbox-actions.ts',\n 'message-types.ts',\n 'message-objects.ts',\n 'integration.ts',\n 'security.mfa-providers.ts',\n 'security.sudo.ts',\n 'data/entities.ts',\n 'data/extensions.ts',\n 'data/fields.ts',\n 'data/enrichers.ts',\n 'data/guards.ts',\n 'api/interceptors.ts',\n 'commands/interceptors.ts',\n 'widgets/components.ts',\n 'widgets/injection-table.ts',\n 'frontend/middleware.ts',\n 'backend/middleware.ts',\n] as const\n\nconst CONTENT_SENSITIVE_SCAN_CONFIGS = [\n SCAN_CONFIGS.apiRoutes,\n SCAN_CONFIGS.apiPlainFiles,\n SCAN_CONFIGS.subscribers,\n SCAN_CONFIGS.workers,\n SCAN_CONFIGS.dashboardWidgets,\n SCAN_CONFIGS.injectionWidgets,\n] as const\n\nconst ROUTE_SHAPE_SCAN_CONFIGS = [\n SCAN_CONFIGS.frontendPages,\n SCAN_CONFIGS.backendPages,\n] as const\n\nfunction checksum(value: string): string {\n return crypto.createHash('md5').update(value).digest('hex')\n}\n\nfunction fileRecord(filePath: string, base: string, mode: 'content' | 'shape'): string | null {\n if (!fs.existsSync(filePath)) return null\n let stat: fs.Stats\n try {\n stat = fs.statSync(filePath)\n } catch {\n return null\n }\n if (!stat.isFile()) return null\n const rel = path.relative(base, filePath).replace(/\\\\/g, '/')\n if (mode === 'shape') {\n return `file:${rel}`\n }\n try {\n return `file:${rel}:${stat.size}:${checksum(fs.readFileSync(filePath, 'utf8'))}`\n } catch {\n return `file:${rel}:unreadable`\n }\n}\n\nfunction resolveCodeFile(base: string, relativePath: string): string | null {\n const stripped = stripModuleCodeExtension(relativePath)\n const candidates = MODULE_CODE_EXTENSIONS.map((extension) => `${stripped}${extension}`)\n for (const candidate of candidates) {\n const filePath = path.join(base, ...candidate.split('/'))\n if (fs.existsSync(filePath)) return filePath\n }\n return null\n}\n\nfunction hasInlinePageMetadata(filePath: string): boolean {\n try {\n const source = fs.readFileSync(filePath, 'utf8')\n return /\\bexport\\s+(?:const|let|var|function|class)\\s+metadata\\b/.test(source)\n || /\\bexport\\s+\\{[^}]*\\bmetadata\\b[^}]*\\}/.test(source)\n } catch {\n return false\n }\n}\n\nfunction addConventionRecords(records: string[], roots: ModuleRoots): void {\n for (const base of [roots.pkgBase, roots.appBase]) {\n records.push(`module-root:${base}:${fs.existsSync(base) ? 'present' : 'missing'}`)\n for (const relativePath of STRUCTURAL_CONVENTION_FILES) {\n const filePath = resolveCodeFile(base, relativePath)\n if (!filePath) {\n records.push(`missing:${base}:${relativePath}`)\n continue\n }\n const record = fileRecord(filePath, base, 'content')\n if (record) records.push(record)\n }\n }\n}\n\nfunction addScannedRecords(records: string[], roots: ModuleRoots): void {\n for (const config of CONTENT_SENSITIVE_SCAN_CONFIGS) {\n for (const scanned of scanModuleDir(roots, config)) {\n const base = scanned.fromApp ? roots.appBase : roots.pkgBase\n const filePath = path.join(base, ...config.folder.split('/'), ...scanned.relPath.split('/'))\n const record = fileRecord(filePath, base, 'content')\n if (record) records.push(`${config.folder}:${record}`)\n }\n }\n\n for (const config of ROUTE_SHAPE_SCAN_CONFIGS) {\n for (const scanned of scanModuleDir(roots, config)) {\n const base = scanned.fromApp ? roots.appBase : roots.pkgBase\n const folderPath = path.join(base, ...config.folder.split('/'))\n const filePath = path.join(folderPath, ...scanned.relPath.split('/'))\n const pageRecord = fileRecord(filePath, base, hasInlinePageMetadata(filePath) ? 'content' : 'shape')\n if (pageRecord) records.push(`${config.folder}:${pageRecord}`)\n\n const dir = path.dirname(filePath)\n const stem = stripModuleCodeExtension(path.basename(filePath))\n const metaCandidates = stem === 'page'\n ? ['page.meta', 'meta']\n : [`${stem}.meta`, 'meta']\n for (const candidate of metaCandidates) {\n const metaPath = resolveCodeFile(dir, candidate)\n if (!metaPath) continue\n const record = fileRecord(metaPath, base, 'content')\n if (record) records.push(`${config.folder}:meta:${record}`)\n }\n }\n }\n}\n\nexport function calculateGenerateWatchStructureChecksum(options: {\n modulesFile: string\n moduleRoots: ModuleRoots[]\n}): string {\n const records: string[] = []\n const modulesRecord = fileRecord(options.modulesFile, path.dirname(options.modulesFile), 'content')\n records.push(modulesRecord ?? `missing:${options.modulesFile}`)\n\n for (const roots of options.moduleRoots) {\n addConventionRecords(records, roots)\n addScannedRecords(records, roots)\n }\n\n return checksum(records.sort((a, b) => a.localeCompare(b)).join('\\n'))\n}\n"],
5
- "mappings": "AAAA,OAAO,YAAY;AACnB,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAEP,MAAM,8BAA8B;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAC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path'\nimport {\n MODULE_CODE_EXTENSIONS,\n SCAN_CONFIGS,\n resolveStandaloneSourceMirrorBase,\n scanModuleDir,\n stripModuleCodeExtension,\n type ModuleRoots,\n} from './generators/scanner'\n\nconst STRUCTURAL_CONVENTION_FILES = [\n 'index.ts',\n 'cli.ts',\n 'di.ts',\n 'acl.ts',\n 'setup.ts',\n 'runtime.ts',\n 'encryption.ts',\n 'ce.ts',\n 'search.ts',\n 'events.ts',\n 'notifications.ts',\n 'notifications.client.ts',\n 'notifications.handlers.ts',\n 'translations.ts',\n 'generators.ts',\n 'ai-tools.ts',\n 'ai-agents.ts',\n 'analytics.ts',\n 'workflows.ts',\n 'inbox-actions.ts',\n 'message-types.ts',\n 'message-objects.ts',\n 'integration.ts',\n 'security.mfa-providers.ts',\n 'security.sudo.ts',\n 'data/entities.ts',\n 'data/extensions.ts',\n 'data/fields.ts',\n 'data/enrichers.ts',\n 'data/guards.ts',\n 'api/interceptors.ts',\n 'commands/interceptors.ts',\n 'widgets/components.ts',\n 'widgets/injection-table.ts',\n 'frontend/middleware.ts',\n 'backend/middleware.ts',\n] as const\n\nconst CONTENT_SENSITIVE_SCAN_CONFIGS = [\n SCAN_CONFIGS.apiRoutes,\n SCAN_CONFIGS.apiPlainFiles,\n SCAN_CONFIGS.subscribers,\n SCAN_CONFIGS.workers,\n SCAN_CONFIGS.dashboardWidgets,\n SCAN_CONFIGS.injectionWidgets,\n] as const\n\nconst ROUTE_SHAPE_SCAN_CONFIGS = [\n SCAN_CONFIGS.frontendPages,\n SCAN_CONFIGS.backendPages,\n] as const\n\nfunction checksum(value: string): string {\n return crypto.createHash('md5').update(value).digest('hex')\n}\n\nfunction moduleRootIdentity(roots: ModuleRoots): string {\n return JSON.stringify([\n roots.pkgBase.replace(/\\\\/g, '/'),\n roots.appBase.replace(/\\\\/g, '/'),\n ])\n}\n\nfunction fileRecord(filePath: string, base: string, mode: 'content' | 'shape'): string | null {\n if (!fs.existsSync(filePath)) return null\n let stat: fs.Stats\n try {\n stat = fs.statSync(filePath)\n } catch {\n return null\n }\n if (!stat.isFile()) return null\n const rel = path.relative(base, filePath).replace(/\\\\/g, '/')\n if (mode === 'shape') {\n return `file:${rel}`\n }\n try {\n return `file:${rel}:${stat.size}:${checksum(fs.readFileSync(filePath, 'utf8'))}`\n } catch {\n return `file:${rel}:unreadable`\n }\n}\n\nfunction addFileRecord(\n records: string[],\n prefix: string,\n filePath: string,\n base: string,\n mode: 'content' | 'shape',\n): void {\n const record = fileRecord(filePath, base, mode)\n if (record) records.push(`${prefix}:${record}`)\n}\n\nfunction resolveCodeFile(base: string, relativePath: string): string | null {\n const stripped = stripModuleCodeExtension(relativePath)\n const candidates = MODULE_CODE_EXTENSIONS.map((extension) => `${stripped}${extension}`)\n for (const candidate of candidates) {\n const filePath = path.join(base, ...candidate.split('/'))\n if (fs.existsSync(filePath)) return filePath\n }\n return null\n}\n\nfunction resolveRuntimeCounterpart(\n pkgBase: string,\n sourceBase: string,\n sourceFile: string,\n): string | null {\n if (sourceBase === pkgBase) return null\n const relativePath = path.relative(sourceBase, sourceFile).replace(/\\\\/g, '/')\n return resolveCodeFile(pkgBase, relativePath)\n}\n\nfunction hasInlinePageMetadata(filePath: string): boolean {\n try {\n const source = fs.readFileSync(filePath, 'utf8')\n return /\\bexport\\s+(?:const|let|var|function|class)\\s+metadata\\b/.test(source)\n || /\\bexport\\s+\\{[^}]*\\bmetadata\\b[^}]*\\}/.test(source)\n } catch {\n return false\n }\n}\n\nfunction addConventionRecords(records: string[], roots: ModuleRoots): void {\n const packageSourceBase = resolveStandaloneSourceMirrorBase(roots.pkgBase) ?? roots.pkgBase\n for (const base of [roots.pkgBase, roots.appBase]) {\n records.push(`module-root:${base}:${fs.existsSync(base) ? 'present' : 'missing'}`)\n }\n if (packageSourceBase !== roots.pkgBase) {\n records.push(\n `module-root:${packageSourceBase}:${fs.existsSync(packageSourceBase) ? 'present' : 'missing'}`,\n )\n }\n\n for (const relativePath of STRUCTURAL_CONVENTION_FILES) {\n const appFile = resolveCodeFile(roots.appBase, relativePath)\n if (appFile) {\n addFileRecord(records, 'convention:app', appFile, roots.appBase, 'content')\n continue\n }\n\n const sourceFile = resolveCodeFile(packageSourceBase, relativePath)\n if (!sourceFile) {\n const runtimeFile = packageSourceBase === roots.pkgBase\n ? null\n : resolveCodeFile(roots.pkgBase, relativePath)\n if (runtimeFile) {\n addFileRecord(records, 'convention:package-runtime', runtimeFile, roots.pkgBase, 'content')\n } else {\n records.push(`convention:missing:${relativePath}`)\n }\n continue\n }\n\n const packagePrefix = packageSourceBase === roots.pkgBase ? 'package' : 'package-source'\n addFileRecord(records, `convention:${packagePrefix}`, sourceFile, packageSourceBase, 'content')\n const runtimeFile = resolveRuntimeCounterpart(roots.pkgBase, packageSourceBase, sourceFile)\n if (runtimeFile) {\n addFileRecord(records, 'convention:package-runtime', runtimeFile, roots.pkgBase, 'content')\n } else if (packageSourceBase !== roots.pkgBase) {\n records.push(`convention:package-runtime:missing:${relativePath}`)\n }\n }\n}\n\nfunction addScannedRecords(records: string[], roots: ModuleRoots): void {\n const packageSourceBase = resolveStandaloneSourceMirrorBase(roots.pkgBase) ?? roots.pkgBase\n for (const config of CONTENT_SENSITIVE_SCAN_CONFIGS) {\n for (const scanned of scanModuleDir(roots, config)) {\n const base = scanned.fromApp ? roots.appBase : packageSourceBase\n const filePath = path.join(base, ...config.folder.split('/'), ...scanned.relPath.split('/'))\n let sourceOrigin = 'app'\n if (!scanned.fromApp) {\n sourceOrigin = packageSourceBase === roots.pkgBase ? 'package' : 'package-source'\n }\n addFileRecord(records, `${config.folder}:${sourceOrigin}`, filePath, base, 'content')\n\n if (!scanned.fromApp && packageSourceBase !== roots.pkgBase) {\n const runtimeFile = resolveRuntimeCounterpart(roots.pkgBase, packageSourceBase, filePath)\n if (runtimeFile) {\n addFileRecord(\n records,\n `${config.folder}:package-runtime`,\n runtimeFile,\n roots.pkgBase,\n 'content',\n )\n } else {\n records.push(`${config.folder}:package-runtime:missing:${scanned.relPath}`)\n }\n }\n }\n }\n\n for (const config of ROUTE_SHAPE_SCAN_CONFIGS) {\n for (const scanned of scanModuleDir(roots, config)) {\n const base = scanned.fromApp ? roots.appBase : packageSourceBase\n const folderPath = path.join(base, ...config.folder.split('/'))\n const filePath = path.join(folderPath, ...scanned.relPath.split('/'))\n let sourceOrigin = 'app'\n if (!scanned.fromApp) {\n sourceOrigin = packageSourceBase === roots.pkgBase ? 'package' : 'package-source'\n }\n addFileRecord(\n records,\n `${config.folder}:${sourceOrigin}`,\n filePath,\n base,\n hasInlinePageMetadata(filePath) ? 'content' : 'shape',\n )\n\n let runtimeFile: string | null = null\n if (!scanned.fromApp && packageSourceBase !== roots.pkgBase) {\n runtimeFile = resolveRuntimeCounterpart(roots.pkgBase, packageSourceBase, filePath)\n if (runtimeFile) {\n addFileRecord(\n records,\n `${config.folder}:package-runtime`,\n runtimeFile,\n roots.pkgBase,\n hasInlinePageMetadata(runtimeFile) ? 'content' : 'shape',\n )\n } else {\n records.push(`${config.folder}:package-runtime:missing:${scanned.relPath}`)\n }\n }\n\n const stem = stripModuleCodeExtension(path.basename(filePath))\n const metaCandidates = stem === 'page'\n ? ['page.meta', 'meta']\n : [`${stem}.meta`, 'meta']\n for (const candidate of metaCandidates) {\n const metaPath = resolveCodeFile(path.dirname(filePath), candidate)\n if (!metaPath) continue\n addFileRecord(records, `${config.folder}:meta:${sourceOrigin}`, metaPath, base, 'content')\n }\n\n if (runtimeFile) {\n for (const candidate of metaCandidates) {\n const runtimeMetaPath = resolveCodeFile(path.dirname(runtimeFile), candidate)\n if (!runtimeMetaPath) continue\n addFileRecord(\n records,\n `${config.folder}:meta:package-runtime`,\n runtimeMetaPath,\n roots.pkgBase,\n 'content',\n )\n }\n }\n }\n }\n}\n\nexport function calculateGenerateWatchStructureChecksum(options: {\n modulesFile: string\n moduleRoots: ModuleRoots[]\n}): string {\n const records: string[] = []\n const modulesRecord = fileRecord(options.modulesFile, path.dirname(options.modulesFile), 'content')\n records.push(modulesRecord ?? `missing:${options.modulesFile}`)\n\n for (const roots of options.moduleRoots) {\n const moduleRecords: string[] = []\n addConventionRecords(moduleRecords, roots)\n addScannedRecords(moduleRecords, roots)\n const rootIdentity = moduleRootIdentity(roots)\n records.push(...moduleRecords.map((record) => `${rootIdentity}:${record}`))\n }\n\n return checksum(records.sort((a, b) => a.localeCompare(b)).join('\\n'))\n}\n"],
5
+ "mappings": "AAAA,OAAO,YAAY;AACnB,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAEP,MAAM,8BAA8B;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,MAAM,iCAAiC;AAAA,EACrC,aAAa;AAAA,EACb,aAAa;AAAA,EACb,aAAa;AAAA,EACb,aAAa;AAAA,EACb,aAAa;AAAA,EACb,aAAa;AACf;AAEA,MAAM,2BAA2B;AAAA,EAC/B,aAAa;AAAA,EACb,aAAa;AACf;AAEA,SAAS,SAAS,OAAuB;AACvC,SAAO,OAAO,WAAW,KAAK,EAAE,OAAO,KAAK,EAAE,OAAO,KAAK;AAC5D;AAEA,SAAS,mBAAmB,OAA4B;AACtD,SAAO,KAAK,UAAU;AAAA,IACpB,MAAM,QAAQ,QAAQ,OAAO,GAAG;AAAA,IAChC,MAAM,QAAQ,QAAQ,OAAO,GAAG;AAAA,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AAQ,QAAQ,WAAW,GAAG,SAAS;AAClG,UAAQ,KAAK,iBAAiB,WAAW,QAAQ,WAAW,EAAE;AAE9D,aAAW,SAAS,QAAQ,aAAa;AACvC,UAAM,gBAA0B,CAAC;AACjC,yBAAqB,eAAe,KAAK;AACzC,sBAAkB,eAAe,KAAK;AACtC,UAAM,eAAe,mBAAmB,KAAK;AAC7C,YAAQ,KAAK,GAAG,cAAc,IAAI,CAAC,WAAW,GAAG,YAAY,IAAI,MAAM,EAAE,CAAC;AAAA,EAC5E;AAEA,SAAO,SAAS,QAAQ,KAAK,CAAC,GAAG,MAAM,EAAE,cAAc,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC;AACvE;",
6
+ "names": ["runtimeFile"]
7
7
  }
@@ -3631,7 +3631,8 @@ async function generateModuleRegistryAppFromDiscovery(options) {
3631
3631
  value: namespaceFallback({
3632
3632
  importName: moduleRuntimeImportName,
3633
3633
  members: ["default", "runtime"],
3634
- fallback: identifier("undefined")
3634
+ fallback: identifier("undefined"),
3635
+ castType: "Module['runtime']"
3635
3636
  })
3636
3637
  });
3637
3638
  }
@@ -3984,7 +3985,8 @@ async function generateModuleRegistryCliFromDiscovery(options) {
3984
3985
  value: namespaceFallback({
3985
3986
  importName: moduleRuntimeImportName,
3986
3987
  members: ["default", "runtime"],
3987
- fallback: identifier("undefined")
3988
+ fallback: identifier("undefined"),
3989
+ castType: "Module['runtime']"
3988
3990
  })
3989
3991
  });
3990
3992
  }