@snelusha/noto 1.0.2 → 1.0.3

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/dist/index.js CHANGED
@@ -132,10 +132,10 @@ var exit = async (code) => {
132
132
  };
133
133
 
134
134
  // src/middleware/auth.ts
135
- var withAuth = (fn, options = {}) => {
135
+ var withAuth = (fn, options = { enabled: true }) => {
136
136
  return async (opts) => {
137
137
  const storage = await StorageManager.get();
138
- if (!storage.llm?.apiKey && !options.silent) {
138
+ if (!storage.llm?.apiKey && options.enabled) {
139
139
  p.log.error(
140
140
  dedent`${color.red("noto api key is missing.")}
141
141
  ${color.dim(`run ${color.cyan("`noto config key`")} to set it up.`)}`
@@ -176,10 +176,10 @@ var commit = async (message) => {
176
176
  };
177
177
 
178
178
  // src/middleware/git.ts
179
- var withRepository = (fn, options = {}) => {
179
+ var withRepository = (fn, options = { enabled: true }) => {
180
180
  return async (opts) => {
181
181
  const isRepo = await isGitRepository();
182
- if (!isRepo && !options.silent) {
182
+ if (!isRepo && options.enabled) {
183
183
  p2.log.error(
184
184
  dedent2`${color2.red("no git repository found in cwd.")}
185
185
  ${color2.dim(`run ${color2.cyan("`git init`")} to initialize a new repository.`)}`
@@ -188,7 +188,7 @@ var withRepository = (fn, options = {}) => {
188
188
  }
189
189
  opts.isRepo = isRepo;
190
190
  const diff = await getStagedDiff();
191
- if (!diff && !options.silent) {
191
+ if (!diff && options.enabled) {
192
192
  p2.log.error(
193
193
  dedent2`${color2.red("no staged changes found.")}
194
194
  ${color2.dim(`run ${color2.cyan("`git add <file>`")} or ${color2.cyan("`git add .`")} to stage changes.`)}`
@@ -222,7 +222,7 @@ var NotoError = class _NotoError extends Error {
222
222
  var google = createGoogleGenerativeAI({
223
223
  apiKey: (await StorageManager.get()).llm?.apiKey ?? "api-key"
224
224
  });
225
- var defaultModel = "gemini-2.0-flash-exp";
225
+ var defaultModel = "gemini-2.0-pro-exp-02-05";
226
226
  var models = {
227
227
  "gemini-1.5-flash": google("gemini-1.5-flash"),
228
228
  "gemini-1.5-flash-latest": google("gemini-1.5-flash-latest"),
@@ -238,7 +238,17 @@ var models = {
238
238
  };
239
239
  var availableModels = Object.keys(models);
240
240
  var getModel = async () => {
241
- const model2 = (await StorageManager.get()).llm?.model ?? defaultModel;
241
+ let model2 = (await StorageManager.get()).llm?.model;
242
+ if (!model2) {
243
+ model2 = defaultModel;
244
+ await StorageManager.update((current) => ({
245
+ ...current,
246
+ llm: {
247
+ ...current.llm,
248
+ model: model2
249
+ }
250
+ }));
251
+ }
242
252
  if (!availableModels.includes(model2)) {
243
253
  throw new NotoError({
244
254
  code: "model-not-found",
@@ -481,7 +491,7 @@ var command2 = {
481
491
  }
482
492
  console.log();
483
493
  },
484
- { silent: true }
494
+ { enabled: false }
485
495
  )
486
496
  )
487
497
  };
@@ -606,7 +616,7 @@ var getCommand = (name, cmds = commands) => {
606
616
  };
607
617
 
608
618
  // package.json
609
- var version = "1.0.2";
619
+ var version = "1.0.3";
610
620
 
611
621
  // src/index.ts
612
622
  var globalSpec = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snelusha/noto",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Generate clean commit messages in a snap! ✨",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/bin/noto.mjs DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
-
4
- import "../dist/index.js";