flowlint 0.5.3 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -355
- package/dist/cli.js +8053 -21
- package/dist/cli.js.map +1 -1
- package/package.json +52 -57
- package/dist/cli.d.ts +0 -8
- package/dist/commands/init.d.ts +0 -8
- package/dist/commands/init.js +0 -34
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/scan.d.ts +0 -11
- package/dist/commands/scan.js +0 -104
- package/dist/commands/scan.js.map +0 -1
- package/dist/packages/config/flowlint-config.d.ts +0 -73
- package/dist/packages/config/flowlint-config.js +0 -120
- package/dist/packages/config/flowlint-config.js.map +0 -1
- package/dist/packages/config/index.d.ts +0 -4
- package/dist/packages/config/index.js +0 -21
- package/dist/packages/config/index.js.map +0 -1
- package/dist/packages/github/client.d.ts +0 -2
- package/dist/packages/github/client.js +0 -94
- package/dist/packages/github/client.js.map +0 -1
- package/dist/packages/logger/index.d.ts +0 -11
- package/dist/packages/logger/index.js +0 -40
- package/dist/packages/logger/index.js.map +0 -1
- package/dist/packages/observability/collectors.d.ts +0 -40
- package/dist/packages/observability/collectors.js +0 -75
- package/dist/packages/observability/collectors.js.map +0 -1
- package/dist/packages/observability/index.d.ts +0 -10
- package/dist/packages/observability/index.js +0 -35
- package/dist/packages/observability/index.js.map +0 -1
- package/dist/packages/observability/metrics.d.ts +0 -119
- package/dist/packages/observability/metrics.js +0 -194
- package/dist/packages/observability/metrics.js.map +0 -1
- package/dist/packages/observability/middleware.d.ts +0 -32
- package/dist/packages/observability/middleware.js +0 -58
- package/dist/packages/observability/middleware.js.map +0 -1
- package/dist/packages/review/analysis-engine.d.ts +0 -19
- package/dist/packages/review/analysis-engine.js +0 -111
- package/dist/packages/review/analysis-engine.js.map +0 -1
- package/dist/packages/review/index.d.ts +0 -12
- package/dist/packages/review/index.js +0 -29
- package/dist/packages/review/index.js.map +0 -1
- package/dist/packages/review/parser-n8n.d.ts +0 -2
- package/dist/packages/review/parser-n8n.js +0 -122
- package/dist/packages/review/parser-n8n.js.map +0 -1
- package/dist/packages/review/providers/github.d.ts +0 -62
- package/dist/packages/review/providers/github.js +0 -275
- package/dist/packages/review/providers/github.js.map +0 -1
- package/dist/packages/review/providers.d.ts +0 -106
- package/dist/packages/review/providers.js +0 -12
- package/dist/packages/review/providers.js.map +0 -1
- package/dist/packages/review/reporter.d.ts +0 -17
- package/dist/packages/review/reporter.js +0 -59
- package/dist/packages/review/reporter.js.map +0 -1
- package/dist/packages/review/rules/index.d.ts +0 -9
- package/dist/packages/review/rules/index.js +0 -415
- package/dist/packages/review/rules/index.js.map +0 -1
- package/dist/packages/review/rules/rule-utils.d.ts +0 -36
- package/dist/packages/review/rules/rule-utils.js +0 -75
- package/dist/packages/review/rules/rule-utils.js.map +0 -1
- package/dist/packages/review/schemas/index.d.ts +0 -17
- package/dist/packages/review/schemas/index.js +0 -167
- package/dist/packages/review/schemas/index.js.map +0 -1
- package/dist/packages/review/schemas/n8n-workflow.schema.json +0 -177
- package/dist/packages/review/sniffer.d.ts +0 -15
- package/dist/packages/review/sniffer.js +0 -47
- package/dist/packages/review/sniffer.js.map +0 -1
- package/dist/packages/review/types.d.ts +0 -40
- package/dist/packages/review/types.js +0 -3
- package/dist/packages/review/types.js.map +0 -1
- package/dist/packages/review/utils/findings.d.ts +0 -23
- package/dist/packages/review/utils/findings.js +0 -34
- package/dist/packages/review/utils/findings.js.map +0 -1
- package/dist/packages/review/utils/merge.d.ts +0 -12
- package/dist/packages/review/utils/merge.js +0 -40
- package/dist/packages/review/utils/merge.js.map +0 -1
- package/dist/packages/review/utils.d.ts +0 -60
- package/dist/packages/review/utils.js +0 -214
- package/dist/packages/review/utils.js.map +0 -1
- package/dist/packages/tracing/github-tracer.d.ts +0 -38
- package/dist/packages/tracing/github-tracer.js +0 -79
- package/dist/packages/tracing/github-tracer.js.map +0 -1
- package/dist/packages/tracing/index.d.ts +0 -81
- package/dist/packages/tracing/index.js +0 -240
- package/dist/packages/tracing/index.js.map +0 -1
- package/dist/packages/tracing/tracer.d.ts +0 -30
- package/dist/packages/tracing/tracer.js +0 -141
- package/dist/packages/tracing/tracer.js.map +0 -1
- package/dist/providers/local-config-provider.d.ts +0 -11
- package/dist/providers/local-config-provider.js +0 -39
- package/dist/providers/local-config-provider.js.map +0 -1
- package/dist/providers/local-file-source.d.ts +0 -13
- package/dist/providers/local-file-source.js +0 -47
- package/dist/providers/local-file-source.js.map +0 -1
- package/dist/reporters/console-reporter.d.ts +0 -8
- package/dist/reporters/console-reporter.js +0 -75
- package/dist/reporters/console-reporter.js.map +0 -1
- package/dist/reporters/github-actions-reporter.d.ts +0 -30
- package/dist/reporters/github-actions-reporter.js +0 -104
- package/dist/reporters/github-actions-reporter.js.map +0 -1
- package/dist/reporters/json-reporter.d.ts +0 -14
- package/dist/reporters/json-reporter.js +0 -57
- package/dist/reporters/json-reporter.js.map +0 -1
- package/dist/reporters/junit-reporter.d.ts +0 -25
- package/dist/reporters/junit-reporter.js +0 -142
- package/dist/reporters/junit-reporter.js.map +0 -1
- package/dist/reporters/sarif-reporter.d.ts +0 -21
- package/dist/reporters/sarif-reporter.js +0 -125
- package/dist/reporters/sarif-reporter.js.map +0 -1
|
@@ -1,40 +0,0 @@
|
|
|
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.logger = void 0;
|
|
7
|
-
exports.createChildLogger = createChildLogger;
|
|
8
|
-
exports.createCorrelatedLogger = createCorrelatedLogger;
|
|
9
|
-
const pino_1 = __importDefault(require("pino"));
|
|
10
|
-
// Create base logger with environment-aware configuration
|
|
11
|
-
exports.logger = (0, pino_1.default)({
|
|
12
|
-
level: process.env.LOG_LEVEL || 'info',
|
|
13
|
-
transport: process.env.NODE_ENV === 'development'
|
|
14
|
-
? {
|
|
15
|
-
target: 'pino-pretty',
|
|
16
|
-
options: {
|
|
17
|
-
colorize: true,
|
|
18
|
-
translateTime: 'HH:MM:ss',
|
|
19
|
-
ignore: 'pid,hostname',
|
|
20
|
-
},
|
|
21
|
-
}
|
|
22
|
-
: undefined,
|
|
23
|
-
});
|
|
24
|
-
/**
|
|
25
|
-
* Create a child logger with additional context.
|
|
26
|
-
* Use this to add correlation IDs, request IDs, or other contextual metadata.
|
|
27
|
-
*/
|
|
28
|
-
function createChildLogger(context) {
|
|
29
|
-
return exports.logger.child(context);
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Create a logger with correlation ID for tracking requests across API → Queue → Worker.
|
|
33
|
-
*/
|
|
34
|
-
function createCorrelatedLogger(correlationId, additionalContext) {
|
|
35
|
-
return exports.logger.child({
|
|
36
|
-
correlationId,
|
|
37
|
-
...additionalContext,
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/logger/index.ts"],"names":[],"mappings":";;;;;;AAsBA,8CAEC;AAKD,wDAKC;AAlCD,gDAAwB;AAExB,0DAA0D;AAC7C,QAAA,MAAM,GAAG,IAAA,cAAI,EAAC;IACzB,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,MAAM;IACtC,SAAS,EACP,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa;QACpC,CAAC,CAAC;YACE,MAAM,EAAE,aAAa;YACrB,OAAO,EAAE;gBACP,QAAQ,EAAE,IAAI;gBACd,aAAa,EAAE,UAAU;gBACzB,MAAM,EAAE,cAAc;aACvB;SACF;QACH,CAAC,CAAC,SAAS;CAChB,CAAC,CAAC;AAEH;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,OAAgC;IAChE,OAAO,cAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAC/B,CAAC;AAED;;GAEG;AACH,SAAgB,sBAAsB,CAAC,aAAqB,EAAE,iBAA2C;IACvG,OAAO,cAAM,CAAC,KAAK,CAAC;QAClB,aAAa;QACb,GAAG,iBAAiB;KACrB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Metric Collectors for FlowLint
|
|
3
|
-
*
|
|
4
|
-
* This module implements periodic metric collectors that query external systems
|
|
5
|
-
* (e.g., BullMQ queue) and update gauge metrics.
|
|
6
|
-
*
|
|
7
|
-
* @module packages/observability/collectors
|
|
8
|
-
*/
|
|
9
|
-
import { Queue } from 'bullmq';
|
|
10
|
-
/**
|
|
11
|
-
* Queue Metrics Collector
|
|
12
|
-
*
|
|
13
|
-
* Periodically queries BullMQ queue for depth by state and updates Prometheus gauges.
|
|
14
|
-
* Runs every 10 seconds to provide near-real-time queue visibility.
|
|
15
|
-
*
|
|
16
|
-
* @param queue - BullMQ queue instance
|
|
17
|
-
* @returns Interval timer (for cleanup)
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* import { Queue } from 'bullmq';
|
|
21
|
-
* import { startQueueMetricsCollector } from './packages/observability/collectors';
|
|
22
|
-
*
|
|
23
|
-
* const queue = new Queue('pr-review', { connection: redis });
|
|
24
|
-
* const collectorInterval = startQueueMetricsCollector(queue);
|
|
25
|
-
*
|
|
26
|
-
* // Later, to stop collector:
|
|
27
|
-
* clearInterval(collectorInterval);
|
|
28
|
-
*/
|
|
29
|
-
export declare function startQueueMetricsCollector(queue: Queue<any>): NodeJS.Timeout;
|
|
30
|
-
/**
|
|
31
|
-
* Stop queue metrics collector
|
|
32
|
-
*
|
|
33
|
-
* Clears the interval timer to stop metric collection.
|
|
34
|
-
*
|
|
35
|
-
* @param interval - Interval timer from startQueueMetricsCollector
|
|
36
|
-
*
|
|
37
|
-
* @example
|
|
38
|
-
* stopQueueMetricsCollector(collectorInterval);
|
|
39
|
-
*/
|
|
40
|
-
export declare function stopQueueMetricsCollector(interval: NodeJS.Timeout): void;
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Metric Collectors for FlowLint
|
|
4
|
-
*
|
|
5
|
-
* This module implements periodic metric collectors that query external systems
|
|
6
|
-
* (e.g., BullMQ queue) and update gauge metrics.
|
|
7
|
-
*
|
|
8
|
-
* @module packages/observability/collectors
|
|
9
|
-
*/
|
|
10
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.startQueueMetricsCollector = startQueueMetricsCollector;
|
|
12
|
-
exports.stopQueueMetricsCollector = stopQueueMetricsCollector;
|
|
13
|
-
const metrics_1 = require("./metrics");
|
|
14
|
-
const logger_1 = require("../logger");
|
|
15
|
-
const logger = (0, logger_1.createChildLogger)({ component: 'observability:collectors' });
|
|
16
|
-
/**
|
|
17
|
-
* Queue Metrics Collector
|
|
18
|
-
*
|
|
19
|
-
* Periodically queries BullMQ queue for depth by state and updates Prometheus gauges.
|
|
20
|
-
* Runs every 10 seconds to provide near-real-time queue visibility.
|
|
21
|
-
*
|
|
22
|
-
* @param queue - BullMQ queue instance
|
|
23
|
-
* @returns Interval timer (for cleanup)
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* import { Queue } from 'bullmq';
|
|
27
|
-
* import { startQueueMetricsCollector } from './packages/observability/collectors';
|
|
28
|
-
*
|
|
29
|
-
* const queue = new Queue('pr-review', { connection: redis });
|
|
30
|
-
* const collectorInterval = startQueueMetricsCollector(queue);
|
|
31
|
-
*
|
|
32
|
-
* // Later, to stop collector:
|
|
33
|
-
* clearInterval(collectorInterval);
|
|
34
|
-
*/
|
|
35
|
-
function startQueueMetricsCollector(queue) {
|
|
36
|
-
logger.info('Starting queue metrics collector (10s interval)');
|
|
37
|
-
const updateQueueMetrics = async () => {
|
|
38
|
-
try {
|
|
39
|
-
// Get job counts from BullMQ queue
|
|
40
|
-
// getJobCounts() returns: { waiting, active, completed, failed, delayed, paused }
|
|
41
|
-
const counts = await queue.getJobCounts();
|
|
42
|
-
// Update gauges for each state
|
|
43
|
-
metrics_1.queueDepthGauge.set({ state: 'waiting' }, counts.waiting || 0);
|
|
44
|
-
metrics_1.queueDepthGauge.set({ state: 'active' }, counts.active || 0);
|
|
45
|
-
metrics_1.queueDepthGauge.set({ state: 'failed' }, counts.failed || 0);
|
|
46
|
-
metrics_1.queueDepthGauge.set({ state: 'delayed' }, counts.delayed || 0);
|
|
47
|
-
metrics_1.queueDepthGauge.set({ state: 'paused' }, counts.paused || 0);
|
|
48
|
-
logger.debug({ counts }, 'Queue metrics updated');
|
|
49
|
-
}
|
|
50
|
-
catch (error) {
|
|
51
|
-
// Don't crash if queue is temporarily unavailable
|
|
52
|
-
logger.warn({ error }, 'Failed to update queue metrics');
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
// Initial update (don't wait 10 seconds for first metrics)
|
|
56
|
-
updateQueueMetrics();
|
|
57
|
-
// Update every 10 seconds
|
|
58
|
-
const interval = setInterval(updateQueueMetrics, 10000);
|
|
59
|
-
return interval;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Stop queue metrics collector
|
|
63
|
-
*
|
|
64
|
-
* Clears the interval timer to stop metric collection.
|
|
65
|
-
*
|
|
66
|
-
* @param interval - Interval timer from startQueueMetricsCollector
|
|
67
|
-
*
|
|
68
|
-
* @example
|
|
69
|
-
* stopQueueMetricsCollector(collectorInterval);
|
|
70
|
-
*/
|
|
71
|
-
function stopQueueMetricsCollector(interval) {
|
|
72
|
-
logger.info('Stopping queue metrics collector');
|
|
73
|
-
clearInterval(interval);
|
|
74
|
-
}
|
|
75
|
-
//# sourceMappingURL=collectors.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"collectors.js","sourceRoot":"","sources":["../../../packages/observability/collectors.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;AA2BH,gEA8BC;A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,kBAAkB,EAAE,CAAC;IAErB,0BAA0B;IAC1B,MAAM,QAAQ,GAAG,WAAW,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;IAExD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;;;;;GASG;AACH,SAAgB,yBAAyB,CAAC,QAAwB;IAChE,MAAM,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;IAChD,aAAa,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* FlowLint Observability Package
|
|
3
|
-
*
|
|
4
|
-
* Provides Prometheus metrics collection and exposure for FlowLint.
|
|
5
|
-
*
|
|
6
|
-
* @module packages/observability
|
|
7
|
-
*/
|
|
8
|
-
export { register, webhookCounter, jobsQueuedCounter, jobsCompletedCounter, jobDurationHistogram, queueDepthGauge, githubApiCallsCounter, findingsGeneratedCounter, redisOpsCounter, httpRequestDuration, getMetrics, getContentType, clearMetrics, getMetric } from './metrics';
|
|
9
|
-
export { metricsMiddleware, metricsErrorHandler } from './middleware';
|
|
10
|
-
export { startQueueMetricsCollector, stopQueueMetricsCollector } from './collectors';
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* FlowLint Observability Package
|
|
4
|
-
*
|
|
5
|
-
* Provides Prometheus metrics collection and exposure for FlowLint.
|
|
6
|
-
*
|
|
7
|
-
* @module packages/observability
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.stopQueueMetricsCollector = exports.startQueueMetricsCollector = exports.metricsErrorHandler = exports.metricsMiddleware = exports.getMetric = exports.clearMetrics = exports.getContentType = exports.getMetrics = exports.httpRequestDuration = exports.redisOpsCounter = exports.findingsGeneratedCounter = exports.githubApiCallsCounter = exports.queueDepthGauge = exports.jobDurationHistogram = exports.jobsCompletedCounter = exports.jobsQueuedCounter = exports.webhookCounter = exports.register = void 0;
|
|
11
|
-
// Export all metrics
|
|
12
|
-
var metrics_1 = require("./metrics");
|
|
13
|
-
Object.defineProperty(exports, "register", { enumerable: true, get: function () { return metrics_1.register; } });
|
|
14
|
-
Object.defineProperty(exports, "webhookCounter", { enumerable: true, get: function () { return metrics_1.webhookCounter; } });
|
|
15
|
-
Object.defineProperty(exports, "jobsQueuedCounter", { enumerable: true, get: function () { return metrics_1.jobsQueuedCounter; } });
|
|
16
|
-
Object.defineProperty(exports, "jobsCompletedCounter", { enumerable: true, get: function () { return metrics_1.jobsCompletedCounter; } });
|
|
17
|
-
Object.defineProperty(exports, "jobDurationHistogram", { enumerable: true, get: function () { return metrics_1.jobDurationHistogram; } });
|
|
18
|
-
Object.defineProperty(exports, "queueDepthGauge", { enumerable: true, get: function () { return metrics_1.queueDepthGauge; } });
|
|
19
|
-
Object.defineProperty(exports, "githubApiCallsCounter", { enumerable: true, get: function () { return metrics_1.githubApiCallsCounter; } });
|
|
20
|
-
Object.defineProperty(exports, "findingsGeneratedCounter", { enumerable: true, get: function () { return metrics_1.findingsGeneratedCounter; } });
|
|
21
|
-
Object.defineProperty(exports, "redisOpsCounter", { enumerable: true, get: function () { return metrics_1.redisOpsCounter; } });
|
|
22
|
-
Object.defineProperty(exports, "httpRequestDuration", { enumerable: true, get: function () { return metrics_1.httpRequestDuration; } });
|
|
23
|
-
Object.defineProperty(exports, "getMetrics", { enumerable: true, get: function () { return metrics_1.getMetrics; } });
|
|
24
|
-
Object.defineProperty(exports, "getContentType", { enumerable: true, get: function () { return metrics_1.getContentType; } });
|
|
25
|
-
Object.defineProperty(exports, "clearMetrics", { enumerable: true, get: function () { return metrics_1.clearMetrics; } });
|
|
26
|
-
Object.defineProperty(exports, "getMetric", { enumerable: true, get: function () { return metrics_1.getMetric; } });
|
|
27
|
-
// Export middleware
|
|
28
|
-
var middleware_1 = require("./middleware");
|
|
29
|
-
Object.defineProperty(exports, "metricsMiddleware", { enumerable: true, get: function () { return middleware_1.metricsMiddleware; } });
|
|
30
|
-
Object.defineProperty(exports, "metricsErrorHandler", { enumerable: true, get: function () { return middleware_1.metricsErrorHandler; } });
|
|
31
|
-
// Export collectors
|
|
32
|
-
var collectors_1 = require("./collectors");
|
|
33
|
-
Object.defineProperty(exports, "startQueueMetricsCollector", { enumerable: true, get: function () { return collectors_1.startQueueMetricsCollector; } });
|
|
34
|
-
Object.defineProperty(exports, "stopQueueMetricsCollector", { enumerable: true, get: function () { return collectors_1.stopQueueMetricsCollector; } });
|
|
35
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/observability/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,qBAAqB;AACrB,qCAemB;AAdjB,mGAAA,QAAQ,OAAA;AACR,yGAAA,cAAc,OAAA;AACd,4GAAA,iBAAiB,OAAA;AACjB,+GAAA,oBAAoB,OAAA;AACpB,+GAAA,oBAAoB,OAAA;AACpB,0GAAA,eAAe,OAAA;AACf,gHAAA,qBAAqB,OAAA;AACrB,mHAAA,wBAAwB,OAAA;AACxB,0GAAA,eAAe,OAAA;AACf,8GAAA,mBAAmB,OAAA;AACnB,qGAAA,UAAU,OAAA;AACV,yGAAA,cAAc,OAAA;AACd,uGAAA,YAAY,OAAA;AACZ,oGAAA,SAAS,OAAA;AAGX,oBAAoB;AACpB,2CAAsE;AAA7D,+GAAA,iBAAiB,OAAA;AAAE,iHAAA,mBAAmB,OAAA;AAE/C,oBAAoB;AACpB,2CAAqF;AAA5E,wHAAA,0BAA0B,OAAA;AAAE,uHAAA,yBAAyB,OAAA"}
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Prometheus Metrics Definitions for FlowLint
|
|
3
|
-
*
|
|
4
|
-
* This module defines all custom Prometheus metrics for FlowLint observability.
|
|
5
|
-
* Metrics follow Prometheus naming conventions and are designed for low cardinality.
|
|
6
|
-
*
|
|
7
|
-
* @module packages/observability/metrics
|
|
8
|
-
*/
|
|
9
|
-
import { Registry, Counter, Histogram, Gauge } from 'prom-client';
|
|
10
|
-
export declare const register: Registry<"text/plain; version=0.0.4; charset=utf-8">;
|
|
11
|
-
/**
|
|
12
|
-
* Metric 1: Webhook Counter
|
|
13
|
-
*
|
|
14
|
-
* Tracks total webhooks received from GitHub, labeled by event type and action.
|
|
15
|
-
*
|
|
16
|
-
* Example usage:
|
|
17
|
-
* webhookCounter.labels('pull_request', 'opened').inc();
|
|
18
|
-
*/
|
|
19
|
-
export declare const webhookCounter: Counter<"event_type" | "action">;
|
|
20
|
-
/**
|
|
21
|
-
* Metric 2: Jobs Queued Counter
|
|
22
|
-
*
|
|
23
|
-
* Tracks total review jobs added to BullMQ queue.
|
|
24
|
-
*
|
|
25
|
-
* Example usage:
|
|
26
|
-
* jobsQueuedCounter.labels('acme-corp/api-gateway').inc();
|
|
27
|
-
*/
|
|
28
|
-
export declare const jobsQueuedCounter: Counter<"repo">;
|
|
29
|
-
/**
|
|
30
|
-
* Metric 3: Jobs Completed Counter
|
|
31
|
-
*
|
|
32
|
-
* Tracks total review jobs completed (success or failure).
|
|
33
|
-
*
|
|
34
|
-
* Example usage:
|
|
35
|
-
* jobsCompletedCounter.labels('success', 'acme-corp/api-gateway').inc();
|
|
36
|
-
*/
|
|
37
|
-
export declare const jobsCompletedCounter: Counter<"repo" | "status">;
|
|
38
|
-
/**
|
|
39
|
-
* Metric 4: Job Duration Histogram
|
|
40
|
-
*
|
|
41
|
-
* Distribution of job processing time in seconds.
|
|
42
|
-
* Buckets optimized for typical workflow review times (0.1s to 120s).
|
|
43
|
-
*
|
|
44
|
-
* Example usage:
|
|
45
|
-
* const timer = jobDurationHistogram.startTimer({ repo: 'acme-corp/api-gateway' });
|
|
46
|
-
* // ... process job
|
|
47
|
-
* timer(); // Records duration
|
|
48
|
-
*/
|
|
49
|
-
export declare const jobDurationHistogram: Histogram<"repo">;
|
|
50
|
-
/**
|
|
51
|
-
* Metric 5: Queue Depth Gauge
|
|
52
|
-
*
|
|
53
|
-
* Current number of jobs in queue by state.
|
|
54
|
-
* Updated periodically by collector (every 10 seconds).
|
|
55
|
-
*
|
|
56
|
-
* Example usage:
|
|
57
|
-
* queueDepthGauge.set({ state: 'waiting' }, 10);
|
|
58
|
-
*/
|
|
59
|
-
export declare const queueDepthGauge: Gauge<"state">;
|
|
60
|
-
/**
|
|
61
|
-
* Metric 6: GitHub API Calls Counter
|
|
62
|
-
*
|
|
63
|
-
* Tracks GitHub API calls made by FlowLint, labeled by method and status.
|
|
64
|
-
*
|
|
65
|
-
* Example usage:
|
|
66
|
-
* githubApiCallsCounter.labels('GET', '200', '/repos/:owner/:repo/pulls/:number/files').inc();
|
|
67
|
-
*/
|
|
68
|
-
export declare const githubApiCallsCounter: Counter<"status" | "method" | "endpoint">;
|
|
69
|
-
/**
|
|
70
|
-
* Metric 7: Findings Generated Counter
|
|
71
|
-
*
|
|
72
|
-
* Tracks lint findings generated, labeled by rule and severity.
|
|
73
|
-
*
|
|
74
|
-
* Example usage:
|
|
75
|
-
* findingsGeneratedCounter.labels('rate_limit_retry', 'must').inc();
|
|
76
|
-
*/
|
|
77
|
-
export declare const findingsGeneratedCounter: Counter<"rule" | "severity">;
|
|
78
|
-
/**
|
|
79
|
-
* Metric 8: Redis Operations Counter (Optional)
|
|
80
|
-
*
|
|
81
|
-
* Tracks Redis operations performed by BullMQ.
|
|
82
|
-
*
|
|
83
|
-
* Example usage:
|
|
84
|
-
* redisOpsCounter.labels('zadd', 'success').inc();
|
|
85
|
-
*/
|
|
86
|
-
export declare const redisOpsCounter: Counter<"status" | "operation">;
|
|
87
|
-
/**
|
|
88
|
-
* HTTP Request Duration Histogram
|
|
89
|
-
*
|
|
90
|
-
* Automatically populated by metricsMiddleware.
|
|
91
|
-
* Tracks HTTP request latency by method, route, and status.
|
|
92
|
-
*/
|
|
93
|
-
export declare const httpRequestDuration: Histogram<"status" | "method" | "route">;
|
|
94
|
-
/**
|
|
95
|
-
* Get all metrics in Prometheus exposition format
|
|
96
|
-
*
|
|
97
|
-
* @returns Prometheus-formatted metrics string
|
|
98
|
-
*/
|
|
99
|
-
export declare function getMetrics(): Promise<string>;
|
|
100
|
-
/**
|
|
101
|
-
* Get metrics content type header
|
|
102
|
-
*
|
|
103
|
-
* @returns Prometheus content type string
|
|
104
|
-
*/
|
|
105
|
-
export declare function getContentType(): string;
|
|
106
|
-
/**
|
|
107
|
-
* Clear all metrics (useful for testing)
|
|
108
|
-
*
|
|
109
|
-
* WARNING: This removes all metrics from the registry.
|
|
110
|
-
* Only use in test environments.
|
|
111
|
-
*/
|
|
112
|
-
export declare function clearMetrics(): void;
|
|
113
|
-
/**
|
|
114
|
-
* Get single metric by name (for testing)
|
|
115
|
-
*
|
|
116
|
-
* @param name - Metric name
|
|
117
|
-
* @returns Metric instance or undefined
|
|
118
|
-
*/
|
|
119
|
-
export declare function getMetric(name: string): import("prom-client").Metric<string> | undefined;
|
|
@@ -1,194 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../../packages/observability/metrics.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAsKH,gCAEC;AAOD,wCA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AAE,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"}
|
|
@@ -1,32 +0,0 @@
|
|
|
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;
|
|
@@ -1,58 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,19 +0,0 @@
|
|
|
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
|
-
}
|