Skip to content

Commit ae43d41

Browse files
committed
add examples to readme
1 parent 7eaf9e6 commit ae43d41

File tree

2 files changed

+34
-5
lines changed

2 files changed

+34
-5
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
## Table of contens
1616

1717
- **[Usage](#usage)**
18+
- [Examples](#examples)
1819
- **[Configuration](#configuration)**
1920
- [Scanner Options](#scanner-options)
2021
- **[Installation](#installation)**
@@ -45,6 +46,23 @@ Customize the scan behavior using the following options:
4546

4647
**Privacy:** Zero user data collected. All processing is client-side. → See Data Handling in our [Security Policy](https://github.com/Flow-Scanner/lightning-flow-scanner-cli?tab=security-ov-file).
4748

49+
### Examples
50+
51+
Quick local scan with JSON output
52+
```
53+
sf flow:scan -d ./flows --json
54+
```
55+
56+
CI/CD ready with SARIF
57+
```
58+
sf flow:scan -d src/flows --sarif > report.sarif
59+
```
60+
61+
Scan only two specific flows with beta rules
62+
```
63+
sf flow:scan -p "flows/Opportunity_Auto_Approve.flow-meta.xml" "flows/Case_Escalation.flow-meta.xml" -z --json
64+
```
65+
4866
---
4967

5068
## Configuration

src/commands/flow/scan.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,26 @@ export default class Scan extends SfCommand<Output> {
115115
this.error(`Scan failed: ${(err as Error).message}`);
116116
}
117117

118-
// BUILD RESULTS ONCE — AND ONLY ONCE
118+
// BUILD RESULTS
119119
const results = this.buildResults(scanResults);
120120

121-
// SARIF: now uses correct errorCounters
121+
// SARIF: output
122122
if (flags.sarif) {
123123
const sarif = await exportSarif(scanResults);
124-
process.stdout.write(sarif + '\n');
125-
process.exit(this.getStatus());
124+
this.log(sarif); // ← ONLY THIS WORKS reliably
125+
const status = this.getStatus();
126+
if (status > 0) {
127+
process.exitCode = status;
128+
}
129+
return {
130+
summary: {
131+
flowsNumber: scanResults.length,
132+
results: results.length,
133+
message: "SARIF output generated",
134+
},
135+
status,
136+
results: [],
137+
};
126138
}
127139

128140
this.debug(`scan results: ${scanResults.length}`, ...scanResults);
@@ -168,7 +180,6 @@ export default class Scan extends SfCommand<Output> {
168180
flowsNumber: scanResults.length,
169181
results: results.length,
170182
message: `A total of ${results.length} results have been found in ${scanResults.length} flows.`,
171-
errorLevelsDetails: Object.fromEntries(this.errorCounters),
172183
};
173184
return { summary, status, results };
174185
}

0 commit comments

Comments
 (0)