@sfdxy/mule-lint 1.21.0 → 1.22.0

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/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sfdxy/mule-lint",
3
- "version": "1.21.0",
3
+ "version": "1.22.0",
4
4
  "description": "Static analysis tool for MuleSoft applications - supports humans, AI agents, and CI/CD pipelines",
5
5
  "author": "Avinava",
6
6
  "license": "MIT",
@@ -1,6 +1,6 @@
1
1
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  /**
3
- * Register all MCP prompts (analyze-project, explain-rule, fix-issue)
3
+ * Register all MCP prompts (analyze-project, explain-rule, fix-issue, review-best-practices)
4
4
  */
5
5
  export declare function registerPrompts(server: McpServer): void;
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/mcp/prompts/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAIvD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/mcp/prompts/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAKvD"}
@@ -3,12 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.registerPrompts = registerPrompts;
4
4
  const zod_1 = require("zod");
5
5
  /**
6
- * Register all MCP prompts (analyze-project, explain-rule, fix-issue)
6
+ * Register all MCP prompts (analyze-project, explain-rule, fix-issue, review-best-practices)
7
7
  */
8
8
  function registerPrompts(server) {
9
9
  registerAnalyzeProject(server);
10
10
  registerExplainRule(server);
11
11
  registerFixIssue(server);
12
+ registerReviewBestPractices(server);
12
13
  }
13
14
  /**
14
15
  * Prompt: analyze-project
@@ -84,4 +85,64 @@ function registerFixIssue(server) {
84
85
  };
85
86
  });
86
87
  }
88
+ /**
89
+ * Prompt: review-best-practices
90
+ *
91
+ * Guides the LLM to read applicable best-practice docs based on project type,
92
+ * then run lint analysis, then cross-reference findings with best practices
93
+ * to provide improvement suggestions beyond just lint rule violations.
94
+ */
95
+ function registerReviewBestPractices(server) {
96
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- MCP SDK generic type inference exceeds TS depth limits (TS2589)
97
+ server.registerPrompt('review-best-practices', {
98
+ description: 'Review a MuleSoft project against best practices. Reads applicable guides based on project type, runs lint analysis, and provides improvement recommendations beyond rule violations.',
99
+ argsSchema: {
100
+ path: zod_1.z.string().describe('The absolute path to the MuleSoft project'),
101
+ projectType: zod_1.z
102
+ .string()
103
+ .describe('The type of project: "http-api" (System/Experience API with HTTP listener), "event-driven" (Process API with platform events/MQ), or "batch" (scheduler/batch processing)'),
104
+ },
105
+ }, ({ path, projectType }) => {
106
+ // Build the list of recommended docs based on project type
107
+ const commonDocs = ['error-handling', 'logging', 'security', 'variables', 'dataweave'];
108
+ const typeDocs = {
109
+ 'http-api': ['connectors', 'performance', 'folder-structure'],
110
+ 'event-driven': ['event-driven', 'connectors', 'performance'],
111
+ batch: ['event-driven', 'performance', 'connectors'],
112
+ };
113
+ const extraDocs = typeDocs[projectType] ?? [];
114
+ const recommendedDocs = [...commonDocs, ...extraDocs];
115
+ const docsList = recommendedDocs.map((d) => `mule-lint://docs/${d}`).join('\n ');
116
+ return {
117
+ messages: [
118
+ {
119
+ role: 'user',
120
+ content: {
121
+ type: 'text',
122
+ text: `Please perform a comprehensive best practices review of the MuleSoft project at ${path}.
123
+
124
+ This is a "${projectType}" project. Follow these steps:
125
+
126
+ 1. **Read best practice guides** — read these resources first to understand the standards:
127
+ ${docsList}
128
+
129
+ 2. **Run lint analysis** — use the run_lint_analysis tool on the project path.
130
+
131
+ 3. **Cross-reference** — compare lint findings with the best practices you read. Look for:
132
+ - Lint rule violations and their recommended fixes
133
+ - Patterns that are technically valid but don't follow best practices
134
+ - Missing patterns that should be present (e.g., entity configs, DWL modules, correlation IDs)
135
+ - **Advanced patterns**: VM queue dispatchers for multi-entity orchestration, scheduler watermarking for incremental polling, pre-batch bulk lookups to prevent N+1 queries, cross-system value mapping strategy selection, centralized error log objects for CRM visibility
136
+
137
+ 4. **Report** — provide a structured summary with:
138
+ - Critical issues (must fix)
139
+ - Recommended improvements (should fix)
140
+ - Architecture observations (consider for future)
141
+ - Specific code examples for each recommendation`,
142
+ },
143
+ },
144
+ ],
145
+ };
146
+ });
147
+ }
87
148
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/mcp/prompts/index.ts"],"names":[],"mappings":";;AAMA,0CAIC;AAVD,6BAAwB;AAGxB;;GAEG;AACH,SAAgB,eAAe,CAAC,MAAiB;IAC/C,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAC/B,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC5B,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAC3B,CAAC;AAED;;GAEG;AACH,SAAS,sBAAsB,CAAC,MAAiB;IAC/C,iIAAiI;IAChI,MAAc,CAAC,cAAc,CAC5B,iBAAiB,EACjB;QACE,WAAW,EACT,uFAAuF;QACzF,UAAU,EAAE;YACV,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6CAA6C,CAAC;SACzE;KACF,EACD,CAAC,EAAE,IAAI,EAAoB,EAAE,EAAE;QAC7B,OAAO;YACL,QAAQ,EAAE;gBACR;oBACE,IAAI,EAAE,MAAM;oBACZ,OAAO,EAAE;wBACP,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,0CAA0C,IAAI,8KAA8K;qBACnO;iBACF;aACF;SACF,CAAC;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UAAU,EAAE,CAAC,YAAY,EAAE,aAAa,EAAE,kBAAkB,CAAC;YAC7D,cAAc,EAAE,CAAC,cAAc,EAAE,YAAY,EAAE,aAAa,CAAC;YAC7D,KAAK,EAAE,CAAC,cAAc,EAAE,aAAa,EAAE,YAAY,CAAC;SACrD,CAAC;QACF,MAAM,SAAS,GAAG,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QAC9C,MAAM,eAAe,GAAG,CAAC,GAAG,UAAU,EAAE,GAAG,SAAS,CAAC,CAAC;QACtD,MAAM,QAAQ,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAElF,OAAO;YACL,QAAQ,EAAE;gBACR;oBACE,IAAI,EAAE,MAAM;oBACZ,OAAO,EAAE;wBACP,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,mFAAmF,IAAI;;aAE9F,WAAW;;;IAGpB,QAAQ;;;;;;;;;;;;;;oDAcwC;qBACvC;iBACF;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -76,68 +76,166 @@ function registerRulesResource(server) {
76
76
  }
77
77
  /**
78
78
  * Resource: mule-lint://docs/{slug}
79
- * Access official MuleSoft development best practices documentation
79
+ * Access official MuleSoft development best practices documentation.
80
+ *
81
+ * Each slug maps to a focused, self-contained guide optimized for LLM consumption.
82
+ * Guides are typically < 200 lines and cover a single topic with decision matrices,
83
+ * code examples, anti-patterns, and checklists.
80
84
  */
81
85
  function registerDocsResource(server) {
82
86
  server.registerResource('docs', new mcp_js_1.ResourceTemplate('mule-lint://docs/{slug}', {
83
87
  list: () => {
84
88
  return {
85
89
  resources: [
90
+ // ── Core Development ──
86
91
  {
87
- uri: 'mule-lint://docs/architecture',
88
- name: 'Architecture',
92
+ uri: 'mule-lint://docs/error-handling',
93
+ name: 'Error Handling',
94
+ description: 'Global error handlers, HTTP vs event-driven patterns, connector error types, centralized CRM error log objects, self-healing error flows',
89
95
  mimeType: 'text/markdown',
90
96
  },
91
97
  {
92
- uri: 'mule-lint://docs/best-practices',
93
- name: 'Best Practices',
98
+ uri: 'mule-lint://docs/variables',
99
+ name: 'Variable Contracts',
100
+ description: 'Standard variable sets for APIKit routes and event listeners, correlation ID sourcing, array mirroring',
94
101
  mimeType: 'text/markdown',
95
102
  },
96
103
  {
97
- uri: 'mule-lint://docs/documentation-standards',
98
- name: 'Documentation Standards',
104
+ uri: 'mule-lint://docs/logging',
105
+ name: 'Logging Standards',
106
+ description: 'Logger categories, structured JSON logging, MDC/tracing module, PII prevention, log levels',
107
+ mimeType: 'text/markdown',
108
+ },
109
+ {
110
+ uri: 'mule-lint://docs/security',
111
+ name: 'Security',
112
+ description: 'Secure properties, TLS 1.2+, credential management, zero-trust architecture, input validation',
113
+ mimeType: 'text/markdown',
114
+ },
115
+ {
116
+ uri: 'mule-lint://docs/performance',
117
+ name: 'Performance',
118
+ description: 'Timeouts, connection pooling, async error handling, streaming, flow complexity limits, pre-batch bulk lookup (N+1 prevention with scatter-gather + groupBy)',
119
+ mimeType: 'text/markdown',
120
+ },
121
+ // ── Architecture & Patterns ──
122
+ {
123
+ uri: 'mule-lint://docs/event-driven',
124
+ name: 'Event-Driven Patterns',
125
+ description: 'Platform Events, Anypoint MQ, VM Queue Dispatcher, scheduler watermarking with ObjectStore, deferred task polling, AsyncAPI 2.6, deduplication',
99
126
  mimeType: 'text/markdown',
100
127
  },
101
- { uri: 'mule-lint://docs/extending', name: 'Extending', mimeType: 'text/markdown' },
128
+ {
129
+ uri: 'mule-lint://docs/connectors',
130
+ name: 'Connector Patterns',
131
+ description: 'Entity config YAML pattern, Salesforce/NetSuite connector gotchas, protocol negotiation, ObjectStore caching, DWL utility modules',
132
+ mimeType: 'text/markdown',
133
+ },
134
+ {
135
+ uri: 'mule-lint://docs/dataweave',
136
+ name: 'DataWeave Patterns',
137
+ description: 'DWL modules, type coercion for connectors, cross-system value mapping (4 strategies: DWL, JSON dictionary, bidirectional, external), import path rules',
138
+ mimeType: 'text/markdown',
139
+ },
140
+ // ── Project & Operations ──
102
141
  {
103
142
  uri: 'mule-lint://docs/folder-structure',
104
143
  name: 'Folder Structure',
144
+ description: 'Standard Maven layout for Mule 4 projects, file naming, directory organization',
105
145
  mimeType: 'text/markdown',
106
146
  },
107
147
  {
108
- uri: 'mule-lint://docs/naming',
109
- name: 'Naming Conventions',
148
+ uri: 'mule-lint://docs/documentation-standards',
149
+ name: 'Documentation Standards',
150
+ description: 'Flow doc:description, README templates, DataWeave comments, commit message conventions',
151
+ mimeType: 'text/markdown',
152
+ },
153
+ {
154
+ uri: 'mule-lint://docs/testing',
155
+ name: 'Testing (MUnit)',
156
+ description: 'MUnit test structure, error scenario testing, event-driven testing, coverage goals',
157
+ mimeType: 'text/markdown',
158
+ },
159
+ {
160
+ uri: 'mule-lint://docs/ci-cd',
161
+ name: 'CI/CD Integration',
162
+ description: 'Pipeline stages, mule-lint integration, quality gates, SARIF output, GitHub Actions',
163
+ mimeType: 'text/markdown',
164
+ },
165
+ {
166
+ uri: 'mule-lint://docs/deployment',
167
+ name: 'Deployment & Modernization (2026)',
168
+ description: 'CloudHub 2.0, Java 17 migration, Anypoint Code Builder, API Governance, monitoring',
169
+ mimeType: 'text/markdown',
170
+ },
171
+ // ── Reference ──
172
+ {
173
+ uri: 'mule-lint://docs/best-practices',
174
+ name: 'Best Practices Index',
175
+ description: 'Master index linking to all topic-specific guides with quick reference card and API-Led overview',
110
176
  mimeType: 'text/markdown',
111
177
  },
112
178
  {
113
179
  uri: 'mule-lint://docs/rules-catalog',
114
180
  name: 'Rules Catalog',
181
+ description: 'Complete reference for all 82 lint rules with severity, examples, and configuration options',
182
+ mimeType: 'text/markdown',
183
+ },
184
+ // ── Linter Internals (for contributors) ──
185
+ {
186
+ uri: 'mule-lint://docs/architecture',
187
+ name: 'Linter Architecture',
188
+ description: 'Internal linter design, patterns, and data flow (for contributors)',
189
+ mimeType: 'text/markdown',
190
+ },
191
+ {
192
+ uri: 'mule-lint://docs/extending',
193
+ name: 'Extending the Linter',
194
+ description: 'How to create custom rules and extend mule-lint (for contributors)',
115
195
  mimeType: 'text/markdown',
116
196
  },
117
197
  ],
118
198
  };
119
199
  },
120
200
  }), {
121
- description: 'Access the official MuleSoft development best practices and internal documentation. Read these documents to ensure your generated code aligns with our architectural standards, naming conventions, and project structure.',
201
+ description: 'Access MuleSoft development best practices and linter documentation. Each slug maps to a focused topic guide. Start by listing available resources, then read the guides relevant to your current task. For example, read "error-handling" when implementing error handlers, or "connectors" when configuring Salesforce/NetSuite connectors.',
122
202
  mimeType: 'text/markdown',
123
203
  }, (uri, variables) => {
124
204
  const slug = variables.slug;
205
+ // Map slugs to file paths — topic-specific best practices + linter docs
125
206
  const docsMap = {
126
- architecture: 'docs/linter/architecture.md',
127
- 'best-practices': 'docs/best-practices/mulesoft-best-practices.md',
207
+ // Core Development
208
+ 'error-handling': 'docs/best-practices/error-handling.md',
209
+ variables: 'docs/best-practices/variable-contracts.md',
210
+ logging: 'docs/best-practices/logging.md',
211
+ security: 'docs/best-practices/security.md',
212
+ performance: 'docs/best-practices/performance.md',
213
+ // Architecture & Patterns
214
+ 'event-driven': 'docs/best-practices/event-driven-patterns.md',
215
+ connectors: 'docs/best-practices/connector-patterns.md',
216
+ dataweave: 'docs/best-practices/dataweave-patterns.md',
217
+ // Project & Operations
218
+ 'folder-structure': 'docs/best-practices/folder-structure.md',
128
219
  'documentation-standards': 'docs/best-practices/documentation-standards.md',
220
+ testing: 'docs/best-practices/testing.md',
221
+ 'ci-cd': 'docs/best-practices/ci-cd.md',
222
+ deployment: 'docs/best-practices/deployment-2026.md',
223
+ // Reference
224
+ 'best-practices': 'docs/best-practices/mulesoft-best-practices.md',
225
+ 'rules-catalog': 'docs/best-practices/rules-catalog.md',
226
+ // Linter Internals — keep for contributors
227
+ architecture: 'docs/linter/architecture.md',
129
228
  extending: 'docs/linter/extending.md',
130
- 'folder-structure': 'docs/best-practices/folder-structure.md',
131
229
  naming: 'docs/linter/naming-conventions.md',
132
- 'rules-catalog': 'docs/best-practices/rules-catalog.md',
133
230
  };
134
231
  const relativePath = docsMap[slug];
135
232
  if (!relativePath) {
233
+ const available = Object.keys(docsMap).join(', ');
136
234
  return {
137
235
  contents: [
138
236
  {
139
237
  uri: uri.href,
140
- text: `Document not found: ${slug}. Available: ${Object.keys(docsMap).join(', ')}`,
238
+ text: `Document not found: "${slug}". Available slugs: ${available}`,
141
239
  mimeType: 'text/plain',
142
240
  },
143
241
  ],
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/mcp/resources/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,8CAGC;AAbD,oEAAsF;AAEtF,8CAAoD;AACpD,uCAAwC;AACxC,2CAA6B;AAC7B,uCAAyB;AAEzB;;GAEG;AACH,SAAgB,iBAAiB,CAAC,MAAiB;IACjD,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAC9B,oBAAoB,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC;AAED;;;GAGG;AACH,SAAS,qBAAqB,CAAC,MAAiB;IAC9C,MAAM,CAAC,gBAAgB,CACrB,OAAO,EACP,mBAAmB,EACnB;QACE,WAAW,EACT,2LAA2L;QAC7L,QAAQ,EAAE,kBAAkB;KAC7B,EACD,CAAC,GAAG,EAAE,EAAE;QACN,MAAM,SAAS,GAAG,iBAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACtC,EAAE,EAAE,CAAC,CAAC,EAAE;YACR,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,QAAQ,EAAE,CAAC,CAAC,QAAQ;YACpB,QAAQ,EAAE,CAAC,CAAC,QAAQ;YACpB,SAAS,EAAE,CAAC,CAAC,SAAS,IAAI,YAAY;YACtC,WAAW,EAAE,CAAC,CAAC,WAAW;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ACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"getRuleDetails.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tools/getRuleDetails.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIpE;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA4C9D"}
1
+ {"version":3,"file":"getRuleDetails.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tools/getRuleDetails.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA4BpE;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAmD9D"}
@@ -3,12 +3,35 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.registerGetRuleDetails = registerGetRuleDetails;
4
4
  const zod_1 = require("zod");
5
5
  const rules_1 = require("../../rules");
6
+ /**
7
+ * Mapping from rule category to the best-practice doc slug.
8
+ * Used by get_rule_details to point agents at the relevant guide.
9
+ */
10
+ const categoryToDocSlug = {
11
+ 'error-handling': 'error-handling',
12
+ naming: 'variables',
13
+ security: 'security',
14
+ logging: 'logging',
15
+ http: 'performance',
16
+ performance: 'performance',
17
+ documentation: 'documentation-standards',
18
+ standards: 'best-practices',
19
+ complexity: 'performance',
20
+ structure: 'folder-structure',
21
+ yaml: 'security',
22
+ dataweave: 'dataweave',
23
+ 'api-led': 'best-practices',
24
+ connector: 'connectors',
25
+ governance: 'ci-cd',
26
+ operations: 'ci-cd',
27
+ experimental: 'best-practices',
28
+ };
6
29
  /**
7
30
  * Register the get_rule_details tool on the MCP server
8
31
  */
9
32
  function registerGetRuleDetails(server) {
10
33
  // eslint-disable-next-line @typescript-eslint/no-explicit-any -- MCP SDK generic type inference exceeds TS depth limits (TS2589)
11
- server.tool('get_rule_details', 'Retrieve detailed documentation for a specific linting rule ID (e.g., MULE-001). Use this to understand WHY a rule failed and HOW to fix it properly according to best practices.', {
34
+ server.tool('get_rule_details', 'Retrieve detailed documentation for a specific linting rule ID (e.g., MULE-001). Use this to understand WHY a rule failed and HOW to fix it properly according to best practices. Returns rule metadata, the relevant best-practice guide slug, and related rules.', {
12
35
  ruleId: zod_1.z.string().describe('The ID of the rule to retrieve (e.g., "MULE-001", "DW-004")'),
13
36
  }, ({ ruleId }) => {
14
37
  const rule = (0, rules_1.getRuleById)(ruleId);
@@ -23,6 +46,7 @@ function registerGetRuleDetails(server) {
23
46
  isError: true,
24
47
  };
25
48
  }
49
+ const docSlug = categoryToDocSlug[rule.category] || 'best-practices';
26
50
  return {
27
51
  content: [
28
52
  {
@@ -35,6 +59,11 @@ function registerGetRuleDetails(server) {
35
59
  severity: rule.severity,
36
60
  issueType: rule.issueType ?? 'code-smell',
37
61
  docsUrl: rule.docsUrl,
62
+ bestPracticeGuide: {
63
+ slug: docSlug,
64
+ uri: `mule-lint://docs/${docSlug}`,
65
+ hint: `Read the "${docSlug}" resource for detailed patterns, code examples, and checklists related to this rule.`,
66
+ },
38
67
  }, null, 2),
39
68
  },
40
69
  ],
@@ -1 +1 @@
1
- {"version":3,"file":"getRuleDetails.js","sourceRoot":"","sources":["../../../../src/mcp/tools/getRuleDetails.ts"],"names":[],"mappings":";;AAQA,wDA4CC;AApDD,6BAAwB;AAGxB,uCAA0C;AAE1C;;GAEG;AACH,SAAgB,sBAAsB,CAAC,MAAiB;IACtD,iIAAiI;IAChI,MAAc,CAAC,IAAI,CAClB,kBAAkB,EAClB,mLAAmL,EACnL;QACE,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6DAA6D,CAAC;KAC3F,EACD,CAAC,EAAE,MAAM,EAAsB,EAAE,EAAE;QACjC,MAAM,IAAI,GAAG,IAAA,mBAAW,EAAC,MAAM,CAAC,CAAC;QACjC,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO;gBACL,O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  # Mule-Lint Documentation
2
2
 
3
- Welcome to the Mule-Lint documentation. This documentation is organized into two sections:
3
+ Welcome to the Mule-Lint documentation. This documentation is organized into two sections: **MuleSoft Best Practices** (for integration developers and AI agents) and **Linter Technical Documentation** (for mule-lint contributors).
4
4
 
5
5
  ---
6
6
 
7
7
  ## 📘 MuleSoft Best Practices
8
8
 
9
- Comprehensive guidelines for building maintainable, secure, and performant Mule applications. These guidelines cover more than just what the linter validates - they represent industry best practices for MuleSoft development.
9
+ Comprehensive guidelines for building maintainable, secure, and performant Mule 4 applications. Each guide is a focused, self-contained reference that can be read independently.
10
10
 
11
- | Document | Description |
12
- | ----------------------------------------------------------------- | -------------------------------------------- |
13
- | [Best Practices Guide](best-practices/mulesoft-best-practices.md) | Complete MuleSoft development best practices |
14
- | [Rules Catalog](best-practices/rules-catalog.md) | All 56 linter rules with examples |
11
+ ### Core Development
12
+
13
+ | Document | Description |
14
+ | ----------------------------------------------------------------- | ---------------------------------------------------------------------------- |
15
+ | [Best Practices Index](best-practices/mulesoft-best-practices.md) | Master index with quick reference card and API-Led overview |
16
+ | [Error Handling](best-practices/error-handling.md) | Global error handlers, HTTP vs. event-driven patterns, connector error types, CRM error log objects |
17
+ | [Variable Contracts](best-practices/variable-contracts.md) | Standard variables, correlation IDs, array mirroring, action routing |
18
+ | [Logging](best-practices/logging.md) | Categories, structured JSON logging, MDC/tracing, PII prevention |
19
+ | [Security](best-practices/security.md) | Secure properties, TLS 1.2+, credentials, zero-trust architecture |
20
+ | [Performance](best-practices/performance.md) | Timeouts, connection pooling, async error handling, streaming, bulk lookup (N+1 prevention) |
21
+
22
+ ### Architecture & Patterns
23
+
24
+ | Document | Description |
25
+ | ---------------------------------------------------------------- | ----------------------------------------------------------------- |
26
+ | [Event-Driven Patterns](best-practices/event-driven-patterns.md) | Platform Events, Anypoint MQ, VM Queue Dispatcher, scheduler watermarking, deferred task polling |
27
+ | [Connector Patterns](best-practices/connector-patterns.md) | Entity config YAML, SF/NS connector gotchas, protocol negotiation, ObjectStore caching |
28
+ | [DataWeave Patterns](best-practices/dataweave-patterns.md) | Modules, type coercion, cross-system value mapping (4 strategies), import path rules |
29
+
30
+ ### Project & Operations
31
+
32
+ | Document | Description |
33
+ | -------------------------------------------------------------------- | ------------------------------------------------------------ |
34
+ | [Folder Structure](best-practices/folder-structure.md) | Standard Maven layout for Mule 4 projects |
35
+ | [Documentation Standards](best-practices/documentation-standards.md) | Flow documentation, README templates, commit messages |
36
+ | [Testing (MUnit)](best-practices/testing.md) | Test structure, error scenario testing, event-driven testing |
37
+ | [CI/CD Integration](best-practices/ci-cd.md) | Pipeline stages, mule-lint integration, quality gates |
38
+ | [Deployment & Modernization](best-practices/deployment-2026.md) | CloudHub 2.0, Java 17, Anypoint Code Builder, API Governance |
39
+
40
+ ### Reference
41
+
42
+ | Document | Description |
43
+ | ------------------------------------------------ | ------------------------------------------------------ |
44
+ | [Rules Catalog](best-practices/rules-catalog.md) | Complete reference for all 82 lint rules with examples |
15
45
 
16
46
  ---
17
47
 
@@ -19,13 +49,14 @@ Comprehensive guidelines for building maintainable, secure, and performant Mule
19
49
 
20
50
  For contributors and those extending mule-lint.
21
51
 
22
- | Document | Description |
23
- | -------------------------------------------------- | -------------------------------------- |
24
- | [Architecture](linter/architecture.md) | System design, patterns, and data flow |
25
- | [Rule Engine](linter/rule-engine.md) | Rule engine internals and interfaces |
26
- | [Extending](linter/extending.md) | How to create custom rules |
27
- | [Folder Structure](linter/folder-structure.md) | Project organization |
28
- | [Naming Conventions](linter/naming-conventions.md) | Code style and naming standards |
52
+ | Document | Description |
53
+ | -------------------------------------------------- | ------------------------------------------------ |
54
+ | [Architecture](linter/architecture.md) | System design, patterns, and data flow |
55
+ | [Rule Engine](linter/rule-engine.md) | Rule engine internals and interfaces |
56
+ | [Extending](linter/extending.md) | How to create custom rules |
57
+ | [Folder Structure](linter/folder-structure.md) | Linter project organization |
58
+ | [Naming Conventions](linter/naming-conventions.md) | Code style and naming standards |
59
+ | [MCP Design](mcp-design.md) | MCP server architecture and tool/resource design |
29
60
 
30
61
  ---
31
62
 
@@ -72,25 +103,54 @@ mule-lint ./src/main/mule --fail-on-warning
72
103
 
73
104
  ## Rule Families
74
105
 
75
- | Family | Prefix | Count | Description |
76
- | --------------- | ------------------------- | ----- | -------------------------------------------------- |
77
- | Core MuleSoft | MULE-XXX | 29 | Core Mule 4 XML validation |
78
- | Security | SEC-XXX | 5 | Security best practices (TLS, rate limiting, etc.) |
79
- | Logging | LOG-XXX | 2 | Structured logging and sensitive data |
80
- | Operations | OPS-XXX, RES-XXX, HYG-XXX | 7 | Reconnection, auto-discovery, hygiene |
81
- | YAML Properties | YAML-XXX | 3 | YAML configuration validation |
82
- | DataWeave | DW-XXX | 4 | DataWeave file validation |
83
- | API-Led | API-XXX | 5 | API-Led connectivity patterns |
84
- | Governance | PROJ-XXX | 2 | POM and Git hygiene |
85
- | Experimental | EXP-XXX | 3 | Beta rules for evaluation |
86
-
87
- **Total: 56 rules**
106
+ | Family | Prefix | Count | Description |
107
+ | --------------- | ------------------------- | ----- | -------------------------------------------- |
108
+ | Core MuleSoft | MULE-XXX | 29 | Core Mule 4 XML validation |
109
+ | Error Handling | ERR-XXX | 4 | Advanced error handler rules |
110
+ | Security | SEC-XXX | 5 | Security best practices (TLS, rate limiting) |
111
+ | Logging | LOG-XXX, HYG-001 | 3 | Structured logging and sensitive data |
112
+ | HTTP | HTTP-XXX | 1 | HTTP connector configuration |
113
+ | Operations | OPS-XXX, RES-XXX, HYG-XXX | 8 | Reconnection, auto-discovery, hygiene |
114
+ | YAML Properties | YAML-XXX | 3 | YAML configuration validation |
115
+ | DataWeave | DW-XXX | 5 | DataWeave file validation |
116
+ | API-Led | API-XXX | 7 | API-Led connectivity patterns |
117
+ | Connectors | SF-XXX | 2 | Salesforce and event connector rules |
118
+ | Standards | CFG-XXX, STD-XXX | 3 | Config and API standards |
119
+ | Governance | PROJ-XXX | 2 | POM and Git hygiene |
120
+ | Experimental | EXP-XXX | 3 | Beta rules for evaluation |
121
+
122
+ **Total: 82 rules**
88
123
 
89
124
  ---
90
125
 
91
126
  ## For AI Agents
92
127
 
93
- Use SARIF output format for structured results:
128
+ ### MCP Resources
129
+
130
+ All best practice guides are available via the MuleSoft Lint MCP server:
131
+
132
+ ```
133
+ mule-lint://rules → JSON catalog of all 82 rules
134
+ mule-lint://docs/best-practices → Master index and quick reference
135
+ mule-lint://docs/error-handling → Error handling patterns
136
+ mule-lint://docs/event-driven → Event-driven architecture
137
+ mule-lint://docs/connectors → Connector configuration
138
+ mule-lint://docs/variables → Variable contracts
139
+ mule-lint://docs/dataweave → DataWeave patterns
140
+ mule-lint://docs/security → Security best practices
141
+ mule-lint://docs/logging → Logging standards
142
+ mule-lint://docs/performance → Performance optimization
143
+ mule-lint://docs/testing → MUnit testing
144
+ mule-lint://docs/deployment → Deployment & modernization
145
+ mule-lint://docs/ci-cd → CI/CD integration
146
+ mule-lint://docs/folder-structure → Project structure
147
+ mule-lint://docs/documentation-standards → Documentation standards
148
+ mule-lint://docs/rules-catalog → Complete rules reference
149
+ ```
150
+
151
+ ### SARIF Output
152
+
153
+ Use SARIF output for structured results:
94
154
 
95
155
  ```bash
96
156
  mule-lint ./src/main/mule -f sarif > report.sarif