lite-kits 0.1.0__py3-none-any.whl → 0.3.1__py3-none-any.whl
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.
- lite_kits/__init__.py +61 -9
- lite_kits/cli.py +788 -262
- lite_kits/core/__init__.py +19 -0
- lite_kits/core/banner.py +160 -0
- lite_kits/core/conflict_checker.py +115 -0
- lite_kits/core/detector.py +140 -0
- lite_kits/core/installer.py +322 -0
- lite_kits/core/manifest.py +146 -0
- lite_kits/core/validator.py +146 -0
- lite_kits/kits/README.md +14 -15
- lite_kits/kits/dev/README.md +241 -0
- lite_kits/kits/dev/commands/.claude/audit.md +143 -0
- lite_kits/kits/{git/claude/commands → dev/commands/.claude}/cleanup.md +2 -2
- lite_kits/kits/{git/claude/commands → dev/commands/.claude}/commit.md +2 -2
- lite_kits/kits/{project/claude/commands → dev/commands/.claude}/orient.md +30 -48
- lite_kits/kits/{git/claude/commands → dev/commands/.claude}/pr.md +1 -1
- lite_kits/kits/dev/commands/.claude/review.md +202 -0
- lite_kits/kits/dev/commands/.claude/stats.md +162 -0
- lite_kits/kits/dev/commands/.github/audit.prompt.md +143 -0
- lite_kits/kits/{git/github/prompts → dev/commands/.github}/cleanup.prompt.md +2 -2
- lite_kits/kits/{git/github/prompts → dev/commands/.github}/commit.prompt.md +2 -2
- lite_kits/kits/{project/github/prompts → dev/commands/.github}/orient.prompt.md +34 -48
- lite_kits/kits/{git/github/prompts → dev/commands/.github}/pr.prompt.md +1 -1
- lite_kits/kits/dev/commands/.github/review.prompt.md +202 -0
- lite_kits/kits/dev/commands/.github/stats.prompt.md +163 -0
- lite_kits/kits/kits.yaml +497 -0
- lite_kits/kits/multiagent/README.md +28 -17
- lite_kits/kits/multiagent/{claude/commands → commands/.claude}/sync.md +331 -331
- lite_kits/kits/multiagent/{github/prompts → commands/.github}/sync.prompt.md +73 -69
- lite_kits/kits/multiagent/memory/git-worktrees-protocol.md +370 -370
- lite_kits/kits/multiagent/memory/parallel-work-protocol.md +536 -536
- lite_kits/kits/multiagent/memory/pr-workflow-guide.md +275 -281
- lite_kits/kits/multiagent/templates/collaboration-structure/README.md +166 -166
- lite_kits/kits/multiagent/templates/decision.md +79 -79
- lite_kits/kits/multiagent/templates/handoff.md +95 -95
- lite_kits/kits/multiagent/templates/session-log.md +68 -68
- lite_kits-0.3.1.dist-info/METADATA +259 -0
- lite_kits-0.3.1.dist-info/RECORD +41 -0
- {lite_kits-0.1.0.dist-info → lite_kits-0.3.1.dist-info}/licenses/LICENSE +21 -21
- lite_kits/installer.py +0 -417
- lite_kits/kits/git/README.md +0 -374
- lite_kits/kits/git/scripts/bash/get-git-context.sh +0 -208
- lite_kits/kits/git/scripts/powershell/Get-GitContext.ps1 +0 -242
- lite_kits/kits/project/README.md +0 -244
- lite_kits-0.1.0.dist-info/METADATA +0 -415
- lite_kits-0.1.0.dist-info/RECORD +0 -31
- {lite_kits-0.1.0.dist-info → lite_kits-0.3.1.dist-info}/WHEEL +0 -0
- {lite_kits-0.1.0.dist-info → lite_kits-0.3.1.dist-info}/entry_points.txt +0 -0
lite_kits/kits/git/README.md
DELETED
@@ -1,374 +0,0 @@
|
|
1
|
-
# Git Kit
|
2
|
-
|
3
|
-
**Status**: ✅ Recommended (Default)
|
4
|
-
|
5
|
-
Git workflow automation with smart commits, PR creation, sync visualization, and cleanup operations. Includes ASCII visualization for better readability.
|
6
|
-
|
7
|
-
## What It Adds
|
8
|
-
|
9
|
-
### Commands
|
10
|
-
|
11
|
-
| Command | Claude Code | GitHub Copilot | Description |
|
12
|
-
|---------|-------------|----------------|-------------|
|
13
|
-
| `/commit` | 🚧 | 🚧 | Smart commit with agent attribution |
|
14
|
-
| `/pr` | 🚧 | 🚧 | Create PR with auto-generated description |
|
15
|
-
| `/sync` | 🚧 | 🚧 | Show sync status with ASCII visualization |
|
16
|
-
| `/cleanup` | 🚧 | 🚧 | Clean merged branches, stale worktrees |
|
17
|
-
|
18
|
-
🚧 = Coming Soon
|
19
|
-
|
20
|
-
## Installation
|
21
|
-
|
22
|
-
### As part of recommended kits:
|
23
|
-
```bash
|
24
|
-
lite-kits install -Recommended # project + git
|
25
|
-
```
|
26
|
-
|
27
|
-
### Individually:
|
28
|
-
```bash
|
29
|
-
lite-kits install -Kit git
|
30
|
-
```
|
31
|
-
|
32
|
-
## What Gets Installed
|
33
|
-
|
34
|
-
```
|
35
|
-
your-project/
|
36
|
-
├── .claude/commands/ # If Claude Code detected
|
37
|
-
│ ├── commit.md
|
38
|
-
│ ├── pr.md
|
39
|
-
│ ├── sync.md
|
40
|
-
│ └── cleanup.md
|
41
|
-
└── .github/prompts/ # If GitHub Copilot detected
|
42
|
-
├── commit.prompt.md
|
43
|
-
├── pr.prompt.md
|
44
|
-
├── sync.prompt.md
|
45
|
-
└── cleanup.prompt.md
|
46
|
-
```
|
47
|
-
|
48
|
-
**Note**: Vanilla spec-kit files are **never modified** - only new files are added.
|
49
|
-
|
50
|
-
## Commands
|
51
|
-
|
52
|
-
### `/commit` - Smart Commit (Coming Soon)
|
53
|
-
|
54
|
-
**Purpose**: Generate smart commit messages with agent attribution.
|
55
|
-
|
56
|
-
**What it will do**:
|
57
|
-
1. Run `git status` to see staged files
|
58
|
-
2. Run `git diff --staged` to see changes
|
59
|
-
3. Analyze changes and generate conventional commit message
|
60
|
-
4. Add agent attribution footer
|
61
|
-
5. Execute commit with generated message
|
62
|
-
|
63
|
-
**Example usage** (planned):
|
64
|
-
```
|
65
|
-
/commit
|
66
|
-
|
67
|
-
## Smart Commit
|
68
|
-
|
69
|
-
**Staged files**: 3
|
70
|
-
- src/auth.py (new)
|
71
|
-
- src/models.py (modified)
|
72
|
-
- tests/test_auth.py (new)
|
73
|
-
|
74
|
-
**Changes detected**:
|
75
|
-
- New feature: Authentication system
|
76
|
-
- Added User model
|
77
|
-
- Comprehensive test coverage
|
78
|
-
|
79
|
-
**Suggested commit message**:
|
80
|
-
|
81
|
-
feat: Add user authentication system
|
82
|
-
|
83
|
-
Implements bcrypt password hashing, JWT token generation,
|
84
|
-
and session management. Includes User model and comprehensive
|
85
|
-
tests with 94% coverage.
|
86
|
-
|
87
|
-
via claude-sonnet-4.5 @ claude-code
|
88
|
-
|
89
|
-
**Confirm?** (y/n): y
|
90
|
-
|
91
|
-
[dev/003-auth a1b2c3d] feat: Add user authentication system
|
92
|
-
3 files changed, 247 insertions(+)
|
93
|
-
create mode 100644 src/auth.py
|
94
|
-
create mode 100644 tests/test_auth.py
|
95
|
-
```
|
96
|
-
|
97
|
-
**Benefits**:
|
98
|
-
- Consistent commit message format
|
99
|
-
- Auto-attribution for AI-generated code
|
100
|
-
- Follows conventional commits
|
101
|
-
- Saves time thinking about messages
|
102
|
-
|
103
|
-
---
|
104
|
-
|
105
|
-
### `/pr` - Create Pull Request (Coming Soon)
|
106
|
-
|
107
|
-
**Purpose**: Create PR with auto-generated description from commits.
|
108
|
-
|
109
|
-
**What it will do**:
|
110
|
-
1. Check current branch against base (main/develop)
|
111
|
-
2. List all commits that will be in PR
|
112
|
-
3. Analyze changes across all commits
|
113
|
-
4. Generate PR title and description
|
114
|
-
5. Create PR using `gh pr create`
|
115
|
-
|
116
|
-
**Example usage** (planned):
|
117
|
-
```
|
118
|
-
/pr
|
119
|
-
|
120
|
-
## Create Pull Request
|
121
|
-
|
122
|
-
**Branch**: dev/003-auth → main
|
123
|
-
**Commits**: 5
|
124
|
-
|
125
|
-
**Changes summary**:
|
126
|
-
- Added authentication system (bcrypt + JWT)
|
127
|
-
- Created User model with validation
|
128
|
-
- Added login/logout API endpoints
|
129
|
-
- Comprehensive test suite (94% coverage)
|
130
|
-
- Updated API documentation
|
131
|
-
|
132
|
-
**Generated PR**:
|
133
|
-
|
134
|
-
Title: feat: Add user authentication system
|
135
|
-
|
136
|
-
Body:
|
137
|
-
## Summary
|
138
|
-
- Implements bcrypt password hashing
|
139
|
-
- JWT token generation and validation
|
140
|
-
- Session management
|
141
|
-
- User model with SQLAlchemy
|
142
|
-
|
143
|
-
## Changes
|
144
|
-
- `src/auth.py` - Authentication logic
|
145
|
-
- `src/models.py` - User model
|
146
|
-
- `src/api/auth_routes.py` - Login/logout endpoints
|
147
|
-
- `tests/test_auth.py` - Test suite (94% coverage)
|
148
|
-
|
149
|
-
## Test Plan
|
150
|
-
- [x] Unit tests passing (24/24)
|
151
|
-
- [x] Manual testing of login flow
|
152
|
-
- [x] Password validation tested
|
153
|
-
- [ ] Security review pending
|
154
|
-
|
155
|
-
## Related
|
156
|
-
- Implements: specs/003-user-auth/spec.md
|
157
|
-
- Closes: #42
|
158
|
-
|
159
|
-
🤖 Generated with spec-kit-multiagent
|
160
|
-
via claude-sonnet-4.5 @ claude-code
|
161
|
-
|
162
|
-
**Create PR?** (y/n): y
|
163
|
-
|
164
|
-
✓ Pull request created: https://github.com/user/repo/pull/15
|
165
|
-
```
|
166
|
-
|
167
|
-
---
|
168
|
-
|
169
|
-
### `/sync` - Sync Status with Visualization (Coming Soon)
|
170
|
-
|
171
|
-
**Purpose**: Show git sync status with ASCII visualization.
|
172
|
-
|
173
|
-
**Problem**: `git status` output is text-heavy and hard to parse visually.
|
174
|
-
|
175
|
-
**Solution**: ASCII tree diagrams and colorized status.
|
176
|
-
|
177
|
-
**Example usage** (planned):
|
178
|
-
```
|
179
|
-
/sync
|
180
|
-
|
181
|
-
## Git Sync Status
|
182
|
-
|
183
|
-
**Branch**: dev/003-auth
|
184
|
-
**Tracking**: origin/dev/003-auth
|
185
|
-
|
186
|
-
**Local vs Remote**:
|
187
|
-
|
188
|
-
origin/main ─────────────┬──────> main (up to date)
|
189
|
-
│
|
190
|
-
├──────> dev/003-auth (5 commits ahead)
|
191
|
-
│ ↑ PUSH NEEDED
|
192
|
-
│
|
193
|
-
Your commits: │
|
194
|
-
├─ a1b2c3d feat: Add auth│
|
195
|
-
├─ b2c3d4e feat: Add user│
|
196
|
-
├─ c3d4e5f test: Add auth│
|
197
|
-
├─ d4e5f6g docs: Update │
|
198
|
-
└─ e5f6g7h fix: Resolve │
|
199
|
-
│
|
200
|
-
**Status**:
|
201
|
-
✓ No uncommitted changes
|
202
|
-
⚠ 5 commits not pushed
|
203
|
-
✓ Up to date with remote (fetched 2m ago)
|
204
|
-
|
205
|
-
**Actions**:
|
206
|
-
1. git push origin dev/003-auth
|
207
|
-
2. git fetch (refresh remote status)
|
208
|
-
3. /pr (create pull request)
|
209
|
-
|
210
|
-
**Worktrees** (if any):
|
211
|
-
None active
|
212
|
-
|
213
|
-
**Branches** (recent):
|
214
|
-
- dev/003-auth (current) ← 5 commits ahead
|
215
|
-
- main (up to date)
|
216
|
-
- dev/002-blog (merged, can cleanup)
|
217
|
-
```
|
218
|
-
|
219
|
-
**Benefits**:
|
220
|
-
- Visual understanding at a glance
|
221
|
-
- Clear action items
|
222
|
-
- Worktree awareness
|
223
|
-
- Branch cleanup suggestions
|
224
|
-
|
225
|
-
---
|
226
|
-
|
227
|
-
### `/cleanup` - Git Cleanup (Coming Soon)
|
228
|
-
|
229
|
-
**Purpose**: Clean up merged branches, stale worktrees, and old features.
|
230
|
-
|
231
|
-
**What it will do**:
|
232
|
-
1. Detect merged branches (local and remote)
|
233
|
-
2. Find stale worktrees
|
234
|
-
3. Identify old feature directories in `specs/`
|
235
|
-
4. Suggest safe cleanup actions
|
236
|
-
5. Execute cleanup with confirmation
|
237
|
-
|
238
|
-
**Example usage** (planned):
|
239
|
-
```
|
240
|
-
/cleanup
|
241
|
-
|
242
|
-
## Git Cleanup
|
243
|
-
|
244
|
-
**Merged branches** (safe to delete):
|
245
|
-
- dev/001-init (merged 2 weeks ago)
|
246
|
-
- dev/002-blog (merged 1 week ago)
|
247
|
-
- feature/old-experiment (merged 3 months ago)
|
248
|
-
|
249
|
-
**Stale worktrees**:
|
250
|
-
- ../blog-backend (branch merged, worktree orphaned)
|
251
|
-
|
252
|
-
**Old feature specs**:
|
253
|
-
- specs/001-init/ (merged, archived?)
|
254
|
-
|
255
|
-
**Cleanup plan**:
|
256
|
-
1. Delete 3 merged local branches
|
257
|
-
2. Delete 2 merged remote branches
|
258
|
-
3. Remove 1 stale worktree
|
259
|
-
4. Suggest archiving specs/001-init/
|
260
|
-
|
261
|
-
**Disk space freed**: ~45 MB
|
262
|
-
|
263
|
-
**Proceed?** (y/n): y
|
264
|
-
|
265
|
-
✓ Deleted branch dev/001-init
|
266
|
-
✓ Deleted branch dev/002-blog
|
267
|
-
✓ Deleted branch feature/old-experiment
|
268
|
-
✓ Deleted remote branch origin/dev/001-init
|
269
|
-
✓ Removed stale worktree ../blog-backend
|
270
|
-
⚠ Manual action: Archive specs/001-init/ to specs/.archive/
|
271
|
-
|
272
|
-
**Cleanup complete!**
|
273
|
-
```
|
274
|
-
|
275
|
-
---
|
276
|
-
|
277
|
-
## ASCII Visualization Examples
|
278
|
-
|
279
|
-
Git-kit emphasizes visual output because AI agents are good at generating ASCII art and it makes git status much easier to understand.
|
280
|
-
|
281
|
-
### Branch Relationships
|
282
|
-
```
|
283
|
-
main ──────────┬──────────> origin/main (synced)
|
284
|
-
│
|
285
|
-
├─ develop ──> origin/develop (2 ahead, 1 behind)
|
286
|
-
│ ↕ PULL & PUSH NEEDED
|
287
|
-
│ │
|
288
|
-
│ ├─ dev/001-kits (current, 3 ahead)
|
289
|
-
│ │ ↑ PUSH NEEDED
|
290
|
-
│ │
|
291
|
-
│ └─ dev/002-examples (merged)
|
292
|
-
│ 🗑 CAN DELETE
|
293
|
-
│
|
294
|
-
└─ hotfix/security (1 ahead)
|
295
|
-
⚠ URGENT PUSH
|
296
|
-
```
|
297
|
-
|
298
|
-
### Commit Graph
|
299
|
-
```
|
300
|
-
Commits ahead of main:
|
301
|
-
|
302
|
-
* e5f6g7h (HEAD) fix: Resolve merge conflict
|
303
|
-
│
|
304
|
-
* d4e5f6g docs: Update README
|
305
|
-
│
|
306
|
-
* c3d4e5f test: Add auth tests
|
307
|
-
│
|
308
|
-
* b2c3d4e feat: Add User model
|
309
|
-
│
|
310
|
-
* a1b2c3d feat: Add auth system
|
311
|
-
│
|
312
|
-
o ─────── (origin/main)
|
313
|
-
```
|
314
|
-
|
315
|
-
---
|
316
|
-
|
317
|
-
## Use Cases
|
318
|
-
|
319
|
-
### Daily Development
|
320
|
-
**Use**: `/commit` for every commit, `/sync` multiple times per day
|
321
|
-
|
322
|
-
### Before Creating PR
|
323
|
-
**Use**: `/sync` to ensure up to date, `/pr` to create pull request
|
324
|
-
|
325
|
-
### Weekly Maintenance
|
326
|
-
**Use**: `/cleanup` to remove merged branches and free up space
|
327
|
-
|
328
|
-
### Multi-Agent Projects
|
329
|
-
**Combine with**: multiagent-kit for coordination
|
330
|
-
**Use**: `/sync` shows worktree status for parallel development
|
331
|
-
|
332
|
-
---
|
333
|
-
|
334
|
-
## Dependencies
|
335
|
-
|
336
|
-
**None** - git-kit is standalone.
|
337
|
-
|
338
|
-
**Requires**: Git 2.0+, optionally `gh` CLI for `/pr` command
|
339
|
-
|
340
|
-
**Recommended with**: multiagent-kit (for worktree visualization)
|
341
|
-
|
342
|
-
---
|
343
|
-
|
344
|
-
## Compatibility
|
345
|
-
|
346
|
-
- ✅ **Agents**: Claude Code, GitHub Copilot
|
347
|
-
- ✅ **Platforms**: Linux, macOS, Windows
|
348
|
-
- ✅ **Shells**: Bash, PowerShell (ASCII works in both!)
|
349
|
-
- ✅ **Vanilla safe**: Only adds new files, never modifies existing
|
350
|
-
|
351
|
-
---
|
352
|
-
|
353
|
-
## Uninstall
|
354
|
-
|
355
|
-
```bash
|
356
|
-
lite-kits remove -Kit git
|
357
|
-
```
|
358
|
-
|
359
|
-
Removes:
|
360
|
-
- `.claude/commands/{commit,pr,sync,cleanup}.md`
|
361
|
-
- `.github/prompts/{commit,pr,sync,cleanup}.prompt.md`
|
362
|
-
|
363
|
-
---
|
364
|
-
|
365
|
-
## Future Enhancements
|
366
|
-
|
367
|
-
Considering for git-kit:
|
368
|
-
- `/rebase` - Interactive rebase helper
|
369
|
-
- `/stash` - Stash management with visualization
|
370
|
-
- `/blame` - Enhanced git blame with agent attribution
|
371
|
-
- `/conflicts` - Merge conflict resolver helper
|
372
|
-
- `/bisect` - Git bisect helper for finding bugs
|
373
|
-
|
374
|
-
Suggest more in [GitHub Discussions](https://github.com/tmorgan181/spec-kit-multiagent-lite/discussions).
|
@@ -1,208 +0,0 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
set -euo pipefail
|
3
|
-
|
4
|
-
# get-git-context.sh
|
5
|
-
# Gathers comprehensive git repository context for AI agents
|
6
|
-
|
7
|
-
show_help() {
|
8
|
-
cat << EOF
|
9
|
-
Usage: get-git-context.sh [OPTIONS]
|
10
|
-
|
11
|
-
Gathers git status, branch information, recent commits, and change statistics
|
12
|
-
in a structured format suitable for AI agent orientation and commit workflows.
|
13
|
-
|
14
|
-
OPTIONS:
|
15
|
-
-c, --commits NUM Number of recent commits to include (default: 5)
|
16
|
-
-f, --format FORMAT Output format: text, json (default: text)
|
17
|
-
-n, --no-diff Exclude diff statistics
|
18
|
-
-h, --help Show this help message
|
19
|
-
|
20
|
-
EXAMPLES:
|
21
|
-
get-git-context.sh
|
22
|
-
get-git-context.sh --commits 10
|
23
|
-
get-git-context.sh --format json
|
24
|
-
EOF
|
25
|
-
}
|
26
|
-
|
27
|
-
# Default options
|
28
|
-
INCLUDE_COMMITS=5
|
29
|
-
FORMAT="text"
|
30
|
-
INCLUDE_DIFF=true
|
31
|
-
|
32
|
-
# Parse arguments
|
33
|
-
while [[ $# -gt 0 ]]; do
|
34
|
-
case $1 in
|
35
|
-
-c|--commits)
|
36
|
-
INCLUDE_COMMITS="$2"
|
37
|
-
shift 2
|
38
|
-
;;
|
39
|
-
-f|--format)
|
40
|
-
FORMAT="$2"
|
41
|
-
shift 2
|
42
|
-
;;
|
43
|
-
-n|--no-diff)
|
44
|
-
INCLUDE_DIFF=false
|
45
|
-
shift
|
46
|
-
;;
|
47
|
-
-h|--help)
|
48
|
-
show_help
|
49
|
-
exit 0
|
50
|
-
;;
|
51
|
-
*)
|
52
|
-
echo "Unknown option: $1"
|
53
|
-
show_help
|
54
|
-
exit 1
|
55
|
-
;;
|
56
|
-
esac
|
57
|
-
done
|
58
|
-
|
59
|
-
# Check if we're in a git repository
|
60
|
-
if ! git rev-parse --git-dir >/dev/null 2>&1; then
|
61
|
-
echo "Error: Not a git repository" >&2
|
62
|
-
exit 1
|
63
|
-
fi
|
64
|
-
|
65
|
-
# Gather git context
|
66
|
-
BRANCH=$(git branch --show-current)
|
67
|
-
COMMIT_HASH=$(git rev-parse --short HEAD 2>/dev/null || echo "")
|
68
|
-
|
69
|
-
# Count file statuses
|
70
|
-
STAGED_COUNT=0
|
71
|
-
UNSTAGED_COUNT=0
|
72
|
-
UNTRACKED_COUNT=0
|
73
|
-
|
74
|
-
while IFS= read -r line; do
|
75
|
-
if [[ -n "$line" ]]; then
|
76
|
-
STATUS="${line:0:2}"
|
77
|
-
|
78
|
-
# Staged files (first character)
|
79
|
-
if [[ "${STATUS:0:1}" =~ [MADRC] ]]; then
|
80
|
-
((STAGED_COUNT++))
|
81
|
-
fi
|
82
|
-
|
83
|
-
# Unstaged files (second character)
|
84
|
-
if [[ "${STATUS:1:1}" =~ [MD] ]]; then
|
85
|
-
((UNSTAGED_COUNT++))
|
86
|
-
fi
|
87
|
-
|
88
|
-
# Untracked files
|
89
|
-
if [[ "$STATUS" == "??" ]]; then
|
90
|
-
((UNTRACKED_COUNT++))
|
91
|
-
fi
|
92
|
-
fi
|
93
|
-
done < <(git status --porcelain)
|
94
|
-
|
95
|
-
# Get remote tracking info
|
96
|
-
TRACKING=$(git rev-parse --abbrev-ref --symbolic-full-name '@{u}' 2>/dev/null || echo "")
|
97
|
-
AHEAD=0
|
98
|
-
BEHIND=0
|
99
|
-
|
100
|
-
if [[ -n "$TRACKING" ]]; then
|
101
|
-
# Get ahead/behind counts
|
102
|
-
AHEAD_BEHIND=$(git rev-list --left-right --count "$TRACKING"..HEAD 2>/dev/null || echo "0 0")
|
103
|
-
AHEAD=$(echo "$AHEAD_BEHIND" | awk '{print $1}')
|
104
|
-
BEHIND=$(echo "$AHEAD_BEHIND" | awk '{print $2}')
|
105
|
-
fi
|
106
|
-
|
107
|
-
# Get remote URL
|
108
|
-
REMOTE_URL=$(git remote get-url origin 2>/dev/null || echo "")
|
109
|
-
|
110
|
-
# Get diff statistics
|
111
|
-
INSERTIONS=0
|
112
|
-
DELETIONS=0
|
113
|
-
FILES_CHANGED=0
|
114
|
-
|
115
|
-
if [[ "$INCLUDE_DIFF" == true ]] && [[ $STAGED_COUNT -gt 0 ]]; then
|
116
|
-
while IFS= read -r line; do
|
117
|
-
if [[ -n "$line" ]]; then
|
118
|
-
INS=$(echo "$line" | awk '{print $1}')
|
119
|
-
DEL=$(echo "$line" | awk '{print $2}')
|
120
|
-
|
121
|
-
# Handle binary files (-)
|
122
|
-
[[ "$INS" != "-" ]] && INSERTIONS=$((INSERTIONS + INS))
|
123
|
-
[[ "$DEL" != "-" ]] && DELETIONS=$((DELETIONS + DEL))
|
124
|
-
((FILES_CHANGED++))
|
125
|
-
fi
|
126
|
-
done < <(git diff --cached --numstat)
|
127
|
-
fi
|
128
|
-
|
129
|
-
# Output based on format
|
130
|
-
if [[ "$FORMAT" == "json" ]]; then
|
131
|
-
# JSON output
|
132
|
-
cat << EOF
|
133
|
-
{
|
134
|
-
"branch": "$BRANCH",
|
135
|
-
"commitHash": "$COMMIT_HASH",
|
136
|
-
"status": {
|
137
|
-
"counts": {
|
138
|
-
"staged": $STAGED_COUNT,
|
139
|
-
"unstaged": $UNSTAGED_COUNT,
|
140
|
-
"untracked": $UNTRACKED_COUNT
|
141
|
-
}
|
142
|
-
},
|
143
|
-
"remote": {
|
144
|
-
"tracking": "$TRACKING",
|
145
|
-
"url": "$REMOTE_URL",
|
146
|
-
"ahead": $AHEAD,
|
147
|
-
"behind": $BEHIND
|
148
|
-
},
|
149
|
-
"stats": {
|
150
|
-
"filesChanged": $FILES_CHANGED,
|
151
|
-
"insertions": $INSERTIONS,
|
152
|
-
"deletions": $DELETIONS
|
153
|
-
}
|
154
|
-
}
|
155
|
-
EOF
|
156
|
-
else
|
157
|
-
# Text output
|
158
|
-
echo "==============================================================="
|
159
|
-
echo "📊 Git Status (on: $BRANCH):"
|
160
|
-
echo "==============================================================="
|
161
|
-
echo "Staged: $STAGED_COUNT files"
|
162
|
-
echo "Unstaged: $UNSTAGED_COUNT files"
|
163
|
-
echo "Untracked: $UNTRACKED_COUNT files"
|
164
|
-
|
165
|
-
if [[ -n "$TRACKING" ]]; then
|
166
|
-
echo ""
|
167
|
-
echo "Remote: $TRACKING"
|
168
|
-
if [[ $AHEAD -gt 0 ]]; then
|
169
|
-
echo " Ahead by $AHEAD commit(s)"
|
170
|
-
fi
|
171
|
-
if [[ $BEHIND -gt 0 ]]; then
|
172
|
-
echo " Behind by $BEHIND commit(s)"
|
173
|
-
fi
|
174
|
-
fi
|
175
|
-
|
176
|
-
if [[ $STAGED_COUNT -gt 0 ]]; then
|
177
|
-
echo ""
|
178
|
-
echo "Staged files:"
|
179
|
-
git status --porcelain | grep '^[MADRC]' | while IFS= read -r line; do
|
180
|
-
echo " ${line:0:2} ${line:3}"
|
181
|
-
done
|
182
|
-
fi
|
183
|
-
|
184
|
-
if [[ $UNSTAGED_COUNT -gt 0 ]]; then
|
185
|
-
echo ""
|
186
|
-
echo "Unstaged files:"
|
187
|
-
git status --porcelain | grep '^ [MD]' | while IFS= read -r line; do
|
188
|
-
echo " ${line:0:2} ${line:3}"
|
189
|
-
done
|
190
|
-
fi
|
191
|
-
|
192
|
-
if [[ $UNTRACKED_COUNT -gt 0 ]]; then
|
193
|
-
echo ""
|
194
|
-
echo "Untracked files:"
|
195
|
-
git status --porcelain | grep '^??' | while IFS= read -r line; do
|
196
|
-
echo " ${line:0:2} ${line:3}"
|
197
|
-
done
|
198
|
-
fi
|
199
|
-
|
200
|
-
if [[ $INCLUDE_COMMITS -gt 0 ]]; then
|
201
|
-
echo ""
|
202
|
-
echo "Recent commits:"
|
203
|
-
git log -n "$INCLUDE_COMMITS" --pretty=format:' %h %s (%ar)' --abbrev-commit
|
204
|
-
echo ""
|
205
|
-
fi
|
206
|
-
|
207
|
-
echo "==============================================================="
|
208
|
-
fi
|