bimagic 1.4.3 → 1.4.5
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/README.md +9 -2
- package/bimagic +116 -21
- package/package.json +35 -35
package/README.md
CHANGED
|
@@ -26,6 +26,8 @@ Bimagic is an interactive command-line tool that streamlines common Git operatio
|
|
|
26
26
|
- 🔐 Secure GitHub authentication via personal access tokens
|
|
27
27
|
- 📦 Easy repository initialization and setup
|
|
28
28
|
- 📥 Clone repositories (Standard or Interactive selection)
|
|
29
|
+
- 📊 Dynamic themed progress bar for cloning
|
|
30
|
+
- 🗜️ Shallow clone support (--depth)
|
|
29
31
|
- 🔄 Simplified push/pull operations
|
|
30
32
|
- 🌿 Branch management made easy
|
|
31
33
|
- 📊 Status dashboard (ahead/behind, branch, clean/uncommitted/conflicts)
|
|
@@ -309,6 +311,10 @@ You can also use flags to perform specific actions immediately:
|
|
|
309
311
|
```bash
|
|
310
312
|
bimagic -d "repo-url"
|
|
311
313
|
```
|
|
314
|
+
- **Shallow Clone**:
|
|
315
|
+
```bash
|
|
316
|
+
bimagic -d "repo-url" --depth 1
|
|
317
|
+
```
|
|
312
318
|
- **Interactive Clone** (Select specific files/folders to download):
|
|
313
319
|
```bash
|
|
314
320
|
bimagic -d -i "repo-url"
|
|
@@ -367,11 +373,12 @@ At the top of the interface, a status box summarizes:
|
|
|
367
373
|
|
|
368
374
|
### Clone repository (Option 1)
|
|
369
375
|
|
|
370
|
-
This feature allows you to clone a repository with two modes:
|
|
376
|
+
This feature allows you to clone a repository with two modes, both featuring a **themed progress bar** to show real-time download status:
|
|
371
377
|
|
|
372
378
|
#### Standard Clone
|
|
373
379
|
|
|
374
|
-
Perform a full `git clone` of the target repository.
|
|
380
|
+
Perform a full or shallow `git clone` of the target repository.
|
|
381
|
+
- Usage from CLI: `bimagic -d "repo-url" [--depth <number>]`
|
|
375
382
|
|
|
376
383
|
#### Interactive Clone (Sparse Checkout)
|
|
377
384
|
|
package/bimagic
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
|
|
3
|
-
VERSION="v1.4.
|
|
3
|
+
VERSION="v1.4.5"
|
|
4
4
|
|
|
5
5
|
if [[ "$1" == "--version" || "$1" == "-v" ]]; then
|
|
6
6
|
echo "Bimagic Git Wizard $VERSION"
|
|
@@ -52,7 +52,24 @@ YELLOW=$(get_ansi_esc "$BIMAGIC_WARNING")
|
|
|
52
52
|
BLUE=$(get_ansi_esc "$BIMAGIC_SECONDARY")
|
|
53
53
|
PURPLE=$(get_ansi_esc "$BIMAGIC_PRIMARY")
|
|
54
54
|
CYAN=$(get_ansi_esc "$BIMAGIC_INFO")
|
|
55
|
-
|
|
55
|
+
GRAY=$(get_ansi_esc "$BIMAGIC_MUTED")
|
|
56
|
+
NC=$(echo -e "\033[0m") # No Color
|
|
57
|
+
|
|
58
|
+
# Function to draw a progress bar
|
|
59
|
+
draw_progress_bar() {
|
|
60
|
+
local label=$1
|
|
61
|
+
local percent=$2
|
|
62
|
+
local width=30
|
|
63
|
+
local filled=$((percent * width / 100))
|
|
64
|
+
local empty=$((width - filled))
|
|
65
|
+
|
|
66
|
+
local bar=""
|
|
67
|
+
for ((i = 0; i < filled; i++)); do bar+="█"; done
|
|
68
|
+
local bg=""
|
|
69
|
+
for ((i = 0; i < empty; i++)); do bg+="░"; done
|
|
70
|
+
|
|
71
|
+
printf "\r\e[K${CYAN}%-20s${NC} [${PURPLE}%s${NC}${GRAY}%s${NC}] ${YELLOW}%3d%%${NC}" "$label" "$bar" "$bg" "$percent"
|
|
72
|
+
}
|
|
56
73
|
|
|
57
74
|
# Ensure gum is installed
|
|
58
75
|
if ! command -v gum &>/dev/null; then
|
|
@@ -229,15 +246,39 @@ STATUS: $status"
|
|
|
229
246
|
|
|
230
247
|
generate_bar() {
|
|
231
248
|
local percentage=$1
|
|
232
|
-
local
|
|
249
|
+
local width=20
|
|
250
|
+
|
|
233
251
|
# Convert float to integer for bar calculation
|
|
234
252
|
local int_percentage=${percentage%.*}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
253
|
+
# Safety check for integer conversion
|
|
254
|
+
if [[ ! "$int_percentage" =~ ^[0-9]+$ ]]; then int_percentage=0; fi
|
|
255
|
+
[[ $int_percentage -gt 100 ]] && int_percentage=100
|
|
256
|
+
|
|
257
|
+
local filled=$((int_percentage * width / 100))
|
|
258
|
+
local empty=$((width - filled))
|
|
259
|
+
|
|
260
|
+
# Pre-get theme colors for the gradient
|
|
261
|
+
local c1=$(get_ansi_esc "$BANNER_COLOR_1")
|
|
262
|
+
local c2=$(get_ansi_esc "$BANNER_COLOR_2")
|
|
263
|
+
local c3=$(get_ansi_esc "$BANNER_COLOR_3")
|
|
264
|
+
local c4=$(get_ansi_esc "$BANNER_COLOR_4")
|
|
265
|
+
local c5=$(get_ansi_esc "$BANNER_COLOR_5")
|
|
266
|
+
local colors=("$c1" "$c2" "$c3" "$c4" "$c5")
|
|
267
|
+
local gray=$(get_ansi_esc "$BIMAGIC_MUTED")
|
|
268
|
+
|
|
269
|
+
local bar="${gray}[${NC}"
|
|
270
|
+
for ((i = 0; i < filled; i++)); do
|
|
271
|
+
local color_idx=$(( i * 5 / width ))
|
|
272
|
+
bar+="${colors[$color_idx]}█"
|
|
273
|
+
done
|
|
274
|
+
|
|
275
|
+
bar+="$gray"
|
|
276
|
+
for ((i = 0; i < empty; i++)); do
|
|
277
|
+
bar+="░"
|
|
239
278
|
done
|
|
240
|
-
|
|
279
|
+
bar+="]${NC}"
|
|
280
|
+
|
|
281
|
+
echo -e "$bar"
|
|
241
282
|
}
|
|
242
283
|
|
|
243
284
|
# Function to get contributor statistics
|
|
@@ -346,10 +387,11 @@ show_contributor_stats() {
|
|
|
346
387
|
# Clean up author name
|
|
347
388
|
author=$(echo "$author" | sed 's/^ *//;s/ *$//')
|
|
348
389
|
|
|
349
|
-
# Generate bar
|
|
390
|
+
# Generate themed bar
|
|
350
391
|
local bar=$(generate_bar "$percentage")
|
|
351
392
|
|
|
352
|
-
|
|
393
|
+
# Display entry with theme colors
|
|
394
|
+
printf "${BLUE}%-15s${NC} %s ${YELLOW}%5.1f%%${NC} (${CYAN}%d lines${NC})\n" \
|
|
353
395
|
"$author" "$bar" "$percentage" "$lines"
|
|
354
396
|
|
|
355
397
|
# Track most active (most commits)
|
|
@@ -372,20 +414,21 @@ show_contributor_stats() {
|
|
|
372
414
|
echo
|
|
373
415
|
echo -e "${CYAN}Highlights:${NC}"
|
|
374
416
|
if [[ -n "$most_active_author" ]]; then
|
|
375
|
-
echo -e "${BLUE}Most Active:${NC} $most_active_author ($most_commits commits)"
|
|
417
|
+
echo -e "${BLUE}Most Active:${NC} ${PURPLE}$most_active_author${NC} (${YELLOW}$most_commits commits${NC})"
|
|
376
418
|
fi
|
|
377
419
|
if [[ -n "$most_productive_author" ]]; then
|
|
378
|
-
echo -e "${BLUE}Most Productive:${NC} $most_productive_author ($highest_avg lines/commit)"
|
|
420
|
+
echo -e "${BLUE}Most Productive:${NC} ${PURPLE}$most_productive_author${NC} (${YELLOW}$highest_avg lines/commit${NC})"
|
|
379
421
|
fi
|
|
380
422
|
|
|
381
423
|
local total_contributors=$(echo "$stats" | wc -l)
|
|
382
|
-
echo -e "${BLUE}Total Contributors:${NC} $total_contributors"
|
|
424
|
+
echo -e "${BLUE}Total Contributors:${NC} ${YELLOW}$total_contributors${NC}"
|
|
383
425
|
}
|
|
384
426
|
|
|
385
427
|
# Function to clone a repository (Standard or Interactive)
|
|
386
428
|
clone_repo() {
|
|
387
429
|
local url=$1
|
|
388
430
|
local interactive=$2
|
|
431
|
+
local depth=$3
|
|
389
432
|
|
|
390
433
|
# Extract repo name from URL (basename, remove .git)
|
|
391
434
|
local repo_name=$(basename "$url" .git)
|
|
@@ -395,11 +438,30 @@ clone_repo() {
|
|
|
395
438
|
return 1
|
|
396
439
|
fi
|
|
397
440
|
|
|
441
|
+
local depth_arg=""
|
|
442
|
+
if [[ -n "$depth" ]]; then
|
|
443
|
+
depth_arg="--depth $depth"
|
|
444
|
+
fi
|
|
445
|
+
|
|
398
446
|
if [[ "$interactive" == "true" ]]; then
|
|
399
447
|
print_status "Initializing interactive clone for $repo_name..."
|
|
400
448
|
|
|
401
449
|
# 1. Clone with --no-checkout and --filter=blob:none (downloads commits/trees, no file contents)
|
|
402
|
-
|
|
450
|
+
print_status "Cloning structure for $repo_name..."
|
|
451
|
+
(
|
|
452
|
+
set -o pipefail
|
|
453
|
+
git clone --progress --filter=blob:none --no-checkout $depth_arg "$url" "$repo_name" 2>&1 | while read -r -d $'\r' line; do
|
|
454
|
+
if [[ $line =~ Receiving\ objects:\ +([0-9]+)% ]]; then
|
|
455
|
+
draw_progress_bar "Receiving Structure" "${BASH_REMATCH[1]}"
|
|
456
|
+
elif [[ $line =~ Resolving\ deltas:\ +([0-9]+)% ]]; then
|
|
457
|
+
draw_progress_bar "Resolving Deltas" "${BASH_REMATCH[1]}"
|
|
458
|
+
fi
|
|
459
|
+
done
|
|
460
|
+
)
|
|
461
|
+
local status=$?
|
|
462
|
+
echo ""
|
|
463
|
+
|
|
464
|
+
if [[ $status -ne 0 || ! -d "$repo_name" ]]; then
|
|
403
465
|
print_error "Clone failed."
|
|
404
466
|
return 1
|
|
405
467
|
fi
|
|
@@ -432,14 +494,39 @@ clone_repo() {
|
|
|
432
494
|
# If the list is huge, this might fail on command line length.
|
|
433
495
|
# Ideally we pipe to 'git sparse-checkout set --stdin', but gum returns newline separated.
|
|
434
496
|
|
|
435
|
-
|
|
497
|
+
print_status "Downloading selected files..."
|
|
498
|
+
(
|
|
499
|
+
set -o pipefail
|
|
500
|
+
git checkout --progress HEAD 2>&1 | while read -r -d $'\r' line; do
|
|
501
|
+
if [[ $line =~ Updating\ files:\ +([0-9]+)% ]]; then
|
|
502
|
+
draw_progress_bar "Updating Files" "${BASH_REMATCH[1]}"
|
|
503
|
+
fi
|
|
504
|
+
done
|
|
505
|
+
)
|
|
506
|
+
echo ""
|
|
436
507
|
|
|
437
508
|
popd >/dev/null
|
|
438
509
|
print_status "Successfully cloned selected files into '$repo_name'!"
|
|
439
510
|
|
|
440
511
|
else
|
|
441
|
-
# Standard clone
|
|
442
|
-
|
|
512
|
+
# Standard clone with progress bar
|
|
513
|
+
print_status "Cloning $url into $repo_name..."
|
|
514
|
+
|
|
515
|
+
# Use a subshell with pipefail to catch git clone errors
|
|
516
|
+
(
|
|
517
|
+
set -o pipefail
|
|
518
|
+
git clone --progress $depth_arg "$url" "$repo_name" 2>&1 | while read -r -d $'\r' line; do
|
|
519
|
+
if [[ $line =~ Receiving\ objects:\ +([0-9]+)% ]]; then
|
|
520
|
+
draw_progress_bar "Receiving Objects" "${BASH_REMATCH[1]}"
|
|
521
|
+
elif [[ $line =~ Resolving\ deltas:\ +([0-9]+)% ]]; then
|
|
522
|
+
draw_progress_bar "Resolving Deltas" "${BASH_REMATCH[1]}"
|
|
523
|
+
fi
|
|
524
|
+
done
|
|
525
|
+
)
|
|
526
|
+
local status=$?
|
|
527
|
+
echo "" # New line after progress bar
|
|
528
|
+
|
|
529
|
+
if [[ $status -eq 0 && -d "$repo_name" ]]; then
|
|
443
530
|
print_status "Successfully cloned '$url' into '$repo_name'!"
|
|
444
531
|
else
|
|
445
532
|
print_error "Clone failed."
|
|
@@ -593,6 +680,7 @@ CLI_MODE=""
|
|
|
593
680
|
CLI_URL=""
|
|
594
681
|
CLI_MSG=""
|
|
595
682
|
CLI_INTERACTIVE="false"
|
|
683
|
+
CLI_DEPTH=""
|
|
596
684
|
|
|
597
685
|
# Preserve args in a loop
|
|
598
686
|
while [[ $# -gt 0 ]]; do
|
|
@@ -601,6 +689,10 @@ while [[ $# -gt 0 ]]; do
|
|
|
601
689
|
CLI_MODE="clone"
|
|
602
690
|
shift
|
|
603
691
|
;;
|
|
692
|
+
--depth)
|
|
693
|
+
CLI_DEPTH="$2"
|
|
694
|
+
shift 2
|
|
695
|
+
;;
|
|
604
696
|
-i)
|
|
605
697
|
CLI_INTERACTIVE="true"
|
|
606
698
|
shift
|
|
@@ -644,10 +736,11 @@ if [[ "$CLI_MODE" == "clone" ]]; then
|
|
|
644
736
|
print_error "Error: Repository URL required with -d"
|
|
645
737
|
exit 1
|
|
646
738
|
fi
|
|
647
|
-
clone_repo "$CLI_URL" "$CLI_INTERACTIVE"
|
|
648
|
-
exit
|
|
739
|
+
clone_repo "$CLI_URL" "$CLI_INTERACTIVE" "$CLI_DEPTH"
|
|
740
|
+
exit 0
|
|
649
741
|
fi
|
|
650
742
|
|
|
743
|
+
|
|
651
744
|
if [[ "$CLI_MODE" == "status" ]]; then
|
|
652
745
|
show_repo_status
|
|
653
746
|
exit 0
|
|
@@ -849,12 +942,14 @@ while true; do
|
|
|
849
942
|
repo_url=$(gum input --placeholder "Enter repository URL")
|
|
850
943
|
if [[ -z "$repo_url" ]]; then continue; fi
|
|
851
944
|
|
|
945
|
+
repo_depth=$(gum input --placeholder "Enter depth (empty for full clone)")
|
|
946
|
+
|
|
852
947
|
clone_mode=$(gum choose "Standard Clone" "Interactive (Select files)")
|
|
853
948
|
|
|
854
949
|
if [[ "$clone_mode" == "Interactive (Select files)" ]]; then
|
|
855
|
-
clone_repo "$repo_url" "true"
|
|
950
|
+
clone_repo "$repo_url" "true" "$repo_depth"
|
|
856
951
|
else
|
|
857
|
-
clone_repo "$repo_url" "false"
|
|
952
|
+
clone_repo "$repo_url" "false" "$repo_depth"
|
|
858
953
|
fi
|
|
859
954
|
;;
|
|
860
955
|
" Stash operations")
|
package/package.json
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
2
|
+
"name": "bimagic",
|
|
3
|
+
"version": "1.4.5",
|
|
4
|
+
"description": "A powerful Bash-based Git automation tool that simplifies your GitHub workflow.",
|
|
5
|
+
"bin": {
|
|
6
|
+
"bimagic": "./bimagic",
|
|
7
|
+
"wz": "./bimagic"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test": "echo \"No tests specified\""
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/orion-kernel/bimagic.git"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"git",
|
|
18
|
+
"cli",
|
|
19
|
+
"automation",
|
|
20
|
+
"bash",
|
|
21
|
+
"tui",
|
|
22
|
+
"gum"
|
|
23
|
+
],
|
|
24
|
+
"author": "Bimbok",
|
|
25
|
+
"contributors": [
|
|
26
|
+
"Bimbok",
|
|
27
|
+
"Aditya Paul (adityapaul26)"
|
|
28
|
+
],
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/orion-kernel/bimagic/issues"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://github.com/orion-kernel/bimagic#readme",
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"bimagic": "^1.4.4"
|
|
36
|
+
}
|
|
37
37
|
}
|