@snelusha/noto 1.1.2 → 1.1.4

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 +12 -0
  2. package/dist/index.js +86 -21
  3. package/package.json +6 -6
package/README.md CHANGED
@@ -118,6 +118,18 @@ To list all branches, including remote branches, use the -r flag
118
118
  noto branch -r
119
119
  ```
120
120
 
121
+ Delete local branches:
122
+
123
+ ```bash
124
+ noto branch delete
125
+ ```
126
+
127
+ If you need to force delete a branch, you can use the force flag:
128
+
129
+ ```bash
130
+ noto branch delete --force # simply: noto branch delete -f
131
+ ```
132
+
121
133
  ## Pro Tips
122
134
 
123
135
  - 🚀 Get fast commits on the fly with `noto -e -a` to streamline your workflow!
package/dist/index.js CHANGED
@@ -222,6 +222,14 @@ var checkout = async (branch) => {
222
222
  return false;
223
223
  }
224
224
  };
225
+ var deleteBranches = async (branches, force = false) => {
226
+ try {
227
+ const result = await git.deleteLocalBranches(branches, force);
228
+ return result.success;
229
+ } catch {
230
+ return false;
231
+ }
232
+ };
225
233
 
226
234
  // src/middleware/git.ts
227
235
  var withRepository = (fn, options = { enabled: true }) => {
@@ -567,7 +575,7 @@ var command2 = {
567
575
  p4.log.error(color4.red("failed to commit changes"));
568
576
  }
569
577
  }
570
- console.log();
578
+ return await exit(0);
571
579
  },
572
580
  { enabled: false }
573
581
  )
@@ -616,6 +624,72 @@ var current = {
616
624
  { enabled: false }
617
625
  )
618
626
  };
627
+ var del = {
628
+ name: "delete",
629
+ description: "delete a branch",
630
+ usage: "branch delete <branch>",
631
+ options: [
632
+ {
633
+ type: Boolean,
634
+ flag: "--force",
635
+ alias: "-f",
636
+ description: "force delete a branch"
637
+ },
638
+ {
639
+ type: Boolean,
640
+ flag: "--all",
641
+ alias: "-a",
642
+ description: "select all branches except the current one"
643
+ }
644
+ ],
645
+ execute: withRepository(
646
+ async (options) => {
647
+ if (!options.isRepo) {
648
+ p5.log.error(
649
+ dedent5`${color5.red("no git repository found in cwd.")}
650
+ ${color5.dim(`run ${color5.cyan("`git init`")} to initialize a new repository.`)}`
651
+ );
652
+ return await exit(1);
653
+ }
654
+ const currentBranch = await getCurrentBranch();
655
+ const branches = await getBranches();
656
+ if (!currentBranch || !branches) {
657
+ p5.log.error("failed to fetch branches");
658
+ return await exit(1);
659
+ }
660
+ const selectedBranches = await p5.multiselect({
661
+ message: "select branches to delete",
662
+ initialValues: options["--all"] ? branches.filter((b) => b !== currentBranch) : [],
663
+ options: branches.map((branch) => ({
664
+ value: branch,
665
+ label: color5.bold(branch),
666
+ hint: branch === options["--current"] ? "current branch" : void 0
667
+ }))
668
+ });
669
+ if (p5.isCancel(selectedBranches)) {
670
+ p5.log.error("nothing selected!");
671
+ return await exit(1);
672
+ }
673
+ if (!selectedBranches) {
674
+ p5.log.error("no branch selected");
675
+ return await exit(1);
676
+ }
677
+ const force = options["--force"];
678
+ if (currentBranch && selectedBranches.includes(currentBranch)) {
679
+ p5.log.error("cannot delete current branch");
680
+ return await exit(1);
681
+ }
682
+ const deletedBranches = await deleteBranches(selectedBranches, force);
683
+ if (!deletedBranches) {
684
+ p5.log.error("failed to delete branches");
685
+ return await exit(1);
686
+ }
687
+ p5.log.success("branches deleted successfully");
688
+ await exit(0);
689
+ },
690
+ { enabled: false }
691
+ )
692
+ };
619
693
  var command3 = {
620
694
  name: "branch",
621
695
  description: "list branches",
@@ -669,7 +743,7 @@ var command3 = {
669
743
  },
670
744
  { enabled: false }
671
745
  ),
672
- subCommands: [current]
746
+ subCommands: [current, del]
673
747
  };
674
748
  var branch_default = command3;
675
749
 
@@ -782,7 +856,7 @@ var key = {
782
856
  }
783
857
  }));
784
858
  p7.log.success(color7.green("noto api key configured!"));
785
- console.log();
859
+ await exit(0);
786
860
  }
787
861
  };
788
862
  var model = {
@@ -802,15 +876,6 @@ var model = {
802
876
  p7.log.error(color7.red("nothing changed!"));
803
877
  return await exit(1);
804
878
  }
805
- if (model2 === "gemini-2.5-pro-exp-03-25") {
806
- const confirm2 = await p7.confirm({
807
- message: "this model has a rate limit of 5 RPM (requests per minute) 50 requests per day, do you want to continue?"
808
- });
809
- if (p7.isCancel(confirm2) || !confirm2) {
810
- p7.log.error(color7.red("nothing changed!"));
811
- return await exit(1);
812
- }
813
- }
814
879
  await StorageManager.update((current2) => ({
815
880
  ...current2,
816
881
  llm: {
@@ -819,7 +884,7 @@ var model = {
819
884
  }
820
885
  }));
821
886
  p7.log.success(color7.green("model configured!"));
822
- console.log();
887
+ await exit(0);
823
888
  }
824
889
  };
825
890
  var reset = {
@@ -836,7 +901,7 @@ var reset = {
836
901
  }
837
902
  await StorageManager.clear();
838
903
  p7.log.success(color7.green("configuration reset!"));
839
- console.log();
904
+ await exit(0);
840
905
  }
841
906
  };
842
907
  var subCommands = [key, model, reset];
@@ -846,7 +911,7 @@ var command5 = {
846
911
  usage: "noto config [subcommand]",
847
912
  execute: async (options) => {
848
913
  const command6 = await p7.select({
849
- message: "Select a subcommand",
914
+ message: "select a subcommand",
850
915
  options: subCommands.map((cmd2) => ({
851
916
  label: cmd2.description,
852
917
  value: cmd2.name
@@ -877,25 +942,25 @@ var help = {
877
942
  const command6 = getCommand(options._[0]);
878
943
  if (command6 && command6.name !== "help") {
879
944
  console.log();
880
- console.log(color8.bold("Usage"));
945
+ console.log(color8.bold("usage"));
881
946
  console.log(` ${command6.usage}`);
882
947
  console.log();
883
- console.log(color8.bold("Description"));
948
+ console.log(color8.bold("description"));
884
949
  console.log(` ${command6.description}`);
885
950
  console.log();
886
951
  } else {
887
952
  const commands2 = listCommand();
888
953
  console.log();
889
- console.log(color8.bold("Usage"));
954
+ console.log(color8.bold("usage"));
890
955
  console.log(` noto [command] [options]`);
891
956
  console.log();
892
- console.log(color8.bold("Commands"));
957
+ console.log(color8.bold("commands"));
893
958
  commands2.forEach((command7) => {
894
959
  console.log(
895
960
  ` ${color8.bold(command7.name)} ${color8.dim(command7.description)}`
896
961
  );
897
962
  });
898
- console.log();
963
+ await exit(0);
899
964
  }
900
965
  }
901
966
  };
@@ -911,7 +976,7 @@ var listCommand = () => {
911
976
  };
912
977
 
913
978
  // package.json
914
- var version = "1.1.2";
979
+ var version = "1.1.4";
915
980
 
916
981
  // src/index.ts
917
982
  var globalSpec = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snelusha/noto",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "Generate clean commit messages in a snap! ✨",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -25,10 +25,10 @@
25
25
  "noto": "./bin/noto.mjs"
26
26
  },
27
27
  "scripts": {
28
- "clean": "rm -rf .turbo node_modules dist",
29
28
  "build": "tsup --clean",
30
29
  "dev": "tsup --clean --watch",
31
- "test": "tsup --clean && vitest"
30
+ "test": "tsup --clean && vitest",
31
+ "clean": "git clean -xdf .cache .turbo node_modules"
32
32
  },
33
33
  "files": [
34
34
  "dist",
@@ -42,15 +42,15 @@
42
42
  "cli"
43
43
  ],
44
44
  "devDependencies": {
45
- "@types/node": "^22.14.0",
45
+ "@types/node": "^22.14.1",
46
46
  "tsup": "^8.4.0",
47
47
  "typescript": "^5.8.3",
48
48
  "vitest": "^3.1.1"
49
49
  },
50
50
  "dependencies": {
51
- "@ai-sdk/google": "^1.2.10",
51
+ "@ai-sdk/google": "^1.2.11",
52
52
  "@clack/prompts": "^0.10.1",
53
- "ai": "^4.3.4",
53
+ "ai": "^4.3.7",
54
54
  "arg": "^5.0.2",
55
55
  "clipboardy": "^4.0.0",
56
56
  "dedent": "^1.5.3",