UNPKG

@cirrusinvicta/ai-commit-toolkit

Version:

AI-powered conventional commit generation with centralized configuration, OpenAI integration, and automated deployment workflows

117 lines (92 loc) 4.5 kB
#!/bin/bash # AI Prompts Configuration # Centralized prompts for AI commit toolkit scripts # This file is sourced by various scripts that need AI prompts # Main AI commit generation prompt # Used by: ai-commit.sh, test-ai-setup.sh AI_COMMIT_PROMPT="Generate a conventional commit message for the following changes. Guidelines: - Format: type(scope): subject - Subject line: max 72 characters, focused on WHAT changed (not HOW) - Header (type + scope + subject): max 100 characters - Type and scope must be lowercase - Use 'chore' for version bumps, release process changes, or lockfile updates - For multiple unrelated changes, choose the most significant one for the subject - ONLY if the subject alone isn't sufficient, include a multi-line body (wrapped at 72 chars per line) - IF using a multi-line body, keep it consice and only include absolutely necessary details - Use a bullet list in the body for multiple significant changes - Include a footer ONLY when there are actual breaking changes or issue references (Examples: 'BREAKING CHANGE: API endpoint removed', 'Fixes #456' - only if relevant) For multiple files: - If files are related (same feature/fix), use a unified subject - If files are diverse, use a general scope like 'setup', 'config', or 'project' - Prioritize the most impactful change in the subject line Examples: - Change: Bump version to 1.2.3 or update package-lock.json Commit: chore(release): bump version to 1.2.3 - Change: Add new feature for user login Commit: feat(auth): add user login functionality - Change: Fix broken navbar link Commit: fix(navbar): correct broken link - Change: Initial project setup with multiple config files Commit: chore(setup): initialize project with AI commit toolkit Example (multi-line body for multiple changes): chore(setup): initialize AI commit toolkit - Add Husky hooks for commit message validation - Configure commitlint for conventional commits - Create environment and configuration files - Install project dependencies and scripts Files changed: \$FILES Changes: \$DIFF Important: - Do NOT add issue references like 'Closes #123' unless the changes actually reference a specific issue - Do NOT add 'BREAKING CHANGE:' unless there are actual breaking changes - Focus on describing the actual changes, not fictional examples Respond with ONLY the commit message. Do not include explanations or commentary." # AI commit helper prompt (for interactive mode) # Used by: commit-helper-ai.sh AI_COMMIT_HELPER_PROMPT="Generate a conventional commit message for these changes. # Example mappings: - Change: Bump version to 1.2.3 or update package-lock.json Commit: chore(release): bump version to 1.2.3 - Change: Add new feature for user login Commit: feat(auth): add user login functionality - Change: Fix broken navbar link Commit: fix(navbar): correct broken link Context: - Repository: \$REPO_NAME - Branch: \$BRANCH_NAME - Files modified: \$FILES Rules: - Use the 'chore' type for version bumps, release process changes, or package manager lockfile updates. - Maximum 100 characters for header (including type, scope, and subject) - Maximum 72 characters for subject - Format: type(scope): description - Include a body only if the primary purpose is not clear from the header - Body should be wrapped at 72 characters - Include a footer ONLY for actual breaking changes or real issue references - Type and scope should be lowercase - Be descriptive but concise - Consider the business impact - Focus on WHAT changed, not HOW Changes: \$DIFF Important: Only add issue references or breaking change notes if they are actually relevant to the changes. Provide the commit message and a brief explanation of why this format was chosen." # OpenAI API Configuration OPENAI_MODEL="gpt-4o-mini" OPENAI_MAX_TOKENS=100 OPENAI_TEMPERATURE=0.3 OPENAI_API_URL="https://api.openai.com/v1/chat/completions" # Commit message validation rules MAX_COMMIT_LENGTH=100 WARN_COMMIT_LENGTH=72 # Valid conventional commit types VALID_COMMIT_TYPES="feat,fix,docs,style,refactor,perf,test,chore,build,ci,revert" # Exclusion patterns for files/directories to ignore in AI commit context # Note: package-lock.json is excluded from AI analysis but should still be committed AI_COMMIT_EXCLUDE="node_modules/ package-lock.json .env" # Exclusion patterns for .gitignore (what should never be committed) # Note: package-lock.json is NOT included here - it should be committed GITIGNORE_EXCLUDE="node_modules .env"