ast-grep-cli 0.6.7__py3-none-win32.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
@@ -0,0 +1,140 @@
1
+ Metadata-Version: 2.1
2
+ Name: ast-grep-cli
3
+ Version: 0.6.7
4
+ Classifier: Development Status :: 3 - Alpha
5
+ Classifier: Environment :: Console
6
+ Classifier: Intended Audience :: Developers
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: Operating System :: OS Independent
9
+ Classifier: Programming Language :: Rust
10
+ Classifier: Topic :: Security
11
+ Classifier: Topic :: Software Development :: Quality Assurance
12
+ Classifier: Topic :: Software Development
13
+ Classifier: Topic :: Text Processing
14
+ License-File: LICENSE
15
+ Summary: Structural Search and Rewrite code at large scale using precise AST pattern.
16
+ Keywords: ast,pattern,codemod,structural search,rewrite
17
+ Home-Page: https://ast-grep.github.io/
18
+ Author: Herrington Darkholme <2883231+HerringtonDarkholme@users.noreply.github.com>
19
+ Author-email: Herrington Darkholme <2883231+HerringtonDarkholme@users.noreply.github.com>
20
+ Maintainer-email: Herrington Darkholme <2883231+HerringtonDarkholme@users.noreply.github.com>
21
+ License: MIT
22
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
23
+ Project-URL: Repository, https://github.com/ast-grep/ast-grep
24
+ Project-URL: Documentation, https://ast-grep.github.io/
25
+ Project-URL: Changelog, https://github.com/ast-grep/ast-grep/blob/main/CHANGELOG.md
26
+
27
+ <p align=center>
28
+ <img src="https://ast-grep.github.io/logo.svg" alt="ast-grep"/>
29
+ </p>
30
+
31
+ <p align="center">
32
+ <img src="https://github.com/ast-grep/ast-grep/actions/workflows/coverage.yaml/badge.svg" alt="coverage badge"/>
33
+ <a href="https://app.codecov.io/gh/ast-grep/ast-grep"><img src="https://codecov.io/gh/ast-grep/ast-grep/branch/main/graph/badge.svg?token=37VX8H2EWV"/></a>
34
+ <a href="https://discord.gg/4YZjf6htSQ" target="_blank"><img alt="Discord" src="https://img.shields.io/discord/1107749847722889217?label=Discord"></a>
35
+ <img src="https://img.shields.io/github/stars/ast-grep/ast-grep?style=social" alt="Badge"/>
36
+ <img src="https://img.shields.io/github/forks/ast-grep/ast-grep?style=social" alt="Badge"/>
37
+ <img alt="GitHub Sponsors" src="https://img.shields.io/github/sponsors/HerringtonDarkholme?style=social">
38
+ </p>
39
+
40
+
41
+ ## ast-grep(sg)
42
+
43
+ ast-grep(sg) is a fast and polyglot tool for code structural search, lint and rewriting at large scale..
44
+
45
+ ## Introduction
46
+ ast-grep is a AST-based tool to search code by pattern code. Think it as your old-friend `grep` but it matches AST nodes instead of text.
47
+ You can write patterns as if you are writing ordinary code. It will match all code that has the same syntactical structure.
48
+ You can use `$` sign + upper case letters as wildcard, e.g. `$MATCH`, to match any single AST node. Think it as REGEX dot `.`, except it is not textual.
49
+
50
+ Try the [online playground](https://ast-grep.github.io/playground.html) for a taste!
51
+
52
+ ## Demo
53
+
54
+ ![output](https://user-images.githubusercontent.com/2883231/183275066-8d9c342f-46cb-4fa5-aa4e-b98aac011869.gif)
55
+
56
+ ## Installation
57
+ You can install it from [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm), [cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html), [homebrew](https://brew.sh/) or [scoop](https://scoop.sh/)!
58
+
59
+ ```bash
60
+ # install via npm
61
+ npm install --global @ast-grep/cli
62
+
63
+ # install via cargo
64
+ cargo install ast-grep
65
+
66
+ # install via homebrew, thank @henryhchchc
67
+ brew install ast-grep
68
+
69
+ # install via scoop, thank @brian6932
70
+ scoop install main/ast-grep
71
+ ```
72
+ Or you can build ast-grep from source. You need install rustup, clone the repository and then
73
+ ```bash
74
+ cargo install --path ./crates/cli
75
+ ```
76
+ [Packages](https://repology.org/project/ast-grep/versions) are available on other platforms too.
77
+
78
+ ## Command line usage example
79
+
80
+ ast-grep has following form.
81
+ ```
82
+ sg --pattern 'var code = $PATTERN' --rewrite 'let code = new $PATTERN' --lang ts
83
+ ```
84
+
85
+ ### Example
86
+
87
+ * [Rewrite code in null coalescing operator](https://twitter.com/Hchan_mgn/status/1547061516993699841?s=20&t=ldDoj4U2nq-FRKQkU5GWXA)
88
+
89
+ ```bash
90
+ sg -p '$A && $A()' -l ts -r '$A?.()'
91
+ ```
92
+
93
+ * [Rewrite](https://twitter.com/Hchan_mgn/status/1561802312846278657) [Zodios](https://github.com/ecyrbe/zodios#migrate-to-v8)
94
+ ```bash
95
+ sg -p 'new Zodios($URL, $CONF as const,)' -l ts -r 'new Zodios($URL, $CONF)' -i
96
+ ```
97
+
98
+ * [Implement eslint rule using YAML.](https://twitter.com/Hchan_mgn/status/1560108625460355073)
99
+
100
+
101
+ ## Sponsor
102
+ ![Sponsors](https://raw.githubusercontent.com/HerringtonDarkholme/sponsors/main/sponsorkit/sponsors.svg)
103
+
104
+ If you find ast-grep interesting and useful for your work, please [buy me a coffee](https://github.com/sponsors/HerringtonDarkholme)
105
+ so I can spend more time on the project!
106
+
107
+ ## Feature Highlight
108
+
109
+ ast-grep's core is an algorithm to search and replace code based on abstract syntax tree produced by tree-sitter.
110
+ It can help you to do lightweight static analysis and massive scale code manipulation in an intuitive way.
111
+
112
+ Key highlights:
113
+
114
+ * An intuitive pattern to find and replace AST.
115
+ ast-grep's pattern looks like ordinary code you would write every day. (You can call the pattern is isomorphic to code).
116
+
117
+ * jQuery like API for AST traversal and manipulation.
118
+
119
+ * YAML configuration to write new linting rules or code modification.
120
+
121
+ * Written in compiled language, with tree-sitter based parsing and utilizing multiple cores.
122
+
123
+ * Beautiful command line interface :)
124
+
125
+ ast-grep's vision is to democratize abstract syntax tree magic and to liberate one from cumbersome AST programming!
126
+
127
+ * If you are an open source library author, ast-grep can help your library users adopt breaking changes more easily.
128
+ * if you are a tech lead in your team, ast-grep can help you enforce code best practice tailored to your business need.
129
+ * If you are a security researcher, ast-grep can help you write rules much faster.
130
+
131
+
132
+ ## CLI Screenshot
133
+
134
+ ### Search
135
+ | Feature | Command | Screenshot |
136
+ | ------- | ------- | ---------- |
137
+ | Search | `sg -p 'Some($A)' -l rs` | ![image](https://github.com/ast-grep/ast-grep/assets/2883231/002db3a2-8a79-4838-ad5c-563634183c3f) |
138
+ | Rewrite | `sg -p '$F && $F($$$ARGS)' -r '$F?.($$$ARGS)' -l ts` | ![image](https://github.com/ast-grep/ast-grep/assets/2883231/ad9394d8-3aea-4b96-8d54-6e01f06174d2)|
139
+ | Report | `sg scan` | ![image](https://user-images.githubusercontent.com/2883231/187094977-fd544d4b-64de-4bba-8bea-8c0de047b352.png) |
140
+
@@ -0,0 +1,6 @@
1
+ ast_grep_cli-0.6.7.dist-info/METADATA,sha256=uar71A5LUasRldlpJDIoUSBb5ejUQKllJT4MnZmAa-M,6327
2
+ ast_grep_cli-0.6.7.dist-info/WHEEL,sha256=NJpBX6vetYlXi9G5wpNsSMr1XugbvTtFZconJI6m9sk,89
3
+ ast_grep_cli-0.6.7.dist-info/license_files/LICENSE,sha256=mSmZDXIfc5hVA0mKAYKgIU31p_5Hcj65ujVVedYJ_gU,1098
4
+ ast_grep_cli-0.6.7.data/scripts/sg.exe,sha256=gV82ju5YOXx9WlBNWV4fGbpCJM6YsIYWR_xkJOfPktY,21065216
5
+ ast_grep_cli-0.6.7.data/scripts/ast-grep.exe,sha256=ee4Wd5DY33nObZa5FCrETTZESJPn4Aws7wFSkyGOkME,21065728
6
+ ast_grep_cli-0.6.7.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: maturin (1.1.0)
3
+ Root-Is-Purelib: false
4
+ Tag: py3-none-win32
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Herrington Darkholme
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.