diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c021dba..f2b4b8e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,6 +37,7 @@ jobs: - run: | cargo build \ --bin ${NAME}-rust \ + --bin ${NAME}-typescript \ --locked \ --release \ --target=x86_64-unknown-linux-musl diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8079ed5..123d8a3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,15 +26,16 @@ jobs: run: | cargo build \ --bin ${NAME}-rust \ + --bin ${NAME}-typescript \ --locked \ --release \ --target=x86_64-unknown-linux-musl - cp target/x86_64-unknown-linux-musl/release/tree-splicer-rust . + cp target/x86_64-unknown-linux-musl/release/tree-splicer-{rust,typescript} . - uses: ncipollo/release-action@v1 if: ${{ startsWith(github.ref, 'refs/tags/v') }} with: - artifacts: "tree-splicer-rust" + artifacts: "tree-splicer-rust,tree-splicer-typescript" artifactErrorsFailBuild: true body: "See [CHANGELOG.md](https://github.com/langston-barrett/tree-splicer/blob/main/doc/CHANGELOG.md)." draft: true @@ -46,7 +47,7 @@ jobs: # Only push on actual release tags PUSH: ${{ startsWith(github.ref, 'refs/tags/v') }} run: | - for pkg in tree-splicer{,-rust}; do + for pkg in tree-splicer{,-rust,-typescript}; do if [[ ${PUSH} == true ]]; then cargo publish --token ${CRATES_IO_TOKEN} -p "${pkg}" else diff --git a/Cargo.lock b/Cargo.lock index f25478b..9140bad 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -523,6 +523,16 @@ dependencies = [ "tree-sitter", ] +[[package]] +name = "tree-sitter-typescript" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "079c695c32d39ad089101c66393aeaca30e967fba3486a91f573d2f0e12d290a" +dependencies = [ + "cc", + "tree-sitter", +] + [[package]] name = "tree-splicer" version = "0.1.0" @@ -549,6 +559,15 @@ dependencies = [ "tree-splicer", ] +[[package]] +name = "tree-splicer-typescript" +version = "0.1.0" +dependencies = [ + "anyhow", + "tree-sitter-typescript", + "tree-splicer", +] + [[package]] name = "unicode-ident" version = "1.0.8" diff --git a/Cargo.toml b/Cargo.toml index 5a27c53..e26c614 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,7 @@ members = [ "crates/tree-splicer", "crates/tree-splicer-rust", + "crates/tree-splicer-typescript", ] # https://nnethercote.github.io/perf-book/build-configuration.html diff --git a/README.md b/README.md index 36d8287..ed7f7bb 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,8 @@ maximal coverage and bug-finding through complete, hand-written grammars and complex techniques like coverage-based feedback, tree-splicer aims to achieve maximal ease-of-use by using off-the-shelf tree-sitter grammars and not requiring any instrumentation (nor even source code) for the target. +In short, tree-splicer wants to be the [Radamsa][radamsa] of grammar-based +fuzzing. tree-sitter grammars are resistant to syntax errors. Therefore, tree-splicer can even mutate syntactically-invalid inputs! You can also use tree-splicer @@ -86,6 +88,11 @@ fn x(x: usize) -> () { } ``` +## Supported languages + +- Rust +- TypeScript + ## Installation ### From a release @@ -125,5 +132,6 @@ You can find binaries in `target/release`. Run tests with `cargo test`. [cargo]: https://doc.rust-lang.org/cargo/ [crates-io]: https://crates.io/ +[radamsa]: https://gitlab.com/akihe/radamsa [releases]: https://github.com/langston-barrett/tree-splicer/releases [rustup]: https://rustup.rs/ diff --git a/crates/tree-splicer-typescript/.gitignore b/crates/tree-splicer-typescript/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/crates/tree-splicer-typescript/.gitignore @@ -0,0 +1 @@ +/target diff --git a/crates/tree-splicer-typescript/Cargo.toml b/crates/tree-splicer-typescript/Cargo.toml new file mode 100644 index 0000000..62e0adf --- /dev/null +++ b/crates/tree-splicer-typescript/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "tree-splicer-typescript" +description = "Simple grammar-based TypeScript program generator" +version = "0.1.0" +keywords = ["black-box", "fuzzer", "grammar-based", "typescript"] +edition = "2021" +authors = ["Langston Barrett "] +license = "MIT" +readme = "../../README.md" +homepage = "https://github.com/langston-barrett/tree-splicer" +repository = "https://github.com/langston-barrett/tree-splicer" + +[dependencies] +anyhow = "1" +tree-splicer = { version = "0.1.0", path = "../tree-splicer", features = ["cli"] } +tree-sitter-typescript = "0.20" \ No newline at end of file diff --git a/crates/tree-splicer-typescript/src/main.rs b/crates/tree-splicer-typescript/src/main.rs new file mode 100644 index 0000000..c71f9fd --- /dev/null +++ b/crates/tree-splicer-typescript/src/main.rs @@ -0,0 +1,5 @@ +use anyhow::Result; + +fn main() -> Result<()> { + tree_splicer::cli::main(tree_sitter_typescript::language_typescript()) +}