@snelusha/noto 1.2.3 → 1.2.5

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 +30 -27
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -63,9 +63,8 @@ var AvailableModelsSchema = z.enum([
63
63
  "gemini-1.5-pro",
64
64
  "gemini-1.5-pro-latest",
65
65
  "gemini-2.0-flash-001",
66
- "gemini-2.0-flash-exp",
66
+ "gemini-2.0-flash",
67
67
  "gemini-2.0-flash-lite-preview-02-05",
68
- "gemini-2.5-pro-exp-03-25",
69
68
  "gemini-2.5-flash-preview-04-17",
70
69
  "gemini-2.5-pro-preview-05-06"
71
70
  ]);
@@ -74,7 +73,7 @@ var AvailableModelsSchema = z.enum([
74
73
  var StorageSchema = z2.object({
75
74
  llm: z2.object({
76
75
  apiKey: z2.string().optional(),
77
- model: AvailableModelsSchema.optional()
76
+ model: AvailableModelsSchema.optional().or(z2.string())
78
77
  }).optional(),
79
78
  lastGeneratedMessage: z2.string().optional()
80
79
  });
@@ -270,22 +269,10 @@ import dedent3 from "dedent";
270
269
 
271
270
  // src/ai/models.ts
272
271
  import { createGoogleGenerativeAI } from "@ai-sdk/google";
273
-
274
- // src/errors.ts
275
- var NotoError = class _NotoError extends Error {
276
- code;
277
- constructor(options) {
278
- super(options.message);
279
- this.code = options.code;
280
- Object.setPrototypeOf(this, _NotoError.prototype);
281
- }
282
- };
283
-
284
- // src/ai/models.ts
285
272
  var google = createGoogleGenerativeAI({
286
273
  apiKey: (await StorageManager.get()).llm?.apiKey ?? "api-key"
287
274
  });
288
- var defaultModel = "gemini-2.0-flash-lite-preview-02-05";
275
+ var defaultModel = "gemini-2.0-flash";
289
276
  var models = {
290
277
  "gemini-1.5-flash": google("gemini-1.5-flash"),
291
278
  "gemini-1.5-flash-latest": google("gemini-1.5-flash-latest"),
@@ -294,33 +281,26 @@ var models = {
294
281
  "gemini-1.5-pro": google("gemini-1.5-pro"),
295
282
  "gemini-1.5-pro-latest": google("gemini-1.5-pro-latest"),
296
283
  "gemini-2.0-flash-001": google("gemini-2.0-flash-001"),
297
- "gemini-2.0-flash-exp": google("gemini-2.0-flash-exp"),
284
+ "gemini-2.0-flash": google("gemini-2.0-flash"),
298
285
  "gemini-2.0-flash-lite-preview-02-05": google(
299
286
  "gemini-2.0-flash-lite-preview-02-05"
300
287
  ),
301
- "gemini-2.5-pro-exp-03-25": google("gemini-2.5-pro-exp-03-25"),
302
288
  "gemini-2.5-flash-preview-04-17": google("gemini-2.5-flash-preview-04-17"),
303
289
  "gemini-2.5-pro-preview-05-06": google("gemini-2.5-pro-preview-05-06")
304
290
  };
305
291
  var availableModels = Object.keys(models);
306
292
  var getModel = async () => {
307
293
  let model2 = (await StorageManager.get()).llm?.model;
308
- if (!model2) {
294
+ if (!model2 || !availableModels.includes(model2)) {
309
295
  model2 = defaultModel;
310
296
  await StorageManager.update((current2) => ({
311
297
  ...current2,
312
298
  llm: {
313
299
  ...current2.llm,
314
- model: model2
300
+ model: defaultModel
315
301
  }
316
302
  }));
317
303
  }
318
- if (!availableModels.includes(model2)) {
319
- throw new NotoError({
320
- code: "model-not-found",
321
- message: `model "${model2}" not found.`
322
- });
323
- }
324
304
  return models[model2];
325
305
  };
326
306
 
@@ -846,6 +826,7 @@ var command4 = {
846
826
  ],
847
827
  execute: withRepository(
848
828
  async (options) => {
829
+ const args = options._.slice(1);
849
830
  if (!options.isRepo) {
850
831
  p6.log.error(
851
832
  dedent6`${color6.red("no git repository found in cwd.")}
@@ -859,6 +840,28 @@ var command4 = {
859
840
  return await exit(1);
860
841
  }
861
842
  const currentBranch = await getCurrentBranch();
843
+ const branchName = args[0];
844
+ if (branchName) {
845
+ if (!branches.includes(branchName)) {
846
+ p6.log.error(
847
+ `branch ${color6.red(branchName)} does not exist in the repository`
848
+ );
849
+ return await exit(1);
850
+ }
851
+ if (branchName === currentBranch) {
852
+ p6.log.error(
853
+ `${color6.red("already on branch")} ${color6.green(branchName)}`
854
+ );
855
+ return await exit(1);
856
+ }
857
+ const result2 = await checkout(branchName);
858
+ if (!result2) {
859
+ p6.log.error(`failed to checkout ${color6.bold(branchName)}`);
860
+ return await exit(1);
861
+ }
862
+ p6.log.success(`checked out ${color6.green(branchName)}`);
863
+ return await exit(0);
864
+ }
862
865
  const branch = await p6.select({
863
866
  message: "select a branch to checkout",
864
867
  options: branches.map((branch2) => ({
@@ -1065,7 +1068,7 @@ var listCommand = () => {
1065
1068
  };
1066
1069
 
1067
1070
  // package.json
1068
- var version = "1.2.3";
1071
+ var version = "1.2.5";
1069
1072
 
1070
1073
  // src/index.ts
1071
1074
  var globalSpec = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snelusha/noto",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
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.18",
45
- "tsup": "^8.4.0",
44
+ "@types/node": "^22.15.23",
45
+ "tsup": "^8.5.0",
46
46
  "typescript": "^5.8.3",
47
- "vitest": "^3.1.3"
47
+ "vitest": "^3.1.4"
48
48
  },
49
49
  "dependencies": {
50
50
  "@ai-sdk/google": "^1.2.18",
51
51
  "@clack/prompts": "^0.10.1",
52
- "ai": "^4.3.15",
52
+ "ai": "^4.3.16",
53
53
  "arg": "^5.0.2",
54
54
  "clipboardy": "^4.0.0",
55
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.4"
59
+ "zod": "^3.25.32"
60
60
  }
61
61
  }