gittable 1.0.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.
Files changed (51) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +459 -0
  3. package/cli.js +342 -0
  4. package/commands/add.js +159 -0
  5. package/commands/blame.js +33 -0
  6. package/commands/branch.js +234 -0
  7. package/commands/checkout.js +43 -0
  8. package/commands/cherry-pick.js +104 -0
  9. package/commands/clean.js +71 -0
  10. package/commands/clone.js +76 -0
  11. package/commands/commit.js +82 -0
  12. package/commands/config.js +171 -0
  13. package/commands/diff.js +30 -0
  14. package/commands/fetch.js +76 -0
  15. package/commands/grep.js +42 -0
  16. package/commands/init.js +45 -0
  17. package/commands/log.js +38 -0
  18. package/commands/merge.js +69 -0
  19. package/commands/mv.js +40 -0
  20. package/commands/pull.js +74 -0
  21. package/commands/push.js +97 -0
  22. package/commands/rebase.js +134 -0
  23. package/commands/remote.js +236 -0
  24. package/commands/restore.js +76 -0
  25. package/commands/revert.js +63 -0
  26. package/commands/rm.js +57 -0
  27. package/commands/show.js +47 -0
  28. package/commands/stash.js +201 -0
  29. package/commands/status.js +21 -0
  30. package/commands/sync.js +98 -0
  31. package/commands/tag.js +153 -0
  32. package/commands/undo.js +200 -0
  33. package/commands/uninit.js +57 -0
  34. package/index.d.ts +56 -0
  35. package/index.js +55 -0
  36. package/lib/commit/build-commit.js +64 -0
  37. package/lib/commit/get-previous-commit.js +15 -0
  38. package/lib/commit/questions.js +226 -0
  39. package/lib/config/read-config-file.js +54 -0
  40. package/lib/git/exec.js +222 -0
  41. package/lib/ui/ascii.js +154 -0
  42. package/lib/ui/banner.js +80 -0
  43. package/lib/ui/status-display.js +90 -0
  44. package/lib/ui/table.js +76 -0
  45. package/lib/utils/email-prompt.js +62 -0
  46. package/lib/utils/logger.js +47 -0
  47. package/lib/utils/spinner.js +57 -0
  48. package/lib/utils/terminal-link.js +55 -0
  49. package/lib/versions.js +17 -0
  50. package/package.json +73 -0
  51. package/standalone.js +24 -0
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Gittable Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
package/README.md ADDED
@@ -0,0 +1,459 @@
1
+ # Gittable
2
+
3
+ <div align="center">
4
+
5
+ **A modern, interactive Git CLI wrapper with conventional commits**
6
+
7
+ [![npm version](https://img.shields.io/npm/v/gittable.svg)](https://www.npmjs.com/package/gittable)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
9
+ [![Node.js Version](https://img.shields.io/badge/node-%3E%3D14.0.0-brightgreen.svg)](https://nodejs.org/)
10
+
11
+ [Installation](#installation) • [Quick Start](#quick-start) • [Documentation](#documentation) • [Contributing](#contributing)
12
+
13
+ </div>
14
+
15
+ ---
16
+
17
+ Gittable provides a beautiful, user-friendly interface for common Git operations while maintaining full compatibility with standard Git commands. Built with [@clack/prompts](https://github.com/natemoo-re/clack) for an exceptional command-line experience, Gittable enforces conventional commit message formats and offers intelligent, context-aware suggestions.
18
+
19
+ ## Features
20
+
21
+ - **Interactive Prompts** - Beautiful, intuitive command-line interface powered by @clack/prompts
22
+ - **Conventional Commits** - Enforces conventional commit message format for better project history
23
+ - **Full Git Coverage** - Wraps all major Git commands with enhanced user experience
24
+ - **Smart Defaults** - Context-aware suggestions and shortcuts for common workflows
25
+ - **Beautiful UI** - Colorful banners, tables, and status displays for better readability
26
+ - **Fast & Lightweight** - Minimal dependencies, maximum performance
27
+ - **Commitizen Adapter** - Works seamlessly with Commitizen for standardized commits
28
+
29
+ ## Installation
30
+
31
+ ### Global Installation
32
+
33
+ Install Gittable globally to use it from any directory:
34
+
35
+ ```bash
36
+ npm install -g gittable
37
+ ```
38
+
39
+ ### Local Installation
40
+
41
+ Install Gittable as a development dependency in your project:
42
+
43
+ ```bash
44
+ npm install --save-dev gittable
45
+ ```
46
+
47
+ ### Using npx
48
+
49
+ Run Gittable without installation using npx:
50
+
51
+ ```bash
52
+ npx gittable <command>
53
+ ```
54
+
55
+ ## Quick Start
56
+
57
+ ### Interactive Mode
58
+
59
+ Simply run `gittable` without any arguments to enter interactive mode:
60
+
61
+ ```bash
62
+ gittable
63
+ ```
64
+
65
+ This will display a beautiful menu to select commands by category, making it easy to discover and use available features.
66
+
67
+ ### Command Mode
68
+
69
+ Use Gittable just like Git, but with enhanced prompts:
70
+
71
+ ```bash
72
+ # Check repository status
73
+ gittable status
74
+ gittable st
75
+
76
+ # Create a commit with conventional format
77
+ gittable commit
78
+ gittable ci
79
+
80
+ # Branch management
81
+ gittable branch
82
+ gittable br
83
+
84
+ # Pull and push operations
85
+ gittable pull
86
+ gittable push
87
+ ```
88
+
89
+ ## Available Commands
90
+
91
+ ### Core Commands
92
+
93
+ | Command | Aliases | Description |
94
+ |---------|---------|-------------|
95
+ | `status` | `st` | Show repository status with color-coded display |
96
+ | `branch` | `br`, `co` | Branch management (list, create, checkout, delete) |
97
+ | `commit` | `ci` | Create commits with conventional format |
98
+ | `pull` | `pl` | Fetch and merge from remote |
99
+ | `push` | `ps` | Push to remote repository |
100
+ | `sync` | | Synchronize (pull + rebase + push) |
101
+ | `merge` | | Merge branches with interactive prompts |
102
+ | `rebase` | | Rebase operations with safety checks |
103
+ | `stash` | | Stash management (list, apply, drop) |
104
+ | `log` | | View commit history with formatted output |
105
+ | `undo` | `reset` | Undo operations and reflog browser |
106
+
107
+ ### File Operations
108
+
109
+ | Command | Description |
110
+ |---------|-------------|
111
+ | `add` | Stage files for commit with interactive selection |
112
+ | `diff` | Show changes with formatted output |
113
+ | `checkout` | Checkout files or branches |
114
+ | `restore` | Restore files from index or commit |
115
+ | `rm` | Remove files from git tracking |
116
+ | `mv` | Move/rename files in git |
117
+ | `clean` | Remove untracked files with confirmation |
118
+
119
+ ### Repository Management
120
+
121
+ | Command | Description |
122
+ |---------|-------------|
123
+ | `init` | Initialize a new repository |
124
+ | `uninit` | Remove git repository (clear history) |
125
+ | `clone` | Clone a repository with progress display |
126
+ | `remote` | Manage remote repositories |
127
+ | `fetch` | Fetch from remote with status updates |
128
+ | `tag` | Tag management (list, create, delete) |
129
+ | `config` | Git configuration management |
130
+
131
+ ### History & Inspection
132
+
133
+ | Command | Description |
134
+ |---------|-------------|
135
+ | `show` | Show commit details with formatted output |
136
+ | `revert` | Revert commits with confirmation |
137
+ | `cherry-pick` | Apply commits from another branch |
138
+ | `blame` | Show who last modified each line |
139
+ | `grep` | Search in repository with formatted results |
140
+
141
+ ## Configuration
142
+
143
+ Gittable uses configuration files to customize commit prompts and behavior. Create one of the following files in your project root:
144
+
145
+ - `.gittable.js`
146
+ - `.gittable.json`
147
+ - Or add config to `package.json` under `gittable` key
148
+
149
+ ### Example Configuration (`.gittable.js`)
150
+
151
+ ```javascript
152
+ module.exports = {
153
+ types: [
154
+ { value: 'feat', name: 'feat: A new feature' },
155
+ { value: 'fix', name: 'fix: A bug fix' },
156
+ { value: 'docs', name: 'docs: Documentation only changes' },
157
+ { value: 'style', name: 'style: Code style changes (formatting, etc.)' },
158
+ { value: 'refactor', name: 'refactor: Code refactoring' },
159
+ { value: 'perf', name: 'perf: Performance improvements' },
160
+ { value: 'test', name: 'test: Adding or updating tests' },
161
+ { value: 'chore', name: 'chore: Maintenance tasks' },
162
+ ],
163
+ scopes: [
164
+ 'components',
165
+ 'api',
166
+ 'auth',
167
+ 'db',
168
+ 'config',
169
+ 'utils',
170
+ ],
171
+ allowTicketNumber: true,
172
+ ticketNumberPrefix: 'TICKET-',
173
+ ticketNumberRegExp: '\\d{1,5}',
174
+ subjectLimit: 100,
175
+ allowBreakingChanges: ['feat', 'fix'],
176
+ skipQuestions: [],
177
+ usePreparedCommit: false,
178
+ };
179
+ ```
180
+
181
+ ### Configuration Options
182
+
183
+ | Option | Type | Description |
184
+ |--------|------|-------------|
185
+ | `types` | Array | Commit types with value and name |
186
+ | `scopes` | Array | Available scopes for commits |
187
+ | `allowTicketNumber` | Boolean | Enable ticket number input |
188
+ | `ticketNumberPrefix` | String | Prefix for ticket numbers |
189
+ | `ticketNumberRegExp` | String | Regex pattern for ticket validation |
190
+ | `subjectLimit` | Number | Maximum subject line length |
191
+ | `allowBreakingChanges` | Array | Types that allow breaking changes |
192
+ | `skipQuestions` | Array | Questions to skip (e.g., `['body', 'footer']`) |
193
+ | `usePreparedCommit` | Boolean | Use previous commit as default |
194
+
195
+ ## Usage Examples
196
+
197
+ ### Creating a Commit
198
+
199
+ ```bash
200
+ gittable commit
201
+ ```
202
+
203
+ This interactive command guides you through:
204
+
205
+ 1. Selecting commit type (feat, fix, docs, etc.)
206
+ 2. Choosing scope (optional)
207
+ 3. Entering ticket number (if enabled)
208
+ 4. Writing commit message
209
+ 5. Adding extended description (optional)
210
+ 6. Breaking changes (if applicable)
211
+ 7. Issues closed (optional)
212
+
213
+ ### Branch Management
214
+
215
+ ```bash
216
+ # List all branches
217
+ gittable branch
218
+
219
+ # Create and checkout new branch
220
+ gittable branch create feature/new-feature
221
+
222
+ # Delete branch
223
+ gittable branch delete old-branch
224
+ ```
225
+
226
+ ### Status Check
227
+
228
+ ```bash
229
+ gittable status
230
+ ```
231
+
232
+ Shows a beautiful, color-coded status display with:
233
+
234
+ - Current branch information
235
+ - Staged files
236
+ - Unstaged files
237
+ - Untracked files
238
+ - Ahead/behind information relative to remote
239
+
240
+ ## Development
241
+
242
+ ### Prerequisites
243
+
244
+ - Node.js >= 14.0.0
245
+ - npm or yarn
246
+ - Git (for testing)
247
+
248
+ ### Setup
249
+
250
+ ```bash
251
+ # Clone the repository
252
+ git clone https://github.com/GG-Santos/Gittable.git
253
+ cd Gittable
254
+
255
+ # Install dependencies
256
+ npm install
257
+ ```
258
+
259
+ ### Available Scripts
260
+
261
+ ```bash
262
+ # Lint code
263
+ npm run lint
264
+
265
+ # Fix linting issues automatically
266
+ npm run lint:fix
267
+
268
+ # Format code
269
+ npm run format
270
+
271
+ # Run tests
272
+ npm test
273
+
274
+ # Run tests in watch mode
275
+ npm run test:watch
276
+
277
+ # Create a commit using Gittable
278
+ npm run commit
279
+ ```
280
+
281
+ ### Project Structure
282
+
283
+ ```
284
+ gittable/
285
+ ├── cli.js # Main CLI entry point
286
+ ├── index.js # Commitizen adapter
287
+ ├── standalone.js # Standalone commit script
288
+ ├── commands/ # Command implementations
289
+ │ ├── add.js
290
+ │ ├── branch.js
291
+ │ ├── commit.js
292
+ │ └── ...
293
+ ├── lib/
294
+ │ ├── commit/ # Commit-related utilities
295
+ │ │ ├── build-commit.js
296
+ │ │ ├── get-previous-commit.js
297
+ │ │ └── questions.js
298
+ │ ├── config/ # Configuration handling
299
+ │ │ └── read-config-file.js
300
+ │ ├── git/ # Git execution helpers
301
+ │ │ └── exec.js
302
+ │ ├── ui/ # UI components
303
+ │ │ ├── ascii.js
304
+ │ │ ├── banner.js
305
+ │ │ ├── status-display.js
306
+ │ │ └── table.js
307
+ │ └── utils/ # Utility functions
308
+ │ ├── email-prompt.js
309
+ │ ├── logger.js
310
+ │ ├── spinner.js
311
+ │ └── terminal-link.js
312
+ └── test/ # Test files
313
+ └── lib/
314
+ ```
315
+
316
+ ## Contributing
317
+
318
+ We welcome contributions to Gittable! This project follows conventional commit standards and uses Biome for code formatting.
319
+
320
+ ### Getting Started
321
+
322
+ 1. **Fork the repository** on GitHub
323
+ 2. **Clone your fork** locally:
324
+ ```bash
325
+ git clone https://github.com/yourusername/Gittable.git
326
+ cd Gittable
327
+ ```
328
+ 3. **Install dependencies**:
329
+ ```bash
330
+ npm install
331
+ ```
332
+
333
+ ### Development Workflow
334
+
335
+ 1. **Create a branch** for your changes:
336
+ ```bash
337
+ gittable branch create feature/your-feature-name
338
+ # or
339
+ git checkout -b feature/your-feature-name
340
+ ```
341
+
342
+ 2. **Make your changes** following the coding standards
343
+
344
+ 3. **Run tests** to ensure everything works:
345
+ ```bash
346
+ npm test
347
+ ```
348
+
349
+ 4. **Run linter** to check code quality:
350
+ ```bash
351
+ npm run lint
352
+ ```
353
+
354
+ 5. **Fix any issues** automatically:
355
+ ```bash
356
+ npm run lint:fix
357
+ ```
358
+
359
+ 6. **Commit your changes** using Gittable's commit command:
360
+ ```bash
361
+ gittable commit
362
+ # or
363
+ npm run commit
364
+ ```
365
+
366
+ 7. **Push to your fork**:
367
+ ```bash
368
+ gittable push origin feature/your-feature-name
369
+ ```
370
+
371
+ 8. **Open a Pull Request** on GitHub
372
+
373
+ ### Coding Standards
374
+
375
+ - We use [Biome](https://biomejs.dev/) for linting and formatting
376
+ - Run `npm run format` before committing
377
+ - Follow the existing code style in the project
378
+ - Write tests for new features
379
+ - Update documentation as needed
380
+
381
+ ### Commit Messages
382
+
383
+ - Use Gittable's commit command for consistent commit messages
384
+ - Follow [Conventional Commits](https://www.conventionalcommits.org/) format
385
+ - Examples:
386
+ - `feat(commands): add new sync command`
387
+ - `fix(exec): handle git errors gracefully`
388
+ - `docs(readme): update installation instructions`
389
+
390
+ ### Reporting Bugs
391
+
392
+ When reporting bugs, please include:
393
+
394
+ 1. **Description** of the bug
395
+ 2. **Steps to reproduce**
396
+ 3. **Expected behavior**
397
+ 4. **Actual behavior**
398
+ 5. **Environment**:
399
+ - Node.js version
400
+ - Operating system
401
+ - Gittable version
402
+
403
+ ### Suggesting Features
404
+
405
+ Feature suggestions are welcome! Please:
406
+
407
+ 1. Check if the feature already exists or is planned
408
+ 2. Open an issue describing the feature
409
+ 3. Explain the use case and benefits
410
+ 4. Be open to discussion and feedback
411
+
412
+ ## Dependencies
413
+
414
+ ### Production Dependencies
415
+
416
+ - **[@clack/prompts](https://github.com/natemoo-re/clack)** (^0.7.0) - Beautiful CLI prompts and interactive components
417
+ - **[chalk](https://github.com/chalk/chalk)** (^4.1.2) - Terminal string styling
418
+ - **[cli-table3](https://github.com/cli-table/cli-table3)** - Beautiful tables for CLI output
419
+ - **[email-prompt](https://github.com/team-767/email-prompt)** - Email input with autocompletion
420
+ - **[find-config](https://github.com/shannonmoeller/find-config)** (^1.0.0) - Find configuration files in directory tree
421
+ - **[prettycli](https://github.com/siddharthkp/prettycli)** - Enhanced CLI logging with better formatting
422
+ - **[word-wrap](https://github.com/jonschlinkert/word-wrap)** (^1.2.5) - Word wrapping utility
423
+
424
+ ### Development Dependencies
425
+
426
+ - **[@biomejs/biome](https://biomejs.dev/)** (^1.9.4) - Fast formatter and linter
427
+ - **[commitizen](https://github.com/commitizen/cz-cli)** (^4.3.0) - Commit message standardization
428
+
429
+ ## License
430
+
431
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
432
+
433
+ ## Acknowledgments
434
+
435
+ Gittable is built with the following excellent open-source projects:
436
+
437
+ - **[@clack/prompts](https://github.com/natemoo-re/clack)** by [@natemoo-re](https://github.com/natemoo-re) - Beautiful CLI prompts library
438
+ - **[cz-customizable](https://github.com/leoforfree/cz-customizable)** by [@leoforfree](https://github.com/leoforfree) - Commit message helper inspiration
439
+ - **[conventional-changelog](https://github.com/conventional-changelog)** - Conventional commits specification
440
+ - **[chalk](https://github.com/chalk/chalk)** by [@sindresorhus](https://github.com/sindresorhus) - Terminal string styling
441
+ - **[cli-table3](https://github.com/cli-table/cli-table3)** - Beautiful CLI tables
442
+ - **[Biome](https://biomejs.dev/)** - Fast formatter and linter
443
+
444
+ ## Author
445
+
446
+ **GG-Santos** from Wab n' Wab Atelier
447
+
448
+ - Email: ggsantos_0415@proton.me
449
+ - GitHub: [@GG-Santos](https://github.com/GG-Santos)
450
+
451
+ ---
452
+
453
+ <div align="center">
454
+
455
+ Made with dedication by the Gittable team
456
+
457
+ [Report Bug](https://github.com/GG-Santos/Gittable/issues) • [Request Feature](https://github.com/GG-Santos/Gittable/issues) • [View on GitHub](https://github.com/GG-Santos/Gittable)
458
+
459
+ </div>