prsmith 1.0.0 → 1.0.2
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.
- package/README.md +86 -24
- package/bin/cli.js +25 -19
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,28 +1,38 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1>PRSmith</h1>
|
|
3
|
+
|
|
4
|
+
[](https://www.npmjs.com/package/prsmith)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
[](https://github.com/TarunyaProgrammer/PRSmith_NPMPackage/actions)
|
|
2
7
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
[](https://github.com/TarunyaProgrammer/PRSmith_NPMPackage/actions)
|
|
8
|
+
<p><b>Forge professional pull request review comments directly from the terminal.</b></p>
|
|
9
|
+
</div>
|
|
6
10
|
|
|
7
|
-
|
|
11
|
+
---
|
|
8
12
|
|
|
9
13
|
PRSmith streamlines the process of writing code reviews by providing an interactive prompt that generates consistently formatted, polite, and actionable Markdown comments.
|
|
10
14
|
|
|
11
|
-
---
|
|
12
|
-
|
|
13
15
|
## Architecture Flow
|
|
14
16
|
|
|
15
17
|
The tool operates via a straightforward interactive flow, generating structured markdown from your inputs.
|
|
16
18
|
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
```text
|
|
20
|
+
┌──────────────────────────┐
|
|
21
|
+
│ Run `prsmith` Command │
|
|
22
|
+
└────────────┬─────────────┘
|
|
23
|
+
▼
|
|
24
|
+
┌──────────────────────────┐
|
|
25
|
+
│ Interactive Prompts │
|
|
26
|
+
│ (Severity, Title, Issue) │
|
|
27
|
+
└────────────┬─────────────┘
|
|
28
|
+
▼
|
|
29
|
+
┌──────────────────────────┐
|
|
30
|
+
│ Markdown Generation │
|
|
31
|
+
└────────────┬─────────────┘
|
|
32
|
+
▼
|
|
33
|
+
┌──────────────────────────┐
|
|
34
|
+
│ Print Formatted Comment │
|
|
35
|
+
└──────────────────────────┘
|
|
26
36
|
```
|
|
27
37
|
|
|
28
38
|
---
|
|
@@ -35,23 +45,46 @@ Install globally to use it anywhere on your machine.
|
|
|
35
45
|
npm install -g prsmith
|
|
36
46
|
```
|
|
37
47
|
|
|
48
|
+
## Features
|
|
49
|
+
|
|
50
|
+
- **Interactive Prompts:** No need to memorize complex flags. Just run the tool and answer the prompts.
|
|
51
|
+
- **Smart Formatting:** Automatically generates perfectly structured Markdown.
|
|
52
|
+
- **Graceful Exits:** Hit `Ctrl+C` anytime to exit safely without stack traces.
|
|
53
|
+
- **Built-in Help:** Run `prsmith --help` to view documentation directly in your terminal.
|
|
54
|
+
|
|
38
55
|
## Usage
|
|
39
56
|
|
|
40
|
-
|
|
57
|
+
### Standard Mode
|
|
58
|
+
The primary way to use PRSmith is via its interactive mode. Simply run:
|
|
41
59
|
|
|
42
60
|
```bash
|
|
43
61
|
prsmith
|
|
44
62
|
```
|
|
63
|
+
This will launch the interactive prompt asking for Severity, Title, Issue, and Fix.
|
|
64
|
+
|
|
65
|
+
### Commands & Flags
|
|
66
|
+
|
|
67
|
+
| Command | Description |
|
|
68
|
+
| :--- | :--- |
|
|
69
|
+
| `prsmith` | Launch the interactive generator |
|
|
70
|
+
| `prsmith -h`, `--help` | Display the help menu and commands |
|
|
71
|
+
| `prsmith -v`, `--version` | Print the current installed version |
|
|
72
|
+
|
|
73
|
+
<details>
|
|
74
|
+
<summary><b>Click to view an Example Interaction</b></summary>
|
|
75
|
+
|
|
76
|
+
<br/>
|
|
45
77
|
|
|
46
|
-
|
|
78
|
+
**Input Data:**
|
|
47
79
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
80
|
+
| Field | Input |
|
|
81
|
+
| :--- | :--- |
|
|
82
|
+
| **Severity** | `<kbd>Critical</kbd>` |
|
|
83
|
+
| **Title** | `Scope Issue` |
|
|
84
|
+
| **Issue** | `Utility functions are nested incorrectly.` |
|
|
85
|
+
| **Suggested Fix** | `Move them to module scope.` |
|
|
53
86
|
|
|
54
|
-
**Output:**
|
|
87
|
+
**Output Markdown:**
|
|
55
88
|
|
|
56
89
|
```md
|
|
57
90
|
### Critical: Scope Issue
|
|
@@ -67,8 +100,17 @@ Utility functions are nested incorrectly.
|
|
|
67
100
|
Move them to module scope.
|
|
68
101
|
```
|
|
69
102
|
|
|
103
|
+
</details>
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
70
107
|
## Development & Contribution
|
|
71
108
|
|
|
109
|
+
<details>
|
|
110
|
+
<summary><b>Local Setup Guide</b></summary>
|
|
111
|
+
|
|
112
|
+
<br/>
|
|
113
|
+
|
|
72
114
|
To set up the project locally:
|
|
73
115
|
|
|
74
116
|
```bash
|
|
@@ -87,7 +129,27 @@ npm run lint
|
|
|
87
129
|
# Format the code
|
|
88
130
|
npm run format
|
|
89
131
|
```
|
|
132
|
+
</details>
|
|
90
133
|
|
|
91
134
|
## License
|
|
92
135
|
|
|
93
136
|
This project is licensed under the MIT License.
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
<div align="center">
|
|
141
|
+
<h3>Built with 💻 by Tarunya Kesharwani</h3>
|
|
142
|
+
|
|
143
|
+
<p>
|
|
144
|
+
<i>"I build things. Usually web apps, sometimes automation scripts that save me from doing something tedious twice."</i>
|
|
145
|
+
</p>
|
|
146
|
+
|
|
147
|
+
<p>
|
|
148
|
+
I'm a Full-Stack Engineer and Open Source fanatic (GSoC'26 @ C2SI, Mentor @ GSSoC & SSoC). I obsess over frontend architecture that doesn't collapse under its own weight, seamless developer experiences, and building UI that feels intentional. When I'm not writing TypeScript, I'm probably deep in a rabbit hole about AI, startup strategy, or restructuring a folder hierarchy for the third time.
|
|
149
|
+
</p>
|
|
150
|
+
|
|
151
|
+
<p>
|
|
152
|
+
<a href="https://www.github.com/tarunyaprogrammer"><b>GitHub</b></a> •
|
|
153
|
+
<a href="https://www.linkedin.com/in/tarunyakesharwani/"><b>LinkedIn</b></a>
|
|
154
|
+
</p>
|
|
155
|
+
</div>
|
package/bin/cli.js
CHANGED
|
@@ -1,30 +1,36 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import chalk from "chalk";
|
|
4
|
+
import { program } from "commander";
|
|
4
5
|
import { getReviewData } from "../src/prompts.js";
|
|
5
6
|
import { generateMarkdown } from "../src/formatter.js";
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
program
|
|
9
|
+
.name("prsmith")
|
|
10
|
+
.description("Forge professional pull request review comments directly from the terminal.")
|
|
11
|
+
.version("1.0.1", "-v, --version", "Output the current version")
|
|
12
|
+
.helpOption("-h, --help", "Display help for command")
|
|
13
|
+
.action(async () => {
|
|
14
|
+
try {
|
|
15
|
+
console.log(
|
|
16
|
+
chalk.cyan("\nPRSmith - Professional PR Review Comment Generator\n")
|
|
17
|
+
);
|
|
12
18
|
|
|
13
|
-
|
|
19
|
+
const data = await getReviewData();
|
|
14
20
|
|
|
15
|
-
|
|
21
|
+
const markdown = generateMarkdown(data);
|
|
16
22
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
console.log(chalk.green("\nGenerated Comment:\n"));
|
|
24
|
+
console.log(markdown);
|
|
25
|
+
} catch (error) {
|
|
26
|
+
if (error.name === "ExitPromptError") {
|
|
27
|
+
console.log(chalk.yellow("\nYou have quit in b/w :) \n"));
|
|
28
|
+
process.exit(0);
|
|
29
|
+
}
|
|
30
|
+
console.error(chalk.red("\nSomething went wrong.\n"));
|
|
31
|
+
console.error(error);
|
|
32
|
+
process.exit(1);
|
|
23
33
|
}
|
|
24
|
-
|
|
25
|
-
console.error(error);
|
|
26
|
-
process.exit(1);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
34
|
+
});
|
|
29
35
|
|
|
30
|
-
|
|
36
|
+
program.parse(process.argv);
|