pathchie-cli
Advanced tools
+40
-32
@@ -11,18 +11,18 @@ #!/usr/bin/env node | ||
| import fetch from "node-fetch"; | ||
| import updateNotifier from "update-notifier"; | ||
| import pkg from "./package.json" assert { type: "json" }; | ||
| dotenv.config(); | ||
| // 🔔 Check for updates | ||
| updateNotifier({ pkg }).notify(); | ||
| const __filename = fileURLToPath(import.meta.url); | ||
| const __dirname = path.dirname(__filename); | ||
| const envPath = path.join(__dirname, ".env"); | ||
| // Charger .env s'il existe | ||
| if (fs.existsSync(envPath)) { | ||
| dotenv.config({ path: envPath }); | ||
| } | ||
| function gradientText(text) { | ||
| const colours = [chalk.hex("#00bfff"), chalk.hex("#8a2be2"), chalk.hex("#ff69b4")]; | ||
| return text | ||
| .split("") | ||
| .map((char, i) => colours[i % colours.length](char)) | ||
| .join(""); | ||
| return text.split("").map((char, i) => | ||
| colours[i % colours.length](char) | ||
| ).join(""); | ||
| } | ||
@@ -41,3 +41,3 @@ | ||
| const versionLine = chalk.gray("v0.1.0‑beta"); | ||
| const versionLine = chalk.gray(`v${pkg.version}`); | ||
| const padded = " ".repeat(Math.max(0, process.stdout.columns - versionLine.length)) + versionLine; | ||
@@ -56,24 +56,36 @@ console.log(padded + "\n"); | ||
| async function authenticate() { | ||
| if (process.env.GEMINI_API_KEY) { | ||
| console.log(chalk.green("🔐 Using saved Pathchie API key.\n")); | ||
| return; | ||
| } | ||
| const answer = await inquirer.prompt([ | ||
| { | ||
| type: "input", | ||
| name: "apiKey", | ||
| message: "Please enter your PATHCHIE API Key (only once):" | ||
| type: "list", | ||
| name: "authChoice", | ||
| message: "Get started\nHow would you like to authenticate for this project?", | ||
| choices: [ | ||
| { name: "Use Pathchie API Key", value: "key" }, | ||
| { name: "Skip for now", value: "skip" } | ||
| ] | ||
| } | ||
| ]); | ||
| const key = answer.apiKey.trim(); | ||
| if (!key) { | ||
| console.log(chalk.red("⚠️ No key entered. Exiting.")); | ||
| process.exit(1); | ||
| if (answer.authChoice === "key") { | ||
| const keyAnswer = await inquirer.prompt([ | ||
| { | ||
| type: "input", | ||
| name: "apiKey", | ||
| message: "Please enter your PATHCHIE API Key:" | ||
| } | ||
| ]); | ||
| const key = keyAnswer.apiKey.trim(); | ||
| if (!key) { | ||
| console.log(chalk.red("⚠️ No key entered. Exiting.")); | ||
| process.exit(1); | ||
| } | ||
| const envPath = path.join(__dirname, ".env"); | ||
| fs.writeFileSync(envPath, `GEMINI_API_KEY=${key}\n`, { encoding: "utf8", flag: "w" }); | ||
| process.env.GEMINI_API_KEY = key; | ||
| console.log(chalk.green("✅ Pathchie API key saved successfully!\n")); | ||
| } else { | ||
| console.log(chalk.yellow("⚠️ Skipping authentication. You may be limited in functionality.\n")); | ||
| } | ||
| fs.writeFileSync(envPath, `GEMINI_API_KEY=${key}\n`, { encoding: "utf8", flag: "w" }); | ||
| dotenv.config({ path: envPath }); // Recharge la clé en mémoire | ||
| console.log(chalk.green("✅ Pathchie API key saved successfully!\n")); | ||
| } | ||
@@ -116,6 +128,3 @@ | ||
| { | ||
| role: "user", | ||
| parts: [ | ||
| { text } | ||
| ] | ||
| parts: [{ text }] | ||
| } | ||
@@ -134,3 +143,2 @@ ] | ||
| console.log(chalk.red("⚠️ No response from Gemini API.\n")); | ||
| console.log("🔍 Raw response:", JSON.stringify(data, null, 2)); | ||
| } | ||
@@ -137,0 +145,0 @@ } catch (err) { |
+4
-3
| { | ||
| "name": "pathchie-cli", | ||
| "version": "0.1.0", | ||
| "version": "0.1.2", | ||
| "description": "Interactive CLI for Pathchie IA", | ||
@@ -8,4 +8,4 @@ "bin": { | ||
| }, | ||
| "type": "module", | ||
| "main": "index.js", | ||
| "type": "module", | ||
| "files": [ | ||
@@ -32,4 +32,5 @@ "index.js" | ||
| "inquirer": "^9.0.0", | ||
| "node-fetch": "^3.3.2" | ||
| "node-fetch": "^3.3.2", | ||
| "update-notifier": "^6.0.2" | ||
| } | ||
| } |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
5254
6.53%134
5.51%5
-16.67%6
20%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added