@sfdxy/mule-lint 1.16.2 → 1.17.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.
Files changed (55) hide show
  1. package/README.md +9 -6
  2. package/dist/bin/mule-lint.js +14 -1
  3. package/dist/bin/mule-lint.js.map +1 -1
  4. package/dist/package.json +3 -2
  5. package/dist/src/mcp/index.d.ts.map +1 -1
  6. package/dist/src/mcp/index.js +6 -0
  7. package/dist/src/mcp/index.js.map +1 -1
  8. package/dist/src/rules/documentation/DisplayNameRule.d.ts +17 -0
  9. package/dist/src/rules/documentation/DisplayNameRule.d.ts.map +1 -0
  10. package/dist/src/rules/documentation/DisplayNameRule.js +46 -0
  11. package/dist/src/rules/documentation/DisplayNameRule.js.map +1 -0
  12. package/dist/src/rules/index.d.ts.map +1 -1
  13. package/dist/src/rules/index.js +21 -12
  14. package/dist/src/rules/index.js.map +1 -1
  15. package/dist/src/rules/logging/ExcessiveLoggersRule.d.ts +16 -0
  16. package/dist/src/rules/logging/ExcessiveLoggersRule.d.ts.map +1 -0
  17. package/dist/src/rules/logging/ExcessiveLoggersRule.js +45 -0
  18. package/dist/src/rules/logging/ExcessiveLoggersRule.js.map +1 -0
  19. package/dist/src/rules/operations/CommentedCodeRule.d.ts +17 -0
  20. package/dist/src/rules/operations/CommentedCodeRule.d.ts.map +1 -0
  21. package/dist/src/rules/operations/CommentedCodeRule.js +58 -0
  22. package/dist/src/rules/operations/CommentedCodeRule.js.map +1 -0
  23. package/dist/src/rules/operations/UnusedFlowRule.d.ts +17 -0
  24. package/dist/src/rules/operations/UnusedFlowRule.d.ts.map +1 -0
  25. package/dist/src/rules/operations/UnusedFlowRule.js +80 -0
  26. package/dist/src/rules/operations/UnusedFlowRule.js.map +1 -0
  27. package/dist/src/rules/performance/ReconnectionStrategyRule.d.ts +16 -0
  28. package/dist/src/rules/performance/ReconnectionStrategyRule.d.ts.map +1 -0
  29. package/dist/src/rules/performance/ReconnectionStrategyRule.js +60 -0
  30. package/dist/src/rules/performance/ReconnectionStrategyRule.js.map +1 -0
  31. package/dist/src/rules/security/EncryptionKeyInLogsRule.d.ts +17 -0
  32. package/dist/src/rules/security/EncryptionKeyInLogsRule.d.ts.map +1 -0
  33. package/dist/src/rules/security/EncryptionKeyInLogsRule.js +46 -0
  34. package/dist/src/rules/security/EncryptionKeyInLogsRule.js.map +1 -0
  35. package/dist/src/rules/standards/ApiKitValidationRule.d.ts +16 -0
  36. package/dist/src/rules/standards/ApiKitValidationRule.d.ts.map +1 -0
  37. package/dist/src/rules/standards/ApiKitValidationRule.js +39 -0
  38. package/dist/src/rules/standards/ApiKitValidationRule.js.map +1 -0
  39. package/dist/src/rules/standards/AutoDiscoveryRule.d.ts +16 -0
  40. package/dist/src/rules/standards/AutoDiscoveryRule.d.ts.map +1 -0
  41. package/dist/src/rules/standards/AutoDiscoveryRule.js +47 -0
  42. package/dist/src/rules/standards/AutoDiscoveryRule.js.map +1 -0
  43. package/dist/src/rules/standards/CronExternalizedRule.d.ts +16 -0
  44. package/dist/src/rules/standards/CronExternalizedRule.d.ts.map +1 -0
  45. package/dist/src/rules/standards/CronExternalizedRule.js +32 -0
  46. package/dist/src/rules/standards/CronExternalizedRule.js.map +1 -0
  47. package/dist/src/rules/standards/HttpPortPlaceholderRule.d.ts +16 -0
  48. package/dist/src/rules/standards/HttpPortPlaceholderRule.d.ts.map +1 -0
  49. package/dist/src/rules/standards/HttpPortPlaceholderRule.js +34 -0
  50. package/dist/src/rules/standards/HttpPortPlaceholderRule.js.map +1 -0
  51. package/package.json +3 -2
  52. package/dist/src/rules/operations/OperationsRules.d.ts +0 -137
  53. package/dist/src/rules/operations/OperationsRules.d.ts.map +0 -1
  54. package/dist/src/rules/operations/OperationsRules.js +0 -442
  55. package/dist/src/rules/operations/OperationsRules.js.map +0 -1
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnusedFlowRule = void 0;
4
+ const BaseRule_1 = require("../base/BaseRule");
5
+ /**
6
+ * HYG-003: Unused Flow Detection
7
+ *
8
+ * Detects flows that are never referenced by flow-ref.
9
+ */
10
+ class UnusedFlowRule extends BaseRule_1.BaseRule {
11
+ id = 'HYG-003';
12
+ name = 'Unused Flow Detection';
13
+ description = 'Detects flows that are never referenced';
14
+ severity = 'warning';
15
+ category = 'standards';
16
+ validate(doc, _context) {
17
+ const issues = [];
18
+ // Get all flow names in this document
19
+ const flows = this.select('//*[local-name()="flow"]', doc);
20
+ const subflows = this.select('//*[local-name()="sub-flow"]', doc);
21
+ // Get all flow-ref targets
22
+ const flowRefs = this.select('//*[local-name()="flow-ref"]', doc);
23
+ const referencedFlows = new Set();
24
+ for (const ref of flowRefs) {
25
+ const name = this.getNameAttribute(ref);
26
+ if (name) {
27
+ referencedFlows.add(name);
28
+ }
29
+ }
30
+ // Check sub-flows (they should always be referenced)
31
+ for (const subflow of subflows) {
32
+ const name = this.getNameAttribute(subflow);
33
+ if (name && !referencedFlows.has(name)) {
34
+ // Exclude common patterns that are referenced externally
35
+ if (!this.isExternallyReferenced(name)) {
36
+ issues.push(this.createIssue(subflow, `Sub-flow "${name}" is never referenced within this file`, {
37
+ severity: 'info',
38
+ suggestion: 'Consider removing unused sub-flows or verify cross-file references',
39
+ }));
40
+ }
41
+ }
42
+ }
43
+ // Check private flows (not triggered by HTTP/scheduler)
44
+ for (const flow of flows) {
45
+ const name = this.getNameAttribute(flow);
46
+ if (!name) {
47
+ continue;
48
+ }
49
+ // Skip if it has an external trigger
50
+ const hasHttpListener = this.exists('.//*[local-name()="listener"]', flow);
51
+ const hasScheduler = this.exists('.//*[local-name()="scheduler"]', flow);
52
+ const hasVmListener = this.exists('.//*[local-name()="listener" and contains(@config-ref, "vm")]', flow);
53
+ if (hasHttpListener || hasScheduler || hasVmListener) {
54
+ continue; // Entry point flow
55
+ }
56
+ // Check if referenced
57
+ if (!referencedFlows.has(name) && !this.isExternallyReferenced(name)) {
58
+ issues.push(this.createIssue(flow, `Flow "${name}" has no trigger and is never referenced`, {
59
+ severity: 'info',
60
+ suggestion: 'Verify this flow is referenced from other files or remove if unused',
61
+ }));
62
+ }
63
+ }
64
+ return issues;
65
+ }
66
+ isExternallyReferenced(name) {
67
+ // Common patterns that are typically referenced externally
68
+ const externalPatterns = [
69
+ /-main$/,
70
+ /-api$/,
71
+ /^api-/,
72
+ /-console$/,
73
+ /-error-handler$/,
74
+ /global/i,
75
+ ];
76
+ return externalPatterns.some((pattern) => pattern.test(name));
77
+ }
78
+ }
79
+ exports.UnusedFlowRule = UnusedFlowRule;
80
+ //# sourceMappingURL=UnusedFlowRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnusedFlowRule.js","sourceRoot":"","sources":["../../../../src/rules/operations/UnusedFlowRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C;;;;GAIG;AACH,MAAa,cAAe,SAAQ,mBAAQ;IACxC,EAAE,GAAG,SAAS,CAAC;IACf,IAAI,GAAG,uBAAuB,CAAC;IAC/B,WAAW,GAAG,yCAAyC,CAAC;IACxD,QAAQ,GAAG,SAAkB,CAAC;IAC9B,QAAQ,GAAG,WAAoB,CAAC;IAEhC,QAAQ,CAAC,GAAa,EAAE,QAA2B;QAC/C,MAAM,MAAM,GAAY,EAAE,CAAC;QAE3B,sCAAsC;QACtC,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,0BAA0B,EAAE,GAAG,CAAC,CAAC;QAC3D,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,8BAA8B,EAAE,GAAG,CAAC,CAAC;QAElE,2BAA2B;QAC3B,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,8BAA8B,EAAE,GAAG,CAAC,CAAC;QAClE,MAAM,eAAe,GAAG,IAAI,GAAG,EAAU,CAAC;QAE1C,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;YACzB,MAAM,IAAI,GAAG,IAAI,CAAC,gBA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AAI,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,EAAE,CAAC;gBACnE,MAAM,CAAC,IAAI,CACP,IAAI,CAAC,WAAW,CACZ,IAAI,EACJ,SAAS,IAAI,0CAA0C,EACvD;oBACI,QAAQ,EAAE,MAAM;oBAChB,UAAU,EACN,qEAAqE;iBAC5E,CACJ,CACJ,CAAC;YACN,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;IAEO,sBAAsB,CAAC,IAAY;QACvC,2DAA2D;QAC3D,MAAM,gBAAgB,GAAG;YACrB,QAAQ;YACR,OAAO;YACP,OAAO;YACP,WAAW;YACX,iBAAiB;YACjB,SAAS;SACZ,CAAC;QACF,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAClE,CAAC;CACJ;AA9FD,wCA8FC"}
@@ -0,0 +1,16 @@
1
+ import { ValidationContext, Issue } from '../../types';
2
+ import { BaseRule } from '../base/BaseRule';
3
+ /**
4
+ * RES-001: Reconnection Strategy
5
+ *
6
+ * Connectors should have reconnection strategies configured for resilience.
7
+ */
8
+ export declare class ReconnectionStrategyRule extends BaseRule {
9
+ id: string;
10
+ name: string;
11
+ description: string;
12
+ severity: "warning";
13
+ category: "performance";
14
+ validate(doc: Document, _context: ValidationContext): Issue[];
15
+ }
16
+ //# sourceMappingURL=ReconnectionStrategyRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReconnectionStrategyRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/performance/ReconnectionStrategyRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;GAIG;AACH,qBAAa,wBAAyB,SAAQ,QAAQ;IAClD,EAAE,SAAa;IACf,IAAI,SAA2B;IAC/B,WAAW,SAA+D;IAC1E,QAAQ,EAAG,SAAS,CAAU;IAC9B,QAAQ,EAAG,aAAa,CAAU;IAElC,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,KAAK,EAAE;CAmEhE"}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReconnectionStrategyRule = void 0;
4
+ const BaseRule_1 = require("../base/BaseRule");
5
+ /**
6
+ * RES-001: Reconnection Strategy
7
+ *
8
+ * Connectors should have reconnection strategies configured for resilience.
9
+ */
10
+ class ReconnectionStrategyRule extends BaseRule_1.BaseRule {
11
+ id = 'RES-001';
12
+ name = 'Reconnection Strategy';
13
+ description = 'Connectors should have reconnection strategies configured';
14
+ severity = 'warning';
15
+ category = 'performance';
16
+ validate(doc, _context) {
17
+ const issues = [];
18
+ // Specific connector configurations that benefit from reconnection strategies
19
+ // Using more specific patterns to avoid false positives on generic "config" elements
20
+ const connectorConfigs = [
21
+ { pattern: 'request-config', name: 'HTTP Request' },
22
+ { pattern: 'listener-config', name: 'HTTP Listener' },
23
+ { pattern: 'jms-config', name: 'JMS' },
24
+ { pattern: 'amqp-config', name: 'AMQP' },
25
+ { pattern: 'sftp-config', name: 'SFTP' },
26
+ { pattern: 'ftp-config', name: 'FTP' },
27
+ { pattern: 'vm-config', name: 'VM' },
28
+ ];
29
+ for (const connector of connectorConfigs) {
30
+ const configs = this.select(`//*[local-name()="${connector.pattern}"]`, doc);
31
+ for (const config of configs) {
32
+ // Check for reconnection or reconnect child elements
33
+ const hasReconnection = this.exists('.//*[local-name()="reconnection"]', config) ||
34
+ this.exists('.//*[local-name()="reconnect"]', config) ||
35
+ this.exists('.//*[local-name()="reconnect-forever"]', config);
36
+ if (!hasReconnection) {
37
+ const name = this.getNameAttribute(config) ?? connector.name;
38
+ issues.push(this.createIssue(config, `${connector.name} config "${name}" has no reconnection strategy`, {
39
+ suggestion: 'Add <reconnection> or <reconnect-forever> for resilience',
40
+ }));
41
+ }
42
+ }
43
+ }
44
+ // Database configs specifically - check for db namespace
45
+ const dbConfigs = this.select('//*[local-name()="config" and starts-with(name(), "db:")]', doc);
46
+ for (const config of dbConfigs) {
47
+ const hasReconnection = this.exists('.//*[local-name()="reconnection"]', config) ||
48
+ this.exists('.//*[local-name()="reconnect"]', config);
49
+ if (!hasReconnection) {
50
+ const name = this.getNameAttribute(config) ?? 'Database';
51
+ issues.push(this.createIssue(config, `Database config "${name}" has no reconnection strategy`, {
52
+ suggestion: 'Add <reconnection> inside the connection element',
53
+ }));
54
+ }
55
+ }
56
+ return issues;
57
+ }
58
+ }
59
+ exports.ReconnectionStrategyRule = ReconnectionStrategyRule;
60
+ //# sourceMappingURL=ReconnectionStrategyRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReconnectionStrategyRule.js","sourceRoot":"","sources":["../../../../src/rules/performance/ReconnectionStrategyRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C;;;;GAIG;AACH,MAAa,wBAAyB,SAAQ,mBAAQ;IAClD,EAAE,GAAG,SAAS,CAAC;IACf,IAAI,GAAG,uBAAuB,CAAC;IAC/B,WAAW,GAAG,2DAA2D,CAAC;IAC1E,QAAQ,GAAG,SAAkB,CAAC;IAC9B,QAAQ,GAAG,aAAsB,CAAC;IAElC,QAAQ,CAAC,GAAa,EAAE,QAA2B;QAC/C,MAAM,MAAM,GAAY,EAAE,CAAC;QAE3B,8EAA8E;QAC9E,qFAAqF;QACrF,MAAM,gBAAgB,GAAG;YACrB,EAAE,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,cAAc,EAAE;YACnD,EAAE,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAE,eAAe,EAAE;YACrD,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,KAAK,EAAE;YACtC,EAAE,OAAO,EAAE,aAAa,EAAE,IAAI,E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C,CAAC;YAE1D,IAAI,CAAC,eAAe,EAAE,CAAC;gBACnB,MAAM,IAAI,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC;gBACzD,MAAM,CAAC,IAAI,CACP,IAAI,CAAC,WAAW,CACZ,MAAM,EACN,oBAAoB,IAAI,gCAAgC,EACxD;oBACI,UAAU,EAAE,kDAAkD;iBACjE,CACJ,CACJ,CAAC;YACN,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AA1ED,4DA0EC"}
@@ -0,0 +1,17 @@
1
+ import { ValidationContext, Issue } from '../../types';
2
+ import { BaseRule } from '../base/BaseRule';
3
+ /**
4
+ * SEC-006: Encryption Key in Logs
5
+ *
6
+ * Encryption keys and sensitive credentials should not appear in log statements.
7
+ */
8
+ export declare class EncryptionKeyInLogsRule extends BaseRule {
9
+ id: string;
10
+ name: string;
11
+ description: string;
12
+ severity: "error";
13
+ category: "security";
14
+ private sensitivePatterns;
15
+ validate(doc: Document, _context: ValidationContext): Issue[];
16
+ }
17
+ //# sourceMappingURL=EncryptionKeyInLogsRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EncryptionKeyInLogsRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/security/EncryptionKeyInLogsRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,QAAQ;IACjD,EAAE,SAAa;IACf,IAAI,SAA4B;IAChC,WAAW,SAAkE;IAC7E,QAAQ,EAAG,OAAO,CAAU;IAC5B,QAAQ,EAAG,UAAU,CAAU;IAE/B,OAAO,CAAC,iBAAiB,CASvB;IAEF,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,KAAK,EAAE;CA6BhE"}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EncryptionKeyInLogsRule = void 0;
4
+ const BaseRule_1 = require("../base/BaseRule");
5
+ /**
6
+ * SEC-006: Encryption Key in Logs
7
+ *
8
+ * Encryption keys and sensitive credentials should not appear in log statements.
9
+ */
10
+ class EncryptionKeyInLogsRule extends BaseRule_1.BaseRule {
11
+ id = 'SEC-006';
12
+ name = 'Encryption Key in Logs';
13
+ description = 'Encryption keys and sensitive data should not appear in logs';
14
+ severity = 'error';
15
+ category = 'security';
16
+ sensitivePatterns = [
17
+ /encrypt.*key/i,
18
+ /decryption.*key/i,
19
+ /secret.*key/i,
20
+ /api[_-]?key/i,
21
+ /password/i,
22
+ /credentials?/i,
23
+ /mule\.key/i,
24
+ /secure::.*key/i,
25
+ ];
26
+ validate(doc, _context) {
27
+ const issues = [];
28
+ // Find all loggers
29
+ const loggers = this.select('//*[local-name()="logger"]', doc);
30
+ for (const logger of loggers) {
31
+ const message = this.getAttribute(logger, 'message') ?? '';
32
+ // Check for sensitive patterns in log messages
33
+ for (const pattern of this.sensitivePatterns) {
34
+ if (pattern.test(message)) {
35
+ issues.push(this.createIssue(logger, `Logger may expose sensitive data: "${message.substring(0, 50)}${message.length > 50 ? '...' : ''}"`, {
36
+ suggestion: 'Remove encryption keys and sensitive data from log messages',
37
+ }));
38
+ break; // Only one issue per logger
39
+ }
40
+ }
41
+ }
42
+ return issues;
43
+ }
44
+ }
45
+ exports.EncryptionKeyInLogsRule = EncryptionKeyInLogsRule;
46
+ //# sourceMappingURL=EncryptionKeyInLogsRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EncryptionKeyInLogsRule.js","sourceRoot":"","sources":["../../../../src/rules/security/EncryptionKeyInLogsRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C;;;;GAIG;AACH,MAAa,uBAAwB,SAAQ,mBAAQ;IACjD,EAAE,GA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6
+ * APIs should use APIKit for auto-generated implementation interfaces.
7
+ */
8
+ export declare class ApiKitValidationRule extends BaseRule {
9
+ id: string;
10
+ name: string;
11
+ description: string;
12
+ severity: "info";
13
+ category: "standards";
14
+ validate(doc: Document, _context: ValidationContext): Issue[];
15
+ }
16
+ //# sourceMappingURL=ApiKitValidationRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApiKitValidationRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/standards/ApiKitValidationRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;GAIG;AACH,qBAAa,oBAAqB,SAAQ,QAAQ;IAC9C,EAAE,SAAa;IACf,IAAI,SAAuB;IAC3B,WAAW,SAA0D;IACrE,QAAQ,EAAG,MAAM,CAAU;IAC3B,QAAQ,EAAG,WAAW,CAAU;IAEhC,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,KAAK,EAAE;CAoChE"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApiKitValidationRule = void 0;
4
+ const BaseRule_1 = require("../base/BaseRule");
5
+ /**
6
+ * API-005: APIKit Validation
7
+ *
8
+ * APIs should use APIKit for auto-generated implementation interfaces.
9
+ */
10
+ class ApiKitValidationRule extends BaseRule_1.BaseRule {
11
+ id = 'API-005';
12
+ name = 'APIKit Validation';
13
+ description = 'APIs should use APIKit for implementation interfaces';
14
+ severity = 'info';
15
+ category = 'standards';
16
+ validate(doc, _context) {
17
+ const issues = [];
18
+ // Check if this appears to be an API project (has HTTP listener)
19
+ const hasHttpListener = this.exists('//*[local-name()="listener"]', doc);
20
+ if (!hasHttpListener) {
21
+ return issues;
22
+ }
23
+ // Check for APIKit router
24
+ const hasApiKitRouter = this.exists('//*[local-name()="router"]', doc);
25
+ const hasApiKitConfig = this.exists('//*[local-name()="config" and contains(@name, "api")]', doc);
26
+ if (!hasApiKitRouter && !hasApiKitConfig) {
27
+ // Only flag if this looks like an interface file
28
+ const hasMainFlow = this.exists('//*[local-name()="flow" and (contains(@name, "-main") or contains(@name, "-api"))]', doc);
29
+ if (hasMainFlow) {
30
+ issues.push(this.createFileIssue('Consider using APIKit to auto-generate the implementation interface', {
31
+ suggestion: 'APIKit provides consistent API implementation patterns',
32
+ }));
33
+ }
34
+ }
35
+ return issues;
36
+ }
37
+ }
38
+ exports.ApiKitValidationRule = ApiKitValidationRule;
39
+ //# sourceMappingURL=ApiKitValidationRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApiKitValidationRule.js","sourceRoot":"","sources":["../../../../src/rules/standards/ApiKitValidationRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C;;;;GAIG;AACH,MAAa,oBAAqB,SAAQ,mBAAQ;IAC9C,EAAE,GAAG,SAAS,CAAC;IACf,IAAI,GAAG,mBAAmB,CAAC;IAC3B,WAAW,GAAG,sDAAsD,CAAC;IACrE,QAAQ,GAAG,MAAe,CAAC;IAC3B,QAAQ,GAAG,WAAoB,CAAC;IAEhC,QAAQ,CAAC,GAAa,EAAE,QAA2B;QAC/C,MAAM,MAAM,GAAY,EAAE,CAAC;QAE3B,iEAAiE;QACjE,MAAM,eAAe,GAAG,IAAI,CAAC,MAAM,CAAC,8BAA8B,EAAE,GAAG,CAAC,CAAC;QACzE,IAAI,CAAC,eAAe,EAAE,CAAC;YACnB,OAAO,MAAM,CAAC;QAClB,CAAC;QAED,0BAA0B;QAC1B,MAAM,eAAe,GAAG,IAAI,CAAC,MAAM,CAAC,4BAA4B,EAAE,GAAG,CAAC,CAAC;QACvE,MAAM,eAAe,GAAG,IAAI,CAAC,MAAM,CAC/B,uDAAuD,EACvD,GAAG,CACN,CAAC;QAEF,IAAI,CAAC,eAAe,IAAI,CAAC,eAAe,EAAE,CAAC;YACvC,iDAAiD;YACjD,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,CAC3B,oFAAoF,EACpF,GAAG,CACN,CAAC;YACF,IAAI,WAAW,EAAE,CAAC;gBACd,MAAM,CAAC,IAAI,CACP,IAAI,CAAC,eAAe,CAChB,qEAAqE,EACrE;oBACI,UAAU,EAAE,wDAAwD;iBACvE,CACJ,CACJ,CAAC;YACN,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AA3CD,oDA2CC"}
@@ -0,0 +1,16 @@
1
+ import { ValidationContext, Issue } from '../../types';
2
+ import { BaseRule } from '../base/BaseRule';
3
+ /**
4
+ * OPS-001: Auto-Discovery Configuration
5
+ *
6
+ * APIs should have auto-discovery configured for API Manager integration.
7
+ */
8
+ export declare class AutoDiscoveryRule extends BaseRule {
9
+ id: string;
10
+ name: string;
11
+ description: string;
12
+ severity: "info";
13
+ category: "standards";
14
+ validate(doc: Document, _context: ValidationContext): Issue[];
15
+ }
16
+ //# sourceMappingURL=AutoDiscoveryRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AutoDiscoveryRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/standards/AutoDiscoveryRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,QAAQ;IAC3C,EAAE,SAAa;IACf,IAAI,SAAkC;IACtC,WAAW,SAAgE;IAC3E,QAAQ,EAAG,MAAM,CAAU;IAC3B,QAAQ,EAAG,WAAW,CAAU;IAEhC,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,KAAK,EAAE;CA2ChE"}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AutoDiscoveryRule = void 0;
4
+ const BaseRule_1 = require("../base/BaseRule");
5
+ /**
6
+ * OPS-001: Auto-Discovery Configuration
7
+ *
8
+ * APIs should have auto-discovery configured for API Manager integration.
9
+ */
10
+ class AutoDiscoveryRule extends BaseRule_1.BaseRule {
11
+ id = 'OPS-001';
12
+ name = 'Auto-Discovery Configuration';
13
+ description = 'APIs should have auto-discovery configured for API Manager';
14
+ severity = 'info';
15
+ category = 'standards';
16
+ validate(doc, _context) {
17
+ const issues = [];
18
+ // Check if this is an API (has APIKit router or HTTP listener)
19
+ const hasApiKitRouter = this.exists('//*[local-name()="router"]', doc);
20
+ const hasHttpListener = this.exists('//*[local-name()="listener"]', doc);
21
+ if (!hasApiKitRouter && !hasHttpListener) {
22
+ return issues; // Not an API, skip
23
+ }
24
+ // Check for auto-discovery configuration
25
+ const hasAutoDiscovery = this.exists('//*[local-name()="api-autodiscovery"]', doc);
26
+ if (!hasAutoDiscovery && hasApiKitRouter) {
27
+ issues.push(this.createFileIssue('API has no auto-discovery configuration for API Manager', {
28
+ suggestion: 'Add <api-gateway:autodiscovery> for API Manager integration',
29
+ }));
30
+ }
31
+ // If auto-discovery exists, check it uses placeholders
32
+ if (hasAutoDiscovery) {
33
+ const autodiscoveryNodes = this.select('//*[local-name()="api-autodiscovery"]', doc);
34
+ for (const node of autodiscoveryNodes) {
35
+ const apiId = this.getAttribute(node, 'apiId');
36
+ if (apiId && !apiId.includes('${')) {
37
+ issues.push(this.createIssue(node, 'Auto-discovery apiId should use a property placeholder', {
38
+ suggestion: 'Use apiId="${api.id}" instead of hardcoded value',
39
+ }));
40
+ }
41
+ }
42
+ }
43
+ return issues;
44
+ }
45
+ }
46
+ exports.AutoDiscoveryRule = AutoDiscoveryRule;
47
+ //# sourceMappingURL=AutoDiscoveryRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AutoDiscoveryRule.js","sourceRoot":"","sources":["../../../../src/rules/standards/AutoDiscoveryRule.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,MAAM,CAAC,IAAI,CACP,IAAI,CAAC,WAAW,CACZ,IAAI,EACJ,wDAAwD,EACxD;wBACI,UAAU,EAAE,kDAAkD;qBACjE,CACJ,CACJ,CAAC;gBACN,CAAC;YACL,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AAlDD,8CAkDC"}
@@ -0,0 +1,16 @@
1
+ import { ValidationContext, Issue } from '../../types';
2
+ import { BaseRule } from '../base/BaseRule';
3
+ /**
4
+ * OPS-003: Cron Expression Externalized
5
+ *
6
+ * Cron expressions in schedulers should use property placeholders.
7
+ */
8
+ export declare class CronExternalizedRule extends BaseRule {
9
+ id: string;
10
+ name: string;
11
+ description: string;
12
+ severity: "warning";
13
+ category: "standards";
14
+ validate(doc: Document, _context: ValidationContext): Issue[];
15
+ }
16
+ //# sourceMappingURL=CronExternalizedRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CronExternalizedRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/standards/CronExternalizedRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;GAIG;AACH,qBAAa,oBAAqB,SAAQ,QAAQ;IAC9C,EAAE,SAAa;IACf,IAAI,SAAkC;IACtC,WAAW,SAAuD;IAClE,QAAQ,EAAG,SAAS,CAAU;IAC9B,QAAQ,EAAG,WAAW,CAAU;IAEhC,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,KAAK,EAAE;CAqBhE"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CronExternalizedRule = void 0;
4
+ const BaseRule_1 = require("../base/BaseRule");
5
+ /**
6
+ * OPS-003: Cron Expression Externalized
7
+ *
8
+ * Cron expressions in schedulers should use property placeholders.
9
+ */
10
+ class CronExternalizedRule extends BaseRule_1.BaseRule {
11
+ id = 'OPS-003';
12
+ name = 'Externalized Cron Expression';
13
+ description = 'Cron expressions should use property placeholders';
14
+ severity = 'warning';
15
+ category = 'standards';
16
+ validate(doc, _context) {
17
+ const issues = [];
18
+ // Find scheduler cron expressions
19
+ const cronNodes = this.select('//*[local-name()="cron"]', doc);
20
+ for (const node of cronNodes) {
21
+ const expression = this.getAttribute(node, 'expression');
22
+ if (expression && !expression.includes('${')) {
23
+ issues.push(this.createIssue(node, `Hardcoded cron expression: "${expression}"`, {
24
+ suggestion: 'Use expression="${scheduler.cron}" to allow environment-specific scheduling',
25
+ }));
26
+ }
27
+ }
28
+ return issues;
29
+ }
30
+ }
31
+ exports.CronExternalizedRule = CronExternalizedRule;
32
+ //# sourceMappingURL=CronExternalizedRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CronExternalizedRule.js","sourceRoot":"","sources":["../../../../src/rules/standards/CronExternalizedRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C;;;;GAIG;AACH,MAAa,oBAAqB,SAAQ,mBAAQ;IAC9C,EAAE,GAAG,SAAS,CAAC;IACf,IAAI,GAAG,8BAA8B,CAAC;IACtC,WAAW,GAAG,mDAAmD,CAAC;IAClE,QAAQ,GAAG,SAAkB,CAAC;IAC9B,QAAQ,GAAG,WAAoB,CAAC;IAEhC,QAAQ,CAAC,GAAa,EAAE,QAA2B;QAC/C,MAAM,MAAM,GAAY,EAAE,CAAC;QAE3B,kCAAkC;QAClC,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,0BAA0B,EAAE,GAAG,CAAC,CAAC;QAE/D,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE,CAAC;YAC3B,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;YAEzD,IAAI,UAAU,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC3C,MAAM,CAAC,IAAI,CACP,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,+BAA+B,UAAU,GAAG,EAAE;oBACjE,UAAU,EACN,6EAA6E;iBACpF,CAAC,CACL,CAAC;YACN,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AA5BD,oDA4BC"}
@@ -0,0 +1,16 @@
1
+ import { ValidationContext, Issue } from '../../types';
2
+ import { BaseRule } from '../base/BaseRule';
3
+ /**
4
+ * OPS-002: HTTP Port Placeholder
5
+ *
6
+ * HTTP listener ports should use property placeholders, not hardcoded values.
7
+ */
8
+ export declare class HttpPortPlaceholderRule extends BaseRule {
9
+ id: string;
10
+ name: string;
11
+ description: string;
12
+ severity: "warning";
13
+ category: "standards";
14
+ validate(doc: Document, _context: ValidationContext): Issue[];
15
+ }
16
+ //# sourceMappingURL=HttpPortPlaceholderRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpPortPlaceholderRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/standards/HttpPortPlaceholderRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,QAAQ;IACjD,EAAE,SAAa;IACf,IAAI,SAA2B;IAC/B,WAAW,SAA0D;IACrE,QAAQ,EAAG,SAAS,CAAU;IAC9B,QAAQ,EAAG,WAAW,CAAU;IAEhC,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,KAAK,EAAE;CAsBhE"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HttpPortPlaceholderRule = void 0;
4
+ const BaseRule_1 = require("../base/BaseRule");
5
+ /**
6
+ * OPS-002: HTTP Port Placeholder
7
+ *
8
+ * HTTP listener ports should use property placeholders, not hardcoded values.
9
+ */
10
+ class HttpPortPlaceholderRule extends BaseRule_1.BaseRule {
11
+ id = 'OPS-002';
12
+ name = 'HTTP Port Placeholder';
13
+ description = 'HTTP listener ports should use property placeholders';
14
+ severity = 'warning';
15
+ category = 'standards';
16
+ validate(doc, _context) {
17
+ const issues = [];
18
+ // Check HTTP listener configurations
19
+ const listenerConfigs = this.select('//*[local-name()="listener-config"]', doc);
20
+ for (const config of listenerConfigs) {
21
+ const port = this.getAttribute(config, 'port');
22
+ if (port && /^\d+$/.test(port)) {
23
+ // Port is a hardcoded number
24
+ const name = this.getNameAttribute(config) ?? 'HTTP Listener Config';
25
+ issues.push(this.createIssue(config, `HTTP config "${name}" has hardcoded port "${port}"`, {
26
+ suggestion: 'Use port="${http.port}" or similar placeholder',
27
+ }));
28
+ }
29
+ }
30
+ return issues;
31
+ }
32
+ }
33
+ exports.HttpPortPlaceholderRule = HttpPortPlaceholderRule;
34
+ //# sourceMappingURL=HttpPortPlaceholderRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpPortPlaceholderRule.js","sourceRoot":"","sources":["../../../../src/rules/standards/HttpPortPlaceholderRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C;;;;GAIG;AACH,MAAa,uBAAwB,SAAQ,mBAAQ;IACjD,EAAE,GAAG,SAAS,CAAC;IACf,IAAI,GAAG,uBAAuB,CAAC;IAC/B,WAAW,GAAG,sDAAsD,CAAC;IACrE,QAAQ,GAAG,SAAkB,CAAC;IAC9B,QAAQ,GAAG,WAAoB,CAAC;IAEhC,QAAQ,CAAC,GAAa,EAAE,QAA2B;QAC/C,MAAM,MAAM,GAAY,EAAE,CAAC;QAE3B,qCAAqC;QACrC,MAAM,eAAe,GAAG,IAAI,CAAC,MAAM,CAAC,qCAAqC,EAAE,GAAG,CAAC,CAAC;QAEhF,KAAK,MAAM,MAAM,IAAI,eAAe,EAAE,CAAC;YACnC,MAAM,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YAE/C,IAAI,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC7B,6BAA6B;gBAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,IAAI,sBAAsB,CAAC;gBACrE,MAAM,CAAC,IAAI,CACP,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,gBAAgB,IAAI,yBAAyB,IAAI,GAAG,EAAE;oBAC3E,UAAU,EAAE,gDAAgD;iBAC/D,CAAC,CACL,CAAC;YACN,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AA7BD,0DA6BC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sfdxy/mule-lint",
3
- "version": "1.16.2",
3
+ "version": "1.17.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",
@@ -45,7 +45,8 @@
45
45
  "commander": "^11.1.0",
46
46
  "fast-glob": "^3.3.2",
47
47
  "js-yaml": "^4.1.1",
48
- "xpath": "^0.0.34"
48
+ "xpath": "^0.0.34",
49
+ "zod": "^3.25.0"
49
50
  },
50
51
  "devDependencies": {
51
52
  "@types/jest": "^29.5.11",