@narrative-os/cli 0.1.1 ā 0.1.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/commands/config.d.ts +1 -1
- package/dist/commands/config.js +20 -3
- package/dist/index.js +4 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ interface Config {
|
|
|
3
3
|
apiKey: string;
|
|
4
4
|
model: string;
|
|
5
5
|
}
|
|
6
|
-
export declare function configCommand(): Promise<void>;
|
|
6
|
+
export declare function configCommand(showOnly?: boolean): Promise<void>;
|
|
7
7
|
export declare function getConfig(): Config | null;
|
|
8
8
|
export declare function applyConfig(): void;
|
|
9
9
|
export {};
|
package/dist/commands/config.js
CHANGED
|
@@ -31,9 +31,26 @@ function saveConfig(config) {
|
|
|
31
31
|
(0, fs_1.mkdirSync)(CONFIG_DIR, { recursive: true });
|
|
32
32
|
(0, fs_1.writeFileSync)(CONFIG_FILE, JSON.stringify(config, null, 2));
|
|
33
33
|
}
|
|
34
|
-
async function configCommand() {
|
|
35
|
-
const { select, password } = await import('@inquirer/prompts');
|
|
34
|
+
async function configCommand(showOnly = false) {
|
|
36
35
|
const existing = loadConfig();
|
|
36
|
+
// Show current configuration
|
|
37
|
+
if (showOnly) {
|
|
38
|
+
if (!existing) {
|
|
39
|
+
console.log('ā No configuration found.');
|
|
40
|
+
console.log('Run: nos config to set up your LLM provider');
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
console.log('\nš Current Configuration:');
|
|
44
|
+
console.log('========================');
|
|
45
|
+
console.log(`Provider: ${existing.provider}`);
|
|
46
|
+
console.log(`Model: ${existing.model}`);
|
|
47
|
+
console.log(`API Key: ${existing.apiKey ? 'ā
Set (' + '*'.repeat(Math.min(existing.apiKey.length - 4, 8)) + existing.apiKey.slice(-4) + ')' : 'ā Not set'}`);
|
|
48
|
+
console.log('');
|
|
49
|
+
console.log(`Config file: ${CONFIG_FILE}`);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
// Interactive configuration
|
|
53
|
+
const { select, password } = await import('@inquirer/prompts');
|
|
37
54
|
const provider = await select({
|
|
38
55
|
message: 'Select LLM provider:',
|
|
39
56
|
choices: PROVIDERS.map(p => ({ name: p.name, value: p.value })),
|
|
@@ -51,7 +68,7 @@ async function configCommand() {
|
|
|
51
68
|
});
|
|
52
69
|
const config = { provider: provider, model, apiKey };
|
|
53
70
|
saveConfig(config);
|
|
54
|
-
console.log(`\
|
|
71
|
+
console.log(`\nā
Configuration saved for ${providerInfo.name}`);
|
|
55
72
|
console.log(`Model: ${model}`);
|
|
56
73
|
}
|
|
57
74
|
function getConfig() {
|
package/dist/index.js
CHANGED
|
@@ -29,7 +29,10 @@ if (process.argv.length <= 2) {
|
|
|
29
29
|
program
|
|
30
30
|
.command('config')
|
|
31
31
|
.description('Configure LLM provider and API key')
|
|
32
|
-
.
|
|
32
|
+
.option('-s, --show', 'Show current configuration')
|
|
33
|
+
.action((options) => {
|
|
34
|
+
(0, config_js_1.configCommand)(options.show);
|
|
35
|
+
});
|
|
33
36
|
// Story Management
|
|
34
37
|
program
|
|
35
38
|
.command('init')
|