gitnexus 1.2.1 → 1.2.2
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/wiki.js +48 -14
- package/package.json +1 -1
package/dist/cli/wiki.js
CHANGED
|
@@ -95,11 +95,18 @@ export const wikiCommand = async (inputPath, options) => {
|
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
97
|
// ── Resolve LLM config (with interactive fallback) ─────────────────
|
|
98
|
-
//
|
|
99
|
-
if (options?.apiKey) {
|
|
98
|
+
// Save any CLI overrides immediately
|
|
99
|
+
if (options?.apiKey || options?.model || options?.baseUrl) {
|
|
100
100
|
const existing = await loadCLIConfig();
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
const updates = {};
|
|
102
|
+
if (options.apiKey)
|
|
103
|
+
updates.apiKey = options.apiKey;
|
|
104
|
+
if (options.model)
|
|
105
|
+
updates.model = options.model;
|
|
106
|
+
if (options.baseUrl)
|
|
107
|
+
updates.baseUrl = options.baseUrl;
|
|
108
|
+
await saveCLIConfig({ ...existing, ...updates });
|
|
109
|
+
console.log(' Config saved to ~/.gitnexus/config.json\n');
|
|
103
110
|
}
|
|
104
111
|
let llmConfig = await resolveLLMConfig({
|
|
105
112
|
model: options?.model,
|
|
@@ -114,25 +121,52 @@ export const wikiCommand = async (inputPath, options) => {
|
|
|
114
121
|
process.exitCode = 1;
|
|
115
122
|
return;
|
|
116
123
|
}
|
|
117
|
-
console.log(' No
|
|
118
|
-
console.log('
|
|
119
|
-
|
|
120
|
-
|
|
124
|
+
console.log(' No LLM configured. Let\'s set it up.\n');
|
|
125
|
+
console.log(' Supports OpenAI, OpenRouter, or any OpenAI-compatible API.\n');
|
|
126
|
+
// Provider selection
|
|
127
|
+
console.log(' [1] OpenAI (api.openai.com)');
|
|
128
|
+
console.log(' [2] OpenRouter (openrouter.ai)');
|
|
129
|
+
console.log(' [3] Custom endpoint\n');
|
|
130
|
+
const choice = await prompt(' Select provider (1/2/3): ');
|
|
131
|
+
let baseUrl;
|
|
132
|
+
let defaultModel;
|
|
133
|
+
if (choice === '2') {
|
|
134
|
+
baseUrl = 'https://openrouter.ai/api/v1';
|
|
135
|
+
defaultModel = 'openai/gpt-4o-mini';
|
|
136
|
+
}
|
|
137
|
+
else if (choice === '3') {
|
|
138
|
+
baseUrl = await prompt(' Base URL (e.g. http://localhost:11434/v1): ');
|
|
139
|
+
if (!baseUrl) {
|
|
140
|
+
console.log('\n No URL provided. Aborting.\n');
|
|
141
|
+
process.exitCode = 1;
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
defaultModel = 'gpt-4o-mini';
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
baseUrl = 'https://api.openai.com/v1';
|
|
148
|
+
defaultModel = 'gpt-4o-mini';
|
|
149
|
+
}
|
|
150
|
+
// Model
|
|
151
|
+
const modelInput = await prompt(` Model (default: ${defaultModel}): `);
|
|
152
|
+
const model = modelInput || defaultModel;
|
|
153
|
+
// API key
|
|
154
|
+
const key = await prompt(' API key: ', true);
|
|
121
155
|
if (!key) {
|
|
122
156
|
console.log('\n No key provided. Aborting.\n');
|
|
123
157
|
process.exitCode = 1;
|
|
124
158
|
return;
|
|
125
159
|
}
|
|
126
|
-
|
|
160
|
+
// Save
|
|
161
|
+
const save = await prompt('\n Save config to ~/.gitnexus/config.json? (Y/n): ');
|
|
127
162
|
if (!save || save.toLowerCase() === 'y' || save.toLowerCase() === 'yes') {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
console.log(' Key saved.\n');
|
|
163
|
+
await saveCLIConfig({ apiKey: key, baseUrl, model });
|
|
164
|
+
console.log(' Config saved.\n');
|
|
131
165
|
}
|
|
132
166
|
else {
|
|
133
|
-
console.log('
|
|
167
|
+
console.log(' Config will be used for this session only.\n');
|
|
134
168
|
}
|
|
135
|
-
llmConfig = { ...llmConfig, apiKey: key };
|
|
169
|
+
llmConfig = { ...llmConfig, apiKey: key, baseUrl, model };
|
|
136
170
|
}
|
|
137
171
|
// ── Setup progress bar ──────────────────────────────────────────────
|
|
138
172
|
const bar = new cliProgress.SingleBar({
|
package/package.json
CHANGED