@snelusha/noto 1.2.5 → 1.2.7

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 (2) hide show
  1. package/dist/index.js +57 -8
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -220,7 +220,15 @@ var getBranches = async (remote) => {
220
220
  };
221
221
  var checkout = async (branch) => {
222
222
  try {
223
- await git.checkout(branch);
223
+ await git.checkout(branch, {});
224
+ return true;
225
+ } catch {
226
+ return false;
227
+ }
228
+ };
229
+ var checkoutLocalBranch = async (branch) => {
230
+ try {
231
+ await git.checkoutLocalBranch(branch);
224
232
  return true;
225
233
  } catch {
226
234
  return false;
@@ -822,6 +830,12 @@ var command4 = {
822
830
  flag: "--copy",
823
831
  alias: "-c",
824
832
  description: "copy the selected branch to clipboard"
833
+ },
834
+ {
835
+ type: Boolean,
836
+ flag: "--create",
837
+ alias: "-b",
838
+ description: "create a new branch"
825
839
  }
826
840
  ],
827
841
  execute: withRepository(
@@ -841,11 +855,46 @@ var command4 = {
841
855
  }
842
856
  const currentBranch = await getCurrentBranch();
843
857
  const branchName = args[0];
858
+ if (options["--create"]) {
859
+ if (branches.includes(branchName)) {
860
+ p6.log.error(
861
+ `branch ${color6.red(branchName)} already exists in the repository`
862
+ );
863
+ return await exit(1);
864
+ }
865
+ const result2 = await checkoutLocalBranch(branchName);
866
+ if (!result2) {
867
+ p6.log.error(
868
+ `failed to create and checkout ${color6.bold(branchName)}`
869
+ );
870
+ return await exit(1);
871
+ }
872
+ p6.log.success(`created and checked out ${color6.green(branchName)}`);
873
+ return await exit(0);
874
+ }
844
875
  if (branchName) {
845
876
  if (!branches.includes(branchName)) {
846
877
  p6.log.error(
847
878
  `branch ${color6.red(branchName)} does not exist in the repository`
848
879
  );
880
+ const createBranch = await p6.confirm({
881
+ message: `do you want to create branch ${color6.green(branchName)}?`
882
+ });
883
+ if (p6.isCancel(createBranch)) {
884
+ p6.log.error("aborted");
885
+ return await exit(1);
886
+ }
887
+ if (createBranch) {
888
+ const result3 = await checkoutLocalBranch(branchName);
889
+ if (!result3) {
890
+ p6.log.error(
891
+ `failed to create and checkout ${color6.bold(branchName)}`
892
+ );
893
+ return await exit(1);
894
+ }
895
+ p6.log.success(`created and checked out ${color6.green(branchName)}`);
896
+ return await exit(0);
897
+ }
849
898
  return await exit(1);
850
899
  }
851
900
  if (branchName === currentBranch) {
@@ -912,10 +961,10 @@ var key = {
912
961
  usage: "noto config key [options]",
913
962
  execute: async (options) => {
914
963
  if ((await StorageManager.get()).llm?.apiKey) {
915
- const confirm2 = await p7.confirm({
964
+ const confirm3 = await p7.confirm({
916
965
  message: "noto api key already configured, do you want to update it?"
917
966
  });
918
- if (p7.isCancel(confirm2) || !confirm2) {
967
+ if (p7.isCancel(confirm3) || !confirm3) {
919
968
  p7.log.error(color7.red("nothing changed!"));
920
969
  return await exit(1);
921
970
  }
@@ -960,10 +1009,10 @@ var model = {
960
1009
  return await exit(1);
961
1010
  }
962
1011
  if (model2 === "gemini-2.5-pro-preview-05-06") {
963
- const confirm2 = await p7.confirm({
1012
+ const confirm3 = await p7.confirm({
964
1013
  message: "this model does not have free quota tier, do you want to continue?"
965
1014
  });
966
- if (p7.isCancel(confirm2) || !confirm2) {
1015
+ if (p7.isCancel(confirm3) || !confirm3) {
967
1016
  p7.log.error(color7.red("nothing changed!"));
968
1017
  return await exit(1);
969
1018
  }
@@ -984,10 +1033,10 @@ var reset = {
984
1033
  description: "reset configuration",
985
1034
  usage: "noto config reset",
986
1035
  execute: async () => {
987
- const confirm2 = await p7.confirm({
1036
+ const confirm3 = await p7.confirm({
988
1037
  message: "are you sure you want to reset the configuration?"
989
1038
  });
990
- if (p7.isCancel(confirm2) || !confirm2) {
1039
+ if (p7.isCancel(confirm3) || !confirm3) {
991
1040
  p7.log.error(color7.red("nothing changed!"));
992
1041
  return await exit(1);
993
1042
  }
@@ -1068,7 +1117,7 @@ var listCommand = () => {
1068
1117
  };
1069
1118
 
1070
1119
  // package.json
1071
- var version = "1.2.5";
1120
+ var version = "1.2.7";
1072
1121
 
1073
1122
  // src/index.ts
1074
1123
  var globalSpec = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snelusha/noto",
3
- "version": "1.2.5",
3
+ "version": "1.2.7",
4
4
  "description": "Generate clean commit messages in a snap! ✨",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -44,10 +44,10 @@
44
44
  "@types/node": "^22.15.23",
45
45
  "tsup": "^8.5.0",
46
46
  "typescript": "^5.8.3",
47
- "vitest": "^3.1.4"
47
+ "vitest": "^3.2.2"
48
48
  },
49
49
  "dependencies": {
50
- "@ai-sdk/google": "^1.2.18",
50
+ "@ai-sdk/google": "^1.2.19",
51
51
  "@clack/prompts": "^0.10.1",
52
52
  "ai": "^4.3.16",
53
53
  "arg": "^5.0.2",
@@ -56,6 +56,6 @@
56
56
  "picocolors": "^1.1.1",
57
57
  "simple-git": "^3.27.0",
58
58
  "tinyexec": "^0.3.2",
59
- "zod": "^3.25.32"
59
+ "zod": "^3.25.51"
60
60
  }
61
61
  }