flowlint 0.3.2 → 0.3.3

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 (77) hide show
  1. package/dist/packages/config/flowlint-config.d.ts +64 -0
  2. package/dist/packages/config/flowlint-config.js +103 -0
  3. package/dist/packages/config/flowlint-config.js.map +1 -0
  4. package/dist/packages/config/index.d.ts +4 -0
  5. package/dist/packages/config/index.js +21 -0
  6. package/dist/packages/config/index.js.map +1 -0
  7. package/dist/packages/github/client.d.ts +2 -0
  8. package/dist/packages/github/client.js +94 -0
  9. package/dist/packages/github/client.js.map +1 -0
  10. package/dist/packages/logger/index.d.ts +11 -0
  11. package/dist/packages/logger/index.js +40 -0
  12. package/dist/packages/logger/index.js.map +1 -0
  13. package/dist/packages/observability/collectors.d.ts +40 -0
  14. package/dist/packages/observability/collectors.js +75 -0
  15. package/dist/packages/observability/collectors.js.map +1 -0
  16. package/dist/packages/observability/index.d.ts +10 -0
  17. package/dist/packages/observability/index.js +35 -0
  18. package/dist/packages/observability/index.js.map +1 -0
  19. package/dist/packages/observability/metrics.d.ts +119 -0
  20. package/dist/packages/observability/metrics.js +194 -0
  21. package/dist/packages/observability/metrics.js.map +1 -0
  22. package/dist/packages/observability/middleware.d.ts +32 -0
  23. package/dist/packages/observability/middleware.js +58 -0
  24. package/dist/packages/observability/middleware.js.map +1 -0
  25. package/dist/packages/review/analysis-engine.d.ts +19 -0
  26. package/dist/packages/review/analysis-engine.js +111 -0
  27. package/dist/packages/review/analysis-engine.js.map +1 -0
  28. package/dist/packages/review/index.d.ts +12 -0
  29. package/dist/packages/review/index.js +29 -0
  30. package/dist/packages/review/index.js.map +1 -0
  31. package/dist/packages/review/parser-n8n.d.ts +2 -0
  32. package/dist/packages/review/parser-n8n.js +118 -0
  33. package/dist/packages/review/parser-n8n.js.map +1 -0
  34. package/dist/packages/review/providers/github.d.ts +62 -0
  35. package/dist/packages/review/providers/github.js +275 -0
  36. package/dist/packages/review/providers/github.js.map +1 -0
  37. package/dist/packages/review/providers.d.ts +106 -0
  38. package/dist/packages/review/providers.js +12 -0
  39. package/dist/packages/review/providers.js.map +1 -0
  40. package/dist/packages/review/reporter.d.ts +17 -0
  41. package/dist/packages/review/reporter.js +62 -0
  42. package/dist/packages/review/reporter.js.map +1 -0
  43. package/dist/packages/review/rules/index.d.ts +9 -0
  44. package/dist/packages/review/rules/index.js +313 -0
  45. package/dist/packages/review/rules/index.js.map +1 -0
  46. package/dist/packages/review/rules/rule-utils.d.ts +36 -0
  47. package/dist/packages/review/rules/rule-utils.js +75 -0
  48. package/dist/packages/review/rules/rule-utils.js.map +1 -0
  49. package/dist/packages/review/schemas/index.d.ts +17 -0
  50. package/dist/packages/review/schemas/index.js +139 -0
  51. package/dist/packages/review/schemas/index.js.map +1 -0
  52. package/dist/packages/review/schemas/n8n-workflow.schema.json +177 -0
  53. package/dist/packages/review/sniffer.d.ts +15 -0
  54. package/dist/packages/review/sniffer.js +47 -0
  55. package/dist/packages/review/sniffer.js.map +1 -0
  56. package/dist/packages/review/types.d.ts +38 -0
  57. package/dist/packages/review/types.js +3 -0
  58. package/dist/packages/review/types.js.map +1 -0
  59. package/dist/packages/review/utils/findings.d.ts +23 -0
  60. package/dist/packages/review/utils/findings.js +34 -0
  61. package/dist/packages/review/utils/findings.js.map +1 -0
  62. package/dist/packages/review/utils/merge.d.ts +12 -0
  63. package/dist/packages/review/utils/merge.js +40 -0
  64. package/dist/packages/review/utils/merge.js.map +1 -0
  65. package/dist/packages/review/utils.d.ts +60 -0
  66. package/dist/packages/review/utils.js +214 -0
  67. package/dist/packages/review/utils.js.map +1 -0
  68. package/dist/packages/tracing/github-tracer.d.ts +38 -0
  69. package/dist/packages/tracing/github-tracer.js +79 -0
  70. package/dist/packages/tracing/github-tracer.js.map +1 -0
  71. package/dist/packages/tracing/index.d.ts +81 -0
  72. package/dist/packages/tracing/index.js +240 -0
  73. package/dist/packages/tracing/index.js.map +1 -0
  74. package/dist/packages/tracing/tracer.d.ts +30 -0
  75. package/dist/packages/tracing/tracer.js +141 -0
  76. package/dist/packages/tracing/tracer.js.map +1 -0
  77. package/package.json +1 -1
@@ -0,0 +1,194 @@
1
+ "use strict";
2
+ /**
3
+ * Prometheus Metrics Definitions for FlowLint
4
+ *
5
+ * This module defines all custom Prometheus metrics for FlowLint observability.
6
+ * Metrics follow Prometheus naming conventions and are designed for low cardinality.
7
+ *
8
+ * @module packages/observability/metrics
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.httpRequestDuration = exports.redisOpsCounter = exports.findingsGeneratedCounter = exports.githubApiCallsCounter = exports.queueDepthGauge = exports.jobDurationHistogram = exports.jobsCompletedCounter = exports.jobsQueuedCounter = exports.webhookCounter = exports.register = void 0;
12
+ exports.getMetrics = getMetrics;
13
+ exports.getContentType = getContentType;
14
+ exports.clearMetrics = clearMetrics;
15
+ exports.getMetric = getMetric;
16
+ const prom_client_1 = require("prom-client");
17
+ // Create dedicated registry for FlowLint metrics
18
+ exports.register = new prom_client_1.Registry();
19
+ // Enable default process and Node.js metrics
20
+ (0, prom_client_1.collectDefaultMetrics)({ register: exports.register });
21
+ // ============================================================================
22
+ // Custom Application Metrics
23
+ // ============================================================================
24
+ /**
25
+ * Metric 1: Webhook Counter
26
+ *
27
+ * Tracks total webhooks received from GitHub, labeled by event type and action.
28
+ *
29
+ * Example usage:
30
+ * webhookCounter.labels('pull_request', 'opened').inc();
31
+ */
32
+ exports.webhookCounter = new prom_client_1.Counter({
33
+ name: 'flowlint_webhook_received_total',
34
+ help: 'Total number of webhooks received from GitHub',
35
+ labelNames: ['event_type', 'action'],
36
+ registers: [exports.register]
37
+ });
38
+ /**
39
+ * Metric 2: Jobs Queued Counter
40
+ *
41
+ * Tracks total review jobs added to BullMQ queue.
42
+ *
43
+ * Example usage:
44
+ * jobsQueuedCounter.labels('acme-corp/api-gateway').inc();
45
+ */
46
+ exports.jobsQueuedCounter = new prom_client_1.Counter({
47
+ name: 'flowlint_jobs_queued_total',
48
+ help: 'Total number of review jobs queued for processing',
49
+ labelNames: ['repo'],
50
+ registers: [exports.register]
51
+ });
52
+ /**
53
+ * Metric 3: Jobs Completed Counter
54
+ *
55
+ * Tracks total review jobs completed (success or failure).
56
+ *
57
+ * Example usage:
58
+ * jobsCompletedCounter.labels('success', 'acme-corp/api-gateway').inc();
59
+ */
60
+ exports.jobsCompletedCounter = new prom_client_1.Counter({
61
+ name: 'flowlint_jobs_completed_total',
62
+ help: 'Total number of review jobs completed',
63
+ labelNames: ['status', 'repo'],
64
+ registers: [exports.register]
65
+ });
66
+ /**
67
+ * Metric 4: Job Duration Histogram
68
+ *
69
+ * Distribution of job processing time in seconds.
70
+ * Buckets optimized for typical workflow review times (0.1s to 120s).
71
+ *
72
+ * Example usage:
73
+ * const timer = jobDurationHistogram.startTimer({ repo: 'acme-corp/api-gateway' });
74
+ * // ... process job
75
+ * timer(); // Records duration
76
+ */
77
+ exports.jobDurationHistogram = new prom_client_1.Histogram({
78
+ name: 'flowlint_job_duration_seconds',
79
+ help: 'Duration of job processing in seconds',
80
+ labelNames: ['repo'],
81
+ buckets: [0.1, 0.5, 1, 2, 5, 10, 30, 60, 120],
82
+ registers: [exports.register]
83
+ });
84
+ /**
85
+ * Metric 5: Queue Depth Gauge
86
+ *
87
+ * Current number of jobs in queue by state.
88
+ * Updated periodically by collector (every 10 seconds).
89
+ *
90
+ * Example usage:
91
+ * queueDepthGauge.set({ state: 'waiting' }, 10);
92
+ */
93
+ exports.queueDepthGauge = new prom_client_1.Gauge({
94
+ name: 'flowlint_queue_depth',
95
+ help: 'Current number of jobs in queue by state',
96
+ labelNames: ['state'],
97
+ registers: [exports.register]
98
+ });
99
+ /**
100
+ * Metric 6: GitHub API Calls Counter
101
+ *
102
+ * Tracks GitHub API calls made by FlowLint, labeled by method and status.
103
+ *
104
+ * Example usage:
105
+ * githubApiCallsCounter.labels('GET', '200', '/repos/:owner/:repo/pulls/:number/files').inc();
106
+ */
107
+ exports.githubApiCallsCounter = new prom_client_1.Counter({
108
+ name: 'flowlint_github_api_calls_total',
109
+ help: 'Total GitHub API calls made by FlowLint',
110
+ labelNames: ['method', 'status', 'endpoint'],
111
+ registers: [exports.register]
112
+ });
113
+ /**
114
+ * Metric 7: Findings Generated Counter
115
+ *
116
+ * Tracks lint findings generated, labeled by rule and severity.
117
+ *
118
+ * Example usage:
119
+ * findingsGeneratedCounter.labels('rate_limit_retry', 'must').inc();
120
+ */
121
+ exports.findingsGeneratedCounter = new prom_client_1.Counter({
122
+ name: 'flowlint_findings_generated_total',
123
+ help: 'Total lint findings generated by rule and severity',
124
+ labelNames: ['rule', 'severity'],
125
+ registers: [exports.register]
126
+ });
127
+ /**
128
+ * Metric 8: Redis Operations Counter (Optional)
129
+ *
130
+ * Tracks Redis operations performed by BullMQ.
131
+ *
132
+ * Example usage:
133
+ * redisOpsCounter.labels('zadd', 'success').inc();
134
+ */
135
+ exports.redisOpsCounter = new prom_client_1.Counter({
136
+ name: 'flowlint_redis_operations_total',
137
+ help: 'Total Redis operations performed',
138
+ labelNames: ['operation', 'status'],
139
+ registers: [exports.register]
140
+ });
141
+ // ============================================================================
142
+ // HTTP Metrics (Automatic via middleware)
143
+ // ============================================================================
144
+ /**
145
+ * HTTP Request Duration Histogram
146
+ *
147
+ * Automatically populated by metricsMiddleware.
148
+ * Tracks HTTP request latency by method, route, and status.
149
+ */
150
+ exports.httpRequestDuration = new prom_client_1.Histogram({
151
+ name: 'http_request_duration_seconds',
152
+ help: 'Duration of HTTP requests in seconds',
153
+ labelNames: ['method', 'route', 'status'],
154
+ buckets: [0.001, 0.005, 0.01, 0.05, 0.1, 0.5, 1, 5],
155
+ registers: [exports.register]
156
+ });
157
+ // ============================================================================
158
+ // Utility Functions
159
+ // ============================================================================
160
+ /**
161
+ * Get all metrics in Prometheus exposition format
162
+ *
163
+ * @returns Prometheus-formatted metrics string
164
+ */
165
+ async function getMetrics() {
166
+ return exports.register.metrics();
167
+ }
168
+ /**
169
+ * Get metrics content type header
170
+ *
171
+ * @returns Prometheus content type string
172
+ */
173
+ function getContentType() {
174
+ return exports.register.contentType;
175
+ }
176
+ /**
177
+ * Clear all metrics (useful for testing)
178
+ *
179
+ * WARNING: This removes all metrics from the registry.
180
+ * Only use in test environments.
181
+ */
182
+ function clearMetrics() {
183
+ exports.register.clear();
184
+ }
185
+ /**
186
+ * Get single metric by name (for testing)
187
+ *
188
+ * @param name - Metric name
189
+ * @returns Metric instance or undefined
190
+ */
191
+ function getMetric(name) {
192
+ return exports.register.getSingleMetric(name);
193
+ }
194
+ //# sourceMappingURL=metrics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../../packages/observability/metrics.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAsKH,gCAEC;AAOD,wCAEC;AAQD,oCAEC;AAQD,8BAEC;AAnMD,6CAAyF;AAEzF,iDAAiD;AACpC,QAAA,QAAQ,GAAG,IAAI,sBAAQ,EAAE,CAAC;AAEvC,6CAA6C;AAC7C,IAAA,mCAAqB,EAAC,EAAE,QAAQ,EAAR,gBAAQ,EAAE,CAAC,CAAC;AAEpC,+EAA+E;AAC/E,6BAA6B;AAC7B,+EAA+E;AAE/E;;;;;;;GAOG;AACU,QAAA,cAAc,GAAG,IAAI,qBAAO,CAAC;IACxC,IAAI,EAAE,iCAAiC;IACvC,IAAI,EAAE,+CAA+C;IACrD,UAAU,EAAE,CAAC,YAAY,EAAE,QAAQ,CAAC;IACpC,SAAS,EAAE,CAAC,gBAAQ,CAAC;CACtB,CAAC,CAAC;AAEH;;;;;;;GAOG;AACU,QAAA,iBAAiB,GAAG,IAAI,qBAAO,CAAC;IAC3C,IAAI,EAAE,4BAA4B;IAClC,IAAI,EAAE,mDAAmD;IACzD,UAAU,EAAE,CAAC,MAAM,CAAC;IACpB,SAAS,EAAE,CAAC,gBAAQ,CAAC;CACtB,CAAC,CAAC;AAEH;;;;;;;GAOG;AACU,QAAA,oBAAoB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QAAA,eAAe,GAAG,IAAI,qBAAO,CAAC;IACzC,IAAI,EAAE,iCAAiC;IACvC,IAAI,EAAE,kCAAkC;IACxC,UAAU,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC;IACnC,SAAS,EAAE,CAAC,gBAAQ,CAAC;CACtB,CAAC,CAAC;AAEH,+EAA+E;AAC/E,0CAA0C;AAC1C,+EAA+E;AAE/E;;;;;GAKG;AACU,QAAA,mBAAmB,GAAG,IAAI,uBAAS,CAAC;IAC/C,IAAI,EAAE,+BAA+B;IACrC,IAAI,EAAE,sCAAsC;IAC5C,UAAU,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC;IACzC,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;IACnD,SAAS,EAAE,CAAC,gBAAQ,CAAC;CACtB,CAAC,CAAC;AAEH,+EAA+E;AAC/E,oBAAoB;AACpB,+EAA+E;AAE/E;;;;GAIG;AACI,KAAK,UAAU,UAAU;IAC9B,OAAO,gBAAQ,CAAC,OAAO,EAAE,CAAC;AAC5B,CAAC;AAED;;;;GAIG;AACH,SAAgB,cAAc;IAC5B,OAAO,gBAAQ,CAAC,WAAW,CAAC;AAC9B,CAAC;AAED;;;;;GAKG;AACH,SAAgB,YAAY;IAC1B,gBAAQ,CAAC,KAAK,EAAE,CAAC;AACnB,CAAC;AAED;;;;;GAKG;AACH,SAAgB,SAAS,CAAC,IAAY;IACpC,OAAO,gBAAQ,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AACxC,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Express Middleware for HTTP Metrics Collection
3
+ *
4
+ * This middleware automatically tracks HTTP request metrics including:
5
+ * - Request duration (latency)
6
+ * - Request count by method, route, status
7
+ *
8
+ * @module packages/observability/middleware
9
+ */
10
+ import { Request, Response, NextFunction } from 'express';
11
+ /**
12
+ * Express middleware to collect HTTP request metrics
13
+ *
14
+ * Automatically instruments all HTTP requests with Prometheus metrics.
15
+ * Metrics are labeled by HTTP method, route path, and response status code.
16
+ *
17
+ * Usage:
18
+ * import { metricsMiddleware } from './packages/observability/middleware';
19
+ * app.use(metricsMiddleware);
20
+ *
21
+ * @param req - Express request object
22
+ * @param res - Express response object
23
+ * @param next - Express next function
24
+ */
25
+ export declare function metricsMiddleware(req: Request, res: Response, next: NextFunction): void;
26
+ /**
27
+ * Middleware error handler
28
+ *
29
+ * Ensures metrics failures don't crash the application.
30
+ * Logs errors and continues processing.
31
+ */
32
+ export declare function metricsErrorHandler(err: Error, req: Request, res: Response, next: NextFunction): void;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ /**
3
+ * Express Middleware for HTTP Metrics Collection
4
+ *
5
+ * This middleware automatically tracks HTTP request metrics including:
6
+ * - Request duration (latency)
7
+ * - Request count by method, route, status
8
+ *
9
+ * @module packages/observability/middleware
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.metricsMiddleware = metricsMiddleware;
13
+ exports.metricsErrorHandler = metricsErrorHandler;
14
+ const metrics_1 = require("./metrics");
15
+ /**
16
+ * Express middleware to collect HTTP request metrics
17
+ *
18
+ * Automatically instruments all HTTP requests with Prometheus metrics.
19
+ * Metrics are labeled by HTTP method, route path, and response status code.
20
+ *
21
+ * Usage:
22
+ * import { metricsMiddleware } from './packages/observability/middleware';
23
+ * app.use(metricsMiddleware);
24
+ *
25
+ * @param req - Express request object
26
+ * @param res - Express response object
27
+ * @param next - Express next function
28
+ */
29
+ function metricsMiddleware(req, res, next) {
30
+ // Start timer for this request
31
+ const timer = metrics_1.httpRequestDuration.startTimer({
32
+ method: req.method,
33
+ route: req.route?.path || req.path,
34
+ status: '0' // Will be updated on response finish
35
+ });
36
+ // Record duration when response finishes
37
+ res.on('finish', () => {
38
+ try {
39
+ timer({ status: res.statusCode.toString() });
40
+ }
41
+ catch (error) {
42
+ // Don't let metrics errors crash the application
43
+ console.error('Failed to record HTTP metrics:', error);
44
+ }
45
+ });
46
+ next();
47
+ }
48
+ /**
49
+ * Middleware error handler
50
+ *
51
+ * Ensures metrics failures don't crash the application.
52
+ * Logs errors and continues processing.
53
+ */
54
+ function metricsErrorHandler(err, req, res, next) {
55
+ console.error('Metrics middleware error:', err);
56
+ next(err); // Pass error to next error handler
57
+ }
58
+ //# sourceMappingURL=middleware.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"middleware.js","sourceRoot":"","sources":["../../../packages/observability/middleware.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AAmBH,8CAmBC;AAQD,kDAGC;AA9CD,uCAAgD;AAEhD;;;;;;;;;;;;;GAaG;AACH,SAAgB,iBAAiB,CAAC,GAAY,EAAE,GAAa,EAAE,IAAkB;IAC/E,+BAA+B;IAC/B,MAAM,KAAK,GAAG,6BAAmB,CAAC,UAAU,CAAC;QAC3C,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,IAAI,IAAI,GAAG,CAAC,IAAI;QAClC,MAAM,EAAE,GAAG,CAAC,qCAAqC;KAClD,CAAC,CAAC;IAEH,yCAAyC;IACzC,GAAG,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;QACpB,IAAI,CAAC;YACH,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAC/C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,iDAAiD;YACjD,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,KAAK,CAAC,CAAC;QACzD,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,IAAI,EAAE,CAAC;AACT,CAAC;AAED;;;;;GAKG;AACH,SAAgB,mBAAmB,CAAC,GAAU,EAAE,GAAY,EAAE,GAAa,EAAE,IAAkB;IAC7F,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,GAAG,CAAC,CAAC;IAChD,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,mCAAmC;AAChD,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * FlowLint Analysis Engine
3
+ *
4
+ * Orchestrates the linting workflow:
5
+ * 1. Load configuration
6
+ * 2. Fetch files to analyze
7
+ * 3. Parse each file into a graph
8
+ * 4. Run rules against the graph
9
+ * 5. Report results
10
+ */
11
+ import type { AnalysisEngine, AnalysisSummary, ConfigProvider, FileSource, Reporter } from './providers';
12
+ export declare class DefaultAnalysisEngine implements AnalysisEngine {
13
+ private fileSource;
14
+ private configProvider;
15
+ private reporter;
16
+ constructor(fileSource: FileSource, configProvider: ConfigProvider, reporter: Reporter);
17
+ analyze(): Promise<AnalysisSummary>;
18
+ private formatParseError;
19
+ }
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ /**
3
+ * FlowLint Analysis Engine
4
+ *
5
+ * Orchestrates the linting workflow:
6
+ * 1. Load configuration
7
+ * 2. Fetch files to analyze
8
+ * 3. Parse each file into a graph
9
+ * 4. Run rules against the graph
10
+ * 5. Report results
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.DefaultAnalysisEngine = void 0;
14
+ const parser_n8n_1 = require("./parser-n8n");
15
+ const rules_1 = require("./rules");
16
+ const schemas_1 = require("./schemas");
17
+ const logger_1 = require("../logger");
18
+ const findings_1 = require("./utils/findings");
19
+ const utils_1 = require("./utils");
20
+ class DefaultAnalysisEngine {
21
+ constructor(fileSource, configProvider, reporter) {
22
+ this.fileSource = fileSource;
23
+ this.configProvider = configProvider;
24
+ this.reporter = reporter;
25
+ }
26
+ async analyze() {
27
+ // 1. Load configuration
28
+ const cfg = await this.configProvider.load();
29
+ logger_1.logger.debug({ rules: Object.keys(cfg.rules) }, 'loaded configuration');
30
+ // 2. Fetch files to analyze
31
+ const files = await this.fileSource.getFiles(cfg.files);
32
+ logger_1.logger.info({ count: files.length }, 'fetched files for analysis');
33
+ // 3. Analyze each file
34
+ const results = [];
35
+ let errorCount = 0;
36
+ for (const file of files) {
37
+ try {
38
+ // Parse file to graph
39
+ const graph = (0, parser_n8n_1.parseN8n)(file.content);
40
+ logger_1.logger.debug({ file: file.path, nodes: graph.nodes.length }, 'parsed file');
41
+ // Run all rules
42
+ const findings = (0, rules_1.runAllRules)(graph, {
43
+ path: file.path,
44
+ cfg,
45
+ nodeLines: graph.meta.nodeLines,
46
+ });
47
+ // Inject documentation URLs into findings
48
+ findings.forEach((f) => {
49
+ f.documentationUrl = (0, utils_1.getExampleLink)(f.rule);
50
+ });
51
+ results.push({
52
+ file,
53
+ graph,
54
+ findings,
55
+ });
56
+ }
57
+ catch (error) {
58
+ errorCount++;
59
+ const message = error instanceof Error ? error.message : String(error);
60
+ const raw_details = this.formatParseError(error);
61
+ logger_1.logger.warn({ file: file.path, error: message }, 'failed to parse file');
62
+ // Add error finding
63
+ const errorFinding = {
64
+ rule: 'PARSE',
65
+ severity: 'must',
66
+ path: file.path,
67
+ message,
68
+ raw_details,
69
+ line: 1,
70
+ };
71
+ results.push({
72
+ file,
73
+ graph: { nodes: [], edges: [], meta: {} },
74
+ findings: [errorFinding],
75
+ errors: [{ error: message, details: raw_details }],
76
+ });
77
+ }
78
+ }
79
+ // 4. Calculate summary
80
+ const allFindings = results.flatMap((r) => r.findings);
81
+ const summary = (0, findings_1.countFindingsBySeverity)(allFindings);
82
+ // 5. Report results
83
+ logger_1.logger.info({ totalResults: results.length, totalFindings: summary.total }, 'reporting results');
84
+ await this.reporter.report(results);
85
+ // 6. Return summary
86
+ return {
87
+ totalFiles: files.length,
88
+ totalFindings: summary.total,
89
+ findingsBySeverity: { must: summary.must, should: summary.should, nit: summary.nit },
90
+ errors: errorCount,
91
+ hasBlockingIssues: summary.must > 0,
92
+ };
93
+ }
94
+ formatParseError(error) {
95
+ if (error instanceof schemas_1.ValidationError && Array.isArray(error.errors) && error.errors.length > 0) {
96
+ return error.errors
97
+ .map((err) => {
98
+ const suggestion = err.suggestion ? ` (suggestion: ${err.suggestion})` : '';
99
+ return `- ${err.path}: ${err.message}${suggestion}`;
100
+ })
101
+ .join('\n')
102
+ .slice(0, 64000);
103
+ }
104
+ if (error instanceof Error && error.stack) {
105
+ return error.stack.slice(0, 64000);
106
+ }
107
+ return undefined;
108
+ }
109
+ }
110
+ exports.DefaultAnalysisEngine = DefaultAnalysisEngine;
111
+ //# sourceMappingURL=analysis-engine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analysis-engine.js","sourceRoot":"","sources":["../../../packages/review/analysis-engine.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAGH,6CAAwC;AACxC,mCAAsC;AACtC,uCAA4C;AAE5C,sCAAmC;AACnC,+CAA2D;AAC3D,mCAAyC;AAEzC,MAAa,qBAAqB;IAChC,YACU,UAAsB,EACtB,cAA8B,EAC9B,QAAkB;QAFlB,eAAU,GAAV,UAAU,CAAY;QACtB,mBAAc,GAAd,cAAc,CAAgB;QAC9B,aAAQ,GAAR,QAAQ,CAAU;IACzB,CAAC;IAEJ,KAAK,CAAC,OAAO;QACX,wBAAwB;QACxB,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC;QAC7C,eAAM,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,sBAAsB,CAAC,CAAC;QAExE,4BAA4B;QAC5B,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACxD,eAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE,4BAA4B,CAAC,CAAC;QAEnE,uBAAuB;QACvB,MAAM,OAAO,GAAqB,EAAE,CAAC;QACrC,IAAI,UAAU,GAAG,CAAC,CAAC;QAEnB,KAAK,MAAM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C,MAAM,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC/F,OAAO,KAAK,CAAC,MAAM;iBAChB,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;gBACX,MAAM,UAAU,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,iBAAiB,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC5E,OAAO,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,CAAC,OAAO,GAAG,UAAU,EAAE,CAAC;YACtD,CAAC,CAAC;iBACD,IAAI,CAAC,IAAI,CAAC;iBACV,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;QACrB,CAAC;QAED,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;YAC1C,OAAO,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;QACrC,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAxGD,sDAwGC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Main exports from packages/review
3
+ */
4
+ export * from './types';
5
+ export * from './providers';
6
+ export * from './analysis-engine';
7
+ export * from './parser-n8n';
8
+ export * from './rules';
9
+ export * from './reporter';
10
+ export * from './sniffer';
11
+ export * from './schemas';
12
+ export * from './providers/github';
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ /**
3
+ * Main exports from packages/review
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
17
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ __exportStar(require("./types"), exports);
21
+ __exportStar(require("./providers"), exports);
22
+ __exportStar(require("./analysis-engine"), exports);
23
+ __exportStar(require("./parser-n8n"), exports);
24
+ __exportStar(require("./rules"), exports);
25
+ __exportStar(require("./reporter"), exports);
26
+ __exportStar(require("./sniffer"), exports);
27
+ __exportStar(require("./schemas"), exports);
28
+ __exportStar(require("./providers/github"), exports);
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/review/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;AAEH,0CAAwB;AACxB,8CAA4B;AAC5B,oDAAkC;AAClC,+CAA6B;AAC7B,0CAAwB;AACxB,6CAA2B;AAC3B,4CAA0B;AAC1B,4CAA0B;AAC1B,qDAAmC"}
@@ -0,0 +1,2 @@
1
+ import type { Graph } from './types';
2
+ export declare function parseN8n(doc: string): Graph;
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.parseN8n = parseN8n;
7
+ const yaml_1 = __importDefault(require("yaml"));
8
+ const schemas_1 = require("./schemas");
9
+ const utils_1 = require("./utils");
10
+ function parseN8n(doc) {
11
+ let parsed;
12
+ try {
13
+ parsed = JSON.parse(doc);
14
+ }
15
+ catch {
16
+ parsed = yaml_1.default.parse(doc);
17
+ }
18
+ // Validate workflow structure before parsing
19
+ (0, schemas_1.validateN8nWorkflow)(parsed);
20
+ const nodes = parsed.nodes.map((node, idx) => {
21
+ const nodeId = node.id || node.name || `node-${idx}`;
22
+ const flags = {
23
+ continueOnFail: node.continueOnFail,
24
+ retryOnFail: node.retryOnFail ?? node.settings?.retryOnFail,
25
+ };
26
+ const hasFlags = flags.continueOnFail !== undefined || flags.retryOnFail !== undefined;
27
+ return {
28
+ id: nodeId,
29
+ type: node.type,
30
+ name: node.name,
31
+ params: node.parameters,
32
+ cred: node.credentials,
33
+ flags: hasFlags ? flags : undefined,
34
+ };
35
+ });
36
+ const nameToId = new Map();
37
+ for (const node of nodes) {
38
+ if (node.id)
39
+ nameToId.set(node.id, node.id);
40
+ if (node.name)
41
+ nameToId.set(node.name, node.id);
42
+ }
43
+ const lines = doc.split(/\r?\n/);
44
+ const idLine = new Map();
45
+ const nameLine = new Map();
46
+ lines.forEach((line, idx) => {
47
+ const idMatch = line.match(/"id":\s*"([^"]+)"/);
48
+ if (idMatch)
49
+ idLine.set(idMatch[1], idx + 1);
50
+ const nameMatch = line.match(/"name":\s*"([^"]+)"/);
51
+ if (nameMatch)
52
+ nameLine.set(nameMatch[1], idx + 1);
53
+ });
54
+ const nodeLines = new Map();
55
+ for (const node of nodes) {
56
+ const lineNumber = (node.name && nameLine.get(node.name)) || idLine.get(node.id);
57
+ if (lineNumber) {
58
+ nodeLines.set(node.id, lineNumber);
59
+ }
60
+ }
61
+ const nodeById = new Map();
62
+ for (const node of nodes) {
63
+ nodeById.set(node.id, node);
64
+ }
65
+ const resolveEdgeType = (connectionType, outputIndex, sourceType) => {
66
+ if (connectionType === 'error')
67
+ return 'error';
68
+ if (connectionType === 'timeout')
69
+ return 'timeout';
70
+ if (connectionType === 'main') {
71
+ if (typeof outputIndex === 'number' &&
72
+ outputIndex > 0 &&
73
+ sourceType &&
74
+ (0, utils_1.isErrorProneNode)(sourceType)) {
75
+ return 'error';
76
+ }
77
+ return 'success';
78
+ }
79
+ return 'success';
80
+ };
81
+ const edges = [];
82
+ Object.entries(parsed.connections || {}).forEach(([from, exits]) => {
83
+ if (!exits) {
84
+ return;
85
+ }
86
+ const exitChannels = exits;
87
+ Object.entries(exitChannels).forEach(([exitType, conn]) => {
88
+ const sourceId = nameToId.get(from) ?? from;
89
+ const sourceNode = nodeById.get(sourceId);
90
+ const enqueueEdges = (value, outputIndex) => {
91
+ (0, utils_1.flattenConnections)(value).forEach((link) => {
92
+ if (!link || typeof link !== 'object')
93
+ return;
94
+ const targetId = nameToId.get(link.node) ?? link.node;
95
+ if (!targetId)
96
+ return;
97
+ const edgeType = resolveEdgeType(exitType, outputIndex, sourceNode?.type);
98
+ edges.push({ from: sourceId, to: targetId, on: edgeType });
99
+ });
100
+ };
101
+ if (Array.isArray(conn)) {
102
+ conn.forEach((entry, index) => enqueueEdges(entry, index));
103
+ }
104
+ else {
105
+ enqueueEdges(conn);
106
+ }
107
+ });
108
+ });
109
+ return {
110
+ nodes,
111
+ edges,
112
+ meta: {
113
+ credentials: !!parsed.credentials,
114
+ nodeLines: Object.fromEntries(nodeLines),
115
+ },
116
+ };
117
+ }
118
+ //# sourceMappingURL=parser-n8n.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser-n8n.js","sourceRoot":"","sources":["../../../packages/review/parser-n8n.ts"],"names":[],"mappings":";;;;;AAKA,4BAsHC;AA3HD,gDAAwB;AAExB,uCAAgD;AAChD,mCAA+D;AAE/D,SAAgB,QAAQ,CAAC,GAAW;IAClC,IAAI,MAAW,CAAC;IAChB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,GAAG,cAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAED,6CAA6C;IAC7C,IAAA,6BAAmB,EAAC,MAAM,CAAC,CAAC;IAE5B,MAAM,KAAK,GAAc,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAS,EAAE,GAAW,EAAE,EAAE;QACnE,MAAM,MAAM,GAAG,IAAI,CAAC,EAAE,IAA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