git-it-done 1.0.1 → 1.0.3
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/dist/index.d.ts +1 -1
- package/dist/index.js +24 -29
- package/dist/index.js.map +1 -1
- package/dist/utils/checkGitStatus.d.ts +1 -1
- package/dist/utils/checkGitStatus.js +7 -10
- package/dist/utils/checkGitStatus.js.map +1 -1
- package/dist/utils/commitMessage.d.ts +1 -1
- package/dist/utils/commitMessage.js +17 -23
- package/dist/utils/commitMessage.js.map +1 -1
- package/dist/utils/displayStatus.d.ts +1 -1
- package/dist/utils/displayStatus.js +10 -16
- package/dist/utils/displayStatus.js.map +1 -1
- package/dist/utils/fileStaging.d.ts +1 -1
- package/dist/utils/fileStaging.js +21 -27
- package/dist/utils/fileStaging.js.map +1 -1
- package/dist/utils/formatFileStatus.js +8 -14
- package/dist/utils/formatFileStatus.js.map +1 -1
- package/dist/utils/generateCommitMessage.d.ts +1 -1
- package/dist/utils/generateCommitMessage.js +8 -14
- package/dist/utils/generateCommitMessage.js.map +1 -1
- package/dist/utils/getFileChanges.d.ts +1 -1
- package/dist/utils/getFileChanges.js +5 -8
- package/dist/utils/getFileChanges.js.map +1 -1
- package/dist/utils/gitCommand.js +3 -6
- package/dist/utils/gitCommand.js.map +1 -1
- package/dist/utils/isGitrepo.js +3 -6
- package/dist/utils/isGitrepo.js.map +1 -1
- package/dist/utils/performCommit.js +17 -23
- package/dist/utils/performCommit.js.map +1 -1
- package/dist/utils/process_interruption.js +5 -8
- package/dist/utils/process_interruption.js.map +1 -1
- package/dist/utils/push_to_remote.js +16 -22
- package/dist/utils/push_to_remote.js.map +1 -1
- package/dist/utils/types/types.js +1 -2
- package/package.json +38 -8
- package/readme.md +298 -9
package/dist/utils/gitCommand.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.gitCommand = gitCommand;
|
|
4
|
-
const child_process_1 = require("child_process");
|
|
1
|
+
import { execSync } from 'child_process';
|
|
5
2
|
// Utility function to execute git commands with better error handling
|
|
6
|
-
function gitCommand(command) {
|
|
3
|
+
export function gitCommand(command) {
|
|
7
4
|
try {
|
|
8
|
-
return
|
|
5
|
+
return execSync(`git ${command}`, {
|
|
9
6
|
encoding: 'utf-8',
|
|
10
7
|
stdio: 'pipe'
|
|
11
8
|
}).trim();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitCommand.js","sourceRoot":"","sources":["../../src/utils/gitCommand.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gitCommand.js","sourceRoot":"","sources":["../../src/utils/gitCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,sEAAsE;AACtE,MAAM,UAAU,UAAU,CAAC,OAAe;IACxC,IAAI,CAAC;QACH,OAAO,QAAQ,CAAC,OAAO,OAAO,EAAE,EAAE;YAChC,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,MAAM;SACd,CAAC,CAAC,IAAI,EAAE,CAAC;IACZ,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
package/dist/utils/isGitrepo.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isGitRepo = isGitRepo;
|
|
4
|
-
const gitCommand_1 = require("./gitCommand");
|
|
1
|
+
import { gitCommand } from "./gitCommand.js";
|
|
5
2
|
// Check if we're in a git repository
|
|
6
|
-
function isGitRepo() {
|
|
7
|
-
return !!
|
|
3
|
+
export function isGitRepo() {
|
|
4
|
+
return !!gitCommand('rev-parse --git-dir');
|
|
8
5
|
}
|
|
9
6
|
//# sourceMappingURL=isGitrepo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isGitrepo.js","sourceRoot":"","sources":["../../src/utils/isGitrepo.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"isGitrepo.js","sourceRoot":"","sources":["../../src/utils/isGitrepo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,qCAAqC;AACrC,MAAM,UAAU,SAAS;IACvB,OAAO,CAAC,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,44 +7,39 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
exports.performCommit = performCommit;
|
|
16
|
-
const prompts_1 = require("@clack/prompts");
|
|
17
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
18
|
-
const gitCommand_1 = require("./gitCommand");
|
|
19
|
-
function performCommit(commitMessage) {
|
|
10
|
+
import { confirm, spinner, cancel, isCancel } from '@clack/prompts';
|
|
11
|
+
import chalk from 'chalk';
|
|
12
|
+
import { gitCommand } from './gitCommand.js';
|
|
13
|
+
export function performCommit(commitMessage) {
|
|
20
14
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21
15
|
// Confirm commit
|
|
22
|
-
const shouldCommit = yield
|
|
16
|
+
const shouldCommit = yield confirm({
|
|
23
17
|
message: `Commit with message: "${commitMessage}"?`
|
|
24
18
|
});
|
|
25
|
-
if (
|
|
26
|
-
|
|
19
|
+
if (isCancel(shouldCommit) || !shouldCommit) {
|
|
20
|
+
cancel('Commit cancelled');
|
|
27
21
|
return false;
|
|
28
22
|
}
|
|
29
23
|
// Execute commit
|
|
30
|
-
const s =
|
|
24
|
+
const s = spinner();
|
|
31
25
|
s.start('Committing changes...');
|
|
32
26
|
try {
|
|
33
27
|
const success = executeCommit(commitMessage);
|
|
34
28
|
if (!success) {
|
|
35
29
|
s.stop('❌ Commit failed');
|
|
36
|
-
|
|
30
|
+
cancel('Failed to commit changes. Please check your git status.');
|
|
37
31
|
return false;
|
|
38
32
|
}
|
|
39
33
|
// Verify commit was created
|
|
40
|
-
const lastCommit =
|
|
34
|
+
const lastCommit = gitCommand('log -1 --oneline');
|
|
41
35
|
if (!lastCommit) {
|
|
42
36
|
s.stop('⚠️ Commit status unclear');
|
|
43
|
-
console.log(
|
|
37
|
+
console.log(chalk.yellow('Commit may not have been created. Please check git status manually.'));
|
|
44
38
|
return false;
|
|
45
39
|
}
|
|
46
40
|
else {
|
|
47
41
|
s.stop('✅ Changes committed successfully!');
|
|
48
|
-
console.log(
|
|
42
|
+
console.log(chalk.dim(`Last commit: ${lastCommit}`));
|
|
49
43
|
return true;
|
|
50
44
|
}
|
|
51
45
|
}
|
|
@@ -58,22 +52,22 @@ function performCommit(commitMessage) {
|
|
|
58
52
|
}
|
|
59
53
|
function executeCommit(commitMessage) {
|
|
60
54
|
const escapedMessage = JSON.stringify(commitMessage);
|
|
61
|
-
const result =
|
|
55
|
+
const result = gitCommand(`commit -m ${escapedMessage}`);
|
|
62
56
|
return result !== null;
|
|
63
57
|
}
|
|
64
58
|
function handleCommitError(error) {
|
|
65
59
|
const msg = error.message || '';
|
|
66
60
|
if (msg.includes('nothing to commit')) {
|
|
67
|
-
|
|
61
|
+
cancel('Nothing to commit - working tree clean');
|
|
68
62
|
}
|
|
69
63
|
else if (msg.includes('Please tell me who you are')) {
|
|
70
|
-
|
|
64
|
+
cancel('Git user not configured. Run: git config --global user.email "you@example.com"');
|
|
71
65
|
}
|
|
72
66
|
else if (msg.includes('not a git repository')) {
|
|
73
|
-
|
|
67
|
+
cancel('Not in a git repository');
|
|
74
68
|
}
|
|
75
69
|
else {
|
|
76
|
-
|
|
70
|
+
cancel(`Failed to commit: ${msg}`);
|
|
77
71
|
}
|
|
78
72
|
}
|
|
79
73
|
//# sourceMappingURL=performCommit.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"performCommit.js","sourceRoot":"","sources":["../../src/utils/performCommit.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"performCommit.js","sourceRoot":"","sources":["../../src/utils/performCommit.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,UAAgB,aAAa,CAAC,aAAqB;;QACvD,iBAAiB;QACjB,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC;YACjC,OAAO,EAAE,yBAAyB,aAAa,IAAI;SACpD,CAAC,CAAC;QAEH,IAAI,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YAC5C,MAAM,CAAC,kBAAkB,CAAC,CAAC;YAC3B,OAAO,KAAK,CAAC;QACf,CAAC;QAED,iBAAiB;QACjB,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;QACpB,CAAC,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAEjC,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,aAAa,CAAC,aAAa,CAAC,CAAC;YAE7C,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;gBAC1B,MAAM,CAAC,yDAAyD,CAAC,CAAC;gBAClE,OAAO,KAAK,CAAC;YACf,CAAC;YAED,4BAA4B;YAC5B,MAAM,UAAU,GAAG,UAAU,CAAC,kBAAkB,CAAC,CAAC;YAClD,IAAI,CAAC,UAAU,EAAE,CAAC;gBAChB,CAAC,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;gBACpC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,qEAAqE,CAAC,CAAC,CAAC;gBACjG,OAAO,KAAK,CAAC;YACf,CAAC;iBAAM,CAAC;gBACN,CAAC,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC;gBAC5C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,gBAAgB,UAAU,EAAE,CAAC,CAAC,CAAC;gBACrD,OAAO,IAAI,CAAC;YACd,CAAC;QAEH,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;YAC1B,iBAAiB,CAAC,KAAK,CAAC,CAAC;YACzB,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CAAA;AAED,SAAS,aAAa,CAAC,aAAqB;IAC1C,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;IACrD,MAAM,MAAM,GAAG,UAAU,CAAC,aAAa,cAAc,EAAE,CAAC,CAAC;IACzD,OAAO,MAAM,KAAK,IAAI,CAAC;AACzB,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAU;IACnC,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,IAAI,EAAE,CAAC;IAEhC,IAAI,GAAG,CAAC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,CAAC;QACtC,MAAM,CAAC,wCAAwC,CAAC,CAAC;IACnD,CAAC;SAAM,IAAI,GAAG,CAAC,QAAQ,CAAC,4BAA4B,CAAC,EAAE,CAAC;QACtD,MAAM,CAAC,gFAAgF,CAAC,CAAC;IAC3F,CAAC;SAAM,IAAI,GAAG,CAAC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,CAAC;QAChD,MAAM,CAAC,yBAAyB,CAAC,CAAC;IACpC,CAAC;SAAM,CAAC;QACN,MAAM,CAAC,qBAAqB,GAAG,EAAE,CAAC,CAAC;IACrC,CAAC;AACH,CAAC"}
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.default = start;
|
|
4
|
-
const prompts_1 = require("@clack/prompts");
|
|
5
|
-
function start(main) {
|
|
1
|
+
import { cancel } from '@clack/prompts';
|
|
2
|
+
export default function start(main) {
|
|
6
3
|
process.on('SIGINT', () => {
|
|
7
|
-
|
|
4
|
+
cancel('Operation cancelled by user');
|
|
8
5
|
process.exit(0);
|
|
9
6
|
});
|
|
10
7
|
process.on('SIGTERM', () => {
|
|
11
|
-
|
|
8
|
+
cancel('Operation terminated');
|
|
12
9
|
process.exit(0);
|
|
13
10
|
});
|
|
14
11
|
main().catch((error) => {
|
|
15
|
-
|
|
12
|
+
cancel('An unexpected error occurred');
|
|
16
13
|
console.error(error instanceof Error ? error.stack || error.message : error);
|
|
17
14
|
process.exit(1);
|
|
18
15
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process_interruption.js","sourceRoot":"","sources":["../../src/utils/process_interruption.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"process_interruption.js","sourceRoot":"","sources":["../../src/utils/process_interruption.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,IAAyB;IACrD,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;QACxB,MAAM,CAAC,6BAA6B,CAAC,CAAC;QACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE;QACzB,MAAM,CAAC,sBAAsB,CAAC,CAAC;QAC/B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;QAC9B,MAAM,CAAC,8BAA8B,CAAC,CAAC;QACvC,OAAO,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAC7E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,20 +7,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
exports.handlePushToRemote = handlePushToRemote;
|
|
16
|
-
const prompts_1 = require("@clack/prompts");
|
|
17
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
18
|
-
const gitCommand_1 = require("./gitCommand");
|
|
19
|
-
function handlePushToRemote() {
|
|
10
|
+
import { confirm, spinner, isCancel } from '@clack/prompts';
|
|
11
|
+
import chalk from 'chalk';
|
|
12
|
+
import { gitCommand } from './gitCommand.js';
|
|
13
|
+
export function handlePushToRemote() {
|
|
20
14
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
const shouldPush = yield
|
|
15
|
+
const shouldPush = yield confirm({
|
|
22
16
|
message: 'Push to remote repository?'
|
|
23
17
|
});
|
|
24
|
-
if (
|
|
18
|
+
if (isCancel(shouldPush) || !shouldPush) {
|
|
25
19
|
return;
|
|
26
20
|
}
|
|
27
21
|
yield executePush();
|
|
@@ -29,17 +23,17 @@ function handlePushToRemote() {
|
|
|
29
23
|
}
|
|
30
24
|
function executePush() {
|
|
31
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
-
const pushSpinner =
|
|
26
|
+
const pushSpinner = spinner();
|
|
33
27
|
pushSpinner.start('Pushing to remote...');
|
|
34
28
|
// Check if remote exists
|
|
35
|
-
const remotes =
|
|
29
|
+
const remotes = gitCommand('remote');
|
|
36
30
|
if (!remotes) {
|
|
37
31
|
pushSpinner.stop('⚠️ No remote repository configured');
|
|
38
|
-
console.log(
|
|
32
|
+
console.log(chalk.yellow('No remote repository found. Skipping push.'));
|
|
39
33
|
return;
|
|
40
34
|
}
|
|
41
35
|
try {
|
|
42
|
-
const pushResult =
|
|
36
|
+
const pushResult = gitCommand('push');
|
|
43
37
|
if (pushResult !== null) {
|
|
44
38
|
pushSpinner.stop('🚀 Changes pushed successfully!');
|
|
45
39
|
}
|
|
@@ -50,19 +44,19 @@ function executePush() {
|
|
|
50
44
|
}
|
|
51
45
|
catch (error) {
|
|
52
46
|
pushSpinner.stop('❌ Push failed');
|
|
53
|
-
console.log(
|
|
54
|
-
console.log(
|
|
47
|
+
console.log(chalk.red('Failed to push. Error details:'));
|
|
48
|
+
console.log(chalk.dim(error.message));
|
|
55
49
|
}
|
|
56
50
|
});
|
|
57
51
|
}
|
|
58
52
|
function handlePushFailure() {
|
|
59
|
-
console.log(
|
|
60
|
-
const branch =
|
|
53
|
+
console.log(chalk.red('Failed to push. You may need to set upstream branch.'));
|
|
54
|
+
const branch = gitCommand('rev-parse --abbrev-ref HEAD');
|
|
61
55
|
if (branch) {
|
|
62
|
-
console.log(
|
|
56
|
+
console.log(chalk.dim(`Try: git push --set-upstream origin ${branch}`));
|
|
63
57
|
}
|
|
64
58
|
else {
|
|
65
|
-
console.log(
|
|
59
|
+
console.log(chalk.dim('Try: git push --set-upstream origin <branch-name>'));
|
|
66
60
|
}
|
|
67
61
|
}
|
|
68
62
|
//# sourceMappingURL=push_to_remote.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push_to_remote.js","sourceRoot":"","sources":["../../src/utils/push_to_remote.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"push_to_remote.js","sourceRoot":"","sources":["../../src/utils/push_to_remote.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,UAAgB,kBAAkB;;QACtC,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC;YAC/B,OAAO,EAAE,4BAA4B;SACtC,CAAC,CAAC;QAEH,IAAI,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACxC,OAAO;QACT,CAAC;QAED,MAAM,WAAW,EAAE,CAAC;IACtB,CAAC;CAAA;AAED,SAAe,WAAW;;QACxB,MAAM,WAAW,GAAG,OAAO,EAAE,CAAC;QAC9B,WAAW,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAE1C,yBAAyB;QACzB,MAAM,OAAO,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;QACrC,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,WAAW,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;YACxD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,4CAA4C,CAAC,CAAC,CAAC;YACxE,OAAO;QACT,CAAC;QAED,IAAI,CAAC;YACH,MAAM,UAAU,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;YAEtC,IAAI,UAAU,KAAK,IAAI,EAAE,CAAC;gBACxB,WAAW,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;YACtD,CAAC;iBAAM,CAAC;gBACN,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;gBAClC,iBAAiB,EAAE,CAAC;YACtB,CAAC;QACH,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YAClC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC,CAAC;YACzD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;CAAA;AAED,SAAS,iBAAiB;IACxB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,sDAAsD,CAAC,CAAC,CAAC;IAE/E,MAAM,MAAM,GAAG,UAAU,CAAC,6BAA6B,CAAC,CAAC;IACzD,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,uCAAuC,MAAM,EAAE,CAAC,CAAC,CAAC;IAC1E,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,mDAAmD,CAAC,CAAC,CAAC;IAC9E,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,21 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "git-it-done",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
|
+
"description": "Smart auto-commit tool with beautiful CLI interface for streamlined Git workflow",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"type": "module",
|
|
4
7
|
"bin": {
|
|
5
8
|
"git-it-done": "./dist/index.js"
|
|
6
9
|
},
|
|
7
10
|
"scripts": {
|
|
8
|
-
"dev": "ts-node ./src/index.ts",
|
|
11
|
+
"dev": "ts-node --esm ./src/index.ts",
|
|
12
|
+
"build": "tsc",
|
|
9
13
|
"prod": "node ./dist/index.js",
|
|
10
|
-
"
|
|
14
|
+
"prepublishOnly": "npm run build",
|
|
15
|
+
"test": "echo \"No tests specified\" && exit 0",
|
|
16
|
+
"start": "npm run build && npm run prod",
|
|
17
|
+
"install-global": "npm install -g .",
|
|
18
|
+
"uninstall-global": "npm uninstall -g git-it-done"
|
|
11
19
|
},
|
|
12
20
|
"files": [
|
|
13
|
-
"dist/"
|
|
21
|
+
"dist/",
|
|
22
|
+
"README.md",
|
|
23
|
+
"LICENSE"
|
|
14
24
|
],
|
|
15
|
-
"keywords": [
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
25
|
+
"keywords": [
|
|
26
|
+
"git",
|
|
27
|
+
"commit",
|
|
28
|
+
"cli",
|
|
29
|
+
"automation",
|
|
30
|
+
"workflow",
|
|
31
|
+
"typescript",
|
|
32
|
+
"interactive",
|
|
33
|
+
"conventional-commits"
|
|
34
|
+
],
|
|
35
|
+
"author": "Your Name <your.email@example.com>",
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "https://github.com/sidhxntt/AutoCommitter.git"
|
|
40
|
+
},
|
|
41
|
+
"bugs": {
|
|
42
|
+
"url": "https://github.com/sidhxntt/AutoCommitter/issues"
|
|
43
|
+
},
|
|
44
|
+
"homepage": "https://github.com/sidhxntt/AutoCommitter#readme",
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=16.0.0"
|
|
47
|
+
},
|
|
48
|
+
"preferGlobal": true,
|
|
19
49
|
"dependencies": {
|
|
20
50
|
"@clack/prompts": "^0.10.1",
|
|
21
51
|
"chalk": "^5.4.1"
|
package/readme.md
CHANGED
|
@@ -1,14 +1,303 @@
|
|
|
1
|
-
|
|
1
|
+
# 🚀 Git-it-done
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A smart, interactive CLI tool that automatically generates meaningful commit messages and streamlines your Git workflow. Built with TypeScript and Clack.js for a beautiful command-line experience.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## ✨ Features
|
|
6
|
+
|
|
7
|
+
- 🧠 **Smart Commit Message Generation** - Analyzes your changes to create conventional commit messages
|
|
8
|
+
- 🎨 **Beautiful Interactive CLI** - Modern prompts with colors, spinners, and emojis
|
|
9
|
+
- 🔍 **File Selection** - Choose which files to stage and commit
|
|
10
|
+
- ✏️ **Flexible Messaging** - Use generated, custom, or edited commit messages
|
|
11
|
+
- 🚀 **Auto-Push** - Optionally push changes to remote repository
|
|
12
|
+
- 🛡️ **Comprehensive Error Handling** - Handles edge cases gracefully
|
|
13
|
+
- 📊 **Visual Status Display** - Color-coded file changes and status
|
|
14
|
+
|
|
15
|
+
## 🎯 Use Cases
|
|
16
|
+
|
|
17
|
+
**Perfect for:**
|
|
18
|
+
- ✅ Ongoing projects with existing Git repositories
|
|
19
|
+
- ✅ Quick commits with meaningful messages
|
|
20
|
+
- ✅ Streamlined development workflow
|
|
21
|
+
- ✅ Teams following conventional commit standards
|
|
22
|
+
|
|
23
|
+
**Not intended for:**
|
|
24
|
+
- ❌ Setting up new repositories (follow GitHub's setup instructions)
|
|
25
|
+
- ❌ Complex Git operations (pull, rebase, revert, merge conflicts)
|
|
26
|
+
- ❌ Repository initialization or first commits
|
|
27
|
+
|
|
28
|
+
## 📋 Prerequisites
|
|
29
|
+
|
|
30
|
+
- **Node.js** >= 16.0.0
|
|
31
|
+
- **Git** installed and configured
|
|
32
|
+
- **Existing Git repository** with proper setup
|
|
33
|
+
|
|
34
|
+
### Git Configuration Required
|
|
35
|
+
|
|
36
|
+
Ensure your Git user is configured:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
git config --global user.name "Your Name"
|
|
40
|
+
git config --global user.email "your.email@example.com"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## 🛠️ Installation
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
|
|
48
|
+
npm install -g git-it-done
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## 🚦 Quick Start
|
|
55
|
+
|
|
56
|
+
1. **Navigate to your project directory** (must be a Git repository):
|
|
57
|
+
```bash
|
|
58
|
+
cd your-project
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
2. **Run the auto-committer**:
|
|
62
|
+
```bash
|
|
63
|
+
auto-commit
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
3. **Follow the interactive prompts**:
|
|
67
|
+
- View repository status
|
|
68
|
+
- Choose files to stage (if needed)
|
|
69
|
+
- Select commit message option
|
|
70
|
+
- Confirm and commit
|
|
71
|
+
- Optionally push to remote
|
|
72
|
+
|
|
73
|
+
## 🎮 Usage Examples
|
|
74
|
+
|
|
75
|
+
### Basic Workflow
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
$ auto-commit
|
|
79
|
+
|
|
80
|
+
┌ Auto Commit Tool
|
|
81
|
+
│
|
|
82
|
+
◇ 📁 Repository Status:
|
|
83
|
+
│
|
|
84
|
+
│ Unstaged files:
|
|
85
|
+
│ ~ modified src/auth.ts
|
|
86
|
+
│ + added tests/auth.test.ts
|
|
87
|
+
│
|
|
88
|
+
◇ No files are staged. What would you like to do?
|
|
89
|
+
│ ● Stage all changes
|
|
90
|
+
│ ○ Select files to stage
|
|
91
|
+
│ ○ Cancel
|
|
92
|
+
│
|
|
93
|
+
◇ How would you like to create the commit message?
|
|
94
|
+
│ ● Use generated: "feat(src): add authentication functionality"
|
|
95
|
+
│ ○ Write custom message
|
|
96
|
+
│ ○ Edit generated message
|
|
97
|
+
│
|
|
98
|
+
◇ Commit with message: "feat(src): add authentication functionality"?
|
|
99
|
+
│ Yes
|
|
100
|
+
│
|
|
101
|
+
◆ ✅ Changes committed successfully!
|
|
102
|
+
│ Last commit: abc1234 feat(src): add authentication functionality
|
|
103
|
+
│
|
|
104
|
+
◇ Push to remote repository?
|
|
105
|
+
│ Yes
|
|
106
|
+
│
|
|
107
|
+
◆ 🚀 Changes pushed successfully!
|
|
108
|
+
│
|
|
109
|
+
└ 🎉 All done!
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Generated Commit Message Examples
|
|
113
|
+
|
|
114
|
+
The tool analyzes your changes and generates conventional commit messages:
|
|
115
|
+
|
|
116
|
+
- `feat(auth): add user authentication system`
|
|
117
|
+
- `fix(api): resolve validation errors`
|
|
118
|
+
- `docs: update API documentation`
|
|
119
|
+
- `style(ui): improve button styling`
|
|
120
|
+
- `test(auth): add authentication tests`
|
|
121
|
+
- `deps: update dependencies`
|
|
122
|
+
- `config: update build configuration`
|
|
123
|
+
|
|
124
|
+
## 🏗️ Project Structure
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
auto-committer/
|
|
128
|
+
├── index.ts # Main entry point
|
|
129
|
+
├── package.json # Dependencies and scripts
|
|
130
|
+
├── utils/
|
|
131
|
+
│ ├── checkGitStatus.ts # Git validation
|
|
132
|
+
│ ├── displayStatus.ts # Repository status display
|
|
133
|
+
│ ├── fileStaging.ts # File staging logic
|
|
134
|
+
│ ├── commitMessage.ts # Commit message handling
|
|
135
|
+
│ ├── performCommit.ts # Commit execution
|
|
136
|
+
│ ├── pushToRemote.ts # Push to remote logic
|
|
137
|
+
│ ├── gitCommand.ts # Git command utilities
|
|
138
|
+
│ ├── getFileChanges.ts # File change detection
|
|
139
|
+
│ ├── generateCommitMessage.ts # Smart message generation
|
|
140
|
+
│ ├── formatFileStatus.ts # File status formatting
|
|
141
|
+
│ ├── process_interruption.ts # Process handling
|
|
142
|
+
│ └── types/
|
|
143
|
+
│ └── types.ts # TypeScript definitions
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## 🔧 Configuration
|
|
147
|
+
|
|
148
|
+
The tool works out of the box but respects your Git configuration:
|
|
149
|
+
|
|
150
|
+
- **Git user settings** - Uses your configured name and email
|
|
151
|
+
- **Remote repositories** - Detects and uses existing remotes
|
|
152
|
+
- **Branch settings** - Works with your current branch
|
|
153
|
+
|
|
154
|
+
## 🎨 Commit Message Generation
|
|
155
|
+
|
|
156
|
+
The smart commit message generator analyzes:
|
|
157
|
+
|
|
158
|
+
### File Types
|
|
159
|
+
- `.js`, `.ts` → JavaScript/TypeScript changes
|
|
160
|
+
- `.css`, `.scss` → Styling changes
|
|
161
|
+
- `.md` → Documentation changes
|
|
162
|
+
- `.json`, `.yaml` → Configuration changes
|
|
163
|
+
- `test/`, `spec/` → Test changes
|
|
164
|
+
|
|
165
|
+
### Change Patterns
|
|
166
|
+
- **New files** → `feat:` (feature)
|
|
167
|
+
- **Modified files** → `fix:` or `feat:` based on content
|
|
168
|
+
- **Deleted files** → `remove:`
|
|
169
|
+
- **Test files** → `test:`
|
|
170
|
+
- **Documentation** → `docs:`
|
|
171
|
+
- **Dependencies** → `deps:`
|
|
172
|
+
|
|
173
|
+
### Content Analysis
|
|
174
|
+
- Function/class additions → `feat:`
|
|
175
|
+
- Bug fixes → `fix:`
|
|
176
|
+
- Refactoring → `refactor:`
|
|
177
|
+
- Style changes → `style:`
|
|
178
|
+
|
|
179
|
+
## 🚨 Error Handling
|
|
180
|
+
|
|
181
|
+
The tool handles common scenarios gracefully:
|
|
182
|
+
|
|
183
|
+
### Repository Issues
|
|
184
|
+
- **Not in Git repo** → Clear error message
|
|
185
|
+
- **Git not installed** → Installation guidance
|
|
186
|
+
- **User not configured** → Configuration commands
|
|
187
|
+
|
|
188
|
+
### File Issues
|
|
189
|
+
- **No changes** → Friendly "nothing to commit" message
|
|
190
|
+
- **Staging failures** → Retry suggestions
|
|
191
|
+
- **Empty commits** → Prevention and guidance
|
|
192
|
+
|
|
193
|
+
### Remote Issues
|
|
194
|
+
- **No remote configured** → Skip push with notification
|
|
195
|
+
- **Push failures** → Helpful error messages and suggestions
|
|
196
|
+
- **Network issues** → Clear error reporting
|
|
197
|
+
|
|
198
|
+
## 🛡️ Limitations
|
|
199
|
+
|
|
200
|
+
This tool is designed for **ongoing projects** and has intentional limitations:
|
|
201
|
+
|
|
202
|
+
### What it DOES NOT handle:
|
|
203
|
+
- ❌ **Repository initialization** - Use `git init` and follow GitHub's setup guide
|
|
204
|
+
- ❌ **First commits** - Use standard Git commands for initial setup
|
|
205
|
+
- ❌ **Pulling changes** - Use `git pull` manually
|
|
206
|
+
- ❌ **Rebasing** - Use `git rebase` for complex history management
|
|
207
|
+
- ❌ **Reverting commits** - Use `git revert` for undoing changes
|
|
208
|
+
- ❌ **Merge conflicts** - Resolve manually with Git tools
|
|
209
|
+
- ❌ **Branch management** - Use Git commands for branch operations
|
|
210
|
+
|
|
211
|
+
### What it DOES handle:
|
|
212
|
+
- ✅ **Smart commit message generation**
|
|
213
|
+
- ✅ **File staging and selection**
|
|
214
|
+
- ✅ **Commit execution**
|
|
215
|
+
- ✅ **Push to existing remotes**
|
|
216
|
+
- ✅ **Error prevention and guidance**
|
|
217
|
+
|
|
218
|
+
## 🤝 Contributing
|
|
219
|
+
|
|
220
|
+
We welcome contributions! Please follow these steps:
|
|
221
|
+
|
|
222
|
+
1. Fork the repository
|
|
223
|
+
2. Create a feature branch: `git checkout -b feature/amazing-feature`
|
|
224
|
+
3. Make your changes
|
|
225
|
+
4. Test thoroughly
|
|
226
|
+
5. Commit with conventional messages: `feat: add amazing feature`
|
|
227
|
+
6. Push to your branch: `git push origin feature/amazing-feature`
|
|
228
|
+
7. Open a Pull Request
|
|
229
|
+
|
|
230
|
+
### Development Setup
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
# Clone your fork
|
|
234
|
+
git clone <your-fork-url>
|
|
235
|
+
cd auto-committer
|
|
236
|
+
|
|
237
|
+
# Install dependencies
|
|
238
|
+
npm install
|
|
239
|
+
|
|
240
|
+
# Run in development mode
|
|
241
|
+
npm run dev
|
|
242
|
+
|
|
243
|
+
# Build for production
|
|
244
|
+
npm run build
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## 📊 Dependencies
|
|
248
|
+
|
|
249
|
+
- **[@clack/prompts](https://github.com/natemoo-re/clack)** - Beautiful CLI prompts
|
|
250
|
+
- **[chalk](https://github.com/chalk/chalk)** - Terminal colors and styling
|
|
251
|
+
- **TypeScript** - Type safety and modern JavaScript features
|
|
252
|
+
|
|
253
|
+
## 📝 License
|
|
254
|
+
|
|
255
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
256
|
+
|
|
257
|
+
## 🆘 Troubleshooting
|
|
258
|
+
|
|
259
|
+
### Common Issues
|
|
260
|
+
|
|
261
|
+
**"Not in a git repository"**
|
|
262
|
+
```bash
|
|
263
|
+
# Make sure you're in a Git repository
|
|
264
|
+
git status
|
|
265
|
+
# If not initialized, use:
|
|
6
266
|
git init
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
git
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
**"Git user not configured"**
|
|
270
|
+
```bash
|
|
271
|
+
git config --global user.name "Your Name"
|
|
272
|
+
git config --global user.email "your.email@example.com"
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
**"No remote repository configured"**
|
|
276
|
+
```bash
|
|
277
|
+
# Add a remote repository
|
|
278
|
+
git remote add origin <repository-url>
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
**"Failed to push"**
|
|
282
|
+
```bash
|
|
283
|
+
# Set upstream branch
|
|
284
|
+
git push --set-upstream origin main
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### Getting Help
|
|
288
|
+
|
|
289
|
+
1. Check this README for common solutions
|
|
290
|
+
2. Ensure your Git repository is properly set up
|
|
291
|
+
3. Verify you have the required Node.js version
|
|
292
|
+
4. Check that Git is installed and in your PATH
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
## 🙏 Acknowledgments
|
|
296
|
+
|
|
297
|
+
- [Clack.js](https://github.com/natemoo-re/clack) for the beautiful CLI interface
|
|
298
|
+
- [Conventional Commits](https://www.conventionalcommits.org/) for the commit message standard
|
|
299
|
+
- The open-source community for inspiration and tools
|
|
12
300
|
|
|
301
|
+
---
|
|
13
302
|
|
|
14
|
-
|
|
303
|
+
**Made with ❤️ for developers who love clean commit histories**
|