contribute-now 0.8.0-dev.a835394 → 0.8.0-pr.2235f44
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/cli.js +59 -244
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -7291,13 +7291,10 @@ import {
|
|
|
7291
7291
|
statSync,
|
|
7292
7292
|
writeFileSync
|
|
7293
7293
|
} from "fs";
|
|
7294
|
-
import { homedir } from "os";
|
|
7295
7294
|
import { dirname, join, resolve } from "path";
|
|
7296
7295
|
var CONFIG_FILENAME = ".contributerc.json";
|
|
7297
7296
|
var LOCAL_CONFIG_DIRNAME = "contribute-now";
|
|
7298
7297
|
var LOCAL_CONFIG_FILENAME = "config.json";
|
|
7299
|
-
var GLOBAL_CONFIG_DIRNAME = ".contribute-now";
|
|
7300
|
-
var GLOBAL_CONFIG_FILENAME = "config.json";
|
|
7301
7298
|
function findRepoRoot(cwd = process.cwd()) {
|
|
7302
7299
|
let current = resolve(cwd);
|
|
7303
7300
|
while (true) {
|
|
@@ -7387,44 +7384,13 @@ function parseConfigFile(path) {
|
|
|
7387
7384
|
aiHost: _aiHost,
|
|
7388
7385
|
...config
|
|
7389
7386
|
} = parsed;
|
|
7390
|
-
|
|
7387
|
+
return {
|
|
7391
7388
|
...config,
|
|
7389
|
+
aiEnabled: parsed.aiEnabled !== false,
|
|
7392
7390
|
aiProvider: parsed.aiProvider,
|
|
7393
7391
|
aiModel: parsed.aiModel?.trim() || undefined,
|
|
7394
7392
|
showTips: parsed.showTips !== false
|
|
7395
7393
|
};
|
|
7396
|
-
if (typeof parsed.aiEnabled === "boolean") {
|
|
7397
|
-
normalizedConfig.aiEnabled = parsed.aiEnabled;
|
|
7398
|
-
}
|
|
7399
|
-
return normalizedConfig;
|
|
7400
|
-
} catch {
|
|
7401
|
-
return null;
|
|
7402
|
-
}
|
|
7403
|
-
}
|
|
7404
|
-
function parseGlobalConfigFile(path) {
|
|
7405
|
-
try {
|
|
7406
|
-
const raw = readFileSync(path, "utf-8");
|
|
7407
|
-
const parsed = JSON.parse(raw);
|
|
7408
|
-
if (typeof parsed !== "object" || parsed === null) {
|
|
7409
|
-
return null;
|
|
7410
|
-
}
|
|
7411
|
-
if (parsed.aiProvider !== undefined && (typeof parsed.aiProvider !== "string" || !VALID_AI_PROVIDERS.includes(parsed.aiProvider))) {
|
|
7412
|
-
console.error(`Invalid aiProvider "${String(parsed.aiProvider)}" in ${GLOBAL_CONFIG_FILENAME}. Valid: ${VALID_AI_PROVIDERS.join(", ")}`);
|
|
7413
|
-
return null;
|
|
7414
|
-
}
|
|
7415
|
-
if (parsed.aiModel !== undefined && (typeof parsed.aiModel !== "string" || !parsed.aiModel.trim())) {
|
|
7416
|
-
console.error(`Invalid ${GLOBAL_CONFIG_FILENAME}: aiModel must be a non-empty string.`);
|
|
7417
|
-
return null;
|
|
7418
|
-
}
|
|
7419
|
-
if (parsed.aiEnabled !== undefined && typeof parsed.aiEnabled !== "boolean") {
|
|
7420
|
-
console.error(`Invalid ${GLOBAL_CONFIG_FILENAME}: aiEnabled must be a boolean when set.`);
|
|
7421
|
-
return null;
|
|
7422
|
-
}
|
|
7423
|
-
return {
|
|
7424
|
-
aiEnabled: parsed.aiEnabled,
|
|
7425
|
-
aiProvider: parsed.aiProvider,
|
|
7426
|
-
aiModel: parsed.aiModel?.trim() || undefined
|
|
7427
|
-
};
|
|
7428
7394
|
} catch {
|
|
7429
7395
|
return null;
|
|
7430
7396
|
}
|
|
@@ -7439,9 +7405,6 @@ function getConfigPath(cwd = process.cwd()) {
|
|
|
7439
7405
|
function getLegacyConfigPath(cwd = process.cwd()) {
|
|
7440
7406
|
return join(findRepoRoot(cwd) ?? cwd, CONFIG_FILENAME);
|
|
7441
7407
|
}
|
|
7442
|
-
function getGlobalConfigPath(baseDir = homedir()) {
|
|
7443
|
-
return join(baseDir, GLOBAL_CONFIG_DIRNAME, GLOBAL_CONFIG_FILENAME);
|
|
7444
|
-
}
|
|
7445
7408
|
function getLocalConfigPath(cwd = process.cwd()) {
|
|
7446
7409
|
const gitDir = resolveGitDir(cwd);
|
|
7447
7410
|
if (!gitDir) {
|
|
@@ -7476,25 +7439,12 @@ function getConfigLocationLabel(cwd = process.cwd()) {
|
|
|
7476
7439
|
function configExists(cwd = process.cwd()) {
|
|
7477
7440
|
return getConfigSource(cwd) !== null;
|
|
7478
7441
|
}
|
|
7479
|
-
function globalConfigExists(baseDir = homedir()) {
|
|
7480
|
-
return existsSync(getGlobalConfigPath(baseDir));
|
|
7481
|
-
}
|
|
7482
7442
|
var VALID_WORKFLOWS = ["clean-flow", "github-flow", "git-flow"];
|
|
7483
7443
|
var VALID_ROLES = ["maintainer", "contributor"];
|
|
7484
7444
|
var VALID_CONVENTIONS = ["conventional", "clean-commit", "none"];
|
|
7485
7445
|
var VALID_AI_PROVIDERS = ["copilot", "ollama-cloud", "openrouter"];
|
|
7486
|
-
function isAIEnabled(config, cliNoAI = false
|
|
7487
|
-
|
|
7488
|
-
return false;
|
|
7489
|
-
}
|
|
7490
|
-
if (typeof config.aiEnabled === "boolean") {
|
|
7491
|
-
return config.aiEnabled;
|
|
7492
|
-
}
|
|
7493
|
-
const resolvedGlobalConfig = globalConfig === undefined ? readGlobalConfig() : globalConfig;
|
|
7494
|
-
if (typeof resolvedGlobalConfig?.aiEnabled === "boolean") {
|
|
7495
|
-
return resolvedGlobalConfig.aiEnabled;
|
|
7496
|
-
}
|
|
7497
|
-
return true;
|
|
7446
|
+
function isAIEnabled(config, cliNoAI = false) {
|
|
7447
|
+
return config.aiEnabled !== false && !cliNoAI;
|
|
7498
7448
|
}
|
|
7499
7449
|
function shouldShowTips(config) {
|
|
7500
7450
|
return config?.showTips !== false;
|
|
@@ -7508,13 +7458,6 @@ function readConfig(cwd = process.cwd()) {
|
|
|
7508
7458
|
return null;
|
|
7509
7459
|
return parseConfigFile(path);
|
|
7510
7460
|
}
|
|
7511
|
-
function readGlobalConfig(baseDir = homedir()) {
|
|
7512
|
-
const path = getGlobalConfigPath(baseDir);
|
|
7513
|
-
if (!existsSync(path)) {
|
|
7514
|
-
return null;
|
|
7515
|
-
}
|
|
7516
|
-
return parseGlobalConfigFile(path);
|
|
7517
|
-
}
|
|
7518
7461
|
function writeConfig(config, cwd = process.cwd()) {
|
|
7519
7462
|
const path = getConfigPath(cwd);
|
|
7520
7463
|
const { aiHost: _aiHost, ...storedConfig } = config;
|
|
@@ -7522,15 +7465,6 @@ function writeConfig(config, cwd = process.cwd()) {
|
|
|
7522
7465
|
writeFileSync(path, `${JSON.stringify(storedConfig, null, 2)}
|
|
7523
7466
|
`, "utf-8");
|
|
7524
7467
|
}
|
|
7525
|
-
function writeGlobalConfig(config, baseDir = homedir()) {
|
|
7526
|
-
const path = getGlobalConfigPath(baseDir);
|
|
7527
|
-
mkdirSync(dirname(path), { recursive: true, mode: 448 });
|
|
7528
|
-
writeFileSync(path, `${JSON.stringify(config, null, 2)}
|
|
7529
|
-
`, {
|
|
7530
|
-
encoding: "utf-8",
|
|
7531
|
-
mode: 384
|
|
7532
|
-
});
|
|
7533
|
-
}
|
|
7534
7468
|
function isGitignored(cwd = process.cwd()) {
|
|
7535
7469
|
const gitignorePath = join(cwd, ".gitignore");
|
|
7536
7470
|
if (!existsSync(gitignorePath))
|
|
@@ -10939,19 +10873,19 @@ init_dist();
|
|
|
10939
10873
|
|
|
10940
10874
|
// src/utils/secrets.ts
|
|
10941
10875
|
import { chmodSync, existsSync as existsSync5, mkdirSync as mkdirSync4, readFileSync as readFileSync4, rmSync, writeFileSync as writeFileSync4 } from "fs";
|
|
10942
|
-
import { homedir
|
|
10876
|
+
import { homedir } from "os";
|
|
10943
10877
|
import { join as join5, resolve as resolve4 } from "path";
|
|
10944
10878
|
var CONTRIBUTE_NOW_SECRETS_DIRNAME = ".contribute-now";
|
|
10945
10879
|
var CONTRIBUTE_NOW_SECRETS_STORE_DIRNAME = "secrets";
|
|
10946
10880
|
var OLLAMA_CLOUD_API_KEY = "ollama.cloud.apiKey";
|
|
10947
10881
|
var OPENROUTER_API_KEY = "openrouter.apiKey";
|
|
10948
|
-
function getSecretsStorePath(baseDir =
|
|
10882
|
+
function getSecretsStorePath(baseDir = homedir()) {
|
|
10949
10883
|
return resolve4(baseDir, CONTRIBUTE_NOW_SECRETS_DIRNAME, CONTRIBUTE_NOW_SECRETS_STORE_DIRNAME);
|
|
10950
10884
|
}
|
|
10951
|
-
function getSecretsFilePath(baseDir =
|
|
10885
|
+
function getSecretsFilePath(baseDir = homedir()) {
|
|
10952
10886
|
return join5(getSecretsStorePath(baseDir), "store.json");
|
|
10953
10887
|
}
|
|
10954
|
-
function readSecretsStore(baseDir =
|
|
10888
|
+
function readSecretsStore(baseDir = homedir()) {
|
|
10955
10889
|
const filePath = getSecretsFilePath(baseDir);
|
|
10956
10890
|
if (!existsSync5(filePath)) {
|
|
10957
10891
|
return null;
|
|
@@ -10963,7 +10897,7 @@ function readSecretsStore(baseDir = homedir2()) {
|
|
|
10963
10897
|
return null;
|
|
10964
10898
|
}
|
|
10965
10899
|
}
|
|
10966
|
-
function writeSecretsStore(store, baseDir =
|
|
10900
|
+
function writeSecretsStore(store, baseDir = homedir()) {
|
|
10967
10901
|
const storePath = getSecretsStorePath(baseDir);
|
|
10968
10902
|
const filePath = getSecretsFilePath(baseDir);
|
|
10969
10903
|
mkdirSync4(storePath, { recursive: true, mode: 448 });
|
|
@@ -10977,23 +10911,23 @@ function writeSecretsStore(store, baseDir = homedir2()) {
|
|
|
10977
10911
|
chmodSync(filePath, 384);
|
|
10978
10912
|
} catch {}
|
|
10979
10913
|
}
|
|
10980
|
-
function hasSecretsStore(baseDir =
|
|
10914
|
+
function hasSecretsStore(baseDir = homedir()) {
|
|
10981
10915
|
return existsSync5(getSecretsFilePath(baseDir));
|
|
10982
10916
|
}
|
|
10983
|
-
async function hasOllamaCloudApiKey(baseDir =
|
|
10917
|
+
async function hasOllamaCloudApiKey(baseDir = homedir()) {
|
|
10984
10918
|
return typeof readSecretsStore(baseDir)?.[OLLAMA_CLOUD_API_KEY] === "string";
|
|
10985
10919
|
}
|
|
10986
|
-
async function getOllamaCloudApiKey(baseDir =
|
|
10920
|
+
async function getOllamaCloudApiKey(baseDir = homedir()) {
|
|
10987
10921
|
return readSecretsStore(baseDir)?.[OLLAMA_CLOUD_API_KEY] ?? null;
|
|
10988
10922
|
}
|
|
10989
|
-
async function setOllamaCloudApiKey(value, baseDir =
|
|
10923
|
+
async function setOllamaCloudApiKey(value, baseDir = homedir()) {
|
|
10990
10924
|
const existingStore = readSecretsStore(baseDir) ?? {};
|
|
10991
10925
|
writeSecretsStore({
|
|
10992
10926
|
...existingStore,
|
|
10993
10927
|
[OLLAMA_CLOUD_API_KEY]: value
|
|
10994
10928
|
}, baseDir);
|
|
10995
10929
|
}
|
|
10996
|
-
async function deleteOllamaCloudApiKey(baseDir =
|
|
10930
|
+
async function deleteOllamaCloudApiKey(baseDir = homedir()) {
|
|
10997
10931
|
const existingStore = readSecretsStore(baseDir);
|
|
10998
10932
|
if (!existingStore || !(OLLAMA_CLOUD_API_KEY in existingStore)) {
|
|
10999
10933
|
return false;
|
|
@@ -11010,20 +10944,20 @@ async function deleteOllamaCloudApiKey(baseDir = homedir2()) {
|
|
|
11010
10944
|
writeSecretsStore(nextStore, baseDir);
|
|
11011
10945
|
return true;
|
|
11012
10946
|
}
|
|
11013
|
-
async function hasOpenRouterApiKey(baseDir =
|
|
10947
|
+
async function hasOpenRouterApiKey(baseDir = homedir()) {
|
|
11014
10948
|
return typeof readSecretsStore(baseDir)?.[OPENROUTER_API_KEY] === "string";
|
|
11015
10949
|
}
|
|
11016
|
-
async function getOpenRouterApiKey(baseDir =
|
|
10950
|
+
async function getOpenRouterApiKey(baseDir = homedir()) {
|
|
11017
10951
|
return readSecretsStore(baseDir)?.[OPENROUTER_API_KEY] ?? null;
|
|
11018
10952
|
}
|
|
11019
|
-
async function setOpenRouterApiKey(value, baseDir =
|
|
10953
|
+
async function setOpenRouterApiKey(value, baseDir = homedir()) {
|
|
11020
10954
|
const existingStore = readSecretsStore(baseDir) ?? {};
|
|
11021
10955
|
writeSecretsStore({
|
|
11022
10956
|
...existingStore,
|
|
11023
10957
|
[OPENROUTER_API_KEY]: value
|
|
11024
10958
|
}, baseDir);
|
|
11025
10959
|
}
|
|
11026
|
-
async function deleteOpenRouterApiKey(baseDir =
|
|
10960
|
+
async function deleteOpenRouterApiKey(baseDir = homedir()) {
|
|
11027
10961
|
const existingStore = readSecretsStore(baseDir);
|
|
11028
10962
|
if (!existingStore || !(OPENROUTER_API_KEY in existingStore)) {
|
|
11029
10963
|
return false;
|
|
@@ -11109,31 +11043,6 @@ var DEFAULT_OLLAMA_CLOUD_MODEL = "gpt-oss:120b";
|
|
|
11109
11043
|
var DEFAULT_OLLAMA_CLOUD_HOST = "https://ollama.com/v1";
|
|
11110
11044
|
var DEFAULT_OPENROUTER_MODEL = "openai/gpt-4o-mini";
|
|
11111
11045
|
var DEFAULT_OPENROUTER_HOST = "https://openrouter.ai/api/v1";
|
|
11112
|
-
function resolveAIConfigFromSources(repoConfig, globalConfig) {
|
|
11113
|
-
const provider = repoConfig?.aiProvider ?? globalConfig?.aiProvider ?? "copilot";
|
|
11114
|
-
const useGlobalModel = !repoConfig?.aiModel && globalConfig?.aiProvider === provider;
|
|
11115
|
-
const globalModel = useGlobalModel ? globalConfig?.aiModel?.trim() : undefined;
|
|
11116
|
-
if (provider === "ollama-cloud") {
|
|
11117
|
-
return {
|
|
11118
|
-
provider,
|
|
11119
|
-
providerLabel: "Ollama Cloud",
|
|
11120
|
-
model: repoConfig?.aiModel?.trim() || globalModel || DEFAULT_OLLAMA_CLOUD_MODEL,
|
|
11121
|
-
host: DEFAULT_OLLAMA_CLOUD_HOST
|
|
11122
|
-
};
|
|
11123
|
-
}
|
|
11124
|
-
if (provider === "openrouter") {
|
|
11125
|
-
return {
|
|
11126
|
-
provider,
|
|
11127
|
-
providerLabel: "OpenRouter",
|
|
11128
|
-
model: repoConfig?.aiModel?.trim() || globalModel || DEFAULT_OPENROUTER_MODEL,
|
|
11129
|
-
host: DEFAULT_OPENROUTER_HOST
|
|
11130
|
-
};
|
|
11131
|
-
}
|
|
11132
|
-
return {
|
|
11133
|
-
provider: "copilot",
|
|
11134
|
-
providerLabel: "GitHub Copilot"
|
|
11135
|
-
};
|
|
11136
|
-
}
|
|
11137
11046
|
function prioritizeOllamaCloudModels(models, preferredModel = DEFAULT_OLLAMA_CLOUD_MODEL) {
|
|
11138
11047
|
const uniqueModels = [...new Set(models.map((model) => model.trim()).filter(Boolean))];
|
|
11139
11048
|
const sortedModels = [...uniqueModels].sort((left, right) => left.localeCompare(right));
|
|
@@ -11207,9 +11116,28 @@ function prioritizeOpenRouterModels(models, preferredModel = DEFAULT_OPENROUTER_
|
|
|
11207
11116
|
return sortedModels.includes(preferredModel) ? [preferredModel, ...sortedModels.filter((model) => model !== preferredModel)] : sortedModels;
|
|
11208
11117
|
}
|
|
11209
11118
|
function resolveAIConfig(config) {
|
|
11210
|
-
const
|
|
11211
|
-
const
|
|
11212
|
-
|
|
11119
|
+
const resolvedConfig = config ?? readConfig();
|
|
11120
|
+
const provider = resolvedConfig?.aiProvider ?? "copilot";
|
|
11121
|
+
if (provider === "ollama-cloud") {
|
|
11122
|
+
return {
|
|
11123
|
+
provider,
|
|
11124
|
+
providerLabel: "Ollama Cloud",
|
|
11125
|
+
model: resolvedConfig?.aiModel?.trim() || DEFAULT_OLLAMA_CLOUD_MODEL,
|
|
11126
|
+
host: DEFAULT_OLLAMA_CLOUD_HOST
|
|
11127
|
+
};
|
|
11128
|
+
}
|
|
11129
|
+
if (provider === "openrouter") {
|
|
11130
|
+
return {
|
|
11131
|
+
provider,
|
|
11132
|
+
providerLabel: "OpenRouter",
|
|
11133
|
+
model: resolvedConfig?.aiModel?.trim() || DEFAULT_OPENROUTER_MODEL,
|
|
11134
|
+
host: DEFAULT_OPENROUTER_HOST
|
|
11135
|
+
};
|
|
11136
|
+
}
|
|
11137
|
+
return {
|
|
11138
|
+
provider: "copilot",
|
|
11139
|
+
providerLabel: "GitHub Copilot"
|
|
11140
|
+
};
|
|
11213
11141
|
}
|
|
11214
11142
|
function suppressSubprocessWarnings() {
|
|
11215
11143
|
process.env.NODE_NO_WARNINGS = "1";
|
|
@@ -12912,62 +12840,6 @@ function buildConfigSnapshot(config, meta) {
|
|
|
12912
12840
|
}
|
|
12913
12841
|
};
|
|
12914
12842
|
}
|
|
12915
|
-
function normalizeGlobalConfig(config) {
|
|
12916
|
-
const normalized = {
|
|
12917
|
-
aiEnabled: config.aiEnabled !== false
|
|
12918
|
-
};
|
|
12919
|
-
if (normalized.aiEnabled) {
|
|
12920
|
-
normalized.aiProvider = config.aiProvider ?? "copilot";
|
|
12921
|
-
if (normalized.aiProvider === "ollama-cloud") {
|
|
12922
|
-
normalized.aiModel = (config.aiModel?.trim() || DEFAULT_OLLAMA_CLOUD_MODEL).trim();
|
|
12923
|
-
} else if (normalized.aiProvider === "openrouter") {
|
|
12924
|
-
normalized.aiModel = (config.aiModel?.trim() || DEFAULT_OPENROUTER_MODEL).trim();
|
|
12925
|
-
}
|
|
12926
|
-
}
|
|
12927
|
-
return normalized;
|
|
12928
|
-
}
|
|
12929
|
-
function buildGlobalConfigSnapshot(config) {
|
|
12930
|
-
const normalized = normalizeGlobalConfig(config);
|
|
12931
|
-
const aiProvider = normalized.aiProvider ?? "copilot";
|
|
12932
|
-
const aiEnabled = normalized.aiEnabled !== false;
|
|
12933
|
-
const providerLabel = aiProvider === "ollama-cloud" ? "Ollama Cloud" : aiProvider === "openrouter" ? "OpenRouter" : "GitHub Copilot";
|
|
12934
|
-
return {
|
|
12935
|
-
location: getGlobalConfigPath(),
|
|
12936
|
-
exists: globalConfigExists(),
|
|
12937
|
-
ai: {
|
|
12938
|
-
enabled: aiEnabled,
|
|
12939
|
-
provider: aiProvider,
|
|
12940
|
-
providerLabel,
|
|
12941
|
-
model: aiEnabled ? normalized.aiModel ?? null : null
|
|
12942
|
-
}
|
|
12943
|
-
};
|
|
12944
|
-
}
|
|
12945
|
-
async function promptForGlobalConfigEdits(current) {
|
|
12946
|
-
const normalized = normalizeGlobalConfig(current);
|
|
12947
|
-
const aiEnabled = await selectBooleanValue("Global AI default", normalized.aiEnabled !== false, "Enabled", "Disabled");
|
|
12948
|
-
if (!aiEnabled) {
|
|
12949
|
-
return {
|
|
12950
|
-
config: {
|
|
12951
|
-
aiEnabled: false
|
|
12952
|
-
}
|
|
12953
|
-
};
|
|
12954
|
-
}
|
|
12955
|
-
const currentProvider = normalized.aiProvider ?? "copilot";
|
|
12956
|
-
const aiProvider = await selectCurrentValue("Global AI provider", AI_PROVIDER_OPTIONS, currentProvider);
|
|
12957
|
-
let aiModel;
|
|
12958
|
-
if (aiProvider === "ollama-cloud") {
|
|
12959
|
-
aiModel = await inputPrompt("Global Ollama Cloud model", normalized.aiModel ?? DEFAULT_OLLAMA_CLOUD_MODEL);
|
|
12960
|
-
} else if (aiProvider === "openrouter") {
|
|
12961
|
-
aiModel = await inputPrompt("Global OpenRouter model", normalized.aiModel ?? DEFAULT_OPENROUTER_MODEL);
|
|
12962
|
-
}
|
|
12963
|
-
return {
|
|
12964
|
-
config: {
|
|
12965
|
-
aiEnabled: true,
|
|
12966
|
-
aiProvider,
|
|
12967
|
-
aiModel: aiModel?.trim() || undefined
|
|
12968
|
-
}
|
|
12969
|
-
};
|
|
12970
|
-
}
|
|
12971
12843
|
function defaultDevBranchForWorkflow(workflow) {
|
|
12972
12844
|
return workflow === "git-flow" ? "develop" : "dev";
|
|
12973
12845
|
}
|
|
@@ -13248,26 +13120,12 @@ function printConfigSummary(snapshot) {
|
|
|
13248
13120
|
}
|
|
13249
13121
|
}
|
|
13250
13122
|
}
|
|
13251
|
-
function printGlobalConfigSummary(snapshot) {
|
|
13252
|
-
info(`Global config path: ${import_picocolors10.default.bold(snapshot.location)}`);
|
|
13253
|
-
info(`Global defaults file: ${import_picocolors10.default.bold(snapshot.exists ? "present" : "missing (using built-ins)")}`);
|
|
13254
|
-
info(`AI default: ${import_picocolors10.default.bold(snapshot.ai.enabled ? "enabled" : "disabled")}`);
|
|
13255
|
-
info(`AI provider: ${import_picocolors10.default.bold(snapshot.ai.providerLabel)}`);
|
|
13256
|
-
if (snapshot.ai.model) {
|
|
13257
|
-
info(`AI model: ${import_picocolors10.default.bold(snapshot.ai.model)}`);
|
|
13258
|
-
}
|
|
13259
|
-
}
|
|
13260
13123
|
var config_default = defineCommand({
|
|
13261
13124
|
meta: {
|
|
13262
13125
|
name: "config",
|
|
13263
13126
|
description: "Inspect or edit the repo config without rerunning setup"
|
|
13264
13127
|
},
|
|
13265
13128
|
args: {
|
|
13266
|
-
global: {
|
|
13267
|
-
type: "boolean",
|
|
13268
|
-
description: "Read or edit global defaults instead of repo config",
|
|
13269
|
-
default: false
|
|
13270
|
-
},
|
|
13271
13129
|
json: {
|
|
13272
13130
|
type: "boolean",
|
|
13273
13131
|
description: "Print the active repo config as JSON with metadata",
|
|
@@ -13280,44 +13138,15 @@ var config_default = defineCommand({
|
|
|
13280
13138
|
}
|
|
13281
13139
|
},
|
|
13282
13140
|
async run({ args }) {
|
|
13141
|
+
if (!await isGitRepo()) {
|
|
13142
|
+
error("Not inside a git repository.");
|
|
13143
|
+
process.exit(1);
|
|
13144
|
+
}
|
|
13283
13145
|
if (args.json && args.edit) {
|
|
13284
13146
|
error("Use either --json or --edit, not both at the same time.");
|
|
13285
13147
|
process.exit(1);
|
|
13286
13148
|
}
|
|
13287
13149
|
await projectHeading("config", "\u2699\uFE0F");
|
|
13288
|
-
if (args.global) {
|
|
13289
|
-
const currentGlobal = readGlobalConfig() ?? {};
|
|
13290
|
-
if (args.edit) {
|
|
13291
|
-
try {
|
|
13292
|
-
const editResult = await promptForGlobalConfigEdits(currentGlobal);
|
|
13293
|
-
writeGlobalConfig(normalizeGlobalConfig(editResult.config));
|
|
13294
|
-
success("Updated global defaults.");
|
|
13295
|
-
const snapshot3 = buildGlobalConfigSnapshot(readGlobalConfig() ?? {});
|
|
13296
|
-
printGlobalConfigSummary(snapshot3);
|
|
13297
|
-
if (args.json) {
|
|
13298
|
-
console.log(JSON.stringify(snapshot3, null, 2));
|
|
13299
|
-
}
|
|
13300
|
-
return;
|
|
13301
|
-
} catch (err) {
|
|
13302
|
-
error(err instanceof Error ? err.message : String(err));
|
|
13303
|
-
process.exit(1);
|
|
13304
|
-
}
|
|
13305
|
-
}
|
|
13306
|
-
const snapshot2 = buildGlobalConfigSnapshot(currentGlobal);
|
|
13307
|
-
if (args.json) {
|
|
13308
|
-
console.log(JSON.stringify(snapshot2, null, 2));
|
|
13309
|
-
return;
|
|
13310
|
-
}
|
|
13311
|
-
printGlobalConfigSummary(snapshot2);
|
|
13312
|
-
console.log();
|
|
13313
|
-
console.log(` ${import_picocolors10.default.dim("Run `cn config --global --edit` to update global defaults.")}`);
|
|
13314
|
-
console.log();
|
|
13315
|
-
return;
|
|
13316
|
-
}
|
|
13317
|
-
if (!await isGitRepo()) {
|
|
13318
|
-
error("Not inside a git repository.");
|
|
13319
|
-
process.exit(1);
|
|
13320
|
-
}
|
|
13321
13150
|
if (!configExists()) {
|
|
13322
13151
|
error("No repo config found. Run `cn setup` first.");
|
|
13323
13152
|
process.exit(1);
|
|
@@ -13483,7 +13312,7 @@ var import_picocolors12 = __toESM(require_picocolors(), 1);
|
|
|
13483
13312
|
// package.json
|
|
13484
13313
|
var package_default = {
|
|
13485
13314
|
name: "contribute-now",
|
|
13486
|
-
version: "0.8.0-
|
|
13315
|
+
version: "0.8.0-pr.2235f44",
|
|
13487
13316
|
description: "Developer CLI that automates git workflows \u2014 branching, syncing, committing, and PRs \u2014 with multi-workflow and commit convention support.",
|
|
13488
13317
|
type: "module",
|
|
13489
13318
|
bin: {
|
|
@@ -15407,20 +15236,13 @@ var setup_default = defineCommand({
|
|
|
15407
15236
|
aiProvider = "copilot";
|
|
15408
15237
|
}
|
|
15409
15238
|
if (aiProvider === "ollama-cloud") {
|
|
15410
|
-
|
|
15411
|
-
|
|
15412
|
-
|
|
15413
|
-
|
|
15414
|
-
|
|
15415
|
-
|
|
15416
|
-
|
|
15417
|
-
promptSecret: passwordPrompt
|
|
15418
|
-
});
|
|
15419
|
-
} catch (err) {
|
|
15420
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
15421
|
-
error(message);
|
|
15422
|
-
process.exit(1);
|
|
15423
|
-
}
|
|
15239
|
+
const resolvedKey = await resolveApiKeyForSetup({
|
|
15240
|
+
providerLabel: "Ollama Cloud",
|
|
15241
|
+
hasStoredKey: await hasOllamaCloudApiKey(),
|
|
15242
|
+
getStoredKey: getOllamaCloudApiKey,
|
|
15243
|
+
select: selectPrompt,
|
|
15244
|
+
promptSecret: passwordPrompt
|
|
15245
|
+
});
|
|
15424
15246
|
aiModel = await promptForOllamaCloudModel(resolvedKey.apiKey);
|
|
15425
15247
|
try {
|
|
15426
15248
|
if (resolvedKey.shouldStore) {
|
|
@@ -15436,20 +15258,13 @@ var setup_default = defineCommand({
|
|
|
15436
15258
|
process.exit(1);
|
|
15437
15259
|
}
|
|
15438
15260
|
} else if (aiProvider === "openrouter") {
|
|
15439
|
-
|
|
15440
|
-
|
|
15441
|
-
|
|
15442
|
-
|
|
15443
|
-
|
|
15444
|
-
|
|
15445
|
-
|
|
15446
|
-
promptSecret: passwordPrompt
|
|
15447
|
-
});
|
|
15448
|
-
} catch (err) {
|
|
15449
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
15450
|
-
error(message);
|
|
15451
|
-
process.exit(1);
|
|
15452
|
-
}
|
|
15261
|
+
const resolvedKey = await resolveApiKeyForSetup({
|
|
15262
|
+
providerLabel: "OpenRouter",
|
|
15263
|
+
hasStoredKey: await hasOpenRouterApiKey(),
|
|
15264
|
+
getStoredKey: getOpenRouterApiKey,
|
|
15265
|
+
select: selectPrompt,
|
|
15266
|
+
promptSecret: passwordPrompt
|
|
15267
|
+
});
|
|
15453
15268
|
aiModel = await promptForOpenRouterModel(resolvedKey.apiKey);
|
|
15454
15269
|
try {
|
|
15455
15270
|
if (resolvedKey.shouldStore) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "contribute-now",
|
|
3
|
-
"version": "0.8.0-
|
|
3
|
+
"version": "0.8.0-pr.2235f44",
|
|
4
4
|
"description": "Developer CLI that automates git workflows — branching, syncing, committing, and PRs — with multi-workflow and commit convention support.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|