bimagic 1.4.2
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/README.md +656 -0
- package/SECURITY.md +25 -0
- package/bimagic +1310 -0
- package/package.json +34 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Bimbok
|
|
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,656 @@
|
|
|
1
|
+
# Bimagic - Git Wizard
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img width="400" style="border-radius: 12px;" alt="Image" src="https://github.com/user-attachments/assets/d74de26d-949b-4aa9-9b2e-c25de5b25b42" />
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">By Bimbok and adityapaul26</p>
|
|
8
|
+
|
|
9
|
+
A powerful Bash-based Git automation tool that simplifies your GitHub workflow with an interactive menu system.
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
Bimagic is an interactive command-line tool that streamlines common Git operations, making version control more accessible through a user-friendly menu interface. It handles repository initialization, committing, branching, and remote operations with GitHub integration using personal access tokens.
|
|
14
|
+
|
|
15
|
+
## Sample
|
|
16
|
+
|
|
17
|
+
<img width="1920" height="1080" alt="Image" src="Sample/2026-03-11-191645_hyprshot.png" />
|
|
18
|
+
<p align="center">bimagic in a terminal (kitty)</p>
|
|
19
|
+
|
|
20
|
+
<img width="1920" height="1080" alt="Image" src="Sample/2026-03-11-191744_hyprshot.png" />
|
|
21
|
+
<p align="center">bimagic in neovim</p>
|
|
22
|
+
|
|
23
|
+
## Features
|
|
24
|
+
|
|
25
|
+
- 🔮 Interactive menu-driven interface
|
|
26
|
+
- 🔐 Secure GitHub authentication via personal access tokens
|
|
27
|
+
- 📦 Easy repository initialization and setup
|
|
28
|
+
- 📥 Clone repositories (Standard or Interactive selection)
|
|
29
|
+
- 🔄 Simplified push/pull operations
|
|
30
|
+
- 🌿 Branch management made easy
|
|
31
|
+
- 📊 Status dashboard (ahead/behind, branch, clean/uncommitted/conflicts)
|
|
32
|
+
- 🛡️ Automatic master-to-main branch renaming
|
|
33
|
+
- 🗑️ Safe file/folder removal with git integration
|
|
34
|
+
- 📈 Contributor statistics with time range selection
|
|
35
|
+
- 🌐 Git graph (pretty git log) viewer
|
|
36
|
+
- 📜 The Architect (.gitignore generator)
|
|
37
|
+
- 🔀 Merge branches with conflict detection
|
|
38
|
+
- ⏪ Revert commit(s) with multi-select
|
|
39
|
+
- 🎨 Theme Customization (ANSI and Hex color support)
|
|
40
|
+
- ⏳ Time Turner (Undo last commit)
|
|
41
|
+
- 🗃️ Stash operations (Push, Pop, List, Apply, Drop, Clear)
|
|
42
|
+
|
|
43
|
+
## Installation
|
|
44
|
+
|
|
45
|
+
### Automated Installation (Recommended)
|
|
46
|
+
|
|
47
|
+
Run this one-line command to install Bimagic:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
curl -sSL https://raw.githubusercontent.com/Bimbok/bimagic/main/install.sh | bash
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Quick Access (Keybinding)
|
|
54
|
+
|
|
55
|
+
The installer automatically sets up a **Ctrl + B** keybinding for **Zsh**, **Bash**, and **Fish** shells. This allows you to summon the Git Wizard from anywhere in your terminal instantly!
|
|
56
|
+
|
|
57
|
+
- **Zsh**: Uses a custom ZLE widget to ensure a clean UI transition.
|
|
58
|
+
- **Bash**: Uses `bind -x` for direct execution.
|
|
59
|
+
- **Fish**: Uses `bind \cb` with a repaint command.
|
|
60
|
+
|
|
61
|
+
_Note: You may need to restart your terminal or source your config file (e.g., `source ~/.zshrc`) after installation for the keybinding to take effect._
|
|
62
|
+
|
|
63
|
+
### Neovim Integration
|
|
64
|
+
|
|
65
|
+
You can use Bimagic directly inside Neovim! This integration wraps the CLI tool in a floating terminal window using `toggleterm.nvim` for a seamless workflow.
|
|
66
|
+
|
|
67
|
+
#### LazyVim / Toggleterm Setup
|
|
68
|
+
|
|
69
|
+
Create a new plugin file (e.g., `~/.config/nvim/lua/plugins/bimagic.lua`) with the following configuration. This sets up a `<leader>gm` keybinding to launch the wizard in a floating popup.
|
|
70
|
+
|
|
71
|
+
```lua
|
|
72
|
+
return {
|
|
73
|
+
{
|
|
74
|
+
"akinsho/toggleterm.nvim",
|
|
75
|
+
opts = function(_, opts)
|
|
76
|
+
opts.size = 20
|
|
77
|
+
opts.open_mapping = [[<c-\>]]
|
|
78
|
+
end,
|
|
79
|
+
keys = {
|
|
80
|
+
{
|
|
81
|
+
"<leader>gm",
|
|
82
|
+
function()
|
|
83
|
+
local Terminal = require("toggleterm.terminal").Terminal
|
|
84
|
+
local bimagic = Terminal:new({
|
|
85
|
+
cmd = "bimagic", -- This assumes 'bimagic' is in your global PATH
|
|
86
|
+
hidden = true,
|
|
87
|
+
direction = "float",
|
|
88
|
+
float_opts = {
|
|
89
|
+
border = "curved", -- 'single', 'double', 'shadow', 'curved'
|
|
90
|
+
width = 100,
|
|
91
|
+
height = 25,
|
|
92
|
+
title = " Bimagic Git Wizard ",
|
|
93
|
+
},
|
|
94
|
+
close_on_exit = true,
|
|
95
|
+
|
|
96
|
+
on_open = function(term)
|
|
97
|
+
vim.cmd("startinsert!")
|
|
98
|
+
vim.api.nvim_buf_set_keymap(term.bufnr, "n", "q", "<cmd>close<CR>", { noremap = true, silent = true })
|
|
99
|
+
end,
|
|
100
|
+
})
|
|
101
|
+
bimagic:toggle()
|
|
102
|
+
end,
|
|
103
|
+
desc = "Bimagic (Git Wizard)",
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Manual Installation
|
|
111
|
+
|
|
112
|
+
1. Clone the repository:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
git clone https://github.com/Bimbok/bimagic.git
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
2. Make the script executable:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
chmod +x bimagic/bimagic
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
3. Move it to your bin directory:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# Option 1: For user-local installation (no sudo required)
|
|
128
|
+
mkdir -p ~/bin
|
|
129
|
+
mv bimagic/bimagic ~/bin/
|
|
130
|
+
|
|
131
|
+
# Option 2: For system-wide installation (requires sudo)
|
|
132
|
+
sudo mv bimagic/bimagic /usr/local/bin/
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
4. Ensure the bin directory is in your PATH (add to ~/.bashrc or ~/.zshrc if needed):
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
export PATH="$HOME/bin:$PATH" # For user-local installation
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Dependencies
|
|
142
|
+
|
|
143
|
+
- gum (required for modern UI and interactive selection)
|
|
144
|
+
- See installation instructions below or use the automated script.
|
|
145
|
+
- If not installed, the tool will not work.
|
|
146
|
+
|
|
147
|
+
## Configuration
|
|
148
|
+
|
|
149
|
+
### Setting Up GitHub Credentials
|
|
150
|
+
|
|
151
|
+
Bimagic requires your GitHub username and a personal access token. Add these to your shell configuration file:
|
|
152
|
+
|
|
153
|
+
1. Open your shell configuration file:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
# For bash users
|
|
157
|
+
nano ~/.bashrc
|
|
158
|
+
|
|
159
|
+
# For zsh users
|
|
160
|
+
nano ~/.zshrc
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
2. Add these lines at the end of the file:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
# GitHub credentials for bimagic
|
|
167
|
+
export GITHUB_USER="your_github_username"
|
|
168
|
+
export GITHUB_TOKEN="your_github_personal_access_token"
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
3. Reload your shell configuration:
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
source ~/.bashrc # or source ~/.zshrc
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Theme Customization 🎨
|
|
178
|
+
|
|
179
|
+
Bimagic allows you to fully customize the UI colors through a theme file.
|
|
180
|
+
|
|
181
|
+
1. **Location**: The theme file is located at `~/.config/bimagic/theme.wz`.
|
|
182
|
+
2. **Formats**: You can use **ANSI color numbers (0-255)** or **Hex codes (#RRGGBB)**.
|
|
183
|
+
3. **TrueColor Support**: Hex codes will automatically enable TrueColor mode in supported terminals.
|
|
184
|
+
|
|
185
|
+
#### Example `theme.wz`:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
# Bimagic Theme - Arctic Neon
|
|
189
|
+
# Copy this to ~/.config/bimagic/theme.wz
|
|
190
|
+
|
|
191
|
+
# Primary color - Neon Cyan
|
|
192
|
+
BIMAGIC_PRIMARY="#00FFFF"
|
|
193
|
+
|
|
194
|
+
# Secondary color - Deep Sky Blue
|
|
195
|
+
BIMAGIC_SECONDARY="#00AFFF"
|
|
196
|
+
|
|
197
|
+
# Success color - Spring Green
|
|
198
|
+
BIMAGIC_SUCCESS="#00FF87"
|
|
199
|
+
|
|
200
|
+
# Error color - Hot Pink
|
|
201
|
+
BIMAGIC_ERROR="#FF005F"
|
|
202
|
+
|
|
203
|
+
# Warning color - Amber
|
|
204
|
+
BIMAGIC_WARNING="#FFD700"
|
|
205
|
+
|
|
206
|
+
# Info color - Seafoam
|
|
207
|
+
BIMAGIC_INFO="#00FFAF"
|
|
208
|
+
|
|
209
|
+
# Muted color - Steel Grey
|
|
210
|
+
BIMAGIC_MUTED="243"
|
|
211
|
+
|
|
212
|
+
# Banner Gradients (Deep Blue to Cyan)
|
|
213
|
+
BANNER_COLOR_1="21"
|
|
214
|
+
BANNER_COLOR_2="27"
|
|
215
|
+
BANNER_COLOR_3="33"
|
|
216
|
+
BANNER_COLOR_4="39"
|
|
217
|
+
BANNER_COLOR_5="45"
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### Matugen integration.
|
|
221
|
+
|
|
222
|
+
#### Step 1: Create the Matugen Template for Bimagic
|
|
223
|
+
|
|
224
|
+
Create a new file at `~/.config/matugen/templates/bimagic-theme.wz`:
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
# Bimagic Theme - Generated by Matugen
|
|
228
|
+
# Do not edit manually!
|
|
229
|
+
|
|
230
|
+
BIMAGIC_PRIMARY="{{colors.primary.default.hex}}"
|
|
231
|
+
BIMAGIC_SECONDARY="{{colors.secondary.default.hex}}"
|
|
232
|
+
|
|
233
|
+
# Material You doesn't have strict 'success/warning', so we map them to complementary accent colors
|
|
234
|
+
BIMAGIC_SUCCESS="{{colors.tertiary.default.hex}}"
|
|
235
|
+
BIMAGIC_ERROR="{{colors.error.default.hex}}"
|
|
236
|
+
BIMAGIC_WARNING="{{colors.tertiary_container.default.hex}}"
|
|
237
|
+
BIMAGIC_INFO="{{colors.primary_container.default.hex}}"
|
|
238
|
+
|
|
239
|
+
# Muted colors for hints
|
|
240
|
+
BIMAGIC_MUTED="{{colors.outline.default.hex}}"
|
|
241
|
+
|
|
242
|
+
# Banner Gradients (Creating a smooth transition using Material shades)
|
|
243
|
+
BANNER_COLOR_1="{{colors.primary.default.hex}}"
|
|
244
|
+
BANNER_COLOR_2="{{colors.primary_fixed.default.hex}}"
|
|
245
|
+
BANNER_COLOR_3="{{colors.secondary.default.hex}}"
|
|
246
|
+
BANNER_COLOR_4="{{colors.secondary_fixed.default.hex}}"
|
|
247
|
+
BANNER_COLOR_5="{{colors.tertiary.default.hex}}"
|
|
248
|
+
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
#### Step 2: Update your Matugen Config
|
|
252
|
+
|
|
253
|
+
Open your Matugen config (usually `~/.config/matugen/config.toml`) and add this block to the bottom:
|
|
254
|
+
|
|
255
|
+
```toml
|
|
256
|
+
[templates.bimagic]
|
|
257
|
+
input_path = "~/.config/matugen/templates/bimagic-theme.wz"
|
|
258
|
+
output_path = "~/.config/bimagic/theme.wz"
|
|
259
|
+
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
#### Step 3: Test the Magic
|
|
263
|
+
|
|
264
|
+
Run your usual matugen command to generate colors from your current wallpaper. For example:
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
matugen image /path/to/your/wallpaper.jpg
|
|
268
|
+
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### Creating a GitHub Personal Access Token
|
|
272
|
+
|
|
273
|
+
1. Go to GitHub → Settings → Developer settings → Personal access tokens
|
|
274
|
+
2. Click "Generate new token"
|
|
275
|
+
3. Give your token a descriptive name (e.g., "bimagic-cli")
|
|
276
|
+
4. Select the "repo" scope (this provides full control of private repositories)
|
|
277
|
+
5. Click "Generate token"
|
|
278
|
+
6. Copy the token immediately (you won't be able to see it again!)
|
|
279
|
+
|
|
280
|
+
## Usage
|
|
281
|
+
|
|
282
|
+
Simply run the `bimagic` command in your terminal:
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
bimagic
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
**Pro Tip:**
|
|
289
|
+
|
|
290
|
+
- Press **Ctrl + B** in your terminal to quickly summon the wizard from anywhere!
|
|
291
|
+
- You can also use the short alias **wz** (Wizard) for even faster access!
|
|
292
|
+
|
|
293
|
+
```bash
|
|
294
|
+
wz
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
### Command Line Flags
|
|
298
|
+
|
|
299
|
+
You can also use flags to perform specific actions immediately:
|
|
300
|
+
|
|
301
|
+
- **Clone Repository**:
|
|
302
|
+
```bash
|
|
303
|
+
bimagic -d "repo-url"
|
|
304
|
+
```
|
|
305
|
+
- **Interactive Clone** (Select specific files/folders to download):
|
|
306
|
+
```bash
|
|
307
|
+
bimagic -d -i "repo-url"
|
|
308
|
+
```
|
|
309
|
+
- **The Lazy Wizard** (Add + Commit + Push):
|
|
310
|
+
```bash
|
|
311
|
+
bimagic -z "commit message"
|
|
312
|
+
```
|
|
313
|
+
- **The Crystal Ball** (Show Status Dashboard):
|
|
314
|
+
```bash
|
|
315
|
+
bimagic -s
|
|
316
|
+
```
|
|
317
|
+
- **The Time Scroll** (Show Git Graph):
|
|
318
|
+
```bash
|
|
319
|
+
bimagic -g
|
|
320
|
+
```
|
|
321
|
+
- **The Time Turner** (Undo last commit):
|
|
322
|
+
```bash
|
|
323
|
+
bimagic -u
|
|
324
|
+
```
|
|
325
|
+
- **The Architect** (Summon .gitignore):
|
|
326
|
+
```bash
|
|
327
|
+
bimagic -a
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
You'll be presented with an interactive menu where you can choose from various Git operations.
|
|
331
|
+
|
|
332
|
+
### Status Dashboard
|
|
333
|
+
|
|
334
|
+
At the top of the interface, a status box summarizes:
|
|
335
|
+
|
|
336
|
+
- Current `GITHUB_USER` and branch
|
|
337
|
+
- Ahead/behind counts relative to upstream (if set)
|
|
338
|
+
- Working tree state: clean, uncommitted, or conflicts
|
|
339
|
+
|
|
340
|
+
### Menu Options
|
|
341
|
+
|
|
342
|
+
1. **Clone repository** - Clone a repository from a URL (supports standard and interactive modes)
|
|
343
|
+
2. **Init new repo** - Initialize a new Git repository (auto-renames master → main)
|
|
344
|
+
3. **Add files** - Stage files (interactive multi-select; includes [ALL])
|
|
345
|
+
4. **Commit changes** - Commit staged changes with a choice between Magic Commit (Conventional Builder) or Quick Commit (One-line)
|
|
346
|
+
5. **Push to remote** - Push changes (handles multiple remotes and auto-configuration)
|
|
347
|
+
6. **Pull latest changes** - Fetch and merge changes from remote
|
|
348
|
+
7. **Create/switch branch** - Create a new branch or switch to an existing one
|
|
349
|
+
8. **Set remote** - Configure remotes (supports HTTPS with token or SSH)
|
|
350
|
+
9. **Show status** - Display repo status dashboard (ahead/behind, branch, cleanliness)
|
|
351
|
+
10. **Contributor Statistics** - View per-author activity with time range selection
|
|
352
|
+
11. **Git graph** - Pretty git log with graph and decorations
|
|
353
|
+
12. **Remove files/folders (rm)** - Safely remove files/folders with git integration
|
|
354
|
+
13. **Summon the Architect (.gitignore)** - Interactive .gitignore generator with 70+ blueprints
|
|
355
|
+
14. **Merge branches** - Merge a selected branch into the current one
|
|
356
|
+
15. **Uninitialize repo** – Remove Git tracking from a project
|
|
357
|
+
16. **Revert commit(s)** - Revert one or more commits (multi-select)
|
|
358
|
+
17. **Stash operations** - Manage stashes (push, pop, list, apply, drop, clear)
|
|
359
|
+
18. **Exit** - Quit the wizard
|
|
360
|
+
|
|
361
|
+
### Clone repository (Option 1)
|
|
362
|
+
|
|
363
|
+
This feature allows you to clone a repository with two modes:
|
|
364
|
+
|
|
365
|
+
#### Standard Clone
|
|
366
|
+
|
|
367
|
+
Perform a full `git clone` of the target repository.
|
|
368
|
+
|
|
369
|
+
#### Interactive Clone (Sparse Checkout)
|
|
370
|
+
|
|
371
|
+
If you only need specific files or folders from a large repository, this mode allows you to:
|
|
372
|
+
|
|
373
|
+
1. Download the repository metadata without file contents.
|
|
374
|
+
2. Select specific files/folders interactively.
|
|
375
|
+
3. Download only the selected items into your local directory.
|
|
376
|
+
|
|
377
|
+
Usage from CLI: `bimagic -d -i "repo-url"`
|
|
378
|
+
|
|
379
|
+
### Commit changes (Option 4)
|
|
380
|
+
|
|
381
|
+
Bimagic offers two ways to commit your staged changes:
|
|
382
|
+
|
|
383
|
+
#### Magic Commit (Builder)
|
|
384
|
+
|
|
385
|
+
The "Commit Spell" - a guided experience that helps you follow the [Conventional Commits](https://www.conventionalcommits.org/) specification. It prompts you for:
|
|
386
|
+
|
|
387
|
+
1. **Type**: feat, fix, docs, style, refactor, perf, test, chore.
|
|
388
|
+
2. **Scope**: The area of the code being changed (optional).
|
|
389
|
+
3. **Description**: A short, imperative-mood summary.
|
|
390
|
+
4. **Body**: Detailed description (optional).
|
|
391
|
+
5. **Breaking Changes**: Automatically adds `!` to the type/scope for visibility.
|
|
392
|
+
|
|
393
|
+
#### Quick Commit (One-line)
|
|
394
|
+
|
|
395
|
+
For when you just want to provide a quick message and move on.
|
|
396
|
+
|
|
397
|
+
### Contributor Statistics (Option 10)
|
|
398
|
+
|
|
399
|
+
Analyze contributions over a chosen time range (Last 7/30/90 days, Last year, All time). The tool parses `git log --numstat` to compute per-author lines changed and commit counts, and surfaces highlights like most active/productive contributors.
|
|
400
|
+
|
|
401
|
+
#### What you get:
|
|
402
|
+
|
|
403
|
+
- Per-author bar visualization and percentages
|
|
404
|
+
- Lines changed and commit counts
|
|
405
|
+
- Highlights: most active and most productive
|
|
406
|
+
|
|
407
|
+
### Git graph (Option 11)
|
|
408
|
+
|
|
409
|
+
Displays a pretty, colorized `git log --graph` with abbrev commit, decorations, author, date, and subject. Press `q` to exit the view.
|
|
410
|
+
|
|
411
|
+
### File Removal (Option 12)
|
|
412
|
+
|
|
413
|
+
The `Remove files/folders (rm)` option lets you select files and folders interactively, with full git integration:
|
|
414
|
+
|
|
415
|
+
#### Features:
|
|
416
|
+
|
|
417
|
+
- **Interactive Multi-select**: Select one or many files to remove
|
|
418
|
+
- **Git Integration**: Tracked files are removed via `git rm -rf`; untracked via `rm -rf`
|
|
419
|
+
- **Safety Confirmation**: Explicit confirmation before deletion
|
|
420
|
+
- **Smart Detection**: Works whether or not a file is tracked in git
|
|
421
|
+
|
|
422
|
+
#### How it works:
|
|
423
|
+
|
|
424
|
+
1. A list of tracked and untracked files is displayed
|
|
425
|
+
2. Use the interactive filter to multi-select entries (TAB to select, ENTER to confirm)
|
|
426
|
+
3. The selection is previewed and you are asked to confirm (y/N)
|
|
427
|
+
4. Each selected item is removed appropriately (git-tracked or filesystem)
|
|
428
|
+
5. A success message lists removed paths
|
|
429
|
+
|
|
430
|
+
### Summon the Architect (Option 13)
|
|
431
|
+
|
|
432
|
+
"The Architect" is a powerful `.gitignore` generator that pulls the latest industry-standard blueprints directly from GitHub's official collection.
|
|
433
|
+
|
|
434
|
+
#### Features:
|
|
435
|
+
|
|
436
|
+
- **70+ Blueprints**: Supports everything from Node, Python, and Rust to Flutter, Unity, and TeX.
|
|
437
|
+
- **Interactive Search**: Use `gum filter` to quickly find your language or framework.
|
|
438
|
+
- **Safety First**: Asks for confirmation before overwriting an existing `.gitignore` file.
|
|
439
|
+
- **Always Up-to-Date**: Fetches directly from the source to ensure you have the latest rules.
|
|
440
|
+
|
|
441
|
+
Usage from CLI: `bimagic -a` or `bimagic --architect`
|
|
442
|
+
|
|
443
|
+
### Merge branches (Option 14)
|
|
444
|
+
|
|
445
|
+
Merge another branch into your current branch using an interactive selector. If conflicts occur, you will be notified to resolve them manually.
|
|
446
|
+
|
|
447
|
+
#### Flow:
|
|
448
|
+
|
|
449
|
+
1. Current branch is shown
|
|
450
|
+
2. Select a branch (other than current) to merge into the current one
|
|
451
|
+
3. If merge succeeds, you get a success message; otherwise, conflicts are reported
|
|
452
|
+
|
|
453
|
+
### Revert commit(s) (Option 16)
|
|
454
|
+
|
|
455
|
+
#### Safety Features:
|
|
456
|
+
|
|
457
|
+
- **Double confirmation** for `*` (everything) - requires typing "yes"
|
|
458
|
+
- **Preview** of what will be deleted before proceeding
|
|
459
|
+
- **Existence check** - only proceeds if files actually exist
|
|
460
|
+
- **Git-aware** - uses `git rm` for tracked files, regular `rm` for untracked files
|
|
461
|
+
Revert one or more commits selected via interactive filter from `git log --oneline`. Each selected commit is reverted in sequence; on conflicts, the process stops and you are instructed to resolve and continue.
|
|
462
|
+
|
|
463
|
+
#### Flow:
|
|
464
|
+
|
|
465
|
+
1. Select commit(s) to revert (multi-select)
|
|
466
|
+
2. Confirm the action (y/N)
|
|
467
|
+
3. Reverts run with `git revert --no-edit`
|
|
468
|
+
4. On conflict, resolve then run `git revert --continue`
|
|
469
|
+
|
|
470
|
+
### Time Turner (Undo)
|
|
471
|
+
|
|
472
|
+
This feature is essentially an "Undo Button" for Git. It allows you to undo the last commit with three levels of severity:
|
|
473
|
+
|
|
474
|
+
#### 1. Soft Undo
|
|
475
|
+
|
|
476
|
+
Cancels the commit but leaves your files **staged**. Best for fixing typos or adding forgotten files.
|
|
477
|
+
|
|
478
|
+
- **Scenario:** You committed "Added login" but forgot `login.css`.
|
|
479
|
+
- **Result:** Files are green (staged), ready to commit again.
|
|
480
|
+
|
|
481
|
+
#### 2. Mixed Undo
|
|
482
|
+
|
|
483
|
+
Cancels the commit and **unstages** the files. Best for when you want to split work into multiple commits.
|
|
484
|
+
|
|
485
|
+
- **Scenario:** You committed backend and frontend work together but want to separate them.
|
|
486
|
+
- **Result:** Files are red (modified), keeping your work but not staged.
|
|
487
|
+
|
|
488
|
+
#### 3. Hard Undo
|
|
489
|
+
|
|
490
|
+
**Destroys** the commit and all changes. Reverts to the previous state.
|
|
491
|
+
|
|
492
|
+
- **Scenario:** You want to trash the last commit completely.
|
|
493
|
+
- **Result:** Everything from that commit is gone forever. **Use with caution!**
|
|
494
|
+
|
|
495
|
+
### Stash operations (Option 16)
|
|
496
|
+
|
|
497
|
+
Manage your git stashes with a comprehensive menu.
|
|
498
|
+
|
|
499
|
+
#### Features:
|
|
500
|
+
|
|
501
|
+
- **Push (Save)**: Stash changes with an optional message and support for untracked files
|
|
502
|
+
- **Pop**: Apply and remove the latest stash
|
|
503
|
+
- **List**: View all saved stashes
|
|
504
|
+
- **Apply**: Apply a specific stash without removing it
|
|
505
|
+
- **Drop**: Delete a specific stash
|
|
506
|
+
- **Clear**: Remove all stashes (with safety confirmation)
|
|
507
|
+
|
|
508
|
+
## Why Sudo Might Be Required
|
|
509
|
+
|
|
510
|
+
### Understanding the Need for Elevated Privileges
|
|
511
|
+
|
|
512
|
+
The installation script may request sudo privileges for these reasons:
|
|
513
|
+
|
|
514
|
+
1. **System-wide installation**:
|
|
515
|
+
- The script tries to install to `/usr/local/bin/` by default
|
|
516
|
+
- This directory is typically owned by root for security reasons
|
|
517
|
+
- Writing to system directories requires administrative privileges
|
|
518
|
+
|
|
519
|
+
2. **Directory permissions**:
|
|
520
|
+
- If you don't have a `~/bin` directory or it's not writable
|
|
521
|
+
- The script falls back to system installation
|
|
522
|
+
|
|
523
|
+
### Avoiding Sudo Requirements
|
|
524
|
+
|
|
525
|
+
You can avoid needing sudo by:
|
|
526
|
+
|
|
527
|
+
1. Creating a local bin directory:
|
|
528
|
+
|
|
529
|
+
```bash
|
|
530
|
+
mkdir -p ~/bin
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
2. Ensuring it's in your PATH (add to ~/.bashrc or ~/.zshrc):
|
|
534
|
+
|
|
535
|
+
```bash
|
|
536
|
+
export PATH="$HOME/bin:$PATH"
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
3. Running the installation again
|
|
540
|
+
|
|
541
|
+
## Security Considerations
|
|
542
|
+
|
|
543
|
+
1. **Token Security**:
|
|
544
|
+
- Your GitHub token is stored in your shell configuration file
|
|
545
|
+
- Protect this file with proper permissions (chmod 600)
|
|
546
|
+
- Never share your token or commit it to version control
|
|
547
|
+
|
|
548
|
+
2. **Script Integrity**:
|
|
549
|
+
- Review the installation script before running it
|
|
550
|
+
- The script only copies files and sets permissions
|
|
551
|
+
|
|
552
|
+
3. **Network Security**:
|
|
553
|
+
- The script uses HTTPS to communicate with GitHub
|
|
554
|
+
- Ensure you're on a secure network when using the tool
|
|
555
|
+
|
|
556
|
+
## Troubleshooting
|
|
557
|
+
|
|
558
|
+
### Common Issues
|
|
559
|
+
|
|
560
|
+
1. **"Command not found" after installation**
|
|
561
|
+
- Your bin directory may not be in PATH
|
|
562
|
+
- Add `export PATH="$HOME/bin:$PATH"` to your shell config file
|
|
563
|
+
- Run `source ~/.bashrc` or `source ~/.zshrc`
|
|
564
|
+
|
|
565
|
+
2. **Permission denied errors**
|
|
566
|
+
- The script might not be executable
|
|
567
|
+
- Run `chmod +x ~/bin/bimagic` or `sudo chmod +x /usr/local/bin/bimagic`
|
|
568
|
+
|
|
569
|
+
3. **GitHub authentication errors**
|
|
570
|
+
- Verify your GITHUB_USER and GITHUB_TOKEN environment variables are set correctly
|
|
571
|
+
- Ensure your token has the necessary permissions
|
|
572
|
+
|
|
573
|
+
4. **Remote operation failures**
|
|
574
|
+
- Check your internet connection
|
|
575
|
+
- Verify the repository name is correct
|
|
576
|
+
|
|
577
|
+
### Getting Help
|
|
578
|
+
|
|
579
|
+
If you encounter issues:
|
|
580
|
+
|
|
581
|
+
1. Check that Git is installed: `git --version`
|
|
582
|
+
2. Verify your environment variables are set: `echo $GITHUB_USER`
|
|
583
|
+
3. Ensure you have a GitHub personal access token with repo permissions
|
|
584
|
+
|
|
585
|
+
## Uninstallation
|
|
586
|
+
|
|
587
|
+
If you ever need to remove Bimagic from your system, you have two options:
|
|
588
|
+
|
|
589
|
+
### Option 1: Curl Directly (Recommended)
|
|
590
|
+
|
|
591
|
+
Run the uninstall script directly from GitHub:
|
|
592
|
+
|
|
593
|
+
```bash
|
|
594
|
+
curl -sSL https://raw.githubusercontent.com/Bimbok/bimagic/main/uninstall.sh | bash
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
### Option 2: Manual Uninstallation
|
|
598
|
+
|
|
599
|
+
1. Remove the Bimagic script:
|
|
600
|
+
|
|
601
|
+
```bash
|
|
602
|
+
# Remove from user directory (if installed there)
|
|
603
|
+
rm -f ~/bin/bimagic
|
|
604
|
+
|
|
605
|
+
# Remove from system directory (if installed there - requires sudo)
|
|
606
|
+
sudo rm -f /usr/local/bin/bimagic
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
2. Optional: Remove GitHub credentials from your shell configuration:
|
|
610
|
+
|
|
611
|
+
````bash
|
|
612
|
+
# Edit your shell config file (e.g., ~/.bashrc, ~/.zshrc)
|
|
613
|
+
# Remove lines containing GITHUB_USER and GITHUB_TOKEN
|
|
614
|
+
nano ~/.bashrc # or ~/.zshrc
|
|
615
|
+
```### What the Uninstall Script Does
|
|
616
|
+
|
|
617
|
+
````
|
|
618
|
+
|
|
619
|
+
3. **Finds Installations**: Checks common installation directories (~/bin and /usr/local/bin)
|
|
620
|
+
4. **Confirmation**: Asks for confirmation before proceeding
|
|
621
|
+
5. **Removes Bimagic**: Deletes the script and `wz` alias from all found locations
|
|
622
|
+
6. **Cleans Shell Config**: Offers to remove **GITHUB_USER**, **GITHUB_TOKEN**, and the **Ctrl + B** shell integrations from your config files
|
|
623
|
+
7. **Creates Backups**: Creates timestamped backups of modified shell configuration files
|
|
624
|
+
|
|
625
|
+
### Safety Features
|
|
626
|
+
|
|
627
|
+
- Asks for confirmation before removing anything
|
|
628
|
+
- Creates backups of modified configuration files
|
|
629
|
+
- Uses sudo only when necessary (for system directories)
|
|
630
|
+
- Provides clear feedback about what's happening
|
|
631
|
+
- Includes timestamped backups to prevent data loss
|
|
632
|
+
|
|
633
|
+
### Notes
|
|
634
|
+
|
|
635
|
+
- The uninstall script will only remove the Bimagic script file
|
|
636
|
+
- Your Git repositories and other files will not be affected
|
|
637
|
+
- GitHub credentials are only removed if you explicitly choose to do so
|
|
638
|
+
- Backups are created before modifying any configuration files
|
|
639
|
+
|
|
640
|
+
Remember to update your repository with both the `uninstall.sh` script and the updated README section.
|
|
641
|
+
|
|
642
|
+
## Contributing
|
|
643
|
+
|
|
644
|
+
Contributions to Bimagic are welcome! Please feel free to submit pull requests or open issues for bugs and feature requests.
|
|
645
|
+
|
|
646
|
+
## License
|
|
647
|
+
|
|
648
|
+
This project is open source and available under the MIT License.
|
|
649
|
+
|
|
650
|
+
## Disclaimer
|
|
651
|
+
|
|
652
|
+
This tool is provided as-is without any warranties. Use it at your own risk. Always ensure you have backups of important repositories before performing operations with this tool.
|
|
653
|
+
|
|
654
|
+
---
|
|
655
|
+
|
|
656
|
+
**Enjoy the magical Git experience!** ✨
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported Versions
|
|
4
|
+
|
|
5
|
+
We are currently supporting the following versions with security updates. We recommend all users stay on the latest stable release.
|
|
6
|
+
|
|
7
|
+
| Version | Supported |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| 1.0.x | :white_check_mark: |
|
|
10
|
+
| < 1.0 | :x: |
|
|
11
|
+
|
|
12
|
+
## Reporting a Vulnerability
|
|
13
|
+
|
|
14
|
+
If you discover a security vulnerability within Bimagic, please do not use the public GitHub issue tracker. Instead, follow these steps:
|
|
15
|
+
|
|
16
|
+
1. **Email the Maintainers**: Send a detailed report to the email associated with the **Bimbok** or **adityapaul26** GitHub profiles.
|
|
17
|
+
2. **Provide Details**: Include a description of the vulnerability, steps to reproduce the issue, and the potential impact.
|
|
18
|
+
3. **Response Time**: You can expect an acknowledgment of your report within 48–72 hours.
|
|
19
|
+
4. **Public Disclosure**: We ask that you do not disclose the vulnerability publicly until we have had the opportunity to analyze and fix the issue to protect our users.
|
|
20
|
+
|
|
21
|
+
## Security Best Practices for Bimagic
|
|
22
|
+
|
|
23
|
+
* **Token Safety**: Your `GITHUB_TOKEN` is stored in your shell configuration (e.g., `.bashrc` or `.zshrc`). Ensure these files are not readable by other users on your system (run `chmod 600 ~/.bashrc`).
|
|
24
|
+
* **Dependencies**: Bimagic relies on `gum` for its interface. Always ensure your system's package manager is up to date to receive security patches for dependencies.
|
|
25
|
+
* **Sudo Usage**: The installation script only requires `sudo` if installing to system-wide directories like `/usr/local/bin`. For maximum security, consider installing to `~/bin` to avoid using elevated privileges.
|