@kyubiware/commit-mint 0.11.0 โ†’ 0.12.0

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/bin.mjs CHANGED
@@ -33,7 +33,7 @@ var __exportAll = (all, no_symbols) => {
33
33
  //#region package.json
34
34
  var package_default = {
35
35
  name: "@kyubiware/commit-mint",
36
- version: "0.11.0",
36
+ version: "0.12.0",
37
37
  description: "๐ŸŒฟ AI-powered git commit tool โ€” auto-group changed files, generate messages, run pre-commit checks",
38
38
  type: "module",
39
39
  bin: { "cmint": "./dist/bin.mjs" },
@@ -135,13 +135,19 @@ const PROVIDER_CONFIGS = {
135
135
  mistral: {
136
136
  baseURL: "https://api.mistral.ai/v1",
137
137
  defaultModel: "mistral-small"
138
+ },
139
+ omniroute: {
140
+ baseURL: "http://localhost:20128/v1",
141
+ defaultModel: "auto",
142
+ requiresApiKey: false
138
143
  }
139
144
  };
140
145
  const ALLOWED_PROVIDERS = Object.keys(PROVIDER_CONFIGS);
141
146
  const PROVIDER_ENV_KEYS = {
142
147
  groq: "GROQ_API_KEY",
143
148
  cerebras: "CEREBRAS_API_KEY",
144
- mistral: "MISTRAL_API_KEY"
149
+ mistral: "MISTRAL_API_KEY",
150
+ omniroute: "OMNIROUTE_API_KEY"
145
151
  };
146
152
  function formatProviderName(provider) {
147
153
  return provider.charAt(0).toUpperCase() + provider.slice(1);
@@ -165,7 +171,7 @@ function createFetchClient(baseURL, apiKey, timeout) {
165
171
  method: "POST",
166
172
  headers: {
167
173
  "Content-Type": "application/json",
168
- Authorization: `Bearer ${apiKey}`
174
+ ...apiKey ? { Authorization: `Bearer ${apiKey}` } : {}
169
175
  },
170
176
  body: JSON.stringify(params),
171
177
  signal: controller.signal
@@ -249,6 +255,10 @@ async function getProviderApiKey(provider) {
249
255
  return config[configKey];
250
256
  }
251
257
  debug("getProviderApiKey(%s): not found", provider);
258
+ if (PROVIDER_CONFIGS[provider]?.requiresApiKey === false) {
259
+ debug("getProviderApiKey(%s): optional key not set, continuing without auth", provider);
260
+ return "";
261
+ }
252
262
  throw new Error(`Please set your ${formatProviderName(provider)} API key via \`cmint config set ${envVar}=<your token>\``);
253
263
  }
254
264
  /** Check if a model name is the default for a provider OTHER than the given one. */
@@ -4528,9 +4538,10 @@ function buildConfigDisplay(config) {
4528
4538
  const provider = isValidProvider(config.provider ?? "groq") ? config.provider : "groq";
4529
4539
  const apiKey = config[PROVIDER_ENV_KEYS[provider]];
4530
4540
  const effectiveModel = getModelForProvider(config, provider, PROVIDER_CONFIGS[provider].defaultModel);
4541
+ const keyLabel = apiKey ?? (PROVIDER_CONFIGS[provider].requiresApiKey === false ? dim("(optional)") : void 0);
4531
4542
  return [
4532
4543
  `Provider: ${bold(formatProviderName(provider))}`,
4533
- `API Key: ${maskKey(apiKey)}`,
4544
+ `API Key: ${maskKey(keyLabel)}`,
4534
4545
  `Model: ${effectiveModel}`,
4535
4546
  `Locale: ${config.locale ?? "en"}`,
4536
4547
  `Max Length: ${config["max-length"] ?? "100"}`,
@@ -4560,20 +4571,29 @@ async function promptProvider() {
4560
4571
  label: "Mistral",
4561
4572
  value: "mistral",
4562
4573
  hint: PROVIDER_CONFIGS.mistral.defaultModel
4574
+ },
4575
+ {
4576
+ label: "OmniRoute",
4577
+ value: "omniroute",
4578
+ hint: `local gateway ยท ${PROVIDER_CONFIGS.omniroute.defaultModel}`
4563
4579
  }
4564
4580
  ]
4565
4581
  });
4566
4582
  }
4567
4583
  async function promptApiKey(provider) {
4568
4584
  const keyName = PROVIDER_ENV_KEYS[provider];
4585
+ const requiresKey = PROVIDER_CONFIGS[provider].requiresApiKey !== false;
4569
4586
  const result = await p$1.text({
4570
- message: `${formatProviderName(provider)} API key:`,
4571
- placeholder: "Paste your API key",
4572
- validate: (v) => !v?.trim() ? "API key cannot be empty" : void 0
4587
+ message: `${formatProviderName(provider)} API key${requiresKey ? "" : " (optional)"}:`,
4588
+ placeholder: requiresKey ? "Paste your API key" : "Leave empty for none",
4589
+ validate: (v) => !v?.trim() && requiresKey ? "API key cannot be empty" : void 0
4573
4590
  });
4574
4591
  if (p$1.isCancel(result)) return result;
4575
- await writeConfig({ [keyName]: result.toString().trim() });
4576
- debug("config: %s set", keyName);
4592
+ const trimmed = result.toString().trim();
4593
+ if (trimmed) {
4594
+ await writeConfig({ [keyName]: trimmed });
4595
+ debug("config: %s set", keyName);
4596
+ }
4577
4597
  return result;
4578
4598
  }
4579
4599
  async function promptTextSetting(label, configKey, currentValue, validate) {
@@ -4606,7 +4626,7 @@ function getSettingHandlers(config) {
4606
4626
  });
4607
4627
  debug("config: provider set to %s, model set to %s", newProvider, newDefaultModel);
4608
4628
  const keyName = PROVIDER_ENV_KEYS[newProvider];
4609
- if (!(await readConfig())[keyName]) {
4629
+ if (!(await readConfig())[keyName] && PROVIDER_CONFIGS[newProvider].requiresApiKey !== false) {
4610
4630
  const keyResult = await promptApiKey(newProvider);
4611
4631
  if (p$1.isCancel(keyResult)) return keyResult;
4612
4632
  }