Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/icholy/semgrepx
xargs for semgrep
https://github.com/icholy/semgrepx
ai golang llm semgrep
Last synced: 23 days ago
JSON representation
xargs for semgrep
- Host: GitHub
- URL: https://github.com/icholy/semgrepx
- Owner: icholy
- Created: 2024-03-23T23:05:06.000Z (8 months ago)
- Default Branch: master
- Last Pushed: 2024-03-27T13:27:28.000Z (8 months ago)
- Last Synced: 2024-10-16T00:31:06.662Z (about 1 month ago)
- Topics: ai, golang, llm, semgrep
- Language: Go
- Homepage: https://choly.ca/post/semgrep-autofix-llm/
- Size: 445 KB
- Stars: 22
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SEMGREPX
> A tool for rewriting semgrep matches using externals tools
### Installation:
If you have a Go toolchain installed, you can install the `semgrepx` binary like this:
```sh
go install github.com/icholy/semgrepx@latest
```It will be placed in your `GOBIN` directory, which defaults to `~/go/bin`.
Depending on your install method, this may or may not already be in your `PATH`.### CLI:
```
Usage: semgrepx [flags] [args...]
flags:
-dir string
directory to run in (default ".")
-file string
semgrep json file
-lines
expand matches to full lines
-retry int
number of retries (< 0 is unlimited)
-trim
trim whitespace
```### How it works:
The provided command is executed for every semgrep match.
The matched code is sent to the command's stdin.
The matched code is replaced by the command's stdout.### Example:
```sh
# create a file of matches
semgrep -l go --pattern 'log.$A(...)' --json > matches.json# rewrite all the matches using the llm tool
semgrepx llm 'update this go to use log.Printf' < matches.json
```* This example uses the [llm](https://llm.datasette.io/en/stable/) tool.
### Demo:
![](./semgrepx.gif)