@snelusha/noto 1.0.7 → 1.0.8

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 CHANGED
@@ -90,6 +90,14 @@ Retrieve the previously generated commit message:
90
90
  noto prev
91
91
  ```
92
92
 
93
+ Amend the previously generated commit message:
94
+
95
+ ```bash
96
+ noto prev --amend --edit # or simply: noto prev --amend -e
97
+ ```
98
+
99
+ > Note: When using the `--amend` flag with the noto prev command, the `--edit` (`-e`) flag is also required. This combination will allow you to modify (amend) the previous commit message before applying it.
100
+
93
101
  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
102
 
95
103
  ## Pro Tips
package/dist/index.js CHANGED
@@ -181,11 +181,12 @@ var getStagedDiff = async () => {
181
181
  return null;
182
182
  }
183
183
  };
184
- var commit = async (message) => {
184
+ var commit = async (message, amend) => {
185
185
  try {
186
+ const options = amend ? { "--amend": null } : void 0;
186
187
  const {
187
188
  summary: { changes }
188
- } = await git.commit(message);
189
+ } = await git.commit(message, void 0, options);
189
190
  return Boolean(changes);
190
191
  } catch {
191
192
  return false;
@@ -477,6 +478,11 @@ var command2 = {
477
478
  flag: "--edit",
478
479
  alias: "-e",
479
480
  description: "edit the last generated commit message"
481
+ },
482
+ {
483
+ type: Boolean,
484
+ flag: "--amend",
485
+ description: "amend the last commit with the last generated message"
480
486
  }
481
487
  ],
482
488
  execute: withAuth(
@@ -488,6 +494,13 @@ var command2 = {
488
494
  return await exit(1);
489
495
  }
490
496
  const isEditMode = options["--edit"];
497
+ const isAmend = options["--amend"];
498
+ if (isAmend && !isEditMode) {
499
+ p4.log.error(
500
+ color4.red("the --amend option requires the --edit option")
501
+ );
502
+ return await exit(1);
503
+ }
491
504
  p4.log.step(
492
505
  isEditMode ? color4.white(lastGeneratedMessage) : color4.green(lastGeneratedMessage)
493
506
  );
@@ -514,7 +527,7 @@ var command2 = {
514
527
  color4.dim("copied last generated commit message to clipboard")
515
528
  );
516
529
  }
517
- if (options["--apply"]) {
530
+ if (options["--apply"] || isAmend) {
518
531
  if (!options.isRepo) {
519
532
  p4.log.error(
520
533
  dedent4`${color4.red("no git repository found in cwd.")}
@@ -522,14 +535,14 @@ var command2 = {
522
535
  );
523
536
  return await exit(1);
524
537
  }
525
- if (!options.diff) {
538
+ if (!options.diff && !isAmend) {
526
539
  p4.log.error(
527
540
  dedent4`${color4.red("no staged changes found.")}
528
541
  ${color4.dim(`run ${color4.cyan("`git add <file>`")} or ${color4.cyan("`git add .`")} to stage changes.`)}`
529
542
  );
530
543
  return await exit(1);
531
544
  }
532
- const success = await commit(lastGeneratedMessage);
545
+ const success = await commit(lastGeneratedMessage, isAmend);
533
546
  if (success) {
534
547
  p4.log.step(color4.dim("commit successful"));
535
548
  } else {
@@ -709,7 +722,7 @@ var listCommand = () => {
709
722
  };
710
723
 
711
724
  // package.json
712
- var version = "1.0.7";
725
+ var version = "1.0.8";
713
726
 
714
727
  // src/index.ts
715
728
  var globalSpec = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snelusha/noto",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "Generate clean commit messages in a snap! ✨",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -12,7 +12,7 @@
12
12
  "homepage": "https://noto.snelusha.dev",
13
13
  "repository": {
14
14
  "type": "git",
15
- "url": "git+https://github.com/snelusha/noto.git",
15
+ "url": "https://github.com/snelusha/noto.git",
16
16
  "directory": "packages/cli"
17
17
  },
18
18
  "bugs": {
@@ -42,21 +42,21 @@
42
42
  "cli"
43
43
  ],
44
44
  "devDependencies": {
45
- "@types/node": "^22.13.13",
45
+ "@types/node": "^22.14.0",
46
46
  "tsup": "^8.4.0",
47
- "typescript": "^5.8.2"
47
+ "typescript": "^5.8.3",
48
+ "vitest": "^3.1.1"
48
49
  },
49
50
  "dependencies": {
50
- "@ai-sdk/google": "^1.2.3",
51
+ "@ai-sdk/google": "^1.2.7",
51
52
  "@clack/prompts": "^0.10.0",
52
- "ai": "^4.2.5",
53
+ "ai": "^4.3.2",
53
54
  "arg": "^5.0.2",
54
55
  "clipboardy": "^4.0.0",
55
56
  "dedent": "^1.5.3",
56
57
  "picocolors": "^1.1.1",
57
58
  "simple-git": "^3.27.0",
58
59
  "tinyexec": "^0.3.2",
59
- "vitest": "^3.0.9",
60
60
  "zod": "^3.24.2"
61
61
  }
62
62
  }