gitgrip 0.3.1 → 0.4.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/README.md +44 -0
- package/assets/griptree-concept.svg +118 -0
- package/assets/griptree-workflow.svg +79 -0
- package/dist/commands/commit.d.ts +1 -0
- package/dist/commands/commit.d.ts.map +1 -1
- package/dist/commands/commit.js +19 -17
- package/dist/commands/commit.js.map +1 -1
- package/dist/commands/griptree.d.ts +27 -0
- package/dist/commands/griptree.d.ts.map +1 -0
- package/dist/commands/griptree.js +369 -0
- package/dist/commands/griptree.js.map +1 -0
- package/dist/commands/push.d.ts +1 -0
- package/dist/commands/push.d.ts.map +1 -1
- package/dist/commands/push.js +27 -21
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +11 -10
- package/dist/commands/sync.js.map +1 -1
- package/dist/index.js +61 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/git.d.ts +30 -1
- package/dist/lib/git.d.ts.map +1 -1
- package/dist/lib/git.js +50 -0
- package/dist/lib/git.js.map +1 -1
- package/dist/types.d.ts +26 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -118,6 +118,9 @@ gr sync
|
|
|
118
118
|
| `gr pr merge` | Merge all linked PRs |
|
|
119
119
|
| `gr repo add <url>` | Add a new repository to workspace |
|
|
120
120
|
| `gr forall -c "cmd"` | Run command in each repo |
|
|
121
|
+
| `gr griptree add <branch>` | Create a worktree-based workspace |
|
|
122
|
+
| `gr griptree list` | List all griptrees |
|
|
123
|
+
| `gr griptree remove <branch>` | Remove a griptree |
|
|
121
124
|
|
|
122
125
|
### Command Details
|
|
123
126
|
|
|
@@ -294,6 +297,47 @@ repos:
|
|
|
294
297
|
baseUrl: https://gitlab.company.com
|
|
295
298
|
```
|
|
296
299
|
|
|
300
|
+
## Griptrees (Multi-Branch Workspaces)
|
|
301
|
+
|
|
302
|
+
Work on multiple branches simultaneously without switching. Griptrees use git worktrees to create parallel workspace directories.
|
|
303
|
+
|
|
304
|
+
<p align="center">
|
|
305
|
+
<img src="assets/griptree-concept.svg" alt="Griptrees Concept" width="700">
|
|
306
|
+
</p>
|
|
307
|
+
|
|
308
|
+
```bash
|
|
309
|
+
# Create a griptree for a feature branch
|
|
310
|
+
gr griptree add feat/new-feature
|
|
311
|
+
|
|
312
|
+
# Creates a sibling directory with all repos on that branch:
|
|
313
|
+
# ../feat-new-feature/
|
|
314
|
+
# ├── frontend/
|
|
315
|
+
# ├── backend/
|
|
316
|
+
# └── shared/
|
|
317
|
+
|
|
318
|
+
# Work in the griptree
|
|
319
|
+
cd ../feat-new-feature
|
|
320
|
+
gr status
|
|
321
|
+
|
|
322
|
+
# List all griptrees
|
|
323
|
+
gr griptree list
|
|
324
|
+
|
|
325
|
+
# Lock to prevent accidental removal
|
|
326
|
+
gr griptree lock feat/new-feature
|
|
327
|
+
|
|
328
|
+
# Remove when done (branches are preserved)
|
|
329
|
+
gr griptree remove feat/new-feature
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
<p align="center">
|
|
333
|
+
<img src="assets/griptree-workflow.svg" alt="Griptree Workflow" width="700">
|
|
334
|
+
</p>
|
|
335
|
+
|
|
336
|
+
**Benefits:**
|
|
337
|
+
- No branch switching required
|
|
338
|
+
- Shared git objects (fast creation, minimal disk usage)
|
|
339
|
+
- Independent working directories
|
|
340
|
+
|
|
297
341
|
## Shorthand
|
|
298
342
|
|
|
299
343
|
Use `gr` as the primary command:
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 500">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="mainGrad" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
4
|
+
<stop offset="0%" style="stop-color:#10B981;stop-opacity:1" />
|
|
5
|
+
<stop offset="100%" style="stop-color:#059669;stop-opacity:1" />
|
|
6
|
+
</linearGradient>
|
|
7
|
+
<linearGradient id="treeGrad" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
8
|
+
<stop offset="0%" style="stop-color:#3B82F6;stop-opacity:1" />
|
|
9
|
+
<stop offset="100%" style="stop-color:#1D4ED8;stop-opacity:1" />
|
|
10
|
+
</linearGradient>
|
|
11
|
+
<linearGradient id="repoGrad" x1="0%" y1="0%" x2="0%" y2="100%">
|
|
12
|
+
<stop offset="0%" style="stop-color:#374151;stop-opacity:1" />
|
|
13
|
+
<stop offset="100%" style="stop-color:#1F2937;stop-opacity:1" />
|
|
14
|
+
</linearGradient>
|
|
15
|
+
<filter id="shadow" x="-20%" y="-20%" width="140%" height="140%">
|
|
16
|
+
<feDropShadow dx="2" dy="4" stdDeviation="4" flood-opacity="0.2"/>
|
|
17
|
+
</filter>
|
|
18
|
+
</defs>
|
|
19
|
+
|
|
20
|
+
<!-- Background -->
|
|
21
|
+
<rect width="800" height="500" fill="#0F172A"/>
|
|
22
|
+
|
|
23
|
+
<!-- Title -->
|
|
24
|
+
<text x="400" y="45" font-family="system-ui, -apple-system, sans-serif" font-size="28" font-weight="bold" fill="#F8FAFC" text-anchor="middle">Griptrees: Multi-Branch Workspaces</text>
|
|
25
|
+
<text x="400" y="75" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#94A3B8" text-anchor="middle">Work on multiple features simultaneously without switching branches</text>
|
|
26
|
+
|
|
27
|
+
<!-- Main Workspace Box -->
|
|
28
|
+
<g transform="translate(50, 110)">
|
|
29
|
+
<rect x="0" y="0" width="220" height="280" rx="12" fill="url(#mainGrad)" filter="url(#shadow)"/>
|
|
30
|
+
<text x="110" y="30" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="white" text-anchor="middle">Main Workspace</text>
|
|
31
|
+
<text x="110" y="50" font-family="monospace" font-size="12" fill="#D1FAE5" text-anchor="middle">branch: main</text>
|
|
32
|
+
|
|
33
|
+
<!-- Repos in main -->
|
|
34
|
+
<g transform="translate(20, 70)">
|
|
35
|
+
<rect x="0" y="0" width="180" height="45" rx="6" fill="url(#repoGrad)"/>
|
|
36
|
+
<text x="15" y="20" font-family="monospace" font-size="11" fill="#10B981">frontend/</text>
|
|
37
|
+
<text x="15" y="35" font-family="monospace" font-size="10" fill="#6B7280">.git/objects (shared)</text>
|
|
38
|
+
</g>
|
|
39
|
+
<g transform="translate(20, 125)">
|
|
40
|
+
<rect x="0" y="0" width="180" height="45" rx="6" fill="url(#repoGrad)"/>
|
|
41
|
+
<text x="15" y="20" font-family="monospace" font-size="11" fill="#10B981">backend/</text>
|
|
42
|
+
<text x="15" y="35" font-family="monospace" font-size="10" fill="#6B7280">.git/objects (shared)</text>
|
|
43
|
+
</g>
|
|
44
|
+
<g transform="translate(20, 180)">
|
|
45
|
+
<rect x="0" y="0" width="180" height="45" rx="6" fill="url(#repoGrad)"/>
|
|
46
|
+
<text x="15" y="20" font-family="monospace" font-size="11" fill="#10B981">shared/</text>
|
|
47
|
+
<text x="15" y="35" font-family="monospace" font-size="10" fill="#6B7280">.git/objects (shared)</text>
|
|
48
|
+
</g>
|
|
49
|
+
</g>
|
|
50
|
+
|
|
51
|
+
<!-- Griptree 1 -->
|
|
52
|
+
<g transform="translate(290, 110)">
|
|
53
|
+
<rect x="0" y="0" width="220" height="280" rx="12" fill="url(#treeGrad)" filter="url(#shadow)"/>
|
|
54
|
+
<text x="110" y="30" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="white" text-anchor="middle">Griptree: feat/auth</text>
|
|
55
|
+
<text x="110" y="50" font-family="monospace" font-size="12" fill="#BFDBFE" text-anchor="middle">branch: feat/auth</text>
|
|
56
|
+
|
|
57
|
+
<!-- Repos as worktrees -->
|
|
58
|
+
<g transform="translate(20, 70)">
|
|
59
|
+
<rect x="0" y="0" width="180" height="45" rx="6" fill="url(#repoGrad)"/>
|
|
60
|
+
<text x="15" y="20" font-family="monospace" font-size="11" fill="#60A5FA">frontend/</text>
|
|
61
|
+
<text x="15" y="35" font-family="monospace" font-size="10" fill="#6B7280">worktree (instant)</text>
|
|
62
|
+
</g>
|
|
63
|
+
<g transform="translate(20, 125)">
|
|
64
|
+
<rect x="0" y="0" width="180" height="45" rx="6" fill="url(#repoGrad)"/>
|
|
65
|
+
<text x="15" y="20" font-family="monospace" font-size="11" fill="#60A5FA">backend/</text>
|
|
66
|
+
<text x="15" y="35" font-family="monospace" font-size="10" fill="#6B7280">worktree (instant)</text>
|
|
67
|
+
</g>
|
|
68
|
+
<g transform="translate(20, 180)">
|
|
69
|
+
<rect x="0" y="0" width="180" height="45" rx="6" fill="url(#repoGrad)"/>
|
|
70
|
+
<text x="15" y="20" font-family="monospace" font-size="11" fill="#60A5FA">shared/</text>
|
|
71
|
+
<text x="15" y="35" font-family="monospace" font-size="10" fill="#6B7280">worktree (instant)</text>
|
|
72
|
+
</g>
|
|
73
|
+
</g>
|
|
74
|
+
|
|
75
|
+
<!-- Griptree 2 -->
|
|
76
|
+
<g transform="translate(530, 110)">
|
|
77
|
+
<rect x="0" y="0" width="220" height="280" rx="12" fill="url(#treeGrad)" filter="url(#shadow)"/>
|
|
78
|
+
<text x="110" y="30" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="white" text-anchor="middle">Griptree: feat/api</text>
|
|
79
|
+
<text x="110" y="50" font-family="monospace" font-size="12" fill="#BFDBFE" text-anchor="middle">branch: feat/api</text>
|
|
80
|
+
|
|
81
|
+
<!-- Repos as worktrees -->
|
|
82
|
+
<g transform="translate(20, 70)">
|
|
83
|
+
<rect x="0" y="0" width="180" height="45" rx="6" fill="url(#repoGrad)"/>
|
|
84
|
+
<text x="15" y="20" font-family="monospace" font-size="11" fill="#60A5FA">frontend/</text>
|
|
85
|
+
<text x="15" y="35" font-family="monospace" font-size="10" fill="#6B7280">worktree (instant)</text>
|
|
86
|
+
</g>
|
|
87
|
+
<g transform="translate(20, 125)">
|
|
88
|
+
<rect x="0" y="0" width="180" height="45" rx="6" fill="url(#repoGrad)"/>
|
|
89
|
+
<text x="15" y="20" font-family="monospace" font-size="11" fill="#60A5FA">backend/</text>
|
|
90
|
+
<text x="15" y="35" font-family="monospace" font-size="10" fill="#6B7280">worktree (instant)</text>
|
|
91
|
+
</g>
|
|
92
|
+
<g transform="translate(20, 180)">
|
|
93
|
+
<rect x="0" y="0" width="180" height="45" rx="6" fill="url(#repoGrad)"/>
|
|
94
|
+
<text x="15" y="20" font-family="monospace" font-size="11" fill="#60A5FA">shared/</text>
|
|
95
|
+
<text x="15" y="35" font-family="monospace" font-size="10" fill="#6B7280">worktree (instant)</text>
|
|
96
|
+
</g>
|
|
97
|
+
</g>
|
|
98
|
+
|
|
99
|
+
<!-- Connecting arrows showing shared objects -->
|
|
100
|
+
<defs>
|
|
101
|
+
<marker id="arrowhead" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">
|
|
102
|
+
<polygon points="0 0, 10 3.5, 0 7" fill="#10B981"/>
|
|
103
|
+
</marker>
|
|
104
|
+
</defs>
|
|
105
|
+
|
|
106
|
+
<!-- Curved lines from main to griptrees -->
|
|
107
|
+
<path d="M 270 250 Q 280 200 290 250" stroke="#10B981" stroke-width="2" fill="none" stroke-dasharray="5,5"/>
|
|
108
|
+
<path d="M 270 250 Q 400 150 530 250" stroke="#10B981" stroke-width="2" fill="none" stroke-dasharray="5,5"/>
|
|
109
|
+
|
|
110
|
+
<!-- Legend -->
|
|
111
|
+
<g transform="translate(50, 420)">
|
|
112
|
+
<rect x="0" y="0" width="700" height="65" rx="8" fill="#1E293B"/>
|
|
113
|
+
<text x="20" y="25" font-family="system-ui, -apple-system, sans-serif" font-size="13" font-weight="bold" fill="#F8FAFC">Benefits:</text>
|
|
114
|
+
<text x="20" y="48" font-family="system-ui, -apple-system, sans-serif" font-size="12" fill="#94A3B8">No branch switching needed</text>
|
|
115
|
+
<text x="200" y="48" font-family="system-ui, -apple-system, sans-serif" font-size="12" fill="#94A3B8">Shared git objects (minimal disk)</text>
|
|
116
|
+
<text x="430" y="48" font-family="system-ui, -apple-system, sans-serif" font-size="12" fill="#94A3B8">Instant creation via git worktree</text>
|
|
117
|
+
</g>
|
|
118
|
+
</svg>
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 300">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="cmdGrad" x1="0%" y1="0%" x2="100%" y2="0%">
|
|
4
|
+
<stop offset="0%" style="stop-color:#10B981"/>
|
|
5
|
+
<stop offset="100%" style="stop-color:#059669"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
<filter id="glow">
|
|
8
|
+
<feGaussianBlur stdDeviation="2" result="coloredBlur"/>
|
|
9
|
+
<feMerge>
|
|
10
|
+
<feMergeNode in="coloredBlur"/>
|
|
11
|
+
<feMergeNode in="SourceGraphic"/>
|
|
12
|
+
</feMerge>
|
|
13
|
+
</filter>
|
|
14
|
+
</defs>
|
|
15
|
+
|
|
16
|
+
<!-- Background -->
|
|
17
|
+
<rect width="800" height="300" fill="#0F172A"/>
|
|
18
|
+
|
|
19
|
+
<!-- Title -->
|
|
20
|
+
<text x="400" y="35" font-family="system-ui, -apple-system, sans-serif" font-size="20" font-weight="bold" fill="#F8FAFC" text-anchor="middle">Griptree Workflow</text>
|
|
21
|
+
|
|
22
|
+
<!-- Step 1: Create -->
|
|
23
|
+
<g transform="translate(60, 70)">
|
|
24
|
+
<rect x="0" y="0" width="180" height="90" rx="10" fill="#1E293B" stroke="#10B981" stroke-width="2"/>
|
|
25
|
+
<text x="90" y="25" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#10B981" text-anchor="middle">1. Create</text>
|
|
26
|
+
<text x="90" y="50" font-family="monospace" font-size="11" fill="#94A3B8" text-anchor="middle">gr griptree add</text>
|
|
27
|
+
<text x="90" y="68" font-family="monospace" font-size="11" fill="#60A5FA" text-anchor="middle">feat/my-feature</text>
|
|
28
|
+
</g>
|
|
29
|
+
|
|
30
|
+
<!-- Arrow 1 -->
|
|
31
|
+
<path d="M 250 115 L 300 115" stroke="#10B981" stroke-width="2" marker-end="url(#arrow)"/>
|
|
32
|
+
<defs>
|
|
33
|
+
<marker id="arrow" markerWidth="10" markerHeight="10" refX="8" refY="5" orient="auto">
|
|
34
|
+
<path d="M 0 0 L 10 5 L 0 10 Z" fill="#10B981"/>
|
|
35
|
+
</marker>
|
|
36
|
+
</defs>
|
|
37
|
+
|
|
38
|
+
<!-- Step 2: Work -->
|
|
39
|
+
<g transform="translate(310, 70)">
|
|
40
|
+
<rect x="0" y="0" width="180" height="90" rx="10" fill="#1E293B" stroke="#3B82F6" stroke-width="2"/>
|
|
41
|
+
<text x="90" y="25" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#3B82F6" text-anchor="middle">2. Work</text>
|
|
42
|
+
<text x="90" y="50" font-family="monospace" font-size="11" fill="#94A3B8" text-anchor="middle">cd ../feat-my-feature</text>
|
|
43
|
+
<text x="90" y="68" font-family="monospace" font-size="11" fill="#94A3B8" text-anchor="middle">gr status / commit / push</text>
|
|
44
|
+
</g>
|
|
45
|
+
|
|
46
|
+
<!-- Arrow 2 -->
|
|
47
|
+
<path d="M 500 115 L 550 115" stroke="#3B82F6" stroke-width="2" marker-end="url(#arrow2)"/>
|
|
48
|
+
<defs>
|
|
49
|
+
<marker id="arrow2" markerWidth="10" markerHeight="10" refX="8" refY="5" orient="auto">
|
|
50
|
+
<path d="M 0 0 L 10 5 L 0 10 Z" fill="#3B82F6"/>
|
|
51
|
+
</marker>
|
|
52
|
+
</defs>
|
|
53
|
+
|
|
54
|
+
<!-- Step 3: Remove -->
|
|
55
|
+
<g transform="translate(560, 70)">
|
|
56
|
+
<rect x="0" y="0" width="180" height="90" rx="10" fill="#1E293B" stroke="#F59E0B" stroke-width="2"/>
|
|
57
|
+
<text x="90" y="25" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#F59E0B" text-anchor="middle">3. Cleanup</text>
|
|
58
|
+
<text x="90" y="50" font-family="monospace" font-size="11" fill="#94A3B8" text-anchor="middle">gr griptree remove</text>
|
|
59
|
+
<text x="90" y="68" font-family="monospace" font-size="11" fill="#60A5FA" text-anchor="middle">feat/my-feature</text>
|
|
60
|
+
</g>
|
|
61
|
+
|
|
62
|
+
<!-- Commands reference -->
|
|
63
|
+
<g transform="translate(60, 190)">
|
|
64
|
+
<rect x="0" y="0" width="680" height="90" rx="8" fill="#1E293B"/>
|
|
65
|
+
<text x="20" y="25" font-family="system-ui, -apple-system, sans-serif" font-size="13" font-weight="bold" fill="#F8FAFC">Quick Reference:</text>
|
|
66
|
+
|
|
67
|
+
<text x="20" y="50" font-family="monospace" font-size="11" fill="#10B981">gr griptree add <branch></text>
|
|
68
|
+
<text x="200" y="50" font-family="system-ui, sans-serif" font-size="11" fill="#6B7280">Create parallel workspace</text>
|
|
69
|
+
|
|
70
|
+
<text x="20" y="70" font-family="monospace" font-size="11" fill="#10B981">gr griptree list</text>
|
|
71
|
+
<text x="200" y="70" font-family="system-ui, sans-serif" font-size="11" fill="#6B7280">Show all griptrees</text>
|
|
72
|
+
|
|
73
|
+
<text x="380" y="50" font-family="monospace" font-size="11" fill="#10B981">gr griptree lock <branch></text>
|
|
74
|
+
<text x="560" y="50" font-family="system-ui, sans-serif" font-size="11" fill="#6B7280">Protect from removal</text>
|
|
75
|
+
|
|
76
|
+
<text x="380" y="70" font-family="monospace" font-size="11" fill="#10B981">gr griptree remove <branch></text>
|
|
77
|
+
<text x="590" y="70" font-family="system-ui, sans-serif" font-size="11" fill="#6B7280">Remove worktrees</text>
|
|
78
|
+
</g>
|
|
79
|
+
</svg>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commit.d.ts","sourceRoot":"","sources":["../../src/commands/commit.ts"],"names":[],"mappings":"AAMA,UAAU,aAAa;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;
|
|
1
|
+
{"version":3,"file":"commit.d.ts","sourceRoot":"","sources":["../../src/commands/commit.ts"],"names":[],"mappings":"AAMA,UAAU,aAAa;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAuCD;;;GAGG;AACH,wBAAsB,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAiFlE"}
|
package/dist/commands/commit.js
CHANGED
|
@@ -26,6 +26,7 @@ async function commitChanges(repoPath, message) {
|
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* Commit staged changes across all repositories
|
|
29
|
+
* Uses two-phase parallel approach for better performance
|
|
29
30
|
*/
|
|
30
31
|
export async function commit(options) {
|
|
31
32
|
const { message, all = false } = options;
|
|
@@ -40,13 +41,12 @@ export async function commit(options) {
|
|
|
40
41
|
if (manifestInfo && await isGitRepo(manifestInfo.absolutePath)) {
|
|
41
42
|
repos = [...repos, manifestInfo];
|
|
42
43
|
}
|
|
43
|
-
const results = [];
|
|
44
|
-
let hasChanges = false;
|
|
45
44
|
console.log(chalk.blue('Checking repositories for changes...\n'));
|
|
46
|
-
|
|
45
|
+
// Phase 1: Check status and optionally stage changes in parallel
|
|
46
|
+
const repoInfoResults = await Promise.all(repos.map(async (repo) => {
|
|
47
47
|
const exists = await pathExists(repo.absolutePath);
|
|
48
48
|
if (!exists) {
|
|
49
|
-
|
|
49
|
+
return null;
|
|
50
50
|
}
|
|
51
51
|
// If --all flag, stage all changes first
|
|
52
52
|
if (all) {
|
|
@@ -57,29 +57,31 @@ export async function commit(options) {
|
|
|
57
57
|
}
|
|
58
58
|
// Check if there are staged changes
|
|
59
59
|
const hasStaged = await hasStagedChanges(repo.absolutePath);
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
return { repo, hasStaged };
|
|
61
|
+
}));
|
|
62
|
+
// Filter to repos with staged changes
|
|
63
|
+
const reposToCommit = repoInfoResults.filter((info) => info !== null && info.hasStaged);
|
|
64
|
+
if (reposToCommit.length === 0) {
|
|
65
|
+
console.log(chalk.yellow('No staged changes to commit in any repository.'));
|
|
66
|
+
if (!all) {
|
|
67
|
+
console.log(chalk.dim('Use --all to stage and commit all changes, or stage changes with git add first.'));
|
|
62
68
|
}
|
|
63
|
-
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
// Phase 2: Commit in parallel
|
|
72
|
+
const results = await Promise.all(reposToCommit.map(async ({ repo }) => {
|
|
64
73
|
const spinner = ora(`Committing ${repo.name}...`).start();
|
|
65
74
|
try {
|
|
66
75
|
await commitChanges(repo.absolutePath, message);
|
|
67
76
|
spinner.succeed(`${repo.name}: committed`);
|
|
68
|
-
|
|
77
|
+
return { repo, success: true, committed: true };
|
|
69
78
|
}
|
|
70
79
|
catch (error) {
|
|
71
80
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
72
81
|
spinner.fail(`${repo.name}: ${errorMsg}`);
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
if (!hasChanges) {
|
|
77
|
-
console.log(chalk.yellow('No staged changes to commit in any repository.'));
|
|
78
|
-
if (!all) {
|
|
79
|
-
console.log(chalk.dim('Use --all to stage and commit all changes, or stage changes with git add first.'));
|
|
82
|
+
return { repo, success: false, committed: false, error: errorMsg };
|
|
80
83
|
}
|
|
81
|
-
|
|
82
|
-
}
|
|
84
|
+
}));
|
|
83
85
|
// Summary
|
|
84
86
|
console.log('');
|
|
85
87
|
const committed = results.filter((r) => r.committed).length;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commit.js","sourceRoot":"","sources":["../../src/commands/commit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACvF,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,qBA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
|
1
|
+
interface GriptreeAddOptions {
|
|
2
|
+
path?: string;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Create a griptree (worktree-based workspace) for a branch
|
|
6
|
+
*/
|
|
7
|
+
export declare function griptreeAdd(branch: string, options?: GriptreeAddOptions): Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* List all griptrees in the workspace
|
|
10
|
+
*/
|
|
11
|
+
export declare function griptreeList(): Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* Remove a griptree
|
|
14
|
+
*/
|
|
15
|
+
export declare function griptreeRemove(branch: string, options?: {
|
|
16
|
+
force?: boolean;
|
|
17
|
+
}): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Lock a griptree to prevent accidental removal
|
|
20
|
+
*/
|
|
21
|
+
export declare function griptreeLock(branch: string): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Unlock a griptree
|
|
24
|
+
*/
|
|
25
|
+
export declare function griptreeUnlock(branch: string): Promise<void>;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=griptree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"griptree.d.ts","sourceRoot":"","sources":["../../src/commands/griptree.ts"],"names":[],"mappings":"AAUA,UAAU,kBAAkB;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAuED;;GAEG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,CA2HjG;AAED;;GAEG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAgFlD;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CA8ErG;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAmBhE;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAmBlE"}
|