git-it-done 1.0.3 → 1.1.1

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 (75) hide show
  1. package/LICENSE +21 -0
  2. package/dist/index.js +22 -30
  3. package/dist/index.js.map +1 -1
  4. package/dist/utils/branches.d.ts +2 -0
  5. package/dist/utils/branches.js +60 -0
  6. package/dist/utils/branches.js.map +1 -0
  7. package/dist/utils/checkGitStatus.js +37 -22
  8. package/dist/utils/checkGitStatus.js.map +1 -1
  9. package/dist/utils/commitWorkflow.d.ts +1 -0
  10. package/dist/utils/commitWorkflow.js +33 -0
  11. package/dist/utils/commitWorkflow.js.map +1 -0
  12. package/dist/utils/conflicts.d.ts +7 -0
  13. package/dist/utils/conflicts.js +96 -0
  14. package/dist/utils/conflicts.js.map +1 -0
  15. package/dist/utils/diffSignals.d.ts +22 -0
  16. package/dist/utils/diffSignals.js +75 -0
  17. package/dist/utils/diffSignals.js.map +1 -0
  18. package/dist/utils/displayStatus.js +8 -9
  19. package/dist/utils/displayStatus.js.map +1 -1
  20. package/dist/utils/fileStaging.js +68 -22
  21. package/dist/utils/fileStaging.js.map +1 -1
  22. package/dist/utils/formatFileStatus.js +6 -0
  23. package/dist/utils/formatFileStatus.js.map +1 -1
  24. package/dist/utils/generateCommitMessage.d.ts +12 -0
  25. package/dist/utils/generateCommitMessage.js +178 -83
  26. package/dist/utils/generateCommitMessage.js.map +1 -1
  27. package/dist/utils/getFileChanges.d.ts +15 -1
  28. package/dist/utils/getFileChanges.js +59 -18
  29. package/dist/utils/getFileChanges.js.map +1 -1
  30. package/dist/utils/gitCommand.d.ts +27 -1
  31. package/dist/utils/gitCommand.js +53 -10
  32. package/dist/utils/gitCommand.js.map +1 -1
  33. package/dist/utils/help.d.ts +7 -0
  34. package/dist/utils/help.js +35 -0
  35. package/dist/utils/help.js.map +1 -0
  36. package/dist/utils/inspect.d.ts +2 -0
  37. package/dist/utils/inspect.js +37 -0
  38. package/dist/utils/inspect.js.map +1 -0
  39. package/dist/utils/performCommit.js +29 -34
  40. package/dist/utils/performCommit.js.map +1 -1
  41. package/dist/utils/process_interruption.js +22 -13
  42. package/dist/utils/process_interruption.js.map +1 -1
  43. package/dist/utils/push_to_remote.d.ts +14 -0
  44. package/dist/utils/push_to_remote.js +76 -36
  45. package/dist/utils/push_to_remote.js.map +1 -1
  46. package/dist/utils/repoRoot.d.ts +6 -0
  47. package/dist/utils/repoRoot.js +10 -0
  48. package/dist/utils/repoRoot.js.map +1 -0
  49. package/dist/utils/repository.d.ts +21 -0
  50. package/dist/utils/repository.js +60 -0
  51. package/dist/utils/repository.js.map +1 -0
  52. package/dist/utils/setup.d.ts +2 -0
  53. package/dist/utils/setup.js +77 -0
  54. package/dist/utils/setup.js.map +1 -0
  55. package/dist/utils/stash.d.ts +2 -0
  56. package/dist/utils/stash.js +64 -0
  57. package/dist/utils/stash.js.map +1 -0
  58. package/dist/utils/sync.d.ts +3 -0
  59. package/dist/utils/sync.js +55 -0
  60. package/dist/utils/sync.js.map +1 -0
  61. package/dist/utils/types/types.d.ts +11 -1
  62. package/dist/utils/ui.d.ts +15 -0
  63. package/dist/utils/ui.js +28 -0
  64. package/dist/utils/ui.js.map +1 -0
  65. package/dist/utils/validation.d.ts +4 -0
  66. package/dist/utils/validation.js +26 -0
  67. package/dist/utils/validation.js.map +1 -0
  68. package/dist/utils/workspace.d.ts +1 -0
  69. package/dist/utils/workspace.js +61 -0
  70. package/dist/utils/workspace.js.map +1 -0
  71. package/package.json +9 -8
  72. package/readme.md +40 -268
  73. package/dist/utils/isGitrepo.d.ts +0 -1
  74. package/dist/utils/isGitrepo.js +0 -6
  75. package/dist/utils/isGitrepo.js.map +0 -1
package/readme.md CHANGED
@@ -1,303 +1,75 @@
1
- # 🚀 Git-it-done
1
+ # Git-it-Done
2
2
 
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.
3
+ Git-it-Done is a guided, interactive Git workspace for the terminal. Choose the task you want to accomplish instead of remembering Git commands; the CLI explains the target, checks for common risks, and asks before it changes anything.
4
4
 
5
- ## ✨ Features
5
+ ## Install
6
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
7
+ ```bash
8
+ npm install -g git-it-done
9
+ ```
35
10
 
36
- Ensure your Git user is configured:
11
+ Git-it-Done requires Node.js 16+, Git, and a configured Git name and email.
37
12
 
38
13
  ```bash
39
14
  git config --global user.name "Your Name"
40
- git config --global user.email "your.email@example.com"
15
+ git config --global user.email "you@example.com"
41
16
  ```
42
17
 
43
- ## 🛠️ Installation
44
-
18
+ Run it from any existing Git repository:
45
19
 
46
20
  ```bash
47
-
48
- npm install -g git-it-done
49
-
21
+ git-it-done
50
22
  ```
51
23
 
24
+ Run it in a normal folder to initialize Git through the same guided UI. It can configure a repository-local identity, create an initial `README.md` for an empty folder, make the first commit, and optionally add and push to a remote.
52
25
 
26
+ ## The guided workspace
53
27
 
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
28
+ The default screen shows your branch, working-tree state, remote/upstream, sync status, and any in-progress Git operation. Choose from:
72
29
 
73
- ## 🎮 Usage Examples
30
+ - **Commit changes** — select files, generate or write a Conventional Commit message, confirm, and optionally push.
31
+ - **Sync with remote** — fetches first, then safely offers a fast-forward-only pull or a push. Diverged branches are explained instead of changed automatically.
32
+ - **Push current branch** — detects the upstream, warns when pushing directly to protected branch names, and can create a missing upstream.
33
+ - **Manage branches** — list, switch, or create validated branch names. It never deletes, merges, or rebases branches.
34
+ - **Save or restore work** — create, list, apply, pop, or drop stashes through prompts.
35
+ - **Resolve an in-progress operation** — guides merge, rebase, cherry-pick, revert, and bisect recovery.
36
+ - **Inspect repository** — shows recent commits, remotes, conflict files, and a plain-language state summary.
74
37
 
75
- ### Basic Workflow
38
+ For a direct commit-only entry point, use:
76
39
 
77
40
  ```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
41
+ git-it-done commit
144
42
  ```
145
43
 
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
44
+ ## Conflict recovery
180
45
 
181
- The tool handles common scenarios gracefully:
46
+ When a merge, rebase, cherry-pick, or revert is already in progress, Git-it-Done surfaces it in the menu rather than leaving you to decipher Git status output. It lists unresolved files and lets you:
182
47
 
183
- ### Repository Issues
184
- - **Not in Git repo** → Clear error message
185
- - **Git not installed** → Installation guidance
186
- - **User not configured** → Configuration commands
48
+ 1. Open a selected file in `GIT_EDITOR`, `VISUAL`, or `EDITOR`.
49
+ 2. Mark a manually resolved file as staged.
50
+ 3. Continue after every conflict is staged.
51
+ 4. Abort the operation after a clear confirmation.
187
52
 
188
- ### File Issues
189
- - **No changes** → Friendly "nothing to commit" message
190
- - **Staging failures** → Retry suggestions
191
- - **Empty commits** → Prevention and guidance
53
+ Git-it-Done does not guess how code should be merged. You decide the correct resolution; the CLI keeps the Git state and next steps visible.
192
54
 
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
55
+ ## Safety guarantees
197
56
 
198
- ## 🛡️ Limitations
57
+ - Git commands run with literal argument arrays, never through a shell.
58
+ - Every state-changing workflow identifies its branch, stash, file, or remote target and requests confirmation.
59
+ - It will not force-push, delete branches, automate a merge/rebase, or overwrite local work.
60
+ - Pulls use `--ff-only`; a dirty worktree is asked to be committed or stashed first.
61
+ - Git failures are shown with the native Git output plus a plain-language next step where one is known.
199
62
 
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
63
+ ## Development
231
64
 
232
65
  ```bash
233
- # Clone your fork
234
- git clone <your-fork-url>
235
- cd auto-committer
236
-
237
- # Install dependencies
238
66
  npm install
239
-
240
- # Run in development mode
67
+ npm test
241
68
  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:
266
- git init
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
69
  ```
286
70
 
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
71
+ `npm test` compiles TypeScript and runs the Node test suite.
300
72
 
301
- ---
73
+ ## License
302
74
 
303
- **Made with ❤️ for developers who love clean commit histories**
75
+ [MIT](LICENSE)
@@ -1 +0,0 @@
1
- export declare function isGitRepo(): boolean;
@@ -1,6 +0,0 @@
1
- import { gitCommand } from "./gitCommand.js";
2
- // Check if we're in a git repository
3
- export function isGitRepo() {
4
- return !!gitCommand('rev-parse --git-dir');
5
- }
6
- //# sourceMappingURL=isGitrepo.js.map
@@ -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"}