@open-mercato/cli 0.11.1-develop.8587.1.5952ba9ee6 → 0.11.1-develop.8593.1.50784dae35
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 +1 -0
- package/dist/agentic/guides/module-facts.json +164 -164
- package/dist/agentic/guides/module-facts.v2.json +164 -164
- package/dist/agentic/guides/modules/agent_orchestrator/index.md +1 -1
- package/dist/agentic/guides/modules/ai_assistant/index.md +1 -1
- package/dist/agentic/guides/modules/api_docs/index.md +1 -1
- package/dist/agentic/guides/modules/api_keys/index.md +1 -1
- package/dist/agentic/guides/modules/attachments/index.md +1 -1
- package/dist/agentic/guides/modules/audit_logs/index.md +1 -1
- package/dist/agentic/guides/modules/auth/index.md +1 -1
- package/dist/agentic/guides/modules/availability/index.md +1 -1
- package/dist/agentic/guides/modules/backups/index.md +1 -1
- package/dist/agentic/guides/modules/business_rules/index.md +1 -1
- package/dist/agentic/guides/modules/carrier_inpost/index.md +1 -1
- package/dist/agentic/guides/modules/cart/index.md +1 -1
- package/dist/agentic/guides/modules/catalog/index.md +1 -1
- package/dist/agentic/guides/modules/channel_apns/index.md +1 -1
- package/dist/agentic/guides/modules/channel_discord/index.md +1 -1
- package/dist/agentic/guides/modules/channel_expo/index.md +1 -1
- package/dist/agentic/guides/modules/channel_fcm/index.md +1 -1
- package/dist/agentic/guides/modules/channel_gmail/index.md +1 -1
- package/dist/agentic/guides/modules/channel_imap/index.md +1 -1
- package/dist/agentic/guides/modules/channel_resend/index.md +1 -1
- package/dist/agentic/guides/modules/channel_ses/index.md +1 -1
- package/dist/agentic/guides/modules/channel_smtp/index.md +1 -1
- package/dist/agentic/guides/modules/checkout/index.md +1 -1
- package/dist/agentic/guides/modules/communication_channels/index.md +1 -1
- package/dist/agentic/guides/modules/configs/index.md +1 -1
- package/dist/agentic/guides/modules/content/index.md +1 -1
- package/dist/agentic/guides/modules/currencies/index.md +1 -1
- package/dist/agentic/guides/modules/customer_accounts/index.md +1 -1
- package/dist/agentic/guides/modules/customer_groups/index.md +1 -1
- package/dist/agentic/guides/modules/customers/index.md +1 -1
- package/dist/agentic/guides/modules/dashboards/index.md +1 -1
- package/dist/agentic/guides/modules/data_sync/index.md +1 -1
- package/dist/agentic/guides/modules/design_system/index.md +1 -1
- package/dist/agentic/guides/modules/devices/index.md +1 -1
- package/dist/agentic/guides/modules/dictionaries/index.md +1 -1
- package/dist/agentic/guides/modules/directory/index.md +1 -1
- package/dist/agentic/guides/modules/documents/index.md +1 -1
- package/dist/agentic/guides/modules/ecommerce/index.md +1 -1
- package/dist/agentic/guides/modules/entities/index.md +1 -1
- package/dist/agentic/guides/modules/eudr/index.md +1 -1
- package/dist/agentic/guides/modules/events/index.md +1 -1
- package/dist/agentic/guides/modules/feature_toggles/index.md +1 -1
- package/dist/agentic/guides/modules/forms/index.md +1 -1
- package/dist/agentic/guides/modules/gateway_autopay/index.md +1 -1
- package/dist/agentic/guides/modules/gateway_stripe/index.md +1 -1
- package/dist/agentic/guides/modules/gateway_tpay/index.md +1 -1
- package/dist/agentic/guides/modules/generators/index.md +1 -1
- package/dist/agentic/guides/modules/inbox_ops/index.md +1 -1
- package/dist/agentic/guides/modules/integrations/index.md +1 -1
- package/dist/agentic/guides/modules/messages/index.md +1 -1
- package/dist/agentic/guides/modules/notifications/index.md +1 -1
- package/dist/agentic/guides/modules/onboarding/index.md +1 -1
- package/dist/agentic/guides/modules/payment_gateways/index.md +1 -1
- package/dist/agentic/guides/modules/perspectives/index.md +1 -1
- package/dist/agentic/guides/modules/phone_calls/index.md +1 -1
- package/dist/agentic/guides/modules/planner/index.md +1 -1
- package/dist/agentic/guides/modules/portal/index.md +1 -1
- package/dist/agentic/guides/modules/progress/index.md +1 -1
- package/dist/agentic/guides/modules/promotions/index.md +1 -1
- package/dist/agentic/guides/modules/push_notifications/index.md +1 -1
- package/dist/agentic/guides/modules/query_index/index.md +1 -1
- package/dist/agentic/guides/modules/record_locks/index.md +1 -1
- package/dist/agentic/guides/modules/resources/index.md +1 -1
- package/dist/agentic/guides/modules/sales/index.md +1 -1
- package/dist/agentic/guides/modules/scheduler/index.md +1 -1
- package/dist/agentic/guides/modules/search/index.md +1 -1
- package/dist/agentic/guides/modules/security/index.md +1 -1
- package/dist/agentic/guides/modules/seeds/index.md +1 -1
- package/dist/agentic/guides/modules/shipping_carriers/index.md +1 -1
- package/dist/agentic/guides/modules/sso/index.md +1 -1
- package/dist/agentic/guides/modules/staff/index.md +1 -1
- package/dist/agentic/guides/modules/storage_s3/index.md +1 -1
- package/dist/agentic/guides/modules/sync_akeneo/index.md +1 -1
- package/dist/agentic/guides/modules/sync_excel/index.md +1 -1
- package/dist/agentic/guides/modules/system_status_overlays/index.md +1 -1
- package/dist/agentic/guides/modules/telemetry/index.md +1 -1
- package/dist/agentic/guides/modules/tillio/index.md +1 -1
- package/dist/agentic/guides/modules/translations/index.md +1 -1
- package/dist/agentic/guides/modules/warranty_claims/index.md +1 -1
- package/dist/agentic/guides/modules/webhooks/index.md +1 -1
- package/dist/agentic/guides/modules/wms/index.md +1 -1
- package/dist/agentic/guides/modules/workflows/index.md +1 -1
- package/dist/agentic/guides/reference-module-facts.json +1 -1
- package/dist/agentic/guides/upstream/manifest.json +1 -1
- package/dist/lib/generate-child-process.js +21 -3
- package/dist/lib/generate-child-process.js.map +2 -2
- package/dist/lib/generate-watch-events.js +135 -19
- package/dist/lib/generate-watch-events.js.map +2 -2
- package/dist/lib/generate-watch-plan.js +166 -0
- package/dist/lib/generate-watch-plan.js.map +7 -0
- package/dist/lib/generate-watch-runner.js +53 -0
- package/dist/lib/generate-watch-runner.js.map +7 -0
- package/dist/lib/generate-watch-structure.js +576 -203
- package/dist/lib/generate-watch-structure.js.map +3 -3
- package/dist/lib/generators/extensions/agent-files.js +1 -0
- package/dist/lib/generators/extensions/agent-files.js.map +2 -2
- package/dist/lib/generators/module-registry.js +148 -191
- package/dist/lib/generators/module-registry.js.map +3 -3
- package/dist/lib/generators/openapi.js +24 -1
- package/dist/lib/generators/openapi.js.map +2 -2
- package/dist/lib/generators/web-research-adapters.js +54 -22
- package/dist/lib/generators/web-research-adapters.js.map +2 -2
- package/dist/lib/in-process-generate-watcher.js +98 -75
- package/dist/lib/in-process-generate-watcher.js.map +2 -2
- package/dist/mercato.js +74 -46
- package/dist/mercato.js.map +2 -2
- package/package.json +7 -7
- package/src/lib/__tests__/generate-child-process.test.ts +30 -0
- package/src/lib/__tests__/generate-watch-events.test.ts +377 -8
- package/src/lib/__tests__/generate-watch-plan.test.ts +98 -0
- package/src/lib/__tests__/generate-watch-runner.test.ts +126 -0
- package/src/lib/__tests__/generate-watch-structure.test.ts +522 -1
- package/src/lib/__tests__/in-process-generate-watcher.test.ts +393 -6
- package/src/lib/__tests__/module-inspection.test.ts +17 -11
- package/src/lib/generate-child-process.ts +26 -3
- package/src/lib/generate-watch-events.ts +189 -17
- package/src/lib/generate-watch-plan.ts +177 -0
- package/src/lib/generate-watch-runner.ts +62 -0
- package/src/lib/generate-watch-structure.ts +666 -227
- package/src/lib/generators/__tests__/incremental-registry.test.ts +262 -0
- package/src/lib/generators/__tests__/openapi.test.ts +91 -1
- package/src/lib/generators/__tests__/web-research-adapters.test.ts +298 -87
- package/src/lib/generators/extension.ts +2 -0
- package/src/lib/generators/extensions/agent-files.ts +1 -0
- package/src/lib/generators/module-registry.ts +168 -200
- package/src/lib/generators/openapi.ts +34 -0
- package/src/lib/generators/web-research-adapters.ts +76 -21
- package/src/lib/in-process-generate-watcher.ts +151 -96
- package/src/mercato.ts +85 -53
package/src/mercato.ts
CHANGED
|
@@ -36,7 +36,9 @@ import {
|
|
|
36
36
|
startInProcessGenerateWatcher,
|
|
37
37
|
type GenerateWatcherHandle,
|
|
38
38
|
} from './lib/in-process-generate-watcher'
|
|
39
|
-
import {
|
|
39
|
+
import type { GenerateWatchPlan, GenerateWatchSnapshot } from './lib/generate-watch-plan'
|
|
40
|
+
import type { GenerateWatchModuleTarget } from './lib/generate-watch-events'
|
|
41
|
+
import { readGenerateWatchRequest, runGenerateChildProcess } from './lib/generate-child-process'
|
|
40
42
|
import {
|
|
41
43
|
resolveGenerateWatcherMode,
|
|
42
44
|
type GenerateWatcherMode,
|
|
@@ -846,33 +848,15 @@ async function runPostGenerateStructuralInvalidation(quiet: boolean): Promise<vo
|
|
|
846
848
|
}
|
|
847
849
|
}
|
|
848
850
|
|
|
849
|
-
/** Full one-shot suite; long-lived watchers invoke this in a disposable CLI process. */
|
|
850
|
-
async function runGeneratorSuite(quiet: boolean): Promise<boolean> {
|
|
851
|
-
const { createResolver } = await import('./lib/resolver')
|
|
852
|
-
const {
|
|
853
|
-
generateEntityIds,
|
|
854
|
-
generateModuleRegistries,
|
|
855
|
-
generateModuleEntities,
|
|
856
|
-
generateModuleDi,
|
|
857
|
-
generateModulePackageSources,
|
|
858
|
-
generateOpenApi,
|
|
859
|
-
generateWebResearchAdapters,
|
|
860
|
-
} = await import('./lib/generators')
|
|
861
|
-
const resolver = createResolver()
|
|
862
|
-
const results = [
|
|
863
|
-
await generateEntityIds({ resolver, quiet }),
|
|
864
|
-
...(await generateModuleRegistries({ resolver, quiet })),
|
|
865
|
-
await generateModuleEntities({ resolver, quiet }),
|
|
866
|
-
await generateModuleDi({ resolver, quiet }),
|
|
867
|
-
await generateModulePackageSources({ resolver, quiet }),
|
|
868
|
-
await generateWebResearchAdapters({ resolver, quiet }),
|
|
869
|
-
await generateOpenApi({ resolver, quiet }),
|
|
870
|
-
]
|
|
871
|
-
return results.some((result) => (result?.filesWritten.length ?? 0) > 0)
|
|
872
|
-
}
|
|
873
851
|
|
|
874
|
-
async function runGeneratorSuiteWithStructuralInvalidation(
|
|
875
|
-
|
|
852
|
+
async function runGeneratorSuiteWithStructuralInvalidation(
|
|
853
|
+
quiet: boolean,
|
|
854
|
+
plan?: GenerateWatchPlan,
|
|
855
|
+
onOpenApiCascade?: (reason: string) => void,
|
|
856
|
+
): Promise<void> {
|
|
857
|
+
// Keep the generator/compiler graph out of ordinary CLI and server bootstrap.
|
|
858
|
+
const { runGenerateWatchSuite } = await import('./lib/generate-watch-runner')
|
|
859
|
+
const generatedFilesChanged = await runGenerateWatchSuite(quiet, plan, undefined, onOpenApiCascade)
|
|
876
860
|
if (!generatedFilesChanged) {
|
|
877
861
|
if (!quiet) {
|
|
878
862
|
console.log('[generate] Generated outputs unchanged; skipping structural invalidation.')
|
|
@@ -882,7 +866,7 @@ async function runGeneratorSuiteWithStructuralInvalidation(quiet: boolean): Prom
|
|
|
882
866
|
await runPostGenerateStructuralInvalidation(quiet)
|
|
883
867
|
}
|
|
884
868
|
|
|
885
|
-
async function runWatchGeneratorSuite(): Promise<void> {
|
|
869
|
+
async function runWatchGeneratorSuite(plan: GenerateWatchPlan | undefined, logCascade: boolean): Promise<void> {
|
|
886
870
|
// Keep resolver setup behind command dispatch; other CLI modes do not need it.
|
|
887
871
|
const { resolveEnvironment } = await import('./lib/resolver')
|
|
888
872
|
const { rootDir, appDir } = resolveEnvironment()
|
|
@@ -890,64 +874,104 @@ async function runWatchGeneratorSuite(): Promise<void> {
|
|
|
890
874
|
mercatoBin: resolveInstalledBinary([rootDir, appDir], '@open-mercato/cli/bin/mercato'),
|
|
891
875
|
cwd: process.cwd(),
|
|
892
876
|
quiet: true,
|
|
877
|
+
watchRequest: { plan, logCascade },
|
|
893
878
|
})
|
|
894
879
|
}
|
|
895
880
|
|
|
896
|
-
/**
|
|
897
|
-
* Builds the event-gated structural fingerprint runtime used by generate
|
|
898
|
-
* watchers. Filesystem events mark the tree dirty; the existing full content
|
|
899
|
-
* checksum remains the final authority and the fallback when watching fails.
|
|
900
|
-
*/
|
|
881
|
+
/** Shared snapshot and event runtime for standalone and embedded watchers. */
|
|
901
882
|
async function createGenerateWatchRuntime(quiet = false) {
|
|
883
|
+
// Compiler-backed discovery is only needed by the generation watcher.
|
|
902
884
|
const [
|
|
903
885
|
{ createResolver },
|
|
904
|
-
{
|
|
886
|
+
{
|
|
887
|
+
collectGenerateWatchStructureSnapshot,
|
|
888
|
+
createGenerateWatchStructureCache,
|
|
889
|
+
diffGenerateWatchStructureSnapshots,
|
|
890
|
+
},
|
|
891
|
+
{ planGenerateWatchChanges },
|
|
905
892
|
{ createGenerateWatchChangeSignal, resolveGenerateWatchTargets },
|
|
906
893
|
{ resolveStandaloneSourceMirrorBase },
|
|
894
|
+
{ getOpenApiWatchInputs },
|
|
895
|
+
{ getWebResearchAdapterWatchInputs },
|
|
907
896
|
] = await Promise.all([
|
|
908
897
|
import('./lib/resolver'),
|
|
909
898
|
import('./lib/generate-watch-structure'),
|
|
899
|
+
import('./lib/generate-watch-plan'),
|
|
910
900
|
import('./lib/generate-watch-events'),
|
|
911
901
|
import('./lib/generators/scanner'),
|
|
902
|
+
import('./lib/generators/openapi'),
|
|
903
|
+
import('./lib/generators/web-research-adapters'),
|
|
912
904
|
])
|
|
913
905
|
|
|
906
|
+
let latestSnapshot: GenerateWatchSnapshot | undefined
|
|
907
|
+
const structureCache = createGenerateWatchStructureCache()
|
|
908
|
+
|
|
914
909
|
const collectWatchState = () => {
|
|
915
910
|
const resolver = createResolver()
|
|
916
|
-
const moduleRoots: Array<{
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
911
|
+
const moduleRoots: Array<GenerateWatchModuleTarget & { moduleId: string; from?: string }> = []
|
|
912
|
+
const additionalInputs = new Set<string>()
|
|
913
|
+
const outputDirectories = new Set<string>([resolver.getOutputDir()])
|
|
914
|
+
for (const directory of [resolver.getRootDir(), resolver.getAppDir()]) {
|
|
915
|
+
for (const fileName of ['package.json', 'tsconfig.json', 'tsconfig.base.json', 'yarn.lock', 'package-lock.json', 'pnpm-lock.yaml']) {
|
|
916
|
+
additionalInputs.add(path.join(directory, fileName))
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
const adapterInputs = getWebResearchAdapterWatchInputs(resolver)
|
|
920
|
+
const openapiInputs = getOpenApiWatchInputs(resolver)
|
|
921
921
|
const watchAppPackageFallbacks = resolver.isMonorepo()
|
|
922
922
|
for (const entry of resolver.loadEnabledModules()) {
|
|
923
|
+
if (watchAppPackageFallbacks) {
|
|
924
|
+
outputDirectories.add(resolver.getPackageOutputDir(entry.from ?? '@open-mercato/core'))
|
|
925
|
+
}
|
|
923
926
|
const roots = resolver.getModulePaths(entry)
|
|
927
|
+
const watchPackageBase = entry.from !== '@app' || watchAppPackageFallbacks
|
|
928
|
+
// Monorepo modules generate from source; their compiled dist trees are build output.
|
|
929
|
+
const compiledBase = watchAppPackageFallbacks && !roots.pkgBase.includes(`${path.sep}dist${path.sep}`) ? [] : ['dist']
|
|
930
|
+
const additionalModuleBases = watchPackageBase
|
|
931
|
+
? ['src', ...compiledBase].map((folder) => path.join(resolver.getPackageRoot(entry.from), folder, 'modules', entry.id))
|
|
932
|
+
: []
|
|
924
933
|
moduleRoots.push({
|
|
925
934
|
...roots,
|
|
926
|
-
|
|
935
|
+
moduleId: entry.id,
|
|
936
|
+
from: entry.from,
|
|
937
|
+
watchPackageBase,
|
|
938
|
+
additionalModuleBases,
|
|
927
939
|
})
|
|
928
940
|
}
|
|
929
941
|
return {
|
|
930
942
|
modulesFile: resolver.getModulesConfigPath(),
|
|
931
943
|
moduleRoots,
|
|
944
|
+
additionalInputs: [...additionalInputs],
|
|
945
|
+
openapiInputs,
|
|
946
|
+
webResearchAdapterInputs: adapterInputs.manifestPaths,
|
|
947
|
+
webResearchAdapterFullReasons: adapterInputs.fullReasons,
|
|
948
|
+
shallowDirectories: adapterInputs.directoryPaths,
|
|
949
|
+
appSourceDir: path.join(resolver.getAppDir(), 'src'),
|
|
950
|
+
outputDir: resolver.getOutputDir(),
|
|
951
|
+
outputDirectories: [...outputDirectories].sort((left, right) => left.localeCompare(right)),
|
|
932
952
|
}
|
|
933
953
|
}
|
|
934
954
|
|
|
935
955
|
return {
|
|
936
|
-
computeStructureChecksum:
|
|
937
|
-
|
|
956
|
+
computeStructureChecksum: () =>
|
|
957
|
+
collectGenerateWatchStructureSnapshot(collectWatchState(), structureCache).checksum,
|
|
958
|
+
incremental: {
|
|
959
|
+
capture: () => {
|
|
960
|
+
latestSnapshot = collectGenerateWatchStructureSnapshot(collectWatchState(), structureCache)
|
|
961
|
+
return latestSnapshot
|
|
962
|
+
},
|
|
963
|
+
plan: (previous: GenerateWatchSnapshot, next: GenerateWatchSnapshot) =>
|
|
964
|
+
planGenerateWatchChanges(diffGenerateWatchStructureSnapshots(previous, next), next.fullReasons),
|
|
938
965
|
},
|
|
939
966
|
changeSignal: createGenerateWatchChangeSignal({
|
|
940
967
|
onSkippedDirectory: quiet
|
|
941
968
|
? undefined
|
|
942
969
|
: (directory) => console.log(`[generate:watch] Skipping missing watch directory: ${directory}`),
|
|
943
|
-
getWatchTargets: () => {
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
resolveSourceMirrorBase: resolveStandaloneSourceMirrorBase,
|
|
949
|
-
})
|
|
950
|
-
},
|
|
970
|
+
getWatchTargets: () => resolveGenerateWatchTargets({
|
|
971
|
+
...collectWatchState(),
|
|
972
|
+
snapshot: latestSnapshot,
|
|
973
|
+
resolveSourceMirrorBase: resolveStandaloneSourceMirrorBase,
|
|
974
|
+
}),
|
|
951
975
|
}),
|
|
952
976
|
}
|
|
953
977
|
}
|
|
@@ -2062,7 +2086,11 @@ export async function run(argv = process.argv) {
|
|
|
2062
2086
|
const quiet = args.includes('--quiet') || args.includes('-q')
|
|
2063
2087
|
|
|
2064
2088
|
if (!quiet) console.log('Running all generators...')
|
|
2065
|
-
|
|
2089
|
+
const watchRequest = readGenerateWatchRequest()
|
|
2090
|
+
await runGeneratorSuiteWithStructuralInvalidation(quiet, watchRequest?.plan,
|
|
2091
|
+
watchRequest?.logCascade
|
|
2092
|
+
? (reason) => console.log(`[generate:watch] Cascading; groups=openapi; reason=${reason}`)
|
|
2093
|
+
: undefined)
|
|
2066
2094
|
if (!quiet) console.log('All generators completed.')
|
|
2067
2095
|
},
|
|
2068
2096
|
},
|
|
@@ -2081,7 +2109,9 @@ export async function run(argv = process.argv) {
|
|
|
2081
2109
|
skipInitial,
|
|
2082
2110
|
quiet,
|
|
2083
2111
|
...generateWatchRuntime,
|
|
2084
|
-
runGenerators:
|
|
2112
|
+
runGenerators: async (_reason, plan) => {
|
|
2113
|
+
await runWatchGeneratorSuite(plan, !quiet)
|
|
2114
|
+
},
|
|
2085
2115
|
})
|
|
2086
2116
|
|
|
2087
2117
|
const shutdownSignals: NodeJS.Signals[] = ['SIGINT', 'SIGTERM']
|
|
@@ -2564,7 +2594,9 @@ export async function run(argv = process.argv) {
|
|
|
2564
2594
|
skipInitial: true,
|
|
2565
2595
|
quiet: false,
|
|
2566
2596
|
...generateWatchRuntime,
|
|
2567
|
-
runGenerators:
|
|
2597
|
+
runGenerators: async (_reason, plan) => {
|
|
2598
|
+
await runWatchGeneratorSuite(plan, true)
|
|
2599
|
+
},
|
|
2568
2600
|
})
|
|
2569
2601
|
} else {
|
|
2570
2602
|
console.log('[server] Legacy out-of-process generate watcher selected via OM_DEV_GENERATE_WATCH_MODE=legacy — expect the dev orchestrator to spawn `mercato generate watch --skip-initial`.')
|