@mapomodule/mcp 0.0.0-stage → 1.0.0-beta.2
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/README.md +509 -2
- package/bin/mapo-mcp.mjs +3 -0
- package/dist/build.d.mts +18 -0
- package/dist/build.d.ts +18 -0
- package/dist/build.mjs +351 -0
- package/dist/cli.d.mts +7 -0
- package/dist/cli.d.ts +7 -0
- package/dist/cli.mjs +274 -0
- package/dist/index.d.mts +68 -0
- package/dist/index.d.ts +68 -0
- package/dist/index.mjs +1 -0
- package/dist/knowledge/api.json +1 -0
- package/dist/knowledge/docs.json +1 -0
- package/dist/module.d.mts +16 -0
- package/dist/module.d.ts +16 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +124 -0
- package/dist/runtime/core/doctor.d.ts +0 -0
- package/dist/runtime/core/doctor.js +128 -0
- package/dist/runtime/core/endpoint.d.ts +0 -0
- package/dist/runtime/core/endpoint.js +8 -0
- package/dist/runtime/core/indexer.d.ts +0 -0
- package/dist/runtime/core/indexer.js +194 -0
- package/dist/runtime/core/instructions.d.ts +0 -0
- package/dist/runtime/core/instructions.js +10 -0
- package/dist/runtime/core/knowledge.d.ts +0 -0
- package/dist/runtime/core/knowledge.js +76 -0
- package/dist/runtime/core/openapi.d.ts +0 -0
- package/dist/runtime/core/openapi.js +229 -0
- package/dist/runtime/core/overview.d.ts +0 -0
- package/dist/runtime/core/overview.js +15 -0
- package/dist/runtime/core/prompts.d.ts +0 -0
- package/dist/runtime/core/prompts.js +108 -0
- package/dist/runtime/core/recipes.d.ts +0 -0
- package/dist/runtime/core/recipes.js +496 -0
- package/dist/runtime/core/resources.d.ts +0 -0
- package/dist/runtime/core/resources.js +92 -0
- package/dist/runtime/core/scaffold/fields.d.ts +0 -0
- package/dist/runtime/core/scaffold/fields.js +64 -0
- package/dist/runtime/core/scaffold/index.d.ts +0 -0
- package/dist/runtime/core/scaffold/index.js +74 -0
- package/dist/runtime/core/scaffold/templates.d.ts +0 -0
- package/dist/runtime/core/scaffold/templates.js +349 -0
- package/dist/runtime/core/schema-source.d.ts +0 -0
- package/dist/runtime/core/schema-source.js +70 -0
- package/dist/runtime/core/search.d.ts +0 -0
- package/dist/runtime/core/search.js +173 -0
- package/dist/runtime/core/tokenize.d.ts +0 -0
- package/dist/runtime/core/tokenize.js +96 -0
- package/dist/runtime/core/tool-spec.d.ts +0 -0
- package/dist/runtime/core/tool-spec.js +3 -0
- package/dist/runtime/core/tools/api.d.ts +0 -0
- package/dist/runtime/core/tools/api.js +192 -0
- package/dist/runtime/core/tools/app.d.ts +0 -0
- package/dist/runtime/core/tools/app.js +141 -0
- package/dist/runtime/core/tools/backend.d.ts +0 -0
- package/dist/runtime/core/tools/backend.js +143 -0
- package/dist/runtime/core/tools/docs.d.ts +0 -0
- package/dist/runtime/core/tools/docs.js +154 -0
- package/dist/runtime/core/tools/scaffold.d.ts +0 -0
- package/dist/runtime/core/tools/scaffold.js +127 -0
- package/dist/runtime/core/types.d.ts +0 -0
- package/dist/runtime/core/types.js +0 -0
- package/dist/runtime/core/write.d.ts +0 -0
- package/dist/runtime/core/write.js +53 -0
- package/dist/runtime/mcp/handlers/mapo/index.js +7 -0
- package/dist/runtime/mcp/handlers/mapo/prompts/crud-page.js +3 -0
- package/dist/runtime/mcp/handlers/mapo/prompts/custom-field.js +3 -0
- package/dist/runtime/mcp/handlers/mapo/prompts/debug-form.js +3 -0
- package/dist/runtime/mcp/handlers/mapo/prompts/migrate-v1.js +3 -0
- package/dist/runtime/mcp/handlers/mapo/prompts/theme.js +3 -0
- package/dist/runtime/mcp/handlers/mapo/resources/app-manifest.js +19 -0
- package/dist/runtime/mcp/handlers/mapo/resources/docs.js +34 -0
- package/dist/runtime/mcp/handlers/mapo/resources/fields.js +34 -0
- package/dist/runtime/mcp/handlers/mapo/resources/knowledge-index.js +22 -0
- package/dist/runtime/mcp/handlers/mapo/resources/overview.js +20 -0
- package/dist/runtime/mcp/handlers/mapo/tools/backend-schema.js +3 -0
- package/dist/runtime/mcp/handlers/mapo/tools/component-api.js +3 -0
- package/dist/runtime/mcp/handlers/mapo/tools/composable-api.js +3 -0
- package/dist/runtime/mcp/handlers/mapo/tools/doctor.js +3 -0
- package/dist/runtime/mcp/handlers/mapo/tools/get-doc.js +3 -0
- package/dist/runtime/mcp/handlers/mapo/tools/inspect-app.js +3 -0
- package/dist/runtime/mcp/handlers/mapo/tools/list-field-types.js +3 -0
- package/dist/runtime/mcp/handlers/mapo/tools/list-recipes.js +3 -0
- package/dist/runtime/mcp/handlers/mapo/tools/scaffold.js +3 -0
- package/dist/runtime/mcp/handlers/mapo/tools/search-docs.js +3 -0
- package/dist/runtime/nitro/context.d.ts +0 -0
- package/dist/runtime/nitro/context.js +21 -0
- package/dist/runtime/nitro/to-mcp-prompt.d.ts +0 -0
- package/dist/runtime/nitro/to-mcp-prompt.js +23 -0
- package/dist/runtime/nitro/to-mcp-tool.d.ts +0 -0
- package/dist/runtime/nitro/to-mcp-tool.js +28 -0
- package/dist/runtime/types/virtual-modules.d.ts +6 -0
- package/dist/types.d.mts +9 -0
- package/package.json +73 -4
- package/src/__tests__/cli.test.ts +137 -0
- package/src/__tests__/doctor.test.ts +145 -0
- package/src/__tests__/endpoint.test.ts +31 -0
- package/src/__tests__/fixtures/drf-schema.json +142 -0
- package/src/__tests__/fixtures.ts +198 -0
- package/src/__tests__/indexer.test.ts +114 -0
- package/src/__tests__/knowledge.test.ts +225 -0
- package/src/__tests__/openapi.test.ts +256 -0
- package/src/__tests__/overview.test.ts +105 -0
- package/src/__tests__/recipes.test.ts +55 -0
- package/src/__tests__/resources.test.ts +69 -0
- package/src/__tests__/scaffold.test.ts +153 -0
- package/src/__tests__/search.test.ts +105 -0
- package/src/__tests__/tools.test.ts +226 -0
- package/src/__tests__/write.test.ts +134 -0
- package/src/build/extract-components.ts +135 -0
- package/src/build/extract-composables.ts +125 -0
- package/src/build/extract-fields.ts +250 -0
- package/src/build/index.ts +103 -0
- package/src/cli.ts +375 -0
- package/src/index.ts +65 -0
- package/src/module.ts +213 -0
- package/src/runtime/core/doctor.ts +204 -0
- package/src/runtime/core/endpoint.ts +27 -0
- package/src/runtime/core/indexer.ts +285 -0
- package/src/runtime/core/instructions.ts +18 -0
- package/src/runtime/core/knowledge.ts +121 -0
- package/src/runtime/core/openapi.ts +417 -0
- package/src/runtime/core/overview.ts +44 -0
- package/src/runtime/core/prompts.ts +150 -0
- package/src/runtime/core/recipes.ts +574 -0
- package/src/runtime/core/resources.ts +150 -0
- package/src/runtime/core/scaffold/fields.ts +127 -0
- package/src/runtime/core/scaffold/index.ts +120 -0
- package/src/runtime/core/scaffold/templates.ts +394 -0
- package/src/runtime/core/schema-source.ts +123 -0
- package/src/runtime/core/search.ts +282 -0
- package/src/runtime/core/tokenize.ts +146 -0
- package/src/runtime/core/tool-spec.ts +74 -0
- package/src/runtime/core/tools/api.ts +300 -0
- package/src/runtime/core/tools/app.ts +201 -0
- package/src/runtime/core/tools/backend.ts +197 -0
- package/src/runtime/core/tools/docs.ts +218 -0
- package/src/runtime/core/tools/scaffold.ts +176 -0
- package/src/runtime/core/types.ts +133 -0
- package/src/runtime/core/write.ts +119 -0
- package/src/runtime/mcp/handlers/mapo/index.ts +16 -0
- package/src/runtime/mcp/handlers/mapo/prompts/crud-page.ts +4 -0
- package/src/runtime/mcp/handlers/mapo/prompts/custom-field.ts +4 -0
- package/src/runtime/mcp/handlers/mapo/prompts/debug-form.ts +4 -0
- package/src/runtime/mcp/handlers/mapo/prompts/migrate-v1.ts +4 -0
- package/src/runtime/mcp/handlers/mapo/prompts/theme.ts +4 -0
- package/src/runtime/mcp/handlers/mapo/resources/app-manifest.ts +28 -0
- package/src/runtime/mcp/handlers/mapo/resources/docs.ts +41 -0
- package/src/runtime/mcp/handlers/mapo/resources/fields.ts +37 -0
- package/src/runtime/mcp/handlers/mapo/resources/knowledge-index.ts +24 -0
- package/src/runtime/mcp/handlers/mapo/resources/overview.ts +22 -0
- package/src/runtime/mcp/handlers/mapo/tools/backend-schema.ts +4 -0
- package/src/runtime/mcp/handlers/mapo/tools/component-api.ts +4 -0
- package/src/runtime/mcp/handlers/mapo/tools/composable-api.ts +4 -0
- package/src/runtime/mcp/handlers/mapo/tools/doctor.ts +4 -0
- package/src/runtime/mcp/handlers/mapo/tools/get-doc.ts +4 -0
- package/src/runtime/mcp/handlers/mapo/tools/inspect-app.ts +4 -0
- package/src/runtime/mcp/handlers/mapo/tools/list-field-types.ts +4 -0
- package/src/runtime/mcp/handlers/mapo/tools/list-recipes.ts +4 -0
- package/src/runtime/mcp/handlers/mapo/tools/scaffold.ts +4 -0
- package/src/runtime/mcp/handlers/mapo/tools/search-docs.ts +4 -0
- package/src/runtime/nitro/context.ts +41 -0
- package/src/runtime/nitro/to-mcp-prompt.ts +30 -0
- package/src/runtime/nitro/to-mcp-tool.ts +35 -0
- package/src/runtime/types/virtual-modules.d.ts +6 -0
|
@@ -0,0 +1,574 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Curated task → documentation map.
|
|
3
|
+
*
|
|
4
|
+
* BM25 answers "which section mentions these words"; it cannot answer "which
|
|
5
|
+
* page is the canonical recipe for this task" — API reference tables often win
|
|
6
|
+
* on raw term frequency. This table encodes that intent, and is the file to
|
|
7
|
+
* update when a new feature ships.
|
|
8
|
+
*/
|
|
9
|
+
import { tokenize } from "./tokenize.js";
|
|
10
|
+
|
|
11
|
+
export interface Recipe {
|
|
12
|
+
id: string;
|
|
13
|
+
/** Task phrased the way a developer would ask for it. */
|
|
14
|
+
task: string;
|
|
15
|
+
/** Extra vocabulary that should match this recipe. */
|
|
16
|
+
keywords: string[];
|
|
17
|
+
/** Canonical doc path, relative to the docs root. */
|
|
18
|
+
doc: string;
|
|
19
|
+
/** Optional section inside `doc`. */
|
|
20
|
+
heading?: string;
|
|
21
|
+
/** Related docs worth reading next. */
|
|
22
|
+
seeAlso?: string[];
|
|
23
|
+
summary: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const RECIPES: Recipe[] = [
|
|
27
|
+
{
|
|
28
|
+
id: "concepts",
|
|
29
|
+
task: "Understand how Mapo fits together",
|
|
30
|
+
keywords: [
|
|
31
|
+
"overview",
|
|
32
|
+
"architecture",
|
|
33
|
+
"packages",
|
|
34
|
+
"concepts",
|
|
35
|
+
"mental model",
|
|
36
|
+
"how it works",
|
|
37
|
+
],
|
|
38
|
+
doc: "guide/concepts.md",
|
|
39
|
+
seeAlso: ["guide/architecture-flows.md", "guide/getting-started.md"],
|
|
40
|
+
summary:
|
|
41
|
+
"The packages, the backend contract, declarative pages, the form engine and the customization layers.",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: "first-admin-page",
|
|
45
|
+
task: "Create the first admin page",
|
|
46
|
+
keywords: [
|
|
47
|
+
"scaffold",
|
|
48
|
+
"start",
|
|
49
|
+
"setup",
|
|
50
|
+
"layout",
|
|
51
|
+
"definePageMeta",
|
|
52
|
+
"dashboard",
|
|
53
|
+
"sidebar entry",
|
|
54
|
+
"install",
|
|
55
|
+
],
|
|
56
|
+
doc: "howto/first-admin-page.md",
|
|
57
|
+
seeAlso: ["guide/getting-started.md"],
|
|
58
|
+
summary:
|
|
59
|
+
"Page meta, mapo-default layout, auth middleware and sidebar registration.",
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: "crud-list",
|
|
63
|
+
task: "Build a CRUD list page",
|
|
64
|
+
keywords: [
|
|
65
|
+
"MapoList",
|
|
66
|
+
"table",
|
|
67
|
+
"columns",
|
|
68
|
+
"pagination",
|
|
69
|
+
"filters",
|
|
70
|
+
"tabs",
|
|
71
|
+
"bulk",
|
|
72
|
+
"quick edit",
|
|
73
|
+
"search",
|
|
74
|
+
"sorting",
|
|
75
|
+
],
|
|
76
|
+
doc: "howto/crud-list.md",
|
|
77
|
+
seeAlso: ["uikit/list.md"],
|
|
78
|
+
summary:
|
|
79
|
+
"MapoList with server-side pagination, filters, tabs, bulk actions and quick edit.",
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
id: "crud-detail",
|
|
83
|
+
task: "Build a CRUD detail or edit page",
|
|
84
|
+
keywords: [
|
|
85
|
+
"MapoDetail",
|
|
86
|
+
"form",
|
|
87
|
+
"save",
|
|
88
|
+
"delete",
|
|
89
|
+
"translations",
|
|
90
|
+
"sidebar fields",
|
|
91
|
+
"patch",
|
|
92
|
+
],
|
|
93
|
+
doc: "howto/crud-detail.md",
|
|
94
|
+
seeAlso: ["uikit/detail.md", "uikit/form/index.md"],
|
|
95
|
+
summary:
|
|
96
|
+
"MapoDetail wired to useCrud, with body/sidebar field descriptors and save flow.",
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: "standalone-form",
|
|
100
|
+
task: "Use the form engine outside a detail page",
|
|
101
|
+
keywords: [
|
|
102
|
+
"MapoForm",
|
|
103
|
+
"useMapoForm",
|
|
104
|
+
"standalone",
|
|
105
|
+
"modal",
|
|
106
|
+
"wizard",
|
|
107
|
+
"custom submit",
|
|
108
|
+
],
|
|
109
|
+
doc: "howto/form-standalone.md",
|
|
110
|
+
seeAlso: ["uikit/form/composable.md"],
|
|
111
|
+
summary:
|
|
112
|
+
"MapoForm / useMapoForm driven by your own state and submit handler.",
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
id: "field-types",
|
|
116
|
+
task: "Pick a form field type",
|
|
117
|
+
keywords: [
|
|
118
|
+
"descriptor",
|
|
119
|
+
"field type",
|
|
120
|
+
"text",
|
|
121
|
+
"select",
|
|
122
|
+
"editor",
|
|
123
|
+
"repeater",
|
|
124
|
+
"seo",
|
|
125
|
+
"map",
|
|
126
|
+
"fks",
|
|
127
|
+
"m2m",
|
|
128
|
+
"datetime",
|
|
129
|
+
],
|
|
130
|
+
doc: "uikit/form/add-fields.md",
|
|
131
|
+
seeAlso: ["uikit/form/index.md"],
|
|
132
|
+
summary:
|
|
133
|
+
"Every built-in field type, the component behind it and its attrs.",
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
id: "custom-field",
|
|
137
|
+
task: "Create and register a custom field type",
|
|
138
|
+
keywords: [
|
|
139
|
+
"defineFormField",
|
|
140
|
+
"registry",
|
|
141
|
+
"custom component",
|
|
142
|
+
"mapping",
|
|
143
|
+
"own field",
|
|
144
|
+
"extend fields",
|
|
145
|
+
],
|
|
146
|
+
doc: "uikit/form/registry.md",
|
|
147
|
+
heading: "Add types globally — `defineFormField()` (recommended)",
|
|
148
|
+
seeAlso: ["uikit/form/custom-fields.md", "uikit/form/reusable-fields.md"],
|
|
149
|
+
summary:
|
|
150
|
+
"Register a component in the field registry, then use it through descriptor.type.",
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
id: "form-validation",
|
|
154
|
+
task: "Validate form fields",
|
|
155
|
+
keywords: [
|
|
156
|
+
"validate",
|
|
157
|
+
"validateAsync",
|
|
158
|
+
"required",
|
|
159
|
+
"errors",
|
|
160
|
+
"rules",
|
|
161
|
+
"async validation",
|
|
162
|
+
],
|
|
163
|
+
doc: "uikit/form/validation.md",
|
|
164
|
+
summary:
|
|
165
|
+
"Sync and debounced async validation on descriptors, plus error display.",
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
id: "form-i18n",
|
|
169
|
+
task: "Make form fields translatable",
|
|
170
|
+
keywords: [
|
|
171
|
+
"translatable",
|
|
172
|
+
"synci18n",
|
|
173
|
+
"translations",
|
|
174
|
+
"languages",
|
|
175
|
+
"lang switch",
|
|
176
|
+
],
|
|
177
|
+
doc: "uikit/form/i18n.md",
|
|
178
|
+
seeAlso: ["howto/i18n.md"],
|
|
179
|
+
summary:
|
|
180
|
+
"translatable descriptors, per-language models and the detail language switcher.",
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
id: "media-manager",
|
|
184
|
+
task: "Use the media manager and media fields",
|
|
185
|
+
keywords: [
|
|
186
|
+
"upload",
|
|
187
|
+
"image",
|
|
188
|
+
"gallery",
|
|
189
|
+
"folders",
|
|
190
|
+
"MapoMediaManager",
|
|
191
|
+
"enhanced-media",
|
|
192
|
+
"MapoDropArea",
|
|
193
|
+
],
|
|
194
|
+
doc: "howto/media-manager.md",
|
|
195
|
+
seeAlso: ["uikit/media.md"],
|
|
196
|
+
summary:
|
|
197
|
+
"Media endpoints configuration, media fields and the picker dialog.",
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
id: "menu-manager",
|
|
201
|
+
task: "Build a navigation menu editor",
|
|
202
|
+
keywords: [
|
|
203
|
+
"MapoMenuManager",
|
|
204
|
+
"tree",
|
|
205
|
+
"drag and drop",
|
|
206
|
+
"nodes",
|
|
207
|
+
"navigation",
|
|
208
|
+
],
|
|
209
|
+
doc: "howto/menu-manager.md",
|
|
210
|
+
seeAlso: ["uikit/menu-manager.md"],
|
|
211
|
+
summary:
|
|
212
|
+
"Tree editor for menus with drag-and-drop nodes and per-node forms.",
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
id: "i18n",
|
|
216
|
+
task: "Translate the admin UI",
|
|
217
|
+
keywords: [
|
|
218
|
+
"locale",
|
|
219
|
+
"language",
|
|
220
|
+
"vue-i18n",
|
|
221
|
+
"catalog",
|
|
222
|
+
"useMapoT",
|
|
223
|
+
"messages",
|
|
224
|
+
],
|
|
225
|
+
doc: "howto/i18n.md",
|
|
226
|
+
seeAlso: ["modules/i18n.md"],
|
|
227
|
+
summary:
|
|
228
|
+
"Locale setup, overriding Mapo strings and adding your own catalogs.",
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
id: "auth-permissions",
|
|
232
|
+
task: "Protect routes with auth and permissions",
|
|
233
|
+
keywords: [
|
|
234
|
+
"login",
|
|
235
|
+
"middleware",
|
|
236
|
+
"roles",
|
|
237
|
+
"useCanAccessRoute",
|
|
238
|
+
"session",
|
|
239
|
+
"logout",
|
|
240
|
+
"django permissions",
|
|
241
|
+
],
|
|
242
|
+
doc: "howto/auth-permissions.md",
|
|
243
|
+
seeAlso: ["uikit/login.md"],
|
|
244
|
+
summary:
|
|
245
|
+
"Auth middleware, permission route meta and the Django-backed permission model.",
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
id: "feedback",
|
|
249
|
+
task: "Show toasts and confirm dialogs",
|
|
250
|
+
keywords: [
|
|
251
|
+
"snackbar",
|
|
252
|
+
"toast",
|
|
253
|
+
"notification",
|
|
254
|
+
"confirm",
|
|
255
|
+
"dialog",
|
|
256
|
+
"alert",
|
|
257
|
+
],
|
|
258
|
+
doc: "howto/feedback.md",
|
|
259
|
+
seeAlso: ["uikit/feedback.md"],
|
|
260
|
+
summary: "Snackbar and confirm stores, plus their root components.",
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
id: "theming",
|
|
264
|
+
task: "Theme and restyle the admin",
|
|
265
|
+
keywords: [
|
|
266
|
+
"css variables",
|
|
267
|
+
"tailwind",
|
|
268
|
+
"nuxt ui",
|
|
269
|
+
"colors",
|
|
270
|
+
"dark mode",
|
|
271
|
+
"tokens",
|
|
272
|
+
"design",
|
|
273
|
+
"primary color",
|
|
274
|
+
],
|
|
275
|
+
doc: "howto/theming.md",
|
|
276
|
+
seeAlso: ["uikit/theming.md"],
|
|
277
|
+
summary:
|
|
278
|
+
"CSS tokens, Nuxt UI defaults and where to put the override stylesheet.",
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
id: "override-components",
|
|
282
|
+
task: "Replace or extend a Mapo component",
|
|
283
|
+
keywords: [
|
|
284
|
+
"MapoOverride",
|
|
285
|
+
"slots",
|
|
286
|
+
"swap component",
|
|
287
|
+
"customize layout",
|
|
288
|
+
"topbar",
|
|
289
|
+
"sidebar",
|
|
290
|
+
],
|
|
291
|
+
doc: "uikit/mapoverride.md",
|
|
292
|
+
seeAlso: ["uikit/layout.md"],
|
|
293
|
+
summary:
|
|
294
|
+
"The MapoOverride system and the layout slots that avoid full replacements.",
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
id: "backend-integration",
|
|
298
|
+
task: "Connect a custom or Django backend",
|
|
299
|
+
keywords: [
|
|
300
|
+
"api",
|
|
301
|
+
"endpoints",
|
|
302
|
+
"csrf",
|
|
303
|
+
"camomilla",
|
|
304
|
+
"drf",
|
|
305
|
+
"proxy",
|
|
306
|
+
"useCrud",
|
|
307
|
+
"rest",
|
|
308
|
+
"fastapi",
|
|
309
|
+
"laravel",
|
|
310
|
+
"jwt",
|
|
311
|
+
],
|
|
312
|
+
doc: "howto/backend-integration.md",
|
|
313
|
+
seeAlso: ["modules/camomilla.md", "modules/api.md"],
|
|
314
|
+
summary:
|
|
315
|
+
"Endpoint conventions, CSRF/session handling and the camomilla integration.",
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
id: "migration",
|
|
319
|
+
task: "Migrate a v1 project to v2",
|
|
320
|
+
keywords: ["v1", "upgrade", "legacy", "vuex", "axios", "breaking changes"],
|
|
321
|
+
doc: "migration/v1-to-v2.md",
|
|
322
|
+
summary: "What changed between Mapo v1 and v2 and how to port each piece.",
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
id: "conditional-fields",
|
|
326
|
+
task: "Show or hide form fields based on other values",
|
|
327
|
+
keywords: [
|
|
328
|
+
"visible",
|
|
329
|
+
"conditional",
|
|
330
|
+
"whenAny",
|
|
331
|
+
"matchesField",
|
|
332
|
+
"depends on",
|
|
333
|
+
"progressive disclosure",
|
|
334
|
+
],
|
|
335
|
+
doc: "uikit/form/progressive-disclosure.md",
|
|
336
|
+
seeAlso: ["howto/form-advanced.md"],
|
|
337
|
+
summary:
|
|
338
|
+
"visible and show predicates built with the when/matchesField matcher helpers.",
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
id: "form-draft",
|
|
342
|
+
task: "Autosave form drafts",
|
|
343
|
+
keywords: ["draft", "autosave", "useFormDraft", "restore", "unsaved"],
|
|
344
|
+
doc: "uikit/form/draft.md",
|
|
345
|
+
seeAlso: ["howto/crud-detail.md"],
|
|
346
|
+
summary:
|
|
347
|
+
"useFormDraft keeps unsaved edits in localStorage and offers to restore them on the next visit.",
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
id: "schema-to-form",
|
|
351
|
+
task: "Generate form fields from a JSON Schema",
|
|
352
|
+
keywords: [
|
|
353
|
+
"json schema",
|
|
354
|
+
"useFormFromSchema",
|
|
355
|
+
"openapi",
|
|
356
|
+
"drf-spectacular",
|
|
357
|
+
"pydantic",
|
|
358
|
+
"serializer",
|
|
359
|
+
],
|
|
360
|
+
doc: "uikit/form/schema-to-form.md",
|
|
361
|
+
seeAlso: ["howto/form-advanced.md"],
|
|
362
|
+
summary:
|
|
363
|
+
"useFormFromSchema turns a JSON Schema (DRF, Pydantic) into field descriptors you can extend.",
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
id: "form-slots",
|
|
367
|
+
task: "Customize how a form field renders with slots",
|
|
368
|
+
keywords: [
|
|
369
|
+
"field slot",
|
|
370
|
+
"hint",
|
|
371
|
+
"above",
|
|
372
|
+
"below",
|
|
373
|
+
"replace a field",
|
|
374
|
+
"group slot",
|
|
375
|
+
],
|
|
376
|
+
doc: "uikit/form/slots.md",
|
|
377
|
+
summary:
|
|
378
|
+
"Per-field, per-group and global slots that wrap, extend or replace how fields render.",
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
id: "focus-mode",
|
|
382
|
+
task: "Focus mode for repeater items and long fields",
|
|
383
|
+
keywords: [
|
|
384
|
+
"focus mode",
|
|
385
|
+
"useFocusMode",
|
|
386
|
+
"fullscreen",
|
|
387
|
+
"field expand",
|
|
388
|
+
"MapoFocusPortal",
|
|
389
|
+
"breadcrumb",
|
|
390
|
+
],
|
|
391
|
+
doc: "uikit/form/focus-mode.md",
|
|
392
|
+
seeAlso: ["uikit/form/field-expand.md"],
|
|
393
|
+
summary:
|
|
394
|
+
"Open a repeater item in a fullscreen view, or expand a single field in place.",
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
id: "sidebar-navigation",
|
|
398
|
+
task: "Build the sidebar navigation",
|
|
399
|
+
keywords: [
|
|
400
|
+
"sidebar",
|
|
401
|
+
"nested menu",
|
|
402
|
+
"parent",
|
|
403
|
+
"icon",
|
|
404
|
+
"label",
|
|
405
|
+
"sidebarFooter",
|
|
406
|
+
"route meta",
|
|
407
|
+
],
|
|
408
|
+
doc: "uikit/sidebar.md",
|
|
409
|
+
seeAlso: ["howto/first-admin-page.md"],
|
|
410
|
+
summary:
|
|
411
|
+
"Route metadata (label, icon, parent, sidebarFooter) builds the sidebar tree, with no menu config.",
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
id: "login-page",
|
|
415
|
+
task: "Customize the login page",
|
|
416
|
+
keywords: [
|
|
417
|
+
"MapoLogin",
|
|
418
|
+
"sign in",
|
|
419
|
+
"login form",
|
|
420
|
+
"login redirect",
|
|
421
|
+
"branding",
|
|
422
|
+
],
|
|
423
|
+
doc: "uikit/login.md",
|
|
424
|
+
seeAlso: ["howto/auth-permissions.md"],
|
|
425
|
+
summary:
|
|
426
|
+
"The built-in /login page: its slots, the redirect after login and error handling.",
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
id: "imports",
|
|
430
|
+
task: "Know what to import and from where",
|
|
431
|
+
keywords: [
|
|
432
|
+
"import",
|
|
433
|
+
"auto-import",
|
|
434
|
+
"import type",
|
|
435
|
+
"mapomodule/types",
|
|
436
|
+
"TS2307",
|
|
437
|
+
"cannot find module",
|
|
438
|
+
],
|
|
439
|
+
doc: "guide/imports.md",
|
|
440
|
+
seeAlso: ["guide/known-limitations.md"],
|
|
441
|
+
summary:
|
|
442
|
+
"Composables and components are auto-imported, types come from mapomodule/types, utils are imported explicitly.",
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
id: "troubleshooting",
|
|
446
|
+
task: "Troubleshoot compatibility and version problems",
|
|
447
|
+
keywords: [
|
|
448
|
+
"module order",
|
|
449
|
+
"nuxt ui first",
|
|
450
|
+
"error",
|
|
451
|
+
"tested versions",
|
|
452
|
+
"peer dependencies",
|
|
453
|
+
"dedupe",
|
|
454
|
+
"duplicate vue",
|
|
455
|
+
],
|
|
456
|
+
doc: "guide/compatibility.md",
|
|
457
|
+
seeAlso: ["guide/known-limitations.md"],
|
|
458
|
+
summary:
|
|
459
|
+
"Tested versions, what to declare in the app, module order and the common problems.",
|
|
460
|
+
},
|
|
461
|
+
{
|
|
462
|
+
id: "utils",
|
|
463
|
+
task: "Merge, diff and format with the utility helpers",
|
|
464
|
+
keywords: [
|
|
465
|
+
"deepMerge",
|
|
466
|
+
"objectDiff",
|
|
467
|
+
"slugify",
|
|
468
|
+
"formatDate",
|
|
469
|
+
"humanFileSize",
|
|
470
|
+
"normalizeEndpoint",
|
|
471
|
+
"debounce",
|
|
472
|
+
],
|
|
473
|
+
doc: "modules/utils.md",
|
|
474
|
+
seeAlso: ["modules/api.md"],
|
|
475
|
+
summary:
|
|
476
|
+
"Typed helpers from @mapomodule/utils: merging, diffing, formatting, slugs and endpoints.",
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
id: "camomilla",
|
|
480
|
+
task: "Use the Camomilla CMS integration",
|
|
481
|
+
keywords: [
|
|
482
|
+
"camomilla",
|
|
483
|
+
"path rewrite",
|
|
484
|
+
"session cookie",
|
|
485
|
+
"django cms",
|
|
486
|
+
"media adapter",
|
|
487
|
+
],
|
|
488
|
+
doc: "modules/camomilla.md",
|
|
489
|
+
seeAlso: ["howto/backend-integration.md"],
|
|
490
|
+
summary:
|
|
491
|
+
"The Camomilla integration: proxy options, path rewriting, the media adapter and session cookies.",
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
id: "ai-assistant",
|
|
495
|
+
task: "Set up an AI coding assistant",
|
|
496
|
+
keywords: ["mcp", "claude", "copilot", "cursor", "agent", "mapo-mcp"],
|
|
497
|
+
doc: "howto/ai-assistant.md",
|
|
498
|
+
seeAlso: ["modules/mcp.md"],
|
|
499
|
+
summary:
|
|
500
|
+
"Connect Claude Code, Copilot or Cursor to the Mapo MCP server over stdio or HTTP.",
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
id: "form-devtools",
|
|
504
|
+
task: "Inspect forms in Nuxt DevTools",
|
|
505
|
+
keywords: [
|
|
506
|
+
"devtools",
|
|
507
|
+
"debug form",
|
|
508
|
+
"registry warning",
|
|
509
|
+
"inspect",
|
|
510
|
+
"_mapo",
|
|
511
|
+
],
|
|
512
|
+
doc: "uikit/form/devtools.md",
|
|
513
|
+
summary:
|
|
514
|
+
"The Mapo Forms tab: the module config and the live field registry your forms read.",
|
|
515
|
+
},
|
|
516
|
+
];
|
|
517
|
+
|
|
518
|
+
export interface RecipeMatch extends Recipe {
|
|
519
|
+
score: number;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
const TASK_WEIGHT = 1.5;
|
|
523
|
+
const KEYWORD_WEIGHT = 1;
|
|
524
|
+
/** Roughly "two distinctive words, or one distinctive word in the task". */
|
|
525
|
+
const MATCH_THRESHOLD = 3;
|
|
526
|
+
|
|
527
|
+
interface RecipeTerms {
|
|
528
|
+
recipe: Recipe;
|
|
529
|
+
task: Set<string>;
|
|
530
|
+
keywords: Set<string>;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
const RECIPE_TERMS: RecipeTerms[] = RECIPES.map((recipe) => ({
|
|
534
|
+
recipe,
|
|
535
|
+
task: new Set(tokenize(recipe.task)),
|
|
536
|
+
keywords: new Set(tokenize(recipe.keywords.join(" "))),
|
|
537
|
+
}));
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* How many recipes mention each term. Words shared by most recipes ("field",
|
|
541
|
+
* "page", "custom") carry little signal; "upload" or "permission" carry a lot.
|
|
542
|
+
*/
|
|
543
|
+
const DOCUMENT_FREQUENCY = new Map<string, number>();
|
|
544
|
+
for (const entry of RECIPE_TERMS) {
|
|
545
|
+
for (const term of new Set([...entry.task, ...entry.keywords])) {
|
|
546
|
+
DOCUMENT_FREQUENCY.set(term, (DOCUMENT_FREQUENCY.get(term) ?? 0) + 1);
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
function idf(term: string): number {
|
|
551
|
+
const frequency = DOCUMENT_FREQUENCY.get(term);
|
|
552
|
+
return frequency ? Math.log(1 + RECIPES.length / frequency) : 0;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
/** Weighted term overlap over task + keywords; returns only confident hits. */
|
|
556
|
+
export function matchRecipes(query: string, limit = 2): RecipeMatch[] {
|
|
557
|
+
const queryTerms = new Set(tokenize(query));
|
|
558
|
+
if (!queryTerms.size) return [];
|
|
559
|
+
|
|
560
|
+
const matches: RecipeMatch[] = [];
|
|
561
|
+
|
|
562
|
+
for (const { recipe, task, keywords } of RECIPE_TERMS) {
|
|
563
|
+
let score = 0;
|
|
564
|
+
for (const term of queryTerms) {
|
|
565
|
+
if (task.has(term)) score += TASK_WEIGHT * idf(term);
|
|
566
|
+
else if (keywords.has(term)) score += KEYWORD_WEIGHT * idf(term);
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
if (score >= MATCH_THRESHOLD)
|
|
570
|
+
matches.push({ ...recipe, score: Number(score.toFixed(2)) });
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
return matches.sort((a, b) => b.score - a.score).slice(0, limit);
|
|
574
|
+
}
|