@enfyra/mcp-server 0.1.36 → 0.1.38

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.
@@ -38,193 +38,228 @@ export function assertExtensionKnowledgeAckIf(condition, key) {
38
38
  if (condition)
39
39
  assertExtensionKnowledgeAck(key);
40
40
  }
41
- export function buildRequiredKnowledgePayload() {
42
- return {
41
+ export const KNOWLEDGE_SCOPES = ['full', 'schema', 'dynamic-code', 'extension', 'flow'];
42
+ function requireScope(scope) {
43
+ const s = (scope || '').trim().toLowerCase();
44
+ if (KNOWLEDGE_SCOPES.includes(s))
45
+ return s;
46
+ return 'full';
47
+ }
48
+ const GLOBAL_RULES_SECTIONS = [
49
+ {
50
+ id: 'examples-are-reasoning-anchors',
51
+ rules: [
52
+ 'Examples explain transferable decisions, not copy-paste mandates.',
53
+ 'Preserve platform contracts and safety boundaries, then adapt names, routes, fields, menus, labels, and lifecycle to live metadata and the user goal.',
54
+ 'When examples use chat, order, report, cloud, email, or support domains, treat those as analogies unless the current task is exactly that domain.',
55
+ ],
56
+ },
57
+ {
58
+ id: 'discover-before-changing',
59
+ rules: [
60
+ 'Inspect live metadata/routes/features before schema, route, permission, extension, flow, or handler changes.',
61
+ 'Use narrow inspection tools for the table, route, feature, or script being changed instead of broad discovery after the target is known.',
62
+ 'When the thing to find lives in DB-backed runtime state rather than repo files, use search_admin_extensions for admin UI or search_runtime_zone for other runtime zones before raw query_table or broad trace tools.',
63
+ 'Read sourceCode, not compiledCode, for editable dynamic scripts.',
64
+ 'Read code, not sourceCode, for editable enfyra_extension Vue SFC records. sourceCode is for dynamic server scripts; extension UI should be located with search_admin_extensions and edited with patch_extension_code/update_extension_code.',
65
+ ],
66
+ },
67
+ {
68
+ id: 'runtime-zone-locators',
69
+ rules: [
70
+ 'Use search_admin_extensions for menu + extension UI: page extensions, widget extensions, global shell extensions, menu chips, account panel entries, visible buttons, labels, icons, tabs, and blocks.',
71
+ 'Use search_runtime_zone as the zone search/inspect tool for non-admin-UI DB-backed artifacts.',
72
+ 'Search first, then inspect with nextInspect.input before editing.',
73
+ 'Use search_runtime_zone with zone=api_runtime for routes, handlers, pre-hooks, post-hooks, guards, guard rules, and route permissions.',
74
+ 'Use search_runtime_zone with zone=flow_runtime for flows and flow steps.',
75
+ 'Use search_runtime_zone with zone=websocket_runtime for websocket gateways and events.',
76
+ 'Use search_runtime_zone with zone=graphql_runtime for GraphQL exposure and resolver source.',
77
+ 'Use search_runtime_zone with zone=schema_data for tables, columns, relations, field permissions, and column rules.',
78
+ 'Use search_runtime_zone with zone=package_runtime for installed app/server packages.',
79
+ 'Use search_runtime_zone with zone=storage_file for storage configs, folders, files, public asset state, and file permissions.',
80
+ 'Use search_runtime_zone with zone=auth_security for roles, route permissions, field permissions, guards, OAuth configs, and access surfaces.',
81
+ 'After search_runtime_zone mode=search, call search_runtime_zone mode=inspect with the returned nextInspect.input before editing source or metadata.',
82
+ 'Use zone-specific write tools after inspection; do not mutate DB-backed runtime artifacts with generic CRUD when a business operation tool exists.',
83
+ ],
84
+ },
85
+ {
86
+ id: 'mutations-are-intentional',
87
+ rules: [
88
+ 'Prefer business operation tools over generic CRUD when a specific tool exists.',
89
+ 'Destructive operations are preview-first; pass confirm=true only after explicit user approval.',
90
+ 'Do not manually reload caches unless natural partial reload is proven stale or a concrete reload error requires it.',
91
+ 'Never fabricate ids, field names, relation names, paths, package names, or permission scopes.',
92
+ ],
93
+ },
94
+ {
95
+ id: 'schema-constraints',
96
+ rules: [
97
+ 'Before creating a multi-table app, call get_schema_design_context first. Use its liveColumnTypes, createTableInput, columnDefinitionInput, relationDefinitionInput, and recommendedSequence instead of guessing metadata attributes.',
98
+ 'Then call get_enfyra_examples with category=schema-relations only for reasoning patterns, not for domain-specific table names.',
99
+ 'Use plural mutation tools for writes: create_tables/update_tables/delete_tables, create_columns/update_columns/delete_columns, create_relations/delete_relations, and create_records/update_records/delete_records. Pass native JSON arrays; use one item in the array for a single mutation.',
100
+ 'Create entity tables with scalar columns first, then add relations once target tables exist. create_tables defers relation creation until all tables in the same batch exist.',
101
+ 'Do not declare id, _id, createdAt, or updatedAt columns; Enfyra manages them automatically.',
102
+ 'For one-pass relation-based unique/index constraints, declare the owning relations in the same create_tables item as the constraints. If relations already exist or will be created separately, add those constraints afterward with update_tables.',
103
+ 'Use live Enfyra column types, not SQL dialect names. Common safe choices: varchar for short text, text/richtext for long prose, float for price/amount/rating/decimal-like values, int/bigint for counts, boolean, date/datetime/timestamp, enum, simple-json for structured objects/arrays when listed by live metadata, and code for source fields.',
104
+ 'Do not use json/jsonb/longtext/decimal unless the live enfyra_column.type enum lists them. The MCP schema tools normalize common aliases where possible and return schemaNormalization.',
105
+ 'Use Enfyra relations instead of scalar FK/id columns for normalized links. Do not create fields such as userId, course_id, categoryIds, authorId, or JSON arrays of related ids unless the user explicitly asks for denormalized snapshots.',
106
+ 'If the app must deep-read a parent with child collections, create the child owning relation with inversePropertyName from the start; otherwise parent.deepChild queries will fail until an inverse relation is added.',
107
+ 'When inserting/updating records with relations, use relation propertyName values in the body, not hidden physical FK columns. Inspect the table to learn propertyName values.',
108
+ 'For record writes, always use create_records/update_records/delete_records with native array inputs; these tools validate every item against live metadata before posting/patching/deleting sequentially.',
109
+ 'For reads, query_table accepts native object filter/deep/aggregate values. Deep keys are relation names; query_table auto-adds missing top-level deep relation keys to fields so nested records can appear. Inside deep, use fields/filter/sort/limit/page/deep; never use _fields.',
110
+ 'Filters use Enfyra operators, not SQL operators. Use _contains, _starts_with, or _ends_with for text matching; do not use _like.',
111
+ 'This auto-add behavior is MCP query_table only. Inside dynamic server scripts, repository find({ deep }) requires the relation property to also be present in top-level fields, otherwise row.<relation> may be undefined.',
112
+ 'For table schema, a field that appears in any uniques group, including composite unique groups such as ["event","attendee"], must not appear in indexes.',
113
+ 'A unique constraint already creates the indexed unique lookup for its fields, so do not add separate indexes for those same fields.',
114
+ 'Use uniques for data integrity and indexes only for non-unique query-performance fields that are not already unique.',
115
+ 'create_tables preflights all items before posting tables and rejects unique/index overlap for the whole batch; update_tables applies the same guard before patching constraints.',
116
+ 'Before update_tables with indexes/uniques, inspect the current table and remove indexes that reference unique fields.',
117
+ 'query_table always requires limit or all=true. Use meta=filterCount/totalCount or count_records for counts. Do not guess aggregate operators such as _sum/_count; call discover_query_capabilities first when an aggregate object is needed.',
118
+ 'Run schema mutation calls through the plural tools; they serialize work internally. Do not parallelize schema mutation tool calls.',
119
+ ],
120
+ },
121
+ {
122
+ id: 'security-first',
123
+ rules: [
124
+ 'Treat permission and owner/tenant scope as the first design step for any route, handler, hook, flow, extension, websocket, or data surface.',
125
+ 'Route permission only lets authenticated users reach a route after RoleGuard; handlers, hooks, RLS, and scripts still enforce record ownership and tenant/project scope.',
126
+ 'Do not expose unpublished fields, private relation facts, secret values, token hashes, stack traces, SQL, provider payloads, or generated passwords to user-facing clients.',
127
+ ],
128
+ },
129
+ {
130
+ id: 'shell-signals',
131
+ rules: [
132
+ 'For app shell menu/account-panel notifications, decide the signal source before choosing count or dot.',
133
+ 'Use a count only when the shell receives an exact or bounded count from a notification/summary source.',
134
+ 'Use a dot when realtime only proves new attention exists.',
135
+ 'Do not fetch destination domain lists such as messages, tickets, orders, or jobs solely to decorate the menu; the destination page owns domain fetching.',
136
+ ],
137
+ },
138
+ ];
139
+ const DYNAMIC_CODE_SECTIONS = [
140
+ {
141
+ id: 'secure-vs-trusted-repositories',
142
+ rules: [
143
+ '@REPOS.main is the secure repository for the current route main table and preserves normal route query behavior.',
144
+ '@REPOS.secure.<table> is not portable across current Enfyra runtimes and MCP save tools reject it before saving sourceCode.',
145
+ 'For explicit-table custom handlers, use #table_name or @REPOS.<table> with exact fields, relation filters, explicit authorization checks, and shaped/sanitized output.',
146
+ '@REPOS.<table> is the trusted internal repository. It may read/write hidden fields, so never return raw rows or broad projections.',
147
+ 'Never return raw trusted-repository records to users. Project or sanitize output before returning it.',
148
+ ],
149
+ },
150
+ {
151
+ id: 'authorization-is-separate',
152
+ rules: [
153
+ 'Secure repository selection does not prove the user is allowed to access a record.',
154
+ 'Handlers and hooks still need route access, owner/tenant filters, membership checks, and explicit mutation authorization.',
155
+ 'For canonical table reads and RLS, merge security filters into @QUERY.filter and preserve @QUERY.fields, @QUERY.deep, @QUERY.sort, @QUERY.limit, @QUERY.page, @QUERY.meta, @QUERY.aggregate, and debugMode.',
156
+ ],
157
+ },
158
+ {
159
+ id: 'hidden-field-query-surfaces',
160
+ rules: [
161
+ 'Unpublished fields and private relations are sensitive even when the field is not selected.',
162
+ 'Do not expose filter predicate-oracle behavior over hidden fields in user-facing endpoints.',
163
+ 'Do not expose aggregate, _max, _min, _count, sort helpers, or counts over unpublished fields/private relations unless the endpoint intentionally exposes that fact.',
164
+ 'If a normal REST read returns an isPublished=false field through fields/deep/dotted projection, treat it as an Enfyra core bug and verify the minimal REST repro.',
165
+ ],
166
+ },
167
+ {
168
+ id: 'dynamic-script-shape',
169
+ rules: [
170
+ 'Use sourceCode and scriptLanguage; never send compiledCode.',
171
+ 'Prefer macros such as @BODY, @QUERY, @PARAMS, @USER, @REQ, @RES, @REPOS, @HELPERS, @STORAGE, @SOCKET, and @THROW* when available.',
172
+ 'Repository reads use filter, not where.',
173
+ 'For dynamic file upload progress, clients send x-enfyra-upload-id on authenticated multipart requests and listen for $system:upload:progress; @STORAGE.$upload and blob-replacing @STORAGE.$update do not accept onProgress.',
174
+ 'Inside dynamic scripts, prefer #table_name.find with limit:1 and explicit fields for one-record lookups. If a primary-key id filter fails in a runtime, fetch a small bounded candidate set by a unique business field or use the canonical route/main-table context; do not keep retrying @REPOS.<table>.find id filter shapes.',
175
+ 'Relation filters use relation propertyName values, not physical FK-shaped names. Use { incident: { id: { _eq: id } } }, not { incidentId: { _eq: id } }.',
176
+ 'Do not use @REPOS.secure.<table> or @REPOS.secure["table"] in generated sourceCode; use @REPOS.main when the route has a main table or #table_name/@REPOS.table_name with explicit fields and auth checks.',
177
+ 'When using repository find({ deep }) in handlers/hooks/flows, include each deep relation name in top-level fields, then choose nested fields under deep.<relation>.fields.',
178
+ 'Repository calls are async. Always await #table.find/create/update/delete/exists and @REPOS.table.find/create/update/delete/exists; reads return { data: [...], meta? }.',
179
+ 'Create/update repository calls return collection-shaped data arrays; read result.data?.[0] for a single row.',
180
+ 'For intentional HTTP errors, numeric helpers are raw HTTP message helpers: @THROW400(message), @THROW404(message), @THROW409(message), @THROW422(message, detailsObject?), @THROW500(message).',
181
+ 'When numeric helpers include details, pass an object or array such as @THROW404("Project not found", { id }); do not use @THROW404("Project", id) as a semantic shortcut.',
182
+ 'Use @THROW.http(status, message, details?) for dynamic status codes. Use @THROW.notFound(resource, id?) and @THROW.duplicate(resource, field, value) only when you intentionally want Enfyra-formatted semantic messages.',
183
+ ],
184
+ },
185
+ ];
186
+ const EXTENSION_SECTIONS = [
187
+ {
188
+ id: 'theme-contract-first',
189
+ rules: [
190
+ 'Call get_extension_theme_contract before writing or reviewing page, widget, or global extension UI.',
191
+ 'Call get_theme_class_reference when an exact eapp-* class or Nuxt UI color mapping is needed.',
192
+ 'Use eapp-surface-*, eapp-text-*, eapp-divide-y, and eapp-divider for neutral app-shell surfaces.',
193
+ 'Use eapp-primary-* or Nuxt UI primary only for runtime-primary identity/accent intent controlled by the app color picker.',
194
+ 'Use semantic state colors only for true status/error/warning/success/info indicators, not for large KPI/list containers.',
195
+ 'Do not use raw CSS variable utilities such as text-[var(...)], bg-[var(...)], or border-[var(...)] when class tokens exist.',
196
+ 'Do not hard-code concrete palettes such as color="violet" or Tailwind palette accents for themeable UI.',
197
+ ],
198
+ },
199
+ {
200
+ id: 'extension-shell-boundary',
201
+ rules: [
202
+ 'Extension roots render inside the Enfyra admin app shell. Do not add root-level page padding such as p-4 sm:p-6 xl:p-8.',
203
+ 'Page extensions should be full-bleed by default and responsive from the first version.',
204
+ 'Do not wrap whole pages in decorative cards; use cards only for repeated items, modals, or genuinely framed tools.',
205
+ 'Use NuxtLink or Nuxt UI components with :to for visible navigation links; reserve navigateTo for imperative side effects.',
206
+ 'Admin extension links for record management should point to /data/<table>, not public website paths stored on records.',
207
+ ],
208
+ },
209
+ {
210
+ id: 'extension-runtime-contract',
211
+ rules: [
212
+ 'Save extensions as enfyra_extension Vue SFC records; no static import statements in extension code.',
213
+ 'Editable extension source is enfyra_extension.code. Do not request or write enfyra_extension.sourceCode.',
214
+ 'Do not call resolveComponent() in extension SFCs. Use auto-injected components such as <UButton>, <UBadge>, <PermissionGate>, and <Widget> directly in the template so the app/compiler resolves them correctly.',
215
+ 'Load app packages with getPackages(["package-name"]) inside extension runtime code.',
216
+ 'Prefer FormEditor/FormEditorLazy for direct table-backed forms when the form maps to metadata fields.',
217
+ 'For long admin setup workflows, open CommonDrawer immediately and show loading/error/content inside it.',
218
+ 'Use Widget with numeric enfyra_extension widget ids; pass safe reactive props/events and keep page-level mutation ownership in the page unless the widget intentionally owns the workflow.',
219
+ 'Use useMenuNotificationRegistry for sidebar menu counts/dots and useAccountPanelRegistry count/badge fields for account panel notifications; register these from global extensions when they should update across the shell.',
220
+ ],
221
+ },
222
+ ];
223
+ const SCOPED_PURPOSES = {
224
+ full: 'Read this before mutating Enfyra metadata, schema, routes, permissions, menus, packages, cache state, dynamic server code, or extension UI through MCP.',
225
+ schema: 'Read this before mutating Enfyra metadata, schema, table data, routes, permissions, guards, or cache state through MCP.',
226
+ 'dynamic-code': 'Read this before writing or mutating dynamic server code (handlers, hooks, flow steps, websocket events, GraphQL resolvers, bootstrap scripts) through MCP.',
227
+ extension: 'Read this before writing or mutating Enfyra admin extension UI, menus, or shell registrations through MCP.',
228
+ flow: 'Read this before creating or mutating Enfyra flows and flow steps through MCP.',
229
+ };
230
+ export function buildRequiredKnowledgePayload(scope = 'full') {
231
+ const resolvedScope = requireScope(scope);
232
+ const includeGlobal = true;
233
+ const includeDynamic = resolvedScope === 'full' || resolvedScope === 'dynamic-code' || resolvedScope === 'flow';
234
+ const includeExtensions = resolvedScope === 'full' || resolvedScope === 'extension';
235
+ const payload = {
43
236
  version: REQUIRED_KNOWLEDGE_VERSION,
44
- purpose: 'Read this before mutating Enfyra metadata, schema, routes, permissions, menus, packages, cache state, dynamic server code, or extension UI through MCP.',
237
+ scope: resolvedScope,
238
+ purpose: SCOPED_PURPOSES[resolvedScope],
239
+ includedDomains: ['globalRules', ...(includeDynamic ? ['dynamicServerCode'] : []), ...(includeExtensions ? ['extensions'] : [])],
240
+ excludedDomains: [...(!includeDynamic ? ['dynamicServerCode'] : []), ...(!includeExtensions ? ['extensions'] : [])],
241
+ note: 'Ack keys (globalRulesAckKey, dynamicCodeAckKey, extensionAckKey) are always returned so you can use them when needed. Only domains listed in includedDomains have rules loaded. Domains in excludedDomains have NO rules in this response.',
45
242
  globalRulesAckKey: GLOBAL_RULES_ACK_KEY,
46
243
  dynamicCodeAckKey: DYNAMIC_CODE_KNOWLEDGE_ACK_KEY,
47
244
  extensionAckKey: EXTENSION_KNOWLEDGE_ACK_KEY,
48
245
  usage: [
49
246
  'Pass globalRulesAckKey exactly as globalRulesAckKey when calling MCP tools that mutate Enfyra metadata, schema, routes, permissions, menus, packages, cache state, dynamic code, or extension UI.',
50
- 'Pass dynamicCodeAckKey exactly as knowledgeAckKey when calling MCP tools that create or update dynamic server code.',
51
- 'Pass extensionAckKey exactly as extensionKnowledgeAckKey when calling MCP tools that create or update Enfyra extension code.',
52
- ],
53
- globalRules: [
54
- {
55
- id: 'examples-are-reasoning-anchors',
56
- rules: [
57
- 'Examples explain transferable decisions, not copy-paste mandates.',
58
- 'Preserve platform contracts and safety boundaries, then adapt names, routes, fields, menus, labels, and lifecycle to live metadata and the user goal.',
59
- 'When examples use chat, order, report, cloud, email, or support domains, treat those as analogies unless the current task is exactly that domain.',
60
- ],
61
- },
62
- {
63
- id: 'discover-before-changing',
64
- rules: [
65
- 'Inspect live metadata/routes/features before schema, route, permission, extension, flow, or handler changes.',
66
- 'Use narrow inspection tools for the table, route, feature, or script being changed instead of broad discovery after the target is known.',
67
- 'When the thing to find lives in DB-backed runtime state rather than repo files, use search_admin_extensions for admin UI or search_runtime_zone for other runtime zones before raw query_table or broad trace tools.',
68
- 'Read sourceCode, not compiledCode, for editable dynamic scripts.',
69
- 'Read code, not sourceCode, for editable enfyra_extension Vue SFC records. sourceCode is for dynamic server scripts; extension UI should be located with search_admin_extensions and edited with patch_extension_code/update_extension_code.',
70
- ],
71
- },
72
- {
73
- id: 'runtime-zone-locators',
74
- rules: [
75
- 'Use search_admin_extensions for menu + extension UI: page extensions, widget extensions, global shell extensions, menu chips, account panel entries, visible buttons, labels, icons, tabs, and blocks.',
76
- 'Use search_runtime_zone as the zone search/inspect tool for non-admin-UI DB-backed artifacts.',
77
- 'Search first, then inspect with nextInspect.input before editing.',
78
- 'Use search_runtime_zone with zone=api_runtime for routes, handlers, pre-hooks, post-hooks, guards, guard rules, and route permissions.',
79
- 'Use search_runtime_zone with zone=flow_runtime for flows and flow steps.',
80
- 'Use search_runtime_zone with zone=websocket_runtime for websocket gateways and events.',
81
- 'Use search_runtime_zone with zone=graphql_runtime for GraphQL exposure and resolver source.',
82
- 'Use search_runtime_zone with zone=schema_data for tables, columns, relations, field permissions, and column rules.',
83
- 'Use search_runtime_zone with zone=package_runtime for installed app/server packages.',
84
- 'Use search_runtime_zone with zone=storage_file for storage configs, folders, files, public asset state, and file permissions.',
85
- 'Use search_runtime_zone with zone=auth_security for roles, route permissions, field permissions, guards, OAuth configs, and access surfaces.',
86
- 'After search_runtime_zone mode=search, call search_runtime_zone mode=inspect with the returned nextInspect.input before editing source or metadata.',
87
- 'Use zone-specific write tools after inspection; do not mutate DB-backed runtime artifacts with generic CRUD when a business operation tool exists.',
88
- ],
89
- },
90
- {
91
- id: 'mutations-are-intentional',
92
- rules: [
93
- 'Prefer business operation tools over generic CRUD when a specific tool exists.',
94
- 'Destructive operations are preview-first; pass confirm=true only after explicit user approval.',
95
- 'Do not manually reload caches unless natural partial reload is proven stale or a concrete reload error requires it.',
96
- 'Never fabricate ids, field names, relation names, paths, package names, or permission scopes.',
97
- ],
98
- },
99
- {
100
- id: 'schema-constraints',
101
- rules: [
102
- 'Before creating a multi-table app, call get_schema_design_context first. Use its liveColumnTypes, createTableInput, columnDefinitionInput, relationDefinitionInput, and recommendedSequence instead of guessing metadata attributes.',
103
- 'Then call get_enfyra_examples with category=schema-relations only for reasoning patterns, not for domain-specific table names.',
104
- 'Use plural mutation tools for writes: create_tables/update_tables/delete_tables, create_columns/update_columns/delete_columns, create_relations/delete_relations, and create_records/update_records/delete_records. Pass native JSON arrays; use one item in the array for a single mutation.',
105
- 'Create entity tables with scalar columns first, then add relations once target tables exist. create_tables defers relation creation until all tables in the same batch exist.',
106
- 'Do not declare id, _id, createdAt, or updatedAt columns; Enfyra manages them automatically.',
107
- 'For one-pass relation-based unique/index constraints, declare the owning relations in the same create_tables item as the constraints. If relations already exist or will be created separately, add those constraints afterward with update_tables.',
108
- 'Use live Enfyra column types, not SQL dialect names. Common safe choices: varchar for short text, text/richtext for long prose, float for price/amount/rating/decimal-like values, int/bigint for counts, boolean, date/datetime/timestamp, enum, simple-json for structured objects/arrays when listed by live metadata, and code for source fields.',
109
- 'Do not use json/jsonb/longtext/decimal unless the live enfyra_column.type enum lists them. The MCP schema tools normalize common aliases where possible and return schemaNormalization.',
110
- 'Use Enfyra relations instead of scalar FK/id columns for normalized links. Do not create fields such as userId, course_id, categoryIds, authorId, or JSON arrays of related ids unless the user explicitly asks for denormalized snapshots.',
111
- 'If the app must deep-read a parent with child collections, create the child owning relation with inversePropertyName from the start; otherwise parent.deepChild queries will fail until an inverse relation is added.',
112
- 'When inserting/updating records with relations, use relation propertyName values in the body, not hidden physical FK columns. Inspect the table to learn propertyName values.',
113
- 'For record writes, always use create_records/update_records/delete_records with native array inputs; these tools validate every item against live metadata before posting/patching/deleting sequentially.',
114
- 'For reads, query_table accepts native object filter/deep/aggregate values. Deep keys are relation names; query_table auto-adds missing top-level deep relation keys to fields so nested records can appear. Inside deep, use fields/filter/sort/limit/page/deep; never use _fields.',
115
- 'Filters use Enfyra operators, not SQL operators. Use _contains, _starts_with, or _ends_with for text matching; do not use _like.',
116
- 'This auto-add behavior is MCP query_table only. Inside dynamic server scripts, repository find({ deep }) requires the relation property to also be present in top-level fields, otherwise row.<relation> may be undefined.',
117
- 'For table schema, a field that appears in any uniques group, including composite unique groups such as ["event","attendee"], must not appear in indexes.',
118
- 'A unique constraint already creates the indexed unique lookup for its fields, so do not add separate indexes for those same fields.',
119
- 'Use uniques for data integrity and indexes only for non-unique query-performance fields that are not already unique.',
120
- 'create_tables preflights all items before posting tables and rejects unique/index overlap for the whole batch; update_tables applies the same guard before patching constraints.',
121
- 'Before update_tables with indexes/uniques, inspect the current table and remove indexes that reference unique fields.',
122
- 'query_table always requires limit or all=true. Use meta=filterCount/totalCount or count_records for counts. Do not guess aggregate operators such as _sum/_count; call discover_query_capabilities first when an aggregate object is needed.',
123
- 'Run schema mutation calls through the plural tools; they serialize work internally. Do not parallelize schema mutation tool calls.',
124
- ],
125
- },
126
- {
127
- id: 'security-first',
128
- rules: [
129
- 'Treat permission and owner/tenant scope as the first design step for any route, handler, hook, flow, extension, websocket, or data surface.',
130
- 'Route permission only lets authenticated users reach a route after RoleGuard; handlers, hooks, RLS, and scripts still enforce record ownership and tenant/project scope.',
131
- 'Do not expose unpublished fields, private relation facts, secret values, token hashes, stack traces, SQL, provider payloads, or generated passwords to user-facing clients.',
132
- ],
133
- },
134
- {
135
- id: 'shell-signals',
136
- rules: [
137
- 'For app shell menu/account-panel notifications, decide the signal source before choosing count or dot.',
138
- 'Use a count only when the shell receives an exact or bounded count from a notification/summary source.',
139
- 'Use a dot when realtime only proves new attention exists.',
140
- 'Do not fetch destination domain lists such as messages, tickets, orders, or jobs solely to decorate the menu; the destination page owns domain fetching.',
141
- ],
142
- },
143
- ],
144
- dynamicServerCode: [
145
- {
146
- id: 'secure-vs-trusted-repositories',
147
- rules: [
148
- '@REPOS.main is the secure repository for the current route main table and preserves normal route query behavior.',
149
- '@REPOS.secure.<table> is not portable across current Enfyra runtimes and MCP save tools reject it before saving sourceCode.',
150
- 'For explicit-table custom handlers, use #table_name or @REPOS.<table> with exact fields, relation filters, explicit authorization checks, and shaped/sanitized output.',
151
- '@REPOS.<table> is the trusted internal repository. It may read/write hidden fields, so never return raw rows or broad projections.',
152
- 'Never return raw trusted-repository records to users. Project or sanitize output before returning it.',
153
- ],
154
- },
155
- {
156
- id: 'authorization-is-separate',
157
- rules: [
158
- 'Secure repository selection does not prove the user is allowed to access a record.',
159
- 'Handlers and hooks still need route access, owner/tenant filters, membership checks, and explicit mutation authorization.',
160
- 'For canonical table reads and RLS, merge security filters into @QUERY.filter and preserve @QUERY.fields, @QUERY.deep, @QUERY.sort, @QUERY.limit, @QUERY.page, @QUERY.meta, @QUERY.aggregate, and debugMode.',
161
- ],
162
- },
163
- {
164
- id: 'hidden-field-query-surfaces',
165
- rules: [
166
- 'Unpublished fields and private relations are sensitive even when the field is not selected.',
167
- 'Do not expose filter predicate-oracle behavior over hidden fields in user-facing endpoints.',
168
- 'Do not expose aggregate, _max, _min, _count, sort helpers, or counts over unpublished fields/private relations unless the endpoint intentionally exposes that fact.',
169
- 'If a normal REST read returns an isPublished=false field through fields/deep/dotted projection, treat it as an Enfyra core bug and verify the minimal REST repro.',
170
- ],
171
- },
172
- {
173
- id: 'dynamic-script-shape',
174
- rules: [
175
- 'Use sourceCode and scriptLanguage; never send compiledCode.',
176
- 'Prefer macros such as @BODY, @QUERY, @PARAMS, @USER, @REQ, @RES, @REPOS, @HELPERS, @STORAGE, @SOCKET, and @THROW* when available.',
177
- 'Repository reads use filter, not where.',
178
- 'For dynamic file upload progress, clients send x-enfyra-upload-id on authenticated multipart requests and listen for $system:upload:progress; @STORAGE.$upload and blob-replacing @STORAGE.$update do not accept onProgress.',
179
- 'Inside dynamic scripts, prefer #table_name.find with limit:1 and explicit fields for one-record lookups. If a primary-key id filter fails in a runtime, fetch a small bounded candidate set by a unique business field or use the canonical route/main-table context; do not keep retrying @REPOS.<table>.find id filter shapes.',
180
- 'Relation filters use relation propertyName values, not physical FK-shaped names. Use { incident: { id: { _eq: id } } }, not { incidentId: { _eq: id } }.',
181
- 'Do not use @REPOS.secure.<table> or @REPOS.secure["table"] in generated sourceCode; use @REPOS.main when the route has a main table or #table_name/@REPOS.table_name with explicit fields and auth checks.',
182
- 'When using repository find({ deep }) in handlers/hooks/flows, include each deep relation name in top-level fields, then choose nested fields under deep.<relation>.fields.',
183
- 'Repository calls are async. Always await #table.find/create/update/delete/exists and @REPOS.table.find/create/update/delete/exists; reads return { data: [...], meta? }.',
184
- 'Create/update repository calls return collection-shaped data arrays; read result.data?.[0] for a single row.',
185
- 'For intentional HTTP errors, numeric helpers are raw HTTP message helpers: @THROW400(message), @THROW404(message), @THROW409(message), @THROW422(message, detailsObject?), @THROW500(message).',
186
- 'When numeric helpers include details, pass an object or array such as @THROW404("Project not found", { id }); do not use @THROW404("Project", id) as a semantic shortcut.',
187
- 'Use @THROW.http(status, message, details?) for dynamic status codes. Use @THROW.notFound(resource, id?) and @THROW.duplicate(resource, field, value) only when you intentionally want Enfyra-formatted semantic messages.',
188
- ],
189
- },
190
- ],
191
- extensions: [
192
- {
193
- id: 'theme-contract-first',
194
- rules: [
195
- 'Call get_extension_theme_contract before writing or reviewing page, widget, or global extension UI.',
196
- 'Call get_theme_class_reference when an exact eapp-* class or Nuxt UI color mapping is needed.',
197
- 'Use eapp-surface-*, eapp-text-*, eapp-divide-y, and eapp-divider for neutral app-shell surfaces.',
198
- 'Use eapp-primary-* or Nuxt UI primary only for runtime-primary identity/accent intent controlled by the app color picker.',
199
- 'Use semantic state colors only for true status/error/warning/success/info indicators, not for large KPI/list containers.',
200
- 'Do not use raw CSS variable utilities such as text-[var(...)], bg-[var(...)], or border-[var(...)] when class tokens exist.',
201
- 'Do not hard-code concrete palettes such as color="violet" or Tailwind palette accents for themeable UI.',
202
- ],
203
- },
204
- {
205
- id: 'extension-shell-boundary',
206
- rules: [
207
- 'Extension roots render inside the Enfyra admin app shell. Do not add root-level page padding such as p-4 sm:p-6 xl:p-8.',
208
- 'Page extensions should be full-bleed by default and responsive from the first version.',
209
- 'Do not wrap whole pages in decorative cards; use cards only for repeated items, modals, or genuinely framed tools.',
210
- 'Use NuxtLink or Nuxt UI components with :to for visible navigation links; reserve navigateTo for imperative side effects.',
211
- 'Admin extension links for record management should point to /data/<table>, not public website paths stored on records.',
212
- ],
213
- },
214
- {
215
- id: 'extension-runtime-contract',
216
- rules: [
217
- 'Save extensions as enfyra_extension Vue SFC records; no static import statements in extension code.',
218
- 'Editable extension source is enfyra_extension.code. Do not request or write enfyra_extension.sourceCode.',
219
- 'Do not call resolveComponent() in extension SFCs. Use auto-injected components such as <UButton>, <UBadge>, <PermissionGate>, and <Widget> directly in the template so the app/compiler resolves them correctly.',
220
- 'Load app packages with getPackages(["package-name"]) inside extension runtime code.',
221
- 'Prefer FormEditor/FormEditorLazy for direct table-backed forms when the form maps to metadata fields.',
222
- 'For long admin setup workflows, open CommonDrawer immediately and show loading/error/content inside it.',
223
- 'Use Widget with numeric enfyra_extension widget ids; pass safe reactive props/events and keep page-level mutation ownership in the page unless the widget intentionally owns the workflow.',
224
- 'Use useMenuNotificationRegistry for sidebar menu counts/dots and useAccountPanelRegistry count/badge fields for account panel notifications; register these from global extensions when they should update across the shell.',
225
- ],
226
- },
227
247
  ],
248
+ globalRules: includeGlobal ? GLOBAL_RULES_SECTIONS : undefined,
249
+ dynamicServerCode: includeDynamic ? DYNAMIC_CODE_SECTIONS : undefined,
250
+ extensions: includeExtensions ? EXTENSION_SECTIONS : undefined,
228
251
  };
252
+ if (includeDynamic) {
253
+ payload.usage.push('Pass dynamicCodeAckKey exactly as knowledgeAckKey when calling MCP tools that create or update dynamic server code.');
254
+ }
255
+ if (includeExtensions) {
256
+ payload.usage.push('Pass extensionAckKey exactly as extensionKnowledgeAckKey when calling MCP tools that create or update Enfyra extension code.');
257
+ }
258
+ // Strip undefined keys
259
+ Object.keys(payload).forEach((k) => {
260
+ if (payload[k] === undefined)
261
+ delete payload[k];
262
+ });
263
+ return payload;
229
264
  }
230
265
  //# sourceMappingURL=required-knowledge.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"required-knowledge.js","sourceRoot":"","sources":["../../src/lib/required-knowledge.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG,oFAAoF,CAAC;AACzH,MAAM,CAAC,MAAM,8BAA8B,GAAG,uEAAuE,CAAC;AACtH,MAAM,CAAC,MAAM,2BAA2B,GAAG,4DAA4D,CAAC;AAExG,MAAM,0BAA0B,GAAG,6DAA6D,CAAC;AAEjG,MAAM,UAAU,mBAAmB,CAAC,CAAC;IACnC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sKAAsK,CAAC,CAAC;AACrM,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAC,CAAC;IAC5C,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4KAA4K,CAAC,CAAC;AAC3M,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,CAAC;IAC1C,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mKAAmK,CAAC,CAAC;AAClM,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,GAAG;IACtC,IAAI,GAAG,KAAK,oBAAoB,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,0KAA0K,CAAC,CAAC;IAC9L,CAAC;AACH,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,SAAS,EAAE,GAAG;IACnD,IAAI,SAAS;QAAE,oBAAoB,CAAC,GAAG,CAAC,CAAC;AAC3C,CAAC;AAED,MAAM,UAAU,6BAA6B,CAAC,GAAG;IAC/C,IAAI,GAAG,KAAK,8BAA8B,EAAE,CAAC;QAC3C,MAAM,IAAI,KAAK,CAAC,wLAAwL,CAAC,CAAC;IAC5M,CAAC;AACH,CAAC;AAED,MAAM,UAAU,+BAA+B,CAAC,SAAS,EAAE,GAAG;IAC5D,IA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C1J,4MAA4M;oBAC5M,4KAA4K;oBAC5K,0KAA0K;oBAC1K,8GAA8G;oBAC9G,gMAAgM;oBAChM,2KAA2K;oBAC3K,2NAA2N;iBAC5N;aACF;SACF;QACD,UAAU,EAAE;YACV;gBACE,EAAE,EAAE,sBAAsB;gBAC1B,KAAK,EAAE;oBACL,qGAAqG;oBACrG,+FAA+F;oBAC/F,kGAAkG;oBAClG,2HAA2H;oBAC3H,0HAA0H;oBAC1H,6HAA6H;oBAC7H,yGAAyG;iBAC1G;aACF;YACD;gBACE,EAAE,EAAE,0BAA0B;gBAC9B,KAAK,EAAE;oBACL,yHAAyH;oBACzH,wFAAwF;oBACxF,oHAAoH;oBACpH,2HAA2H;oBAC3H,wHAAwH;iBACzH;aACF;YACD;gBACE,EAAE,EAAE,4BAA4B;gBAChC,KAAK,EAAE;oBACL,qGAAqG;oBACrG,0GAA0G;oBAC1G,kNAAkN;oBAClN,qFAAqF;oBACrF,uGAAuG;oBACvG,yGAAyG;oBACzG,4LAA4L;oBAC5L,8NAA8N;iBAC/N;aACF;SACF;KACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"required-knowledge.js","sourceRoot":"","sources":["../../src/lib/required-knowledge.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG,oFAAoF,CAAC;AACzH,MAAM,CAAC,MAAM,8BAA8B,GAAG,uEAAuE,CAAC;AACtH,MAAM,CAAC,MAAM,2BAA2B,GAAG,4DAA4D,CAAC;AAExG,MAAM,0BAA0B,GAAG,6DAA6D,CAAC;AAEjG,MAAM,UAAU,mBAAmB,CAAC,CAAC;IACnC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sKAAsK,CAAC,CAAC;AACrM,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAC,CAAC;IAC5C,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4KAA4K,CAAC,CAAC;AAC3M,CAAC;AAED,MAAM,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AAE,aAAa,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,SAAS;QAC9D,iBAAiB,EAAE,cAAc,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,SAAS;QACrE,UAAU,EAAE,iBAAiB,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,SAAS;KAC/D,CAAC;IAEF,IAAI,cAAc,EAAE,CAAC;QACnB,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,qHAAqH,CAAC,CAAC;IAC5I,CAAC;IACD,IAAI,iBAAiB,EAAE,CAAC;QACtB,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,8HAA8H,CAAC,CAAC;IACrJ,CAAC;IAED,uBAAuB;IACvB,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;QACjC,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,SAAS;YAAE,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -25,6 +25,7 @@ export declare const TOOL_WORKFLOWS: ({
25
25
  requiredAck: string[];
26
26
  exampleCategories: string[];
27
27
  nextStepTemplate: string[];
28
+ recommendedScope: string;
28
29
  } | {
29
30
  key: "extension";
30
31
  title: string;
@@ -44,6 +45,7 @@ export declare const TOOL_WORKFLOWS: ({
44
45
  requiredAck: string[];
45
46
  exampleCategories: string[];
46
47
  nextStepTemplate: string[];
48
+ recommendedScope: string;
47
49
  } | {
48
50
  key: "schema";
49
51
  title: string;
@@ -63,6 +65,7 @@ export declare const TOOL_WORKFLOWS: ({
63
65
  requiredAck: string[];
64
66
  exampleCategories: string[];
65
67
  nextStepTemplate: string[];
68
+ recommendedScope: string;
66
69
  } | {
67
70
  key: "record-data";
68
71
  title: string;
@@ -82,6 +85,7 @@ export declare const TOOL_WORKFLOWS: ({
82
85
  requiredAck: string[];
83
86
  exampleCategories: string[];
84
87
  nextStepTemplate: string[];
88
+ recommendedScope: string;
85
89
  } | {
86
90
  key: "dynamic-script";
87
91
  title: string;
@@ -101,6 +105,7 @@ export declare const TOOL_WORKFLOWS: ({
101
105
  requiredAck: string[];
102
106
  exampleCategories: string[];
103
107
  nextStepTemplate: string[];
108
+ recommendedScope: string;
104
109
  } | {
105
110
  key: "route-access";
106
111
  title: string;
@@ -120,6 +125,7 @@ export declare const TOOL_WORKFLOWS: ({
120
125
  requiredAck: string[];
121
126
  exampleCategories: string[];
122
127
  nextStepTemplate: string[];
128
+ recommendedScope: string;
123
129
  } | {
124
130
  key: "guards-permissions-rules";
125
131
  title: string;
@@ -139,6 +145,7 @@ export declare const TOOL_WORKFLOWS: ({
139
145
  requiredAck: string[];
140
146
  exampleCategories: string[];
141
147
  nextStepTemplate: string[];
148
+ recommendedScope: string;
142
149
  } | {
143
150
  key: "flow";
144
151
  title: string;
@@ -158,6 +165,7 @@ export declare const TOOL_WORKFLOWS: ({
158
165
  requiredAck: string[];
159
166
  exampleCategories: string[];
160
167
  nextStepTemplate: string[];
168
+ recommendedScope: string;
161
169
  } | {
162
170
  key: "websocket";
163
171
  title: string;
@@ -177,6 +185,7 @@ export declare const TOOL_WORKFLOWS: ({
177
185
  requiredAck: string[];
178
186
  exampleCategories: string[];
179
187
  nextStepTemplate: string[];
188
+ recommendedScope: string;
180
189
  } | {
181
190
  key: "graphql";
182
191
  title: string;
@@ -196,6 +205,7 @@ export declare const TOOL_WORKFLOWS: ({
196
205
  requiredAck: string[];
197
206
  exampleCategories: string[];
198
207
  nextStepTemplate: string[];
208
+ recommendedScope: string;
199
209
  } | {
200
210
  key: "package";
201
211
  title: string;
@@ -215,6 +225,7 @@ export declare const TOOL_WORKFLOWS: ({
215
225
  requiredAck: string[];
216
226
  exampleCategories: string[];
217
227
  nextStepTemplate: string[];
228
+ recommendedScope: string;
218
229
  } | {
219
230
  key: "cache";
220
231
  title: string;
@@ -234,6 +245,7 @@ export declare const TOOL_WORKFLOWS: ({
234
245
  requiredAck: string[];
235
246
  exampleCategories: any[];
236
247
  nextStepTemplate: string[];
248
+ recommendedScope: string;
237
249
  } | {
238
250
  key: "logs-debug";
239
251
  title: string;
@@ -253,6 +265,7 @@ export declare const TOOL_WORKFLOWS: ({
253
265
  requiredAck: any[];
254
266
  exampleCategories: any[];
255
267
  nextStepTemplate: string[];
268
+ recommendedScope: string;
256
269
  } | {
257
270
  key: "auth-context";
258
271
  title: string;
@@ -272,11 +285,13 @@ export declare const TOOL_WORKFLOWS: ({
272
285
  requiredAck: any[];
273
286
  exampleCategories: string[];
274
287
  nextStepTemplate: string[];
288
+ recommendedScope: string;
275
289
  })[];
276
290
  export declare function listWorkflowSurfaces(): {
277
291
  key: "websocket" | "api-endpoint" | "extension" | "schema" | "record-data" | "dynamic-script" | "route-access" | "guards-permissions-rules" | "flow" | "graphql" | "package" | "cache" | "logs-debug" | "auth-context";
278
292
  title: string;
279
293
  useWhen: string[];
294
+ recommendedScope: string;
280
295
  }[];
281
296
  export declare function discoverWorkflowRoutes({ intent, surface, risk, detail, limit, }?: WorkflowRouteOptions): {
282
297
  action: string;
@@ -289,6 +304,7 @@ export declare function discoverWorkflowRoutes({ intent, surface, risk, detail,
289
304
  key: "websocket" | "api-endpoint" | "extension" | "schema" | "record-data" | "dynamic-script" | "route-access" | "guards-permissions-rules" | "flow" | "graphql" | "package" | "cache" | "logs-debug" | "auth-context";
290
305
  title: string;
291
306
  useWhen: string[];
307
+ recommendedScope: string;
292
308
  score: number;
293
309
  }[];
294
310
  surfaces: readonly ["api-endpoint", "extension", "schema", "record-data", "dynamic-script", "route-access", "guards-permissions-rules", "flow", "websocket", "graphql", "package", "cache", "logs-debug", "auth-context"];