@snelusha/noto 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.
Files changed (3) hide show
  1. package/README.md +108 -0
  2. package/dist/index.js +24 -3
  3. package/package.json +7 -7
package/README.md ADDED
@@ -0,0 +1,108 @@
1
+ <h1 align="center">noto ✨</h1>
2
+ <p align="center"><sup>(/nōto/, <em>notebook</em> in Japanese)</sup></p>
3
+ <img src="https://github.com/snelusha/static/blob/main/noto/banner.png?raw=true" align="center"></img>
4
+
5
+ ## Features
6
+
7
+ - **Instant Commit Messages**: Generate clear, context-aware messages based on staged changes.
8
+
9
+ - **Seamless Git Integration**: Apply messages directly, skip the copy-paste.
10
+
11
+ - **Interactive Editing:** Easily refine your commit message with the new `--edit` flag.
12
+
13
+ - **Enhanced Configuration:** Manage your LLM model preferences with an improved configuration interface.
14
+
15
+ ## Installation
16
+
17
+ Install noto globally using npm:
18
+
19
+ ```bash
20
+ npm install -g @snelusha/noto
21
+ ```
22
+
23
+ After installation, you can run `noto` from any terminal.
24
+
25
+ ## Prerequisites
26
+
27
+ Before using noto, you must configure your [Google Generative API](https://aistudio.google.com/app/apikey) key. Run the following command to set it up:
28
+
29
+ ```bash
30
+ noto config key # or simply noto config key YOUR_API_KEY
31
+ ```
32
+
33
+ Optionally, if you wish to configure a different Gemini model (the default model will be used if not configured), run:
34
+
35
+ ```bash
36
+ noto config model
37
+ ```
38
+
39
+ If you ever need to reset your configuration, you can now run:
40
+
41
+ ```bash
42
+ noto config reset
43
+ ```
44
+
45
+ ## Usage
46
+
47
+ Generate a new commit message:
48
+
49
+ ```bash
50
+ noto
51
+ ```
52
+
53
+ Apply the generated commit message to your current commit:
54
+
55
+ ```bash
56
+ noto --apply # or simply noto -a
57
+ ```
58
+
59
+ Copy the generated commit message to your clipboard:
60
+
61
+ ```bash
62
+ noto --copy # or simply noto -c
63
+ ```
64
+
65
+ Specify the commit type for your commit message:
66
+
67
+ ```bash
68
+ noto --type # or simply noto -t
69
+
70
+ noto --type chore # or simply noto -t chore
71
+ ```
72
+
73
+ Open an interactive editor to refine the generated commit message:
74
+
75
+ ```bash
76
+ noto --edit # or simply noto -e
77
+ ```
78
+
79
+ Combine all flags to specify the commit type, open the interactive editor, and apply the generated commit message in one go:
80
+
81
+ ```bash
82
+ noto --edit --type feat --apply # or simply: noto -e -t feat -a
83
+ ```
84
+
85
+ This command will generate a commit message for a "feat" commit, let you refine it interactively, and then apply it directly to your current commit.
86
+
87
+ Retrieve the previously generated commit message:
88
+
89
+ ```bash
90
+ noto prev
91
+ ```
92
+
93
+ Note: All of the flags shown above (`--apply`, `--copy`, `--type`, `--edit`) can also be used with the `noto prev` command to work with the previously generated commit message.
94
+
95
+ ## Pro Tips
96
+
97
+ - 🚀 Get fast commits on the fly with `noto -e -a` to streamline your workflow!
98
+
99
+ ## Contributing
100
+
101
+ We welcome contributions and suggestions! If you have ideas or improvements, feel free to reach out or open a pull request.
102
+
103
+ Thank you for using `noto`! If you have any feedback or suggestions, feel free to reach out or contribute to the project. ✨
104
+
105
+ ## License
106
+
107
+ This project is licensed under the MIT License.
108
+ © 2024 [Sithija Nelusha Silva](https://github.com/snelusha)
package/dist/index.js CHANGED
@@ -118,6 +118,10 @@ var StorageManager = class {
118
118
  await this.load();
119
119
  return JSON.parse(JSON.stringify(this.storage));
120
120
  }
121
+ static async clear() {
122
+ this.storage = {};
123
+ await this.save();
124
+ }
121
125
  };
122
126
 
123
127
  // src/utils/process.ts
@@ -550,7 +554,24 @@ var model = {
550
554
  console.log();
551
555
  }
552
556
  };
553
- var subCommands = [key, model];
557
+ var reset = {
558
+ name: "reset",
559
+ description: "reset configuration",
560
+ usage: "noto config reset",
561
+ execute: async () => {
562
+ const confirm2 = await p5.confirm({
563
+ message: "are you sure you want to reset the configuration?"
564
+ });
565
+ if (p5.isCancel(confirm2) || !confirm2) {
566
+ p5.log.error(color5.red("nothing changed!"));
567
+ return await exit(1);
568
+ }
569
+ await StorageManager.clear();
570
+ p5.log.success(color5.green("configuration reset!"));
571
+ console.log();
572
+ }
573
+ };
574
+ var subCommands = [key, model, reset];
554
575
  var command3 = {
555
576
  name: "config",
556
577
  description: "configure noto",
@@ -585,7 +606,7 @@ var getCommand = (name, cmds = commands) => {
585
606
  };
586
607
 
587
608
  // package.json
588
- var version = "1.0.0";
609
+ var version = "1.0.2";
589
610
 
590
611
  // src/index.ts
591
612
  var globalSpec = {
@@ -611,7 +632,7 @@ function main() {
611
632
  );
612
633
  if (subCommand) {
613
634
  selectedCommand = subCommand;
614
- commandArgs = commandArgs.slice(1);
635
+ commandArgs = commandArgs.slice(2);
615
636
  }
616
637
  }
617
638
  const commandSpec = (selectedCommand.options ?? []).reduce((acc, opt) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snelusha/noto",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Generate clean commit messages in a snap! ✨",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -40,21 +40,21 @@
40
40
  "cli"
41
41
  ],
42
42
  "devDependencies": {
43
- "@types/node": "^22.12.0",
44
- "tsup": "^8.3.6",
45
- "typescript": "^5.7.3"
43
+ "@types/node": "^22.13.10",
44
+ "tsup": "^8.4.0",
45
+ "typescript": "^5.8.2"
46
46
  },
47
47
  "dependencies": {
48
- "@ai-sdk/google": "^1.1.14",
48
+ "@ai-sdk/google": "^1.1.20",
49
49
  "@clack/prompts": "^0.10.0",
50
- "ai": "^4.1.40",
50
+ "ai": "^4.1.54",
51
51
  "arg": "^5.0.2",
52
52
  "clipboardy": "^4.0.0",
53
53
  "dedent": "^1.5.3",
54
54
  "picocolors": "^1.1.1",
55
55
  "simple-git": "^3.27.0",
56
56
  "tinyexec": "^0.3.2",
57
- "vitest": "^3.0.5",
57
+ "vitest": "^3.0.8",
58
58
  "zod": "^3.24.2"
59
59
  }
60
60
  }