@snelusha/noto 1.0.1 → 1.0.3
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 +6 -0
- package/dist/index.js +42 -11
- package/package.json +7 -7
- package/bin/noto.mjs +0 -4
package/README.md
CHANGED
|
@@ -36,6 +36,12 @@ Optionally, if you wish to configure a different Gemini model (the default model
|
|
|
36
36
|
noto config model
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
+
If you ever need to reset your configuration, you can now run:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
noto config reset
|
|
43
|
+
```
|
|
44
|
+
|
|
39
45
|
## Usage
|
|
40
46
|
|
|
41
47
|
Generate a new commit message:
|
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
|
|
@@ -128,10 +132,10 @@ var exit = async (code) => {
|
|
|
128
132
|
};
|
|
129
133
|
|
|
130
134
|
// src/middleware/auth.ts
|
|
131
|
-
var withAuth = (fn, options = {}) => {
|
|
135
|
+
var withAuth = (fn, options = { enabled: true }) => {
|
|
132
136
|
return async (opts) => {
|
|
133
137
|
const storage = await StorageManager.get();
|
|
134
|
-
if (!storage.llm?.apiKey &&
|
|
138
|
+
if (!storage.llm?.apiKey && options.enabled) {
|
|
135
139
|
p.log.error(
|
|
136
140
|
dedent`${color.red("noto api key is missing.")}
|
|
137
141
|
${color.dim(`run ${color.cyan("`noto config key`")} to set it up.`)}`
|
|
@@ -172,10 +176,10 @@ var commit = async (message) => {
|
|
|
172
176
|
};
|
|
173
177
|
|
|
174
178
|
// src/middleware/git.ts
|
|
175
|
-
var withRepository = (fn, options = {}) => {
|
|
179
|
+
var withRepository = (fn, options = { enabled: true }) => {
|
|
176
180
|
return async (opts) => {
|
|
177
181
|
const isRepo = await isGitRepository();
|
|
178
|
-
if (!isRepo &&
|
|
182
|
+
if (!isRepo && options.enabled) {
|
|
179
183
|
p2.log.error(
|
|
180
184
|
dedent2`${color2.red("no git repository found in cwd.")}
|
|
181
185
|
${color2.dim(`run ${color2.cyan("`git init`")} to initialize a new repository.`)}`
|
|
@@ -184,7 +188,7 @@ var withRepository = (fn, options = {}) => {
|
|
|
184
188
|
}
|
|
185
189
|
opts.isRepo = isRepo;
|
|
186
190
|
const diff = await getStagedDiff();
|
|
187
|
-
if (!diff &&
|
|
191
|
+
if (!diff && options.enabled) {
|
|
188
192
|
p2.log.error(
|
|
189
193
|
dedent2`${color2.red("no staged changes found.")}
|
|
190
194
|
${color2.dim(`run ${color2.cyan("`git add <file>`")} or ${color2.cyan("`git add .`")} to stage changes.`)}`
|
|
@@ -218,7 +222,7 @@ var NotoError = class _NotoError extends Error {
|
|
|
218
222
|
var google = createGoogleGenerativeAI({
|
|
219
223
|
apiKey: (await StorageManager.get()).llm?.apiKey ?? "api-key"
|
|
220
224
|
});
|
|
221
|
-
var defaultModel = "gemini-2.0-
|
|
225
|
+
var defaultModel = "gemini-2.0-pro-exp-02-05";
|
|
222
226
|
var models = {
|
|
223
227
|
"gemini-1.5-flash": google("gemini-1.5-flash"),
|
|
224
228
|
"gemini-1.5-flash-latest": google("gemini-1.5-flash-latest"),
|
|
@@ -234,7 +238,17 @@ var models = {
|
|
|
234
238
|
};
|
|
235
239
|
var availableModels = Object.keys(models);
|
|
236
240
|
var getModel = async () => {
|
|
237
|
-
|
|
241
|
+
let model2 = (await StorageManager.get()).llm?.model;
|
|
242
|
+
if (!model2) {
|
|
243
|
+
model2 = defaultModel;
|
|
244
|
+
await StorageManager.update((current) => ({
|
|
245
|
+
...current,
|
|
246
|
+
llm: {
|
|
247
|
+
...current.llm,
|
|
248
|
+
model: model2
|
|
249
|
+
}
|
|
250
|
+
}));
|
|
251
|
+
}
|
|
238
252
|
if (!availableModels.includes(model2)) {
|
|
239
253
|
throw new NotoError({
|
|
240
254
|
code: "model-not-found",
|
|
@@ -477,7 +491,7 @@ var command2 = {
|
|
|
477
491
|
}
|
|
478
492
|
console.log();
|
|
479
493
|
},
|
|
480
|
-
{
|
|
494
|
+
{ enabled: false }
|
|
481
495
|
)
|
|
482
496
|
)
|
|
483
497
|
};
|
|
@@ -550,7 +564,24 @@ var model = {
|
|
|
550
564
|
console.log();
|
|
551
565
|
}
|
|
552
566
|
};
|
|
553
|
-
var
|
|
567
|
+
var reset = {
|
|
568
|
+
name: "reset",
|
|
569
|
+
description: "reset configuration",
|
|
570
|
+
usage: "noto config reset",
|
|
571
|
+
execute: async () => {
|
|
572
|
+
const confirm2 = await p5.confirm({
|
|
573
|
+
message: "are you sure you want to reset the configuration?"
|
|
574
|
+
});
|
|
575
|
+
if (p5.isCancel(confirm2) || !confirm2) {
|
|
576
|
+
p5.log.error(color5.red("nothing changed!"));
|
|
577
|
+
return await exit(1);
|
|
578
|
+
}
|
|
579
|
+
await StorageManager.clear();
|
|
580
|
+
p5.log.success(color5.green("configuration reset!"));
|
|
581
|
+
console.log();
|
|
582
|
+
}
|
|
583
|
+
};
|
|
584
|
+
var subCommands = [key, model, reset];
|
|
554
585
|
var command3 = {
|
|
555
586
|
name: "config",
|
|
556
587
|
description: "configure noto",
|
|
@@ -585,7 +616,7 @@ var getCommand = (name, cmds = commands) => {
|
|
|
585
616
|
};
|
|
586
617
|
|
|
587
618
|
// package.json
|
|
588
|
-
var version = "1.0.
|
|
619
|
+
var version = "1.0.3";
|
|
589
620
|
|
|
590
621
|
// src/index.ts
|
|
591
622
|
var globalSpec = {
|
|
@@ -611,7 +642,7 @@ function main() {
|
|
|
611
642
|
);
|
|
612
643
|
if (subCommand) {
|
|
613
644
|
selectedCommand = subCommand;
|
|
614
|
-
commandArgs = commandArgs.slice(
|
|
645
|
+
commandArgs = commandArgs.slice(2);
|
|
615
646
|
}
|
|
616
647
|
}
|
|
617
648
|
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.
|
|
3
|
+
"version": "1.0.3",
|
|
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.
|
|
44
|
-
"tsup": "^8.
|
|
45
|
-
"typescript": "^5.
|
|
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.
|
|
48
|
+
"@ai-sdk/google": "^1.1.20",
|
|
49
49
|
"@clack/prompts": "^0.10.0",
|
|
50
|
-
"ai": "^4.1.
|
|
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.
|
|
57
|
+
"vitest": "^3.0.8",
|
|
58
58
|
"zod": "^3.24.2"
|
|
59
59
|
}
|
|
60
60
|
}
|
package/bin/noto.mjs
DELETED