New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

pathchie-cli

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pathchie-cli - npm Package Compare versions

Comparing version
0.1.0
to
0.1.2
+40
-32
index.js

@@ -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) {

{
"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"
}
}