@open-mercato/cli 0.6.7-develop.6566.1.15385fa179 → 0.6.7-develop.6568.1.9f57ffc393
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 +1 -1
- package/AGENTS.md +5 -3
- package/dist/agentic/guides/module-facts.json +53 -53
- package/dist/agentic/guides/modules/ai_assistant.md +1 -1
- 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 +1 -1
- package/dist/agentic/guides/modules/audit_logs.md +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- package/dist/agentic/guides/modules/workflows.md +1 -1
- package/dist/lib/post-generate-invalidation.js +49 -0
- package/dist/lib/post-generate-invalidation.js.map +7 -0
- package/dist/mercato.js +20 -20
- package/dist/mercato.js.map +2 -2
- package/package.json +5 -5
- package/src/__tests__/mercato.test.ts +63 -21
- package/src/lib/__tests__/post-generate-invalidation.test.ts +81 -0
- package/src/lib/post-generate-invalidation.ts +62 -0
- package/src/mercato.ts +20 -20
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# feature_toggles — module facts (generated, do not edit)
|
|
2
|
-
<!-- generated from @open-mercato/core 0.6.7-develop.
|
|
2
|
+
<!-- generated from @open-mercato/core 0.6.7-develop.6568.1.9f57ffc393 — R1 staleness stamp -->
|
|
3
3
|
|
|
4
4
|
## Entities
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# gateway_stripe — module facts (generated, do not edit)
|
|
2
|
-
<!-- generated from @open-mercato/core 0.6.7-develop.
|
|
2
|
+
<!-- generated from @open-mercato/core 0.6.7-develop.6568.1.9f57ffc393 — R1 staleness stamp -->
|
|
3
3
|
|
|
4
4
|
## Entities
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# payment_gateways — module facts (generated, do not edit)
|
|
2
|
-
<!-- generated from @open-mercato/core 0.6.7-develop.
|
|
2
|
+
<!-- generated from @open-mercato/core 0.6.7-develop.6568.1.9f57ffc393 — R1 staleness stamp -->
|
|
3
3
|
|
|
4
4
|
## Entities
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# shipping_carriers — module facts (generated, do not edit)
|
|
2
|
-
<!-- generated from @open-mercato/core 0.6.7-develop.
|
|
2
|
+
<!-- generated from @open-mercato/core 0.6.7-develop.6568.1.9f57ffc393 — R1 staleness stamp -->
|
|
3
3
|
|
|
4
4
|
## Entities
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# system_status_overlays — module facts (generated, do not edit)
|
|
2
|
-
<!-- generated from @open-mercato/core 0.6.7-develop.
|
|
2
|
+
<!-- generated from @open-mercato/core 0.6.7-develop.6568.1.9f57ffc393 — R1 staleness stamp -->
|
|
3
3
|
|
|
4
4
|
## Entities
|
|
5
5
|
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { purgeConfiguredCachePatternsAcrossTenantScopes } from "@open-mercato/shared/lib/cache/maintenance";
|
|
4
|
+
const STRUCTURAL_CACHE_PATTERNS = [
|
|
5
|
+
"nav:*",
|
|
6
|
+
"crud|*|*|*/admin/nav|*",
|
|
7
|
+
"crud|*|*|*/portal/nav|*"
|
|
8
|
+
];
|
|
9
|
+
const TOUCHABLE_GENERATED_FILE_PATTERN = /\.generated(?:\.[a-z0-9]+)?(?:\.ts|\.checksum)$/i;
|
|
10
|
+
function touchGeneratedFiles(appDir) {
|
|
11
|
+
const generatedDir = path.join(appDir, ".mercato", "generated");
|
|
12
|
+
if (!fs.existsSync(generatedDir) || !fs.statSync(generatedDir).isDirectory()) return [];
|
|
13
|
+
const touched = [];
|
|
14
|
+
const entries = fs.readdirSync(generatedDir, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name));
|
|
15
|
+
for (const entry of entries) {
|
|
16
|
+
if (!entry.isFile() || !TOUCHABLE_GENERATED_FILE_PATTERN.test(entry.name)) continue;
|
|
17
|
+
const filePath = path.join(generatedDir, entry.name);
|
|
18
|
+
const contents = fs.readFileSync(filePath);
|
|
19
|
+
fs.writeFileSync(filePath, contents);
|
|
20
|
+
touched.push(filePath);
|
|
21
|
+
}
|
|
22
|
+
return touched;
|
|
23
|
+
}
|
|
24
|
+
async function runPostGenerateStructuralInvalidation(appDir) {
|
|
25
|
+
let cacheEntriesDeleted = 0;
|
|
26
|
+
let generatedFilesTouched = [];
|
|
27
|
+
let cacheError = null;
|
|
28
|
+
let generatedFilesError = null;
|
|
29
|
+
try {
|
|
30
|
+
generatedFilesTouched = touchGeneratedFiles(appDir);
|
|
31
|
+
} catch (error) {
|
|
32
|
+
generatedFilesError = error;
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
cacheEntriesDeleted = await purgeConfiguredCachePatternsAcrossTenantScopes(STRUCTURAL_CACHE_PATTERNS);
|
|
36
|
+
} catch (error) {
|
|
37
|
+
cacheError = error;
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
cacheEntriesDeleted,
|
|
41
|
+
generatedFilesTouched,
|
|
42
|
+
cacheError,
|
|
43
|
+
generatedFilesError
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
runPostGenerateStructuralInvalidation
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=post-generate-invalidation.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/lib/post-generate-invalidation.ts"],
|
|
4
|
+
"sourcesContent": ["import fs from 'node:fs'\nimport path from 'node:path'\nimport { purgeConfiguredCachePatternsAcrossTenantScopes } from '@open-mercato/shared/lib/cache/maintenance'\n\nconst STRUCTURAL_CACHE_PATTERNS = [\n 'nav:*',\n 'crud|*|*|*/admin/nav|*',\n 'crud|*|*|*/portal/nav|*',\n]\nconst TOUCHABLE_GENERATED_FILE_PATTERN = /\\.generated(?:\\.[a-z0-9]+)?(?:\\.ts|\\.checksum)$/i\n\nexport type PostGenerateStructuralInvalidationResult = {\n cacheEntriesDeleted: number\n generatedFilesTouched: string[]\n cacheError: unknown | null\n generatedFilesError: unknown | null\n}\n\nfunction touchGeneratedFiles(appDir: string): string[] {\n const generatedDir = path.join(appDir, '.mercato', 'generated')\n if (!fs.existsSync(generatedDir) || !fs.statSync(generatedDir).isDirectory()) return []\n\n const touched: string[] = []\n const entries = fs.readdirSync(generatedDir, { withFileTypes: true })\n .sort((left, right) => left.name.localeCompare(right.name))\n for (const entry of entries) {\n if (!entry.isFile() || !TOUCHABLE_GENERATED_FILE_PATTERN.test(entry.name)) continue\n const filePath = path.join(generatedDir, entry.name)\n const contents = fs.readFileSync(filePath)\n fs.writeFileSync(filePath, contents)\n touched.push(filePath)\n }\n return touched\n}\n\nexport async function runPostGenerateStructuralInvalidation(\n appDir: string,\n): Promise<PostGenerateStructuralInvalidationResult> {\n let cacheEntriesDeleted = 0\n let generatedFilesTouched: string[] = []\n let cacheError: unknown | null = null\n let generatedFilesError: unknown | null = null\n\n try {\n generatedFilesTouched = touchGeneratedFiles(appDir)\n } catch (error) {\n generatedFilesError = error\n }\n\n try {\n cacheEntriesDeleted = await purgeConfiguredCachePatternsAcrossTenantScopes(STRUCTURAL_CACHE_PATTERNS)\n } catch (error) {\n cacheError = error\n }\n\n return {\n cacheEntriesDeleted,\n generatedFilesTouched,\n c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 @@ async function runModuleCommand(allModules, moduleName, commandName, args = [],
|
|
|
517
517
|
await resolved.command.run(args);
|
|
518
518
|
return true;
|
|
519
519
|
}
|
|
520
|
-
async function
|
|
520
|
+
async function runPostGenerateStructuralInvalidation(quiet) {
|
|
521
521
|
try {
|
|
522
|
-
const
|
|
523
|
-
import("@open-mercato/shared/lib/bootstrap/dynamicLoader"),
|
|
524
|
-
import("./lib/resolver.js")
|
|
525
|
-
]);
|
|
522
|
+
const { createResolver } = await import("./lib/resolver.js");
|
|
526
523
|
const resolver = createResolver();
|
|
527
524
|
const appDir = resolver.getAppDir();
|
|
528
|
-
const
|
|
529
|
-
|
|
530
|
-
const configsModule = data.modules.find((mod) => mod.id === "configs");
|
|
531
|
-
const hasCacheCommand = configsModule?.cli?.some((command) => command.command === "cache") ?? false;
|
|
532
|
-
if (!hasCacheCommand) {
|
|
525
|
+
const hasConfigsModule = resolver.loadEnabledModules().some((module) => module.id === "configs");
|
|
526
|
+
if (!hasConfigsModule) {
|
|
533
527
|
if (!quiet) {
|
|
534
|
-
console.log('[generate] Skipping structural
|
|
528
|
+
console.log('[generate] Skipping structural invalidation: the "configs" module is not enabled in this app.');
|
|
535
529
|
}
|
|
536
530
|
return;
|
|
537
531
|
}
|
|
532
|
+
const { runPostGenerateStructuralInvalidation: invalidate } = await import("./lib/post-generate-invalidation.js");
|
|
538
533
|
if (!quiet) {
|
|
539
|
-
console.log("[generate]
|
|
534
|
+
console.log("[generate] Invalidating generated structure...");
|
|
540
535
|
}
|
|
541
|
-
|
|
542
|
-
optional: true,
|
|
543
|
-
silentOptional: quiet
|
|
544
|
-
});
|
|
536
|
+
const result = await invalidate(appDir);
|
|
545
537
|
if (!quiet) {
|
|
546
|
-
|
|
538
|
+
if (result.cacheError) {
|
|
539
|
+
console.log(`[generate] Structural cache purge skipped: ${formatCliFailureMessage("configs", "cache", result.cacheError)}`);
|
|
540
|
+
}
|
|
541
|
+
if (result.generatedFilesError) {
|
|
542
|
+
console.log(`[generate] Generated artifact refresh skipped: ${formatCliFailureMessage("generate", "refresh", result.generatedFilesError)}`);
|
|
543
|
+
}
|
|
544
|
+
console.log(
|
|
545
|
+
`[generate] Structural invalidation completed (${result.cacheEntriesDeleted} cache entr${result.cacheEntriesDeleted === 1 ? "y" : "ies"}, ${result.generatedFilesTouched.length} generated artifact${result.generatedFilesTouched.length === 1 ? "" : "s"} refreshed).`
|
|
546
|
+
);
|
|
547
547
|
}
|
|
548
548
|
} catch (error) {
|
|
549
549
|
if (!quiet) {
|
|
550
550
|
const message = formatCliFailureMessage("configs", "cache", error);
|
|
551
|
-
console.log(`[generate] Skipping structural
|
|
551
|
+
console.log(`[generate] Skipping structural invalidation: ${message}`);
|
|
552
552
|
}
|
|
553
553
|
}
|
|
554
554
|
}
|
|
@@ -581,11 +581,11 @@ async function runGeneratorSuiteWithStructuralInvalidation(quiet) {
|
|
|
581
581
|
const generatedFilesChanged = await runGeneratorSuite(quiet);
|
|
582
582
|
if (!generatedFilesChanged) {
|
|
583
583
|
if (!quiet) {
|
|
584
|
-
console.log("[generate] Generated outputs unchanged; skipping structural
|
|
584
|
+
console.log("[generate] Generated outputs unchanged; skipping structural invalidation.");
|
|
585
585
|
}
|
|
586
586
|
return;
|
|
587
587
|
}
|
|
588
|
-
await
|
|
588
|
+
await runPostGenerateStructuralInvalidation(quiet);
|
|
589
589
|
}
|
|
590
590
|
async function createGenerateWatchRuntime() {
|
|
591
591
|
const [
|