@open-mercato/cli 0.6.6-develop.6382.1.4b9b9091ab → 0.6.6-develop.6384.1.f06fc0b42c

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.
@@ -1,4 +1,15 @@
1
1
  [build:cli] found 93 entry points
2
2
  Copied create-app/agentic/ → dist/agentic/
3
3
  Discovered 7 standalone guides → dist/agentic/guides/
4
+ [module-facts] module registry unavailable (registryPath not provided); API route auth omitted for auth
5
+ [module-facts] module registry unavailable (registryPath not provided); API route auth omitted for catalog
6
+ [module-facts] module registry unavailable (registryPath not provided); API route auth omitted for currencies
7
+ [module-facts] module registry unavailable (registryPath not provided); API route auth omitted for customer_accounts
8
+ [module-facts] module registry unavailable (registryPath not provided); API route auth omitted for customers
9
+ [module-facts] module registry unavailable (registryPath not provided); API route auth omitted for data_sync
10
+ [module-facts] module registry unavailable (registryPath not provided); API route auth omitted for integrations
11
+ [module-facts] module registry unavailable (registryPath not provided); API route auth omitted for sales
12
+ [module-facts] module registry unavailable (registryPath not provided); API route auth omitted for workflows
13
+ Generated 9 module fact-sheets → dist/agentic/guides/modules/
14
+ Wrote 9 legacy core.<module>.md redirect stubs → dist/agentic/guides/
4
15
  [build:cli] built successfully
package/build.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { chmodSync, cpSync, existsSync, mkdirSync, readdirSync, readFileSync } from 'node:fs'
1
+ import { chmodSync, cpSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
2
2
  import { dirname, join } from 'node:path'
3
- import { fileURLToPath } from 'node:url'
3
+ import { fileURLToPath, pathToFileURL } from 'node:url'
4
4
  import { atomicWriteFileSync } from '../../scripts/lib/add-js-extension.mjs'
5
5
  import { buildPackage } from '../../scripts/build-package.mjs'
6
6
 
@@ -35,6 +35,18 @@ await buildPackage(packageDir, {
35
35
  const guidesDestDir = join(outdir, 'agentic', 'guides')
36
36
  mkdirSync(guidesDestDir, { recursive: true })
37
37
 
38
+ // Clean stale per-module artifacts before regenerating so an incremental dist never
39
+ // retains a removed module's full guide or fact-sheet — a removed `core.<module>.md`
40
+ // (two-dot, per-module) must come back as a redirect stub, not linger as a full guide.
41
+ // Mirrors packages/create-app/build.mjs; the conceptual `module-system.md` and the
42
+ // single-dot package guides are re-copied/re-discovered below.
43
+ rmSync(join(guidesDestDir, 'modules'), { recursive: true, force: true })
44
+ for (const entry of readdirSync(guidesDestDir)) {
45
+ if (/^core\..+\.md$/.test(entry)) {
46
+ rmSync(join(guidesDestDir, entry))
47
+ }
48
+ }
49
+
38
50
  let guidesFound = 0
39
51
  for (const pkg of readdirSync(packagesDir)) {
40
52
  const guideSource = join(packagesDir, pkg, 'agentic', 'standalone-guide.md')
@@ -58,5 +70,61 @@ await buildPackage(packageDir, {
58
70
  if (guidesFound > 0) {
59
71
  console.log(`Discovered ${guidesFound} standalone guides → dist/agentic/guides/`)
60
72
  }
73
+
74
+ // Generate per-module fact-sheets (Layer 2) from core module sources via the
75
+ // freshly built ts-morph extractor, so `mercato agentic:init` bundles the same
76
+ // guides as a create-mercato-app scaffold (packages/create-app/build.mjs).
77
+ const coreSrcRoot = join(packagesDir, 'core', 'src', 'modules')
78
+ if (existsSync(coreSrcRoot)) {
79
+ const { extractAllModuleFacts, renderModuleFactsJson } = await import(
80
+ pathToFileURL(join(outdir, 'lib', 'generators', 'module-facts.js')).href
81
+ )
82
+ const registryPath = join(packagesDir, '..', 'apps', 'mercato', '.mercato', 'generated', 'modules.runtime.generated.ts')
83
+ let coreVersion = null
84
+ try {
85
+ coreVersion = JSON.parse(readFileSync(join(packagesDir, 'core', 'package.json'), 'utf8')).version ?? null
86
+ } catch {
87
+ coreVersion = null
88
+ }
89
+
90
+ const { factsByModule, markdownByModule, warnings } = extractAllModuleFacts({
91
+ coreSrcRoot,
92
+ registryPath: existsSync(registryPath) ? registryPath : null,
93
+ coreVersion,
94
+ })
95
+
96
+ const modulesGuidesDir = join(guidesDestDir, 'modules')
97
+ mkdirSync(modulesGuidesDir, { recursive: true })
98
+ for (const [moduleId, markdown] of Object.entries(markdownByModule)) {
99
+ writeFileSync(join(modulesGuidesDir, `${moduleId}.md`), markdown)
100
+ }
101
+ writeFileSync(join(guidesDestDir, 'module-facts.json'), renderModuleFactsJson(factsByModule))
102
+
103
+ for (const warning of warnings) console.warn(warning)
104
+ console.log(`Generated ${Object.keys(markdownByModule).length} module fact-sheets → dist/agentic/guides/modules/`)
105
+
106
+ // BC bridge (spec §7 generated-file contract): for any allowlisted module whose
107
+ // legacy full guide `core.<module>.md` is no longer bundled (its standalone-guide.md
108
+ // source was removed), emit a thin redirect stub pointing at the generated fact-sheet.
109
+ // Fresh scaffolds never link these names; they exist only for apps upgrading in place.
110
+ let stubsWritten = 0
111
+ for (const moduleId of Object.keys(markdownByModule)) {
112
+ const legacyGuidePath = join(guidesDestDir, `core.${moduleId}.md`)
113
+ if (!existsSync(legacyGuidePath)) {
114
+ writeFileSync(
115
+ legacyGuidePath,
116
+ `# core.${moduleId} — moved\n\n` +
117
+ `> This guide has moved. See [\`modules/${moduleId}.md\`](modules/${moduleId}.md) for the generated ` +
118
+ `\`${moduleId}\` fact-sheet, and [\`module-system.md\`](module-system.md) for conceptual module guidance.\n`,
119
+ )
120
+ stubsWritten++
121
+ }
122
+ }
123
+ if (stubsWritten > 0) {
124
+ console.log(`Wrote ${stubsWritten} legacy core.<module>.md redirect stubs → dist/agentic/guides/`)
125
+ }
126
+ } else {
127
+ console.warn(`[module-facts] core module sources not found at ${coreSrcRoot}; skipping fact-sheet generation`)
128
+ }
61
129
  },
62
130
  })
@@ -0,0 +1,3 @@
1
+ # core.auth — moved
2
+
3
+ > This guide has moved. See [`modules/auth.md`](modules/auth.md) for the generated `auth` fact-sheet, and [`module-system.md`](module-system.md) for conceptual module guidance.
@@ -0,0 +1,3 @@
1
+ # core.catalog — moved
2
+
3
+ > This guide has moved. See [`modules/catalog.md`](modules/catalog.md) for the generated `catalog` fact-sheet, and [`module-system.md`](module-system.md) for conceptual module guidance.
@@ -0,0 +1,3 @@
1
+ # core.currencies — moved
2
+
3
+ > This guide has moved. See [`modules/currencies.md`](modules/currencies.md) for the generated `currencies` fact-sheet, and [`module-system.md`](module-system.md) for conceptual module guidance.
@@ -0,0 +1,3 @@
1
+ # core.customer_accounts — moved
2
+
3
+ > This guide has moved. See [`modules/customer_accounts.md`](modules/customer_accounts.md) for the generated `customer_accounts` fact-sheet, and [`module-system.md`](module-system.md) for conceptual module guidance.
@@ -0,0 +1,3 @@
1
+ # core.customers — moved
2
+
3
+ > This guide has moved. See [`modules/customers.md`](modules/customers.md) for the generated `customers` fact-sheet, and [`module-system.md`](module-system.md) for conceptual module guidance.
@@ -0,0 +1,3 @@
1
+ # core.data_sync — moved
2
+
3
+ > This guide has moved. See [`modules/data_sync.md`](modules/data_sync.md) for the generated `data_sync` fact-sheet, and [`module-system.md`](module-system.md) for conceptual module guidance.
@@ -0,0 +1,3 @@
1
+ # core.integrations — moved
2
+
3
+ > This guide has moved. See [`modules/integrations.md`](modules/integrations.md) for the generated `integrations` fact-sheet, and [`module-system.md`](module-system.md) for conceptual module guidance.
@@ -0,0 +1,3 @@
1
+ # core.sales — moved
2
+
3
+ > This guide has moved. See [`modules/sales.md`](modules/sales.md) for the generated `sales` fact-sheet, and [`module-system.md`](module-system.md) for conceptual module guidance.
@@ -0,0 +1,3 @@
1
+ # core.workflows — moved
2
+
3
+ > This guide has moved. See [`modules/workflows.md`](modules/workflows.md) for the generated `workflows` fact-sheet, and [`module-system.md`](module-system.md) for conceptual module guidance.