@snelusha/noto 1.2.0 → 1.2.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 +1 -1
- package/dist/index.js +92 -22
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -154,7 +154,7 @@ noto branch delete --force # simply: noto branch delete -f
|
|
|
154
154
|
|
|
155
155
|
## Pro Tips
|
|
156
156
|
|
|
157
|
-
- 🚀 Get fast commits on the fly with `noto -
|
|
157
|
+
- 🚀 Get fast commits on the fly with `noto -a` to streamline your workflow!
|
|
158
158
|
|
|
159
159
|
## Contributing
|
|
160
160
|
|
package/dist/index.js
CHANGED
|
@@ -66,7 +66,8 @@ var AvailableModelsSchema = z.enum([
|
|
|
66
66
|
"gemini-2.0-flash-exp",
|
|
67
67
|
"gemini-2.0-flash-lite-preview-02-05",
|
|
68
68
|
"gemini-2.5-pro-exp-03-25",
|
|
69
|
-
"gemini-2.5-flash-preview-04-17"
|
|
69
|
+
"gemini-2.5-flash-preview-04-17",
|
|
70
|
+
"gemini-2.5-pro-preview-05-06"
|
|
70
71
|
]);
|
|
71
72
|
|
|
72
73
|
// src/utils/storage.ts
|
|
@@ -298,7 +299,8 @@ var models = {
|
|
|
298
299
|
"gemini-2.0-flash-lite-preview-02-05"
|
|
299
300
|
),
|
|
300
301
|
"gemini-2.5-pro-exp-03-25": google("gemini-2.5-pro-exp-03-25"),
|
|
301
|
-
"gemini-2.5-flash-preview-04-17": google("gemini-2.5-flash-preview-04-17")
|
|
302
|
+
"gemini-2.5-flash-preview-04-17": google("gemini-2.5-flash-preview-04-17"),
|
|
303
|
+
"gemini-2.5-pro-preview-05-06": google("gemini-2.5-pro-preview-05-06")
|
|
302
304
|
};
|
|
303
305
|
var availableModels = Object.keys(models);
|
|
304
306
|
var getModel = async () => {
|
|
@@ -323,7 +325,7 @@ var getModel = async () => {
|
|
|
323
325
|
};
|
|
324
326
|
|
|
325
327
|
// src/ai/index.ts
|
|
326
|
-
var generateCommitMessage = async (diff, type) => {
|
|
328
|
+
var generateCommitMessage = async (diff, type, context) => {
|
|
327
329
|
const model2 = await getModel();
|
|
328
330
|
const { object } = await generateObject({
|
|
329
331
|
model: model2,
|
|
@@ -334,27 +336,62 @@ var generateCommitMessage = async (diff, type) => {
|
|
|
334
336
|
{
|
|
335
337
|
role: "system",
|
|
336
338
|
content: dedent3`
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
339
|
+
## Persona
|
|
340
|
+
You are a highly specialized AI assistant engineered for generating precise, standards-compliant Git commit messages. Your function is to serve as an automated tool ensuring consistency and clarity in version control history, adhering strictly to predefined formatting rules optimized for software development workflows.
|
|
341
|
+
|
|
342
|
+
## Core Objective
|
|
343
|
+
Your objective is to meticulously analyze provided code changes (diffs) and synthesize a Git commit message that strictly conforms to the specified output requirements. The focus is on accuracy, conciseness, and unwavering adherence to the format.
|
|
344
|
+
|
|
345
|
+
## Input Specification
|
|
346
|
+
The input provided by the user will be structured as follows:
|
|
347
|
+
|
|
348
|
+
1. **Optional Type Override:** A line indicating the desired commit type, formatted as:
|
|
349
|
+
\`USER_SPECIFIED_TYPE: <value>\`
|
|
350
|
+
* The \`<value>\` will either be one of the valid types (\`chore\`, \`feat\`, \`fix\`, \`docs\`, \`refactor\`, \`perf\`, \`test\) or the special keyword \`[none]\` if the user does not wish to force a specific type.
|
|
351
|
+
2. **Optional User Context:** A section providing supplementary information about the changes, formatted as:
|
|
352
|
+
\`USER_PROVIDED_CONTEXT:\`
|
|
353
|
+
\`{context_placeholder or [none]}\`
|
|
354
|
+
* This context (e.g., issue details, goal description) is optional. If provided, use it to better understand the *purpose* and *intent* behind the code changes. If not provided, the value will be \`[none]\`.
|
|
355
|
+
3. **Diff Content:** The raw diff output, typically generated by \`git diff --staged\`, encapsulated within triple backticks.
|
|
356
|
+
|
|
357
|
+
**You must parse the \`USER_SPECIFIED_TYPE:\` and \`USER_PROVIDED_CONTEXT:\` inputs before analyzing the diff.**
|
|
351
358
|
|
|
352
|
-
|
|
359
|
+
## Output Specification & Constraints (Mandatory Adherence)
|
|
360
|
+
Adherence to the following specifications is mandatory and non-negotiable. Any deviation constitutes an incorrect output.
|
|
361
|
+
|
|
362
|
+
1. **Commit Message Format:**
|
|
363
|
+
* The output MUST strictly follow the single-line format: \`<type>: <description>\`
|
|
364
|
+
* A single colon (\`:\`) followed by a single space MUST separate the \`<type>\` and \`<description>\`.
|
|
365
|
+
* Scopes within the type (e.g., \`feat(api):\`) are explicitly disallowed.
|
|
366
|
+
* Message bodies and footers are explicitly disallowed. The output MUST be exactly one line.
|
|
367
|
+
|
|
368
|
+
2. **Type (\`<type>\`) - Determination Logic:**
|
|
369
|
+
* **Priority 1: User-Specified Type:** Check the value provided on the \`USER_SPECIFIED_TYPE:\` line. If this value is exactly one of \`chore\`, \`feat\`, \`fix\`, \`docs\`, \`refactor\`, \`perf\`, \`test\`, then you **MUST** use this user-specified type.
|
|
370
|
+
* **Priority 2: Diff & Context Analysis (Default Behavior):** If the value on the \`USER_SPECIFIED_TYPE:\` line is \`[none]\` or invalid, you **MUST** select the \`<type>\` exclusively from the predefined vocabulary (\`chore\`, \`feat\`, \`fix\`, \`docs\`, \`refactor\`, \`perf\`, \`test\`). Base your selection on your analysis of the diff, **informed by the \`USER_PROVIDED_CONTEXT\`** if available, to accurately reflect the primary semantic purpose of the changes.
|
|
371
|
+
|
|
372
|
+
3. **Description (\`<description>\`):**
|
|
373
|
+
* **Tense:** MUST employ the imperative, present tense (e.g.,\`add\`, \`fix\`, \`update\`, \`implement\`, \`refactor\`, \`remove\`).
|
|
374
|
+
* **Content:** Must succinctly convey the core semantic change introduced by the diff.
|
|
375
|
+
* **Leverage Context:** If \`USER_PROVIDED_CONTEXT\` is available and not \`[none]\`, use it to **refine the description**, ensuring it reflects the *intent* and *purpose* behind the changes, while still accurately summarizing *what* was changed in the diff.
|
|
376
|
+
* **Focus:** Prioritize the most significant aspects of the change.
|
|
377
|
+
* **File Name Reference:** Inclusion of file names should be exceptional, reserved only for renaming operations or when essential for disambiguating the change's primary focus.
|
|
378
|
+
* **Case Sensitivity:** The entire output string, encompassing both \`<type>\` and \`<description>\`, MUST be rendered in lowercase.
|
|
379
|
+
* **Punctuation:** The description MUST NOT conclude with any terminal punctuation (e.g., no period/full stop).
|
|
380
|
+
* **Length Constraint:** The total character count of the generated commit message line MUST NOT exceed 72 characters. **The description must be concise enough to fit within this limit alongside the chosen type.**`
|
|
353
381
|
},
|
|
354
382
|
{
|
|
355
383
|
role: "user",
|
|
356
|
-
content: dedent3`
|
|
357
|
-
|
|
384
|
+
content: dedent3`
|
|
385
|
+
\`\`\`text
|
|
386
|
+
USER_SPECIFIED_TYPE: ${type ?? "[none]"}
|
|
387
|
+
|
|
388
|
+
USER_PROVIDED_CONTEXT:
|
|
389
|
+
${context ?? "[none]"}
|
|
390
|
+
\`\`\`
|
|
391
|
+
|
|
392
|
+
\`\`\`diff
|
|
393
|
+
${diff}
|
|
394
|
+
\`\`\``
|
|
358
395
|
}
|
|
359
396
|
]
|
|
360
397
|
});
|
|
@@ -386,6 +423,12 @@ var command = {
|
|
|
386
423
|
alias: "-t",
|
|
387
424
|
description: "generate commit message based on type"
|
|
388
425
|
},
|
|
426
|
+
{
|
|
427
|
+
type: String,
|
|
428
|
+
flag: "--message",
|
|
429
|
+
alias: "-m",
|
|
430
|
+
description: "provide context for the commit message"
|
|
431
|
+
},
|
|
389
432
|
{
|
|
390
433
|
type: Boolean,
|
|
391
434
|
flag: "--copy",
|
|
@@ -424,10 +467,28 @@ var command = {
|
|
|
424
467
|
} else if (typeof type === "string") {
|
|
425
468
|
options.type = type;
|
|
426
469
|
}
|
|
470
|
+
const context = options["--message"];
|
|
471
|
+
if (typeof context === "string") {
|
|
472
|
+
options.context = context;
|
|
473
|
+
} else if (typeof context === "boolean") {
|
|
474
|
+
const context2 = await p3.text({
|
|
475
|
+
message: "provide context for the commit message",
|
|
476
|
+
placeholder: "describe the changes"
|
|
477
|
+
});
|
|
478
|
+
if (p3.isCancel(context2)) {
|
|
479
|
+
p3.log.error(color3.red("nothing changed!"));
|
|
480
|
+
return await exit(1);
|
|
481
|
+
}
|
|
482
|
+
options.context = context2;
|
|
483
|
+
}
|
|
427
484
|
spin.start("generating commit message");
|
|
428
485
|
let message = null;
|
|
429
486
|
if (!await isFirstCommit()) {
|
|
430
|
-
message = await generateCommitMessage(
|
|
487
|
+
message = await generateCommitMessage(
|
|
488
|
+
diff,
|
|
489
|
+
options.type,
|
|
490
|
+
options.context
|
|
491
|
+
);
|
|
431
492
|
} else {
|
|
432
493
|
message = INIT_COMMIT_MESSAGE;
|
|
433
494
|
}
|
|
@@ -895,6 +956,15 @@ var model = {
|
|
|
895
956
|
p7.log.error(color7.red("nothing changed!"));
|
|
896
957
|
return await exit(1);
|
|
897
958
|
}
|
|
959
|
+
if (model2 === "gemini-2.5-pro-preview-05-06") {
|
|
960
|
+
const confirm2 = await p7.confirm({
|
|
961
|
+
message: "this model does not have free quota tier, do you want to continue?"
|
|
962
|
+
});
|
|
963
|
+
if (p7.isCancel(confirm2) || !confirm2) {
|
|
964
|
+
p7.log.error(color7.red("nothing changed!"));
|
|
965
|
+
return await exit(1);
|
|
966
|
+
}
|
|
967
|
+
}
|
|
898
968
|
await StorageManager.update((current2) => ({
|
|
899
969
|
...current2,
|
|
900
970
|
llm: {
|
|
@@ -995,7 +1065,7 @@ var listCommand = () => {
|
|
|
995
1065
|
};
|
|
996
1066
|
|
|
997
1067
|
// package.json
|
|
998
|
-
var version = "1.2.
|
|
1068
|
+
var version = "1.2.2";
|
|
999
1069
|
|
|
1000
1070
|
// src/index.ts
|
|
1001
1071
|
var globalSpec = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@snelusha/noto",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "Generate clean commit messages in a snap! ✨",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -41,21 +41,21 @@
|
|
|
41
41
|
"cli"
|
|
42
42
|
],
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@types/node": "^22.15.
|
|
44
|
+
"@types/node": "^22.15.14",
|
|
45
45
|
"tsup": "^8.4.0",
|
|
46
46
|
"typescript": "^5.8.3",
|
|
47
|
-
"vitest": "^3.1.
|
|
47
|
+
"vitest": "^3.1.3"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@ai-sdk/google": "^1.2.
|
|
50
|
+
"@ai-sdk/google": "^1.2.16",
|
|
51
51
|
"@clack/prompts": "^0.10.1",
|
|
52
|
-
"ai": "^4.3.
|
|
52
|
+
"ai": "^4.3.14",
|
|
53
53
|
"arg": "^5.0.2",
|
|
54
54
|
"clipboardy": "^4.0.0",
|
|
55
|
-
"dedent": "^1.
|
|
55
|
+
"dedent": "^1.6.0",
|
|
56
56
|
"picocolors": "^1.1.1",
|
|
57
57
|
"simple-git": "^3.27.0",
|
|
58
58
|
"tinyexec": "^0.3.2",
|
|
59
|
-
"zod": "^3.24.
|
|
59
|
+
"zod": "^3.24.4"
|
|
60
60
|
}
|
|
61
61
|
}
|