Skip to content

Commit e2685db

Browse files
author
colinmcneil
committed
Add tree-sitter step to pylint prompt
1 parent e725f6d commit e2685db

File tree

3 files changed

+31
-6
lines changed

3 files changed

+31
-6
lines changed

functions/bash_alpine/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM alpine:latest
2+
3+
RUN apk add --no-cache bash
4+
5+
ENTRYPOINT ["/bin/bash", "-c"]

functions/tree_sitter/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ FROM rust
33

44
RUN cargo install tree-sitter-cli
55

6+
RUN apt-get update && apt-get install fd-find
7+
68
# Setup parser
79
COPY config.json /root/.config/tree-sitter/config.json
810

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,38 @@
11
---
22
tools:
3-
- name: run-tree-sitter
4-
description: Runs tree sitter in the current directory.
3+
- name: run-tree-sitter-flow
4+
description: Runs a flow with fd and tree sitter in the current directory.
55
parameters:
66
type: object
77
properties:
8-
tree_sitter_args:
8+
fd_args:
99
type: string
10-
description: The args to pass to tree-sitter-cli
10+
description: The args to pass to fd
11+
output_dir:
12+
type: string
13+
description: The path to output files to
1114
container:
1215
image: vonwig/tree_sitter
1316
command:
14-
- "tree-sitter {{tree_sitter_args|safe}}"
17+
- "fdfind {{fd_args|safe}} | while read -r file; do mkdir -p \"{{output_dir|safe}}/$(dirname $file)\" && tree-sitter parse \"$file\" > \"{{output_dir|safe}}/$file.parsed\"; done"
18+
- name: delete_folder
19+
description: Runs rm -rf on a folder
20+
parameters:
21+
type: object
22+
properties:
23+
path:
24+
type: string
25+
description: Path of the folder to delete
26+
container:
27+
image: vonwig/bash_alpine
28+
command:
29+
- "rm -rf {{path|safe}}"
1530
---
1631

1732
# prompt user
1833

19-
Use tree-sitter with args `parse '**/*.py' > /thread/ast.txt`
34+
Delete `/thread/top-level/`
2035

36+
Run tree-sitter-flow
37+
fd args are `-e py`
38+
use `/thread/top-level` as output dir

0 commit comments

Comments
 (0)