git-tidy-cli 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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Arman
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.
package/README.md ADDED
@@ -0,0 +1,117 @@
1
+ # git-tidy
2
+
3
+ An interactive CLI tool for cleaning up unused git branches. Built with [Ink](https://github.com/vadimdemedes/ink) for a beautiful terminal UI experience.
4
+
5
+ ## Features
6
+
7
+ - **Interactive wizard** - Step-by-step guided cleanup process
8
+ - **Dry-run by default** - Safe mode that shows what would be deleted without actually deleting
9
+ - **Multiple filter criteria** - Filter branches by:
10
+ - Merged status (already merged into default branch)
11
+ - Stale branches (no commits in X days)
12
+ - Age-based (branches older than X days)
13
+ - Pattern matching (e.g., `feature/*`, `hotfix/*`)
14
+ - **Smart defaults** - Auto-detects default branch via GitHub API
15
+ - **Batch selection** - Select all, none, or invert selection with keyboard shortcuts
16
+ - **Local & remote** - Delete both local and remote branches in one go
17
+ - **Delete after dry-run** - Option to execute deletion right after reviewing dry-run results
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ # Install globally from npm
23
+ npm install -g git-tidy-cli
24
+ ```
25
+
26
+ ### From source
27
+
28
+ ```bash
29
+ # Clone the repository
30
+ git clone https://github.com/ArmandBrworworworx/git-tidy.git
31
+ cd git-tidy
32
+
33
+ # Install dependencies
34
+ npm install
35
+
36
+ # Build
37
+ npm run build
38
+
39
+ # Link globally
40
+ npm link
41
+ ```
42
+
43
+ ## Usage
44
+
45
+ Simply run `git-tidy` in any git repository:
46
+
47
+ ```bash
48
+ git-tidy
49
+ ```
50
+
51
+ ### Options
52
+
53
+ | Flag | Description |
54
+ |------|-------------|
55
+ | `-x, --execute` | Actually delete branches (default: dry-run mode) |
56
+ | `-y, --yes` | Skip confirmations (for scripting) |
57
+ | `-t, --token <token>` | GitHub personal access token (or use `GITHUB_TOKEN` env) |
58
+ | `-V, --version` | Show version |
59
+ | `-h, --help` | Show help |
60
+
61
+ ### Examples
62
+
63
+ ```bash
64
+ # Interactive mode (dry-run by default)
65
+ git-tidy
66
+
67
+ # Actually delete branches
68
+ git-tidy --execute
69
+
70
+ # Use with GitHub token for better API access
71
+ git-tidy --token ghp_xxxxxxxxxxxx
72
+ # or
73
+ GITHUB_TOKEN=ghp_xxxxxxxxxxxx git-tidy
74
+ ```
75
+
76
+ ## Workflow
77
+
78
+ 1. **Scope Selection** - Choose to clean local, remote, or both
79
+ 2. **Filter Criteria** - Select which branches to include (merged, stale, pattern, etc.)
80
+ 3. **Branch Selection** - Review and select specific branches to delete
81
+ 4. **Confirmation** - Review summary before deletion
82
+ 5. **Execution** - Watch progress as branches are deleted
83
+ 6. **Summary** - See results with option to delete for real after dry-run
84
+
85
+ ### Keyboard Shortcuts
86
+
87
+ | Key | Action |
88
+ |-----|--------|
89
+ | `↑` `↓` | Navigate |
90
+ | `Space` | Toggle selection |
91
+ | `Enter` | Confirm / Proceed |
92
+ | `Esc` | Go back |
93
+ | `a` | Select all (in branch selection) |
94
+ | `n` | Select none (in branch selection) |
95
+ | `i` | Invert selection (in branch selection) |
96
+ | `d` | Delete for real (after dry-run) |
97
+ | `q` | Quit |
98
+
99
+ ## Safety
100
+
101
+ - **Dry-run by default** - No branches are deleted unless you pass `--execute` or press `d` after a dry-run
102
+ - **Protected branches** - Automatically protects `main`, `master`, `develop`, and the repository's default branch
103
+ - **Current branch protection** - Never deletes the branch you're currently on
104
+ - **Confirmation step** - Always shows a summary before any deletion
105
+
106
+ ## Tech Stack
107
+
108
+ - [Ink](https://github.com/vadimdemedes/ink) - React for CLI
109
+ - [@inkjs/ui](https://github.com/vadimdemedes/ink-ui) - UI components (Select, MultiSelect, Spinner)
110
+ - [simple-git](https://github.com/steveukx/git-js) - Git operations
111
+ - [@octokit/rest](https://github.com/octokit/rest.js) - GitHub API
112
+ - [Commander.js](https://github.com/tj/commander.js) - CLI argument parsing
113
+ - TypeScript + tsup
114
+
115
+ ## License
116
+
117
+ MIT
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import '../dist/index.js';
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node