git-it-done 1.0.3 → 1.1.0
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/LICENSE +21 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/checkGitStatus.js +39 -22
- package/dist/utils/checkGitStatus.js.map +1 -1
- package/dist/utils/diffSignals.d.ts +22 -0
- package/dist/utils/diffSignals.js +75 -0
- package/dist/utils/diffSignals.js.map +1 -0
- package/dist/utils/fileStaging.js +68 -22
- package/dist/utils/fileStaging.js.map +1 -1
- package/dist/utils/formatFileStatus.js +6 -0
- package/dist/utils/formatFileStatus.js.map +1 -1
- package/dist/utils/generateCommitMessage.d.ts +12 -0
- package/dist/utils/generateCommitMessage.js +178 -83
- package/dist/utils/generateCommitMessage.js.map +1 -1
- package/dist/utils/getFileChanges.d.ts +15 -1
- package/dist/utils/getFileChanges.js +59 -18
- package/dist/utils/getFileChanges.js.map +1 -1
- package/dist/utils/gitCommand.d.ts +27 -1
- package/dist/utils/gitCommand.js +53 -10
- package/dist/utils/gitCommand.js.map +1 -1
- package/dist/utils/performCommit.js +29 -34
- package/dist/utils/performCommit.js.map +1 -1
- package/dist/utils/process_interruption.js +22 -13
- package/dist/utils/process_interruption.js.map +1 -1
- package/dist/utils/push_to_remote.js +52 -36
- package/dist/utils/push_to_remote.js.map +1 -1
- package/dist/utils/repoRoot.d.ts +6 -0
- package/dist/utils/repoRoot.js +10 -0
- package/dist/utils/repoRoot.js.map +1 -0
- package/dist/utils/types/types.d.ts +11 -1
- package/package.json +8 -7
- package/readme.md +5 -5
- package/dist/utils/isGitrepo.d.ts +0 -1
- package/dist/utils/isGitrepo.js +0 -6
- package/dist/utils/isGitrepo.js.map +0 -1
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { confirm, spinner, cancel, isCancel } from '@clack/prompts';
|
|
11
11
|
import chalk from 'chalk';
|
|
12
|
-
import { gitCommand } from './gitCommand.js';
|
|
12
|
+
import { gitCommand, gitErrorText, gitOutput } from './gitCommand.js';
|
|
13
13
|
export function performCommit(commitMessage) {
|
|
14
14
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15
15
|
// Confirm commit
|
|
@@ -23,51 +23,46 @@ export function performCommit(commitMessage) {
|
|
|
23
23
|
// Execute commit
|
|
24
24
|
const s = spinner();
|
|
25
25
|
s.start('Committing changes...');
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
cancel('Failed to commit changes. Please check your git status.');
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
// Verify commit was created
|
|
34
|
-
const lastCommit = gitCommand('log -1 --oneline');
|
|
35
|
-
if (!lastCommit) {
|
|
36
|
-
s.stop('⚠️ Commit status unclear');
|
|
37
|
-
console.log(chalk.yellow('Commit may not have been created. Please check git status manually.'));
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
s.stop('✅ Changes committed successfully!');
|
|
42
|
-
console.log(chalk.dim(`Last commit: ${lastCommit}`));
|
|
43
|
-
return true;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
catch (error) {
|
|
26
|
+
// The message is passed as a single argv entry — no shell, so `$(id)`,
|
|
27
|
+
// backticks and `!` reach git verbatim.
|
|
28
|
+
const result = gitCommand(['commit', '-m', commitMessage]);
|
|
29
|
+
if (!result.ok) {
|
|
47
30
|
s.stop('❌ Commit failed');
|
|
48
|
-
handleCommitError(
|
|
31
|
+
handleCommitError(result);
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
// Verify commit was created
|
|
35
|
+
const lastCommit = gitOutput(['log', '-1', '--oneline']);
|
|
36
|
+
if (!lastCommit) {
|
|
37
|
+
s.stop('⚠️ Commit status unclear');
|
|
38
|
+
console.log(chalk.yellow('Commit may not have been created. Please check git status manually.'));
|
|
49
39
|
return false;
|
|
50
40
|
}
|
|
41
|
+
s.stop('✅ Changes committed successfully!');
|
|
42
|
+
console.log(chalk.dim(`Last commit: ${lastCommit}`));
|
|
43
|
+
return true;
|
|
51
44
|
});
|
|
52
45
|
}
|
|
53
|
-
function
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
if (msg.includes('nothing to commit')) {
|
|
46
|
+
function handleCommitError(result) {
|
|
47
|
+
const details = gitErrorText(result);
|
|
48
|
+
// Always surface git's own output — pre-commit hook rejections and commitlint
|
|
49
|
+
// failures only ever explain themselves there.
|
|
50
|
+
console.log(chalk.red('\nGit reported:'));
|
|
51
|
+
console.log(chalk.dim(details));
|
|
52
|
+
if (/nothing to commit|no changes added to commit/i.test(details)) {
|
|
61
53
|
cancel('Nothing to commit - working tree clean');
|
|
62
54
|
}
|
|
63
|
-
else if (
|
|
55
|
+
else if (/Please tell me who you are/i.test(details)) {
|
|
64
56
|
cancel('Git user not configured. Run: git config --global user.email "you@example.com"');
|
|
65
57
|
}
|
|
66
|
-
else if (
|
|
58
|
+
else if (/not a git repository/i.test(details)) {
|
|
67
59
|
cancel('Not in a git repository');
|
|
68
60
|
}
|
|
61
|
+
else if (result.status === 1 && /hook|husky|commitlint/i.test(details)) {
|
|
62
|
+
cancel('A git hook rejected the commit (see output above)');
|
|
63
|
+
}
|
|
69
64
|
else {
|
|
70
|
-
cancel(
|
|
65
|
+
cancel('Failed to commit changes (see output above)');
|
|
71
66
|
}
|
|
72
67
|
}
|
|
73
68
|
//# sourceMappingURL=performCommit.js.map
|
|
@@ -1 +1 @@
|
|
|
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,C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-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
const SHOW_CURSOR = '\u001B[?25h';
|
|
3
|
+
/** clack hides the cursor while a prompt/spinner is active; bring it back. */
|
|
4
|
+
function restoreCursor() {
|
|
5
|
+
if (process.stdout.isTTY) {
|
|
6
|
+
process.stdout.write(SHOW_CURSOR);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
function exitWith(code, message, error) {
|
|
10
|
+
restoreCursor();
|
|
11
|
+
cancel(message);
|
|
12
|
+
if (error !== undefined) {
|
|
13
13
|
console.error(error instanceof Error ? error.stack || error.message : error);
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
}
|
|
15
|
+
process.exit(code);
|
|
16
|
+
}
|
|
17
|
+
export default function start(main) {
|
|
18
|
+
// 128 + signal number, so CI wrappers do not read Ctrl+C as success.
|
|
19
|
+
process.on('SIGINT', () => exitWith(130, 'Operation cancelled by user'));
|
|
20
|
+
process.on('SIGTERM', () => exitWith(143, 'Operation terminated'));
|
|
21
|
+
process.on('unhandledRejection', (reason) => exitWith(1, 'An unexpected error occurred (unhandled rejection)', reason));
|
|
22
|
+
process.on('uncaughtException', (error) => exitWith(1, 'An unexpected error occurred (uncaught exception)', error));
|
|
23
|
+
process.on('exit', restoreCursor);
|
|
24
|
+
main().catch((error) => exitWith(1, 'An unexpected error occurred', error));
|
|
16
25
|
}
|
|
17
26
|
//# sourceMappingURL=process_interruption.js.map
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
1
|
+
{"version":3,"file":"process_interruption.js","sourceRoot":"","sources":["../../src/utils/process_interruption.ts"],"names":[],"mappings":"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,EAAE,aAAa,CAAC,CAAC;IAElC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,8BAA8B,EAAE,KAAK,CAAC,CAAC,CAAC;AACvF,CAAC"}
|
|
@@ -9,54 +9,70 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { confirm, spinner, isCancel } from '@clack/prompts';
|
|
11
11
|
import chalk from 'chalk';
|
|
12
|
-
import { gitCommand } from './gitCommand.js';
|
|
12
|
+
import { gitCommand, gitErrorText, gitOutput } from './gitCommand.js';
|
|
13
|
+
const PROTECTED_BRANCHES = new Set(['main', 'master', 'production', 'release']);
|
|
13
14
|
export function handlePushToRemote() {
|
|
14
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
var _a;
|
|
17
|
+
const remotes = ((_a = gitOutput(['remote'])) !== null && _a !== void 0 ? _a : '').split('\n').filter(Boolean);
|
|
18
|
+
if (remotes.length === 0) {
|
|
19
|
+
console.log(chalk.yellow('⚠️ No remote repository configured. Skipping push.'));
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const branch = gitOutput(['rev-parse', '--abbrev-ref', 'HEAD']);
|
|
23
|
+
if (!branch || branch === 'HEAD') {
|
|
24
|
+
console.log(chalk.yellow('⚠️ HEAD is detached — not pushing. Create a branch first.'));
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const upstream = gitOutput(['rev-parse', '--abbrev-ref', '--symbolic-full-name', '@{u}']);
|
|
28
|
+
const remote = upstream ? upstream.split('/')[0] : remotes.includes('origin') ? 'origin' : remotes[0];
|
|
29
|
+
const target = { branch, remote, upstream };
|
|
30
|
+
if (PROTECTED_BRANCHES.has(branch.toLowerCase())) {
|
|
31
|
+
console.log(chalk.yellow.bold(`\n⚠️ You are about to push directly to "${branch}".`));
|
|
32
|
+
}
|
|
33
|
+
if (!upstream) {
|
|
34
|
+
console.log(chalk.yellow(`ℹ️ "${branch}" has no upstream; it will be created as ${remote}/${branch}.`));
|
|
35
|
+
}
|
|
15
36
|
const shouldPush = yield confirm({
|
|
16
|
-
message:
|
|
37
|
+
message: upstream
|
|
38
|
+
? `Push to ${upstream}?`
|
|
39
|
+
: `Push to ${remote}/${branch} and set it as upstream?`
|
|
17
40
|
});
|
|
18
41
|
if (isCancel(shouldPush) || !shouldPush) {
|
|
19
42
|
return;
|
|
20
43
|
}
|
|
21
|
-
|
|
44
|
+
executePush(target);
|
|
22
45
|
});
|
|
23
46
|
}
|
|
24
|
-
function executePush() {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const pushResult = gitCommand('push');
|
|
37
|
-
if (pushResult !== null) {
|
|
38
|
-
pushSpinner.stop('🚀 Changes pushed successfully!');
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
pushSpinner.stop('❌ Push failed');
|
|
42
|
-
handlePushFailure();
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
catch (error) {
|
|
46
|
-
pushSpinner.stop('❌ Push failed');
|
|
47
|
-
console.log(chalk.red('Failed to push. Error details:'));
|
|
48
|
-
console.log(chalk.dim(error.message));
|
|
47
|
+
function executePush(target) {
|
|
48
|
+
const pushSpinner = spinner();
|
|
49
|
+
pushSpinner.start(`Pushing to ${target.remote}/${target.branch}...`);
|
|
50
|
+
const args = target.upstream
|
|
51
|
+
? ['push']
|
|
52
|
+
: ['push', '--set-upstream', target.remote, target.branch];
|
|
53
|
+
const result = gitCommand(args);
|
|
54
|
+
if (result.ok) {
|
|
55
|
+
pushSpinner.stop('🚀 Changes pushed successfully!');
|
|
56
|
+
const summary = gitErrorText(result);
|
|
57
|
+
if (summary) {
|
|
58
|
+
console.log(chalk.dim(summary));
|
|
49
59
|
}
|
|
50
|
-
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
pushSpinner.stop('❌ Push failed');
|
|
63
|
+
handlePushFailure(target, gitErrorText(result));
|
|
51
64
|
}
|
|
52
|
-
function handlePushFailure() {
|
|
53
|
-
console.log(chalk.red('
|
|
54
|
-
|
|
55
|
-
if (
|
|
56
|
-
console.log(chalk.
|
|
65
|
+
function handlePushFailure(target, details) {
|
|
66
|
+
console.log(chalk.red('\nGit reported:'));
|
|
67
|
+
console.log(chalk.dim(details));
|
|
68
|
+
if (/non-fast-forward|fetch first|behind its remote/i.test(details)) {
|
|
69
|
+
console.log(chalk.yellow(`Remote has commits you don't. Try: git pull --rebase ${target.remote} ${target.branch}`));
|
|
70
|
+
}
|
|
71
|
+
else if (/Authentication failed|could not read Username|Permission denied|403/i.test(details)) {
|
|
72
|
+
console.log(chalk.yellow('Authentication failed — check your credentials or SSH key.'));
|
|
57
73
|
}
|
|
58
|
-
else {
|
|
59
|
-
console.log(chalk.
|
|
74
|
+
else if (/protected branch|pre-receive hook declined/i.test(details)) {
|
|
75
|
+
console.log(chalk.yellow('The remote rejected the push (protected branch or server-side hook).'));
|
|
60
76
|
}
|
|
61
77
|
}
|
|
62
78
|
//# 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":";;;;;;;;;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;
|
|
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,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,MAAM,CAAC,CAAC;QACrC,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;QAClC,CAAC;QACD,OAAO;IACT,CAAC;IAED,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAClC,iBAAiB,CAAC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;AAClD,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAkB,EAAE,OAAe;IAC5D,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAC1C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;IAEhC,IAAI,iDAAiD,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QACpE,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,MAAM,CAAC,wDAAwD,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC,CACvG,CAAC;IACJ,CAAC;SAAM,IAAI,sEAAsE,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QAChG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,4DAA4D,CAAC,CAAC,CAAC;IAC1F,CAAC;SAAM,IAAI,6CAA6C,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QACvE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,sEAAsE,CAAC,CAAC,CAAC;IACpG,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Absolute path of the repository root, or null when it cannot be resolved.
|
|
3
|
+
* Used so staging operates on the same (repo-root-relative) set of paths that
|
|
4
|
+
* the status display shows, no matter which subdirectory the tool was run from.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getRepoRoot(): string | null;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { gitOutput } from './gitCommand.js';
|
|
2
|
+
/**
|
|
3
|
+
* Absolute path of the repository root, or null when it cannot be resolved.
|
|
4
|
+
* Used so staging operates on the same (repo-root-relative) set of paths that
|
|
5
|
+
* the status display shows, no matter which subdirectory the tool was run from.
|
|
6
|
+
*/
|
|
7
|
+
export function getRepoRoot() {
|
|
8
|
+
return gitOutput(['rev-parse', '--show-toplevel']);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=repoRoot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repoRoot.js","sourceRoot":"","sources":["../../src/utils/repoRoot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;;;GAIG;AACH,MAAM,UAAU,WAAW;IACzB,OAAO,SAAS,CAAC,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export interface FileChange {
|
|
2
|
+
/** Single-letter git status: A, M, D, R, C, T, U or `??` for untracked. */
|
|
2
3
|
status: string;
|
|
4
|
+
/** Repo-root-relative path. For renames/copies this is the destination. */
|
|
3
5
|
file: string;
|
|
6
|
+
/** Source path, present only for renames and copies. */
|
|
7
|
+
from?: string;
|
|
4
8
|
}
|
|
5
9
|
export interface GitChanges {
|
|
6
10
|
staged: FileChange[];
|
|
@@ -10,8 +14,14 @@ export interface GitChanges {
|
|
|
10
14
|
export interface GitStatus {
|
|
11
15
|
valid: boolean;
|
|
12
16
|
reason?: string;
|
|
17
|
+
/** Non-fatal problems worth shouting about (e.g. detached HEAD). */
|
|
18
|
+
warnings?: string[];
|
|
13
19
|
}
|
|
14
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Conventional Commits types only — anything outside this list is rejected by a
|
|
22
|
+
* standard commitlint `commit-msg` hook.
|
|
23
|
+
*/
|
|
24
|
+
export type CommitType = 'feat' | 'fix' | 'docs' | 'style' | 'refactor' | 'perf' | 'test' | 'build' | 'ci' | 'chore' | 'revert';
|
|
15
25
|
export interface CommitInfo {
|
|
16
26
|
type: CommitType;
|
|
17
27
|
scope?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "git-it-done",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Smart auto-commit tool with beautiful CLI interface for streamlined Git workflow",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -12,14 +12,14 @@
|
|
|
12
12
|
"build": "tsc",
|
|
13
13
|
"prod": "node ./dist/index.js",
|
|
14
14
|
"prepublishOnly": "npm run build",
|
|
15
|
-
"test": "
|
|
15
|
+
"test": "npm run build && node --test \"test/*.test.js\"",
|
|
16
16
|
"start": "npm run build && npm run prod",
|
|
17
17
|
"install-global": "npm install -g .",
|
|
18
18
|
"uninstall-global": "npm uninstall -g git-it-done"
|
|
19
19
|
},
|
|
20
20
|
"files": [
|
|
21
21
|
"dist/",
|
|
22
|
-
"
|
|
22
|
+
"readme.md",
|
|
23
23
|
"LICENSE"
|
|
24
24
|
],
|
|
25
25
|
"keywords": [
|
|
@@ -32,16 +32,17 @@
|
|
|
32
32
|
"interactive",
|
|
33
33
|
"conventional-commits"
|
|
34
34
|
],
|
|
35
|
-
"author": "
|
|
35
|
+
"author": "Siddhant Gupta <siddhant@invytt.com>",
|
|
36
36
|
"license": "MIT",
|
|
37
37
|
"repository": {
|
|
38
38
|
"type": "git",
|
|
39
|
-
"url": "https://github.com/sidhxntt/
|
|
39
|
+
"url": "https://github.com/sidhxntt/Git-Bundle.git",
|
|
40
|
+
"directory": "Git-it-Done"
|
|
40
41
|
},
|
|
41
42
|
"bugs": {
|
|
42
|
-
"url": "https://github.com/sidhxntt/
|
|
43
|
+
"url": "https://github.com/sidhxntt/Git-Bundle/issues"
|
|
43
44
|
},
|
|
44
|
-
"homepage": "https://github.com/sidhxntt/
|
|
45
|
+
"homepage": "https://github.com/sidhxntt/Git-Bundle/tree/main/Git-it-Done#readme",
|
|
45
46
|
"engines": {
|
|
46
47
|
"node": ">=16.0.0"
|
|
47
48
|
},
|
package/readme.md
CHANGED
|
@@ -60,7 +60,7 @@ npm install -g git-it-done
|
|
|
60
60
|
|
|
61
61
|
2. **Run the auto-committer**:
|
|
62
62
|
```bash
|
|
63
|
-
|
|
63
|
+
git-it-done
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
3. **Follow the interactive prompts**:
|
|
@@ -75,7 +75,7 @@ npm install -g git-it-done
|
|
|
75
75
|
### Basic Workflow
|
|
76
76
|
|
|
77
77
|
```bash
|
|
78
|
-
$
|
|
78
|
+
$ git-it-done
|
|
79
79
|
|
|
80
80
|
┌ Auto Commit Tool
|
|
81
81
|
│
|
|
@@ -118,8 +118,8 @@ The tool analyzes your changes and generates conventional commit messages:
|
|
|
118
118
|
- `docs: update API documentation`
|
|
119
119
|
- `style(ui): improve button styling`
|
|
120
120
|
- `test(auth): add authentication tests`
|
|
121
|
-
- `
|
|
122
|
-
- `
|
|
121
|
+
- `build: update dependencies`
|
|
122
|
+
- `chore: update configuration`
|
|
123
123
|
|
|
124
124
|
## 🏗️ Project Structure
|
|
125
125
|
|
|
@@ -232,7 +232,7 @@ We welcome contributions! Please follow these steps:
|
|
|
232
232
|
```bash
|
|
233
233
|
# Clone your fork
|
|
234
234
|
git clone <your-fork-url>
|
|
235
|
-
cd
|
|
235
|
+
cd Git-Bundle/Git-it-Done
|
|
236
236
|
|
|
237
237
|
# Install dependencies
|
|
238
238
|
npm install
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isGitRepo(): boolean;
|
package/dist/utils/isGitrepo.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|