Skip to content

Commit 79359e1

Browse files
branchseerclaude
andauthored
feat: add vite_shell crate for bash script parsing (#18)
Create a new vite_shell crate that uses ast-grep to parse and split bash scripts by top-level && operators. The implementation properly handles operator precedence and mixed operators (|| and &&). Key features: - Splits bash scripts by top-level && operators only - Preserves nested structures (subshells, functions, etc.) - Correctly handles || operators (left-associative precedence) - Comprehensive test coverage (12 tests) including edge cases Examples: - "a && b && c" → ["a", "b", "c"] - "a || b && c" → ["a || b", "c"] - "a && b || c" → ["a && b || c"] Dependencies: - ast-grep-core 0.32.2 for AST-based parsing - tree-sitter-bash 0.23.1 for bash grammar - thiserror for error handling 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2 parents cc4caff + f5cb83c commit 79359e1

File tree

4 files changed

+424
-0
lines changed

4 files changed

+424
-0
lines changed

Cargo.lock

Lines changed: 119 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ allocator-api2 = { version = "0.2.21", default-features = false, features = ["al
3636
anyhow = "1.0.98"
3737
assert2 = "0.3.16"
3838
assertables = "9.8.1"
39+
ast-grep-core = "0.32.2"
3940
attohttpc = { version = "0.30.1", features = ["tls-native", "tls-native-vendored"], default-features = false }
4041
base64 = "0.22.1"
4142
bincode = "2.0.1"
@@ -107,6 +108,7 @@ toml = "0.9.5"
107108
tracing = "0.1.41"
108109
tracing-error = "0.2.1"
109110
tracing-subscriber = { version = "0.3.19", features = ["env-filter", "serde"] }
111+
tree-sitter-bash = "0.23.1"
110112
tui-term = "0.2.0"
111113
twox-hash = "2.1.1"
112114
uuid = "1.18.1"

crates/vite_shell/Cargo.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[package]
2+
name = "vite_shell"
3+
version = "0.0.0"
4+
authors.workspace = true
5+
edition.workspace = true
6+
license.workspace = true
7+
publish = false
8+
rust-version.workspace = true
9+
10+
[dependencies]
11+
ast-grep-core = { workspace = true }
12+
thiserror = { workspace = true }
13+
tree-sitter-bash = { workspace = true }
14+
15+
[lints]
16+
workspace = true

0 commit comments

Comments
 (0)