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.
Files changed (108) hide show
  1. package/README.md +45 -355
  2. package/dist/cli.js +8053 -21
  3. package/dist/cli.js.map +1 -1
  4. package/package.json +52 -57
  5. package/dist/cli.d.ts +0 -8
  6. package/dist/commands/init.d.ts +0 -8
  7. package/dist/commands/init.js +0 -34
  8. package/dist/commands/init.js.map +0 -1
  9. package/dist/commands/scan.d.ts +0 -11
  10. package/dist/commands/scan.js +0 -104
  11. package/dist/commands/scan.js.map +0 -1
  12. package/dist/packages/config/flowlint-config.d.ts +0 -73
  13. package/dist/packages/config/flowlint-config.js +0 -120
  14. package/dist/packages/config/flowlint-config.js.map +0 -1
  15. package/dist/packages/config/index.d.ts +0 -4
  16. package/dist/packages/config/index.js +0 -21
  17. package/dist/packages/config/index.js.map +0 -1
  18. package/dist/packages/github/client.d.ts +0 -2
  19. package/dist/packages/github/client.js +0 -94
  20. package/dist/packages/github/client.js.map +0 -1
  21. package/dist/packages/logger/index.d.ts +0 -11
  22. package/dist/packages/logger/index.js +0 -40
  23. package/dist/packages/logger/index.js.map +0 -1
  24. package/dist/packages/observability/collectors.d.ts +0 -40
  25. package/dist/packages/observability/collectors.js +0 -75
  26. package/dist/packages/observability/collectors.js.map +0 -1
  27. package/dist/packages/observability/index.d.ts +0 -10
  28. package/dist/packages/observability/index.js +0 -35
  29. package/dist/packages/observability/index.js.map +0 -1
  30. package/dist/packages/observability/metrics.d.ts +0 -119
  31. package/dist/packages/observability/metrics.js +0 -194
  32. package/dist/packages/observability/metrics.js.map +0 -1
  33. package/dist/packages/observability/middleware.d.ts +0 -32
  34. package/dist/packages/observability/middleware.js +0 -58
  35. package/dist/packages/observability/middleware.js.map +0 -1
  36. package/dist/packages/review/analysis-engine.d.ts +0 -19
  37. package/dist/packages/review/analysis-engine.js +0 -111
  38. package/dist/packages/review/analysis-engine.js.map +0 -1
  39. package/dist/packages/review/index.d.ts +0 -12
  40. package/dist/packages/review/index.js +0 -29
  41. package/dist/packages/review/index.js.map +0 -1
  42. package/dist/packages/review/parser-n8n.d.ts +0 -2
  43. package/dist/packages/review/parser-n8n.js +0 -122
  44. package/dist/packages/review/parser-n8n.js.map +0 -1
  45. package/dist/packages/review/providers/github.d.ts +0 -62
  46. package/dist/packages/review/providers/github.js +0 -275
  47. package/dist/packages/review/providers/github.js.map +0 -1
  48. package/dist/packages/review/providers.d.ts +0 -106
  49. package/dist/packages/review/providers.js +0 -12
  50. package/dist/packages/review/providers.js.map +0 -1
  51. package/dist/packages/review/reporter.d.ts +0 -17
  52. package/dist/packages/review/reporter.js +0 -59
  53. package/dist/packages/review/reporter.js.map +0 -1
  54. package/dist/packages/review/rules/index.d.ts +0 -9
  55. package/dist/packages/review/rules/index.js +0 -415
  56. package/dist/packages/review/rules/index.js.map +0 -1
  57. package/dist/packages/review/rules/rule-utils.d.ts +0 -36
  58. package/dist/packages/review/rules/rule-utils.js +0 -75
  59. package/dist/packages/review/rules/rule-utils.js.map +0 -1
  60. package/dist/packages/review/schemas/index.d.ts +0 -17
  61. package/dist/packages/review/schemas/index.js +0 -167
  62. package/dist/packages/review/schemas/index.js.map +0 -1
  63. package/dist/packages/review/schemas/n8n-workflow.schema.json +0 -177
  64. package/dist/packages/review/sniffer.d.ts +0 -15
  65. package/dist/packages/review/sniffer.js +0 -47
  66. package/dist/packages/review/sniffer.js.map +0 -1
  67. package/dist/packages/review/types.d.ts +0 -40
  68. package/dist/packages/review/types.js +0 -3
  69. package/dist/packages/review/types.js.map +0 -1
  70. package/dist/packages/review/utils/findings.d.ts +0 -23
  71. package/dist/packages/review/utils/findings.js +0 -34
  72. package/dist/packages/review/utils/findings.js.map +0 -1
  73. package/dist/packages/review/utils/merge.d.ts +0 -12
  74. package/dist/packages/review/utils/merge.js +0 -40
  75. package/dist/packages/review/utils/merge.js.map +0 -1
  76. package/dist/packages/review/utils.d.ts +0 -60
  77. package/dist/packages/review/utils.js +0 -214
  78. package/dist/packages/review/utils.js.map +0 -1
  79. package/dist/packages/tracing/github-tracer.d.ts +0 -38
  80. package/dist/packages/tracing/github-tracer.js +0 -79
  81. package/dist/packages/tracing/github-tracer.js.map +0 -1
  82. package/dist/packages/tracing/index.d.ts +0 -81
  83. package/dist/packages/tracing/index.js +0 -240
  84. package/dist/packages/tracing/index.js.map +0 -1
  85. package/dist/packages/tracing/tracer.d.ts +0 -30
  86. package/dist/packages/tracing/tracer.js +0 -141
  87. package/dist/packages/tracing/tracer.js.map +0 -1
  88. package/dist/providers/local-config-provider.d.ts +0 -11
  89. package/dist/providers/local-config-provider.js +0 -39
  90. package/dist/providers/local-config-provider.js.map +0 -1
  91. package/dist/providers/local-file-source.d.ts +0 -13
  92. package/dist/providers/local-file-source.js +0 -47
  93. package/dist/providers/local-file-source.js.map +0 -1
  94. package/dist/reporters/console-reporter.d.ts +0 -8
  95. package/dist/reporters/console-reporter.js +0 -75
  96. package/dist/reporters/console-reporter.js.map +0 -1
  97. package/dist/reporters/github-actions-reporter.d.ts +0 -30
  98. package/dist/reporters/github-actions-reporter.js +0 -104
  99. package/dist/reporters/github-actions-reporter.js.map +0 -1
  100. package/dist/reporters/json-reporter.d.ts +0 -14
  101. package/dist/reporters/json-reporter.js +0 -57
  102. package/dist/reporters/json-reporter.js.map +0 -1
  103. package/dist/reporters/junit-reporter.d.ts +0 -25
  104. package/dist/reporters/junit-reporter.js +0 -142
  105. package/dist/reporters/junit-reporter.js.map +0 -1
  106. package/dist/reporters/sarif-reporter.d.ts +0 -21
  107. package/dist/reporters/sarif-reporter.js +0 -125
  108. package/dist/reporters/sarif-reporter.js.map +0 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # FlowLint CLI
1
+ # FlowLint CLI
2
2
 
3
- Static analysis tool for n8n workflows - detect issues early, fix them faster.
3
+ Command-line tool for static analysis of n8n workflows.
4
4
 
5
5
  ## Installation
6
6
 
@@ -8,391 +8,81 @@ Static analysis tool for n8n workflows - detect issues early, fix them faster.
8
8
  npm install -g flowlint
9
9
  ```
10
10
 
11
- Or use with npx (no installation required):
11
+ Or use npx:
12
12
 
13
13
  ```bash
14
- npx flowlint scan ./workflows
14
+ npx flowlint scan .
15
15
  ```
16
16
 
17
- ## Quick Start
17
+ ## Usage
18
18
 
19
- Scan workflows in the current directory:
19
+ ### Scan workflows
20
20
 
21
21
  ```bash
22
- flowlint scan .
23
- ```
24
-
25
- Scan a specific directory:
26
-
27
- ```bash
28
- flowlint scan ./workflows
29
- ```
30
-
31
- Scan with a custom config file:
32
-
33
- ```bash
34
- flowlint scan . --config .flowlint.yml
35
- ```
36
-
37
- ## Output Formats
38
-
39
- FlowLint supports multiple output formats for different use cases:
40
-
41
- ### Stylish (Default)
42
-
43
- Human-readable console output with colors and formatting:
44
-
45
- ```bash
46
- flowlint scan .
47
- ```
48
-
49
- ### JSON
50
-
51
- Machine-readable JSON output:
52
-
53
- ```bash
54
- flowlint scan . --format json
55
- flowlint scan . --format json --out-file report.json
56
- ```
57
-
58
- ### SARIF
59
-
60
- SARIF 2.1.0 format for GitHub Code Scanning and other security platforms:
61
-
62
- ```bash
63
- flowlint scan . --format sarif --out-file results.sarif
64
- ```
65
-
66
- ### JUnit XML
67
-
68
- JUnit XML format for CI/CD platforms (Jenkins, GitLab CI, CircleCI, etc.):
69
-
70
- ```bash
71
- flowlint scan . --format junit --out-file results.xml
72
- ```
73
-
74
- ### GitHub Actions
75
-
76
- GitHub Actions workflow commands for inline annotations in workflow logs:
77
-
78
- ```bash
79
- flowlint scan . --format github-actions
80
- ```
81
-
82
- ## Command Reference
83
-
84
- ### `scan`
85
-
86
- Scan workflow files for issues.
87
-
88
- ```bash
89
- flowlint scan [path] [options]
90
- ```
91
-
92
- **Arguments:**
93
- - `path` - Directory to scan (default: current directory)
94
-
95
- **Options:**
96
- - `--config <path>` - Path to `.flowlint.yml` config file
97
- - `--format <format>` - Output format: `stylish`, `json`, `sarif`, `junit`, `github-actions` (default: `stylish`)
98
- - `--out-file <path>` - Write results to file (format inferred from extension or `--format`)
99
- - `--fail-on-error` - Exit with code 1 if errors found
100
-
101
- **Examples:**
102
-
103
- ```bash
104
- # Scan current directory with default config
22
+ # Scan current directory
105
23
  flowlint scan
106
24
 
107
25
  # Scan specific directory
108
- flowlint scan ./my-workflows
109
-
110
- # Use custom config
111
- flowlint scan --config custom-config.yml
112
-
113
- # Output JSON to file
114
- flowlint scan --format json --out-file report.json
115
-
116
- # Generate SARIF for GitHub Code Scanning
117
- flowlint scan --format sarif --out-file results.sarif
26
+ flowlint scan ./workflows
118
27
 
119
- # Generate JUnit XML for Jenkins
120
- flowlint scan --format junit --out-file test-results.xml
28
+ # Output as JSON
29
+ flowlint scan --format json
121
30
 
122
- # Fail CI build if errors found
31
+ # Fail on errors (for CI)
123
32
  flowlint scan --fail-on-error
124
33
  ```
125
34
 
126
- ## CI/CD Integration
127
-
128
- ### GitHub Actions
129
-
130
- #### Option 1: SARIF Upload (Recommended)
131
-
132
- Upload results to GitHub Code Scanning for permanent PR annotations:
133
-
134
- ```yaml
135
- name: FlowLint
136
-
137
- on:
138
- pull_request:
139
- paths:
140
- - '**.json'
141
-
142
- jobs:
143
- flowlint:
144
- runs-on: ubuntu-latest
145
- permissions:
146
- contents: read
147
- security-events: write # Required for SARIF upload
148
- steps:
149
- - uses: actions/checkout@v4
150
-
151
- - name: Run FlowLint
152
- run: npx flowlint scan --format sarif --out-file results.sarif
153
- continue-on-error: true # Don't fail workflow on findings
154
-
155
- - name: Upload SARIF results
156
- uses: github/codeql-action/upload-sarif@v3
157
- if: always()
158
- with:
159
- sarif_file: results.sarif
160
- ```
161
-
162
- #### Option 2: Workflow Annotations
163
-
164
- Show findings directly in workflow logs:
35
+ ### Initialize configuration
165
36
 
166
- ```yaml
167
- name: FlowLint
168
-
169
- on:
170
- pull_request:
171
- paths:
172
- - '**.json'
173
-
174
- jobs:
175
- flowlint:
176
- runs-on: ubuntu-latest
177
- steps:
178
- - uses: actions/checkout@v4
179
-
180
- - name: Run FlowLint
181
- run: npx flowlint scan --format github-actions --fail-on-error
182
- ```
183
-
184
- #### Option 3: Both (Best of Both Worlds)
185
-
186
- Combine both approaches for immediate feedback and permanent annotations:
187
-
188
- ```yaml
189
- name: FlowLint
190
-
191
- on:
192
- pull_request:
193
- paths:
194
- - '**.json'
195
-
196
- jobs:
197
- flowlint:
198
- runs-on: ubuntu-latest
199
- permissions:
200
- contents: read
201
- security-events: write
202
- steps:
203
- - uses: actions/checkout@v4
204
-
205
- - name: Run FlowLint (Workflow Annotations)
206
- run: npx flowlint scan --format github-actions
207
- continue-on-error: true
208
-
209
- - name: Run FlowLint (SARIF)
210
- run: npx flowlint scan --format sarif --out-file results.sarif
211
- continue-on-error: true
212
-
213
- - name: Upload SARIF results
214
- uses: github/codeql-action/upload-sarif@v3
215
- if: always()
216
- with:
217
- sarif_file: results.sarif
218
-
219
- - name: Check for blocking issues
220
- run: npx flowlint scan --fail-on-error
221
- ```
222
-
223
- ### GitLab CI
224
-
225
- ```yaml
226
- flowlint:
227
- stage: test
228
- image: node:22
229
- script:
230
- - npx flowlint scan --format junit --out-file flowlint-results.xml
231
- artifacts:
232
- when: always
233
- reports:
234
- junit: flowlint-results.xml
235
- ```
236
-
237
- ### Jenkins
238
-
239
- ```groovy
240
- pipeline {
241
- agent any
242
-
243
- stages {
244
- stage('FlowLint') {
245
- steps {
246
- sh 'npx flowlint scan --format junit --out-file flowlint-results.xml'
247
- }
248
- post {
249
- always {
250
- junit 'flowlint-results.xml'
251
- }
252
- }
253
- }
254
- }
255
- }
256
- ```
257
-
258
- ### CircleCI
259
-
260
- ```yaml
261
- version: 2.1
262
-
263
- jobs:
264
- flowlint:
265
- docker:
266
- - image: cimg/node:22.0
267
- steps:
268
- - checkout
269
- - run:
270
- name: Run FlowLint
271
- command: npx flowlint scan --format junit --out-file test-results/flowlint.xml
272
- - store_test_results:
273
- path: test-results
37
+ ```bash
38
+ flowlint init
274
39
  ```
275
40
 
276
- ### Azure Pipelines
277
-
278
- ```yaml
279
- trigger:
280
- branches:
281
- include:
282
- - main
283
- - develop
284
-
285
- pool:
286
- vmImage: 'ubuntu-latest'
287
-
288
- steps:
289
- - task: NodeTool@0
290
- inputs:
291
- versionSpec: '22.x'
292
-
293
- - script: npx flowlint scan --format junit --out-file flowlint-results.xml
294
- displayName: 'Run FlowLint'
295
-
296
- - task: PublishTestResults@2
297
- condition: always()
298
- inputs:
299
- testResultsFormat: 'JUnit'
300
- testResultsFiles: 'flowlint-results.xml'
301
- failTaskOnFailedTests: true
302
- ```
41
+ Creates a `.flowlint.yml` file in the current directory.
303
42
 
304
43
  ## Configuration
305
44
 
306
- Create a `.flowlint.yml` file in your repository root:
45
+ Create a `.flowlint.yml` file:
307
46
 
308
47
  ```yaml
309
48
  files:
310
49
  include:
311
- - '**/*.json'
50
+ - "**/*.n8n.json"
312
51
  ignore:
313
- - 'node_modules/**'
314
- - 'dist/**'
315
-
316
- report:
317
- annotations: true
318
- summary_limit: 100
52
+ - "node_modules/**"
319
53
 
320
54
  rules:
321
- R1:
55
+ rate_limit_retry:
322
56
  enabled: true
323
- R2:
57
+ error_handling:
324
58
  enabled: true
325
- # ... etc
326
- ```
327
-
328
- See [FlowLint documentation](https://flowlint.dev) for complete configuration reference.
329
-
330
- ## Exit Codes
331
-
332
- - `0` - Success (no errors or only warnings/suggestions)
333
- - `1` - Analysis found blocking issues (when using `--fail-on-error`)
334
- - `2` - Runtime error (invalid config, file not found, etc.)
335
-
336
- ## Rule Severity Levels
337
-
338
- - **must** - Blocks PR (errors) - Critical issues that must be fixed
339
- - **should** - Warnings - Important issues that should be addressed
340
- - **nit** - Suggestions - Minor improvements
341
-
342
- ## Supported Rules
343
-
344
- FlowLint currently implements the following rules:
345
-
346
- - **R1** - Rate Limit & Retry
347
- - **R2** - Error Handling
348
- - **R3** - Idempotency
349
- - **R4** - Secrets
350
- - **R5** - Dead Ends
351
- - **R6** - Long Running
352
- - **R7** - Alert/Log Enforcement
353
- - **R8** - Unused Data
354
- - **R9** - Config Literals
355
- - **R10** - Naming Convention
356
- - **R11** - Deprecated Nodes
357
- - **R12** - Unhandled Error Path
358
- - **R13** - Webhook Acknowledgment
359
- - **R14** - HTTP Retry-After Compliance
360
-
361
- See [RULES.md](https://github.com/Replikanti/flowlint-examples/blob/main/README.md) for detailed rule documentation.
362
-
363
- ## Troubleshooting
59
+ # ... more rules
60
+ ```
61
+
62
+ ## Rules
63
+
64
+ | Rule | Description | Severity |
65
+ |------|-------------|----------|
66
+ | R1 | Rate limit retry | must |
67
+ | R2 | Error handling | must |
68
+ | R3 | Idempotency | should |
69
+ | R4 | Secrets exposure | must |
70
+ | R5 | Dead ends | nit |
71
+ | R6 | Long running | should |
72
+ | R7 | Alert/log enforcement | should |
73
+ | R8 | Unused data | nit |
74
+ | R9 | Config literals | should |
75
+ | R10 | Naming convention | nit |
76
+ | R11 | Deprecated nodes | should |
77
+ | R12 | Unhandled error path | must |
78
+ | R13 | Webhook acknowledgment | must |
79
+ | R14 | Retry-After compliance | should |
364
80
 
365
- ### No workflows found
366
-
367
- Make sure your workflow files match the glob patterns in `.flowlint.yml`:
368
-
369
- ```yaml
370
- files:
371
- include:
372
- - '**/*.json' # Adjust pattern as needed
373
- ```
374
-
375
- ### SARIF upload fails in GitHub Actions
376
-
377
- Ensure you have the correct permissions:
378
-
379
- ```yaml
380
- permissions:
381
- contents: read
382
- security-events: write # Required for SARIF upload
383
- ```
384
-
385
- ### JUnit results not showing in CI
386
-
387
- Make sure the file path in your CI configuration matches the `--out-file` path.
81
+ ## License
388
82
 
389
- ## Links
83
+ MIT
390
84
 
391
- - [Documentation](https://flowlint.dev)
392
- - [GitHub Repository](https://github.com/Replikanti/flowlint-app)
393
- - [Issue Tracker](https://github.com/Replikanti/flowlint-app/issues)
394
- - [npm Package](https://www.npmjs.com/package/flowlint)
395
85
 
396
- ## License
86
+ ## Dependencies
397
87
 
398
- MIT
88
+ This tool depends on [@replikanti/flowlint-core](https://www.npmjs.com/package/@replikanti/flowlint-core) for linting logic.