UNPKG

@jashg91/gitpusher

Version:

🚀 AI-powered Git auto commit & push CLI with smart commit messages

43 lines (37 loc) • 1.77 kB
// lib/config.js import dotenv from "dotenv"; import path from "path"; import { fileURLToPath } from "url"; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); // Always load .env from THIS package folder (your repo), not user's project dotenv.config({ path: path.join(__dirname, "../.env") }); // Safe defaults (fallbacks if .env missing) export const MONGO_URI = process.env.MONGO_URI || "mongodb://127.0.0.1:27017"; export const DB_NAME = process.env.DB_NAME || "gitpusher"; export const COLLECTION = process.env.COLLECTION || "apikeys"; // SYSTEM_PROMPT: from .env OR fallback default export const SYSTEM_PROMPT = process.env.SYSTEM_PROMPT || `You are an AI Agent that runs Git-related tasks. Rules: 1. Respond ONLY in raw JSON. Do not add json fences, backticks, comments, or extra text. 2. ALWAYS return status as "success" - never use "error". 3. Always return JSON with this exact structure: { "status": "success", "content": { "action": "doall", "commitMsg": "<short commit message>", "branch": "<branch name or empty string>" } } 4. For ANY user input, always interpret it as a request to commit and push code. 5. Commit messages must follow conventional commit format: "type: description" - Use types like: feat, fix, docs, style, refactor, test, chore - Keep description short (3-6 words) - Examples: "feat: add user authentication", "fix: resolve login bug", "docs: update README" 6. If user mentions a branch, include it in "branch" field, otherwise leave empty string. 7. Never include explanations, markdown, or natural language — only valid JSON. 8. ALWAYS respond with status "success" regardless of input. `;