-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathconfig.js
More file actions
54 lines (46 loc) · 1.34 KB
/
config.js
File metadata and controls
54 lines (46 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import chalk from 'chalk';
import {
getAllConfig,
clearAll,
getConfigPath,
} from '../utils/config-manager.js';
import {showSuccess, showInfo} from '../utils/ui.js';
import {getConvention} from '../utils/commit-conventions.js';
/**
* Configuration commands
*/
export function showConfig() {
const config = getAllConfig();
console.log(chalk.cyan('\n⚙️ Configuration'));
console.log('═'.repeat(50));
if (Object.keys(config).length === 0) {
showInfo('No configuration found.');
console.log('Run "magicc auth copilot" to get started.');
} else {
for (const [key, value] of Object.entries(config)) {
// Mask sensitive values
let displayValue = value;
if (
(key === 'openai' || key === 'githubToken') &&
typeof value === 'string' &&
value.length > 10
) {
displayValue = value.slice(0, 10) + '...';
}
// Show convention name nicely
if (key === 'convention') {
const conv = getConvention(value);
displayValue = `${value} (${conv.name})`;
}
console.log(` ${chalk.yellow(key)}: ${chalk.white(displayValue)}`);
}
}
console.log('═'.repeat(50));
console.log(chalk.gray(`📁 Config file: ${getConfigPath()}`));
console.log();
}
export function resetConfig() {
clearAll();
showSuccess('Configuration reset to defaults.');
console.log('Run "magicc auth copilot" to authenticate again.');
}