@mehmetsagir/git-ai 0.0.9 → 0.0.19

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.
Files changed (66) hide show
  1. package/README.md +135 -297
  2. package/dist/commit.d.ts +1 -4
  3. package/dist/commit.d.ts.map +1 -1
  4. package/dist/commit.js +214 -208
  5. package/dist/commit.js.map +1 -1
  6. package/dist/config.d.ts +0 -39
  7. package/dist/config.d.ts.map +1 -1
  8. package/dist/config.js +3 -95
  9. package/dist/config.js.map +1 -1
  10. package/dist/git.d.ts +19 -51
  11. package/dist/git.d.ts.map +1 -1
  12. package/dist/git.js +137 -269
  13. package/dist/git.js.map +1 -1
  14. package/dist/index.js +54 -109
  15. package/dist/index.js.map +1 -1
  16. package/dist/openai.d.ts +2 -21
  17. package/dist/openai.d.ts.map +1 -1
  18. package/dist/openai.js +17 -96
  19. package/dist/openai.js.map +1 -1
  20. package/dist/prompts.d.ts +2 -16
  21. package/dist/prompts.d.ts.map +1 -1
  22. package/dist/prompts.js +32 -146
  23. package/dist/prompts.js.map +1 -1
  24. package/dist/reset.d.ts +0 -3
  25. package/dist/reset.d.ts.map +1 -1
  26. package/dist/reset.js +10 -20
  27. package/dist/reset.js.map +1 -1
  28. package/dist/setup.d.ts +0 -3
  29. package/dist/setup.d.ts.map +1 -1
  30. package/dist/setup.js +28 -156
  31. package/dist/setup.js.map +1 -1
  32. package/dist/stash.d.ts +2 -0
  33. package/dist/stash.d.ts.map +1 -0
  34. package/dist/stash.js +818 -0
  35. package/dist/stash.js.map +1 -0
  36. package/dist/types.d.ts +9 -23
  37. package/dist/types.d.ts.map +1 -1
  38. package/dist/utils/hunk-parser.d.ts +22 -0
  39. package/dist/utils/hunk-parser.d.ts.map +1 -0
  40. package/dist/utils/hunk-parser.js +155 -0
  41. package/dist/utils/hunk-parser.js.map +1 -0
  42. package/package.json +8 -9
  43. package/dist/add.d.ts +0 -5
  44. package/dist/add.d.ts.map +0 -1
  45. package/dist/add.js +0 -98
  46. package/dist/add.js.map +0 -1
  47. package/dist/commit-processor.d.ts +0 -6
  48. package/dist/commit-processor.d.ts.map +0 -1
  49. package/dist/commit-processor.js +0 -226
  50. package/dist/commit-processor.js.map +0 -1
  51. package/dist/update.d.ts +0 -9
  52. package/dist/update.d.ts.map +0 -1
  53. package/dist/update.js +0 -69
  54. package/dist/update.js.map +0 -1
  55. package/dist/user-management.d.ts +0 -10
  56. package/dist/user-management.d.ts.map +0 -1
  57. package/dist/user-management.js +0 -175
  58. package/dist/user-management.js.map +0 -1
  59. package/dist/users.d.ts +0 -9
  60. package/dist/users.d.ts.map +0 -1
  61. package/dist/users.js +0 -129
  62. package/dist/users.js.map +0 -1
  63. package/dist/utils/validation.d.ts +0 -24
  64. package/dist/utils/validation.d.ts.map +0 -1
  65. package/dist/utils/validation.js +0 -81
  66. package/dist/utils/validation.js.map +0 -1
package/dist/index.js CHANGED
@@ -41,120 +41,65 @@ const commander_1 = require("commander");
41
41
  const chalk_1 = __importDefault(require("chalk"));
42
42
  const setup = __importStar(require("./setup"));
43
43
  const commit = __importStar(require("./commit"));
44
- const users = __importStar(require("./users"));
45
44
  const reset = __importStar(require("./reset"));
46
- const add = __importStar(require("./add"));
47
- const update = __importStar(require("./update"));
48
- const package_json_1 = __importDefault(require("../package.json"));
45
+ const stash = __importStar(require("./stash"));
49
46
  const errors_1 = require("./utils/errors");
50
47
  const program = new commander_1.Command();
51
- /**
52
- * Handle command errors consistently
53
- */
54
- function handleError(error, showStack = false) {
55
- const err = error instanceof Error ? error : new Error((0, errors_1.getErrorMessage)(error));
56
- console.error(chalk_1.default.red(`\n❌ Error: ${err.message}\n`));
57
- if (showStack && err.stack) {
58
- console.error(chalk_1.default.gray(err.stack));
59
- }
48
+ function handleError(error) {
49
+ console.error(chalk_1.default.red(`\n❌ Error: ${(0, errors_1.getErrorMessage)(error)}\n`));
60
50
  process.exit(1);
61
51
  }
62
- // Check for --update flag before parsing
63
- if (process.argv.includes("--update")) {
64
- (async () => {
65
- try {
66
- await update.checkAndUpdate();
67
- process.exit(0);
68
- }
69
- catch (error) {
70
- handleError(error);
71
- }
72
- })();
73
- // Don't continue - the async function will exit the process when done
74
- }
75
- else {
76
- // Check for updates silently in background (after a delay to not block startup)
77
- setTimeout(() => {
78
- update.checkForUpdates();
79
- }, 1000);
80
- program
81
- .name("git-ai")
82
- .description("AI-powered git commit tool that analyzes diffs and creates conventional commit messages")
83
- .version(package_json_1.default.version)
84
- .option("--update", "Check for updates and update to latest version");
85
- program
86
- .command("setup")
87
- .description("Initial setup - OpenAI API key and git user configuration")
88
- .action(async () => {
89
- try {
90
- await setup.runSetup();
91
- }
92
- catch (error) {
93
- handleError(error);
94
- }
95
- });
96
- program
97
- .command("commit")
98
- .description("Analyze git diffs and create commits")
99
- .option("-u, --user <user>", "Git user ID or email to use (instead of default user)")
100
- .action(async (options) => {
101
- try {
102
- await commit.runCommit(options.user);
103
- }
104
- catch (error) {
105
- handleError(error, true);
106
- }
107
- });
108
- program
109
- .command("add")
110
- .alias("add-user")
111
- .description("Add a new git user profile")
112
- .action(async () => {
113
- try {
114
- await add.addUser();
115
- }
116
- catch (error) {
117
- handleError(error);
118
- }
119
- });
120
- program
121
- .command("list")
122
- .alias("users")
123
- .description("List all configured git user profiles")
124
- .action(() => {
125
- try {
126
- users.listUsers();
127
- }
128
- catch (error) {
129
- handleError(error);
130
- }
131
- });
132
- program
133
- .command("remove")
134
- .alias("delete")
135
- .description("Remove a git user profile")
136
- .action(async () => {
137
- try {
138
- await users.removeUser();
139
- }
140
- catch (error) {
141
- handleError(error);
142
- }
143
- });
144
- program
145
- .command("reset")
146
- .description("Reset all configuration (deletes OpenAI key and all git users)")
147
- .action(async () => {
148
- try {
149
- await reset.resetConfig();
150
- }
151
- catch (error) {
152
- handleError(error);
153
- }
154
- });
155
- if (process.argv.length === 2) {
156
- program.help();
52
+ program
53
+ .name("git-ai")
54
+ .description("AI-powered git commit tool")
55
+ .version(require("../package.json").version);
56
+ program
57
+ .command("setup")
58
+ .description("Configure OpenAI API key")
59
+ .action(async () => {
60
+ try {
61
+ await setup.runSetup();
157
62
  }
158
- program.parse(process.argv);
63
+ catch (error) {
64
+ handleError(error);
65
+ }
66
+ });
67
+ program
68
+ .command("commit")
69
+ .description("Analyze changes and create commits")
70
+ .action(async () => {
71
+ try {
72
+ await commit.runCommit();
73
+ }
74
+ catch (error) {
75
+ handleError(error);
76
+ }
77
+ });
78
+ program
79
+ .command("reset")
80
+ .description("Reset configuration")
81
+ .action(async () => {
82
+ try {
83
+ await reset.resetConfig();
84
+ }
85
+ catch (error) {
86
+ handleError(error);
87
+ }
88
+ });
89
+ program
90
+ .command("stash")
91
+ .description("View git stashes in browser")
92
+ .action(async () => {
93
+ try {
94
+ await stash.runStashViewer();
95
+ }
96
+ catch (error) {
97
+ handleError(error);
98
+ }
99
+ });
100
+ // Show help if no command provided
101
+ if (process.argv.length === 2) {
102
+ program.help();
159
103
  }
104
+ program.parse(process.argv);
160
105
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,yCAAoC;AACpC,kDAA0B;AAC1B,+CAAiC;AACjC,iDAAmC;AACnC,+CAAiC;AACjC,+CAAiC;AACjC,2CAA6B;AAC7B,iDAAmC;AACnC,mEAA0C;AAC1C,2CAAiD;AAEjD,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B;;GAEG;AACH,SAAS,WAAW,CAAC,KAAc,EAAE,SAAS,GAAG,KAAK;IACpD,MAAM,GAAG,GACP,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,IAAA,wBAAe,EAAC,KAAK,CAAC,CAAC,CAAC;IACrE,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG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ist/openai.d.ts CHANGED
@@ -1,22 +1,3 @@
1
- import OpenAI from 'openai';
2
- import { AnalysisResult } from './types';
3
- /**
4
- * Initialize OpenAI client
5
- */
6
- export declare function initOpenAI(apiKey: string): OpenAI;
7
- /**
8
- * Get OpenAI client
9
- */
10
- export declare function getOpenAIClient(): OpenAI;
11
- /**
12
- * Analyze git diff and create commit groups
13
- */
14
- export declare function analyzeDiffAndGroup(diff: string, apiKey: string): Promise<AnalysisResult>;
15
- /**
16
- * Generate commit message for a single diff (simple usage)
17
- */
18
- export declare function generateCommitMessage(diff: string, apiKey: string): Promise<{
19
- commitMessage: string;
20
- commitBody: string;
21
- }>;
1
+ import { AnalysisResult } from "./types";
2
+ export declare function analyzeAndGroup(formattedDiff: string, stats: string, apiKey: string): Promise<AnalysisResult>;
22
3
  //# sourceMappingURL=openai.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../src/openai.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAKzC;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAMjD;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAKxC;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAmC/F;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,CAmChI"}
1
+ {"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../src/openai.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,wBAAsB,eAAe,CACnC,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,cAAc,CAAC,CAmBzB"}
package/dist/openai.js CHANGED
@@ -36,103 +36,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.initOpenAI = initOpenAI;
40
- exports.getOpenAIClient = getOpenAIClient;
41
- exports.analyzeDiffAndGroup = analyzeDiffAndGroup;
42
- exports.generateCommitMessage = generateCommitMessage;
39
+ exports.analyzeAndGroup = analyzeAndGroup;
43
40
  const openai_1 = __importDefault(require("openai"));
44
41
  const prompts = __importStar(require("./prompts"));
45
- const errors_1 = require("./utils/errors");
46
- let openaiClient = null;
47
- /**
48
- * Initialize OpenAI client
49
- */
50
- function initOpenAI(apiKey) {
51
- if (!apiKey) {
52
- throw new Error('OpenAI API key is required');
53
- }
54
- openaiClient = new openai_1.default({ apiKey });
55
- return openaiClient;
56
- }
57
- /**
58
- * Get OpenAI client
59
- */
60
- function getOpenAIClient() {
61
- if (!openaiClient) {
62
- throw new Error('OpenAI client not initialized. Call initOpenAI() first.');
63
- }
64
- return openaiClient;
65
- }
66
- /**
67
- * Analyze git diff and create commit groups
68
- */
69
- async function analyzeDiffAndGroup(diff, apiKey) {
70
- if (!apiKey) {
71
- throw new Error('OpenAI API key is required');
72
- }
73
- initOpenAI(apiKey);
74
- const client = getOpenAIClient();
75
- const systemPrompt = prompts.getDiffAnalysisSystemPrompt();
76
- const userPrompt = prompts.getDiffAnalysisUserPrompt(diff);
77
- try {
78
- const response = await client.chat.completions.create({
79
- model: 'gpt-4o-mini',
80
- messages: [
81
- { role: 'system', content: systemPrompt },
82
- { role: 'user', content: userPrompt }
83
- ],
84
- temperature: 0.3,
85
- response_format: { type: 'json_object' }
86
- });
87
- const content = response.choices[0]?.message?.content;
88
- if (!content) {
89
- throw new Error('No response from OpenAI');
90
- }
91
- const result = JSON.parse(content);
92
- return result;
93
- }
94
- catch (error) {
95
- const message = (0, errors_1.getErrorMessage)(error);
96
- if (message.includes('API key')) {
97
- throw new Error('Invalid OpenAI API key');
98
- }
99
- throw new Error(`OpenAI API error: ${message}`);
100
- }
101
- }
102
- /**
103
- * Generate commit message for a single diff (simple usage)
104
- */
105
- async function generateCommitMessage(diff, apiKey) {
106
- if (!apiKey) {
107
- throw new Error('OpenAI API key is required');
108
- }
109
- initOpenAI(apiKey);
110
- const client = getOpenAIClient();
111
- const systemPrompt = prompts.getSingleCommitSystemPrompt();
112
- const userPrompt = prompts.getSingleCommitUserPrompt(diff);
113
- try {
114
- const response = await client.chat.completions.create({
115
- model: 'gpt-4o-mini',
116
- messages: [
117
- { role: 'system', content: systemPrompt },
118
- { role: 'user', content: userPrompt }
119
- ],
120
- temperature: 0.3,
121
- response_format: { type: 'json_object' }
122
- });
123
- const content = response.choices[0]?.message?.content;
124
- if (!content) {
125
- throw new Error('No response from OpenAI');
126
- }
127
- const result = JSON.parse(content);
128
- return result;
129
- }
130
- catch (error) {
131
- const message = (0, errors_1.getErrorMessage)(error);
132
- if (message.includes('API key')) {
133
- throw new Error('Invalid OpenAI API key');
134
- }
135
- throw new Error(`OpenAI API error: ${message}`);
136
- }
42
+ async function analyzeAndGroup(formattedDiff, stats, apiKey) {
43
+ const client = new openai_1.default({ apiKey });
44
+ const response = await client.chat.completions.create({
45
+ model: "gpt-4o-mini",
46
+ messages: [
47
+ { role: "system", content: prompts.getSystemPrompt() },
48
+ { role: "user", content: prompts.getUserPrompt(formattedDiff, stats) },
49
+ ],
50
+ temperature: 0.3,
51
+ response_format: { type: "json_object" },
52
+ });
53
+ const content = response.choices[0]?.message?.content;
54
+ if (!content) {
55
+ throw new Error("No response from OpenAI");
56
+ }
57
+ return JSON.parse(content);
137
58
  }
138
59
  //# sourceMappingURL=openai.js.map
@@ -1 +1 @@
1
- {"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;YACR,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,eAAe,EAAE,EAAE;YACtD,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,aAAa,EAAE,KAAK,CAAC,EAAE;SACvE;QACD,WAAW,EAAE,GAAG;QAChB,eAAe,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE;KACzC,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC;IACtD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAmB,CAAC;AAC/C,CAAC"}
package/dist/prompts.d.ts CHANGED
@@ -1,17 +1,3 @@
1
- /**
2
- * Get system prompt for diff analysis and grouping
3
- */
4
- export declare function getDiffAnalysisSystemPrompt(): string;
5
- /**
6
- * Get user prompt for diff analysis
7
- */
8
- export declare function getDiffAnalysisUserPrompt(diff: string): string;
9
- /**
10
- * Get system prompt for single commit message generation
11
- */
12
- export declare function getSingleCommitSystemPrompt(): string;
13
- /**
14
- * Get user prompt for single commit message
15
- */
16
- export declare function getSingleCommitUserPrompt(diff: string): string;
1
+ export declare function getSystemPrompt(): string;
2
+ export declare function getUserPrompt(formattedDiff: string, stats: string): string;
17
3
  //# sourceMappingURL=prompts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,2BAA2B,IAAI,MAAM,CA6FpD;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAuB9D;AAED;;GAEG;AACH,wBAAgB,2BAA2B,IAAI,MAAM,CAoBpD;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAY9D"}
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,IAAI,MAAM,CAwCxC;AAED,wBAAgB,aAAa,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAU1E"}
package/dist/prompts.js CHANGED
@@ -1,171 +1,57 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDiffAnalysisSystemPrompt = getDiffAnalysisSystemPrompt;
4
- exports.getDiffAnalysisUserPrompt = getDiffAnalysisUserPrompt;
5
- exports.getSingleCommitSystemPrompt = getSingleCommitSystemPrompt;
6
- exports.getSingleCommitUserPrompt = getSingleCommitUserPrompt;
7
- /**
8
- * Get system prompt for diff analysis and grouping
9
- */
10
- function getDiffAnalysisSystemPrompt() {
11
- return `You are a git commit expert. You analyze git diffs, group them logically, and create Conventional Commits standard commit messages for each group.
3
+ exports.getSystemPrompt = getSystemPrompt;
4
+ exports.getUserPrompt = getUserPrompt;
5
+ function getSystemPrompt() {
6
+ return `You are a git commit expert. Analyze diff hunks and group them into logical commits.
12
7
 
13
- CRITICAL GROUPING PRINCIPLES (MUST FOLLOW):
8
+ IMPORTANT: Each file may have multiple independent changes (hunks). Group related hunks together, even if they're from different files. Unrelated changes in the same file should be in different commits.
14
9
 
15
- 1. **Group Related Files Together**:
16
- - Files that implement the same feature MUST be in the same commit
17
- - Files that import/use each other MUST be in the same commit
18
- - Test files MUST be with their corresponding source files
19
- - Configuration files related to a feature MUST be with that feature
20
- - Example: If you add a UserService, put UserService.ts, UserService.test.ts, and user.types.ts together
10
+ GROUPING RULES:
11
+ 1. Group hunks by logical change (same feature, same fix, same refactor)
12
+ 2. Related changes across multiple files go together
13
+ 3. Unrelated changes in the SAME file should be SEPARATE commits
14
+ 4. Keep test hunks with their source code hunks
15
+ 5. Binary files are treated as single hunks
21
16
 
22
- 2. **Respect Dependencies**:
23
- - Base/utility files that other files depend on should be committed FIRST
24
- - Files that depend on others should be committed AFTER their dependencies
25
- - Example: If types.ts is used by service.ts, commit types.ts first, then service.ts
26
-
27
- 3. **Feature-Based Grouping**:
28
- - Group by feature/module (authentication, payment, user management, etc.)
29
- - Group by component area (UI components, API endpoints, database models)
30
- - Group by layer (models, services, controllers, views)
31
-
32
- 4. **Type-Based Grouping** (when features are unrelated):
33
- - All documentation changes together
34
- - All test files together (if not related to specific features)
35
- - All style/formatting changes together
36
- - All configuration changes together
37
-
38
- 5. **Atomic Commits**:
39
- - Each commit should represent ONE complete, logical change
40
- - Each commit should leave the codebase in a working state
41
- - Avoid mixing unrelated changes in one commit
42
-
43
- 6. **Optimal Grouping Strategy**:
44
- - MAXIMIZE grouping: Put as many related files together as possible
45
- - MINIMIZE commits: Create fewer, well-grouped commits rather than many tiny commits
46
- - Only create separate commits when files are truly unrelated
47
- - If 10 files are all part of one feature, they should be ONE commit, not 10
48
-
49
- GROUPING EXAMPLES:
50
-
51
- ✅ GOOD GROUPING:
52
- - Group 1: Authentication feature (auth.ts, auth.test.ts, auth.types.ts, auth.config.ts) - 4 files, 1 commit
53
- - Group 2: User profile feature (profile.ts, profile.test.ts, profile.types.ts) - 3 files, 1 commit
54
-
55
- ❌ BAD GROUPING:
56
- - Group 1: auth.ts - 1 file
57
- - Group 2: auth.test.ts - 1 file
58
- - Group 3: auth.types.ts - 1 file
59
- (This is wrong! These are related and should be ONE commit)
60
-
61
- Conventional Commits format:
17
+ COMMIT MESSAGE FORMAT (Conventional Commits):
62
18
  <type>(<scope>): <subject>
63
19
 
64
- <body>
65
-
66
- <footer>
67
-
68
20
  Types:
69
21
  - feat: New feature
70
22
  - fix: Bug fix
71
- - refactor: Code refactoring
72
- - style: Formatting, styling changes
23
+ - refactor: Code restructuring
24
+ - style: Formatting, CSS
73
25
  - docs: Documentation
74
26
  - test: Tests
75
- - chore: Maintenance tasks
76
-
77
- Each commit group must contain:
78
- 1. Group number (sequential: 1, 2, 3...)
79
- 2. Group description (what feature/change this represents)
80
- 3. File list (full file paths - ALL related files together)
81
- 4. Commit message in Conventional Commits format
82
- 5. Commit message body (detailed description of changes)
83
-
84
- IMPORTANT:
85
- - Each group will be created as a SEPARATE COMMIT
86
- - Group files MAXIMALLY - put all related files together
87
- - Only separate into different commits if files are truly unrelated
88
- - Order groups by dependencies (base files first, dependent files later)
27
+ - chore: Maintenance, config
89
28
 
90
- Respond in JSON format:
29
+ Respond in JSON:
91
30
  {
92
31
  "groups": [
93
32
  {
94
33
  "number": 1,
95
- "description": "Authentication feature implementation",
96
- "files": ["src/auth.ts", "src/auth.test.ts", "src/auth.types.ts", "src/auth.config.ts"],
97
- "commitMessage": "feat(auth): add OAuth2 authentication support",
98
- "commitBody": "Implemented complete OAuth2 authentication flow. Added authentication service, types, configuration, and comprehensive tests."
34
+ "description": "Brief description of what this commit does",
35
+ "hunks": [
36
+ { "file": "path/to/file.ts", "hunkIndex": 0 },
37
+ { "file": "path/to/file.ts", "hunkIndex": 2 },
38
+ { "file": "path/to/other.ts", "hunkIndex": 0 }
39
+ ],
40
+ "commitMessage": "feat(scope): description",
41
+ "commitBody": "Optional details"
99
42
  }
100
- ],
101
- "summary": "Total X groups, Y file changes"
43
+ ]
102
44
  }`;
103
45
  }
104
- /**
105
- * Get user prompt for diff analysis
106
- */
107
- function getDiffAnalysisUserPrompt(diff) {
108
- return `Analyze the following git diff and group it into logical commit groups.
46
+ function getUserPrompt(formattedDiff, stats) {
47
+ return `Analyze these changes and group the hunks into logical commits.
109
48
 
110
- CRITICAL INSTRUCTIONS:
111
- 1. **MAXIMIZE GROUPING**: Put ALL related files together in the same commit
112
- 2. **Identify relationships**: Look for imports, shared functionality, feature boundaries
113
- 3. **Group by feature first**: If files are part of the same feature, they MUST be in one commit
114
- 4. **Minimize commit count**: Only create separate commits when files are truly unrelated
115
- 5. **Order by dependencies**: Commit base/utility files before files that use them
49
+ ${stats}
116
50
 
117
- Analyze file relationships:
118
- - Do files import each other? → Same commit
119
- - Do files implement the same feature? → Same commit
120
- - Are there test files? → Same commit as the code they test
121
- - Are there type definitions? → Same commit as the code that uses them
122
-
123
- \`\`\`
124
- ${diff}
125
- \`\`\`
126
-
127
- Create the MINIMUM number of well-grouped commits. Group related files together aggressively.
128
-
129
- Please respond in JSON format.`;
130
- }
131
- /**
132
- * Get system prompt for single commit message generation
133
- */
134
- function getSingleCommitSystemPrompt() {
135
- return `You are a git commit expert. You analyze git diffs and create Conventional Commits standard commit messages.
51
+ CHANGES:
52
+ ${formattedDiff}
136
53
 
137
- Conventional Commits format:
138
- <type>(<scope>): <subject>
139
-
140
- <body>
141
-
142
- <footer>
143
-
144
- Types:
145
- - feat: New feature
146
- - fix: Bug fix
147
- - refactor: Code refactoring
148
- - style: Formatting, styling changes
149
- - docs: Documentation
150
- - test: Tests
151
- - chore: Maintenance tasks
152
-
153
- Commit message should be short and descriptive. Body should contain details of the changes.`;
154
- }
155
- /**
156
- * Get user prompt for single commit message
157
- */
158
- function getSingleCommitUserPrompt(diff) {
159
- return `Analyze the following git diff and create a commit message in Conventional Commits format.
160
-
161
- \`\`\`
162
- ${diff}
163
- \`\`\`
164
-
165
- Respond in JSON format:
166
- {
167
- "commitMessage": "feat(auth): add OAuth2 authentication support",
168
- "commitBody": "Detailed description here..."
169
- }`;
54
+ Group related hunks together. If a file has multiple unrelated changes, put them in separate commits.
55
+ Each hunk must be in exactly one group. Respond in JSON format.`;
170
56
  }
171
57
  //# sourceMappingURL=prompts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":";;AAGA,kEA6FC;AAKD,8DAuBC;AAKD,kEAoBC;AAKD,8DAYC;AAtKD;;GAEG;AACH,SAAgB,2BAA2B;IACzC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2FP,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAgB,yBAAyB,CAAC,IAAY;IACpD,OAAO;;;;;;;;;;;;;;;;EAgBP,IAAI;;;;;+BAKyB,CAAC;AAChC,CAAC;AAED;;GAEG;AACH,SAAgB,2BAA2B;IACzC,OAAO;;;;;;;;;;;;;;;;;;4FAkBmF,CAAC;AAC7F,CAAC;AAED;;GAEG;AACH,SAAgB,yBAAyB,CAAC,IAAY;IACpD,OAAO;;;EAGP,IAAI;;;;;;;EAOJ,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":";;AAAA,0CAwCC;AAED,sCAUC;AApDD,SAAgB,eAAe;IAC7B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsCP,CAAC;AACH,CAAC;AAED,SAAgB,aAAa,CAAC,aAAqB,EAAE,KAAa;IAChE,OAAO;;EAEP,KAAK;;;EAGL,aAAa;;;gEAGiD,CAAC;AACjE,CAAC"}
package/dist/reset.d.ts CHANGED
@@ -1,5 +1,2 @@
1
- /**
2
- * Reset configuration
3
- */
4
1
  export declare function resetConfig(): Promise<void>;
5
2
  //# sourceMappingURL=reset.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reset.d.ts","sourceRoot":"","sources":["../src/reset.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAiCjD"}
1
+ {"version":3,"file":"reset.d.ts","sourceRoot":"","sources":["../src/reset.ts"],"names":[],"mappings":"AAIA,wBAAsB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAyBjD"}
package/dist/reset.js CHANGED
@@ -40,38 +40,28 @@ exports.resetConfig = resetConfig;
40
40
  const chalk_1 = __importDefault(require("chalk"));
41
41
  const inquirer_1 = __importDefault(require("inquirer"));
42
42
  const config = __importStar(require("./config"));
43
- /**
44
- * Reset configuration
45
- */
46
43
  async function resetConfig() {
47
44
  if (!config.configExists()) {
48
- console.log(chalk_1.default.yellow('⚠ No configuration found.\n'));
45
+ console.log(chalk_1.default.yellow("⚠ No configuration found.\n"));
49
46
  return;
50
47
  }
51
- console.log(chalk_1.default.red.bold('\n⚠️ Reset Configuration\n'));
52
- console.log(chalk_1.default.yellow('This will delete all configuration including:'));
53
- console.log(chalk_1.default.yellow(' - OpenAI API key'));
54
- console.log(chalk_1.default.yellow(' - All git user profiles'));
55
- console.log(chalk_1.default.yellow(' - Default user settings\n'));
56
48
  const { confirm } = await inquirer_1.default.prompt([
57
49
  {
58
- type: 'confirm',
59
- name: 'confirm',
60
- message: 'Are you sure you want to reset all configuration?',
61
- default: false
62
- }
50
+ type: "confirm",
51
+ name: "confirm",
52
+ message: "Delete all configuration (API key)?",
53
+ default: false,
54
+ },
63
55
  ]);
64
56
  if (!confirm) {
65
- console.log(chalk_1.default.yellow('⚠ Reset cancelled.\n'));
57
+ console.log(chalk_1.default.yellow("Cancelled.\n"));
66
58
  return;
67
59
  }
68
- const success = config.resetConfig();
69
- if (success) {
70
- console.log(chalk_1.default.green('✓ Configuration reset successfully.\n'));
71
- console.log(chalk_1.default.blue('Run "git-ai setup" to configure again.\n'));
60
+ if (config.resetConfig()) {
61
+ console.log(chalk_1.default.green("✓ Configuration reset.\n"));
72
62
  }
73
63
  else {
74
- console.log(chalk_1.default.red('❌ Failed to reset configuration.\n'));
64
+ console.log(chalk_1.default.red("❌ Failed to reset.\n"));
75
65
  }
76
66
  }
77
67
  //# sourceMappingURL=reset.js.map