atlasia-ghost 0.2.0 → 0.3.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/ghost.js +18 -9
- package/package.json +2 -2
package/ghost.js
CHANGED
|
@@ -17,6 +17,7 @@ const os = require('os');
|
|
|
17
17
|
// ⚙️ CONFIGURATION & CONSTANTES
|
|
18
18
|
// ==============================================================================
|
|
19
19
|
const CONFIG_FILE = path.join(os.homedir(), '.ghost');
|
|
20
|
+
const HISTORY_FILE = path.join(os.homedir(), '.ghost_history');
|
|
20
21
|
const SAFE_EXTENSIONS = new Set(['.md', '.txt', '.csv', '.html', '.css', '.scss', '.lock', '.xml', '.json']);
|
|
21
22
|
const SAFE_FILES = new Set(['mvnw', 'gradlew', 'package-lock.json', 'yarn.lock', 'pom.xml']);
|
|
22
23
|
|
|
@@ -62,21 +63,29 @@ class ConfigManager {
|
|
|
62
63
|
console.log(`${Colors.DIM}Configuration sauvegardée dans ${CONFIG_FILE}${Colors.ENDC}`);
|
|
63
64
|
}
|
|
64
65
|
|
|
65
|
-
async getApiKey() {
|
|
66
|
-
|
|
66
|
+
async getApiKey(provider = 'groq') {
|
|
67
|
+
const keyMap = {
|
|
68
|
+
groq: { env: 'GROQ_API_KEY', config: 'groq_api_key', label: 'Groq', url: 'https://console.groq.com', prefix: 'gsk_' },
|
|
69
|
+
openai: { env: 'OPENAI_API_KEY', config: 'openai_api_key', label: 'OpenAI', url: 'https://platform.openai.com', prefix: 'sk-' },
|
|
70
|
+
anthropic: { env: 'ANTHROPIC_API_KEY', config: 'anthropic_api_key', label: 'Anthropic', url: 'https://console.anthropic.com', prefix: 'sk-ant' },
|
|
71
|
+
gemini: { env: 'GEMINI_API_KEY', config: 'gemini_api_key', label: 'Gemini', url: 'https://aistudio.google.com', prefix: '' }
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const info = keyMap[provider] || keyMap.groq;
|
|
75
|
+
let key = process.env[info.env] || this.config[info.config];
|
|
67
76
|
|
|
68
77
|
if (!key) {
|
|
69
|
-
console.log(`\n${Colors.WARNING}⚠️ Configuration manquante${Colors.ENDC}`);
|
|
70
|
-
console.log(`${Colors.DIM}Pour utiliser Ghost, vous avez besoin d'une clé API
|
|
71
|
-
console.log(`${Colors.BLUE}👉 Obtenir une clé :
|
|
78
|
+
console.log(`\n${Colors.WARNING}⚠️ Configuration manquante pour ${info.label}${Colors.ENDC}`);
|
|
79
|
+
console.log(`${Colors.DIM}Pour utiliser Ghost avec ${info.label}, vous avez besoin d'une clé API.${Colors.ENDC}`);
|
|
80
|
+
console.log(`${Colors.BLUE}👉 Obtenir une clé : ${info.url}${Colors.ENDC}\n`);
|
|
72
81
|
|
|
73
|
-
key = await promptUser(`${Colors.BOLD}Collez votre clé
|
|
82
|
+
key = await promptUser(`${Colors.BOLD}Collez votre clé ${info.label} : ${Colors.ENDC}`);
|
|
74
83
|
|
|
75
|
-
if (key && key.trim()
|
|
76
|
-
this.config.
|
|
84
|
+
if (key && key.trim()) {
|
|
85
|
+
this.config[info.config] = key.trim();
|
|
77
86
|
this.save();
|
|
78
87
|
} else {
|
|
79
|
-
console.log(`${Colors.FAIL}❌ Clé
|
|
88
|
+
console.log(`${Colors.FAIL}❌ Clé manquante. Abandon.${Colors.ENDC}`);
|
|
80
89
|
process.exit(1);
|
|
81
90
|
}
|
|
82
91
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "atlasia-ghost",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Utilitaire de verification, validation, et de proposition de commits basé sur l'IA",
|
|
5
5
|
"main": "ghost.js",
|
|
6
6
|
"files": [
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"automate",
|
|
27
27
|
"ai",
|
|
28
28
|
"cli",
|
|
29
|
-
"
|
|
29
|
+
"npm"
|
|
30
30
|
],
|
|
31
31
|
"author": "Adel Lamallam",
|
|
32
32
|
"license": "MIT",
|