xoegit 1.1.4 → 1.1.5

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/README.md CHANGED
@@ -17,6 +17,7 @@
17
17
  - **Atomic Commits** — Automatically suggests splitting large changes into multiple logical commits
18
18
  - **Execute Mode** — Optionally execute commits with confirmation using `--execute`
19
19
  - **Context Aware** — Provide context with `--context` for more accurate commit messages
20
+ - **Explain Mode** — Learn commit crafting with `--explain` to see reasoning behind each grouping
20
21
  - **Smart Fallback** — Automatically switches between Gemini models when rate limits are hit
21
22
  - **Semantic Commits** — Strictly follows [Conventional Commits](https://www.conventionalcommits.org/)
22
23
  - **PR Ready** — Generates ready-to-use PR title and description
@@ -37,13 +38,19 @@ You remain in full control of your git workflow.
37
38
  - **Git**: Must be installed and available in your PATH
38
39
  - **API Key**: A Google Gemini API key ([get one here](https://aistudio.google.com/))
39
40
 
40
- ### Install
41
+ ### Quick Start
42
+
43
+ ```bash
44
+ npx xoegit
45
+ ```
46
+
47
+ ### Global Installation (Optional)
41
48
 
42
49
  ```bash
43
50
  npm install -g xoegit
44
51
  ```
45
52
 
46
- **or** install from source:
53
+ ### Install from Source
47
54
 
48
55
  ```bash
49
56
  git clone git@github.com:ujangdoubleday/xoegit.git
@@ -59,7 +66,13 @@ Simply run `xoegit` for the first time. It will prompt you for your API Key secu
59
66
 
60
67
  ## Usage
61
68
 
62
- Then, from whatever project you're working on, just run:
69
+ From any git repository, just run:
70
+
71
+ ```bash
72
+ npx xoegit
73
+ ```
74
+
75
+ **or** if installed globally:
63
76
 
64
77
  ```bash
65
78
  xoegit
@@ -74,6 +87,7 @@ xoegit
74
87
  | `-k, --api-key <key>` | Use specific API key for this session |
75
88
  | `-c, --context <text>` | Provide context for more accurate suggestions |
76
89
  | `-e, --execute` | Execute commits after confirmation prompt |
90
+ | `--explain` | Show reasoning behind each commit grouping |
77
91
  | `-s, --set-key <key>` | Save API key to config |
78
92
  | `-d, --delete-key` | Delete saved API key from config |
79
93
  | `-V, --version` | Show version |
@@ -84,36 +98,41 @@ xoegit
84
98
  **Basic usage:**
85
99
 
86
100
  ```bash
87
- xoegit
101
+ npx xoegit
88
102
  ```
89
103
 
90
104
  **With context for better commit type detection:**
91
105
 
92
106
  ```bash
93
- xoegit --context "refactoring folder structure"
94
- xoegit -c "fixing authentication bug"
95
- xoegit -c "adding new payment feature"
107
+ npx xoegit --context "refactoring folder structure"
108
+ npx xoegit -c "fixing authentication bug"
109
+ npx xoegit -c "adding new payment feature"
96
110
  ```
97
111
 
98
- **Use API key for this session only (not saved):**
99
-
100
112
  ```bash
101
- xoegit --api-key "YOUR_GEMINI_API_KEY"
113
+ npx xoegit --api-key "YOUR_GEMINI_API_KEY"
102
114
  ```
103
115
 
104
116
  **Manage API key:**
105
117
 
106
118
  ```bash
107
- xoegit --set-key "YOUR_GEMINI_API_KEY"
108
- xoegit --delete-key
119
+ npx xoegit --set-key "YOUR_GEMINI_API_KEY"
120
+ npx xoegit --delete-key
109
121
  ```
110
122
 
111
123
  **Execute mode (auto-commit with confirmation):**
112
124
 
113
125
  ```bash
114
- xoegit --execute
115
- xoegit -e
116
- xoegit -e -c "fixing critical bug"
126
+ npx xoegit --execute
127
+ npx xoegit -e
128
+ npx xoegit -e -c "fixing critical bug"
129
+ ```
130
+
131
+ **Explain mode (verbose reasoning):**
132
+
133
+ ```bash
134
+ npx xoegit --explain
135
+ npx xoegit --explain -c "refactoring auth module"
117
136
  ```
118
137
 
119
138
  ### Sample Output
@@ -137,6 +156,20 @@ pr description: feat(auth): implement secure login
137
156
  - refactor(utils): improve error logging
138
157
  ```
139
158
 
159
+ ### Explain Mode Output
160
+
161
+ ```
162
+ commit 1
163
+ git add src/auth/login.ts src/auth/validator.ts
164
+ git commit -m "feat(auth): add login validation"
165
+ why: I grouped these files because they both handle authentication logic and the validator is directly used by login.ts.
166
+
167
+ commit 2
168
+ git add package.json package-lock.json
169
+ git commit -m "chore: update dependencies"
170
+ why: I separated dependency updates from code changes to keep the commit atomic and make it easy to revert if needed.
171
+ ```
172
+
140
173
  ### Execute Mode Output
141
174
 
142
175
  ```
@@ -80,7 +80,7 @@ export async function analyzeAction() {
80
80
  return;
81
81
  }
82
82
  // 3. Generate Prompt
83
- const systemPrompt = await generateSystemPrompt();
83
+ const systemPrompt = await generateSystemPrompt({ explain: options.explain });
84
84
  // Get user context if provided
85
85
  const userContext = options.context || '';
86
86
  if (userContext) {
@@ -9,4 +9,5 @@ program
9
9
  .option('-c, --context <context>', 'Context for the changes (e.g., "refactoring folder structure")')
10
10
  .option('-s, --set-key <key>', 'Save Gemini API Key to config (overwrites existing)')
11
11
  .option('-d, --delete-key', 'Delete saved API Key from config')
12
- .option('-e, --execute', 'Execute commit after confirmation prompt');
12
+ .option('-e, --execute', 'Execute commit after confirmation prompt')
13
+ .option('--explain', 'Show explanation for each commit grouping (verbose mode)');
@@ -4,7 +4,7 @@ import url from 'url';
4
4
  /**
5
5
  * Generates the system prompt for the AI
6
6
  */
7
- export async function generateSystemPrompt() {
7
+ export async function generateSystemPrompt(options = {}) {
8
8
  let rulesContent = '';
9
9
  try {
10
10
  const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
@@ -15,6 +15,33 @@ export async function generateSystemPrompt() {
15
15
  console.warn('Could not read RULES.md, using default rules.');
16
16
  rulesContent = 'Follow conventional commits.';
17
17
  }
18
+ // Build explain mode instructions
19
+ const explainInstructions = options.explain
20
+ ? `
21
+ EXPLAIN MODE ENABLED:
22
+ For each commit, you MUST add a "why:" line directly after the git commit command (no blank line in between).
23
+ This line should explain the logical reasoning behind grouping these specific files together.
24
+
25
+ Format:
26
+ commit N
27
+ git add <files>
28
+ git commit -m "<message>"
29
+ why: <one sentence explaining why these files are grouped together>
30
+
31
+ Example:
32
+ commit 1
33
+ git add src/auth/login.ts src/auth/utils.ts
34
+ git commit -m "feat(auth): add login validation"
35
+ why: I grouped these files because they both handle authentication logic and the validation directly depends on the auth utilities.
36
+
37
+ commit 2
38
+ git add package.json package-lock.json
39
+ git commit -m "chore: update dependencies"
40
+ why: I separated dependency updates from code changes to keep the commit atomic and make it easy to revert if needed.
41
+
42
+ The explanation should help developers understand your commit crafting logic for educational purposes.
43
+ `
44
+ : '';
18
45
  return `
19
46
  You are a Git Commit Assistant for the 'xoegit' CLI.
20
47
  Your goal is to suggest git commands and commit messages based on the provided changes.
@@ -28,7 +55,7 @@ Your goal is to suggest git commands and commit messages based on the provided c
28
55
  RULES FROM USER:
29
56
  ${rulesContent}
30
57
  ---
31
-
58
+ ${explainInstructions}
32
59
  IMPORTANT:
33
60
  - You definitely MUST NOT execute commands. You only suggest them.
34
61
  - Output MUST be strictly valid shell commands or clear instructions as per the examples in RULES.md.
package/dist/utils/ui.js CHANGED
@@ -53,6 +53,10 @@ function formatSuggestionLine(line) {
53
53
  if (line.startsWith('pr title:') || line.startsWith('pr description:')) {
54
54
  return chalk.yellow(line);
55
55
  }
56
+ // Format explanation lines from --explain mode
57
+ if (line.startsWith('why:')) {
58
+ return brand.muted(' ') + chalk.italic.hex('#A78BFA')(line);
59
+ }
56
60
  return line;
57
61
  }
58
62
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xoegit",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "AI-powered CLI tool for generating semantic git commit messages and PR descriptions",
5
5
  "license": "MIT",
6
6
  "author": "ujangdoubleday",